forlogic-core 2.2.7 → 2.3.0

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 (1679) hide show
  1. package/README.md +22 -2
  2. package/dist/action-plans/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  3. package/dist/action-plans/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  4. package/dist/action-plans/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  5. package/dist/action-plans/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  6. package/dist/action-plans/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  7. package/dist/action-plans/action-plans/components/ActionPlanPage.d.ts +25 -0
  8. package/dist/action-plans/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  9. package/dist/action-plans/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  10. package/dist/action-plans/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  11. package/dist/action-plans/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  12. package/dist/action-plans/action-plans/constants.d.ts +86 -0
  13. package/dist/action-plans/action-plans/hooks/useActionPlan.d.ts +19 -0
  14. package/dist/action-plans/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  15. package/dist/action-plans/action-plans/index.d.ts +15 -0
  16. package/dist/action-plans/action-plans/types.d.ts +413 -0
  17. package/dist/action-plans/action-plans/utils/formatTime.d.ts +24 -0
  18. package/dist/action-plans/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  19. package/dist/action-plans/approval-flow/components/ApproveDialog.d.ts +13 -0
  20. package/dist/action-plans/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  21. package/dist/action-plans/approval-flow/index.d.ts +4 -0
  22. package/dist/action-plans/approval-flow/types.d.ts +76 -0
  23. package/dist/action-plans/assets/index.d.ts +7 -0
  24. package/dist/action-plans/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  25. package/dist/action-plans/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  26. package/dist/action-plans/audit-trail/components/AuditTrailPage.d.ts +40 -0
  27. package/dist/action-plans/audit-trail/index.d.ts +9 -0
  28. package/dist/action-plans/audit-trail/types.d.ts +209 -0
  29. package/dist/action-plans/audit-trail/utils.d.ts +54 -0
  30. package/dist/action-plans/auth/components/AliasRedirect.d.ts +13 -0
  31. package/dist/action-plans/auth/components/AliasRouteGuard.d.ts +20 -0
  32. package/dist/action-plans/auth/components/EditProfileDialog.d.ts +13 -0
  33. package/dist/action-plans/auth/components/ProtectedRoute.d.ts +11 -0
  34. package/dist/action-plans/auth/components/UserInfo.d.ts +10 -0
  35. package/dist/action-plans/auth/contexts/AuthContext.d.ts +89 -0
  36. package/dist/action-plans/auth/pages/CallbackPage.d.ts +6 -0
  37. package/dist/action-plans/auth/pages/LoginPage.d.ts +2 -0
  38. package/dist/action-plans/auth/services/AuthService.d.ts +45 -0
  39. package/dist/action-plans/auth/services/SupabaseTokenService.d.ts +3 -0
  40. package/dist/action-plans/auth/services/TokenManager.d.ts +66 -0
  41. package/dist/action-plans/auth/services/TokenRegenerationService.d.ts +14 -0
  42. package/dist/action-plans/auth/services/TokenService.d.ts +48 -0
  43. package/dist/action-plans/auth/utils/ErrorInterceptor.d.ts +20 -0
  44. package/dist/action-plans/components/ErrorBoundary.d.ts +19 -0
  45. package/dist/action-plans/components/dashboards/dashboard-form.d.ts +65 -0
  46. package/dist/action-plans/components/dashboards/dashboard-general-view.d.ts +124 -0
  47. package/dist/action-plans/components/dashboards/dashboard-grid.d.ts +66 -0
  48. package/dist/action-plans/components/dashboards/dashboard-list.d.ts +41 -0
  49. package/dist/action-plans/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  50. package/dist/action-plans/components/dashboards/dashboard-view.d.ts +48 -0
  51. package/dist/action-plans/components/dashboards/helpers.d.ts +86 -0
  52. package/dist/action-plans/components/dashboards/index.d.ts +9 -0
  53. package/dist/action-plans/components/dashboards/panels/burndown-panel.d.ts +41 -0
  54. package/dist/action-plans/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  55. package/dist/action-plans/components/dashboards/panels/index.d.ts +14 -0
  56. package/dist/action-plans/components/dashboards/panels/list-panel.d.ts +45 -0
  57. package/dist/action-plans/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  58. package/dist/action-plans/components/dashboards/panels/numeric-panel.d.ts +32 -0
  59. package/dist/action-plans/components/dashboards/panels/panel-error.d.ts +18 -0
  60. package/dist/action-plans/components/dashboards/panels/panel-header.d.ts +27 -0
  61. package/dist/action-plans/components/dashboards/panels/panel-loader.d.ts +17 -0
  62. package/dist/action-plans/components/dashboards/panels/panel-no-data.d.ts +16 -0
  63. package/dist/action-plans/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  64. package/dist/action-plans/components/dashboards/panels/pareto-panel.d.ts +30 -0
  65. package/dist/action-plans/components/dashboards/panels/performance-panel.d.ts +39 -0
  66. package/dist/action-plans/components/dashboards/panels/pie-panel.d.ts +29 -0
  67. package/dist/action-plans/components/dashboards/panels/text-panel.d.ts +28 -0
  68. package/dist/action-plans/components/dashboards/types.d.ts +755 -0
  69. package/dist/action-plans/components/layout/AppHeader.d.ts +6 -0
  70. package/dist/action-plans/components/layout/AppLayout.d.ts +10 -0
  71. package/dist/action-plans/components/layout/AppSidebar.d.ts +10 -0
  72. package/dist/action-plans/components/layout/BodyContent.d.ts +60 -0
  73. package/dist/action-plans/components/layout/SidebarActionTrigger.d.ts +46 -0
  74. package/dist/action-plans/components/layout/SidebarHeader.d.ts +5 -0
  75. package/dist/action-plans/components/layout/SidebarLogo.d.ts +5 -0
  76. package/dist/action-plans/components/layout/sidebar-utils.d.ts +12 -0
  77. package/dist/action-plans/components/modules/AccessDeniedDialog.d.ts +43 -0
  78. package/dist/action-plans/components/modules/ModuleAccessGuard.d.ts +42 -0
  79. package/dist/action-plans/components/modules/ModuleGrid.d.ts +9 -0
  80. package/dist/action-plans/components/modules/ModuleOfferContent.d.ts +20 -0
  81. package/dist/action-plans/components/modules/ModulesContent.d.ts +21 -0
  82. package/dist/action-plans/components/modules/ModulesDialog.d.ts +3 -0
  83. package/dist/action-plans/components/modules/ModulesFooterCards.d.ts +10 -0
  84. package/dist/action-plans/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  85. package/dist/action-plans/components/modules/index.d.ts +14 -0
  86. package/dist/action-plans/components/modules/modulesData.d.ts +6 -0
  87. package/dist/action-plans/components/modules/types.d.ts +41 -0
  88. package/dist/action-plans/components/ui/accordion.d.ts +42 -0
  89. package/dist/action-plans/components/ui/action-button.d.ts +48 -0
  90. package/dist/action-plans/components/ui/alert-dialog.d.ts +102 -0
  91. package/dist/action-plans/components/ui/alert.d.ts +44 -0
  92. package/dist/action-plans/components/ui/avatar.d.ts +36 -0
  93. package/dist/action-plans/components/ui/badge.d.ts +41 -0
  94. package/dist/action-plans/components/ui/breadcrumb.d.ts +73 -0
  95. package/dist/action-plans/components/ui/button-group.d.ts +24 -0
  96. package/dist/action-plans/components/ui/button.d.ts +66 -0
  97. package/dist/action-plans/components/ui/calendar.d.ts +24 -0
  98. package/dist/action-plans/components/ui/card.d.ts +57 -0
  99. package/dist/action-plans/components/ui/chart.d.ts +97 -0
  100. package/dist/action-plans/components/ui/checkbox.d.ts +15 -0
  101. package/dist/action-plans/components/ui/collapsible.d.ts +20 -0
  102. package/dist/action-plans/components/ui/color-picker.d.ts +19 -0
  103. package/dist/action-plans/components/ui/combo-tree.d.ts +103 -0
  104. package/dist/action-plans/components/ui/combobox.d.ts +64 -0
  105. package/dist/action-plans/components/ui/command.d.ts +89 -0
  106. package/dist/action-plans/components/ui/context-menu.d.ts +122 -0
  107. package/dist/action-plans/components/ui/data-list.d.ts +86 -0
  108. package/dist/action-plans/components/ui/date-picker.d.ts +19 -0
  109. package/dist/action-plans/components/ui/dialog-wizard.d.ts +100 -0
  110. package/dist/action-plans/components/ui/dialog.d.ts +229 -0
  111. package/dist/action-plans/components/ui/disabled-menu-item.d.ts +25 -0
  112. package/dist/action-plans/components/ui/drawer.d.ts +94 -0
  113. package/dist/action-plans/components/ui/dropdown-menu.d.ts +180 -0
  114. package/dist/action-plans/components/ui/electronic-signature-dialog.d.ts +31 -0
  115. package/dist/action-plans/components/ui/empty-state.d.ts +79 -0
  116. package/dist/action-plans/components/ui/export-dialog.d.ts +48 -0
  117. package/dist/action-plans/components/ui/form.d.ts +119 -0
  118. package/dist/action-plans/components/ui/grid.d.ts +53 -0
  119. package/dist/action-plans/components/ui/hover-card.d.ts +21 -0
  120. package/dist/action-plans/components/ui/icon-picker.d.ts +17 -0
  121. package/dist/action-plans/components/ui/iframe-dialog.d.ts +24 -0
  122. package/dist/action-plans/components/ui/input-group.d.ts +113 -0
  123. package/dist/action-plans/components/ui/input.d.ts +24 -0
  124. package/dist/action-plans/components/ui/label.d.ts +23 -0
  125. package/dist/action-plans/components/ui/loading-state.d.ts +52 -0
  126. package/dist/action-plans/components/ui/menubar.d.ts +113 -0
  127. package/dist/action-plans/components/ui/multiselect-permissions.d.ts +84 -0
  128. package/dist/action-plans/components/ui/navigation-menu.d.ts +57 -0
  129. package/dist/action-plans/components/ui/onboarding-dialog.d.ts +58 -0
  130. package/dist/action-plans/components/ui/online-editor-dialog.d.ts +28 -0
  131. package/dist/action-plans/components/ui/page-breadcrumb.d.ts +77 -0
  132. package/dist/action-plans/components/ui/pagination.d.ts +81 -0
  133. package/dist/action-plans/components/ui/popover.d.ts +57 -0
  134. package/dist/action-plans/components/ui/progress.d.ts +22 -0
  135. package/dist/action-plans/components/ui/radio-group.d.ts +66 -0
  136. package/dist/action-plans/components/ui/report-request-list.d.ts +64 -0
  137. package/dist/action-plans/components/ui/resizable.d.ts +38 -0
  138. package/dist/action-plans/components/ui/rich-text-editor.d.ts +58 -0
  139. package/dist/action-plans/components/ui/scroll-area.d.ts +40 -0
  140. package/dist/action-plans/components/ui/select.d.ts +94 -0
  141. package/dist/action-plans/components/ui/separator.d.ts +17 -0
  142. package/dist/action-plans/components/ui/sheet.d.ts +108 -0
  143. package/dist/action-plans/components/ui/sidebar.d.ts +269 -0
  144. package/dist/action-plans/components/ui/skeleton-variants.d.ts +41 -0
  145. package/dist/action-plans/components/ui/skeleton.d.ts +14 -0
  146. package/dist/action-plans/components/ui/slider.d.ts +9 -0
  147. package/dist/action-plans/components/ui/sonner.d.ts +8 -0
  148. package/dist/action-plans/components/ui/spinner.d.ts +11 -0
  149. package/dist/action-plans/components/ui/split-button.d.ts +76 -0
  150. package/dist/action-plans/components/ui/stack.d.ts +17 -0
  151. package/dist/action-plans/components/ui/status-badge.d.ts +52 -0
  152. package/dist/action-plans/components/ui/step-selector.d.ts +46 -0
  153. package/dist/action-plans/components/ui/stimulsoft-viewer.d.ts +28 -0
  154. package/dist/action-plans/components/ui/switch.d.ts +25 -0
  155. package/dist/action-plans/components/ui/tab-page-layout.d.ts +52 -0
  156. package/dist/action-plans/components/ui/table-resize-handle.d.ts +22 -0
  157. package/dist/action-plans/components/ui/table.d.ts +112 -0
  158. package/dist/action-plans/components/ui/tabs.d.ts +66 -0
  159. package/dist/action-plans/components/ui/terms-of-use-dialog.d.ts +102 -0
  160. package/dist/action-plans/components/ui/textarea.d.ts +33 -0
  161. package/dist/action-plans/components/ui/timepicker.d.ts +34 -0
  162. package/dist/action-plans/components/ui/toggle-group.d.ts +37 -0
  163. package/dist/action-plans/components/ui/toggle.d.ts +33 -0
  164. package/dist/action-plans/components/ui/tooltip.d.ts +61 -0
  165. package/dist/action-plans/components/ui/truncated-cell.d.ts +20 -0
  166. package/dist/action-plans/components/ui/typography.d.ts +135 -0
  167. package/dist/action-plans/components/ui/updates-notification.d.ts +47 -0
  168. package/dist/action-plans/components/ui/users-groups-selector.d.ts +87 -0
  169. package/dist/action-plans/components/ui/viewer-dialog.d.ts +184 -0
  170. package/dist/action-plans/config/backend.d.ts +10 -0
  171. package/dist/action-plans/config/environments.d.ts +12 -0
  172. package/dist/action-plans/config/index.d.ts +75 -0
  173. package/dist/action-plans/contexts/LocaleContext.d.ts +15 -0
  174. package/dist/action-plans/contexts/ModalStateContext.d.ts +57 -0
  175. package/dist/action-plans/contexts/ModuleContext.d.ts +34 -0
  176. package/dist/action-plans/contexts/NavigationContext.d.ts +13 -0
  177. package/dist/action-plans/contexts/PageMetadataContext.d.ts +48 -0
  178. package/dist/action-plans/crud/components/ActionMenuItems.d.ts +22 -0
  179. package/dist/action-plans/crud/components/BaseForm.d.ts +52 -0
  180. package/dist/action-plans/crud/components/ColumnSettingsPopover.d.ts +28 -0
  181. package/dist/action-plans/crud/components/ContextMenu.d.ts +21 -0
  182. package/dist/action-plans/crud/components/CrudActionBar.d.ts +59 -0
  183. package/dist/action-plans/crud/components/CrudGrid.d.ts +53 -0
  184. package/dist/action-plans/crud/components/CrudPagination.d.ts +17 -0
  185. package/dist/action-plans/crud/components/CrudTable.d.ts +66 -0
  186. package/dist/action-plans/crud/components/FilterBar.d.ts +136 -0
  187. package/dist/action-plans/crud/components/GroupDropZone.d.ts +16 -0
  188. package/dist/action-plans/crud/components/InlineRowActions.d.ts +15 -0
  189. package/dist/action-plans/crud/components/SelectionCheckbox.d.ts +9 -0
  190. package/dist/action-plans/crud/components/TableFooter.d.ts +14 -0
  191. package/dist/action-plans/crud/components/TableRowActions.d.ts +19 -0
  192. package/dist/action-plans/crud/createCrudPage.d.ts +134 -0
  193. package/dist/action-plans/crud/createSimpleService.d.ts +85 -0
  194. package/dist/action-plans/crud/generateCrudConfig.d.ts +78 -0
  195. package/dist/action-plans/crud/hooks/useBaseForm.d.ts +47 -0
  196. package/dist/action-plans/crud/hooks/useColumnDragReorder.d.ts +19 -0
  197. package/dist/action-plans/crud/hooks/useColumnManager.d.ts +85 -0
  198. package/dist/action-plans/crud/hooks/useCrud.d.ts +152 -0
  199. package/dist/action-plans/crud/primitives/ActionMenu.d.ts +69 -0
  200. package/dist/action-plans/crud/primitives/FilterBar.d.ts +69 -0
  201. package/dist/action-plans/crud/primitives/Pagination.d.ts +29 -0
  202. package/dist/action-plans/crud/primitives/Table.d.ts +31 -0
  203. package/dist/action-plans/crud/primitives/TreeTable.d.ts +7 -0
  204. package/dist/action-plans/crud/primitives/index.d.ts +12 -0
  205. package/dist/action-plans/crud/primitives/types.d.ts +199 -0
  206. package/dist/action-plans/crud/utils/routingHelpers.d.ts +41 -0
  207. package/dist/action-plans/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  208. package/dist/action-plans/custom-form-fields/fields/FormDateField.d.ts +9 -0
  209. package/dist/action-plans/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  210. package/dist/action-plans/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  211. package/dist/action-plans/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  212. package/dist/action-plans/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  213. package/dist/action-plans/custom-form-fields/fields/FormTextField.d.ts +9 -0
  214. package/dist/action-plans/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  215. package/dist/action-plans/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  216. package/dist/action-plans/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  217. package/dist/action-plans/custom-form-fields/index.d.ts +13 -0
  218. package/dist/action-plans/custom-form-fields/types.d.ts +206 -0
  219. package/dist/action-plans/exports/action-plans.d.ts +16 -0
  220. package/dist/action-plans/exports/audit-trail.d.ts +1 -0
  221. package/dist/action-plans/exports/crud.d.ts +31 -0
  222. package/dist/action-plans/exports/custom-form-fields.d.ts +1 -0
  223. package/dist/action-plans/exports/file-upload.d.ts +1 -0
  224. package/dist/action-plans/exports/integrations.d.ts +15 -0
  225. package/dist/action-plans/exports/ui.d.ts +98 -0
  226. package/dist/action-plans/file-upload/components/SingleFileUpload.d.ts +102 -0
  227. package/dist/action-plans/file-upload/index.d.ts +6 -0
  228. package/dist/action-plans/file-upload/types.d.ts +26 -0
  229. package/dist/action-plans/file-upload/utils/formatBytes.d.ts +6 -0
  230. package/dist/action-plans/file-upload/utils/getFileExtension.d.ts +6 -0
  231. package/dist/action-plans/hooks/useActiveModules.d.ts +45 -0
  232. package/dist/action-plans/hooks/useAliasFromUrl.d.ts +33 -0
  233. package/dist/action-plans/hooks/useColumnResize.d.ts +45 -0
  234. package/dist/action-plans/hooks/useDebounce.d.ts +56 -0
  235. package/dist/action-plans/hooks/useDerivedContractedModules.d.ts +8 -0
  236. package/dist/action-plans/hooks/useI18nFormatters.d.ts +40 -0
  237. package/dist/action-plans/hooks/useMediaQuery.d.ts +14 -0
  238. package/dist/action-plans/hooks/useModuleAccess.d.ts +59 -0
  239. package/dist/action-plans/hooks/usePageTitle.d.ts +10 -0
  240. package/dist/action-plans/hooks/usePermissionQuery.d.ts +49 -0
  241. package/dist/action-plans/hooks/useRowResize.d.ts +37 -0
  242. package/dist/action-plans/hooks/useSidebarResize.d.ts +37 -0
  243. package/dist/action-plans/hooks/useUpdatesNotification.d.ts +27 -0
  244. package/dist/action-plans/hooks/useWizard.d.ts +40 -0
  245. package/dist/action-plans/i18n/config.d.ts +13 -0
  246. package/dist/action-plans/i18n/constants.d.ts +126 -0
  247. package/dist/action-plans/i18n/index.d.ts +11 -0
  248. package/dist/action-plans/i18n/utils.d.ts +14 -0
  249. package/dist/action-plans/index.d.ts +103 -14
  250. package/dist/action-plans/index.esm.js +1 -0
  251. package/dist/action-plans/index.js +1 -0
  252. package/dist/action-plans/integrations/clarity/clarityTracking.d.ts +31 -0
  253. package/dist/action-plans/integrations/clarity/index.d.ts +3 -0
  254. package/dist/action-plans/integrations/clarity/types.d.ts +46 -0
  255. package/dist/action-plans/integrations/clarity/useClarity.d.ts +34 -0
  256. package/dist/action-plans/integrations/index.d.ts +5 -0
  257. package/dist/action-plans/leadership/components/LeadershipDialog.d.ts +10 -0
  258. package/dist/action-plans/leadership/components/LeadershipForm.d.ts +8 -0
  259. package/dist/action-plans/leadership/components/LeadershipPage.d.ts +19 -0
  260. package/dist/action-plans/leadership/hooks/useLeadershipApi.d.ts +4 -0
  261. package/dist/action-plans/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  262. package/dist/action-plans/leadership/index.d.ts +13 -0
  263. package/dist/action-plans/leadership/types.d.ts +23 -0
  264. package/dist/action-plans/leadership/utils/leadershipUtils.d.ts +8 -0
  265. package/dist/action-plans/media/components/ImageEditor.d.ts +22 -0
  266. package/dist/action-plans/media/components/ImageRenderer.d.ts +23 -0
  267. package/dist/action-plans/media/components/VideoEditor.d.ts +2 -0
  268. package/dist/action-plans/media/components/VideoRenderer.d.ts +2 -0
  269. package/dist/action-plans/media/hooks/useMediaUpload.d.ts +19 -0
  270. package/dist/action-plans/media/index.d.ts +49 -0
  271. package/dist/action-plans/media/types.d.ts +66 -0
  272. package/dist/action-plans/media/utils/imageHelpers.d.ts +28 -0
  273. package/dist/action-plans/media/utils/videoHelpers.d.ts +35 -0
  274. package/dist/action-plans/mind-map/components/MindMap.d.ts +23 -0
  275. package/dist/action-plans/mind-map/components/MindMapConnection.d.ts +12 -0
  276. package/dist/action-plans/mind-map/components/MindMapNodeView.d.ts +24 -0
  277. package/dist/action-plans/mind-map/components/MindMapToolbar.d.ts +26 -0
  278. package/dist/action-plans/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  279. package/dist/action-plans/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  280. package/dist/action-plans/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  281. package/dist/action-plans/mind-map/hooks/useMindMapState.d.ts +32 -0
  282. package/dist/action-plans/mind-map/index.d.ts +4 -0
  283. package/dist/action-plans/mind-map/types.d.ts +91 -0
  284. package/dist/action-plans/mind-map/utils/export-image.d.ts +9 -0
  285. package/dist/action-plans/mind-map/utils/layout.d.ts +15 -0
  286. package/dist/action-plans/mind-map/utils/nodeOps.d.ts +66 -0
  287. package/dist/action-plans/mind-map/utils/serialize.d.ts +10 -0
  288. package/dist/action-plans/modules/softwaresMap.d.ts +4 -0
  289. package/dist/action-plans/places/components/ManageAccessModal.d.ts +11 -0
  290. package/dist/action-plans/places/components/PlaceCard.d.ts +12 -0
  291. package/dist/action-plans/places/components/PlacesList.d.ts +12 -0
  292. package/dist/action-plans/places/index.d.ts +8 -0
  293. package/dist/action-plans/places/services/PlaceService.d.ts +9 -0
  294. package/dist/action-plans/places/types.d.ts +10 -0
  295. package/dist/action-plans/providers/CoreProviders.d.ts +107 -0
  296. package/dist/action-plans/providers/index.d.ts +2 -0
  297. package/dist/action-plans/qualiex/components/QualiexUserField.d.ts +133 -0
  298. package/dist/action-plans/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  299. package/dist/action-plans/qualiex/services/qualiexApi.d.ts +75 -0
  300. package/dist/action-plans/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  301. package/dist/action-plans/qualiex/utils/userPlaceUtils.d.ts +16 -0
  302. package/dist/action-plans/services/BaseService.d.ts +51 -0
  303. package/dist/action-plans/services/EmailService.d.ts +110 -0
  304. package/dist/action-plans/services/ErrorService.d.ts +19 -0
  305. package/dist/action-plans/services/QualiexEnrichmentService.d.ts +53 -0
  306. package/dist/action-plans/services/QualiexFieldHelpers.d.ts +17 -0
  307. package/dist/action-plans/setup/favicon.d.ts +1 -0
  308. package/dist/action-plans/setup.d.ts +16 -0
  309. package/dist/action-plans/sign/components/D4SignWidget.d.ts +2 -0
  310. package/dist/action-plans/sign/components/DocumentSigner.d.ts +2 -0
  311. package/dist/action-plans/sign/components/SignConfigForm.d.ts +2 -0
  312. package/dist/action-plans/sign/components/SignWidget.d.ts +9 -0
  313. package/dist/action-plans/sign/hooks/useSignConfig.d.ts +6 -0
  314. package/dist/action-plans/sign/index.d.ts +8 -0
  315. package/dist/action-plans/sign/services/signService.d.ts +17 -0
  316. package/dist/action-plans/sign/types.d.ts +53 -0
  317. package/dist/action-plans/sign/utils/loadClicksignScript.d.ts +13 -0
  318. package/dist/action-plans/supabase/SupabaseSingleton.d.ts +34 -0
  319. package/dist/action-plans/supabase/client.d.ts +2 -0
  320. package/dist/action-plans/supabase/legacyKeyGuard.d.ts +19 -0
  321. package/dist/action-plans/supabase/publicClient.d.ts +2 -0
  322. package/dist/action-plans/supabase/types.d.ts +377 -0
  323. package/dist/action-plans/team-selector/components/TeamSelector.d.ts +24 -0
  324. package/dist/action-plans/team-selector/index.d.ts +2 -0
  325. package/dist/action-plans/team-selector/types.d.ts +10 -0
  326. package/dist/action-plans/types/sidebar.d.ts +52 -0
  327. package/dist/action-plans/types.d.ts +551 -361
  328. package/dist/action-plans/utils/color.d.ts +26 -0
  329. package/dist/action-plans/utils/formatters/currencyFormatters.d.ts +1 -0
  330. package/dist/action-plans/utils/formatters/dateFormatters.d.ts +52 -0
  331. package/dist/action-plans/utils/index.d.ts +9 -0
  332. package/dist/action-plans/utils/linkHelpers.d.ts +9 -0
  333. package/dist/action-plans/utils/load-fonts.d.ts +1 -0
  334. package/dist/audit-trail/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  335. package/dist/audit-trail/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  336. package/dist/audit-trail/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  337. package/dist/audit-trail/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  338. package/dist/audit-trail/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  339. package/dist/audit-trail/action-plans/components/ActionPlanPage.d.ts +25 -0
  340. package/dist/audit-trail/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  341. package/dist/audit-trail/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  342. package/dist/audit-trail/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  343. package/dist/audit-trail/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  344. package/dist/audit-trail/action-plans/constants.d.ts +86 -0
  345. package/dist/audit-trail/action-plans/hooks/useActionPlan.d.ts +19 -0
  346. package/dist/audit-trail/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  347. package/dist/audit-trail/action-plans/index.d.ts +15 -0
  348. package/dist/audit-trail/action-plans/types.d.ts +413 -0
  349. package/dist/audit-trail/action-plans/utils/formatTime.d.ts +24 -0
  350. package/dist/audit-trail/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  351. package/dist/audit-trail/approval-flow/components/ApproveDialog.d.ts +13 -0
  352. package/dist/audit-trail/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  353. package/dist/audit-trail/approval-flow/index.d.ts +4 -0
  354. package/dist/audit-trail/approval-flow/types.d.ts +76 -0
  355. package/dist/audit-trail/assets/index.d.ts +7 -0
  356. package/dist/audit-trail/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  357. package/dist/audit-trail/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  358. package/dist/audit-trail/audit-trail/components/AuditTrailPage.d.ts +40 -0
  359. package/dist/audit-trail/audit-trail/index.d.ts +9 -0
  360. package/dist/audit-trail/audit-trail/types.d.ts +209 -0
  361. package/dist/audit-trail/audit-trail/utils.d.ts +54 -0
  362. package/dist/audit-trail/auth/components/AliasRedirect.d.ts +13 -0
  363. package/dist/audit-trail/auth/components/AliasRouteGuard.d.ts +20 -0
  364. package/dist/audit-trail/auth/components/EditProfileDialog.d.ts +13 -0
  365. package/dist/audit-trail/auth/components/ProtectedRoute.d.ts +11 -0
  366. package/dist/audit-trail/auth/components/UserInfo.d.ts +10 -0
  367. package/dist/audit-trail/auth/contexts/AuthContext.d.ts +89 -0
  368. package/dist/audit-trail/auth/pages/CallbackPage.d.ts +6 -0
  369. package/dist/audit-trail/auth/pages/LoginPage.d.ts +2 -0
  370. package/dist/audit-trail/auth/services/AuthService.d.ts +45 -0
  371. package/dist/audit-trail/auth/services/SupabaseTokenService.d.ts +3 -0
  372. package/dist/audit-trail/auth/services/TokenManager.d.ts +66 -0
  373. package/dist/audit-trail/auth/services/TokenRegenerationService.d.ts +14 -0
  374. package/dist/audit-trail/auth/services/TokenService.d.ts +48 -0
  375. package/dist/audit-trail/auth/utils/ErrorInterceptor.d.ts +20 -0
  376. package/dist/audit-trail/components/ErrorBoundary.d.ts +19 -0
  377. package/dist/audit-trail/components/dashboards/dashboard-form.d.ts +65 -0
  378. package/dist/audit-trail/components/dashboards/dashboard-general-view.d.ts +124 -0
  379. package/dist/audit-trail/components/dashboards/dashboard-grid.d.ts +66 -0
  380. package/dist/audit-trail/components/dashboards/dashboard-list.d.ts +41 -0
  381. package/dist/audit-trail/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  382. package/dist/audit-trail/components/dashboards/dashboard-view.d.ts +48 -0
  383. package/dist/audit-trail/components/dashboards/helpers.d.ts +86 -0
  384. package/dist/audit-trail/components/dashboards/index.d.ts +9 -0
  385. package/dist/audit-trail/components/dashboards/panels/burndown-panel.d.ts +41 -0
  386. package/dist/audit-trail/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  387. package/dist/audit-trail/components/dashboards/panels/index.d.ts +14 -0
  388. package/dist/audit-trail/components/dashboards/panels/list-panel.d.ts +45 -0
  389. package/dist/audit-trail/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  390. package/dist/audit-trail/components/dashboards/panels/numeric-panel.d.ts +32 -0
  391. package/dist/audit-trail/components/dashboards/panels/panel-error.d.ts +18 -0
  392. package/dist/audit-trail/components/dashboards/panels/panel-header.d.ts +27 -0
  393. package/dist/audit-trail/components/dashboards/panels/panel-loader.d.ts +17 -0
  394. package/dist/audit-trail/components/dashboards/panels/panel-no-data.d.ts +16 -0
  395. package/dist/audit-trail/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  396. package/dist/audit-trail/components/dashboards/panels/pareto-panel.d.ts +30 -0
  397. package/dist/audit-trail/components/dashboards/panels/performance-panel.d.ts +39 -0
  398. package/dist/audit-trail/components/dashboards/panels/pie-panel.d.ts +29 -0
  399. package/dist/audit-trail/components/dashboards/panels/text-panel.d.ts +28 -0
  400. package/dist/audit-trail/components/dashboards/types.d.ts +755 -0
  401. package/dist/audit-trail/components/layout/AppHeader.d.ts +6 -0
  402. package/dist/audit-trail/components/layout/AppLayout.d.ts +10 -0
  403. package/dist/audit-trail/components/layout/AppSidebar.d.ts +10 -0
  404. package/dist/audit-trail/components/layout/BodyContent.d.ts +60 -0
  405. package/dist/audit-trail/components/layout/SidebarActionTrigger.d.ts +46 -0
  406. package/dist/audit-trail/components/layout/SidebarHeader.d.ts +5 -0
  407. package/dist/audit-trail/components/layout/SidebarLogo.d.ts +5 -0
  408. package/dist/audit-trail/components/layout/sidebar-utils.d.ts +12 -0
  409. package/dist/audit-trail/components/modules/AccessDeniedDialog.d.ts +43 -0
  410. package/dist/audit-trail/components/modules/ModuleAccessGuard.d.ts +42 -0
  411. package/dist/audit-trail/components/modules/ModuleGrid.d.ts +9 -0
  412. package/dist/audit-trail/components/modules/ModuleOfferContent.d.ts +20 -0
  413. package/dist/audit-trail/components/modules/ModulesContent.d.ts +21 -0
  414. package/dist/audit-trail/components/modules/ModulesDialog.d.ts +3 -0
  415. package/dist/audit-trail/components/modules/ModulesFooterCards.d.ts +10 -0
  416. package/dist/audit-trail/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  417. package/dist/audit-trail/components/modules/index.d.ts +14 -0
  418. package/dist/audit-trail/components/modules/modulesData.d.ts +6 -0
  419. package/dist/audit-trail/components/modules/types.d.ts +41 -0
  420. package/dist/audit-trail/components/ui/accordion.d.ts +42 -0
  421. package/dist/audit-trail/components/ui/action-button.d.ts +48 -0
  422. package/dist/audit-trail/components/ui/alert-dialog.d.ts +102 -0
  423. package/dist/audit-trail/components/ui/alert.d.ts +44 -0
  424. package/dist/audit-trail/components/ui/avatar.d.ts +36 -0
  425. package/dist/audit-trail/components/ui/badge.d.ts +41 -0
  426. package/dist/audit-trail/components/ui/breadcrumb.d.ts +73 -0
  427. package/dist/audit-trail/components/ui/button-group.d.ts +24 -0
  428. package/dist/audit-trail/components/ui/button.d.ts +66 -0
  429. package/dist/audit-trail/components/ui/calendar.d.ts +24 -0
  430. package/dist/audit-trail/components/ui/card.d.ts +57 -0
  431. package/dist/audit-trail/components/ui/chart.d.ts +97 -0
  432. package/dist/audit-trail/components/ui/checkbox.d.ts +15 -0
  433. package/dist/audit-trail/components/ui/collapsible.d.ts +20 -0
  434. package/dist/audit-trail/components/ui/color-picker.d.ts +19 -0
  435. package/dist/audit-trail/components/ui/combo-tree.d.ts +103 -0
  436. package/dist/audit-trail/components/ui/combobox.d.ts +64 -0
  437. package/dist/audit-trail/components/ui/command.d.ts +89 -0
  438. package/dist/audit-trail/components/ui/context-menu.d.ts +122 -0
  439. package/dist/audit-trail/components/ui/data-list.d.ts +86 -0
  440. package/dist/audit-trail/components/ui/date-picker.d.ts +19 -0
  441. package/dist/audit-trail/components/ui/dialog-wizard.d.ts +100 -0
  442. package/dist/audit-trail/components/ui/dialog.d.ts +229 -0
  443. package/dist/audit-trail/components/ui/disabled-menu-item.d.ts +25 -0
  444. package/dist/audit-trail/components/ui/drawer.d.ts +94 -0
  445. package/dist/audit-trail/components/ui/dropdown-menu.d.ts +180 -0
  446. package/dist/audit-trail/components/ui/electronic-signature-dialog.d.ts +31 -0
  447. package/dist/audit-trail/components/ui/empty-state.d.ts +79 -0
  448. package/dist/audit-trail/components/ui/export-dialog.d.ts +48 -0
  449. package/dist/audit-trail/components/ui/form.d.ts +119 -0
  450. package/dist/audit-trail/components/ui/grid.d.ts +53 -0
  451. package/dist/audit-trail/components/ui/hover-card.d.ts +21 -0
  452. package/dist/audit-trail/components/ui/icon-picker.d.ts +17 -0
  453. package/dist/audit-trail/components/ui/iframe-dialog.d.ts +24 -0
  454. package/dist/audit-trail/components/ui/input-group.d.ts +113 -0
  455. package/dist/audit-trail/components/ui/input.d.ts +24 -0
  456. package/dist/audit-trail/components/ui/label.d.ts +23 -0
  457. package/dist/audit-trail/components/ui/loading-state.d.ts +52 -0
  458. package/dist/audit-trail/components/ui/menubar.d.ts +113 -0
  459. package/dist/audit-trail/components/ui/multiselect-permissions.d.ts +84 -0
  460. package/dist/audit-trail/components/ui/navigation-menu.d.ts +57 -0
  461. package/dist/audit-trail/components/ui/onboarding-dialog.d.ts +58 -0
  462. package/dist/audit-trail/components/ui/online-editor-dialog.d.ts +28 -0
  463. package/dist/audit-trail/components/ui/page-breadcrumb.d.ts +77 -0
  464. package/dist/audit-trail/components/ui/pagination.d.ts +81 -0
  465. package/dist/audit-trail/components/ui/popover.d.ts +57 -0
  466. package/dist/audit-trail/components/ui/progress.d.ts +22 -0
  467. package/dist/audit-trail/components/ui/radio-group.d.ts +66 -0
  468. package/dist/audit-trail/components/ui/report-request-list.d.ts +64 -0
  469. package/dist/audit-trail/components/ui/resizable.d.ts +38 -0
  470. package/dist/audit-trail/components/ui/rich-text-editor.d.ts +58 -0
  471. package/dist/audit-trail/components/ui/scroll-area.d.ts +40 -0
  472. package/dist/audit-trail/components/ui/select.d.ts +94 -0
  473. package/dist/audit-trail/components/ui/separator.d.ts +17 -0
  474. package/dist/audit-trail/components/ui/sheet.d.ts +108 -0
  475. package/dist/audit-trail/components/ui/sidebar.d.ts +269 -0
  476. package/dist/audit-trail/components/ui/skeleton-variants.d.ts +41 -0
  477. package/dist/audit-trail/components/ui/skeleton.d.ts +14 -0
  478. package/dist/audit-trail/components/ui/slider.d.ts +9 -0
  479. package/dist/audit-trail/components/ui/sonner.d.ts +8 -0
  480. package/dist/audit-trail/components/ui/spinner.d.ts +11 -0
  481. package/dist/audit-trail/components/ui/split-button.d.ts +76 -0
  482. package/dist/audit-trail/components/ui/stack.d.ts +17 -0
  483. package/dist/audit-trail/components/ui/status-badge.d.ts +52 -0
  484. package/dist/audit-trail/components/ui/step-selector.d.ts +46 -0
  485. package/dist/audit-trail/components/ui/stimulsoft-viewer.d.ts +28 -0
  486. package/dist/audit-trail/components/ui/switch.d.ts +25 -0
  487. package/dist/audit-trail/components/ui/tab-page-layout.d.ts +52 -0
  488. package/dist/audit-trail/components/ui/table-resize-handle.d.ts +22 -0
  489. package/dist/audit-trail/components/ui/table.d.ts +112 -0
  490. package/dist/audit-trail/components/ui/tabs.d.ts +66 -0
  491. package/dist/audit-trail/components/ui/terms-of-use-dialog.d.ts +102 -0
  492. package/dist/audit-trail/components/ui/textarea.d.ts +33 -0
  493. package/dist/audit-trail/components/ui/timepicker.d.ts +34 -0
  494. package/dist/audit-trail/components/ui/toggle-group.d.ts +37 -0
  495. package/dist/audit-trail/components/ui/toggle.d.ts +33 -0
  496. package/dist/audit-trail/components/ui/tooltip.d.ts +61 -0
  497. package/dist/audit-trail/components/ui/truncated-cell.d.ts +20 -0
  498. package/dist/audit-trail/components/ui/typography.d.ts +135 -0
  499. package/dist/audit-trail/components/ui/updates-notification.d.ts +47 -0
  500. package/dist/audit-trail/components/ui/users-groups-selector.d.ts +87 -0
  501. package/dist/audit-trail/components/ui/viewer-dialog.d.ts +184 -0
  502. package/dist/audit-trail/config/backend.d.ts +10 -0
  503. package/dist/audit-trail/config/environments.d.ts +12 -0
  504. package/dist/audit-trail/config/index.d.ts +75 -0
  505. package/dist/audit-trail/contexts/LocaleContext.d.ts +15 -0
  506. package/dist/audit-trail/contexts/ModalStateContext.d.ts +57 -0
  507. package/dist/audit-trail/contexts/ModuleContext.d.ts +34 -0
  508. package/dist/audit-trail/contexts/NavigationContext.d.ts +13 -0
  509. package/dist/audit-trail/contexts/PageMetadataContext.d.ts +48 -0
  510. package/dist/audit-trail/crud/components/ActionMenuItems.d.ts +22 -0
  511. package/dist/audit-trail/crud/components/BaseForm.d.ts +52 -0
  512. package/dist/audit-trail/crud/components/ColumnSettingsPopover.d.ts +28 -0
  513. package/dist/audit-trail/crud/components/ContextMenu.d.ts +21 -0
  514. package/dist/audit-trail/crud/components/CrudActionBar.d.ts +59 -0
  515. package/dist/audit-trail/crud/components/CrudGrid.d.ts +53 -0
  516. package/dist/audit-trail/crud/components/CrudPagination.d.ts +17 -0
  517. package/dist/audit-trail/crud/components/CrudTable.d.ts +66 -0
  518. package/dist/audit-trail/crud/components/FilterBar.d.ts +136 -0
  519. package/dist/audit-trail/crud/components/GroupDropZone.d.ts +16 -0
  520. package/dist/audit-trail/crud/components/InlineRowActions.d.ts +15 -0
  521. package/dist/audit-trail/crud/components/SelectionCheckbox.d.ts +9 -0
  522. package/dist/audit-trail/crud/components/TableFooter.d.ts +14 -0
  523. package/dist/audit-trail/crud/components/TableRowActions.d.ts +19 -0
  524. package/dist/audit-trail/crud/createCrudPage.d.ts +134 -0
  525. package/dist/audit-trail/crud/createSimpleService.d.ts +85 -0
  526. package/dist/audit-trail/crud/generateCrudConfig.d.ts +78 -0
  527. package/dist/audit-trail/crud/hooks/useBaseForm.d.ts +47 -0
  528. package/dist/audit-trail/crud/hooks/useColumnDragReorder.d.ts +19 -0
  529. package/dist/audit-trail/crud/hooks/useColumnManager.d.ts +85 -0
  530. package/dist/audit-trail/crud/hooks/useCrud.d.ts +152 -0
  531. package/dist/audit-trail/crud/primitives/ActionMenu.d.ts +69 -0
  532. package/dist/audit-trail/crud/primitives/FilterBar.d.ts +69 -0
  533. package/dist/audit-trail/crud/primitives/Pagination.d.ts +29 -0
  534. package/dist/audit-trail/crud/primitives/Table.d.ts +31 -0
  535. package/dist/audit-trail/crud/primitives/TreeTable.d.ts +7 -0
  536. package/dist/audit-trail/crud/primitives/index.d.ts +12 -0
  537. package/dist/audit-trail/crud/primitives/types.d.ts +199 -0
  538. package/dist/audit-trail/crud/utils/routingHelpers.d.ts +41 -0
  539. package/dist/audit-trail/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  540. package/dist/audit-trail/custom-form-fields/fields/FormDateField.d.ts +9 -0
  541. package/dist/audit-trail/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  542. package/dist/audit-trail/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  543. package/dist/audit-trail/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  544. package/dist/audit-trail/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  545. package/dist/audit-trail/custom-form-fields/fields/FormTextField.d.ts +9 -0
  546. package/dist/audit-trail/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  547. package/dist/audit-trail/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  548. package/dist/audit-trail/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  549. package/dist/audit-trail/custom-form-fields/index.d.ts +13 -0
  550. package/dist/audit-trail/custom-form-fields/types.d.ts +206 -0
  551. package/dist/audit-trail/exports/action-plans.d.ts +16 -0
  552. package/dist/audit-trail/exports/audit-trail.d.ts +1 -0
  553. package/dist/audit-trail/exports/crud.d.ts +31 -0
  554. package/dist/audit-trail/exports/custom-form-fields.d.ts +1 -0
  555. package/dist/audit-trail/exports/file-upload.d.ts +1 -0
  556. package/dist/audit-trail/exports/integrations.d.ts +15 -0
  557. package/dist/audit-trail/exports/ui.d.ts +98 -0
  558. package/dist/audit-trail/file-upload/components/SingleFileUpload.d.ts +102 -0
  559. package/dist/audit-trail/file-upload/index.d.ts +6 -0
  560. package/dist/audit-trail/file-upload/types.d.ts +26 -0
  561. package/dist/audit-trail/file-upload/utils/formatBytes.d.ts +6 -0
  562. package/dist/audit-trail/file-upload/utils/getFileExtension.d.ts +6 -0
  563. package/dist/audit-trail/hooks/useActiveModules.d.ts +45 -0
  564. package/dist/audit-trail/hooks/useAliasFromUrl.d.ts +33 -0
  565. package/dist/audit-trail/hooks/useColumnResize.d.ts +45 -0
  566. package/dist/audit-trail/hooks/useDebounce.d.ts +56 -0
  567. package/dist/audit-trail/hooks/useDerivedContractedModules.d.ts +8 -0
  568. package/dist/audit-trail/hooks/useI18nFormatters.d.ts +40 -0
  569. package/dist/audit-trail/hooks/useMediaQuery.d.ts +14 -0
  570. package/dist/audit-trail/hooks/useModuleAccess.d.ts +59 -0
  571. package/dist/audit-trail/hooks/usePageTitle.d.ts +10 -0
  572. package/dist/audit-trail/hooks/usePermissionQuery.d.ts +49 -0
  573. package/dist/audit-trail/hooks/useRowResize.d.ts +37 -0
  574. package/dist/audit-trail/hooks/useSidebarResize.d.ts +37 -0
  575. package/dist/audit-trail/hooks/useUpdatesNotification.d.ts +27 -0
  576. package/dist/audit-trail/hooks/useWizard.d.ts +40 -0
  577. package/dist/audit-trail/i18n/config.d.ts +13 -0
  578. package/dist/audit-trail/i18n/constants.d.ts +126 -0
  579. package/dist/audit-trail/i18n/index.d.ts +11 -0
  580. package/dist/audit-trail/i18n/utils.d.ts +14 -0
  581. package/dist/audit-trail/index.d.ts +103 -8
  582. package/dist/audit-trail/index.esm.js +1 -0
  583. package/dist/audit-trail/index.js +1 -0
  584. package/dist/audit-trail/integrations/clarity/clarityTracking.d.ts +31 -0
  585. package/dist/audit-trail/integrations/clarity/index.d.ts +3 -0
  586. package/dist/audit-trail/integrations/clarity/types.d.ts +46 -0
  587. package/dist/audit-trail/integrations/clarity/useClarity.d.ts +34 -0
  588. package/dist/audit-trail/integrations/index.d.ts +5 -0
  589. package/dist/audit-trail/leadership/components/LeadershipDialog.d.ts +10 -0
  590. package/dist/audit-trail/leadership/components/LeadershipForm.d.ts +8 -0
  591. package/dist/audit-trail/leadership/components/LeadershipPage.d.ts +19 -0
  592. package/dist/audit-trail/leadership/hooks/useLeadershipApi.d.ts +4 -0
  593. package/dist/audit-trail/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  594. package/dist/audit-trail/leadership/index.d.ts +13 -0
  595. package/dist/audit-trail/leadership/types.d.ts +23 -0
  596. package/dist/audit-trail/leadership/utils/leadershipUtils.d.ts +8 -0
  597. package/dist/audit-trail/media/components/ImageEditor.d.ts +22 -0
  598. package/dist/audit-trail/media/components/ImageRenderer.d.ts +23 -0
  599. package/dist/audit-trail/media/components/VideoEditor.d.ts +2 -0
  600. package/dist/audit-trail/media/components/VideoRenderer.d.ts +2 -0
  601. package/dist/audit-trail/media/hooks/useMediaUpload.d.ts +19 -0
  602. package/dist/audit-trail/media/index.d.ts +49 -0
  603. package/dist/audit-trail/media/types.d.ts +66 -0
  604. package/dist/audit-trail/media/utils/imageHelpers.d.ts +28 -0
  605. package/dist/audit-trail/media/utils/videoHelpers.d.ts +35 -0
  606. package/dist/audit-trail/mind-map/components/MindMap.d.ts +23 -0
  607. package/dist/audit-trail/mind-map/components/MindMapConnection.d.ts +12 -0
  608. package/dist/audit-trail/mind-map/components/MindMapNodeView.d.ts +24 -0
  609. package/dist/audit-trail/mind-map/components/MindMapToolbar.d.ts +26 -0
  610. package/dist/audit-trail/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  611. package/dist/audit-trail/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  612. package/dist/audit-trail/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  613. package/dist/audit-trail/mind-map/hooks/useMindMapState.d.ts +32 -0
  614. package/dist/audit-trail/mind-map/index.d.ts +4 -0
  615. package/dist/audit-trail/mind-map/types.d.ts +91 -0
  616. package/dist/audit-trail/mind-map/utils/export-image.d.ts +9 -0
  617. package/dist/audit-trail/mind-map/utils/layout.d.ts +15 -0
  618. package/dist/audit-trail/mind-map/utils/nodeOps.d.ts +66 -0
  619. package/dist/audit-trail/mind-map/utils/serialize.d.ts +10 -0
  620. package/dist/audit-trail/modules/softwaresMap.d.ts +4 -0
  621. package/dist/audit-trail/places/components/ManageAccessModal.d.ts +11 -0
  622. package/dist/audit-trail/places/components/PlaceCard.d.ts +12 -0
  623. package/dist/audit-trail/places/components/PlacesList.d.ts +12 -0
  624. package/dist/audit-trail/places/index.d.ts +8 -0
  625. package/dist/audit-trail/places/services/PlaceService.d.ts +9 -0
  626. package/dist/audit-trail/places/types.d.ts +10 -0
  627. package/dist/audit-trail/providers/CoreProviders.d.ts +107 -0
  628. package/dist/audit-trail/providers/index.d.ts +2 -0
  629. package/dist/audit-trail/qualiex/components/QualiexUserField.d.ts +133 -0
  630. package/dist/audit-trail/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  631. package/dist/audit-trail/qualiex/services/qualiexApi.d.ts +75 -0
  632. package/dist/audit-trail/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  633. package/dist/audit-trail/qualiex/utils/userPlaceUtils.d.ts +16 -0
  634. package/dist/audit-trail/services/BaseService.d.ts +51 -0
  635. package/dist/audit-trail/services/EmailService.d.ts +110 -0
  636. package/dist/audit-trail/services/ErrorService.d.ts +19 -0
  637. package/dist/audit-trail/services/QualiexEnrichmentService.d.ts +53 -0
  638. package/dist/audit-trail/services/QualiexFieldHelpers.d.ts +17 -0
  639. package/dist/audit-trail/setup/favicon.d.ts +1 -0
  640. package/dist/audit-trail/setup.d.ts +16 -0
  641. package/dist/audit-trail/sign/components/D4SignWidget.d.ts +2 -0
  642. package/dist/audit-trail/sign/components/DocumentSigner.d.ts +2 -0
  643. package/dist/audit-trail/sign/components/SignConfigForm.d.ts +2 -0
  644. package/dist/audit-trail/sign/components/SignWidget.d.ts +9 -0
  645. package/dist/audit-trail/sign/hooks/useSignConfig.d.ts +6 -0
  646. package/dist/audit-trail/sign/index.d.ts +8 -0
  647. package/dist/audit-trail/sign/services/signService.d.ts +17 -0
  648. package/dist/audit-trail/sign/types.d.ts +53 -0
  649. package/dist/audit-trail/sign/utils/loadClicksignScript.d.ts +13 -0
  650. package/dist/audit-trail/supabase/SupabaseSingleton.d.ts +34 -0
  651. package/dist/audit-trail/supabase/client.d.ts +2 -0
  652. package/dist/audit-trail/supabase/legacyKeyGuard.d.ts +19 -0
  653. package/dist/audit-trail/supabase/publicClient.d.ts +2 -0
  654. package/dist/audit-trail/supabase/types.d.ts +377 -0
  655. package/dist/audit-trail/team-selector/components/TeamSelector.d.ts +24 -0
  656. package/dist/audit-trail/team-selector/index.d.ts +2 -0
  657. package/dist/audit-trail/team-selector/types.d.ts +10 -0
  658. package/dist/audit-trail/types/sidebar.d.ts +52 -0
  659. package/dist/audit-trail/types.d.ts +567 -173
  660. package/dist/audit-trail/utils/color.d.ts +26 -0
  661. package/dist/audit-trail/utils/formatters/currencyFormatters.d.ts +1 -0
  662. package/dist/audit-trail/utils/formatters/dateFormatters.d.ts +52 -0
  663. package/dist/audit-trail/utils/index.d.ts +9 -0
  664. package/dist/audit-trail/utils/linkHelpers.d.ts +9 -0
  665. package/dist/audit-trail/utils/load-fonts.d.ts +1 -0
  666. package/dist/components/ui/icon-picker.d.ts +2 -0
  667. package/dist/config/backend.d.ts +10 -0
  668. package/dist/index.css +1 -1
  669. package/dist/index.css.map +1 -1
  670. package/dist/index.d.ts +4 -6
  671. package/dist/index.esm.js +1 -1
  672. package/dist/index.js +1 -1
  673. package/dist/leadership/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  674. package/dist/leadership/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  675. package/dist/leadership/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  676. package/dist/leadership/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  677. package/dist/leadership/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  678. package/dist/leadership/action-plans/components/ActionPlanPage.d.ts +25 -0
  679. package/dist/leadership/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  680. package/dist/leadership/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  681. package/dist/leadership/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  682. package/dist/leadership/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  683. package/dist/leadership/action-plans/constants.d.ts +86 -0
  684. package/dist/leadership/action-plans/hooks/useActionPlan.d.ts +19 -0
  685. package/dist/leadership/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  686. package/dist/leadership/action-plans/index.d.ts +15 -0
  687. package/dist/leadership/action-plans/types.d.ts +413 -0
  688. package/dist/leadership/action-plans/utils/formatTime.d.ts +24 -0
  689. package/dist/leadership/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  690. package/dist/leadership/approval-flow/components/ApproveDialog.d.ts +13 -0
  691. package/dist/leadership/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  692. package/dist/leadership/approval-flow/index.d.ts +4 -0
  693. package/dist/leadership/approval-flow/types.d.ts +76 -0
  694. package/dist/leadership/assets/index.d.ts +7 -0
  695. package/dist/leadership/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  696. package/dist/leadership/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  697. package/dist/leadership/audit-trail/components/AuditTrailPage.d.ts +40 -0
  698. package/dist/leadership/audit-trail/index.d.ts +9 -0
  699. package/dist/leadership/audit-trail/types.d.ts +209 -0
  700. package/dist/leadership/audit-trail/utils.d.ts +54 -0
  701. package/dist/leadership/auth/components/AliasRedirect.d.ts +13 -0
  702. package/dist/leadership/auth/components/AliasRouteGuard.d.ts +20 -0
  703. package/dist/leadership/auth/components/EditProfileDialog.d.ts +13 -0
  704. package/dist/leadership/auth/components/ProtectedRoute.d.ts +11 -0
  705. package/dist/leadership/auth/components/UserInfo.d.ts +10 -0
  706. package/dist/leadership/auth/contexts/AuthContext.d.ts +89 -0
  707. package/dist/leadership/auth/pages/CallbackPage.d.ts +6 -0
  708. package/dist/leadership/auth/pages/LoginPage.d.ts +2 -0
  709. package/dist/leadership/auth/services/AuthService.d.ts +45 -0
  710. package/dist/leadership/auth/services/SupabaseTokenService.d.ts +3 -0
  711. package/dist/leadership/auth/services/TokenManager.d.ts +66 -0
  712. package/dist/leadership/auth/services/TokenRegenerationService.d.ts +14 -0
  713. package/dist/leadership/auth/services/TokenService.d.ts +48 -0
  714. package/dist/leadership/auth/utils/ErrorInterceptor.d.ts +20 -0
  715. package/dist/leadership/components/ErrorBoundary.d.ts +19 -0
  716. package/dist/leadership/components/dashboards/dashboard-form.d.ts +65 -0
  717. package/dist/leadership/components/dashboards/dashboard-general-view.d.ts +124 -0
  718. package/dist/leadership/components/dashboards/dashboard-grid.d.ts +66 -0
  719. package/dist/leadership/components/dashboards/dashboard-list.d.ts +41 -0
  720. package/dist/leadership/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  721. package/dist/leadership/components/dashboards/dashboard-view.d.ts +48 -0
  722. package/dist/leadership/components/dashboards/helpers.d.ts +86 -0
  723. package/dist/leadership/components/dashboards/index.d.ts +9 -0
  724. package/dist/leadership/components/dashboards/panels/burndown-panel.d.ts +41 -0
  725. package/dist/leadership/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  726. package/dist/leadership/components/dashboards/panels/index.d.ts +14 -0
  727. package/dist/leadership/components/dashboards/panels/list-panel.d.ts +45 -0
  728. package/dist/leadership/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  729. package/dist/leadership/components/dashboards/panels/numeric-panel.d.ts +32 -0
  730. package/dist/leadership/components/dashboards/panels/panel-error.d.ts +18 -0
  731. package/dist/leadership/components/dashboards/panels/panel-header.d.ts +27 -0
  732. package/dist/leadership/components/dashboards/panels/panel-loader.d.ts +17 -0
  733. package/dist/leadership/components/dashboards/panels/panel-no-data.d.ts +16 -0
  734. package/dist/leadership/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  735. package/dist/leadership/components/dashboards/panels/pareto-panel.d.ts +30 -0
  736. package/dist/leadership/components/dashboards/panels/performance-panel.d.ts +39 -0
  737. package/dist/leadership/components/dashboards/panels/pie-panel.d.ts +29 -0
  738. package/dist/leadership/components/dashboards/panels/text-panel.d.ts +28 -0
  739. package/dist/leadership/components/dashboards/types.d.ts +755 -0
  740. package/dist/leadership/components/layout/AppHeader.d.ts +6 -0
  741. package/dist/leadership/components/layout/AppLayout.d.ts +10 -0
  742. package/dist/leadership/components/layout/AppSidebar.d.ts +10 -0
  743. package/dist/leadership/components/layout/BodyContent.d.ts +60 -0
  744. package/dist/leadership/components/layout/SidebarActionTrigger.d.ts +46 -0
  745. package/dist/leadership/components/layout/SidebarHeader.d.ts +5 -0
  746. package/dist/leadership/components/layout/SidebarLogo.d.ts +5 -0
  747. package/dist/leadership/components/layout/sidebar-utils.d.ts +12 -0
  748. package/dist/leadership/components/modules/AccessDeniedDialog.d.ts +43 -0
  749. package/dist/leadership/components/modules/ModuleAccessGuard.d.ts +42 -0
  750. package/dist/leadership/components/modules/ModuleGrid.d.ts +9 -0
  751. package/dist/leadership/components/modules/ModuleOfferContent.d.ts +20 -0
  752. package/dist/leadership/components/modules/ModulesContent.d.ts +21 -0
  753. package/dist/leadership/components/modules/ModulesDialog.d.ts +3 -0
  754. package/dist/leadership/components/modules/ModulesFooterCards.d.ts +10 -0
  755. package/dist/leadership/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  756. package/dist/leadership/components/modules/index.d.ts +14 -0
  757. package/dist/leadership/components/modules/modulesData.d.ts +6 -0
  758. package/dist/leadership/components/modules/types.d.ts +41 -0
  759. package/dist/leadership/components/ui/accordion.d.ts +42 -0
  760. package/dist/leadership/components/ui/action-button.d.ts +48 -0
  761. package/dist/leadership/components/ui/alert-dialog.d.ts +102 -0
  762. package/dist/leadership/components/ui/alert.d.ts +44 -0
  763. package/dist/leadership/components/ui/avatar.d.ts +36 -0
  764. package/dist/leadership/components/ui/badge.d.ts +41 -0
  765. package/dist/leadership/components/ui/breadcrumb.d.ts +73 -0
  766. package/dist/leadership/components/ui/button-group.d.ts +24 -0
  767. package/dist/leadership/components/ui/button.d.ts +66 -0
  768. package/dist/leadership/components/ui/calendar.d.ts +24 -0
  769. package/dist/leadership/components/ui/card.d.ts +57 -0
  770. package/dist/leadership/components/ui/chart.d.ts +97 -0
  771. package/dist/leadership/components/ui/checkbox.d.ts +15 -0
  772. package/dist/leadership/components/ui/collapsible.d.ts +20 -0
  773. package/dist/leadership/components/ui/color-picker.d.ts +19 -0
  774. package/dist/leadership/components/ui/combo-tree.d.ts +103 -0
  775. package/dist/leadership/components/ui/combobox.d.ts +64 -0
  776. package/dist/leadership/components/ui/command.d.ts +89 -0
  777. package/dist/leadership/components/ui/context-menu.d.ts +122 -0
  778. package/dist/leadership/components/ui/data-list.d.ts +86 -0
  779. package/dist/leadership/components/ui/date-picker.d.ts +19 -0
  780. package/dist/leadership/components/ui/dialog-wizard.d.ts +100 -0
  781. package/dist/leadership/components/ui/dialog.d.ts +229 -0
  782. package/dist/leadership/components/ui/disabled-menu-item.d.ts +25 -0
  783. package/dist/leadership/components/ui/drawer.d.ts +94 -0
  784. package/dist/leadership/components/ui/dropdown-menu.d.ts +180 -0
  785. package/dist/leadership/components/ui/electronic-signature-dialog.d.ts +31 -0
  786. package/dist/leadership/components/ui/empty-state.d.ts +79 -0
  787. package/dist/leadership/components/ui/export-dialog.d.ts +48 -0
  788. package/dist/leadership/components/ui/form.d.ts +119 -0
  789. package/dist/leadership/components/ui/grid.d.ts +53 -0
  790. package/dist/leadership/components/ui/hover-card.d.ts +21 -0
  791. package/dist/leadership/components/ui/icon-picker.d.ts +17 -0
  792. package/dist/leadership/components/ui/iframe-dialog.d.ts +24 -0
  793. package/dist/leadership/components/ui/input-group.d.ts +113 -0
  794. package/dist/leadership/components/ui/input.d.ts +24 -0
  795. package/dist/leadership/components/ui/label.d.ts +23 -0
  796. package/dist/leadership/components/ui/loading-state.d.ts +52 -0
  797. package/dist/leadership/components/ui/menubar.d.ts +113 -0
  798. package/dist/leadership/components/ui/multiselect-permissions.d.ts +84 -0
  799. package/dist/leadership/components/ui/navigation-menu.d.ts +57 -0
  800. package/dist/leadership/components/ui/onboarding-dialog.d.ts +58 -0
  801. package/dist/leadership/components/ui/online-editor-dialog.d.ts +28 -0
  802. package/dist/leadership/components/ui/page-breadcrumb.d.ts +77 -0
  803. package/dist/leadership/components/ui/pagination.d.ts +81 -0
  804. package/dist/leadership/components/ui/popover.d.ts +57 -0
  805. package/dist/leadership/components/ui/progress.d.ts +22 -0
  806. package/dist/leadership/components/ui/radio-group.d.ts +66 -0
  807. package/dist/leadership/components/ui/report-request-list.d.ts +64 -0
  808. package/dist/leadership/components/ui/resizable.d.ts +38 -0
  809. package/dist/leadership/components/ui/rich-text-editor.d.ts +58 -0
  810. package/dist/leadership/components/ui/scroll-area.d.ts +40 -0
  811. package/dist/leadership/components/ui/select.d.ts +94 -0
  812. package/dist/leadership/components/ui/separator.d.ts +17 -0
  813. package/dist/leadership/components/ui/sheet.d.ts +108 -0
  814. package/dist/leadership/components/ui/sidebar.d.ts +269 -0
  815. package/dist/leadership/components/ui/skeleton-variants.d.ts +41 -0
  816. package/dist/leadership/components/ui/skeleton.d.ts +14 -0
  817. package/dist/leadership/components/ui/slider.d.ts +9 -0
  818. package/dist/leadership/components/ui/sonner.d.ts +8 -0
  819. package/dist/leadership/components/ui/spinner.d.ts +11 -0
  820. package/dist/leadership/components/ui/split-button.d.ts +76 -0
  821. package/dist/leadership/components/ui/stack.d.ts +17 -0
  822. package/dist/leadership/components/ui/status-badge.d.ts +52 -0
  823. package/dist/leadership/components/ui/step-selector.d.ts +46 -0
  824. package/dist/leadership/components/ui/stimulsoft-viewer.d.ts +28 -0
  825. package/dist/leadership/components/ui/switch.d.ts +25 -0
  826. package/dist/leadership/components/ui/tab-page-layout.d.ts +52 -0
  827. package/dist/leadership/components/ui/table-resize-handle.d.ts +22 -0
  828. package/dist/leadership/components/ui/table.d.ts +112 -0
  829. package/dist/leadership/components/ui/tabs.d.ts +66 -0
  830. package/dist/leadership/components/ui/terms-of-use-dialog.d.ts +102 -0
  831. package/dist/leadership/components/ui/textarea.d.ts +33 -0
  832. package/dist/leadership/components/ui/timepicker.d.ts +34 -0
  833. package/dist/leadership/components/ui/toggle-group.d.ts +37 -0
  834. package/dist/leadership/components/ui/toggle.d.ts +33 -0
  835. package/dist/leadership/components/ui/tooltip.d.ts +61 -0
  836. package/dist/leadership/components/ui/truncated-cell.d.ts +20 -0
  837. package/dist/leadership/components/ui/typography.d.ts +135 -0
  838. package/dist/leadership/components/ui/updates-notification.d.ts +47 -0
  839. package/dist/leadership/components/ui/users-groups-selector.d.ts +87 -0
  840. package/dist/leadership/components/ui/viewer-dialog.d.ts +184 -0
  841. package/dist/leadership/config/backend.d.ts +10 -0
  842. package/dist/leadership/config/environments.d.ts +12 -0
  843. package/dist/leadership/config/index.d.ts +75 -0
  844. package/dist/leadership/contexts/LocaleContext.d.ts +15 -0
  845. package/dist/leadership/contexts/ModalStateContext.d.ts +57 -0
  846. package/dist/leadership/contexts/ModuleContext.d.ts +34 -0
  847. package/dist/leadership/contexts/NavigationContext.d.ts +13 -0
  848. package/dist/leadership/contexts/PageMetadataContext.d.ts +48 -0
  849. package/dist/leadership/crud/components/ActionMenuItems.d.ts +22 -0
  850. package/dist/leadership/crud/components/BaseForm.d.ts +52 -0
  851. package/dist/leadership/crud/components/ColumnSettingsPopover.d.ts +28 -0
  852. package/dist/leadership/crud/components/ContextMenu.d.ts +21 -0
  853. package/dist/leadership/crud/components/CrudActionBar.d.ts +59 -0
  854. package/dist/leadership/crud/components/CrudGrid.d.ts +53 -0
  855. package/dist/leadership/crud/components/CrudPagination.d.ts +17 -0
  856. package/dist/leadership/crud/components/CrudTable.d.ts +66 -0
  857. package/dist/leadership/crud/components/FilterBar.d.ts +136 -0
  858. package/dist/leadership/crud/components/GroupDropZone.d.ts +16 -0
  859. package/dist/leadership/crud/components/InlineRowActions.d.ts +15 -0
  860. package/dist/leadership/crud/components/SelectionCheckbox.d.ts +9 -0
  861. package/dist/leadership/crud/components/TableFooter.d.ts +14 -0
  862. package/dist/leadership/crud/components/TableRowActions.d.ts +19 -0
  863. package/dist/leadership/crud/createCrudPage.d.ts +134 -0
  864. package/dist/leadership/crud/createSimpleService.d.ts +85 -0
  865. package/dist/leadership/crud/generateCrudConfig.d.ts +78 -0
  866. package/dist/leadership/crud/hooks/useBaseForm.d.ts +47 -0
  867. package/dist/leadership/crud/hooks/useColumnDragReorder.d.ts +19 -0
  868. package/dist/leadership/crud/hooks/useColumnManager.d.ts +85 -0
  869. package/dist/leadership/crud/hooks/useCrud.d.ts +152 -0
  870. package/dist/leadership/crud/primitives/ActionMenu.d.ts +69 -0
  871. package/dist/leadership/crud/primitives/FilterBar.d.ts +69 -0
  872. package/dist/leadership/crud/primitives/Pagination.d.ts +29 -0
  873. package/dist/leadership/crud/primitives/Table.d.ts +31 -0
  874. package/dist/leadership/crud/primitives/TreeTable.d.ts +7 -0
  875. package/dist/leadership/crud/primitives/index.d.ts +12 -0
  876. package/dist/leadership/crud/primitives/types.d.ts +199 -0
  877. package/dist/leadership/crud/utils/routingHelpers.d.ts +41 -0
  878. package/dist/leadership/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  879. package/dist/leadership/custom-form-fields/fields/FormDateField.d.ts +9 -0
  880. package/dist/leadership/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  881. package/dist/leadership/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  882. package/dist/leadership/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  883. package/dist/leadership/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  884. package/dist/leadership/custom-form-fields/fields/FormTextField.d.ts +9 -0
  885. package/dist/leadership/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  886. package/dist/leadership/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  887. package/dist/leadership/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  888. package/dist/leadership/custom-form-fields/index.d.ts +13 -0
  889. package/dist/leadership/custom-form-fields/types.d.ts +206 -0
  890. package/dist/leadership/exports/action-plans.d.ts +16 -0
  891. package/dist/leadership/exports/audit-trail.d.ts +1 -0
  892. package/dist/leadership/exports/crud.d.ts +31 -0
  893. package/dist/leadership/exports/custom-form-fields.d.ts +1 -0
  894. package/dist/leadership/exports/file-upload.d.ts +1 -0
  895. package/dist/leadership/exports/integrations.d.ts +15 -0
  896. package/dist/leadership/exports/ui.d.ts +98 -0
  897. package/dist/leadership/file-upload/components/SingleFileUpload.d.ts +102 -0
  898. package/dist/leadership/file-upload/index.d.ts +6 -0
  899. package/dist/leadership/file-upload/types.d.ts +26 -0
  900. package/dist/leadership/file-upload/utils/formatBytes.d.ts +6 -0
  901. package/dist/leadership/file-upload/utils/getFileExtension.d.ts +6 -0
  902. package/dist/leadership/hooks/useActiveModules.d.ts +45 -0
  903. package/dist/leadership/hooks/useAliasFromUrl.d.ts +33 -0
  904. package/dist/leadership/hooks/useColumnResize.d.ts +45 -0
  905. package/dist/leadership/hooks/useDebounce.d.ts +56 -0
  906. package/dist/leadership/hooks/useDerivedContractedModules.d.ts +8 -0
  907. package/dist/leadership/hooks/useI18nFormatters.d.ts +40 -0
  908. package/dist/leadership/hooks/useMediaQuery.d.ts +14 -0
  909. package/dist/leadership/hooks/useModuleAccess.d.ts +59 -0
  910. package/dist/leadership/hooks/usePageTitle.d.ts +10 -0
  911. package/dist/leadership/hooks/usePermissionQuery.d.ts +49 -0
  912. package/dist/leadership/hooks/useRowResize.d.ts +37 -0
  913. package/dist/leadership/hooks/useSidebarResize.d.ts +37 -0
  914. package/dist/leadership/hooks/useUpdatesNotification.d.ts +27 -0
  915. package/dist/leadership/hooks/useWizard.d.ts +40 -0
  916. package/dist/leadership/i18n/config.d.ts +13 -0
  917. package/dist/leadership/i18n/constants.d.ts +126 -0
  918. package/dist/leadership/i18n/index.d.ts +11 -0
  919. package/dist/leadership/i18n/utils.d.ts +14 -0
  920. package/dist/leadership/index.d.ts +103 -12
  921. package/dist/leadership/index.esm.js +1 -0
  922. package/dist/leadership/index.js +1 -0
  923. package/dist/leadership/integrations/clarity/clarityTracking.d.ts +31 -0
  924. package/dist/leadership/integrations/clarity/index.d.ts +3 -0
  925. package/dist/leadership/integrations/clarity/types.d.ts +46 -0
  926. package/dist/leadership/integrations/clarity/useClarity.d.ts +34 -0
  927. package/dist/leadership/integrations/index.d.ts +5 -0
  928. package/dist/leadership/leadership/components/LeadershipDialog.d.ts +10 -0
  929. package/dist/leadership/leadership/components/LeadershipForm.d.ts +8 -0
  930. package/dist/leadership/leadership/components/LeadershipPage.d.ts +19 -0
  931. package/dist/leadership/leadership/hooks/useLeadershipApi.d.ts +4 -0
  932. package/dist/leadership/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  933. package/dist/leadership/leadership/index.d.ts +13 -0
  934. package/dist/leadership/leadership/types.d.ts +23 -0
  935. package/dist/leadership/leadership/utils/leadershipUtils.d.ts +8 -0
  936. package/dist/leadership/media/components/ImageEditor.d.ts +22 -0
  937. package/dist/leadership/media/components/ImageRenderer.d.ts +23 -0
  938. package/dist/leadership/media/components/VideoEditor.d.ts +2 -0
  939. package/dist/leadership/media/components/VideoRenderer.d.ts +2 -0
  940. package/dist/leadership/media/hooks/useMediaUpload.d.ts +19 -0
  941. package/dist/leadership/media/index.d.ts +49 -0
  942. package/dist/leadership/media/types.d.ts +66 -0
  943. package/dist/leadership/media/utils/imageHelpers.d.ts +28 -0
  944. package/dist/leadership/media/utils/videoHelpers.d.ts +35 -0
  945. package/dist/leadership/mind-map/components/MindMap.d.ts +23 -0
  946. package/dist/leadership/mind-map/components/MindMapConnection.d.ts +12 -0
  947. package/dist/leadership/mind-map/components/MindMapNodeView.d.ts +24 -0
  948. package/dist/leadership/mind-map/components/MindMapToolbar.d.ts +26 -0
  949. package/dist/leadership/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  950. package/dist/leadership/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  951. package/dist/leadership/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  952. package/dist/leadership/mind-map/hooks/useMindMapState.d.ts +32 -0
  953. package/dist/leadership/mind-map/index.d.ts +4 -0
  954. package/dist/leadership/mind-map/types.d.ts +91 -0
  955. package/dist/leadership/mind-map/utils/export-image.d.ts +9 -0
  956. package/dist/leadership/mind-map/utils/layout.d.ts +15 -0
  957. package/dist/leadership/mind-map/utils/nodeOps.d.ts +66 -0
  958. package/dist/leadership/mind-map/utils/serialize.d.ts +10 -0
  959. package/dist/leadership/modules/softwaresMap.d.ts +4 -0
  960. package/dist/leadership/places/components/ManageAccessModal.d.ts +11 -0
  961. package/dist/leadership/places/components/PlaceCard.d.ts +12 -0
  962. package/dist/leadership/places/components/PlacesList.d.ts +12 -0
  963. package/dist/leadership/places/index.d.ts +8 -0
  964. package/dist/leadership/places/services/PlaceService.d.ts +9 -0
  965. package/dist/leadership/places/types.d.ts +10 -0
  966. package/dist/leadership/providers/CoreProviders.d.ts +107 -0
  967. package/dist/leadership/providers/index.d.ts +2 -0
  968. package/dist/leadership/qualiex/components/QualiexUserField.d.ts +133 -0
  969. package/dist/leadership/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  970. package/dist/leadership/qualiex/services/qualiexApi.d.ts +75 -0
  971. package/dist/leadership/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  972. package/dist/leadership/qualiex/utils/userPlaceUtils.d.ts +16 -0
  973. package/dist/leadership/services/BaseService.d.ts +51 -0
  974. package/dist/leadership/services/EmailService.d.ts +110 -0
  975. package/dist/leadership/services/ErrorService.d.ts +19 -0
  976. package/dist/leadership/services/QualiexEnrichmentService.d.ts +53 -0
  977. package/dist/leadership/services/QualiexFieldHelpers.d.ts +17 -0
  978. package/dist/leadership/setup/favicon.d.ts +1 -0
  979. package/dist/leadership/setup.d.ts +16 -0
  980. package/dist/leadership/sign/components/D4SignWidget.d.ts +2 -0
  981. package/dist/leadership/sign/components/DocumentSigner.d.ts +2 -0
  982. package/dist/leadership/sign/components/SignConfigForm.d.ts +2 -0
  983. package/dist/leadership/sign/components/SignWidget.d.ts +9 -0
  984. package/dist/leadership/sign/hooks/useSignConfig.d.ts +6 -0
  985. package/dist/leadership/sign/index.d.ts +8 -0
  986. package/dist/leadership/sign/services/signService.d.ts +17 -0
  987. package/dist/leadership/sign/types.d.ts +53 -0
  988. package/dist/leadership/sign/utils/loadClicksignScript.d.ts +13 -0
  989. package/dist/leadership/supabase/SupabaseSingleton.d.ts +34 -0
  990. package/dist/leadership/supabase/client.d.ts +2 -0
  991. package/dist/leadership/supabase/legacyKeyGuard.d.ts +19 -0
  992. package/dist/leadership/supabase/publicClient.d.ts +2 -0
  993. package/dist/leadership/supabase/types.d.ts +377 -0
  994. package/dist/leadership/team-selector/components/TeamSelector.d.ts +24 -0
  995. package/dist/leadership/team-selector/index.d.ts +2 -0
  996. package/dist/leadership/team-selector/types.d.ts +10 -0
  997. package/dist/leadership/types/sidebar.d.ts +52 -0
  998. package/dist/leadership/types.d.ts +593 -13
  999. package/dist/leadership/utils/color.d.ts +26 -0
  1000. package/dist/leadership/utils/formatters/currencyFormatters.d.ts +1 -0
  1001. package/dist/leadership/utils/formatters/dateFormatters.d.ts +52 -0
  1002. package/dist/leadership/utils/index.d.ts +9 -0
  1003. package/dist/leadership/utils/linkHelpers.d.ts +9 -0
  1004. package/dist/leadership/utils/load-fonts.d.ts +1 -0
  1005. package/dist/places/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  1006. package/dist/places/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  1007. package/dist/places/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  1008. package/dist/places/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  1009. package/dist/places/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  1010. package/dist/places/action-plans/components/ActionPlanPage.d.ts +25 -0
  1011. package/dist/places/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1012. package/dist/places/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1013. package/dist/places/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1014. package/dist/places/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1015. package/dist/places/action-plans/constants.d.ts +86 -0
  1016. package/dist/places/action-plans/hooks/useActionPlan.d.ts +19 -0
  1017. package/dist/places/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1018. package/dist/places/action-plans/index.d.ts +15 -0
  1019. package/dist/places/action-plans/types.d.ts +413 -0
  1020. package/dist/places/action-plans/utils/formatTime.d.ts +24 -0
  1021. package/dist/places/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1022. package/dist/places/approval-flow/components/ApproveDialog.d.ts +13 -0
  1023. package/dist/places/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1024. package/dist/places/approval-flow/index.d.ts +4 -0
  1025. package/dist/places/approval-flow/types.d.ts +76 -0
  1026. package/dist/places/assets/index.d.ts +7 -0
  1027. package/dist/places/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1028. package/dist/places/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1029. package/dist/places/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1030. package/dist/places/audit-trail/index.d.ts +9 -0
  1031. package/dist/places/audit-trail/types.d.ts +209 -0
  1032. package/dist/places/audit-trail/utils.d.ts +54 -0
  1033. package/dist/places/auth/components/AliasRedirect.d.ts +13 -0
  1034. package/dist/places/auth/components/AliasRouteGuard.d.ts +20 -0
  1035. package/dist/places/auth/components/EditProfileDialog.d.ts +13 -0
  1036. package/dist/places/auth/components/ProtectedRoute.d.ts +11 -0
  1037. package/dist/places/auth/components/UserInfo.d.ts +10 -0
  1038. package/dist/places/auth/contexts/AuthContext.d.ts +89 -0
  1039. package/dist/places/auth/pages/CallbackPage.d.ts +6 -0
  1040. package/dist/places/auth/pages/LoginPage.d.ts +2 -0
  1041. package/dist/places/auth/services/AuthService.d.ts +45 -0
  1042. package/dist/places/auth/services/SupabaseTokenService.d.ts +3 -0
  1043. package/dist/places/auth/services/TokenManager.d.ts +66 -0
  1044. package/dist/places/auth/services/TokenRegenerationService.d.ts +14 -0
  1045. package/dist/places/auth/services/TokenService.d.ts +48 -0
  1046. package/dist/places/auth/utils/ErrorInterceptor.d.ts +20 -0
  1047. package/dist/places/components/ErrorBoundary.d.ts +19 -0
  1048. package/dist/places/components/dashboards/dashboard-form.d.ts +65 -0
  1049. package/dist/places/components/dashboards/dashboard-general-view.d.ts +124 -0
  1050. package/dist/places/components/dashboards/dashboard-grid.d.ts +66 -0
  1051. package/dist/places/components/dashboards/dashboard-list.d.ts +41 -0
  1052. package/dist/places/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1053. package/dist/places/components/dashboards/dashboard-view.d.ts +48 -0
  1054. package/dist/places/components/dashboards/helpers.d.ts +86 -0
  1055. package/dist/places/components/dashboards/index.d.ts +9 -0
  1056. package/dist/places/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1057. package/dist/places/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1058. package/dist/places/components/dashboards/panels/index.d.ts +14 -0
  1059. package/dist/places/components/dashboards/panels/list-panel.d.ts +45 -0
  1060. package/dist/places/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1061. package/dist/places/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1062. package/dist/places/components/dashboards/panels/panel-error.d.ts +18 -0
  1063. package/dist/places/components/dashboards/panels/panel-header.d.ts +27 -0
  1064. package/dist/places/components/dashboards/panels/panel-loader.d.ts +17 -0
  1065. package/dist/places/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1066. package/dist/places/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1067. package/dist/places/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1068. package/dist/places/components/dashboards/panels/performance-panel.d.ts +39 -0
  1069. package/dist/places/components/dashboards/panels/pie-panel.d.ts +29 -0
  1070. package/dist/places/components/dashboards/panels/text-panel.d.ts +28 -0
  1071. package/dist/places/components/dashboards/types.d.ts +755 -0
  1072. package/dist/places/components/layout/AppHeader.d.ts +6 -0
  1073. package/dist/places/components/layout/AppLayout.d.ts +10 -0
  1074. package/dist/places/components/layout/AppSidebar.d.ts +10 -0
  1075. package/dist/places/components/layout/BodyContent.d.ts +60 -0
  1076. package/dist/places/components/layout/SidebarActionTrigger.d.ts +46 -0
  1077. package/dist/places/components/layout/SidebarHeader.d.ts +5 -0
  1078. package/dist/places/components/layout/SidebarLogo.d.ts +5 -0
  1079. package/dist/places/components/layout/sidebar-utils.d.ts +12 -0
  1080. package/dist/places/components/modules/AccessDeniedDialog.d.ts +43 -0
  1081. package/dist/places/components/modules/ModuleAccessGuard.d.ts +42 -0
  1082. package/dist/places/components/modules/ModuleGrid.d.ts +9 -0
  1083. package/dist/places/components/modules/ModuleOfferContent.d.ts +20 -0
  1084. package/dist/places/components/modules/ModulesContent.d.ts +21 -0
  1085. package/dist/places/components/modules/ModulesDialog.d.ts +3 -0
  1086. package/dist/places/components/modules/ModulesFooterCards.d.ts +10 -0
  1087. package/dist/places/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1088. package/dist/places/components/modules/index.d.ts +14 -0
  1089. package/dist/places/components/modules/modulesData.d.ts +6 -0
  1090. package/dist/places/components/modules/types.d.ts +41 -0
  1091. package/dist/places/components/ui/accordion.d.ts +42 -0
  1092. package/dist/places/components/ui/action-button.d.ts +48 -0
  1093. package/dist/places/components/ui/alert-dialog.d.ts +102 -0
  1094. package/dist/places/components/ui/alert.d.ts +44 -0
  1095. package/dist/places/components/ui/avatar.d.ts +36 -0
  1096. package/dist/places/components/ui/badge.d.ts +41 -0
  1097. package/dist/places/components/ui/breadcrumb.d.ts +73 -0
  1098. package/dist/places/components/ui/button-group.d.ts +24 -0
  1099. package/dist/places/components/ui/button.d.ts +66 -0
  1100. package/dist/places/components/ui/calendar.d.ts +24 -0
  1101. package/dist/places/components/ui/card.d.ts +57 -0
  1102. package/dist/places/components/ui/chart.d.ts +97 -0
  1103. package/dist/places/components/ui/checkbox.d.ts +15 -0
  1104. package/dist/places/components/ui/collapsible.d.ts +20 -0
  1105. package/dist/places/components/ui/color-picker.d.ts +19 -0
  1106. package/dist/places/components/ui/combo-tree.d.ts +103 -0
  1107. package/dist/places/components/ui/combobox.d.ts +64 -0
  1108. package/dist/places/components/ui/command.d.ts +89 -0
  1109. package/dist/places/components/ui/context-menu.d.ts +122 -0
  1110. package/dist/places/components/ui/data-list.d.ts +86 -0
  1111. package/dist/places/components/ui/date-picker.d.ts +19 -0
  1112. package/dist/places/components/ui/dialog-wizard.d.ts +100 -0
  1113. package/dist/places/components/ui/dialog.d.ts +229 -0
  1114. package/dist/places/components/ui/disabled-menu-item.d.ts +25 -0
  1115. package/dist/places/components/ui/drawer.d.ts +94 -0
  1116. package/dist/places/components/ui/dropdown-menu.d.ts +180 -0
  1117. package/dist/places/components/ui/electronic-signature-dialog.d.ts +31 -0
  1118. package/dist/places/components/ui/empty-state.d.ts +79 -0
  1119. package/dist/places/components/ui/export-dialog.d.ts +48 -0
  1120. package/dist/places/components/ui/form.d.ts +119 -0
  1121. package/dist/places/components/ui/grid.d.ts +53 -0
  1122. package/dist/places/components/ui/hover-card.d.ts +21 -0
  1123. package/dist/places/components/ui/icon-picker.d.ts +17 -0
  1124. package/dist/places/components/ui/iframe-dialog.d.ts +24 -0
  1125. package/dist/places/components/ui/input-group.d.ts +113 -0
  1126. package/dist/places/components/ui/input.d.ts +24 -0
  1127. package/dist/places/components/ui/label.d.ts +23 -0
  1128. package/dist/places/components/ui/loading-state.d.ts +52 -0
  1129. package/dist/places/components/ui/menubar.d.ts +113 -0
  1130. package/dist/places/components/ui/multiselect-permissions.d.ts +84 -0
  1131. package/dist/places/components/ui/navigation-menu.d.ts +57 -0
  1132. package/dist/places/components/ui/onboarding-dialog.d.ts +58 -0
  1133. package/dist/places/components/ui/online-editor-dialog.d.ts +28 -0
  1134. package/dist/places/components/ui/page-breadcrumb.d.ts +77 -0
  1135. package/dist/places/components/ui/pagination.d.ts +81 -0
  1136. package/dist/places/components/ui/popover.d.ts +57 -0
  1137. package/dist/places/components/ui/progress.d.ts +22 -0
  1138. package/dist/places/components/ui/radio-group.d.ts +66 -0
  1139. package/dist/places/components/ui/report-request-list.d.ts +64 -0
  1140. package/dist/places/components/ui/resizable.d.ts +38 -0
  1141. package/dist/places/components/ui/rich-text-editor.d.ts +58 -0
  1142. package/dist/places/components/ui/scroll-area.d.ts +40 -0
  1143. package/dist/places/components/ui/select.d.ts +94 -0
  1144. package/dist/places/components/ui/separator.d.ts +17 -0
  1145. package/dist/places/components/ui/sheet.d.ts +108 -0
  1146. package/dist/places/components/ui/sidebar.d.ts +269 -0
  1147. package/dist/places/components/ui/skeleton-variants.d.ts +41 -0
  1148. package/dist/places/components/ui/skeleton.d.ts +14 -0
  1149. package/dist/places/components/ui/slider.d.ts +9 -0
  1150. package/dist/places/components/ui/sonner.d.ts +8 -0
  1151. package/dist/places/components/ui/spinner.d.ts +11 -0
  1152. package/dist/places/components/ui/split-button.d.ts +76 -0
  1153. package/dist/places/components/ui/stack.d.ts +17 -0
  1154. package/dist/places/components/ui/status-badge.d.ts +52 -0
  1155. package/dist/places/components/ui/step-selector.d.ts +46 -0
  1156. package/dist/places/components/ui/stimulsoft-viewer.d.ts +28 -0
  1157. package/dist/places/components/ui/switch.d.ts +25 -0
  1158. package/dist/places/components/ui/tab-page-layout.d.ts +52 -0
  1159. package/dist/places/components/ui/table-resize-handle.d.ts +22 -0
  1160. package/dist/places/components/ui/table.d.ts +112 -0
  1161. package/dist/places/components/ui/tabs.d.ts +66 -0
  1162. package/dist/places/components/ui/terms-of-use-dialog.d.ts +102 -0
  1163. package/dist/places/components/ui/textarea.d.ts +33 -0
  1164. package/dist/places/components/ui/timepicker.d.ts +34 -0
  1165. package/dist/places/components/ui/toggle-group.d.ts +37 -0
  1166. package/dist/places/components/ui/toggle.d.ts +33 -0
  1167. package/dist/places/components/ui/tooltip.d.ts +61 -0
  1168. package/dist/places/components/ui/truncated-cell.d.ts +20 -0
  1169. package/dist/places/components/ui/typography.d.ts +135 -0
  1170. package/dist/places/components/ui/updates-notification.d.ts +47 -0
  1171. package/dist/places/components/ui/users-groups-selector.d.ts +87 -0
  1172. package/dist/places/components/ui/viewer-dialog.d.ts +184 -0
  1173. package/dist/places/config/backend.d.ts +10 -0
  1174. package/dist/places/config/environments.d.ts +12 -0
  1175. package/dist/places/config/index.d.ts +75 -0
  1176. package/dist/places/contexts/LocaleContext.d.ts +15 -0
  1177. package/dist/places/contexts/ModalStateContext.d.ts +57 -0
  1178. package/dist/places/contexts/ModuleContext.d.ts +34 -0
  1179. package/dist/places/contexts/NavigationContext.d.ts +13 -0
  1180. package/dist/places/contexts/PageMetadataContext.d.ts +48 -0
  1181. package/dist/places/crud/components/ActionMenuItems.d.ts +22 -0
  1182. package/dist/places/crud/components/BaseForm.d.ts +52 -0
  1183. package/dist/places/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1184. package/dist/places/crud/components/ContextMenu.d.ts +21 -0
  1185. package/dist/places/crud/components/CrudActionBar.d.ts +59 -0
  1186. package/dist/places/crud/components/CrudGrid.d.ts +53 -0
  1187. package/dist/places/crud/components/CrudPagination.d.ts +17 -0
  1188. package/dist/places/crud/components/CrudTable.d.ts +66 -0
  1189. package/dist/places/crud/components/FilterBar.d.ts +136 -0
  1190. package/dist/places/crud/components/GroupDropZone.d.ts +16 -0
  1191. package/dist/places/crud/components/InlineRowActions.d.ts +15 -0
  1192. package/dist/places/crud/components/SelectionCheckbox.d.ts +9 -0
  1193. package/dist/places/crud/components/TableFooter.d.ts +14 -0
  1194. package/dist/places/crud/components/TableRowActions.d.ts +19 -0
  1195. package/dist/places/crud/createCrudPage.d.ts +134 -0
  1196. package/dist/places/crud/createSimpleService.d.ts +85 -0
  1197. package/dist/places/crud/generateCrudConfig.d.ts +78 -0
  1198. package/dist/places/crud/hooks/useBaseForm.d.ts +47 -0
  1199. package/dist/places/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1200. package/dist/places/crud/hooks/useColumnManager.d.ts +85 -0
  1201. package/dist/places/crud/hooks/useCrud.d.ts +152 -0
  1202. package/dist/places/crud/primitives/ActionMenu.d.ts +69 -0
  1203. package/dist/places/crud/primitives/FilterBar.d.ts +69 -0
  1204. package/dist/places/crud/primitives/Pagination.d.ts +29 -0
  1205. package/dist/places/crud/primitives/Table.d.ts +31 -0
  1206. package/dist/places/crud/primitives/TreeTable.d.ts +7 -0
  1207. package/dist/places/crud/primitives/index.d.ts +12 -0
  1208. package/dist/places/crud/primitives/types.d.ts +199 -0
  1209. package/dist/places/crud/utils/routingHelpers.d.ts +41 -0
  1210. package/dist/places/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1211. package/dist/places/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1212. package/dist/places/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1213. package/dist/places/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1214. package/dist/places/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1215. package/dist/places/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1216. package/dist/places/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1217. package/dist/places/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1218. package/dist/places/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1219. package/dist/places/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1220. package/dist/places/custom-form-fields/index.d.ts +13 -0
  1221. package/dist/places/custom-form-fields/types.d.ts +206 -0
  1222. package/dist/places/exports/action-plans.d.ts +16 -0
  1223. package/dist/places/exports/audit-trail.d.ts +1 -0
  1224. package/dist/places/exports/crud.d.ts +31 -0
  1225. package/dist/places/exports/custom-form-fields.d.ts +1 -0
  1226. package/dist/places/exports/file-upload.d.ts +1 -0
  1227. package/dist/places/exports/integrations.d.ts +15 -0
  1228. package/dist/places/exports/ui.d.ts +98 -0
  1229. package/dist/places/file-upload/components/SingleFileUpload.d.ts +102 -0
  1230. package/dist/places/file-upload/index.d.ts +6 -0
  1231. package/dist/places/file-upload/types.d.ts +26 -0
  1232. package/dist/places/file-upload/utils/formatBytes.d.ts +6 -0
  1233. package/dist/places/file-upload/utils/getFileExtension.d.ts +6 -0
  1234. package/dist/places/hooks/useActiveModules.d.ts +45 -0
  1235. package/dist/places/hooks/useAliasFromUrl.d.ts +33 -0
  1236. package/dist/places/hooks/useColumnResize.d.ts +45 -0
  1237. package/dist/places/hooks/useDebounce.d.ts +56 -0
  1238. package/dist/places/hooks/useDerivedContractedModules.d.ts +8 -0
  1239. package/dist/places/hooks/useI18nFormatters.d.ts +40 -0
  1240. package/dist/places/hooks/useMediaQuery.d.ts +14 -0
  1241. package/dist/places/hooks/useModuleAccess.d.ts +59 -0
  1242. package/dist/places/hooks/usePageTitle.d.ts +10 -0
  1243. package/dist/places/hooks/usePermissionQuery.d.ts +49 -0
  1244. package/dist/places/hooks/useRowResize.d.ts +37 -0
  1245. package/dist/places/hooks/useSidebarResize.d.ts +37 -0
  1246. package/dist/places/hooks/useUpdatesNotification.d.ts +27 -0
  1247. package/dist/places/hooks/useWizard.d.ts +40 -0
  1248. package/dist/places/i18n/config.d.ts +13 -0
  1249. package/dist/places/i18n/constants.d.ts +126 -0
  1250. package/dist/places/i18n/index.d.ts +11 -0
  1251. package/dist/places/i18n/utils.d.ts +14 -0
  1252. package/dist/places/index.d.ts +104 -8
  1253. package/dist/places/index.esm.js +1 -0
  1254. package/dist/places/index.js +1 -0
  1255. package/dist/places/integrations/clarity/clarityTracking.d.ts +31 -0
  1256. package/dist/places/integrations/clarity/index.d.ts +3 -0
  1257. package/dist/places/integrations/clarity/types.d.ts +46 -0
  1258. package/dist/places/integrations/clarity/useClarity.d.ts +34 -0
  1259. package/dist/places/integrations/index.d.ts +5 -0
  1260. package/dist/places/leadership/components/LeadershipDialog.d.ts +10 -0
  1261. package/dist/places/leadership/components/LeadershipForm.d.ts +8 -0
  1262. package/dist/places/leadership/components/LeadershipPage.d.ts +19 -0
  1263. package/dist/places/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1264. package/dist/places/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1265. package/dist/places/leadership/index.d.ts +13 -0
  1266. package/dist/places/leadership/types.d.ts +23 -0
  1267. package/dist/places/leadership/utils/leadershipUtils.d.ts +8 -0
  1268. package/dist/places/media/components/ImageEditor.d.ts +22 -0
  1269. package/dist/places/media/components/ImageRenderer.d.ts +23 -0
  1270. package/dist/places/media/components/VideoEditor.d.ts +2 -0
  1271. package/dist/places/media/components/VideoRenderer.d.ts +2 -0
  1272. package/dist/places/media/hooks/useMediaUpload.d.ts +19 -0
  1273. package/dist/places/media/index.d.ts +49 -0
  1274. package/dist/places/media/types.d.ts +66 -0
  1275. package/dist/places/media/utils/imageHelpers.d.ts +28 -0
  1276. package/dist/places/media/utils/videoHelpers.d.ts +35 -0
  1277. package/dist/places/mind-map/components/MindMap.d.ts +23 -0
  1278. package/dist/places/mind-map/components/MindMapConnection.d.ts +12 -0
  1279. package/dist/places/mind-map/components/MindMapNodeView.d.ts +24 -0
  1280. package/dist/places/mind-map/components/MindMapToolbar.d.ts +26 -0
  1281. package/dist/places/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1282. package/dist/places/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1283. package/dist/places/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1284. package/dist/places/mind-map/hooks/useMindMapState.d.ts +32 -0
  1285. package/dist/places/mind-map/index.d.ts +4 -0
  1286. package/dist/places/mind-map/types.d.ts +91 -0
  1287. package/dist/places/mind-map/utils/export-image.d.ts +9 -0
  1288. package/dist/places/mind-map/utils/layout.d.ts +15 -0
  1289. package/dist/places/mind-map/utils/nodeOps.d.ts +66 -0
  1290. package/dist/places/mind-map/utils/serialize.d.ts +10 -0
  1291. package/dist/places/modules/softwaresMap.d.ts +4 -0
  1292. package/dist/places/places/components/ManageAccessModal.d.ts +11 -0
  1293. package/dist/places/places/components/PlaceCard.d.ts +12 -0
  1294. package/dist/places/places/components/PlacesList.d.ts +12 -0
  1295. package/dist/places/places/index.d.ts +8 -0
  1296. package/dist/places/places/services/PlaceService.d.ts +9 -0
  1297. package/dist/places/places/types.d.ts +10 -0
  1298. package/dist/places/providers/CoreProviders.d.ts +107 -0
  1299. package/dist/places/providers/index.d.ts +2 -0
  1300. package/dist/places/qualiex/components/QualiexUserField.d.ts +133 -0
  1301. package/dist/places/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1302. package/dist/places/qualiex/services/qualiexApi.d.ts +75 -0
  1303. package/dist/places/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1304. package/dist/places/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1305. package/dist/places/services/BaseService.d.ts +51 -0
  1306. package/dist/places/services/EmailService.d.ts +110 -0
  1307. package/dist/places/services/ErrorService.d.ts +19 -0
  1308. package/dist/places/services/QualiexEnrichmentService.d.ts +53 -0
  1309. package/dist/places/services/QualiexFieldHelpers.d.ts +17 -0
  1310. package/dist/places/setup/favicon.d.ts +1 -0
  1311. package/dist/places/setup.d.ts +16 -0
  1312. package/dist/places/sign/components/D4SignWidget.d.ts +2 -0
  1313. package/dist/places/sign/components/DocumentSigner.d.ts +2 -0
  1314. package/dist/places/sign/components/SignConfigForm.d.ts +2 -0
  1315. package/dist/places/sign/components/SignWidget.d.ts +9 -0
  1316. package/dist/places/sign/hooks/useSignConfig.d.ts +6 -0
  1317. package/dist/places/sign/index.d.ts +8 -0
  1318. package/dist/places/sign/services/signService.d.ts +17 -0
  1319. package/dist/places/sign/types.d.ts +53 -0
  1320. package/dist/places/sign/utils/loadClicksignScript.d.ts +13 -0
  1321. package/dist/places/supabase/SupabaseSingleton.d.ts +34 -0
  1322. package/dist/places/supabase/client.d.ts +2 -0
  1323. package/dist/places/supabase/legacyKeyGuard.d.ts +19 -0
  1324. package/dist/places/supabase/publicClient.d.ts +2 -0
  1325. package/dist/places/supabase/types.d.ts +377 -0
  1326. package/dist/places/team-selector/components/TeamSelector.d.ts +24 -0
  1327. package/dist/places/team-selector/index.d.ts +2 -0
  1328. package/dist/places/team-selector/types.d.ts +10 -0
  1329. package/dist/places/types/sidebar.d.ts +52 -0
  1330. package/dist/places/types.d.ts +599 -6
  1331. package/dist/places/utils/color.d.ts +26 -0
  1332. package/dist/places/utils/formatters/currencyFormatters.d.ts +1 -0
  1333. package/dist/places/utils/formatters/dateFormatters.d.ts +52 -0
  1334. package/dist/places/utils/index.d.ts +9 -0
  1335. package/dist/places/utils/linkHelpers.d.ts +9 -0
  1336. package/dist/places/utils/load-fonts.d.ts +1 -0
  1337. package/dist/providers/CoreProviders.d.ts +14 -1
  1338. package/dist/sign/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  1339. package/dist/sign/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  1340. package/dist/sign/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  1341. package/dist/sign/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  1342. package/dist/sign/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  1343. package/dist/sign/action-plans/components/ActionPlanPage.d.ts +25 -0
  1344. package/dist/sign/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1345. package/dist/sign/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1346. package/dist/sign/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1347. package/dist/sign/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1348. package/dist/sign/action-plans/constants.d.ts +86 -0
  1349. package/dist/sign/action-plans/hooks/useActionPlan.d.ts +19 -0
  1350. package/dist/sign/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1351. package/dist/sign/action-plans/index.d.ts +15 -0
  1352. package/dist/sign/action-plans/types.d.ts +413 -0
  1353. package/dist/sign/action-plans/utils/formatTime.d.ts +24 -0
  1354. package/dist/sign/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1355. package/dist/sign/approval-flow/components/ApproveDialog.d.ts +13 -0
  1356. package/dist/sign/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1357. package/dist/sign/approval-flow/index.d.ts +4 -0
  1358. package/dist/sign/approval-flow/types.d.ts +76 -0
  1359. package/dist/sign/assets/index.d.ts +7 -0
  1360. package/dist/sign/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1361. package/dist/sign/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1362. package/dist/sign/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1363. package/dist/sign/audit-trail/index.d.ts +9 -0
  1364. package/dist/sign/audit-trail/types.d.ts +209 -0
  1365. package/dist/sign/audit-trail/utils.d.ts +54 -0
  1366. package/dist/sign/auth/components/AliasRedirect.d.ts +13 -0
  1367. package/dist/sign/auth/components/AliasRouteGuard.d.ts +20 -0
  1368. package/dist/sign/auth/components/EditProfileDialog.d.ts +13 -0
  1369. package/dist/sign/auth/components/ProtectedRoute.d.ts +11 -0
  1370. package/dist/sign/auth/components/UserInfo.d.ts +10 -0
  1371. package/dist/sign/auth/contexts/AuthContext.d.ts +89 -0
  1372. package/dist/sign/auth/pages/CallbackPage.d.ts +6 -0
  1373. package/dist/sign/auth/pages/LoginPage.d.ts +2 -0
  1374. package/dist/sign/auth/services/AuthService.d.ts +45 -0
  1375. package/dist/sign/auth/services/SupabaseTokenService.d.ts +3 -0
  1376. package/dist/sign/auth/services/TokenManager.d.ts +66 -0
  1377. package/dist/sign/auth/services/TokenRegenerationService.d.ts +14 -0
  1378. package/dist/sign/auth/services/TokenService.d.ts +48 -0
  1379. package/dist/sign/auth/utils/ErrorInterceptor.d.ts +20 -0
  1380. package/dist/sign/components/ErrorBoundary.d.ts +19 -0
  1381. package/dist/sign/components/dashboards/dashboard-form.d.ts +65 -0
  1382. package/dist/sign/components/dashboards/dashboard-general-view.d.ts +124 -0
  1383. package/dist/sign/components/dashboards/dashboard-grid.d.ts +66 -0
  1384. package/dist/sign/components/dashboards/dashboard-list.d.ts +41 -0
  1385. package/dist/sign/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1386. package/dist/sign/components/dashboards/dashboard-view.d.ts +48 -0
  1387. package/dist/sign/components/dashboards/helpers.d.ts +86 -0
  1388. package/dist/sign/components/dashboards/index.d.ts +9 -0
  1389. package/dist/sign/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1390. package/dist/sign/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1391. package/dist/sign/components/dashboards/panels/index.d.ts +14 -0
  1392. package/dist/sign/components/dashboards/panels/list-panel.d.ts +45 -0
  1393. package/dist/sign/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1394. package/dist/sign/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1395. package/dist/sign/components/dashboards/panels/panel-error.d.ts +18 -0
  1396. package/dist/sign/components/dashboards/panels/panel-header.d.ts +27 -0
  1397. package/dist/sign/components/dashboards/panels/panel-loader.d.ts +17 -0
  1398. package/dist/sign/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1399. package/dist/sign/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1400. package/dist/sign/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1401. package/dist/sign/components/dashboards/panels/performance-panel.d.ts +39 -0
  1402. package/dist/sign/components/dashboards/panels/pie-panel.d.ts +29 -0
  1403. package/dist/sign/components/dashboards/panels/text-panel.d.ts +28 -0
  1404. package/dist/sign/components/dashboards/types.d.ts +755 -0
  1405. package/dist/sign/components/layout/AppHeader.d.ts +6 -0
  1406. package/dist/sign/components/layout/AppLayout.d.ts +10 -0
  1407. package/dist/sign/components/layout/AppSidebar.d.ts +10 -0
  1408. package/dist/sign/components/layout/BodyContent.d.ts +60 -0
  1409. package/dist/sign/components/layout/SidebarActionTrigger.d.ts +46 -0
  1410. package/dist/sign/components/layout/SidebarHeader.d.ts +5 -0
  1411. package/dist/sign/components/layout/SidebarLogo.d.ts +5 -0
  1412. package/dist/sign/components/layout/sidebar-utils.d.ts +12 -0
  1413. package/dist/sign/components/modules/AccessDeniedDialog.d.ts +43 -0
  1414. package/dist/sign/components/modules/ModuleAccessGuard.d.ts +42 -0
  1415. package/dist/sign/components/modules/ModuleGrid.d.ts +9 -0
  1416. package/dist/sign/components/modules/ModuleOfferContent.d.ts +20 -0
  1417. package/dist/sign/components/modules/ModulesContent.d.ts +21 -0
  1418. package/dist/sign/components/modules/ModulesDialog.d.ts +3 -0
  1419. package/dist/sign/components/modules/ModulesFooterCards.d.ts +10 -0
  1420. package/dist/sign/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1421. package/dist/sign/components/modules/index.d.ts +14 -0
  1422. package/dist/sign/components/modules/modulesData.d.ts +6 -0
  1423. package/dist/sign/components/modules/types.d.ts +41 -0
  1424. package/dist/sign/components/ui/accordion.d.ts +42 -0
  1425. package/dist/sign/components/ui/action-button.d.ts +48 -0
  1426. package/dist/sign/components/ui/alert-dialog.d.ts +102 -0
  1427. package/dist/sign/components/ui/alert.d.ts +44 -0
  1428. package/dist/sign/components/ui/avatar.d.ts +36 -0
  1429. package/dist/sign/components/ui/badge.d.ts +41 -0
  1430. package/dist/sign/components/ui/breadcrumb.d.ts +73 -0
  1431. package/dist/sign/components/ui/button-group.d.ts +24 -0
  1432. package/dist/sign/components/ui/button.d.ts +66 -0
  1433. package/dist/sign/components/ui/calendar.d.ts +24 -0
  1434. package/dist/sign/components/ui/card.d.ts +57 -0
  1435. package/dist/sign/components/ui/chart.d.ts +97 -0
  1436. package/dist/sign/components/ui/checkbox.d.ts +15 -0
  1437. package/dist/sign/components/ui/collapsible.d.ts +20 -0
  1438. package/dist/sign/components/ui/color-picker.d.ts +19 -0
  1439. package/dist/sign/components/ui/combo-tree.d.ts +103 -0
  1440. package/dist/sign/components/ui/combobox.d.ts +64 -0
  1441. package/dist/sign/components/ui/command.d.ts +89 -0
  1442. package/dist/sign/components/ui/context-menu.d.ts +122 -0
  1443. package/dist/sign/components/ui/data-list.d.ts +86 -0
  1444. package/dist/sign/components/ui/date-picker.d.ts +19 -0
  1445. package/dist/sign/components/ui/dialog-wizard.d.ts +100 -0
  1446. package/dist/sign/components/ui/dialog.d.ts +229 -0
  1447. package/dist/sign/components/ui/disabled-menu-item.d.ts +25 -0
  1448. package/dist/sign/components/ui/drawer.d.ts +94 -0
  1449. package/dist/sign/components/ui/dropdown-menu.d.ts +180 -0
  1450. package/dist/sign/components/ui/electronic-signature-dialog.d.ts +31 -0
  1451. package/dist/sign/components/ui/empty-state.d.ts +79 -0
  1452. package/dist/sign/components/ui/export-dialog.d.ts +48 -0
  1453. package/dist/sign/components/ui/form.d.ts +119 -0
  1454. package/dist/sign/components/ui/grid.d.ts +53 -0
  1455. package/dist/sign/components/ui/hover-card.d.ts +21 -0
  1456. package/dist/sign/components/ui/icon-picker.d.ts +17 -0
  1457. package/dist/sign/components/ui/iframe-dialog.d.ts +24 -0
  1458. package/dist/sign/components/ui/input-group.d.ts +113 -0
  1459. package/dist/sign/components/ui/input.d.ts +24 -0
  1460. package/dist/sign/components/ui/label.d.ts +23 -0
  1461. package/dist/sign/components/ui/loading-state.d.ts +52 -0
  1462. package/dist/sign/components/ui/menubar.d.ts +113 -0
  1463. package/dist/sign/components/ui/multiselect-permissions.d.ts +84 -0
  1464. package/dist/sign/components/ui/navigation-menu.d.ts +57 -0
  1465. package/dist/sign/components/ui/onboarding-dialog.d.ts +58 -0
  1466. package/dist/sign/components/ui/online-editor-dialog.d.ts +28 -0
  1467. package/dist/sign/components/ui/page-breadcrumb.d.ts +77 -0
  1468. package/dist/sign/components/ui/pagination.d.ts +81 -0
  1469. package/dist/sign/components/ui/popover.d.ts +57 -0
  1470. package/dist/sign/components/ui/progress.d.ts +22 -0
  1471. package/dist/sign/components/ui/radio-group.d.ts +66 -0
  1472. package/dist/sign/components/ui/report-request-list.d.ts +64 -0
  1473. package/dist/sign/components/ui/resizable.d.ts +38 -0
  1474. package/dist/sign/components/ui/rich-text-editor.d.ts +58 -0
  1475. package/dist/sign/components/ui/scroll-area.d.ts +40 -0
  1476. package/dist/sign/components/ui/select.d.ts +94 -0
  1477. package/dist/sign/components/ui/separator.d.ts +17 -0
  1478. package/dist/sign/components/ui/sheet.d.ts +108 -0
  1479. package/dist/sign/components/ui/sidebar.d.ts +269 -0
  1480. package/dist/sign/components/ui/skeleton-variants.d.ts +41 -0
  1481. package/dist/sign/components/ui/skeleton.d.ts +14 -0
  1482. package/dist/sign/components/ui/slider.d.ts +9 -0
  1483. package/dist/sign/components/ui/sonner.d.ts +8 -0
  1484. package/dist/sign/components/ui/spinner.d.ts +11 -0
  1485. package/dist/sign/components/ui/split-button.d.ts +76 -0
  1486. package/dist/sign/components/ui/stack.d.ts +17 -0
  1487. package/dist/sign/components/ui/status-badge.d.ts +52 -0
  1488. package/dist/sign/components/ui/step-selector.d.ts +46 -0
  1489. package/dist/sign/components/ui/stimulsoft-viewer.d.ts +28 -0
  1490. package/dist/sign/components/ui/switch.d.ts +25 -0
  1491. package/dist/sign/components/ui/tab-page-layout.d.ts +52 -0
  1492. package/dist/sign/components/ui/table-resize-handle.d.ts +22 -0
  1493. package/dist/sign/components/ui/table.d.ts +112 -0
  1494. package/dist/sign/components/ui/tabs.d.ts +66 -0
  1495. package/dist/sign/components/ui/terms-of-use-dialog.d.ts +102 -0
  1496. package/dist/sign/components/ui/textarea.d.ts +33 -0
  1497. package/dist/sign/components/ui/timepicker.d.ts +34 -0
  1498. package/dist/sign/components/ui/toggle-group.d.ts +37 -0
  1499. package/dist/sign/components/ui/toggle.d.ts +33 -0
  1500. package/dist/sign/components/ui/tooltip.d.ts +61 -0
  1501. package/dist/sign/components/ui/truncated-cell.d.ts +20 -0
  1502. package/dist/sign/components/ui/typography.d.ts +135 -0
  1503. package/dist/sign/components/ui/updates-notification.d.ts +47 -0
  1504. package/dist/sign/components/ui/users-groups-selector.d.ts +87 -0
  1505. package/dist/sign/components/ui/viewer-dialog.d.ts +184 -0
  1506. package/dist/sign/config/backend.d.ts +10 -0
  1507. package/dist/sign/config/environments.d.ts +12 -0
  1508. package/dist/sign/config/index.d.ts +75 -0
  1509. package/dist/sign/contexts/LocaleContext.d.ts +15 -0
  1510. package/dist/sign/contexts/ModalStateContext.d.ts +57 -0
  1511. package/dist/sign/contexts/ModuleContext.d.ts +34 -0
  1512. package/dist/sign/contexts/NavigationContext.d.ts +13 -0
  1513. package/dist/sign/contexts/PageMetadataContext.d.ts +48 -0
  1514. package/dist/sign/crud/components/ActionMenuItems.d.ts +22 -0
  1515. package/dist/sign/crud/components/BaseForm.d.ts +52 -0
  1516. package/dist/sign/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1517. package/dist/sign/crud/components/ContextMenu.d.ts +21 -0
  1518. package/dist/sign/crud/components/CrudActionBar.d.ts +59 -0
  1519. package/dist/sign/crud/components/CrudGrid.d.ts +53 -0
  1520. package/dist/sign/crud/components/CrudPagination.d.ts +17 -0
  1521. package/dist/sign/crud/components/CrudTable.d.ts +66 -0
  1522. package/dist/sign/crud/components/FilterBar.d.ts +136 -0
  1523. package/dist/sign/crud/components/GroupDropZone.d.ts +16 -0
  1524. package/dist/sign/crud/components/InlineRowActions.d.ts +15 -0
  1525. package/dist/sign/crud/components/SelectionCheckbox.d.ts +9 -0
  1526. package/dist/sign/crud/components/TableFooter.d.ts +14 -0
  1527. package/dist/sign/crud/components/TableRowActions.d.ts +19 -0
  1528. package/dist/sign/crud/createCrudPage.d.ts +134 -0
  1529. package/dist/sign/crud/createSimpleService.d.ts +85 -0
  1530. package/dist/sign/crud/generateCrudConfig.d.ts +78 -0
  1531. package/dist/sign/crud/hooks/useBaseForm.d.ts +47 -0
  1532. package/dist/sign/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1533. package/dist/sign/crud/hooks/useColumnManager.d.ts +85 -0
  1534. package/dist/sign/crud/hooks/useCrud.d.ts +152 -0
  1535. package/dist/sign/crud/primitives/ActionMenu.d.ts +69 -0
  1536. package/dist/sign/crud/primitives/FilterBar.d.ts +69 -0
  1537. package/dist/sign/crud/primitives/Pagination.d.ts +29 -0
  1538. package/dist/sign/crud/primitives/Table.d.ts +31 -0
  1539. package/dist/sign/crud/primitives/TreeTable.d.ts +7 -0
  1540. package/dist/sign/crud/primitives/index.d.ts +12 -0
  1541. package/dist/sign/crud/primitives/types.d.ts +199 -0
  1542. package/dist/sign/crud/utils/routingHelpers.d.ts +41 -0
  1543. package/dist/sign/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1544. package/dist/sign/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1545. package/dist/sign/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1546. package/dist/sign/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1547. package/dist/sign/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1548. package/dist/sign/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1549. package/dist/sign/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1550. package/dist/sign/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1551. package/dist/sign/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1552. package/dist/sign/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1553. package/dist/sign/custom-form-fields/index.d.ts +13 -0
  1554. package/dist/sign/custom-form-fields/types.d.ts +206 -0
  1555. package/dist/sign/exports/action-plans.d.ts +16 -0
  1556. package/dist/sign/exports/audit-trail.d.ts +1 -0
  1557. package/dist/sign/exports/crud.d.ts +31 -0
  1558. package/dist/sign/exports/custom-form-fields.d.ts +1 -0
  1559. package/dist/sign/exports/file-upload.d.ts +1 -0
  1560. package/dist/sign/exports/integrations.d.ts +15 -0
  1561. package/dist/sign/exports/ui.d.ts +98 -0
  1562. package/dist/sign/file-upload/components/SingleFileUpload.d.ts +102 -0
  1563. package/dist/sign/file-upload/index.d.ts +6 -0
  1564. package/dist/sign/file-upload/types.d.ts +26 -0
  1565. package/dist/sign/file-upload/utils/formatBytes.d.ts +6 -0
  1566. package/dist/sign/file-upload/utils/getFileExtension.d.ts +6 -0
  1567. package/dist/sign/hooks/useActiveModules.d.ts +45 -0
  1568. package/dist/sign/hooks/useAliasFromUrl.d.ts +33 -0
  1569. package/dist/sign/hooks/useColumnResize.d.ts +45 -0
  1570. package/dist/sign/hooks/useDebounce.d.ts +56 -0
  1571. package/dist/sign/hooks/useDerivedContractedModules.d.ts +8 -0
  1572. package/dist/sign/hooks/useI18nFormatters.d.ts +40 -0
  1573. package/dist/sign/hooks/useMediaQuery.d.ts +14 -0
  1574. package/dist/sign/hooks/useModuleAccess.d.ts +59 -0
  1575. package/dist/sign/hooks/usePageTitle.d.ts +10 -0
  1576. package/dist/sign/hooks/usePermissionQuery.d.ts +49 -0
  1577. package/dist/sign/hooks/useRowResize.d.ts +37 -0
  1578. package/dist/sign/hooks/useSidebarResize.d.ts +37 -0
  1579. package/dist/sign/hooks/useUpdatesNotification.d.ts +27 -0
  1580. package/dist/sign/hooks/useWizard.d.ts +40 -0
  1581. package/dist/sign/i18n/config.d.ts +13 -0
  1582. package/dist/sign/i18n/constants.d.ts +126 -0
  1583. package/dist/sign/i18n/index.d.ts +11 -0
  1584. package/dist/sign/i18n/utils.d.ts +14 -0
  1585. package/dist/sign/index.d.ts +104 -8
  1586. package/dist/sign/index.esm.js +1 -0
  1587. package/dist/sign/index.js +1 -0
  1588. package/dist/sign/integrations/clarity/clarityTracking.d.ts +31 -0
  1589. package/dist/sign/integrations/clarity/index.d.ts +3 -0
  1590. package/dist/sign/integrations/clarity/types.d.ts +46 -0
  1591. package/dist/sign/integrations/clarity/useClarity.d.ts +34 -0
  1592. package/dist/sign/integrations/index.d.ts +5 -0
  1593. package/dist/sign/leadership/components/LeadershipDialog.d.ts +10 -0
  1594. package/dist/sign/leadership/components/LeadershipForm.d.ts +8 -0
  1595. package/dist/sign/leadership/components/LeadershipPage.d.ts +19 -0
  1596. package/dist/sign/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1597. package/dist/sign/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1598. package/dist/sign/leadership/index.d.ts +13 -0
  1599. package/dist/sign/leadership/types.d.ts +23 -0
  1600. package/dist/sign/leadership/utils/leadershipUtils.d.ts +8 -0
  1601. package/dist/sign/media/components/ImageEditor.d.ts +22 -0
  1602. package/dist/sign/media/components/ImageRenderer.d.ts +23 -0
  1603. package/dist/sign/media/components/VideoEditor.d.ts +2 -0
  1604. package/dist/sign/media/components/VideoRenderer.d.ts +2 -0
  1605. package/dist/sign/media/hooks/useMediaUpload.d.ts +19 -0
  1606. package/dist/sign/media/index.d.ts +49 -0
  1607. package/dist/sign/media/types.d.ts +66 -0
  1608. package/dist/sign/media/utils/imageHelpers.d.ts +28 -0
  1609. package/dist/sign/media/utils/videoHelpers.d.ts +35 -0
  1610. package/dist/sign/mind-map/components/MindMap.d.ts +23 -0
  1611. package/dist/sign/mind-map/components/MindMapConnection.d.ts +12 -0
  1612. package/dist/sign/mind-map/components/MindMapNodeView.d.ts +24 -0
  1613. package/dist/sign/mind-map/components/MindMapToolbar.d.ts +26 -0
  1614. package/dist/sign/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1615. package/dist/sign/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1616. package/dist/sign/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1617. package/dist/sign/mind-map/hooks/useMindMapState.d.ts +32 -0
  1618. package/dist/sign/mind-map/index.d.ts +4 -0
  1619. package/dist/sign/mind-map/types.d.ts +91 -0
  1620. package/dist/sign/mind-map/utils/export-image.d.ts +9 -0
  1621. package/dist/sign/mind-map/utils/layout.d.ts +15 -0
  1622. package/dist/sign/mind-map/utils/nodeOps.d.ts +66 -0
  1623. package/dist/sign/mind-map/utils/serialize.d.ts +10 -0
  1624. package/dist/sign/modules/softwaresMap.d.ts +4 -0
  1625. package/dist/sign/places/components/ManageAccessModal.d.ts +11 -0
  1626. package/dist/sign/places/components/PlaceCard.d.ts +12 -0
  1627. package/dist/sign/places/components/PlacesList.d.ts +12 -0
  1628. package/dist/sign/places/index.d.ts +8 -0
  1629. package/dist/sign/places/services/PlaceService.d.ts +9 -0
  1630. package/dist/sign/places/types.d.ts +10 -0
  1631. package/dist/sign/providers/CoreProviders.d.ts +107 -0
  1632. package/dist/sign/providers/index.d.ts +2 -0
  1633. package/dist/sign/qualiex/components/QualiexUserField.d.ts +133 -0
  1634. package/dist/sign/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1635. package/dist/sign/qualiex/services/qualiexApi.d.ts +75 -0
  1636. package/dist/sign/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1637. package/dist/sign/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1638. package/dist/sign/services/BaseService.d.ts +51 -0
  1639. package/dist/sign/services/EmailService.d.ts +110 -0
  1640. package/dist/sign/services/ErrorService.d.ts +19 -0
  1641. package/dist/sign/services/QualiexEnrichmentService.d.ts +53 -0
  1642. package/dist/sign/services/QualiexFieldHelpers.d.ts +17 -0
  1643. package/dist/sign/setup/favicon.d.ts +1 -0
  1644. package/dist/sign/setup.d.ts +16 -0
  1645. package/dist/sign/sign/components/D4SignWidget.d.ts +2 -0
  1646. package/dist/sign/sign/components/DocumentSigner.d.ts +2 -0
  1647. package/dist/sign/sign/components/SignConfigForm.d.ts +2 -0
  1648. package/dist/sign/sign/components/SignWidget.d.ts +9 -0
  1649. package/dist/sign/sign/hooks/useSignConfig.d.ts +6 -0
  1650. package/dist/sign/sign/index.d.ts +8 -0
  1651. package/dist/sign/sign/services/signService.d.ts +17 -0
  1652. package/dist/sign/sign/types.d.ts +53 -0
  1653. package/dist/sign/sign/utils/loadClicksignScript.d.ts +13 -0
  1654. package/dist/sign/supabase/SupabaseSingleton.d.ts +34 -0
  1655. package/dist/sign/supabase/client.d.ts +2 -0
  1656. package/dist/sign/supabase/legacyKeyGuard.d.ts +19 -0
  1657. package/dist/sign/supabase/publicClient.d.ts +2 -0
  1658. package/dist/sign/supabase/types.d.ts +377 -0
  1659. package/dist/sign/team-selector/components/TeamSelector.d.ts +24 -0
  1660. package/dist/sign/team-selector/index.d.ts +2 -0
  1661. package/dist/sign/team-selector/types.d.ts +10 -0
  1662. package/dist/sign/types/sidebar.d.ts +52 -0
  1663. package/dist/sign/types.d.ts +596 -46
  1664. package/dist/sign/utils/color.d.ts +26 -0
  1665. package/dist/sign/utils/formatters/currencyFormatters.d.ts +1 -0
  1666. package/dist/sign/utils/formatters/dateFormatters.d.ts +52 -0
  1667. package/dist/sign/utils/index.d.ts +9 -0
  1668. package/dist/sign/utils/linkHelpers.d.ts +9 -0
  1669. package/dist/sign/utils/load-fonts.d.ts +1 -0
  1670. package/dist/supabase/SupabaseSingleton.d.ts +19 -22
  1671. package/docs/PUBLISH.md +18 -6
  1672. package/docs/WORKSPACE_KNOWLEDGE.md +34 -1
  1673. package/docs/design-system/patterns/core-providers.md +29 -1
  1674. package/docs/design-system/selectors.md +9 -2
  1675. package/package.json +26 -1
  1676. package/dist/README.md +0 -1079
  1677. package/dist/bin/bootstrap.js +0 -40
  1678. package/dist/bin/pull-docs.js +0 -186
  1679. package/dist/docs/KNOWLEDGE.md +0 -109
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import e from"i18next";export{default as i18n}from"i18next";import{jsx as a,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import i,{useState as o,useMemo as s,useCallback as l,createContext as d,useContext as c,useRef as u,useEffect as m,memo as p,Component as h,forwardRef as f}from"react";import{Slot as g}from"@radix-ui/react-slot";import{cva as v}from"class-variance-authority";import{clsx as b}from"clsx";import{twMerge as x}from"tailwind-merge";import{getDefaultOptions as y,parseISO as N,isValid as w,format as _}from"date-fns";import{toast as C,Toaster as k}from"sonner";export{toast as sonnerToast,toast}from"sonner";import*as S from"lucide-react";import{EllipsisVertical as A,X as E,ChevronDown as D,ChevronUp as P,Check as I,Loader2 as T,Loader2Icon as M,OctagonXIcon as R,TriangleAlertIcon as L,InfoIcon as z,CircleCheckIcon as F,ChevronRight as U,Circle as j,AlertCircle as O,Search as B,FileX as $,Edit as V,PowerOff as q,Power as W,Trash2 as H,Pencil as G,ToggleRight as K,ToggleLeft as Y,Plus as Q,LayoutGrid as X,List as J,Table2 as Z,Columns3 as ee,GripVertical as ae,Group as te,ArrowUp as re,ArrowDown as ne,ChevronsLeft as ie,ChevronLeft as oe,ChevronsRight as se,CheckCircle as le,AlertTriangle as de,Info as ce,RefreshCw as ue,Copy as me,ExternalLink as pe,NotebookText as he,Building2 as fe,User as ge,LogOut as ve,Sparkles as be,MoreHorizontal as xe,Calendar as ye,PanelLeft as Ne,Edit3 as we,Code as _e,Eye as Ce,Heading1 as ke,Heading2 as Se,Heading3 as Ae,Bold as Ee,Italic as De,Underline as Pe,Strikethrough as Ie,ListOrdered as Te,Highlighter as Me,Link as Re,RemoveFormatting as Le,Undo as ze,Redo as Fe,ImageIcon as Ue,ArrowLeft as je,ArrowRight as Oe,FileText as Be,FileSpreadsheet as $e,Image as Ve,FileImage as qe,Clock as We,Lock as He,ShieldCheck as Ge,Mail as Ke,Coffee as Ye,CheckCheck as Qe,Star as Xe,Download as Je,Users as Ze,TriangleAlert as ea,CheckCircle2 as aa,Hourglass as ta,MoreVertical as ra,Minus as na,CornerDownRight as ia,ChevronsUpDown as oa,ChevronsDownUp as sa,ZoomOut as la,ZoomIn as da,Maximize2 as ca,Undo2 as ua,Redo2 as ma,ArrowUpToLine as pa,Camera as ha,UserPen as fa,Menu as ga,Crown as va,UserPlus as ba,Settings as xa,Upload as ya,Pause as Na,Play as wa,MessageSquare as _a,Smartphone as Ca,Paperclip as ka,CloudUpload as Sa,RotateCcw as Aa,Filter as Ea,Layers as Da,MapPin as Pa,XCircle as Ia,Shield as Ta}from"lucide-react";import*as Ma from"@radix-ui/react-label";import*as Ra from"@radix-ui/react-dialog";import*as La from"@radix-ui/react-separator";import*as za from"@radix-ui/react-alert-dialog";import{useFormContext as Fa,FormProvider as Ua,Controller as ja,appendErrors as Oa,useForm as Ba}from"react-hook-form";import*as $a from"@radix-ui/react-select";import*as Va from"@radix-ui/react-checkbox";import*as qa from"@radix-ui/react-dropdown-menu";import*as Wa from"@radix-ui/react-tooltip";import*as Ha from"@radix-ui/react-popover";import{useTranslation as Ga,initReactI18next as Ka,I18nextProvider as Ya}from"react-i18next";export{I18nextProvider,useTranslation}from"react-i18next";import{createClient as Qa}from"@supabase/supabase-js";import{useQueryClient as Xa,useQuery as Ja,useMutation as Za,QueryClient as et,QueryClientProvider as at}from"@tanstack/react-query";import{useSearchParams as tt,useParams as rt,useNavigate as nt,useLocation as it,Navigate as ot,Link as st}from"react-router-dom";import*as lt from"@radix-ui/react-context-menu";import*as dt from"@radix-ui/react-toggle-group";import*as ct from"@radix-ui/react-toggle";import*as ut from"@radix-ui/react-scroll-area";import*as mt from"@radix-ui/react-switch";import*as pt from"@radix-ui/react-collapsible";import*as ht from"@radix-ui/react-tabs";import*as ft from"@radix-ui/react-accordion";import*as gt from"@radix-ui/react-avatar";import{DayPicker as vt}from"react-day-picker";import{Drawer as bt}from"vaul";import*as xt from"@radix-ui/react-hover-card";import*as yt from"@radix-ui/react-navigation-menu";import*as Nt from"@radix-ui/react-progress";import*as wt from"@radix-ui/react-radio-group";import*as _t from"react-resizable-panels";import*as Ct from"@radix-ui/react-slider";import*as kt from"@radix-ui/react-menubar";import*as St from"recharts";import{ResponsiveContainer as At,XAxis as Et,YAxis as Dt,CartesianGrid as Pt,Tooltip as It,Legend as Tt,BarChart as Mt,Bar as Rt,AreaChart as Lt,Area as zt,LineChart as Ft,Line as Ut,PieChart as jt,Pie as Ot,Cell as Bt,ComposedChart as $t}from"recharts";import{useEditor as Vt,EditorContent as qt}from"@tiptap/react";import Wt from"@tiptap/starter-kit";import Ht from"@tiptap/extension-underline";import Gt from"@tiptap/extension-link";import{TextStyle as Kt}from"@tiptap/extension-text-style";import{Color as Yt}from"@tiptap/extension-color";import Qt from"@tiptap/extension-highlight";import{useSensors as Xt,useSensor as Jt,PointerSensor as Zt,DndContext as er,closestCenter as ar}from"@dnd-kit/core";import{SortableContext as tr,rectSortingStrategy as rr,useSortable as nr}from"@dnd-kit/sortable";import{z as ir}from"zod";import{validateFieldsNatively as or,toNestErrors as sr}from"@hookform/resolvers";const lr="ccjfvpnndclajkleyqkc",dr={storageProjectId:"ccjfvpnndclajkleyqkc",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api.qualiex.com"},cr={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 ur(){let e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=import.meta.env.VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e===lr?dr:cr}function mr(){let e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=import.meta.env.VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e!==lr}const pr={get oauth(){const e=ur();return{authUrl:e.oauth.authUrl,clientId:e.oauth.clientId,responseType:"id_token token",scope:"openid profile email"}}},hr={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},fr={debounceDelay:500},gr=()=>{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||import.meta.env.DEV},vr=()=>gr(),br=gr,xr=()=>ur().qualiexApiUrl,yr={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},Nr={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},wr={isQualiex:"true"===import.meta.env.VITE_IS_QUALIEX},_r={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}`}},Cr=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)}}),kr=`https://${ur().storageProjectId}.supabase.co/storage/v1/object/public/library-assets`,Sr={logo:wr.isQualiex?`${kr}/logo-qualiex-white.svg`:`${kr}/saber-gestao-white.png`,smallLogo:wr.isQualiex?`${kr}/logo-forlogic-white.svg`:`${kr}/small.svg`,favicon:`${kr}/favicon.png`},Ar=Sr.logo,Er=Sr.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=Sr.favicon,document.head.appendChild(e)}const Dr={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 Pr(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const Ir={date:Pr({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Pr({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:Pr({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Tr={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Mr(e){return(a,t)=>{let r;if("formatting"===(t?.context?String(t.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,n=t?.width?String(t.width):a;r=e.formattingValues[n]||e.formattingValues[a]}else{const a=e.defaultWidth,n=t?.width?String(t.width):e.defaultWidth;r=e.values[n]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(a):a]}}function Rr(e){return(a,t={})=>{const r=t.width,n=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=a.match(n);if(!i)return null;const o=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t;return}(s,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}(s,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 Lr(e){return(a,t={})=>{const r=a.match(e.matchPattern);if(!r)return null;const n=r[0],i=a.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;return{value:o,rest:a.slice(n.length)}}}const zr={code:"en-US",formatDistance:(e,a,t)=>{let r;const n=Dr[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r},formatLong:Ir,formatRelative:(e,a,t,r)=>Tr[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:Mr({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Mr({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:Mr({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:Mr({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:Mr({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:Lr({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Rr({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:Rr({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:Rr({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:Rr({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:Rr({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 Fr={};function Ur(){return Fr}const jr=6048e5;function Or(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 Br(e){const a=Or(e);return a.setHours(0,0,0,0),a}function $r(e){const a=Or(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 Vr(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function qr(e){const a=Or(e),t=function(e,a){const t=Br(e),r=Br(a),n=+t-$r(t),i=+r-$r(r);return Math.round((n-i)/864e5)}(a,function(e){const a=Or(e),t=Vr(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function Wr(e,a){const t=Ur(),r=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=Or(e),i=n.getDay(),o=(i<r?7:0)+i-r;return n.setDate(n.getDate()-o),n.setHours(0,0,0,0),n}function Hr(e){return Wr(e,{weekStartsOn:1})}function Gr(e){const a=Or(e),t=a.getFullYear(),r=Vr(e,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const n=Hr(r),i=Vr(e,0);i.setFullYear(t,0,4),i.setHours(0,0,0,0);const o=Hr(i);return a.getTime()>=n.getTime()?t+1:a.getTime()>=o.getTime()?t:t-1}function Kr(e){const a=Or(e),t=+Hr(a)-+function(e){const a=Gr(e),t=Vr(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),Hr(t)}(a);return Math.round(t/jr)+1}function Yr(e,a){const t=Or(e),r=t.getFullYear(),n=Ur(),i=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=Vr(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=Wr(o,a),l=Vr(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const d=Wr(l,a);return t.getTime()>=s.getTime()?r+1:t.getTime()>=d.getTime()?r:r-1}function Qr(e,a){const t=Or(e),r=+Wr(t,a)-+function(e,a){const t=Ur(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=Yr(e,a),i=Vr(e,0);return i.setFullYear(n,0,r),i.setHours(0,0,0,0),Wr(i,a)}(t,a);return Math.round(r/jr)+1}function Xr(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const Jr={y(e,a){const t=e.getFullYear(),r=t>0?t:1-t;return Xr("yy"===a?r%100:r,a.length)},M(e,a){const t=e.getMonth();return"M"===a?String(t+1):Xr(t+1,2)},d:(e,a)=>Xr(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)=>Xr(e.getHours()%12||12,a.length),H:(e,a)=>Xr(e.getHours(),a.length),m:(e,a)=>Xr(e.getMinutes(),a.length),s:(e,a)=>Xr(e.getSeconds(),a.length),S(e,a){const t=a.length,r=e.getMilliseconds();return Xr(Math.trunc(r*Math.pow(10,t-3)),a.length)}},Zr="midnight",en="noon",an="morning",tn="afternoon",rn="evening",nn="night",on={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 Jr.y(e,a)},Y:function(e,a,t,r){const n=Yr(e,r),i=n>0?n:1-n;if("YY"===a){return Xr(i%100,2)}return"Yo"===a?t.ordinalNumber(i,{unit:"year"}):Xr(i,a.length)},R:function(e,a){return Xr(Gr(e),a.length)},u:function(e,a){return Xr(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 Xr(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 Xr(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 Jr.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 Xr(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 n=Qr(e,r);return"wo"===a?t.ordinalNumber(n,{unit:"week"}):Xr(n,a.length)},I:function(e,a,t){const r=Kr(e);return"Io"===a?t.ordinalNumber(r,{unit:"week"}):Xr(r,a.length)},d:function(e,a,t){return"do"===a?t.ordinalNumber(e.getDate(),{unit:"date"}):Jr.d(e,a)},D:function(e,a,t){const r=qr(e);return"Do"===a?t.ordinalNumber(r,{unit:"dayOfYear"}):Xr(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 n=e.getDay(),i=(n-r.weekStartsOn+8)%7||7;switch(a){case"e":return String(i);case"ee":return Xr(i,2);case"eo":return t.ordinalNumber(i,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(e,a,t,r){const n=e.getDay(),i=(n-r.weekStartsOn+8)%7||7;switch(a){case"c":return String(i);case"cc":return Xr(i,a.length);case"co":return t.ordinalNumber(i,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(e,a,t){const r=e.getDay(),n=0===r?7:r;switch(a){case"i":return String(n);case"ii":return Xr(n,a.length);case"io":return t.ordinalNumber(n,{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 n;switch(n=12===r?en:0===r?Zr:r/12>=1?"pm":"am",a){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,a,t){const r=e.getHours();let n;switch(n=r>=17?rn:r>=12?tn:r>=4?an:nn,a){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{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 Jr.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):Jr.H(e,a)},K:function(e,a,t){const r=e.getHours()%12;return"Ko"===a?t.ordinalNumber(r,{unit:"hour"}):Xr(r,a.length)},k:function(e,a,t){let r=e.getHours();return 0===r&&(r=24),"ko"===a?t.ordinalNumber(r,{unit:"hour"}):Xr(r,a.length)},m:function(e,a,t){return"mo"===a?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):Jr.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):Jr.s(e,a)},S:function(e,a){return Jr.S(e,a)},X:function(e,a,t){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(a){case"X":return ln(r);case"XXXX":case"XX":return dn(r);default:return dn(r,":")}},x:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"x":return ln(r);case"xxxx":case"xx":return dn(r);default:return dn(r,":")}},O:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+sn(r,":");default:return"GMT"+dn(r,":")}},z:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+sn(r,":");default:return"GMT"+dn(r,":")}},t:function(e,a,t){return Xr(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,t){return Xr(e.getTime(),a.length)}};function sn(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),n=Math.trunc(r/60),i=r%60;return 0===i?t+String(n):t+String(n)+a+Xr(i,2)}function ln(e,a){if(e%60==0){return(e>0?"-":"+")+Xr(Math.abs(e)/60,2)}return dn(e,a)}function dn(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+Xr(Math.trunc(r/60),2)+a+Xr(r%60,2)}const cn=(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"})}},un=(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"})}},mn={p:un,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],r=t[1],n=t[2];if(!n)return cn(e,a);let i;switch(r){case"P":i=a.dateTime({width:"short"});break;case"PP":i=a.dateTime({width:"medium"});break;case"PPP":i=a.dateTime({width:"long"});break;default:i=a.dateTime({width:"full"})}return i.replace("{{date}}",cn(r,a)).replace("{{time}}",un(n,a))}},pn=/^D+$/,hn=/^Y+$/,fn=["D","DD","YY","YYYY"];function gn(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=Or(e);return!isNaN(Number(t))}const vn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xn=/^'([^]*?)'?$/,yn=/''/g,Nn=/[a-zA-Z]/;function wn(e,a,t){const r=Ur(),n=t?.locale??r.locale??zr,i=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,s=Or(e);if(!gn(s))throw new RangeError("Invalid time value");let l=a.match(bn).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,mn[a])(e,n.formatLong)}return e}).join("").match(vn).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:_n(e)};if(on[a])return{isToken:!0,value:e};if(a.match(Nn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}});n.localize.preprocessor&&(l=n.localize.preprocessor(s,l));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:n};return l.map(r=>{if(!r.isToken)return r.value;const i=r.value;(!t?.useAdditionalWeekYearTokens&&function(e){return hn.test(e)}(i)||!t?.useAdditionalDayOfYearTokens&&function(e){return pn.test(e)}(i))&&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(fn.includes(e))throw new RangeError(r)}(i,a,String(e));return(0,on[i[0]])(s,i,n.localize,d)}).join("")}function _n(e){const a=e.match(xn);return a?a[1].replace(yn,"'"):e}function Cn(e,a,t){const r=y(),n=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 n?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}(n,a):function(e,a){const t=e.format(a).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(t);return r?r[0].substr(1):""}(n,a)}function kn(e,a){const t=function(e){An[e]||(An[e]=Dn?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 An[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=Sn[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 Sn={year:0,month:1,day:2,hour:3,minute:4,second:5};const An={},En=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")),Dn="06/25/2014, 00:00:00"===En||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===En;function Pn(e,a,t,r,n,i,o){const s=new Date(0);return s.setUTCFullYear(e,a,t),s.setUTCHours(r,n,i,o),s}const In=36e5,Tn={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Mn(e,a,t){if(!e)return 0;let r,n,i=Tn.timezoneZ.exec(e);if(i)return 0;if(i=Tn.timezoneHH.exec(e),i)return r=parseInt(i[1],10),Ln(r)?-r*In:NaN;if(i=Tn.timezoneHHMM.exec(e),i){r=parseInt(i[2],10);const e=parseInt(i[3],10);return Ln(r,e)?(n=Math.abs(r)*In+6e4*e,"+"===i[1]?-n:n):NaN}if(function(e){if(zn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),zn[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const r=t?a:function(e){return Pn(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),n=Rn(r,e),i=t?n:function(e,a,t){const r=e.getTime();let n=r-a;const i=Rn(new Date(n),t);if(a===i)return a;n-=i-a;const o=Rn(new Date(n),t);if(i===o)return i;return Math.max(i,o)}(a,n,e);return-i}return NaN}function Rn(e,a){const t=kn(e,a),r=Pn(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let n=e.getTime();const i=n%1e3;return n-=i>=0?i:1e3+i,r-n}function Ln(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const zn={};const Fn={X:function(e,a,t){const r=Un(t.timeZone,e);if(0===r)return"Z";switch(a){case"X":return Bn(r);case"XXXX":case"XX":return On(r);default:return On(r,":")}},x:function(e,a,t){const r=Un(t.timeZone,e);switch(a){case"x":return Bn(r);case"xxxx":case"xx":return On(r);default:return On(r,":")}},O:function(e,a,t){const r=Un(t.timeZone,e);switch(a){case"O":case"OO":case"OOO":return"GMT"+function(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),n=Math.floor(r/60),i=r%60;if(0===i)return t+String(n);return t+String(n)+a+jn(i,2)}(r,":");default:return"GMT"+On(r,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return Cn("short",e,t);default:return Cn("long",e,t)}}};function Un(e,a){const t=e?Mn(e,a,!0)/6e4:a?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function jn(e,a){const t=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<a;)r="0"+r;return t+r}function On(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+jn(Math.floor(r/60),2)+a+jn(Math.floor(r%60),2)}function Bn(e,a){if(e%60==0){return(e>0?"-":"+")+jn(Math.abs(e)/60,2)}return On(e,a)}function $n(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 Vn=36e5,qn=6e4,Wn={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 Hn(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=Wn.dateTimePattern.exec(e);r?(a.date=r[1],t=r[3]):(r=Wn.datePattern.exec(e),r?(a.date=r[1],t=r[2]):(a.date=null,t=e));if(t){const e=Wn.timeZone.exec(t);e?(a.time=t.replace(e[1],""),a.timeZone=e[1].trim()):a.time=t}return a}(e),{year:n,restDateString:i}=function(e,a){if(e){const t=Wn.YYY[a],r=Wn.YYYYY[a];let n=Wn.YYYY.exec(e)||r.exec(e);if(n){const a=n[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(n=Wn.YY.exec(e)||t.exec(e),n){const a=n[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,n;if(!e||!e.length)return t=new Date(0),t.setUTCFullYear(a),t;let i=Wn.MM.exec(e);if(i)return t=new Date(0),r=parseInt(i[1],10)-1,Xn(a,r)?(t.setUTCFullYear(a,r),t):new Date(NaN);if(i=Wn.DDD.exec(e),i){t=new Date(0);const e=parseInt(i[1],10);return function(e,a){if(a<1)return!1;const t=Qn(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(i=Wn.MMDD.exec(e),i){t=new Date(0),r=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return Xn(a,r,e)?(t.setUTCFullYear(a,r,e),t):new Date(NaN)}if(i=Wn.Www.exec(e),i)return n=parseInt(i[1],10)-1,Jn(n)?Gn(a,n):new Date(NaN);if(i=Wn.WwwD.exec(e),i){n=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return Jn(n,e)?Gn(a,n,e):new Date(NaN)}return null}(i,n);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let t,n=0;if(r.time&&(n=function(e){let a,t,r=Wn.HH.exec(e);if(r)return a=parseFloat(r[1].replace(",",".")),Zn(a)?a%24*Vn:NaN;if(r=Wn.HHMM.exec(e),r)return a=parseInt(r[1],10),t=parseFloat(r[2].replace(",",".")),Zn(a,t)?a%24*Vn+t*qn:NaN;if(r=Wn.HHMMSS.exec(e),r){a=parseInt(r[1],10),t=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return Zn(a,t,e)?a%24*Vn+t*qn+1e3*e:NaN}return null}(r.time),null===n||isNaN(n)))return new Date(NaN);if(r.timeZone||a.timeZone){if(t=Mn(r.timeZone||a.timeZone,new Date(e+n)),isNaN(t))return new Date(NaN)}else t=$n(new Date(e+n)),t=$n(new Date(e+n+t));return new Date(e+n+t)}return new Date(NaN)}function Gn(e,a,t){a=a||0,t=t||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const n=7*a+t+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+n),r}const Kn=[31,28,31,30,31,30,31,31,30,31,30,31],Yn=[31,29,31,30,31,30,31,31,30,31,30,31];function Qn(e){return e%400==0||e%4==0&&e%100!=0}function Xn(e,a,t){if(a<0||a>11)return!1;if(null!=t){if(t<1)return!1;const r=Qn(e);if(r&&t>Yn[a])return!1;if(!r&&t>Kn[a])return!1}return!0}function Jn(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function Zn(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const ei=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function ai(e,a,t,r){return function(e,a,t={}){const r=(a=String(a)).match(ei);if(r){const n=Hn(t.originalDate||e,t);a=r.reduce(function(e,a){if("'"===a[0])return e;const r=e.indexOf(a),i="'"===e[r-1],o=e.replace(a,"'"+Fn[a[0]](n,a,t)+"'");return i?o.substring(0,r-1)+o.substring(r+1):o},a)}return wn(e,a,t)}(function(e,a,t){const r=Mn(a,e=Hn(e,t),!0),n=new Date(e.getTime()-r),i=new Date(0);return i.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),i.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),i}(e,a,{timeZone:(r={...r,timeZone:a,originalDate:e}).timeZone}),t,r)}const ti={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"}},ri={date:Pr({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:Pr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Pr({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ni={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"},ii={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"},oi={code:"es",formatDistance:(e,a,t)=>{let r;const n=ti[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"en "+r:"hace "+r:r},formatLong:ri,formatRelative:(e,a,t,r)=>1!==a.getHours()?ii[e]:ni[e],localize:{ordinalNumber:(e,a)=>Number(e)+"º",era:Mr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:Mr({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:Mr({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:Mr({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:Mr({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:Lr({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Rr({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:Rr({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:Rr({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:Rr({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:Rr({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}},si={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"}},li={date:Pr({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:Pr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Pr({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},di={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"},ci={code:"pt-BR",formatDistance:(e,a,t)=>{let r;const n=si[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",String(a)),t?.addSuffix?t.comparison&&t.comparison>0?"em "+r:"há "+r:r},formatLong:li,formatRelative:(e,a,t,r)=>{const n=di[e];return"function"==typeof n?n(a):n},localize:{ordinalNumber:(e,a)=>{const t=Number(e);return"week"===a?.unit?t+"ª":t+"º"},era:Mr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:Mr({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:Mr({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:Mr({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:Mr({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:Lr({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Rr({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:Rr({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:Rr({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:Rr({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:Rr({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}},ui=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],mi=[{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"}],pi=[{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"}],hi="pt-BR",fi="dd/MM/yyyy HH:mm",gi="America/Sao_Paulo",vi=e=>ui.find(a=>a.value===e),bi=e=>mi.find(a=>a.value===e),xi=e=>pi.find(a=>a.value===e),yi=e=>ui.some(a=>a.value===e),Ni=e=>mi.some(a=>a.value===e),wi=e=>pi.some(a=>a.value===e),_i=()=>{if("undefined"==typeof navigator)return hi;const e=navigator.language;if(yi(e))return e;const a=e.split("-")[0],t=ui.find(e=>e.value.startsWith(a));return t?.value||hi},Ci=()=>{if("undefined"==typeof Intl)return gi;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return wi(e)?e:gi}catch{return gi}},ki=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||fi),Si=()=>{const e=_i();return{locale:e,timezone:Ci(),datetimeFormat:ki(e)}},Ai={"pt-BR":ci,"en-US":zr,"es-ES":oi},Ei=(e,a=fi,t=gi,r=hi)=>{if(!e)return"";const n=N(e);if(!w(n))return"Data inválida";const i=Ai[r]||ci;try{return ai(n,t,a,{locale:i})}catch(o){return ai(n,gi,a,{locale:i})}},Di=(e,a=hi,t=gi)=>{if(!e)return"";const r=N(e);if(!w(r))return"Data inválida";const n=Ai[a]||ci;try{return ai(r,t,"PP",{locale:n})}catch(i){return ai(r,gi,"PP",{locale:n})}},Pi=(e,a="BRL",t="pt-BR")=>null==e?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e);function Ii(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 Ti(e,a=.1){const{r:t,g:r,b:n}=Ii(e);return`rgba(${t}, ${r}, ${n}, ${a})`}function Mi(e){const{r:a,g:t,b:r}=Ii(e),[n,i,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*n+.7152*i+.0722*o}function Ri(e,a){const t=Mi(e),r=Mi(a);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)}function Li(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{C.info("Link copiado para a área de transferência")})}function zi(e,a){return a?e.replace(/\{alias\}/g,a):e}function Fi(...e){return x(b(e))}const Ui=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Ui);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,r]of Object.entries(e))a[t]=Ui(r);return a}return e},ji=(e,a)=>{let t;return(...r)=>{clearTimeout(t),t=setTimeout(()=>e(...r),a)}},Oi=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),Bi=v("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"}}),$i=n.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...i},o)=>a(n?g:"button",{className:Fi(Bi({variant:t,size:r,className:e})),ref:o,...i}));$i.displayName="Button";const Vi=i.forwardRef(({className:e,children:t,variant:r="action",...n},i)=>a($i,{ref:i,variant:r,size:"icon",className:Fi("h-8 w-8",e),...n,children:t||a(A,{size:16})}));Vi.displayName="ActionButton";const qi=n.forwardRef(({className:e,type:r,showCharCount:i,maxLength:o,onChange:s,...l},d)=>{const[c,u]=n.useState(0);n.useEffect(()=>{"string"==typeof l.value?u(l.value.length):"string"==typeof l.defaultValue&&u(l.defaultValue.length)},[l.value,l.defaultValue]);return t("div",{className:"w-full",children:[a("input",{type:r,className:Fi("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:d,maxLength:o,onChange:e=>{u(e.target.value.length),s?.(e)},...l}),i&&o&&t("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[c," / ",o]})]})});qi.displayName="Input";const Wi=v("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Hi=n.forwardRef(({className:e,...t},r)=>a(Ma.Root,{ref:r,className:Fi(Wi(),e),...t}));Hi.displayName=Ma.Root.displayName;const Gi=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Gi.displayName="Card";const Ki=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("flex flex-col space-y-1.5 p-6",e),...t}));Ki.displayName="CardHeader";const Yi=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Fi("text-2xl font-semibold leading-none tracking-tight",e),...t}));Yi.displayName="CardTitle";const Qi=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));Qi.displayName="CardDescription";const Xi=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("p-6 pt-0",e),...t}));Xi.displayName="CardContent";const Ji=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("flex items-center p-6 pt-0",e),...t}));Ji.displayName="CardFooter";const Zi=n.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},i)=>a(La.Root,{ref:i,decorative:r,orientation:t,className:Fi("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Zi.displayName=La.Root.displayName;const eo=za.Root,ao=za.Trigger,to=za.Portal,ro=n.forwardRef(({className:e,...t},r)=>a(za.Overlay,{className:Fi("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}));ro.displayName=za.Overlay.displayName;const no=n.forwardRef(({className:e,...r},n)=>t(to,{children:[a(ro,{}),a(za.Content,{ref:n,className:Fi("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),...r})]}));no.displayName=za.Content.displayName;const io=({className:e,...t})=>a("div",{className:Fi("flex flex-col space-y-2 text-center sm:text-left",e),...t});io.displayName="AlertDialogHeader";const oo=({className:e,...t})=>a("div",{className:Fi("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});oo.displayName="AlertDialogFooter";const so=n.forwardRef(({className:e,...t},r)=>a(za.Title,{ref:r,className:Fi("text-lg font-semibold",e),...t}));so.displayName=za.Title.displayName;const lo=n.forwardRef(({className:e,...t},r)=>a(za.Description,{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));lo.displayName=za.Description.displayName;const co=n.forwardRef(({className:e,...t},r)=>a(za.Action,{ref:r,className:Fi(Bi(),e),...t}));co.displayName=za.Action.displayName;const uo=n.forwardRef(({className:e,...t},r)=>a(za.Cancel,{ref:r,className:Fi(Bi({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));uo.displayName=za.Cancel.displayName;const mo=Ra.Root,po=Ra.Trigger,ho=Ra.Portal,fo=Ra.Close,go=n.forwardRef(({className:e,...t},r)=>a(Ra.Overlay,{ref:r,className:Fi("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}));go.displayName=Ra.Overlay.displayName;const vo={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"}},bo=n.forwardRef(({className:r,children:i,size:o,variant:s="informative",isDirty:l,customWidth:d,customMinWidth:c,customMaxWidth:u,customHeight:m,customMinHeight:p,customMaxHeight:h,unsavedChangesTitle:f=e.t("unsaved_changes"),unsavedChangesDescription:g=e.t("unsaved_changes_description"),cancelText:v=e.t("cancel"),leaveWithoutSavingText:b=e.t("leave_without_saving"),style:x,onInteractOutside:y,onEscapeKeyDown:N,...w},_)=>{const[C,k]=n.useState(!1),S=n.useRef(null),A=n.useRef(!1),D=o??(d||c||u||m||p||h?void 0:"md"),P=D?vo[D]:{},I={...d??P.width?{width:d??P.width}:{},...c??P.minWidth?{minWidth:c??P.minWidth}:{},...u??P.maxWidth?{maxWidth:u??P.maxWidth}:{},...m??P.height?{height:m??P.height}:{},...p??P.minHeight?{minHeight:p??P.minHeight}:{},...h??P.maxHeight?{maxHeight:h??P.maxHeight}:{},...x},T=n.useCallback(e=>{"form"===s&&l?(S.current=e,k(!0)):e()},[s,l]),M=n.useRef(null),R="destructive"!==s;if("development"===process.env.NODE_ENV&&i){const e=n.Children.toArray(i);e.some(e=>n.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>n.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t(ho,{children:[a(go,{}),t(Ra.Content,{ref:_,className:Fi("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",r),style:I,onInteractOutside:e=>{"form"!==s&&"destructive"!==s?y?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==s)return"form"===s&&l?(e.preventDefault(),void T(()=>{A.current=!0,M.current?.click()})):void N?.(e);e.preventDefault()},...w,children:[i,R&&t(Ra.Close,{ref:M,onClick:e=>{A.current?A.current=!1:"form"===s&&l&&(e.preventDefault(),T(()=>{A.current=!0,M.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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]}),a(eo,{open:C,onOpenChange:k,children:t(no,{children:[t(io,{children:[a(so,{children:f}),a(lo,{children:g})]}),t(oo,{children:[a(uo,{onClick:()=>{k(!1),S.current=null},children:v}),a(co,{onClick:()=>{k(!1),S.current?.(),S.current=null},children:b})]})]})})]})});bo.displayName=Ra.Content.displayName;const xo=({className:e,showSeparator:r=!1,children:n,...i})=>t("div",{className:Fi("flex flex-col flex-shrink-0",e),...i,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(Zi,{className:"mt-2"})]});xo.displayName="DialogHeader";const yo=({className:e,...t})=>a("div",{className:Fi("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});yo.displayName="DialogBody";const No=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(Zi,{className:"mb-4"}),a("div",{className:Fi("flex flex-row justify-end gap-2",e),...n,children:r})]});No.displayName="DialogFooter";const wo=n.forwardRef(({className:e,...t},r)=>a(Ra.Title,{ref:r,className:Fi("text-xl font-semibold leading-none tracking-tight",e),...t}));wo.displayName=Ra.Title.displayName;const _o=n.forwardRef(({className:e,...t},r)=>a(Ra.Description,{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));_o.displayName=Ra.Description.displayName;const Co=Ua,ko=n.createContext({}),So=({...e})=>a(ko.Provider,{value:{name:e.name},children:a(ja,{...e})}),Ao=()=>{const e=n.useContext(ko),a=n.useContext(Eo),{getFieldState:t,formState:r}=Fa(),i=t(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=a;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},Eo=n.createContext({}),Do=n.forwardRef(({className:e,...t},r)=>{const i=n.useId();return a(Eo.Provider,{value:{id:i},children:a("div",{ref:r,className:Fi("space-y-1.5",e),...t})})});Do.displayName="FormItem";const Po=n.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:i}=Ao();return a(Hi,{ref:r,className:Fi(n&&"text-destructive",e),htmlFor:i,...t})});Po.displayName="FormLabel";const Io=n.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:i,formMessageId:o}=Ao();return a(g,{ref:t,id:n,"aria-describedby":r?`${i} ${o}`:`${i}`,"aria-invalid":!!r,...e})});Io.displayName="FormControl";const To=n.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Ao();return a("p",{ref:r,id:n,className:Fi("text-sm text-muted-foreground",e),...t})});To.displayName="FormDescription";const Mo=n.forwardRef(({className:e,children:t,...r},n)=>{const{error:i,formMessageId:o}=Ao(),s=i?String(i?.message):t;return s?a("p",{ref:n,id:o,className:Fi("text-sm font-medium text-destructive",e),...r,children:s}):null});Mo.displayName="FormMessage";const Ro=n.createContext({showCheck:!1}),Lo=({showCheck:e=!1,...t})=>a(Ro.Provider,{value:{showCheck:e},children:a($a.Root,{...t})}),zo=$a.Group,Fo=$a.Value,Uo=n.forwardRef(({className:e,children:r,...n},i)=>t($a.Trigger,{ref:i,className:Fi("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),...n,children:[r,a($a.Icon,{asChild:!0,children:a(D,{className:"h-4 w-4 opacity-50"})})]}));Uo.displayName=$a.Trigger.displayName;const jo=n.forwardRef(({className:e,...t},r)=>a($a.ScrollUpButton,{ref:r,className:Fi("flex cursor-default items-center justify-center py-1",e),...t,children:a(P,{className:"h-4 w-4"})}));jo.displayName=$a.ScrollUpButton.displayName;const Oo=n.forwardRef(({className:e,...t},r)=>a($a.ScrollDownButton,{ref:r,className:Fi("flex cursor-default items-center justify-center py-1",e),...t,children:a(D,{className:"h-4 w-4"})}));Oo.displayName=$a.ScrollDownButton.displayName;const Bo=n.forwardRef(({className:e,children:r,position:n="popper",container:i,collisionBoundary:o,...s},l)=>a($a.Portal,{container:i,children:t($a.Content,{ref:l,className:Fi("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"===n&&"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:n,collisionBoundary:o,...s,children:[a(jo,{}),a($a.Viewport,{className:Fi("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),a(Oo,{})]})}));Bo.displayName=$a.Content.displayName;const $o=n.forwardRef(({className:e,...t},r)=>a($a.Label,{ref:r,className:Fi("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));$o.displayName=$a.Label.displayName;const Vo=n.forwardRef(({className:e,children:r,...i},o)=>{const{showCheck:s}=n.useContext(Ro);return t($a.Item,{ref:o,className:Fi("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",s?"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",s?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...i,children:[s&&a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a($a.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),a($a.ItemText,{children:r})]})});Vo.displayName=$a.Item.displayName;const qo=n.forwardRef(({className:e,...t},r)=>a($a.Separator,{ref:r,className:Fi("-mx-1 my-1 h-px bg-muted",e),...t}));qo.displayName=$a.Separator.displayName;const Wo=n.forwardRef(({className:e,...t},r)=>a(Va.Root,{ref:r,className:Fi("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(Va.Indicator,{className:Fi("flex items-center justify-center text-current"),children:a(I,{className:"h-4 w-4"})})}));Wo.displayName=Va.Root.displayName;const Ho=n.forwardRef(({className:e,showCharCount:r,maxLength:i,onChange:o,...s},l)=>{const[d,c]=n.useState(0);n.useEffect(()=>{"string"==typeof s.value?c(s.value.length):"string"==typeof s.defaultValue&&c(s.defaultValue.length)},[s.value,s.defaultValue]);return t("div",{className:"w-full",children:[a("textarea",{className:Fi("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:l,maxLength:i,onChange:e=>{c(e.target.value.length),o?.(e)},...s}),r&&i&&t("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[d," / ",i]})]})});Ho.displayName="Textarea";const Go=v("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"}}),Ko=n.forwardRef(({className:e,variant:t,...r},n)=>a("div",{ref:n,className:Fi(Go({variant:t}),e),...r}));Ko.displayName="Badge";const Yo={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Qo({size:e="md",className:t}){return a(T,{className:Fi("animate-spin text-muted-foreground",Yo[e],t)})}function Xo({isLoading:e,children:n,className:i,type:o="spinner",size:s="md"}){return e?"overlay"===o?t("div",{className:Fi("relative",i),children:[n,a("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:a(Qo,{size:s})})]}):a("div","skeleton"===o?{className:Fi("animate-pulse",i),children:a("div",{className:"bg-muted rounded-md h-full w-full"})}:{className:Fi("flex items-center justify-center py-8",i),children:a(Qo,{size:s})}):a(r,{children:n})}const Jo=({...e})=>a(k,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a(F,{className:"h-4 w-4"}),info:a(z,{className:"h-4 w-4"}),warning:a(L,{className:"h-4 w-4"}),error:a(R,{className:"h-4 w-4"}),loading:a(M,{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}),Zo=qa.Root,es=qa.Trigger,as=qa.Group,ts=qa.Portal,rs=qa.Sub,ns=qa.RadioGroup,is=n.forwardRef(({className:e,inset:r,children:n,...i},o)=>t(qa.SubTrigger,{ref:o,className:Fi("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...i,children:[n,a(U,{className:"ml-auto h-4 w-4"})]}));is.displayName=qa.SubTrigger.displayName;const os=n.forwardRef(({className:e,...t},r)=>a(qa.SubContent,{ref:r,className:Fi("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}));os.displayName=qa.SubContent.displayName;const ss=n.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a(qa.Portal,{children:a(qa.Content,{ref:n,sideOffset:t,className:Fi("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})}));ss.displayName=qa.Content.displayName;const ls=n.forwardRef(({className:e,inset:t,...r},n)=>a(qa.Item,{ref:n,className:Fi("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}));ls.displayName=qa.Item.displayName;const ds=n.forwardRef(({className:e,children:r,checked:n,...i},o)=>t(qa.CheckboxItem,{ref:o,className:Fi("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:n,...i,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(qa.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));ds.displayName=qa.CheckboxItem.displayName;const cs=n.forwardRef(({className:e,children:r,...n},i)=>t(qa.RadioItem,{ref:i,className:Fi("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(qa.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));cs.displayName=qa.RadioItem.displayName;const us=n.forwardRef(({className:e,inset:t,...r},n)=>a(qa.Label,{ref:n,className:Fi("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));us.displayName=qa.Label.displayName;const ms=n.forwardRef(({className:e,...t},r)=>a(qa.Separator,{ref:r,className:Fi("-mx-1 my-1 h-px bg-muted",e),...t}));ms.displayName=qa.Separator.displayName;const ps=({className:e,...t})=>a("span",{className:Fi("ml-auto text-xs tracking-widest opacity-60",e),...t});ps.displayName="DropdownMenuShortcut";const hs=({delayDuration:e=300,...t})=>a(Wa.Provider,{delayDuration:e,...t}),fs=Wa.Root,gs=Wa.Trigger,vs=n.forwardRef(({className:e,sideOffset:t=4,container:r,...n},i)=>a(Wa.Portal,{container:r,children:a(Wa.Content,{ref:i,sideOffset:t,className:Fi("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),...n})}));vs.displayName=Wa.Content.displayName;const bs=n.forwardRef(({children:e,disabledReason:r,className:n},i)=>{const o=a(ls,{ref:i,className:Fi("opacity-50 cursor-not-allowed pointer-events-auto",n),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return r?a(hs,{delayDuration:100,children:t(fs,{children:[a(gs,{asChild:!0,children:a("div",{className:"w-full",children:o})}),a(vs,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:r})]})}):o});bs.displayName="DisabledMenuItem";const xs=Ha.Root,ys=Ha.Trigger,Ns=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:n,...i},o)=>a(Ha.Portal,{container:n,children:a(Ha.Content,{ref:o,align:t,sideOffset:r,className:Fi("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),...i})}));Ns.displayName=Ha.Content.displayName;const ws=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ws.displayName="Command";const _s=({children:e,...t})=>a("div",{...t,children:a(ws,{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})}),Cs=n.forwardRef(({className:e,...t},r)=>a("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:a("input",{ref:r,className:Fi("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})}));Cs.displayName="CommandInput";const ks=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));ks.displayName="CommandList";const Ss=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("py-6 text-center text-sm text-muted-foreground",e),...t}));Ss.displayName="CommandEmpty";const As=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("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}));As.displayName="CommandGroup";const Es=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("-mx-1 h-px bg-border",e),...t}));Es.displayName="CommandSeparator";const Ds=n.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...i},o)=>a("div",{ref:o,className:Fi("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?.(n||""),...i}));Ds.displayName="CommandItem";const Ps=({className:e,...t})=>a("span",{className:Fi("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function Is({className:e,...t}){return a("div",{className:Fi("animate-pulse rounded-md bg-muted",e),...t})}Ps.displayName="CommandShortcut";const Ts=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Ms({multiple:r,options:n,value:i,onChange:l,getOptionValue:d,getOptionLabel:c,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:f,disabled:g,required:v,className:b,sortOptions:x,maxDisplayedBadges:y,popoverContainer:N,onOpen:w,onClose:_,clearable:C,showCheck:k}){const[S,A]=o(!1),[P,T]=o(""),M=s(()=>i?Array.isArray(i)?i:[i]:[],[i]),R=s(()=>{if(!N)return;let e=N,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},[N]),L=s(()=>{const e=n.map(e=>({original:e,value:d(e),label:c(e)}));return x?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[n,d,c,x]),z=s(()=>{if(!P)return L;const e=Ts(P);return L.filter(a=>Ts(a.label).includes(e))},[L,P]),F=s(()=>L.filter(e=>M.includes(e.value)),[L,M]),U=e=>{A(e),e?w?.():(T(""),_?.())},j=(e,a)=>{a.preventDefault(),a.stopPropagation(),l&&l(r?M.filter(a=>a!==e):"")},O=y?F.slice(0,y):F,B=y&&F.length>y?F.length-y:0;return t("div",{className:Fi("space-y-2",b),children:[m&&t(Hi,{children:[m,v&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(xs,{open:S,onOpenChange:U,modal:!1,children:[r?a(ys,{asChild:!0,children:t("div",{role:"combobox","aria-expanded":S,"aria-disabled":g,tabIndex:g?-1:0,onKeyDown:e=>{g||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),U(!S))},className:Fi("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",g&&"pointer-events-none opacity-50 cursor-not-allowed",0===F.length&&"text-muted-foreground"),children:[0===F.length?t("span",{className:"flex items-center gap-2",children:[p&&a(p,{className:"h-4 w-4"}),u]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[O.map(e=>t(Ko,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a("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&&j(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>j(e.value,a),children:a(E,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),B>0&&t(Ko,{variant:"outline",className:"gap-1",children:["+",B]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t("div",{className:"relative",children:[a(ys,{asChild:!0,children:t($i,{variant:"outline",role:"combobox","aria-expanded":S,disabled:g,className:Fi("relative w-full justify-start min-h-10 h-auto pr-10",C&&F.length>0&&"pr-16",0===F.length&&"text-muted-foreground"),children:[0===F.length?t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&a(p,{className:"h-4 w-4"}),a("span",{className:"truncate",children:u})]}):t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&a(p,{className:"h-4 w-4"}),a("span",{className:"truncate",children:F[0]?.label})]}),a(D,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),C&&F.length>0&&a("button",{type:"button",disabled:g,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=>j("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:a(E,{className:"h-3.5 w-3.5"})})]}),a(Ns,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:t(ws,{children:[t("div",{className:"relative",children:[a(Cs,{placeholder:f,value:P,onChange:e=>T(e.target.value)}),P&&a("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(E,{className:"h-3.5 w-3.5"})})]}),a(ks,{children:0===n.length?a(Ss,{children:h}):0===z.length?a(Ss,{children:e.t("no_results")}):a(As,{children:z.map(e=>{const n=M.includes(e.value);return t(Ds,{value:e.value,onSelect:()=>(e=>{if(l)if(r){const a=M.includes(e)?M.filter(a=>a!==e):[...M,e];l(a)}else l(e),A(!1)})(e.value),className:Fi("cursor-pointer",n&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[k&&a(I,{className:Fi("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),e.label]},e.value)})})})]})})]})]})}function Rs({multiple:e=!1,options:r,items:n,value:i,onChange:o,onValueChange:s,getOptionValue:l=e=>e.value,getOptionLabel:d=e=>e.label,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:f=!1,required:g=!1,isLoading:v=!1,error:b,className:x,sortOptions:y=!0,maxDisplayedBadges:N,popoverContainer:w,onOpen:_,onClose:C,clearable:k=!0,showCheck:S=!1}){const{t:A}=Ga(),E=r||n||[],D=s||o,P=c||A("select_placeholder","Selecione..."),I=p||A("no_results",A("no_results")),T=h||A("search_placeholder","Pesquisar...");if(v)return t("div",{className:Fi("space-y-2",x),children:[u&&t(Hi,{children:[u,g&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Is,{className:"h-10 w-full"})]});const M="string"==typeof b?b:b instanceof Error?b.message:b?A("error_loading",A("error_loading")):void 0;return M?t("div",{className:Fi("space-y-2",x),children:[u&&t(Hi,{children:[u,g&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a(O,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:M})]})]}):a(Ms,{multiple:e,options:E,value:i||(e?[]:""),onChange:D,getOptionValue:l,getOptionLabel:d,placeholder:P,label:u,icon:m,emptyMessage:I,searchPlaceholder:T,disabled:f,required:g,className:x,sortOptions:y,maxDisplayedBadges:N,popoverContainer:w,onOpen:_,onClose:C,clearable:k,showCheck:S})}const Ls=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function zs(e,a){if(!a)return null;const t=Ls(a),r=[];for(const n of e){const e=Ls(n.label).includes(t),i=n.children?zs(n.children,a):null,o=i&&i.length>0;(e||o)&&r.push({...n,children:e?n.children:o?i:n.children})}return r}function Fs(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=Fs(t.children,a);if(e)return e}}}function Us({node:e,level:r,expanded:n,onToggleExpand:i,selectedValues:o,onSelect:s,showCheck:l}){const d=e.children&&e.children.length>0,c=o.includes(e.value),u=8+20*r;return t("div",{role:"treeitem","aria-expanded":d?n:void 0,"aria-selected":c,className:Fi("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:[t("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:a=>{a.stopPropagation(),s(e.value)},children:[l&&a(I,{className:Fi("h-4 w-4 shrink-0",c?"opacity-100":"opacity-0")}),(()=>{const t=c?e.iconSelected??(n?e.iconOpen:null)??e.icon:n?e.iconOpen??e.icon:e.icon;return t?a(t,{className:Fi("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),a("span",{className:"truncate",children:e.label})]}),d&&a("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(),i(e.value)},tabIndex:-1,"aria-label":n?"Recolher":"Expandir",children:a(n?D:U,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function js({nodes:e,level:n,expandedIds:o,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}){return a(r,{children:e.map(e=>{const r=o.has(e.value);return t(i.Fragment,{children:[a(Us,{node:e,level:n,expanded:r,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}),r&&e.children&&e.children.length>0&&a(js,{nodes:e.children,level:n+1,expandedIds:o,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c})]},e.value)})})}function Os({multiple:e=!1,options:r,value:n,onChange:i,placeholder:d,label:c,icon:u,emptyMessage:m,searchPlaceholder:p,disabled:h=!1,required:f=!1,isLoading:g=!1,error:v,className:b,maxDisplayedBadges:x,popoverContainer:y,onOpen:N,onClose:w,defaultExpanded:_=!0,showCheck:C=!1}){const{t:k}=Ga(),[S,A]=o(!1),[P,I]=o(""),[T,M]=o(()=>_?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),R=d||k("select_placeholder","Selecione..."),L=m||k("no_results",k("no_results")),z=p||k("search_placeholder","Pesquisar..."),F=s(()=>n?Array.isArray(n)?n:[n]:[],[n]),U=s(()=>{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]),j=s(()=>zs(r,P),[r,P])??r,$=s(()=>P?function(e,a){const t=new Set,r=Ls(a);function n(e){if(!e.children||0===e.children.length)return Ls(e.label).includes(r);let a=!1;for(const t of e.children)n(t)&&(a=!0);return a&&t.add(e.value),a||Ls(e.label).includes(r)}for(const i of e)n(i);return t}(r,P):new Set,[r,P]),V=P?$:T,q=l(e=>{P||M(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[P]),W=s(()=>F.map(e=>({value:e,label:Fs(r,e)||e})),[F,r]),H=e=>{A(e),e?N?.():(I(""),w?.())},G=l(a=>{if(i)if(e){const e=F.includes(a)?F.filter(e=>e!==a):[...F,a];i(e)}else i(a),A(!1)},[i,e,F]),K=(a,t)=>{t.preventDefault(),t.stopPropagation(),i&&i(e?F.filter(e=>e!==a):"")},Y=x?W.slice(0,x):W,Q=x&&W.length>x?W.length-x:0;if(g)return t("div",{className:Fi("space-y-2",b),children:[c&&t(Hi,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Is,{className:"h-10 w-full"})]});const X="string"==typeof v?v:v instanceof Error?v.message:v?k("error_loading",k("error_loading")):void 0;return t("div",X?{className:Fi("space-y-2",b),children:[c&&t(Hi,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a(O,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:X})]})]}:{className:Fi("space-y-2",b),children:[c&&t(Hi,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(xs,{open:S,onOpenChange:H,modal:!1,children:[a(ys,{asChild:!0,children:e?t("div",{role:"combobox","aria-expanded":S,"aria-disabled":h,tabIndex:h?-1:0,onKeyDown:e=>{h||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),H(!S))},className:Fi("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",h&&"pointer-events-none opacity-50 cursor-not-allowed",0===W.length&&"text-muted-foreground"),children:[0===W.length?t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),R]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[Y.map(e=>t(Ko,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a("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&&K(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>K(e.value,a),children:a(E,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),Q>0&&t(Ko,{variant:"outline",className:"gap-1",children:["+",Q]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t($i,{variant:"outline",role:"combobox","aria-expanded":S,disabled:h,className:Fi("w-full justify-between min-h-10 h-auto font-normal",0===W.length&&"text-muted-foreground"),children:[0===W.length?t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),R]}):t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),W[0]?.label]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t(Ns,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:U,collisionBoundary:U,children:[t("div",{className:"flex items-center border-b px-3",children:[a(B,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a("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:z,value:P,onChange:e=>I(e.target.value)}),P&&a("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>I(""),children:a(E,{className:"h-3.5 w-3.5"})})]}),a("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:a("div",{role:"tree",className:"p-1",children:0===j.length?a("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?L:k("no_search_results",k("no_results"))}):a(js,{nodes:j,level:0,expandedIds:V,onToggleExpand:q,selectedValues:F,onSelect:G,showCheck:C})})})]})]})]})}class Bs{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 n=e.split(".");if(3!==n.length)return null;const i=n[1];i.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(i),a=atob(e),t=new Uint8Array(a.length);for(let n=0;n<a.length;n++)t[n]=a.charCodeAt(n);const r=new TextDecoder("utf-8").decode(t);return JSON.parse(r)}catch(a){try{const e=this.normalizeBase64Url(i),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(i),a=atob(e);return JSON.parse(a)}catch(r){throw r}}}}catch(n){return null}}static validateTokens(e,a){const t=[],r=[];try{a.split(".")[1],e.split(".")[1];const n=this.parseJwtPayload(a),i=this.parseJwtPayload(e);if(!n){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(!i){const e="Access token decode falhou - será tentado novamente nas chamadas de API";t.push(e),o=!1}const s=Math.floor(Date.now()/1e3);if(i?.exp&&i.exp<s){const e="Access token expirado - pode precisar de refresh";t.push(e),o=!1}if(n.exp&&n.exp<s){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(n){const e=`Erro na validação de tokens: ${n}`;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()}}Bs.LARGE_PAYLOAD_THRESHOLD=1e3;const $s="qualiex_access_token",Vs="qualiex_id_token",qs="supabase_token",Ws="oauth_state",Hs="oauth_nonce",Gs="selected_alias",Ks="manual_logout",Ys="supabase_project_id",Qs={setAccessToken:e=>localStorage.setItem($s,e),getAccessToken:()=>localStorage.getItem($s),setIdToken:e=>localStorage.setItem(Vs,e),getIdToken:()=>localStorage.getItem(Vs),getSupabaseToken:()=>localStorage.getItem(qs),setOAuthState:e=>sessionStorage.setItem(Ws,e),getOAuthState:()=>sessionStorage.getItem(Ws),clearOAuthState:()=>sessionStorage.removeItem(Ws),setOAuthNonce:e=>sessionStorage.setItem(Hs,e),getOAuthNonce:()=>sessionStorage.getItem(Hs),clearOAuthNonce:()=>sessionStorage.removeItem(Hs),setSelectedAlias:e=>localStorage.setItem(Gs,e),getSelectedAlias:()=>localStorage.getItem(Gs),clearSelectedAlias:()=>localStorage.removeItem(Gs),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Qs.getAccessToken()||!Qs.getIdToken()),checkProjectMismatch:()=>{const e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)return!1;const a=localStorage.getItem(Ys);return a&&a!==e?(Qs.clearAll(),localStorage.setItem(Ys,e),!0):(a||localStorage.setItem(Ys,e),!1)},setSupabaseToken:e=>{localStorage.setItem(qs,e),Qs._clearValidationCache()},areAllTokensValid:()=>{const e=Qs.getAccessToken(),a=Qs.getIdToken();if(!e||!a)return!1;try{const t=Bs.validateTokens(e,a);return!!t.idTokenValid&&t.idTokenValid}catch(t){return!1}},clearExpiredTokens:()=>{let e=!1;const a=Qs.getAccessToken(),t=Qs.getIdToken(),r=Qs.getSupabaseToken();return a&&Qs.isTokenExpired(a)&&(localStorage.removeItem($s),e=!0),t&&Qs.isTokenExpired(t)&&(localStorage.removeItem(Vs),e=!0),r&&Qs.isTokenExpired(r)&&(localStorage.removeItem(qs),e=!0),e},clearAll:()=>{localStorage.removeItem($s),localStorage.removeItem(Vs),localStorage.removeItem(qs),localStorage.removeItem(Gs),localStorage.removeItem(Ks),sessionStorage.removeItem(Ws),sessionStorage.removeItem(Hs),Qs._clearValidationCache()},setManualLogout:()=>localStorage.setItem(Ks,"true"),isManualLogout:()=>"true"===localStorage.getItem(Ks),clearManualLogout:()=>localStorage.removeItem(Ks),isTokenExpired:e=>{try{return Bs.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Qs._validationCache.isValid=!1,Qs._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Qs.getSupabaseToken();if(!e)return!1;if(Qs.isTokenExpired(e))return Qs._clearValidationCache(),Qs._handleExpiredToken(),!1;const a=Date.now();return a-Qs._validationCache.timestamp<Qs._validationCache.cacheValidityMs?Qs._validationCache.isValid:(Qs._validationCache.isValid=!0,Qs._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>Qs.isSupabaseTokenValid()?Qs.getSupabaseToken():null,_handleExpiredToken:()=>{Qs.clearAll()},extractTokenData:()=>{if(!Qs.isSupabaseTokenValid())return null;const e=Qs.getSupabaseToken();if(!e)return null;try{const a=Bs.parseJwtPayload(e);if(!a)return null;const t=a.alias||a.default||a.user_alias,r=a.place_id||null,n=a.place_name||null;let i=a.company_id;if(!i&&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){i=e[7];break}}}return{alias:t,companyId:i,placeId:r,placeName:n,payload:a}}catch(a){return Qs._handleExpiredToken(),null}},getCompanyId:e=>{const a=Qs.getAccessToken();if(a)try{const t=Bs.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(n){}const t=Qs.extractTokenData();if(t?.companyId)return t.companyId;const r=Qs.getIdToken();if(r)try{const a=Bs.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(n){}return null},getCompanyIdInt:e=>{const a=[Qs.getAccessToken(),Qs.getIdToken()];for(const t of a)if(t)try{const a=Bs.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=Qs.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=Qs.getIdToken();if(!e)return[];try{const a=Bs.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 Xs=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);C.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){C.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 Js(e){return!!e&&e.startsWith("eyJ")}function Zs(){const e=import.meta.env.VITE_SUPABASE_PK_OVERRIDE;return e||(import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY??"")}let el=!1;const al=import.meta.env.VITE_SUPABASE_URL,tl=Zs();class rl{constructor(){this.currentToken=null,function(){const e=import.meta.env.VITE_SUPABASE_PK_OVERRIDE,a=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;el?Js(a):e&&Js(a)?el=!0:Js(a)?el=!0:el=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:tl};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return Qa(al,tl,{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 rl.instance||(rl.instance=new rl),rl.instance}getClient(){const e=Qs.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Bs.isTokenExpired(e)}catch(a){return Xs.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}}function nl(){return rl.getInstance().getClient()}class il{static async generateToken(e,a,t,r=!1){try{if(!r){const e=Qs.getSupabaseToken();if(e&&Qs.isSupabaseTokenValid())return e}const n=nl(),{data:i,error:o}=await n.functions.invoke("validate-token",{body:{access_token:e,alias:a}});return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(t?.(),null):i?.access_token?(Qs.setSupabaseToken(i.access_token),i.access_token):null}catch(n){return n instanceof Error&&(n.message.includes("401")||n.message.includes("Unauthorized"))&&t?.(),null}}}class ol{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=Qs.getAccessToken(),t=Qs.getSelectedAlias();if(!a||!t)return null;const r=await il.generateToken(a,t,this.onLogoutCallback||void 0,e);return r||null}catch(a){return null}}}ol.regenerationPromise=null,ol.onLogoutCallback=null;class sl{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(Qs.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 ll{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 ol.attemptRegeneration()?(this.isRetrying=!1,!0):(sl.handleError(e),this.isRetrying=!1,!1)}catch(r){return sl.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Qs.getAccessToken();return e?Qs.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."}}}ll.isRetrying=!1;const dl=new class{get baseUrl(){return xr()}async makeApiCall(e,a,t){const r=ll.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const n=Qs.getAccessToken();if(!n)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 i=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{i.searchParams.append(e,a)});const o=await fetch(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"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 Xs.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(Xs.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(n){if(await ll.handleApiError(n))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a," após retry")??[]}catch(i){return Xs.handleError(i instanceof Error?i:"Erro ao buscar usuários após renovação de token",!0),[]}return Xs.handleError(n instanceof Error?n.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 Xs.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=Qs.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||""})):(Xs.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await ll.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 Xs.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return Xs.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})):(Xs.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(t){if(await ll.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 Xs.handleError(r instanceof Error?r:"Erro ao buscar associações após renovação de token",!0),[]}return Xs.handleError(t instanceof Error?t.message:"Erro ao buscar associações do usuário",!0),[]}}};function cl(e,a){const t=a||Nr.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function ul(e,a){const t=a||Nr.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function ml(e,a){const t=a||Nr.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function pl(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||cl(e.idField),emailField:e.emailField||ul(e.idField),usernameField:e.usernameField||ml(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:cl(e),emailField:ul(e),usernameField:ml(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const hl=new Map;class fl{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,r=hl.get(t);if(r&&Date.now()-r.timestamp<3e5)return r.users;let n=await dl.fetchUsers(e,a,"all");return 0===n.length&&(n=await dl.fetchUsers(e,a,"active")),hl.set(t,{users:n,timestamp:Date.now()}),n}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 n of a){const a=e[n.idField];if(!a)continue;const i=t.get(a);if(i){if(n.nameField){r[n.nameField]||(r[n.nameField]=i.userName||null)}if(n.emailField){r[n.emailField]||(r[n.emailField]=i.userEmail||null)}if(n.usernameField){r[n.usernameField]||(r[n.usernameField]=i.userName||null)}}}return r}static async enrichWithUserData(e,a){if(!Array.isArray(e)||0===e.length)return e;try{if(!Qs.areAllTokensValid())return e;const t=Qs.extractTokenData();if(!t)return e;const{alias:r,companyId:n}=t;if(!r||!n)return e;const i=pl(a.userIdFields,a.userFieldsMapping);if(0===this.extractUserIds(e,i).size)return e;const o=await this.fetchQualiexUsers(r,n),s=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,i,s))}catch(t){return Xs.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const gl=["responsible_name"],vl=e=>gl.includes(e);function bl(e,a,t){const r="string"==typeof e?{tableName:e,searchFields:a||[],schemaName:t||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:n,searchFields:i,selectFields:o,schemaName:s,entityName:l,enableQualiexEnrichment:d=!1}=r,c=()=>{if(!Qs.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return nl().schema(s).from(n)},u=(e,a,t,r)=>{let n=c().select(o||"*",{count:"exact"});n=n.eq("is_removed",!1),Object.entries(r).forEach(([e,a])=>{void 0!==a&&""!==a&&(Array.isArray(a)?n=n.in(e,a):"object"==typeof a&&a&&"operator"in a?"not_null"===a.operator?n=n.not(e,"is",null):"is_null"===a.operator&&(n=n.is(e,null)):null!==a&&(n=n.eq(e,a)))}),n=((e,a)=>{if(a&&i.length>0){const t=i.map(e=>`${e}.ilike.%${a}%`).join(",");return e.or(t)}return e})(n,e);const s=a.includes(".");return s||vl(a)||(n=n.order(a,{ascending:"asc"===t})),{query:n,isForeignKey:s}},m=async(e,a,t,n,i)=>{const o=pl(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),s=a.includes(".");if(vl(a)||s||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 fl.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let c;c=s?d.sort((e,r)=>{const n=a.split(".").reduce((e,a)=>e?.[a],e)||"",i=a.split(".").reduce((e,a)=>e?.[a],r)||"",o=String(n).localeCompare(String(i),"pt-BR");return"asc"===t?o:-o}):((e,a,t)=>[...e].sort((e,r)=>{const n=e[a]||"",i=r[a]||"",o=n.localeCompare(i,"pt-BR",{sensitivity:"base"});return"asc"===t?o:-o}))(d,a,t);const u=((e,a=1,t=25)=>{const r=(a-1)*t,n=r+t;return{data:e.slice(r,n),pagination:{currentPage:a,totalPages:Math.ceil(e.length/t),totalItems:e.length,itemsPerPage:t,hasNextPage:n<e.length,hasPreviousPage:a>1}}})(c,n,i);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 fl.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:a,sortField:t,sortDirection:i,page:o,limit:s,additionalFilters:c}=(e=>{const{search:a="",sortField:t="updated_at",sortDirection:r="desc",page:n=1,limit:i=25,...o}=e;return{search:a,sortField:t,sortDirection:r,page:n,limit:i,additionalFilters:o}})(e),{query:p}=u(a,t,i,c),h=((e,a,t)=>{const r=(a-1)*t,n=r+t-1;return e.range(r,n)})(p,o,s),{data:f,error:g,count:v}=await h;if(g)throw new Error(`Error fetching ${n}: ${g.message}`);let b=((e,a,t,r)=>{const n=Math.ceil((a||0)/r);return{data:e,currentPage:t,totalPages:n,totalItems:a||0,itemsPerPage:r,hasNextPage:t<n,hasPreviousPage:t>1}})(f||[],v,o,s);if((e=>{if(!d||!l||0===e.length)return!1;const a=pl(r.userIdFields,r.userFieldsMapping);return e.some(e=>a.some(a=>e[a.idField]))})(b.data)){const e=await m(b.data,t,i,o,s);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 ${n}: ${t.message}`);return a},async create(e){const a=Ui(e),t=Object.entries(a).reduce((e,[a,t])=>(void 0!==t&&(e[a]=t),e),{}),{data:r,error:i}=await c().insert(t).select().single();if(i)throw new Error(`Error creating ${n}: ${i.message}`);if(!r)throw new Error(`No data returned from create ${n} operation`);return r},async update(e,a){const t={...Ui(a),updated_at:(new Date).toISOString()},{data:r,error:i}=await c().update(t).eq("id",e).select().single();if(i)throw new Error(`Error updating ${n}: ${i.message}`);if(!r)throw new Error(`No data returned from update ${n} 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 ${n}: ${t.message}`)}};return p}var xl;const yl={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};class Nl{static async initialize(){try{if(Qs.checkProjectMismatch())return{...yl};if(!Qs.hasAllTokens()||!Qs.areAllTokensValid())return Qs.clearExpiredTokens(),{...yl};const e=Qs.getAccessToken(),a=Qs.getIdToken();Qs.clearManualLogout();const t=this.extractUserFromIdToken(a,e),r=this.extractCompaniesFromIdToken(a),n=this.extractAliasFromAccessToken(e),i=Qs.extractTokenData(),o=i?.alias;let s=null;if(o&&r.some(e=>e.alias===o))s=o;else{const e=Qs.getSelectedAlias(),a=e&&r.some(a=>a.alias===e);s=a?e:n||r[0]?.alias||null}if(!Qs.isSupabaseTokenValid()&&s&&await ol.attemptRegeneration(),!Qs.isSupabaseTokenValid())return{...yl};let l=null;if(s){const e=Qs.getCompanyId(s),a=r.find(e=>e.alias===s);a&&(l={id:e||a.id,name:a.name,alias:a.alias})}const d=i?.placeId??null,c=i?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:t,alias:s,companies:r,selectedUnit:l,userId:t?.id||null,userAlias:t?.id||null,placeId:d,placeName:c,activePlaceId:d,activePlaceName:c}}catch(e){return{...yl}}}static async loginDev(){try{const e=nl(),{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==";Qs.setOAuthState(e);const a=Qs.generateOAuthNonce();Qs.setOAuthNonce(a);const t=`${window.location.origin}/callback`,r=new URL(pr.oauth.authUrl);r.searchParams.set("client_id",pr.oauth.clientId),r.searchParams.set("response_type",pr.oauth.responseType),r.searchParams.set("scope",pr.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"),n=t("id_token"),i=t("error");if(i)throw new Error(`Erro OAuth: ${i}`);if(r&&n){const e=Qs.getAccessToken();e!==r&&Qs.clearAll()}if(Qs.hasAllTokens()){return Qs.getValidSupabaseToken()||await ol.attemptRegeneration(!0),!0}const o=r,s=n;if(!o||!s)throw new Error("Tokens não encontrados na URL de callback");Qs.setAccessToken(o),Qs.setIdToken(s),Qs.clearManualLogout();const l=this.extractAliasFromAccessToken(o);if(l)Qs.setSelectedAlias(l);else{const e=this.extractCompaniesFromIdToken(s);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");Qs.setSelectedAlias(e[0].alias)}if(!await ol.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase");return Qs.clearOAuthState(),Qs.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){Qs.setManualLogout(),Qs.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 Bs.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,n]=a[e].split("|");r&&n&&t.push({id:"",alias:r.trim(),name:n.trim()})}}}),t}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}}xl=Nl,ol.setLogoutCallback(()=>{xl.logout()});const wl=e=>e?.placeId||null,_l=e=>e?.placeName||null,Cl=d(void 0),kl=({children:e})=>{const[t,r]=o({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=Xa()}catch{}const[i,d]=o(!1),c=u(0),p=l(e=>{r(a=>({...a,...e}))},[]),h=l(e=>{r(a=>({...a,isLoading:e}))},[]),f=l(()=>{r({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),g=l(async e=>{if(e.alias===t.alias)return;const a=++c.current;try{const i=Qs.getAccessToken();if(!i)return;const o=await il.generateToken(i,e.alias,void 0,!0);if(c.current!==a)return;if(!o)return;Qs.setSupabaseToken(o),Qs.setSelectedAlias(e.alias);const s=Qs.extractTokenData(),l=s?.alias||e.alias,d=s?.companyId||Qs.getCompanyId(e.alias),u={id:d||e.id,name:e.name,alias:l};let m=null,h=null;if(t.user?.id&&l&&d)try{const e=await dl.fetchActiveUsersMap(l,d);if(c.current!==a)return;const r=e.get(t.user.id);if(r){const e=(e=>({placeId:wl(e),placeName:_l(e)}))(r);m=e.placeId,h=e.placeName}}catch(r){}if(c.current!==a)return;p({alias:l,selectedUnit:u,placeId:m,placeName:h,activePlaceId:m,activePlaceName:h}),n&&await n.clear()}catch(r){}},[p,n,t.user,t.alias]),v=l(async()=>{const e=await Nl.processCallback();if(e){const e=await Nl.initialize();e&&e.isAuthenticated&&(p({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},[p,n]),b=l(async()=>{await Nl.logout(),f(),n&&await n.clear()},[f,n]),x=l(e=>{d(e)},[]),y=l(()=>{},[]),N=l(()=>{n&&n.invalidateQueries()},[n]);m(()=>{if(!t.isAuthenticated)return;let e=!0;const a=setInterval(async()=>{if(e)if(Qs.areAllTokensValid()){if(!Qs.isSupabaseTokenValid())try{await ol.attemptRegeneration()||e&&b()}catch(a){e&&b()}}else e&&b()},6e5);return()=>{e=!1,clearInterval(a)}},[t.isAuthenticated,b]),m(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const a=await Nl.initialize();if(!e)return;a&&a.isAuthenticated?p({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&&h(!1)}catch(a){e&&(sl.handleError(a),h(!1))}})(),()=>{e=!1}},[p,h,b]);const w=s(()=>({...t,logout:b,processCallback:v,switchUnit:g,availableUnits:t.companies,isSearchVisible:i,setSearchVisible:x,clearSearch:y,refreshData:N}),[t.user,t.companies,t.alias,t.isAuthenticated,t.isLoading,t.selectedUnit,t.userId,t.userAlias,t.placeId,t.placeName,t.activePlaceId,t.activePlaceName,b,v,g,i,x,y,N]);return a(Cl.Provider,{value:w,children:e})},Sl=()=>{const e=c(Cl);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function Al({queryKey:e,service:a,entityName:t,searchFields:r,additionalFilters:n={},onSuccess:i}){const[d,c]=tt(),u=Xa(),{alias:m,userId:p,isAuthenticated:h}=Sl(),{t:f}=Ga(),g=l(a=>{const t=`${e}_${a}`,r=d.get(t);return r||(d.get(a)||"")},[d,e]),v=g("search"),b=g("sortField")||hr.sorting.defaultField,x=g("sortDirection")||hr.sorting.defaultDirection,y=parseInt(g("page")||"1"),N=parseInt(g("limit")||String(hr.pagination.defaultPageSize)),w=v,_=s(()=>({search:w,sortField:b,sortDirection:x,page:y,limit:N,...n}),[w,b,x,y,N,n]),k=l(()=>a.getAll(_),[a,_]),S=Ja({queryKey:[e,m,p,_],queryFn:k,enabled:!!m&&h});if(!S)throw new Error(`useCrud: Query initialization failed for "${t}". Ensure QueryClientProvider is configured in your app root.`);const A=Za({mutationFn:a.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(_r.success.created(t)),i?.()},onError:e=>{C.error(`${_r.error.create(t)}: ${e.message}`)}}),E=Za({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(_r.success.updated(t)),i?.()},onError:e=>{C.error(`${_r.error.update(t)}: ${e.message}`)}}),D=Za({mutationFn:a.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(_r.success.deleted(t))},onError:e=>{C.error(`${_r.error.delete(t)}: ${e.message}`)}}),P=l(a=>{const t={...Object.fromEntries(d)};Object.entries(a).forEach(([a,r])=>{const n=`${e}_${a}`;""===r||0===r?delete t[n]:t[n]=String(r)}),delete t.sortField,delete t.sortDirection,c(t)},[d,c,e]),I=l(e=>{P({search:e,page:1})},[P]),T=l(e=>{P({sortField:e,sortDirection:b===e&&"asc"===x?"desc":"asc",page:1})},[b,x,P]),M=l(e=>{P({page:e})},[P]),R=l(e=>{P({limit:e,page:1})},[P]),L=l(()=>{const a=Object.fromEntries(d),t=`${e}_`,r=Object.fromEntries(Object.entries(a).filter(([e])=>!e.startsWith(t)));c(r)},[c,d,e]),[z,F]=o([]),U=l(e=>{F(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),j=l(()=>{const e=S?.data?.data.map(e=>e.id)||[];F(a=>a.length===e.length?[]:e)},[S?.data?.data]),O=l(()=>{F([])},[]),B=s(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&z.length===e.length},[z,S?.data?.data]),$=Za({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,r)=>{u.invalidateQueries({queryKey:[e]}),C.success(f("bulk_delete_success",`${r.length} ${t}(s) deletado(s) com sucesso`)),O()},onError:e=>{C.error(f("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),V=l((e,a)=>{const t=a?a(e):e;e.id?E.mutate({id:e.id,data:t}):A.mutate({...t,alias:m})},[m,A,E]);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||hr.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:E?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:v,sortField:b,sortDirection:x,currentPage:y,itemsPerPage:N,queryKey:e,createEntity:A.mutate,updateEntity:(e,a)=>E.mutate({id:e,data:a}),deleteEntity:D.mutate,save:V,handleSearch:I,handleSort:T,handlePageChange:M,handleItemsPerPageChange:R,clearFilters:L,refetch:S.refetch,selectedIds:z,selectItem:U,selectAll:j,clearSelection:O,isAllSelected:B,bulkDelete:e=>$.mutateAsync(e),isBulkDeleting:$.isPending}}function El(e){const a=bl({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)=>Al({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:r})}}function Dl(e){const[a,t]=o(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return m(()=>{const a=window.matchMedia(e);t(a.matches);const r=e=>{t(e.matches)};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),a}function Pl(e=768){return Dl(`(max-width: ${e-1}px)`)}const Il=n.forwardRef(({className:e,...t},r)=>a("table",{ref:r,className:Fi("w-full caption-bottom text-[13px] table-fixed",e),...t}));Il.displayName="Table";const Tl=n.forwardRef(({className:e,...t},r)=>a("thead",{ref:r,className:Fi("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));Tl.displayName="TableHeader";const Ml=n.forwardRef(({className:e,...t},r)=>a("tbody",{ref:r,className:Fi("[&_tr:last-child]:border-0",e),...t}));Ml.displayName="TableBody";const Rl=n.forwardRef(({className:e,...t},r)=>a("tfoot",{ref:r,className:Fi("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Rl.displayName="TableFooter";const Ll=n.forwardRef(({className:e,...t},r)=>a("tr",{ref:r,className:Fi("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));Ll.displayName="TableRow";const zl=n.forwardRef(({className:e,...t},r)=>a("th",{ref:r,className:Fi("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}));zl.displayName="TableHead";const Fl=n.forwardRef(({className:e,...t},r)=>a("td",{ref:r,className:Fi("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));Fl.displayName="TableCell";const Ul=n.forwardRef(({className:e,...t},r)=>a("caption",{ref:r,className:Fi("mt-4 text-sm text-muted-foreground",e),...t}));function jl({rows:e=5,columns:r=4}){return a("div",{className:"w-full",children:t("div",{className:"rounded-md border",children:[a("div",{className:"border-b bg-muted/50 px-4 py-3",children:a("div",{className:"flex space-x-4",children:Array.from({length:r}).map((e,t)=>a(Is,{className:"h-4 w-24"},t))})}),a("div",{children:Array.from({length:e}).map((e,t)=>a("div",{className:"border-b px-4 py-3 last:border-0",children:a("div",{className:"flex space-x-4",children:Array.from({length:r}).map((e,t)=>a(Is,{className:"h-4 w-20"},t))})},t))})]})})}function Ol({count:e=3}){return a("div",{className:"space-y-4",children:Array.from({length:e}).map((e,r)=>t(Gi,{children:[t(Ki,{children:[a(Is,{className:"h-4 w-3/4"}),a(Is,{className:"h-3 w-1/2"})]}),a(Xi,{children:t("div",{className:"space-y-2",children:[a(Is,{className:"h-3 w-full"}),a(Is,{className:"h-3 w-2/3"})]})})]},r))})}function Bl({fields:e=4}){return t("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,r)=>t("div",{className:"space-y-2",children:[a(Is,{className:"h-4 w-24"}),a(Is,{className:"h-10 w-full"})]},r)),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a(Is,{className:"h-10 w-20"}),a(Is,{className:"h-10 w-20"})]})]})}function $l(){return t("div",{className:"flex items-center justify-between p-4 border-b",children:[t("div",{className:"flex items-center space-x-3",children:[a(Is,{className:"h-8 w-8 rounded-full"}),a(Is,{className:"h-6 w-32"})]}),t("div",{className:"flex items-center space-x-2",children:[a(Is,{className:"h-8 w-8"}),a(Is,{className:"h-8 w-24"})]})]})}function Vl(){return a("div",{className:"w-64 border-r bg-muted/10",children:t("div",{className:"p-4",children:[a(Is,{className:"h-8 w-32 mb-6"}),a("div",{className:"space-y-2",children:Array.from({length:6}).map((e,r)=>t("div",{className:"flex items-center space-x-3 p-2",children:[a(Is,{className:"h-4 w-4"}),a(Is,{className:"h-4 w-20"})]},r))})]})})}Ul.displayName="TableCaption";const ql={default:$,search:B,error:O};function Wl({icon:e,title:r,description:n,action:i,className:o,variant:s="default"}){const{t:l}=Ga(),d=!!e,c=ql[s];return t("div",{className:Fi("flex flex-col items-center justify-center py-12 px-4 text-center",o),children:[a("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:d?e:a(c,{className:"h-8 w-8 text-muted-foreground"})}),a("h3",{className:"text-lg font-semibold mb-2",children:r}),n&&a("p",{className:"text-muted-foreground mb-6 max-w-sm",children:n}),i&&a($i,{onClick:i.onClick,variant:"outline",children:i.label})]})}function Hl({children:e,className:r}){const i=n.useRef(null),[o,s]=n.useState(!1);n.useEffect(()=>{const e=()=>{const e=i.current;e&&s(e.scrollWidth>e.clientWidth)};e();const a=new ResizeObserver(e);return i.current&&a.observe(i.current),()=>a.disconnect()},[e]);const l=a("div",{ref:i,className:`truncate w-full max-w-full ${r||""}`,children:e});return o?a(hs,{delayDuration:300,children:t(fs,{children:[a(gs,{asChild:!0,children:l}),a(vs,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):l}const Gl=n.forwardRef(({direction:e,onMouseDown:t,isDragging:r,className:n},i)=>{const o="horizontal"===e;return a("div",{ref:i,onMouseDown:t,className:Fi("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",n),children:a("div",{className:Fi("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});Gl.displayName="TableResizeHandle";const Kl=lt.Root,Yl=lt.Trigger,Ql=lt.Group,Xl=lt.Portal,Jl=lt.Sub,Zl=lt.RadioGroup,ed=n.forwardRef(({className:e,inset:r,children:n,...i},o)=>t(lt.SubTrigger,{ref:o,className:Fi("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",r&&"pl-8",e),...i,children:[n,a(U,{className:"ml-auto h-4 w-4"})]}));ed.displayName=lt.SubTrigger.displayName;const ad=n.forwardRef(({className:e,...t},r)=>a(lt.SubContent,{ref:r,className:Fi("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}));ad.displayName=lt.SubContent.displayName;const td=n.forwardRef(({className:e,...t},r)=>a(lt.Portal,{children:a(lt.Content,{ref:r,className:Fi("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})}));td.displayName=lt.Content.displayName;const rd=n.forwardRef(({className:e,inset:t,...r},n)=>a(lt.Item,{ref:n,className:Fi("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}));rd.displayName=lt.Item.displayName;const nd=n.forwardRef(({className:e,children:r,checked:n,...i},o)=>t(lt.CheckboxItem,{ref:o,className:Fi("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:n,...i,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(lt.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));nd.displayName=lt.CheckboxItem.displayName;const id=n.forwardRef(({className:e,children:r,...n},i)=>t(lt.RadioItem,{ref:i,className:Fi("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(lt.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));id.displayName=lt.RadioItem.displayName;const od=n.forwardRef(({className:e,inset:t,...r},n)=>a(lt.Label,{ref:n,className:Fi("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));od.displayName=lt.Label.displayName;const sd=n.forwardRef(({className:e,...t},r)=>a(lt.Separator,{ref:r,className:Fi("-mx-1 my-1 h-px bg-border",e),...t}));sd.displayName=lt.Separator.displayName;const ld=({className:e,...t})=>a("span",{className:Fi("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});ld.displayName="ContextMenuShortcut";const dd=({onEdit:e,onDelete:n,onToggleStatus:i,isActive:o=!0,canDelete:s=!0,customActions:l=[],renderAs:d})=>{const{t:c}=Ga(),u=[];if(e){const a={icon:V,label:c("edit"),onClick:e};u.push(a)}if(l.forEach(e=>{u.push(e)}),i){const e={icon:o?q:W,label:o?"Inativar":"Ativar",onClick:i};u.push(e)}if(s&&n){const e={icon:H,label:c("ap_delete"),onClick:n,destructive:!0};u.push(e)}const m="dropdown"===d?ls:rd;return a(r,{children:u.map((e,r)=>t(m,{onClick:e.onClick,className:Fi("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[a(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},r))})},cd=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:i,isActive:o=!0,customActions:s=[]})=>t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a(A,{size:12})})}),a(ss,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a(dd,{onEdit:e?a=>{a?.stopPropagation(),e?.()}:void 0,onDelete:r?e=>{e?.stopPropagation(),r?.()}:void 0,onToggleStatus:i?e=>{e?.stopPropagation(),i?.()}:void 0,isActive:o,canDelete:n&&!!r,customActions:s,renderAs:"dropdown"})})]}),ud=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:i,isActive:o=!0,customActions:s=[]})=>{const{t:l}=Ga();return a(hs,{delayDuration:200,children:t("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a(G,{size:14})})}),a(vs,{children:l("edit")})]}),s.map((e,r)=>{const n=e.icon;return t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a(n,{size:14})})}),a(vs,{children:e.label})]},r)}),i&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),i()},children:a(o?K:Y,{size:14})})}),a(vs,{children:o?"Inativar":"Ativar"})]}),r&&n&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:Fi("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),r()},children:a(H,{size:14})})}),a(vs,{children:l("ap_delete")})]})]})})},md=150;function pd({columns:e,storageKey:a,onResize:t,enabled:r=!0}){const[n,i]=o(()=>{if(!r||"undefined"==typeof window)return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??md,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??md,e),{})}),[s,d]=o(!1),[c,p]=o(null),h=u(0),f=u(0),g=l((e,a)=>{r&&(a.preventDefault(),a.stopPropagation(),d(!0),p(e),h.current=a.clientX,f.current=n[e]??md)},[r,n]);m(()=>{if(!s||!c)return;const r=e.find(e=>e.key===c),n=r?.minWidth??60,o=r?.maxWidth??500,l=e=>{const a=e.clientX-h.current,r=Math.max(n,Math.min(o,f.current+a));i(e=>{const a={...e,[c]:r};return t?.(a),a})},u=()=>{d(!1),p(null),a&&i(e=>(localStorage.setItem(a,JSON.stringify(e)),e))};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[s,c,e,a,t]),m(()=>(s?(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=""}),[s]);const v=l(()=>{const r=e.reduce((e,a)=>(e[a.key]=a.defaultWidth??md,e),{});i(r),a&&localStorage.removeItem(a),t?.(r)},[e,a,t]);return{columnWidths:n,isDragging:s,activeColumn:c,handleMouseDown:g,resetWidths:v}}const hd=v("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"}}),fd=n.forwardRef(({className:e,variant:t,size:r,...n},i)=>a(ct.Root,{ref:i,className:Fi(hd({variant:t,size:r,className:e})),...n}));fd.displayName=ct.Root.displayName;const gd=n.createContext({size:"default",variant:"default"}),vd=n.forwardRef(({className:e,variant:t,size:r,children:n,...i},o)=>a(dt.Root,{ref:o,className:Fi("flex items-center justify-center gap-1",e),...i,children:a(gd.Provider,{value:{variant:t,size:r},children:n})}));vd.displayName=dt.Root.displayName;const bd=n.forwardRef(({className:e,children:t,variant:r,size:i,...o},s)=>{const l=n.useContext(gd);return a(dt.Item,{ref:s,className:Fi(hd({variant:l.variant||r,size:l.size||i}),e),...o,children:t})});bd.displayName=dt.Item.displayName;const xd=p(function({onNew:e,newButtonLabel:r,showNewButton:n=!0,showSearch:i=!1,searchValue:o="",onSearchChange:s,searchPlaceholder:l,showBulkActions:d=!1,selectedCount:c=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:f,viewMode:g,onViewModeChange:v,showViewToggle:b=!1,availableViewModes:x=["table","list","grid"],rightSlot:y,className:N}){const{t:w}=Ga(),_=c>0,C=e&&n||h.length>0,k=f||b||y,S=i&&s;return C||S||k||d&&_?t("div",{className:Fi("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",N),children:[t("div",{className:"flex items-center gap-2 shrink-0",children:[e&&n&&t($i,{onClick:e,children:[a(Q,{size:16,className:"mr-2"}),r||"Novo"]}),h.map((e,r)=>{const n=e.icon;return t($i,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[n&&a(n,{size:16,className:"mr-2"}),e.label]},r)})]}),d&&_&&t("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[a(Ko,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),t(hs,{delayDuration:200,children:[u.length>0?u.map((e,r)=>{const n=e.icon,i=e.disabled;return t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:Fi("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:i,onClick:()=>e.action([]),children:n?a(n,{size:16}):a("span",{className:"text-xs",children:e.label[0]})})}),a(vs,{children:e.label})]},r)}):t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a(H,{size:16})})}),a(vs,{children:w("ap_delete")})]}),t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a(E,{size:16})})}),a(vs,{children:w("clear_selection")})]})]})]}),S&&a("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t("div",{className:"relative w-full",children:[a(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{type:"text",placeholder:l||"Pesquisar",value:o,onChange:e=>s?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[f,b&&g&&v&&a(vd,{type:"single",value:g,onValueChange:e=>e&&v(e),size:"sm",children:x.map(e=>{const t=(e=>{switch(e){case"table":return Z;case"list":return J;case"grid":return X}})(e);return a(bd,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a(t,{className:"h-4 w-4"})},e)})}),y]})]}):null}),yd=p(({checked:e,onCheckedChange:t})=>a(Wo,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function Nd(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 wd({columns:e,storageKey:a,enabled:t=!0,defaultHiddenColumns:r}){const n=s(()=>e.map(e=>String(e.key)),[e]),i=s(()=>new Set(r??[]),[r]),[d,c]=o(()=>{if(!t)return i;if(!a)return i;const e=Nd(a);return e?.hiddenColumns??i}),[u,p]=o(()=>{if(!t||!a)return n;const e=Nd(a)?.columnOrder;return e&&e.length>0?e:n}),[h,f]=o(()=>t&&a?Nd(a)?.groupByColumns??[]:[]),[g,v]=o(new Set);m(()=>{t&&a&&function(e,a){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,groupByColumns:a.groupByColumns}))}catch{}}(a,{hiddenColumns:d,columnOrder:u,groupByColumns:h})},[d,u,h,a,t]),m(()=>{const a=new Set(e.map(e=>String(e.key))),t=new Set(u),r=[...a].filter(e=>!t.has(e));r.length>0&&p(e=>[...e.filter(e=>a.has(e)),...r])},[e]);const b=l(e=>d.has(e),[d]),x=l(e=>{c(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),y=l(()=>{c(new Set)},[]),N=l(()=>{if(c(i),p(n),f([]),v(new Set),a)try{localStorage.removeItem(a)}catch{}},[n,i,a]),w=l((e,a)=>{p(t=>{const r=[...t],[n]=r.splice(e,1);return r.splice(a,0,n),r})},[]),_=l(e=>{v(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),C=l(e=>{f(e),v(new Set)},[]),k=l(e=>{f(a=>a.includes(e)?a:[...a,e])},[]),S=l(e=>{f(a=>a.filter(a=>a!==e)),v(a=>{const t=new Set;for(const r of a)r.includes(`${e}:`)||t.add(r);return t})},[]),A=l((e,a)=>{f(t=>{const r=[...t],[n]=r.splice(e,1);return r.splice(a,0,n),r}),v(new Set)},[]),E=h[0]??null,D=l(e=>{f(e?[e]:[]),v(new Set)},[]),P=s(()=>{if(!t)return e;const a=new Map(e.map(e=>[String(e.key),e]));return u.filter(e=>!d.has(e)&&a.has(e)).map(e=>a.get(e))},[e,u,d,t]),I=l(e=>{if(0===h.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(a,t,r,n){if(0===t.length)return[{groupKey:n||"__leaf__",groupValue:"",items:a,count:a.length,level:r}];const[i,...o]=t,s=new Map;for(const l of a){const e=String(l[i]??"(vazio)");s.has(e)||s.set(e,[]),s.get(e).push(l)}return Array.from(s.entries()).map(([a,t])=>{const s=n?`${n}|${i}:${a}`:`${i}:${a}`,l=o.length>0?e(t,o,r+1,s):void 0;return{groupKey:s,groupValue:a,items:t,count:t.length,level:r,children:l}})}(e,h,0,"")},[h]);return{visibleColumns:P,allColumns:e,isColumnHidden:b,toggleColumn:x,showAllColumns:y,resetColumns:N,columnOrder:u,reorderColumns:w,groupByColumn:E,setGroupByColumn:D,groupByColumns:h,setGroupByColumns:C,addGroupByColumn:k,removeGroupByColumn:S,reorderGroupByColumns:A,getGroupedData:I,collapsedGroups:g,toggleGroupCollapse:_}}function _d({enabled:e=!1,onReorder:a}){const[t,r]=o(null),[n,i]=o(null),d=l(()=>{r(null),i(null)},[]),c=l((n,o)=>({draggable:e,onDragStart:a=>{e&&(r(n),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setData("text/plain",String(n)),o&&a.dataTransfer.setData("application/column-key",o))},onDragOver:a=>{e&&null!==t&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDragEnter:a=>{e&&null!==t&&(a.preventDefault(),i(n))},onDrop:r=>{r.preventDefault(),e&&null!==t&&t!==n?(a(t,n),d()):d()},onDragEnd:()=>{d()}}),[e,t,a,d]);return s(()=>({dragFromIndex:t,dragOverIndex:n,isDragging:null!==t,getDragProps:c}),[t,n,c])}function Cd({columns:e,columnOrder:r,isColumnHidden:n,toggleColumn:i,showAllColumns:s,reorderColumns:l,groupByColumn:d,setGroupByColumn:c,groupByColumns:m=[],addGroupByColumn:p,removeGroupByColumn:h,resetColumns:f}){const{t:g}=Ga(),[v,b]=o(null),[x,y]=o(null),N=u(null),w=new Map(e.map(e=>[String(e.key),e])),_=r.filter(e=>w.has(e)).map(e=>w.get(e)),C=()=>{N.current=null,b(null),y(null)};_.some(e=>n(String(e.key)));const k=_.every(e=>!n(String(e.key)));return t(xs,{children:[a(ys,{asChild:!0,children:a($i,{variant:"outline",size:"icon",className:"h-8 w-8",children:a(ee,{size:16})})}),t(Ns,{className:"w-[260px] p-0",align:"end",children:[a("div",{className:"px-3 py-2 border-b",children:a("span",{className:"text-sm font-medium",children:"Colunas"})}),a("div",{className:"max-h-[300px] overflow-auto py-1",children:a(hs,{delayDuration:300,children:_.map((e,r)=>{const o=String(e.key),s=n(o),u=!1!==e.hideable,f=!0===e.groupable,w=m.includes(o)||d===o;return t("div",{draggable:!0,onDragStart:()=>(e=>{N.current=e,b(e)})(r),onDragOver:e=>((e,a)=>{e.preventDefault(),y(a)})(e,r),onDrop:()=>(e=>{null!==N.current&&N.current!==e&&l(N.current,e),N.current=null,b(null),y(null)})(r),onDragEnd:C,className:Fi("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",v===r&&"opacity-50",x===r&&"border-t-2 border-primary"),children:[a(ae,{size:14,className:"text-muted-foreground shrink-0"}),a(Wo,{checked:!s,onCheckedChange:()=>u&&i(o),disabled:!u,className:"shrink-0"}),a("span",{className:Fi("flex-1 truncate",s&&"text-muted-foreground"),children:e.header}),f&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:Fi("h-6 w-6 shrink-0",w&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),w?h?h(o):c?.(null):p?p(o):c?.(o)},children:a(te,{size:14})})}),a(vs,{children:g(w?"remove_grouping":"group_by_column")})]})]},o)})})}),t("div",{className:"border-t px-3 py-2 space-y-1",children:[a($i,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:k?()=>_.filter(e=>!1!==e.hideable).forEach(e=>i(String(e.key))):s,children:g(k?"deselect_all":"select_all_columns")}),f&&a($i,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:f,children:"Redefinir padrão"})]})]})]})}function kd({columns:e,groupByColumns:r,addGroupByColumn:n,removeGroupByColumn:s,reorderGroupByColumns:l}){const[d,c]=o(!1),[u,m]=o(null),[p,h]=o(null),f=new Map(e.map(e=>[String(e.key),e])),g=()=>{m(null),h(null)},v=r.length>0;return t("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",c(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},onDrop:e=>{e.preventDefault(),c(!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=f.get(a);e&&e.groupable&&n(a)}},className:Fi("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",d&&"bg-primary/5 border-primary/30",!v&&"text-muted-foreground"),children:[a(te,{size:14,className:"shrink-0 text-muted-foreground"}),a("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:v?r.map((e,r)=>{const n=f.get(e);if(!n)return null;const o=u===r,d=p===r&&u!==r;return t(i.Fragment,{children:[r>0&&a("span",{className:"text-xs text-muted-foreground",children:"›"}),t(Ko,{variant:"secondary",className:Fi("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",o&&"opacity-50",d&&"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",m(a)})(e,r),onDragOver:e=>((e,a)=>{e.preventDefault(),e.stopPropagation(),h(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||l(e,a)}m(null),h(null)})(e,r),onDragEnd:g,children:[n.header,a("button",{onClick:a=>{a.stopPropagation(),s(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:a(E,{size:12})})]})]},e)}):a("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const Sd=({manager:r,columns:n,onEdit:d,onView:c,onToggleStatus:u,onDelete:p,renderActions:h,customRowActions:f,enableBulkActions:g=!1,rowActionsVariant:v="dropdown",onNew:b,newButtonLabel:x,showNewButton:y=!0,customActions:N=[],hideActionBar:w,showActionBar:_=!0,showSearch:C=!1,searchValue:k,onSearchChange:S,searchPlaceholder:A,bulkActions:E=[],onBulkDelete:P,filters:I,viewMode:T,onViewModeChange:M,showViewToggle:R=!1,enableColumnResize:L=!0,resizeStorageKey:z,enableColumnManager:F=!0,columnManagerStorageKey:j,defaultHiddenColumns:O,enableGrouping:B=!1,enableExpandableRows:$=!1,renderExpandedContent:V,expandedRowIds:q,onToggleExpand:W,defaultExpandAll:H=!1,hideActionsColumn:G=!1})=>{const{t:K}=Ga(),{setSearchVisible:Y}=Sl(),Q=Pl(),[X,J]=o(()=>H&&$?new Set(r.entities.map(e=>e.id)):new Set),Z=void 0!==q,ee=Z?new Set(q):X,ae=l(e=>{Z&&W?W(e):J(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[Z,W]),te=void 0!==w?!w:_;m(()=>{if(!C)return Y(!0),()=>Y(!1)},[Y,C]);const ie=wd({columns:n,storageKey:j,enabled:F,defaultHiddenColumns:O}),oe=_d({enabled:F,onReorder:ie.reorderColumns}),se=F?ie.visibleColumns:n,{columnWidths:le,isDragging:de,activeColumn:ce,handleMouseDown:ue}=pd({columns:se.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:z?`${z}-columns`:void 0,enabled:L}),me=s(()=>(()=>{if(L){const e=se.map(e=>le[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return se.map((t,r)=>({...t,calculatedWidth:e[r],style:{width:e[r]/a*100+"%"}}))}let e=0;const a=se.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`}})})(),[se,L,le]),pe=b||N.length>0||C||g||I||R||F,he=te&&pe,fe=P||(()=>{r.bulkDelete?.(r.selectedIds)}),ge=e=>a(Fl,{className:"text-center",children:h?h(e):"inline"===v?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a(ud,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})}):a(cd,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})}),ve=e=>a(td,{className:"w-[160px]",children:a(dd,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,canDelete:!!p,customActions:f?f(e):[],renderAs:"context"})}),be=F?a(Cd,{columns:n,columnOrder:ie.columnOrder,isColumnHidden:ie.isColumnHidden,toggleColumn:ie.toggleColumn,showAllColumns:ie.showAllColumns,resetColumns:ie.resetColumns,reorderColumns:ie.reorderColumns,groupByColumn:B?ie.groupByColumn:void 0,setGroupByColumn:B?ie.setGroupByColumn:void 0,groupByColumns:B?ie.groupByColumns:void 0,addGroupByColumn:B?ie.addGroupByColumn:void 0,removeGroupByColumn:B?ie.removeGroupByColumn:void 0}):void 0;if(Q)return r.isLoading?a(Ol,{count:3}):0===r.entities.length?a(Wl,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t("div",{className:"flex flex-col h-full",children:[he&&a(xd,{onNew:b,newButtonLabel:x,showNewButton:y,showSearch:C,searchValue:k,onSearchChange:S,searchPlaceholder:A,showBulkActions:g,selectedCount:r.selectedIds.length,bulkActions:E,onBulkDelete:fe,onClearSelection:r.clearSelection,customActions:N,filters:I,viewMode:T,onViewModeChange:M,showViewToggle:R}),a("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>t(Kl,{children:[a(Yl,{asChild:!0,children:a(Gi,{className:Fi("overflow-hidden cursor-pointer hover:bg-muted/50",g&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),g?r.selectItem(e.id):d?.(e)},children:a(Xi,{className:"p-4",children:t("div",{className:"flex items-start gap-3",children:[g&&a("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a(yd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t("div",{className:"flex-1",children:[se.map(r=>t("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key))),(d||c||h)&&a("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:h?h(e):a(cd,{onEdit:d?()=>{d(e)}:void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})})]})]})})})}),ve(e)]},e.id))})]});const xe=B&&ie.groupByColumns.length>0?ie.getGroupedData(r.entities):null,ye=null!==xe,Ne=($?1:0)+(g?1:0)+se.length+(G?0:1),we=e=>{const n=$&&ee.has(e.id);return t(i.Fragment,{children:[t(Kl,{children:[a(Yl,{asChild:!0,children:t(Ll,{className:Fi("cursor-pointer hover:bg-muted/50 relative",("inline"===v||G)&&"group",g&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),g?r.selectItem(e.id):d?.(e)},children:[$&&a(Fl,{className:"w-[40px] px-2",children:a("button",{onClick:a=>{a.stopPropagation(),ae(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":K(n?"collapse_row":"expand_row"),children:a(n?D:U,{size:16,className:"text-muted-foreground"})})}),g&&a(Fl,{onClick:e=>e.stopPropagation(),children:a(yd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),se.map(t=>a(Fl,{className:t.className,children:a(Hl,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!G&&ge(e)]})}),ve(e)]}),n&&V&&a(Ll,{className:"bg-muted/30 hover:bg-muted/30",children:a(Fl,{colSpan:Ne,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:V(e)})})})]},e.id)},_e=(e,r)=>{const{t:n}=Ga();return e.map(e=>{const n=ie.collapsedGroups.has(e.groupKey),o=16*e.level,s=Math.max(30,70-15*e.level);return t(i.Fragment,{children:[a(Ll,{className:Fi("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${s}%)`},onClick:()=>ie.toggleGroupCollapse(e.groupKey),children:a(Fl,{colSpan:r,className:"py-2 px-4",children:t("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${o}px`},children:[a(n?U:D,{size:16}),a("span",{children:e.groupValue}),t("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!n&&(e.children?_e(e.children,r):e.items.map(we))]},e.groupKey)})};return t("div",{className:"flex flex-col h-full",children:[he&&a(xd,{onNew:b,newButtonLabel:x,showNewButton:y,showSearch:C,searchValue:k,onSearchChange:S,searchPlaceholder:A,showBulkActions:g,selectedCount:r.selectedIds.length,bulkActions:E,onBulkDelete:fe,onClearSelection:r.clearSelection,customActions:N,filters:I,viewMode:T,onViewModeChange:M,showViewToggle:R}),r.isLoading?a(jl,{rows:5,columns:se.length}):t("div",{className:"flex flex-col h-full overflow-hidden",children:[B&&a(kd,{columns:n,groupByColumns:ie.groupByColumns,addGroupByColumn:ie.addGroupByColumn,removeGroupByColumn:ie.removeGroupByColumn,reorderGroupByColumns:ie.reorderGroupByColumns}),a("div",{className:"flex-1 overflow-auto",children:t(Il,{className:"table-fixed w-full",children:[t("colgroup",{children:[$&&a("col",{style:{width:"40px"}}),g&&a("col",{style:{width:"50px"}}),me.map((e,t)=>a("col",{style:e.style},t)),!G&&a("col",{style:{width:"inline"===v?"auto":"50px",minWidth:"50px"}})]}),a(Tl,{children:t(Ll,{children:[$&&a(zl,{className:"w-[40px]"}),g&&a(zl,{className:"w-[50px]",children:a(yd,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),se.map((e,n)=>{const i=L&&!1!==e.resizable,o=ce===String(e.key),s=F?oe.getDragProps(n,String(e.key)):{},l=oe.dragFromIndex===n,d=oe.dragOverIndex===n&&oe.dragFromIndex!==n;return t(zl,{className:Fi(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",F&&oe.isDragging&&"cursor-grabbing",l&&"opacity-50",d&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...s,children:[t("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(re,{size:14,className:"ml-1"}):a(ne,{size:14,className:"ml-1"}))]}),i&&a(Gl,{direction:"horizontal",onMouseDown:a=>ue(String(e.key),a),isDragging:o})]},String(e.key));var c}),!G&&a(zl,{className:"w-[50px] text-center",children:be||e.t("actions")})]})}),a(Ml,{children:0===r.entities.length?a(Ll,{children:a(Fl,{colSpan:Ne,className:"h-32",children:a(Wl,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):ye?_e(xe,Ne):r.entities.map(we)})]})})]})]})};function Ad(e,a,t,r){const[n,i]=o({}),[l,d]=o({}),c=s(()=>e,[e]),u=e=>e instanceof Date&&!isNaN(e.getTime()),p=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{}}},h=(e,a)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(a)}catch(t){return p(e)}},f=(e,a,t)=>{if(e.required&&(""===a||null==a||Array.isArray(a)&&0===a.length))return`${e.label} é obrigatório`;if(e.validation){let n;if("function"==typeof e.validation?n=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(n=e.validation.custom),n)try{const e=n(a,t);if(e)return e}catch(r){}}};m(()=>{if(!r)return;const e=a=>{const t=[];return a.forEach(a=>{t.push(a),a.fields&&t.push(...e(a.fields))}),t},n=e(c),o={};n.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);u(e)&&(t=e.toISOString().split("T")[0])}else u(t)&&(t=t.toISOString().split("T")[0])}else t=p(e);o[e.name]=t}),n.forEach(e=>{const a=h(e,o);void 0!==a&&(o[e.name]=a)}),a&&Object.keys(a).forEach(e=>{n.find(a=>a.name===e)||void 0===a[e]||(o[e]=a[e])}),i(o),d({}),t&&t(o)},[c,a,t,r]);const g=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...g(e.fields))}),a},v=()=>{const e=g(c),a={};return e.forEach(e=>{const t=f(e,n[e.name],n);t&&(a[e.name]=t)}),d(a),0===Object.keys(a).length};return{formData:n,errors:l,updateField:(e,a)=>{i(r=>{const n={...r,[e]:a},i=((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(c).filter(a=>a.dependsOn===e).forEach(e=>{const a=h(e,t);void 0!==a&&(t={...t,[e.name]:a})}),t})(e,n);return t&&t(i),i}),l[e]&&d(a=>{const t={...a};return delete t[e],t});const r=g(c).find(a=>a.name===e);if(r){const t=f(r,a,n);t&&d(a=>({...a,[e]:t}))}},validateForm:v,handleSubmit:e=>a=>{a&&(a.preventDefault(),a.stopPropagation()),v()&&e(n)}}}const Ed=[{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}],Dd=[10,22,35,45,55,68,78,87,94].flatMap(e=>Ed.map(({hue:a,saturation:t})=>((e,a,t)=>{t/=100;const r=a=>(a+e/30)%12,n=(a/=100)*Math.min(t,1-t),i=e=>{const a=t-n*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`#${i(0)}${i(8)}${i(4)}`})(a,t,e))),Pd=({value:e="#3b82f6",onChange:r,label:n,customColorLabel:i,presetColorsLabel:o,showHexValue:s=!0})=>{const{t:l}=Ga(),d=i??l("custom_color"),c=o??l("preset_colors");return t("div",{className:"space-y-2",children:[n&&a(Hi,{children:n}),t(xs,{children:[a(ys,{asChild:!0,children:t($i,{variant:"outline",className:"w-full justify-between text-left font-normal",children:[t("span",{className:"flex items-center min-w-0",children:[a("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),s&&a("span",{className:"truncate",children:e})]}),a(D,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),a(Ns,{className:"w-auto p-3",children:t("div",{className:"space-y-3",children:[t("div",{children:[a(Hi,{children:c}),a("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${Ed.length}, minmax(0, 1fr))`},children:Dd.map((t,n)=>{const i=t.toLowerCase()===e.toLowerCase();return a("button",{className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 "+(i?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:t},onClick:()=>r?.(t),"aria-label":`Selecionar cor ${t}`},`${t}-${n}`)})})]}),t("div",{children:[a(Hi,{htmlFor:"color-input",children:d}),a(qi,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Id=n.forwardRef(({className:e,children:r,...n},i)=>t(ut.Root,{ref:i,className:Fi("relative overflow-hidden",e),...n,children:[a(ut.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),a(Td,{}),a(ut.Corner,{})]}));Id.displayName=ut.Root.displayName;const Td=n.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a(ut.ScrollAreaScrollbar,{ref:n,orientation:t,className:Fi("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(ut.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Td.displayName=ut.ScrollAreaScrollbar.displayName;const Md=[{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 Rd({name:e,filled:t,className:r}){return a("span",{className:`material-symbols-outlined ${r??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Ld=({value:e=null,onChange:r,label:n,noIconLabel:i="SEM ÍCONE"})=>{const[s,l]=o(!1),d=e?(c=e,Md.find(e=>e.name===c)):null;var c;const u=e=>{r?.(e),l(!1)};return t("div",{className:"space-y-2",children:[n&&a(Hi,{children:n}),t(xs,{open:s,onOpenChange:l,children:[a(ys,{asChild:!0,children:t($i,{variant:"outline",className:"justify-start text-left font-normal gap-2",children:[d?a(Rd,{name:d.name,filled:d.filled,className:"text-xl text-muted-foreground"}):a("span",{className:"text-muted-foreground text-sm",children:i}),a(D,{className:"ml-auto h-4 w-4 opacity-50"})]})}),a(Ns,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",children:t("div",{className:"space-y-3",children:[a(Id,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a("div",{className:"grid grid-cols-10 gap-1",children:Md.map(t=>a("button",{type:"button",className:"flex items-center justify-center p-1.5 rounded hover:bg-accent transition-colors "+(e===t.name?"bg-primary/10 text-primary":"text-muted-foreground"),onClick:()=>u(t.name),title:t.name,children:a(Rd,{name:t.name,filled:t.filled,className:"text-2xl"})},t.name))})}),a("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:()=>u(null),children:i})]})})]})]})},zd=n.forwardRef(({className:e,...t},r)=>a(mt.Root,{className:Fi("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(mt.Thumb,{className:Fi("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")})}));zd.displayName=mt.Root.displayName;const Fd=(e={})=>{const{user:a,alias:t}=Sl(),{enabled:r=!0,status:n="active"}=e;return Ja({queryKey:["qualiex-users",t,n],queryFn:()=>dl.getUsers(t,n),enabled:r&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},Ud=({value:t,onChange:r,multiple:n=!1,label:i,required:d,placeholder:c,icon:u,maxDisplayedBadges:p,className:h,disabled:f,enabled:g,displayFormat:v="name",customDisplayFn:b,filterFn:x,sortOptions:y=!0,popoverContainer:N,onOpen:w,onClose:_})=>{const{t:C}=Ga(),{data:k=[],isLoading:S,error:A}=Fd({enabled:g}),[E,D]=o(new Map),P=s(()=>t?Array.isArray(t)?t.filter(Boolean):[t].filter(Boolean):[],[t]),I=s(()=>{if(0===P.length||0===k.length)return"";const e=new Set(k.map(e=>e.userId||e.id||""));return P.filter(a=>a&&!e.has(a)&&!E.has(a)).sort().join(",")},[P,k,E]);m(()=>{if(!I)return;const e=I.split(",");let a=!1;const t=Qs.extractTokenData();return t?.alias&&t?.companyId?(dl.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||D(a=>{const r=new Map(a);for(const n of e){const e=t.find(e=>e.userId===n||e.id===n);e&&r.set(n,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{a=!0}):void 0},[I]);const T=s(()=>x?k.filter(x):k,[k,x]),M=s(()=>{if(0===P.length)return T;const a=new Set(T.map(e=>e.userId||e.id||"")),t=P.filter(e=>e&&!a.has(e));if(0===t.length)return T;const r=t.map(a=>{const t=E.get(a);return t||{userId:a,id:a,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...T,...r]},[T,P,E]),R=l(a=>{let t;if("custom"===v&&b)t=b(a);else{const e=a.userName||"";switch(v){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},[v,b]);return a(Rs,{multiple:n,value:t??(n?[]:""),onChange:r,options:M,isLoading:S,error:A,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:R,placeholder:c||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:C("no_results"),label:i,required:d,icon:u,maxDisplayedBadges:p,disabled:f,className:h,sortOptions:y,popoverContainer:N,onOpen:w,onClose:_})};function jd({title:e,sections:r,initialData:n,onSubmit:d,onCancel:c,open:m,submitButtonText:p,isLoading:h=!1,usersData:f}){const[g,v]=o(r?.[0]?.id||""),b=u(null),[x,y]=o(null),N=l(e=>{b.current=e,y(e)},[]),w=s(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:_,errors:C,updateField:k,handleSubmit:S}=Ad(w,n,void 0,m),A=s(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(_):e.disabled||!1})):[],[r,_]),E=s(()=>{const e=A.find(e=>e.id===g);if(e&&!e.disabled)return g;const a=A.find(e=>!e.disabled);return a?.id||g},[A,g]);i.useEffect(()=>{E!==g&&v(E)},[E,g]);const D=A.find(e=>e.id===E),P=e=>{const r=(e.computedValue,_[e.name]),n=void 0!==r?r:"",i=C[e.name];switch(e.type){case"group":const r="horizontal"===e.layout,o=r?`flex gap-3 w-full ${e.className||""}`:"space-y-3",s=r?Fi("space-y-2 w-full",e.wrapperClassName):Fi("space-y-2",e.className,e.wrapperClassName);return t("div",{className:s,children:[e.label,a("div",{className:o,children:e.fields?.map(e=>P(e))})]},e.name);case"user-select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Ud,{value:n||"",onChange:a=>k(e.name,a),placeholder:e.placeholder,disabled:e.disabled,className:i?"border-destructive":""}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"textarea":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Ho,{id:e.name,value:n||"",onChange:a=>{k(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${i?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Lo,{value:String(n),onValueChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a(Uo,{className:`${i?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a(Fo,{placeholder:e.placeholder})}),a(Bo,{children:e.options?.map(e=>a(Vo,{value:e.value,children:e.label},e.value))})]}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"multiselect":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Rs,{options:e.options||[],value:Array.isArray(n)?n:[],onChange:a=>k(e.name,a),placeholder:e.placeholder,disabled:e.disabled,error:i,popoverContainer:x,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"date":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qi,{id:e.name,type:"date",value:String(n),onChange:a=>k(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Fi("w-full",i?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"color":return t("div",{children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qi,{id:e.name,type:"color",value:n||e.defaultValue||"#000000",onChange:a=>k(e.name,a.target.value),className:"h-10"}),i&&a("p",{className:"text-sm text-destructive mt-1",children:i})]},e.name);case"color-picker":return t("div",{children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Pd,{value:n||e.defaultValue||"#3b82f6",onChange:a=>k(e.name,a)}),i&&a("p",{className:"text-sm text-destructive mt-1",children:i})]},e.name);case"icon-picker":return t("div",{children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Ld,{value:n||e.defaultValue||null,onChange:a=>k(e.name,a)}),i&&a("p",{className:"text-sm text-destructive mt-1",children:i})]},e.name);case"custom":if(!e.component)return null;const l=e.component,d="function"==typeof e.componentProps?e.componentProps(_):e.componentProps||{};return t("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(l,{value:n,onChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,error:i,popoverContainer:x,...d}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"number":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qi,{id:e.name,type:"number",value:null!=n?String(n):"",onChange:a=>{const t=a.target.value,r=""===t?null:Number(t);k(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${i?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"checkbox":return t("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[a(Wo,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),t(Hi,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name);case"switch":return t("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(zd,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),i&&a("p",{className:"text-sm text-destructive mt-2",children:i})]},e.name);default:return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(Hi,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qi,{id:e.name,type:"text",value:n||"",onChange:a=>{k(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${i?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),i&&a("p",{className:"text-sm text-destructive",children:i})]},e.name)}},I=l(()=>{if(!D)return null;if(D.disabled)return t("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a("div",{className:"rounded-full bg-muted p-3 mb-4",children:a("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),a("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),a("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(D.component){const e=D.component;return a(e,{formData:_,updateField:k,errors:C,users:f,disabled:D.disabled})}return a("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:D.fields.map(P)})},[D,_,k,C,f,P]),T=t("div",{className:"flex flex-col max-h-[80vh]",children:[A.length>1&&a("div",{className:"flex-shrink-0 p-4 border-b",children:a("div",{className:"flex space-x-2",children:A.map(e=>a($i,{variant:E===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const a=A.find(a=>a.id===e);a&&!a.disabled&&v(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),a("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:h?a("div",{className:"flex items-center justify-center py-12",children:a("div",{className:"text-muted-foreground",children:"Carregando..."})}):t("form",{onSubmit:S(d),className:"space-y-3 md:space-y-4",children:[I(),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a($i,{type:"button",variant:"outline",onClick:c,children:"Cancelar"}),a($i,{type:"submit",disabled:h,children:p||"Salvar"})]})]})})]});return a(mo,{open:m,onOpenChange:e=>{!1===e&&!0===m&&c()},children:t(bo,{ref:N,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t(xo,{showSeparator:!0,children:[a(wo,{children:e}),a(_o,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),T]})})}function Od({currentPage:e,totalPages:n,totalItems:i,itemsPerPage:o,onPageChange:s,onItemsPerPageChange:l,variant:d="full"}){const{t:c}=Ga();if(0===i)return null;const u=(e-1)*o+1,m=Math.min(e*o,i);return t("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[a("div",{className:"flex items-center gap-2",children:"full"===d&&t(r,{children:[a("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:c("rows_per_page","Linhas por página")}),t(Lo,{value:String(o),onValueChange:e=>l(Number(e)),children:[a(Uo,{className:"h-8 w-[70px]",children:a(Fo,{})}),t(Bo,{children:[a(Vo,{value:"10",children:"10"}),a(Vo,{value:"25",children:"25"}),a(Vo,{value:"50",children:"50"}),a(Vo,{value:"100",children:"100"})]})]})]})}),t("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[u,"-",m," ",c("of","de")," ",i," ",c("items","itens")]}),t("div",{className:"flex items-center gap-1",children:[a($i,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:1===e,className:"h-8 w-8 p-0",children:a(ie,{size:16})}),a($i,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a(oe,{size:16})}),t("div",{className:"flex items-center gap-1 px-2",children:[a("span",{className:"text-sm font-medium",children:e}),a("span",{className:"text-sm text-muted-foreground",children:c("of","de")}),a("span",{className:"text-sm font-medium",children:n})]}),a($i,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:e===n,className:"h-8 w-8 p-0",children:a(U,{size:16})}),a($i,{variant:"outline",size:"sm",onClick:()=>s(n),disabled:e===n,className:"h-8 w-8 p-0",children:a(se,{size:16})})]})]})}function Bd({manager:e}){return a(Od,{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 $d={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Vd={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},qd={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Wd({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:i="start",wrap:o=!1,className:s}){return a("div",{className:Fi("flex","column"===t?"flex-col":"flex-row",$d[r],Vd[n],qd[i],o&&"flex-wrap",s),children:e})}function Hd({manager:e,filters:n,inline:i=!1}){const{t:o}=Ga(),{isSearchVisible:s}=Sl(),l=e.searchTerm,d=t(r,{children:[n.some(e=>"search"===e.type)&&!s&&t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(qi,{placeholder:"Pesquisar",value:e.searchTerm,onChange:a=>e.handleSearch(a.target.value),className:"pl-10"})]}),n.filter(e=>"select"===e.type&&e.options).map((e,r)=>t(Lo,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a(Uo,{className:"w-[180px]",children:a(Fo,{placeholder:e.placeholder})}),a(Bo,{children:e.options.map(e=>a(Vo,{value:e.value,children:e.label},e.value))})]},`select-${r}`)),n.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return a("div",{className:i?"":"w-full sm:w-auto",children:a(r,{...e.props})},`custom-${t}`)}),l&&t($i,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a(E,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return i?a("div",{className:"flex items-center gap-2",children:d}):a(Wd,{direction:"column",gap:"md",className:"mb-6",children:a(Wd,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:d})})}function Gd({manager:e,config:r,formSections:n,onSave:i,onToggleStatus:s,defaultSort:l}){e&&e.queryKey;const{setSearchVisible:d}=Sl(),[c,u]=tt(),[p,h]=o(!1),[f,g]=o(null),[v,b]=o({isOpen:!1,entityId:null,entityName:""}),[x,y]=o({isOpen:!1,count:0});m(()=>(d(!0),()=>{d(!1)}),[d]),m(()=>{if(l&&e){const a=`${e.queryKey}_sortField`,t=`${e.queryKey}_sortDirection`;if(!c.has(a)&&!c.has(t)){const e=Object.fromEntries(c);e[a]=l.column,e[t]=l.direction,u(e)}}},[]);const N=n.length>0?e=>{r.onEdit?r.onEdit(e):(g(e),h(!0))}:void 0,w="function"==typeof e?.deleteEntity?e=>{b({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,_=()=>{b({isOpen:!1,entityId:null,entityName:""})},C=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,k=(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 t("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&a(xd,{onNew:()=>{r.onNew?r.onNew():(g(null),h(!0))},newButtonLabel:r.newButtonLabel,showNewButton:C,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{y({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:k,filters:r.filters&&r.filters.length>0?a(Hd,{manager:e,filters:r.filters,inline:!0}):void 0}),a("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?a("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):a(Sd,{manager:e,columns:r.columns,onEdit:N,onDelete:w,onToggleStatus:s,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("div",{className:"flex-shrink-0 border-t bg-background",children:a(Bd,{manager:e})}),!r.useCustomRouting&&!r.onNew&&n.length>0&&a(jd,{open:p,title:f?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:n,initialData:f||void 0,onSubmit:e=>{i(e),h(!1),g(null)},onCancel:()=>{h(!1),g(null)},isLoading:e.isLoading,submitButtonText:f?"Atualizar":"Criar"}),a(mo,{open:v.isOpen,onOpenChange:_,children:t(bo,{size:"sm",variant:"destructive",children:[a(xo,{showSeparator:!0,children:a(wo,{children:"Você tem certeza absoluta?"})}),a("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a("strong",{children:v.entityName}),". Esta ação não pode ser desfeita."]})}),t(No,{children:[a($i,{variant:"outline",onClick:_,children:"Cancelar"}),a($i,{variant:"destructive",onClick:()=>{v.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(v.entityId),b({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),a(mo,{open:x.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),children:t(bo,{size:"sm",variant:"destructive",children:[a(xo,{showSeparator:!0,children:a(wo,{children:"Você tem certeza absoluta?"})}),a("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a("strong",{children:x.count})," ",1===x.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t(No,{children:[a($i,{variant:"outline",onClick:()=>y({isOpen:!1,count:0}),children:"Cancelar"}),a($i,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),y({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Kd(e){return({manager:t})=>{const{manager:r,config:n,onSave:i,onEdit:o,onToggleStatus:s}=e,l=t??r,d={entityName:n.entityName,entityNamePlural:n.entityNamePlural,filters:n.filters||[],columns:n.columns,cardFields:n.cardFields||[],enableBulkActions:n.enableBulkActions??!1,bulkActions:n.bulkActions||[],customActions:n.customActions,customRowActions:n.customRowActions,customListView:n.customListView,onEdit:o||n.onEdit,onNew:n.onNew,useCustomRouting:n.useCustomRouting,hideNewButton:n.hideNewButton,showNewButton:n.showNewButton,newButtonLabel:n.newButtonLabel,showSearch:n.showSearch,searchPlaceholder:n.searchPlaceholder,showActionBar:n.showActionBar};return a(Gd,{manager:l,config:d,formSections:n.formSections,onSave:i,onToggleStatus:s,defaultSort:n.defaultSort})}}function Yd(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)}}}function Qd(e,a,t={}){const r=[];return Object.keys(a).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const t=a[e],n={key:e,header:Jd(e),label:Jd(e),...Xd(e,t),sortable:!0,searchable:"string"==typeof t};r.push(n)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...t}}function Xd(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 Jd(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const Zd=({children:n})=>{const{isAuthenticated:o,isLoading:s}=Sl();if(i.useEffect(()=>{if(s)return;if(o)return;if(Qs.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=vr(),n=window.location.pathname+window.location.search+window.location.hash;["/","/login","/callback"].includes(window.location.pathname)||localStorage.setItem("auth_return_url",n);(async()=>{r?await Nl.loginDev():Nl.loginProd()})()},[o,s]),s&&!o)return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:a(Yi,{className:"text-xl font-semibold",children:"Carregando..."})}),t(Xi,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!o){const r=new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token");return a("div",r?{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:a(Yi,{className:"text-xl font-semibold",children:"Processando..."})}),t(Xi,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}:{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:a(Yi,{className:"text-xl font-semibold",children:"Iniciando..."})}),t(Xi,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:vr()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a(r,{children:n})};function ec(e={}){const{paramName:a="alias"}=e,t=rt(),{alias:r,companies:n}=Sl(),i=t[a]||null;return s(()=>{if(!i)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===i)||null,a=!!e;return{urlAlias:i,isAliasMismatch:a&&i!==r,isValidAlias:a,isMissing:!1,matchedCompany:e}},[i,r,n])}function ac({children:e,paramName:n="alias"}){const i=nt(),s=it(),d=rt(),{alias:c,isAuthenticated:p,isLoading:h,switchUnit:f}=Sl(),{urlAlias:g,isAliasMismatch:v,isValidAlias:b,isMissing:x,matchedCompany:y}=ec({paramName:n}),[N,w]=o(!1),_=u(!1),C=n in d,k=l(e=>{const a=d[n],{pathname:t,search:r,hash:i}=s;if(a){const n=t.split("/"),o=n.findIndex(e=>e===a);if(o>=0)return n[o]=e,n.join("/")+r+i}return`/${e}${"/"===t?"":t}${r}${i}`},[d,n,s]);return m(()=>{if(C&&!h&&p&&c&&!_.current)if(x)i(k(c),{replace:!0});else if(!g||b){if(v&&y&&!_.current){(async()=>{_.current=!0,w(!0);try{await f(y)}catch(e){c&&i(k(c),{replace:!0})}finally{_.current=!1,w(!1)}})()}}else i(k(c),{replace:!0})},[C,h,p,c,x,g,b,v,y,f,k,i]),h||!p?a(r,{children:e}):N?a("div",{className:"flex items-center justify-center min-h-screen",children:t("div",{className:"flex flex-col items-center gap-3",children:[a(Qo,{size:"lg"}),a("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a(r,{children:e})}function tc(){const{alias:e}=Sl(),{pathname:t,search:r,hash:n}=it();return e?a(ot,{to:`/${e}${t}${r}${n}`,replace:!0}):null}const rc=v("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"}}),nc={info:ce,warning:ce,danger:de,success:le},ic=n.forwardRef(({className:e,variant:r="info",showIcon:n=!0,children:i,...o},s)=>{const l=nc[r||"info"];return t("div",{ref:s,role:"alert",className:Fi(rc({variant:r}),e),...o,children:[n&&a(l,{className:"h-4 w-4"}),i]})});ic.displayName="Alert";const oc=n.forwardRef(({className:e,...t},r)=>a("h5",{ref:r,className:Fi("mb-1 font-medium leading-none tracking-tight",e),...t}));oc.displayName="AlertTitle";const sc=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("text-sm [&_p]:leading-relaxed",e),...t}));sc.displayName="AlertDescription";const lc=()=>{const{processCallback:e}=Sl(),n=nt(),[i,s]=o(null),[l,d]=o(!1);m(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),n(e||"/",{replace:!0})}else s("Falha na autenticação. Tente novamente.")}catch(a){localStorage.removeItem("auth_return_url"),s(a?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e,n]);const c=async()=>{d(!0),s(null);try{await e()||s("Falha na autenticação. Tente novamente.")}catch(a){s(a?.message||"Erro ao tentar novamente.")}finally{d(!1)}},u=()=>{window.location.href="/"};return a("div",i?{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:t(Yi,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a(O,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t(Xi,{className:"space-y-4",children:[a(ic,{variant:"danger",children:a(sc,{children:i})}),a("div",{className:"text-sm text-muted-foreground",children:a("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t("div",{className:"flex gap-2",children:[a($i,{onClick:c,disabled:l,className:"flex-1",children:t(r,l?{children:[a(Qo,{size:"sm",className:"mr-2"}),"Tentando..."]}:{children:[a(ue,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a($i,{onClick:u,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}:{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:a(Yi,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t(Xi,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(Qo,{size:"lg"})}),a("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},dc=()=>{const{t:e}=Ga();return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Gi,{className:"w-full max-w-md",children:[a(Ki,{className:"text-center",children:a(Yi,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t(Xi,{className:"text-center space-y-4",children:[a("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a($i,{onClick:async()=>{vr()?await Nl.loginDev():Nl.loginProd()},className:"w-full",size:"lg",children:vr()?e("dev_login"):e("login_with_qualiex")})]})]})})},cc=d(void 0);function uc({children:e,actions:t}){const{t:r}=Ga(),[n,i]=o({}),[d,c]=o(t);m(()=>{c(t)},[t]);const u=l(()=>i({}),[]),p=s(()=>({metadata:n,setMetadata:i,clearMetadata:u,headerActions:d,setHeaderActions:c}),[n,u,d]);return a(cc.Provider,{value:p,children:e})}function mc(){const e=c(cc);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}function pc(e){const{setMetadata:a,clearMetadata:t}=mc(),r=u({});m(()=>{const n=JSON.stringify(r.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(r.current.title!==e.title||r.current.subtitle!==e.subtitle||n)&&(r.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},a(e)),()=>t()},[e.title,e.subtitle,e.breadcrumbs,a,t])}function hc(e){return{queryClient:e.queryClient||new et({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}var fc={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..."},gc={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..."},vc={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 bc="true"===import.meta.env.VITE_I18N_DEBUG_MODE;function xc(a,t){e.addResourceBundle(a,"app",t,!0,!0)}bc&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(Ka).init({resources:{"pt-BR":{core:fc},"en-US":{core:gc},"es-ES":{core:vc}},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:bc?["debugKeys"]:[]});const yc=d(void 0),Nc={locale:hi,timezone:gi,datetimeFormat:fi},wc=async()=>{},_c=({children:e})=>a(yc.Provider,{value:{...Nc,setLocale:wc,setTimezone:wc,setDatetimeFormat:wc,isLoading:!1},children:e}),Cc=()=>{const e=c(yc);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},kc=d({moduleAlias:null});function Sc({moduleAlias:e=null,children:t}){return a(kc.Provider,{value:{moduleAlias:e},children:t})}function Ac(){return c(kc)}const Ec=pt.Root,Dc=pt.CollapsibleTrigger,Pc=pt.CollapsibleContent;class Ic extends h{constructor(a){super(a),this.copyErrorDetails=()=>{const a=Xs.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),C.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})},this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if(import.meta.env.DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,a){if(import.meta.env.DEV)throw e;Xs.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const r=Xs.getErrors().slice(0,2);return a("div",{className:"flex items-center justify-center min-h-screen p-4",children:t(Gi,{className:"w-full max-w-2xl",children:[t(Ki,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(de,{className:"h-12 w-12 text-destructive"})}),a(Yi,{children:e.t("something_went_wrong")})]}),t(Xi,{className:"space-y-4",children:[a("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t(Ec,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a(Dc,{asChild:!0,children:t($i,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[a(D,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t(Pc,{className:"mt-4 space-y-4",children:[t("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t("div",{children:[a("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t("div",{className:"text-sm space-y-2",children:[a("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&a(Id,{className:"h-32 w-full rounded border bg-muted p-2",children:a("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),r.length>0&&t("div",{className:"pt-3 border-t",children:[a("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),a("div",{className:"space-y-2",children:r.map((e,r)=>a("div",{className:"text-sm p-2 rounded bg-muted/50",children:t("div",{className:"flex items-start gap-2",children:[t("span",{className:"font-medium text-muted-foreground shrink-0",children:[r+1,"."]}),t("div",{className:"flex-1 min-w-0",children:[a("div",{className:"flex items-center gap-2 flex-wrap",children:t("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),a("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t($i,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a(me,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a($i,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const Tc=ht.Root,Mc=n.forwardRef(({className:e,...t},r)=>a(ht.List,{ref:r,className:Fi("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Mc.displayName=ht.List.displayName;const Rc=n.forwardRef(({className:e,...t},r)=>a(ht.Trigger,{ref:r,className:Fi("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}));Rc.displayName=ht.Trigger.displayName;const Lc=n.forwardRef(({className:e,...t},r)=>a(ht.Content,{ref:r,className:Fi("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 zc({className:e}){return t("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a("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("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("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 Fc({className:e}){return t("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a("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("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("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"})]})}Lc.displayName=ht.Content.displayName;const Uc={init(e){!function(e){try{return void function(e,a,t,r,n,i,o){a.getElementById("clarity-script")||(e[t]=e[t]||function(){(e[t].q=e[t].q||[]).push(arguments)},(i=a.createElement(r)).async=1,i.src="https://www.clarity.ms/tag/"+n+"?ref=npm",i.id="clarity-script",(o=a.getElementsByTagName(r)[0]).parentNode.insertBefore(i,o))}(window,document,"clarity","script",e)}catch(a){return}}(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)}},jc="forlogic_";function Oc(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Bc(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function $c(e){return Bc()?`${jc}${e}`:e}function Vc(e){return Bc()?`${jc}${e}`:e}function qc(e){try{e()}catch(a){import.meta.env.DEV}}function Wc(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&Uc.setTag(Vc(a),t)}function Hc({module:e,isContracted:a,sourceModule:t,alias:r}){Oc()&&qc(()=>{Wc({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:r}),Uc.event($c("module_menu_click"))})}function Gc({module:e,sourceModule:a,alias:t}){Oc()&&qc(()=>{Wc({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),Uc.event($c("module_interest_click"))})}function Kc({resource:e,sourceModule:a,alias:t}){Oc()&&qc(()=>{Wc({footer_resource:e,source_module:a,alias:t}),Uc.event($c("module_footer_click"))})}function Yc({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:r="https://sabergestao.com.br/",wikiUrl:n,alias:i,sourceModule:o}){const{t:s}=Ga(),l=zi(e||n||"https://educacao.sabergestao.com.br/{alias}/fe",i),d=e=>{Kc({resource:e,sourceModule:o,alias:i})};return t("div",{className:"flex-shrink-0 pt-4",children:[a(Zi,{className:"mb-4"}),t("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-white",children:s("learn_qualiex")}),t("a",{href:l,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(zc,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-foreground",children:s("know_saber_gestao")}),t("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(Fc,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t("a",{href:n||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(he,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const Qc=[{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 Xc({module:e,onClick:r}){return t("button",{type:"button",onClick:r,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[a("div",{className:Fi("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t("div",{className:"min-w-0",children:[a("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&a("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function Jc(e,a){if(0===e.length)return e;const t=Math.ceil(e.length/a),r=[];for(let n=0;n<t;n++)for(let i=0;i<a;i++){const a=i*t+n;a<e.length&&r.push(e[a])}return r}function Zc({modules:e,onModuleClick:r,contractedModules:n,onModuleInterest:i}){const s=function(){const[e,a]=o(4);return m(()=>{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}(),l=[...e].sort((e,a)=>e.name.localeCompare(a.name)),d=void 0!==n,c=d?l.filter(e=>n.includes(e.name)):l,u=d?l.filter(e=>!n.includes(e.name)):[],p=Jc(c,s),h=Jc(u,s),f=(e,a)=>{a?r?.(e):i?.(e)};return t("div",{className:"space-y-6",children:[p.length>0&&a("section",{children:a("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>a(Xc,{module:e,onClick:()=>f(e,!0)},e.name))})}),h.length>0&&t("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[a("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),a("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:h.map(e=>a(Xc,{module:e,onClick:()=>f(e,!1)},e.name))})]})]})}function eu({onModuleClick:e,contractedModules:r,onModuleInterest:n,nonContractedUrl:i="https://qualiex.com/",educaUrl:s="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:l="https://sabergestao.com.br/",wikiUrl:d,alias:c,sourceModule:u}){const[m,p]=o("qualiex"),h=e=>{Gc({module:e,sourceModule:u,alias:c}),window.open(i,"_blank","noopener,noreferrer"),n?.(e)};return t("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t(Tc,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[a(Mc,{className:"w-fit shrink-0",children:Qc.map(e=>t(Rc,{value:e.id,children:[e.label,t("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),Qc.map(t=>a(Lc,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a(Zc,{modules:t.modules,onModuleClick:a=>{return n=a,i=t.id,Hc({module:n,isContracted:"qualiex"!==i||!r||r.includes(n.name),sourceModule:u,alias:c}),void e?.(n);var n,i},contractedModules:"qualiex"===t.id?r:void 0,onModuleInterest:h})},t.id))]}),a(Yc,{educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:c,sourceModule:u})]})}const au={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},tu=6e5;function ru(e){const{moduleAlias:a}=Ac(),{alias:t,user:r,isAuthenticated:n}=Sl(),i=e??a,o=r?.id??null,d=n&&!!t&&!!o,{data:c=[],isLoading:u}=Ja({queryKey:["qualiex-associations",o,t],queryFn:()=>dl.fetchUserAssociations(o,t),enabled:d,staleTime:tu,gcTime:12e5}),m=s(()=>t&&0!==c.length?c.find(e=>e.companyAlias===t)??null:null,[c,t]),p=l(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=au[e];return void 0!==a&&m.softwares.includes(a)})},[m]);return{hasAccess:s(()=>!i||p(i),[i,p]),isLoading:d&&u,role:s(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}function nu(e){const{association:a}=ru();return s(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,r=Qc.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=au[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function iu({open:e,onOpenChange:r,onModuleClick:n,contractedModules:i,onModuleInterest:o,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,sourceModule:c}){const{alias:u}=Sl(),m=nu(i);return a(mo,{open:e,onOpenChange:r,children:t(bo,{size:"lg",className:"overflow-hidden flex flex-col",children:[a(xo,{className:"sr-only",children:a(wo,{children:"Módulos"})}),a(eu,{onModuleClick:e=>{n?n(e):e.url&&Li(zi(e.url,u||void 0))},contractedModules:m,onModuleInterest:o,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:u||void 0,sourceModule:c})]})})}function ou({open:r,onOpenChange:n,onModuleClick:i,contractedModules:o,onModuleInterest:l,userName:d,unitName:c,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,blocking:b=!0,size:x="lg",children:y,sourceModule:N}){const{t:w}=Ga(),_=s(()=>{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(mo,{open:r,onOpenChange:b?void 0:n,children:t(bo,{size:x,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:[t("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t("div",{className:"flex flex-col gap-1.5 text-left",children:[a(wo,{children:w("no_access_page")}),a(_o,{children:"Selecione um módulo para continuar navegando!"})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t(Zo,{children:[a(es,{asChild:!0,children:t($i,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a(fe,{className:"h-4 w-4 shrink-0"}),a("span",{className:"truncate text-xs",children:c||"Unidade"}),a(D,{className:"h-3 w-3 shrink-0"})]})}),a(ss,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t(ls,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a(fe,{className:"mr-2 h-4 w-4 shrink-0"}),a("span",{className:"truncate",children:e.name}),e.alias===m&&a(Ko,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t(Zo,{children:[a(es,{asChild:!0,children:t($i,{variant:"ghost",size:"sm",className:"gap-2",children:[a("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:a(ge,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a(D,{className:"h-3 w-3"})]})}),t(ss,{align:"end",children:[t("div",{className:"px-2 py-1.5",children:[a("p",{className:"text-sm font-medium",children:d||e.t("user")}),a("p",{className:"text-xs text-muted-foreground",children:c})]}),a(ms,{}),t(ls,{onClick:h,children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),y?t("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[a("div",{className:"flex-1",children:y}),a(Yc,{educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:N})]}):a(eu,{onModuleClick:i,contractedModules:o,onModuleInterest:l,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:N})]})})}function su(e,a){const{t:t}=Ga();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function lu({children:e,contractedModules:t,onModuleClick:n,onModuleInterest:i,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:d="https://sabergestao.com.br/",wikiUrl:c,bypassPaths:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=Ga(),{hasAccess:f,isLoading:g,association:v}=ru(),{user:b,alias:x,companies:y,isAuthenticated:N,isLoading:w,logout:_,switchUnit:C}=Sl(),k=nu(t),S=s(()=>y?.length?x&&y.find(e=>e.alias===x)||y[0]:null,[y,x]),A=s(()=>y?.length?y.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[y]),E=l(e=>{const a=y?.find(a=>a.alias===e.alias);if(!a)return;const{pathname:t,search:r,hash:n}=window.location;if(x){const e=t.split("/"),i=e.indexOf(x);if(i>=0)return e[i]=a.alias,void(window.location.href=e.join("/")+r+n)}C(a)},[x,C,y]),D=l(e=>{n?n(e):e.url&&Li(zi(e.url,x||void 0))},[n,x]),P=s(()=>{if(!m)return;const e=window.location.pathname,a=Object.keys(m).find(a=>su(e,[a]));return a?m[a]:void 0},[m]);return w||!N||u?.length&&su(window.location.pathname,u)?a(r,{children:e}):g?a("div",{className:"flex items-center justify-center min-h-screen",children:a(Qo,{size:"lg"})}):f?a(r,{children:e}):a(ou,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:i,userName:b?.name,unitName:S?.name,units:A,currentAlias:x||void 0,onUnitChange:E,onLogout:_,educaUrl:o,saberGestaoUrl:d,wikiUrl:c,sourceModule:p,blocking:!0,children:P})}function du({title:e,description:r,image:n,icon:i,ctaLabel:o,onCtaClick:s,children:l}){const{t:d}=Ga(),c=o??d("want_to_know_more");return t("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!l&&(n||i)&&a("div",{className:"flex items-center justify-center",children:n?a("img",{src:n,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):i?a("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:a(i,{className:"h-12 w-12 text-primary"})}):null}),t("div",{className:"space-y-3 max-w-lg",children:[a("h3",{className:"text-xl font-semibold text-foreground",children:e}),a("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r})]}),l?a("div",{className:"w-full",children:l}):s?t($i,{onClick:s,size:"lg",className:"gap-2",children:[a(be,{className:"h-4 w-4"}),c]}):null]})}let cu=!1;function uu(){if(cu||"undefined"==typeof document)return;cu=!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 mu({projectId:e,mode:a="auto"}){const{user:t,alias:r,isAuthenticated:n}=Sl();m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!vr()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Uc.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(t){import.meta.env.DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,a]),m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&n&&t&&"function"==typeof window.clarity)try{const e=t.email||t.identifier||"anonymous";Uc.identify(e,void 0,"modules-menu",t.name||void 0),r&&Uc.setTag("alias",r),"boolean"==typeof t.isSysAdmin&&Uc.setTag("isSysAdmin",String(t.isSysAdmin))}catch(e){import.meta.env.DEV}},[t,r,n,a])}function pu({children:r,queryClient:n,moduleAlias:o,moduleAccessGuardProps:s,appTranslations:l,clarityProjectId:d,clarityMode:c="auto"}){uu();const[u]=i.useState(()=>new et({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),m=n??u;i.useEffect(()=>{if(l)for(const[e,a]of Object.entries(l))xc(e,a)},[l]);const p={sourceModule:o,...s};return t(Ic,{children:[a(fu,{}),a(Ya,{i18n:e,children:a(at,{client:m,children:t(kl,{children:[a(hu,{projectId:d,mode:c}),a(_c,{children:a(Sc,{moduleAlias:o,children:a(lu,{...p,children:r})})})]})})})]})}function hu({projectId:e,mode:a}){return mu({projectId:e,mode:a}),null}function fu(){const e=Js(import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY),r=!!import.meta.env.VITE_SUPABASE_PK_OVERRIDE;if(!e||r||!import.meta.env.DEV)return null;const n={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t("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("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",a("code",{style:n,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",a("code",{style:n,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const gu=ft.Root,vu=n.forwardRef(({className:e,...t},r)=>a(ft.Item,{ref:r,className:Fi("border-b",e),...t}));vu.displayName="AccordionItem";const bu=n.forwardRef(({className:e,children:r,...n},i)=>a(ft.Header,{className:"flex",children:t(ft.Trigger,{ref:i,className:Fi("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[r,a(D,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));bu.displayName=ft.Trigger.displayName;const xu=n.forwardRef(({className:e,children:t,...r},n)=>a(ft.Content,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a("div",{className:Fi("pb-4 pt-0",e),children:t})}));xu.displayName=ft.Content.displayName;const yu=n.forwardRef(({className:e,...t},r)=>a(gt.Root,{ref:r,className:Fi("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));yu.displayName=gt.Root.displayName;const Nu=n.forwardRef(({className:e,...t},r)=>a(gt.Image,{ref:r,className:Fi("aspect-square h-full w-full",e),...t}));Nu.displayName=gt.Image.displayName;const wu=n.forwardRef(({className:e,...t},r)=>a(gt.Fallback,{ref:r,className:Fi("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));wu.displayName=gt.Fallback.displayName;const _u=n.forwardRef(({...e},t)=>a("nav",{ref:t,"aria-label":"breadcrumb",...e}));_u.displayName="Breadcrumb";const Cu=n.forwardRef(({className:e,...t},r)=>a("ol",{ref:r,className:Fi("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));Cu.displayName="BreadcrumbList";const ku=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Fi("inline-flex items-center gap-1.5",e),...t}));ku.displayName="BreadcrumbItem";const Su=n.forwardRef(({asChild:e,className:t,...r},n)=>a(e?g:"a",{ref:n,className:Fi("transition-colors hover:text-foreground",t),...r}));Su.displayName="BreadcrumbLink";const Au=n.forwardRef(({className:e,...t},r)=>a("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Fi("font-normal text-foreground",e),...t}));Au.displayName="BreadcrumbPage";const Eu=({children:e,className:t,...r})=>a("li",{role:"presentation","aria-hidden":"true",className:Fi("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...r,children:e??a(U,{})});Eu.displayName="BreadcrumbSeparator";const Du=({className:e,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:Fi("flex h-9 w-9 items-center justify-center",e),...r,children:[a(xe,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Mais"})]});Du.displayName="BreadcrumbEllipsis";const Pu=v("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"}}),Iu=n.forwardRef(({className:e,orientation:t,...r},n)=>a("div",{ref:n,className:Fi(Pu({orientation:t}),e),...r}));function Tu({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a(vt,{showOutsideDays:r,className:Fi("p-3 pointer-events-auto",e),locale:ci,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:Fi(Bi({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Fi(Bi({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:Fi(Bi({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})=>a("left"===e?oe:U,{className:"h-4 w-4"})},...n})}Iu.displayName="ButtonGroup",Tu.displayName="Calendar";const Mu={Root:function({children:e,className:t}){return a("div",{className:Fi("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return a(Gi,{className:Fi("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:a(Xi,{className:"p-4",children:e})})},Field:function({label:e,value:r,className:n}){return t("div",{className:Fi("flex justify-between items-center text-sm",n),children:[t("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),a("span",{className:"text-foreground",children:r})]})}};function Ru({date:e,onDateChange:r,placeholder:n,disabled:i=!1,className:o,disabledDates:s}){const{t:l}=Ga(),d=n??l("select_date");return t(xs,{children:[a(ys,{asChild:!0,children:t($i,{variant:"outline",disabled:i,className:Fi("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",o),children:[a(ye,{className:"mr-2 h-4 w-4"}),e?_(e,"d 'de' MMMM 'de' yyyy",{locale:ci}):a("span",{children:d})]})}),a(Ns,{className:"w-auto p-0",align:"start",children:a(Tu,{mode:"single",selected:e,onSelect:r,disabled:s,initialFocus:!0,className:"pointer-events-auto"})})]})}const Lu=({shouldScaleBackground:e=!0,...t})=>a(bt.Root,{shouldScaleBackground:e,...t});Lu.displayName="Drawer";const zu=bt.Trigger,Fu=bt.Portal,Uu=bt.Close,ju=n.forwardRef(({className:e,...t},r)=>a(bt.Overlay,{ref:r,className:Fi("fixed inset-0 z-50 bg-black/80",e),...t}));ju.displayName=bt.Overlay.displayName;const Ou=n.forwardRef(({className:e,children:r,...n},i)=>t(Fu,{children:[a(ju,{}),t(bt.Content,{ref:i,className:Fi("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[a("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),r]})]}));Ou.displayName="DrawerContent";const Bu=({className:e,...t})=>a("div",{className:Fi("grid gap-1.5 p-4 text-center sm:text-left",e),...t});Bu.displayName="DrawerHeader";const $u=({className:e,...t})=>a("div",{className:Fi("mt-auto flex flex-col gap-2 p-4",e),...t});$u.displayName="DrawerFooter";const Vu=n.forwardRef(({className:e,...t},r)=>a(bt.Title,{ref:r,className:Fi("text-lg font-semibold leading-none tracking-tight",e),...t}));Vu.displayName=bt.Title.displayName;const qu=n.forwardRef(({className:e,...t},r)=>a(bt.Description,{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));qu.displayName=bt.Description.displayName;const Wu={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))]"},Hu={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Gu({children:e,cols:t="auto-fit",gap:r="md",className:n}){return a("div",{className:Fi("grid",Wu[t],Hu[r],n),children:e})}const Ku=xt.Root,Yu=xt.Trigger,Qu=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},i)=>a(xt.Content,{ref:i,align:t,sideOffset:r,className:Fi("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),...n}));Qu.displayName=xt.Content.displayName;const Xu=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-slot":"input-group",className:Fi("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}));Xu.displayName="InputGroup";const Ju=v("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"}}),Zu=n.forwardRef(({className:e,align:t,...r},n)=>a("div",{ref:n,"data-slot":"input-group-addon",className:Fi(Ju({align:t}),e),...r}));Zu.displayName="InputGroupAddon";const em=v("",{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"}}),am=n.forwardRef(({className:e,size:t,variant:r="ghost",...n},i)=>a($i,{ref:i,"data-slot":"input-group-button",variant:r,className:Fi(em({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...n}));am.displayName="InputGroupButton";const tm=n.forwardRef(({className:e,...t},r)=>a(qi,{ref:r,"data-slot":"input-group-control",className:Fi("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));tm.displayName="InputGroupInput";const rm=n.forwardRef(({className:e,...t},r)=>a(Ho,{ref:r,"data-slot":"input-group-control",className:Fi("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));rm.displayName="InputGroupTextarea";const nm=n.forwardRef(({className:e,...t},r)=>a("h1",{ref:r,className:Fi("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));nm.displayName="H1";const im=n.forwardRef(({className:e,...t},r)=>a("h2",{ref:r,className:Fi("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));im.displayName="H2";const om=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Fi("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));om.displayName="H3";const sm=n.forwardRef(({className:e,...t},r)=>a("h4",{ref:r,className:Fi("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));sm.displayName="H4";const lm=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Fi("leading-7 [&:not(:first-child)]:mt-6",e),...t}));lm.displayName="P";const dm=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Fi("text-xl text-muted-foreground",e),...t}));dm.displayName="Lead";const cm=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Fi("text-lg font-semibold",e),...t}));cm.displayName="Large";const um=n.forwardRef(({className:e,...t},r)=>a("small",{ref:r,className:Fi("text-sm font-medium leading-none",e),...t}));um.displayName="Small";const mm=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));mm.displayName="Muted";const pm=n.forwardRef(({className:e,...t},r)=>a("code",{ref:r,className:Fi("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));pm.displayName="InlineCode";const hm=n.forwardRef(({className:e,...t},r)=>a("blockquote",{ref:r,className:Fi("mt-6 border-l-2 pl-6 italic",e),...t}));hm.displayName="Blockquote";const fm=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Fi("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));fm.displayName="List";const gm=n.forwardRef(({className:e,children:r,...n},i)=>t(yt.Root,{ref:i,className:Fi("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...n,children:[r,a(_m,{})]}));gm.displayName=yt.Root.displayName;const vm=n.forwardRef(({className:e,...t},r)=>a(yt.List,{ref:r,className:Fi("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));vm.displayName=yt.List.displayName;const bm=yt.Item,xm=v("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"),ym=n.forwardRef(({className:e,children:r,...n},i)=>t(yt.Trigger,{ref:i,className:Fi(xm(),"group",e),...n,children:[r," ",a(D,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));ym.displayName=yt.Trigger.displayName;const Nm=n.forwardRef(({className:e,...t},r)=>a(yt.Content,{ref:r,className:Fi("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}));Nm.displayName=yt.Content.displayName;const wm=yt.Link,_m=n.forwardRef(({className:e,...t},r)=>a("div",{className:Fi("absolute left-0 top-full flex justify-center"),children:a(yt.Viewport,{className:Fi("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})}));_m.displayName=yt.Viewport.displayName;const Cm=n.forwardRef(({className:e,...t},r)=>a(yt.Indicator,{ref:r,className:Fi("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("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));function km({items:e,maxItems:n=3,className:i}){const o=e.length>n?[e[0],...e.slice(-(n-1))]:e,s=e.length>n;return a(_u,{className:i,children:a(Cu,{children:o.map((e,n)=>{const i=s&&1===n;return t(ku,{children:[!(0===n)&&a(Eu,{}),i&&t(r,{children:[a(Du,{}),a(Eu,{})]}),e.isCurrentPage?a(Au,{children:e.label}):a(Su,{asChild:!0,children:a(st,{to:e.href||"/",children:e.label})})]},e.label)})})})}function Sm(){const e=it();return(()=>{const a=e.pathname.split("/").filter(Boolean),t=[{label:"Exemplos",href:"/"}];let r="";return a.forEach((e,n)=>{r+=`/${e}`;const i=n===a.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.push({label:o,href:i?void 0:r,isCurrentPage:i})}),t})()}Cm.displayName=yt.Indicator.displayName;const Am=({className:e,...t})=>a("nav",{role:"navigation","aria-label":"pagination",className:Fi("mx-auto flex w-full justify-center",e),...t});Am.displayName="Pagination";const Em=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Fi("flex flex-row items-center gap-1",e),...t}));Em.displayName="PaginationContent";const Dm=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Fi("",e),...t}));Dm.displayName="PaginationItem";const Pm=({className:e,isActive:t,size:r="icon",...n})=>a("a",{"aria-current":t?"page":void 0,className:Fi(Bi({variant:t?"outline":"ghost",size:r}),e),...n});Pm.displayName="PaginationLink";const Im=({className:r,...n})=>t(Pm,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Fi("gap-1 pl-2.5",r),...n,children:[a(oe,{className:"h-4 w-4"}),a("span",{children:"Previous"})]});Im.displayName="PaginationPrevious";const Tm=({className:r,...n})=>t(Pm,{"aria-label":e.t("go_to_next_page"),size:"default",className:Fi("gap-1 pr-2.5",r),...n,children:[a("span",{children:"Next"}),a(U,{className:"h-4 w-4"})]});Tm.displayName="PaginationNext";const Mm=({className:e,...r})=>t("span",{"aria-hidden":!0,className:Fi("flex h-9 w-9 items-center justify-center",e),...r,children:[a(xe,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"More pages"})]});Mm.displayName="PaginationEllipsis";const Rm=n.forwardRef(({className:e,value:t,...r},n)=>a(Nt.Root,{ref:n,className:Fi("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:a(Nt.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Rm.displayName=Nt.Root.displayName;const Lm=n.forwardRef(({className:e,...t},r)=>a(wt.Root,{className:Fi("grid gap-2",e),...t,ref:r}));Lm.displayName=wt.Root.displayName;const zm=n.forwardRef(({className:e,...t},r)=>a(wt.Item,{ref:r,className:Fi("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(wt.Indicator,{className:"flex items-center justify-center",children:a(j,{className:"h-2.5 w-2.5 fill-current text-current"})})}));zm.displayName=wt.Item.displayName;const Fm=({className:e,...t})=>a(_t.PanelGroup,{className:Fi("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Um=_t.Panel,jm=({withHandle:e,className:t,...r})=>a(_t.PanelResizeHandle,{className:Fi("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("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:a(ae,{className:"h-2.5 w-2.5"})})}),Om=Ra.Root,Bm=Ra.Trigger,$m=Ra.Close,Vm=Ra.Portal,qm=n.forwardRef(({className:e,...t},r)=>a(Ra.Overlay,{className:Fi("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}));qm.displayName=Ra.Overlay.displayName;const Wm=v("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"}}),Hm=n.forwardRef(({side:e="right",className:r,children:n,...i},o)=>t(Vm,{children:[a(qm,{}),t(Ra.Content,{ref:o,className:Fi(Wm({side:e}),r),...i,children:[n,t(Ra.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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]})]}));Hm.displayName=Ra.Content.displayName;const Gm=({className:e,showSeparator:r=!1,children:n,...i})=>t("div",{className:Fi("flex flex-col flex-shrink-0",e),...i,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(Zi,{className:"mt-2"})]});Gm.displayName="SheetHeader";const Km=({className:e,...t})=>a("div",{className:Fi("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});Km.displayName="SheetBody";const Ym=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(Zi,{className:"mb-4"}),a("div",{className:Fi("flex flex-row justify-end gap-2",e),...n,children:r})]});Ym.displayName="SheetFooter";const Qm=n.forwardRef(({className:e,...t},r)=>a(Ra.Title,{ref:r,className:Fi("text-lg font-semibold text-foreground",e),...t}));Qm.displayName=Ra.Title.displayName;const Xm=n.forwardRef(({className:e,...t},r)=>a(Ra.Description,{ref:r,className:Fi("text-sm text-muted-foreground",e),...t}));Xm.displayName=Ra.Description.displayName;const Jm="sidebar:state",Zm=n.createContext(null);function ep(){const e=n.useContext(Zm);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const ap=n.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:i,style:o,children:s,...l},d)=>{const c=Pl(),[u,m]=n.useState(!1),[p,h]=n.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Jm);return null!==a?"true"===a:e}return e}),f=t??p,g=n.useCallback(e=>{const a="function"==typeof e?e(f):e;r?r(a):h(a),"undefined"!=typeof window&&localStorage.setItem(Jm,String(a))},[r,f]),v=n.useCallback(()=>c?m(e=>!e):g(e=>!e),[c,g,m]);n.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v]);const b=f?"expanded":"collapsed",x=n.useMemo(()=>({state:b,open:f,setOpen:g,isMobile:c,openMobile:u,setOpenMobile:m,toggleSidebar:v}),[b,f,g,c,u,m,v]);return a(Zm.Provider,{value:x,children:a(hs,{delayDuration:0,children:a("div",{className:Fi("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",i),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...o},ref:d,...l,children:s})})})});ap.displayName="SidebarProvider";const tp=n.forwardRef(({side:e="left",variant:r="sidebar",collapsible:n="offcanvas",className:i,children:o,...s},l)=>{const{isMobile:d,state:c,openMobile:u,setOpenMobile:m}=ep();return"none"===n?a("div",{className:Fi("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",i),ref:l,...s,children:o}):d?a(Om,{open:u,onOpenChange:m,...s,children:t(Hm,{"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(Qm,{className:"sr-only",children:"Menu de Navegação"}),a("div",{className:"flex h-full w-full flex-col",children:o})]})}):t("div",{ref:l,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?n:"","data-variant":r,"data-side":e,children:[a("div",{className:Fi("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"===r||"inset"===r?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),a("div",{className:Fi("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"===r||"inset"===r?"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",i),...s,children:a("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:o})})]})});tp.displayName="Sidebar";const rp=n.forwardRef(({className:e,onClick:r,...n},i)=>{const{toggleSidebar:o}=ep();return t($i,{ref:i,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Fi("h-7 w-7",e),onClick:e=>{r?.(e),o()},...n,children:[a(Ne,{}),a("span",{className:"sr-only",children:"Toggle Sidebar"})]})});rp.displayName="SidebarTrigger";const np=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=ep();return a("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Fi("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})});np.displayName="SidebarRail";const ip=n.forwardRef(({className:e,...t},r)=>a("main",{ref:r,className:Fi("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}));ip.displayName="SidebarInset";const op=n.forwardRef(({className:e,...t},r)=>a(qi,{ref:r,"data-sidebar":"input",className:Fi("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));op.displayName="SidebarInput";const sp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"header",className:Fi("flex flex-col gap-2 p-2",e),...t}));sp.displayName="SidebarHeader";const lp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"footer",className:Fi("flex flex-col gap-2 p-2",e),...t}));lp.displayName="SidebarFooter";const dp=n.forwardRef(({className:e,...t},r)=>a(Zi,{ref:r,"data-sidebar":"separator",className:Fi("mx-2 w-auto bg-sidebar-border",e),...t}));dp.displayName="SidebarSeparator";const cp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"content",className:Fi("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));cp.displayName="SidebarContent";const up=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group",className:Fi("relative flex w-full min-w-0 flex-col p-2",e),...t}));up.displayName="SidebarGroup";const mp=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?g:"div",{ref:n,"data-sidebar":"group-label",className:Fi("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}));mp.displayName="SidebarGroupLabel";const pp=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?g:"button",{ref:n,"data-sidebar":"group-action",className:Fi("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}));pp.displayName="SidebarGroupAction";const hp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group-content",className:Fi("w-full text-sm",e),...t}));hp.displayName="SidebarGroupContent";const fp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu",className:Fi("flex w-full min-w-0 flex-col gap-1",e),...t}));fp.displayName="SidebarMenu";const gp=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,"data-sidebar":"menu-item",className:Fi("group/menu-item relative",e),...t}));gp.displayName="SidebarMenuItem";const vp=v("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"}}),bp=n.forwardRef(({asChild:e=!1,isActive:r=!1,variant:n="default",size:i="default",tooltip:o,className:s,...l},d)=>{const c=e?g:"button",{isMobile:u,state:m}=ep(),p=a(c,{ref:d,"data-sidebar":"menu-button","data-size":i,"data-active":r,className:Fi(vp({variant:n,size:i}),s),...l});return o?("string"==typeof o&&(o={children:o}),t(fs,{children:[a(gs,{asChild:!0,children:p}),a(vs,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});bp.displayName="SidebarMenuButton";const xp=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},i)=>a(t?g:"button",{ref:i,"data-sidebar":"menu-action",className:Fi("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}));xp.displayName="SidebarMenuAction";const yp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"menu-badge",className:Fi("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}));yp.displayName="SidebarMenuBadge";const Np=n.forwardRef(({className:e,showIcon:r=!1,...i},o)=>{const s=n.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t("div",{ref:o,"data-sidebar":"menu-skeleton",className:Fi("rounded-md h-8 flex gap-2 px-2 items-center",e),...i,children:[r&&a("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});Np.displayName="SidebarMenuSkeleton";const wp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu-sub",className:Fi("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}));wp.displayName="SidebarMenuSub";const _p=n.forwardRef(({...e},t)=>a("li",{ref:t,...e}));_p.displayName="SidebarMenuSubItem";const Cp=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...i},o)=>a(e?g:"a",{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Fi("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),...i}));Cp.displayName="SidebarMenuSubButton";const kp=n.forwardRef(({className:e,value:r,defaultValue:n,...i},o)=>{const s=r||n||[0];return t(Ct.Root,{ref:o,value:r,defaultValue:n,className:Fi("relative flex w-full touch-none select-none items-center",e),...i,children:[a(Ct.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a(Ct.Range,{className:"absolute h-full bg-primary"})}),s.map((e,t)=>a(Ct.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))]})});function Sp({children:e,className:t}){return a("div",{className:Fi("flex flex-col h-full",t),children:a(Id,{className:"flex-1",children:a("div",{className:"space-y-6 p-6",children:e})})})}function Ap({title:e,description:r,actions:n,className:i}){return t("div",{className:Fi("space-y-4",i),children:[t("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t("div",{className:"space-y-1",children:[a("h2",{className:"text-2xl font-bold tracking-tight",children:e}),r&&a("p",{className:"text-muted-foreground text-sm",children:r})]}),n&&a("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a(Zi,{})]})}function Ep({children:e,className:t}){return a("div",{className:Fi("space-y-6",t),children:e})}kp.displayName=Ct.Root.displayName;const Dp=kt.Menu,Pp=kt.Group,Ip=kt.Portal,Tp=kt.Sub,Mp=kt.RadioGroup,Rp=n.forwardRef(({className:e,...t},r)=>a(kt.Root,{ref:r,className:Fi("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));Rp.displayName=kt.Root.displayName;const Lp=n.forwardRef(({className:e,...t},r)=>a(kt.Trigger,{ref:r,className:Fi("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}));Lp.displayName=kt.Trigger.displayName;const zp=n.forwardRef(({className:e,inset:r,children:n,...i},o)=>t(kt.SubTrigger,{ref:o,className:Fi("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",r&&"pl-8",e),...i,children:[n,a(U,{className:"ml-auto h-4 w-4"})]}));zp.displayName=kt.SubTrigger.displayName;const Fp=n.forwardRef(({className:e,...t},r)=>a(kt.SubContent,{ref:r,className:Fi("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}));Fp.displayName=kt.SubContent.displayName;const Up=n.forwardRef(({className:e,align:t="start",alignOffset:r=-4,sideOffset:n=8,...i},o)=>a(kt.Portal,{children:a(kt.Content,{ref:o,align:t,alignOffset:r,sideOffset:n,className:Fi("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),...i})}));Up.displayName=kt.Content.displayName;const jp=n.forwardRef(({className:e,inset:t,...r},n)=>a(kt.Item,{ref:n,className:Fi("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}));jp.displayName=kt.Item.displayName;const Op=n.forwardRef(({className:e,children:r,checked:n,...i},o)=>t(kt.CheckboxItem,{ref:o,className:Fi("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:n,...i,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(kt.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Op.displayName=kt.CheckboxItem.displayName;const Bp=n.forwardRef(({className:e,children:r,...n},i)=>t(kt.RadioItem,{ref:i,className:Fi("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(kt.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));Bp.displayName=kt.RadioItem.displayName;const $p=n.forwardRef(({className:e,inset:t,...r},n)=>a(kt.Label,{ref:n,className:Fi("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));$p.displayName=kt.Label.displayName;const Vp=n.forwardRef(({className:e,...t},r)=>a(kt.Separator,{ref:r,className:Fi("-mx-1 my-1 h-px bg-muted",e),...t}));Vp.displayName=kt.Separator.displayName;const qp=({className:e,...t})=>a("span",{className:Fi("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});qp.displayname="MenubarShortcut";const Wp={light:"",dark:".dark"},Hp=n.createContext(null);function Gp(){const e=n.useContext(Hp);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Kp=n.forwardRef(({id:e,className:r,children:i,config:o,...s},l)=>{const d=n.useId(),c=`chart-${e||d.replace(/:/g,"")}`;return a(Hp.Provider,{value:{config:o},children:t("div",{"data-chart":c,ref:l,className:Fi("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",r),...s,children:[a(Yp,{id:c,config:o}),a(St.ResponsiveContainer,{children:i})]})})});Kp.displayName="Chart";const Yp=({id:e,config:t})=>{const r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?a("style",{dangerouslySetInnerHTML:{__html:Object.entries(Wp).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},Qp=St.Tooltip,Xp=n.forwardRef(({active:e,payload:i,className:o,indicator:s="dot",hideLabel:l=!1,hideIndicator:d=!1,label:c,labelFormatter:u,labelClassName:m,formatter:p,color:h,nameKey:f,labelKey:g},v)=>{const{config:b}=Gp(),x=n.useMemo(()=>{if(l||!i?.length)return null;const[e]=i,t=eh(b,e,`${g||e?.dataKey||e?.name||"value"}`),r=g||"string"!=typeof c?t?.label:b[c]?.label||c;return u?a("div",{className:Fi("font-medium",m),children:u(r,i)}):r?a("div",{className:Fi("font-medium",m),children:r}):null},[c,u,i,l,m,b,g]);if(!e||!i?.length)return null;const y=1===i.length&&"dot"!==s;return t("div",{ref:v,className:Fi("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",o),children:[y?null:x,a("div",{className:"grid gap-1.5",children:i.map((e,n)=>{const i=`${f||e.name||e.dataKey||"value"}`,o=eh(b,e,i),l=h||e.payload?.fill||e.color;return a("div",{className:Fi("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:p&&void 0!==e?.value&&e.name?p(e.value,e.name,e,n,e.payload):t(r,{children:[o?.icon?a(o.icon,{}):!d&&a("div",{className:Fi("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":y&&"dashed"===s}),style:{"--color-bg":l,"--color-border":l}}),t("div",{className:Fi("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[t("div",{className:"grid gap-1.5",children:[y?x:null,a("span",{className:"text-muted-foreground",children:o?.label||e.name})]}),void 0!==e.value&&a("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||n)})})]})});Xp.displayName="ChartTooltip";const Jp=St.Legend,Zp=n.forwardRef(({className:e,hideIcon:r=!1,payload:n,verticalAlign:i="bottom",nameKey:o},s)=>{const{config:l}=Gp();return n?.length?a("div",{ref:s,className:Fi("flex items-center justify-center gap-4","top"===i?"pb-3":"pt-3",e),children:n.map(e=>{const n=`${o||e.dataKey||"value"}`,i=eh(l,e,n);return t("div",{className:Fi("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[i?.icon&&!r?a(i.icon,{}):a("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),i?.label]},e.value)})}):null});function eh(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 n=t;return t in a&&"string"==typeof a[t]?n=a[t]:r&&t in r&&"string"==typeof r[t]&&(n=r[t]),n in e?e[n]:e[t]}Zp.displayName="ChartLegend";const ah=({onClick:e,isActive:t,disabled:r,children:n,title:i})=>a("button",{type:"button",onClick:e,disabled:r,title:i,className:Fi("p-1.5 rounded hover:bg-muted transition-colors",t?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:n}),th=()=>a("div",{className:"w-px h-5 bg-border mx-1"}),rh=({value:r,onChange:i,disabled:s,placeholder:d=e.t("write_content_here"),minHeight:c="300px",showModeToggle:u=!0,showVariableHint:m=!0,className:p})=>{const{t:h}=Ga(),[f,g]=o("visual"),v=Vt({extensions:[Wt.configure({heading:{levels:[1,2,3]}}),Ht,Gt.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Kt,Yt,Qt.configure({multicolor:!0})],content:r||"",editable:!s,onUpdate:({editor:e})=>{i(e.getHTML())}});n.useEffect(()=>{v&&r!==v.getHTML()&&v.commands.setContent(r||"")},[r,v]);const b=l(()=>{if(!v)return;const e=v.getAttributes("link").href,a=window.prompt("URL",e);null!==a&&(""!==a?v.chain().focus().extendMarkRange("link").setLink({href:a}).run():v.chain().focus().extendMarkRange("link").unsetLink().run())},[v]);return v?t("div",{className:Fi("space-y-2",p),children:[u&&t("div",{className:"flex justify-between items-center",children:[t("div",{className:"flex gap-1",children:[t($i,{type:"button",size:"sm",variant:"visual"===f?"default":"outline",onClick:()=>g("visual"),disabled:s,children:[a(we,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t($i,{type:"button",size:"sm",variant:"code"===f?"default":"outline",onClick:()=>g("code"),disabled:s,children:[a(_e,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t($i,{type:"button",size:"sm",variant:"preview"===f?"default":"outline",onClick:()=>g("preview"),disabled:s,children:[a(Ce,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),m&&t("p",{className:"text-xs text-muted-foreground",children:["Use ",a("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===f&&t("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||v?.commands.focus()},children:[t("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[a(ah,{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),isActive:v.isActive("heading",{level:1}),disabled:s,title:e.t("heading_1"),children:a(ke,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),isActive:v.isActive("heading",{level:2}),disabled:s,title:e.t("heading_2"),children:a(Se,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),isActive:v.isActive("heading",{level:3}),disabled:s,title:e.t("heading_3"),children:a(Ae,{className:"h-4 w-4"})}),a(th,{}),a(ah,{onClick:()=>v.chain().focus().toggleBold().run(),isActive:v.isActive("bold"),disabled:s,title:e.t("bold"),children:a(Ee,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleItalic().run(),isActive:v.isActive("italic"),disabled:s,title:e.t("italic"),children:a(De,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleUnderline().run(),isActive:v.isActive("underline"),disabled:s,title:"Sublinhado",children:a(Pe,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleStrike().run(),isActive:v.isActive("strike"),disabled:s,title:"Riscado",children:a(Ie,{className:"h-4 w-4"})}),a(th,{}),a(ah,{onClick:()=>v.chain().focus().toggleBulletList().run(),isActive:v.isActive("bulletList"),disabled:s,title:"Lista",children:a(J,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().toggleOrderedList().run(),isActive:v.isActive("orderedList"),disabled:s,title:h("ordered_list"),children:a(Te,{className:"h-4 w-4"})}),a(th,{}),a(ah,{onClick:()=>v.chain().focus().toggleHighlight().run(),isActive:v.isActive("highlight"),disabled:s,title:"Destacar",children:a(Me,{className:"h-4 w-4"})}),a(ah,{onClick:b,isActive:v.isActive("link"),disabled:s,title:"Link",children:a(Re,{className:"h-4 w-4"})}),a(th,{}),a(ah,{onClick:()=>v.chain().focus().unsetAllMarks().clearNodes().run(),disabled:s,title:h("clear_formatting"),children:a(Le,{className:"h-4 w-4"})}),a(th,{}),a(ah,{onClick:()=>v.chain().focus().undo().run(),disabled:s||!v.can().undo(),title:"Desfazer",children:a(ze,{className:"h-4 w-4"})}),a(ah,{onClick:()=>v.chain().focus().redo().run(),disabled:s||!v.can().redo(),title:"Refazer",children:a(Fe,{className:"h-4 w-4"})})]}),a(qt,{editor:v,className:Fi("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:c}})]}),"code"===f&&a("textarea",{value:r||"",onChange:e=>i(e.target.value),disabled:s,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:c},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===f&&a("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:c},children:a("div",{className:"bg-background shadow-sm rounded border p-4",children:a("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${d}</p>`}})})})]}):null};function nh({image:e,title:t,className:r}){return a("div",{className:Fi("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?a("img",{src:e,alt:t,className:"w-full h-full object-cover"}):a("div",{className:"flex items-center justify-center h-full",children:a(Ue,{className:"w-16 h-16 text-muted-foreground"})})})}function ih({steps:e,currentStepIndex:r,onStepSelect:n,stepLabel:i,className:o}){const{t:s}=Ga(),l=e.length,d=(r+1)/l*100;return t("div",{className:Fi("flex items-center gap-3",o),children:[t(Zo,{children:[a(es,{asChild:!0,children:t($i,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[i," ",r+1,"/",l,a(D,{className:"h-3 w-3 ml-1"})]})}),a(ss,{align:"start",children:e.map((e,a)=>t(ls,{onClick:()=>n(a),className:Fi(a===r&&"bg-accent"),children:[a+1,". ",e.title]},e.id))})]}),a(Rm,{value:d,className:"w-32 h-2"})]})}function oh({currentStepIndex:e,totalSteps:r,onBack:n,onNext:i,onComplete:o,backButtonText:s,continueButtonText:l,finishButtonText:d,className:c}){const{t:u}=Ga(),m=0===e,p=e===r-1;return t("div",{className:Fi("flex items-center gap-2",c),children:[!m&&t($i,{variant:"outline",onClick:n,size:"sm",children:[a(je,{className:"h-4 w-4 mr-2"}),s]}),t($i,{onClick:p?o:i,size:"sm",children:[p?d:l,!p&&a(Oe,{className:"h-4 w-4 ml-2"})]})]})}const sh=n.forwardRef(({open:r,onOpenChange:i,steps:o,onComplete:s,onStepChange:l,continueButtonText:d="Continuar",backButtonText:c="Voltar",finishButtonText:u="Concluir",stepLabel:m=e.t("approval_step_label"),size:p="md",showProgressIndicator:h=!0,currentStepIndex:f,onCurrentStepChange:g,className:v},b)=>{const[x,y]=n.useState(0),N=void 0!==f,w=N?f:x,_=n.useCallback(e=>{N?g?.(e):y(e),l?.(e)},[N,g,l]);n.useEffect(()=>{r||N||y(0)},[r,N]);const C=o[w],k=o.length;return C?a(mo,{open:r,onOpenChange:i,children:t(bo,{ref:b,size:p,variant:"informative",className:Fi("p-0 gap-0 overflow-hidden",v),children:[t(fo,{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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Fechar"})]}),a("div",{className:"flex-1 min-h-0 overflow-auto",children:t("div",{className:"p-6 space-y-4",children:[a(nh,{image:C.image,title:C.title}),a(wo,{className:"text-xl font-semibold",children:C.title}),a(_o,{className:"text-muted-foreground",children:C.description})]})}),t("div",{className:"flex-shrink-0",children:[a(Zi,{}),t("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[h&&k>1?a(ih,{steps:o,currentStepIndex:w,onStepSelect:e=>{_(e)},stepLabel:m}):a("div",{}),a(oh,{currentStepIndex:w,totalSteps:k,onBack:()=>{w>0&&_(w-1)},onNext:()=>{w<k-1&&_(w+1)},onComplete:()=>{s?.(),i(!1)},backButtonText:c,continueButtonText:d,finishButtonText:u})]})]})]})}):null});function lh({label:e,onClick:r,icon:n,actions:i=[],variant:o="default",size:s="default",disabled:l=!1,loading:d=!1,menuAlign:c="end",className:u}){const{t:m}=Ga(),p=l||d;if(!(i.length>0))return t($i,{variant:o,size:s,disabled:p,onClick:r,className:u,children:[d?a(T,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]});return t("div",{className:Fi("inline-flex rounded-md shadow-sm",u),children:[t($i,{variant:o,size:s,disabled:p,onClick:r,className:"rounded-r-none border-r-0 focus:z-10",children:[d?a(T,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]}),t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:o,size:s,disabled:p,className:Fi("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"}[s]),"aria-label":m("more_options"),children:a(D,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[s]})})}),a(ss,{align:c,className:"min-w-[160px]",children:i.map(e=>{const r=e.icon;return t(ls,{onClick:e.onClick,disabled:e.disabled,className:Fi("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}var dh,ch;sh.displayName="OnboardingDialog",(ch=dh||(dh={})).CSV="csv",ch.PDF="pdf",ch.XLSX="xlsx",ch.PNG="png",ch.JPEG="jpeg",ch.SVG="svg";const uh=[{value:dh.CSV,label:"CSV",icon:a(Be,{className:"h-5 w-5"})},{value:dh.PDF,label:"PDF",icon:a(Be,{className:"h-5 w-5"})},{value:dh.XLSX,label:"XLSX",icon:a($e,{className:"h-5 w-5"})}],mh=[{value:dh.PNG,label:"PNG",icon:a(Ve,{className:"h-5 w-5"})},{value:dh.JPEG,label:"JPEG",icon:a(qe,{className:"h-5 w-5"})},{value:dh.SVG,label:"SVG",icon:a(qe,{className:"h-5 w-5"})},{value:dh.PDF,label:"PDF",icon:a(Be,{className:"h-5 w-5"})}];function ph({open:e,onOpenChange:r,onExport:n,mode:i="table",options:s,title:l,description:d,cancelLabel:c="Cancelar",exportLabel:u="Exportar"}){const{t:m}=Ga(),[p,h]=o(""),f=s??("chart"===i?mh:uh),g=l??m("chart"===i?"dashboard_export_chart":"dashboard_export_table"),v=d??m("select_file_format"),b=e=>{e||h(""),r(e)};return a(mo,{open:e,onOpenChange:b,children:t(bo,{className:"sm:max-w-md",variant:"form",isDirty:!!p,children:[a(xo,{children:a(wo,{children:g})}),t("div",{className:"py-4",children:[a("p",{className:"text-sm text-muted-foreground mb-4",children:v}),a(Lm,{value:p,onValueChange:h,className:"gap-3",children:f.map(e=>t("div",{className:"flex items-center space-x-3",children:[a(zm,{value:e.value,id:`export-${e.value}`}),t(Hi,{htmlFor:`export-${e.value}`,className:Fi("flex items-center gap-2 cursor-pointer font-normal",p===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t(No,{children:[a($i,{variant:"outline",onClick:()=>b(!1),children:c}),a($i,{onClick:()=>{p&&(n(p),r(!1),h(""))},disabled:!p,children:u})]})]})})}const hh=f(({value:e,onChange:r,onTimeChange:i,label:o,error:s,format:d="24h",className:c,id:u,...m},p)=>{const h=u??n.useId(),f=l(e=>{const a=e.target.value;r?.(a),i?.(a)},[r,i]),g=l(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t("div",{className:Fi("grid gap-1.5",c),children:[o&&a(Hi,{htmlFor:h,children:o}),t("div",{className:"relative",children:[a(qi,{ref:p,id:h,type:"time",value:e??"",onChange:f,onKeyDown:g,min:"00:00",max:"23:59",step:60,className:Fi("pr-9",s&&"border-destructive focus-visible:ring-destructive"),...m}),a(We,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),s&&a("p",{className:"text-sm text-destructive",children:s})]})});function fh({open:r,onOpenChange:n,onConfirm:i,onGenerateCode:s,mode:d="code",email:c,maxLength:u=8,title:m=e.t("electronic_signature"),description:p,confirmLabel:h=e.t("conclude"),cancelLabel:f=e.t("cancel"),resendLabel:g=e.t("resend_code"),errorMessage:v}){const b="password"===d,x=b?e.t("esign_password_description"):e.t("esign_code_description"),y=p??x,[N,w]=o(""),[_,C]=o(!1),[k,S]=o(!1),[A,E]=o(null),D=l(async()=>{if(N.trim()){C(!0),E(null);try{await i(N)?(w(""),n(!1)):E(v??(b?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{E(v??(b?e.t("esign_password_error"):e.t("esign_code_error")))}finally{C(!1)}}},[N,i,n,v,b]),P=l(async()=>{if(s){S(!0),E(null);try{await s()}catch{E(e.t("esign_resend_error"))}finally{S(!1)}}},[s]),I=e=>{e||(w(""),E(null)),n(e)},T=b?He:Ge,M=b?"Senha":e.t("verification_code"),R=b?e.t("enter_password"):e.t("enter_code");return a(mo,{open:r,onOpenChange:I,children:t(bo,{className:"sm:max-w-md",variant:"form",isDirty:!!N,children:[a(xo,{children:t(wo,{className:"flex items-center gap-2",children:[a(T,{className:"h-5 w-5 text-primary"}),m]})}),t("div",{className:"py-4 space-y-4",children:[a("p",{className:"text-sm text-muted-foreground",children:y}),!b&&c&&t("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[a(Ke,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-muted-foreground",children:"Enviado para:"}),a("span",{className:"font-medium",children:c})]}),t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"signature-input",children:M}),a(qi,{id:"signature-input",type:b?"password":"text",value:N,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&N.trim()&&(e.preventDefault(),D())},maxLength:b?void 0:u,placeholder:R,autoFocus:!0,className:Fi(A&&"border-destructive focus-visible:ring-destructive")}),A&&a("p",{className:"text-sm text-destructive",children:A})]}),!b&&t($i,{variant:"ghost",size:"sm",onClick:P,disabled:k,className:"text-primary",children:[a(ue,{className:Fi("h-4 w-4 mr-1",k&&"animate-spin")}),g]})]}),t(No,{children:[a($i,{variant:"outline",onClick:()=>I(!1),disabled:_,children:f}),a($i,{onClick:D,disabled:!N.trim()||_,children:_?"Validando...":h})]})]})})}function gh({currentStep:e,totalSteps:r,onStepChange:i,stepLabels:o,canGoToStep:s,className:l,progressWidth:d="w-32"}){n.useEffect(()=>{process.env.NODE_ENV},[]);const c=Array.from({length:r},(e,a)=>a+1),u=a=>!(a<=e)&&(!!s&&!s(a));return t("div",{className:Fi("flex items-center gap-3",l),children:[t(Zo,{children:[a(es,{asChild:!0,children:t($i,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",r,a(D,{className:"h-3 w-3 ml-1"})]})}),a(ss,{align:"start",children:c.map(r=>t(ls,{onClick:()=>{var a;(a=r)<e?i(a):s&&!s(a)||i(a)},disabled:u(r),className:Fi("cursor-pointer",r===e&&"bg-muted font-medium",u(r)&&"opacity-50 cursor-not-allowed"),children:[t("span",{className:"mr-2 text-muted-foreground",children:[r,"."]}),o?.[r-1]||`Etapa ${r}`,r===e&&a(I,{className:"h-4 w-4 ml-auto"})]},r))})]}),a(Rm,{value:e/r*100,className:Fi("h-2",d)})]})}function vh({open:r,onOpenChange:n,currentStep:i,onStepChange:o,steps:s,canGoToStep:l,children:d,title:c,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:f=e.t("back"),variant:g="form",isDirty:v,size:b="lg",unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:N,leaveWithoutSavingText:w,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=Ga(),E=s.length,D=i>=E,P=i<=1;return a(mo,{open:r,onOpenChange:n,children:t(bo,{size:b,variant:g,isDirty:v,unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:N,leaveWithoutSavingText:w,className:Fi("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[a("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),a("nav",{className:"flex flex-col gap-1 flex-1",children:s.map((e,r)=>{const n=r+1,s=n===i,d=(e=>e<i)(n),c=(u=n)<=i||!l||l(u);var u;return t("button",{type:"button",onClick:()=>(e=>{e!==i&&(e<i?o(e):l&&!l(e)||o(e))})(n),disabled:!c,className:Fi("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",s&&"bg-primary-foreground/20 font-semibold",!s&&c&&"hover:bg-primary-foreground/10 cursor-pointer",!c&&"opacity-40 cursor-not-allowed"),children:[a("span",{className:Fi("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",s&&"bg-primary-foreground text-primary",d&&!s&&"bg-primary-foreground/30 text-primary-foreground",!s&&!d&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:d&&!s?a(I,{className:"h-3.5 w-3.5"}):n}),a("span",{className:Fi("line-clamp-2",s&&"text-primary-foreground",!s&&"text-primary-foreground/70"),children:e})]},n)})})]}),t("div",{className:"flex flex-col flex-1 min-w-0",children:[t(xo,{className:"p-6 pb-0",children:[t("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",i," de ",E]}),a(wo,{children:c}),u&&a("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a(yo,{className:"px-6",children:d}),!k&&a(No,{className:"px-6 pb-6",children:t("div",{className:"flex items-center justify-between w-full",children:[a("div",{className:"flex items-center gap-2",children:S}),t("div",{className:"flex items-center gap-2",children:[!P&&a($i,{variant:"outline",onClick:()=>o(i-1),children:f}),a($i,D?{onClick:m,disabled:C,children:p}:{onClick:()=>o(i+1),disabled:C,children:h})]})]})})]})]})})}function bh(e){const a=Qs.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 xh(e,a,t){let r=await fetch(e,a);if(401===r.status){if(await ll.handleApiError({status:401})){const n={...a,headers:bh(t)};r=await fetch(e,n)}}return r}function yh(e){const[a,t]=o([]),[r,n]=o(0),[i,s]=o(!1);m(()=>{if(!e)return;let a=!1;const r=`${xr().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){s(!0);try{const i=bh(e),o=await xh(r,{method:"GET",headers:i},e);if(!o.ok)return;const s=await o.json();!a&&s.data?.[0]&&(t(s.data[0].updates??[]),n(s.data[0].valueBadge??0))}catch(i){}finally{a||s(!1)}}(),()=>{a=!0}},[e]);const d=l(async()=>{if(!e||r<=0||0===a.length)return;const t=a[0].id,i=`${xr().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=bh(e),r=JSON.stringify({id:t,idUpdateType:3});await xh(i,{method:"POST",headers:a,body:r},e)}catch(o){}},[e,r,a]);return{updates:a,badgeCount:r,loading:i,markAsVisualized:d}}hh.displayName="Timepicker";const Nh=i.forwardRef(({updates:r,badgeCount:n,onOpen:i,onViewAll:o},s)=>{const l=void 0===r,d=Sl(),c=d?.alias??null,u=yh(l?c:null),m=l?u.updates??[]:r,p=l?u.badgeCount??0:n??0,h=i??(l?u.markAsVisualized:void 0),f=o??(l&&c?()=>{const e=`https://apps4.qualiex.com/common/${c}/up/view`;window.open(e,"_blank","noopener,noreferrer")}:void 0);return t(xs,{children:[a(ys,{asChild:!0,children:t($i,{ref:s,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(Ye,{className:"h-7 w-7"}),p>0&&a("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})]})}),t(Ns,{align:"end",className:"w-80 p-0",children:[a("div",{className:"border-b border-border px-4 py-3",children:a("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),a("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?a("ul",{className:"divide-y divide-border",children:m.map(e=>t("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:f,children:[a("p",{className:"text-sm font-medium text-foreground",children:e.title}),a("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[a(Ye,{className:"h-8 w-8 text-muted-foreground mb-2"}),a("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),a("div",{className:"border-t border-border px-4 py-2",children:t($i,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:f,children:["Ver todas as atualizações",a(Oe,{className:"h-[18px] w-[18px]"})]})})]})]})});var wh,_h,Ch,kh;Nh.displayName="UpdatesNotification",(_h=wh||(wh={}))[_h.none=0]="none",_h[_h.image=1]="image",_h[_h.video=2]="video",_h[_h.audio=3]="audio",_h[_h.wopi=4]="wopi",_h[_h.onlineEditor=5]="onlineEditor",_h[_h.report=6]="report",(kh=Ch||(Ch={}))[kh.SimplePrint=0]="SimplePrint",kh[kh.ManagedCopy=1]="ManagedCopy",kh[kh.NonManagedCopy=2]="NonManagedCopy";const Sh={".jpg":wh.image,".jpeg":wh.image,".png":wh.image,".bmp":wh.image,".gif":wh.image,".svg":wh.image,".webp":wh.image,".wav":wh.audio,".mp3":wh.audio,".mp4":wh.video,".webm":wh.video,".ogg":wh.video,".pdf":wh.wopi,".ods":wh.wopi,".xls":wh.wopi,".xlsb":wh.wopi,".xlsm":wh.wopi,".xlsx":wh.wopi,".doc":wh.wopi,".docm":wh.wopi,".docx":wh.wopi,".dot":wh.wopi,".dotm":wh.wopi,".dotx":wh.wopi,".odt":wh.wopi,".odp":wh.wopi,".pot":wh.wopi,".potm":wh.wopi,".potx":wh.wopi,".pps":wh.wopi,".ppsm":wh.wopi,".ppsx":wh.wopi,".ppt":wh.wopi,".pptm":wh.wopi,".pptx":wh.wopi,".gdocs":wh.onlineEditor,".gsheets":wh.onlineEditor};function Ah(e){const{t:a}=Ga();return e?Sh[e.toLowerCase()]??wh.none:wh.none}function Eh(e){const{t:a}=Ga();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"}const Dh={".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 Ph(e){const{t:a}=Ga();return Dh[e?.toLowerCase()]||""}function Ih(e){const{t:a}=Ga(),{viewerUrl:t,wopiUrl:r,fileId:n,token:i,extension:o,language:s="pt-br"}=e,l=Ph(o);if(!l)return null;return`${t}${l}ui=${s}&rs=${s}&access_token=${i}&WOPISrc=${encodeURIComponent(`${r}${n}`)}`}function Th({open:e,onOpenChange:n,template:i,viewerType:o,isLoading:s=!1,enableDownload:d=!0,onDownload:c,isDownloading:p=!1,enableFavorite:h=!1,isFavorite:f=!1,onFavorite:g,isFavoriting:v=!1,enableConfirmReading:b=!1,readingConfirmationDate:x,onConfirmReading:y,isConfirmingReading:N=!1,readingConfirmationTimeRemaining:w,onIframeLoad:_,className:C}){const{t:k}=Ga(),S=u(null),A=o??Ah(i.extension),D=p||N||v,P=i.code?`${i.code} – ${i.name}`:i.name,I=l(()=>{S.current&&_&&_(S.current)},[_]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&n(!1)};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,n]),a(mo,{open:e,onOpenChange:n,children:t(bo,{className:Fi("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(A===wh.wopi||A===wh.report)&&"w-[90vw]",C),children:[t("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[a("h2",s?{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}:{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:P}),t("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!s&&t(r,{children:[(b||x)&&a(r,{children:x?t("div",{className:"flex flex-col mr-2.5",children:[t("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[a(Qe,{className:"h-4 w-4"}),"Leitura confirmada"]}),a("span",{className:"text-xs text-muted-foreground ml-5",children:x.toLocaleDateString()})]}):null!=w&&w>0?t("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[a("span",{children:k("terms_confirmation_available")}),a("span",{className:"font-medium min-w-[72px]",children:Mh(w)}),a("span",{children:"segundos"})]}):t($i,{variant:"default",size:"sm",disabled:D,onClick:()=>y?.(),className:"mr-2.5",children:[a(Ge,{className:"h-4 w-4 mr-1"}),N?"Confirmando...":k("terms_confirm_reading")]})}),A!==wh.none&&h&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>g?.(f),children:a(Xe,{className:Fi("h-4 w-4",f&&"fill-accent text-accent")})})}),a(vs,{children:f?"Desfavoritar":"Favoritar"})]}),A!==wh.none&&d&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>c?.(),children:a(Je,{className:"h-4 w-4"})})}),a(vs,{children:"Download"})]})]}),t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>n(!1),children:a(E,{className:"h-4 w-4"})})}),a(vs,{children:"Fechar"})]})]})]}),a("div",{className:Fi("flex flex-col items-center justify-center min-h-[160px] w-full",s&&"relative -top-5",A===wh.none&&"min-h-[124px]",A===wh.image&&"max-h-[85vh]",(A===wh.wopi||A===wh.report)&&"min-w-[77vw] min-h-[80vh]"),children:s?a(Qo,{className:"h-14 w-14"}):t(r,{children:[(A===wh.none||!i.url)&&t("div",{className:"text-center",children:[a("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),a("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),A===wh.image&&a("img",{loading:"eager",src:i.url,alt:i.name,className:"max-w-full max-h-[85vh] object-contain"}),A===wh.video&&a("video",{controls:!0,autoPlay:!0,src:i.url,className:"w-full h-full"}),A===wh.audio&&a("audio",{controls:!0,autoPlay:!0,src:i.url}),(A===wh.wopi||A===wh.report)&&t("div",{className:"relative w-full h-[79.5vh]",children:[a(Qo,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a("iframe",{ref:S,src:i.url,onLoad:I,className:"border-none w-full h-full z-[1] relative",title:i.name})]})]})}),!s&&A===wh.none&&t("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a($i,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),d&&a($i,{variant:"default",onClick:()=>c?.(),children:"Download"})]})]})})}function Mh(e){const{t:a}=Ga(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function Rh({open:e,onOpenChange:r,identifier:n,fileName:i,mode:s="edit",type:d="document",onClose:c,className:u}){const[p,h]=o(!0),f=function(e,a="edit",t="document"){return`https://docs.google.com/${t}/d/${e}/${a}?usp=drivesdk?embedded=true&rm=demo`}(n,s,d);m(()=>{if(e){h(!0);const e=setTimeout(()=>h(!1),300);return()=>clearTimeout(e)}},[e]);const g=l(()=>{c?.(),r(!1)},[c,r]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&g()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,g]),a(mo,{open:e,onOpenChange:r,children:t(bo,{className:Fi("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",u),children:[t("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[a("h2",p?{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}:{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:i}),a("div",{className:"flex items-center ml-4 z-20",children:t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,children:a(E,{className:"h-4 w-4"})})}),a(vs,{children:"Fechar"})]})})]}),a("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:p?a(Qo,{className:"h-14 w-14"}):t("div",{className:"relative w-full h-[79.5vh]",children:[a(Qo,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a("iframe",{src:f,className:"border-none w-full h-full z-[1] relative",title:i})]})})]})})}function Lh({open:e,onOpenChange:r,url:n,title:i,className:o,minHeight:s="250px"}){const{t:d}=Ga(),c=l(()=>{r(!1)},[r]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&c()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,c]),a(mo,{open:e,onOpenChange:r,children:t(bo,{className:Fi("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[t("div",{className:"flex items-center justify-end mb-2.5",children:[i&&a("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:i}),t(fs,{children:[a(gs,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a(E,{className:"h-4 w-4"})})}),a(vs,{children:"Fechar"})]})]}),a("iframe",{src:n,className:"border-none w-full",style:{minHeight:s},title:i||d("embedded_content")})]})})}function zh({term:n,open:i,onClose:s,onAgree:d,title:c=e.t("terms_updated"),seeLaterLabel:u=e.t("terms_see_later"),agreeLabel:m=e.t("terms_read_agree"),viewTermLabel:p=e.t("terms_view")}){const[h,f]=o(!1),g=l(()=>{d(n.id)},[d,n.id]);return t(r,{children:[a(mo,{open:i&&!h,onOpenChange:e=>!e&&s(),children:t(bo,{className:"sm:max-w-md",children:[a(xo,{children:t(wo,{className:"flex items-center gap-2",children:[a(Ge,{className:"h-5 w-5 text-primary"}),c]})}),t("div",{className:"space-y-4",children:[n.description&&a(Id,{className:"max-h-48",children:a("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:n.description}})}),n.file&&t($i,{variant:"link",className:"px-0 text-primary",onClick:()=>f(!0),children:[a(pe,{className:"mr-1 h-4 w-4"}),p]})]}),t(No,{className:"gap-2 sm:gap-0",children:[a($i,{variant:"ghost",onClick:s,children:u}),a($i,{onClick:g,children:m})]})]})}),h&&a(Fh,{term:n,open:h,onClose:()=>f(!1),viewOnly:!0})]})}function Fh({term:r,open:n,onClose:i,onSign:o,viewOnly:d=!1,title:c=e.t("terms_of_use"),signLabel:u=e.t("terms_read_agree")}){const m=s(()=>r.file?function(e,a=""){const{t:t}=Ga(),r=atob(e),n=[];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);n.push(new Uint8Array(a))}const i=new Blob(n,{type:a});return URL.createObjectURL(i)}(r.file,r.type):null,[r.file,r.type]),p=l(()=>{m&&URL.revokeObjectURL(m),i()},[m,i]),h=l(()=>{r.hasUserSignature?p():o?.(r.id)},[r,o,p]),f=!d&&!r.hasUserSignature&&o;return a(mo,{open:n,onOpenChange:e=>!e&&p(),children:t(bo,{className:Fi("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[a(Be,{className:"h-5 w-5 text-primary"}),c]}),t("div",{className:"flex items-center gap-2",children:[f&&a($i,{size:"sm",onClick:h,children:u}),a($i,{variant:"ghost",size:"icon",onClick:p,children:a(E,{className:"h-4 w-4"})})]})]}),a("div",{className:"flex-1 min-h-0",children:r.file&&m?a("iframe",{className:"h-full w-full border-0",src:m,title:c}):a("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function Uh(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function jh({users:r,groups:n=[],value:i,onChange:d,disabled:c=!1,maxHeight:u=350,hideGroupFilter:m=!1,searchPlaceholder:p="Buscar usuário...",selectLabel:h="Selecionar",doneLabel:f="Concluir",allLabel:g="Todos",emptyLabel:v=e.t("leadership_no_user_selected"),selectedLabel:b="selecionado",selectedPluralLabel:x="selecionados",className:y}){const[N,w]=o(!1),[_,C]=o(""),[k,S]=o(void 0),A=s(()=>new Set(i),[i]),E=s(()=>{let e=r;if(k&&(e=e.filter(e=>e.groupIds?.includes(k))),_){const a=Uh(_);e=e.filter(e=>Uh(e.name).includes(a)||Uh(e.email??"").includes(a))}return e},[r,k,_]),D=s(()=>N?E:r.filter(e=>A.has(e.id)),[N,E,r,A]),P=i.length,I=s(()=>E.length>0&&E.every(e=>A.has(e.id)),[E,A]),T=l(e=>{if(c)return;const a=A.has(e)?i.filter(a=>a!==e):[...i,e];d(a)},[i,A,d,c]),M=l(e=>{if(c)return;const a=new Set(E.map(e=>e.id));if(e){const e=new Set([...i,...a]);d(Array.from(e))}else d(i.filter(e=>!a.has(e)))},[i,E,d,c]),R=l(()=>{w(e=>!e),C(""),S(void 0)},[]);return t("div",{className:Fi("rounded-md border bg-muted/30",y),children:[(!c||P>0)&&t("div",{className:Fi("flex items-center justify-between px-4 py-2",!c&&"cursor-pointer hover:bg-muted/50"),onClick:c?void 0:R,children:[a("span",{className:"text-sm font-medium text-primary uppercase",children:!c&&(N?f:h)}),a("span",{className:"text-xs text-muted-foreground",children:P>0&&`${P} ${1===P?b:x}`})]}),t("div",{className:"px-4 pb-3",children:[N&&t("div",{className:"flex gap-3 mb-3",children:[!m&&n.length>0&&t(Lo,{value:k??"__all__",onValueChange:e=>S("__all__"===e?void 0:e),children:[a(Uo,{className:"w-[200px] h-9 text-sm",children:a(Fo,{placeholder:e.t("approval_user_group")})}),t(Bo,{children:[a(Vo,{value:"__all__",children:e.t("team_all_groups")}),n.map(e=>a(Vo,{value:e.id,children:e.name},e.id))]})]}),t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{className:"pl-8 h-9 text-sm",placeholder:p,value:_,onChange:e=>C(e.target.value)})]})]}),!N&&0===P&&t("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a(Ze,{className:"h-4 w-4 mr-2"}),v]}),N&&E.length>0&&t("div",{className:"flex items-center gap-2 mb-2",children:[a(Wo,{checked:I,onCheckedChange:e=>M(!!e)}),a("span",{className:"text-sm",children:g})]}),D.length>0&&a(Id,{style:{maxHeight:u},className:"pr-2",children:a("div",{className:"space-y-0.5",children:D.map(e=>{return t("div",{className:Fi("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",N&&!c&&"cursor-pointer hover:bg-accent/50"),onClick:N?()=>T(e.id):void 0,children:[N&&a(Wo,{checked:A.has(e.id),onCheckedChange:()=>T(e.id),onClick:e=>e.stopPropagation()}),t(yu,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(Nu,{src:e.avatar,alt:e.name}),a(wu,{className:"text-xs",children:(r=e.name,r.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t("div",{className:"flex flex-col min-w-0",children:[a("span",{className:"font-normal truncate",children:e.name}),e.email&&a("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var r})})}),N&&0===E.length&&a("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})}function Oh(e){const{t:a}=Ga();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Bh(e){const{t:a}=Ga(),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}function $h({items:r,categories:n,value:i,onChange:d,readonly:c=!1,isLoading:u=!1,title:m=e.t("permissions"),addButtonLabel:p=e.t("allow"),chipsTitle:h=e.t("allowed_items"),chipsPlaceholder:f=e.t("no_item_selected"),searchPlaceholder:g=e.t("search_placeholder"),selectPlaceholder:v=e.t("select_items_to_add"),itemInfoTemplate:b=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:x,disclaimerLink:y,onDisclaimerClick:N,className:w}){const[_,C]=o(n[0]?.id??""),[k,S]=o(""),[A,P]=o([]),[T,M]=o(!1),R=s(()=>Bh(i[_]),[i,_]),L=s(()=>function(e){const{t:a}=Ga(),t=new Set;if(!e)return t;for(const r of e)r.inheritedIds?.forEach(e=>t.add(e));return t}(i[_]),[i,_]),z=s(()=>r.filter(e=>R.has(e.id)),[r,R]),F=s(()=>{const e=Oh(k);return r.filter(a=>!R.has(a.id)&&!(e&&!Oh(a.name).includes(e)))},[r,R,k]),U=s(()=>{const e={};for(const a of n)e[a.id]=Bh(i[a.id]).size;return e},[n,i]),j=l(e=>{C(e),P([]),S("")},[]),O=l(e=>{P(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),$=l(()=>{if(0===A.length)return;const e=[...i[_]??[]];for(const a of A){const t=r.find(e=>e.id===a),n=t?.group??"default",i=e.find(e=>e.context===n);i?i.allowedIds.includes(a)||(i.allowedIds=[...i.allowedIds,a]):e.push({context:n,allowedIds:[a],inheritedIds:[]})}d({...i,[_]:e}),P([]),S(""),M(!1)},[A,i,_,r,d]),V=l(e=>{if(L.has(e))return;const a=(i[_]??[]).map(a=>({...a,allowedIds:a.allowedIds.filter(a=>a!==e)}));d({...i,[_]:a})},[i,_,L,d]);return u?t("div",{className:Fi("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[a("div",{className:"h-4 w-32 bg-muted rounded"}),a("div",{className:"h-9 w-full bg-muted rounded"}),a("div",{className:"h-20 w-full bg-muted rounded"})]}):a("div",{className:Fi("rounded-md border bg-muted/30",w),children:t("div",{className:"p-4 space-y-4",children:[t("div",{className:"space-y-2",children:[a("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:m}),t(Lo,{value:_,onValueChange:j,children:[a(Uo,{className:"h-9 text-sm",children:a(Fo,{})}),a(Bo,{children:n.map(e=>a(Vo,{value:e.id,children:t("span",{className:"flex items-center gap-2",children:[e.icon,e.name,U[e.id]>0&&a(Ko,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:U[e.id]})]})},e.id))})]})]}),!c&&t("div",{className:"flex gap-2",children:[t(xs,{open:T,onOpenChange:M,children:[a(ys,{asChild:!0,children:t($i,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[A.length>0?`${A.length} selecionado${A.length>1?"s":""}`:v,a(D,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Ns,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[a("div",{className:"p-2 border-b",children:t("div",{className:"relative",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{className:"pl-8 h-8 text-sm",placeholder:g,value:k,onChange:e=>S(e.target.value)})]})}),a(Id,{className:"max-h-[220px]",children:0===F.length?a("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):a("div",{className:"p-1",children:F.map(e=>{const r=A.includes(e.id);return t("div",{className:Fi("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",r&&"bg-accent/50"),onClick:()=>O(e.id),children:[a("div",{className:Fi("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",r&&"bg-primary text-primary-foreground"),children:r&&a(I,{className:"h-3 w-3"})}),t("div",{className:"flex flex-col min-w-0",children:[a("span",{className:"truncate",children:e.name}),null!=e.count&&a("span",{className:"text-xs text-muted-foreground",children:b(e.count)})]})]},e.id)})})})]})]}),t($i,{size:"sm",className:"h-9 gap-1",disabled:0===A.length,onClick:$,children:[a(Q,{className:"h-4 w-4"}),p]})]}),t("div",{className:"space-y-2",children:[a("p",{className:"text-sm font-medium",children:h}),a("div",{className:Fi("rounded-md border bg-background p-3 min-h-[60px]",c&&"bg-muted/50"),children:0===z.length?a("span",{className:"text-sm text-muted-foreground",children:f}):a("div",{className:"flex flex-wrap gap-1.5",children:z.map(e=>{const r=L.has(e.id);return t(Ko,{variant:r?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!c&&!r&&a("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>V(e.id),children:a(E,{className:"h-3 w-3"})})]},e.id)})})}),c&&x&&t("p",{className:"text-xs text-muted-foreground",children:[a("span",{dangerouslySetInnerHTML:{__html:x}})," ",y&&N&&a("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:N,children:y})]})]})]})})}var Vh,qh;(qh=Vh||(Vh={}))[qh.WaitingProcessing=1]="WaitingProcessing",qh[qh.Processing=2]="Processing",qh[qh.Completed=3]="Completed",qh[qh.Error=4]="Error",qh[qh.Expired=5]="Expired";const Wh={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 Hh(e){const{t:a}=Ga();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Gh(e){const{t:a}=Ga();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Kh({requests:e,isLoading:n=!1,onGetReportUrl:i,formatDate:d=Gh,labels:c,className:u}){const{t:m}=Ga(),p={...Wh,...c},[h,f]=o(""),[g,v]=o(!1),[b,x]=o(""),[y,N]=o(""),[w,_]=o(null),C=s(()=>{if(!h)return e;const a=Hh(h);return e.filter(e=>Hh(e.reportName).includes(a))},[e,h]),k=l(async e=>{if(!w){_(e.id);try{const a=await i(e.id);a&&(x(a),N(e.reportName),v(!0))}finally{_(null)}}},[i,w]);return n?a("div",{className:Fi("space-y-3",u),children:Array.from({length:5}).map((e,t)=>a(Is,{className:"h-12 w-full"},t))}):t(r,{children:[t("div",{className:Fi("space-y-3",u),children:[t("div",{className:"relative max-w-sm",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{className:"pl-8 h-9 text-sm",placeholder:p.searchPlaceholder,value:h,onChange:e=>f(e.target.value)})]}),a(Id,{className:"rounded-md border",children:t(Il,{children:[a(Tl,{children:t(Ll,{children:[a(zl,{className:"min-w-[140px]",children:p.report}),a(zl,{className:"min-w-[150px]",children:p.status}),a(zl,{className:"min-w-[160px]",children:p.requestDate}),a(zl,{className:"min-w-[160px]",children:p.lastUpdate}),a(zl,{className:"min-w-[160px]",children:p.expirationDate}),a(zl,{className:"min-w-[140px]"})]})}),a(Ml,{children:0===C.length?a(Ll,{children:a(Fl,{colSpan:6,className:"text-center text-muted-foreground py-8",children:p.noResults})}):C.map(e=>{const r=function(e){const{t:a}=Ga();return new Date>new Date(e.expirationDate)&&e.statusId===Vh.Completed?Vh.Expired:e.statusId}(e),n=function(e,t){const{t:r}=Ga();switch(e){case Vh.WaitingProcessing:return{label:t.statusWaiting,icon:a(ta,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case Vh.Processing:return{label:t.statusProcessing,icon:a(ue,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case Vh.Completed:return{label:t.statusCompleted,icon:a(aa,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case Vh.Error:return{label:t.statusError,icon:a(O,{className:"h-3.5 w-3.5"}),variant:"danger"};case Vh.Expired:return{label:t.statusExpired,icon:a(ea,{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"}}}(r,p),i=r===Vh.Completed,o=r===Vh.Expired;return t(Ll,{children:[a(Fl,{className:"font-medium",children:e.reportName}),a(Fl,{children:t(Ko,{variant:n.variant,className:Fi("gap-1",n.className),children:[n.icon,n.label]})}),a(Fl,{className:"text-sm",children:d(new Date(e.requestDate))}),a(Fl,{className:"text-sm",children:d(new Date(e.lastUpdate))}),a(Fl,{className:Fi("text-sm",o&&"text-destructive"),children:d(new Date(e.expirationDate))}),a(Fl,{children:t($i,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!i||w===e.id,onClick:()=>k(e),children:[w===e.id?a(T,{className:"h-4 w-4 animate-spin"}):a(Ce,{className:"h-4 w-4"}),p.viewReport]})})]},e.id)})})]})})]}),a(Lh,{open:g,onOpenChange:v,url:b,title:y})]})}function Yh({reportApiUrl:e,parameters:t={},minHeight:r="80vh",...n}){const i=s(()=>{const a=`${e}/api/reports/v1/Viewer/InitViewer`,r=new URLSearchParams(t).toString();return r?`${a}?${r}`:a},[e,t]);return a(Lh,{...n,url:i,minHeight:r})}const Qh={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 Xh({label:e,color:r,icon:n,showIcon:i,size:o="md",variant:s="filled",backgroundColor:l,className:d}){const c=Qh[o],u=i??!!n;return t("span",{className:Fi("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===s&&"border",c.badge,d),style:(()=>{switch(s){case"outline":return{color:r,borderColor:Ti(r,.3),backgroundColor:"transparent"};case"ghost":return{color:r,backgroundColor:"transparent"};default:return{color:r,backgroundColor:l||Ti(r,.1)}}})(),children:[u&&n&&a(n,{size:c.icon,strokeWidth:2}),e]})}function Jh(e){return a=>e[a]}var Zh,ef,af,tf,rf,nf,of,sf,lf,df,cf,uf,mf,pf,hf,ff,gf,vf,bf,xf,yf,Nf,wf,_f,Cf,kf,Sf,Af,Ef,Df,Pf,If,Tf,Mf,Rf,Lf,zf,Ff,Uf,jf,Of,Bf,$f,Vf,qf,Wf,Hf,Gf,Kf,Yf,Qf;(ef=Zh||(Zh={})).Count="valuecount",ef.Sum="sum",ef.Average="average",ef.DistinctCount="valuecount_distict",ef.Max="max",ef.Min="min",(af||(af={})).ViewAllAnalysis="nes3j6wn",(rf=tf||(tf={})).RegisterDashboards="EeKs7CYA",rf.RemoveDashboards="3GKZYOQ9",rf.ViewAllDashboards="wYBdQNvZ",rf.EditDashboards="bMFcbwv4",(of=nf||(nf={}))[of.Default=1]="Default",of[of.Compact=2]="Compact",(lf=sf||(sf={}))[lf.FiveSeconds=1]="FiveSeconds",lf[lf.TenSeconds=2]="TenSeconds",lf[lf.FifteenSeconds=3]="FifteenSeconds",lf[lf.ThirtySeconds=4]="ThirtySeconds",lf[lf.OneMinute=5]="OneMinute",lf[lf.ThreeMinutes=6]="ThreeMinutes",lf[lf.FiveMinutes=7]="FiveMinutes",lf[lf.TenMinutes=8]="TenMinutes",(cf=df||(df={}))[cf.Day=1]="Day",cf[cf.Month=2]="Month",cf[cf.Year=3]="Year",(mf=uf||(uf={}))[mf.Ascending=1]="Ascending",mf[mf.Descending=2]="Descending",(hf=pf||(pf={}))[hf.Label=1]="Label",hf[hf.Value=2]="Value",(gf=ff||(ff={}))[gf.LastSevenDays=1]="LastSevenDays",gf[gf.LastWeek=2]="LastWeek",gf[gf.LastMonth=3]="LastMonth",gf[gf.PreviousQuarter=4]="PreviousQuarter",gf[gf.PreviousSemester=5]="PreviousSemester",gf[gf.LastYear=6]="LastYear",gf[gf.SpecificPeriod=7]="SpecificPeriod",gf[gf.CurrentMonth=8]="CurrentMonth",gf[gf.CurrentSemester=9]="CurrentSemester",gf[gf.CurrentWeek=10]="CurrentWeek",gf[gf.CurrentYear=11]="CurrentYear",(bf=vf||(vf={}))[bf.Text=1]="Text",bf[bf.Area=2]="Area",bf[bf.Bar=3]="Bar",bf[bf.Column=4]="Column",bf[bf.StackedColumn=5]="StackedColumn",bf[bf.Line=6]="Line",bf[bf.List=7]="List",bf[bf.Numeric=8]="Numeric",bf[bf.Pareto=9]="Pareto",bf[bf.Pie=10]="Pie",bf[bf.RiskMatrix=11]="RiskMatrix",bf[bf.Burndown=12]="Burndown",bf[bf.PerformanceColumns=13]="PerformanceColumns",bf[bf.EvolutionLine=14]="EvolutionLine",(yf=xf||(xf={}))[yf.NotUpdate=1]="NotUpdate",yf[yf.FiveMinutes=2]="FiveMinutes",yf[yf.TenMinutes=3]="TenMinutes",yf[yf.FifteenMinutes=4]="FifteenMinutes",yf[yf.ThirtyMinutes=5]="ThirtyMinutes",yf[yf.OneHour=6]="OneHour",(wf=Nf||(Nf={}))[wf.NormalPage=1]="NormalPage",wf[wf.Carousel=2]="Carousel",(Cf=_f||(_f={}))[Cf.General=0]="General",Cf[Cf.Share=1]="Share",(Sf=kf||(kf={}))[Sf.NotShared=1]="NotShared",Sf[Sf.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Sf[Sf.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",(Ef=Af||(Af={})).PtBr="pt-br",Ef.EnUs="en",Ef.EsEs="es",(Pf=Df||(Df={}))[Pf.Quantity=0]="Quantity",Pf[Pf.AllRisksList=1]="AllRisksList",(Tf=If||(If={}))[Tf.Five=5]="Five",Tf[Tf.Ten=10]="Ten",Tf[Tf.Fifteen=15]="Fifteen",Tf[Tf.Twenty=20]="Twenty",Tf[Tf.All=0]="All",Tf[Tf.Custom=-1]="Custom",(Rf=Mf||(Mf={}))[Rf.AlphabeticalAsc=1]="AlphabeticalAsc",Rf[Rf.AlphabeticalDesc=2]="AlphabeticalDesc",Rf[Rf.CountAsc=3]="CountAsc",Rf[Rf.CountDesc=4]="CountDesc",Rf[Rf.DateAsc=5]="DateAsc",Rf[Rf.DateDesc=6]="DateDesc",(zf=Lf||(Lf={}))[zf.Loading=0]="Loading",zf[zf.Loaded=1]="Loaded",zf[zf.Error=3]="Error",zf[zf.NoData=4]="NoData",zf[zf.Unavailable=5]="Unavailable",(Uf=Ff||(Ff={}))[Uf.Quantity=1]="Quantity",Uf[Uf.Percentage=2]="Percentage",Uf[Uf.QuantityPercentage=3]="QuantityPercentage",(Of=jf||(jf={}))[Of.Program=1]="Program",Of[Of.Project=2]="Project",Of[Of.Action=3]="Action",Of[Of.PerformanceProject=4]="PerformanceProject",Of[Of.PerformanceAction=5]="PerformanceAction",($f=Bf||(Bf={})).OccurrenceActionPlans="xebGnSSq",$f.OccurrenceGeneral="UFws4AvH",$f.PlansActionPlans="Kux6CcVC",$f.PlansProgramProjects="UWjrp6Dw",$f.PlansIdeas="3g7vNm2w",$f.RisksGeneral="PZ4b6FhP",$f.RisksActionPlans="xZErDg57",$f.RisksAnalysis="UxsioMbH",$f.RisksIncidences="gNt5IJ2F",$f.MetrologyGeneral="4MfEPbRY",$f.MetrologyActivities="hdFM9XQW",$f.MetrologyServiceOrders="cIrVPdMv",$f.DecisionsGeneral="CopsnHDB",$f.DecisionsItems="qLFAayjx",$f.DecisionsActionPlans="RiQFpxdb",$f.FlowGeneral="AFV98JoG",$f.AuditGeneral="gON8LJPi",$f.AuditPlans="SsCNVOvr",$f.AuditPlansItems="OpPkCCFm",$f.AuditActionPlans="P1oGePhh",$f.CommonGeneral="VVfEzgMQ",$f.ActionPlans="C6Z4MgGa",$f.SuppliersEvaluations="fSCeS4mH",$f.SuppliersGeneral="8qPThkrD",$f.SuppliersEvaluationsCriteria="RiSIStdY",$f.SuppliersDocuments="Riua4jMa",$f.SuppliersMaterialsServices="UpEkatXH",$f.DocumentsGeneral="FRhhEX2J",$f.DocumentsPhysicalCopies="PZLtJ23h",$f.DocumentsObsolete="XDjbga14",$f.FmeaGeneral="aPwf4uPr",$f.FmeaActionPlans="vQ8PMrVX",(qf=Vf||(Vf={}))[qf.NotShared=1]="NotShared",qf[qf.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",qf[qf.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",(Hf=Wf||(Wf={}))[Hf.All=1]="All",Hf[Hf.OnlyMine=2]="OnlyMine",Hf[Hf.Favorites=3]="Favorites",(Kf=Gf||(Gf={}))[Kf.Current=1]="Current",Kf[Kf.Inherent=2]="Inherent",(Qf=Yf||(Yf={}))[Qf.Default=1]="Default",Qf[Qf.Pastel=2]="Pastel",Qf[Qf.Vibrant=3]="Vibrant",Qf[Qf.Earth=4]="Earth",Qf[Qf.Ocean=5]="Ocean",Qf[Qf.Floral=6]="Floral",Qf[Qf.Night=7]="Night",Qf[Qf.Winter=8]="Winter",Qf[Qf.Spring=9]="Spring",Qf[Qf.Summer=10]="Summer",Qf[Qf.Fall=11]="Fall",Qf[Qf.Gray=12]="Gray",Qf[Qf.Brown=13]="Brown",Qf[Qf.Blue=14]="Blue",Qf[Qf.Yellow=15]="Yellow",Qf[Qf.Green=16]="Green",Qf[Qf.Purple=17]="Purple",Qf[Qf.Orange=18]="Orange",Qf[Qf.Pink=19]="Pink",Qf[Qf.Red=20]="Red";const Xf={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Jf={advancedFilter:"analysisDashboardsListFilter"},Zf=["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"],eg=["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 ag(e){return e?.sort((e,a)=>{if(!e?.items?.length||!a?.items?.length)return 0;return tg(e.items[0]?.keyDate)-tg(a.items[0]?.keyDate)})}function tg(e){if(!e)return 0;const[a,t]=e.split("/"),r=Xf[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+r}function rg(e){return null==e?.value||""===e.value.trim()}function ng(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function ig(e){for(const a of eg)if(e[a])return e[a];return null}function og(e){return e?sg(e).join("&"):null}function sg(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(...sg({[t]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||a.push(`${t}=${r}`))}return a}const lg=/^-?\d+(,\d{3})*(\.\d+)?$/;function dg(e){return!!lg.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))}function cg(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)}const ug=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});function mg(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}const pg=new Set([vf.Text]),hg=new Set([vf.Text,vf.Numeric,vf.RiskMatrix,vf.Burndown,vf.PerformanceColumns]),fg=new Set([vf.Text,vf.RiskMatrix,vf.Burndown,vf.PerformanceColumns]);function gg({config:e,viewOnly:n=!1,complement:i,complementPosition:d="before-options",queryUrlBuilder:c,onRefresh:u,onExport:m,onToggleOnlyMine:p,className:h}){const{t:f}=Ga(),[g,v]=o(e.onlyMine??!1),b=pg.has(e.typeId),x=!hg.has(e.typeId),y=!fg.has(e.typeId),N=s(()=>{if(!e.jsonRules||e.typeId===vf.PerformanceColumns)return!1;try{const a=JSON.parse(e.jsonRules);return a?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),w=s(()=>c?.(e)??"#",[c,e]),_=l(()=>{const e=!g;v(e),p?.(e)},[g,p]),C=[];return g&&C.push(f("dashboard_only_mine")),e.onlyLate&&C.push(f("dashboard_only_overdue")),N&&C.push(f("dashboard_advanced_filter")),t("div",{className:Fi("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",h),children:[t("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===d&&i,t("div",{className:"flex min-w-0 flex-col",children:[t(fs,{children:[a(gs,{asChild:!0,children:a("span",{className:"block truncate",children:e.title})}),a(vs,{children:e.title})]}),C.length>0&&a("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:C.join(" | ")})]}),"after-title"===d&&i]}),!n&&t("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===d&&i,t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a(ra,{className:"h-3.5 w-3.5"})})}),t(ss,{align:"end",className:"w-48",children:[e.canUpdate&&t(ls,{onClick:()=>e.onEdit?.(e.id),children:[a(G,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!b&&t(ls,{onClick:u,children:[a(ue,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),x&&t(ls,{disabled:e.noData,onClick:m,children:[a(Je,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!b&&t(ls,{disabled:!e.openQueryEnabled,onClick:()=>window.open(w,"_blank"),children:[a(pe,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),y&&t(r,{children:[a(ms,{}),t(ls,{onClick:_,children:[g&&a(I,{className:"mr-2 h-3.5 w-3.5"}),!g&&a("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t(r,{children:[a(ms,{}),t(ls,{onClick:()=>e.onDuplicate?.(e.id),children:[a(me,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t(ls,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a(H,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===d&&i]})]})}function vg({config:e,queryUrl:r,className:n}){return t("div",{className:Fi("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a(de,{className:"h-12 w-12 text-muted-foreground/50"}),a("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),a("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t("p",{className:"mt-2 text-xs",children:[r&&a("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),r&&e.canUpdate&&a("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&a("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function bg({panelType:e,className:r}){const n=e===vf.Burndown;return t("div",{className:Fi("flex flex-1 flex-col items-center justify-center gap-2 p-4",r),children:[a(Qo,{className:"h-10 w-10 text-muted-foreground/40"}),n&&a("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function xg({hasRemovedColumn:r=!1,className:n}){return t("div",{className:Fi("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),a("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function yg({onRemove:e,className:r}){return t("div",{className:Fi("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a(de,{className:"h-12 w-12 text-muted-foreground/50"}),a("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),a("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&a("p",{className:"mt-2 text-xs",children:a("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const Ng={[Zh.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Zh.Sum]:"Sum",[Zh.Average]:e.t("dashboard_average"),[Zh.DistinctCount]:e.t("dashboard_distinct_count"),[Zh.Max]:e.t("dashboard_max_value"),[Zh.Min]:e.t("dashboard_min_value")};function wg({config:e,state:r,value:n,label:i,viewOnly:o=!1,onClick:s,onRefresh:l,queryUrl:d,queryUrlBuilder:c,className:u}){const{t:m}=Ga(),p=i??Ng[e.aggregationType??""]??"",h=function(e,a){if(null==e)return"—";const t=Zf.includes(a.field),r=a.aggregationType===Zh.Count||a.aggregationType===Zh.DistinctCount;return t&&!r?ug.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(n,e);return t("div",{className:Fi("flex h-full flex-col",u),children:[a(gg,{config:e,viewOnly:o,onRefresh:l,queryUrlBuilder:c}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&t("div",{className:Fi("flex flex-1 flex-col items-center justify-center",s&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:s,children:[a("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:h}),p&&a("span",{className:"text-xs text-muted-foreground mt-1",children:p})]}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:d}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function _g({config:e,state:r,htmlContent:n,viewOnly:i=!1,onRefresh:o,queryUrl:s,queryUrlBuilder:l,className:d}){const c=n??e.textTypeString??"";return t("div",{className:Fi("flex h-full flex-col",d),children:[a(gg,{config:e,viewOnly:i,onRefresh:o,queryUrlBuilder:l}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&a("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),r===Lf.Error&&a(vg,{config:e,queryUrl:s})]})}function Cg({config:e,state:r,data:n=[],columns:i=[],viewOnly:o=!1,onRowClick:d,onRefresh:c,onExport:u,queryUrl:m,queryUrlBuilder:p,enableRowLinks:h=!0,className:f}){const g=s(()=>i.filter(e=>!1!==e.visible),[i]),v=l(e=>{if(d)d(e);else if(h){const a=ig(e);a&&window.open(ng(a),"_blank")}},[d,h]);return t("div",{className:Fi("flex h-full flex-col",f),children:[a(gg,{config:e,viewOnly:o,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&a("div",{className:"flex-1 overflow-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:a("tr",{children:g.map(e=>a("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("tbody",{children:n.map((e,t)=>{const r=h&&!!ig(e);return a("tr",{className:Fi("border-b border-border/50 transition-colors hover:bg-muted/30",(r||d)&&"cursor-pointer"),onClick:()=>v(e),children:g.map(t=>a("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:t.render?t.render(e[t.columnName],e):kg(e[t.columnName],t)},t.columnName))},t)})})]})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:m}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function kg(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 Sg=["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 Ag({config:e,variant:r,state:n,data:i=[],series:o,colors:l,categoryKey:d="key",yAxisFormat:c,viewOnly:u=!1,onPointClick:m,onRefresh:p,onExport:h,queryUrl:f,queryUrlBuilder:g,className:v}){const b=l?.length?l:e.hexColors?.length?e.hexColors:Sg,x=s(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),y="bar"===r,N="stacked-column"===r,w=s(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t("div",{className:Fi("flex h-full flex-col",v),children:[a(gg,{config:e,viewOnly:u,onRefresh:p,onExport:h,queryUrlBuilder:g}),n===Lf.Loading&&a(bg,{}),n===Lf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(At,{width:"100%",height:"100%",children:Eg({variant:r,data:i,series:x,colors:b,categoryKey:d,isHorizontalBar:y,isStacked:N,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:m})})}),n===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),n===Lf.Error&&a(vg,{config:e,queryUrl:f}),n===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Eg({variant:e,data:r,series:n,colors:i,categoryKey:o,isHorizontalBar:s,isStacked:l,yAxisTickFormatter:d,tooltipFormatter:c,onPointClick:u}){const m={tick:{fontSize:11},tickLine:!1,axisLine:!1},p=a(Et,{dataKey:s?void 0:o,type:s?"number":"category",...m,angle:s?0:-45,textAnchor:s?"middle":"end",height:s?void 0:60,tickFormatter:s?d:void 0}),h=a(Dt,{dataKey:s?o:void 0,type:s?"category":"number",...m,width:s?100:60,tickFormatter:s?void 0:d}),f=a(Pt,{strokeDasharray:"3 3",className:"stroke-border/50"}),g=a(It,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),v=n.length>1?a(Tt,{wrapperStyle:{fontSize:"11px"}}):null,b=u?(e,a)=>u(r[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t(Mt,{data:r,layout:s?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(Rt,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||i[t%i.length],stackId:l?e.stackId||"stack":void 0,radius:l?void 0:[2,2,0,0],onClick:b,cursor:u?"pointer":void 0},e.dataKey))]}):"area"===e?t(Lt,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>{const r=e.color||i[t%i.length];return a(zt,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:u?"pointer":void 0}},e.dataKey)})]}):t(Ft,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(Ut,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||i[t%i.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:u?"pointer":void 0}},e.dataKey))]})}const Dg=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function Pg({config:e,state:r,data:n=[],colors:i,viewOnly:o=!1,onSliceClick:l,onRefresh:d,onExport:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=i?.length?i:e.hexColors?.length?e.hexColors:Dg,f=s(()=>n.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[n]),g=s(()=>f.reduce((e,a)=>e+(a.value??0),0),[f]);return t("div",{className:Fi("flex h-full flex-col",p),children:[a(gg,{config:e,viewOnly:o,onRefresh:d,onExport:c,queryUrlBuilder:m}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(At,{width:"100%",height:"100%",children:t(jt,{children:[a(Ot,{data:f,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:a})=>`${e??""}: ${(100*(a??0)).toFixed(0)}%`,labelLine:!0,onClick:l?(e,a)=>l(n[a],a):void 0,cursor:l?"pointer":void 0,children:f.map((e,t)=>a(Bt,{fill:h[t%h.length]},t))}),a(It,{formatter:e=>{const a="number"==typeof e?e:0,t=g>0?(a/g*100).toFixed(1):"0";return`${a.toLocaleString("pt-BR")} (${t}%)`}}),a(Tt,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:u}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Ig({config:e,state:r,data:n=[],barColor:i,lineColor:o="#e31a1c",viewOnly:l=!1,onPointClick:d,onRefresh:c,onExport:u,queryUrl:m,queryUrlBuilder:p,className:h}){const f=e.hexColors?.length?e.hexColors:["#1f78b4"],g=i??f[0],v=s(()=>{const e=[...n].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}))},[n]);return t("div",{className:Fi("flex h-full flex-col",h),children:[a(gg,{config:e,viewOnly:l,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(At,{width:"100%",height:"100%",children:t($t,{data:v,margin:{top:5,right:30,left:0,bottom:5},children:[a(Pt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(Et,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a(Dt,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a(Dt,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a(It,{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(Tt,{wrapperStyle:{fontSize:"11px"}}),a(Rt,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:g,radius:[2,2,0,0],onClick:d?(e,a)=>d(n[a],a):void 0,cursor:d?"pointer":void 0}),a(Ut,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:m}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Tg({config:e,state:r,data:n=[],executedLabel:i,plannedLabel:o,executedColor:s="hsl(var(--primary))",plannedColor:l="hsl(var(--chart-2))",viewOnly:d=!1,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=Ga(),f=i??h("dashboard_work_done"),g=o??h("dashboard_work_planned");return t("div",{className:Fi("flex h-full flex-col",p),children:[a(gg,{config:e,viewOnly:d,onRefresh:c,queryUrlBuilder:m}),r===Lf.Loading&&a(bg,{panelType:vf.Burndown}),r===Lf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(At,{width:"100%",height:"100%",children:t(Lt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Pt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(Et,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a(Dt,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a(It,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(Tt,{wrapperStyle:{fontSize:"11px"}}),a(zt,{type:"monotone",dataKey:"executedPercentage",name:f,stroke:s,fill:s,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a(zt,{type:"monotone",dataKey:"plannedPercentage",name:g,stroke:l,fill:l,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:u}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Mg({config:e,state:r,data:n=[],executedLabel:i,plannedLabel:o,executedColor:s="hsl(var(--primary))",plannedColor:l="hsl(var(--chart-2))",viewOnly:d=!1,onPointClick:c,onRefresh:u,queryUrl:m,queryUrlBuilder:p,className:h}){const{t:f}=Ga(),g=i??f("dashboard_work_done"),v=o??f("dashboard_work_planned");return t("div",{className:Fi("flex h-full flex-col",h),children:[a(gg,{config:e,viewOnly:d,onRefresh:u,queryUrlBuilder:p}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(At,{width:"100%",height:"100%",children:t(Mt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Pt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(Et,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a(Dt,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a(It,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(Tt,{wrapperStyle:{fontSize:"11px"}}),a(Rt,{dataKey:"executedWork",name:g,fill:s,radius:[2,2,0,0],onClick:c?(e,a)=>c(n[a],a):void 0,cursor:c?"pointer":void 0}),a(Rt,{dataKey:"plannedWork",name:v,fill:l,radius:[2,2,0,0]})]})})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:m}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Rg({config:e,state:r,rule:n,risks:i=[],matrixViewType:o=Df.Quantity,viewOnly:l=!1,onCellClick:d,onRiskClick:c,onRefresh:u,queryUrl:m,queryUrlBuilder:p,className:h}){const f=s(()=>[...n?.parametersY??[]].sort((e,a)=>a.position-e.position),[n?.parametersY]),g=n?.parametersX??[],v=s(()=>{const e={};return i.forEach(a=>{const t=`${a.parameterYPosition}-${a.parameterXPosition}`;e[t]||(e[t]=[]),e[t].push(a)}),e},[i]);return t("div",{className:Fi("flex h-full flex-col",h),children:[a(gg,{config:e,viewOnly:l,onRefresh:u,queryUrlBuilder:p}),r===Lf.Loading&&a(bg,{}),r===Lf.Loaded&&n&&a("div",{className:"flex-1 overflow-auto p-4",children:t("div",{className:"flex gap-4 items-stretch min-w-fit",children:[a("div",{className:"flex items-center justify-center",children:a("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:n.name_y})}),t("div",{className:"flex-1",children:[t("div",{className:"flex mb-1",children:[a("div",{className:"w-16 shrink-0"}),a("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:n.threat_strategy_type_name}),!n.disable_opportunities&&a("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:n.opportunity_strategy_type_name})]}),f.map((e,r)=>t("div",{className:"flex",children:[a("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}),g.map((i,s)=>{const l=((e,a)=>v[`${a.position}-${e.position}`]??[])(i,e),u=((e,a)=>n?.colorMatrix?.[a]?.[e]??"hsl(var(--muted))")(s,r);return t("div",{className:Fi("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(d||c)&&l.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:u},onClick:()=>l.length>0&&d?.(i,e,l),children:[o===Df.Quantity&&l.length>0&&t("span",{className:"text-xs font-semibold",children:[l.length," risco",1!==l.length?"s":""]}),o===Df.AllRisksList&&l.map(e=>t(fs,{children:[a(gs,{asChild:!0,children:a("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:a=>{a.stopPropagation(),c?.(e)},children:e.code})}),t(vs,{className:"max-w-[250px]",children:[t("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t("p",{className:"text-xs mt-1",children:["Última análise: ",a("strong",{children:e.analysisDate})]}),e.strategy&&t("p",{className:"text-xs",children:["Estratégia: ",a("strong",{children:e.strategy})]}),e.resultName&&t("p",{className:"text-xs",children:["Criticidade: ",a("strong",{style:{backgroundColor:u},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},i.position)})]},e.position)),t("div",{className:"flex",children:[a("div",{className:"w-16 shrink-0"}),g.map(e=>a("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("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:n.name_x})]})]})}),r===Lf.NoData&&a(xg,{hasRemovedColumn:e.hasRemovedColumn}),r===Lf.Error&&a(vg,{config:e,queryUrl:m}),r===Lf.Unavailable&&a(yg,{onRemove:()=>e.onRemove?.(e.id)})]})}const Lg=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[Lg.Translate.toString(e),Lg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:r}=e;return a+" "+t+"ms "+r}}});function zg(e){switch(e){case vf.Bar:case vf.Column:case vf.Pie:case vf.List:case vf.Line:case vf.Area:case vf.Text:case vf.StackedColumn:return{x:4,y:2};case vf.Pareto:case vf.RiskMatrix:case vf.Burndown:case vf.PerformanceColumns:return{x:8,y:2};case vf.Numeric:return{x:1,y:1};default:return{x:2,y:2}}}function Fg(e){switch(Number(e)){case vf.Area:case vf.Bar:case vf.Column:case vf.Line:case vf.Numeric:case vf.Pie:case vf.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Ug({panel:e,columns:r,cellHeight:n,cellGap:i,allowDragging:o,children:l}){const{attributes:d,listeners:c,setNodeRef:u,transform:m,transition:p,isDragging:h}=nr({id:e.id,disabled:!o}),f=s(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*n+(e.sizeY-1)*i+"px",transform:Lg.Transform.toString(m),transition:p,zIndex:h?50:void 0,opacity:h?.85:1}),[e,r,n,i,m,p,h]);return t("div",{ref:u,style:f,className:Fi("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",h&&"shadow-lg ring-2 ring-primary/20"),...d,children:[a("div",{className:Fi("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?c:{}}),a("div",{className:"h-full",children:l})]})}function jg({panels:e,columns:r=8,cellHeight:n=160,cellGap:i=10,allowDragging:d=!1,showGridLines:c=!1,renderPanel:u,onLayoutChange:m,className:p}){const[h,f]=o(e);s(()=>{f(e)},[e]);const g=Xt(Jt(Zt,{activationConstraint:{distance:8}})),v=s(()=>0===h.length?1:Math.max(...h.map(e=>e.row+e.sizeY)),[h]),b=s(()=>h.map(e=>e.id),[h]),x=l(e=>{const{active:a,over:t}=e;if(!t||a.id===t.id)return;const r=h.findIndex(e=>e.id===a.id),n=h.findIndex(e=>e.id===t.id);if(-1===r||-1===n)return;const i=[...h],o={...i[r]},s={...i[n]},l=o.col,d=o.row;o.col=s.col,o.row=s.row,s.col=l,s.row=d,i[r]=o,i[n]=s,f(i),m?.(i)},[h,m]),y=s(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${v}, ${n}px)`,gap:`${i}px`}),[r,v,n,i]);return 0===h.length?t("div",{className:Fi("flex flex-col items-center justify-center py-16 text-center",p),children:[a("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),a("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):a(er,{sensors:g,collisionDetection:ar,onDragEnd:x,children:a(tr,{items:b,strategy:rr,children:a("div",{style:y,className:Fi("relative w-full",c&&"bg-muted/30",p),children:h.map(e=>a(Ug,{panel:e,columns:r,cellHeight:n,cellGap:i,allowDragging:d,children:u(e.id)},e.id))})})})}const Og={[vf.Bar]:"bar",[vf.Column]:"column",[vf.StackedColumn]:"stacked-column",[vf.Area]:"area",[vf.Line]:"line",[vf.EvolutionLine]:"evolution-line"};function Bg({config:e,state:r,data:n,numericValue:i,listColumns:o,cartesianData:s,cartesianSeries:l,burndownData:d,performanceData:c,matrixRule:u,matrixRisks:m,onPanelClick:p}){const h=Og[e.typeId];if(h)return a(Ag,{config:e,variant:h,state:r,data:s,series:l});switch(e.typeId){case vf.Numeric:return a(wg,{config:e,state:r,value:i});case vf.Text:return a(_g,{config:e,state:r});case vf.List:return a(Cg,{config:e,state:r,data:n,columns:o??[]});case vf.Pie:return a(Pg,{config:e,state:r,data:n});case vf.Pareto:return a(Ig,{config:e,state:r,data:n});case vf.Burndown:return a(Tg,{config:e,state:r,data:d});case vf.PerformanceColumns:return a(Mg,{config:e,state:r,data:c});case vf.RiskMatrix:return a(Rg,{config:e,state:r,rule:u,risks:m??[]});default:return t("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function $g({dashboard:e,panels:r,pages:n,activePageId:i,canEdit:d=!1,isFullscreen:c=!1,isLoading:u=!1,getPanelData:m,onRefresh:p,onToggleFullscreen:h,onToggleFavorite:f,onEdit:g,onShare:v,onAddPanel:b,onEditPanel:x,onRemovePanel:y,onDuplicatePanel:N,onLayoutChange:w,onPageChange:_,toolbarActions:C,className:k}){const{t:S}=Ga(),[A,E]=o(!1),D=e.idViewType===Nf.Carousel,P=s(()=>r,[r,D,i]),I=s(()=>P.map(e=>{const a=Fg(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[P]),T=l(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:d,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:x,onRemove:y,onDuplicate:N}),[d,x,y,N]),M=l(()=>{A||u||(E(!0),p?.(),setTimeout(()=>E(!1),3e4))},[A,u,p]),R=l(e=>{const r=P.find(a=>a.id===e);if(!r)return null;const n=T(r),i=m?.(e)??{state:Lf.Loaded};return t("div",{className:"flex flex-col h-full",children:[a(gg,{config:n,onRefresh:()=>{}}),a("div",{className:"flex-1 min-h-0 p-2",children:a(Bg,{config:n,...i})})]})},[P,T,m,d,x,y,N]);return t("div",{className:Fi("flex flex-col h-full",c&&"fixed inset-0 z-50 bg-background",k),children:[t("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3 min-w-0",children:[a("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!c&&a("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t("div",{className:"flex items-center gap-1",children:[C,p&&a("button",{onClick:M,disabled:A||u,className:Fi("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:A?S("dashboard_wait_refresh"):"Atualizar",children:a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("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"})})}),h&&a("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:c?S("dashboard_exit_fullscreen"):"Fullscreen",children:a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",c?{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"}:{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"})})}),d&&!c&&v&&a("button",{onClick:v,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:t("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),f&&!c&&a("button",{onClick:f,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?S("dashboard_remove_favorite"):"Favoritar",children:a("svg",{className:Fi("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("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"})})})]})]}),D&&n&&n.length>1&&a("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:n.map(e=>a("button",{onClick:()=>_?.(e.id),className:Fi("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",i===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))}),d&&!c&&b&&a("div",{className:"flex justify-center py-3",children:t("button",{onClick:b,className:Fi("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("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),u&&a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!u&&a("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:a(jg,{panels:I,allowDragging:d,showGridLines:d,renderPanel:R,onLayoutChange:w})})]})}function Vg(e,a=Af.PtBr){const{t:t}=Ga();switch(a){case Af.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case Af.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function qg(e){const{t:a}=Ga();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Wg=[{value:Wf.All,label:"Todos"},{value:Wf.OnlyMine,label:e.t("dashboard_my")},{value:Wf.Favorites,label:"Favoritos"}];function Hg({dashboards:e,limit:n,isLoading:i=!1,language:d=Af.PtBr,canAdd:c=!1,canEdit:u=!1,canRemove:m=!1,onOpen:p,onEdit:h,onShare:f,onDuplicate:g,onRemove:v,onAdd:b,onToggleFavorite:x,onRefresh:y,onSearch:N,onQuickFilterChange:w,toolbarExtra:_,className:C}){const{t:k}=Ga(),[S,A]=o(""),[E,D]=o(Wf.All),[P,I]=o(null),T=l(e=>{A(e),N?.(e)},[N]),M=l(e=>{D(e),w?.(e)},[w]),R=s(()=>{let a=e;if(S){const e=S.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||Vg(a,d).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(E){case Wf.OnlyMine:break;case Wf.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,S,E,d]);return t("div",{className:Fi("flex flex-col h-full",C),children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:[a("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),n&&t("span",{className:"text-xs text-muted-foreground",children:["(",n.countDashboards,"/",n.maxDashboards,")"]})]}),t("div",{className:"flex items-center gap-2",children:[t("div",{className:"relative",children:[t("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("circle",{cx:"11",cy:"11",r:"8"}),a("path",{d:"m21 21-4.3-4.3"})]}),a("input",{type:"text",placeholder:"Buscar...",value:S,onChange:e=>T(e.target.value),className:Fi("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")})]}),_,c&&b&&t("button",{onClick:b,className:Fi("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("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),a("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Wg.map(e=>a("button",{onClick:()=>M(e.value),disabled:i,className:Fi("px-3 py-1.5 text-sm rounded-md transition-colors",E===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))}),i&&a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!i&&a("div",{className:"flex-1 overflow-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t("tr",{children:[a("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:a("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("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("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),a("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),a("th",{className:"w-12 px-3 py-2"})]})}),t("tbody",{children:[0===R.length&&a("tr",{children:a("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),R.map(e=>t("tr",{onClick:()=>p?.(e),className:Fi("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[a("td",{className:"px-3 py-2",children:a("button",{onClick:a=>{a.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:a("svg",{className:Fi("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("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("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),a("td",{className:"px-3 py-2 text-foreground font-medium",children:Vg(e,d)}),a("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),a("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:qg(e.lastModified)}),a("td",{className:"px-3 py-2",children:a("span",{className:Fi("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("td",{className:"px-3 py-2",children:t("div",{className:"relative",children:[a("button",{onClick:a=>{a.stopPropagation(),I(P===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("circle",{cx:"12",cy:"5",r:"1"}),a("circle",{cx:"12",cy:"12",r:"1"}),a("circle",{cx:"12",cy:"19",r:"1"})]})}),P===e.id&&t(r,{children:[a("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),t("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("button",{onClick:a=>{a.stopPropagation(),I(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),u&&a("button",{onClick:a=>{a.stopPropagation(),I(null),h?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),u&&a("button",{onClick:a=>{a.stopPropagation(),I(null),f?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),a("button",{onClick:a=>{a.stopPropagation(),I(null),g?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),m&&t(r,{children:[a("div",{className:"my-1 border-t border-border"}),a("button",{onClick:a=>{a.stopPropagation(),I(null),v?.(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 Gg=[{value:xf.NotUpdate,label:e.t("dashboard_no_refresh")},{value:xf.FiveMinutes,label:"5 minutos"},{value:xf.TenMinutes,label:"10 minutos"},{value:xf.FifteenMinutes,label:"15 minutos"},{value:xf.ThirtyMinutes,label:"30 minutos"},{value:xf.OneHour,label:"1 hora"}],Kg=[{value:Nf.NormalPage,label:e.t("dashboard_normal_page")},{value:Nf.Carousel,label:"Carrossel"}],Yg=[{value:sf.FiveSeconds,label:"5 segundos"},{value:sf.TenSeconds,label:"10 segundos"},{value:sf.FifteenSeconds,label:"15 segundos"},{value:sf.ThirtySeconds,label:"30 segundos"},{value:sf.OneMinute,label:"1 minuto"},{value:sf.ThreeMinutes,label:"3 minutos"},{value:sf.FiveMinutes,label:"5 minutos"},{value:sf.TenMinutes,label:"10 minutos"}],Qg=[{value:kf.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:kf.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:kf.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Xg=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Jg({dashboard:e,initialTab:r=_f.General,isSaving:n=!1,isQualitfy:i=!1,users:d=[],groups:c=[],places:u=[],collaborators:m=[],onSave:p,onCancel:h,className:f}){const{t:g}=Ga(),v=!!e,[b,x]=o(r),[y,N]=o({"pt-br":!!e?.titlePtBr||!v,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[w,_]=o(e?.titlePtBr??""),[C,k]=o(e?.titleEnUs??""),[S,A]=o(e?.titleEsEs??""),[E,D]=o(e?.responsibleId??""),[P,I]=o(e?.isActive??!0),[T,M]=o(e?.idUpdateTime??xf.NotUpdate),[R,L]=o(e?.idViewType??Nf.NormalPage),[z,F]=o(e?.idPageTime??sf.FifteenSeconds),[U,j]=o(e?.idShare??kf.NotShared),[O,B]=o(e?.groups??[]),[$,V]=o(e?.places??[]),[q,W]=o(e?.collaborators??[]),H=R===Nf.Carousel,G=y["pt-br"]||y.en||y.es,K=s(()=>!!G&&(!(y["pt-br"]&&!w.trim())&&(!(y.en&&!C.trim())&&!(y.es&&!S.trim()))),[G,y,w,C,S]),Y=l(e=>{N(a=>({...a,[e]:!a[e]}))},[]),Q=l(()=>{K&&!n&&p?.({titlePtBr:y["pt-br"]?w:"",titleEnUs:y.en?C:"",titleEsEs:y.es?S:"",responsibleId:E||void 0,isActive:P,idUpdateTime:T,idViewType:R,idPageTime:H?z:null,idShare:U,groups:U===kf.SharedWithUsersGroupsPlacesCollaborators?O:[],places:U===kf.SharedWithUsersGroupsPlacesCollaborators?$:[],collaborators:U===kf.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[K,n,p,y,w,C,S,E,P,T,R,z,H,U,O,$,q]);return t("div",{className:Fi("flex flex-col h-full bg-background",f),children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:[a("h2",{className:"text-lg font-semibold text-foreground",children:g(v?"dashboard_edit":"dashboard_new")}),v&&e&&a("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t("div",{className:"flex items-center gap-2",children:[a("button",{onClick:h,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t("button",{onClick:Q,disabled:!K||n,className:Fi("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:[n?a("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t("div",{className:"flex border-b border-border bg-card",children:[a("button",{onClick:()=>x(_f.General),className:Fi("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===_f.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a("button",{onClick:()=>x(_f.Share),className:Fi("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===_f.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t("div",{className:"flex-1 overflow-auto p-6",children:[b===_f.General&&t("div",{className:"max-w-2xl space-y-6",children:[t("div",{className:"space-y-2",children:[a("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),a("div",{className:"flex gap-2",children:Xg.map(e=>a("button",{onClick:()=>Y(e.key),className:Fi("px-3 py-1 text-xs rounded-md border transition-colors",y[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!G&&a("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),y["pt-br"]&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),a("input",{value:w,onChange:e=>_(e.target.value),maxLength:200,className:Fi("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[w.length,"/200"]})]}),y.en&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),a("input",{value:C,onChange:e=>k(e.target.value),maxLength:200,className:Fi("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[C.length,"/200"]})]}),y.es&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),a("input",{value:S,onChange:e=>A(e.target.value),maxLength:200,className:Fi("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[S.length,"/200"]})]}),!e?.isStandard&&d.length>0&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t("select",{value:E,onChange:e=>D(e.target.value),disabled:!v,className:Fi("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("option",{value:"",children:"Selecione..."}),d.map(e=>a("option",{value:e.id,children:e.name},e.id))]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),a("select",{value:T,onChange:e=>M(Number(e.target.value)),disabled:i,className:Fi("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:Gg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t("div",{className:"flex items-center gap-3 h-10",children:[a("button",{onClick:()=>I(!P),disabled:e?.isGeneralViewUse,className:Fi("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",P?"bg-primary":"bg-muted","disabled:opacity-50"),children:a("span",{className:Fi("inline-block h-4 w-4 rounded-full bg-white transition-transform",P?"translate-x-6":"translate-x-1")})}),a("span",{className:"text-sm text-foreground",children:P?"Ativo":"Inativo"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),a("select",{value:R,onChange:e=>L(Number(e.target.value)),disabled:i||H,className:Fi("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:Kg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),H&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),a("select",{value:z??"",onChange:e=>F(Number(e.target.value)),className:Fi("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:Yg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]})]}),b===_f.Share&&t("div",{className:"max-w-2xl space-y-6",children:[t("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t("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("circle",{cx:"12",cy:"12",r:"10"}),a("path",{d:"M12 16v-4"}),a("path",{d:"M12 8h.01"})]}),a("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),a("div",{className:"space-y-3",children:Qg.map(r=>t("label",{className:Fi("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",U===r.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[a("input",{type:"radio",name:"shareType",value:r.value,checked:U===r.value,onChange:()=>j(r.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t("div",{children:[a("p",{className:"text-sm font-medium text-foreground",children:r.label}),a("p",{className:"text-xs text-muted-foreground",children:r.description})]})]},r.value))}),U===kf.SharedWithUsersGroupsPlacesCollaborators&&t("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",O.length,")"]}),a("select",{multiple:!0,value:O,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);B(a)},className:Fi("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:c.map(e=>a("option",{value:e.id,children:e.name},e.id))})]}),t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Locais (",$.length,")"]}),a("select",{multiple:!0,value:$,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);V(a)},className:Fi("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:u.map(e=>a("option",{value:e.id,children:e.name},e.id))})]}),t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),a("select",{multiple:!0,value:q,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);W(a)},className:Fi("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:m.map(e=>a("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Zg({dashboards:e,limit:r,generalView:n,language:i=Af.PtBr,isLoading:d=!1,canAdd:c=!1,canEdit:u=!1,canRemove:p=!1,canEditStandard:h=!1,activePanels:f=[],activePages:g=[],getPanelData:v,users:b=[],groups:x=[],places:y=[],collaborators:N=[],isSaving:w=!1,onOpen:_,onBackToList:C,onRefresh:k,onRefreshList:S,onToggleFavorite:A,onSave:E,onUpdate:D,onRemove:P,onDuplicate:I,onShare:T,onAddPanel:M,onEditPanel:R,onRemovePanel:L,onDuplicatePanel:z,onLayoutChange:F,onSearch:U,onQuickFilterChange:j,onSetGeneralView:O,viewState:B,onViewStateChange:$,listToolbarExtra:V,viewToolbarActions:q,className:W}){const[H,G]=o({mode:"list"}),K=B??H,Y=l(e=>{$?$(e):G(e)},[$]),Q=s(()=>"view"===K.mode||"edit"===K.mode||"share"===K.mode?e.find(e=>e.id===K.dashboardId)??null:null,[e,K]),[X,J]=o(!1),[Z,ee]=o(g[0]?.id);m(()=>{g.length>0&&!Z&&ee(g[0]?.id)},[g,Z]),m(()=>{if("view"!==K.mode||!Q||Q.idViewType!==Nf.Carousel||g.length<=1)return;const e=function(e){switch(e){case sf.FiveSeconds:return 5e3;case sf.TenSeconds:return 1e4;case sf.FifteenSeconds:return 15e3;case sf.ThirtySeconds:return 3e4;case sf.OneMinute:return 6e4;case sf.ThreeMinutes:return 18e4;case sf.FiveMinutes:return 3e5;case sf.TenMinutes:return 6e5;default:return 15e3}}(Q.idPageTime),a=setInterval(()=>{ee(e=>{const a=(g.findIndex(a=>a.id===e)+1)%g.length;return g[a]?.id})},e);return()=>clearInterval(a)},[K,Q,g]);const ae=l(e=>{Y({mode:"view",dashboardId:e.id}),ee(void 0),_?.(e)},[Y,_]),te=l(()=>{Y({mode:"list"}),J(!1),C?.()},[Y,C]),re=l(()=>{Y({mode:"create"})},[Y]),ne=l(e=>{Y({mode:"edit",dashboardId:e.id})},[Y]),ie=l(e=>{Y({mode:"share",dashboardId:e.id})},[Y]),oe=l(e=>{"edit"===K.mode||"share"===K.mode?D?.(K.dashboardId,e):E?.(e)},[K,E,D]),se=l(()=>{"edit"===K.mode||"share"===K.mode?Y({mode:"view",dashboardId:K.dashboardId}):Y({mode:"list"})},[K,Y]),le=l(()=>{Q&&A?.(Q)},[Q,A]),de=l(()=>{Q&&ne(Q)},[Q,ne]),ce=l(()=>{Q&&ie(Q)},[Q,ie]);return t("div",{className:Fi("flex flex-col h-full",W),children:["list"===K.mode&&a(Hg,{dashboards:e,limit:r,isLoading:d,language:i,canAdd:c,canEdit:u,canRemove:p,onOpen:ae,onEdit:ne,onShare:ie,onDuplicate:I,onRemove:P,onAdd:re,onToggleFavorite:A,onRefresh:S,onSearch:U,onQuickFilterChange:j,toolbarExtra:V,className:"flex-1"}),"view"===K.mode&&Q&&t("div",{className:"flex flex-col h-full",children:[!X&&t("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t("button",{onClick:te,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),n?.dashboardId===Q.id&&t("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:[t("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),a("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),u&&O&&n?.dashboardId!==Q.id&&a("button",{onClick:()=>O(Q.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),a($g,{dashboard:Q,panels:f,pages:g,activePageId:Z,canEdit:u||h&&!!Q.isStandard,isFullscreen:X,isLoading:d,getPanelData:v,onRefresh:k,onToggleFullscreen:()=>J(e=>!e),onToggleFavorite:le,onEdit:de,onShare:ce,onAddPanel:M,onEditPanel:R,onRemovePanel:L,onDuplicatePanel:z,onLayoutChange:F,onPageChange:ee,toolbarActions:q,className:"flex-1"})]}),"create"===K.mode&&t("div",{className:"flex flex-col h-full",children:[a("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t("button",{onClick:te,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),a(Jg,{users:b,groups:x,places:y,collaborators:N,isSaving:w,onSave:oe,onCancel:se,className:"flex-1"})]}),("edit"===K.mode||"share"===K.mode)&&Q&&t("div",{className:"flex flex-col h-full",children:[a("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),a(Jg,{dashboard:Q,initialTab:"share"===K.mode?_f.Share:_f.General,users:b,groups:x,places:y,collaborators:N,isSaving:w,isQualitfy:!!Q.isStandard&&!h,onSave:oe,onCancel:se,className:"flex-1"})]})]})}function ev(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function av(e,a){return{id:a?.id??ev(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function tv(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 rv(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>rv(e,a))}:t}function nv(e,a,t){return rv(e,e=>e.id===a?t(e):e)}function iv(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function ov(e,a,t){const r=av(t||"");let n=r.id;const i=rv(e,t=>{if(t.id!==a)return t;let i=r;if(t.id===e.id){const a=iv(e);i={...i,side:a.left<=a.right?"left":"right"}}else i={...i,side:t.side};return n=i.id,{...t,collapsed:!1,children:[...t.children??[],i]}});return{root:i,newId:n}}function sv(e,a,t){if(e.id===a)return ov(e,a,t);const r=tv(e,a);if(!r||!r.parent)return{root:e,newId:a};const n=r.parent,i=av(t||"",{side:r.node.side}),o=i.id,s=rv(e,e=>{if(e.id!==n.id)return e;const t=(e.children??[]).findIndex(e=>e.id===a),r=[...e.children??[]];return r.splice(t+1,0,i),{...e,children:r}});return{root:s,newId:o}}function lv(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=tv(e,a);if(!t||!t.parent)return{root:e,nextSelectedId:null};const r=t.parent,n=r.children??[],i=n.findIndex(e=>e.id===a),o=n[i+1]?.id??n[i-1]?.id??r.id,s=rv(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)});return{root:s,nextSelectedId:o}}function dv(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const r=tv(e,a);return!!r&&!!tv(r.node,t)}(e,a,t))return e;const r=tv(e,a);if(!r)return e;const n=(()=>{if(t===e.id){const a=iv(e);return{...r.node,side:a.left<=a.right?"left":"right"}}const a=tv(e,t)?.node;return{...r.node,side:a?.side}})(),i=rv(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return rv(i,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],n]})}function cv(e,a){return nv(e,a,e=>({...e,collapsed:!e.collapsed}))}function uv(e,a){return rv(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function mv(e){const{value:a,defaultValue:t,onChange:r,readOnly:n}=e,i=void 0!==a,[d,c]=o(()=>t??a??av("Mapa Mental",{id:"root"})),m=i?a:d,[p,h]=o(m.id),f=u([]),g=u([]),v=l((e,a)=>{n||(f.current.push(a),f.current.length>50&&f.current.shift(),g.current=[],i||c(e),r?.(e))},[i,r,n]),b=l((e,a)=>{const t=nv(m,e,e=>({...e,text:a}));v(t,m)},[m,v]),x=l((e,a)=>{const t=nv(m,e,e=>({...e,...a}));v(t,m)},[m,v]),y=l((e,a="")=>{const{root:t,newId:r}=ov(m,e,a);return v(t,m),h(r),r},[m,v]),N=l((e,a="")=>{const{root:t,newId:r}=sv(m,e,a);return v(t,m),h(r),r},[m,v]),w=l(e=>{const{root:a,nextSelectedId:t}=lv(m,e);a!==m&&(v(a,m),h(t))},[m,v]),_=l((e,a)=>{const t=dv(m,e,a);t!==m&&v(t,m)},[m,v]),C=l(e=>{const a=tv(m,e);if(!a||!a.node.children?.length)return;const t=cv(m,e);v(t,m)},[m,v]),k=l(()=>{v(uv(m,!1),m)},[m,v]),S=l(()=>{v(uv(m,!0),m)},[m,v]),A=l(()=>{const e=f.current.pop();e&&(g.current.push(m),i||c(e),r?.(e))},[m,i,r]),E=l(()=>{const e=g.current.pop();e&&(f.current.push(m),i||c(e),r?.(e))},[m,i,r]),D=f.current.length>0,P=g.current.length>0,I=s(()=>p?tv(m,p)?.node??null:null,[m,p]),T=l(e=>{v(e,m)},[m,v]);return{root:m,setRoot:T,selectedId:p,selectedNode:I,setSelectedId:h,renameNode:b,updateNodeProps:x,addChild:y,addSibling:N,removeNode:w,moveNode:_,toggleNode:C,expandAll:k,collapseAll:S,undo:A,redo:E,canUndo:D,canRedo:P}}const pv=180,hv=80,fv=16,gv=60;function vv(e){const a=(e.collapsed?[]:e.children??[]).map(vv);if(!a.length)return{node:e,visibleChildren:a,height:44};const t=a.reduce((e,a)=>e+a.height,0)+fv*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function bv(e,a,t,r,n,i,o){const s=[],l={node:e.node,parent:a,x:t,y:r,width:180,height:44,side:n,depth:i,visibleChildren:s};if(o.push(l),!e.visibleChildren.length)return l;let d=r+22-(e.visibleChildren.reduce((e,a)=>e+a.height,0)+fv*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===n?t+180+hv:t-hv-pv,r=d+c.height/2-22,l=bv(c,e.node,a,r,n,i+1,o);s.push(l),d+=c.height+fv}return l}function xv(e){return s(()=>function(e){const a=e.collapsed?[]:e.children??[],t=a.filter(e=>"left"!==e.side).map(vv),r=a.filter(e=>"left"===e.side).map(vv),n=t.reduce((e,a)=>e+a.height,0)+fv*Math.max(0,t.length-1),i=r.reduce((e,a)=>e+a.height,0)+fv*Math.max(0,r.length-1),o=Math.max(n,i,56),s=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(s)):0,l=t.length?Math.max(...t.map(s))+1:0,d=260*(r.length?Math.max(...r.map(s))+1:0),c=220+260*l+d+120,u=o+120,m=gv+d,p=[],h={node:e,parent:null,x:m,y:gv+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let f=gv+o/2-n/2;for(const b of t){const a=f+b.height/2-22,t=bv(b,e,m+220+hv,a,"right",1,p);h.visibleChildren.push(t),f+=b.height+fv}let g=gv+o/2-i/2;for(const b of r){const a=g+b.height/2-22,t=bv(b,e,m-hv-pv,a,"left",1,p);h.visibleChildren.push(t),g+=b.height+fv}const v=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:v,width:c,height:u}}(e),[e])}function yv(e,a){const{layout:t,selectedId:r,setSelectedId:n}=a;if(!r)return void n(t.nodes[0]?.node.id??null);const i=t.byId.get(r);if(!i)return;if("left"===e||"right"===e){if("root"===i.side){const a=i.visibleChildren.find(a=>a.side===e);return void(a&&n(a.node.id))}if(e===i.side){const e=i.visibleChildren[Math.floor(i.visibleChildren.length/2)];e&&n(e.node.id)}else i.parent&&n(i.parent.id);return}if(!i.parent)return;const o=t.byId.get(i.parent.id);if(!o)return;const s=o.visibleChildren.filter(e=>e.side===i.side),l=s.findIndex(e=>e.node.id===r),d="up"===e?s[l-1]:s[l+1];d&&n(d.node.id)}const Nv=({layout:e,selected:r,editing:i,readOnly:o,onSelect:s,onStartEditing:l,onFinishEditing:d,onToggle:c,onDragStart:u,onDragOver:m,onDragLeave:p,onDrop:h,isDropTarget:f,renderNodeContent:g})=>{const v=e.node,b="root"===e.side,x=(y=v.icon)?S[y]??null:null;var y;const N=!!v.children?.length,w=n.useRef(null),[_,C]=n.useState(v.text);n.useEffect(()=>{if(i){C(v.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[i,v.text]);const k=()=>{d(_.trim()||v.text)},A=v.color;return t("div",{role:"treeitem","aria-selected":r,"aria-expanded":N?!v.collapsed:void 0,tabIndex:r?0:-1,"data-node-id":v.id,draggable:!o&&!b&&!i,onDragStart:u,onDragOver:m,onDragLeave:p,onDrop:h,onClick:e=>{e.stopPropagation(),s()},onDoubleClick:e=>{e.stopPropagation(),o||l()},className:Fi("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",b&&"font-semibold border-primary/40 bg-primary text-primary-foreground",r&&!b&&"ring-2 ring-primary ring-offset-1",r&&b&&"ring-2 ring-primary-foreground/60 ring-offset-1",f&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:A},children:[x&&a(x,{className:Fi("h-4 w-4 shrink-0",b&&"text-primary-foreground")}),a("div",{className:"flex-1 min-w-0",children:i?a("input",{ref:w,value:_,onChange:e=>C(e.target.value),onBlur:k,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key?(e.preventDefault(),d(null)):e.stopPropagation()},className:Fi("w-full bg-transparent outline-none text-sm",b&&"text-primary-foreground placeholder:text-primary-foreground/60")}):a("div",g?{className:"text-sm truncate",children:g(v)}:{className:"text-sm truncate",children:v.text||a("span",{className:"opacity-50",children:"—"})})}),v.note&&!i&&t(fs,{children:[a(gs,{asChild:!0,children:a("button",{type:"button",onClick:e=>e.stopPropagation(),className:Fi("shrink-0 rounded p-0.5 hover:bg-muted/40",b&&"hover:bg-primary-foreground/10"),"aria-label":v.note,children:a(Be,{className:"h-3.5 w-3.5 opacity-70"})})}),a(vs,{className:"max-w-xs whitespace-pre-line",children:v.note})]}),N&&a("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:Fi("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",b&&"border-primary-foreground/30"),"aria-label":v.collapsed?"Expandir":"Colapsar",children:v.collapsed?a(Q,{className:"h-3 w-3"}):"left"===e.side?a(U,{className:"h-3 w-3 rotate-180"}):"right"===e.side?a(U,{className:"h-3 w-3"}):a(na,{className:"h-3 w-3"})})]})},wv=({parent:e,child:t})=>{const r=t.x+t.width/2<e.x+e.width/2,n=r?e.x:e.x+e.width,i=e.y+e.height/2,o=r?t.x+t.width:t.x,s=t.y+t.height/2,l=(n+o)/2;return a("path",{d:`M ${n} ${i} C ${l} ${i}, ${l} ${s}, ${o} ${s}`,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},_v=({label:e,icon:r,onClick:n,disabled:i})=>t(fs,{children:[a(gs,{asChild:!0,children:a($i,{type:"button",variant:"ghost",size:"icon",onClick:n,disabled:i,"aria-label":e,className:"h-8 w-8",children:r})}),a(vs,{children:e})]}),Cv=e=>{const{t:r}=Ga();return t("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a(_v,{label:r("mind_map_add_child"),icon:a(ia,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a(_v,{label:r("mind_map_add_sibling"),icon:a(Q,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a(_v,{label:r("mind_map_delete_node"),icon:a(H,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a(Zi,{orientation:"vertical",className:"mx-1 h-5"}),a(_v,{label:r("mind_map_expand_all"),icon:a(oa,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a(_v,{label:r("mind_map_collapse_all"),icon:a(sa,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a(Zi,{orientation:"vertical",className:"mx-1 h-5"}),a(_v,{label:r("mind_map_zoom_out"),icon:a(la,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a(_v,{label:r("mind_map_zoom_in"),icon:a(da,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a(_v,{label:r("mind_map_fit_to_screen"),icon:a(ca,{className:"h-4 w-4"}),onClick:e.onFit}),a(Zi,{orientation:"vertical",className:"mx-1 h-5"}),a(_v,{label:r("mind_map_undo"),icon:a(ua,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a(_v,{label:r("mind_map_redo"),icon:a(ma,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a("div",{className:"flex-1"}),a(_v,{label:r("mind_map_export_json"),icon:a(Je,{className:"h-4 w-4"}),onClick:e.onExportJson}),a(_v,{label:r("mind_map_export_image"),icon:a(Ve,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function kv(e){return JSON.stringify(e,null,2)}function Sv(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=>Sv(e)):void 0;return av(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 Av(e){return Sv(JSON.parse(e))}const Ev=({value:e,defaultValue:r,onChange:i,onNodeSelect:s,readOnly:d=!1,hideToolbar:c=!1,extraShortcuts:p,renderNodeContent:h,className:f,height:g=600})=>{const{t:v}=Ga(),b=mv({value:e,defaultValue:r,onChange:i,readOnly:d}),x=xv(b.root),y=function(){const[e,a]=o({x:0,y:0,scale:1}),t=u(!1),r=u({x:0,y:0,tx:0,ty:0}),n=l(a=>{0!==a.button&&1!==a.button||(t.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]),i=l(e=>{t.current&&a(a=>({...a,x:r.current.tx+(e.clientX-r.current.x),y:r.current.ty+(e.clientY-r.current.y)}))},[]),s=l(e=>{if(t.current){t.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),d=l((e,t,r)=>{a(a=>{const n=Math.min(2.5,Math.max(.3,a.scale+e));if(n===a.scale)return a;if(void 0===t||void 0===r)return{...a,scale:n};const i=n/a.scale;return{scale:n,x:t-(t-a.x)*i,y:r-(r-a.y)*i}})},[]),c=l(()=>d(.15),[d]),p=l(()=>d(-.15),[d]),h=l(()=>a({x:0,y:0,scale:1}),[]),f=l((e,t,r,n)=>{const i=Math.min((r-64)/e,(n-64)/t,1.5),o=Math.max(.3,i);a({scale:o,x:(r-e*o)/2,y:(n-t*o)/2})},[]),g=l(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const a=e.currentTarget.getBoundingClientRect(),t=e.clientX-a.left,r=e.clientY-a.top;d(e.deltaY>0?-.1:.1,t,r)},[d]);return m(()=>{const e=()=>t.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:a,zoomIn:c,zoomOut:p,reset:h,fitTo:f,onBackgroundPointerDown:n,onPointerMove:i,onPointerUp:s,onWheel:g}}(),N=n.useRef(null),w=n.useRef(null),_=n.useRef(null),[C,k]=n.useState(null),[S,A]=n.useState(null);n.useEffect(()=>{s?.(b.selectedNode)},[b.selectedNode,s]),function({api:e,layout:a,containerRef:t,onStartEditing:r,readOnly:n,extraShortcuts:i}){m(()=>{const o=o=>{const s=t.current;if(!s)return;if(!s.contains(document.activeElement))return;const l=o.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 i??[])if(a.key.toLowerCase()===o.key.toLowerCase()&&!!a.ctrl===(o.ctrlKey||o.metaKey)&&!!a.shift===o.shiftKey&&!!a.alt===o.altKey)return o.preventDefault(),void a.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((o.ctrlKey||o.metaKey)&&"z"===o.key.toLowerCase())return o.preventDefault(),void(o.shiftKey?e.redo():e.undo());if("ArrowUp"===o.key)return o.preventDefault(),void yv("up",d);if("ArrowDown"===o.key)return o.preventDefault(),void yv("down",d);if("ArrowLeft"===o.key)return o.preventDefault(),void yv("left",d);if("ArrowRight"===o.key)return o.preventDefault(),void yv("right",d);if(c){if(" "===o.key)return o.preventDefault(),void e.toggleNode(c);if("F2"===o.key){if(n)return;return o.preventDefault(),void r(c)}if(!n){if("Enter"===o.key&&!o.shiftKey)return o.preventDefault(),c===e.root.id?e.addChild(c,""):e.addSibling(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Insert"===o.key||"Tab"===o.key)return o.preventDefault(),e.addChild(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Delete"===o.key||"Backspace"===o.key){if(c===e.root.id)return;return o.preventDefault(),void e.removeNode(c)}}}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[e,a,t,r,n,i])}({api:b,layout:x,containerRef:N,onStartEditing:e=>{d||k(e)},readOnly:d,extraShortcuts:p});const E=n.useRef(!1);n.useEffect(()=>{if(E.current)return;const e=w.current;if(!e)return;const{clientWidth:a,clientHeight:t}=e;a>0&&t>0&&x.width>0&&(y.fitTo(x.width,x.height,a,t),E.current=!0)},[x.width,x.height,y]);const D=b.selectedId,P=b.selectedNode,I=D===b.root.id,T=n.useRef(null),M=e=>a=>{if(d)return;const t=T.current;if(!t||t===e)return;const r=tv(b.root,t);r&&tv(r.node,e)||(a.preventDefault(),a.dataTransfer.dropEffect="move",A(e))},R=()=>A(null),L=e=>a=>{a.preventDefault();const t=T.current;A(null),T.current=null,t&&t!==e&&b.moveNode(t,e)};return a(hs,{children:t("div",{ref:N,tabIndex:0,role:"tree","aria-label":v("mind_map_aria_label"),className:Fi("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",f),style:{height:g},onClick:()=>N.current?.focus(),children:[!c&&a(Cv,{canAddChild:!!P&&!d,canAddSibling:!!P&&!d,canDelete:!!P&&!I&&!d,canUndo:b.canUndo&&!d,canRedo:b.canRedo&&!d,onAddChild:()=>{if(!D)return;const e=b.addChild(D,"");k(e)},onAddSibling:()=>{if(!D)return;if(I){const e=b.addChild(D,"");return void k(e)}const e=b.addSibling(D,"");k(e)},onDelete:()=>{D&&!I&&b.removeNode(D)},onExpandAll:b.expandAll,onCollapseAll:b.collapseAll,onFit:()=>{const e=w.current;e&&y.fitTo(x.width,x.height,e.clientWidth,e.clientHeight)},onZoomIn:y.zoomIn,onZoomOut:y.zoomOut,onUndo:b.undo,onRedo:b.redo,onExportJson:()=>{!function(e,a,t="application/json"){const r=new Blob([e],{type:t}),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=a,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}(kv(b.root),"mind-map.json")},onExportImage:async()=>{if(_.current)try{await async function(e,a="mind-map.png"){const t=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(t),n=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,i=new Image;await new Promise((e,a)=>{i.onload=()=>e(),i.onerror=()=>a(new Error("Failed to load SVG snapshot")),i.src=n});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,s=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*s;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(i,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)}(_.current,"mind-map.png")}catch(e){}}}),a("div",{ref:w,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(y.onBackgroundPointerDown(e),b.setSelectedId(null))},onPointerMove:y.onPointerMove,onPointerUp:y.onPointerUp,onWheel:y.onWheel,children:t("div",{className:"absolute origin-top-left",style:{transform:`translate(${y.transform.x}px, ${y.transform.y}px) scale(${y.transform.scale})`,width:x.width,height:x.height},children:[a("svg",{ref:_,width:x.width,height:x.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:x.nodes.map(e=>e.visibleChildren.map(t=>a(wv,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),x.nodes.map(e=>{return a(Nv,{layout:e,selected:D===e.node.id,editing:C===e.node.id,readOnly:d,onSelect:()=>b.setSelectedId(e.node.id),onStartEditing:()=>k(e.node.id),onFinishEditing:a=>{null!==a&&b.renameNode(e.node.id,a),k(null)},onToggle:()=>b.toggleNode(e.node.id),onDragStart:(t=e.node.id,e=>{d||t===b.root.id||(T.current=t,e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="move")}),onDragOver:M(e.node.id),onDragLeave:R,onDrop:L(e.node.id),isDropTarget:S===e.node.id,renderNodeContent:h},e.node.id);var t})]})})]})})},Dv=({manager:n,columns:i,onEdit:o,onView:s,onToggleStatus:l,onDelete:d,renderActions:c,customRowActions:u,enableBulkActions:p=!1,onNew:h,newButtonLabel:f,showNewButton:g=!0,customActions:v=[],hideActionBar:b,showActionBar:x=!0,showSearch:y=!1,searchValue:N,onSearchChange:w,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,gridColumns:A=3,renderCard:E,viewMode:D,onViewModeChange:P,listCardRenderer:I,gridCardRenderer:T,showViewToggle:M=!1})=>{const{setSearchVisible:R}=Sl(),L=void 0!==b?!b:x;m(()=>{if(!y)return R(!0),()=>R(!1)},[R,y]);const z=h||v.length>0||y||p||S||M,F=k||(()=>{n.bulkDelete?.(n.selectedIds)}),U=D||"grid",j="list"===U,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"}[j?1:A],B=L&&z?a(xd,{onNew:h,newButtonLabel:f,showNewButton:g,showSearch:y,searchValue:N,onSearchChange:w,searchPlaceholder:_,showBulkActions:p,selectedCount:n.selectedIds.length,bulkActions:C,onBulkDelete:F,onClearSelection:n.clearSelection,customActions:v,filters:S,viewMode:U,onViewModeChange:P,showViewToggle:M,availableViewModes:["list","grid"]}):null;return n.isLoading?t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 overflow-auto p-4",children:a(Ol,{count:6})})]}):0===n.entities.length?t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 flex items-center justify-center",children:a(Wl,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 overflow-auto p-4",children:a("div",{className:Fi("grid gap-4",O),children:n.entities.map(e=>{const m=(e=>{const{t:a}=Ga();return j&&I?I(e):!j&&T?T(e):E?E(e):null})(e);return t(Kl,{children:[a(Yl,{asChild:!0,children:m?a("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):o?.(e)},children:m}):a(Gi,{className:Fi("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",p&&n.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",j&&"flex-row"),onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):o?.(e)},children:t(Xi,{className:Fi("p-4",j&&"flex items-center gap-4 w-full"),children:[p&&a("div",{className:Fi(j?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a(yd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),j?t(r,{children:[a("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:i.map(r=>t("div",{className:"flex items-center gap-2 min-w-0",children:[t("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground truncate",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key)))}),(o||s||c)&&a("div",{onClick:e=>e.stopPropagation(),children:c?c(e):a(cd,{onEdit:o?()=>o(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]}):t("div",{className:"flex items-start gap-3",children:[p&&a("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a(yd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),t("div",{className:"flex-1 min-w-0",children:[i.map((r,n)=>t("div",{className:Fi("flex justify-between items-start gap-2",n!==i.length-1&&"mb-2"),children:[t("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground text-right truncate",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key))),(o||s||c)&&a("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):a(cd,{onEdit:o?()=>o(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})]})})}),a(td,{className:"w-[160px]",children:a(dd,{onEdit:o?()=>o(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,canDelete:!!d,customActions:u?u(e):[],renderAs:"context"})})]},e.id)})})})]})};function Pv({data:e,columns:r,sortField:n,sortDirection:d,onSort:c,onRowClick:u,renderActions:m,isLoading:p=!1,emptyMessage:h,className:f,enableSelection:g=!1,selectedIds:v=[],onSelectItem:b,onSelectAll:x,isAllSelected:y=!1,enableColumnResize:N=!0,onColumnResize:w,enableColumnReorder:_=!1,onReorderColumns:C,storageKey:k,enableExpandableRows:S=!1,renderExpandedContent:A,expandedRowIds:E,onToggleExpand:P,defaultExpandAll:I=!1,rowActionsVariant:T="default",hideActionsColumn:M=!1,actionsHeaderContent:R}){const{t:L}=Ga(),z=h||L("no_items_found",L("no_items_found_empty")),[F,j]=o(()=>I?new Set(e.map(e=>e.id)):new Set),O=void 0!==E,B=O?new Set(E):F,$=l(e=>{O&&P?P(e):j(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[O,P]),{columnWidths:V,isDragging:q,activeColumn:W,handleMouseDown:H}=pd({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:k?`${k}-columns`:void 0,onResize:w,enabled:N}),G=_d({enabled:_&&!!C,onReorder:C??(()=>{})}),K=s(()=>{if(N){const e=r.map(e=>V[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,N,V]);if(p)return a("div",{className:"flex-1 overflow-auto",children:a("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>a(Is,{className:"h-12 w-full"},t))})});if(0===e.length)return a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"text-center text-muted-foreground",children:a("p",{children:z})})});const Y=m&&!M,Q=(g?1:0)+(S?1:0)+r.length+(Y?1:0);return a("div",{className:"flex-1 overflow-auto "+(q?"select-none":""),children:t(Il,{className:Fi("table-fixed w-full",f),children:[a(Tl,{className:"sticky top-0 bg-background z-10",children:t(Ll,{children:[S&&a(zl,{className:"w-[40px]"}),g&&a(zl,{className:"w-[40px]",children:a(Wo,{checked:y,onCheckedChange:x,"aria-label":L("select_all","Selecionar todos")})}),r.map((e,r)=>{const i=N&&!1!==e.resizable,o=W===String(e.key),s=_&&!!C,l=s?G.getDragProps(r):{},u=G.dragFromIndex===r,m=G.dragOverIndex===r&&G.dragFromIndex!==r;return t(zl,{className:Fi(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",s&&G.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:K[r]},...l,children:[!1!==e.sortable&&c?t("button",{onClick:()=>c(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),n!==p?null:a("asc"===d?re:ne,{size:14,className:"ml-1"}))]}):a("span",{className:"font-medium",children:e.header}),i&&a(Gl,{direction:"horizontal",onMouseDown:a=>H(String(e.key),a),isDragging:o})]},String(e.key));var p}),Y&&a(zl,{className:"w-[80px] text-right",children:R??L("actions","Ações")})]})}),a(Ml,{children:e.map(e=>{const n=S&&B.has(e.id);return t(i.Fragment,{children:[t(Ll,{onClick:()=>u?.(e),className:Fi(u?"cursor-pointer":"","relative","inline"===T&&"group"),children:[S&&a(Fl,{className:"w-[40px] px-2",children:a("button",{onClick:a=>{a.stopPropagation(),$(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":n?L("collapse_row","Recolher linha"):L("expand_row","Expandir linha"),children:a(n?D:U,{size:16,className:"text-muted-foreground"})})}),g&&a(Fl,{children:a(Wo,{checked:v.includes(e.id),onCheckedChange:()=>b?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${L("select_all","Selecionar todos")} ${e.id}`})}),r.map(t=>a(Fl,{className:t.className,children:a(Hl,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),Y&&a(Fl,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===T?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:m(e)}):m(e)})]}),n&&A&&a(Ll,{className:"bg-muted/30 hover:bg-muted/30",children:a(Fl,{colSpan:Q,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:A(e)})})})]},e.id)})})]})})}function Iv({onEdit:e,onDelete:r,onToggleStatus:n,isActive:i=!0,canEdit:o=!0,canDelete:l=!0,customActions:d=[],renderAs:c="dropdown",variant:u="default"}){const{t:m}=Ga(),p=s(()=>{const a=[];return e&&o&&a.push({key:"edit",icon:V,label:m("edit","Editar"),onClick:e,variant:"default"}),n&&a.push({key:"toggle-status",icon:i?q:W,label:i?m("deactivate","Inativar"):m("activate","Ativar"),onClick:n,variant:"default"}),d.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&&l&&a.push({key:"delete",icon:H,label:m("remove","Remover"),onClick:r,variant:"destructive"}),a},[e,r,n,i,o,l,d,m]);return 0===p.length?null:"dropdown"===c?a(hs,{delayDuration:200,children:t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a(A,{size:"compact"===u?14:16})})}),a(ss,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t(bs,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t(ls,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):a("div",{className:"flex items-center gap-1",children:p.map(e=>t($i,{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(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&a("span",{className:"ml-1",children:e.label})]},e.key))})}function Tv({searchValue:e="",onSearchChange:r,customFilters:n=[],onClearFilters:i,showClearButton:o=!0,layout:s="horizontal"}){const{t:l}=Ga(),d=e||n.length>0;return t("div",{className:`flex ${"vertical"===s?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[r&&t("div",{className:"relative flex-1 min-w-[200px]",children:[a(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{type:"text",placeholder:l("search","Pesquisar"),value:e,onChange:e=>r(e.target.value),className:"pl-9 h-9"})]}),n.map((e,t)=>a("div",{className:"vertical"===s?"w-full":"",children:e},t)),o&&d&&i&&t($i,{variant:"ghost",size:"sm",onClick:i,className:"h-9 px-3 whitespace-nowrap",children:[a(E,{size:14,className:"mr-1"}),l("clear_filters","Limpar filtros")]})]})}function Mv(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 n of t){if(n.id===a)return r(n.children),!0;if(n.children&&e(n.children))return!0}return!1}(e),t}function Rv({children:e,itemId:t,enableDrag:r,onDragStartCell:n,onDragEndCell:i,onDragOverCell:o,onDropCell:s,className:l}){return a(Fl,{draggable:r,onDragStart:r?e=>n(t,e):void 0,onDragEnd:r?i: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(),s(t,e)},className:l,children:e})}function Lv({item:e,level:n,columns:i,nameKey:o,iconComponent:s,expandedIds:l,onToggleExpand:d,onRowClick:c,renderActions:u,rowActionsVariant:m="default",enableSelection:p,selectedIds:h,onSelectItem:f,enableRowDrag:g,draggedId:v,dragOverId:b,onDragStartCell:x,onDragEndCell:y,onDragOverCell:N,onDropCell:w,dragCount:_}){const C=l.has(e.id),k=(e.children?.length??0)>0,S=24*n,A="inline"===m,E=v===e.id||h?.has(e.id)&&v&&h?.has(v),P=b===e.id&&v!==e.id,I=h?.has(e.id)??!1,T={itemId:e.id,enableDrag:g,onDragStartCell:x,onDragEndCell:y,onDragOverCell:N,onDropCell:w};return t(r,{children:[t(Ll,{className:Fi(c&&"cursor-pointer",A&&"group",E&&"opacity-40",P&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:c?()=>c(e):void 0,children:[a(Rv,{...T,children:t("div",{className:"flex items-center gap-2",style:{paddingLeft:`${S}px`},children:[p&&a(Wo,{checked:I,onCheckedChange:()=>f?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),g&&a("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),k?a("button",{onClick:a=>{a.stopPropagation(),d(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:a(C?D:U,{className:"h-4 w-4"})}):a("div",{className:"w-6 shrink-0"}),s??a(ge,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a("span",{className:"truncate",children:String(e[o]??e.id)}),v===e.id&&_&&_>1&&a("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:_})]})}),i.map(r=>{const i=e[r.key],o=r.render?r.render(e,n):null!=i?String(i):"—";return a(Rv,{...T,className:Fi("text-center",r.className),children:r.hoverContent?t(Ku,{openDelay:200,children:[a(Yu,{asChild:!0,children:a("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:o})}),a(Qu,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):o},String(r.key))}),u&&a(Rv,{...T,className:"text-right",children:a("div",{onClick:e=>e.stopPropagation(),className:Fi("flex items-center justify-end gap-1",A&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:u(e)})})]}),k&&C&&e.children.map(e=>a(Lv,{item:e,level:n+1,columns:i,nameKey:o,iconComponent:s,expandedIds:l,onToggleExpand:d,onRowClick:c,renderActions:u,rowActionsVariant:m,enableSelection:p,selectedIds:h,onSelectItem:f,enableRowDrag:g,draggedId:v,dragOverId:b,onDragStartCell:x,onDragEndCell:y,onDragOverCell:N,onDropCell:w,dragCount:_},e.id))]})}function zv({onDrop:r,isDragOver:n,onDragOver:i,onDragLeave:o,label:s}){return t("div",{className:Fi("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",n?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:i,onDragEnter:i,onDragLeave:o,onDrop:r,children:[a(pa,{className:"h-4 w-4"}),s??e.t("leadership_make_root_short")]})}function Fv({data:r,columns:n,nameKey:s,nameHeader:d=e.t("ap_name"),iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,actionsHeader:g="",rowActionsVariant:v="default",isLoading:b,emptyMessage:x="Nenhum registro encontrado.",className:y,enableSelection:N,selectedIds:w,onSelectItem:_,onSelectAll:C,isAllSelected:k,enableRowDrag:S,onMoveNode:A,onMoveNodes:E,rootDropLabel:D,actionsWidth:P=20,nameMinWidth:I=200}){const[T,M]=o(null),[R,L]=o(null),[z,F]=o(!1),[U,j]=o(1),O=u(null),B=u([]),$=u(null),V=i.useMemo(()=>new Set(w??[]),[w]),q=i.useMemo(()=>{if(!T||!r)return new Set;const e=B.current.length>0?B.current:[T],a=function(e,a){const t=new Set;for(const r of a)Mv(e,r).forEach(e=>t.add(e));return t}(r,e);return e.forEach(e=>a.add(e)),a},[T,r]),W=u(q);W.current=q;const H=l(()=>{O.current=null,B.current=[],$.current=null,M(null),L(null),F(!1),j(1)},[]),G=l((e,a)=>{e.length>1&&E?E(e,a):1===e.length&&A?.(e[0],a)},[A,E]),K=l((e,a)=>{const t=V.has(e)&&V.size>1?Array.from(V):[e];O.current=e,B.current=t,$.current=null,M(e),j(t.length),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",e),a.dataTransfer.setData("application/x-tree-ids",JSON.stringify(t))},[V]),Y=l((e,a)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",W.current.has(e)?L(null):($.current=e,L(e))},[]),Q=l((e,a)=>{a.preventDefault(),a.stopPropagation();const t=W.current.has(e)?$.current:e;if(!t)return void H();let r=B.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)||G(r,t),H()},[G,H]),X=l(e=>{e.preventDefault(),e.stopPropagation();let a=B.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?(G(a,null),H()):H()},[G,H]),J=l(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",F(!0)},[]),Z=l(e=>{S&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[S]),ee=l(e=>{if(!S)return;const a=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),t=a?.dataset?.treeRowId??$.current;t&&Q(t,e)},[S,Q]);if(b)return a("div",{className:"flex items-center justify-center py-12",children:t("div",{className:"text-center space-y-2",children:[a("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[a(ge,{className:"h-10 w-10 text-muted-foreground/50"}),a("p",{className:"text-sm text-muted-foreground",children:x})]});const ae=null!==T;return t("div",{className:Fi("border rounded-lg overflow-hidden relative",y),onDragOver:Z,onDrop:ee,onDragLeave:S?e=>{const a=e.relatedTarget;a&&e.currentTarget.contains(a)||(L(null),F(!1))}:void 0,children:[S&&ae&&a(zv,{onDrop:X,isDragOver:z,onDragOver:J,onDragLeave:()=>F(!1),label:D}),t(Il,{children:[a(Tl,{children:t(Ll,{children:[a(zl,{className:"text-left",style:{minWidth:I},children:t("div",{className:"flex items-center gap-2",children:[N&&a(Wo,{checked:k??!1,onCheckedChange:()=>C?.()}),d]})}),n.map(e=>a(zl,{className:Fi("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),f&&a(zl,{className:"text-right",style:{width:P},children:g})]})}),a(Ml,{children:r.map(e=>a(Lv,{item:e,level:0,columns:n,nameKey:s,iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,rowActionsVariant:v,enableSelection:N,selectedIds:V,onSelectItem:_,enableRowDrag:S,draggedId:T,dragOverId:R,onDragStartCell:K,onDragEndCell:H,onDragOverCell:Y,onDropCell:Q,dragCount:U},e.id))})]})]})}function Uv(e){const a=nt();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)}}}function jv(e,a){const t=Uv({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}}const Ov=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],Bv=({open:e,onOpenChange:r,user:n,userPhotoUrl:i,userInitials:s})=>{const{t:l,i18n:d}=Ga(),c=u(null),[m,p]=o(null),[h,f]=o(d.language||"pt-BR"),g=m||i,v=e=>{e||(p(null),f(d.language||"pt-BR")),r(e)};return a(mo,{open:e,onOpenChange:v,children:t(bo,{className:"sm:max-w-md",children:[a(xo,{children:a(wo,{children:l("edit_profile","Editar Perfil")})}),t("div",{className:"space-y-6 py-4",children:[t("div",{className:"flex items-center gap-4",children:[a("div",{className:"relative flex-shrink-0",children:t(yu,{className:"w-24 h-24",children:[g&&a(Nu,{src:g,alt:n.name||""}),a(wu,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:s})]})}),t("div",{className:"space-y-1",children:[n.name&&a("p",{className:"text-base font-semibold",children:n.name}),n.email&&a("p",{className:"text-sm text-muted-foreground",children:n.email}),t($i,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a(ha,{className:"mr-2 h-4 w-4"}),l("change_photo","Trocar foto")]}),a("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);p(t)}})]})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:l("language","Idioma")}),t(Lo,{value:h,onValueChange:f,children:[a(Uo,{children:a(Fo,{})}),a(Bo,{children:Ov.map(e=>a(Vo,{value:e.value,children:e.label},e.value))})]})]})]}),t(No,{children:[a($i,{variant:"outline",onClick:()=>v(!1),children:l("cancel","Cancelar")}),a($i,{onClick:()=>{h!==d.language&&d.changeLanguage(h),r(!1)},children:l("save","Salvar")})]})]})})},$v="true"===import.meta.env.VITE_SHOW_EDIT_PROFILE,Vv=i.memo(({variant:e="card",className:n="",selectedUnit:l,onUnitChange:d})=>{const{t:c}=Ga(),{user:u,companies:m,alias:p,isAuthenticated:h,logout:f,switchUnit:g}=Sl(),{role:v}=ru(),b=v?.name||null,x=m?.[0]||null,y=p?m?.find(e=>e.alias===p):x,N=m||[],w=l||y||x||x,_=s(()=>{if(!u?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${u.id}/${e}/1?size=48`},[u?.id]),C=s(()=>{if(!u?.name)return"";const e=u.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[u?.name]),k=i.useCallback(e=>{d?d(e):g(e)},[d,g]),S=i.useMemo(()=>{if(!N?.length)return[];const e=new Map;N.forEach(a=>{e.set(a.alias,a)});const a=Array.from(e.values()),t=a.find(e=>e.alias===w?.alias),r=a.filter(e=>e.alias!==w?.alias);return r.sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"})),t?[t,...r]:r},[N,w?.alias]),[A,E]=o(!1);if(!h||!u)return null;return"dropdown"===e?t(r,{children:[t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${n}`,children:t("div",{className:"flex items-center space-x-2",children:[t("div",{className:"hidden md:block text-right",children:[t("p",{className:"text-sm font-medium",children:[u.name?.split(" ")[0],b?` [${b}]`:""]}),a("p",{className:"text-xs text-primary-foreground/70",children:w?.name||"N/A"})]}),t(yu,{className:"w-8 h-8 border border-primary-foreground/30",children:[_&&a(Nu,{src:_,alt:u.name||c("user_photo")}),a(wu,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||a(ge,{className:"h-4 w-4"})})]}),a(D,{className:"h-4 w-4"})]})})}),t(ss,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t(rs,{children:[t(is,{children:[a(ue,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a(os,{children:S.map(e=>t(ls,{onClick:()=>k(e),className:e.alias===w?.alias?"bg-muted":"",children:[a(fe,{className:"mr-2 h-4 w-4"}),e.name,e.alias===w?.alias&&a(Ko,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),$v&&t(r,{children:[a(ms,{}),t(ls,{onClick:()=>E(!0),children:[a(fa,{className:"mr-2 h-4 w-4"}),c("edit_profile","Editar Perfil")]})]}),a(ms,{}),t(ls,{onClick:f,children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),$v&&a(Bv,{open:A,onOpenChange:E,user:u,userPhotoUrl:_,userInitials:C})]}):t(Gi,{className:n,children:[a(Ki,{children:a(Yi,{className:"text-lg",children:c("user_info")})}),t(Xi,{className:"space-y-4",children:[a(()=>t(r,{children:[t("div",{className:"flex items-center space-x-3",children:[a("div",{className:"flex-shrink-0",children:t(yu,{className:"w-10 h-10",children:[_&&a(Nu,{src:_,alt:u.name||c("user_photo")}),a(wu,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||a(ge,{className:"h-5 w-5"})})]})}),t("div",{className:"flex-1 min-w-0",children:[a("p",{className:"text-sm font-medium truncate",children:u.name}),t("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",w?.name||"N/A"]})]})]}),w&&a("div",{className:"mt-3",children:t("div",{className:"flex items-center space-x-2",children:[a(fe,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-sm font-medium",children:w.name})]})}),S.length>1&&t("div",{className:"mt-2",children:[t("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>a(Ko,{variant:e.alias===w?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t(Ko,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]}),{}),a(Zi,{}),t($i,{variant:"outline",onClick:f,size:"sm",className:"w-full",children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),qv=d({});function Wv({children:e,config:t}){const r=s(()=>{const e=mr(),a=t?.appName?e?`${t.appName} (Dev)`:t.appName:void 0;return{navigation:t?.navigation,appName:a}},[t?.navigation,t?.appName]);return a(qv.Provider,{value:r,children:e})}function Hv(){return c(qv)}function Gv(){const e=it(),{navigation:a}=Hv();return Kv(a,e.pathname)}function Kv(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 Yv(e,a){const[t,r]=o(e),n=u(),i=l(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return m(()=>(i(),n.current=setTimeout(()=>{r(e)},a),i),[e,a,i]),[t,i]}function Qv({appName:e}){const[n,i]=o(!1);return t(r,{children:[t("div",{className:"flex items-center justify-between w-[258px]",children:[a("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>i(!0),children:a("img",{src:Sr.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&a("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:()=>i(!0),children:a("span",{className:"line-clamp-2",children:(e=>{const n=e.split(" ");if(n.length<=1)return t("span",{className:"whitespace-nowrap",children:[e," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const i=n[n.length-1],o=n.slice(0,-1).join(" ");return t(r,{children:[o," ",t("span",{className:"whitespace-nowrap",children:[i," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),a(iu,{open:n,onOpenChange:i})]})}const Xv=p(function({actions:r}){const n=it(),i=nt(),{navigation:s,appName:d}=Hv(),c=Kv(s,n.pathname),{metadata:u,headerActions:p}=mc(),{setOpenMobile:h}=ep(),{companies:f,alias:g,isSearchVisible:v,clearSearch:b,refreshData:x,switchUnit:y}=Sl(),N=g?f?.find(e=>e.alias===g)||f?.[0]||null:f?.[0]||null,[w,_]=tt(),C=l(e=>{const{pathname:a,search:t,hash:r}=n;if(g){const n=a.split("/"),o=n.indexOf(g);if(o>=0)return n[o]=e.alias,void i(n.join("/")+t+r)}y(e)},[g,n,i,y]),[k,S]=o(()=>w.get("search")||""),[A,D]=Yv(k,fr.debounceDelay);m(()=>{if(!v)return;const e=new URLSearchParams(w);A?(e.set("search",A),e.set("page","1")):e.delete("search"),_(e)},[A,_,v]);const P=s?.find(e=>e.path===n.pathname)||s?.find(e=>n.pathname.startsWith(e.path+"/")),I=u.title||c,T=u.subtitle||P?.complementaryText||"";return a("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t("div",{className:"flex items-center gap-4",children:[a($i,{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:()=>h(!0),children:a(ga,{size:20})}),a("div",{className:"hidden md:flex items-center flex-shrink-0",children:a(Qv,{appName:d})}),a("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t("div",{className:"flex-shrink-0",children:[u.breadcrumbs&&u.breadcrumbs.length>0&&a("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:u.breadcrumbs.map((e,r)=>t("span",{className:"flex items-center gap-1",children:[r>0&&a(U,{className:"h-3 w-3"}),e.href?a(st,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):a("span",{children:e.label})]},r))}),a("div",{className:"flex items-center gap-2 mb-1",children:a("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:I})}),T&&a("div",{className:"text-sm text-primary-foreground/70 truncate",children:T})]}),v&&t("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(qi,{placeholder:"Pesquisar",value:k,onChange:e=>{return a=e.target.value,void S(a);var a},className:"w-full pl-10 pr-8"}),k&&a($i,{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:()=>{D(),S("");const e=new URLSearchParams(w);e.delete("search"),e.delete("page"),_(e)},title:e.t("clear_search"),children:a(E,{size:14})})]}),a($i,{variant:"outline",size:"sm",onClick:x,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(ue,{size:14})})]}),t("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(p||r)&&a("div",{className:"flex items-center gap-2",children:p||r}),import.meta.env.VITE_WIKI_URL&&a($i,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>Li(import.meta.env.VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a(Nh,{}),a("div",{className:"text-sm",children:a(Vv,{variant:"dropdown",selectedUnit:N,onUnitChange:C})})]})]})})}),Jv=({key:e,enabled:a,checkFn:t,staleTime:r=3e5,gcTime:n=6e5})=>Ja({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:r,gcTime:n,retry:0,refetchOnWindowFocus:!1});function Zv({config:e,isCollapsed:n=!1,isDisabled:i=!1,className:o}){const{t:s}=Ga(),{actions:l,triggerLabel:d="Criar",triggerIcon:c=Q,variant:u="button"}=e;if(!l||0===l.length)return null;if("split-button"===u){const e=l[0],r=e.icon||c,s=l.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(n){const n=a($i,{onClick:e.onClick,disabled:i||e.disabled,className:Fi("justify-center px-2 w-full",o),variant:"outline",size:"default",children:a(r,{className:"h-4 w-4 shrink-0"})});return t(fs,{children:[a(gs,{asChild:!0,children:n}),a(vs,{side:"right",children:a("p",{children:e.label})})]})}return a(lh,{label:e.label,onClick:e.onClick,icon:r,actions:s,variant:"outline",disabled:i||e.disabled,className:Fi("w-full",o),menuAlign:"start"})}const m=(e,i,o=!1)=>t(r,{children:[e,!n&&i&&a("span",{className:"truncate",children:i}),!n&&o&&a(D,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(l.length>1)){const e=l[0],r=e.icon||c,s=i||e.disabled,d=a($i,{onClick:e.onClick,disabled:s,className:Fi("w-full gap-2 justify-start",n&&"justify-center px-2",o),variant:"outline",size:"default",children:m(a(r,{className:"h-4 w-4 shrink-0"}),e.label)});return n?t(fs,{children:[a(gs,{asChild:!0,children:d}),a(vs,{side:"right",children:a("p",{children:e.label})})]}):d}const p=a($i,{disabled:i,className:Fi("w-full gap-2 justify-start",n&&"justify-center px-2",o),variant:"outline",size:"default",children:m(a(c,{className:"h-4 w-4 shrink-0"}),d,!0)});return t(Zo,{children:[a(es,{asChild:!0,children:n?t(fs,{children:[a(gs,{asChild:!0,children:p}),a(vs,{side:"right",children:a("p",{children:d})})]}):p}),a(ss,{align:"start",side:n?"right":"bottom",className:"w-56 bg-popover",children:l.map(e=>{const r=e.icon;return t(ls,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const eb="forlogic-sidebar-pinned",ab=()=>{try{const e=localStorage.getItem(eb);return!!e&&JSON.parse(e)}catch{return!1}};function tb({direction:e="right",minWidth:a=224,maxWidth:t=384,defaultWidth:r=290,storageKey:n="sidebar-width",onResize:i,isOpen:s=!0}={}){const[d,c]=o(()=>{if("undefined"==typeof window)return r;const e=localStorage.getItem(n);return e?parseInt(e):r}),[p,h]=o(!1),f=u(null);m(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(s?e.style.setProperty("--sidebar-width",`${d}px`):e.style.setProperty("--sidebar-width","290px"))},[d,s]);const g=l(e=>{e.preventDefault(),h(!0)},[]);return m(()=>{if(!p)return;const r=r=>{let n;n="left"===e?window.innerWidth-r.clientX:r.clientX,n=Math.max(a,Math.min(t,n)),c(n),i?.(n)},o=()=>{h(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",o),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o)}},[p,e,a,t,d,n,i]),m(()=>(p?(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=""}),[p,e]),{width:d,isDragging:p,dragRef:f,handleMouseDown:g}}const rb=d(void 0);function nb({children:e}){const[t,r]=o(new Set),[n,i]=o(!1),d=l(e=>{r(a=>{const t=new Set(a);return t.add(e),t})},[]),c=l(e=>{r(a=>{const t=new Set(a);return t.delete(e),t})},[]),u=l(e=>{i(e)},[]),m=s(()=>t.size>0||n,[t,n]),p=s(()=>({openModals:t,hasOpenModal:m,registerModal:d,unregisterModal:c,setHasOpenModal:u}),[t,m,d,c,u]);return a(rb.Provider,{value:p,children:e})}function ib(){const e=c(rb);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function ob(){const{hasOpenModal:e}=ib();return e}function sb({config:e,customContent:r,resizable:n=!1,minWidth:i=224,maxWidth:s=384}={}){const{t:d}=Ga(),{open:c,setOpen:u,setOpenMobile:p}=ep(),h=it(),{alias:f,user:g}=Sl(),{appName:v}=Hv(),{hasOpenModal:b}=ib(),[x,y]=o(ab),N=Pl(),w=!!N||c,_=l(()=>{N&&p(!1)},[N,p]),C=n?tb({minWidth:i,maxWidth:s,storageKey:"app-sidebar-width",isOpen:c}):null;m(()=>{u(!!x)},[x,u]);const k=e=>h.pathname===e||h.pathname.startsWith(e+"/");return t(tp,{collapsible:"icon",className:Fi("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:C&&w?{width:`${C.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&a("div",{className:"py-3",children:a(hs,{children:a(Zv,{config:e.moduleActions,isCollapsed:!w,isDisabled:b})})}),a(cp,{className:Fi(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||a(up,{className:"p-0",children:a(hp,{children:a(fp,{className:"gap-1",children:a(hs,{children:e?.navigation?.map((e,r)=>{if("separator"===e.type)return a(dp,{className:"my-2"},`sep-${r}`);const n=({item:e,index:r})=>{const i=`${e.path}-${r}-${f??"noalias"}-${g?.id??"nouser"}`,{data:o=!0,isLoading:s}=Jv({key:i,enabled:Boolean(e.permissionCheck&&f&&g?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!o,c=s?T:l?He:e.icon;l?d("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?a(Ec,{defaultOpen:!0,className:"group/collapsible",children:t(gp,{children:[a(Dc,{asChild:!0,children:a(bp,{size:"default",children:t("div",{className:"flex w-full items-center gap-3",children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4"})}),a("span",{className:"font-medium sidebar-text",children:e.label}),a(U,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),a(Pc,{children:a(wp,{children:e.children.map((e,t)=>a(n,{item:e,index:t},e.path))})})]})},e.path):a(gp,{children:t(fs,{children:[a(gs,{asChild:!0,children:a("div",{className:Fi("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(c,{className:"h-4 w-4"})})}),a(vs,{side:"right",children:a("p",{children:e.label})})]})},e.path):a(gp,{children:l||s?t(fs,{children:[a(gs,{asChild:!0,children:w?a(bp,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t("div",{className:"flex w-full items-center gap-3",children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4 "+(s?"animate-spin":"")})}),a("span",{className:"font-medium sidebar-text",children:e.label})]})}):a("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(c,{className:"h-4 w-4 "+(s?"animate-spin":"")})})}),a(vs,{side:"right",children:a("p",{children:s?"Verificando acesso...":d("restricted_access")})})]}):w?a(bp,{asChild:!0,isActive:k(e.path),size:"default",children:t(st,{to:e.path,className:"flex w-full items-center gap-3",onClick:_,children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4"})}),a("span",{className:"font-medium sidebar-text",children:e.label})]})}):t(fs,{children:[a(gs,{asChild:!0,children:a(st,{to:e.path,onClick:_,className:Fi("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",k(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:a(c,{className:"h-4 w-4"})})}),a(vs,{side:"right",children:a("p",{children:e.label})})]})},e.path)};return a(n,{item:e,index:r},e.path)})})})})})}),!N&&a("div",{className:Fi("mt-auto pb-4 pt-2 flex",c?"justify-end":"justify-center"),children:t(fs,{children:[a(gs,{asChild:!0,children:a("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!x;y(e),(e=>{try{localStorage.setItem(eb,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:a(c?oe:U,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a(vs,{side:"right",children:a("p",{children:c?"Recolher":"Expandir"})})]})}),n&&C&&w&&a("div",{ref:C.dragRef,onMouseDown:C.handleMouseDown,className:Fi("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-['']",C.isDragging&&"bg-primary/40")})]})}const lb=p(function({children:e,sidebar:r,sidebarConfig:n,showHeader:i=!0}){const o=s(()=>r||a(sb,{config:n}),[r,n]),d=s(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=u(null),p=u(null),h=l(()=>{if(c.current&&p.current){const e=c.current.offsetHeight;p.current.style.setProperty("--header-height",`${e}px`)}},[]);return m(()=>{h();const e=new ResizeObserver(h);return c.current&&e.observe(c.current),()=>e.disconnect()},[h]),a(Wv,{config:n,children:a(uc,{children:a(ap,{defaultOpen:!1,style:d,children:t("div",{ref:p,className:"flex flex-col h-screen w-full overflow-hidden",children:[i&&a("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:a(Xv,{})}),t("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[o,a("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:a("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});function db({open:e,appName:n}){const[i,s]=o(!1);return t(r,{children:[a(sp,{className:"p-0 gap-0",children:e?t("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[a("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:a("img",{src:Sr.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),n&&a("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:()=>s(!0),children:a("span",{className:"line-clamp-2",children:(e=>{const n=e.split(" ");if(n.length<=1)return t("span",{className:"whitespace-nowrap",children:[e," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const i=n[n.length-1],o=n.slice(0,-1).join(" ");return t(r,{children:[o," ",t("span",{className:"whitespace-nowrap",children:[i," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(n)})})]}):a("div",{className:"flex flex-col items-center justify-center w-full",children:a("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>s(!0),children:a("img",{src:Sr.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a(iu,{open:i,onOpenChange:s})]})}function cb({title:e,subtitle:r,children:n,className:i,hasHeader:o=!0}){const s=e||r;return t("div",{className:Fi("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",i),children:[o&&s&&t("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&a("h2",{className:"text-xl font-semibold text-foreground",children:e}),r&&a("p",{className:"text-sm text-muted-foreground mt-0.5",children:r})]}),n&&a("div",{className:Fi("p-6",!o&&s&&"pt-4"),children:n})]})}function ub({breadcrumbs:e,children:r,className:i}){return t("div",{className:Fi("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",i),children:[e&&e.length>0&&a(_u,{className:"mb-4",children:a(Cu,{children:e.map((r,i)=>{const o=i===e.length-1;return t(n.Fragment,{children:[i>0&&a(Eu,{}),a(ku,{children:o||!r.href?a(Au,{children:r.label}):r.asChild&&r.children?a(Su,{asChild:!0,children:r.children}):a(Su,{asChild:!0,children:a(st,{to:r.href||"/",children:r.label})})})]},`${r.label}-${i}`)})})}),a("div",{className:"space-y-6",children:r})]})}const mb=(e={})=>{const{enabled:a=!0}=e,{alias:t}=Sl();return Ja({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=nl(),{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(!sl.handleError(r))throw r;return[]}return a||[]},enabled:a&&!!t})};function pb({rowIds:e,defaultHeight:a=48,minHeight:t=32,maxHeight:r=120,storageKey:n,onResize:i,enabled:s=!0}){const[d,c]=o(()=>{if(!s||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[p,h]=o(!1),[f,g]=o(null),v=u(0),b=u(0),x=l(e=>d[e]??a,[d,a]),y=l((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),h(!0),g(e),v.current=t.clientY,b.current=d[e]??a)},[s,d,a]);m(()=>{if(!p||!f)return;const e=e=>{const a=e.clientY-v.current,n=Math.max(t,Math.min(r,b.current+a));c(e=>{const a={...e,[f]:n};return i?.(a),a})},a=()=>{h(!1),g(null),n&&c(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)}},[p,f,t,r,n,i]),m(()=>(p?(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=""}),[p]);const N=l(()=>{c({}),n&&localStorage.removeItem(n),i?.({})},[n,i]);return{rowHeights:d,isDragging:p,activeRow:f,handleMouseDown:y,resetHeights:N,getRowHeight:x}}function hb(e){const{steps:a,initialStep:t=0,initialData:r={},onComplete:n,onCancel:i}=e,[d,c]=o(t),[u,m]=o(r),[p,h]=o(!1),[f,g]=o(!1),v=a.length,b=0===d,x=d===v-1,y=a[d],N=v>1?(d+1)/v*100:100,w=l(()=>!y?.canProceed||y.canProceed(),[y]),_=s(()=>w(),[w,u]),C=s(()=>!b&&!y?.disableBack,[b,y]),k=l(e=>{m(a=>({...a,...e}))},[]),S=l((e,a)=>{m(t=>({...t,[e]:a}))},[]),A=l(()=>{c(t),m(r),h(!1),g(!1),i?.()},[t,r,i]),E=l(async()=>{if(w()&&!f){g(!0);try{await(n?.(u))}finally{g(!1)}}},[w,f,u,n]),D=l(async()=>{w()&&!p&&(x?await E():c(e=>Math.min(e+1,v-1)))},[w,p,x,v,E]),P=l(()=>{C&&!p&&c(e=>Math.max(e-1,0))},[C,p]),I=l(e=>{e<0||e>=v||p||(e<=d||e===d+1)&&c(e)},[d,v,p]),T=l(e=>{h(e)},[]);return{currentStep:d,currentStepConfig:y,data:u,isFirstStep:b,isLastStep:x,isLoading:p,isCompleting:f,next:D,back:P,goTo:I,canProceed:_,canGoBack:C,setData:k,updateField:S,reset:A,complete:E,setLoading:T,progress:N,stepIndex:d,totalSteps:v}}function fb(...e){return Object.assign({},...e)}const gb=()=>{const{locale:e,timezone:a}=Cc(),t=fi;return{formatDatetime:r=>Ei(r,t,a,e),formatDate:t=>Di(t,e,a),locale:e,timezone:a,datetimeFormat:t}};class vb{static async sendEmail(e){const a=nl(),{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 bb=vb;function xb({open:e,onOpenChange:r,placeId:n,placeName:i,onMakeManager:l,onMakeMembers:d,currentManagerId:c,currentMemberIds:u=[]}){const{t:m}=Ga(),[p,h]=o([]),[f,g]=o(!1),[v,b]=o(""),{data:x=[],isLoading:y}=Fd({enabled:e}),N=s(()=>{let e=[...x];if(e.sort((e,a)=>{const t=e.userName?.toLowerCase()||"",r=a.userName?.toLowerCase()||"";return t.localeCompare(r)}),v){const a=v.toLowerCase();e=e.filter(e=>e.userName?.toLowerCase().includes(a)||e.userEmail?.toLowerCase().includes(a))}return e},[x,v]),w=e=>{h(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},_=1===p.length,C=p.length>0;return a(mo,{open:e,onOpenChange:r,children:t(bo,{className:"max-w-2xl",variant:"form",children:[a(xo,{showSeparator:!0,children:t(wo,{className:"flex items-center gap-2",children:[a(Ze,{className:"h-5 w-5"}),"Gerenciar Acessos - ",i]})}),t(yo,{children:[t("div",{className:"relative mb-4",children:[a(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(qi,{placeholder:"Pesquisar...",value:v,onChange:e=>b(e.target.value),className:"pl-9"})]}),a(Id,{className:"h-[400px] pr-4",children:y?a("div",{className:"space-y-2",children:[...Array(5)].map((e,t)=>a(Is,{className:"h-16 w-full"},t))}):0===N.length?t("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a(Ze,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),a("p",{className:"text-sm text-muted-foreground",children:m(v?"leadership_no_users_found":"leadership_no_users_available")})]}):a("div",{className:"space-y-2",children:N.map(e=>{const r=e.userId===c,n=u.includes(e.userId||""),i=p.includes(e.userId||"");return t("div",{className:Fi("flex items-center gap-3 p-3 rounded-lg border transition-colors",i&&"bg-accent border-primary","hover:bg-accent/50 cursor-pointer"),onClick:()=>w(e.userId||""),children:[a(Wo,{checked:i,onCheckedChange:()=>w(e.userId||""),onClick:e=>e.stopPropagation()}),t("div",{className:"flex-1",children:[t("div",{className:"flex items-center gap-2",children:[a("p",{className:"font-medium",children:e.userName}),r&&a(va,{className:"h-4 w-4 text-yellow-500"})]}),a("p",{className:"text-sm text-muted-foreground",children:e.userEmail})]}),(r||n)&&a("div",{className:"text-xs text-muted-foreground",children:r?"Gestor":"Membro"})]},e.userId)})})})]}),t(No,{className:"flex gap-2 sm:gap-2",children:[a("div",{className:"flex-1 text-sm text-muted-foreground",children:p.length>0&&t("span",{children:[p.length," selecionado(s)"]})}),_&&l&&t($i,{onClick:async()=>{if(l&&1===p.length){g(!0);try{await l(p[0],n),h([])}finally{g(!1)}}},disabled:f,variant:"outline",children:[a(va,{className:"h-4 w-4 mr-2"}),"Tornar Gestor"]}),C&&d&&t($i,{onClick:async()=>{if(d&&0!==p.length){g(!0);try{await d(p,n),h([])}finally{g(!1)}}},disabled:f,children:[a(ba,{className:"h-4 w-4 mr-2"}),"Tornar ",p.length>1?"Membros":"Membro"]})]})]})})}function yb({place:e,level:r=0,manageAccessConfig:n}){const{t:i}=Ga(),[s,l]=o(!1),[d,c]=o(!1),u=e.subPlaces&&e.subPlaces.length>0,m=e.isActive??!0,p=e.usersCount??0;return t("div",{children:[t(Ec,{open:s,onOpenChange:l,children:[t("div",{className:"flex items-center gap-2 py-3 px-4 hover:bg-accent/50 transition-colors",style:{paddingLeft:2*r+1+"rem"},children:[u?t(Dc,{className:"flex items-center gap-2 flex-1",children:[a(U,{className:Fi("h-4 w-4 transition-transform shrink-0",s&&"rotate-90")}),a(fe,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a("span",{className:"font-medium",children:e.name}),t("span",{className:"text-sm text-muted-foreground",children:["(",e.subPlaces.length,")"]})]}):t("div",{className:"flex items-center gap-2 flex-1",children:[a("div",{className:"w-4 shrink-0"}),a(fe,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a("span",{className:"font-medium",children:e.name})]}),t("div",{className:"flex items-center gap-3 ml-auto",children:[t("div",{className:"flex items-center gap-1.5",children:[a(Ze,{className:"h-3.5 w-3.5 text-muted-foreground"}),a("span",{className:"text-sm text-muted-foreground",children:p})]}),a(Ko,{variant:m?"default":"secondary",className:"text-xs",children:m?"Ativo":"Inativo"}),n&&a(Iv,{customActions:[{label:i("manage_access"),icon:xa,onClick:()=>c(!0),variant:"default"}],renderAs:"dropdown",variant:"compact"})]})]}),u&&a(Pc,{children:e.subPlaces.map(e=>a(yb,{place:e,level:r+1,manageAccessConfig:n},e.id))})]}),0===r&&a(Zi,{}),n&&a(xb,{open:d,onOpenChange:c,placeId:e.id,placeName:e.name,onMakeManager:n.onMakeManager,onMakeMembers:n.onMakeMembers,currentManagerId:n.getCurrentManagerId?.(e.id),currentMemberIds:n.getCurrentMemberIds?.(e.id)})]})}function Nb({places:e,isLoading:r,manageAccessConfig:n}){return r?a("div",{className:"flex items-center justify-center py-12",children:t("div",{className:"text-center space-y-2",children:[a("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a("p",{className:"text-sm text-muted-foreground",children:"Carregando dados..."})]})}):e&&0!==e.length?t("div",{className:"space-y-1",children:[a("h2",{className:"text-xl font-bold mb-4",children:"Estrutura de Locais"}),e.map(e=>a(yb,{place:e,manageAccessConfig:n},e.id))]}):t("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-3",children:[a(fe,{className:"h-12 w-12 text-muted-foreground/50"}),t("div",{children:[a("h3",{className:"font-semibold text-lg",children:"Nenhum local encontrado"}),a("p",{className:"text-sm text-muted-foreground",children:"Não há locais cadastrados para esta unidade."})]})]})}const wb=new class{get baseUrl(){return xr()}async makeApiCall(e,a,t){const r=ll.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const n=Qs.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!t||""===t.trim())throw new Error("Alias da unidade é obrigatório");const i=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{i.searchParams.append(e,a)});const o=await fetch(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"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 r=a.get(e.id);if(e.parentId){const n=a.get(e.parentId);n?(n.subPlaces=n.subPlaces||[],n.subPlaces.push(r)):t.push(r)}else t.push(r)}),t}async getPlaces(e,a){try{const t=await this.makeApiCall("/api/common/v1/places",{companyId:a},e),r=t.data||t||[];return this.buildHierarchy(r)}catch(t){if(await ll.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/places",{companyId:a},e),r=t.data||t||[];return this.buildHierarchy(r)}catch(r){return Xs.handleError(r instanceof Error?r:"Erro ao buscar locais após renovação de token",!0),[]}return Xs.handleError(t instanceof Error?t.message:"Erro ao buscar locais",!0),[]}}};function _b(e,a){const t=e.map(e=>({...e})),r=new Set(t.filter(e=>!a.has(e.id_user)).map(e=>e.id_user));return t.forEach(e=>{if(e.id_leader&&r.has(e.id_leader)){let a=e.id_leader;for(;a&&r.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))}function Cb(e){const a=new Map,t=new Map,r=[];e.forEach(e=>{const r={...e,children:[],level:0};a.set(e.id,r),t.set(e.id_user,r)}),e.forEach(e=>{const n=a.get(e.id);if(e.id_leader){const a=t.get(e.id_leader);if(a)return void a.children.push(n)}r.push(n)});const n=(e,a)=>{e.level=a,e.children.forEach(e=>n(e,a+1))};r.forEach(e=>n(e,0));const i=e=>{e.sort((e,a)=>{const t=e.name||e.id_user||e.email||"",r=a.name||a.id_user||a.email||"";return t.localeCompare(r)}),e.forEach(e=>e.children.length>0&&i(e.children))};return i(r),r}function kb(e){const a=[],t=e=>{a.push(e),e.children.forEach(t)};return e.forEach(t),a}function Sb(){const{alias:a,isAuthenticated:t}=Sl(),r=Qs.getAccessToken(),{data:n=[]}=Fd(),i=Ja({queryKey:["leadership-raw",a],queryFn:async()=>{if(!r||!a)throw new Error("Usuário não autenticado ou unidade não selecionada");const e=nl(),{data:t,error:n}=await e.schema("common").from("leaders").select("*").eq("is_removed",!1).eq("alias",a);if(n)throw new Error("Erro ao buscar hierarquia de liderança");return t??[]},enabled:!!r&&!!a&&t}),o=s(()=>{const a=i.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 r=a.map(r=>{const n=a.filter(e=>e.id_leader===r.id_user);return{...r,name:t[r.id_user]?.name||e.t("inactive_user"),email:t[r.id_user]?.email||"",subordinatesCount:n.length,subordinateNames:n.map(e=>t[e.id_user]?.name||"[Usuário inativo]").sort((e,a)=>e.localeCompare(a))}}),o=new Set(a.map(e=>e.id_user));return new Set(a.filter(e=>e.id_leader&&!o.has(e.id_leader)).map(e=>e.id_leader)).forEach(n=>{const i=t[n],o=a.filter(e=>e.id_leader===n);r.push({id:`virtual-${n}`,alias:a[0]?.alias||"",id_user:n,id_leader:null,is_removed:!1,is_active:!0,created_at:(new Date).toISOString(),updated_at:(new Date).toISOString(),name:i?.name||e.t("inactive_user"),email:i?.email||"",subordinatesCount:o.length,subordinateNames:o.map(e=>t[e.id_user]?.name||"[Usuário inativo]").sort((e,a)=>e.localeCompare(a))})}),Cb(r)},[i.data,n]);return{...i,data:o}}import.meta.env.VITE_SUPABASE_URL,Zs();const Ab="common";function Eb(){const{alias:e}=Sl(),a=Xa(),t=nl(),{t:r}=Ga();return Za({mutationFn:async a=>{if(!e)throw new Error(r("unit_not_selected","Unidade não selecionada"));if(a.id_user===a.id_leader)throw new Error(r("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await Mb(t,e,a.id_user,a.id_leader);const{data:n,error:i}=await t.schema(Ab).from("leaders").insert({alias:e,id_user:a.id_user,id_leader:a.id_leader,is_active:!0,is_removed:!1}).select().single();if(i)throw i;return n},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),C.success(r("leader_promoted_success","Líder virtual promovido com sucesso"))},onError:e=>{C.error(e.message||r("leader_create_error","Erro ao criar líder"))}})}function Db(){const{alias:e}=Sl(),a=Xa(),t=nl(),{t:r}=Ga();return Za({mutationFn:async a=>{if(!e)throw new Error(r("unit_not_selected","Unidade não selecionada"));if(!a.users.length)throw new Error(r("select_at_least_one",r("leadership_select_subordinates")));const n=a.users.map(e=>e.id_user),{data:i}=await t.schema(Ab).from("leaders").select("id_user").eq("alias",e).in("id_user",n).eq("is_removed",!1);if(i&&i.length>0){const e=i.map(e=>e.id_user);throw new Error(r("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(r("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await Mb(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:s,error:l}=await t.schema(Ab).from("leaders").insert(o).select();if(l)throw l;return s},onSuccess:t=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),C.success(r("subordinates_added_success",`${t?.length||0} liderado(s) adicionado(s) com sucesso`))},onError:e=>{C.error(e.message||r("subordinates_add_error","Erro ao adicionar liderados"))}})}function Pb(){const{alias:e}=Sl(),a=Xa(),t=nl(),{t:r}=Ga();return Za({mutationFn:async a=>{if(!e)throw new Error(r("unit_not_selected","Unidade não selecionada"));const{data:n}=await t.schema(Ab).from("leaders").select("id_user").eq("id",a.id).eq("alias",e).single();if(!n)throw new Error(r("leader_not_found","Líder não encontrado"));if(n.id_user===a.id_leader)throw new Error(r("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));a.id_leader&&await Mb(t,e,n.id_user,a.id_leader,a.id);const{data:i,error:o}=await t.schema(Ab).from("leaders").update({id_leader:a.id_leader}).eq("id",a.id).eq("alias",e).select().single();if(o)throw o;return i},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),C.success(r("leader_updated_success","Líder atualizado com sucesso"))},onError:e=>{C.error(e.message||r("leader_update_error","Erro ao atualizar líder"))}})}function Ib(){const{alias:e}=Sl(),a=Xa(),t=nl(),{t:r}=Ga();return Za({mutationFn:async a=>{if(!e)throw new Error(r("unit_not_selected","Unidade não selecionada"));const{error:n}=await t.schema(Ab).from("leaders").update({is_removed:!0}).eq("id",a).eq("alias",e);if(n)throw n},onSuccess:()=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),C.success(r("leader_removed_success","Líder removido com sucesso"))},onError:e=>{C.error(e.message||r("leader_remove_error","Erro ao remover líder"))}})}function Tb(){const{alias:e}=Sl(),a=Xa(),t=nl(),{t:r}=Ga();return Za({mutationFn:async({leaderUserId:a,selectedUsers:n})=>{if(!e)throw new Error(r("unit_not_selected","Unidade não selecionada"));const i=n.map(e=>e.id_user),o=await Promise.all([t.schema(Ab).from("leaders").select("id, id_user, id_leader").eq("alias",e).eq("is_removed",!1).eq("id_leader",a),t.schema(Ab).from("leaders").select("id, id_user, id_leader").eq("alias",e).eq("is_removed",!1).in("id_user",i.length?i:["__none__"])]),[{data:s,error:l},{data:d,error:c}]=o;if(l)throw l;if(c)throw c;const u=s||[],m=d||[],p=new Set(i),h=u.filter(e=>!p.has(e.id_user)),f=m.filter(e=>e.id_leader!==a),g=new Set(m.map(e=>e.id_user)),v=n.filter(e=>!g.has(e.id_user));for(const r of f)await Mb(t,e,r.id_user,a,r.id);for(const y of v){if(y.id_user===a)throw new Error(r("cannot_be_own_leader","Usuário não pode ser seu próprio líder"));await Mb(t,e,y.id_user,a)}const b=[];if(h.length){const a=h.map(e=>e.id);b.push(t.schema(Ab).from("leaders").update({is_removed:!0}).in("id",a).eq("alias",e))}if(f.length){const r=f.map(e=>e.id);b.push(t.schema(Ab).from("leaders").update({id_leader:a}).in("id",r).eq("alias",e))}if(v.length){const r=v.map(t=>({alias:e,id_user:t.id_user,id_leader:a,is_active:!0,is_removed:!1}));b.push(t.schema(Ab).from("leaders").insert(r))}const x=(await Promise.all(b)).find(e=>e?.error);if(x?.error)throw x.error;return{unlinked:h.length,updated:f.length,created:v.length}},onSuccess:t=>{a.invalidateQueries({queryKey:["leadership-raw",e]}),C.success(r("subordinates_synced_success",`Subordinados sincronizados (${t.created} adicionados, ${t.updated} atualizados, ${t.unlinked} removidos)`))},onError:e=>{C.error(e.message||r("subordinates_sync_error","Erro ao sincronizar subordinados"))}})}async function Mb(a,t,r,n,i){const{data:o,error:s}=await a.schema(Ab).from("leaders").select("id, id_user, id_leader").eq("alias",t).eq("is_removed",!1);if(s)throw s;const l=i?o.filter(e=>e.id!==i):o,d=new Set;let c=n;for(;c;){if(d.has(c))throw new Error(e.t("leadership_cycle_error"));if(c===r)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 Rb=function(e,a){for(var t={};e.length;){var r=e[0],n=r.code,i=r.message,o=r.path.join(".");if(!t[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];t[o]={message:s.message,type:s.code}}else t[o]={message:i,type:n};if("unionErrors"in r&&r.unionErrors.forEach(function(a){return a.errors.forEach(function(a){return e.push(a)})}),a){var l=t[o].types,d=l&&l[r.code];t[o]=Oa(o,a,t,n,d?[].concat(d,r.message):r.message)}e.shift()}return t},Lb=function(e,a,t){return void 0===t&&(t={}),function(r,n,i){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(e["sync"===t.mode?"parse":"parseAsync"](r,a)).then(function(e){return i.shouldUseNativeValidation&&or({},i),{errors:{},values:t.raw?r:e}})}catch(l){return o(l)}return s&&s.then?s.then(void 0,o):s}(0,function(e){if(function(e){return Array.isArray(null==e?void 0:e.errors)}(e))return{values:{},errors:sr(Rb(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e}))}catch(o){return Promise.reject(o)}}};const zb=ir.object({id_leader:ir.string().nullable(),id_users:ir.array(ir.string()).min(1,e.t("leadership_select_subordinates"))}),Fb=ir.object({id_leader:ir.string().nullable(),id_users:ir.array(ir.string())});function Ub({value:r,onChange:n,excludeUserIds:i=[],error:s}){const{data:l=[],isLoading:d}=Fd(),[c,p]=o(""),h=u(null),f=u(0),g=l.filter(e=>!i.includes(e.userId||"")).filter(e=>{const a=c.toLowerCase(),t=e.userName?.toLowerCase().includes(a);return t}).sort((e,a)=>{const t=r.includes(e.userId),n=r.includes(a.userId);if(t&&!n)return-1;if(!t&&n)return 1;const i=e.userName||e.userEmail||"",o=a.userName||a.userEmail||"";return i.localeCompare(o)});return m(()=>{h.current&&f.current>0&&(h.current.scrollTop=f.current)},[g]),t("div",d?{className:"flex items-center justify-center p-4",children:[a(T,{className:"h-6 w-6 animate-spin"}),a("span",{className:"ml-2",children:"Carregando dados..."})]}:{className:"space-y-2",children:[a(qi,{placeholder:e.t("search_user_placeholder"),value:c,onChange:e=>p(e.target.value)}),a("div",{ref:h,className:"border rounded-md p-4 max-h-[300px] overflow-y-auto",children:0===g.length?a("p",{className:"text-sm text-muted-foreground",children:e.t("search_user_placeholder")}):a("div",{className:"space-y-2",children:g.map(e=>t("div",{className:"flex items-center space-x-2",children:[a(Wo,{id:e.userId,checked:r.includes(e.userId),onCheckedChange:()=>{return a=e.userId,h.current&&(f.current=h.current.scrollTop),void(r.includes(a)?n(r.filter(e=>e!==a)):n([...r,a]));var a}}),a(Hi,{htmlFor:e.userId,className:"flex-1 cursor-pointer",children:e.userName||e.userEmail})]},e.userId))})}),r.length>0&&t("p",{className:"text-sm text-muted-foreground",children:[r.length," selecionado(s)"]}),s&&a("p",{className:"text-sm text-destructive",children:s})]})}function jb({leader:n,prefilledLeaderId:i,onSuccess:s}){const{t:l}=Ga(),{alias:d}=Sl(),c=!!n,u=n?.id.startsWith("virtual-"),p=Db(),h=Eb(),f=Pb(),g=Tb(),v=Ib(),{data:b=[]}=Sb(),{data:x=[]}=Fd(),[y,N]=o(""),w=kb(b).map(e=>e.id_user),_=c?kb(b).filter(e=>e.id_leader===n.id_user).map(e=>e.id_user):[],C=Ba({resolver:Lb(c?Fb:zb),defaultValues:{id_leader:i||(c?n?.id_leader:null)||null,id_users:c?_:[]}});m(()=>{if(n){const e=kb(b).filter(e=>e.id_leader===n.id_user).map(e=>e.id_user);C.reset({id_leader:n.id_leader||null,id_users:e})}else i?C.reset({id_leader:i,id_users:[]}):C.reset({id_leader:null,id_users:[]})},[d,n?.id,n?.id_user,n?.id_leader,i,b]);const k=p.isPending||h.isPending||f.isPending||g.isPending||v.isPending,S=C.watch("id_leader"),A=C.watch("id_users"),E=c?[n.id_user,...w.filter(e=>e!==n.id_user&&!A.includes(e)&&!_.includes(e))]:[S,...w.filter(e=>!A.includes(e))].filter(Boolean);return t("form",{onSubmit:C.handleSubmit(async e=>{try{if(c)if(u){await h.mutateAsync({id_user:n.id_user,id_leader:e.id_leader});const a=x.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await g.mutateAsync({leaderUserId:n.id_user,selectedUsers:a})}else{await f.mutateAsync({id:n.id,id_leader:e.id_leader});const a=x.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await g.mutateAsync({leaderUserId:n.id_user,selectedUsers:a})}else{const a=x.filter(a=>e.id_users.includes(a.userId)).map(e=>({id_user:e.userId}));await p.mutateAsync({id_leader:e.id_leader,users:a})}s?.()}catch(a){}}),className:"space-y-4",children:[c&&t("div",{children:[a(Hi,{children:e.t("leader")}),a(qi,{value:x.find(e=>e.userId===n.id_user)?.userName||n.name||e.t("inactive_user"),disabled:!0,className:"bg-muted"})]}),t("div",{children:[a(Hi,{children:l("leadership_immediate_superior")}),t(Lo,{value:S||"none",onValueChange:e=>C.setValue("id_leader","none"===e?null:e),children:[a(Uo,{children:a(Fo,{placeholder:"Selecione..."})}),t(Bo,{children:[a("div",{className:"sticky top-0 z-10 bg-background p-2 border-b",children:a(qi,{placeholder:"Buscar superior...",value:y,onChange:e=>N(e.target.value),onKeyDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:"h-8"})}),t(Id,{className:"h-[200px]",children:[a(Vo,{value:"none",children:"[Nenhum]"}),x.filter(e=>{const a=c?e.userId!==n.id_user:!A.includes(e.userId),t=!y||e.userName?.toLowerCase().includes(y.toLowerCase());return a&&t}).sort((e,a)=>{const t=e.userName||e.userEmail||"",r=a.userName||a.userEmail||"";return t.localeCompare(r)}).map(e=>a(Vo,{value:e.userId,children:e.userName},e.userId))]})]})]},`superior-select-${d}`),C.formState.errors.id_leader&&a("p",{className:"text-sm text-destructive mt-1",children:C.formState.errors.id_leader.message})]}),t("div",{children:[a(Hi,{children:"Subordinados *"}),a(Ub,{value:A,onChange:e=>C.setValue("id_users",e),excludeUserIds:E,error:C.formState.errors.id_users?.message},`users-multiselect-${d}`)]}),t("div",{className:"flex items-center justify-between gap-2",children:[a($i,{type:"submit",disabled:k||!c&&0===A.length,children:k&&!v.isPending?t(r,{children:[a(T,{className:"mr-2 h-4 w-4 animate-spin"}),c?"Atualizando...":"Salvando..."]}):c?"Atualizar":"Criar"}),c&&!S&&0===A.length&&t(eo,{children:[a(ao,{asChild:!0,children:a($i,{type:"button",variant:"destructive",disabled:k,className:"ml-auto",children:v.isPending?t(r,{children:[a(T,{className:"mr-2 h-4 w-4 animate-spin"}),"Removendo..."]}):t(r,{children:[a(H,{className:"mr-2 h-4 w-4"}),"Remover"]})})}),t(no,{children:[t(io,{children:[a(so,{children:l("confirm_removal")}),a(lo,{children:"Tem certeza que deseja remover este líder? Esta ação não pode ser desfeita."})]}),t(oo,{children:[a(uo,{children:l("cancel")}),a(co,{onClick:async()=>{if(n)try{await v.mutateAsync(n.id),s?.()}catch(e){}},children:l("remove")})]})]})]})]})]})}function Ob({open:e,onOpenChange:r,leader:n,prefilledLeaderId:i,title:o}){return a(mo,{open:e,onOpenChange:r,children:t(bo,{variant:"form",className:"sm:max-w-[500px]",children:[a(xo,{showSeparator:!0,children:a(wo,{children:o})}),a(yo,{children:a(jb,{leader:n,prefilledLeaderId:i,onSuccess:()=>r(!1)})})]})})}const Bb="leadership-expanded-nodes",$b=(e,a)=>{try{localStorage.setItem(`${Bb}-${e}`,JSON.stringify(Array.from(a)))}catch{}};function Vb({unassociatedUsers:n=[],onAssociateUser:i,onMoveNode:d,onMoveNodes:c,columns:u,nameHeader:p=e.t("leader"),rootDropLabel:h=e.t("leadership_make_root")}={}){const{alias:f}=Sl(),{data:g,isLoading:v,error:b,refetch:x}=Sb(),y=Pb(),N=Eb(),[w,_]=o(()=>f?(e=>{try{const a=localStorage.getItem(`${Bb}-${e}`);if(a)return new Set(JSON.parse(a))}catch{}return new Set})(f):new Set),[C,k]=o([]),[S,A]=o(new Set),[E,P]=o(!0),[I,T]=o(!1),[M,R]=o(),[L,z]=o(null),F=s(()=>g?kb(g):[],[g]),j=s(()=>F.map(e=>e.id),[F]),O=j.length>0&&C.length===j.length,B=F.filter(e=>e.children.length>0).every(e=>w.has(e.id));m(()=>{if(g&&g.length>0&&f){if(!localStorage.getItem(`${Bb}-${f}`)){const e=g.map(e=>e.id),a=new Set(e);_(a),$b(f,a)}}},[g,f]);const $=l(e=>{_(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),f&&$b(f,t),t})},[f]),V=l(()=>{if(B){const e=new Set;_(e),f&&$b(f,e)}else{const e=new Set(F.filter(e=>e.children.length>0).map(e=>e.id));_(e),f&&$b(f,e)}},[B,F,f]),q=l(e=>{k(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),W=l(()=>{k(O?[]:j)},[O,j]),H=l(e=>{A(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),K=l(e=>F.find(a=>a.id===e),[F]),Y=l((e,a)=>{if(d)return void d(e,a);const t=n.find(a=>a.id===e);if(t){if(i){const e=a?K(a):null;i(t.id,e?.id_user||null)}else N.mutate({id_user:t.id,id_leader:a&&K(a)?.id_user||null});return}const r=K(e);if(!r)return;const o=a?K(a):null;y.mutate({id:r.id,id_leader:o?.id_user||null})},[d,n,i,K,y,N]),X=l((e,a)=>{c?c(e,a):(e.forEach(e=>Y(e,a)),k([]))},[c,Y]),J=l(e=>{R(e),z(null),T(!0)},[]),Z=l(()=>{R(void 0),z(null),T(!0)},[]),ee=l(()=>{T(!1),R(void 0),z(null)},[]),ae=l((e,a)=>{const t=S.has(e)&&S.size>1?Array.from(S):[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"},[S]),te=s(()=>[{key:"subordinatesCount",header:"Subordinados",hoverContent:e=>e.subordinateNames&&e.subordinateNames.length>0?t("div",{className:"space-y-1.5",children:[a("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Subordinados diretos:"}),[...e.subordinateNames].sort((e,a)=>e.localeCompare(a)).map(e=>t("div",{className:"flex items-center gap-2 text-sm",children:[a(ge,{className:"h-3 w-3 text-muted-foreground"}),a("span",{children:e})]},e))]}):a("p",{className:"text-xs text-muted-foreground",children:"Sem subordinados diretos"})},{key:"email",header:"Email",className:"text-left",width:180,render:e=>t("span",{className:"flex items-center gap-1.5 text-muted-foreground text-sm",children:[a(Ke,{className:"h-3.5 w-3.5"}),e.email||"—"]})}],[]),re=u??te;if(v)return a("div",{className:"flex items-center justify-center h-full",children:t("div",{className:"text-center space-y-2",children:[a("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(b)return a("div",{className:"flex items-center justify-center h-full",children:t("div",{className:"text-center",children:[a("p",{className:"text-destructive mb-4",children:"Erro ao carregar hierarquia de liderança"}),a($i,{onClick:()=>x(),children:e.t("try_again")})]})});const ne=F.filter(a=>a.name!==e.t("inactive_user")).length;return t("div",{className:"flex flex-col h-full gap-3 p-4",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex gap-2 items-center",children:[t($i,{size:"sm",onClick:Z,children:[a(Q,{className:"h-4 w-4 mr-2"}),"Definir Líder"]}),a($i,{size:"sm",variant:"outline",onClick:V,children:t(r,B?{children:[a(D,{className:"h-4 w-4 mr-1"}),"Colapsar"]}:{children:[a(U,{className:"h-4 w-4 mr-1"}),"Expandir"]})}),a("div",{className:"flex items-center gap-2 ml-4",children:t("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted rounded-md",children:[a(Ze,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"text-sm font-medium",children:[ne," usuário",1!==ne?"s":""," associado",1!==ne?"s":""]})]})})]}),a("p",{className:"text-xs text-muted-foreground",children:"Arraste as linhas para reorganizar • Selecione múltiplos para mover em lote"})]}),a(Fv,{data:g||[],columns:re,nameKey:"name",nameHeader:p,expandedIds:w,onToggleExpand:$,iconComponent:a(Ze,{className:"h-4 w-4 text-muted-foreground shrink-0"}),rowActionsVariant:"inline",enableRowDrag:!0,enableSelection:!0,selectedIds:C,onSelectItem:q,onSelectAll:W,isAllSelected:O,onMoveNode:Y,onMoveNodes:X,rootDropLabel:h,emptyMessage:e.t("leadership_no_hierarchy"),renderActions:e=>a($i,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>J(e),children:a(G,{className:"h-4 w-4"})})}),n.length>0&&t("div",{className:"border rounded-lg overflow-hidden",children:[t("button",{type:"button",onClick:()=>P(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(E?D:U,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a(ba,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-sm font-medium",children:"Usuários não associados"}),t("span",{className:"text-xs text-muted-foreground ml-1",children:["(",n.length,")"]}),S.size>0&&t("span",{className:"text-xs text-primary ml-1",children:["(",S.size," selecionado",S.size>1?"s":"",")"]}),a("span",{className:"text-xs text-muted-foreground ml-auto",children:"Arraste para a hierarquia acima"})]}),E&&a("div",{className:"divide-y",children:n.map(e=>t("div",{draggable:!0,onDragStart:a=>ae(e.id,a),onDragEnd:e=>{e.currentTarget.style.opacity="1"},className:Fi("flex items-center gap-3 px-4 py-2.5 hover:bg-accent/50 cursor-grab active:cursor-grabbing transition-colors",S.has(e.id)&&"bg-primary/5"),children:[a(Wo,{checked:S.has(e.id),onCheckedChange:()=>H(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),a("span",{className:"text-muted-foreground shrink-0 select-none",children:"⠿"}),a(ge,{className:"h-4 w-4 text-muted-foreground shrink-0"}),t("div",{className:"flex flex-col min-w-0",children:[a("span",{className:"text-sm truncate",children:e.name}),a("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id))})]}),t("div",{className:"px-3 py-2 bg-muted/20 border rounded-lg text-xs text-muted-foreground flex justify-between",children:[t("span",{children:["Usuários associados: ",ne]}),n.length>0&&t("span",{children:["Usuários não associados: ",n.length]})]}),a(Ob,{open:I,onOpenChange:ee,leader:M,prefilledLeaderId:L,title:M?e.t("edit_name"):L?e.t("leadership_add_subordinate"):e.t("leadership_add_root")},`leadership-dialog-${f}`)]})}function qb(e){const[a,t]=o(!1),{uploadFunction:r,deleteFunction:n,defaultOptions:i,onSuccess:s,onError:l}=e||{};return{upload:async(e,a)=>{if(!r){const e=new Error("uploadFunction não fornecida");throw C.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}t(!0);try{const t={...i,...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 n=await r(e,t);return C.success("Sucesso",{description:"Arquivo enviado com sucesso"}),s?.(n),n}catch(n){const e=n instanceof Error?n:new Error("Erro ao fazer upload");throw C.error("Erro",{description:e.message}),l?.(e),e}finally{t(!1)}},deleteMedia:async(e,a)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw C.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),C.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw C.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function Wb(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 Hb(e,a){const t=Wb(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function Gb(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function Kb(e,a){const t=Gb(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function Yb(e){if(!e)return;const a=e.match(/src="([^"]+)"/);return a?a[1]:void 0}function Qb(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function Xb(e,a,t){switch(a||Qb(e)){case"youtube":return Hb(e,t);case"vimeo":return Kb(e,t);default:return e}}function Jb({value:n,onChange:i,onSubmit:l,onCancel:d,uploadFunction:c,deleteFunction:m,uploadOptions:p}){const{t:h}=Ga(),[f,g]=o(n||{inputType:"url",controls:!0}),v=u(null),b=u(null),{upload:x,uploading:y}=qb({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["video/*"],maxSize:104857600}}),{upload:N,uploading:w}=qb({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["image/*"],maxSize:5242880}}),_=s(()=>Qb(f.videoUrl||Yb(f.embedCode)||""),[f.videoUrl,f.embedCode]),k=(e,a)=>{const t={...f,[e]:a};g(t),i(t)};return t("div",{className:"space-y-6",children:[t("div",{className:"space-y-2",children:[a(Hi,{children:h("input_type")}),t(Lo,{value:f.inputType||"url",onValueChange:e=>k("inputType",e),children:[a(Uo,{children:a(Fo,{})}),t(Bo,{children:[a(Vo,{value:"url",children:"URL"}),a(Vo,{value:"upload",children:h("file_upload")}),a(Vo,{value:"embed",children:h("embed_code")})]})]})]}),"upload"===f.inputType&&c&&t("div",{className:"space-y-2",children:[a(Hi,{children:"Arquivo"}),t("div",{className:"flex gap-2",children:[a("input",{ref:v,type:"file",accept:"video/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await x(a),t={...f,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:f.title||a.name.replace(/\.[^/.]+$/,"")};g(t),i(t)}catch(t){}finally{v.current&&(v.current.value="")}},className:"hidden"}),a($i,{type:"button",variant:"outline",onClick:()=>v.current?.click(),disabled:y,children:t(r,y?{children:[a(T,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(ya,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),f.videoFile&&t("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",f.videoFile," (",Math.round((f.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===f.inputType&&t("div",{className:"space-y-2",children:[a(Hi,{children:h("embed_code")}),a(Ho,{placeholder:h("paste_embed_code"),value:f.embedCode||"",onChange:e=>k("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),c&&t("div",{className:"space-y-2",children:[a(Hi,{children:"Thumbnail"}),t("div",{className:"flex gap-2",children:[a(qi,{type:"url",placeholder:"URL da thumbnail",value:f.thumbnail||"",onChange:e=>k("thumbnail",e.target.value),className:"flex-1"}),a("input",{ref:b,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await N(a),t={...f,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};g(t),i(t)}catch(t){}finally{b.current&&(b.current.value="")}},className:"hidden"}),a($i,{type:"button",variant:"outline",onClick:()=>b.current?.click(),disabled:w,children:t(r,w?{children:[a(T,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(ya,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),f.thumbnailFile&&t("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",f.thumbnailFile]})]}),t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"title",children:"Título"}),a(qi,{id:"title",placeholder:h("video_title"),value:f.title||"",onChange:e=>k("title",e.target.value)})]}),t("div",{className:"flex gap-6",children:[t("div",{className:"flex items-center gap-2",children:[a(Wo,{id:"autoplay",checked:f.autoplay||!1,onCheckedChange:e=>k("autoplay",!0===e)}),a(Hi,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t("div",{className:"flex items-center gap-2",children:[a(Wo,{id:"controls",checked:!1!==f.controls,onCheckedChange:e=>k("controls",!0===e)}),a(Hi,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const r=f.videoUrl||Yb(f.embedCode)||"";if(!r)return a("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===_)return t("video",{controls:!1!==f.controls,autoPlay:f.autoplay,poster:f.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[a("source",{src:r}),"Seu navegador não suporta este vídeo."]});const n="youtube"===_?Hb(r,f.autoplay):Kb(r,f.autoplay);return a("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a("iframe",{title:f.title||e.t("video"),src:n,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a($i,{variant:"outline",onClick:d,children:"Cancelar"}),a($i,{onClick:()=>{f.videoUrl||f.embedCode?l(f):C.error("Erro",{description:h("no_video_selected")})},disabled:!(f.videoUrl||f.embedCode),children:"Salvar"})]})]})}function Zb({content:r,className:n="",style:i}){const o=r.videoUrl||Yb(r.embedCode)||"";if(!o)return null;const s=Qb(o);return a(Gi,{className:`overflow-hidden my-4 ${n}`,style:i,children:t(Xi,{className:"p-0",children:["file"===s?t("video",{controls:!1!==r.controls,autoPlay:r.autoplay,poster:r.thumbnail,className:"w-full h-auto",playsInline:!0,muted:r.autoplay,children:[a("source",{src:o}),"Seu navegador não suporta vídeos HTML5."]}):a("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a("iframe",{title:r.title||e.t("video"),src:"youtube"===s?Hb(o,r.autoplay):Kb(o,r.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),r.title&&a("div",{className:"p-4",children:a("p",{className:"text-sm font-medium",children:r.title})})]})})}function ex({value:e,onChange:n,onSubmit:i,onCancel:s,uploadFunction:l,deleteFunction:d,uploadOptions:c}){const{t:m}=Ga(),[p,h]=o(e||{alignment:"center",allowDownload:!1}),f=u(null),{upload:g,uploading:v}=qb({uploadFunction:l,deleteFunction:d,defaultOptions:{...c,allowedTypes:["image/*"],maxSize:5242880}}),b=(e,a)=>{const t={...p,[e]:a};h(t),n(t)};return t("div",{className:"space-y-6",children:[t("div",{className:"space-y-2",children:[a(Hi,{children:"URL"}),t("div",{className:"flex gap-2",children:[a(qi,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:p.imageUrl||"",onChange:e=>b("imageUrl",e.target.value),className:"flex-1"}),l&&t(r,{children:[a("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await g(a),t={...p,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};h(t),n(t)}catch(t){}finally{f.current&&(f.current.value="")}},className:"hidden"}),a($i,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:v,children:t(r,v?{children:[a(T,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(ya,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),p.imageFile&&t("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",p.imageFile," (",Math.round((p.imageSize||0)/1024)," KB)"]})]}),p.imageUrl&&t("div",{className:"space-y-2",children:[a(Hi,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:a("div",{className:"flex "+("left"===p.alignment?"justify-start":"right"===p.alignment?"justify-end":"justify-center"),children:a("img",{src:p.imageUrl,alt:p.alt||"Preview",style:{width:p.width?`${p.width}px`:"auto",height:p.height?`${p.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"caption",children:"Legenda"}),a(Ho,{id:"caption",placeholder:"Legenda",value:p.caption||"",onChange:e=>b("caption",e.target.value),rows:2})]}),t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"alt",children:m("alt_text")}),a(qi,{id:"alt",placeholder:m("alt_text"),value:p.alt||"",onChange:e=>b("alt",e.target.value)})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:"Alinhamento"}),t(Lo,{value:p.alignment||"center",onValueChange:e=>b("alignment",e),children:[a(Uo,{children:a(Fo,{})}),t(Bo,{children:[a(Vo,{value:"left",children:"Esquerda"}),a(Vo,{value:"center",children:"Centro"}),a(Vo,{value:"right",children:"Direita"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"width",children:"Largura"}),a(qi,{id:"width",type:"number",placeholder:"px",value:p.width||"",onChange:e=>b("width",e.target.value?Number(e.target.value):void 0)})]}),t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"height",children:"Altura"}),a(qi,{id:"height",type:"number",placeholder:"px",value:p.height||"",onChange:e=>b("height",e.target.value?Number(e.target.value):void 0)})]})]}),t("div",{className:"flex items-center gap-2",children:[a(Wo,{id:"allowDownload",checked:p.allowDownload||!1,onCheckedChange:e=>b("allowDownload",!0===e)}),a(Hi,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a($i,{variant:"outline",onClick:s,children:"Cancelar"}),a($i,{onClick:()=>{p.imageUrl?i(p):C.error("Erro",{description:m("no_image_selected")})},disabled:!p.imageUrl,children:"Salvar"})]})]})}function ax({content:e,className:r="",style:n}){const{t:i}=Ga();if(!e.imageUrl)return null;const o={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return a("div",{className:`flex ${o} my-4 ${r}`,style:n,children:t("div",{className:"space-y-2 max-w-full",children:[a("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("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[a(Je,{className:"h-4 w-4"}),"Baixar imagem"]})]})})}function tx(e,a){return e/a}function rx(e,a,t,r){const n=tx(e,a);return t&&!r?{width:t,height:Math.round(t/n)}:r&&!t?{width:Math.round(r*n),height:r}:{width:e,height:a}}function nx(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))}}function ix(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"}}function ox(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function sx(){const{alias:e}=Sl(),[a,t]=o(null),[r,n]=o(!0);m(()=>{if(!e)return void n(!1);let a=!1;return(async()=>{n(!0);try{const r=nl(),{data:n,error:i}=await r.schema("common").from("sign_configs").select("*").eq("alias",e).is("deleted_at",null).maybeSingle();a||t(n)}catch(r){a||t(null)}finally{a||n(!1)}})(),()=>{a=!0}},[e]);return{config:a,isLoading:r,saveConfig:l(async(a,r)=>{if(!e)throw new Error("Alias not available");const n=nl(),{data:i,error:o}=await n.schema("common").from("sign_configs").upsert({alias:e,api_key:a,environment:r,updated_at:(new Date).toISOString()},{onConflict:"alias"}).select().maybeSingle();if(o)throw o;return t(i),i},[e])}}const lx=import.meta.env.VITE_SUPABASE_URL,dx=Zs();async function cx(e,a,t){const r=Qs.getSupabaseToken(),n={"Content-Type":"application/json",apikey:dx};r&&(n.Authorization=`Bearer ${r}`);const i=await fetch(`${lx}/functions/v1/${e}`,{method:"POST",headers:n,body:JSON.stringify({action:a,data:t})});if(!i.ok){const e=await i.json().catch(()=>({}));throw new Error(e.error||`Erro na requisição: ${i.status}`)}return i}const ux={async createEnvelopeWithSigner(e){const a="d4sign"===e.provider?"d4sign":"clicksign",t="d4sign"===e.provider?"create_and_send":"create_envelope_with_signer";return(await cx(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 cx(a,"get_signed_document",{envelope_id:e.envelopeId,document_id:e.documentId})).json()}};let mx=null;function px(){return window.Clicksign?Promise.resolve():mx||(mx=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)}),mx)}const hx="clicksign-container";function fx({signerId:e,environment:r="sandbox",onSign:n,onError:i,onClose:s}){const{t:l}=Ga(),d=u(null),[c,p]=o(!0),[h,f]=o(null);return m(()=>{let a=!1;return d.current&&(d.current.unmount(),d.current=null),f(null),p(!0),px().then(()=>{if(a)return;const t=new window.Clicksign(e);t.endpoint="production"===r?"https://app.clicksign.com":"https://sandbox.clicksign.com",t.origin=window.origin,t.mount(hx),t.on("loaded",function(){p(!1)}),t.on("signed",function(){n?.()}),t.on("resized",function(e){const a=e,t=document.getElementById(hx);t&&a?.data?.height&&(t.style.height=a.data.height+"px")}),t.on("error",function(e){p(!1),i?.(e instanceof Error?e:new Error(l("sign_widget_error")))}),t.on("closed",function(){s?.()}),d.current=t}).catch(e=>{a||(f("Falha ao carregar o script de assinatura."),p(!1),i?.(e))}),()=>{a=!0,d.current&&(d.current.unmount(),d.current=null)}},[e,r]),t("div",{className:"relative h-full",children:[c&&a("div",{className:"absolute inset-0 flex items-center justify-center",children:t("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a(T,{className:"h-5 w-5 animate-spin"}),a("span",{className:"text-sm",children:"Carregando documento..."})]})}),h&&a("div",{className:"absolute inset-0 flex items-center justify-center",children:a("p",{className:"text-sm text-destructive",children:h})}),a("div",{id:hx,style:{height:"600px"}})]})}function gx({documentKey:r,signerEmail:n,signerName:i,keySigner:s,environment:d,onSign:c,onError:p}){const h=u(null),[f,g]=o("loading"),[v,b]=o(null),x="production"===d?"https://secure.d4sign.com.br/embed/viewblob":"https://sandbox.d4sign.com.br/embed/viewblob",y=(()=>{const e=new URLSearchParams({email:n,display_name:i||"",disable_preview:"0"});return s&&e.set("key_signer",s),`${x}/${r}?${e.toString()}`})(),N=l(a=>"signed"===a.data?(g("ready"),void c?.()):"wrong-data"===a.data?(g("error"),b(e.t("sign_incorrect_data")),void p?.(new Error(e.t("sign_incorrect_data")))):void 0,[c,p]);m(()=>(window.addEventListener("message",N,!1),()=>{window.removeEventListener("message",N,!1)}),[N]);const w=l(()=>{"loading"===f&&g("ready")},[f]);return"error"===f?t(ic,{variant:"danger",className:"my-4",children:[a(oc,{children:e.t("sign_doc_load_error")}),a(sc,{children:v||"Ocorreu um erro inesperado ao carregar o documento para assinatura. Tente novamente."})]}):t("div",{className:"relative h-full",children:["loading"===f&&a("div",{className:"absolute inset-0 flex items-center justify-center",children:t("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a(T,{className:"h-5 w-5 animate-spin"}),a("span",{className:"text-sm",children:"Carregando documento..."})]})}),a("iframe",{ref:h,id:"d4sign-container",src:y,width:"100%",style:{height:"600px",border:0},allow:"geolocation",onLoad:w})]})}function vx({file:r,onDocumentSigned:n,onError:i,showEventLog:s=!1}){const{user:d,alias:c}=Sl(),{config:p,isLoading:h}=sx(),{t:f}=Ga(),[g,v]=o(null),[b,x]=o(!1),[y,N]=o(null),[w,_]=o("sandbox"),[k,S]=o("clicksign"),[A,E]=o(null),[D,P]=o(null),[I,M]=o(!1),[R,L]=o(0),[z,F]=o(!1),[U,j]=o([]),O=u(null),B=u(null),$=l(e=>{s&&j(a=>[...a,`[${(new Date).toLocaleTimeString()}] ${e}`])},[s]),V=l(async a=>{if(v(a),N(null),E(null),P(null),$(`Arquivo selecionado: ${a.name}`),c&&d){x(!0);try{const t=p?.provider??"clicksign";S(t),$(`Provedor resolvido: ${t}`);const r=new FileReader,n=await new Promise((e,t)=>{r.onload=()=>{const a=r.result;e(a)},r.onerror=t,r.readAsDataURL(a)});$(`Criando envelope para assinatura via ${t}...`);const o=await ux.createEnvelopeWithSigner({alias:c,contentBase64:n,filename:a.name,signerEmail:d.email||"",signerName:d.name||"",provider:t});$(`Envelope criado: ${o.envelope_id}`),E({envelope_id:o.envelope_id,document_id:o.document_id,signer_email:o.signer_email,key_signer:o.signer_id}),_(o.environment),S(o.provider||t),"d4sign"===t?($("Documento enviado para D4Sign. Abrindo widget de assinatura..."),await new Promise(e=>setTimeout(e,2e3)),N(o.document_id),C.success(f("sign_doc_sent","Documento enviado! Assine abaixo."))):o.signer_id?($(`Signer ID obtido: ${o.signer_id}. Aguardando processamento (3s)...`),await new Promise(e=>setTimeout(e,3e3)),N(o.signer_id),C.success(f("sign_doc_sent","Documento enviado! Assine abaixo."))):($(e.t("sign_signer_unavailable")),C.error(f("sign_access_error","Não foi possível obter o acesso para assinatura. Tente novamente.")),i?.(new Error(f("sign_signer_unavailable"))))}catch(t){const a=t instanceof Error?t:new Error(f("sign_process_error",f("sign_doc_process_error"))),r=a.message||"";r.includes("MONTHLY_LIMIT_REACHED")?($(e.t("sign_monthly_limit")),C.error(f("sign_monthly_limit","Limite mensal de assinaturas atingido. Entre em contato com o administrador para ampliar seu plano."))):($(`Erro: ${r}`),C.error(r)),i?.(a)}finally{x(!1)}}},[c,d,$,i,p]);m(()=>{r&&c&&d&&!h&&r!==B.current&&(B.current=r,V(r))},[r,c,d,h,V]);const q=l(async()=>{if(!A||!c)return;M(!0),L(0),F(!1),$("Buscando documento assinado...");for(let t=1;t<=6;t++){L(t),$(`Tentativa ${t}/6...`);try{const a=await ux.getSignedDocument({alias:c,envelopeId:A.envelope_id,documentId:A.document_id,provider:k});if(a.download_url)return $(e.t("sign_doc_available")),P(a.download_url),void M(!1)}catch(a){$(`Erro na tentativa ${t}: ${a instanceof Error?a.message:f("unknown_error")}`)}t<6&&($("Aguardando 10 segundos para próxima tentativa..."),await new Promise(e=>setTimeout(e,1e4)))}$(e.t("sign_fetch_failed")),M(!1),F(!0)},[A,c,$,k]),W=l(async()=>{$("Documento assinado com sucesso!"),C.success(f("sign_signed_success","Documento assinado com sucesso!")),N(null),A&&c&&(n?.({success:!0,provider:k,envelope_id:A.envelope_id,document_id:A.document_id,signer_id:y||"",environment:w}),await q())},[$,n,A,y,c,w,k,q]);if(!c)return a(Gi,{className:"border-amber-200 bg-amber-50",children:a(Xi,{className:"flex items-start gap-3 py-6",children:t("div",{children:[a("p",{className:"font-medium text-amber-800",children:f("sign_auth_required","Autenticação necessária")}),a("p",{className:"text-sm text-amber-700 mt-1",children:f("sign_login_required","Faça login para utilizar a assinatura digital.")})]})})});const H="d4sign"===k?"D4Sign":"Clicksign",G=()=>s&&U.length>0?a("div",{className:"bg-muted p-3 rounded-md text-xs font-mono space-y-1 max-h-40 overflow-auto",children:U.map((e,t)=>a("div",{children:e},t))}):null;return A&&!y&&(D||I||z)?t("div",{className:"space-y-4",children:[a(Gi,{className:"border-green-200 bg-green-50",children:t(Xi,{className:"flex flex-col items-center gap-4 py-8",children:[a(aa,{className:"h-12 w-12 text-green-600"}),t("div",{className:"text-center",children:[a("p",{className:"text-lg font-semibold text-green-800",children:f("sign_signed_success","Documento assinado com sucesso!")}),a("p",{className:"text-sm text-green-700 mt-1",children:g?.name})]}),I?t("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[t("div",{className:"flex items-center gap-2",children:[a(T,{className:"h-4 w-4 animate-spin"}),f("sign_preparing_doc","Preparando documento assinado...")," (",f("sign_attempt","tentativa")," ",R,"/6)"]}),a("p",{className:"text-xs text-muted-foreground",children:f("sign_waiting_provider",`Aguardando processamento pelo ${H}...`)})]}):D?a($i,{asChild:!0,variant:"default",className:"gap-2",children:t("a",{href:D,target:"_blank",rel:"noopener noreferrer",children:[a(Je,{className:"h-4 w-4"}),f("sign_download_signed","Baixar documento assinado")]})}):z?t("div",{className:"text-center space-y-3",children:[t("div",{className:"space-y-1",children:[a("p",{className:"text-sm text-muted-foreground",children:f("sign_fetch_failed","Não foi possível obter o documento assinado após 1 minuto.")}),a("p",{className:"text-xs text-muted-foreground",children:f("sign_email_fallback","O documento será enviado para o seu e-mail assim que estiver disponível.")})]}),t($i,{variant:"secondary",className:"gap-2",onClick:q,children:[a(ue,{className:"h-4 w-4"}),f("sign_try_again","Tentar novamente")]})]}):null]})}),a(G,{})]}):y?t("div",{className:"space-y-4",children:["d4sign"===k?a(gx,{documentKey:y,signerEmail:A?.signer_email||d?.email||"",signerName:d?.name,keySigner:A?.key_signer,environment:w,onSign:W,onError:i}):a(fx,{signerId:y,environment:w,onSign:W,onError:i}),a(G,{})]}):r&&(b||h)?a(Gi,{children:t(Xi,{className:"flex items-center justify-center gap-3 py-10",children:[a(T,{className:"h-6 w-6 animate-spin text-primary"}),a("p",{className:"font-medium",children:f("sign_sending_doc","Enviando documento para assinatura...")})]})}):t("div",{className:"space-y-4",children:[a("input",{ref:O,type:"file",accept:"application/pdf",className:"hidden",onChange:e=>{const a=e.target.files?.[0];a&&"application/pdf"===a.type?V(a):C.error(f("sign_select_pdf","Selecione um arquivo PDF"))}}),a(Gi,b?{children:t(Xi,{className:"flex items-center justify-center gap-3 py-10",children:[a(T,{className:"h-6 w-6 animate-spin text-primary"}),a("p",{className:"font-medium",children:f("sign_sending_doc","Enviando documento para assinatura...")})]})}:{className:"border-dashed border-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>O.current?.click(),children:t(Xi,{className:"flex flex-col items-center justify-center py-10 gap-3",children:[a(ya,{className:"h-8 w-8 text-muted-foreground"}),t("div",{className:"text-center",children:[a("p",{className:"font-medium",children:f("sign_select_pdf","Selecione um arquivo PDF")}),a("p",{className:"text-sm text-muted-foreground",children:f("sign_click_to_select","Clique para escolher o documento para assinatura")})]})]})}),a(G,{})]})}function bx({onSaved:e}){const{config:r,isLoading:n,saveConfig:i}=sx(),{t:s}=Ga(),[l,d]=o(""),[c,u]=o("sandbox"),[p,h]=o(!1);m(()=>{!n&&r&&(d(r.api_key),u(r.environment))},[r,n]);return n?a("div",{className:"flex items-center justify-center py-8",children:a(T,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"space-y-4",children:[t("div",r?{className:"flex items-center gap-2 text-sm text-emerald-600",children:[a(le,{className:"h-4 w-4"}),a("span",{children:s("sign_configured",s("sign_configured_unit"))})]}:{className:"flex items-center gap-2 text-sm text-amber-600",children:[a(O,{className:"h-4 w-4"}),a("span",{children:s("sign_not_configured",s("sign_not_configured_unit"))})]}),t(Gi,{children:[a(Ki,{children:a(Yi,{className:"text-base",children:s("sign_digital_config")})}),a(Xi,{children:t("form",{onSubmit:async a=>{if(a.preventDefault(),l.trim()){h(!0);try{await i(l.trim(),c),C.success(s("sign_config_saved",s("sign_config_saved_success"))),e?.()}catch(t){C.error(s("sign_config_save_error",s("sign_config_save_err")))}finally{h(!1)}}else C.error(s("sign_api_key_required",s("sign_api_key_info")))},className:"space-y-4",children:[t("div",{className:"space-y-2",children:[a(Hi,{htmlFor:"sign-api-key",children:"API Key"}),a(qi,{id:"sign-api-key",type:"password",placeholder:s("sign_api_key_placeholder",s("sign_api_key_input")),value:l,onChange:e=>d(e.target.value)})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:s("sign_environment","Ambiente")}),t(Lo,{value:c,onValueChange:e=>u(e),children:[a(Uo,{children:a(Fo,{})}),t(Bo,{children:[a(Vo,{value:"sandbox",children:"Sandbox (Testes)"}),a(Vo,{value:"production",children:"Produção"})]})]})]}),t($i,{type:"submit",disabled:p,children:[p&&a(T,{className:"mr-2 h-4 w-4 animate-spin"}),r?s("sign_update_config",s("sign_update_config_btn")):s("sign_save_config",s("sign_save_config_btn"))]})]})})]})]})}var xx,yx,Nx,wx,_x,Cx,kx,Sx,Ax,Ex;(yx=xx||(xx={}))[yx.waitingStart=1]="waitingStart",yx[yx.running=2]="running",yx[yx.effectivenessCheck=3]="effectivenessCheck",yx[yx.done=4]="done",yx[yx.suspended=5]="suspended",yx[yx.canceled=6]="canceled",(wx=Nx||(Nx={}))[wx.low=0]="low",wx[wx.medium=1]="medium",wx[wx.high=2]="high",(Cx=_x||(_x={}))[Cx.plan=2]="plan",Cx[Cx.occurrence=3]="occurrence",Cx[Cx.risk=4]="risk",Cx[Cx.decisions=5]="decisions",Cx[Cx.audit=6]="audit",Cx[Cx.strategyExtension=7]="strategyExtension",Cx[Cx.standardization=8]="standardization",Cx[Cx.supplier=9]="supplier",Cx[Cx.auditItems=10]="auditItems",(Sx=kx||(kx={}))[Sx.currentProgress=1]="currentProgress",Sx[Sx.cumulativeProgress=2]="cumulativeProgress",(Ex=Ax||(Ax={})).uploading="uploading",Ex.waiting="waiting",Ex.done="done",Ex.error="error",Ex.canceled="canceled",Ex.duplicateItem="duplicateItem";const Dx={[xx.waitingStart]:"#D6D6D6",[xx.running]:"#DAE9F4",[xx.effectivenessCheck]:"#1B75BB29",[xx.done]:"#DDEECA",[xx.suspended]:"#FFF2D6",[xx.canceled]:"#F4433629"},Px={[xx.waitingStart]:"#666666",[xx.running]:"#1B75BB",[xx.effectivenessCheck]:"#1B75BB",[xx.done]:"#4CAF50",[xx.suspended]:"#FF9800",[xx.canceled]:"#F44336"},Ix={[xx.waitingStart]:"waiting-start",[xx.running]:"running",[xx.effectivenessCheck]:"effectiveness-check",[xx.done]:"done",[xx.suspended]:"suspended",[xx.canceled]:"canceled"};function Tx(){return{[xx.waitingStart]:e.t("ap_status_waiting_start"),[xx.running]:e.t("ap_status_running"),[xx.effectivenessCheck]:e.t("ap_status_effectiveness_check"),[xx.done]:e.t("ap_status_done"),[xx.suspended]:e.t("ap_status_suspended"),[xx.canceled]:e.t("ap_status_canceled")}}const Mx=new Proxy({},{get:(e,a)=>{if("symbol"==typeof a)return;return Tx()[a]}});function Rx(){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")}]}const Lx=[{id:"immediate",label:"Imediata"},{id:"corrective",label:"Corretiva"},{id:"preventive",label:"Preventiva"},{id:"improvement",label:"Oportunidade de Melhoria"},{id:"standardization",label:"Padronização"}];function zx(){return[{id:Nx.low,label:e.t("ap_priority_low"),color:"#4CAF50"},{id:Nx.medium,label:e.t("ap_priority_medium"),color:"#FF9800"},{id:Nx.high,label:e.t("ap_priority_high"),color:"#F44336"}]}const Fx=[{id:Nx.low,label:"Baixa",color:"#4CAF50"},{id:Nx.medium,label:"Média",color:"#FF9800"},{id:Nx.high,label:"Alta",color:"#F44336"}],Ux=[xx.done,xx.canceled],jx=[xx.waitingStart,xx.running,xx.effectivenessCheck,xx.suspended];function Ox(e){const{actionPlan:a,isNew:t=!1,config:r,onSave:n,onCancel:i,onDelete:s,onChangeStatus:d}=e,[c,u]=o({formData:a||{},isLoading:e.isLoading||!1,isSaving:!1,activeTab:"general",isFormDisabled:!1});m(()=>{a&&u(e=>({...e,formData:a,isFormDisabled:r?.disableFields||Ux.includes(a.statusId)}))},[a,r?.disableFields]),m(()=>{u(a=>({...a,isLoading:e.isLoading||!1}))},[e.isLoading]);const p=l((e,a)=>{u(t=>({...t,formData:{...t.formData,[e]:a}}))},[]),h=l(e=>{u(a=>({...a,activeTab:e}))},[]),f=l(async()=>{if(n){u(e=>({...e,isSaving:!0}));try{await n(c.formData)}finally{u(e=>({...e,isSaving:!1}))}}},[n,c.formData]),g=l(async e=>{if(d&&c.formData.id){u(e=>({...e,isLoading:!0}));try{await d(c.formData.id,e)}finally{u(e=>({...e,isLoading:!1}))}}},[d,c.formData.id]),v=l(async()=>{if(s&&c.formData.id){u(e=>({...e,isLoading:!0}));try{await s(c.formData.id)}finally{u(e=>({...e,isLoading:!1}))}}},[s,c.formData.id]);return{formData:c.formData,isLoading:c.isLoading,isSaving:c.isSaving,activeTab:c.activeTab,isFormDisabled:c.isFormDisabled,updateField:p,setActiveTab:h,save:f,changeStatus:g,remove:v,cancel:i}}const Bx={[xx.waitingStart]:{label:"",color:"#8B7355",icon:We},[xx.running]:{label:"",color:"#2E7D5B",icon:wa},[xx.effectivenessCheck]:{label:"",color:"#4A6FA5",icon:Ge},[xx.done]:{label:"",color:"#3D7A40",icon:aa},[xx.suspended]:{label:"",color:"#6B7280",icon:Na},[xx.canceled]:{label:"",color:"#B44A4A",icon:E}};function $x({status:e,labels:t,className:r,size:n,showIcon:i,variant:o}){const s=Tx(),l=Bx[e];if(!l)return null;const d=t?.[e]||s[e]||"";return a(Xh,{label:d,color:l.color,icon:l.icon,size:n,showIcon:i,variant:o,className:r})}function Vx({formData:e,updateField:r,disabled:n=!1,users:o=[],places:s=[],actionTypes:l,causes:d=[],parentActions:c=[],config:u}){const{t:m}=Ga(),p=u?.requiredFields,h=l||Lx,f=e=>{if(u?.hiddenFields?.includes(e))return!1;if(u?.visibleFields&&u.visibleFields.length>0)return u.visibleFields.includes(e);const a=`${e}Visible`;return!p||!(a in p)||!1!==p[a]},g=e=>p?!!p[e]:"name"===e,v=i.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 t("div",{className:"space-y-6 p-1",children:[t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("name")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Nome"}),a(qi,{value:e.name||"",onChange:e=>r("name",e.target.value),maxLength:500,disabled:n,placeholder:m("ap_plan_name_placeholder")})]}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f("responsibleWho")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("responsibleWho")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Responsável"}),t(Lo,{value:e.responsibleId||"",onValueChange:e=>r("responsibleId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_responsible")})}),a(Bo,{children:o.map(e=>a(Vo,{value:e.id,children:e.name},e.id))})]})]}),f("checkerWho")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("checkerWho")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Verificador"}),t(Lo,{value:e.checkerId||"",onValueChange:e=>r("checkerId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_checker")})}),a(Bo,{children:o.map(e=>a(Vo,{value:e.id,children:e.name},e.id))})]})]})]}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f("place")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("place")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Local"}),t(Lo,{value:e.placeId||"",onValueChange:e=>r("placeId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_place")})}),a(Bo,{children:qx(s).map(e=>a(Vo,{value:e.id,children:e.name},e.id))})]})]}),f("planType")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("planType")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Tipo de Ação"}),t(Lo,{value:e.typeId||"",onValueChange:e=>r("typeId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_type")})}),a(Bo,{children:h.map(e=>a(Vo,{value:e.id,children:e.label},e.id))})]})]})]}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f("priority")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("priority")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Prioridade"}),t(Lo,{value:e.priorityType?.toString()||"",onValueChange:e=>r("priorityType",Number(e)),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_priority")})}),a(Bo,{children:Fx.map(e=>a(Vo,{value:e.id.toString(),children:t("span",{className:"flex items-center gap-2",children:[a("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:e.color}}),e.label]})},e.id))})]})]}),c.length>0&&t("div",{className:"space-y-2",children:[a(Hi,{children:m("ap_belongs_to")}),t(Lo,{value:e.parentId||"",onValueChange:e=>r("parentId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_parent")})}),a(Bo,{children:c.map(e=>a(Vo,{value:e.id,children:e.label},e.id))})]})]})]}),t("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[f("startDate")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("startDate")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Data de Início"}),a(Ru,{date:e.startDate?new Date(e.startDate):void 0,onDateChange:e=>r("startDate",e||null),disabled:n,placeholder:m("ap_select_date")})]}),f("endDate")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("endDate")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Data de Término"}),a(Ru,{date:e.endDate?new Date(e.endDate):void 0,onDateChange:e=>r("endDate",e||null),disabled:n,placeholder:m("ap_select_date"),disabledDates:e.startDate?a=>a<new Date(e.startDate):void 0})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:m("ap_duration_days")}),a(qi,{type:"number",value:v,disabled:!0,className:"bg-muted"})]})]}),f("estimatedCost")&&t("div",{className:"space-y-2 max-w-xs",children:[a(Hi,{className:Fi(g("estimatedCost")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Custo Estimado"}),t("div",{className:"relative",children:[a("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"R$"}),a(qi,{type:"number",min:0,step:.01,value:e.estimatedCost||"",onChange:e=>r("estimatedCost",Number(e.target.value)),disabled:n,className:"pl-9",placeholder:"0,00"})]})]}),f("cause")&&d.length>0&&t("div",{className:"space-y-2",children:[a(Hi,{children:"Causa"}),t(Lo,{value:e.causeId||"",onValueChange:e=>r("causeId",e),disabled:n,children:[a(Uo,{children:a(Fo,{placeholder:m("ap_select_cause")})}),a(Bo,{children:d.map(e=>a(Vo,{value:e.id,children:e.label},e.id))})]})]}),f("description")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("description")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Descrição"}),a(Ho,{value:e.description||"",onChange:e=>r("description",e.target.value),maxLength:4e3,disabled:n,rows:4,placeholder:m("ap_description_placeholder")})]}),f("justification")&&t("div",{className:"space-y-2",children:[a(Hi,{className:Fi(g("justification")&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:"Justificativa"}),a(Ho,{value:e.justification||"",onChange:e=>r("justification",e.target.value),maxLength:4e3,disabled:n,rows:4,placeholder:m("ap_justification_placeholder")})]})]})}function qx(e,a=0){const t=[];for(const r of e)t.push({...r,depth:a}),r.children?.length&&t.push(...qx(r.children,a+1));return t}function Wx(e){const{progress:a,onReportProgress:t,onEditProgress:r,onDeleteProgress:n}=e,[i,s]=o(!1),[d,c]=o(null),u=!!a&&jx.includes(a.status),m=l(async e=>{if(t&&a){s(!0);try{const r=100===e.percentProgress;await t({id:a.id,...e,conclude:r})}finally{s(!1)}}},[t,a]),p=l(async e=>{if(r){s(!0);try{await r(e)}finally{s(!1),c(null)}}},[r]),h=l(async e=>{if(n){s(!0);try{await n(e)}finally{s(!1)}}},[n]);return{progress:a,canReportProgress:u,isSubmitting:i,editingReport:d,setEditingReport:c,reportProgress:m,editProgress:p,deleteProgress:h}}function Hx(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 r=parseInt(a)||0,n=parseInt(t)||0;return r+=Math.floor(n/60),n%=60,`${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`}}if(a=a.replace(/\D/g,""),!a)return"00:00";let t=0,r=0;return 4===a.length?(t=parseInt(a.substring(0,2))||0,r=parseInt(a.substring(2,4))||0,t+=Math.floor(r/60),r%=60):(t=parseInt(a)||0,r=0),`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Gx(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 r=parseInt(t)||0,n=parseInt(e)||0;return r+=Math.floor(n/60),n%=60,`${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`}}function Kx(e){return 100===e?"#84c148":e>0?"#1b75bb":""}function Yx({open:e,onOpenChange:r,report:n,onSave:s,isSubmitting:l=!1}){const{t:d}=Ga(),[c,u]=o(n?.percentProgress||0),[m,p]=o(n?.timeProgress||""),[h,f]=o(n?.comments||""),g=c!==(n?.percentProgress??0)||m!==(n?.timeProgress??"")||h!==(n?.comments??"");i.useEffect(()=>{n&&(u(n.percentProgress),p(n.timeProgress||""),f(n.comments||""))},[n]);return a(mo,{open:e,onOpenChange:r,children:t(bo,{className:"sm:max-w-md",variant:"form",isDirty:g,children:[a(xo,{children:a(wo,{children:d("ap_edit_progress")})}),t("div",{className:"space-y-4 py-4",children:[t("div",{className:"space-y-2",children:[a(Hi,{children:d("ap_progress_percent")}),a(qi,{type:"number",min:0,max:100,value:c,onChange:e=>u(Number(e.target.value))})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:d("ap_time_spent")}),a(qi,{value:m,onChange:e=>p(e.target.value),onBlur:()=>p(Hx(m)||""),placeholder:"00:00"})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:d("ap_comments")}),a(Ho,{value:h,onChange:e=>f(e.target.value),rows:3,maxLength:4e3})]})]}),t(No,{children:[a($i,{variant:"outline",onClick:()=>r(!1),disabled:l,children:"Cancelar"}),a($i,{onClick:()=>{n&&s({...n,percentProgress:c,timeProgress:Hx(m)||"00:00",comments:h})},disabled:l,children:l?"Salvando...":"Salvar"})]})]})})}function Qx(e){const{t:r}=Ga(),{progress:n,canReportProgress:i,isSubmitting:s,editingReport:l,setEditingReport:d,reportProgress:c,editProgress:u,deleteProgress:m}=Wx(e),[p,h]=o(""),[f,g]=o(""),[v,b]=o("");if(!n)return a("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Sem dados de progresso disponíveis"});const x=Kx(n.percentProgress),y=!p,N=!p&&!f&&!v;return t("div",{className:"space-y-6 p-1",children:[t("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t("div",{className:"flex items-center justify-between text-sm",children:[a("span",{className:"font-medium",children:r("ap_overall_progress")}),t("span",{className:"font-semibold",style:{color:x||void 0},children:[n.percentProgress,"%"]})]}),a(Rm,{value:n.percentProgress,className:"h-3"}),n.timeProgress&&t("div",{className:"text-xs text-muted-foreground",children:["Tempo total: ",Gx(n.timeProgress)]})]}),i&&t("div",{className:"rounded-lg border bg-card p-4 space-y-4",children:[a("h4",{className:"text-sm font-medium",children:r("ap_report_progress")}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(Hi,{children:r("ap_progress_percent")}),a(qi,{type:"number",min:0,max:100,value:p,onChange:e=>h(e.target.value),placeholder:"0"})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:r("ap_time_spent")}),a(qi,{value:f,onChange:e=>g(e.target.value),onBlur:()=>g(Hx(f)||""),placeholder:"00:00"})]})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:r("ap_comments")}),a(Ho,{value:v,onChange:e=>b(e.target.value),rows:3,maxLength:4e3,placeholder:r("ap_progress_comment_placeholder")})]}),t("div",{className:"flex gap-2 justify-end",children:[a($i,{variant:"outline",size:"sm",onClick:()=>{h(""),g(""),b("")},disabled:N||s,children:"Limpar"}),a($i,{size:"sm",onClick:async()=>{const e=Number(p);(e||0===e)&&(await c({percentProgress:e,timeProgress:Hx(f)||"00:00",comments:v}),h(""),g(""),b(""))},disabled:y||s,children:s?"Reportando...":"Reportar"})]})]}),n.reports.length>0&&t("div",{className:"space-y-3",children:[a("h4",{className:"text-sm font-medium",children:r("ap_reports_history")}),a("div",{className:"space-y-2",children:n.reports.map(e=>a(Xx,{report:e,onEdit:()=>d(e),onDelete:()=>m(e.id),disabled:!i},e.id))})]}),a(Yx,{open:!!l,onOpenChange:e=>!e&&d(null),report:l,onSave:u,isSubmitting:s})]})}function Xx({report:r,onEdit:n,onDelete:i,disabled:o}){const s=r.date?new Date(r.date):null,l=Kx(r.percentProgress);return t("div",{className:"flex items-start gap-3 rounded-lg border bg-card p-3",children:[a("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:r.userName?.charAt(0)?.toUpperCase()||"?"}),t("div",{className:"flex-1 min-w-0 space-y-1",children:[t("div",{className:"flex items-center gap-2 text-sm",children:[a("span",{className:"font-medium truncate",children:r.userName}),s&&a("span",{className:"text-xs text-muted-foreground",children:s.toLocaleDateString("pt-BR")})]}),t("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[t("span",{style:{color:l||void 0},className:"font-semibold",children:[r.percentProgress,"%"]}),r.timeProgress&&t("span",{children:["Tempo: ",Gx(r.timeProgress)]})]}),r.comments&&a("p",{className:"text-xs text-muted-foreground mt-1",children:r.comments})]}),!o&&t(Zo,{children:[a(es,{asChild:!0,children:a(Vi,{})}),t(ss,{align:"end",children:[a(ls,{onClick:n,children:e.t("edit")}),a(ls,{className:"text-destructive",onClick:i,children:e.t("ap_delete")})]})]})]})}function Jx({predecessors:e=[],availablePredecessors:r=[],onAdd:n,onRemove:o,disabled:s=!1}){const{t:l}=Ga(),[d,c]=i.useState(""),u=r.filter(a=>!e.some(e=>e.predecessorId===a.id));return t("div",{className:"space-y-6 p-1",children:[!s&&u.length>0&&t("div",{className:"flex items-end gap-3",children:[t("div",{className:"flex-1 space-y-2",children:[a(Hi,{children:l("ap_add_predecessor")}),t(Lo,{value:d,onValueChange:c,children:[a(Uo,{children:a(Fo,{placeholder:l("ap_select_action")})}),a(Bo,{children:u.map(e=>a(Vo,{value:e.id,children:e.label},e.id))})]})]}),t($i,{size:"sm",onClick:()=>{d&&n&&(n(d),c(""))},disabled:!d,children:[a(Q,{className:"h-4 w-4 mr-1"}),"Adicionar"]})]}),e.length>0?a("div",{className:"space-y-2",children:e.map(e=>t("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[t("div",{className:"flex items-center gap-3",children:[e.predecessorCode&&a("span",{className:"text-xs text-muted-foreground font-mono",children:e.predecessorCode}),a("span",{className:"text-sm font-medium",children:e.predecessorName}),null!=e.predecessorStatus&&a($x,{status:e.predecessorStatus})]}),!s&&o&&t(Zo,{children:[a(es,{asChild:!0,children:a(Vi,{})}),a(ss,{align:"end",children:a(ls,{className:"text-destructive",onClick:()=>o(e.predecessorId),children:"Remover"})})]})]},e.id))}):a("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Nenhum predecessor adicionado"})]})}function Zx({costs:e=[],onAdd:r,onEdit:n,onDelete:i,disabled:s=!1}){const{t:l}=Ga(),[d,c]=o(""),[u,m]=o(""),p=e.reduce((e,a)=>e+(a.value||0),0);return t("div",{className:"space-y-6 p-1",children:[t("div",{className:"rounded-lg border bg-card p-4 flex items-center justify-between",children:[a("span",{className:"text-sm font-medium",children:l("ap_total_cost")}),t("span",{className:"text-lg font-semibold text-foreground",children:["R$ ",p.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})]})]}),!s&&r&&t("div",{className:"rounded-lg border bg-card p-4 space-y-4",children:[a("h4",{className:"text-sm font-medium",children:l("ap_add_cost")}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(Hi,{children:"Descrição"}),a(qi,{value:d,onChange:e=>c(e.target.value),placeholder:l("ap_cost_description")})]}),t("div",{className:"space-y-2",children:[a(Hi,{children:"Valor (R$)"}),a(qi,{type:"number",min:0,step:.01,value:u,onChange:e=>m(e.target.value),placeholder:"0,00"})]})]}),a("div",{className:"flex justify-end",children:t($i,{size:"sm",onClick:()=>{d&&u&&r&&(r({description:d,value:Number(u),date:(new Date).toISOString()}),c(""),m(""))},disabled:!d||!u,children:[a(Q,{className:"h-4 w-4 mr-1"}),"Adicionar"]})})]}),e.length>0?a("div",{className:"space-y-2",children:e.map(e=>t("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[t("div",{className:"flex-1 min-w-0",children:[a("p",{className:"text-sm font-medium truncate",children:e.description}),e.date&&a("p",{className:"text-xs text-muted-foreground",children:new Date(e.date).toLocaleDateString("pt-BR")})]}),t("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-semibold whitespace-nowrap",children:["R$ ",e.value.toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})]}),!s&&(n||i)&&t(Zo,{children:[a(es,{asChild:!0,children:a(Vi,{})}),t(ss,{align:"end",children:[n&&a(ls,{onClick:()=>n(e),children:l("edit")}),i&&a(ls,{className:"text-destructive",onClick:()=>i(e.id),children:l("ap_delete")})]})]})]})]},e.id))}):a("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Nenhum custo registrado"})]})}function ey({comments:e=[],currentUserId:r,onAdd:n,onEdit:i,onDelete:s,disabled:l=!1,maxLength:d=4e3}){const{t:c}=Ga(),[u,m]=o(""),[p,h]=o(!1),[f,g]=o(null),[v,b]=o(""),x=()=>{g(null),b("")};return t("div",{className:"space-y-6 p-1",children:[!l&&n&&t("div",{className:"space-y-3",children:[a(Ho,{value:u,onChange:e=>m(e.target.value),placeholder:c("ap_add_comment_placeholder"),maxLength:d,rows:3}),t("div",{className:"flex items-center justify-between",children:[d&&t("span",{className:"text-xs text-muted-foreground",children:[u.length,"/",d]}),t("div",{className:"flex gap-2 ml-auto",children:[a($i,{variant:"outline",size:"sm",onClick:()=>m(""),disabled:!u||p,children:"Limpar"}),a($i,{size:"sm",onClick:async()=>{if(u.trim()&&n){h(!0);try{await n(u),m("")}finally{h(!1)}}},disabled:!u.trim()||p,children:p?"Enviando...":"Comentar"})]})]})]}),t("div",{className:"space-y-1",children:[e.length>0?t("div",{className:"flex items-center gap-2 mb-3",children:[a("span",{className:"text-sm font-medium",children:c("ap_comments")}),a(Ko,{variant:"info",className:"text-[10px] px-1.5 py-0",children:e.length})]}):t("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a(_a,{className:"h-8 w-8 mb-2 opacity-50"}),a("p",{className:"text-sm",children:"Nenhum comentário adicionado"})]}),e.map(e=>t("div",{className:"flex gap-3 rounded-lg border bg-card p-3",children:[a("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("img",{src:e.userPhotoUrl,alt:e.userName,className:"h-full w-full object-cover"}):e.userName?.charAt(0)?.toUpperCase()||"?"}),t("div",{className:"flex-1 min-w-0 space-y-1",children:[t("div",{className:"flex items-center gap-2 text-sm",children:[a("span",{className:"font-medium truncate",children:e.userName}),e.userEmail&&a("span",{className:"text-xs text-muted-foreground truncate",children:e.userEmail}),a("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:ay(e.dateEdited||e.dateCreation)}),e.dateEdited&&a("span",{className:"text-xs text-muted-foreground italic",children:"editado"})]}),f===e.id?t("div",{className:"space-y-2",children:[a(Ho,{value:v,onChange:e=>b(e.target.value),maxLength:d,rows:3}),t("div",{className:"flex gap-2 justify-end",children:[a($i,{variant:"outline",size:"sm",onClick:x,disabled:p,children:"Cancelar"}),a($i,{size:"sm",onClick:()=>(async e=>{if(v.trim()&&i){h(!0);try{await i({...e,text:v,stringText:v}),g(null),b("")}finally{h(!1)}}})(e),disabled:!v.trim()||p,children:p?"Salvando...":"Salvar"})]})]}):a("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.stringText||e.text})]}),!l&&r===e.userId&&f!==e.id&&t(Zo,{children:[a(es,{asChild:!0,children:a(Vi,{})}),t(ss,{align:"end",children:[i&&a(ls,{onClick:()=>(e=>{g(e.id),b(e.stringText||e.text)})(e),children:c("edit")}),s&&a(ls,{className:"text-destructive",onClick:()=>(async e=>{if(s){h(!0);try{await s(e)}finally{h(!1)}}})(e.id),children:"Excluir"})]})]})]},e.id))]})]})}function ay(e){const{t:a}=Ga();if(!e)return"";const t=new Date(e);return`${t.toLocaleDateString("pt-BR")} ${t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}`}function ty({history:e=[],isLoading:r=!1}){const{t:n}=Ga();return r?a("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Carregando histórico..."}):0===e.length?t("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a(We,{className:"h-8 w-8 mb-2 opacity-50"}),a("p",{className:"text-sm",children:n("ap_no_history")})]}):a("div",{className:"p-1",children:t("div",{className:"relative",children:[a("div",{className:"absolute left-4 top-0 bottom-0 w-px bg-border"}),a("div",{className:"space-y-0",children:e.map((e,r)=>t("div",{className:"relative flex gap-4 pb-6 last:pb-0",children:[a("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("span",{className:"text-xs text-primary",children:e.icon}):a("div",{className:"h-2 w-2 rounded-full bg-primary"})}),t("div",{className:"flex-1 min-w-0 rounded-lg border bg-card p-3 space-y-2",children:[t("div",{children:[a("h4",{className:"text-sm font-medium",children:e.translateEvent||e.eventName}),e.eventDescription&&a("p",{className:"text-xs text-muted-foreground",children:e.eventDescription})]}),t("div",{className:"flex items-center gap-2",children:[a("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("img",{src:e.userPhotoUrl,alt:e.userName,className:"h-full w-full object-cover"}):e.userName?.charAt(0)?.toUpperCase()||"?"}),t("div",{className:"min-w-0",children:[a("span",{className:"text-xs font-medium truncate block",children:e.userName}),e.userEmail&&a("span",{className:"text-[10px] text-muted-foreground truncate block",children:e.userEmail})]})]}),t("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[t("div",{className:"flex items-center gap-1",children:[a(ye,{className:"h-3 w-3"}),a("span",{children:ry(e.date)})]}),t("div",{className:"flex items-center gap-1",children:[a(We,{className:"h-3 w-3"}),a("span",{children:ny(e.date)})]}),e.isMobileRequest&&t("div",{className:"flex items-center gap-1",children:[a(Ca,{className:"h-3 w-3"}),a("span",{children:n("ap_via_app")})]})]})]})]},e.id))})]})})}function ry(e){const{t:a}=Ga();return new Date(e).toLocaleDateString("pt-BR")}function ny(e){const{t:a}=Ga();return new Date(e).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function iy({attachments:e=[],onUpload:n,onDelete:i,onRename:s,onDownload:l,onView:d,disabled:c=!1}){const{t:m}=Ga(),p=u(null),[h,f]=o(null),[g,v]=o(""),b=async e=>{g.trim()&&s&&(await s(e.id,g),f(null),v(""))},x=()=>{f(null),v("")};return t("div",{className:"space-y-4 p-1",children:[!c&&n&&t(r,{children:[a("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:e=>{const a=e.target.files;if(a&&n){for(let e=0;e<a.length;e++){const t=a.item(e);t&&n(t)}p.current&&(p.current.value="")}}}),t($i,{size:"sm",onClick:()=>p.current?.click(),children:[a(Q,{className:"h-4 w-4 mr-1"}),"Adicionar anexo"]})]}),e.length>0?a("div",{className:"space-y-2",children:e.map(e=>t("div",{className:Fi("flex items-center gap-3 rounded-lg border bg-card p-3",e.status===Ax.error&&"border-destructive/50 bg-destructive/5",e.status===Ax.canceled&&"opacity-50"),children:[a("div",{className:"flex-shrink-0 h-9 w-9 rounded bg-muted flex items-center justify-center",children:a("span",{className:"text-[10px] font-bold uppercase text-muted-foreground",children:e.extension.replace(".","").substring(0,4)})}),t("div",{className:"flex-1 min-w-0 space-y-1",children:[h===e.id?t("div",{className:"flex items-center gap-2",children:[a("input",{className:"flex-1 text-sm border rounded px-2 py-1 bg-background",value:g,onChange:e=>v(e.target.value),onKeyDown:a=>{"Enter"===a.key&&b(e),"Escape"===a.key&&x()},autoFocus:!0}),a($i,{size:"sm",variant:"outline",onClick:x,children:m("cancel")}),a($i,{size:"sm",onClick:()=>b(e),children:m("save")})]}):a("button",{type:"button",className:"text-sm font-medium truncate block text-left hover:underline cursor-pointer",onClick:()=>d?.(e.id),children:e.name}),(e.status===Ax.uploading||e.status===Ax.waiting)&&a(Rm,{value:e.progress||0,className:"h-1.5"}),e.status===Ax.error&&a("p",{className:"text-xs text-destructive",children:"Erro ao enviar arquivo"}),e.status===Ax.duplicateItem&&a("p",{className:"text-xs text-warning",children:"Arquivo duplicado"}),e.status===Ax.canceled&&a("p",{className:"text-xs text-muted-foreground",children:"Upload cancelado"})]}),t("div",{className:"flex items-center gap-2",children:[e.status===Ax.done&&t(r,{children:[a("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:oy(e.size)}),t(Zo,{children:[a(es,{asChild:!0,children:a(Vi,{})}),t(ss,{align:"end",children:[s&&!c&&a(ls,{onClick:()=>(e=>{const a=e.name.replace(e.extension,"");f(e.id),v(a)})(e),children:"Renomear"}),d&&a(ls,{onClick:()=>d(e.id),children:"Visualizar"}),l&&a(ls,{onClick:()=>l(e.id),children:"Download"}),i&&!c&&t(r,{children:[a(ms,{}),a(ls,{className:"text-destructive",onClick:()=>i(e.id),children:"Excluir"})]})]})]})]}),e.status===Ax.uploading&&a($i,{variant:"outline",size:"sm",onClick:()=>i?.(e.id),children:"Cancelar"})]})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[a(ka,{className:"h-8 w-8 mb-2 opacity-50"}),a("p",{className:"text-sm",children:"Nenhum anexo adicionado"})]})]})}function oy(e){const{t:a}=Ga();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]}`}function sy(e){const{formData:r,isLoading:n,isSaving:i,activeTab:o,isFormDisabled:s,updateField:l,setActiveTab:d,save:c,changeStatus:u,remove:m,cancel:p}=Ox(e),{t:h}=Ga(),{isNew:f=!1,config:g,users:v,places:b,actionTypes:x,causes:y,parentActions:N,progress:w,predecessors:_,availablePredecessors:C,costs:k,comments:S,history:A,attachments:E,attachmentsSlot:D,commentsSlot:P,historySlot:I,onAddPredecessor:T,onRemovePredecessor:M,onAddCost:R,onEditCost:L,onDeleteCost:z,onAddComment:F,onEditComment:U,onDeleteComment:j,onUploadAttachment:O,onDeleteAttachment:B,onRenameAttachment:$,onDownloadAttachment:V,onViewAttachment:q}=e;if(n&&!r.id)return a(Xo,{isLoading:!0,children:a("div",{})});const W=function(e){const{t:a}=Ga();if(!e)return[];return{[xx.waitingStart]:[xx.running,xx.suspended,xx.canceled],[xx.running]:[xx.effectivenessCheck,xx.done,xx.suspended,xx.canceled],[xx.effectivenessCheck]:[xx.running,xx.done,xx.suspended,xx.canceled],[xx.done]:[xx.running],[xx.suspended]:[xx.running,xx.canceled],[xx.canceled]:[xx.waitingStart]}[e]||[]}(r.statusId);return t("div",{className:"flex flex-col h-full",children:[t("div",{className:"flex items-center justify-between border-b bg-card px-6 py-4",children:[t("div",{className:"flex items-center gap-4",children:[p&&a($i,{variant:"ghost",size:"icon",onClick:p,children:a(je,{className:"h-4 w-4"})}),t("div",{className:"space-y-1",children:[t("div",{className:"flex items-center gap-3",children:[a("h1",{className:"text-lg font-semibold",children:f?h("ap_new_action"):r.name||h("ap_action_plan")}),!f&&r.statusId&&a($x,{status:r.statusId})]}),r.code&&a("p",{className:"text-xs text-muted-foreground font-mono",children:r.code})]})]}),t("div",{className:"flex items-center gap-2",children:[!f&&W.length>0&&!s&&t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"outline",size:"sm",children:"Alterar Status"})}),a(ss,{align:"end",children:W.map(e=>a(ls,{onClick:()=>u(e),children:Mx[e]},e))})]}),!f&&e.onDelete&&t(Zo,{children:[a(es,{asChild:!0,children:a($i,{variant:"ghost",size:"icon",children:a(ra,{className:"h-4 w-4"})})}),a(ss,{align:"end",children:a(ls,{className:"text-destructive",onClick:m,children:"Excluir"})})]})]})]}),a("div",{className:"flex-1 min-h-0 overflow-y-auto",children:a("div",{className:"max-w-4xl mx-auto px-6 py-6",children:t(Tc,{value:o,onValueChange:d,children:[t(Mc,{className:"mb-6",children:[a(Rc,{value:"general",children:"Geral"}),!f&&a(Rc,{value:"progress",children:"Progresso"}),!f&&g?.enablePredecessors&&a(Rc,{value:"predecessors",children:h("ap_predecessors")}),!f&&g?.enableCosts&&a(Rc,{value:"costs",children:"Custos"}),!f&&g?.enableAttachments&&a(Rc,{value:"attachments",children:h("ap_attachments")}),!f&&g?.enableComments&&a(Rc,{value:"comments",children:h("ap_comments")}),!f&&g?.enableHistory&&a(Rc,{value:"history",children:"Histórico"})]}),a(Lc,{value:"general",children:a(Vx,{formData:r,updateField:l,disabled:s,users:v,places:b,actionTypes:x,causes:y,parentActions:N,config:g})}),!f&&a(Lc,{value:"progress",children:a(Qx,{...e})}),!f&&g?.enablePredecessors&&a(Lc,{value:"predecessors",children:a(Jx,{predecessors:_,availablePredecessors:C,onAdd:T,onRemove:M,disabled:s})}),!f&&g?.enableCosts&&a(Lc,{value:"costs",children:a(Zx,{costs:k,onAdd:R,onEdit:L,onDelete:z,disabled:s})}),!f&&g?.enableAttachments&&a(Lc,{value:"attachments",children:D||a(iy,{attachments:E,onUpload:O,onDelete:B,onRename:$,onDownload:V,onView:q,disabled:s})}),!f&&g?.enableComments&&a(Lc,{value:"comments",children:P||a(ey,{comments:S,onAdd:F,onEdit:U,onDelete:j,disabled:s})}),!f&&g?.enableHistory&&a(Lc,{value:"history",children:I||a(ty,{history:A})})]})})}),t("div",{className:"flex items-center justify-end gap-3 border-t bg-card px-6 py-4",children:[p&&a($i,{variant:"outline",onClick:p,disabled:i,children:"Cancelar"}),a($i,{onClick:c,disabled:i||s,children:i?"Salvando...":"Salvar"})]})]})}const ly=["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 dy(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 cy(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}function uy({storedFile:e,customFileName:r,allowedExtensions:n,customExtensionErrorMessage:i,minSizeInBytes:s=1,maxSizeInBytes:d=314572800,showDownloadButton:c=!0,showViewButton:m=!0,showReplaceButton:p=!0,showCloseButton:h=!0,required:f=!1,touched:g=!1,disabled:v=!1,error:b,onFileSelect:x,onFileRemove:y,onFileReplace:N,onDownload:w,onView:_,className:C}){const{t:k}=Ga(),S=u(null),[A,D]=o(null),[P,I]=o(null),[T,M]=o(!1),R=A||e,L=A?.name||e?.name||"",z=A?.size||e?.size;L&&cy(L);const F=r||L,U=c&&!A&&!!e,j=m&&!A&&!!e,O=!!P||!!b||f&&g&&!R,B=!!R,$=l(e=>{if(ly.includes(e.type))return{type:"forbidden-type"};if(e.size<=s)return{type:"min-size"};if(e.size>=d)return{type:"max-size"};if(n?.length){const a=cy(e.name);if(!n.includes(a))return{type:"extension",message:i}}return null},[s,d,n,i]),V=l(e=>{const a=e.target.files?.[0];if(!a)return;const t=$(a);if(t)return I(t),D(null),void(S.current&&(S.current.value=""));I(null),D(a),x?.(a),S.current&&(S.current.value="")},[$,x]),q=l(e=>{if(e.preventDefault(),e.stopPropagation(),v)return;const a=e.dataTransfer.files?.[0];if(!a)return;const t=$(a);if(t)return I(t),void D(null);I(null),D(a),x?.(a)},[v,$,x]),W=l(e=>{e.preventDefault(),e.stopPropagation()},[]),H=l(()=>{N?.(),S.current?.click()},[N]),G=l(()=>{D(null),I(null),y?.(),S.current&&(S.current.value="")},[y]),K=l(async()=>{if(!T&&e&&w){M(!0);try{await w(e)}finally{M(!1)}}},[T,e,w]),Y=l(()=>{e&&_&&_(e)},[e,_]),Q=l(()=>{v||S.current?.click()},[v]),X=(()=>{if(b)return b;if(!P)return f&&g&&!R?k("required_field"):null;switch(P.type){case"extension":return P.message||k("sign_file_not_allowed");case"forbidden-type":return k("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${dy(s)}`;case"max-size":return`Tamanho máximo: ${dy(d)}`;default:return k("file_error")}})();return t("div",{className:Fi("space-y-1",C),children:[a("div",{className:Fi("rounded-md border border-dashed transition-colors",B&&"border-solid border-border",!B&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",O&&"border-destructive border-solid",v&&"opacity-50 pointer-events-none"),children:t("div",B?{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a(Be,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a("p",{className:"text-xs truncate",children:F})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[null!=z&&a("span",{className:"text-xs text-muted-foreground",children:dy(z)}),t("div",{className:"flex items-center gap-0.5",children:[U&&w&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:T,onClick:K,children:a(Je,{className:"h-3.5 w-3.5 text-primary"})})}),a(vs,{children:"Download"})]}),j&&_&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Y,children:a(Ce,{className:"h-3.5 w-3.5 text-primary"})})}),a(vs,{children:"Visualizar"})]}),p&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,children:a(ue,{className:"h-3.5 w-3.5 text-primary"})})}),a(vs,{children:"Substituir"})]}),h&&t(fs,{children:[a(gs,{asChild:!0,children:a($i,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:G,children:a(E,{className:"h-3 w-3 text-muted-foreground"})})}),a(vs,{children:k("remove")})]})]})]})]}:{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:Q,onKeyDown:e=>"Enter"===e.key&&Q(),onDrop:q,onDragOver:W,children:[a(Sa,{className:"h-4 w-4 text-muted-foreground"}),t("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",a("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),X&&a("p",{className:"text-xs text-destructive",children:X}),a("input",{ref:S,type:"file",className:"hidden",accept:n?.map(e=>`.${e}`).join(","),onChange:V,disabled:v})]})}var my,py,hy,fy,gy,vy;function by(e){switch(e.type){case my.text:return e.textValue;case my.number:return e.numberValue;case my.date:return e.dateValue;case my.time:return e.timeValue;case my.url:case my.singleSelection:case my.multiSelection:return e.itemsValue;case my.questions:return e.questionsValue;case my.readOnlyText:return e.textValue;default:return null}}function xy(e,a){if(!a)return!0;const t=null!=by(e)&&""!==by(e)&&!(Array.isArray(by(e))&&0===by(e).length);return!1!==e.isActive||t}function yy(e){return e.filter(e=>e.type!==my.readOnlyText).map(e=>({formFieldAssociationId:e.id,textValue:e.type===my.text?e.textValue:void 0,numberValue:e.type===my.number?e.numberValue:void 0,dateValue:e.type===my.date?e.dateValue:void 0,timeValue:e.type===my.time?e.timeValue:void 0,itemsValue:[my.url,my.singleSelection,my.multiSelection].includes(e.type)?e.itemsValue:void 0,questionsValue:e.type===my.questions?e.questionsValue:void 0}))}function Ny(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 my.text:r.textValue=t.textValue;break;case my.number:r.numberValue=t.numberValue;break;case my.date:r.dateValue=t.dateValue;break;case my.time:r.timeValue=t.timeValue;break;case my.url:case my.singleSelection:case my.multiSelection:r.itemsValue=t.itemsValue||[];break;case my.questions:r.questionsValue=t.questionsValue||[]}return r}):e}function wy(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||e.type===my.readOnlyText)return;const t=by(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),e.type===my.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)]}}function _y({field:e}){return t("div",{className:"space-y-1",children:[e.name&&a("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&a("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&a("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Cy({field:e,readOnly:r,onChange:n}){const i=e.config,o=i?.multiline??!1,s=r||e.readOnly,l=a=>{n?.({...e,textValue:a})};return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),o?a(Ho,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s,rows:4}):a(qi,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s})]})}function ky({field:e,readOnly:r,onChange:n}){const i=r||e.readOnly,o=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(qi,{type:"date",value:o,onChange:a=>{return t=a.target.value,void n?.({...e,dateValue:t||void 0});var t},placeholder:e.placeholder,disabled:i})]})}function Sy({field:e,readOnly:r,onChange:n}){const i=r||e.readOnly,o=e=>{if(!e)return;const[a,t]=e.split(":").map(Number);return 60*a+t};return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(qi,{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=>n?.({...e,timeValue:o(a.target.value)}),placeholder:e.placeholder,disabled:i})]})}function Ay({field:e,readOnly:r,onChange:n}){const i=e.config,s=i?.multiple??!1,l=r||e.readOnly,[d,c]=o(""),u=e.itemsValue||[],m=()=>{if(!d.trim())return;const a={value:crypto.randomUUID(),text:d.trim()};n?.({...e,itemsValue:[...u,a]}),c("")};if(!s){const r=u[0]?.text||"";return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),t("div",{className:"flex items-center gap-2",children:[a(qi,{type:"url",value:r,onChange:a=>(a=>{const t={value:a,text:a};n?.({...e,itemsValue:a?[t]:[]})})(a.target.value),placeholder:e.placeholder||"https://",disabled:l}),r&&a($i,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:a(pe,{className:"h-4 w-4"})})})]})]})}return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),!l&&t("div",{className:"flex items-center gap-2",children:[a(qi,{type:"url",value:d,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a($i,{variant:"outline",size:"icon",onClick:m,disabled:!d.trim(),className:"flex-shrink-0",children:a(Q,{className:"h-4 w-4"})})]}),u.length>0&&a("div",{className:"space-y-1",children:u.map((r,i)=>t("div",{className:"flex items-center gap-2 text-sm",children:[a("a",{href:r.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:r.text}),!l&&a($i,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(a=>{const t=u.filter((e,t)=>t!==a);n?.({...e,itemsValue:t})})(i),children:a(H,{className:"h-3 w-3"})})]},r.value))})]})}function Ey({field:e,readOnly:r,onChange:n}){const i=e.config,o=r||e.readOnly,s=null!=i?.decimals&&i.decimals>0?(1/Math.pow(10,i.decimals)).toString():"1";return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(qi,{type:"number",value:e.numberValue??"",onChange:a=>(a=>{if(""===a)return void n?.({...e,numberValue:void 0});const t=parseFloat(a);isNaN(t)||n?.({...e,numberValue:t})})(a.target.value),placeholder:e.placeholder,disabled:o,min:i?.min,max:i?.max,step:s}),null!=i?.min&&null!=i?.max&&t("p",{className:"text-xs text-muted-foreground",children:["Min: ",i.min," | Max: ",i.max]})]})}function Dy({field:e,readOnly:r,onChange:n}){const i=e.config,o=r||e.readOnly,s=i?.viewMode??hy.dropdown,l=i?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],d=e.itemsValue?.[0]?.value||"",c=a=>{const t=l.find(e=>e.value===a);if(!t)return;const r={value:t.value,text:t.text,isActive:t.isActive};n?.({...e,itemsValue:[r]})};return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),s===hy.dropdown&&t(Lo,{value:d,onValueChange:c,disabled:o,children:[a(Uo,{children:a(Fo,{placeholder:e.placeholder||"Selecione..."})}),a(Bo,{children:l.map(e=>t(Vo,{value:e.value,children:[e.text,!1===e.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(s===hy.radio||s===hy.buttons)&&a(Lm,{value:d,onValueChange:c,disabled:o,className:Fi(s===hy.buttons?"flex flex-wrap gap-2":"space-y-2"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(zm,{value:r.value,id:`${e.id}-${r.value}`}),t(Hi,{htmlFor:`${e.id}-${r.value}`,className:"text-sm font-normal cursor-pointer",children:[r.text,!1===r.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},r.value))}),!o&&d&&!e.required&&a("button",{type:"button",onClick:()=>{n?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Py({field:e,readOnly:r,onChange:n}){const i=e.config,o=r||e.readOnly,s=i?.viewMode??hy.dropdown,l=i?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],d=new Set(e.itemsValue?.map(e=>e.value)||[]);return t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&a("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(r=>t(Ko,{variant:"secondary",className:"gap-1 pr-1",children:[a("span",{className:"text-xs",children:r.text}),!o&&a("button",{type:"button",onClick:()=>(a=>{const t=(e.itemsValue||[]).filter(e=>e.value!==a);n?.({...e,itemsValue:t})})(r.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:a(E,{className:"h-3 w-3"})})]},r.value))}),!o&&a("div",{className:Fi(s===hy.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(Wo,{id:`${e.id}-${r.value}`,checked:d.has(r.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}];n?.({...e,itemsValue:r})})(r),disabled:o}),t(Hi,{htmlFor:`${e.id}-${r.value}`,className:"text-sm font-normal cursor-pointer",children:[r.text,!1===r.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},r.value))})]})}function Iy({field:e,readOnly:r,onChange:n}){const i=e.config,o=r||e.readOnly,s=i?.questions||[],l=i?.options||[],d=e.questionsValue||[];return 0===s.length||0===l.length?t("div",{className:"space-y-1.5",children:[a(Hi,{children:e.name}),a("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t("div",{className:"space-y-1.5",children:[a(Hi,{className:Fi(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a("div",{className:"border rounded-md overflow-x-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{children:t("tr",{className:"border-b bg-muted/50",children:[a("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),l.map(e=>a("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),a("tbody",{children:s.map((r,i)=>t("tr",{className:Fi(i<s.length-1&&"border-b"),children:[a("td",{className:"p-2 text-muted-foreground",children:r.text}),l.map(t=>{return a("td",{className:"text-center p-2",children:a(Lm,{value:(i=r.value,d.find(e=>e.questionValue===i)?.optionValue||""),onValueChange:a=>((a,t,r,i)=>{const o={questionValue:a,questionText:t,optionValue:r,optionText:i},s=d.filter(e=>e.questionValue!==a);s.push(o),n?.({...e,questionsValue:s})})(r.value,r.text,a,t.text),disabled:o,className:"flex justify-center",children:a(zm,{value:t.value,id:`${e.id}-${r.value}-${t.value}`})})},t.value);var i})]},r.value))})]})})]})}function Ty({fields:e,readOnly:t=!1,hideInactiveWithoutValue:r=!1,onChange:n,onFieldChange:i}){const o=l(a=>{if(i?.(a),n){const t=e.map(e=>e.id===a.id?a:e);n(t)}},[e,n,i]),s=e.filter(e=>xy(e,r));return 0===s.length?null:a("div",{className:"space-y-4",children:s.map(e=>a(My,{field:e,readOnly:t,onChange:o},e.id))})}function My({field:e,readOnly:t,onChange:r}){const n={field:e,readOnly:t,onChange:r};switch(e.type){case my.readOnlyText:return a(_y,{...n});case my.text:return a(Cy,{...n});case my.date:return a(ky,{...n});case my.time:return a(Sy,{...n});case my.url:return a(Ay,{...n});case my.number:return a(Ey,{...n});case my.singleSelection:return a(Dy,{...n});case my.multiSelection:return a(Py,{...n});case my.questions:return a(Iy,{...n});default:return null}}function Ry({queryParams:e,events:r,softwares:n,users:i=[],permissions:s={viewAllEvents:!0,viewOnlyMyEvents:!1,download:!1},isLoading:d=!1,onFilter:c,onReset:u,onExport:m,onSoftwareChange:p}){const[h,f]=o(e.softwareId),[g,v]=o(e.eventId),[b,x]=o(e.userId||"all"),[y,N]=o(Ly(e.startDate)),[w,_]=o(Ly(e.endDate)),C=l(e=>{const a=parseInt(e);f(a),p?.(a)},[p]),k=l(()=>{c({...e,softwareId:h,eventId:g,userId:"all"===b?void 0:b,startDate:new Date(y),endDate:new Date(w),software:n.find(e=>e.id===h)?.software||e.software,event:r.find(e=>e.id===g)?.name||e.event})},[e,h,g,b,y,w,n,r,c]),S=l(()=>{const a=new Date;a.setHours(0,0,0,0),N(Ly(a)),_(Ly(a)),v(e.eventId),s.viewAllEvents&&x("all"),u?.()},[e.eventId,s.viewAllEvents,u]),A=s.viewOnlyMyEvents&&!s.viewAllEvents,E=h&&g&&y&&w;return t("div",{className:"flex flex-wrap items-end gap-3 rounded-lg border border-border bg-card p-3",children:[t("div",{className:"flex flex-col gap-1 min-w-[180px]",children:[a(Hi,{className:"text-xs text-muted-foreground",children:"Módulo *"}),t(Lo,{value:String(h),onValueChange:C,disabled:d,children:[a(Uo,{className:"h-8 text-xs",children:a(Fo,{placeholder:"Selecione..."})}),a(Bo,{children:n.map(e=>a(Vo,{value:String(e.id),className:"text-xs",children:e.translation},e.id))})]})]}),t("div",{className:"flex flex-col gap-1 min-w-[200px]",children:[a(Hi,{className:"text-xs text-muted-foreground",children:"Evento *"}),t(Lo,{value:String(g),onValueChange:e=>v(parseInt(e)),disabled:d,children:[a(Uo,{className:"h-8 text-xs",children:a(Fo,{placeholder:"Selecione..."})}),a(Bo,{children:r.map(e=>a(Vo,{value:String(e.id),className:"text-xs",children:e.translation},e.id))})]})]}),t("div",{className:"flex flex-col gap-1 min-w-[200px]",children:[a(Hi,{className:"text-xs text-muted-foreground",children:"Usuário *"}),t(Lo,{value:b,onValueChange:x,disabled:d||A,children:[a(Uo,{className:"h-8 text-xs",children:a(Fo,{placeholder:"Selecione..."})}),t(Bo,{children:[a(Vo,{value:"all",className:"text-xs",children:"Todos"}),i.map(e=>a(Vo,{value:e.id,className:"text-xs",children:e.name},e.id))]})]})]}),t("div",{className:"flex flex-col gap-1 min-w-[150px]",children:[a(Hi,{className:"text-xs text-muted-foreground",children:"De *"}),a(qi,{type:"date",value:y,onChange:e=>N(e.target.value),className:"h-8 text-xs",max:w,disabled:d})]}),t("div",{className:"flex flex-col gap-1 min-w-[150px]",children:[a(Hi,{className:"text-xs text-muted-foreground",children:"Até *"}),a(qi,{type:"date",value:w,onChange:e=>_(e.target.value),className:"h-8 text-xs",min:y,disabled:d})]}),t("div",{className:"flex items-center gap-2 ml-auto",children:[t($i,{variant:"outline",size:"sm",onClick:S,disabled:d,children:[a(Aa,{className:"h-3.5 w-3.5 mr-1"}),"Limpar"]}),s.download&&m&&t($i,{variant:"outline",size:"sm",onClick:()=>m("xlsx"),disabled:d,children:[a(Je,{className:"h-3.5 w-3.5 mr-1"}),"Exportar"]}),t($i,{size:"sm",onClick:k,disabled:d||!E,children:[a(Ea,{className:"h-3.5 w-3.5 mr-1"}),"Filtrar"]})]})]})}function Ly(e){return(e instanceof Date?e:new Date(e)).toISOString().split("T")[0]}function zy(e,a,t,r="Anônimo"){return e.map(e=>({...e,translatedSoftware:Uy(e.software,t),user:e.userEmail||e.userName||r,translatedEvent:Fy(e.eventName,a),date:new Date(e.dateTime)})).sort((e,a)=>(a.date?.getTime()??0)-(e.date?.getTime()??0))}function Fy(e,a){const t=a.find(a=>a.name===e);return t?.translation||e}function Uy(e,a){const t=e.includes(".")?e.split(".").pop():e,r=a.find(e=>e.software===t);return r?.translation||t}function jy(e,a){const t=[],r={...Hy,...a?.labels},n=e.eventName;t.push({name:r.event,value:n});const i=e.entities?.[0];if(i&&(t.push({name:r.entityName,value:Oy(i)}),i.description&&t.push({name:r.description,value:i.description}),i.justification&&t.push({name:r.justification,value:i.justification}),i.statusName&&t.push({name:r.status,value:i.statusName}),i.equipmentType&&t.push({name:r.type,value:i.equipmentType}),i.extra?.length)){[...new Set(i.extra.map(e=>e.property))].forEach(e=>{const a=i.extra.filter(a=>a.property===e).map(e=>e.value||"").join(", ");t.push({name:qy(e),value:a})})}e.entities?.forEach(e=>{e.data?.forEach(e=>{if("Removed"===e.property)return;if(""===e.newValue&&!e.tagTranslate)return;const i=By(e,n,a?.translateProperty),o=$y(e,null,n,r,a);o&&t.push({name:i,value:o})})}),e.entities?.forEach(e=>{if(e.association?.length){const a=e.association.filter(e=>""!==e.id).map(e=>{const a=Oy(e);return`(${e.softwareName||e.type}) ${a}`});a.length&&t.push({name:r.references,value:a.join(", ")})}}),i?.isElectronicSigned&&t.push({name:r.security,value:"🛡️ "+r.electronicSigned}),t.push({name:r.accomplishedBy,value:e.userName?`${e.userName} (${e.userEmail})`:e.userEmail});const o=a?.formatDate?a.formatDate(e.dateTime):Wy(e.dateTime);return t.push({name:r.accomplishedIn,value:o}),t}function Oy(e){return e.code&&e.name&&e.code!==e.name?`${e.code} ${e.name}`:e.name||e.code||""}function By(e,a,t){if(e.propertyCustomName)return e.propertyCustomName;const r=qy(e.property);return t?t(a,r):r}function $y(e,a,t,r,n){if(e.propertyResource||(e.propertyResource=a?`${a.propertyResource}.${e.property}`:e.property),e.children?.length){if(e.newValue){const a=By(e,t,n?.translateProperty),i=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,r);let o=`${a}: "${Vy(e,"newValue",r,n)}" ${i}`;const s=e.children.map(a=>(a.propertyResource=`${e.propertyResource}.${a.property}`,$y(a,e,t,r,n)));return s.some(Boolean)&&(o+="\n"+s.filter(Boolean).join("\n")),o}return e.children.map(a=>(a.propertyResource=`${e.propertyResource}.${a.property}`,$y(a,e,t,r,n))).filter(Boolean).join("\n")}if("Removed"===e.property)return"";if("Modified"===e.state){const i=Vy(e,"oldValue",r,n),o=Vy(e,"newValue",r,n);return`${a?By(e,t,n?.translateProperty)+": ":""}${r.changedFrom} "${i}" ${r.changedTo} "${o}"`}const i=Vy(e,"newValue",r,n);return a?`${By(e,t,n?.translateProperty)}: ${i}`:i}function Vy(e,a,t,r){const n=e[a];return null==n||""===n?"Modified"===e.state||"Added"===e.state||"Unchanged"===e.state?t.uninformed:"":"string"==typeof n&&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())}(n)?r?.formatDate?r.formatDate(n):Wy(n):String(n)}function qy(e){return e.replace(/([A-Z])/g,(e,a,t)=>`${t>0?"-":""}${a.toLowerCase()}`)}function Wy(e){try{return new Date(e).toLocaleString()}catch{return e}}(py=my||(my={}))[py.readOnlyText=1]="readOnlyText",py[py.text=2]="text",py[py.date=3]="date",py[py.time=4]="time",py[py.url=5]="url",py[py.number=6]="number",py[py.singleSelection=7]="singleSelection",py[py.multiSelection=8]="multiSelection",py[py.questions=9]="questions",(fy=hy||(hy={}))[fy.dropdown=1]="dropdown",fy[fy.buttons=2]="buttons",fy[fy.radio=3]="radio",fy[fy.checkbox=4]="checkbox",(vy=gy||(gy={}))[vy.custom=1]="custom",vy[vy.users=2]="users",vy[vy.usersLists=3]="usersLists";const Hy={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 Gy({documentId:e,onFetchDetails:r,onClose:n,labels:i,translateProperty:s,translatePropertyValue:d,formatDate:c}){const[u,p]=o(!1),[h,f]=o([]),[g,v]=o(null),b=l(async e=>{p(!0),v(null);try{const a=jy(await r(e),{translateProperty:s,translatePropertyValue:d,formatDate:c,labels:i});f(a)}catch(a){v("Erro ao carregar detalhes da trilha de auditoria."),f([])}finally{p(!1)}},[r,s,d,c,i]);return m(()=>{e&&b(e)},[e,b]),e?t("div",{className:"flex flex-col h-full bg-background",children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/30",children:[a("h3",{className:"text-sm font-semibold text-foreground",children:"Detalhes da Auditoria"}),a($i,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:n,children:a(E,{className:"h-4 w-4"})})]}),a("div",{className:"flex-1 overflow-y-auto",children:u?t("div",{className:"flex items-center justify-center p-6",children:[a(Qo,{size:"md"}),a("span",{className:"ml-2 text-sm text-muted-foreground",children:"Carregando detalhes..."})]}):g?a("div",{className:"p-6 text-sm text-destructive",children:g}):a("table",{className:"w-full text-xs",children:a("tbody",{children:h.map((e,r)=>t("tr",{className:r%2==0?"bg-background":"bg-muted/20",children:[a("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("td",{className:"px-4 py-2.5 text-muted-foreground break-words border-b border-border/50",children:a("span",{dangerouslySetInnerHTML:{__html:e.value.replace(/\n/g,"<br />")}})})]},r))})})})]}):null}function Ky({title:r,softwares:n,softwareId:i,permissions:s={viewAllEvents:!0,viewOnlyMyEvents:!1,download:!1},callbacks:d,limit:c=2e3,currentUserId:p,labels:h,formatDate:f,anonymousLabel:g=e.t("anonymous")}){const{t:v}=Ga();r??v("audit_trail");const[b,x]=o(!0),[y,N]=o([]),[w,_]=o([]),[C,k]=o([]),[S,A]=o(null),[E,D]=o(!1),P=u(null),I=new Date;I.setHours(0,0,0,0);const[T,M]=o({software:n.find(e=>e.id===i)?.software||"",softwareId:i,event:"All",eventId:1,startDate:I,endDate:I,limit:c,softwares:n,userId:s.viewOnlyMyEvents&&!s.viewAllEvents?p:void 0});m(()=>{(async()=>{x(!0);try{const[e,a]=await Promise.all([d.onFetchEvents(T.softwareId),d.onFetchUsers?.()??Promise.resolve([])]);_(e),k(a),await R(T,e)}catch(e){}finally{x(!1)}})()},[]);const R=l(async(e,a)=>{try{const t=zy((await d.onFetchTrails(e)).data,a||w,n,g);N(t)}catch(t){}},[d,w,n,g]),L=l(async e=>{x(!0),M(e);try{await R(e)}finally{x(!1)}},[R]),z=l(async e=>{try{const a=await d.onFetchEvents(e);_(a)}catch(a){}},[d]),F=l(e=>{A(e.documentId),D(!0)},[]),U=l(()=>{D(!1),A(null)},[]),j=l(async()=>{const e={...T,startDate:I,endDate:I,eventId:1,userId:s.viewAllEvents?void 0:p};M(e),x(!0);try{await R(e)}finally{x(!1)}},[T,R]),O=l(e=>{d.onExport?.(e,y)},[d,y]),B=l(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 t("div",{className:"flex flex-col h-full",children:[a("div",{className:"p-3",children:a(Ry,{queryParams:T,events:w,softwares:n,users:C,permissions:s,isLoading:b,onFilter:L,onReset:j,onExport:s.download?O:void 0,onSoftwareChange:z})}),t("div",{className:"flex flex-1 min-h-0 relative",children:[t("div",{className:Fi("flex-1 overflow-auto transition-all duration-300",E?"mr-[400px]":""),children:[b?t("div",{className:"flex items-center justify-center h-64",children:[a(Qo,{size:"md"}),a("span",{className:"ml-2 text-sm text-muted-foreground",children:"Carregando trilha de auditoria..."})]}):0===y.length?t("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground",children:[a(Be,{className:"h-12 w-12 mb-3 opacity-30"}),a("p",{className:"text-sm",children:"Nenhum registro encontrado"}),a("p",{className:"text-xs mt-1",children:"Ajuste os filtros e tente novamente"})]}):t("table",{className:"w-full text-xs border-collapse",children:[a("thead",{className:"sticky top-0 z-10",children:t("tr",{className:"bg-muted/60 border-b border-border",children:[a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("div",{className:"flex items-center gap-1.5",children:[a(Da,{className:"h-3 w-3"}),"Módulo"]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("div",{className:"flex items-center gap-1.5",children:[a(We,{className:"h-3 w-3"}),"Data"]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("div",{className:"flex items-center gap-1.5",children:[a(ge,{className:"h-3 w-3"}),"Usuário"]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("div",{className:"flex items-center gap-1.5",children:[a(Be,{className:"h-3 w-3"}),"Evento"]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Item"}),a("th",{className:"px-3 py-2 w-10"})]})}),a("tbody",{children:y.map((e,r)=>t("tr",{onClick:()=>F(e),className:Fi("cursor-pointer border-b border-border/50 transition-colors","hover:bg-accent/50",S===e.documentId&&"bg-accent",r%2==0?"bg-background":"bg-muted/10"),children:[a("td",{className:"px-3 py-2 text-foreground",children:e.translatedSoftware}),a("td",{className:"px-3 py-2 text-muted-foreground whitespace-nowrap",children:e.date?B(e.date.toISOString()):"—"}),a("td",{className:"px-3 py-2 text-foreground",children:e.user}),a("td",{className:"px-3 py-2 text-foreground",children:e.translatedEvent}),a("td",{className:"px-3 py-2 text-foreground truncate max-w-[200px]",title:e.entityName,children:e.entityName}),a("td",{className:"px-3 py-2",children:a(Ce,{className:"h-3.5 w-3.5 text-muted-foreground"})})]},e.documentId||r))})]}),!b&&y.length>0&&t("div",{className:"px-3 py-2 text-xs text-muted-foreground border-t border-border bg-muted/20",children:[y.length," registro",1!==y.length?"s":""]})]}),a("div",{ref:P,className:Fi("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",E?"translate-x-0":"translate-x-full"),children:E&&a(Gy,{documentId:S,onFetchDetails:d.onFetchDetails,onClose:U,labels:h,translateProperty:d.translateProperty,translatePropertyValue:d.translatePropertyValue,formatDate:f||B})})]})]})}function Yy({open:r,onOpenChange:n,returnSteps:i,initialObservation:s="",title:l=e.t("approval_execute_action"),descriptions:d=[],setDefaultApproverOnInit:c=!0,onSubmit:u}){const[m,p]=o(!0),[h,f]=o(c&&i.length>0?i[0].id:null),[g,v]=o(s),b=e=>{p(e),e&&!c?f(null):!e&&!c&&i.length>0&&f(i[0].id)},x=g!==s||!m;return a(mo,{open:r,onOpenChange:n,children:t(bo,{className:"sm:max-w-[480px]",variant:"form",isDirty:x,children:[a(xo,{children:a(wo,{children:l})}),t("div",{className:"space-y-4",children:[d.length>0&&a("div",{className:"space-y-1 text-sm text-muted-foreground",children:d.map((e,t)=>a("p",{dangerouslySetInnerHTML:{__html:e}},t))}),t("div",{className:"flex gap-4",children:[t("label",{className:"flex items-center gap-2 cursor-pointer",children:[a("input",{type:"radio",name:"approved",checked:m,onChange:()=>b(!0),className:"accent-primary"}),a("span",{className:"text-sm",children:e.t("approval_approve")})]}),t("label",{className:"flex items-center gap-2 cursor-pointer",children:[a("input",{type:"radio",name:"approved",checked:!m,onChange:()=>b(!1),className:"accent-primary"}),a("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t("div",{className:"space-y-1.5",children:[a(Hi,{children:"Etapa"}),t(Lo,{value:h??void 0,onValueChange:f,disabled:m,children:[a(Uo,{children:a(Fo,{placeholder:e.t("approval_select_step")})}),a(Bo,{children:i.map(e=>a(Vo,{value:e.id,children:e.name},e.id))})]})]}),t("div",{className:"space-y-1.5",children:[a(Hi,{children:e.t("approval_opinion")}),a(Ho,{value:g,onChange:e=>v(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t("p",{className:"text-xs text-muted-foreground text-right",children:[g.length,"/",4e3]})]})]}),t(No,{children:[a($i,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),a($i,{onClick:()=>{if(!g.trim())return void C.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:i.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:g})},disabled:!x,children:"Concluir"})]})]})})}function Qy({open:e,onOpenChange:r,approvers:n,isLoading:i=!1,ignoreUserIds:l=[],onSubmit:d}){const{t:c}=Ga(),[u,m]=o(null),p=s(()=>{const e=new Set(l);return n.filter(a=>!e.has(a.id))},[n,l]),h=s(()=>p.map(e=>({value:e.id,label:e.name})),[p]);return a(mo,{open:e,onOpenChange:r,children:t(bo,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!u,children:[a(xo,{children:a(wo,{children:c("approval_select_approver")})}),a(Xo,{isLoading:i,type:"spinner",children:a("div",{className:"space-y-4",children:a(Rs,{options:h,value:u??void 0,onValueChange:e=>m("string"==typeof e?e:e?.[0]??null),placeholder:c("approval_select_approver_placeholder"),searchPlaceholder:c("approval_search_approver")})})}),t(No,{children:[a($i,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a($i,{onClick:()=>{if(!u)return;const e=p.find(e=>e.id===u);e&&d(e)},disabled:!u||i,children:"Concluir"})]})]})})}function Xy(e){const{t:a}=Ga();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Jy({text:e,maxLength:r=130}){const{t:n}=Ga(),[i,s]=o(!1);return e.length<=r?a("span",{children:e}):t("span",{children:[i?e:`${e.substring(0,r)}... `,a("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>s(!i),children:n(i?"approval_read_less":"approval_read_more")})]})}function Zy({approver:e}){if(1===e.type&&e.approverId)return t(yu,{className:"h-9 w-9 shrink-0",children:[a(Nu,{src:e.photoUrl,alt:e.name}),a(wu,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const r=2===e.type?Ze:3===e.type?Pa:ge;return a("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:a(r,{className:"h-4 w-4 text-background"})})}function eN({approver:e}){return e.date?t("div",{className:"flex items-center gap-2 flex-wrap",children:[t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[a(le,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Xy(e.date)}),1!==e.type&&e.approvedUsername&&t("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t("div",{className:"flex items-center gap-2 flex-wrap",children:[t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[a(Ia,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Xy(e.returnDate)})]}):t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[a(O,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function aN({approver:e}){const{t:r}=Ga(),n=1!==e.type||e.approverId?e.name:"A definir";return t("div",{children:[2===e.type&&a("p",{className:"text-xs text-muted-foreground",children:r("approval_user_group")}),3===e.type&&a("p",{className:"text-xs text-muted-foreground",children:"Local"}),a("p",{className:"text-sm font-medium break-words",children:n}),a(eN,{approver:e})]})}function tN({config:e,isLoading:r=!1,onClose:n,onApprove:i,onDefineApprover:s,onRefreshSteps:d,availableApprovers:c=[],isLoadingApprovers:u=!1}){const{t:m}=Ga(),[p,h]=o(!1),[f,g]=o(!1),[v,b]=o(""),[x,y]=o(""),[N,w]=o(!1),[_,C]=o(""),k=r||p,S=l((e,a)=>{b(e),y(a??""),g(!0)},[]),A=l(async a=>{g(!1),h(!0);if(!await i(e.associationId,{stepApproverId:v,...a}))return S(v,a.observation),void h(!1);n(),h(!1)},[e.associationId,v,i,n,S]),D=l(e=>{C(e),w(!0)},[]),P=l(async a=>{w(!1),h(!0),await s(e.associationId,_,a),await(d?.(e.associationId)),h(!1)},[e.associationId,_,s,d]),I=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],T=(a,t)=>e.canApprove&&a.isCurrentStep&&t.approverId&&!t.date&&t.canApprove,M=(a,t)=>!e.flowReproved&&a.isCurrentStep&&1===t.type&&t.canApprove&&(!t.approverId||t.isToBeDefined);return t("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[a($i,{variant:"ghost",size:"icon",onClick:n,className:"shrink-0",children:a(E,{className:"h-5 w-5"})}),a("span",{className:"text-lg font-medium",children:e.title})]}),k?a(Xo,{isLoading:!0,type:"spinner",className:"flex-1",children:a("div",{})}):t("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&a("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,t)=>a("div",{className:Fi("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("hr",{className:"border-border"}),e.approvalFlowSteps.map(r=>t("div",{className:Fi("space-y-2",(!r.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t("p",{className:"font-semibold text-sm",children:[r.index,". Etapa: ",r.name]}),r.description&&a("p",{className:"text-sm text-muted-foreground break-words",children:a(Jy,{text:r.description})}),r.returnDate&&t("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t("div",{className:"flex items-center gap-2",children:[a("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t("span",{className:"text-xs text-muted-foreground",children:[r.returnUserName," em ",Xy(r.returnDate)]})]}),r.returnObservation&&a("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a(Jy,{text:r.returnObservation})})]}),r.approvers.map(e=>t("div",{className:"p-2 space-y-1",children:[t("div",{className:"flex items-center justify-between gap-2",children:[t("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a(Zy,{approver:e}),a(aN,{approver:e})]}),T(r,e)&&a($i,{size:"sm",onClick:()=>S(e.id),children:"Aprovar"}),M(r,e)&&a($i,{size:"sm",variant:"outline",onClick:()=>D(e.id),children:"Selecionar"})]}),e.observation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Jy,{text:e.observation})}),e.returnObservation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Jy,{text:e.returnObservation})})]},e.id))]},r.id))]}),a(Yy,{open:f,onOpenChange:g,returnSteps:e.returnSteps,initialObservation:x,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:A}),a(Qy,{open:N,onOpenChange:w,approvers:c,isLoading:u,ignoreUserIds:I,onSubmit:P})]})}var rN,nN;function iN({users:e,value:r,onChange:n,disabled:i=!1,placeholder:d="Buscar membro da equipe...",confirmRemoval:c=!0,confirmTitle:u,confirmMessage:m="Tem certeza que deseja remover este membro da equipe?",emptyMessage:p,className:h}){const{t:f}=Ga(),g=u??f("leadership_remove_team"),v=p??f("leadership_no_members"),[b,x]=o(""),[y,N]=o(!1),[w,_]=o(null),C=s(()=>new Set(r),[r]),k=s(()=>e.filter(e=>C.has(e.id)),[e,C]),S=s(()=>e.filter(e=>!C.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,C]),A=l(e=>{e&&!C.has(e)&&(n([...r,e]),x(""))},[r,n,C]),D=l(e=>{c?(_(e),N(!0)):n(r.filter(a=>a!==e))},[r,n,c]),P=l(()=>{w&&n(r.filter(e=>e!==w)),N(!1),_(null)},[w,r,n]);return t("div",{className:Fi("space-y-3",h),children:[a("div",{className:"flex items-start gap-3",children:a("div",{className:"flex-1",children:a(Rs,{options:S,value:b,onValueChange:e=>{const a="string"==typeof e?e:e?.[0]??"";x(a),a&&A(a)},placeholder:d,searchPlaceholder:"Buscar...",disabled:i})})}),t("div",{className:"flex items-center gap-2",children:[a("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),a("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:k.length})]}),k.length>0?a("div",{className:"space-y-2",children:k.map(e=>t("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t(yu,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(Nu,{src:e.avatar,alt:e.name}),a(wu,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),a("div",{className:"flex-1 min-w-0",children:a("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t("span",{className:"flex items-center gap-1",children:[a(Ta,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t("span",{className:"flex items-center gap-1",children:[a(Pa,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a("button",{type:"button",className:Fi("text-muted-foreground hover:text-destructive transition-colors",i&&"opacity-50 pointer-events-none"),onClick:()=>!i&&D(e.id),title:f("remove"),children:a(E,{className:"h-4 w-4"})})]})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a(ge,{className:"h-12 w-12 mb-2 opacity-30"}),a("p",{className:"text-sm",children:v})]}),a(mo,{open:y,onOpenChange:N,children:t(bo,{className:"sm:max-w-[400px]",children:[a(xo,{children:a(wo,{children:g})}),a("p",{className:"text-sm text-muted-foreground",children:m}),t(No,{children:[a($i,{variant:"ghost",onClick:()=>N(!1),children:"Cancelar"}),a($i,{variant:"destructive",onClick:P,children:"Remover"})]})]})})]})}(nN=rN||(rN={}))[nN.ApprovalFlow=1]="ApprovalFlow",nN[nN.Association=2]="Association";export{pr as AUTH_CONFIG,ou as AccessDeniedDialog,gu as Accordion,xu as AccordionContent,vu as AccordionItem,bu as AccordionTrigger,Vi as ActionButton,Vi as ActionMenu,dd as ActionMenuItems,iy as ActionPlanAttachmentsTab,ey as ActionPlanCommentsTab,Zx as ActionPlanCostTab,Vx as ActionPlanGeneralTab,ty as ActionPlanHistoryTab,sy as ActionPlanPage,Jx as ActionPlanPredecessorsTab,Yx as ActionPlanProgressDialog,Qx as ActionPlanProgressTab,$x as ActionPlanStatusBadge,Zh as AggregationType,ic as Alert,sc as AlertDescription,eo as AlertDialog,co as AlertDialogAction,uo as AlertDialogCancel,no as AlertDialogContent,lo as AlertDialogDescription,oo as AlertDialogFooter,io as AlertDialogHeader,ro as AlertDialogOverlay,to as AlertDialogPortal,so as AlertDialogTitle,ao as AlertDialogTrigger,oc as AlertTitle,tc as AliasRedirect,ac as AliasRouteGuard,af as AnalysisFunctionality,Xv as AppHeader,lb as AppLayout,sb as AppSidebar,rN as ApprovalFlowReturnStep,tN as ApprovalSidenav,Yy as ApproveDialog,Gy as AuditTrailDetails,Ry as AuditTrailFilter,Ky as AuditTrailPage,sl as AuthErrorInterceptor,kl as AuthProvider,Nl as AuthService,Rs as AutoComplete,yu as Avatar,wu as AvatarFallback,Nu as AvatarImage,Ko as Badge,jd as BaseForm,hm as Blockquote,ub as BodyContent,_u as Breadcrumb,Du as BreadcrumbEllipsis,ku as BreadcrumbItem,Su as BreadcrumbLink,Cu as BreadcrumbList,Au as BreadcrumbPage,Eu as BreadcrumbSeparator,Tg as BurndownPanel,$i as Button,Iu as ButtonGroup,Ux as CLOSED_STATUSES,hr as CRUD_CONFIG,Zf as CURRENCY_FIELDS,Tu as Calendar,lc as CallbackPage,Gi as Card,Xi as CardContent,Qi as CardDescription,Ji as CardFooter,Ki as CardHeader,Ol as CardSkeleton,Yi as CardTitle,Ag as CartesianPanel,Kp as ChartContainer,Jp as ChartLegend,Zp as ChartLegendContent,Yp as ChartStyle,Qp as ChartTooltip,Xp as ChartTooltipContent,Wo as Checkbox,Ec as Collapsible,Pc as CollapsibleContent,Dc as CollapsibleTrigger,Pd as ColorPicker,Cd as ColumnSettingsPopover,Os as ComboTree,Rs as Combobox,ws as Command,_s as CommandDialog,Ss as CommandEmpty,As as CommandGroup,Cs as CommandInput,Ds as CommandItem,ks as CommandList,Es as CommandSeparator,Ps as CommandShortcut,cb as ContentContainer,Kl as ContextMenu,nd as ContextMenuCheckboxItem,td as ContextMenuContent,Ql as ContextMenuGroup,rd as ContextMenuItem,od as ContextMenuLabel,Xl as ContextMenuPortal,Zl as ContextMenuRadioGroup,id as ContextMenuRadioItem,sd as ContextMenuSeparator,ld as ContextMenuShortcut,Jl as ContextMenuSub,ad as ContextMenuSubContent,ed as ContextMenuSubTrigger,Yl as ContextMenuTrigger,pu as CoreProviders,xd as CrudActionBar,Iv as CrudActionMenu,Dv as CrudGrid,Gd as CrudPageInternal,Bd as CrudPagination,Tv as CrudPrimitiveFilterBar,Od as CrudPrimitivePagination,Pv as CrudPrimitiveTable,Sd as CrudTable,Ty as CustomFormFields,gx as D4SignWidget,Jf as DASHBOARD_STORAGE_KEYS,mi as DATETIME_FORMATS,Lx as DEFAULT_ACTION_TYPES,fi as DEFAULT_DATETIME_FORMAT,hi as DEFAULT_LOCALE,gi as DEFAULT_TIMEZONE,Jg as DashboardForm,_f as DashboardFormTab,tf as DashboardFunctionality,Zg as DashboardGeneralView,jg as DashboardGrid,Af as DashboardLanguage,Hg as DashboardList,nf as DashboardListType,sf as DashboardPageTime,df as DashboardPanelDimension,pf as DashboardPanelOrderBy,uf as DashboardPanelOrderByType,ff as DashboardPanelPeriod,Bg as DashboardPanelRenderer,vf as DashboardPanelType,kf as DashboardShareType,xf as DashboardUpdateTime,$g as DashboardView,Nf as DashboardViewType,Tv as DataFilterBar,Mu as DataList,Od as DataPagination,Pv as DataTable,Ru as DatePicker,mo as Dialog,yo as DialogBody,fo as DialogClose,bo as DialogContent,_o as DialogDescription,No as DialogFooter,xo as DialogHeader,go as DialogOverlay,ho as DialogPortal,wo as DialogTitle,po as DialogTrigger,vh as DialogWizard,bs as DisabledMenuItem,vx as DocumentSigner,Lu as Drawer,Uu as DrawerClose,Ou as DrawerContent,qu as DrawerDescription,$u as DrawerFooter,Bu as DrawerHeader,ju as DrawerOverlay,Fu as DrawerPortal,Vu as DrawerTitle,zu as DrawerTrigger,Zo as DropdownMenu,ds as DropdownMenuCheckboxItem,ss as DropdownMenuContent,as as DropdownMenuGroup,ls as DropdownMenuItem,us as DropdownMenuLabel,ts as DropdownMenuPortal,ns as DropdownMenuRadioGroup,cs as DropdownMenuRadioItem,ms as DropdownMenuSeparator,ps as DropdownMenuShortcut,rs as DropdownMenuSub,os as DropdownMenuSubContent,is as DropdownMenuSubTrigger,es as DropdownMenuTrigger,Ax as EAttachmentItemStatus,my as ECustomFormFieldType,hy as EFieldViewMode,gy as ESelectionFieldDataSource,_x as ETaskPlanAssociationType,Nx as ETaskPlanPriority,xx as ETaskPlanStatus,kx as ETaskPlanTypeProgress,fh as ElectronicSignatureDialog,Hl as EllipsisText,vb as EmailService,Wl as EmptyState,Rs as EntitySelect,Ic as ErrorBoundary,ph as ExportDialog,dh as ExportFormat,ly as FORBIDDEN_FILE_TYPES,Ch as FilePrintType,wh as FileViewerType,Hd as FilterBar,Co as Form,Io as FormControl,ky as FormDateField,To as FormDescription,So as FormField,Do as FormItem,Po as FormLabel,Mo as FormMessage,Py as FormMultiSelectionField,Ey as FormNumericField,Iy as FormQuestionsField,Dy as FormSingleSelectionField,Bl as FormSkeleton,Cy as FormTextField,Sy as FormTimeField,Ay as FormUrlField,Gu as Grid,nm as H1,im as H2,om as H3,sm as H4,$l as HeaderSkeleton,Ku as HoverCard,Qu as HoverCardContent,Yu as HoverCardTrigger,Ld as IconPicker,Lh as IframeDialog,ex as ImageEditor,ax as ImageRenderer,pm as InlineCode,qi as Input,Xu as InputGroup,Zu as InputGroupAddon,am as InputGroupButton,tm as InputGroupInput,rm as InputGroupTextarea,eg as LINK_PROPERTIES,wr as LOGO_CONFIG,Hi as Label,cm as Large,dm as Lead,Ob as LeadershipDialog,jb as LeadershipForm,Vb as LeadershipPage,fm as List,Cg as ListPanel,Xo as LoadingState,_c as LocaleProvider,dc as LoginPage,_r as MESSAGES,Qc as MODULES_DATA,Xf as MONTHS_MAP,xb as ManageAccessModal,Rg as MatrixRiskPanel,Df as MatrixViewType,Rp as Menubar,Op as MenubarCheckboxItem,Up as MenubarContent,Pp as MenubarGroup,jp as MenubarItem,$p as MenubarLabel,Dp as MenubarMenu,Ip as MenubarPortal,Mp as MenubarRadioGroup,Bp as MenubarRadioItem,Vp as MenubarSeparator,qp as MenubarShortcut,Tp as MenubarSub,Fp as MenubarSubContent,zp as MenubarSubTrigger,Lp as MenubarTrigger,Ev as MindMap,nb as ModalStateProvider,lu as ModuleAccessGuard,Zc as ModuleGrid,du as ModuleOfferContent,Sc as ModuleProvider,eu as ModulesContent,iu as ModulesDialog,Yc as ModulesFooterCards,Rs as MultiSelect,$h as MultiselectPermissions,mm as Muted,gm as NavigationMenu,Nm as NavigationMenuContent,Cm as NavigationMenuIndicator,bm as NavigationMenuItem,wm as NavigationMenuLink,vm as NavigationMenuList,ym as NavigationMenuTrigger,_m as NavigationMenuViewport,Wv as NavigationProvider,wg as NumericPanel,sh as OnboardingDialog,Rh as OnlineEditorDialog,lm as P,Fx as PRIORITIES,lr as PROD_PROJECT_ID,jx as PROGRESS_ALLOWED_STATUSES,km as PageBreadcrumb,uc as PageMetadataProvider,Am as Pagination,Em as PaginationContent,Mm as PaginationEllipsis,Dm as PaginationItem,Pm as PaginationLink,Tm as PaginationNext,Im as PaginationPrevious,Yf as PaletteType,vg as PanelError,gg as PanelHeader,If as PanelItemsPerPanel,bg as PanelLoader,xg as PanelNoData,Mf as PanelSortType,Lf as PanelState,yg as PanelUnavailable,Ig as ParetoPanel,Mg as PerformancePanel,Pg as PiePanel,yb as PlaceCard,Nb as PlacesList,jf as PlanType,xs as Popover,Ns as PopoverContent,ys as PopoverTrigger,Rm as Progress,Zd as ProtectedRoute,Nr as QUALIEX_CONFIG,yr as QUERY_KEYS,fl as QualiexEnrichmentService,ll as QualiexErrorInterceptor,Ud as QualiexUserField,Bf as QueriesContextType,Vf as QueriesShareType,Wf as QuickFilterDashboard,Lm as RadioGroup,zm as RadioGroupItem,_y as ReadOnlyTextField,Kh as ReportRequestList,Vh as ReportRequestStatus,jm as ResizableHandle,Um as ResizablePanel,Fm as ResizablePanelGroup,rh as RichTextEditor,Gf as RiskCriticality,fr as SEARCH_CONFIG,Dx as STATUS_COLORS,Mx as STATUS_LABELS,Ix as STATUS_MAP,Px as STATUS_TEXT_COLORS,ui as SUPPORTED_LOCALES,Id as ScrollArea,Td as ScrollBar,Lo as Select,Qy as SelectApproverDialog,Bo as SelectContent,zo as SelectGroup,Vo as SelectItem,$o as SelectLabel,Oo as SelectScrollDownButton,jo as SelectScrollUpButton,Rs as SelectSearch,qo as SelectSeparator,Uo as SelectTrigger,Fo as SelectValue,Zi as Separator,Om as Sheet,Km as SheetBody,$m as SheetClose,Hm as SheetContent,Xm as SheetDescription,Ym as SheetFooter,Gm as SheetHeader,qm as SheetOverlay,Vm as SheetPortal,Qm as SheetTitle,Bm as SheetTrigger,tp as Sidebar,Zv as SidebarActionTrigger,cp as SidebarContent,lp as SidebarFooter,up as SidebarGroup,pp as SidebarGroupAction,hp as SidebarGroupContent,mp as SidebarGroupLabel,db as SidebarHeader,op as SidebarInput,ip as SidebarInset,Qv as SidebarLogo,fp as SidebarMenu,xp as SidebarMenuAction,yp as SidebarMenuBadge,bp as SidebarMenuButton,gp as SidebarMenuItem,Np as SidebarMenuSkeleton,wp as SidebarMenuSub,Cp as SidebarMenuSubButton,_p as SidebarMenuSubItem,ap as SidebarProvider,np as SidebarRail,dp as SidebarSeparator,Vl as SidebarSkeleton,rp as SidebarTrigger,bx as SignConfigForm,fx as SignWidget,uy as SingleFileUpload,Is as Skeleton,kp as Slider,um as Small,Jo as SonnerToaster,Qo as Spinner,lh as SplitButton,Wd as Stack,Xh as StatusBadge,gh as StepSelector,gh as Stepper,Yh as StimulsoftViewer,zd as Switch,pi as TIMEZONES,Ep as TabPageContent,Ap as TabPageHeader,Sp as TabPageLayout,Il as Table,Ml as TableBody,Ul as TableCaption,Fl as TableCell,Rl as TableFooter,zl as TableHead,Tl as TableHeader,Gl as TableResizeHandle,Ll as TableRow,cd as TableRowActions,jl as TableSkeleton,Tc as Tabs,Lc as TabsContent,Mc as TabsList,Rc as TabsTrigger,iN as TeamSelector,zh as TermsOfUseDialog,Fh as TermsOfUseViewer,_g as TextPanel,Ho as Textarea,hh as Timepicker,Jo as Toaster,fd as Toggle,vd as ToggleGroup,bd as ToggleGroupItem,Qs as TokenManager,Bs as TokenService,fs as Tooltip,vs as TooltipContent,hs as TooltipProvider,gs as TooltipTrigger,Os as TreeSelect,Fv as TreeTable,Hl as TruncatedCell,Nh as UpdatesNotification,jh as UsersGroupsSelector,Jb as VideoEditor,Zb as VideoRenderer,Th as ViewerDialog,Ff as VisualizationType,xc as addAppTranslations,ov as addChild,sv as addSibling,Sr as assets,Go as badgeVariants,jy as buildDetailRows,Cb as buildHierarchy,zi as buildModuleUrl,mg as buildPlacesTree,Ih as buildWopiUrl,Pu as buttonGroupVariants,Bi as buttonVariants,tx as calculateAspectRatio,qy as camelToDash,Fi as cn,Kd as createCrudPage,jv as createCrudRoutingConfig,av as createMindMapNode,Uv as createRoutingHandlers,bl as createService,Yd as createSimpleSaveHandler,El as createSimpleService,Jh as createStatusConfig,Cr as createTranslatedMessages,ug as currencyFormatter,ji as debounce,ul as deriveEmailField,cl as deriveNameField,ml as deriveUsernameField,_i as detectBrowserLocale,Si as detectBrowserPreferences,Ci as detectBrowserTimezone,Qb as detectVideoProvider,bb as emailService,Xs as errorService,kv as exportMindMap,ix as extractImageFileName,cg as extractNumberFromCurrency,Gb as extractVimeoId,Wb as extractYouTubeId,_b as filterAndPromoteOrphans,bi as findDatetimeFormat,vi as findLocale,tv as findNode,xi as findTimezone,kb as flattenTree,dy as formatBytes,Pi as formatCurrency,Di as formatDate,Ei as formatDatetime,ox as formatFileSize,Gx as formatTime,Hx as formatTimeProgress,Qd as generateCrudConfig,ev as generateNodeId,Ti as generatePastelBg,Rx as getActionTypes,Ri as getContrastRatio,zg as getDefaultPanelSize,ur as getEnvironmentConfig,by as getFieldValue,cy as getFileExtension,yy as getFormFieldValues,ig as getLinkFromRow,Mi as getLuminance,Fg as getMinPanelSize,Eh as getOnlineViewerType,zx as getPriorities,Kx as getProgressColor,xr as getQualiexApiUrl,Tx as getStatusLabels,nl as getSupabaseClient,Ah as getViewerType,Ph as getWopiViewer,Li as handleExternalLink,Av as importMindMap,ki as inferDatetimeFormat,Ju as inputGroupAddonVariants,em as inputGroupButtonVariants,dg as isCurrency,br as isDevEnvironment,mr as isDevSupabaseProject,nx as isImageUrl,gr as isLovablePreview,rg as isNullOrEmptyField,Ni as isValidDatetimeFormat,yi as isValidLocale,wi as isValidTimezone,px as loadClicksignScript,uu as loadForlogicFonts,Ar as logoSrc,fb as mergeTranslationFiles,dv as moveNode,xm as navigationMenuTriggerStyle,Xb as normalizeVideoUrl,Kb as normalizeVimeoUrl,Hb as normalizeYouTubeUrl,Yb as parseIframeSrc,wb as placeService,zy as processTrails,ng as processUrl,dl as qualiexApi,lv as removeNode,rx as resizeKeepingAspect,pl as resolveFieldMappings,Kv as resolvePageTitle,uv as setCollapsedAll,Ny as setFormFieldValues,hc as setupQualiexCore,xy as shouldShowField,vr as shouldUseDevTokens,ux as signService,Oi as slugify,Er as smallLogoSrc,ag as sortByMonthYear,og as toQueryString,cv as toggleCollapsed,hd as toggleVariants,Kc as trackFooterClick,Gc as trackInterestClick,Hc as trackModuleClick,Ui as trimTextFields,Ox as useActionPlan,Wx as useActionPlanProgress,mb as useActiveModules,ec as useAliasFromUrl,Sl as useAuth,Ad as useBaseForm,mu as useClarity,wd as useColumnManager,pd as useColumnResize,Db as useCreateMultipleLeadersMutation,Eb as useCreateSingleLeaderMutation,Al as useCrud,Yv as useDebounce,nu as useDerivedContractedModules,Ao as useFormField,ob as useHasOpenModal,gb as useI18nFormatters,Pl as useIsMobile,Sb as useLeadershipApi,Cc as useLocale,Dl as useMediaQuery,qb as useMediaUpload,ib as useModalState,ru as useModuleAccess,Ac as useModuleConfig,Hv as useNavigation,pc as usePageMetadata,mc as usePageMetadataContext,Gv as usePageTitle,Jv as usePermissionQuery,Fd as useQualiexUsers,Ib as useRemoveLeaderMutation,Sm as useRouteBreadcrumbs,pb as useRowResize,ep as useSidebar,tb as useSidebarResize,sx as useSignConfig,Tb as useSyncSubordinatesMutation,Pb as useUpdateLeaderMutation,yh as useUpdatesNotification,hb as useWizard,wy as validateFields};
1
+ import e from"i18next";export{default as i18n}from"i18next";import{jsx as a,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import o,{useState as i,useMemo as s,useCallback as l,createContext as d,useContext as c,useRef as u,useEffect as m,memo as p,Component as h,forwardRef as f}from"react";import{Slot as g}from"@radix-ui/react-slot";import{cva as v}from"class-variance-authority";import{clsx as b}from"clsx";import{twMerge as x}from"tailwind-merge";import{getDefaultOptions as y,parseISO as w,isValid as N,format as _}from"date-fns";import{toast as C,Toaster as k}from"sonner";export{toast as sonnerToast,toast}from"sonner";import*as S from"lucide-react";import{EllipsisVertical as A,X as E,ChevronDown as D,ChevronUp as P,Check as T,Loader2 as I,Loader2Icon as M,OctagonXIcon as R,TriangleAlertIcon as z,InfoIcon as L,CircleCheckIcon as F,ChevronRight as O,Circle as U,AlertCircle as j,Search as B,FileX as V,Edit as $,PowerOff as q,Power as W,Trash2 as H,Pencil as G,ToggleRight as K,ToggleLeft as Y,Plus as Q,LayoutGrid as X,List as J,Table2 as Z,Columns3 as ee,GripVertical as ae,Group as te,ArrowUp as re,ArrowDown as ne,ChevronsLeft as oe,ChevronLeft as ie,ChevronsRight as se,CheckCircle as le,AlertTriangle as de,Info as ce,RefreshCw as ue,Copy as me,ExternalLink as pe,NotebookText as he,Building2 as fe,User as ge,LogOut as ve,Sparkles as be,MoreHorizontal as xe,Calendar as ye,PanelLeft as we,Edit3 as Ne,Code as _e,Eye as Ce,Heading1 as ke,Heading2 as Se,Heading3 as Ae,Bold as Ee,Italic as De,Underline as Pe,Strikethrough as Te,ListOrdered as Ie,Highlighter as Me,Link as Re,RemoveFormatting as ze,Undo as Le,Redo as Fe,ImageIcon as Oe,ArrowLeft as Ue,ArrowRight as je,FileText as Be,FileSpreadsheet as Ve,Image as $e,FileImage as qe,Clock as We,Lock as He,ShieldCheck as Ge,Mail as Ke,Coffee as Ye,CheckCheck as Qe,Star as Xe,Download as Je,Users as Ze,TriangleAlert as ea,CheckCircle2 as aa,Hourglass as ta,MoreVertical as ra,Minus as na,CornerDownRight as oa,ChevronsUpDown as ia,ChevronsDownUp as sa,ZoomOut as la,ZoomIn as da,Maximize2 as ca,Undo2 as ua,Redo2 as ma,ArrowUpToLine as pa,Camera as ha,UserPen as fa,Menu as ga,Upload as va,CloudUpload as ba,MapPin as xa,XCircle as ya,Shield as wa}from"lucide-react";import*as Na from"@radix-ui/react-label";import*as _a from"@radix-ui/react-dialog";import*as Ca from"@radix-ui/react-separator";import*as ka from"@radix-ui/react-alert-dialog";import{useFormContext as Sa,FormProvider as Aa,Controller as Ea}from"react-hook-form";import*as Da from"@radix-ui/react-select";import*as Pa from"@radix-ui/react-checkbox";import*as Ta from"@radix-ui/react-dropdown-menu";import*as Ia from"@radix-ui/react-tooltip";import*as Ma from"@radix-ui/react-popover";import{useTranslation as Ra,initReactI18next as za,I18nextProvider as La}from"react-i18next";export{I18nextProvider,useTranslation}from"react-i18next";import{createClient as Fa}from"@supabase/supabase-js";import{useQueryClient as Oa,useQuery as Ua,useMutation as ja,QueryClient as Ba,QueryClientProvider as Va}from"@tanstack/react-query";import{useSearchParams as $a,useParams as qa,useNavigate as Wa,useLocation as Ha,Navigate as Ga,Link as Ka}from"react-router-dom";import*as Ya from"@radix-ui/react-context-menu";import*as Qa from"@radix-ui/react-toggle-group";import*as Xa from"@radix-ui/react-toggle";import*as Ja from"@radix-ui/react-scroll-area";import*as Za from"@radix-ui/react-switch";import*as et from"@radix-ui/react-collapsible";import*as at from"@radix-ui/react-tabs";import*as tt from"@radix-ui/react-accordion";import*as rt from"@radix-ui/react-avatar";import{DayPicker as nt}from"react-day-picker";import{Drawer as ot}from"vaul";import*as it from"@radix-ui/react-hover-card";import*as st from"@radix-ui/react-navigation-menu";import*as lt from"@radix-ui/react-progress";import*as dt from"@radix-ui/react-radio-group";import*as ct from"react-resizable-panels";import*as ut from"@radix-ui/react-slider";import*as mt from"@radix-ui/react-menubar";import*as pt from"recharts";import{ResponsiveContainer as ht,XAxis as ft,YAxis as gt,CartesianGrid as vt,Tooltip as bt,Legend as xt,BarChart as yt,Bar as wt,AreaChart as Nt,Area as _t,LineChart as Ct,Line as kt,PieChart as St,Pie as At,Cell as Et,ComposedChart as Dt}from"recharts";import{useEditor as Pt,EditorContent as Tt}from"@tiptap/react";import It from"@tiptap/starter-kit";import Mt from"@tiptap/extension-underline";import Rt from"@tiptap/extension-link";import{TextStyle as zt}from"@tiptap/extension-text-style";import{Color as Lt}from"@tiptap/extension-color";import Ft from"@tiptap/extension-highlight";import{useSensors as Ot,useSensor as Ut,PointerSensor as jt,DndContext as Bt,closestCenter as Vt}from"@dnd-kit/core";import{SortableContext as $t,rectSortingStrategy as qt,useSortable as Wt}from"@dnd-kit/sortable";const Ht="ccjfvpnndclajkleyqkc",Gt={storageProjectId:"ccjfvpnndclajkleyqkc",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api.qualiex.com"},Kt={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 Yt(){let e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=import.meta.env.VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e===Ht?Gt:Kt}function Qt(){let e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)try{const a=import.meta.env.VITE_SUPABASE_URL;a&&(e=new URL(a).hostname.split(".")[0])}catch{}return e!==Ht}const Xt={get oauth(){const e=Yt();return{authUrl:e.oauth.authUrl,clientId:e.oauth.clientId,responseType:"id_token token",scope:"openid profile email"}}},Jt={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Zt={debounceDelay:500},er=()=>{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||import.meta.env.DEV},ar=()=>er(),tr=er,rr=()=>Yt().qualiexApiUrl,nr={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},or={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},ir={isQualiex:"true"===import.meta.env.VITE_IS_QUALIEX},sr={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}`}},lr=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)}}),dr=`https://${Yt().storageProjectId}.supabase.co/storage/v1/object/public/library-assets`,cr={logo:ir.isQualiex?`${dr}/logo-qualiex-white.svg`:`${dr}/saber-gestao-white.png`,smallLogo:ir.isQualiex?`${dr}/logo-forlogic-white.svg`:`${dr}/small.svg`,favicon:`${dr}/favicon.png`},ur=cr.logo,mr=cr.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=cr.favicon,document.head.appendChild(e)}const pr={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 hr(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const fr={date:hr({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:hr({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:hr({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},gr={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function vr(e){return(a,t)=>{let r;if("formatting"===(t?.context?String(t.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,n=t?.width?String(t.width):a;r=e.formattingValues[n]||e.formattingValues[a]}else{const a=e.defaultWidth,n=t?.width?String(t.width):e.defaultWidth;r=e.values[n]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(a):a]}}function br(e){return(a,t={})=>{const r=t.width,n=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=a.match(n);if(!o)return null;const i=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t;return}(s,e=>e.test(i)):function(e,a){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&a(e[t]))return t;return}(s,e=>e.test(i));let d;d=e.valueCallback?e.valueCallback(l):l,d=t.valueCallback?t.valueCallback(d):d;return{value:d,rest:a.slice(i.length)}}}function xr(e){return(a,t={})=>{const r=a.match(e.matchPattern);if(!r)return null;const n=r[0],o=a.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=t.valueCallback?t.valueCallback(i):i;return{value:i,rest:a.slice(n.length)}}}const yr={code:"en-US",formatDistance:(e,a,t)=>{let r;const n=pr[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r},formatLong:fr,formatRelative:(e,a,t,r)=>gr[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:vr({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:vr({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:vr({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:vr({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:vr({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:xr({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:br({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:br({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:br({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:br({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:br({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 wr={};function Nr(){return wr}const _r=6048e5;function Cr(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 kr(e){const a=Cr(e);return a.setHours(0,0,0,0),a}function Sr(e){const a=Cr(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 Ar(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function Er(e){const a=Cr(e),t=function(e,a){const t=kr(e),r=kr(a),n=+t-Sr(t),o=+r-Sr(r);return Math.round((n-o)/864e5)}(a,function(e){const a=Cr(e),t=Ar(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function Dr(e,a){const t=Nr(),r=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=Cr(e),o=n.getDay(),i=(o<r?7:0)+o-r;return n.setDate(n.getDate()-i),n.setHours(0,0,0,0),n}function Pr(e){return Dr(e,{weekStartsOn:1})}function Tr(e){const a=Cr(e),t=a.getFullYear(),r=Ar(e,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const n=Pr(r),o=Ar(e,0);o.setFullYear(t,0,4),o.setHours(0,0,0,0);const i=Pr(o);return a.getTime()>=n.getTime()?t+1:a.getTime()>=i.getTime()?t:t-1}function Ir(e){const a=Cr(e),t=+Pr(a)-+function(e){const a=Tr(e),t=Ar(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),Pr(t)}(a);return Math.round(t/_r)+1}function Mr(e,a){const t=Cr(e),r=t.getFullYear(),n=Nr(),o=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Ar(e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const s=Dr(i,a),l=Ar(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const d=Dr(l,a);return t.getTime()>=s.getTime()?r+1:t.getTime()>=d.getTime()?r:r-1}function Rr(e,a){const t=Cr(e),r=+Dr(t,a)-+function(e,a){const t=Nr(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=Mr(e,a),o=Ar(e,0);return o.setFullYear(n,0,r),o.setHours(0,0,0,0),Dr(o,a)}(t,a);return Math.round(r/_r)+1}function zr(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const Lr={y(e,a){const t=e.getFullYear(),r=t>0?t:1-t;return zr("yy"===a?r%100:r,a.length)},M(e,a){const t=e.getMonth();return"M"===a?String(t+1):zr(t+1,2)},d:(e,a)=>zr(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)=>zr(e.getHours()%12||12,a.length),H:(e,a)=>zr(e.getHours(),a.length),m:(e,a)=>zr(e.getMinutes(),a.length),s:(e,a)=>zr(e.getSeconds(),a.length),S(e,a){const t=a.length,r=e.getMilliseconds();return zr(Math.trunc(r*Math.pow(10,t-3)),a.length)}},Fr="midnight",Or="noon",Ur="morning",jr="afternoon",Br="evening",Vr="night",$r={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 Lr.y(e,a)},Y:function(e,a,t,r){const n=Mr(e,r),o=n>0?n:1-n;if("YY"===a){return zr(o%100,2)}return"Yo"===a?t.ordinalNumber(o,{unit:"year"}):zr(o,a.length)},R:function(e,a){return zr(Tr(e),a.length)},u:function(e,a){return zr(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 zr(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 zr(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 Lr.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 zr(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 n=Rr(e,r);return"wo"===a?t.ordinalNumber(n,{unit:"week"}):zr(n,a.length)},I:function(e,a,t){const r=Ir(e);return"Io"===a?t.ordinalNumber(r,{unit:"week"}):zr(r,a.length)},d:function(e,a,t){return"do"===a?t.ordinalNumber(e.getDate(),{unit:"date"}):Lr.d(e,a)},D:function(e,a,t){const r=Er(e);return"Do"===a?t.ordinalNumber(r,{unit:"dayOfYear"}):zr(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 n=e.getDay(),o=(n-r.weekStartsOn+8)%7||7;switch(a){case"e":return String(o);case"ee":return zr(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(e,a,t,r){const n=e.getDay(),o=(n-r.weekStartsOn+8)%7||7;switch(a){case"c":return String(o);case"cc":return zr(o,a.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(e,a,t){const r=e.getDay(),n=0===r?7:r;switch(a){case"i":return String(n);case"ii":return zr(n,a.length);case"io":return t.ordinalNumber(n,{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 n;switch(n=12===r?Or:0===r?Fr:r/12>=1?"pm":"am",a){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,a,t){const r=e.getHours();let n;switch(n=r>=17?Br:r>=12?jr:r>=4?Ur:Vr,a){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{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 Lr.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):Lr.H(e,a)},K:function(e,a,t){const r=e.getHours()%12;return"Ko"===a?t.ordinalNumber(r,{unit:"hour"}):zr(r,a.length)},k:function(e,a,t){let r=e.getHours();return 0===r&&(r=24),"ko"===a?t.ordinalNumber(r,{unit:"hour"}):zr(r,a.length)},m:function(e,a,t){return"mo"===a?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):Lr.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):Lr.s(e,a)},S:function(e,a){return Lr.S(e,a)},X:function(e,a,t){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(a){case"X":return Wr(r);case"XXXX":case"XX":return Hr(r);default:return Hr(r,":")}},x:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"x":return Wr(r);case"xxxx":case"xx":return Hr(r);default:return Hr(r,":")}},O:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+qr(r,":");default:return"GMT"+Hr(r,":")}},z:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+qr(r,":");default:return"GMT"+Hr(r,":")}},t:function(e,a,t){return zr(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,t){return zr(e.getTime(),a.length)}};function qr(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),n=Math.trunc(r/60),o=r%60;return 0===o?t+String(n):t+String(n)+a+zr(o,2)}function Wr(e,a){if(e%60==0){return(e>0?"-":"+")+zr(Math.abs(e)/60,2)}return Hr(e,a)}function Hr(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+zr(Math.trunc(r/60),2)+a+zr(r%60,2)}const Gr=(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"})}},Kr=(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"})}},Yr={p:Kr,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],r=t[1],n=t[2];if(!n)return Gr(e,a);let o;switch(r){case"P":o=a.dateTime({width:"short"});break;case"PP":o=a.dateTime({width:"medium"});break;case"PPP":o=a.dateTime({width:"long"});break;default:o=a.dateTime({width:"full"})}return o.replace("{{date}}",Gr(r,a)).replace("{{time}}",Kr(n,a))}},Qr=/^D+$/,Xr=/^Y+$/,Jr=["D","DD","YY","YYYY"];function Zr(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=Cr(e);return!isNaN(Number(t))}const en=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,an=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tn=/^'([^]*?)'?$/,rn=/''/g,nn=/[a-zA-Z]/;function on(e,a,t){const r=Nr(),n=t?.locale??r.locale??yr,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Cr(e);if(!Zr(s))throw new RangeError("Invalid time value");let l=a.match(an).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,Yr[a])(e,n.formatLong)}return e}).join("").match(en).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:sn(e)};if($r[a])return{isToken:!0,value:e};if(a.match(nn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}});n.localize.preprocessor&&(l=n.localize.preprocessor(s,l));const d={firstWeekContainsDate:o,weekStartsOn:i,locale:n};return l.map(r=>{if(!r.isToken)return r.value;const o=r.value;(!t?.useAdditionalWeekYearTokens&&function(e){return Xr.test(e)}(o)||!t?.useAdditionalDayOfYearTokens&&function(e){return Qr.test(e)}(o))&&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(Jr.includes(e))throw new RangeError(r)}(o,a,String(e));return(0,$r[o[0]])(s,o,n.localize,d)}).join("")}function sn(e){const a=e.match(tn);return a?a[1].replace(rn,"'"):e}function ln(e,a,t){const r=y(),n=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 n?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}(n,a):function(e,a){const t=e.format(a).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(t);return r?r[0].substr(1):""}(n,a)}function dn(e,a){const t=function(e){un[e]||(un[e]=pn?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 un[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=cn[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 cn={year:0,month:1,day:2,hour:3,minute:4,second:5};const un={},mn=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")),pn="06/25/2014, 00:00:00"===mn||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===mn;function hn(e,a,t,r,n,o,i){const s=new Date(0);return s.setUTCFullYear(e,a,t),s.setUTCHours(r,n,o,i),s}const fn=36e5,gn={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function vn(e,a,t){if(!e)return 0;let r,n,o=gn.timezoneZ.exec(e);if(o)return 0;if(o=gn.timezoneHH.exec(e),o)return r=parseInt(o[1],10),xn(r)?-r*fn:NaN;if(o=gn.timezoneHHMM.exec(e),o){r=parseInt(o[2],10);const e=parseInt(o[3],10);return xn(r,e)?(n=Math.abs(r)*fn+6e4*e,"+"===o[1]?-n:n):NaN}if(function(e){if(yn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),yn[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const r=t?a:function(e){return hn(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),n=bn(r,e),o=t?n:function(e,a,t){const r=e.getTime();let n=r-a;const o=bn(new Date(n),t);if(a===o)return a;n-=o-a;const i=bn(new Date(n),t);if(o===i)return o;return Math.max(o,i)}(a,n,e);return-o}return NaN}function bn(e,a){const t=dn(e,a),r=hn(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let n=e.getTime();const o=n%1e3;return n-=o>=0?o:1e3+o,r-n}function xn(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const yn={};const wn={X:function(e,a,t){const r=Nn(t.timeZone,e);if(0===r)return"Z";switch(a){case"X":return kn(r);case"XXXX":case"XX":return Cn(r);default:return Cn(r,":")}},x:function(e,a,t){const r=Nn(t.timeZone,e);switch(a){case"x":return kn(r);case"xxxx":case"xx":return Cn(r);default:return Cn(r,":")}},O:function(e,a,t){const r=Nn(t.timeZone,e);switch(a){case"O":case"OO":case"OOO":return"GMT"+function(e,a=""){const t=e>0?"-":"+",r=Math.abs(e),n=Math.floor(r/60),o=r%60;if(0===o)return t+String(n);return t+String(n)+a+_n(o,2)}(r,":");default:return"GMT"+Cn(r,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return ln("short",e,t);default:return ln("long",e,t)}}};function Nn(e,a){const t=e?vn(e,a,!0)/6e4:a?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function _n(e,a){const t=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<a;)r="0"+r;return t+r}function Cn(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+_n(Math.floor(r/60),2)+a+_n(Math.floor(r%60),2)}function kn(e,a){if(e%60==0){return(e>0?"-":"+")+_n(Math.abs(e)/60,2)}return Cn(e,a)}function Sn(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 An=36e5,En=6e4,Dn={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 Pn(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=Dn.dateTimePattern.exec(e);r?(a.date=r[1],t=r[3]):(r=Dn.datePattern.exec(e),r?(a.date=r[1],t=r[2]):(a.date=null,t=e));if(t){const e=Dn.timeZone.exec(t);e?(a.time=t.replace(e[1],""),a.timeZone=e[1].trim()):a.time=t}return a}(e),{year:n,restDateString:o}=function(e,a){if(e){const t=Dn.YYY[a],r=Dn.YYYYY[a];let n=Dn.YYYY.exec(e)||r.exec(e);if(n){const a=n[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(n=Dn.YY.exec(e)||t.exec(e),n){const a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}}return{year:null}}(r.date,t),i=function(e,a){if(null===a)return null;let t,r,n;if(!e||!e.length)return t=new Date(0),t.setUTCFullYear(a),t;let o=Dn.MM.exec(e);if(o)return t=new Date(0),r=parseInt(o[1],10)-1,zn(a,r)?(t.setUTCFullYear(a,r),t):new Date(NaN);if(o=Dn.DDD.exec(e),o){t=new Date(0);const e=parseInt(o[1],10);return function(e,a){if(a<1)return!1;const t=Rn(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(o=Dn.MMDD.exec(e),o){t=new Date(0),r=parseInt(o[1],10)-1;const e=parseInt(o[2],10);return zn(a,r,e)?(t.setUTCFullYear(a,r,e),t):new Date(NaN)}if(o=Dn.Www.exec(e),o)return n=parseInt(o[1],10)-1,Ln(n)?Tn(a,n):new Date(NaN);if(o=Dn.WwwD.exec(e),o){n=parseInt(o[1],10)-1;const e=parseInt(o[2],10)-1;return Ln(n,e)?Tn(a,n,e):new Date(NaN)}return null}(o,n);if(null===i||isNaN(i.getTime()))return new Date(NaN);if(i){const e=i.getTime();let t,n=0;if(r.time&&(n=function(e){let a,t,r=Dn.HH.exec(e);if(r)return a=parseFloat(r[1].replace(",",".")),Fn(a)?a%24*An:NaN;if(r=Dn.HHMM.exec(e),r)return a=parseInt(r[1],10),t=parseFloat(r[2].replace(",",".")),Fn(a,t)?a%24*An+t*En:NaN;if(r=Dn.HHMMSS.exec(e),r){a=parseInt(r[1],10),t=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return Fn(a,t,e)?a%24*An+t*En+1e3*e:NaN}return null}(r.time),null===n||isNaN(n)))return new Date(NaN);if(r.timeZone||a.timeZone){if(t=vn(r.timeZone||a.timeZone,new Date(e+n)),isNaN(t))return new Date(NaN)}else t=Sn(new Date(e+n)),t=Sn(new Date(e+n+t));return new Date(e+n+t)}return new Date(NaN)}function Tn(e,a,t){a=a||0,t=t||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const n=7*a+t+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+n),r}const In=[31,28,31,30,31,30,31,31,30,31,30,31],Mn=[31,29,31,30,31,30,31,31,30,31,30,31];function Rn(e){return e%400==0||e%4==0&&e%100!=0}function zn(e,a,t){if(a<0||a>11)return!1;if(null!=t){if(t<1)return!1;const r=Rn(e);if(r&&t>Mn[a])return!1;if(!r&&t>In[a])return!1}return!0}function Ln(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function Fn(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const On=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Un(e,a,t,r){return function(e,a,t={}){const r=(a=String(a)).match(On);if(r){const n=Pn(t.originalDate||e,t);a=r.reduce(function(e,a){if("'"===a[0])return e;const r=e.indexOf(a),o="'"===e[r-1],i=e.replace(a,"'"+wn[a[0]](n,a,t)+"'");return o?i.substring(0,r-1)+i.substring(r+1):i},a)}return on(e,a,t)}(function(e,a,t){const r=vn(a,e=Pn(e,t),!0),n=new Date(e.getTime()-r),o=new Date(0);return o.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),o.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),o}(e,a,{timeZone:(r={...r,timeZone:a,originalDate:e}).timeZone}),t,r)}const jn={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"}},Bn={date:hr({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:hr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:hr({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Vn={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"},$n={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"},qn={code:"es",formatDistance:(e,a,t)=>{let r;const n=jn[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",a.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"en "+r:"hace "+r:r},formatLong:Bn,formatRelative:(e,a,t,r)=>1!==a.getHours()?$n[e]:Vn[e],localize:{ordinalNumber:(e,a)=>Number(e)+"º",era:vr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:vr({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:vr({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:vr({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:vr({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:xr({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:br({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:br({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:br({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:br({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:br({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}},Wn={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"}},Hn={date:hr({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:hr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:hr({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Gn={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"},Kn={code:"pt-BR",formatDistance:(e,a,t)=>{let r;const n=Wn[e];return r="string"==typeof n?n:1===a?n.one:n.other.replace("{{count}}",String(a)),t?.addSuffix?t.comparison&&t.comparison>0?"em "+r:"há "+r:r},formatLong:Hn,formatRelative:(e,a,t,r)=>{const n=Gn[e];return"function"==typeof n?n(a):n},localize:{ordinalNumber:(e,a)=>{const t=Number(e);return"week"===a?.unit?t+"ª":t+"º"},era:vr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:vr({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:vr({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:vr({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:vr({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:xr({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:br({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:br({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:br({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:br({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:br({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}},Yn=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],Qn=[{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"}],Xn=[{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"}],Jn="pt-BR",Zn="dd/MM/yyyy HH:mm",eo="America/Sao_Paulo",ao=e=>Yn.find(a=>a.value===e),to=e=>Qn.find(a=>a.value===e),ro=e=>Xn.find(a=>a.value===e),no=e=>Yn.some(a=>a.value===e),oo=e=>Qn.some(a=>a.value===e),io=e=>Xn.some(a=>a.value===e),so=()=>{if("undefined"==typeof navigator)return Jn;const e=navigator.language;if(no(e))return e;const a=e.split("-")[0],t=Yn.find(e=>e.value.startsWith(a));return t?.value||Jn},lo=()=>{if("undefined"==typeof Intl)return eo;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return io(e)?e:eo}catch{return eo}},co=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||Zn),uo=()=>{const e=so();return{locale:e,timezone:lo(),datetimeFormat:co(e)}},mo={"pt-BR":Kn,"en-US":yr,"es-ES":qn},po=(e,a=Zn,t=eo,r=Jn)=>{if(!e)return"";const n=w(e);if(!N(n))return"Data inválida";const o=mo[r]||Kn;try{return Un(n,t,a,{locale:o})}catch(i){return Un(n,eo,a,{locale:o})}},ho=(e,a=Jn,t=eo)=>{if(!e)return"";const r=w(e);if(!N(r))return"Data inválida";const n=mo[a]||Kn;try{return Un(r,t,"PP",{locale:n})}catch(o){return Un(r,eo,"PP",{locale:n})}},fo=(e,a="BRL",t="pt-BR")=>null==e?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e);function go(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 vo(e,a=.1){const{r:t,g:r,b:n}=go(e);return`rgba(${t}, ${r}, ${n}, ${a})`}function bo(e){const{r:a,g:t,b:r}=go(e),[n,o,i]=[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*n+.7152*o+.0722*i}function xo(e,a){const t=bo(e),r=bo(a);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)}function yo(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{C.info("Link copiado para a área de transferência")})}function wo(e,a){return a?e.replace(/\{alias\}/g,a):e}function No(...e){return x(b(e))}const _o=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(_o);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,r]of Object.entries(e))a[t]=_o(r);return a}return e},Co=(e,a)=>{let t;return(...r)=>{clearTimeout(t),t=setTimeout(()=>e(...r),a)}},ko=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),So=v("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"}}),Ao=n.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>a(n?g:"button",{className:No(So({variant:t,size:r,className:e})),ref:i,...o}));Ao.displayName="Button";const Eo=o.forwardRef(({className:e,children:t,variant:r="action",...n},o)=>a(Ao,{ref:o,variant:r,size:"icon",className:No("h-8 w-8",e),...n,children:t||a(A,{size:16})}));Eo.displayName="ActionButton";const Do=n.forwardRef(({className:e,type:r,showCharCount:o,maxLength:i,onChange:s,...l},d)=>{const[c,u]=n.useState(0);n.useEffect(()=>{"string"==typeof l.value?u(l.value.length):"string"==typeof l.defaultValue&&u(l.defaultValue.length)},[l.value,l.defaultValue]);return t("div",{className:"w-full",children:[a("input",{type:r,className:No("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:d,maxLength:i,onChange:e=>{u(e.target.value.length),s?.(e)},...l}),o&&i&&t("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[c," / ",i]})]})});Do.displayName="Input";const Po=v("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),To=n.forwardRef(({className:e,...t},r)=>a(Na.Root,{ref:r,className:No(Po(),e),...t}));To.displayName=Na.Root.displayName;const Io=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Io.displayName="Card";const Mo=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("flex flex-col space-y-1.5 p-6",e),...t}));Mo.displayName="CardHeader";const Ro=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:No("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ro.displayName="CardTitle";const zo=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:No("text-sm text-muted-foreground",e),...t}));zo.displayName="CardDescription";const Lo=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("p-6 pt-0",e),...t}));Lo.displayName="CardContent";const Fo=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("flex items-center p-6 pt-0",e),...t}));Fo.displayName="CardFooter";const Oo=n.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>a(Ca.Root,{ref:o,decorative:r,orientation:t,className:No("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Oo.displayName=Ca.Root.displayName;const Uo=ka.Root,jo=ka.Trigger,Bo=ka.Portal,Vo=n.forwardRef(({className:e,...t},r)=>a(ka.Overlay,{className:No("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}));Vo.displayName=ka.Overlay.displayName;const $o=n.forwardRef(({className:e,...r},n)=>t(Bo,{children:[a(Vo,{}),a(ka.Content,{ref:n,className:No("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),...r})]}));$o.displayName=ka.Content.displayName;const qo=({className:e,...t})=>a("div",{className:No("flex flex-col space-y-2 text-center sm:text-left",e),...t});qo.displayName="AlertDialogHeader";const Wo=({className:e,...t})=>a("div",{className:No("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Wo.displayName="AlertDialogFooter";const Ho=n.forwardRef(({className:e,...t},r)=>a(ka.Title,{ref:r,className:No("text-lg font-semibold",e),...t}));Ho.displayName=ka.Title.displayName;const Go=n.forwardRef(({className:e,...t},r)=>a(ka.Description,{ref:r,className:No("text-sm text-muted-foreground",e),...t}));Go.displayName=ka.Description.displayName;const Ko=n.forwardRef(({className:e,...t},r)=>a(ka.Action,{ref:r,className:No(So(),e),...t}));Ko.displayName=ka.Action.displayName;const Yo=n.forwardRef(({className:e,...t},r)=>a(ka.Cancel,{ref:r,className:No(So({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Yo.displayName=ka.Cancel.displayName;const Qo=_a.Root,Xo=_a.Trigger,Jo=_a.Portal,Zo=_a.Close,ei=n.forwardRef(({className:e,...t},r)=>a(_a.Overlay,{ref:r,className:No("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}));ei.displayName=_a.Overlay.displayName;const ai={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"}},ti=n.forwardRef(({className:r,children:o,size:i,variant:s="informative",isDirty:l,customWidth:d,customMinWidth:c,customMaxWidth:u,customHeight:m,customMinHeight:p,customMaxHeight:h,unsavedChangesTitle:f=e.t("unsaved_changes"),unsavedChangesDescription:g=e.t("unsaved_changes_description"),cancelText:v=e.t("cancel"),leaveWithoutSavingText:b=e.t("leave_without_saving"),style:x,onInteractOutside:y,onEscapeKeyDown:w,...N},_)=>{const[C,k]=n.useState(!1),S=n.useRef(null),A=n.useRef(!1),D=i??(d||c||u||m||p||h?void 0:"md"),P=D?ai[D]:{},T={...d??P.width?{width:d??P.width}:{},...c??P.minWidth?{minWidth:c??P.minWidth}:{},...u??P.maxWidth?{maxWidth:u??P.maxWidth}:{},...m??P.height?{height:m??P.height}:{},...p??P.minHeight?{minHeight:p??P.minHeight}:{},...h??P.maxHeight?{maxHeight:h??P.maxHeight}:{},...x},I=n.useCallback(e=>{"form"===s&&l?(S.current=e,k(!0)):e()},[s,l]),M=n.useRef(null),R="destructive"!==s;if("development"===process.env.NODE_ENV&&o){const e=n.Children.toArray(o);e.some(e=>n.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>n.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t(Jo,{children:[a(ei,{}),t(_a.Content,{ref:_,className:No("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",r),style:T,onInteractOutside:e=>{"form"!==s&&"destructive"!==s?y?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==s)return"form"===s&&l?(e.preventDefault(),void I(()=>{A.current=!0,M.current?.click()})):void w?.(e);e.preventDefault()},...N,children:[o,R&&t(_a.Close,{ref:M,onClick:e=>{A.current?A.current=!1:"form"===s&&l&&(e.preventDefault(),I(()=>{A.current=!0,M.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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]}),a(Uo,{open:C,onOpenChange:k,children:t($o,{children:[t(qo,{children:[a(Ho,{children:f}),a(Go,{children:g})]}),t(Wo,{children:[a(Yo,{onClick:()=>{k(!1),S.current=null},children:v}),a(Ko,{onClick:()=>{k(!1),S.current?.(),S.current=null},children:b})]})]})})]})});ti.displayName=_a.Content.displayName;const ri=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:No("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(Oo,{className:"mt-2"})]});ri.displayName="DialogHeader";const ni=({className:e,...t})=>a("div",{className:No("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});ni.displayName="DialogBody";const oi=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(Oo,{className:"mb-4"}),a("div",{className:No("flex flex-row justify-end gap-2",e),...n,children:r})]});oi.displayName="DialogFooter";const ii=n.forwardRef(({className:e,...t},r)=>a(_a.Title,{ref:r,className:No("text-xl font-semibold leading-none tracking-tight",e),...t}));ii.displayName=_a.Title.displayName;const si=n.forwardRef(({className:e,...t},r)=>a(_a.Description,{ref:r,className:No("text-sm text-muted-foreground",e),...t}));si.displayName=_a.Description.displayName;const li=Aa,di=n.createContext({}),ci=({...e})=>a(di.Provider,{value:{name:e.name},children:a(Ea,{...e})}),ui=()=>{const e=n.useContext(di),a=n.useContext(mi),{getFieldState:t,formState:r}=Sa(),o=t(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=a;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},mi=n.createContext({}),pi=n.forwardRef(({className:e,...t},r)=>{const o=n.useId();return a(mi.Provider,{value:{id:o},children:a("div",{ref:r,className:No("space-y-1.5",e),...t})})});pi.displayName="FormItem";const hi=n.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:o}=ui();return a(To,{ref:r,className:No(n&&"text-destructive",e),htmlFor:o,...t})});hi.displayName="FormLabel";const fi=n.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:i}=ui();return a(g,{ref:t,id:n,"aria-describedby":r?`${o} ${i}`:`${o}`,"aria-invalid":!!r,...e})});fi.displayName="FormControl";const gi=n.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=ui();return a("p",{ref:r,id:n,className:No("text-sm text-muted-foreground",e),...t})});gi.displayName="FormDescription";const vi=n.forwardRef(({className:e,children:t,...r},n)=>{const{error:o,formMessageId:i}=ui(),s=o?String(o?.message):t;return s?a("p",{ref:n,id:i,className:No("text-sm font-medium text-destructive",e),...r,children:s}):null});vi.displayName="FormMessage";const bi=n.createContext({showCheck:!1}),xi=({showCheck:e=!1,...t})=>a(bi.Provider,{value:{showCheck:e},children:a(Da.Root,{...t})}),yi=Da.Group,wi=Da.Value,Ni=n.forwardRef(({className:e,children:r,...n},o)=>t(Da.Trigger,{ref:o,className:No("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),...n,children:[r,a(Da.Icon,{asChild:!0,children:a(D,{className:"h-4 w-4 opacity-50"})})]}));Ni.displayName=Da.Trigger.displayName;const _i=n.forwardRef(({className:e,...t},r)=>a(Da.ScrollUpButton,{ref:r,className:No("flex cursor-default items-center justify-center py-1",e),...t,children:a(P,{className:"h-4 w-4"})}));_i.displayName=Da.ScrollUpButton.displayName;const Ci=n.forwardRef(({className:e,...t},r)=>a(Da.ScrollDownButton,{ref:r,className:No("flex cursor-default items-center justify-center py-1",e),...t,children:a(D,{className:"h-4 w-4"})}));Ci.displayName=Da.ScrollDownButton.displayName;const ki=n.forwardRef(({className:e,children:r,position:n="popper",container:o,collisionBoundary:i,...s},l)=>a(Da.Portal,{container:o,children:t(Da.Content,{ref:l,className:No("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"===n&&"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:n,collisionBoundary:i,...s,children:[a(_i,{}),a(Da.Viewport,{className:No("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),a(Ci,{})]})}));ki.displayName=Da.Content.displayName;const Si=n.forwardRef(({className:e,...t},r)=>a(Da.Label,{ref:r,className:No("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Si.displayName=Da.Label.displayName;const Ai=n.forwardRef(({className:e,children:r,...o},i)=>{const{showCheck:s}=n.useContext(bi);return t(Da.Item,{ref:i,className:No("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",s?"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",s?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...o,children:[s&&a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(Da.ItemIndicator,{children:a(T,{className:"h-4 w-4"})})}),a(Da.ItemText,{children:r})]})});Ai.displayName=Da.Item.displayName;const Ei=n.forwardRef(({className:e,...t},r)=>a(Da.Separator,{ref:r,className:No("-mx-1 my-1 h-px bg-muted",e),...t}));Ei.displayName=Da.Separator.displayName;const Di=n.forwardRef(({className:e,...t},r)=>a(Pa.Root,{ref:r,className:No("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(Pa.Indicator,{className:No("flex items-center justify-center text-current"),children:a(T,{className:"h-4 w-4"})})}));Di.displayName=Pa.Root.displayName;const Pi=n.forwardRef(({className:e,showCharCount:r,maxLength:o,onChange:i,...s},l)=>{const[d,c]=n.useState(0);n.useEffect(()=>{"string"==typeof s.value?c(s.value.length):"string"==typeof s.defaultValue&&c(s.defaultValue.length)},[s.value,s.defaultValue]);return t("div",{className:"w-full",children:[a("textarea",{className:No("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:l,maxLength:o,onChange:e=>{c(e.target.value.length),i?.(e)},...s}),r&&o&&t("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[d," / ",o]})]})});Pi.displayName="Textarea";const Ti=v("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"}}),Ii=n.forwardRef(({className:e,variant:t,...r},n)=>a("div",{ref:n,className:No(Ti({variant:t}),e),...r}));Ii.displayName="Badge";const Mi={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Ri({size:e="md",className:t}){return a(I,{className:No("animate-spin text-muted-foreground",Mi[e],t)})}function zi({isLoading:e,children:n,className:o,type:i="spinner",size:s="md"}){return e?"overlay"===i?t("div",{className:No("relative",o),children:[n,a("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:a(Ri,{size:s})})]}):a("div","skeleton"===i?{className:No("animate-pulse",o),children:a("div",{className:"bg-muted rounded-md h-full w-full"})}:{className:No("flex items-center justify-center py-8",o),children:a(Ri,{size:s})}):a(r,{children:n})}const Li=({...e})=>a(k,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a(F,{className:"h-4 w-4"}),info:a(L,{className:"h-4 w-4"}),warning:a(z,{className:"h-4 w-4"}),error:a(R,{className:"h-4 w-4"}),loading:a(M,{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}),Fi=Ta.Root,Oi=Ta.Trigger,Ui=Ta.Group,ji=Ta.Portal,Bi=Ta.Sub,Vi=Ta.RadioGroup,$i=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ta.SubTrigger,{ref:i,className:No("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...o,children:[n,a(O,{className:"ml-auto h-4 w-4"})]}));$i.displayName=Ta.SubTrigger.displayName;const qi=n.forwardRef(({className:e,...t},r)=>a(Ta.SubContent,{ref:r,className:No("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}));qi.displayName=Ta.SubContent.displayName;const Wi=n.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a(Ta.Portal,{children:a(Ta.Content,{ref:n,sideOffset:t,className:No("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})}));Wi.displayName=Ta.Content.displayName;const Hi=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ta.Item,{ref:n,className:No("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}));Hi.displayName=Ta.Item.displayName;const Gi=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ta.CheckboxItem,{ref:i,className:No("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:n,...o,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(Ta.ItemIndicator,{children:a(T,{className:"h-4 w-4"})})}),r]}));Gi.displayName=Ta.CheckboxItem.displayName;const Ki=n.forwardRef(({className:e,children:r,...n},o)=>t(Ta.RadioItem,{ref:o,className:No("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(Ta.ItemIndicator,{children:a(U,{className:"h-2 w-2 fill-current"})})}),r]}));Ki.displayName=Ta.RadioItem.displayName;const Yi=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ta.Label,{ref:n,className:No("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Yi.displayName=Ta.Label.displayName;const Qi=n.forwardRef(({className:e,...t},r)=>a(Ta.Separator,{ref:r,className:No("-mx-1 my-1 h-px bg-muted",e),...t}));Qi.displayName=Ta.Separator.displayName;const Xi=({className:e,...t})=>a("span",{className:No("ml-auto text-xs tracking-widest opacity-60",e),...t});Xi.displayName="DropdownMenuShortcut";const Ji=({delayDuration:e=300,...t})=>a(Ia.Provider,{delayDuration:e,...t}),Zi=Ia.Root,es=Ia.Trigger,as=n.forwardRef(({className:e,sideOffset:t=4,container:r,...n},o)=>a(Ia.Portal,{container:r,children:a(Ia.Content,{ref:o,sideOffset:t,className:No("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),...n})}));as.displayName=Ia.Content.displayName;const ts=n.forwardRef(({children:e,disabledReason:r,className:n},o)=>{const i=a(Hi,{ref:o,className:No("opacity-50 cursor-not-allowed pointer-events-auto",n),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return r?a(Ji,{delayDuration:100,children:t(Zi,{children:[a(es,{asChild:!0,children:a("div",{className:"w-full",children:i})}),a(as,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:r})]})}):i});ts.displayName="DisabledMenuItem";const rs=Ma.Root,ns=Ma.Trigger,os=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:n,...o},i)=>a(Ma.Portal,{container:n,children:a(Ma.Content,{ref:i,align:t,sideOffset:r,className:No("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),...o})}));os.displayName=Ma.Content.displayName;const is=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));is.displayName="Command";const ss=({children:e,...t})=>a("div",{...t,children:a(is,{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})}),ls=n.forwardRef(({className:e,...t},r)=>a("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:a("input",{ref:r,className:No("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})}));ls.displayName="CommandInput";const ds=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));ds.displayName="CommandList";const cs=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("py-6 text-center text-sm text-muted-foreground",e),...t}));cs.displayName="CommandEmpty";const us=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("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}));us.displayName="CommandGroup";const ms=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("-mx-1 h-px bg-border",e),...t}));ms.displayName="CommandSeparator";const ps=n.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...o},i)=>a("div",{ref:i,className:No("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?.(n||""),...o}));ps.displayName="CommandItem";const hs=({className:e,...t})=>a("span",{className:No("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function fs({className:e,...t}){return a("div",{className:No("animate-pulse rounded-md bg-muted",e),...t})}hs.displayName="CommandShortcut";const gs=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function vs({multiple:r,options:n,value:o,onChange:l,getOptionValue:d,getOptionLabel:c,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:f,disabled:g,required:v,className:b,sortOptions:x,maxDisplayedBadges:y,popoverContainer:w,onOpen:N,onClose:_,clearable:C,showCheck:k}){const[S,A]=i(!1),[P,I]=i(""),M=s(()=>o?Array.isArray(o)?o:[o]:[],[o]),R=s(()=>{if(!w)return;let e=w,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},[w]),z=s(()=>{const e=n.map(e=>({original:e,value:d(e),label:c(e)}));return x?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[n,d,c,x]),L=s(()=>{if(!P)return z;const e=gs(P);return z.filter(a=>gs(a.label).includes(e))},[z,P]),F=s(()=>z.filter(e=>M.includes(e.value)),[z,M]),O=e=>{A(e),e?N?.():(I(""),_?.())},U=(e,a)=>{a.preventDefault(),a.stopPropagation(),l&&l(r?M.filter(a=>a!==e):"")},j=y?F.slice(0,y):F,B=y&&F.length>y?F.length-y:0;return t("div",{className:No("space-y-2",b),children:[m&&t(To,{children:[m,v&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(rs,{open:S,onOpenChange:O,modal:!1,children:[r?a(ns,{asChild:!0,children:t("div",{role:"combobox","aria-expanded":S,"aria-disabled":g,tabIndex:g?-1:0,onKeyDown:e=>{g||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),O(!S))},className:No("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",g&&"pointer-events-none opacity-50 cursor-not-allowed",0===F.length&&"text-muted-foreground"),children:[0===F.length?t("span",{className:"flex items-center gap-2",children:[p&&a(p,{className:"h-4 w-4"}),u]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[j.map(e=>t(Ii,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a("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&&U(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>U(e.value,a),children:a(E,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),B>0&&t(Ii,{variant:"outline",className:"gap-1",children:["+",B]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t("div",{className:"relative",children:[a(ns,{asChild:!0,children:t(Ao,{variant:"outline",role:"combobox","aria-expanded":S,disabled:g,className:No("relative w-full justify-start min-h-10 h-auto pr-10",C&&F.length>0&&"pr-16",0===F.length&&"text-muted-foreground"),children:[0===F.length?t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&a(p,{className:"h-4 w-4"}),a("span",{className:"truncate",children:u})]}):t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&a(p,{className:"h-4 w-4"}),a("span",{className:"truncate",children:F[0]?.label})]}),a(D,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),C&&F.length>0&&a("button",{type:"button",disabled:g,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=>U("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:a(E,{className:"h-3.5 w-3.5"})})]}),a(os,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:t(is,{children:[t("div",{className:"relative",children:[a(ls,{placeholder:f,value:P,onChange:e=>I(e.target.value)}),P&&a("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:()=>I(""),children:a(E,{className:"h-3.5 w-3.5"})})]}),a(ds,{children:0===n.length?a(cs,{children:h}):0===L.length?a(cs,{children:e.t("no_results")}):a(us,{children:L.map(e=>{const n=M.includes(e.value);return t(ps,{value:e.value,onSelect:()=>(e=>{if(l)if(r){const a=M.includes(e)?M.filter(a=>a!==e):[...M,e];l(a)}else l(e),A(!1)})(e.value),className:No("cursor-pointer",n&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[k&&a(T,{className:No("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),e.label]},e.value)})})})]})})]})]})}function bs({multiple:e=!1,options:r,items:n,value:o,onChange:i,onValueChange:s,getOptionValue:l=e=>e.value,getOptionLabel:d=e=>e.label,placeholder:c,label:u,icon:m,emptyMessage:p,searchPlaceholder:h,disabled:f=!1,required:g=!1,isLoading:v=!1,error:b,className:x,sortOptions:y=!0,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k=!0,showCheck:S=!1}){const{t:A}=Ra(),E=r||n||[],D=s||i,P=c||A("select_placeholder","Selecione..."),T=p||A("no_results",A("no_results")),I=h||A("search_placeholder","Pesquisar...");if(v)return t("div",{className:No("space-y-2",x),children:[u&&t(To,{children:[u,g&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(fs,{className:"h-10 w-full"})]});const M="string"==typeof b?b:b instanceof Error?b.message:b?A("error_loading",A("error_loading")):void 0;return M?t("div",{className:No("space-y-2",x),children:[u&&t(To,{children:[u,g&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a(j,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:M})]})]}):a(vs,{multiple:e,options:E,value:o||(e?[]:""),onChange:D,getOptionValue:l,getOptionLabel:d,placeholder:P,label:u,icon:m,emptyMessage:T,searchPlaceholder:I,disabled:f,required:g,className:x,sortOptions:y,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k,showCheck:S})}const xs=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function ys(e,a){if(!a)return null;const t=xs(a),r=[];for(const n of e){const e=xs(n.label).includes(t),o=n.children?ys(n.children,a):null,i=o&&o.length>0;(e||i)&&r.push({...n,children:e?n.children:i?o:n.children})}return r}function ws(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=ws(t.children,a);if(e)return e}}}function Ns({node:e,level:r,expanded:n,onToggleExpand:o,selectedValues:i,onSelect:s,showCheck:l}){const d=e.children&&e.children.length>0,c=i.includes(e.value),u=8+20*r;return t("div",{role:"treeitem","aria-expanded":d?n:void 0,"aria-selected":c,className:No("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:[t("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:a=>{a.stopPropagation(),s(e.value)},children:[l&&a(T,{className:No("h-4 w-4 shrink-0",c?"opacity-100":"opacity-0")}),(()=>{const t=c?e.iconSelected??(n?e.iconOpen:null)??e.icon:n?e.iconOpen??e.icon:e.icon;return t?a(t,{className:No("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),a("span",{className:"truncate",children:e.label})]}),d&&a("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(),o(e.value)},tabIndex:-1,"aria-label":n?"Recolher":"Expandir",children:a(n?D:O,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function _s({nodes:e,level:n,expandedIds:i,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}){return a(r,{children:e.map(e=>{const r=i.has(e.value);return t(o.Fragment,{children:[a(Ns,{node:e,level:n,expanded:r,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}),r&&e.children&&e.children.length>0&&a(_s,{nodes:e.children,level:n+1,expandedIds:i,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c})]},e.value)})})}function Cs({multiple:e=!1,options:r,value:n,onChange:o,placeholder:d,label:c,icon:u,emptyMessage:m,searchPlaceholder:p,disabled:h=!1,required:f=!1,isLoading:g=!1,error:v,className:b,maxDisplayedBadges:x,popoverContainer:y,onOpen:w,onClose:N,defaultExpanded:_=!0,showCheck:C=!1}){const{t:k}=Ra(),[S,A]=i(!1),[P,T]=i(""),[I,M]=i(()=>_?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),R=d||k("select_placeholder","Selecione..."),z=m||k("no_results",k("no_results")),L=p||k("search_placeholder","Pesquisar..."),F=s(()=>n?Array.isArray(n)?n:[n]:[],[n]),O=s(()=>{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]),U=s(()=>ys(r,P),[r,P])??r,V=s(()=>P?function(e,a){const t=new Set,r=xs(a);function n(e){if(!e.children||0===e.children.length)return xs(e.label).includes(r);let a=!1;for(const t of e.children)n(t)&&(a=!0);return a&&t.add(e.value),a||xs(e.label).includes(r)}for(const o of e)n(o);return t}(r,P):new Set,[r,P]),$=P?V:I,q=l(e=>{P||M(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[P]),W=s(()=>F.map(e=>({value:e,label:ws(r,e)||e})),[F,r]),H=e=>{A(e),e?w?.():(T(""),N?.())},G=l(a=>{if(o)if(e){const e=F.includes(a)?F.filter(e=>e!==a):[...F,a];o(e)}else o(a),A(!1)},[o,e,F]),K=(a,t)=>{t.preventDefault(),t.stopPropagation(),o&&o(e?F.filter(e=>e!==a):"")},Y=x?W.slice(0,x):W,Q=x&&W.length>x?W.length-x:0;if(g)return t("div",{className:No("space-y-2",b),children:[c&&t(To,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(fs,{className:"h-10 w-full"})]});const X="string"==typeof v?v:v instanceof Error?v.message:v?k("error_loading",k("error_loading")):void 0;return t("div",X?{className:No("space-y-2",b),children:[c&&t(To,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[a(j,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:X})]})]}:{className:No("space-y-2",b),children:[c&&t(To,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(rs,{open:S,onOpenChange:H,modal:!1,children:[a(ns,{asChild:!0,children:e?t("div",{role:"combobox","aria-expanded":S,"aria-disabled":h,tabIndex:h?-1:0,onKeyDown:e=>{h||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),H(!S))},className:No("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",h&&"pointer-events-none opacity-50 cursor-not-allowed",0===W.length&&"text-muted-foreground"),children:[0===W.length?t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),R]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[Y.map(e=>t(Ii,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,a("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&&K(e.value,a)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:a=>K(e.value,a),children:a(E,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),Q>0&&t(Ii,{variant:"outline",className:"gap-1",children:["+",Q]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t(Ao,{variant:"outline",role:"combobox","aria-expanded":S,disabled:h,className:No("w-full justify-between min-h-10 h-auto font-normal",0===W.length&&"text-muted-foreground"),children:[0===W.length?t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),R]}):t("span",{className:"flex items-center gap-2",children:[u&&a(u,{className:"h-4 w-4"}),W[0]?.label]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t(os,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:O,collisionBoundary:O,children:[t("div",{className:"flex items-center border-b px-3",children:[a(B,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a("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:L,value:P,onChange:e=>T(e.target.value)}),P&&a("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a(E,{className:"h-3.5 w-3.5"})})]}),a("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:a("div",{role:"tree",className:"p-1",children:0===U.length?a("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?z:k("no_search_results",k("no_results"))}):a(_s,{nodes:U,level:0,expandedIds:$,onToggleExpand:q,selectedValues:F,onSelect:G,showCheck:C})})})]})]})]})}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 n=e.split(".");if(3!==n.length)return null;const o=n[1];o.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(o),a=atob(e),t=new Uint8Array(a.length);for(let n=0;n<a.length;n++)t[n]=a.charCodeAt(n);const r=new TextDecoder("utf-8").decode(t);return JSON.parse(r)}catch(a){try{const e=this.normalizeBase64Url(o),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(o),a=atob(e);return JSON.parse(a)}catch(r){throw r}}}}catch(n){return null}}static validateTokens(e,a){const t=[],r=[];try{a.split(".")[1],e.split(".")[1];const n=this.parseJwtPayload(a),o=this.parseJwtPayload(e);if(!n){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 i=!0;if(!o){const e="Access token decode falhou - será tentado novamente nas chamadas de API";t.push(e),i=!1}const s=Math.floor(Date.now()/1e3);if(o?.exp&&o.exp<s){const e="Access token expirado - pode precisar de refresh";t.push(e),i=!1}if(n.exp&&n.exp<s){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:i,warnings:t,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:i,warnings:t,errors:r}}catch(n){const e=`Erro na validação de tokens: ${n}`;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 Ss="qualiex_access_token",As="qualiex_id_token",Es="supabase_token",Ds="oauth_state",Ps="oauth_nonce",Ts="selected_alias",Is="manual_logout",Ms="supabase_project_id",Rs={setAccessToken:e=>localStorage.setItem(Ss,e),getAccessToken:()=>localStorage.getItem(Ss),setIdToken:e=>localStorage.setItem(As,e),getIdToken:()=>localStorage.getItem(As),getSupabaseToken:()=>localStorage.getItem(Es),setOAuthState:e=>sessionStorage.setItem(Ds,e),getOAuthState:()=>sessionStorage.getItem(Ds),clearOAuthState:()=>sessionStorage.removeItem(Ds),setOAuthNonce:e=>sessionStorage.setItem(Ps,e),getOAuthNonce:()=>sessionStorage.getItem(Ps),clearOAuthNonce:()=>sessionStorage.removeItem(Ps),setSelectedAlias:e=>localStorage.setItem(Ts,e),getSelectedAlias:()=>localStorage.getItem(Ts),clearSelectedAlias:()=>localStorage.removeItem(Ts),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Rs.getAccessToken()||!Rs.getIdToken()),checkProjectMismatch:()=>{const e=import.meta.env.VITE_SUPABASE_PROJECT_ID;if(!e)return!1;const a=localStorage.getItem(Ms);return a&&a!==e?(Rs.clearAll(),localStorage.setItem(Ms,e),!0):(a||localStorage.setItem(Ms,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Es,e),Rs._clearValidationCache()},areAllTokensValid:()=>{const e=Rs.getAccessToken(),a=Rs.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=Rs.getAccessToken(),t=Rs.getIdToken(),r=Rs.getSupabaseToken();return a&&Rs.isTokenExpired(a)&&(localStorage.removeItem(Ss),e=!0),t&&Rs.isTokenExpired(t)&&(localStorage.removeItem(As),e=!0),r&&Rs.isTokenExpired(r)&&(localStorage.removeItem(Es),e=!0),e},clearAll:()=>{localStorage.removeItem(Ss),localStorage.removeItem(As),localStorage.removeItem(Es),localStorage.removeItem(Ts),localStorage.removeItem(Is),sessionStorage.removeItem(Ds),sessionStorage.removeItem(Ps),Rs._clearValidationCache()},setManualLogout:()=>localStorage.setItem(Is,"true"),isManualLogout:()=>"true"===localStorage.getItem(Is),clearManualLogout:()=>localStorage.removeItem(Is),isTokenExpired:e=>{try{return ks.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Rs._validationCache.isValid=!1,Rs._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Rs.getSupabaseToken();if(!e)return!1;if(Rs.isTokenExpired(e))return Rs._clearValidationCache(),Rs._handleExpiredToken(),!1;const a=Date.now();return a-Rs._validationCache.timestamp<Rs._validationCache.cacheValidityMs?Rs._validationCache.isValid:(Rs._validationCache.isValid=!0,Rs._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>Rs.isSupabaseTokenValid()?Rs.getSupabaseToken():null,_handleExpiredToken:()=>{Rs.clearAll()},extractTokenData:()=>{if(!Rs.isSupabaseTokenValid())return null;const e=Rs.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,n=a.place_name||null;let o=a.company_id;if(!o&&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){o=e[7];break}}}return{alias:t,companyId:o,placeId:r,placeName:n,payload:a}}catch(a){return Rs._handleExpiredToken(),null}},getCompanyId:e=>{const a=Rs.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(n){}const t=Rs.extractTokenData();if(t?.companyId)return t.companyId;const r=Rs.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(n){}return null},getCompanyIdInt:e=>{const a=[Rs.getAccessToken(),Rs.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=Rs.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=Rs.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 zs=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);C.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){C.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 Ls(e){return!!e&&e.startsWith("eyJ")}let Fs=!1;function Os(){const e=import.meta.env.VITE_SUPABASE_URL,a=import.meta.env.VITE_SUPABASE_PK_OVERRIDE||(import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&a?{url:e,key:a}:null}function Us(){return null!==Os()}class js{constructor(e){this.currentToken=null,this.config=e,function(){const e=import.meta.env.VITE_SUPABASE_PK_OVERRIDE,a=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;Fs?Ls(a):e&&Ls(a)?Fs=!0:Ls(a)?Fs=!0:Fs=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:this.config.key};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return Fa(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(!js.instance){const e=Os();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).");js.instance=new js(e)}return js.instance}getClient(){const e=Rs.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 zs.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}}function Bs(){return js.getInstance().getClient()}class Vs{static async generateToken(e,a,t,r=!1){try{if(!r){const e=Rs.getSupabaseToken();if(e&&Rs.isSupabaseTokenValid())return e}const n=Bs(),{data:o,error:i}=await n.functions.invoke("validate-token",{body:{access_token:e,alias:a}});return i&&(i.message?.includes("401")||i.message?.includes("Unauthorized"))?(t?.(),null):o?.access_token?(Rs.setSupabaseToken(o.access_token),o.access_token):null}catch(n){return n instanceof Error&&(n.message.includes("401")||n.message.includes("Unauthorized"))&&t?.(),null}}}class $s{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=Rs.getAccessToken(),t=Rs.getSelectedAlias();if(!a||!t)return null;const r=await Vs.generateToken(a,t,this.onLogoutCallback||void 0,e);return r||null}catch(a){return null}}}$s.regenerationPromise=null,$s.onLogoutCallback=null;class qs{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(Rs.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 Ws{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 $s.attemptRegeneration()?(this.isRetrying=!1,!0):(qs.handleError(e),this.isRetrying=!1,!1)}catch(r){return qs.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Rs.getAccessToken();return e?Rs.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."}}}Ws.isRetrying=!1;const Hs=new class{get baseUrl(){return rr()}async makeApiCall(e,a,t){const r=Ws.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const n=Rs.getAccessToken();if(!n)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 o=new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{o.searchParams.append(e,a)});const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!i.ok){const e=new Error(`API call failed: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}return await i.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 zs.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(zs.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(n){if(await Ws.handleApiError(n))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a," após retry")??[]}catch(o){return zs.handleError(o instanceof Error?o:"Erro ao buscar usuários após renovação de token",!0),[]}return zs.handleError(n instanceof Error?n.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 zs.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=Rs.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||""})):(zs.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await Ws.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 zs.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return zs.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})):(zs.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(t){if(await Ws.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 zs.handleError(r instanceof Error?r:"Erro ao buscar associações após renovação de token",!0),[]}return zs.handleError(t instanceof Error?t.message:"Erro ao buscar associações do usuário",!0),[]}}};function Gs(e,a){const t=a||or.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Ks(e,a){const t=a||or.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Ys(e,a){const t=a||or.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Qs(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||Gs(e.idField),emailField:e.emailField||Ks(e.idField),usernameField:e.usernameField||Ys(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:Gs(e),emailField:Ks(e),usernameField:Ys(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const Xs=new Map;class Js{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,r=Xs.get(t);if(r&&Date.now()-r.timestamp<3e5)return r.users;let n=await Hs.fetchUsers(e,a,"all");return 0===n.length&&(n=await Hs.fetchUsers(e,a,"active")),Xs.set(t,{users:n,timestamp:Date.now()}),n}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 n of a){const a=e[n.idField];if(!a)continue;const o=t.get(a);if(o){if(n.nameField){r[n.nameField]||(r[n.nameField]=o.userName||null)}if(n.emailField){r[n.emailField]||(r[n.emailField]=o.userEmail||null)}if(n.usernameField){r[n.usernameField]||(r[n.usernameField]=o.userName||null)}}}return r}static async enrichWithUserData(e,a){if(!Array.isArray(e)||0===e.length)return e;try{if(!Rs.areAllTokensValid())return e;const t=Rs.extractTokenData();if(!t)return e;const{alias:r,companyId:n}=t;if(!r||!n)return e;const o=Qs(a.userIdFields,a.userFieldsMapping);if(0===this.extractUserIds(e,o).size)return e;const i=await this.fetchQualiexUsers(r,n),s=this.indexUsers(i);return e.map(e=>this.enrichEntity(e,o,s))}catch(t){return zs.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const Zs=["responsible_name"],el=e=>Zs.includes(e);function al(e,a,t){const r="string"==typeof e?{tableName:e,searchFields:a||[],schemaName:t||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:n,searchFields:o,selectFields:i,schemaName:s,entityName:l,enableQualiexEnrichment:d=!1}=r,c=()=>{if(!Rs.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Bs().schema(s).from(n)},u=(e,a,t,r)=>{let n=c().select(i||"*",{count:"exact"});n=n.eq("is_removed",!1),Object.entries(r).forEach(([e,a])=>{void 0!==a&&""!==a&&(Array.isArray(a)?n=n.in(e,a):"object"==typeof a&&a&&"operator"in a?"not_null"===a.operator?n=n.not(e,"is",null):"is_null"===a.operator&&(n=n.is(e,null)):null!==a&&(n=n.eq(e,a)))}),n=((e,a)=>{if(a&&o.length>0){const t=o.map(e=>`${e}.ilike.%${a}%`).join(",");return e.or(t)}return e})(n,e);const s=a.includes(".");return s||el(a)||(n=n.order(a,{ascending:"asc"===t})),{query:n,isForeignKey:s}},m=async(e,a,t,n,o)=>{const i=Qs(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),s=a.includes(".");if(el(a)||s||i){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},i=await p.getAll(e);if(!i?.data?.length)return i;const d=await Js.enrichWithUserData(i.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let c;c=s?d.sort((e,r)=>{const n=a.split(".").reduce((e,a)=>e?.[a],e)||"",o=a.split(".").reduce((e,a)=>e?.[a],r)||"",i=String(n).localeCompare(String(o),"pt-BR");return"asc"===t?i:-i}):((e,a,t)=>[...e].sort((e,r)=>{const n=e[a]||"",o=r[a]||"",i=n.localeCompare(o,"pt-BR",{sensitivity:"base"});return"asc"===t?i:-i}))(d,a,t);const u=((e,a=1,t=25)=>{const r=(a-1)*t,n=r+t;return{data:e.slice(r,n),pagination:{currentPage:a,totalPages:Math.ceil(e.length/t),totalItems:e.length,itemsPerPage:t,hasNextPage:n<e.length,hasPreviousPage:a>1}}})(c,n,o);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 Js.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:a,sortField:t,sortDirection:o,page:i,limit:s,additionalFilters:c}=(e=>{const{search:a="",sortField:t="updated_at",sortDirection:r="desc",page:n=1,limit:o=25,...i}=e;return{search:a,sortField:t,sortDirection:r,page:n,limit:o,additionalFilters:i}})(e),{query:p}=u(a,t,o,c),h=((e,a,t)=>{const r=(a-1)*t,n=r+t-1;return e.range(r,n)})(p,i,s),{data:f,error:g,count:v}=await h;if(g)throw new Error(`Error fetching ${n}: ${g.message}`);let b=((e,a,t,r)=>{const n=Math.ceil((a||0)/r);return{data:e,currentPage:t,totalPages:n,totalItems:a||0,itemsPerPage:r,hasNextPage:t<n,hasPreviousPage:t>1}})(f||[],v,i,s);if((e=>{if(!d||!l||0===e.length)return!1;const a=Qs(r.userIdFields,r.userFieldsMapping);return e.some(e=>a.some(a=>e[a.idField]))})(b.data)){const e=await m(b.data,t,o,i,s);if(!Array.isArray(e))return e;b={...b,data:e}}return b},async getById(e){const{data:a,error:t}=await c().select(i||"*").eq("id",e).maybeSingle();if(t)throw new Error(`Error fetching ${n}: ${t.message}`);return a},async create(e){const a=_o(e),t=Object.entries(a).reduce((e,[a,t])=>(void 0!==t&&(e[a]=t),e),{}),{data:r,error:o}=await c().insert(t).select().single();if(o)throw new Error(`Error creating ${n}: ${o.message}`);if(!r)throw new Error(`No data returned from create ${n} operation`);return r},async update(e,a){const t={..._o(a),updated_at:(new Date).toISOString()},{data:r,error:o}=await c().update(t).eq("id",e).select().single();if(o)throw new Error(`Error updating ${n}: ${o.message}`);if(!r)throw new Error(`No data returned from update ${n} 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 ${n}: ${t.message}`)}};return p}let tl="supabase";function rl(e){tl=e}function nl(){return tl}function ol(){return"supabase"===tl}var il;const sl={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};class ll{static async initialize(){try{const e=ol();if(e){if(Rs.checkProjectMismatch())return{...sl}}if(!Rs.hasAllTokens()||!Rs.areAllTokensValid())return Rs.clearExpiredTokens(),{...sl};const a=Rs.getAccessToken(),t=Rs.getIdToken();Rs.clearManualLogout();const r=this.extractUserFromIdToken(t,a),n=this.extractCompaniesFromIdToken(t),o=this.extractAliasFromAccessToken(a),i=e?Rs.extractTokenData():null,s=i?.alias;let l=null;if(s&&n.some(e=>e.alias===s))l=s;else{const e=Rs.getSelectedAlias(),a=e&&n.some(a=>a.alias===e);l=a?e:o||n[0]?.alias||null}if(e&&(!Rs.isSupabaseTokenValid()&&l&&await $s.attemptRegeneration(),!Rs.isSupabaseTokenValid()))return{...sl};let d=null;if(l){const e=Rs.getCompanyId(l),a=n.find(e=>e.alias===l);a&&(d={id:e||a.id,name:a.name,alias:a.alias})}const c=i?.placeId??null,u=i?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:l,companies:n,selectedUnit:d,userId:r?.id||null,userAlias:r?.id||null,placeId:c,placeName:u,activePlaceId:c,activePlaceName:u}}catch(e){return{...sl}}}static async loginDev(){try{const e=Bs(),{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==";Rs.setOAuthState(e);const a=Rs.generateOAuthNonce();Rs.setOAuthNonce(a);const t=`${window.location.origin}/callback`,r=new URL(Xt.oauth.authUrl);r.searchParams.set("client_id",Xt.oauth.clientId),r.searchParams.set("response_type",Xt.oauth.responseType),r.searchParams.set("scope",Xt.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"),n=t("id_token"),o=t("error");if(o)throw new Error(`Erro OAuth: ${o}`);if(r&&n){const e=Rs.getAccessToken();e!==r&&Rs.clearAll()}const i=ol();if(Rs.hasAllTokens()){if(i){Rs.getValidSupabaseToken()||await $s.attemptRegeneration(!0)}return!0}const s=r,l=n;if(!s||!l)throw new Error("Tokens não encontrados na URL de callback");Rs.setAccessToken(s),Rs.setIdToken(l),Rs.clearManualLogout();const d=this.extractAliasFromAccessToken(s);if(d)Rs.setSelectedAlias(d);else{const e=this.extractCompaniesFromIdToken(l);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");Rs.setSelectedAlias(e[0].alias)}if(i){if(!await $s.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return Rs.clearOAuthState(),Rs.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){Rs.setManualLogout(),Rs.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 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,n]=a[e].split("|");r&&n&&t.push({id:"",alias:r.trim(),name:n.trim()})}}}),t}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}}il=ll,$s.setLogoutCallback(()=>{il.logout()});const dl=e=>e?.placeId||null,cl=e=>e?.placeName||null,ul=d(void 0),ml=({children:e})=>{const[t,r]=i({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=Oa()}catch{}const[o,d]=i(!1),c=u(0),p=l(e=>{r(a=>({...a,...e}))},[]),h=l(e=>{r(a=>({...a,isLoading:e}))},[]),f=l(()=>{r({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),g=l(async e=>{if(e.alias===t.alias)return;const a=++c.current;try{const o=Rs.getAccessToken();if(!o)return;const i=ol();let s=null;if(i){const t=await Vs.generateToken(o,e.alias,void 0,!0);if(c.current!==a)return;if(!t)return;Rs.setSupabaseToken(t),s=Rs.extractTokenData()}Rs.setSelectedAlias(e.alias);const l=s?.alias||e.alias,d=s?.companyId||Rs.getCompanyId(e.alias),u={id:d||e.id,name:e.name,alias:l};let m=null,h=null;if(t.user?.id&&l&&d)try{const e=await Hs.fetchActiveUsersMap(l,d);if(c.current!==a)return;const r=e.get(t.user.id);if(r){const e=(e=>({placeId:dl(e),placeName:cl(e)}))(r);m=e.placeId,h=e.placeName}}catch(r){}if(c.current!==a)return;p({alias:l,selectedUnit:u,placeId:m,placeName:h,activePlaceId:m,activePlaceName:h}),n&&await n.clear()}catch(r){}},[p,n,t.user,t.alias]),v=l(async()=>{const e=await ll.processCallback();if(e){const e=await ll.initialize();e&&e.isAuthenticated&&(p({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},[p,n]),b=l(async()=>{await ll.logout(),f(),n&&await n.clear()},[f,n]),x=l(e=>{d(e)},[]),y=l(()=>{},[]),w=l(()=>{n&&n.invalidateQueries()},[n]);m(()=>{if(!t.isAuthenticated)return;let e=!0;const a=setInterval(async()=>{if(e)if(Rs.areAllTokensValid()){if(ol()&&!Rs.isSupabaseTokenValid())try{await $s.attemptRegeneration()||e&&b()}catch(a){e&&b()}}else e&&b()},6e5);return()=>{e=!1,clearInterval(a)}},[t.isAuthenticated,b]),m(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const a=await ll.initialize();if(!e)return;a&&a.isAuthenticated?p({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&&h(!1)}catch(a){e&&(qs.handleError(a),h(!1))}})(),()=>{e=!1}},[p,h,b]);const N=s(()=>({...t,logout:b,processCallback:v,switchUnit:g,availableUnits:t.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:y,refreshData:w}),[t.user,t.companies,t.alias,t.isAuthenticated,t.isLoading,t.selectedUnit,t.userId,t.userAlias,t.placeId,t.placeName,t.activePlaceId,t.activePlaceName,b,v,g,o,x,y,w]);return a(ul.Provider,{value:N,children:e})},pl=()=>{const e=c(ul);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function hl({queryKey:e,service:a,entityName:t,searchFields:r,additionalFilters:n={},onSuccess:o}){const[d,c]=$a(),u=Oa(),{alias:m,userId:p,isAuthenticated:h}=pl(),{t:f}=Ra(),g=l(a=>{const t=`${e}_${a}`,r=d.get(t);return r||(d.get(a)||"")},[d,e]),v=g("search"),b=g("sortField")||Jt.sorting.defaultField,x=g("sortDirection")||Jt.sorting.defaultDirection,y=parseInt(g("page")||"1"),w=parseInt(g("limit")||String(Jt.pagination.defaultPageSize)),N=v,_=s(()=>({search:N,sortField:b,sortDirection:x,page:y,limit:w,...n}),[N,b,x,y,w,n]),k=l(()=>a.getAll(_),[a,_]),S=Ua({queryKey:[e,m,p,_],queryFn:k,enabled:!!m&&h});if(!S)throw new Error(`useCrud: Query initialization failed for "${t}". Ensure QueryClientProvider is configured in your app root.`);const A=ja({mutationFn:a.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(sr.success.created(t)),o?.()},onError:e=>{C.error(`${sr.error.create(t)}: ${e.message}`)}}),E=ja({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(sr.success.updated(t)),o?.()},onError:e=>{C.error(`${sr.error.update(t)}: ${e.message}`)}}),D=ja({mutationFn:a.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),C.success(sr.success.deleted(t))},onError:e=>{C.error(`${sr.error.delete(t)}: ${e.message}`)}}),P=l(a=>{const t={...Object.fromEntries(d)};Object.entries(a).forEach(([a,r])=>{const n=`${e}_${a}`;""===r||0===r?delete t[n]:t[n]=String(r)}),delete t.sortField,delete t.sortDirection,c(t)},[d,c,e]),T=l(e=>{P({search:e,page:1})},[P]),I=l(e=>{P({sortField:e,sortDirection:b===e&&"asc"===x?"desc":"asc",page:1})},[b,x,P]),M=l(e=>{P({page:e})},[P]),R=l(e=>{P({limit:e,page:1})},[P]),z=l(()=>{const a=Object.fromEntries(d),t=`${e}_`,r=Object.fromEntries(Object.entries(a).filter(([e])=>!e.startsWith(t)));c(r)},[c,d,e]),[L,F]=i([]),O=l(e=>{F(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),U=l(()=>{const e=S?.data?.data.map(e=>e.id)||[];F(a=>a.length===e.length?[]:e)},[S?.data?.data]),j=l(()=>{F([])},[]),B=s(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&L.length===e.length},[L,S?.data?.data]),V=ja({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,r)=>{u.invalidateQueries({queryKey:[e]}),C.success(f("bulk_delete_success",`${r.length} ${t}(s) deletado(s) com sucesso`)),j()},onError:e=>{C.error(f("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=l((e,a)=>{const t=a?a(e):e;e.id?E.mutate({id:e.id,data:t}):A.mutate({...t,alias:m})},[m,A,E]);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||Jt.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:E?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:v,sortField:b,sortDirection:x,currentPage:y,itemsPerPage:w,queryKey:e,createEntity:A.mutate,updateEntity:(e,a)=>E.mutate({id:e,data:a}),deleteEntity:D.mutate,save:$,handleSearch:T,handleSort:I,handlePageChange:M,handleItemsPerPageChange:R,clearFilters:z,refetch:S.refetch,selectedIds:L,selectItem:O,selectAll:U,clearSelection:j,isAllSelected:B,bulkDelete:e=>V.mutateAsync(e),isBulkDeleting:V.isPending}}function fl(e){const a=al({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)=>hl({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:r})}}function gl(e){const[a,t]=i(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return m(()=>{const a=window.matchMedia(e);t(a.matches);const r=e=>{t(e.matches)};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),a}function vl(e=768){return gl(`(max-width: ${e-1}px)`)}const bl=n.forwardRef(({className:e,...t},r)=>a("table",{ref:r,className:No("w-full caption-bottom text-[13px] table-fixed",e),...t}));bl.displayName="Table";const xl=n.forwardRef(({className:e,...t},r)=>a("thead",{ref:r,className:No("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));xl.displayName="TableHeader";const yl=n.forwardRef(({className:e,...t},r)=>a("tbody",{ref:r,className:No("[&_tr:last-child]:border-0",e),...t}));yl.displayName="TableBody";const wl=n.forwardRef(({className:e,...t},r)=>a("tfoot",{ref:r,className:No("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));wl.displayName="TableFooter";const Nl=n.forwardRef(({className:e,...t},r)=>a("tr",{ref:r,className:No("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));Nl.displayName="TableRow";const _l=n.forwardRef(({className:e,...t},r)=>a("th",{ref:r,className:No("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}));_l.displayName="TableHead";const Cl=n.forwardRef(({className:e,...t},r)=>a("td",{ref:r,className:No("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));Cl.displayName="TableCell";const kl=n.forwardRef(({className:e,...t},r)=>a("caption",{ref:r,className:No("mt-4 text-sm text-muted-foreground",e),...t}));function Sl({rows:e=5,columns:r=4}){return a("div",{className:"w-full",children:t("div",{className:"rounded-md border",children:[a("div",{className:"border-b bg-muted/50 px-4 py-3",children:a("div",{className:"flex space-x-4",children:Array.from({length:r}).map((e,t)=>a(fs,{className:"h-4 w-24"},t))})}),a("div",{children:Array.from({length:e}).map((e,t)=>a("div",{className:"border-b px-4 py-3 last:border-0",children:a("div",{className:"flex space-x-4",children:Array.from({length:r}).map((e,t)=>a(fs,{className:"h-4 w-20"},t))})},t))})]})})}function Al({count:e=3}){return a("div",{className:"space-y-4",children:Array.from({length:e}).map((e,r)=>t(Io,{children:[t(Mo,{children:[a(fs,{className:"h-4 w-3/4"}),a(fs,{className:"h-3 w-1/2"})]}),a(Lo,{children:t("div",{className:"space-y-2",children:[a(fs,{className:"h-3 w-full"}),a(fs,{className:"h-3 w-2/3"})]})})]},r))})}function El({fields:e=4}){return t("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,r)=>t("div",{className:"space-y-2",children:[a(fs,{className:"h-4 w-24"}),a(fs,{className:"h-10 w-full"})]},r)),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a(fs,{className:"h-10 w-20"}),a(fs,{className:"h-10 w-20"})]})]})}function Dl(){return t("div",{className:"flex items-center justify-between p-4 border-b",children:[t("div",{className:"flex items-center space-x-3",children:[a(fs,{className:"h-8 w-8 rounded-full"}),a(fs,{className:"h-6 w-32"})]}),t("div",{className:"flex items-center space-x-2",children:[a(fs,{className:"h-8 w-8"}),a(fs,{className:"h-8 w-24"})]})]})}function Pl(){return a("div",{className:"w-64 border-r bg-muted/10",children:t("div",{className:"p-4",children:[a(fs,{className:"h-8 w-32 mb-6"}),a("div",{className:"space-y-2",children:Array.from({length:6}).map((e,r)=>t("div",{className:"flex items-center space-x-3 p-2",children:[a(fs,{className:"h-4 w-4"}),a(fs,{className:"h-4 w-20"})]},r))})]})})}kl.displayName="TableCaption";const Tl={default:V,search:B,error:j};function Il({icon:e,title:r,description:n,action:o,className:i,variant:s="default"}){const{t:l}=Ra(),d=!!e,c=Tl[s];return t("div",{className:No("flex flex-col items-center justify-center py-12 px-4 text-center",i),children:[a("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:d?e:a(c,{className:"h-8 w-8 text-muted-foreground"})}),a("h3",{className:"text-lg font-semibold mb-2",children:r}),n&&a("p",{className:"text-muted-foreground mb-6 max-w-sm",children:n}),o&&a(Ao,{onClick:o.onClick,variant:"outline",children:o.label})]})}function Ml({children:e,className:r}){const o=n.useRef(null),[i,s]=n.useState(!1);n.useEffect(()=>{const e=()=>{const e=o.current;e&&s(e.scrollWidth>e.clientWidth)};e();const a=new ResizeObserver(e);return o.current&&a.observe(o.current),()=>a.disconnect()},[e]);const l=a("div",{ref:o,className:`truncate w-full max-w-full ${r||""}`,children:e});return i?a(Ji,{delayDuration:300,children:t(Zi,{children:[a(es,{asChild:!0,children:l}),a(as,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):l}const Rl=n.forwardRef(({direction:e,onMouseDown:t,isDragging:r,className:n},o)=>{const i="horizontal"===e;return a("div",{ref:o,onMouseDown:t,className:No("absolute z-20 select-none touch-none","transition-colors duration-150",i&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!i&&["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",n),children:a("div",{className:No("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",i?"h-6 w-0.5":"w-6 h-0.5")})})});Rl.displayName="TableResizeHandle";const zl=Ya.Root,Ll=Ya.Trigger,Fl=Ya.Group,Ol=Ya.Portal,Ul=Ya.Sub,jl=Ya.RadioGroup,Bl=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ya.SubTrigger,{ref:i,className:No("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",r&&"pl-8",e),...o,children:[n,a(O,{className:"ml-auto h-4 w-4"})]}));Bl.displayName=Ya.SubTrigger.displayName;const Vl=n.forwardRef(({className:e,...t},r)=>a(Ya.SubContent,{ref:r,className:No("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}));Vl.displayName=Ya.SubContent.displayName;const $l=n.forwardRef(({className:e,...t},r)=>a(Ya.Portal,{children:a(Ya.Content,{ref:r,className:No("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})}));$l.displayName=Ya.Content.displayName;const ql=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ya.Item,{ref:n,className:No("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}));ql.displayName=Ya.Item.displayName;const Wl=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ya.CheckboxItem,{ref:i,className:No("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:n,...o,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(Ya.ItemIndicator,{children:a(T,{className:"h-4 w-4"})})}),r]}));Wl.displayName=Ya.CheckboxItem.displayName;const Hl=n.forwardRef(({className:e,children:r,...n},o)=>t(Ya.RadioItem,{ref:o,className:No("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(Ya.ItemIndicator,{children:a(U,{className:"h-2 w-2 fill-current"})})}),r]}));Hl.displayName=Ya.RadioItem.displayName;const Gl=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ya.Label,{ref:n,className:No("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));Gl.displayName=Ya.Label.displayName;const Kl=n.forwardRef(({className:e,...t},r)=>a(Ya.Separator,{ref:r,className:No("-mx-1 my-1 h-px bg-border",e),...t}));Kl.displayName=Ya.Separator.displayName;const Yl=({className:e,...t})=>a("span",{className:No("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Yl.displayName="ContextMenuShortcut";const Ql=({onEdit:e,onDelete:n,onToggleStatus:o,isActive:i=!0,canDelete:s=!0,customActions:l=[],renderAs:d})=>{const{t:c}=Ra(),u=[];if(e){const a={icon:$,label:c("edit"),onClick:e};u.push(a)}if(l.forEach(e=>{u.push(e)}),o){const e={icon:i?q:W,label:i?"Inativar":"Ativar",onClick:o};u.push(e)}if(s&&n){const e={icon:H,label:c("ap_delete"),onClick:n,destructive:!0};u.push(e)}const m="dropdown"===d?Hi:ql;return a(r,{children:u.map((e,r)=>t(m,{onClick:e.onClick,className:No("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[a(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},r))})},Xl=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>t(Fi,{children:[a(Oi,{asChild:!0,children:a(Ao,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a(A,{size:12})})}),a(Wi,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a(Ql,{onEdit:e?a=>{a?.stopPropagation(),e?.()}:void 0,onDelete:r?e=>{e?.stopPropagation(),r?.()}:void 0,onToggleStatus:o?e=>{e?.stopPropagation(),o?.()}:void 0,isActive:i,canDelete:n&&!!r,customActions:s,renderAs:"dropdown"})})]}),Jl=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>{const{t:l}=Ra();return a(Ji,{delayDuration:200,children:t("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a(G,{size:14})})}),a(as,{children:l("edit")})]}),s.map((e,r)=>{const n=e.icon;return t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a(n,{size:14})})}),a(as,{children:e.label})]},r)}),o&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),o()},children:a(i?K:Y,{size:14})})}),a(as,{children:i?"Inativar":"Ativar"})]}),r&&n&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:No("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),r()},children:a(H,{size:14})})}),a(as,{children:l("ap_delete")})]})]})})},Zl=150;function ed({columns:e,storageKey:a,onResize:t,enabled:r=!0}){const[n,o]=i(()=>{if(!r||"undefined"==typeof window)return e.reduce((e,a)=>(e[a.key]=a.defaultWidth??Zl,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??Zl,e),{})}),[s,d]=i(!1),[c,p]=i(null),h=u(0),f=u(0),g=l((e,a)=>{r&&(a.preventDefault(),a.stopPropagation(),d(!0),p(e),h.current=a.clientX,f.current=n[e]??Zl)},[r,n]);m(()=>{if(!s||!c)return;const r=e.find(e=>e.key===c),n=r?.minWidth??60,i=r?.maxWidth??500,l=e=>{const a=e.clientX-h.current,r=Math.max(n,Math.min(i,f.current+a));o(e=>{const a={...e,[c]:r};return t?.(a),a})},u=()=>{d(!1),p(null),a&&o(e=>(localStorage.setItem(a,JSON.stringify(e)),e))};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[s,c,e,a,t]),m(()=>(s?(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=""}),[s]);const v=l(()=>{const r=e.reduce((e,a)=>(e[a.key]=a.defaultWidth??Zl,e),{});o(r),a&&localStorage.removeItem(a),t?.(r)},[e,a,t]);return{columnWidths:n,isDragging:s,activeColumn:c,handleMouseDown:g,resetWidths:v}}const ad=v("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"}}),td=n.forwardRef(({className:e,variant:t,size:r,...n},o)=>a(Xa.Root,{ref:o,className:No(ad({variant:t,size:r,className:e})),...n}));td.displayName=Xa.Root.displayName;const rd=n.createContext({size:"default",variant:"default"}),nd=n.forwardRef(({className:e,variant:t,size:r,children:n,...o},i)=>a(Qa.Root,{ref:i,className:No("flex items-center justify-center gap-1",e),...o,children:a(rd.Provider,{value:{variant:t,size:r},children:n})}));nd.displayName=Qa.Root.displayName;const od=n.forwardRef(({className:e,children:t,variant:r,size:o,...i},s)=>{const l=n.useContext(rd);return a(Qa.Item,{ref:s,className:No(ad({variant:l.variant||r,size:l.size||o}),e),...i,children:t})});od.displayName=Qa.Item.displayName;const id=p(function({onNew:e,newButtonLabel:r,showNewButton:n=!0,showSearch:o=!1,searchValue:i="",onSearchChange:s,searchPlaceholder:l,showBulkActions:d=!1,selectedCount:c=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:f,viewMode:g,onViewModeChange:v,showViewToggle:b=!1,availableViewModes:x=["table","list","grid"],rightSlot:y,className:w}){const{t:N}=Ra(),_=c>0,C=e&&n||h.length>0,k=f||b||y,S=o&&s;return C||S||k||d&&_?t("div",{className:No("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",w),children:[t("div",{className:"flex items-center gap-2 shrink-0",children:[e&&n&&t(Ao,{onClick:e,children:[a(Q,{size:16,className:"mr-2"}),r||"Novo"]}),h.map((e,r)=>{const n=e.icon;return t(Ao,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[n&&a(n,{size:16,className:"mr-2"}),e.label]},r)})]}),d&&_&&t("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[a(Ii,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),t(Ji,{delayDuration:200,children:[u.length>0?u.map((e,r)=>{const n=e.icon,o=e.disabled;return t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:No("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:o,onClick:()=>e.action([]),children:n?a(n,{size:16}):a("span",{className:"text-xs",children:e.label[0]})})}),a(as,{children:e.label})]},r)}):t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a(H,{size:16})})}),a(as,{children:N("ap_delete")})]}),t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a(E,{size:16})})}),a(as,{children:N("clear_selection")})]})]})]}),S&&a("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t("div",{className:"relative w-full",children:[a(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(Do,{type:"text",placeholder:l||"Pesquisar",value:i,onChange:e=>s?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[f,b&&g&&v&&a(nd,{type:"single",value:g,onValueChange:e=>e&&v(e),size:"sm",children:x.map(e=>{const t=(e=>{switch(e){case"table":return Z;case"list":return J;case"grid":return X}})(e);return a(od,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a(t,{className:"h-4 w-4"})},e)})}),y]})]}):null}),sd=p(({checked:e,onCheckedChange:t})=>a(Di,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function ld(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 dd({columns:e,storageKey:a,enabled:t=!0,defaultHiddenColumns:r}){const n=s(()=>e.map(e=>String(e.key)),[e]),o=s(()=>new Set(r??[]),[r]),[d,c]=i(()=>{if(!t)return o;if(!a)return o;const e=ld(a);return e?.hiddenColumns??o}),[u,p]=i(()=>{if(!t||!a)return n;const e=ld(a)?.columnOrder;return e&&e.length>0?e:n}),[h,f]=i(()=>t&&a?ld(a)?.groupByColumns??[]:[]),[g,v]=i(new Set);m(()=>{t&&a&&function(e,a){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,groupByColumns:a.groupByColumns}))}catch{}}(a,{hiddenColumns:d,columnOrder:u,groupByColumns:h})},[d,u,h,a,t]),m(()=>{const a=new Set(e.map(e=>String(e.key))),t=new Set(u),r=[...a].filter(e=>!t.has(e));r.length>0&&p(e=>[...e.filter(e=>a.has(e)),...r])},[e]);const b=l(e=>d.has(e),[d]),x=l(e=>{c(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),y=l(()=>{c(new Set)},[]),w=l(()=>{if(c(o),p(n),f([]),v(new Set),a)try{localStorage.removeItem(a)}catch{}},[n,o,a]),N=l((e,a)=>{p(t=>{const r=[...t],[n]=r.splice(e,1);return r.splice(a,0,n),r})},[]),_=l(e=>{v(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[]),C=l(e=>{f(e),v(new Set)},[]),k=l(e=>{f(a=>a.includes(e)?a:[...a,e])},[]),S=l(e=>{f(a=>a.filter(a=>a!==e)),v(a=>{const t=new Set;for(const r of a)r.includes(`${e}:`)||t.add(r);return t})},[]),A=l((e,a)=>{f(t=>{const r=[...t],[n]=r.splice(e,1);return r.splice(a,0,n),r}),v(new Set)},[]),E=h[0]??null,D=l(e=>{f(e?[e]:[]),v(new Set)},[]),P=s(()=>{if(!t)return e;const a=new Map(e.map(e=>[String(e.key),e]));return u.filter(e=>!d.has(e)&&a.has(e)).map(e=>a.get(e))},[e,u,d,t]),T=l(e=>{if(0===h.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(a,t,r,n){if(0===t.length)return[{groupKey:n||"__leaf__",groupValue:"",items:a,count:a.length,level:r}];const[o,...i]=t,s=new Map;for(const l of a){const e=String(l[o]??"(vazio)");s.has(e)||s.set(e,[]),s.get(e).push(l)}return Array.from(s.entries()).map(([a,t])=>{const s=n?`${n}|${o}:${a}`:`${o}:${a}`,l=i.length>0?e(t,i,r+1,s):void 0;return{groupKey:s,groupValue:a,items:t,count:t.length,level:r,children:l}})}(e,h,0,"")},[h]);return{visibleColumns:P,allColumns:e,isColumnHidden:b,toggleColumn:x,showAllColumns:y,resetColumns:w,columnOrder:u,reorderColumns:N,groupByColumn:E,setGroupByColumn:D,groupByColumns:h,setGroupByColumns:C,addGroupByColumn:k,removeGroupByColumn:S,reorderGroupByColumns:A,getGroupedData:T,collapsedGroups:g,toggleGroupCollapse:_}}function cd({enabled:e=!1,onReorder:a}){const[t,r]=i(null),[n,o]=i(null),d=l(()=>{r(null),o(null)},[]),c=l((n,i)=>({draggable:e,onDragStart:a=>{e&&(r(n),a.dataTransfer.effectAllowed="copyMove",a.dataTransfer.setData("text/plain",String(n)),i&&a.dataTransfer.setData("application/column-key",i))},onDragOver:a=>{e&&null!==t&&(a.preventDefault(),a.dataTransfer.dropEffect="move")},onDragEnter:a=>{e&&null!==t&&(a.preventDefault(),o(n))},onDrop:r=>{r.preventDefault(),e&&null!==t&&t!==n?(a(t,n),d()):d()},onDragEnd:()=>{d()}}),[e,t,a,d]);return s(()=>({dragFromIndex:t,dragOverIndex:n,isDragging:null!==t,getDragProps:c}),[t,n,c])}function ud({columns:e,columnOrder:r,isColumnHidden:n,toggleColumn:o,showAllColumns:s,reorderColumns:l,groupByColumn:d,setGroupByColumn:c,groupByColumns:m=[],addGroupByColumn:p,removeGroupByColumn:h,resetColumns:f}){const{t:g}=Ra(),[v,b]=i(null),[x,y]=i(null),w=u(null),N=new Map(e.map(e=>[String(e.key),e])),_=r.filter(e=>N.has(e)).map(e=>N.get(e)),C=()=>{w.current=null,b(null),y(null)};_.some(e=>n(String(e.key)));const k=_.every(e=>!n(String(e.key)));return t(rs,{children:[a(ns,{asChild:!0,children:a(Ao,{variant:"outline",size:"icon",className:"h-8 w-8",children:a(ee,{size:16})})}),t(os,{className:"w-[260px] p-0",align:"end",children:[a("div",{className:"px-3 py-2 border-b",children:a("span",{className:"text-sm font-medium",children:"Colunas"})}),a("div",{className:"max-h-[300px] overflow-auto py-1",children:a(Ji,{delayDuration:300,children:_.map((e,r)=>{const i=String(e.key),s=n(i),u=!1!==e.hideable,f=!0===e.groupable,N=m.includes(i)||d===i;return t("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,b(e)})(r),onDragOver:e=>((e,a)=>{e.preventDefault(),y(a)})(e,r),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&l(w.current,e),w.current=null,b(null),y(null)})(r),onDragEnd:C,className:No("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",v===r&&"opacity-50",x===r&&"border-t-2 border-primary"),children:[a(ae,{size:14,className:"text-muted-foreground shrink-0"}),a(Di,{checked:!s,onCheckedChange:()=>u&&o(i),disabled:!u,className:"shrink-0"}),a("span",{className:No("flex-1 truncate",s&&"text-muted-foreground"),children:e.header}),f&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:No("h-6 w-6 shrink-0",N&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),N?h?h(i):c?.(null):p?p(i):c?.(i)},children:a(te,{size:14})})}),a(as,{children:g(N?"remove_grouping":"group_by_column")})]})]},i)})})}),t("div",{className:"border-t px-3 py-2 space-y-1",children:[a(Ao,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:k?()=>_.filter(e=>!1!==e.hideable).forEach(e=>o(String(e.key))):s,children:g(k?"deselect_all":"select_all_columns")}),f&&a(Ao,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:f,children:"Redefinir padrão"})]})]})]})}function md({columns:e,groupByColumns:r,addGroupByColumn:n,removeGroupByColumn:s,reorderGroupByColumns:l}){const[d,c]=i(!1),[u,m]=i(null),[p,h]=i(null),f=new Map(e.map(e=>[String(e.key),e])),g=()=>{m(null),h(null)},v=r.length>0;return t("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",c(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},onDrop:e=>{e.preventDefault(),c(!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=f.get(a);e&&e.groupable&&n(a)}},className:No("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",d&&"bg-primary/5 border-primary/30",!v&&"text-muted-foreground"),children:[a(te,{size:14,className:"shrink-0 text-muted-foreground"}),a("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:v?r.map((e,r)=>{const n=f.get(e);if(!n)return null;const i=u===r,d=p===r&&u!==r;return t(o.Fragment,{children:[r>0&&a("span",{className:"text-xs text-muted-foreground",children:"›"}),t(Ii,{variant:"secondary",className:No("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",d&&"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",m(a)})(e,r),onDragOver:e=>((e,a)=>{e.preventDefault(),e.stopPropagation(),h(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||l(e,a)}m(null),h(null)})(e,r),onDragEnd:g,children:[n.header,a("button",{onClick:a=>{a.stopPropagation(),s(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:a(E,{size:12})})]})]},e)}):a("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const pd=({manager:r,columns:n,onEdit:d,onView:c,onToggleStatus:u,onDelete:p,renderActions:h,customRowActions:f,enableBulkActions:g=!1,rowActionsVariant:v="dropdown",onNew:b,newButtonLabel:x,showNewButton:y=!0,customActions:w=[],hideActionBar:N,showActionBar:_=!0,showSearch:C=!1,searchValue:k,onSearchChange:S,searchPlaceholder:A,bulkActions:E=[],onBulkDelete:P,filters:T,viewMode:I,onViewModeChange:M,showViewToggle:R=!1,enableColumnResize:z=!0,resizeStorageKey:L,enableColumnManager:F=!0,columnManagerStorageKey:U,defaultHiddenColumns:j,enableGrouping:B=!1,enableExpandableRows:V=!1,renderExpandedContent:$,expandedRowIds:q,onToggleExpand:W,defaultExpandAll:H=!1,hideActionsColumn:G=!1})=>{const{t:K}=Ra(),{setSearchVisible:Y}=pl(),Q=vl(),[X,J]=i(()=>H&&V?new Set(r.entities.map(e=>e.id)):new Set),Z=void 0!==q,ee=Z?new Set(q):X,ae=l(e=>{Z&&W?W(e):J(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[Z,W]),te=void 0!==N?!N:_;m(()=>{if(!C)return Y(!0),()=>Y(!1)},[Y,C]);const oe=dd({columns:n,storageKey:U,enabled:F,defaultHiddenColumns:j}),ie=cd({enabled:F,onReorder:oe.reorderColumns}),se=F?oe.visibleColumns:n,{columnWidths:le,isDragging:de,activeColumn:ce,handleMouseDown:ue}=ed({columns:se.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:L?`${L}-columns`:void 0,enabled:z}),me=s(()=>(()=>{if(z){const e=se.map(e=>le[String(e.key)]??e.width??e.minWidth??150),a=e.reduce((e,a)=>e+a,0);return se.map((t,r)=>({...t,calculatedWidth:e[r],style:{width:e[r]/a*100+"%"}}))}let e=0;const a=se.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`}})})(),[se,z,le]),pe=b||w.length>0||C||g||T||R||F,he=te&&pe,fe=P||(()=>{r.bulkDelete?.(r.selectedIds)}),ge=e=>a(Cl,{className:"text-center",children:h?h(e):"inline"===v?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a(Jl,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})}):a(Xl,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})}),ve=e=>a($l,{className:"w-[160px]",children:a(Ql,{onEdit:d?()=>d(e):void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,canDelete:!!p,customActions:f?f(e):[],renderAs:"context"})}),be=F?a(ud,{columns:n,columnOrder:oe.columnOrder,isColumnHidden:oe.isColumnHidden,toggleColumn:oe.toggleColumn,showAllColumns:oe.showAllColumns,resetColumns:oe.resetColumns,reorderColumns:oe.reorderColumns,groupByColumn:B?oe.groupByColumn:void 0,setGroupByColumn:B?oe.setGroupByColumn:void 0,groupByColumns:B?oe.groupByColumns:void 0,addGroupByColumn:B?oe.addGroupByColumn:void 0,removeGroupByColumn:B?oe.removeGroupByColumn:void 0}):void 0;if(Q)return r.isLoading?a(Al,{count:3}):0===r.entities.length?a(Il,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t("div",{className:"flex flex-col h-full",children:[he&&a(id,{onNew:b,newButtonLabel:x,showNewButton:y,showSearch:C,searchValue:k,onSearchChange:S,searchPlaceholder:A,showBulkActions:g,selectedCount:r.selectedIds.length,bulkActions:E,onBulkDelete:fe,onClearSelection:r.clearSelection,customActions:w,filters:T,viewMode:I,onViewModeChange:M,showViewToggle:R}),a("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>t(zl,{children:[a(Ll,{asChild:!0,children:a(Io,{className:No("overflow-hidden cursor-pointer hover:bg-muted/50",g&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),g?r.selectItem(e.id):d?.(e)},children:a(Lo,{className:"p-4",children:t("div",{className:"flex items-start gap-3",children:[g&&a("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a(sd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t("div",{className:"flex-1",children:[se.map(r=>t("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key))),(d||c||h)&&a("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:h?h(e):a(Xl,{onEdit:d?()=>{d(e)}:void 0,onDelete:p?()=>p(e):void 0,onToggleStatus:u?()=>u(e):void 0,isActive:e.is_actived,customActions:f?f(e):[]})})]})]})})})}),ve(e)]},e.id))})]});const xe=B&&oe.groupByColumns.length>0?oe.getGroupedData(r.entities):null,ye=null!==xe,we=(V?1:0)+(g?1:0)+se.length+(G?0:1),Ne=e=>{const n=V&&ee.has(e.id);return t(o.Fragment,{children:[t(zl,{children:[a(Ll,{asChild:!0,children:t(Nl,{className:No("cursor-pointer hover:bg-muted/50 relative",("inline"===v||G)&&"group",g&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:a=>{a.stopPropagation(),g?r.selectItem(e.id):d?.(e)},children:[V&&a(Cl,{className:"w-[40px] px-2",children:a("button",{onClick:a=>{a.stopPropagation(),ae(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":K(n?"collapse_row":"expand_row"),children:a(n?D:O,{size:16,className:"text-muted-foreground"})})}),g&&a(Cl,{onClick:e=>e.stopPropagation(),children:a(sd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),se.map(t=>a(Cl,{className:t.className,children:a(Ml,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!G&&ge(e)]})}),ve(e)]}),n&&$&&a(Nl,{className:"bg-muted/30 hover:bg-muted/30",children:a(Cl,{colSpan:we,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:$(e)})})})]},e.id)},_e=(e,r)=>{const{t:n}=Ra();return e.map(e=>{const n=oe.collapsedGroups.has(e.groupKey),i=16*e.level,s=Math.max(30,70-15*e.level);return t(o.Fragment,{children:[a(Nl,{className:No("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${s}%)`},onClick:()=>oe.toggleGroupCollapse(e.groupKey),children:a(Cl,{colSpan:r,className:"py-2 px-4",children:t("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${i}px`},children:[a(n?O:D,{size:16}),a("span",{children:e.groupValue}),t("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!n&&(e.children?_e(e.children,r):e.items.map(Ne))]},e.groupKey)})};return t("div",{className:"flex flex-col h-full",children:[he&&a(id,{onNew:b,newButtonLabel:x,showNewButton:y,showSearch:C,searchValue:k,onSearchChange:S,searchPlaceholder:A,showBulkActions:g,selectedCount:r.selectedIds.length,bulkActions:E,onBulkDelete:fe,onClearSelection:r.clearSelection,customActions:w,filters:T,viewMode:I,onViewModeChange:M,showViewToggle:R}),r.isLoading?a(Sl,{rows:5,columns:se.length}):t("div",{className:"flex flex-col h-full overflow-hidden",children:[B&&a(md,{columns:n,groupByColumns:oe.groupByColumns,addGroupByColumn:oe.addGroupByColumn,removeGroupByColumn:oe.removeGroupByColumn,reorderGroupByColumns:oe.reorderGroupByColumns}),a("div",{className:"flex-1 overflow-auto",children:t(bl,{className:"table-fixed w-full",children:[t("colgroup",{children:[V&&a("col",{style:{width:"40px"}}),g&&a("col",{style:{width:"50px"}}),me.map((e,t)=>a("col",{style:e.style},t)),!G&&a("col",{style:{width:"inline"===v?"auto":"50px",minWidth:"50px"}})]}),a(xl,{children:t(Nl,{children:[V&&a(_l,{className:"w-[40px]"}),g&&a(_l,{className:"w-[50px]",children:a(sd,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),se.map((e,n)=>{const o=z&&!1!==e.resizable,i=ce===String(e.key),s=F?ie.getDragProps(n,String(e.key)):{},l=ie.dragFromIndex===n,d=ie.dragOverIndex===n&&ie.dragFromIndex!==n;return t(_l,{className:No(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",F&&ie.isDragging&&"cursor-grabbing",l&&"opacity-50",d&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...s,children:[t("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(re,{size:14,className:"ml-1"}):a(ne,{size:14,className:"ml-1"}))]}),o&&a(Rl,{direction:"horizontal",onMouseDown:a=>ue(String(e.key),a),isDragging:i})]},String(e.key));var c}),!G&&a(_l,{className:"w-[50px] text-center",children:be||e.t("actions")})]})}),a(yl,{children:0===r.entities.length?a(Nl,{children:a(Cl,{colSpan:we,className:"h-32",children:a(Il,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):ye?_e(xe,we):r.entities.map(Ne)})]})})]})]})};function hd(e,a,t,r){const[n,o]=i({}),[l,d]=i({}),c=s(()=>e,[e]),u=e=>e instanceof Date&&!isNaN(e.getTime()),p=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{}}},h=(e,a)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(a)}catch(t){return p(e)}},f=(e,a,t)=>{if(e.required&&(""===a||null==a||Array.isArray(a)&&0===a.length))return`${e.label} é obrigatório`;if(e.validation){let n;if("function"==typeof e.validation?n=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(n=e.validation.custom),n)try{const e=n(a,t);if(e)return e}catch(r){}}};m(()=>{if(!r)return;const e=a=>{const t=[];return a.forEach(a=>{t.push(a),a.fields&&t.push(...e(a.fields))}),t},n=e(c),i={};n.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);u(e)&&(t=e.toISOString().split("T")[0])}else u(t)&&(t=t.toISOString().split("T")[0])}else t=p(e);i[e.name]=t}),n.forEach(e=>{const a=h(e,i);void 0!==a&&(i[e.name]=a)}),a&&Object.keys(a).forEach(e=>{n.find(a=>a.name===e)||void 0===a[e]||(i[e]=a[e])}),o(i),d({}),t&&t(i)},[c,a,t,r]);const g=e=>{const a=[];return e.forEach(e=>{a.push(e),e.fields&&a.push(...g(e.fields))}),a},v=()=>{const e=g(c),a={};return e.forEach(e=>{const t=f(e,n[e.name],n);t&&(a[e.name]=t)}),d(a),0===Object.keys(a).length};return{formData:n,errors:l,updateField:(e,a)=>{o(r=>{const n={...r,[e]:a},o=((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(c).filter(a=>a.dependsOn===e).forEach(e=>{const a=h(e,t);void 0!==a&&(t={...t,[e.name]:a})}),t})(e,n);return t&&t(o),o}),l[e]&&d(a=>{const t={...a};return delete t[e],t});const r=g(c).find(a=>a.name===e);if(r){const t=f(r,a,n);t&&d(a=>({...a,[e]:t}))}},validateForm:v,handleSubmit:e=>a=>{a&&(a.preventDefault(),a.stopPropagation()),v()&&e(n)}}}const fd=[{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}],gd=[10,22,35,45,55,68,78,87,94].flatMap(e=>fd.map(({hue:a,saturation:t})=>((e,a,t)=>{t/=100;const r=a=>(a+e/30)%12,n=(a/=100)*Math.min(t,1-t),o=e=>{const a=t-n*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`#${o(0)}${o(8)}${o(4)}`})(a,t,e))),vd=({value:e="#3b82f6",onChange:r,label:n,customColorLabel:i,presetColorsLabel:s,showHexValue:l=!0})=>{const{t:d}=Ra(),c=i??d("custom_color"),u=s??d("preset_colors"),[m,p]=o.useState(!1),h=o.useRef([]),f=fd.length,g=o.useMemo(()=>{const a=gd.findIndex(a=>a.toLowerCase()===e.toLowerCase());return a>=0?a:0},[e]),[v,b]=o.useState(g);o.useEffect(()=>{m&&(b(g),requestAnimationFrame(()=>{h.current[g]?.focus()}))},[m,g]);const x=e=>{const a=Math.max(0,Math.min(gd.length-1,e));b(a),h.current[a]?.focus()},y=e=>{r?.(e),p(!1)};return t("div",{className:"space-y-2",children:[n&&a(To,{children:n}),t(rs,{open:m,onOpenChange:p,children:[a(ns,{asChild:!0,children:t(Ao,{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:[t("span",{className:"flex items-center min-w-0",children:[a("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),l&&a("span",{className:"truncate",children:e})]}),a(D,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),a(os,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[g]?.focus()})},children:t("div",{className:"space-y-3",children:[t("div",{children:[a(To,{children:u}),a("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${fd.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),x(v+1);break;case"ArrowLeft":e.preventDefault(),x(v-1);break;case"ArrowDown":e.preventDefault(),x(v+f);break;case"ArrowUp":e.preventDefault(),x(v-f);break;case"Home":e.preventDefault(),x(0);break;case"End":e.preventDefault(),x(gd.length-1);break;case"Enter":e.preventDefault(),y(gd[v]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:gd.map((t,r)=>{const n=t.toLowerCase()===e.toLowerCase();return a("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===v?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 "+(n?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:t},onClick:()=>y(t),"aria-label":`Selecionar cor ${t}`},`${t}-${r}`)})})]}),t("div",{children:[a(To,{htmlFor:"color-input",children:c}),a(Do,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},bd=n.forwardRef(({className:e,children:r,...n},o)=>t(Ja.Root,{ref:o,className:No("relative overflow-hidden",e),...n,children:[a(Ja.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),a(xd,{}),a(Ja.Corner,{})]}));bd.displayName=Ja.Root.displayName;const xd=n.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a(Ja.ScrollAreaScrollbar,{ref:n,orientation:t,className:No("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(Ja.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));xd.displayName=Ja.ScrollAreaScrollbar.displayName;const yd=[{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 wd({name:e,filled:t,className:r}){return a("span",{className:`material-symbols-outlined ${r??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Nd=({value:e=null,onChange:r,label:n,noIconLabel:o="SEM ÍCONE",color:d="text-foreground/60"})=>{const[c,p]=i(!1),h=u([]),f=e?(g=e,yd.find(e=>e.name===g)):null;var g;const v=s(()=>{if(!e)return 0;const a=yd.findIndex(a=>a.name===e);return a>=0?a:0},[e]),[b,x]=i(v);m(()=>{c&&(x(v),requestAnimationFrame(()=>{h.current[v]?.focus()}))},[c,v]);const y=l(e=>{const a=Math.max(0,Math.min(yd.length-1,e));x(a),h.current[a]?.focus()},[]),w=l(e=>{r?.(e),p(!1)},[r]),N=l(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},[]),_=l(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),y(b+1);break;case"ArrowLeft":e.preventDefault(),y(b-1);break;case"ArrowDown":e.preventDefault(),y(b+10);break;case"ArrowUp":e.preventDefault(),y(b-10);break;case"Home":e.preventDefault(),y(0);break;case"End":e.preventDefault(),y(yd.length-1);break;case"Enter":e.preventDefault(),w(yd[b]?.name??null);break;case"Tab":e.preventDefault(),p(!1)}},[b,y,w]);return t("div",{className:"space-y-2",children:[n&&a(To,{children:n}),t(rs,{open:c,onOpenChange:p,children:[a(ns,{asChild:!0,children:t(Ao,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:N,children:[f?a(wd,{name:f.name,filled:f.filled,className:`text-xl ${d}`}):a("span",{className:"text-muted-foreground text-sm",children:o}),a(D,{className:"ml-auto h-4 w-4 opacity-50"})]})}),a(os,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[v]?.focus()})},children:t("div",{className:"space-y-3",children:[a(bd,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a("div",{className:"grid grid-cols-10 gap-1",onKeyDown:_,role:"grid",children:yd.map((t,r)=>a("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===b?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${d} ${e===t.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>w(t.name),title:t.name,children:a(wd,{name:t.name,filled:t.filled,className:"text-2xl"})},t.name))})}),a("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:()=>w(null),children:o})]})})]})]})},_d=n.forwardRef(({className:e,...t},r)=>a(Za.Root,{className:No("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(Za.Thumb,{className:No("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")})}));_d.displayName=Za.Root.displayName;const Cd=(e={})=>{const{user:a,alias:t}=pl(),{enabled:r=!0,status:n="active"}=e;return Ua({queryKey:["qualiex-users",t,n],queryFn:()=>Hs.getUsers(t,n),enabled:r&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},kd=({value:t,onChange:r,multiple:n=!1,label:o,required:d,placeholder:c,icon:u,maxDisplayedBadges:p,className:h,disabled:f,enabled:g,displayFormat:v="name",customDisplayFn:b,filterFn:x,sortOptions:y=!0,popoverContainer:w,onOpen:N,onClose:_})=>{const{t:C}=Ra(),{data:k=[],isLoading:S,error:A}=Cd({enabled:g}),[E,D]=i(new Map),P=s(()=>t?Array.isArray(t)?t.filter(Boolean):[t].filter(Boolean):[],[t]),T=s(()=>{if(0===P.length||0===k.length)return"";const e=new Set(k.map(e=>e.userId||e.id||""));return P.filter(a=>a&&!e.has(a)&&!E.has(a)).sort().join(",")},[P,k,E]);m(()=>{if(!T)return;const e=T.split(",");let a=!1;const t=Rs.extractTokenData();return t?.alias&&t?.companyId?(Hs.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||D(a=>{const r=new Map(a);for(const n of e){const e=t.find(e=>e.userId===n||e.id===n);e&&r.set(n,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{a=!0}):void 0},[T]);const I=s(()=>x?k.filter(x):k,[k,x]),M=s(()=>{if(0===P.length)return I;const a=new Set(I.map(e=>e.userId||e.id||"")),t=P.filter(e=>e&&!a.has(e));if(0===t.length)return I;const r=t.map(a=>{const t=E.get(a);return t||{userId:a,id:a,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...I,...r]},[I,P,E]),R=l(a=>{let t;if("custom"===v&&b)t=b(a);else{const e=a.userName||"";switch(v){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},[v,b]);return a(bs,{multiple:n,value:t??(n?[]:""),onChange:r,options:M,isLoading:S,error:A,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:R,placeholder:c||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:C("no_results"),label:o,required:d,icon:u,maxDisplayedBadges:p,disabled:f,className:h,sortOptions:y,popoverContainer:w,onOpen:N,onClose:_})};function Sd({title:e,sections:r,initialData:n,onSubmit:d,onCancel:c,open:m,submitButtonText:p,isLoading:h=!1,usersData:f}){const[g,v]=i(r?.[0]?.id||""),b=u(null),[x,y]=i(null),w=l(e=>{b.current=e,y(e)},[]),N=s(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:_,errors:C,updateField:k,handleSubmit:S}=hd(N,n,void 0,m),A=s(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(_):e.disabled||!1})):[],[r,_]),E=s(()=>{const e=A.find(e=>e.id===g);if(e&&!e.disabled)return g;const a=A.find(e=>!e.disabled);return a?.id||g},[A,g]);o.useEffect(()=>{E!==g&&v(E)},[E,g]);const D=A.find(e=>e.id===E),P=e=>{const r=(e.computedValue,_[e.name]),n=void 0!==r?r:"",o=C[e.name];switch(e.type){case"group":const r="horizontal"===e.layout,i=r?`flex gap-3 w-full ${e.className||""}`:"space-y-3",s=r?No("space-y-2 w-full",e.wrapperClassName):No("space-y-2",e.className,e.wrapperClassName);return t("div",{className:s,children:[e.label,a("div",{className:i,children:e.fields?.map(e=>P(e))})]},e.name);case"user-select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(kd,{value:n||"",onChange:a=>k(e.name,a),placeholder:e.placeholder,disabled:e.disabled,className:o?"border-destructive":""}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"textarea":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Pi,{id:e.name,value:n||"",onChange:a=>{k(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(xi,{value:String(n),onValueChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a(Ni,{className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a(wi,{placeholder:e.placeholder})}),a(ki,{children:e.options?.map(e=>a(Ai,{value:e.value,children:e.label},e.value))})]}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"multiselect":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(bs,{options:e.options||[],value:Array.isArray(n)?n:[],onChange:a=>k(e.name,a),placeholder:e.placeholder,disabled:e.disabled,error:o,popoverContainer:x,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"date":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Do,{id:e.name,type:"date",value:String(n),onChange:a=>k(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:No("w-full",o?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"color":return t("div",{children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Do,{id:e.name,type:"color",value:n||e.defaultValue||"#000000",onChange:a=>k(e.name,a.target.value),className:"h-10"}),o&&a("p",{className:"text-sm text-destructive mt-1",children:o})]},e.name);case"color-picker":return t("div",{children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(vd,{value:n||e.defaultValue||"#3b82f6",onChange:a=>k(e.name,a)}),o&&a("p",{className:"text-sm text-destructive mt-1",children:o})]},e.name);case"icon-picker":return t("div",{children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Nd,{value:n||e.defaultValue||null,onChange:a=>k(e.name,a)}),o&&a("p",{className:"text-sm text-destructive mt-1",children:o})]},e.name);case"custom":if(!e.component)return null;const l=e.component,d="function"==typeof e.componentProps?e.componentProps(_):e.componentProps||{};return t("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(l,{value:n,onChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,error:o,popoverContainer:x,...d}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"number":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Do,{id:e.name,type:"number",value:null!=n?String(n):"",onChange:a=>{const t=a.target.value,r=""===t?null:Number(t);k(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"checkbox":return t("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[a(Di,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),t(To,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name);case"switch":return t("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(_d,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),o&&a("p",{className:"text-sm text-destructive mt-2",children:o})]},e.name);default:return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(To,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Do,{id:e.name,type:"text",value:n||"",onChange:a=>{k(e.name,a.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),o&&a("p",{className:"text-sm text-destructive",children:o})]},e.name)}},T=l(()=>{if(!D)return null;if(D.disabled)return t("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a("div",{className:"rounded-full bg-muted p-3 mb-4",children:a("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),a("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),a("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(D.component){const e=D.component;return a(e,{formData:_,updateField:k,errors:C,users:f,disabled:D.disabled})}return a("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:D.fields.map(P)})},[D,_,k,C,f,P]),I=t("div",{className:"flex flex-col max-h-[80vh]",children:[A.length>1&&a("div",{className:"flex-shrink-0 p-4 border-b",children:a("div",{className:"flex space-x-2",children:A.map(e=>a(Ao,{variant:E===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const a=A.find(a=>a.id===e);a&&!a.disabled&&v(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),a("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:h?a("div",{className:"flex items-center justify-center py-12",children:a("div",{className:"text-muted-foreground",children:"Carregando..."})}):t("form",{onSubmit:S(d),className:"space-y-3 md:space-y-4",children:[T(),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a(Ao,{type:"button",variant:"outline",onClick:c,children:"Cancelar"}),a(Ao,{type:"submit",disabled:h,children:p||"Salvar"})]})]})})]});return a(Qo,{open:m,onOpenChange:e=>{!1===e&&!0===m&&c()},children:t(ti,{ref:w,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t(ri,{showSeparator:!0,children:[a(ii,{children:e}),a(si,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),I]})})}function Ad({currentPage:e,totalPages:n,totalItems:o,itemsPerPage:i,onPageChange:s,onItemsPerPageChange:l,variant:d="full"}){const{t:c}=Ra();if(0===o)return null;const u=(e-1)*i+1,m=Math.min(e*i,o);return t("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[a("div",{className:"flex items-center gap-2",children:"full"===d&&t(r,{children:[a("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:c("rows_per_page","Linhas por página")}),t(xi,{value:String(i),onValueChange:e=>l(Number(e)),children:[a(Ni,{className:"h-8 w-[70px]",children:a(wi,{})}),t(ki,{children:[a(Ai,{value:"10",children:"10"}),a(Ai,{value:"25",children:"25"}),a(Ai,{value:"50",children:"50"}),a(Ai,{value:"100",children:"100"})]})]})]})}),t("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[u,"-",m," ",c("of","de")," ",o," ",c("items","itens")]}),t("div",{className:"flex items-center gap-1",children:[a(Ao,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:1===e,className:"h-8 w-8 p-0",children:a(oe,{size:16})}),a(Ao,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a(ie,{size:16})}),t("div",{className:"flex items-center gap-1 px-2",children:[a("span",{className:"text-sm font-medium",children:e}),a("span",{className:"text-sm text-muted-foreground",children:c("of","de")}),a("span",{className:"text-sm font-medium",children:n})]}),a(Ao,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:e===n,className:"h-8 w-8 p-0",children:a(O,{size:16})}),a(Ao,{variant:"outline",size:"sm",onClick:()=>s(n),disabled:e===n,className:"h-8 w-8 p-0",children:a(se,{size:16})})]})]})}function Ed({manager:e}){return a(Ad,{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 Dd={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Pd={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Td={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Id({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:o="start",wrap:i=!1,className:s}){return a("div",{className:No("flex","column"===t?"flex-col":"flex-row",Dd[r],Pd[n],Td[o],i&&"flex-wrap",s),children:e})}function Md({manager:e,filters:n,inline:o=!1}){const{t:i}=Ra(),{isSearchVisible:s}=pl(),l=e.searchTerm,d=t(r,{children:[n.some(e=>"search"===e.type)&&!s&&t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(Do,{placeholder:"Pesquisar",value:e.searchTerm,onChange:a=>e.handleSearch(a.target.value),className:"pl-10"})]}),n.filter(e=>"select"===e.type&&e.options).map((e,r)=>t(xi,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a(Ni,{className:"w-[180px]",children:a(wi,{placeholder:e.placeholder})}),a(ki,{children:e.options.map(e=>a(Ai,{value:e.value,children:e.label},e.value))})]},`select-${r}`)),n.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return a("div",{className:o?"":"w-full sm:w-auto",children:a(r,{...e.props})},`custom-${t}`)}),l&&t(Ao,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a(E,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return o?a("div",{className:"flex items-center gap-2",children:d}):a(Id,{direction:"column",gap:"md",className:"mb-6",children:a(Id,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:d})})}function Rd({manager:e,config:r,formSections:n,onSave:o,onToggleStatus:s,defaultSort:l}){e&&e.queryKey;const{setSearchVisible:d}=pl(),[c,u]=$a(),[p,h]=i(!1),[f,g]=i(null),[v,b]=i({isOpen:!1,entityId:null,entityName:""}),[x,y]=i({isOpen:!1,count:0});m(()=>(d(!0),()=>{d(!1)}),[d]),m(()=>{if(l&&e){const a=`${e.queryKey}_sortField`,t=`${e.queryKey}_sortDirection`;if(!c.has(a)&&!c.has(t)){const e=Object.fromEntries(c);e[a]=l.column,e[t]=l.direction,u(e)}}},[]);const w=n.length>0?e=>{r.onEdit?r.onEdit(e):(g(e),h(!0))}:void 0,N="function"==typeof e?.deleteEntity?e=>{b({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})}:void 0,_=()=>{b({isOpen:!1,entityId:null,entityName:""})},C=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,k=(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 t("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&a(id,{onNew:()=>{r.onNew?r.onNew():(g(null),h(!0))},newButtonLabel:r.newButtonLabel,showNewButton:C,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{y({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:k,filters:r.filters&&r.filters.length>0?a(Md,{manager:e,filters:r.filters,inline:!0}):void 0}),a("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?a("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):a(pd,{manager:e,columns:r.columns,onEdit:w,onDelete:N,onToggleStatus:s,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("div",{className:"flex-shrink-0 border-t bg-background",children:a(Ed,{manager:e})}),!r.useCustomRouting&&!r.onNew&&n.length>0&&a(Sd,{open:p,title:f?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:n,initialData:f||void 0,onSubmit:e=>{o(e),h(!1),g(null)},onCancel:()=>{h(!1),g(null)},isLoading:e.isLoading,submitButtonText:f?"Atualizar":"Criar"}),a(Qo,{open:v.isOpen,onOpenChange:_,children:t(ti,{size:"sm",variant:"destructive",children:[a(ri,{showSeparator:!0,children:a(ii,{children:"Você tem certeza absoluta?"})}),a("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a("strong",{children:v.entityName}),". Esta ação não pode ser desfeita."]})}),t(oi,{children:[a(Ao,{variant:"outline",onClick:_,children:"Cancelar"}),a(Ao,{variant:"destructive",onClick:()=>{v.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(v.entityId),b({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),a(Qo,{open:x.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),children:t(ti,{size:"sm",variant:"destructive",children:[a(ri,{showSeparator:!0,children:a(ii,{children:"Você tem certeza absoluta?"})}),a("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",a("strong",{children:x.count})," ",1===x.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t(oi,{children:[a(Ao,{variant:"outline",onClick:()=>y({isOpen:!1,count:0}),children:"Cancelar"}),a(Ao,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),y({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function zd(e){return({manager:t})=>{const{manager:r,config:n,onSave:o,onEdit:i,onToggleStatus:s}=e,l=t??r,d={entityName:n.entityName,entityNamePlural:n.entityNamePlural,filters:n.filters||[],columns:n.columns,cardFields:n.cardFields||[],enableBulkActions:n.enableBulkActions??!1,bulkActions:n.bulkActions||[],customActions:n.customActions,customRowActions:n.customRowActions,customListView:n.customListView,onEdit:i||n.onEdit,onNew:n.onNew,useCustomRouting:n.useCustomRouting,hideNewButton:n.hideNewButton,showNewButton:n.showNewButton,newButtonLabel:n.newButtonLabel,showSearch:n.showSearch,searchPlaceholder:n.searchPlaceholder,showActionBar:n.showActionBar};return a(Rd,{manager:l,config:d,formSections:n.formSections,onSave:o,onToggleStatus:s,defaultSort:n.defaultSort})}}function Ld(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)}}}function Fd(e,a,t={}){const r=[];return Object.keys(a).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const t=a[e],n={key:e,header:Ud(e),label:Ud(e),...Od(e,t),sortable:!0,searchable:"string"==typeof t};r.push(n)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...t}}function Od(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 Ud(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const jd=({children:n})=>{const{isAuthenticated:i,isLoading:s}=pl();if(o.useEffect(()=>{if(s)return;if(i)return;if(Rs.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=ar(),n=window.location.pathname+window.location.search+window.location.hash;["/","/login","/callback"].includes(window.location.pathname)||localStorage.setItem("auth_return_url",n);(async()=>{r?await ll.loginDev():ll.loginProd()})()},[i,s]),s&&!i)return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:a(Ro,{className:"text-xl font-semibold",children:"Carregando..."})}),t(Lo,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!i){const r=new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token");return a("div",r?{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:a(Ro,{className:"text-xl font-semibold",children:"Processando..."})}),t(Lo,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}:{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:a(Ro,{className:"text-xl font-semibold",children:"Iniciando..."})}),t(Lo,{className:"text-center",children:[a("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),a("p",{className:"text-muted-foreground",children:ar()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a(r,{children:n})};function Bd(e={}){const{paramName:a="alias"}=e,t=qa(),{alias:r,companies:n}=pl(),o=t[a]||null;return s(()=>{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])}function Vd({children:e,paramName:n="alias"}){const o=Wa(),s=Ha(),d=qa(),{alias:c,isAuthenticated:p,isLoading:h,switchUnit:f}=pl(),{urlAlias:g,isAliasMismatch:v,isValidAlias:b,isMissing:x,matchedCompany:y}=Bd({paramName:n}),[w,N]=i(!1),_=u(!1),C=n in d,k=l(e=>{const a=d[n],{pathname:t,search:r,hash:o}=s;if(a){const n=t.split("/"),i=n.findIndex(e=>e===a);if(i>=0)return n[i]=e,n.join("/")+r+o}return`/${e}${"/"===t?"":t}${r}${o}`},[d,n,s]);return m(()=>{if(C&&!h&&p&&c&&!_.current)if(x)o(k(c),{replace:!0});else if(!g||b){if(v&&y&&!_.current){(async()=>{_.current=!0,N(!0);try{await f(y)}catch(e){c&&o(k(c),{replace:!0})}finally{_.current=!1,N(!1)}})()}}else o(k(c),{replace:!0})},[C,h,p,c,x,g,b,v,y,f,k,o]),h||!p?a(r,{children:e}):w?a("div",{className:"flex items-center justify-center min-h-screen",children:t("div",{className:"flex flex-col items-center gap-3",children:[a(Ri,{size:"lg"}),a("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a(r,{children:e})}function $d(){const{alias:e}=pl(),{pathname:t,search:r,hash:n}=Ha();return e?a(Ga,{to:`/${e}${t}${r}${n}`,replace:!0}):null}const qd=v("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"}}),Wd={info:ce,warning:ce,danger:de,success:le},Hd=n.forwardRef(({className:e,variant:r="info",showIcon:n=!0,children:o,...i},s)=>{const l=Wd[r||"info"];return t("div",{ref:s,role:"alert",className:No(qd({variant:r}),e),...i,children:[n&&a(l,{className:"h-4 w-4"}),o]})});Hd.displayName="Alert";const Gd=n.forwardRef(({className:e,...t},r)=>a("h5",{ref:r,className:No("mb-1 font-medium leading-none tracking-tight",e),...t}));Gd.displayName="AlertTitle";const Kd=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("text-sm [&_p]:leading-relaxed",e),...t}));Kd.displayName="AlertDescription";const Yd=()=>{const{processCallback:e}=pl(),n=Wa(),[o,s]=i(null),[l,d]=i(!1);m(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),n(e||"/",{replace:!0})}else s("Falha na autenticação. Tente novamente.")}catch(a){localStorage.removeItem("auth_return_url"),s(a?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e,n]);const c=async()=>{d(!0),s(null);try{await e()||s("Falha na autenticação. Tente novamente.")}catch(a){s(a?.message||"Erro ao tentar novamente.")}finally{d(!1)}},u=()=>{window.location.href="/"};return a("div",o?{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:t(Ro,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a(j,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t(Lo,{className:"space-y-4",children:[a(Hd,{variant:"danger",children:a(Kd,{children:o})}),a("div",{className:"text-sm text-muted-foreground",children:a("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t("div",{className:"flex gap-2",children:[a(Ao,{onClick:c,disabled:l,className:"flex-1",children:t(r,l?{children:[a(Ri,{size:"sm",className:"mr-2"}),"Tentando..."]}:{children:[a(ue,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a(Ao,{onClick:u,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}:{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:a(Ro,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t(Lo,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(Ri,{size:"lg"})}),a("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},Qd=()=>{const{t:e}=Ra();return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(Io,{className:"w-full max-w-md",children:[a(Mo,{className:"text-center",children:a(Ro,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t(Lo,{className:"text-center space-y-4",children:[a("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a(Ao,{onClick:async()=>{ar()?await ll.loginDev():ll.loginProd()},className:"w-full",size:"lg",children:ar()?e("dev_login"):e("login_with_qualiex")})]})]})})},Xd=d(void 0);function Jd({children:e,actions:t}){const{t:r}=Ra(),[n,o]=i({}),[d,c]=i(t);m(()=>{c(t)},[t]);const u=l(()=>o({}),[]),p=s(()=>({metadata:n,setMetadata:o,clearMetadata:u,headerActions:d,setHeaderActions:c}),[n,u,d]);return a(Xd.Provider,{value:p,children:e})}function Zd(){const e=c(Xd);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}function ec(e){const{setMetadata:a,clearMetadata:t}=Zd(),r=u({});m(()=>{const n=JSON.stringify(r.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(r.current.title!==e.title||r.current.subtitle!==e.subtitle||n)&&(r.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},a(e)),()=>t()},[e.title,e.subtitle,e.breadcrumbs,a,t])}function ac(e){return{queryClient:e.queryClient||new Ba({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}var tc={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..."},rc={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..."},nc={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 oc="true"===import.meta.env.VITE_I18N_DEBUG_MODE;function ic(a,t){e.addResourceBundle(a,"app",t,!0,!0)}oc&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(za).init({resources:{"pt-BR":{core:tc},"en-US":{core:rc},"es-ES":{core:nc}},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:oc?["debugKeys"]:[]});const sc=d(void 0),lc={locale:Jn,timezone:eo,datetimeFormat:Zn},dc=async()=>{},cc=({children:e})=>a(sc.Provider,{value:{...lc,setLocale:dc,setTimezone:dc,setDatetimeFormat:dc,isLoading:!1},children:e}),uc=()=>{const e=c(sc);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},mc=d({moduleAlias:null});function pc({moduleAlias:e=null,children:t}){return a(mc.Provider,{value:{moduleAlias:e},children:t})}function hc(){return c(mc)}const fc=et.Root,gc=et.CollapsibleTrigger,vc=et.CollapsibleContent;class bc extends h{constructor(a){super(a),this.copyErrorDetails=()=>{const a=zs.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),C.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})},this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if(import.meta.env.DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,a){if(import.meta.env.DEV)throw e;zs.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const r=zs.getErrors().slice(0,2);return a("div",{className:"flex items-center justify-center min-h-screen p-4",children:t(Io,{className:"w-full max-w-2xl",children:[t(Mo,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(de,{className:"h-12 w-12 text-destructive"})}),a(Ro,{children:e.t("something_went_wrong")})]}),t(Lo,{className:"space-y-4",children:[a("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t(fc,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a(gc,{asChild:!0,children:t(Ao,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[a(D,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t(vc,{className:"mt-4 space-y-4",children:[t("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t("div",{children:[a("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t("div",{className:"text-sm space-y-2",children:[a("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&a(bd,{className:"h-32 w-full rounded border bg-muted p-2",children:a("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),r.length>0&&t("div",{className:"pt-3 border-t",children:[a("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),a("div",{className:"space-y-2",children:r.map((e,r)=>a("div",{className:"text-sm p-2 rounded bg-muted/50",children:t("div",{className:"flex items-start gap-2",children:[t("span",{className:"font-medium text-muted-foreground shrink-0",children:[r+1,"."]}),t("div",{className:"flex-1 min-w-0",children:[a("div",{className:"flex items-center gap-2 flex-wrap",children:t("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),a("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t(Ao,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a(me,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a(Ao,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const xc=at.Root,yc=n.forwardRef(({className:e,...t},r)=>a(at.List,{ref:r,className:No("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));yc.displayName=at.List.displayName;const wc=n.forwardRef(({className:e,...t},r)=>a(at.Trigger,{ref:r,className:No("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}));wc.displayName=at.Trigger.displayName;const Nc=n.forwardRef(({className:e,...t},r)=>a(at.Content,{ref:r,className:No("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 _c({className:e}){return t("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a("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("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("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 Cc({className:e}){return t("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a("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("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("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"})]})}Nc.displayName=at.Content.displayName;const kc={init(e){!function(e){try{return a=window,t=document,r="clarity",n="script",o=e,void(t.getElementById("clarity-script")||(a[r]=a[r]||function(){(a[r].q=a[r].q||[]).push(arguments)},(i=t.createElement(n)).async=1,i.src="https://www.clarity.ms/tag/"+o+"?ref=npm",i.id="clarity-script",(s=t.getElementsByTagName(n)[0]).parentNode.insertBefore(i,s)))}catch(l){return}var a,t,r,n,o,i,s}(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)}},Sc="forlogic_";function Ac(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Ec(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Dc(e){return Ec()?`${Sc}${e}`:e}function Pc(e){return Ec()?`${Sc}${e}`:e}function Tc(e){try{e()}catch(a){import.meta.env.DEV}}function Ic(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&kc.setTag(Pc(a),t)}function Mc({module:e,isContracted:a,sourceModule:t,alias:r}){Ac()&&Tc(()=>{Ic({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:r}),kc.event(Dc("module_menu_click"))})}function Rc({module:e,sourceModule:a,alias:t}){Ac()&&Tc(()=>{Ic({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),kc.event(Dc("module_interest_click"))})}function zc({resource:e,sourceModule:a,alias:t}){Ac()&&Tc(()=>{Ic({footer_resource:e,source_module:a,alias:t}),kc.event(Dc("module_footer_click"))})}function Lc({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:r="https://sabergestao.com.br/",wikiUrl:n,alias:o,sourceModule:i}){const{t:s}=Ra(),l=wo(e||n||"https://educacao.sabergestao.com.br/{alias}/fe",o),d=e=>{zc({resource:e,sourceModule:i,alias:o})};return t("div",{className:"flex-shrink-0 pt-4",children:[a(Oo,{className:"mb-4"}),t("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-white",children:s("learn_qualiex")}),t("a",{href:l,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(_c,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-foreground",children:s("know_saber_gestao")}),t("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(Cc,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t("div",{className:"relative z-10",children:[a("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t("a",{href:n||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>d("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(pe,{className:"h-3.5 w-3.5"})]})]}),a(he,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const Fc=[{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 Oc({module:e,onClick:r}){return t("button",{type:"button",onClick:r,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[a("div",{className:No("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t("div",{className:"min-w-0",children:[a("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&a("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function Uc(e,a){if(0===e.length)return e;const t=Math.ceil(e.length/a),r=[];for(let n=0;n<t;n++)for(let o=0;o<a;o++){const a=o*t+n;a<e.length&&r.push(e[a])}return r}function jc({modules:e,onModuleClick:r,contractedModules:n,onModuleInterest:o}){const s=function(){const[e,a]=i(4);return m(()=>{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}(),l=[...e].sort((e,a)=>e.name.localeCompare(a.name)),d=void 0!==n,c=d?l.filter(e=>n.includes(e.name)):l,u=d?l.filter(e=>!n.includes(e.name)):[],p=Uc(c,s),h=Uc(u,s),f=(e,a)=>{a?r?.(e):o?.(e)};return t("div",{className:"space-y-6",children:[p.length>0&&a("section",{children:a("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>a(Oc,{module:e,onClick:()=>f(e,!0)},e.name))})}),h.length>0&&t("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[a("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),a("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:h.map(e=>a(Oc,{module:e,onClick:()=>f(e,!1)},e.name))})]})]})}function Bc({onModuleClick:e,contractedModules:r,onModuleInterest:n,nonContractedUrl:o="https://qualiex.com/",educaUrl:s="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:l="https://sabergestao.com.br/",wikiUrl:d,alias:c,sourceModule:u}){const[m,p]=i("qualiex"),h=e=>{Rc({module:e,sourceModule:u,alias:c}),window.open(o,"_blank","noopener,noreferrer"),n?.(e)};return t("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t(xc,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[a(yc,{className:"w-fit shrink-0",children:Fc.map(e=>t(wc,{value:e.id,children:[e.label,t("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),Fc.map(t=>a(Nc,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a(jc,{modules:t.modules,onModuleClick:a=>{return n=a,o=t.id,Mc({module:n,isContracted:"qualiex"!==o||!r||r.includes(n.name),sourceModule:u,alias:c}),void e?.(n);var n,o},contractedModules:"qualiex"===t.id?r:void 0,onModuleInterest:h})},t.id))]}),a(Lc,{educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:c,sourceModule:u})]})}const Vc={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},$c=6e5;function qc(e){const{moduleAlias:a}=hc(),{alias:t,user:r,isAuthenticated:n}=pl(),o=e??a,i=r?.id??null,d=n&&!!t&&!!i,{data:c=[],isLoading:u}=Ua({queryKey:["qualiex-associations",i,t],queryFn:()=>Hs.fetchUserAssociations(i,t),enabled:d,staleTime:$c,gcTime:12e5}),m=s(()=>t&&0!==c.length?c.find(e=>e.companyAlias===t)??null:null,[c,t]),p=l(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=Vc[e];return void 0!==a&&m.softwares.includes(a)})},[m]);return{hasAccess:s(()=>!o||p(o),[o,p]),isLoading:d&&u,role:s(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}function Wc(e){const{association:a}=qc();return s(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,r=Fc.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=Vc[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function Hc({open:e,onOpenChange:r,onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,sourceModule:c}){const{alias:u}=pl(),m=Wc(o);return a(Qo,{open:e,onOpenChange:r,children:t(ti,{size:"lg",className:"overflow-hidden flex flex-col",children:[a(ri,{className:"sr-only",children:a(ii,{children:"Módulos"})}),a(Bc,{onModuleClick:e=>{n?n(e):e.url&&yo(wo(e.url,u||void 0))},contractedModules:m,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:u||void 0,sourceModule:c})]})})}function Gc({open:r,onOpenChange:n,onModuleClick:o,contractedModules:i,onModuleInterest:l,userName:d,unitName:c,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,blocking:b=!0,size:x="lg",children:y,sourceModule:w}){const{t:N}=Ra(),_=s(()=>{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(Qo,{open:r,onOpenChange:b?void 0:n,children:t(ti,{size:x,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:[t("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t("div",{className:"flex flex-col gap-1.5 text-left",children:[a(ii,{children:N("no_access_page")}),a(si,{children:"Selecione um módulo para continuar navegando!"})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t(Fi,{children:[a(Oi,{asChild:!0,children:t(Ao,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a(fe,{className:"h-4 w-4 shrink-0"}),a("span",{className:"truncate text-xs",children:c||"Unidade"}),a(D,{className:"h-3 w-3 shrink-0"})]})}),a(Wi,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t(Hi,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a(fe,{className:"mr-2 h-4 w-4 shrink-0"}),a("span",{className:"truncate",children:e.name}),e.alias===m&&a(Ii,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t(Fi,{children:[a(Oi,{asChild:!0,children:t(Ao,{variant:"ghost",size:"sm",className:"gap-2",children:[a("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:a(ge,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a(D,{className:"h-3 w-3"})]})}),t(Wi,{align:"end",children:[t("div",{className:"px-2 py-1.5",children:[a("p",{className:"text-sm font-medium",children:d||e.t("user")}),a("p",{className:"text-xs text-muted-foreground",children:c})]}),a(Qi,{}),t(Hi,{onClick:h,children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),y?t("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[a("div",{className:"flex-1",children:y}),a(Lc,{educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]}):a(Bc,{onModuleClick:o,contractedModules:i,onModuleInterest:l,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]})})}function Kc(e,a){const{t:t}=Ra();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function Yc({children:e,contractedModules:t,onModuleClick:n,onModuleInterest:o,educaUrl:i="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:d="https://sabergestao.com.br/",wikiUrl:c,bypassPaths:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=Ra(),{hasAccess:f,isLoading:g,association:v}=qc(),{user:b,alias:x,companies:y,isAuthenticated:w,isLoading:N,logout:_,switchUnit:C}=pl(),k=Wc(t),S=s(()=>y?.length?x&&y.find(e=>e.alias===x)||y[0]:null,[y,x]),A=s(()=>y?.length?y.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[y]),E=l(e=>{const a=y?.find(a=>a.alias===e.alias);if(!a)return;const{pathname:t,search:r,hash:n}=window.location;if(x){const e=t.split("/"),o=e.indexOf(x);if(o>=0)return e[o]=a.alias,void(window.location.href=e.join("/")+r+n)}C(a)},[x,C,y]),D=l(e=>{n?n(e):e.url&&yo(wo(e.url,x||void 0))},[n,x]),P=s(()=>{if(!m)return;const e=window.location.pathname,a=Object.keys(m).find(a=>Kc(e,[a]));return a?m[a]:void 0},[m]);return N||!w||u?.length&&Kc(window.location.pathname,u)?a(r,{children:e}):g?a("div",{className:"flex items-center justify-center min-h-screen",children:a(Ri,{size:"lg"})}):f?a(r,{children:e}):a(Gc,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:o,userName:b?.name,unitName:S?.name,units:A,currentAlias:x||void 0,onUnitChange:E,onLogout:_,educaUrl:i,saberGestaoUrl:d,wikiUrl:c,sourceModule:p,blocking:!0,children:P})}function Qc({title:e,description:r,image:n,icon:o,ctaLabel:i,onCtaClick:s,children:l}){const{t:d}=Ra(),c=i??d("want_to_know_more");return t("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!l&&(n||o)&&a("div",{className:"flex items-center justify-center",children:n?a("img",{src:n,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):o?a("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:a(o,{className:"h-12 w-12 text-primary"})}):null}),t("div",{className:"space-y-3 max-w-lg",children:[a("h3",{className:"text-xl font-semibold text-foreground",children:e}),a("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r})]}),l?a("div",{className:"w-full",children:l}):s?t(Ao,{onClick:s,size:"lg",className:"gap-2",children:[a(be,{className:"h-4 w-4"}),c]}):null]})}let Xc=!1;function Jc(){if(Xc||"undefined"==typeof document)return;Xc=!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 Zc({projectId:e,mode:a="auto"}){const{user:t,alias:r,isAuthenticated:n}=pl();m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!ar()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{kc.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(t){import.meta.env.DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,a]),m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&n&&t&&"function"==typeof window.clarity)try{const e=t.email||t.identifier||"anonymous";kc.identify(e,void 0,"modules-menu",t.name||void 0),r&&kc.setTag("alias",r),"boolean"==typeof t.isSysAdmin&&kc.setTag("isSysAdmin",String(t.isSysAdmin))}catch(e){import.meta.env.DEV}},[t,r,n,a])}function eu({children:r,queryClient:n,moduleAlias:i,moduleAccessGuardProps:s,appTranslations:l,clarityProjectId:d,clarityMode:c="auto",backend:u="supabase"}){rl(u),Jc();const[m]=o.useState(()=>new Ba({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),p=n??m;o.useEffect(()=>{if(l)for(const[e,a]of Object.entries(l))ic(e,a)},[l]);const h={sourceModule:i,...s};return t(bc,{children:[a(tu,{}),a(La,{i18n:e,children:a(Va,{client:p,children:t(ml,{children:[a(au,{projectId:d,mode:c}),a(cc,{children:a(pc,{moduleAlias:i,children:a(Yc,{...h,children:r})})})]})})})]})}function au({projectId:e,mode:a}){return Zc({projectId:e,mode:a}),null}function tu(){const e=Ls(import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY),r=!!import.meta.env.VITE_SUPABASE_PK_OVERRIDE;if(!e||r||!import.meta.env.DEV)return null;const n={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t("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("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",a("code",{style:n,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",a("code",{style:n,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const ru=tt.Root,nu=n.forwardRef(({className:e,...t},r)=>a(tt.Item,{ref:r,className:No("border-b",e),...t}));nu.displayName="AccordionItem";const ou=n.forwardRef(({className:e,children:r,...n},o)=>a(tt.Header,{className:"flex",children:t(tt.Trigger,{ref:o,className:No("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[r,a(D,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ou.displayName=tt.Trigger.displayName;const iu=n.forwardRef(({className:e,children:t,...r},n)=>a(tt.Content,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a("div",{className:No("pb-4 pt-0",e),children:t})}));iu.displayName=tt.Content.displayName;const su=n.forwardRef(({className:e,...t},r)=>a(rt.Root,{ref:r,className:No("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));su.displayName=rt.Root.displayName;const lu=n.forwardRef(({className:e,...t},r)=>a(rt.Image,{ref:r,className:No("aspect-square h-full w-full",e),...t}));lu.displayName=rt.Image.displayName;const du=n.forwardRef(({className:e,...t},r)=>a(rt.Fallback,{ref:r,className:No("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));du.displayName=rt.Fallback.displayName;const cu=n.forwardRef(({...e},t)=>a("nav",{ref:t,"aria-label":"breadcrumb",...e}));cu.displayName="Breadcrumb";const uu=n.forwardRef(({className:e,...t},r)=>a("ol",{ref:r,className:No("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));uu.displayName="BreadcrumbList";const mu=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:No("inline-flex items-center gap-1.5",e),...t}));mu.displayName="BreadcrumbItem";const pu=n.forwardRef(({asChild:e,className:t,...r},n)=>a(e?g:"a",{ref:n,className:No("transition-colors hover:text-foreground",t),...r}));pu.displayName="BreadcrumbLink";const hu=n.forwardRef(({className:e,...t},r)=>a("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:No("font-normal text-foreground",e),...t}));hu.displayName="BreadcrumbPage";const fu=({children:e,className:t,...r})=>a("li",{role:"presentation","aria-hidden":"true",className:No("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...r,children:e??a(O,{})});fu.displayName="BreadcrumbSeparator";const gu=({className:e,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:No("flex h-9 w-9 items-center justify-center",e),...r,children:[a(xe,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Mais"})]});gu.displayName="BreadcrumbEllipsis";const vu=v("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"}}),bu=n.forwardRef(({className:e,orientation:t,...r},n)=>a("div",{ref:n,className:No(vu({orientation:t}),e),...r}));function xu({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a(nt,{showOutsideDays:r,className:No("p-3 pointer-events-auto",e),locale:Kn,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:No(So({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:No(So({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:No(So({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})=>a("left"===e?ie:O,{className:"h-4 w-4"})},...n})}bu.displayName="ButtonGroup",xu.displayName="Calendar";const yu={Root:function({children:e,className:t}){return a("div",{className:No("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return a(Io,{className:No("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:a(Lo,{className:"p-4",children:e})})},Field:function({label:e,value:r,className:n}){return t("div",{className:No("flex justify-between items-center text-sm",n),children:[t("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),a("span",{className:"text-foreground",children:r})]})}};function wu({date:e,onDateChange:r,placeholder:n,disabled:o=!1,className:i,disabledDates:s}){const{t:l}=Ra(),d=n??l("select_date");return t(rs,{children:[a(ns,{asChild:!0,children:t(Ao,{variant:"outline",disabled:o,className:No("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",i),children:[a(ye,{className:"mr-2 h-4 w-4"}),e?_(e,"d 'de' MMMM 'de' yyyy",{locale:Kn}):a("span",{children:d})]})}),a(os,{className:"w-auto p-0",align:"start",children:a(xu,{mode:"single",selected:e,onSelect:r,disabled:s,initialFocus:!0,className:"pointer-events-auto"})})]})}const Nu=({shouldScaleBackground:e=!0,...t})=>a(ot.Root,{shouldScaleBackground:e,...t});Nu.displayName="Drawer";const _u=ot.Trigger,Cu=ot.Portal,ku=ot.Close,Su=n.forwardRef(({className:e,...t},r)=>a(ot.Overlay,{ref:r,className:No("fixed inset-0 z-50 bg-black/80",e),...t}));Su.displayName=ot.Overlay.displayName;const Au=n.forwardRef(({className:e,children:r,...n},o)=>t(Cu,{children:[a(Su,{}),t(ot.Content,{ref:o,className:No("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[a("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),r]})]}));Au.displayName="DrawerContent";const Eu=({className:e,...t})=>a("div",{className:No("grid gap-1.5 p-4 text-center sm:text-left",e),...t});Eu.displayName="DrawerHeader";const Du=({className:e,...t})=>a("div",{className:No("mt-auto flex flex-col gap-2 p-4",e),...t});Du.displayName="DrawerFooter";const Pu=n.forwardRef(({className:e,...t},r)=>a(ot.Title,{ref:r,className:No("text-lg font-semibold leading-none tracking-tight",e),...t}));Pu.displayName=ot.Title.displayName;const Tu=n.forwardRef(({className:e,...t},r)=>a(ot.Description,{ref:r,className:No("text-sm text-muted-foreground",e),...t}));Tu.displayName=ot.Description.displayName;const Iu={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))]"},Mu={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Ru({children:e,cols:t="auto-fit",gap:r="md",className:n}){return a("div",{className:No("grid",Iu[t],Mu[r],n),children:e})}const zu=it.Root,Lu=it.Trigger,Fu=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>a(it.Content,{ref:o,align:t,sideOffset:r,className:No("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),...n}));Fu.displayName=it.Content.displayName;const Ou=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-slot":"input-group",className:No("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}));Ou.displayName="InputGroup";const Uu=v("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"}}),ju=n.forwardRef(({className:e,align:t,...r},n)=>a("div",{ref:n,"data-slot":"input-group-addon",className:No(Uu({align:t}),e),...r}));ju.displayName="InputGroupAddon";const Bu=v("",{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"}}),Vu=n.forwardRef(({className:e,size:t,variant:r="ghost",...n},o)=>a(Ao,{ref:o,"data-slot":"input-group-button",variant:r,className:No(Bu({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...n}));Vu.displayName="InputGroupButton";const $u=n.forwardRef(({className:e,...t},r)=>a(Do,{ref:r,"data-slot":"input-group-control",className:No("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));$u.displayName="InputGroupInput";const qu=n.forwardRef(({className:e,...t},r)=>a(Pi,{ref:r,"data-slot":"input-group-control",className:No("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));qu.displayName="InputGroupTextarea";const Wu=n.forwardRef(({className:e,...t},r)=>a("h1",{ref:r,className:No("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));Wu.displayName="H1";const Hu=n.forwardRef(({className:e,...t},r)=>a("h2",{ref:r,className:No("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));Hu.displayName="H2";const Gu=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:No("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));Gu.displayName="H3";const Ku=n.forwardRef(({className:e,...t},r)=>a("h4",{ref:r,className:No("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));Ku.displayName="H4";const Yu=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:No("leading-7 [&:not(:first-child)]:mt-6",e),...t}));Yu.displayName="P";const Qu=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:No("text-xl text-muted-foreground",e),...t}));Qu.displayName="Lead";const Xu=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:No("text-lg font-semibold",e),...t}));Xu.displayName="Large";const Ju=n.forwardRef(({className:e,...t},r)=>a("small",{ref:r,className:No("text-sm font-medium leading-none",e),...t}));Ju.displayName="Small";const Zu=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:No("text-sm text-muted-foreground",e),...t}));Zu.displayName="Muted";const em=n.forwardRef(({className:e,...t},r)=>a("code",{ref:r,className:No("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));em.displayName="InlineCode";const am=n.forwardRef(({className:e,...t},r)=>a("blockquote",{ref:r,className:No("mt-6 border-l-2 pl-6 italic",e),...t}));am.displayName="Blockquote";const tm=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:No("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));tm.displayName="List";const rm=n.forwardRef(({className:e,children:r,...n},o)=>t(st.Root,{ref:o,className:No("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...n,children:[r,a(cm,{})]}));rm.displayName=st.Root.displayName;const nm=n.forwardRef(({className:e,...t},r)=>a(st.List,{ref:r,className:No("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));nm.displayName=st.List.displayName;const om=st.Item,im=v("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"),sm=n.forwardRef(({className:e,children:r,...n},o)=>t(st.Trigger,{ref:o,className:No(im(),"group",e),...n,children:[r," ",a(D,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));sm.displayName=st.Trigger.displayName;const lm=n.forwardRef(({className:e,...t},r)=>a(st.Content,{ref:r,className:No("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}));lm.displayName=st.Content.displayName;const dm=st.Link,cm=n.forwardRef(({className:e,...t},r)=>a("div",{className:No("absolute left-0 top-full flex justify-center"),children:a(st.Viewport,{className:No("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})}));cm.displayName=st.Viewport.displayName;const um=n.forwardRef(({className:e,...t},r)=>a(st.Indicator,{ref:r,className:No("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("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));function mm({items:e,maxItems:n=3,className:o}){const i=e.length>n?[e[0],...e.slice(-(n-1))]:e,s=e.length>n;return a(cu,{className:o,children:a(uu,{children:i.map((e,n)=>{const o=s&&1===n;return t(mu,{children:[!(0===n)&&a(fu,{}),o&&t(r,{children:[a(gu,{}),a(fu,{})]}),e.isCurrentPage?a(hu,{children:e.label}):a(pu,{asChild:!0,children:a(Ka,{to:e.href||"/",children:e.label})})]},e.label)})})})}function pm(){const e=Ha();return(()=>{const a=e.pathname.split("/").filter(Boolean),t=[{label:"Exemplos",href:"/"}];let r="";return a.forEach((e,n)=>{r+=`/${e}`;const o=n===a.length-1,i=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.push({label:i,href:o?void 0:r,isCurrentPage:o})}),t})()}um.displayName=st.Indicator.displayName;const hm=({className:e,...t})=>a("nav",{role:"navigation","aria-label":"pagination",className:No("mx-auto flex w-full justify-center",e),...t});hm.displayName="Pagination";const fm=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:No("flex flex-row items-center gap-1",e),...t}));fm.displayName="PaginationContent";const gm=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:No("",e),...t}));gm.displayName="PaginationItem";const vm=({className:e,isActive:t,size:r="icon",...n})=>a("a",{"aria-current":t?"page":void 0,className:No(So({variant:t?"outline":"ghost",size:r}),e),...n});vm.displayName="PaginationLink";const bm=({className:r,...n})=>t(vm,{"aria-label":e.t("go_to_previous_page"),size:"default",className:No("gap-1 pl-2.5",r),...n,children:[a(ie,{className:"h-4 w-4"}),a("span",{children:"Previous"})]});bm.displayName="PaginationPrevious";const xm=({className:r,...n})=>t(vm,{"aria-label":e.t("go_to_next_page"),size:"default",className:No("gap-1 pr-2.5",r),...n,children:[a("span",{children:"Next"}),a(O,{className:"h-4 w-4"})]});xm.displayName="PaginationNext";const ym=({className:e,...r})=>t("span",{"aria-hidden":!0,className:No("flex h-9 w-9 items-center justify-center",e),...r,children:[a(xe,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"More pages"})]});ym.displayName="PaginationEllipsis";const wm=n.forwardRef(({className:e,value:t,...r},n)=>a(lt.Root,{ref:n,className:No("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:a(lt.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));wm.displayName=lt.Root.displayName;const Nm=n.forwardRef(({className:e,...t},r)=>a(dt.Root,{className:No("grid gap-2",e),...t,ref:r}));Nm.displayName=dt.Root.displayName;const _m=n.forwardRef(({className:e,...t},r)=>a(dt.Item,{ref:r,className:No("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(dt.Indicator,{className:"flex items-center justify-center",children:a(U,{className:"h-2.5 w-2.5 fill-current text-current"})})}));_m.displayName=dt.Item.displayName;const Cm=({className:e,...t})=>a(ct.PanelGroup,{className:No("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),km=ct.Panel,Sm=({withHandle:e,className:t,...r})=>a(ct.PanelResizeHandle,{className:No("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("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:a(ae,{className:"h-2.5 w-2.5"})})}),Am=_a.Root,Em=_a.Trigger,Dm=_a.Close,Pm=_a.Portal,Tm=n.forwardRef(({className:e,...t},r)=>a(_a.Overlay,{className:No("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}));Tm.displayName=_a.Overlay.displayName;const Im=v("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"}}),Mm=n.forwardRef(({side:e="right",className:r,children:n,...o},i)=>t(Pm,{children:[a(Tm,{}),t(_a.Content,{ref:i,className:No(Im({side:e}),r),...o,children:[n,t(_a.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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]})]}));Mm.displayName=_a.Content.displayName;const Rm=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:No("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(Oo,{className:"mt-2"})]});Rm.displayName="SheetHeader";const zm=({className:e,...t})=>a("div",{className:No("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});zm.displayName="SheetBody";const Lm=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(Oo,{className:"mb-4"}),a("div",{className:No("flex flex-row justify-end gap-2",e),...n,children:r})]});Lm.displayName="SheetFooter";const Fm=n.forwardRef(({className:e,...t},r)=>a(_a.Title,{ref:r,className:No("text-lg font-semibold text-foreground",e),...t}));Fm.displayName=_a.Title.displayName;const Om=n.forwardRef(({className:e,...t},r)=>a(_a.Description,{ref:r,className:No("text-sm text-muted-foreground",e),...t}));Om.displayName=_a.Description.displayName;const Um="sidebar:state",jm=n.createContext(null);function Bm(){const e=n.useContext(jm);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Vm=n.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:o,style:i,children:s,...l},d)=>{const c=vl(),[u,m]=n.useState(!1),[p,h]=n.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Um);return null!==a?"true"===a:e}return e}),f=t??p,g=n.useCallback(e=>{const a="function"==typeof e?e(f):e;r?r(a):h(a),"undefined"!=typeof window&&localStorage.setItem(Um,String(a))},[r,f]),v=n.useCallback(()=>c?m(e=>!e):g(e=>!e),[c,g,m]);n.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v]);const b=f?"expanded":"collapsed",x=n.useMemo(()=>({state:b,open:f,setOpen:g,isMobile:c,openMobile:u,setOpenMobile:m,toggleSidebar:v}),[b,f,g,c,u,m,v]);return a(jm.Provider,{value:x,children:a(Ji,{delayDuration:0,children:a("div",{className:No("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",o),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...i},ref:d,...l,children:s})})})});Vm.displayName="SidebarProvider";const $m=n.forwardRef(({side:e="left",variant:r="sidebar",collapsible:n="offcanvas",className:o,children:i,...s},l)=>{const{isMobile:d,state:c,openMobile:u,setOpenMobile:m}=Bm();return"none"===n?a("div",{className:No("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",o),ref:l,...s,children:i}):d?a(Am,{open:u,onOpenChange:m,...s,children:t(Mm,{"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(Fm,{className:"sr-only",children:"Menu de Navegação"}),a("div",{className:"flex h-full w-full flex-col",children:i})]})}):t("div",{ref:l,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?n:"","data-variant":r,"data-side":e,children:[a("div",{className:No("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"===r||"inset"===r?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),a("div",{className:No("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"===r||"inset"===r?"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",o),...s,children:a("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:i})})]})});$m.displayName="Sidebar";const qm=n.forwardRef(({className:e,onClick:r,...n},o)=>{const{toggleSidebar:i}=Bm();return t(Ao,{ref:o,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:No("h-7 w-7",e),onClick:e=>{r?.(e),i()},...n,children:[a(we,{}),a("span",{className:"sr-only",children:"Toggle Sidebar"})]})});qm.displayName="SidebarTrigger";const Wm=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=Bm();return a("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:No("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})});Wm.displayName="SidebarRail";const Hm=n.forwardRef(({className:e,...t},r)=>a("main",{ref:r,className:No("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}));Hm.displayName="SidebarInset";const Gm=n.forwardRef(({className:e,...t},r)=>a(Do,{ref:r,"data-sidebar":"input",className:No("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Gm.displayName="SidebarInput";const Km=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"header",className:No("flex flex-col gap-2 p-2",e),...t}));Km.displayName="SidebarHeader";const Ym=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"footer",className:No("flex flex-col gap-2 p-2",e),...t}));Ym.displayName="SidebarFooter";const Qm=n.forwardRef(({className:e,...t},r)=>a(Oo,{ref:r,"data-sidebar":"separator",className:No("mx-2 w-auto bg-sidebar-border",e),...t}));Qm.displayName="SidebarSeparator";const Xm=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"content",className:No("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Xm.displayName="SidebarContent";const Jm=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group",className:No("relative flex w-full min-w-0 flex-col p-2",e),...t}));Jm.displayName="SidebarGroup";const Zm=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?g:"div",{ref:n,"data-sidebar":"group-label",className:No("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}));Zm.displayName="SidebarGroupLabel";const ep=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?g:"button",{ref:n,"data-sidebar":"group-action",className:No("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}));ep.displayName="SidebarGroupAction";const ap=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group-content",className:No("w-full text-sm",e),...t}));ap.displayName="SidebarGroupContent";const tp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu",className:No("flex w-full min-w-0 flex-col gap-1",e),...t}));tp.displayName="SidebarMenu";const rp=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,"data-sidebar":"menu-item",className:No("group/menu-item relative",e),...t}));rp.displayName="SidebarMenuItem";const np=v("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"}}),op=n.forwardRef(({asChild:e=!1,isActive:r=!1,variant:n="default",size:o="default",tooltip:i,className:s,...l},d)=>{const c=e?g:"button",{isMobile:u,state:m}=Bm(),p=a(c,{ref:d,"data-sidebar":"menu-button","data-size":o,"data-active":r,className:No(np({variant:n,size:o}),s),...l});return i?("string"==typeof i&&(i={children:i}),t(Zi,{children:[a(es,{asChild:!0,children:p}),a(as,{side:"right",align:"center",hidden:"collapsed"!==m||u,...i})]})):p});op.displayName="SidebarMenuButton";const ip=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>a(t?g:"button",{ref:o,"data-sidebar":"menu-action",className:No("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}));ip.displayName="SidebarMenuAction";const sp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"menu-badge",className:No("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}));sp.displayName="SidebarMenuBadge";const lp=n.forwardRef(({className:e,showIcon:r=!1,...o},i)=>{const s=n.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t("div",{ref:i,"data-sidebar":"menu-skeleton",className:No("rounded-md h-8 flex gap-2 px-2 items-center",e),...o,children:[r&&a("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),a("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});lp.displayName="SidebarMenuSkeleton";const dp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu-sub",className:No("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}));dp.displayName="SidebarMenuSub";const cp=n.forwardRef(({...e},t)=>a("li",{ref:t,...e}));cp.displayName="SidebarMenuSubItem";const up=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},i)=>a(e?g:"a",{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:No("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}));up.displayName="SidebarMenuSubButton";const mp=n.forwardRef(({className:e,value:r,defaultValue:n,...o},i)=>{const s=r||n||[0];return t(ut.Root,{ref:i,value:r,defaultValue:n,className:No("relative flex w-full touch-none select-none items-center",e),...o,children:[a(ut.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a(ut.Range,{className:"absolute h-full bg-primary"})}),s.map((e,t)=>a(ut.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))]})});function pp({children:e,className:t}){return a("div",{className:No("flex flex-col h-full",t),children:a(bd,{className:"flex-1",children:a("div",{className:"space-y-6 p-6",children:e})})})}function hp({title:e,description:r,actions:n,className:o}){return t("div",{className:No("space-y-4",o),children:[t("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t("div",{className:"space-y-1",children:[a("h2",{className:"text-2xl font-bold tracking-tight",children:e}),r&&a("p",{className:"text-muted-foreground text-sm",children:r})]}),n&&a("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a(Oo,{})]})}function fp({children:e,className:t}){return a("div",{className:No("space-y-6",t),children:e})}mp.displayName=ut.Root.displayName;const gp=mt.Menu,vp=mt.Group,bp=mt.Portal,xp=mt.Sub,yp=mt.RadioGroup,wp=n.forwardRef(({className:e,...t},r)=>a(mt.Root,{ref:r,className:No("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));wp.displayName=mt.Root.displayName;const Np=n.forwardRef(({className:e,...t},r)=>a(mt.Trigger,{ref:r,className:No("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}));Np.displayName=mt.Trigger.displayName;const _p=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(mt.SubTrigger,{ref:i,className:No("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",r&&"pl-8",e),...o,children:[n,a(O,{className:"ml-auto h-4 w-4"})]}));_p.displayName=mt.SubTrigger.displayName;const Cp=n.forwardRef(({className:e,...t},r)=>a(mt.SubContent,{ref:r,className:No("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}));Cp.displayName=mt.SubContent.displayName;const kp=n.forwardRef(({className:e,align:t="start",alignOffset:r=-4,sideOffset:n=8,...o},i)=>a(mt.Portal,{children:a(mt.Content,{ref:i,align:t,alignOffset:r,sideOffset:n,className:No("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),...o})}));kp.displayName=mt.Content.displayName;const Sp=n.forwardRef(({className:e,inset:t,...r},n)=>a(mt.Item,{ref:n,className:No("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}));Sp.displayName=mt.Item.displayName;const Ap=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(mt.CheckboxItem,{ref:i,className:No("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:n,...o,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(mt.ItemIndicator,{children:a(T,{className:"h-4 w-4"})})}),r]}));Ap.displayName=mt.CheckboxItem.displayName;const Ep=n.forwardRef(({className:e,children:r,...n},o)=>t(mt.RadioItem,{ref:o,className:No("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),...n,children:[a("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a(mt.ItemIndicator,{children:a(U,{className:"h-2 w-2 fill-current"})})}),r]}));Ep.displayName=mt.RadioItem.displayName;const Dp=n.forwardRef(({className:e,inset:t,...r},n)=>a(mt.Label,{ref:n,className:No("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Dp.displayName=mt.Label.displayName;const Pp=n.forwardRef(({className:e,...t},r)=>a(mt.Separator,{ref:r,className:No("-mx-1 my-1 h-px bg-muted",e),...t}));Pp.displayName=mt.Separator.displayName;const Tp=({className:e,...t})=>a("span",{className:No("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Tp.displayname="MenubarShortcut";const Ip={light:"",dark:".dark"},Mp=n.createContext(null);function Rp(){const e=n.useContext(Mp);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const zp=n.forwardRef(({id:e,className:r,children:o,config:i,...s},l)=>{const d=n.useId(),c=`chart-${e||d.replace(/:/g,"")}`;return a(Mp.Provider,{value:{config:i},children:t("div",{"data-chart":c,ref:l,className:No("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",r),...s,children:[a(Lp,{id:c,config:i}),a(pt.ResponsiveContainer,{children:o})]})})});zp.displayName="Chart";const Lp=({id:e,config:t})=>{const r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?a("style",{dangerouslySetInnerHTML:{__html:Object.entries(Ip).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},Fp=pt.Tooltip,Op=n.forwardRef(({active:e,payload:o,className:i,indicator:s="dot",hideLabel:l=!1,hideIndicator:d=!1,label:c,labelFormatter:u,labelClassName:m,formatter:p,color:h,nameKey:f,labelKey:g},v)=>{const{config:b}=Rp(),x=n.useMemo(()=>{if(l||!o?.length)return null;const[e]=o,t=Bp(b,e,`${g||e?.dataKey||e?.name||"value"}`),r=g||"string"!=typeof c?t?.label:b[c]?.label||c;return u?a("div",{className:No("font-medium",m),children:u(r,o)}):r?a("div",{className:No("font-medium",m),children:r}):null},[c,u,o,l,m,b,g]);if(!e||!o?.length)return null;const y=1===o.length&&"dot"!==s;return t("div",{ref:v,className:No("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",i),children:[y?null:x,a("div",{className:"grid gap-1.5",children:o.map((e,n)=>{const o=`${f||e.name||e.dataKey||"value"}`,i=Bp(b,e,o),l=h||e.payload?.fill||e.color;return a("div",{className:No("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:p&&void 0!==e?.value&&e.name?p(e.value,e.name,e,n,e.payload):t(r,{children:[i?.icon?a(i.icon,{}):!d&&a("div",{className:No("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":y&&"dashed"===s}),style:{"--color-bg":l,"--color-border":l}}),t("div",{className:No("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[t("div",{className:"grid gap-1.5",children:[y?x:null,a("span",{className:"text-muted-foreground",children:i?.label||e.name})]}),void 0!==e.value&&a("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||n)})})]})});Op.displayName="ChartTooltip";const Up=pt.Legend,jp=n.forwardRef(({className:e,hideIcon:r=!1,payload:n,verticalAlign:o="bottom",nameKey:i},s)=>{const{config:l}=Rp();return n?.length?a("div",{ref:s,className:No("flex items-center justify-center gap-4","top"===o?"pb-3":"pt-3",e),children:n.map(e=>{const n=`${i||e.dataKey||"value"}`,o=Bp(l,e,n);return t("div",{className:No("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[o?.icon&&!r?a(o.icon,{}):a("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),o?.label]},e.value)})}):null});function Bp(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 n=t;return t in a&&"string"==typeof a[t]?n=a[t]:r&&t in r&&"string"==typeof r[t]&&(n=r[t]),n in e?e[n]:e[t]}jp.displayName="ChartLegend";const Vp=({onClick:e,isActive:t,disabled:r,children:n,title:o})=>a("button",{type:"button",onClick:e,disabled:r,title:o,className:No("p-1.5 rounded hover:bg-muted transition-colors",t?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:n}),$p=()=>a("div",{className:"w-px h-5 bg-border mx-1"}),qp=({value:r,onChange:o,disabled:s,placeholder:d=e.t("write_content_here"),minHeight:c="300px",showModeToggle:u=!0,showVariableHint:m=!0,className:p})=>{const{t:h}=Ra(),[f,g]=i("visual"),v=Pt({extensions:[It.configure({heading:{levels:[1,2,3]}}),Mt,Rt.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),zt,Lt,Ft.configure({multicolor:!0})],content:r||"",editable:!s,onUpdate:({editor:e})=>{o(e.getHTML())}});n.useEffect(()=>{v&&r!==v.getHTML()&&v.commands.setContent(r||"")},[r,v]);const b=l(()=>{if(!v)return;const e=v.getAttributes("link").href,a=window.prompt("URL",e);null!==a&&(""!==a?v.chain().focus().extendMarkRange("link").setLink({href:a}).run():v.chain().focus().extendMarkRange("link").unsetLink().run())},[v]);return v?t("div",{className:No("space-y-2",p),children:[u&&t("div",{className:"flex justify-between items-center",children:[t("div",{className:"flex gap-1",children:[t(Ao,{type:"button",size:"sm",variant:"visual"===f?"default":"outline",onClick:()=>g("visual"),disabled:s,children:[a(Ne,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t(Ao,{type:"button",size:"sm",variant:"code"===f?"default":"outline",onClick:()=>g("code"),disabled:s,children:[a(_e,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t(Ao,{type:"button",size:"sm",variant:"preview"===f?"default":"outline",onClick:()=>g("preview"),disabled:s,children:[a(Ce,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),m&&t("p",{className:"text-xs text-muted-foreground",children:["Use ",a("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===f&&t("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||v?.commands.focus()},children:[t("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[a(Vp,{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),isActive:v.isActive("heading",{level:1}),disabled:s,title:e.t("heading_1"),children:a(ke,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),isActive:v.isActive("heading",{level:2}),disabled:s,title:e.t("heading_2"),children:a(Se,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),isActive:v.isActive("heading",{level:3}),disabled:s,title:e.t("heading_3"),children:a(Ae,{className:"h-4 w-4"})}),a($p,{}),a(Vp,{onClick:()=>v.chain().focus().toggleBold().run(),isActive:v.isActive("bold"),disabled:s,title:e.t("bold"),children:a(Ee,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleItalic().run(),isActive:v.isActive("italic"),disabled:s,title:e.t("italic"),children:a(De,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleUnderline().run(),isActive:v.isActive("underline"),disabled:s,title:"Sublinhado",children:a(Pe,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleStrike().run(),isActive:v.isActive("strike"),disabled:s,title:"Riscado",children:a(Te,{className:"h-4 w-4"})}),a($p,{}),a(Vp,{onClick:()=>v.chain().focus().toggleBulletList().run(),isActive:v.isActive("bulletList"),disabled:s,title:"Lista",children:a(J,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().toggleOrderedList().run(),isActive:v.isActive("orderedList"),disabled:s,title:h("ordered_list"),children:a(Ie,{className:"h-4 w-4"})}),a($p,{}),a(Vp,{onClick:()=>v.chain().focus().toggleHighlight().run(),isActive:v.isActive("highlight"),disabled:s,title:"Destacar",children:a(Me,{className:"h-4 w-4"})}),a(Vp,{onClick:b,isActive:v.isActive("link"),disabled:s,title:"Link",children:a(Re,{className:"h-4 w-4"})}),a($p,{}),a(Vp,{onClick:()=>v.chain().focus().unsetAllMarks().clearNodes().run(),disabled:s,title:h("clear_formatting"),children:a(ze,{className:"h-4 w-4"})}),a($p,{}),a(Vp,{onClick:()=>v.chain().focus().undo().run(),disabled:s||!v.can().undo(),title:"Desfazer",children:a(Le,{className:"h-4 w-4"})}),a(Vp,{onClick:()=>v.chain().focus().redo().run(),disabled:s||!v.can().redo(),title:"Refazer",children:a(Fe,{className:"h-4 w-4"})})]}),a(Tt,{editor:v,className:No("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:c}})]}),"code"===f&&a("textarea",{value:r||"",onChange:e=>o(e.target.value),disabled:s,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:c},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===f&&a("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:c},children:a("div",{className:"bg-background shadow-sm rounded border p-4",children:a("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${d}</p>`}})})})]}):null};function Wp({image:e,title:t,className:r}){return a("div",{className:No("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?a("img",{src:e,alt:t,className:"w-full h-full object-cover"}):a("div",{className:"flex items-center justify-center h-full",children:a(Oe,{className:"w-16 h-16 text-muted-foreground"})})})}function Hp({steps:e,currentStepIndex:r,onStepSelect:n,stepLabel:o,className:i}){const{t:s}=Ra(),l=e.length,d=(r+1)/l*100;return t("div",{className:No("flex items-center gap-3",i),children:[t(Fi,{children:[a(Oi,{asChild:!0,children:t(Ao,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[o," ",r+1,"/",l,a(D,{className:"h-3 w-3 ml-1"})]})}),a(Wi,{align:"start",children:e.map((e,a)=>t(Hi,{onClick:()=>n(a),className:No(a===r&&"bg-accent"),children:[a+1,". ",e.title]},e.id))})]}),a(wm,{value:d,className:"w-32 h-2"})]})}function Gp({currentStepIndex:e,totalSteps:r,onBack:n,onNext:o,onComplete:i,backButtonText:s,continueButtonText:l,finishButtonText:d,className:c}){const{t:u}=Ra(),m=0===e,p=e===r-1;return t("div",{className:No("flex items-center gap-2",c),children:[!m&&t(Ao,{variant:"outline",onClick:n,size:"sm",children:[a(Ue,{className:"h-4 w-4 mr-2"}),s]}),t(Ao,{onClick:p?i:o,size:"sm",children:[p?d:l,!p&&a(je,{className:"h-4 w-4 ml-2"})]})]})}const Kp=n.forwardRef(({open:r,onOpenChange:o,steps:i,onComplete:s,onStepChange:l,continueButtonText:d="Continuar",backButtonText:c="Voltar",finishButtonText:u="Concluir",stepLabel:m=e.t("approval_step_label"),size:p="md",showProgressIndicator:h=!0,currentStepIndex:f,onCurrentStepChange:g,className:v},b)=>{const[x,y]=n.useState(0),w=void 0!==f,N=w?f:x,_=n.useCallback(e=>{w?g?.(e):y(e),l?.(e)},[w,g,l]);n.useEffect(()=>{r||w||y(0)},[r,w]);const C=i[N],k=i.length;return C?a(Qo,{open:r,onOpenChange:o,children:t(ti,{ref:b,size:p,variant:"informative",className:No("p-0 gap-0 overflow-hidden",v),children:[t(Zo,{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(E,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Fechar"})]}),a("div",{className:"flex-1 min-h-0 overflow-auto",children:t("div",{className:"p-6 space-y-4",children:[a(Wp,{image:C.image,title:C.title}),a(ii,{className:"text-xl font-semibold",children:C.title}),a(si,{className:"text-muted-foreground",children:C.description})]})}),t("div",{className:"flex-shrink-0",children:[a(Oo,{}),t("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[h&&k>1?a(Hp,{steps:i,currentStepIndex:N,onStepSelect:e=>{_(e)},stepLabel:m}):a("div",{}),a(Gp,{currentStepIndex:N,totalSteps:k,onBack:()=>{N>0&&_(N-1)},onNext:()=>{N<k-1&&_(N+1)},onComplete:()=>{s?.(),o(!1)},backButtonText:c,continueButtonText:d,finishButtonText:u})]})]})]})}):null});function Yp({label:e,onClick:r,icon:n,actions:o=[],variant:i="default",size:s="default",disabled:l=!1,loading:d=!1,menuAlign:c="end",className:u}){const{t:m}=Ra(),p=l||d;if(!(o.length>0))return t(Ao,{variant:i,size:s,disabled:p,onClick:r,className:u,children:[d?a(I,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]});return t("div",{className:No("inline-flex rounded-md shadow-sm",u),children:[t(Ao,{variant:i,size:s,disabled:p,onClick:r,className:"rounded-r-none border-r-0 focus:z-10",children:[d?a(I,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]}),t(Fi,{children:[a(Oi,{asChild:!0,children:a(Ao,{variant:i,size:s,disabled:p,className:No("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"}[s]),"aria-label":m("more_options"),children:a(D,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[s]})})}),a(Wi,{align:c,className:"min-w-[160px]",children:o.map(e=>{const r=e.icon;return t(Hi,{onClick:e.onClick,disabled:e.disabled,className:No("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}var Qp,Xp;Kp.displayName="OnboardingDialog",(Xp=Qp||(Qp={})).CSV="csv",Xp.PDF="pdf",Xp.XLSX="xlsx",Xp.PNG="png",Xp.JPEG="jpeg",Xp.SVG="svg";const Jp=[{value:Qp.CSV,label:"CSV",icon:a(Be,{className:"h-5 w-5"})},{value:Qp.PDF,label:"PDF",icon:a(Be,{className:"h-5 w-5"})},{value:Qp.XLSX,label:"XLSX",icon:a(Ve,{className:"h-5 w-5"})}],Zp=[{value:Qp.PNG,label:"PNG",icon:a($e,{className:"h-5 w-5"})},{value:Qp.JPEG,label:"JPEG",icon:a(qe,{className:"h-5 w-5"})},{value:Qp.SVG,label:"SVG",icon:a(qe,{className:"h-5 w-5"})},{value:Qp.PDF,label:"PDF",icon:a(Be,{className:"h-5 w-5"})}];function eh({open:e,onOpenChange:r,onExport:n,mode:o="table",options:s,title:l,description:d,cancelLabel:c="Cancelar",exportLabel:u="Exportar"}){const{t:m}=Ra(),[p,h]=i(""),f=s??("chart"===o?Zp:Jp),g=l??m("chart"===o?"dashboard_export_chart":"dashboard_export_table"),v=d??m("select_file_format"),b=e=>{e||h(""),r(e)};return a(Qo,{open:e,onOpenChange:b,children:t(ti,{className:"sm:max-w-md",variant:"form",isDirty:!!p,children:[a(ri,{children:a(ii,{children:g})}),t("div",{className:"py-4",children:[a("p",{className:"text-sm text-muted-foreground mb-4",children:v}),a(Nm,{value:p,onValueChange:h,className:"gap-3",children:f.map(e=>t("div",{className:"flex items-center space-x-3",children:[a(_m,{value:e.value,id:`export-${e.value}`}),t(To,{htmlFor:`export-${e.value}`,className:No("flex items-center gap-2 cursor-pointer font-normal",p===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t(oi,{children:[a(Ao,{variant:"outline",onClick:()=>b(!1),children:c}),a(Ao,{onClick:()=>{p&&(n(p),r(!1),h(""))},disabled:!p,children:u})]})]})})}const ah=f(({value:e,onChange:r,onTimeChange:o,label:i,error:s,format:d="24h",className:c,id:u,...m},p)=>{const h=u??n.useId(),f=l(e=>{const a=e.target.value;r?.(a),o?.(a)},[r,o]),g=l(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t("div",{className:No("grid gap-1.5",c),children:[i&&a(To,{htmlFor:h,children:i}),t("div",{className:"relative",children:[a(Do,{ref:p,id:h,type:"time",value:e??"",onChange:f,onKeyDown:g,min:"00:00",max:"23:59",step:60,className:No("pr-9",s&&"border-destructive focus-visible:ring-destructive"),...m}),a(We,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),s&&a("p",{className:"text-sm text-destructive",children:s})]})});function th({open:r,onOpenChange:n,onConfirm:o,onGenerateCode:s,mode:d="code",email:c,maxLength:u=8,title:m=e.t("electronic_signature"),description:p,confirmLabel:h=e.t("conclude"),cancelLabel:f=e.t("cancel"),resendLabel:g=e.t("resend_code"),errorMessage:v}){const b="password"===d,x=b?e.t("esign_password_description"):e.t("esign_code_description"),y=p??x,[w,N]=i(""),[_,C]=i(!1),[k,S]=i(!1),[A,E]=i(null),D=l(async()=>{if(w.trim()){C(!0),E(null);try{await o(w)?(N(""),n(!1)):E(v??(b?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{E(v??(b?e.t("esign_password_error"):e.t("esign_code_error")))}finally{C(!1)}}},[w,o,n,v,b]),P=l(async()=>{if(s){S(!0),E(null);try{await s()}catch{E(e.t("esign_resend_error"))}finally{S(!1)}}},[s]),T=e=>{e||(N(""),E(null)),n(e)},I=b?He:Ge,M=b?"Senha":e.t("verification_code"),R=b?e.t("enter_password"):e.t("enter_code");return a(Qo,{open:r,onOpenChange:T,children:t(ti,{className:"sm:max-w-md",variant:"form",isDirty:!!w,children:[a(ri,{children:t(ii,{className:"flex items-center gap-2",children:[a(I,{className:"h-5 w-5 text-primary"}),m]})}),t("div",{className:"py-4 space-y-4",children:[a("p",{className:"text-sm text-muted-foreground",children:y}),!b&&c&&t("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[a(Ke,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-muted-foreground",children:"Enviado para:"}),a("span",{className:"font-medium",children:c})]}),t("div",{className:"space-y-2",children:[a(To,{htmlFor:"signature-input",children:M}),a(Do,{id:"signature-input",type:b?"password":"text",value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&w.trim()&&(e.preventDefault(),D())},maxLength:b?void 0:u,placeholder:R,autoFocus:!0,className:No(A&&"border-destructive focus-visible:ring-destructive")}),A&&a("p",{className:"text-sm text-destructive",children:A})]}),!b&&t(Ao,{variant:"ghost",size:"sm",onClick:P,disabled:k,className:"text-primary",children:[a(ue,{className:No("h-4 w-4 mr-1",k&&"animate-spin")}),g]})]}),t(oi,{children:[a(Ao,{variant:"outline",onClick:()=>T(!1),disabled:_,children:f}),a(Ao,{onClick:D,disabled:!w.trim()||_,children:_?"Validando...":h})]})]})})}function rh({currentStep:e,totalSteps:r,onStepChange:o,stepLabels:i,canGoToStep:s,className:l,progressWidth:d="w-32"}){n.useEffect(()=>{process.env.NODE_ENV},[]);const c=Array.from({length:r},(e,a)=>a+1),u=a=>!(a<=e)&&(!!s&&!s(a));return t("div",{className:No("flex items-center gap-3",l),children:[t(Fi,{children:[a(Oi,{asChild:!0,children:t(Ao,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",r,a(D,{className:"h-3 w-3 ml-1"})]})}),a(Wi,{align:"start",children:c.map(r=>t(Hi,{onClick:()=>{var a;(a=r)<e?o(a):s&&!s(a)||o(a)},disabled:u(r),className:No("cursor-pointer",r===e&&"bg-muted font-medium",u(r)&&"opacity-50 cursor-not-allowed"),children:[t("span",{className:"mr-2 text-muted-foreground",children:[r,"."]}),i?.[r-1]||`Etapa ${r}`,r===e&&a(T,{className:"h-4 w-4 ml-auto"})]},r))})]}),a(wm,{value:e/r*100,className:No("h-2",d)})]})}function nh({open:r,onOpenChange:n,currentStep:o,onStepChange:i,steps:s,canGoToStep:l,children:d,title:c,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:f=e.t("back"),variant:g="form",isDirty:v,size:b="lg",unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:w,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=Ra(),E=s.length,D=o>=E,P=o<=1;return a(Qo,{open:r,onOpenChange:n,children:t(ti,{size:b,variant:g,isDirty:v,unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:w,leaveWithoutSavingText:N,className:No("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[a("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),a("nav",{className:"flex flex-col gap-1 flex-1",children:s.map((e,r)=>{const n=r+1,s=n===o,d=(e=>e<o)(n),c=(u=n)<=o||!l||l(u);var u;return t("button",{type:"button",onClick:()=>(e=>{e!==o&&(e<o?i(e):l&&!l(e)||i(e))})(n),disabled:!c,className:No("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",s&&"bg-primary-foreground/20 font-semibold",!s&&c&&"hover:bg-primary-foreground/10 cursor-pointer",!c&&"opacity-40 cursor-not-allowed"),children:[a("span",{className:No("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",s&&"bg-primary-foreground text-primary",d&&!s&&"bg-primary-foreground/30 text-primary-foreground",!s&&!d&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:d&&!s?a(T,{className:"h-3.5 w-3.5"}):n}),a("span",{className:No("line-clamp-2",s&&"text-primary-foreground",!s&&"text-primary-foreground/70"),children:e})]},n)})})]}),t("div",{className:"flex flex-col flex-1 min-w-0",children:[t(ri,{className:"p-6 pb-0",children:[t("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",o," de ",E]}),a(ii,{children:c}),u&&a("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a(ni,{className:"px-6",children:d}),!k&&a(oi,{className:"px-6 pb-6",children:t("div",{className:"flex items-center justify-between w-full",children:[a("div",{className:"flex items-center gap-2",children:S}),t("div",{className:"flex items-center gap-2",children:[!P&&a(Ao,{variant:"outline",onClick:()=>i(o-1),children:f}),a(Ao,D?{onClick:m,disabled:C,children:p}:{onClick:()=>i(o+1),disabled:C,children:h})]})]})})]})]})})}function oh(e){const a=Rs.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 ih(e,a,t){let r=await fetch(e,a);if(401===r.status){if(await Ws.handleApiError({status:401})){const n={...a,headers:oh(t)};r=await fetch(e,n)}}return r}function sh(e){const[a,t]=i([]),[r,n]=i(0),[o,s]=i(!1);m(()=>{if(!e)return;let a=!1;const r=`${rr().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){s(!0);try{const o=oh(e),i=await ih(r,{method:"GET",headers:o},e);if(!i.ok)return;const s=await i.json();!a&&s.data?.[0]&&(t(s.data[0].updates??[]),n(s.data[0].valueBadge??0))}catch(o){}finally{a||s(!1)}}(),()=>{a=!0}},[e]);const d=l(async()=>{if(!e||r<=0||0===a.length)return;const t=a[0].id,o=`${rr().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=oh(e),r=JSON.stringify({id:t,idUpdateType:3});await ih(o,{method:"POST",headers:a,body:r},e)}catch(i){}},[e,r,a]);return{updates:a,badgeCount:r,loading:o,markAsVisualized:d}}ah.displayName="Timepicker";const lh=o.forwardRef(({updates:r,badgeCount:n,onOpen:o,onViewAll:i},s)=>{const l=void 0===r,d=pl(),c=d?.alias??null,u=sh(l?c:null),m=l?u.updates??[]:r,p=l?u.badgeCount??0:n??0,h=o??(l?u.markAsVisualized:void 0),f=i??(l&&c?()=>{const e=`https://apps4.qualiex.com/common/${c}/up/view`;window.open(e,"_blank","noopener,noreferrer")}:void 0);return t(rs,{children:[a(ns,{asChild:!0,children:t(Ao,{ref:s,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(Ye,{className:"h-7 w-7"}),p>0&&a("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})]})}),t(os,{align:"end",className:"w-80 p-0",children:[a("div",{className:"border-b border-border px-4 py-3",children:a("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),a("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?a("ul",{className:"divide-y divide-border",children:m.map(e=>t("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:f,children:[a("p",{className:"text-sm font-medium text-foreground",children:e.title}),a("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[a(Ye,{className:"h-8 w-8 text-muted-foreground mb-2"}),a("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),a("div",{className:"border-t border-border px-4 py-2",children:t(Ao,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:f,children:["Ver todas as atualizações",a(je,{className:"h-[18px] w-[18px]"})]})})]})]})});var dh,ch,uh,mh;lh.displayName="UpdatesNotification",(ch=dh||(dh={}))[ch.none=0]="none",ch[ch.image=1]="image",ch[ch.video=2]="video",ch[ch.audio=3]="audio",ch[ch.wopi=4]="wopi",ch[ch.onlineEditor=5]="onlineEditor",ch[ch.report=6]="report",(mh=uh||(uh={}))[mh.SimplePrint=0]="SimplePrint",mh[mh.ManagedCopy=1]="ManagedCopy",mh[mh.NonManagedCopy=2]="NonManagedCopy";const ph={".jpg":dh.image,".jpeg":dh.image,".png":dh.image,".bmp":dh.image,".gif":dh.image,".svg":dh.image,".webp":dh.image,".wav":dh.audio,".mp3":dh.audio,".mp4":dh.video,".webm":dh.video,".ogg":dh.video,".pdf":dh.wopi,".ods":dh.wopi,".xls":dh.wopi,".xlsb":dh.wopi,".xlsm":dh.wopi,".xlsx":dh.wopi,".doc":dh.wopi,".docm":dh.wopi,".docx":dh.wopi,".dot":dh.wopi,".dotm":dh.wopi,".dotx":dh.wopi,".odt":dh.wopi,".odp":dh.wopi,".pot":dh.wopi,".potm":dh.wopi,".potx":dh.wopi,".pps":dh.wopi,".ppsm":dh.wopi,".ppsx":dh.wopi,".ppt":dh.wopi,".pptm":dh.wopi,".pptx":dh.wopi,".gdocs":dh.onlineEditor,".gsheets":dh.onlineEditor};function hh(e){const{t:a}=Ra();return e?ph[e.toLowerCase()]??dh.none:dh.none}function fh(e){const{t:a}=Ra();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"}const gh={".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 vh(e){const{t:a}=Ra();return gh[e?.toLowerCase()]||""}function bh(e){const{t:a}=Ra(),{viewerUrl:t,wopiUrl:r,fileId:n,token:o,extension:i,language:s="pt-br"}=e,l=vh(i);if(!l)return null;return`${t}${l}ui=${s}&rs=${s}&access_token=${o}&WOPISrc=${encodeURIComponent(`${r}${n}`)}`}function xh({open:e,onOpenChange:n,template:o,viewerType:i,isLoading:s=!1,enableDownload:d=!0,onDownload:c,isDownloading:p=!1,enableFavorite:h=!1,isFavorite:f=!1,onFavorite:g,isFavoriting:v=!1,enableConfirmReading:b=!1,readingConfirmationDate:x,onConfirmReading:y,isConfirmingReading:w=!1,readingConfirmationTimeRemaining:N,onIframeLoad:_,className:C}){const{t:k}=Ra(),S=u(null),A=i??hh(o.extension),D=p||w||v,P=o.code?`${o.code} – ${o.name}`:o.name,T=l(()=>{S.current&&_&&_(S.current)},[_]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&n(!1)};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,n]),a(Qo,{open:e,onOpenChange:n,children:t(ti,{className:No("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(A===dh.wopi||A===dh.report)&&"w-[90vw]",C),children:[t("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[a("h2",s?{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}:{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:P}),t("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!s&&t(r,{children:[(b||x)&&a(r,{children:x?t("div",{className:"flex flex-col mr-2.5",children:[t("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[a(Qe,{className:"h-4 w-4"}),"Leitura confirmada"]}),a("span",{className:"text-xs text-muted-foreground ml-5",children:x.toLocaleDateString()})]}):null!=N&&N>0?t("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[a("span",{children:k("terms_confirmation_available")}),a("span",{className:"font-medium min-w-[72px]",children:yh(N)}),a("span",{children:"segundos"})]}):t(Ao,{variant:"default",size:"sm",disabled:D,onClick:()=>y?.(),className:"mr-2.5",children:[a(Ge,{className:"h-4 w-4 mr-1"}),w?"Confirmando...":k("terms_confirm_reading")]})}),A!==dh.none&&h&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>g?.(f),children:a(Xe,{className:No("h-4 w-4",f&&"fill-accent text-accent")})})}),a(as,{children:f?"Desfavoritar":"Favoritar"})]}),A!==dh.none&&d&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>c?.(),children:a(Je,{className:"h-4 w-4"})})}),a(as,{children:"Download"})]})]}),t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:D,onClick:()=>n(!1),children:a(E,{className:"h-4 w-4"})})}),a(as,{children:"Fechar"})]})]})]}),a("div",{className:No("flex flex-col items-center justify-center min-h-[160px] w-full",s&&"relative -top-5",A===dh.none&&"min-h-[124px]",A===dh.image&&"max-h-[85vh]",(A===dh.wopi||A===dh.report)&&"min-w-[77vw] min-h-[80vh]"),children:s?a(Ri,{className:"h-14 w-14"}):t(r,{children:[(A===dh.none||!o.url)&&t("div",{className:"text-center",children:[a("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),a("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),A===dh.image&&a("img",{loading:"eager",src:o.url,alt:o.name,className:"max-w-full max-h-[85vh] object-contain"}),A===dh.video&&a("video",{controls:!0,autoPlay:!0,src:o.url,className:"w-full h-full"}),A===dh.audio&&a("audio",{controls:!0,autoPlay:!0,src:o.url}),(A===dh.wopi||A===dh.report)&&t("div",{className:"relative w-full h-[79.5vh]",children:[a(Ri,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a("iframe",{ref:S,src:o.url,onLoad:T,className:"border-none w-full h-full z-[1] relative",title:o.name})]})]})}),!s&&A===dh.none&&t("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a(Ao,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),d&&a(Ao,{variant:"default",onClick:()=>c?.(),children:"Download"})]})]})})}function yh(e){const{t:a}=Ra(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function wh({open:e,onOpenChange:r,identifier:n,fileName:o,mode:s="edit",type:d="document",onClose:c,className:u}){const[p,h]=i(!0),f=function(e,a="edit",t="document"){return`https://docs.google.com/${t}/d/${e}/${a}?usp=drivesdk?embedded=true&rm=demo`}(n,s,d);m(()=>{if(e){h(!0);const e=setTimeout(()=>h(!1),300);return()=>clearTimeout(e)}},[e]);const g=l(()=>{c?.(),r(!1)},[c,r]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&g()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,g]),a(Qo,{open:e,onOpenChange:r,children:t(ti,{className:No("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",u),children:[t("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[a("h2",p?{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}:{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:o}),a("div",{className:"flex items-center ml-4 z-20",children:t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,children:a(E,{className:"h-4 w-4"})})}),a(as,{children:"Fechar"})]})})]}),a("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:p?a(Ri,{className:"h-14 w-14"}):t("div",{className:"relative w-full h-[79.5vh]",children:[a(Ri,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),a("iframe",{src:f,className:"border-none w-full h-full z-[1] relative",title:o})]})})]})})}function Nh({open:e,onOpenChange:r,url:n,title:o,className:i,minHeight:s="250px"}){const{t:d}=Ra(),c=l(()=>{r(!1)},[r]);return m(()=>{if(!e)return;const a=e=>{"Escape"===e.key&&c()};return window.addEventListener("keyup",a),()=>window.removeEventListener("keyup",a)},[e,c]),a(Qo,{open:e,onOpenChange:r,children:t(ti,{className:No("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",i),children:[t("div",{className:"flex items-center justify-end mb-2.5",children:[o&&a("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:o}),t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a(E,{className:"h-4 w-4"})})}),a(as,{children:"Fechar"})]})]}),a("iframe",{src:n,className:"border-none w-full",style:{minHeight:s},title:o||d("embedded_content")})]})})}function _h({term:n,open:o,onClose:s,onAgree:d,title:c=e.t("terms_updated"),seeLaterLabel:u=e.t("terms_see_later"),agreeLabel:m=e.t("terms_read_agree"),viewTermLabel:p=e.t("terms_view")}){const[h,f]=i(!1),g=l(()=>{d(n.id)},[d,n.id]);return t(r,{children:[a(Qo,{open:o&&!h,onOpenChange:e=>!e&&s(),children:t(ti,{className:"sm:max-w-md",children:[a(ri,{children:t(ii,{className:"flex items-center gap-2",children:[a(Ge,{className:"h-5 w-5 text-primary"}),c]})}),t("div",{className:"space-y-4",children:[n.description&&a(bd,{className:"max-h-48",children:a("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:n.description}})}),n.file&&t(Ao,{variant:"link",className:"px-0 text-primary",onClick:()=>f(!0),children:[a(pe,{className:"mr-1 h-4 w-4"}),p]})]}),t(oi,{className:"gap-2 sm:gap-0",children:[a(Ao,{variant:"ghost",onClick:s,children:u}),a(Ao,{onClick:g,children:m})]})]})}),h&&a(Ch,{term:n,open:h,onClose:()=>f(!1),viewOnly:!0})]})}function Ch({term:r,open:n,onClose:o,onSign:i,viewOnly:d=!1,title:c=e.t("terms_of_use"),signLabel:u=e.t("terms_read_agree")}){const m=s(()=>r.file?function(e,a=""){const{t:t}=Ra(),r=atob(e),n=[];for(let i=0;i<r.length;i+=512){const e=r.slice(i,i+512),a=new Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t);n.push(new Uint8Array(a))}const o=new Blob(n,{type:a});return URL.createObjectURL(o)}(r.file,r.type):null,[r.file,r.type]),p=l(()=>{m&&URL.revokeObjectURL(m),o()},[m,o]),h=l(()=>{r.hasUserSignature?p():i?.(r.id)},[r,i,p]),f=!d&&!r.hasUserSignature&&i;return a(Qo,{open:n,onOpenChange:e=>!e&&p(),children:t(ti,{className:No("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[a(Be,{className:"h-5 w-5 text-primary"}),c]}),t("div",{className:"flex items-center gap-2",children:[f&&a(Ao,{size:"sm",onClick:h,children:u}),a(Ao,{variant:"ghost",size:"icon",onClick:p,children:a(E,{className:"h-4 w-4"})})]})]}),a("div",{className:"flex-1 min-h-0",children:r.file&&m?a("iframe",{className:"h-full w-full border-0",src:m,title:c}):a("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function kh(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Sh({users:r,groups:n=[],value:o,onChange:d,disabled:c=!1,maxHeight:u=350,hideGroupFilter:m=!1,searchPlaceholder:p="Buscar usuário...",selectLabel:h="Selecionar",doneLabel:f="Concluir",allLabel:g="Todos",emptyLabel:v=e.t("leadership_no_user_selected"),selectedLabel:b="selecionado",selectedPluralLabel:x="selecionados",className:y}){const[w,N]=i(!1),[_,C]=i(""),[k,S]=i(void 0),A=s(()=>new Set(o),[o]),E=s(()=>{let e=r;if(k&&(e=e.filter(e=>e.groupIds?.includes(k))),_){const a=kh(_);e=e.filter(e=>kh(e.name).includes(a)||kh(e.email??"").includes(a))}return e},[r,k,_]),D=s(()=>w?E:r.filter(e=>A.has(e.id)),[w,E,r,A]),P=o.length,T=s(()=>E.length>0&&E.every(e=>A.has(e.id)),[E,A]),I=l(e=>{if(c)return;const a=A.has(e)?o.filter(a=>a!==e):[...o,e];d(a)},[o,A,d,c]),M=l(e=>{if(c)return;const a=new Set(E.map(e=>e.id));if(e){const e=new Set([...o,...a]);d(Array.from(e))}else d(o.filter(e=>!a.has(e)))},[o,E,d,c]),R=l(()=>{N(e=>!e),C(""),S(void 0)},[]);return t("div",{className:No("rounded-md border bg-muted/30",y),children:[(!c||P>0)&&t("div",{className:No("flex items-center justify-between px-4 py-2",!c&&"cursor-pointer hover:bg-muted/50"),onClick:c?void 0:R,children:[a("span",{className:"text-sm font-medium text-primary uppercase",children:!c&&(w?f:h)}),a("span",{className:"text-xs text-muted-foreground",children:P>0&&`${P} ${1===P?b:x}`})]}),t("div",{className:"px-4 pb-3",children:[w&&t("div",{className:"flex gap-3 mb-3",children:[!m&&n.length>0&&t(xi,{value:k??"__all__",onValueChange:e=>S("__all__"===e?void 0:e),children:[a(Ni,{className:"w-[200px] h-9 text-sm",children:a(wi,{placeholder:e.t("approval_user_group")})}),t(ki,{children:[a(Ai,{value:"__all__",children:e.t("team_all_groups")}),n.map(e=>a(Ai,{value:e.id,children:e.name},e.id))]})]}),t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(Do,{className:"pl-8 h-9 text-sm",placeholder:p,value:_,onChange:e=>C(e.target.value)})]})]}),!w&&0===P&&t("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a(Ze,{className:"h-4 w-4 mr-2"}),v]}),w&&E.length>0&&t("div",{className:"flex items-center gap-2 mb-2",children:[a(Di,{checked:T,onCheckedChange:e=>M(!!e)}),a("span",{className:"text-sm",children:g})]}),D.length>0&&a(bd,{style:{maxHeight:u},className:"pr-2",children:a("div",{className:"space-y-0.5",children:D.map(e=>{return t("div",{className:No("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",w&&!c&&"cursor-pointer hover:bg-accent/50"),onClick:w?()=>I(e.id):void 0,children:[w&&a(Di,{checked:A.has(e.id),onCheckedChange:()=>I(e.id),onClick:e=>e.stopPropagation()}),t(su,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(lu,{src:e.avatar,alt:e.name}),a(du,{className:"text-xs",children:(r=e.name,r.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t("div",{className:"flex flex-col min-w-0",children:[a("span",{className:"font-normal truncate",children:e.name}),e.email&&a("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var r})})}),w&&0===E.length&&a("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})}function Ah(e){const{t:a}=Ra();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Eh(e){const{t:a}=Ra(),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}function Dh({items:r,categories:n,value:o,onChange:d,readonly:c=!1,isLoading:u=!1,title:m=e.t("permissions"),addButtonLabel:p=e.t("allow"),chipsTitle:h=e.t("allowed_items"),chipsPlaceholder:f=e.t("no_item_selected"),searchPlaceholder:g=e.t("search_placeholder"),selectPlaceholder:v=e.t("select_items_to_add"),itemInfoTemplate:b=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:x,disclaimerLink:y,onDisclaimerClick:w,className:N}){const[_,C]=i(n[0]?.id??""),[k,S]=i(""),[A,P]=i([]),[I,M]=i(!1),R=s(()=>Eh(o[_]),[o,_]),z=s(()=>function(e){const{t:a}=Ra(),t=new Set;if(!e)return t;for(const r of e)r.inheritedIds?.forEach(e=>t.add(e));return t}(o[_]),[o,_]),L=s(()=>r.filter(e=>R.has(e.id)),[r,R]),F=s(()=>{const e=Ah(k);return r.filter(a=>!R.has(a.id)&&!(e&&!Ah(a.name).includes(e)))},[r,R,k]),O=s(()=>{const e={};for(const a of n)e[a.id]=Eh(o[a.id]).size;return e},[n,o]),U=l(e=>{C(e),P([]),S("")},[]),j=l(e=>{P(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),V=l(()=>{if(0===A.length)return;const e=[...o[_]??[]];for(const a of A){const t=r.find(e=>e.id===a),n=t?.group??"default",o=e.find(e=>e.context===n);o?o.allowedIds.includes(a)||(o.allowedIds=[...o.allowedIds,a]):e.push({context:n,allowedIds:[a],inheritedIds:[]})}d({...o,[_]:e}),P([]),S(""),M(!1)},[A,o,_,r,d]),$=l(e=>{if(z.has(e))return;const a=(o[_]??[]).map(a=>({...a,allowedIds:a.allowedIds.filter(a=>a!==e)}));d({...o,[_]:a})},[o,_,z,d]);return u?t("div",{className:No("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",N),children:[a("div",{className:"h-4 w-32 bg-muted rounded"}),a("div",{className:"h-9 w-full bg-muted rounded"}),a("div",{className:"h-20 w-full bg-muted rounded"})]}):a("div",{className:No("rounded-md border bg-muted/30",N),children:t("div",{className:"p-4 space-y-4",children:[t("div",{className:"space-y-2",children:[a("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:m}),t(xi,{value:_,onValueChange:U,children:[a(Ni,{className:"h-9 text-sm",children:a(wi,{})}),a(ki,{children:n.map(e=>a(Ai,{value:e.id,children:t("span",{className:"flex items-center gap-2",children:[e.icon,e.name,O[e.id]>0&&a(Ii,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:O[e.id]})]})},e.id))})]})]}),!c&&t("div",{className:"flex gap-2",children:[t(rs,{open:I,onOpenChange:M,children:[a(ns,{asChild:!0,children:t(Ao,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[A.length>0?`${A.length} selecionado${A.length>1?"s":""}`:v,a(D,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(os,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[a("div",{className:"p-2 border-b",children:t("div",{className:"relative",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(Do,{className:"pl-8 h-8 text-sm",placeholder:g,value:k,onChange:e=>S(e.target.value)})]})}),a(bd,{className:"max-h-[220px]",children:0===F.length?a("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):a("div",{className:"p-1",children:F.map(e=>{const r=A.includes(e.id);return t("div",{className:No("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",r&&"bg-accent/50"),onClick:()=>j(e.id),children:[a("div",{className:No("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",r&&"bg-primary text-primary-foreground"),children:r&&a(T,{className:"h-3 w-3"})}),t("div",{className:"flex flex-col min-w-0",children:[a("span",{className:"truncate",children:e.name}),null!=e.count&&a("span",{className:"text-xs text-muted-foreground",children:b(e.count)})]})]},e.id)})})})]})]}),t(Ao,{size:"sm",className:"h-9 gap-1",disabled:0===A.length,onClick:V,children:[a(Q,{className:"h-4 w-4"}),p]})]}),t("div",{className:"space-y-2",children:[a("p",{className:"text-sm font-medium",children:h}),a("div",{className:No("rounded-md border bg-background p-3 min-h-[60px]",c&&"bg-muted/50"),children:0===L.length?a("span",{className:"text-sm text-muted-foreground",children:f}):a("div",{className:"flex flex-wrap gap-1.5",children:L.map(e=>{const r=z.has(e.id);return t(Ii,{variant:r?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!c&&!r&&a("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>$(e.id),children:a(E,{className:"h-3 w-3"})})]},e.id)})})}),c&&x&&t("p",{className:"text-xs text-muted-foreground",children:[a("span",{dangerouslySetInnerHTML:{__html:x}})," ",y&&w&&a("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:w,children:y})]})]})]})})}var Ph,Th;(Th=Ph||(Ph={}))[Th.WaitingProcessing=1]="WaitingProcessing",Th[Th.Processing=2]="Processing",Th[Th.Completed=3]="Completed",Th[Th.Error=4]="Error",Th[Th.Expired=5]="Expired";const Ih={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 Mh(e){const{t:a}=Ra();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Rh(e){const{t:a}=Ra();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function zh({requests:e,isLoading:n=!1,onGetReportUrl:o,formatDate:d=Rh,labels:c,className:u}){const{t:m}=Ra(),p={...Ih,...c},[h,f]=i(""),[g,v]=i(!1),[b,x]=i(""),[y,w]=i(""),[N,_]=i(null),C=s(()=>{if(!h)return e;const a=Mh(h);return e.filter(e=>Mh(e.reportName).includes(a))},[e,h]),k=l(async e=>{if(!N){_(e.id);try{const a=await o(e.id);a&&(x(a),w(e.reportName),v(!0))}finally{_(null)}}},[o,N]);return n?a("div",{className:No("space-y-3",u),children:Array.from({length:5}).map((e,t)=>a(fs,{className:"h-12 w-full"},t))}):t(r,{children:[t("div",{className:No("space-y-3",u),children:[t("div",{className:"relative max-w-sm",children:[a(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(Do,{className:"pl-8 h-9 text-sm",placeholder:p.searchPlaceholder,value:h,onChange:e=>f(e.target.value)})]}),a(bd,{className:"rounded-md border",children:t(bl,{children:[a(xl,{children:t(Nl,{children:[a(_l,{className:"min-w-[140px]",children:p.report}),a(_l,{className:"min-w-[150px]",children:p.status}),a(_l,{className:"min-w-[160px]",children:p.requestDate}),a(_l,{className:"min-w-[160px]",children:p.lastUpdate}),a(_l,{className:"min-w-[160px]",children:p.expirationDate}),a(_l,{className:"min-w-[140px]"})]})}),a(yl,{children:0===C.length?a(Nl,{children:a(Cl,{colSpan:6,className:"text-center text-muted-foreground py-8",children:p.noResults})}):C.map(e=>{const r=function(e){const{t:a}=Ra();return new Date>new Date(e.expirationDate)&&e.statusId===Ph.Completed?Ph.Expired:e.statusId}(e),n=function(e,t){const{t:r}=Ra();switch(e){case Ph.WaitingProcessing:return{label:t.statusWaiting,icon:a(ta,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case Ph.Processing:return{label:t.statusProcessing,icon:a(ue,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case Ph.Completed:return{label:t.statusCompleted,icon:a(aa,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case Ph.Error:return{label:t.statusError,icon:a(j,{className:"h-3.5 w-3.5"}),variant:"danger"};case Ph.Expired:return{label:t.statusExpired,icon:a(ea,{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"}}}(r,p),o=r===Ph.Completed,i=r===Ph.Expired;return t(Nl,{children:[a(Cl,{className:"font-medium",children:e.reportName}),a(Cl,{children:t(Ii,{variant:n.variant,className:No("gap-1",n.className),children:[n.icon,n.label]})}),a(Cl,{className:"text-sm",children:d(new Date(e.requestDate))}),a(Cl,{className:"text-sm",children:d(new Date(e.lastUpdate))}),a(Cl,{className:No("text-sm",i&&"text-destructive"),children:d(new Date(e.expirationDate))}),a(Cl,{children:t(Ao,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!o||N===e.id,onClick:()=>k(e),children:[N===e.id?a(I,{className:"h-4 w-4 animate-spin"}):a(Ce,{className:"h-4 w-4"}),p.viewReport]})})]},e.id)})})]})})]}),a(Nh,{open:g,onOpenChange:v,url:b,title:y})]})}function Lh({reportApiUrl:e,parameters:t={},minHeight:r="80vh",...n}){const o=s(()=>{const a=`${e}/api/reports/v1/Viewer/InitViewer`,r=new URLSearchParams(t).toString();return r?`${a}?${r}`:a},[e,t]);return a(Nh,{...n,url:o,minHeight:r})}const Fh={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 Oh({label:e,color:r,icon:n,showIcon:o,size:i="md",variant:s="filled",backgroundColor:l,className:d}){const c=Fh[i],u=o??!!n;return t("span",{className:No("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===s&&"border",c.badge,d),style:(()=>{switch(s){case"outline":return{color:r,borderColor:vo(r,.3),backgroundColor:"transparent"};case"ghost":return{color:r,backgroundColor:"transparent"};default:return{color:r,backgroundColor:l||vo(r,.1)}}})(),children:[u&&n&&a(n,{size:c.icon,strokeWidth:2}),e]})}function Uh(e){return a=>e[a]}var jh,Bh,Vh,$h,qh,Wh,Hh,Gh,Kh,Yh,Qh,Xh,Jh,Zh,ef,af,tf,rf,nf,of,sf,lf,df,cf,uf,mf,pf,hf,ff,gf,vf,bf,xf,yf,wf,Nf,_f,Cf,kf,Sf,Af,Ef,Df,Pf,Tf,If,Mf,Rf,zf,Lf,Ff;(Bh=jh||(jh={})).Count="valuecount",Bh.Sum="sum",Bh.Average="average",Bh.DistinctCount="valuecount_distict",Bh.Max="max",Bh.Min="min",(Vh||(Vh={})).ViewAllAnalysis="nes3j6wn",(qh=$h||($h={})).RegisterDashboards="EeKs7CYA",qh.RemoveDashboards="3GKZYOQ9",qh.ViewAllDashboards="wYBdQNvZ",qh.EditDashboards="bMFcbwv4",(Hh=Wh||(Wh={}))[Hh.Default=1]="Default",Hh[Hh.Compact=2]="Compact",(Kh=Gh||(Gh={}))[Kh.FiveSeconds=1]="FiveSeconds",Kh[Kh.TenSeconds=2]="TenSeconds",Kh[Kh.FifteenSeconds=3]="FifteenSeconds",Kh[Kh.ThirtySeconds=4]="ThirtySeconds",Kh[Kh.OneMinute=5]="OneMinute",Kh[Kh.ThreeMinutes=6]="ThreeMinutes",Kh[Kh.FiveMinutes=7]="FiveMinutes",Kh[Kh.TenMinutes=8]="TenMinutes",(Qh=Yh||(Yh={}))[Qh.Day=1]="Day",Qh[Qh.Month=2]="Month",Qh[Qh.Year=3]="Year",(Jh=Xh||(Xh={}))[Jh.Ascending=1]="Ascending",Jh[Jh.Descending=2]="Descending",(ef=Zh||(Zh={}))[ef.Label=1]="Label",ef[ef.Value=2]="Value",(tf=af||(af={}))[tf.LastSevenDays=1]="LastSevenDays",tf[tf.LastWeek=2]="LastWeek",tf[tf.LastMonth=3]="LastMonth",tf[tf.PreviousQuarter=4]="PreviousQuarter",tf[tf.PreviousSemester=5]="PreviousSemester",tf[tf.LastYear=6]="LastYear",tf[tf.SpecificPeriod=7]="SpecificPeriod",tf[tf.CurrentMonth=8]="CurrentMonth",tf[tf.CurrentSemester=9]="CurrentSemester",tf[tf.CurrentWeek=10]="CurrentWeek",tf[tf.CurrentYear=11]="CurrentYear",(nf=rf||(rf={}))[nf.Text=1]="Text",nf[nf.Area=2]="Area",nf[nf.Bar=3]="Bar",nf[nf.Column=4]="Column",nf[nf.StackedColumn=5]="StackedColumn",nf[nf.Line=6]="Line",nf[nf.List=7]="List",nf[nf.Numeric=8]="Numeric",nf[nf.Pareto=9]="Pareto",nf[nf.Pie=10]="Pie",nf[nf.RiskMatrix=11]="RiskMatrix",nf[nf.Burndown=12]="Burndown",nf[nf.PerformanceColumns=13]="PerformanceColumns",nf[nf.EvolutionLine=14]="EvolutionLine",(sf=of||(of={}))[sf.NotUpdate=1]="NotUpdate",sf[sf.FiveMinutes=2]="FiveMinutes",sf[sf.TenMinutes=3]="TenMinutes",sf[sf.FifteenMinutes=4]="FifteenMinutes",sf[sf.ThirtyMinutes=5]="ThirtyMinutes",sf[sf.OneHour=6]="OneHour",(df=lf||(lf={}))[df.NormalPage=1]="NormalPage",df[df.Carousel=2]="Carousel",(uf=cf||(cf={}))[uf.General=0]="General",uf[uf.Share=1]="Share",(pf=mf||(mf={}))[pf.NotShared=1]="NotShared",pf[pf.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",pf[pf.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",(ff=hf||(hf={})).PtBr="pt-br",ff.EnUs="en",ff.EsEs="es",(vf=gf||(gf={}))[vf.Quantity=0]="Quantity",vf[vf.AllRisksList=1]="AllRisksList",(xf=bf||(bf={}))[xf.Five=5]="Five",xf[xf.Ten=10]="Ten",xf[xf.Fifteen=15]="Fifteen",xf[xf.Twenty=20]="Twenty",xf[xf.All=0]="All",xf[xf.Custom=-1]="Custom",(wf=yf||(yf={}))[wf.AlphabeticalAsc=1]="AlphabeticalAsc",wf[wf.AlphabeticalDesc=2]="AlphabeticalDesc",wf[wf.CountAsc=3]="CountAsc",wf[wf.CountDesc=4]="CountDesc",wf[wf.DateAsc=5]="DateAsc",wf[wf.DateDesc=6]="DateDesc",(_f=Nf||(Nf={}))[_f.Loading=0]="Loading",_f[_f.Loaded=1]="Loaded",_f[_f.Error=3]="Error",_f[_f.NoData=4]="NoData",_f[_f.Unavailable=5]="Unavailable",(kf=Cf||(Cf={}))[kf.Quantity=1]="Quantity",kf[kf.Percentage=2]="Percentage",kf[kf.QuantityPercentage=3]="QuantityPercentage",(Af=Sf||(Sf={}))[Af.Program=1]="Program",Af[Af.Project=2]="Project",Af[Af.Action=3]="Action",Af[Af.PerformanceProject=4]="PerformanceProject",Af[Af.PerformanceAction=5]="PerformanceAction",(Df=Ef||(Ef={})).OccurrenceActionPlans="xebGnSSq",Df.OccurrenceGeneral="UFws4AvH",Df.PlansActionPlans="Kux6CcVC",Df.PlansProgramProjects="UWjrp6Dw",Df.PlansIdeas="3g7vNm2w",Df.RisksGeneral="PZ4b6FhP",Df.RisksActionPlans="xZErDg57",Df.RisksAnalysis="UxsioMbH",Df.RisksIncidences="gNt5IJ2F",Df.MetrologyGeneral="4MfEPbRY",Df.MetrologyActivities="hdFM9XQW",Df.MetrologyServiceOrders="cIrVPdMv",Df.DecisionsGeneral="CopsnHDB",Df.DecisionsItems="qLFAayjx",Df.DecisionsActionPlans="RiQFpxdb",Df.FlowGeneral="AFV98JoG",Df.AuditGeneral="gON8LJPi",Df.AuditPlans="SsCNVOvr",Df.AuditPlansItems="OpPkCCFm",Df.AuditActionPlans="P1oGePhh",Df.CommonGeneral="VVfEzgMQ",Df.ActionPlans="C6Z4MgGa",Df.SuppliersEvaluations="fSCeS4mH",Df.SuppliersGeneral="8qPThkrD",Df.SuppliersEvaluationsCriteria="RiSIStdY",Df.SuppliersDocuments="Riua4jMa",Df.SuppliersMaterialsServices="UpEkatXH",Df.DocumentsGeneral="FRhhEX2J",Df.DocumentsPhysicalCopies="PZLtJ23h",Df.DocumentsObsolete="XDjbga14",Df.FmeaGeneral="aPwf4uPr",Df.FmeaActionPlans="vQ8PMrVX",(Tf=Pf||(Pf={}))[Tf.NotShared=1]="NotShared",Tf[Tf.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",Tf[Tf.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",(Mf=If||(If={}))[Mf.All=1]="All",Mf[Mf.OnlyMine=2]="OnlyMine",Mf[Mf.Favorites=3]="Favorites",(zf=Rf||(Rf={}))[zf.Current=1]="Current",zf[zf.Inherent=2]="Inherent",(Ff=Lf||(Lf={}))[Ff.Default=1]="Default",Ff[Ff.Pastel=2]="Pastel",Ff[Ff.Vibrant=3]="Vibrant",Ff[Ff.Earth=4]="Earth",Ff[Ff.Ocean=5]="Ocean",Ff[Ff.Floral=6]="Floral",Ff[Ff.Night=7]="Night",Ff[Ff.Winter=8]="Winter",Ff[Ff.Spring=9]="Spring",Ff[Ff.Summer=10]="Summer",Ff[Ff.Fall=11]="Fall",Ff[Ff.Gray=12]="Gray",Ff[Ff.Brown=13]="Brown",Ff[Ff.Blue=14]="Blue",Ff[Ff.Yellow=15]="Yellow",Ff[Ff.Green=16]="Green",Ff[Ff.Purple=17]="Purple",Ff[Ff.Orange=18]="Orange",Ff[Ff.Pink=19]="Pink",Ff[Ff.Red=20]="Red";const Of={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Uf={advancedFilter:"analysisDashboardsListFilter"},jf=["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"],Bf=["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 Vf(e){return e?.sort((e,a)=>{if(!e?.items?.length||!a?.items?.length)return 0;return $f(e.items[0]?.keyDate)-$f(a.items[0]?.keyDate)})}function $f(e){if(!e)return 0;const[a,t]=e.split("/"),r=Of[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+r}function qf(e){return null==e?.value||""===e.value.trim()}function Wf(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function Hf(e){for(const a of Bf)if(e[a])return e[a];return null}function Gf(e){return e?Kf(e).join("&"):null}function Kf(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(...Kf({[t]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||a.push(`${t}=${r}`))}return a}const Yf=/^-?\d+(,\d{3})*(\.\d+)?$/;function Qf(e){return!!Yf.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))}function Xf(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)}const Jf=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});function Zf(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}const eg=new Set([rf.Text]),ag=new Set([rf.Text,rf.Numeric,rf.RiskMatrix,rf.Burndown,rf.PerformanceColumns]),tg=new Set([rf.Text,rf.RiskMatrix,rf.Burndown,rf.PerformanceColumns]);function rg({config:e,viewOnly:n=!1,complement:o,complementPosition:d="before-options",queryUrlBuilder:c,onRefresh:u,onExport:m,onToggleOnlyMine:p,className:h}){const{t:f}=Ra(),[g,v]=i(e.onlyMine??!1),b=eg.has(e.typeId),x=!ag.has(e.typeId),y=!tg.has(e.typeId),w=s(()=>{if(!e.jsonRules||e.typeId===rf.PerformanceColumns)return!1;try{const a=JSON.parse(e.jsonRules);return a?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),N=s(()=>c?.(e)??"#",[c,e]),_=l(()=>{const e=!g;v(e),p?.(e)},[g,p]),C=[];return g&&C.push(f("dashboard_only_mine")),e.onlyLate&&C.push(f("dashboard_only_overdue")),w&&C.push(f("dashboard_advanced_filter")),t("div",{className:No("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",h),children:[t("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===d&&o,t("div",{className:"flex min-w-0 flex-col",children:[t(Zi,{children:[a(es,{asChild:!0,children:a("span",{className:"block truncate",children:e.title})}),a(as,{children:e.title})]}),C.length>0&&a("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:C.join(" | ")})]}),"after-title"===d&&o]}),!n&&t("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===d&&o,t(Fi,{children:[a(Oi,{asChild:!0,children:a(Ao,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a(ra,{className:"h-3.5 w-3.5"})})}),t(Wi,{align:"end",className:"w-48",children:[e.canUpdate&&t(Hi,{onClick:()=>e.onEdit?.(e.id),children:[a(G,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!b&&t(Hi,{onClick:u,children:[a(ue,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),x&&t(Hi,{disabled:e.noData,onClick:m,children:[a(Je,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!b&&t(Hi,{disabled:!e.openQueryEnabled,onClick:()=>window.open(N,"_blank"),children:[a(pe,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),y&&t(r,{children:[a(Qi,{}),t(Hi,{onClick:_,children:[g&&a(T,{className:"mr-2 h-3.5 w-3.5"}),!g&&a("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t(r,{children:[a(Qi,{}),t(Hi,{onClick:()=>e.onDuplicate?.(e.id),children:[a(me,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t(Hi,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a(H,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===d&&o]})]})}function ng({config:e,queryUrl:r,className:n}){return t("div",{className:No("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a(de,{className:"h-12 w-12 text-muted-foreground/50"}),a("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),a("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t("p",{className:"mt-2 text-xs",children:[r&&a("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),r&&e.canUpdate&&a("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&a("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function og({panelType:e,className:r}){const n=e===rf.Burndown;return t("div",{className:No("flex flex-1 flex-col items-center justify-center gap-2 p-4",r),children:[a(Ri,{className:"h-10 w-10 text-muted-foreground/40"}),n&&a("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function ig({hasRemovedColumn:r=!1,className:n}){return t("div",{className:No("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),a("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function sg({onRemove:e,className:r}){return t("div",{className:No("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a(de,{className:"h-12 w-12 text-muted-foreground/50"}),a("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),a("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&a("p",{className:"mt-2 text-xs",children:a("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const lg={[jh.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[jh.Sum]:"Sum",[jh.Average]:e.t("dashboard_average"),[jh.DistinctCount]:e.t("dashboard_distinct_count"),[jh.Max]:e.t("dashboard_max_value"),[jh.Min]:e.t("dashboard_min_value")};function dg({config:e,state:r,value:n,label:o,viewOnly:i=!1,onClick:s,onRefresh:l,queryUrl:d,queryUrlBuilder:c,className:u}){const{t:m}=Ra(),p=o??lg[e.aggregationType??""]??"",h=function(e,a){if(null==e)return"—";const t=jf.includes(a.field),r=a.aggregationType===jh.Count||a.aggregationType===jh.DistinctCount;return t&&!r?Jf.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(n,e);return t("div",{className:No("flex h-full flex-col",u),children:[a(rg,{config:e,viewOnly:i,onRefresh:l,queryUrlBuilder:c}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&t("div",{className:No("flex flex-1 flex-col items-center justify-center",s&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:s,children:[a("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:h}),p&&a("span",{className:"text-xs text-muted-foreground mt-1",children:p})]}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:d}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function cg({config:e,state:r,htmlContent:n,viewOnly:o=!1,onRefresh:i,queryUrl:s,queryUrlBuilder:l,className:d}){const c=n??e.textTypeString??"";return t("div",{className:No("flex h-full flex-col",d),children:[a(rg,{config:e,viewOnly:o,onRefresh:i,queryUrlBuilder:l}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&a("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),r===Nf.Error&&a(ng,{config:e,queryUrl:s})]})}function ug({config:e,state:r,data:n=[],columns:o=[],viewOnly:i=!1,onRowClick:d,onRefresh:c,onExport:u,queryUrl:m,queryUrlBuilder:p,enableRowLinks:h=!0,className:f}){const g=s(()=>o.filter(e=>!1!==e.visible),[o]),v=l(e=>{if(d)d(e);else if(h){const a=Hf(e);a&&window.open(Wf(a),"_blank")}},[d,h]);return t("div",{className:No("flex h-full flex-col",f),children:[a(rg,{config:e,viewOnly:i,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&a("div",{className:"flex-1 overflow-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:a("tr",{children:g.map(e=>a("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("tbody",{children:n.map((e,t)=>{const r=h&&!!Hf(e);return a("tr",{className:No("border-b border-border/50 transition-colors hover:bg-muted/30",(r||d)&&"cursor-pointer"),onClick:()=>v(e),children:g.map(t=>a("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:t.render?t.render(e[t.columnName],e):mg(e[t.columnName],t)},t.columnName))},t)})})]})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:m}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function mg(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 pg=["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 hg({config:e,variant:r,state:n,data:o=[],series:i,colors:l,categoryKey:d="key",yAxisFormat:c,viewOnly:u=!1,onPointClick:m,onRefresh:p,onExport:h,queryUrl:f,queryUrlBuilder:g,className:v}){const b=l?.length?l:e.hexColors?.length?e.hexColors:pg,x=s(()=>i?.length?i:[{dataKey:"value",name:e.title}],[i,e.title]),y="bar"===r,w="stacked-column"===r,N=s(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t("div",{className:No("flex h-full flex-col",v),children:[a(rg,{config:e,viewOnly:u,onRefresh:p,onExport:h,queryUrlBuilder:g}),n===Nf.Loading&&a(og,{}),n===Nf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(ht,{width:"100%",height:"100%",children:fg({variant:r,data:o,series:x,colors:b,categoryKey:d,isHorizontalBar:y,isStacked:w,yAxisTickFormatter:N,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:m})})}),n===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),n===Nf.Error&&a(ng,{config:e,queryUrl:f}),n===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function fg({variant:e,data:r,series:n,colors:o,categoryKey:i,isHorizontalBar:s,isStacked:l,yAxisTickFormatter:d,tooltipFormatter:c,onPointClick:u}){const m={tick:{fontSize:11},tickLine:!1,axisLine:!1},p=a(ft,{dataKey:s?void 0:i,type:s?"number":"category",...m,angle:s?0:-45,textAnchor:s?"middle":"end",height:s?void 0:60,tickFormatter:s?d:void 0}),h=a(gt,{dataKey:s?i:void 0,type:s?"category":"number",...m,width:s?100:60,tickFormatter:s?void 0:d}),f=a(vt,{strokeDasharray:"3 3",className:"stroke-border/50"}),g=a(bt,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),v=n.length>1?a(xt,{wrapperStyle:{fontSize:"11px"}}):null,b=u?(e,a)=>u(r[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t(yt,{data:r,layout:s?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(wt,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||o[t%o.length],stackId:l?e.stackId||"stack":void 0,radius:l?void 0:[2,2,0,0],onClick:b,cursor:u?"pointer":void 0},e.dataKey))]}):"area"===e?t(Nt,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>{const r=e.color||o[t%o.length];return a(_t,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:u?"pointer":void 0}},e.dataKey)})]}):t(Ct,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(kt,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||o[t%o.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:u?"pointer":void 0}},e.dataKey))]})}const gg=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function vg({config:e,state:r,data:n=[],colors:o,viewOnly:i=!1,onSliceClick:l,onRefresh:d,onExport:c,queryUrl:u,queryUrlBuilder:m,className:p}){const h=o?.length?o:e.hexColors?.length?e.hexColors:gg,f=s(()=>n.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[n]),g=s(()=>f.reduce((e,a)=>e+(a.value??0),0),[f]);return t("div",{className:No("flex h-full flex-col",p),children:[a(rg,{config:e,viewOnly:i,onRefresh:d,onExport:c,queryUrlBuilder:m}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(ht,{width:"100%",height:"100%",children:t(St,{children:[a(At,{data:f,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:a})=>`${e??""}: ${(100*(a??0)).toFixed(0)}%`,labelLine:!0,onClick:l?(e,a)=>l(n[a],a):void 0,cursor:l?"pointer":void 0,children:f.map((e,t)=>a(Et,{fill:h[t%h.length]},t))}),a(bt,{formatter:e=>{const a="number"==typeof e?e:0,t=g>0?(a/g*100).toFixed(1):"0";return`${a.toLocaleString("pt-BR")} (${t}%)`}}),a(xt,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:u}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function bg({config:e,state:r,data:n=[],barColor:o,lineColor:i="#e31a1c",viewOnly:l=!1,onPointClick:d,onRefresh:c,onExport:u,queryUrl:m,queryUrlBuilder:p,className:h}){const f=e.hexColors?.length?e.hexColors:["#1f78b4"],g=o??f[0],v=s(()=>{const e=[...n].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}))},[n]);return t("div",{className:No("flex h-full flex-col",h),children:[a(rg,{config:e,viewOnly:l,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(ht,{width:"100%",height:"100%",children:t(Dt,{data:v,margin:{top:5,right:30,left:0,bottom:5},children:[a(vt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(ft,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a(gt,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a(gt,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a(bt,{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(xt,{wrapperStyle:{fontSize:"11px"}}),a(wt,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:g,radius:[2,2,0,0],onClick:d?(e,a)=>d(n[a],a):void 0,cursor:d?"pointer":void 0}),a(kt,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:i,strokeWidth:2,dot:{r:3,fill:i}})]})})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:m}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function xg({config:e,state:r,data:n=[],executedLabel:o,plannedLabel:i,executedColor:s="hsl(var(--primary))",plannedColor:l="hsl(var(--chart-2))",viewOnly:d=!1,onRefresh:c,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=Ra(),f=o??h("dashboard_work_done"),g=i??h("dashboard_work_planned");return t("div",{className:No("flex h-full flex-col",p),children:[a(rg,{config:e,viewOnly:d,onRefresh:c,queryUrlBuilder:m}),r===Nf.Loading&&a(og,{panelType:rf.Burndown}),r===Nf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(ht,{width:"100%",height:"100%",children:t(Nt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(vt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(ft,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a(gt,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a(bt,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(xt,{wrapperStyle:{fontSize:"11px"}}),a(_t,{type:"monotone",dataKey:"executedPercentage",name:f,stroke:s,fill:s,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a(_t,{type:"monotone",dataKey:"plannedPercentage",name:g,stroke:l,fill:l,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:u}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function yg({config:e,state:r,data:n=[],executedLabel:o,plannedLabel:i,executedColor:s="hsl(var(--primary))",plannedColor:l="hsl(var(--chart-2))",viewOnly:d=!1,onPointClick:c,onRefresh:u,queryUrl:m,queryUrlBuilder:p,className:h}){const{t:f}=Ra(),g=o??f("dashboard_work_done"),v=i??f("dashboard_work_planned");return t("div",{className:No("flex h-full flex-col",h),children:[a(rg,{config:e,viewOnly:d,onRefresh:u,queryUrlBuilder:p}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(ht,{width:"100%",height:"100%",children:t(yt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(vt,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(ft,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a(gt,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a(bt,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(xt,{wrapperStyle:{fontSize:"11px"}}),a(wt,{dataKey:"executedWork",name:g,fill:s,radius:[2,2,0,0],onClick:c?(e,a)=>c(n[a],a):void 0,cursor:c?"pointer":void 0}),a(wt,{dataKey:"plannedWork",name:v,fill:l,radius:[2,2,0,0]})]})})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:m}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}function wg({config:e,state:r,rule:n,risks:o=[],matrixViewType:i=gf.Quantity,viewOnly:l=!1,onCellClick:d,onRiskClick:c,onRefresh:u,queryUrl:m,queryUrlBuilder:p,className:h}){const f=s(()=>[...n?.parametersY??[]].sort((e,a)=>a.position-e.position),[n?.parametersY]),g=n?.parametersX??[],v=s(()=>{const e={};return o.forEach(a=>{const t=`${a.parameterYPosition}-${a.parameterXPosition}`;e[t]||(e[t]=[]),e[t].push(a)}),e},[o]);return t("div",{className:No("flex h-full flex-col",h),children:[a(rg,{config:e,viewOnly:l,onRefresh:u,queryUrlBuilder:p}),r===Nf.Loading&&a(og,{}),r===Nf.Loaded&&n&&a("div",{className:"flex-1 overflow-auto p-4",children:t("div",{className:"flex gap-4 items-stretch min-w-fit",children:[a("div",{className:"flex items-center justify-center",children:a("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:n.name_y})}),t("div",{className:"flex-1",children:[t("div",{className:"flex mb-1",children:[a("div",{className:"w-16 shrink-0"}),a("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:n.threat_strategy_type_name}),!n.disable_opportunities&&a("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:n.opportunity_strategy_type_name})]}),f.map((e,r)=>t("div",{className:"flex",children:[a("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}),g.map((o,s)=>{const l=((e,a)=>v[`${a.position}-${e.position}`]??[])(o,e),u=((e,a)=>n?.colorMatrix?.[a]?.[e]??"hsl(var(--muted))")(s,r);return t("div",{className:No("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(d||c)&&l.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:u},onClick:()=>l.length>0&&d?.(o,e,l),children:[i===gf.Quantity&&l.length>0&&t("span",{className:"text-xs font-semibold",children:[l.length," risco",1!==l.length?"s":""]}),i===gf.AllRisksList&&l.map(e=>t(Zi,{children:[a(es,{asChild:!0,children:a("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:a=>{a.stopPropagation(),c?.(e)},children:e.code})}),t(as,{className:"max-w-[250px]",children:[t("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t("p",{className:"text-xs mt-1",children:["Última análise: ",a("strong",{children:e.analysisDate})]}),e.strategy&&t("p",{className:"text-xs",children:["Estratégia: ",a("strong",{children:e.strategy})]}),e.resultName&&t("p",{className:"text-xs",children:["Criticidade: ",a("strong",{style:{backgroundColor:u},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},o.position)})]},e.position)),t("div",{className:"flex",children:[a("div",{className:"w-16 shrink-0"}),g.map(e=>a("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("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:n.name_x})]})]})}),r===Nf.NoData&&a(ig,{hasRemovedColumn:e.hasRemovedColumn}),r===Nf.Error&&a(ng,{config:e,queryUrl:m}),r===Nf.Unavailable&&a(sg,{onRemove:()=>e.onRemove?.(e.id)})]})}const Ng=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[Ng.Translate.toString(e),Ng.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:r}=e;return a+" "+t+"ms "+r}}});function _g(e){switch(e){case rf.Bar:case rf.Column:case rf.Pie:case rf.List:case rf.Line:case rf.Area:case rf.Text:case rf.StackedColumn:return{x:4,y:2};case rf.Pareto:case rf.RiskMatrix:case rf.Burndown:case rf.PerformanceColumns:return{x:8,y:2};case rf.Numeric:return{x:1,y:1};default:return{x:2,y:2}}}function Cg(e){switch(Number(e)){case rf.Area:case rf.Bar:case rf.Column:case rf.Line:case rf.Numeric:case rf.Pie:case rf.Text:return{x:1,y:1};default:return{x:2,y:2}}}function kg({panel:e,columns:r,cellHeight:n,cellGap:o,allowDragging:i,children:l}){const{attributes:d,listeners:c,setNodeRef:u,transform:m,transition:p,isDragging:h}=Wt({id:e.id,disabled:!i}),f=s(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*n+(e.sizeY-1)*o+"px",transform:Ng.Transform.toString(m),transition:p,zIndex:h?50:void 0,opacity:h?.85:1}),[e,r,n,o,m,p,h]);return t("div",{ref:u,style:f,className:No("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",h&&"shadow-lg ring-2 ring-primary/20"),...d,children:[a("div",{className:No("dashboard-panel-drag-handle",i&&"cursor-grab active:cursor-grabbing"),...i?c:{}}),a("div",{className:"h-full",children:l})]})}function Sg({panels:e,columns:r=8,cellHeight:n=160,cellGap:o=10,allowDragging:d=!1,showGridLines:c=!1,renderPanel:u,onLayoutChange:m,className:p}){const[h,f]=i(e);s(()=>{f(e)},[e]);const g=Ot(Ut(jt,{activationConstraint:{distance:8}})),v=s(()=>0===h.length?1:Math.max(...h.map(e=>e.row+e.sizeY)),[h]),b=s(()=>h.map(e=>e.id),[h]),x=l(e=>{const{active:a,over:t}=e;if(!t||a.id===t.id)return;const r=h.findIndex(e=>e.id===a.id),n=h.findIndex(e=>e.id===t.id);if(-1===r||-1===n)return;const o=[...h],i={...o[r]},s={...o[n]},l=i.col,d=i.row;i.col=s.col,i.row=s.row,s.col=l,s.row=d,o[r]=i,o[n]=s,f(o),m?.(o)},[h,m]),y=s(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${v}, ${n}px)`,gap:`${o}px`}),[r,v,n,o]);return 0===h.length?t("div",{className:No("flex flex-col items-center justify-center py-16 text-center",p),children:[a("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),a("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):a(Bt,{sensors:g,collisionDetection:Vt,onDragEnd:x,children:a($t,{items:b,strategy:qt,children:a("div",{style:y,className:No("relative w-full",c&&"bg-muted/30",p),children:h.map(e=>a(kg,{panel:e,columns:r,cellHeight:n,cellGap:o,allowDragging:d,children:u(e.id)},e.id))})})})}const Ag={[rf.Bar]:"bar",[rf.Column]:"column",[rf.StackedColumn]:"stacked-column",[rf.Area]:"area",[rf.Line]:"line",[rf.EvolutionLine]:"evolution-line"};function Eg({config:e,state:r,data:n,numericValue:o,listColumns:i,cartesianData:s,cartesianSeries:l,burndownData:d,performanceData:c,matrixRule:u,matrixRisks:m,onPanelClick:p}){const h=Ag[e.typeId];if(h)return a(hg,{config:e,variant:h,state:r,data:s,series:l});switch(e.typeId){case rf.Numeric:return a(dg,{config:e,state:r,value:o});case rf.Text:return a(cg,{config:e,state:r});case rf.List:return a(ug,{config:e,state:r,data:n,columns:i??[]});case rf.Pie:return a(vg,{config:e,state:r,data:n});case rf.Pareto:return a(bg,{config:e,state:r,data:n});case rf.Burndown:return a(xg,{config:e,state:r,data:d});case rf.PerformanceColumns:return a(yg,{config:e,state:r,data:c});case rf.RiskMatrix:return a(wg,{config:e,state:r,rule:u,risks:m??[]});default:return t("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function Dg({dashboard:e,panels:r,pages:n,activePageId:o,canEdit:d=!1,isFullscreen:c=!1,isLoading:u=!1,getPanelData:m,onRefresh:p,onToggleFullscreen:h,onToggleFavorite:f,onEdit:g,onShare:v,onAddPanel:b,onEditPanel:x,onRemovePanel:y,onDuplicatePanel:w,onLayoutChange:N,onPageChange:_,toolbarActions:C,className:k}){const{t:S}=Ra(),[A,E]=i(!1),D=e.idViewType===lf.Carousel,P=s(()=>r,[r,D,o]),T=s(()=>P.map(e=>{const a=Cg(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[P]),I=l(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:d,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:x,onRemove:y,onDuplicate:w}),[d,x,y,w]),M=l(()=>{A||u||(E(!0),p?.(),setTimeout(()=>E(!1),3e4))},[A,u,p]),R=l(e=>{const r=P.find(a=>a.id===e);if(!r)return null;const n=I(r),o=m?.(e)??{state:Nf.Loaded};return t("div",{className:"flex flex-col h-full",children:[a(rg,{config:n,onRefresh:()=>{}}),a("div",{className:"flex-1 min-h-0 p-2",children:a(Eg,{config:n,...o})})]})},[P,I,m,d,x,y,w]);return t("div",{className:No("flex flex-col h-full",c&&"fixed inset-0 z-50 bg-background",k),children:[t("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3 min-w-0",children:[a("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!c&&a("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t("div",{className:"flex items-center gap-1",children:[C,p&&a("button",{onClick:M,disabled:A||u,className:No("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:A?S("dashboard_wait_refresh"):"Atualizar",children:a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("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"})})}),h&&a("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:c?S("dashboard_exit_fullscreen"):"Fullscreen",children:a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",c?{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"}:{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"})})}),d&&!c&&v&&a("button",{onClick:v,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:t("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),f&&!c&&a("button",{onClick:f,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?S("dashboard_remove_favorite"):"Favoritar",children:a("svg",{className:No("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("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"})})})]})]}),D&&n&&n.length>1&&a("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:n.map(e=>a("button",{onClick:()=>_?.(e.id),className:No("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",o===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))}),d&&!c&&b&&a("div",{className:"flex justify-center py-3",children:t("button",{onClick:b,className:No("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("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),u&&a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!u&&a("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:a(Sg,{panels:T,allowDragging:d,showGridLines:d,renderPanel:R,onLayoutChange:N})})]})}function Pg(e,a=hf.PtBr){const{t:t}=Ra();switch(a){case hf.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case hf.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function Tg(e){const{t:a}=Ra();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Ig=[{value:If.All,label:"Todos"},{value:If.OnlyMine,label:e.t("dashboard_my")},{value:If.Favorites,label:"Favoritos"}];function Mg({dashboards:e,limit:n,isLoading:o=!1,language:d=hf.PtBr,canAdd:c=!1,canEdit:u=!1,canRemove:m=!1,onOpen:p,onEdit:h,onShare:f,onDuplicate:g,onRemove:v,onAdd:b,onToggleFavorite:x,onRefresh:y,onSearch:w,onQuickFilterChange:N,toolbarExtra:_,className:C}){const{t:k}=Ra(),[S,A]=i(""),[E,D]=i(If.All),[P,T]=i(null),I=l(e=>{A(e),w?.(e)},[w]),M=l(e=>{D(e),N?.(e)},[N]),R=s(()=>{let a=e;if(S){const e=S.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||Pg(a,d).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(E){case If.OnlyMine:break;case If.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,S,E,d]);return t("div",{className:No("flex flex-col h-full",C),children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:[a("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),n&&t("span",{className:"text-xs text-muted-foreground",children:["(",n.countDashboards,"/",n.maxDashboards,")"]})]}),t("div",{className:"flex items-center gap-2",children:[t("div",{className:"relative",children:[t("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("circle",{cx:"11",cy:"11",r:"8"}),a("path",{d:"m21 21-4.3-4.3"})]}),a("input",{type:"text",placeholder:"Buscar...",value:S,onChange:e=>I(e.target.value),className:No("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")})]}),_,c&&b&&t("button",{onClick:b,className:No("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("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),a("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Ig.map(e=>a("button",{onClick:()=>M(e.value),disabled:o,className:No("px-3 py-1.5 text-sm rounded-md transition-colors",E===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))}),o&&a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!o&&a("div",{className:"flex-1 overflow-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t("tr",{children:[a("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:a("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("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("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),a("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),a("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),a("th",{className:"w-12 px-3 py-2"})]})}),t("tbody",{children:[0===R.length&&a("tr",{children:a("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),R.map(e=>t("tr",{onClick:()=>p?.(e),className:No("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[a("td",{className:"px-3 py-2",children:a("button",{onClick:a=>{a.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:a("svg",{className:No("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("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("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),a("td",{className:"px-3 py-2 text-foreground font-medium",children:Pg(e,d)}),a("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),a("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),a("circle",{cx:"9",cy:"7",r:"4"}),a("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),a("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),a("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:Tg(e.lastModified)}),a("td",{className:"px-3 py-2",children:a("span",{className:No("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("td",{className:"px-3 py-2",children:t("div",{className:"relative",children:[a("button",{onClick:a=>{a.stopPropagation(),T(P===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("circle",{cx:"12",cy:"5",r:"1"}),a("circle",{cx:"12",cy:"12",r:"1"}),a("circle",{cx:"12",cy:"19",r:"1"})]})}),P===e.id&&t(r,{children:[a("div",{className:"fixed inset-0 z-40",onClick:()=>T(null)}),t("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("button",{onClick:a=>{a.stopPropagation(),T(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),u&&a("button",{onClick:a=>{a.stopPropagation(),T(null),h?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),u&&a("button",{onClick:a=>{a.stopPropagation(),T(null),f?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),a("button",{onClick:a=>{a.stopPropagation(),T(null),g?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),m&&t(r,{children:[a("div",{className:"my-1 border-t border-border"}),a("button",{onClick:a=>{a.stopPropagation(),T(null),v?.(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 Rg=[{value:of.NotUpdate,label:e.t("dashboard_no_refresh")},{value:of.FiveMinutes,label:"5 minutos"},{value:of.TenMinutes,label:"10 minutos"},{value:of.FifteenMinutes,label:"15 minutos"},{value:of.ThirtyMinutes,label:"30 minutos"},{value:of.OneHour,label:"1 hora"}],zg=[{value:lf.NormalPage,label:e.t("dashboard_normal_page")},{value:lf.Carousel,label:"Carrossel"}],Lg=[{value:Gh.FiveSeconds,label:"5 segundos"},{value:Gh.TenSeconds,label:"10 segundos"},{value:Gh.FifteenSeconds,label:"15 segundos"},{value:Gh.ThirtySeconds,label:"30 segundos"},{value:Gh.OneMinute,label:"1 minuto"},{value:Gh.ThreeMinutes,label:"3 minutos"},{value:Gh.FiveMinutes,label:"5 minutos"},{value:Gh.TenMinutes,label:"10 minutos"}],Fg=[{value:mf.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:mf.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:mf.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Og=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Ug({dashboard:e,initialTab:r=cf.General,isSaving:n=!1,isQualitfy:o=!1,users:d=[],groups:c=[],places:u=[],collaborators:m=[],onSave:p,onCancel:h,className:f}){const{t:g}=Ra(),v=!!e,[b,x]=i(r),[y,w]=i({"pt-br":!!e?.titlePtBr||!v,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[N,_]=i(e?.titlePtBr??""),[C,k]=i(e?.titleEnUs??""),[S,A]=i(e?.titleEsEs??""),[E,D]=i(e?.responsibleId??""),[P,T]=i(e?.isActive??!0),[I,M]=i(e?.idUpdateTime??of.NotUpdate),[R,z]=i(e?.idViewType??lf.NormalPage),[L,F]=i(e?.idPageTime??Gh.FifteenSeconds),[O,U]=i(e?.idShare??mf.NotShared),[j,B]=i(e?.groups??[]),[V,$]=i(e?.places??[]),[q,W]=i(e?.collaborators??[]),H=R===lf.Carousel,G=y["pt-br"]||y.en||y.es,K=s(()=>!!G&&(!(y["pt-br"]&&!N.trim())&&(!(y.en&&!C.trim())&&!(y.es&&!S.trim()))),[G,y,N,C,S]),Y=l(e=>{w(a=>({...a,[e]:!a[e]}))},[]),Q=l(()=>{K&&!n&&p?.({titlePtBr:y["pt-br"]?N:"",titleEnUs:y.en?C:"",titleEsEs:y.es?S:"",responsibleId:E||void 0,isActive:P,idUpdateTime:I,idViewType:R,idPageTime:H?L:null,idShare:O,groups:O===mf.SharedWithUsersGroupsPlacesCollaborators?j:[],places:O===mf.SharedWithUsersGroupsPlacesCollaborators?V:[],collaborators:O===mf.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[K,n,p,y,N,C,S,E,P,I,R,L,H,O,j,V,q]);return t("div",{className:No("flex flex-col h-full bg-background",f),children:[t("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:[a("h2",{className:"text-lg font-semibold text-foreground",children:g(v?"dashboard_edit":"dashboard_new")}),v&&e&&a("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t("div",{className:"flex items-center gap-2",children:[a("button",{onClick:h,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t("button",{onClick:Q,disabled:!K||n,className:No("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:[n?a("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t("div",{className:"flex border-b border-border bg-card",children:[a("button",{onClick:()=>x(cf.General),className:No("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===cf.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a("button",{onClick:()=>x(cf.Share),className:No("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===cf.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t("div",{className:"flex-1 overflow-auto p-6",children:[b===cf.General&&t("div",{className:"max-w-2xl space-y-6",children:[t("div",{className:"space-y-2",children:[a("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),a("div",{className:"flex gap-2",children:Og.map(e=>a("button",{onClick:()=>Y(e.key),className:No("px-3 py-1 text-xs rounded-md border transition-colors",y[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!G&&a("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),y["pt-br"]&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),a("input",{value:N,onChange:e=>_(e.target.value),maxLength:200,className:No("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[N.length,"/200"]})]}),y.en&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),a("input",{value:C,onChange:e=>k(e.target.value),maxLength:200,className:No("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[C.length,"/200"]})]}),y.es&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),a("input",{value:S,onChange:e=>A(e.target.value),maxLength:200,className:No("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")}),t("p",{className:"text-xs text-muted-foreground text-right",children:[S.length,"/200"]})]}),!e?.isStandard&&d.length>0&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t("select",{value:E,onChange:e=>D(e.target.value),disabled:!v,className:No("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("option",{value:"",children:"Selecione..."}),d.map(e=>a("option",{value:e.id,children:e.name},e.id))]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),a("select",{value:I,onChange:e=>M(Number(e.target.value)),disabled:o,className:No("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:Rg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t("div",{className:"flex items-center gap-3 h-10",children:[a("button",{onClick:()=>T(!P),disabled:e?.isGeneralViewUse,className:No("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",P?"bg-primary":"bg-muted","disabled:opacity-50"),children:a("span",{className:No("inline-block h-4 w-4 rounded-full bg-white transition-transform",P?"translate-x-6":"translate-x-1")})}),a("span",{className:"text-sm text-foreground",children:P?"Ativo":"Inativo"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),a("select",{value:R,onChange:e=>z(Number(e.target.value)),disabled:o||H,className:No("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:zg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),H&&t("div",{className:"space-y-1",children:[a("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),a("select",{value:L??"",onChange:e=>F(Number(e.target.value)),className:No("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:Lg.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]})]}),b===cf.Share&&t("div",{className:"max-w-2xl space-y-6",children:[t("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t("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("circle",{cx:"12",cy:"12",r:"10"}),a("path",{d:"M12 16v-4"}),a("path",{d:"M12 8h.01"})]}),a("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),a("div",{className:"space-y-3",children:Fg.map(r=>t("label",{className:No("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",O===r.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[a("input",{type:"radio",name:"shareType",value:r.value,checked:O===r.value,onChange:()=>U(r.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t("div",{children:[a("p",{className:"text-sm font-medium text-foreground",children:r.label}),a("p",{className:"text-xs text-muted-foreground",children:r.description})]})]},r.value))}),O===mf.SharedWithUsersGroupsPlacesCollaborators&&t("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",j.length,")"]}),a("select",{multiple:!0,value:j,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);B(a)},className:No("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:c.map(e=>a("option",{value:e.id,children:e.name},e.id))})]}),t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Locais (",V.length,")"]}),a("select",{multiple:!0,value:V,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);$(a)},className:No("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:u.map(e=>a("option",{value:e.id,children:e.name},e.id))})]}),t("div",{className:"space-y-1",children:[t("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),a("select",{multiple:!0,value:q,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);W(a)},className:No("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:m.map(e=>a("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function jg({dashboards:e,limit:r,generalView:n,language:o=hf.PtBr,isLoading:d=!1,canAdd:c=!1,canEdit:u=!1,canRemove:p=!1,canEditStandard:h=!1,activePanels:f=[],activePages:g=[],getPanelData:v,users:b=[],groups:x=[],places:y=[],collaborators:w=[],isSaving:N=!1,onOpen:_,onBackToList:C,onRefresh:k,onRefreshList:S,onToggleFavorite:A,onSave:E,onUpdate:D,onRemove:P,onDuplicate:T,onShare:I,onAddPanel:M,onEditPanel:R,onRemovePanel:z,onDuplicatePanel:L,onLayoutChange:F,onSearch:O,onQuickFilterChange:U,onSetGeneralView:j,viewState:B,onViewStateChange:V,listToolbarExtra:$,viewToolbarActions:q,className:W}){const[H,G]=i({mode:"list"}),K=B??H,Y=l(e=>{V?V(e):G(e)},[V]),Q=s(()=>"view"===K.mode||"edit"===K.mode||"share"===K.mode?e.find(e=>e.id===K.dashboardId)??null:null,[e,K]),[X,J]=i(!1),[Z,ee]=i(g[0]?.id);m(()=>{g.length>0&&!Z&&ee(g[0]?.id)},[g,Z]),m(()=>{if("view"!==K.mode||!Q||Q.idViewType!==lf.Carousel||g.length<=1)return;const e=function(e){switch(e){case Gh.FiveSeconds:return 5e3;case Gh.TenSeconds:return 1e4;case Gh.FifteenSeconds:return 15e3;case Gh.ThirtySeconds:return 3e4;case Gh.OneMinute:return 6e4;case Gh.ThreeMinutes:return 18e4;case Gh.FiveMinutes:return 3e5;case Gh.TenMinutes:return 6e5;default:return 15e3}}(Q.idPageTime),a=setInterval(()=>{ee(e=>{const a=(g.findIndex(a=>a.id===e)+1)%g.length;return g[a]?.id})},e);return()=>clearInterval(a)},[K,Q,g]);const ae=l(e=>{Y({mode:"view",dashboardId:e.id}),ee(void 0),_?.(e)},[Y,_]),te=l(()=>{Y({mode:"list"}),J(!1),C?.()},[Y,C]),re=l(()=>{Y({mode:"create"})},[Y]),ne=l(e=>{Y({mode:"edit",dashboardId:e.id})},[Y]),oe=l(e=>{Y({mode:"share",dashboardId:e.id})},[Y]),ie=l(e=>{"edit"===K.mode||"share"===K.mode?D?.(K.dashboardId,e):E?.(e)},[K,E,D]),se=l(()=>{"edit"===K.mode||"share"===K.mode?Y({mode:"view",dashboardId:K.dashboardId}):Y({mode:"list"})},[K,Y]),le=l(()=>{Q&&A?.(Q)},[Q,A]),de=l(()=>{Q&&ne(Q)},[Q,ne]),ce=l(()=>{Q&&oe(Q)},[Q,oe]);return t("div",{className:No("flex flex-col h-full",W),children:["list"===K.mode&&a(Mg,{dashboards:e,limit:r,isLoading:d,language:o,canAdd:c,canEdit:u,canRemove:p,onOpen:ae,onEdit:ne,onShare:oe,onDuplicate:T,onRemove:P,onAdd:re,onToggleFavorite:A,onRefresh:S,onSearch:O,onQuickFilterChange:U,toolbarExtra:$,className:"flex-1"}),"view"===K.mode&&Q&&t("div",{className:"flex flex-col h-full",children:[!X&&t("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t("button",{onClick:te,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),n?.dashboardId===Q.id&&t("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:[t("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),a("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),u&&j&&n?.dashboardId!==Q.id&&a("button",{onClick:()=>j(Q.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),a(Dg,{dashboard:Q,panels:f,pages:g,activePageId:Z,canEdit:u||h&&!!Q.isStandard,isFullscreen:X,isLoading:d,getPanelData:v,onRefresh:k,onToggleFullscreen:()=>J(e=>!e),onToggleFavorite:le,onEdit:de,onShare:ce,onAddPanel:M,onEditPanel:R,onRemovePanel:z,onDuplicatePanel:L,onLayoutChange:F,onPageChange:ee,toolbarActions:q,className:"flex-1"})]}),"create"===K.mode&&t("div",{className:"flex flex-col h-full",children:[a("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t("button",{onClick:te,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),a(Ug,{users:b,groups:x,places:y,collaborators:w,isSaving:N,onSave:ie,onCancel:se,className:"flex-1"})]}),("edit"===K.mode||"share"===K.mode)&&Q&&t("div",{className:"flex flex-col h-full",children:[a("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t("button",{onClick:se,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),a(Ug,{dashboard:Q,initialTab:"share"===K.mode?cf.Share:cf.General,users:b,groups:x,places:y,collaborators:w,isSaving:N,isQualitfy:!!Q.isStandard&&!h,onSave:ie,onCancel:se,className:"flex-1"})]})]})}function Bg(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Vg(e,a){return{id:a?.id??Bg(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function $g(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 qg(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>qg(e,a))}:t}function Wg(e,a,t){return qg(e,e=>e.id===a?t(e):e)}function Hg(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Gg(e,a,t){const r=Vg(t||"");let n=r.id;return{root:qg(e,t=>{if(t.id!==a)return t;let o=r;if(t.id===e.id){const a=Hg(e);o={...o,side:a.left<=a.right?"left":"right"}}else o={...o,side:t.side};return n=o.id,{...t,collapsed:!1,children:[...t.children??[],o]}}),newId:n}}function Kg(e,a,t){if(e.id===a)return Gg(e,a,t);const r=$g(e,a);if(!r||!r.parent)return{root:e,newId:a};const n=r.parent,o=Vg(t||"",{side:r.node.side}),i=o.id;return{root:qg(e,e=>{if(e.id!==n.id)return e;const t=(e.children??[]).findIndex(e=>e.id===a),r=[...e.children??[]];return r.splice(t+1,0,o),{...e,children:r}}),newId:i}}function Yg(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=$g(e,a);if(!t||!t.parent)return{root:e,nextSelectedId:null};const r=t.parent,n=r.children??[],o=n.findIndex(e=>e.id===a),i=n[o+1]?.id??n[o-1]?.id??r.id;return{root:qg(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)}),nextSelectedId:i}}function Qg(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const r=$g(e,a);return!!r&&!!$g(r.node,t)}(e,a,t))return e;const r=$g(e,a);if(!r)return e;const n=(()=>{if(t===e.id){const a=Hg(e);return{...r.node,side:a.left<=a.right?"left":"right"}}const a=$g(e,t)?.node;return{...r.node,side:a?.side}})(),o=qg(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return qg(o,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],n]})}function Xg(e,a){return Wg(e,a,e=>({...e,collapsed:!e.collapsed}))}function Jg(e,a){return qg(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function Zg(e){const{value:a,defaultValue:t,onChange:r,readOnly:n}=e,o=void 0!==a,[d,c]=i(()=>t??a??Vg("Mapa Mental",{id:"root"})),m=o?a:d,[p,h]=i(m.id),f=u([]),g=u([]),v=l((e,a)=>{n||(f.current.push(a),f.current.length>50&&f.current.shift(),g.current=[],o||c(e),r?.(e))},[o,r,n]),b=l((e,a)=>{const t=Wg(m,e,e=>({...e,text:a}));v(t,m)},[m,v]),x=l((e,a)=>{const t=Wg(m,e,e=>({...e,...a}));v(t,m)},[m,v]),y=l((e,a="")=>{const{root:t,newId:r}=Gg(m,e,a);return v(t,m),h(r),r},[m,v]),w=l((e,a="")=>{const{root:t,newId:r}=Kg(m,e,a);return v(t,m),h(r),r},[m,v]),N=l(e=>{const{root:a,nextSelectedId:t}=Yg(m,e);a!==m&&(v(a,m),h(t))},[m,v]),_=l((e,a)=>{const t=Qg(m,e,a);t!==m&&v(t,m)},[m,v]),C=l(e=>{const a=$g(m,e);if(!a||!a.node.children?.length)return;const t=Xg(m,e);v(t,m)},[m,v]),k=l(()=>{v(Jg(m,!1),m)},[m,v]),S=l(()=>{v(Jg(m,!0),m)},[m,v]),A=l(()=>{const e=f.current.pop();e&&(g.current.push(m),o||c(e),r?.(e))},[m,o,r]),E=l(()=>{const e=g.current.pop();e&&(f.current.push(m),o||c(e),r?.(e))},[m,o,r]),D=f.current.length>0,P=g.current.length>0,T=s(()=>p?$g(m,p)?.node??null:null,[m,p]),I=l(e=>{v(e,m)},[m,v]);return{root:m,setRoot:I,selectedId:p,selectedNode:T,setSelectedId:h,renameNode:b,updateNodeProps:x,addChild:y,addSibling:w,removeNode:N,moveNode:_,toggleNode:C,expandAll:k,collapseAll:S,undo:A,redo:E,canUndo:D,canRedo:P}}const ev=180,av=80,tv=16,rv=60;function nv(e){const a=(e.collapsed?[]:e.children??[]).map(nv);if(!a.length)return{node:e,visibleChildren:a,height:44};const t=a.reduce((e,a)=>e+a.height,0)+tv*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function ov(e,a,t,r,n,o,i){const s=[],l={node:e.node,parent:a,x:t,y:r,width:180,height:44,side:n,depth:o,visibleChildren:s};if(i.push(l),!e.visibleChildren.length)return l;let d=r+22-(e.visibleChildren.reduce((e,a)=>e+a.height,0)+tv*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===n?t+180+av:t-av-ev,r=d+c.height/2-22,l=ov(c,e.node,a,r,n,o+1,i);s.push(l),d+=c.height+tv}return l}function iv(e){return s(()=>function(e){const a=e.collapsed?[]:e.children??[],t=a.filter(e=>"left"!==e.side).map(nv),r=a.filter(e=>"left"===e.side).map(nv),n=t.reduce((e,a)=>e+a.height,0)+tv*Math.max(0,t.length-1),o=r.reduce((e,a)=>e+a.height,0)+tv*Math.max(0,r.length-1),i=Math.max(n,o,56),s=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(s)):0,l=t.length?Math.max(...t.map(s))+1:0,d=260*(r.length?Math.max(...r.map(s))+1:0),c=220+260*l+d+120,u=i+120,m=rv+d,p=[],h={node:e,parent:null,x:m,y:rv+i/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let f=rv+i/2-n/2;for(const b of t){const a=f+b.height/2-22,t=ov(b,e,m+220+av,a,"right",1,p);h.visibleChildren.push(t),f+=b.height+tv}let g=rv+i/2-o/2;for(const b of r){const a=g+b.height/2-22,t=ov(b,e,m-av-ev,a,"left",1,p);h.visibleChildren.push(t),g+=b.height+tv}const v=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:v,width:c,height:u}}(e),[e])}function sv(e,a){const{layout:t,selectedId:r,setSelectedId:n}=a;if(!r)return void n(t.nodes[0]?.node.id??null);const o=t.byId.get(r);if(!o)return;if("left"===e||"right"===e){if("root"===o.side){const a=o.visibleChildren.find(a=>a.side===e);return void(a&&n(a.node.id))}if(e===o.side){const e=o.visibleChildren[Math.floor(o.visibleChildren.length/2)];e&&n(e.node.id)}else o.parent&&n(o.parent.id);return}if(!o.parent)return;const i=t.byId.get(o.parent.id);if(!i)return;const s=i.visibleChildren.filter(e=>e.side===o.side),l=s.findIndex(e=>e.node.id===r),d="up"===e?s[l-1]:s[l+1];d&&n(d.node.id)}const lv=({layout:e,selected:r,editing:o,readOnly:i,onSelect:s,onStartEditing:l,onFinishEditing:d,onToggle:c,onDragStart:u,onDragOver:m,onDragLeave:p,onDrop:h,isDropTarget:f,renderNodeContent:g})=>{const v=e.node,b="root"===e.side,x=(y=v.icon)?S[y]??null:null;var y;const w=!!v.children?.length,N=n.useRef(null),[_,C]=n.useState(v.text);n.useEffect(()=>{if(o){C(v.text);const e=window.setTimeout(()=>{N.current?.focus(),N.current?.select()},0);return()=>window.clearTimeout(e)}},[o,v.text]);const k=()=>{d(_.trim()||v.text)},A=v.color;return t("div",{role:"treeitem","aria-selected":r,"aria-expanded":w?!v.collapsed:void 0,tabIndex:r?0:-1,"data-node-id":v.id,draggable:!i&&!b&&!o,onDragStart:u,onDragOver:m,onDragLeave:p,onDrop:h,onClick:e=>{e.stopPropagation(),s()},onDoubleClick:e=>{e.stopPropagation(),i||l()},className:No("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",b&&"font-semibold border-primary/40 bg-primary text-primary-foreground",r&&!b&&"ring-2 ring-primary ring-offset-1",r&&b&&"ring-2 ring-primary-foreground/60 ring-offset-1",f&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:A},children:[x&&a(x,{className:No("h-4 w-4 shrink-0",b&&"text-primary-foreground")}),a("div",{className:"flex-1 min-w-0",children:o?a("input",{ref:N,value:_,onChange:e=>C(e.target.value),onBlur:k,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),k()):"Escape"===e.key?(e.preventDefault(),d(null)):e.stopPropagation()},className:No("w-full bg-transparent outline-none text-sm",b&&"text-primary-foreground placeholder:text-primary-foreground/60")}):a("div",g?{className:"text-sm truncate",children:g(v)}:{className:"text-sm truncate",children:v.text||a("span",{className:"opacity-50",children:"—"})})}),v.note&&!o&&t(Zi,{children:[a(es,{asChild:!0,children:a("button",{type:"button",onClick:e=>e.stopPropagation(),className:No("shrink-0 rounded p-0.5 hover:bg-muted/40",b&&"hover:bg-primary-foreground/10"),"aria-label":v.note,children:a(Be,{className:"h-3.5 w-3.5 opacity-70"})})}),a(as,{className:"max-w-xs whitespace-pre-line",children:v.note})]}),w&&a("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:No("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",b&&"border-primary-foreground/30"),"aria-label":v.collapsed?"Expandir":"Colapsar",children:v.collapsed?a(Q,{className:"h-3 w-3"}):"left"===e.side?a(O,{className:"h-3 w-3 rotate-180"}):"right"===e.side?a(O,{className:"h-3 w-3"}):a(na,{className:"h-3 w-3"})})]})},dv=({parent:e,child:t})=>{const r=t.x+t.width/2<e.x+e.width/2,n=r?e.x:e.x+e.width,o=e.y+e.height/2,i=r?t.x+t.width:t.x,s=t.y+t.height/2,l=(n+i)/2;return a("path",{d:`M ${n} ${o} C ${l} ${o}, ${l} ${s}, ${i} ${s}`,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},cv=({label:e,icon:r,onClick:n,disabled:o})=>t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{type:"button",variant:"ghost",size:"icon",onClick:n,disabled:o,"aria-label":e,className:"h-8 w-8",children:r})}),a(as,{children:e})]}),uv=e=>{const{t:r}=Ra();return t("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a(cv,{label:r("mind_map_add_child"),icon:a(oa,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a(cv,{label:r("mind_map_add_sibling"),icon:a(Q,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a(cv,{label:r("mind_map_delete_node"),icon:a(H,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a(Oo,{orientation:"vertical",className:"mx-1 h-5"}),a(cv,{label:r("mind_map_expand_all"),icon:a(ia,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a(cv,{label:r("mind_map_collapse_all"),icon:a(sa,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a(Oo,{orientation:"vertical",className:"mx-1 h-5"}),a(cv,{label:r("mind_map_zoom_out"),icon:a(la,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a(cv,{label:r("mind_map_zoom_in"),icon:a(da,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a(cv,{label:r("mind_map_fit_to_screen"),icon:a(ca,{className:"h-4 w-4"}),onClick:e.onFit}),a(Oo,{orientation:"vertical",className:"mx-1 h-5"}),a(cv,{label:r("mind_map_undo"),icon:a(ua,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a(cv,{label:r("mind_map_redo"),icon:a(ma,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a("div",{className:"flex-1"}),a(cv,{label:r("mind_map_export_json"),icon:a(Je,{className:"h-4 w-4"}),onClick:e.onExportJson}),a(cv,{label:r("mind_map_export_image"),icon:a($e,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function mv(e){return JSON.stringify(e,null,2)}function pv(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=>pv(e)):void 0;return Vg(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 hv(e){return pv(JSON.parse(e))}const fv=({value:e,defaultValue:r,onChange:o,onNodeSelect:s,readOnly:d=!1,hideToolbar:c=!1,extraShortcuts:p,renderNodeContent:h,className:f,height:g=600})=>{const{t:v}=Ra(),b=Zg({value:e,defaultValue:r,onChange:o,readOnly:d}),x=iv(b.root),y=function(){const[e,a]=i({x:0,y:0,scale:1}),t=u(!1),r=u({x:0,y:0,tx:0,ty:0}),n=l(a=>{0!==a.button&&1!==a.button||(t.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=l(e=>{t.current&&a(a=>({...a,x:r.current.tx+(e.clientX-r.current.x),y:r.current.ty+(e.clientY-r.current.y)}))},[]),s=l(e=>{if(t.current){t.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),d=l((e,t,r)=>{a(a=>{const n=Math.min(2.5,Math.max(.3,a.scale+e));if(n===a.scale)return a;if(void 0===t||void 0===r)return{...a,scale:n};const o=n/a.scale;return{scale:n,x:t-(t-a.x)*o,y:r-(r-a.y)*o}})},[]),c=l(()=>d(.15),[d]),p=l(()=>d(-.15),[d]),h=l(()=>a({x:0,y:0,scale:1}),[]),f=l((e,t,r,n)=>{const o=Math.min((r-64)/e,(n-64)/t,1.5),i=Math.max(.3,o);a({scale:i,x:(r-e*i)/2,y:(n-t*i)/2})},[]),g=l(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const a=e.currentTarget.getBoundingClientRect(),t=e.clientX-a.left,r=e.clientY-a.top;d(e.deltaY>0?-.1:.1,t,r)},[d]);return m(()=>{const e=()=>t.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:a,zoomIn:c,zoomOut:p,reset:h,fitTo:f,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:s,onWheel:g}}(),w=n.useRef(null),N=n.useRef(null),_=n.useRef(null),[C,k]=n.useState(null),[S,A]=n.useState(null);n.useEffect(()=>{s?.(b.selectedNode)},[b.selectedNode,s]),function({api:e,layout:a,containerRef:t,onStartEditing:r,readOnly:n,extraShortcuts:o}){m(()=>{const i=i=>{const s=t.current;if(!s)return;if(!s.contains(document.activeElement))return;const l=i.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()===i.key.toLowerCase()&&!!a.ctrl===(i.ctrlKey||i.metaKey)&&!!a.shift===i.shiftKey&&!!a.alt===i.altKey)return i.preventDefault(),void a.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((i.ctrlKey||i.metaKey)&&"z"===i.key.toLowerCase())return i.preventDefault(),void(i.shiftKey?e.redo():e.undo());if("ArrowUp"===i.key)return i.preventDefault(),void sv("up",d);if("ArrowDown"===i.key)return i.preventDefault(),void sv("down",d);if("ArrowLeft"===i.key)return i.preventDefault(),void sv("left",d);if("ArrowRight"===i.key)return i.preventDefault(),void sv("right",d);if(c){if(" "===i.key)return i.preventDefault(),void e.toggleNode(c);if("F2"===i.key){if(n)return;return i.preventDefault(),void r(c)}if(!n){if("Enter"===i.key&&!i.shiftKey)return i.preventDefault(),c===e.root.id?e.addChild(c,""):e.addSibling(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Insert"===i.key||"Tab"===i.key)return i.preventDefault(),e.addChild(c,""),void setTimeout(()=>{e.selectedId&&r(e.selectedId)},0);if("Delete"===i.key||"Backspace"===i.key){if(c===e.root.id)return;return i.preventDefault(),void e.removeNode(c)}}}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e,a,t,r,n,o])}({api:b,layout:x,containerRef:w,onStartEditing:e=>{d||k(e)},readOnly:d,extraShortcuts:p});const E=n.useRef(!1);n.useEffect(()=>{if(E.current)return;const e=N.current;if(!e)return;const{clientWidth:a,clientHeight:t}=e;a>0&&t>0&&x.width>0&&(y.fitTo(x.width,x.height,a,t),E.current=!0)},[x.width,x.height,y]);const D=b.selectedId,P=b.selectedNode,T=D===b.root.id,I=n.useRef(null),M=e=>a=>{if(d)return;const t=I.current;if(!t||t===e)return;const r=$g(b.root,t);r&&$g(r.node,e)||(a.preventDefault(),a.dataTransfer.dropEffect="move",A(e))},R=()=>A(null),z=e=>a=>{a.preventDefault();const t=I.current;A(null),I.current=null,t&&t!==e&&b.moveNode(t,e)};return a(Ji,{children:t("div",{ref:w,tabIndex:0,role:"tree","aria-label":v("mind_map_aria_label"),className:No("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",f),style:{height:g},onClick:()=>w.current?.focus(),children:[!c&&a(uv,{canAddChild:!!P&&!d,canAddSibling:!!P&&!d,canDelete:!!P&&!T&&!d,canUndo:b.canUndo&&!d,canRedo:b.canRedo&&!d,onAddChild:()=>{if(!D)return;const e=b.addChild(D,"");k(e)},onAddSibling:()=>{if(!D)return;if(T){const e=b.addChild(D,"");return void k(e)}const e=b.addSibling(D,"");k(e)},onDelete:()=>{D&&!T&&b.removeNode(D)},onExpandAll:b.expandAll,onCollapseAll:b.collapseAll,onFit:()=>{const e=N.current;e&&y.fitTo(x.width,x.height,e.clientWidth,e.clientHeight)},onZoomIn:y.zoomIn,onZoomOut:y.zoomOut,onUndo:b.undo,onRedo:b.redo,onExportJson:()=>{!function(e,a,t="application/json"){const r=new Blob([e],{type:t}),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}(mv(b.root),"mind-map.json")},onExportImage:async()=>{if(_.current)try{await async function(e,a="mind-map.png"){const t=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(t),n=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,o=new Image;await new Promise((e,a)=>{o.onload=()=>e(),o.onerror=()=>a(new Error("Failed to load SVG snapshot")),o.src=n});const i=e.clientWidth||Number(e.getAttribute("width"))||1200,s=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*i,l.height=2*s;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(o,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)}(_.current,"mind-map.png")}catch(e){}}}),a("div",{ref:N,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(y.onBackgroundPointerDown(e),b.setSelectedId(null))},onPointerMove:y.onPointerMove,onPointerUp:y.onPointerUp,onWheel:y.onWheel,children:t("div",{className:"absolute origin-top-left",style:{transform:`translate(${y.transform.x}px, ${y.transform.y}px) scale(${y.transform.scale})`,width:x.width,height:x.height},children:[a("svg",{ref:_,width:x.width,height:x.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:x.nodes.map(e=>e.visibleChildren.map(t=>a(dv,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),x.nodes.map(e=>{return a(lv,{layout:e,selected:D===e.node.id,editing:C===e.node.id,readOnly:d,onSelect:()=>b.setSelectedId(e.node.id),onStartEditing:()=>k(e.node.id),onFinishEditing:a=>{null!==a&&b.renameNode(e.node.id,a),k(null)},onToggle:()=>b.toggleNode(e.node.id),onDragStart:(t=e.node.id,e=>{d||t===b.root.id||(I.current=t,e.dataTransfer.setData("text/plain",t),e.dataTransfer.effectAllowed="move")}),onDragOver:M(e.node.id),onDragLeave:R,onDrop:z(e.node.id),isDropTarget:S===e.node.id,renderNodeContent:h},e.node.id);var t})]})})]})})},gv=({manager:n,columns:o,onEdit:i,onView:s,onToggleStatus:l,onDelete:d,renderActions:c,customRowActions:u,enableBulkActions:p=!1,onNew:h,newButtonLabel:f,showNewButton:g=!0,customActions:v=[],hideActionBar:b,showActionBar:x=!0,showSearch:y=!1,searchValue:w,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,gridColumns:A=3,renderCard:E,viewMode:D,onViewModeChange:P,listCardRenderer:T,gridCardRenderer:I,showViewToggle:M=!1})=>{const{setSearchVisible:R}=pl(),z=void 0!==b?!b:x;m(()=>{if(!y)return R(!0),()=>R(!1)},[R,y]);const L=h||v.length>0||y||p||S||M,F=k||(()=>{n.bulkDelete?.(n.selectedIds)}),O=D||"grid",U="list"===O,j={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"}[U?1:A],B=z&&L?a(id,{onNew:h,newButtonLabel:f,showNewButton:g,showSearch:y,searchValue:w,onSearchChange:N,searchPlaceholder:_,showBulkActions:p,selectedCount:n.selectedIds.length,bulkActions:C,onBulkDelete:F,onClearSelection:n.clearSelection,customActions:v,filters:S,viewMode:O,onViewModeChange:P,showViewToggle:M,availableViewModes:["list","grid"]}):null;return n.isLoading?t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 overflow-auto p-4",children:a(Al,{count:6})})]}):0===n.entities.length?t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 flex items-center justify-center",children:a(Il,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t("div",{className:"flex flex-col h-full",children:[B,a("div",{className:"flex-1 overflow-auto p-4",children:a("div",{className:No("grid gap-4",j),children:n.entities.map(e=>{const m=(e=>{const{t:a}=Ra();return U&&T?T(e):!U&&I?I(e):E?E(e):null})(e);return t(zl,{children:[a(Ll,{asChild:!0,children:m?a("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:m}):a(Io,{className:No("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",p&&n.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",U&&"flex-row"),onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:t(Lo,{className:No("p-4",U&&"flex items-center gap-4 w-full"),children:[p&&a("div",{className:No(U?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a(sd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),U?t(r,{children:[a("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:o.map(r=>t("div",{className:"flex items-center gap-2 min-w-0",children:[t("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground truncate",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key)))}),(i||s||c)&&a("div",{onClick:e=>e.stopPropagation(),children:c?c(e):a(Xl,{onEdit:i?()=>i(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]}):t("div",{className:"flex items-start gap-3",children:[p&&a("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:a(sd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),t("div",{className:"flex-1 min-w-0",children:[o.map((r,n)=>t("div",{className:No("flex justify-between items-start gap-2",n!==o.length-1&&"mb-2"),children:[t("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[r.header,":"]}),a("div",{className:"text-sm text-foreground text-right truncate",children:r.render?r.render(e):String(e[r.key]??"")})]},String(r.key))),(i||s||c)&&a("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):a(Xl,{onEdit:i?()=>i(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})]})})}),a($l,{className:"w-[160px]",children:a(Ql,{onEdit:i?()=>i(e):void 0,onDelete:d?()=>d(e):void 0,onToggleStatus:l?()=>l(e):void 0,isActive:e.is_actived,canDelete:!!d,customActions:u?u(e):[],renderAs:"context"})})]},e.id)})})})]})};function vv({data:e,columns:r,sortField:n,sortDirection:d,onSort:c,onRowClick:u,renderActions:m,isLoading:p=!1,emptyMessage:h,className:f,enableSelection:g=!1,selectedIds:v=[],onSelectItem:b,onSelectAll:x,isAllSelected:y=!1,enableColumnResize:w=!0,onColumnResize:N,enableColumnReorder:_=!1,onReorderColumns:C,storageKey:k,enableExpandableRows:S=!1,renderExpandedContent:A,expandedRowIds:E,onToggleExpand:P,defaultExpandAll:T=!1,rowActionsVariant:I="default",hideActionsColumn:M=!1,actionsHeaderContent:R}){const{t:z}=Ra(),L=h||z("no_items_found",z("no_items_found_empty")),[F,U]=i(()=>T?new Set(e.map(e=>e.id)):new Set),j=void 0!==E,B=j?new Set(E):F,V=l(e=>{j&&P?P(e):U(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[j,P]),{columnWidths:$,isDragging:q,activeColumn:W,handleMouseDown:H}=ed({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:k?`${k}-columns`:void 0,onResize:N,enabled:w}),G=cd({enabled:_&&!!C,onReorder:C??(()=>{})}),K=s(()=>{if(w){const e=r.map(e=>$[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,w,$]);if(p)return a("div",{className:"flex-1 overflow-auto",children:a("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>a(fs,{className:"h-12 w-full"},t))})});if(0===e.length)return a("div",{className:"flex-1 flex items-center justify-center",children:a("div",{className:"text-center text-muted-foreground",children:a("p",{children:L})})});const Y=m&&!M,Q=(g?1:0)+(S?1:0)+r.length+(Y?1:0);return a("div",{className:"flex-1 overflow-auto "+(q?"select-none":""),children:t(bl,{className:No("table-fixed w-full",f),children:[a(xl,{className:"sticky top-0 bg-background z-10",children:t(Nl,{children:[S&&a(_l,{className:"w-[40px]"}),g&&a(_l,{className:"w-[40px]",children:a(Di,{checked:y,onCheckedChange:x,"aria-label":z("select_all","Selecionar todos")})}),r.map((e,r)=>{const o=w&&!1!==e.resizable,i=W===String(e.key),s=_&&!!C,l=s?G.getDragProps(r):{},u=G.dragFromIndex===r,m=G.dragOverIndex===r&&G.dragFromIndex!==r;return t(_l,{className:No(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",s&&G.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:K[r]},...l,children:[!1!==e.sortable&&c?t("button",{onClick:()=>c(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),n!==p?null:a("asc"===d?re:ne,{size:14,className:"ml-1"}))]}):a("span",{className:"font-medium",children:e.header}),o&&a(Rl,{direction:"horizontal",onMouseDown:a=>H(String(e.key),a),isDragging:i})]},String(e.key));var p}),Y&&a(_l,{className:"w-[80px] text-right",children:R??z("actions","Ações")})]})}),a(yl,{children:e.map(e=>{const n=S&&B.has(e.id);return t(o.Fragment,{children:[t(Nl,{onClick:()=>u?.(e),className:No(u?"cursor-pointer":"","relative","inline"===I&&"group"),children:[S&&a(Cl,{className:"w-[40px] px-2",children:a("button",{onClick:a=>{a.stopPropagation(),V(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":n?z("collapse_row","Recolher linha"):z("expand_row","Expandir linha"),children:a(n?D:O,{size:16,className:"text-muted-foreground"})})}),g&&a(Cl,{children:a(Di,{checked:v.includes(e.id),onCheckedChange:()=>b?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${z("select_all","Selecionar todos")} ${e.id}`})}),r.map(t=>a(Cl,{className:t.className,children:a(Ml,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),Y&&a(Cl,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===I?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:m(e)}):m(e)})]}),n&&A&&a(Nl,{className:"bg-muted/30 hover:bg-muted/30",children:a(Cl,{colSpan:Q,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:A(e)})})})]},e.id)})})]})})}function bv({onEdit:e,onDelete:r,onToggleStatus:n,isActive:o=!0,canEdit:i=!0,canDelete:l=!0,customActions:d=[],renderAs:c="dropdown",variant:u="default"}){const{t:m}=Ra(),p=s(()=>{const a=[];return e&&i&&a.push({key:"edit",icon:$,label:m("edit","Editar"),onClick:e,variant:"default"}),n&&a.push({key:"toggle-status",icon:o?q:W,label:o?m("deactivate","Inativar"):m("activate","Ativar"),onClick:n,variant:"default"}),d.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&&l&&a.push({key:"delete",icon:H,label:m("remove","Remover"),onClick:r,variant:"destructive"}),a},[e,r,n,o,i,l,d,m]);return 0===p.length?null:"dropdown"===c?a(Ji,{delayDuration:200,children:t(Fi,{children:[a(Oi,{asChild:!0,children:a(Ao,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a(A,{size:"compact"===u?14:16})})}),a(Wi,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t(ts,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t(Hi,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&a(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):a("div",{className:"flex items-center gap-1",children:p.map(e=>t(Ao,{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(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&a("span",{className:"ml-1",children:e.label})]},e.key))})}function xv({searchValue:e="",onSearchChange:r,customFilters:n=[],onClearFilters:o,showClearButton:i=!0,layout:s="horizontal"}){const{t:l}=Ra(),d=e||n.length>0;return t("div",{className:`flex ${"vertical"===s?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[r&&t("div",{className:"relative flex-1 min-w-[200px]",children:[a(B,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(Do,{type:"text",placeholder:l("search","Pesquisar"),value:e,onChange:e=>r(e.target.value),className:"pl-9 h-9"})]}),n.map((e,t)=>a("div",{className:"vertical"===s?"w-full":"",children:e},t)),i&&d&&o&&t(Ao,{variant:"ghost",size:"sm",onClick:o,className:"h-9 px-3 whitespace-nowrap",children:[a(E,{size:14,className:"mr-1"}),l("clear_filters","Limpar filtros")]})]})}function yv(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 n of t){if(n.id===a)return r(n.children),!0;if(n.children&&e(n.children))return!0}return!1}(e),t}function wv({children:e,itemId:t,enableDrag:r,onDragStartCell:n,onDragEndCell:o,onDragOverCell:i,onDropCell:s,className:l}){return a(Cl,{draggable:r,onDragStart:r?e=>n(t,e):void 0,onDragEnd:r?o:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),i(t,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),i(t,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),s(t,e)},className:l,children:e})}function Nv({item:e,level:n,columns:o,nameKey:i,iconComponent:s,expandedIds:l,onToggleExpand:d,onRowClick:c,renderActions:u,rowActionsVariant:m="default",enableSelection:p,selectedIds:h,onSelectItem:f,enableRowDrag:g,draggedId:v,dragOverId:b,onDragStartCell:x,onDragEndCell:y,onDragOverCell:w,onDropCell:N,dragCount:_}){const C=l.has(e.id),k=(e.children?.length??0)>0,S=24*n,A="inline"===m,E=v===e.id||h?.has(e.id)&&v&&h?.has(v),P=b===e.id&&v!==e.id,T=h?.has(e.id)??!1,I={itemId:e.id,enableDrag:g,onDragStartCell:x,onDragEndCell:y,onDragOverCell:w,onDropCell:N};return t(r,{children:[t(Nl,{className:No(c&&"cursor-pointer",A&&"group",E&&"opacity-40",P&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:c?()=>c(e):void 0,children:[a(wv,{...I,children:t("div",{className:"flex items-center gap-2",style:{paddingLeft:`${S}px`},children:[p&&a(Di,{checked:T,onCheckedChange:()=>f?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),g&&a("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),k?a("button",{onClick:a=>{a.stopPropagation(),d(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:a(C?D:O,{className:"h-4 w-4"})}):a("div",{className:"w-6 shrink-0"}),s??a(ge,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a("span",{className:"truncate",children:String(e[i]??e.id)}),v===e.id&&_&&_>1&&a("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:_})]})}),o.map(r=>{const o=e[r.key],i=r.render?r.render(e,n):null!=o?String(o):"—";return a(wv,{...I,className:No("text-center",r.className),children:r.hoverContent?t(zu,{openDelay:200,children:[a(Lu,{asChild:!0,children:a("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:i})}),a(Fu,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):i},String(r.key))}),u&&a(wv,{...I,className:"text-right",children:a("div",{onClick:e=>e.stopPropagation(),className:No("flex items-center justify-end gap-1",A&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:u(e)})})]}),k&&C&&e.children.map(e=>a(Nv,{item:e,level:n+1,columns:o,nameKey:i,iconComponent:s,expandedIds:l,onToggleExpand:d,onRowClick:c,renderActions:u,rowActionsVariant:m,enableSelection:p,selectedIds:h,onSelectItem:f,enableRowDrag:g,draggedId:v,dragOverId:b,onDragStartCell:x,onDragEndCell:y,onDragOverCell:w,onDropCell:N,dragCount:_},e.id))]})}function _v({onDrop:r,isDragOver:n,onDragOver:o,onDragLeave:i,label:s}){return t("div",{className:No("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",n?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:o,onDragEnter:o,onDragLeave:i,onDrop:r,children:[a(pa,{className:"h-4 w-4"}),s??e.t("leadership_make_root_short")]})}function Cv({data:r,columns:n,nameKey:s,nameHeader:d=e.t("ap_name"),iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,actionsHeader:g="",rowActionsVariant:v="default",isLoading:b,emptyMessage:x="Nenhum registro encontrado.",className:y,enableSelection:w,selectedIds:N,onSelectItem:_,onSelectAll:C,isAllSelected:k,enableRowDrag:S,onMoveNode:A,onMoveNodes:E,rootDropLabel:D,actionsWidth:P=20,nameMinWidth:T=200}){const[I,M]=i(null),[R,z]=i(null),[L,F]=i(!1),[O,U]=i(1),j=u(null),B=u([]),V=u(null),$=o.useMemo(()=>new Set(N??[]),[N]),q=o.useMemo(()=>{if(!I||!r)return new Set;const e=B.current.length>0?B.current:[I],a=function(e,a){const t=new Set;for(const r of a)yv(e,r).forEach(e=>t.add(e));return t}(r,e);return e.forEach(e=>a.add(e)),a},[I,r]),W=u(q);W.current=q;const H=l(()=>{j.current=null,B.current=[],V.current=null,M(null),z(null),F(!1),U(1)},[]),G=l((e,a)=>{e.length>1&&E?E(e,a):1===e.length&&A?.(e[0],a)},[A,E]),K=l((e,a)=>{const t=$.has(e)&&$.size>1?Array.from($):[e];j.current=e,B.current=t,V.current=null,M(e),U(t.length),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",e),a.dataTransfer.setData("application/x-tree-ids",JSON.stringify(t))},[$]),Y=l((e,a)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",W.current.has(e)?z(null):(V.current=e,z(e))},[]),Q=l((e,a)=>{a.preventDefault(),a.stopPropagation();const t=W.current.has(e)?V.current:e;if(!t)return void H();let r=B.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)||G(r,t),H()},[G,H]),X=l(e=>{e.preventDefault(),e.stopPropagation();let a=B.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?(G(a,null),H()):H()},[G,H]),J=l(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",F(!0)},[]),Z=l(e=>{S&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[S]),ee=l(e=>{if(!S)return;const a=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),t=a?.dataset?.treeRowId??V.current;t&&Q(t,e)},[S,Q]);if(b)return a("div",{className:"flex items-center justify-center py-12",children:t("div",{className:"text-center space-y-2",children:[a("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),a("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[a(ge,{className:"h-10 w-10 text-muted-foreground/50"}),a("p",{className:"text-sm text-muted-foreground",children:x})]});const ae=null!==I;return t("div",{className:No("border rounded-lg overflow-hidden relative",y),onDragOver:Z,onDrop:ee,onDragLeave:S?e=>{const a=e.relatedTarget;a&&e.currentTarget.contains(a)||(z(null),F(!1))}:void 0,children:[S&&ae&&a(_v,{onDrop:X,isDragOver:L,onDragOver:J,onDragLeave:()=>F(!1),label:D}),t(bl,{children:[a(xl,{children:t(Nl,{children:[a(_l,{className:"text-left",style:{minWidth:T},children:t("div",{className:"flex items-center gap-2",children:[w&&a(Di,{checked:k??!1,onCheckedChange:()=>C?.()}),d]})}),n.map(e=>a(_l,{className:No("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),f&&a(_l,{className:"text-right",style:{width:P},children:g})]})}),a(yl,{children:r.map(e=>a(Nv,{item:e,level:0,columns:n,nameKey:s,iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,rowActionsVariant:v,enableSelection:w,selectedIds:$,onSelectItem:_,enableRowDrag:S,draggedId:I,dragOverId:R,onDragStartCell:K,onDragEndCell:H,onDragOverCell:Y,onDropCell:Q,dragCount:O},e.id))})]})]})}function kv(e){const a=Wa();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)}}}function Sv(e,a){const t=kv({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}}const Av=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],Ev=({open:e,onOpenChange:r,user:n,userPhotoUrl:o,userInitials:s})=>{const{t:l,i18n:d}=Ra(),c=u(null),[m,p]=i(null),[h,f]=i(d.language||"pt-BR"),g=m||o,v=e=>{e||(p(null),f(d.language||"pt-BR")),r(e)};return a(Qo,{open:e,onOpenChange:v,children:t(ti,{className:"sm:max-w-md",children:[a(ri,{children:a(ii,{children:l("edit_profile","Editar Perfil")})}),t("div",{className:"space-y-6 py-4",children:[t("div",{className:"flex items-center gap-4",children:[a("div",{className:"relative flex-shrink-0",children:t(su,{className:"w-24 h-24",children:[g&&a(lu,{src:g,alt:n.name||""}),a(du,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:s})]})}),t("div",{className:"space-y-1",children:[n.name&&a("p",{className:"text-base font-semibold",children:n.name}),n.email&&a("p",{className:"text-sm text-muted-foreground",children:n.email}),t(Ao,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a(ha,{className:"mr-2 h-4 w-4"}),l("change_photo","Trocar foto")]}),a("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);p(t)}})]})]}),t("div",{className:"space-y-2",children:[a(To,{children:l("language","Idioma")}),t(xi,{value:h,onValueChange:f,children:[a(Ni,{children:a(wi,{})}),a(ki,{children:Av.map(e=>a(Ai,{value:e.value,children:e.label},e.value))})]})]})]}),t(oi,{children:[a(Ao,{variant:"outline",onClick:()=>v(!1),children:l("cancel","Cancelar")}),a(Ao,{onClick:()=>{h!==d.language&&d.changeLanguage(h),r(!1)},children:l("save","Salvar")})]})]})})},Dv="true"===import.meta.env.VITE_SHOW_EDIT_PROFILE,Pv=o.memo(({variant:e="card",className:n="",selectedUnit:l,onUnitChange:d})=>{const{t:c}=Ra(),{user:u,companies:m,alias:p,isAuthenticated:h,logout:f,switchUnit:g}=pl(),{role:v}=qc(),b=v?.name||null,x=m?.[0]||null,y=p?m?.find(e=>e.alias===p):x,w=m||[],N=l||y||x||x,_=s(()=>{if(!u?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${u.id}/${e}/1?size=48`},[u?.id]),C=s(()=>{if(!u?.name)return"";const e=u.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[u?.name]),k=o.useCallback(e=>{d?d(e):g(e)},[d,g]),S=o.useMemo(()=>{if(!w?.length)return[];const e=new Map;w.forEach(a=>{e.set(a.alias,a)});const a=Array.from(e.values()),t=a.find(e=>e.alias===N?.alias),r=a.filter(e=>e.alias!==N?.alias);return r.sort((e,a)=>(e.name||"").localeCompare(a.name||"","pt-BR",{sensitivity:"base"})),t?[t,...r]:r},[w,N?.alias]),[A,E]=i(!1);if(!h||!u)return null;return"dropdown"===e?t(r,{children:[t(Fi,{children:[a(Oi,{asChild:!0,children:a(Ao,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${n}`,children:t("div",{className:"flex items-center space-x-2",children:[t("div",{className:"hidden md:block text-right",children:[t("p",{className:"text-sm font-medium",children:[u.name?.split(" ")[0],b?` [${b}]`:""]}),a("p",{className:"text-xs text-primary-foreground/70",children:N?.name||"N/A"})]}),t(su,{className:"w-8 h-8 border border-primary-foreground/30",children:[_&&a(lu,{src:_,alt:u.name||c("user_photo")}),a(du,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||a(ge,{className:"h-4 w-4"})})]}),a(D,{className:"h-4 w-4"})]})})}),t(Wi,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t(Bi,{children:[t($i,{children:[a(ue,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a(qi,{children:S.map(e=>t(Hi,{onClick:()=>k(e),className:e.alias===N?.alias?"bg-muted":"",children:[a(fe,{className:"mr-2 h-4 w-4"}),e.name,e.alias===N?.alias&&a(Ii,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Dv&&t(r,{children:[a(Qi,{}),t(Hi,{onClick:()=>E(!0),children:[a(fa,{className:"mr-2 h-4 w-4"}),c("edit_profile","Editar Perfil")]})]}),a(Qi,{}),t(Hi,{onClick:f,children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),Dv&&a(Ev,{open:A,onOpenChange:E,user:u,userPhotoUrl:_,userInitials:C})]}):t(Io,{className:n,children:[a(Mo,{children:a(Ro,{className:"text-lg",children:c("user_info")})}),t(Lo,{className:"space-y-4",children:[a(()=>t(r,{children:[t("div",{className:"flex items-center space-x-3",children:[a("div",{className:"flex-shrink-0",children:t(su,{className:"w-10 h-10",children:[_&&a(lu,{src:_,alt:u.name||c("user_photo")}),a(du,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||a(ge,{className:"h-5 w-5"})})]})}),t("div",{className:"flex-1 min-w-0",children:[a("p",{className:"text-sm font-medium truncate",children:u.name}),t("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",N?.name||"N/A"]})]})]}),N&&a("div",{className:"mt-3",children:t("div",{className:"flex items-center space-x-2",children:[a(fe,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-sm font-medium",children:N.name})]})}),S.length>1&&t("div",{className:"mt-2",children:[t("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>a(Ii,{variant:e.alias===N?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t(Ii,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]}),{}),a(Oo,{}),t(Ao,{variant:"outline",onClick:f,size:"sm",className:"w-full",children:[a(ve,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),Tv=d({});function Iv({children:e,config:t}){const r=s(()=>{const e=Qt(),a=t?.appName?e?`${t.appName} (Dev)`:t.appName:void 0;return{navigation:t?.navigation,appName:a}},[t?.navigation,t?.appName]);return a(Tv.Provider,{value:r,children:e})}function Mv(){return c(Tv)}function Rv(){const e=Ha(),{navigation:a}=Mv();return zv(a,e.pathname)}function zv(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 Lv(e,a){const[t,r]=i(e),n=u(),o=l(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return m(()=>(o(),n.current=setTimeout(()=>{r(e)},a),o),[e,a,o]),[t,o]}function Fv({appName:e}){const[n,o]=i(!1);return t(r,{children:[t("div",{className:"flex items-center justify-between w-[258px]",children:[a("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>o(!0),children:a("img",{src:cr.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&a("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:()=>o(!0),children:a("span",{className:"line-clamp-2",children:(e=>{const n=e.split(" ");if(n.length<=1)return t("span",{className:"whitespace-nowrap",children:[e," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const o=n[n.length-1],i=n.slice(0,-1).join(" ");return t(r,{children:[i," ",t("span",{className:"whitespace-nowrap",children:[o," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]}),a(Hc,{open:n,onOpenChange:o})]})}const Ov=p(function({actions:r}){const n=Ha(),o=Wa(),{navigation:s,appName:d}=Mv(),c=zv(s,n.pathname),{metadata:u,headerActions:p}=Zd(),{setOpenMobile:h}=Bm(),{companies:f,alias:g,isSearchVisible:v,clearSearch:b,refreshData:x,switchUnit:y}=pl(),w=g?f?.find(e=>e.alias===g)||f?.[0]||null:f?.[0]||null,[N,_]=$a(),C=l(e=>{const{pathname:a,search:t,hash:r}=n;if(g){const n=a.split("/"),i=n.indexOf(g);if(i>=0)return n[i]=e.alias,void o(n.join("/")+t+r)}y(e)},[g,n,o,y]),[k,S]=i(()=>N.get("search")||""),[A,D]=Lv(k,Zt.debounceDelay);m(()=>{if(!v)return;const e=new URLSearchParams(N);A?(e.set("search",A),e.set("page","1")):e.delete("search"),_(e)},[A,_,v]);const P=s?.find(e=>e.path===n.pathname)||s?.find(e=>n.pathname.startsWith(e.path+"/")),T=u.title||c,I=u.subtitle||P?.complementaryText||"";return a("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t("div",{className:"flex items-center gap-4",children:[a(Ao,{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:()=>h(!0),children:a(ga,{size:20})}),a("div",{className:"hidden md:flex items-center flex-shrink-0",children:a(Fv,{appName:d})}),a("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t("div",{className:"flex-shrink-0",children:[u.breadcrumbs&&u.breadcrumbs.length>0&&a("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:u.breadcrumbs.map((e,r)=>t("span",{className:"flex items-center gap-1",children:[r>0&&a(O,{className:"h-3 w-3"}),e.href?a(Ka,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):a("span",{children:e.label})]},r))}),a("div",{className:"flex items-center gap-2 mb-1",children:a("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:T})}),I&&a("div",{className:"text-sm text-primary-foreground/70 truncate",children:I})]}),v&&t("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t("div",{className:"relative flex-1",children:[a(B,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(Do,{placeholder:"Pesquisar",value:k,onChange:e=>{return a=e.target.value,void S(a);var a},className:"w-full pl-10 pr-8"}),k&&a(Ao,{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:()=>{D(),S("");const e=new URLSearchParams(N);e.delete("search"),e.delete("page"),_(e)},title:e.t("clear_search"),children:a(E,{size:14})})]}),a(Ao,{variant:"outline",size:"sm",onClick:x,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(ue,{size:14})})]}),t("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(p||r)&&a("div",{className:"flex items-center gap-2",children:p||r}),import.meta.env.VITE_WIKI_URL&&a(Ao,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>yo(import.meta.env.VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a(lh,{}),a("div",{className:"text-sm",children:a(Pv,{variant:"dropdown",selectedUnit:w,onUnitChange:C})})]})]})})}),Uv=({key:e,enabled:a,checkFn:t,staleTime:r=3e5,gcTime:n=6e5})=>Ua({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:r,gcTime:n,retry:0,refetchOnWindowFocus:!1});function jv({config:e,isCollapsed:n=!1,isDisabled:o=!1,className:i}){const{t:s}=Ra(),{actions:l,triggerLabel:d="Criar",triggerIcon:c=Q,variant:u="button"}=e;if(!l||0===l.length)return null;if("split-button"===u){const e=l[0],r=e.icon||c,s=l.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(n){const n=a(Ao,{onClick:e.onClick,disabled:o||e.disabled,className:No("justify-center px-2 w-full",i),variant:"outline",size:"default",children:a(r,{className:"h-4 w-4 shrink-0"})});return t(Zi,{children:[a(es,{asChild:!0,children:n}),a(as,{side:"right",children:a("p",{children:e.label})})]})}return a(Yp,{label:e.label,onClick:e.onClick,icon:r,actions:s,variant:"outline",disabled:o||e.disabled,className:No("w-full",i),menuAlign:"start"})}const m=(e,o,i=!1)=>t(r,{children:[e,!n&&o&&a("span",{className:"truncate",children:o}),!n&&i&&a(D,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(l.length>1)){const e=l[0],r=e.icon||c,s=o||e.disabled,d=a(Ao,{onClick:e.onClick,disabled:s,className:No("w-full gap-2 justify-start",n&&"justify-center px-2",i),variant:"outline",size:"default",children:m(a(r,{className:"h-4 w-4 shrink-0"}),e.label)});return n?t(Zi,{children:[a(es,{asChild:!0,children:d}),a(as,{side:"right",children:a("p",{children:e.label})})]}):d}const p=a(Ao,{disabled:o,className:No("w-full gap-2 justify-start",n&&"justify-center px-2",i),variant:"outline",size:"default",children:m(a(c,{className:"h-4 w-4 shrink-0"}),d,!0)});return t(Fi,{children:[a(Oi,{asChild:!0,children:n?t(Zi,{children:[a(es,{asChild:!0,children:p}),a(as,{side:"right",children:a("p",{children:d})})]}):p}),a(Wi,{align:"start",side:n?"right":"bottom",className:"w-56 bg-popover",children:l.map(e=>{const r=e.icon;return t(Hi,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Bv="forlogic-sidebar-pinned",Vv=()=>{try{const e=localStorage.getItem(Bv);return!!e&&JSON.parse(e)}catch{return!1}};function $v({direction:e="right",minWidth:a=224,maxWidth:t=384,defaultWidth:r=290,storageKey:n="sidebar-width",onResize:o,isOpen:s=!0}={}){const[d,c]=i(()=>{if("undefined"==typeof window)return r;const e=localStorage.getItem(n);return e?parseInt(e):r}),[p,h]=i(!1),f=u(null);m(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(s?e.style.setProperty("--sidebar-width",`${d}px`):e.style.setProperty("--sidebar-width","290px"))},[d,s]);const g=l(e=>{e.preventDefault(),h(!0)},[]);return m(()=>{if(!p)return;const r=r=>{let n;n="left"===e?window.innerWidth-r.clientX:r.clientX,n=Math.max(a,Math.min(t,n)),c(n),o?.(n)},i=()=>{h(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",i),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i)}},[p,e,a,t,d,n,o]),m(()=>(p?(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=""}),[p,e]),{width:d,isDragging:p,dragRef:f,handleMouseDown:g}}const qv=d(void 0);function Wv({children:e}){const[t,r]=i(new Set),[n,o]=i(!1),d=l(e=>{r(a=>{const t=new Set(a);return t.add(e),t})},[]),c=l(e=>{r(a=>{const t=new Set(a);return t.delete(e),t})},[]),u=l(e=>{o(e)},[]),m=s(()=>t.size>0||n,[t,n]),p=s(()=>({openModals:t,hasOpenModal:m,registerModal:d,unregisterModal:c,setHasOpenModal:u}),[t,m,d,c,u]);return a(qv.Provider,{value:p,children:e})}function Hv(){const e=c(qv);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Gv(){const{hasOpenModal:e}=Hv();return e}function Kv({config:e,customContent:r,resizable:n=!1,minWidth:o=224,maxWidth:s=384}={}){const{t:d}=Ra(),{open:c,setOpen:u,setOpenMobile:p}=Bm(),h=Ha(),{alias:f,user:g}=pl(),{appName:v}=Mv(),{hasOpenModal:b}=Hv(),[x,y]=i(Vv),w=vl(),N=!!w||c,_=l(()=>{w&&p(!1)},[w,p]),C=n?$v({minWidth:o,maxWidth:s,storageKey:"app-sidebar-width",isOpen:c}):null;m(()=>{u(!!x)},[x,u]);const k=e=>h.pathname===e||h.pathname.startsWith(e+"/");return t($m,{collapsible:"icon",className:No("app-sidebar bg-background border-r border-border flex flex-col",N?"px-3":"px-1.5"),style:C&&N?{width:`${C.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&a("div",{className:"py-3",children:a(Ji,{children:a(jv,{config:e.moduleActions,isCollapsed:!N,isDisabled:b})})}),a(Xm,{className:No(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||a(Jm,{className:"p-0",children:a(ap,{children:a(tp,{className:"gap-1",children:a(Ji,{children:e?.navigation?.map((e,r)=>{if("separator"===e.type)return a(Qm,{className:"my-2"},`sep-${r}`);const n=({item:e,index:r})=>{const o=`${e.path}-${r}-${f??"noalias"}-${g?.id??"nouser"}`,{data:i=!0,isLoading:s}=Uv({key:o,enabled:Boolean(e.permissionCheck&&f&&g?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!i,c=s?I:l?He:e.icon;l?d("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?N?a(fc,{defaultOpen:!0,className:"group/collapsible",children:t(rp,{children:[a(gc,{asChild:!0,children:a(op,{size:"default",children:t("div",{className:"flex w-full items-center gap-3",children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4"})}),a("span",{className:"font-medium sidebar-text",children:e.label}),a(O,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),a(vc,{children:a(dp,{children:e.children.map((e,t)=>a(n,{item:e,index:t},e.path))})})]})},e.path):a(rp,{children:t(Zi,{children:[a(es,{asChild:!0,children:a("div",{className:No("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(c,{className:"h-4 w-4"})})}),a(as,{side:"right",children:a("p",{children:e.label})})]})},e.path):a(rp,{children:l||s?t(Zi,{children:[a(es,{asChild:!0,children:N?a(op,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t("div",{className:"flex w-full items-center gap-3",children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4 "+(s?"animate-spin":"")})}),a("span",{className:"font-medium sidebar-text",children:e.label})]})}):a("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(c,{className:"h-4 w-4 "+(s?"animate-spin":"")})})}),a(as,{side:"right",children:a("p",{children:s?"Verificando acesso...":d("restricted_access")})})]}):N?a(op,{asChild:!0,isActive:k(e.path),size:"default",children:t(Ka,{to:e.path,className:"flex w-full items-center gap-3",onClick:_,children:[a("span",{className:"flex items-center justify-center h-8 w-8",children:a(c,{className:"h-4 w-4"})}),a("span",{className:"font-medium sidebar-text",children:e.label})]})}):t(Zi,{children:[a(es,{asChild:!0,children:a(Ka,{to:e.path,onClick:_,className:No("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",k(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:a(c,{className:"h-4 w-4"})})}),a(as,{side:"right",children:a("p",{children:e.label})})]})},e.path)};return a(n,{item:e,index:r},e.path)})})})})})}),!w&&a("div",{className:No("mt-auto pb-4 pt-2 flex",c?"justify-end":"justify-center"),children:t(Zi,{children:[a(es,{asChild:!0,children:a("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!x;y(e),(e=>{try{localStorage.setItem(Bv,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:a(c?ie:O,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a(as,{side:"right",children:a("p",{children:c?"Recolher":"Expandir"})})]})}),n&&C&&N&&a("div",{ref:C.dragRef,onMouseDown:C.handleMouseDown,className:No("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-['']",C.isDragging&&"bg-primary/40")})]})}const Yv=p(function({children:e,sidebar:r,sidebarConfig:n,showHeader:o=!0}){const i=s(()=>r||a(Kv,{config:n}),[r,n]),d=s(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=u(null),p=u(null),h=l(()=>{if(c.current&&p.current){const e=c.current.offsetHeight;p.current.style.setProperty("--header-height",`${e}px`)}},[]);return m(()=>{h();const e=new ResizeObserver(h);return c.current&&e.observe(c.current),()=>e.disconnect()},[h]),a(Iv,{config:n,children:a(Jd,{children:a(Vm,{defaultOpen:!1,style:d,children:t("div",{ref:p,className:"flex flex-col h-screen w-full overflow-hidden",children:[o&&a("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:a(Ov,{})}),t("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[i,a("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:a("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});function Qv({open:e,appName:n}){const[o,s]=i(!1);return t(r,{children:[a(Km,{className:"p-0 gap-0",children:e?t("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[a("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:a("img",{src:cr.logo,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),n&&a("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:()=>s(!0),children:a("span",{className:"line-clamp-2",children:(e=>{const n=e.split(" ");if(n.length<=1)return t("span",{className:"whitespace-nowrap",children:[e," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const o=n[n.length-1],i=n.slice(0,-1).join(" ");return t(r,{children:[i," ",t("span",{className:"whitespace-nowrap",children:[o," ",a(D,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(n)})})]}):a("div",{className:"flex flex-col items-center justify-center w-full",children:a("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>s(!0),children:a("img",{src:cr.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a(Hc,{open:o,onOpenChange:s})]})}function Xv({title:e,subtitle:r,children:n,className:o,hasHeader:i=!0}){const s=e||r;return t("div",{className:No("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",o),children:[i&&s&&t("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&a("h2",{className:"text-xl font-semibold text-foreground",children:e}),r&&a("p",{className:"text-sm text-muted-foreground mt-0.5",children:r})]}),n&&a("div",{className:No("p-6",!i&&s&&"pt-4"),children:n})]})}function Jv({breadcrumbs:e,children:r,className:o}){return t("div",{className:No("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",o),children:[e&&e.length>0&&a(cu,{className:"mb-4",children:a(uu,{children:e.map((r,o)=>{const i=o===e.length-1;return t(n.Fragment,{children:[o>0&&a(fu,{}),a(mu,{children:i||!r.href?a(hu,{children:r.label}):r.asChild&&r.children?a(pu,{asChild:!0,children:r.children}):a(pu,{asChild:!0,children:a(Ka,{to:r.href||"/",children:r.label})})})]},`${r.label}-${o}`)})})}),a("div",{className:"space-y-6",children:r})]})}const Zv=(e={})=>{const{enabled:a=!0}=e,{alias:t}=pl();return Ua({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=Bs(),{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(!qs.handleError(r))throw r;return[]}return a||[]},enabled:a&&!!t})};function eb({rowIds:e,defaultHeight:a=48,minHeight:t=32,maxHeight:r=120,storageKey:n,onResize:o,enabled:s=!0}){const[d,c]=i(()=>{if(!s||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[p,h]=i(!1),[f,g]=i(null),v=u(0),b=u(0),x=l(e=>d[e]??a,[d,a]),y=l((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),h(!0),g(e),v.current=t.clientY,b.current=d[e]??a)},[s,d,a]);m(()=>{if(!p||!f)return;const e=e=>{const a=e.clientY-v.current,n=Math.max(t,Math.min(r,b.current+a));c(e=>{const a={...e,[f]:n};return o?.(a),a})},a=()=>{h(!1),g(null),n&&c(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)}},[p,f,t,r,n,o]),m(()=>(p?(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=""}),[p]);const w=l(()=>{c({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:d,isDragging:p,activeRow:f,handleMouseDown:y,resetHeights:w,getRowHeight:x}}function ab(e){const{steps:a,initialStep:t=0,initialData:r={},onComplete:n,onCancel:o}=e,[d,c]=i(t),[u,m]=i(r),[p,h]=i(!1),[f,g]=i(!1),v=a.length,b=0===d,x=d===v-1,y=a[d],w=v>1?(d+1)/v*100:100,N=l(()=>!y?.canProceed||y.canProceed(),[y]),_=s(()=>N(),[N,u]),C=s(()=>!b&&!y?.disableBack,[b,y]),k=l(e=>{m(a=>({...a,...e}))},[]),S=l((e,a)=>{m(t=>({...t,[e]:a}))},[]),A=l(()=>{c(t),m(r),h(!1),g(!1),o?.()},[t,r,o]),E=l(async()=>{if(N()&&!f){g(!0);try{await(n?.(u))}finally{g(!1)}}},[N,f,u,n]),D=l(async()=>{N()&&!p&&(x?await E():c(e=>Math.min(e+1,v-1)))},[N,p,x,v,E]),P=l(()=>{C&&!p&&c(e=>Math.max(e-1,0))},[C,p]),T=l(e=>{e<0||e>=v||p||(e<=d||e===d+1)&&c(e)},[d,v,p]),I=l(e=>{h(e)},[]);return{currentStep:d,currentStepConfig:y,data:u,isFirstStep:b,isLastStep:x,isLoading:p,isCompleting:f,next:D,back:P,goTo:T,canProceed:_,canGoBack:C,setData:k,updateField:S,reset:A,complete:E,setLoading:I,progress:w,stepIndex:d,totalSteps:v}}function tb(...e){return Object.assign({},...e)}const rb=()=>{const{locale:e,timezone:a}=uc(),t=Zn;return{formatDatetime:r=>po(r,t,a,e),formatDate:t=>ho(t,e,a),locale:e,timezone:a,datetimeFormat:t}};class nb{static async sendEmail(e){const a=Bs(),{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 ob=nb;function ib(e){const[a,t]=i(!1),{uploadFunction:r,deleteFunction:n,defaultOptions:o,onSuccess:s,onError:l}=e||{};return{upload:async(e,a)=>{if(!r){const e=new Error("uploadFunction não fornecida");throw C.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}t(!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 n=await r(e,t);return C.success("Sucesso",{description:"Arquivo enviado com sucesso"}),s?.(n),n}catch(n){const e=n instanceof Error?n:new Error("Erro ao fazer upload");throw C.error("Erro",{description:e.message}),l?.(e),e}finally{t(!1)}},deleteMedia:async(e,a)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw C.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),C.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw C.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function sb(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 lb(e,a){const t=sb(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function db(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function cb(e,a){const t=db(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function ub(e){if(!e)return;const a=e.match(/src="([^"]+)"/);return a?a[1]:void 0}function mb(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function pb(e,a,t){switch(a||mb(e)){case"youtube":return lb(e,t);case"vimeo":return cb(e,t);default:return e}}function hb({value:n,onChange:o,onSubmit:l,onCancel:d,uploadFunction:c,deleteFunction:m,uploadOptions:p}){const{t:h}=Ra(),[f,g]=i(n||{inputType:"url",controls:!0}),v=u(null),b=u(null),{upload:x,uploading:y}=ib({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["video/*"],maxSize:104857600}}),{upload:w,uploading:N}=ib({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["image/*"],maxSize:5242880}}),_=s(()=>mb(f.videoUrl||ub(f.embedCode)||""),[f.videoUrl,f.embedCode]),k=(e,a)=>{const t={...f,[e]:a};g(t),o(t)};return t("div",{className:"space-y-6",children:[t("div",{className:"space-y-2",children:[a(To,{children:h("input_type")}),t(xi,{value:f.inputType||"url",onValueChange:e=>k("inputType",e),children:[a(Ni,{children:a(wi,{})}),t(ki,{children:[a(Ai,{value:"url",children:"URL"}),a(Ai,{value:"upload",children:h("file_upload")}),a(Ai,{value:"embed",children:h("embed_code")})]})]})]}),"upload"===f.inputType&&c&&t("div",{className:"space-y-2",children:[a(To,{children:"Arquivo"}),t("div",{className:"flex gap-2",children:[a("input",{ref:v,type:"file",accept:"video/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await x(a),t={...f,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:f.title||a.name.replace(/\.[^/.]+$/,"")};g(t),o(t)}catch(t){}finally{v.current&&(v.current.value="")}},className:"hidden"}),a(Ao,{type:"button",variant:"outline",onClick:()=>v.current?.click(),disabled:y,children:t(r,y?{children:[a(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(va,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),f.videoFile&&t("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",f.videoFile," (",Math.round((f.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===f.inputType&&t("div",{className:"space-y-2",children:[a(To,{children:h("embed_code")}),a(Pi,{placeholder:h("paste_embed_code"),value:f.embedCode||"",onChange:e=>k("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),c&&t("div",{className:"space-y-2",children:[a(To,{children:"Thumbnail"}),t("div",{className:"flex gap-2",children:[a(Do,{type:"url",placeholder:"URL da thumbnail",value:f.thumbnail||"",onChange:e=>k("thumbnail",e.target.value),className:"flex-1"}),a("input",{ref:b,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await w(a),t={...f,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};g(t),o(t)}catch(t){}finally{b.current&&(b.current.value="")}},className:"hidden"}),a(Ao,{type:"button",variant:"outline",onClick:()=>b.current?.click(),disabled:N,children:t(r,N?{children:[a(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(va,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),f.thumbnailFile&&t("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",f.thumbnailFile]})]}),t("div",{className:"space-y-2",children:[a(To,{htmlFor:"title",children:"Título"}),a(Do,{id:"title",placeholder:h("video_title"),value:f.title||"",onChange:e=>k("title",e.target.value)})]}),t("div",{className:"flex gap-6",children:[t("div",{className:"flex items-center gap-2",children:[a(Di,{id:"autoplay",checked:f.autoplay||!1,onCheckedChange:e=>k("autoplay",!0===e)}),a(To,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t("div",{className:"flex items-center gap-2",children:[a(Di,{id:"controls",checked:!1!==f.controls,onCheckedChange:e=>k("controls",!0===e)}),a(To,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t("div",{className:"space-y-2",children:[a(To,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const r=f.videoUrl||ub(f.embedCode)||"";if(!r)return a("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===_)return t("video",{controls:!1!==f.controls,autoPlay:f.autoplay,poster:f.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[a("source",{src:r}),"Seu navegador não suporta este vídeo."]});const n="youtube"===_?lb(r,f.autoplay):cb(r,f.autoplay);return a("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a("iframe",{title:f.title||e.t("video"),src:n,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a(Ao,{variant:"outline",onClick:d,children:"Cancelar"}),a(Ao,{onClick:()=>{f.videoUrl||f.embedCode?l(f):C.error("Erro",{description:h("no_video_selected")})},disabled:!(f.videoUrl||f.embedCode),children:"Salvar"})]})]})}function fb({content:r,className:n="",style:o}){const i=r.videoUrl||ub(r.embedCode)||"";if(!i)return null;const s=mb(i);return a(Io,{className:`overflow-hidden my-4 ${n}`,style:o,children:t(Lo,{className:"p-0",children:["file"===s?t("video",{controls:!1!==r.controls,autoPlay:r.autoplay,poster:r.thumbnail,className:"w-full h-auto",playsInline:!0,muted:r.autoplay,children:[a("source",{src:i}),"Seu navegador não suporta vídeos HTML5."]}):a("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:a("iframe",{title:r.title||e.t("video"),src:"youtube"===s?lb(i,r.autoplay):cb(i,r.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),r.title&&a("div",{className:"p-4",children:a("p",{className:"text-sm font-medium",children:r.title})})]})})}function gb({value:e,onChange:n,onSubmit:o,onCancel:s,uploadFunction:l,deleteFunction:d,uploadOptions:c}){const{t:m}=Ra(),[p,h]=i(e||{alignment:"center",allowDownload:!1}),f=u(null),{upload:g,uploading:v}=ib({uploadFunction:l,deleteFunction:d,defaultOptions:{...c,allowedTypes:["image/*"],maxSize:5242880}}),b=(e,a)=>{const t={...p,[e]:a};h(t),n(t)};return t("div",{className:"space-y-6",children:[t("div",{className:"space-y-2",children:[a(To,{children:"URL"}),t("div",{className:"flex gap-2",children:[a(Do,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:p.imageUrl||"",onChange:e=>b("imageUrl",e.target.value),className:"flex-1"}),l&&t(r,{children:[a("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const a=e.target.files?.[0];if(a)try{const e=await g(a),t={...p,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};h(t),n(t)}catch(t){}finally{f.current&&(f.current.value="")}},className:"hidden"}),a(Ao,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:v,children:t(r,v?{children:[a(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(va,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),p.imageFile&&t("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",p.imageFile," (",Math.round((p.imageSize||0)/1024)," KB)"]})]}),p.imageUrl&&t("div",{className:"space-y-2",children:[a(To,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:a("div",{className:"flex "+("left"===p.alignment?"justify-start":"right"===p.alignment?"justify-end":"justify-center"),children:a("img",{src:p.imageUrl,alt:p.alt||"Preview",style:{width:p.width?`${p.width}px`:"auto",height:p.height?`${p.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t("div",{className:"space-y-2",children:[a(To,{htmlFor:"caption",children:"Legenda"}),a(Pi,{id:"caption",placeholder:"Legenda",value:p.caption||"",onChange:e=>b("caption",e.target.value),rows:2})]}),t("div",{className:"space-y-2",children:[a(To,{htmlFor:"alt",children:m("alt_text")}),a(Do,{id:"alt",placeholder:m("alt_text"),value:p.alt||"",onChange:e=>b("alt",e.target.value)})]}),t("div",{className:"space-y-2",children:[a(To,{children:"Alinhamento"}),t(xi,{value:p.alignment||"center",onValueChange:e=>b("alignment",e),children:[a(Ni,{children:a(wi,{})}),t(ki,{children:[a(Ai,{value:"left",children:"Esquerda"}),a(Ai,{value:"center",children:"Centro"}),a(Ai,{value:"right",children:"Direita"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(To,{htmlFor:"width",children:"Largura"}),a(Do,{id:"width",type:"number",placeholder:"px",value:p.width||"",onChange:e=>b("width",e.target.value?Number(e.target.value):void 0)})]}),t("div",{className:"space-y-2",children:[a(To,{htmlFor:"height",children:"Altura"}),a(Do,{id:"height",type:"number",placeholder:"px",value:p.height||"",onChange:e=>b("height",e.target.value?Number(e.target.value):void 0)})]})]}),t("div",{className:"flex items-center gap-2",children:[a(Di,{id:"allowDownload",checked:p.allowDownload||!1,onCheckedChange:e=>b("allowDownload",!0===e)}),a(To,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a(Ao,{variant:"outline",onClick:s,children:"Cancelar"}),a(Ao,{onClick:()=>{p.imageUrl?o(p):C.error("Erro",{description:m("no_image_selected")})},disabled:!p.imageUrl,children:"Salvar"})]})]})}function vb({content:e,className:r="",style:n}){const{t:o}=Ra();if(!e.imageUrl)return null;const i={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return a("div",{className:`flex ${i} my-4 ${r}`,style:n,children:t("div",{className:"space-y-2 max-w-full",children:[a("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("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[a(Je,{className:"h-4 w-4"}),"Baixar imagem"]})]})})}function bb(e,a){return e/a}function xb(e,a,t,r){const n=bb(e,a);return t&&!r?{width:t,height:Math.round(t/n)}:r&&!t?{width:Math.round(r*n),height:r}:{width:e,height:a}}function yb(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))}}function wb(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"}}function Nb(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const _b=["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 Cb(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 kb(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}function Sb({storedFile:e,customFileName:r,allowedExtensions:n,customExtensionErrorMessage:o,minSizeInBytes:s=1,maxSizeInBytes:d=314572800,showDownloadButton:c=!0,showViewButton:m=!0,showReplaceButton:p=!0,showCloseButton:h=!0,required:f=!1,touched:g=!1,disabled:v=!1,error:b,onFileSelect:x,onFileRemove:y,onFileReplace:w,onDownload:N,onView:_,className:C}){const{t:k}=Ra(),S=u(null),[A,D]=i(null),[P,T]=i(null),[I,M]=i(!1),R=A||e,z=A?.name||e?.name||"",L=A?.size||e?.size;z&&kb(z);const F=r||z,O=c&&!A&&!!e,U=m&&!A&&!!e,j=!!P||!!b||f&&g&&!R,B=!!R,V=l(e=>{if(_b.includes(e.type))return{type:"forbidden-type"};if(e.size<=s)return{type:"min-size"};if(e.size>=d)return{type:"max-size"};if(n?.length){const a=kb(e.name);if(!n.includes(a))return{type:"extension",message:o}}return null},[s,d,n,o]),$=l(e=>{const a=e.target.files?.[0];if(!a)return;const t=V(a);if(t)return T(t),D(null),void(S.current&&(S.current.value=""));T(null),D(a),x?.(a),S.current&&(S.current.value="")},[V,x]),q=l(e=>{if(e.preventDefault(),e.stopPropagation(),v)return;const a=e.dataTransfer.files?.[0];if(!a)return;const t=V(a);if(t)return T(t),void D(null);T(null),D(a),x?.(a)},[v,V,x]),W=l(e=>{e.preventDefault(),e.stopPropagation()},[]),H=l(()=>{w?.(),S.current?.click()},[w]),G=l(()=>{D(null),T(null),y?.(),S.current&&(S.current.value="")},[y]),K=l(async()=>{if(!I&&e&&N){M(!0);try{await N(e)}finally{M(!1)}}},[I,e,N]),Y=l(()=>{e&&_&&_(e)},[e,_]),Q=l(()=>{v||S.current?.click()},[v]),X=(()=>{if(b)return b;if(!P)return f&&g&&!R?k("required_field"):null;switch(P.type){case"extension":return P.message||k("sign_file_not_allowed");case"forbidden-type":return k("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${Cb(s)}`;case"max-size":return`Tamanho máximo: ${Cb(d)}`;default:return k("file_error")}})();return t("div",{className:No("space-y-1",C),children:[a("div",{className:No("rounded-md border border-dashed transition-colors",B&&"border-solid border-border",!B&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",j&&"border-destructive border-solid",v&&"opacity-50 pointer-events-none"),children:t("div",B?{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a(Be,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a("p",{className:"text-xs truncate",children:F})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[null!=L&&a("span",{className:"text-xs text-muted-foreground",children:Cb(L)}),t("div",{className:"flex items-center gap-0.5",children:[O&&N&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:I,onClick:K,children:a(Je,{className:"h-3.5 w-3.5 text-primary"})})}),a(as,{children:"Download"})]}),U&&_&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Y,children:a(Ce,{className:"h-3.5 w-3.5 text-primary"})})}),a(as,{children:"Visualizar"})]}),p&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,children:a(ue,{className:"h-3.5 w-3.5 text-primary"})})}),a(as,{children:"Substituir"})]}),h&&t(Zi,{children:[a(es,{asChild:!0,children:a(Ao,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:G,children:a(E,{className:"h-3 w-3 text-muted-foreground"})})}),a(as,{children:k("remove")})]})]})]})]}:{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:Q,onKeyDown:e=>"Enter"===e.key&&Q(),onDrop:q,onDragOver:W,children:[a(ba,{className:"h-4 w-4 text-muted-foreground"}),t("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",a("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),X&&a("p",{className:"text-xs text-destructive",children:X}),a("input",{ref:S,type:"file",className:"hidden",accept:n?.map(e=>`.${e}`).join(","),onChange:$,disabled:v})]})}var Ab,Eb,Db,Pb,Tb,Ib;function Mb(e){switch(e.type){case Ab.text:return e.textValue;case Ab.number:return e.numberValue;case Ab.date:return e.dateValue;case Ab.time:return e.timeValue;case Ab.url:case Ab.singleSelection:case Ab.multiSelection:return e.itemsValue;case Ab.questions:return e.questionsValue;case Ab.readOnlyText:return e.textValue;default:return null}}function Rb(e,a){if(!a)return!0;const t=null!=Mb(e)&&""!==Mb(e)&&!(Array.isArray(Mb(e))&&0===Mb(e).length);return!1!==e.isActive||t}function zb(e){return e.filter(e=>e.type!==Ab.readOnlyText).map(e=>({formFieldAssociationId:e.id,textValue:e.type===Ab.text?e.textValue:void 0,numberValue:e.type===Ab.number?e.numberValue:void 0,dateValue:e.type===Ab.date?e.dateValue:void 0,timeValue:e.type===Ab.time?e.timeValue:void 0,itemsValue:[Ab.url,Ab.singleSelection,Ab.multiSelection].includes(e.type)?e.itemsValue:void 0,questionsValue:e.type===Ab.questions?e.questionsValue:void 0}))}function Lb(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 Ab.text:r.textValue=t.textValue;break;case Ab.number:r.numberValue=t.numberValue;break;case Ab.date:r.dateValue=t.dateValue;break;case Ab.time:r.timeValue=t.timeValue;break;case Ab.url:case Ab.singleSelection:case Ab.multiSelection:r.itemsValue=t.itemsValue||[];break;case Ab.questions:r.questionsValue=t.questionsValue||[]}return r}):e}function Fb(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||e.type===Ab.readOnlyText)return;const t=Mb(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),e.type===Ab.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)]}}function Ob({field:e}){return t("div",{className:"space-y-1",children:[e.name&&a("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&a("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&a("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Ub({field:e,readOnly:r,onChange:n}){const o=e.config,i=o?.multiline??!1,s=r||e.readOnly,l=a=>{n?.({...e,textValue:a})};return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),i?a(Pi,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s,rows:4}):a(Do,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s})]})}function jb({field:e,readOnly:r,onChange:n}){const o=r||e.readOnly,i=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(Do,{type:"date",value:i,onChange:a=>{return t=a.target.value,void n?.({...e,dateValue:t||void 0});var t},placeholder:e.placeholder,disabled:o})]})}function Bb({field:e,readOnly:r,onChange:n}){const o=r||e.readOnly,i=e=>{if(!e)return;const[a,t]=e.split(":").map(Number);return 60*a+t};return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(Do,{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=>n?.({...e,timeValue:i(a.target.value)}),placeholder:e.placeholder,disabled:o})]})}function Vb({field:e,readOnly:r,onChange:n}){const o=e.config,s=o?.multiple??!1,l=r||e.readOnly,[d,c]=i(""),u=e.itemsValue||[],m=()=>{if(!d.trim())return;const a={value:crypto.randomUUID(),text:d.trim()};n?.({...e,itemsValue:[...u,a]}),c("")};if(!s){const r=u[0]?.text||"";return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),t("div",{className:"flex items-center gap-2",children:[a(Do,{type:"url",value:r,onChange:a=>(a=>{const t={value:a,text:a};n?.({...e,itemsValue:a?[t]:[]})})(a.target.value),placeholder:e.placeholder||"https://",disabled:l}),r&&a(Ao,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:a(pe,{className:"h-4 w-4"})})})]})]})}return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),!l&&t("div",{className:"flex items-center gap-2",children:[a(Do,{type:"url",value:d,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a(Ao,{variant:"outline",size:"icon",onClick:m,disabled:!d.trim(),className:"flex-shrink-0",children:a(Q,{className:"h-4 w-4"})})]}),u.length>0&&a("div",{className:"space-y-1",children:u.map((r,o)=>t("div",{className:"flex items-center gap-2 text-sm",children:[a("a",{href:r.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:r.text}),!l&&a(Ao,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(a=>{const t=u.filter((e,t)=>t!==a);n?.({...e,itemsValue:t})})(o),children:a(H,{className:"h-3 w-3"})})]},r.value))})]})}function $b({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=null!=o?.decimals&&o.decimals>0?(1/Math.pow(10,o.decimals)).toString():"1";return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a(Do,{type:"number",value:e.numberValue??"",onChange:a=>(a=>{if(""===a)return void n?.({...e,numberValue:void 0});const t=parseFloat(a);isNaN(t)||n?.({...e,numberValue:t})})(a.target.value),placeholder:e.placeholder,disabled:i,min:o?.min,max:o?.max,step:s}),null!=o?.min&&null!=o?.max&&t("p",{className:"text-xs text-muted-foreground",children:["Min: ",o.min," | Max: ",o.max]})]})}function qb({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Db.dropdown,l=o?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],d=e.itemsValue?.[0]?.value||"",c=a=>{const t=l.find(e=>e.value===a);if(!t)return;const r={value:t.value,text:t.text,isActive:t.isActive};n?.({...e,itemsValue:[r]})};return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),s===Db.dropdown&&t(xi,{value:d,onValueChange:c,disabled:i,children:[a(Ni,{children:a(wi,{placeholder:e.placeholder||"Selecione..."})}),a(ki,{children:l.map(e=>t(Ai,{value:e.value,children:[e.text,!1===e.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(s===Db.radio||s===Db.buttons)&&a(Nm,{value:d,onValueChange:c,disabled:i,className:No(s===Db.buttons?"flex flex-wrap gap-2":"space-y-2"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(_m,{value:r.value,id:`${e.id}-${r.value}`}),t(To,{htmlFor:`${e.id}-${r.value}`,className:"text-sm font-normal cursor-pointer",children:[r.text,!1===r.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},r.value))}),!i&&d&&!e.required&&a("button",{type:"button",onClick:()=>{n?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Wb({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Db.dropdown,l=o?.data?.filter(a=>!1!==a.isActive||e.itemsValue?.some(e=>e.value===a.value))||[],d=new Set(e.itemsValue?.map(e=>e.value)||[]);return t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&a("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(r=>t(Ii,{variant:"secondary",className:"gap-1 pr-1",children:[a("span",{className:"text-xs",children:r.text}),!i&&a("button",{type:"button",onClick:()=>(a=>{const t=(e.itemsValue||[]).filter(e=>e.value!==a);n?.({...e,itemsValue:t})})(r.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:a(E,{className:"h-3 w-3"})})]},r.value))}),!i&&a("div",{className:No(s===Db.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(Di,{id:`${e.id}-${r.value}`,checked:d.has(r.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}];n?.({...e,itemsValue:r})})(r),disabled:i}),t(To,{htmlFor:`${e.id}-${r.value}`,className:"text-sm font-normal cursor-pointer",children:[r.text,!1===r.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},r.value))})]})}function Hb({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.questions||[],l=o?.options||[],d=e.questionsValue||[];return 0===s.length||0===l.length?t("div",{className:"space-y-1.5",children:[a(To,{children:e.name}),a("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t("div",{className:"space-y-1.5",children:[a(To,{className:No(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&a("p",{className:"text-xs text-muted-foreground",children:e.description}),a("div",{className:"border rounded-md overflow-x-auto",children:t("table",{className:"w-full text-sm",children:[a("thead",{children:t("tr",{className:"border-b bg-muted/50",children:[a("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),l.map(e=>a("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),a("tbody",{children:s.map((r,o)=>t("tr",{className:No(o<s.length-1&&"border-b"),children:[a("td",{className:"p-2 text-muted-foreground",children:r.text}),l.map(t=>{return a("td",{className:"text-center p-2",children:a(Nm,{value:(o=r.value,d.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:a=>((a,t,r,o)=>{const i={questionValue:a,questionText:t,optionValue:r,optionText:o},s=d.filter(e=>e.questionValue!==a);s.push(i),n?.({...e,questionsValue:s})})(r.value,r.text,a,t.text),disabled:i,className:"flex justify-center",children:a(_m,{value:t.value,id:`${e.id}-${r.value}-${t.value}`})})},t.value);var o})]},r.value))})]})})]})}function Gb({fields:e,readOnly:t=!1,hideInactiveWithoutValue:r=!1,onChange:n,onFieldChange:o}){const i=l(a=>{if(o?.(a),n){const t=e.map(e=>e.id===a.id?a:e);n(t)}},[e,n,o]),s=e.filter(e=>Rb(e,r));return 0===s.length?null:a("div",{className:"space-y-4",children:s.map(e=>a(Kb,{field:e,readOnly:t,onChange:i},e.id))})}function Kb({field:e,readOnly:t,onChange:r}){const n={field:e,readOnly:t,onChange:r};switch(e.type){case Ab.readOnlyText:return a(Ob,{...n});case Ab.text:return a(Ub,{...n});case Ab.date:return a(jb,{...n});case Ab.time:return a(Bb,{...n});case Ab.url:return a(Vb,{...n});case Ab.number:return a($b,{...n});case Ab.singleSelection:return a(qb,{...n});case Ab.multiSelection:return a(Wb,{...n});case Ab.questions:return a(Hb,{...n});default:return null}}function Yb({open:r,onOpenChange:n,returnSteps:o,initialObservation:s="",title:l=e.t("approval_execute_action"),descriptions:d=[],setDefaultApproverOnInit:c=!0,onSubmit:u}){const[m,p]=i(!0),[h,f]=i(c&&o.length>0?o[0].id:null),[g,v]=i(s),b=e=>{p(e),e&&!c?f(null):!e&&!c&&o.length>0&&f(o[0].id)},x=g!==s||!m;return a(Qo,{open:r,onOpenChange:n,children:t(ti,{className:"sm:max-w-[480px]",variant:"form",isDirty:x,children:[a(ri,{children:a(ii,{children:l})}),t("div",{className:"space-y-4",children:[d.length>0&&a("div",{className:"space-y-1 text-sm text-muted-foreground",children:d.map((e,t)=>a("p",{dangerouslySetInnerHTML:{__html:e}},t))}),t("div",{className:"flex gap-4",children:[t("label",{className:"flex items-center gap-2 cursor-pointer",children:[a("input",{type:"radio",name:"approved",checked:m,onChange:()=>b(!0),className:"accent-primary"}),a("span",{className:"text-sm",children:e.t("approval_approve")})]}),t("label",{className:"flex items-center gap-2 cursor-pointer",children:[a("input",{type:"radio",name:"approved",checked:!m,onChange:()=>b(!1),className:"accent-primary"}),a("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t("div",{className:"space-y-1.5",children:[a(To,{children:"Etapa"}),t(xi,{value:h??void 0,onValueChange:f,disabled:m,children:[a(Ni,{children:a(wi,{placeholder:e.t("approval_select_step")})}),a(ki,{children:o.map(e=>a(Ai,{value:e.id,children:e.name},e.id))})]})]}),t("div",{className:"space-y-1.5",children:[a(To,{children:e.t("approval_opinion")}),a(Pi,{value:g,onChange:e=>v(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t("p",{className:"text-xs text-muted-foreground text-right",children:[g.length,"/",4e3]})]})]}),t(oi,{children:[a(Ao,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),a(Ao,{onClick:()=>{if(!g.trim())return void C.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:o.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:g})},disabled:!x,children:"Concluir"})]})]})})}function Qb({open:e,onOpenChange:r,approvers:n,isLoading:o=!1,ignoreUserIds:l=[],onSubmit:d}){const{t:c}=Ra(),[u,m]=i(null),p=s(()=>{const e=new Set(l);return n.filter(a=>!e.has(a.id))},[n,l]),h=s(()=>p.map(e=>({value:e.id,label:e.name})),[p]);return a(Qo,{open:e,onOpenChange:r,children:t(ti,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!u,children:[a(ri,{children:a(ii,{children:c("approval_select_approver")})}),a(zi,{isLoading:o,type:"spinner",children:a("div",{className:"space-y-4",children:a(bs,{options:h,value:u??void 0,onValueChange:e=>m("string"==typeof e?e:e?.[0]??null),placeholder:c("approval_select_approver_placeholder"),searchPlaceholder:c("approval_search_approver")})})}),t(oi,{children:[a(Ao,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a(Ao,{onClick:()=>{if(!u)return;const e=p.find(e=>e.id===u);e&&d(e)},disabled:!u||o,children:"Concluir"})]})]})})}(Eb=Ab||(Ab={}))[Eb.readOnlyText=1]="readOnlyText",Eb[Eb.text=2]="text",Eb[Eb.date=3]="date",Eb[Eb.time=4]="time",Eb[Eb.url=5]="url",Eb[Eb.number=6]="number",Eb[Eb.singleSelection=7]="singleSelection",Eb[Eb.multiSelection=8]="multiSelection",Eb[Eb.questions=9]="questions",(Pb=Db||(Db={}))[Pb.dropdown=1]="dropdown",Pb[Pb.buttons=2]="buttons",Pb[Pb.radio=3]="radio",Pb[Pb.checkbox=4]="checkbox",(Ib=Tb||(Tb={}))[Ib.custom=1]="custom",Ib[Ib.users=2]="users",Ib[Ib.usersLists=3]="usersLists";function Xb(e){const{t:a}=Ra();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Jb({text:e,maxLength:r=130}){const{t:n}=Ra(),[o,s]=i(!1);return e.length<=r?a("span",{children:e}):t("span",{children:[o?e:`${e.substring(0,r)}... `,a("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>s(!o),children:n(o?"approval_read_less":"approval_read_more")})]})}function Zb({approver:e}){if(1===e.type&&e.approverId)return t(su,{className:"h-9 w-9 shrink-0",children:[a(lu,{src:e.photoUrl,alt:e.name}),a(du,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const r=2===e.type?Ze:3===e.type?xa:ge;return a("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:a(r,{className:"h-4 w-4 text-background"})})}function ex({approver:e}){return e.date?t("div",{className:"flex items-center gap-2 flex-wrap",children:[t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[a(le,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Xb(e.date)}),1!==e.type&&e.approvedUsername&&t("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t("div",{className:"flex items-center gap-2 flex-wrap",children:[t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[a(ya,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Xb(e.returnDate)})]}):t("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[a(j,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function ax({approver:e}){const{t:r}=Ra(),n=1!==e.type||e.approverId?e.name:"A definir";return t("div",{children:[2===e.type&&a("p",{className:"text-xs text-muted-foreground",children:r("approval_user_group")}),3===e.type&&a("p",{className:"text-xs text-muted-foreground",children:"Local"}),a("p",{className:"text-sm font-medium break-words",children:n}),a(ex,{approver:e})]})}function tx({config:e,isLoading:r=!1,onClose:n,onApprove:o,onDefineApprover:s,onRefreshSteps:d,availableApprovers:c=[],isLoadingApprovers:u=!1}){const{t:m}=Ra(),[p,h]=i(!1),[f,g]=i(!1),[v,b]=i(""),[x,y]=i(""),[w,N]=i(!1),[_,C]=i(""),k=r||p,S=l((e,a)=>{b(e),y(a??""),g(!0)},[]),A=l(async a=>{g(!1),h(!0);if(!await o(e.associationId,{stepApproverId:v,...a}))return S(v,a.observation),void h(!1);n(),h(!1)},[e.associationId,v,o,n,S]),D=l(e=>{C(e),N(!0)},[]),P=l(async a=>{N(!1),h(!0),await s(e.associationId,_,a),await(d?.(e.associationId)),h(!1)},[e.associationId,_,s,d]),T=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],I=(a,t)=>e.canApprove&&a.isCurrentStep&&t.approverId&&!t.date&&t.canApprove,M=(a,t)=>!e.flowReproved&&a.isCurrentStep&&1===t.type&&t.canApprove&&(!t.approverId||t.isToBeDefined);return t("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[a(Ao,{variant:"ghost",size:"icon",onClick:n,className:"shrink-0",children:a(E,{className:"h-5 w-5"})}),a("span",{className:"text-lg font-medium",children:e.title})]}),k?a(zi,{isLoading:!0,type:"spinner",className:"flex-1",children:a("div",{})}):t("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&a("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,t)=>a("div",{className:No("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("hr",{className:"border-border"}),e.approvalFlowSteps.map(r=>t("div",{className:No("space-y-2",(!r.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t("p",{className:"font-semibold text-sm",children:[r.index,". Etapa: ",r.name]}),r.description&&a("p",{className:"text-sm text-muted-foreground break-words",children:a(Jb,{text:r.description})}),r.returnDate&&t("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t("div",{className:"flex items-center gap-2",children:[a("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t("span",{className:"text-xs text-muted-foreground",children:[r.returnUserName," em ",Xb(r.returnDate)]})]}),r.returnObservation&&a("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a(Jb,{text:r.returnObservation})})]}),r.approvers.map(e=>t("div",{className:"p-2 space-y-1",children:[t("div",{className:"flex items-center justify-between gap-2",children:[t("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a(Zb,{approver:e}),a(ax,{approver:e})]}),I(r,e)&&a(Ao,{size:"sm",onClick:()=>S(e.id),children:"Aprovar"}),M(r,e)&&a(Ao,{size:"sm",variant:"outline",onClick:()=>D(e.id),children:"Selecionar"})]}),e.observation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Jb,{text:e.observation})}),e.returnObservation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Jb,{text:e.returnObservation})})]},e.id))]},r.id))]}),a(Yb,{open:f,onOpenChange:g,returnSteps:e.returnSteps,initialObservation:x,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:A}),a(Qb,{open:w,onOpenChange:N,approvers:c,isLoading:u,ignoreUserIds:T,onSubmit:P})]})}var rx,nx;function ox({users:e,value:r,onChange:n,disabled:o=!1,placeholder:d="Buscar membro da equipe...",confirmRemoval:c=!0,confirmTitle:u,confirmMessage:m="Tem certeza que deseja remover este membro da equipe?",emptyMessage:p,className:h}){const{t:f}=Ra(),g=u??f("leadership_remove_team"),v=p??f("leadership_no_members"),[b,x]=i(""),[y,w]=i(!1),[N,_]=i(null),C=s(()=>new Set(r),[r]),k=s(()=>e.filter(e=>C.has(e.id)),[e,C]),S=s(()=>e.filter(e=>!C.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,C]),A=l(e=>{e&&!C.has(e)&&(n([...r,e]),x(""))},[r,n,C]),D=l(e=>{c?(_(e),w(!0)):n(r.filter(a=>a!==e))},[r,n,c]),P=l(()=>{N&&n(r.filter(e=>e!==N)),w(!1),_(null)},[N,r,n]);return t("div",{className:No("space-y-3",h),children:[a("div",{className:"flex items-start gap-3",children:a("div",{className:"flex-1",children:a(bs,{options:S,value:b,onValueChange:e=>{const a="string"==typeof e?e:e?.[0]??"";x(a),a&&A(a)},placeholder:d,searchPlaceholder:"Buscar...",disabled:o})})}),t("div",{className:"flex items-center gap-2",children:[a("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),a("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:k.length})]}),k.length>0?a("div",{className:"space-y-2",children:k.map(e=>t("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t(su,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(lu,{src:e.avatar,alt:e.name}),a(du,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),a("div",{className:"flex-1 min-w-0",children:a("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t("span",{className:"flex items-center gap-1",children:[a(wa,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t("span",{className:"flex items-center gap-1",children:[a(xa,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a("button",{type:"button",className:No("text-muted-foreground hover:text-destructive transition-colors",o&&"opacity-50 pointer-events-none"),onClick:()=>!o&&D(e.id),title:f("remove"),children:a(E,{className:"h-4 w-4"})})]})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a(ge,{className:"h-12 w-12 mb-2 opacity-30"}),a("p",{className:"text-sm",children:v})]}),a(Qo,{open:y,onOpenChange:w,children:t(ti,{className:"sm:max-w-[400px]",children:[a(ri,{children:a(ii,{children:g})}),a("p",{className:"text-sm text-muted-foreground",children:m}),t(oi,{children:[a(Ao,{variant:"ghost",onClick:()=>w(!1),children:"Cancelar"}),a(Ao,{variant:"destructive",onClick:P,children:"Remover"})]})]})})]})}(nx=rx||(rx={}))[nx.ApprovalFlow=1]="ApprovalFlow",nx[nx.Association=2]="Association";export{Xt as AUTH_CONFIG,Gc as AccessDeniedDialog,ru as Accordion,iu as AccordionContent,nu as AccordionItem,ou as AccordionTrigger,Eo as ActionButton,Eo as ActionMenu,Ql as ActionMenuItems,jh as AggregationType,Hd as Alert,Kd as AlertDescription,Uo as AlertDialog,Ko as AlertDialogAction,Yo as AlertDialogCancel,$o as AlertDialogContent,Go as AlertDialogDescription,Wo as AlertDialogFooter,qo as AlertDialogHeader,Vo as AlertDialogOverlay,Bo as AlertDialogPortal,Ho as AlertDialogTitle,jo as AlertDialogTrigger,Gd as AlertTitle,$d as AliasRedirect,Vd as AliasRouteGuard,Vh as AnalysisFunctionality,Ov as AppHeader,Yv as AppLayout,Kv as AppSidebar,rx as ApprovalFlowReturnStep,tx as ApprovalSidenav,Yb as ApproveDialog,qs as AuthErrorInterceptor,ml as AuthProvider,ll as AuthService,bs as AutoComplete,su as Avatar,du as AvatarFallback,lu as AvatarImage,Ii as Badge,Sd as BaseForm,am as Blockquote,Jv as BodyContent,cu as Breadcrumb,gu as BreadcrumbEllipsis,mu as BreadcrumbItem,pu as BreadcrumbLink,uu as BreadcrumbList,hu as BreadcrumbPage,fu as BreadcrumbSeparator,xg as BurndownPanel,Ao as Button,bu as ButtonGroup,Jt as CRUD_CONFIG,jf as CURRENCY_FIELDS,xu as Calendar,Yd as CallbackPage,Io as Card,Lo as CardContent,zo as CardDescription,Fo as CardFooter,Mo as CardHeader,Al as CardSkeleton,Ro as CardTitle,hg as CartesianPanel,zp as ChartContainer,Up as ChartLegend,jp as ChartLegendContent,Lp as ChartStyle,Fp as ChartTooltip,Op as ChartTooltipContent,Di as Checkbox,fc as Collapsible,vc as CollapsibleContent,gc as CollapsibleTrigger,vd as ColorPicker,ud as ColumnSettingsPopover,Cs as ComboTree,bs as Combobox,is as Command,ss as CommandDialog,cs as CommandEmpty,us as CommandGroup,ls as CommandInput,ps as CommandItem,ds as CommandList,ms as CommandSeparator,hs as CommandShortcut,Xv as ContentContainer,zl as ContextMenu,Wl as ContextMenuCheckboxItem,$l as ContextMenuContent,Fl as ContextMenuGroup,ql as ContextMenuItem,Gl as ContextMenuLabel,Ol as ContextMenuPortal,jl as ContextMenuRadioGroup,Hl as ContextMenuRadioItem,Kl as ContextMenuSeparator,Yl as ContextMenuShortcut,Ul as ContextMenuSub,Vl as ContextMenuSubContent,Bl as ContextMenuSubTrigger,Ll as ContextMenuTrigger,eu as CoreProviders,id as CrudActionBar,bv as CrudActionMenu,gv as CrudGrid,Rd as CrudPageInternal,Ed as CrudPagination,xv as CrudPrimitiveFilterBar,Ad as CrudPrimitivePagination,vv as CrudPrimitiveTable,pd as CrudTable,Gb as CustomFormFields,Uf as DASHBOARD_STORAGE_KEYS,Qn as DATETIME_FORMATS,Zn as DEFAULT_DATETIME_FORMAT,Jn as DEFAULT_LOCALE,eo as DEFAULT_TIMEZONE,Ug as DashboardForm,cf as DashboardFormTab,$h as DashboardFunctionality,jg as DashboardGeneralView,Sg as DashboardGrid,hf as DashboardLanguage,Mg as DashboardList,Wh as DashboardListType,Gh as DashboardPageTime,Yh as DashboardPanelDimension,Zh as DashboardPanelOrderBy,Xh as DashboardPanelOrderByType,af as DashboardPanelPeriod,Eg as DashboardPanelRenderer,rf as DashboardPanelType,mf as DashboardShareType,of as DashboardUpdateTime,Dg as DashboardView,lf as DashboardViewType,xv as DataFilterBar,yu as DataList,Ad as DataPagination,vv as DataTable,wu as DatePicker,Qo as Dialog,ni as DialogBody,Zo as DialogClose,ti as DialogContent,si as DialogDescription,oi as DialogFooter,ri as DialogHeader,ei as DialogOverlay,Jo as DialogPortal,ii as DialogTitle,Xo as DialogTrigger,nh as DialogWizard,ts as DisabledMenuItem,Nu as Drawer,ku as DrawerClose,Au as DrawerContent,Tu as DrawerDescription,Du as DrawerFooter,Eu as DrawerHeader,Su as DrawerOverlay,Cu as DrawerPortal,Pu as DrawerTitle,_u as DrawerTrigger,Fi as DropdownMenu,Gi as DropdownMenuCheckboxItem,Wi as DropdownMenuContent,Ui as DropdownMenuGroup,Hi as DropdownMenuItem,Yi as DropdownMenuLabel,ji as DropdownMenuPortal,Vi as DropdownMenuRadioGroup,Ki as DropdownMenuRadioItem,Qi as DropdownMenuSeparator,Xi as DropdownMenuShortcut,Bi as DropdownMenuSub,qi as DropdownMenuSubContent,$i as DropdownMenuSubTrigger,Oi as DropdownMenuTrigger,Ab as ECustomFormFieldType,Db as EFieldViewMode,Tb as ESelectionFieldDataSource,th as ElectronicSignatureDialog,Ml as EllipsisText,nb as EmailService,Il as EmptyState,bs as EntitySelect,bc as ErrorBoundary,eh as ExportDialog,Qp as ExportFormat,_b as FORBIDDEN_FILE_TYPES,uh as FilePrintType,dh as FileViewerType,Md as FilterBar,li as Form,fi as FormControl,jb as FormDateField,gi as FormDescription,ci as FormField,pi as FormItem,hi as FormLabel,vi as FormMessage,Wb as FormMultiSelectionField,$b as FormNumericField,Hb as FormQuestionsField,qb as FormSingleSelectionField,El as FormSkeleton,Ub as FormTextField,Bb as FormTimeField,Vb as FormUrlField,Ru as Grid,Wu as H1,Hu as H2,Gu as H3,Ku as H4,Dl as HeaderSkeleton,zu as HoverCard,Fu as HoverCardContent,Lu as HoverCardTrigger,Nd as IconPicker,Nh as IframeDialog,gb as ImageEditor,vb as ImageRenderer,em as InlineCode,Do as Input,Ou as InputGroup,ju as InputGroupAddon,Vu as InputGroupButton,$u as InputGroupInput,qu as InputGroupTextarea,Bf as LINK_PROPERTIES,ir as LOGO_CONFIG,To as Label,Xu as Large,Qu as Lead,tm as List,ug as ListPanel,zi as LoadingState,cc as LocaleProvider,Qd as LoginPage,sr as MESSAGES,Fc as MODULES_DATA,Of as MONTHS_MAP,wg as MatrixRiskPanel,gf as MatrixViewType,wp as Menubar,Ap as MenubarCheckboxItem,kp as MenubarContent,vp as MenubarGroup,Sp as MenubarItem,Dp as MenubarLabel,gp as MenubarMenu,bp as MenubarPortal,yp as MenubarRadioGroup,Ep as MenubarRadioItem,Pp as MenubarSeparator,Tp as MenubarShortcut,xp as MenubarSub,Cp as MenubarSubContent,_p as MenubarSubTrigger,Np as MenubarTrigger,fv as MindMap,Wv as ModalStateProvider,Yc as ModuleAccessGuard,jc as ModuleGrid,Qc as ModuleOfferContent,pc as ModuleProvider,Bc as ModulesContent,Hc as ModulesDialog,Lc as ModulesFooterCards,bs as MultiSelect,Dh as MultiselectPermissions,Zu as Muted,rm as NavigationMenu,lm as NavigationMenuContent,um as NavigationMenuIndicator,om as NavigationMenuItem,dm as NavigationMenuLink,nm as NavigationMenuList,sm as NavigationMenuTrigger,cm as NavigationMenuViewport,Iv as NavigationProvider,dg as NumericPanel,Kp as OnboardingDialog,wh as OnlineEditorDialog,Yu as P,Ht as PROD_PROJECT_ID,mm as PageBreadcrumb,Jd as PageMetadataProvider,hm as Pagination,fm as PaginationContent,ym as PaginationEllipsis,gm as PaginationItem,vm as PaginationLink,xm as PaginationNext,bm as PaginationPrevious,Lf as PaletteType,ng as PanelError,rg as PanelHeader,bf as PanelItemsPerPanel,og as PanelLoader,ig as PanelNoData,yf as PanelSortType,Nf as PanelState,sg as PanelUnavailable,bg as ParetoPanel,yg as PerformancePanel,vg as PiePanel,Sf as PlanType,rs as Popover,os as PopoverContent,ns as PopoverTrigger,wm as Progress,jd as ProtectedRoute,or as QUALIEX_CONFIG,nr as QUERY_KEYS,Js as QualiexEnrichmentService,Ws as QualiexErrorInterceptor,kd as QualiexUserField,Ef as QueriesContextType,Pf as QueriesShareType,If as QuickFilterDashboard,Nm as RadioGroup,_m as RadioGroupItem,Ob as ReadOnlyTextField,zh as ReportRequestList,Ph as ReportRequestStatus,Sm as ResizableHandle,km as ResizablePanel,Cm as ResizablePanelGroup,qp as RichTextEditor,Rf as RiskCriticality,Zt as SEARCH_CONFIG,Yn as SUPPORTED_LOCALES,bd as ScrollArea,xd as ScrollBar,xi as Select,Qb as SelectApproverDialog,ki as SelectContent,yi as SelectGroup,Ai as SelectItem,Si as SelectLabel,Ci as SelectScrollDownButton,_i as SelectScrollUpButton,bs as SelectSearch,Ei as SelectSeparator,Ni as SelectTrigger,wi as SelectValue,Oo as Separator,Am as Sheet,zm as SheetBody,Dm as SheetClose,Mm as SheetContent,Om as SheetDescription,Lm as SheetFooter,Rm as SheetHeader,Tm as SheetOverlay,Pm as SheetPortal,Fm as SheetTitle,Em as SheetTrigger,$m as Sidebar,jv as SidebarActionTrigger,Xm as SidebarContent,Ym as SidebarFooter,Jm as SidebarGroup,ep as SidebarGroupAction,ap as SidebarGroupContent,Zm as SidebarGroupLabel,Qv as SidebarHeader,Gm as SidebarInput,Hm as SidebarInset,Fv as SidebarLogo,tp as SidebarMenu,ip as SidebarMenuAction,sp as SidebarMenuBadge,op as SidebarMenuButton,rp as SidebarMenuItem,lp as SidebarMenuSkeleton,dp as SidebarMenuSub,up as SidebarMenuSubButton,cp as SidebarMenuSubItem,Vm as SidebarProvider,Wm as SidebarRail,Qm as SidebarSeparator,Pl as SidebarSkeleton,qm as SidebarTrigger,Sb as SingleFileUpload,fs as Skeleton,mp as Slider,Ju as Small,Li as SonnerToaster,Ri as Spinner,Yp as SplitButton,Id as Stack,Oh as StatusBadge,rh as StepSelector,rh as Stepper,Lh as StimulsoftViewer,_d as Switch,Xn as TIMEZONES,fp as TabPageContent,hp as TabPageHeader,pp as TabPageLayout,bl as Table,yl as TableBody,kl as TableCaption,Cl as TableCell,wl as TableFooter,_l as TableHead,xl as TableHeader,Rl as TableResizeHandle,Nl as TableRow,Xl as TableRowActions,Sl as TableSkeleton,xc as Tabs,Nc as TabsContent,yc as TabsList,wc as TabsTrigger,ox as TeamSelector,_h as TermsOfUseDialog,Ch as TermsOfUseViewer,cg as TextPanel,Pi as Textarea,ah as Timepicker,Li as Toaster,td as Toggle,nd as ToggleGroup,od as ToggleGroupItem,Rs as TokenManager,ks as TokenService,Zi as Tooltip,as as TooltipContent,Ji as TooltipProvider,es as TooltipTrigger,Cs as TreeSelect,Cv as TreeTable,Ml as TruncatedCell,lh as UpdatesNotification,Sh as UsersGroupsSelector,hb as VideoEditor,fb as VideoRenderer,xh as ViewerDialog,Cf as VisualizationType,ic as addAppTranslations,Gg as addChild,Kg as addSibling,cr as assets,Ti as badgeVariants,wo as buildModuleUrl,Zf as buildPlacesTree,bh as buildWopiUrl,vu as buttonGroupVariants,So as buttonVariants,bb as calculateAspectRatio,No as cn,zd as createCrudPage,Sv as createCrudRoutingConfig,Vg as createMindMapNode,kv as createRoutingHandlers,al as createService,Ld as createSimpleSaveHandler,fl as createSimpleService,Uh as createStatusConfig,lr as createTranslatedMessages,Jf as currencyFormatter,Co as debounce,Ks as deriveEmailField,Gs as deriveNameField,Ys as deriveUsernameField,so as detectBrowserLocale,uo as detectBrowserPreferences,lo as detectBrowserTimezone,mb as detectVideoProvider,ob as emailService,zs as errorService,mv as exportMindMap,wb as extractImageFileName,Xf as extractNumberFromCurrency,db as extractVimeoId,sb as extractYouTubeId,to as findDatetimeFormat,ao as findLocale,$g as findNode,ro as findTimezone,Cb as formatBytes,fo as formatCurrency,ho as formatDate,po as formatDatetime,Nb as formatFileSize,Fd as generateCrudConfig,Bg as generateNodeId,vo as generatePastelBg,nl as getBackendMode,xo as getContrastRatio,_g as getDefaultPanelSize,Yt as getEnvironmentConfig,Mb as getFieldValue,kb as getFileExtension,zb as getFormFieldValues,Hf as getLinkFromRow,bo as getLuminance,Cg as getMinPanelSize,fh as getOnlineViewerType,rr as getQualiexApiUrl,Bs as getSupabaseClient,hh as getViewerType,vh as getWopiViewer,yo as handleExternalLink,hv as importMindMap,co as inferDatetimeFormat,Uu as inputGroupAddonVariants,Bu as inputGroupButtonVariants,Qf as isCurrency,tr as isDevEnvironment,Qt as isDevSupabaseProject,yb as isImageUrl,er as isLovablePreview,qf as isNullOrEmptyField,ol as isSupabaseBackend,Us as isSupabaseConfigured,oo as isValidDatetimeFormat,no as isValidLocale,io as isValidTimezone,Jc as loadForlogicFonts,ur as logoSrc,tb as mergeTranslationFiles,Qg as moveNode,im as navigationMenuTriggerStyle,pb as normalizeVideoUrl,cb as normalizeVimeoUrl,lb as normalizeYouTubeUrl,ub as parseIframeSrc,Wf as processUrl,Hs as qualiexApi,Yg as removeNode,xb as resizeKeepingAspect,Qs as resolveFieldMappings,zv as resolvePageTitle,rl as setBackendMode,Jg as setCollapsedAll,Lb as setFormFieldValues,ac as setupQualiexCore,Rb as shouldShowField,ar as shouldUseDevTokens,ko as slugify,mr as smallLogoSrc,Vf as sortByMonthYear,Gf as toQueryString,Xg as toggleCollapsed,ad as toggleVariants,zc as trackFooterClick,Rc as trackInterestClick,Mc as trackModuleClick,_o as trimTextFields,Zv as useActiveModules,Bd as useAliasFromUrl,pl as useAuth,hd as useBaseForm,Zc as useClarity,dd as useColumnManager,ed as useColumnResize,hl as useCrud,Lv as useDebounce,Wc as useDerivedContractedModules,ui as useFormField,Gv as useHasOpenModal,rb as useI18nFormatters,vl as useIsMobile,uc as useLocale,gl as useMediaQuery,ib as useMediaUpload,Hv as useModalState,qc as useModuleAccess,hc as useModuleConfig,Mv as useNavigation,ec as usePageMetadata,Zd as usePageMetadataContext,Rv as usePageTitle,Uv as usePermissionQuery,Cd as useQualiexUsers,pm as useRouteBreadcrumbs,eb as useRowResize,Bm as useSidebar,$v as useSidebarResize,sh as useUpdatesNotification,ab as useWizard,Fb as validateFields};