forlogic-core 2.2.8 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1684) hide show
  1. package/.note/memory/patterns/dynamic-supabase-config.md +2 -2
  2. package/.note/memory/patterns/environment-detection-logic.md +21 -15
  3. package/README.md +22 -2
  4. package/dist/action-plans/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  5. package/dist/action-plans/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  6. package/dist/action-plans/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  7. package/dist/action-plans/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  8. package/dist/action-plans/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  9. package/dist/action-plans/action-plans/components/ActionPlanPage.d.ts +25 -0
  10. package/dist/action-plans/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  11. package/dist/action-plans/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  12. package/dist/action-plans/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  13. package/dist/action-plans/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  14. package/dist/action-plans/action-plans/constants.d.ts +86 -0
  15. package/dist/action-plans/action-plans/hooks/useActionPlan.d.ts +19 -0
  16. package/dist/action-plans/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  17. package/dist/action-plans/action-plans/index.d.ts +15 -0
  18. package/dist/action-plans/action-plans/types.d.ts +413 -0
  19. package/dist/action-plans/action-plans/utils/formatTime.d.ts +24 -0
  20. package/dist/action-plans/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  21. package/dist/action-plans/approval-flow/components/ApproveDialog.d.ts +13 -0
  22. package/dist/action-plans/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  23. package/dist/action-plans/approval-flow/index.d.ts +4 -0
  24. package/dist/action-plans/approval-flow/types.d.ts +76 -0
  25. package/dist/action-plans/assets/index.d.ts +7 -0
  26. package/dist/action-plans/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  27. package/dist/action-plans/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  28. package/dist/action-plans/audit-trail/components/AuditTrailPage.d.ts +40 -0
  29. package/dist/action-plans/audit-trail/index.d.ts +9 -0
  30. package/dist/action-plans/audit-trail/types.d.ts +209 -0
  31. package/dist/action-plans/audit-trail/utils.d.ts +54 -0
  32. package/dist/action-plans/auth/components/AliasRedirect.d.ts +13 -0
  33. package/dist/action-plans/auth/components/AliasRouteGuard.d.ts +20 -0
  34. package/dist/action-plans/auth/components/EditProfileDialog.d.ts +13 -0
  35. package/dist/action-plans/auth/components/ProtectedRoute.d.ts +11 -0
  36. package/dist/action-plans/auth/components/UserInfo.d.ts +10 -0
  37. package/dist/action-plans/auth/contexts/AuthContext.d.ts +89 -0
  38. package/dist/action-plans/auth/pages/CallbackPage.d.ts +6 -0
  39. package/dist/action-plans/auth/pages/LoginPage.d.ts +2 -0
  40. package/dist/action-plans/auth/services/AuthService.d.ts +45 -0
  41. package/dist/action-plans/auth/services/SupabaseTokenService.d.ts +3 -0
  42. package/dist/action-plans/auth/services/TokenManager.d.ts +66 -0
  43. package/dist/action-plans/auth/services/TokenRegenerationService.d.ts +14 -0
  44. package/dist/action-plans/auth/services/TokenService.d.ts +48 -0
  45. package/dist/action-plans/auth/utils/ErrorInterceptor.d.ts +20 -0
  46. package/dist/action-plans/components/ErrorBoundary.d.ts +19 -0
  47. package/dist/action-plans/components/dashboards/dashboard-form.d.ts +65 -0
  48. package/dist/action-plans/components/dashboards/dashboard-general-view.d.ts +124 -0
  49. package/dist/action-plans/components/dashboards/dashboard-grid.d.ts +66 -0
  50. package/dist/action-plans/components/dashboards/dashboard-list.d.ts +41 -0
  51. package/dist/action-plans/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  52. package/dist/action-plans/components/dashboards/dashboard-view.d.ts +48 -0
  53. package/dist/action-plans/components/dashboards/helpers.d.ts +86 -0
  54. package/dist/action-plans/components/dashboards/index.d.ts +9 -0
  55. package/dist/action-plans/components/dashboards/panels/burndown-panel.d.ts +41 -0
  56. package/dist/action-plans/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  57. package/dist/action-plans/components/dashboards/panels/index.d.ts +14 -0
  58. package/dist/action-plans/components/dashboards/panels/list-panel.d.ts +45 -0
  59. package/dist/action-plans/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  60. package/dist/action-plans/components/dashboards/panels/numeric-panel.d.ts +32 -0
  61. package/dist/action-plans/components/dashboards/panels/panel-error.d.ts +18 -0
  62. package/dist/action-plans/components/dashboards/panels/panel-header.d.ts +27 -0
  63. package/dist/action-plans/components/dashboards/panels/panel-loader.d.ts +17 -0
  64. package/dist/action-plans/components/dashboards/panels/panel-no-data.d.ts +16 -0
  65. package/dist/action-plans/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  66. package/dist/action-plans/components/dashboards/panels/pareto-panel.d.ts +30 -0
  67. package/dist/action-plans/components/dashboards/panels/performance-panel.d.ts +39 -0
  68. package/dist/action-plans/components/dashboards/panels/pie-panel.d.ts +29 -0
  69. package/dist/action-plans/components/dashboards/panels/text-panel.d.ts +28 -0
  70. package/dist/action-plans/components/dashboards/types.d.ts +755 -0
  71. package/dist/action-plans/components/layout/AppHeader.d.ts +6 -0
  72. package/dist/action-plans/components/layout/AppLayout.d.ts +10 -0
  73. package/dist/action-plans/components/layout/AppSidebar.d.ts +10 -0
  74. package/dist/action-plans/components/layout/BodyContent.d.ts +60 -0
  75. package/dist/action-plans/components/layout/SidebarActionTrigger.d.ts +46 -0
  76. package/dist/action-plans/components/layout/SidebarHeader.d.ts +5 -0
  77. package/dist/action-plans/components/layout/SidebarLogo.d.ts +5 -0
  78. package/dist/action-plans/components/layout/sidebar-utils.d.ts +12 -0
  79. package/dist/action-plans/components/modules/AccessDeniedDialog.d.ts +43 -0
  80. package/dist/action-plans/components/modules/ModuleAccessGuard.d.ts +42 -0
  81. package/dist/action-plans/components/modules/ModuleGrid.d.ts +9 -0
  82. package/dist/action-plans/components/modules/ModuleOfferContent.d.ts +20 -0
  83. package/dist/action-plans/components/modules/ModulesContent.d.ts +21 -0
  84. package/dist/action-plans/components/modules/ModulesDialog.d.ts +3 -0
  85. package/dist/action-plans/components/modules/ModulesFooterCards.d.ts +10 -0
  86. package/dist/action-plans/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  87. package/dist/action-plans/components/modules/index.d.ts +14 -0
  88. package/dist/action-plans/components/modules/modulesData.d.ts +6 -0
  89. package/dist/action-plans/components/modules/types.d.ts +41 -0
  90. package/dist/action-plans/components/ui/accordion.d.ts +42 -0
  91. package/dist/action-plans/components/ui/action-button.d.ts +48 -0
  92. package/dist/action-plans/components/ui/alert-dialog.d.ts +102 -0
  93. package/dist/action-plans/components/ui/alert.d.ts +44 -0
  94. package/dist/action-plans/components/ui/avatar.d.ts +36 -0
  95. package/dist/action-plans/components/ui/badge.d.ts +41 -0
  96. package/dist/action-plans/components/ui/breadcrumb.d.ts +73 -0
  97. package/dist/action-plans/components/ui/button-group.d.ts +24 -0
  98. package/dist/action-plans/components/ui/button.d.ts +66 -0
  99. package/dist/action-plans/components/ui/calendar.d.ts +24 -0
  100. package/dist/action-plans/components/ui/card.d.ts +57 -0
  101. package/dist/action-plans/components/ui/chart.d.ts +97 -0
  102. package/dist/action-plans/components/ui/checkbox.d.ts +15 -0
  103. package/dist/action-plans/components/ui/collapsible.d.ts +20 -0
  104. package/dist/action-plans/components/ui/color-picker.d.ts +19 -0
  105. package/dist/action-plans/components/ui/combo-tree.d.ts +103 -0
  106. package/dist/action-plans/components/ui/combobox.d.ts +64 -0
  107. package/dist/action-plans/components/ui/command.d.ts +89 -0
  108. package/dist/action-plans/components/ui/context-menu.d.ts +122 -0
  109. package/dist/action-plans/components/ui/data-list.d.ts +86 -0
  110. package/dist/action-plans/components/ui/date-picker.d.ts +19 -0
  111. package/dist/action-plans/components/ui/dialog-wizard.d.ts +100 -0
  112. package/dist/action-plans/components/ui/dialog.d.ts +229 -0
  113. package/dist/action-plans/components/ui/disabled-menu-item.d.ts +25 -0
  114. package/dist/action-plans/components/ui/drawer.d.ts +94 -0
  115. package/dist/action-plans/components/ui/dropdown-menu.d.ts +180 -0
  116. package/dist/action-plans/components/ui/electronic-signature-dialog.d.ts +31 -0
  117. package/dist/action-plans/components/ui/empty-state.d.ts +79 -0
  118. package/dist/action-plans/components/ui/export-dialog.d.ts +48 -0
  119. package/dist/action-plans/components/ui/form.d.ts +119 -0
  120. package/dist/action-plans/components/ui/grid.d.ts +53 -0
  121. package/dist/action-plans/components/ui/hover-card.d.ts +21 -0
  122. package/dist/action-plans/components/ui/icon-picker.d.ts +17 -0
  123. package/dist/action-plans/components/ui/iframe-dialog.d.ts +24 -0
  124. package/dist/action-plans/components/ui/input-group.d.ts +113 -0
  125. package/dist/action-plans/components/ui/input.d.ts +24 -0
  126. package/dist/action-plans/components/ui/label.d.ts +23 -0
  127. package/dist/action-plans/components/ui/loading-state.d.ts +52 -0
  128. package/dist/action-plans/components/ui/menubar.d.ts +113 -0
  129. package/dist/action-plans/components/ui/multiselect-permissions.d.ts +84 -0
  130. package/dist/action-plans/components/ui/navigation-menu.d.ts +57 -0
  131. package/dist/action-plans/components/ui/onboarding-dialog.d.ts +58 -0
  132. package/dist/action-plans/components/ui/online-editor-dialog.d.ts +28 -0
  133. package/dist/action-plans/components/ui/page-breadcrumb.d.ts +77 -0
  134. package/dist/action-plans/components/ui/pagination.d.ts +81 -0
  135. package/dist/action-plans/components/ui/popover.d.ts +57 -0
  136. package/dist/action-plans/components/ui/progress.d.ts +22 -0
  137. package/dist/action-plans/components/ui/radio-group.d.ts +66 -0
  138. package/dist/action-plans/components/ui/report-request-list.d.ts +64 -0
  139. package/dist/action-plans/components/ui/resizable.d.ts +38 -0
  140. package/dist/action-plans/components/ui/rich-text-editor.d.ts +58 -0
  141. package/dist/action-plans/components/ui/scroll-area.d.ts +40 -0
  142. package/dist/action-plans/components/ui/select.d.ts +94 -0
  143. package/dist/action-plans/components/ui/separator.d.ts +17 -0
  144. package/dist/action-plans/components/ui/sheet.d.ts +108 -0
  145. package/dist/action-plans/components/ui/sidebar.d.ts +269 -0
  146. package/dist/action-plans/components/ui/skeleton-variants.d.ts +41 -0
  147. package/dist/action-plans/components/ui/skeleton.d.ts +14 -0
  148. package/dist/action-plans/components/ui/slider.d.ts +9 -0
  149. package/dist/action-plans/components/ui/sonner.d.ts +8 -0
  150. package/dist/action-plans/components/ui/spinner.d.ts +11 -0
  151. package/dist/action-plans/components/ui/split-button.d.ts +76 -0
  152. package/dist/action-plans/components/ui/stack.d.ts +17 -0
  153. package/dist/action-plans/components/ui/status-badge.d.ts +52 -0
  154. package/dist/action-plans/components/ui/step-selector.d.ts +46 -0
  155. package/dist/action-plans/components/ui/stimulsoft-viewer.d.ts +28 -0
  156. package/dist/action-plans/components/ui/switch.d.ts +25 -0
  157. package/dist/action-plans/components/ui/tab-page-layout.d.ts +52 -0
  158. package/dist/action-plans/components/ui/table-resize-handle.d.ts +22 -0
  159. package/dist/action-plans/components/ui/table.d.ts +112 -0
  160. package/dist/action-plans/components/ui/tabs.d.ts +66 -0
  161. package/dist/action-plans/components/ui/terms-of-use-dialog.d.ts +102 -0
  162. package/dist/action-plans/components/ui/textarea.d.ts +33 -0
  163. package/dist/action-plans/components/ui/timepicker.d.ts +34 -0
  164. package/dist/action-plans/components/ui/toggle-group.d.ts +37 -0
  165. package/dist/action-plans/components/ui/toggle.d.ts +33 -0
  166. package/dist/action-plans/components/ui/tooltip.d.ts +61 -0
  167. package/dist/action-plans/components/ui/truncated-cell.d.ts +20 -0
  168. package/dist/action-plans/components/ui/typography.d.ts +135 -0
  169. package/dist/action-plans/components/ui/updates-notification.d.ts +47 -0
  170. package/dist/action-plans/components/ui/users-groups-selector.d.ts +87 -0
  171. package/dist/action-plans/components/ui/viewer-dialog.d.ts +184 -0
  172. package/dist/action-plans/config/backend.d.ts +10 -0
  173. package/dist/action-plans/config/environments.d.ts +27 -0
  174. package/dist/action-plans/config/index.d.ts +75 -0
  175. package/dist/action-plans/contexts/LocaleContext.d.ts +15 -0
  176. package/dist/action-plans/contexts/ModalStateContext.d.ts +57 -0
  177. package/dist/action-plans/contexts/ModuleContext.d.ts +34 -0
  178. package/dist/action-plans/contexts/NavigationContext.d.ts +13 -0
  179. package/dist/action-plans/contexts/PageMetadataContext.d.ts +48 -0
  180. package/dist/action-plans/crud/components/ActionMenuItems.d.ts +22 -0
  181. package/dist/action-plans/crud/components/BaseForm.d.ts +52 -0
  182. package/dist/action-plans/crud/components/ColumnSettingsPopover.d.ts +28 -0
  183. package/dist/action-plans/crud/components/ContextMenu.d.ts +21 -0
  184. package/dist/action-plans/crud/components/CrudActionBar.d.ts +59 -0
  185. package/dist/action-plans/crud/components/CrudGrid.d.ts +53 -0
  186. package/dist/action-plans/crud/components/CrudPagination.d.ts +17 -0
  187. package/dist/action-plans/crud/components/CrudTable.d.ts +66 -0
  188. package/dist/action-plans/crud/components/FilterBar.d.ts +136 -0
  189. package/dist/action-plans/crud/components/GroupDropZone.d.ts +16 -0
  190. package/dist/action-plans/crud/components/InlineRowActions.d.ts +15 -0
  191. package/dist/action-plans/crud/components/SelectionCheckbox.d.ts +9 -0
  192. package/dist/action-plans/crud/components/TableFooter.d.ts +14 -0
  193. package/dist/action-plans/crud/components/TableRowActions.d.ts +19 -0
  194. package/dist/action-plans/crud/createCrudPage.d.ts +134 -0
  195. package/dist/action-plans/crud/createSimpleService.d.ts +85 -0
  196. package/dist/action-plans/crud/generateCrudConfig.d.ts +78 -0
  197. package/dist/action-plans/crud/hooks/useBaseForm.d.ts +47 -0
  198. package/dist/action-plans/crud/hooks/useColumnDragReorder.d.ts +19 -0
  199. package/dist/action-plans/crud/hooks/useColumnManager.d.ts +85 -0
  200. package/dist/action-plans/crud/hooks/useCrud.d.ts +152 -0
  201. package/dist/action-plans/crud/primitives/ActionMenu.d.ts +69 -0
  202. package/dist/action-plans/crud/primitives/FilterBar.d.ts +69 -0
  203. package/dist/action-plans/crud/primitives/Pagination.d.ts +29 -0
  204. package/dist/action-plans/crud/primitives/Table.d.ts +31 -0
  205. package/dist/action-plans/crud/primitives/TreeTable.d.ts +7 -0
  206. package/dist/action-plans/crud/primitives/index.d.ts +12 -0
  207. package/dist/action-plans/crud/primitives/types.d.ts +199 -0
  208. package/dist/action-plans/crud/utils/routingHelpers.d.ts +41 -0
  209. package/dist/action-plans/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  210. package/dist/action-plans/custom-form-fields/fields/FormDateField.d.ts +9 -0
  211. package/dist/action-plans/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  212. package/dist/action-plans/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  213. package/dist/action-plans/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  214. package/dist/action-plans/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  215. package/dist/action-plans/custom-form-fields/fields/FormTextField.d.ts +9 -0
  216. package/dist/action-plans/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  217. package/dist/action-plans/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  218. package/dist/action-plans/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  219. package/dist/action-plans/custom-form-fields/index.d.ts +13 -0
  220. package/dist/action-plans/custom-form-fields/types.d.ts +206 -0
  221. package/dist/action-plans/exports/action-plans.d.ts +16 -0
  222. package/dist/action-plans/exports/audit-trail.d.ts +1 -0
  223. package/dist/action-plans/exports/crud.d.ts +31 -0
  224. package/dist/action-plans/exports/custom-form-fields.d.ts +1 -0
  225. package/dist/action-plans/exports/file-upload.d.ts +1 -0
  226. package/dist/action-plans/exports/integrations.d.ts +15 -0
  227. package/dist/action-plans/exports/ui.d.ts +98 -0
  228. package/dist/action-plans/file-upload/components/SingleFileUpload.d.ts +102 -0
  229. package/dist/action-plans/file-upload/index.d.ts +6 -0
  230. package/dist/action-plans/file-upload/types.d.ts +26 -0
  231. package/dist/action-plans/file-upload/utils/formatBytes.d.ts +6 -0
  232. package/dist/action-plans/file-upload/utils/getFileExtension.d.ts +6 -0
  233. package/dist/action-plans/hooks/useActiveModules.d.ts +45 -0
  234. package/dist/action-plans/hooks/useAliasFromUrl.d.ts +33 -0
  235. package/dist/action-plans/hooks/useColumnResize.d.ts +45 -0
  236. package/dist/action-plans/hooks/useDebounce.d.ts +56 -0
  237. package/dist/action-plans/hooks/useDerivedContractedModules.d.ts +8 -0
  238. package/dist/action-plans/hooks/useI18nFormatters.d.ts +40 -0
  239. package/dist/action-plans/hooks/useMediaQuery.d.ts +14 -0
  240. package/dist/action-plans/hooks/useModuleAccess.d.ts +59 -0
  241. package/dist/action-plans/hooks/usePageTitle.d.ts +10 -0
  242. package/dist/action-plans/hooks/usePermissionQuery.d.ts +49 -0
  243. package/dist/action-plans/hooks/useRowResize.d.ts +37 -0
  244. package/dist/action-plans/hooks/useSidebarResize.d.ts +37 -0
  245. package/dist/action-plans/hooks/useUpdatesNotification.d.ts +27 -0
  246. package/dist/action-plans/hooks/useWizard.d.ts +40 -0
  247. package/dist/action-plans/i18n/config.d.ts +13 -0
  248. package/dist/action-plans/i18n/constants.d.ts +126 -0
  249. package/dist/action-plans/i18n/index.d.ts +11 -0
  250. package/dist/action-plans/i18n/utils.d.ts +14 -0
  251. package/dist/action-plans/index.d.ts +103 -14
  252. package/dist/action-plans/index.esm.js +1 -0
  253. package/dist/action-plans/index.js +1 -0
  254. package/dist/action-plans/integrations/clarity/clarityTracking.d.ts +31 -0
  255. package/dist/action-plans/integrations/clarity/index.d.ts +3 -0
  256. package/dist/action-plans/integrations/clarity/types.d.ts +46 -0
  257. package/dist/action-plans/integrations/clarity/useClarity.d.ts +34 -0
  258. package/dist/action-plans/integrations/index.d.ts +5 -0
  259. package/dist/action-plans/leadership/components/LeadershipDialog.d.ts +10 -0
  260. package/dist/action-plans/leadership/components/LeadershipForm.d.ts +8 -0
  261. package/dist/action-plans/leadership/components/LeadershipPage.d.ts +19 -0
  262. package/dist/action-plans/leadership/hooks/useLeadershipApi.d.ts +4 -0
  263. package/dist/action-plans/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  264. package/dist/action-plans/leadership/index.d.ts +13 -0
  265. package/dist/action-plans/leadership/types.d.ts +23 -0
  266. package/dist/action-plans/leadership/utils/leadershipUtils.d.ts +8 -0
  267. package/dist/action-plans/media/components/ImageEditor.d.ts +22 -0
  268. package/dist/action-plans/media/components/ImageRenderer.d.ts +23 -0
  269. package/dist/action-plans/media/components/VideoEditor.d.ts +2 -0
  270. package/dist/action-plans/media/components/VideoRenderer.d.ts +2 -0
  271. package/dist/action-plans/media/hooks/useMediaUpload.d.ts +19 -0
  272. package/dist/action-plans/media/index.d.ts +49 -0
  273. package/dist/action-plans/media/types.d.ts +66 -0
  274. package/dist/action-plans/media/utils/imageHelpers.d.ts +28 -0
  275. package/dist/action-plans/media/utils/videoHelpers.d.ts +35 -0
  276. package/dist/action-plans/mind-map/components/MindMap.d.ts +23 -0
  277. package/dist/action-plans/mind-map/components/MindMapConnection.d.ts +12 -0
  278. package/dist/action-plans/mind-map/components/MindMapNodeView.d.ts +24 -0
  279. package/dist/action-plans/mind-map/components/MindMapToolbar.d.ts +26 -0
  280. package/dist/action-plans/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  281. package/dist/action-plans/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  282. package/dist/action-plans/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  283. package/dist/action-plans/mind-map/hooks/useMindMapState.d.ts +32 -0
  284. package/dist/action-plans/mind-map/index.d.ts +4 -0
  285. package/dist/action-plans/mind-map/types.d.ts +91 -0
  286. package/dist/action-plans/mind-map/utils/export-image.d.ts +9 -0
  287. package/dist/action-plans/mind-map/utils/layout.d.ts +15 -0
  288. package/dist/action-plans/mind-map/utils/nodeOps.d.ts +66 -0
  289. package/dist/action-plans/mind-map/utils/serialize.d.ts +10 -0
  290. package/dist/action-plans/modules/softwaresMap.d.ts +4 -0
  291. package/dist/action-plans/places/components/ManageAccessModal.d.ts +11 -0
  292. package/dist/action-plans/places/components/PlaceCard.d.ts +12 -0
  293. package/dist/action-plans/places/components/PlacesList.d.ts +12 -0
  294. package/dist/action-plans/places/index.d.ts +8 -0
  295. package/dist/action-plans/places/services/PlaceService.d.ts +9 -0
  296. package/dist/action-plans/places/types.d.ts +10 -0
  297. package/dist/action-plans/providers/CoreProviders.d.ts +107 -0
  298. package/dist/action-plans/providers/index.d.ts +2 -0
  299. package/dist/action-plans/qualiex/components/QualiexUserField.d.ts +133 -0
  300. package/dist/action-plans/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  301. package/dist/action-plans/qualiex/services/qualiexApi.d.ts +75 -0
  302. package/dist/action-plans/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  303. package/dist/action-plans/qualiex/utils/userPlaceUtils.d.ts +16 -0
  304. package/dist/action-plans/services/BaseService.d.ts +51 -0
  305. package/dist/action-plans/services/EmailService.d.ts +110 -0
  306. package/dist/action-plans/services/ErrorService.d.ts +19 -0
  307. package/dist/action-plans/services/QualiexEnrichmentService.d.ts +53 -0
  308. package/dist/action-plans/services/QualiexFieldHelpers.d.ts +17 -0
  309. package/dist/action-plans/setup/favicon.d.ts +1 -0
  310. package/dist/action-plans/setup.d.ts +16 -0
  311. package/dist/action-plans/sign/components/D4SignWidget.d.ts +2 -0
  312. package/dist/action-plans/sign/components/DocumentSigner.d.ts +2 -0
  313. package/dist/action-plans/sign/components/SignConfigForm.d.ts +2 -0
  314. package/dist/action-plans/sign/components/SignWidget.d.ts +9 -0
  315. package/dist/action-plans/sign/hooks/useSignConfig.d.ts +6 -0
  316. package/dist/action-plans/sign/index.d.ts +8 -0
  317. package/dist/action-plans/sign/services/signService.d.ts +17 -0
  318. package/dist/action-plans/sign/types.d.ts +53 -0
  319. package/dist/action-plans/sign/utils/loadClicksignScript.d.ts +13 -0
  320. package/dist/action-plans/supabase/SupabaseSingleton.d.ts +34 -0
  321. package/dist/action-plans/supabase/client.d.ts +2 -0
  322. package/dist/action-plans/supabase/legacyKeyGuard.d.ts +19 -0
  323. package/dist/action-plans/supabase/publicClient.d.ts +2 -0
  324. package/dist/action-plans/supabase/types.d.ts +377 -0
  325. package/dist/action-plans/team-selector/components/TeamSelector.d.ts +24 -0
  326. package/dist/action-plans/team-selector/index.d.ts +2 -0
  327. package/dist/action-plans/team-selector/types.d.ts +10 -0
  328. package/dist/action-plans/types/sidebar.d.ts +52 -0
  329. package/dist/action-plans/types.d.ts +551 -361
  330. package/dist/action-plans/utils/color.d.ts +26 -0
  331. package/dist/action-plans/utils/formatters/currencyFormatters.d.ts +1 -0
  332. package/dist/action-plans/utils/formatters/dateFormatters.d.ts +52 -0
  333. package/dist/action-plans/utils/index.d.ts +9 -0
  334. package/dist/action-plans/utils/linkHelpers.d.ts +9 -0
  335. package/dist/action-plans/utils/load-fonts.d.ts +1 -0
  336. package/dist/audit-trail/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  337. package/dist/audit-trail/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  338. package/dist/audit-trail/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  339. package/dist/audit-trail/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  340. package/dist/audit-trail/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  341. package/dist/audit-trail/action-plans/components/ActionPlanPage.d.ts +25 -0
  342. package/dist/audit-trail/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  343. package/dist/audit-trail/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  344. package/dist/audit-trail/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  345. package/dist/audit-trail/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  346. package/dist/audit-trail/action-plans/constants.d.ts +86 -0
  347. package/dist/audit-trail/action-plans/hooks/useActionPlan.d.ts +19 -0
  348. package/dist/audit-trail/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  349. package/dist/audit-trail/action-plans/index.d.ts +15 -0
  350. package/dist/audit-trail/action-plans/types.d.ts +413 -0
  351. package/dist/audit-trail/action-plans/utils/formatTime.d.ts +24 -0
  352. package/dist/audit-trail/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  353. package/dist/audit-trail/approval-flow/components/ApproveDialog.d.ts +13 -0
  354. package/dist/audit-trail/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  355. package/dist/audit-trail/approval-flow/index.d.ts +4 -0
  356. package/dist/audit-trail/approval-flow/types.d.ts +76 -0
  357. package/dist/audit-trail/assets/index.d.ts +7 -0
  358. package/dist/audit-trail/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  359. package/dist/audit-trail/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  360. package/dist/audit-trail/audit-trail/components/AuditTrailPage.d.ts +40 -0
  361. package/dist/audit-trail/audit-trail/index.d.ts +9 -0
  362. package/dist/audit-trail/audit-trail/types.d.ts +209 -0
  363. package/dist/audit-trail/audit-trail/utils.d.ts +54 -0
  364. package/dist/audit-trail/auth/components/AliasRedirect.d.ts +13 -0
  365. package/dist/audit-trail/auth/components/AliasRouteGuard.d.ts +20 -0
  366. package/dist/audit-trail/auth/components/EditProfileDialog.d.ts +13 -0
  367. package/dist/audit-trail/auth/components/ProtectedRoute.d.ts +11 -0
  368. package/dist/audit-trail/auth/components/UserInfo.d.ts +10 -0
  369. package/dist/audit-trail/auth/contexts/AuthContext.d.ts +89 -0
  370. package/dist/audit-trail/auth/pages/CallbackPage.d.ts +6 -0
  371. package/dist/audit-trail/auth/pages/LoginPage.d.ts +2 -0
  372. package/dist/audit-trail/auth/services/AuthService.d.ts +45 -0
  373. package/dist/audit-trail/auth/services/SupabaseTokenService.d.ts +3 -0
  374. package/dist/audit-trail/auth/services/TokenManager.d.ts +66 -0
  375. package/dist/audit-trail/auth/services/TokenRegenerationService.d.ts +14 -0
  376. package/dist/audit-trail/auth/services/TokenService.d.ts +48 -0
  377. package/dist/audit-trail/auth/utils/ErrorInterceptor.d.ts +20 -0
  378. package/dist/audit-trail/components/ErrorBoundary.d.ts +19 -0
  379. package/dist/audit-trail/components/dashboards/dashboard-form.d.ts +65 -0
  380. package/dist/audit-trail/components/dashboards/dashboard-general-view.d.ts +124 -0
  381. package/dist/audit-trail/components/dashboards/dashboard-grid.d.ts +66 -0
  382. package/dist/audit-trail/components/dashboards/dashboard-list.d.ts +41 -0
  383. package/dist/audit-trail/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  384. package/dist/audit-trail/components/dashboards/dashboard-view.d.ts +48 -0
  385. package/dist/audit-trail/components/dashboards/helpers.d.ts +86 -0
  386. package/dist/audit-trail/components/dashboards/index.d.ts +9 -0
  387. package/dist/audit-trail/components/dashboards/panels/burndown-panel.d.ts +41 -0
  388. package/dist/audit-trail/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  389. package/dist/audit-trail/components/dashboards/panels/index.d.ts +14 -0
  390. package/dist/audit-trail/components/dashboards/panels/list-panel.d.ts +45 -0
  391. package/dist/audit-trail/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  392. package/dist/audit-trail/components/dashboards/panels/numeric-panel.d.ts +32 -0
  393. package/dist/audit-trail/components/dashboards/panels/panel-error.d.ts +18 -0
  394. package/dist/audit-trail/components/dashboards/panels/panel-header.d.ts +27 -0
  395. package/dist/audit-trail/components/dashboards/panels/panel-loader.d.ts +17 -0
  396. package/dist/audit-trail/components/dashboards/panels/panel-no-data.d.ts +16 -0
  397. package/dist/audit-trail/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  398. package/dist/audit-trail/components/dashboards/panels/pareto-panel.d.ts +30 -0
  399. package/dist/audit-trail/components/dashboards/panels/performance-panel.d.ts +39 -0
  400. package/dist/audit-trail/components/dashboards/panels/pie-panel.d.ts +29 -0
  401. package/dist/audit-trail/components/dashboards/panels/text-panel.d.ts +28 -0
  402. package/dist/audit-trail/components/dashboards/types.d.ts +755 -0
  403. package/dist/audit-trail/components/layout/AppHeader.d.ts +6 -0
  404. package/dist/audit-trail/components/layout/AppLayout.d.ts +10 -0
  405. package/dist/audit-trail/components/layout/AppSidebar.d.ts +10 -0
  406. package/dist/audit-trail/components/layout/BodyContent.d.ts +60 -0
  407. package/dist/audit-trail/components/layout/SidebarActionTrigger.d.ts +46 -0
  408. package/dist/audit-trail/components/layout/SidebarHeader.d.ts +5 -0
  409. package/dist/audit-trail/components/layout/SidebarLogo.d.ts +5 -0
  410. package/dist/audit-trail/components/layout/sidebar-utils.d.ts +12 -0
  411. package/dist/audit-trail/components/modules/AccessDeniedDialog.d.ts +43 -0
  412. package/dist/audit-trail/components/modules/ModuleAccessGuard.d.ts +42 -0
  413. package/dist/audit-trail/components/modules/ModuleGrid.d.ts +9 -0
  414. package/dist/audit-trail/components/modules/ModuleOfferContent.d.ts +20 -0
  415. package/dist/audit-trail/components/modules/ModulesContent.d.ts +21 -0
  416. package/dist/audit-trail/components/modules/ModulesDialog.d.ts +3 -0
  417. package/dist/audit-trail/components/modules/ModulesFooterCards.d.ts +10 -0
  418. package/dist/audit-trail/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  419. package/dist/audit-trail/components/modules/index.d.ts +14 -0
  420. package/dist/audit-trail/components/modules/modulesData.d.ts +6 -0
  421. package/dist/audit-trail/components/modules/types.d.ts +41 -0
  422. package/dist/audit-trail/components/ui/accordion.d.ts +42 -0
  423. package/dist/audit-trail/components/ui/action-button.d.ts +48 -0
  424. package/dist/audit-trail/components/ui/alert-dialog.d.ts +102 -0
  425. package/dist/audit-trail/components/ui/alert.d.ts +44 -0
  426. package/dist/audit-trail/components/ui/avatar.d.ts +36 -0
  427. package/dist/audit-trail/components/ui/badge.d.ts +41 -0
  428. package/dist/audit-trail/components/ui/breadcrumb.d.ts +73 -0
  429. package/dist/audit-trail/components/ui/button-group.d.ts +24 -0
  430. package/dist/audit-trail/components/ui/button.d.ts +66 -0
  431. package/dist/audit-trail/components/ui/calendar.d.ts +24 -0
  432. package/dist/audit-trail/components/ui/card.d.ts +57 -0
  433. package/dist/audit-trail/components/ui/chart.d.ts +97 -0
  434. package/dist/audit-trail/components/ui/checkbox.d.ts +15 -0
  435. package/dist/audit-trail/components/ui/collapsible.d.ts +20 -0
  436. package/dist/audit-trail/components/ui/color-picker.d.ts +19 -0
  437. package/dist/audit-trail/components/ui/combo-tree.d.ts +103 -0
  438. package/dist/audit-trail/components/ui/combobox.d.ts +64 -0
  439. package/dist/audit-trail/components/ui/command.d.ts +89 -0
  440. package/dist/audit-trail/components/ui/context-menu.d.ts +122 -0
  441. package/dist/audit-trail/components/ui/data-list.d.ts +86 -0
  442. package/dist/audit-trail/components/ui/date-picker.d.ts +19 -0
  443. package/dist/audit-trail/components/ui/dialog-wizard.d.ts +100 -0
  444. package/dist/audit-trail/components/ui/dialog.d.ts +229 -0
  445. package/dist/audit-trail/components/ui/disabled-menu-item.d.ts +25 -0
  446. package/dist/audit-trail/components/ui/drawer.d.ts +94 -0
  447. package/dist/audit-trail/components/ui/dropdown-menu.d.ts +180 -0
  448. package/dist/audit-trail/components/ui/electronic-signature-dialog.d.ts +31 -0
  449. package/dist/audit-trail/components/ui/empty-state.d.ts +79 -0
  450. package/dist/audit-trail/components/ui/export-dialog.d.ts +48 -0
  451. package/dist/audit-trail/components/ui/form.d.ts +119 -0
  452. package/dist/audit-trail/components/ui/grid.d.ts +53 -0
  453. package/dist/audit-trail/components/ui/hover-card.d.ts +21 -0
  454. package/dist/audit-trail/components/ui/icon-picker.d.ts +17 -0
  455. package/dist/audit-trail/components/ui/iframe-dialog.d.ts +24 -0
  456. package/dist/audit-trail/components/ui/input-group.d.ts +113 -0
  457. package/dist/audit-trail/components/ui/input.d.ts +24 -0
  458. package/dist/audit-trail/components/ui/label.d.ts +23 -0
  459. package/dist/audit-trail/components/ui/loading-state.d.ts +52 -0
  460. package/dist/audit-trail/components/ui/menubar.d.ts +113 -0
  461. package/dist/audit-trail/components/ui/multiselect-permissions.d.ts +84 -0
  462. package/dist/audit-trail/components/ui/navigation-menu.d.ts +57 -0
  463. package/dist/audit-trail/components/ui/onboarding-dialog.d.ts +58 -0
  464. package/dist/audit-trail/components/ui/online-editor-dialog.d.ts +28 -0
  465. package/dist/audit-trail/components/ui/page-breadcrumb.d.ts +77 -0
  466. package/dist/audit-trail/components/ui/pagination.d.ts +81 -0
  467. package/dist/audit-trail/components/ui/popover.d.ts +57 -0
  468. package/dist/audit-trail/components/ui/progress.d.ts +22 -0
  469. package/dist/audit-trail/components/ui/radio-group.d.ts +66 -0
  470. package/dist/audit-trail/components/ui/report-request-list.d.ts +64 -0
  471. package/dist/audit-trail/components/ui/resizable.d.ts +38 -0
  472. package/dist/audit-trail/components/ui/rich-text-editor.d.ts +58 -0
  473. package/dist/audit-trail/components/ui/scroll-area.d.ts +40 -0
  474. package/dist/audit-trail/components/ui/select.d.ts +94 -0
  475. package/dist/audit-trail/components/ui/separator.d.ts +17 -0
  476. package/dist/audit-trail/components/ui/sheet.d.ts +108 -0
  477. package/dist/audit-trail/components/ui/sidebar.d.ts +269 -0
  478. package/dist/audit-trail/components/ui/skeleton-variants.d.ts +41 -0
  479. package/dist/audit-trail/components/ui/skeleton.d.ts +14 -0
  480. package/dist/audit-trail/components/ui/slider.d.ts +9 -0
  481. package/dist/audit-trail/components/ui/sonner.d.ts +8 -0
  482. package/dist/audit-trail/components/ui/spinner.d.ts +11 -0
  483. package/dist/audit-trail/components/ui/split-button.d.ts +76 -0
  484. package/dist/audit-trail/components/ui/stack.d.ts +17 -0
  485. package/dist/audit-trail/components/ui/status-badge.d.ts +52 -0
  486. package/dist/audit-trail/components/ui/step-selector.d.ts +46 -0
  487. package/dist/audit-trail/components/ui/stimulsoft-viewer.d.ts +28 -0
  488. package/dist/audit-trail/components/ui/switch.d.ts +25 -0
  489. package/dist/audit-trail/components/ui/tab-page-layout.d.ts +52 -0
  490. package/dist/audit-trail/components/ui/table-resize-handle.d.ts +22 -0
  491. package/dist/audit-trail/components/ui/table.d.ts +112 -0
  492. package/dist/audit-trail/components/ui/tabs.d.ts +66 -0
  493. package/dist/audit-trail/components/ui/terms-of-use-dialog.d.ts +102 -0
  494. package/dist/audit-trail/components/ui/textarea.d.ts +33 -0
  495. package/dist/audit-trail/components/ui/timepicker.d.ts +34 -0
  496. package/dist/audit-trail/components/ui/toggle-group.d.ts +37 -0
  497. package/dist/audit-trail/components/ui/toggle.d.ts +33 -0
  498. package/dist/audit-trail/components/ui/tooltip.d.ts +61 -0
  499. package/dist/audit-trail/components/ui/truncated-cell.d.ts +20 -0
  500. package/dist/audit-trail/components/ui/typography.d.ts +135 -0
  501. package/dist/audit-trail/components/ui/updates-notification.d.ts +47 -0
  502. package/dist/audit-trail/components/ui/users-groups-selector.d.ts +87 -0
  503. package/dist/audit-trail/components/ui/viewer-dialog.d.ts +184 -0
  504. package/dist/audit-trail/config/backend.d.ts +10 -0
  505. package/dist/audit-trail/config/environments.d.ts +27 -0
  506. package/dist/audit-trail/config/index.d.ts +75 -0
  507. package/dist/audit-trail/contexts/LocaleContext.d.ts +15 -0
  508. package/dist/audit-trail/contexts/ModalStateContext.d.ts +57 -0
  509. package/dist/audit-trail/contexts/ModuleContext.d.ts +34 -0
  510. package/dist/audit-trail/contexts/NavigationContext.d.ts +13 -0
  511. package/dist/audit-trail/contexts/PageMetadataContext.d.ts +48 -0
  512. package/dist/audit-trail/crud/components/ActionMenuItems.d.ts +22 -0
  513. package/dist/audit-trail/crud/components/BaseForm.d.ts +52 -0
  514. package/dist/audit-trail/crud/components/ColumnSettingsPopover.d.ts +28 -0
  515. package/dist/audit-trail/crud/components/ContextMenu.d.ts +21 -0
  516. package/dist/audit-trail/crud/components/CrudActionBar.d.ts +59 -0
  517. package/dist/audit-trail/crud/components/CrudGrid.d.ts +53 -0
  518. package/dist/audit-trail/crud/components/CrudPagination.d.ts +17 -0
  519. package/dist/audit-trail/crud/components/CrudTable.d.ts +66 -0
  520. package/dist/audit-trail/crud/components/FilterBar.d.ts +136 -0
  521. package/dist/audit-trail/crud/components/GroupDropZone.d.ts +16 -0
  522. package/dist/audit-trail/crud/components/InlineRowActions.d.ts +15 -0
  523. package/dist/audit-trail/crud/components/SelectionCheckbox.d.ts +9 -0
  524. package/dist/audit-trail/crud/components/TableFooter.d.ts +14 -0
  525. package/dist/audit-trail/crud/components/TableRowActions.d.ts +19 -0
  526. package/dist/audit-trail/crud/createCrudPage.d.ts +134 -0
  527. package/dist/audit-trail/crud/createSimpleService.d.ts +85 -0
  528. package/dist/audit-trail/crud/generateCrudConfig.d.ts +78 -0
  529. package/dist/audit-trail/crud/hooks/useBaseForm.d.ts +47 -0
  530. package/dist/audit-trail/crud/hooks/useColumnDragReorder.d.ts +19 -0
  531. package/dist/audit-trail/crud/hooks/useColumnManager.d.ts +85 -0
  532. package/dist/audit-trail/crud/hooks/useCrud.d.ts +152 -0
  533. package/dist/audit-trail/crud/primitives/ActionMenu.d.ts +69 -0
  534. package/dist/audit-trail/crud/primitives/FilterBar.d.ts +69 -0
  535. package/dist/audit-trail/crud/primitives/Pagination.d.ts +29 -0
  536. package/dist/audit-trail/crud/primitives/Table.d.ts +31 -0
  537. package/dist/audit-trail/crud/primitives/TreeTable.d.ts +7 -0
  538. package/dist/audit-trail/crud/primitives/index.d.ts +12 -0
  539. package/dist/audit-trail/crud/primitives/types.d.ts +199 -0
  540. package/dist/audit-trail/crud/utils/routingHelpers.d.ts +41 -0
  541. package/dist/audit-trail/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  542. package/dist/audit-trail/custom-form-fields/fields/FormDateField.d.ts +9 -0
  543. package/dist/audit-trail/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  544. package/dist/audit-trail/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  545. package/dist/audit-trail/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  546. package/dist/audit-trail/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  547. package/dist/audit-trail/custom-form-fields/fields/FormTextField.d.ts +9 -0
  548. package/dist/audit-trail/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  549. package/dist/audit-trail/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  550. package/dist/audit-trail/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  551. package/dist/audit-trail/custom-form-fields/index.d.ts +13 -0
  552. package/dist/audit-trail/custom-form-fields/types.d.ts +206 -0
  553. package/dist/audit-trail/exports/action-plans.d.ts +16 -0
  554. package/dist/audit-trail/exports/audit-trail.d.ts +1 -0
  555. package/dist/audit-trail/exports/crud.d.ts +31 -0
  556. package/dist/audit-trail/exports/custom-form-fields.d.ts +1 -0
  557. package/dist/audit-trail/exports/file-upload.d.ts +1 -0
  558. package/dist/audit-trail/exports/integrations.d.ts +15 -0
  559. package/dist/audit-trail/exports/ui.d.ts +98 -0
  560. package/dist/audit-trail/file-upload/components/SingleFileUpload.d.ts +102 -0
  561. package/dist/audit-trail/file-upload/index.d.ts +6 -0
  562. package/dist/audit-trail/file-upload/types.d.ts +26 -0
  563. package/dist/audit-trail/file-upload/utils/formatBytes.d.ts +6 -0
  564. package/dist/audit-trail/file-upload/utils/getFileExtension.d.ts +6 -0
  565. package/dist/audit-trail/hooks/useActiveModules.d.ts +45 -0
  566. package/dist/audit-trail/hooks/useAliasFromUrl.d.ts +33 -0
  567. package/dist/audit-trail/hooks/useColumnResize.d.ts +45 -0
  568. package/dist/audit-trail/hooks/useDebounce.d.ts +56 -0
  569. package/dist/audit-trail/hooks/useDerivedContractedModules.d.ts +8 -0
  570. package/dist/audit-trail/hooks/useI18nFormatters.d.ts +40 -0
  571. package/dist/audit-trail/hooks/useMediaQuery.d.ts +14 -0
  572. package/dist/audit-trail/hooks/useModuleAccess.d.ts +59 -0
  573. package/dist/audit-trail/hooks/usePageTitle.d.ts +10 -0
  574. package/dist/audit-trail/hooks/usePermissionQuery.d.ts +49 -0
  575. package/dist/audit-trail/hooks/useRowResize.d.ts +37 -0
  576. package/dist/audit-trail/hooks/useSidebarResize.d.ts +37 -0
  577. package/dist/audit-trail/hooks/useUpdatesNotification.d.ts +27 -0
  578. package/dist/audit-trail/hooks/useWizard.d.ts +40 -0
  579. package/dist/audit-trail/i18n/config.d.ts +13 -0
  580. package/dist/audit-trail/i18n/constants.d.ts +126 -0
  581. package/dist/audit-trail/i18n/index.d.ts +11 -0
  582. package/dist/audit-trail/i18n/utils.d.ts +14 -0
  583. package/dist/audit-trail/index.d.ts +103 -8
  584. package/dist/audit-trail/index.esm.js +1 -0
  585. package/dist/audit-trail/index.js +1 -0
  586. package/dist/audit-trail/integrations/clarity/clarityTracking.d.ts +31 -0
  587. package/dist/audit-trail/integrations/clarity/index.d.ts +3 -0
  588. package/dist/audit-trail/integrations/clarity/types.d.ts +46 -0
  589. package/dist/audit-trail/integrations/clarity/useClarity.d.ts +34 -0
  590. package/dist/audit-trail/integrations/index.d.ts +5 -0
  591. package/dist/audit-trail/leadership/components/LeadershipDialog.d.ts +10 -0
  592. package/dist/audit-trail/leadership/components/LeadershipForm.d.ts +8 -0
  593. package/dist/audit-trail/leadership/components/LeadershipPage.d.ts +19 -0
  594. package/dist/audit-trail/leadership/hooks/useLeadershipApi.d.ts +4 -0
  595. package/dist/audit-trail/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  596. package/dist/audit-trail/leadership/index.d.ts +13 -0
  597. package/dist/audit-trail/leadership/types.d.ts +23 -0
  598. package/dist/audit-trail/leadership/utils/leadershipUtils.d.ts +8 -0
  599. package/dist/audit-trail/media/components/ImageEditor.d.ts +22 -0
  600. package/dist/audit-trail/media/components/ImageRenderer.d.ts +23 -0
  601. package/dist/audit-trail/media/components/VideoEditor.d.ts +2 -0
  602. package/dist/audit-trail/media/components/VideoRenderer.d.ts +2 -0
  603. package/dist/audit-trail/media/hooks/useMediaUpload.d.ts +19 -0
  604. package/dist/audit-trail/media/index.d.ts +49 -0
  605. package/dist/audit-trail/media/types.d.ts +66 -0
  606. package/dist/audit-trail/media/utils/imageHelpers.d.ts +28 -0
  607. package/dist/audit-trail/media/utils/videoHelpers.d.ts +35 -0
  608. package/dist/audit-trail/mind-map/components/MindMap.d.ts +23 -0
  609. package/dist/audit-trail/mind-map/components/MindMapConnection.d.ts +12 -0
  610. package/dist/audit-trail/mind-map/components/MindMapNodeView.d.ts +24 -0
  611. package/dist/audit-trail/mind-map/components/MindMapToolbar.d.ts +26 -0
  612. package/dist/audit-trail/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  613. package/dist/audit-trail/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  614. package/dist/audit-trail/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  615. package/dist/audit-trail/mind-map/hooks/useMindMapState.d.ts +32 -0
  616. package/dist/audit-trail/mind-map/index.d.ts +4 -0
  617. package/dist/audit-trail/mind-map/types.d.ts +91 -0
  618. package/dist/audit-trail/mind-map/utils/export-image.d.ts +9 -0
  619. package/dist/audit-trail/mind-map/utils/layout.d.ts +15 -0
  620. package/dist/audit-trail/mind-map/utils/nodeOps.d.ts +66 -0
  621. package/dist/audit-trail/mind-map/utils/serialize.d.ts +10 -0
  622. package/dist/audit-trail/modules/softwaresMap.d.ts +4 -0
  623. package/dist/audit-trail/places/components/ManageAccessModal.d.ts +11 -0
  624. package/dist/audit-trail/places/components/PlaceCard.d.ts +12 -0
  625. package/dist/audit-trail/places/components/PlacesList.d.ts +12 -0
  626. package/dist/audit-trail/places/index.d.ts +8 -0
  627. package/dist/audit-trail/places/services/PlaceService.d.ts +9 -0
  628. package/dist/audit-trail/places/types.d.ts +10 -0
  629. package/dist/audit-trail/providers/CoreProviders.d.ts +107 -0
  630. package/dist/audit-trail/providers/index.d.ts +2 -0
  631. package/dist/audit-trail/qualiex/components/QualiexUserField.d.ts +133 -0
  632. package/dist/audit-trail/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  633. package/dist/audit-trail/qualiex/services/qualiexApi.d.ts +75 -0
  634. package/dist/audit-trail/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  635. package/dist/audit-trail/qualiex/utils/userPlaceUtils.d.ts +16 -0
  636. package/dist/audit-trail/services/BaseService.d.ts +51 -0
  637. package/dist/audit-trail/services/EmailService.d.ts +110 -0
  638. package/dist/audit-trail/services/ErrorService.d.ts +19 -0
  639. package/dist/audit-trail/services/QualiexEnrichmentService.d.ts +53 -0
  640. package/dist/audit-trail/services/QualiexFieldHelpers.d.ts +17 -0
  641. package/dist/audit-trail/setup/favicon.d.ts +1 -0
  642. package/dist/audit-trail/setup.d.ts +16 -0
  643. package/dist/audit-trail/sign/components/D4SignWidget.d.ts +2 -0
  644. package/dist/audit-trail/sign/components/DocumentSigner.d.ts +2 -0
  645. package/dist/audit-trail/sign/components/SignConfigForm.d.ts +2 -0
  646. package/dist/audit-trail/sign/components/SignWidget.d.ts +9 -0
  647. package/dist/audit-trail/sign/hooks/useSignConfig.d.ts +6 -0
  648. package/dist/audit-trail/sign/index.d.ts +8 -0
  649. package/dist/audit-trail/sign/services/signService.d.ts +17 -0
  650. package/dist/audit-trail/sign/types.d.ts +53 -0
  651. package/dist/audit-trail/sign/utils/loadClicksignScript.d.ts +13 -0
  652. package/dist/audit-trail/supabase/SupabaseSingleton.d.ts +34 -0
  653. package/dist/audit-trail/supabase/client.d.ts +2 -0
  654. package/dist/audit-trail/supabase/legacyKeyGuard.d.ts +19 -0
  655. package/dist/audit-trail/supabase/publicClient.d.ts +2 -0
  656. package/dist/audit-trail/supabase/types.d.ts +377 -0
  657. package/dist/audit-trail/team-selector/components/TeamSelector.d.ts +24 -0
  658. package/dist/audit-trail/team-selector/index.d.ts +2 -0
  659. package/dist/audit-trail/team-selector/types.d.ts +10 -0
  660. package/dist/audit-trail/types/sidebar.d.ts +52 -0
  661. package/dist/audit-trail/types.d.ts +567 -173
  662. package/dist/audit-trail/utils/color.d.ts +26 -0
  663. package/dist/audit-trail/utils/formatters/currencyFormatters.d.ts +1 -0
  664. package/dist/audit-trail/utils/formatters/dateFormatters.d.ts +52 -0
  665. package/dist/audit-trail/utils/index.d.ts +9 -0
  666. package/dist/audit-trail/utils/linkHelpers.d.ts +9 -0
  667. package/dist/audit-trail/utils/load-fonts.d.ts +1 -0
  668. package/dist/config/backend.d.ts +10 -0
  669. package/dist/config/environments.d.ts +18 -3
  670. package/dist/config/index.d.ts +3 -3
  671. package/dist/index.css +1 -1
  672. package/dist/index.css.map +1 -1
  673. package/dist/index.d.ts +5 -7
  674. package/dist/index.esm.js +1 -1
  675. package/dist/index.js +1 -1
  676. package/dist/leadership/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  677. package/dist/leadership/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  678. package/dist/leadership/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  679. package/dist/leadership/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  680. package/dist/leadership/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  681. package/dist/leadership/action-plans/components/ActionPlanPage.d.ts +25 -0
  682. package/dist/leadership/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  683. package/dist/leadership/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  684. package/dist/leadership/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  685. package/dist/leadership/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  686. package/dist/leadership/action-plans/constants.d.ts +86 -0
  687. package/dist/leadership/action-plans/hooks/useActionPlan.d.ts +19 -0
  688. package/dist/leadership/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  689. package/dist/leadership/action-plans/index.d.ts +15 -0
  690. package/dist/leadership/action-plans/types.d.ts +413 -0
  691. package/dist/leadership/action-plans/utils/formatTime.d.ts +24 -0
  692. package/dist/leadership/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  693. package/dist/leadership/approval-flow/components/ApproveDialog.d.ts +13 -0
  694. package/dist/leadership/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  695. package/dist/leadership/approval-flow/index.d.ts +4 -0
  696. package/dist/leadership/approval-flow/types.d.ts +76 -0
  697. package/dist/leadership/assets/index.d.ts +7 -0
  698. package/dist/leadership/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  699. package/dist/leadership/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  700. package/dist/leadership/audit-trail/components/AuditTrailPage.d.ts +40 -0
  701. package/dist/leadership/audit-trail/index.d.ts +9 -0
  702. package/dist/leadership/audit-trail/types.d.ts +209 -0
  703. package/dist/leadership/audit-trail/utils.d.ts +54 -0
  704. package/dist/leadership/auth/components/AliasRedirect.d.ts +13 -0
  705. package/dist/leadership/auth/components/AliasRouteGuard.d.ts +20 -0
  706. package/dist/leadership/auth/components/EditProfileDialog.d.ts +13 -0
  707. package/dist/leadership/auth/components/ProtectedRoute.d.ts +11 -0
  708. package/dist/leadership/auth/components/UserInfo.d.ts +10 -0
  709. package/dist/leadership/auth/contexts/AuthContext.d.ts +89 -0
  710. package/dist/leadership/auth/pages/CallbackPage.d.ts +6 -0
  711. package/dist/leadership/auth/pages/LoginPage.d.ts +2 -0
  712. package/dist/leadership/auth/services/AuthService.d.ts +45 -0
  713. package/dist/leadership/auth/services/SupabaseTokenService.d.ts +3 -0
  714. package/dist/leadership/auth/services/TokenManager.d.ts +66 -0
  715. package/dist/leadership/auth/services/TokenRegenerationService.d.ts +14 -0
  716. package/dist/leadership/auth/services/TokenService.d.ts +48 -0
  717. package/dist/leadership/auth/utils/ErrorInterceptor.d.ts +20 -0
  718. package/dist/leadership/components/ErrorBoundary.d.ts +19 -0
  719. package/dist/leadership/components/dashboards/dashboard-form.d.ts +65 -0
  720. package/dist/leadership/components/dashboards/dashboard-general-view.d.ts +124 -0
  721. package/dist/leadership/components/dashboards/dashboard-grid.d.ts +66 -0
  722. package/dist/leadership/components/dashboards/dashboard-list.d.ts +41 -0
  723. package/dist/leadership/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  724. package/dist/leadership/components/dashboards/dashboard-view.d.ts +48 -0
  725. package/dist/leadership/components/dashboards/helpers.d.ts +86 -0
  726. package/dist/leadership/components/dashboards/index.d.ts +9 -0
  727. package/dist/leadership/components/dashboards/panels/burndown-panel.d.ts +41 -0
  728. package/dist/leadership/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  729. package/dist/leadership/components/dashboards/panels/index.d.ts +14 -0
  730. package/dist/leadership/components/dashboards/panels/list-panel.d.ts +45 -0
  731. package/dist/leadership/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  732. package/dist/leadership/components/dashboards/panels/numeric-panel.d.ts +32 -0
  733. package/dist/leadership/components/dashboards/panels/panel-error.d.ts +18 -0
  734. package/dist/leadership/components/dashboards/panels/panel-header.d.ts +27 -0
  735. package/dist/leadership/components/dashboards/panels/panel-loader.d.ts +17 -0
  736. package/dist/leadership/components/dashboards/panels/panel-no-data.d.ts +16 -0
  737. package/dist/leadership/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  738. package/dist/leadership/components/dashboards/panels/pareto-panel.d.ts +30 -0
  739. package/dist/leadership/components/dashboards/panels/performance-panel.d.ts +39 -0
  740. package/dist/leadership/components/dashboards/panels/pie-panel.d.ts +29 -0
  741. package/dist/leadership/components/dashboards/panels/text-panel.d.ts +28 -0
  742. package/dist/leadership/components/dashboards/types.d.ts +755 -0
  743. package/dist/leadership/components/layout/AppHeader.d.ts +6 -0
  744. package/dist/leadership/components/layout/AppLayout.d.ts +10 -0
  745. package/dist/leadership/components/layout/AppSidebar.d.ts +10 -0
  746. package/dist/leadership/components/layout/BodyContent.d.ts +60 -0
  747. package/dist/leadership/components/layout/SidebarActionTrigger.d.ts +46 -0
  748. package/dist/leadership/components/layout/SidebarHeader.d.ts +5 -0
  749. package/dist/leadership/components/layout/SidebarLogo.d.ts +5 -0
  750. package/dist/leadership/components/layout/sidebar-utils.d.ts +12 -0
  751. package/dist/leadership/components/modules/AccessDeniedDialog.d.ts +43 -0
  752. package/dist/leadership/components/modules/ModuleAccessGuard.d.ts +42 -0
  753. package/dist/leadership/components/modules/ModuleGrid.d.ts +9 -0
  754. package/dist/leadership/components/modules/ModuleOfferContent.d.ts +20 -0
  755. package/dist/leadership/components/modules/ModulesContent.d.ts +21 -0
  756. package/dist/leadership/components/modules/ModulesDialog.d.ts +3 -0
  757. package/dist/leadership/components/modules/ModulesFooterCards.d.ts +10 -0
  758. package/dist/leadership/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  759. package/dist/leadership/components/modules/index.d.ts +14 -0
  760. package/dist/leadership/components/modules/modulesData.d.ts +6 -0
  761. package/dist/leadership/components/modules/types.d.ts +41 -0
  762. package/dist/leadership/components/ui/accordion.d.ts +42 -0
  763. package/dist/leadership/components/ui/action-button.d.ts +48 -0
  764. package/dist/leadership/components/ui/alert-dialog.d.ts +102 -0
  765. package/dist/leadership/components/ui/alert.d.ts +44 -0
  766. package/dist/leadership/components/ui/avatar.d.ts +36 -0
  767. package/dist/leadership/components/ui/badge.d.ts +41 -0
  768. package/dist/leadership/components/ui/breadcrumb.d.ts +73 -0
  769. package/dist/leadership/components/ui/button-group.d.ts +24 -0
  770. package/dist/leadership/components/ui/button.d.ts +66 -0
  771. package/dist/leadership/components/ui/calendar.d.ts +24 -0
  772. package/dist/leadership/components/ui/card.d.ts +57 -0
  773. package/dist/leadership/components/ui/chart.d.ts +97 -0
  774. package/dist/leadership/components/ui/checkbox.d.ts +15 -0
  775. package/dist/leadership/components/ui/collapsible.d.ts +20 -0
  776. package/dist/leadership/components/ui/color-picker.d.ts +19 -0
  777. package/dist/leadership/components/ui/combo-tree.d.ts +103 -0
  778. package/dist/leadership/components/ui/combobox.d.ts +64 -0
  779. package/dist/leadership/components/ui/command.d.ts +89 -0
  780. package/dist/leadership/components/ui/context-menu.d.ts +122 -0
  781. package/dist/leadership/components/ui/data-list.d.ts +86 -0
  782. package/dist/leadership/components/ui/date-picker.d.ts +19 -0
  783. package/dist/leadership/components/ui/dialog-wizard.d.ts +100 -0
  784. package/dist/leadership/components/ui/dialog.d.ts +229 -0
  785. package/dist/leadership/components/ui/disabled-menu-item.d.ts +25 -0
  786. package/dist/leadership/components/ui/drawer.d.ts +94 -0
  787. package/dist/leadership/components/ui/dropdown-menu.d.ts +180 -0
  788. package/dist/leadership/components/ui/electronic-signature-dialog.d.ts +31 -0
  789. package/dist/leadership/components/ui/empty-state.d.ts +79 -0
  790. package/dist/leadership/components/ui/export-dialog.d.ts +48 -0
  791. package/dist/leadership/components/ui/form.d.ts +119 -0
  792. package/dist/leadership/components/ui/grid.d.ts +53 -0
  793. package/dist/leadership/components/ui/hover-card.d.ts +21 -0
  794. package/dist/leadership/components/ui/icon-picker.d.ts +17 -0
  795. package/dist/leadership/components/ui/iframe-dialog.d.ts +24 -0
  796. package/dist/leadership/components/ui/input-group.d.ts +113 -0
  797. package/dist/leadership/components/ui/input.d.ts +24 -0
  798. package/dist/leadership/components/ui/label.d.ts +23 -0
  799. package/dist/leadership/components/ui/loading-state.d.ts +52 -0
  800. package/dist/leadership/components/ui/menubar.d.ts +113 -0
  801. package/dist/leadership/components/ui/multiselect-permissions.d.ts +84 -0
  802. package/dist/leadership/components/ui/navigation-menu.d.ts +57 -0
  803. package/dist/leadership/components/ui/onboarding-dialog.d.ts +58 -0
  804. package/dist/leadership/components/ui/online-editor-dialog.d.ts +28 -0
  805. package/dist/leadership/components/ui/page-breadcrumb.d.ts +77 -0
  806. package/dist/leadership/components/ui/pagination.d.ts +81 -0
  807. package/dist/leadership/components/ui/popover.d.ts +57 -0
  808. package/dist/leadership/components/ui/progress.d.ts +22 -0
  809. package/dist/leadership/components/ui/radio-group.d.ts +66 -0
  810. package/dist/leadership/components/ui/report-request-list.d.ts +64 -0
  811. package/dist/leadership/components/ui/resizable.d.ts +38 -0
  812. package/dist/leadership/components/ui/rich-text-editor.d.ts +58 -0
  813. package/dist/leadership/components/ui/scroll-area.d.ts +40 -0
  814. package/dist/leadership/components/ui/select.d.ts +94 -0
  815. package/dist/leadership/components/ui/separator.d.ts +17 -0
  816. package/dist/leadership/components/ui/sheet.d.ts +108 -0
  817. package/dist/leadership/components/ui/sidebar.d.ts +269 -0
  818. package/dist/leadership/components/ui/skeleton-variants.d.ts +41 -0
  819. package/dist/leadership/components/ui/skeleton.d.ts +14 -0
  820. package/dist/leadership/components/ui/slider.d.ts +9 -0
  821. package/dist/leadership/components/ui/sonner.d.ts +8 -0
  822. package/dist/leadership/components/ui/spinner.d.ts +11 -0
  823. package/dist/leadership/components/ui/split-button.d.ts +76 -0
  824. package/dist/leadership/components/ui/stack.d.ts +17 -0
  825. package/dist/leadership/components/ui/status-badge.d.ts +52 -0
  826. package/dist/leadership/components/ui/step-selector.d.ts +46 -0
  827. package/dist/leadership/components/ui/stimulsoft-viewer.d.ts +28 -0
  828. package/dist/leadership/components/ui/switch.d.ts +25 -0
  829. package/dist/leadership/components/ui/tab-page-layout.d.ts +52 -0
  830. package/dist/leadership/components/ui/table-resize-handle.d.ts +22 -0
  831. package/dist/leadership/components/ui/table.d.ts +112 -0
  832. package/dist/leadership/components/ui/tabs.d.ts +66 -0
  833. package/dist/leadership/components/ui/terms-of-use-dialog.d.ts +102 -0
  834. package/dist/leadership/components/ui/textarea.d.ts +33 -0
  835. package/dist/leadership/components/ui/timepicker.d.ts +34 -0
  836. package/dist/leadership/components/ui/toggle-group.d.ts +37 -0
  837. package/dist/leadership/components/ui/toggle.d.ts +33 -0
  838. package/dist/leadership/components/ui/tooltip.d.ts +61 -0
  839. package/dist/leadership/components/ui/truncated-cell.d.ts +20 -0
  840. package/dist/leadership/components/ui/typography.d.ts +135 -0
  841. package/dist/leadership/components/ui/updates-notification.d.ts +47 -0
  842. package/dist/leadership/components/ui/users-groups-selector.d.ts +87 -0
  843. package/dist/leadership/components/ui/viewer-dialog.d.ts +184 -0
  844. package/dist/leadership/config/backend.d.ts +10 -0
  845. package/dist/leadership/config/environments.d.ts +27 -0
  846. package/dist/leadership/config/index.d.ts +75 -0
  847. package/dist/leadership/contexts/LocaleContext.d.ts +15 -0
  848. package/dist/leadership/contexts/ModalStateContext.d.ts +57 -0
  849. package/dist/leadership/contexts/ModuleContext.d.ts +34 -0
  850. package/dist/leadership/contexts/NavigationContext.d.ts +13 -0
  851. package/dist/leadership/contexts/PageMetadataContext.d.ts +48 -0
  852. package/dist/leadership/crud/components/ActionMenuItems.d.ts +22 -0
  853. package/dist/leadership/crud/components/BaseForm.d.ts +52 -0
  854. package/dist/leadership/crud/components/ColumnSettingsPopover.d.ts +28 -0
  855. package/dist/leadership/crud/components/ContextMenu.d.ts +21 -0
  856. package/dist/leadership/crud/components/CrudActionBar.d.ts +59 -0
  857. package/dist/leadership/crud/components/CrudGrid.d.ts +53 -0
  858. package/dist/leadership/crud/components/CrudPagination.d.ts +17 -0
  859. package/dist/leadership/crud/components/CrudTable.d.ts +66 -0
  860. package/dist/leadership/crud/components/FilterBar.d.ts +136 -0
  861. package/dist/leadership/crud/components/GroupDropZone.d.ts +16 -0
  862. package/dist/leadership/crud/components/InlineRowActions.d.ts +15 -0
  863. package/dist/leadership/crud/components/SelectionCheckbox.d.ts +9 -0
  864. package/dist/leadership/crud/components/TableFooter.d.ts +14 -0
  865. package/dist/leadership/crud/components/TableRowActions.d.ts +19 -0
  866. package/dist/leadership/crud/createCrudPage.d.ts +134 -0
  867. package/dist/leadership/crud/createSimpleService.d.ts +85 -0
  868. package/dist/leadership/crud/generateCrudConfig.d.ts +78 -0
  869. package/dist/leadership/crud/hooks/useBaseForm.d.ts +47 -0
  870. package/dist/leadership/crud/hooks/useColumnDragReorder.d.ts +19 -0
  871. package/dist/leadership/crud/hooks/useColumnManager.d.ts +85 -0
  872. package/dist/leadership/crud/hooks/useCrud.d.ts +152 -0
  873. package/dist/leadership/crud/primitives/ActionMenu.d.ts +69 -0
  874. package/dist/leadership/crud/primitives/FilterBar.d.ts +69 -0
  875. package/dist/leadership/crud/primitives/Pagination.d.ts +29 -0
  876. package/dist/leadership/crud/primitives/Table.d.ts +31 -0
  877. package/dist/leadership/crud/primitives/TreeTable.d.ts +7 -0
  878. package/dist/leadership/crud/primitives/index.d.ts +12 -0
  879. package/dist/leadership/crud/primitives/types.d.ts +199 -0
  880. package/dist/leadership/crud/utils/routingHelpers.d.ts +41 -0
  881. package/dist/leadership/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  882. package/dist/leadership/custom-form-fields/fields/FormDateField.d.ts +9 -0
  883. package/dist/leadership/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  884. package/dist/leadership/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  885. package/dist/leadership/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  886. package/dist/leadership/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  887. package/dist/leadership/custom-form-fields/fields/FormTextField.d.ts +9 -0
  888. package/dist/leadership/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  889. package/dist/leadership/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  890. package/dist/leadership/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  891. package/dist/leadership/custom-form-fields/index.d.ts +13 -0
  892. package/dist/leadership/custom-form-fields/types.d.ts +206 -0
  893. package/dist/leadership/exports/action-plans.d.ts +16 -0
  894. package/dist/leadership/exports/audit-trail.d.ts +1 -0
  895. package/dist/leadership/exports/crud.d.ts +31 -0
  896. package/dist/leadership/exports/custom-form-fields.d.ts +1 -0
  897. package/dist/leadership/exports/file-upload.d.ts +1 -0
  898. package/dist/leadership/exports/integrations.d.ts +15 -0
  899. package/dist/leadership/exports/ui.d.ts +98 -0
  900. package/dist/leadership/file-upload/components/SingleFileUpload.d.ts +102 -0
  901. package/dist/leadership/file-upload/index.d.ts +6 -0
  902. package/dist/leadership/file-upload/types.d.ts +26 -0
  903. package/dist/leadership/file-upload/utils/formatBytes.d.ts +6 -0
  904. package/dist/leadership/file-upload/utils/getFileExtension.d.ts +6 -0
  905. package/dist/leadership/hooks/useActiveModules.d.ts +45 -0
  906. package/dist/leadership/hooks/useAliasFromUrl.d.ts +33 -0
  907. package/dist/leadership/hooks/useColumnResize.d.ts +45 -0
  908. package/dist/leadership/hooks/useDebounce.d.ts +56 -0
  909. package/dist/leadership/hooks/useDerivedContractedModules.d.ts +8 -0
  910. package/dist/leadership/hooks/useI18nFormatters.d.ts +40 -0
  911. package/dist/leadership/hooks/useMediaQuery.d.ts +14 -0
  912. package/dist/leadership/hooks/useModuleAccess.d.ts +59 -0
  913. package/dist/leadership/hooks/usePageTitle.d.ts +10 -0
  914. package/dist/leadership/hooks/usePermissionQuery.d.ts +49 -0
  915. package/dist/leadership/hooks/useRowResize.d.ts +37 -0
  916. package/dist/leadership/hooks/useSidebarResize.d.ts +37 -0
  917. package/dist/leadership/hooks/useUpdatesNotification.d.ts +27 -0
  918. package/dist/leadership/hooks/useWizard.d.ts +40 -0
  919. package/dist/leadership/i18n/config.d.ts +13 -0
  920. package/dist/leadership/i18n/constants.d.ts +126 -0
  921. package/dist/leadership/i18n/index.d.ts +11 -0
  922. package/dist/leadership/i18n/utils.d.ts +14 -0
  923. package/dist/leadership/index.d.ts +103 -12
  924. package/dist/leadership/index.esm.js +1 -0
  925. package/dist/leadership/index.js +1 -0
  926. package/dist/leadership/integrations/clarity/clarityTracking.d.ts +31 -0
  927. package/dist/leadership/integrations/clarity/index.d.ts +3 -0
  928. package/dist/leadership/integrations/clarity/types.d.ts +46 -0
  929. package/dist/leadership/integrations/clarity/useClarity.d.ts +34 -0
  930. package/dist/leadership/integrations/index.d.ts +5 -0
  931. package/dist/leadership/leadership/components/LeadershipDialog.d.ts +10 -0
  932. package/dist/leadership/leadership/components/LeadershipForm.d.ts +8 -0
  933. package/dist/leadership/leadership/components/LeadershipPage.d.ts +19 -0
  934. package/dist/leadership/leadership/hooks/useLeadershipApi.d.ts +4 -0
  935. package/dist/leadership/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  936. package/dist/leadership/leadership/index.d.ts +13 -0
  937. package/dist/leadership/leadership/types.d.ts +23 -0
  938. package/dist/leadership/leadership/utils/leadershipUtils.d.ts +8 -0
  939. package/dist/leadership/media/components/ImageEditor.d.ts +22 -0
  940. package/dist/leadership/media/components/ImageRenderer.d.ts +23 -0
  941. package/dist/leadership/media/components/VideoEditor.d.ts +2 -0
  942. package/dist/leadership/media/components/VideoRenderer.d.ts +2 -0
  943. package/dist/leadership/media/hooks/useMediaUpload.d.ts +19 -0
  944. package/dist/leadership/media/index.d.ts +49 -0
  945. package/dist/leadership/media/types.d.ts +66 -0
  946. package/dist/leadership/media/utils/imageHelpers.d.ts +28 -0
  947. package/dist/leadership/media/utils/videoHelpers.d.ts +35 -0
  948. package/dist/leadership/mind-map/components/MindMap.d.ts +23 -0
  949. package/dist/leadership/mind-map/components/MindMapConnection.d.ts +12 -0
  950. package/dist/leadership/mind-map/components/MindMapNodeView.d.ts +24 -0
  951. package/dist/leadership/mind-map/components/MindMapToolbar.d.ts +26 -0
  952. package/dist/leadership/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  953. package/dist/leadership/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  954. package/dist/leadership/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  955. package/dist/leadership/mind-map/hooks/useMindMapState.d.ts +32 -0
  956. package/dist/leadership/mind-map/index.d.ts +4 -0
  957. package/dist/leadership/mind-map/types.d.ts +91 -0
  958. package/dist/leadership/mind-map/utils/export-image.d.ts +9 -0
  959. package/dist/leadership/mind-map/utils/layout.d.ts +15 -0
  960. package/dist/leadership/mind-map/utils/nodeOps.d.ts +66 -0
  961. package/dist/leadership/mind-map/utils/serialize.d.ts +10 -0
  962. package/dist/leadership/modules/softwaresMap.d.ts +4 -0
  963. package/dist/leadership/places/components/ManageAccessModal.d.ts +11 -0
  964. package/dist/leadership/places/components/PlaceCard.d.ts +12 -0
  965. package/dist/leadership/places/components/PlacesList.d.ts +12 -0
  966. package/dist/leadership/places/index.d.ts +8 -0
  967. package/dist/leadership/places/services/PlaceService.d.ts +9 -0
  968. package/dist/leadership/places/types.d.ts +10 -0
  969. package/dist/leadership/providers/CoreProviders.d.ts +107 -0
  970. package/dist/leadership/providers/index.d.ts +2 -0
  971. package/dist/leadership/qualiex/components/QualiexUserField.d.ts +133 -0
  972. package/dist/leadership/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  973. package/dist/leadership/qualiex/services/qualiexApi.d.ts +75 -0
  974. package/dist/leadership/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  975. package/dist/leadership/qualiex/utils/userPlaceUtils.d.ts +16 -0
  976. package/dist/leadership/services/BaseService.d.ts +51 -0
  977. package/dist/leadership/services/EmailService.d.ts +110 -0
  978. package/dist/leadership/services/ErrorService.d.ts +19 -0
  979. package/dist/leadership/services/QualiexEnrichmentService.d.ts +53 -0
  980. package/dist/leadership/services/QualiexFieldHelpers.d.ts +17 -0
  981. package/dist/leadership/setup/favicon.d.ts +1 -0
  982. package/dist/leadership/setup.d.ts +16 -0
  983. package/dist/leadership/sign/components/D4SignWidget.d.ts +2 -0
  984. package/dist/leadership/sign/components/DocumentSigner.d.ts +2 -0
  985. package/dist/leadership/sign/components/SignConfigForm.d.ts +2 -0
  986. package/dist/leadership/sign/components/SignWidget.d.ts +9 -0
  987. package/dist/leadership/sign/hooks/useSignConfig.d.ts +6 -0
  988. package/dist/leadership/sign/index.d.ts +8 -0
  989. package/dist/leadership/sign/services/signService.d.ts +17 -0
  990. package/dist/leadership/sign/types.d.ts +53 -0
  991. package/dist/leadership/sign/utils/loadClicksignScript.d.ts +13 -0
  992. package/dist/leadership/supabase/SupabaseSingleton.d.ts +34 -0
  993. package/dist/leadership/supabase/client.d.ts +2 -0
  994. package/dist/leadership/supabase/legacyKeyGuard.d.ts +19 -0
  995. package/dist/leadership/supabase/publicClient.d.ts +2 -0
  996. package/dist/leadership/supabase/types.d.ts +377 -0
  997. package/dist/leadership/team-selector/components/TeamSelector.d.ts +24 -0
  998. package/dist/leadership/team-selector/index.d.ts +2 -0
  999. package/dist/leadership/team-selector/types.d.ts +10 -0
  1000. package/dist/leadership/types/sidebar.d.ts +52 -0
  1001. package/dist/leadership/types.d.ts +593 -13
  1002. package/dist/leadership/utils/color.d.ts +26 -0
  1003. package/dist/leadership/utils/formatters/currencyFormatters.d.ts +1 -0
  1004. package/dist/leadership/utils/formatters/dateFormatters.d.ts +52 -0
  1005. package/dist/leadership/utils/index.d.ts +9 -0
  1006. package/dist/leadership/utils/linkHelpers.d.ts +9 -0
  1007. package/dist/leadership/utils/load-fonts.d.ts +1 -0
  1008. package/dist/places/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  1009. package/dist/places/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  1010. package/dist/places/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  1011. package/dist/places/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  1012. package/dist/places/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  1013. package/dist/places/action-plans/components/ActionPlanPage.d.ts +25 -0
  1014. package/dist/places/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1015. package/dist/places/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1016. package/dist/places/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1017. package/dist/places/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1018. package/dist/places/action-plans/constants.d.ts +86 -0
  1019. package/dist/places/action-plans/hooks/useActionPlan.d.ts +19 -0
  1020. package/dist/places/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1021. package/dist/places/action-plans/index.d.ts +15 -0
  1022. package/dist/places/action-plans/types.d.ts +413 -0
  1023. package/dist/places/action-plans/utils/formatTime.d.ts +24 -0
  1024. package/dist/places/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1025. package/dist/places/approval-flow/components/ApproveDialog.d.ts +13 -0
  1026. package/dist/places/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1027. package/dist/places/approval-flow/index.d.ts +4 -0
  1028. package/dist/places/approval-flow/types.d.ts +76 -0
  1029. package/dist/places/assets/index.d.ts +7 -0
  1030. package/dist/places/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1031. package/dist/places/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1032. package/dist/places/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1033. package/dist/places/audit-trail/index.d.ts +9 -0
  1034. package/dist/places/audit-trail/types.d.ts +209 -0
  1035. package/dist/places/audit-trail/utils.d.ts +54 -0
  1036. package/dist/places/auth/components/AliasRedirect.d.ts +13 -0
  1037. package/dist/places/auth/components/AliasRouteGuard.d.ts +20 -0
  1038. package/dist/places/auth/components/EditProfileDialog.d.ts +13 -0
  1039. package/dist/places/auth/components/ProtectedRoute.d.ts +11 -0
  1040. package/dist/places/auth/components/UserInfo.d.ts +10 -0
  1041. package/dist/places/auth/contexts/AuthContext.d.ts +89 -0
  1042. package/dist/places/auth/pages/CallbackPage.d.ts +6 -0
  1043. package/dist/places/auth/pages/LoginPage.d.ts +2 -0
  1044. package/dist/places/auth/services/AuthService.d.ts +45 -0
  1045. package/dist/places/auth/services/SupabaseTokenService.d.ts +3 -0
  1046. package/dist/places/auth/services/TokenManager.d.ts +66 -0
  1047. package/dist/places/auth/services/TokenRegenerationService.d.ts +14 -0
  1048. package/dist/places/auth/services/TokenService.d.ts +48 -0
  1049. package/dist/places/auth/utils/ErrorInterceptor.d.ts +20 -0
  1050. package/dist/places/components/ErrorBoundary.d.ts +19 -0
  1051. package/dist/places/components/dashboards/dashboard-form.d.ts +65 -0
  1052. package/dist/places/components/dashboards/dashboard-general-view.d.ts +124 -0
  1053. package/dist/places/components/dashboards/dashboard-grid.d.ts +66 -0
  1054. package/dist/places/components/dashboards/dashboard-list.d.ts +41 -0
  1055. package/dist/places/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1056. package/dist/places/components/dashboards/dashboard-view.d.ts +48 -0
  1057. package/dist/places/components/dashboards/helpers.d.ts +86 -0
  1058. package/dist/places/components/dashboards/index.d.ts +9 -0
  1059. package/dist/places/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1060. package/dist/places/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1061. package/dist/places/components/dashboards/panels/index.d.ts +14 -0
  1062. package/dist/places/components/dashboards/panels/list-panel.d.ts +45 -0
  1063. package/dist/places/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1064. package/dist/places/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1065. package/dist/places/components/dashboards/panels/panel-error.d.ts +18 -0
  1066. package/dist/places/components/dashboards/panels/panel-header.d.ts +27 -0
  1067. package/dist/places/components/dashboards/panels/panel-loader.d.ts +17 -0
  1068. package/dist/places/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1069. package/dist/places/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1070. package/dist/places/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1071. package/dist/places/components/dashboards/panels/performance-panel.d.ts +39 -0
  1072. package/dist/places/components/dashboards/panels/pie-panel.d.ts +29 -0
  1073. package/dist/places/components/dashboards/panels/text-panel.d.ts +28 -0
  1074. package/dist/places/components/dashboards/types.d.ts +755 -0
  1075. package/dist/places/components/layout/AppHeader.d.ts +6 -0
  1076. package/dist/places/components/layout/AppLayout.d.ts +10 -0
  1077. package/dist/places/components/layout/AppSidebar.d.ts +10 -0
  1078. package/dist/places/components/layout/BodyContent.d.ts +60 -0
  1079. package/dist/places/components/layout/SidebarActionTrigger.d.ts +46 -0
  1080. package/dist/places/components/layout/SidebarHeader.d.ts +5 -0
  1081. package/dist/places/components/layout/SidebarLogo.d.ts +5 -0
  1082. package/dist/places/components/layout/sidebar-utils.d.ts +12 -0
  1083. package/dist/places/components/modules/AccessDeniedDialog.d.ts +43 -0
  1084. package/dist/places/components/modules/ModuleAccessGuard.d.ts +42 -0
  1085. package/dist/places/components/modules/ModuleGrid.d.ts +9 -0
  1086. package/dist/places/components/modules/ModuleOfferContent.d.ts +20 -0
  1087. package/dist/places/components/modules/ModulesContent.d.ts +21 -0
  1088. package/dist/places/components/modules/ModulesDialog.d.ts +3 -0
  1089. package/dist/places/components/modules/ModulesFooterCards.d.ts +10 -0
  1090. package/dist/places/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1091. package/dist/places/components/modules/index.d.ts +14 -0
  1092. package/dist/places/components/modules/modulesData.d.ts +6 -0
  1093. package/dist/places/components/modules/types.d.ts +41 -0
  1094. package/dist/places/components/ui/accordion.d.ts +42 -0
  1095. package/dist/places/components/ui/action-button.d.ts +48 -0
  1096. package/dist/places/components/ui/alert-dialog.d.ts +102 -0
  1097. package/dist/places/components/ui/alert.d.ts +44 -0
  1098. package/dist/places/components/ui/avatar.d.ts +36 -0
  1099. package/dist/places/components/ui/badge.d.ts +41 -0
  1100. package/dist/places/components/ui/breadcrumb.d.ts +73 -0
  1101. package/dist/places/components/ui/button-group.d.ts +24 -0
  1102. package/dist/places/components/ui/button.d.ts +66 -0
  1103. package/dist/places/components/ui/calendar.d.ts +24 -0
  1104. package/dist/places/components/ui/card.d.ts +57 -0
  1105. package/dist/places/components/ui/chart.d.ts +97 -0
  1106. package/dist/places/components/ui/checkbox.d.ts +15 -0
  1107. package/dist/places/components/ui/collapsible.d.ts +20 -0
  1108. package/dist/places/components/ui/color-picker.d.ts +19 -0
  1109. package/dist/places/components/ui/combo-tree.d.ts +103 -0
  1110. package/dist/places/components/ui/combobox.d.ts +64 -0
  1111. package/dist/places/components/ui/command.d.ts +89 -0
  1112. package/dist/places/components/ui/context-menu.d.ts +122 -0
  1113. package/dist/places/components/ui/data-list.d.ts +86 -0
  1114. package/dist/places/components/ui/date-picker.d.ts +19 -0
  1115. package/dist/places/components/ui/dialog-wizard.d.ts +100 -0
  1116. package/dist/places/components/ui/dialog.d.ts +229 -0
  1117. package/dist/places/components/ui/disabled-menu-item.d.ts +25 -0
  1118. package/dist/places/components/ui/drawer.d.ts +94 -0
  1119. package/dist/places/components/ui/dropdown-menu.d.ts +180 -0
  1120. package/dist/places/components/ui/electronic-signature-dialog.d.ts +31 -0
  1121. package/dist/places/components/ui/empty-state.d.ts +79 -0
  1122. package/dist/places/components/ui/export-dialog.d.ts +48 -0
  1123. package/dist/places/components/ui/form.d.ts +119 -0
  1124. package/dist/places/components/ui/grid.d.ts +53 -0
  1125. package/dist/places/components/ui/hover-card.d.ts +21 -0
  1126. package/dist/places/components/ui/icon-picker.d.ts +17 -0
  1127. package/dist/places/components/ui/iframe-dialog.d.ts +24 -0
  1128. package/dist/places/components/ui/input-group.d.ts +113 -0
  1129. package/dist/places/components/ui/input.d.ts +24 -0
  1130. package/dist/places/components/ui/label.d.ts +23 -0
  1131. package/dist/places/components/ui/loading-state.d.ts +52 -0
  1132. package/dist/places/components/ui/menubar.d.ts +113 -0
  1133. package/dist/places/components/ui/multiselect-permissions.d.ts +84 -0
  1134. package/dist/places/components/ui/navigation-menu.d.ts +57 -0
  1135. package/dist/places/components/ui/onboarding-dialog.d.ts +58 -0
  1136. package/dist/places/components/ui/online-editor-dialog.d.ts +28 -0
  1137. package/dist/places/components/ui/page-breadcrumb.d.ts +77 -0
  1138. package/dist/places/components/ui/pagination.d.ts +81 -0
  1139. package/dist/places/components/ui/popover.d.ts +57 -0
  1140. package/dist/places/components/ui/progress.d.ts +22 -0
  1141. package/dist/places/components/ui/radio-group.d.ts +66 -0
  1142. package/dist/places/components/ui/report-request-list.d.ts +64 -0
  1143. package/dist/places/components/ui/resizable.d.ts +38 -0
  1144. package/dist/places/components/ui/rich-text-editor.d.ts +58 -0
  1145. package/dist/places/components/ui/scroll-area.d.ts +40 -0
  1146. package/dist/places/components/ui/select.d.ts +94 -0
  1147. package/dist/places/components/ui/separator.d.ts +17 -0
  1148. package/dist/places/components/ui/sheet.d.ts +108 -0
  1149. package/dist/places/components/ui/sidebar.d.ts +269 -0
  1150. package/dist/places/components/ui/skeleton-variants.d.ts +41 -0
  1151. package/dist/places/components/ui/skeleton.d.ts +14 -0
  1152. package/dist/places/components/ui/slider.d.ts +9 -0
  1153. package/dist/places/components/ui/sonner.d.ts +8 -0
  1154. package/dist/places/components/ui/spinner.d.ts +11 -0
  1155. package/dist/places/components/ui/split-button.d.ts +76 -0
  1156. package/dist/places/components/ui/stack.d.ts +17 -0
  1157. package/dist/places/components/ui/status-badge.d.ts +52 -0
  1158. package/dist/places/components/ui/step-selector.d.ts +46 -0
  1159. package/dist/places/components/ui/stimulsoft-viewer.d.ts +28 -0
  1160. package/dist/places/components/ui/switch.d.ts +25 -0
  1161. package/dist/places/components/ui/tab-page-layout.d.ts +52 -0
  1162. package/dist/places/components/ui/table-resize-handle.d.ts +22 -0
  1163. package/dist/places/components/ui/table.d.ts +112 -0
  1164. package/dist/places/components/ui/tabs.d.ts +66 -0
  1165. package/dist/places/components/ui/terms-of-use-dialog.d.ts +102 -0
  1166. package/dist/places/components/ui/textarea.d.ts +33 -0
  1167. package/dist/places/components/ui/timepicker.d.ts +34 -0
  1168. package/dist/places/components/ui/toggle-group.d.ts +37 -0
  1169. package/dist/places/components/ui/toggle.d.ts +33 -0
  1170. package/dist/places/components/ui/tooltip.d.ts +61 -0
  1171. package/dist/places/components/ui/truncated-cell.d.ts +20 -0
  1172. package/dist/places/components/ui/typography.d.ts +135 -0
  1173. package/dist/places/components/ui/updates-notification.d.ts +47 -0
  1174. package/dist/places/components/ui/users-groups-selector.d.ts +87 -0
  1175. package/dist/places/components/ui/viewer-dialog.d.ts +184 -0
  1176. package/dist/places/config/backend.d.ts +10 -0
  1177. package/dist/places/config/environments.d.ts +27 -0
  1178. package/dist/places/config/index.d.ts +75 -0
  1179. package/dist/places/contexts/LocaleContext.d.ts +15 -0
  1180. package/dist/places/contexts/ModalStateContext.d.ts +57 -0
  1181. package/dist/places/contexts/ModuleContext.d.ts +34 -0
  1182. package/dist/places/contexts/NavigationContext.d.ts +13 -0
  1183. package/dist/places/contexts/PageMetadataContext.d.ts +48 -0
  1184. package/dist/places/crud/components/ActionMenuItems.d.ts +22 -0
  1185. package/dist/places/crud/components/BaseForm.d.ts +52 -0
  1186. package/dist/places/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1187. package/dist/places/crud/components/ContextMenu.d.ts +21 -0
  1188. package/dist/places/crud/components/CrudActionBar.d.ts +59 -0
  1189. package/dist/places/crud/components/CrudGrid.d.ts +53 -0
  1190. package/dist/places/crud/components/CrudPagination.d.ts +17 -0
  1191. package/dist/places/crud/components/CrudTable.d.ts +66 -0
  1192. package/dist/places/crud/components/FilterBar.d.ts +136 -0
  1193. package/dist/places/crud/components/GroupDropZone.d.ts +16 -0
  1194. package/dist/places/crud/components/InlineRowActions.d.ts +15 -0
  1195. package/dist/places/crud/components/SelectionCheckbox.d.ts +9 -0
  1196. package/dist/places/crud/components/TableFooter.d.ts +14 -0
  1197. package/dist/places/crud/components/TableRowActions.d.ts +19 -0
  1198. package/dist/places/crud/createCrudPage.d.ts +134 -0
  1199. package/dist/places/crud/createSimpleService.d.ts +85 -0
  1200. package/dist/places/crud/generateCrudConfig.d.ts +78 -0
  1201. package/dist/places/crud/hooks/useBaseForm.d.ts +47 -0
  1202. package/dist/places/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1203. package/dist/places/crud/hooks/useColumnManager.d.ts +85 -0
  1204. package/dist/places/crud/hooks/useCrud.d.ts +152 -0
  1205. package/dist/places/crud/primitives/ActionMenu.d.ts +69 -0
  1206. package/dist/places/crud/primitives/FilterBar.d.ts +69 -0
  1207. package/dist/places/crud/primitives/Pagination.d.ts +29 -0
  1208. package/dist/places/crud/primitives/Table.d.ts +31 -0
  1209. package/dist/places/crud/primitives/TreeTable.d.ts +7 -0
  1210. package/dist/places/crud/primitives/index.d.ts +12 -0
  1211. package/dist/places/crud/primitives/types.d.ts +199 -0
  1212. package/dist/places/crud/utils/routingHelpers.d.ts +41 -0
  1213. package/dist/places/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1214. package/dist/places/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1215. package/dist/places/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1216. package/dist/places/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1217. package/dist/places/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1218. package/dist/places/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1219. package/dist/places/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1220. package/dist/places/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1221. package/dist/places/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1222. package/dist/places/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1223. package/dist/places/custom-form-fields/index.d.ts +13 -0
  1224. package/dist/places/custom-form-fields/types.d.ts +206 -0
  1225. package/dist/places/exports/action-plans.d.ts +16 -0
  1226. package/dist/places/exports/audit-trail.d.ts +1 -0
  1227. package/dist/places/exports/crud.d.ts +31 -0
  1228. package/dist/places/exports/custom-form-fields.d.ts +1 -0
  1229. package/dist/places/exports/file-upload.d.ts +1 -0
  1230. package/dist/places/exports/integrations.d.ts +15 -0
  1231. package/dist/places/exports/ui.d.ts +98 -0
  1232. package/dist/places/file-upload/components/SingleFileUpload.d.ts +102 -0
  1233. package/dist/places/file-upload/index.d.ts +6 -0
  1234. package/dist/places/file-upload/types.d.ts +26 -0
  1235. package/dist/places/file-upload/utils/formatBytes.d.ts +6 -0
  1236. package/dist/places/file-upload/utils/getFileExtension.d.ts +6 -0
  1237. package/dist/places/hooks/useActiveModules.d.ts +45 -0
  1238. package/dist/places/hooks/useAliasFromUrl.d.ts +33 -0
  1239. package/dist/places/hooks/useColumnResize.d.ts +45 -0
  1240. package/dist/places/hooks/useDebounce.d.ts +56 -0
  1241. package/dist/places/hooks/useDerivedContractedModules.d.ts +8 -0
  1242. package/dist/places/hooks/useI18nFormatters.d.ts +40 -0
  1243. package/dist/places/hooks/useMediaQuery.d.ts +14 -0
  1244. package/dist/places/hooks/useModuleAccess.d.ts +59 -0
  1245. package/dist/places/hooks/usePageTitle.d.ts +10 -0
  1246. package/dist/places/hooks/usePermissionQuery.d.ts +49 -0
  1247. package/dist/places/hooks/useRowResize.d.ts +37 -0
  1248. package/dist/places/hooks/useSidebarResize.d.ts +37 -0
  1249. package/dist/places/hooks/useUpdatesNotification.d.ts +27 -0
  1250. package/dist/places/hooks/useWizard.d.ts +40 -0
  1251. package/dist/places/i18n/config.d.ts +13 -0
  1252. package/dist/places/i18n/constants.d.ts +126 -0
  1253. package/dist/places/i18n/index.d.ts +11 -0
  1254. package/dist/places/i18n/utils.d.ts +14 -0
  1255. package/dist/places/index.d.ts +104 -8
  1256. package/dist/places/index.esm.js +1 -0
  1257. package/dist/places/index.js +1 -0
  1258. package/dist/places/integrations/clarity/clarityTracking.d.ts +31 -0
  1259. package/dist/places/integrations/clarity/index.d.ts +3 -0
  1260. package/dist/places/integrations/clarity/types.d.ts +46 -0
  1261. package/dist/places/integrations/clarity/useClarity.d.ts +34 -0
  1262. package/dist/places/integrations/index.d.ts +5 -0
  1263. package/dist/places/leadership/components/LeadershipDialog.d.ts +10 -0
  1264. package/dist/places/leadership/components/LeadershipForm.d.ts +8 -0
  1265. package/dist/places/leadership/components/LeadershipPage.d.ts +19 -0
  1266. package/dist/places/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1267. package/dist/places/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1268. package/dist/places/leadership/index.d.ts +13 -0
  1269. package/dist/places/leadership/types.d.ts +23 -0
  1270. package/dist/places/leadership/utils/leadershipUtils.d.ts +8 -0
  1271. package/dist/places/media/components/ImageEditor.d.ts +22 -0
  1272. package/dist/places/media/components/ImageRenderer.d.ts +23 -0
  1273. package/dist/places/media/components/VideoEditor.d.ts +2 -0
  1274. package/dist/places/media/components/VideoRenderer.d.ts +2 -0
  1275. package/dist/places/media/hooks/useMediaUpload.d.ts +19 -0
  1276. package/dist/places/media/index.d.ts +49 -0
  1277. package/dist/places/media/types.d.ts +66 -0
  1278. package/dist/places/media/utils/imageHelpers.d.ts +28 -0
  1279. package/dist/places/media/utils/videoHelpers.d.ts +35 -0
  1280. package/dist/places/mind-map/components/MindMap.d.ts +23 -0
  1281. package/dist/places/mind-map/components/MindMapConnection.d.ts +12 -0
  1282. package/dist/places/mind-map/components/MindMapNodeView.d.ts +24 -0
  1283. package/dist/places/mind-map/components/MindMapToolbar.d.ts +26 -0
  1284. package/dist/places/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1285. package/dist/places/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1286. package/dist/places/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1287. package/dist/places/mind-map/hooks/useMindMapState.d.ts +32 -0
  1288. package/dist/places/mind-map/index.d.ts +4 -0
  1289. package/dist/places/mind-map/types.d.ts +91 -0
  1290. package/dist/places/mind-map/utils/export-image.d.ts +9 -0
  1291. package/dist/places/mind-map/utils/layout.d.ts +15 -0
  1292. package/dist/places/mind-map/utils/nodeOps.d.ts +66 -0
  1293. package/dist/places/mind-map/utils/serialize.d.ts +10 -0
  1294. package/dist/places/modules/softwaresMap.d.ts +4 -0
  1295. package/dist/places/places/components/ManageAccessModal.d.ts +11 -0
  1296. package/dist/places/places/components/PlaceCard.d.ts +12 -0
  1297. package/dist/places/places/components/PlacesList.d.ts +12 -0
  1298. package/dist/places/places/index.d.ts +8 -0
  1299. package/dist/places/places/services/PlaceService.d.ts +9 -0
  1300. package/dist/places/places/types.d.ts +10 -0
  1301. package/dist/places/providers/CoreProviders.d.ts +107 -0
  1302. package/dist/places/providers/index.d.ts +2 -0
  1303. package/dist/places/qualiex/components/QualiexUserField.d.ts +133 -0
  1304. package/dist/places/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1305. package/dist/places/qualiex/services/qualiexApi.d.ts +75 -0
  1306. package/dist/places/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1307. package/dist/places/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1308. package/dist/places/services/BaseService.d.ts +51 -0
  1309. package/dist/places/services/EmailService.d.ts +110 -0
  1310. package/dist/places/services/ErrorService.d.ts +19 -0
  1311. package/dist/places/services/QualiexEnrichmentService.d.ts +53 -0
  1312. package/dist/places/services/QualiexFieldHelpers.d.ts +17 -0
  1313. package/dist/places/setup/favicon.d.ts +1 -0
  1314. package/dist/places/setup.d.ts +16 -0
  1315. package/dist/places/sign/components/D4SignWidget.d.ts +2 -0
  1316. package/dist/places/sign/components/DocumentSigner.d.ts +2 -0
  1317. package/dist/places/sign/components/SignConfigForm.d.ts +2 -0
  1318. package/dist/places/sign/components/SignWidget.d.ts +9 -0
  1319. package/dist/places/sign/hooks/useSignConfig.d.ts +6 -0
  1320. package/dist/places/sign/index.d.ts +8 -0
  1321. package/dist/places/sign/services/signService.d.ts +17 -0
  1322. package/dist/places/sign/types.d.ts +53 -0
  1323. package/dist/places/sign/utils/loadClicksignScript.d.ts +13 -0
  1324. package/dist/places/supabase/SupabaseSingleton.d.ts +34 -0
  1325. package/dist/places/supabase/client.d.ts +2 -0
  1326. package/dist/places/supabase/legacyKeyGuard.d.ts +19 -0
  1327. package/dist/places/supabase/publicClient.d.ts +2 -0
  1328. package/dist/places/supabase/types.d.ts +377 -0
  1329. package/dist/places/team-selector/components/TeamSelector.d.ts +24 -0
  1330. package/dist/places/team-selector/index.d.ts +2 -0
  1331. package/dist/places/team-selector/types.d.ts +10 -0
  1332. package/dist/places/types/sidebar.d.ts +52 -0
  1333. package/dist/places/types.d.ts +599 -6
  1334. package/dist/places/utils/color.d.ts +26 -0
  1335. package/dist/places/utils/formatters/currencyFormatters.d.ts +1 -0
  1336. package/dist/places/utils/formatters/dateFormatters.d.ts +52 -0
  1337. package/dist/places/utils/index.d.ts +9 -0
  1338. package/dist/places/utils/linkHelpers.d.ts +9 -0
  1339. package/dist/places/utils/load-fonts.d.ts +1 -0
  1340. package/dist/providers/CoreProviders.d.ts +14 -1
  1341. package/dist/sign/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  1342. package/dist/sign/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  1343. package/dist/sign/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  1344. package/dist/sign/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  1345. package/dist/sign/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  1346. package/dist/sign/action-plans/components/ActionPlanPage.d.ts +25 -0
  1347. package/dist/sign/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1348. package/dist/sign/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1349. package/dist/sign/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1350. package/dist/sign/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1351. package/dist/sign/action-plans/constants.d.ts +86 -0
  1352. package/dist/sign/action-plans/hooks/useActionPlan.d.ts +19 -0
  1353. package/dist/sign/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1354. package/dist/sign/action-plans/index.d.ts +15 -0
  1355. package/dist/sign/action-plans/types.d.ts +413 -0
  1356. package/dist/sign/action-plans/utils/formatTime.d.ts +24 -0
  1357. package/dist/sign/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1358. package/dist/sign/approval-flow/components/ApproveDialog.d.ts +13 -0
  1359. package/dist/sign/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1360. package/dist/sign/approval-flow/index.d.ts +4 -0
  1361. package/dist/sign/approval-flow/types.d.ts +76 -0
  1362. package/dist/sign/assets/index.d.ts +7 -0
  1363. package/dist/sign/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1364. package/dist/sign/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1365. package/dist/sign/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1366. package/dist/sign/audit-trail/index.d.ts +9 -0
  1367. package/dist/sign/audit-trail/types.d.ts +209 -0
  1368. package/dist/sign/audit-trail/utils.d.ts +54 -0
  1369. package/dist/sign/auth/components/AliasRedirect.d.ts +13 -0
  1370. package/dist/sign/auth/components/AliasRouteGuard.d.ts +20 -0
  1371. package/dist/sign/auth/components/EditProfileDialog.d.ts +13 -0
  1372. package/dist/sign/auth/components/ProtectedRoute.d.ts +11 -0
  1373. package/dist/sign/auth/components/UserInfo.d.ts +10 -0
  1374. package/dist/sign/auth/contexts/AuthContext.d.ts +89 -0
  1375. package/dist/sign/auth/pages/CallbackPage.d.ts +6 -0
  1376. package/dist/sign/auth/pages/LoginPage.d.ts +2 -0
  1377. package/dist/sign/auth/services/AuthService.d.ts +45 -0
  1378. package/dist/sign/auth/services/SupabaseTokenService.d.ts +3 -0
  1379. package/dist/sign/auth/services/TokenManager.d.ts +66 -0
  1380. package/dist/sign/auth/services/TokenRegenerationService.d.ts +14 -0
  1381. package/dist/sign/auth/services/TokenService.d.ts +48 -0
  1382. package/dist/sign/auth/utils/ErrorInterceptor.d.ts +20 -0
  1383. package/dist/sign/components/ErrorBoundary.d.ts +19 -0
  1384. package/dist/sign/components/dashboards/dashboard-form.d.ts +65 -0
  1385. package/dist/sign/components/dashboards/dashboard-general-view.d.ts +124 -0
  1386. package/dist/sign/components/dashboards/dashboard-grid.d.ts +66 -0
  1387. package/dist/sign/components/dashboards/dashboard-list.d.ts +41 -0
  1388. package/dist/sign/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1389. package/dist/sign/components/dashboards/dashboard-view.d.ts +48 -0
  1390. package/dist/sign/components/dashboards/helpers.d.ts +86 -0
  1391. package/dist/sign/components/dashboards/index.d.ts +9 -0
  1392. package/dist/sign/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1393. package/dist/sign/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1394. package/dist/sign/components/dashboards/panels/index.d.ts +14 -0
  1395. package/dist/sign/components/dashboards/panels/list-panel.d.ts +45 -0
  1396. package/dist/sign/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1397. package/dist/sign/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1398. package/dist/sign/components/dashboards/panels/panel-error.d.ts +18 -0
  1399. package/dist/sign/components/dashboards/panels/panel-header.d.ts +27 -0
  1400. package/dist/sign/components/dashboards/panels/panel-loader.d.ts +17 -0
  1401. package/dist/sign/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1402. package/dist/sign/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1403. package/dist/sign/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1404. package/dist/sign/components/dashboards/panels/performance-panel.d.ts +39 -0
  1405. package/dist/sign/components/dashboards/panels/pie-panel.d.ts +29 -0
  1406. package/dist/sign/components/dashboards/panels/text-panel.d.ts +28 -0
  1407. package/dist/sign/components/dashboards/types.d.ts +755 -0
  1408. package/dist/sign/components/layout/AppHeader.d.ts +6 -0
  1409. package/dist/sign/components/layout/AppLayout.d.ts +10 -0
  1410. package/dist/sign/components/layout/AppSidebar.d.ts +10 -0
  1411. package/dist/sign/components/layout/BodyContent.d.ts +60 -0
  1412. package/dist/sign/components/layout/SidebarActionTrigger.d.ts +46 -0
  1413. package/dist/sign/components/layout/SidebarHeader.d.ts +5 -0
  1414. package/dist/sign/components/layout/SidebarLogo.d.ts +5 -0
  1415. package/dist/sign/components/layout/sidebar-utils.d.ts +12 -0
  1416. package/dist/sign/components/modules/AccessDeniedDialog.d.ts +43 -0
  1417. package/dist/sign/components/modules/ModuleAccessGuard.d.ts +42 -0
  1418. package/dist/sign/components/modules/ModuleGrid.d.ts +9 -0
  1419. package/dist/sign/components/modules/ModuleOfferContent.d.ts +20 -0
  1420. package/dist/sign/components/modules/ModulesContent.d.ts +21 -0
  1421. package/dist/sign/components/modules/ModulesDialog.d.ts +3 -0
  1422. package/dist/sign/components/modules/ModulesFooterCards.d.ts +10 -0
  1423. package/dist/sign/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1424. package/dist/sign/components/modules/index.d.ts +14 -0
  1425. package/dist/sign/components/modules/modulesData.d.ts +6 -0
  1426. package/dist/sign/components/modules/types.d.ts +41 -0
  1427. package/dist/sign/components/ui/accordion.d.ts +42 -0
  1428. package/dist/sign/components/ui/action-button.d.ts +48 -0
  1429. package/dist/sign/components/ui/alert-dialog.d.ts +102 -0
  1430. package/dist/sign/components/ui/alert.d.ts +44 -0
  1431. package/dist/sign/components/ui/avatar.d.ts +36 -0
  1432. package/dist/sign/components/ui/badge.d.ts +41 -0
  1433. package/dist/sign/components/ui/breadcrumb.d.ts +73 -0
  1434. package/dist/sign/components/ui/button-group.d.ts +24 -0
  1435. package/dist/sign/components/ui/button.d.ts +66 -0
  1436. package/dist/sign/components/ui/calendar.d.ts +24 -0
  1437. package/dist/sign/components/ui/card.d.ts +57 -0
  1438. package/dist/sign/components/ui/chart.d.ts +97 -0
  1439. package/dist/sign/components/ui/checkbox.d.ts +15 -0
  1440. package/dist/sign/components/ui/collapsible.d.ts +20 -0
  1441. package/dist/sign/components/ui/color-picker.d.ts +19 -0
  1442. package/dist/sign/components/ui/combo-tree.d.ts +103 -0
  1443. package/dist/sign/components/ui/combobox.d.ts +64 -0
  1444. package/dist/sign/components/ui/command.d.ts +89 -0
  1445. package/dist/sign/components/ui/context-menu.d.ts +122 -0
  1446. package/dist/sign/components/ui/data-list.d.ts +86 -0
  1447. package/dist/sign/components/ui/date-picker.d.ts +19 -0
  1448. package/dist/sign/components/ui/dialog-wizard.d.ts +100 -0
  1449. package/dist/sign/components/ui/dialog.d.ts +229 -0
  1450. package/dist/sign/components/ui/disabled-menu-item.d.ts +25 -0
  1451. package/dist/sign/components/ui/drawer.d.ts +94 -0
  1452. package/dist/sign/components/ui/dropdown-menu.d.ts +180 -0
  1453. package/dist/sign/components/ui/electronic-signature-dialog.d.ts +31 -0
  1454. package/dist/sign/components/ui/empty-state.d.ts +79 -0
  1455. package/dist/sign/components/ui/export-dialog.d.ts +48 -0
  1456. package/dist/sign/components/ui/form.d.ts +119 -0
  1457. package/dist/sign/components/ui/grid.d.ts +53 -0
  1458. package/dist/sign/components/ui/hover-card.d.ts +21 -0
  1459. package/dist/sign/components/ui/icon-picker.d.ts +17 -0
  1460. package/dist/sign/components/ui/iframe-dialog.d.ts +24 -0
  1461. package/dist/sign/components/ui/input-group.d.ts +113 -0
  1462. package/dist/sign/components/ui/input.d.ts +24 -0
  1463. package/dist/sign/components/ui/label.d.ts +23 -0
  1464. package/dist/sign/components/ui/loading-state.d.ts +52 -0
  1465. package/dist/sign/components/ui/menubar.d.ts +113 -0
  1466. package/dist/sign/components/ui/multiselect-permissions.d.ts +84 -0
  1467. package/dist/sign/components/ui/navigation-menu.d.ts +57 -0
  1468. package/dist/sign/components/ui/onboarding-dialog.d.ts +58 -0
  1469. package/dist/sign/components/ui/online-editor-dialog.d.ts +28 -0
  1470. package/dist/sign/components/ui/page-breadcrumb.d.ts +77 -0
  1471. package/dist/sign/components/ui/pagination.d.ts +81 -0
  1472. package/dist/sign/components/ui/popover.d.ts +57 -0
  1473. package/dist/sign/components/ui/progress.d.ts +22 -0
  1474. package/dist/sign/components/ui/radio-group.d.ts +66 -0
  1475. package/dist/sign/components/ui/report-request-list.d.ts +64 -0
  1476. package/dist/sign/components/ui/resizable.d.ts +38 -0
  1477. package/dist/sign/components/ui/rich-text-editor.d.ts +58 -0
  1478. package/dist/sign/components/ui/scroll-area.d.ts +40 -0
  1479. package/dist/sign/components/ui/select.d.ts +94 -0
  1480. package/dist/sign/components/ui/separator.d.ts +17 -0
  1481. package/dist/sign/components/ui/sheet.d.ts +108 -0
  1482. package/dist/sign/components/ui/sidebar.d.ts +269 -0
  1483. package/dist/sign/components/ui/skeleton-variants.d.ts +41 -0
  1484. package/dist/sign/components/ui/skeleton.d.ts +14 -0
  1485. package/dist/sign/components/ui/slider.d.ts +9 -0
  1486. package/dist/sign/components/ui/sonner.d.ts +8 -0
  1487. package/dist/sign/components/ui/spinner.d.ts +11 -0
  1488. package/dist/sign/components/ui/split-button.d.ts +76 -0
  1489. package/dist/sign/components/ui/stack.d.ts +17 -0
  1490. package/dist/sign/components/ui/status-badge.d.ts +52 -0
  1491. package/dist/sign/components/ui/step-selector.d.ts +46 -0
  1492. package/dist/sign/components/ui/stimulsoft-viewer.d.ts +28 -0
  1493. package/dist/sign/components/ui/switch.d.ts +25 -0
  1494. package/dist/sign/components/ui/tab-page-layout.d.ts +52 -0
  1495. package/dist/sign/components/ui/table-resize-handle.d.ts +22 -0
  1496. package/dist/sign/components/ui/table.d.ts +112 -0
  1497. package/dist/sign/components/ui/tabs.d.ts +66 -0
  1498. package/dist/sign/components/ui/terms-of-use-dialog.d.ts +102 -0
  1499. package/dist/sign/components/ui/textarea.d.ts +33 -0
  1500. package/dist/sign/components/ui/timepicker.d.ts +34 -0
  1501. package/dist/sign/components/ui/toggle-group.d.ts +37 -0
  1502. package/dist/sign/components/ui/toggle.d.ts +33 -0
  1503. package/dist/sign/components/ui/tooltip.d.ts +61 -0
  1504. package/dist/sign/components/ui/truncated-cell.d.ts +20 -0
  1505. package/dist/sign/components/ui/typography.d.ts +135 -0
  1506. package/dist/sign/components/ui/updates-notification.d.ts +47 -0
  1507. package/dist/sign/components/ui/users-groups-selector.d.ts +87 -0
  1508. package/dist/sign/components/ui/viewer-dialog.d.ts +184 -0
  1509. package/dist/sign/config/backend.d.ts +10 -0
  1510. package/dist/sign/config/environments.d.ts +27 -0
  1511. package/dist/sign/config/index.d.ts +75 -0
  1512. package/dist/sign/contexts/LocaleContext.d.ts +15 -0
  1513. package/dist/sign/contexts/ModalStateContext.d.ts +57 -0
  1514. package/dist/sign/contexts/ModuleContext.d.ts +34 -0
  1515. package/dist/sign/contexts/NavigationContext.d.ts +13 -0
  1516. package/dist/sign/contexts/PageMetadataContext.d.ts +48 -0
  1517. package/dist/sign/crud/components/ActionMenuItems.d.ts +22 -0
  1518. package/dist/sign/crud/components/BaseForm.d.ts +52 -0
  1519. package/dist/sign/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1520. package/dist/sign/crud/components/ContextMenu.d.ts +21 -0
  1521. package/dist/sign/crud/components/CrudActionBar.d.ts +59 -0
  1522. package/dist/sign/crud/components/CrudGrid.d.ts +53 -0
  1523. package/dist/sign/crud/components/CrudPagination.d.ts +17 -0
  1524. package/dist/sign/crud/components/CrudTable.d.ts +66 -0
  1525. package/dist/sign/crud/components/FilterBar.d.ts +136 -0
  1526. package/dist/sign/crud/components/GroupDropZone.d.ts +16 -0
  1527. package/dist/sign/crud/components/InlineRowActions.d.ts +15 -0
  1528. package/dist/sign/crud/components/SelectionCheckbox.d.ts +9 -0
  1529. package/dist/sign/crud/components/TableFooter.d.ts +14 -0
  1530. package/dist/sign/crud/components/TableRowActions.d.ts +19 -0
  1531. package/dist/sign/crud/createCrudPage.d.ts +134 -0
  1532. package/dist/sign/crud/createSimpleService.d.ts +85 -0
  1533. package/dist/sign/crud/generateCrudConfig.d.ts +78 -0
  1534. package/dist/sign/crud/hooks/useBaseForm.d.ts +47 -0
  1535. package/dist/sign/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1536. package/dist/sign/crud/hooks/useColumnManager.d.ts +85 -0
  1537. package/dist/sign/crud/hooks/useCrud.d.ts +152 -0
  1538. package/dist/sign/crud/primitives/ActionMenu.d.ts +69 -0
  1539. package/dist/sign/crud/primitives/FilterBar.d.ts +69 -0
  1540. package/dist/sign/crud/primitives/Pagination.d.ts +29 -0
  1541. package/dist/sign/crud/primitives/Table.d.ts +31 -0
  1542. package/dist/sign/crud/primitives/TreeTable.d.ts +7 -0
  1543. package/dist/sign/crud/primitives/index.d.ts +12 -0
  1544. package/dist/sign/crud/primitives/types.d.ts +199 -0
  1545. package/dist/sign/crud/utils/routingHelpers.d.ts +41 -0
  1546. package/dist/sign/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1547. package/dist/sign/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1548. package/dist/sign/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1549. package/dist/sign/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1550. package/dist/sign/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1551. package/dist/sign/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1552. package/dist/sign/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1553. package/dist/sign/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1554. package/dist/sign/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1555. package/dist/sign/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1556. package/dist/sign/custom-form-fields/index.d.ts +13 -0
  1557. package/dist/sign/custom-form-fields/types.d.ts +206 -0
  1558. package/dist/sign/exports/action-plans.d.ts +16 -0
  1559. package/dist/sign/exports/audit-trail.d.ts +1 -0
  1560. package/dist/sign/exports/crud.d.ts +31 -0
  1561. package/dist/sign/exports/custom-form-fields.d.ts +1 -0
  1562. package/dist/sign/exports/file-upload.d.ts +1 -0
  1563. package/dist/sign/exports/integrations.d.ts +15 -0
  1564. package/dist/sign/exports/ui.d.ts +98 -0
  1565. package/dist/sign/file-upload/components/SingleFileUpload.d.ts +102 -0
  1566. package/dist/sign/file-upload/index.d.ts +6 -0
  1567. package/dist/sign/file-upload/types.d.ts +26 -0
  1568. package/dist/sign/file-upload/utils/formatBytes.d.ts +6 -0
  1569. package/dist/sign/file-upload/utils/getFileExtension.d.ts +6 -0
  1570. package/dist/sign/hooks/useActiveModules.d.ts +45 -0
  1571. package/dist/sign/hooks/useAliasFromUrl.d.ts +33 -0
  1572. package/dist/sign/hooks/useColumnResize.d.ts +45 -0
  1573. package/dist/sign/hooks/useDebounce.d.ts +56 -0
  1574. package/dist/sign/hooks/useDerivedContractedModules.d.ts +8 -0
  1575. package/dist/sign/hooks/useI18nFormatters.d.ts +40 -0
  1576. package/dist/sign/hooks/useMediaQuery.d.ts +14 -0
  1577. package/dist/sign/hooks/useModuleAccess.d.ts +59 -0
  1578. package/dist/sign/hooks/usePageTitle.d.ts +10 -0
  1579. package/dist/sign/hooks/usePermissionQuery.d.ts +49 -0
  1580. package/dist/sign/hooks/useRowResize.d.ts +37 -0
  1581. package/dist/sign/hooks/useSidebarResize.d.ts +37 -0
  1582. package/dist/sign/hooks/useUpdatesNotification.d.ts +27 -0
  1583. package/dist/sign/hooks/useWizard.d.ts +40 -0
  1584. package/dist/sign/i18n/config.d.ts +13 -0
  1585. package/dist/sign/i18n/constants.d.ts +126 -0
  1586. package/dist/sign/i18n/index.d.ts +11 -0
  1587. package/dist/sign/i18n/utils.d.ts +14 -0
  1588. package/dist/sign/index.d.ts +104 -8
  1589. package/dist/sign/index.esm.js +1 -0
  1590. package/dist/sign/index.js +1 -0
  1591. package/dist/sign/integrations/clarity/clarityTracking.d.ts +31 -0
  1592. package/dist/sign/integrations/clarity/index.d.ts +3 -0
  1593. package/dist/sign/integrations/clarity/types.d.ts +46 -0
  1594. package/dist/sign/integrations/clarity/useClarity.d.ts +34 -0
  1595. package/dist/sign/integrations/index.d.ts +5 -0
  1596. package/dist/sign/leadership/components/LeadershipDialog.d.ts +10 -0
  1597. package/dist/sign/leadership/components/LeadershipForm.d.ts +8 -0
  1598. package/dist/sign/leadership/components/LeadershipPage.d.ts +19 -0
  1599. package/dist/sign/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1600. package/dist/sign/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1601. package/dist/sign/leadership/index.d.ts +13 -0
  1602. package/dist/sign/leadership/types.d.ts +23 -0
  1603. package/dist/sign/leadership/utils/leadershipUtils.d.ts +8 -0
  1604. package/dist/sign/media/components/ImageEditor.d.ts +22 -0
  1605. package/dist/sign/media/components/ImageRenderer.d.ts +23 -0
  1606. package/dist/sign/media/components/VideoEditor.d.ts +2 -0
  1607. package/dist/sign/media/components/VideoRenderer.d.ts +2 -0
  1608. package/dist/sign/media/hooks/useMediaUpload.d.ts +19 -0
  1609. package/dist/sign/media/index.d.ts +49 -0
  1610. package/dist/sign/media/types.d.ts +66 -0
  1611. package/dist/sign/media/utils/imageHelpers.d.ts +28 -0
  1612. package/dist/sign/media/utils/videoHelpers.d.ts +35 -0
  1613. package/dist/sign/mind-map/components/MindMap.d.ts +23 -0
  1614. package/dist/sign/mind-map/components/MindMapConnection.d.ts +12 -0
  1615. package/dist/sign/mind-map/components/MindMapNodeView.d.ts +24 -0
  1616. package/dist/sign/mind-map/components/MindMapToolbar.d.ts +26 -0
  1617. package/dist/sign/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1618. package/dist/sign/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1619. package/dist/sign/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1620. package/dist/sign/mind-map/hooks/useMindMapState.d.ts +32 -0
  1621. package/dist/sign/mind-map/index.d.ts +4 -0
  1622. package/dist/sign/mind-map/types.d.ts +91 -0
  1623. package/dist/sign/mind-map/utils/export-image.d.ts +9 -0
  1624. package/dist/sign/mind-map/utils/layout.d.ts +15 -0
  1625. package/dist/sign/mind-map/utils/nodeOps.d.ts +66 -0
  1626. package/dist/sign/mind-map/utils/serialize.d.ts +10 -0
  1627. package/dist/sign/modules/softwaresMap.d.ts +4 -0
  1628. package/dist/sign/places/components/ManageAccessModal.d.ts +11 -0
  1629. package/dist/sign/places/components/PlaceCard.d.ts +12 -0
  1630. package/dist/sign/places/components/PlacesList.d.ts +12 -0
  1631. package/dist/sign/places/index.d.ts +8 -0
  1632. package/dist/sign/places/services/PlaceService.d.ts +9 -0
  1633. package/dist/sign/places/types.d.ts +10 -0
  1634. package/dist/sign/providers/CoreProviders.d.ts +107 -0
  1635. package/dist/sign/providers/index.d.ts +2 -0
  1636. package/dist/sign/qualiex/components/QualiexUserField.d.ts +133 -0
  1637. package/dist/sign/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1638. package/dist/sign/qualiex/services/qualiexApi.d.ts +75 -0
  1639. package/dist/sign/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1640. package/dist/sign/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1641. package/dist/sign/services/BaseService.d.ts +51 -0
  1642. package/dist/sign/services/EmailService.d.ts +110 -0
  1643. package/dist/sign/services/ErrorService.d.ts +19 -0
  1644. package/dist/sign/services/QualiexEnrichmentService.d.ts +53 -0
  1645. package/dist/sign/services/QualiexFieldHelpers.d.ts +17 -0
  1646. package/dist/sign/setup/favicon.d.ts +1 -0
  1647. package/dist/sign/setup.d.ts +16 -0
  1648. package/dist/sign/sign/components/D4SignWidget.d.ts +2 -0
  1649. package/dist/sign/sign/components/DocumentSigner.d.ts +2 -0
  1650. package/dist/sign/sign/components/SignConfigForm.d.ts +2 -0
  1651. package/dist/sign/sign/components/SignWidget.d.ts +9 -0
  1652. package/dist/sign/sign/hooks/useSignConfig.d.ts +6 -0
  1653. package/dist/sign/sign/index.d.ts +8 -0
  1654. package/dist/sign/sign/services/signService.d.ts +17 -0
  1655. package/dist/sign/sign/types.d.ts +53 -0
  1656. package/dist/sign/sign/utils/loadClicksignScript.d.ts +13 -0
  1657. package/dist/sign/supabase/SupabaseSingleton.d.ts +34 -0
  1658. package/dist/sign/supabase/client.d.ts +2 -0
  1659. package/dist/sign/supabase/legacyKeyGuard.d.ts +19 -0
  1660. package/dist/sign/supabase/publicClient.d.ts +2 -0
  1661. package/dist/sign/supabase/types.d.ts +377 -0
  1662. package/dist/sign/team-selector/components/TeamSelector.d.ts +24 -0
  1663. package/dist/sign/team-selector/index.d.ts +2 -0
  1664. package/dist/sign/team-selector/types.d.ts +10 -0
  1665. package/dist/sign/types/sidebar.d.ts +52 -0
  1666. package/dist/sign/types.d.ts +596 -46
  1667. package/dist/sign/utils/color.d.ts +26 -0
  1668. package/dist/sign/utils/formatters/currencyFormatters.d.ts +1 -0
  1669. package/dist/sign/utils/formatters/dateFormatters.d.ts +52 -0
  1670. package/dist/sign/utils/index.d.ts +9 -0
  1671. package/dist/sign/utils/linkHelpers.d.ts +9 -0
  1672. package/dist/sign/utils/load-fonts.d.ts +1 -0
  1673. package/dist/supabase/SupabaseSingleton.d.ts +19 -22
  1674. package/dist/vite/index.esm.js +24 -1
  1675. package/dist/vite/index.js +24 -0
  1676. package/docs/PUBLISH.md +18 -6
  1677. package/docs/WORKSPACE_KNOWLEDGE.md +34 -1
  1678. package/docs/design-system/patterns/core-providers.md +38 -1
  1679. package/docs/design-system/patterns/feature-flags.md +53 -21
  1680. package/package.json +26 -1
  1681. package/dist/README.md +0 -1079
  1682. package/dist/bin/bootstrap.js +0 -40
  1683. package/dist/bin/pull-docs.js +0 -186
  1684. package/dist/docs/KNOWLEDGE.md +0 -109
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("i18next"),a=require("react/jsx-runtime"),t=require("react"),s=require("@radix-ui/react-slot"),r=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),d=require("lucide-react"),c=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),v=require("@radix-ui/react-tooltip"),b=require("@radix-ui/react-popover"),y=require("react-i18next"),j=require("@supabase/supabase-js"),w=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),T=require("@radix-ui/react-switch"),P=require("@radix-ui/react-collapsible"),D=require("@radix-ui/react-tabs"),E=require("@radix-ui/react-accordion"),A=require("@radix-ui/react-avatar"),I=require("react-day-picker"),M=require("vaul"),F=require("@radix-ui/react-hover-card"),R=require("@radix-ui/react-navigation-menu"),L=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),U=require("react-resizable-panels"),O=require("@radix-ui/react-slider"),V=require("@radix-ui/react-menubar"),B=require("recharts"),q=require("@tiptap/react"),$=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable"),J=require("zod"),Z=require("@hookform/resolvers");function ee(e){var a=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}}),a.default=e,Object.freeze(a)}var ae=ee(t),te=ee(d),se=ee(c),re=ee(u),ne=ee(m),oe=ee(p),ie=ee(x),le=ee(f),de=ee(g),ce=ee(v),ue=ee(b),me=ee(_),pe=ee(C),he=ee(k),xe=ee(S),fe=ee(T),ge=ee(P),ve=ee(D),be=ee(E),ye=ee(A),je=ee(F),we=ee(R),Ne=ee(L),_e=ee(z),Ce=ee(U),ke=ee(O),Se=ee(V),Te=ee(B);const Pe="ccjfvpnndclajkleyqkc",De={storageProjectId:"ccjfvpnndclajkleyqkc",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api.qualiex.com"},Ee={storageProjectId:"ccjfvpnndclajkleyqkc",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com"};function Ae(){let e=(void 0).VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=(void 0).VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e===Pe?De:Ee}function Ie(){let e=(void 0).VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=(void 0).VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e!==Pe}const Me={get oauth(){const e=Ae();return{authUrl:e.oauth.authUrl,clientId:e.oauth.clientId,responseType:"id_token token",scope:"openid profile email"}}},Fe={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Re={debounceDelay:500},Le=()=>{const e=window.location.origin,a=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&a||(void 0).DEV},ze=()=>Le(),Ue=Le,Oe=()=>Ae().qualiexApiUrl,Ve={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},Be={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},qe={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},$e=`https://${Ae().storageProjectId}.supabase.co/storage/v1/object/public/library-assets`,We={logo:Be.isQualiex?`${$e}/logo-qualiex-white.svg`:`${$e}/saber-gestao-white.png`,smallLogo:Be.isQualiex?`${$e}/logo-forlogic-white.svg`:`${$e}/small.svg`,favicon:`${$e}/favicon.png`},He=We.logo,Ge=We.smallLogo;if("undefined"!=typeof document){document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=We.favicon,document.head.appendChild(e)}const Ke={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Ye(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const Qe={date:Ye({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Ye({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Ye({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Xe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Je(e){return(a,t)=>{let s;if("formatting"===(t?.context?String(t.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,r=t?.width?String(t.width):a;s=e.formattingValues[r]||e.formattingValues[a]}else{const a=e.defaultWidth,r=t?.width?String(t.width):e.defaultWidth;s=e.values[r]||e.values[a]}return s[e.argumentCallback?e.argumentCallback(a):a]}}function Ze(e){return(a,t={})=>{const s=t.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],n=a.match(r);if(!n)return null;const o=n[0],i=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t;return}(i,e=>e.test(o)):function(e,a){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&a(e[t]))return t;return}(i,e=>e.test(o));let d;d=e.valueCallback?e.valueCallback(l):l,d=t.valueCallback?t.valueCallback(d):d;return{value:d,rest:a.slice(o.length)}}}function ea(e){return(a,t={})=>{const s=a.match(e.matchPattern);if(!s)return null;const r=s[0],n=a.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=t.valueCallback?t.valueCallback(o):o;return{value:o,rest:a.slice(r.length)}}}const aa={code:"en-US",formatDistance:(e,a,t)=>{let s;const r=Ke[e];return s="string"==typeof r?r:1===a?r.one:r.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+s:s+" ago":s},formatLong:Qe,formatRelative:(e,a,t,s)=>Xe[e],localize:{ordinalNumber:(e,a)=>{const t=Number(e),s=t%100;if(s>20||s<10)switch(s%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Je({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Je({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Je({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Je({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Je({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ea({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Ze({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Ze({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ze({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ze({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ze({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};let ta={};function sa(){return ta}const ra=6048e5;function na(e){const a=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===a?new e.constructor(+e):"number"==typeof e||"[object Number]"===a||"string"==typeof e||"[object String]"===a?new Date(e):new Date(NaN)}function oa(e){const a=na(e);return a.setHours(0,0,0,0),a}function ia(e){const a=na(e),t=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return t.setUTCFullYear(a.getFullYear()),+e-+t}function la(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function da(e){const a=na(e),t=function(e,a){const t=oa(e),s=oa(a),r=+t-ia(t),n=+s-ia(s);return Math.round((r-n)/864e5)}(a,function(e){const a=na(e),t=la(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function ca(e,a){const t=sa(),s=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=na(e),n=r.getDay(),o=(n<s?7:0)+n-s;return r.setDate(r.getDate()-o),r.setHours(0,0,0,0),r}function ua(e){return ca(e,{weekStartsOn:1})}function ma(e){const a=na(e),t=a.getFullYear(),s=la(e,0);s.setFullYear(t+1,0,4),s.setHours(0,0,0,0);const r=ua(s),n=la(e,0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);const o=ua(n);return a.getTime()>=r.getTime()?t+1:a.getTime()>=o.getTime()?t:t-1}function pa(e){const a=na(e),t=+ua(a)-+function(e){const a=ma(e),t=la(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),ua(t)}(a);return Math.round(t/ra)+1}function ha(e,a){const t=na(e),s=t.getFullYear(),r=sa(),n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=la(e,0);o.setFullYear(s+1,0,n),o.setHours(0,0,0,0);const i=ca(o,a),l=la(e,0);l.setFullYear(s,0,n),l.setHours(0,0,0,0);const d=ca(l,a);return t.getTime()>=i.getTime()?s+1:t.getTime()>=d.getTime()?s:s-1}function xa(e,a){const t=na(e),s=+ca(t,a)-+function(e,a){const t=sa(),s=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=ha(e,a),n=la(e,0);return n.setFullYear(r,0,s),n.setHours(0,0,0,0),ca(n,a)}(t,a);return Math.round(s/ra)+1}function fa(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const ga={y(e,a){const t=e.getFullYear(),s=t>0?t:1-t;return fa("yy"===a?s%100:s,a.length)},M(e,a){const t=e.getMonth();return"M"===a?String(t+1):fa(t+1,2)},d:(e,a)=>fa(e.getDate(),a.length),a(e,a){const t=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return"am"===t?"a.m.":"p.m."}},h:(e,a)=>fa(e.getHours()%12||12,a.length),H:(e,a)=>fa(e.getHours(),a.length),m:(e,a)=>fa(e.getMinutes(),a.length),s:(e,a)=>fa(e.getSeconds(),a.length),S(e,a){const t=a.length,s=e.getMilliseconds();return fa(Math.trunc(s*Math.pow(10,t-3)),a.length)}},va="midnight",ba="noon",ya="morning",ja="afternoon",wa="evening",Na="night",_a={G:function(e,a,t){const s=e.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return t.era(s,{width:"abbreviated"});case"GGGGG":return t.era(s,{width:"narrow"});default:return t.era(s,{width:"wide"})}},y:function(e,a,t){if("yo"===a){const a=e.getFullYear(),s=a>0?a:1-a;return t.ordinalNumber(s,{unit:"year"})}return ga.y(e,a)},Y:function(e,a,t,s){const r=ha(e,s),n=r>0?r:1-r;if("YY"===a){return fa(n%100,2)}return"Yo"===a?t.ordinalNumber(n,{unit:"year"}):fa(n,a.length)},R:function(e,a){return fa(ma(e),a.length)},u:function(e,a){return fa(e.getFullYear(),a.length)},Q:function(e,a,t){const s=Math.ceil((e.getMonth()+1)/3);switch(a){case"Q":return String(s);case"QQ":return fa(s,2);case"Qo":return t.ordinalNumber(s,{unit:"quarter"});case"QQQ":return t.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(s,{width:"narrow",context:"formatting"});default:return t.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,a,t){const s=Math.ceil((e.getMonth()+1)/3);switch(a){case"q":return String(s);case"qq":return fa(s,2);case"qo":return t.ordinalNumber(s,{unit:"quarter"});case"qqq":return t.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(s,{width:"narrow",context:"standalone"});default:return t.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,a,t){const s=e.getMonth();switch(a){case"M":case"MM":return ga.M(e,a);case"Mo":return t.ordinalNumber(s+1,{unit:"month"});case"MMM":return t.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(s,{width:"narrow",context:"formatting"});default:return t.month(s,{width:"wide",context:"formatting"})}},L:function(e,a,t){const s=e.getMonth();switch(a){case"L":return String(s+1);case"LL":return fa(s+1,2);case"Lo":return t.ordinalNumber(s+1,{unit:"month"});case"LLL":return t.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(s,{width:"narrow",context:"standalone"});default:return t.month(s,{width:"wide",context:"standalone"})}},w:function(e,a,t,s){const r=xa(e,s);return"wo"===a?t.ordinalNumber(r,{unit:"week"}):fa(r,a.length)},I:function(e,a,t){const s=pa(e);return"Io"===a?t.ordinalNumber(s,{unit:"week"}):fa(s,a.length)},d:function(e,a,t){return"do"===a?t.ordinalNumber(e.getDate(),{unit:"date"}):ga.d(e,a)},D:function(e,a,t){const s=da(e);return"Do"===a?t.ordinalNumber(s,{unit:"dayOfYear"}):fa(s,a.length)},E:function(e,a,t){const s=e.getDay();switch(a){case"E":case"EE":case"EEE":return t.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},e:function(e,a,t,s){const r=e.getDay(),n=(r-s.weekStartsOn+8)%7||7;switch(a){case"e":return String(n);case"ee":return fa(n,2);case"eo":return t.ordinalNumber(n,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(e,a,t,s){const r=e.getDay(),n=(r-s.weekStartsOn+8)%7||7;switch(a){case"c":return String(n);case"cc":return fa(n,a.length);case"co":return t.ordinalNumber(n,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(e,a,t){const s=e.getDay(),r=0===s?7:s;switch(a){case"i":return String(r);case"ii":return fa(r,a.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},a:function(e,a,t){const s=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,a,t){const s=e.getHours();let r;switch(r=12===s?ba:0===s?va:s/12>=1?"pm":"am",a){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,a,t){const s=e.getHours();let r;switch(r=s>=17?wa:s>=12?ja:s>=4?ya:Na,a){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,a,t){if("ho"===a){let a=e.getHours()%12;return 0===a&&(a=12),t.ordinalNumber(a,{unit:"hour"})}return ga.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):ga.H(e,a)},K:function(e,a,t){const s=e.getHours()%12;return"Ko"===a?t.ordinalNumber(s,{unit:"hour"}):fa(s,a.length)},k:function(e,a,t){let s=e.getHours();return 0===s&&(s=24),"ko"===a?t.ordinalNumber(s,{unit:"hour"}):fa(s,a.length)},m:function(e,a,t){return"mo"===a?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):ga.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):ga.s(e,a)},S:function(e,a){return ga.S(e,a)},X:function(e,a,t){const s=e.getTimezoneOffset();if(0===s)return"Z";switch(a){case"X":return ka(s);case"XXXX":case"XX":return Sa(s);default:return Sa(s,":")}},x:function(e,a,t){const s=e.getTimezoneOffset();switch(a){case"x":return ka(s);case"xxxx":case"xx":return Sa(s);default:return Sa(s,":")}},O:function(e,a,t){const s=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+Ca(s,":");default:return"GMT"+Sa(s,":")}},z:function(e,a,t){const s=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+Ca(s,":");default:return"GMT"+Sa(s,":")}},t:function(e,a,t){return fa(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,t){return fa(e.getTime(),a.length)}};function Ca(e,a=""){const t=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),n=s%60;return 0===n?t+String(r):t+String(r)+a+fa(n,2)}function ka(e,a){if(e%60==0){return(e>0?"-":"+")+fa(Math.abs(e)/60,2)}return Sa(e,a)}function Sa(e,a=""){const t=e>0?"-":"+",s=Math.abs(e);return t+fa(Math.trunc(s/60),2)+a+fa(s%60,2)}const Ta=(e,a)=>{switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},Pa=(e,a)=>{switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},Da={p:Pa,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],s=t[1],r=t[2];if(!r)return Ta(e,a);let n;switch(s){case"P":n=a.dateTime({width:"short"});break;case"PP":n=a.dateTime({width:"medium"});break;case"PPP":n=a.dateTime({width:"long"});break;default:n=a.dateTime({width:"full"})}return n.replace("{{date}}",Ta(s,a)).replace("{{time}}",Pa(r,a))}},Ea=/^D+$/,Aa=/^Y+$/,Ia=["D","DD","YY","YYYY"];function Ma(e){if(!(a=e,a instanceof Date||"object"==typeof a&&"[object Date]"===Object.prototype.toString.call(a)||"number"==typeof e))return!1;var a;const t=na(e);return!isNaN(Number(t))}const Fa=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ra=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,La=/^'([^]*?)'?$/,za=/''/g,Ua=/[a-zA-Z]/;function Oa(e,a,t){const s=sa(),r=t?.locale??s.locale??aa,n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=na(e);if(!Ma(i))throw new RangeError("Invalid time value");let l=a.match(Ra).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,Da[a])(e,r.formatLong)}return e}).join("").match(Fa).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:Va(e)};if(_a[a])return{isToken:!0,value:e};if(a.match(Ua))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}});r.localize.preprocessor&&(l=r.localize.preprocessor(i,l));const d={firstWeekContainsDate:n,weekStartsOn:o,locale:r};return l.map(s=>{if(!s.isToken)return s.value;const n=s.value;(!t?.useAdditionalWeekYearTokens&&function(e){return Aa.test(e)}(n)||!t?.useAdditionalDayOfYearTokens&&function(e){return Ea.test(e)}(n))&&function(e,a,t){const s=function(e,a,t){const s="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${a}\`) for formatting ${s} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,a,t);if(Ia.includes(e))throw new RangeError(s)}(n,a,String(e));return(0,_a[n[0]])(i,n,r.localize,d)}).join("")}function Va(e){const a=e.match(La);return a?a[1].replace(za,"'"):e}function Ba(e,a,t){const s=i.getDefaultOptions(),r=function(e,a,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:a,timeZoneName:e})}(e,t.timeZone,t.locale??s.locale);return"formatToParts"in r?function(e,a){const t=e.formatToParts(a);for(let s=t.length-1;s>=0;--s)if("timeZoneName"===t[s].type)return t[s].value;return}(r,a):function(e,a){const t=e.format(a).replace(/\u200E/g,""),s=/ [\w-+ ]+$/.exec(t);return s?s[0].substr(1):""}(r,a)}function qa(e,a){const t=function(e){Wa[e]||(Wa[e]=Ga?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return Wa[e]}(a);return"formatToParts"in t?function(e,a){try{const t=e.formatToParts(a),s=[];for(let e=0;e<t.length;e++){const a=$a[t[e].type];void 0!==a&&(s[a]=parseInt(t[e].value,10))}return s}catch(t){if(t instanceof RangeError)return[NaN];throw t}}(t,e):function(e,a){const t=e.format(a),s=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(s[3],10),parseInt(s[1],10),parseInt(s[2],10),parseInt(s[4],10),parseInt(s[5],10),parseInt(s[6],10)]}(t,e)}const $a={year:0,month:1,day:2,hour:3,minute:4,second:5};const Wa={},Ha=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),Ga="06/25/2014, 00:00:00"===Ha||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===Ha;function Ka(e,a,t,s,r,n,o){const i=new Date(0);return i.setUTCFullYear(e,a,t),i.setUTCHours(s,r,n,o),i}const Ya=36e5,Qa={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Xa(e,a,t){if(!e)return 0;let s,r,n=Qa.timezoneZ.exec(e);if(n)return 0;if(n=Qa.timezoneHH.exec(e),n)return s=parseInt(n[1],10),Za(s)?-s*Ya:NaN;if(n=Qa.timezoneHHMM.exec(e),n){s=parseInt(n[2],10);const e=parseInt(n[3],10);return Za(s,e)?(r=Math.abs(s)*Ya+6e4*e,"+"===n[1]?-r:r):NaN}if(function(e){if(et[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),et[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const s=t?a:function(e){return Ka(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),r=Ja(s,e),n=t?r:function(e,a,t){const s=e.getTime();let r=s-a;const n=Ja(new Date(r),t);if(a===n)return a;r-=n-a;const o=Ja(new Date(r),t);if(n===o)return n;return Math.max(n,o)}(a,r,e);return-n}return NaN}function Ja(e,a){const t=qa(e,a),s=Ka(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let r=e.getTime();const n=r%1e3;return r-=n>=0?n:1e3+n,s-r}function Za(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const et={};const at={X:function(e,a,t){const s=tt(t.timeZone,e);if(0===s)return"Z";switch(a){case"X":return nt(s);case"XXXX":case"XX":return rt(s);default:return rt(s,":")}},x:function(e,a,t){const s=tt(t.timeZone,e);switch(a){case"x":return nt(s);case"xxxx":case"xx":return rt(s);default:return rt(s,":")}},O:function(e,a,t){const s=tt(t.timeZone,e);switch(a){case"O":case"OO":case"OOO":return"GMT"+function(e,a=""){const t=e>0?"-":"+",s=Math.abs(e),r=Math.floor(s/60),n=s%60;if(0===n)return t+String(r);return t+String(r)+a+st(n,2)}(s,":");default:return"GMT"+rt(s,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return Ba("short",e,t);default:return Ba("long",e,t)}}};function tt(e,a){const t=e?Xa(e,a,!0)/6e4:a?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function st(e,a){const t=e<0?"-":"";let s=Math.abs(e).toString();for(;s.length<a;)s="0"+s;return t+s}function rt(e,a=""){const t=e>0?"-":"+",s=Math.abs(e);return t+st(Math.floor(s/60),2)+a+st(Math.floor(s%60),2)}function nt(e,a){if(e%60==0){return(e>0?"-":"+")+st(Math.abs(e)/60,2)}return rt(e,a)}function ot(e){const a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),+e-+a}const it=36e5,lt=6e4,dt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function ct(e,a={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const t=null==a.additionalDigits?2:Number(a.additionalDigits);if(2!==t&&1!==t&&0!==t)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const s=function(e){const a={};let t,s=dt.dateTimePattern.exec(e);s?(a.date=s[1],t=s[3]):(s=dt.datePattern.exec(e),s?(a.date=s[1],t=s[2]):(a.date=null,t=e));if(t){const e=dt.timeZone.exec(t);e?(a.time=t.replace(e[1],""),a.timeZone=e[1].trim()):a.time=t}return a}(e),{year:r,restDateString:n}=function(e,a){if(e){const t=dt.YYY[a],s=dt.YYYYY[a];let r=dt.YYYY.exec(e)||s.exec(e);if(r){const a=r[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(r=dt.YY.exec(e)||t.exec(e),r){const a=r[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}}return{year:null}}(s.date,t),o=function(e,a){if(null===a)return null;let t,s,r;if(!e||!e.length)return t=new Date(0),t.setUTCFullYear(a),t;let n=dt.MM.exec(e);if(n)return t=new Date(0),s=parseInt(n[1],10)-1,xt(a,s)?(t.setUTCFullYear(a,s),t):new Date(NaN);if(n=dt.DDD.exec(e),n){t=new Date(0);const e=parseInt(n[1],10);return function(e,a){if(a<1)return!1;const t=ht(e);if(t&&a>366)return!1;if(!t&&a>365)return!1;return!0}(a,e)?(t.setUTCFullYear(a,0,e),t):new Date(NaN)}if(n=dt.MMDD.exec(e),n){t=new Date(0),s=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return xt(a,s,e)?(t.setUTCFullYear(a,s,e),t):new Date(NaN)}if(n=dt.Www.exec(e),n)return r=parseInt(n[1],10)-1,ft(r)?ut(a,r):new Date(NaN);if(n=dt.WwwD.exec(e),n){r=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return ft(r,e)?ut(a,r,e):new Date(NaN)}return null}(n,r);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let t,r=0;if(s.time&&(r=function(e){let a,t,s=dt.HH.exec(e);if(s)return a=parseFloat(s[1].replace(",",".")),gt(a)?a%24*it:NaN;if(s=dt.HHMM.exec(e),s)return a=parseInt(s[1],10),t=parseFloat(s[2].replace(",",".")),gt(a,t)?a%24*it+t*lt:NaN;if(s=dt.HHMMSS.exec(e),s){a=parseInt(s[1],10),t=parseInt(s[2],10);const e=parseFloat(s[3].replace(",","."));return gt(a,t,e)?a%24*it+t*lt+1e3*e:NaN}return null}(s.time),null===r||isNaN(r)))return new Date(NaN);if(s.timeZone||a.timeZone){if(t=Xa(s.timeZone||a.timeZone,new Date(e+r)),isNaN(t))return new Date(NaN)}else t=ot(new Date(e+r)),t=ot(new Date(e+r+t));return new Date(e+r+t)}return new Date(NaN)}function ut(e,a,t){a=a||0,t=t||0;const s=new Date(0);s.setUTCFullYear(e,0,4);const r=7*a+t+1-(s.getUTCDay()||7);return s.setUTCDate(s.getUTCDate()+r),s}const mt=[31,28,31,30,31,30,31,31,30,31,30,31],pt=[31,29,31,30,31,30,31,31,30,31,30,31];function ht(e){return e%400==0||e%4==0&&e%100!=0}function xt(e,a,t){if(a<0||a>11)return!1;if(null!=t){if(t<1)return!1;const s=ht(e);if(s&&t>pt[a])return!1;if(!s&&t>mt[a])return!1}return!0}function ft(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function gt(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const vt=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function bt(e,a,t,s){return function(e,a,t={}){const s=(a=String(a)).match(vt);if(s){const r=ct(t.originalDate||e,t);a=s.reduce(function(e,a){if("'"===a[0])return e;const s=e.indexOf(a),n="'"===e[s-1],o=e.replace(a,"'"+at[a[0]](r,a,t)+"'");return n?o.substring(0,s-1)+o.substring(s+1):o},a)}return Oa(e,a,t)}(function(e,a,t){const s=Xa(a,e=ct(e,t),!0),r=new Date(e.getTime()-s),n=new Date(0);return n.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),n.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),n}(e,a,{timeZone:(s={...s,timeZone:a,originalDate:e}).timeZone}),t,s)}const yt={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},jt={date:Ye({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:Ye({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Ye({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},wt={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Nt={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},_t={code:"es",formatDistance:(e,a,t)=>{let s;const r=yt[e];return s="string"==typeof r?r:1===a?r.one:r.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"en "+s:"hace "+s:s},formatLong:jt,formatRelative:(e,a,t,s)=>1!==a.getHours()?Nt[e]:wt[e],localize:{ordinalNumber:(e,a)=>Number(e)+"º",era:Je({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:Je({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:Je({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:Je({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:Je({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ea({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Ze({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:Ze({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ze({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:Ze({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ze({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:1}},Ct={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},kt={date:Ye({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:Ye({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Ye({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},St={lastWeek:e=>{const a=e.getDay();return"'"+(0===a||6===a?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Tt={code:"pt-BR",formatDistance:(e,a,t)=>{let s;const r=Ct[e];return s="string"==typeof r?r:1===a?r.one:r.other.replace("{{count}}",String(a)),t?.addSuffix?t.comparison&&t.comparison>0?"em "+s:"há "+s:s},formatLong:kt,formatRelative:(e,a,t,s)=>{const r=St[e];return"function"==typeof r?r(a):r},localize:{ordinalNumber:(e,a)=>{const t=Number(e);return"week"===a?.unit?t+"ª":t+"º"},era:Je({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:Je({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Je({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:Je({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:Je({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ea({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Ze({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:Ze({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ze({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:Ze({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:Ze({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Pt=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],Dt=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],Et=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],At="pt-BR",It="dd/MM/yyyy HH:mm",Mt="America/Sao_Paulo",Ft=e=>Pt.some(a=>a.value===e),Rt=e=>Et.some(a=>a.value===e),Lt=()=>{if("undefined"==typeof navigator)return At;const e=navigator.language;if(Ft(e))return e;const a=e.split("-")[0],t=Pt.find(e=>e.value.startsWith(a));return t?.value||At},zt=()=>{if("undefined"==typeof Intl)return Mt;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return Rt(e)?e:Mt}catch{return Mt}},Ut=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||It),Ot={"pt-BR":Tt,"en-US":aa,"es-ES":_t},Vt=(e,a=It,t=Mt,s=At)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const n=Ot[s]||Tt;try{return bt(r,t,a,{locale:n})}catch(o){return bt(r,Mt,a,{locale:n})}},Bt=(e,a=At,t=Mt)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const r=Ot[a]||Tt;try{return bt(s,t,"PP",{locale:r})}catch(n){return bt(s,Mt,"PP",{locale:r})}};function qt(e){const a=e.replace("#",""),t=3===a.length?a.split("").map(e=>e+e).join(""):a;return{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16)}}function $t(e,a=.1){const{r:t,g:s,b:r}=qt(e);return`rgba(${t}, ${s}, ${r}, ${a})`}function Wt(e){const{r:a,g:t,b:s}=qt(e),[r,n,o]=[a,t,s].map(e=>{const a=e/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return.2126*r+.7152*n+.0722*o}function Ht(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function Gt(e,a){return a?e.replace(/\{alias\}/g,a):e}function Kt(...e){return o.twMerge(n.clsx(e))}const Yt=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Yt);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,s]of Object.entries(e))a[t]=Yt(s);return a}return e},Qt=r.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),Xt=ae.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>{const l=n?s.Slot:"button";return a.jsx(l,{className:Kt(Qt({variant:t,size:r,className:e})),ref:i,...o})});Xt.displayName="Button";const Jt=t.forwardRef(({className:e,children:t,variant:s="action",...r},n)=>a.jsx(Xt,{ref:n,variant:s,size:"icon",className:Kt("h-8 w-8",e),...r,children:t||a.jsx(d.EllipsisVertical,{size:16})}));Jt.displayName="ActionButton";const Zt=ae.forwardRef(({className:e,type:t,showCharCount:s,maxLength:r,onChange:n,...o},i)=>{const[l,d]=ae.useState(0);ae.useEffect(()=>{"string"==typeof o.value?d(o.value.length):"string"==typeof o.defaultValue&&d(o.defaultValue.length)},[o.value,o.defaultValue]);return a.jsxs("div",{className:"w-full",children:[a.jsx("input",{type:t,className:Kt("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:r,onChange:e=>{d(e.target.value.length),n?.(e)},...o}),s&&r&&a.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",r]})]})});Zt.displayName="Input";const es=r.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),as=ae.forwardRef(({className:e,...t},s)=>a.jsx(se.Root,{ref:s,className:Kt(es(),e),...t}));as.displayName=se.Root.displayName;const ts=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ts.displayName="Card";const ss=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("flex flex-col space-y-1.5 p-6",e),...t}));ss.displayName="CardHeader";const rs=ae.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Kt("text-2xl font-semibold leading-none tracking-tight",e),...t}));rs.displayName="CardTitle";const ns=ae.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));ns.displayName="CardDescription";const os=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("p-6 pt-0",e),...t}));os.displayName="CardContent";const is=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("flex items-center p-6 pt-0",e),...t}));is.displayName="CardFooter";const ls=ae.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...r},n)=>a.jsx(ne.Root,{ref:n,decorative:s,orientation:t,className:Kt("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ls.displayName=ne.Root.displayName;const ds=oe.Root,cs=oe.Trigger,us=oe.Portal,ms=ae.forwardRef(({className:e,...t},s)=>a.jsx(oe.Overlay,{className:Kt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));ms.displayName=oe.Overlay.displayName;const ps=ae.forwardRef(({className:e,...t},s)=>a.jsxs(us,{children:[a.jsx(ms,{}),a.jsx(oe.Content,{ref:s,className:Kt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));ps.displayName=oe.Content.displayName;const hs=({className:e,...t})=>a.jsx("div",{className:Kt("flex flex-col space-y-2 text-center sm:text-left",e),...t});hs.displayName="AlertDialogHeader";const xs=({className:e,...t})=>a.jsx("div",{className:Kt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});xs.displayName="AlertDialogFooter";const fs=ae.forwardRef(({className:e,...t},s)=>a.jsx(oe.Title,{ref:s,className:Kt("text-lg font-semibold",e),...t}));fs.displayName=oe.Title.displayName;const gs=ae.forwardRef(({className:e,...t},s)=>a.jsx(oe.Description,{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));gs.displayName=oe.Description.displayName;const vs=ae.forwardRef(({className:e,...t},s)=>a.jsx(oe.Action,{ref:s,className:Kt(Qt(),e),...t}));vs.displayName=oe.Action.displayName;const bs=ae.forwardRef(({className:e,...t},s)=>a.jsx(oe.Cancel,{ref:s,className:Kt(Qt({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));bs.displayName=oe.Cancel.displayName;const ys=re.Root,js=re.Trigger,ws=re.Portal,Ns=re.Close,_s=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Overlay,{ref:s,className:Kt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_s.displayName=re.Overlay.displayName;const Cs={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},ks=ae.forwardRef(({className:t,children:s,size:r,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:c,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:v,onInteractOutside:b,onEscapeKeyDown:y,...j},w)=>{const[N,_]=ae.useState(!1),C=ae.useRef(null),k=ae.useRef(!1),S=r??(i||l||c||u||m||p?void 0:"md"),T=S?Cs[S]:{},P={...i??T.width?{width:i??T.width}:{},...l??T.minWidth?{minWidth:l??T.minWidth}:{},...c??T.maxWidth?{maxWidth:c??T.maxWidth}:{},...u??T.height?{height:u??T.height}:{},...m??T.minHeight?{minHeight:m??T.minHeight}:{},...p??T.maxHeight?{maxHeight:p??T.maxHeight}:{},...v},D=ae.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),E=ae.useRef(null),A="destructive"!==n;if("development"===process.env.NODE_ENV&&s){const e=ae.Children.toArray(s);e.some(e=>ae.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>ae.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return a.jsxs(ws,{children:[a.jsx(_s,{}),a.jsxs(re.Content,{ref:w,className:Kt("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",t),style:P,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?b?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void D(()=>{k.current=!0,E.current?.click()})):void y?.(e);e.preventDefault()},...j,children:[s,A&&a.jsxs(re.Close,{ref:E,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),D(()=>{k.current=!0,E.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]}),a.jsx(ds,{open:N,onOpenChange:_,children:a.jsxs(ps,{children:[a.jsxs(hs,{children:[a.jsx(fs,{children:h}),a.jsx(gs,{children:x})]}),a.jsxs(xs,{children:[a.jsx(bs,{onClick:()=>{_(!1),C.current=null},children:f}),a.jsx(vs,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});ks.displayName=re.Content.displayName;const Ss=({className:e,showSeparator:t=!1,children:s,...r})=>a.jsxs("div",{className:Kt("flex flex-col flex-shrink-0",e),...r,children:[a.jsx("div",{className:"flex flex-col text-left",children:s}),t&&a.jsx(ls,{className:"mt-2"})]});Ss.displayName="DialogHeader";const Ts=({className:e,...t})=>a.jsx("div",{className:Kt("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});Ts.displayName="DialogBody";const Ps=({className:e,children:t,...s})=>a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(ls,{className:"mb-4"}),a.jsx("div",{className:Kt("flex flex-row justify-end gap-2",e),...s,children:t})]});Ps.displayName="DialogFooter";const Ds=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Title,{ref:s,className:Kt("text-xl font-semibold leading-none tracking-tight",e),...t}));Ds.displayName=re.Title.displayName;const Es=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Description,{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));Es.displayName=re.Description.displayName;const As=h.FormProvider,Is=ae.createContext({}),Ms=()=>{const e=ae.useContext(Is),a=ae.useContext(Fs),{getFieldState:t,formState:s}=h.useFormContext(),r=t(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=a;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...r}},Fs=ae.createContext({}),Rs=ae.forwardRef(({className:e,...t},s)=>{const r=ae.useId();return a.jsx(Fs.Provider,{value:{id:r},children:a.jsx("div",{ref:s,className:Kt("space-y-1.5",e),...t})})});Rs.displayName="FormItem";const Ls=ae.forwardRef(({className:e,...t},s)=>{const{error:r,formItemId:n}=Ms();return a.jsx(as,{ref:s,className:Kt(r&&"text-destructive",e),htmlFor:n,...t})});Ls.displayName="FormLabel";const zs=ae.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:i}=Ms();return a.jsx(s.Slot,{ref:t,id:n,"aria-describedby":r?`${o} ${i}`:`${o}`,"aria-invalid":!!r,...e})});zs.displayName="FormControl";const Us=ae.forwardRef(({className:e,...t},s)=>{const{formDescriptionId:r}=Ms();return a.jsx("p",{ref:s,id:r,className:Kt("text-sm text-muted-foreground",e),...t})});Us.displayName="FormDescription";const Os=ae.forwardRef(({className:e,children:t,...s},r)=>{const{error:n,formMessageId:o}=Ms(),i=n?String(n?.message):t;return i?a.jsx("p",{ref:r,id:o,className:Kt("text-sm font-medium text-destructive",e),...s,children:i}):null});Os.displayName="FormMessage";const Vs=ae.createContext({showCheck:!1}),Bs=({showCheck:e=!1,...t})=>a.jsx(Vs.Provider,{value:{showCheck:e},children:a.jsx(ie.Root,{...t})}),qs=ie.Group,$s=ie.Value,Ws=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(ie.Trigger,{ref:r,className:Kt("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...s,children:[t,a.jsx(ie.Icon,{asChild:!0,children:a.jsx(d.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ws.displayName=ie.Trigger.displayName;const Hs=ae.forwardRef(({className:e,...t},s)=>a.jsx(ie.ScrollUpButton,{ref:s,className:Kt("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(d.ChevronUp,{className:"h-4 w-4"})}));Hs.displayName=ie.ScrollUpButton.displayName;const Gs=ae.forwardRef(({className:e,...t},s)=>a.jsx(ie.ScrollDownButton,{ref:s,className:Kt("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(d.ChevronDown,{className:"h-4 w-4"})}));Gs.displayName=ie.ScrollDownButton.displayName;const Ks=ae.forwardRef(({className:e,children:t,position:s="popper",container:r,collisionBoundary:n,...o},i)=>a.jsx(ie.Portal,{container:r,children:a.jsxs(ie.Content,{ref:i,className:Kt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,collisionBoundary:n,...o,children:[a.jsx(Hs,{}),a.jsx(ie.Viewport,{className:Kt("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(Gs,{})]})}));Ks.displayName=ie.Content.displayName;const Ys=ae.forwardRef(({className:e,...t},s)=>a.jsx(ie.Label,{ref:s,className:Kt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Ys.displayName=ie.Label.displayName;const Qs=ae.forwardRef(({className:e,children:t,...s},r)=>{const{showCheck:n}=ae.useContext(Vs);return a.jsxs(ie.Item,{ref:r,className:Kt("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...s,children:[n&&a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ie.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),a.jsx(ie.ItemText,{children:t})]})});Qs.displayName=ie.Item.displayName;const Xs=ae.forwardRef(({className:e,...t},s)=>a.jsx(ie.Separator,{ref:s,className:Kt("-mx-1 my-1 h-px bg-muted",e),...t}));Xs.displayName=ie.Separator.displayName;const Js=ae.forwardRef(({className:e,...t},s)=>a.jsx(le.Root,{ref:s,className:Kt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(le.Indicator,{className:Kt("flex items-center justify-center text-current"),children:a.jsx(d.Check,{className:"h-4 w-4"})})}));Js.displayName=le.Root.displayName;const Zs=ae.forwardRef(({className:e,showCharCount:t,maxLength:s,onChange:r,...n},o)=>{const[i,l]=ae.useState(0);ae.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return a.jsxs("div",{className:"w-full",children:[a.jsx("textarea",{className:Kt("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:s,onChange:e=>{l(e.target.value.length),r?.(e)},...n}),t&&s&&a.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",s]})]})});Zs.displayName="Textarea";const er=r.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),ar=ae.forwardRef(({className:e,variant:t,...s},r)=>a.jsx("div",{ref:r,className:Kt(er({variant:t}),e),...s}));ar.displayName="Badge";const tr={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function sr({size:e="md",className:t}){return a.jsx(d.Loader2,{className:Kt("animate-spin text-muted-foreground",tr[e],t)})}function rr({isLoading:e,children:t,className:s,type:r="spinner",size:n="md"}){return e?"overlay"===r?a.jsxs("div",{className:Kt("relative",s),children:[t,a.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:a.jsx(sr,{size:n})})]}):"skeleton"===r?a.jsx("div",{className:Kt("animate-pulse",s),children:a.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):a.jsx("div",{className:Kt("flex items-center justify-center py-8",s),children:a.jsx(sr,{size:n})}):a.jsx(a.Fragment,{children:t})}const nr=({...e})=>a.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a.jsx(d.CircleCheckIcon,{className:"h-4 w-4"}),info:a.jsx(d.InfoIcon,{className:"h-4 w-4"}),warning:a.jsx(d.TriangleAlertIcon,{className:"h-4 w-4"}),error:a.jsx(d.OctagonXIcon,{className:"h-4 w-4"}),loading:a.jsx(d.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),or=de.Root,ir=de.Trigger,lr=de.Group,dr=de.Portal,cr=de.Sub,ur=de.RadioGroup,mr=ae.forwardRef(({className:e,inset:t,children:s,...r},n)=>a.jsxs(de.SubTrigger,{ref:n,className:Kt("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[s,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));mr.displayName=de.SubTrigger.displayName;const pr=ae.forwardRef(({className:e,...t},s)=>a.jsx(de.SubContent,{ref:s,className:Kt("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));pr.displayName=de.SubContent.displayName;const hr=ae.forwardRef(({className:e,sideOffset:t=4,...s},r)=>a.jsx(de.Portal,{children:a.jsx(de.Content,{ref:r,sideOffset:t,className:Kt("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));hr.displayName=de.Content.displayName;const xr=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(de.Item,{ref:r,className:Kt("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));xr.displayName=de.Item.displayName;const fr=ae.forwardRef(({className:e,children:t,checked:s,...r},n)=>a.jsxs(de.CheckboxItem,{ref:n,className:Kt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(de.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));fr.displayName=de.CheckboxItem.displayName;const gr=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(de.RadioItem,{ref:r,className:Kt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(de.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));gr.displayName=de.RadioItem.displayName;const vr=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(de.Label,{ref:r,className:Kt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));vr.displayName=de.Label.displayName;const br=ae.forwardRef(({className:e,...t},s)=>a.jsx(de.Separator,{ref:s,className:Kt("-mx-1 my-1 h-px bg-muted",e),...t}));br.displayName=de.Separator.displayName;const yr=({className:e,...t})=>a.jsx("span",{className:Kt("ml-auto text-xs tracking-widest opacity-60",e),...t});yr.displayName="DropdownMenuShortcut";const jr=({delayDuration:e=300,...t})=>a.jsx(ce.Provider,{delayDuration:e,...t}),wr=ce.Root,Nr=ce.Trigger,_r=ae.forwardRef(({className:e,sideOffset:t=4,container:s,...r},n)=>a.jsx(ce.Portal,{container:s,children:a.jsx(ce.Content,{ref:n,sideOffset:t,className:Kt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));_r.displayName=ce.Content.displayName;const Cr=ae.forwardRef(({children:e,disabledReason:t,className:s},r)=>{const n=a.jsx(xr,{ref:r,className:Kt("opacity-50 cursor-not-allowed pointer-events-auto",s),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return t?a.jsx(jr,{delayDuration:100,children:a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("div",{className:"w-full",children:n})}),a.jsx(_r,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:t})]})}):n});Cr.displayName="DisabledMenuItem";const kr=ue.Root,Sr=ue.Trigger,Tr=ae.forwardRef(({className:e,align:t="center",sideOffset:s=4,container:r,...n},o)=>a.jsx(ue.Portal,{container:r,children:a.jsx(ue.Content,{ref:o,align:t,sideOffset:s,className:Kt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Tr.displayName=ue.Content.displayName;const Pr=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Pr.displayName="Command";const Dr=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:a.jsx("input",{ref:s,className:Kt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})}));Dr.displayName="CommandInput";const Er=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Er.displayName="CommandList";const Ar=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("py-6 text-center text-sm text-muted-foreground",e),...t}));Ar.displayName="CommandEmpty";const Ir=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ir.displayName="CommandGroup";const Mr=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("-mx-1 h-px bg-border",e),...t}));Mr.displayName="CommandSeparator";const Fr=ae.forwardRef(({className:e,disabled:t,onSelect:s,value:r,...n},o)=>a.jsx("div",{ref:o,className:Kt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":t,onClick:()=>!t&&s?.(r||""),...n}));Fr.displayName="CommandItem";const Rr=({className:e,...t})=>a.jsx("span",{className:Kt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function Lr({className:e,...t}){return a.jsx("div",{className:Kt("animate-pulse rounded-md bg-muted",e),...t})}Rr.displayName="CommandShortcut";const zr=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Ur({multiple:s,options:r,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:x,required:f,className:g,sortOptions:v,maxDisplayedBadges:b,popoverContainer:y,onOpen:j,onClose:w,clearable:N,showCheck:_}){const[C,k]=t.useState(!1),[S,T]=t.useState(""),P=t.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),D=t.useMemo(()=>{if(!y)return;let e=y,a=0;try{for(;e&&a<3;){const t=window.getComputedStyle(e),s=t.overflowY||t.overflow;if(!s||"visible"===s||"unset"===s)break;e=e.parentElement,a++}}catch{}return e??void 0},[y]),E=t.useMemo(()=>{const e=r.map(e=>({original:e,value:i(e),label:l(e)}));return v?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[r,i,l,v]),A=t.useMemo(()=>{if(!S)return E;const e=zr(S);return E.filter(a=>zr(a.label).includes(e))},[E,S]),I=t.useMemo(()=>E.filter(e=>P.includes(e.value)),[E,P]),M=e=>{k(e),e?j?.():(T(""),w?.())},F=(e,a)=>{a.preventDefault(),a.stopPropagation(),o&&o(s?P.filter(a=>a!==e):"")},R=b?I.slice(0,b):I,L=b&&I.length>b?I.length-b:0;return a.jsxs("div",{className:Kt("space-y-2",g),children:[u&&a.jsxs(as,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(kr,{open:C,onOpenChange:M,modal:!1,children:[s?a.jsx(Sr,{asChild:!0,children:a.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":x,tabIndex:x?-1:0,onKeyDown:e=>{x||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M(!C))},className:Kt("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",x&&"pointer-events-none opacity-50 cursor-not-allowed",0===I.length&&"text-muted-foreground"),children:[0===I.length?a.jsxs("span",{className:"flex items-center gap-2",children:[m&&a.jsx(m,{className:"h-4 w-4"}),c]}):a.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[R.map(e=>a.jsxs(ar,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:a=>{"Enter"===a.key&&F(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>F(e.value,a),children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),L>0&&a.jsxs(ar,{variant:"outline",className:"gap-1",children:["+",L]})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):a.jsxs("div",{className:"relative",children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",role:"combobox","aria-expanded":C,disabled:x,className:Kt("relative w-full justify-start min-h-10 h-auto pr-10",N&&I.length>0&&"pr-16",0===I.length&&"text-muted-foreground"),children:[0===I.length?a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[m&&a.jsx(m,{className:"h-4 w-4"}),a.jsx("span",{className:"truncate",children:c})]}):a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[m&&a.jsx(m,{className:"h-4 w-4"}),a.jsx("span",{className:"truncate",children:I[0]?.label})]}),a.jsx(d.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),N&&I.length>0&&a.jsx("button",{type:"button",disabled:x,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>F("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx(Tr,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:D,collisionBoundary:D,children:a.jsxs(Pr,{children:[a.jsxs("div",{className:"relative",children:[a.jsx(Dr,{placeholder:h,value:S,onChange:e=>T(e.target.value)}),S&&a.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx(Er,{children:0===r.length?a.jsx(Ar,{children:p}):0===A.length?a.jsx(Ar,{children:e.t("no_results")}):a.jsx(Ir,{children:A.map(e=>{const t=P.includes(e.value);return a.jsxs(Fr,{value:e.value,onSelect:()=>(e=>{if(o)if(s){const a=P.includes(e)?P.filter(a=>a!==e):[...P,e];o(a)}else o(e),k(!1)})(e.value),className:Kt("cursor-pointer",t&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[_&&a.jsx(d.Check,{className:Kt("mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),e.label]},e.value)})})})]})})]})]})}function Or({multiple:e=!1,options:t,items:s,value:r,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:x=!1,required:f=!1,isLoading:g=!1,error:v,className:b,sortOptions:j=!0,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k=!0,showCheck:S=!1}){const{t:T}=y.useTranslation(),P=t||s||[],D=o||n,E=c||T("select_placeholder","Selecione..."),A=p||T("no_results",T("no_results")),I=h||T("search_placeholder","Pesquisar...");if(g)return a.jsxs("div",{className:Kt("space-y-2",b),children:[u&&a.jsxs(as,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Lr,{className:"h-10 w-full"})]});const M="string"==typeof v?v:v instanceof Error?v.message:v?T("error_loading",T("error_loading")):void 0;return M?a.jsxs("div",{className:Kt("space-y-2",b),children:[u&&a.jsxs(as,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a.jsx(d.AlertCircle,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:M})]})]}):a.jsx(Ur,{multiple:e,options:P,value:r||(e?[]:""),onChange:D,getOptionValue:i,getOptionLabel:l,placeholder:E,label:u,icon:m,emptyMessage:A,searchPlaceholder:I,disabled:x,required:f,className:b,sortOptions:j,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k,showCheck:S})}const Vr=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Br(e,a){if(!a)return null;const t=Vr(a),s=[];for(const r of e){const e=Vr(r.label).includes(t),n=r.children?Br(r.children,a):null,o=n&&n.length>0;(e||o)&&s.push({...r,children:e?r.children:o?n:r.children})}return s}function qr(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=qr(t.children,a);if(e)return e}}}function $r({node:e,level:t,expanded:s,onToggleExpand:r,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,c=n.includes(e.value),u=8+20*t;return a.jsxs("div",{role:"treeitem","aria-expanded":l?s:void 0,"aria-selected":c,className:Kt("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",c&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(c?2:0)+"px"},children:[a.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:a=>{a.stopPropagation(),o(e.value)},children:[i&&a.jsx(d.Check,{className:Kt("h-4 w-4 shrink-0",c?"opacity-100":"opacity-0")}),(()=>{const t=c?e.iconSelected??(s?e.iconOpen:null)??e.icon:s?e.iconOpen??e.icon:e.icon;return t?a.jsx(t,{className:Kt("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),a.jsx("span",{className:"truncate",children:e.label})]}),l&&a.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:a=>{a.stopPropagation(),r(e.value)},tabIndex:-1,"aria-label":s?"Recolher":"Expandir",children:s?a.jsx(d.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(d.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function Wr({nodes:e,level:s,expandedIds:r,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return a.jsx(a.Fragment,{children:e.map(e=>{const d=r.has(e.value);return a.jsxs(t.Fragment,{children:[a.jsx($r,{node:e,level:s,expanded:d,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),d&&e.children&&e.children.length>0&&a.jsx(Wr,{nodes:e.children,level:s+1,expandedIds:r,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function Hr({multiple:e=!1,options:s,value:r,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:c,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:v,onOpen:b,onClose:j,defaultExpanded:w=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=t.useState(!1),[S,T]=t.useState(""),[P,D]=t.useState(()=>w?function(e){const a=new Set;return function e(t){for(const s of t)s.children&&s.children.length>0&&(a.add(s.value),e(s.children))}(e),a}(s):new Set),E=o||_("select_placeholder","Selecione..."),A=c||_("no_results",_("no_results")),I=u||_("search_placeholder","Pesquisar..."),M=t.useMemo(()=>r?Array.isArray(r)?r:[r]:[],[r]),F=t.useMemo(()=>{if(!v)return;let e=v,a=0;try{for(;e&&a<3;){const t=window.getComputedStyle(e),s=t.overflowY||t.overflow;if(!s||"visible"===s||"unset"===s)break;e=e.parentElement,a++}}catch{}return e??void 0},[v]),R=t.useMemo(()=>Br(s,S),[s,S])??s,L=t.useMemo(()=>S?function(e,a){const t=new Set,s=Vr(a);function r(e){if(!e.children||0===e.children.length)return Vr(e.label).includes(s);let a=!1;for(const t of e.children)r(t)&&(a=!0);return a&&t.add(e.value),a||Vr(e.label).includes(s)}for(const n of e)r(n);return t}(s,S):new Set,[s,S]),z=S?L:P,U=t.useCallback(e=>{S||D(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[S]),O=t.useMemo(()=>M.map(e=>({value:e,label:qr(s,e)||e})),[M,s]),V=e=>{k(e),e?b?.():(T(""),j?.())},B=t.useCallback(a=>{if(n)if(e){const e=M.includes(a)?M.filter(e=>e!==a):[...M,a];n(e)}else n(a),k(!1)},[n,e,M]),q=(a,t)=>{t.preventDefault(),t.stopPropagation(),n&&n(e?M.filter(e=>e!==a):"")},$=g?O.slice(0,g):O,W=g&&O.length>g?O.length-g:0;if(h)return a.jsxs("div",{className:Kt("space-y-2",f),children:[i&&a.jsxs(as,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Lr,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?a.jsxs("div",{className:Kt("space-y-2",f),children:[i&&a.jsxs(as,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a.jsx(d.AlertCircle,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:H})]})]}):a.jsxs("div",{className:Kt("space-y-2",f),children:[i&&a.jsxs(as,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(kr,{open:C,onOpenChange:V,modal:!1,children:[a.jsx(Sr,{asChild:!0,children:e?a.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V(!C))},className:Kt("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===O.length&&"text-muted-foreground"),children:[0===O.length?a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),E]}):a.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>a.jsxs(ar,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:a=>{"Enter"===a.key&&q(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>q(e.value,a),children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&a.jsxs(ar,{variant:"outline",className:"gap-1",children:["+",W]})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):a.jsxs(Xt,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:Kt("w-full justify-between min-h-10 h-auto font-normal",0===O.length&&"text-muted-foreground"),children:[0===O.length?a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),E]}):a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),O[0]?.label]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Tr,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:F,collisionBoundary:F,children:[a.jsxs("div",{className:"flex items-center border-b px-3",children:[a.jsx(d.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:I,value:S,onChange:e=>T(e.target.value)}),S&&a.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:a.jsx("div",{role:"tree",className:"p-1",children:0===R.length?a.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===s.length?A:_("no_search_results",_("no_results"))}):a.jsx(Wr,{nodes:R,level:0,expandedIds:z,onToggleExpand:U,selectedValues:M,onSelect:B,showCheck:N})})})]})]})]})}class Gr{static normalizeBase64Url(e){let a=e.replace(/-/g,"+").replace(/_/g,"/");const t=(4-a.length%4)%4;return a+="=".repeat(t),a}static parseJwtPayload(e){try{const r=e.split(".");if(3!==r.length)return null;const n=r[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),a=atob(e),t=new Uint8Array(a.length);for(let r=0;r<a.length;r++)t[r]=a.charCodeAt(r);const s=new TextDecoder("utf-8").decode(t);return JSON.parse(s)}catch(a){try{const e=this.normalizeBase64Url(n),a=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(a)}catch(t){try{const e=this.normalizeBase64Url(n),a=atob(e);return JSON.parse(a)}catch(s){throw s}}}}catch(r){return null}}static validateTokens(e,a){const t=[],s=[];try{a.split(".")[1],e.split(".")[1];const r=this.parseJwtPayload(a),n=this.parseJwtPayload(e);if(!r){const e="ID token decode falhou - possível problema com base64url encoding";return s.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:t,errors:s}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";t.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";t.push(e),o=!1}if(r.exp&&r.exp<i){const e="ID token expirado - autenticação inválida";return s.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:t,errors:s}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:t,errors:s}}catch(r){const e=`Erro na validação de tokens: ${r}`;return s.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:t,errors:s}}}static isTokenExpired(e){const a=this.parseJwtPayload(e);return!a||!a.exp||1e3*a.exp<Date.now()}}Gr.LARGE_PAYLOAD_THRESHOLD=1e3;const Kr="qualiex_access_token",Yr="qualiex_id_token",Qr="supabase_token",Xr="oauth_state",Jr="oauth_nonce",Zr="selected_alias",en="manual_logout",an="supabase_project_id",tn={setAccessToken:e=>localStorage.setItem(Kr,e),getAccessToken:()=>localStorage.getItem(Kr),setIdToken:e=>localStorage.setItem(Yr,e),getIdToken:()=>localStorage.getItem(Yr),getSupabaseToken:()=>localStorage.getItem(Qr),setOAuthState:e=>sessionStorage.setItem(Xr,e),getOAuthState:()=>sessionStorage.getItem(Xr),clearOAuthState:()=>sessionStorage.removeItem(Xr),setOAuthNonce:e=>sessionStorage.setItem(Jr,e),getOAuthNonce:()=>sessionStorage.getItem(Jr),clearOAuthNonce:()=>sessionStorage.removeItem(Jr),setSelectedAlias:e=>localStorage.setItem(Zr,e),getSelectedAlias:()=>localStorage.getItem(Zr),clearSelectedAlias:()=>localStorage.removeItem(Zr),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!tn.getAccessToken()||!tn.getIdToken()),checkProjectMismatch:()=>{const e=(void 0).VITE_SUPABASE_PROJECT_ID;if(!e)return!1;const a=localStorage.getItem(an);return a&&a!==e?(tn.clearAll(),localStorage.setItem(an,e),!0):(a||localStorage.setItem(an,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Qr,e),tn._clearValidationCache()},areAllTokensValid:()=>{const e=tn.getAccessToken(),a=tn.getIdToken();if(!e||!a)return!1;try{const t=Gr.validateTokens(e,a);return!!t.idTokenValid&&t.idTokenValid}catch(t){return!1}},clearExpiredTokens:()=>{let e=!1;const a=tn.getAccessToken(),t=tn.getIdToken(),s=tn.getSupabaseToken();return a&&tn.isTokenExpired(a)&&(localStorage.removeItem(Kr),e=!0),t&&tn.isTokenExpired(t)&&(localStorage.removeItem(Yr),e=!0),s&&tn.isTokenExpired(s)&&(localStorage.removeItem(Qr),e=!0),e},clearAll:()=>{localStorage.removeItem(Kr),localStorage.removeItem(Yr),localStorage.removeItem(Qr),localStorage.removeItem(Zr),localStorage.removeItem(en),sessionStorage.removeItem(Xr),sessionStorage.removeItem(Jr),tn._clearValidationCache()},setManualLogout:()=>localStorage.setItem(en,"true"),isManualLogout:()=>"true"===localStorage.getItem(en),clearManualLogout:()=>localStorage.removeItem(en),isTokenExpired:e=>{try{return Gr.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{tn._validationCache.isValid=!1,tn._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=tn.getSupabaseToken();if(!e)return!1;if(tn.isTokenExpired(e))return tn._clearValidationCache(),tn._handleExpiredToken(),!1;const a=Date.now();return a-tn._validationCache.timestamp<tn._validationCache.cacheValidityMs?tn._validationCache.isValid:(tn._validationCache.isValid=!0,tn._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>tn.isSupabaseTokenValid()?tn.getSupabaseToken():null,_handleExpiredToken:()=>{tn.clearAll()},extractTokenData:()=>{if(!tn.isSupabaseTokenValid())return null;const e=tn.getSupabaseToken();if(!e)return null;try{const a=Gr.parseJwtPayload(e);if(!a)return null;const t=a.alias||a.default||a.user_alias,s=a.place_id||null,r=a.place_name||null;let n=a.company_id;if(!n&&t)for(const e in a)if(e.startsWith("co")&&/^co\d+$/.test(e)){const s=a[e];if(s&&"string"==typeof s){const e=s.split(";");if(e.length>7&&e[0]===t){n=e[7];break}}}return{alias:t,companyId:n,placeId:s,placeName:r,payload:a}}catch(a){return tn._handleExpiredToken(),null}},getCompanyId:e=>{const a=tn.getAccessToken();if(a)try{const t=Gr.parseJwtPayload(a);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const s=t[a];if(s&&"string"==typeof s){const a=s.split(";");if(e&&a.length>7&&a[0]===e)return a[7];if(!e&&a.length>7)return a[7]}}}catch(r){}const t=tn.extractTokenData();if(t?.companyId)return t.companyId;const s=tn.getIdToken();if(s)try{const a=Gr.parseJwtPayload(s);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const s=a[t];if(s&&"string"==typeof s){const a=s.split(";");if(e&&a.length>7&&a[0]===e)return a[7];if(!e&&a.length>7)return a[7]}}}catch(r){}return null},getCompanyIdInt:e=>{const a=[tn.getAccessToken(),tn.getIdToken()];for(const t of a)if(t)try{const a=Gr.parseJwtPayload(t);if(!a)continue;for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const s=a[t];if(s&&"string"==typeof s){const a=s.split(";");if(e&&a.length>1&&a[0]===e)return a[1];if(!e&&a.length>1)return a[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=tn.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=tn.getIdToken();if(!e)return[];try{const a=Gr.parseJwtPayload(e);if(!a)return[];const t=[];for(const e in a)if(e.startsWith("co")&&/^co\d+$/.test(e)){const s=a[e];if(s&&"string"==typeof s){const e=s.split(";");e.length>=4&&t.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:a})}}return t}catch{return[]}}};const sn=new class{constructor(){this.errors=[],this.toastCount=0,this.lastToastTime=0}handleError(e,a=!0){const t="string"==typeof e?e:e.message;if(this.errors.push({id:Date.now().toString(),message:t,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),a&&this.shouldShowToast()){const e=this.getErrorTitle(t);l.toast.error(e,{description:t})}}getErrorTitle(a){const t=a.toLowerCase();return t.includes("401")||t.includes("unauthorized")||t.includes("expirou")?e.t("error_session_expired"):t.includes("token")||t.includes("autenticação")?e.t("error_authentication"):t.includes("api")||t.includes("network")?e.t("error_connection"):"Erro"}success(e,a){l.toast.success(e,{description:a})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function rn(e){return!!e&&e.startsWith("eyJ")}function nn(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE;return e||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"")}let on=!1;const ln=(void 0).VITE_SUPABASE_URL,dn=nn();class cn{constructor(){this.currentToken=null,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,a=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;on?rn(a):e&&rn(a)?on=!0:rn(a)?on=!0:on=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:dn};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return j.createClient(ln,dn,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:a,fetch:async(e,a)=>("string"==typeof e?e:e.url).includes("/auth/v1/user")?new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}}):fetch(e,a)}})}static getInstance(){return cn.instance||(cn.instance=new cn),cn.instance}getClient(){const e=tn.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Gr.isTokenExpired(e)}catch(a){return sn.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}}function un(){return cn.getInstance().getClient()}class mn{static async generateToken(e,a,t,s=!1){try{if(!s){const e=tn.getSupabaseToken();if(e&&tn.isSupabaseTokenValid())return e}const r=un(),{data:n,error:o}=await r.functions.invoke("validate-token",{body:{access_token:e,alias:a}});return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(t?.(),null):n?.access_token?(tn.setSupabaseToken(n.access_token),n.access_token):null}catch(r){return r instanceof Error&&(r.message.includes("401")||r.message.includes("Unauthorized"))&&t?.(),null}}}class pn{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const a=tn.getAccessToken(),t=tn.getSelectedAlias();if(!a||!t)return null;const s=await mn.generateToken(a,t,this.onLogoutCallback||void 0,e);return s||null}catch(a){return null}}}pn.regenerationPromise=null,pn.onLogoutCallback=null;class hn{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(tn.clearAll(),window.location.href="/login",!0)}static isAuthenticationError(e,a){if(401===e.status||401===e.statusCode)return!0;const t=a.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>t.includes(e))}static async wrapAsync(e){try{return await e}catch(a){if(!this.handleError(a))throw a;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}class xn{static async handleApiError(e){if(!e||this.isRetrying)return!1;const a=e.status||e.statusCode,t=e.message||e.toString();if(401===a||t.includes("401")||t.includes("Unauthorized")){this.isRetrying=!0;try{return await pn.attemptRegeneration()?(this.isRetrying=!1,!0):(hn.handleError(e),this.isRetrying=!1,!1)}catch(s){return hn.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=tn.getAccessToken();return e?tn.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}xn.isRetrying=!1;const fn=new class{get baseUrl(){return Oe()}async makeApiCall(e,a,t){const s=xn.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const r=tn.getAccessToken();if(!r)throw new Error("Token Qualiex não encontrado");if(!t||""===t.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const n=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{n.searchParams.append(e,a)});const o=await fetch(n.toString(),{method:"GET",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!o.ok){const e=new Error(`API call failed: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}return await o.json()}mapToQualiexUser(e){let a;return a="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:a}}parseUsersResponse(e,a=""){let t=e;if(e.data)t=e.data;else{if(!Array.isArray(e))return sn.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(sn.handleError(`[QualiexApi] Resposta não é um array${a}`,!1),null)}async fetchUsers(e,a,t="active"){const s={companyId:a,search:"",filterStatus:t};try{const a=await this.makeApiCall("/api/common/v1/companiesusers",s,e);return this.parseUsersResponse(a)??[]}catch(r){if(await xn.handleApiError(r))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",s,e);return this.parseUsersResponse(a," após retry")??[]}catch(n){return sn.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return sn.handleError(r instanceof Error?r.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,a,t){try{return(await this.fetchUsers(a,t)).find(a=>a.userId===e)||null}catch(s){return sn.handleError(s instanceof Error?s:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,a){const t=await this.fetchUsers(e,a,"active"),s=new Map;return t.forEach(e=>s.set(e.userId,e)),s}async fetchAllUsersMap(e,a){const t=await this.fetchUsers(e,a,"all"),s=new Map;return t.forEach(e=>s.set(e.userId,e)),s}async getUsers(e,a="active"){const t=tn.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId,a):[]}async fetchSoftwares(e){try{const a=await this.makeApiCall("/api/common/v1/softwares",{},e),t=a?.data||a;return Array.isArray(t)?t.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):(sn.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await xn.handleApiError(a))try{const a=await this.makeApiCall("/api/common/v1/softwares",{},e),t=a?.data||a;return Array.isArray(t)?t.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(t){return sn.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return sn.handleError(a instanceof Error?a.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,a){try{const t=await this.makeApiCall(`/api/common/v1/Users/${e}/associations`,{},a),s=t?.data||t;return Array.isArray(s)?s.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1})):(sn.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(t){if(await xn.handleApiError(t))try{const t=await this.makeApiCall(`/api/common/v1/Users/${e}/associations`,{},a),s=t?.data||t;return Array.isArray(s)?s.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1})):[]}catch(s){return sn.handleError(s instanceof Error?s:"Erro ao buscar associações após renovação de token",!0),[]}return sn.handleError(t instanceof Error?t.message:"Erro ao buscar associações do usuário",!0),[]}}};function gn(e,a){const t=a||Ve.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function vn(e,a){const t=a||Ve.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function bn(e,a){const t=a||Ve.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function yn(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||gn(e.idField),emailField:e.emailField||vn(e.idField),usernameField:e.usernameField||bn(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:gn(e),emailField:vn(e),usernameField:bn(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const jn=new Map;class wn{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,s=jn.get(t);if(s&&Date.now()-s.timestamp<3e5)return s.users;let r=await fn.fetchUsers(e,a,"all");return 0===r.length&&(r=await fn.fetchUsers(e,a,"active")),jn.set(t,{users:r,timestamp:Date.now()}),r}static extractUserIds(e,a){const t=new Set;for(const s of e)for(const e of a){const a=s[e.idField];a&&"string"==typeof a&&""!==a.trim()&&t.add(a)}return t}static indexUsers(e){const a=new Map;for(const t of e)t.id&&a.set(t.id,t),t.userId&&a.set(t.userId,t);return a}static enrichEntity(e,a,t){const s={...e};for(const r of a){const a=e[r.idField];if(!a)continue;const n=t.get(a);if(n){if(r.nameField){s[r.nameField]||(s[r.nameField]=n.userName||null)}if(r.emailField){s[r.emailField]||(s[r.emailField]=n.userEmail||null)}if(r.usernameField){s[r.usernameField]||(s[r.usernameField]=n.userName||null)}}}return s}static async enrichWithUserData(e,a){if(!Array.isArray(e)||0===e.length)return e;try{if(!tn.areAllTokensValid())return e;const t=tn.extractTokenData();if(!t)return e;const{alias:s,companyId:r}=t;if(!s||!r)return e;const n=yn(a.userIdFields,a.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(s,r),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(t){return sn.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const Nn=["responsible_name"],_n=e=>Nn.includes(e);function Cn(e,a,t){const s="string"==typeof e?{tableName:e,searchFields:a||[],schemaName:t||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:r,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:d=!1}=s,c=()=>{if(!tn.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return un().schema(i).from(r)},u=(e,a,t,s)=>{let r=c().select(o||"*",{count:"exact"});r=r.eq("is_removed",!1),Object.entries(s).forEach(([e,a])=>{void 0!==a&&""!==a&&(Array.isArray(a)?r=r.in(e,a):"object"==typeof a&&a&&"operator"in a?"not_null"===a.operator?r=r.not(e,"is",null):"is_null"===a.operator&&(r=r.is(e,null)):null!==a&&(r=r.eq(e,a)))}),r=((e,a)=>{if(a&&n.length>0){const t=n.map(e=>`${e}.ilike.%${a}%`).join(",");return e.or(t)}return e})(r,e);const i=a.includes(".");return i||_n(a)||(r=r.order(a,{ascending:"asc"===t})),{query:r,isForeignKey:i}},m=async(e,a,t,r,n)=>{const o=yn(s.userIdFields,s.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),i=a.includes(".");if(_n(a)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const d=await wn.enrichWithUserData(o.data,{entityName:l,userIdFields:s.userIdFields,userFieldsMapping:s.userFieldsMapping});let c;c=i?d.sort((e,s)=>{const r=a.split(".").reduce((e,a)=>e?.[a],e)||"",n=a.split(".").reduce((e,a)=>e?.[a],s)||"",o=String(r).localeCompare(String(n),"pt-BR");return"asc"===t?o:-o}):((e,a,t)=>[...e].sort((e,s)=>{const r=e[a]||"",n=s[a]||"",o=r.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===t?o:-o}))(d,a,t);const u=((e,a=1,t=25)=>{const s=(a-1)*t,r=s+t;return{data:e.slice(s,r),pagination:{currentPage:a,totalPages:Math.ceil(e.length/t),totalItems:e.length,itemsPerPage:t,hasNextPage:r<e.length,hasPreviousPage:a>1}}})(c,r,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await wn.enrichWithUserData(e,{entityName:l,userIdFields:s.userIdFields,userFieldsMapping:s.userFieldsMapping})},p={async getAll(e={}){const{search:a,sortField:t,sortDirection:n,page:o,limit:i,additionalFilters:c}=(e=>{const{search:a="",sortField:t="updated_at",sortDirection:s="desc",page:r=1,limit:n=25,...o}=e;return{search:a,sortField:t,sortDirection:s,page:r,limit:n,additionalFilters:o}})(e),{query:p}=u(a,t,n,c),h=((e,a,t)=>{const s=(a-1)*t,r=s+t-1;return e.range(s,r)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${r}: ${f.message}`);let v=((e,a,t,s)=>{const r=Math.ceil((a||0)/s);return{data:e,currentPage:t,totalPages:r,totalItems:a||0,itemsPerPage:s,hasNextPage:t<r,hasPreviousPage:t>1}})(x||[],g,o,i);if((e=>{if(!d||!l||0===e.length)return!1;const a=yn(s.userIdFields,s.userFieldsMapping);return e.some(e=>a.some(a=>e[a.idField]))})(v.data)){const e=await m(v.data,t,n,o,i);if(!Array.isArray(e))return e;v={...v,data:e}}return v},async getById(e){const{data:a,error:t}=await c().select(o||"*").eq("id",e).maybeSingle();if(t)throw new Error(`Error fetching ${r}: ${t.message}`);return a},async create(e){const a=Yt(e),t=Object.entries(a).reduce((e,[a,t])=>(void 0!==t&&(e[a]=t),e),{}),{data:s,error:n}=await c().insert(t).select().single();if(n)throw new Error(`Error creating ${r}: ${n.message}`);if(!s)throw new Error(`No data returned from create ${r} operation`);return s},async update(e,a){const t={...Yt(a),updated_at:(new Date).toISOString()},{data:s,error:n}=await c().update(t).eq("id",e).select().single();if(n)throw new Error(`Error updating ${r}: ${n.message}`);if(!s)throw new Error(`No data returned from update ${r} operation`);return s},async delete(e){const a={is_removed:!0,updated_at:(new Date).toISOString()},{error:t}=await c().update(a).eq("id",e);if(t)throw new Error(`Error soft deleting ${r}: ${t.message}`)}};return p}var kn;const Sn={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};class Tn{static async initialize(){try{if(tn.checkProjectMismatch())return{...Sn};if(!tn.hasAllTokens()||!tn.areAllTokensValid())return tn.clearExpiredTokens(),{...Sn};const e=tn.getAccessToken(),a=tn.getIdToken();tn.clearManualLogout();const t=this.extractUserFromIdToken(a,e),s=this.extractCompaniesFromIdToken(a),r=this.extractAliasFromAccessToken(e),n=tn.extractTokenData(),o=n?.alias;let i=null;if(o&&s.some(e=>e.alias===o))i=o;else{const e=tn.getSelectedAlias(),a=e&&s.some(a=>a.alias===e);i=a?e:r||s[0]?.alias||null}if(!tn.isSupabaseTokenValid()&&i&&await pn.attemptRegeneration(),!tn.isSupabaseTokenValid())return{...Sn};let l=null;if(i){const e=tn.getCompanyId(i),a=s.find(e=>e.alias===i);a&&(l={id:e||a.id,name:a.name,alias:a.alias})}const d=n?.placeId??null,c=n?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:t,alias:i,companies:s,selectedUnit:l,userId:t?.id||null,userAlias:t?.id||null,placeId:d,placeName:c,activePlaceId:d,activePlaceName:c}}catch(e){return{...Sn}}}static async loginDev(){try{const e=un(),{data:a,error:t}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(t)return!1;if(!a?.access_token||!a?.id_token)return!1;const s=new URL("/callback",window.location.origin);return s.hash=`access_token=${a.access_token}&id_token=${a.id_token}&token_type=bearer`,window.location.href=s.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";tn.setOAuthState(e);const a=tn.generateOAuthNonce();tn.setOAuthNonce(a);const t=`${window.location.origin}/callback`,s=new URL(Me.oauth.authUrl);s.searchParams.set("client_id",Me.oauth.clientId),s.searchParams.set("response_type",Me.oauth.responseType),s.searchParams.set("scope",Me.oauth.scope),s.searchParams.set("redirect_uri",t),s.searchParams.set("state",e),s.searchParams.set("nonce",a),s.searchParams.set("response_mode","fragment"),window.location.href=s.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),a=new URLSearchParams(window.location.search),t=t=>e.get(t)||a.get(t),s=t("access_token"),r=t("id_token"),n=t("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(s&&r){const e=tn.getAccessToken();e!==s&&tn.clearAll()}if(tn.hasAllTokens()){return tn.getValidSupabaseToken()||await pn.attemptRegeneration(!0),!0}const o=s,i=r;if(!o||!i)throw new Error("Tokens não encontrados na URL de callback");tn.setAccessToken(o),tn.setIdToken(i),tn.clearManualLogout();const l=this.extractAliasFromAccessToken(o);if(l)tn.setSelectedAlias(l);else{const e=this.extractCompaniesFromIdToken(i);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");tn.setSelectedAlias(e[0].alias)}if(!await pn.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase");return tn.clearOAuthState(),tn.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){tn.setManualLogout(),tn.clearAll(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}window.location.href="/login"}static decodeToken(e){return Gr.parseJwtPayload(e)}static extractUserFromIdToken(e,a){const t=this.decodeToken(e);if(!t)return null;const s=a?this.decodeToken(a):null;return{id:t.subNewId,email:t.email,name:t.name,identifier:t.identifier,isSysAdmin:"1"===s?.admin}}static extractCompaniesFromIdToken(e){const a=this.decodeToken(e);if(!a)return[];const t=[];return Object.keys(a).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof a[e]){const s=a[e].split(";");if(s.length>=4)t.push({id:s.length>7?s[7].trim():"",alias:s[0].trim(),name:s[3].trim()});else{const[s,r]=a[e].split("|");s&&r&&t.push({id:"",alias:s.trim(),name:r.trim()})}}}),t}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}}kn=Tn,pn.setLogoutCallback(()=>{kn.logout()});const Pn=e=>e?.placeId||null,Dn=e=>e?.placeName||null,En=t.createContext(void 0),An=({children:e})=>{const[s,r]=t.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=w.useQueryClient()}catch{}const[o,i]=t.useState(!1),l=t.useRef(0),d=t.useCallback(e=>{r(a=>({...a,...e}))},[]),c=t.useCallback(e=>{r(a=>({...a,isLoading:e}))},[]),u=t.useCallback(()=>{r({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=t.useCallback(async e=>{if(e.alias===s.alias)return;const a=++l.current;try{const r=tn.getAccessToken();if(!r)return;const o=await mn.generateToken(r,e.alias,void 0,!0);if(l.current!==a)return;if(!o)return;tn.setSupabaseToken(o),tn.setSelectedAlias(e.alias);const i=tn.extractTokenData(),c=i?.alias||e.alias,u=i?.companyId||tn.getCompanyId(e.alias),m={id:u||e.id,name:e.name,alias:c};let p=null,h=null;if(s.user?.id&&c&&u)try{const e=await fn.fetchActiveUsersMap(c,u);if(l.current!==a)return;const t=e.get(s.user.id);if(t){const e=(e=>({placeId:Pn(e),placeName:Dn(e)}))(t);p=e.placeId,h=e.placeName}}catch(t){}if(l.current!==a)return;d({alias:c,selectedUnit:m,placeId:p,placeName:h,activePlaceId:p,activePlaceName:h}),n&&await n.clear()}catch(t){}},[d,n,s.user,s.alias]),p=t.useCallback(async()=>{const e=await Tn.processCallback();if(e){const e=await Tn.initialize();e&&e.isAuthenticated&&(d({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[d,n]),h=t.useCallback(async()=>{await Tn.logout(),u(),n&&await n.clear()},[u,n]),x=t.useCallback(e=>{i(e)},[]),f=t.useCallback(()=>{},[]),g=t.useCallback(()=>{n&&n.invalidateQueries()},[n]);t.useEffect(()=>{if(!s.isAuthenticated)return;let e=!0;const a=setInterval(async()=>{if(e)if(tn.areAllTokensValid()){if(!tn.isSupabaseTokenValid())try{await pn.attemptRegeneration()||e&&h()}catch(a){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(a)}},[s.isAuthenticated,h]),t.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const a=await Tn.initialize();if(!e)return;a&&a.isAuthenticated?d({user:a.user,companies:a.companies,alias:a.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:a.selectedUnit,userId:a.userId,userAlias:a.userAlias,placeId:a.placeId,placeName:a.placeName,activePlaceId:a.activePlaceId,activePlaceName:a.activePlaceName}):e&&c(!1)}catch(a){e&&(hn.handleError(a),c(!1))}})(),()=>{e=!1}},[d,c,h]);const v=t.useMemo(()=>({...s,logout:h,processCallback:p,switchUnit:m,availableUnits:s.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[s.user,s.companies,s.alias,s.isAuthenticated,s.isLoading,s.selectedUnit,s.userId,s.userAlias,s.placeId,s.placeName,s.activePlaceId,s.activePlaceName,h,p,m,o,x,f,g]);return a.jsx(En.Provider,{value:v,children:e})},In=()=>{const e=t.useContext(En);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function Mn({queryKey:e,service:a,entityName:s,searchFields:r,additionalFilters:n={},onSuccess:o}){const[i,d]=N.useSearchParams(),c=w.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=In(),{t:h}=y.useTranslation(),x=t.useCallback(a=>{const t=`${e}_${a}`,s=i.get(t);return s||(i.get(a)||"")},[i,e]),f=x("search"),g=x("sortField")||Fe.sorting.defaultField,v=x("sortDirection")||Fe.sorting.defaultDirection,b=parseInt(x("page")||"1"),j=parseInt(x("limit")||String(Fe.pagination.defaultPageSize)),_=f,C=t.useMemo(()=>({search:_,sortField:g,sortDirection:v,page:b,limit:j,...n}),[_,g,v,b,j,n]),k=t.useCallback(()=>a.getAll(C),[a,C]),S=w.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${s}". Ensure QueryClientProvider is configured in your app root.`);const T=w.useMutation({mutationFn:a.create,onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success(qe.success.created(s)),o?.()},onError:e=>{l.toast.error(`${qe.error.create(s)}: ${e.message}`)}}),P=w.useMutation({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success(qe.success.updated(s)),o?.()},onError:e=>{l.toast.error(`${qe.error.update(s)}: ${e.message}`)}}),D=w.useMutation({mutationFn:a.delete,onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success(qe.success.deleted(s))},onError:e=>{l.toast.error(`${qe.error.delete(s)}: ${e.message}`)}}),E=t.useCallback(a=>{const t={...Object.fromEntries(i)};Object.entries(a).forEach(([a,s])=>{const r=`${e}_${a}`;""===s||0===s?delete t[r]:t[r]=String(s)}),delete t.sortField,delete t.sortDirection,d(t)},[i,d,e]),A=t.useCallback(e=>{E({search:e,page:1})},[E]),I=t.useCallback(e=>{E({sortField:e,sortDirection:g===e&&"asc"===v?"desc":"asc",page:1})},[g,v,E]),M=t.useCallback(e=>{E({page:e})},[E]),F=t.useCallback(e=>{E({limit:e,page:1})},[E]),R=t.useCallback(()=>{const a=Object.fromEntries(i),t=`${e}_`,s=Object.fromEntries(Object.entries(a).filter(([e])=>!e.startsWith(t)));d(s)},[d,i,e]),[L,z]=t.useState([]),U=t.useCallback(e=>{z(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),O=t.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(a=>a.length===e.length?[]:e)},[S?.data?.data]),V=t.useCallback(()=>{z([])},[]),B=t.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&L.length===e.length},[L,S?.data?.data]),q=w.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,t)=>{c.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${t.length} ${s}(s) deletado(s) com sucesso`)),V()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=t.useCallback((e,a)=>{const t=a?a(e):e;e.id?P.mutate({id:e.id,data:t}):T.mutate({...t,alias:u})},[u,T,P]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||Fe.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:T?.isPending??!1,isUpdating:P?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:v,currentPage:b,itemsPerPage:j,queryKey:e,createEntity:T.mutate,updateEntity:(e,a)=>P.mutate({id:e,data:a}),deleteEntity:D.mutate,save:$,handleSearch:A,handleSort:I,handlePageChange:M,handleItemsPerPageChange:F,clearFilters:R,refetch:S.refetch,selectedIds:L,selectItem:U,selectAll:O,clearSelection:V,isAllSelected:B,bulkDelete:e=>q.mutateAsync(e),isBulkDeleting:q.isPending}}function Fn(e){const[a,s]=t.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return t.useEffect(()=>{const a=window.matchMedia(e);s(a.matches);const t=e=>{s(e.matches)};return a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[e]),a}function Rn(e=768){return Fn(`(max-width: ${e-1}px)`)}const Ln=ae.forwardRef(({className:e,...t},s)=>a.jsx("table",{ref:s,className:Kt("w-full caption-bottom text-[13px] table-fixed",e),...t}));Ln.displayName="Table";const zn=ae.forwardRef(({className:e,...t},s)=>a.jsx("thead",{ref:s,className:Kt("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));zn.displayName="TableHeader";const Un=ae.forwardRef(({className:e,...t},s)=>a.jsx("tbody",{ref:s,className:Kt("[&_tr:last-child]:border-0",e),...t}));Un.displayName="TableBody";const On=ae.forwardRef(({className:e,...t},s)=>a.jsx("tfoot",{ref:s,className:Kt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));On.displayName="TableFooter";const Vn=ae.forwardRef(({className:e,...t},s)=>a.jsx("tr",{ref:s,className:Kt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));Vn.displayName="TableRow";const Bn=ae.forwardRef(({className:e,...t},s)=>a.jsx("th",{ref:s,className:Kt("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...t}));Bn.displayName="TableHead";const qn=ae.forwardRef(({className:e,...t},s)=>a.jsx("td",{ref:s,className:Kt("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));qn.displayName="TableCell";const $n=ae.forwardRef(({className:e,...t},s)=>a.jsx("caption",{ref:s,className:Kt("mt-4 text-sm text-muted-foreground",e),...t}));function Wn({rows:e=5,columns:t=4}){return a.jsx("div",{className:"w-full",children:a.jsxs("div",{className:"rounded-md border",children:[a.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:a.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>a.jsx(Lr,{className:"h-4 w-24"},t))})}),a.jsx("div",{children:Array.from({length:e}).map((e,s)=>a.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:a.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>a.jsx(Lr,{className:"h-4 w-20"},t))})},s))})]})})}function Hn({count:e=3}){return a.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>a.jsxs(ts,{children:[a.jsxs(ss,{children:[a.jsx(Lr,{className:"h-4 w-3/4"}),a.jsx(Lr,{className:"h-3 w-1/2"})]}),a.jsx(os,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(Lr,{className:"h-3 w-full"}),a.jsx(Lr,{className:"h-3 w-2/3"})]})})]},t))})}$n.displayName="TableCaption";const Gn={default:d.FileX,search:d.Search,error:d.AlertCircle};function Kn({icon:e,title:t,description:s,action:r,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,d=Gn[o];return a.jsxs("div",{className:Kt("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[a.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:a.jsx(d,{className:"h-8 w-8 text-muted-foreground"})}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),s&&a.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:s}),r&&a.jsx(Xt,{onClick:r.onClick,variant:"outline",children:r.label})]})}function Yn({children:e,className:t}){const s=ae.useRef(null),[r,n]=ae.useState(!1);ae.useEffect(()=>{const e=()=>{const e=s.current;e&&n(e.scrollWidth>e.clientWidth)};e();const a=new ResizeObserver(e);return s.current&&a.observe(s.current),()=>a.disconnect()},[e]);const o=a.jsx("div",{ref:s,className:`truncate w-full max-w-full ${t||""}`,children:e});return r?a.jsx(jr,{delayDuration:300,children:a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:o}),a.jsx(_r,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const Qn=ae.forwardRef(({direction:e,onMouseDown:t,isDragging:s,className:r},n)=>{const o="horizontal"===e;return a.jsx("div",{ref:n,onMouseDown:t,className:Kt("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],s&&"bg-primary/30",r),children:a.jsx("div",{className:Kt("rounded-full bg-border transition-colors group-hover:bg-primary",s&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});Qn.displayName="TableResizeHandle";const Xn=me.Root,Jn=me.Trigger,Zn=me.Group,eo=me.Portal,ao=me.Sub,to=me.RadioGroup,so=ae.forwardRef(({className:e,inset:t,children:s,...r},n)=>a.jsxs(me.SubTrigger,{ref:n,className:Kt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[s,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));so.displayName=me.SubTrigger.displayName;const ro=ae.forwardRef(({className:e,...t},s)=>a.jsx(me.SubContent,{ref:s,className:Kt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ro.displayName=me.SubContent.displayName;const no=ae.forwardRef(({className:e,...t},s)=>a.jsx(me.Portal,{children:a.jsx(me.Content,{ref:s,className:Kt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));no.displayName=me.Content.displayName;const oo=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(me.Item,{ref:r,className:Kt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));oo.displayName=me.Item.displayName;const io=ae.forwardRef(({className:e,children:t,checked:s,...r},n)=>a.jsxs(me.CheckboxItem,{ref:n,className:Kt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(me.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));io.displayName=me.CheckboxItem.displayName;const lo=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(me.RadioItem,{ref:r,className:Kt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(me.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));lo.displayName=me.RadioItem.displayName;const co=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(me.Label,{ref:r,className:Kt("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));co.displayName=me.Label.displayName;const uo=ae.forwardRef(({className:e,...t},s)=>a.jsx(me.Separator,{ref:s,className:Kt("-mx-1 my-1 h-px bg-border",e),...t}));uo.displayName=me.Separator.displayName;const mo=({className:e,...t})=>a.jsx("span",{className:Kt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});mo.displayName="ContextMenuShortcut";const po=({onEdit:e,onDelete:t,onToggleStatus:s,isActive:r=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),c=[];if(e){const a={icon:d.Edit,label:l("edit"),onClick:e};c.push(a)}if(o.forEach(e=>{c.push(e)}),s){const e={icon:r?d.PowerOff:d.Power,label:r?"Inativar":"Ativar",onClick:s};c.push(e)}if(n&&t){const e={icon:d.Trash2,label:l("ap_delete"),onClick:t,destructive:!0};c.push(e)}const u="dropdown"===i?xr:oo;return a.jsx(a.Fragment,{children:c.map((e,t)=>a.jsxs(u,{onClick:e.onClick,className:Kt("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[a.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},t))})},ho=({onEdit:e,onDelete:t,canDelete:s=!0,onToggleStatus:r,isActive:n=!0,customActions:o=[]})=>a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a.jsx(d.EllipsisVertical,{size:12})})}),a.jsx(hr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a.jsx(po,{onEdit:e?a=>{a?.stopPropagation(),e?.()}:void 0,onDelete:t?e=>{e?.stopPropagation(),t?.()}:void 0,onToggleStatus:r?e=>{e?.stopPropagation(),r?.()}:void 0,isActive:n,canDelete:s&&!!t,customActions:o,renderAs:"dropdown"})})]}),xo=({onEdit:e,onDelete:t,canDelete:s=!0,onToggleStatus:r,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return a.jsx(jr,{delayDuration:200,children:a.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a.jsx(d.Pencil,{size:14})})}),a.jsx(_r,{children:i("edit")})]}),o.map((e,t)=>{const s=e.icon;return a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a.jsx(s,{size:14})})}),a.jsx(_r,{children:e.label})]},t)}),r&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),r()},children:n?a.jsx(d.ToggleRight,{size:14}):a.jsx(d.ToggleLeft,{size:14})})}),a.jsx(_r,{children:n?"Inativar":"Ativar"})]}),t&&s&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:Kt("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),t()},children:a.jsx(d.Trash2,{size:14})})}),a.jsx(_r,{children:i("ap_delete")})]})]})})},fo=150;function go({columns:e,storageKey:a,onResize:s,enabled:r=!0}){const[n,o]=t.useState(()=>{if(!r||"undefined"==typeof window)return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??fo,e),{});if(a){const e=localStorage.getItem(a);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??fo,e),{})}),[i,l]=t.useState(!1),[d,c]=t.useState(null),u=t.useRef(0),m=t.useRef(0),p=t.useCallback((e,a)=>{r&&(a.preventDefault(),a.stopPropagation(),l(!0),c(e),u.current=a.clientX,m.current=n[e]??fo)},[r,n]);t.useEffect(()=>{if(!i||!d)return;const t=e.find(e=>e.key===d),r=t?.minWidth??60,n=t?.maxWidth??500,p=e=>{const a=e.clientX-u.current,t=Math.max(r,Math.min(n,m.current+a));o(e=>{const a={...e,[d]:t};return s?.(a),a})},h=()=>{l(!1),c(null),a&&o(e=>(localStorage.setItem(a,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,d,e,a,s]),t.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=t.useCallback(()=>{const t=e.reduce((e,a)=>(e[a.key]=a.defaultWidth??fo,e),{});o(t),a&&localStorage.removeItem(a),s?.(t)},[e,a,s]);return{columnWidths:n,isDragging:i,activeColumn:d,handleMouseDown:p,resetWidths:h}}const vo=r.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),bo=ae.forwardRef(({className:e,variant:t,size:s,...r},n)=>a.jsx(he.Root,{ref:n,className:Kt(vo({variant:t,size:s,className:e})),...r}));bo.displayName=he.Root.displayName;const yo=ae.createContext({size:"default",variant:"default"}),jo=ae.forwardRef(({className:e,variant:t,size:s,children:r,...n},o)=>a.jsx(pe.Root,{ref:o,className:Kt("flex items-center justify-center gap-1",e),...n,children:a.jsx(yo.Provider,{value:{variant:t,size:s},children:r})}));jo.displayName=pe.Root.displayName;const wo=ae.forwardRef(({className:e,children:t,variant:s,size:r,...n},o)=>{const i=ae.useContext(yo);return a.jsx(pe.Item,{ref:o,className:Kt(vo({variant:i.variant||s,size:i.size||r}),e),...n,children:t})});wo.displayName=pe.Item.displayName;const No=t.memo(function({onNew:e,newButtonLabel:t,showNewButton:s=!0,showSearch:r=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:c=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:v=!1,availableViewModes:b=["table","list","grid"],rightSlot:j,className:w}){const{t:N}=y.useTranslation(),_=c>0,C=e&&s||h.length>0,k=x||v||j,S=r&&o;return C||S||k||l&&_?a.jsxs("div",{className:Kt("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",w),children:[a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&s&&a.jsxs(Xt,{onClick:e,children:[a.jsx(d.Plus,{size:16,className:"mr-2"}),t||"Novo"]}),h.map((e,t)=>{const s=e.icon;return a.jsxs(Xt,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[s&&a.jsx(s,{size:16,className:"mr-2"}),e.label]},t)})]}),l&&_&&a.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[a.jsx(ar,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),a.jsxs(jr,{delayDuration:200,children:[u.length>0?u.map((e,t)=>{const s=e.icon,r=e.disabled;return a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:Kt("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:r,onClick:()=>e.action([]),children:s?a.jsx(s,{size:16}):a.jsx("span",{className:"text-xs",children:e.label[0]})})}),a.jsx(_r,{children:e.label})]},t)}):a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a.jsx(d.Trash2,{size:16})})}),a.jsx(_r,{children:N("ap_delete")})]}),a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a.jsx(d.X,{size:16})})}),a.jsx(_r,{children:N("clear_selection")})]})]})]}),S&&a.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:a.jsxs("div",{className:"relative w-full",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&a.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,v&&f&&g&&a.jsx(jo,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:b.map(e=>{const t=(e=>{switch(e){case"table":return d.Table2;case"list":return d.List;case"grid":return d.LayoutGrid}})(e);return a.jsx(wo,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a.jsx(t,{className:"h-4 w-4"})},e)})}),j]})]}):null}),_o=t.memo(({checked:e,onCheckedChange:t})=>a.jsx(Js,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function Co(e){try{const a=localStorage.getItem(e);if(!a)return null;const t=JSON.parse(a);let s=t.groupByColumns||[];return 0===s.length&&t.groupByColumn&&(s=[t.groupByColumn]),{hiddenColumns:new Set(t.hiddenColumns||[]),columnOrder:t.columnOrder||[],groupByColumns:s}}catch{return null}}function ko({columns:e,storageKey:a,enabled:s=!0,defaultHiddenColumns:r}){const n=t.useMemo(()=>e.map(e=>String(e.key)),[e]),o=t.useMemo(()=>new Set(r??[]),[r]),[i,l]=t.useState(()=>{if(!s)return o;if(!a)return o;const e=Co(a);return e?.hiddenColumns??o}),[d,c]=t.useState(()=>{if(!s||!a)return n;const e=Co(a)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=t.useState(()=>s&&a?Co(a)?.groupByColumns??[]:[]),[p,h]=t.useState(new Set);t.useEffect(()=>{s&&a&&function(e,a){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,groupByColumns:a.groupByColumns}))}catch{}}(a,{hiddenColumns:i,columnOrder:d,groupByColumns:u})},[i,d,u,a,s]),t.useEffect(()=>{const a=new Set(e.map(e=>String(e.key))),t=new Set(d),s=[...a].filter(e=>!t.has(e));s.length>0&&c(e=>[...e.filter(e=>a.has(e)),...s])},[e]);const x=t.useCallback(e=>i.has(e),[i]),f=t.useCallback(e=>{l(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),g=t.useCallback(()=>{l(new Set)},[]),v=t.useCallback(()=>{if(l(o),c(n),m([]),h(new Set),a)try{localStorage.removeItem(a)}catch{}},[n,o,a]),b=t.useCallback((e,a)=>{c(t=>{const s=[...t],[r]=s.splice(e,1);return s.splice(a,0,r),s})},[]),y=t.useCallback(e=>{h(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),j=t.useCallback(e=>{m(e),h(new Set)},[]),w=t.useCallback(e=>{m(a=>a.includes(e)?a:[...a,e])},[]),N=t.useCallback(e=>{m(a=>a.filter(a=>a!==e)),h(a=>{const t=new Set;for(const s of a)s.includes(`${e}:`)||t.add(s);return t})},[]),_=t.useCallback((e,a)=>{m(t=>{const s=[...t],[r]=s.splice(e,1);return s.splice(a,0,r),s}),h(new Set)},[]),C=u[0]??null,k=t.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=t.useMemo(()=>{if(!s)return e;const a=new Map(e.map(e=>[String(e.key),e]));return d.filter(e=>!i.has(e)&&a.has(e)).map(e=>a.get(e))},[e,d,i,s]),T=t.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(a,t,s,r){if(0===t.length)return[{groupKey:r||"__leaf__",groupValue:"",items:a,count:a.length,level:s}];const[n,...o]=t,i=new Map;for(const l of a){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([a,t])=>{const i=r?`${r}|${n}:${a}`:`${n}:${a}`,l=o.length>0?e(t,o,s+1,i):void 0;return{groupKey:i,groupValue:a,items:t,count:t.length,level:s,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:v,columnOrder:d,reorderColumns:b,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:j,addGroupByColumn:w,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:T,collapsedGroups:p,toggleGroupCollapse:y}}function So({enabled:e=!1,onReorder:a}){const[s,r]=t.useState(null),[n,o]=t.useState(null),i=t.useCallback(()=>{r(null),o(null)},[]),l=t.useCallback((t,n)=>({draggable:e,onDragStart:a=>{e&&(r(t),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setData("text/plain",String(t)),n&&a.dataTransfer.setData("application/column-key",n))},onDragOver:a=>{e&&null!==s&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDragEnter:a=>{e&&null!==s&&(a.preventDefault(),o(t))},onDrop:r=>{r.preventDefault(),e&&null!==s&&s!==t?(a(s,t),i()):i()},onDragEnd:()=>{i()}}),[e,s,a,i]);return t.useMemo(()=>({dragFromIndex:s,dragOverIndex:n,isDragging:null!==s,getDragProps:l}),[s,n,l])}function To({columns:e,columnOrder:s,isColumnHidden:r,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:c,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=t.useState(null),[v,b]=t.useState(null),j=t.useRef(null),w=new Map(e.map(e=>[String(e.key),e])),N=s.filter(e=>w.has(e)).map(e=>w.get(e)),_=()=>{j.current=null,g(null),b(null)};N.some(e=>r(String(e.key)));const C=N.every(e=>!r(String(e.key)));return a.jsxs(kr,{children:[a.jsx(Sr,{asChild:!0,children:a.jsx(Xt,{variant:"outline",size:"icon",className:"h-8 w-8",children:a.jsx(d.Columns3,{size:16})})}),a.jsxs(Tr,{className:"w-[260px] p-0",align:"end",children:[a.jsx("div",{className:"px-3 py-2 border-b",children:a.jsx("span",{className:"text-sm font-medium",children:"Colunas"})}),a.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:a.jsx(jr,{delayDuration:300,children:N.map((e,t)=>{const s=String(e.key),o=r(s),h=!1!==e.hideable,y=!0===e.groupable,w=u.includes(s)||l===s;return a.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{j.current=e,g(e)})(t),onDragOver:e=>((e,a)=>{e.preventDefault(),b(a)})(e,t),onDrop:()=>(e=>{null!==j.current&&j.current!==e&&i(j.current,e),j.current=null,g(null),b(null)})(t),onDragEnd:_,className:Kt("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===t&&"opacity-50",v===t&&"border-t-2 border-primary"),children:[a.jsx(d.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),a.jsx(Js,{checked:!o,onCheckedChange:()=>h&&n(s),disabled:!h,className:"shrink-0"}),a.jsx("span",{className:Kt("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:Kt("h-6 w-6 shrink-0",w&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),w?p?p(s):c?.(null):m?m(s):c?.(s)},children:a.jsx(d.Group,{size:14})})}),a.jsx(_r,{children:x(w?"remove_grouping":"group_by_column")})]})]},s)})})}),a.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[a.jsx(Xt,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&a.jsx(Xt,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:"Redefinir padrão"})]})]})]})}function Po({columns:e,groupByColumns:s,addGroupByColumn:r,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=t.useState(!1),[c,u]=t.useState(null),[m,p]=t.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=s.length>0;return a.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const a=e.dataTransfer.getData("application/column-key");if(a&&!s.includes(a)){const e=h.get(a);e&&e.groupable&&r(a)}},className:Kt("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[a.jsx(d.Group,{size:14,className:"shrink-0 text-muted-foreground"}),a.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?s.map((e,s)=>{const r=h.get(e);if(!r)return null;const i=c===s,l=m===s&&c!==s;return a.jsxs(t.Fragment,{children:[s>0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),a.jsxs(ar,{variant:"secondary",className:Kt("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,a)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(a)),e.dataTransfer.effectAllowed="move",u(a)})(e,s),onDragOver:e=>((e,a)=>{e.preventDefault(),e.stopPropagation(),p(a)})(e,s),onDrop:e=>((e,a)=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer.getData("application/group-chip-index");if(""!==t){const e=parseInt(t,10);isNaN(e)||e===a||o(e,a)}u(null),p(null)})(e,s),onDragEnd:x,children:[r.header,a.jsx("button",{onClick:a=>{a.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:a.jsx(d.X,{size:12})})]})]},e)}):a.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const Do=({manager:s,columns:r,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:v,showActionBar:b=!0,showSearch:j=!1,searchValue:w,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:T,onViewModeChange:P,showViewToggle:D=!1,enableColumnResize:E=!0,resizeStorageKey:A,enableColumnManager:I=!0,columnManagerStorageKey:M,defaultHiddenColumns:F,enableGrouping:R=!1,enableExpandableRows:L=!1,renderExpandedContent:z,expandedRowIds:U,onToggleExpand:O,defaultExpandAll:V=!1,hideActionsColumn:B=!1})=>{const{t:q}=y.useTranslation(),{setSearchVisible:$}=In(),W=Rn(),[H,G]=t.useState(()=>V&&L?new Set(s.entities.map(e=>e.id)):new Set),K=void 0!==U,Y=K?new Set(U):H,Q=t.useCallback(e=>{K&&O?O(e):G(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[K,O]),X=void 0!==v?!v:b;t.useEffect(()=>{if(!j)return $(!0),()=>$(!1)},[$,j]);const J=ko({columns:r,storageKey:M,enabled:I,defaultHiddenColumns:F}),Z=So({enabled:I,onReorder:J.reorderColumns}),ee=I?J.visibleColumns:r,{columnWidths:ae,isDragging:te,activeColumn:se,handleMouseDown:re}=go({columns:ee.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:A?`${A}-columns`:void 0,enabled:E}),ne=t.useMemo(()=>(()=>{if(E){const e=ee.map(e=>ae[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return ee.map((t,s)=>({...t,calculatedWidth:e[s],style:{width:e[s]/a*100+"%"}}))}let e=0;const a=ee.map(a=>{if(a.width)return e+=a.width,{...a,calculatedWidth:a.width,isFixed:!0};{const t=a.minWidth||120,s=a.weight||1;return e+=t,{...a,calculatedWidth:t,weight:s,isFixed:!1}}});return e+=50,a.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[ee,E,ae]),oe=h||g.length>0||j||m||S||D||I,ie=X&&oe,le=k||(()=>{s.bulkDelete?.(s.selectedIds)}),de=e=>a.jsx(qn,{className:"text-center",children:c?c(e):"inline"===p?a.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a.jsx(xo,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):a.jsx(ho,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),ce=e=>a.jsx(no,{className:"w-[160px]",children:a.jsx(po,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),ue=I?a.jsx(To,{columns:r,columnOrder:J.columnOrder,isColumnHidden:J.isColumnHidden,toggleColumn:J.toggleColumn,showAllColumns:J.showAllColumns,resetColumns:J.resetColumns,reorderColumns:J.reorderColumns,groupByColumn:R?J.groupByColumn:void 0,setGroupByColumn:R?J.setGroupByColumn:void 0,groupByColumns:R?J.groupByColumns:void 0,addGroupByColumn:R?J.addGroupByColumn:void 0,removeGroupByColumn:R?J.removeGroupByColumn:void 0}):void 0;if(W)return s.isLoading?a.jsx(Hn,{count:3}):0===s.entities.length?a.jsx(Kn,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):a.jsxs("div",{className:"flex flex-col h-full",children:[ie&&a.jsx(No,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:j,searchValue:w,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:s.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:s.clearSelection,customActions:g,filters:S,viewMode:T,onViewModeChange:P,showViewToggle:D}),a.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:s.entities.map(e=>a.jsxs(Xn,{children:[a.jsx(Jn,{asChild:!0,children:a.jsx(ts,{className:Kt("overflow-hidden cursor-pointer hover:bg-muted/50",m&&s.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),m?s.selectItem(e.id):n?.(e)},children:a.jsx(os,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[m&&a.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a.jsx(_o,{checked:s.selectedIds.includes(e.id),onCheckedChange:()=>s.selectItem(e.id)})}),a.jsxs("div",{className:"flex-1",children:[ee.map(t=>a.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key))),(n||o||c)&&a.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):a.jsx(ho,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})})}),ce(e)]},e.id))})]});const me=R&&J.groupByColumns.length>0?J.getGroupedData(s.entities):null,pe=null!==me,he=(L?1:0)+(m?1:0)+ee.length+(B?0:1),xe=e=>{const r=L&&Y.has(e.id);return a.jsxs(t.Fragment,{children:[a.jsxs(Xn,{children:[a.jsx(Jn,{asChild:!0,children:a.jsxs(Vn,{className:Kt("cursor-pointer hover:bg-muted/50 relative",("inline"===p||B)&&"group",m&&s.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),m?s.selectItem(e.id):n?.(e)},children:[L&&a.jsx(qn,{className:"w-[40px] px-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),Q(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":q(r?"collapse_row":"expand_row"),children:r?a.jsx(d.ChevronDown,{size:16,className:"text-muted-foreground"}):a.jsx(d.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&a.jsx(qn,{onClick:e=>e.stopPropagation(),children:a.jsx(_o,{checked:s.selectedIds.includes(e.id),onCheckedChange:()=>s.selectItem(e.id)})}),ee.map(t=>a.jsx(qn,{className:t.className,children:a.jsx(Yn,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!B&&de(e)]})}),ce(e)]}),r&&z&&a.jsx(Vn,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qn,{colSpan:he,className:"p-0",children:a.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},fe=(e,s)=>{const{t:r}=y.useTranslation();return e.map(e=>{const r=J.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return a.jsxs(t.Fragment,{children:[a.jsx(Vn,{className:Kt("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>J.toggleGroupCollapse(e.groupKey),children:a.jsx(qn,{colSpan:s,className:"py-2 px-4",children:a.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[r?a.jsx(d.ChevronRight,{size:16}):a.jsx(d.ChevronDown,{size:16}),a.jsx("span",{children:e.groupValue}),a.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!r&&(e.children?fe(e.children,s):e.items.map(xe))]},e.groupKey)})};return a.jsxs("div",{className:"flex flex-col h-full",children:[ie&&a.jsx(No,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:j,searchValue:w,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:s.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:s.clearSelection,customActions:g,filters:S,viewMode:T,onViewModeChange:P,showViewToggle:D}),s.isLoading?a.jsx(Wn,{rows:5,columns:ee.length}):a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[R&&a.jsx(Po,{columns:r,groupByColumns:J.groupByColumns,addGroupByColumn:J.addGroupByColumn,removeGroupByColumn:J.removeGroupByColumn,reorderGroupByColumns:J.reorderGroupByColumns}),a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs(Ln,{className:"table-fixed w-full",children:[a.jsxs("colgroup",{children:[L&&a.jsx("col",{style:{width:"40px"}}),m&&a.jsx("col",{style:{width:"50px"}}),ne.map((e,t)=>a.jsx("col",{style:e.style},t)),!B&&a.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),a.jsx(zn,{children:a.jsxs(Vn,{children:[L&&a.jsx(Bn,{className:"w-[40px]"}),m&&a.jsx(Bn,{className:"w-[50px]",children:a.jsx(_o,{checked:s.isAllSelected,onCheckedChange:s.selectAll})}),ee.map((e,t)=>{const r=E&&!1!==e.resizable,n=se===String(e.key),o=I?Z.getDragProps(t,String(e.key)):{},i=Z.dragFromIndex===t,l=Z.dragOverIndex===t&&Z.dragFromIndex!==t;return a.jsxs(Bn,{className:Kt(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",I&&Z.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>s.handleSort(String(e.key)):void 0,...o,children:[a.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(c=String(e.key),s.sortField!==c?null:"asc"===s.sortDirection?a.jsx(d.ArrowUp,{size:14,className:"ml-1"}):a.jsx(d.ArrowDown,{size:14,className:"ml-1"}))]}),r&&a.jsx(Qn,{direction:"horizontal",onMouseDown:a=>re(String(e.key),a),isDragging:n})]},String(e.key));var c}),!B&&a.jsx(Bn,{className:"w-[50px] text-center",children:ue||e.t("actions")})]})}),a.jsx(Un,{children:0===s.entities.length?a.jsx(Vn,{children:a.jsx(qn,{colSpan:he,className:"h-32",children:a.jsx(Kn,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):pe?fe(me,he):s.entities.map(xe)})]})})]})]})};function Eo(e,a,s,r){const[n,o]=t.useState({}),[i,l]=t.useState({}),d=t.useMemo(()=>e,[e]),c=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,a)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(a)}catch(t){return u(e)}},p=(e,a,t)=>{if(e.required&&(""===a||null==a||Array.isArray(a)&&0===a.length))return`${e.label} é obrigatório`;if(e.validation){let r;if("function"==typeof e.validation?r=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(r=e.validation.custom),r)try{const e=r(a,t);if(e)return e}catch(s){}}};t.useEffect(()=>{if(!r)return;const e=a=>{const t=[];return a.forEach(a=>{t.push(a),a.fields&&t.push(...e(a.fields))}),t},t=e(d),n={};t.forEach(e=>{let t;if(a&&void 0!==a[e.name]){if(t=a[e.name],null==t&&(t=""),"date"===e.type&&t)if("string"==typeof t){const e=new Date(t);c(e)&&(t=e.toISOString().split("T")[0])}else c(t)&&(t=t.toISOString().split("T")[0])}else t=u(e);n[e.name]=t}),t.forEach(e=>{const a=m(e,n);void 0!==a&&(n[e.name]=a)}),a&&Object.keys(a).forEach(e=>{t.find(a=>a.name===e)||void 0===a[e]||(n[e]=a[e])}),o(n),l({}),s&&s(n)},[d,a,s,r]);const h=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...h(e.fields))}),a},x=()=>{const e=h(d),a={};return e.forEach(e=>{const t=p(e,n[e.name],n);t&&(a[e.name]=t)}),l(a),0===Object.keys(a).length};return{formData:n,errors:i,updateField:(e,a)=>{o(t=>{const r={...t,[e]:a},n=((e,a)=>{let t={...a};const s=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...s(e.fields))}),a};return s(d).filter(a=>a.dependsOn===e).forEach(e=>{const a=m(e,t);void 0!==a&&(t={...t,[e.name]:a})}),t})(e,r);return s&&s(n),n}),i[e]&&l(a=>{const t={...a};return delete t[e],t});const t=h(d).find(a=>a.name===e);if(t){const s=p(t,a,n);s&&l(a=>({...a,[e]:s}))}},validateForm:x,handleSubmit:e=>a=>{a&&(a.preventDefault(),a.stopPropagation()),x()&&e(n)}}}const Ao=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],Io=[10,22,35,45,55,68,78,87,94].flatMap(e=>Ao.map(({hue:a,saturation:t})=>((e,a,t)=>{t/=100;const s=a=>(a+e/30)%12,r=(a/=100)*Math.min(t,1-t),n=e=>{const a=t-r*Math.max(-1,Math.min(s(e)-3,Math.min(9-s(e),1)));return Math.round(255*a).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(a,t,e))),Mo=({value:e="#3b82f6",onChange:s,label:r,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),c=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=t.useState(!1),h=t.useRef([]),x=Ao.length,f=t.useMemo(()=>{const a=Io.findIndex(a=>a.toLowerCase()===e.toLowerCase());return a>=0?a:0},[e]),[g,v]=t.useState(f);t.useEffect(()=>{m&&(v(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const b=e=>{const a=Math.max(0,Math.min(Io.length-1,e));v(a),h.current[a]?.focus()},j=e=>{s?.(e),p(!1)};return a.jsxs("div",{className:"space-y-2",children:[r&&a.jsx(as,{children:r}),a.jsxs(kr,{open:m,onOpenChange:p,children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[a.jsxs("span",{className:"flex items-center min-w-0",children:[a.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&a.jsx("span",{className:"truncate",children:e})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),a.jsx(Tr,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(as,{children:u}),a.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${Ao.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),b(g+1);break;case"ArrowLeft":e.preventDefault(),b(g-1);break;case"ArrowDown":e.preventDefault(),b(g+x);break;case"ArrowUp":e.preventDefault(),b(g-x);break;case"Home":e.preventDefault(),b(0);break;case"End":e.preventDefault(),b(Io.length-1);break;case"Enter":e.preventDefault(),j(Io[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:Io.map((t,s)=>{const r=t.toLowerCase()===e.toLowerCase();return a.jsx("button",{ref:e=>{h.current[s]=e},type:"button",tabIndex:s===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(r?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:t},onClick:()=>j(t),"aria-label":`Selecionar cor ${t}`},`${t}-${s}`)})})]}),a.jsxs("div",{children:[a.jsx(as,{htmlFor:"color-input",children:c}),a.jsx(Zt,{id:"color-input",type:"color",value:e,onChange:e=>s?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Fo=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(xe.Root,{ref:r,className:Kt("relative overflow-hidden",e),...s,children:[a.jsx(xe.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Ro,{}),a.jsx(xe.Corner,{})]}));Fo.displayName=xe.Root.displayName;const Ro=ae.forwardRef(({className:e,orientation:t="vertical",...s},r)=>a.jsx(xe.ScrollAreaScrollbar,{ref:r,orientation:t,className:Kt("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...s,children:a.jsx(xe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ro.displayName=xe.ScrollAreaScrollbar.displayName;const Lo=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function zo({name:e,filled:t,className:s}){return a.jsx("span",{className:`material-symbols-outlined ${s??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Uo=({value:e=null,onChange:s,label:r,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=t.useState(!1),c=t.useRef([]),u=e?(m=e,Lo.find(e=>e.name===m)):null;var m;const p=t.useMemo(()=>{if(!e)return 0;const a=Lo.findIndex(a=>a.name===e);return a>=0?a:0},[e]),[h,x]=t.useState(p);t.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{c.current[p]?.focus()}))},[i,p]);const f=t.useCallback(e=>{const a=Math.max(0,Math.min(Lo.length-1,e));x(a),c.current[a]?.focus()},[]),g=t.useCallback(e=>{s?.(e),l(!1)},[s]),v=t.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),b=t.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Lo.length-1);break;case"Enter":e.preventDefault(),g(Lo[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return a.jsxs("div",{className:"space-y-2",children:[r&&a.jsx(as,{children:r}),a.jsxs(kr,{open:i,onOpenChange:l,children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:v,children:[u?a.jsx(zo,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):a.jsx("span",{className:"text-muted-foreground text-sm",children:n}),a.jsx(d.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),a.jsx(Tr,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{c.current[p]?.focus()})},children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(Fo,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:b,role:"grid",children:Lo.map((t,s)=>a.jsx("button",{ref:e=>{c.current[s]=e},type:"button",tabIndex:s===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===t.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(t.name),title:t.name,children:a.jsx(zo,{name:t.name,filled:t.filled,className:"text-2xl"})},t.name))})}),a.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Oo=ae.forwardRef(({className:e,...t},s)=>a.jsx(fe.Root,{className:Kt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:s,children:a.jsx(fe.Thumb,{className:Kt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Oo.displayName=fe.Root.displayName;const Vo=(e={})=>{const{user:a,alias:t}=In(),{enabled:s=!0,status:r="active"}=e;return w.useQuery({queryKey:["qualiex-users",t,r],queryFn:()=>fn.getUsers(t,r),enabled:s&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},Bo=({value:s,onChange:r,multiple:n=!1,label:o,required:i,placeholder:l,icon:d,maxDisplayedBadges:c,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:v,onOpen:b,onClose:j})=>{const{t:w}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Vo({enabled:p}),[k,S]=t.useState(new Map),T=t.useMemo(()=>s?Array.isArray(s)?s.filter(Boolean):[s].filter(Boolean):[],[s]),P=t.useMemo(()=>{if(0===T.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return T.filter(a=>a&&!e.has(a)&&!k.has(a)).sort().join(",")},[T,N,k]);t.useEffect(()=>{if(!P)return;const e=P.split(",");let a=!1;const t=tn.extractTokenData();return t?.alias&&t?.companyId?(fn.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||S(a=>{const s=new Map(a);for(const r of e){const e=t.find(e=>e.userId===r||e.id===r);e&&s.set(r,{...e,isActive:e.isActive??!1})}return s})}).catch(()=>{}),()=>{a=!0}):void 0},[P]);const D=t.useMemo(()=>f?N.filter(f):N,[N,f]),E=t.useMemo(()=>{if(0===T.length)return D;const a=new Set(D.map(e=>e.userId||e.id||"")),t=T.filter(e=>e&&!a.has(e));if(0===t.length)return D;const s=t.map(a=>{const t=k.get(a);return t||{userId:a,id:a,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...D,...s]},[D,T,k]),A=t.useCallback(a=>{let t;if("custom"===h&&x)t=x(a);else{const e=a.userName||"";switch(h){case"name-email":t=a.userEmail?`${e} (${a.userEmail})`:e;break;case"name-role":t=a.roleName?`${e} - ${a.roleName}`:e;break;default:t=e}}return!1===a.isActive?`${t} (${e.t("inactive")})`:t},[h,x]);return a.jsx(Or,{multiple:n,value:s??(n?[]:""),onChange:r,options:E,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:A,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:w("no_results"),label:o,required:i,icon:d,maxDisplayedBadges:c,disabled:m,className:u,sortOptions:g,popoverContainer:v,onOpen:b,onClose:j})};function qo({title:e,sections:s,initialData:r,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:d=!1,usersData:c}){const[u,m]=t.useState(s?.[0]?.id||""),p=t.useRef(null),[h,x]=t.useState(null),f=t.useCallback(e=>{p.current=e,x(e)},[]),g=t.useMemo(()=>s&&Array.isArray(s)?s.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[s]),{formData:v,errors:b,updateField:y,handleSubmit:j}=Eo(g,r,void 0,i),w=t.useMemo(()=>s&&Array.isArray(s)?s.map(e=>({...e,disabled:e.condition?!e.condition(v):e.disabled||!1})):[],[s,v]),N=t.useMemo(()=>{const e=w.find(e=>e.id===u);if(e&&!e.disabled)return u;const a=w.find(e=>!e.disabled);return a?.id||u},[w,u]);t.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=w.find(e=>e.id===N),C=e=>{const t=(e.computedValue,v[e.name]),s=void 0!==t?t:"",r=b[e.name];switch(e.type){case"group":const t="horizontal"===e.layout,n=t?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=t?Kt("space-y-2 w-full",e.wrapperClassName):Kt("space-y-2",e.className,e.wrapperClassName);return a.jsxs("div",{className:o,children:[e.label,a.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Bo,{value:s||"",onChange:a=>y(e.name,a),placeholder:e.placeholder,disabled:e.disabled,className:r?"border-destructive":""}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"textarea":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Zs,{id:e.name,value:s||"",onChange:a=>{y(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${r?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"select":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(Bs,{value:String(s),onValueChange:a=>{y(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a.jsx(Ws,{className:`${r?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a.jsx($s,{placeholder:e.placeholder})}),a.jsx(Ks,{children:e.options?.map(e=>a.jsx(Qs,{value:e.value,children:e.label},e.value))})]}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"multiselect":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Or,{options:e.options||[],value:Array.isArray(s)?s:[],onChange:a=>y(e.name,a),placeholder:e.placeholder,disabled:e.disabled,error:r,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"date":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Zt,{id:e.name,type:"date",value:String(s),onChange:a=>y(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Kt("w-full",r?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"color":return a.jsxs("div",{children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Zt,{id:e.name,type:"color",value:s||e.defaultValue||"#000000",onChange:a=>y(e.name,a.target.value),className:"h-10"}),r&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"color-picker":return a.jsxs("div",{children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Mo,{value:s||e.defaultValue||"#3b82f6",onChange:a=>y(e.name,a)}),r&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"icon-picker":return a.jsxs("div",{children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Uo,{value:s||e.defaultValue||null,onChange:a=>y(e.name,a)}),r&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(v):e.componentProps||{};return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(i,{value:s,onChange:a=>{y(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,error:r,popoverContainer:h,...l}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"number":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Zt,{id:e.name,type:"number",value:null!=s?String(s):"",onChange:a=>{const t=a.target.value,s=""===t?null:Number(t);y(e.name,s)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"checkbox":return a.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[a.jsx(Js,{id:e.name,checked:!!s,onCheckedChange:a=>y(e.name,a),disabled:e.disabled}),a.jsxs(as,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name);case"switch":return a.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Oo,{id:e.name,checked:!!s,onCheckedChange:a=>y(e.name,a),disabled:e.disabled}),r&&a.jsx("p",{className:"text-sm text-destructive mt-2",children:r})]},e.name);default:return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(as,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Zt,{id:e.name,type:"text",value:s||"",onChange:a=>{y(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),r&&a.jsx("p",{className:"text-sm text-destructive",children:r})]},e.name)}},k=t.useCallback(()=>{if(!_)return null;if(_.disabled)return a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),a.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return a.jsx(e,{formData:v,updateField:y,errors:b,users:c,disabled:_.disabled})}return a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,v,y,b,c,C]),S=a.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[w.length>1&&a.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:a.jsx("div",{className:"flex space-x-2",children:w.map(e=>a.jsx(Xt,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const a=w.find(a=>a.id===e);a&&!a.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:d?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):a.jsxs("form",{onSubmit:j(n),className:"space-y-3 md:space-y-4",children:[k(),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[a.jsx(Xt,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),a.jsx(Xt,{type:"submit",disabled:d,children:l||"Salvar"})]})]})})]});return a.jsx(ys,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:a.jsxs(ks,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[a.jsxs(Ss,{showSeparator:!0,children:[a.jsx(Ds,{children:e}),a.jsx(Es,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function $o({currentPage:e,totalPages:t,totalItems:s,itemsPerPage:r,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===s)return null;const c=(e-1)*r+1,u=Math.min(e*r,s);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),a.jsxs(Bs,{value:String(r),onValueChange:e=>o(Number(e)),children:[a.jsx(Ws,{className:"h-8 w-[70px]",children:a.jsx($s,{})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"10",children:"10"}),a.jsx(Qs,{value:"25",children:"25"}),a.jsx(Qs,{value:"50",children:"50"}),a.jsx(Qs,{value:"100",children:"100"})]})]})]})}),a.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[c,"-",u," ",l("of","de")," ",s," ",l("items","itens")]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronsLeft,{size:16})}),a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronLeft,{size:16})}),a.jsxs("div",{className:"flex items-center gap-1 px-2",children:[a.jsx("span",{className:"text-sm font-medium",children:e}),a.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),a.jsx("span",{className:"text-sm font-medium",children:t})]}),a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronRight,{size:16})}),a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>n(t),disabled:e===t,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronsRight,{size:16})})]})]})}function Wo({manager:e}){return a.jsx($o,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const Ho={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Go={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Ko={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Yo({children:e,direction:t="column",gap:s="md",align:r="stretch",justify:n="start",wrap:o=!1,className:i}){return a.jsx("div",{className:Kt("flex","column"===t?"flex-col":"flex-row",Ho[s],Go[r],Ko[n],o&&"flex-wrap",i),children:e})}function Qo({manager:e,filters:t,inline:s=!1}){const{t:r}=y.useTranslation(),{isSearchVisible:n}=In(),o=e.searchTerm,i=a.jsxs(a.Fragment,{children:[t.some(e=>"search"===e.type)&&!n&&a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Zt,{placeholder:"Pesquisar",value:e.searchTerm,onChange:a=>e.handleSearch(a.target.value),className:"pl-10"})]}),t.filter(e=>"select"===e.type&&e.options).map((e,t)=>a.jsxs(Bs,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a.jsx(Ws,{className:"w-[180px]",children:a.jsx($s,{placeholder:e.placeholder})}),a.jsx(Ks,{children:e.options.map(e=>a.jsx(Qs,{value:e.value,children:e.label},e.value))})]},`select-${t}`)),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return a.jsx("div",{className:s?"":"w-full sm:w-auto",children:a.jsx(r,{...e.props})},`custom-${t}`)}),o&&a.jsxs(Xt,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a.jsx(d.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return s?a.jsx("div",{className:"flex items-center gap-2",children:i}):a.jsx(Yo,{direction:"column",gap:"md",className:"mb-6",children:a.jsx(Yo,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function Xo({manager:e,config:s,formSections:r,onSave:n,onToggleStatus:o,defaultSort:i}){e&&e.queryKey;const{setSearchVisible:l}=In(),[d,c]=N.useSearchParams(),[u,m]=t.useState(!1),[p,h]=t.useState(null),[x,f]=t.useState({isOpen:!1,entityId:null,entityName:""}),[g,v]=t.useState({isOpen:!1,count:0});t.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),t.useEffect(()=>{if(i&&e){const a=`${e.queryKey}_sortField`,t=`${e.queryKey}_sortDirection`;if(!d.has(a)&&!d.has(t)){const e=Object.fromEntries(d);e[a]=i.column,e[t]=i.direction,c(e)}}},[]);const b=r.length>0?e=>{s.onEdit?s.onEdit(e):(h(e),m(!0))}:void 0,y="function"==typeof e?.deleteEntity?e=>{f({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,j=()=>{f({isOpen:!1,entityId:null,entityName:""})},w=void 0!==s.hideNewButton?!s.hideNewButton:s.showNewButton??!0,_=(s.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(s.showActionBar??!0)&&a.jsx(No,{onNew:()=>{s.onNew?s.onNew():(h(null),m(!0))},newButtonLabel:s.newButtonLabel,showNewButton:w,showSearch:s.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:s.searchPlaceholder,showBulkActions:s.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:s.bulkActions,onBulkDelete:()=>{v({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:_,filters:s.filters&&s.filters.length>0?a.jsx(Qo,{manager:e,filters:s.filters,inline:!0}):void 0}),a.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:s.customListView?a.jsx("div",{className:"flex-1 overflow-auto p-4",children:s.customListView(e.entities,e)}):a.jsx(Do,{manager:e,columns:s.columns,onEdit:b,onDelete:y,onToggleStatus:o,enableBulkActions:s.enableBulkActions,customRowActions:s.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${s.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${s.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:s.defaultHiddenColumns})}),a.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:a.jsx(Wo,{manager:e})}),!s.useCustomRouting&&!s.onNew&&r.length>0&&a.jsx(qo,{open:u,title:p?`Editar ${s.entityName}`:`Novo ${s.entityName}`,sections:r,initialData:p||void 0,onSubmit:e=>{n(e),m(!1),h(null)},onCancel:()=>{m(!1),h(null)},isLoading:e.isLoading,submitButtonText:p?"Atualizar":"Criar"}),a.jsx(ys,{open:x.isOpen,onOpenChange:j,children:a.jsxs(ks,{size:"sm",variant:"destructive",children:[a.jsx(Ss,{showSeparator:!0,children:a.jsx(Ds,{children:"Você tem certeza absoluta?"})}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a.jsx("strong",{children:x.entityName}),". Esta ação não pode ser desfeita."]})}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:j,children:"Cancelar"}),a.jsx(Xt,{variant:"destructive",onClick:()=>{x.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(x.entityId),f({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),a.jsx(ys,{open:g.isOpen,onOpenChange:()=>v({isOpen:!1,count:0}),children:a.jsxs(ks,{size:"sm",variant:"destructive",children:[a.jsx(Ss,{showSeparator:!0,children:a.jsx(Ds,{children:"Você tem certeza absoluta?"})}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a.jsx("strong",{children:g.count})," ",1===g.count?s.entityName:s.entityNamePlural,". Esta ação não pode ser desfeita."]})}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:()=>v({isOpen:!1,count:0}),children:"Cancelar"}),a.jsx(Xt,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),v({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Jo(e,a){const t=e.toLowerCase();return t.includes("email")?{type:"email",required:!0}:t.includes("phone")||t.includes("tel")?{type:"tel"}:t.includes("description")||t.includes("content")||t.includes("notes")?{type:"textarea"}:t.includes("status")||t.includes("type")||t.includes("category")?{type:"select",options:[]}:"boolean"==typeof a?{type:"boolean"}:"number"==typeof a?{type:"number"}:a instanceof Date?{type:"date"}:{type:"text"}}function Zo(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function ei(e={}){const{paramName:a="alias"}=e,s=N.useParams(),{alias:r,companies:n}=In(),o=s[a]||null;return t.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,a=!!e;return{urlAlias:o,isAliasMismatch:a&&o!==r,isValidAlias:a,isMissing:!1,matchedCompany:e}},[o,r,n])}const ai=r.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),ti={info:d.Info,warning:d.Info,danger:d.AlertTriangle,success:d.CheckCircle},si=ae.forwardRef(({className:e,variant:t="info",showIcon:s=!0,children:r,...n},o)=>{const i=ti[t||"info"];return a.jsxs("div",{ref:o,role:"alert",className:Kt(ai({variant:t}),e),...n,children:[s&&a.jsx(i,{className:"h-4 w-4"}),r]})});si.displayName="Alert";const ri=ae.forwardRef(({className:e,...t},s)=>a.jsx("h5",{ref:s,className:Kt("mb-1 font-medium leading-none tracking-tight",e),...t}));ri.displayName="AlertTitle";const ni=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("text-sm [&_p]:leading-relaxed",e),...t}));ni.displayName="AlertDescription";const oi=t.createContext(void 0);function ii({children:e,actions:s}){const{t:r}=y.useTranslation(),[n,o]=t.useState({}),[i,l]=t.useState(s);t.useEffect(()=>{l(s)},[s]);const d=t.useCallback(()=>o({}),[]),c=t.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:d,headerActions:i,setHeaderActions:l}),[n,d,i]);return a.jsx(oi.Provider,{value:c,children:e})}function li(){const e=t.useContext(oi);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var di={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",change_photo:"Trocar foto",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nome",electronic_signature:"Assinatura Eletrônica",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Imediato",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_team:"Remover da equipe",leadership_select_subordinates:"Selecione pelo menos um liderado",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",updates:"Atualizações",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},ci={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",change_photo:"Change photo",cannot_be_own_leader:"A leader cannot be their own superior",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_profile:"Edit Profile",edit_name:"Edit Name",electronic_signature:"Electronic Signature",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_immediate_superior:"Immediate Superior",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_team:"Remove from team",leadership_select_subordinates:"Select at least one subordinate",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",updates:"Updates",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},ui={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",change_photo:"Cambiar foto",cannot_be_own_leader:"Un líder no puede ser su propio superior",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nombre",electronic_signature:"Firma Electrónica",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Inmediato",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_team:"Quitar del equipo",leadership_select_subordinates:"Seleccione al menos un subordinado",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",updates:"Actualizaciones",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const mi="true"===(void 0).VITE_I18N_DEBUG_MODE;function pi(a,t){e.addResourceBundle(a,"app",t,!0,!0)}mi&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:di},"en-US":{core:ci},"es-ES":{core:ui}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:mi?["debugKeys"]:[]});const hi=t.createContext(void 0),xi={locale:At,timezone:Mt,datetimeFormat:It},fi=async()=>{},gi=({children:e})=>a.jsx(hi.Provider,{value:{...xi,setLocale:fi,setTimezone:fi,setDatetimeFormat:fi,isLoading:!1},children:e}),vi=()=>{const e=t.useContext(hi);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},bi=t.createContext({moduleAlias:null});function yi({moduleAlias:e=null,children:t}){return a.jsx(bi.Provider,{value:{moduleAlias:e},children:t})}function ji(){return t.useContext(bi)}const wi=ge.Root,Ni=ge.CollapsibleTrigger,_i=ge.CollapsibleContent;class Ci extends t.Component{constructor(a){super(a),this.copyErrorDetails=()=>{const a=sn.getErrors().slice(0,2),t=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${a.map((e,a)=>`${a+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(t),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})},this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,a){if((void 0).DEV)throw e;sn.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t=sn.getErrors().slice(0,2);return a.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:a.jsxs(ts,{className:"w-full max-w-2xl",children:[a.jsxs(ss,{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),a.jsx(rs,{children:e.t("something_went_wrong")})]}),a.jsxs(os,{className:"space-y-4",children:[a.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),a.jsxs(wi,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a.jsx(Ni,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[a.jsx(d.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),a.jsxs(_i,{className:"mt-4 space-y-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),a.jsxs("div",{className:"text-sm space-y-2",children:[a.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&a.jsx(Fo,{className:"h-32 w-full rounded border bg-muted p-2",children:a.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),t.length>0&&a.jsxs("div",{className:"pt-3 border-t",children:[a.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),a.jsx("div",{className:"space-y-2",children:t.map((e,t)=>a.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[t+1,"."]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),a.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),a.jsxs(Xt,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a.jsx(d.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a.jsx(Xt,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const ki=ve.Root,Si=ae.forwardRef(({className:e,...t},s)=>a.jsx(ve.List,{ref:s,className:Kt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Si.displayName=ve.List.displayName;const Ti=ae.forwardRef(({className:e,...t},s)=>a.jsx(ve.Trigger,{ref:s,className:Kt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Ti.displayName=ve.Trigger.displayName;const Pi=ae.forwardRef(({className:e,...t},s)=>a.jsx(ve.Content,{ref:s,className:Kt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function Di({className:e}){return a.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),a.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),a.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function Ei({className:e}){return a.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),a.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),a.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}Pi.displayName=ve.Content.displayName;const Ai={init(e){!function(e){try{return void function(e,a,t,s,r,n,o){a.getElementById("clarity-script")||(e[t]=e[t]||function(){(e[t].q=e[t].q||[]).push(arguments)},(n=a.createElement(s)).async=1,n.src="https://www.clarity.ms/tag/"+r+"?ref=npm",n.id="clarity-script",(o=a.getElementsByTagName(s)[0]).parentNode.insertBefore(n,o))}(window,document,"clarity","script",e)}catch(a){return}}(e)},setTag(e,a){window.clarity("set",e,a)},identify(e,a,t,s){window.clarity("identify",e,a,t,s)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Ii="forlogic_";function Mi(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Fi(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Ri(e){return Fi()?`${Ii}${e}`:e}function Li(e){return Fi()?`${Ii}${e}`:e}function zi(e){try{e()}catch(a){(void 0).DEV}}function Ui(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&Ai.setTag(Li(a),t)}function Oi({module:e,isContracted:a,sourceModule:t,alias:s}){Mi()&&zi(()=>{Ui({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:s}),Ai.event(Ri("module_menu_click"))})}function Vi({module:e,sourceModule:a,alias:t}){Mi()&&zi(()=>{Ui({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),Ai.event(Ri("module_interest_click"))})}function Bi({resource:e,sourceModule:a,alias:t}){Mi()&&zi(()=>{Ui({footer_resource:e,source_module:a,alias:t}),Ai.event(Ri("module_footer_click"))})}function qi({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:t="https://sabergestao.com.br/",wikiUrl:s,alias:r,sourceModule:n}){const{t:o}=y.useTranslation(),i=Gt(e||s||"https://educacao.sabergestao.com.br/{alias}/fe",r),l=e=>{Bi({resource:e,sourceModule:n,alias:r})};return a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(ls,{className:"mb-4"}),a.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[a.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),a.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(Di,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),a.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),a.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(Ei,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),a.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),a.jsxs("a",{href:s||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(d.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const $i=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]}];function Wi({module:e,onClick:t}){return a.jsxs("button",{type:"button",onClick:t,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[a.jsx("div",{className:Kt("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&a.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function Hi(e,a){if(0===e.length)return e;const t=Math.ceil(e.length/a),s=[];for(let r=0;r<t;r++)for(let n=0;n<a;n++){const a=n*t+r;a<e.length&&s.push(e[a])}return s}function Gi({modules:e,onModuleClick:s,contractedModules:r,onModuleInterest:n}){const o=function(){const[e,a]=t.useState(4);return t.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?a(4):window.matchMedia("(min-width: 768px)").matches?a(3):window.matchMedia("(min-width: 640px)").matches?a(2):a(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,a)=>e.name.localeCompare(a.name)),l=void 0!==r,d=l?i.filter(e=>r.includes(e.name)):i,c=l?i.filter(e=>!r.includes(e.name)):[],u=Hi(d,o),m=Hi(c,o),p=(e,a)=>{a?s?.(e):n?.(e)};return a.jsxs("div",{className:"space-y-6",children:[u.length>0&&a.jsx("section",{children:a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:u.map(e=>a.jsx(Wi,{module:e,onClick:()=>p(e,!0)},e.name))})}),m.length>0&&a.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[a.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>a.jsx(Wi,{module:e,onClick:()=>p(e,!1)},e.name))})]})]})}function Ki({onModuleClick:e,contractedModules:s,onModuleInterest:r,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:d,sourceModule:c}){const[u,m]=t.useState("qualiex"),p=e=>{Vi({module:e,sourceModule:c,alias:d}),window.open(n,"_blank","noopener,noreferrer"),r?.(e)};return a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs(ki,{value:u,onValueChange:m,className:"flex-1 flex flex-col min-h-0",children:[a.jsx(Si,{className:"w-fit shrink-0",children:$i.map(e=>a.jsxs(Ti,{value:e.id,children:[e.label,a.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),$i.map(t=>a.jsx(Pi,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a.jsx(Gi,{modules:t.modules,onModuleClick:a=>{return r=a,n=t.id,Oi({module:r,isContracted:"qualiex"!==n||!s||s.includes(r.name),sourceModule:c,alias:d}),void e?.(r);var r,n},contractedModules:"qualiex"===t.id?s:void 0,onModuleInterest:p})},t.id))]}),a.jsx(qi,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:d,sourceModule:c})]})}const Yi={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},Qi=6e5;function Xi(e){const{moduleAlias:a}=ji(),{alias:s,user:r,isAuthenticated:n}=In(),o=e??a,i=r?.id??null,l=n&&!!s&&!!i,{data:d=[],isLoading:c}=w.useQuery({queryKey:["qualiex-associations",i,s],queryFn:()=>fn.fetchUserAssociations(i,s),enabled:l,staleTime:Qi,gcTime:12e5}),u=t.useMemo(()=>s&&0!==d.length?d.find(e=>e.companyAlias===s)??null:null,[d,s]),m=t.useCallback(e=>{if(!u)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=Yi[e];return void 0!==a&&u.softwares.includes(a)})},[u]);return{hasAccess:t.useMemo(()=>!o||m(o),[o,m]),isLoading:l&&c,role:t.useMemo(()=>u?{id:u.roleId,name:u.roleName}:null,[u]),association:u,hasAccessTo:m}}function Ji(e){const{association:a}=Xi();return t.useMemo(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,s=$i.find(e=>"qualiex"===e.id);return s?s.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=Yi[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function Zi({open:e,onOpenChange:t,onModuleClick:s,contractedModules:r,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:d}){const{alias:c}=In(),u=Ji(r);return a.jsx(ys,{open:e,onOpenChange:t,children:a.jsxs(ks,{size:"lg",className:"overflow-hidden flex flex-col",children:[a.jsx(Ss,{className:"sr-only",children:a.jsx(Ds,{children:"Módulos"})}),a.jsx(Ki,{onModuleClick:e=>{s?s(e):e.url&&Ht(Gt(e.url,c||void 0))},contractedModules:u,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c||void 0,sourceModule:d})]})})}function el({open:s,onOpenChange:r,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:c,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:v=!0,size:b="lg",children:j,sourceModule:w}){const{t:N}=y.useTranslation(),_=t.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(a=>e.set(a.alias,a));const a=Array.from(e.values()),t=a.find(e=>e.alias===m),s=a.filter(e=>e.alias!==m).sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"}));return t?[t,...s]:s},[u,m]);return a.jsx(ys,{open:s,onOpenChange:v?void 0:r,children:a.jsxs(ks,{size:b,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:v?e=>e.preventDefault():void 0,onEscapeKeyDown:v?e=>e.preventDefault():void 0,children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[a.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[a.jsx(Ds,{children:N("no_access_page")}),a.jsx(Es,{children:"Selecione um módulo para continuar navegando!"})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a.jsx(d.Building2,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"truncate text-xs",children:c||"Unidade"}),a.jsx(d.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),a.jsx(hr,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>a.jsxs(xr,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a.jsx(d.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),a.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&a.jsx(ar,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsxs(Xt,{variant:"ghost",size:"sm",className:"gap-2",children:[a.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:a.jsx(d.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a.jsx(d.ChevronDown,{className:"h-3 w-3"})]})}),a.jsxs(hr,{align:"end",children:[a.jsxs("div",{className:"px-2 py-1.5",children:[a.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:c})]}),a.jsx(br,{}),a.jsxs(xr,{onClick:h,children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),j?a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[a.jsx("div",{className:"flex-1",children:j}),a.jsx(qi,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:w})]}):a.jsx(Ki,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:w})]})})}function al(e,a){const{t:t}=y.useTranslation();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function tl({children:e,contractedModules:s,onModuleClick:r,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:d,accessDeniedRoutes:c,sourceModule:u}){const{t:m}=y.useTranslation(),{hasAccess:p,isLoading:h,association:x}=Xi(),{user:f,alias:g,companies:v,isAuthenticated:b,isLoading:j,logout:w,switchUnit:N}=In(),_=Ji(s),C=t.useMemo(()=>v?.length?g&&v.find(e=>e.alias===g)||v[0]:null,[v,g]),k=t.useMemo(()=>v?.length?v.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[v]),S=t.useCallback(e=>{const a=v?.find(a=>a.alias===e.alias);if(!a)return;const{pathname:t,search:s,hash:r}=window.location;if(g){const e=t.split("/"),n=e.indexOf(g);if(n>=0)return e[n]=a.alias,void(window.location.href=e.join("/")+s+r)}N(a)},[g,N,v]),T=t.useCallback(e=>{r?r(e):e.url&&Ht(Gt(e.url,g||void 0))},[r,g]),P=t.useMemo(()=>{if(!c)return;const e=window.location.pathname,a=Object.keys(c).find(a=>al(e,[a]));return a?c[a]:void 0},[c]);return j||!b||d?.length&&al(window.location.pathname,d)?a.jsx(a.Fragment,{children:e}):h?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(sr,{size:"lg"})}):p?a.jsx(a.Fragment,{children:e}):a.jsx(el,{open:!0,onModuleClick:T,contractedModules:_,onModuleInterest:n,userName:f?.name,unitName:C?.name,units:k,currentAlias:g||void 0,onUnitChange:S,onLogout:w,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:u,blocking:!0,children:P})}let sl=!1;function rl(){if(sl||"undefined"==typeof document)return;sl=!0;for(const a of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${a}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=a,a.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const a of e)if(!document.querySelector(`link[href="${a}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=a,document.head.appendChild(e)}}function nl({projectId:e,mode:a="auto"}){const{user:s,alias:r,isAuthenticated:n}=In();t.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!ze()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Ai.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(t){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,a]),t.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==a&&n&&s&&"function"==typeof window.clarity)try{const e=s.email||s.identifier||"anonymous";Ai.identify(e,void 0,"modules-menu",s.name||void 0),r&&Ai.setTag("alias",r),"boolean"==typeof s.isSysAdmin&&Ai.setTag("isSysAdmin",String(s.isSysAdmin))}catch(e){(void 0).DEV}},[s,r,n,a])}function ol({projectId:e,mode:a}){return nl({projectId:e,mode:a}),null}function il(){const e=rn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),t=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||t||!(void 0).DEV)return null;const s={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return a.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[a.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",a.jsx("code",{style:s,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",a.jsx("code",{style:s,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const ll=be.Root,dl=ae.forwardRef(({className:e,...t},s)=>a.jsx(be.Item,{ref:s,className:Kt("border-b",e),...t}));dl.displayName="AccordionItem";const cl=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsx(be.Header,{className:"flex",children:a.jsxs(be.Trigger,{ref:r,className:Kt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));cl.displayName=be.Trigger.displayName;const ul=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsx(be.Content,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...s,children:a.jsx("div",{className:Kt("pb-4 pt-0",e),children:t})}));ul.displayName=be.Content.displayName;const ml=ae.forwardRef(({className:e,...t},s)=>a.jsx(ye.Root,{ref:s,className:Kt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ml.displayName=ye.Root.displayName;const pl=ae.forwardRef(({className:e,...t},s)=>a.jsx(ye.Image,{ref:s,className:Kt("aspect-square h-full w-full",e),...t}));pl.displayName=ye.Image.displayName;const hl=ae.forwardRef(({className:e,...t},s)=>a.jsx(ye.Fallback,{ref:s,className:Kt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));hl.displayName=ye.Fallback.displayName;const xl=ae.forwardRef(({...e},t)=>a.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));xl.displayName="Breadcrumb";const fl=ae.forwardRef(({className:e,...t},s)=>a.jsx("ol",{ref:s,className:Kt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));fl.displayName="BreadcrumbList";const gl=ae.forwardRef(({className:e,...t},s)=>a.jsx("li",{ref:s,className:Kt("inline-flex items-center gap-1.5",e),...t}));gl.displayName="BreadcrumbItem";const vl=ae.forwardRef(({asChild:e,className:t,...r},n)=>{const o=e?s.Slot:"a";return a.jsx(o,{ref:n,className:Kt("transition-colors hover:text-foreground",t),...r})});vl.displayName="BreadcrumbLink";const bl=ae.forwardRef(({className:e,...t},s)=>a.jsx("span",{ref:s,role:"link","aria-disabled":"true","aria-current":"page",className:Kt("font-normal text-foreground",e),...t}));bl.displayName="BreadcrumbPage";const yl=({children:e,className:t,...s})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Kt("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...s,children:e??a.jsx(d.ChevronRight,{})});yl.displayName="BreadcrumbSeparator";const jl=({className:e,...t})=>a.jsxs("span",{role:"presentation","aria-hidden":"true",className:Kt("flex h-9 w-9 items-center justify-center",e),...t,children:[a.jsx(d.MoreHorizontal,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Mais"})]});jl.displayName="BreadcrumbEllipsis";const wl=r.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),Nl=ae.forwardRef(({className:e,orientation:t,...s},r)=>a.jsx("div",{ref:r,className:Kt(wl({orientation:t}),e),...s}));function _l({className:e,classNames:t,showOutsideDays:s=!0,...r}){return a.jsx(I.DayPicker,{showOutsideDays:s,className:Kt("p-3 pointer-events-auto",e),locale:Tt,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:"flex h-9 w-full items-center justify-center px-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1",button_previous:Kt(Qt({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Kt(Qt({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:Kt(Qt({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...t},components:{Chevron:({orientation:e})=>"left"===e?a.jsx(d.ChevronLeft,{className:"h-4 w-4"}):a.jsx(d.ChevronRight,{className:"h-4 w-4"})},...r})}Nl.displayName="ButtonGroup",_l.displayName="Calendar";const Cl={Root:function({children:e,className:t}){return a.jsx("div",{className:Kt("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:s}){return a.jsx(ts,{className:Kt("transition-colors",t&&"cursor-pointer hover:bg-muted/50",s),onClick:t,children:a.jsx(os,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:s}){return a.jsxs("div",{className:Kt("flex justify-between items-center text-sm",s),children:[a.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),a.jsx("span",{className:"text-foreground",children:t})]})}};function kl({date:e,onDateChange:t,placeholder:s,disabled:r=!1,className:n,disabledDates:o}){const{t:l}=y.useTranslation(),c=s??l("select_date");return a.jsxs(kr,{children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",disabled:r,className:Kt("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[a.jsx(d.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Tt}):a.jsx("span",{children:c})]})}),a.jsx(Tr,{className:"w-auto p-0",align:"start",children:a.jsx(_l,{mode:"single",selected:e,onSelect:t,disabled:o,initialFocus:!0,className:"pointer-events-auto"})})]})}const Sl=({shouldScaleBackground:e=!0,...t})=>a.jsx(M.Drawer.Root,{shouldScaleBackground:e,...t});Sl.displayName="Drawer";const Tl=M.Drawer.Trigger,Pl=M.Drawer.Portal,Dl=M.Drawer.Close,El=ae.forwardRef(({className:e,...t},s)=>a.jsx(M.Drawer.Overlay,{ref:s,className:Kt("fixed inset-0 z-50 bg-black/80",e),...t}));El.displayName=M.Drawer.Overlay.displayName;const Al=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(Pl,{children:[a.jsx(El,{}),a.jsxs(M.Drawer.Content,{ref:r,className:Kt("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...s,children:[a.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));Al.displayName="DrawerContent";const Il=({className:e,...t})=>a.jsx("div",{className:Kt("grid gap-1.5 p-4 text-center sm:text-left",e),...t});Il.displayName="DrawerHeader";const Ml=({className:e,...t})=>a.jsx("div",{className:Kt("mt-auto flex flex-col gap-2 p-4",e),...t});Ml.displayName="DrawerFooter";const Fl=ae.forwardRef(({className:e,...t},s)=>a.jsx(M.Drawer.Title,{ref:s,className:Kt("text-lg font-semibold leading-none tracking-tight",e),...t}));Fl.displayName=M.Drawer.Title.displayName;const Rl=ae.forwardRef(({className:e,...t},s)=>a.jsx(M.Drawer.Description,{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));Rl.displayName=M.Drawer.Description.displayName;const Ll={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},zl={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Ul=je.Root,Ol=je.Trigger,Vl=ae.forwardRef(({className:e,align:t="center",sideOffset:s=4,...r},n)=>a.jsx(je.Content,{ref:n,align:t,sideOffset:s,className:Kt("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Vl.displayName=je.Content.displayName;const Bl=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-slot":"input-group",className:Kt("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...t}));Bl.displayName="InputGroup";const ql=r.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),$l=ae.forwardRef(({className:e,align:t,...s},r)=>a.jsx("div",{ref:r,"data-slot":"input-group-addon",className:Kt(ql({align:t}),e),...s}));$l.displayName="InputGroupAddon";const Wl=r.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),Hl=ae.forwardRef(({className:e,size:t,variant:s="ghost",...r},n)=>a.jsx(Xt,{ref:n,"data-slot":"input-group-button",variant:s,className:Kt(Wl({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...r}));Hl.displayName="InputGroupButton";const Gl=ae.forwardRef(({className:e,...t},s)=>a.jsx(Zt,{ref:s,"data-slot":"input-group-control",className:Kt("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));Gl.displayName="InputGroupInput";const Kl=ae.forwardRef(({className:e,...t},s)=>a.jsx(Zs,{ref:s,"data-slot":"input-group-control",className:Kt("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));Kl.displayName="InputGroupTextarea";const Yl=ae.forwardRef(({className:e,...t},s)=>a.jsx("h1",{ref:s,className:Kt("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));Yl.displayName="H1";const Ql=ae.forwardRef(({className:e,...t},s)=>a.jsx("h2",{ref:s,className:Kt("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));Ql.displayName="H2";const Xl=ae.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Kt("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));Xl.displayName="H3";const Jl=ae.forwardRef(({className:e,...t},s)=>a.jsx("h4",{ref:s,className:Kt("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));Jl.displayName="H4";const Zl=ae.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Kt("leading-7 [&:not(:first-child)]:mt-6",e),...t}));Zl.displayName="P";const ed=ae.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Kt("text-xl text-muted-foreground",e),...t}));ed.displayName="Lead";const ad=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Kt("text-lg font-semibold",e),...t}));ad.displayName="Large";const td=ae.forwardRef(({className:e,...t},s)=>a.jsx("small",{ref:s,className:Kt("text-sm font-medium leading-none",e),...t}));td.displayName="Small";const sd=ae.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));sd.displayName="Muted";const rd=ae.forwardRef(({className:e,...t},s)=>a.jsx("code",{ref:s,className:Kt("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));rd.displayName="InlineCode";const nd=ae.forwardRef(({className:e,...t},s)=>a.jsx("blockquote",{ref:s,className:Kt("mt-6 border-l-2 pl-6 italic",e),...t}));nd.displayName="Blockquote";const od=ae.forwardRef(({className:e,...t},s)=>a.jsx("ul",{ref:s,className:Kt("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));od.displayName="List";const id=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(we.Root,{ref:r,className:Kt("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...s,children:[t,a.jsx(hd,{})]}));id.displayName=we.Root.displayName;const ld=ae.forwardRef(({className:e,...t},s)=>a.jsx(we.List,{ref:s,className:Kt("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));ld.displayName=we.List.displayName;const dd=we.Item,cd=r.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),ud=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(we.Trigger,{ref:r,className:Kt(cd(),"group",e),...s,children:[t," ",a.jsx(d.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));ud.displayName=we.Trigger.displayName;const md=ae.forwardRef(({className:e,...t},s)=>a.jsx(we.Content,{ref:s,className:Kt("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...t}));md.displayName=we.Content.displayName;const pd=we.Link,hd=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{className:Kt("absolute left-0 top-full flex justify-center"),children:a.jsx(we.Viewport,{className:Kt("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:s,...t})}));hd.displayName=we.Viewport.displayName;const xd=ae.forwardRef(({className:e,...t},s)=>a.jsx(we.Indicator,{ref:s,className:Kt("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...t,children:a.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));xd.displayName=we.Indicator.displayName;const fd=({className:e,...t})=>a.jsx("nav",{role:"navigation","aria-label":"pagination",className:Kt("mx-auto flex w-full justify-center",e),...t});fd.displayName="Pagination";const gd=ae.forwardRef(({className:e,...t},s)=>a.jsx("ul",{ref:s,className:Kt("flex flex-row items-center gap-1",e),...t}));gd.displayName="PaginationContent";const vd=ae.forwardRef(({className:e,...t},s)=>a.jsx("li",{ref:s,className:Kt("",e),...t}));vd.displayName="PaginationItem";const bd=({className:e,isActive:t,size:s="icon",...r})=>a.jsx("a",{"aria-current":t?"page":void 0,className:Kt(Qt({variant:t?"outline":"ghost",size:s}),e),...r});bd.displayName="PaginationLink";const yd=({className:t,...s})=>a.jsxs(bd,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Kt("gap-1 pl-2.5",t),...s,children:[a.jsx(d.ChevronLeft,{className:"h-4 w-4"}),a.jsx("span",{children:"Previous"})]});yd.displayName="PaginationPrevious";const jd=({className:t,...s})=>a.jsxs(bd,{"aria-label":e.t("go_to_next_page"),size:"default",className:Kt("gap-1 pr-2.5",t),...s,children:[a.jsx("span",{children:"Next"}),a.jsx(d.ChevronRight,{className:"h-4 w-4"})]});jd.displayName="PaginationNext";const wd=({className:e,...t})=>a.jsxs("span",{"aria-hidden":!0,className:Kt("flex h-9 w-9 items-center justify-center",e),...t,children:[a.jsx(d.MoreHorizontal,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"More pages"})]});wd.displayName="PaginationEllipsis";const Nd=ae.forwardRef(({className:e,value:t,...s},r)=>a.jsx(Ne.Root,{ref:r,className:Kt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...s,children:a.jsx(Ne.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Nd.displayName=Ne.Root.displayName;const _d=ae.forwardRef(({className:e,...t},s)=>a.jsx(_e.Root,{className:Kt("grid gap-2",e),...t,ref:s}));_d.displayName=_e.Root.displayName;const Cd=ae.forwardRef(({className:e,...t},s)=>a.jsx(_e.Item,{ref:s,className:Kt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(_e.Indicator,{className:"flex items-center justify-center",children:a.jsx(d.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Cd.displayName=_e.Item.displayName;const kd=Ce.Panel,Sd=re.Root,Td=re.Trigger,Pd=re.Close,Dd=re.Portal,Ed=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Overlay,{className:Kt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));Ed.displayName=re.Overlay.displayName;const Ad=r.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Id=ae.forwardRef(({side:e="right",className:t,children:s,...r},n)=>a.jsxs(Dd,{children:[a.jsx(Ed,{}),a.jsxs(re.Content,{ref:n,className:Kt(Ad({side:e}),t),...r,children:[s,a.jsxs(re.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Id.displayName=re.Content.displayName;const Md=({className:e,showSeparator:t=!1,children:s,...r})=>a.jsxs("div",{className:Kt("flex flex-col flex-shrink-0",e),...r,children:[a.jsx("div",{className:"flex flex-col text-left",children:s}),t&&a.jsx(ls,{className:"mt-2"})]});Md.displayName="SheetHeader";const Fd=({className:e,...t})=>a.jsx("div",{className:Kt("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});Fd.displayName="SheetBody";const Rd=({className:e,children:t,...s})=>a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(ls,{className:"mb-4"}),a.jsx("div",{className:Kt("flex flex-row justify-end gap-2",e),...s,children:t})]});Rd.displayName="SheetFooter";const Ld=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Title,{ref:s,className:Kt("text-lg font-semibold text-foreground",e),...t}));Ld.displayName=re.Title.displayName;const zd=ae.forwardRef(({className:e,...t},s)=>a.jsx(re.Description,{ref:s,className:Kt("text-sm text-muted-foreground",e),...t}));zd.displayName=re.Description.displayName;const Ud="sidebar:state",Od=ae.createContext(null);function Vd(){const e=ae.useContext(Od);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Bd=ae.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:s,className:r,style:n,children:o,...i},l)=>{const d=Rn(),[c,u]=ae.useState(!1),[m,p]=ae.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Ud);return null!==a?"true"===a:e}return e}),h=t??m,x=ae.useCallback(e=>{const a="function"==typeof e?e(h):e;s?s(a):p(a),"undefined"!=typeof window&&localStorage.setItem(Ud,String(a))},[s,h]),f=ae.useCallback(()=>d?u(e=>!e):x(e=>!e),[d,x,u]);ae.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",v=ae.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:d,openMobile:c,setOpenMobile:u,toggleSidebar:f}),[g,h,x,d,c,u,f]);return a.jsx(Od.Provider,{value:v,children:a.jsx(jr,{delayDuration:0,children:a.jsx("div",{className:Kt("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",r),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});Bd.displayName="SidebarProvider";const qd=ae.forwardRef(({side:e="left",variant:t="sidebar",collapsible:s="offcanvas",className:r,children:n,...o},i)=>{const{isMobile:l,state:d,openMobile:c,setOpenMobile:u}=Vd();return"none"===s?a.jsx("div",{className:Kt("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:i,...o,children:n}):l?a.jsx(Sd,{open:c,onOpenChange:u,...o,children:a.jsxs(Id,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[a.jsx(Ld,{className:"sr-only",children:"Menu de Navegação"}),a.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):a.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":d,"data-collapsible":"collapsed"===d?s:"","data-variant":t,"data-side":e,children:[a.jsx("div",{className:Kt("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),a.jsx("div",{className:Kt("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:a.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});qd.displayName="Sidebar";const $d=ae.forwardRef(({className:e,onClick:t,...s},r)=>{const{toggleSidebar:n}=Vd();return a.jsxs(Xt,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Kt("h-7 w-7",e),onClick:e=>{t?.(e),n()},...s,children:[a.jsx(d.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});$d.displayName="SidebarTrigger";const Wd=ae.forwardRef(({className:e,...t},s)=>{const{toggleSidebar:r}=Vd();return a.jsx("button",{ref:s,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:Kt("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});Wd.displayName="SidebarRail";const Hd=ae.forwardRef(({className:e,...t},s)=>a.jsx("main",{ref:s,className:Kt("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));Hd.displayName="SidebarInset";const Gd=ae.forwardRef(({className:e,...t},s)=>a.jsx(Zt,{ref:s,"data-sidebar":"input",className:Kt("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Gd.displayName="SidebarInput";const Kd=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"header",className:Kt("flex flex-col gap-2 p-2",e),...t}));Kd.displayName="SidebarHeader";const Yd=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"footer",className:Kt("flex flex-col gap-2 p-2",e),...t}));Yd.displayName="SidebarFooter";const Qd=ae.forwardRef(({className:e,...t},s)=>a.jsx(ls,{ref:s,"data-sidebar":"separator",className:Kt("mx-2 w-auto bg-sidebar-border",e),...t}));Qd.displayName="SidebarSeparator";const Xd=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"content",className:Kt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Xd.displayName="SidebarContent";const Jd=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"group",className:Kt("relative flex w-full min-w-0 flex-col p-2",e),...t}));Jd.displayName="SidebarGroup";const Zd=ae.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?s.Slot:"div";return a.jsx(o,{ref:n,"data-sidebar":"group-label",className:Kt("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})});Zd.displayName="SidebarGroupLabel";const ec=ae.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?s.Slot:"button";return a.jsx(o,{ref:n,"data-sidebar":"group-action",className:Kt("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...r})});ec.displayName="SidebarGroupAction";const ac=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"group-content",className:Kt("w-full text-sm",e),...t}));ac.displayName="SidebarGroupContent";const tc=ae.forwardRef(({className:e,...t},s)=>a.jsx("ul",{ref:s,"data-sidebar":"menu",className:Kt("flex w-full min-w-0 flex-col gap-1",e),...t}));tc.displayName="SidebarMenu";const sc=ae.forwardRef(({className:e,...t},s)=>a.jsx("li",{ref:s,"data-sidebar":"menu-item",className:Kt("group/menu-item relative",e),...t}));sc.displayName="SidebarMenuItem";const rc=r.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),nc=ae.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:o,className:i,...l},d)=>{const c=e?s.Slot:"button",{isMobile:u,state:m}=Vd(),p=a.jsx(c,{ref:d,"data-sidebar":"menu-button","data-size":n,"data-active":t,className:Kt(rc({variant:r,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:p}),a.jsx(_r,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});nc.displayName="SidebarMenuButton";const oc=ae.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>{const i=t?s.Slot:"button";return a.jsx(i,{ref:o,"data-sidebar":"menu-action",className:Kt("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});oc.displayName="SidebarMenuAction";const ic=ae.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,"data-sidebar":"menu-badge",className:Kt("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));ic.displayName="SidebarMenuBadge";const lc=ae.forwardRef(({className:e,showIcon:t=!1,...s},r)=>{const n=ae.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return a.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:Kt("rounded-md h-8 flex gap-2 px-2 items-center",e),...s,children:[t&&a.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});lc.displayName="SidebarMenuSkeleton";const dc=ae.forwardRef(({className:e,...t},s)=>a.jsx("ul",{ref:s,"data-sidebar":"menu-sub",className:Kt("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));dc.displayName="SidebarMenuSub";const cc=ae.forwardRef(({...e},t)=>a.jsx("li",{ref:t,...e}));cc.displayName="SidebarMenuSubItem";const uc=ae.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},i)=>{const l=e?s.Slot:"a";return a.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Kt("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===t&&"text-xs","md"===t&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});uc.displayName="SidebarMenuSubButton";const mc=ae.forwardRef(({className:e,value:t,defaultValue:s,...r},n)=>{const o=t||s||[0];return a.jsxs(ke.Root,{ref:n,value:t,defaultValue:s,className:Kt("relative flex w-full touch-none select-none items-center",e),...r,children:[a.jsx(ke.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(ke.Range,{className:"absolute h-full bg-primary"})}),o.map((e,t)=>a.jsx(ke.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},t))]})});mc.displayName=ke.Root.displayName;const pc=Se.Menu,hc=Se.Group,xc=Se.Portal,fc=Se.Sub,gc=Se.RadioGroup,vc=ae.forwardRef(({className:e,...t},s)=>a.jsx(Se.Root,{ref:s,className:Kt("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));vc.displayName=Se.Root.displayName;const bc=ae.forwardRef(({className:e,...t},s)=>a.jsx(Se.Trigger,{ref:s,className:Kt("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...t}));bc.displayName=Se.Trigger.displayName;const yc=ae.forwardRef(({className:e,inset:t,children:s,...r},n)=>a.jsxs(Se.SubTrigger,{ref:n,className:Kt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[s,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));yc.displayName=Se.SubTrigger.displayName;const jc=ae.forwardRef(({className:e,...t},s)=>a.jsx(Se.SubContent,{ref:s,className:Kt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));jc.displayName=Se.SubContent.displayName;const wc=ae.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:r=8,...n},o)=>a.jsx(Se.Portal,{children:a.jsx(Se.Content,{ref:o,align:t,alignOffset:s,sideOffset:r,className:Kt("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));wc.displayName=Se.Content.displayName;const Nc=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(Se.Item,{ref:r,className:Kt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));Nc.displayName=Se.Item.displayName;const _c=ae.forwardRef(({className:e,children:t,checked:s,...r},n)=>a.jsxs(Se.CheckboxItem,{ref:n,className:Kt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Se.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));_c.displayName=Se.CheckboxItem.displayName;const Cc=ae.forwardRef(({className:e,children:t,...s},r)=>a.jsxs(Se.RadioItem,{ref:r,className:Kt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Se.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));Cc.displayName=Se.RadioItem.displayName;const kc=ae.forwardRef(({className:e,inset:t,...s},r)=>a.jsx(Se.Label,{ref:r,className:Kt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));kc.displayName=Se.Label.displayName;const Sc=ae.forwardRef(({className:e,...t},s)=>a.jsx(Se.Separator,{ref:s,className:Kt("-mx-1 my-1 h-px bg-muted",e),...t}));Sc.displayName=Se.Separator.displayName;const Tc=({className:e,...t})=>a.jsx("span",{className:Kt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Tc.displayname="MenubarShortcut";const Pc={light:"",dark:".dark"},Dc=ae.createContext(null);function Ec(){const e=ae.useContext(Dc);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Ac=ae.forwardRef(({id:e,className:t,children:s,config:r,...n},o)=>{const i=ae.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return a.jsx(Dc.Provider,{value:{config:r},children:a.jsxs("div",{"data-chart":l,ref:o,className:Kt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...n,children:[a.jsx(Ic,{id:l,config:r}),a.jsx(Te.ResponsiveContainer,{children:s})]})})});Ac.displayName="Chart";const Ic=({id:e,config:t})=>{const s=Object.entries(t).filter(([,e])=>e.theme||e.color);return s.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Pc).map(([a,t])=>`\n${t} [data-chart=${e}] {\n${s.map(([e,t])=>{const s=t.theme?.[a]||t.color;return s?` --color-${e}: ${s};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Mc=Te.Tooltip,Fc=ae.forwardRef(({active:e,payload:t,className:s,indicator:r="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:d,formatter:c,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=Ec(),f=ae.useMemo(()=>{if(n||!t?.length)return null;const[e]=t,s=zc(x,e,`${p||e?.dataKey||e?.name||"value"}`),r=p||"string"!=typeof i?s?.label:x[i]?.label||i;return l?a.jsx("div",{className:Kt("font-medium",d),children:l(r,t)}):r?a.jsx("div",{className:Kt("font-medium",d),children:r}):null},[i,l,t,n,d,x,p]);if(!e||!t?.length)return null;const g=1===t.length&&"dot"!==r;return a.jsxs("div",{ref:h,className:Kt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",s),children:[g?null:f,a.jsx("div",{className:"grid gap-1.5",children:t.map((e,t)=>{const s=`${m||e.name||e.dataKey||"value"}`,n=zc(x,e,s),i=u||e.payload?.fill||e.color;return a.jsx("div",{className:Kt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===r&&"items-center"),children:c&&void 0!==e?.value&&e.name?c(e.value,e.name,e,t,e.payload):a.jsxs(a.Fragment,{children:[n?.icon?a.jsx(n.icon,{}):!o&&a.jsx("div",{className:Kt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===r,"w-1":"line"===r,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===r,"my-0.5":g&&"dashed"===r}),style:{"--color-bg":i,"--color-border":i}}),a.jsxs("div",{className:Kt("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,a.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||t)})})]})});Fc.displayName="ChartTooltip";const Rc=Te.Legend,Lc=ae.forwardRef(({className:e,hideIcon:t=!1,payload:s,verticalAlign:r="bottom",nameKey:n},o)=>{const{config:i}=Ec();return s?.length?a.jsx("div",{ref:o,className:Kt("flex items-center justify-center gap-4","top"===r?"pb-3":"pt-3",e),children:s.map(e=>{const s=`${n||e.dataKey||"value"}`,r=zc(i,e,s);return a.jsxs("div",{className:Kt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[r?.icon&&!t?a.jsx(r.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null});function zc(e,a,t){if("object"!=typeof a||null===a)return;const s="payload"in a&&"object"==typeof a.payload&&null!==a.payload?a.payload:void 0;let r=t;return t in a&&"string"==typeof a[t]?r=a[t]:s&&t in s&&"string"==typeof s[t]&&(r=s[t]),r in e?e[r]:e[t]}Lc.displayName="ChartLegend";const Uc=({onClick:e,isActive:t,disabled:s,children:r,title:n})=>a.jsx("button",{type:"button",onClick:e,disabled:s,title:n,className:Kt("p-1.5 rounded hover:bg-muted transition-colors",t?"bg-muted text-primary":"text-muted-foreground",s&&"opacity-50 cursor-not-allowed"),children:r}),Oc=()=>a.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Vc({image:e,title:t,className:s}){return a.jsx("div",{className:Kt("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",s),children:e?a.jsx("img",{src:e,alt:t,className:"w-full h-full object-cover"}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx(d.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function Bc({steps:e,currentStepIndex:t,onStepSelect:s,stepLabel:r,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(t+1)/i*100;return a.jsxs("div",{className:Kt("flex items-center gap-3",n),children:[a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsxs(Xt,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[r," ",t+1,"/",i,a.jsx(d.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),a.jsx(hr,{align:"start",children:e.map((e,r)=>a.jsxs(xr,{onClick:()=>s(r),className:Kt(r===t&&"bg-accent"),children:[r+1,". ",e.title]},e.id))})]}),a.jsx(Nd,{value:l,className:"w-32 h-2"})]})}function qc({currentStepIndex:e,totalSteps:t,onBack:s,onNext:r,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:c}){const{t:u}=y.useTranslation(),m=0===e,p=e===t-1;return a.jsxs("div",{className:Kt("flex items-center gap-2",c),children:[!m&&a.jsxs(Xt,{variant:"outline",onClick:s,size:"sm",children:[a.jsx(d.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),a.jsxs(Xt,{onClick:p?n:r,size:"sm",children:[p?l:i,!p&&a.jsx(d.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const $c=ae.forwardRef(({open:t,onOpenChange:s,steps:r,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:c="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[v,b]=ae.useState(0),y=void 0!==h,j=y?h:v,w=ae.useCallback(e=>{y?x?.(e):b(e),o?.(e)},[y,x,o]);ae.useEffect(()=>{t||y||b(0)},[t,y]);const N=r[j],_=r.length;return N?a.jsx(ys,{open:t,onOpenChange:s,children:a.jsxs(ks,{ref:g,size:m,variant:"informative",className:Kt("p-0 gap-0 overflow-hidden",f),children:[a.jsxs(Ns,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Fechar"})]}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx(Vc,{image:N.image,title:N.title}),a.jsx(Ds,{className:"text-xl font-semibold",children:N.title}),a.jsx(Es,{className:"text-muted-foreground",children:N.description})]})}),a.jsxs("div",{className:"flex-shrink-0",children:[a.jsx(ls,{}),a.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?a.jsx(Bc,{steps:r,currentStepIndex:j,onStepSelect:e=>{w(e)},stepLabel:u}):a.jsx("div",{}),a.jsx(qc,{currentStepIndex:j,totalSteps:_,onBack:()=>{j>0&&w(j-1)},onNext:()=>{j<_-1&&w(j+1)},onComplete:()=>{n?.(),s(!1)},backButtonText:l,continueButtonText:i,finishButtonText:c})]})]})]})}):null});function Wc({label:e,onClick:t,icon:s,actions:r=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:c="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(r.length>0))return a.jsxs(Xt,{variant:n,size:o,disabled:p,onClick:t,className:u,children:[l?a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):s?a.jsx(s,{className:"mr-2 h-4 w-4"}):null,e]});return a.jsxs("div",{className:Kt("inline-flex rounded-md shadow-sm",u),children:[a.jsxs(Xt,{variant:n,size:o,disabled:p,onClick:t,className:"rounded-r-none border-r-0 focus:z-10",children:[l?a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):s?a.jsx(s,{className:"mr-2 h-4 w-4"}):null,e]}),a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:n,size:o,disabled:p,className:Kt("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:a.jsx(d.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),a.jsx(hr,{align:c,className:"min-w-[160px]",children:r.map(e=>{const t=e.icon;return a.jsxs(xr,{onClick:e.onClick,disabled:e.disabled,className:Kt("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[t&&a.jsx(t,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}var Hc;$c.displayName="OnboardingDialog",exports.ExportFormat=void 0,(Hc=exports.ExportFormat||(exports.ExportFormat={})).CSV="csv",Hc.PDF="pdf",Hc.XLSX="xlsx",Hc.PNG="png",Hc.JPEG="jpeg",Hc.SVG="svg";const Gc=[{value:exports.ExportFormat.CSV,label:"CSV",icon:a.jsx(d.FileText,{className:"h-5 w-5"})},{value:exports.ExportFormat.PDF,label:"PDF",icon:a.jsx(d.FileText,{className:"h-5 w-5"})},{value:exports.ExportFormat.XLSX,label:"XLSX",icon:a.jsx(d.FileSpreadsheet,{className:"h-5 w-5"})}],Kc=[{value:exports.ExportFormat.PNG,label:"PNG",icon:a.jsx(d.Image,{className:"h-5 w-5"})},{value:exports.ExportFormat.JPEG,label:"JPEG",icon:a.jsx(d.FileImage,{className:"h-5 w-5"})},{value:exports.ExportFormat.SVG,label:"SVG",icon:a.jsx(d.FileImage,{className:"h-5 w-5"})},{value:exports.ExportFormat.PDF,label:"PDF",icon:a.jsx(d.FileText,{className:"h-5 w-5"})}];const Yc=t.forwardRef(({value:e,onChange:s,onTimeChange:r,label:n,error:o,format:i="24h",className:l,id:c,...u},m)=>{const p=c??ae.useId(),h=t.useCallback(e=>{const a=e.target.value;s?.(a),r?.(a)},[s,r]),x=t.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return a.jsxs("div",{className:Kt("grid gap-1.5",l),children:[n&&a.jsx(as,{htmlFor:p,children:n}),a.jsxs("div",{className:"relative",children:[a.jsx(Zt,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:Kt("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),a.jsx(d.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&a.jsx("p",{className:"text-sm text-destructive",children:o})]})});function Qc({currentStep:e,totalSteps:t,onStepChange:s,stepLabels:r,canGoToStep:n,className:o,progressWidth:i="w-32"}){ae.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:t},(e,a)=>a+1),c=a=>!(a<=e)&&(!!n&&!n(a));return a.jsxs("div",{className:Kt("flex items-center gap-3",o),children:[a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsxs(Xt,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",t,a.jsx(d.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),a.jsx(hr,{align:"start",children:l.map(t=>a.jsxs(xr,{onClick:()=>{var a;(a=t)<e?s(a):n&&!n(a)||s(a)},disabled:c(t),className:Kt("cursor-pointer",t===e&&"bg-muted font-medium",c(t)&&"opacity-50 cursor-not-allowed"),children:[a.jsxs("span",{className:"mr-2 text-muted-foreground",children:[t,"."]}),r?.[t-1]||`Etapa ${t}`,t===e&&a.jsx(d.Check,{className:"h-4 w-4 ml-auto"})]},t))})]}),a.jsx(Nd,{value:e/t*100,className:Kt("h-2",i)})]})}function Xc(e){const a=tn.getAccessToken(),t={"Content-Type":"application/json",...a?{Authorization:`Bearer ${a}`}:{},"un-alias":e};if(a)try{const e=JSON.parse(atob(a.split(".")[1]));e.sub&&(t["x-waf-rate"]=btoa(e.sub))}catch{}return t}async function Jc(e,a,t){let s=await fetch(e,a);if(401===s.status){if(await xn.handleApiError({status:401})){const r={...a,headers:Xc(t)};s=await fetch(e,r)}}return s}function Zc(e){const[a,s]=t.useState([]),[r,n]=t.useState(0),[o,i]=t.useState(!1);t.useEffect(()=>{if(!e)return;let a=!1;const t=`${Oe().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const r=Xc(e),o=await Jc(t,{method:"GET",headers:r},e);if(!o.ok)return;const i=await o.json();!a&&i.data?.[0]&&(s(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(r){}finally{a||i(!1)}}(),()=>{a=!0}},[e]);const l=t.useCallback(async()=>{if(!e||r<=0||0===a.length)return;const t=a[0].id,s=`${Oe().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=Xc(e),r=JSON.stringify({id:t,idUpdateType:3});await Jc(s,{method:"POST",headers:a,body:r},e)}catch(o){}},[e,r,a]);return{updates:a,badgeCount:r,loading:o,markAsVisualized:l}}Yc.displayName="Timepicker";const eu=t.forwardRef(({updates:t,badgeCount:s,onOpen:r,onViewAll:n},o)=>{const i=void 0===t,l=In(),c=l?.alias??null,u=Zc(i?c:null),m=i?u.updates??[]:t,p=i?u.badgeCount??0:s??0,h=r??(i?u.markAsVisualized:void 0),x=n??(i&&c?()=>{const e=`https://apps4.qualiex.com/common/${c}/up/view`;window.open(e,"_blank","noopener,noreferrer")}:void 0);return a.jsxs(kr,{children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:h,title:e.t("updates"),children:[a.jsx(d.Coffee,{className:"h-7 w-7"}),p>0&&a.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:p>99?"99+":p})]})}),a.jsxs(Tr,{align:"end",className:"w-80 p-0",children:[a.jsx("div",{className:"border-b border-border px-4 py-3",children:a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),a.jsx("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?a.jsx("ul",{className:"divide-y divide-border",children:m.map(e=>a.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:x,children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[a.jsx(d.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),a.jsx("div",{className:"border-t border-border px-4 py-2",children:a.jsxs(Xt,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:x,children:["Ver todas as atualizações",a.jsx(d.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});var au,tu;eu.displayName="UpdatesNotification",exports.FileViewerType=void 0,(au=exports.FileViewerType||(exports.FileViewerType={}))[au.none=0]="none",au[au.image=1]="image",au[au.video=2]="video",au[au.audio=3]="audio",au[au.wopi=4]="wopi",au[au.onlineEditor=5]="onlineEditor",au[au.report=6]="report",exports.FilePrintType=void 0,(tu=exports.FilePrintType||(exports.FilePrintType={}))[tu.SimplePrint=0]="SimplePrint",tu[tu.ManagedCopy=1]="ManagedCopy",tu[tu.NonManagedCopy=2]="NonManagedCopy";const su={".jpg":exports.FileViewerType.image,".jpeg":exports.FileViewerType.image,".png":exports.FileViewerType.image,".bmp":exports.FileViewerType.image,".gif":exports.FileViewerType.image,".svg":exports.FileViewerType.image,".webp":exports.FileViewerType.image,".wav":exports.FileViewerType.audio,".mp3":exports.FileViewerType.audio,".mp4":exports.FileViewerType.video,".webm":exports.FileViewerType.video,".ogg":exports.FileViewerType.video,".pdf":exports.FileViewerType.wopi,".ods":exports.FileViewerType.wopi,".xls":exports.FileViewerType.wopi,".xlsb":exports.FileViewerType.wopi,".xlsm":exports.FileViewerType.wopi,".xlsx":exports.FileViewerType.wopi,".doc":exports.FileViewerType.wopi,".docm":exports.FileViewerType.wopi,".docx":exports.FileViewerType.wopi,".dot":exports.FileViewerType.wopi,".dotm":exports.FileViewerType.wopi,".dotx":exports.FileViewerType.wopi,".odt":exports.FileViewerType.wopi,".odp":exports.FileViewerType.wopi,".pot":exports.FileViewerType.wopi,".potm":exports.FileViewerType.wopi,".potx":exports.FileViewerType.wopi,".pps":exports.FileViewerType.wopi,".ppsm":exports.FileViewerType.wopi,".ppsx":exports.FileViewerType.wopi,".ppt":exports.FileViewerType.wopi,".pptm":exports.FileViewerType.wopi,".pptx":exports.FileViewerType.wopi,".gdocs":exports.FileViewerType.onlineEditor,".gsheets":exports.FileViewerType.onlineEditor};function ru(e){const{t:a}=y.useTranslation();return e?su[e.toLowerCase()]??exports.FileViewerType.none:exports.FileViewerType.none}const nu={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function ou(e){const{t:a}=y.useTranslation();return nu[e?.toLowerCase()]||""}function iu(e){const{t:a}=y.useTranslation(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function lu({open:e,onOpenChange:s,url:r,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),c=t.useCallback(()=>{s(!1)},[s]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&c()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,c]),a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:Kt("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[a.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&a.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(_r,{children:"Fechar"})]})]}),a.jsx("iframe",{src:r,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function du({term:s,open:r,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:c=e.t("terms_read_agree")}){const u=t.useMemo(()=>s.file?function(e,a=""){const{t:t}=y.useTranslation(),s=atob(e),r=[];for(let o=0;o<s.length;o+=512){const e=s.slice(o,o+512),a=new Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t);r.push(new Uint8Array(a))}const n=new Blob(r,{type:a});return URL.createObjectURL(n)}(s.file,s.type):null,[s.file,s.type]),m=t.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=t.useCallback(()=>{s.hasUserSignature?m():o?.(s.id)},[s,o,m]),h=!i&&!s.hasUserSignature&&o;return a.jsx(ys,{open:r,onOpenChange:e=>!e&&m(),children:a.jsxs(ks,{className:Kt("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[a.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[a.jsx(d.FileText,{className:"h-5 w-5 text-primary"}),l]}),a.jsxs("div",{className:"flex items-center gap-2",children:[h&&a.jsx(Xt,{size:"sm",onClick:p,children:c}),a.jsx(Xt,{variant:"ghost",size:"icon",onClick:m,children:a.jsx(d.X,{className:"h-4 w-4"})})]})]}),a.jsx("div",{className:"flex-1 min-h-0",children:s.file&&u?a.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function cu(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function uu(e){const{t:a}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function mu(e){const{t:a}=y.useTranslation(),t=new Set;if(!e)return t;for(const s of e)s.allowedIds?.forEach(e=>t.add(e)),s.inheritedIds?.forEach(e=>t.add(e));return t}var pu;exports.ReportRequestStatus=void 0,(pu=exports.ReportRequestStatus||(exports.ReportRequestStatus={}))[pu.WaitingProcessing=1]="WaitingProcessing",pu[pu.Processing=2]="Processing",pu[pu.Completed=3]="Completed",pu[pu.Error=4]="Error",pu[pu.Expired=5]="Expired";const hu={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function xu(e){const{t:a}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function fu(e){const{t:a}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const gu={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};function vu({label:e,color:t,icon:s,showIcon:r,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const d=gu[n],c=r??!!s;return a.jsxs("span",{className:Kt("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",d.badge,l),style:(()=>{switch(o){case"outline":return{color:t,borderColor:$t(t,.3),backgroundColor:"transparent"};case"ghost":return{color:t,backgroundColor:"transparent"};default:return{color:t,backgroundColor:i||$t(t,.1)}}})(),children:[c&&s&&a.jsx(s,{size:d.icon,strokeWidth:2}),e]})}var bu,yu,ju,wu,Nu,_u,Cu,ku,Su,Tu,Pu,Du,Eu,Au,Iu,Mu,Fu,Ru,Lu,zu,Uu,Ou,Vu,Bu,qu;exports.AggregationType=void 0,(bu=exports.AggregationType||(exports.AggregationType={})).Count="valuecount",bu.Sum="sum",bu.Average="average",bu.DistinctCount="valuecount_distict",bu.Max="max",bu.Min="min",exports.AnalysisFunctionality=void 0,(exports.AnalysisFunctionality||(exports.AnalysisFunctionality={})).ViewAllAnalysis="nes3j6wn",exports.DashboardFunctionality=void 0,(yu=exports.DashboardFunctionality||(exports.DashboardFunctionality={})).RegisterDashboards="EeKs7CYA",yu.RemoveDashboards="3GKZYOQ9",yu.ViewAllDashboards="wYBdQNvZ",yu.EditDashboards="bMFcbwv4",exports.DashboardListType=void 0,(ju=exports.DashboardListType||(exports.DashboardListType={}))[ju.Default=1]="Default",ju[ju.Compact=2]="Compact",exports.DashboardPageTime=void 0,(wu=exports.DashboardPageTime||(exports.DashboardPageTime={}))[wu.FiveSeconds=1]="FiveSeconds",wu[wu.TenSeconds=2]="TenSeconds",wu[wu.FifteenSeconds=3]="FifteenSeconds",wu[wu.ThirtySeconds=4]="ThirtySeconds",wu[wu.OneMinute=5]="OneMinute",wu[wu.ThreeMinutes=6]="ThreeMinutes",wu[wu.FiveMinutes=7]="FiveMinutes",wu[wu.TenMinutes=8]="TenMinutes",exports.DashboardPanelDimension=void 0,(Nu=exports.DashboardPanelDimension||(exports.DashboardPanelDimension={}))[Nu.Day=1]="Day",Nu[Nu.Month=2]="Month",Nu[Nu.Year=3]="Year",exports.DashboardPanelOrderByType=void 0,(_u=exports.DashboardPanelOrderByType||(exports.DashboardPanelOrderByType={}))[_u.Ascending=1]="Ascending",_u[_u.Descending=2]="Descending",exports.DashboardPanelOrderBy=void 0,(Cu=exports.DashboardPanelOrderBy||(exports.DashboardPanelOrderBy={}))[Cu.Label=1]="Label",Cu[Cu.Value=2]="Value",exports.DashboardPanelPeriod=void 0,(ku=exports.DashboardPanelPeriod||(exports.DashboardPanelPeriod={}))[ku.LastSevenDays=1]="LastSevenDays",ku[ku.LastWeek=2]="LastWeek",ku[ku.LastMonth=3]="LastMonth",ku[ku.PreviousQuarter=4]="PreviousQuarter",ku[ku.PreviousSemester=5]="PreviousSemester",ku[ku.LastYear=6]="LastYear",ku[ku.SpecificPeriod=7]="SpecificPeriod",ku[ku.CurrentMonth=8]="CurrentMonth",ku[ku.CurrentSemester=9]="CurrentSemester",ku[ku.CurrentWeek=10]="CurrentWeek",ku[ku.CurrentYear=11]="CurrentYear",exports.DashboardPanelType=void 0,(Su=exports.DashboardPanelType||(exports.DashboardPanelType={}))[Su.Text=1]="Text",Su[Su.Area=2]="Area",Su[Su.Bar=3]="Bar",Su[Su.Column=4]="Column",Su[Su.StackedColumn=5]="StackedColumn",Su[Su.Line=6]="Line",Su[Su.List=7]="List",Su[Su.Numeric=8]="Numeric",Su[Su.Pareto=9]="Pareto",Su[Su.Pie=10]="Pie",Su[Su.RiskMatrix=11]="RiskMatrix",Su[Su.Burndown=12]="Burndown",Su[Su.PerformanceColumns=13]="PerformanceColumns",Su[Su.EvolutionLine=14]="EvolutionLine",exports.DashboardUpdateTime=void 0,(Tu=exports.DashboardUpdateTime||(exports.DashboardUpdateTime={}))[Tu.NotUpdate=1]="NotUpdate",Tu[Tu.FiveMinutes=2]="FiveMinutes",Tu[Tu.TenMinutes=3]="TenMinutes",Tu[Tu.FifteenMinutes=4]="FifteenMinutes",Tu[Tu.ThirtyMinutes=5]="ThirtyMinutes",Tu[Tu.OneHour=6]="OneHour",exports.DashboardViewType=void 0,(Pu=exports.DashboardViewType||(exports.DashboardViewType={}))[Pu.NormalPage=1]="NormalPage",Pu[Pu.Carousel=2]="Carousel",exports.DashboardFormTab=void 0,(Du=exports.DashboardFormTab||(exports.DashboardFormTab={}))[Du.General=0]="General",Du[Du.Share=1]="Share",exports.DashboardShareType=void 0,(Eu=exports.DashboardShareType||(exports.DashboardShareType={}))[Eu.NotShared=1]="NotShared",Eu[Eu.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Eu[Eu.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",exports.DashboardLanguage=void 0,(Au=exports.DashboardLanguage||(exports.DashboardLanguage={})).PtBr="pt-br",Au.EnUs="en",Au.EsEs="es",exports.MatrixViewType=void 0,(Iu=exports.MatrixViewType||(exports.MatrixViewType={}))[Iu.Quantity=0]="Quantity",Iu[Iu.AllRisksList=1]="AllRisksList",exports.PanelItemsPerPanel=void 0,(Mu=exports.PanelItemsPerPanel||(exports.PanelItemsPerPanel={}))[Mu.Five=5]="Five",Mu[Mu.Ten=10]="Ten",Mu[Mu.Fifteen=15]="Fifteen",Mu[Mu.Twenty=20]="Twenty",Mu[Mu.All=0]="All",Mu[Mu.Custom=-1]="Custom",exports.PanelSortType=void 0,(Fu=exports.PanelSortType||(exports.PanelSortType={}))[Fu.AlphabeticalAsc=1]="AlphabeticalAsc",Fu[Fu.AlphabeticalDesc=2]="AlphabeticalDesc",Fu[Fu.CountAsc=3]="CountAsc",Fu[Fu.CountDesc=4]="CountDesc",Fu[Fu.DateAsc=5]="DateAsc",Fu[Fu.DateDesc=6]="DateDesc",exports.PanelState=void 0,(Ru=exports.PanelState||(exports.PanelState={}))[Ru.Loading=0]="Loading",Ru[Ru.Loaded=1]="Loaded",Ru[Ru.Error=3]="Error",Ru[Ru.NoData=4]="NoData",Ru[Ru.Unavailable=5]="Unavailable",exports.VisualizationType=void 0,(Lu=exports.VisualizationType||(exports.VisualizationType={}))[Lu.Quantity=1]="Quantity",Lu[Lu.Percentage=2]="Percentage",Lu[Lu.QuantityPercentage=3]="QuantityPercentage",exports.PlanType=void 0,(zu=exports.PlanType||(exports.PlanType={}))[zu.Program=1]="Program",zu[zu.Project=2]="Project",zu[zu.Action=3]="Action",zu[zu.PerformanceProject=4]="PerformanceProject",zu[zu.PerformanceAction=5]="PerformanceAction",exports.QueriesContextType=void 0,(Uu=exports.QueriesContextType||(exports.QueriesContextType={})).OccurrenceActionPlans="xebGnSSq",Uu.OccurrenceGeneral="UFws4AvH",Uu.PlansActionPlans="Kux6CcVC",Uu.PlansProgramProjects="UWjrp6Dw",Uu.PlansIdeas="3g7vNm2w",Uu.RisksGeneral="PZ4b6FhP",Uu.RisksActionPlans="xZErDg57",Uu.RisksAnalysis="UxsioMbH",Uu.RisksIncidences="gNt5IJ2F",Uu.MetrologyGeneral="4MfEPbRY",Uu.MetrologyActivities="hdFM9XQW",Uu.MetrologyServiceOrders="cIrVPdMv",Uu.DecisionsGeneral="CopsnHDB",Uu.DecisionsItems="qLFAayjx",Uu.DecisionsActionPlans="RiQFpxdb",Uu.FlowGeneral="AFV98JoG",Uu.AuditGeneral="gON8LJPi",Uu.AuditPlans="SsCNVOvr",Uu.AuditPlansItems="OpPkCCFm",Uu.AuditActionPlans="P1oGePhh",Uu.CommonGeneral="VVfEzgMQ",Uu.ActionPlans="C6Z4MgGa",Uu.SuppliersEvaluations="fSCeS4mH",Uu.SuppliersGeneral="8qPThkrD",Uu.SuppliersEvaluationsCriteria="RiSIStdY",Uu.SuppliersDocuments="Riua4jMa",Uu.SuppliersMaterialsServices="UpEkatXH",Uu.DocumentsGeneral="FRhhEX2J",Uu.DocumentsPhysicalCopies="PZLtJ23h",Uu.DocumentsObsolete="XDjbga14",Uu.FmeaGeneral="aPwf4uPr",Uu.FmeaActionPlans="vQ8PMrVX",exports.QueriesShareType=void 0,(Ou=exports.QueriesShareType||(exports.QueriesShareType={}))[Ou.NotShared=1]="NotShared",Ou[Ou.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Ou[Ou.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",exports.QuickFilterDashboard=void 0,(Vu=exports.QuickFilterDashboard||(exports.QuickFilterDashboard={}))[Vu.All=1]="All",Vu[Vu.OnlyMine=2]="OnlyMine",Vu[Vu.Favorites=3]="Favorites",exports.RiskCriticality=void 0,(Bu=exports.RiskCriticality||(exports.RiskCriticality={}))[Bu.Current=1]="Current",Bu[Bu.Inherent=2]="Inherent",exports.PaletteType=void 0,(qu=exports.PaletteType||(exports.PaletteType={}))[qu.Default=1]="Default",qu[qu.Pastel=2]="Pastel",qu[qu.Vibrant=3]="Vibrant",qu[qu.Earth=4]="Earth",qu[qu.Ocean=5]="Ocean",qu[qu.Floral=6]="Floral",qu[qu.Night=7]="Night",qu[qu.Winter=8]="Winter",qu[qu.Spring=9]="Spring",qu[qu.Summer=10]="Summer",qu[qu.Fall=11]="Fall",qu[qu.Gray=12]="Gray",qu[qu.Brown=13]="Brown",qu[qu.Blue=14]="Blue",qu[qu.Yellow=15]="Yellow",qu[qu.Green=16]="Green",qu[qu.Purple=17]="Purple",qu[qu.Orange=18]="Orange",qu[qu.Pink=19]="Pink",qu[qu.Red=20]="Red";const $u={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Wu=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],Hu=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function Gu(e){if(!e)return 0;const[a,t]=e.split("/"),s=$u[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+s}function Ku(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function Yu(e){for(const a of Hu)if(e[a])return e[a];return null}function Qu(e){const a=[];for(const t of Object.keys(e)){const s=e[t];null!=s&&(s instanceof Date?a.push(`${t}=${s.toISOString()}`):Array.isArray(s)?s.forEach(e=>{a.push(...Qu({[t]:e}))}):"string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s||a.push(`${t}=${s}`))}return a}const Xu=/^-?\d+(,\d{3})*(\.\d+)?$/;const Ju=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const Zu=new Set([exports.DashboardPanelType.Text]),em=new Set([exports.DashboardPanelType.Text,exports.DashboardPanelType.Numeric,exports.DashboardPanelType.RiskMatrix,exports.DashboardPanelType.Burndown,exports.DashboardPanelType.PerformanceColumns]),am=new Set([exports.DashboardPanelType.Text,exports.DashboardPanelType.RiskMatrix,exports.DashboardPanelType.Burndown,exports.DashboardPanelType.PerformanceColumns]);function tm({config:e,viewOnly:s=!1,complement:r,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:c,className:u}){const{t:m}=y.useTranslation(),[p,h]=t.useState(e.onlyMine??!1),x=Zu.has(e.typeId),f=!em.has(e.typeId),g=!am.has(e.typeId),v=t.useMemo(()=>{if(!e.jsonRules||e.typeId===exports.DashboardPanelType.PerformanceColumns)return!1;try{const a=JSON.parse(e.jsonRules);return a?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),b=t.useMemo(()=>o?.(e)??"#",[o,e]),j=t.useCallback(()=>{const e=!p;h(e),c?.(e)},[p,c]),w=[];return p&&w.push(m("dashboard_only_mine")),e.onlyLate&&w.push(m("dashboard_only_overdue")),v&&w.push(m("dashboard_advanced_filter")),a.jsxs("div",{className:Kt("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&r,a.jsxs("div",{className:"flex min-w-0 flex-col",children:[a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:e.title})}),a.jsx(_r,{children:e.title})]}),w.length>0&&a.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:w.join(" | ")})]}),"after-title"===n&&r]}),!s&&a.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&r,a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a.jsx(d.MoreVertical,{className:"h-3.5 w-3.5"})})}),a.jsxs(hr,{align:"end",className:"w-48",children:[e.canUpdate&&a.jsxs(xr,{onClick:()=>e.onEdit?.(e.id),children:[a.jsx(d.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&a.jsxs(xr,{onClick:i,children:[a.jsx(d.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&a.jsxs(xr,{disabled:e.noData,onClick:l,children:[a.jsx(d.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&a.jsxs(xr,{disabled:!e.openQueryEnabled,onClick:()=>window.open(b,"_blank"),children:[a.jsx(d.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&a.jsxs(a.Fragment,{children:[a.jsx(br,{}),a.jsxs(xr,{onClick:j,children:[p&&a.jsx(d.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&a.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&a.jsxs(a.Fragment,{children:[a.jsx(br,{}),a.jsxs(xr,{onClick:()=>e.onDuplicate?.(e.id),children:[a.jsx(d.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),a.jsxs(xr,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a.jsx(d.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&r]})]})}function sm({config:e,queryUrl:t,className:s}){return a.jsxs("div",{className:Kt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",s),children:[a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),a.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),a.jsxs("p",{className:"mt-2 text-xs",children:[t&&a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),t&&e.canUpdate&&a.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&a.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function rm({panelType:e,className:t}){const s=e===exports.DashboardPanelType.Burndown;return a.jsxs("div",{className:Kt("flex flex-1 flex-col items-center justify-center gap-2 p-4",t),children:[a.jsx(sr,{className:"h-10 w-10 text-muted-foreground/40"}),s&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function nm({hasRemovedColumn:t=!1,className:s}){return a.jsxs("div",{className:Kt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",s),children:[a.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),a.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function om({onRemove:e,className:t}){return a.jsxs("div",{className:Kt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",t),children:[a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),a.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&a.jsx("p",{className:"mt-2 text-xs",children:a.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const im={[exports.AggregationType.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[exports.AggregationType.Sum]:"Sum",[exports.AggregationType.Average]:e.t("dashboard_average"),[exports.AggregationType.DistinctCount]:e.t("dashboard_distinct_count"),[exports.AggregationType.Max]:e.t("dashboard_max_value"),[exports.AggregationType.Min]:e.t("dashboard_min_value")};function lm({config:e,state:t,value:s,label:r,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:d,className:c}){const{t:u}=y.useTranslation(),m=r??im[e.aggregationType??""]??"",p=function(e,a){if(null==e)return"—";const t=Wu.includes(a.field),s=a.aggregationType===exports.AggregationType.Count||a.aggregationType===exports.AggregationType.DistinctCount;return t&&!s?Ju.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?s?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(s,e);return a.jsxs("div",{className:Kt("flex h-full flex-col",c),children:[a.jsx(tm,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:d}),t===exports.PanelState.Loading&&a.jsx(rm,{}),t===exports.PanelState.Loaded&&a.jsxs("div",{className:Kt("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[a.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),t===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:l}),t===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function dm({config:e,state:t,htmlContent:s,viewOnly:r=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const d=s??e.textTypeString??"";return a.jsxs("div",{className:Kt("flex h-full flex-col",l),children:[a.jsx(tm,{config:e,viewOnly:r,onRefresh:n,queryUrlBuilder:i}),t===exports.PanelState.Loading&&a.jsx(rm,{}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:d}}),t===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:o})]})}function cm({config:e,state:s,data:r=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:d,queryUrl:c,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=t.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=t.useCallback(e=>{if(i)i(e);else if(m){const a=Yu(e);a&&window.open(Ku(a),"_blank")}},[i,m]);return a.jsxs("div",{className:Kt("flex h-full flex-col",p),children:[a.jsx(tm,{config:e,viewOnly:o,onRefresh:l,onExport:d,queryUrlBuilder:u}),s===exports.PanelState.Loading&&a.jsx(rm,{}),s===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:a.jsx("tr",{children:h.map(e=>a.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),a.jsx("tbody",{children:r.map((e,t)=>{const s=m&&!!Yu(e);return a.jsx("tr",{className:Kt("border-b border-border/50 transition-colors hover:bg-muted/30",(s||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(t=>a.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:t.render?t.render(e[t.columnName],e):um(e[t.columnName],t)},t.columnName))},t)})})]})}),s===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),s===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:c}),s===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function um(e,a){return null==e?"":e instanceof Date?"datetime"===a.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const mm=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function pm({config:e,variant:s,state:r,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:d,viewOnly:c=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:mm,v=t.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),b="bar"===s,y="stacked-column"===s,j=t.useMemo(()=>{if(d)return e=>d.replace("{value}",e.toLocaleString("pt-BR"))},[d]);return a.jsxs("div",{className:Kt("flex h-full flex-col",f),children:[a.jsx(tm,{config:e,viewOnly:c,onRefresh:m,onExport:p,queryUrlBuilder:x}),r===exports.PanelState.Loading&&a.jsx(rm,{}),r===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:hm({variant:s,data:n,series:v,colors:g,categoryKey:l,isHorizontalBar:b,isStacked:y,yAxisTickFormatter:j,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),r===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),r===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:h}),r===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function hm({variant:e,data:t,series:s,colors:r,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:d,onPointClick:c}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=a.jsx(B.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=a.jsx(B.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=a.jsx(B.Tooltip,{formatter:d,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=s.length>1?a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=c?(e,a)=>c(t[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?a.jsxs(B.BarChart,{data:t,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,s.map((e,t)=>a.jsx(B.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||r[t%r.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:c?"pointer":void 0},e.dataKey))]}):"area"===e?a.jsxs(B.AreaChart,{data:t,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,s.map((e,t)=>{const s=e.color||r[t%r.length];return a.jsx(B.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:s,fill:s,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:c?"pointer":void 0}},e.dataKey)})]}):a.jsxs(B.LineChart,{data:t,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,s.map((e,t)=>a.jsx(B.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||r[t%r.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:c?"pointer":void 0}},e.dataKey))]})}const xm=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function fm({config:e,state:s,data:r=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:d,queryUrl:c,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:xm,h=t.useMemo(()=>r.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[r]),x=t.useMemo(()=>h.reduce((e,a)=>e+(a.value??0),0),[h]);return a.jsxs("div",{className:Kt("flex h-full flex-col",m),children:[a.jsx(tm,{config:e,viewOnly:o,onRefresh:l,onExport:d,queryUrlBuilder:u}),s===exports.PanelState.Loading&&a.jsx(rm,{}),s===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.PieChart,{children:[a.jsx(B.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:a})=>`${e??""}: ${(100*(a??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,a)=>i(r[a],a):void 0,cursor:i?"pointer":void 0,children:h.map((e,t)=>a.jsx(B.Cell,{fill:p[t%p.length]},t))}),a.jsx(B.Tooltip,{formatter:e=>{const a="number"==typeof e?e:0,t=x>0?(a/x*100).toFixed(1):"0";return`${a.toLocaleString("pt-BR")} (${t}%)`}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),s===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),s===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:c}),s===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function gm({config:e,state:s,data:r=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:d,onExport:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=t.useMemo(()=>{const e=[...r].sort((e,a)=>(a.value??0)-(e.value??0)),a=e.reduce((e,a)=>e+(a.value??0),0);let t=0;return e.map(e=>(t+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:a>0?Math.round(t/a*100):0}))},[r]);return a.jsxs("div",{className:Kt("flex h-full flex-col",p),children:[a.jsx(tm,{config:e,viewOnly:i,onRefresh:d,onExport:c,queryUrlBuilder:m}),s===exports.PanelState.Loading&&a.jsx(rm,{}),s===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a.jsx(B.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(B.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a.jsx(B.Tooltip,{formatter:(e,a)=>"% Acumulado"===a?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,a)=>l(r[a],a):void 0,cursor:l?"pointer":void 0}),a.jsx(B.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),s===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),s===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:u}),s===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function vm({config:e,state:t,data:s=[],executedLabel:r,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:d,queryUrl:c,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=r??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return a.jsxs("div",{className:Kt("flex h-full flex-col",m),children:[a.jsx(tm,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:u}),t===exports.PanelState.Loading&&a.jsx(rm,{panelType:exports.DashboardPanelType.Burndown}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.AreaChart,{data:s,margin:{top:5,right:10,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a.jsx(B.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a.jsx(B.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a.jsx(B.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),t===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:c}),t===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function bm({config:e,state:t,data:s=[],executedLabel:r,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:d,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=r??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return a.jsxs("div",{className:Kt("flex h-full flex-col",p),children:[a.jsx(tm,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:m}),t===exports.PanelState.Loading&&a.jsx(rm,{}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.BarChart,{data:s,margin:{top:5,right:10,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a.jsx(B.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a.jsx(B.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:d?(e,a)=>d(s[a],a):void 0,cursor:d?"pointer":void 0}),a.jsx(B.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),t===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:u}),t===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}function ym({config:e,state:s,rule:r,risks:n=[],matrixViewType:o=exports.MatrixViewType.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:d,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=t.useMemo(()=>[...r?.parametersY??[]].sort((e,a)=>a.position-e.position),[r?.parametersY]),x=r?.parametersX??[],f=t.useMemo(()=>{const e={};return n.forEach(a=>{const t=`${a.parameterYPosition}-${a.parameterXPosition}`;e[t]||(e[t]=[]),e[t].push(a)}),e},[n]);return a.jsxs("div",{className:Kt("flex h-full flex-col",p),children:[a.jsx(tm,{config:e,viewOnly:i,onRefresh:c,queryUrlBuilder:m}),s===exports.PanelState.Loading&&a.jsx(rm,{}),s===exports.PanelState.Loaded&&r&&a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:r.name_y})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex mb-1",children:[a.jsx("div",{className:"w-16 shrink-0"}),a.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:r.threat_strategy_type_name}),!r.disable_opportunities&&a.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:r.opportunity_strategy_type_name})]}),h.map((e,t)=>a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((s,n)=>{const i=((e,a)=>f[`${a.position}-${e.position}`]??[])(s,e),c=((e,a)=>r?.colorMatrix?.[a]?.[e]??"hsl(var(--muted))")(n,t);return a.jsxs("div",{className:Kt("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||d)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:c},onClick:()=>i.length>0&&l?.(s,e,i),children:[o===exports.MatrixViewType.Quantity&&i.length>0&&a.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===exports.MatrixViewType.AllRisksList&&i.map(e=>a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:a=>{a.stopPropagation(),d?.(e)},children:e.code})}),a.jsxs(_r,{className:"max-w-[250px]",children:[a.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&a.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",a.jsx("strong",{children:e.analysisDate})]}),e.strategy&&a.jsxs("p",{className:"text-xs",children:["Estratégia: ",a.jsx("strong",{children:e.strategy})]}),e.resultName&&a.jsxs("p",{className:"text-xs",children:["Criticidade: ",a.jsx("strong",{style:{backgroundColor:c},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},s.position)})]},e.position)),a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>a.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),a.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:r.name_x})]})]})}),s===exports.PanelState.NoData&&a.jsx(nm,{hasRemovedColumn:e.hasRemovedColumn}),s===exports.PanelState.Error&&a.jsx(sm,{config:e,queryUrl:u}),s===exports.PanelState.Unavailable&&a.jsx(om,{onRemove:()=>e.onRemove?.(e.id)})]})}const jm=Object.freeze({Translate:{toString(e){if(!e)return;const{x:a,y:t}=e;return"translate3d("+(a?Math.round(a):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:a,scaleY:t}=e;return"scaleX("+a+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[jm.Translate.toString(e),jm.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:s}=e;return a+" "+t+"ms "+s}}});function wm(e){switch(Number(e)){case exports.DashboardPanelType.Area:case exports.DashboardPanelType.Bar:case exports.DashboardPanelType.Column:case exports.DashboardPanelType.Line:case exports.DashboardPanelType.Numeric:case exports.DashboardPanelType.Pie:case exports.DashboardPanelType.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Nm({panel:e,columns:s,cellHeight:r,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:d,setNodeRef:c,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=t.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*r+(e.sizeY-1)*n+"px",transform:jm.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,s,r,n,u,m,p]);return a.jsxs("div",{ref:c,style:h,className:Kt("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[a.jsx("div",{className:Kt("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?d:{}}),a.jsx("div",{className:"h-full",children:i})]})}function _m({panels:e,columns:s=8,cellHeight:r=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:d,className:c}){const[u,m]=t.useState(e);t.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=t.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=t.useMemo(()=>u.map(e=>e.id),[u]),f=t.useCallback(e=>{const{active:a,over:t}=e;if(!t||a.id===t.id)return;const s=u.findIndex(e=>e.id===a.id),r=u.findIndex(e=>e.id===t.id);if(-1===s||-1===r)return;const n=[...u],o={...n[s]},i={...n[r]},l=o.col,c=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=c,n[s]=o,n[r]=i,m(n),d?.(n)},[u,d]),g=t.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gridTemplateRows:`repeat(${h}, ${r}px)`,gap:`${n}px`}),[s,h,r,n]);return 0===u.length?a.jsxs("div",{className:Kt("flex flex-col items-center justify-center py-16 text-center",c),children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):a.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:a.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:a.jsx("div",{style:g,className:Kt("relative w-full",i&&"bg-muted/30",c),children:u.map(e=>a.jsx(Nm,{panel:e,columns:s,cellHeight:r,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const Cm={[exports.DashboardPanelType.Bar]:"bar",[exports.DashboardPanelType.Column]:"column",[exports.DashboardPanelType.StackedColumn]:"stacked-column",[exports.DashboardPanelType.Area]:"area",[exports.DashboardPanelType.Line]:"line",[exports.DashboardPanelType.EvolutionLine]:"evolution-line"};function km({config:e,state:t,data:s,numericValue:r,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:d,matrixRule:c,matrixRisks:u,onPanelClick:m}){const p=Cm[e.typeId];if(p)return a.jsx(pm,{config:e,variant:p,state:t,data:o,series:i});switch(e.typeId){case exports.DashboardPanelType.Numeric:return a.jsx(lm,{config:e,state:t,value:r});case exports.DashboardPanelType.Text:return a.jsx(dm,{config:e,state:t});case exports.DashboardPanelType.List:return a.jsx(cm,{config:e,state:t,data:s,columns:n??[]});case exports.DashboardPanelType.Pie:return a.jsx(fm,{config:e,state:t,data:s});case exports.DashboardPanelType.Pareto:return a.jsx(gm,{config:e,state:t,data:s});case exports.DashboardPanelType.Burndown:return a.jsx(vm,{config:e,state:t,data:l});case exports.DashboardPanelType.PerformanceColumns:return a.jsx(bm,{config:e,state:t,data:d});case exports.DashboardPanelType.RiskMatrix:return a.jsx(ym,{config:e,state:t,rule:c,risks:u??[]});default:return a.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function Sm({dashboard:e,panels:s,pages:r,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:d,onRefresh:c,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:v,onLayoutChange:b,onPageChange:j,toolbarActions:w,className:N}){const{t:_}=y.useTranslation(),[C,k]=t.useState(!1),S=e.idViewType===exports.DashboardViewType.Carousel,T=t.useMemo(()=>s,[s,S,n]),P=t.useMemo(()=>T.map(e=>{const a=wm(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[T]),D=t.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:v}),[o,f,g,v]),E=t.useCallback(()=>{C||l||(k(!0),c?.(),setTimeout(()=>k(!1),3e4))},[C,l,c]),A=t.useCallback(e=>{const t=T.find(a=>a.id===e);if(!t)return null;const s=D(t),r=d?.(e)??{state:exports.PanelState.Loaded};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(tm,{config:s,onRefresh:()=>{}}),a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(km,{config:s,...r})})]})},[T,D,d,o,f,g,v]);return a.jsxs("div",{className:Kt("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&a.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[w,c&&a.jsx("button",{onClick:E,disabled:C||l,className:Kt("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&a.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?a.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):a.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&a.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:a.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&a.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:a.jsx("svg",{className:Kt("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&r&&r.length>1&&a.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:r.map(e=>a.jsx("button",{onClick:()=>j?.(e.id),className:Kt("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsxs("button",{onClick:x,className:Kt("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&a.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:a.jsx(_m,{panels:P,allowDragging:o,showGridLines:o,renderPanel:A,onLayoutChange:b})})]})}function Tm(e,a=exports.DashboardLanguage.PtBr){const{t:t}=y.useTranslation();switch(a){case exports.DashboardLanguage.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case exports.DashboardLanguage.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function Pm(e){const{t:a}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Dm=[{value:exports.QuickFilterDashboard.All,label:"Todos"},{value:exports.QuickFilterDashboard.OnlyMine,label:e.t("dashboard_my")},{value:exports.QuickFilterDashboard.Favorites,label:"Favoritos"}];function Em({dashboards:e,limit:s,isLoading:r=!1,language:n=exports.DashboardLanguage.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:d,onEdit:c,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:v,toolbarExtra:b,className:j}){const{t:w}=y.useTranslation(),[N,_]=t.useState(""),[C,k]=t.useState(exports.QuickFilterDashboard.All),[S,T]=t.useState(null),P=t.useCallback(e=>{_(e),g?.(e)},[g]),D=t.useCallback(e=>{k(e),v?.(e)},[v]),E=t.useMemo(()=>{let a=e;if(N){const e=N.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||Tm(a,n).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(C){case exports.QuickFilterDashboard.OnlyMine:break;case exports.QuickFilterDashboard.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,N,C,n]);return a.jsxs("div",{className:Kt("flex flex-col h-full",j),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),s&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",s.countDashboards,"/",s.maxDashboards,")"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"m21 21-4.3-4.3"})]}),a.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>P(e.target.value),className:Kt("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),b,o&&h&&a.jsxs("button",{onClick:h,className:Kt("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),a.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Dm.map(e=>a.jsx("button",{onClick:()=>D(e.value),disabled:r,className:Kt("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),r&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!r&&a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:a.jsxs("tr",{children:[a.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),a.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:a.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),a.jsx("th",{className:"w-12 px-3 py-2"})]})}),a.jsxs("tbody",{children:[0===E.length&&a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),E.map(e=>a.jsxs("tr",{onClick:()=>d?.(e),className:Kt("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:a.jsx("svg",{className:Kt("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),a.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),a.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Tm(e,n)}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),a.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&a.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:Pm(e.lastModified)}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("span",{className:Kt("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),a.jsx("td",{className:"px-3 py-2",children:a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:a=>{a.stopPropagation(),T(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:a.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"5",r:"1"}),a.jsx("circle",{cx:"12",cy:"12",r:"1"}),a.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(null)}),a.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"my-1 border-t border-border"}),a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Am=[{value:exports.DashboardUpdateTime.NotUpdate,label:e.t("dashboard_no_refresh")},{value:exports.DashboardUpdateTime.FiveMinutes,label:"5 minutos"},{value:exports.DashboardUpdateTime.TenMinutes,label:"10 minutos"},{value:exports.DashboardUpdateTime.FifteenMinutes,label:"15 minutos"},{value:exports.DashboardUpdateTime.ThirtyMinutes,label:"30 minutos"},{value:exports.DashboardUpdateTime.OneHour,label:"1 hora"}],Im=[{value:exports.DashboardViewType.NormalPage,label:e.t("dashboard_normal_page")},{value:exports.DashboardViewType.Carousel,label:"Carrossel"}],Mm=[{value:exports.DashboardPageTime.FiveSeconds,label:"5 segundos"},{value:exports.DashboardPageTime.TenSeconds,label:"10 segundos"},{value:exports.DashboardPageTime.FifteenSeconds,label:"15 segundos"},{value:exports.DashboardPageTime.ThirtySeconds,label:"30 segundos"},{value:exports.DashboardPageTime.OneMinute,label:"1 minuto"},{value:exports.DashboardPageTime.ThreeMinutes,label:"3 minutos"},{value:exports.DashboardPageTime.FiveMinutes,label:"5 minutos"},{value:exports.DashboardPageTime.TenMinutes,label:"10 minutos"}],Fm=[{value:exports.DashboardShareType.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:exports.DashboardShareType.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Rm=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Lm({dashboard:e,initialTab:s=exports.DashboardFormTab.General,isSaving:r=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:d=[],onSave:c,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=t.useState(s),[g,v]=t.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[b,j]=t.useState(e?.titlePtBr??""),[w,N]=t.useState(e?.titleEnUs??""),[_,C]=t.useState(e?.titleEsEs??""),[k,S]=t.useState(e?.responsibleId??""),[T,P]=t.useState(e?.isActive??!0),[D,E]=t.useState(e?.idUpdateTime??exports.DashboardUpdateTime.NotUpdate),[A,I]=t.useState(e?.idViewType??exports.DashboardViewType.NormalPage),[M,F]=t.useState(e?.idPageTime??exports.DashboardPageTime.FifteenSeconds),[R,L]=t.useState(e?.idShare??exports.DashboardShareType.NotShared),[z,U]=t.useState(e?.groups??[]),[O,V]=t.useState(e?.places??[]),[B,q]=t.useState(e?.collaborators??[]),$=A===exports.DashboardViewType.Carousel,W=g["pt-br"]||g.en||g.es,H=t.useMemo(()=>!!W&&(!(g["pt-br"]&&!b.trim())&&(!(g.en&&!w.trim())&&!(g.es&&!_.trim()))),[W,g,b,w,_]),G=t.useCallback(e=>{v(a=>({...a,[e]:!a[e]}))},[]),K=t.useCallback(()=>{H&&!r&&c?.({titlePtBr:g["pt-br"]?b:"",titleEnUs:g.en?w:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:T,idUpdateTime:D,idViewType:A,idPageTime:$?M:null,idShare:R,groups:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?z:[],places:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?O:[],collaborators:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?B:[]})},[H,r,c,g,b,w,_,k,T,D,A,M,$,R,z,O,B]);return a.jsxs("div",{className:Kt("flex flex-col h-full bg-background",m),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&a.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),a.jsxs("button",{onClick:K,disabled:!H||r,className:Kt("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[r?a.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),a.jsxs("div",{className:"flex border-b border-border bg-card",children:[a.jsx("button",{onClick:()=>f(exports.DashboardFormTab.General),className:Kt("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===exports.DashboardFormTab.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a.jsx("button",{onClick:()=>f(exports.DashboardFormTab.Share),className:Kt("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===exports.DashboardFormTab.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),a.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===exports.DashboardFormTab.General&&a.jsxs("div",{className:"max-w-2xl space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),a.jsx("div",{className:"flex gap-2",children:Rm.map(e=>a.jsx("button",{onClick:()=>G(e.key),className:Kt("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&a.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),a.jsx("input",{value:b,onChange:e=>j(e.target.value),maxLength:200,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[b.length,"/200"]})]}),g.en&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),a.jsx("input",{value:w,onChange:e=>N(e.target.value),maxLength:200,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[w.length,"/200"]})]}),g.es&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),a.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),a.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[a.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),a.jsx("select",{value:D,onChange:e=>E(Number(e.target.value)),disabled:n,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Am.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),a.jsxs("div",{className:"flex items-center gap-3 h-10",children:[a.jsx("button",{onClick:()=>P(!T),disabled:e?.isGeneralViewUse,className:Kt("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",T?"bg-primary":"bg-muted","disabled:opacity-50"),children:a.jsx("span",{className:Kt("inline-block h-4 w-4 rounded-full bg-white transition-transform",T?"translate-x-6":"translate-x-1")})}),a.jsx("span",{className:"text-sm text-foreground",children:T?"Ativo":"Inativo"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),a.jsx("select",{value:A,onChange:e=>I(Number(e.target.value)),disabled:n||$,className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Im.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),$&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),a.jsx("select",{value:M??"",onChange:e=>F(Number(e.target.value)),className:Kt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Mm.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===exports.DashboardFormTab.Share&&a.jsxs("div",{className:"max-w-2xl space-y-6",children:[a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[a.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 16v-4"}),a.jsx("path",{d:"M12 8h.01"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),a.jsx("div",{className:"space-y-3",children:Fm.map(t=>a.jsxs("label",{className:Kt("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",R===t.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[a.jsx("input",{type:"radio",name:"shareType",value:t.value,checked:R===t.value,onChange:()=>L(t.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:t.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t.description})]})]},t.value))}),R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators&&a.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),a.jsx("select",{multiple:!0,value:z,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);U(a)},className:Kt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",O.length,")"]}),a.jsx("select",{multiple:!0,value:O,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);V(a)},className:Kt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",B.length,")"]}),a.jsx("select",{multiple:!0,value:B,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);q(a)},className:Kt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:d.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function zm(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Um(e,a){return{id:a?.id??zm(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function Om(e,a){if(e.id===a)return{node:e,parent:null};const t=[];for(const s of e.children??[])t.push({node:s,parent:e});for(;t.length;){const e=t.pop();if(e.node.id===a)return{node:e.node,parent:e.parent};for(const a of e.node.children??[])t.push({node:a,parent:e.node})}return null}function Vm(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>Vm(e,a))}:t}function Bm(e,a,t){return Vm(e,e=>e.id===a?t(e):e)}function qm(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function $m(e,a,t){const s=Um(t||"");let r=s.id;const n=Vm(e,t=>{if(t.id!==a)return t;let n=s;if(t.id===e.id){const a=qm(e);n={...n,side:a.left<=a.right?"left":"right"}}else n={...n,side:t.side};return r=n.id,{...t,collapsed:!1,children:[...t.children??[],n]}});return{root:n,newId:r}}function Wm(e,a,t){if(e.id===a)return $m(e,a,t);const s=Om(e,a);if(!s||!s.parent)return{root:e,newId:a};const r=s.parent,n=Um(t||"",{side:s.node.side}),o=n.id,i=Vm(e,e=>{if(e.id!==r.id)return e;const t=(e.children??[]).findIndex(e=>e.id===a),s=[...e.children??[]];return s.splice(t+1,0,n),{...e,children:s}});return{root:i,newId:o}}function Hm(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=Om(e,a);if(!t||!t.parent)return{root:e,nextSelectedId:null};const s=t.parent,r=s.children??[],n=r.findIndex(e=>e.id===a),o=r[n+1]?.id??r[n-1]?.id??s.id,i=Vm(e,e=>e.id!==s.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)});return{root:i,nextSelectedId:o}}function Gm(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const s=Om(e,a);return!!s&&!!Om(s.node,t)}(e,a,t))return e;const s=Om(e,a);if(!s)return e;const r=(()=>{if(t===e.id){const a=qm(e);return{...s.node,side:a.left<=a.right?"left":"right"}}const a=Om(e,t)?.node;return{...s.node,side:a?.side}})(),n=Vm(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return Vm(n,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],r]})}function Km(e,a){return Bm(e,a,e=>({...e,collapsed:!e.collapsed}))}function Ym(e,a){return Vm(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function Qm(e){const{value:a,defaultValue:s,onChange:r,readOnly:n}=e,o=void 0!==a,[i,l]=t.useState(()=>s??a??Um("Mapa Mental",{id:"root"})),d=o?a:i,[c,u]=t.useState(d.id),m=t.useRef([]),p=t.useRef([]),h=t.useCallback((e,a)=>{n||(m.current.push(a),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),r?.(e))},[o,r,n]),x=t.useCallback((e,a)=>{const t=Bm(d,e,e=>({...e,text:a}));h(t,d)},[d,h]),f=t.useCallback((e,a)=>{const t=Bm(d,e,e=>({...e,...a}));h(t,d)},[d,h]),g=t.useCallback((e,a="")=>{const{root:t,newId:s}=$m(d,e,a);return h(t,d),u(s),s},[d,h]),v=t.useCallback((e,a="")=>{const{root:t,newId:s}=Wm(d,e,a);return h(t,d),u(s),s},[d,h]),b=t.useCallback(e=>{const{root:a,nextSelectedId:t}=Hm(d,e);a!==d&&(h(a,d),u(t))},[d,h]),y=t.useCallback((e,a)=>{const t=Gm(d,e,a);t!==d&&h(t,d)},[d,h]),j=t.useCallback(e=>{const a=Om(d,e);if(!a||!a.node.children?.length)return;const t=Km(d,e);h(t,d)},[d,h]),w=t.useCallback(()=>{h(Ym(d,!1),d)},[d,h]),N=t.useCallback(()=>{h(Ym(d,!0),d)},[d,h]),_=t.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(d),o||l(e),r?.(e))},[d,o,r]),C=t.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(d),o||l(e),r?.(e))},[d,o,r]),k=m.current.length>0,S=p.current.length>0,T=t.useMemo(()=>c?Om(d,c)?.node??null:null,[d,c]),P=t.useCallback(e=>{h(e,d)},[d,h]);return{root:d,setRoot:P,selectedId:c,selectedNode:T,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:v,removeNode:b,moveNode:y,toggleNode:j,expandAll:w,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const Xm=180,Jm=80,Zm=16,ep=60;function ap(e){const a=(e.collapsed?[]:e.children??[]).map(ap);if(!a.length)return{node:e,visibleChildren:a,height:44};const t=a.reduce((e,a)=>e+a.height,0)+Zm*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function tp(e,a,t,s,r,n,o){const i=[],l={node:e.node,parent:a,x:t,y:s,width:180,height:44,side:r,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let d=s+22-(e.visibleChildren.reduce((e,a)=>e+a.height,0)+Zm*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===r?t+180+Jm:t-Jm-Xm,s=d+c.height/2-22,l=tp(c,e.node,a,s,r,n+1,o);i.push(l),d+=c.height+Zm}return l}function sp(e){return t.useMemo(()=>function(e){const a=e.collapsed?[]:e.children??[],t=a.filter(e=>"left"!==e.side).map(ap),s=a.filter(e=>"left"===e.side).map(ap),r=t.reduce((e,a)=>e+a.height,0)+Zm*Math.max(0,t.length-1),n=s.reduce((e,a)=>e+a.height,0)+Zm*Math.max(0,s.length-1),o=Math.max(r,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=t.length?Math.max(...t.map(i))+1:0,d=260*(s.length?Math.max(...s.map(i))+1:0),c=220+260*l+d+120,u=o+120,m=ep+d,p=[],h={node:e,parent:null,x:m,y:ep+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=ep+o/2-r/2;for(const v of t){const a=x+v.height/2-22,t=tp(v,e,m+220+Jm,a,"right",1,p);h.visibleChildren.push(t),x+=v.height+Zm}let f=ep+o/2-n/2;for(const v of s){const a=f+v.height/2-22,t=tp(v,e,m-Jm-Xm,a,"left",1,p);h.visibleChildren.push(t),f+=v.height+Zm}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:c,height:u}}(e),[e])}function rp(e,a){const{layout:t,selectedId:s,setSelectedId:r}=a;if(!s)return void r(t.nodes[0]?.node.id??null);const n=t.byId.get(s);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const a=n.visibleChildren.find(a=>a.side===e);return void(a&&r(a.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&r(e.node.id)}else n.parent&&r(n.parent.id);return}if(!n.parent)return;const o=t.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===s),d="up"===e?i[l-1]:i[l+1];d&&r(d.node.id)}const np=({layout:e,selected:t,editing:s,readOnly:r,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:c,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,v=(b=f.icon)?te[b]??null:null;var b;const y=!!f.children?.length,j=ae.useRef(null),[w,N]=ae.useState(f.text);ae.useEffect(()=>{if(s){N(f.text);const e=window.setTimeout(()=>{j.current?.focus(),j.current?.select()},0);return()=>window.clearTimeout(e)}},[s,f.text]);const _=()=>{i(w.trim()||f.text)},C=f.color;return a.jsxs("div",{role:"treeitem","aria-selected":t,"aria-expanded":y?!f.collapsed:void 0,tabIndex:t?0:-1,"data-node-id":f.id,draggable:!r&&!g&&!s,onDragStart:c,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),r||o()},className:Kt("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",t&&!g&&"ring-2 ring-primary ring-offset-1",t&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[v&&a.jsx(v,{className:Kt("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),a.jsx("div",{className:"flex-1 min-w-0",children:s?a.jsx("input",{ref:j,value:w,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:Kt("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?a.jsx("div",{className:"text-sm truncate",children:x(f)}):a.jsx("div",{className:"text-sm truncate",children:f.text||a.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!s&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:Kt("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:a.jsx(d.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),a.jsx(_r,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&a.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:Kt("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?a.jsx(d.Plus,{className:"h-3 w-3"}):"left"===e.side?a.jsx(d.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?a.jsx(d.ChevronRight,{className:"h-3 w-3"}):a.jsx(d.Minus,{className:"h-3 w-3"})})]})},op=({parent:e,child:t})=>{const s=t.x+t.width/2<e.x+e.width/2,r=s?e.x:e.x+e.width,n=e.y+e.height/2,o=s?t.x+t.width:t.x,i=t.y+t.height/2,l=(r+o)/2,d=`M ${r} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return a.jsx("path",{d:d,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},ip=({label:e,icon:t,onClick:s,disabled:r})=>a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"ghost",size:"icon",onClick:s,disabled:r,"aria-label":e,className:"h-8 w-8",children:t})}),a.jsx(_r,{children:e})]}),lp=e=>{const{t:t}=y.useTranslation();return a.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a.jsx(ip,{label:t("mind_map_add_child"),icon:a.jsx(d.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a.jsx(ip,{label:t("mind_map_add_sibling"),icon:a.jsx(d.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a.jsx(ip,{label:t("mind_map_delete_node"),icon:a.jsx(d.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a.jsx(ls,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(ip,{label:t("mind_map_expand_all"),icon:a.jsx(d.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a.jsx(ip,{label:t("mind_map_collapse_all"),icon:a.jsx(d.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a.jsx(ls,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(ip,{label:t("mind_map_zoom_out"),icon:a.jsx(d.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a.jsx(ip,{label:t("mind_map_zoom_in"),icon:a.jsx(d.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a.jsx(ip,{label:t("mind_map_fit_to_screen"),icon:a.jsx(d.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),a.jsx(ls,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(ip,{label:t("mind_map_undo"),icon:a.jsx(d.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a.jsx(ip,{label:t("mind_map_redo"),icon:a.jsx(d.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a.jsx("div",{className:"flex-1"}),a.jsx(ip,{label:t("mind_map_export_json"),icon:a.jsx(d.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),a.jsx(ip,{label:t("mind_map_export_image"),icon:a.jsx(d.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function dp(e){return JSON.stringify(e,null,2)}function cp(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const a=e;if("string"!=typeof a.text)throw new Error('Invalid mind map node: missing "text"');const t=Array.isArray(a.children)?a.children.map(e=>cp(e)):void 0;return Um(a.text,{id:"string"==typeof a.id?a.id:void 0,collapsed:"boolean"==typeof a.collapsed?a.collapsed:void 0,color:"string"==typeof a.color?a.color:void 0,icon:"string"==typeof a.icon?a.icon:void 0,note:"string"==typeof a.note?a.note:void 0,side:"left"===a.side||"right"===a.side?a.side:void 0,children:t})}function up({data:e,columns:s,sortField:r,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:c=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:v=!0,onColumnResize:b,enableColumnReorder:j=!1,onReorderColumns:w,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:T=!1,rowActionsVariant:P="default",hideActionsColumn:D=!1,actionsHeaderContent:E}){const{t:A}=y.useTranslation(),I=u||A("no_items_found",A("no_items_found_empty")),[M,F]=t.useState(()=>T?new Set(e.map(e=>e.id)):new Set),R=void 0!==k,L=R?new Set(k):M,z=t.useCallback(e=>{R&&S?S(e):F(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[R,S]),{columnWidths:U,isDragging:O,activeColumn:V,handleMouseDown:B}=go({columns:s.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:b,enabled:v}),q=So({enabled:j&&!!w,onReorder:w??(()=>{})}),$=t.useMemo(()=>{if(v){const e=s.map(e=>U[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return e.map(e=>e/a*100+"%")}const e=s.reduce((e,a)=>a.width?e:e+(a.weight??1),0);return s.map(a=>{if(a.width)return`${a.width}px`;if(a.minWidth&&!a.weight)return`${a.minWidth}px`;const t=(a.weight??1)/e*100;return a.minWidth?`minmax(${a.minWidth}px, ${t}%)`:`${t}%`})},[s,v,U]);if(c)return a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>a.jsx(Lr,{className:"h-12 w-full"},t))})});if(0===e.length)return a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"text-center text-muted-foreground",children:a.jsx("p",{children:I})})});const W=l&&!D,H=(p?1:0)+(_?1:0)+s.length+(W?1:0);return a.jsx("div",{className:"flex-1 overflow-auto "+(O?"select-none":""),children:a.jsxs(Ln,{className:Kt("table-fixed w-full",m),children:[a.jsx(zn,{className:"sticky top-0 bg-background z-10",children:a.jsxs(Vn,{children:[_&&a.jsx(Bn,{className:"w-[40px]"}),p&&a.jsx(Bn,{className:"w-[40px]",children:a.jsx(Js,{checked:g,onCheckedChange:f,"aria-label":A("select_all","Selecionar todos")})}),s.map((e,t)=>{const s=v&&!1!==e.resizable,i=V===String(e.key),l=j&&!!w,c=l?q.getDragProps(t):{},u=q.dragFromIndex===t,m=q.dragOverIndex===t&&q.dragFromIndex!==t;return a.jsxs(Bn,{className:Kt(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&q.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:$[t]},...c,children:[!1!==e.sortable&&o?a.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),r!==p?null:"asc"===n?a.jsx(d.ArrowUp,{size:14,className:"ml-1"}):a.jsx(d.ArrowDown,{size:14,className:"ml-1"}))]}):a.jsx("span",{className:"font-medium",children:e.header}),s&&a.jsx(Qn,{direction:"horizontal",onMouseDown:a=>B(String(e.key),a),isDragging:i})]},String(e.key));var p}),W&&a.jsx(Bn,{className:"w-[80px] text-right",children:E??A("actions","Ações")})]})}),a.jsx(Un,{children:e.map(e=>{const r=_&&L.has(e.id);return a.jsxs(t.Fragment,{children:[a.jsxs(Vn,{onClick:()=>i?.(e),className:Kt(i?"cursor-pointer":"","relative","inline"===P&&"group"),children:[_&&a.jsx(qn,{className:"w-[40px] px-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":r?A("collapse_row","Recolher linha"):A("expand_row","Expandir linha"),children:r?a.jsx(d.ChevronDown,{size:16,className:"text-muted-foreground"}):a.jsx(d.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&a.jsx(qn,{children:a.jsx(Js,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${A("select_all","Selecionar todos")} ${e.id}`})}),s.map(t=>a.jsx(qn,{className:t.className,children:a.jsx(Yn,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),W&&a.jsx(qn,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===P?a.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),r&&C&&a.jsx(Vn,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qn,{colSpan:H,className:"p-0",children:a.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function mp({onEdit:e,onDelete:s,onToggleStatus:r,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:c="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=t.useMemo(()=>{const a=[];return e&&o&&a.push({key:"edit",icon:d.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),r&&a.push({key:"toggle-status",icon:n?d.PowerOff:d.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:r,variant:"default"}),l.forEach(e=>{!1!==e.show&&a.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),s&&i&&a.push({key:"delete",icon:d.Trash2,label:m("remove","Remover"),onClick:s,variant:"destructive"}),a},[e,s,r,n,o,i,l,m]);return 0===p.length?null:"dropdown"===c?a.jsx(jr,{delayDuration:200,children:a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a.jsx(d.EllipsisVertical,{size:"compact"===u?14:16})})}),a.jsx(hr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?a.jsxs(Cr,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):a.jsxs(xr,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):a.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>a.jsxs(Xt,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&a.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&a.jsx("span",{className:"ml-1",children:e.label})]},e.key))})}function pp({searchValue:e="",onSearchChange:t,customFilters:s=[],onClearFilters:r,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||s.length>0;return a.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[t&&a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>t(e.target.value),className:"pl-9 h-9"})]}),s.map((e,t)=>a.jsx("div",{className:"vertical"===o?"w-full":"",children:e},t)),n&&l&&r&&a.jsxs(Xt,{variant:"ghost",size:"sm",onClick:r,className:"h-9 px-3 whitespace-nowrap",children:[a.jsx(d.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function hp(e,a){const t=new Set;function s(e){if(e)for(const a of e)t.add(a.id),s(a.children)}return function e(t){for(const r of t){if(r.id===a)return s(r.children),!0;if(r.children&&e(r.children))return!0}return!1}(e),t}function xp({children:e,itemId:t,enableDrag:s,onDragStartCell:r,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return a.jsx(qn,{draggable:s,onDragStart:s?e=>r(t,e):void 0,onDragEnd:s?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(t,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(t,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(t,e)},className:l,children:e})}function fp({item:e,level:t,columns:s,nameKey:r,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:c,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:j,dragCount:w}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*t,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),T=g===e.id&&f!==e.id,P=p?.has(e.id)??!1,D={itemId:e.id,enableDrag:x,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:j};return a.jsxs(a.Fragment,{children:[a.jsxs(Vn,{className:Kt(l&&"cursor-pointer",k&&"group",S&&"opacity-40",T&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[a.jsx(xp,{...D,children:a.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&a.jsx(Js,{checked:P,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&a.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?a.jsx("button",{onClick:a=>{a.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?a.jsx(d.ChevronDown,{className:"h-4 w-4"}):a.jsx(d.ChevronRight,{className:"h-4 w-4"})}):a.jsx("div",{className:"w-6 shrink-0"}),n??a.jsx(d.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"truncate",children:String(e[r]??e.id)}),f===e.id&&w&&w>1&&a.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:w})]})}),s.map(s=>{const r=e[s.key],n=s.render?s.render(e,t):null!=r?String(r):"—";return a.jsx(xp,{...D,className:Kt("text-center",s.className),children:s.hoverContent?a.jsxs(Ul,{openDelay:200,children:[a.jsx(Ol,{asChild:!0,children:a.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),a.jsx(Vl,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:s.hoverContent(e)})]}):n},String(s.key))}),c&&a.jsx(xp,{...D,className:"text-right",children:a.jsx("div",{onClick:e=>e.stopPropagation(),className:Kt("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:c(e)})})]}),_&&N&&e.children.map(e=>a.jsx(fp,{item:e,level:t+1,columns:s,nameKey:r,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:c,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:v,onDragEndCell:b,onDragOverCell:y,onDropCell:j,dragCount:w},e.id))]})}function gp({onDrop:t,isDragOver:s,onDragOver:r,onDragLeave:n,label:o}){return a.jsxs("div",{className:Kt("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",s?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:r,onDragEnter:r,onDragLeave:n,onDrop:t,children:[a.jsx(d.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function vp({data:s,columns:r,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:c,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:v,selectedIds:b,onSelectItem:y,onSelectAll:j,isAllSelected:w,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:T=200}){const[P,D]=t.useState(null),[E,A]=t.useState(null),[I,M]=t.useState(!1),[F,R]=t.useState(1),L=t.useRef(null),z=t.useRef([]),U=t.useRef(null),O=t.useMemo(()=>new Set(b??[]),[b]),V=t.useMemo(()=>{if(!P||!s)return new Set;const e=z.current.length>0?z.current:[P],a=function(e,a){const t=new Set;for(const s of a)hp(e,s).forEach(e=>t.add(e));return t}(s,e);return e.forEach(e=>a.add(e)),a},[P,s]),B=t.useRef(V);B.current=V;const q=t.useCallback(()=>{L.current=null,z.current=[],U.current=null,D(null),A(null),M(!1),R(1)},[]),$=t.useCallback((e,a)=>{e.length>1&&C?C(e,a):1===e.length&&_?.(e[0],a)},[_,C]),W=t.useCallback((e,a)=>{const t=O.has(e)&&O.size>1?Array.from(O):[e];L.current=e,z.current=t,U.current=null,D(e),R(t.length),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",e),a.dataTransfer.setData("application/x-tree-ids",JSON.stringify(t))},[O]),H=t.useCallback((e,a)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",B.current.has(e)?A(null):(U.current=e,A(e))},[]),G=t.useCallback((e,a)=>{a.preventDefault(),a.stopPropagation();const t=B.current.has(e)?U.current:e;if(!t)return void q();let s=z.current;if(0===s.length){try{const e=a.dataTransfer.getData("application/x-tree-ids");if(e){const a=JSON.parse(e);Array.isArray(a)&&a.length>0&&(s=a)}}catch{}if(0===s.length){const e=a.dataTransfer.getData("text/plain");e&&(s=[e])}}0===s.length||s.includes(t)||$(s,t),q()},[$,q]),K=t.useCallback(e=>{e.preventDefault(),e.stopPropagation();let a=z.current;if(0===a.length){try{const t=e.dataTransfer.getData("application/x-tree-ids");if(t){const e=JSON.parse(t);Array.isArray(e)&&e.length>0&&(a=e)}}catch{}if(0===a.length){const t=e.dataTransfer.getData("text/plain");t&&(a=[t])}}0!==a.length?($(a,null),q()):q()},[$,q]),Y=t.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",M(!0)},[]),Q=t.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=t.useCallback(e=>{if(!N)return;const a=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),t=a?.dataset?.treeRowId??U.current;t&&G(t,e)},[N,G]);if(x)return a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!s||0===s.length)return a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[a.jsx(d.User,{className:"h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==P;return a.jsxs("div",{className:Kt("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const a=e.relatedTarget;a&&e.currentTarget.contains(a)||(A(null),M(!1))}:void 0,children:[N&&J&&a.jsx(gp,{onDrop:K,isDragOver:I,onDragOver:Y,onDragLeave:()=>M(!1),label:k}),a.jsxs(Ln,{children:[a.jsx(zn,{children:a.jsxs(Vn,{children:[a.jsx(Bn,{className:"text-left",style:{minWidth:T},children:a.jsxs("div",{className:"flex items-center gap-2",children:[v&&a.jsx(Js,{checked:w??!1,onCheckedChange:()=>j?.()}),o]})}),r.map(e=>a.jsx(Bn,{className:Kt("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&a.jsx(Bn,{className:"text-right",style:{width:S},children:p})]})}),a.jsx(Un,{children:s.map(e=>a.jsx(fp,{item:e,level:0,columns:r,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:c,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:v,selectedIds:O,onSelectItem:y,enableRowDrag:N,draggedId:P,dragOverId:E,onDragStartCell:W,onDragEndCell:q,onDragOverCell:H,onDropCell:G,dragCount:F},e.id))})]})]})}function bp(e){const a=N.useNavigate();return{onNew:()=>{const t=e.newPath||`${e.basePath}/new`;a(t)},onEdit:t=>{const s=e.editPath?e.editPath.replace(":id",t.id):`${e.basePath}/${t.id}/edit`;a(s)}}}const yp=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],jp=({open:e,onOpenChange:s,user:r,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:l}=y.useTranslation(),c=t.useRef(null),[u,m]=t.useState(null),[p,h]=t.useState(l.language||"pt-BR"),x=u||n,f=e=>{e||(m(null),h(l.language||"pt-BR")),s(e)};return a.jsx(ys,{open:e,onOpenChange:f,children:a.jsxs(ks,{className:"sm:max-w-md",children:[a.jsx(Ss,{children:a.jsx(Ds,{children:i("edit_profile","Editar Perfil")})}),a.jsxs("div",{className:"space-y-6 py-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"relative flex-shrink-0",children:a.jsxs(ml,{className:"w-24 h-24",children:[x&&a.jsx(pl,{src:x,alt:r.name||""}),a.jsx(hl,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]})}),a.jsxs("div",{className:"space-y-1",children:[r.name&&a.jsx("p",{className:"text-base font-semibold",children:r.name}),r.email&&a.jsx("p",{className:"text-sm text-muted-foreground",children:r.email}),a.jsxs(Xt,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a.jsx(d.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),a.jsx("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const a=e.target.files?.[0];if(!a)return;const t=URL.createObjectURL(a);m(t)}})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:i("language","Idioma")}),a.jsxs(Bs,{value:p,onValueChange:h,children:[a.jsx(Ws,{children:a.jsx($s,{})}),a.jsx(Ks,{children:yp.map(e=>a.jsx(Qs,{value:e.value,children:e.label},e.value))})]})]})]}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:()=>f(!1),children:i("cancel","Cancelar")}),a.jsx(Xt,{onClick:()=>{p!==l.language&&l.changeLanguage(p),s(!1)},children:i("save","Salvar")})]})]})})},wp="true"===(void 0).VITE_SHOW_EDIT_PROFILE,Np=t.memo(({variant:e="card",className:s="",selectedUnit:r,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:c,isAuthenticated:u,logout:m,switchUnit:p}=In(),{role:h}=Xi(),x=h?.name||null,f=l?.[0]||null,g=c?l?.find(e=>e.alias===c):f,v=l||[],b=r||g||f||f,j=t.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48`},[i?.id]),w=t.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),N=t.useCallback(e=>{n?n(e):p(e)},[n,p]),_=t.useMemo(()=>{if(!v?.length)return[];const e=new Map;v.forEach(a=>{e.set(a.alias,a)});const a=Array.from(e.values()),t=a.find(e=>e.alias===b?.alias),s=a.filter(e=>e.alias!==b?.alias);return s.sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"})),t?[t,...s]:s},[v,b?.alias]),[C,k]=t.useState(!1);if(!u||!i)return null;return"dropdown"===e?a.jsxs(a.Fragment,{children:[a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${s}`,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("div",{className:"hidden md:block text-right",children:[a.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),a.jsx("p",{className:"text-xs text-primary-foreground/70",children:b?.name||"N/A"})]}),a.jsxs(ml,{className:"w-8 h-8 border border-primary-foreground/30",children:[j&&a.jsx(pl,{src:j,alt:i.name||o("user_photo")}),a.jsx(hl,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:w||a.jsx(d.User,{className:"h-4 w-4"})})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4"})]})})}),a.jsxs(hr,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[a.jsxs(cr,{children:[a.jsxs(mr,{children:[a.jsx(d.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a.jsx(pr,{children:_.map(e=>a.jsxs(xr,{onClick:()=>N(e),className:e.alias===b?.alias?"bg-muted":"",children:[a.jsx(d.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===b?.alias&&a.jsx(ar,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),wp&&a.jsxs(a.Fragment,{children:[a.jsx(br,{}),a.jsxs(xr,{onClick:()=>k(!0),children:[a.jsx(d.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),a.jsx(br,{}),a.jsxs(xr,{onClick:m,children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),wp&&a.jsx(jp,{open:C,onOpenChange:k,user:i,userPhotoUrl:j,userInitials:w})]}):a.jsxs(ts,{className:s,children:[a.jsx(ss,{children:a.jsx(rs,{className:"text-lg",children:o("user_info")})}),a.jsxs(os,{className:"space-y-4",children:[a.jsx(()=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsxs(ml,{className:"w-10 h-10",children:[j&&a.jsx(pl,{src:j,alt:i.name||o("user_photo")}),a.jsx(hl,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:w||a.jsx(d.User,{className:"h-5 w-5"})})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",b?.name||"N/A"]})]})]}),b&&a.jsx("div",{className:"mt-3",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(d.Building2,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:b.name})]})}),_.length>1&&a.jsxs("div",{className:"mt-2",children:[a.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",_.length]}),a.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.slice(0,3).map(e=>a.jsx(ar,{variant:e.alias===b?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>N(e),children:e.name},e.alias)),_.length>3&&a.jsxs(ar,{variant:"outline",className:"text-xs",children:["+",_.length-3]})]})]})]}),{}),a.jsx(ls,{}),a.jsxs(Xt,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),_p=t.createContext({});function Cp({children:e,config:s}){const r=t.useMemo(()=>{const e=Ie(),a=s?.appName?e?`${s.appName} (Dev)`:s.appName:void 0;return{navigation:s?.navigation,appName:a}},[s?.navigation,s?.appName]);return a.jsx(_p.Provider,{value:r,children:e})}function kp(){return t.useContext(_p)}function Sp(e,a){if(!e)return"";const t=e.find(e=>e.path===a);if(t)return t.label;const s=e.find(e=>a.startsWith(e.path+"/"));return s?.label||""}function Tp(e,a){const[s,r]=t.useState(e),n=t.useRef(),o=t.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return t.useEffect(()=>(o(),n.current=setTimeout(()=>{r(e)},a),o),[e,a,o]),[s,o]}function Pp({appName:e}){const[s,r]=t.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between w-[258px]",children:[a.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>r(!0),children:a.jsx("img",{src:We.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&a.jsx("button",{className:"min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground/80 hover:text-primary-foreground/60 transition-colors leading-tight py-1",onClick:()=>r(!0),children:a.jsx("span",{className:"line-clamp-2",children:(e=>{const t=e.split(" ");if(t.length<=1)return a.jsxs("span",{className:"whitespace-nowrap",children:[e," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const s=t[t.length-1],r=t.slice(0,-1).join(" ");return a.jsxs(a.Fragment,{children:[r," ",a.jsxs("span",{className:"whitespace-nowrap",children:[s," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),a.jsx(Zi,{open:s,onOpenChange:r})]})}const Dp=t.memo(function({actions:s}){const r=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=kp(),l=Sp(o,r.pathname),{metadata:c,headerActions:u}=li(),{setOpenMobile:m}=Vd(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:v}=In(),b=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,j]=N.useSearchParams(),w=t.useCallback(e=>{const{pathname:a,search:t,hash:s}=r;if(h){const r=a.split("/"),o=r.indexOf(h);if(o>=0)return r[o]=e.alias,void n(r.join("/")+t+s)}v(e)},[h,r,n,v]),[_,C]=t.useState(()=>y.get("search")||""),[k,S]=Tp(_,Re.debounceDelay);t.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),j(e)},[k,j,x]);const T=o?.find(e=>e.path===r.pathname)||o?.find(e=>r.pathname.startsWith(e.path+"/")),P=c.title||l,D=c.subtitle||T?.complementaryText||"";return a.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Xt,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:a.jsx(d.Menu,{size:20})}),a.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:a.jsx(Pp,{appName:i})}),a.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),a.jsxs("div",{className:"flex-shrink-0",children:[c.breadcrumbs&&c.breadcrumbs.length>0&&a.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:c.breadcrumbs.map((e,t)=>a.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&a.jsx(d.ChevronRight,{className:"h-3 w-3"}),e.href?a.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):a.jsx("span",{children:e.label})]},t))}),a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:P})}),D&&a.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:D})]}),x&&a.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Zt,{placeholder:"Pesquisar",value:_,onChange:e=>{return a=e.target.value,void C(a);var a},className:"w-full pl-10 pr-8"}),_&&a.jsx(Xt,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),j(e)},title:e.t("clear_search"),children:a.jsx(d.X,{size:14})})]}),a.jsx(Xt,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:a.jsx(d.RefreshCw,{size:14})})]}),a.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||s)&&a.jsx("div",{className:"flex items-center gap-2",children:u||s}),(void 0).VITE_WIKI_URL&&a.jsx(Xt,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>Ht((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a.jsx(eu,{}),a.jsx("div",{className:"text-sm",children:a.jsx(Np,{variant:"dropdown",selectedUnit:b,onUnitChange:w})})]})]})})}),Ep=({key:e,enabled:a,checkFn:t,staleTime:s=3e5,gcTime:r=6e5})=>w.useQuery({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:s,gcTime:r,retry:0,refetchOnWindowFocus:!1});function Ap({config:e,isCollapsed:t=!1,isDisabled:s=!1,className:r}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=d.Plus,variant:c="button"}=e;if(!o||0===o.length)return null;if("split-button"===c){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(t){const t=a.jsx(Xt,{onClick:e.onClick,disabled:s||e.disabled,className:Kt("justify-center px-2 w-full",r),variant:"outline",size:"default",children:a.jsx(n,{className:"h-4 w-4 shrink-0"})});return a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:t}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:e.label})})]})}return a.jsx(Wc,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:s||e.disabled,className:Kt("w-full",r),menuAlign:"start"})}const u=(e,s,r=!1)=>a.jsxs(a.Fragment,{children:[e,!t&&s&&a.jsx("span",{className:"truncate",children:s}),!t&&r&&a.jsx(d.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=s||e.disabled,d=a.jsx(Xt,{onClick:e.onClick,disabled:i,className:Kt("w-full gap-2 justify-start",t&&"justify-center px-2",r),variant:"outline",size:"default",children:u(a.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return t?a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:d}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:e.label})})]}):d}const m=a.jsx(Xt,{disabled:s,className:Kt("w-full gap-2 justify-start",t&&"justify-center px-2",r),variant:"outline",size:"default",children:u(a.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:t?a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:m}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:i})})]}):m}),a.jsx(hr,{align:"start",side:t?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const t=e.icon;return a.jsxs(xr,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[t&&a.jsx(t,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Ip="forlogic-sidebar-pinned",Mp=()=>{try{const e=localStorage.getItem(Ip);return!!e&&JSON.parse(e)}catch{return!1}};function Fp({direction:e="right",minWidth:a=224,maxWidth:s=384,defaultWidth:r=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,d]=t.useState(()=>{if("undefined"==typeof window)return r;const e=localStorage.getItem(n);return e?parseInt(e):r}),[c,u]=t.useState(!1),m=t.useRef(null);t.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=t.useCallback(e=>{e.preventDefault(),u(!0)},[]);return t.useEffect(()=>{if(!c)return;const t=t=>{let r;r="left"===e?window.innerWidth-t.clientX:t.clientX,r=Math.max(a,Math.min(s,r)),d(r),o?.(r)},r=()=>{u(!1),d(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)}},[c,e,a,s,l,n,o]),t.useEffect(()=>(c?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[c,e]),{width:l,isDragging:c,dragRef:m,handleMouseDown:p}}const Rp=t.createContext(void 0);function Lp(){const e=t.useContext(Rp);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function zp({config:e,customContent:s,resizable:r=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:c,setOpenMobile:u}=Vd(),m=N.useLocation(),{alias:p,user:h}=In(),{appName:x}=kp(),{hasOpenModal:f}=Lp(),[g,v]=t.useState(Mp),b=Rn(),j=!!b||l,w=t.useCallback(()=>{b&&u(!1)},[b,u]),_=r?Fp({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;t.useEffect(()=>{c(!!g)},[g,c]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return a.jsxs(qd,{collapsible:"icon",className:Kt("app-sidebar bg-background border-r border-border flex flex-col",j?"px-3":"px-1.5"),style:_&&j?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&a.jsx("div",{className:"py-3",children:a.jsx(jr,{children:a.jsx(Ap,{config:e.moduleActions,isCollapsed:!j,isDisabled:f})})}),a.jsx(Xd,{className:Kt(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:s||a.jsx(Jd,{className:"p-0",children:a.jsx(ac,{children:a.jsx(tc,{className:"gap-1",children:a.jsx(jr,{children:e?.navigation?.map((e,t)=>{if("separator"===e.type)return a.jsx(Qd,{className:"my-2"},`sep-${t}`);const s=({item:e,index:t})=>{const r=`${e.path}-${t}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=Ep({key:r,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,c=o?d.Loader2:l?d.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?j?a.jsx(wi,{defaultOpen:!0,className:"group/collapsible",children:a.jsxs(sc,{children:[a.jsx(Ni,{asChild:!0,children:a.jsx(nc,{size:"default",children:a.jsxs("div",{className:"flex w-full items-center gap-3",children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4"})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label}),a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),a.jsx(_i,{children:a.jsx(dc,{children:e.children.map((e,t)=>a.jsx(s,{item:e,index:t},e.path))})})]})},e.path):a.jsx(sc,{children:a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("div",{className:Kt("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:a.jsx(c,{className:"h-4 w-4"})})}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:e.label})})]})},e.path):a.jsx(sc,{children:l||o?a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:j?a.jsx(nc,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:a.jsxs("div",{className:"flex w-full items-center gap-3",children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):a.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:a.jsx(c,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):j?a.jsx(nc,{asChild:!0,isActive:C(e.path),size:"default",children:a.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:w,children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4"})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(N.Link,{to:e.path,onClick:w,className:Kt("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:a.jsx(c,{className:"h-4 w-4"})})}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:e.label})})]})},e.path)};return a.jsx(s,{item:e,index:t},e.path)})})})})})}),!b&&a.jsx("div",{className:Kt("mt-auto pb-4 pt-2 flex",l?"justify-end":"justify-center"),children:a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;v(e),(e=>{try{localStorage.setItem(Ip,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?a.jsx(d.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):a.jsx(d.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a.jsx(_r,{side:"right",children:a.jsx("p",{children:l?"Recolher":"Expandir"})})]})}),r&&_&&j&&a.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:Kt("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}const Up=t.memo(function({children:e,sidebar:s,sidebarConfig:r,showHeader:n=!0}){const o=t.useMemo(()=>s||a.jsx(zp,{config:r}),[s,r]),i=t.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),l=t.useRef(null),d=t.useRef(null),c=t.useCallback(()=>{if(l.current&&d.current){const e=l.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return t.useEffect(()=>{c();const e=new ResizeObserver(c);return l.current&&e.observe(l.current),()=>e.disconnect()},[c]),a.jsx(Cp,{config:r,children:a.jsx(ii,{children:a.jsx(Bd,{defaultOpen:!1,style:i,children:a.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&a.jsx("div",{ref:l,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:a.jsx(Dp,{})}),a.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[o,a.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class Op{static async sendEmail(e){const a=un(),{data:t,error:s}=await a.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(s)throw s;return t}}const Vp=Op;function Bp({open:e,onOpenChange:s,placeId:r,placeName:n,onMakeManager:o,onMakeMembers:i,currentManagerId:l,currentMemberIds:c=[]}){const{t:u}=y.useTranslation(),[m,p]=t.useState([]),[h,x]=t.useState(!1),[f,g]=t.useState(""),{data:v=[],isLoading:b}=Vo({enabled:e}),j=t.useMemo(()=>{let e=[...v];if(e.sort((e,a)=>{const t=e.userName?.toLowerCase()||"",s=a.userName?.toLowerCase()||"";return t.localeCompare(s)}),f){const a=f.toLowerCase();e=e.filter(e=>e.userName?.toLowerCase().includes(a)||e.userEmail?.toLowerCase().includes(a))}return e},[v,f]),w=e=>{p(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},N=1===m.length,_=m.length>0;return a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:"max-w-2xl",variant:"form",children:[a.jsx(Ss,{showSeparator:!0,children:a.jsxs(Ds,{className:"flex items-center gap-2",children:[a.jsx(d.Users,{className:"h-5 w-5"}),"Gerenciar Acessos - ",n]})}),a.jsxs(Ts,{children:[a.jsxs("div",{className:"relative mb-4",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{placeholder:"Pesquisar...",value:f,onChange:e=>g(e.target.value),className:"pl-9"})]}),a.jsx(Fo,{className:"h-[400px] pr-4",children:b?a.jsx("div",{className:"space-y-2",children:[...Array(5)].map((e,t)=>a.jsx(Lr,{className:"h-16 w-full"},t))}):0===j.length?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(d.Users,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:u(f?"leadership_no_users_found":"leadership_no_users_available")})]}):a.jsx("div",{className:"space-y-2",children:j.map(e=>{const t=e.userId===l,s=c.includes(e.userId||""),r=m.includes(e.userId||"");return a.jsxs("div",{className:Kt("flex items-center gap-3 p-3 rounded-lg border transition-colors",r&&"bg-accent border-primary","hover:bg-accent/50 cursor-pointer"),onClick:()=>w(e.userId||""),children:[a.jsx(Js,{checked:r,onCheckedChange:()=>w(e.userId||""),onClick:e=>e.stopPropagation()}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-medium",children:e.userName}),t&&a.jsx(d.Crown,{className:"h-4 w-4 text-yellow-500"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.userEmail})]}),(t||s)&&a.jsx("div",{className:"text-xs text-muted-foreground",children:t?"Gestor":"Membro"})]},e.userId)})})})]}),a.jsxs(Ps,{className:"flex gap-2 sm:gap-2",children:[a.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:m.length>0&&a.jsxs("span",{children:[m.length," selecionado(s)"]})}),N&&o&&a.jsxs(Xt,{onClick:async()=>{if(o&&1===m.length){x(!0);try{await o(m[0],r),p([])}finally{x(!1)}}},disabled:h,variant:"outline",children:[a.jsx(d.Crown,{className:"h-4 w-4 mr-2"}),"Tornar Gestor"]}),_&&i&&a.jsxs(Xt,{onClick:async()=>{if(i&&0!==m.length){x(!0);try{await i(m,r),p([])}finally{x(!1)}}},disabled:h,children:[a.jsx(d.UserPlus,{className:"h-4 w-4 mr-2"}),"Tornar ",m.length>1?"Membros":"Membro"]})]})]})})}function qp({place:e,level:s=0,manageAccessConfig:r}){const{t:n}=y.useTranslation(),[o,i]=t.useState(!1),[l,c]=t.useState(!1),u=e.subPlaces&&e.subPlaces.length>0,m=e.isActive??!0,p=e.usersCount??0;return a.jsxs("div",{children:[a.jsxs(wi,{open:o,onOpenChange:i,children:[a.jsxs("div",{className:"flex items-center gap-2 py-3 px-4 hover:bg-accent/50 transition-colors",style:{paddingLeft:2*s+1+"rem"},children:[u?a.jsxs(Ni,{className:"flex items-center gap-2 flex-1",children:[a.jsx(d.ChevronRight,{className:Kt("h-4 w-4 transition-transform shrink-0",o&&"rotate-90")}),a.jsx(d.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"font-medium",children:e.name}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",e.subPlaces.length,")"]})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("div",{className:"w-4 shrink-0"}),a.jsx(d.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"font-medium",children:e.name})]}),a.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(d.Users,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:p})]}),a.jsx(ar,{variant:m?"default":"secondary",className:"text-xs",children:m?"Ativo":"Inativo"}),r&&a.jsx(mp,{customActions:[{label:n("manage_access"),icon:d.Settings,onClick:()=>c(!0),variant:"default"}],renderAs:"dropdown",variant:"compact"})]})]}),u&&a.jsx(_i,{children:e.subPlaces.map(e=>a.jsx(qp,{place:e,level:s+1,manageAccessConfig:r},e.id))})]}),0===s&&a.jsx(ls,{}),r&&a.jsx(Bp,{open:l,onOpenChange:c,placeId:e.id,placeName:e.name,onMakeManager:r.onMakeManager,onMakeMembers:r.onMakeMembers,currentManagerId:r.getCurrentManagerId?.(e.id),currentMemberIds:r.getCurrentMemberIds?.(e.id)})]})}const $p=new class{get baseUrl(){return Oe()}async makeApiCall(e,a,t){const s=xn.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const r=tn.getAccessToken();if(!r)throw new Error("Token Qualiex não encontrado");if(!t||""===t.trim())throw new Error("Alias da unidade é obrigatório");const n=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{n.searchParams.append(e,a)});const o=await fetch(n.toString(),{method:"GET",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!o.ok){const e=new Error(`API call failed: ${o.status}`);throw e.status=o.status,e}return o.json()}buildHierarchy(e){const a=new Map,t=[];return e.forEach(e=>{a.set(e.id,{...e,subPlaces:[]})}),e.forEach(e=>{const s=a.get(e.id);if(e.parentId){const r=a.get(e.parentId);r?(r.subPlaces=r.subPlaces||[],r.subPlaces.push(s)):t.push(s)}else t.push(s)}),t}async getPlaces(e,a){try{const t=await this.makeApiCall("/api/common/v1/places",{companyId:a},e),s=t.data||t||[];return this.buildHierarchy(s)}catch(t){if(await xn.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/places",{companyId:a},e),s=t.data||t||[];return this.buildHierarchy(s)}catch(s){return sn.handleError(s instanceof Error?s:"Erro ao buscar locais após renovação de token",!0),[]}return sn.handleError(t instanceof Error?t.message:"Erro ao buscar locais",!0),[]}}};function Wp(e){const a=new Map,t=new Map,s=[];e.forEach(e=>{const s={...e,children:[],level:0};a.set(e.id,s),t.set(e.id_user,s)}),e.forEach(e=>{const r=a.get(e.id);if(e.id_leader){const a=t.get(e.id_leader);if(a)return void a.children.push(r)}s.push(r)});const r=(e,a)=>{e.level=a,e.children.forEach(e=>r(e,a+1))};s.forEach(e=>r(e,0));const n=e=>{e.sort((e,a)=>{const t=e.name||e.id_user||e.email||"",s=a.name||a.id_user||a.email||"";return t.localeCompare(s)}),e.forEach(e=>e.children.length>0&&n(e.children))};return n(s),s}function Hp(e){const a=[],t=e=>{a.push(e),e.children.forEach(t)};return e.forEach(t),a}function Gp(){const{alias:a,isAuthenticated:s}=In(),r=tn.getAccessToken(),{data:n=[]}=Vo(),o=w.useQuery({queryKey:["leadership-raw",a],queryFn:async()=>{if(!r||!a)throw new Error("Usuário não autenticado ou unidade não selecionada");const e=un(),{data:t,error:s}=await e.schema("common").from("leaders").select("*").eq("is_removed",!1).eq("alias",a);if(s)throw new Error("Erro ao buscar hierarquia de liderança");return t??[]},enabled:!!r&&!!a&&s}),i=t.useMemo(()=>{const a=o.data;if(!a)return;if(0===a.length)return[];const t={};n.forEach(e=>{t[e.userId]={name:e.userName||e.userEmail,email:e.userEmail||""}});const s=a.map(s=>{const r=a.filter(e=>e.id_leader===s.id_user);return{...s,name:t[s.id_user]?.name||e.t("inactive_user"),email:t[s.id_user]?.email||"",subordinatesCount:r.length,subordinateNames:r.map(e=>t[e.id_user]?.name||"[Usuário inativo]").sort((e,a)=>e.localeCompare(a))}}),r=new Set(a.map(e=>e.id_user));return new Set(a.filter(e=>e.id_leader&&!r.has(e.id_leader)).map(e=>e.id_leader)).forEach(r=>{const n=t[r],o=a.filter(e=>e.id_leader===r);s.push({id:`virtual-${r}`,alias:a[0]?.alias||"",id_user:r,id_leader:null,is_removed:!1,is_active:!0,created_at:(new Date).toISOString(),updated_at:(new Date).toISOString(),name:n?.name||e.t("inactive_user"),email:n?.email||"",subordinatesCount:o.length,subordinateNames:o.map(e=>t[e.id_user]?.name||"[Usuário inativo]").sort((e,a)=>e.localeCompare(a))})}),Wp(s)},[o.data,n]);return{...o,data:i}}(void 0).VITE_SUPABASE_URL,nn();const Kp="common";function Yp(){const{alias:e}=In(),a=w.useQueryClient(),t=un(),{t:s}=y.useTranslation();return w.useMutation({mutationFn:async a=>{if(!e)throw new Error(s("unit_not_selected","Unidade não selecionada"));if(a.id_user===a.id_leader)throw new Error(s("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await eh(t,e,a.id_user,a.id_leader);const{data:r,error:n}=await t.schema(Kp).from("leaders").insert({alias:e,id_user:a.id_user,id_leader:a.id_leader,is_active:!0,is_removed:!1}).select().single();if(n)throw n;return r},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),l.toast.success(s("leader_promoted_success","Líder virtual promovido com sucesso"))},onError:e=>{l.toast.error(e.message||s("leader_create_error","Erro ao criar líder"))}})}function Qp(){const{alias:e}=In(),a=w.useQueryClient(),t=un(),{t:s}=y.useTranslation();return w.useMutation({mutationFn:async a=>{if(!e)throw new Error(s("unit_not_selected","Unidade não selecionada"));if(!a.users.length)throw new Error(s("select_at_least_one",s("leadership_select_subordinates")));const r=a.users.map(e=>e.id_user),{data:n}=await t.schema(Kp).from("leaders").select("id_user").eq("alias",e).in("id_user",r).eq("is_removed",!1);if(n&&n.length>0){const e=n.map(e=>e.id_user);throw new Error(s("users_already_leaders",`Alguns usuários já estão cadastrados como líderes: ${e.join(", ")}`))}for(const d of a.users){if(a.id_leader&&d.id_user===a.id_leader)throw new Error(s("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await eh(t,e,d.id_user,a.id_leader)}const o=a.users.map(t=>({alias:e,id_user:t.id_user,id_leader:a.id_leader,is_active:!0,is_removed:!1})),{data:i,error:l}=await t.schema(Kp).from("leaders").insert(o).select();if(l)throw l;return i},onSuccess:t=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),l.toast.success(s("subordinates_added_success",`${t?.length||0} liderado(s) adicionado(s) com sucesso`))},onError:e=>{l.toast.error(e.message||s("subordinates_add_error","Erro ao adicionar liderados"))}})}function Xp(){const{alias:e}=In(),a=w.useQueryClient(),t=un(),{t:s}=y.useTranslation();return w.useMutation({mutationFn:async a=>{if(!e)throw new Error(s("unit_not_selected","Unidade não selecionada"));const{data:r}=await t.schema(Kp).from("leaders").select("id_user").eq("id",a.id).eq("alias",e).single();if(!r)throw new Error(s("leader_not_found","Líder não encontrado"));if(r.id_user===a.id_leader)throw new Error(s("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await eh(t,e,r.id_user,a.id_leader,a.id);const{data:n,error:o}=await t.schema(Kp).from("leaders").update({id_leader:a.id_leader}).eq("id",a.id).eq("alias",e).select().single();if(o)throw o;return n},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),l.toast.success(s("leader_updated_success","Líder atualizado com sucesso"))},onError:e=>{l.toast.error(e.message||s("leader_update_error","Erro ao atualizar líder"))}})}function Jp(){const{alias:e}=In(),a=w.useQueryClient(),t=un(),{t:s}=y.useTranslation();return w.useMutation({mutationFn:async a=>{if(!e)throw new Error(s("unit_not_selected","Unidade não selecionada"));const{error:r}=await t.schema(Kp).from("leaders").update({is_removed:!0}).eq("id",a).eq("alias",e);if(r)throw r},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),l.toast.success(s("leader_removed_success","Líder removido com sucesso"))},onError:e=>{l.toast.error(e.message||s("leader_remove_error","Erro ao remover líder"))}})}function Zp(){const{alias:e}=In(),a=w.useQueryClient(),t=un(),{t:s}=y.useTranslation();return w.useMutation({mutationFn:async({leaderUserId:a,selectedUsers:r})=>{if(!e)throw new Error(s("unit_not_selected","Unidade não selecionada"));const n=r.map(e=>e.id_user),o=await Promise.all([t.schema(Kp).from("leaders").select("id, id_user, id_leader").eq("alias",e).eq("is_removed",!1).eq("id_leader",a),t.schema(Kp).from("leaders").select("id, id_user, id_leader").eq("alias",e).eq("is_removed",!1).in("id_user",n.length?n:["__none__"])]),[{data:i,error:l},{data:d,error:c}]=o;if(l)throw l;if(c)throw c;const u=i||[],m=d||[],p=new Set(n),h=u.filter(e=>!p.has(e.id_user)),x=m.filter(e=>e.id_leader!==a),f=new Set(m.map(e=>e.id_user)),g=r.filter(e=>!f.has(e.id_user));for(const s of x)await eh(t,e,s.id_user,a,s.id);for(const y of g){if(y.id_user===a)throw new Error(s("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));await eh(t,e,y.id_user,a)}const v=[];if(h.length){const a=h.map(e=>e.id);v.push(t.schema(Kp).from("leaders").update({is_removed:!0}).in("id",a).eq("alias",e))}if(x.length){const s=x.map(e=>e.id);v.push(t.schema(Kp).from("leaders").update({id_leader:a}).in("id",s).eq("alias",e))}if(g.length){const s=g.map(t=>({alias:e,id_user:t.id_user,id_leader:a,is_active:!0,is_removed:!1}));v.push(t.schema(Kp).from("leaders").insert(s))}const b=(await Promise.all(v)).find(e=>e?.error);if(b?.error)throw b.error;return{unlinked:h.length,updated:x.length,created:g.length}},onSuccess:t=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),l.toast.success(s("subordinates_synced_success",`Subordinados sincronizados (${t.created} adicionados, ${t.updated} atualizados, ${t.unlinked} removidos)`))},onError:e=>{l.toast.error(e.message||s("subordinates_sync_error","Erro ao sincronizar subordinados"))}})}async function eh(a,t,s,r,n){const{data:o,error:i}=await a.schema(Kp).from("leaders").select("id, id_user, id_leader").eq("alias",t).eq("is_removed",!1);if(i)throw i;const l=n?o.filter(e=>e.id!==n):o,d=new Set;let c=r;for(;c;){if(d.has(c))throw new Error(e.t("leadership_cycle_error"));if(c===s)throw new Error("Esta associação criaria um ciclo na hierarquia");d.add(c);const a=l.find(e=>e.id_user===c);c=a?.id_leader||null}}var ah=function(e,a){for(var t={};e.length;){var s=e[0],r=s.code,n=s.message,o=s.path.join(".");if(!t[o])if("unionErrors"in s){var i=s.unionErrors[0].errors[0];t[o]={message:i.message,type:i.code}}else t[o]={message:n,type:r};if("unionErrors"in s&&s.unionErrors.forEach(function(a){return a.errors.forEach(function(a){return e.push(a)})}),a){var l=t[o].types,d=l&&l[s.code];t[o]=h.appendErrors(o,a,t,r,d?[].concat(d,s.message):s.message)}e.shift()}return t},th=function(e,a,t){return void 0===t&&(t={}),function(s,r,n){try{return Promise.resolve(function(r,o){try{var i=Promise.resolve(e["sync"===t.mode?"parse":"parseAsync"](s,a)).then(function(e){return n.shouldUseNativeValidation&&Z.validateFieldsNatively({},n),{errors:{},values:t.raw?s:e}})}catch(l){return o(l)}return i&&i.then?i.then(void 0,o):i}(0,function(e){if(function(e){return Array.isArray(null==e?void 0:e.errors)}(e))return{values:{},errors:Z.toNestErrors(ah(e.errors,!n.shouldUseNativeValidation&&"all"===n.criteriaMode),n)};throw e}))}catch(o){return Promise.reject(o)}}};const sh=J.z.object({id_leader:J.z.string().nullable(),id_users:J.z.array(J.z.string()).min(1,e.t("leadership_select_subordinates"))}),rh=J.z.object({id_leader:J.z.string().nullable(),id_users:J.z.array(J.z.string())});function nh({value:s,onChange:r,excludeUserIds:n=[],error:o}){const{data:i=[],isLoading:l}=Vo(),[c,u]=t.useState(""),m=t.useRef(null),p=t.useRef(0),h=i.filter(e=>!n.includes(e.userId||"")).filter(e=>{const a=c.toLowerCase(),t=e.userName?.toLowerCase().includes(a);return t}).sort((e,a)=>{const t=s.includes(e.userId),r=s.includes(a.userId);if(t&&!r)return-1;if(!t&&r)return 1;const n=e.userName||e.userEmail||"",o=a.userName||a.userEmail||"";return n.localeCompare(o)});return t.useEffect(()=>{m.current&&p.current>0&&(m.current.scrollTop=p.current)},[h]),l?a.jsxs("div",{className:"flex items-center justify-center p-4",children:[a.jsx(d.Loader2,{className:"h-6 w-6 animate-spin"}),a.jsx("span",{className:"ml-2",children:"Carregando dados..."})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsx(Zt,{placeholder:e.t("search_user_placeholder"),value:c,onChange:e=>u(e.target.value)}),a.jsx("div",{ref:m,className:"border rounded-md p-4 max-h-[300px] overflow-y-auto",children:0===h.length?a.jsx("p",{className:"text-sm text-muted-foreground",children:e.t("search_user_placeholder")}):a.jsx("div",{className:"space-y-2",children:h.map(e=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Js,{id:e.userId,checked:s.includes(e.userId),onCheckedChange:()=>{return a=e.userId,m.current&&(p.current=m.current.scrollTop),void(s.includes(a)?r(s.filter(e=>e!==a)):r([...s,a]));var a}}),a.jsx(as,{htmlFor:e.userId,className:"flex-1 cursor-pointer",children:e.userName||e.userEmail})]},e.userId))})}),s.length>0&&a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.length," selecionado(s)"]}),o&&a.jsx("p",{className:"text-sm text-destructive",children:o})]})}function oh({leader:s,prefilledLeaderId:r,onSuccess:n}){const{t:o}=y.useTranslation(),{alias:i}=In(),l=!!s,c=s?.id.startsWith("virtual-"),u=Qp(),m=Yp(),p=Xp(),x=Zp(),f=Jp(),{data:g=[]}=Gp(),{data:v=[]}=Vo(),[b,j]=t.useState(""),w=Hp(g).map(e=>e.id_user),N=l?Hp(g).filter(e=>e.id_leader===s.id_user).map(e=>e.id_user):[],_=h.useForm({resolver:th(l?rh:sh),defaultValues:{id_leader:r||(l?s?.id_leader:null)||null,id_users:l?N:[]}});t.useEffect(()=>{if(s){const e=Hp(g).filter(e=>e.id_leader===s.id_user).map(e=>e.id_user);_.reset({id_leader:s.id_leader||null,id_users:e})}else r?_.reset({id_leader:r,id_users:[]}):_.reset({id_leader:null,id_users:[]})},[i,s?.id,s?.id_user,s?.id_leader,r,g]);const C=u.isPending||m.isPending||p.isPending||x.isPending||f.isPending,k=_.watch("id_leader"),S=_.watch("id_users"),T=l?[s.id_user,...w.filter(e=>e!==s.id_user&&!S.includes(e)&&!N.includes(e))]:[k,...w.filter(e=>!S.includes(e))].filter(Boolean);return a.jsxs("form",{onSubmit:_.handleSubmit(async e=>{try{if(l)if(c){await m.mutateAsync({id_user:s.id_user,id_leader:e.id_leader});const a=v.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await x.mutateAsync({leaderUserId:s.id_user,selectedUsers:a})}else{await p.mutateAsync({id:s.id,id_leader:e.id_leader});const a=v.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await x.mutateAsync({leaderUserId:s.id_user,selectedUsers:a})}else{const a=v.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await u.mutateAsync({id_leader:e.id_leader,users:a})}n?.()}catch(a){}}),className:"space-y-4",children:[l&&a.jsxs("div",{children:[a.jsx(as,{children:e.t("leader")}),a.jsx(Zt,{value:v.find(e=>e.userId===s.id_user)?.userName||s.name||e.t("inactive_user"),disabled:!0,className:"bg-muted"})]}),a.jsxs("div",{children:[a.jsx(as,{children:o("leadership_immediate_superior")}),a.jsxs(Bs,{value:k||"none",onValueChange:e=>_.setValue("id_leader","none"===e?null:e),children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:"Selecione..."})}),a.jsxs(Ks,{children:[a.jsx("div",{className:"sticky top-0 z-10 bg-background p-2 border-b",children:a.jsx(Zt,{placeholder:"Buscar superior...",value:b,onChange:e=>j(e.target.value),onKeyDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:"h-8"})}),a.jsxs(Fo,{className:"h-[200px]",children:[a.jsx(Qs,{value:"none",children:"[Nenhum]"}),v.filter(e=>{const a=l?e.userId!==s.id_user:!S.includes(e.userId),t=!b||e.userName?.toLowerCase().includes(b.toLowerCase());return a&&t}).sort((e,a)=>{const t=e.userName||e.userEmail||"",s=a.userName||a.userEmail||"";return t.localeCompare(s)}).map(e=>a.jsx(Qs,{value:e.userId,children:e.userName},e.userId))]})]})]},`superior-select-${i}`),_.formState.errors.id_leader&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:_.formState.errors.id_leader.message})]}),a.jsxs("div",{children:[a.jsx(as,{children:"Subordinados *"}),a.jsx(nh,{value:S,onChange:e=>_.setValue("id_users",e),excludeUserIds:T,error:_.formState.errors.id_users?.message},`users-multiselect-${i}`)]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Xt,{type:"submit",disabled:C||!l&&0===S.length,children:C&&!f.isPending?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),l?"Atualizando...":"Salvando..."]}):l?"Atualizar":"Criar"}),l&&!k&&0===S.length&&a.jsxs(ds,{children:[a.jsx(cs,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"destructive",disabled:C,className:"ml-auto",children:f.isPending?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Removendo..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Trash2,{className:"mr-2 h-4 w-4"}),"Remover"]})})}),a.jsxs(ps,{children:[a.jsxs(hs,{children:[a.jsx(fs,{children:o("confirm_removal")}),a.jsx(gs,{children:"Tem certeza que deseja remover este líder? Esta ação não pode ser desfeita."})]}),a.jsxs(xs,{children:[a.jsx(bs,{children:o("cancel")}),a.jsx(vs,{onClick:async()=>{if(s)try{await f.mutateAsync(s.id),n?.()}catch(e){}},children:o("remove")})]})]})]})]})]})}function ih({open:e,onOpenChange:t,leader:s,prefilledLeaderId:r,title:n}){return a.jsx(ys,{open:e,onOpenChange:t,children:a.jsxs(ks,{variant:"form",className:"sm:max-w-[500px]",children:[a.jsx(Ss,{showSeparator:!0,children:a.jsx(Ds,{children:n})}),a.jsx(Ts,{children:a.jsx(oh,{leader:s,prefilledLeaderId:r,onSuccess:()=>t(!1)})})]})})}const lh="leadership-expanded-nodes",dh=(e,a)=>{try{localStorage.setItem(`${lh}-${e}`,JSON.stringify(Array.from(a)))}catch{}};function ch(e){const[a,s]=t.useState(!1),{uploadFunction:r,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:d}=e||{};return{upload:async(e,a)=>{if(!r){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}s(!0);try{const t={...o,...a};if(t.maxSize&&e.size>t.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(t.maxSize/1024/1024)}MB`);if(t.allowedTypes){if(!t.allowedTypes.some(a=>a.endsWith("/*")?e.type.startsWith(a.replace("/*","")):e.type===a))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${t.allowedTypes.join(", ")}`)}const s=await r(e,t);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(s),s}catch(t){const e=t instanceof Error?t:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),d?.(e),e}finally{s(!1)}},deleteMedia:async(e,a)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function uh(e){const a=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const t of a){const a=e.match(t);if(a)return a[1]}return null}function mh(e,a){const t=uh(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function ph(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function hh(e,a){const t=ph(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function xh(e){if(!e)return;const a=e.match(/src="([^"]+)"/);return a?a[1]:void 0}function fh(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function gh(e,a){return e/a}function vh(){const{alias:e}=In(),[a,s]=t.useState(null),[r,n]=t.useState(!0);t.useEffect(()=>{if(!e)return void n(!1);let a=!1;return(async()=>{n(!0);try{const t=un(),{data:r,error:n}=await t.schema("common").from("sign_configs").select("*").eq("alias",e).is("deleted_at",null).maybeSingle();a||s(r)}catch(t){a||s(null)}finally{a||n(!1)}})(),()=>{a=!0}},[e]);return{config:a,isLoading:r,saveConfig:t.useCallback(async(a,t)=>{if(!e)throw new Error("Alias not available");const r=un(),{data:n,error:o}=await r.schema("common").from("sign_configs").upsert({alias:e,api_key:a,environment:t,updated_at:(new Date).toISOString()},{onConflict:"alias"}).select().maybeSingle();if(o)throw o;return s(n),n},[e])}}const bh=(void 0).VITE_SUPABASE_URL,yh=nn();async function jh(e,a,t){const s=tn.getSupabaseToken(),r={"Content-Type":"application/json",apikey:yh};s&&(r.Authorization=`Bearer ${s}`);const n=await fetch(`${bh}/functions/v1/${e}`,{method:"POST",headers:r,body:JSON.stringify({action:a,data:t})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.error||`Erro na requisição: ${n.status}`)}return n}const wh={async createEnvelopeWithSigner(e){const a="d4sign"===e.provider?"d4sign":"clicksign",t="d4sign"===e.provider?"create_and_send":"create_envelope_with_signer";return(await jh(a,t,{content_base64:e.contentBase64,filename:e.filename,signer_email:e.signerEmail,signer_name:e.signerName})).json()},async getSignedDocument(e){const a="d4sign"===e.provider?"d4sign":"clicksign";return(await jh(a,"get_signed_document",{envelope_id:e.envelopeId,document_id:e.documentId})).json()}};let Nh=null;function _h(){return window.Clicksign?Promise.resolve():Nh||(Nh=new Promise((e,a)=>{const t=document.createElement("script");t.src="https://cdn-public-library.clicksign.com/embedded/embedded.min-2.1.0.js",t.onload=()=>e(),t.onerror=()=>a(new Error("Falha ao carregar script do Clicksign")),document.head.appendChild(t)}),Nh)}const Ch="clicksign-container";function kh({signerId:e,environment:s="sandbox",onSign:r,onError:n,onClose:o}){const{t:i}=y.useTranslation(),l=t.useRef(null),[c,u]=t.useState(!0),[m,p]=t.useState(null);return t.useEffect(()=>{let a=!1;return l.current&&(l.current.unmount(),l.current=null),p(null),u(!0),_h().then(()=>{if(a)return;const t=new window.Clicksign(e);t.endpoint="production"===s?"https://app.clicksign.com":"https://sandbox.clicksign.com",t.origin=window.origin,t.mount(Ch),t.on("loaded",function(){u(!1)}),t.on("signed",function(){r?.()}),t.on("resized",function(e){const a=e,t=document.getElementById(Ch);t&&a?.data?.height&&(t.style.height=a.data.height+"px")}),t.on("error",function(e){u(!1),n?.(e instanceof Error?e:new Error(i("sign_widget_error")))}),t.on("closed",function(){o?.()}),l.current=t}).catch(e=>{a||(p("Falha ao carregar o script de assinatura."),u(!1),n?.(e))}),()=>{a=!0,l.current&&(l.current.unmount(),l.current=null)}},[e,s]),a.jsxs("div",{className:"relative h-full",children:[c&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(d.Loader2,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Carregando documento..."})]})}),m&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("p",{className:"text-sm text-destructive",children:m})}),a.jsx("div",{id:Ch,style:{height:"600px"}})]})}function Sh({documentKey:s,signerEmail:r,signerName:n,keySigner:o,environment:i,onSign:l,onError:c}){const u=t.useRef(null),[m,p]=t.useState("loading"),[h,x]=t.useState(null),f="production"===i?"https://secure.d4sign.com.br/embed/viewblob":"https://sandbox.d4sign.com.br/embed/viewblob",g=(()=>{const e=new URLSearchParams({email:r,display_name:n||"",disable_preview:"0"});return o&&e.set("key_signer",o),`${f}/${s}?${e.toString()}`})(),v=t.useCallback(a=>"signed"===a.data?(p("ready"),void l?.()):"wrong-data"===a.data?(p("error"),x(e.t("sign_incorrect_data")),void c?.(new Error(e.t("sign_incorrect_data")))):void 0,[l,c]);t.useEffect(()=>(window.addEventListener("message",v,!1),()=>{window.removeEventListener("message",v,!1)}),[v]);const b=t.useCallback(()=>{"loading"===m&&p("ready")},[m]);return"error"===m?a.jsxs(si,{variant:"danger",className:"my-4",children:[a.jsx(ri,{children:e.t("sign_doc_load_error")}),a.jsx(ni,{children:h||"Ocorreu um erro inesperado ao carregar o documento para assinatura. Tente novamente."})]}):a.jsxs("div",{className:"relative h-full",children:["loading"===m&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(d.Loader2,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Carregando documento..."})]})}),a.jsx("iframe",{ref:u,id:"d4sign-container",src:g,width:"100%",style:{height:"600px",border:0},allow:"geolocation",onLoad:b})]})}var Th,Ph,Dh,Eh,Ah;exports.ETaskPlanStatus=void 0,(Th=exports.ETaskPlanStatus||(exports.ETaskPlanStatus={}))[Th.waitingStart=1]="waitingStart",Th[Th.running=2]="running",Th[Th.effectivenessCheck=3]="effectivenessCheck",Th[Th.done=4]="done",Th[Th.suspended=5]="suspended",Th[Th.canceled=6]="canceled",exports.ETaskPlanPriority=void 0,(Ph=exports.ETaskPlanPriority||(exports.ETaskPlanPriority={}))[Ph.low=0]="low",Ph[Ph.medium=1]="medium",Ph[Ph.high=2]="high",exports.ETaskPlanAssociationType=void 0,(Dh=exports.ETaskPlanAssociationType||(exports.ETaskPlanAssociationType={}))[Dh.plan=2]="plan",Dh[Dh.occurrence=3]="occurrence",Dh[Dh.risk=4]="risk",Dh[Dh.decisions=5]="decisions",Dh[Dh.audit=6]="audit",Dh[Dh.strategyExtension=7]="strategyExtension",Dh[Dh.standardization=8]="standardization",Dh[Dh.supplier=9]="supplier",Dh[Dh.auditItems=10]="auditItems",exports.ETaskPlanTypeProgress=void 0,(Eh=exports.ETaskPlanTypeProgress||(exports.ETaskPlanTypeProgress={}))[Eh.currentProgress=1]="currentProgress",Eh[Eh.cumulativeProgress=2]="cumulativeProgress",exports.EAttachmentItemStatus=void 0,(Ah=exports.EAttachmentItemStatus||(exports.EAttachmentItemStatus={})).uploading="uploading",Ah.waiting="waiting",Ah.done="done",Ah.error="error",Ah.canceled="canceled",Ah.duplicateItem="duplicateItem";const Ih={[exports.ETaskPlanStatus.waitingStart]:"#D6D6D6",[exports.ETaskPlanStatus.running]:"#DAE9F4",[exports.ETaskPlanStatus.effectivenessCheck]:"#1B75BB29",[exports.ETaskPlanStatus.done]:"#DDEECA",[exports.ETaskPlanStatus.suspended]:"#FFF2D6",[exports.ETaskPlanStatus.canceled]:"#F4433629"},Mh={[exports.ETaskPlanStatus.waitingStart]:"#666666",[exports.ETaskPlanStatus.running]:"#1B75BB",[exports.ETaskPlanStatus.effectivenessCheck]:"#1B75BB",[exports.ETaskPlanStatus.done]:"#4CAF50",[exports.ETaskPlanStatus.suspended]:"#FF9800",[exports.ETaskPlanStatus.canceled]:"#F44336"},Fh={[exports.ETaskPlanStatus.waitingStart]:"waiting-start",[exports.ETaskPlanStatus.running]:"running",[exports.ETaskPlanStatus.effectivenessCheck]:"effectiveness-check",[exports.ETaskPlanStatus.done]:"done",[exports.ETaskPlanStatus.suspended]:"suspended",[exports.ETaskPlanStatus.canceled]:"canceled"};function Rh(){return{[exports.ETaskPlanStatus.waitingStart]:e.t("ap_status_waiting_start"),[exports.ETaskPlanStatus.running]:e.t("ap_status_running"),[exports.ETaskPlanStatus.effectivenessCheck]:e.t("ap_status_effectiveness_check"),[exports.ETaskPlanStatus.done]:e.t("ap_status_done"),[exports.ETaskPlanStatus.suspended]:e.t("ap_status_suspended"),[exports.ETaskPlanStatus.canceled]:e.t("ap_status_canceled")}}const Lh=new Proxy({},{get:(e,a)=>{if("symbol"==typeof a)return;return Rh()[a]}});const zh=[{id:"immediate",label:"Imediata"},{id:"corrective",label:"Corretiva"},{id:"preventive",label:"Preventiva"},{id:"improvement",label:"Oportunidade de Melhoria"},{id:"standardization",label:"Padronização"}];const Uh=[{id:exports.ETaskPlanPriority.low,label:"Baixa",color:"#4CAF50"},{id:exports.ETaskPlanPriority.medium,label:"Média",color:"#FF9800"},{id:exports.ETaskPlanPriority.high,label:"Alta",color:"#F44336"}],Oh=[exports.ETaskPlanStatus.done,exports.ETaskPlanStatus.canceled],Vh=[exports.ETaskPlanStatus.waitingStart,exports.ETaskPlanStatus.running,exports.ETaskPlanStatus.effectivenessCheck,exports.ETaskPlanStatus.suspended];function Bh(e){const{actionPlan:a,isNew:s=!1,config:r,onSave:n,onCancel:o,onDelete:i,onChangeStatus:l}=e,[d,c]=t.useState({formData:a||{},isLoading:e.isLoading||!1,isSaving:!1,activeTab:"general",isFormDisabled:!1});t.useEffect(()=>{a&&c(e=>({...e,formData:a,isFormDisabled:r?.disableFields||Oh.includes(a.statusId)}))},[a,r?.disableFields]),t.useEffect(()=>{c(a=>({...a,isLoading:e.isLoading||!1}))},[e.isLoading]);const u=t.useCallback((e,a)=>{c(t=>({...t,formData:{...t.formData,[e]:a}}))},[]),m=t.useCallback(e=>{c(a=>({...a,activeTab:e}))},[]),p=t.useCallback(async()=>{if(n){c(e=>({...e,isSaving:!0}));try{await n(d.formData)}finally{c(e=>({...e,isSaving:!1}))}}},[n,d.formData]),h=t.useCallback(async e=>{if(l&&d.formData.id){c(e=>({...e,isLoading:!0}));try{await l(d.formData.id,e)}finally{c(e=>({...e,isLoading:!1}))}}},[l,d.formData.id]),x=t.useCallback(async()=>{if(i&&d.formData.id){c(e=>({...e,isLoading:!0}));try{await i(d.formData.id)}finally{c(e=>({...e,isLoading:!1}))}}},[i,d.formData.id]);return{formData:d.formData,isLoading:d.isLoading,isSaving:d.isSaving,activeTab:d.activeTab,isFormDisabled:d.isFormDisabled,updateField:u,setActiveTab:m,save:p,changeStatus:h,remove:x,cancel:o}}const qh={[exports.ETaskPlanStatus.waitingStart]:{label:"",color:"#8B7355",icon:d.Clock},[exports.ETaskPlanStatus.running]:{label:"",color:"#2E7D5B",icon:d.Play},[exports.ETaskPlanStatus.effectivenessCheck]:{label:"",color:"#4A6FA5",icon:d.ShieldCheck},[exports.ETaskPlanStatus.done]:{label:"",color:"#3D7A40",icon:d.CheckCircle2},[exports.ETaskPlanStatus.suspended]:{label:"",color:"#6B7280",icon:d.Pause},[exports.ETaskPlanStatus.canceled]:{label:"",color:"#B44A4A",icon:d.X}};function $h({status:e,labels:t,className:s,size:r,showIcon:n,variant:o}){const i=Rh(),l=qh[e];if(!l)return null;const d=t?.[e]||i[e]||"";return a.jsx(vu,{label:d,color:l.color,icon:l.icon,size:r,showIcon:n,variant:o,className:s})}function Wh({formData:e,updateField:s,disabled:r=!1,users:n=[],places:o=[],actionTypes:i,causes:l=[],parentActions:d=[],config:c}){const{t:u}=y.useTranslation(),m=c?.requiredFields,p=i||zh,h=e=>{if(c?.hiddenFields?.includes(e))return!1;if(c?.visibleFields&&c.visibleFields.length>0)return c.visibleFields.includes(e);const a=`${e}Visible`;return!m||!(a in m)||!1!==m[a]},x=e=>m?!!m[e]:"name"===e,f=t.useMemo(()=>{if(e.startDate&&e.endDate){const a=new Date(e.startDate),t=new Date(e.endDate).getTime()-a.getTime();return Math.max(0,Math.ceil(t/864e5))}return e.duration||0},[e.startDate,e.endDate,e.duration]);return a.jsxs("div",{className:"space-y-6 p-1",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("name")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Nome"}),a.jsx(Zt,{value:e.name||"",onChange:e=>s("name",e.target.value),maxLength:500,disabled:r,placeholder:u("ap_plan_name_placeholder")})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h("responsibleWho")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("responsibleWho")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Responsável"}),a.jsxs(Bs,{value:e.responsibleId||"",onValueChange:e=>s("responsibleId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_responsible")})}),a.jsx(Ks,{children:n.map(e=>a.jsx(Qs,{value:e.id,children:e.name},e.id))})]})]}),h("checkerWho")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("checkerWho")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Verificador"}),a.jsxs(Bs,{value:e.checkerId||"",onValueChange:e=>s("checkerId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_checker")})}),a.jsx(Ks,{children:n.map(e=>a.jsx(Qs,{value:e.id,children:e.name},e.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h("place")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("place")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Local"}),a.jsxs(Bs,{value:e.placeId||"",onValueChange:e=>s("placeId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_place")})}),a.jsx(Ks,{children:Hh(o).map(e=>a.jsx(Qs,{value:e.id,children:e.name},e.id))})]})]}),h("planType")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("planType")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Tipo de Ação"}),a.jsxs(Bs,{value:e.typeId||"",onValueChange:e=>s("typeId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_type")})}),a.jsx(Ks,{children:p.map(e=>a.jsx(Qs,{value:e.id,children:e.label},e.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h("priority")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("priority")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Prioridade"}),a.jsxs(Bs,{value:e.priorityType?.toString()||"",onValueChange:e=>s("priorityType",Number(e)),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_priority")})}),a.jsx(Ks,{children:Uh.map(e=>a.jsx(Qs,{value:e.id.toString(),children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:e.color}}),e.label]})},e.id))})]})]}),d.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:u("ap_belongs_to")}),a.jsxs(Bs,{value:e.parentId||"",onValueChange:e=>s("parentId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_parent")})}),a.jsx(Ks,{children:d.map(e=>a.jsx(Qs,{value:e.id,children:e.label},e.id))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[h("startDate")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("startDate")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Data de Início"}),a.jsx(kl,{date:e.startDate?new Date(e.startDate):void 0,onDateChange:e=>s("startDate",e||null),disabled:r,placeholder:u("ap_select_date")})]}),h("endDate")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("endDate")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Data de Término"}),a.jsx(kl,{date:e.endDate?new Date(e.endDate):void 0,onDateChange:e=>s("endDate",e||null),disabled:r,placeholder:u("ap_select_date"),disabledDates:e.startDate?a=>a<new Date(e.startDate):void 0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:u("ap_duration_days")}),a.jsx(Zt,{type:"number",value:f,disabled:!0,className:"bg-muted"})]})]}),h("estimatedCost")&&a.jsxs("div",{className:"space-y-2 max-w-xs",children:[a.jsx(as,{className:Kt(x("estimatedCost")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Custo Estimado"}),a.jsxs("div",{className:"relative",children:[a.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"R$"}),a.jsx(Zt,{type:"number",min:0,step:.01,value:e.estimatedCost||"",onChange:e=>s("estimatedCost",Number(e.target.value)),disabled:r,className:"pl-9",placeholder:"0,00"})]})]}),h("cause")&&l.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Causa"}),a.jsxs(Bs,{value:e.causeId||"",onValueChange:e=>s("causeId",e),disabled:r,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:u("ap_select_cause")})}),a.jsx(Ks,{children:l.map(e=>a.jsx(Qs,{value:e.id,children:e.label},e.id))})]})]}),h("description")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("description")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Descrição"}),a.jsx(Zs,{value:e.description||"",onChange:e=>s("description",e.target.value),maxLength:4e3,disabled:r,rows:4,placeholder:u("ap_description_placeholder")})]}),h("justification")&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{className:Kt(x("justification")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Justificativa"}),a.jsx(Zs,{value:e.justification||"",onChange:e=>s("justification",e.target.value),maxLength:4e3,disabled:r,rows:4,placeholder:u("ap_justification_placeholder")})]})]})}function Hh(e,a=0){const t=[];for(const s of e)t.push({...s,depth:a}),s.children?.length&&t.push(...Hh(s.children,a+1));return t}function Gh(e){const{progress:a,onReportProgress:s,onEditProgress:r,onDeleteProgress:n}=e,[o,i]=t.useState(!1),[l,d]=t.useState(null),c=!!a&&Vh.includes(a.status),u=t.useCallback(async e=>{if(s&&a){i(!0);try{const t=100===e.percentProgress;await s({id:a.id,...e,conclude:t})}finally{i(!1)}}},[s,a]),m=t.useCallback(async e=>{if(r){i(!0);try{await r(e)}finally{i(!1),d(null)}}},[r]),p=t.useCallback(async e=>{if(n){i(!0);try{await n(e)}finally{i(!1)}}},[n]);return{progress:a,canReportProgress:c,isSubmitting:o,editingReport:l,setEditingReport:d,reportProgress:u,editProgress:m,deleteProgress:p}}function Kh(e){if(!e)return"";let a=(e||"").trim();if(!a)return"00:00";if(a.includes(":")){const e=a.split(":");if(e.length>=2){const a=e[0].replace(/\D/g,""),t=e[1].replace(/\D/g,"");let s=parseInt(a)||0,r=parseInt(t)||0;return s+=Math.floor(r/60),r%=60,`${s.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}}if(a=a.replace(/\D/g,""),!a)return"00:00";let t=0,s=0;return 4===a.length?(t=parseInt(a.substring(0,2))||0,s=parseInt(a.substring(2,4))||0,t+=Math.floor(s/60),s%=60):(t=parseInt(a)||0,s=0),`${t.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}function Yh(e){if(null==e)return"00:00";const a=String(e).replace(/\D/g,"");if(a.length<3){let e=parseInt(a)||0;const t=Math.floor(e/60);return e%=60,`${t.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`}{const e=a.slice(-2),t=a.slice(0,-2);let s=parseInt(t)||0,r=parseInt(e)||0;return s+=Math.floor(r/60),r%=60,`${s.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}}function Qh(e){return 100===e?"#84c148":e>0?"#1b75bb":""}function Xh({open:e,onOpenChange:s,report:r,onSave:n,isSubmitting:o=!1}){const{t:i}=y.useTranslation(),[l,d]=t.useState(r?.percentProgress||0),[c,u]=t.useState(r?.timeProgress||""),[m,p]=t.useState(r?.comments||""),h=l!==(r?.percentProgress??0)||c!==(r?.timeProgress??"")||m!==(r?.comments??"");t.useEffect(()=>{r&&(d(r.percentProgress),u(r.timeProgress||""),p(r.comments||""))},[r]);return a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:"sm:max-w-md",variant:"form",isDirty:h,children:[a.jsx(Ss,{children:a.jsx(Ds,{children:i("ap_edit_progress")})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:i("ap_progress_percent")}),a.jsx(Zt,{type:"number",min:0,max:100,value:l,onChange:e=>d(Number(e.target.value))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:i("ap_time_spent")}),a.jsx(Zt,{value:c,onChange:e=>u(e.target.value),onBlur:()=>u(Kh(c)||""),placeholder:"00:00"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:i("ap_comments")}),a.jsx(Zs,{value:m,onChange:e=>p(e.target.value),rows:3,maxLength:4e3})]})]}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:()=>s(!1),disabled:o,children:"Cancelar"}),a.jsx(Xt,{onClick:()=>{r&&n({...r,percentProgress:l,timeProgress:Kh(c)||"00:00",comments:m})},disabled:o,children:o?"Salvando...":"Salvar"})]})]})})}function Jh(e){const{t:s}=y.useTranslation(),{progress:r,canReportProgress:n,isSubmitting:o,editingReport:i,setEditingReport:l,reportProgress:d,editProgress:c,deleteProgress:u}=Gh(e),[m,p]=t.useState(""),[h,x]=t.useState(""),[f,g]=t.useState("");if(!r)return a.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Sem dados de progresso disponíveis"});const v=Qh(r.percentProgress),b=!m,j=!m&&!h&&!f;return a.jsxs("div",{className:"space-y-6 p-1",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"font-medium",children:s("ap_overall_progress")}),a.jsxs("span",{className:"font-semibold",style:{color:v||void 0},children:[r.percentProgress,"%"]})]}),a.jsx(Nd,{value:r.percentProgress,className:"h-3"}),r.timeProgress&&a.jsxs("div",{className:"text-xs text-muted-foreground",children:["Tempo total: ",Yh(r.timeProgress)]})]}),n&&a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-4",children:[a.jsx("h4",{className:"text-sm font-medium",children:s("ap_report_progress")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:s("ap_progress_percent")}),a.jsx(Zt,{type:"number",min:0,max:100,value:m,onChange:e=>p(e.target.value),placeholder:"0"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:s("ap_time_spent")}),a.jsx(Zt,{value:h,onChange:e=>x(e.target.value),onBlur:()=>x(Kh(h)||""),placeholder:"00:00"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:s("ap_comments")}),a.jsx(Zs,{value:f,onChange:e=>g(e.target.value),rows:3,maxLength:4e3,placeholder:s("ap_progress_comment_placeholder")})]}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>{p(""),x(""),g("")},disabled:j||o,children:"Limpar"}),a.jsx(Xt,{size:"sm",onClick:async()=>{const e=Number(m);(e||0===e)&&(await d({percentProgress:e,timeProgress:Kh(h)||"00:00",comments:f}),p(""),x(""),g(""))},disabled:b||o,children:o?"Reportando...":"Reportar"})]})]}),r.reports.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-sm font-medium",children:s("ap_reports_history")}),a.jsx("div",{className:"space-y-2",children:r.reports.map(e=>a.jsx(Zh,{report:e,onEdit:()=>l(e),onDelete:()=>u(e.id),disabled:!n},e.id))})]}),a.jsx(Xh,{open:!!i,onOpenChange:e=>!e&&l(null),report:i,onSave:c,isSubmitting:o})]})}function Zh({report:t,onEdit:s,onDelete:r,disabled:n}){const o=t.date?new Date(t.date):null,i=Qh(t.percentProgress);return a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-card p-3",children:[a.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground",children:t.userName?.charAt(0)?.toUpperCase()||"?"}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"font-medium truncate",children:t.userName}),o&&a.jsx("span",{className:"text-xs text-muted-foreground",children:o.toLocaleDateString("pt-BR")})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("span",{style:{color:i||void 0},className:"font-semibold",children:[t.percentProgress,"%"]}),t.timeProgress&&a.jsxs("span",{children:["Tempo: ",Yh(t.timeProgress)]})]}),t.comments&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.comments})]}),!n&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Jt,{})}),a.jsxs(hr,{align:"end",children:[a.jsx(xr,{onClick:s,children:e.t("edit")}),a.jsx(xr,{className:"text-destructive",onClick:r,children:e.t("ap_delete")})]})]})]})}function ex({predecessors:e=[],availablePredecessors:s=[],onAdd:r,onRemove:n,disabled:o=!1}){const{t:i}=y.useTranslation(),[l,c]=t.useState(""),u=s.filter(a=>!e.some(e=>e.predecessorId===a.id));return a.jsxs("div",{className:"space-y-6 p-1",children:[!o&&u.length>0&&a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx(as,{children:i("ap_add_predecessor")}),a.jsxs(Bs,{value:l,onValueChange:c,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:i("ap_select_action")})}),a.jsx(Ks,{children:u.map(e=>a.jsx(Qs,{value:e.id,children:e.label},e.id))})]})]}),a.jsxs(Xt,{size:"sm",onClick:()=>{l&&r&&(r(l),c(""))},disabled:!l,children:[a.jsx(d.Plus,{className:"h-4 w-4 mr-1"}),"Adicionar"]})]}),e.length>0?a.jsx("div",{className:"space-y-2",children:e.map(e=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[e.predecessorCode&&a.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:e.predecessorCode}),a.jsx("span",{className:"text-sm font-medium",children:e.predecessorName}),null!=e.predecessorStatus&&a.jsx($h,{status:e.predecessorStatus})]}),!o&&n&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Jt,{})}),a.jsx(hr,{align:"end",children:a.jsx(xr,{className:"text-destructive",onClick:()=>n(e.predecessorId),children:"Remover"})})]})]},e.id))}):a.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Nenhum predecessor adicionado"})]})}function ax({costs:e=[],onAdd:s,onEdit:r,onDelete:n,disabled:o=!1}){const{t:i}=y.useTranslation(),[l,c]=t.useState(""),[u,m]=t.useState(""),p=e.reduce((e,a)=>e+(a.value||0),0);return a.jsxs("div",{className:"space-y-6 p-1",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium",children:i("ap_total_cost")}),a.jsxs("span",{className:"text-lg font-semibold text-foreground",children:["R$ ",p.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),!o&&s&&a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-4",children:[a.jsx("h4",{className:"text-sm font-medium",children:i("ap_add_cost")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Descrição"}),a.jsx(Zt,{value:l,onChange:e=>c(e.target.value),placeholder:i("ap_cost_description")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Valor (R$)"}),a.jsx(Zt,{type:"number",min:0,step:.01,value:u,onChange:e=>m(e.target.value),placeholder:"0,00"})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Xt,{size:"sm",onClick:()=>{l&&u&&s&&(s({description:l,value:Number(u),date:(new Date).toISOString()}),c(""),m(""))},disabled:!l||!u,children:[a.jsx(d.Plus,{className:"h-4 w-4 mr-1"}),"Adicionar"]})})]}),e.length>0?a.jsx("div",{className:"space-y-2",children:e.map(e=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:e.description}),e.date&&a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(e.date).toLocaleDateString("pt-BR")})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-sm font-semibold whitespace-nowrap",children:["R$ ",e.value.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})]}),!o&&(r||n)&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Jt,{})}),a.jsxs(hr,{align:"end",children:[r&&a.jsx(xr,{onClick:()=>r(e),children:i("edit")}),n&&a.jsx(xr,{className:"text-destructive",onClick:()=>n(e.id),children:i("ap_delete")})]})]})]})]},e.id))}):a.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Nenhum custo registrado"})]})}function tx({comments:e=[],currentUserId:s,onAdd:r,onEdit:n,onDelete:o,disabled:i=!1,maxLength:l=4e3}){const{t:c}=y.useTranslation(),[u,m]=t.useState(""),[p,h]=t.useState(!1),[x,f]=t.useState(null),[g,v]=t.useState(""),b=()=>{f(null),v("")};return a.jsxs("div",{className:"space-y-6 p-1",children:[!i&&r&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(Zs,{value:u,onChange:e=>m(e.target.value),placeholder:c("ap_add_comment_placeholder"),maxLength:l,rows:3}),a.jsxs("div",{className:"flex items-center justify-between",children:[l&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.length,"/",l]}),a.jsxs("div",{className:"flex gap-2 ml-auto",children:[a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>m(""),disabled:!u||p,children:"Limpar"}),a.jsx(Xt,{size:"sm",onClick:async()=>{if(u.trim()&&r){h(!0);try{await r(u),m("")}finally{h(!1)}}},disabled:!u.trim()||p,children:p?"Enviando...":"Comentar"})]})]})]}),a.jsxs("div",{className:"space-y-1",children:[e.length>0?a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx("span",{className:"text-sm font-medium",children:c("ap_comments")}),a.jsx(ar,{variant:"info",className:"text-[10px] px-1.5 py-0",children:e.length})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a.jsx(d.MessageSquare,{className:"h-8 w-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"Nenhum comentário adicionado"})]}),e.map(e=>a.jsxs("div",{className:"flex gap-3 rounded-lg border bg-card p-3",children:[a.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground overflow-hidden",children:e.userPhotoUrl?a.jsx("img",{src:e.userPhotoUrl,alt:e.userName,className:"h-full w-full object-cover"}):e.userName?.charAt(0)?.toUpperCase()||"?"}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"font-medium truncate",children:e.userName}),e.userEmail&&a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.userEmail}),a.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:sx(e.dateEdited||e.dateCreation)}),e.dateEdited&&a.jsx("span",{className:"text-xs text-muted-foreground italic",children:"editado"})]}),x===e.id?a.jsxs("div",{className:"space-y-2",children:[a.jsx(Zs,{value:g,onChange:e=>v(e.target.value),maxLength:l,rows:3}),a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.jsx(Xt,{variant:"outline",size:"sm",onClick:b,disabled:p,children:"Cancelar"}),a.jsx(Xt,{size:"sm",onClick:()=>(async e=>{if(g.trim()&&n){h(!0);try{await n({...e,text:g,stringText:g}),f(null),v("")}finally{h(!1)}}})(e),disabled:!g.trim()||p,children:p?"Salvando...":"Salvar"})]})]}):a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.stringText||e.text})]}),!i&&s===e.userId&&x!==e.id&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Jt,{})}),a.jsxs(hr,{align:"end",children:[n&&a.jsx(xr,{onClick:()=>(e=>{f(e.id),v(e.stringText||e.text)})(e),children:c("edit")}),o&&a.jsx(xr,{className:"text-destructive",onClick:()=>(async e=>{if(o){h(!0);try{await o(e)}finally{h(!1)}}})(e.id),children:"Excluir"})]})]})]},e.id))]})]})}function sx(e){const{t:a}=y.useTranslation();if(!e)return"";const t=new Date(e);return`${t.toLocaleDateString("pt-BR")} ${t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}`}function rx({history:e=[],isLoading:t=!1}){const{t:s}=y.useTranslation();return t?a.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Carregando histórico..."}):0===e.length?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a.jsx(d.Clock,{className:"h-8 w-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:s("ap_no_history")})]}):a.jsx("div",{className:"p-1",children:a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-4 top-0 bottom-0 w-px bg-border"}),a.jsx("div",{className:"space-y-0",children:e.map((e,t)=>a.jsxs("div",{className:"relative flex gap-4 pb-6 last:pb-0",children:[a.jsx("div",{className:"relative z-10 flex-shrink-0 h-8 w-8 rounded-full bg-primary/10 border-2 border-primary/30 flex items-center justify-center",children:e.icon?a.jsx("span",{className:"text-xs text-primary",children:e.icon}):a.jsx("div",{className:"h-2 w-2 rounded-full bg-primary"})}),a.jsxs("div",{className:"flex-1 min-w-0 rounded-lg border bg-card p-3 space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:e.translateEvent||e.eventName}),e.eventDescription&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.eventDescription})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-shrink-0 h-6 w-6 rounded-full bg-muted overflow-hidden flex items-center justify-center text-[10px] font-medium text-muted-foreground",children:e.userPhotoUrl?a.jsx("img",{src:e.userPhotoUrl,alt:e.userName,className:"h-full w-full object-cover"}):e.userName?.charAt(0)?.toUpperCase()||"?"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{className:"text-xs font-medium truncate block",children:e.userName}),e.userEmail&&a.jsx("span",{className:"text-[10px] text-muted-foreground truncate block",children:e.userEmail})]})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(d.Calendar,{className:"h-3 w-3"}),a.jsx("span",{children:nx(e.date)})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(d.Clock,{className:"h-3 w-3"}),a.jsx("span",{children:ox(e.date)})]}),e.isMobileRequest&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(d.Smartphone,{className:"h-3 w-3"}),a.jsx("span",{children:s("ap_via_app")})]})]})]})]},e.id))})]})})}function nx(e){const{t:a}=y.useTranslation();return new Date(e).toLocaleDateString("pt-BR")}function ox(e){const{t:a}=y.useTranslation();return new Date(e).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function ix({attachments:e=[],onUpload:s,onDelete:r,onRename:n,onDownload:o,onView:i,disabled:l=!1}){const{t:c}=y.useTranslation(),u=t.useRef(null),[m,p]=t.useState(null),[h,x]=t.useState(""),f=async e=>{h.trim()&&n&&(await n(e.id,h),p(null),x(""))},g=()=>{p(null),x("")};return a.jsxs("div",{className:"space-y-4 p-1",children:[!l&&s&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:e=>{const a=e.target.files;if(a&&s){for(let e=0;e<a.length;e++){const t=a.item(e);t&&s(t)}u.current&&(u.current.value="")}}}),a.jsxs(Xt,{size:"sm",onClick:()=>u.current?.click(),children:[a.jsx(d.Plus,{className:"h-4 w-4 mr-1"}),"Adicionar anexo"]})]}),e.length>0?a.jsx("div",{className:"space-y-2",children:e.map(e=>a.jsxs("div",{className:Kt("flex items-center gap-3 rounded-lg border bg-card p-3",e.status===exports.EAttachmentItemStatus.error&&"border-destructive/50 bg-destructive/5",e.status===exports.EAttachmentItemStatus.canceled&&"opacity-50"),children:[a.jsx("div",{className:"flex-shrink-0 h-9 w-9 rounded bg-muted flex items-center justify-center",children:a.jsx("span",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:e.extension.replace(".","").substring(0,4)})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[m===e.id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{className:"flex-1 text-sm border rounded px-2 py-1 bg-background",value:h,onChange:e=>x(e.target.value),onKeyDown:a=>{"Enter"===a.key&&f(e),"Escape"===a.key&&g()},autoFocus:!0}),a.jsx(Xt,{size:"sm",variant:"outline",onClick:g,children:c("cancel")}),a.jsx(Xt,{size:"sm",onClick:()=>f(e),children:c("save")})]}):a.jsx("button",{type:"button",className:"text-sm font-medium truncate block text-left hover:underline cursor-pointer",onClick:()=>i?.(e.id),children:e.name}),(e.status===exports.EAttachmentItemStatus.uploading||e.status===exports.EAttachmentItemStatus.waiting)&&a.jsx(Nd,{value:e.progress||0,className:"h-1.5"}),e.status===exports.EAttachmentItemStatus.error&&a.jsx("p",{className:"text-xs text-destructive",children:"Erro ao enviar arquivo"}),e.status===exports.EAttachmentItemStatus.duplicateItem&&a.jsx("p",{className:"text-xs text-warning",children:"Arquivo duplicado"}),e.status===exports.EAttachmentItemStatus.canceled&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload cancelado"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.status===exports.EAttachmentItemStatus.done&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:lx(e.size)}),a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Jt,{})}),a.jsxs(hr,{align:"end",children:[n&&!l&&a.jsx(xr,{onClick:()=>(e=>{const a=e.name.replace(e.extension,"");p(e.id),x(a)})(e),children:"Renomear"}),i&&a.jsx(xr,{onClick:()=>i(e.id),children:"Visualizar"}),o&&a.jsx(xr,{onClick:()=>o(e.id),children:"Download"}),r&&!l&&a.jsxs(a.Fragment,{children:[a.jsx(br,{}),a.jsx(xr,{className:"text-destructive",onClick:()=>r(e.id),children:"Excluir"})]})]})]})]}),e.status===exports.EAttachmentItemStatus.uploading&&a.jsx(Xt,{variant:"outline",size:"sm",onClick:()=>r?.(e.id),children:"Cancelar"})]})]},e.id))}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a.jsx(d.Paperclip,{className:"h-8 w-8 mb-2 opacity-50"}),a.jsx("p",{className:"text-sm",children:"Nenhum anexo adicionado"})]})]})}function lx(e){const{t:a}=y.useTranslation();if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(1))} ${["B","KB","MB","GB"][t]}`}const dx=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function cx(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const a=e/1024;if(a<1024)return`${Math.round(a)} KB`;const t=a/1024;if(t<1024)return`${Math.round(t)} MB`;const s=t/1024;return Math.round(100*s)/100+" GB"}function ux(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}var mx,px,hx;function xx(e){switch(e.type){case exports.ECustomFormFieldType.text:return e.textValue;case exports.ECustomFormFieldType.number:return e.numberValue;case exports.ECustomFormFieldType.date:return e.dateValue;case exports.ECustomFormFieldType.time:return e.timeValue;case exports.ECustomFormFieldType.url:case exports.ECustomFormFieldType.singleSelection:case exports.ECustomFormFieldType.multiSelection:return e.itemsValue;case exports.ECustomFormFieldType.questions:return e.questionsValue;case exports.ECustomFormFieldType.readOnlyText:return e.textValue;default:return null}}function fx(e,a){if(!a)return!0;const t=null!=xx(e)&&""!==xx(e)&&!(Array.isArray(xx(e))&&0===xx(e).length);return!1!==e.isActive||t}function gx({field:e}){return a.jsxs("div",{className:"space-y-1",children:[e.name&&a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function vx({field:e,readOnly:t,onChange:s}){const r=e.config,n=r?.multiline??!1,o=t||e.readOnly,i=a=>{s?.({...e,textValue:a})};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?a.jsx(Zs,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):a.jsx(Zt,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function bx({field:e,readOnly:t,onChange:s}){const r=t||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(Zt,{type:"date",value:n,onChange:a=>{return t=a.target.value,void s?.({...e,dateValue:t||void 0});var t},placeholder:e.placeholder,disabled:r})]})}function yx({field:e,readOnly:t,onChange:s}){const r=t||e.readOnly,n=e=>{if(!e)return;const[a,t]=e.split(":").map(Number);return 60*a+t};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(Zt,{type:"time",value:(e=>{if(null==e)return"";const a=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`})(e.timeValue),onChange:a=>s?.({...e,timeValue:n(a.target.value)}),placeholder:e.placeholder,disabled:r})]})}function jx({field:e,readOnly:s,onChange:r}){const n=e.config,o=n?.multiple??!1,i=s||e.readOnly,[l,c]=t.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const a={value:crypto.randomUUID(),text:l.trim()};r?.({...e,itemsValue:[...u,a]}),c("")};if(!o){const t=u[0]?.text||"";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zt,{type:"url",value:t,onChange:a=>(a=>{const t={value:a,text:a};r?.({...e,itemsValue:a?[t]:[]})})(a.target.value),placeholder:e.placeholder||"https://",disabled:i}),t&&a.jsx(Xt,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:a.jsx(d.ExternalLink,{className:"h-4 w-4"})})})]})]})}return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zt,{type:"url",value:l,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a.jsx(Xt,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:a.jsx(d.Plus,{className:"h-4 w-4"})})]}),u.length>0&&a.jsx("div",{className:"space-y-1",children:u.map((t,s)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("a",{href:t.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:t.text}),!i&&a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(a=>{const t=u.filter((e,t)=>t!==a);r?.({...e,itemsValue:t})})(s),children:a.jsx(d.Trash2,{className:"h-3 w-3"})})]},t.value))})]})}function wx({field:e,readOnly:t,onChange:s}){const r=e.config,n=t||e.readOnly,o=null!=r?.decimals&&r.decimals>0?(1/Math.pow(10,r.decimals)).toString():"1";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(Zt,{type:"number",value:e.numberValue??"",onChange:a=>(a=>{if(""===a)return void s?.({...e,numberValue:void 0});const t=parseFloat(a);isNaN(t)||s?.({...e,numberValue:t})})(a.target.value),placeholder:e.placeholder,disabled:n,min:r?.min,max:r?.max,step:o}),null!=r?.min&&null!=r?.max&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",r.min," | Max: ",r.max]})]})}function Nx({field:e,readOnly:t,onChange:s}){const r=e.config,n=t||e.readOnly,o=r?.viewMode??exports.EFieldViewMode.dropdown,i=r?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],l=e.itemsValue?.[0]?.value||"",d=a=>{const t=i.find(e=>e.value===a);if(!t)return;const r={value:t.value,text:t.text,isActive:t.isActive};s?.({...e,itemsValue:[r]})};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===exports.EFieldViewMode.dropdown&&a.jsxs(Bs,{value:l,onValueChange:d,disabled:n,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:e.placeholder||"Selecione..."})}),a.jsx(Ks,{children:i.map(e=>a.jsxs(Qs,{value:e.value,children:[e.text,!1===e.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===exports.EFieldViewMode.radio||o===exports.EFieldViewMode.buttons)&&a.jsx(_d,{value:l,onValueChange:d,disabled:n,className:Kt(o===exports.EFieldViewMode.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(t=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Cd,{value:t.value,id:`${e.id}-${t.value}`}),a.jsxs(as,{htmlFor:`${e.id}-${t.value}`,className:"text-sm font-normal cursor-pointer",children:[t.text,!1===t.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},t.value))}),!n&&l&&!e.required&&a.jsx("button",{type:"button",onClick:()=>{s?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function _x({field:e,readOnly:t,onChange:s}){const r=e.config,n=t||e.readOnly,o=r?.viewMode??exports.EFieldViewMode.dropdown,i=r?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(t=>a.jsxs(ar,{variant:"secondary",className:"gap-1 pr-1",children:[a.jsx("span",{className:"text-xs",children:t.text}),!n&&a.jsx("button",{type:"button",onClick:()=>(a=>{const t=(e.itemsValue||[]).filter(e=>e.value!==a);s?.({...e,itemsValue:t})})(t.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:a.jsx(d.X,{className:"h-3 w-3"})})]},t.value))}),!n&&a.jsx("div",{className:Kt(o===exports.EFieldViewMode.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(t=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Js,{id:`${e.id}-${t.value}`,checked:l.has(t.value),onCheckedChange:()=>(a=>{const t=e.itemsValue||[],r=t.some(e=>e.value===a.value)?t.filter(e=>e.value!==a.value):[...t,{value:a.value,text:a.text,isActive:a.isActive}];s?.({...e,itemsValue:r})})(t),disabled:n}),a.jsxs(as,{htmlFor:`${e.id}-${t.value}`,className:"text-sm font-normal cursor-pointer",children:[t.text,!1===t.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},t.value))})]})}function Cx({field:e,readOnly:t,onChange:s}){const r=e.config,n=t||e.readOnly,o=r?.questions||[],i=r?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{children:e.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{className:Kt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx("div",{className:"border rounded-md overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50",children:[a.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>a.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),a.jsx("tbody",{children:o.map((t,r)=>a.jsxs("tr",{className:Kt(r<o.length-1&&"border-b"),children:[a.jsx("td",{className:"p-2 text-muted-foreground",children:t.text}),i.map(r=>{return a.jsx("td",{className:"text-center p-2",children:a.jsx(_d,{value:(o=t.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:a=>((a,t,r,n)=>{const o={questionValue:a,questionText:t,optionValue:r,optionText:n},i=l.filter(e=>e.questionValue!==a);i.push(o),s?.({...e,questionsValue:i})})(t.value,t.text,a,r.text),disabled:n,className:"flex justify-center",children:a.jsx(Cd,{value:r.value,id:`${e.id}-${t.value}-${r.value}`})})},r.value);var o})]},t.value))})]})})]})}function kx({field:e,readOnly:t,onChange:s}){const r={field:e,readOnly:t,onChange:s};switch(e.type){case exports.ECustomFormFieldType.readOnlyText:return a.jsx(gx,{...r});case exports.ECustomFormFieldType.text:return a.jsx(vx,{...r});case exports.ECustomFormFieldType.date:return a.jsx(bx,{...r});case exports.ECustomFormFieldType.time:return a.jsx(yx,{...r});case exports.ECustomFormFieldType.url:return a.jsx(jx,{...r});case exports.ECustomFormFieldType.number:return a.jsx(wx,{...r});case exports.ECustomFormFieldType.singleSelection:return a.jsx(Nx,{...r});case exports.ECustomFormFieldType.multiSelection:return a.jsx(_x,{...r});case exports.ECustomFormFieldType.questions:return a.jsx(Cx,{...r});default:return null}}function Sx({queryParams:e,events:s,softwares:r,users:n=[],permissions:o={viewAllEvents:!0,viewOnlyMyEvents:!1,download:!1},isLoading:i=!1,onFilter:l,onReset:c,onExport:u,onSoftwareChange:m}){const[p,h]=t.useState(e.softwareId),[x,f]=t.useState(e.eventId),[g,v]=t.useState(e.userId||"all"),[b,y]=t.useState(Tx(e.startDate)),[j,w]=t.useState(Tx(e.endDate)),N=t.useCallback(e=>{const a=parseInt(e);h(a),m?.(a)},[m]),_=t.useCallback(()=>{l({...e,softwareId:p,eventId:x,userId:"all"===g?void 0:g,startDate:new Date(b),endDate:new Date(j),software:r.find(e=>e.id===p)?.software||e.software,event:s.find(e=>e.id===x)?.name||e.event})},[e,p,x,g,b,j,r,s,l]),C=t.useCallback(()=>{const a=new Date;a.setHours(0,0,0,0),y(Tx(a)),w(Tx(a)),f(e.eventId),o.viewAllEvents&&v("all"),c?.()},[e.eventId,o.viewAllEvents,c]),k=o.viewOnlyMyEvents&&!o.viewAllEvents,S=p&&x&&b&&j;return a.jsxs("div",{className:"flex flex-wrap items-end gap-3 rounded-lg border border-border bg-card p-3",children:[a.jsxs("div",{className:"flex flex-col gap-1 min-w-[180px]",children:[a.jsx(as,{className:"text-xs text-muted-foreground",children:"Módulo *"}),a.jsxs(Bs,{value:String(p),onValueChange:N,disabled:i,children:[a.jsx(Ws,{className:"h-8 text-xs",children:a.jsx($s,{placeholder:"Selecione..."})}),a.jsx(Ks,{children:r.map(e=>a.jsx(Qs,{value:String(e.id),className:"text-xs",children:e.translation},e.id))})]})]}),a.jsxs("div",{className:"flex flex-col gap-1 min-w-[200px]",children:[a.jsx(as,{className:"text-xs text-muted-foreground",children:"Evento *"}),a.jsxs(Bs,{value:String(x),onValueChange:e=>f(parseInt(e)),disabled:i,children:[a.jsx(Ws,{className:"h-8 text-xs",children:a.jsx($s,{placeholder:"Selecione..."})}),a.jsx(Ks,{children:s.map(e=>a.jsx(Qs,{value:String(e.id),className:"text-xs",children:e.translation},e.id))})]})]}),a.jsxs("div",{className:"flex flex-col gap-1 min-w-[200px]",children:[a.jsx(as,{className:"text-xs text-muted-foreground",children:"Usuário *"}),a.jsxs(Bs,{value:g,onValueChange:v,disabled:i||k,children:[a.jsx(Ws,{className:"h-8 text-xs",children:a.jsx($s,{placeholder:"Selecione..."})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"all",className:"text-xs",children:"Todos"}),n.map(e=>a.jsx(Qs,{value:e.id,className:"text-xs",children:e.name},e.id))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px]",children:[a.jsx(as,{className:"text-xs text-muted-foreground",children:"De *"}),a.jsx(Zt,{type:"date",value:b,onChange:e=>y(e.target.value),className:"h-8 text-xs",max:j,disabled:i})]}),a.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px]",children:[a.jsx(as,{className:"text-xs text-muted-foreground",children:"Até *"}),a.jsx(Zt,{type:"date",value:j,onChange:e=>w(e.target.value),className:"h-8 text-xs",min:b,disabled:i})]}),a.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[a.jsxs(Xt,{variant:"outline",size:"sm",onClick:C,disabled:i,children:[a.jsx(d.RotateCcw,{className:"h-3.5 w-3.5 mr-1"}),"Limpar"]}),o.download&&u&&a.jsxs(Xt,{variant:"outline",size:"sm",onClick:()=>u("xlsx"),disabled:i,children:[a.jsx(d.Download,{className:"h-3.5 w-3.5 mr-1"}),"Exportar"]}),a.jsxs(Xt,{size:"sm",onClick:_,disabled:i||!S,children:[a.jsx(d.Filter,{className:"h-3.5 w-3.5 mr-1"}),"Filtrar"]})]})]})}function Tx(e){return(e instanceof Date?e:new Date(e)).toISOString().split("T")[0]}function Px(e,a,t,s="Anônimo"){return e.map(e=>({...e,translatedSoftware:Ex(e.software,t),user:e.userEmail||e.userName||s,translatedEvent:Dx(e.eventName,a),date:new Date(e.dateTime)})).sort((e,a)=>(a.date?.getTime()??0)-(e.date?.getTime()??0))}function Dx(e,a){const t=a.find(a=>a.name===e);return t?.translation||e}function Ex(e,a){const t=e.includes(".")?e.split(".").pop():e,s=a.find(e=>e.software===t);return s?.translation||t}function Ax(e,a){const t=[],s={...Ux,...a?.labels},r=e.eventName;t.push({name:s.event,value:r});const n=e.entities?.[0];if(n&&(t.push({name:s.entityName,value:Ix(n)}),n.description&&t.push({name:s.description,value:n.description}),n.justification&&t.push({name:s.justification,value:n.justification}),n.statusName&&t.push({name:s.status,value:n.statusName}),n.equipmentType&&t.push({name:s.type,value:n.equipmentType}),n.extra?.length)){[...new Set(n.extra.map(e=>e.property))].forEach(e=>{const a=n.extra.filter(a=>a.property===e).map(e=>e.value||"").join(", ");t.push({name:Lx(e),value:a})})}e.entities?.forEach(e=>{e.data?.forEach(e=>{if("Removed"===e.property)return;if(""===e.newValue&&!e.tagTranslate)return;const n=Mx(e,r,a?.translateProperty),o=Fx(e,null,r,s,a);o&&t.push({name:n,value:o})})}),e.entities?.forEach(e=>{if(e.association?.length){const a=e.association.filter(e=>""!==e.id).map(e=>{const a=Ix(e);return`(${e.softwareName||e.type}) ${a}`});a.length&&t.push({name:s.references,value:a.join(", ")})}}),n?.isElectronicSigned&&t.push({name:s.security,value:"🛡️ "+s.electronicSigned}),t.push({name:s.accomplishedBy,value:e.userName?`${e.userName} (${e.userEmail})`:e.userEmail});const o=a?.formatDate?a.formatDate(e.dateTime):zx(e.dateTime);return t.push({name:s.accomplishedIn,value:o}),t}function Ix(e){return e.code&&e.name&&e.code!==e.name?`${e.code} ${e.name}`:e.name||e.code||""}function Mx(e,a,t){if(e.propertyCustomName)return e.propertyCustomName;const s=Lx(e.property);return t?t(a,s):s}function Fx(e,a,t,s,r){if(e.propertyResource||(e.propertyResource=a?`${a.propertyResource}.${e.property}`:e.property),e.children?.length){if(e.newValue){const a=Mx(e,t,r?.translateProperty),n=function(e,a){switch(e.state){case"Added":return a.stateAdded;case"Modified":return e.children?.some(e=>"Removed"===e.property)?a.stateRemoved:a.stateModified;default:return""}}(e,s);let o=`${a}: "${Rx(e,"newValue",s,r)}" ${n}`;const i=e.children.map(a=>(a.propertyResource=`${e.propertyResource}.${a.property}`,Fx(a,e,t,s,r)));return i.some(Boolean)&&(o+="\n"+i.filter(Boolean).join("\n")),o}return e.children.map(a=>(a.propertyResource=`${e.propertyResource}.${a.property}`,Fx(a,e,t,s,r))).filter(Boolean).join("\n")}if("Removed"===e.property)return"";if("Modified"===e.state){const n=Rx(e,"oldValue",s,r),o=Rx(e,"newValue",s,r);return`${a?Mx(e,t,r?.translateProperty)+": ":""}${s.changedFrom} "${n}" ${s.changedTo} "${o}"`}const n=Rx(e,"newValue",s,r);return a?`${Mx(e,t,r?.translateProperty)}: ${n}`:n}function Rx(e,a,t,s){const r=e[a];return null==r||""===r?"Modified"===e.state||"Added"===e.state||"Unchanged"===e.state?t.uninformed:"":"string"==typeof r&&function(e){if("string"!=typeof e)return!1;if(!/^\d{4}[-/]\d{2}[-/]\d{2}/.test(e))return!1;const a=new Date(e);return!isNaN(a.getTime())}(r)?s?.formatDate?s.formatDate(r):zx(r):String(r)}function Lx(e){return e.replace(/([A-Z])/g,(e,a,t)=>`${t>0?"-":""}${a.toLowerCase()}`)}function zx(e){try{return new Date(e).toLocaleString()}catch{return e}}exports.ECustomFormFieldType=void 0,(mx=exports.ECustomFormFieldType||(exports.ECustomFormFieldType={}))[mx.readOnlyText=1]="readOnlyText",mx[mx.text=2]="text",mx[mx.date=3]="date",mx[mx.time=4]="time",mx[mx.url=5]="url",mx[mx.number=6]="number",mx[mx.singleSelection=7]="singleSelection",mx[mx.multiSelection=8]="multiSelection",mx[mx.questions=9]="questions",exports.EFieldViewMode=void 0,(px=exports.EFieldViewMode||(exports.EFieldViewMode={}))[px.dropdown=1]="dropdown",px[px.buttons=2]="buttons",px[px.radio=3]="radio",px[px.checkbox=4]="checkbox",exports.ESelectionFieldDataSource=void 0,(hx=exports.ESelectionFieldDataSource||(exports.ESelectionFieldDataSource={}))[hx.custom=1]="custom",hx[hx.users=2]="users",hx[hx.usersLists=3]="usersLists";const Ux={event:"Evento",entityName:"Item",description:e.t("audit_description"),justification:"Justificativa",status:"Status",type:"Tipo",references:e.t("audit_references"),security:e.t("audit_security"),electronicSigned:e.t("audit_esign"),accomplishedBy:"Realizado por",accomplishedIn:"Realizado em",changedFrom:"de",changedTo:"para",uninformed:e.t("audit_not_informed"),stateAdded:"(adicionado)",stateModified:"(modificado)",stateRemoved:"(removido)"};function Ox({documentId:e,onFetchDetails:s,onClose:r,labels:n,translateProperty:o,translatePropertyValue:i,formatDate:l}){const[c,u]=t.useState(!1),[m,p]=t.useState([]),[h,x]=t.useState(null),f=t.useCallback(async e=>{u(!0),x(null);try{const a=Ax(await s(e),{translateProperty:o,translatePropertyValue:i,formatDate:l,labels:n});p(a)}catch(a){x("Erro ao carregar detalhes da trilha de auditoria."),p([])}finally{u(!1)}},[s,o,i,l,n]);return t.useEffect(()=>{e&&f(e)},[e,f]),e?a.jsxs("div",{className:"flex flex-col h-full bg-background",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/30",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Detalhes da Auditoria"}),a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r,children:a.jsx(d.X,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:c?a.jsxs("div",{className:"flex items-center justify-center p-6",children:[a.jsx(sr,{size:"md"}),a.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Carregando detalhes..."})]}):h?a.jsx("div",{className:"p-6 text-sm text-destructive",children:h}):a.jsx("table",{className:"w-full text-xs",children:a.jsx("tbody",{children:m.map((e,t)=>a.jsxs("tr",{className:t%2==0?"bg-background":"bg-muted/20",children:[a.jsx("td",{className:"px-4 py-2.5 font-semibold text-foreground whitespace-nowrap align-top w-[180px] border-b border-border/50",children:e.name}),a.jsx("td",{className:"px-4 py-2.5 text-muted-foreground break-words border-b border-border/50",children:a.jsx("span",{dangerouslySetInnerHTML:{__html:e.value.replace(/\n/g,"<br />")}})})]},t))})})})]}):null}function Vx({open:s,onOpenChange:r,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:d=[],setDefaultApproverOnInit:c=!0,onSubmit:u}){const[m,p]=t.useState(!0),[h,x]=t.useState(c&&n.length>0?n[0].id:null),[f,g]=t.useState(o),v=e=>{p(e),e&&!c?x(null):!e&&!c&&n.length>0&&x(n[0].id)},b=f!==o||!m;return a.jsx(ys,{open:s,onOpenChange:r,children:a.jsxs(ks,{className:"sm:max-w-[480px]",variant:"form",isDirty:b,children:[a.jsx(Ss,{children:a.jsx(Ds,{children:i})}),a.jsxs("div",{className:"space-y-4",children:[d.length>0&&a.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:d.map((e,t)=>a.jsx("p",{dangerouslySetInnerHTML:{__html:e}},t))}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>v(!0),className:"accent-primary"}),a.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>v(!1),className:"accent-primary"}),a.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{children:"Etapa"}),a.jsxs(Bs,{value:h??void 0,onValueChange:x,disabled:m,children:[a.jsx(Ws,{children:a.jsx($s,{placeholder:e.t("approval_select_step")})}),a.jsx(Ks,{children:n.map(e=>a.jsx(Qs,{value:e.id,children:e.name},e.id))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(as,{children:e.t("approval_opinion")}),a.jsx(Zs,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a.jsx(Xt,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!b,children:"Concluir"})]})]})})}function Bx({open:e,onOpenChange:s,approvers:r,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[d,c]=t.useState(null),u=t.useMemo(()=>{const e=new Set(o);return r.filter(a=>!e.has(a.id))},[r,o]),m=t.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!d,children:[a.jsx(Ss,{children:a.jsx(Ds,{children:l("approval_select_approver")})}),a.jsx(rr,{isLoading:n,type:"spinner",children:a.jsx("div",{className:"space-y-4",children:a.jsx(Or,{options:m,value:d??void 0,onValueChange:e=>c("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),a.jsx(Xt,{onClick:()=>{if(!d)return;const e=u.find(e=>e.id===d);e&&i(e)},disabled:!d||n,children:"Concluir"})]})]})})}function qx(e){const{t:a}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function $x({text:e,maxLength:s=130}){const{t:r}=y.useTranslation(),[n,o]=t.useState(!1);return e.length<=s?a.jsx("span",{children:e}):a.jsxs("span",{children:[n?e:`${e.substring(0,s)}... `,a.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:r(n?"approval_read_less":"approval_read_more")})]})}function Wx({approver:e}){if(1===e.type&&e.approverId)return a.jsxs(ml,{className:"h-9 w-9 shrink-0",children:[a.jsx(pl,{src:e.photoUrl,alt:e.name}),a.jsx(hl,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const t=2===e.type?d.Users:3===e.type?d.MapPin:d.User;return a.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:a.jsx(t,{className:"h-4 w-4 text-background"})})}function Hx({approver:e}){return e.date?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[a.jsx(d.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:qx(e.date)}),1!==e.type&&e.approvedUsername&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[a.jsx(d.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:qx(e.returnDate)})]}):a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[a.jsx(d.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function Gx({approver:e}){const{t:t}=y.useTranslation(),s=1!==e.type||e.approverId?e.name:"A definir";return a.jsxs("div",{children:[2===e.type&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t("approval_user_group")}),3===e.type&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),a.jsx("p",{className:"text-sm font-medium break-words",children:s}),a.jsx(Hx,{approver:e})]})}var Kx;exports.ApprovalFlowReturnStep=void 0,(Kx=exports.ApprovalFlowReturnStep||(exports.ApprovalFlowReturnStep={}))[Kx.ApprovalFlow=1]="ApprovalFlow",Kx[Kx.Association=2]="Association",exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AUTH_CONFIG=Me,exports.AccessDeniedDialog=el,exports.Accordion=ll,exports.AccordionContent=ul,exports.AccordionItem=dl,exports.AccordionTrigger=cl,exports.ActionButton=Jt,exports.ActionMenu=Jt,exports.ActionMenuItems=po,exports.ActionPlanAttachmentsTab=ix,exports.ActionPlanCommentsTab=tx,exports.ActionPlanCostTab=ax,exports.ActionPlanGeneralTab=Wh,exports.ActionPlanHistoryTab=rx,exports.ActionPlanPage=function(e){const{formData:t,isLoading:s,isSaving:r,activeTab:n,isFormDisabled:o,updateField:i,setActiveTab:l,save:c,changeStatus:u,remove:m,cancel:p}=Bh(e),{t:h}=y.useTranslation(),{isNew:x=!1,config:f,users:g,places:v,actionTypes:b,causes:j,parentActions:w,progress:N,predecessors:_,availablePredecessors:C,costs:k,comments:S,history:T,attachments:P,attachmentsSlot:D,commentsSlot:E,historySlot:A,onAddPredecessor:I,onRemovePredecessor:M,onAddCost:F,onEditCost:R,onDeleteCost:L,onAddComment:z,onEditComment:U,onDeleteComment:O,onUploadAttachment:V,onDeleteAttachment:B,onRenameAttachment:q,onDownloadAttachment:$,onViewAttachment:W}=e;if(s&&!t.id)return a.jsx(rr,{isLoading:!0,children:a.jsx("div",{})});const H=function(e){const{t:a}=y.useTranslation();if(!e)return[];return{[exports.ETaskPlanStatus.waitingStart]:[exports.ETaskPlanStatus.running,exports.ETaskPlanStatus.suspended,exports.ETaskPlanStatus.canceled],[exports.ETaskPlanStatus.running]:[exports.ETaskPlanStatus.effectivenessCheck,exports.ETaskPlanStatus.done,exports.ETaskPlanStatus.suspended,exports.ETaskPlanStatus.canceled],[exports.ETaskPlanStatus.effectivenessCheck]:[exports.ETaskPlanStatus.running,exports.ETaskPlanStatus.done,exports.ETaskPlanStatus.suspended,exports.ETaskPlanStatus.canceled],[exports.ETaskPlanStatus.done]:[exports.ETaskPlanStatus.running],[exports.ETaskPlanStatus.suspended]:[exports.ETaskPlanStatus.running,exports.ETaskPlanStatus.canceled],[exports.ETaskPlanStatus.canceled]:[exports.ETaskPlanStatus.waitingStart]}[e]||[]}(t.statusId);return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between border-b bg-card px-6 py-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[p&&a.jsx(Xt,{variant:"ghost",size:"icon",onClick:p,children:a.jsx(d.ArrowLeft,{className:"h-4 w-4"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-lg font-semibold",children:x?h("ap_new_action"):t.name||h("ap_action_plan")}),!x&&t.statusId&&a.jsx($h,{status:t.statusId})]}),t.code&&a.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:t.code})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!x&&H.length>0&&!o&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"outline",size:"sm",children:"Alterar Status"})}),a.jsx(hr,{align:"end",children:H.map(e=>a.jsx(xr,{onClick:()=>u(e),children:Lh[e]},e))})]}),!x&&e.onDelete&&a.jsxs(or,{children:[a.jsx(ir,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",children:a.jsx(d.MoreVertical,{className:"h-4 w-4"})})}),a.jsx(hr,{align:"end",children:a.jsx(xr,{className:"text-destructive",onClick:m,children:"Excluir"})})]})]})]}),a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:a.jsx("div",{className:"max-w-4xl mx-auto px-6 py-6",children:a.jsxs(ki,{value:n,onValueChange:l,children:[a.jsxs(Si,{className:"mb-6",children:[a.jsx(Ti,{value:"general",children:"Geral"}),!x&&a.jsx(Ti,{value:"progress",children:"Progresso"}),!x&&f?.enablePredecessors&&a.jsx(Ti,{value:"predecessors",children:h("ap_predecessors")}),!x&&f?.enableCosts&&a.jsx(Ti,{value:"costs",children:"Custos"}),!x&&f?.enableAttachments&&a.jsx(Ti,{value:"attachments",children:h("ap_attachments")}),!x&&f?.enableComments&&a.jsx(Ti,{value:"comments",children:h("ap_comments")}),!x&&f?.enableHistory&&a.jsx(Ti,{value:"history",children:"Histórico"})]}),a.jsx(Pi,{value:"general",children:a.jsx(Wh,{formData:t,updateField:i,disabled:o,users:g,places:v,actionTypes:b,causes:j,parentActions:w,config:f})}),!x&&a.jsx(Pi,{value:"progress",children:a.jsx(Jh,{...e})}),!x&&f?.enablePredecessors&&a.jsx(Pi,{value:"predecessors",children:a.jsx(ex,{predecessors:_,availablePredecessors:C,onAdd:I,onRemove:M,disabled:o})}),!x&&f?.enableCosts&&a.jsx(Pi,{value:"costs",children:a.jsx(ax,{costs:k,onAdd:F,onEdit:R,onDelete:L,disabled:o})}),!x&&f?.enableAttachments&&a.jsx(Pi,{value:"attachments",children:D||a.jsx(ix,{attachments:P,onUpload:V,onDelete:B,onRename:q,onDownload:$,onView:W,disabled:o})}),!x&&f?.enableComments&&a.jsx(Pi,{value:"comments",children:E||a.jsx(tx,{comments:S,onAdd:z,onEdit:U,onDelete:O,disabled:o})}),!x&&f?.enableHistory&&a.jsx(Pi,{value:"history",children:A||a.jsx(rx,{history:T})})]})})}),a.jsxs("div",{className:"flex items-center justify-end gap-3 border-t bg-card px-6 py-4",children:[p&&a.jsx(Xt,{variant:"outline",onClick:p,disabled:r,children:"Cancelar"}),a.jsx(Xt,{onClick:c,disabled:r||o,children:r?"Salvando...":"Salvar"})]})]})},exports.ActionPlanPredecessorsTab=ex,exports.ActionPlanProgressDialog=Xh,exports.ActionPlanProgressTab=Jh,exports.ActionPlanStatusBadge=$h,exports.Alert=si,exports.AlertDescription=ni,exports.AlertDialog=ds,exports.AlertDialogAction=vs,exports.AlertDialogCancel=bs,exports.AlertDialogContent=ps,exports.AlertDialogDescription=gs,exports.AlertDialogFooter=xs,exports.AlertDialogHeader=hs,exports.AlertDialogOverlay=ms,exports.AlertDialogPortal=us,exports.AlertDialogTitle=fs,exports.AlertDialogTrigger=cs,exports.AlertTitle=ri,exports.AliasRedirect=function(){const{alias:e}=In(),{pathname:t,search:s,hash:r}=N.useLocation();return e?a.jsx(N.Navigate,{to:`/${e}${t}${s}${r}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:s="alias"}){const r=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:d,switchUnit:c}=In(),{urlAlias:u,isAliasMismatch:m,isValidAlias:p,isMissing:h,matchedCompany:x}=ei({paramName:s}),[f,g]=t.useState(!1),v=t.useRef(!1),b=s in o,y=t.useCallback(e=>{const a=o[s],{pathname:t,search:r,hash:i}=n;if(a){const s=t.split("/"),n=s.findIndex(e=>e===a);if(n>=0)return s[n]=e,s.join("/")+r+i}return`/${e}${"/"===t?"":t}${r}${i}`},[o,s,n]);return t.useEffect(()=>{if(b&&!d&&l&&i&&!v.current)if(h)r(y(i),{replace:!0});else if(!u||p){if(m&&x&&!v.current){(async()=>{v.current=!0,g(!0);try{await c(x)}catch(e){i&&r(y(i),{replace:!0})}finally{v.current=!1,g(!1)}})()}}else r(y(i),{replace:!0})},[b,d,l,i,h,u,p,m,x,c,y,r]),d||!l?a.jsx(a.Fragment,{children:e}):f?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(sr,{size:"lg"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a.jsx(a.Fragment,{children:e})},exports.AppHeader=Dp,exports.AppLayout=Up,exports.AppSidebar=zp,exports.ApprovalSidenav=function({config:e,isLoading:s=!1,onClose:r,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:c=!1}){const{t:u}=y.useTranslation(),[m,p]=t.useState(!1),[h,x]=t.useState(!1),[f,g]=t.useState(""),[v,b]=t.useState(""),[j,w]=t.useState(!1),[N,_]=t.useState(""),C=s||m,k=t.useCallback((e,a)=>{g(e),b(a??""),x(!0)},[]),S=t.useCallback(async a=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...a}))return k(f,a.observation),void p(!1);r(),p(!1)},[e.associationId,f,n,r,k]),T=t.useCallback(e=>{_(e),w(!0)},[]),P=t.useCallback(async a=>{w(!1),p(!0),await o(e.associationId,N,a),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),D=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],E=(a,t)=>e.canApprove&&a.isCurrentStep&&t.approverId&&!t.date&&t.canApprove,A=(a,t)=>!e.flowReproved&&a.isCurrentStep&&1===t.type&&t.canApprove&&(!t.approverId||t.isToBeDefined);return a.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[a.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[a.jsx(Xt,{variant:"ghost",size:"icon",onClick:r,className:"shrink-0",children:a.jsx(d.X,{className:"h-5 w-5"})}),a.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?a.jsx(rr,{isLoading:!0,type:"spinner",className:"flex-1",children:a.jsx("div",{})}):a.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&a.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,t)=>a.jsx("div",{className:Kt("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},t))}),a.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(t=>a.jsxs("div",{className:Kt("space-y-2",(!t.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[a.jsxs("p",{className:"font-semibold text-sm",children:[t.index,". Etapa: ",t.name]}),t.description&&a.jsx("p",{className:"text-sm text-muted-foreground break-words",children:a.jsx($x,{text:t.description})}),t.returnDate&&a.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.returnUserName," em ",qx(t.returnDate)]})]}),t.returnObservation&&a.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a.jsx($x,{text:t.returnObservation})})]}),t.approvers.map(e=>a.jsxs("div",{className:"p-2 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx(Wx,{approver:e}),a.jsx(Gx,{approver:e})]}),E(t,e)&&a.jsx(Xt,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),A(t,e)&&a.jsx(Xt,{size:"sm",variant:"outline",onClick:()=>T(e.id),children:"Selecionar"})]}),e.observation&&a.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a.jsx($x,{text:e.observation})}),e.returnObservation&&a.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a.jsx($x,{text:e.returnObservation})})]},e.id))]},t.id))]}),a.jsx(Vx,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:v,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),a.jsx(Bx,{open:j,onOpenChange:w,approvers:l,isLoading:c,ignoreUserIds:D,onSubmit:P})]})},exports.ApproveDialog=Vx,exports.AuditTrailDetails=Ox,exports.AuditTrailFilter=Sx,exports.AuditTrailPage=function({title:s,softwares:r,softwareId:n,permissions:o={viewAllEvents:!0,viewOnlyMyEvents:!1,download:!1},callbacks:i,limit:l=2e3,currentUserId:c,labels:u,formatDate:m,anonymousLabel:p=e.t("anonymous")}){const{t:h}=y.useTranslation();s??h("audit_trail");const[x,f]=t.useState(!0),[g,v]=t.useState([]),[b,j]=t.useState([]),[w,N]=t.useState([]),[_,C]=t.useState(null),[k,S]=t.useState(!1),T=t.useRef(null),P=new Date;P.setHours(0,0,0,0);const[D,E]=t.useState({software:r.find(e=>e.id===n)?.software||"",softwareId:n,event:"All",eventId:1,startDate:P,endDate:P,limit:l,softwares:r,userId:o.viewOnlyMyEvents&&!o.viewAllEvents?c:void 0});t.useEffect(()=>{(async()=>{f(!0);try{const[e,a]=await Promise.all([i.onFetchEvents(D.softwareId),i.onFetchUsers?.()??Promise.resolve([])]);j(e),N(a),await A(D,e)}catch(e){}finally{f(!1)}})()},[]);const A=t.useCallback(async(e,a)=>{try{const t=Px((await i.onFetchTrails(e)).data,a||b,r,p);v(t)}catch(t){}},[i,b,r,p]),I=t.useCallback(async e=>{f(!0),E(e);try{await A(e)}finally{f(!1)}},[A]),M=t.useCallback(async e=>{try{const a=await i.onFetchEvents(e);j(a)}catch(a){}},[i]),F=t.useCallback(e=>{C(e.documentId),S(!0)},[]),R=t.useCallback(()=>{S(!1),C(null)},[]),L=t.useCallback(async()=>{const e={...D,startDate:P,endDate:P,eventId:1,userId:o.viewAllEvents?void 0:c};E(e),f(!0);try{await A(e)}finally{f(!1)}},[D,A]),z=t.useCallback(e=>{i.onExport?.(e,g)},[i,g]),U=t.useCallback(e=>{try{return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}},[]);return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"p-3",children:a.jsx(Sx,{queryParams:D,events:b,softwares:r,users:w,permissions:o,isLoading:x,onFilter:I,onReset:L,onExport:o.download?z:void 0,onSoftwareChange:M})}),a.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[a.jsxs("div",{className:Kt("flex-1 overflow-auto transition-all duration-300",k?"mr-[400px]":""),children:[x?a.jsxs("div",{className:"flex items-center justify-center h-64",children:[a.jsx(sr,{size:"md"}),a.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Carregando trilha de auditoria..."})]}):0===g.length?a.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground",children:[a.jsx(d.FileText,{className:"h-12 w-12 mb-3 opacity-30"}),a.jsx("p",{className:"text-sm",children:"Nenhum registro encontrado"}),a.jsx("p",{className:"text-xs mt-1",children:"Ajuste os filtros e tente novamente"})]}):a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{className:"sticky top-0 z-10",children:a.jsxs("tr",{className:"bg-muted/60 border-b border-border",children:[a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(d.Layers,{className:"h-3 w-3"}),"Módulo"]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(d.Clock,{className:"h-3 w-3"}),"Data"]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(d.User,{className:"h-3 w-3"}),"Usuário"]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(d.FileText,{className:"h-3 w-3"}),"Evento"]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Item"}),a.jsx("th",{className:"px-3 py-2 w-10"})]})}),a.jsx("tbody",{children:g.map((e,t)=>a.jsxs("tr",{onClick:()=>F(e),className:Kt("cursor-pointer border-b border-border/50 transition-colors","hover:bg-accent/50",_===e.documentId&&"bg-accent",t%2==0?"bg-background":"bg-muted/10"),children:[a.jsx("td",{className:"px-3 py-2 text-foreground",children:e.translatedSoftware}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",children:e.date?U(e.date.toISOString()):"—"}),a.jsx("td",{className:"px-3 py-2 text-foreground",children:e.user}),a.jsx("td",{className:"px-3 py-2 text-foreground",children:e.translatedEvent}),a.jsx("td",{className:"px-3 py-2 text-foreground truncate max-w-[200px]",title:e.entityName,children:e.entityName}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(d.Eye,{className:"h-3.5 w-3.5 text-muted-foreground"})})]},e.documentId||t))})]}),!x&&g.length>0&&a.jsxs("div",{className:"px-3 py-2 text-xs text-muted-foreground border-t border-border bg-muted/20",children:[g.length," registro",1!==g.length?"s":""]})]}),a.jsx("div",{ref:T,className:Kt("fixed right-0 top-0 h-full w-[400px] border-l border-border bg-background shadow-lg z-30","transition-transform duration-300 ease-in-out",k?"translate-x-0":"translate-x-full"),children:k&&a.jsx(Ox,{documentId:_,onFetchDetails:i.onFetchDetails,onClose:R,labels:u,translateProperty:i.translateProperty,translatePropertyValue:i.translatePropertyValue,formatDate:m||U})})]})]})},exports.AuthErrorInterceptor=hn,exports.AuthProvider=An,exports.AuthService=Tn,exports.AutoComplete=Or,exports.Avatar=ml,exports.AvatarFallback=hl,exports.AvatarImage=pl,exports.Badge=ar,exports.BaseForm=qo,exports.Blockquote=nd,exports.BodyContent=function({breadcrumbs:e,children:t,className:s}){return a.jsxs("div",{className:Kt("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",s),children:[e&&e.length>0&&a.jsx(xl,{className:"mb-4",children:a.jsx(fl,{children:e.map((t,s)=>{const r=s===e.length-1;return a.jsxs(ae.Fragment,{children:[s>0&&a.jsx(yl,{}),a.jsx(gl,{children:r||!t.href?a.jsx(bl,{children:t.label}):t.asChild&&t.children?a.jsx(vl,{asChild:!0,children:t.children}):a.jsx(vl,{asChild:!0,children:a.jsx(N.Link,{to:t.href||"/",children:t.label})})})]},`${t.label}-${s}`)})})}),a.jsx("div",{className:"space-y-6",children:t})]})},exports.Breadcrumb=xl,exports.BreadcrumbEllipsis=jl,exports.BreadcrumbItem=gl,exports.BreadcrumbLink=vl,exports.BreadcrumbList=fl,exports.BreadcrumbPage=bl,exports.BreadcrumbSeparator=yl,exports.BurndownPanel=vm,exports.Button=Xt,exports.ButtonGroup=Nl,exports.CLOSED_STATUSES=Oh,exports.CRUD_CONFIG=Fe,exports.CURRENCY_FIELDS=Wu,exports.Calendar=_l,exports.CallbackPage=()=>{const{processCallback:e}=In(),s=N.useNavigate(),[r,n]=t.useState(null),[o,i]=t.useState(!1);t.useEffect(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),s(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e,s]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(a){n(a?.message||"Erro ao tentar novamente.")}finally{i(!1)}},c=()=>{window.location.href="/"};return r?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsxs(rs,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a.jsx(d.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),a.jsxs(os,{className:"space-y-4",children:[a.jsx(si,{variant:"danger",children:a.jsx(ni,{children:r})}),a.jsx("div",{className:"text-sm text-muted-foreground",children:a.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Xt,{onClick:l,disabled:o,className:"flex-1",children:o?a.jsxs(a.Fragment,{children:[a.jsx(sr,{size:"sm",className:"mr-2"}),"Tentando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a.jsx(Xt,{onClick:c,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsx(rs,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),a.jsxs(os,{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(sr,{size:"lg"})}),a.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=ts,exports.CardContent=os,exports.CardDescription=ns,exports.CardFooter=is,exports.CardHeader=ss,exports.CardSkeleton=Hn,exports.CardTitle=rs,exports.CartesianPanel=pm,exports.ChartContainer=Ac,exports.ChartLegend=Rc,exports.ChartLegendContent=Lc,exports.ChartStyle=Ic,exports.ChartTooltip=Mc,exports.ChartTooltipContent=Fc,exports.Checkbox=Js,exports.Collapsible=wi,exports.CollapsibleContent=_i,exports.CollapsibleTrigger=Ni,exports.ColorPicker=Mo,exports.ColumnSettingsPopover=To,exports.ComboTree=Hr,exports.Combobox=Or,exports.Command=Pr,exports.CommandDialog=({children:e,...t})=>a.jsx("div",{...t,children:a.jsx(Pr,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=Ar,exports.CommandGroup=Ir,exports.CommandInput=Dr,exports.CommandItem=Fr,exports.CommandList=Er,exports.CommandSeparator=Mr,exports.CommandShortcut=Rr,exports.ContentContainer=function({title:e,subtitle:t,children:s,className:r,hasHeader:n=!0}){const o=e||t;return a.jsxs("div",{className:Kt("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",r),children:[n&&o&&a.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),t&&a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t})]}),s&&a.jsx("div",{className:Kt("p-6",!n&&o&&"pt-4"),children:s})]})},exports.ContextMenu=Xn,exports.ContextMenuCheckboxItem=io,exports.ContextMenuContent=no,exports.ContextMenuGroup=Zn,exports.ContextMenuItem=oo,exports.ContextMenuLabel=co,exports.ContextMenuPortal=eo,exports.ContextMenuRadioGroup=to,exports.ContextMenuRadioItem=lo,exports.ContextMenuSeparator=uo,exports.ContextMenuShortcut=mo,exports.ContextMenuSub=ao,exports.ContextMenuSubContent=ro,exports.ContextMenuSubTrigger=so,exports.ContextMenuTrigger=Jn,exports.CoreProviders=function({children:s,queryClient:r,moduleAlias:n,moduleAccessGuardProps:o,appTranslations:i,clarityProjectId:l,clarityMode:d="auto"}){rl();const[c]=t.useState(()=>new w.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),u=r??c;t.useEffect(()=>{if(i)for(const[e,a]of Object.entries(i))pi(e,a)},[i]);const m={sourceModule:n,...o};return a.jsxs(Ci,{children:[a.jsx(il,{}),a.jsx(y.I18nextProvider,{i18n:e,children:a.jsx(w.QueryClientProvider,{client:u,children:a.jsxs(An,{children:[a.jsx(ol,{projectId:l,mode:d}),a.jsx(gi,{children:a.jsx(yi,{moduleAlias:n,children:a.jsx(tl,{...m,children:s})})})]})})})]})},exports.CrudActionBar=No,exports.CrudActionMenu=mp,exports.CrudGrid=({manager:s,columns:r,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:c,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:v=!1,searchValue:b,onSearchChange:j,searchPlaceholder:w,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:T,onViewModeChange:P,listCardRenderer:D,gridCardRenderer:E,showViewToggle:A=!1})=>{const{setSearchVisible:I}=In(),M=void 0!==f?!f:g;t.useEffect(()=>{if(!v)return I(!0),()=>I(!1)},[I,v]);const F=m||x.length>0||v||u||C||A,R=_||(()=>{s.bulkDelete?.(s.selectedIds)}),L=T||"grid",z="list"===L,U={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],O=M&&F?a.jsx(No,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:v,searchValue:b,onSearchChange:j,searchPlaceholder:w,showBulkActions:u,selectedCount:s.selectedIds.length,bulkActions:N,onBulkDelete:R,onClearSelection:s.clearSelection,customActions:x,filters:C,viewMode:L,onViewModeChange:P,showViewToggle:A,availableViewModes:["list","grid"]}):null;return s.isLoading?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx(Hn,{count:6})})]}):0===s.entities.length?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(Kn,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("div",{className:Kt("grid gap-4",U),children:s.entities.map(e=>{const t=(e=>{const{t:a}=y.useTranslation();return z&&D?D(e):!z&&E?E(e):S?S(e):null})(e);return a.jsxs(Xn,{children:[a.jsx(Jn,{asChild:!0,children:t?a.jsx("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),u?s.selectItem(e.id):n?.(e)},children:t}):a.jsx(ts,{className:Kt("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&s.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:a=>{a.stopPropagation(),u?s.selectItem(e.id):n?.(e)},children:a.jsxs(os,{className:Kt("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&a.jsx("div",{className:Kt(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a.jsx(_o,{checked:s.selectedIds.includes(e.id),onCheckedChange:()=>s.selectItem(e.id)})}),z?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:r.map(t=>a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground truncate",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key)))}),(n||o||d)&&a.jsx("div",{onClick:e=>e.stopPropagation(),children:d?d(e):a.jsx(ho,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]}):a.jsxs("div",{className:"flex items-start gap-3",children:[u&&a.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a.jsx(_o,{checked:s.selectedIds.includes(e.id),onCheckedChange:()=>s.selectItem(e.id)})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[r.map((t,s)=>a.jsxs("div",{className:Kt("flex justify-between items-start gap-2",s!==r.length-1&&"mb-2"),children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground text-right truncate",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key))),(n||o||d)&&a.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):a.jsx(ho,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]})]})]})})}),a.jsx(no,{className:"w-[160px]",children:a.jsx(po,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:c?c(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=Xo,exports.CrudPagination=Wo,exports.CrudPrimitiveFilterBar=pp,exports.CrudPrimitivePagination=$o,exports.CrudPrimitiveTable=up,exports.CrudTable=Do,exports.CustomFormFields=function({fields:e,readOnly:s=!1,hideInactiveWithoutValue:r=!1,onChange:n,onFieldChange:o}){const i=t.useCallback(a=>{if(o?.(a),n){const t=e.map(e=>e.id===a.id?a:e);n(t)}},[e,n,o]),l=e.filter(e=>fx(e,r));return 0===l.length?null:a.jsx("div",{className:"space-y-4",children:l.map(e=>a.jsx(kx,{field:e,readOnly:s,onChange:i},e.id))})},exports.D4SignWidget=Sh,exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=Dt,exports.DEFAULT_ACTION_TYPES=zh,exports.DEFAULT_DATETIME_FORMAT=It,exports.DEFAULT_LOCALE=At,exports.DEFAULT_TIMEZONE=Mt,exports.DashboardForm=Lm,exports.DashboardGeneralView=function({dashboards:e,limit:s,generalView:r,language:n=exports.DashboardLanguage.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:d=!1,canEditStandard:c=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:v=!1,onOpen:b,onBackToList:y,onRefresh:j,onRefreshList:w,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:T,onAddPanel:P,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:A,onLayoutChange:I,onSearch:M,onQuickFilterChange:F,onSetGeneralView:R,viewState:L,onViewStateChange:z,listToolbarExtra:U,viewToolbarActions:O,className:V}){const[B,q]=t.useState({mode:"list"}),$=L??B,W=t.useCallback(e=>{z?z(e):q(e)},[z]),H=t.useMemo(()=>"view"===$.mode||"edit"===$.mode||"share"===$.mode?e.find(e=>e.id===$.dashboardId)??null:null,[e,$]),[G,K]=t.useState(!1),[Y,Q]=t.useState(m[0]?.id);t.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),t.useEffect(()=>{if("view"!==$.mode||!H||H.idViewType!==exports.DashboardViewType.Carousel||m.length<=1)return;const e=function(e){switch(e){case exports.DashboardPageTime.FiveSeconds:return 5e3;case exports.DashboardPageTime.TenSeconds:return 1e4;case exports.DashboardPageTime.FifteenSeconds:return 15e3;case exports.DashboardPageTime.ThirtySeconds:return 3e4;case exports.DashboardPageTime.OneMinute:return 6e4;case exports.DashboardPageTime.ThreeMinutes:return 18e4;case exports.DashboardPageTime.FiveMinutes:return 3e5;case exports.DashboardPageTime.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),a=setInterval(()=>{Q(e=>{const a=(m.findIndex(a=>a.id===e)+1)%m.length;return m[a]?.id})},e);return()=>clearInterval(a)},[$,H,m]);const X=t.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),b?.(e)},[W,b]),J=t.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=t.useCallback(()=>{W({mode:"create"})},[W]),ee=t.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),ae=t.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),te=t.useCallback(e=>{"edit"===$.mode||"share"===$.mode?C?.($.dashboardId,e):_?.(e)},[$,_,C]),se=t.useCallback(()=>{"edit"===$.mode||"share"===$.mode?W({mode:"view",dashboardId:$.dashboardId}):W({mode:"list"})},[$,W]),re=t.useCallback(()=>{H&&N?.(H)},[H,N]),ne=t.useCallback(()=>{H&&ee(H)},[H,ee]),oe=t.useCallback(()=>{H&&ae(H)},[H,ae]);return a.jsxs("div",{className:Kt("flex flex-col h-full",V),children:["list"===$.mode&&a.jsx(Em,{dashboards:e,limit:s,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:d,onOpen:X,onEdit:ee,onShare:ae,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:w,onSearch:M,onQuickFilterChange:F,toolbarExtra:U,className:"flex-1"}),"view"===$.mode&&H&&a.jsxs("div",{className:"flex flex-col h-full",children:[!G&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[a.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),r?.dashboardId===H.id&&a.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[a.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),a.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&R&&r?.dashboardId!==H.id&&a.jsx("button",{onClick:()=>R(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),a.jsx(Sm,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||c&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:j,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:re,onEdit:ne,onShare:oe,onAddPanel:P,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:A,onLayoutChange:I,onPageChange:Q,toolbarActions:O,className:"flex-1"})]}),"create"===$.mode&&a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:a.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),a.jsx(Lm,{users:h,groups:x,places:f,collaborators:g,isSaving:v,onSave:te,onCancel:se,className:"flex-1"})]}),("edit"===$.mode||"share"===$.mode)&&H&&a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:a.jsxs("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),a.jsx(Lm,{dashboard:H,initialTab:"share"===$.mode?exports.DashboardFormTab.Share:exports.DashboardFormTab.General,users:h,groups:x,places:f,collaborators:g,isSaving:v,isQualitfy:!!H.isStandard&&!c,onSave:te,onCancel:se,className:"flex-1"})]})]})},exports.DashboardGrid=_m,exports.DashboardList=Em,exports.DashboardPanelRenderer=km,exports.DashboardView=Sm,exports.DataFilterBar=pp,exports.DataList=Cl,exports.DataPagination=$o,exports.DataTable=up,exports.DatePicker=kl,exports.Dialog=ys,exports.DialogBody=Ts,exports.DialogClose=Ns,exports.DialogContent=ks,exports.DialogDescription=Es,exports.DialogFooter=Ps,exports.DialogHeader=Ss,exports.DialogOverlay=_s,exports.DialogPortal=ws,exports.DialogTitle=Ds,exports.DialogTrigger=js,exports.DialogWizard=function({open:t,onOpenChange:s,currentStep:r,onStepChange:n,steps:o,canGoToStep:i,children:l,title:c,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:v="lg",unsavedChangesTitle:b,unsavedChangesDescription:j,cancelText:w,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:T}=y.useTranslation(),P=o.length,D=r>=P,E=r<=1;return a.jsx(ys,{open:t,onOpenChange:s,children:a.jsxs(ks,{size:v,variant:f,isDirty:g,unsavedChangesTitle:b,unsavedChangesDescription:j,cancelText:w,leaveWithoutSavingText:N,className:Kt("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[a.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[a.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),a.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,t)=>{const s=t+1,o=s===r,l=(e=>e<r)(s),c=(u=s)<=r||!i||i(u);var u;return a.jsxs("button",{type:"button",onClick:()=>(e=>{e!==r&&(e<r?n(e):i&&!i(e)||n(e))})(s),disabled:!c,className:Kt("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&c&&"hover:bg-primary-foreground/10 cursor-pointer",!c&&"opacity-40 cursor-not-allowed"),children:[a.jsx("span",{className:Kt("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?a.jsx(d.Check,{className:"h-3.5 w-3.5"}):s}),a.jsx("span",{className:Kt("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},s)})})]}),a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs(Ss,{className:"p-6 pb-0",children:[a.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",r," de ",P]}),a.jsx(Ds,{children:c}),u&&a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a.jsx(Ts,{className:"px-6",children:l}),!k&&a.jsx(Ps,{className:"px-6 pb-6",children:a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("div",{className:"flex items-center gap-2",children:S}),a.jsxs("div",{className:"flex items-center gap-2",children:[!E&&a.jsx(Xt,{variant:"outline",onClick:()=>n(r-1),children:x}),D?a.jsx(Xt,{onClick:m,disabled:C,children:p}):a.jsx(Xt,{onClick:()=>n(r+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=Cr,exports.DocumentSigner=function({file:s,onDocumentSigned:r,onError:n,showEventLog:o=!1}){const{user:i,alias:c}=In(),{config:u,isLoading:m}=vh(),{t:p}=y.useTranslation(),[h,x]=t.useState(null),[f,g]=t.useState(!1),[v,b]=t.useState(null),[j,w]=t.useState("sandbox"),[N,_]=t.useState("clicksign"),[C,k]=t.useState(null),[S,T]=t.useState(null),[P,D]=t.useState(!1),[E,A]=t.useState(0),[I,M]=t.useState(!1),[F,R]=t.useState([]),L=t.useRef(null),z=t.useRef(null),U=t.useCallback(e=>{o&&R(a=>[...a,`[${(new Date).toLocaleTimeString()}] ${e}`])},[o]),O=t.useCallback(async a=>{if(x(a),b(null),k(null),T(null),U(`Arquivo selecionado: ${a.name}`),c&&i){g(!0);try{const t=u?.provider??"clicksign";_(t),U(`Provedor resolvido: ${t}`);const s=new FileReader,r=await new Promise((e,t)=>{s.onload=()=>{const a=s.result;e(a)},s.onerror=t,s.readAsDataURL(a)});U(`Criando envelope para assinatura via ${t}...`);const o=await wh.createEnvelopeWithSigner({alias:c,contentBase64:r,filename:a.name,signerEmail:i.email||"",signerName:i.name||"",provider:t});U(`Envelope criado: ${o.envelope_id}`),k({envelope_id:o.envelope_id,document_id:o.document_id,signer_email:o.signer_email,key_signer:o.signer_id}),w(o.environment),_(o.provider||t),"d4sign"===t?(U("Documento enviado para D4Sign. Abrindo widget de assinatura..."),await new Promise(e=>setTimeout(e,2e3)),b(o.document_id),l.toast.success(p("sign_doc_sent","Documento enviado! Assine abaixo."))):o.signer_id?(U(`Signer ID obtido: ${o.signer_id}. Aguardando processamento (3s)...`),await new Promise(e=>setTimeout(e,3e3)),b(o.signer_id),l.toast.success(p("sign_doc_sent","Documento enviado! Assine abaixo."))):(U(e.t("sign_signer_unavailable")),l.toast.error(p("sign_access_error","Não foi possível obter o acesso para assinatura. Tente novamente.")),n?.(new Error(p("sign_signer_unavailable"))))}catch(t){const a=t instanceof Error?t:new Error(p("sign_process_error",p("sign_doc_process_error"))),s=a.message||"";s.includes("MONTHLY_LIMIT_REACHED")?(U(e.t("sign_monthly_limit")),l.toast.error(p("sign_monthly_limit","Limite mensal de assinaturas atingido. Entre em contato com o administrador para ampliar seu plano."))):(U(`Erro: ${s}`),l.toast.error(s)),n?.(a)}finally{g(!1)}}},[c,i,U,n,u]);t.useEffect(()=>{s&&c&&i&&!m&&s!==z.current&&(z.current=s,O(s))},[s,c,i,m,O]);const V=t.useCallback(async()=>{if(!C||!c)return;D(!0),A(0),M(!1),U("Buscando documento assinado...");for(let t=1;t<=6;t++){A(t),U(`Tentativa ${t}/6...`);try{const a=await wh.getSignedDocument({alias:c,envelopeId:C.envelope_id,documentId:C.document_id,provider:N});if(a.download_url)return U(e.t("sign_doc_available")),T(a.download_url),void D(!1)}catch(a){U(`Erro na tentativa ${t}: ${a instanceof Error?a.message:p("unknown_error")}`)}t<6&&(U("Aguardando 10 segundos para próxima tentativa..."),await new Promise(e=>setTimeout(e,1e4)))}U(e.t("sign_fetch_failed")),D(!1),M(!0)},[C,c,U,N]),B=t.useCallback(async()=>{U("Documento assinado com sucesso!"),l.toast.success(p("sign_signed_success","Documento assinado com sucesso!")),b(null),C&&c&&(r?.({success:!0,provider:N,envelope_id:C.envelope_id,document_id:C.document_id,signer_id:v||"",environment:j}),await V())},[U,r,C,v,c,j,N,V]);if(!c)return a.jsx(ts,{className:"border-amber-200 bg-amber-50",children:a.jsx(os,{className:"flex items-start gap-3 py-6",children:a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-amber-800",children:p("sign_auth_required","Autenticação necessária")}),a.jsx("p",{className:"text-sm text-amber-700 mt-1",children:p("sign_login_required","Faça login para utilizar a assinatura digital.")})]})})});const q="d4sign"===N?"D4Sign":"Clicksign",$=()=>o&&F.length>0?a.jsx("div",{className:"bg-muted p-3 rounded-md text-xs font-mono space-y-1 max-h-40 overflow-auto",children:F.map((e,t)=>a.jsx("div",{children:e},t))}):null;return C&&!v&&(S||P||I)?a.jsxs("div",{className:"space-y-4",children:[a.jsx(ts,{className:"border-green-200 bg-green-50",children:a.jsxs(os,{className:"flex flex-col items-center gap-4 py-8",children:[a.jsx(d.CheckCircle2,{className:"h-12 w-12 text-green-600"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-lg font-semibold text-green-800",children:p("sign_signed_success","Documento assinado com sucesso!")}),a.jsx("p",{className:"text-sm text-green-700 mt-1",children:h?.name})]}),P?a.jsxs("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(d.Loader2,{className:"h-4 w-4 animate-spin"}),p("sign_preparing_doc","Preparando documento assinado...")," (",p("sign_attempt","tentativa")," ",E,"/6)"]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:p("sign_waiting_provider",`Aguardando processamento pelo ${q}...`)})]}):S?a.jsx(Xt,{asChild:!0,variant:"default",className:"gap-2",children:a.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(d.Download,{className:"h-4 w-4"}),p("sign_download_signed","Baixar documento assinado")]})}):I?a.jsxs("div",{className:"text-center space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:p("sign_fetch_failed","Não foi possível obter o documento assinado após 1 minuto.")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:p("sign_email_fallback","O documento será enviado para o seu e-mail assim que estiver disponível.")})]}),a.jsxs(Xt,{variant:"secondary",className:"gap-2",onClick:V,children:[a.jsx(d.RefreshCw,{className:"h-4 w-4"}),p("sign_try_again","Tentar novamente")]})]}):null]})}),a.jsx($,{})]}):v?a.jsxs("div",{className:"space-y-4",children:["d4sign"===N?a.jsx(Sh,{documentKey:v,signerEmail:C?.signer_email||i?.email||"",signerName:i?.name,keySigner:C?.key_signer,environment:j,onSign:B,onError:n}):a.jsx(kh,{signerId:v,environment:j,onSign:B,onError:n}),a.jsx($,{})]}):s&&(f||m)?a.jsx(ts,{children:a.jsxs(os,{className:"flex items-center justify-center gap-3 py-10",children:[a.jsx(d.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),a.jsx("p",{className:"font-medium",children:p("sign_sending_doc","Enviando documento para assinatura...")})]})}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("input",{ref:L,type:"file",accept:"application/pdf",className:"hidden",onChange:e=>{const a=e.target.files?.[0];a&&"application/pdf"===a.type?O(a):l.toast.error(p("sign_select_pdf","Selecione um arquivo PDF"))}}),f?a.jsx(ts,{children:a.jsxs(os,{className:"flex items-center justify-center gap-3 py-10",children:[a.jsx(d.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),a.jsx("p",{className:"font-medium",children:p("sign_sending_doc","Enviando documento para assinatura...")})]})}):a.jsx(ts,{className:"border-dashed border-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>L.current?.click(),children:a.jsxs(os,{className:"flex flex-col items-center justify-center py-10 gap-3",children:[a.jsx(d.Upload,{className:"h-8 w-8 text-muted-foreground"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"font-medium",children:p("sign_select_pdf","Selecione um arquivo PDF")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:p("sign_click_to_select","Clique para escolher o documento para assinatura")})]})]})}),a.jsx($,{})]})},exports.Drawer=Sl,exports.DrawerClose=Dl,exports.DrawerContent=Al,exports.DrawerDescription=Rl,exports.DrawerFooter=Ml,exports.DrawerHeader=Il,exports.DrawerOverlay=El,exports.DrawerPortal=Pl,exports.DrawerTitle=Fl,exports.DrawerTrigger=Tl,exports.DropdownMenu=or,exports.DropdownMenuCheckboxItem=fr,exports.DropdownMenuContent=hr,exports.DropdownMenuGroup=lr,exports.DropdownMenuItem=xr,exports.DropdownMenuLabel=vr,exports.DropdownMenuPortal=dr,exports.DropdownMenuRadioGroup=ur,exports.DropdownMenuRadioItem=gr,exports.DropdownMenuSeparator=br,exports.DropdownMenuShortcut=yr,exports.DropdownMenuSub=cr,exports.DropdownMenuSubContent=pr,exports.DropdownMenuSubTrigger=mr,exports.DropdownMenuTrigger=ir,exports.ElectronicSignatureDialog=function({open:s,onOpenChange:r,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:c=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,v=g?e.t("esign_password_description"):e.t("esign_code_description"),b=m??v,[y,j]=t.useState(""),[w,N]=t.useState(!1),[_,C]=t.useState(!1),[k,S]=t.useState(null),T=t.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(j(""),r(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,r,f,g]),P=t.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),D=e=>{e||(j(""),S(null)),r(e)},E=g?d.Lock:d.ShieldCheck,A=g?"Senha":e.t("verification_code"),I=g?e.t("enter_password"):e.t("enter_code");return a.jsx(ys,{open:s,onOpenChange:D,children:a.jsxs(ks,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[a.jsx(Ss,{children:a.jsxs(Ds,{className:"flex items-center gap-2",children:[a.jsx(E,{className:"h-5 w-5 text-primary"}),u]})}),a.jsxs("div",{className:"py-4 space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:b}),!g&&l&&a.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[a.jsx(d.Mail,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),a.jsx("span",{className:"font-medium",children:l})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"signature-input",children:A}),a.jsx(Zt,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>j(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),T())},maxLength:g?void 0:c,placeholder:I,autoFocus:!0,className:Kt(k&&"border-destructive focus-visible:ring-destructive")}),k&&a.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&a.jsxs(Xt,{variant:"ghost",size:"sm",onClick:P,disabled:_,className:"text-primary",children:[a.jsx(d.RefreshCw,{className:Kt("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:()=>D(!1),disabled:w,children:h}),a.jsx(Xt,{onClick:T,disabled:!y.trim()||w,children:w?"Validando...":p})]})]})})},exports.EllipsisText=Yn,exports.EmailService=Op,exports.EmptyState=Kn,exports.EntitySelect=Or,exports.ErrorBoundary=Ci,exports.ExportDialog=function({open:e,onOpenChange:s,onExport:r,mode:n="table",options:o,title:i,description:l,cancelLabel:d="Cancelar",exportLabel:c="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=t.useState(""),h=o??("chart"===n?Kc:Gc),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),s(e)};return a.jsx(ys,{open:e,onOpenChange:g,children:a.jsxs(ks,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[a.jsx(Ss,{children:a.jsx(Ds,{children:x})}),a.jsxs("div",{className:"py-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),a.jsx(_d,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Cd,{value:e.value,id:`export-${e.value}`}),a.jsxs(as,{htmlFor:`export-${e.value}`,className:Kt("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"outline",onClick:()=>g(!1),children:d}),a.jsx(Xt,{onClick:()=>{m&&(r(m),s(!1),p(""))},disabled:!m,children:c})]})]})})},exports.FORBIDDEN_FILE_TYPES=dx,exports.FilterBar=Qo,exports.Form=As,exports.FormControl=zs,exports.FormDateField=bx,exports.FormDescription=Us,exports.FormField=({...e})=>a.jsx(Is.Provider,{value:{name:e.name},children:a.jsx(h.Controller,{...e})}),exports.FormItem=Rs,exports.FormLabel=Ls,exports.FormMessage=Os,exports.FormMultiSelectionField=_x,exports.FormNumericField=wx,exports.FormQuestionsField=Cx,exports.FormSingleSelectionField=Nx,exports.FormSkeleton=function({fields:e=4}){return a.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(Lr,{className:"h-4 w-24"}),a.jsx(Lr,{className:"h-10 w-full"})]},t)),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[a.jsx(Lr,{className:"h-10 w-20"}),a.jsx(Lr,{className:"h-10 w-20"})]})]})},exports.FormTextField=vx,exports.FormTimeField=yx,exports.FormUrlField=jx,exports.Grid=function({children:e,cols:t="auto-fit",gap:s="md",className:r}){return a.jsx("div",{className:Kt("grid",Ll[t],zl[s],r),children:e})},exports.H1=Yl,exports.H2=Ql,exports.H3=Xl,exports.H4=Jl,exports.HeaderSkeleton=function(){return a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Lr,{className:"h-8 w-8 rounded-full"}),a.jsx(Lr,{className:"h-6 w-32"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Lr,{className:"h-8 w-8"}),a.jsx(Lr,{className:"h-8 w-24"})]})]})},exports.HoverCard=Ul,exports.HoverCardContent=Vl,exports.HoverCardTrigger=Ol,exports.IconPicker=Uo,exports.IframeDialog=lu,exports.ImageEditor=function({value:e,onChange:s,onSubmit:r,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:c}){const{t:u}=y.useTranslation(),[m,p]=t.useState(e||{alignment:"center",allowDownload:!1}),h=t.useRef(null),{upload:x,uploading:f}=ch({uploadFunction:o,deleteFunction:i,defaultOptions:{...c,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,a)=>{const t={...m,[e]:a};p(t),s(t)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Zt,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await x(a),t={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(t),s(t)}catch(t){}finally{h.current&&(h.current.value="")}},className:"hidden"}),a.jsx(Xt,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Preview"}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:a.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:a.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"caption",children:"Legenda"}),a.jsx(Zs,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"alt",children:u("alt_text")}),a.jsx(Zt,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Alinhamento"}),a.jsxs(Bs,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[a.jsx(Ws,{children:a.jsx($s,{})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"left",children:"Esquerda"}),a.jsx(Qs,{value:"center",children:"Centro"}),a.jsx(Qs,{value:"right",children:"Direita"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"width",children:"Largura"}),a.jsx(Zt,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"height",children:"Altura"}),a.jsx(Zt,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Js,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),a.jsx(as,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a.jsx(Xt,{variant:"outline",onClick:n,children:"Cancelar"}),a.jsx(Xt,{onClick:()=>{m.imageUrl?r(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:t="",style:s}){const{t:r}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return a.jsx("div",{className:`flex ${n} my-4 ${t}`,style:s,children:a.jsxs("div",{className:"space-y-2 max-w-full",children:[a.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&a.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&a.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[a.jsx(d.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=rd,exports.Input=Zt,exports.InputGroup=Bl,exports.InputGroupAddon=$l,exports.InputGroupButton=Hl,exports.InputGroupInput=Gl,exports.InputGroupTextarea=Kl,exports.LINK_PROPERTIES=Hu,exports.LOGO_CONFIG=Be,exports.Label=as,exports.Large=ad,exports.Lead=ed,exports.LeadershipDialog=ih,exports.LeadershipForm=oh,exports.LeadershipPage=function({unassociatedUsers:s=[],onAssociateUser:r,onMoveNode:n,onMoveNodes:o,columns:i,nameHeader:l=e.t("leader"),rootDropLabel:c=e.t("leadership_make_root")}={}){const{alias:u}=In(),{data:m,isLoading:p,error:h,refetch:x}=Gp(),f=Xp(),g=Yp(),[v,b]=t.useState(()=>u?(e=>{try{const a=localStorage.getItem(`${lh}-${e}`);if(a)return new Set(JSON.parse(a))}catch{}return new Set})(u):new Set),[y,j]=t.useState([]),[w,N]=t.useState(new Set),[_,C]=t.useState(!0),[k,S]=t.useState(!1),[T,P]=t.useState(),[D,E]=t.useState(null),A=t.useMemo(()=>m?Hp(m):[],[m]),I=t.useMemo(()=>A.map(e=>e.id),[A]),M=I.length>0&&y.length===I.length,F=A.filter(e=>e.children.length>0).every(e=>v.has(e.id));t.useEffect(()=>{if(m&&m.length>0&&u){if(!localStorage.getItem(`${lh}-${u}`)){const e=m.map(e=>e.id),a=new Set(e);b(a),dh(u,a)}}},[m,u]);const R=t.useCallback(e=>{b(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),u&&dh(u,t),t})},[u]),L=t.useCallback(()=>{if(F){const e=new Set;b(e),u&&dh(u,e)}else{const e=new Set(A.filter(e=>e.children.length>0).map(e=>e.id));b(e),u&&dh(u,e)}},[F,A,u]),z=t.useCallback(e=>{j(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),U=t.useCallback(()=>{j(M?[]:I)},[M,I]),O=t.useCallback(e=>{N(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),V=t.useCallback(e=>A.find(a=>a.id===e),[A]),B=t.useCallback((e,a)=>{if(n)return void n(e,a);const t=s.find(a=>a.id===e);if(t){if(r){const e=a?V(a):null;r(t.id,e?.id_user||null)}else g.mutate({id_user:t.id,id_leader:a&&V(a)?.id_user||null});return}const o=V(e);if(!o)return;const i=a?V(a):null;f.mutate({id:o.id,id_leader:i?.id_user||null})},[n,s,r,V,f,g]),q=t.useCallback((e,a)=>{o?o(e,a):(e.forEach(e=>B(e,a)),j([]))},[o,B]),$=t.useCallback(e=>{P(e),E(null),S(!0)},[]),W=t.useCallback(()=>{P(void 0),E(null),S(!0)},[]),H=t.useCallback(()=>{S(!1),P(void 0),E(null)},[]),G=t.useCallback((e,a)=>{const t=w.has(e)&&w.size>1?Array.from(w):[e];a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",e),a.dataTransfer.setData("application/x-tree-ids",JSON.stringify(t)),a.currentTarget.style.opacity="0.4"},[w]),K=t.useMemo(()=>[{key:"subordinatesCount",header:"Subordinados",hoverContent:e=>e.subordinateNames&&e.subordinateNames.length>0?a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Subordinados diretos:"}),[...e.subordinateNames].sort((e,a)=>e.localeCompare(a)).map(e=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(d.User,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{children:e})]},e))]}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Sem subordinados diretos"})},{key:"email",header:"Email",className:"text-left",width:180,render:e=>a.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground text-sm",children:[a.jsx(d.Mail,{className:"h-3.5 w-3.5"}),e.email||"—"]})}],[]),Y=i??K;if(p)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(h)return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-destructive mb-4",children:"Erro ao carregar hierarquia de liderança"}),a.jsx(Xt,{onClick:()=>x(),children:e.t("try_again")})]})});const Q=A.filter(a=>a.name!==e.t("inactive_user")).length;return a.jsxs("div",{className:"flex flex-col h-full gap-3 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex gap-2 items-center",children:[a.jsxs(Xt,{size:"sm",onClick:W,children:[a.jsx(d.Plus,{className:"h-4 w-4 mr-2"}),"Definir Líder"]}),a.jsx(Xt,{size:"sm",variant:"outline",onClick:L,children:F?a.jsxs(a.Fragment,{children:[a.jsx(d.ChevronDown,{className:"h-4 w-4 mr-1"}),"Colapsar"]}):a.jsxs(a.Fragment,{children:[a.jsx(d.ChevronRight,{className:"h-4 w-4 mr-1"}),"Expandir"]})}),a.jsx("div",{className:"flex items-center gap-2 ml-4",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted rounded-md",children:[a.jsx(d.Users,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[Q," usuário",1!==Q?"s":""," associado",1!==Q?"s":""]})]})})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Arraste as linhas para reorganizar • Selecione múltiplos para mover em lote"})]}),a.jsx(vp,{data:m||[],columns:Y,nameKey:"name",nameHeader:l,expandedIds:v,onToggleExpand:R,iconComponent:a.jsx(d.Users,{className:"h-4 w-4 text-muted-foreground shrink-0"}),rowActionsVariant:"inline",enableRowDrag:!0,enableSelection:!0,selectedIds:y,onSelectItem:z,onSelectAll:U,isAllSelected:M,onMoveNode:B,onMoveNodes:q,rootDropLabel:c,emptyMessage:e.t("leadership_no_hierarchy"),renderActions:e=>a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>$(e),children:a.jsx(d.Pencil,{className:"h-4 w-4"})})}),s.length>0&&a.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>C(e=>!e),className:"w-full px-4 py-2.5 bg-muted/50 border-b flex items-center gap-2 hover:bg-muted/70 transition-colors cursor-pointer",children:[_?a.jsx(d.ChevronDown,{className:"h-4 w-4 text-muted-foreground shrink-0"}):a.jsx(d.ChevronRight,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx(d.UserPlus,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"Usuários não associados"}),a.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["(",s.length,")"]}),w.size>0&&a.jsxs("span",{className:"text-xs text-primary ml-1",children:["(",w.size," selecionado",w.size>1?"s":"",")"]}),a.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Arraste para a hierarquia acima"})]}),_&&a.jsx("div",{className:"divide-y",children:s.map(e=>a.jsxs("div",{draggable:!0,onDragStart:a=>G(e.id,a),onDragEnd:e=>{e.currentTarget.style.opacity="1"},className:Kt("flex items-center gap-3 px-4 py-2.5 hover:bg-accent/50 cursor-grab active:cursor-grabbing transition-colors",w.has(e.id)&&"bg-primary/5"),children:[a.jsx(Js,{checked:w.has(e.id),onCheckedChange:()=>O(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),a.jsx("span",{className:"text-muted-foreground shrink-0 select-none",children:"⠿"}),a.jsx(d.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-sm truncate",children:e.name}),a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id))})]}),a.jsxs("div",{className:"px-3 py-2 bg-muted/20 border rounded-lg text-xs text-muted-foreground flex justify-between",children:[a.jsxs("span",{children:["Usuários associados: ",Q]}),s.length>0&&a.jsxs("span",{children:["Usuários não associados: ",s.length]})]}),a.jsx(ih,{open:k,onOpenChange:H,leader:T,prefilledLeaderId:D,title:T?e.t("edit_name"):D?e.t("leadership_add_subordinate"):e.t("leadership_add_root")},`leadership-dialog-${u}`)]})},exports.List=od,exports.ListPanel=cm,exports.LoadingState=rr,exports.LocaleProvider=gi,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsx(rs,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),a.jsxs(os,{className:"text-center space-y-4",children:[a.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a.jsx(Xt,{onClick:async()=>{ze()?await Tn.loginDev():Tn.loginProd()},className:"w-full",size:"lg",children:ze()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=qe,exports.MODULES_DATA=$i,exports.MONTHS_MAP=$u,exports.ManageAccessModal=Bp,exports.MatrixRiskPanel=ym,exports.Menubar=vc,exports.MenubarCheckboxItem=_c,exports.MenubarContent=wc,exports.MenubarGroup=hc,exports.MenubarItem=Nc,exports.MenubarLabel=kc,exports.MenubarMenu=pc,exports.MenubarPortal=xc,exports.MenubarRadioGroup=gc,exports.MenubarRadioItem=Cc,exports.MenubarSeparator=Sc,exports.MenubarShortcut=Tc,exports.MenubarSub=fc,exports.MenubarSubContent=jc,exports.MenubarSubTrigger=yc,exports.MenubarTrigger=bc,exports.MindMap=({value:e,defaultValue:s,onChange:r,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:d,className:c,height:u=600})=>{const{t:m}=y.useTranslation(),p=Qm({value:e,defaultValue:s,onChange:r,readOnly:o}),h=sp(p.root),x=function(){const[e,a]=t.useState({x:0,y:0,scale:1}),s=t.useRef(!1),r=t.useRef({x:0,y:0,tx:0,ty:0}),n=t.useCallback(a=>{0!==a.button&&1!==a.button||(s.current=!0,r.current={x:a.clientX,y:a.clientY,tx:e.x,ty:e.y},a.currentTarget.setPointerCapture(a.pointerId))},[e.x,e.y]),o=t.useCallback(e=>{s.current&&a(a=>({...a,x:r.current.tx+(e.clientX-r.current.x),y:r.current.ty+(e.clientY-r.current.y)}))},[]),i=t.useCallback(e=>{if(s.current){s.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=t.useCallback((e,t,s)=>{a(a=>{const r=Math.min(2.5,Math.max(.3,a.scale+e));if(r===a.scale)return a;if(void 0===t||void 0===s)return{...a,scale:r};const n=r/a.scale;return{scale:r,x:t-(t-a.x)*n,y:s-(s-a.y)*n}})},[]),d=t.useCallback(()=>l(.15),[l]),c=t.useCallback(()=>l(-.15),[l]),u=t.useCallback(()=>a({x:0,y:0,scale:1}),[]),m=t.useCallback((e,t,s,r)=>{const n=Math.min((s-64)/e,(r-64)/t,1.5),o=Math.max(.3,n);a({scale:o,x:(s-e*o)/2,y:(r-t*o)/2})},[]),p=t.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const a=e.currentTarget.getBoundingClientRect(),t=e.clientX-a.left,s=e.clientY-a.top;l(e.deltaY>0?-.1:.1,t,s)},[l]);return t.useEffect(()=>{const e=()=>s.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:a,zoomIn:d,zoomOut:c,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=ae.useRef(null),g=ae.useRef(null),v=ae.useRef(null),[b,j]=ae.useState(null),[w,N]=ae.useState(null);ae.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:a,containerRef:s,onStartEditing:r,readOnly:n,extraShortcuts:o}){t.useEffect(()=>{const t=t=>{const i=s.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=t.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const d={layout:a,selectedId:e.selectedId,setSelectedId:e.setSelectedId},c=e.selectedId;for(const a of o??[])if(a.key.toLowerCase()===t.key.toLowerCase()&&!!a.ctrl===(t.ctrlKey||t.metaKey)&&!!a.shift===t.shiftKey&&!!a.alt===t.altKey)return t.preventDefault(),void a.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((t.ctrlKey||t.metaKey)&&"z"===t.key.toLowerCase())return t.preventDefault(),void(t.shiftKey?e.redo():e.undo());if("ArrowUp"===t.key)return t.preventDefault(),void rp("up",d);if("ArrowDown"===t.key)return t.preventDefault(),void rp("down",d);if("ArrowLeft"===t.key)return t.preventDefault(),void rp("left",d);if("ArrowRight"===t.key)return t.preventDefault(),void rp("right",d);if(c){if(" "===t.key)return t.preventDefault(),void e.toggleNode(c);if("F2"===t.key){if(n)return;return t.preventDefault(),void r(c)}if(!n){if("Enter"===t.key&&!t.shiftKey)return t.preventDefault(),c===e.root.id?e.addChild(c,""):e.addSibling(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Insert"===t.key||"Tab"===t.key)return t.preventDefault(),e.addChild(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Delete"===t.key||"Backspace"===t.key){if(c===e.root.id)return;return t.preventDefault(),void e.removeNode(c)}}}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,a,s,r,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||j(e)},readOnly:o,extraShortcuts:l});const _=ae.useRef(!1);ae.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:a,clientHeight:t}=e;a>0&&t>0&&h.width>0&&(x.fitTo(h.width,h.height,a,t),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,T=ae.useRef(null),P=e=>a=>{if(o)return;const t=T.current;if(!t||t===e)return;const s=Om(p.root,t);s&&Om(s.node,e)||(a.preventDefault(),a.dataTransfer.dropEffect="move",N(e))},D=()=>N(null),E=e=>a=>{a.preventDefault();const t=T.current;N(null),T.current=null,t&&t!==e&&p.moveNode(t,e)};return a.jsx(jr,{children:a.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:Kt("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",c),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&a.jsx(lp,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");j(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void j(e)}const e=p.addSibling(C,"");j(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,a,t="application/json"){const s=new Blob([e],{type:t}),r=URL.createObjectURL(s),n=document.createElement("a");n.href=r,n.download=a,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}(dp(p.root),"mind-map.json")},onExportImage:async()=>{if(v.current)try{await async function(e,a="mind-map.png"){const t=e.cloneNode(!0),s=(new XMLSerializer).serializeToString(t),r=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`,n=new Image;await new Promise((e,a)=>{n.onload=()=>e(),n.onerror=()=>a(new Error("Failed to load SVG snapshot")),n.src=r});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const d=l.getContext("2d");if(!d)throw new Error("Canvas 2D context unavailable");d.fillStyle="#ffffff",d.fillRect(0,0,l.width,l.height),d.drawImage(n,0,0,l.width,l.height);const c=await new Promise(e=>l.toBlob(e,"image/png"));if(!c)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(c),m=document.createElement("a");m.href=u,m.download=a,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(v.current,"mind-map.png")}catch(e){}}}),a.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:a.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[a.jsx("svg",{ref:v,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(t=>a.jsx(op,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),h.nodes.map(e=>{return a.jsx(np,{layout:e,selected:C===e.node.id,editing:b===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>j(e.node.id),onFinishEditing:a=>{null!==a&&p.renameNode(e.node.id,a),j(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(t=e.node.id,e=>{o||t===p.root.id||(T.current=t,e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="move")}),onDragOver:P(e.node.id),onDragLeave:D,onDrop:E(e.node.id),isDropTarget:w===e.node.id,renderNodeContent:d},e.node.id);var t})]})})]})})},exports.ModalStateProvider=function({children:e}){const[s,r]=t.useState(new Set),[n,o]=t.useState(!1),i=t.useCallback(e=>{r(a=>{const t=new Set(a);return t.add(e),t})},[]),l=t.useCallback(e=>{r(a=>{const t=new Set(a);return t.delete(e),t})},[]),d=t.useCallback(e=>{o(e)},[]),c=t.useMemo(()=>s.size>0||n,[s,n]),u=t.useMemo(()=>({openModals:s,hasOpenModal:c,registerModal:i,unregisterModal:l,setHasOpenModal:d}),[s,c,i,l,d]);return a.jsx(Rp.Provider,{value:u,children:e})},exports.ModuleAccessGuard=tl,exports.ModuleGrid=Gi,exports.ModuleOfferContent=function({title:e,description:t,image:s,icon:r,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),c=n??l("want_to_know_more");return a.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(s||r)&&a.jsx("div",{className:"flex items-center justify-center",children:s?a.jsx("img",{src:s,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):r?a.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:a.jsx(r,{className:"h-12 w-12 text-primary"})}):null}),a.jsxs("div",{className:"space-y-3 max-w-lg",children:[a.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t})]}),i?a.jsx("div",{className:"w-full",children:i}):o?a.jsxs(Xt,{onClick:o,size:"lg",className:"gap-2",children:[a.jsx(d.Sparkles,{className:"h-4 w-4"}),c]}):null]})},exports.ModuleProvider=yi,exports.ModulesContent=Ki,exports.ModulesDialog=Zi,exports.ModulesFooterCards=qi,exports.MultiSelect=Or,exports.MultiselectPermissions=function({items:s,categories:r,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:c=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:v,onDisclaimerClick:b,className:j}){const[w,N]=t.useState(r[0]?.id??""),[_,C]=t.useState(""),[k,S]=t.useState([]),[T,P]=t.useState(!1),D=t.useMemo(()=>mu(n[w]),[n,w]),E=t.useMemo(()=>function(e){const{t:a}=y.useTranslation(),t=new Set;if(!e)return t;for(const s of e)s.inheritedIds?.forEach(e=>t.add(e));return t}(n[w]),[n,w]),A=t.useMemo(()=>s.filter(e=>D.has(e.id)),[s,D]),I=t.useMemo(()=>{const e=uu(_);return s.filter(a=>!D.has(a.id)&&!(e&&!uu(a.name).includes(e)))},[s,D,_]),M=t.useMemo(()=>{const e={};for(const a of r)e[a.id]=mu(n[a.id]).size;return e},[r,n]),F=t.useCallback(e=>{N(e),S([]),C("")},[]),R=t.useCallback(e=>{S(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),L=t.useCallback(()=>{if(0===k.length)return;const e=[...n[w]??[]];for(const a of k){const t=s.find(e=>e.id===a),r=t?.group??"default",n=e.find(e=>e.context===r);n?n.allowedIds.includes(a)||(n.allowedIds=[...n.allowedIds,a]):e.push({context:r,allowedIds:[a],inheritedIds:[]})}o({...n,[w]:e}),S([]),C(""),P(!1)},[k,n,w,s,o]),z=t.useCallback(e=>{if(E.has(e))return;const a=(n[w]??[]).map(a=>({...a,allowedIds:a.allowedIds.filter(a=>a!==e)}));o({...n,[w]:a})},[n,w,E,o]);return l?a.jsxs("div",{className:Kt("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",j),children:[a.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),a.jsx("div",{className:"h-9 w-full bg-muted rounded"}),a.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):a.jsx("div",{className:Kt("rounded-md border bg-muted/30",j),children:a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:c}),a.jsxs(Bs,{value:w,onValueChange:F,children:[a.jsx(Ws,{className:"h-9 text-sm",children:a.jsx($s,{})}),a.jsx(Ks,{children:r.map(e=>a.jsx(Qs,{value:e.id,children:a.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,M[e.id]>0&&a.jsx(ar,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:M[e.id]})]})},e.id))})]})]}),!i&&a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(kr,{open:T,onOpenChange:P,children:[a.jsx(Sr,{asChild:!0,children:a.jsxs(Xt,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,a.jsx(d.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Tr,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[a.jsx("div",{className:"p-2 border-b",children:a.jsxs("div",{className:"relative",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),a.jsx(Fo,{className:"max-h-[220px]",children:0===I.length?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):a.jsx("div",{className:"p-1",children:I.map(e=>{const t=k.includes(e.id);return a.jsxs("div",{className:Kt("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",t&&"bg-accent/50"),onClick:()=>R(e.id),children:[a.jsx("div",{className:Kt("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",t&&"bg-primary text-primary-foreground"),children:t&&a.jsx(d.Check,{className:"h-3 w-3"})}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&a.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),a.jsxs(Xt,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:L,children:[a.jsx(d.Plus,{className:"h-4 w-4"}),u]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:m}),a.jsx("div",{className:Kt("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===A.length?a.jsx("span",{className:"text-sm text-muted-foreground",children:p}):a.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(e=>{const t=E.has(e.id);return a.jsxs(ar,{variant:t?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!t&&a.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:a.jsx(d.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",v&&b&&a.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:b,children:v})]})]})]})})},exports.Muted=sd,exports.NavigationMenu=id,exports.NavigationMenuContent=md,exports.NavigationMenuIndicator=xd,exports.NavigationMenuItem=dd,exports.NavigationMenuLink=pd,exports.NavigationMenuList=ld,exports.NavigationMenuTrigger=ud,exports.NavigationMenuViewport=hd,exports.NavigationProvider=Cp,exports.NumericPanel=lm,exports.OnboardingDialog=$c,exports.OnlineEditorDialog=function({open:e,onOpenChange:s,identifier:r,fileName:n,mode:o="edit",type:i="document",onClose:l,className:c}){const[u,m]=t.useState(!0),p=function(e,a="edit",t="document"){return`https://docs.google.com/${t}/d/${e}/${a}?usp=drivesdk?embedded=true&rm=demo`}(r,o,i);t.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=t.useCallback(()=>{l?.(),s(!1)},[l,s]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,h]),a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:Kt("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",c),children:[a.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?a.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):a.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),a.jsx("div",{className:"flex items-center ml-4 z-20",children:a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(_r,{children:"Fechar"})]})})]}),a.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?a.jsx(sr,{className:"h-14 w-14"}):a.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[a.jsx(sr,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=Zl,exports.PRIORITIES=Uh,exports.PROD_PROJECT_ID=Pe,exports.PROGRESS_ALLOWED_STATUSES=Vh,exports.PageBreadcrumb=function({items:e,maxItems:t=3,className:s}){const r=e.length>t?[e[0],...e.slice(-(t-1))]:e,n=e.length>t;return a.jsx(xl,{className:s,children:a.jsx(fl,{children:r.map((e,t)=>{const s=0===t,r=n&&1===t;return a.jsxs(gl,{children:[!s&&a.jsx(yl,{}),r&&a.jsxs(a.Fragment,{children:[a.jsx(jl,{}),a.jsx(yl,{})]}),e.isCurrentPage?a.jsx(bl,{children:e.label}):a.jsx(vl,{asChild:!0,children:a.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=ii,exports.Pagination=fd,exports.PaginationContent=gd,exports.PaginationEllipsis=wd,exports.PaginationItem=vd,exports.PaginationLink=bd,exports.PaginationNext=jd,exports.PaginationPrevious=yd,exports.PanelError=sm,exports.PanelHeader=tm,exports.PanelLoader=rm,exports.PanelNoData=nm,exports.PanelUnavailable=om,exports.ParetoPanel=gm,exports.PerformancePanel=bm,exports.PiePanel=fm,exports.PlaceCard=qp,exports.PlacesList=function({places:e,isLoading:t,manageAccessConfig:s}){return t?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando dados..."})]})}):e&&0!==e.length?a.jsxs("div",{className:"space-y-1",children:[a.jsx("h2",{className:"text-xl font-bold mb-4",children:"Estrutura de Locais"}),e.map(e=>a.jsx(qp,{place:e,manageAccessConfig:s},e.id))]}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-3",children:[a.jsx(d.Building2,{className:"h-12 w-12 text-muted-foreground/50"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Nenhum local encontrado"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Não há locais cadastrados para esta unidade."})]})]})},exports.Popover=kr,exports.PopoverContent=Tr,exports.PopoverTrigger=Sr,exports.Progress=Nd,exports.ProtectedRoute=({children:s})=>{const{isAuthenticated:r,isLoading:n}=In();if(t.useEffect(()=>{if(n)return;if(r)return;if(tn.isManualLogout())return void(window.location.href="/login");const e=new URLSearchParams(window.location.search),a=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,t=new URLSearchParams(a);if(e.has("access_token")||t.has("access_token"))return;const s=ze(),o=window.location.pathname+window.location.search+window.location.hash;["/","/login","/callback"].includes(window.location.pathname)||localStorage.setItem("auth_return_url",o);(async()=>{s?await Tn.loginDev():Tn.loginProd()})()},[r,n]),n&&!r)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsx(rs,{className:"text-xl font-semibold",children:"Carregando..."})}),a.jsxs(os,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!r){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsx(rs,{className:"text-xl font-semibold",children:"Processando..."})}),a.jsxs(os,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(ts,{className:"w-full max-w-md",children:[a.jsx(ss,{className:"text-center",children:a.jsx(rs,{className:"text-xl font-semibold",children:"Iniciando..."})}),a.jsxs(os,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:ze()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a.jsx(a.Fragment,{children:s})},exports.QUALIEX_CONFIG=Ve,exports.QUERY_KEYS={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},exports.QualiexEnrichmentService=wn,exports.QualiexErrorInterceptor=xn,exports.QualiexUserField=Bo,exports.RadioGroup=_d,exports.RadioGroupItem=Cd,exports.ReadOnlyTextField=gx,exports.ReportRequestList=function({requests:e,isLoading:s=!1,onGetReportUrl:r,formatDate:n=fu,labels:o,className:i}){const{t:l}=y.useTranslation(),c={...hu,...o},[u,m]=t.useState(""),[p,h]=t.useState(!1),[x,f]=t.useState(""),[g,v]=t.useState(""),[b,j]=t.useState(null),w=t.useMemo(()=>{if(!u)return e;const a=xu(u);return e.filter(e=>xu(e.reportName).includes(a))},[e,u]),N=t.useCallback(async e=>{if(!b){j(e.id);try{const a=await r(e.id);a&&(f(a),v(e.reportName),h(!0))}finally{j(null)}}},[r,b]);return s?a.jsx("div",{className:Kt("space-y-3",i),children:Array.from({length:5}).map((e,t)=>a.jsx(Lr,{className:"h-12 w-full"},t))}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Kt("space-y-3",i),children:[a.jsxs("div",{className:"relative max-w-sm",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{className:"pl-8 h-9 text-sm",placeholder:c.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),a.jsx(Fo,{className:"rounded-md border",children:a.jsxs(Ln,{children:[a.jsx(zn,{children:a.jsxs(Vn,{children:[a.jsx(Bn,{className:"min-w-[140px]",children:c.report}),a.jsx(Bn,{className:"min-w-[150px]",children:c.status}),a.jsx(Bn,{className:"min-w-[160px]",children:c.requestDate}),a.jsx(Bn,{className:"min-w-[160px]",children:c.lastUpdate}),a.jsx(Bn,{className:"min-w-[160px]",children:c.expirationDate}),a.jsx(Bn,{className:"min-w-[140px]"})]})}),a.jsx(Un,{children:0===w.length?a.jsx(Vn,{children:a.jsx(qn,{colSpan:6,className:"text-center text-muted-foreground py-8",children:c.noResults})}):w.map(e=>{const t=function(e){const{t:a}=y.useTranslation();return new Date>new Date(e.expirationDate)&&e.statusId===exports.ReportRequestStatus.Completed?exports.ReportRequestStatus.Expired:e.statusId}(e),s=function(e,t){const{t:s}=y.useTranslation();switch(e){case exports.ReportRequestStatus.WaitingProcessing:return{label:t.statusWaiting,icon:a.jsx(d.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case exports.ReportRequestStatus.Processing:return{label:t.statusProcessing,icon:a.jsx(d.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case exports.ReportRequestStatus.Completed:return{label:t.statusCompleted,icon:a.jsx(d.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case exports.ReportRequestStatus.Error:return{label:t.statusError,icon:a.jsx(d.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case exports.ReportRequestStatus.Expired:return{label:t.statusExpired,icon:a.jsx(d.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(t,c),r=t===exports.ReportRequestStatus.Completed,o=t===exports.ReportRequestStatus.Expired;return a.jsxs(Vn,{children:[a.jsx(qn,{className:"font-medium",children:e.reportName}),a.jsx(qn,{children:a.jsxs(ar,{variant:s.variant,className:Kt("gap-1",s.className),children:[s.icon,s.label]})}),a.jsx(qn,{className:"text-sm",children:n(new Date(e.requestDate))}),a.jsx(qn,{className:"text-sm",children:n(new Date(e.lastUpdate))}),a.jsx(qn,{className:Kt("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),a.jsx(qn,{children:a.jsxs(Xt,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!r||b===e.id,onClick:()=>N(e),children:[b===e.id?a.jsx(d.Loader2,{className:"h-4 w-4 animate-spin"}):a.jsx(d.Eye,{className:"h-4 w-4"}),c.viewReport]})})]},e.id)})})]})})]}),a.jsx(lu,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ResizableHandle=({withHandle:e,className:t,...s})=>a.jsx(Ce.PanelResizeHandle,{className:Kt("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...s,children:e&&a.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:a.jsx(d.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=kd,exports.ResizablePanelGroup=({className:e,...t})=>a.jsx(Ce.PanelGroup,{className:Kt("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),exports.RichTextEditor=({value:s,onChange:r,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:c=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=t.useState("visual"),x=q.useEditor({extensions:[$.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:s||"",editable:!n,onUpdate:({editor:e})=>{r(e.getHTML())}});ae.useEffect(()=>{x&&s!==x.getHTML()&&x.commands.setContent(s||"")},[s,x]);const f=t.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,a=window.prompt("URL",e);null!==a&&(""!==a?x.chain().focus().extendMarkRange("link").setLink({href:a}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?a.jsxs("div",{className:Kt("space-y-2",u),children:[l&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsxs(Xt,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[a.jsx(d.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),a.jsxs(Xt,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[a.jsx(d.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),a.jsxs(Xt,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[a.jsx(d.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),c&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",a.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&a.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[a.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[a.jsx(Uc,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:a.jsx(d.Heading1,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:a.jsx(d.Heading2,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:a.jsx(d.Heading3,{className:"h-4 w-4"})}),a.jsx(Oc,{}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:a.jsx(d.Bold,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:a.jsx(d.Italic,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:a.jsx(d.Underline,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:a.jsx(d.Strikethrough,{className:"h-4 w-4"})}),a.jsx(Oc,{}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:a.jsx(d.List,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:a.jsx(d.ListOrdered,{className:"h-4 w-4"})}),a.jsx(Oc,{}),a.jsx(Uc,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:a.jsx(d.Highlighter,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:a.jsx(d.Link,{className:"h-4 w-4"})}),a.jsx(Oc,{}),a.jsx(Uc,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:a.jsx(d.RemoveFormatting,{className:"h-4 w-4"})}),a.jsx(Oc,{}),a.jsx(Uc,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:a.jsx(d.Undo,{className:"h-4 w-4"})}),a.jsx(Uc,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:a.jsx(d.Redo,{className:"h-4 w-4"})})]}),a.jsx(q.EditorContent,{editor:x,className:Kt("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&a.jsx("textarea",{value:s||"",onChange:e=>r(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&a.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:a.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:s||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.SEARCH_CONFIG=Re,exports.STATUS_COLORS=Ih,exports.STATUS_LABELS=Lh,exports.STATUS_MAP=Fh,exports.STATUS_TEXT_COLORS=Mh,exports.SUPPORTED_LOCALES=Pt,exports.ScrollArea=Fo,exports.ScrollBar=Ro,exports.Select=Bs,exports.SelectApproverDialog=Bx,exports.SelectContent=Ks,exports.SelectGroup=qs,exports.SelectItem=Qs,exports.SelectLabel=Ys,exports.SelectScrollDownButton=Gs,exports.SelectScrollUpButton=Hs,exports.SelectSearch=Or,exports.SelectSeparator=Xs,exports.SelectTrigger=Ws,exports.SelectValue=$s,exports.Separator=ls,exports.Sheet=Sd,exports.SheetBody=Fd,exports.SheetClose=Pd,exports.SheetContent=Id,exports.SheetDescription=zd,exports.SheetFooter=Rd,exports.SheetHeader=Md,exports.SheetOverlay=Ed,exports.SheetPortal=Dd,exports.SheetTitle=Ld,exports.SheetTrigger=Td,exports.Sidebar=qd,exports.SidebarActionTrigger=Ap,exports.SidebarContent=Xd,exports.SidebarFooter=Yd,exports.SidebarGroup=Jd,exports.SidebarGroupAction=ec,exports.SidebarGroupContent=ac,exports.SidebarGroupLabel=Zd,exports.SidebarHeader=function({open:e,appName:s}){const[r,n]=t.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx(Kd,{className:"p-0 gap-0",children:e?a.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[a.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:a.jsx("img",{src:We.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),s&&a.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:a.jsx("span",{className:"line-clamp-2",children:(e=>{const t=e.split(" ");if(t.length<=1)return a.jsxs("span",{className:"whitespace-nowrap",children:[e," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const s=t[t.length-1],r=t.slice(0,-1).join(" ");return a.jsxs(a.Fragment,{children:[r," ",a.jsxs("span",{className:"whitespace-nowrap",children:[s," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(s)})})]}):a.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:a.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:a.jsx("img",{src:We.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a.jsx(Zi,{open:r,onOpenChange:n})]})},exports.SidebarInput=Gd,exports.SidebarInset=Hd,exports.SidebarLogo=Pp,exports.SidebarMenu=tc,exports.SidebarMenuAction=oc,exports.SidebarMenuBadge=ic,exports.SidebarMenuButton=nc,exports.SidebarMenuItem=sc,exports.SidebarMenuSkeleton=lc,exports.SidebarMenuSub=dc,exports.SidebarMenuSubButton=uc,exports.SidebarMenuSubItem=cc,exports.SidebarProvider=Bd,exports.SidebarRail=Wd,exports.SidebarSeparator=Qd,exports.SidebarSkeleton=function(){return a.jsx("div",{className:"w-64 border-r bg-muted/10",children:a.jsxs("div",{className:"p-4",children:[a.jsx(Lr,{className:"h-8 w-32 mb-6"}),a.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>a.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[a.jsx(Lr,{className:"h-4 w-4"}),a.jsx(Lr,{className:"h-4 w-20"})]},t))})]})})},exports.SidebarTrigger=$d,exports.SignConfigForm=function({onSaved:e}){const{config:s,isLoading:r,saveConfig:n}=vh(),{t:o}=y.useTranslation(),[i,c]=t.useState(""),[u,m]=t.useState("sandbox"),[p,h]=t.useState(!1);return t.useEffect(()=>{!r&&s&&(c(s.api_key),m(s.environment))},[s,r]),r?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(d.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):a.jsxs("div",{className:"space-y-4",children:[s?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600",children:[a.jsx(d.CheckCircle,{className:"h-4 w-4"}),a.jsx("span",{children:o("sign_configured",o("sign_configured_unit"))})]}):a.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600",children:[a.jsx(d.AlertCircle,{className:"h-4 w-4"}),a.jsx("span",{children:o("sign_not_configured",o("sign_not_configured_unit"))})]}),a.jsxs(ts,{children:[a.jsx(ss,{children:a.jsx(rs,{className:"text-base",children:o("sign_digital_config")})}),a.jsx(os,{children:a.jsxs("form",{onSubmit:async a=>{if(a.preventDefault(),i.trim()){h(!0);try{await n(i.trim(),u),l.toast.success(o("sign_config_saved",o("sign_config_saved_success"))),e?.()}catch(t){l.toast.error(o("sign_config_save_error",o("sign_config_save_err")))}finally{h(!1)}}else l.toast.error(o("sign_api_key_required",o("sign_api_key_info")))},className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"sign-api-key",children:"API Key"}),a.jsx(Zt,{id:"sign-api-key",type:"password",placeholder:o("sign_api_key_placeholder",o("sign_api_key_input")),value:i,onChange:e=>c(e.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:o("sign_environment","Ambiente")}),a.jsxs(Bs,{value:u,onValueChange:e=>m(e),children:[a.jsx(Ws,{children:a.jsx($s,{})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"sandbox",children:"Sandbox (Testes)"}),a.jsx(Qs,{value:"production",children:"Produção"})]})]})]}),a.jsxs(Xt,{type:"submit",disabled:p,children:[p&&a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),s?o("sign_update_config",o("sign_update_config_btn")):o("sign_save_config",o("sign_save_config_btn"))]})]})})]})]})},exports.SignWidget=kh,exports.SingleFileUpload=function({storedFile:e,customFileName:s,allowedExtensions:r,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:c=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:v,onFileReplace:b,onDownload:j,onView:w,className:N}){const{t:_}=y.useTranslation(),C=t.useRef(null),[k,S]=t.useState(null),[T,P]=t.useState(null),[D,E]=t.useState(!1),A=k||e,I=k?.name||e?.name||"",M=k?.size||e?.size;I&&ux(I);const F=s||I,R=l&&!k&&!!e,L=c&&!k&&!!e,z=!!T||!!f||p&&h&&!A,U=!!A,O=t.useCallback(e=>{if(dx.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(r?.length){const a=ux(e.name);if(!r.includes(a))return{type:"extension",message:n}}return null},[o,i,r,n]),V=t.useCallback(e=>{const a=e.target.files?.[0];if(!a)return;const t=O(a);if(t)return P(t),S(null),void(C.current&&(C.current.value=""));P(null),S(a),g?.(a),C.current&&(C.current.value="")},[O,g]),B=t.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const a=e.dataTransfer.files?.[0];if(!a)return;const t=O(a);if(t)return P(t),void S(null);P(null),S(a),g?.(a)},[x,O,g]),q=t.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),$=t.useCallback(()=>{b?.(),C.current?.click()},[b]),W=t.useCallback(()=>{S(null),P(null),v?.(),C.current&&(C.current.value="")},[v]),H=t.useCallback(async()=>{if(!D&&e&&j){E(!0);try{await j(e)}finally{E(!1)}}},[D,e,j]),G=t.useCallback(()=>{e&&w&&w(e)},[e,w]),K=t.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!T)return p&&h&&!A?_("required_field"):null;switch(T.type){case"extension":return T.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${cx(o)}`;case"max-size":return`Tamanho máximo: ${cx(i)}`;default:return _("file_error")}})();return a.jsxs("div",{className:Kt("space-y-1",N),children:[a.jsx("div",{className:Kt("rounded-md border border-dashed transition-colors",U&&"border-solid border-border",!U&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:U?a.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a.jsx(d.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-xs truncate",children:F})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=M&&a.jsx("span",{className:"text-xs text-muted-foreground",children:cx(M)}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[R&&j&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:D,onClick:H,children:a.jsx(d.Download,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(_r,{children:"Download"})]}),L&&w&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:a.jsx(d.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(_r,{children:"Visualizar"})]}),u&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:$,children:a.jsx(d.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(_r,{children:"Substituir"})]}),m&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground"})})}),a.jsx(_r,{children:_("remove")})]})]})]})]}):a.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:B,onDragOver:q,children:[a.jsx(d.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",a.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&a.jsx("p",{className:"text-xs text-destructive",children:Y}),a.jsx("input",{ref:C,type:"file",className:"hidden",accept:r?.map(e=>`.${e}`).join(","),onChange:V,disabled:x})]})},exports.Skeleton=Lr,exports.Slider=mc,exports.Small=td,exports.SonnerToaster=nr,exports.Spinner=sr,exports.SplitButton=Wc,exports.Stack=Yo,exports.StatusBadge=vu,exports.StepSelector=Qc,exports.Stepper=Qc,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:s={},minHeight:r="80vh",...n}){const o=t.useMemo(()=>{const a=`${e}/api/reports/v1/Viewer/InitViewer`,t=new URLSearchParams(s).toString();return t?`${a}?${t}`:a},[e,s]);return a.jsx(lu,{...n,url:o,minHeight:r})},exports.Switch=Oo,exports.TIMEZONES=Et,exports.TabPageContent=function({children:e,className:t}){return a.jsx("div",{className:Kt("space-y-6",t),children:e})},exports.TabPageHeader=function({title:e,description:t,actions:s,className:r}){return a.jsxs("div",{className:Kt("space-y-4",r),children:[a.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&a.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),s&&a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:s})]}),a.jsx(ls,{})]})},exports.TabPageLayout=function({children:e,className:t}){return a.jsx("div",{className:Kt("flex flex-col h-full",t),children:a.jsx(Fo,{className:"flex-1",children:a.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Ln,exports.TableBody=Un,exports.TableCaption=$n,exports.TableCell=qn,exports.TableFooter=On,exports.TableHead=Bn,exports.TableHeader=zn,exports.TableResizeHandle=Qn,exports.TableRow=Vn,exports.TableRowActions=ho,exports.TableSkeleton=Wn,exports.Tabs=ki,exports.TabsContent=Pi,exports.TabsList=Si,exports.TabsTrigger=Ti,exports.TeamSelector=function({users:e,value:s,onChange:r,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:c="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=t.useState(""),[v,b]=t.useState(!1),[j,w]=t.useState(null),N=t.useMemo(()=>new Set(s),[s]),_=t.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=t.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=t.useCallback(e=>{e&&!N.has(e)&&(r([...s,e]),g(""))},[s,r,N]),S=t.useCallback(e=>{i?(w(e),b(!0)):r(s.filter(a=>a!==e))},[s,r,i]),T=t.useCallback(()=>{j&&r(s.filter(e=>e!==j)),b(!1),w(null)},[j,s,r]);return a.jsxs("div",{className:Kt("space-y-3",m),children:[a.jsx("div",{className:"flex items-start gap-3",children:a.jsx("div",{className:"flex-1",children:a.jsx(Or,{options:C,value:f,onValueChange:e=>{const a="string"==typeof e?e:e?.[0]??"";g(a),a&&k(a)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),a.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?a.jsx("div",{className:"space-y-2",children:_.map(e=>a.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[a.jsxs(ml,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a.jsx(pl,{src:e.avatar,alt:e.name}),a.jsx(hl,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(d.Shield,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(d.MapPin,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a.jsx("button",{type:"button",className:Kt("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:a.jsx(d.X,{className:"h-4 w-4"})})]})]},e.id))}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a.jsx(d.User,{className:"h-12 w-12 mb-2 opacity-30"}),a.jsx("p",{className:"text-sm",children:x})]}),a.jsx(ys,{open:v,onOpenChange:b,children:a.jsxs(ks,{className:"sm:max-w-[400px]",children:[a.jsx(Ss,{children:a.jsx(Ds,{children:h})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:c}),a.jsxs(Ps,{children:[a.jsx(Xt,{variant:"ghost",onClick:()=>b(!1),children:"Cancelar"}),a.jsx(Xt,{variant:"destructive",onClick:T,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:s,open:r,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:c=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=t.useState(!1),h=t.useCallback(()=>{o(s.id)},[o,s.id]);return a.jsxs(a.Fragment,{children:[a.jsx(ys,{open:r&&!m,onOpenChange:e=>!e&&n(),children:a.jsxs(ks,{className:"sm:max-w-md",children:[a.jsx(Ss,{children:a.jsxs(Ds,{className:"flex items-center gap-2",children:[a.jsx(d.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),a.jsxs("div",{className:"space-y-4",children:[s.description&&a.jsx(Fo,{className:"max-h-48",children:a.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:s.description}})}),s.file&&a.jsxs(Xt,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[a.jsx(d.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),a.jsxs(Ps,{className:"gap-2 sm:gap-0",children:[a.jsx(Xt,{variant:"ghost",onClick:n,children:l}),a.jsx(Xt,{onClick:h,children:c})]})]})}),m&&a.jsx(du,{term:s,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=du,exports.TextPanel=dm,exports.Textarea=Zs,exports.Timepicker=Yc,exports.Toaster=nr,exports.Toggle=bo,exports.ToggleGroup=jo,exports.ToggleGroupItem=wo,exports.TokenManager=tn,exports.TokenService=Gr,exports.Tooltip=wr,exports.TooltipContent=_r,exports.TooltipProvider=jr,exports.TooltipTrigger=Nr,exports.TreeSelect=Hr,exports.TreeTable=vp,exports.TruncatedCell=Yn,exports.UpdatesNotification=eu,exports.UsersGroupsSelector=function({users:s,groups:r=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:c=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:v}){const[b,y]=t.useState(!1),[j,w]=t.useState(""),[N,_]=t.useState(void 0),C=t.useMemo(()=>new Set(n),[n]),k=t.useMemo(()=>{let e=s;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),j){const a=cu(j);e=e.filter(e=>cu(e.name).includes(a)||cu(e.email??"").includes(a))}return e},[s,N,j]),S=t.useMemo(()=>b?k:s.filter(e=>C.has(e.id)),[b,k,s,C]),T=n.length,P=t.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),D=t.useCallback(e=>{if(i)return;const a=C.has(e)?n.filter(a=>a!==e):[...n,e];o(a)},[n,C,o,i]),E=t.useCallback(e=>{if(i)return;const a=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...a]);o(Array.from(e))}else o(n.filter(e=>!a.has(e)))},[n,k,o,i]),A=t.useCallback(()=>{y(e=>!e),w(""),_(void 0)},[]);return a.jsxs("div",{className:Kt("rounded-md border bg-muted/30",v),children:[(!i||T>0)&&a.jsxs("div",{className:Kt("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:A,children:[a.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(b?p:m)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:T>0&&`${T} ${1===T?f:g}`})]}),a.jsxs("div",{className:"px-4 pb-3",children:[b&&a.jsxs("div",{className:"flex gap-3 mb-3",children:[!c&&r.length>0&&a.jsxs(Bs,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[a.jsx(Ws,{className:"w-[200px] h-9 text-sm",children:a.jsx($s,{placeholder:e.t("approval_user_group")})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"__all__",children:e.t("team_all_groups")}),r.map(e=>a.jsx(Qs,{value:e.id,children:e.name},e.id))]})]}),a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Zt,{className:"pl-8 h-9 text-sm",placeholder:u,value:j,onChange:e=>w(e.target.value)})]})]}),!b&&0===T&&a.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a.jsx(d.Users,{className:"h-4 w-4 mr-2"}),x]}),b&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Js,{checked:P,onCheckedChange:e=>E(!!e)}),a.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&a.jsx(Fo,{style:{maxHeight:l},className:"pr-2",children:a.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return a.jsxs("div",{className:Kt("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",b&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:b?()=>D(e.id):void 0,children:[b&&a.jsx(Js,{checked:C.has(e.id),onCheckedChange:()=>D(e.id),onClick:e=>e.stopPropagation()}),a.jsxs(ml,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a.jsx(pl,{src:e.avatar,alt:e.name}),a.jsx(hl,{className:"text-xs",children:(t=e.name,t.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var t})})}),b&&0===k.length&&a.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:s,onChange:r,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:c,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=t.useState(s||{inputType:"url",controls:!0}),x=t.useRef(null),f=t.useRef(null),{upload:g,uploading:v}=ch({uploadFunction:i,deleteFunction:c,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:b,uploading:j}=ch({uploadFunction:i,deleteFunction:c,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),w=t.useMemo(()=>fh(p.videoUrl||xh(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,a)=>{const t={...p,[e]:a};h(t),r(t)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:m("input_type")}),a.jsxs(Bs,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[a.jsx(Ws,{children:a.jsx($s,{})}),a.jsxs(Ks,{children:[a.jsx(Qs,{value:"url",children:"URL"}),a.jsx(Qs,{value:"upload",children:m("file_upload")}),a.jsx(Qs,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Arquivo"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await g(a),t={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||a.name.replace(/\.[^/.]+$/,"")};h(t),r(t)}catch(t){}finally{x.current&&(x.current.value="")}},className:"hidden"}),a.jsx(Xt,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:v,children:v?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:m("embed_code")}),a.jsx(Zs,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Thumbnail"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Zt,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),a.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await b(a),t={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(t),r(t)}catch(t){}finally{f.current&&(f.current.value="")}},className:"hidden"}),a.jsx(Xt,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:j,children:j?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{htmlFor:"title",children:"Título"}),a.jsx(Zt,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),a.jsxs("div",{className:"flex gap-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Js,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),a.jsx(as,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Js,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),a.jsx(as,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(as,{children:"Preview"}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const t=p.videoUrl||xh(p.embedCode)||"";if(!t)return a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===w)return a.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[a.jsx("source",{src:t}),"Seu navegador não suporta este vídeo."]});const s="youtube"===w?mh(t,p.autoplay):hh(t,p.autoplay);return a.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a.jsx("iframe",{title:p.title||e.t("video"),src:s,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a.jsx(Xt,{variant:"outline",onClick:o,children:"Cancelar"}),a.jsx(Xt,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:t,className:s="",style:r}){const n=t.videoUrl||xh(t.embedCode)||"";if(!n)return null;const o=fh(n);return a.jsx(ts,{className:`overflow-hidden my-4 ${s}`,style:r,children:a.jsxs(os,{className:"p-0",children:["file"===o?a.jsxs("video",{controls:!1!==t.controls,autoPlay:t.autoplay,poster:t.thumbnail,className:"w-full h-auto",playsInline:!0,muted:t.autoplay,children:[a.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):a.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a.jsx("iframe",{title:t.title||e.t("video"),src:"youtube"===o?mh(n,t.autoplay):hh(n,t.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),t.title&&a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-sm font-medium",children:t.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:s,template:r,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:c=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:v=!1,readingConfirmationTimeRemaining:b,onIframeLoad:j,className:w}){const{t:N}=y.useTranslation(),_=t.useRef(null),C=n??ru(r.extension),k=c||v||h,S=r.code?`${r.code} – ${r.name}`:r.name,T=t.useCallback(()=>{_.current&&j&&j(_.current)},[j]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&s(!1)};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,s]),a.jsx(ys,{open:e,onOpenChange:s,children:a.jsxs(ks,{className:Kt("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&"w-[90vw]",w),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?a.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):a.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),a.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&a.jsxs(a.Fragment,{children:[(x||f)&&a.jsx(a.Fragment,{children:f?a.jsxs("div",{className:"flex flex-col mr-2.5",children:[a.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[a.jsx(d.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),a.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=b&&b>0?a.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[a.jsx("span",{children:N("terms_confirmation_available")}),a.jsx("span",{className:"font-medium min-w-[72px]",children:iu(b)}),a.jsx("span",{children:"segundos"})]}):a.jsxs(Xt,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[a.jsx(d.ShieldCheck,{className:"h-4 w-4 mr-1"}),v?"Confirmando...":N("terms_confirm_reading")]})}),C!==exports.FileViewerType.none&&u&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:a.jsx(d.Star,{className:Kt("h-4 w-4",m&&"fill-accent text-accent")})})}),a.jsx(_r,{children:m?"Desfavoritar":"Favoritar"})]}),C!==exports.FileViewerType.none&&i&&a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:a.jsx(d.Download,{className:"h-4 w-4"})})}),a.jsx(_r,{children:"Download"})]})]}),a.jsxs(wr,{children:[a.jsx(Nr,{asChild:!0,children:a.jsx(Xt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>s(!1),children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(_r,{children:"Fechar"})]})]})]}),a.jsx("div",{className:Kt("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",C===exports.FileViewerType.none&&"min-h-[124px]",C===exports.FileViewerType.image&&"max-h-[85vh]",(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&"min-w-[77vw] min-h-[80vh]"),children:o?a.jsx(sr,{className:"h-14 w-14"}):a.jsxs(a.Fragment,{children:[(C===exports.FileViewerType.none||!r.url)&&a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),a.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),C===exports.FileViewerType.image&&a.jsx("img",{loading:"eager",src:r.url,alt:r.name,className:"max-w-full max-h-[85vh] object-contain"}),C===exports.FileViewerType.video&&a.jsx("video",{controls:!0,autoPlay:!0,src:r.url,className:"w-full h-full"}),C===exports.FileViewerType.audio&&a.jsx("audio",{controls:!0,autoPlay:!0,src:r.url}),(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&a.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[a.jsx(sr,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a.jsx("iframe",{ref:_,src:r.url,onLoad:T,className:"border-none w-full h-full z-[1] relative",title:r.name})]})]})}),!o&&C===exports.FileViewerType.none&&a.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a.jsx(Xt,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),i&&a.jsx(Xt,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.addAppTranslations=pi,exports.addChild=$m,exports.addSibling=Wm,exports.assets=We,exports.badgeVariants=er,exports.buildDetailRows=Ax,exports.buildHierarchy=Wp,exports.buildModuleUrl=Gt,exports.buildPlacesTree=function(e){e.forEach(a=>{a.children=e.filter(e=>e.parentId===a.id)});const a=e.filter(e=>!e.parentId);return function e(a,t){a?.forEach(a=>{t(a),a.children&&e(a.children,t)})}(a,a=>{a.children=e.filter(e=>e.parentId===a.id)}),a},exports.buildWopiUrl=function(e){const{t:a}=y.useTranslation(),{viewerUrl:t,wopiUrl:s,fileId:r,token:n,extension:o,language:i="pt-br"}=e,l=ou(o);return l?`${t}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${s}${r}`)}`:null},exports.buttonGroupVariants=wl,exports.buttonVariants=Qt,exports.calculateAspectRatio=gh,exports.camelToDash=Lx,exports.cn=Kt,exports.createCrudPage=function(e){return({manager:t})=>{const{manager:s,config:r,onSave:n,onEdit:o,onToggleStatus:i}=e,l=t??s,d={entityName:r.entityName,entityNamePlural:r.entityNamePlural,filters:r.filters||[],columns:r.columns,cardFields:r.cardFields||[],enableBulkActions:r.enableBulkActions??!1,bulkActions:r.bulkActions||[],customActions:r.customActions,customRowActions:r.customRowActions,customListView:r.customListView,onEdit:o||r.onEdit,onNew:r.onNew,useCustomRouting:r.useCustomRouting,hideNewButton:r.hideNewButton,showNewButton:r.showNewButton,newButtonLabel:r.newButtonLabel,showSearch:r.showSearch,searchPlaceholder:r.searchPlaceholder,showActionBar:r.showActionBar};return a.jsx(Xo,{manager:l,config:d,formSections:r.formSections,onSave:n,onToggleStatus:i,defaultSort:r.defaultSort})}},exports.createCrudRoutingConfig=function(e,a){const t=bp({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}},exports.createMindMapNode=Um,exports.createRoutingHandlers=bp,exports.createService=Cn,exports.createSimpleSaveHandler=function(e,a,t){return s=>{if(s.id){const a=t(s);e.updateEntity(s.id,a)}else{const t=a(s);e.createEntity(t)}}},exports.createSimpleService=function(e){const a=Cn({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:a,useCrudHook:(t,s)=>Mn({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:s})}},exports.createStatusConfig=function(e){return a=>e[a]},exports.createTranslatedMessages=a=>({success:{created:a=>e.t("msg_created_success",`${a} criado com sucesso`).replace("{{entity}}",a),updated:a=>e.t("msg_updated_success",`${a} atualizado com sucesso`).replace("{{entity}}",a),deleted:a=>e.t("msg_deleted_success",`${a} removido com sucesso`).replace("{{entity}}",a)},error:{create:a=>e.t("msg_create_error",`Erro ao criar ${a}`).replace("{{entity}}",a),update:a=>e.t("msg_update_error",`Erro ao atualizar ${a}`).replace("{{entity}}",a),delete:a=>e.t("msg_delete_error",`Erro ao remover ${a}`).replace("{{entity}}",a),load:a=>e.t("msg_load_error",`Erro ao carregar ${a}`).replace("{{entity}}",a)}}),exports.currencyFormatter=Ju,exports.debounce=(e,a)=>{let t;return(...s)=>{clearTimeout(t),t=setTimeout(()=>e(...s),a)}},exports.deriveEmailField=vn,exports.deriveNameField=gn,exports.deriveUsernameField=bn,exports.detectBrowserLocale=Lt,exports.detectBrowserPreferences=()=>{const e=Lt();return{locale:e,timezone:zt(),datetimeFormat:Ut(e)}},exports.detectBrowserTimezone=zt,exports.detectVideoProvider=fh,exports.emailService=Vp,exports.errorService=sn,exports.exportMindMap=dp,exports.extractImageFileName=function(e){try{const a=new URL(e),t=a.pathname.split("/");return t[t.length-1]||"image"}catch{const a=e.split("/");return a[a.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)},exports.extractVimeoId=ph,exports.extractYouTubeId=uh,exports.filterAndPromoteOrphans=function(e,a){const t=e.map(e=>({...e})),s=new Set(t.filter(e=>!a.has(e.id_user)).map(e=>e.id_user));return t.forEach(e=>{if(e.id_leader&&s.has(e.id_leader)){let a=e.id_leader;for(;a&&s.has(a);){const e=t.find(e=>e.id_user===a);a=e?.id_leader||null}e.id_leader=a}}),t.filter(e=>a.has(e.id_user))},exports.findDatetimeFormat=e=>Dt.find(a=>a.value===e),exports.findLocale=e=>Pt.find(a=>a.value===e),exports.findNode=Om,exports.findTimezone=e=>Et.find(a=>a.value===e),exports.flattenTree=Hp,exports.formatBytes=cx,exports.formatCurrency=(e,a="BRL",t="pt-BR")=>null==e?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=Bt,exports.formatDatetime=Vt,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.formatTime=Yh,exports.formatTimeProgress=Kh,exports.generateCrudConfig=function(e,a,t={}){const s=[];return Object.keys(a).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const t=a[e],r={key:e,header:Zo(e),label:Zo(e),...Jo(e,t),sortable:!0,searchable:"string"==typeof t};s.push(r)}}),{title:e,columns:s,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...t}},exports.generateNodeId=zm,exports.generatePastelBg=$t,exports.getActionTypes=function(){return[{id:"immediate",label:e.t("ap_type_immediate")},{id:"corrective",label:e.t("ap_type_corrective")},{id:"preventive",label:e.t("ap_type_preventive")},{id:"improvement",label:e.t("ap_type_improvement")},{id:"standardization",label:e.t("ap_type_standardization")}]},exports.getContrastRatio=function(e,a){const t=Wt(e),s=Wt(a);return(Math.max(t,s)+.05)/(Math.min(t,s)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case exports.DashboardPanelType.Bar:case exports.DashboardPanelType.Column:case exports.DashboardPanelType.Pie:case exports.DashboardPanelType.List:case exports.DashboardPanelType.Line:case exports.DashboardPanelType.Area:case exports.DashboardPanelType.Text:case exports.DashboardPanelType.StackedColumn:return{x:4,y:2};case exports.DashboardPanelType.Pareto:case exports.DashboardPanelType.RiskMatrix:case exports.DashboardPanelType.Burndown:case exports.DashboardPanelType.PerformanceColumns:return{x:8,y:2};case exports.DashboardPanelType.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getEnvironmentConfig=Ae,exports.getFieldValue=xx,exports.getFileExtension=ux,exports.getFormFieldValues=function(e){return e.filter(e=>e.type!==exports.ECustomFormFieldType.readOnlyText).map(e=>({formFieldAssociationId:e.id,textValue:e.type===exports.ECustomFormFieldType.text?e.textValue:void 0,numberValue:e.type===exports.ECustomFormFieldType.number?e.numberValue:void 0,dateValue:e.type===exports.ECustomFormFieldType.date?e.dateValue:void 0,timeValue:e.type===exports.ECustomFormFieldType.time?e.timeValue:void 0,itemsValue:[exports.ECustomFormFieldType.url,exports.ECustomFormFieldType.singleSelection,exports.ECustomFormFieldType.multiSelection].includes(e.type)?e.itemsValue:void 0,questionsValue:e.type===exports.ECustomFormFieldType.questions?e.questionsValue:void 0}))},exports.getLinkFromRow=Yu,exports.getLuminance=Wt,exports.getMinPanelSize=wm,exports.getOnlineViewerType=function(e){const{t:a}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getPriorities=function(){return[{id:exports.ETaskPlanPriority.low,label:e.t("ap_priority_low"),color:"#4CAF50"},{id:exports.ETaskPlanPriority.medium,label:e.t("ap_priority_medium"),color:"#FF9800"},{id:exports.ETaskPlanPriority.high,label:e.t("ap_priority_high"),color:"#F44336"}]},exports.getProgressColor=Qh,exports.getQualiexApiUrl=Oe,exports.getStatusLabels=Rh,exports.getSupabaseClient=un,exports.getViewerType=ru,exports.getWopiViewer=ou,exports.handleExternalLink=Ht,exports.importMindMap=function(e){return cp(JSON.parse(e))},exports.inferDatetimeFormat=Ut,exports.inputGroupAddonVariants=ql,exports.inputGroupButtonVariants=Wl,exports.isCurrency=function(e){return!!Xu.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnvironment=Ue,exports.isDevSupabaseProject=Ie,exports.isImageUrl=function(e){const a=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const t=new URL(e);return a.some(e=>t.pathname.toLowerCase().endsWith(e))}catch{const t=e.toLowerCase();return a.some(e=>t.endsWith(e))}},exports.isLovablePreview=Le,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isValidDatetimeFormat=e=>Dt.some(a=>a.value===e),exports.isValidLocale=Ft,exports.isValidTimezone=Rt,exports.loadClicksignScript=_h,exports.loadForlogicFonts=rl,exports.logoSrc=He,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=Gm,exports.navigationMenuTriggerStyle=cd,exports.normalizeVideoUrl=function(e,a,t){switch(a||fh(e)){case"youtube":return mh(e,t);case"vimeo":return hh(e,t);default:return e}},exports.normalizeVimeoUrl=hh,exports.normalizeYouTubeUrl=mh,exports.parseIframeSrc=xh,exports.placeService=$p,exports.processTrails=Px,exports.processUrl=Ku,exports.qualiexApi=fn,exports.removeNode=Hm,exports.resizeKeepingAspect=function(e,a,t,s){const r=gh(e,a);return t&&!s?{width:t,height:Math.round(t/r)}:s&&!t?{width:Math.round(s*r),height:s}:{width:e,height:a}},exports.resolveFieldMappings=yn,exports.resolvePageTitle=Sp,exports.setCollapsedAll=Ym,exports.setFormFieldValues=function(e,a){return a?.length?e.map(e=>{const t=a.find(a=>a.formFieldAssociationId===e.id);if(!t)return e;const s={...e};switch(e.type){case exports.ECustomFormFieldType.text:s.textValue=t.textValue;break;case exports.ECustomFormFieldType.number:s.numberValue=t.numberValue;break;case exports.ECustomFormFieldType.date:s.dateValue=t.dateValue;break;case exports.ECustomFormFieldType.time:s.timeValue=t.timeValue;break;case exports.ECustomFormFieldType.url:case exports.ECustomFormFieldType.singleSelection:case exports.ECustomFormFieldType.multiSelection:s.itemsValue=t.itemsValue||[];break;case exports.ECustomFormFieldType.questions:s.questionsValue=t.questionsValue||[]}return s}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new w.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=fx,exports.shouldUseDevTokens=ze,exports.signService=wh,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=Ge,exports.sortByMonthYear=function(e){return e?.sort((e,a)=>{if(!e?.items?.length||!a?.items?.length)return 0;return Gu(e.items[0]?.keyDate)-Gu(a.items[0]?.keyDate)})},exports.toQueryString=function(e){return e?Qu(e).join("&"):null},exports.toggleCollapsed=Km,exports.toggleVariants=vo,exports.trackFooterClick=Bi,exports.trackInterestClick=Vi,exports.trackModuleClick=Oi,exports.trimTextFields=Yt,exports.useActionPlan=Bh,exports.useActionPlanProgress=Gh,exports.useActiveModules=(e={})=>{const{enabled:a=!0}=e,{alias:t}=In();return w.useQuery({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=un(),{data:a,error:s}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",t).eq("status","active").order("name");if(s){if(!hn.handleError(s))throw s;return[]}return a||[]},enabled:a&&!!t})},exports.useAliasFromUrl=ei,exports.useAuth=In,exports.useBaseForm=Eo,exports.useClarity=nl,exports.useColumnManager=ko,exports.useColumnResize=go,exports.useCreateMultipleLeadersMutation=Qp,exports.useCreateSingleLeaderMutation=Yp,exports.useCrud=Mn,exports.useDebounce=Tp,exports.useDerivedContractedModules=Ji,exports.useFormField=Ms,exports.useHasOpenModal=function(){const{hasOpenModal:e}=Lp();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:a}=vi(),t=It;return{formatDatetime:s=>Vt(s,t,a,e),formatDate:t=>Bt(t,e,a),locale:e,timezone:a,datetimeFormat:t}},exports.useIsMobile=Rn,exports.useLeadershipApi=Gp,exports.useLocale=vi,exports.useMediaQuery=Fn,exports.useMediaUpload=ch,exports.useModalState=Lp,exports.useModuleAccess=Xi,exports.useModuleConfig=ji,exports.useNavigation=kp,exports.usePageMetadata=function(e){const{setMetadata:a,clearMetadata:s}=li(),r=t.useRef({});t.useEffect(()=>{const t=JSON.stringify(r.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(r.current.title!==e.title||r.current.subtitle!==e.subtitle||t)&&(r.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},a(e)),()=>s()},[e.title,e.subtitle,e.breadcrumbs,a,s])},exports.usePageMetadataContext=li,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:a}=kp();return Sp(a,e.pathname)},exports.usePermissionQuery=Ep,exports.useQualiexUsers=Vo,exports.useRemoveLeaderMutation=Jp,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const a=e.pathname.split("/").filter(Boolean),t=[{label:"Exemplos",href:"/"}];let s="";return a.forEach((e,r)=>{s+=`/${e}`;const n=r===a.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.push({label:o,href:n?void 0:s,isCurrentPage:n})}),t})()},exports.useRowResize=function({rowIds:e,defaultHeight:a=48,minHeight:s=32,maxHeight:r=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,d]=t.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[c,u]=t.useState(!1),[m,p]=t.useState(null),h=t.useRef(0),x=t.useRef(0),f=t.useCallback(e=>l[e]??a,[l,a]),g=t.useCallback((e,t)=>{i&&(t.preventDefault(),t.stopPropagation(),u(!0),p(e),h.current=t.clientY,x.current=l[e]??a)},[i,l,a]);t.useEffect(()=>{if(!c||!m)return;const e=e=>{const a=e.clientY-h.current,t=Math.max(s,Math.min(r,x.current+a));d(e=>{const a={...e,[m]:t};return o?.(a),a})},a=()=>{u(!1),p(null),n&&d(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a)}},[c,m,s,r,n,o]),t.useEffect(()=>(c?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[c]);const v=t.useCallback(()=>{d({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:c,activeRow:m,handleMouseDown:g,resetHeights:v,getRowHeight:f}},exports.useSidebar=Vd,exports.useSidebarResize=Fp,exports.useSignConfig=vh,exports.useSyncSubordinatesMutation=Zp,exports.useUpdateLeaderMutation=Xp,exports.useUpdatesNotification=Zc,exports.useWizard=function(e){const{steps:a,initialStep:s=0,initialData:r={},onComplete:n,onCancel:o}=e,[i,l]=t.useState(s),[d,c]=t.useState(r),[u,m]=t.useState(!1),[p,h]=t.useState(!1),x=a.length,f=0===i,g=i===x-1,v=a[i],b=x>1?(i+1)/x*100:100,y=t.useCallback(()=>!v?.canProceed||v.canProceed(),[v]),j=t.useMemo(()=>y(),[y,d]),w=t.useMemo(()=>!f&&!v?.disableBack,[f,v]),N=t.useCallback(e=>{c(a=>({...a,...e}))},[]),_=t.useCallback((e,a)=>{c(t=>({...t,[e]:a}))},[]),C=t.useCallback(()=>{l(s),c(r),m(!1),h(!1),o?.()},[s,r,o]),k=t.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(d))}finally{h(!1)}}},[y,p,d,n]),S=t.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),T=t.useCallback(()=>{w&&!u&&l(e=>Math.max(e-1,0))},[w,u]),P=t.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),D=t.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:v,data:d,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:T,goTo:P,canProceed:j,canGoBack:w,setData:N,updateField:_,reset:C,complete:k,setLoading:D,progress:b,stepIndex:i,totalSteps:x}},exports.validateFields=function(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||e.type===exports.ECustomFormFieldType.readOnlyText)return;const t=xx(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),e.type===exports.ECustomFormFieldType.number&&null!=t){const s=e.config;null!=s?.min&&t<s.min&&a.push(e.id),null!=s?.max&&t>s.max&&a.push(e.id)}}),{valid:0===a.length,invalidFields:[...new Set(a)]}};
1
+ "use strict";var e=require("i18next"),a=require("react/jsx-runtime"),t=require("react"),r=require("@radix-ui/react-slot"),s=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),d=require("lucide-react"),c=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),b=require("@radix-ui/react-tooltip"),v=require("@radix-ui/react-popover"),y=require("react-i18next"),w=require("@supabase/supabase-js"),j=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),T=require("@radix-ui/react-switch"),D=require("@radix-ui/react-collapsible"),P=require("@radix-ui/react-tabs"),A=require("@radix-ui/react-accordion"),E=require("@radix-ui/react-avatar"),M=require("react-day-picker"),I=require("vaul"),F=require("@radix-ui/react-hover-card"),R=require("@radix-ui/react-navigation-menu"),L=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),O=require("react-resizable-panels"),U=require("@radix-ui/react-slider"),V=require("@radix-ui/react-menubar"),B=require("recharts"),q=require("@tiptap/react"),$=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable");function J(e){var a=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}}),a.default=e,Object.freeze(a)}var Z=J(t),ee=J(d),ae=J(c),te=J(u),re=J(m),se=J(p),ne=J(x),oe=J(f),ie=J(g),le=J(b),de=J(v),ce=J(_),ue=J(C),me=J(k),pe=J(S),he=J(T),xe=J(D),fe=J(P),ge=J(A),be=J(E),ve=J(F),ye=J(R),we=J(L),je=J(z),Ne=J(O),_e=J(U),Ce=J(V),ke=J(B);const Se={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api.qualiex.com"},Te={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com"};function De(){return"DEV"===(void 0).VITE_APP_ENV?"DEV":"PROD"}function Pe(){return"DEV"===De()?Te:Se}function Ae(){return"DEV"===De()}let Ee="supabase";function Me(e){Ee=e}function Ie(){return"supabase"===Ee}const Fe={get oauth(){const e=Pe();return{authUrl:e.oauth.authUrl,clientId:e.oauth.clientId,responseType:"id_token token",scope:"openid profile email"}}},Re={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Le={debounceDelay:500},ze=()=>{const e=window.location.origin,a=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&a||(void 0).DEV},Oe=()=>ze()&&Ie(),Ue=ze,Ve=()=>Pe().qualiexApiUrl,Be={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},qe={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},$e={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},We="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",He={logo:qe.isQualiex?`${We}/logo-qualiex-white.svg`:`${We}/saber-gestao-white.png`,smallLogo:qe.isQualiex?`${We}/logo-forlogic-white.svg`:`${We}/small.svg`,favicon:`${We}/favicon.png`},Ge=He.logo,Ke=He.smallLogo;if("undefined"!=typeof document){document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=He.favicon,document.head.appendChild(e)}const Ye={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Qe(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const Xe={date:Qe({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Qe({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Qe({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Je={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Ze(e){return(a,t)=>{let r;if("formatting"===(t?.context?String(t.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,s=t?.width?String(t.width):a;r=e.formattingValues[s]||e.formattingValues[a]}else{const a=e.defaultWidth,s=t?.width?String(t.width):e.defaultWidth;r=e.values[s]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(a):a]}}function ea(e){return(a,t={})=>{const r=t.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],n=a.match(s);if(!n)return null;const o=n[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t;return}(i,e=>e.test(o)):function(e,a){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&a(e[t]))return t;return}(i,e=>e.test(o));let d;d=e.valueCallback?e.valueCallback(l):l,d=t.valueCallback?t.valueCallback(d):d;return{value:d,rest:a.slice(o.length)}}}function aa(e){return(a,t={})=>{const r=a.match(e.matchPattern);if(!r)return null;const s=r[0],n=a.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=t.valueCallback?t.valueCallback(o):o;return{value:o,rest:a.slice(s.length)}}}const ta={code:"en-US",formatDistance:(e,a,t)=>{let r;const s=Ye[e];return r="string"==typeof s?s:1===a?s.one:s.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r},formatLong:Xe,formatRelative:(e,a,t,r)=>Je[e],localize:{ordinalNumber:(e,a)=>{const t=Number(e),r=t%100;if(r>20||r<10)switch(r%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Ze({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Ze({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ze({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Ze({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Ze({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:aa({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ea({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:ea({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ea({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:ea({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ea({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};let ra={};function sa(){return ra}const na=6048e5;function oa(e){const a=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===a?new e.constructor(+e):"number"==typeof e||"[object Number]"===a||"string"==typeof e||"[object String]"===a?new Date(e):new Date(NaN)}function ia(e){const a=oa(e);return a.setHours(0,0,0,0),a}function la(e){const a=oa(e),t=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return t.setUTCFullYear(a.getFullYear()),+e-+t}function da(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function ca(e){const a=oa(e),t=function(e,a){const t=ia(e),r=ia(a),s=+t-la(t),n=+r-la(r);return Math.round((s-n)/864e5)}(a,function(e){const a=oa(e),t=da(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function ua(e,a){const t=sa(),r=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=oa(e),n=s.getDay(),o=(n<r?7:0)+n-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function ma(e){return ua(e,{weekStartsOn:1})}function pa(e){const a=oa(e),t=a.getFullYear(),r=da(e,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const s=ma(r),n=da(e,0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);const o=ma(n);return a.getTime()>=s.getTime()?t+1:a.getTime()>=o.getTime()?t:t-1}function ha(e){const a=oa(e),t=+ma(a)-+function(e){const a=pa(e),t=da(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),ma(t)}(a);return Math.round(t/na)+1}function xa(e,a){const t=oa(e),r=t.getFullYear(),s=sa(),n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=da(e,0);o.setFullYear(r+1,0,n),o.setHours(0,0,0,0);const i=ua(o,a),l=da(e,0);l.setFullYear(r,0,n),l.setHours(0,0,0,0);const d=ua(l,a);return t.getTime()>=i.getTime()?r+1:t.getTime()>=d.getTime()?r:r-1}function fa(e,a){const t=oa(e),r=+ua(t,a)-+function(e,a){const t=sa(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=xa(e,a),n=da(e,0);return n.setFullYear(s,0,r),n.setHours(0,0,0,0),ua(n,a)}(t,a);return Math.round(r/na)+1}function ga(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const ba={y(e,a){const t=e.getFullYear(),r=t>0?t:1-t;return ga("yy"===a?r%100:r,a.length)},M(e,a){const t=e.getMonth();return"M"===a?String(t+1):ga(t+1,2)},d:(e,a)=>ga(e.getDate(),a.length),a(e,a){const t=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return"am"===t?"a.m.":"p.m."}},h:(e,a)=>ga(e.getHours()%12||12,a.length),H:(e,a)=>ga(e.getHours(),a.length),m:(e,a)=>ga(e.getMinutes(),a.length),s:(e,a)=>ga(e.getSeconds(),a.length),S(e,a){const t=a.length,r=e.getMilliseconds();return ga(Math.trunc(r*Math.pow(10,t-3)),a.length)}},va="midnight",ya="noon",wa="morning",ja="afternoon",Na="evening",_a="night",Ca={G:function(e,a,t){const r=e.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return t.era(r,{width:"abbreviated"});case"GGGGG":return t.era(r,{width:"narrow"});default:return t.era(r,{width:"wide"})}},y:function(e,a,t){if("yo"===a){const a=e.getFullYear(),r=a>0?a:1-a;return t.ordinalNumber(r,{unit:"year"})}return ba.y(e,a)},Y:function(e,a,t,r){const s=xa(e,r),n=s>0?s:1-s;if("YY"===a){return ga(n%100,2)}return"Yo"===a?t.ordinalNumber(n,{unit:"year"}):ga(n,a.length)},R:function(e,a){return ga(pa(e),a.length)},u:function(e,a){return ga(e.getFullYear(),a.length)},Q:function(e,a,t){const r=Math.ceil((e.getMonth()+1)/3);switch(a){case"Q":return String(r);case"QQ":return ga(r,2);case"Qo":return t.ordinalNumber(r,{unit:"quarter"});case"QQQ":return t.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(r,{width:"narrow",context:"formatting"});default:return t.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,a,t){const r=Math.ceil((e.getMonth()+1)/3);switch(a){case"q":return String(r);case"qq":return ga(r,2);case"qo":return t.ordinalNumber(r,{unit:"quarter"});case"qqq":return t.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(r,{width:"narrow",context:"standalone"});default:return t.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,a,t){const r=e.getMonth();switch(a){case"M":case"MM":return ba.M(e,a);case"Mo":return t.ordinalNumber(r+1,{unit:"month"});case"MMM":return t.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(r,{width:"narrow",context:"formatting"});default:return t.month(r,{width:"wide",context:"formatting"})}},L:function(e,a,t){const r=e.getMonth();switch(a){case"L":return String(r+1);case"LL":return ga(r+1,2);case"Lo":return t.ordinalNumber(r+1,{unit:"month"});case"LLL":return t.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(r,{width:"narrow",context:"standalone"});default:return t.month(r,{width:"wide",context:"standalone"})}},w:function(e,a,t,r){const s=fa(e,r);return"wo"===a?t.ordinalNumber(s,{unit:"week"}):ga(s,a.length)},I:function(e,a,t){const r=ha(e);return"Io"===a?t.ordinalNumber(r,{unit:"week"}):ga(r,a.length)},d:function(e,a,t){return"do"===a?t.ordinalNumber(e.getDate(),{unit:"date"}):ba.d(e,a)},D:function(e,a,t){const r=ca(e);return"Do"===a?t.ordinalNumber(r,{unit:"dayOfYear"}):ga(r,a.length)},E:function(e,a,t){const r=e.getDay();switch(a){case"E":case"EE":case"EEE":return t.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},e:function(e,a,t,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(a){case"e":return String(n);case"ee":return ga(n,2);case"eo":return t.ordinalNumber(n,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(e,a,t,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(a){case"c":return String(n);case"cc":return ga(n,a.length);case"co":return t.ordinalNumber(n,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(e,a,t){const r=e.getDay(),s=0===r?7:r;switch(a){case"i":return String(s);case"ii":return ga(s,a.length);case"io":return t.ordinalNumber(s,{unit:"day"});case"iii":return t.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},a:function(e,a,t){const r=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,a,t){const r=e.getHours();let s;switch(s=12===r?ya:0===r?va:r/12>=1?"pm":"am",a){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,a,t){const r=e.getHours();let s;switch(s=r>=17?Na:r>=12?ja:r>=4?wa:_a,a){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,a,t){if("ho"===a){let a=e.getHours()%12;return 0===a&&(a=12),t.ordinalNumber(a,{unit:"hour"})}return ba.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):ba.H(e,a)},K:function(e,a,t){const r=e.getHours()%12;return"Ko"===a?t.ordinalNumber(r,{unit:"hour"}):ga(r,a.length)},k:function(e,a,t){let r=e.getHours();return 0===r&&(r=24),"ko"===a?t.ordinalNumber(r,{unit:"hour"}):ga(r,a.length)},m:function(e,a,t){return"mo"===a?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):ba.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):ba.s(e,a)},S:function(e,a){return ba.S(e,a)},X:function(e,a,t){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(a){case"X":return Sa(r);case"XXXX":case"XX":return Ta(r);default:return Ta(r,":")}},x:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"x":return Sa(r);case"xxxx":case"xx":return Ta(r);default:return Ta(r,":")}},O:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+ka(r,":");default:return"GMT"+Ta(r,":")}},z:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+ka(r,":");default:return"GMT"+Ta(r,":")}},t:function(e,a,t){return ga(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,t){return ga(e.getTime(),a.length)}};function ka(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),n=r%60;return 0===n?t+String(s):t+String(s)+a+ga(n,2)}function Sa(e,a){if(e%60==0){return(e>0?"-":"+")+ga(Math.abs(e)/60,2)}return Ta(e,a)}function Ta(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+ga(Math.trunc(r/60),2)+a+ga(r%60,2)}const Da=(e,a)=>{switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},Pa=(e,a)=>{switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},Aa={p:Pa,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],r=t[1],s=t[2];if(!s)return Da(e,a);let n;switch(r){case"P":n=a.dateTime({width:"short"});break;case"PP":n=a.dateTime({width:"medium"});break;case"PPP":n=a.dateTime({width:"long"});break;default:n=a.dateTime({width:"full"})}return n.replace("{{date}}",Da(r,a)).replace("{{time}}",Pa(s,a))}},Ea=/^D+$/,Ma=/^Y+$/,Ia=["D","DD","YY","YYYY"];function Fa(e){if(!(a=e,a instanceof Date||"object"==typeof a&&"[object Date]"===Object.prototype.toString.call(a)||"number"==typeof e))return!1;var a;const t=oa(e);return!isNaN(Number(t))}const Ra=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,La=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,za=/^'([^]*?)'?$/,Oa=/''/g,Ua=/[a-zA-Z]/;function Va(e,a,t){const r=sa(),s=t?.locale??r.locale??ta,n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=oa(e);if(!Fa(i))throw new RangeError("Invalid time value");let l=a.match(La).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,Aa[a])(e,s.formatLong)}return e}).join("").match(Ra).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:Ba(e)};if(Ca[a])return{isToken:!0,value:e};if(a.match(Ua))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}});s.localize.preprocessor&&(l=s.localize.preprocessor(i,l));const d={firstWeekContainsDate:n,weekStartsOn:o,locale:s};return l.map(r=>{if(!r.isToken)return r.value;const n=r.value;(!t?.useAdditionalWeekYearTokens&&function(e){return Ma.test(e)}(n)||!t?.useAdditionalDayOfYearTokens&&function(e){return Ea.test(e)}(n))&&function(e,a,t){const r=function(e,a,t){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${a}\`) for formatting ${r} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,a,t);if(Ia.includes(e))throw new RangeError(r)}(n,a,String(e));return(0,Ca[n[0]])(i,n,s.localize,d)}).join("")}function Ba(e){const a=e.match(za);return a?a[1].replace(Oa,"'"):e}function qa(e,a,t){const r=i.getDefaultOptions(),s=function(e,a,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:a,timeZoneName:e})}(e,t.timeZone,t.locale??r.locale);return"formatToParts"in s?function(e,a){const t=e.formatToParts(a);for(let r=t.length-1;r>=0;--r)if("timeZoneName"===t[r].type)return t[r].value;return}(s,a):function(e,a){const t=e.format(a).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(t);return r?r[0].substr(1):""}(s,a)}function $a(e,a){const t=function(e){Ha[e]||(Ha[e]=Ka?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return Ha[e]}(a);return"formatToParts"in t?function(e,a){try{const t=e.formatToParts(a),r=[];for(let e=0;e<t.length;e++){const a=Wa[t[e].type];void 0!==a&&(r[a]=parseInt(t[e].value,10))}return r}catch(t){if(t instanceof RangeError)return[NaN];throw t}}(t,e):function(e,a){const t=e.format(a),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}(t,e)}const Wa={year:0,month:1,day:2,hour:3,minute:4,second:5};const Ha={},Ga=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),Ka="06/25/2014, 00:00:00"===Ga||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===Ga;function Ya(e,a,t,r,s,n,o){const i=new Date(0);return i.setUTCFullYear(e,a,t),i.setUTCHours(r,s,n,o),i}const Qa=36e5,Xa={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ja(e,a,t){if(!e)return 0;let r,s,n=Xa.timezoneZ.exec(e);if(n)return 0;if(n=Xa.timezoneHH.exec(e),n)return r=parseInt(n[1],10),et(r)?-r*Qa:NaN;if(n=Xa.timezoneHHMM.exec(e),n){r=parseInt(n[2],10);const e=parseInt(n[3],10);return et(r,e)?(s=Math.abs(r)*Qa+6e4*e,"+"===n[1]?-s:s):NaN}if(function(e){if(at[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),at[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const r=t?a:function(e){return Ya(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),s=Za(r,e),n=t?s:function(e,a,t){const r=e.getTime();let s=r-a;const n=Za(new Date(s),t);if(a===n)return a;s-=n-a;const o=Za(new Date(s),t);if(n===o)return n;return Math.max(n,o)}(a,s,e);return-n}return NaN}function Za(e,a){const t=$a(e,a),r=Ya(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let s=e.getTime();const n=s%1e3;return s-=n>=0?n:1e3+n,r-s}function et(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const at={};const tt={X:function(e,a,t){const r=rt(t.timeZone,e);if(0===r)return"Z";switch(a){case"X":return ot(r);case"XXXX":case"XX":return nt(r);default:return nt(r,":")}},x:function(e,a,t){const r=rt(t.timeZone,e);switch(a){case"x":return ot(r);case"xxxx":case"xx":return nt(r);default:return nt(r,":")}},O:function(e,a,t){const r=rt(t.timeZone,e);switch(a){case"O":case"OO":case"OOO":return"GMT"+function(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),n=r%60;if(0===n)return t+String(s);return t+String(s)+a+st(n,2)}(r,":");default:return"GMT"+nt(r,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return qa("short",e,t);default:return qa("long",e,t)}}};function rt(e,a){const t=e?Ja(e,a,!0)/6e4:a?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function st(e,a){const t=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<a;)r="0"+r;return t+r}function nt(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+st(Math.floor(r/60),2)+a+st(Math.floor(r%60),2)}function ot(e,a){if(e%60==0){return(e>0?"-":"+")+st(Math.abs(e)/60,2)}return nt(e,a)}function it(e){const a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),+e-+a}const lt=36e5,dt=6e4,ct={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function ut(e,a={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const t=null==a.additionalDigits?2:Number(a.additionalDigits);if(2!==t&&1!==t&&0!==t)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const r=function(e){const a={};let t,r=ct.dateTimePattern.exec(e);r?(a.date=r[1],t=r[3]):(r=ct.datePattern.exec(e),r?(a.date=r[1],t=r[2]):(a.date=null,t=e));if(t){const e=ct.timeZone.exec(t);e?(a.time=t.replace(e[1],""),a.timeZone=e[1].trim()):a.time=t}return a}(e),{year:s,restDateString:n}=function(e,a){if(e){const t=ct.YYY[a],r=ct.YYYYY[a];let s=ct.YYYY.exec(e)||r.exec(e);if(s){const a=s[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(s=ct.YY.exec(e)||t.exec(e),s){const a=s[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}}return{year:null}}(r.date,t),o=function(e,a){if(null===a)return null;let t,r,s;if(!e||!e.length)return t=new Date(0),t.setUTCFullYear(a),t;let n=ct.MM.exec(e);if(n)return t=new Date(0),r=parseInt(n[1],10)-1,ft(a,r)?(t.setUTCFullYear(a,r),t):new Date(NaN);if(n=ct.DDD.exec(e),n){t=new Date(0);const e=parseInt(n[1],10);return function(e,a){if(a<1)return!1;const t=xt(e);if(t&&a>366)return!1;if(!t&&a>365)return!1;return!0}(a,e)?(t.setUTCFullYear(a,0,e),t):new Date(NaN)}if(n=ct.MMDD.exec(e),n){t=new Date(0),r=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return ft(a,r,e)?(t.setUTCFullYear(a,r,e),t):new Date(NaN)}if(n=ct.Www.exec(e),n)return s=parseInt(n[1],10)-1,gt(s)?mt(a,s):new Date(NaN);if(n=ct.WwwD.exec(e),n){s=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return gt(s,e)?mt(a,s,e):new Date(NaN)}return null}(n,s);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let t,s=0;if(r.time&&(s=function(e){let a,t,r=ct.HH.exec(e);if(r)return a=parseFloat(r[1].replace(",",".")),bt(a)?a%24*lt:NaN;if(r=ct.HHMM.exec(e),r)return a=parseInt(r[1],10),t=parseFloat(r[2].replace(",",".")),bt(a,t)?a%24*lt+t*dt:NaN;if(r=ct.HHMMSS.exec(e),r){a=parseInt(r[1],10),t=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return bt(a,t,e)?a%24*lt+t*dt+1e3*e:NaN}return null}(r.time),null===s||isNaN(s)))return new Date(NaN);if(r.timeZone||a.timeZone){if(t=Ja(r.timeZone||a.timeZone,new Date(e+s)),isNaN(t))return new Date(NaN)}else t=it(new Date(e+s)),t=it(new Date(e+s+t));return new Date(e+s+t)}return new Date(NaN)}function mt(e,a,t){a=a||0,t=t||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const s=7*a+t+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}const pt=[31,28,31,30,31,30,31,31,30,31,30,31],ht=[31,29,31,30,31,30,31,31,30,31,30,31];function xt(e){return e%400==0||e%4==0&&e%100!=0}function ft(e,a,t){if(a<0||a>11)return!1;if(null!=t){if(t<1)return!1;const r=xt(e);if(r&&t>ht[a])return!1;if(!r&&t>pt[a])return!1}return!0}function gt(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function bt(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const vt=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yt(e,a,t,r){return function(e,a,t={}){const r=(a=String(a)).match(vt);if(r){const s=ut(t.originalDate||e,t);a=r.reduce(function(e,a){if("'"===a[0])return e;const r=e.indexOf(a),n="'"===e[r-1],o=e.replace(a,"'"+tt[a[0]](s,a,t)+"'");return n?o.substring(0,r-1)+o.substring(r+1):o},a)}return Va(e,a,t)}(function(e,a,t){const r=Ja(a,e=ut(e,t),!0),s=new Date(e.getTime()-r),n=new Date(0);return n.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),n.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),n}(e,a,{timeZone:(r={...r,timeZone:a,originalDate:e}).timeZone}),t,r)}const wt={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},jt={date:Qe({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:Qe({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Qe({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Nt={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},_t={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Ct={code:"es",formatDistance:(e,a,t)=>{let r;const s=wt[e];return r="string"==typeof s?s:1===a?s.one:s.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"en "+r:"hace "+r:r},formatLong:jt,formatRelative:(e,a,t,r)=>1!==a.getHours()?_t[e]:Nt[e],localize:{ordinalNumber:(e,a)=>Number(e)+"º",era:Ze({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:Ze({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:Ze({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:Ze({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:Ze({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:aa({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ea({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:ea({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ea({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:ea({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ea({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:1}},kt={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},St={date:Qe({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:Qe({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Qe({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Tt={lastWeek:e=>{const a=e.getDay();return"'"+(0===a||6===a?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Dt={code:"pt-BR",formatDistance:(e,a,t)=>{let r;const s=kt[e];return r="string"==typeof s?s:1===a?s.one:s.other.replace("{{count}}",String(a)),t?.addSuffix?t.comparison&&t.comparison>0?"em "+r:"há "+r:r},formatLong:St,formatRelative:(e,a,t,r)=>{const s=Tt[e];return"function"==typeof s?s(a):s},localize:{ordinalNumber:(e,a)=>{const t=Number(e);return"week"===a?.unit?t+"ª":t+"º"},era:Ze({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:Ze({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ze({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:Ze({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:Ze({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:aa({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:ea({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:ea({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ea({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:ea({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:ea({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Pt=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],At=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],Et=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],Mt="pt-BR",It="dd/MM/yyyy HH:mm",Ft="America/Sao_Paulo",Rt=e=>Pt.some(a=>a.value===e),Lt=e=>Et.some(a=>a.value===e),zt=()=>{if("undefined"==typeof navigator)return Mt;const e=navigator.language;if(Rt(e))return e;const a=e.split("-")[0],t=Pt.find(e=>e.value.startsWith(a));return t?.value||Mt},Ot=()=>{if("undefined"==typeof Intl)return Ft;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return Lt(e)?e:Ft}catch{return Ft}},Ut=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||It),Vt={"pt-BR":Dt,"en-US":ta,"es-ES":Ct},Bt=(e,a=It,t=Ft,r=Mt)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const n=Vt[r]||Dt;try{return yt(s,t,a,{locale:n})}catch(o){return yt(s,Ft,a,{locale:n})}},qt=(e,a=Mt,t=Ft)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const s=Vt[a]||Dt;try{return yt(r,t,"PP",{locale:s})}catch(n){return yt(r,Ft,"PP",{locale:s})}};function $t(e){const a=e.replace("#",""),t=3===a.length?a.split("").map(e=>e+e).join(""):a;return{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16)}}function Wt(e,a=.1){const{r:t,g:r,b:s}=$t(e);return`rgba(${t}, ${r}, ${s}, ${a})`}function Ht(e){const{r:a,g:t,b:r}=$t(e),[s,n,o]=[a,t,r].map(e=>{const a=e/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return.2126*s+.7152*n+.0722*o}function Gt(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function Kt(e,a){return a?e.replace(/\{alias\}/g,a):e}function Yt(...e){return o.twMerge(n.clsx(e))}const Qt=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Qt);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,r]of Object.entries(e))a[t]=Qt(r);return a}return e},Xt=s.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),Jt=Z.forwardRef(({className:e,variant:t,size:s,asChild:n=!1,...o},i)=>{const l=n?r.Slot:"button";return a.jsx(l,{className:Yt(Xt({variant:t,size:s,className:e})),ref:i,...o})});Jt.displayName="Button";const Zt=t.forwardRef(({className:e,children:t,variant:r="action",...s},n)=>a.jsx(Jt,{ref:n,variant:r,size:"icon",className:Yt("h-8 w-8",e),...s,children:t||a.jsx(d.EllipsisVertical,{size:16})}));Zt.displayName="ActionButton";const er=Z.forwardRef(({className:e,type:t,showCharCount:r,maxLength:s,onChange:n,...o},i)=>{const[l,d]=Z.useState(0);Z.useEffect(()=>{"string"==typeof o.value?d(o.value.length):"string"==typeof o.defaultValue&&d(o.defaultValue.length)},[o.value,o.defaultValue]);return a.jsxs("div",{className:"w-full",children:[a.jsx("input",{type:t,className:Yt("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:s,onChange:e=>{d(e.target.value.length),n?.(e)},...o}),r&&s&&a.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",s]})]})});er.displayName="Input";const ar=s.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),tr=Z.forwardRef(({className:e,...t},r)=>a.jsx(ae.Root,{ref:r,className:Yt(ar(),e),...t}));tr.displayName=ae.Root.displayName;const rr=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));rr.displayName="Card";const sr=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("flex flex-col space-y-1.5 p-6",e),...t}));sr.displayName="CardHeader";const nr=Z.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:Yt("text-2xl font-semibold leading-none tracking-tight",e),...t}));nr.displayName="CardTitle";const or=Z.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));or.displayName="CardDescription";const ir=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("p-6 pt-0",e),...t}));ir.displayName="CardContent";const lr=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("flex items-center p-6 pt-0",e),...t}));lr.displayName="CardFooter";const dr=Z.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},n)=>a.jsx(re.Root,{ref:n,decorative:r,orientation:t,className:Yt("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...s}));dr.displayName=re.Root.displayName;const cr=se.Root,ur=se.Trigger,mr=se.Portal,pr=Z.forwardRef(({className:e,...t},r)=>a.jsx(se.Overlay,{className:Yt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));pr.displayName=se.Overlay.displayName;const hr=Z.forwardRef(({className:e,...t},r)=>a.jsxs(mr,{children:[a.jsx(pr,{}),a.jsx(se.Content,{ref:r,className:Yt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));hr.displayName=se.Content.displayName;const xr=({className:e,...t})=>a.jsx("div",{className:Yt("flex flex-col space-y-2 text-center sm:text-left",e),...t});xr.displayName="AlertDialogHeader";const fr=({className:e,...t})=>a.jsx("div",{className:Yt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});fr.displayName="AlertDialogFooter";const gr=Z.forwardRef(({className:e,...t},r)=>a.jsx(se.Title,{ref:r,className:Yt("text-lg font-semibold",e),...t}));gr.displayName=se.Title.displayName;const br=Z.forwardRef(({className:e,...t},r)=>a.jsx(se.Description,{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));br.displayName=se.Description.displayName;const vr=Z.forwardRef(({className:e,...t},r)=>a.jsx(se.Action,{ref:r,className:Yt(Xt(),e),...t}));vr.displayName=se.Action.displayName;const yr=Z.forwardRef(({className:e,...t},r)=>a.jsx(se.Cancel,{ref:r,className:Yt(Xt({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));yr.displayName=se.Cancel.displayName;const wr=te.Root,jr=te.Trigger,Nr=te.Portal,_r=te.Close,Cr=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Overlay,{ref:r,className:Yt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Cr.displayName=te.Overlay.displayName;const kr={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},Sr=Z.forwardRef(({className:t,children:r,size:s,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:c,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:b,onInteractOutside:v,onEscapeKeyDown:y,...w},j)=>{const[N,_]=Z.useState(!1),C=Z.useRef(null),k=Z.useRef(!1),S=s??(i||l||c||u||m||p?void 0:"md"),T=S?kr[S]:{},D={...i??T.width?{width:i??T.width}:{},...l??T.minWidth?{minWidth:l??T.minWidth}:{},...c??T.maxWidth?{maxWidth:c??T.maxWidth}:{},...u??T.height?{height:u??T.height}:{},...m??T.minHeight?{minHeight:m??T.minHeight}:{},...p??T.maxHeight?{maxHeight:p??T.maxHeight}:{},...b},P=Z.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),A=Z.useRef(null),E="destructive"!==n;if("development"===process.env.NODE_ENV&&r){const e=Z.Children.toArray(r);e.some(e=>Z.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>Z.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return a.jsxs(Nr,{children:[a.jsx(Cr,{}),a.jsxs(te.Content,{ref:j,className:Yt("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",t),style:D,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?v?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void P(()=>{k.current=!0,A.current?.click()})):void y?.(e);e.preventDefault()},...w,children:[r,E&&a.jsxs(te.Close,{ref:A,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),P(()=>{k.current=!0,A.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]}),a.jsx(cr,{open:N,onOpenChange:_,children:a.jsxs(hr,{children:[a.jsxs(xr,{children:[a.jsx(gr,{children:h}),a.jsx(br,{children:x})]}),a.jsxs(fr,{children:[a.jsx(yr,{onClick:()=>{_(!1),C.current=null},children:f}),a.jsx(vr,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});Sr.displayName=te.Content.displayName;const Tr=({className:e,showSeparator:t=!1,children:r,...s})=>a.jsxs("div",{className:Yt("flex flex-col flex-shrink-0",e),...s,children:[a.jsx("div",{className:"flex flex-col text-left",children:r}),t&&a.jsx(dr,{className:"mt-2"})]});Tr.displayName="DialogHeader";const Dr=({className:e,...t})=>a.jsx("div",{className:Yt("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});Dr.displayName="DialogBody";const Pr=({className:e,children:t,...r})=>a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(dr,{className:"mb-4"}),a.jsx("div",{className:Yt("flex flex-row justify-end gap-2",e),...r,children:t})]});Pr.displayName="DialogFooter";const Ar=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Title,{ref:r,className:Yt("text-xl font-semibold leading-none tracking-tight",e),...t}));Ar.displayName=te.Title.displayName;const Er=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Description,{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));Er.displayName=te.Description.displayName;const Mr=h.FormProvider,Ir=Z.createContext({}),Fr=()=>{const e=Z.useContext(Ir),a=Z.useContext(Rr),{getFieldState:t,formState:r}=h.useFormContext(),s=t(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=a;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...s}},Rr=Z.createContext({}),Lr=Z.forwardRef(({className:e,...t},r)=>{const s=Z.useId();return a.jsx(Rr.Provider,{value:{id:s},children:a.jsx("div",{ref:r,className:Yt("space-y-1.5",e),...t})})});Lr.displayName="FormItem";const zr=Z.forwardRef(({className:e,...t},r)=>{const{error:s,formItemId:n}=Fr();return a.jsx(tr,{ref:r,className:Yt(s&&"text-destructive",e),htmlFor:n,...t})});zr.displayName="FormLabel";const Or=Z.forwardRef(({...e},t)=>{const{error:s,formItemId:n,formDescriptionId:o,formMessageId:i}=Fr();return a.jsx(r.Slot,{ref:t,id:n,"aria-describedby":s?`${o} ${i}`:`${o}`,"aria-invalid":!!s,...e})});Or.displayName="FormControl";const Ur=Z.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:s}=Fr();return a.jsx("p",{ref:r,id:s,className:Yt("text-sm text-muted-foreground",e),...t})});Ur.displayName="FormDescription";const Vr=Z.forwardRef(({className:e,children:t,...r},s)=>{const{error:n,formMessageId:o}=Fr(),i=n?String(n?.message):t;return i?a.jsx("p",{ref:s,id:o,className:Yt("text-sm font-medium text-destructive",e),...r,children:i}):null});Vr.displayName="FormMessage";const Br=Z.createContext({showCheck:!1}),qr=({showCheck:e=!1,...t})=>a.jsx(Br.Provider,{value:{showCheck:e},children:a.jsx(ne.Root,{...t})}),$r=ne.Group,Wr=ne.Value,Hr=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(ne.Trigger,{ref:s,className:Yt("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...r,children:[t,a.jsx(ne.Icon,{asChild:!0,children:a.jsx(d.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Hr.displayName=ne.Trigger.displayName;const Gr=Z.forwardRef(({className:e,...t},r)=>a.jsx(ne.ScrollUpButton,{ref:r,className:Yt("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(d.ChevronUp,{className:"h-4 w-4"})}));Gr.displayName=ne.ScrollUpButton.displayName;const Kr=Z.forwardRef(({className:e,...t},r)=>a.jsx(ne.ScrollDownButton,{ref:r,className:Yt("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(d.ChevronDown,{className:"h-4 w-4"})}));Kr.displayName=ne.ScrollDownButton.displayName;const Yr=Z.forwardRef(({className:e,children:t,position:r="popper",container:s,collisionBoundary:n,...o},i)=>a.jsx(ne.Portal,{container:s,children:a.jsxs(ne.Content,{ref:i,className:Yt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,collisionBoundary:n,...o,children:[a.jsx(Gr,{}),a.jsx(ne.Viewport,{className:Yt("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(Kr,{})]})}));Yr.displayName=ne.Content.displayName;const Qr=Z.forwardRef(({className:e,...t},r)=>a.jsx(ne.Label,{ref:r,className:Yt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Qr.displayName=ne.Label.displayName;const Xr=Z.forwardRef(({className:e,children:t,...r},s)=>{const{showCheck:n}=Z.useContext(Br);return a.jsxs(ne.Item,{ref:s,className:Yt("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...r,children:[n&&a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ne.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),a.jsx(ne.ItemText,{children:t})]})});Xr.displayName=ne.Item.displayName;const Jr=Z.forwardRef(({className:e,...t},r)=>a.jsx(ne.Separator,{ref:r,className:Yt("-mx-1 my-1 h-px bg-muted",e),...t}));Jr.displayName=ne.Separator.displayName;const Zr=Z.forwardRef(({className:e,...t},r)=>a.jsx(oe.Root,{ref:r,className:Yt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(oe.Indicator,{className:Yt("flex items-center justify-center text-current"),children:a.jsx(d.Check,{className:"h-4 w-4"})})}));Zr.displayName=oe.Root.displayName;const es=Z.forwardRef(({className:e,showCharCount:t,maxLength:r,onChange:s,...n},o)=>{const[i,l]=Z.useState(0);Z.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return a.jsxs("div",{className:"w-full",children:[a.jsx("textarea",{className:Yt("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:r,onChange:e=>{l(e.target.value.length),s?.(e)},...n}),t&&r&&a.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",r]})]})});es.displayName="Textarea";const as=s.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),ts=Z.forwardRef(({className:e,variant:t,...r},s)=>a.jsx("div",{ref:s,className:Yt(as({variant:t}),e),...r}));ts.displayName="Badge";const rs={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function ss({size:e="md",className:t}){return a.jsx(d.Loader2,{className:Yt("animate-spin text-muted-foreground",rs[e],t)})}function ns({isLoading:e,children:t,className:r,type:s="spinner",size:n="md"}){return e?"overlay"===s?a.jsxs("div",{className:Yt("relative",r),children:[t,a.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:a.jsx(ss,{size:n})})]}):"skeleton"===s?a.jsx("div",{className:Yt("animate-pulse",r),children:a.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):a.jsx("div",{className:Yt("flex items-center justify-center py-8",r),children:a.jsx(ss,{size:n})}):a.jsx(a.Fragment,{children:t})}const os=({...e})=>a.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a.jsx(d.CircleCheckIcon,{className:"h-4 w-4"}),info:a.jsx(d.InfoIcon,{className:"h-4 w-4"}),warning:a.jsx(d.TriangleAlertIcon,{className:"h-4 w-4"}),error:a.jsx(d.OctagonXIcon,{className:"h-4 w-4"}),loading:a.jsx(d.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),is=ie.Root,ls=ie.Trigger,ds=ie.Group,cs=ie.Portal,us=ie.Sub,ms=ie.RadioGroup,ps=Z.forwardRef(({className:e,inset:t,children:r,...s},n)=>a.jsxs(ie.SubTrigger,{ref:n,className:Yt("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...s,children:[r,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ps.displayName=ie.SubTrigger.displayName;const hs=Z.forwardRef(({className:e,...t},r)=>a.jsx(ie.SubContent,{ref:r,className:Yt("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));hs.displayName=ie.SubContent.displayName;const xs=Z.forwardRef(({className:e,sideOffset:t=4,...r},s)=>a.jsx(ie.Portal,{children:a.jsx(ie.Content,{ref:s,sideOffset:t,className:Yt("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));xs.displayName=ie.Content.displayName;const fs=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(ie.Item,{ref:s,className:Yt("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));fs.displayName=ie.Item.displayName;const gs=Z.forwardRef(({className:e,children:t,checked:r,...s},n)=>a.jsxs(ie.CheckboxItem,{ref:n,className:Yt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ie.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));gs.displayName=ie.CheckboxItem.displayName;const bs=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(ie.RadioItem,{ref:s,className:Yt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ie.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));bs.displayName=ie.RadioItem.displayName;const vs=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(ie.Label,{ref:s,className:Yt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));vs.displayName=ie.Label.displayName;const ys=Z.forwardRef(({className:e,...t},r)=>a.jsx(ie.Separator,{ref:r,className:Yt("-mx-1 my-1 h-px bg-muted",e),...t}));ys.displayName=ie.Separator.displayName;const ws=({className:e,...t})=>a.jsx("span",{className:Yt("ml-auto text-xs tracking-widest opacity-60",e),...t});ws.displayName="DropdownMenuShortcut";const js=({delayDuration:e=300,...t})=>a.jsx(le.Provider,{delayDuration:e,...t}),Ns=le.Root,_s=le.Trigger,Cs=Z.forwardRef(({className:e,sideOffset:t=4,container:r,...s},n)=>a.jsx(le.Portal,{container:r,children:a.jsx(le.Content,{ref:n,sideOffset:t,className:Yt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Cs.displayName=le.Content.displayName;const ks=Z.forwardRef(({children:e,disabledReason:t,className:r},s)=>{const n=a.jsx(fs,{ref:s,className:Yt("opacity-50 cursor-not-allowed pointer-events-auto",r),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return t?a.jsx(js,{delayDuration:100,children:a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("div",{className:"w-full",children:n})}),a.jsx(Cs,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:t})]})}):n});ks.displayName="DisabledMenuItem";const Ss=de.Root,Ts=de.Trigger,Ds=Z.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:s,...n},o)=>a.jsx(de.Portal,{container:s,children:a.jsx(de.Content,{ref:o,align:t,sideOffset:r,className:Yt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ds.displayName=de.Content.displayName;const Ps=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ps.displayName="Command";const As=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:a.jsx("input",{ref:r,className:Yt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})}));As.displayName="CommandInput";const Es=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Es.displayName="CommandList";const Ms=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("py-6 text-center text-sm text-muted-foreground",e),...t}));Ms.displayName="CommandEmpty";const Is=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Is.displayName="CommandGroup";const Fs=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("-mx-1 h-px bg-border",e),...t}));Fs.displayName="CommandSeparator";const Rs=Z.forwardRef(({className:e,disabled:t,onSelect:r,value:s,...n},o)=>a.jsx("div",{ref:o,className:Yt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":t,onClick:()=>!t&&r?.(s||""),...n}));Rs.displayName="CommandItem";const Ls=({className:e,...t})=>a.jsx("span",{className:Yt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function zs({className:e,...t}){return a.jsx("div",{className:Yt("animate-pulse rounded-md bg-muted",e),...t})}Ls.displayName="CommandShortcut";const Os=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Us({multiple:r,options:s,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:x,required:f,className:g,sortOptions:b,maxDisplayedBadges:v,popoverContainer:y,onOpen:w,onClose:j,clearable:N,showCheck:_}){const[C,k]=t.useState(!1),[S,T]=t.useState(""),D=t.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),P=t.useMemo(()=>{if(!y)return;let e=y,a=0;try{for(;e&&a<3;){const t=window.getComputedStyle(e),r=t.overflowY||t.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,a++}}catch{}return e??void 0},[y]),A=t.useMemo(()=>{const e=s.map(e=>({original:e,value:i(e),label:l(e)}));return b?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[s,i,l,b]),E=t.useMemo(()=>{if(!S)return A;const e=Os(S);return A.filter(a=>Os(a.label).includes(e))},[A,S]),M=t.useMemo(()=>A.filter(e=>D.includes(e.value)),[A,D]),I=e=>{k(e),e?w?.():(T(""),j?.())},F=(e,a)=>{a.preventDefault(),a.stopPropagation(),o&&o(r?D.filter(a=>a!==e):"")},R=v?M.slice(0,v):M,L=v&&M.length>v?M.length-v:0;return a.jsxs("div",{className:Yt("space-y-2",g),children:[u&&a.jsxs(tr,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(Ss,{open:C,onOpenChange:I,modal:!1,children:[r?a.jsx(Ts,{asChild:!0,children:a.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":x,tabIndex:x?-1:0,onKeyDown:e=>{x||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),I(!C))},className:Yt("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",x&&"pointer-events-none opacity-50 cursor-not-allowed",0===M.length&&"text-muted-foreground"),children:[0===M.length?a.jsxs("span",{className:"flex items-center gap-2",children:[m&&a.jsx(m,{className:"h-4 w-4"}),c]}):a.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[R.map(e=>a.jsxs(ts,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:a=>{"Enter"===a.key&&F(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>F(e.value,a),children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),L>0&&a.jsxs(ts,{variant:"outline",className:"gap-1",children:["+",L]})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):a.jsxs("div",{className:"relative",children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",role:"combobox","aria-expanded":C,disabled:x,className:Yt("relative w-full justify-start min-h-10 h-auto pr-10",N&&M.length>0&&"pr-16",0===M.length&&"text-muted-foreground"),children:[0===M.length?a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[m&&a.jsx(m,{className:"h-4 w-4"}),a.jsx("span",{className:"truncate",children:c})]}):a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[m&&a.jsx(m,{className:"h-4 w-4"}),a.jsx("span",{className:"truncate",children:M[0]?.label})]}),a.jsx(d.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),N&&M.length>0&&a.jsx("button",{type:"button",disabled:x,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>F("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx(Ds,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:P,collisionBoundary:P,children:a.jsxs(Ps,{children:[a.jsxs("div",{className:"relative",children:[a.jsx(As,{placeholder:h,value:S,onChange:e=>T(e.target.value)}),S&&a.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx(Es,{children:0===s.length?a.jsx(Ms,{children:p}):0===E.length?a.jsx(Ms,{children:e.t("no_results")}):a.jsx(Is,{children:E.map(e=>{const t=D.includes(e.value);return a.jsxs(Rs,{value:e.value,onSelect:()=>(e=>{if(o)if(r){const a=D.includes(e)?D.filter(a=>a!==e):[...D,e];o(a)}else o(e),k(!1)})(e.value),className:Yt("cursor-pointer",t&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[_&&a.jsx(d.Check,{className:Yt("mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),e.label]},e.value)})})})]})})]})]})}function Vs({multiple:e=!1,options:t,items:r,value:s,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:x=!1,required:f=!1,isLoading:g=!1,error:b,className:v,sortOptions:w=!0,maxDisplayedBadges:j,popoverContainer:N,onOpen:_,onClose:C,clearable:k=!0,showCheck:S=!1}){const{t:T}=y.useTranslation(),D=t||r||[],P=o||n,A=c||T("select_placeholder","Selecione..."),E=p||T("no_results",T("no_results")),M=h||T("search_placeholder","Pesquisar...");if(g)return a.jsxs("div",{className:Yt("space-y-2",v),children:[u&&a.jsxs(tr,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(zs,{className:"h-10 w-full"})]});const I="string"==typeof b?b:b instanceof Error?b.message:b?T("error_loading",T("error_loading")):void 0;return I?a.jsxs("div",{className:Yt("space-y-2",v),children:[u&&a.jsxs(tr,{children:[u,f&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a.jsx(d.AlertCircle,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:I})]})]}):a.jsx(Us,{multiple:e,options:D,value:s||(e?[]:""),onChange:P,getOptionValue:i,getOptionLabel:l,placeholder:A,label:u,icon:m,emptyMessage:E,searchPlaceholder:M,disabled:x,required:f,className:v,sortOptions:w,maxDisplayedBadges:j,popoverContainer:N,onOpen:_,onClose:C,clearable:k,showCheck:S})}const Bs=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function qs(e,a){if(!a)return null;const t=Bs(a),r=[];for(const s of e){const e=Bs(s.label).includes(t),n=s.children?qs(s.children,a):null,o=n&&n.length>0;(e||o)&&r.push({...s,children:e?s.children:o?n:s.children})}return r}function $s(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=$s(t.children,a);if(e)return e}}}function Ws({node:e,level:t,expanded:r,onToggleExpand:s,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,c=n.includes(e.value),u=8+20*t;return a.jsxs("div",{role:"treeitem","aria-expanded":l?r:void 0,"aria-selected":c,className:Yt("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",c&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(c?2:0)+"px"},children:[a.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:a=>{a.stopPropagation(),o(e.value)},children:[i&&a.jsx(d.Check,{className:Yt("h-4 w-4 shrink-0",c?"opacity-100":"opacity-0")}),(()=>{const t=c?e.iconSelected??(r?e.iconOpen:null)??e.icon:r?e.iconOpen??e.icon:e.icon;return t?a.jsx(t,{className:Yt("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),a.jsx("span",{className:"truncate",children:e.label})]}),l&&a.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:a=>{a.stopPropagation(),s(e.value)},tabIndex:-1,"aria-label":r?"Recolher":"Expandir",children:r?a.jsx(d.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(d.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function Hs({nodes:e,level:r,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return a.jsx(a.Fragment,{children:e.map(e=>{const d=s.has(e.value);return a.jsxs(t.Fragment,{children:[a.jsx(Ws,{node:e,level:r,expanded:d,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),d&&e.children&&e.children.length>0&&a.jsx(Hs,{nodes:e.children,level:r+1,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function Gs({multiple:e=!1,options:r,value:s,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:c,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:b,onOpen:v,onClose:w,defaultExpanded:j=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=t.useState(!1),[S,T]=t.useState(""),[D,P]=t.useState(()=>j?function(e){const a=new Set;return function e(t){for(const r of t)r.children&&r.children.length>0&&(a.add(r.value),e(r.children))}(e),a}(r):new Set),A=o||_("select_placeholder","Selecione..."),E=c||_("no_results",_("no_results")),M=u||_("search_placeholder","Pesquisar..."),I=t.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),F=t.useMemo(()=>{if(!b)return;let e=b,a=0;try{for(;e&&a<3;){const t=window.getComputedStyle(e),r=t.overflowY||t.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,a++}}catch{}return e??void 0},[b]),R=t.useMemo(()=>qs(r,S),[r,S])??r,L=t.useMemo(()=>S?function(e,a){const t=new Set,r=Bs(a);function s(e){if(!e.children||0===e.children.length)return Bs(e.label).includes(r);let a=!1;for(const t of e.children)s(t)&&(a=!0);return a&&t.add(e.value),a||Bs(e.label).includes(r)}for(const n of e)s(n);return t}(r,S):new Set,[r,S]),z=S?L:D,O=t.useCallback(e=>{S||P(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[S]),U=t.useMemo(()=>I.map(e=>({value:e,label:$s(r,e)||e})),[I,r]),V=e=>{k(e),e?v?.():(T(""),w?.())},B=t.useCallback(a=>{if(n)if(e){const e=I.includes(a)?I.filter(e=>e!==a):[...I,a];n(e)}else n(a),k(!1)},[n,e,I]),q=(a,t)=>{t.preventDefault(),t.stopPropagation(),n&&n(e?I.filter(e=>e!==a):"")},$=g?U.slice(0,g):U,W=g&&U.length>g?U.length-g:0;if(h)return a.jsxs("div",{className:Yt("space-y-2",f),children:[i&&a.jsxs(tr,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(zs,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?a.jsxs("div",{className:Yt("space-y-2",f),children:[i&&a.jsxs(tr,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a.jsx(d.AlertCircle,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:H})]})]}):a.jsxs("div",{className:Yt("space-y-2",f),children:[i&&a.jsxs(tr,{children:[i,p&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(Ss,{open:C,onOpenChange:V,modal:!1,children:[a.jsx(Ts,{asChild:!0,children:e?a.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V(!C))},className:Yt("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===U.length&&"text-muted-foreground"),children:[0===U.length?a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),A]}):a.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>a.jsxs(ts,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:a=>{"Enter"===a.key&&q(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>q(e.value,a),children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&a.jsxs(ts,{variant:"outline",className:"gap-1",children:["+",W]})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):a.jsxs(Jt,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:Yt("w-full justify-between min-h-10 h-auto font-normal",0===U.length&&"text-muted-foreground"),children:[0===U.length?a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),A]}):a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx(l,{className:"h-4 w-4"}),U[0]?.label]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ds,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:F,collisionBoundary:F,children:[a.jsxs("div",{className:"flex items-center border-b px-3",children:[a.jsx(d.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:M,value:S,onChange:e=>T(e.target.value)}),S&&a.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),a.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:a.jsx("div",{role:"tree",className:"p-1",children:0===R.length?a.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?E:_("no_search_results",_("no_results"))}):a.jsx(Hs,{nodes:R,level:0,expandedIds:z,onToggleExpand:O,selectedValues:I,onSelect:B,showCheck:N})})})]})]})]})}class Ks{static normalizeBase64Url(e){let a=e.replace(/-/g,"+").replace(/_/g,"/");const t=(4-a.length%4)%4;return a+="=".repeat(t),a}static parseJwtPayload(e){try{const s=e.split(".");if(3!==s.length)return null;const n=s[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),a=atob(e),t=new Uint8Array(a.length);for(let s=0;s<a.length;s++)t[s]=a.charCodeAt(s);const r=new TextDecoder("utf-8").decode(t);return JSON.parse(r)}catch(a){try{const e=this.normalizeBase64Url(n),a=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(a)}catch(t){try{const e=this.normalizeBase64Url(n),a=atob(e);return JSON.parse(a)}catch(r){throw r}}}}catch(s){return null}}static validateTokens(e,a){const t=[],r=[];try{a.split(".")[1],e.split(".")[1];const s=this.parseJwtPayload(a),n=this.parseJwtPayload(e);if(!s){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:t,errors:r}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";t.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";t.push(e),o=!1}if(s.exp&&s.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:t,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:t,errors:r}}catch(s){const e=`Erro na validação de tokens: ${s}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:t,errors:r}}}static isTokenExpired(e){const a=this.parseJwtPayload(e);return!a||!a.exp||1e3*a.exp<Date.now()}}Ks.LARGE_PAYLOAD_THRESHOLD=1e3;const Ys="qualiex_access_token",Qs="qualiex_id_token",Xs="supabase_token",Js="oauth_state",Zs="oauth_nonce",en="selected_alias",an="manual_logout",tn="supabase_project_id",rn={setAccessToken:e=>localStorage.setItem(Ys,e),getAccessToken:()=>localStorage.getItem(Ys),setIdToken:e=>localStorage.setItem(Qs,e),getIdToken:()=>localStorage.getItem(Qs),getSupabaseToken:()=>localStorage.getItem(Xs),setOAuthState:e=>sessionStorage.setItem(Js,e),getOAuthState:()=>sessionStorage.getItem(Js),clearOAuthState:()=>sessionStorage.removeItem(Js),setOAuthNonce:e=>sessionStorage.setItem(Zs,e),getOAuthNonce:()=>sessionStorage.getItem(Zs),clearOAuthNonce:()=>sessionStorage.removeItem(Zs),setSelectedAlias:e=>localStorage.setItem(en,e),getSelectedAlias:()=>localStorage.getItem(en),clearSelectedAlias:()=>localStorage.removeItem(en),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!rn.getAccessToken()||!rn.getIdToken()),checkProjectMismatch:()=>{const e=Pe().supabaseProjectId;if(!e)return!1;const a=localStorage.getItem(tn);return a&&a!==e?(rn.clearAll(),localStorage.setItem(tn,e),!0):(a||localStorage.setItem(tn,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Xs,e),rn._clearValidationCache()},areAllTokensValid:()=>{const e=rn.getAccessToken(),a=rn.getIdToken();if(!e||!a)return!1;try{const t=Ks.validateTokens(e,a);return!!t.idTokenValid&&t.idTokenValid}catch(t){return!1}},clearExpiredTokens:()=>{let e=!1;const a=rn.getAccessToken(),t=rn.getIdToken(),r=rn.getSupabaseToken();return a&&rn.isTokenExpired(a)&&(localStorage.removeItem(Ys),e=!0),t&&rn.isTokenExpired(t)&&(localStorage.removeItem(Qs),e=!0),r&&rn.isTokenExpired(r)&&(localStorage.removeItem(Xs),e=!0),e},clearAll:()=>{localStorage.removeItem(Ys),localStorage.removeItem(Qs),localStorage.removeItem(Xs),localStorage.removeItem(en),sessionStorage.removeItem(Js),sessionStorage.removeItem(Zs),rn._clearValidationCache()},setManualLogout:()=>localStorage.setItem(an,"true"),isManualLogout:()=>"true"===localStorage.getItem(an),clearManualLogout:()=>localStorage.removeItem(an),isTokenExpired:e=>{try{return Ks.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{rn._validationCache.isValid=!1,rn._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=rn.getSupabaseToken();if(!e)return!1;if(rn.isTokenExpired(e))return rn._clearValidationCache(),rn._handleExpiredToken(),!1;const a=Date.now();return a-rn._validationCache.timestamp<rn._validationCache.cacheValidityMs?rn._validationCache.isValid:(rn._validationCache.isValid=!0,rn._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>rn.isSupabaseTokenValid()?rn.getSupabaseToken():null,_handleExpiredToken:()=>{rn.clearAll()},extractTokenData:()=>{if(!rn.isSupabaseTokenValid())return null;const e=rn.getSupabaseToken();if(!e)return null;try{const a=Ks.parseJwtPayload(e);if(!a)return null;const t=a.alias||a.default||a.user_alias,r=a.place_id||null,s=a.place_name||null;let n=a.company_id;if(!n&&t)for(const e in a)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=a[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===t){n=e[7];break}}}return{alias:t,companyId:n,placeId:r,placeName:s,payload:a}}catch(a){return rn._handleExpiredToken(),null}},getCompanyId:e=>{const a=rn.getAccessToken();if(a)try{const t=Ks.parseJwtPayload(a);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const a=r.split(";");if(e&&a.length>7&&a[0]===e)return a[7];if(!e&&a.length>7)return a[7]}}}catch(s){}const t=rn.extractTokenData();if(t?.companyId)return t.companyId;const r=rn.getIdToken();if(r)try{const a=Ks.parseJwtPayload(r);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const a=r.split(";");if(e&&a.length>7&&a[0]===e)return a[7];if(!e&&a.length>7)return a[7]}}}catch(s){}return null},getCompanyIdInt:e=>{const a=[rn.getAccessToken(),rn.getIdToken()];for(const t of a)if(t)try{const a=Ks.parseJwtPayload(t);if(!a)continue;for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const a=r.split(";");if(e&&a.length>1&&a[0]===e)return a[1];if(!e&&a.length>1)return a[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=rn.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=rn.getIdToken();if(!e)return[];try{const a=Ks.parseJwtPayload(e);if(!a)return[];const t=[];for(const e in a)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=a[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&t.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:a})}}return t}catch{return[]}}};const sn=new class{constructor(){this.errors=[],this.toastCount=0,this.lastToastTime=0}handleError(e,a=!0){const t="string"==typeof e?e:e.message;if(this.errors.push({id:Date.now().toString(),message:t,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),a&&this.shouldShowToast()){const e=this.getErrorTitle(t);l.toast.error(e,{description:t})}}getErrorTitle(a){const t=a.toLowerCase();return t.includes("401")||t.includes("unauthorized")||t.includes("expirou")?e.t("error_session_expired"):t.includes("token")||t.includes("autenticação")?e.t("error_authentication"):t.includes("api")||t.includes("network")?e.t("error_connection"):"Erro"}success(e,a){l.toast.success(e,{description:a})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function nn(e){return!!e&&e.startsWith("eyJ")}let on=!1;function ln(){if(Ae()){const e=Pe();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}const e=(void 0).VITE_SUPABASE_URL,a=(void 0).VITE_SUPABASE_PK_OVERRIDE||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&a?{url:e,key:a}:null}class dn{constructor(e){this.currentToken=null,this.config=e,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,a=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;on?nn(a):e&&nn(a)?on=!0:nn(a)?on=!0:on=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:this.config.key};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return w.createClient(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:a,fetch:async(e,a)=>("string"==typeof e?e:e.url).includes("/auth/v1/user")?new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}}):fetch(e,a)}})}static getInstance(){if(!dn.instance){const e=ln();if(!e)throw new Error("[forlogic-core] Supabase não configurado. Defina VITE_SUPABASE_URL e VITE_SUPABASE_PUBLISHABLE_KEY no .env, ou não invoque getSupabaseClient() (use isSupabaseConfigured() para checar antes).");dn.instance=new dn(e)}return dn.instance}getClient(){const e=rn.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Ks.isTokenExpired(e)}catch(a){return sn.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}}function cn(){return dn.getInstance().getClient()}class un{static async generateToken(e,a,t,r=!1){try{if(!r){const e=rn.getSupabaseToken();if(e&&rn.isSupabaseTokenValid())return e}const s=cn(),{data:n,error:o}=await s.functions.invoke("validate-token",{body:{access_token:e,alias:a}});return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(t?.(),null):n?.access_token?(rn.setSupabaseToken(n.access_token),n.access_token):null}catch(s){return s instanceof Error&&(s.message.includes("401")||s.message.includes("Unauthorized"))&&t?.(),null}}}class mn{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const a=rn.getAccessToken(),t=rn.getSelectedAlias();if(!a||!t)return null;const r=await un.generateToken(a,t,this.onLogoutCallback||void 0,e);return r||null}catch(a){return null}}}mn.regenerationPromise=null,mn.onLogoutCallback=null;class pn{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(rn.clearAll(),window.location.href="/login",!0)}static isAuthenticationError(e,a){if(401===e.status||401===e.statusCode)return!0;const t=a.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>t.includes(e))}static async wrapAsync(e){try{return await e}catch(a){if(!this.handleError(a))throw a;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}class hn{static async handleApiError(e){if(!e||this.isRetrying)return!1;const a=e.status||e.statusCode,t=e.message||e.toString();if(401===a||t.includes("401")||t.includes("Unauthorized")){this.isRetrying=!0;try{return await mn.attemptRegeneration()?(this.isRetrying=!1,!0):(pn.handleError(e),this.isRetrying=!1,!1)}catch(r){return pn.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=rn.getAccessToken();return e?rn.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}hn.isRetrying=!1;const xn=new class{get baseUrl(){return Ve()}async makeApiCall(e,a,t){const r=hn.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const s=rn.getAccessToken();if(!s)throw new Error("Token Qualiex não encontrado");if(!t||""===t.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const n=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{n.searchParams.append(e,a)});const o=await fetch(n.toString(),{method:"GET",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!o.ok){const e=new Error(`API call failed: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}return await o.json()}mapToQualiexUser(e){let a;return a="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:a}}parseUsersResponse(e,a=""){let t=e;if(e.data)t=e.data;else{if(!Array.isArray(e))return sn.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(sn.handleError(`[QualiexApi] Resposta não é um array${a}`,!1),null)}async fetchUsers(e,a,t="active"){const r={companyId:a,search:"",filterStatus:t};try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a)??[]}catch(s){if(await hn.handleApiError(s))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a," após retry")??[]}catch(n){return sn.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return sn.handleError(s instanceof Error?s.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,a,t){try{return(await this.fetchUsers(a,t)).find(a=>a.userId===e)||null}catch(r){return sn.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,a){const t=await this.fetchUsers(e,a,"active"),r=new Map;return t.forEach(e=>r.set(e.userId,e)),r}async fetchAllUsersMap(e,a){const t=await this.fetchUsers(e,a,"all"),r=new Map;return t.forEach(e=>r.set(e.userId,e)),r}async getUsers(e,a="active"){const t=rn.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId,a):[]}async fetchSoftwares(e){try{const a=await this.makeApiCall("/api/common/v1/softwares",{},e),t=a?.data||a;return Array.isArray(t)?t.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):(sn.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await hn.handleApiError(a))try{const a=await this.makeApiCall("/api/common/v1/softwares",{},e),t=a?.data||a;return Array.isArray(t)?t.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(t){return sn.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return sn.handleError(a instanceof Error?a.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,a){try{const t=await this.makeApiCall(`/api/common/v1/Users/${e}/associations`,{},a),r=t?.data||t;return Array.isArray(r)?r.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1})):(sn.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(t){if(await hn.handleApiError(t))try{const t=await this.makeApiCall(`/api/common/v1/Users/${e}/associations`,{},a),r=t?.data||t;return Array.isArray(r)?r.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1})):[]}catch(r){return sn.handleError(r instanceof Error?r:"Erro ao buscar associações após renovação de token",!0),[]}return sn.handleError(t instanceof Error?t.message:"Erro ao buscar associações do usuário",!0),[]}}};function fn(e,a){const t=a||Be.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function gn(e,a){const t=a||Be.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function bn(e,a){const t=a||Be.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function vn(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||fn(e.idField),emailField:e.emailField||gn(e.idField),usernameField:e.usernameField||bn(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:fn(e),emailField:gn(e),usernameField:bn(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const yn=new Map;class wn{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,r=yn.get(t);if(r&&Date.now()-r.timestamp<3e5)return r.users;let s=await xn.fetchUsers(e,a,"all");return 0===s.length&&(s=await xn.fetchUsers(e,a,"active")),yn.set(t,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,a){const t=new Set;for(const r of e)for(const e of a){const a=r[e.idField];a&&"string"==typeof a&&""!==a.trim()&&t.add(a)}return t}static indexUsers(e){const a=new Map;for(const t of e)t.id&&a.set(t.id,t),t.userId&&a.set(t.userId,t);return a}static enrichEntity(e,a,t){const r={...e};for(const s of a){const a=e[s.idField];if(!a)continue;const n=t.get(a);if(n){if(s.nameField){r[s.nameField]||(r[s.nameField]=n.userName||null)}if(s.emailField){r[s.emailField]||(r[s.emailField]=n.userEmail||null)}if(s.usernameField){r[s.usernameField]||(r[s.usernameField]=n.userName||null)}}}return r}static async enrichWithUserData(e,a){if(!Array.isArray(e)||0===e.length)return e;try{if(!rn.areAllTokensValid())return e;const t=rn.extractTokenData();if(!t)return e;const{alias:r,companyId:s}=t;if(!r||!s)return e;const n=vn(a.userIdFields,a.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(r,s),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(t){return sn.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const jn=["responsible_name"],Nn=e=>jn.includes(e);function _n(e,a,t){const r="string"==typeof e?{tableName:e,searchFields:a||[],schemaName:t||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:s,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:d=!1}=r,c=()=>{if(!rn.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return cn().schema(i).from(s)},u=(e,a,t,r)=>{let s=c().select(o||"*",{count:"exact"});s=s.eq("is_removed",!1),Object.entries(r).forEach(([e,a])=>{void 0!==a&&""!==a&&(Array.isArray(a)?s=s.in(e,a):"object"==typeof a&&a&&"operator"in a?"not_null"===a.operator?s=s.not(e,"is",null):"is_null"===a.operator&&(s=s.is(e,null)):null!==a&&(s=s.eq(e,a)))}),s=((e,a)=>{if(a&&n.length>0){const t=n.map(e=>`${e}.ilike.%${a}%`).join(",");return e.or(t)}return e})(s,e);const i=a.includes(".");return i||Nn(a)||(s=s.order(a,{ascending:"asc"===t})),{query:s,isForeignKey:i}},m=async(e,a,t,s,n)=>{const o=vn(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),i=a.includes(".");if(Nn(a)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const d=await wn.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let c;c=i?d.sort((e,r)=>{const s=a.split(".").reduce((e,a)=>e?.[a],e)||"",n=a.split(".").reduce((e,a)=>e?.[a],r)||"",o=String(s).localeCompare(String(n),"pt-BR");return"asc"===t?o:-o}):((e,a,t)=>[...e].sort((e,r)=>{const s=e[a]||"",n=r[a]||"",o=s.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===t?o:-o}))(d,a,t);const u=((e,a=1,t=25)=>{const r=(a-1)*t,s=r+t;return{data:e.slice(r,s),pagination:{currentPage:a,totalPages:Math.ceil(e.length/t),totalItems:e.length,itemsPerPage:t,hasNextPage:s<e.length,hasPreviousPage:a>1}}})(c,s,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await wn.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:a,sortField:t,sortDirection:n,page:o,limit:i,additionalFilters:c}=(e=>{const{search:a="",sortField:t="updated_at",sortDirection:r="desc",page:s=1,limit:n=25,...o}=e;return{search:a,sortField:t,sortDirection:r,page:s,limit:n,additionalFilters:o}})(e),{query:p}=u(a,t,n,c),h=((e,a,t)=>{const r=(a-1)*t,s=r+t-1;return e.range(r,s)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${s}: ${f.message}`);let b=((e,a,t,r)=>{const s=Math.ceil((a||0)/r);return{data:e,currentPage:t,totalPages:s,totalItems:a||0,itemsPerPage:r,hasNextPage:t<s,hasPreviousPage:t>1}})(x||[],g,o,i);if((e=>{if(!d||!l||0===e.length)return!1;const a=vn(r.userIdFields,r.userFieldsMapping);return e.some(e=>a.some(a=>e[a.idField]))})(b.data)){const e=await m(b.data,t,n,o,i);if(!Array.isArray(e))return e;b={...b,data:e}}return b},async getById(e){const{data:a,error:t}=await c().select(o||"*").eq("id",e).maybeSingle();if(t)throw new Error(`Error fetching ${s}: ${t.message}`);return a},async create(e){const a=Qt(e),t=Object.entries(a).reduce((e,[a,t])=>(void 0!==t&&(e[a]=t),e),{}),{data:r,error:n}=await c().insert(t).select().single();if(n)throw new Error(`Error creating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from create ${s} operation`);return r},async update(e,a){const t={...Qt(a),updated_at:(new Date).toISOString()},{data:r,error:n}=await c().update(t).eq("id",e).select().single();if(n)throw new Error(`Error updating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from update ${s} operation`);return r},async delete(e){const a={is_removed:!0,updated_at:(new Date).toISOString()},{error:t}=await c().update(a).eq("id",e);if(t)throw new Error(`Error soft deleting ${s}: ${t.message}`)}};return p}var Cn;const kn={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};class Sn{static async initialize(){try{const e=Ie();if(e){if(rn.checkProjectMismatch())return{...kn}}if(!rn.hasAllTokens()||!rn.areAllTokensValid())return rn.clearExpiredTokens(),{...kn};const a=rn.getAccessToken(),t=rn.getIdToken();rn.clearManualLogout();const r=this.extractUserFromIdToken(t,a),s=this.extractCompaniesFromIdToken(t),n=this.extractAliasFromAccessToken(a),o=e?rn.extractTokenData():null,i=o?.alias;let l=null;if(i&&s.some(e=>e.alias===i))l=i;else{const e=rn.getSelectedAlias(),a=e&&s.some(a=>a.alias===e);l=a?e:n||s[0]?.alias||null}if(e&&(!rn.isSupabaseTokenValid()&&l&&await mn.attemptRegeneration(),!rn.isSupabaseTokenValid()))return{...kn};let d=null;if(l){const e=rn.getCompanyId(l),a=s.find(e=>e.alias===l);a&&(d={id:e||a.id,name:a.name,alias:a.alias})}const c=o?.placeId??null,u=o?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:l,companies:s,selectedUnit:d,userId:r?.id||null,userAlias:r?.id||null,placeId:c,placeName:u,activePlaceId:c,activePlaceName:u}}catch(e){return{...kn}}}static async loginDev(){if(!Ie())return this.loginProd(),!0;try{const e=cn(),{data:a,error:t}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(t)return!1;if(!a?.access_token||!a?.id_token)return!1;const r=new URL("/callback",window.location.origin);return r.hash=`access_token=${a.access_token}&id_token=${a.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";rn.setOAuthState(e);const a=rn.generateOAuthNonce();rn.setOAuthNonce(a);const t=`${window.location.origin}/callback`,r=new URL(Fe.oauth.authUrl);r.searchParams.set("client_id",Fe.oauth.clientId),r.searchParams.set("response_type",Fe.oauth.responseType),r.searchParams.set("scope",Fe.oauth.scope),r.searchParams.set("redirect_uri",t),r.searchParams.set("state",e),r.searchParams.set("nonce",a),r.searchParams.set("response_mode","fragment"),window.location.href=r.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),a=new URLSearchParams(window.location.search),t=t=>e.get(t)||a.get(t),r=t("access_token"),s=t("id_token"),n=t("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(r&&s){const e=rn.getAccessToken();e!==r&&rn.clearAll()}const o=Ie();if(rn.hasAllTokens()){if(o){rn.getValidSupabaseToken()||await mn.attemptRegeneration(!0)}return!0}const i=r,l=s;if(!i||!l)throw new Error("Tokens não encontrados na URL de callback");rn.setAccessToken(i),rn.setIdToken(l),rn.clearManualLogout();const d=this.extractAliasFromAccessToken(i);if(d)rn.setSelectedAlias(d);else{const e=this.extractCompaniesFromIdToken(l);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");rn.setSelectedAlias(e[0].alias)}if(o){if(!await mn.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return rn.clearOAuthState(),rn.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){rn.clearAll(),rn.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}window.location.href="/login"}static decodeToken(e){return Ks.parseJwtPayload(e)}static extractUserFromIdToken(e,a){const t=this.decodeToken(e);if(!t)return null;const r=a?this.decodeToken(a):null;return{id:t.subNewId,email:t.email,name:t.name,identifier:t.identifier,isSysAdmin:"1"===r?.admin}}static extractCompaniesFromIdToken(e){const a=this.decodeToken(e);if(!a)return[];const t=[];return Object.keys(a).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof a[e]){const r=a[e].split(";");if(r.length>=4)t.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,s]=a[e].split("|");r&&s&&t.push({id:"",alias:r.trim(),name:s.trim()})}}}),t}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}}Cn=Sn,mn.setLogoutCallback(()=>{Cn.logout()});const Tn=e=>e?.placeId||null,Dn=e=>e?.placeName||null,Pn=t.createContext(void 0),An=({children:e})=>{const[r,s]=t.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=j.useQueryClient()}catch{}const[o,i]=t.useState(!1),l=t.useRef(0),d=t.useCallback(e=>{s(a=>({...a,...e}))},[]),c=t.useCallback(e=>{s(a=>({...a,isLoading:e}))},[]),u=t.useCallback(()=>{s({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=t.useCallback(async e=>{if(e.alias===r.alias)return;const a=++l.current;try{const s=rn.getAccessToken();if(!s)return;const o=Ie();let i=null;if(o){const t=await un.generateToken(s,e.alias,void 0,!0);if(l.current!==a)return;if(!t)return;rn.setSupabaseToken(t),i=rn.extractTokenData()}rn.setSelectedAlias(e.alias);const c=i?.alias||e.alias,u=i?.companyId||rn.getCompanyId(e.alias),m={id:u||e.id,name:e.name,alias:c};let p=null,h=null;if(r.user?.id&&c&&u)try{const e=await xn.fetchActiveUsersMap(c,u);if(l.current!==a)return;const t=e.get(r.user.id);if(t){const e=(e=>({placeId:Tn(e),placeName:Dn(e)}))(t);p=e.placeId,h=e.placeName}}catch(t){}if(l.current!==a)return;d({alias:c,selectedUnit:m,placeId:p,placeName:h,activePlaceId:p,activePlaceName:h}),n&&await n.clear()}catch(t){}},[d,n,r.user,r.alias]),p=t.useCallback(async()=>{const e=await Sn.processCallback();if(e){const e=await Sn.initialize();e&&e.isAuthenticated&&(d({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[d,n]),h=t.useCallback(async()=>{await Sn.logout(),u(),n&&await n.clear()},[u,n]),x=t.useCallback(e=>{i(e)},[]),f=t.useCallback(()=>{},[]),g=t.useCallback(()=>{n&&n.invalidateQueries()},[n]);t.useEffect(()=>{if(!r.isAuthenticated)return;let e=!0;const a=setInterval(async()=>{if(e)if(rn.areAllTokensValid()){if(Ie()&&!rn.isSupabaseTokenValid())try{await mn.attemptRegeneration()||e&&h()}catch(a){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(a)}},[r.isAuthenticated,h]),t.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const a=await Sn.initialize();if(!e)return;a&&a.isAuthenticated?d({user:a.user,companies:a.companies,alias:a.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:a.selectedUnit,userId:a.userId,userAlias:a.userAlias,placeId:a.placeId,placeName:a.placeName,activePlaceId:a.activePlaceId,activePlaceName:a.activePlaceName}):e&&c(!1)}catch(a){e&&(pn.handleError(a),c(!1))}})(),()=>{e=!1}},[d,c,h]);const b=t.useMemo(()=>({...r,logout:h,processCallback:p,switchUnit:m,availableUnits:r.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[r.user,r.companies,r.alias,r.isAuthenticated,r.isLoading,r.selectedUnit,r.userId,r.userAlias,r.placeId,r.placeName,r.activePlaceId,r.activePlaceName,h,p,m,o,x,f,g]);return a.jsx(Pn.Provider,{value:b,children:e})},En=()=>{const e=t.useContext(Pn);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function Mn({queryKey:e,service:a,entityName:r,searchFields:s,additionalFilters:n={},onSuccess:o}){const[i,d]=N.useSearchParams(),c=j.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=En(),{t:h}=y.useTranslation(),x=t.useCallback(a=>{const t=`${e}_${a}`,r=i.get(t);return r||(i.get(a)||"")},[i,e]),f=x("search"),g=x("sortField")||Re.sorting.defaultField,b=x("sortDirection")||Re.sorting.defaultDirection,v=parseInt(x("page")||"1"),w=parseInt(x("limit")||String(Re.pagination.defaultPageSize)),_=f,C=t.useMemo(()=>({search:_,sortField:g,sortDirection:b,page:v,limit:w,...n}),[_,g,b,v,w,n]),k=t.useCallback(()=>a.getAll(C),[a,C]),S=j.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const T=j.useMutation({mutationFn:a.create,onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success($e.success.created(r)),o?.()},onError:e=>{l.toast.error(`${$e.error.create(r)}: ${e.message}`)}}),D=j.useMutation({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success($e.success.updated(r)),o?.()},onError:e=>{l.toast.error(`${$e.error.update(r)}: ${e.message}`)}}),P=j.useMutation({mutationFn:a.delete,onSuccess:()=>{c.invalidateQueries({queryKey:[e]}),l.toast.success($e.success.deleted(r))},onError:e=>{l.toast.error(`${$e.error.delete(r)}: ${e.message}`)}}),A=t.useCallback(a=>{const t={...Object.fromEntries(i)};Object.entries(a).forEach(([a,r])=>{const s=`${e}_${a}`;""===r||0===r?delete t[s]:t[s]=String(r)}),delete t.sortField,delete t.sortDirection,d(t)},[i,d,e]),E=t.useCallback(e=>{A({search:e,page:1})},[A]),M=t.useCallback(e=>{A({sortField:e,sortDirection:g===e&&"asc"===b?"desc":"asc",page:1})},[g,b,A]),I=t.useCallback(e=>{A({page:e})},[A]),F=t.useCallback(e=>{A({limit:e,page:1})},[A]),R=t.useCallback(()=>{const a=Object.fromEntries(i),t=`${e}_`,r=Object.fromEntries(Object.entries(a).filter(([e])=>!e.startsWith(t)));d(r)},[d,i,e]),[L,z]=t.useState([]),O=t.useCallback(e=>{z(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),U=t.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(a=>a.length===e.length?[]:e)},[S?.data?.data]),V=t.useCallback(()=>{z([])},[]),B=t.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&L.length===e.length},[L,S?.data?.data]),q=j.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,t)=>{c.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${t.length} ${r}(s) deletado(s) com sucesso`)),V()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=t.useCallback((e,a)=>{const t=a?a(e):e;e.id?D.mutate({id:e.id,data:t}):T.mutate({...t,alias:u})},[u,T,D]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||Re.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:T?.isPending??!1,isUpdating:D?.isPending??!1,isDeleting:P?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:b,currentPage:v,itemsPerPage:w,queryKey:e,createEntity:T.mutate,updateEntity:(e,a)=>D.mutate({id:e,data:a}),deleteEntity:P.mutate,save:$,handleSearch:E,handleSort:M,handlePageChange:I,handleItemsPerPageChange:F,clearFilters:R,refetch:S.refetch,selectedIds:L,selectItem:O,selectAll:U,clearSelection:V,isAllSelected:B,bulkDelete:e=>q.mutateAsync(e),isBulkDeleting:q.isPending}}function In(e){const[a,r]=t.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return t.useEffect(()=>{const a=window.matchMedia(e);r(a.matches);const t=e=>{r(e.matches)};return a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[e]),a}function Fn(e=768){return In(`(max-width: ${e-1}px)`)}const Rn=Z.forwardRef(({className:e,...t},r)=>a.jsx("table",{ref:r,className:Yt("w-full caption-bottom text-[13px] table-fixed",e),...t}));Rn.displayName="Table";const Ln=Z.forwardRef(({className:e,...t},r)=>a.jsx("thead",{ref:r,className:Yt("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));Ln.displayName="TableHeader";const zn=Z.forwardRef(({className:e,...t},r)=>a.jsx("tbody",{ref:r,className:Yt("[&_tr:last-child]:border-0",e),...t}));zn.displayName="TableBody";const On=Z.forwardRef(({className:e,...t},r)=>a.jsx("tfoot",{ref:r,className:Yt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));On.displayName="TableFooter";const Un=Z.forwardRef(({className:e,...t},r)=>a.jsx("tr",{ref:r,className:Yt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));Un.displayName="TableRow";const Vn=Z.forwardRef(({className:e,...t},r)=>a.jsx("th",{ref:r,className:Yt("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...t}));Vn.displayName="TableHead";const Bn=Z.forwardRef(({className:e,...t},r)=>a.jsx("td",{ref:r,className:Yt("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));Bn.displayName="TableCell";const qn=Z.forwardRef(({className:e,...t},r)=>a.jsx("caption",{ref:r,className:Yt("mt-4 text-sm text-muted-foreground",e),...t}));function $n({rows:e=5,columns:t=4}){return a.jsx("div",{className:"w-full",children:a.jsxs("div",{className:"rounded-md border",children:[a.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:a.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>a.jsx(zs,{className:"h-4 w-24"},t))})}),a.jsx("div",{children:Array.from({length:e}).map((e,r)=>a.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:a.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>a.jsx(zs,{className:"h-4 w-20"},t))})},r))})]})})}function Wn({count:e=3}){return a.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>a.jsxs(rr,{children:[a.jsxs(sr,{children:[a.jsx(zs,{className:"h-4 w-3/4"}),a.jsx(zs,{className:"h-3 w-1/2"})]}),a.jsx(ir,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(zs,{className:"h-3 w-full"}),a.jsx(zs,{className:"h-3 w-2/3"})]})})]},t))})}qn.displayName="TableCaption";const Hn={default:d.FileX,search:d.Search,error:d.AlertCircle};function Gn({icon:e,title:t,description:r,action:s,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,d=Hn[o];return a.jsxs("div",{className:Yt("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[a.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:a.jsx(d,{className:"h-8 w-8 text-muted-foreground"})}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),r&&a.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),s&&a.jsx(Jt,{onClick:s.onClick,variant:"outline",children:s.label})]})}function Kn({children:e,className:t}){const r=Z.useRef(null),[s,n]=Z.useState(!1);Z.useEffect(()=>{const e=()=>{const e=r.current;e&&n(e.scrollWidth>e.clientWidth)};e();const a=new ResizeObserver(e);return r.current&&a.observe(r.current),()=>a.disconnect()},[e]);const o=a.jsx("div",{ref:r,className:`truncate w-full max-w-full ${t||""}`,children:e});return s?a.jsx(js,{delayDuration:300,children:a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:o}),a.jsx(Cs,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const Yn=Z.forwardRef(({direction:e,onMouseDown:t,isDragging:r,className:s},n)=>{const o="horizontal"===e;return a.jsx("div",{ref:n,onMouseDown:t,className:Yt("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],r&&"bg-primary/30",s),children:a.jsx("div",{className:Yt("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});Yn.displayName="TableResizeHandle";const Qn=ce.Root,Xn=ce.Trigger,Jn=ce.Group,Zn=ce.Portal,eo=ce.Sub,ao=ce.RadioGroup,to=Z.forwardRef(({className:e,inset:t,children:r,...s},n)=>a.jsxs(ce.SubTrigger,{ref:n,className:Yt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...s,children:[r,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));to.displayName=ce.SubTrigger.displayName;const ro=Z.forwardRef(({className:e,...t},r)=>a.jsx(ce.SubContent,{ref:r,className:Yt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ro.displayName=ce.SubContent.displayName;const so=Z.forwardRef(({className:e,...t},r)=>a.jsx(ce.Portal,{children:a.jsx(ce.Content,{ref:r,className:Yt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));so.displayName=ce.Content.displayName;const no=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(ce.Item,{ref:s,className:Yt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));no.displayName=ce.Item.displayName;const oo=Z.forwardRef(({className:e,children:t,checked:r,...s},n)=>a.jsxs(ce.CheckboxItem,{ref:n,className:Yt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ce.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));oo.displayName=ce.CheckboxItem.displayName;const io=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(ce.RadioItem,{ref:s,className:Yt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ce.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));io.displayName=ce.RadioItem.displayName;const lo=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(ce.Label,{ref:s,className:Yt("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));lo.displayName=ce.Label.displayName;const co=Z.forwardRef(({className:e,...t},r)=>a.jsx(ce.Separator,{ref:r,className:Yt("-mx-1 my-1 h-px bg-border",e),...t}));co.displayName=ce.Separator.displayName;const uo=({className:e,...t})=>a.jsx("span",{className:Yt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});uo.displayName="ContextMenuShortcut";const mo=({onEdit:e,onDelete:t,onToggleStatus:r,isActive:s=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),c=[];if(e){const a={icon:d.Edit,label:l("edit"),onClick:e};c.push(a)}if(o.forEach(e=>{c.push(e)}),r){const e={icon:s?d.PowerOff:d.Power,label:s?"Inativar":"Ativar",onClick:r};c.push(e)}if(n&&t){const e={icon:d.Trash2,label:l("ap_delete"),onClick:t,destructive:!0};c.push(e)}const u="dropdown"===i?fs:no;return a.jsx(a.Fragment,{children:c.map((e,t)=>a.jsxs(u,{onClick:e.onClick,className:Yt("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[a.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},t))})},po=({onEdit:e,onDelete:t,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsx(Jt,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a.jsx(d.EllipsisVertical,{size:12})})}),a.jsx(xs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a.jsx(mo,{onEdit:e?a=>{a?.stopPropagation(),e?.()}:void 0,onDelete:t?e=>{e?.stopPropagation(),t?.()}:void 0,onToggleStatus:s?e=>{e?.stopPropagation(),s?.()}:void 0,isActive:n,canDelete:r&&!!t,customActions:o,renderAs:"dropdown"})})]}),ho=({onEdit:e,onDelete:t,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return a.jsx(js,{delayDuration:200,children:a.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a.jsx(d.Pencil,{size:14})})}),a.jsx(Cs,{children:i("edit")})]}),o.map((e,t)=>{const r=e.icon;return a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a.jsx(r,{size:14})})}),a.jsx(Cs,{children:e.label})]},t)}),s&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),s()},children:n?a.jsx(d.ToggleRight,{size:14}):a.jsx(d.ToggleLeft,{size:14})})}),a.jsx(Cs,{children:n?"Inativar":"Ativar"})]}),t&&r&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:Yt("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),t()},children:a.jsx(d.Trash2,{size:14})})}),a.jsx(Cs,{children:i("ap_delete")})]})]})})},xo=150;function fo({columns:e,storageKey:a,onResize:r,enabled:s=!0}){const[n,o]=t.useState(()=>{if(!s||"undefined"==typeof window)return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??xo,e),{});if(a){const e=localStorage.getItem(a);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??xo,e),{})}),[i,l]=t.useState(!1),[d,c]=t.useState(null),u=t.useRef(0),m=t.useRef(0),p=t.useCallback((e,a)=>{s&&(a.preventDefault(),a.stopPropagation(),l(!0),c(e),u.current=a.clientX,m.current=n[e]??xo)},[s,n]);t.useEffect(()=>{if(!i||!d)return;const t=e.find(e=>e.key===d),s=t?.minWidth??60,n=t?.maxWidth??500,p=e=>{const a=e.clientX-u.current,t=Math.max(s,Math.min(n,m.current+a));o(e=>{const a={...e,[d]:t};return r?.(a),a})},h=()=>{l(!1),c(null),a&&o(e=>(localStorage.setItem(a,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,d,e,a,r]),t.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=t.useCallback(()=>{const t=e.reduce((e,a)=>(e[a.key]=a.defaultWidth??xo,e),{});o(t),a&&localStorage.removeItem(a),r?.(t)},[e,a,r]);return{columnWidths:n,isDragging:i,activeColumn:d,handleMouseDown:p,resetWidths:h}}const go=s.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),bo=Z.forwardRef(({className:e,variant:t,size:r,...s},n)=>a.jsx(me.Root,{ref:n,className:Yt(go({variant:t,size:r,className:e})),...s}));bo.displayName=me.Root.displayName;const vo=Z.createContext({size:"default",variant:"default"}),yo=Z.forwardRef(({className:e,variant:t,size:r,children:s,...n},o)=>a.jsx(ue.Root,{ref:o,className:Yt("flex items-center justify-center gap-1",e),...n,children:a.jsx(vo.Provider,{value:{variant:t,size:r},children:s})}));yo.displayName=ue.Root.displayName;const wo=Z.forwardRef(({className:e,children:t,variant:r,size:s,...n},o)=>{const i=Z.useContext(vo);return a.jsx(ue.Item,{ref:o,className:Yt(go({variant:i.variant||r,size:i.size||s}),e),...n,children:t})});wo.displayName=ue.Item.displayName;const jo=t.memo(function({onNew:e,newButtonLabel:t,showNewButton:r=!0,showSearch:s=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:c=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:b=!1,availableViewModes:v=["table","list","grid"],rightSlot:w,className:j}){const{t:N}=y.useTranslation(),_=c>0,C=e&&r||h.length>0,k=x||b||w,S=s&&o;return C||S||k||l&&_?a.jsxs("div",{className:Yt("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",j),children:[a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&r&&a.jsxs(Jt,{onClick:e,children:[a.jsx(d.Plus,{size:16,className:"mr-2"}),t||"Novo"]}),h.map((e,t)=>{const r=e.icon;return a.jsxs(Jt,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[r&&a.jsx(r,{size:16,className:"mr-2"}),e.label]},t)})]}),l&&_&&a.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[a.jsx(ts,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),a.jsxs(js,{delayDuration:200,children:[u.length>0?u.map((e,t)=>{const r=e.icon,s=e.disabled;return a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:Yt("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:s,onClick:()=>e.action([]),children:r?a.jsx(r,{size:16}):a.jsx("span",{className:"text-xs",children:e.label[0]})})}),a.jsx(Cs,{children:e.label})]},t)}):a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a.jsx(d.Trash2,{size:16})})}),a.jsx(Cs,{children:N("ap_delete")})]}),a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a.jsx(d.X,{size:16})})}),a.jsx(Cs,{children:N("clear_selection")})]})]})]}),S&&a.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:a.jsxs("div",{className:"relative w-full",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(er,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&a.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,b&&f&&g&&a.jsx(yo,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:v.map(e=>{const t=(e=>{switch(e){case"table":return d.Table2;case"list":return d.List;case"grid":return d.LayoutGrid}})(e);return a.jsx(wo,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a.jsx(t,{className:"h-4 w-4"})},e)})}),w]})]}):null}),No=t.memo(({checked:e,onCheckedChange:t})=>a.jsx(Zr,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function _o(e){try{const a=localStorage.getItem(e);if(!a)return null;const t=JSON.parse(a);let r=t.groupByColumns||[];return 0===r.length&&t.groupByColumn&&(r=[t.groupByColumn]),{hiddenColumns:new Set(t.hiddenColumns||[]),columnOrder:t.columnOrder||[],groupByColumns:r}}catch{return null}}function Co({columns:e,storageKey:a,enabled:r=!0,defaultHiddenColumns:s}){const n=t.useMemo(()=>e.map(e=>String(e.key)),[e]),o=t.useMemo(()=>new Set(s??[]),[s]),[i,l]=t.useState(()=>{if(!r)return o;if(!a)return o;const e=_o(a);return e?.hiddenColumns??o}),[d,c]=t.useState(()=>{if(!r||!a)return n;const e=_o(a)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=t.useState(()=>r&&a?_o(a)?.groupByColumns??[]:[]),[p,h]=t.useState(new Set);t.useEffect(()=>{r&&a&&function(e,a){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,groupByColumns:a.groupByColumns}))}catch{}}(a,{hiddenColumns:i,columnOrder:d,groupByColumns:u})},[i,d,u,a,r]),t.useEffect(()=>{const a=new Set(e.map(e=>String(e.key))),t=new Set(d),r=[...a].filter(e=>!t.has(e));r.length>0&&c(e=>[...e.filter(e=>a.has(e)),...r])},[e]);const x=t.useCallback(e=>i.has(e),[i]),f=t.useCallback(e=>{l(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),g=t.useCallback(()=>{l(new Set)},[]),b=t.useCallback(()=>{if(l(o),c(n),m([]),h(new Set),a)try{localStorage.removeItem(a)}catch{}},[n,o,a]),v=t.useCallback((e,a)=>{c(t=>{const r=[...t],[s]=r.splice(e,1);return r.splice(a,0,s),r})},[]),y=t.useCallback(e=>{h(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),w=t.useCallback(e=>{m(e),h(new Set)},[]),j=t.useCallback(e=>{m(a=>a.includes(e)?a:[...a,e])},[]),N=t.useCallback(e=>{m(a=>a.filter(a=>a!==e)),h(a=>{const t=new Set;for(const r of a)r.includes(`${e}:`)||t.add(r);return t})},[]),_=t.useCallback((e,a)=>{m(t=>{const r=[...t],[s]=r.splice(e,1);return r.splice(a,0,s),r}),h(new Set)},[]),C=u[0]??null,k=t.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=t.useMemo(()=>{if(!r)return e;const a=new Map(e.map(e=>[String(e.key),e]));return d.filter(e=>!i.has(e)&&a.has(e)).map(e=>a.get(e))},[e,d,i,r]),T=t.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(a,t,r,s){if(0===t.length)return[{groupKey:s||"__leaf__",groupValue:"",items:a,count:a.length,level:r}];const[n,...o]=t,i=new Map;for(const l of a){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([a,t])=>{const i=s?`${s}|${n}:${a}`:`${n}:${a}`,l=o.length>0?e(t,o,r+1,i):void 0;return{groupKey:i,groupValue:a,items:t,count:t.length,level:r,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:b,columnOrder:d,reorderColumns:v,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:w,addGroupByColumn:j,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:T,collapsedGroups:p,toggleGroupCollapse:y}}function ko({enabled:e=!1,onReorder:a}){const[r,s]=t.useState(null),[n,o]=t.useState(null),i=t.useCallback(()=>{s(null),o(null)},[]),l=t.useCallback((t,n)=>({draggable:e,onDragStart:a=>{e&&(s(t),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setData("text/plain",String(t)),n&&a.dataTransfer.setData("application/column-key",n))},onDragOver:a=>{e&&null!==r&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDragEnter:a=>{e&&null!==r&&(a.preventDefault(),o(t))},onDrop:s=>{s.preventDefault(),e&&null!==r&&r!==t?(a(r,t),i()):i()},onDragEnd:()=>{i()}}),[e,r,a,i]);return t.useMemo(()=>({dragFromIndex:r,dragOverIndex:n,isDragging:null!==r,getDragProps:l}),[r,n,l])}function So({columns:e,columnOrder:r,isColumnHidden:s,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:c,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=t.useState(null),[b,v]=t.useState(null),w=t.useRef(null),j=new Map(e.map(e=>[String(e.key),e])),N=r.filter(e=>j.has(e)).map(e=>j.get(e)),_=()=>{w.current=null,g(null),v(null)};N.some(e=>s(String(e.key)));const C=N.every(e=>!s(String(e.key)));return a.jsxs(Ss,{children:[a.jsx(Ts,{asChild:!0,children:a.jsx(Jt,{variant:"outline",size:"icon",className:"h-8 w-8",children:a.jsx(d.Columns3,{size:16})})}),a.jsxs(Ds,{className:"w-[260px] p-0",align:"end",children:[a.jsx("div",{className:"px-3 py-2 border-b",children:a.jsx("span",{className:"text-sm font-medium",children:"Colunas"})}),a.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:a.jsx(js,{delayDuration:300,children:N.map((e,t)=>{const r=String(e.key),o=s(r),h=!1!==e.hideable,y=!0===e.groupable,j=u.includes(r)||l===r;return a.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,g(e)})(t),onDragOver:e=>((e,a)=>{e.preventDefault(),v(a)})(e,t),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&i(w.current,e),w.current=null,g(null),v(null)})(t),onDragEnd:_,className:Yt("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===t&&"opacity-50",b===t&&"border-t-2 border-primary"),children:[a.jsx(d.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),a.jsx(Zr,{checked:!o,onCheckedChange:()=>h&&n(r),disabled:!h,className:"shrink-0"}),a.jsx("span",{className:Yt("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:Yt("h-6 w-6 shrink-0",j&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),j?p?p(r):c?.(null):m?m(r):c?.(r)},children:a.jsx(d.Group,{size:14})})}),a.jsx(Cs,{children:x(j?"remove_grouping":"group_by_column")})]})]},r)})})}),a.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[a.jsx(Jt,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&a.jsx(Jt,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:"Redefinir padrão"})]})]})]})}function To({columns:e,groupByColumns:r,addGroupByColumn:s,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=t.useState(!1),[c,u]=t.useState(null),[m,p]=t.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=r.length>0;return a.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const a=e.dataTransfer.getData("application/column-key");if(a&&!r.includes(a)){const e=h.get(a);e&&e.groupable&&s(a)}},className:Yt("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[a.jsx(d.Group,{size:14,className:"shrink-0 text-muted-foreground"}),a.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?r.map((e,r)=>{const s=h.get(e);if(!s)return null;const i=c===r,l=m===r&&c!==r;return a.jsxs(t.Fragment,{children:[r>0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),a.jsxs(ts,{variant:"secondary",className:Yt("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,a)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(a)),e.dataTransfer.effectAllowed="move",u(a)})(e,r),onDragOver:e=>((e,a)=>{e.preventDefault(),e.stopPropagation(),p(a)})(e,r),onDrop:e=>((e,a)=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer.getData("application/group-chip-index");if(""!==t){const e=parseInt(t,10);isNaN(e)||e===a||o(e,a)}u(null),p(null)})(e,r),onDragEnd:x,children:[s.header,a.jsx("button",{onClick:a=>{a.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:a.jsx(d.X,{size:12})})]})]},e)}):a.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const Do=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:b,showActionBar:v=!0,showSearch:w=!1,searchValue:j,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:T,onViewModeChange:D,showViewToggle:P=!1,enableColumnResize:A=!0,resizeStorageKey:E,enableColumnManager:M=!0,columnManagerStorageKey:I,defaultHiddenColumns:F,enableGrouping:R=!1,enableExpandableRows:L=!1,renderExpandedContent:z,expandedRowIds:O,onToggleExpand:U,defaultExpandAll:V=!1,hideActionsColumn:B=!1})=>{const{t:q}=y.useTranslation(),{setSearchVisible:$}=En(),W=Fn(),[H,G]=t.useState(()=>V&&L?new Set(r.entities.map(e=>e.id)):new Set),K=void 0!==O,Y=K?new Set(O):H,Q=t.useCallback(e=>{K&&U?U(e):G(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[K,U]),X=void 0!==b?!b:v;t.useEffect(()=>{if(!w)return $(!0),()=>$(!1)},[$,w]);const J=Co({columns:s,storageKey:I,enabled:M,defaultHiddenColumns:F}),Z=ko({enabled:M,onReorder:J.reorderColumns}),ee=M?J.visibleColumns:s,{columnWidths:ae,isDragging:te,activeColumn:re,handleMouseDown:se}=fo({columns:ee.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:E?`${E}-columns`:void 0,enabled:A}),ne=t.useMemo(()=>(()=>{if(A){const e=ee.map(e=>ae[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return ee.map((t,r)=>({...t,calculatedWidth:e[r],style:{width:e[r]/a*100+"%"}}))}let e=0;const a=ee.map(a=>{if(a.width)return e+=a.width,{...a,calculatedWidth:a.width,isFixed:!0};{const t=a.minWidth||120,r=a.weight||1;return e+=t,{...a,calculatedWidth:t,weight:r,isFixed:!1}}});return e+=50,a.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[ee,A,ae]),oe=h||g.length>0||w||m||S||P||M,ie=X&&oe,le=k||(()=>{r.bulkDelete?.(r.selectedIds)}),de=e=>a.jsx(Bn,{className:"text-center",children:c?c(e):"inline"===p?a.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a.jsx(ho,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):a.jsx(po,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),ce=e=>a.jsx(so,{className:"w-[160px]",children:a.jsx(mo,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),ue=M?a.jsx(So,{columns:s,columnOrder:J.columnOrder,isColumnHidden:J.isColumnHidden,toggleColumn:J.toggleColumn,showAllColumns:J.showAllColumns,resetColumns:J.resetColumns,reorderColumns:J.reorderColumns,groupByColumn:R?J.groupByColumn:void 0,setGroupByColumn:R?J.setGroupByColumn:void 0,groupByColumns:R?J.groupByColumns:void 0,addGroupByColumn:R?J.addGroupByColumn:void 0,removeGroupByColumn:R?J.removeGroupByColumn:void 0}):void 0;if(W)return r.isLoading?a.jsx(Wn,{count:3}):0===r.entities.length?a.jsx(Gn,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):a.jsxs("div",{className:"flex flex-col h-full",children:[ie&&a.jsx(jo,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:T,onViewModeChange:D,showViewToggle:P}),a.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>a.jsxs(Qn,{children:[a.jsx(Xn,{asChild:!0,children:a.jsx(rr,{className:Yt("overflow-hidden cursor-pointer hover:bg-muted/50",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:a.jsx(ir,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[m&&a.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a.jsx(No,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),a.jsxs("div",{className:"flex-1",children:[ee.map(t=>a.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key))),(n||o||c)&&a.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):a.jsx(po,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})})}),ce(e)]},e.id))})]});const me=R&&J.groupByColumns.length>0?J.getGroupedData(r.entities):null,pe=null!==me,he=(L?1:0)+(m?1:0)+ee.length+(B?0:1),xe=e=>{const s=L&&Y.has(e.id);return a.jsxs(t.Fragment,{children:[a.jsxs(Qn,{children:[a.jsx(Xn,{asChild:!0,children:a.jsxs(Un,{className:Yt("cursor-pointer hover:bg-muted/50 relative",("inline"===p||B)&&"group",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:[L&&a.jsx(Bn,{className:"w-[40px] px-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),Q(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":q(s?"collapse_row":"expand_row"),children:s?a.jsx(d.ChevronDown,{size:16,className:"text-muted-foreground"}):a.jsx(d.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&a.jsx(Bn,{onClick:e=>e.stopPropagation(),children:a.jsx(No,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),ee.map(t=>a.jsx(Bn,{className:t.className,children:a.jsx(Kn,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!B&&de(e)]})}),ce(e)]}),s&&z&&a.jsx(Un,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(Bn,{colSpan:he,className:"p-0",children:a.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},fe=(e,r)=>{const{t:s}=y.useTranslation();return e.map(e=>{const s=J.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return a.jsxs(t.Fragment,{children:[a.jsx(Un,{className:Yt("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>J.toggleGroupCollapse(e.groupKey),children:a.jsx(Bn,{colSpan:r,className:"py-2 px-4",children:a.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[s?a.jsx(d.ChevronRight,{size:16}):a.jsx(d.ChevronDown,{size:16}),a.jsx("span",{children:e.groupValue}),a.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!s&&(e.children?fe(e.children,r):e.items.map(xe))]},e.groupKey)})};return a.jsxs("div",{className:"flex flex-col h-full",children:[ie&&a.jsx(jo,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:le,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:T,onViewModeChange:D,showViewToggle:P}),r.isLoading?a.jsx($n,{rows:5,columns:ee.length}):a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[R&&a.jsx(To,{columns:s,groupByColumns:J.groupByColumns,addGroupByColumn:J.addGroupByColumn,removeGroupByColumn:J.removeGroupByColumn,reorderGroupByColumns:J.reorderGroupByColumns}),a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs(Rn,{className:"table-fixed w-full",children:[a.jsxs("colgroup",{children:[L&&a.jsx("col",{style:{width:"40px"}}),m&&a.jsx("col",{style:{width:"50px"}}),ne.map((e,t)=>a.jsx("col",{style:e.style},t)),!B&&a.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),a.jsx(Ln,{children:a.jsxs(Un,{children:[L&&a.jsx(Vn,{className:"w-[40px]"}),m&&a.jsx(Vn,{className:"w-[50px]",children:a.jsx(No,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),ee.map((e,t)=>{const s=A&&!1!==e.resizable,n=re===String(e.key),o=M?Z.getDragProps(t,String(e.key)):{},i=Z.dragFromIndex===t,l=Z.dragOverIndex===t&&Z.dragFromIndex!==t;return a.jsxs(Vn,{className:Yt(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",M&&Z.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...o,children:[a.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(c=String(e.key),r.sortField!==c?null:"asc"===r.sortDirection?a.jsx(d.ArrowUp,{size:14,className:"ml-1"}):a.jsx(d.ArrowDown,{size:14,className:"ml-1"}))]}),s&&a.jsx(Yn,{direction:"horizontal",onMouseDown:a=>se(String(e.key),a),isDragging:n})]},String(e.key));var c}),!B&&a.jsx(Vn,{className:"w-[50px] text-center",children:ue||e.t("actions")})]})}),a.jsx(zn,{children:0===r.entities.length?a.jsx(Un,{children:a.jsx(Bn,{colSpan:he,className:"h-32",children:a.jsx(Gn,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):pe?fe(me,he):r.entities.map(xe)})]})})]})]})};function Po(e,a,r,s){const[n,o]=t.useState({}),[i,l]=t.useState({}),d=t.useMemo(()=>e,[e]),c=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,a)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(a)}catch(t){return u(e)}},p=(e,a,t)=>{if(e.required&&(""===a||null==a||Array.isArray(a)&&0===a.length))return`${e.label} é obrigatório`;if(e.validation){let s;if("function"==typeof e.validation?s=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(s=e.validation.custom),s)try{const e=s(a,t);if(e)return e}catch(r){}}};t.useEffect(()=>{if(!s)return;const e=a=>{const t=[];return a.forEach(a=>{t.push(a),a.fields&&t.push(...e(a.fields))}),t},t=e(d),n={};t.forEach(e=>{let t;if(a&&void 0!==a[e.name]){if(t=a[e.name],null==t&&(t=""),"date"===e.type&&t)if("string"==typeof t){const e=new Date(t);c(e)&&(t=e.toISOString().split("T")[0])}else c(t)&&(t=t.toISOString().split("T")[0])}else t=u(e);n[e.name]=t}),t.forEach(e=>{const a=m(e,n);void 0!==a&&(n[e.name]=a)}),a&&Object.keys(a).forEach(e=>{t.find(a=>a.name===e)||void 0===a[e]||(n[e]=a[e])}),o(n),l({}),r&&r(n)},[d,a,r,s]);const h=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...h(e.fields))}),a},x=()=>{const e=h(d),a={};return e.forEach(e=>{const t=p(e,n[e.name],n);t&&(a[e.name]=t)}),l(a),0===Object.keys(a).length};return{formData:n,errors:i,updateField:(e,a)=>{o(t=>{const s={...t,[e]:a},n=((e,a)=>{let t={...a};const r=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...r(e.fields))}),a};return r(d).filter(a=>a.dependsOn===e).forEach(e=>{const a=m(e,t);void 0!==a&&(t={...t,[e.name]:a})}),t})(e,s);return r&&r(n),n}),i[e]&&l(a=>{const t={...a};return delete t[e],t});const t=h(d).find(a=>a.name===e);if(t){const r=p(t,a,n);r&&l(a=>({...a,[e]:r}))}},validateForm:x,handleSubmit:e=>a=>{a&&(a.preventDefault(),a.stopPropagation()),x()&&e(n)}}}const Ao=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],Eo=[10,22,35,45,55,68,78,87,94].flatMap(e=>Ao.map(({hue:a,saturation:t})=>((e,a,t)=>{t/=100;const r=a=>(a+e/30)%12,s=(a/=100)*Math.min(t,1-t),n=e=>{const a=t-s*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return Math.round(255*a).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(a,t,e))),Mo=({value:e="#3b82f6",onChange:r,label:s,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),c=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=t.useState(!1),h=t.useRef([]),x=Ao.length,f=t.useMemo(()=>{const a=Eo.findIndex(a=>a.toLowerCase()===e.toLowerCase());return a>=0?a:0},[e]),[g,b]=t.useState(f);t.useEffect(()=>{m&&(b(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const v=e=>{const a=Math.max(0,Math.min(Eo.length-1,e));b(a),h.current[a]?.focus()},w=e=>{r?.(e),p(!1)};return a.jsxs("div",{className:"space-y-2",children:[s&&a.jsx(tr,{children:s}),a.jsxs(Ss,{open:m,onOpenChange:p,children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[a.jsxs("span",{className:"flex items-center min-w-0",children:[a.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&a.jsx("span",{className:"truncate",children:e})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),a.jsx(Ds,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(tr,{children:u}),a.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${Ao.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),v(g+1);break;case"ArrowLeft":e.preventDefault(),v(g-1);break;case"ArrowDown":e.preventDefault(),v(g+x);break;case"ArrowUp":e.preventDefault(),v(g-x);break;case"Home":e.preventDefault(),v(0);break;case"End":e.preventDefault(),v(Eo.length-1);break;case"Enter":e.preventDefault(),w(Eo[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:Eo.map((t,r)=>{const s=t.toLowerCase()===e.toLowerCase();return a.jsx("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(s?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:t},onClick:()=>w(t),"aria-label":`Selecionar cor ${t}`},`${t}-${r}`)})})]}),a.jsxs("div",{children:[a.jsx(tr,{htmlFor:"color-input",children:c}),a.jsx(er,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Io=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(pe.Root,{ref:s,className:Yt("relative overflow-hidden",e),...r,children:[a.jsx(pe.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Fo,{}),a.jsx(pe.Corner,{})]}));Io.displayName=pe.Root.displayName;const Fo=Z.forwardRef(({className:e,orientation:t="vertical",...r},s)=>a.jsx(pe.ScrollAreaScrollbar,{ref:s,orientation:t,className:Yt("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(pe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Fo.displayName=pe.ScrollAreaScrollbar.displayName;const Ro=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function Lo({name:e,filled:t,className:r}){return a.jsx("span",{className:`material-symbols-outlined ${r??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const zo=({value:e=null,onChange:r,label:s,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=t.useState(!1),c=t.useRef([]),u=e?(m=e,Ro.find(e=>e.name===m)):null;var m;const p=t.useMemo(()=>{if(!e)return 0;const a=Ro.findIndex(a=>a.name===e);return a>=0?a:0},[e]),[h,x]=t.useState(p);t.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{c.current[p]?.focus()}))},[i,p]);const f=t.useCallback(e=>{const a=Math.max(0,Math.min(Ro.length-1,e));x(a),c.current[a]?.focus()},[]),g=t.useCallback(e=>{r?.(e),l(!1)},[r]),b=t.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),v=t.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Ro.length-1);break;case"Enter":e.preventDefault(),g(Ro[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return a.jsxs("div",{className:"space-y-2",children:[s&&a.jsx(tr,{children:s}),a.jsxs(Ss,{open:i,onOpenChange:l,children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:b,children:[u?a.jsx(Lo,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):a.jsx("span",{className:"text-muted-foreground text-sm",children:n}),a.jsx(d.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),a.jsx(Ds,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{c.current[p]?.focus()})},children:a.jsxs("div",{className:"space-y-3",children:[a.jsx(Io,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:v,role:"grid",children:Ro.map((t,r)=>a.jsx("button",{ref:e=>{c.current[r]=e},type:"button",tabIndex:r===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===t.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(t.name),title:t.name,children:a.jsx(Lo,{name:t.name,filled:t.filled,className:"text-2xl"})},t.name))})}),a.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Oo=Z.forwardRef(({className:e,...t},r)=>a.jsx(he.Root,{className:Yt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(he.Thumb,{className:Yt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Oo.displayName=he.Root.displayName;const Uo=(e={})=>{const{user:a,alias:t}=En(),{enabled:r=!0,status:s="active"}=e;return j.useQuery({queryKey:["qualiex-users",t,s],queryFn:()=>xn.getUsers(t,s),enabled:r&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},Vo=({value:r,onChange:s,multiple:n=!1,label:o,required:i,placeholder:l,icon:d,maxDisplayedBadges:c,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:b,onOpen:v,onClose:w})=>{const{t:j}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Uo({enabled:p}),[k,S]=t.useState(new Map),T=t.useMemo(()=>r?Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean):[],[r]),D=t.useMemo(()=>{if(0===T.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return T.filter(a=>a&&!e.has(a)&&!k.has(a)).sort().join(",")},[T,N,k]);t.useEffect(()=>{if(!D)return;const e=D.split(",");let a=!1;const t=rn.extractTokenData();return t?.alias&&t?.companyId?(xn.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||S(a=>{const r=new Map(a);for(const s of e){const e=t.find(e=>e.userId===s||e.id===s);e&&r.set(s,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{a=!0}):void 0},[D]);const P=t.useMemo(()=>f?N.filter(f):N,[N,f]),A=t.useMemo(()=>{if(0===T.length)return P;const a=new Set(P.map(e=>e.userId||e.id||"")),t=T.filter(e=>e&&!a.has(e));if(0===t.length)return P;const r=t.map(a=>{const t=k.get(a);return t||{userId:a,id:a,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...P,...r]},[P,T,k]),E=t.useCallback(a=>{let t;if("custom"===h&&x)t=x(a);else{const e=a.userName||"";switch(h){case"name-email":t=a.userEmail?`${e} (${a.userEmail})`:e;break;case"name-role":t=a.roleName?`${e} - ${a.roleName}`:e;break;default:t=e}}return!1===a.isActive?`${t} (${e.t("inactive")})`:t},[h,x]);return a.jsx(Vs,{multiple:n,value:r??(n?[]:""),onChange:s,options:A,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:E,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:j("no_results"),label:o,required:i,icon:d,maxDisplayedBadges:c,disabled:m,className:u,sortOptions:g,popoverContainer:b,onOpen:v,onClose:w})};function Bo({title:e,sections:r,initialData:s,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:d=!1,usersData:c}){const[u,m]=t.useState(r?.[0]?.id||""),p=t.useRef(null),[h,x]=t.useState(null),f=t.useCallback(e=>{p.current=e,x(e)},[]),g=t.useMemo(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:b,errors:v,updateField:y,handleSubmit:w}=Po(g,s,void 0,i),j=t.useMemo(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(b):e.disabled||!1})):[],[r,b]),N=t.useMemo(()=>{const e=j.find(e=>e.id===u);if(e&&!e.disabled)return u;const a=j.find(e=>!e.disabled);return a?.id||u},[j,u]);t.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=j.find(e=>e.id===N),C=e=>{const t=(e.computedValue,b[e.name]),r=void 0!==t?t:"",s=v[e.name];switch(e.type){case"group":const t="horizontal"===e.layout,n=t?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=t?Yt("space-y-2 w-full",e.wrapperClassName):Yt("space-y-2",e.className,e.wrapperClassName);return a.jsxs("div",{className:o,children:[e.label,a.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Vo,{value:r||"",onChange:a=>y(e.name,a),placeholder:e.placeholder,disabled:e.disabled,className:s?"border-destructive":""}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"textarea":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(es,{id:e.name,value:r||"",onChange:a=>{y(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"select":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsxs(qr,{value:String(r),onValueChange:a=>{y(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a.jsx(Hr,{className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a.jsx(Wr,{placeholder:e.placeholder})}),a.jsx(Yr,{children:e.options?.map(e=>a.jsx(Xr,{value:e.value,children:e.label},e.value))})]}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"multiselect":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Vs,{options:e.options||[],value:Array.isArray(r)?r:[],onChange:a=>y(e.name,a),placeholder:e.placeholder,disabled:e.disabled,error:s,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"date":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(er,{id:e.name,type:"date",value:String(r),onChange:a=>y(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Yt("w-full",s?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"color":return a.jsxs("div",{children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(er,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:a=>y(e.name,a.target.value),className:"h-10"}),s&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"color-picker":return a.jsxs("div",{children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Mo,{value:r||e.defaultValue||"#3b82f6",onChange:a=>y(e.name,a)}),s&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"icon-picker":return a.jsxs("div",{children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(zo,{value:r||e.defaultValue||null,onChange:a=>y(e.name,a)}),s&&a.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(b):e.componentProps||{};return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(i,{value:r,onChange:a=>{y(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,error:s,popoverContainer:h,...l}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"number":return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(er,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:a=>{const t=a.target.value,r=""===t?null:Number(t);y(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"checkbox":return a.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[a.jsx(Zr,{id:e.name,checked:!!r,onCheckedChange:a=>y(e.name,a),disabled:e.disabled}),a.jsxs(tr,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"switch":return a.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(Oo,{id:e.name,checked:!!r,onCheckedChange:a=>y(e.name,a),disabled:e.disabled}),s&&a.jsx("p",{className:"text-sm text-destructive mt-2",children:s})]},e.name);default:return a.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[a.jsxs(tr,{htmlFor:e.name,children:[e.label,e.required&&a.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.jsx(er,{id:e.name,type:"text",value:r||"",onChange:a=>{y(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),s&&a.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name)}},k=t.useCallback(()=>{if(!_)return null;if(_.disabled)return a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:a.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),a.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return a.jsx(e,{formData:b,updateField:y,errors:v,users:c,disabled:_.disabled})}return a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,b,y,v,c,C]),S=a.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[j.length>1&&a.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:a.jsx("div",{className:"flex space-x-2",children:j.map(e=>a.jsx(Jt,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const a=j.find(a=>a.id===e);a&&!a.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:d?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):a.jsxs("form",{onSubmit:w(n),className:"space-y-3 md:space-y-4",children:[k(),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[a.jsx(Jt,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),a.jsx(Jt,{type:"submit",disabled:d,children:l||"Salvar"})]})]})})]});return a.jsx(wr,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:a.jsxs(Sr,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[a.jsxs(Tr,{showSeparator:!0,children:[a.jsx(Ar,{children:e}),a.jsx(Er,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function qo({currentPage:e,totalPages:t,totalItems:r,itemsPerPage:s,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===r)return null;const c=(e-1)*s+1,u=Math.min(e*s,r);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),a.jsxs(qr,{value:String(s),onValueChange:e=>o(Number(e)),children:[a.jsx(Hr,{className:"h-8 w-[70px]",children:a.jsx(Wr,{})}),a.jsxs(Yr,{children:[a.jsx(Xr,{value:"10",children:"10"}),a.jsx(Xr,{value:"25",children:"25"}),a.jsx(Xr,{value:"50",children:"50"}),a.jsx(Xr,{value:"100",children:"100"})]})]})]})}),a.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[c,"-",u," ",l("of","de")," ",r," ",l("items","itens")]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jt,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronsLeft,{size:16})}),a.jsx(Jt,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronLeft,{size:16})}),a.jsxs("div",{className:"flex items-center gap-1 px-2",children:[a.jsx("span",{className:"text-sm font-medium",children:e}),a.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),a.jsx("span",{className:"text-sm font-medium",children:t})]}),a.jsx(Jt,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===t,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronRight,{size:16})}),a.jsx(Jt,{variant:"outline",size:"sm",onClick:()=>n(t),disabled:e===t,className:"h-8 w-8 p-0",children:a.jsx(d.ChevronsRight,{size:16})})]})]})}function $o({manager:e}){return a.jsx(qo,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const Wo={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Ho={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Go={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Ko({children:e,direction:t="column",gap:r="md",align:s="stretch",justify:n="start",wrap:o=!1,className:i}){return a.jsx("div",{className:Yt("flex","column"===t?"flex-col":"flex-row",Wo[r],Ho[s],Go[n],o&&"flex-wrap",i),children:e})}function Yo({manager:e,filters:t,inline:r=!1}){const{t:s}=y.useTranslation(),{isSearchVisible:n}=En(),o=e.searchTerm,i=a.jsxs(a.Fragment,{children:[t.some(e=>"search"===e.type)&&!n&&a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(er,{placeholder:"Pesquisar",value:e.searchTerm,onChange:a=>e.handleSearch(a.target.value),className:"pl-10"})]}),t.filter(e=>"select"===e.type&&e.options).map((e,t)=>a.jsxs(qr,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a.jsx(Hr,{className:"w-[180px]",children:a.jsx(Wr,{placeholder:e.placeholder})}),a.jsx(Yr,{children:e.options.map(e=>a.jsx(Xr,{value:e.value,children:e.label},e.value))})]},`select-${t}`)),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const s=e.component;return a.jsx("div",{className:r?"":"w-full sm:w-auto",children:a.jsx(s,{...e.props})},`custom-${t}`)}),o&&a.jsxs(Jt,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a.jsx(d.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return r?a.jsx("div",{className:"flex items-center gap-2",children:i}):a.jsx(Ko,{direction:"column",gap:"md",className:"mb-6",children:a.jsx(Ko,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function Qo({manager:e,config:r,formSections:s,onSave:n,onToggleStatus:o,defaultSort:i}){e&&e.queryKey;const{setSearchVisible:l}=En(),[d,c]=N.useSearchParams(),[u,m]=t.useState(!1),[p,h]=t.useState(null),[x,f]=t.useState({isOpen:!1,entityId:null,entityName:""}),[g,b]=t.useState({isOpen:!1,count:0});t.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),t.useEffect(()=>{if(i&&e){const a=`${e.queryKey}_sortField`,t=`${e.queryKey}_sortDirection`;if(!d.has(a)&&!d.has(t)){const e=Object.fromEntries(d);e[a]=i.column,e[t]=i.direction,c(e)}}},[]);const v=s.length>0?e=>{r.onEdit?r.onEdit(e):(h(e),m(!0))}:void 0,y="function"==typeof e?.deleteEntity?e=>{f({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,w=()=>{f({isOpen:!1,entityId:null,entityName:""})},j=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,_=(r.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return a.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&a.jsx(jo,{onNew:()=>{r.onNew?r.onNew():(h(null),m(!0))},newButtonLabel:r.newButtonLabel,showNewButton:j,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{b({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:_,filters:r.filters&&r.filters.length>0?a.jsx(Yo,{manager:e,filters:r.filters,inline:!0}):void 0}),a.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?a.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):a.jsx(Do,{manager:e,columns:r.columns,onEdit:v,onDelete:y,onToggleStatus:o,enableBulkActions:r.enableBulkActions,customRowActions:r.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:r.defaultHiddenColumns})}),a.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:a.jsx($o,{manager:e})}),!r.useCustomRouting&&!r.onNew&&s.length>0&&a.jsx(Bo,{open:u,title:p?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:s,initialData:p||void 0,onSubmit:e=>{n(e),m(!1),h(null)},onCancel:()=>{m(!1),h(null)},isLoading:e.isLoading,submitButtonText:p?"Atualizar":"Criar"}),a.jsx(wr,{open:x.isOpen,onOpenChange:w,children:a.jsxs(Sr,{size:"sm",variant:"destructive",children:[a.jsx(Tr,{showSeparator:!0,children:a.jsx(Ar,{children:"Você tem certeza absoluta?"})}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a.jsx("strong",{children:x.entityName}),". Esta ação não pode ser desfeita."]})}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"outline",onClick:w,children:"Cancelar"}),a.jsx(Jt,{variant:"destructive",onClick:()=>{x.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(x.entityId),f({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),a.jsx(wr,{open:g.isOpen,onOpenChange:()=>b({isOpen:!1,count:0}),children:a.jsxs(Sr,{size:"sm",variant:"destructive",children:[a.jsx(Tr,{showSeparator:!0,children:a.jsx(Ar,{children:"Você tem certeza absoluta?"})}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a.jsx("strong",{children:g.count})," ",1===g.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"outline",onClick:()=>b({isOpen:!1,count:0}),children:"Cancelar"}),a.jsx(Jt,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),b({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Xo(e,a){const t=e.toLowerCase();return t.includes("email")?{type:"email",required:!0}:t.includes("phone")||t.includes("tel")?{type:"tel"}:t.includes("description")||t.includes("content")||t.includes("notes")?{type:"textarea"}:t.includes("status")||t.includes("type")||t.includes("category")?{type:"select",options:[]}:"boolean"==typeof a?{type:"boolean"}:"number"==typeof a?{type:"number"}:a instanceof Date?{type:"date"}:{type:"text"}}function Jo(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function Zo(e={}){const{paramName:a="alias"}=e,r=N.useParams(),{alias:s,companies:n}=En(),o=r[a]||null;return t.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,a=!!e;return{urlAlias:o,isAliasMismatch:a&&o!==s,isValidAlias:a,isMissing:!1,matchedCompany:e}},[o,s,n])}const ei=s.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),ai={info:d.Info,warning:d.Info,danger:d.AlertTriangle,success:d.CheckCircle},ti=Z.forwardRef(({className:e,variant:t="info",showIcon:r=!0,children:s,...n},o)=>{const i=ai[t||"info"];return a.jsxs("div",{ref:o,role:"alert",className:Yt(ei({variant:t}),e),...n,children:[r&&a.jsx(i,{className:"h-4 w-4"}),s]})});ti.displayName="Alert";const ri=Z.forwardRef(({className:e,...t},r)=>a.jsx("h5",{ref:r,className:Yt("mb-1 font-medium leading-none tracking-tight",e),...t}));ri.displayName="AlertTitle";const si=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("text-sm [&_p]:leading-relaxed",e),...t}));si.displayName="AlertDescription";const ni=t.createContext(void 0);function oi({children:e,actions:r}){const{t:s}=y.useTranslation(),[n,o]=t.useState({}),[i,l]=t.useState(r);t.useEffect(()=>{l(r)},[r]);const d=t.useCallback(()=>o({}),[]),c=t.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:d,headerActions:i,setHeaderActions:l}),[n,d,i]);return a.jsx(ni.Provider,{value:c,children:e})}function ii(){const e=t.useContext(ni);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var li={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",change_photo:"Trocar foto",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nome",electronic_signature:"Assinatura Eletrônica",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Imediato",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_team:"Remover da equipe",leadership_select_subordinates:"Selecione pelo menos um liderado",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",updates:"Atualizações",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},di={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",change_photo:"Change photo",cannot_be_own_leader:"A leader cannot be their own superior",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_profile:"Edit Profile",edit_name:"Edit Name",electronic_signature:"Electronic Signature",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_immediate_superior:"Immediate Superior",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_team:"Remove from team",leadership_select_subordinates:"Select at least one subordinate",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",updates:"Updates",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},ci={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",change_photo:"Cambiar foto",cannot_be_own_leader:"Un líder no puede ser su propio superior",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_profile:"Editar Perfil",edit_name:"Editar Nombre",electronic_signature:"Firma Electrónica",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_immediate_superior:"Superior Inmediato",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_team:"Quitar del equipo",leadership_select_subordinates:"Seleccione al menos un subordinado",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",updates:"Actualizaciones",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const ui="true"===(void 0).VITE_I18N_DEBUG_MODE;function mi(a,t){e.addResourceBundle(a,"app",t,!0,!0)}ui&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:li},"en-US":{core:di},"es-ES":{core:ci}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:ui?["debugKeys"]:[]});const pi=t.createContext(void 0),hi={locale:Mt,timezone:Ft,datetimeFormat:It},xi=async()=>{},fi=({children:e})=>a.jsx(pi.Provider,{value:{...hi,setLocale:xi,setTimezone:xi,setDatetimeFormat:xi,isLoading:!1},children:e}),gi=()=>{const e=t.useContext(pi);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},bi=t.createContext({moduleAlias:null});function vi({moduleAlias:e=null,children:t}){return a.jsx(bi.Provider,{value:{moduleAlias:e},children:t})}function yi(){return t.useContext(bi)}const wi=xe.Root,ji=xe.CollapsibleTrigger,Ni=xe.CollapsibleContent;class _i extends t.Component{constructor(a){super(a),this.copyErrorDetails=()=>{const a=sn.getErrors().slice(0,2),t=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${a.map((e,a)=>`${a+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(t),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})},this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,a){if((void 0).DEV)throw e;sn.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t=sn.getErrors().slice(0,2);return a.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:a.jsxs(rr,{className:"w-full max-w-2xl",children:[a.jsxs(sr,{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),a.jsx(nr,{children:e.t("something_went_wrong")})]}),a.jsxs(ir,{className:"space-y-4",children:[a.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),a.jsxs(wi,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[a.jsx(d.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),a.jsxs(Ni,{className:"mt-4 space-y-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),a.jsxs("div",{className:"text-sm space-y-2",children:[a.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&a.jsx(Io,{className:"h-32 w-full rounded border bg-muted p-2",children:a.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),t.length>0&&a.jsxs("div",{className:"pt-3 border-t",children:[a.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),a.jsx("div",{className:"space-y-2",children:t.map((e,t)=>a.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[t+1,"."]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),a.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),a.jsxs(Jt,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a.jsx(d.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a.jsx(Jt,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const Ci=fe.Root,ki=Z.forwardRef(({className:e,...t},r)=>a.jsx(fe.List,{ref:r,className:Yt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));ki.displayName=fe.List.displayName;const Si=Z.forwardRef(({className:e,...t},r)=>a.jsx(fe.Trigger,{ref:r,className:Yt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Si.displayName=fe.Trigger.displayName;const Ti=Z.forwardRef(({className:e,...t},r)=>a.jsx(fe.Content,{ref:r,className:Yt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function Di({className:e}){return a.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),a.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),a.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function Pi({className:e}){return a.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),a.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),a.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}Ti.displayName=fe.Content.displayName;const Ai={init(e){!function(e){try{return a=window,t=document,r="clarity",s="script",n=e,void(t.getElementById("clarity-script")||(a[r]=a[r]||function(){(a[r].q=a[r].q||[]).push(arguments)},(o=t.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+n+"?ref=npm",o.id="clarity-script",(i=t.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var a,t,r,s,n,o,i}(e)},setTag(e,a){window.clarity("set",e,a)},identify(e,a,t,r){window.clarity("identify",e,a,t,r)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Ei="forlogic_";function Mi(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Ii(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Fi(e){return Ii()?`${Ei}${e}`:e}function Ri(e){return Ii()?`${Ei}${e}`:e}function Li(e){try{e()}catch(a){(void 0).DEV}}function zi(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&Ai.setTag(Ri(a),t)}function Oi({module:e,isContracted:a,sourceModule:t,alias:r}){Mi()&&Li(()=>{zi({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:r}),Ai.event(Fi("module_menu_click"))})}function Ui({module:e,sourceModule:a,alias:t}){Mi()&&Li(()=>{zi({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),Ai.event(Fi("module_interest_click"))})}function Vi({resource:e,sourceModule:a,alias:t}){Mi()&&Li(()=>{zi({footer_resource:e,source_module:a,alias:t}),Ai.event(Fi("module_footer_click"))})}function Bi({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:t="https://sabergestao.com.br/",wikiUrl:r,alias:s,sourceModule:n}){const{t:o}=y.useTranslation(),i=Kt(e||r||"https://educacao.sabergestao.com.br/{alias}/fe",s),l=e=>{Vi({resource:e,sourceModule:n,alias:s})};return a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(dr,{className:"mb-4"}),a.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[a.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),a.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(Di,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),a.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),a.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(Pi,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),a.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[a.jsxs("div",{className:"relative z-10",children:[a.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),a.jsxs("a",{href:r||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",a.jsx(d.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),a.jsx(d.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const qi=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]}];function $i({module:e,onClick:t}){return a.jsxs("button",{type:"button",onClick:t,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[a.jsx("div",{className:Yt("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&a.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function Wi(e,a){if(0===e.length)return e;const t=Math.ceil(e.length/a),r=[];for(let s=0;s<t;s++)for(let n=0;n<a;n++){const a=n*t+s;a<e.length&&r.push(e[a])}return r}function Hi({modules:e,onModuleClick:r,contractedModules:s,onModuleInterest:n}){const o=function(){const[e,a]=t.useState(4);return t.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?a(4):window.matchMedia("(min-width: 768px)").matches?a(3):window.matchMedia("(min-width: 640px)").matches?a(2):a(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,a)=>e.name.localeCompare(a.name)),l=void 0!==s,d=l?i.filter(e=>s.includes(e.name)):i,c=l?i.filter(e=>!s.includes(e.name)):[],u=Wi(d,o),m=Wi(c,o),p=(e,a)=>{a?r?.(e):n?.(e)};return a.jsxs("div",{className:"space-y-6",children:[u.length>0&&a.jsx("section",{children:a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:u.map(e=>a.jsx($i,{module:e,onClick:()=>p(e,!0)},e.name))})}),m.length>0&&a.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[a.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>a.jsx($i,{module:e,onClick:()=>p(e,!1)},e.name))})]})]})}function Gi({onModuleClick:e,contractedModules:r,onModuleInterest:s,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:d,sourceModule:c}){const[u,m]=t.useState("qualiex"),p=e=>{Ui({module:e,sourceModule:c,alias:d}),window.open(n,"_blank","noopener,noreferrer"),s?.(e)};return a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs(Ci,{value:u,onValueChange:m,className:"flex-1 flex flex-col min-h-0",children:[a.jsx(ki,{className:"w-fit shrink-0",children:qi.map(e=>a.jsxs(Si,{value:e.id,children:[e.label,a.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),qi.map(t=>a.jsx(Ti,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a.jsx(Hi,{modules:t.modules,onModuleClick:a=>{return s=a,n=t.id,Oi({module:s,isContracted:"qualiex"!==n||!r||r.includes(s.name),sourceModule:c,alias:d}),void e?.(s);var s,n},contractedModules:"qualiex"===t.id?r:void 0,onModuleInterest:p})},t.id))]}),a.jsx(Bi,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:d,sourceModule:c})]})}const Ki={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},Yi=6e5;function Qi(e){const{moduleAlias:a}=yi(),{alias:r,user:s,isAuthenticated:n}=En(),o=e??a,i=s?.id??null,l=n&&!!r&&!!i,{data:d=[],isLoading:c}=j.useQuery({queryKey:["qualiex-associations",i,r],queryFn:()=>xn.fetchUserAssociations(i,r),enabled:l,staleTime:Yi,gcTime:12e5}),u=t.useMemo(()=>r&&0!==d.length?d.find(e=>e.companyAlias===r)??null:null,[d,r]),m=t.useCallback(e=>{if(!u)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=Ki[e];return void 0!==a&&u.softwares.includes(a)})},[u]);return{hasAccess:t.useMemo(()=>!o||m(o),[o,m]),isLoading:l&&c,role:t.useMemo(()=>u?{id:u.roleId,name:u.roleName}:null,[u]),association:u,hasAccessTo:m}}function Xi(e){const{association:a}=Qi();return t.useMemo(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,r=qi.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=Ki[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function Ji({open:e,onOpenChange:t,onModuleClick:r,contractedModules:s,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:d}){const{alias:c}=En(),u=Xi(s);return a.jsx(wr,{open:e,onOpenChange:t,children:a.jsxs(Sr,{size:"lg",className:"overflow-hidden flex flex-col",children:[a.jsx(Tr,{className:"sr-only",children:a.jsx(Ar,{children:"Módulos"})}),a.jsx(Gi,{onModuleClick:e=>{r?r(e):e.url&&Gt(Kt(e.url,c||void 0))},contractedModules:u,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c||void 0,sourceModule:d})]})})}function Zi({open:r,onOpenChange:s,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:c,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:b=!0,size:v="lg",children:w,sourceModule:j}){const{t:N}=y.useTranslation(),_=t.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(a=>e.set(a.alias,a));const a=Array.from(e.values()),t=a.find(e=>e.alias===m),r=a.filter(e=>e.alias!==m).sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"}));return t?[t,...r]:r},[u,m]);return a.jsx(wr,{open:r,onOpenChange:b?void 0:s,children:a.jsxs(Sr,{size:v,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:b?e=>e.preventDefault():void 0,onEscapeKeyDown:b?e=>e.preventDefault():void 0,children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[a.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[a.jsx(Ar,{children:N("no_access_page")}),a.jsx(Er,{children:"Selecione um módulo para continuar navegando!"})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a.jsx(d.Building2,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"truncate text-xs",children:c||"Unidade"}),a.jsx(d.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),a.jsx(xs,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>a.jsxs(fs,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a.jsx(d.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),a.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&a.jsx(ts,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsxs(Jt,{variant:"ghost",size:"sm",className:"gap-2",children:[a.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:a.jsx(d.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a.jsx(d.ChevronDown,{className:"h-3 w-3"})]})}),a.jsxs(xs,{align:"end",children:[a.jsxs("div",{className:"px-2 py-1.5",children:[a.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:c})]}),a.jsx(ys,{}),a.jsxs(fs,{onClick:h,children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),w?a.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[a.jsx("div",{className:"flex-1",children:w}),a.jsx(Bi,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]}):a.jsx(Gi,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]})})}function el(e,a){const{t:t}=y.useTranslation();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function al({children:e,contractedModules:r,onModuleClick:s,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:d,accessDeniedRoutes:c,sourceModule:u}){const{t:m}=y.useTranslation(),{hasAccess:p,isLoading:h,association:x}=Qi(),{user:f,alias:g,companies:b,isAuthenticated:v,isLoading:w,logout:j,switchUnit:N}=En(),_=Xi(r),C=t.useMemo(()=>b?.length?g&&b.find(e=>e.alias===g)||b[0]:null,[b,g]),k=t.useMemo(()=>b?.length?b.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[b]),S=t.useCallback(e=>{const a=b?.find(a=>a.alias===e.alias);if(!a)return;const{pathname:t,search:r,hash:s}=window.location;if(g){const e=t.split("/"),n=e.indexOf(g);if(n>=0)return e[n]=a.alias,void(window.location.href=e.join("/")+r+s)}N(a)},[g,N,b]),T=t.useCallback(e=>{s?s(e):e.url&&Gt(Kt(e.url,g||void 0))},[s,g]),D=t.useMemo(()=>{if(!c)return;const e=window.location.pathname,a=Object.keys(c).find(a=>el(e,[a]));return a?c[a]:void 0},[c]);return w||!v||d?.length&&el(window.location.pathname,d)?a.jsx(a.Fragment,{children:e}):h?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx(ss,{size:"lg"})}):p?a.jsx(a.Fragment,{children:e}):a.jsx(Zi,{open:!0,onModuleClick:T,contractedModules:_,onModuleInterest:n,userName:f?.name,unitName:C?.name,units:k,currentAlias:g||void 0,onUnitChange:S,onLogout:j,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:u,blocking:!0,children:D})}let tl=!1;function rl(){if(tl||"undefined"==typeof document)return;tl=!0;for(const a of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${a}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=a,a.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const a of e)if(!document.querySelector(`link[href="${a}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=a,document.head.appendChild(e)}}function sl({projectId:e,mode:a="auto"}){const{user:r,alias:s,isAuthenticated:n}=En();t.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!Oe()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Ai.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(t){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,a]),t.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==a&&n&&r&&"function"==typeof window.clarity)try{const e=r.email||r.identifier||"anonymous";Ai.identify(e,void 0,"modules-menu",r.name||void 0),s&&Ai.setTag("alias",s),"boolean"==typeof r.isSysAdmin&&Ai.setTag("isSysAdmin",String(r.isSysAdmin))}catch(e){(void 0).DEV}},[r,s,n,a])}function nl({projectId:e,mode:a}){return sl({projectId:e,mode:a}),null}function ol(){if(!Ie())return null;const e=nn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),t=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||t||!(void 0).DEV)return null;const r={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return a.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[a.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",a.jsx("code",{style:r,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",a.jsx("code",{style:r,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const il=ge.Root,ll=Z.forwardRef(({className:e,...t},r)=>a.jsx(ge.Item,{ref:r,className:Yt("border-b",e),...t}));ll.displayName="AccordionItem";const dl=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsx(ge.Header,{className:"flex",children:a.jsxs(ge.Trigger,{ref:s,className:Yt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,a.jsx(d.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dl.displayName=ge.Trigger.displayName;const cl=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsx(ge.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:Yt("pb-4 pt-0",e),children:t})}));cl.displayName=ge.Content.displayName;const ul=Z.forwardRef(({className:e,...t},r)=>a.jsx(be.Root,{ref:r,className:Yt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ul.displayName=be.Root.displayName;const ml=Z.forwardRef(({className:e,...t},r)=>a.jsx(be.Image,{ref:r,className:Yt("aspect-square h-full w-full",e),...t}));ml.displayName=be.Image.displayName;const pl=Z.forwardRef(({className:e,...t},r)=>a.jsx(be.Fallback,{ref:r,className:Yt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));pl.displayName=be.Fallback.displayName;const hl=Z.forwardRef(({...e},t)=>a.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));hl.displayName="Breadcrumb";const xl=Z.forwardRef(({className:e,...t},r)=>a.jsx("ol",{ref:r,className:Yt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));xl.displayName="BreadcrumbList";const fl=Z.forwardRef(({className:e,...t},r)=>a.jsx("li",{ref:r,className:Yt("inline-flex items-center gap-1.5",e),...t}));fl.displayName="BreadcrumbItem";const gl=Z.forwardRef(({asChild:e,className:t,...s},n)=>{const o=e?r.Slot:"a";return a.jsx(o,{ref:n,className:Yt("transition-colors hover:text-foreground",t),...s})});gl.displayName="BreadcrumbLink";const bl=Z.forwardRef(({className:e,...t},r)=>a.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Yt("font-normal text-foreground",e),...t}));bl.displayName="BreadcrumbPage";const vl=({children:e,className:t,...r})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Yt("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...r,children:e??a.jsx(d.ChevronRight,{})});vl.displayName="BreadcrumbSeparator";const yl=({className:e,...t})=>a.jsxs("span",{role:"presentation","aria-hidden":"true",className:Yt("flex h-9 w-9 items-center justify-center",e),...t,children:[a.jsx(d.MoreHorizontal,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Mais"})]});yl.displayName="BreadcrumbEllipsis";const wl=s.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),jl=Z.forwardRef(({className:e,orientation:t,...r},s)=>a.jsx("div",{ref:s,className:Yt(wl({orientation:t}),e),...r}));function Nl({className:e,classNames:t,showOutsideDays:r=!0,...s}){return a.jsx(M.DayPicker,{showOutsideDays:r,className:Yt("p-3 pointer-events-auto",e),locale:Dt,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:"flex h-9 w-full items-center justify-center px-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1",button_previous:Yt(Xt({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Yt(Xt({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:Yt(Xt({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...t},components:{Chevron:({orientation:e})=>"left"===e?a.jsx(d.ChevronLeft,{className:"h-4 w-4"}):a.jsx(d.ChevronRight,{className:"h-4 w-4"})},...s})}jl.displayName="ButtonGroup",Nl.displayName="Calendar";const _l={Root:function({children:e,className:t}){return a.jsx("div",{className:Yt("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return a.jsx(rr,{className:Yt("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:a.jsx(ir,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:r}){return a.jsxs("div",{className:Yt("flex justify-between items-center text-sm",r),children:[a.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),a.jsx("span",{className:"text-foreground",children:t})]})}};const Cl=({shouldScaleBackground:e=!0,...t})=>a.jsx(I.Drawer.Root,{shouldScaleBackground:e,...t});Cl.displayName="Drawer";const kl=I.Drawer.Trigger,Sl=I.Drawer.Portal,Tl=I.Drawer.Close,Dl=Z.forwardRef(({className:e,...t},r)=>a.jsx(I.Drawer.Overlay,{ref:r,className:Yt("fixed inset-0 z-50 bg-black/80",e),...t}));Dl.displayName=I.Drawer.Overlay.displayName;const Pl=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(Sl,{children:[a.jsx(Dl,{}),a.jsxs(I.Drawer.Content,{ref:s,className:Yt("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[a.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));Pl.displayName="DrawerContent";const Al=({className:e,...t})=>a.jsx("div",{className:Yt("grid gap-1.5 p-4 text-center sm:text-left",e),...t});Al.displayName="DrawerHeader";const El=({className:e,...t})=>a.jsx("div",{className:Yt("mt-auto flex flex-col gap-2 p-4",e),...t});El.displayName="DrawerFooter";const Ml=Z.forwardRef(({className:e,...t},r)=>a.jsx(I.Drawer.Title,{ref:r,className:Yt("text-lg font-semibold leading-none tracking-tight",e),...t}));Ml.displayName=I.Drawer.Title.displayName;const Il=Z.forwardRef(({className:e,...t},r)=>a.jsx(I.Drawer.Description,{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));Il.displayName=I.Drawer.Description.displayName;const Fl={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},Rl={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Ll=ve.Root,zl=ve.Trigger,Ol=Z.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},n)=>a.jsx(ve.Content,{ref:n,align:t,sideOffset:r,className:Yt("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));Ol.displayName=ve.Content.displayName;const Ul=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-slot":"input-group",className:Yt("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...t}));Ul.displayName="InputGroup";const Vl=s.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),Bl=Z.forwardRef(({className:e,align:t,...r},s)=>a.jsx("div",{ref:s,"data-slot":"input-group-addon",className:Yt(Vl({align:t}),e),...r}));Bl.displayName="InputGroupAddon";const ql=s.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),$l=Z.forwardRef(({className:e,size:t,variant:r="ghost",...s},n)=>a.jsx(Jt,{ref:n,"data-slot":"input-group-button",variant:r,className:Yt(ql({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...s}));$l.displayName="InputGroupButton";const Wl=Z.forwardRef(({className:e,...t},r)=>a.jsx(er,{ref:r,"data-slot":"input-group-control",className:Yt("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));Wl.displayName="InputGroupInput";const Hl=Z.forwardRef(({className:e,...t},r)=>a.jsx(es,{ref:r,"data-slot":"input-group-control",className:Yt("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));Hl.displayName="InputGroupTextarea";const Gl=Z.forwardRef(({className:e,...t},r)=>a.jsx("h1",{ref:r,className:Yt("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));Gl.displayName="H1";const Kl=Z.forwardRef(({className:e,...t},r)=>a.jsx("h2",{ref:r,className:Yt("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));Kl.displayName="H2";const Yl=Z.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:Yt("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));Yl.displayName="H3";const Ql=Z.forwardRef(({className:e,...t},r)=>a.jsx("h4",{ref:r,className:Yt("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));Ql.displayName="H4";const Xl=Z.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:Yt("leading-7 [&:not(:first-child)]:mt-6",e),...t}));Xl.displayName="P";const Jl=Z.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:Yt("text-xl text-muted-foreground",e),...t}));Jl.displayName="Lead";const Zl=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:Yt("text-lg font-semibold",e),...t}));Zl.displayName="Large";const ed=Z.forwardRef(({className:e,...t},r)=>a.jsx("small",{ref:r,className:Yt("text-sm font-medium leading-none",e),...t}));ed.displayName="Small";const ad=Z.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));ad.displayName="Muted";const td=Z.forwardRef(({className:e,...t},r)=>a.jsx("code",{ref:r,className:Yt("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));td.displayName="InlineCode";const rd=Z.forwardRef(({className:e,...t},r)=>a.jsx("blockquote",{ref:r,className:Yt("mt-6 border-l-2 pl-6 italic",e),...t}));rd.displayName="Blockquote";const sd=Z.forwardRef(({className:e,...t},r)=>a.jsx("ul",{ref:r,className:Yt("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));sd.displayName="List";const nd=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(ye.Root,{ref:s,className:Yt("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...r,children:[t,a.jsx(md,{})]}));nd.displayName=ye.Root.displayName;const od=Z.forwardRef(({className:e,...t},r)=>a.jsx(ye.List,{ref:r,className:Yt("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));od.displayName=ye.List.displayName;const id=ye.Item,ld=s.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),dd=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(ye.Trigger,{ref:s,className:Yt(ld(),"group",e),...r,children:[t," ",a.jsx(d.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));dd.displayName=ye.Trigger.displayName;const cd=Z.forwardRef(({className:e,...t},r)=>a.jsx(ye.Content,{ref:r,className:Yt("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...t}));cd.displayName=ye.Content.displayName;const ud=ye.Link,md=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{className:Yt("absolute left-0 top-full flex justify-center"),children:a.jsx(ye.Viewport,{className:Yt("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:r,...t})}));md.displayName=ye.Viewport.displayName;const pd=Z.forwardRef(({className:e,...t},r)=>a.jsx(ye.Indicator,{ref:r,className:Yt("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...t,children:a.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));pd.displayName=ye.Indicator.displayName;const hd=({className:e,...t})=>a.jsx("nav",{role:"navigation","aria-label":"pagination",className:Yt("mx-auto flex w-full justify-center",e),...t});hd.displayName="Pagination";const xd=Z.forwardRef(({className:e,...t},r)=>a.jsx("ul",{ref:r,className:Yt("flex flex-row items-center gap-1",e),...t}));xd.displayName="PaginationContent";const fd=Z.forwardRef(({className:e,...t},r)=>a.jsx("li",{ref:r,className:Yt("",e),...t}));fd.displayName="PaginationItem";const gd=({className:e,isActive:t,size:r="icon",...s})=>a.jsx("a",{"aria-current":t?"page":void 0,className:Yt(Xt({variant:t?"outline":"ghost",size:r}),e),...s});gd.displayName="PaginationLink";const bd=({className:t,...r})=>a.jsxs(gd,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Yt("gap-1 pl-2.5",t),...r,children:[a.jsx(d.ChevronLeft,{className:"h-4 w-4"}),a.jsx("span",{children:"Previous"})]});bd.displayName="PaginationPrevious";const vd=({className:t,...r})=>a.jsxs(gd,{"aria-label":e.t("go_to_next_page"),size:"default",className:Yt("gap-1 pr-2.5",t),...r,children:[a.jsx("span",{children:"Next"}),a.jsx(d.ChevronRight,{className:"h-4 w-4"})]});vd.displayName="PaginationNext";const yd=({className:e,...t})=>a.jsxs("span",{"aria-hidden":!0,className:Yt("flex h-9 w-9 items-center justify-center",e),...t,children:[a.jsx(d.MoreHorizontal,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"More pages"})]});yd.displayName="PaginationEllipsis";const wd=Z.forwardRef(({className:e,value:t,...r},s)=>a.jsx(we.Root,{ref:s,className:Yt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:a.jsx(we.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));wd.displayName=we.Root.displayName;const jd=Z.forwardRef(({className:e,...t},r)=>a.jsx(je.Root,{className:Yt("grid gap-2",e),...t,ref:r}));jd.displayName=je.Root.displayName;const Nd=Z.forwardRef(({className:e,...t},r)=>a.jsx(je.Item,{ref:r,className:Yt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(je.Indicator,{className:"flex items-center justify-center",children:a.jsx(d.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Nd.displayName=je.Item.displayName;const _d=Ne.Panel,Cd=te.Root,kd=te.Trigger,Sd=te.Close,Td=te.Portal,Dd=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Overlay,{className:Yt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));Dd.displayName=te.Overlay.displayName;const Pd=s.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ad=Z.forwardRef(({side:e="right",className:t,children:r,...s},n)=>a.jsxs(Td,{children:[a.jsx(Dd,{}),a.jsxs(te.Content,{ref:n,className:Yt(Pd({side:e}),t),...s,children:[r,a.jsxs(te.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ad.displayName=te.Content.displayName;const Ed=({className:e,showSeparator:t=!1,children:r,...s})=>a.jsxs("div",{className:Yt("flex flex-col flex-shrink-0",e),...s,children:[a.jsx("div",{className:"flex flex-col text-left",children:r}),t&&a.jsx(dr,{className:"mt-2"})]});Ed.displayName="SheetHeader";const Md=({className:e,...t})=>a.jsx("div",{className:Yt("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});Md.displayName="SheetBody";const Id=({className:e,children:t,...r})=>a.jsxs("div",{className:"flex-shrink-0 pt-4",children:[a.jsx(dr,{className:"mb-4"}),a.jsx("div",{className:Yt("flex flex-row justify-end gap-2",e),...r,children:t})]});Id.displayName="SheetFooter";const Fd=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Title,{ref:r,className:Yt("text-lg font-semibold text-foreground",e),...t}));Fd.displayName=te.Title.displayName;const Rd=Z.forwardRef(({className:e,...t},r)=>a.jsx(te.Description,{ref:r,className:Yt("text-sm text-muted-foreground",e),...t}));Rd.displayName=te.Description.displayName;const Ld="sidebar:state",zd=Z.createContext(null);function Od(){const e=Z.useContext(zd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Ud=Z.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:s,style:n,children:o,...i},l)=>{const d=Fn(),[c,u]=Z.useState(!1),[m,p]=Z.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Ld);return null!==a?"true"===a:e}return e}),h=t??m,x=Z.useCallback(e=>{const a="function"==typeof e?e(h):e;r?r(a):p(a),"undefined"!=typeof window&&localStorage.setItem(Ld,String(a))},[r,h]),f=Z.useCallback(()=>d?u(e=>!e):x(e=>!e),[d,x,u]);Z.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",b=Z.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:d,openMobile:c,setOpenMobile:u,toggleSidebar:f}),[g,h,x,d,c,u,f]);return a.jsx(zd.Provider,{value:b,children:a.jsx(js,{delayDuration:0,children:a.jsx("div",{className:Yt("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",s),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});Ud.displayName="SidebarProvider";const Vd=Z.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:s,children:n,...o},i)=>{const{isMobile:l,state:d,openMobile:c,setOpenMobile:u}=Od();return"none"===r?a.jsx("div",{className:Yt("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:i,...o,children:n}):l?a.jsx(Cd,{open:c,onOpenChange:u,...o,children:a.jsxs(Ad,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[a.jsx(Fd,{className:"sr-only",children:"Menu de Navegação"}),a.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):a.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":d,"data-collapsible":"collapsed"===d?r:"","data-variant":t,"data-side":e,children:[a.jsx("div",{className:Yt("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),a.jsx("div",{className:Yt("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:a.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});Vd.displayName="Sidebar";const Bd=Z.forwardRef(({className:e,onClick:t,...r},s)=>{const{toggleSidebar:n}=Od();return a.jsxs(Jt,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Yt("h-7 w-7",e),onClick:e=>{t?.(e),n()},...r,children:[a.jsx(d.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Bd.displayName="SidebarTrigger";const qd=Z.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:s}=Od();return a.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:Yt("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});qd.displayName="SidebarRail";const $d=Z.forwardRef(({className:e,...t},r)=>a.jsx("main",{ref:r,className:Yt("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));$d.displayName="SidebarInset";const Wd=Z.forwardRef(({className:e,...t},r)=>a.jsx(er,{ref:r,"data-sidebar":"input",className:Yt("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Wd.displayName="SidebarInput";const Hd=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"header",className:Yt("flex flex-col gap-2 p-2",e),...t}));Hd.displayName="SidebarHeader";const Gd=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"footer",className:Yt("flex flex-col gap-2 p-2",e),...t}));Gd.displayName="SidebarFooter";const Kd=Z.forwardRef(({className:e,...t},r)=>a.jsx(dr,{ref:r,"data-sidebar":"separator",className:Yt("mx-2 w-auto bg-sidebar-border",e),...t}));Kd.displayName="SidebarSeparator";const Yd=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"content",className:Yt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Yd.displayName="SidebarContent";const Qd=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"group",className:Yt("relative flex w-full min-w-0 flex-col p-2",e),...t}));Qd.displayName="SidebarGroup";const Xd=Z.forwardRef(({className:e,asChild:t=!1,...s},n)=>{const o=t?r.Slot:"div";return a.jsx(o,{ref:n,"data-sidebar":"group-label",className:Yt("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})});Xd.displayName="SidebarGroupLabel";const Jd=Z.forwardRef(({className:e,asChild:t=!1,...s},n)=>{const o=t?r.Slot:"button";return a.jsx(o,{ref:n,"data-sidebar":"group-action",className:Yt("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...s})});Jd.displayName="SidebarGroupAction";const Zd=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"group-content",className:Yt("w-full text-sm",e),...t}));Zd.displayName="SidebarGroupContent";const ec=Z.forwardRef(({className:e,...t},r)=>a.jsx("ul",{ref:r,"data-sidebar":"menu",className:Yt("flex w-full min-w-0 flex-col gap-1",e),...t}));ec.displayName="SidebarMenu";const ac=Z.forwardRef(({className:e,...t},r)=>a.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Yt("group/menu-item relative",e),...t}));ac.displayName="SidebarMenuItem";const tc=s.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),rc=Z.forwardRef(({asChild:e=!1,isActive:t=!1,variant:s="default",size:n="default",tooltip:o,className:i,...l},d)=>{const c=e?r.Slot:"button",{isMobile:u,state:m}=Od(),p=a.jsx(c,{ref:d,"data-sidebar":"menu-button","data-size":n,"data-active":t,className:Yt(tc({variant:s,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:p}),a.jsx(Cs,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});rc.displayName="SidebarMenuButton";const sc=Z.forwardRef(({className:e,asChild:t=!1,showOnHover:s=!1,...n},o)=>{const i=t?r.Slot:"button";return a.jsx(i,{ref:o,"data-sidebar":"menu-action",className:Yt("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});sc.displayName="SidebarMenuAction";const nc=Z.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Yt("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));nc.displayName="SidebarMenuBadge";const oc=Z.forwardRef(({className:e,showIcon:t=!1,...r},s)=>{const n=Z.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return a.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:Yt("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[t&&a.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});oc.displayName="SidebarMenuSkeleton";const ic=Z.forwardRef(({className:e,...t},r)=>a.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Yt("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));ic.displayName="SidebarMenuSub";const lc=Z.forwardRef(({...e},t)=>a.jsx("li",{ref:t,...e}));lc.displayName="SidebarMenuSubItem";const dc=Z.forwardRef(({asChild:e=!1,size:t="md",isActive:s,className:n,...o},i)=>{const l=e?r.Slot:"a";return a.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":s,className:Yt("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===t&&"text-xs","md"===t&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});dc.displayName="SidebarMenuSubButton";const cc=Z.forwardRef(({className:e,value:t,defaultValue:r,...s},n)=>{const o=t||r||[0];return a.jsxs(_e.Root,{ref:n,value:t,defaultValue:r,className:Yt("relative flex w-full touch-none select-none items-center",e),...s,children:[a.jsx(_e.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(_e.Range,{className:"absolute h-full bg-primary"})}),o.map((e,t)=>a.jsx(_e.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},t))]})});cc.displayName=_e.Root.displayName;const uc=Ce.Menu,mc=Ce.Group,pc=Ce.Portal,hc=Ce.Sub,xc=Ce.RadioGroup,fc=Z.forwardRef(({className:e,...t},r)=>a.jsx(Ce.Root,{ref:r,className:Yt("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));fc.displayName=Ce.Root.displayName;const gc=Z.forwardRef(({className:e,...t},r)=>a.jsx(Ce.Trigger,{ref:r,className:Yt("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...t}));gc.displayName=Ce.Trigger.displayName;const bc=Z.forwardRef(({className:e,inset:t,children:r,...s},n)=>a.jsxs(Ce.SubTrigger,{ref:n,className:Yt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...s,children:[r,a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4"})]}));bc.displayName=Ce.SubTrigger.displayName;const vc=Z.forwardRef(({className:e,...t},r)=>a.jsx(Ce.SubContent,{ref:r,className:Yt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));vc.displayName=Ce.SubContent.displayName;const yc=Z.forwardRef(({className:e,align:t="start",alignOffset:r=-4,sideOffset:s=8,...n},o)=>a.jsx(Ce.Portal,{children:a.jsx(Ce.Content,{ref:o,align:t,alignOffset:r,sideOffset:s,className:Yt("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));yc.displayName=Ce.Content.displayName;const wc=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(Ce.Item,{ref:s,className:Yt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));wc.displayName=Ce.Item.displayName;const jc=Z.forwardRef(({className:e,children:t,checked:r,...s},n)=>a.jsxs(Ce.CheckboxItem,{ref:n,className:Yt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Ce.ItemIndicator,{children:a.jsx(d.Check,{className:"h-4 w-4"})})}),t]}));jc.displayName=Ce.CheckboxItem.displayName;const Nc=Z.forwardRef(({className:e,children:t,...r},s)=>a.jsxs(Ce.RadioItem,{ref:s,className:Yt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Ce.ItemIndicator,{children:a.jsx(d.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));Nc.displayName=Ce.RadioItem.displayName;const _c=Z.forwardRef(({className:e,inset:t,...r},s)=>a.jsx(Ce.Label,{ref:s,className:Yt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));_c.displayName=Ce.Label.displayName;const Cc=Z.forwardRef(({className:e,...t},r)=>a.jsx(Ce.Separator,{ref:r,className:Yt("-mx-1 my-1 h-px bg-muted",e),...t}));Cc.displayName=Ce.Separator.displayName;const kc=({className:e,...t})=>a.jsx("span",{className:Yt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});kc.displayname="MenubarShortcut";const Sc={light:"",dark:".dark"},Tc=Z.createContext(null);function Dc(){const e=Z.useContext(Tc);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Pc=Z.forwardRef(({id:e,className:t,children:r,config:s,...n},o)=>{const i=Z.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return a.jsx(Tc.Provider,{value:{config:s},children:a.jsxs("div",{"data-chart":l,ref:o,className:Yt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...n,children:[a.jsx(Ac,{id:l,config:s}),a.jsx(ke.ResponsiveContainer,{children:r})]})})});Pc.displayName="Chart";const Ac=({id:e,config:t})=>{const r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Sc).map(([a,t])=>`\n${t} [data-chart=${e}] {\n${r.map(([e,t])=>{const r=t.theme?.[a]||t.color;return r?` --color-${e}: ${r};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Ec=ke.Tooltip,Mc=Z.forwardRef(({active:e,payload:t,className:r,indicator:s="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:d,formatter:c,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=Dc(),f=Z.useMemo(()=>{if(n||!t?.length)return null;const[e]=t,r=Rc(x,e,`${p||e?.dataKey||e?.name||"value"}`),s=p||"string"!=typeof i?r?.label:x[i]?.label||i;return l?a.jsx("div",{className:Yt("font-medium",d),children:l(s,t)}):s?a.jsx("div",{className:Yt("font-medium",d),children:s}):null},[i,l,t,n,d,x,p]);if(!e||!t?.length)return null;const g=1===t.length&&"dot"!==s;return a.jsxs("div",{ref:h,className:Yt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:f,a.jsx("div",{className:"grid gap-1.5",children:t.map((e,t)=>{const r=`${m||e.name||e.dataKey||"value"}`,n=Rc(x,e,r),i=u||e.payload?.fill||e.color;return a.jsx("div",{className:Yt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===s&&"items-center"),children:c&&void 0!==e?.value&&e.name?c(e.value,e.name,e,t,e.payload):a.jsxs(a.Fragment,{children:[n?.icon?a.jsx(n.icon,{}):!o&&a.jsx("div",{className:Yt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===s,"w-1":"line"===s,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===s,"my-0.5":g&&"dashed"===s}),style:{"--color-bg":i,"--color-border":i}}),a.jsxs("div",{className:Yt("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,a.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||t)})})]})});Mc.displayName="ChartTooltip";const Ic=ke.Legend,Fc=Z.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:s="bottom",nameKey:n},o)=>{const{config:i}=Dc();return r?.length?a.jsx("div",{ref:o,className:Yt("flex items-center justify-center gap-4","top"===s?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${n||e.dataKey||"value"}`,s=Rc(i,e,r);return a.jsxs("div",{className:Yt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[s?.icon&&!t?a.jsx(s.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),s?.label]},e.value)})}):null});function Rc(e,a,t){if("object"!=typeof a||null===a)return;const r="payload"in a&&"object"==typeof a.payload&&null!==a.payload?a.payload:void 0;let s=t;return t in a&&"string"==typeof a[t]?s=a[t]:r&&t in r&&"string"==typeof r[t]&&(s=r[t]),s in e?e[s]:e[t]}Fc.displayName="ChartLegend";const Lc=({onClick:e,isActive:t,disabled:r,children:s,title:n})=>a.jsx("button",{type:"button",onClick:e,disabled:r,title:n,className:Yt("p-1.5 rounded hover:bg-muted transition-colors",t?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:s}),zc=()=>a.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Oc({image:e,title:t,className:r}){return a.jsx("div",{className:Yt("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?a.jsx("img",{src:e,alt:t,className:"w-full h-full object-cover"}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx(d.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function Uc({steps:e,currentStepIndex:t,onStepSelect:r,stepLabel:s,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(t+1)/i*100;return a.jsxs("div",{className:Yt("flex items-center gap-3",n),children:[a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsxs(Jt,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[s," ",t+1,"/",i,a.jsx(d.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),a.jsx(xs,{align:"start",children:e.map((e,s)=>a.jsxs(fs,{onClick:()=>r(s),className:Yt(s===t&&"bg-accent"),children:[s+1,". ",e.title]},e.id))})]}),a.jsx(wd,{value:l,className:"w-32 h-2"})]})}function Vc({currentStepIndex:e,totalSteps:t,onBack:r,onNext:s,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:c}){const{t:u}=y.useTranslation(),m=0===e,p=e===t-1;return a.jsxs("div",{className:Yt("flex items-center gap-2",c),children:[!m&&a.jsxs(Jt,{variant:"outline",onClick:r,size:"sm",children:[a.jsx(d.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),a.jsxs(Jt,{onClick:p?n:s,size:"sm",children:[p?l:i,!p&&a.jsx(d.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const Bc=Z.forwardRef(({open:t,onOpenChange:r,steps:s,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:c="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[b,v]=Z.useState(0),y=void 0!==h,w=y?h:b,j=Z.useCallback(e=>{y?x?.(e):v(e),o?.(e)},[y,x,o]);Z.useEffect(()=>{t||y||v(0)},[t,y]);const N=s[w],_=s.length;return N?a.jsx(wr,{open:t,onOpenChange:r,children:a.jsxs(Sr,{ref:g,size:m,variant:"informative",className:Yt("p-0 gap-0 overflow-hidden",f),children:[a.jsxs(_r,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[a.jsx(d.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Fechar"})]}),a.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx(Oc,{image:N.image,title:N.title}),a.jsx(Ar,{className:"text-xl font-semibold",children:N.title}),a.jsx(Er,{className:"text-muted-foreground",children:N.description})]})}),a.jsxs("div",{className:"flex-shrink-0",children:[a.jsx(dr,{}),a.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?a.jsx(Uc,{steps:s,currentStepIndex:w,onStepSelect:e=>{j(e)},stepLabel:u}):a.jsx("div",{}),a.jsx(Vc,{currentStepIndex:w,totalSteps:_,onBack:()=>{w>0&&j(w-1)},onNext:()=>{w<_-1&&j(w+1)},onComplete:()=>{n?.(),r(!1)},backButtonText:l,continueButtonText:i,finishButtonText:c})]})]})]})}):null});function qc({label:e,onClick:t,icon:r,actions:s=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:c="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(s.length>0))return a.jsxs(Jt,{variant:n,size:o,disabled:p,onClick:t,className:u,children:[l?a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?a.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]});return a.jsxs("div",{className:Yt("inline-flex rounded-md shadow-sm",u),children:[a.jsxs(Jt,{variant:n,size:o,disabled:p,onClick:t,className:"rounded-r-none border-r-0 focus:z-10",children:[l?a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?a.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]}),a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsx(Jt,{variant:n,size:o,disabled:p,className:Yt("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:a.jsx(d.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),a.jsx(xs,{align:c,className:"min-w-[160px]",children:s.map(e=>{const t=e.icon;return a.jsxs(fs,{onClick:e.onClick,disabled:e.disabled,className:Yt("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[t&&a.jsx(t,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}var $c;Bc.displayName="OnboardingDialog",exports.ExportFormat=void 0,($c=exports.ExportFormat||(exports.ExportFormat={})).CSV="csv",$c.PDF="pdf",$c.XLSX="xlsx",$c.PNG="png",$c.JPEG="jpeg",$c.SVG="svg";const Wc=[{value:exports.ExportFormat.CSV,label:"CSV",icon:a.jsx(d.FileText,{className:"h-5 w-5"})},{value:exports.ExportFormat.PDF,label:"PDF",icon:a.jsx(d.FileText,{className:"h-5 w-5"})},{value:exports.ExportFormat.XLSX,label:"XLSX",icon:a.jsx(d.FileSpreadsheet,{className:"h-5 w-5"})}],Hc=[{value:exports.ExportFormat.PNG,label:"PNG",icon:a.jsx(d.Image,{className:"h-5 w-5"})},{value:exports.ExportFormat.JPEG,label:"JPEG",icon:a.jsx(d.FileImage,{className:"h-5 w-5"})},{value:exports.ExportFormat.SVG,label:"SVG",icon:a.jsx(d.FileImage,{className:"h-5 w-5"})},{value:exports.ExportFormat.PDF,label:"PDF",icon:a.jsx(d.FileText,{className:"h-5 w-5"})}];const Gc=t.forwardRef(({value:e,onChange:r,onTimeChange:s,label:n,error:o,format:i="24h",className:l,id:c,...u},m)=>{const p=c??Z.useId(),h=t.useCallback(e=>{const a=e.target.value;r?.(a),s?.(a)},[r,s]),x=t.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return a.jsxs("div",{className:Yt("grid gap-1.5",l),children:[n&&a.jsx(tr,{htmlFor:p,children:n}),a.jsxs("div",{className:"relative",children:[a.jsx(er,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:Yt("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),a.jsx(d.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&a.jsx("p",{className:"text-sm text-destructive",children:o})]})});function Kc({currentStep:e,totalSteps:t,onStepChange:r,stepLabels:s,canGoToStep:n,className:o,progressWidth:i="w-32"}){Z.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:t},(e,a)=>a+1),c=a=>!(a<=e)&&(!!n&&!n(a));return a.jsxs("div",{className:Yt("flex items-center gap-3",o),children:[a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsxs(Jt,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",t,a.jsx(d.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),a.jsx(xs,{align:"start",children:l.map(t=>a.jsxs(fs,{onClick:()=>{var a;(a=t)<e?r(a):n&&!n(a)||r(a)},disabled:c(t),className:Yt("cursor-pointer",t===e&&"bg-muted font-medium",c(t)&&"opacity-50 cursor-not-allowed"),children:[a.jsxs("span",{className:"mr-2 text-muted-foreground",children:[t,"."]}),s?.[t-1]||`Etapa ${t}`,t===e&&a.jsx(d.Check,{className:"h-4 w-4 ml-auto"})]},t))})]}),a.jsx(wd,{value:e/t*100,className:Yt("h-2",i)})]})}function Yc(e){const a=rn.getAccessToken(),t={"Content-Type":"application/json",...a?{Authorization:`Bearer ${a}`}:{},"un-alias":e};if(a)try{const e=JSON.parse(atob(a.split(".")[1]));e.sub&&(t["x-waf-rate"]=btoa(e.sub))}catch{}return t}async function Qc(e,a,t){let r=await fetch(e,a);if(401===r.status){if(await hn.handleApiError({status:401})){const s={...a,headers:Yc(t)};r=await fetch(e,s)}}return r}function Xc(e){const[a,r]=t.useState([]),[s,n]=t.useState(0),[o,i]=t.useState(!1);t.useEffect(()=>{if(!e)return;let a=!1;const t=`${Ve().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const s=Yc(e),o=await Qc(t,{method:"GET",headers:s},e);if(!o.ok)return;const i=await o.json();!a&&i.data?.[0]&&(r(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(s){}finally{a||i(!1)}}(),()=>{a=!0}},[e]);const l=t.useCallback(async()=>{if(!e||s<=0||0===a.length)return;const t=a[0].id,r=`${Ve().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=Yc(e),s=JSON.stringify({id:t,idUpdateType:3});await Qc(r,{method:"POST",headers:a,body:s},e)}catch(o){}},[e,s,a]);return{updates:a,badgeCount:s,loading:o,markAsVisualized:l}}Gc.displayName="Timepicker";const Jc=t.forwardRef(({updates:t,badgeCount:r,onOpen:s,onViewAll:n},o)=>{const i=void 0===t,l=En(),c=l?.alias??null,u=Xc(i?c:null),m=i?u.updates??[]:t,p=i?u.badgeCount??0:r??0,h=s??(i?u.markAsVisualized:void 0),x=n??(i&&c?()=>{const e=`https://apps4.qualiex.com/common/${c}/up/view`;window.open(e,"_blank","noopener,noreferrer")}:void 0);return a.jsxs(Ss,{children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:h,title:e.t("updates"),children:[a.jsx(d.Coffee,{className:"h-7 w-7"}),p>0&&a.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:p>99?"99+":p})]})}),a.jsxs(Ds,{align:"end",className:"w-80 p-0",children:[a.jsx("div",{className:"border-b border-border px-4 py-3",children:a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),a.jsx("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?a.jsx("ul",{className:"divide-y divide-border",children:m.map(e=>a.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:x,children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[a.jsx(d.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),a.jsx("div",{className:"border-t border-border px-4 py-2",children:a.jsxs(Jt,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:x,children:["Ver todas as atualizações",a.jsx(d.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});var Zc,eu;Jc.displayName="UpdatesNotification",exports.FileViewerType=void 0,(Zc=exports.FileViewerType||(exports.FileViewerType={}))[Zc.none=0]="none",Zc[Zc.image=1]="image",Zc[Zc.video=2]="video",Zc[Zc.audio=3]="audio",Zc[Zc.wopi=4]="wopi",Zc[Zc.onlineEditor=5]="onlineEditor",Zc[Zc.report=6]="report",exports.FilePrintType=void 0,(eu=exports.FilePrintType||(exports.FilePrintType={}))[eu.SimplePrint=0]="SimplePrint",eu[eu.ManagedCopy=1]="ManagedCopy",eu[eu.NonManagedCopy=2]="NonManagedCopy";const au={".jpg":exports.FileViewerType.image,".jpeg":exports.FileViewerType.image,".png":exports.FileViewerType.image,".bmp":exports.FileViewerType.image,".gif":exports.FileViewerType.image,".svg":exports.FileViewerType.image,".webp":exports.FileViewerType.image,".wav":exports.FileViewerType.audio,".mp3":exports.FileViewerType.audio,".mp4":exports.FileViewerType.video,".webm":exports.FileViewerType.video,".ogg":exports.FileViewerType.video,".pdf":exports.FileViewerType.wopi,".ods":exports.FileViewerType.wopi,".xls":exports.FileViewerType.wopi,".xlsb":exports.FileViewerType.wopi,".xlsm":exports.FileViewerType.wopi,".xlsx":exports.FileViewerType.wopi,".doc":exports.FileViewerType.wopi,".docm":exports.FileViewerType.wopi,".docx":exports.FileViewerType.wopi,".dot":exports.FileViewerType.wopi,".dotm":exports.FileViewerType.wopi,".dotx":exports.FileViewerType.wopi,".odt":exports.FileViewerType.wopi,".odp":exports.FileViewerType.wopi,".pot":exports.FileViewerType.wopi,".potm":exports.FileViewerType.wopi,".potx":exports.FileViewerType.wopi,".pps":exports.FileViewerType.wopi,".ppsm":exports.FileViewerType.wopi,".ppsx":exports.FileViewerType.wopi,".ppt":exports.FileViewerType.wopi,".pptm":exports.FileViewerType.wopi,".pptx":exports.FileViewerType.wopi,".gdocs":exports.FileViewerType.onlineEditor,".gsheets":exports.FileViewerType.onlineEditor};function tu(e){const{t:a}=y.useTranslation();return e?au[e.toLowerCase()]??exports.FileViewerType.none:exports.FileViewerType.none}const ru={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function su(e){const{t:a}=y.useTranslation();return ru[e?.toLowerCase()]||""}function nu(e){const{t:a}=y.useTranslation(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function ou({open:e,onOpenChange:r,url:s,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),c=t.useCallback(()=>{r(!1)},[r]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&c()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,c]),a.jsx(wr,{open:e,onOpenChange:r,children:a.jsxs(Sr,{className:Yt("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[a.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&a.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(Cs,{children:"Fechar"})]})]}),a.jsx("iframe",{src:s,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function iu({term:r,open:s,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:c=e.t("terms_read_agree")}){const u=t.useMemo(()=>r.file?function(e,a=""){const{t:t}=y.useTranslation(),r=atob(e),s=[];for(let o=0;o<r.length;o+=512){const e=r.slice(o,o+512),a=new Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t);s.push(new Uint8Array(a))}const n=new Blob(s,{type:a});return URL.createObjectURL(n)}(r.file,r.type):null,[r.file,r.type]),m=t.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=t.useCallback(()=>{r.hasUserSignature?m():o?.(r.id)},[r,o,m]),h=!i&&!r.hasUserSignature&&o;return a.jsx(wr,{open:s,onOpenChange:e=>!e&&m(),children:a.jsxs(Sr,{className:Yt("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[a.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[a.jsx(d.FileText,{className:"h-5 w-5 text-primary"}),l]}),a.jsxs("div",{className:"flex items-center gap-2",children:[h&&a.jsx(Jt,{size:"sm",onClick:p,children:c}),a.jsx(Jt,{variant:"ghost",size:"icon",onClick:m,children:a.jsx(d.X,{className:"h-4 w-4"})})]})]}),a.jsx("div",{className:"flex-1 min-h-0",children:r.file&&u?a.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):a.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function lu(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function du(e){const{t:a}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function cu(e){const{t:a}=y.useTranslation(),t=new Set;if(!e)return t;for(const r of e)r.allowedIds?.forEach(e=>t.add(e)),r.inheritedIds?.forEach(e=>t.add(e));return t}var uu;exports.ReportRequestStatus=void 0,(uu=exports.ReportRequestStatus||(exports.ReportRequestStatus={}))[uu.WaitingProcessing=1]="WaitingProcessing",uu[uu.Processing=2]="Processing",uu[uu.Completed=3]="Completed",uu[uu.Error=4]="Error",uu[uu.Expired=5]="Expired";const mu={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function pu(e){const{t:a}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function hu(e){const{t:a}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const xu={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};var fu,gu,bu,vu,yu,wu,ju,Nu,_u,Cu,ku,Su,Tu,Du,Pu,Au,Eu,Mu,Iu,Fu,Ru,Lu,zu,Ou,Uu;exports.AggregationType=void 0,(fu=exports.AggregationType||(exports.AggregationType={})).Count="valuecount",fu.Sum="sum",fu.Average="average",fu.DistinctCount="valuecount_distict",fu.Max="max",fu.Min="min",exports.AnalysisFunctionality=void 0,(exports.AnalysisFunctionality||(exports.AnalysisFunctionality={})).ViewAllAnalysis="nes3j6wn",exports.DashboardFunctionality=void 0,(gu=exports.DashboardFunctionality||(exports.DashboardFunctionality={})).RegisterDashboards="EeKs7CYA",gu.RemoveDashboards="3GKZYOQ9",gu.ViewAllDashboards="wYBdQNvZ",gu.EditDashboards="bMFcbwv4",exports.DashboardListType=void 0,(bu=exports.DashboardListType||(exports.DashboardListType={}))[bu.Default=1]="Default",bu[bu.Compact=2]="Compact",exports.DashboardPageTime=void 0,(vu=exports.DashboardPageTime||(exports.DashboardPageTime={}))[vu.FiveSeconds=1]="FiveSeconds",vu[vu.TenSeconds=2]="TenSeconds",vu[vu.FifteenSeconds=3]="FifteenSeconds",vu[vu.ThirtySeconds=4]="ThirtySeconds",vu[vu.OneMinute=5]="OneMinute",vu[vu.ThreeMinutes=6]="ThreeMinutes",vu[vu.FiveMinutes=7]="FiveMinutes",vu[vu.TenMinutes=8]="TenMinutes",exports.DashboardPanelDimension=void 0,(yu=exports.DashboardPanelDimension||(exports.DashboardPanelDimension={}))[yu.Day=1]="Day",yu[yu.Month=2]="Month",yu[yu.Year=3]="Year",exports.DashboardPanelOrderByType=void 0,(wu=exports.DashboardPanelOrderByType||(exports.DashboardPanelOrderByType={}))[wu.Ascending=1]="Ascending",wu[wu.Descending=2]="Descending",exports.DashboardPanelOrderBy=void 0,(ju=exports.DashboardPanelOrderBy||(exports.DashboardPanelOrderBy={}))[ju.Label=1]="Label",ju[ju.Value=2]="Value",exports.DashboardPanelPeriod=void 0,(Nu=exports.DashboardPanelPeriod||(exports.DashboardPanelPeriod={}))[Nu.LastSevenDays=1]="LastSevenDays",Nu[Nu.LastWeek=2]="LastWeek",Nu[Nu.LastMonth=3]="LastMonth",Nu[Nu.PreviousQuarter=4]="PreviousQuarter",Nu[Nu.PreviousSemester=5]="PreviousSemester",Nu[Nu.LastYear=6]="LastYear",Nu[Nu.SpecificPeriod=7]="SpecificPeriod",Nu[Nu.CurrentMonth=8]="CurrentMonth",Nu[Nu.CurrentSemester=9]="CurrentSemester",Nu[Nu.CurrentWeek=10]="CurrentWeek",Nu[Nu.CurrentYear=11]="CurrentYear",exports.DashboardPanelType=void 0,(_u=exports.DashboardPanelType||(exports.DashboardPanelType={}))[_u.Text=1]="Text",_u[_u.Area=2]="Area",_u[_u.Bar=3]="Bar",_u[_u.Column=4]="Column",_u[_u.StackedColumn=5]="StackedColumn",_u[_u.Line=6]="Line",_u[_u.List=7]="List",_u[_u.Numeric=8]="Numeric",_u[_u.Pareto=9]="Pareto",_u[_u.Pie=10]="Pie",_u[_u.RiskMatrix=11]="RiskMatrix",_u[_u.Burndown=12]="Burndown",_u[_u.PerformanceColumns=13]="PerformanceColumns",_u[_u.EvolutionLine=14]="EvolutionLine",exports.DashboardUpdateTime=void 0,(Cu=exports.DashboardUpdateTime||(exports.DashboardUpdateTime={}))[Cu.NotUpdate=1]="NotUpdate",Cu[Cu.FiveMinutes=2]="FiveMinutes",Cu[Cu.TenMinutes=3]="TenMinutes",Cu[Cu.FifteenMinutes=4]="FifteenMinutes",Cu[Cu.ThirtyMinutes=5]="ThirtyMinutes",Cu[Cu.OneHour=6]="OneHour",exports.DashboardViewType=void 0,(ku=exports.DashboardViewType||(exports.DashboardViewType={}))[ku.NormalPage=1]="NormalPage",ku[ku.Carousel=2]="Carousel",exports.DashboardFormTab=void 0,(Su=exports.DashboardFormTab||(exports.DashboardFormTab={}))[Su.General=0]="General",Su[Su.Share=1]="Share",exports.DashboardShareType=void 0,(Tu=exports.DashboardShareType||(exports.DashboardShareType={}))[Tu.NotShared=1]="NotShared",Tu[Tu.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Tu[Tu.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",exports.DashboardLanguage=void 0,(Du=exports.DashboardLanguage||(exports.DashboardLanguage={})).PtBr="pt-br",Du.EnUs="en",Du.EsEs="es",exports.MatrixViewType=void 0,(Pu=exports.MatrixViewType||(exports.MatrixViewType={}))[Pu.Quantity=0]="Quantity",Pu[Pu.AllRisksList=1]="AllRisksList",exports.PanelItemsPerPanel=void 0,(Au=exports.PanelItemsPerPanel||(exports.PanelItemsPerPanel={}))[Au.Five=5]="Five",Au[Au.Ten=10]="Ten",Au[Au.Fifteen=15]="Fifteen",Au[Au.Twenty=20]="Twenty",Au[Au.All=0]="All",Au[Au.Custom=-1]="Custom",exports.PanelSortType=void 0,(Eu=exports.PanelSortType||(exports.PanelSortType={}))[Eu.AlphabeticalAsc=1]="AlphabeticalAsc",Eu[Eu.AlphabeticalDesc=2]="AlphabeticalDesc",Eu[Eu.CountAsc=3]="CountAsc",Eu[Eu.CountDesc=4]="CountDesc",Eu[Eu.DateAsc=5]="DateAsc",Eu[Eu.DateDesc=6]="DateDesc",exports.PanelState=void 0,(Mu=exports.PanelState||(exports.PanelState={}))[Mu.Loading=0]="Loading",Mu[Mu.Loaded=1]="Loaded",Mu[Mu.Error=3]="Error",Mu[Mu.NoData=4]="NoData",Mu[Mu.Unavailable=5]="Unavailable",exports.VisualizationType=void 0,(Iu=exports.VisualizationType||(exports.VisualizationType={}))[Iu.Quantity=1]="Quantity",Iu[Iu.Percentage=2]="Percentage",Iu[Iu.QuantityPercentage=3]="QuantityPercentage",exports.PlanType=void 0,(Fu=exports.PlanType||(exports.PlanType={}))[Fu.Program=1]="Program",Fu[Fu.Project=2]="Project",Fu[Fu.Action=3]="Action",Fu[Fu.PerformanceProject=4]="PerformanceProject",Fu[Fu.PerformanceAction=5]="PerformanceAction",exports.QueriesContextType=void 0,(Ru=exports.QueriesContextType||(exports.QueriesContextType={})).OccurrenceActionPlans="xebGnSSq",Ru.OccurrenceGeneral="UFws4AvH",Ru.PlansActionPlans="Kux6CcVC",Ru.PlansProgramProjects="UWjrp6Dw",Ru.PlansIdeas="3g7vNm2w",Ru.RisksGeneral="PZ4b6FhP",Ru.RisksActionPlans="xZErDg57",Ru.RisksAnalysis="UxsioMbH",Ru.RisksIncidences="gNt5IJ2F",Ru.MetrologyGeneral="4MfEPbRY",Ru.MetrologyActivities="hdFM9XQW",Ru.MetrologyServiceOrders="cIrVPdMv",Ru.DecisionsGeneral="CopsnHDB",Ru.DecisionsItems="qLFAayjx",Ru.DecisionsActionPlans="RiQFpxdb",Ru.FlowGeneral="AFV98JoG",Ru.AuditGeneral="gON8LJPi",Ru.AuditPlans="SsCNVOvr",Ru.AuditPlansItems="OpPkCCFm",Ru.AuditActionPlans="P1oGePhh",Ru.CommonGeneral="VVfEzgMQ",Ru.ActionPlans="C6Z4MgGa",Ru.SuppliersEvaluations="fSCeS4mH",Ru.SuppliersGeneral="8qPThkrD",Ru.SuppliersEvaluationsCriteria="RiSIStdY",Ru.SuppliersDocuments="Riua4jMa",Ru.SuppliersMaterialsServices="UpEkatXH",Ru.DocumentsGeneral="FRhhEX2J",Ru.DocumentsPhysicalCopies="PZLtJ23h",Ru.DocumentsObsolete="XDjbga14",Ru.FmeaGeneral="aPwf4uPr",Ru.FmeaActionPlans="vQ8PMrVX",exports.QueriesShareType=void 0,(Lu=exports.QueriesShareType||(exports.QueriesShareType={}))[Lu.NotShared=1]="NotShared",Lu[Lu.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Lu[Lu.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",exports.QuickFilterDashboard=void 0,(zu=exports.QuickFilterDashboard||(exports.QuickFilterDashboard={}))[zu.All=1]="All",zu[zu.OnlyMine=2]="OnlyMine",zu[zu.Favorites=3]="Favorites",exports.RiskCriticality=void 0,(Ou=exports.RiskCriticality||(exports.RiskCriticality={}))[Ou.Current=1]="Current",Ou[Ou.Inherent=2]="Inherent",exports.PaletteType=void 0,(Uu=exports.PaletteType||(exports.PaletteType={}))[Uu.Default=1]="Default",Uu[Uu.Pastel=2]="Pastel",Uu[Uu.Vibrant=3]="Vibrant",Uu[Uu.Earth=4]="Earth",Uu[Uu.Ocean=5]="Ocean",Uu[Uu.Floral=6]="Floral",Uu[Uu.Night=7]="Night",Uu[Uu.Winter=8]="Winter",Uu[Uu.Spring=9]="Spring",Uu[Uu.Summer=10]="Summer",Uu[Uu.Fall=11]="Fall",Uu[Uu.Gray=12]="Gray",Uu[Uu.Brown=13]="Brown",Uu[Uu.Blue=14]="Blue",Uu[Uu.Yellow=15]="Yellow",Uu[Uu.Green=16]="Green",Uu[Uu.Purple=17]="Purple",Uu[Uu.Orange=18]="Orange",Uu[Uu.Pink=19]="Pink",Uu[Uu.Red=20]="Red";const Vu={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Bu=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],qu=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function $u(e){if(!e)return 0;const[a,t]=e.split("/"),r=Vu[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+r}function Wu(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function Hu(e){for(const a of qu)if(e[a])return e[a];return null}function Gu(e){const a=[];for(const t of Object.keys(e)){const r=e[t];null!=r&&(r instanceof Date?a.push(`${t}=${r.toISOString()}`):Array.isArray(r)?r.forEach(e=>{a.push(...Gu({[t]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||a.push(`${t}=${r}`))}return a}const Ku=/^-?\d+(,\d{3})*(\.\d+)?$/;const Yu=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const Qu=new Set([exports.DashboardPanelType.Text]),Xu=new Set([exports.DashboardPanelType.Text,exports.DashboardPanelType.Numeric,exports.DashboardPanelType.RiskMatrix,exports.DashboardPanelType.Burndown,exports.DashboardPanelType.PerformanceColumns]),Ju=new Set([exports.DashboardPanelType.Text,exports.DashboardPanelType.RiskMatrix,exports.DashboardPanelType.Burndown,exports.DashboardPanelType.PerformanceColumns]);function Zu({config:e,viewOnly:r=!1,complement:s,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:c,className:u}){const{t:m}=y.useTranslation(),[p,h]=t.useState(e.onlyMine??!1),x=Qu.has(e.typeId),f=!Xu.has(e.typeId),g=!Ju.has(e.typeId),b=t.useMemo(()=>{if(!e.jsonRules||e.typeId===exports.DashboardPanelType.PerformanceColumns)return!1;try{const a=JSON.parse(e.jsonRules);return a?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),v=t.useMemo(()=>o?.(e)??"#",[o,e]),w=t.useCallback(()=>{const e=!p;h(e),c?.(e)},[p,c]),j=[];return p&&j.push(m("dashboard_only_mine")),e.onlyLate&&j.push(m("dashboard_only_overdue")),b&&j.push(m("dashboard_advanced_filter")),a.jsxs("div",{className:Yt("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&s,a.jsxs("div",{className:"flex min-w-0 flex-col",children:[a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:e.title})}),a.jsx(Cs,{children:e.title})]}),j.length>0&&a.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:j.join(" | ")})]}),"after-title"===n&&s]}),!r&&a.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&s,a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a.jsx(d.MoreVertical,{className:"h-3.5 w-3.5"})})}),a.jsxs(xs,{align:"end",className:"w-48",children:[e.canUpdate&&a.jsxs(fs,{onClick:()=>e.onEdit?.(e.id),children:[a.jsx(d.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&a.jsxs(fs,{onClick:i,children:[a.jsx(d.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&a.jsxs(fs,{disabled:e.noData,onClick:l,children:[a.jsx(d.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&a.jsxs(fs,{disabled:!e.openQueryEnabled,onClick:()=>window.open(v,"_blank"),children:[a.jsx(d.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&a.jsxs(a.Fragment,{children:[a.jsx(ys,{}),a.jsxs(fs,{onClick:w,children:[p&&a.jsx(d.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&a.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&a.jsxs(a.Fragment,{children:[a.jsx(ys,{}),a.jsxs(fs,{onClick:()=>e.onDuplicate?.(e.id),children:[a.jsx(d.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),a.jsxs(fs,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a.jsx(d.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&s]})]})}function em({config:e,queryUrl:t,className:r}){return a.jsxs("div",{className:Yt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),a.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),a.jsxs("p",{className:"mt-2 text-xs",children:[t&&a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),t&&e.canUpdate&&a.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&a.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function am({panelType:e,className:t}){const r=e===exports.DashboardPanelType.Burndown;return a.jsxs("div",{className:Yt("flex flex-1 flex-col items-center justify-center gap-2 p-4",t),children:[a.jsx(ss,{className:"h-10 w-10 text-muted-foreground/40"}),r&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function tm({hasRemovedColumn:t=!1,className:r}){return a.jsxs("div",{className:Yt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),a.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function rm({onRemove:e,className:t}){return a.jsxs("div",{className:Yt("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",t),children:[a.jsx(d.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),a.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&a.jsx("p",{className:"mt-2 text-xs",children:a.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const sm={[exports.AggregationType.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[exports.AggregationType.Sum]:"Sum",[exports.AggregationType.Average]:e.t("dashboard_average"),[exports.AggregationType.DistinctCount]:e.t("dashboard_distinct_count"),[exports.AggregationType.Max]:e.t("dashboard_max_value"),[exports.AggregationType.Min]:e.t("dashboard_min_value")};function nm({config:e,state:t,value:r,label:s,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:d,className:c}){const{t:u}=y.useTranslation(),m=s??sm[e.aggregationType??""]??"",p=function(e,a){if(null==e)return"—";const t=Bu.includes(a.field),r=a.aggregationType===exports.AggregationType.Count||a.aggregationType===exports.AggregationType.DistinctCount;return t&&!r?Yu.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(r,e);return a.jsxs("div",{className:Yt("flex h-full flex-col",c),children:[a.jsx(Zu,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:d}),t===exports.PanelState.Loading&&a.jsx(am,{}),t===exports.PanelState.Loaded&&a.jsxs("div",{className:Yt("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[a.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),t===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:l}),t===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function om({config:e,state:t,htmlContent:r,viewOnly:s=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const d=r??e.textTypeString??"";return a.jsxs("div",{className:Yt("flex h-full flex-col",l),children:[a.jsx(Zu,{config:e,viewOnly:s,onRefresh:n,queryUrlBuilder:i}),t===exports.PanelState.Loading&&a.jsx(am,{}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:d}}),t===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:o})]})}function im({config:e,state:r,data:s=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:d,queryUrl:c,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=t.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=t.useCallback(e=>{if(i)i(e);else if(m){const a=Hu(e);a&&window.open(Wu(a),"_blank")}},[i,m]);return a.jsxs("div",{className:Yt("flex h-full flex-col",p),children:[a.jsx(Zu,{config:e,viewOnly:o,onRefresh:l,onExport:d,queryUrlBuilder:u}),r===exports.PanelState.Loading&&a.jsx(am,{}),r===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:a.jsx("tr",{children:h.map(e=>a.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),a.jsx("tbody",{children:s.map((e,t)=>{const r=m&&!!Hu(e);return a.jsx("tr",{className:Yt("border-b border-border/50 transition-colors hover:bg-muted/30",(r||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(t=>a.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:t.render?t.render(e[t.columnName],e):lm(e[t.columnName],t)},t.columnName))},t)})})]})}),r===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),r===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:c}),r===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function lm(e,a){return null==e?"":e instanceof Date?"datetime"===a.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const dm=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function cm({config:e,variant:r,state:s,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:d,viewOnly:c=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:dm,b=t.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),v="bar"===r,y="stacked-column"===r,w=t.useMemo(()=>{if(d)return e=>d.replace("{value}",e.toLocaleString("pt-BR"))},[d]);return a.jsxs("div",{className:Yt("flex h-full flex-col",f),children:[a.jsx(Zu,{config:e,viewOnly:c,onRefresh:m,onExport:p,queryUrlBuilder:x}),s===exports.PanelState.Loading&&a.jsx(am,{}),s===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:um({variant:r,data:n,series:b,colors:g,categoryKey:l,isHorizontalBar:v,isStacked:y,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),s===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),s===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:h}),s===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function um({variant:e,data:t,series:r,colors:s,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:d,onPointClick:c}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=a.jsx(B.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=a.jsx(B.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=a.jsx(B.Tooltip,{formatter:d,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=r.length>1?a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=c?(e,a)=>c(t[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?a.jsxs(B.BarChart,{data:t,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,t)=>a.jsx(B.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||s[t%s.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:c?"pointer":void 0},e.dataKey))]}):"area"===e?a.jsxs(B.AreaChart,{data:t,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,t)=>{const r=e.color||s[t%s.length];return a.jsx(B.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:c?"pointer":void 0}},e.dataKey)})]}):a.jsxs(B.LineChart,{data:t,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,t)=>a.jsx(B.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||s[t%s.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:c?"pointer":void 0}},e.dataKey))]})}const mm=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function pm({config:e,state:r,data:s=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:d,queryUrl:c,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:mm,h=t.useMemo(()=>s.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[s]),x=t.useMemo(()=>h.reduce((e,a)=>e+(a.value??0),0),[h]);return a.jsxs("div",{className:Yt("flex h-full flex-col",m),children:[a.jsx(Zu,{config:e,viewOnly:o,onRefresh:l,onExport:d,queryUrlBuilder:u}),r===exports.PanelState.Loading&&a.jsx(am,{}),r===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.PieChart,{children:[a.jsx(B.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:a})=>`${e??""}: ${(100*(a??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,a)=>i(s[a],a):void 0,cursor:i?"pointer":void 0,children:h.map((e,t)=>a.jsx(B.Cell,{fill:p[t%p.length]},t))}),a.jsx(B.Tooltip,{formatter:e=>{const a="number"==typeof e?e:0,t=x>0?(a/x*100).toFixed(1):"0";return`${a.toLocaleString("pt-BR")} (${t}%)`}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),r===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),r===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:c}),r===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function hm({config:e,state:r,data:s=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:d,onExport:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=t.useMemo(()=>{const e=[...s].sort((e,a)=>(a.value??0)-(e.value??0)),a=e.reduce((e,a)=>e+(a.value??0),0);let t=0;return e.map(e=>(t+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:a>0?Math.round(t/a*100):0}))},[s]);return a.jsxs("div",{className:Yt("flex h-full flex-col",p),children:[a.jsx(Zu,{config:e,viewOnly:i,onRefresh:d,onExport:c,queryUrlBuilder:m}),r===exports.PanelState.Loading&&a.jsx(am,{}),r===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a.jsx(B.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(B.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a.jsx(B.Tooltip,{formatter:(e,a)=>"% Acumulado"===a?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,a)=>l(s[a],a):void 0,cursor:l?"pointer":void 0}),a.jsx(B.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),r===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:u}),r===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function xm({config:e,state:t,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:d,queryUrl:c,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=s??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return a.jsxs("div",{className:Yt("flex h-full flex-col",m),children:[a.jsx(Zu,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:u}),t===exports.PanelState.Loading&&a.jsx(am,{panelType:exports.DashboardPanelType.Burndown}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.AreaChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a.jsx(B.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a.jsx(B.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a.jsx(B.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),t===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:c}),t===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function fm({config:e,state:t,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:d,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=s??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return a.jsxs("div",{className:Yt("flex h-full flex-col",p),children:[a.jsx(Zu,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:m}),t===exports.PanelState.Loading&&a.jsx(am,{}),t===exports.PanelState.Loaded&&a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(B.ResponsiveContainer,{width:"100%",height:"100%",children:a.jsxs(B.BarChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[a.jsx(B.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),a.jsx(B.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a.jsx(B.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a.jsx(B.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a.jsx(B.Legend,{wrapperStyle:{fontSize:"11px"}}),a.jsx(B.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:d?(e,a)=>d(r[a],a):void 0,cursor:d?"pointer":void 0}),a.jsx(B.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),t===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),t===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:u}),t===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}function gm({config:e,state:r,rule:s,risks:n=[],matrixViewType:o=exports.MatrixViewType.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:d,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=t.useMemo(()=>[...s?.parametersY??[]].sort((e,a)=>a.position-e.position),[s?.parametersY]),x=s?.parametersX??[],f=t.useMemo(()=>{const e={};return n.forEach(a=>{const t=`${a.parameterYPosition}-${a.parameterXPosition}`;e[t]||(e[t]=[]),e[t].push(a)}),e},[n]);return a.jsxs("div",{className:Yt("flex h-full flex-col",p),children:[a.jsx(Zu,{config:e,viewOnly:i,onRefresh:c,queryUrlBuilder:m}),r===exports.PanelState.Loading&&a.jsx(am,{}),r===exports.PanelState.Loaded&&s&&a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:s.name_y})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex mb-1",children:[a.jsx("div",{className:"w-16 shrink-0"}),a.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.threat_strategy_type_name}),!s.disable_opportunities&&a.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.opportunity_strategy_type_name})]}),h.map((e,t)=>a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((r,n)=>{const i=((e,a)=>f[`${a.position}-${e.position}`]??[])(r,e),c=((e,a)=>s?.colorMatrix?.[a]?.[e]??"hsl(var(--muted))")(n,t);return a.jsxs("div",{className:Yt("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||d)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:c},onClick:()=>i.length>0&&l?.(r,e,i),children:[o===exports.MatrixViewType.Quantity&&i.length>0&&a.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===exports.MatrixViewType.AllRisksList&&i.map(e=>a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:a=>{a.stopPropagation(),d?.(e)},children:e.code})}),a.jsxs(Cs,{className:"max-w-[250px]",children:[a.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&a.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",a.jsx("strong",{children:e.analysisDate})]}),e.strategy&&a.jsxs("p",{className:"text-xs",children:["Estratégia: ",a.jsx("strong",{children:e.strategy})]}),e.resultName&&a.jsxs("p",{className:"text-xs",children:["Criticidade: ",a.jsx("strong",{style:{backgroundColor:c},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},r.position)})]},e.position)),a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>a.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),a.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:s.name_x})]})]})}),r===exports.PanelState.NoData&&a.jsx(tm,{hasRemovedColumn:e.hasRemovedColumn}),r===exports.PanelState.Error&&a.jsx(em,{config:e,queryUrl:u}),r===exports.PanelState.Unavailable&&a.jsx(rm,{onRemove:()=>e.onRemove?.(e.id)})]})}const bm=Object.freeze({Translate:{toString(e){if(!e)return;const{x:a,y:t}=e;return"translate3d("+(a?Math.round(a):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:a,scaleY:t}=e;return"scaleX("+a+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[bm.Translate.toString(e),bm.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:r}=e;return a+" "+t+"ms "+r}}});function vm(e){switch(Number(e)){case exports.DashboardPanelType.Area:case exports.DashboardPanelType.Bar:case exports.DashboardPanelType.Column:case exports.DashboardPanelType.Line:case exports.DashboardPanelType.Numeric:case exports.DashboardPanelType.Pie:case exports.DashboardPanelType.Text:return{x:1,y:1};default:return{x:2,y:2}}}function ym({panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:d,setNodeRef:c,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=t.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*s+(e.sizeY-1)*n+"px",transform:bm.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,r,s,n,u,m,p]);return a.jsxs("div",{ref:c,style:h,className:Yt("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[a.jsx("div",{className:Yt("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?d:{}}),a.jsx("div",{className:"h-full",children:i})]})}function wm({panels:e,columns:r=8,cellHeight:s=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:d,className:c}){const[u,m]=t.useState(e);t.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=t.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=t.useMemo(()=>u.map(e=>e.id),[u]),f=t.useCallback(e=>{const{active:a,over:t}=e;if(!t||a.id===t.id)return;const r=u.findIndex(e=>e.id===a.id),s=u.findIndex(e=>e.id===t.id);if(-1===r||-1===s)return;const n=[...u],o={...n[r]},i={...n[s]},l=o.col,c=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=c,n[r]=o,n[s]=i,m(n),d?.(n)},[u,d]),g=t.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${h}, ${s}px)`,gap:`${n}px`}),[r,h,s,n]);return 0===u.length?a.jsxs("div",{className:Yt("flex flex-col items-center justify-center py-16 text-center",c),children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):a.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:a.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:a.jsx("div",{style:g,className:Yt("relative w-full",i&&"bg-muted/30",c),children:u.map(e=>a.jsx(ym,{panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const jm={[exports.DashboardPanelType.Bar]:"bar",[exports.DashboardPanelType.Column]:"column",[exports.DashboardPanelType.StackedColumn]:"stacked-column",[exports.DashboardPanelType.Area]:"area",[exports.DashboardPanelType.Line]:"line",[exports.DashboardPanelType.EvolutionLine]:"evolution-line"};function Nm({config:e,state:t,data:r,numericValue:s,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:d,matrixRule:c,matrixRisks:u,onPanelClick:m}){const p=jm[e.typeId];if(p)return a.jsx(cm,{config:e,variant:p,state:t,data:o,series:i});switch(e.typeId){case exports.DashboardPanelType.Numeric:return a.jsx(nm,{config:e,state:t,value:s});case exports.DashboardPanelType.Text:return a.jsx(om,{config:e,state:t});case exports.DashboardPanelType.List:return a.jsx(im,{config:e,state:t,data:r,columns:n??[]});case exports.DashboardPanelType.Pie:return a.jsx(pm,{config:e,state:t,data:r});case exports.DashboardPanelType.Pareto:return a.jsx(hm,{config:e,state:t,data:r});case exports.DashboardPanelType.Burndown:return a.jsx(xm,{config:e,state:t,data:l});case exports.DashboardPanelType.PerformanceColumns:return a.jsx(fm,{config:e,state:t,data:d});case exports.DashboardPanelType.RiskMatrix:return a.jsx(gm,{config:e,state:t,rule:c,risks:u??[]});default:return a.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function _m({dashboard:e,panels:r,pages:s,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:d,onRefresh:c,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:b,onLayoutChange:v,onPageChange:w,toolbarActions:j,className:N}){const{t:_}=y.useTranslation(),[C,k]=t.useState(!1),S=e.idViewType===exports.DashboardViewType.Carousel,T=t.useMemo(()=>r,[r,S,n]),D=t.useMemo(()=>T.map(e=>{const a=vm(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[T]),P=t.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:b}),[o,f,g,b]),A=t.useCallback(()=>{C||l||(k(!0),c?.(),setTimeout(()=>k(!1),3e4))},[C,l,c]),E=t.useCallback(e=>{const t=T.find(a=>a.id===e);if(!t)return null;const r=P(t),s=d?.(e)??{state:exports.PanelState.Loaded};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Zu,{config:r,onRefresh:()=>{}}),a.jsx("div",{className:"flex-1 min-h-0 p-2",children:a.jsx(Nm,{config:r,...s})})]})},[T,P,d,o,f,g,b]);return a.jsxs("div",{className:Yt("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&a.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[j,c&&a.jsx("button",{onClick:A,disabled:C||l,className:Yt("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&a.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?a.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):a.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&a.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:a.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&a.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:a.jsx("svg",{className:Yt("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&s&&s.length>1&&a.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:s.map(e=>a.jsx("button",{onClick:()=>w?.(e.id),className:Yt("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsxs("button",{onClick:x,className:Yt("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&a.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:a.jsx(wm,{panels:D,allowDragging:o,showGridLines:o,renderPanel:E,onLayoutChange:v})})]})}function Cm(e,a=exports.DashboardLanguage.PtBr){const{t:t}=y.useTranslation();switch(a){case exports.DashboardLanguage.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case exports.DashboardLanguage.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function km(e){const{t:a}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Sm=[{value:exports.QuickFilterDashboard.All,label:"Todos"},{value:exports.QuickFilterDashboard.OnlyMine,label:e.t("dashboard_my")},{value:exports.QuickFilterDashboard.Favorites,label:"Favoritos"}];function Tm({dashboards:e,limit:r,isLoading:s=!1,language:n=exports.DashboardLanguage.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:d,onEdit:c,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:b,toolbarExtra:v,className:w}){const{t:j}=y.useTranslation(),[N,_]=t.useState(""),[C,k]=t.useState(exports.QuickFilterDashboard.All),[S,T]=t.useState(null),D=t.useCallback(e=>{_(e),g?.(e)},[g]),P=t.useCallback(e=>{k(e),b?.(e)},[b]),A=t.useMemo(()=>{let a=e;if(N){const e=N.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||Cm(a,n).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(C){case exports.QuickFilterDashboard.OnlyMine:break;case exports.QuickFilterDashboard.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,N,C,n]);return a.jsxs("div",{className:Yt("flex flex-col h-full",w),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),r&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.countDashboards,"/",r.maxDashboards,")"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"m21 21-4.3-4.3"})]}),a.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>D(e.target.value),className:Yt("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),v,o&&h&&a.jsxs("button",{onClick:h,className:Yt("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),a.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Sm.map(e=>a.jsx("button",{onClick:()=>P(e.value),disabled:s,className:Yt("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),s&&a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!s&&a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:a.jsxs("tr",{children:[a.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:a.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),a.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:a.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),a.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),a.jsx("th",{className:"w-12 px-3 py-2"})]})}),a.jsxs("tbody",{children:[0===A.length&&a.jsx("tr",{children:a.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),A.map(e=>a.jsxs("tr",{onClick:()=>d?.(e),className:Yt("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[a.jsx("td",{className:"px-3 py-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:a.jsx("svg",{className:Yt("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),a.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),a.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Cm(e,n)}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),a.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&a.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a.jsx("circle",{cx:"9",cy:"7",r:"4"}),a.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:km(e.lastModified)}),a.jsx("td",{className:"px-3 py-2",children:a.jsx("span",{className:Yt("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),a.jsx("td",{className:"px-3 py-2",children:a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:a=>{a.stopPropagation(),T(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:a.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"5",r:"1"}),a.jsx("circle",{cx:"12",cy:"12",r:"1"}),a.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(null)}),a.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"my-1 border-t border-border"}),a.jsx("button",{onClick:a=>{a.stopPropagation(),T(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Dm=[{value:exports.DashboardUpdateTime.NotUpdate,label:e.t("dashboard_no_refresh")},{value:exports.DashboardUpdateTime.FiveMinutes,label:"5 minutos"},{value:exports.DashboardUpdateTime.TenMinutes,label:"10 minutos"},{value:exports.DashboardUpdateTime.FifteenMinutes,label:"15 minutos"},{value:exports.DashboardUpdateTime.ThirtyMinutes,label:"30 minutos"},{value:exports.DashboardUpdateTime.OneHour,label:"1 hora"}],Pm=[{value:exports.DashboardViewType.NormalPage,label:e.t("dashboard_normal_page")},{value:exports.DashboardViewType.Carousel,label:"Carrossel"}],Am=[{value:exports.DashboardPageTime.FiveSeconds,label:"5 segundos"},{value:exports.DashboardPageTime.TenSeconds,label:"10 segundos"},{value:exports.DashboardPageTime.FifteenSeconds,label:"15 segundos"},{value:exports.DashboardPageTime.ThirtySeconds,label:"30 segundos"},{value:exports.DashboardPageTime.OneMinute,label:"1 minuto"},{value:exports.DashboardPageTime.ThreeMinutes,label:"3 minutos"},{value:exports.DashboardPageTime.FiveMinutes,label:"5 minutos"},{value:exports.DashboardPageTime.TenMinutes,label:"10 minutos"}],Em=[{value:exports.DashboardShareType.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:exports.DashboardShareType.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Mm=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Im({dashboard:e,initialTab:r=exports.DashboardFormTab.General,isSaving:s=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:d=[],onSave:c,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=t.useState(r),[g,b]=t.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[v,w]=t.useState(e?.titlePtBr??""),[j,N]=t.useState(e?.titleEnUs??""),[_,C]=t.useState(e?.titleEsEs??""),[k,S]=t.useState(e?.responsibleId??""),[T,D]=t.useState(e?.isActive??!0),[P,A]=t.useState(e?.idUpdateTime??exports.DashboardUpdateTime.NotUpdate),[E,M]=t.useState(e?.idViewType??exports.DashboardViewType.NormalPage),[I,F]=t.useState(e?.idPageTime??exports.DashboardPageTime.FifteenSeconds),[R,L]=t.useState(e?.idShare??exports.DashboardShareType.NotShared),[z,O]=t.useState(e?.groups??[]),[U,V]=t.useState(e?.places??[]),[B,q]=t.useState(e?.collaborators??[]),$=E===exports.DashboardViewType.Carousel,W=g["pt-br"]||g.en||g.es,H=t.useMemo(()=>!!W&&(!(g["pt-br"]&&!v.trim())&&(!(g.en&&!j.trim())&&!(g.es&&!_.trim()))),[W,g,v,j,_]),G=t.useCallback(e=>{b(a=>({...a,[e]:!a[e]}))},[]),K=t.useCallback(()=>{H&&!s&&c?.({titlePtBr:g["pt-br"]?v:"",titleEnUs:g.en?j:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:T,idUpdateTime:P,idViewType:E,idPageTime:$?I:null,idShare:R,groups:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?z:[],places:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?U:[],collaborators:R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators?B:[]})},[H,s,c,g,v,j,_,k,T,P,E,I,$,R,z,U,B]);return a.jsxs("div",{className:Yt("flex flex-col h-full bg-background",m),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&a.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),a.jsxs("button",{onClick:K,disabled:!H||s,className:Yt("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[s?a.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),a.jsxs("div",{className:"flex border-b border-border bg-card",children:[a.jsx("button",{onClick:()=>f(exports.DashboardFormTab.General),className:Yt("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===exports.DashboardFormTab.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a.jsx("button",{onClick:()=>f(exports.DashboardFormTab.Share),className:Yt("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===exports.DashboardFormTab.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),a.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===exports.DashboardFormTab.General&&a.jsxs("div",{className:"max-w-2xl space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),a.jsx("div",{className:"flex gap-2",children:Mm.map(e=>a.jsx("button",{onClick:()=>G(e.key),className:Yt("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&a.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),a.jsx("input",{value:v,onChange:e=>w(e.target.value),maxLength:200,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[v.length,"/200"]})]}),g.en&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),a.jsx("input",{value:j,onChange:e=>N(e.target.value),maxLength:200,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[j.length,"/200"]})]}),g.es&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),a.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),a.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[a.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),a.jsx("select",{value:P,onChange:e=>A(Number(e.target.value)),disabled:n,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Dm.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),a.jsxs("div",{className:"flex items-center gap-3 h-10",children:[a.jsx("button",{onClick:()=>D(!T),disabled:e?.isGeneralViewUse,className:Yt("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",T?"bg-primary":"bg-muted","disabled:opacity-50"),children:a.jsx("span",{className:Yt("inline-block h-4 w-4 rounded-full bg-white transition-transform",T?"translate-x-6":"translate-x-1")})}),a.jsx("span",{className:"text-sm text-foreground",children:T?"Ativo":"Inativo"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),a.jsx("select",{value:E,onChange:e=>M(Number(e.target.value)),disabled:n||$,className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Pm.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),$&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),a.jsx("select",{value:I??"",onChange:e=>F(Number(e.target.value)),className:Yt("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Am.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===exports.DashboardFormTab.Share&&a.jsxs("div",{className:"max-w-2xl space-y-6",children:[a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[a.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 16v-4"}),a.jsx("path",{d:"M12 8h.01"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),a.jsx("div",{className:"space-y-3",children:Em.map(t=>a.jsxs("label",{className:Yt("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",R===t.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[a.jsx("input",{type:"radio",name:"shareType",value:t.value,checked:R===t.value,onChange:()=>L(t.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:t.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t.description})]})]},t.value))}),R===exports.DashboardShareType.SharedWithUsersGroupsPlacesCollaborators&&a.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),a.jsx("select",{multiple:!0,value:z,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);O(a)},className:Yt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",U.length,")"]}),a.jsx("select",{multiple:!0,value:U,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);V(a)},className:Yt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",B.length,")"]}),a.jsx("select",{multiple:!0,value:B,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);q(a)},className:Yt("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:d.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Fm(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Rm(e,a){return{id:a?.id??Fm(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function Lm(e,a){if(e.id===a)return{node:e,parent:null};const t=[];for(const r of e.children??[])t.push({node:r,parent:e});for(;t.length;){const e=t.pop();if(e.node.id===a)return{node:e.node,parent:e.parent};for(const a of e.node.children??[])t.push({node:a,parent:e.node})}return null}function zm(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>zm(e,a))}:t}function Om(e,a,t){return zm(e,e=>e.id===a?t(e):e)}function Um(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Vm(e,a,t){const r=Rm(t||"");let s=r.id;return{root:zm(e,t=>{if(t.id!==a)return t;let n=r;if(t.id===e.id){const a=Um(e);n={...n,side:a.left<=a.right?"left":"right"}}else n={...n,side:t.side};return s=n.id,{...t,collapsed:!1,children:[...t.children??[],n]}}),newId:s}}function Bm(e,a,t){if(e.id===a)return Vm(e,a,t);const r=Lm(e,a);if(!r||!r.parent)return{root:e,newId:a};const s=r.parent,n=Rm(t||"",{side:r.node.side}),o=n.id;return{root:zm(e,e=>{if(e.id!==s.id)return e;const t=(e.children??[]).findIndex(e=>e.id===a),r=[...e.children??[]];return r.splice(t+1,0,n),{...e,children:r}}),newId:o}}function qm(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=Lm(e,a);if(!t||!t.parent)return{root:e,nextSelectedId:null};const r=t.parent,s=r.children??[],n=s.findIndex(e=>e.id===a),o=s[n+1]?.id??s[n-1]?.id??r.id;return{root:zm(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)}),nextSelectedId:o}}function $m(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const r=Lm(e,a);return!!r&&!!Lm(r.node,t)}(e,a,t))return e;const r=Lm(e,a);if(!r)return e;const s=(()=>{if(t===e.id){const a=Um(e);return{...r.node,side:a.left<=a.right?"left":"right"}}const a=Lm(e,t)?.node;return{...r.node,side:a?.side}})(),n=zm(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return zm(n,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],s]})}function Wm(e,a){return Om(e,a,e=>({...e,collapsed:!e.collapsed}))}function Hm(e,a){return zm(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function Gm(e){const{value:a,defaultValue:r,onChange:s,readOnly:n}=e,o=void 0!==a,[i,l]=t.useState(()=>r??a??Rm("Mapa Mental",{id:"root"})),d=o?a:i,[c,u]=t.useState(d.id),m=t.useRef([]),p=t.useRef([]),h=t.useCallback((e,a)=>{n||(m.current.push(a),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),s?.(e))},[o,s,n]),x=t.useCallback((e,a)=>{const t=Om(d,e,e=>({...e,text:a}));h(t,d)},[d,h]),f=t.useCallback((e,a)=>{const t=Om(d,e,e=>({...e,...a}));h(t,d)},[d,h]),g=t.useCallback((e,a="")=>{const{root:t,newId:r}=Vm(d,e,a);return h(t,d),u(r),r},[d,h]),b=t.useCallback((e,a="")=>{const{root:t,newId:r}=Bm(d,e,a);return h(t,d),u(r),r},[d,h]),v=t.useCallback(e=>{const{root:a,nextSelectedId:t}=qm(d,e);a!==d&&(h(a,d),u(t))},[d,h]),y=t.useCallback((e,a)=>{const t=$m(d,e,a);t!==d&&h(t,d)},[d,h]),w=t.useCallback(e=>{const a=Lm(d,e);if(!a||!a.node.children?.length)return;const t=Wm(d,e);h(t,d)},[d,h]),j=t.useCallback(()=>{h(Hm(d,!1),d)},[d,h]),N=t.useCallback(()=>{h(Hm(d,!0),d)},[d,h]),_=t.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(d),o||l(e),s?.(e))},[d,o,s]),C=t.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(d),o||l(e),s?.(e))},[d,o,s]),k=m.current.length>0,S=p.current.length>0,T=t.useMemo(()=>c?Lm(d,c)?.node??null:null,[d,c]),D=t.useCallback(e=>{h(e,d)},[d,h]);return{root:d,setRoot:D,selectedId:c,selectedNode:T,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:b,removeNode:v,moveNode:y,toggleNode:w,expandAll:j,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const Km=180,Ym=80,Qm=16,Xm=60;function Jm(e){const a=(e.collapsed?[]:e.children??[]).map(Jm);if(!a.length)return{node:e,visibleChildren:a,height:44};const t=a.reduce((e,a)=>e+a.height,0)+Qm*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function Zm(e,a,t,r,s,n,o){const i=[],l={node:e.node,parent:a,x:t,y:r,width:180,height:44,side:s,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let d=r+22-(e.visibleChildren.reduce((e,a)=>e+a.height,0)+Qm*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===s?t+180+Ym:t-Ym-Km,r=d+c.height/2-22,l=Zm(c,e.node,a,r,s,n+1,o);i.push(l),d+=c.height+Qm}return l}function ep(e){return t.useMemo(()=>function(e){const a=e.collapsed?[]:e.children??[],t=a.filter(e=>"left"!==e.side).map(Jm),r=a.filter(e=>"left"===e.side).map(Jm),s=t.reduce((e,a)=>e+a.height,0)+Qm*Math.max(0,t.length-1),n=r.reduce((e,a)=>e+a.height,0)+Qm*Math.max(0,r.length-1),o=Math.max(s,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=t.length?Math.max(...t.map(i))+1:0,d=260*(r.length?Math.max(...r.map(i))+1:0),c=220+260*l+d+120,u=o+120,m=Xm+d,p=[],h={node:e,parent:null,x:m,y:Xm+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=Xm+o/2-s/2;for(const b of t){const a=x+b.height/2-22,t=Zm(b,e,m+220+Ym,a,"right",1,p);h.visibleChildren.push(t),x+=b.height+Qm}let f=Xm+o/2-n/2;for(const b of r){const a=f+b.height/2-22,t=Zm(b,e,m-Ym-Km,a,"left",1,p);h.visibleChildren.push(t),f+=b.height+Qm}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:c,height:u}}(e),[e])}function ap(e,a){const{layout:t,selectedId:r,setSelectedId:s}=a;if(!r)return void s(t.nodes[0]?.node.id??null);const n=t.byId.get(r);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const a=n.visibleChildren.find(a=>a.side===e);return void(a&&s(a.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&s(e.node.id)}else n.parent&&s(n.parent.id);return}if(!n.parent)return;const o=t.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===r),d="up"===e?i[l-1]:i[l+1];d&&s(d.node.id)}const tp=({layout:e,selected:t,editing:r,readOnly:s,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:c,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,b=(v=f.icon)?ee[v]??null:null;var v;const y=!!f.children?.length,w=Z.useRef(null),[j,N]=Z.useState(f.text);Z.useEffect(()=>{if(r){N(f.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[r,f.text]);const _=()=>{i(j.trim()||f.text)},C=f.color;return a.jsxs("div",{role:"treeitem","aria-selected":t,"aria-expanded":y?!f.collapsed:void 0,tabIndex:t?0:-1,"data-node-id":f.id,draggable:!s&&!g&&!r,onDragStart:c,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),s||o()},className:Yt("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",t&&!g&&"ring-2 ring-primary ring-offset-1",t&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[b&&a.jsx(b,{className:Yt("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),a.jsx("div",{className:"flex-1 min-w-0",children:r?a.jsx("input",{ref:w,value:j,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:Yt("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?a.jsx("div",{className:"text-sm truncate",children:x(f)}):a.jsx("div",{className:"text-sm truncate",children:f.text||a.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!r&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:Yt("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:a.jsx(d.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),a.jsx(Cs,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&a.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:Yt("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?a.jsx(d.Plus,{className:"h-3 w-3"}):"left"===e.side?a.jsx(d.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?a.jsx(d.ChevronRight,{className:"h-3 w-3"}):a.jsx(d.Minus,{className:"h-3 w-3"})})]})},rp=({parent:e,child:t})=>{const r=t.x+t.width/2<e.x+e.width/2,s=r?e.x:e.x+e.width,n=e.y+e.height/2,o=r?t.x+t.width:t.x,i=t.y+t.height/2,l=(s+o)/2,d=`M ${s} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return a.jsx("path",{d:d,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},sp=({label:e,icon:t,onClick:r,disabled:s})=>a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:s,"aria-label":e,className:"h-8 w-8",children:t})}),a.jsx(Cs,{children:e})]}),np=e=>{const{t:t}=y.useTranslation();return a.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a.jsx(sp,{label:t("mind_map_add_child"),icon:a.jsx(d.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a.jsx(sp,{label:t("mind_map_add_sibling"),icon:a.jsx(d.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a.jsx(sp,{label:t("mind_map_delete_node"),icon:a.jsx(d.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a.jsx(dr,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(sp,{label:t("mind_map_expand_all"),icon:a.jsx(d.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a.jsx(sp,{label:t("mind_map_collapse_all"),icon:a.jsx(d.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a.jsx(dr,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(sp,{label:t("mind_map_zoom_out"),icon:a.jsx(d.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a.jsx(sp,{label:t("mind_map_zoom_in"),icon:a.jsx(d.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a.jsx(sp,{label:t("mind_map_fit_to_screen"),icon:a.jsx(d.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),a.jsx(dr,{orientation:"vertical",className:"mx-1 h-5"}),a.jsx(sp,{label:t("mind_map_undo"),icon:a.jsx(d.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a.jsx(sp,{label:t("mind_map_redo"),icon:a.jsx(d.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a.jsx("div",{className:"flex-1"}),a.jsx(sp,{label:t("mind_map_export_json"),icon:a.jsx(d.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),a.jsx(sp,{label:t("mind_map_export_image"),icon:a.jsx(d.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function op(e){return JSON.stringify(e,null,2)}function ip(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const a=e;if("string"!=typeof a.text)throw new Error('Invalid mind map node: missing "text"');const t=Array.isArray(a.children)?a.children.map(e=>ip(e)):void 0;return Rm(a.text,{id:"string"==typeof a.id?a.id:void 0,collapsed:"boolean"==typeof a.collapsed?a.collapsed:void 0,color:"string"==typeof a.color?a.color:void 0,icon:"string"==typeof a.icon?a.icon:void 0,note:"string"==typeof a.note?a.note:void 0,side:"left"===a.side||"right"===a.side?a.side:void 0,children:t})}function lp({data:e,columns:r,sortField:s,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:c=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:b=!0,onColumnResize:v,enableColumnReorder:w=!1,onReorderColumns:j,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:T=!1,rowActionsVariant:D="default",hideActionsColumn:P=!1,actionsHeaderContent:A}){const{t:E}=y.useTranslation(),M=u||E("no_items_found",E("no_items_found_empty")),[I,F]=t.useState(()=>T?new Set(e.map(e=>e.id)):new Set),R=void 0!==k,L=R?new Set(k):I,z=t.useCallback(e=>{R&&S?S(e):F(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[R,S]),{columnWidths:O,isDragging:U,activeColumn:V,handleMouseDown:B}=fo({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:v,enabled:b}),q=ko({enabled:w&&!!j,onReorder:j??(()=>{})}),$=t.useMemo(()=>{if(b){const e=r.map(e=>O[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return e.map(e=>e/a*100+"%")}const e=r.reduce((e,a)=>a.width?e:e+(a.weight??1),0);return r.map(a=>{if(a.width)return`${a.width}px`;if(a.minWidth&&!a.weight)return`${a.minWidth}px`;const t=(a.weight??1)/e*100;return a.minWidth?`minmax(${a.minWidth}px, ${t}%)`:`${t}%`})},[r,b,O]);if(c)return a.jsx("div",{className:"flex-1 overflow-auto",children:a.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>a.jsx(zs,{className:"h-12 w-full"},t))})});if(0===e.length)return a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"text-center text-muted-foreground",children:a.jsx("p",{children:M})})});const W=l&&!P,H=(p?1:0)+(_?1:0)+r.length+(W?1:0);return a.jsx("div",{className:"flex-1 overflow-auto "+(U?"select-none":""),children:a.jsxs(Rn,{className:Yt("table-fixed w-full",m),children:[a.jsx(Ln,{className:"sticky top-0 bg-background z-10",children:a.jsxs(Un,{children:[_&&a.jsx(Vn,{className:"w-[40px]"}),p&&a.jsx(Vn,{className:"w-[40px]",children:a.jsx(Zr,{checked:g,onCheckedChange:f,"aria-label":E("select_all","Selecionar todos")})}),r.map((e,t)=>{const r=b&&!1!==e.resizable,i=V===String(e.key),l=w&&!!j,c=l?q.getDragProps(t):{},u=q.dragFromIndex===t,m=q.dragOverIndex===t&&q.dragFromIndex!==t;return a.jsxs(Vn,{className:Yt(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&q.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:$[t]},...c,children:[!1!==e.sortable&&o?a.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),s!==p?null:"asc"===n?a.jsx(d.ArrowUp,{size:14,className:"ml-1"}):a.jsx(d.ArrowDown,{size:14,className:"ml-1"}))]}):a.jsx("span",{className:"font-medium",children:e.header}),r&&a.jsx(Yn,{direction:"horizontal",onMouseDown:a=>B(String(e.key),a),isDragging:i})]},String(e.key));var p}),W&&a.jsx(Vn,{className:"w-[80px] text-right",children:A??E("actions","Ações")})]})}),a.jsx(zn,{children:e.map(e=>{const s=_&&L.has(e.id);return a.jsxs(t.Fragment,{children:[a.jsxs(Un,{onClick:()=>i?.(e),className:Yt(i?"cursor-pointer":"","relative","inline"===D&&"group"),children:[_&&a.jsx(Bn,{className:"w-[40px] px-2",children:a.jsx("button",{onClick:a=>{a.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":s?E("collapse_row","Recolher linha"):E("expand_row","Expandir linha"),children:s?a.jsx(d.ChevronDown,{size:16,className:"text-muted-foreground"}):a.jsx(d.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&a.jsx(Bn,{children:a.jsx(Zr,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${E("select_all","Selecionar todos")} ${e.id}`})}),r.map(t=>a.jsx(Bn,{className:t.className,children:a.jsx(Kn,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),W&&a.jsx(Bn,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===D?a.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),s&&C&&a.jsx(Un,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(Bn,{colSpan:H,className:"p-0",children:a.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function dp({searchValue:e="",onSearchChange:t,customFilters:r=[],onClearFilters:s,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||r.length>0;return a.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[t&&a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(er,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>t(e.target.value),className:"pl-9 h-9"})]}),r.map((e,t)=>a.jsx("div",{className:"vertical"===o?"w-full":"",children:e},t)),n&&l&&s&&a.jsxs(Jt,{variant:"ghost",size:"sm",onClick:s,className:"h-9 px-3 whitespace-nowrap",children:[a.jsx(d.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function cp(e,a){const t=new Set;function r(e){if(e)for(const a of e)t.add(a.id),r(a.children)}return function e(t){for(const s of t){if(s.id===a)return r(s.children),!0;if(s.children&&e(s.children))return!0}return!1}(e),t}function up({children:e,itemId:t,enableDrag:r,onDragStartCell:s,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return a.jsx(Bn,{draggable:r,onDragStart:r?e=>s(t,e):void 0,onDragEnd:r?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(t,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(t,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(t,e)},className:l,children:e})}function mp({item:e,level:t,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:c,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*t,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),T=g===e.id&&f!==e.id,D=p?.has(e.id)??!1,P={itemId:e.id,enableDrag:x,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w};return a.jsxs(a.Fragment,{children:[a.jsxs(Un,{className:Yt(l&&"cursor-pointer",k&&"group",S&&"opacity-40",T&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[a.jsx(up,{...P,children:a.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&a.jsx(Zr,{checked:D,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&a.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?a.jsx("button",{onClick:a=>{a.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?a.jsx(d.ChevronDown,{className:"h-4 w-4"}):a.jsx(d.ChevronRight,{className:"h-4 w-4"})}):a.jsx("div",{className:"w-6 shrink-0"}),n??a.jsx(d.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"truncate",children:String(e[s]??e.id)}),f===e.id&&j&&j>1&&a.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:j})]})}),r.map(r=>{const s=e[r.key],n=r.render?r.render(e,t):null!=s?String(s):"—";return a.jsx(up,{...P,className:Yt("text-center",r.className),children:r.hoverContent?a.jsxs(Ll,{openDelay:200,children:[a.jsx(zl,{asChild:!0,children:a.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),a.jsx(Ol,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):n},String(r.key))}),c&&a.jsx(up,{...P,className:"text-right",children:a.jsx("div",{onClick:e=>e.stopPropagation(),className:Yt("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:c(e)})})]}),_&&N&&e.children.map(e=>a.jsx(mp,{item:e,level:t+1,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:c,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j},e.id))]})}function pp({onDrop:t,isDragOver:r,onDragOver:s,onDragLeave:n,label:o}){return a.jsxs("div",{className:Yt("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:s,onDragEnter:s,onDragLeave:n,onDrop:t,children:[a.jsx(d.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function hp(e){const a=N.useNavigate();return{onNew:()=>{const t=e.newPath||`${e.basePath}/new`;a(t)},onEdit:t=>{const r=e.editPath?e.editPath.replace(":id",t.id):`${e.basePath}/${t.id}/edit`;a(r)}}}const xp=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],fp=({open:e,onOpenChange:r,user:s,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:l}=y.useTranslation(),c=t.useRef(null),[u,m]=t.useState(null),[p,h]=t.useState(l.language||"pt-BR"),x=u||n,f=e=>{e||(m(null),h(l.language||"pt-BR")),r(e)};return a.jsx(wr,{open:e,onOpenChange:f,children:a.jsxs(Sr,{className:"sm:max-w-md",children:[a.jsx(Tr,{children:a.jsx(Ar,{children:i("edit_profile","Editar Perfil")})}),a.jsxs("div",{className:"space-y-6 py-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"relative flex-shrink-0",children:a.jsxs(ul,{className:"w-24 h-24",children:[x&&a.jsx(ml,{src:x,alt:s.name||""}),a.jsx(pl,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]})}),a.jsxs("div",{className:"space-y-1",children:[s.name&&a.jsx("p",{className:"text-base font-semibold",children:s.name}),s.email&&a.jsx("p",{className:"text-sm text-muted-foreground",children:s.email}),a.jsxs(Jt,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a.jsx(d.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),a.jsx("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const a=e.target.files?.[0];if(!a)return;const t=URL.createObjectURL(a);m(t)}})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:i("language","Idioma")}),a.jsxs(qr,{value:p,onValueChange:h,children:[a.jsx(Hr,{children:a.jsx(Wr,{})}),a.jsx(Yr,{children:xp.map(e=>a.jsx(Xr,{value:e.value,children:e.label},e.value))})]})]})]}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"outline",onClick:()=>f(!1),children:i("cancel","Cancelar")}),a.jsx(Jt,{onClick:()=>{p!==l.language&&l.changeLanguage(p),r(!1)},children:i("save","Salvar")})]})]})})},gp="true"===(void 0).VITE_SHOW_EDIT_PROFILE,bp=t.memo(({variant:e="card",className:r="",selectedUnit:s,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:c,isAuthenticated:u,logout:m,switchUnit:p}=En(),{role:h}=Qi(),x=h?.name||null,f=l?.[0]||null,g=c?l?.find(e=>e.alias===c):f,b=l||[],v=s||g||f||f,w=t.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48`},[i?.id]),j=t.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),N=t.useCallback(e=>{n?n(e):p(e)},[n,p]),_=t.useMemo(()=>{if(!b?.length)return[];const e=new Map;b.forEach(a=>{e.set(a.alias,a)});const a=Array.from(e.values()),t=a.find(e=>e.alias===v?.alias),r=a.filter(e=>e.alias!==v?.alias);return r.sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"})),t?[t,...r]:r},[b,v?.alias]),[C,k]=t.useState(!1);if(!u||!i)return null;return"dropdown"===e?a.jsxs(a.Fragment,{children:[a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${r}`,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("div",{className:"hidden md:block text-right",children:[a.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),a.jsx("p",{className:"text-xs text-primary-foreground/70",children:v?.name||"N/A"})]}),a.jsxs(ul,{className:"w-8 h-8 border border-primary-foreground/30",children:[w&&a.jsx(ml,{src:w,alt:i.name||o("user_photo")}),a.jsx(pl,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:j||a.jsx(d.User,{className:"h-4 w-4"})})]}),a.jsx(d.ChevronDown,{className:"h-4 w-4"})]})})}),a.jsxs(xs,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[a.jsxs(us,{children:[a.jsxs(ps,{children:[a.jsx(d.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a.jsx(hs,{children:_.map(e=>a.jsxs(fs,{onClick:()=>N(e),className:e.alias===v?.alias?"bg-muted":"",children:[a.jsx(d.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===v?.alias&&a.jsx(ts,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),gp&&a.jsxs(a.Fragment,{children:[a.jsx(ys,{}),a.jsxs(fs,{onClick:()=>k(!0),children:[a.jsx(d.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),a.jsx(ys,{}),a.jsxs(fs,{onClick:m,children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),gp&&a.jsx(fp,{open:C,onOpenChange:k,user:i,userPhotoUrl:w,userInitials:j})]}):a.jsxs(rr,{className:r,children:[a.jsx(sr,{children:a.jsx(nr,{className:"text-lg",children:o("user_info")})}),a.jsxs(ir,{className:"space-y-4",children:[a.jsx(()=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsxs(ul,{className:"w-10 h-10",children:[w&&a.jsx(ml,{src:w,alt:i.name||o("user_photo")}),a.jsx(pl,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:j||a.jsx(d.User,{className:"h-5 w-5"})})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",v?.name||"N/A"]})]})]}),v&&a.jsx("div",{className:"mt-3",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(d.Building2,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:v.name})]})}),_.length>1&&a.jsxs("div",{className:"mt-2",children:[a.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",_.length]}),a.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.slice(0,3).map(e=>a.jsx(ts,{variant:e.alias===v?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>N(e),children:e.name},e.alias)),_.length>3&&a.jsxs(ts,{variant:"outline",className:"text-xs",children:["+",_.length-3]})]})]})]}),{}),a.jsx(dr,{}),a.jsxs(Jt,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[a.jsx(d.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),vp=t.createContext({});function yp({children:e,config:r}){const s=t.useMemo(()=>{const e=Ae(),a=r?.appName?e?`${r.appName} (Dev)`:r.appName:void 0;return{navigation:r?.navigation,appName:a}},[r?.navigation,r?.appName]);return a.jsx(vp.Provider,{value:s,children:e})}function wp(){return t.useContext(vp)}function jp(e,a){if(!e)return"";const t=e.find(e=>e.path===a);if(t)return t.label;const r=e.find(e=>a.startsWith(e.path+"/"));return r?.label||""}function Np(e,a){const[r,s]=t.useState(e),n=t.useRef(),o=t.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return t.useEffect(()=>(o(),n.current=setTimeout(()=>{s(e)},a),o),[e,a,o]),[r,o]}function _p({appName:e}){const[r,s]=t.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between w-[258px]",children:[a.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:a.jsx("img",{src:He.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&a.jsx("button",{className:"min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground/80 hover:text-primary-foreground/60 transition-colors leading-tight py-1",onClick:()=>s(!0),children:a.jsx("span",{className:"line-clamp-2",children:(e=>{const t=e.split(" ");if(t.length<=1)return a.jsxs("span",{className:"whitespace-nowrap",children:[e," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=t[t.length-1],s=t.slice(0,-1).join(" ");return a.jsxs(a.Fragment,{children:[s," ",a.jsxs("span",{className:"whitespace-nowrap",children:[r," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),a.jsx(Ji,{open:r,onOpenChange:s})]})}const Cp=t.memo(function({actions:r}){const s=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=wp(),l=jp(o,s.pathname),{metadata:c,headerActions:u}=ii(),{setOpenMobile:m}=Od(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:b}=En(),v=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,w]=N.useSearchParams(),j=t.useCallback(e=>{const{pathname:a,search:t,hash:r}=s;if(h){const s=a.split("/"),o=s.indexOf(h);if(o>=0)return s[o]=e.alias,void n(s.join("/")+t+r)}b(e)},[h,s,n,b]),[_,C]=t.useState(()=>y.get("search")||""),[k,S]=Np(_,Le.debounceDelay);t.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),w(e)},[k,w,x]);const T=o?.find(e=>e.path===s.pathname)||o?.find(e=>s.pathname.startsWith(e.path+"/")),D=c.title||l,P=c.subtitle||T?.complementaryText||"";return a.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Jt,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:a.jsx(d.Menu,{size:20})}),a.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:a.jsx(_p,{appName:i})}),a.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),a.jsxs("div",{className:"flex-shrink-0",children:[c.breadcrumbs&&c.breadcrumbs.length>0&&a.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:c.breadcrumbs.map((e,t)=>a.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&a.jsx(d.ChevronRight,{className:"h-3 w-3"}),e.href?a.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):a.jsx("span",{children:e.label})]},t))}),a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:D})}),P&&a.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:P})]}),x&&a.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(er,{placeholder:"Pesquisar",value:_,onChange:e=>{return a=e.target.value,void C(a);var a},className:"w-full pl-10 pr-8"}),_&&a.jsx(Jt,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),w(e)},title:e.t("clear_search"),children:a.jsx(d.X,{size:14})})]}),a.jsx(Jt,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:a.jsx(d.RefreshCw,{size:14})})]}),a.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||r)&&a.jsx("div",{className:"flex items-center gap-2",children:u||r}),(void 0).VITE_WIKI_URL&&a.jsx(Jt,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>Gt((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a.jsx(Jc,{}),a.jsx("div",{className:"text-sm",children:a.jsx(bp,{variant:"dropdown",selectedUnit:v,onUnitChange:j})})]})]})})}),kp=({key:e,enabled:a,checkFn:t,staleTime:r=3e5,gcTime:s=6e5})=>j.useQuery({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:r,gcTime:s,retry:0,refetchOnWindowFocus:!1});function Sp({config:e,isCollapsed:t=!1,isDisabled:r=!1,className:s}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=d.Plus,variant:c="button"}=e;if(!o||0===o.length)return null;if("split-button"===c){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(t){const t=a.jsx(Jt,{onClick:e.onClick,disabled:r||e.disabled,className:Yt("justify-center px-2 w-full",s),variant:"outline",size:"default",children:a.jsx(n,{className:"h-4 w-4 shrink-0"})});return a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:t}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:e.label})})]})}return a.jsx(qc,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:r||e.disabled,className:Yt("w-full",s),menuAlign:"start"})}const u=(e,r,s=!1)=>a.jsxs(a.Fragment,{children:[e,!t&&r&&a.jsx("span",{className:"truncate",children:r}),!t&&s&&a.jsx(d.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=r||e.disabled,d=a.jsx(Jt,{onClick:e.onClick,disabled:i,className:Yt("w-full gap-2 justify-start",t&&"justify-center px-2",s),variant:"outline",size:"default",children:u(a.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return t?a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:d}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:e.label})})]}):d}const m=a.jsx(Jt,{disabled:r,className:Yt("w-full gap-2 justify-start",t&&"justify-center px-2",s),variant:"outline",size:"default",children:u(a.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:t?a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:m}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:i})})]}):m}),a.jsx(xs,{align:"start",side:t?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const t=e.icon;return a.jsxs(fs,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[t&&a.jsx(t,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Tp="forlogic-sidebar-pinned",Dp=()=>{try{const e=localStorage.getItem(Tp);return!!e&&JSON.parse(e)}catch{return!1}};function Pp({direction:e="right",minWidth:a=224,maxWidth:r=384,defaultWidth:s=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,d]=t.useState(()=>{if("undefined"==typeof window)return s;const e=localStorage.getItem(n);return e?parseInt(e):s}),[c,u]=t.useState(!1),m=t.useRef(null);t.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=t.useCallback(e=>{e.preventDefault(),u(!0)},[]);return t.useEffect(()=>{if(!c)return;const t=t=>{let s;s="left"===e?window.innerWidth-t.clientX:t.clientX,s=Math.max(a,Math.min(r,s)),d(s),o?.(s)},s=()=>{u(!1),d(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",s)}},[c,e,a,r,l,n,o]),t.useEffect(()=>(c?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[c,e]),{width:l,isDragging:c,dragRef:m,handleMouseDown:p}}const Ap=t.createContext(void 0);function Ep(){const e=t.useContext(Ap);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Mp({config:e,customContent:r,resizable:s=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:c,setOpenMobile:u}=Od(),m=N.useLocation(),{alias:p,user:h}=En(),{appName:x}=wp(),{hasOpenModal:f}=Ep(),[g,b]=t.useState(Dp),v=Fn(),w=!!v||l,j=t.useCallback(()=>{v&&u(!1)},[v,u]),_=s?Pp({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;t.useEffect(()=>{c(!!g)},[g,c]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return a.jsxs(Vd,{collapsible:"icon",className:Yt("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:_&&w?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&a.jsx("div",{className:"py-3",children:a.jsx(js,{children:a.jsx(Sp,{config:e.moduleActions,isCollapsed:!w,isDisabled:f})})}),a.jsx(Yd,{className:Yt(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||a.jsx(Qd,{className:"p-0",children:a.jsx(Zd,{children:a.jsx(ec,{className:"gap-1",children:a.jsx(js,{children:e?.navigation?.map((e,t)=>{if("separator"===e.type)return a.jsx(Kd,{className:"my-2"},`sep-${t}`);const r=({item:e,index:t})=>{const s=`${e.path}-${t}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=kp({key:s,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,c=o?d.Loader2:l?d.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?a.jsx(wi,{defaultOpen:!0,className:"group/collapsible",children:a.jsxs(ac,{children:[a.jsx(ji,{asChild:!0,children:a.jsx(rc,{size:"default",children:a.jsxs("div",{className:"flex w-full items-center gap-3",children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4"})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label}),a.jsx(d.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),a.jsx(Ni,{children:a.jsx(ic,{children:e.children.map((e,t)=>a.jsx(r,{item:e,index:t},e.path))})})]})},e.path):a.jsx(ac,{children:a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("div",{className:Yt("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:a.jsx(c,{className:"h-4 w-4"})})}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:e.label})})]})},e.path):a.jsx(ac,{children:l||o?a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:w?a.jsx(rc,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:a.jsxs("div",{className:"flex w-full items-center gap-3",children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):a.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:a.jsx(c,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):w?a.jsx(rc,{asChild:!0,isActive:C(e.path),size:"default",children:a.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:j,children:[a.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:a.jsx(c,{className:"h-4 w-4"})}),a.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(N.Link,{to:e.path,onClick:j,className:Yt("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:a.jsx(c,{className:"h-4 w-4"})})}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:e.label})})]})},e.path)};return a.jsx(r,{item:e,index:t},e.path)})})})})})}),!v&&a.jsx("div",{className:Yt("mt-auto pb-4 pt-2 flex",l?"justify-end":"justify-center"),children:a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;b(e),(e=>{try{localStorage.setItem(Tp,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?a.jsx(d.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):a.jsx(d.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a.jsx(Cs,{side:"right",children:a.jsx("p",{children:l?"Recolher":"Expandir"})})]})}),s&&_&&w&&a.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:Yt("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}const Ip=t.memo(function({children:e,sidebar:r,sidebarConfig:s,showHeader:n=!0}){const o=t.useMemo(()=>r||a.jsx(Mp,{config:s}),[r,s]),i=t.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),l=t.useRef(null),d=t.useRef(null),c=t.useCallback(()=>{if(l.current&&d.current){const e=l.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return t.useEffect(()=>{c();const e=new ResizeObserver(c);return l.current&&e.observe(l.current),()=>e.disconnect()},[c]),a.jsx(yp,{config:s,children:a.jsx(oi,{children:a.jsx(Ud,{defaultOpen:!1,style:i,children:a.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&a.jsx("div",{ref:l,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:a.jsx(Cp,{})}),a.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[o,a.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class Fp{static async sendEmail(e){const a=cn(),{data:t,error:r}=await a.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return t}}const Rp=Fp;function Lp(e){const[a,r]=t.useState(!1),{uploadFunction:s,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:d}=e||{};return{upload:async(e,a)=>{if(!s){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}r(!0);try{const t={...o,...a};if(t.maxSize&&e.size>t.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(t.maxSize/1024/1024)}MB`);if(t.allowedTypes){if(!t.allowedTypes.some(a=>a.endsWith("/*")?e.type.startsWith(a.replace("/*","")):e.type===a))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${t.allowedTypes.join(", ")}`)}const r=await s(e,t);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(r),r}catch(t){const e=t instanceof Error?t:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),d?.(e),e}finally{r(!1)}},deleteMedia:async(e,a)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function zp(e){const a=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const t of a){const a=e.match(t);if(a)return a[1]}return null}function Op(e,a){const t=zp(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function Up(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function Vp(e,a){const t=Up(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function Bp(e){if(!e)return;const a=e.match(/src="([^"]+)"/);return a?a[1]:void 0}function qp(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function $p(e,a){return e/a}const Wp=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function Hp(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const a=e/1024;if(a<1024)return`${Math.round(a)} KB`;const t=a/1024;if(t<1024)return`${Math.round(t)} MB`;const r=t/1024;return Math.round(100*r)/100+" GB"}function Gp(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}var Kp,Yp,Qp;function Xp(e){switch(e.type){case exports.ECustomFormFieldType.text:return e.textValue;case exports.ECustomFormFieldType.number:return e.numberValue;case exports.ECustomFormFieldType.date:return e.dateValue;case exports.ECustomFormFieldType.time:return e.timeValue;case exports.ECustomFormFieldType.url:case exports.ECustomFormFieldType.singleSelection:case exports.ECustomFormFieldType.multiSelection:return e.itemsValue;case exports.ECustomFormFieldType.questions:return e.questionsValue;case exports.ECustomFormFieldType.readOnlyText:return e.textValue;default:return null}}function Jp(e,a){if(!a)return!0;const t=null!=Xp(e)&&""!==Xp(e)&&!(Array.isArray(Xp(e))&&0===Xp(e).length);return!1!==e.isActive||t}function Zp({field:e}){return a.jsxs("div",{className:"space-y-1",children:[e.name&&a.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&a.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function eh({field:e,readOnly:t,onChange:r}){const s=e.config,n=s?.multiline??!1,o=t||e.readOnly,i=a=>{r?.({...e,textValue:a})};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?a.jsx(es,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):a.jsx(er,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function ah({field:e,readOnly:t,onChange:r}){const s=t||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(er,{type:"date",value:n,onChange:a=>{return t=a.target.value,void r?.({...e,dateValue:t||void 0});var t},placeholder:e.placeholder,disabled:s})]})}function th({field:e,readOnly:t,onChange:r}){const s=t||e.readOnly,n=e=>{if(!e)return;const[a,t]=e.split(":").map(Number);return 60*a+t};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(er,{type:"time",value:(e=>{if(null==e)return"";const a=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`})(e.timeValue),onChange:a=>r?.({...e,timeValue:n(a.target.value)}),placeholder:e.placeholder,disabled:s})]})}function rh({field:e,readOnly:r,onChange:s}){const n=e.config,o=n?.multiple??!1,i=r||e.readOnly,[l,c]=t.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const a={value:crypto.randomUUID(),text:l.trim()};s?.({...e,itemsValue:[...u,a]}),c("")};if(!o){const t=u[0]?.text||"";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(er,{type:"url",value:t,onChange:a=>(a=>{const t={value:a,text:a};s?.({...e,itemsValue:a?[t]:[]})})(a.target.value),placeholder:e.placeholder||"https://",disabled:i}),t&&a.jsx(Jt,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:a.jsx(d.ExternalLink,{className:"h-4 w-4"})})})]})]})}return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(er,{type:"url",value:l,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a.jsx(Jt,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:a.jsx(d.Plus,{className:"h-4 w-4"})})]}),u.length>0&&a.jsx("div",{className:"space-y-1",children:u.map((t,r)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("a",{href:t.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:t.text}),!i&&a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(a=>{const t=u.filter((e,t)=>t!==a);s?.({...e,itemsValue:t})})(r),children:a.jsx(d.Trash2,{className:"h-3 w-3"})})]},t.value))})]})}function sh({field:e,readOnly:t,onChange:r}){const s=e.config,n=t||e.readOnly,o=null!=s?.decimals&&s.decimals>0?(1/Math.pow(10,s.decimals)).toString():"1";return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx(er,{type:"number",value:e.numberValue??"",onChange:a=>(a=>{if(""===a)return void r?.({...e,numberValue:void 0});const t=parseFloat(a);isNaN(t)||r?.({...e,numberValue:t})})(a.target.value),placeholder:e.placeholder,disabled:n,min:s?.min,max:s?.max,step:o}),null!=s?.min&&null!=s?.max&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",s.min," | Max: ",s.max]})]})}function nh({field:e,readOnly:t,onChange:r}){const s=e.config,n=t||e.readOnly,o=s?.viewMode??exports.EFieldViewMode.dropdown,i=s?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],l=e.itemsValue?.[0]?.value||"",d=a=>{const t=i.find(e=>e.value===a);if(!t)return;const s={value:t.value,text:t.text,isActive:t.isActive};r?.({...e,itemsValue:[s]})};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===exports.EFieldViewMode.dropdown&&a.jsxs(qr,{value:l,onValueChange:d,disabled:n,children:[a.jsx(Hr,{children:a.jsx(Wr,{placeholder:e.placeholder||"Selecione..."})}),a.jsx(Yr,{children:i.map(e=>a.jsxs(Xr,{value:e.value,children:[e.text,!1===e.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===exports.EFieldViewMode.radio||o===exports.EFieldViewMode.buttons)&&a.jsx(jd,{value:l,onValueChange:d,disabled:n,className:Yt(o===exports.EFieldViewMode.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(t=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Nd,{value:t.value,id:`${e.id}-${t.value}`}),a.jsxs(tr,{htmlFor:`${e.id}-${t.value}`,className:"text-sm font-normal cursor-pointer",children:[t.text,!1===t.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},t.value))}),!n&&l&&!e.required&&a.jsx("button",{type:"button",onClick:()=>{r?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function oh({field:e,readOnly:t,onChange:r}){const s=e.config,n=t||e.readOnly,o=s?.viewMode??exports.EFieldViewMode.dropdown,i=s?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(t=>a.jsxs(ts,{variant:"secondary",className:"gap-1 pr-1",children:[a.jsx("span",{className:"text-xs",children:t.text}),!n&&a.jsx("button",{type:"button",onClick:()=>(a=>{const t=(e.itemsValue||[]).filter(e=>e.value!==a);r?.({...e,itemsValue:t})})(t.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:a.jsx(d.X,{className:"h-3 w-3"})})]},t.value))}),!n&&a.jsx("div",{className:Yt(o===exports.EFieldViewMode.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(t=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zr,{id:`${e.id}-${t.value}`,checked:l.has(t.value),onCheckedChange:()=>(a=>{const t=e.itemsValue||[],s=t.some(e=>e.value===a.value)?t.filter(e=>e.value!==a.value):[...t,{value:a.value,text:a.text,isActive:a.isActive}];r?.({...e,itemsValue:s})})(t),disabled:n}),a.jsxs(tr,{htmlFor:`${e.id}-${t.value}`,className:"text-sm font-normal cursor-pointer",children:[t.text,!1===t.isActive&&a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},t.value))})]})}function ih({field:e,readOnly:t,onChange:r}){const s=e.config,n=t||e.readOnly,o=s?.questions||[],i=s?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{children:e.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{className:Yt(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),a.jsx("div",{className:"border rounded-md overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50",children:[a.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>a.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),a.jsx("tbody",{children:o.map((t,s)=>a.jsxs("tr",{className:Yt(s<o.length-1&&"border-b"),children:[a.jsx("td",{className:"p-2 text-muted-foreground",children:t.text}),i.map(s=>{return a.jsx("td",{className:"text-center p-2",children:a.jsx(jd,{value:(o=t.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:a=>((a,t,s,n)=>{const o={questionValue:a,questionText:t,optionValue:s,optionText:n},i=l.filter(e=>e.questionValue!==a);i.push(o),r?.({...e,questionsValue:i})})(t.value,t.text,a,s.text),disabled:n,className:"flex justify-center",children:a.jsx(Nd,{value:s.value,id:`${e.id}-${t.value}-${s.value}`})})},s.value);var o})]},t.value))})]})})]})}function lh({field:e,readOnly:t,onChange:r}){const s={field:e,readOnly:t,onChange:r};switch(e.type){case exports.ECustomFormFieldType.readOnlyText:return a.jsx(Zp,{...s});case exports.ECustomFormFieldType.text:return a.jsx(eh,{...s});case exports.ECustomFormFieldType.date:return a.jsx(ah,{...s});case exports.ECustomFormFieldType.time:return a.jsx(th,{...s});case exports.ECustomFormFieldType.url:return a.jsx(rh,{...s});case exports.ECustomFormFieldType.number:return a.jsx(sh,{...s});case exports.ECustomFormFieldType.singleSelection:return a.jsx(nh,{...s});case exports.ECustomFormFieldType.multiSelection:return a.jsx(oh,{...s});case exports.ECustomFormFieldType.questions:return a.jsx(ih,{...s});default:return null}}function dh({open:r,onOpenChange:s,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:d=[],setDefaultApproverOnInit:c=!0,onSubmit:u}){const[m,p]=t.useState(!0),[h,x]=t.useState(c&&n.length>0?n[0].id:null),[f,g]=t.useState(o),b=e=>{p(e),e&&!c?x(null):!e&&!c&&n.length>0&&x(n[0].id)},v=f!==o||!m;return a.jsx(wr,{open:r,onOpenChange:s,children:a.jsxs(Sr,{className:"sm:max-w-[480px]",variant:"form",isDirty:v,children:[a.jsx(Tr,{children:a.jsx(Ar,{children:i})}),a.jsxs("div",{className:"space-y-4",children:[d.length>0&&a.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:d.map((e,t)=>a.jsx("p",{dangerouslySetInnerHTML:{__html:e}},t))}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>b(!0),className:"accent-primary"}),a.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>b(!1),className:"accent-primary"}),a.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{children:"Etapa"}),a.jsxs(qr,{value:h??void 0,onValueChange:x,disabled:m,children:[a.jsx(Hr,{children:a.jsx(Wr,{placeholder:e.t("approval_select_step")})}),a.jsx(Yr,{children:n.map(e=>a.jsx(Xr,{value:e.id,children:e.name},e.id))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(tr,{children:e.t("approval_opinion")}),a.jsx(es,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),a.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),a.jsx(Jt,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!v,children:"Concluir"})]})]})})}function ch({open:e,onOpenChange:r,approvers:s,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[d,c]=t.useState(null),u=t.useMemo(()=>{const e=new Set(o);return s.filter(a=>!e.has(a.id))},[s,o]),m=t.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return a.jsx(wr,{open:e,onOpenChange:r,children:a.jsxs(Sr,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!d,children:[a.jsx(Tr,{children:a.jsx(Ar,{children:l("approval_select_approver")})}),a.jsx(ns,{isLoading:n,type:"spinner",children:a.jsx("div",{className:"space-y-4",children:a.jsx(Vs,{options:m,value:d??void 0,onValueChange:e=>c("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a.jsx(Jt,{onClick:()=>{if(!d)return;const e=u.find(e=>e.id===d);e&&i(e)},disabled:!d||n,children:"Concluir"})]})]})})}exports.ECustomFormFieldType=void 0,(Kp=exports.ECustomFormFieldType||(exports.ECustomFormFieldType={}))[Kp.readOnlyText=1]="readOnlyText",Kp[Kp.text=2]="text",Kp[Kp.date=3]="date",Kp[Kp.time=4]="time",Kp[Kp.url=5]="url",Kp[Kp.number=6]="number",Kp[Kp.singleSelection=7]="singleSelection",Kp[Kp.multiSelection=8]="multiSelection",Kp[Kp.questions=9]="questions",exports.EFieldViewMode=void 0,(Yp=exports.EFieldViewMode||(exports.EFieldViewMode={}))[Yp.dropdown=1]="dropdown",Yp[Yp.buttons=2]="buttons",Yp[Yp.radio=3]="radio",Yp[Yp.checkbox=4]="checkbox",exports.ESelectionFieldDataSource=void 0,(Qp=exports.ESelectionFieldDataSource||(exports.ESelectionFieldDataSource={}))[Qp.custom=1]="custom",Qp[Qp.users=2]="users",Qp[Qp.usersLists=3]="usersLists";function uh(e){const{t:a}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function mh({text:e,maxLength:r=130}){const{t:s}=y.useTranslation(),[n,o]=t.useState(!1);return e.length<=r?a.jsx("span",{children:e}):a.jsxs("span",{children:[n?e:`${e.substring(0,r)}... `,a.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:s(n?"approval_read_less":"approval_read_more")})]})}function ph({approver:e}){if(1===e.type&&e.approverId)return a.jsxs(ul,{className:"h-9 w-9 shrink-0",children:[a.jsx(ml,{src:e.photoUrl,alt:e.name}),a.jsx(pl,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const t=2===e.type?d.Users:3===e.type?d.MapPin:d.User;return a.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:a.jsx(t,{className:"h-4 w-4 text-background"})})}function hh({approver:e}){return e.date?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[a.jsx(d.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:uh(e.date)}),1!==e.type&&e.approvedUsername&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[a.jsx(d.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:uh(e.returnDate)})]}):a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[a.jsx(d.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function xh({approver:e}){const{t:t}=y.useTranslation(),r=1!==e.type||e.approverId?e.name:"A definir";return a.jsxs("div",{children:[2===e.type&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t("approval_user_group")}),3===e.type&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),a.jsx("p",{className:"text-sm font-medium break-words",children:r}),a.jsx(hh,{approver:e})]})}var fh;exports.ApprovalFlowReturnStep=void 0,(fh=exports.ApprovalFlowReturnStep||(exports.ApprovalFlowReturnStep={}))[fh.ApprovalFlow=1]="ApprovalFlow",fh[fh.Association=2]="Association",exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AUTH_CONFIG=Fe,exports.AccessDeniedDialog=Zi,exports.Accordion=il,exports.AccordionContent=cl,exports.AccordionItem=ll,exports.AccordionTrigger=dl,exports.ActionButton=Zt,exports.ActionMenu=Zt,exports.ActionMenuItems=mo,exports.Alert=ti,exports.AlertDescription=si,exports.AlertDialog=cr,exports.AlertDialogAction=vr,exports.AlertDialogCancel=yr,exports.AlertDialogContent=hr,exports.AlertDialogDescription=br,exports.AlertDialogFooter=fr,exports.AlertDialogHeader=xr,exports.AlertDialogOverlay=pr,exports.AlertDialogPortal=mr,exports.AlertDialogTitle=gr,exports.AlertDialogTrigger=ur,exports.AlertTitle=ri,exports.AliasRedirect=function(){const{alias:e}=En(),{pathname:t,search:r,hash:s}=N.useLocation();return e?a.jsx(N.Navigate,{to:`/${e}${t}${r}${s}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:r="alias"}){const s=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:d,switchUnit:c}=En(),{urlAlias:u,isAliasMismatch:m,isValidAlias:p,isMissing:h,matchedCompany:x}=Zo({paramName:r}),[f,g]=t.useState(!1),b=t.useRef(!1),v=r in o,y=t.useCallback(e=>{const a=o[r],{pathname:t,search:s,hash:i}=n;if(a){const r=t.split("/"),n=r.findIndex(e=>e===a);if(n>=0)return r[n]=e,r.join("/")+s+i}return`/${e}${"/"===t?"":t}${s}${i}`},[o,r,n]);return t.useEffect(()=>{if(v&&!d&&l&&i&&!b.current)if(h)s(y(i),{replace:!0});else if(!u||p){if(m&&x&&!b.current){(async()=>{b.current=!0,g(!0);try{await c(x)}catch(e){i&&s(y(i),{replace:!0})}finally{b.current=!1,g(!1)}})()}}else s(y(i),{replace:!0})},[v,d,l,i,h,u,p,m,x,c,y,s]),d||!l?a.jsx(a.Fragment,{children:e}):f?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(ss,{size:"lg"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a.jsx(a.Fragment,{children:e})},exports.AppHeader=Cp,exports.AppLayout=Ip,exports.AppSidebar=Mp,exports.ApprovalSidenav=function({config:e,isLoading:r=!1,onClose:s,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:c=!1}){const{t:u}=y.useTranslation(),[m,p]=t.useState(!1),[h,x]=t.useState(!1),[f,g]=t.useState(""),[b,v]=t.useState(""),[w,j]=t.useState(!1),[N,_]=t.useState(""),C=r||m,k=t.useCallback((e,a)=>{g(e),v(a??""),x(!0)},[]),S=t.useCallback(async a=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...a}))return k(f,a.observation),void p(!1);s(),p(!1)},[e.associationId,f,n,s,k]),T=t.useCallback(e=>{_(e),j(!0)},[]),D=t.useCallback(async a=>{j(!1),p(!0),await o(e.associationId,N,a),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),P=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],A=(a,t)=>e.canApprove&&a.isCurrentStep&&t.approverId&&!t.date&&t.canApprove,E=(a,t)=>!e.flowReproved&&a.isCurrentStep&&1===t.type&&t.canApprove&&(!t.approverId||t.isToBeDefined);return a.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[a.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[a.jsx(Jt,{variant:"ghost",size:"icon",onClick:s,className:"shrink-0",children:a.jsx(d.X,{className:"h-5 w-5"})}),a.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?a.jsx(ns,{isLoading:!0,type:"spinner",className:"flex-1",children:a.jsx("div",{})}):a.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&a.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,t)=>a.jsx("div",{className:Yt("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},t))}),a.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(t=>a.jsxs("div",{className:Yt("space-y-2",(!t.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[a.jsxs("p",{className:"font-semibold text-sm",children:[t.index,". Etapa: ",t.name]}),t.description&&a.jsx("p",{className:"text-sm text-muted-foreground break-words",children:a.jsx(mh,{text:t.description})}),t.returnDate&&a.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.returnUserName," em ",uh(t.returnDate)]})]}),t.returnObservation&&a.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a.jsx(mh,{text:t.returnObservation})})]}),t.approvers.map(e=>a.jsxs("div",{className:"p-2 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx(ph,{approver:e}),a.jsx(xh,{approver:e})]}),A(t,e)&&a.jsx(Jt,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),E(t,e)&&a.jsx(Jt,{size:"sm",variant:"outline",onClick:()=>T(e.id),children:"Selecionar"})]}),e.observation&&a.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a.jsx(mh,{text:e.observation})}),e.returnObservation&&a.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a.jsx(mh,{text:e.returnObservation})})]},e.id))]},t.id))]}),a.jsx(dh,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:b,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),a.jsx(ch,{open:w,onOpenChange:j,approvers:l,isLoading:c,ignoreUserIds:P,onSubmit:D})]})},exports.ApproveDialog=dh,exports.AuthErrorInterceptor=pn,exports.AuthProvider=An,exports.AuthService=Sn,exports.AutoComplete=Vs,exports.Avatar=ul,exports.AvatarFallback=pl,exports.AvatarImage=ml,exports.Badge=ts,exports.BaseForm=Bo,exports.Blockquote=rd,exports.BodyContent=function({breadcrumbs:e,children:t,className:r}){return a.jsxs("div",{className:Yt("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",r),children:[e&&e.length>0&&a.jsx(hl,{className:"mb-4",children:a.jsx(xl,{children:e.map((t,r)=>{const s=r===e.length-1;return a.jsxs(Z.Fragment,{children:[r>0&&a.jsx(vl,{}),a.jsx(fl,{children:s||!t.href?a.jsx(bl,{children:t.label}):t.asChild&&t.children?a.jsx(gl,{asChild:!0,children:t.children}):a.jsx(gl,{asChild:!0,children:a.jsx(N.Link,{to:t.href||"/",children:t.label})})})]},`${t.label}-${r}`)})})}),a.jsx("div",{className:"space-y-6",children:t})]})},exports.Breadcrumb=hl,exports.BreadcrumbEllipsis=yl,exports.BreadcrumbItem=fl,exports.BreadcrumbLink=gl,exports.BreadcrumbList=xl,exports.BreadcrumbPage=bl,exports.BreadcrumbSeparator=vl,exports.BurndownPanel=xm,exports.Button=Jt,exports.ButtonGroup=jl,exports.CRUD_CONFIG=Re,exports.CURRENCY_FIELDS=Bu,exports.Calendar=Nl,exports.CallbackPage=()=>{const{processCallback:e}=En(),r=N.useNavigate(),[s,n]=t.useState(null),[o,i]=t.useState(!1);t.useEffect(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),r(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e,r]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(a){n(a?.message||"Erro ao tentar novamente.")}finally{i(!1)}},c=()=>{window.location.href="/"};return s?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsxs(nr,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a.jsx(d.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),a.jsxs(ir,{className:"space-y-4",children:[a.jsx(ti,{variant:"danger",children:a.jsx(si,{children:s})}),a.jsx("div",{className:"text-sm text-muted-foreground",children:a.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Jt,{onClick:l,disabled:o,className:"flex-1",children:o?a.jsxs(a.Fragment,{children:[a.jsx(ss,{size:"sm",className:"mr-2"}),"Tentando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a.jsx(Jt,{onClick:c,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsx(nr,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),a.jsxs(ir,{className:"text-center",children:[a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx(ss,{size:"lg"})}),a.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=rr,exports.CardContent=ir,exports.CardDescription=or,exports.CardFooter=lr,exports.CardHeader=sr,exports.CardSkeleton=Wn,exports.CardTitle=nr,exports.CartesianPanel=cm,exports.ChartContainer=Pc,exports.ChartLegend=Ic,exports.ChartLegendContent=Fc,exports.ChartStyle=Ac,exports.ChartTooltip=Ec,exports.ChartTooltipContent=Mc,exports.Checkbox=Zr,exports.Collapsible=wi,exports.CollapsibleContent=Ni,exports.CollapsibleTrigger=ji,exports.ColorPicker=Mo,exports.ColumnSettingsPopover=So,exports.ComboTree=Gs,exports.Combobox=Vs,exports.Command=Ps,exports.CommandDialog=({children:e,...t})=>a.jsx("div",{...t,children:a.jsx(Ps,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=Ms,exports.CommandGroup=Is,exports.CommandInput=As,exports.CommandItem=Rs,exports.CommandList=Es,exports.CommandSeparator=Fs,exports.CommandShortcut=Ls,exports.ContentContainer=function({title:e,subtitle:t,children:r,className:s,hasHeader:n=!0}){const o=e||t;return a.jsxs("div",{className:Yt("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",s),children:[n&&o&&a.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),t&&a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t})]}),r&&a.jsx("div",{className:Yt("p-6",!n&&o&&"pt-4"),children:r})]})},exports.ContextMenu=Qn,exports.ContextMenuCheckboxItem=oo,exports.ContextMenuContent=so,exports.ContextMenuGroup=Jn,exports.ContextMenuItem=no,exports.ContextMenuLabel=lo,exports.ContextMenuPortal=Zn,exports.ContextMenuRadioGroup=ao,exports.ContextMenuRadioItem=io,exports.ContextMenuSeparator=co,exports.ContextMenuShortcut=uo,exports.ContextMenuSub=eo,exports.ContextMenuSubContent=ro,exports.ContextMenuSubTrigger=to,exports.ContextMenuTrigger=Xn,exports.CoreProviders=function({children:r,queryClient:s,moduleAlias:n,moduleAccessGuardProps:o,appTranslations:i,clarityProjectId:l,clarityMode:d="auto",backend:c="supabase"}){Me(c),rl();const[u]=t.useState(()=>new j.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),m=s??u;t.useEffect(()=>{if(i)for(const[e,a]of Object.entries(i))mi(e,a)},[i]);const p={sourceModule:n,...o};return a.jsxs(_i,{children:[a.jsx(ol,{}),a.jsx(y.I18nextProvider,{i18n:e,children:a.jsx(j.QueryClientProvider,{client:m,children:a.jsxs(An,{children:[a.jsx(nl,{projectId:l,mode:d}),a.jsx(fi,{children:a.jsx(vi,{moduleAlias:n,children:a.jsx(al,{...p,children:r})})})]})})})]})},exports.CrudActionBar=jo,exports.CrudActionMenu=function({onEdit:e,onDelete:r,onToggleStatus:s,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:c="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=t.useMemo(()=>{const a=[];return e&&o&&a.push({key:"edit",icon:d.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),s&&a.push({key:"toggle-status",icon:n?d.PowerOff:d.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:s,variant:"default"}),l.forEach(e=>{!1!==e.show&&a.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),r&&i&&a.push({key:"delete",icon:d.Trash2,label:m("remove","Remover"),onClick:r,variant:"destructive"}),a},[e,r,s,n,o,i,l,m]);return 0===p.length?null:"dropdown"===c?a.jsx(js,{delayDuration:200,children:a.jsxs(is,{children:[a.jsx(ls,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a.jsx(d.EllipsisVertical,{size:"compact"===u?14:16})})}),a.jsx(xs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?a.jsxs(ks,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):a.jsxs(fs,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):a.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>a.jsxs(Jt,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&a.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&a.jsx("span",{className:"ml-1",children:e.label})]},e.key))})},exports.CrudGrid=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:c,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:b=!1,searchValue:v,onSearchChange:w,searchPlaceholder:j,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:T,onViewModeChange:D,listCardRenderer:P,gridCardRenderer:A,showViewToggle:E=!1})=>{const{setSearchVisible:M}=En(),I=void 0!==f?!f:g;t.useEffect(()=>{if(!b)return M(!0),()=>M(!1)},[M,b]);const F=m||x.length>0||b||u||C||E,R=_||(()=>{r.bulkDelete?.(r.selectedIds)}),L=T||"grid",z="list"===L,O={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],U=I&&F?a.jsx(jo,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:b,searchValue:v,onSearchChange:w,searchPlaceholder:j,showBulkActions:u,selectedCount:r.selectedIds.length,bulkActions:N,onBulkDelete:R,onClearSelection:r.clearSelection,customActions:x,filters:C,viewMode:L,onViewModeChange:D,showViewToggle:E,availableViewModes:["list","grid"]}):null;return r.isLoading?a.jsxs("div",{className:"flex flex-col h-full",children:[U,a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx(Wn,{count:6})})]}):0===r.entities.length?a.jsxs("div",{className:"flex flex-col h-full",children:[U,a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(Gn,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):a.jsxs("div",{className:"flex flex-col h-full",children:[U,a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("div",{className:Yt("grid gap-4",O),children:r.entities.map(e=>{const t=(e=>{const{t:a}=y.useTranslation();return z&&P?P(e):!z&&A?A(e):S?S(e):null})(e);return a.jsxs(Qn,{children:[a.jsx(Xn,{asChild:!0,children:t?a.jsx("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:t}):a.jsx(rr,{className:Yt("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&r.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:a=>{a.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:a.jsxs(ir,{className:Yt("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&a.jsx("div",{className:Yt(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a.jsx(No,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),z?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:s.map(t=>a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground truncate",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key)))}),(n||o||d)&&a.jsx("div",{onClick:e=>e.stopPropagation(),children:d?d(e):a.jsx(po,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]}):a.jsxs("div",{className:"flex items-start gap-3",children:[u&&a.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a.jsx(No,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[s.map((t,r)=>a.jsxs("div",{className:Yt("flex justify-between items-start gap-2",r!==s.length-1&&"mb-2"),children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[t.header,":"]}),a.jsx("div",{className:"text-sm text-foreground text-right truncate",children:t.render?t.render(e):String(e[t.key]??"")})]},String(t.key))),(n||o||d)&&a.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):a.jsx(po,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]})]})]})})}),a.jsx(so,{className:"w-[160px]",children:a.jsx(mo,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:c?c(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=Qo,exports.CrudPagination=$o,exports.CrudPrimitiveFilterBar=dp,exports.CrudPrimitivePagination=qo,exports.CrudPrimitiveTable=lp,exports.CrudTable=Do,exports.CustomFormFields=function({fields:e,readOnly:r=!1,hideInactiveWithoutValue:s=!1,onChange:n,onFieldChange:o}){const i=t.useCallback(a=>{if(o?.(a),n){const t=e.map(e=>e.id===a.id?a:e);n(t)}},[e,n,o]),l=e.filter(e=>Jp(e,s));return 0===l.length?null:a.jsx("div",{className:"space-y-4",children:l.map(e=>a.jsx(lh,{field:e,readOnly:r,onChange:i},e.id))})},exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=At,exports.DEFAULT_DATETIME_FORMAT=It,exports.DEFAULT_LOCALE=Mt,exports.DEFAULT_TIMEZONE=Ft,exports.DashboardForm=Im,exports.DashboardGeneralView=function({dashboards:e,limit:r,generalView:s,language:n=exports.DashboardLanguage.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:d=!1,canEditStandard:c=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:b=!1,onOpen:v,onBackToList:y,onRefresh:w,onRefreshList:j,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:T,onAddPanel:D,onEditPanel:P,onRemovePanel:A,onDuplicatePanel:E,onLayoutChange:M,onSearch:I,onQuickFilterChange:F,onSetGeneralView:R,viewState:L,onViewStateChange:z,listToolbarExtra:O,viewToolbarActions:U,className:V}){const[B,q]=t.useState({mode:"list"}),$=L??B,W=t.useCallback(e=>{z?z(e):q(e)},[z]),H=t.useMemo(()=>"view"===$.mode||"edit"===$.mode||"share"===$.mode?e.find(e=>e.id===$.dashboardId)??null:null,[e,$]),[G,K]=t.useState(!1),[Y,Q]=t.useState(m[0]?.id);t.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),t.useEffect(()=>{if("view"!==$.mode||!H||H.idViewType!==exports.DashboardViewType.Carousel||m.length<=1)return;const e=function(e){switch(e){case exports.DashboardPageTime.FiveSeconds:return 5e3;case exports.DashboardPageTime.TenSeconds:return 1e4;case exports.DashboardPageTime.FifteenSeconds:return 15e3;case exports.DashboardPageTime.ThirtySeconds:return 3e4;case exports.DashboardPageTime.OneMinute:return 6e4;case exports.DashboardPageTime.ThreeMinutes:return 18e4;case exports.DashboardPageTime.FiveMinutes:return 3e5;case exports.DashboardPageTime.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),a=setInterval(()=>{Q(e=>{const a=(m.findIndex(a=>a.id===e)+1)%m.length;return m[a]?.id})},e);return()=>clearInterval(a)},[$,H,m]);const X=t.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),v?.(e)},[W,v]),J=t.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=t.useCallback(()=>{W({mode:"create"})},[W]),ee=t.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),ae=t.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),te=t.useCallback(e=>{"edit"===$.mode||"share"===$.mode?C?.($.dashboardId,e):_?.(e)},[$,_,C]),re=t.useCallback(()=>{"edit"===$.mode||"share"===$.mode?W({mode:"view",dashboardId:$.dashboardId}):W({mode:"list"})},[$,W]),se=t.useCallback(()=>{H&&N?.(H)},[H,N]),ne=t.useCallback(()=>{H&&ee(H)},[H,ee]),oe=t.useCallback(()=>{H&&ae(H)},[H,ae]);return a.jsxs("div",{className:Yt("flex flex-col h-full",V),children:["list"===$.mode&&a.jsx(Tm,{dashboards:e,limit:r,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:d,onOpen:X,onEdit:ee,onShare:ae,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:j,onSearch:I,onQuickFilterChange:F,toolbarExtra:O,className:"flex-1"}),"view"===$.mode&&H&&a.jsxs("div",{className:"flex flex-col h-full",children:[!G&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[a.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),s?.dashboardId===H.id&&a.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[a.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),a.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&R&&s?.dashboardId!==H.id&&a.jsx("button",{onClick:()=>R(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),a.jsx(_m,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||c&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:w,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:se,onEdit:ne,onShare:oe,onAddPanel:D,onEditPanel:P,onRemovePanel:A,onDuplicatePanel:E,onLayoutChange:M,onPageChange:Q,toolbarActions:U,className:"flex-1"})]}),"create"===$.mode&&a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:a.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),a.jsx(Im,{users:h,groups:x,places:f,collaborators:g,isSaving:b,onSave:te,onCancel:re,className:"flex-1"})]}),("edit"===$.mode||"share"===$.mode)&&H&&a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:a.jsxs("button",{onClick:re,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),a.jsx(Im,{dashboard:H,initialTab:"share"===$.mode?exports.DashboardFormTab.Share:exports.DashboardFormTab.General,users:h,groups:x,places:f,collaborators:g,isSaving:b,isQualitfy:!!H.isStandard&&!c,onSave:te,onCancel:re,className:"flex-1"})]})]})},exports.DashboardGrid=wm,exports.DashboardList=Tm,exports.DashboardPanelRenderer=Nm,exports.DashboardView=_m,exports.DataFilterBar=dp,exports.DataList=_l,exports.DataPagination=qo,exports.DataTable=lp,exports.DatePicker=function({date:e,onDateChange:t,placeholder:r,disabled:s=!1,className:n,disabledDates:o}){const{t:l}=y.useTranslation(),c=r??l("select_date");return a.jsxs(Ss,{children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",disabled:s,className:Yt("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[a.jsx(d.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Dt}):a.jsx("span",{children:c})]})}),a.jsx(Ds,{className:"w-auto p-0",align:"start",children:a.jsx(Nl,{mode:"single",selected:e,onSelect:t,disabled:o,initialFocus:!0,className:"pointer-events-auto"})})]})},exports.Dialog=wr,exports.DialogBody=Dr,exports.DialogClose=_r,exports.DialogContent=Sr,exports.DialogDescription=Er,exports.DialogFooter=Pr,exports.DialogHeader=Tr,exports.DialogOverlay=Cr,exports.DialogPortal=Nr,exports.DialogTitle=Ar,exports.DialogTrigger=jr,exports.DialogWizard=function({open:t,onOpenChange:r,currentStep:s,onStepChange:n,steps:o,canGoToStep:i,children:l,title:c,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:b="lg",unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:T}=y.useTranslation(),D=o.length,P=s>=D,A=s<=1;return a.jsx(wr,{open:t,onOpenChange:r,children:a.jsxs(Sr,{size:b,variant:f,isDirty:g,unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:Yt("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[a.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[a.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),a.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,t)=>{const r=t+1,o=r===s,l=(e=>e<s)(r),c=(u=r)<=s||!i||i(u);var u;return a.jsxs("button",{type:"button",onClick:()=>(e=>{e!==s&&(e<s?n(e):i&&!i(e)||n(e))})(r),disabled:!c,className:Yt("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&c&&"hover:bg-primary-foreground/10 cursor-pointer",!c&&"opacity-40 cursor-not-allowed"),children:[a.jsx("span",{className:Yt("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?a.jsx(d.Check,{className:"h-3.5 w-3.5"}):r}),a.jsx("span",{className:Yt("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},r)})})]}),a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs(Tr,{className:"p-6 pb-0",children:[a.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",s," de ",D]}),a.jsx(Ar,{children:c}),u&&a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a.jsx(Dr,{className:"px-6",children:l}),!k&&a.jsx(Pr,{className:"px-6 pb-6",children:a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("div",{className:"flex items-center gap-2",children:S}),a.jsxs("div",{className:"flex items-center gap-2",children:[!A&&a.jsx(Jt,{variant:"outline",onClick:()=>n(s-1),children:x}),P?a.jsx(Jt,{onClick:m,disabled:C,children:p}):a.jsx(Jt,{onClick:()=>n(s+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=ks,exports.Drawer=Cl,exports.DrawerClose=Tl,exports.DrawerContent=Pl,exports.DrawerDescription=Il,exports.DrawerFooter=El,exports.DrawerHeader=Al,exports.DrawerOverlay=Dl,exports.DrawerPortal=Sl,exports.DrawerTitle=Ml,exports.DrawerTrigger=kl,exports.DropdownMenu=is,exports.DropdownMenuCheckboxItem=gs,exports.DropdownMenuContent=xs,exports.DropdownMenuGroup=ds,exports.DropdownMenuItem=fs,exports.DropdownMenuLabel=vs,exports.DropdownMenuPortal=cs,exports.DropdownMenuRadioGroup=ms,exports.DropdownMenuRadioItem=bs,exports.DropdownMenuSeparator=ys,exports.DropdownMenuShortcut=ws,exports.DropdownMenuSub=us,exports.DropdownMenuSubContent=hs,exports.DropdownMenuSubTrigger=ps,exports.DropdownMenuTrigger=ls,exports.ElectronicSignatureDialog=function({open:r,onOpenChange:s,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:c=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,b=g?e.t("esign_password_description"):e.t("esign_code_description"),v=m??b,[y,w]=t.useState(""),[j,N]=t.useState(!1),[_,C]=t.useState(!1),[k,S]=t.useState(null),T=t.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(w(""),s(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,s,f,g]),D=t.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),P=e=>{e||(w(""),S(null)),s(e)},A=g?d.Lock:d.ShieldCheck,E=g?"Senha":e.t("verification_code"),M=g?e.t("enter_password"):e.t("enter_code");return a.jsx(wr,{open:r,onOpenChange:P,children:a.jsxs(Sr,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[a.jsx(Tr,{children:a.jsxs(Ar,{className:"flex items-center gap-2",children:[a.jsx(A,{className:"h-5 w-5 text-primary"}),u]})}),a.jsxs("div",{className:"py-4 space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:v}),!g&&l&&a.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[a.jsx(d.Mail,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),a.jsx("span",{className:"font-medium",children:l})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"signature-input",children:E}),a.jsx(er,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),T())},maxLength:g?void 0:c,placeholder:M,autoFocus:!0,className:Yt(k&&"border-destructive focus-visible:ring-destructive")}),k&&a.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&a.jsxs(Jt,{variant:"ghost",size:"sm",onClick:D,disabled:_,className:"text-primary",children:[a.jsx(d.RefreshCw,{className:Yt("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"outline",onClick:()=>P(!1),disabled:j,children:h}),a.jsx(Jt,{onClick:T,disabled:!y.trim()||j,children:j?"Validando...":p})]})]})})},exports.EllipsisText=Kn,exports.EmailService=Fp,exports.EmptyState=Gn,exports.EntitySelect=Vs,exports.ErrorBoundary=_i,exports.ExportDialog=function({open:e,onOpenChange:r,onExport:s,mode:n="table",options:o,title:i,description:l,cancelLabel:d="Cancelar",exportLabel:c="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=t.useState(""),h=o??("chart"===n?Hc:Wc),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),r(e)};return a.jsx(wr,{open:e,onOpenChange:g,children:a.jsxs(Sr,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[a.jsx(Tr,{children:a.jsx(Ar,{children:x})}),a.jsxs("div",{className:"py-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),a.jsx(jd,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(Nd,{value:e.value,id:`export-${e.value}`}),a.jsxs(tr,{htmlFor:`export-${e.value}`,className:Yt("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"outline",onClick:()=>g(!1),children:d}),a.jsx(Jt,{onClick:()=>{m&&(s(m),r(!1),p(""))},disabled:!m,children:c})]})]})})},exports.FORBIDDEN_FILE_TYPES=Wp,exports.FilterBar=Yo,exports.Form=Mr,exports.FormControl=Or,exports.FormDateField=ah,exports.FormDescription=Ur,exports.FormField=({...e})=>a.jsx(Ir.Provider,{value:{name:e.name},children:a.jsx(h.Controller,{...e})}),exports.FormItem=Lr,exports.FormLabel=zr,exports.FormMessage=Vr,exports.FormMultiSelectionField=oh,exports.FormNumericField=sh,exports.FormQuestionsField=ih,exports.FormSingleSelectionField=nh,exports.FormSkeleton=function({fields:e=4}){return a.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(zs,{className:"h-4 w-24"}),a.jsx(zs,{className:"h-10 w-full"})]},t)),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[a.jsx(zs,{className:"h-10 w-20"}),a.jsx(zs,{className:"h-10 w-20"})]})]})},exports.FormTextField=eh,exports.FormTimeField=th,exports.FormUrlField=rh,exports.Grid=function({children:e,cols:t="auto-fit",gap:r="md",className:s}){return a.jsx("div",{className:Yt("grid",Fl[t],Rl[r],s),children:e})},exports.H1=Gl,exports.H2=Kl,exports.H3=Yl,exports.H4=Ql,exports.HeaderSkeleton=function(){return a.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(zs,{className:"h-8 w-8 rounded-full"}),a.jsx(zs,{className:"h-6 w-32"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(zs,{className:"h-8 w-8"}),a.jsx(zs,{className:"h-8 w-24"})]})]})},exports.HoverCard=Ll,exports.HoverCardContent=Ol,exports.HoverCardTrigger=zl,exports.IconPicker=zo,exports.IframeDialog=ou,exports.ImageEditor=function({value:e,onChange:r,onSubmit:s,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:c}){const{t:u}=y.useTranslation(),[m,p]=t.useState(e||{alignment:"center",allowDownload:!1}),h=t.useRef(null),{upload:x,uploading:f}=Lp({uploadFunction:o,deleteFunction:i,defaultOptions:{...c,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,a)=>{const t={...m,[e]:a};p(t),r(t)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(er,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await x(a),t={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(t),r(t)}catch(t){}finally{h.current&&(h.current.value="")}},className:"hidden"}),a.jsx(Jt,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"Preview"}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:a.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:a.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"caption",children:"Legenda"}),a.jsx(es,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"alt",children:u("alt_text")}),a.jsx(er,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"Alinhamento"}),a.jsxs(qr,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[a.jsx(Hr,{children:a.jsx(Wr,{})}),a.jsxs(Yr,{children:[a.jsx(Xr,{value:"left",children:"Esquerda"}),a.jsx(Xr,{value:"center",children:"Centro"}),a.jsx(Xr,{value:"right",children:"Direita"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"width",children:"Largura"}),a.jsx(er,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"height",children:"Altura"}),a.jsx(er,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zr,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),a.jsx(tr,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a.jsx(Jt,{variant:"outline",onClick:n,children:"Cancelar"}),a.jsx(Jt,{onClick:()=>{m.imageUrl?s(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:t="",style:r}){const{t:s}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return a.jsx("div",{className:`flex ${n} my-4 ${t}`,style:r,children:a.jsxs("div",{className:"space-y-2 max-w-full",children:[a.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&a.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&a.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[a.jsx(d.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=td,exports.Input=er,exports.InputGroup=Ul,exports.InputGroupAddon=Bl,exports.InputGroupButton=$l,exports.InputGroupInput=Wl,exports.InputGroupTextarea=Hl,exports.LINK_PROPERTIES=qu,exports.LOGO_CONFIG=qe,exports.Label=tr,exports.Large=Zl,exports.Lead=Jl,exports.List=sd,exports.ListPanel=im,exports.LoadingState=ns,exports.LocaleProvider=fi,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsx(nr,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),a.jsxs(ir,{className:"text-center space-y-4",children:[a.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a.jsx(Jt,{onClick:async()=>{Oe()?await Sn.loginDev():Sn.loginProd()},className:"w-full",size:"lg",children:Oe()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=$e,exports.MODULES_DATA=qi,exports.MONTHS_MAP=Vu,exports.MatrixRiskPanel=gm,exports.Menubar=fc,exports.MenubarCheckboxItem=jc,exports.MenubarContent=yc,exports.MenubarGroup=mc,exports.MenubarItem=wc,exports.MenubarLabel=_c,exports.MenubarMenu=uc,exports.MenubarPortal=pc,exports.MenubarRadioGroup=xc,exports.MenubarRadioItem=Nc,exports.MenubarSeparator=Cc,exports.MenubarShortcut=kc,exports.MenubarSub=hc,exports.MenubarSubContent=vc,exports.MenubarSubTrigger=bc,exports.MenubarTrigger=gc,exports.MindMap=({value:e,defaultValue:r,onChange:s,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:d,className:c,height:u=600})=>{const{t:m}=y.useTranslation(),p=Gm({value:e,defaultValue:r,onChange:s,readOnly:o}),h=ep(p.root),x=function(){const[e,a]=t.useState({x:0,y:0,scale:1}),r=t.useRef(!1),s=t.useRef({x:0,y:0,tx:0,ty:0}),n=t.useCallback(a=>{0!==a.button&&1!==a.button||(r.current=!0,s.current={x:a.clientX,y:a.clientY,tx:e.x,ty:e.y},a.currentTarget.setPointerCapture(a.pointerId))},[e.x,e.y]),o=t.useCallback(e=>{r.current&&a(a=>({...a,x:s.current.tx+(e.clientX-s.current.x),y:s.current.ty+(e.clientY-s.current.y)}))},[]),i=t.useCallback(e=>{if(r.current){r.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=t.useCallback((e,t,r)=>{a(a=>{const s=Math.min(2.5,Math.max(.3,a.scale+e));if(s===a.scale)return a;if(void 0===t||void 0===r)return{...a,scale:s};const n=s/a.scale;return{scale:s,x:t-(t-a.x)*n,y:r-(r-a.y)*n}})},[]),d=t.useCallback(()=>l(.15),[l]),c=t.useCallback(()=>l(-.15),[l]),u=t.useCallback(()=>a({x:0,y:0,scale:1}),[]),m=t.useCallback((e,t,r,s)=>{const n=Math.min((r-64)/e,(s-64)/t,1.5),o=Math.max(.3,n);a({scale:o,x:(r-e*o)/2,y:(s-t*o)/2})},[]),p=t.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const a=e.currentTarget.getBoundingClientRect(),t=e.clientX-a.left,r=e.clientY-a.top;l(e.deltaY>0?-.1:.1,t,r)},[l]);return t.useEffect(()=>{const e=()=>r.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:a,zoomIn:d,zoomOut:c,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=Z.useRef(null),g=Z.useRef(null),b=Z.useRef(null),[v,w]=Z.useState(null),[j,N]=Z.useState(null);Z.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:a,containerRef:r,onStartEditing:s,readOnly:n,extraShortcuts:o}){t.useEffect(()=>{const t=t=>{const i=r.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=t.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const d={layout:a,selectedId:e.selectedId,setSelectedId:e.setSelectedId},c=e.selectedId;for(const a of o??[])if(a.key.toLowerCase()===t.key.toLowerCase()&&!!a.ctrl===(t.ctrlKey||t.metaKey)&&!!a.shift===t.shiftKey&&!!a.alt===t.altKey)return t.preventDefault(),void a.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((t.ctrlKey||t.metaKey)&&"z"===t.key.toLowerCase())return t.preventDefault(),void(t.shiftKey?e.redo():e.undo());if("ArrowUp"===t.key)return t.preventDefault(),void ap("up",d);if("ArrowDown"===t.key)return t.preventDefault(),void ap("down",d);if("ArrowLeft"===t.key)return t.preventDefault(),void ap("left",d);if("ArrowRight"===t.key)return t.preventDefault(),void ap("right",d);if(c){if(" "===t.key)return t.preventDefault(),void e.toggleNode(c);if("F2"===t.key){if(n)return;return t.preventDefault(),void s(c)}if(!n){if("Enter"===t.key&&!t.shiftKey)return t.preventDefault(),c===e.root.id?e.addChild(c,""):e.addSibling(c,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Insert"===t.key||"Tab"===t.key)return t.preventDefault(),e.addChild(c,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Delete"===t.key||"Backspace"===t.key){if(c===e.root.id)return;return t.preventDefault(),void e.removeNode(c)}}}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,a,r,s,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||w(e)},readOnly:o,extraShortcuts:l});const _=Z.useRef(!1);Z.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:a,clientHeight:t}=e;a>0&&t>0&&h.width>0&&(x.fitTo(h.width,h.height,a,t),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,T=Z.useRef(null),D=e=>a=>{if(o)return;const t=T.current;if(!t||t===e)return;const r=Lm(p.root,t);r&&Lm(r.node,e)||(a.preventDefault(),a.dataTransfer.dropEffect="move",N(e))},P=()=>N(null),A=e=>a=>{a.preventDefault();const t=T.current;N(null),T.current=null,t&&t!==e&&p.moveNode(t,e)};return a.jsx(js,{children:a.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:Yt("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",c),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&a.jsx(np,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");w(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void w(e)}const e=p.addSibling(C,"");w(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,a,t="application/json"){const r=new Blob([e],{type:t}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=a,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(op(p.root),"mind-map.json")},onExportImage:async()=>{if(b.current)try{await async function(e,a="mind-map.png"){const t=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(t),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,n=new Image;await new Promise((e,a)=>{n.onload=()=>e(),n.onerror=()=>a(new Error("Failed to load SVG snapshot")),n.src=s});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const d=l.getContext("2d");if(!d)throw new Error("Canvas 2D context unavailable");d.fillStyle="#ffffff",d.fillRect(0,0,l.width,l.height),d.drawImage(n,0,0,l.width,l.height);const c=await new Promise(e=>l.toBlob(e,"image/png"));if(!c)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(c),m=document.createElement("a");m.href=u,m.download=a,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(b.current,"mind-map.png")}catch(e){}}}),a.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:a.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[a.jsx("svg",{ref:b,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(t=>a.jsx(rp,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),h.nodes.map(e=>{return a.jsx(tp,{layout:e,selected:C===e.node.id,editing:v===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>w(e.node.id),onFinishEditing:a=>{null!==a&&p.renameNode(e.node.id,a),w(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(t=e.node.id,e=>{o||t===p.root.id||(T.current=t,e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="move")}),onDragOver:D(e.node.id),onDragLeave:P,onDrop:A(e.node.id),isDropTarget:j===e.node.id,renderNodeContent:d},e.node.id);var t})]})})]})})},exports.ModalStateProvider=function({children:e}){const[r,s]=t.useState(new Set),[n,o]=t.useState(!1),i=t.useCallback(e=>{s(a=>{const t=new Set(a);return t.add(e),t})},[]),l=t.useCallback(e=>{s(a=>{const t=new Set(a);return t.delete(e),t})},[]),d=t.useCallback(e=>{o(e)},[]),c=t.useMemo(()=>r.size>0||n,[r,n]),u=t.useMemo(()=>({openModals:r,hasOpenModal:c,registerModal:i,unregisterModal:l,setHasOpenModal:d}),[r,c,i,l,d]);return a.jsx(Ap.Provider,{value:u,children:e})},exports.ModuleAccessGuard=al,exports.ModuleGrid=Hi,exports.ModuleOfferContent=function({title:e,description:t,image:r,icon:s,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),c=n??l("want_to_know_more");return a.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(r||s)&&a.jsx("div",{className:"flex items-center justify-center",children:r?a.jsx("img",{src:r,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):s?a.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:a.jsx(s,{className:"h-12 w-12 text-primary"})}):null}),a.jsxs("div",{className:"space-y-3 max-w-lg",children:[a.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t})]}),i?a.jsx("div",{className:"w-full",children:i}):o?a.jsxs(Jt,{onClick:o,size:"lg",className:"gap-2",children:[a.jsx(d.Sparkles,{className:"h-4 w-4"}),c]}):null]})},exports.ModuleProvider=vi,exports.ModulesContent=Gi,exports.ModulesDialog=Ji,exports.ModulesFooterCards=Bi,exports.MultiSelect=Vs,exports.MultiselectPermissions=function({items:r,categories:s,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:c=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:b,onDisclaimerClick:v,className:w}){const[j,N]=t.useState(s[0]?.id??""),[_,C]=t.useState(""),[k,S]=t.useState([]),[T,D]=t.useState(!1),P=t.useMemo(()=>cu(n[j]),[n,j]),A=t.useMemo(()=>function(e){const{t:a}=y.useTranslation(),t=new Set;if(!e)return t;for(const r of e)r.inheritedIds?.forEach(e=>t.add(e));return t}(n[j]),[n,j]),E=t.useMemo(()=>r.filter(e=>P.has(e.id)),[r,P]),M=t.useMemo(()=>{const e=du(_);return r.filter(a=>!P.has(a.id)&&!(e&&!du(a.name).includes(e)))},[r,P,_]),I=t.useMemo(()=>{const e={};for(const a of s)e[a.id]=cu(n[a.id]).size;return e},[s,n]),F=t.useCallback(e=>{N(e),S([]),C("")},[]),R=t.useCallback(e=>{S(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),L=t.useCallback(()=>{if(0===k.length)return;const e=[...n[j]??[]];for(const a of k){const t=r.find(e=>e.id===a),s=t?.group??"default",n=e.find(e=>e.context===s);n?n.allowedIds.includes(a)||(n.allowedIds=[...n.allowedIds,a]):e.push({context:s,allowedIds:[a],inheritedIds:[]})}o({...n,[j]:e}),S([]),C(""),D(!1)},[k,n,j,r,o]),z=t.useCallback(e=>{if(A.has(e))return;const a=(n[j]??[]).map(a=>({...a,allowedIds:a.allowedIds.filter(a=>a!==e)}));o({...n,[j]:a})},[n,j,A,o]);return l?a.jsxs("div",{className:Yt("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[a.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),a.jsx("div",{className:"h-9 w-full bg-muted rounded"}),a.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):a.jsx("div",{className:Yt("rounded-md border bg-muted/30",w),children:a.jsxs("div",{className:"p-4 space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:c}),a.jsxs(qr,{value:j,onValueChange:F,children:[a.jsx(Hr,{className:"h-9 text-sm",children:a.jsx(Wr,{})}),a.jsx(Yr,{children:s.map(e=>a.jsx(Xr,{value:e.id,children:a.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,I[e.id]>0&&a.jsx(ts,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:I[e.id]})]})},e.id))})]})]}),!i&&a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Ss,{open:T,onOpenChange:D,children:[a.jsx(Ts,{asChild:!0,children:a.jsxs(Jt,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,a.jsx(d.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ds,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[a.jsx("div",{className:"p-2 border-b",children:a.jsxs("div",{className:"relative",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(er,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),a.jsx(Io,{className:"max-h-[220px]",children:0===M.length?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):a.jsx("div",{className:"p-1",children:M.map(e=>{const t=k.includes(e.id);return a.jsxs("div",{className:Yt("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",t&&"bg-accent/50"),onClick:()=>R(e.id),children:[a.jsx("div",{className:Yt("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",t&&"bg-primary text-primary-foreground"),children:t&&a.jsx(d.Check,{className:"h-3 w-3"})}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&a.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),a.jsxs(Jt,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:L,children:[a.jsx(d.Plus,{className:"h-4 w-4"}),u]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:m}),a.jsx("div",{className:Yt("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===E.length?a.jsx("span",{className:"text-sm text-muted-foreground",children:p}):a.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(e=>{const t=A.has(e.id);return a.jsxs(ts,{variant:t?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!t&&a.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:a.jsx(d.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",b&&v&&a.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:v,children:b})]})]})]})})},exports.Muted=ad,exports.NavigationMenu=nd,exports.NavigationMenuContent=cd,exports.NavigationMenuIndicator=pd,exports.NavigationMenuItem=id,exports.NavigationMenuLink=ud,exports.NavigationMenuList=od,exports.NavigationMenuTrigger=dd,exports.NavigationMenuViewport=md,exports.NavigationProvider=yp,exports.NumericPanel=nm,exports.OnboardingDialog=Bc,exports.OnlineEditorDialog=function({open:e,onOpenChange:r,identifier:s,fileName:n,mode:o="edit",type:i="document",onClose:l,className:c}){const[u,m]=t.useState(!0),p=function(e,a="edit",t="document"){return`https://docs.google.com/${t}/d/${e}/${a}?usp=drivesdk?embedded=true&rm=demo`}(s,o,i);t.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=t.useCallback(()=>{l?.(),r(!1)},[l,r]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,h]),a.jsx(wr,{open:e,onOpenChange:r,children:a.jsxs(Sr,{className:Yt("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",c),children:[a.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?a.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):a.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),a.jsx("div",{className:"flex items-center ml-4 z-20",children:a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(Cs,{children:"Fechar"})]})})]}),a.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?a.jsx(ss,{className:"h-14 w-14"}):a.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[a.jsx(ss,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=Xl,exports.PageBreadcrumb=function({items:e,maxItems:t=3,className:r}){const s=e.length>t?[e[0],...e.slice(-(t-1))]:e,n=e.length>t;return a.jsx(hl,{className:r,children:a.jsx(xl,{children:s.map((e,t)=>{const r=0===t,s=n&&1===t;return a.jsxs(fl,{children:[!r&&a.jsx(vl,{}),s&&a.jsxs(a.Fragment,{children:[a.jsx(yl,{}),a.jsx(vl,{})]}),e.isCurrentPage?a.jsx(bl,{children:e.label}):a.jsx(gl,{asChild:!0,children:a.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=oi,exports.Pagination=hd,exports.PaginationContent=xd,exports.PaginationEllipsis=yd,exports.PaginationItem=fd,exports.PaginationLink=gd,exports.PaginationNext=vd,exports.PaginationPrevious=bd,exports.PanelError=em,exports.PanelHeader=Zu,exports.PanelLoader=am,exports.PanelNoData=tm,exports.PanelUnavailable=rm,exports.ParetoPanel=hm,exports.PerformancePanel=fm,exports.PiePanel=pm,exports.Popover=Ss,exports.PopoverContent=Ds,exports.PopoverTrigger=Ts,exports.Progress=wd,exports.ProtectedRoute=({children:r})=>{const{isAuthenticated:s,isLoading:n}=En();if(t.useEffect(()=>{if(n)return;if(s)return;if(rn.isManualLogout())return void(window.location.href="/login");const e=new URLSearchParams(window.location.search),a=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,t=new URLSearchParams(a);if(e.has("access_token")||t.has("access_token"))return;const r=Oe(),o=window.location.pathname+window.location.search+window.location.hash;["/","/login","/callback"].includes(window.location.pathname)||localStorage.setItem("auth_return_url",o);(async()=>{r?await Sn.loginDev():Sn.loginProd()})()},[s,n]),n&&!s)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsx(nr,{className:"text-xl font-semibold",children:"Carregando..."})}),a.jsxs(ir,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!s){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsx(nr,{className:"text-xl font-semibold",children:"Processando..."})}),a.jsxs(ir,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:a.jsxs(rr,{className:"w-full max-w-md",children:[a.jsx(sr,{className:"text-center",children:a.jsx(nr,{className:"text-xl font-semibold",children:"Iniciando..."})}),a.jsxs(ir,{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:Oe()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a.jsx(a.Fragment,{children:r})},exports.QUALIEX_CONFIG=Be,exports.QUERY_KEYS={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},exports.QualiexEnrichmentService=wn,exports.QualiexErrorInterceptor=hn,exports.QualiexUserField=Vo,exports.RadioGroup=jd,exports.RadioGroupItem=Nd,exports.ReadOnlyTextField=Zp,exports.ReportRequestList=function({requests:e,isLoading:r=!1,onGetReportUrl:s,formatDate:n=hu,labels:o,className:i}){const{t:l}=y.useTranslation(),c={...mu,...o},[u,m]=t.useState(""),[p,h]=t.useState(!1),[x,f]=t.useState(""),[g,b]=t.useState(""),[v,w]=t.useState(null),j=t.useMemo(()=>{if(!u)return e;const a=pu(u);return e.filter(e=>pu(e.reportName).includes(a))},[e,u]),N=t.useCallback(async e=>{if(!v){w(e.id);try{const a=await s(e.id);a&&(f(a),b(e.reportName),h(!0))}finally{w(null)}}},[s,v]);return r?a.jsx("div",{className:Yt("space-y-3",i),children:Array.from({length:5}).map((e,t)=>a.jsx(zs,{className:"h-12 w-full"},t))}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Yt("space-y-3",i),children:[a.jsxs("div",{className:"relative max-w-sm",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(er,{className:"pl-8 h-9 text-sm",placeholder:c.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),a.jsx(Io,{className:"rounded-md border",children:a.jsxs(Rn,{children:[a.jsx(Ln,{children:a.jsxs(Un,{children:[a.jsx(Vn,{className:"min-w-[140px]",children:c.report}),a.jsx(Vn,{className:"min-w-[150px]",children:c.status}),a.jsx(Vn,{className:"min-w-[160px]",children:c.requestDate}),a.jsx(Vn,{className:"min-w-[160px]",children:c.lastUpdate}),a.jsx(Vn,{className:"min-w-[160px]",children:c.expirationDate}),a.jsx(Vn,{className:"min-w-[140px]"})]})}),a.jsx(zn,{children:0===j.length?a.jsx(Un,{children:a.jsx(Bn,{colSpan:6,className:"text-center text-muted-foreground py-8",children:c.noResults})}):j.map(e=>{const t=function(e){const{t:a}=y.useTranslation();return new Date>new Date(e.expirationDate)&&e.statusId===exports.ReportRequestStatus.Completed?exports.ReportRequestStatus.Expired:e.statusId}(e),r=function(e,t){const{t:r}=y.useTranslation();switch(e){case exports.ReportRequestStatus.WaitingProcessing:return{label:t.statusWaiting,icon:a.jsx(d.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case exports.ReportRequestStatus.Processing:return{label:t.statusProcessing,icon:a.jsx(d.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case exports.ReportRequestStatus.Completed:return{label:t.statusCompleted,icon:a.jsx(d.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case exports.ReportRequestStatus.Error:return{label:t.statusError,icon:a.jsx(d.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case exports.ReportRequestStatus.Expired:return{label:t.statusExpired,icon:a.jsx(d.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(t,c),s=t===exports.ReportRequestStatus.Completed,o=t===exports.ReportRequestStatus.Expired;return a.jsxs(Un,{children:[a.jsx(Bn,{className:"font-medium",children:e.reportName}),a.jsx(Bn,{children:a.jsxs(ts,{variant:r.variant,className:Yt("gap-1",r.className),children:[r.icon,r.label]})}),a.jsx(Bn,{className:"text-sm",children:n(new Date(e.requestDate))}),a.jsx(Bn,{className:"text-sm",children:n(new Date(e.lastUpdate))}),a.jsx(Bn,{className:Yt("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),a.jsx(Bn,{children:a.jsxs(Jt,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!s||v===e.id,onClick:()=>N(e),children:[v===e.id?a.jsx(d.Loader2,{className:"h-4 w-4 animate-spin"}):a.jsx(d.Eye,{className:"h-4 w-4"}),c.viewReport]})})]},e.id)})})]})})]}),a.jsx(ou,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ResizableHandle=({withHandle:e,className:t,...r})=>a.jsx(Ne.PanelResizeHandle,{className:Yt("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...r,children:e&&a.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:a.jsx(d.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=_d,exports.ResizablePanelGroup=({className:e,...t})=>a.jsx(Ne.PanelGroup,{className:Yt("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),exports.RichTextEditor=({value:r,onChange:s,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:c=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=t.useState("visual"),x=q.useEditor({extensions:[$.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:r||"",editable:!n,onUpdate:({editor:e})=>{s(e.getHTML())}});Z.useEffect(()=>{x&&r!==x.getHTML()&&x.commands.setContent(r||"")},[r,x]);const f=t.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,a=window.prompt("URL",e);null!==a&&(""!==a?x.chain().focus().extendMarkRange("link").setLink({href:a}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?a.jsxs("div",{className:Yt("space-y-2",u),children:[l&&a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsxs(Jt,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[a.jsx(d.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),a.jsxs(Jt,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[a.jsx(d.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),a.jsxs(Jt,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[a.jsx(d.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),c&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",a.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&a.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[a.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[a.jsx(Lc,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:a.jsx(d.Heading1,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:a.jsx(d.Heading2,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:a.jsx(d.Heading3,{className:"h-4 w-4"})}),a.jsx(zc,{}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:a.jsx(d.Bold,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:a.jsx(d.Italic,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:a.jsx(d.Underline,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:a.jsx(d.Strikethrough,{className:"h-4 w-4"})}),a.jsx(zc,{}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:a.jsx(d.List,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:a.jsx(d.ListOrdered,{className:"h-4 w-4"})}),a.jsx(zc,{}),a.jsx(Lc,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:a.jsx(d.Highlighter,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:a.jsx(d.Link,{className:"h-4 w-4"})}),a.jsx(zc,{}),a.jsx(Lc,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:a.jsx(d.RemoveFormatting,{className:"h-4 w-4"})}),a.jsx(zc,{}),a.jsx(Lc,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:a.jsx(d.Undo,{className:"h-4 w-4"})}),a.jsx(Lc,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:a.jsx(d.Redo,{className:"h-4 w-4"})})]}),a.jsx(q.EditorContent,{editor:x,className:Yt("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&a.jsx("textarea",{value:r||"",onChange:e=>s(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&a.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:a.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.SEARCH_CONFIG=Le,exports.SUPPORTED_LOCALES=Pt,exports.ScrollArea=Io,exports.ScrollBar=Fo,exports.Select=qr,exports.SelectApproverDialog=ch,exports.SelectContent=Yr,exports.SelectGroup=$r,exports.SelectItem=Xr,exports.SelectLabel=Qr,exports.SelectScrollDownButton=Kr,exports.SelectScrollUpButton=Gr,exports.SelectSearch=Vs,exports.SelectSeparator=Jr,exports.SelectTrigger=Hr,exports.SelectValue=Wr,exports.Separator=dr,exports.Sheet=Cd,exports.SheetBody=Md,exports.SheetClose=Sd,exports.SheetContent=Ad,exports.SheetDescription=Rd,exports.SheetFooter=Id,exports.SheetHeader=Ed,exports.SheetOverlay=Dd,exports.SheetPortal=Td,exports.SheetTitle=Fd,exports.SheetTrigger=kd,exports.Sidebar=Vd,exports.SidebarActionTrigger=Sp,exports.SidebarContent=Yd,exports.SidebarFooter=Gd,exports.SidebarGroup=Qd,exports.SidebarGroupAction=Jd,exports.SidebarGroupContent=Zd,exports.SidebarGroupLabel=Xd,exports.SidebarHeader=function({open:e,appName:r}){const[s,n]=t.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx(Hd,{className:"p-0 gap-0",children:e?a.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[a.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:a.jsx("img",{src:He.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),r&&a.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:a.jsx("span",{className:"line-clamp-2",children:(e=>{const t=e.split(" ");if(t.length<=1)return a.jsxs("span",{className:"whitespace-nowrap",children:[e," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=t[t.length-1],s=t.slice(0,-1).join(" ");return a.jsxs(a.Fragment,{children:[s," ",a.jsxs("span",{className:"whitespace-nowrap",children:[r," ",a.jsx(d.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(r)})})]}):a.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:a.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:a.jsx("img",{src:He.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a.jsx(Ji,{open:s,onOpenChange:n})]})},exports.SidebarInput=Wd,exports.SidebarInset=$d,exports.SidebarLogo=_p,exports.SidebarMenu=ec,exports.SidebarMenuAction=sc,exports.SidebarMenuBadge=nc,exports.SidebarMenuButton=rc,exports.SidebarMenuItem=ac,exports.SidebarMenuSkeleton=oc,exports.SidebarMenuSub=ic,exports.SidebarMenuSubButton=dc,exports.SidebarMenuSubItem=lc,exports.SidebarProvider=Ud,exports.SidebarRail=qd,exports.SidebarSeparator=Kd,exports.SidebarSkeleton=function(){return a.jsx("div",{className:"w-64 border-r bg-muted/10",children:a.jsxs("div",{className:"p-4",children:[a.jsx(zs,{className:"h-8 w-32 mb-6"}),a.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>a.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[a.jsx(zs,{className:"h-4 w-4"}),a.jsx(zs,{className:"h-4 w-20"})]},t))})]})})},exports.SidebarTrigger=Bd,exports.SingleFileUpload=function({storedFile:e,customFileName:r,allowedExtensions:s,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:c=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:b,onFileReplace:v,onDownload:w,onView:j,className:N}){const{t:_}=y.useTranslation(),C=t.useRef(null),[k,S]=t.useState(null),[T,D]=t.useState(null),[P,A]=t.useState(!1),E=k||e,M=k?.name||e?.name||"",I=k?.size||e?.size;M&&Gp(M);const F=r||M,R=l&&!k&&!!e,L=c&&!k&&!!e,z=!!T||!!f||p&&h&&!E,O=!!E,U=t.useCallback(e=>{if(Wp.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(s?.length){const a=Gp(e.name);if(!s.includes(a))return{type:"extension",message:n}}return null},[o,i,s,n]),V=t.useCallback(e=>{const a=e.target.files?.[0];if(!a)return;const t=U(a);if(t)return D(t),S(null),void(C.current&&(C.current.value=""));D(null),S(a),g?.(a),C.current&&(C.current.value="")},[U,g]),B=t.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const a=e.dataTransfer.files?.[0];if(!a)return;const t=U(a);if(t)return D(t),void S(null);D(null),S(a),g?.(a)},[x,U,g]),q=t.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),$=t.useCallback(()=>{v?.(),C.current?.click()},[v]),W=t.useCallback(()=>{S(null),D(null),b?.(),C.current&&(C.current.value="")},[b]),H=t.useCallback(async()=>{if(!P&&e&&w){A(!0);try{await w(e)}finally{A(!1)}}},[P,e,w]),G=t.useCallback(()=>{e&&j&&j(e)},[e,j]),K=t.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!T)return p&&h&&!E?_("required_field"):null;switch(T.type){case"extension":return T.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${Hp(o)}`;case"max-size":return`Tamanho máximo: ${Hp(i)}`;default:return _("file_error")}})();return a.jsxs("div",{className:Yt("space-y-1",N),children:[a.jsx("div",{className:Yt("rounded-md border border-dashed transition-colors",O&&"border-solid border-border",!O&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:O?a.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a.jsx(d.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-xs truncate",children:F})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=I&&a.jsx("span",{className:"text-xs text-muted-foreground",children:Hp(I)}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[R&&w&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:P,onClick:H,children:a.jsx(d.Download,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(Cs,{children:"Download"})]}),L&&j&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:a.jsx(d.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(Cs,{children:"Visualizar"})]}),u&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:$,children:a.jsx(d.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),a.jsx(Cs,{children:"Substituir"})]}),m&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:a.jsx(d.X,{className:"h-3 w-3 text-muted-foreground"})})}),a.jsx(Cs,{children:_("remove")})]})]})]})]}):a.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:B,onDragOver:q,children:[a.jsx(d.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",a.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&a.jsx("p",{className:"text-xs text-destructive",children:Y}),a.jsx("input",{ref:C,type:"file",className:"hidden",accept:s?.map(e=>`.${e}`).join(","),onChange:V,disabled:x})]})},exports.Skeleton=zs,exports.Slider=cc,exports.Small=ed,exports.SonnerToaster=os,exports.Spinner=ss,exports.SplitButton=qc,exports.Stack=Ko,exports.StatusBadge=function({label:e,color:t,icon:r,showIcon:s,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const d=xu[n],c=s??!!r;return a.jsxs("span",{className:Yt("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",d.badge,l),style:(()=>{switch(o){case"outline":return{color:t,borderColor:Wt(t,.3),backgroundColor:"transparent"};case"ghost":return{color:t,backgroundColor:"transparent"};default:return{color:t,backgroundColor:i||Wt(t,.1)}}})(),children:[c&&r&&a.jsx(r,{size:d.icon,strokeWidth:2}),e]})},exports.StepSelector=Kc,exports.Stepper=Kc,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:r={},minHeight:s="80vh",...n}){const o=t.useMemo(()=>{const a=`${e}/api/reports/v1/Viewer/InitViewer`,t=new URLSearchParams(r).toString();return t?`${a}?${t}`:a},[e,r]);return a.jsx(ou,{...n,url:o,minHeight:s})},exports.Switch=Oo,exports.TIMEZONES=Et,exports.TabPageContent=function({children:e,className:t}){return a.jsx("div",{className:Yt("space-y-6",t),children:e})},exports.TabPageHeader=function({title:e,description:t,actions:r,className:s}){return a.jsxs("div",{className:Yt("space-y-4",s),children:[a.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&a.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),r&&a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),a.jsx(dr,{})]})},exports.TabPageLayout=function({children:e,className:t}){return a.jsx("div",{className:Yt("flex flex-col h-full",t),children:a.jsx(Io,{className:"flex-1",children:a.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Rn,exports.TableBody=zn,exports.TableCaption=qn,exports.TableCell=Bn,exports.TableFooter=On,exports.TableHead=Vn,exports.TableHeader=Ln,exports.TableResizeHandle=Yn,exports.TableRow=Un,exports.TableRowActions=po,exports.TableSkeleton=$n,exports.Tabs=Ci,exports.TabsContent=Ti,exports.TabsList=ki,exports.TabsTrigger=Si,exports.TeamSelector=function({users:e,value:r,onChange:s,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:c="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=t.useState(""),[b,v]=t.useState(!1),[w,j]=t.useState(null),N=t.useMemo(()=>new Set(r),[r]),_=t.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=t.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=t.useCallback(e=>{e&&!N.has(e)&&(s([...r,e]),g(""))},[r,s,N]),S=t.useCallback(e=>{i?(j(e),v(!0)):s(r.filter(a=>a!==e))},[r,s,i]),T=t.useCallback(()=>{w&&s(r.filter(e=>e!==w)),v(!1),j(null)},[w,r,s]);return a.jsxs("div",{className:Yt("space-y-3",m),children:[a.jsx("div",{className:"flex items-start gap-3",children:a.jsx("div",{className:"flex-1",children:a.jsx(Vs,{options:C,value:f,onValueChange:e=>{const a="string"==typeof e?e:e?.[0]??"";g(a),a&&k(a)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),a.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?a.jsx("div",{className:"space-y-2",children:_.map(e=>a.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[a.jsxs(ul,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a.jsx(ml,{src:e.avatar,alt:e.name}),a.jsx(pl,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(d.Shield,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(d.MapPin,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a.jsx("button",{type:"button",className:Yt("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:a.jsx(d.X,{className:"h-4 w-4"})})]})]},e.id))}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a.jsx(d.User,{className:"h-12 w-12 mb-2 opacity-30"}),a.jsx("p",{className:"text-sm",children:x})]}),a.jsx(wr,{open:b,onOpenChange:v,children:a.jsxs(Sr,{className:"sm:max-w-[400px]",children:[a.jsx(Tr,{children:a.jsx(Ar,{children:h})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:c}),a.jsxs(Pr,{children:[a.jsx(Jt,{variant:"ghost",onClick:()=>v(!1),children:"Cancelar"}),a.jsx(Jt,{variant:"destructive",onClick:T,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:r,open:s,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:c=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=t.useState(!1),h=t.useCallback(()=>{o(r.id)},[o,r.id]);return a.jsxs(a.Fragment,{children:[a.jsx(wr,{open:s&&!m,onOpenChange:e=>!e&&n(),children:a.jsxs(Sr,{className:"sm:max-w-md",children:[a.jsx(Tr,{children:a.jsxs(Ar,{className:"flex items-center gap-2",children:[a.jsx(d.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),a.jsxs("div",{className:"space-y-4",children:[r.description&&a.jsx(Io,{className:"max-h-48",children:a.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r.description}})}),r.file&&a.jsxs(Jt,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[a.jsx(d.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),a.jsxs(Pr,{className:"gap-2 sm:gap-0",children:[a.jsx(Jt,{variant:"ghost",onClick:n,children:l}),a.jsx(Jt,{onClick:h,children:c})]})]})}),m&&a.jsx(iu,{term:r,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=iu,exports.TextPanel=om,exports.Textarea=es,exports.Timepicker=Gc,exports.Toaster=os,exports.Toggle=bo,exports.ToggleGroup=yo,exports.ToggleGroupItem=wo,exports.TokenManager=rn,exports.TokenService=Ks,exports.Tooltip=Ns,exports.TooltipContent=Cs,exports.TooltipProvider=js,exports.TooltipTrigger=_s,exports.TreeSelect=Gs,exports.TreeTable=function({data:r,columns:s,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:c,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:b,selectedIds:v,onSelectItem:y,onSelectAll:w,isAllSelected:j,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:T=200}){const[D,P]=t.useState(null),[A,E]=t.useState(null),[M,I]=t.useState(!1),[F,R]=t.useState(1),L=t.useRef(null),z=t.useRef([]),O=t.useRef(null),U=t.useMemo(()=>new Set(v??[]),[v]),V=t.useMemo(()=>{if(!D||!r)return new Set;const e=z.current.length>0?z.current:[D],a=function(e,a){const t=new Set;for(const r of a)cp(e,r).forEach(e=>t.add(e));return t}(r,e);return e.forEach(e=>a.add(e)),a},[D,r]),B=t.useRef(V);B.current=V;const q=t.useCallback(()=>{L.current=null,z.current=[],O.current=null,P(null),E(null),I(!1),R(1)},[]),$=t.useCallback((e,a)=>{e.length>1&&C?C(e,a):1===e.length&&_?.(e[0],a)},[_,C]),W=t.useCallback((e,a)=>{const t=U.has(e)&&U.size>1?Array.from(U):[e];L.current=e,z.current=t,O.current=null,P(e),R(t.length),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",e),a.dataTransfer.setData("application/x-tree-ids",JSON.stringify(t))},[U]),H=t.useCallback((e,a)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",B.current.has(e)?E(null):(O.current=e,E(e))},[]),G=t.useCallback((e,a)=>{a.preventDefault(),a.stopPropagation();const t=B.current.has(e)?O.current:e;if(!t)return void q();let r=z.current;if(0===r.length){try{const e=a.dataTransfer.getData("application/x-tree-ids");if(e){const a=JSON.parse(e);Array.isArray(a)&&a.length>0&&(r=a)}}catch{}if(0===r.length){const e=a.dataTransfer.getData("text/plain");e&&(r=[e])}}0===r.length||r.includes(t)||$(r,t),q()},[$,q]),K=t.useCallback(e=>{e.preventDefault(),e.stopPropagation();let a=z.current;if(0===a.length){try{const t=e.dataTransfer.getData("application/x-tree-ids");if(t){const e=JSON.parse(t);Array.isArray(e)&&e.length>0&&(a=e)}}catch{}if(0===a.length){const t=e.dataTransfer.getData("text/plain");t&&(a=[t])}}0!==a.length?($(a,null),q()):q()},[$,q]),Y=t.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",I(!0)},[]),Q=t.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=t.useCallback(e=>{if(!N)return;const a=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),t=a?.dataset?.treeRowId??O.current;t&&G(t,e)},[N,G]);if(x)return a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[a.jsx(d.User,{className:"h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==D;return a.jsxs("div",{className:Yt("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const a=e.relatedTarget;a&&e.currentTarget.contains(a)||(E(null),I(!1))}:void 0,children:[N&&J&&a.jsx(pp,{onDrop:K,isDragOver:M,onDragOver:Y,onDragLeave:()=>I(!1),label:k}),a.jsxs(Rn,{children:[a.jsx(Ln,{children:a.jsxs(Un,{children:[a.jsx(Vn,{className:"text-left",style:{minWidth:T},children:a.jsxs("div",{className:"flex items-center gap-2",children:[b&&a.jsx(Zr,{checked:j??!1,onCheckedChange:()=>w?.()}),o]})}),s.map(e=>a.jsx(Vn,{className:Yt("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&a.jsx(Vn,{className:"text-right",style:{width:S},children:p})]})}),a.jsx(zn,{children:r.map(e=>a.jsx(mp,{item:e,level:0,columns:s,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:c,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:b,selectedIds:U,onSelectItem:y,enableRowDrag:N,draggedId:D,dragOverId:A,onDragStartCell:W,onDragEndCell:q,onDragOverCell:H,onDropCell:G,dragCount:F},e.id))})]})]})},exports.TruncatedCell=Kn,exports.UpdatesNotification=Jc,exports.UsersGroupsSelector=function({users:r,groups:s=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:c=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:b}){const[v,y]=t.useState(!1),[w,j]=t.useState(""),[N,_]=t.useState(void 0),C=t.useMemo(()=>new Set(n),[n]),k=t.useMemo(()=>{let e=r;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),w){const a=lu(w);e=e.filter(e=>lu(e.name).includes(a)||lu(e.email??"").includes(a))}return e},[r,N,w]),S=t.useMemo(()=>v?k:r.filter(e=>C.has(e.id)),[v,k,r,C]),T=n.length,D=t.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),P=t.useCallback(e=>{if(i)return;const a=C.has(e)?n.filter(a=>a!==e):[...n,e];o(a)},[n,C,o,i]),A=t.useCallback(e=>{if(i)return;const a=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...a]);o(Array.from(e))}else o(n.filter(e=>!a.has(e)))},[n,k,o,i]),E=t.useCallback(()=>{y(e=>!e),j(""),_(void 0)},[]);return a.jsxs("div",{className:Yt("rounded-md border bg-muted/30",b),children:[(!i||T>0)&&a.jsxs("div",{className:Yt("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:E,children:[a.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(v?p:m)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:T>0&&`${T} ${1===T?f:g}`})]}),a.jsxs("div",{className:"px-4 pb-3",children:[v&&a.jsxs("div",{className:"flex gap-3 mb-3",children:[!c&&s.length>0&&a.jsxs(qr,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[a.jsx(Hr,{className:"w-[200px] h-9 text-sm",children:a.jsx(Wr,{placeholder:e.t("approval_user_group")})}),a.jsxs(Yr,{children:[a.jsx(Xr,{value:"__all__",children:e.t("team_all_groups")}),s.map(e=>a.jsx(Xr,{value:e.id,children:e.name},e.id))]})]}),a.jsxs("div",{className:"relative flex-1",children:[a.jsx(d.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(er,{className:"pl-8 h-9 text-sm",placeholder:u,value:w,onChange:e=>j(e.target.value)})]})]}),!v&&0===T&&a.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a.jsx(d.Users,{className:"h-4 w-4 mr-2"}),x]}),v&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Zr,{checked:D,onCheckedChange:e=>A(!!e)}),a.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&a.jsx(Io,{style:{maxHeight:l},className:"pr-2",children:a.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return a.jsxs("div",{className:Yt("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",v&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:v?()=>P(e.id):void 0,children:[v&&a.jsx(Zr,{checked:C.has(e.id),onCheckedChange:()=>P(e.id),onClick:e=>e.stopPropagation()}),a.jsxs(ul,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a.jsx(ml,{src:e.avatar,alt:e.name}),a.jsx(pl,{className:"text-xs",children:(t=e.name,t.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var t})})}),v&&0===k.length&&a.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:r,onChange:s,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:c,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=t.useState(r||{inputType:"url",controls:!0}),x=t.useRef(null),f=t.useRef(null),{upload:g,uploading:b}=Lp({uploadFunction:i,deleteFunction:c,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:v,uploading:w}=Lp({uploadFunction:i,deleteFunction:c,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),j=t.useMemo(()=>qp(p.videoUrl||Bp(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,a)=>{const t={...p,[e]:a};h(t),s(t)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:m("input_type")}),a.jsxs(qr,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[a.jsx(Hr,{children:a.jsx(Wr,{})}),a.jsxs(Yr,{children:[a.jsx(Xr,{value:"url",children:"URL"}),a.jsx(Xr,{value:"upload",children:m("file_upload")}),a.jsx(Xr,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"Arquivo"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await g(a),t={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||a.name.replace(/\.[^/.]+$/,"")};h(t),s(t)}catch(t){}finally{x.current&&(x.current.value="")}},className:"hidden"}),a.jsx(Jt,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:b,children:b?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:m("embed_code")}),a.jsx(es,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"Thumbnail"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(er,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),a.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await v(a),t={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(t),s(t)}catch(t){}finally{f.current&&(f.current.value="")}},className:"hidden"}),a.jsx(Jt,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:w,children:w?a.jsxs(a.Fragment,{children:[a.jsx(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(d.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{htmlFor:"title",children:"Título"}),a.jsx(er,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),a.jsxs("div",{className:"flex gap-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zr,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),a.jsx(tr,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Zr,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),a.jsx(tr,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(tr,{children:"Preview"}),a.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const t=p.videoUrl||Bp(p.embedCode)||"";if(!t)return a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===j)return a.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[a.jsx("source",{src:t}),"Seu navegador não suporta este vídeo."]});const r="youtube"===j?Op(t,p.autoplay):Vp(t,p.autoplay);return a.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a.jsx("iframe",{title:p.title||e.t("video"),src:r,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a.jsx(Jt,{variant:"outline",onClick:o,children:"Cancelar"}),a.jsx(Jt,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:t,className:r="",style:s}){const n=t.videoUrl||Bp(t.embedCode)||"";if(!n)return null;const o=qp(n);return a.jsx(rr,{className:`overflow-hidden my-4 ${r}`,style:s,children:a.jsxs(ir,{className:"p-0",children:["file"===o?a.jsxs("video",{controls:!1!==t.controls,autoPlay:t.autoplay,poster:t.thumbnail,className:"w-full h-auto",playsInline:!0,muted:t.autoplay,children:[a.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):a.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a.jsx("iframe",{title:t.title||e.t("video"),src:"youtube"===o?Op(n,t.autoplay):Vp(n,t.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),t.title&&a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-sm font-medium",children:t.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:r,template:s,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:c=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:b=!1,readingConfirmationTimeRemaining:v,onIframeLoad:w,className:j}){const{t:N}=y.useTranslation(),_=t.useRef(null),C=n??tu(s.extension),k=c||b||h,S=s.code?`${s.code} – ${s.name}`:s.name,T=t.useCallback(()=>{_.current&&w&&w(_.current)},[w]);return t.useEffect(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,r]),a.jsx(wr,{open:e,onOpenChange:r,children:a.jsxs(Sr,{className:Yt("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&"w-[90vw]",j),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?a.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):a.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),a.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&a.jsxs(a.Fragment,{children:[(x||f)&&a.jsx(a.Fragment,{children:f?a.jsxs("div",{className:"flex flex-col mr-2.5",children:[a.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[a.jsx(d.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),a.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=v&&v>0?a.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[a.jsx("span",{children:N("terms_confirmation_available")}),a.jsx("span",{className:"font-medium min-w-[72px]",children:nu(v)}),a.jsx("span",{children:"segundos"})]}):a.jsxs(Jt,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[a.jsx(d.ShieldCheck,{className:"h-4 w-4 mr-1"}),b?"Confirmando...":N("terms_confirm_reading")]})}),C!==exports.FileViewerType.none&&u&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:a.jsx(d.Star,{className:Yt("h-4 w-4",m&&"fill-accent text-accent")})})}),a.jsx(Cs,{children:m?"Desfavoritar":"Favoritar"})]}),C!==exports.FileViewerType.none&&i&&a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:a.jsx(d.Download,{className:"h-4 w-4"})})}),a.jsx(Cs,{children:"Download"})]})]}),a.jsxs(Ns,{children:[a.jsx(_s,{asChild:!0,children:a.jsx(Jt,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>r(!1),children:a.jsx(d.X,{className:"h-4 w-4"})})}),a.jsx(Cs,{children:"Fechar"})]})]})]}),a.jsx("div",{className:Yt("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",C===exports.FileViewerType.none&&"min-h-[124px]",C===exports.FileViewerType.image&&"max-h-[85vh]",(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&"min-w-[77vw] min-h-[80vh]"),children:o?a.jsx(ss,{className:"h-14 w-14"}):a.jsxs(a.Fragment,{children:[(C===exports.FileViewerType.none||!s.url)&&a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),a.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),C===exports.FileViewerType.image&&a.jsx("img",{loading:"eager",src:s.url,alt:s.name,className:"max-w-full max-h-[85vh] object-contain"}),C===exports.FileViewerType.video&&a.jsx("video",{controls:!0,autoPlay:!0,src:s.url,className:"w-full h-full"}),C===exports.FileViewerType.audio&&a.jsx("audio",{controls:!0,autoPlay:!0,src:s.url}),(C===exports.FileViewerType.wopi||C===exports.FileViewerType.report)&&a.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[a.jsx(ss,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a.jsx("iframe",{ref:_,src:s.url,onLoad:T,className:"border-none w-full h-full z-[1] relative",title:s.name})]})]})}),!o&&C===exports.FileViewerType.none&&a.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a.jsx(Jt,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),i&&a.jsx(Jt,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.addAppTranslations=mi,exports.addChild=Vm,exports.addSibling=Bm,exports.assets=He,exports.badgeVariants=as,exports.buildModuleUrl=Kt,exports.buildPlacesTree=function(e){e.forEach(a=>{a.children=e.filter(e=>e.parentId===a.id)});const a=e.filter(e=>!e.parentId);return function e(a,t){a?.forEach(a=>{t(a),a.children&&e(a.children,t)})}(a,a=>{a.children=e.filter(e=>e.parentId===a.id)}),a},exports.buildWopiUrl=function(e){const{t:a}=y.useTranslation(),{viewerUrl:t,wopiUrl:r,fileId:s,token:n,extension:o,language:i="pt-br"}=e,l=su(o);return l?`${t}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${r}${s}`)}`:null},exports.buttonGroupVariants=wl,exports.buttonVariants=Xt,exports.calculateAspectRatio=$p,exports.cn=Yt,exports.createCrudPage=function(e){return({manager:t})=>{const{manager:r,config:s,onSave:n,onEdit:o,onToggleStatus:i}=e,l=t??r,d={entityName:s.entityName,entityNamePlural:s.entityNamePlural,filters:s.filters||[],columns:s.columns,cardFields:s.cardFields||[],enableBulkActions:s.enableBulkActions??!1,bulkActions:s.bulkActions||[],customActions:s.customActions,customRowActions:s.customRowActions,customListView:s.customListView,onEdit:o||s.onEdit,onNew:s.onNew,useCustomRouting:s.useCustomRouting,hideNewButton:s.hideNewButton,showNewButton:s.showNewButton,newButtonLabel:s.newButtonLabel,showSearch:s.showSearch,searchPlaceholder:s.searchPlaceholder,showActionBar:s.showActionBar};return a.jsx(Qo,{manager:l,config:d,formSections:s.formSections,onSave:n,onToggleStatus:i,defaultSort:s.defaultSort})}},exports.createCrudRoutingConfig=function(e,a){const t=hp({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}},exports.createMindMapNode=Rm,exports.createRoutingHandlers=hp,exports.createService=_n,exports.createSimpleSaveHandler=function(e,a,t){return r=>{if(r.id){const a=t(r);e.updateEntity(r.id,a)}else{const t=a(r);e.createEntity(t)}}},exports.createSimpleService=function(e){const a=_n({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:a,useCrudHook:(t,r)=>Mn({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:r})}},exports.createStatusConfig=function(e){return a=>e[a]},exports.createTranslatedMessages=a=>({success:{created:a=>e.t("msg_created_success",`${a} criado com sucesso`).replace("{{entity}}",a),updated:a=>e.t("msg_updated_success",`${a} atualizado com sucesso`).replace("{{entity}}",a),deleted:a=>e.t("msg_deleted_success",`${a} removido com sucesso`).replace("{{entity}}",a)},error:{create:a=>e.t("msg_create_error",`Erro ao criar ${a}`).replace("{{entity}}",a),update:a=>e.t("msg_update_error",`Erro ao atualizar ${a}`).replace("{{entity}}",a),delete:a=>e.t("msg_delete_error",`Erro ao remover ${a}`).replace("{{entity}}",a),load:a=>e.t("msg_load_error",`Erro ao carregar ${a}`).replace("{{entity}}",a)}}),exports.currencyFormatter=Yu,exports.debounce=(e,a)=>{let t;return(...r)=>{clearTimeout(t),t=setTimeout(()=>e(...r),a)}},exports.deriveEmailField=gn,exports.deriveNameField=fn,exports.deriveUsernameField=bn,exports.detectBrowserLocale=zt,exports.detectBrowserPreferences=()=>{const e=zt();return{locale:e,timezone:Ot(),datetimeFormat:Ut(e)}},exports.detectBrowserTimezone=Ot,exports.detectVideoProvider=qp,exports.emailService=Rp,exports.errorService=sn,exports.exportMindMap=op,exports.extractImageFileName=function(e){try{const a=new URL(e),t=a.pathname.split("/");return t[t.length-1]||"image"}catch{const a=e.split("/");return a[a.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)},exports.extractVimeoId=Up,exports.extractYouTubeId=zp,exports.findDatetimeFormat=e=>At.find(a=>a.value===e),exports.findLocale=e=>Pt.find(a=>a.value===e),exports.findNode=Lm,exports.findTimezone=e=>Et.find(a=>a.value===e),exports.formatBytes=Hp,exports.formatCurrency=(e,a="BRL",t="pt-BR")=>null==e?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=qt,exports.formatDatetime=Bt,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.generateCrudConfig=function(e,a,t={}){const r=[];return Object.keys(a).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const t=a[e],s={key:e,header:Jo(e),label:Jo(e),...Xo(e,t),sortable:!0,searchable:"string"==typeof t};r.push(s)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...t}},exports.generateNodeId=Fm,exports.generatePastelBg=Wt,exports.getAppEnv=De,exports.getBackendMode=function(){return Ee},exports.getContrastRatio=function(e,a){const t=Ht(e),r=Ht(a);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case exports.DashboardPanelType.Bar:case exports.DashboardPanelType.Column:case exports.DashboardPanelType.Pie:case exports.DashboardPanelType.List:case exports.DashboardPanelType.Line:case exports.DashboardPanelType.Area:case exports.DashboardPanelType.Text:case exports.DashboardPanelType.StackedColumn:return{x:4,y:2};case exports.DashboardPanelType.Pareto:case exports.DashboardPanelType.RiskMatrix:case exports.DashboardPanelType.Burndown:case exports.DashboardPanelType.PerformanceColumns:return{x:8,y:2};case exports.DashboardPanelType.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getEnvironmentConfig=Pe,exports.getFieldValue=Xp,exports.getFileExtension=Gp,exports.getFormFieldValues=function(e){return e.filter(e=>e.type!==exports.ECustomFormFieldType.readOnlyText).map(e=>({formFieldAssociationId:e.id,textValue:e.type===exports.ECustomFormFieldType.text?e.textValue:void 0,numberValue:e.type===exports.ECustomFormFieldType.number?e.numberValue:void 0,dateValue:e.type===exports.ECustomFormFieldType.date?e.dateValue:void 0,timeValue:e.type===exports.ECustomFormFieldType.time?e.timeValue:void 0,itemsValue:[exports.ECustomFormFieldType.url,exports.ECustomFormFieldType.singleSelection,exports.ECustomFormFieldType.multiSelection].includes(e.type)?e.itemsValue:void 0,questionsValue:e.type===exports.ECustomFormFieldType.questions?e.questionsValue:void 0}))},exports.getLinkFromRow=Hu,exports.getLuminance=Ht,exports.getMinPanelSize=vm,exports.getOnlineViewerType=function(e){const{t:a}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getQualiexApiUrl=Ve,exports.getSupabaseClient=cn,exports.getViewerType=tu,exports.getWopiViewer=su,exports.handleExternalLink=Gt,exports.importMindMap=function(e){return ip(JSON.parse(e))},exports.inferDatetimeFormat=Ut,exports.inputGroupAddonVariants=Vl,exports.inputGroupButtonVariants=ql,exports.isCurrency=function(e){return!!Ku.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnv=Ae,exports.isDevEnvironment=Ue,exports.isImageUrl=function(e){const a=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const t=new URL(e);return a.some(e=>t.pathname.toLowerCase().endsWith(e))}catch{const t=e.toLowerCase();return a.some(e=>t.endsWith(e))}},exports.isLovablePreview=ze,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isSupabaseBackend=Ie,exports.isSupabaseConfigured=function(){return null!==ln()},exports.isValidDatetimeFormat=e=>At.some(a=>a.value===e),exports.isValidLocale=Rt,exports.isValidTimezone=Lt,exports.loadForlogicFonts=rl,exports.logoSrc=Ge,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=$m,exports.navigationMenuTriggerStyle=ld,exports.normalizeVideoUrl=function(e,a,t){switch(a||qp(e)){case"youtube":return Op(e,t);case"vimeo":return Vp(e,t);default:return e}},exports.normalizeVimeoUrl=Vp,exports.normalizeYouTubeUrl=Op,exports.parseIframeSrc=Bp,exports.processUrl=Wu,exports.qualiexApi=xn,exports.removeNode=qm,exports.resizeKeepingAspect=function(e,a,t,r){const s=$p(e,a);return t&&!r?{width:t,height:Math.round(t/s)}:r&&!t?{width:Math.round(r*s),height:r}:{width:e,height:a}},exports.resolveFieldMappings=vn,exports.resolvePageTitle=jp,exports.setBackendMode=Me,exports.setCollapsedAll=Hm,exports.setFormFieldValues=function(e,a){return a?.length?e.map(e=>{const t=a.find(a=>a.formFieldAssociationId===e.id);if(!t)return e;const r={...e};switch(e.type){case exports.ECustomFormFieldType.text:r.textValue=t.textValue;break;case exports.ECustomFormFieldType.number:r.numberValue=t.numberValue;break;case exports.ECustomFormFieldType.date:r.dateValue=t.dateValue;break;case exports.ECustomFormFieldType.time:r.timeValue=t.timeValue;break;case exports.ECustomFormFieldType.url:case exports.ECustomFormFieldType.singleSelection:case exports.ECustomFormFieldType.multiSelection:r.itemsValue=t.itemsValue||[];break;case exports.ECustomFormFieldType.questions:r.questionsValue=t.questionsValue||[]}return r}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new j.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=Jp,exports.shouldUseDevTokens=Oe,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=Ke,exports.sortByMonthYear=function(e){return e?.sort((e,a)=>{if(!e?.items?.length||!a?.items?.length)return 0;return $u(e.items[0]?.keyDate)-$u(a.items[0]?.keyDate)})},exports.toQueryString=function(e){return e?Gu(e).join("&"):null},exports.toggleCollapsed=Wm,exports.toggleVariants=go,exports.trackFooterClick=Vi,exports.trackInterestClick=Ui,exports.trackModuleClick=Oi,exports.trimTextFields=Qt,exports.useActiveModules=(e={})=>{const{enabled:a=!0}=e,{alias:t}=En();return j.useQuery({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=cn(),{data:a,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",t).eq("status","active").order("name");if(r){if(!pn.handleError(r))throw r;return[]}return a||[]},enabled:a&&!!t})},exports.useAliasFromUrl=Zo,exports.useAuth=En,exports.useBaseForm=Po,exports.useClarity=sl,exports.useColumnManager=Co,exports.useColumnResize=fo,exports.useCrud=Mn,exports.useDebounce=Np,exports.useDerivedContractedModules=Xi,exports.useFormField=Fr,exports.useHasOpenModal=function(){const{hasOpenModal:e}=Ep();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:a}=gi(),t=It;return{formatDatetime:r=>Bt(r,t,a,e),formatDate:t=>qt(t,e,a),locale:e,timezone:a,datetimeFormat:t}},exports.useIsMobile=Fn,exports.useLocale=gi,exports.useMediaQuery=In,exports.useMediaUpload=Lp,exports.useModalState=Ep,exports.useModuleAccess=Qi,exports.useModuleConfig=yi,exports.useNavigation=wp,exports.usePageMetadata=function(e){const{setMetadata:a,clearMetadata:r}=ii(),s=t.useRef({});t.useEffect(()=>{const t=JSON.stringify(s.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(s.current.title!==e.title||s.current.subtitle!==e.subtitle||t)&&(s.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},a(e)),()=>r()},[e.title,e.subtitle,e.breadcrumbs,a,r])},exports.usePageMetadataContext=ii,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:a}=wp();return jp(a,e.pathname)},exports.usePermissionQuery=kp,exports.useQualiexUsers=Uo,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const a=e.pathname.split("/").filter(Boolean),t=[{label:"Exemplos",href:"/"}];let r="";return a.forEach((e,s)=>{r+=`/${e}`;const n=s===a.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.push({label:o,href:n?void 0:r,isCurrentPage:n})}),t})()},exports.useRowResize=function({rowIds:e,defaultHeight:a=48,minHeight:r=32,maxHeight:s=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,d]=t.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[c,u]=t.useState(!1),[m,p]=t.useState(null),h=t.useRef(0),x=t.useRef(0),f=t.useCallback(e=>l[e]??a,[l,a]),g=t.useCallback((e,t)=>{i&&(t.preventDefault(),t.stopPropagation(),u(!0),p(e),h.current=t.clientY,x.current=l[e]??a)},[i,l,a]);t.useEffect(()=>{if(!c||!m)return;const e=e=>{const a=e.clientY-h.current,t=Math.max(r,Math.min(s,x.current+a));d(e=>{const a={...e,[m]:t};return o?.(a),a})},a=()=>{u(!1),p(null),n&&d(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a)}},[c,m,r,s,n,o]),t.useEffect(()=>(c?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[c]);const b=t.useCallback(()=>{d({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:c,activeRow:m,handleMouseDown:g,resetHeights:b,getRowHeight:f}},exports.useSidebar=Od,exports.useSidebarResize=Pp,exports.useUpdatesNotification=Xc,exports.useWizard=function(e){const{steps:a,initialStep:r=0,initialData:s={},onComplete:n,onCancel:o}=e,[i,l]=t.useState(r),[d,c]=t.useState(s),[u,m]=t.useState(!1),[p,h]=t.useState(!1),x=a.length,f=0===i,g=i===x-1,b=a[i],v=x>1?(i+1)/x*100:100,y=t.useCallback(()=>!b?.canProceed||b.canProceed(),[b]),w=t.useMemo(()=>y(),[y,d]),j=t.useMemo(()=>!f&&!b?.disableBack,[f,b]),N=t.useCallback(e=>{c(a=>({...a,...e}))},[]),_=t.useCallback((e,a)=>{c(t=>({...t,[e]:a}))},[]),C=t.useCallback(()=>{l(r),c(s),m(!1),h(!1),o?.()},[r,s,o]),k=t.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(d))}finally{h(!1)}}},[y,p,d,n]),S=t.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),T=t.useCallback(()=>{j&&!u&&l(e=>Math.max(e-1,0))},[j,u]),D=t.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),P=t.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:b,data:d,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:T,goTo:D,canProceed:w,canGoBack:j,setData:N,updateField:_,reset:C,complete:k,setLoading:P,progress:v,stepIndex:i,totalSteps:x}},exports.validateFields=function(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||e.type===exports.ECustomFormFieldType.readOnlyText)return;const t=Xp(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),e.type===exports.ECustomFormFieldType.number&&null!=t){const r=e.config;null!=r?.min&&t<r.min&&a.push(e.id),null!=r?.max&&t>r.max&&a.push(e.id)}}),{valid:0===a.length,invalidFields:[...new Set(a)]}};