forlogic-core 2.4.3 → 2.4.5

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 (1653) hide show
  1. package/dist/action-plans/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  2. package/dist/action-plans/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  3. package/dist/action-plans/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  4. package/dist/action-plans/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  5. package/dist/action-plans/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  6. package/dist/action-plans/action-plans/components/ActionPlanPage.d.ts +25 -0
  7. package/dist/action-plans/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  8. package/dist/action-plans/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  9. package/dist/action-plans/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  10. package/dist/action-plans/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  11. package/dist/action-plans/action-plans/constants.d.ts +86 -0
  12. package/dist/action-plans/action-plans/hooks/useActionPlan.d.ts +19 -0
  13. package/dist/action-plans/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  14. package/dist/action-plans/action-plans/index.d.ts +15 -0
  15. package/dist/action-plans/action-plans/types.d.ts +413 -0
  16. package/dist/action-plans/action-plans/utils/formatTime.d.ts +24 -0
  17. package/dist/action-plans/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  18. package/dist/action-plans/approval-flow/components/ApproveDialog.d.ts +13 -0
  19. package/dist/action-plans/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  20. package/dist/action-plans/approval-flow/index.d.ts +4 -0
  21. package/dist/action-plans/approval-flow/types.d.ts +76 -0
  22. package/dist/action-plans/assets/index.d.ts +7 -0
  23. package/dist/action-plans/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  24. package/dist/action-plans/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  25. package/dist/action-plans/audit-trail/components/AuditTrailPage.d.ts +40 -0
  26. package/dist/action-plans/audit-trail/index.d.ts +9 -0
  27. package/dist/action-plans/audit-trail/types.d.ts +209 -0
  28. package/dist/action-plans/audit-trail/utils.d.ts +54 -0
  29. package/dist/action-plans/auth/components/AliasRedirect.d.ts +13 -0
  30. package/dist/action-plans/auth/components/AliasRouteGuard.d.ts +20 -0
  31. package/dist/action-plans/auth/components/EditProfileDialog.d.ts +13 -0
  32. package/dist/action-plans/auth/components/ProtectedRoute.d.ts +11 -0
  33. package/dist/action-plans/auth/components/UserInfo.d.ts +10 -0
  34. package/dist/action-plans/auth/contexts/AuthContext.d.ts +89 -0
  35. package/dist/action-plans/auth/pages/CallbackPage.d.ts +6 -0
  36. package/dist/action-plans/auth/pages/LoginPage.d.ts +2 -0
  37. package/dist/action-plans/auth/services/AuthService.d.ts +64 -0
  38. package/dist/action-plans/auth/services/SupabaseTokenService.d.ts +3 -0
  39. package/dist/action-plans/auth/services/TokenManager.d.ts +66 -0
  40. package/dist/action-plans/auth/services/TokenRegenerationService.d.ts +14 -0
  41. package/dist/action-plans/auth/services/TokenService.d.ts +48 -0
  42. package/dist/action-plans/auth/utils/ErrorInterceptor.d.ts +20 -0
  43. package/dist/action-plans/components/ErrorBoundary.d.ts +19 -0
  44. package/dist/action-plans/components/dashboards/dashboard-form.d.ts +65 -0
  45. package/dist/action-plans/components/dashboards/dashboard-general-view.d.ts +124 -0
  46. package/dist/action-plans/components/dashboards/dashboard-grid.d.ts +66 -0
  47. package/dist/action-plans/components/dashboards/dashboard-list.d.ts +41 -0
  48. package/dist/action-plans/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  49. package/dist/action-plans/components/dashboards/dashboard-view.d.ts +48 -0
  50. package/dist/action-plans/components/dashboards/helpers.d.ts +86 -0
  51. package/dist/action-plans/components/dashboards/index.d.ts +9 -0
  52. package/dist/action-plans/components/dashboards/panels/burndown-panel.d.ts +41 -0
  53. package/dist/action-plans/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  54. package/dist/action-plans/components/dashboards/panels/index.d.ts +14 -0
  55. package/dist/action-plans/components/dashboards/panels/list-panel.d.ts +45 -0
  56. package/dist/action-plans/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  57. package/dist/action-plans/components/dashboards/panels/numeric-panel.d.ts +32 -0
  58. package/dist/action-plans/components/dashboards/panels/panel-error.d.ts +18 -0
  59. package/dist/action-plans/components/dashboards/panels/panel-header.d.ts +27 -0
  60. package/dist/action-plans/components/dashboards/panels/panel-loader.d.ts +17 -0
  61. package/dist/action-plans/components/dashboards/panels/panel-no-data.d.ts +16 -0
  62. package/dist/action-plans/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  63. package/dist/action-plans/components/dashboards/panels/pareto-panel.d.ts +30 -0
  64. package/dist/action-plans/components/dashboards/panels/performance-panel.d.ts +39 -0
  65. package/dist/action-plans/components/dashboards/panels/pie-panel.d.ts +29 -0
  66. package/dist/action-plans/components/dashboards/panels/text-panel.d.ts +28 -0
  67. package/dist/action-plans/components/dashboards/types.d.ts +755 -0
  68. package/dist/action-plans/components/layout/AppHeader.d.ts +6 -0
  69. package/dist/action-plans/components/layout/AppLayout.d.ts +10 -0
  70. package/dist/action-plans/components/layout/AppSidebar.d.ts +10 -0
  71. package/dist/action-plans/components/layout/BodyContent.d.ts +60 -0
  72. package/dist/action-plans/components/layout/SidebarActionTrigger.d.ts +46 -0
  73. package/dist/action-plans/components/layout/SidebarHeader.d.ts +5 -0
  74. package/dist/action-plans/components/layout/SidebarLogo.d.ts +5 -0
  75. package/dist/action-plans/components/layout/sidebar-utils.d.ts +12 -0
  76. package/dist/action-plans/components/modules/AccessDeniedDialog.d.ts +43 -0
  77. package/dist/action-plans/components/modules/ModuleAccessGuard.d.ts +42 -0
  78. package/dist/action-plans/components/modules/ModuleGrid.d.ts +9 -0
  79. package/dist/action-plans/components/modules/ModuleOfferContent.d.ts +20 -0
  80. package/dist/action-plans/components/modules/ModulesContent.d.ts +21 -0
  81. package/dist/action-plans/components/modules/ModulesDialog.d.ts +3 -0
  82. package/dist/action-plans/components/modules/ModulesFooterCards.d.ts +10 -0
  83. package/dist/action-plans/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  84. package/dist/action-plans/components/modules/index.d.ts +14 -0
  85. package/dist/action-plans/components/modules/modulesData.d.ts +6 -0
  86. package/dist/action-plans/components/modules/types.d.ts +41 -0
  87. package/dist/action-plans/components/ui/accordion.d.ts +42 -0
  88. package/dist/action-plans/components/ui/action-button.d.ts +48 -0
  89. package/dist/action-plans/components/ui/alert-dialog.d.ts +102 -0
  90. package/dist/action-plans/components/ui/alert.d.ts +44 -0
  91. package/dist/action-plans/components/ui/avatar.d.ts +36 -0
  92. package/dist/action-plans/components/ui/badge.d.ts +41 -0
  93. package/dist/action-plans/components/ui/breadcrumb.d.ts +73 -0
  94. package/dist/action-plans/components/ui/button-group.d.ts +24 -0
  95. package/dist/action-plans/components/ui/button.d.ts +66 -0
  96. package/dist/action-plans/components/ui/calendar.d.ts +24 -0
  97. package/dist/action-plans/components/ui/card.d.ts +57 -0
  98. package/dist/action-plans/components/ui/chart.d.ts +97 -0
  99. package/dist/action-plans/components/ui/checkbox.d.ts +15 -0
  100. package/dist/action-plans/components/ui/collapsible.d.ts +20 -0
  101. package/dist/action-plans/components/ui/color-picker.d.ts +19 -0
  102. package/dist/action-plans/components/ui/combo-tree.d.ts +103 -0
  103. package/dist/action-plans/components/ui/combobox.d.ts +64 -0
  104. package/dist/action-plans/components/ui/command.d.ts +89 -0
  105. package/dist/action-plans/components/ui/context-menu.d.ts +122 -0
  106. package/dist/action-plans/components/ui/data-list.d.ts +86 -0
  107. package/dist/action-plans/components/ui/date-picker.d.ts +19 -0
  108. package/dist/action-plans/components/ui/dialog-wizard.d.ts +100 -0
  109. package/dist/action-plans/components/ui/dialog.d.ts +229 -0
  110. package/dist/action-plans/components/ui/disabled-menu-item.d.ts +25 -0
  111. package/dist/action-plans/components/ui/drawer.d.ts +94 -0
  112. package/dist/action-plans/components/ui/dropdown-menu.d.ts +180 -0
  113. package/dist/action-plans/components/ui/electronic-signature-dialog.d.ts +31 -0
  114. package/dist/action-plans/components/ui/empty-state.d.ts +79 -0
  115. package/dist/action-plans/components/ui/export-dialog.d.ts +48 -0
  116. package/dist/action-plans/components/ui/form.d.ts +119 -0
  117. package/dist/action-plans/components/ui/grid.d.ts +53 -0
  118. package/dist/action-plans/components/ui/hover-card.d.ts +21 -0
  119. package/dist/action-plans/components/ui/icon-picker.d.ts +17 -0
  120. package/dist/action-plans/components/ui/iframe-dialog.d.ts +24 -0
  121. package/dist/action-plans/components/ui/input-group.d.ts +113 -0
  122. package/dist/action-plans/components/ui/input.d.ts +24 -0
  123. package/dist/action-plans/components/ui/label.d.ts +23 -0
  124. package/dist/action-plans/components/ui/loading-state.d.ts +52 -0
  125. package/dist/action-plans/components/ui/menubar.d.ts +113 -0
  126. package/dist/action-plans/components/ui/multiselect-permissions.d.ts +84 -0
  127. package/dist/action-plans/components/ui/navigation-menu.d.ts +57 -0
  128. package/dist/action-plans/components/ui/onboarding-dialog.d.ts +58 -0
  129. package/dist/action-plans/components/ui/online-editor-dialog.d.ts +28 -0
  130. package/dist/action-plans/components/ui/page-breadcrumb.d.ts +77 -0
  131. package/dist/action-plans/components/ui/pagination.d.ts +81 -0
  132. package/dist/action-plans/components/ui/popover.d.ts +57 -0
  133. package/dist/action-plans/components/ui/progress.d.ts +22 -0
  134. package/dist/action-plans/components/ui/radio-group.d.ts +66 -0
  135. package/dist/action-plans/components/ui/report-request-list.d.ts +64 -0
  136. package/dist/action-plans/components/ui/resizable.d.ts +38 -0
  137. package/dist/action-plans/components/ui/rich-text-editor.d.ts +58 -0
  138. package/dist/action-plans/components/ui/scroll-area.d.ts +40 -0
  139. package/dist/action-plans/components/ui/select.d.ts +94 -0
  140. package/dist/action-plans/components/ui/separator.d.ts +17 -0
  141. package/dist/action-plans/components/ui/sheet.d.ts +108 -0
  142. package/dist/action-plans/components/ui/sidebar.d.ts +269 -0
  143. package/dist/action-plans/components/ui/skeleton-variants.d.ts +41 -0
  144. package/dist/action-plans/components/ui/skeleton.d.ts +14 -0
  145. package/dist/action-plans/components/ui/slider.d.ts +9 -0
  146. package/dist/action-plans/components/ui/sonner.d.ts +8 -0
  147. package/dist/action-plans/components/ui/spinner.d.ts +11 -0
  148. package/dist/action-plans/components/ui/split-button.d.ts +76 -0
  149. package/dist/action-plans/components/ui/stack.d.ts +17 -0
  150. package/dist/action-plans/components/ui/status-badge.d.ts +52 -0
  151. package/dist/action-plans/components/ui/step-selector.d.ts +46 -0
  152. package/dist/action-plans/components/ui/stimulsoft-viewer.d.ts +28 -0
  153. package/dist/action-plans/components/ui/switch.d.ts +25 -0
  154. package/dist/action-plans/components/ui/tab-page-layout.d.ts +52 -0
  155. package/dist/action-plans/components/ui/table-resize-handle.d.ts +22 -0
  156. package/dist/action-plans/components/ui/table.d.ts +112 -0
  157. package/dist/action-plans/components/ui/tabs.d.ts +66 -0
  158. package/dist/action-plans/components/ui/terms-of-use-dialog.d.ts +102 -0
  159. package/dist/action-plans/components/ui/textarea.d.ts +33 -0
  160. package/dist/action-plans/components/ui/timepicker.d.ts +34 -0
  161. package/dist/action-plans/components/ui/toggle-group.d.ts +37 -0
  162. package/dist/action-plans/components/ui/toggle.d.ts +33 -0
  163. package/dist/action-plans/components/ui/tooltip.d.ts +61 -0
  164. package/dist/action-plans/components/ui/truncated-cell.d.ts +20 -0
  165. package/dist/action-plans/components/ui/typography.d.ts +135 -0
  166. package/dist/action-plans/components/ui/updates-notification.d.ts +47 -0
  167. package/dist/action-plans/components/ui/users-groups-selector.d.ts +87 -0
  168. package/dist/action-plans/components/ui/viewer-dialog.d.ts +184 -0
  169. package/dist/action-plans/config/backend.d.ts +10 -0
  170. package/dist/action-plans/config/environments.d.ts +27 -0
  171. package/dist/action-plans/config/index.d.ts +75 -0
  172. package/dist/action-plans/contexts/LocaleContext.d.ts +15 -0
  173. package/dist/action-plans/contexts/ModalStateContext.d.ts +57 -0
  174. package/dist/action-plans/contexts/ModuleContext.d.ts +34 -0
  175. package/dist/action-plans/contexts/NavigationContext.d.ts +13 -0
  176. package/dist/action-plans/contexts/PageMetadataContext.d.ts +48 -0
  177. package/dist/action-plans/crud/components/ActionMenuItems.d.ts +22 -0
  178. package/dist/action-plans/crud/components/BaseForm.d.ts +52 -0
  179. package/dist/action-plans/crud/components/ColumnSettingsPopover.d.ts +28 -0
  180. package/dist/action-plans/crud/components/ContextMenu.d.ts +21 -0
  181. package/dist/action-plans/crud/components/CrudActionBar.d.ts +59 -0
  182. package/dist/action-plans/crud/components/CrudGrid.d.ts +53 -0
  183. package/dist/action-plans/crud/components/CrudPagination.d.ts +17 -0
  184. package/dist/action-plans/crud/components/CrudTable.d.ts +66 -0
  185. package/dist/action-plans/crud/components/FilterBar.d.ts +136 -0
  186. package/dist/action-plans/crud/components/GroupDropZone.d.ts +16 -0
  187. package/dist/action-plans/crud/components/InlineRowActions.d.ts +15 -0
  188. package/dist/action-plans/crud/components/SelectionCheckbox.d.ts +9 -0
  189. package/dist/action-plans/crud/components/TableFooter.d.ts +14 -0
  190. package/dist/action-plans/crud/components/TableRowActions.d.ts +19 -0
  191. package/dist/action-plans/crud/createCrudPage.d.ts +134 -0
  192. package/dist/action-plans/crud/createSimpleService.d.ts +85 -0
  193. package/dist/action-plans/crud/generateCrudConfig.d.ts +78 -0
  194. package/dist/action-plans/crud/hooks/useBaseForm.d.ts +47 -0
  195. package/dist/action-plans/crud/hooks/useColumnDragReorder.d.ts +19 -0
  196. package/dist/action-plans/crud/hooks/useColumnManager.d.ts +85 -0
  197. package/dist/action-plans/crud/hooks/useCrud.d.ts +152 -0
  198. package/dist/action-plans/crud/primitives/ActionMenu.d.ts +69 -0
  199. package/dist/action-plans/crud/primitives/FilterBar.d.ts +69 -0
  200. package/dist/action-plans/crud/primitives/Pagination.d.ts +29 -0
  201. package/dist/action-plans/crud/primitives/Table.d.ts +31 -0
  202. package/dist/action-plans/crud/primitives/TreeTable.d.ts +7 -0
  203. package/dist/action-plans/crud/primitives/index.d.ts +12 -0
  204. package/dist/action-plans/crud/primitives/types.d.ts +199 -0
  205. package/dist/action-plans/crud/utils/routingHelpers.d.ts +41 -0
  206. package/dist/action-plans/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  207. package/dist/action-plans/custom-form-fields/fields/FormDateField.d.ts +9 -0
  208. package/dist/action-plans/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  209. package/dist/action-plans/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  210. package/dist/action-plans/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  211. package/dist/action-plans/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  212. package/dist/action-plans/custom-form-fields/fields/FormTextField.d.ts +9 -0
  213. package/dist/action-plans/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  214. package/dist/action-plans/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  215. package/dist/action-plans/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  216. package/dist/action-plans/custom-form-fields/index.d.ts +13 -0
  217. package/dist/action-plans/custom-form-fields/types.d.ts +206 -0
  218. package/dist/action-plans/exports/action-plans.d.ts +16 -0
  219. package/dist/action-plans/exports/audit-trail.d.ts +1 -0
  220. package/dist/action-plans/exports/crud.d.ts +31 -0
  221. package/dist/action-plans/exports/custom-form-fields.d.ts +1 -0
  222. package/dist/action-plans/exports/file-upload.d.ts +1 -0
  223. package/dist/action-plans/exports/integrations.d.ts +15 -0
  224. package/dist/action-plans/exports/ui.d.ts +100 -0
  225. package/dist/action-plans/file-upload/components/SingleFileUpload.d.ts +102 -0
  226. package/dist/action-plans/file-upload/index.d.ts +6 -0
  227. package/dist/action-plans/file-upload/types.d.ts +26 -0
  228. package/dist/action-plans/file-upload/utils/formatBytes.d.ts +6 -0
  229. package/dist/action-plans/file-upload/utils/getFileExtension.d.ts +6 -0
  230. package/dist/action-plans/hooks/useActiveModules.d.ts +45 -0
  231. package/dist/action-plans/hooks/useAliasFromUrl.d.ts +33 -0
  232. package/dist/action-plans/hooks/useColumnResize.d.ts +45 -0
  233. package/dist/action-plans/hooks/useDebounce.d.ts +56 -0
  234. package/dist/action-plans/hooks/useDerivedContractedModules.d.ts +8 -0
  235. package/dist/action-plans/hooks/useI18nFormatters.d.ts +40 -0
  236. package/dist/action-plans/hooks/useMediaQuery.d.ts +14 -0
  237. package/dist/action-plans/hooks/useModuleAccess.d.ts +59 -0
  238. package/dist/action-plans/hooks/usePageTitle.d.ts +10 -0
  239. package/dist/action-plans/hooks/usePermissionQuery.d.ts +49 -0
  240. package/dist/action-plans/hooks/useRowResize.d.ts +37 -0
  241. package/dist/action-plans/hooks/useSidebarResize.d.ts +37 -0
  242. package/dist/action-plans/hooks/useUpdatesNotification.d.ts +27 -0
  243. package/dist/action-plans/hooks/useWizard.d.ts +40 -0
  244. package/dist/action-plans/i18n/LanguageBootstrap.d.ts +14 -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 +12 -0
  248. package/dist/action-plans/i18n/utils.d.ts +14 -0
  249. package/dist/action-plans/integrations/clarity/clarityTracking.d.ts +31 -0
  250. package/dist/action-plans/integrations/clarity/index.d.ts +3 -0
  251. package/dist/action-plans/integrations/clarity/types.d.ts +46 -0
  252. package/dist/action-plans/integrations/clarity/useClarity.d.ts +34 -0
  253. package/dist/action-plans/integrations/index.d.ts +5 -0
  254. package/dist/action-plans/leadership/components/LeadershipDialog.d.ts +10 -0
  255. package/dist/action-plans/leadership/components/LeadershipForm.d.ts +8 -0
  256. package/dist/action-plans/leadership/components/LeadershipPage.d.ts +19 -0
  257. package/dist/action-plans/leadership/hooks/useLeadershipApi.d.ts +4 -0
  258. package/dist/action-plans/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  259. package/dist/action-plans/leadership/index.d.ts +13 -0
  260. package/dist/action-plans/leadership/types.d.ts +23 -0
  261. package/dist/action-plans/leadership/utils/leadershipUtils.d.ts +8 -0
  262. package/dist/action-plans/media/components/ImageEditor.d.ts +22 -0
  263. package/dist/action-plans/media/components/ImageRenderer.d.ts +23 -0
  264. package/dist/action-plans/media/components/VideoEditor.d.ts +2 -0
  265. package/dist/action-plans/media/components/VideoRenderer.d.ts +2 -0
  266. package/dist/action-plans/media/hooks/useMediaUpload.d.ts +19 -0
  267. package/dist/action-plans/media/index.d.ts +49 -0
  268. package/dist/action-plans/media/types.d.ts +66 -0
  269. package/dist/action-plans/media/utils/imageHelpers.d.ts +28 -0
  270. package/dist/action-plans/media/utils/videoHelpers.d.ts +35 -0
  271. package/dist/action-plans/mind-map/components/MindMap.d.ts +23 -0
  272. package/dist/action-plans/mind-map/components/MindMapConnection.d.ts +12 -0
  273. package/dist/action-plans/mind-map/components/MindMapNodeView.d.ts +24 -0
  274. package/dist/action-plans/mind-map/components/MindMapToolbar.d.ts +26 -0
  275. package/dist/action-plans/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  276. package/dist/action-plans/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  277. package/dist/action-plans/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  278. package/dist/action-plans/mind-map/hooks/useMindMapState.d.ts +32 -0
  279. package/dist/action-plans/mind-map/index.d.ts +4 -0
  280. package/dist/action-plans/mind-map/types.d.ts +91 -0
  281. package/dist/action-plans/mind-map/utils/export-image.d.ts +9 -0
  282. package/dist/action-plans/mind-map/utils/layout.d.ts +15 -0
  283. package/dist/action-plans/mind-map/utils/nodeOps.d.ts +66 -0
  284. package/dist/action-plans/mind-map/utils/serialize.d.ts +10 -0
  285. package/dist/action-plans/modules/softwaresMap.d.ts +4 -0
  286. package/dist/action-plans/places/components/ManageAccessModal.d.ts +11 -0
  287. package/dist/action-plans/places/components/PlaceCard.d.ts +12 -0
  288. package/dist/action-plans/places/components/PlacesList.d.ts +12 -0
  289. package/dist/action-plans/places/index.d.ts +8 -0
  290. package/dist/action-plans/places/services/PlaceService.d.ts +9 -0
  291. package/dist/action-plans/places/types.d.ts +10 -0
  292. package/dist/action-plans/providers/CoreProviders.d.ts +107 -0
  293. package/dist/action-plans/providers/index.d.ts +2 -0
  294. package/dist/action-plans/qualiex/components/QualiexUserField.d.ts +133 -0
  295. package/dist/action-plans/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  296. package/dist/action-plans/qualiex/services/qualiexApi.d.ts +75 -0
  297. package/dist/action-plans/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  298. package/dist/action-plans/qualiex/utils/userPlaceUtils.d.ts +16 -0
  299. package/dist/action-plans/services/BaseService.d.ts +51 -0
  300. package/dist/action-plans/services/EmailService.d.ts +110 -0
  301. package/dist/action-plans/services/ErrorService.d.ts +19 -0
  302. package/dist/action-plans/services/QualiexEnrichmentService.d.ts +53 -0
  303. package/dist/action-plans/services/QualiexFieldHelpers.d.ts +17 -0
  304. package/dist/action-plans/setup/favicon.d.ts +1 -0
  305. package/dist/action-plans/setup.d.ts +16 -0
  306. package/dist/action-plans/sign/components/D4SignWidget.d.ts +2 -0
  307. package/dist/action-plans/sign/components/DocumentSigner.d.ts +2 -0
  308. package/dist/action-plans/sign/components/SignConfigForm.d.ts +2 -0
  309. package/dist/action-plans/sign/components/SignWidget.d.ts +9 -0
  310. package/dist/action-plans/sign/hooks/useSignConfig.d.ts +6 -0
  311. package/dist/action-plans/sign/index.d.ts +8 -0
  312. package/dist/action-plans/sign/services/signService.d.ts +17 -0
  313. package/dist/action-plans/sign/types.d.ts +53 -0
  314. package/dist/action-plans/sign/utils/loadClicksignScript.d.ts +13 -0
  315. package/dist/action-plans/supabase/SupabaseSingleton.d.ts +34 -0
  316. package/dist/action-plans/supabase/client.d.ts +2 -0
  317. package/dist/action-plans/supabase/legacyKeyGuard.d.ts +19 -0
  318. package/dist/action-plans/supabase/publicClient.d.ts +2 -0
  319. package/dist/action-plans/supabase/types.d.ts +377 -0
  320. package/dist/action-plans/team-selector/components/TeamSelector.d.ts +24 -0
  321. package/dist/action-plans/team-selector/index.d.ts +2 -0
  322. package/dist/action-plans/team-selector/types.d.ts +10 -0
  323. package/dist/action-plans/types/sidebar.d.ts +52 -0
  324. package/dist/action-plans/utils/color.d.ts +26 -0
  325. package/dist/action-plans/utils/formatters/currencyFormatters.d.ts +1 -0
  326. package/dist/action-plans/utils/formatters/dateFormatters.d.ts +52 -0
  327. package/dist/action-plans/utils/index.d.ts +9 -0
  328. package/dist/action-plans/utils/linkHelpers.d.ts +9 -0
  329. package/dist/action-plans/utils/load-fonts.d.ts +1 -0
  330. package/dist/assets/index.d.ts +33 -10
  331. package/dist/audit-trail/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  332. package/dist/audit-trail/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  333. package/dist/audit-trail/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  334. package/dist/audit-trail/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  335. package/dist/audit-trail/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  336. package/dist/audit-trail/action-plans/components/ActionPlanPage.d.ts +25 -0
  337. package/dist/audit-trail/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  338. package/dist/audit-trail/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  339. package/dist/audit-trail/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  340. package/dist/audit-trail/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  341. package/dist/audit-trail/action-plans/constants.d.ts +86 -0
  342. package/dist/audit-trail/action-plans/hooks/useActionPlan.d.ts +19 -0
  343. package/dist/audit-trail/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  344. package/dist/audit-trail/action-plans/index.d.ts +15 -0
  345. package/dist/audit-trail/action-plans/types.d.ts +413 -0
  346. package/dist/audit-trail/action-plans/utils/formatTime.d.ts +24 -0
  347. package/dist/audit-trail/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  348. package/dist/audit-trail/approval-flow/components/ApproveDialog.d.ts +13 -0
  349. package/dist/audit-trail/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  350. package/dist/audit-trail/approval-flow/index.d.ts +4 -0
  351. package/dist/audit-trail/approval-flow/types.d.ts +76 -0
  352. package/dist/audit-trail/assets/index.d.ts +7 -0
  353. package/dist/audit-trail/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  354. package/dist/audit-trail/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  355. package/dist/audit-trail/audit-trail/components/AuditTrailPage.d.ts +40 -0
  356. package/dist/audit-trail/audit-trail/index.d.ts +9 -0
  357. package/dist/audit-trail/audit-trail/types.d.ts +209 -0
  358. package/dist/audit-trail/audit-trail/utils.d.ts +54 -0
  359. package/dist/audit-trail/auth/components/AliasRedirect.d.ts +13 -0
  360. package/dist/audit-trail/auth/components/AliasRouteGuard.d.ts +20 -0
  361. package/dist/audit-trail/auth/components/EditProfileDialog.d.ts +13 -0
  362. package/dist/audit-trail/auth/components/ProtectedRoute.d.ts +11 -0
  363. package/dist/audit-trail/auth/components/UserInfo.d.ts +10 -0
  364. package/dist/audit-trail/auth/contexts/AuthContext.d.ts +89 -0
  365. package/dist/audit-trail/auth/pages/CallbackPage.d.ts +6 -0
  366. package/dist/audit-trail/auth/pages/LoginPage.d.ts +2 -0
  367. package/dist/audit-trail/auth/services/AuthService.d.ts +64 -0
  368. package/dist/audit-trail/auth/services/SupabaseTokenService.d.ts +3 -0
  369. package/dist/audit-trail/auth/services/TokenManager.d.ts +66 -0
  370. package/dist/audit-trail/auth/services/TokenRegenerationService.d.ts +14 -0
  371. package/dist/audit-trail/auth/services/TokenService.d.ts +48 -0
  372. package/dist/audit-trail/auth/utils/ErrorInterceptor.d.ts +20 -0
  373. package/dist/audit-trail/components/ErrorBoundary.d.ts +19 -0
  374. package/dist/audit-trail/components/dashboards/dashboard-form.d.ts +65 -0
  375. package/dist/audit-trail/components/dashboards/dashboard-general-view.d.ts +124 -0
  376. package/dist/audit-trail/components/dashboards/dashboard-grid.d.ts +66 -0
  377. package/dist/audit-trail/components/dashboards/dashboard-list.d.ts +41 -0
  378. package/dist/audit-trail/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  379. package/dist/audit-trail/components/dashboards/dashboard-view.d.ts +48 -0
  380. package/dist/audit-trail/components/dashboards/helpers.d.ts +86 -0
  381. package/dist/audit-trail/components/dashboards/index.d.ts +9 -0
  382. package/dist/audit-trail/components/dashboards/panels/burndown-panel.d.ts +41 -0
  383. package/dist/audit-trail/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  384. package/dist/audit-trail/components/dashboards/panels/index.d.ts +14 -0
  385. package/dist/audit-trail/components/dashboards/panels/list-panel.d.ts +45 -0
  386. package/dist/audit-trail/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  387. package/dist/audit-trail/components/dashboards/panels/numeric-panel.d.ts +32 -0
  388. package/dist/audit-trail/components/dashboards/panels/panel-error.d.ts +18 -0
  389. package/dist/audit-trail/components/dashboards/panels/panel-header.d.ts +27 -0
  390. package/dist/audit-trail/components/dashboards/panels/panel-loader.d.ts +17 -0
  391. package/dist/audit-trail/components/dashboards/panels/panel-no-data.d.ts +16 -0
  392. package/dist/audit-trail/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  393. package/dist/audit-trail/components/dashboards/panels/pareto-panel.d.ts +30 -0
  394. package/dist/audit-trail/components/dashboards/panels/performance-panel.d.ts +39 -0
  395. package/dist/audit-trail/components/dashboards/panels/pie-panel.d.ts +29 -0
  396. package/dist/audit-trail/components/dashboards/panels/text-panel.d.ts +28 -0
  397. package/dist/audit-trail/components/dashboards/types.d.ts +755 -0
  398. package/dist/audit-trail/components/layout/AppHeader.d.ts +6 -0
  399. package/dist/audit-trail/components/layout/AppLayout.d.ts +10 -0
  400. package/dist/audit-trail/components/layout/AppSidebar.d.ts +10 -0
  401. package/dist/audit-trail/components/layout/BodyContent.d.ts +60 -0
  402. package/dist/audit-trail/components/layout/SidebarActionTrigger.d.ts +46 -0
  403. package/dist/audit-trail/components/layout/SidebarHeader.d.ts +5 -0
  404. package/dist/audit-trail/components/layout/SidebarLogo.d.ts +5 -0
  405. package/dist/audit-trail/components/layout/sidebar-utils.d.ts +12 -0
  406. package/dist/audit-trail/components/modules/AccessDeniedDialog.d.ts +43 -0
  407. package/dist/audit-trail/components/modules/ModuleAccessGuard.d.ts +42 -0
  408. package/dist/audit-trail/components/modules/ModuleGrid.d.ts +9 -0
  409. package/dist/audit-trail/components/modules/ModuleOfferContent.d.ts +20 -0
  410. package/dist/audit-trail/components/modules/ModulesContent.d.ts +21 -0
  411. package/dist/audit-trail/components/modules/ModulesDialog.d.ts +3 -0
  412. package/dist/audit-trail/components/modules/ModulesFooterCards.d.ts +10 -0
  413. package/dist/audit-trail/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  414. package/dist/audit-trail/components/modules/index.d.ts +14 -0
  415. package/dist/audit-trail/components/modules/modulesData.d.ts +6 -0
  416. package/dist/audit-trail/components/modules/types.d.ts +41 -0
  417. package/dist/audit-trail/components/ui/accordion.d.ts +42 -0
  418. package/dist/audit-trail/components/ui/action-button.d.ts +48 -0
  419. package/dist/audit-trail/components/ui/alert-dialog.d.ts +102 -0
  420. package/dist/audit-trail/components/ui/alert.d.ts +44 -0
  421. package/dist/audit-trail/components/ui/avatar.d.ts +36 -0
  422. package/dist/audit-trail/components/ui/badge.d.ts +41 -0
  423. package/dist/audit-trail/components/ui/breadcrumb.d.ts +73 -0
  424. package/dist/audit-trail/components/ui/button-group.d.ts +24 -0
  425. package/dist/audit-trail/components/ui/button.d.ts +66 -0
  426. package/dist/audit-trail/components/ui/calendar.d.ts +24 -0
  427. package/dist/audit-trail/components/ui/card.d.ts +57 -0
  428. package/dist/audit-trail/components/ui/chart.d.ts +97 -0
  429. package/dist/audit-trail/components/ui/checkbox.d.ts +15 -0
  430. package/dist/audit-trail/components/ui/collapsible.d.ts +20 -0
  431. package/dist/audit-trail/components/ui/color-picker.d.ts +19 -0
  432. package/dist/audit-trail/components/ui/combo-tree.d.ts +103 -0
  433. package/dist/audit-trail/components/ui/combobox.d.ts +64 -0
  434. package/dist/audit-trail/components/ui/command.d.ts +89 -0
  435. package/dist/audit-trail/components/ui/context-menu.d.ts +122 -0
  436. package/dist/audit-trail/components/ui/data-list.d.ts +86 -0
  437. package/dist/audit-trail/components/ui/date-picker.d.ts +19 -0
  438. package/dist/audit-trail/components/ui/dialog-wizard.d.ts +100 -0
  439. package/dist/audit-trail/components/ui/dialog.d.ts +229 -0
  440. package/dist/audit-trail/components/ui/disabled-menu-item.d.ts +25 -0
  441. package/dist/audit-trail/components/ui/drawer.d.ts +94 -0
  442. package/dist/audit-trail/components/ui/dropdown-menu.d.ts +180 -0
  443. package/dist/audit-trail/components/ui/electronic-signature-dialog.d.ts +31 -0
  444. package/dist/audit-trail/components/ui/empty-state.d.ts +79 -0
  445. package/dist/audit-trail/components/ui/export-dialog.d.ts +48 -0
  446. package/dist/audit-trail/components/ui/form.d.ts +119 -0
  447. package/dist/audit-trail/components/ui/grid.d.ts +53 -0
  448. package/dist/audit-trail/components/ui/hover-card.d.ts +21 -0
  449. package/dist/audit-trail/components/ui/icon-picker.d.ts +17 -0
  450. package/dist/audit-trail/components/ui/iframe-dialog.d.ts +24 -0
  451. package/dist/audit-trail/components/ui/input-group.d.ts +113 -0
  452. package/dist/audit-trail/components/ui/input.d.ts +24 -0
  453. package/dist/audit-trail/components/ui/label.d.ts +23 -0
  454. package/dist/audit-trail/components/ui/loading-state.d.ts +52 -0
  455. package/dist/audit-trail/components/ui/menubar.d.ts +113 -0
  456. package/dist/audit-trail/components/ui/multiselect-permissions.d.ts +84 -0
  457. package/dist/audit-trail/components/ui/navigation-menu.d.ts +57 -0
  458. package/dist/audit-trail/components/ui/onboarding-dialog.d.ts +58 -0
  459. package/dist/audit-trail/components/ui/online-editor-dialog.d.ts +28 -0
  460. package/dist/audit-trail/components/ui/page-breadcrumb.d.ts +77 -0
  461. package/dist/audit-trail/components/ui/pagination.d.ts +81 -0
  462. package/dist/audit-trail/components/ui/popover.d.ts +57 -0
  463. package/dist/audit-trail/components/ui/progress.d.ts +22 -0
  464. package/dist/audit-trail/components/ui/radio-group.d.ts +66 -0
  465. package/dist/audit-trail/components/ui/report-request-list.d.ts +64 -0
  466. package/dist/audit-trail/components/ui/resizable.d.ts +38 -0
  467. package/dist/audit-trail/components/ui/rich-text-editor.d.ts +58 -0
  468. package/dist/audit-trail/components/ui/scroll-area.d.ts +40 -0
  469. package/dist/audit-trail/components/ui/select.d.ts +94 -0
  470. package/dist/audit-trail/components/ui/separator.d.ts +17 -0
  471. package/dist/audit-trail/components/ui/sheet.d.ts +108 -0
  472. package/dist/audit-trail/components/ui/sidebar.d.ts +269 -0
  473. package/dist/audit-trail/components/ui/skeleton-variants.d.ts +41 -0
  474. package/dist/audit-trail/components/ui/skeleton.d.ts +14 -0
  475. package/dist/audit-trail/components/ui/slider.d.ts +9 -0
  476. package/dist/audit-trail/components/ui/sonner.d.ts +8 -0
  477. package/dist/audit-trail/components/ui/spinner.d.ts +11 -0
  478. package/dist/audit-trail/components/ui/split-button.d.ts +76 -0
  479. package/dist/audit-trail/components/ui/stack.d.ts +17 -0
  480. package/dist/audit-trail/components/ui/status-badge.d.ts +52 -0
  481. package/dist/audit-trail/components/ui/step-selector.d.ts +46 -0
  482. package/dist/audit-trail/components/ui/stimulsoft-viewer.d.ts +28 -0
  483. package/dist/audit-trail/components/ui/switch.d.ts +25 -0
  484. package/dist/audit-trail/components/ui/tab-page-layout.d.ts +52 -0
  485. package/dist/audit-trail/components/ui/table-resize-handle.d.ts +22 -0
  486. package/dist/audit-trail/components/ui/table.d.ts +112 -0
  487. package/dist/audit-trail/components/ui/tabs.d.ts +66 -0
  488. package/dist/audit-trail/components/ui/terms-of-use-dialog.d.ts +102 -0
  489. package/dist/audit-trail/components/ui/textarea.d.ts +33 -0
  490. package/dist/audit-trail/components/ui/timepicker.d.ts +34 -0
  491. package/dist/audit-trail/components/ui/toggle-group.d.ts +37 -0
  492. package/dist/audit-trail/components/ui/toggle.d.ts +33 -0
  493. package/dist/audit-trail/components/ui/tooltip.d.ts +61 -0
  494. package/dist/audit-trail/components/ui/truncated-cell.d.ts +20 -0
  495. package/dist/audit-trail/components/ui/typography.d.ts +135 -0
  496. package/dist/audit-trail/components/ui/updates-notification.d.ts +47 -0
  497. package/dist/audit-trail/components/ui/users-groups-selector.d.ts +87 -0
  498. package/dist/audit-trail/components/ui/viewer-dialog.d.ts +184 -0
  499. package/dist/audit-trail/config/backend.d.ts +10 -0
  500. package/dist/audit-trail/config/environments.d.ts +27 -0
  501. package/dist/audit-trail/config/index.d.ts +75 -0
  502. package/dist/audit-trail/contexts/LocaleContext.d.ts +15 -0
  503. package/dist/audit-trail/contexts/ModalStateContext.d.ts +57 -0
  504. package/dist/audit-trail/contexts/ModuleContext.d.ts +34 -0
  505. package/dist/audit-trail/contexts/NavigationContext.d.ts +13 -0
  506. package/dist/audit-trail/contexts/PageMetadataContext.d.ts +48 -0
  507. package/dist/audit-trail/crud/components/ActionMenuItems.d.ts +22 -0
  508. package/dist/audit-trail/crud/components/BaseForm.d.ts +52 -0
  509. package/dist/audit-trail/crud/components/ColumnSettingsPopover.d.ts +28 -0
  510. package/dist/audit-trail/crud/components/ContextMenu.d.ts +21 -0
  511. package/dist/audit-trail/crud/components/CrudActionBar.d.ts +59 -0
  512. package/dist/audit-trail/crud/components/CrudGrid.d.ts +53 -0
  513. package/dist/audit-trail/crud/components/CrudPagination.d.ts +17 -0
  514. package/dist/audit-trail/crud/components/CrudTable.d.ts +66 -0
  515. package/dist/audit-trail/crud/components/FilterBar.d.ts +136 -0
  516. package/dist/audit-trail/crud/components/GroupDropZone.d.ts +16 -0
  517. package/dist/audit-trail/crud/components/InlineRowActions.d.ts +15 -0
  518. package/dist/audit-trail/crud/components/SelectionCheckbox.d.ts +9 -0
  519. package/dist/audit-trail/crud/components/TableFooter.d.ts +14 -0
  520. package/dist/audit-trail/crud/components/TableRowActions.d.ts +19 -0
  521. package/dist/audit-trail/crud/createCrudPage.d.ts +134 -0
  522. package/dist/audit-trail/crud/createSimpleService.d.ts +85 -0
  523. package/dist/audit-trail/crud/generateCrudConfig.d.ts +78 -0
  524. package/dist/audit-trail/crud/hooks/useBaseForm.d.ts +47 -0
  525. package/dist/audit-trail/crud/hooks/useColumnDragReorder.d.ts +19 -0
  526. package/dist/audit-trail/crud/hooks/useColumnManager.d.ts +85 -0
  527. package/dist/audit-trail/crud/hooks/useCrud.d.ts +152 -0
  528. package/dist/audit-trail/crud/primitives/ActionMenu.d.ts +69 -0
  529. package/dist/audit-trail/crud/primitives/FilterBar.d.ts +69 -0
  530. package/dist/audit-trail/crud/primitives/Pagination.d.ts +29 -0
  531. package/dist/audit-trail/crud/primitives/Table.d.ts +31 -0
  532. package/dist/audit-trail/crud/primitives/TreeTable.d.ts +7 -0
  533. package/dist/audit-trail/crud/primitives/index.d.ts +12 -0
  534. package/dist/audit-trail/crud/primitives/types.d.ts +199 -0
  535. package/dist/audit-trail/crud/utils/routingHelpers.d.ts +41 -0
  536. package/dist/audit-trail/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  537. package/dist/audit-trail/custom-form-fields/fields/FormDateField.d.ts +9 -0
  538. package/dist/audit-trail/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  539. package/dist/audit-trail/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  540. package/dist/audit-trail/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  541. package/dist/audit-trail/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  542. package/dist/audit-trail/custom-form-fields/fields/FormTextField.d.ts +9 -0
  543. package/dist/audit-trail/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  544. package/dist/audit-trail/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  545. package/dist/audit-trail/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  546. package/dist/audit-trail/custom-form-fields/index.d.ts +13 -0
  547. package/dist/audit-trail/custom-form-fields/types.d.ts +206 -0
  548. package/dist/audit-trail/exports/action-plans.d.ts +16 -0
  549. package/dist/audit-trail/exports/audit-trail.d.ts +1 -0
  550. package/dist/audit-trail/exports/crud.d.ts +31 -0
  551. package/dist/audit-trail/exports/custom-form-fields.d.ts +1 -0
  552. package/dist/audit-trail/exports/file-upload.d.ts +1 -0
  553. package/dist/audit-trail/exports/integrations.d.ts +15 -0
  554. package/dist/audit-trail/exports/ui.d.ts +100 -0
  555. package/dist/audit-trail/file-upload/components/SingleFileUpload.d.ts +102 -0
  556. package/dist/audit-trail/file-upload/index.d.ts +6 -0
  557. package/dist/audit-trail/file-upload/types.d.ts +26 -0
  558. package/dist/audit-trail/file-upload/utils/formatBytes.d.ts +6 -0
  559. package/dist/audit-trail/file-upload/utils/getFileExtension.d.ts +6 -0
  560. package/dist/audit-trail/hooks/useActiveModules.d.ts +45 -0
  561. package/dist/audit-trail/hooks/useAliasFromUrl.d.ts +33 -0
  562. package/dist/audit-trail/hooks/useColumnResize.d.ts +45 -0
  563. package/dist/audit-trail/hooks/useDebounce.d.ts +56 -0
  564. package/dist/audit-trail/hooks/useDerivedContractedModules.d.ts +8 -0
  565. package/dist/audit-trail/hooks/useI18nFormatters.d.ts +40 -0
  566. package/dist/audit-trail/hooks/useMediaQuery.d.ts +14 -0
  567. package/dist/audit-trail/hooks/useModuleAccess.d.ts +59 -0
  568. package/dist/audit-trail/hooks/usePageTitle.d.ts +10 -0
  569. package/dist/audit-trail/hooks/usePermissionQuery.d.ts +49 -0
  570. package/dist/audit-trail/hooks/useRowResize.d.ts +37 -0
  571. package/dist/audit-trail/hooks/useSidebarResize.d.ts +37 -0
  572. package/dist/audit-trail/hooks/useUpdatesNotification.d.ts +27 -0
  573. package/dist/audit-trail/hooks/useWizard.d.ts +40 -0
  574. package/dist/audit-trail/i18n/LanguageBootstrap.d.ts +14 -0
  575. package/dist/audit-trail/i18n/config.d.ts +13 -0
  576. package/dist/audit-trail/i18n/constants.d.ts +126 -0
  577. package/dist/audit-trail/i18n/index.d.ts +12 -0
  578. package/dist/audit-trail/i18n/utils.d.ts +14 -0
  579. package/dist/audit-trail/integrations/clarity/clarityTracking.d.ts +31 -0
  580. package/dist/audit-trail/integrations/clarity/index.d.ts +3 -0
  581. package/dist/audit-trail/integrations/clarity/types.d.ts +46 -0
  582. package/dist/audit-trail/integrations/clarity/useClarity.d.ts +34 -0
  583. package/dist/audit-trail/integrations/index.d.ts +5 -0
  584. package/dist/audit-trail/leadership/components/LeadershipDialog.d.ts +10 -0
  585. package/dist/audit-trail/leadership/components/LeadershipForm.d.ts +8 -0
  586. package/dist/audit-trail/leadership/components/LeadershipPage.d.ts +19 -0
  587. package/dist/audit-trail/leadership/hooks/useLeadershipApi.d.ts +4 -0
  588. package/dist/audit-trail/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  589. package/dist/audit-trail/leadership/index.d.ts +13 -0
  590. package/dist/audit-trail/leadership/types.d.ts +23 -0
  591. package/dist/audit-trail/leadership/utils/leadershipUtils.d.ts +8 -0
  592. package/dist/audit-trail/media/components/ImageEditor.d.ts +22 -0
  593. package/dist/audit-trail/media/components/ImageRenderer.d.ts +23 -0
  594. package/dist/audit-trail/media/components/VideoEditor.d.ts +2 -0
  595. package/dist/audit-trail/media/components/VideoRenderer.d.ts +2 -0
  596. package/dist/audit-trail/media/hooks/useMediaUpload.d.ts +19 -0
  597. package/dist/audit-trail/media/index.d.ts +49 -0
  598. package/dist/audit-trail/media/types.d.ts +66 -0
  599. package/dist/audit-trail/media/utils/imageHelpers.d.ts +28 -0
  600. package/dist/audit-trail/media/utils/videoHelpers.d.ts +35 -0
  601. package/dist/audit-trail/mind-map/components/MindMap.d.ts +23 -0
  602. package/dist/audit-trail/mind-map/components/MindMapConnection.d.ts +12 -0
  603. package/dist/audit-trail/mind-map/components/MindMapNodeView.d.ts +24 -0
  604. package/dist/audit-trail/mind-map/components/MindMapToolbar.d.ts +26 -0
  605. package/dist/audit-trail/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  606. package/dist/audit-trail/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  607. package/dist/audit-trail/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  608. package/dist/audit-trail/mind-map/hooks/useMindMapState.d.ts +32 -0
  609. package/dist/audit-trail/mind-map/index.d.ts +4 -0
  610. package/dist/audit-trail/mind-map/types.d.ts +91 -0
  611. package/dist/audit-trail/mind-map/utils/export-image.d.ts +9 -0
  612. package/dist/audit-trail/mind-map/utils/layout.d.ts +15 -0
  613. package/dist/audit-trail/mind-map/utils/nodeOps.d.ts +66 -0
  614. package/dist/audit-trail/mind-map/utils/serialize.d.ts +10 -0
  615. package/dist/audit-trail/modules/softwaresMap.d.ts +4 -0
  616. package/dist/audit-trail/places/components/ManageAccessModal.d.ts +11 -0
  617. package/dist/audit-trail/places/components/PlaceCard.d.ts +12 -0
  618. package/dist/audit-trail/places/components/PlacesList.d.ts +12 -0
  619. package/dist/audit-trail/places/index.d.ts +8 -0
  620. package/dist/audit-trail/places/services/PlaceService.d.ts +9 -0
  621. package/dist/audit-trail/places/types.d.ts +10 -0
  622. package/dist/audit-trail/providers/CoreProviders.d.ts +107 -0
  623. package/dist/audit-trail/providers/index.d.ts +2 -0
  624. package/dist/audit-trail/qualiex/components/QualiexUserField.d.ts +133 -0
  625. package/dist/audit-trail/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  626. package/dist/audit-trail/qualiex/services/qualiexApi.d.ts +75 -0
  627. package/dist/audit-trail/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  628. package/dist/audit-trail/qualiex/utils/userPlaceUtils.d.ts +16 -0
  629. package/dist/audit-trail/services/BaseService.d.ts +51 -0
  630. package/dist/audit-trail/services/EmailService.d.ts +110 -0
  631. package/dist/audit-trail/services/ErrorService.d.ts +19 -0
  632. package/dist/audit-trail/services/QualiexEnrichmentService.d.ts +53 -0
  633. package/dist/audit-trail/services/QualiexFieldHelpers.d.ts +17 -0
  634. package/dist/audit-trail/setup/favicon.d.ts +1 -0
  635. package/dist/audit-trail/setup.d.ts +16 -0
  636. package/dist/audit-trail/sign/components/D4SignWidget.d.ts +2 -0
  637. package/dist/audit-trail/sign/components/DocumentSigner.d.ts +2 -0
  638. package/dist/audit-trail/sign/components/SignConfigForm.d.ts +2 -0
  639. package/dist/audit-trail/sign/components/SignWidget.d.ts +9 -0
  640. package/dist/audit-trail/sign/hooks/useSignConfig.d.ts +6 -0
  641. package/dist/audit-trail/sign/index.d.ts +8 -0
  642. package/dist/audit-trail/sign/services/signService.d.ts +17 -0
  643. package/dist/audit-trail/sign/types.d.ts +53 -0
  644. package/dist/audit-trail/sign/utils/loadClicksignScript.d.ts +13 -0
  645. package/dist/audit-trail/supabase/SupabaseSingleton.d.ts +34 -0
  646. package/dist/audit-trail/supabase/client.d.ts +2 -0
  647. package/dist/audit-trail/supabase/legacyKeyGuard.d.ts +19 -0
  648. package/dist/audit-trail/supabase/publicClient.d.ts +2 -0
  649. package/dist/audit-trail/supabase/types.d.ts +377 -0
  650. package/dist/audit-trail/team-selector/components/TeamSelector.d.ts +24 -0
  651. package/dist/audit-trail/team-selector/index.d.ts +2 -0
  652. package/dist/audit-trail/team-selector/types.d.ts +10 -0
  653. package/dist/audit-trail/types/sidebar.d.ts +52 -0
  654. package/dist/audit-trail/utils/color.d.ts +26 -0
  655. package/dist/audit-trail/utils/formatters/currencyFormatters.d.ts +1 -0
  656. package/dist/audit-trail/utils/formatters/dateFormatters.d.ts +52 -0
  657. package/dist/audit-trail/utils/index.d.ts +9 -0
  658. package/dist/audit-trail/utils/linkHelpers.d.ts +9 -0
  659. package/dist/audit-trail/utils/load-fonts.d.ts +1 -0
  660. package/dist/config/environments.d.ts +21 -0
  661. package/dist/config/index.d.ts +6 -0
  662. package/dist/index.d.ts +3 -2
  663. package/dist/index.esm.js +1 -1
  664. package/dist/index.js +1 -1
  665. package/dist/leadership/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  666. package/dist/leadership/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  667. package/dist/leadership/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  668. package/dist/leadership/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  669. package/dist/leadership/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  670. package/dist/leadership/action-plans/components/ActionPlanPage.d.ts +25 -0
  671. package/dist/leadership/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  672. package/dist/leadership/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  673. package/dist/leadership/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  674. package/dist/leadership/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  675. package/dist/leadership/action-plans/constants.d.ts +86 -0
  676. package/dist/leadership/action-plans/hooks/useActionPlan.d.ts +19 -0
  677. package/dist/leadership/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  678. package/dist/leadership/action-plans/index.d.ts +15 -0
  679. package/dist/leadership/action-plans/types.d.ts +413 -0
  680. package/dist/leadership/action-plans/utils/formatTime.d.ts +24 -0
  681. package/dist/leadership/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  682. package/dist/leadership/approval-flow/components/ApproveDialog.d.ts +13 -0
  683. package/dist/leadership/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  684. package/dist/leadership/approval-flow/index.d.ts +4 -0
  685. package/dist/leadership/approval-flow/types.d.ts +76 -0
  686. package/dist/leadership/assets/index.d.ts +7 -0
  687. package/dist/leadership/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  688. package/dist/leadership/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  689. package/dist/leadership/audit-trail/components/AuditTrailPage.d.ts +40 -0
  690. package/dist/leadership/audit-trail/index.d.ts +9 -0
  691. package/dist/leadership/audit-trail/types.d.ts +209 -0
  692. package/dist/leadership/audit-trail/utils.d.ts +54 -0
  693. package/dist/leadership/auth/components/AliasRedirect.d.ts +13 -0
  694. package/dist/leadership/auth/components/AliasRouteGuard.d.ts +20 -0
  695. package/dist/leadership/auth/components/EditProfileDialog.d.ts +13 -0
  696. package/dist/leadership/auth/components/ProtectedRoute.d.ts +11 -0
  697. package/dist/leadership/auth/components/UserInfo.d.ts +10 -0
  698. package/dist/leadership/auth/contexts/AuthContext.d.ts +89 -0
  699. package/dist/leadership/auth/pages/CallbackPage.d.ts +6 -0
  700. package/dist/leadership/auth/pages/LoginPage.d.ts +2 -0
  701. package/dist/leadership/auth/services/AuthService.d.ts +64 -0
  702. package/dist/leadership/auth/services/SupabaseTokenService.d.ts +3 -0
  703. package/dist/leadership/auth/services/TokenManager.d.ts +66 -0
  704. package/dist/leadership/auth/services/TokenRegenerationService.d.ts +14 -0
  705. package/dist/leadership/auth/services/TokenService.d.ts +48 -0
  706. package/dist/leadership/auth/utils/ErrorInterceptor.d.ts +20 -0
  707. package/dist/leadership/components/ErrorBoundary.d.ts +19 -0
  708. package/dist/leadership/components/dashboards/dashboard-form.d.ts +65 -0
  709. package/dist/leadership/components/dashboards/dashboard-general-view.d.ts +124 -0
  710. package/dist/leadership/components/dashboards/dashboard-grid.d.ts +66 -0
  711. package/dist/leadership/components/dashboards/dashboard-list.d.ts +41 -0
  712. package/dist/leadership/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  713. package/dist/leadership/components/dashboards/dashboard-view.d.ts +48 -0
  714. package/dist/leadership/components/dashboards/helpers.d.ts +86 -0
  715. package/dist/leadership/components/dashboards/index.d.ts +9 -0
  716. package/dist/leadership/components/dashboards/panels/burndown-panel.d.ts +41 -0
  717. package/dist/leadership/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  718. package/dist/leadership/components/dashboards/panels/index.d.ts +14 -0
  719. package/dist/leadership/components/dashboards/panels/list-panel.d.ts +45 -0
  720. package/dist/leadership/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  721. package/dist/leadership/components/dashboards/panels/numeric-panel.d.ts +32 -0
  722. package/dist/leadership/components/dashboards/panels/panel-error.d.ts +18 -0
  723. package/dist/leadership/components/dashboards/panels/panel-header.d.ts +27 -0
  724. package/dist/leadership/components/dashboards/panels/panel-loader.d.ts +17 -0
  725. package/dist/leadership/components/dashboards/panels/panel-no-data.d.ts +16 -0
  726. package/dist/leadership/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  727. package/dist/leadership/components/dashboards/panels/pareto-panel.d.ts +30 -0
  728. package/dist/leadership/components/dashboards/panels/performance-panel.d.ts +39 -0
  729. package/dist/leadership/components/dashboards/panels/pie-panel.d.ts +29 -0
  730. package/dist/leadership/components/dashboards/panels/text-panel.d.ts +28 -0
  731. package/dist/leadership/components/dashboards/types.d.ts +755 -0
  732. package/dist/leadership/components/layout/AppHeader.d.ts +6 -0
  733. package/dist/leadership/components/layout/AppLayout.d.ts +10 -0
  734. package/dist/leadership/components/layout/AppSidebar.d.ts +10 -0
  735. package/dist/leadership/components/layout/BodyContent.d.ts +60 -0
  736. package/dist/leadership/components/layout/SidebarActionTrigger.d.ts +46 -0
  737. package/dist/leadership/components/layout/SidebarHeader.d.ts +5 -0
  738. package/dist/leadership/components/layout/SidebarLogo.d.ts +5 -0
  739. package/dist/leadership/components/layout/sidebar-utils.d.ts +12 -0
  740. package/dist/leadership/components/modules/AccessDeniedDialog.d.ts +43 -0
  741. package/dist/leadership/components/modules/ModuleAccessGuard.d.ts +42 -0
  742. package/dist/leadership/components/modules/ModuleGrid.d.ts +9 -0
  743. package/dist/leadership/components/modules/ModuleOfferContent.d.ts +20 -0
  744. package/dist/leadership/components/modules/ModulesContent.d.ts +21 -0
  745. package/dist/leadership/components/modules/ModulesDialog.d.ts +3 -0
  746. package/dist/leadership/components/modules/ModulesFooterCards.d.ts +10 -0
  747. package/dist/leadership/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  748. package/dist/leadership/components/modules/index.d.ts +14 -0
  749. package/dist/leadership/components/modules/modulesData.d.ts +6 -0
  750. package/dist/leadership/components/modules/types.d.ts +41 -0
  751. package/dist/leadership/components/ui/accordion.d.ts +42 -0
  752. package/dist/leadership/components/ui/action-button.d.ts +48 -0
  753. package/dist/leadership/components/ui/alert-dialog.d.ts +102 -0
  754. package/dist/leadership/components/ui/alert.d.ts +44 -0
  755. package/dist/leadership/components/ui/avatar.d.ts +36 -0
  756. package/dist/leadership/components/ui/badge.d.ts +41 -0
  757. package/dist/leadership/components/ui/breadcrumb.d.ts +73 -0
  758. package/dist/leadership/components/ui/button-group.d.ts +24 -0
  759. package/dist/leadership/components/ui/button.d.ts +66 -0
  760. package/dist/leadership/components/ui/calendar.d.ts +24 -0
  761. package/dist/leadership/components/ui/card.d.ts +57 -0
  762. package/dist/leadership/components/ui/chart.d.ts +97 -0
  763. package/dist/leadership/components/ui/checkbox.d.ts +15 -0
  764. package/dist/leadership/components/ui/collapsible.d.ts +20 -0
  765. package/dist/leadership/components/ui/color-picker.d.ts +19 -0
  766. package/dist/leadership/components/ui/combo-tree.d.ts +103 -0
  767. package/dist/leadership/components/ui/combobox.d.ts +64 -0
  768. package/dist/leadership/components/ui/command.d.ts +89 -0
  769. package/dist/leadership/components/ui/context-menu.d.ts +122 -0
  770. package/dist/leadership/components/ui/data-list.d.ts +86 -0
  771. package/dist/leadership/components/ui/date-picker.d.ts +19 -0
  772. package/dist/leadership/components/ui/dialog-wizard.d.ts +100 -0
  773. package/dist/leadership/components/ui/dialog.d.ts +229 -0
  774. package/dist/leadership/components/ui/disabled-menu-item.d.ts +25 -0
  775. package/dist/leadership/components/ui/drawer.d.ts +94 -0
  776. package/dist/leadership/components/ui/dropdown-menu.d.ts +180 -0
  777. package/dist/leadership/components/ui/electronic-signature-dialog.d.ts +31 -0
  778. package/dist/leadership/components/ui/empty-state.d.ts +79 -0
  779. package/dist/leadership/components/ui/export-dialog.d.ts +48 -0
  780. package/dist/leadership/components/ui/form.d.ts +119 -0
  781. package/dist/leadership/components/ui/grid.d.ts +53 -0
  782. package/dist/leadership/components/ui/hover-card.d.ts +21 -0
  783. package/dist/leadership/components/ui/icon-picker.d.ts +17 -0
  784. package/dist/leadership/components/ui/iframe-dialog.d.ts +24 -0
  785. package/dist/leadership/components/ui/input-group.d.ts +113 -0
  786. package/dist/leadership/components/ui/input.d.ts +24 -0
  787. package/dist/leadership/components/ui/label.d.ts +23 -0
  788. package/dist/leadership/components/ui/loading-state.d.ts +52 -0
  789. package/dist/leadership/components/ui/menubar.d.ts +113 -0
  790. package/dist/leadership/components/ui/multiselect-permissions.d.ts +84 -0
  791. package/dist/leadership/components/ui/navigation-menu.d.ts +57 -0
  792. package/dist/leadership/components/ui/onboarding-dialog.d.ts +58 -0
  793. package/dist/leadership/components/ui/online-editor-dialog.d.ts +28 -0
  794. package/dist/leadership/components/ui/page-breadcrumb.d.ts +77 -0
  795. package/dist/leadership/components/ui/pagination.d.ts +81 -0
  796. package/dist/leadership/components/ui/popover.d.ts +57 -0
  797. package/dist/leadership/components/ui/progress.d.ts +22 -0
  798. package/dist/leadership/components/ui/radio-group.d.ts +66 -0
  799. package/dist/leadership/components/ui/report-request-list.d.ts +64 -0
  800. package/dist/leadership/components/ui/resizable.d.ts +38 -0
  801. package/dist/leadership/components/ui/rich-text-editor.d.ts +58 -0
  802. package/dist/leadership/components/ui/scroll-area.d.ts +40 -0
  803. package/dist/leadership/components/ui/select.d.ts +94 -0
  804. package/dist/leadership/components/ui/separator.d.ts +17 -0
  805. package/dist/leadership/components/ui/sheet.d.ts +108 -0
  806. package/dist/leadership/components/ui/sidebar.d.ts +269 -0
  807. package/dist/leadership/components/ui/skeleton-variants.d.ts +41 -0
  808. package/dist/leadership/components/ui/skeleton.d.ts +14 -0
  809. package/dist/leadership/components/ui/slider.d.ts +9 -0
  810. package/dist/leadership/components/ui/sonner.d.ts +8 -0
  811. package/dist/leadership/components/ui/spinner.d.ts +11 -0
  812. package/dist/leadership/components/ui/split-button.d.ts +76 -0
  813. package/dist/leadership/components/ui/stack.d.ts +17 -0
  814. package/dist/leadership/components/ui/status-badge.d.ts +52 -0
  815. package/dist/leadership/components/ui/step-selector.d.ts +46 -0
  816. package/dist/leadership/components/ui/stimulsoft-viewer.d.ts +28 -0
  817. package/dist/leadership/components/ui/switch.d.ts +25 -0
  818. package/dist/leadership/components/ui/tab-page-layout.d.ts +52 -0
  819. package/dist/leadership/components/ui/table-resize-handle.d.ts +22 -0
  820. package/dist/leadership/components/ui/table.d.ts +112 -0
  821. package/dist/leadership/components/ui/tabs.d.ts +66 -0
  822. package/dist/leadership/components/ui/terms-of-use-dialog.d.ts +102 -0
  823. package/dist/leadership/components/ui/textarea.d.ts +33 -0
  824. package/dist/leadership/components/ui/timepicker.d.ts +34 -0
  825. package/dist/leadership/components/ui/toggle-group.d.ts +37 -0
  826. package/dist/leadership/components/ui/toggle.d.ts +33 -0
  827. package/dist/leadership/components/ui/tooltip.d.ts +61 -0
  828. package/dist/leadership/components/ui/truncated-cell.d.ts +20 -0
  829. package/dist/leadership/components/ui/typography.d.ts +135 -0
  830. package/dist/leadership/components/ui/updates-notification.d.ts +47 -0
  831. package/dist/leadership/components/ui/users-groups-selector.d.ts +87 -0
  832. package/dist/leadership/components/ui/viewer-dialog.d.ts +184 -0
  833. package/dist/leadership/config/backend.d.ts +10 -0
  834. package/dist/leadership/config/environments.d.ts +27 -0
  835. package/dist/leadership/config/index.d.ts +75 -0
  836. package/dist/leadership/contexts/LocaleContext.d.ts +15 -0
  837. package/dist/leadership/contexts/ModalStateContext.d.ts +57 -0
  838. package/dist/leadership/contexts/ModuleContext.d.ts +34 -0
  839. package/dist/leadership/contexts/NavigationContext.d.ts +13 -0
  840. package/dist/leadership/contexts/PageMetadataContext.d.ts +48 -0
  841. package/dist/leadership/crud/components/ActionMenuItems.d.ts +22 -0
  842. package/dist/leadership/crud/components/BaseForm.d.ts +52 -0
  843. package/dist/leadership/crud/components/ColumnSettingsPopover.d.ts +28 -0
  844. package/dist/leadership/crud/components/ContextMenu.d.ts +21 -0
  845. package/dist/leadership/crud/components/CrudActionBar.d.ts +59 -0
  846. package/dist/leadership/crud/components/CrudGrid.d.ts +53 -0
  847. package/dist/leadership/crud/components/CrudPagination.d.ts +17 -0
  848. package/dist/leadership/crud/components/CrudTable.d.ts +66 -0
  849. package/dist/leadership/crud/components/FilterBar.d.ts +136 -0
  850. package/dist/leadership/crud/components/GroupDropZone.d.ts +16 -0
  851. package/dist/leadership/crud/components/InlineRowActions.d.ts +15 -0
  852. package/dist/leadership/crud/components/SelectionCheckbox.d.ts +9 -0
  853. package/dist/leadership/crud/components/TableFooter.d.ts +14 -0
  854. package/dist/leadership/crud/components/TableRowActions.d.ts +19 -0
  855. package/dist/leadership/crud/createCrudPage.d.ts +134 -0
  856. package/dist/leadership/crud/createSimpleService.d.ts +85 -0
  857. package/dist/leadership/crud/generateCrudConfig.d.ts +78 -0
  858. package/dist/leadership/crud/hooks/useBaseForm.d.ts +47 -0
  859. package/dist/leadership/crud/hooks/useColumnDragReorder.d.ts +19 -0
  860. package/dist/leadership/crud/hooks/useColumnManager.d.ts +85 -0
  861. package/dist/leadership/crud/hooks/useCrud.d.ts +152 -0
  862. package/dist/leadership/crud/primitives/ActionMenu.d.ts +69 -0
  863. package/dist/leadership/crud/primitives/FilterBar.d.ts +69 -0
  864. package/dist/leadership/crud/primitives/Pagination.d.ts +29 -0
  865. package/dist/leadership/crud/primitives/Table.d.ts +31 -0
  866. package/dist/leadership/crud/primitives/TreeTable.d.ts +7 -0
  867. package/dist/leadership/crud/primitives/index.d.ts +12 -0
  868. package/dist/leadership/crud/primitives/types.d.ts +199 -0
  869. package/dist/leadership/crud/utils/routingHelpers.d.ts +41 -0
  870. package/dist/leadership/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  871. package/dist/leadership/custom-form-fields/fields/FormDateField.d.ts +9 -0
  872. package/dist/leadership/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  873. package/dist/leadership/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  874. package/dist/leadership/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  875. package/dist/leadership/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  876. package/dist/leadership/custom-form-fields/fields/FormTextField.d.ts +9 -0
  877. package/dist/leadership/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  878. package/dist/leadership/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  879. package/dist/leadership/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  880. package/dist/leadership/custom-form-fields/index.d.ts +13 -0
  881. package/dist/leadership/custom-form-fields/types.d.ts +206 -0
  882. package/dist/leadership/exports/action-plans.d.ts +16 -0
  883. package/dist/leadership/exports/audit-trail.d.ts +1 -0
  884. package/dist/leadership/exports/crud.d.ts +31 -0
  885. package/dist/leadership/exports/custom-form-fields.d.ts +1 -0
  886. package/dist/leadership/exports/file-upload.d.ts +1 -0
  887. package/dist/leadership/exports/integrations.d.ts +15 -0
  888. package/dist/leadership/exports/ui.d.ts +100 -0
  889. package/dist/leadership/file-upload/components/SingleFileUpload.d.ts +102 -0
  890. package/dist/leadership/file-upload/index.d.ts +6 -0
  891. package/dist/leadership/file-upload/types.d.ts +26 -0
  892. package/dist/leadership/file-upload/utils/formatBytes.d.ts +6 -0
  893. package/dist/leadership/file-upload/utils/getFileExtension.d.ts +6 -0
  894. package/dist/leadership/hooks/useActiveModules.d.ts +45 -0
  895. package/dist/leadership/hooks/useAliasFromUrl.d.ts +33 -0
  896. package/dist/leadership/hooks/useColumnResize.d.ts +45 -0
  897. package/dist/leadership/hooks/useDebounce.d.ts +56 -0
  898. package/dist/leadership/hooks/useDerivedContractedModules.d.ts +8 -0
  899. package/dist/leadership/hooks/useI18nFormatters.d.ts +40 -0
  900. package/dist/leadership/hooks/useMediaQuery.d.ts +14 -0
  901. package/dist/leadership/hooks/useModuleAccess.d.ts +59 -0
  902. package/dist/leadership/hooks/usePageTitle.d.ts +10 -0
  903. package/dist/leadership/hooks/usePermissionQuery.d.ts +49 -0
  904. package/dist/leadership/hooks/useRowResize.d.ts +37 -0
  905. package/dist/leadership/hooks/useSidebarResize.d.ts +37 -0
  906. package/dist/leadership/hooks/useUpdatesNotification.d.ts +27 -0
  907. package/dist/leadership/hooks/useWizard.d.ts +40 -0
  908. package/dist/leadership/i18n/LanguageBootstrap.d.ts +14 -0
  909. package/dist/leadership/i18n/config.d.ts +13 -0
  910. package/dist/leadership/i18n/constants.d.ts +126 -0
  911. package/dist/leadership/i18n/index.d.ts +12 -0
  912. package/dist/leadership/i18n/utils.d.ts +14 -0
  913. package/dist/leadership/integrations/clarity/clarityTracking.d.ts +31 -0
  914. package/dist/leadership/integrations/clarity/index.d.ts +3 -0
  915. package/dist/leadership/integrations/clarity/types.d.ts +46 -0
  916. package/dist/leadership/integrations/clarity/useClarity.d.ts +34 -0
  917. package/dist/leadership/integrations/index.d.ts +5 -0
  918. package/dist/leadership/leadership/components/LeadershipDialog.d.ts +10 -0
  919. package/dist/leadership/leadership/components/LeadershipForm.d.ts +8 -0
  920. package/dist/leadership/leadership/components/LeadershipPage.d.ts +19 -0
  921. package/dist/leadership/leadership/hooks/useLeadershipApi.d.ts +4 -0
  922. package/dist/leadership/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  923. package/dist/leadership/leadership/index.d.ts +13 -0
  924. package/dist/leadership/leadership/types.d.ts +23 -0
  925. package/dist/leadership/leadership/utils/leadershipUtils.d.ts +8 -0
  926. package/dist/leadership/media/components/ImageEditor.d.ts +22 -0
  927. package/dist/leadership/media/components/ImageRenderer.d.ts +23 -0
  928. package/dist/leadership/media/components/VideoEditor.d.ts +2 -0
  929. package/dist/leadership/media/components/VideoRenderer.d.ts +2 -0
  930. package/dist/leadership/media/hooks/useMediaUpload.d.ts +19 -0
  931. package/dist/leadership/media/index.d.ts +49 -0
  932. package/dist/leadership/media/types.d.ts +66 -0
  933. package/dist/leadership/media/utils/imageHelpers.d.ts +28 -0
  934. package/dist/leadership/media/utils/videoHelpers.d.ts +35 -0
  935. package/dist/leadership/mind-map/components/MindMap.d.ts +23 -0
  936. package/dist/leadership/mind-map/components/MindMapConnection.d.ts +12 -0
  937. package/dist/leadership/mind-map/components/MindMapNodeView.d.ts +24 -0
  938. package/dist/leadership/mind-map/components/MindMapToolbar.d.ts +26 -0
  939. package/dist/leadership/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  940. package/dist/leadership/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  941. package/dist/leadership/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  942. package/dist/leadership/mind-map/hooks/useMindMapState.d.ts +32 -0
  943. package/dist/leadership/mind-map/index.d.ts +4 -0
  944. package/dist/leadership/mind-map/types.d.ts +91 -0
  945. package/dist/leadership/mind-map/utils/export-image.d.ts +9 -0
  946. package/dist/leadership/mind-map/utils/layout.d.ts +15 -0
  947. package/dist/leadership/mind-map/utils/nodeOps.d.ts +66 -0
  948. package/dist/leadership/mind-map/utils/serialize.d.ts +10 -0
  949. package/dist/leadership/modules/softwaresMap.d.ts +4 -0
  950. package/dist/leadership/places/components/ManageAccessModal.d.ts +11 -0
  951. package/dist/leadership/places/components/PlaceCard.d.ts +12 -0
  952. package/dist/leadership/places/components/PlacesList.d.ts +12 -0
  953. package/dist/leadership/places/index.d.ts +8 -0
  954. package/dist/leadership/places/services/PlaceService.d.ts +9 -0
  955. package/dist/leadership/places/types.d.ts +10 -0
  956. package/dist/leadership/providers/CoreProviders.d.ts +107 -0
  957. package/dist/leadership/providers/index.d.ts +2 -0
  958. package/dist/leadership/qualiex/components/QualiexUserField.d.ts +133 -0
  959. package/dist/leadership/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  960. package/dist/leadership/qualiex/services/qualiexApi.d.ts +75 -0
  961. package/dist/leadership/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  962. package/dist/leadership/qualiex/utils/userPlaceUtils.d.ts +16 -0
  963. package/dist/leadership/services/BaseService.d.ts +51 -0
  964. package/dist/leadership/services/EmailService.d.ts +110 -0
  965. package/dist/leadership/services/ErrorService.d.ts +19 -0
  966. package/dist/leadership/services/QualiexEnrichmentService.d.ts +53 -0
  967. package/dist/leadership/services/QualiexFieldHelpers.d.ts +17 -0
  968. package/dist/leadership/setup/favicon.d.ts +1 -0
  969. package/dist/leadership/setup.d.ts +16 -0
  970. package/dist/leadership/sign/components/D4SignWidget.d.ts +2 -0
  971. package/dist/leadership/sign/components/DocumentSigner.d.ts +2 -0
  972. package/dist/leadership/sign/components/SignConfigForm.d.ts +2 -0
  973. package/dist/leadership/sign/components/SignWidget.d.ts +9 -0
  974. package/dist/leadership/sign/hooks/useSignConfig.d.ts +6 -0
  975. package/dist/leadership/sign/index.d.ts +8 -0
  976. package/dist/leadership/sign/services/signService.d.ts +17 -0
  977. package/dist/leadership/sign/types.d.ts +53 -0
  978. package/dist/leadership/sign/utils/loadClicksignScript.d.ts +13 -0
  979. package/dist/leadership/supabase/SupabaseSingleton.d.ts +34 -0
  980. package/dist/leadership/supabase/client.d.ts +2 -0
  981. package/dist/leadership/supabase/legacyKeyGuard.d.ts +19 -0
  982. package/dist/leadership/supabase/publicClient.d.ts +2 -0
  983. package/dist/leadership/supabase/types.d.ts +377 -0
  984. package/dist/leadership/team-selector/components/TeamSelector.d.ts +24 -0
  985. package/dist/leadership/team-selector/index.d.ts +2 -0
  986. package/dist/leadership/team-selector/types.d.ts +10 -0
  987. package/dist/leadership/types/sidebar.d.ts +52 -0
  988. package/dist/leadership/utils/color.d.ts +26 -0
  989. package/dist/leadership/utils/formatters/currencyFormatters.d.ts +1 -0
  990. package/dist/leadership/utils/formatters/dateFormatters.d.ts +52 -0
  991. package/dist/leadership/utils/index.d.ts +9 -0
  992. package/dist/leadership/utils/linkHelpers.d.ts +9 -0
  993. package/dist/leadership/utils/load-fonts.d.ts +1 -0
  994. package/dist/places/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  995. package/dist/places/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  996. package/dist/places/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  997. package/dist/places/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  998. package/dist/places/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  999. package/dist/places/action-plans/components/ActionPlanPage.d.ts +25 -0
  1000. package/dist/places/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1001. package/dist/places/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1002. package/dist/places/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1003. package/dist/places/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1004. package/dist/places/action-plans/constants.d.ts +86 -0
  1005. package/dist/places/action-plans/hooks/useActionPlan.d.ts +19 -0
  1006. package/dist/places/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1007. package/dist/places/action-plans/index.d.ts +15 -0
  1008. package/dist/places/action-plans/types.d.ts +413 -0
  1009. package/dist/places/action-plans/utils/formatTime.d.ts +24 -0
  1010. package/dist/places/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1011. package/dist/places/approval-flow/components/ApproveDialog.d.ts +13 -0
  1012. package/dist/places/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1013. package/dist/places/approval-flow/index.d.ts +4 -0
  1014. package/dist/places/approval-flow/types.d.ts +76 -0
  1015. package/dist/places/assets/index.d.ts +7 -0
  1016. package/dist/places/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1017. package/dist/places/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1018. package/dist/places/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1019. package/dist/places/audit-trail/index.d.ts +9 -0
  1020. package/dist/places/audit-trail/types.d.ts +209 -0
  1021. package/dist/places/audit-trail/utils.d.ts +54 -0
  1022. package/dist/places/auth/components/AliasRedirect.d.ts +13 -0
  1023. package/dist/places/auth/components/AliasRouteGuard.d.ts +20 -0
  1024. package/dist/places/auth/components/EditProfileDialog.d.ts +13 -0
  1025. package/dist/places/auth/components/ProtectedRoute.d.ts +11 -0
  1026. package/dist/places/auth/components/UserInfo.d.ts +10 -0
  1027. package/dist/places/auth/contexts/AuthContext.d.ts +89 -0
  1028. package/dist/places/auth/pages/CallbackPage.d.ts +6 -0
  1029. package/dist/places/auth/pages/LoginPage.d.ts +2 -0
  1030. package/dist/places/auth/services/AuthService.d.ts +64 -0
  1031. package/dist/places/auth/services/SupabaseTokenService.d.ts +3 -0
  1032. package/dist/places/auth/services/TokenManager.d.ts +66 -0
  1033. package/dist/places/auth/services/TokenRegenerationService.d.ts +14 -0
  1034. package/dist/places/auth/services/TokenService.d.ts +48 -0
  1035. package/dist/places/auth/utils/ErrorInterceptor.d.ts +20 -0
  1036. package/dist/places/components/ErrorBoundary.d.ts +19 -0
  1037. package/dist/places/components/dashboards/dashboard-form.d.ts +65 -0
  1038. package/dist/places/components/dashboards/dashboard-general-view.d.ts +124 -0
  1039. package/dist/places/components/dashboards/dashboard-grid.d.ts +66 -0
  1040. package/dist/places/components/dashboards/dashboard-list.d.ts +41 -0
  1041. package/dist/places/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1042. package/dist/places/components/dashboards/dashboard-view.d.ts +48 -0
  1043. package/dist/places/components/dashboards/helpers.d.ts +86 -0
  1044. package/dist/places/components/dashboards/index.d.ts +9 -0
  1045. package/dist/places/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1046. package/dist/places/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1047. package/dist/places/components/dashboards/panels/index.d.ts +14 -0
  1048. package/dist/places/components/dashboards/panels/list-panel.d.ts +45 -0
  1049. package/dist/places/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1050. package/dist/places/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1051. package/dist/places/components/dashboards/panels/panel-error.d.ts +18 -0
  1052. package/dist/places/components/dashboards/panels/panel-header.d.ts +27 -0
  1053. package/dist/places/components/dashboards/panels/panel-loader.d.ts +17 -0
  1054. package/dist/places/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1055. package/dist/places/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1056. package/dist/places/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1057. package/dist/places/components/dashboards/panels/performance-panel.d.ts +39 -0
  1058. package/dist/places/components/dashboards/panels/pie-panel.d.ts +29 -0
  1059. package/dist/places/components/dashboards/panels/text-panel.d.ts +28 -0
  1060. package/dist/places/components/dashboards/types.d.ts +755 -0
  1061. package/dist/places/components/layout/AppHeader.d.ts +6 -0
  1062. package/dist/places/components/layout/AppLayout.d.ts +10 -0
  1063. package/dist/places/components/layout/AppSidebar.d.ts +10 -0
  1064. package/dist/places/components/layout/BodyContent.d.ts +60 -0
  1065. package/dist/places/components/layout/SidebarActionTrigger.d.ts +46 -0
  1066. package/dist/places/components/layout/SidebarHeader.d.ts +5 -0
  1067. package/dist/places/components/layout/SidebarLogo.d.ts +5 -0
  1068. package/dist/places/components/layout/sidebar-utils.d.ts +12 -0
  1069. package/dist/places/components/modules/AccessDeniedDialog.d.ts +43 -0
  1070. package/dist/places/components/modules/ModuleAccessGuard.d.ts +42 -0
  1071. package/dist/places/components/modules/ModuleGrid.d.ts +9 -0
  1072. package/dist/places/components/modules/ModuleOfferContent.d.ts +20 -0
  1073. package/dist/places/components/modules/ModulesContent.d.ts +21 -0
  1074. package/dist/places/components/modules/ModulesDialog.d.ts +3 -0
  1075. package/dist/places/components/modules/ModulesFooterCards.d.ts +10 -0
  1076. package/dist/places/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1077. package/dist/places/components/modules/index.d.ts +14 -0
  1078. package/dist/places/components/modules/modulesData.d.ts +6 -0
  1079. package/dist/places/components/modules/types.d.ts +41 -0
  1080. package/dist/places/components/ui/accordion.d.ts +42 -0
  1081. package/dist/places/components/ui/action-button.d.ts +48 -0
  1082. package/dist/places/components/ui/alert-dialog.d.ts +102 -0
  1083. package/dist/places/components/ui/alert.d.ts +44 -0
  1084. package/dist/places/components/ui/avatar.d.ts +36 -0
  1085. package/dist/places/components/ui/badge.d.ts +41 -0
  1086. package/dist/places/components/ui/breadcrumb.d.ts +73 -0
  1087. package/dist/places/components/ui/button-group.d.ts +24 -0
  1088. package/dist/places/components/ui/button.d.ts +66 -0
  1089. package/dist/places/components/ui/calendar.d.ts +24 -0
  1090. package/dist/places/components/ui/card.d.ts +57 -0
  1091. package/dist/places/components/ui/chart.d.ts +97 -0
  1092. package/dist/places/components/ui/checkbox.d.ts +15 -0
  1093. package/dist/places/components/ui/collapsible.d.ts +20 -0
  1094. package/dist/places/components/ui/color-picker.d.ts +19 -0
  1095. package/dist/places/components/ui/combo-tree.d.ts +103 -0
  1096. package/dist/places/components/ui/combobox.d.ts +64 -0
  1097. package/dist/places/components/ui/command.d.ts +89 -0
  1098. package/dist/places/components/ui/context-menu.d.ts +122 -0
  1099. package/dist/places/components/ui/data-list.d.ts +86 -0
  1100. package/dist/places/components/ui/date-picker.d.ts +19 -0
  1101. package/dist/places/components/ui/dialog-wizard.d.ts +100 -0
  1102. package/dist/places/components/ui/dialog.d.ts +229 -0
  1103. package/dist/places/components/ui/disabled-menu-item.d.ts +25 -0
  1104. package/dist/places/components/ui/drawer.d.ts +94 -0
  1105. package/dist/places/components/ui/dropdown-menu.d.ts +180 -0
  1106. package/dist/places/components/ui/electronic-signature-dialog.d.ts +31 -0
  1107. package/dist/places/components/ui/empty-state.d.ts +79 -0
  1108. package/dist/places/components/ui/export-dialog.d.ts +48 -0
  1109. package/dist/places/components/ui/form.d.ts +119 -0
  1110. package/dist/places/components/ui/grid.d.ts +53 -0
  1111. package/dist/places/components/ui/hover-card.d.ts +21 -0
  1112. package/dist/places/components/ui/icon-picker.d.ts +17 -0
  1113. package/dist/places/components/ui/iframe-dialog.d.ts +24 -0
  1114. package/dist/places/components/ui/input-group.d.ts +113 -0
  1115. package/dist/places/components/ui/input.d.ts +24 -0
  1116. package/dist/places/components/ui/label.d.ts +23 -0
  1117. package/dist/places/components/ui/loading-state.d.ts +52 -0
  1118. package/dist/places/components/ui/menubar.d.ts +113 -0
  1119. package/dist/places/components/ui/multiselect-permissions.d.ts +84 -0
  1120. package/dist/places/components/ui/navigation-menu.d.ts +57 -0
  1121. package/dist/places/components/ui/onboarding-dialog.d.ts +58 -0
  1122. package/dist/places/components/ui/online-editor-dialog.d.ts +28 -0
  1123. package/dist/places/components/ui/page-breadcrumb.d.ts +77 -0
  1124. package/dist/places/components/ui/pagination.d.ts +81 -0
  1125. package/dist/places/components/ui/popover.d.ts +57 -0
  1126. package/dist/places/components/ui/progress.d.ts +22 -0
  1127. package/dist/places/components/ui/radio-group.d.ts +66 -0
  1128. package/dist/places/components/ui/report-request-list.d.ts +64 -0
  1129. package/dist/places/components/ui/resizable.d.ts +38 -0
  1130. package/dist/places/components/ui/rich-text-editor.d.ts +58 -0
  1131. package/dist/places/components/ui/scroll-area.d.ts +40 -0
  1132. package/dist/places/components/ui/select.d.ts +94 -0
  1133. package/dist/places/components/ui/separator.d.ts +17 -0
  1134. package/dist/places/components/ui/sheet.d.ts +108 -0
  1135. package/dist/places/components/ui/sidebar.d.ts +269 -0
  1136. package/dist/places/components/ui/skeleton-variants.d.ts +41 -0
  1137. package/dist/places/components/ui/skeleton.d.ts +14 -0
  1138. package/dist/places/components/ui/slider.d.ts +9 -0
  1139. package/dist/places/components/ui/sonner.d.ts +8 -0
  1140. package/dist/places/components/ui/spinner.d.ts +11 -0
  1141. package/dist/places/components/ui/split-button.d.ts +76 -0
  1142. package/dist/places/components/ui/stack.d.ts +17 -0
  1143. package/dist/places/components/ui/status-badge.d.ts +52 -0
  1144. package/dist/places/components/ui/step-selector.d.ts +46 -0
  1145. package/dist/places/components/ui/stimulsoft-viewer.d.ts +28 -0
  1146. package/dist/places/components/ui/switch.d.ts +25 -0
  1147. package/dist/places/components/ui/tab-page-layout.d.ts +52 -0
  1148. package/dist/places/components/ui/table-resize-handle.d.ts +22 -0
  1149. package/dist/places/components/ui/table.d.ts +112 -0
  1150. package/dist/places/components/ui/tabs.d.ts +66 -0
  1151. package/dist/places/components/ui/terms-of-use-dialog.d.ts +102 -0
  1152. package/dist/places/components/ui/textarea.d.ts +33 -0
  1153. package/dist/places/components/ui/timepicker.d.ts +34 -0
  1154. package/dist/places/components/ui/toggle-group.d.ts +37 -0
  1155. package/dist/places/components/ui/toggle.d.ts +33 -0
  1156. package/dist/places/components/ui/tooltip.d.ts +61 -0
  1157. package/dist/places/components/ui/truncated-cell.d.ts +20 -0
  1158. package/dist/places/components/ui/typography.d.ts +135 -0
  1159. package/dist/places/components/ui/updates-notification.d.ts +47 -0
  1160. package/dist/places/components/ui/users-groups-selector.d.ts +87 -0
  1161. package/dist/places/components/ui/viewer-dialog.d.ts +184 -0
  1162. package/dist/places/config/backend.d.ts +10 -0
  1163. package/dist/places/config/environments.d.ts +27 -0
  1164. package/dist/places/config/index.d.ts +75 -0
  1165. package/dist/places/contexts/LocaleContext.d.ts +15 -0
  1166. package/dist/places/contexts/ModalStateContext.d.ts +57 -0
  1167. package/dist/places/contexts/ModuleContext.d.ts +34 -0
  1168. package/dist/places/contexts/NavigationContext.d.ts +13 -0
  1169. package/dist/places/contexts/PageMetadataContext.d.ts +48 -0
  1170. package/dist/places/crud/components/ActionMenuItems.d.ts +22 -0
  1171. package/dist/places/crud/components/BaseForm.d.ts +52 -0
  1172. package/dist/places/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1173. package/dist/places/crud/components/ContextMenu.d.ts +21 -0
  1174. package/dist/places/crud/components/CrudActionBar.d.ts +59 -0
  1175. package/dist/places/crud/components/CrudGrid.d.ts +53 -0
  1176. package/dist/places/crud/components/CrudPagination.d.ts +17 -0
  1177. package/dist/places/crud/components/CrudTable.d.ts +66 -0
  1178. package/dist/places/crud/components/FilterBar.d.ts +136 -0
  1179. package/dist/places/crud/components/GroupDropZone.d.ts +16 -0
  1180. package/dist/places/crud/components/InlineRowActions.d.ts +15 -0
  1181. package/dist/places/crud/components/SelectionCheckbox.d.ts +9 -0
  1182. package/dist/places/crud/components/TableFooter.d.ts +14 -0
  1183. package/dist/places/crud/components/TableRowActions.d.ts +19 -0
  1184. package/dist/places/crud/createCrudPage.d.ts +134 -0
  1185. package/dist/places/crud/createSimpleService.d.ts +85 -0
  1186. package/dist/places/crud/generateCrudConfig.d.ts +78 -0
  1187. package/dist/places/crud/hooks/useBaseForm.d.ts +47 -0
  1188. package/dist/places/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1189. package/dist/places/crud/hooks/useColumnManager.d.ts +85 -0
  1190. package/dist/places/crud/hooks/useCrud.d.ts +152 -0
  1191. package/dist/places/crud/primitives/ActionMenu.d.ts +69 -0
  1192. package/dist/places/crud/primitives/FilterBar.d.ts +69 -0
  1193. package/dist/places/crud/primitives/Pagination.d.ts +29 -0
  1194. package/dist/places/crud/primitives/Table.d.ts +31 -0
  1195. package/dist/places/crud/primitives/TreeTable.d.ts +7 -0
  1196. package/dist/places/crud/primitives/index.d.ts +12 -0
  1197. package/dist/places/crud/primitives/types.d.ts +199 -0
  1198. package/dist/places/crud/utils/routingHelpers.d.ts +41 -0
  1199. package/dist/places/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1200. package/dist/places/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1201. package/dist/places/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1202. package/dist/places/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1203. package/dist/places/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1204. package/dist/places/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1205. package/dist/places/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1206. package/dist/places/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1207. package/dist/places/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1208. package/dist/places/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1209. package/dist/places/custom-form-fields/index.d.ts +13 -0
  1210. package/dist/places/custom-form-fields/types.d.ts +206 -0
  1211. package/dist/places/exports/action-plans.d.ts +16 -0
  1212. package/dist/places/exports/audit-trail.d.ts +1 -0
  1213. package/dist/places/exports/crud.d.ts +31 -0
  1214. package/dist/places/exports/custom-form-fields.d.ts +1 -0
  1215. package/dist/places/exports/file-upload.d.ts +1 -0
  1216. package/dist/places/exports/integrations.d.ts +15 -0
  1217. package/dist/places/exports/ui.d.ts +100 -0
  1218. package/dist/places/file-upload/components/SingleFileUpload.d.ts +102 -0
  1219. package/dist/places/file-upload/index.d.ts +6 -0
  1220. package/dist/places/file-upload/types.d.ts +26 -0
  1221. package/dist/places/file-upload/utils/formatBytes.d.ts +6 -0
  1222. package/dist/places/file-upload/utils/getFileExtension.d.ts +6 -0
  1223. package/dist/places/hooks/useActiveModules.d.ts +45 -0
  1224. package/dist/places/hooks/useAliasFromUrl.d.ts +33 -0
  1225. package/dist/places/hooks/useColumnResize.d.ts +45 -0
  1226. package/dist/places/hooks/useDebounce.d.ts +56 -0
  1227. package/dist/places/hooks/useDerivedContractedModules.d.ts +8 -0
  1228. package/dist/places/hooks/useI18nFormatters.d.ts +40 -0
  1229. package/dist/places/hooks/useMediaQuery.d.ts +14 -0
  1230. package/dist/places/hooks/useModuleAccess.d.ts +59 -0
  1231. package/dist/places/hooks/usePageTitle.d.ts +10 -0
  1232. package/dist/places/hooks/usePermissionQuery.d.ts +49 -0
  1233. package/dist/places/hooks/useRowResize.d.ts +37 -0
  1234. package/dist/places/hooks/useSidebarResize.d.ts +37 -0
  1235. package/dist/places/hooks/useUpdatesNotification.d.ts +27 -0
  1236. package/dist/places/hooks/useWizard.d.ts +40 -0
  1237. package/dist/places/i18n/LanguageBootstrap.d.ts +14 -0
  1238. package/dist/places/i18n/config.d.ts +13 -0
  1239. package/dist/places/i18n/constants.d.ts +126 -0
  1240. package/dist/places/i18n/index.d.ts +12 -0
  1241. package/dist/places/i18n/utils.d.ts +14 -0
  1242. package/dist/places/integrations/clarity/clarityTracking.d.ts +31 -0
  1243. package/dist/places/integrations/clarity/index.d.ts +3 -0
  1244. package/dist/places/integrations/clarity/types.d.ts +46 -0
  1245. package/dist/places/integrations/clarity/useClarity.d.ts +34 -0
  1246. package/dist/places/integrations/index.d.ts +5 -0
  1247. package/dist/places/leadership/components/LeadershipDialog.d.ts +10 -0
  1248. package/dist/places/leadership/components/LeadershipForm.d.ts +8 -0
  1249. package/dist/places/leadership/components/LeadershipPage.d.ts +19 -0
  1250. package/dist/places/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1251. package/dist/places/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1252. package/dist/places/leadership/index.d.ts +13 -0
  1253. package/dist/places/leadership/types.d.ts +23 -0
  1254. package/dist/places/leadership/utils/leadershipUtils.d.ts +8 -0
  1255. package/dist/places/media/components/ImageEditor.d.ts +22 -0
  1256. package/dist/places/media/components/ImageRenderer.d.ts +23 -0
  1257. package/dist/places/media/components/VideoEditor.d.ts +2 -0
  1258. package/dist/places/media/components/VideoRenderer.d.ts +2 -0
  1259. package/dist/places/media/hooks/useMediaUpload.d.ts +19 -0
  1260. package/dist/places/media/index.d.ts +49 -0
  1261. package/dist/places/media/types.d.ts +66 -0
  1262. package/dist/places/media/utils/imageHelpers.d.ts +28 -0
  1263. package/dist/places/media/utils/videoHelpers.d.ts +35 -0
  1264. package/dist/places/mind-map/components/MindMap.d.ts +23 -0
  1265. package/dist/places/mind-map/components/MindMapConnection.d.ts +12 -0
  1266. package/dist/places/mind-map/components/MindMapNodeView.d.ts +24 -0
  1267. package/dist/places/mind-map/components/MindMapToolbar.d.ts +26 -0
  1268. package/dist/places/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1269. package/dist/places/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1270. package/dist/places/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1271. package/dist/places/mind-map/hooks/useMindMapState.d.ts +32 -0
  1272. package/dist/places/mind-map/index.d.ts +4 -0
  1273. package/dist/places/mind-map/types.d.ts +91 -0
  1274. package/dist/places/mind-map/utils/export-image.d.ts +9 -0
  1275. package/dist/places/mind-map/utils/layout.d.ts +15 -0
  1276. package/dist/places/mind-map/utils/nodeOps.d.ts +66 -0
  1277. package/dist/places/mind-map/utils/serialize.d.ts +10 -0
  1278. package/dist/places/modules/softwaresMap.d.ts +4 -0
  1279. package/dist/places/places/components/ManageAccessModal.d.ts +11 -0
  1280. package/dist/places/places/components/PlaceCard.d.ts +12 -0
  1281. package/dist/places/places/components/PlacesList.d.ts +12 -0
  1282. package/dist/places/places/index.d.ts +8 -0
  1283. package/dist/places/places/services/PlaceService.d.ts +9 -0
  1284. package/dist/places/places/types.d.ts +10 -0
  1285. package/dist/places/providers/CoreProviders.d.ts +107 -0
  1286. package/dist/places/providers/index.d.ts +2 -0
  1287. package/dist/places/qualiex/components/QualiexUserField.d.ts +133 -0
  1288. package/dist/places/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1289. package/dist/places/qualiex/services/qualiexApi.d.ts +75 -0
  1290. package/dist/places/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1291. package/dist/places/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1292. package/dist/places/services/BaseService.d.ts +51 -0
  1293. package/dist/places/services/EmailService.d.ts +110 -0
  1294. package/dist/places/services/ErrorService.d.ts +19 -0
  1295. package/dist/places/services/QualiexEnrichmentService.d.ts +53 -0
  1296. package/dist/places/services/QualiexFieldHelpers.d.ts +17 -0
  1297. package/dist/places/setup/favicon.d.ts +1 -0
  1298. package/dist/places/setup.d.ts +16 -0
  1299. package/dist/places/sign/components/D4SignWidget.d.ts +2 -0
  1300. package/dist/places/sign/components/DocumentSigner.d.ts +2 -0
  1301. package/dist/places/sign/components/SignConfigForm.d.ts +2 -0
  1302. package/dist/places/sign/components/SignWidget.d.ts +9 -0
  1303. package/dist/places/sign/hooks/useSignConfig.d.ts +6 -0
  1304. package/dist/places/sign/index.d.ts +8 -0
  1305. package/dist/places/sign/services/signService.d.ts +17 -0
  1306. package/dist/places/sign/types.d.ts +53 -0
  1307. package/dist/places/sign/utils/loadClicksignScript.d.ts +13 -0
  1308. package/dist/places/supabase/SupabaseSingleton.d.ts +34 -0
  1309. package/dist/places/supabase/client.d.ts +2 -0
  1310. package/dist/places/supabase/legacyKeyGuard.d.ts +19 -0
  1311. package/dist/places/supabase/publicClient.d.ts +2 -0
  1312. package/dist/places/supabase/types.d.ts +377 -0
  1313. package/dist/places/team-selector/components/TeamSelector.d.ts +24 -0
  1314. package/dist/places/team-selector/index.d.ts +2 -0
  1315. package/dist/places/team-selector/types.d.ts +10 -0
  1316. package/dist/places/types/sidebar.d.ts +52 -0
  1317. package/dist/places/utils/color.d.ts +26 -0
  1318. package/dist/places/utils/formatters/currencyFormatters.d.ts +1 -0
  1319. package/dist/places/utils/formatters/dateFormatters.d.ts +52 -0
  1320. package/dist/places/utils/index.d.ts +9 -0
  1321. package/dist/places/utils/linkHelpers.d.ts +9 -0
  1322. package/dist/places/utils/load-fonts.d.ts +1 -0
  1323. package/dist/setup/favicon.d.ts +2 -1
  1324. package/dist/sign/action-plans/components/ActionPlanAttachmentsTab.d.ts +21 -0
  1325. package/dist/sign/action-plans/components/ActionPlanCommentsTab.d.ts +21 -0
  1326. package/dist/sign/action-plans/components/ActionPlanCostTab.d.ts +15 -0
  1327. package/dist/sign/action-plans/components/ActionPlanGeneralTab.d.ts +21 -0
  1328. package/dist/sign/action-plans/components/ActionPlanHistoryTab.d.ts +16 -0
  1329. package/dist/sign/action-plans/components/ActionPlanPage.d.ts +25 -0
  1330. package/dist/sign/action-plans/components/ActionPlanPredecessorsTab.d.ts +15 -0
  1331. package/dist/sign/action-plans/components/ActionPlanProgressDialog.d.ts +16 -0
  1332. package/dist/sign/action-plans/components/ActionPlanProgressTab.d.ts +10 -0
  1333. package/dist/sign/action-plans/components/ActionPlanStatusBadge.d.ts +18 -0
  1334. package/dist/sign/action-plans/constants.d.ts +86 -0
  1335. package/dist/sign/action-plans/hooks/useActionPlan.d.ts +19 -0
  1336. package/dist/sign/action-plans/hooks/useActionPlanProgress.d.ts +20 -0
  1337. package/dist/sign/action-plans/index.d.ts +15 -0
  1338. package/dist/sign/action-plans/types.d.ts +413 -0
  1339. package/dist/sign/action-plans/utils/formatTime.d.ts +24 -0
  1340. package/dist/sign/approval-flow/components/ApprovalSidenav.d.ts +16 -0
  1341. package/dist/sign/approval-flow/components/ApproveDialog.d.ts +13 -0
  1342. package/dist/sign/approval-flow/components/SelectApproverDialog.d.ts +11 -0
  1343. package/dist/sign/approval-flow/index.d.ts +4 -0
  1344. package/dist/sign/approval-flow/types.d.ts +76 -0
  1345. package/dist/sign/assets/index.d.ts +7 -0
  1346. package/dist/sign/audit-trail/components/AuditTrailDetails.d.ts +27 -0
  1347. package/dist/sign/audit-trail/components/AuditTrailFilter.d.ts +29 -0
  1348. package/dist/sign/audit-trail/components/AuditTrailPage.d.ts +40 -0
  1349. package/dist/sign/audit-trail/index.d.ts +9 -0
  1350. package/dist/sign/audit-trail/types.d.ts +209 -0
  1351. package/dist/sign/audit-trail/utils.d.ts +54 -0
  1352. package/dist/sign/auth/components/AliasRedirect.d.ts +13 -0
  1353. package/dist/sign/auth/components/AliasRouteGuard.d.ts +20 -0
  1354. package/dist/sign/auth/components/EditProfileDialog.d.ts +13 -0
  1355. package/dist/sign/auth/components/ProtectedRoute.d.ts +11 -0
  1356. package/dist/sign/auth/components/UserInfo.d.ts +10 -0
  1357. package/dist/sign/auth/contexts/AuthContext.d.ts +89 -0
  1358. package/dist/sign/auth/pages/CallbackPage.d.ts +6 -0
  1359. package/dist/sign/auth/pages/LoginPage.d.ts +2 -0
  1360. package/dist/sign/auth/services/AuthService.d.ts +64 -0
  1361. package/dist/sign/auth/services/SupabaseTokenService.d.ts +3 -0
  1362. package/dist/sign/auth/services/TokenManager.d.ts +66 -0
  1363. package/dist/sign/auth/services/TokenRegenerationService.d.ts +14 -0
  1364. package/dist/sign/auth/services/TokenService.d.ts +48 -0
  1365. package/dist/sign/auth/utils/ErrorInterceptor.d.ts +20 -0
  1366. package/dist/sign/components/ErrorBoundary.d.ts +19 -0
  1367. package/dist/sign/components/dashboards/dashboard-form.d.ts +65 -0
  1368. package/dist/sign/components/dashboards/dashboard-general-view.d.ts +124 -0
  1369. package/dist/sign/components/dashboards/dashboard-grid.d.ts +66 -0
  1370. package/dist/sign/components/dashboards/dashboard-list.d.ts +41 -0
  1371. package/dist/sign/components/dashboards/dashboard-panel-renderer.d.ts +31 -0
  1372. package/dist/sign/components/dashboards/dashboard-view.d.ts +48 -0
  1373. package/dist/sign/components/dashboards/helpers.d.ts +86 -0
  1374. package/dist/sign/components/dashboards/index.d.ts +9 -0
  1375. package/dist/sign/components/dashboards/panels/burndown-panel.d.ts +41 -0
  1376. package/dist/sign/components/dashboards/panels/cartesian-panel.d.ts +66 -0
  1377. package/dist/sign/components/dashboards/panels/index.d.ts +14 -0
  1378. package/dist/sign/components/dashboards/panels/list-panel.d.ts +45 -0
  1379. package/dist/sign/components/dashboards/panels/matrix-risk-panel.d.ts +74 -0
  1380. package/dist/sign/components/dashboards/panels/numeric-panel.d.ts +32 -0
  1381. package/dist/sign/components/dashboards/panels/panel-error.d.ts +18 -0
  1382. package/dist/sign/components/dashboards/panels/panel-header.d.ts +27 -0
  1383. package/dist/sign/components/dashboards/panels/panel-loader.d.ts +17 -0
  1384. package/dist/sign/components/dashboards/panels/panel-no-data.d.ts +16 -0
  1385. package/dist/sign/components/dashboards/panels/panel-unavailable.d.ts +16 -0
  1386. package/dist/sign/components/dashboards/panels/pareto-panel.d.ts +30 -0
  1387. package/dist/sign/components/dashboards/panels/performance-panel.d.ts +39 -0
  1388. package/dist/sign/components/dashboards/panels/pie-panel.d.ts +29 -0
  1389. package/dist/sign/components/dashboards/panels/text-panel.d.ts +28 -0
  1390. package/dist/sign/components/dashboards/types.d.ts +755 -0
  1391. package/dist/sign/components/layout/AppHeader.d.ts +6 -0
  1392. package/dist/sign/components/layout/AppLayout.d.ts +10 -0
  1393. package/dist/sign/components/layout/AppSidebar.d.ts +10 -0
  1394. package/dist/sign/components/layout/BodyContent.d.ts +60 -0
  1395. package/dist/sign/components/layout/SidebarActionTrigger.d.ts +46 -0
  1396. package/dist/sign/components/layout/SidebarHeader.d.ts +5 -0
  1397. package/dist/sign/components/layout/SidebarLogo.d.ts +5 -0
  1398. package/dist/sign/components/layout/sidebar-utils.d.ts +12 -0
  1399. package/dist/sign/components/modules/AccessDeniedDialog.d.ts +43 -0
  1400. package/dist/sign/components/modules/ModuleAccessGuard.d.ts +42 -0
  1401. package/dist/sign/components/modules/ModuleGrid.d.ts +9 -0
  1402. package/dist/sign/components/modules/ModuleOfferContent.d.ts +20 -0
  1403. package/dist/sign/components/modules/ModulesContent.d.ts +21 -0
  1404. package/dist/sign/components/modules/ModulesDialog.d.ts +3 -0
  1405. package/dist/sign/components/modules/ModulesFooterCards.d.ts +10 -0
  1406. package/dist/sign/components/modules/icons/ModulesCardIcons.d.ts +19 -0
  1407. package/dist/sign/components/modules/index.d.ts +14 -0
  1408. package/dist/sign/components/modules/modulesData.d.ts +6 -0
  1409. package/dist/sign/components/modules/types.d.ts +41 -0
  1410. package/dist/sign/components/ui/accordion.d.ts +42 -0
  1411. package/dist/sign/components/ui/action-button.d.ts +48 -0
  1412. package/dist/sign/components/ui/alert-dialog.d.ts +102 -0
  1413. package/dist/sign/components/ui/alert.d.ts +44 -0
  1414. package/dist/sign/components/ui/avatar.d.ts +36 -0
  1415. package/dist/sign/components/ui/badge.d.ts +41 -0
  1416. package/dist/sign/components/ui/breadcrumb.d.ts +73 -0
  1417. package/dist/sign/components/ui/button-group.d.ts +24 -0
  1418. package/dist/sign/components/ui/button.d.ts +66 -0
  1419. package/dist/sign/components/ui/calendar.d.ts +24 -0
  1420. package/dist/sign/components/ui/card.d.ts +57 -0
  1421. package/dist/sign/components/ui/chart.d.ts +97 -0
  1422. package/dist/sign/components/ui/checkbox.d.ts +15 -0
  1423. package/dist/sign/components/ui/collapsible.d.ts +20 -0
  1424. package/dist/sign/components/ui/color-picker.d.ts +19 -0
  1425. package/dist/sign/components/ui/combo-tree.d.ts +103 -0
  1426. package/dist/sign/components/ui/combobox.d.ts +64 -0
  1427. package/dist/sign/components/ui/command.d.ts +89 -0
  1428. package/dist/sign/components/ui/context-menu.d.ts +122 -0
  1429. package/dist/sign/components/ui/data-list.d.ts +86 -0
  1430. package/dist/sign/components/ui/date-picker.d.ts +19 -0
  1431. package/dist/sign/components/ui/dialog-wizard.d.ts +100 -0
  1432. package/dist/sign/components/ui/dialog.d.ts +229 -0
  1433. package/dist/sign/components/ui/disabled-menu-item.d.ts +25 -0
  1434. package/dist/sign/components/ui/drawer.d.ts +94 -0
  1435. package/dist/sign/components/ui/dropdown-menu.d.ts +180 -0
  1436. package/dist/sign/components/ui/electronic-signature-dialog.d.ts +31 -0
  1437. package/dist/sign/components/ui/empty-state.d.ts +79 -0
  1438. package/dist/sign/components/ui/export-dialog.d.ts +48 -0
  1439. package/dist/sign/components/ui/form.d.ts +119 -0
  1440. package/dist/sign/components/ui/grid.d.ts +53 -0
  1441. package/dist/sign/components/ui/hover-card.d.ts +21 -0
  1442. package/dist/sign/components/ui/icon-picker.d.ts +17 -0
  1443. package/dist/sign/components/ui/iframe-dialog.d.ts +24 -0
  1444. package/dist/sign/components/ui/input-group.d.ts +113 -0
  1445. package/dist/sign/components/ui/input.d.ts +24 -0
  1446. package/dist/sign/components/ui/label.d.ts +23 -0
  1447. package/dist/sign/components/ui/loading-state.d.ts +52 -0
  1448. package/dist/sign/components/ui/menubar.d.ts +113 -0
  1449. package/dist/sign/components/ui/multiselect-permissions.d.ts +84 -0
  1450. package/dist/sign/components/ui/navigation-menu.d.ts +57 -0
  1451. package/dist/sign/components/ui/onboarding-dialog.d.ts +58 -0
  1452. package/dist/sign/components/ui/online-editor-dialog.d.ts +28 -0
  1453. package/dist/sign/components/ui/page-breadcrumb.d.ts +77 -0
  1454. package/dist/sign/components/ui/pagination.d.ts +81 -0
  1455. package/dist/sign/components/ui/popover.d.ts +57 -0
  1456. package/dist/sign/components/ui/progress.d.ts +22 -0
  1457. package/dist/sign/components/ui/radio-group.d.ts +66 -0
  1458. package/dist/sign/components/ui/report-request-list.d.ts +64 -0
  1459. package/dist/sign/components/ui/resizable.d.ts +38 -0
  1460. package/dist/sign/components/ui/rich-text-editor.d.ts +58 -0
  1461. package/dist/sign/components/ui/scroll-area.d.ts +40 -0
  1462. package/dist/sign/components/ui/select.d.ts +94 -0
  1463. package/dist/sign/components/ui/separator.d.ts +17 -0
  1464. package/dist/sign/components/ui/sheet.d.ts +108 -0
  1465. package/dist/sign/components/ui/sidebar.d.ts +269 -0
  1466. package/dist/sign/components/ui/skeleton-variants.d.ts +41 -0
  1467. package/dist/sign/components/ui/skeleton.d.ts +14 -0
  1468. package/dist/sign/components/ui/slider.d.ts +9 -0
  1469. package/dist/sign/components/ui/sonner.d.ts +8 -0
  1470. package/dist/sign/components/ui/spinner.d.ts +11 -0
  1471. package/dist/sign/components/ui/split-button.d.ts +76 -0
  1472. package/dist/sign/components/ui/stack.d.ts +17 -0
  1473. package/dist/sign/components/ui/status-badge.d.ts +52 -0
  1474. package/dist/sign/components/ui/step-selector.d.ts +46 -0
  1475. package/dist/sign/components/ui/stimulsoft-viewer.d.ts +28 -0
  1476. package/dist/sign/components/ui/switch.d.ts +25 -0
  1477. package/dist/sign/components/ui/tab-page-layout.d.ts +52 -0
  1478. package/dist/sign/components/ui/table-resize-handle.d.ts +22 -0
  1479. package/dist/sign/components/ui/table.d.ts +112 -0
  1480. package/dist/sign/components/ui/tabs.d.ts +66 -0
  1481. package/dist/sign/components/ui/terms-of-use-dialog.d.ts +102 -0
  1482. package/dist/sign/components/ui/textarea.d.ts +33 -0
  1483. package/dist/sign/components/ui/timepicker.d.ts +34 -0
  1484. package/dist/sign/components/ui/toggle-group.d.ts +37 -0
  1485. package/dist/sign/components/ui/toggle.d.ts +33 -0
  1486. package/dist/sign/components/ui/tooltip.d.ts +61 -0
  1487. package/dist/sign/components/ui/truncated-cell.d.ts +20 -0
  1488. package/dist/sign/components/ui/typography.d.ts +135 -0
  1489. package/dist/sign/components/ui/updates-notification.d.ts +47 -0
  1490. package/dist/sign/components/ui/users-groups-selector.d.ts +87 -0
  1491. package/dist/sign/components/ui/viewer-dialog.d.ts +184 -0
  1492. package/dist/sign/config/backend.d.ts +10 -0
  1493. package/dist/sign/config/environments.d.ts +27 -0
  1494. package/dist/sign/config/index.d.ts +75 -0
  1495. package/dist/sign/contexts/LocaleContext.d.ts +15 -0
  1496. package/dist/sign/contexts/ModalStateContext.d.ts +57 -0
  1497. package/dist/sign/contexts/ModuleContext.d.ts +34 -0
  1498. package/dist/sign/contexts/NavigationContext.d.ts +13 -0
  1499. package/dist/sign/contexts/PageMetadataContext.d.ts +48 -0
  1500. package/dist/sign/crud/components/ActionMenuItems.d.ts +22 -0
  1501. package/dist/sign/crud/components/BaseForm.d.ts +52 -0
  1502. package/dist/sign/crud/components/ColumnSettingsPopover.d.ts +28 -0
  1503. package/dist/sign/crud/components/ContextMenu.d.ts +21 -0
  1504. package/dist/sign/crud/components/CrudActionBar.d.ts +59 -0
  1505. package/dist/sign/crud/components/CrudGrid.d.ts +53 -0
  1506. package/dist/sign/crud/components/CrudPagination.d.ts +17 -0
  1507. package/dist/sign/crud/components/CrudTable.d.ts +66 -0
  1508. package/dist/sign/crud/components/FilterBar.d.ts +136 -0
  1509. package/dist/sign/crud/components/GroupDropZone.d.ts +16 -0
  1510. package/dist/sign/crud/components/InlineRowActions.d.ts +15 -0
  1511. package/dist/sign/crud/components/SelectionCheckbox.d.ts +9 -0
  1512. package/dist/sign/crud/components/TableFooter.d.ts +14 -0
  1513. package/dist/sign/crud/components/TableRowActions.d.ts +19 -0
  1514. package/dist/sign/crud/createCrudPage.d.ts +134 -0
  1515. package/dist/sign/crud/createSimpleService.d.ts +85 -0
  1516. package/dist/sign/crud/generateCrudConfig.d.ts +78 -0
  1517. package/dist/sign/crud/hooks/useBaseForm.d.ts +47 -0
  1518. package/dist/sign/crud/hooks/useColumnDragReorder.d.ts +19 -0
  1519. package/dist/sign/crud/hooks/useColumnManager.d.ts +85 -0
  1520. package/dist/sign/crud/hooks/useCrud.d.ts +152 -0
  1521. package/dist/sign/crud/primitives/ActionMenu.d.ts +69 -0
  1522. package/dist/sign/crud/primitives/FilterBar.d.ts +69 -0
  1523. package/dist/sign/crud/primitives/Pagination.d.ts +29 -0
  1524. package/dist/sign/crud/primitives/Table.d.ts +31 -0
  1525. package/dist/sign/crud/primitives/TreeTable.d.ts +7 -0
  1526. package/dist/sign/crud/primitives/index.d.ts +12 -0
  1527. package/dist/sign/crud/primitives/types.d.ts +199 -0
  1528. package/dist/sign/crud/utils/routingHelpers.d.ts +41 -0
  1529. package/dist/sign/custom-form-fields/components/CustomFormFields.d.ts +11 -0
  1530. package/dist/sign/custom-form-fields/fields/FormDateField.d.ts +9 -0
  1531. package/dist/sign/custom-form-fields/fields/FormMultiSelectionField.d.ts +9 -0
  1532. package/dist/sign/custom-form-fields/fields/FormNumericField.d.ts +9 -0
  1533. package/dist/sign/custom-form-fields/fields/FormQuestionsField.d.ts +9 -0
  1534. package/dist/sign/custom-form-fields/fields/FormSingleSelectionField.d.ts +9 -0
  1535. package/dist/sign/custom-form-fields/fields/FormTextField.d.ts +9 -0
  1536. package/dist/sign/custom-form-fields/fields/FormTimeField.d.ts +9 -0
  1537. package/dist/sign/custom-form-fields/fields/FormUrlField.d.ts +9 -0
  1538. package/dist/sign/custom-form-fields/fields/ReadOnlyTextField.d.ts +9 -0
  1539. package/dist/sign/custom-form-fields/index.d.ts +13 -0
  1540. package/dist/sign/custom-form-fields/types.d.ts +206 -0
  1541. package/dist/sign/exports/action-plans.d.ts +16 -0
  1542. package/dist/sign/exports/audit-trail.d.ts +1 -0
  1543. package/dist/sign/exports/crud.d.ts +31 -0
  1544. package/dist/sign/exports/custom-form-fields.d.ts +1 -0
  1545. package/dist/sign/exports/file-upload.d.ts +1 -0
  1546. package/dist/sign/exports/integrations.d.ts +15 -0
  1547. package/dist/sign/exports/ui.d.ts +100 -0
  1548. package/dist/sign/file-upload/components/SingleFileUpload.d.ts +102 -0
  1549. package/dist/sign/file-upload/index.d.ts +6 -0
  1550. package/dist/sign/file-upload/types.d.ts +26 -0
  1551. package/dist/sign/file-upload/utils/formatBytes.d.ts +6 -0
  1552. package/dist/sign/file-upload/utils/getFileExtension.d.ts +6 -0
  1553. package/dist/sign/hooks/useActiveModules.d.ts +45 -0
  1554. package/dist/sign/hooks/useAliasFromUrl.d.ts +33 -0
  1555. package/dist/sign/hooks/useColumnResize.d.ts +45 -0
  1556. package/dist/sign/hooks/useDebounce.d.ts +56 -0
  1557. package/dist/sign/hooks/useDerivedContractedModules.d.ts +8 -0
  1558. package/dist/sign/hooks/useI18nFormatters.d.ts +40 -0
  1559. package/dist/sign/hooks/useMediaQuery.d.ts +14 -0
  1560. package/dist/sign/hooks/useModuleAccess.d.ts +59 -0
  1561. package/dist/sign/hooks/usePageTitle.d.ts +10 -0
  1562. package/dist/sign/hooks/usePermissionQuery.d.ts +49 -0
  1563. package/dist/sign/hooks/useRowResize.d.ts +37 -0
  1564. package/dist/sign/hooks/useSidebarResize.d.ts +37 -0
  1565. package/dist/sign/hooks/useUpdatesNotification.d.ts +27 -0
  1566. package/dist/sign/hooks/useWizard.d.ts +40 -0
  1567. package/dist/sign/i18n/LanguageBootstrap.d.ts +14 -0
  1568. package/dist/sign/i18n/config.d.ts +13 -0
  1569. package/dist/sign/i18n/constants.d.ts +126 -0
  1570. package/dist/sign/i18n/index.d.ts +12 -0
  1571. package/dist/sign/i18n/utils.d.ts +14 -0
  1572. package/dist/sign/integrations/clarity/clarityTracking.d.ts +31 -0
  1573. package/dist/sign/integrations/clarity/index.d.ts +3 -0
  1574. package/dist/sign/integrations/clarity/types.d.ts +46 -0
  1575. package/dist/sign/integrations/clarity/useClarity.d.ts +34 -0
  1576. package/dist/sign/integrations/index.d.ts +5 -0
  1577. package/dist/sign/leadership/components/LeadershipDialog.d.ts +10 -0
  1578. package/dist/sign/leadership/components/LeadershipForm.d.ts +8 -0
  1579. package/dist/sign/leadership/components/LeadershipPage.d.ts +19 -0
  1580. package/dist/sign/leadership/hooks/useLeadershipApi.d.ts +4 -0
  1581. package/dist/sign/leadership/hooks/useLeadershipMutations.d.ts +29 -0
  1582. package/dist/sign/leadership/index.d.ts +13 -0
  1583. package/dist/sign/leadership/types.d.ts +23 -0
  1584. package/dist/sign/leadership/utils/leadershipUtils.d.ts +8 -0
  1585. package/dist/sign/media/components/ImageEditor.d.ts +22 -0
  1586. package/dist/sign/media/components/ImageRenderer.d.ts +23 -0
  1587. package/dist/sign/media/components/VideoEditor.d.ts +2 -0
  1588. package/dist/sign/media/components/VideoRenderer.d.ts +2 -0
  1589. package/dist/sign/media/hooks/useMediaUpload.d.ts +19 -0
  1590. package/dist/sign/media/index.d.ts +49 -0
  1591. package/dist/sign/media/types.d.ts +66 -0
  1592. package/dist/sign/media/utils/imageHelpers.d.ts +28 -0
  1593. package/dist/sign/media/utils/videoHelpers.d.ts +35 -0
  1594. package/dist/sign/mind-map/components/MindMap.d.ts +23 -0
  1595. package/dist/sign/mind-map/components/MindMapConnection.d.ts +12 -0
  1596. package/dist/sign/mind-map/components/MindMapNodeView.d.ts +24 -0
  1597. package/dist/sign/mind-map/components/MindMapToolbar.d.ts +26 -0
  1598. package/dist/sign/mind-map/hooks/useMindMapKeyboard.d.ts +15 -0
  1599. package/dist/sign/mind-map/hooks/useMindMapLayout.d.ts +5 -0
  1600. package/dist/sign/mind-map/hooks/useMindMapPanZoom.d.ts +21 -0
  1601. package/dist/sign/mind-map/hooks/useMindMapState.d.ts +32 -0
  1602. package/dist/sign/mind-map/index.d.ts +4 -0
  1603. package/dist/sign/mind-map/types.d.ts +91 -0
  1604. package/dist/sign/mind-map/utils/export-image.d.ts +9 -0
  1605. package/dist/sign/mind-map/utils/layout.d.ts +15 -0
  1606. package/dist/sign/mind-map/utils/nodeOps.d.ts +66 -0
  1607. package/dist/sign/mind-map/utils/serialize.d.ts +10 -0
  1608. package/dist/sign/modules/softwaresMap.d.ts +4 -0
  1609. package/dist/sign/places/components/ManageAccessModal.d.ts +11 -0
  1610. package/dist/sign/places/components/PlaceCard.d.ts +12 -0
  1611. package/dist/sign/places/components/PlacesList.d.ts +12 -0
  1612. package/dist/sign/places/index.d.ts +8 -0
  1613. package/dist/sign/places/services/PlaceService.d.ts +9 -0
  1614. package/dist/sign/places/types.d.ts +10 -0
  1615. package/dist/sign/providers/CoreProviders.d.ts +107 -0
  1616. package/dist/sign/providers/index.d.ts +2 -0
  1617. package/dist/sign/qualiex/components/QualiexUserField.d.ts +133 -0
  1618. package/dist/sign/qualiex/hooks/useQualiexUsers.d.ts +41 -0
  1619. package/dist/sign/qualiex/services/qualiexApi.d.ts +75 -0
  1620. package/dist/sign/qualiex/utils/QualiexErrorInterceptor.d.ts +20 -0
  1621. package/dist/sign/qualiex/utils/userPlaceUtils.d.ts +16 -0
  1622. package/dist/sign/services/BaseService.d.ts +51 -0
  1623. package/dist/sign/services/EmailService.d.ts +110 -0
  1624. package/dist/sign/services/ErrorService.d.ts +19 -0
  1625. package/dist/sign/services/QualiexEnrichmentService.d.ts +53 -0
  1626. package/dist/sign/services/QualiexFieldHelpers.d.ts +17 -0
  1627. package/dist/sign/setup/favicon.d.ts +1 -0
  1628. package/dist/sign/setup.d.ts +16 -0
  1629. package/dist/sign/sign/components/D4SignWidget.d.ts +2 -0
  1630. package/dist/sign/sign/components/DocumentSigner.d.ts +2 -0
  1631. package/dist/sign/sign/components/SignConfigForm.d.ts +2 -0
  1632. package/dist/sign/sign/components/SignWidget.d.ts +9 -0
  1633. package/dist/sign/sign/hooks/useSignConfig.d.ts +6 -0
  1634. package/dist/sign/sign/index.d.ts +8 -0
  1635. package/dist/sign/sign/services/signService.d.ts +17 -0
  1636. package/dist/sign/sign/types.d.ts +53 -0
  1637. package/dist/sign/sign/utils/loadClicksignScript.d.ts +13 -0
  1638. package/dist/sign/supabase/SupabaseSingleton.d.ts +34 -0
  1639. package/dist/sign/supabase/client.d.ts +2 -0
  1640. package/dist/sign/supabase/legacyKeyGuard.d.ts +19 -0
  1641. package/dist/sign/supabase/publicClient.d.ts +2 -0
  1642. package/dist/sign/supabase/types.d.ts +377 -0
  1643. package/dist/sign/team-selector/components/TeamSelector.d.ts +24 -0
  1644. package/dist/sign/team-selector/index.d.ts +2 -0
  1645. package/dist/sign/team-selector/types.d.ts +10 -0
  1646. package/dist/sign/types/sidebar.d.ts +52 -0
  1647. package/dist/sign/utils/color.d.ts +26 -0
  1648. package/dist/sign/utils/formatters/currencyFormatters.d.ts +1 -0
  1649. package/dist/sign/utils/formatters/dateFormatters.d.ts +52 -0
  1650. package/dist/sign/utils/index.d.ts +9 -0
  1651. package/dist/sign/utils/linkHelpers.d.ts +9 -0
  1652. package/dist/sign/utils/load-fonts.d.ts +1 -0
  1653. package/package.json +1 -1
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 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,useReducer as g}from"react";import{Slot as v}from"@radix-ui/react-slot";import{cva as b}from"class-variance-authority";import{clsx as x}from"clsx";import{twMerge as y}from"tailwind-merge";import{getDefaultOptions as w,parseISO as N,isValid as _,format as C}from"date-fns";import{toast as k,Toaster as S}from"sonner";export{toast as sonnerToast,toast}from"sonner";import*as A from"lucide-react";import{EllipsisVertical as E,X as P,ChevronDown as D,ChevronUp as T,Check as I,Loader2 as M,Loader2Icon as R,OctagonXIcon as z,TriangleAlertIcon as L,InfoIcon as F,CircleCheckIcon as U,ChevronRight as O,Circle as j,AlertCircle as $,Search as B,FileX as V,Edit as q,PowerOff as W,Power as H,Trash2 as G,Pencil as K,ToggleRight as Y,ToggleLeft as Q,Plus as J,LayoutGrid as X,List as Z,Table2 as ee,Columns3 as ae,GripVertical as te,Group as re,ArrowUp as ne,ArrowDown as oe,ChevronsLeft as ie,ChevronLeft as se,ChevronsRight as le,CheckCircle as de,AlertTriangle as ce,Info as ue,RefreshCw as me,Camera as pe,Copy as he,ExternalLink as fe,NotebookText as ge,Building2 as ve,User as be,LogOut as xe,Sparkles as ye,MoreHorizontal as we,Calendar as Ne,PanelLeft as _e,Edit3 as Ce,Code as ke,Eye as Se,Heading1 as Ae,Heading2 as Ee,Heading3 as Pe,Bold as De,Italic as Te,Underline as Ie,Strikethrough as Me,ListOrdered as Re,Highlighter as ze,Link as Le,RemoveFormatting as Fe,Undo as Ue,Redo as Oe,ImageIcon as je,ArrowLeft as $e,ArrowRight as Be,Image as Ve,FileImage as qe,FileText as We,FileSpreadsheet as He,Clock as Ge,Lock as Ke,ShieldCheck as Ye,Mail as Qe,Coffee as Je,CheckCheck as Xe,Star as Ze,Download as ea,Users as aa,TriangleAlert as ta,CheckCircle2 as ra,Hourglass as na,MoreVertical as oa,Minus as ia,CornerDownRight as sa,ChevronsUpDown as la,ChevronsDownUp as da,ZoomOut as ca,ZoomIn as ua,Maximize2 as ma,Undo2 as pa,Redo2 as ha,ArrowUpToLine as fa,UserPen as ga,Menu as va,Heart as ba,Upload as xa,CloudUpload as ya,MapPin as wa,XCircle as Na,Shield as _a}from"lucide-react";import*as Ca from"@radix-ui/react-label";import*as ka from"@radix-ui/react-dialog";export{ka as DialogPrimitive};import*as Sa from"@radix-ui/react-separator";import*as Aa from"@radix-ui/react-alert-dialog";import{useFormContext as Ea,FormProvider as Pa,Controller as Da}from"react-hook-form";import*as Ta from"@radix-ui/react-select";import*as Ia from"@radix-ui/react-checkbox";import*as Ma from"@radix-ui/react-dropdown-menu";import*as Ra from"@radix-ui/react-tooltip";import*as za from"@radix-ui/react-popover";import{useTranslation as La,initReactI18next as Fa,I18nextProvider as Ua}from"react-i18next";export{I18nextProvider,useTranslation}from"react-i18next";import{createClient as Oa}from"@supabase/supabase-js";import{useQueryClient as ja,useQuery as $a,useMutation as Ba,QueryClient as Va,QueryClientProvider as qa}from"@tanstack/react-query";import{useSearchParams as Wa,useParams as Ha,useNavigate as Ga,useLocation as Ka,Navigate as Ya,Link as Qa}from"react-router-dom";import*as Ja from"@radix-ui/react-context-menu";import*as Xa from"@radix-ui/react-toggle-group";import*as Za from"@radix-ui/react-toggle";import*as et from"@radix-ui/react-scroll-area";import*as at from"@radix-ui/react-switch";import*as tt from"@radix-ui/react-avatar";import*as rt from"@radix-ui/react-collapsible";import*as nt from"@radix-ui/react-tabs";import*as ot from"@radix-ui/react-accordion";export{ot as AccordionPrimitive};import{DayPicker as it}from"react-day-picker";import{Drawer as st}from"vaul";import*as lt from"@radix-ui/react-hover-card";import*as dt from"@radix-ui/react-navigation-menu";import*as ct from"@radix-ui/react-progress";import*as ut from"@radix-ui/react-radio-group";import*as mt from"react-resizable-panels";import*as pt from"@radix-ui/react-slider";import*as ht from"@radix-ui/react-menubar";import*as ft from"recharts";import{ResponsiveContainer as gt,Legend as vt,BarChart as bt,Bar as xt,AreaChart as yt,Area as wt,LineChart as Nt,Line as _t,CartesianGrid as Ct,XAxis as kt,YAxis as St,Tooltip as At,PieChart as Et,Pie as Pt,Cell as Dt,ComposedChart as Tt}from"recharts";import{useEditor as It,EditorContent as Mt}from"@tiptap/react";import Rt from"@tiptap/starter-kit";import zt from"@tiptap/extension-underline";import Lt from"@tiptap/extension-link";import{TextStyle as Ft}from"@tiptap/extension-text-style";import{Color as Ut}from"@tiptap/extension-color";import Ot from"@tiptap/extension-highlight";import{useSensors as jt,useSensor as $t,PointerSensor as Bt,DndContext as Vt,closestCenter as qt}from"@dnd-kit/core";import{SortableContext as Wt,rectSortingStrategy as Ht,useSortable as Gt}from"@dnd-kit/sortable";import{z as Kt}from"zod";const Yt={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api.qualiex.com"},Qt={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com"};function Jt(){return"DEV"===import.meta.env.VITE_APP_ENV?"DEV":"PROD"}function Xt(){return"DEV"===Jt()?Qt:Yt}function Zt(){return"DEV"===Jt()}let er="supabase";function ar(e){er=e}function tr(){return er}function rr(){return"supabase"===er}const nr={get oauth(){const e=Xt();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:"id_token token",scope:"openid profile email"}}},or={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},ir={debounceDelay:500},sr=()=>{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},lr=()=>sr()&&rr(),dr=sr,cr=()=>Xt().qualiexApiUrl,ur={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},mr={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},pr={isQualiex:"true"===import.meta.env.VITE_IS_QUALIEX},hr={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}`}},fr=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)}}),gr="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",vr=`${gr}/logo-qualiex-white.svg`,br=`${gr}/logo-qualitfy-white.svg`,xr=`${gr}/logo-metroex-white.svg`,yr=`${gr}/logo-forlogic-white.svg`,wr=`${gr}/saber-gestao-white.png`,Nr=`${gr}/small.svg`,_r=`${gr}/favicon.png`,Cr={qualiex:vr,qualitfy:br,metroex:xr,saber:wr,qualiexSmall:yr,saberSmall:Nr};function kr(e){return pr.isQualiex?e?.isMetroex?xr:e?.isQualitfy?br:vr:wr}const Sr={logo:kr(),smallLogo:pr.isQualiex?yr:Nr,favicon:_r},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 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 Dr(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const Tr={date:Dr({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Dr({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:Dr({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ir={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]}}const Rr={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"})};function zr(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 Lr(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 Fr={ordinalNumber:Lr({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:zr({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:zr({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:zr({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:zr({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:zr({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"})},Ur={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:Tr,formatRelative:(e,a,t,r)=>Ir[e],localize:Rr,match:Fr,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Or={};function jr(){return Or}const $r=6048e5;function Br(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 Vr(e){const a=Br(e);return a.setHours(0,0,0,0),a}function qr(e){const a=Br(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 Wr(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function Hr(e){const a=Br(e),t=function(e,a){const t=Vr(e),r=Vr(a),n=+t-qr(t),o=+r-qr(r);return Math.round((n-o)/864e5)}(a,function(e){const a=Br(e),t=Wr(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function Gr(e,a){const t=jr(),r=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=Br(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 Kr(e){return Gr(e,{weekStartsOn:1})}function Yr(e){const a=Br(e),t=a.getFullYear(),r=Wr(e,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const n=Kr(r),o=Wr(e,0);o.setFullYear(t,0,4),o.setHours(0,0,0,0);const i=Kr(o);return a.getTime()>=n.getTime()?t+1:a.getTime()>=i.getTime()?t:t-1}function Qr(e){const a=Br(e),t=+Kr(a)-+function(e){const a=Yr(e),t=Wr(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),Kr(t)}(a);return Math.round(t/$r)+1}function Jr(e,a){const t=Br(e),r=t.getFullYear(),n=jr(),o=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Wr(e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const s=Gr(i,a),l=Wr(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const d=Gr(l,a);return t.getTime()>=s.getTime()?r+1:t.getTime()>=d.getTime()?r:r-1}function Xr(e,a){const t=Br(e),r=+Gr(t,a)-+function(e,a){const t=jr(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=Jr(e,a),o=Wr(e,0);return o.setFullYear(n,0,r),o.setHours(0,0,0,0),Gr(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 en={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)}},an="midnight",tn="noon",rn="morning",nn="afternoon",on="evening",sn="night",ln={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 en.y(e,a)},Y:function(e,a,t,r){const n=Jr(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(Yr(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 en.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=Xr(e,r);return"wo"===a?t.ordinalNumber(n,{unit:"week"}):Zr(n,a.length)},I:function(e,a,t){const r=Qr(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"}):en.d(e,a)},D:function(e,a,t){const r=Hr(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?tn:0===r?an: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?on:r>=12?nn:r>=4?rn:sn,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 en.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):en.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"}):en.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):en.s(e,a)},S:function(e,a){return en.S(e,a)},X:function(e,a,t){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(a){case"X":return cn(r);case"XXXX":case"XX":return un(r);default:return un(r,":")}},x:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"x":return cn(r);case"xxxx":case"xx":return un(r);default:return un(r,":")}},O:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+dn(r,":");default:return"GMT"+un(r,":")}},z:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+dn(r,":");default:return"GMT"+un(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 dn(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 cn(e,a){if(e%60==0){return(e>0?"-":"+")+Zr(Math.abs(e)/60,2)}return un(e,a)}function un(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+Zr(Math.trunc(r/60),2)+a+Zr(r%60,2)}const mn=(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"})}},pn=(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"})}},hn={p:pn,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],r=t[1],n=t[2];if(!n)return mn(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}}",mn(r,a)).replace("{{time}}",pn(n,a))}},fn=/^D+$/,gn=/^Y+$/,vn=["D","DD","YY","YYYY"];function bn(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=Br(e);return!isNaN(Number(t))}const xn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,yn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,wn=/^'([^]*?)'?$/,Nn=/''/g,_n=/[a-zA-Z]/;function Cn(e,a,t){const r=jr(),n=t?.locale??r.locale??Ur,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=Br(e);if(!bn(s))throw new RangeError("Invalid time value");let l=a.match(yn).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,hn[a])(e,n.formatLong)}return e}).join("").match(xn).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:kn(e)};if(ln[a])return{isToken:!0,value:e};if(a.match(_n))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 gn.test(e)}(o)||!t?.useAdditionalDayOfYearTokens&&function(e){return fn.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(vn.includes(e))throw new RangeError(r)}(o,a,String(e));return(0,ln[o[0]])(s,o,n.localize,d)}).join("")}function kn(e){const a=e.match(wn);return a?a[1].replace(Nn,"'"):e}function Sn(e,a,t){const r=w(),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 An(e,a){const t=function(e){Pn[e]||(Pn[e]=Tn?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 Pn[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=En[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 En={year:0,month:1,day:2,hour:3,minute:4,second:5};const Pn={},Dn=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")),Tn="06/25/2014, 00:00:00"===Dn||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===Dn;function In(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 Mn=36e5,Rn={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function zn(e,a,t){if(!e)return 0;let r,n,o=Rn.timezoneZ.exec(e);if(o)return 0;if(o=Rn.timezoneHH.exec(e),o)return r=parseInt(o[1],10),Fn(r)?-r*Mn:NaN;if(o=Rn.timezoneHHMM.exec(e),o){r=parseInt(o[2],10);const e=parseInt(o[3],10);return Fn(r,e)?(n=Math.abs(r)*Mn+6e4*e,"+"===o[1]?-n:n):NaN}if(function(e){if(Un[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Un[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const r=t?a:function(e){return In(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),n=Ln(r,e),o=t?n:function(e,a,t){const r=e.getTime();let n=r-a;const o=Ln(new Date(n),t);if(a===o)return a;n-=o-a;const i=Ln(new Date(n),t);if(o===i)return o;return Math.max(o,i)}(a,n,e);return-o}return NaN}function Ln(e,a){const t=An(e,a),r=In(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 Fn(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const Un={};const On={X:function(e,a,t){const r=jn(t.timeZone,e);if(0===r)return"Z";switch(a){case"X":return Vn(r);case"XXXX":case"XX":return Bn(r);default:return Bn(r,":")}},x:function(e,a,t){const r=jn(t.timeZone,e);switch(a){case"x":return Vn(r);case"xxxx":case"xx":return Bn(r);default:return Bn(r,":")}},O:function(e,a,t){const r=jn(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"+Bn(r,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return Sn("short",e,t);default:return Sn("long",e,t)}}};function jn(e,a){const t=e?zn(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 Bn(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 Vn(e,a){if(e%60==0){return(e>0?"-":"+")+$n(Math.abs(e)/60,2)}return Bn(e,a)}function qn(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 Wn=36e5,Hn=6e4,Gn={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 Kn(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=Gn.dateTimePattern.exec(e);r?(a.date=r[1],t=r[3]):(r=Gn.datePattern.exec(e),r?(a.date=r[1],t=r[2]):(a.date=null,t=e));if(t){const e=Gn.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=Gn.YYY[a],r=Gn.YYYYY[a];let n=Gn.YYYY.exec(e)||r.exec(e);if(n){const a=n[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(n=Gn.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=Gn.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=Gn.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=Xn(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=Gn.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=Gn.Www.exec(e),o)return n=parseInt(o[1],10)-1,eo(n)?Yn(a,n):new Date(NaN);if(o=Gn.WwwD.exec(e),o){n=parseInt(o[1],10)-1;const e=parseInt(o[2],10)-1;return eo(n,e)?Yn(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=Gn.HH.exec(e);if(r)return a=parseFloat(r[1].replace(",",".")),ao(a)?a%24*Wn:NaN;if(r=Gn.HHMM.exec(e),r)return a=parseInt(r[1],10),t=parseFloat(r[2].replace(",",".")),ao(a,t)?a%24*Wn+t*Hn:NaN;if(r=Gn.HHMMSS.exec(e),r){a=parseInt(r[1],10),t=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return ao(a,t,e)?a%24*Wn+t*Hn+1e3*e:NaN}return null}(r.time),null===n||isNaN(n)))return new Date(NaN);if(r.timeZone||a.timeZone){if(t=zn(r.timeZone||a.timeZone,new Date(e+n)),isNaN(t))return new Date(NaN)}else t=qn(new Date(e+n)),t=qn(new Date(e+n+t));return new Date(e+n+t)}return new Date(NaN)}function Yn(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 Qn=[31,28,31,30,31,30,31,31,30,31,30,31],Jn=[31,29,31,30,31,30,31,31,30,31,30,31];function Xn(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=Xn(e);if(r&&t>Jn[a])return!1;if(!r&&t>Qn[a])return!1}return!0}function eo(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function ao(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const to=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function ro(e,a,t,r){return function(e,a,t={}){const r=(a=String(a)).match(to);if(r){const n=Kn(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,"'"+On[a[0]](n,a,t)+"'");return o?i.substring(0,r-1)+i.substring(r+1):i},a)}return Cn(e,a,t)}(function(e,a,t){const r=zn(a,e=Kn(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 no={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"}},oo={date:Dr({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:Dr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Dr({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},io={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"},so={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"},lo={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"})},co={ordinalNumber:Lr({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:zr({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:zr({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:zr({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:zr({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:zr({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"})},uo={code:"es",formatDistance:(e,a,t)=>{let r;const n=no[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:oo,formatRelative:(e,a,t,r)=>1!==a.getHours()?so[e]:io[e],localize:lo,match:co,options:{weekStartsOn:1,firstWeekContainsDate:1}},mo={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"}},po={date:Dr({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:Dr({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Dr({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ho={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"},fo={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"})},go={ordinalNumber:Lr({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:zr({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:zr({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:zr({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:zr({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:zr({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"})},vo={code:"pt-BR",formatDistance:(e,a,t)=>{let r;const n=mo[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:po,formatRelative:(e,a,t,r)=>{const n=ho[e];return"function"==typeof n?n(a):n},localize:fo,match:go,options:{weekStartsOn:0,firstWeekContainsDate:1}},bo=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],xo=[{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"}],yo=[{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"}],wo="pt-BR",No="dd/MM/yyyy HH:mm",_o="America/Sao_Paulo",Co=e=>bo.find(a=>a.value===e),ko=e=>xo.find(a=>a.value===e),So=e=>yo.find(a=>a.value===e),Ao=e=>bo.some(a=>a.value===e),Eo=e=>xo.some(a=>a.value===e),Po=e=>yo.some(a=>a.value===e),Do=()=>{if("undefined"==typeof navigator)return wo;const e=navigator.language;if(Ao(e))return e;const a=e.split("-")[0],t=bo.find(e=>e.value.startsWith(a));return t?.value||wo},To=()=>{if("undefined"==typeof Intl)return _o;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return Po(e)?e:_o}catch{return _o}},Io=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||No),Mo=()=>{const e=Do();return{locale:e,timezone:To(),datetimeFormat:Io(e)}},Ro={"pt-BR":vo,"en-US":Ur,"es-ES":uo},zo=(e,a=No,t=_o,r=wo)=>{if(!e)return"";const n=N(e);if(!_(n))return"Data inválida";const o=Ro[r]||vo;try{return ro(n,t,a,{locale:o})}catch(i){return ro(n,_o,a,{locale:o})}},Lo=(e,a=wo,t=_o)=>{if(!e)return"";const r=N(e);if(!_(r))return"Data inválida";const n=Ro[a]||vo;try{return ro(r,t,"PP",{locale:n})}catch(o){return ro(r,_o,"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 Uo(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 Oo(e,a=.1){const{r:t,g:r,b:n}=Uo(e);return`rgba(${t}, ${r}, ${n}, ${a})`}function jo(e){const{r:a,g:t,b:r}=Uo(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 $o(e,a){const t=jo(e),r=jo(a);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)}function Bo(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{k.info("Link copiado para a área de transferência")})}function Vo(e,a){return a?e.replace(/\{alias\}/g,a):e}function qo(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const a=new Uint8Array(16);crypto.getRandomValues(a),a[6]=15&a[6]|64,a[8]=63&a[8]|128;const t=Array.from(a,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}const Wo=()=>Date.now().toString(),Ho=["hint","details","code","where","schema","table","column"],Go="Ocorreu um erro ao processar sua solicitação.",Ko=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function Yo(e){const a=function(e){if(!e)return Go;if("string"==typeof e)return e;if(e instanceof Error)return e.message||Go;if("object"==typeof e&&"message"in e)return String(e.message);return Go}(e);return Zt()?a:Ko.some(e=>e.test(a))?Go:a}function Qo(e){if(!e||"object"!=typeof e)return e;const a={...e};for(const t of Ho)delete a[t];return a}function Jo(...e){return y(x(e))}const Xo=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Xo);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,r]of Object.entries(e))a[t]=Xo(r);return a}return e},Zo=(e,a)=>{let t;return(...r)=>{clearTimeout(t),t=setTimeout(()=>e(...r),a)}},ei=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),ai=b("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"}}),ti=n.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>a(n?v:"button",{className:Jo(ai({variant:t,size:r,className:e})),ref:i,...o}));ti.displayName="Button";const ri=o.forwardRef(({className:e,children:t,variant:r="action",...n},o)=>a(ti,{ref:o,variant:r,size:"icon",className:Jo("h-8 w-8",e),...n,children:t||a(E,{size:16})}));ri.displayName="ActionButton";const ni=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:Jo("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]})]})});ni.displayName="Input";const oi=b("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ii=n.forwardRef(({className:e,...t},r)=>a(Ca.Root,{ref:r,className:Jo(oi(),e),...t}));ii.displayName=Ca.Root.displayName;const si=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));si.displayName="Card";const li=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("flex flex-col space-y-1.5 p-6",e),...t}));li.displayName="CardHeader";const di=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Jo("text-2xl font-semibold leading-none tracking-tight",e),...t}));di.displayName="CardTitle";const ci=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));ci.displayName="CardDescription";const ui=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("p-6 pt-0",e),...t}));ui.displayName="CardContent";const mi=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("flex items-center p-6 pt-0",e),...t}));mi.displayName="CardFooter";const pi=n.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>a(Sa.Root,{ref:o,decorative:r,orientation:t,className:Jo("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));pi.displayName=Sa.Root.displayName;const hi=Aa.Root,fi=Aa.Trigger,gi=Aa.Portal,vi=n.forwardRef(({className:e,...t},r)=>a(Aa.Overlay,{className:Jo("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}));vi.displayName=Aa.Overlay.displayName;const bi=n.forwardRef(({className:e,...r},n)=>t(gi,{children:[a(vi,{}),a(Aa.Content,{ref:n,className:Jo("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})]}));bi.displayName=Aa.Content.displayName;const xi=({className:e,...t})=>a("div",{className:Jo("flex flex-col space-y-2 text-center sm:text-left",e),...t});xi.displayName="AlertDialogHeader";const yi=({className:e,...t})=>a("div",{className:Jo("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});yi.displayName="AlertDialogFooter";const wi=n.forwardRef(({className:e,...t},r)=>a(Aa.Title,{ref:r,className:Jo("text-lg font-semibold",e),...t}));wi.displayName=Aa.Title.displayName;const Ni=n.forwardRef(({className:e,...t},r)=>a(Aa.Description,{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));Ni.displayName=Aa.Description.displayName;const _i=n.forwardRef(({className:e,...t},r)=>a(Aa.Action,{ref:r,className:Jo(ai(),e),...t}));_i.displayName=Aa.Action.displayName;const Ci=n.forwardRef(({className:e,...t},r)=>a(Aa.Cancel,{ref:r,className:Jo(ai({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ci.displayName=Aa.Cancel.displayName;const ki=ka.Root,Si=ka.Trigger,Ai=ka.Portal,Ei=ka.Close,Pi=n.forwardRef(({className:e,...t},r)=>a(ka.Overlay,{ref:r,className:Jo("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}));Pi.displayName=ka.Overlay.displayName;const Di={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),E=i??(d||c||u||m||p||h?void 0:"md"),D=E?Di[E]:{},T={...d??D.width?{width:d??D.width}:{},...c??D.minWidth?{minWidth:c??D.minWidth}:{},...u??D.maxWidth?{maxWidth:u??D.maxWidth}:{},...m??D.height?{height:m??D.height}:{},...p??D.minHeight?{minHeight:p??D.minHeight}:{},...h??D.maxHeight?{maxHeight:h??D.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(Ai,{children:[a(Pi,{}),t(ka.Content,{ref:_,className:Jo("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(ka.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(P,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]}),a(hi,{open:C,onOpenChange:k,children:t(bi,{children:[t(xi,{children:[a(wi,{children:f}),a(Ni,{children:g})]}),t(yi,{children:[a(Ci,{onClick:()=>{k(!1),S.current=null},children:v}),a(_i,{onClick:()=>{k(!1),S.current?.(),S.current=null},children:b})]})]})})]})});Ti.displayName=ka.Content.displayName;const Ii=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:Jo("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(pi,{className:"mt-2"})]});Ii.displayName="DialogHeader";const Mi=({className:e,...t})=>a("div",{className:Jo("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});Mi.displayName="DialogBody";const Ri=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(pi,{className:"mb-4"}),a("div",{className:Jo("flex flex-row justify-end gap-2",e),...n,children:r})]});Ri.displayName="DialogFooter";const zi=n.forwardRef(({className:e,...t},r)=>a(ka.Title,{ref:r,className:Jo("text-xl font-semibold leading-none tracking-tight",e),...t}));zi.displayName=ka.Title.displayName;const Li=n.forwardRef(({className:e,...t},r)=>a(ka.Description,{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));Li.displayName=ka.Description.displayName;const Fi=Pa,Ui=n.createContext({}),Oi=({...e})=>a(Ui.Provider,{value:{name:e.name},children:a(Da,{...e})}),ji=()=>{const e=n.useContext(Ui),a=n.useContext($i),{getFieldState:t,formState:r}=Ea(),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}},$i=n.createContext({}),Bi=n.forwardRef(({className:e,...t},r)=>{const o=n.useId();return a($i.Provider,{value:{id:o},children:a("div",{ref:r,className:Jo("space-y-1.5",e),...t})})});Bi.displayName="FormItem";const Vi=n.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:o}=ji();return a(ii,{ref:r,className:Jo(n&&"text-destructive",e),htmlFor:o,...t})});Vi.displayName="FormLabel";const qi=n.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:i}=ji();return a(v,{ref:t,id:n,"aria-describedby":r?`${o} ${i}`:`${o}`,"aria-invalid":!!r,...e})});qi.displayName="FormControl";const Wi=n.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=ji();return a("p",{ref:r,id:n,className:Jo("text-sm text-muted-foreground",e),...t})});Wi.displayName="FormDescription";const Hi=n.forwardRef(({className:e,children:t,...r},n)=>{const{error:o,formMessageId:i}=ji(),s=o?String(o?.message):t;return s?a("p",{ref:n,id:i,className:Jo("text-sm font-medium text-destructive",e),...r,children:s}):null});Hi.displayName="FormMessage";const Gi=n.createContext({showCheck:!1}),Ki=({showCheck:e=!1,...t})=>a(Gi.Provider,{value:{showCheck:e},children:a(Ta.Root,{...t})}),Yi=Ta.Group,Qi=Ta.Value,Ji=n.forwardRef(({className:e,children:r,...n},o)=>t(Ta.Trigger,{ref:o,className:Jo("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(Ta.Icon,{asChild:!0,children:a(D,{className:"h-4 w-4 opacity-50"})})]}));Ji.displayName=Ta.Trigger.displayName;const Xi=n.forwardRef(({className:e,...t},r)=>a(Ta.ScrollUpButton,{ref:r,className:Jo("flex cursor-default items-center justify-center py-1",e),...t,children:a(T,{className:"h-4 w-4"})}));Xi.displayName=Ta.ScrollUpButton.displayName;const Zi=n.forwardRef(({className:e,...t},r)=>a(Ta.ScrollDownButton,{ref:r,className:Jo("flex cursor-default items-center justify-center py-1",e),...t,children:a(D,{className:"h-4 w-4"})}));Zi.displayName=Ta.ScrollDownButton.displayName;const es=n.forwardRef(({className:e,children:r,position:n="popper",container:o,collisionBoundary:i,...s},l)=>a(Ta.Portal,{container:o,children:t(Ta.Content,{ref:l,className:Jo("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(Xi,{}),a(Ta.Viewport,{className:Jo("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),a(Zi,{})]})}));es.displayName=Ta.Content.displayName;const as=n.forwardRef(({className:e,...t},r)=>a(Ta.Label,{ref:r,className:Jo("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));as.displayName=Ta.Label.displayName;const ts=n.forwardRef(({className:e,children:r,...o},i)=>{const{showCheck:s}=n.useContext(Gi);return t(Ta.Item,{ref:i,className:Jo("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(Ta.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),a(Ta.ItemText,{children:r})]})});ts.displayName=Ta.Item.displayName;const rs=n.forwardRef(({className:e,...t},r)=>a(Ta.Separator,{ref:r,className:Jo("-mx-1 my-1 h-px bg-muted",e),...t}));rs.displayName=Ta.Separator.displayName;const ns=n.forwardRef(({className:e,...t},r)=>a(Ia.Root,{ref:r,className:Jo("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(Ia.Indicator,{className:Jo("flex items-center justify-center text-current"),children:a(I,{className:"h-4 w-4"})})}));ns.displayName=Ia.Root.displayName;const os=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:Jo("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]})]})});os.displayName="Textarea";const is=b("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"}}),ss=n.forwardRef(({className:e,variant:t,...r},n)=>a("div",{ref:n,className:Jo(is({variant:t}),e),...r}));ss.displayName="Badge";const ls={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function ds({size:e="md",className:t}){return a(M,{className:Jo("animate-spin text-muted-foreground",ls[e],t)})}function cs({isLoading:e,children:n,className:o,type:i="spinner",size:s="md"}){return e?"overlay"===i?t("div",{className:Jo("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(ds,{size:s})})]}):a("div","skeleton"===i?{className:Jo("animate-pulse",o),children:a("div",{className:"bg-muted rounded-md h-full w-full"})}:{className:Jo("flex items-center justify-center py-8",o),children:a(ds,{size:s})}):a(r,{children:n})}const us=({...e})=>a(S,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a(U,{className:"h-4 w-4"}),info:a(F,{className:"h-4 w-4"}),warning:a(L,{className:"h-4 w-4"}),error:a(z,{className:"h-4 w-4"}),loading:a(R,{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}),ms=Ma.Root,ps=Ma.Trigger,hs=Ma.Group,fs=Ma.Portal,gs=Ma.Sub,vs=Ma.RadioGroup,bs=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ma.SubTrigger,{ref:i,className:Jo("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"})]}));bs.displayName=Ma.SubTrigger.displayName;const xs=n.forwardRef(({className:e,...t},r)=>a(Ma.SubContent,{ref:r,className:Jo("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}));xs.displayName=Ma.SubContent.displayName;const ys=n.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a(Ma.Portal,{children:a(Ma.Content,{ref:n,sideOffset:t,className:Jo("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})}));ys.displayName=Ma.Content.displayName;const ws=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ma.Item,{ref:n,className:Jo("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}));ws.displayName=Ma.Item.displayName;const Ns=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ma.CheckboxItem,{ref:i,className:Jo("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(Ma.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Ns.displayName=Ma.CheckboxItem.displayName;const _s=n.forwardRef(({className:e,children:r,...n},o)=>t(Ma.RadioItem,{ref:o,className:Jo("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(Ma.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));_s.displayName=Ma.RadioItem.displayName;const Cs=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ma.Label,{ref:n,className:Jo("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Cs.displayName=Ma.Label.displayName;const ks=n.forwardRef(({className:e,...t},r)=>a(Ma.Separator,{ref:r,className:Jo("-mx-1 my-1 h-px bg-muted",e),...t}));ks.displayName=Ma.Separator.displayName;const Ss=({className:e,...t})=>a("span",{className:Jo("ml-auto text-xs tracking-widest opacity-60",e),...t});Ss.displayName="DropdownMenuShortcut";const As=({delayDuration:e=300,...t})=>a(Ra.Provider,{delayDuration:e,...t}),Es=Ra.Root,Ps=Ra.Trigger,Ds=n.forwardRef(({className:e,sideOffset:t=4,container:r,...n},o)=>a(Ra.Portal,{container:r,children:a(Ra.Content,{ref:o,sideOffset:t,className:Jo("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})}));Ds.displayName=Ra.Content.displayName;const Ts=n.forwardRef(({children:e,disabledReason:r,className:n},o)=>{const i=a(ws,{ref:o,className:Jo("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(As,{delayDuration:100,children:t(Es,{children:[a(Ps,{asChild:!0,children:a("div",{className:"w-full",children:i})}),a(Ds,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:r})]})}):i});Ts.displayName="DisabledMenuItem";const Is=za.Root,Ms=za.Trigger,Rs=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:n,...o},i)=>a(za.Portal,{container:n,children:a(za.Content,{ref:i,align:t,sideOffset:r,className:Jo("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})}));Rs.displayName=za.Content.displayName;const zs=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));zs.displayName="Command";const Ls=({children:e,...t})=>a("div",{...t,children:a(zs,{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})}),Fs=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:Jo("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})}));Fs.displayName="CommandInput";const Us=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Us.displayName="CommandList";const Os=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("py-6 text-center text-sm text-muted-foreground",e),...t}));Os.displayName="CommandEmpty";const js=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("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}));js.displayName="CommandGroup";const $s=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("-mx-1 h-px bg-border",e),...t}));$s.displayName="CommandSeparator";const Bs=n.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...o},i)=>a("div",{ref:i,className:Jo("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}));Bs.displayName="CommandItem";const Vs=({className:e,...t})=>a("span",{className:Jo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function qs({className:e,...t}){return a("div",{className:Jo("animate-pulse rounded-md bg-muted",e),...t})}Vs.displayName="CommandShortcut";const Ws=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Hs({multiple:r,options:n,value:o,onChange:l,getOptionValue:d,getOptionLabel:c,renderOption:u,placeholder:m,label:p,icon:h,emptyMessage:f,searchPlaceholder:g,disabled:v,required:b,className:x,sortOptions:y,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k,showCheck:S}){const[A,E]=i(!1),[T,M]=i(""),R=s(()=>o?Array.isArray(o)?o:[o]:[],[o]),z=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 y?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[n,d,c,y]),F=s(()=>{if(!T)return L;const e=Ws(T);return L.filter(a=>Ws(a.label).includes(e))},[L,T]),U=s(()=>L.filter(e=>R.includes(e.value)),[L,R]),O=e=>{E(e),e?_?.():(M(""),C?.())},j=(e,a)=>{a.preventDefault(),a.stopPropagation(),l&&l(r?R.filter(a=>a!==e):"")},$=w?U.slice(0,w):U,B=w&&U.length>w?U.length-w:0;return t("div",{className:Jo("space-y-2",x),children:[p&&t(ii,{children:[p,b&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Is,{open:A,onOpenChange:O,modal:!1,children:[r?a(Ms,{asChild:!0,children:t("div",{role:"combobox","aria-expanded":A,"aria-disabled":v,tabIndex:v?-1:0,onKeyDown:e=>{v||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),O(!A))},className:Jo("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",v&&"pointer-events-none opacity-50 cursor-not-allowed",0===U.length&&"text-muted-foreground"),children:[0===U.length?t("span",{className:"flex items-center gap-2",children:[h&&a(h,{className:"h-4 w-4"}),m]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>t(ss,{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(P,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),B>0&&t(ss,{variant:"outline",className:"gap-1",children:["+",B]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t("div",{className:"relative",children:[a(Ms,{asChild:!0,children:t(ti,{variant:"outline",role:"combobox","aria-expanded":A,disabled:v,className:Jo("relative w-full justify-start min-h-10 h-auto pr-10",k&&U.length>0&&"pr-16",0===U.length&&"text-muted-foreground"),children:[0===U.length?t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[h&&a(h,{className:"h-4 w-4"}),a("span",{className:"truncate",children:m})]}):t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[h&&a(h,{className:"h-4 w-4"}),a("span",{className:"truncate",children:U[0]?.label})]}),a(D,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),k&&U.length>0&&a("button",{type:"button",disabled:v,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(P,{className:"h-3.5 w-3.5"})})]}),a(Rs,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:z,collisionBoundary:z,children:t(zs,{children:[t("div",{className:"relative",children:[a(Fs,{placeholder:g,value:T,onChange:e=>M(e.target.value)}),T&&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:()=>M(""),children:a(P,{className:"h-3.5 w-3.5"})})]}),a(Us,{children:0===n.length?a(Os,{children:f}):0===F.length?a(Os,{children:e.t("no_results")}):a(js,{children:F.map(e=>{const n=R.includes(e.value);return t(Bs,{value:e.value,onSelect:()=>(e=>{if(l)if(r){const a=R.includes(e)?R.filter(a=>a!==e):[...R,e];l(a)}else l(e),E(!1)})(e.value),className:Jo("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:[S&&a(I,{className:Jo("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),u?u(e.original):e.label]},e.value)})})})]})})]})]})}function Gs({multiple:e=!1,options:r,items:n,value:o,onChange:i,onValueChange:s,getOptionValue:l=e=>e.value,getOptionLabel:d=e=>e.label,renderOption:c,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:f,disabled:g=!1,required:v=!1,isLoading:b=!1,error:x,className:y,sortOptions:w=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:E}=La(),P=r||n||[],D=s||i,T=u||E("select_placeholder","Selecione..."),I=h||E("no_results",E("no_results")),M=f||E("search_placeholder","Pesquisar...");if(b)return t("div",{className:Jo("space-y-2",y),children:[m&&t(ii,{children:[m,v&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qs,{className:"h-10 w-full"})]});const R="string"==typeof x?x:x instanceof Error?x.message:x?E("error_loading",E("error_loading")):void 0;return R?t("div",{className:Jo("space-y-2",y),children:[m&&t(ii,{children:[m,v&&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($,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:R})]})]}):a(Hs,{multiple:e,options:P,value:o||(e?[]:""),onChange:D,getOptionValue:l,getOptionLabel:d,renderOption:c,placeholder:T,label:m,icon:p,emptyMessage:I,searchPlaceholder:M,disabled:g,required:v,className:y,sortOptions:w,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const Ks=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Ys(e,a){if(!a)return null;const t=Ks(a),r=[];for(const n of e){const e=Ks(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 Qs(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=Qs(t.children,a);if(e)return e}}}function Js({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:Jo("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:Jo("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:Jo("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 Xs({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(Js,{node:e,level:n,expanded:r,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}),r&&e.children&&e.children.length>0&&a(Xs,{nodes:e.children,level:n+1,expandedIds:i,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c})]},e.value)})})}function Zs({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}=La(),[S,A]=i(!1),[E,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]),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]),O=s(()=>Ys(r,E),[r,E])??r,j=s(()=>E?function(e,a){const t=new Set,r=Ks(a);function n(e){if(!e.children||0===e.children.length)return Ks(e.label).includes(r);let a=!1;for(const t of e.children)n(t)&&(a=!0);return a&&t.add(e.value),a||Ks(e.label).includes(r)}for(const o of e)n(o);return t}(r,E):new Set,[r,E]),V=E?j:I,q=l(e=>{E||M(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[E]),W=s(()=>F.map(e=>({value:e,label:Qs(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:Jo("space-y-2",b),children:[c&&t(ii,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(qs,{className:"h-10 w-full"})]});const J="string"==typeof v?v:v instanceof Error?v.message:v?k("error_loading",k("error_loading")):void 0;return t("div",J?{className:Jo("space-y-2",b),children:[c&&t(ii,{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($,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:J})]})]}:{className:Jo("space-y-2",b),children:[c&&t(ii,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Is,{open:S,onOpenChange:H,modal:!1,children:[a(Ms,{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:Jo("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(ss,{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(P,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),Q>0&&t(ss,{variant:"outline",className:"gap-1",children:["+",Q]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t(ti,{variant:"outline",role:"combobox","aria-expanded":S,disabled:h,className:Jo("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(Rs,{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:L,value:E,onChange:e=>T(e.target.value)}),E&&a("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a(P,{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===O.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(Xs,{nodes:O,level:0,expandedIds:V,onToggleExpand:q,selectedValues:F,onSelect:G,showCheck:C})})})]})]})]})}const el=void 0!==import.meta&&"true"===import.meta.env?.VITE_AUTH_DEBUG,al=new Map;function tl(e,a=1/0){if(!el)return 0;const t=(al.get(e)??0)+1;return al.set(e,t),t}function rl(e){if(el)try{performance.mark(`auth:${e}`)}catch{}}async function nl(e,a){if(!el)return a();const t=performance.now();try{return await a()}finally{performance.now()}}function ol(e){if(!el)return;if(0===al.size)return;const a={};for(const[t,r]of al.entries())a[t]=r}let il=null;function sl(e,a,t){if(!el||!a)return;if(t&&"object"==typeof t)for(const r in t)/^co\d+$/.test(r)&&0}const ll=()=>el;var dl=Object.defineProperty;const cl=class e{static normalizeBase64Url(e){let a=e.replace(/-/g,"+").replace(/_/g,"/");const t=(4-a.length%4)%4;return a+="=".repeat(t),a}static parseJwtPayload(a){if(ll()){return tl(`parseJwtPayload:${a.length}:${a.slice(-8)}`,4),tl("parseJwtPayload:total"),function(e,a){if(!el)return a();performance.now();try{return a()}finally{performance.now()}}(a.length,()=>e._parseJwtPayloadImpl(a))}return e._parseJwtPayloadImpl(a)}static _parseJwtPayloadImpl(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()}};((e,a,t)=>{a in e?dl(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t})(cl,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let ul=cl;const ml="qualiex_access_token",pl="qualiex_id_token",hl="supabase_token",fl="oauth_state",gl="oauth_nonce",vl="selected_alias",bl="manual_logout",xl="supabase_project_id",yl={setAccessToken:e=>localStorage.setItem(ml,e),getAccessToken:()=>localStorage.getItem(ml),setIdToken:e=>localStorage.setItem(pl,e),getIdToken:()=>localStorage.getItem(pl),getSupabaseToken:()=>localStorage.getItem(hl),setOAuthState:e=>sessionStorage.setItem(fl,e),getOAuthState:()=>sessionStorage.getItem(fl),clearOAuthState:()=>sessionStorage.removeItem(fl),setOAuthNonce:e=>sessionStorage.setItem(gl,e),getOAuthNonce:()=>sessionStorage.getItem(gl),clearOAuthNonce:()=>sessionStorage.removeItem(gl),setSelectedAlias:e=>localStorage.setItem(vl,e),getSelectedAlias:()=>localStorage.getItem(vl),clearSelectedAlias:()=>localStorage.removeItem(vl),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!yl.getAccessToken()||!yl.getIdToken()),checkProjectMismatch:()=>{const e=Xt().supabaseProjectId;if(!e)return!1;const a=localStorage.getItem(xl);return a&&a!==e?(yl.clearAll(),localStorage.setItem(xl,e),!0):(a||localStorage.setItem(xl,e),!1)},setSupabaseToken:e=>{localStorage.setItem(hl,e),yl._clearValidationCache()},areAllTokensValid:()=>{const e=yl.getAccessToken(),a=yl.getIdToken();if(!e||!a)return!1;try{const t=ul.validateTokens(e,a);return!!t.idTokenValid&&t.idTokenValid}catch(t){return!1}},clearExpiredTokens:()=>{let e=!1;const a=yl.getAccessToken(),t=yl.getIdToken(),r=yl.getSupabaseToken();return a&&yl.isTokenExpired(a)&&(localStorage.removeItem(ml),e=!0),t&&yl.isTokenExpired(t)&&(localStorage.removeItem(pl),e=!0),r&&yl.isTokenExpired(r)&&(localStorage.removeItem(hl),e=!0),e},clearAll:()=>{localStorage.removeItem(ml),localStorage.removeItem(pl),localStorage.removeItem(hl),localStorage.removeItem(vl),sessionStorage.removeItem(fl),sessionStorage.removeItem(gl),yl._clearValidationCache()},setManualLogout:()=>localStorage.setItem(bl,"true"),isManualLogout:()=>"true"===localStorage.getItem(bl),clearManualLogout:()=>localStorage.removeItem(bl),isTokenExpired:e=>{try{return ul.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{yl._validationCache.isValid=!1,yl._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=yl.getSupabaseToken();if(!e)return!1;if(yl.isTokenExpired(e))return yl._clearValidationCache(),yl._handleExpiredToken(),!1;const a=Date.now();return a-yl._validationCache.timestamp<yl._validationCache.cacheValidityMs?yl._validationCache.isValid:(yl._validationCache.isValid=!0,yl._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>yl.isSupabaseTokenValid()?yl.getSupabaseToken():null,_handleExpiredToken:()=>{yl.clearAll()},extractTokenData:()=>{if(tl("TokenManager.extractTokenData"),!yl.isSupabaseTokenValid())return null;const e=yl.getSupabaseToken();if(!e)return null;try{const a=ul.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 yl._handleExpiredToken(),null}},getCompanyId:e=>{tl("TokenManager.getCompanyId");const a=yl.getAccessToken();if(a)try{const t=ul.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=yl.extractTokenData();if(t?.companyId)return t.companyId;const r=yl.getIdToken();if(r)try{const a=ul.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=>{tl("TokenManager.getCompanyIdInt");const a=[yl.getAccessToken(),yl.getIdToken()];for(const t of a)if(t)try{const a=ul.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=yl.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{tl("TokenManager.getAllCompaniesData");const e=yl.getIdToken();if(!e)return[];try{const a=ul.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[]}}};var wl=Object.defineProperty,Nl=(e,a,t)=>((e,a,t)=>a in e?wl(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);const _l=new class{constructor(){Nl(this,"errors",[]),Nl(this,"toastCount",0),Nl(this,"lastToastTime",0)}handleError(e,a=!0){const t="string"==typeof e?e:e.message,r=Yo(t);if(this.errors.push({id:qo("short"),message:t,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),a&&this.shouldShowToast()){const e=this.getErrorTitle(r);k.error(e,{description:r})}}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){k.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 Cl(e){return!!e&&e.startsWith("eyJ")}let kl=!1;var Sl=Object.defineProperty,Al=(e,a,t)=>((e,a,t)=>a in e?Sl(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);function El(){if(Zt()){const e=Xt();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}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 Pl(){return null!==El()}const Dl=class e{constructor(e){Al(this,"client"),Al(this,"currentToken",null),Al(this,"config"),this.config=e,function(){const e=import.meta.env.VITE_SUPABASE_PK_OVERRIDE,a=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;kl?Cl(a):e&&Cl(a)?kl=!0:Cl(a)?kl=!0:kl=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:this.config.key};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return Oa(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:a,fetch:async(e,a)=>{const t="string"==typeof e?e:e.url;if(t.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(t.includes("apikey="))try{const e=new URL(t,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=t.startsWith("http")?e.toString():e.pathname+e.search+e.hash,n={...a,headers:{...a?.headers,apikey:this.config.key}};return fetch(r,n)}}catch{}return fetch(e,a)}}})}static getInstance(){if(!e.instance){const a=El();if(!a)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).");e.instance=new e(a)}return e.instance}getClient(){const e=yl.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!ul.isTokenExpired(e)}catch(a){return _l.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}};Al(Dl,"instance");let Tl=Dl;function Il(){return Tl.getInstance().getClient()}class Ml{static async generateToken(e,a,t,r=!1){try{if(!r){const e=yl.getSupabaseToken();if(e&&yl.isSupabaseTokenValid())return e}const n=Il();tl("SupabaseTokenService.generateToken:invoke");const{data:o,error:i}=await nl(0,()=>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?(yl.setSupabaseToken(o.access_token),o.access_token):null}catch(n){return n instanceof Error&&(n.message.includes("401")||n.message.includes("Unauthorized"))&&t?.(),null}}}var Rl=Object.defineProperty,zl=(e,a,t)=>((e,a,t)=>a in e?Rl(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);class Ll{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=yl.getAccessToken(),t=yl.getSelectedAlias();if(!a||!t)return null;const r=await Ml.generateToken(a,t,this.onLogoutCallback||void 0,e);return r||null}catch(a){return null}}}zl(Ll,"regenerationPromise",null),zl(Ll,"onLogoutCallback",null);class Fl{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(yl.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.")}}}var Ul=Object.defineProperty;class Ol{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 Ll.attemptRegeneration()?(this.isRetrying=!1,!0):(Fl.handleError(e),this.isRetrying=!1,!1)}catch(r){return Fl.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=yl.getAccessToken();return e?yl.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."}}}((e,a,t)=>{((e,a,t)=>{a in e?Ul(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t})(e,a+"",t)})(Ol,"isRetrying",!1);const jl=new class{get baseUrl(){return cr()}async makeApiCall(e,a,t,r){const n=Ol.validateToken();if(!n.valid)throw new Error(n.message||"Token inválido");const o=yl.getAccessToken();if(!o)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=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{i.searchParams.append(e,a)});const s=await fetch(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!s.ok){const e=new Error(`API call failed: ${s.status} ${s.statusText}`);throw e.status=s.status,e.statusCode=s.status,e}return await s.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 _l.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(_l.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 Ol.handleApiError(n))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a," após retry")??[]}catch(o){return _l.handleError(o instanceof Error?o:"Erro ao buscar usuários após renovação de token",!0),[]}return _l.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 _l.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=yl.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||""})):(_l.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await Ol.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 _l.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return _l.handleError(a instanceof Error?a.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,a,t){const r=!!t?.baseUrl,n=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,o=r?t.baseUrl:void 0,i=e=>e.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}));try{const e=await this.makeApiCall(n,{},a,o),t=e?.data||e;return Array.isArray(t)?i(t):(_l.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(s){if(await Ol.handleApiError(s))try{const e=await this.makeApiCall(n,{},a,o),t=e?.data||e;return Array.isArray(t)?i(t):[]}catch(l){return _l.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return _l.handleError(s instanceof Error?s.message:"Erro ao buscar associações do usuário",!0),[]}}};function $l(e,a){const t=a||mr.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Bl(e,a){const t=a||mr.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Vl(e,a){const t=a||mr.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function ql(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||$l(e.idField),emailField:e.emailField||Bl(e.idField),usernameField:e.usernameField||Vl(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:$l(e),emailField:Bl(e),usernameField:Vl(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const Wl=new Map;class Hl{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,r=Wl.get(t);if(r&&Date.now()-r.timestamp<3e5)return r.users;let n=await jl.fetchUsers(e,a,"all");return 0===n.length&&(n=await jl.fetchUsers(e,a,"active")),Wl.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(!yl.areAllTokensValid())return e;const t=yl.extractTokenData();if(!t)return e;const{alias:r,companyId:n}=t;if(!r||!n)return e;const o=ql(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 _l.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const Gl=["responsible_name"],Kl=e=>Gl.includes(e);function Yl(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(!yl.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Il().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||Kl(a)||(n=n.order(a,{ascending:"asc"===t})),{query:n,isForeignKey:s}},m=async(e,a,t,n,o)=>{const i=ql(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),s=a.includes(".");if(Kl(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 Hl.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 Hl.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=ql(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=Xo(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={...Xo(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}const Ql={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},Jl=class{static async initialize(){try{const e=rr();if(e){if(yl.checkProjectMismatch())return{...Ql}}if(!yl.hasAllTokens()||!yl.areAllTokensValid())return yl.clearExpiredTokens(),{...Ql};const a=yl.getAccessToken(),t=yl.getIdToken();yl.clearManualLogout();const r=this.extractUserFromIdToken(t,a),n=this.extractCompaniesFromIdToken(t),o=e?yl.extractTokenData():null,i=this.resolveAliasFromContext(n,a,o?.alias??null);if(e&&(!yl.isSupabaseTokenValid()&&i&&await Ll.attemptRegeneration(),!yl.isSupabaseTokenValid()))return{...Ql};let s=null;if(i){const e=yl.getCompanyId(i),a=n.find(e=>e.alias===i);a&&(s={id:e||a.id,name:a.name,alias:a.alias})}const l=o?.placeId??null,d=o?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:i,companies:n,selectedUnit:s,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:d,activePlaceId:l,activePlaceName:d}}catch(e){return{...Ql}}}static async loginDev(){if(!rr())return this.loginProd(),!0;try{const e=Il(),{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==";yl.setOAuthState(e);const a=yl.generateOAuthNonce();yl.setOAuthNonce(a);const t=`${window.location.origin}/callback`,r=new URL(nr.oauth.authUrl);r.searchParams.set("client_id",nr.oauth.clientId),r.searchParams.set("response_type",nr.oauth.responseType),r.searchParams.set("scope",nr.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=yl.getAccessToken();e!==r&&yl.clearAll()}const i=rr();if(yl.hasAllTokens()){if(i){yl.getValidSupabaseToken()||await Ll.attemptRegeneration(!0)}return!0}const s=r,l=n;if(!s||!l)throw new Error("Tokens não encontrados na URL de callback");yl.setAccessToken(s),yl.setIdToken(l),yl.clearManualLogout();const d=this.extractCompaniesFromIdToken(l),c=this.resolveAliasFromContext(d,s,null);if(!c)throw new Error("Nenhuma empresa encontrada nos tokens");if(yl.setSelectedAlias(c),i){if(!await Ll.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return yl.clearOAuthState(),yl.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){const e=yl.getIdToken();yl.clearAll(),yl.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}const a=`${window.location.origin}/login`;if(e)try{const t=new URL(nr.oauth.logoutUrl);return t.searchParams.set("id_token_hint",e),t.searchParams.set("post_logout_redirect_uri",a),t.searchParams.set("client_id",nr.oauth.clientId),void(window.location.href=t.toString())}catch{}window.location.href="/login"}static decodeToken(e){return ul.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=[];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()})}}});const r=new Map;for(const o of t){if(!o.alias)continue;const e=r.get(o.alias);(!e||!e.id&&o.id)&&r.set(o.alias,o)}const n=Array.from(r.values());t.length,n.length;return n.length,n}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const a=e.split(".");if(a.length<3)return null;const t=a[0];return"www"===t||"admin"===t?null:a.length>=4?a[1]:t}static resolveAliasFromContext(e,a,t){const r=a=>!!a&&e.some(e=>e.alias===a),n=this.getSubdomainAlias();if(r(n))return n;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(t))return t;const o=yl.getSelectedAlias();if(r(o))return o;const i=this.extractAliasFromAccessToken(a);return r(i)?i:e[0]?.alias||null}};Ll.setLogoutCallback(()=>{Jl.logout()});let Xl=Jl;const Zl=e=>e?.placeId||null,ed=e=>e?.placeName||null,ad=d(void 0),td=({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=ja()}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=yl.getAccessToken();if(!o)return;const i=rr();let s=null;if(i){const t=await Ml.generateToken(o,e.alias,void 0,!0);if(c.current!==a)return;if(!t)return;yl.setSupabaseToken(t),s=yl.extractTokenData()}yl.setSelectedAlias(e.alias);const l=s?.alias||e.alias,d=s?.companyId||yl.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 jl.fetchActiveUsersMap(l,d);if(c.current!==a)return;const r=e.get(t.user.id);if(r){const e=(e=>({placeId:Zl(e),placeName:ed(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()=>{tl("AuthContext.processCallback");const e=await nl(0,()=>Xl.processCallback());if(e){const e=await nl(0,()=>Xl.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 Xl.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(yl.areAllTokensValid()){if(rr()&&!yl.isSupabaseTokenValid())try{await Ll.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 Xl.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&&(Fl.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(ad.Provider,{value:N,children:e})},rd=()=>{const e=c(ad);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function nd({queryKey:e,service:a,entityName:t,searchFields:r,additionalFilters:n={},onSuccess:o}){const[d,c]=Wa(),u=ja(),{alias:m,userId:p,isAuthenticated:h}=rd(),{t:f}=La(),g=l(a=>{const t=`${e}_${a}`,r=d.get(t);return r||(d.get(a)||"")},[d,e]),v=g("search"),b=g("sortField")||or.sorting.defaultField,x=g("sortDirection")||or.sorting.defaultDirection,y=parseInt(g("page")||"1"),w=parseInt(g("limit")||String(or.pagination.defaultPageSize)),N=v,_=s(()=>({search:N,sortField:b,sortDirection:x,page:y,limit:w,...n}),[N,b,x,y,w,n]),C=l(()=>a.getAll(_),[a,_]),S=$a({queryKey:[e,m,p,_],queryFn:C,enabled:!!m&&h});if(!S)throw new Error(`useCrud: Query initialization failed for "${t}". Ensure QueryClientProvider is configured in your app root.`);const A=Ba({mutationFn:a.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(hr.success.created(t)),o?.()},onError:e=>{k.error(`${hr.error.create(t)}: ${e.message}`)}}),E=Ba({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(hr.success.updated(t)),o?.()},onError:e=>{k.error(`${hr.error.update(t)}: ${e.message}`)}}),P=Ba({mutationFn:a.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(hr.success.deleted(t))},onError:e=>{k.error(`${hr.error.delete(t)}: ${e.message}`)}}),D=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=>{D({search:e,page:1})},[D]),I=l(e=>{D({sortField:e,sortDirection:b===e&&"asc"===x?"desc":"asc",page:1})},[b,x,D]),M=l(e=>{D({page:e})},[D]),R=l(e=>{D({limit:e,page:1})},[D]),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([]),U=l(e=>{F(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),O=l(()=>{const e=S?.data?.data.map(e=>e.id)||[];F(a=>a.length===e.length?[]:e)},[S?.data?.data]),j=l(()=>{F([])},[]),$=s(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&L.length===e.length},[L,S?.data?.data]),B=Ba({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,r)=>{u.invalidateQueries({queryKey:[e]}),k.success(f("bulk_delete_success",`${r.length} ${t}(s) deletado(s) com sucesso`)),j()},onError:e=>{k.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||or.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:P?.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:P.mutate,save:V,handleSearch:T,handleSort:I,handlePageChange:M,handleItemsPerPageChange:R,clearFilters:z,refetch:S.refetch,selectedIds:L,selectItem:U,selectAll:O,clearSelection:j,isAllSelected:$,bulkDelete:e=>B.mutateAsync(e),isBulkDeleting:B.isPending}}function od(e){const a=Yl({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)=>nd({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:r})}}function id(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 sd(e=768){return id(`(max-width: ${e-1}px)`)}const ld=n.forwardRef(({className:e,...t},r)=>a("table",{ref:r,className:Jo("w-full caption-bottom text-[13px] table-fixed",e),...t}));ld.displayName="Table";const dd=n.forwardRef(({className:e,...t},r)=>a("thead",{ref:r,className:Jo("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));dd.displayName="TableHeader";const cd=n.forwardRef(({className:e,...t},r)=>a("tbody",{ref:r,className:Jo("[&_tr:last-child]:border-0",e),...t}));cd.displayName="TableBody";const ud=n.forwardRef(({className:e,...t},r)=>a("tfoot",{ref:r,className:Jo("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));ud.displayName="TableFooter";const md=n.forwardRef(({className:e,...t},r)=>a("tr",{ref:r,className:Jo("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));md.displayName="TableRow";const pd=n.forwardRef(({className:e,...t},r)=>a("th",{ref:r,className:Jo("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}));pd.displayName="TableHead";const hd=n.forwardRef(({className:e,...t},r)=>a("td",{ref:r,className:Jo("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));hd.displayName="TableCell";const fd=n.forwardRef(({className:e,...t},r)=>a("caption",{ref:r,className:Jo("mt-4 text-sm text-muted-foreground",e),...t}));function gd({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(qs,{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(qs,{className:"h-4 w-20"},t))})},t))})]})})}function vd({count:e=3}){return a("div",{className:"space-y-4",children:Array.from({length:e}).map((e,r)=>t(si,{children:[t(li,{children:[a(qs,{className:"h-4 w-3/4"}),a(qs,{className:"h-3 w-1/2"})]}),a(ui,{children:t("div",{className:"space-y-2",children:[a(qs,{className:"h-3 w-full"}),a(qs,{className:"h-3 w-2/3"})]})})]},r))})}function bd({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(qs,{className:"h-4 w-24"}),a(qs,{className:"h-10 w-full"})]},r)),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a(qs,{className:"h-10 w-20"}),a(qs,{className:"h-10 w-20"})]})]})}function xd(){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(qs,{className:"h-8 w-8 rounded-full"}),a(qs,{className:"h-6 w-32"})]}),t("div",{className:"flex items-center space-x-2",children:[a(qs,{className:"h-8 w-8"}),a(qs,{className:"h-8 w-24"})]})]})}function yd(){return a("div",{className:"w-64 border-r bg-muted/10",children:t("div",{className:"p-4",children:[a(qs,{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(qs,{className:"h-4 w-4"}),a(qs,{className:"h-4 w-20"})]},r))})]})})}fd.displayName="TableCaption";const wd={default:V,search:B,error:$};function Nd({icon:e,title:r,description:n,action:o,className:i,variant:s="default"}){const{t:l}=La(),d=!!e,c=wd[s];return t("div",{className:Jo("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(ti,{onClick:o.onClick,variant:"outline",children:o.label})]})}function _d({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(As,{delayDuration:300,children:t(Es,{children:[a(Ps,{asChild:!0,children:l}),a(Ds,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):l}const Cd=n.forwardRef(({direction:e,onMouseDown:t,isDragging:r,className:n},o)=>{const i="horizontal"===e;return a("div",{ref:o,onMouseDown:t,className:Jo("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:Jo("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",i?"h-6 w-0.5":"w-6 h-0.5")})})});Cd.displayName="TableResizeHandle";const kd=Ja.Root,Sd=Ja.Trigger,Ad=Ja.Group,Ed=Ja.Portal,Pd=Ja.Sub,Dd=Ja.RadioGroup,Td=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ja.SubTrigger,{ref:i,className:Jo("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"})]}));Td.displayName=Ja.SubTrigger.displayName;const Id=n.forwardRef(({className:e,...t},r)=>a(Ja.SubContent,{ref:r,className:Jo("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}));Id.displayName=Ja.SubContent.displayName;const Md=n.forwardRef(({className:e,...t},r)=>a(Ja.Portal,{children:a(Ja.Content,{ref:r,className:Jo("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})}));Md.displayName=Ja.Content.displayName;const Rd=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ja.Item,{ref:n,className:Jo("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=Ja.Item.displayName;const zd=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ja.CheckboxItem,{ref:i,className:Jo("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(Ja.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));zd.displayName=Ja.CheckboxItem.displayName;const Ld=n.forwardRef(({className:e,children:r,...n},o)=>t(Ja.RadioItem,{ref:o,className:Jo("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(Ja.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));Ld.displayName=Ja.RadioItem.displayName;const Fd=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ja.Label,{ref:n,className:Jo("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));Fd.displayName=Ja.Label.displayName;const Ud=n.forwardRef(({className:e,...t},r)=>a(Ja.Separator,{ref:r,className:Jo("-mx-1 my-1 h-px bg-border",e),...t}));Ud.displayName=Ja.Separator.displayName;const Od=({className:e,...t})=>a("span",{className:Jo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Od.displayName="ContextMenuShortcut";const jd=({onEdit:e,onDelete:n,onToggleStatus:o,isActive:i=!0,canDelete:s=!0,customActions:l=[],renderAs:d})=>{const{t:c}=La(),u=[];if(e){const a={icon:q,label:c("edit"),onClick:e};u.push(a)}if(l.forEach(e=>{u.push(e)}),o){const e={icon:i?W:H,label:i?"Inativar":"Ativar",onClick:o};u.push(e)}if(s&&n){const e={icon:G,label:c("ap_delete"),onClick:n,destructive:!0};u.push(e)}const m="dropdown"===d?ws:Rd;return a(r,{children:u.map((e,r)=>t(m,{onClick:e.onClick,className:Jo("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))})},$d=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>t(ms,{children:[a(ps,{asChild:!0,children:a(ti,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a(E,{size:12})})}),a(ys,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a(jd,{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"})})]}),Bd=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>{const{t:l}=La();return a(As,{delayDuration:200,children:t("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a(K,{size:14})})}),a(Ds,{children:l("edit")})]}),s.map((e,r)=>{const n=e.icon;return t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a(n,{size:14})})}),a(Ds,{children:e.label})]},r)}),o&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),o()},children:a(i?Y:Q,{size:14})})}),a(Ds,{children:i?"Inativar":"Ativar"})]}),r&&n&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:Jo("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),r()},children:a(G,{size:14})})}),a(Ds,{children:l("ap_delete")})]})]})})},Vd=150;function qd({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??Vd,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??Vd,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]??Vd)},[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??Vd,e),{});o(r),a&&localStorage.removeItem(a),t?.(r)},[e,a,t]);return{columnWidths:n,isDragging:s,activeColumn:c,handleMouseDown:g,resetWidths:v}}const Wd=b("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"}}),Hd=n.forwardRef(({className:e,variant:t,size:r,...n},o)=>a(Za.Root,{ref:o,className:Jo(Wd({variant:t,size:r,className:e})),...n}));Hd.displayName=Za.Root.displayName;const Gd=n.createContext({size:"default",variant:"default"}),Kd=n.forwardRef(({className:e,variant:t,size:r,children:n,...o},i)=>a(Xa.Root,{ref:i,className:Jo("flex items-center justify-center gap-1",e),...o,children:a(Gd.Provider,{value:{variant:t,size:r},children:n})}));Kd.displayName=Xa.Root.displayName;const Yd=n.forwardRef(({className:e,children:t,variant:r,size:o,...i},s)=>{const l=n.useContext(Gd);return a(Xa.Item,{ref:s,className:Jo(Wd({variant:l.variant||r,size:l.size||o}),e),...i,children:t})});Yd.displayName=Xa.Item.displayName;const Qd=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}=La(),_=c>0,C=e&&n||h.length>0,k=f||b||y,S=o&&s;return C||S||k||d&&_?t("div",{className:Jo("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(ti,{onClick:e,children:[a(J,{size:16,className:"mr-2"}),r||"Novo"]}),h.map((e,r)=>{const n=e.icon;return t(ti,{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(ss,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),t(As,{delayDuration:200,children:[u.length>0?u.map((e,r)=>{const n=e.icon,o=e.disabled;return t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:Jo("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(Ds,{children:e.label})]},r)}):t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a(G,{size:16})})}),a(Ds,{children:N("ap_delete")})]}),t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a(P,{size:16})})}),a(Ds,{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(ni,{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(Kd,{type:"single",value:g,onValueChange:e=>e&&v(e),size:"sm",children:x.map(e=>{const t=(e=>{switch(e){case"table":return ee;case"list":return Z;case"grid":return X}})(e);return a(Yd,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a(t,{className:"h-4 w-4"})},e)})}),y]})]}):null}),Jd=p(({checked:e,onCheckedChange:t})=>a(ns,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function Xd(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 Zd({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=Xd(a);return e?.hiddenColumns??o}),[u,p]=i(()=>{if(!t||!a)return n;const e=Xd(a)?.columnOrder;return e&&e.length>0?e:n}),[h,f]=i(()=>t&&a?Xd(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,P=l(e=>{f(e?[e]:[]),v(new Set)},[]),D=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:D,allColumns:e,isColumnHidden:b,toggleColumn:x,showAllColumns:y,resetColumns:w,columnOrder:u,reorderColumns:N,groupByColumn:E,setGroupByColumn:P,groupByColumns:h,setGroupByColumns:C,addGroupByColumn:k,removeGroupByColumn:S,reorderGroupByColumns:A,getGroupedData:T,collapsedGroups:g,toggleGroupCollapse:_}}function ec({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 ac({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}=La(),[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(Is,{children:[a(Ms,{asChild:!0,children:a(ti,{variant:"outline",size:"icon",className:"h-8 w-8",children:a(ae,{size:16})})}),t(Rs,{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(As,{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:Jo("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(te,{size:14,className:"text-muted-foreground shrink-0"}),a(ns,{checked:!s,onCheckedChange:()=>u&&o(i),disabled:!u,className:"shrink-0"}),a("span",{className:Jo("flex-1 truncate",s&&"text-muted-foreground"),children:e.header}),f&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:Jo("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(re,{size:14})})}),a(Ds,{children:g(N?"remove_grouping":"group_by_column")})]})]},i)})})}),t("div",{className:"border-t px-3 py-2 space-y-1",children:[a(ti,{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(ti,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:f,children:"Redefinir padrão"})]})]})]})}function tc({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:Jo("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(re,{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(ss,{variant:"secondary",className:Jo("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(P,{size:12})})]})]},e)}):a("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const rc=({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:$=!1,enableExpandableRows:B=!1,renderExpandedContent:V,expandedRowIds:q,onToggleExpand:W,defaultExpandAll:H=!1,hideActionsColumn:G=!1})=>{const{t:K}=La(),{setSearchVisible:Y}=rd(),Q=sd(),[J,X]=i(()=>H&&B?new Set(r.entities.map(e=>e.id)):new Set),Z=void 0!==q,ee=Z?new Set(q):J,ae=l(e=>{Z&&W?W(e):X(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 re=Zd({columns:n,storageKey:U,enabled:F,defaultHiddenColumns:j}),ie=ec({enabled:F,onReorder:re.reorderColumns}),se=F?re.visibleColumns:n,{columnWidths:le,isDragging:de,activeColumn:ce,handleMouseDown:ue}=qd({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(hd,{className:"text-center",children:h?h(e):"inline"===v?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a(Bd,{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($d,{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(Md,{className:"w-[160px]",children:a(jd,{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(ac,{columns:n,columnOrder:re.columnOrder,isColumnHidden:re.isColumnHidden,toggleColumn:re.toggleColumn,showAllColumns:re.showAllColumns,resetColumns:re.resetColumns,reorderColumns:re.reorderColumns,groupByColumn:$?re.groupByColumn:void 0,setGroupByColumn:$?re.setGroupByColumn:void 0,groupByColumns:$?re.groupByColumns:void 0,addGroupByColumn:$?re.addGroupByColumn:void 0,removeGroupByColumn:$?re.removeGroupByColumn:void 0}):void 0;if(Q)return r.isLoading?a(vd,{count:3}):0===r.entities.length?a(Nd,{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(Qd,{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(kd,{children:[a(Sd,{asChild:!0,children:a(si,{className:Jo("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(ui,{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(Jd,{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($d,{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=$&&re.groupByColumns.length>0?re.getGroupedData(r.entities):null,ye=null!==xe,we=(B?1:0)+(g?1:0)+se.length+(G?0:1),Ne=e=>{const n=B&&ee.has(e.id);return t(o.Fragment,{children:[t(kd,{children:[a(Sd,{asChild:!0,children:t(md,{className:Jo("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:[B&&a(hd,{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(hd,{onClick:e=>e.stopPropagation(),children:a(Jd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),se.map(t=>a(hd,{className:t.className,children:a(_d,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!G&&ge(e)]})}),ve(e)]}),n&&V&&a(md,{className:"bg-muted/30 hover:bg-muted/30",children:a(hd,{colSpan:we,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:V(e)})})})]},e.id)},_e=(e,r)=>{const{t:n}=La();return e.map(e=>{const n=re.collapsedGroups.has(e.groupKey),i=16*e.level,s=Math.max(30,70-15*e.level);return t(o.Fragment,{children:[a(md,{className:Jo("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${s}%)`},onClick:()=>re.toggleGroupCollapse(e.groupKey),children:a(hd,{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(Qd,{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(gd,{rows:5,columns:se.length}):t("div",{className:"flex flex-col h-full overflow-hidden",children:[$&&a(tc,{columns:n,groupByColumns:re.groupByColumns,addGroupByColumn:re.addGroupByColumn,removeGroupByColumn:re.removeGroupByColumn,reorderGroupByColumns:re.reorderGroupByColumns}),a("div",{className:"flex-1 overflow-auto",children:t(ld,{className:"table-fixed w-full",children:[t("colgroup",{children:[B&&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(dd,{children:t(md,{children:[B&&a(pd,{className:"w-[40px]"}),g&&a(pd,{className:"w-[50px]",children:a(Jd,{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(pd,{className:Jo(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(ne,{size:14,className:"ml-1"}):a(oe,{size:14,className:"ml-1"}))]}),o&&a(Cd,{direction:"horizontal",onMouseDown:a=>ue(String(e.key),a),isDragging:i})]},String(e.key));var c}),!G&&a(pd,{className:"w-[50px] text-center",children:be||e.t("actions")})]})}),a(cd,{children:0===r.entities.length?a(md,{children:a(hd,{colSpan:we,className:"h-32",children:a(Nd,{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 nc(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 oc=[{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}],ic=[10,22,35,45,55,68,78,87,94].flatMap(e=>oc.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))),sc=({value:e="#3b82f6",onChange:r,label:n,customColorLabel:i,presetColorsLabel:s,showHexValue:l=!0})=>{const{t:d}=La(),c=i??d("custom_color"),u=s??d("preset_colors"),[m,p]=o.useState(!1),h=o.useRef([]),f=oc.length,g=o.useMemo(()=>{const a=ic.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(ic.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(ii,{children:n}),t(Is,{open:m,onOpenChange:p,children:[a(Ms,{asChild:!0,children:t(ti,{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(Rs,{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(ii,{children:u}),a("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${oc.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(ic.length-1);break;case"Enter":e.preventDefault(),y(ic[v]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:ic.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(ii,{htmlFor:"color-input",children:c}),a(ni,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},lc=n.forwardRef(({className:e,children:r,...n},o)=>t(et.Root,{ref:o,className:Jo("relative overflow-hidden",e),...n,children:[a(et.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),a(dc,{}),a(et.Corner,{})]}));lc.displayName=et.Root.displayName;const dc=n.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a(et.ScrollAreaScrollbar,{ref:n,orientation:t,className:Jo("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(et.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));dc.displayName=et.ScrollAreaScrollbar.displayName;const cc=[{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 uc({name:e,filled:t,className:r}){return a("span",{className:`material-symbols-outlined ${r??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const mc=({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,cc.find(e=>e.name===g)):null;var g;const v=s(()=>{if(!e)return 0;const a=cc.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(cc.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(cc.length-1);break;case"Enter":e.preventDefault(),w(cc[b]?.name??null);break;case"Tab":e.preventDefault(),p(!1)}},[b,y,w]);return t("div",{className:"space-y-2",children:[n&&a(ii,{children:n}),t(Is,{open:c,onOpenChange:p,children:[a(Ms,{asChild:!0,children:t(ti,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:N,children:[f?a(uc,{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(Rs,{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(lc,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a("div",{className:"grid grid-cols-10 gap-1",onKeyDown:_,role:"grid",children:cc.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(uc,{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})]})})]})]})},pc=n.forwardRef(({className:e,...t},r)=>a(at.Root,{className:Jo("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(at.Thumb,{className:Jo("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")})}));pc.displayName=at.Root.displayName;const hc=(e={})=>{const{user:a,alias:t}=rd(),{enabled:r=!0,status:n="active"}=e;return $a({queryKey:["qualiex-users",t,n],queryFn:()=>jl.getUsers(t,n),enabled:r&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},fc=({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}=La(),{data:k=[],isLoading:S,error:A}=hc({enabled:g}),[E,P]=i(new Map),D=s(()=>t?Array.isArray(t)?t.filter(Boolean):[t].filter(Boolean):[],[t]),T=s(()=>{if(0===D.length||0===k.length)return"";const e=new Set(k.map(e=>e.userId||e.id||""));return D.filter(a=>a&&!e.has(a)&&!E.has(a)).sort().join(",")},[D,k,E]);m(()=>{if(!T)return;const e=T.split(",");let a=!1;const t=yl.extractTokenData();return t?.alias&&t?.companyId?(jl.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||P(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===D.length)return I;const a=new Set(I.map(e=>e.userId||e.id||"")),t=D.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,D,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(Gs,{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 gc({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}=nc(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 P=A.find(e=>e.id===E),D=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?Jo("space-y-2 w-full",e.wrapperClassName):Jo("space-y-2",e.className,e.wrapperClassName);return t("div",{className:s,children:[e.label,a("div",{className:i,children:e.fields?.map(e=>D(e))})]},e.name);case"user-select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(fc,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(os,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Ki,{value:String(n),onValueChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a(Ji,{className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a(Qi,{placeholder:e.placeholder})}),a(es,{children:e.options?.map(e=>a(ts,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Gs,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ni,{id:e.name,type:"date",value:String(n),onChange:a=>k(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Jo("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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ni,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(sc,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(mc,{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(ii,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ni,{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(ns,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),t(ii,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(pc,{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(ii,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ni,{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(!P)return null;if(P.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(P.component){const e=P.component;return a(e,{formData:_,updateField:k,errors:C,users:f,disabled:P.disabled})}return a("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:P.fields.map(D)})},[P,_,k,C,f,D]),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(ti,{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(ti,{type:"button",variant:"outline",onClick:c,children:"Cancelar"}),a(ti,{type:"submit",disabled:h,children:p||"Salvar"})]})]})})]});return a(ki,{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(Ii,{showSeparator:!0,children:[a(zi,{children:e}),a(Li,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),I]})})}function vc({currentPage:e,totalPages:n,totalItems:o,itemsPerPage:i,onPageChange:s,onItemsPerPageChange:l,variant:d="full"}){const{t:c}=La();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(Ki,{value:String(i),onValueChange:e=>l(Number(e)),children:[a(Ji,{className:"h-8 w-[70px]",children:a(Qi,{})}),t(es,{children:[a(ts,{value:"10",children:"10"}),a(ts,{value:"25",children:"25"}),a(ts,{value:"50",children:"50"}),a(ts,{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(ti,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:1===e,className:"h-8 w-8 p-0",children:a(ie,{size:16})}),a(ti,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a(se,{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(ti,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:e===n,className:"h-8 w-8 p-0",children:a(O,{size:16})}),a(ti,{variant:"outline",size:"sm",onClick:()=>s(n),disabled:e===n,className:"h-8 w-8 p-0",children:a(le,{size:16})})]})]})}function bc({manager:e}){return a(vc,{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 xc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},yc={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},wc={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Nc({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:o="start",wrap:i=!1,className:s}){return a("div",{className:Jo("flex","column"===t?"flex-col":"flex-row",xc[r],yc[n],wc[o],i&&"flex-wrap",s),children:e})}function _c({manager:e,filters:n,inline:o=!1}){const{t:i}=La(),{isSearchVisible:s}=rd(),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(ni,{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(Ki,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a(Ji,{className:"w-[180px]",children:a(Qi,{placeholder:e.placeholder})}),a(es,{children:e.options.map(e=>a(ts,{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(ti,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a(P,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return o?a("div",{className:"flex items-center gap-2",children:d}):a(Nc,{direction:"column",gap:"md",className:"mb-6",children:a(Nc,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:d})})}function Cc({manager:e,config:r,formSections:n,onSave:o,onToggleStatus:s,defaultSort:l}){e&&e.queryKey;const{setSearchVisible:d}=rd(),[c,u]=Wa(),[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(Qd,{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(_c,{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(rc,{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(bc,{manager:e})}),!r.useCustomRouting&&!r.onNew&&n.length>0&&a(gc,{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(ki,{open:v.isOpen,onOpenChange:_,children:t(Ti,{size:"sm",variant:"destructive",children:[a(Ii,{showSeparator:!0,children:a(zi,{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(Ri,{children:[a(ti,{variant:"outline",onClick:_,children:"Cancelar"}),a(ti,{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(ki,{open:x.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),children:t(Ti,{size:"sm",variant:"destructive",children:[a(Ii,{showSeparator:!0,children:a(zi,{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(Ri,{children:[a(ti,{variant:"outline",onClick:()=>y({isOpen:!1,count:0}),children:"Cancelar"}),a(ti,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),y({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function kc(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(Cc,{manager:l,config:d,formSections:n.formSections,onSave:o,onToggleStatus:s,defaultSort:n.defaultSort})}}function Sc(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 Ac(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:Pc(e),label:Pc(e),...Ec(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 Ec(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 Pc(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const Dc=({children:n})=>{const{isAuthenticated:i,isLoading:s}=rd();if(o.useEffect(()=>{if(s)return;if(i)return;if(yl.isManualLogout())return void("/login"!==window.location.pathname&&(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=lr(),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 Xl.loginDev():Xl.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(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:a(di,{className:"text-xl font-semibold",children:"Carregando..."})}),t(ui,{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(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:a(di,{className:"text-xl font-semibold",children:"Processando..."})}),t(ui,{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(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:a(di,{className:"text-xl font-semibold",children:"Iniciando..."})}),t(ui,{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:lr()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a(r,{children:n})};function Tc(e={}){const{paramName:a="alias"}=e,t=Ha(),{alias:r,companies:n}=rd(),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 Ic({children:e,paramName:n="alias"}){const o=Ga(),s=Ka(),d=Ha(),{alias:c,isAuthenticated:p,isLoading:h,switchUnit:f}=rd(),{urlAlias:g,isAliasMismatch:v,isValidAlias:b,isMissing:x,matchedCompany:y}=Tc({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(ds,{size:"lg"}),a("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a(r,{children:e})}function Mc(){const{alias:e}=rd(),{pathname:t,search:r,hash:n}=Ka();return e?a(Ya,{to:`/${e}${t}${r}${n}`,replace:!0}):null}const Rc=b("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"}}),zc={info:ue,warning:ue,danger:ce,success:de},Lc=n.forwardRef(({className:e,variant:r="info",showIcon:n=!0,children:o,...i},s)=>{const l=zc[r||"info"];return t("div",{ref:s,role:"alert",className:Jo(Rc({variant:r}),e),...i,children:[n&&a(l,{className:"h-4 w-4"}),o]})});Lc.displayName="Alert";const Fc=n.forwardRef(({className:e,...t},r)=>a("h5",{ref:r,className:Jo("mb-1 font-medium leading-none tracking-tight",e),...t}));Fc.displayName="AlertTitle";const Uc=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("text-sm [&_p]:leading-relaxed",e),...t}));Uc.displayName="AlertDescription";const Oc=()=>{const{processCallback:e}=rd(),n=Ga(),[o,s]=i(null),[l,d]=i(!1);m(()=>{let a=!1;if(ll()){al.clear(),function(){if(el&&"undefined"!=typeof PerformanceObserver&&!il)try{il=new PerformanceObserver(e=>{for(const a of e.getEntries())a.duration}),il.observe({type:"longtask",buffered:!0})}catch{}}(),rl("callback:start");try{const e=yl.getAccessToken(),a=yl.getIdToken();if(e){sl(0,e,ul.parseJwtPayload(e))}if(a){sl(0,a,ul.parseJwtPayload(a))}}catch{}}const t=ll()?window.setTimeout(()=>{a||ol()},15e3):0;return(async()=>{try{const t=await e();if(a=!0,ll()&&(rl("callback:processCallback:end"),function(e,a,t){if(!el)return null;try{return performance.measure(`auth:${e}`,`auth:${a}`,`auth:${t}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),ol()),t){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(t){a=!0,ll()&&ol(),localStorage.removeItem("auth_return_url"),s(t?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{t&&window.clearTimeout(t),function(){if(il){try{il.disconnect()}catch{}il=null}}()}},[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(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:t(di,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a($,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t(ui,{className:"space-y-4",children:[a(Lc,{variant:"danger",children:a(Uc,{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(ti,{onClick:c,disabled:l,className:"flex-1",children:t(r,l?{children:[a(ds,{size:"sm",className:"mr-2"}),"Tentando..."]}:{children:[a(me,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a(ti,{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(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:a(di,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t(ui,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(ds,{size:"lg"})}),a("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},jc=()=>{const{t:e}=La();return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(si,{className:"w-full max-w-md",children:[a(li,{className:"text-center",children:a(di,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t(ui,{className:"text-center space-y-4",children:[a("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a(ti,{onClick:async()=>{lr()?await Xl.loginDev():Xl.loginProd()},className:"w-full",size:"lg",children:lr()?e("dev_login"):e("login_with_qualiex")})]})]})})},$c=n.forwardRef(({className:e,...t},r)=>a(tt.Root,{ref:r,className:Jo("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));$c.displayName=tt.Root.displayName;const Bc=n.forwardRef(({className:e,...t},r)=>a(tt.Image,{ref:r,className:Jo("aspect-square h-full w-full",e),...t}));Bc.displayName=tt.Image.displayName;const Vc=n.forwardRef(({className:e,...t},r)=>a(tt.Fallback,{ref:r,className:Jo("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));function qc(){return cr()||"https://common-v4-api.qualiex.com"}function Wc(){const e=qc().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://ident-api${e[1]||""}.${e[2]}`}return"https://ident-api.qualiex.com"}function Hc(){const e=qc().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://login-api${e[1]||""}.${e[2]}`}return"https://login-api.qualiex.com"}function Gc(e){const a=yl.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function Kc(e,a,t){const r=async()=>{const r=await fetch(e,{...t,headers:{...Gc(a),...t?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(n){if(await Ol.handleApiError(n))return await r();throw n}}async function Yc(e){const a=yl.getAccessToken(),t=yl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const a=ul.parseJwtPayload(e),t="string"==typeof a?.subNewId?a.subNewId.trim():"";if(!t)throw new Error("NewId do usuário não encontrado no id-token.");return t}(t),n=yl.getSelectedAlias()?.trim()||yl.extractTokenData()?.alias||"",o=`${Hc()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,i=async()=>{const r=yl.getAccessToken()||a,i=yl.getIdToken()||t,s=new FormData;s.append(e.name,e,e.name);const l=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":i,Accept:"application/json, text/plain, */*",...n?{"un-alias":n}:{},AppGroupId:"1"},body:s});if(!l.ok){const e=new Error(`Upload falhou: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await i()}catch(s){if(await Ol.handleApiError(s))try{return void await i()}catch(l){throw _l.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw s}}Vc.displayName=tt.Fallback.displayName;const Qc={"en-US":1,"pt-BR":2,"es-ES":3};function Jc(e,a){const t=e?.trim();if(t)return t;const r=ul.parseJwtPayload(a),n="string"==typeof r?.subNewId?r.subNewId.trim():"";if(n)return n;throw new Error("Identificador do usuário não encontrado.")}function Xc(e){const a=yl.getSelectedAlias()?.trim();if(a)return a;const t=yl.getSupabaseToken(),r=t?ul.parseJwtPayload(t):null,n="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(n)return n;const o=ul.parseJwtPayload(e),i="string"==typeof o?.default?o.default.trim():"string"==typeof o?.alias?o.alias.trim():"string"==typeof o?.user_alias?o.user_alias.trim():"";if(i)return i;for(const s in o||{}){if(!/^co\d+$/.test(s))continue;const e=o?.[s];if("string"!=typeof e)continue;const[a]=e.split(";");if(a?.trim())return a.trim()}}async function Zc(e){const a=yl.getAccessToken(),t=yl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=Jc(e.newId,t),n=Xc(t),o={};e.name&&e.name.trim()&&(o.Name=e.name.trim()),e.email&&e.email.trim()&&(o.Email=e.email.trim());const i=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e?e:null:Qc[e]??null}(e.language);void 0!==i&&(o.LanguageId=i);const s=`${Hc()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=yl.getAccessToken()||a,r=yl.getIdToken()||t,i=await fetch(s,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...n?{"un-alias":n}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=new Error(`Falha ao atualizar perfil: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}};try{await l()}catch(d){if(await Ol.handleApiError(d))return void await l();throw d}}const eu={1:"en-US",2:"pt-BR",3:"es-ES"};function au(e,...a){for(const t of a){const a=e[t];if("string"==typeof a&&a.trim())return a}return null}async function tu(e){const a=yl.getAccessToken(),t=yl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=Jc(e,t),n=Xc(t),o=`${Hc()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,i=async()=>{const e=yl.getAccessToken()||a,i=yl.getIdToken()||t,s=await fetch(o,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":i,...n?{"un-alias":n}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*"}});if(404===s.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!s.ok){const e=new Error(`Falha ao obter perfil: ${s.status} ${s.statusText}`);throw e.status=s.status,e.statusCode=s.status,e}const l=await s.json(),d=function(e,...a){for(const t of a){const a=e[t];if("number"==typeof a&&Number.isFinite(a))return a;if("string"==typeof a&&a.trim()&&!Number.isNaN(Number(a)))return Number(a)}return null}(l,"languageId","LanguageId"),c=1===d||2===d||3===d?d:null,u=au(l,"photoUrl","PhotoUrl");let m=null;if(u)if(/^https?:\/\//i.test(u))m=u;else{const e=u.replace(/^\/+/,""),a=e.includes("?")?"&":"?";m=`${Hc()}/api/${e}${a}size=96`}return{newId:r,name:au(l,"name","Name"),email:au(l,"email","Email"),languageId:c,language:c?eu[c]:null,photoUrl:m}};try{return await i()}catch(s){if(await Ol.handleApiError(s))return await i();throw s}}const ru=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],nu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ou=({open:e,onOpenChange:r,user:n,userPhotoUrl:o,userInitials:s})=>{const{t:l,i18n:d}=La(),c=u(null),[p,h]=i(null),[f,g]=i(null),[v,b]=i(d.language||"pt-BR"),[x,y]=i(n.name||""),[w,N]=i(n.email||""),[_,C]=i(!1),[S,A]=i(null);m(()=>{if(!e)return;y(n.name||""),N(n.email||""),b(d.language||"pt-BR"),A(null);let a=!1;return(async()=>{try{const e=await tu(n.id||void 0);if(a)return;e.name&&y(e.name),e.email&&N(e.email),e.language&&b(e.language),A(e.photoUrl)}catch{}})(),()=>{a=!0}},[e,n.id,n.name,n.email,d.language]);const E=p||S||o,P=e=>{_||(e||(h(null),g(null),b(d.language||"pt-BR"),y(n.name||""),N(n.email||"")),r(e))};return a(ki,{open:e,onOpenChange:P,children:t(Ti,{className:"sm:max-w-md",children:[a(Ii,{children:a(zi,{children:l("edit_profile","Editar Perfil")})}),t(Mi,{className:"space-y-6",children:[t("div",{className:"flex items-center gap-4",children:[t($c,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[E&&a(Bc,{src:E,alt:n.name||""}),a(Vc,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:s})]}),t("div",{children:[t(ti,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a(pe,{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);h(t),g(a)}})]})]}),t("div",{className:"space-y-2",children:[a(ii,{htmlFor:"profile-name",children:l("name","Nome")}),a(ni,{id:"profile-name",value:x,onChange:e=>y(e.target.value),maxLength:150,autoComplete:"name"})]}),t("div",{className:"space-y-2",children:[a(ii,{htmlFor:"profile-email",children:l("email","E-mail")}),a(ni,{id:"profile-email",type:"email",value:w,onChange:e=>N(e.target.value),maxLength:200,autoComplete:"email"})]}),t("div",{className:"space-y-2",children:[a(ii,{children:l("language","Idioma")}),t(Ki,{value:v,onValueChange:b,children:[a(Ji,{children:a(Qi,{})}),a(es,{children:ru.map(e=>a(ts,{value:e.value,children:e.label},e.value))})]})]})]}),t(Ri,{children:[a(ti,{variant:"outline",onClick:()=>P(!1),disabled:_,children:l("cancel","Cancelar")}),t(ti,{onClick:async()=>{if(x.trim())if(nu.test(w.trim())){C(!0);try{if(f)try{await Yc(f),window.dispatchEvent(new Event("user-photo-updated")),k.success("Foto atualizada com sucesso")}catch(e){const a=e instanceof Error?e.message:String(e);k.error("Falha ao atualizar foto"+(a?`: ${a}`:""))}if(x.trim()!==(n.name||"")||w.trim()!==(n.email||"")||v!==d.language)try{await Zc({newId:n.id||void 0,name:x.trim(),email:w.trim(),language:v}),k.success("Perfil atualizado com sucesso")}catch(e){const a=e instanceof Error?e.message:String(e);k.error(a||"Falha ao atualizar perfil")}v!==d.language&&d.changeLanguage(v),g(null),h(null),r(!1)}finally{C(!1)}}else k.error("Informe um e-mail válido.");else k.error("Informe o nome.")},disabled:_,children:[_&&a(M,{className:"mr-2 h-4 w-4 animate-spin"}),_?l("saving","Salvando..."):l("save","Salvar")]})]})]})})},iu=d(void 0);function su({children:e,actions:t}){const{t:r}=La(),[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(iu.Provider,{value:p,children:e})}function lu(){const e=c(iu);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}function du(e){const{setMetadata:a,clearMetadata:t}=lu(),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 cu(e){return{queryClient:e.queryClient||new Va({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}var uu={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",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_like:"Curtir",updates_dialog_do_not_show_again:"Não exibir novamente",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..."},mu={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",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_like:"Like",updates_dialog_do_not_show_again:"Do not show again",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..."},pu={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",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_like:"Me gusta",updates_dialog_do_not_show_again:"No mostrar de nuevo",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 hu="true"===import.meta.env.VITE_I18N_DEBUG_MODE;function fu(a,t){e.addResourceBundle(a,"app",t,!0,!0)}hu&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(Fa).init({resources:{"pt-BR":{core:uu},"en-US":{core:mu},"es-ES":{core:pu}},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:hu?["debugKeys"]:[]});const gu=d({moduleAlias:null,associationsBaseUrl:null});function vu({moduleAlias:e=null,associationsBaseUrl:t=null,children:r}){return a(gu.Provider,{value:{moduleAlias:e,associationsBaseUrl:t},children:r})}function bu(){return c(gu)}const xu={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},yu=6e5;function wu(e){const{moduleAlias:a,associationsBaseUrl:t}=bu(),{alias:r,user:n,isAuthenticated:o}=rd(),i=e??a,d=n?.id??null,c=o&&!!r&&!!d,{data:u=[],isLoading:m}=$a({queryKey:["qualiex-associations",d,r,t??null],queryFn:()=>jl.fetchUserAssociations(d,r,t?{baseUrl:t}:void 0),enabled:c,staleTime:yu,gcTime:12e5}),p=s(()=>r&&0!==u.length?u.find(e=>e.companyAlias===r)??null:null,[u,r]),h=l(e=>{if(!p)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=xu[e];return void 0!==a&&p.softwares.includes(a)})},[p]);return{hasAccess:s(()=>!i||h(i),[i,h]),isLoading:c&&m,role:s(()=>p?{id:p.roleId,name:p.roleName}:null,[p]),association:p,hasAccessTo:h}}const Nu={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES"};function _u(){const{association:a}=wu(),t=a?.language;return m(()=>{if(!t)return;const a=Nu[t];a&&e.language!==a&&e.changeLanguage(a)},[t]),null}const Cu=d(void 0),ku={locale:wo,timezone:_o,datetimeFormat:No},Su=async()=>{},Au=({children:e})=>a(Cu.Provider,{value:{...ku,setLocale:Su,setTimezone:Su,setDatetimeFormat:Su,isLoading:!1},children:e}),Eu=()=>{const e=c(Cu);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Pu=rt.Root,Du=rt.CollapsibleTrigger,Tu=rt.CollapsibleContent;var Iu=Object.defineProperty,Mu=(e,a,t)=>((e,a,t)=>a in e?Iu(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,a+"",t);class Ru extends h{constructor(a){super(a),Mu(this,"copyErrorDetails",()=>{const a=_l.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),k.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;_l.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const r=_l.getErrors().slice(0,2);return a("div",{className:"flex items-center justify-center min-h-screen p-4",children:t(si,{className:"w-full max-w-2xl",children:[t(li,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(ce,{className:"h-12 w-12 text-destructive"})}),a(di,{children:e.t("something_went_wrong")})]}),t(ui,{className:"space-y-4",children:[a("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t(Pu,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a(Du,{asChild:!0,children:t(ti,{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(Tu,{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(lc,{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(ti,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a(he,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a(ti,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const zu=nt.Root,Lu=n.forwardRef(({className:e,...t},r)=>a(nt.List,{ref:r,className:Jo("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Lu.displayName=nt.List.displayName;const Fu=n.forwardRef(({className:e,...t},r)=>a(nt.Trigger,{ref:r,className:Jo("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}));Fu.displayName=nt.Trigger.displayName;const Uu=n.forwardRef(({className:e,...t},r)=>a(nt.Content,{ref:r,className:Jo("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 Ou({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 ju({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"})]})}Uu.displayName=nt.Content.displayName;const $u={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)}},Bu="forlogic_";function Vu(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function qu(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Wu(e){return qu()?`${Bu}${e}`:e}function Hu(e){return qu()?`${Bu}${e}`:e}function Gu(e){try{e()}catch(a){import.meta.env.DEV}}function Ku(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&$u.setTag(Hu(a),t)}function Yu({module:e,isContracted:a,sourceModule:t,alias:r}){Vu()&&Gu(()=>{Ku({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:r}),$u.event(Wu("module_menu_click"))})}function Qu({module:e,sourceModule:a,alias:t}){Vu()&&Gu(()=>{Ku({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),$u.event(Wu("module_interest_click"))})}function Ju({resource:e,sourceModule:a,alias:t}){Vu()&&Gu(()=>{Ku({footer_resource:e,source_module:a,alias:t}),$u.event(Wu("module_footer_click"))})}function Xu({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:r="https://sabergestao.com.br/",wikiUrl:n,alias:o,sourceModule:i}){const{t:s}=La(),l=Vo(e||n||"https://educacao.sabergestao.com.br/{alias}/fe",o),d=e=>{Ju({resource:e,sourceModule:i,alias:o})};return t("div",{className:"flex-shrink-0 pt-4",children:[a(pi,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a(Ou,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a(ju,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a(ge,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const Zu=[{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}"}]},{id:"admin",label:"Admin",modules:[{name:"Admin",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function em({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:Jo("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 am(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 tm({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=e=>!0===e.alwaysContracted||!d||n.includes(e.name),u=l.filter(c),p=d?l.filter(e=>!c(e)):[],h=am(u,s),f=am(p,s),g=(e,a)=>{a?r?.(e):o?.(e)};return t("div",{className:"space-y-6",children:[h.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:h.map(e=>a(em,{module:e,onClick:()=>g(e,!0)},e.name))})}),f.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:f.map(e=>a(em,{module:e,onClick:()=>g(e,!1)},e.name))})]})]})}function rm({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,showAdminGroup:m=!1}){const[p,h]=i("qualiex"),f=m?Zu.find(e=>"admin"===e.id)?.modules??[]:[],g=Zu.filter(e=>"admin"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...f]}:e),v=e=>{Qu({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(zu,{value:p,onValueChange:h,className:"flex-1 flex flex-col min-h-0",children:[a(Lu,{className:"w-fit shrink-0",children:g.map(e=>t(Fu,{value:e.id,children:[e.label,t("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),g.map(t=>a(Uu,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a(tm,{modules:t.modules,onModuleClick:a=>{return n=a,o=t.id,Yu({module:n,isContracted:!!n.alwaysContracted||"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:v})},t.id))]}),a(Xu,{educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:c,sourceModule:u})]})}function nm(e){const{association:a}=wu();return s(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,r=Zu.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=xu[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function om({open:e,onOpenChange:r,onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,sourceModule:c,showAdminGroup:u}){const{alias:m,user:p}=rd(),h=nm(o),f=u??!!p?.isSysAdmin;return a(ki,{open:e,onOpenChange:r,children:t(Ti,{size:"lg",className:"overflow-hidden flex flex-col",children:[a(Ii,{className:"sr-only",children:a(zi,{children:"Módulos"})}),a(rm,{onModuleClick:e=>{n?n(e):e.url&&Bo(Vo(e.url,m||void 0))},contractedModules:h,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:m||void 0,sourceModule:c,showAdminGroup:f})]})})}function im({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}=La(),_=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(ki,{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(zi,{children:N("no_access_page")}),a(Li,{children:"Selecione um módulo para continuar navegando!"})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t(ms,{children:[a(ps,{asChild:!0,children:t(ti,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a(ve,{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(ys,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t(ws,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a(ve,{className:"mr-2 h-4 w-4 shrink-0"}),a("span",{className:"truncate",children:e.name}),e.alias===m&&a(ss,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t(ms,{children:[a(ps,{asChild:!0,children:t(ti,{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(be,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a(D,{className:"h-3 w-3"})]})}),t(ys,{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(ks,{}),t(ws,{onClick:h,children:[a(xe,{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(Xu,{educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]}):a(rm,{onModuleClick:o,contractedModules:i,onModuleInterest:l,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]})})}function sm(e,a){const{t:t}=La();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function lm({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}=La(),{hasAccess:f,isLoading:g,association:v}=wu(),{user:b,alias:x,companies:y,isAuthenticated:w,isLoading:N,logout:_,switchUnit:C}=rd(),k=nm(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]),P=l(e=>{n?n(e):e.url&&Bo(Vo(e.url,x||void 0))},[n,x]),D=s(()=>{if(!m)return;const e=window.location.pathname,a=Object.keys(m).find(a=>sm(e,[a]));return a?m[a]:void 0},[m]);return N||!w||u?.length&&sm(window.location.pathname,u)?a(r,{children:e}):g?a("div",{className:"flex items-center justify-center min-h-screen",children:a(ds,{size:"lg"})}):f?a(r,{children:e}):a(im,{open:!0,onModuleClick:P,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:D})}function dm({title:e,description:r,image:n,icon:o,ctaLabel:i,onCtaClick:s,children:l}){const{t:d}=La(),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(ti,{onClick:s,size:"lg",className:"gap-2",children:[a(ye,{className:"h-4 w-4"}),c]}):null]})}let cm=!1;function um(){if(cm||"undefined"==typeof document)return;cm=!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 mm({projectId:e,mode:a="auto"}){const{user:t,alias:r,isAuthenticated:n}=rd();m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!lr()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{$u.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";$u.identify(e,void 0,"modules-menu",t.name||void 0),r&&$u.setTag("alias",r),"boolean"==typeof t.isSysAdmin&&$u.setTag("isSysAdmin",String(t.isSysAdmin))}catch(e){import.meta.env.DEV}},[t,r,n,a])}let pm="legacy";function hm(){return pm}function fm({children:r,queryClient:n,moduleAlias:i,associationsBaseUrl:s,moduleAccessGuardProps:l,appTranslations:d,clarityProjectId:c,clarityMode:u="auto",backend:m="supabase",securityMode:p="legacy"}){ar(m),pm=p,um();const[h]=o.useState(()=>new Va({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=n??h;o.useEffect(()=>{if(d)for(const[e,a]of Object.entries(d))fu(e,a)},[d]);const g={sourceModule:i,...l};return t(Ru,{children:[a(vm,{}),a(Ua,{i18n:e,children:a(qa,{client:f,children:t(td,{children:[a(gm,{projectId:c,mode:u}),a(Au,{children:t(vu,{moduleAlias:i,associationsBaseUrl:s,children:[a(_u,{}),a(lm,{...g,children:r})]})})]})})})]})}function gm({projectId:e,mode:a}){return mm({projectId:e,mode:a}),null}function vm(){if(!rr())return null;const e=Cl(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 bm=ot.Root,xm=n.forwardRef(({className:e,...t},r)=>a(ot.Item,{ref:r,className:Jo("border-b",e),...t}));xm.displayName="AccordionItem";const ym=n.forwardRef(({className:e,children:r,...n},o)=>a(ot.Header,{className:"flex",children:t(ot.Trigger,{ref:o,className:Jo("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"})]})}));ym.displayName=ot.Trigger.displayName;const wm=n.forwardRef(({className:e,children:t,...r},n)=>a(ot.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:Jo("pb-4 pt-0",e),children:t})}));wm.displayName=ot.Content.displayName;const Nm=n.forwardRef(({...e},t)=>a("nav",{ref:t,"aria-label":"breadcrumb",...e}));Nm.displayName="Breadcrumb";const _m=n.forwardRef(({className:e,...t},r)=>a("ol",{ref:r,className:Jo("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));_m.displayName="BreadcrumbList";const Cm=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Jo("inline-flex items-center gap-1.5",e),...t}));Cm.displayName="BreadcrumbItem";const km=n.forwardRef(({asChild:e,className:t,...r},n)=>a(e?v:"a",{ref:n,className:Jo("transition-colors hover:text-foreground",t),...r}));km.displayName="BreadcrumbLink";const Sm=n.forwardRef(({className:e,...t},r)=>a("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Jo("font-normal text-foreground",e),...t}));Sm.displayName="BreadcrumbPage";const Am=({children:e,className:t,...r})=>a("li",{role:"presentation","aria-hidden":"true",className:Jo("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...r,children:e??a(O,{})});Am.displayName="BreadcrumbSeparator";const Em=({className:e,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:Jo("flex h-9 w-9 items-center justify-center",e),...r,children:[a(we,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Mais"})]});Em.displayName="BreadcrumbEllipsis";const Pm=b("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"}}),Dm=n.forwardRef(({className:e,orientation:t,...r},n)=>a("div",{ref:n,className:Jo(Pm({orientation:t}),e),...r}));function Tm({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a(it,{showOutsideDays:r,className:Jo("p-3 pointer-events-auto",e),locale:vo,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:Jo(ai({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Jo(ai({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:Jo(ai({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?se:O,{className:"h-4 w-4"})},...n})}Dm.displayName="ButtonGroup",Tm.displayName="Calendar";const Im={Root:function({children:e,className:t}){return a("div",{className:Jo("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return a(si,{className:Jo("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:a(ui,{className:"p-4",children:e})})},Field:function({label:e,value:r,className:n}){return t("div",{className:Jo("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 Mm({date:e,onDateChange:r,placeholder:n,disabled:o=!1,className:i,disabledDates:s}){const{t:l}=La(),d=n??l("select_date");return t(Is,{children:[a(Ms,{asChild:!0,children:t(ti,{variant:"outline",disabled:o,className:Jo("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",i),children:[a(Ne,{className:"mr-2 h-4 w-4"}),e?C(e,"d 'de' MMMM 'de' yyyy",{locale:vo}):a("span",{children:d})]})}),a(Rs,{className:"w-auto p-0",align:"start",children:a(Tm,{mode:"single",selected:e,onSelect:r,disabled:s,initialFocus:!0,className:"pointer-events-auto"})})]})}const Rm=({shouldScaleBackground:e=!0,...t})=>a(st.Root,{shouldScaleBackground:e,...t});Rm.displayName="Drawer";const zm=st.Trigger,Lm=st.Portal,Fm=st.Close,Um=n.forwardRef(({className:e,...t},r)=>a(st.Overlay,{ref:r,className:Jo("fixed inset-0 z-50 bg-black/80",e),...t}));Um.displayName=st.Overlay.displayName;const Om=n.forwardRef(({className:e,children:r,...n},o)=>t(Lm,{children:[a(Um,{}),t(st.Content,{ref:o,className:Jo("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]})]}));Om.displayName="DrawerContent";const jm=({className:e,...t})=>a("div",{className:Jo("grid gap-1.5 p-4 text-center sm:text-left",e),...t});jm.displayName="DrawerHeader";const $m=({className:e,...t})=>a("div",{className:Jo("mt-auto flex flex-col gap-2 p-4",e),...t});$m.displayName="DrawerFooter";const Bm=n.forwardRef(({className:e,...t},r)=>a(st.Title,{ref:r,className:Jo("text-lg font-semibold leading-none tracking-tight",e),...t}));Bm.displayName=st.Title.displayName;const Vm=n.forwardRef(({className:e,...t},r)=>a(st.Description,{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));Vm.displayName=st.Description.displayName;const qm={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))]"},Wm={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Hm({children:e,cols:t="auto-fit",gap:r="md",className:n}){return a("div",{className:Jo("grid",qm[t],Wm[r],n),children:e})}const Gm=lt.Root,Km=lt.Trigger,Ym=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>a(lt.Content,{ref:o,align:t,sideOffset:r,className:Jo("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}));Ym.displayName=lt.Content.displayName;const Qm=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-slot":"input-group",className:Jo("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}));Qm.displayName="InputGroup";const Jm=b("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"}}),Xm=n.forwardRef(({className:e,align:t,...r},n)=>a("div",{ref:n,"data-slot":"input-group-addon",className:Jo(Jm({align:t}),e),...r}));Xm.displayName="InputGroupAddon";const Zm=b("",{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"}}),ep=n.forwardRef(({className:e,size:t,variant:r="ghost",...n},o)=>a(ti,{ref:o,"data-slot":"input-group-button",variant:r,className:Jo(Zm({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...n}));ep.displayName="InputGroupButton";const ap=n.forwardRef(({className:e,...t},r)=>a(ni,{ref:r,"data-slot":"input-group-control",className:Jo("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));ap.displayName="InputGroupInput";const tp=n.forwardRef(({className:e,...t},r)=>a(os,{ref:r,"data-slot":"input-group-control",className:Jo("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));tp.displayName="InputGroupTextarea";const rp=n.forwardRef(({className:e,...t},r)=>a("h1",{ref:r,className:Jo("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));rp.displayName="H1";const np=n.forwardRef(({className:e,...t},r)=>a("h2",{ref:r,className:Jo("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));np.displayName="H2";const op=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Jo("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));op.displayName="H3";const ip=n.forwardRef(({className:e,...t},r)=>a("h4",{ref:r,className:Jo("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));ip.displayName="H4";const sp=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Jo("leading-7 [&:not(:first-child)]:mt-6",e),...t}));sp.displayName="P";const lp=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Jo("text-xl text-muted-foreground",e),...t}));lp.displayName="Lead";const dp=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Jo("text-lg font-semibold",e),...t}));dp.displayName="Large";const cp=n.forwardRef(({className:e,...t},r)=>a("small",{ref:r,className:Jo("text-sm font-medium leading-none",e),...t}));cp.displayName="Small";const up=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));up.displayName="Muted";const mp=n.forwardRef(({className:e,...t},r)=>a("code",{ref:r,className:Jo("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));mp.displayName="InlineCode";const pp=n.forwardRef(({className:e,...t},r)=>a("blockquote",{ref:r,className:Jo("mt-6 border-l-2 pl-6 italic",e),...t}));pp.displayName="Blockquote";const hp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Jo("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));hp.displayName="List";const fp=n.forwardRef(({className:e,children:r,...n},o)=>t(dt.Root,{ref:o,className:Jo("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...n,children:[r,a(Np,{})]}));fp.displayName=dt.Root.displayName;const gp=n.forwardRef(({className:e,...t},r)=>a(dt.List,{ref:r,className:Jo("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));gp.displayName=dt.List.displayName;const vp=dt.Item,bp=b("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"),xp=n.forwardRef(({className:e,children:r,...n},o)=>t(dt.Trigger,{ref:o,className:Jo(bp(),"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"})]}));xp.displayName=dt.Trigger.displayName;const yp=n.forwardRef(({className:e,...t},r)=>a(dt.Content,{ref:r,className:Jo("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}));yp.displayName=dt.Content.displayName;const wp=dt.Link,Np=n.forwardRef(({className:e,...t},r)=>a("div",{className:Jo("absolute left-0 top-full flex justify-center"),children:a(dt.Viewport,{className:Jo("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})}));Np.displayName=dt.Viewport.displayName;const _p=n.forwardRef(({className:e,...t},r)=>a(dt.Indicator,{ref:r,className:Jo("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 Cp({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(Nm,{className:o,children:a(_m,{children:i.map((e,n)=>{const o=s&&1===n;return t(Cm,{children:[!(0===n)&&a(Am,{}),o&&t(r,{children:[a(Em,{}),a(Am,{})]}),e.isCurrentPage?a(Sm,{children:e.label}):a(km,{asChild:!0,children:a(Qa,{to:e.href||"/",children:e.label})})]},e.label)})})})}function kp(){const e=Ka();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})()}_p.displayName=dt.Indicator.displayName;const Sp=({className:e,...t})=>a("nav",{role:"navigation","aria-label":"pagination",className:Jo("mx-auto flex w-full justify-center",e),...t});Sp.displayName="Pagination";const Ap=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Jo("flex flex-row items-center gap-1",e),...t}));Ap.displayName="PaginationContent";const Ep=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Jo("",e),...t}));Ep.displayName="PaginationItem";const Pp=({className:e,isActive:t,size:r="icon",...n})=>a("a",{"aria-current":t?"page":void 0,className:Jo(ai({variant:t?"outline":"ghost",size:r}),e),...n});Pp.displayName="PaginationLink";const Dp=({className:r,...n})=>t(Pp,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Jo("gap-1 pl-2.5",r),...n,children:[a(se,{className:"h-4 w-4"}),a("span",{children:"Previous"})]});Dp.displayName="PaginationPrevious";const Tp=({className:r,...n})=>t(Pp,{"aria-label":e.t("go_to_next_page"),size:"default",className:Jo("gap-1 pr-2.5",r),...n,children:[a("span",{children:"Next"}),a(O,{className:"h-4 w-4"})]});Tp.displayName="PaginationNext";const Ip=({className:e,...r})=>t("span",{"aria-hidden":!0,className:Jo("flex h-9 w-9 items-center justify-center",e),...r,children:[a(we,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"More pages"})]});Ip.displayName="PaginationEllipsis";const Mp=n.forwardRef(({className:e,value:t,...r},n)=>a(ct.Root,{ref:n,className:Jo("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:a(ct.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Mp.displayName=ct.Root.displayName;const Rp=n.forwardRef(({className:e,...t},r)=>a(ut.Root,{className:Jo("grid gap-2",e),...t,ref:r}));Rp.displayName=ut.Root.displayName;const zp=n.forwardRef(({className:e,...t},r)=>a(ut.Item,{ref:r,className:Jo("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(ut.Indicator,{className:"flex items-center justify-center",children:a(j,{className:"h-2.5 w-2.5 fill-current text-current"})})}));zp.displayName=ut.Item.displayName;const Lp=({className:e,...t})=>a(mt.PanelGroup,{className:Jo("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Fp=mt.Panel,Up=({withHandle:e,className:t,...r})=>a(mt.PanelResizeHandle,{className:Jo("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(te,{className:"h-2.5 w-2.5"})})}),Op=ka.Root,jp=ka.Trigger,$p=ka.Close,Bp=ka.Portal,Vp=n.forwardRef(({className:e,...t},r)=>a(ka.Overlay,{className:Jo("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}));Vp.displayName=ka.Overlay.displayName;const qp=b("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"}}),Wp=n.forwardRef(({side:e="right",className:r,children:n,...o},i)=>t(Bp,{children:[a(Vp,{}),t(ka.Content,{ref:i,className:Jo(qp({side:e}),r),...o,children:[n,t(ka.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(P,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]})]}));Wp.displayName=ka.Content.displayName;const Hp=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:Jo("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(pi,{className:"mt-2"})]});Hp.displayName="SheetHeader";const Gp=({className:e,...t})=>a("div",{className:Jo("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});Gp.displayName="SheetBody";const Kp=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(pi,{className:"mb-4"}),a("div",{className:Jo("flex flex-row justify-end gap-2",e),...n,children:r})]});Kp.displayName="SheetFooter";const Yp=n.forwardRef(({className:e,...t},r)=>a(ka.Title,{ref:r,className:Jo("text-lg font-semibold text-foreground",e),...t}));Yp.displayName=ka.Title.displayName;const Qp=n.forwardRef(({className:e,...t},r)=>a(ka.Description,{ref:r,className:Jo("text-sm text-muted-foreground",e),...t}));Qp.displayName=ka.Description.displayName;const Jp="sidebar:state",Xp=n.createContext(null);function Zp(){const e=n.useContext(Xp);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const eh=n.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:o,style:i,children:s,...l},d)=>{const c=sd(),[u,m]=n.useState(!1),[p,h]=n.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Jp);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(Jp,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(Xp.Provider,{value:x,children:a(As,{delayDuration:0,children:a("div",{className:Jo("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})})})});eh.displayName="SidebarProvider";const ah=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}=Zp();return"none"===n?a("div",{className:Jo("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",o),ref:l,...s,children:i}):d?a(Op,{open:u,onOpenChange:m,...s,children:t(Wp,{"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(Yp,{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:Jo("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:Jo("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})})]})});ah.displayName="Sidebar";const th=n.forwardRef(({className:e,onClick:r,...n},o)=>{const{toggleSidebar:i}=Zp();return t(ti,{ref:o,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Jo("h-7 w-7",e),onClick:e=>{r?.(e),i()},...n,children:[a(_e,{}),a("span",{className:"sr-only",children:"Toggle Sidebar"})]})});th.displayName="SidebarTrigger";const rh=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=Zp();return a("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Jo("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})});rh.displayName="SidebarRail";const nh=n.forwardRef(({className:e,...t},r)=>a("main",{ref:r,className:Jo("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}));nh.displayName="SidebarInset";const oh=n.forwardRef(({className:e,...t},r)=>a(ni,{ref:r,"data-sidebar":"input",className:Jo("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));oh.displayName="SidebarInput";const ih=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"header",className:Jo("flex flex-col gap-2 p-2",e),...t}));ih.displayName="SidebarHeader";const sh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"footer",className:Jo("flex flex-col gap-2 p-2",e),...t}));sh.displayName="SidebarFooter";const lh=n.forwardRef(({className:e,...t},r)=>a(pi,{ref:r,"data-sidebar":"separator",className:Jo("mx-2 w-auto bg-sidebar-border",e),...t}));lh.displayName="SidebarSeparator";const dh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"content",className:Jo("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));dh.displayName="SidebarContent";const ch=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group",className:Jo("relative flex w-full min-w-0 flex-col p-2",e),...t}));ch.displayName="SidebarGroup";const uh=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?v:"div",{ref:n,"data-sidebar":"group-label",className:Jo("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}));uh.displayName="SidebarGroupLabel";const mh=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?v:"button",{ref:n,"data-sidebar":"group-action",className:Jo("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}));mh.displayName="SidebarGroupAction";const ph=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group-content",className:Jo("w-full text-sm",e),...t}));ph.displayName="SidebarGroupContent";const hh=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu",className:Jo("flex w-full min-w-0 flex-col gap-1",e),...t}));hh.displayName="SidebarMenu";const fh=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,"data-sidebar":"menu-item",className:Jo("group/menu-item relative",e),...t}));fh.displayName="SidebarMenuItem";const gh=b("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"}}),vh=n.forwardRef(({asChild:e=!1,isActive:r=!1,variant:n="default",size:o="default",tooltip:i,className:s,...l},d)=>{const c=e?v:"button",{isMobile:u,state:m}=Zp(),p=a(c,{ref:d,"data-sidebar":"menu-button","data-size":o,"data-active":r,className:Jo(gh({variant:n,size:o}),s),...l});return i?("string"==typeof i&&(i={children:i}),t(Es,{children:[a(Ps,{asChild:!0,children:p}),a(Ds,{side:"right",align:"center",hidden:"collapsed"!==m||u,...i})]})):p});vh.displayName="SidebarMenuButton";const bh=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>a(t?v:"button",{ref:o,"data-sidebar":"menu-action",className:Jo("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}));bh.displayName="SidebarMenuAction";const xh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"menu-badge",className:Jo("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}));xh.displayName="SidebarMenuBadge";const yh=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:Jo("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}})]})});yh.displayName="SidebarMenuSkeleton";const wh=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu-sub",className:Jo("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}));wh.displayName="SidebarMenuSub";const Nh=n.forwardRef(({...e},t)=>a("li",{ref:t,...e}));Nh.displayName="SidebarMenuSubItem";const _h=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},i)=>a(e?v:"a",{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Jo("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}));_h.displayName="SidebarMenuSubButton";const Ch=n.forwardRef(({className:e,value:r,defaultValue:n,...o},i)=>{const s=r||n||[0];return t(pt.Root,{ref:i,value:r,defaultValue:n,className:Jo("relative flex w-full touch-none select-none items-center",e),...o,children:[a(pt.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a(pt.Range,{className:"absolute h-full bg-primary"})}),s.map((e,t)=>a(pt.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 kh({children:e,className:t}){return a("div",{className:Jo("flex flex-col h-full",t),children:a(lc,{className:"flex-1",children:a("div",{className:"space-y-6 p-6",children:e})})})}function Sh({title:e,description:r,actions:n,className:o}){return t("div",{className:Jo("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(pi,{})]})}function Ah({children:e,className:t}){return a("div",{className:Jo("space-y-6",t),children:e})}Ch.displayName=pt.Root.displayName;const Eh=ht.Menu,Ph=ht.Group,Dh=ht.Portal,Th=ht.Sub,Ih=ht.RadioGroup,Mh=n.forwardRef(({className:e,...t},r)=>a(ht.Root,{ref:r,className:Jo("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));Mh.displayName=ht.Root.displayName;const Rh=n.forwardRef(({className:e,...t},r)=>a(ht.Trigger,{ref:r,className:Jo("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}));Rh.displayName=ht.Trigger.displayName;const zh=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(ht.SubTrigger,{ref:i,className:Jo("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"})]}));zh.displayName=ht.SubTrigger.displayName;const Lh=n.forwardRef(({className:e,...t},r)=>a(ht.SubContent,{ref:r,className:Jo("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}));Lh.displayName=ht.SubContent.displayName;const Fh=n.forwardRef(({className:e,align:t="start",alignOffset:r=-4,sideOffset:n=8,...o},i)=>a(ht.Portal,{children:a(ht.Content,{ref:i,align:t,alignOffset:r,sideOffset:n,className:Jo("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})}));Fh.displayName=ht.Content.displayName;const Uh=n.forwardRef(({className:e,inset:t,...r},n)=>a(ht.Item,{ref:n,className:Jo("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}));Uh.displayName=ht.Item.displayName;const Oh=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(ht.CheckboxItem,{ref:i,className:Jo("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(ht.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Oh.displayName=ht.CheckboxItem.displayName;const jh=n.forwardRef(({className:e,children:r,...n},o)=>t(ht.RadioItem,{ref:o,className:Jo("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(ht.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));jh.displayName=ht.RadioItem.displayName;const $h=n.forwardRef(({className:e,inset:t,...r},n)=>a(ht.Label,{ref:n,className:Jo("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));$h.displayName=ht.Label.displayName;const Bh=n.forwardRef(({className:e,...t},r)=>a(ht.Separator,{ref:r,className:Jo("-mx-1 my-1 h-px bg-muted",e),...t}));Bh.displayName=ht.Separator.displayName;const Vh=({className:e,...t})=>a("span",{className:Jo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Vh.displayname="MenubarShortcut";const qh={light:"",dark:".dark"},Wh=n.createContext(null);function Hh(){const e=n.useContext(Wh);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Gh=n.forwardRef(({id:e,className:r,children:o,config:i,...s},l)=>{const d=n.useId(),c=`chart-${e||d.replace(/:/g,"")}`;return a(Wh.Provider,{value:{config:i},children:t("div",{"data-chart":c,ref:l,className:Jo("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(Kh,{id:c,config:i}),a(ft.ResponsiveContainer,{children:o})]})})});Gh.displayName="Chart";const Kh=({id:e,config:t})=>{const r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?a("style",{dangerouslySetInnerHTML:{__html:Object.entries(qh).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},Yh=ft.Tooltip,Qh=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}=Hh(),x=n.useMemo(()=>{if(l||!o?.length)return null;const[e]=o,t=Zh(b,e,`${g||e?.dataKey||e?.name||"value"}`),r=g||"string"!=typeof c?t?.label:b[c]?.label||c;return u?a("div",{className:Jo("font-medium",m),children:u(r,o)}):r?a("div",{className:Jo("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:Jo("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=Zh(b,e,o),l=h||e.payload?.fill||e.color;return a("div",{className:Jo("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:Jo("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:Jo("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)})})]})});Qh.displayName="ChartTooltip";const Jh=ft.Legend,Xh=n.forwardRef(({className:e,hideIcon:r=!1,payload:n,verticalAlign:o="bottom",nameKey:i},s)=>{const{config:l}=Hh();return n?.length?a("div",{ref:s,className:Jo("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=Zh(l,e,n);return t("div",{className:Jo("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 Zh(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]}Xh.displayName="ChartLegend";const ef=({onClick:e,isActive:t,disabled:r,children:n,title:o})=>a("button",{type:"button",onClick:e,disabled:r,title:o,className:Jo("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}),af=()=>a("div",{className:"w-px h-5 bg-border mx-1"}),tf=({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}=La(),[f,g]=i("visual"),v=It({extensions:[Rt.configure({heading:{levels:[1,2,3]}}),zt,Lt.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Ft,Ut,Ot.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:Jo("space-y-2",p),children:[u&&t("div",{className:"flex justify-between items-center",children:[t("div",{className:"flex gap-1",children:[t(ti,{type:"button",size:"sm",variant:"visual"===f?"default":"outline",onClick:()=>g("visual"),disabled:s,children:[a(Ce,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t(ti,{type:"button",size:"sm",variant:"code"===f?"default":"outline",onClick:()=>g("code"),disabled:s,children:[a(ke,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t(ti,{type:"button",size:"sm",variant:"preview"===f?"default":"outline",onClick:()=>g("preview"),disabled:s,children:[a(Se,{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(ef,{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),isActive:v.isActive("heading",{level:1}),disabled:s,title:e.t("heading_1"),children:a(Ae,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),isActive:v.isActive("heading",{level:2}),disabled:s,title:e.t("heading_2"),children:a(Ee,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),isActive:v.isActive("heading",{level:3}),disabled:s,title:e.t("heading_3"),children:a(Pe,{className:"h-4 w-4"})}),a(af,{}),a(ef,{onClick:()=>v.chain().focus().toggleBold().run(),isActive:v.isActive("bold"),disabled:s,title:e.t("bold"),children:a(De,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleItalic().run(),isActive:v.isActive("italic"),disabled:s,title:e.t("italic"),children:a(Te,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleUnderline().run(),isActive:v.isActive("underline"),disabled:s,title:"Sublinhado",children:a(Ie,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleStrike().run(),isActive:v.isActive("strike"),disabled:s,title:"Riscado",children:a(Me,{className:"h-4 w-4"})}),a(af,{}),a(ef,{onClick:()=>v.chain().focus().toggleBulletList().run(),isActive:v.isActive("bulletList"),disabled:s,title:"Lista",children:a(Z,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().toggleOrderedList().run(),isActive:v.isActive("orderedList"),disabled:s,title:h("ordered_list"),children:a(Re,{className:"h-4 w-4"})}),a(af,{}),a(ef,{onClick:()=>v.chain().focus().toggleHighlight().run(),isActive:v.isActive("highlight"),disabled:s,title:"Destacar",children:a(ze,{className:"h-4 w-4"})}),a(ef,{onClick:b,isActive:v.isActive("link"),disabled:s,title:"Link",children:a(Le,{className:"h-4 w-4"})}),a(af,{}),a(ef,{onClick:()=>v.chain().focus().unsetAllMarks().clearNodes().run(),disabled:s,title:h("clear_formatting"),children:a(Fe,{className:"h-4 w-4"})}),a(af,{}),a(ef,{onClick:()=>v.chain().focus().undo().run(),disabled:s||!v.can().undo(),title:"Desfazer",children:a(Ue,{className:"h-4 w-4"})}),a(ef,{onClick:()=>v.chain().focus().redo().run(),disabled:s||!v.can().redo(),title:"Refazer",children:a(Oe,{className:"h-4 w-4"})})]}),a(Mt,{editor:v,className:Jo("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 rf({image:e,title:t,className:r}){return a("div",{className:Jo("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(je,{className:"w-16 h-16 text-muted-foreground"})})})}function nf({steps:e,currentStepIndex:r,onStepSelect:n,stepLabel:o,className:i}){const{t:s}=La(),l=e.length,d=(r+1)/l*100;return t("div",{className:Jo("flex items-center gap-3",i),children:[t(ms,{children:[a(ps,{asChild:!0,children:t(ti,{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(ys,{align:"start",children:e.map((e,a)=>t(ws,{onClick:()=>n(a),className:Jo(a===r&&"bg-accent"),children:[a+1,". ",e.title]},e.id))})]}),a(Mp,{value:d,className:"w-32 h-2"})]})}function of({currentStepIndex:e,totalSteps:r,onBack:n,onNext:o,onComplete:i,backButtonText:s,continueButtonText:l,finishButtonText:d,className:c}){const{t:u}=La(),m=0===e,p=e===r-1;return t("div",{className:Jo("flex items-center gap-2",c),children:[!m&&t(ti,{variant:"outline",onClick:n,size:"sm",children:[a($e,{className:"h-4 w-4 mr-2"}),s]}),t(ti,{onClick:p?i:o,size:"sm",children:[p?d:l,!p&&a(Be,{className:"h-4 w-4 ml-2"})]})]})}const sf=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(ki,{open:r,onOpenChange:o,children:t(Ti,{ref:b,size:p,variant:"informative",className:Jo("p-0 gap-0 overflow-hidden",v),children:[t(Ei,{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(P,{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(rf,{image:C.image,title:C.title}),a(zi,{className:"text-xl font-semibold",children:C.title}),a(Li,{className:"text-muted-foreground",children:C.description})]})}),t("div",{className:"flex-shrink-0",children:[a(pi,{}),t("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[h&&k>1?a(nf,{steps:i,currentStepIndex:N,onStepSelect:e=>{_(e)},stepLabel:m}):a("div",{}),a(of,{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 lf({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}=La(),p=l||d;if(!(o.length>0))return t(ti,{variant:i,size:s,disabled:p,onClick:r,className:u,children:[d?a(M,{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:Jo("inline-flex rounded-md shadow-sm",u),children:[t(ti,{variant:i,size:s,disabled:p,onClick:r,className:"rounded-r-none border-r-0 focus:z-10",children:[d?a(M,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]}),t(ms,{children:[a(ps,{asChild:!0,children:a(ti,{variant:i,size:s,disabled:p,className:Jo("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(ys,{align:c,className:"min-w-[160px]",children:o.map(e=>{const r=e.icon;return t(ws,{onClick:e.onClick,disabled:e.disabled,className:Jo("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}sf.displayName="OnboardingDialog";var df=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(df||{});const cf=[{value:"csv",label:"CSV",icon:a(We,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:a(We,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:a(He,{className:"h-5 w-5"})}],uf=[{value:"png",label:"PNG",icon:a(Ve,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:a(qe,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:a(qe,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:a(We,{className:"h-5 w-5"})}];function mf({open:e,onOpenChange:r,onExport:n,mode:o="table",options:s,title:l,description:d,cancelLabel:c="Cancelar",exportLabel:u="Exportar"}){const{t:m}=La(),[p,h]=i(""),f=s??("chart"===o?uf:cf),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(ki,{open:e,onOpenChange:b,children:t(Ti,{className:"sm:max-w-md",variant:"form",isDirty:!!p,children:[a(Ii,{children:a(zi,{children:g})}),t("div",{className:"py-4",children:[a("p",{className:"text-sm text-muted-foreground mb-4",children:v}),a(Rp,{value:p,onValueChange:h,className:"gap-3",children:f.map(e=>t("div",{className:"flex items-center space-x-3",children:[a(zp,{value:e.value,id:`export-${e.value}`}),t(ii,{htmlFor:`export-${e.value}`,className:Jo("flex items-center gap-2 cursor-pointer font-normal",p===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t(Ri,{children:[a(ti,{variant:"outline",onClick:()=>b(!1),children:c}),a(ti,{onClick:()=>{p&&(n(p),r(!1),h(""))},disabled:!p,children:u})]})]})})}const pf=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:Jo("grid gap-1.5",c),children:[i&&a(ii,{htmlFor:h,children:i}),t("div",{className:"relative",children:[a(ni,{ref:p,id:h,type:"time",value:e??"",onChange:f,onKeyDown:g,min:"00:00",max:"23:59",step:60,className:Jo("pr-9",s&&"border-destructive focus-visible:ring-destructive"),...m}),a(Ge,{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 hf({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),P=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]),D=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?Ke:Ye,M=b?"Senha":e.t("verification_code"),R=b?e.t("enter_password"):e.t("enter_code");return a(ki,{open:r,onOpenChange:T,children:t(Ti,{className:"sm:max-w-md",variant:"form",isDirty:!!w,children:[a(Ii,{children:t(zi,{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(Qe,{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(ii,{htmlFor:"signature-input",children:M}),a(ni,{id:"signature-input",type:b?"password":"text",value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&w.trim()&&(e.preventDefault(),P())},maxLength:b?void 0:u,placeholder:R,autoFocus:!0,className:Jo(A&&"border-destructive focus-visible:ring-destructive")}),A&&a("p",{className:"text-sm text-destructive",children:A})]}),!b&&t(ti,{variant:"ghost",size:"sm",onClick:D,disabled:k,className:"text-primary",children:[a(me,{className:Jo("h-4 w-4 mr-1",k&&"animate-spin")}),g]})]}),t(Ri,{children:[a(ti,{variant:"outline",onClick:()=>T(!1),disabled:_,children:f}),a(ti,{onClick:P,disabled:!w.trim()||_,children:_?"Validando...":h})]})]})})}function ff({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:Jo("flex items-center gap-3",l),children:[t(ms,{children:[a(ps,{asChild:!0,children:t(ti,{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(ys,{align:"start",children:c.map(r=>t(ws,{onClick:()=>{var a;(a=r)<e?o(a):s&&!s(a)||o(a)},disabled:u(r),className:Jo("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(I,{className:"h-4 w-4 ml-auto"})]},r))})]}),a(Mp,{value:e/r*100,className:Jo("h-2",d)})]})}function gf({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}=La(),E=s.length,P=o>=E,D=o<=1;return a(ki,{open:r,onOpenChange:n,children:t(Ti,{size:b,variant:g,isDirty:v,unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:w,leaveWithoutSavingText:N,className:Jo("!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:Jo("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:Jo("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:Jo("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(Ii,{className:"p-6 pb-0",children:[t("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",o," de ",E]}),a(zi,{children:c}),u&&a("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a(Mi,{className:"px-6",children:d}),!k&&a(Ri,{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:[!D&&a(ti,{variant:"outline",onClick:()=>i(o-1),children:f}),a(ti,P?{onClick:m,disabled:C,children:p}:{onClick:()=>i(o+1),disabled:C,children:h})]})]})})]})]})})}function vf(e){const a=yl.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 bf(e,a,t){let r=await fetch(e,a);if(401===r.status){if(await Ol.handleApiError({status:401})){const n={...a,headers:vf(t)};r=await fetch(e,n)}}return r}function xf(e){const[a,t]=i([]),[r,n]=i(0),[o,s]=i(!1);m(()=>{if(!e)return;let a=!1;const r=`${cr().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){s(!0);try{const o=vf(e),i=await bf(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=`${cr().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=vf(e),r=JSON.stringify({id:t,idUpdateType:3});await bf(o,{method:"POST",headers:a,body:r},e)}catch(i){}},[e,r,a]);return{updates:a,badgeCount:r,loading:o,markAsVisualized:d}}pf.displayName="Timepicker";const yf=o.forwardRef(({updates:r,badgeCount:n,onOpen:o,onViewAll:i},s)=>{const l=void 0===r,d=rd(),c=d?.alias??null,u=xf(l?c:null),m=Ga(),p=l?u.updates??[]:r,h=l?u.badgeCount??0:n??0,f=o??(l?u.markAsVisualized:void 0),g=i??(l&&c?()=>{m(`/${c}/up/view`)}:void 0);return t(Is,{children:[a(Ms,{asChild:!0,children:t(ti,{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:f,title:e.t("updates"),children:[a(Je,{className:"h-7 w-7"}),h>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:h>99?"99+":h})]})}),t(Rs,{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:p.length>0?a("ul",{className:"divide-y divide-border",children:p.map(e=>t("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:g,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(Je,{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(ti,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:g,children:["Ver todas as atualizações",a(Be,{className:"h-[18px] w-[18px]"})]})})]})]})});yf.displayName="UpdatesNotification";var wf=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(wf||{}),Nf=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(Nf||{});const _f={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function Cf(e){const{t:a}=La();return e?_f[e.toLowerCase()]??0:0}function kf(e){const{t:a}=La();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"}const Sf={".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 Af(e){const{t:a}=La();return Sf[e?.toLowerCase()]||""}function Ef(e){const{t:a}=La(),{viewerUrl:t,wopiUrl:r,fileId:n,token:o,extension:i,language:s="pt-br"}=e,l=Af(i);if(!l)return null;return`${t}${l}ui=${s}&rs=${s}&access_token=${o}&WOPISrc=${encodeURIComponent(`${r}${n}`)}`}function Pf({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}=La(),S=u(null),A=i??Cf(o.extension),E=p||w||v,D=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(ki,{open:e,onOpenChange:n,children:t(Ti,{className:Jo("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===A||6===A)&&"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:D}),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(Xe,{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:Df(N)}),a("span",{children:"segundos"})]}):t(ti,{variant:"default",size:"sm",disabled:E,onClick:()=>y?.(),className:"mr-2.5",children:[a(Ye,{className:"h-4 w-4 mr-1"}),w?"Confirmando...":k("terms_confirm_reading")]})}),0!==A&&h&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>g?.(f),children:a(Ze,{className:Jo("h-4 w-4",f&&"fill-accent text-accent")})})}),a(Ds,{children:f?"Desfavoritar":"Favoritar"})]}),0!==A&&d&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>c?.(),children:a(ea,{className:"h-4 w-4"})})}),a(Ds,{children:"Download"})]})]}),t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>n(!1),children:a(P,{className:"h-4 w-4"})})}),a(Ds,{children:"Fechar"})]})]})]}),a("div",{className:Jo("flex flex-col items-center justify-center min-h-[160px] w-full",s&&"relative -top-5",0===A&&"min-h-[124px]",1===A&&"max-h-[85vh]",(4===A||6===A)&&"min-w-[77vw] min-h-[80vh]"),children:s?a(ds,{className:"h-14 w-14"}):t(r,{children:[(0===A||!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?"})]}),1===A&&a("img",{loading:"eager",src:o.url,alt:o.name,className:"max-w-full max-h-[85vh] object-contain"}),2===A&&a("video",{controls:!0,autoPlay:!0,src:o.url,className:"w-full h-full"}),3===A&&a("audio",{controls:!0,autoPlay:!0,src:o.url}),(4===A||6===A)&&t("div",{className:"relative w-full h-[79.5vh]",children:[a(ds,{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&&0===A&&t("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a(ti,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),d&&a(ti,{variant:"default",onClick:()=>c?.(),children:"Download"})]})]})})}function Df(e){const{t:a}=La(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function Tf({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(ki,{open:e,onOpenChange:r,children:t(Ti,{className:Jo("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(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,children:a(P,{className:"h-4 w-4"})})}),a(Ds,{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(ds,{className:"h-14 w-14"}):t("div",{className:"relative w-full h-[79.5vh]",children:[a(ds,{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 If({open:e,onOpenChange:r,url:n,title:o,className:i,minHeight:s="250px"}){const{t:d}=La(),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(ki,{open:e,onOpenChange:r,children:t(Ti,{className:Jo("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(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a(P,{className:"h-4 w-4"})})}),a(Ds,{children:"Fechar"})]})]}),a("iframe",{src:n,className:"border-none w-full",style:{minHeight:s},title:o||d("embedded_content")})]})})}function Mf({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(ki,{open:o&&!h,onOpenChange:e=>!e&&s(),children:t(Ti,{className:"sm:max-w-md",children:[a(Ii,{children:t(zi,{className:"flex items-center gap-2",children:[a(Ye,{className:"h-5 w-5 text-primary"}),c]})}),t("div",{className:"space-y-4",children:[n.description&&a(lc,{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(ti,{variant:"link",className:"px-0 text-primary",onClick:()=>f(!0),children:[a(fe,{className:"mr-1 h-4 w-4"}),p]})]}),t(Ri,{className:"gap-2 sm:gap-0",children:[a(ti,{variant:"ghost",onClick:s,children:u}),a(ti,{onClick:g,children:m})]})]})}),h&&a(Rf,{term:n,open:h,onClose:()=>f(!1),viewOnly:!0})]})}function Rf({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}=La(),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(ki,{open:n,onOpenChange:e=>!e&&p(),children:t(Ti,{className:Jo("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(We,{className:"h-5 w-5 text-primary"}),c]}),t("div",{className:"flex items-center gap-2",children:[f&&a(ti,{size:"sm",onClick:h,children:u}),a(ti,{variant:"ghost",size:"icon",onClick:p,children:a(P,{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 zf(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Lf({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=zf(_);e=e.filter(e=>zf(e.name).includes(a)||zf(e.email??"").includes(a))}return e},[r,k,_]),P=s(()=>w?E:r.filter(e=>A.has(e.id)),[w,E,r,A]),D=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:Jo("rounded-md border bg-muted/30",y),children:[(!c||D>0)&&t("div",{className:Jo("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:D>0&&`${D} ${1===D?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(Ki,{value:k??"__all__",onValueChange:e=>S("__all__"===e?void 0:e),children:[a(Ji,{className:"w-[200px] h-9 text-sm",children:a(Qi,{placeholder:e.t("approval_user_group")})}),t(es,{children:[a(ts,{value:"__all__",children:e.t("team_all_groups")}),n.map(e=>a(ts,{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(ni,{className:"pl-8 h-9 text-sm",placeholder:p,value:_,onChange:e=>C(e.target.value)})]})]}),!w&&0===D&&t("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a(aa,{className:"h-4 w-4 mr-2"}),v]}),w&&E.length>0&&t("div",{className:"flex items-center gap-2 mb-2",children:[a(ns,{checked:T,onCheckedChange:e=>M(!!e)}),a("span",{className:"text-sm",children:g})]}),P.length>0&&a(lc,{style:{maxHeight:u},className:"pr-2",children:a("div",{className:"space-y-0.5",children:P.map(e=>{return t("div",{className:Jo("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(ns,{checked:A.has(e.id),onCheckedChange:()=>I(e.id),onClick:e=>e.stopPropagation()}),t($c,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(Bc,{src:e.avatar,alt:e.name}),a(Vc,{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 Ff(e){const{t:a}=La();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Uf(e){const{t:a}=La(),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 Of({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,E]=i([]),[T,M]=i(!1),R=s(()=>Uf(o[_]),[o,_]),z=s(()=>function(e){const{t:a}=La(),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=Ff(k);return r.filter(a=>!R.has(a.id)&&!(e&&!Ff(a.name).includes(e)))},[r,R,k]),U=s(()=>{const e={};for(const a of n)e[a.id]=Uf(o[a.id]).size;return e},[n,o]),O=l(e=>{C(e),E([]),S("")},[]),j=l(e=>{E(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),$=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}),E([]),S(""),M(!1)},[A,o,_,r,d]),V=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:Jo("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:Jo("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(Ki,{value:_,onValueChange:O,children:[a(Ji,{className:"h-9 text-sm",children:a(Qi,{})}),a(es,{children:n.map(e=>a(ts,{value:e.id,children:t("span",{className:"flex items-center gap-2",children:[e.icon,e.name,U[e.id]>0&&a(ss,{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(Is,{open:T,onOpenChange:M,children:[a(Ms,{asChild:!0,children:t(ti,{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(Rs,{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(ni,{className:"pl-8 h-8 text-sm",placeholder:g,value:k,onChange:e=>S(e.target.value)})]})}),a(lc,{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:Jo("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:Jo("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(ti,{size:"sm",className:"h-9 gap-1",disabled:0===A.length,onClick:$,children:[a(J,{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:Jo("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(ss,{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(P,{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 jf=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))(jf||{});const $f={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 Bf(e){const{t:a}=La();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Vf(e){const{t:a}=La();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function qf({requests:e,isLoading:n=!1,onGetReportUrl:o,formatDate:d=Vf,labels:c,className:u}){const{t:m}=La(),p={...$f,...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=Bf(h);return e.filter(e=>Bf(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:Jo("space-y-3",u),children:Array.from({length:5}).map((e,t)=>a(qs,{className:"h-12 w-full"},t))}):t(r,{children:[t("div",{className:Jo("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(ni,{className:"pl-8 h-9 text-sm",placeholder:p.searchPlaceholder,value:h,onChange:e=>f(e.target.value)})]}),a(lc,{className:"rounded-md border",children:t(ld,{children:[a(dd,{children:t(md,{children:[a(pd,{className:"min-w-[140px]",children:p.report}),a(pd,{className:"min-w-[150px]",children:p.status}),a(pd,{className:"min-w-[160px]",children:p.requestDate}),a(pd,{className:"min-w-[160px]",children:p.lastUpdate}),a(pd,{className:"min-w-[160px]",children:p.expirationDate}),a(pd,{className:"min-w-[140px]"})]})}),a(cd,{children:0===C.length?a(md,{children:a(hd,{colSpan:6,className:"text-center text-muted-foreground py-8",children:p.noResults})}):C.map(e=>{const r=function(e){const{t:a}=La();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),n=function(e,t){const{t:r}=La();switch(e){case 1:return{label:t.statusWaiting,icon:a(na,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:t.statusProcessing,icon:a(me,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:t.statusCompleted,icon:a(ra,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:t.statusError,icon:a($,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:t.statusExpired,icon:a(ta,{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=3===r,i=5===r;return t(md,{children:[a(hd,{className:"font-medium",children:e.reportName}),a(hd,{children:t(ss,{variant:n.variant,className:Jo("gap-1",n.className),children:[n.icon,n.label]})}),a(hd,{className:"text-sm",children:d(new Date(e.requestDate))}),a(hd,{className:"text-sm",children:d(new Date(e.lastUpdate))}),a(hd,{className:Jo("text-sm",i&&"text-destructive"),children:d(new Date(e.expirationDate))}),a(hd,{children:t(ti,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!o||N===e.id,onClick:()=>k(e),children:[N===e.id?a(M,{className:"h-4 w-4 animate-spin"}):a(Se,{className:"h-4 w-4"}),p.viewReport]})})]},e.id)})})]})})]}),a(If,{open:g,onOpenChange:v,url:b,title:y})]})}function Wf({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(If,{...n,url:o,minHeight:r})}const Hf={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 Gf({label:e,color:r,icon:n,showIcon:o,size:i="md",variant:s="filled",backgroundColor:l,className:d}){const c=Hf[i],u=o??!!n;return t("span",{className:Jo("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:Oo(r,.3),backgroundColor:"transparent"};case"ghost":return{color:r,backgroundColor:"transparent"};default:return{color:r,backgroundColor:l||Oo(r,.1)}}})(),children:[u&&n&&a(n,{size:c.icon,strokeWidth:2}),e]})}function Kf(e){return a=>e[a]}var Yf=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Yf||{}),Qf=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(Qf||{}),Jf=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Jf||{}),Xf=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(Xf||{}),Zf=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(Zf||{}),eg=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(eg||{}),ag=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(ag||{}),tg=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(tg||{}),rg=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(rg||{}),ng=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(ng||{}),og=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(og||{}),ig=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(ig||{}),sg=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(sg||{}),lg=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(lg||{}),dg=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(dg||{}),cg=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))(cg||{}),ug=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(ug||{}),mg=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))(mg||{}),pg=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(pg||{}),hg=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))(hg||{}),fg=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(fg||{}),gg=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(gg||{}),vg=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(vg||{}),bg=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(bg||{}),xg=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(xg||{}),yg=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(yg||{});const wg={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Ng={advancedFilter:"analysisDashboardsListFilter"},_g=["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"],Cg=["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 kg(e){return e?.sort((e,a)=>{if(!e?.items?.length||!a?.items?.length)return 0;return Sg(e.items[0]?.keyDate)-Sg(a.items[0]?.keyDate)})}function Sg(e){if(!e)return 0;const[a,t]=e.split("/"),r=wg[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+r}function Ag(e){return null==e?.value||""===e.value.trim()}function Eg(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function Pg(e){for(const a of Cg)if(e[a])return e[a];return null}function Dg(e){return e?Tg(e).join("&"):null}function Tg(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(...Tg({[t]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||a.push(`${t}=${r}`))}return a}const Ig=/^-?\d+(,\d{3})*(\.\d+)?$/;function Mg(e){return!!Ig.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))}function Rg(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)}const zg=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});function Lg(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 Fg=new Set([ng.Text]),Ug=new Set([ng.Text,ng.Numeric,ng.RiskMatrix,ng.Burndown,ng.PerformanceColumns]),Og=new Set([ng.Text,ng.RiskMatrix,ng.Burndown,ng.PerformanceColumns]);function jg({config:e,viewOnly:n=!1,complement:o,complementPosition:d="before-options",queryUrlBuilder:c,onRefresh:u,onExport:m,onToggleOnlyMine:p,className:h}){const{t:f}=La(),[g,v]=i(e.onlyMine??!1),b=Fg.has(e.typeId),x=!Ug.has(e.typeId),y=!Og.has(e.typeId),w=s(()=>{if(!e.jsonRules||e.typeId===ng.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:Jo("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(Es,{children:[a(Ps,{asChild:!0,children:a("span",{className:"block truncate",children:e.title})}),a(Ds,{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(ms,{children:[a(ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a(oa,{className:"h-3.5 w-3.5"})})}),t(ys,{align:"end",className:"w-48",children:[e.canUpdate&&t(ws,{onClick:()=>e.onEdit?.(e.id),children:[a(K,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!b&&t(ws,{onClick:u,children:[a(me,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),x&&t(ws,{disabled:e.noData,onClick:m,children:[a(ea,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!b&&t(ws,{disabled:!e.openQueryEnabled,onClick:()=>window.open(N,"_blank"),children:[a(fe,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),y&&t(r,{children:[a(ks,{}),t(ws,{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(ks,{}),t(ws,{onClick:()=>e.onDuplicate?.(e.id),children:[a(he,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t(ws,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a(G,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===d&&o]})]})}function $g({config:e,queryUrl:r,className:n}){return t("div",{className:Jo("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a(ce,{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===ng.Burndown;return t("div",{className:Jo("flex flex-1 flex-col items-center justify-center gap-2 p-4",r),children:[a(ds,{className:"h-10 w-10 text-muted-foreground/40"}),n&&a("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function Vg({hasRemovedColumn:r=!1,className:n}){return t("div",{className:Jo("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 qg({onRemove:e,className:r}){return t("div",{className:Jo("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a(ce,{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 Wg={[Yf.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Yf.Sum]:"Sum",[Yf.Average]:e.t("dashboard_average"),[Yf.DistinctCount]:e.t("dashboard_distinct_count"),[Yf.Max]:e.t("dashboard_max_value"),[Yf.Min]:e.t("dashboard_min_value")};function Hg({config:e,state:r,value:n,label:o,viewOnly:i=!1,onClick:s,onRefresh:l,queryUrl:d,queryUrlBuilder:c,className:u}){const{t:m}=La(),p=o??Wg[e.aggregationType??""]??"",h=function(e,a){if(null==e)return"—";const t=_g.includes(a.field),r=a.aggregationType===Yf.Count||a.aggregationType===Yf.DistinctCount;return t&&!r?zg.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:Jo("flex h-full flex-col",u),children:[a(jg,{config:e,viewOnly:i,onRefresh:l,queryUrlBuilder:c}),r===pg.Loading&&a(Bg,{}),r===pg.Loaded&&t("div",{className:Jo("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===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:d}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Gg({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:Jo("flex h-full flex-col",d),children:[a(jg,{config:e,viewOnly:o,onRefresh:i,queryUrlBuilder:l}),r===pg.Loading&&a(Bg,{}),r===pg.Loaded&&a("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),r===pg.Error&&a($g,{config:e,queryUrl:s})]})}function Kg({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=Pg(e);a&&window.open(Eg(a),"_blank")}},[d,h]);return t("div",{className:Jo("flex h-full flex-col",f),children:[a(jg,{config:e,viewOnly:i,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===pg.Loading&&a(Bg,{}),r===pg.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&&!!Pg(e);return a("tr",{className:Jo("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):Yg(e[t.columnName],t)},t.columnName))},t)})})]})}),r===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:m}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Yg(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 Qg=["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 Jg({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:Qg,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:Jo("flex h-full flex-col",v),children:[a(jg,{config:e,viewOnly:u,onRefresh:p,onExport:h,queryUrlBuilder:g}),n===pg.Loading&&a(Bg,{}),n===pg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:Xg({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===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),n===pg.Error&&a($g,{config:e,queryUrl:f}),n===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Xg({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(kt,{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(St,{dataKey:s?i:void 0,type:s?"category":"number",...m,width:s?100:60,tickFormatter:s?void 0:d}),f=a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),g=a(At,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),v=n.length>1?a(vt,{wrapperStyle:{fontSize:"11px"}}):null,b=u?(e,a)=>u(r[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t(bt,{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(xt,{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(yt,{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(wt,{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(Nt,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(_t,{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 Zg=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function ev({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:Zg,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:Jo("flex h-full flex-col",p),children:[a(jg,{config:e,viewOnly:i,onRefresh:d,onExport:c,queryUrlBuilder:m}),r===pg.Loading&&a(Bg,{}),r===pg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(Et,{children:[a(Pt,{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(Dt,{fill:h[t%h.length]},t))}),a(At,{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(vt,{wrapperStyle:{fontSize:"11px"}})]})})}),r===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:u}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function av({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:Jo("flex h-full flex-col",h),children:[a(jg,{config:e,viewOnly:l,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===pg.Loading&&a(Bg,{}),r===pg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(Tt,{data:v,margin:{top:5,right:30,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a(St,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a(St,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a(At,{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(vt,{wrapperStyle:{fontSize:"11px"}}),a(xt,{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(_t,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:i,strokeWidth:2,dot:{r:3,fill:i}})]})})}),r===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:m}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function tv({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}=La(),f=o??h("dashboard_work_done"),g=i??h("dashboard_work_planned");return t("div",{className:Jo("flex h-full flex-col",p),children:[a(jg,{config:e,viewOnly:d,onRefresh:c,queryUrlBuilder:m}),r===pg.Loading&&a(Bg,{panelType:ng.Burndown}),r===pg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(yt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a(St,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a(At,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(vt,{wrapperStyle:{fontSize:"11px"}}),a(wt,{type:"monotone",dataKey:"executedPercentage",name:f,stroke:s,fill:s,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a(wt,{type:"monotone",dataKey:"plannedPercentage",name:g,stroke:l,fill:l,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),r===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:u}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function rv({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}=La(),g=o??f("dashboard_work_done"),v=i??f("dashboard_work_planned");return t("div",{className:Jo("flex h-full flex-col",h),children:[a(jg,{config:e,viewOnly:d,onRefresh:u,queryUrlBuilder:p}),r===pg.Loading&&a(Bg,{}),r===pg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(bt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a(St,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a(At,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(vt,{wrapperStyle:{fontSize:"11px"}}),a(xt,{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(xt,{dataKey:"plannedWork",name:v,fill:l,radius:[2,2,0,0]})]})})}),r===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:m}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}function nv({config:e,state:r,rule:n,risks:o=[],matrixViewType:i=cg.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:Jo("flex h-full flex-col",h),children:[a(jg,{config:e,viewOnly:l,onRefresh:u,queryUrlBuilder:p}),r===pg.Loading&&a(Bg,{}),r===pg.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:Jo("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===cg.Quantity&&l.length>0&&t("span",{className:"text-xs font-semibold",children:[l.length," risco",1!==l.length?"s":""]}),i===cg.AllRisksList&&l.map(e=>t(Es,{children:[a(Ps,{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(Ds,{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===pg.NoData&&a(Vg,{hasRemovedColumn:e.hasRemovedColumn}),r===pg.Error&&a($g,{config:e,queryUrl:m}),r===pg.Unavailable&&a(qg,{onRemove:()=>e.onRemove?.(e.id)})]})}const ov=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[ov.Translate.toString(e),ov.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:r}=e;return a+" "+t+"ms "+r}}});function iv(e){switch(e){case ng.Bar:case ng.Column:case ng.Pie:case ng.List:case ng.Line:case ng.Area:case ng.Text:case ng.StackedColumn:return{x:4,y:2};case ng.Pareto:case ng.RiskMatrix:case ng.Burndown:case ng.PerformanceColumns:return{x:8,y:2};case ng.Numeric:return{x:1,y:1};default:return{x:2,y:2}}}function sv(e){switch(Number(e)){case ng.Area:case ng.Bar:case ng.Column:case ng.Line:case ng.Numeric:case ng.Pie:case ng.Text:return{x:1,y:1};default:return{x:2,y:2}}}function lv({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}=Gt({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:ov.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:Jo("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:Jo("dashboard-panel-drag-handle",i&&"cursor-grab active:cursor-grabbing"),...i?c:{}}),a("div",{className:"h-full",children:l})]})}function dv({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=jt($t(Bt,{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:Jo("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(Vt,{sensors:g,collisionDetection:qt,onDragEnd:x,children:a(Wt,{items:b,strategy:Ht,children:a("div",{style:y,className:Jo("relative w-full",c&&"bg-muted/30",p),children:h.map(e=>a(lv,{panel:e,columns:r,cellHeight:n,cellGap:o,allowDragging:d,children:u(e.id)},e.id))})})})}const cv={[ng.Bar]:"bar",[ng.Column]:"column",[ng.StackedColumn]:"stacked-column",[ng.Area]:"area",[ng.Line]:"line",[ng.EvolutionLine]:"evolution-line"};function uv({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=cv[e.typeId];if(h)return a(Jg,{config:e,variant:h,state:r,data:s,series:l});switch(e.typeId){case ng.Numeric:return a(Hg,{config:e,state:r,value:o});case ng.Text:return a(Gg,{config:e,state:r});case ng.List:return a(Kg,{config:e,state:r,data:n,columns:i??[]});case ng.Pie:return a(ev,{config:e,state:r,data:n});case ng.Pareto:return a(av,{config:e,state:r,data:n});case ng.Burndown:return a(tv,{config:e,state:r,data:d});case ng.PerformanceColumns:return a(rv,{config:e,state:r,data:c});case ng.RiskMatrix:return a(nv,{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 mv({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}=La(),[A,E]=i(!1),P=e.idViewType===ig.Carousel,D=s(()=>r,[r,P,o]),T=s(()=>D.map(e=>{const a=sv(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[D]),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=D.find(a=>a.id===e);if(!r)return null;const n=I(r),o=m?.(e)??{state:pg.Loaded};return t("div",{className:"flex flex-col h-full",children:[a(jg,{config:n,onRefresh:()=>{}}),a("div",{className:"flex-1 min-h-0 p-2",children:a(uv,{config:n,...o})})]})},[D,I,m,d,x,y,w]);return t("div",{className:Jo("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:Jo("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:Jo("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"})})})]})]}),P&&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:Jo("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:Jo("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(dv,{panels:T,allowDragging:d,showGridLines:d,renderPanel:R,onLayoutChange:N})})]})}function pv(e,a=dg.PtBr){const{t:t}=La();switch(a){case dg.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case dg.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function hv(e){const{t:a}=La();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const fv=[{value:bg.All,label:"Todos"},{value:bg.OnlyMine,label:e.t("dashboard_my")},{value:bg.Favorites,label:"Favoritos"}];function gv({dashboards:e,limit:n,isLoading:o=!1,language:d=dg.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}=La(),[S,A]=i(""),[E,P]=i(bg.All),[D,T]=i(null),I=l(e=>{A(e),w?.(e)},[w]),M=l(e=>{P(e),N?.(e)},[N]),R=s(()=>{let a=e;if(S){const e=S.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||pv(a,d).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(E){case bg.OnlyMine:break;case bg.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,S,E,d]);return t("div",{className:Jo("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:Jo("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:Jo("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:fv.map(e=>a("button",{onClick:()=>M(e.value),disabled:o,className:Jo("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:Jo("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:Jo("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:pv(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:hv(e.lastModified)}),a("td",{className:"px-3 py-2",children:a("span",{className:Jo("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(D===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"})]})}),D===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 vv=[{value:og.NotUpdate,label:e.t("dashboard_no_refresh")},{value:og.FiveMinutes,label:"5 minutos"},{value:og.TenMinutes,label:"10 minutos"},{value:og.FifteenMinutes,label:"15 minutos"},{value:og.ThirtyMinutes,label:"30 minutos"},{value:og.OneHour,label:"1 hora"}],bv=[{value:ig.NormalPage,label:e.t("dashboard_normal_page")},{value:ig.Carousel,label:"Carrossel"}],xv=[{value:Zf.FiveSeconds,label:"5 segundos"},{value:Zf.TenSeconds,label:"10 segundos"},{value:Zf.FifteenSeconds,label:"15 segundos"},{value:Zf.ThirtySeconds,label:"30 segundos"},{value:Zf.OneMinute,label:"1 minuto"},{value:Zf.ThreeMinutes,label:"3 minutos"},{value:Zf.FiveMinutes,label:"5 minutos"},{value:Zf.TenMinutes,label:"10 minutos"}],yv=[{value:lg.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:lg.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:lg.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],wv=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Nv({dashboard:e,initialTab:r=sg.General,isSaving:n=!1,isQualitfy:o=!1,users:d=[],groups:c=[],places:u=[],collaborators:m=[],onSave:p,onCancel:h,className:f}){const{t:g}=La(),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,P]=i(e?.responsibleId??""),[D,T]=i(e?.isActive??!0),[I,M]=i(e?.idUpdateTime??og.NotUpdate),[R,z]=i(e?.idViewType??ig.NormalPage),[L,F]=i(e?.idPageTime??Zf.FifteenSeconds),[U,O]=i(e?.idShare??lg.NotShared),[j,$]=i(e?.groups??[]),[B,V]=i(e?.places??[]),[q,W]=i(e?.collaborators??[]),H=R===ig.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:D,idUpdateTime:I,idViewType:R,idPageTime:H?L:null,idShare:U,groups:U===lg.SharedWithUsersGroupsPlacesCollaborators?j:[],places:U===lg.SharedWithUsersGroupsPlacesCollaborators?B:[],collaborators:U===lg.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[K,n,p,y,N,C,S,E,D,I,R,L,H,U,j,B,q]);return t("div",{className:Jo("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:Jo("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(sg.General),className:Jo("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===sg.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a("button",{onClick:()=>x(sg.Share),className:Jo("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===sg.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===sg.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:wv.map(e=>a("button",{onClick:()=>Y(e.key),className:Jo("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:Jo("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:Jo("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:Jo("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=>P(e.target.value),disabled:!v,className:Jo("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:Jo("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:vv.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(!D),disabled:e?.isGeneralViewUse,className:Jo("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",D?"bg-primary":"bg-muted","disabled:opacity-50"),children:a("span",{className:Jo("inline-block h-4 w-4 rounded-full bg-white transition-transform",D?"translate-x-6":"translate-x-1")})}),a("span",{className:"text-sm text-foreground",children:D?"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:Jo("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:bv.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:Jo("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:xv.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]})]}),b===sg.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:yv.map(r=>t("label",{className:Jo("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:()=>O(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===lg.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);$(a)},className:Jo("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 (",B.length,")"]}),a("select",{multiple:!0,value:B,onChange:e=>{const a=Array.from(e.target.selectedOptions,e=>e.value);V(a)},className:Jo("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:Jo("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 _v({dashboards:e,limit:r,generalView:n,language:o=dg.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:P,onRemove:D,onDuplicate:T,onShare:I,onAddPanel:M,onEditPanel:R,onRemovePanel:z,onDuplicatePanel:L,onLayoutChange:F,onSearch:U,onQuickFilterChange:O,onSetGeneralView:j,viewState:$,onViewStateChange:B,listToolbarExtra:V,viewToolbarActions:q,className:W}){const[H,G]=i({mode:"list"}),K=$??H,Y=l(e=>{B?B(e):G(e)},[B]),Q=s(()=>"view"===K.mode||"edit"===K.mode||"share"===K.mode?e.find(e=>e.id===K.dashboardId)??null:null,[e,K]),[J,X]=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!==ig.Carousel||g.length<=1)return;const e=function(e){switch(e){case Zf.FiveSeconds:return 5e3;case Zf.TenSeconds:return 1e4;case Zf.FifteenSeconds:return 15e3;case Zf.ThirtySeconds:return 3e4;case Zf.OneMinute:return 6e4;case Zf.ThreeMinutes:return 18e4;case Zf.FiveMinutes:return 3e5;case Zf.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"}),X(!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?P?.(K.dashboardId,e):E?.(e)},[K,E,P]),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:Jo("flex flex-col h-full",W),children:["list"===K.mode&&a(gv,{dashboards:e,limit:r,isLoading:d,language:o,canAdd:c,canEdit:u,canRemove:p,onOpen:ae,onEdit:ne,onShare:oe,onDuplicate:T,onRemove:D,onAdd:re,onToggleFavorite:A,onRefresh:S,onSearch:U,onQuickFilterChange:O,toolbarExtra:V,className:"flex-1"}),"view"===K.mode&&Q&&t("div",{className:"flex flex-col h-full",children:[!J&&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(mv,{dashboard:Q,panels:f,pages:g,activePageId:Z,canEdit:u||h&&!!Q.isStandard,isFullscreen:J,isLoading:d,getPanelData:v,onRefresh:k,onToggleFullscreen:()=>X(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(Nv,{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(Nv,{dashboard:Q,initialTab:"share"===K.mode?sg.Share:sg.General,users:b,groups:x,places:y,collaborators:w,isSaving:N,isQualitfy:!!Q.isStandard&&!h,onSave:ie,onCancel:se,className:"flex-1"})]})]})}function Cv(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function kv(e,a){return{id:a?.id??Cv(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function Sv(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 Av(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>Av(e,a))}:t}function Ev(e,a,t){return Av(e,e=>e.id===a?t(e):e)}function Pv(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Dv(e,a,t){const r=kv(t||"");let n=r.id;return{root:Av(e,t=>{if(t.id!==a)return t;let o=r;if(t.id===e.id){const a=Pv(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 Tv(e,a,t){if(e.id===a)return Dv(e,a,t);const r=Sv(e,a);if(!r||!r.parent)return{root:e,newId:a};const n=r.parent,o=kv(t||"",{side:r.node.side}),i=o.id;return{root:Av(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 Iv(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=Sv(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:Av(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)}),nextSelectedId:i}}function Mv(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const r=Sv(e,a);return!!r&&!!Sv(r.node,t)}(e,a,t))return e;const r=Sv(e,a);if(!r)return e;const n=(()=>{if(t===e.id){const a=Pv(e);return{...r.node,side:a.left<=a.right?"left":"right"}}const a=Sv(e,t)?.node;return{...r.node,side:a?.side}})(),o=Av(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return Av(o,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],n]})}function Rv(e,a){return Ev(e,a,e=>({...e,collapsed:!e.collapsed}))}function zv(e,a){return Av(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function Lv(e){const{value:a,defaultValue:t,onChange:r,readOnly:n}=e,o=void 0!==a,[d,c]=i(()=>t??a??kv("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=Ev(m,e,e=>({...e,text:a}));v(t,m)},[m,v]),x=l((e,a)=>{const t=Ev(m,e,e=>({...e,...a}));v(t,m)},[m,v]),y=l((e,a="")=>{const{root:t,newId:r}=Dv(m,e,a);return v(t,m),h(r),r},[m,v]),w=l((e,a="")=>{const{root:t,newId:r}=Tv(m,e,a);return v(t,m),h(r),r},[m,v]),N=l(e=>{const{root:a,nextSelectedId:t}=Iv(m,e);a!==m&&(v(a,m),h(t))},[m,v]),_=l((e,a)=>{const t=Mv(m,e,a);t!==m&&v(t,m)},[m,v]),C=l(e=>{const a=Sv(m,e);if(!a||!a.node.children?.length)return;const t=Rv(m,e);v(t,m)},[m,v]),k=l(()=>{v(zv(m,!1),m)},[m,v]),S=l(()=>{v(zv(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]),P=f.current.length>0,D=g.current.length>0,T=s(()=>p?Sv(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:P,canRedo:D}}const Fv=180,Uv=80,Ov=16,jv=60;function $v(e){const a=(e.collapsed?[]:e.children??[]).map($v);if(!a.length)return{node:e,visibleChildren:a,height:44};const t=a.reduce((e,a)=>e+a.height,0)+Ov*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function Bv(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)+Ov*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===n?t+180+Uv:t-Uv-Fv,r=d+c.height/2-22,l=Bv(c,e.node,a,r,n,o+1,i);s.push(l),d+=c.height+Ov}return l}function Vv(e){return s(()=>function(e){const a=e.collapsed?[]:e.children??[],t=a.filter(e=>"left"!==e.side).map($v),r=a.filter(e=>"left"===e.side).map($v),n=t.reduce((e,a)=>e+a.height,0)+Ov*Math.max(0,t.length-1),o=r.reduce((e,a)=>e+a.height,0)+Ov*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=jv+d,p=[],h={node:e,parent:null,x:m,y:jv+i/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let f=jv+i/2-n/2;for(const b of t){const a=f+b.height/2-22,t=Bv(b,e,m+220+Uv,a,"right",1,p);h.visibleChildren.push(t),f+=b.height+Ov}let g=jv+i/2-o/2;for(const b of r){const a=g+b.height/2-22,t=Bv(b,e,m-Uv-Fv,a,"left",1,p);h.visibleChildren.push(t),g+=b.height+Ov}const v=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:v,width:c,height:u}}(e),[e])}function qv(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 Wv=({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)?A[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)},S=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:Jo("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:S},children:[x&&a(x,{className:Jo("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:Jo("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(Es,{children:[a(Ps,{asChild:!0,children:a("button",{type:"button",onClick:e=>e.stopPropagation(),className:Jo("shrink-0 rounded p-0.5 hover:bg-muted/40",b&&"hover:bg-primary-foreground/10"),"aria-label":v.note,children:a(We,{className:"h-3.5 w-3.5 opacity-70"})})}),a(Ds,{className:"max-w-xs whitespace-pre-line",children:v.note})]}),w&&a("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:Jo("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(J,{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(ia,{className:"h-3 w-3"})})]})},Hv=({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"})},Gv=({label:e,icon:r,onClick:n,disabled:o})=>t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{type:"button",variant:"ghost",size:"icon",onClick:n,disabled:o,"aria-label":e,className:"h-8 w-8",children:r})}),a(Ds,{children:e})]}),Kv=e=>{const{t:r}=La();return t("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a(Gv,{label:r("mind_map_add_child"),icon:a(sa,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a(Gv,{label:r("mind_map_add_sibling"),icon:a(J,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a(Gv,{label:r("mind_map_delete_node"),icon:a(G,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a(pi,{orientation:"vertical",className:"mx-1 h-5"}),a(Gv,{label:r("mind_map_expand_all"),icon:a(la,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a(Gv,{label:r("mind_map_collapse_all"),icon:a(da,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a(pi,{orientation:"vertical",className:"mx-1 h-5"}),a(Gv,{label:r("mind_map_zoom_out"),icon:a(ca,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a(Gv,{label:r("mind_map_zoom_in"),icon:a(ua,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a(Gv,{label:r("mind_map_fit_to_screen"),icon:a(ma,{className:"h-4 w-4"}),onClick:e.onFit}),a(pi,{orientation:"vertical",className:"mx-1 h-5"}),a(Gv,{label:r("mind_map_undo"),icon:a(pa,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a(Gv,{label:r("mind_map_redo"),icon:a(ha,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a("div",{className:"flex-1"}),a(Gv,{label:r("mind_map_export_json"),icon:a(ea,{className:"h-4 w-4"}),onClick:e.onExportJson}),a(Gv,{label:r("mind_map_export_image"),icon:a(Ve,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function Yv(e){return JSON.stringify(e,null,2)}function Qv(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=>Qv(e)):void 0;return kv(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 Jv(e){return Qv(JSON.parse(e))}const Xv=({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}=La(),b=Lv({value:e,defaultValue:r,onChange:o,readOnly:d}),x=Vv(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 qv("up",d);if("ArrowDown"===i.key)return i.preventDefault(),void qv("down",d);if("ArrowLeft"===i.key)return i.preventDefault(),void qv("left",d);if("ArrowRight"===i.key)return i.preventDefault(),void qv("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 P=b.selectedId,D=b.selectedNode,T=P===b.root.id,I=n.useRef(null),M=e=>a=>{if(d)return;const t=I.current;if(!t||t===e)return;const r=Sv(b.root,t);r&&Sv(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(As,{children:t("div",{ref:w,tabIndex:0,role:"tree","aria-label":v("mind_map_aria_label"),className:Jo("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(Kv,{canAddChild:!!D&&!d,canAddSibling:!!D&&!d,canDelete:!!D&&!T&&!d,canUndo:b.canUndo&&!d,canRedo:b.canRedo&&!d,onAddChild:()=>{if(!P)return;const e=b.addChild(P,"");k(e)},onAddSibling:()=>{if(!P)return;if(T){const e=b.addChild(P,"");return void k(e)}const e=b.addSibling(P,"");k(e)},onDelete:()=>{P&&!T&&b.removeNode(P)},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)}(Yv(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(Hv,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),x.nodes.map(e=>{return a(Wv,{layout:e,selected:P===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})]})})]})})},Zv=({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:P,onViewModeChange:D,listCardRenderer:T,gridCardRenderer:I,showViewToggle:M=!1})=>{const{setSearchVisible:R}=rd(),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)}),U=P||"grid",O="list"===U,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"}[O?1:A],$=z&&L?a(Qd,{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:U,onViewModeChange:D,showViewToggle:M,availableViewModes:["list","grid"]}):null;return n.isLoading?t("div",{className:"flex flex-col h-full",children:[$,a("div",{className:"flex-1 overflow-auto p-4",children:a(vd,{count:6})})]}):0===n.entities.length?t("div",{className:"flex flex-col h-full",children:[$,a("div",{className:"flex-1 flex items-center justify-center",children:a(Nd,{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:[$,a("div",{className:"flex-1 overflow-auto p-4",children:a("div",{className:Jo("grid gap-4",j),children:n.entities.map(e=>{const m=(e=>{const{t:a}=La();return O&&T?T(e):!O&&I?I(e):E?E(e):null})(e);return t(kd,{children:[a(Sd,{asChild:!0,children:m?a("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:m}):a(si,{className:Jo("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",p&&n.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",O&&"flex-row"),onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:t(ui,{className:Jo("p-4",O&&"flex items-center gap-4 w-full"),children:[p&&a("div",{className:Jo(O?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a(Jd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),O?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($d,{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(Jd,{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:Jo("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($d,{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(Md,{className:"w-[160px]",children:a(jd,{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 eb({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}=La(),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,$=j?new Set(E):F,B=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:V,isDragging:q,activeColumn:W,handleMouseDown:H}=qd({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=ec({enabled:_&&!!C,onReorder:C??(()=>{})}),K=s(()=>{if(w){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,w,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(qs,{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(ld,{className:Jo("table-fixed w-full",f),children:[a(dd,{className:"sticky top-0 bg-background z-10",children:t(md,{children:[S&&a(pd,{className:"w-[40px]"}),g&&a(pd,{className:"w-[40px]",children:a(ns,{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(pd,{className:Jo(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?ne:oe,{size:14,className:"ml-1"}))]}):a("span",{className:"font-medium",children:e.header}),o&&a(Cd,{direction:"horizontal",onMouseDown:a=>H(String(e.key),a),isDragging:i})]},String(e.key));var p}),Y&&a(pd,{className:"w-[80px] text-right",children:R??z("actions","Ações")})]})}),a(cd,{children:e.map(e=>{const n=S&&$.has(e.id);return t(o.Fragment,{children:[t(md,{onClick:()=>u?.(e),className:Jo(u?"cursor-pointer":"","relative","inline"===I&&"group"),children:[S&&a(hd,{className:"w-[40px] px-2",children:a("button",{onClick:a=>{a.stopPropagation(),B(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(hd,{children:a(ns,{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(hd,{className:t.className,children:a(_d,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),Y&&a(hd,{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(md,{className:"bg-muted/30 hover:bg-muted/30",children:a(hd,{colSpan:Q,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:A(e)})})})]},e.id)})})]})})}function ab({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}=La(),p=s(()=>{const a=[];return e&&i&&a.push({key:"edit",icon:q,label:m("edit","Editar"),onClick:e,variant:"default"}),n&&a.push({key:"toggle-status",icon:o?W:H,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:G,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(As,{delayDuration:200,children:t(ms,{children:[a(ps,{asChild:!0,children:a(ti,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a(E,{size:"compact"===u?14:16})})}),a(ys,{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(ws,{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(ti,{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 tb({searchValue:e="",onSearchChange:r,customFilters:n=[],onClearFilters:o,showClearButton:i=!0,layout:s="horizontal"}){const{t:l}=La(),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(ni,{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(ti,{variant:"ghost",size:"sm",onClick:o,className:"h-9 px-3 whitespace-nowrap",children:[a(P,{size:14,className:"mr-1"}),l("clear_filters","Limpar filtros")]})]})}function rb(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 nb({children:e,itemId:t,enableDrag:r,onDragStartCell:n,onDragEndCell:o,onDragOverCell:i,onDropCell:s,className:l}){return a(hd,{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 ob({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(md,{className:Jo(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(nb,{...I,children:t("div",{className:"flex items-center gap-2",style:{paddingLeft:`${S}px`},children:[p&&a(ns,{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(be,{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(nb,{...I,className:Jo("text-center",r.className),children:r.hoverContent?t(Gm,{openDelay:200,children:[a(Km,{asChild:!0,children:a("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:i})}),a(Ym,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):i},String(r.key))}),u&&a(nb,{...I,className:"text-right",children:a("div",{onClick:e=>e.stopPropagation(),className:Jo("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(ob,{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 ib({onDrop:r,isDragOver:n,onDragOver:o,onDragLeave:i,label:s}){return t("div",{className:Jo("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(fa,{className:"h-4 w-4"}),s??e.t("leadership_make_root_short")]})}function sb({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:P,actionsWidth:D=20,nameMinWidth:T=200}){const[I,M]=i(null),[R,z]=i(null),[L,F]=i(!1),[U,O]=i(1),j=u(null),$=u([]),B=u(null),V=o.useMemo(()=>new Set(N??[]),[N]),q=o.useMemo(()=>{if(!I||!r)return new Set;const e=$.current.length>0?$.current:[I],a=function(e,a){const t=new Set;for(const r of a)rb(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,$.current=[],B.current=null,M(null),z(null),F(!1),O(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];j.current=e,$.current=t,B.current=null,M(e),O(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)?z(null):(B.current=e,z(e))},[]),Q=l((e,a)=>{a.preventDefault(),a.stopPropagation();const t=W.current.has(e)?B.current:e;if(!t)return void H();let r=$.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]),J=l(e=>{e.preventDefault(),e.stopPropagation();let a=$.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]),X=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??B.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(be,{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:Jo("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(ib,{onDrop:J,isDragOver:L,onDragOver:X,onDragLeave:()=>F(!1),label:P}),t(ld,{children:[a(dd,{children:t(md,{children:[a(pd,{className:"text-left",style:{minWidth:T},children:t("div",{className:"flex items-center gap-2",children:[w&&a(ns,{checked:k??!1,onCheckedChange:()=>C?.()}),d]})}),n.map(e=>a(pd,{className:Jo("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),f&&a(pd,{className:"text-right",style:{width:D},children:g})]})}),a(cd,{children:r.map(e=>a(ob,{item:e,level:0,columns:n,nameKey:s,iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,rowActionsVariant:v,enableSelection:w,selectedIds:V,onSelectItem:_,enableRowDrag:S,draggedId:I,dragOverId:R,onDragStartCell:K,onDragEndCell:H,onDragOverCell:Y,onDropCell:Q,dragCount:U},e.id))})]})]})}function lb(e){const a=Ga();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 db(e,a){const t=lb({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}}const cb="true"===import.meta.env.VITE_SHOW_EDIT_PROFILE,ub=o.memo(({variant:e="card",className:n="",selectedUnit:l,onUnitChange:d})=>{const{t:c}=La(),{user:u,companies:m,alias:p,isAuthenticated:h,logout:f,switchUnit:g}=rd(),{role:v}=wu(),b=v?.name||null,x=m?.[0]||null,y=p?m?.find(e=>e.alias===p):x,w=m||[],N=l||y||x||x,[_,C]=o.useState(0);o.useEffect(()=>{const e=()=>C(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const k=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&v=${_}`},[u?.id,_]),S=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=96&v=${_}`},[u?.id,_]),A=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]),E=o.useCallback(e=>{d?d(e):g(e)},[d,g]),P=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]),[T,I]=i(!1);if(!h||!u)return null;const M=()=>t(r,{children:[t("div",{className:"flex items-center space-x-3",children:[a("div",{className:"flex-shrink-0",children:t($c,{className:"w-10 h-10",children:[k&&a(Bc,{src:k,alt:u.name||c("user_photo")}),a(Vc,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:A||a(be,{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(ve,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-sm font-medium",children:N.name})]})}),P.length>1&&t("div",{className:"mt-2",children:[t("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",P.length]}),t("div",{className:"flex flex-wrap gap-1",children:[P.slice(0,3).map(e=>a(ss,{variant:e.alias===N?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>E(e),children:e.name},e.alias)),P.length>3&&t(ss,{variant:"outline",className:"text-xs",children:["+",P.length-3]})]})]})]});return"dropdown"===e?t(r,{children:[t(ms,{children:[a(ps,{asChild:!0,children:a(ti,{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($c,{className:"w-8 h-8 border border-primary-foreground/30",children:[k&&a(Bc,{src:k,alt:u.name||c("user_photo")}),a(Vc,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:A||a(be,{className:"h-4 w-4"})})]}),a(D,{className:"h-4 w-4"})]})})}),t(ys,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t(gs,{children:[t(bs,{children:[a(me,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a(xs,{children:P.map(e=>t(ws,{onClick:()=>E(e),className:e.alias===N?.alias?"bg-muted":"",children:[a(ve,{className:"mr-2 h-4 w-4"}),e.name,e.alias===N?.alias&&a(ss,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),cb&&t(r,{children:[a(ks,{}),t(ws,{onClick:()=>I(!0),children:[a(ga,{className:"mr-2 h-4 w-4"}),c("edit_profile","Editar Perfil")]})]}),a(ks,{}),t(ws,{onClick:f,children:[a(xe,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),cb&&a(ou,{open:T,onOpenChange:I,user:u,userPhotoUrl:S,userInitials:A})]}):t(si,{className:n,children:[a(li,{children:a(di,{className:"text-lg",children:c("user_info")})}),t(ui,{className:"space-y-4",children:[a(M,{}),a(pi,{}),t(ti,{variant:"outline",onClick:f,size:"sm",className:"w-full",children:[a(xe,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),mb=d({});function pb({children:e,config:t}){const r=s(()=>{const e=Zt(),a=t?.appName?e?`${t.appName} (Dev)`:t.appName:void 0;return{navigation:t?.navigation,appName:a}},[t?.navigation,t?.appName]);return a(mb.Provider,{value:r,children:e})}function hb(){return c(mb)}function fb(){const e=Ka(),{navigation:a}=hb();return gb(a,e.pathname)}function gb(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 vb(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 bb({appName:e}){const[n,o]=i(!1),{association:s}=wu(),l=kr({isQualitfy:s?.isQualitfy,isMetroex:s?.isMetroex});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:l,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(om,{open:n,onOpenChange:o})]})}const xb=p(function({actions:r}){const n=Ka(),o=Ga(),{navigation:s,appName:d}=hb(),c=gb(s,n.pathname),{metadata:u,headerActions:p}=lu(),{setOpenMobile:h}=Zp(),{companies:f,alias:g,isSearchVisible:v,clearSearch:b,refreshData:x,switchUnit:y}=rd(),w=g?f?.find(e=>e.alias===g)||f?.[0]||null:f?.[0]||null,[N,_]=Wa(),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,E]=vb(k,ir.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 D=s?.find(e=>e.path===n.pathname)||s?.find(e=>n.pathname.startsWith(e.path+"/")),T=u.title||c,I=u.subtitle||D?.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(ti,{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(va,{size:20})}),a("div",{className:"hidden md:flex items-center flex-shrink-0",children:a(bb,{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(Qa,{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(ni,{placeholder:"Pesquisar",value:k,onChange:e=>(e=>{S(e)})(e.target.value),className:"w-full pl-10 pr-8"}),k&&a(ti,{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:()=>{E(),S("");const e=new URLSearchParams(N);e.delete("search"),e.delete("page"),_(e)},title:e.t("clear_search"),children:a(P,{size:14})})]}),a(ti,{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(me,{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(ti,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>Bo(import.meta.env.VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a(yf,{}),a("div",{className:"text-sm",children:a(ub,{variant:"dropdown",selectedUnit:w,onUnitChange:C})})]})]})})}),yb=({key:e,enabled:a,checkFn:t,staleTime:r=3e5,gcTime:n=6e5})=>$a({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:r,gcTime:n,retry:0,refetchOnWindowFocus:!1});function wb({config:e,isCollapsed:n=!1,isDisabled:o=!1,className:i}){const{t:s}=La(),{actions:l,triggerLabel:d="Criar",triggerIcon:c=J,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(ti,{onClick:e.onClick,disabled:o||e.disabled,className:Jo("justify-center px-2 w-full",i),variant:"outline",size:"default",children:a(r,{className:"h-4 w-4 shrink-0"})});return t(Es,{children:[a(Ps,{asChild:!0,children:n}),a(Ds,{side:"right",children:a("p",{children:e.label})})]})}return a(lf,{label:e.label,onClick:e.onClick,icon:r,actions:s,variant:"outline",disabled:o||e.disabled,className:Jo("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(ti,{onClick:e.onClick,disabled:s,className:Jo("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(Es,{children:[a(Ps,{asChild:!0,children:d}),a(Ds,{side:"right",children:a("p",{children:e.label})})]}):d}const p=a(ti,{disabled:o,className:Jo("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(ms,{children:[a(ps,{asChild:!0,children:n?t(Es,{children:[a(Ps,{asChild:!0,children:p}),a(Ds,{side:"right",children:a("p",{children:d})})]}):p}),a(ys,{align:"start",side:n?"right":"bottom",className:"w-56 bg-popover",children:l.map(e=>{const r=e.icon;return t(ws,{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 Nb="forlogic-sidebar-pinned",_b=()=>{try{const e=localStorage.getItem(Nb);return!!e&&JSON.parse(e)}catch{return!1}};function Cb({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 kb=d(void 0);function Sb({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(kb.Provider,{value:p,children:e})}function Ab(){const e=c(kb);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Eb(){const{hasOpenModal:e}=Ab();return e}const Pb="2.4.3";function Db({config:e,customContent:r,resizable:n=!1,minWidth:o=224,maxWidth:s=384}={}){const{t:d}=La(),{open:c,setOpen:u,setOpenMobile:p}=Zp(),h=Ka(),{alias:f,user:g}=rd(),{appName:v}=hb(),{hasOpenModal:b}=Ab(),[x,y]=i(_b),w=sd(),N=!!w||c,_=l(()=>{w&&p(!1)},[w,p]),C=n?Cb({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(ah,{collapsible:"icon",className:Jo("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(As,{children:a(wb,{config:e.moduleActions,isCollapsed:!N,isDisabled:b})})}),a(dh,{className:Jo(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||a(ch,{className:"p-0",children:a(ph,{children:a(hh,{className:"gap-1",children:a(As,{children:e?.navigation?.map((e,r)=>{if("separator"===e.type)return a(lh,{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}=yb({key:o,enabled:Boolean(e.permissionCheck&&f&&g?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!i,c=s?M:l?Ke:e.icon;l?d("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?N?a(Pu,{defaultOpen:!0,className:"group/collapsible",children:t(fh,{children:[a(Du,{asChild:!0,children:a(vh,{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(Tu,{children:a(wh,{children:e.children.map((e,t)=>a(n,{item:e,index:t},e.path))})})]})},e.path):a(fh,{children:t(Es,{children:[a(Ps,{asChild:!0,children:a("div",{className:Jo("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(Ds,{side:"right",children:a("p",{children:e.label})})]})},e.path):a(fh,{children:l||s?t(Es,{children:[a(Ps,{asChild:!0,children:N?a(vh,{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(Ds,{side:"right",children:a("p",{children:s?"Verificando acesso...":d("restricted_access")})})]}):N?a(vh,{asChild:!0,isActive:k(e.path),size:"default",children:t(Qa,{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(Es,{children:[a(Ps,{asChild:!0,children:a(Qa,{to:e.path,onClick:_,className:Jo("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(Ds,{side:"right",children:a("p",{children:e.label})})]})},e.path)};return a(n,{item:e,index:r},e.path)})})})})})}),!w&&t("div",{className:Jo("mt-auto pb-4 pt-2 flex items-center gap-2",N?"justify-between px-1":"justify-center flex-col"),children:[N&&t("span",{className:"text-[10px] font-mono text-muted-foreground/70 select-text truncate",title:`forlogic-core v${Pb}`,children:["v",Pb]}),!N&&t(Es,{children:[a(Ps,{asChild:!0,children:t("span",{className:"text-[9px] font-mono text-muted-foreground/60 select-text",children:["v",Pb.split(".").slice(0,2).join(".")]})}),a(Ds,{side:"right",children:t("p",{children:["forlogic-core v",Pb]})})]}),t(Es,{children:[a(Ps,{asChild:!0,children:a("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!x;y(e),(e=>{try{localStorage.setItem(Nb,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?se:O,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a(Ds,{side:"right",children:a("p",{children:c?"Recolher":"Expandir"})})]})]}),n&&C&&N&&a("div",{ref:C.dragRef,onMouseDown:C.handleMouseDown,className:Jo("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")})]})}function Tb(e){if("string"!=typeof e)return;return e.trim()||void 0}function Ib(){const{alias:e,isAuthenticated:a,isLoading:t,selectedUnit:r}=rd(),n=r?.id??null,o=!!yl.getAccessToken(),i=function(e,a){const t=Tb(a);if(t)return t;const r=yl,n=Tb(r.getCurrentCompanyId?.());if(n)return n;const o=yl.extractTokenData(),i=Tb(o?.companyId)??Tb(o?.company_id);if(i)return i;if(e){const a=Tb(yl.getCompanyId(e));if(a)return a}}(e,n),s=!!e&&!!a&&o,l=s&&!!i,[,d]=g(e=>e+1,0);m(()=>{if(!a||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[a,o,i]);let c=null;return t?c="Carregando autenticação...":a?e?o?i||(c="Aguardando unidade ativa..."):c="Aguardando token de acesso Qualiex...":c="Aguardando alias...":c="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!t,isAuthenticated:!!a,isReadyForQualiex:s,isReadyForQualiexWithCompany:l,isWaitingCompanyId:!!a&&o&&!i,waitingReason:c}}async function Mb(e,a){const t=await Kc(`${qc()}/api/common/v1/updates/userView/${a}`,e),r=await t.json(),n=r?.data??r;return Array.isArray(n)?n:[]}async function Rb(e,a,t,r){const n=void 0===r?"undefined":String(r),o={id:a,idUpdateType:t};void 0!==r&&(o.liked=r),await Kc(`${qc()}/api/common/v1/Updates/userVisualized/${t}/${n}`,e,{method:"POST",body:JSON.stringify(o)})}const zb=3e5;function Lb(){const{alias:e,isReadyForQualiex:a}=Ib();return $a({queryKey:["user-updates","bar",e],queryFn:()=>Mb(e,1),enabled:a,staleTime:zb})}function Fb(){const{alias:e,isReadyForQualiex:a}=Ib();return $a({queryKey:["user-updates","dialog",e],queryFn:()=>Mb(e,2),enabled:a,staleTime:zb})}function Ub({item:e,onDismiss:r}){const{t:n}=La(),o=e.text||e.title,i=e.color||"hsl(var(--primary))";return t("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:i},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[o,a(fe,{className:"h-3.5 w-3.5"})]}):a("span",{children:o}),a("button",{type:"button",onClick:()=>r(e.id),"aria-label":n("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:a(P,{className:"h-4 w-4"})})]})}function Ob(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 jb(e,a){const t=Ob(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function $b(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function Bb(e,a){const t=$b(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function Vb(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 Wb(e,a,t){switch(a||qb(e)){case"youtube":return jb(e,t);case"vimeo":return Bb(e,t);default:return e}}function Hb({item:e,open:r,onClose:n}){const{t:o}=La(),[s,l]=i(!1),[d,c]=i(!1);m(()=>{l(!1),c(!1)},[e.id]);const u=e.countLiked+(s?1:0);return a(ki,{open:r,onOpenChange:e=>{e||n({liked:s,doNotShowAgain:d})},children:t(Ti,{size:"md",children:[a(Ii,{showSeparator:!0,children:a(zi,{style:e.color?{color:e.color}:void 0,children:e.title})}),t(Mi,{children:[(()=>{const t=e.urlVideo??e.videoUrl??e.url??"",r=t?Ob(t):null;return r?a("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:a("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),a("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t(Ri,{className:"!justify-between items-center",children:[t("div",{className:"flex items-center gap-2",children:[a("button",{type:"button",onClick:()=>l(e=>!e),"aria-pressed":s,"aria-label":o("updates_dialog_like","Curtir"),className:Jo("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",s?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:a(ba,{className:Jo("h-4 w-4",s&&"fill-current")})}),a("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t("div",{className:"flex items-center gap-4",children:[t("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[a(ns,{checked:d,onCheckedChange:e=>c(!0===e)}),o("updates_dialog_do_not_show_again","Não exibir novamente")]}),a(ti,{variant:"ghost",onClick:()=>n({liked:s,doNotShowAgain:d}),children:o("updates_dialog_close","Fechar")})]})]})]})})}function Gb(e){return e&&e.trim()?e.trim():"anon"}function Kb(e){try{const a=localStorage.getItem(e);if(!a)return new Set;const t=JSON.parse(a);return new Set(Array.isArray(t)?t.map(String):[])}catch{return new Set}}function Yb(e,a){try{localStorage.setItem(e,JSON.stringify(Array.from(a)))}catch{}}function Qb(){const{alias:e}=Ib(),{data:n=[]}=Lb(),{data:o=[]}=Fb(),l=s(()=>function(e){return`updates.bar.dismissed.${Gb(e)}`}(e),[e]),d=s(()=>function(e){return`updates.dialog.seen.${Gb(e)}`}(e),[e]),[c,u]=i(()=>Kb(l)),[p,h]=i(()=>Kb(d)),[f,g]=i(new Set),[v,b]=i(0);if(m(()=>{u(Kb(l)),h(Kb(d)),g(new Set),b(0)},[l,d]),!e)return null;const x=n.find(e=>!c.has(e.id)),y=o.filter(e=>!p.has(e.id)&&!f.has(e.id))[v];return t(r,{children:[x&&a(Ub,{item:x,onDismiss:async a=>{const t=new Set(c);t.add(a),u(t),Yb(l,t);try{await Rb(e,a,1)}catch{}}}),y&&a(Hb,{item:y,open:!0,onClose:async({liked:a,doNotShowAgain:t})=>{if(!y)return;const r=y.id;if(!t)return g(e=>{const a=new Set(e);return a.add(r),a}),void b(0);const n=new Set(p);n.add(r),h(n),Yb(d,n),b(0);try{await Rb(e,r,2,a)}catch{}}})]})}const Jb=p(function({children:e,sidebar:r,sidebarConfig:n,showHeader:o=!0,showSidebar:i=!0}){const d=s(()=>i?r||a(Db,{config:n}):null,[r,n,i]),c=s(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),p=u(null),h=u(null),f=l(()=>{if(p.current&&h.current){const e=p.current.offsetHeight;h.current.style.setProperty("--header-height",`${e}px`)}},[]);return m(()=>{f();const e=new ResizeObserver(f);return p.current&&e.observe(p.current),()=>e.disconnect()},[f]),a(pb,{config:n,children:a(su,{children:a(eh,{defaultOpen:!1,style:c,children:t("div",{ref:h,className:"flex flex-col h-screen w-full overflow-hidden",children:[o&&t("div",{ref:p,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[a(xb,{}),a(Qb,{})]}),t("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[d,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 Xb({open:e,appName:n}){const[o,s]=i(!1),{association:l}=wu(),d=kr({isQualitfy:l?.isQualitfy,isMetroex:l?.isMetroex});return t(r,{children:[a(ih,{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:d,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:Sr.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a(om,{open:o,onOpenChange:s})]})}function Zb({title:e,subtitle:r,children:n,className:o,hasHeader:i=!0}){const s=e||r;return t("div",{className:Jo("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:Jo("p-6",!i&&s&&"pt-4"),children:n})]})}function ex({breadcrumbs:e,children:r,className:o}){return t("div",{className:Jo("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",o),children:[e&&e.length>0&&a(Nm,{className:"mb-4",children:a(_m,{children:e.map((r,o)=>{const i=o===e.length-1;return t(n.Fragment,{children:[o>0&&a(Am,{}),a(Cm,{children:i||!r.href?a(Sm,{children:r.label}):r.asChild&&r.children?a(km,{asChild:!0,children:r.children}):a(km,{asChild:!0,children:a(Qa,{to:r.href||"/",children:r.label})})})]},`${r.label}-${o}`)})})}),a("div",{className:"space-y-6",children:r})]})}const ax=(e={})=>{const{enabled:a=!0}=e,{alias:t}=rd();return $a({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=Il(),{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(!Fl.handleError(r))throw r;return[]}return a||[]},enabled:a&&!!t})};function tx({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 rx(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]),P=l(async()=>{N()&&!p&&(x?await E():c(e=>Math.min(e+1,v-1)))},[N,p,x,v,E]),D=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:P,back:D,goTo:T,canProceed:_,canGoBack:C,setData:k,updateField:S,reset:A,complete:E,setLoading:I,progress:w,stepIndex:d,totalSteps:v}}function nx(...e){return Object.assign({},...e)}const ox=()=>{const{locale:e,timezone:a}=Eu(),t=No;return{formatDatetime:r=>zo(r,t,a,e),formatDate:t=>Lo(t,e,a),locale:e,timezone:a,datetimeFormat:t}};class ix{static async sendEmail(e){const a=Il(),{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 sx=ix,lx=Kt.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),dx=Kt.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),cx=Kt.string().uuid("UUID inválido"),ux=Kt.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),mx=(e=1e3)=>Kt.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),px=Kt.object({page:Kt.coerce.number().int().min(1).default(1),pageSize:Kt.coerce.number().int().min(1).max(500).default(50)});function hx(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 k.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 k.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 k.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 k.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),k.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw k.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function fx({value:n,onChange:o,onSubmit:l,onCancel:d,uploadFunction:c,deleteFunction:m,uploadOptions:p}){const{t:h}=La(),[f,g]=i(n||{inputType:"url",controls:!0}),v=u(null),b=u(null),{upload:x,uploading:y}=hx({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["video/*"],maxSize:104857600}}),{upload:w,uploading:N}=hx({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["image/*"],maxSize:5242880}}),_=s(()=>qb(f.videoUrl||Vb(f.embedCode)||""),[f.videoUrl,f.embedCode]),C=(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(ii,{children:h("input_type")}),t(Ki,{value:f.inputType||"url",onValueChange:e=>C("inputType",e),children:[a(Ji,{children:a(Qi,{})}),t(es,{children:[a(ts,{value:"url",children:"URL"}),a(ts,{value:"upload",children:h("file_upload")}),a(ts,{value:"embed",children:h("embed_code")})]})]})]}),"upload"===f.inputType&&c&&t("div",{className:"space-y-2",children:[a(ii,{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(ti,{type:"button",variant:"outline",onClick:()=>v.current?.click(),disabled:y,children:t(r,y?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(ii,{children:h("embed_code")}),a(os,{placeholder:h("paste_embed_code"),value:f.embedCode||"",onChange:e=>C("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),c&&t("div",{className:"space-y-2",children:[a(ii,{children:"Thumbnail"}),t("div",{className:"flex gap-2",children:[a(ni,{type:"url",placeholder:"URL da thumbnail",value:f.thumbnail||"",onChange:e=>C("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(ti,{type:"button",variant:"outline",onClick:()=>b.current?.click(),disabled:N,children:t(r,N?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(ii,{htmlFor:"title",children:"Título"}),a(ni,{id:"title",placeholder:h("video_title"),value:f.title||"",onChange:e=>C("title",e.target.value)})]}),t("div",{className:"flex gap-6",children:[t("div",{className:"flex items-center gap-2",children:[a(ns,{id:"autoplay",checked:f.autoplay||!1,onCheckedChange:e=>C("autoplay",!0===e)}),a(ii,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t("div",{className:"flex items-center gap-2",children:[a(ns,{id:"controls",checked:!1!==f.controls,onCheckedChange:e=>C("controls",!0===e)}),a(ii,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t("div",{className:"space-y-2",children:[a(ii,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const r=f.videoUrl||Vb(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"===_?jb(r,f.autoplay):Bb(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(ti,{variant:"outline",onClick:d,children:"Cancelar"}),a(ti,{onClick:()=>{f.videoUrl||f.embedCode?l(f):k.error("Erro",{description:h("no_video_selected")})},disabled:!(f.videoUrl||f.embedCode),children:"Salvar"})]})]})}function gx({content:r,className:n="",style:o}){const i=r.videoUrl||Vb(r.embedCode)||"";if(!i)return null;const s=qb(i);return a(si,{className:`overflow-hidden my-4 ${n}`,style:o,children:t(ui,{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?jb(i,r.autoplay):Bb(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 vx({value:e,onChange:n,onSubmit:o,onCancel:s,uploadFunction:l,deleteFunction:d,uploadOptions:c}){const{t:m}=La(),[p,h]=i(e||{alignment:"center",allowDownload:!1}),f=u(null),{upload:g,uploading:v}=hx({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(ii,{children:"URL"}),t("div",{className:"flex gap-2",children:[a(ni,{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(ti,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:v,children:t(r,v?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(ii,{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(ii,{htmlFor:"caption",children:"Legenda"}),a(os,{id:"caption",placeholder:"Legenda",value:p.caption||"",onChange:e=>b("caption",e.target.value),rows:2})]}),t("div",{className:"space-y-2",children:[a(ii,{htmlFor:"alt",children:m("alt_text")}),a(ni,{id:"alt",placeholder:m("alt_text"),value:p.alt||"",onChange:e=>b("alt",e.target.value)})]}),t("div",{className:"space-y-2",children:[a(ii,{children:"Alinhamento"}),t(Ki,{value:p.alignment||"center",onValueChange:e=>b("alignment",e),children:[a(Ji,{children:a(Qi,{})}),t(es,{children:[a(ts,{value:"left",children:"Esquerda"}),a(ts,{value:"center",children:"Centro"}),a(ts,{value:"right",children:"Direita"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(ii,{htmlFor:"width",children:"Largura"}),a(ni,{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(ii,{htmlFor:"height",children:"Altura"}),a(ni,{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(ns,{id:"allowDownload",checked:p.allowDownload||!1,onCheckedChange:e=>b("allowDownload",!0===e)}),a(ii,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a(ti,{variant:"outline",onClick:s,children:"Cancelar"}),a(ti,{onClick:()=>{p.imageUrl?o(p):k.error("Erro",{description:m("no_image_selected")})},disabled:!p.imageUrl,children:"Salvar"})]})]})}function bx({content:e,className:r="",style:n}){const{t:o}=La();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(ea,{className:"h-4 w-4"}),"Baixar imagem"]})]})})}function xx(e,a){return e/a}function yx(e,a,t,r){const n=xx(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 wx(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 Nx(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 _x(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const Cx=["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 kx(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 Sx(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}function Ax({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}=La(),S=u(null),[A,E]=i(null),[D,T]=i(null),[I,M]=i(!1),R=A||e,z=A?.name||e?.name||"",L=A?.size||e?.size;z&&Sx(z);const F=r||z,U=c&&!A&&!!e,O=m&&!A&&!!e,j=!!D||!!b||f&&g&&!R,$=!!R,B=l(e=>{if(Cx.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=Sx(e.name);if(!n.includes(a))return{type:"extension",message:o}}return null},[s,d,n,o]),V=l(e=>{const a=e.target.files?.[0];if(!a)return;const t=B(a);if(t)return T(t),E(null),void(S.current&&(S.current.value=""));T(null),E(a),x?.(a),S.current&&(S.current.value="")},[B,x]),q=l(e=>{if(e.preventDefault(),e.stopPropagation(),v)return;const a=e.dataTransfer.files?.[0];if(!a)return;const t=B(a);if(t)return T(t),void E(null);T(null),E(a),x?.(a)},[v,B,x]),W=l(e=>{e.preventDefault(),e.stopPropagation()},[]),H=l(()=>{w?.(),S.current?.click()},[w]),G=l(()=>{E(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]),J=(()=>{if(b)return b;if(!D)return f&&g&&!R?k("required_field"):null;switch(D.type){case"extension":return D.message||k("sign_file_not_allowed");case"forbidden-type":return k("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${kx(s)}`;case"max-size":return`Tamanho máximo: ${kx(d)}`;default:return k("file_error")}})();return t("div",{className:Jo("space-y-1",C),children:[a("div",{className:Jo("rounded-md border border-dashed transition-colors",$&&"border-solid border-border",!$&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",j&&"border-destructive border-solid",v&&"opacity-50 pointer-events-none"),children:t("div",$?{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(We,{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:kx(L)}),t("div",{className:"flex items-center gap-0.5",children:[U&&N&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:I,onClick:K,children:a(ea,{className:"h-3.5 w-3.5 text-primary"})})}),a(Ds,{children:"Download"})]}),O&&_&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Y,children:a(Se,{className:"h-3.5 w-3.5 text-primary"})})}),a(Ds,{children:"Visualizar"})]}),p&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,children:a(me,{className:"h-3.5 w-3.5 text-primary"})})}),a(Ds,{children:"Substituir"})]}),h&&t(Es,{children:[a(Ps,{asChild:!0,children:a(ti,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:G,children:a(P,{className:"h-3 w-3 text-muted-foreground"})})}),a(Ds,{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(ya,{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"})]})]})}),J&&a("p",{className:"text-xs text-destructive",children:J}),a("input",{ref:S,type:"file",className:"hidden",accept:n?.map(e=>`.${e}`).join(","),onChange:V,disabled:v})]})}var Ex=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(Ex||{}),Px=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(Px||{}),Dx=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Dx||{});function Tx(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function Ix(e,a){if(!a)return!0;const t=null!=Tx(e)&&""!==Tx(e)&&!(Array.isArray(Tx(e))&&0===Tx(e).length);return!1!==e.isActive||t}function Mx(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))}function Rx(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 2:r.textValue=t.textValue;break;case 6:r.numberValue=t.numberValue;break;case 3:r.dateValue=t.dateValue;break;case 4:r.timeValue=t.timeValue;break;case 5:case 7:case 8:r.itemsValue=t.itemsValue||[];break;case 9:r.questionsValue=t.questionsValue||[]}return r}):e}function zx(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const t=Tx(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),6===e.type&&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 Lx({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 Fx({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(ii,{className:Jo(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(os,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s,rows:4}):a(ni,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s})]})}function Ux({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(ii,{className:Jo(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(ni,{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 Ox({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(ii,{className:Jo(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(ni,{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 jx({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(ii,{className:Jo(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(ni,{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(ti,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:a(fe,{className:"h-4 w-4"})})})]})]})}return t("div",{className:"space-y-1.5",children:[a(ii,{className:Jo(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(ni,{type:"url",value:d,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a(ti,{variant:"outline",size:"icon",onClick:m,disabled:!d.trim(),className:"flex-shrink-0",children:a(J,{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(ti,{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(G,{className:"h-3 w-3"})})]},r.value))})]})}function $x({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(ii,{className:Jo(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(ni,{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 Bx({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Px.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(ii,{className:Jo(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===Px.dropdown&&t(Ki,{value:d,onValueChange:c,disabled:i,children:[a(Ji,{children:a(Qi,{placeholder:e.placeholder||"Selecione..."})}),a(es,{children:l.map(e=>t(ts,{value:e.value,children:[e.text,!1===e.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(s===Px.radio||s===Px.buttons)&&a(Rp,{value:d,onValueChange:c,disabled:i,className:Jo(s===Px.buttons?"flex flex-wrap gap-2":"space-y-2"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(zp,{value:r.value,id:`${e.id}-${r.value}`}),t(ii,{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 Vx({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Px.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(ii,{className:Jo(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(ss,{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(P,{className:"h-3 w-3"})})]},r.value))}),!i&&a("div",{className:Jo(s===Px.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(ns,{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(ii,{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 qx({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(ii,{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(ii,{className:Jo(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:Jo(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(Rp,{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(zp,{value:t.value,id:`${e.id}-${r.value}-${t.value}`})})},t.value);var o})]},r.value))})]})})]})}function Wx({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=>Ix(e,r));return 0===s.length?null:a("div",{className:"space-y-4",children:s.map(e=>a(Hx,{field:e,readOnly:t,onChange:i},e.id))})}function Hx({field:e,readOnly:t,onChange:r}){const n={field:e,readOnly:t,onChange:r};switch(e.type){case Ex.readOnlyText:return a(Lx,{...n});case Ex.text:return a(Fx,{...n});case Ex.date:return a(Ux,{...n});case Ex.time:return a(Ox,{...n});case Ex.url:return a(jx,{...n});case Ex.number:return a($x,{...n});case Ex.singleSelection:return a(Bx,{...n});case Ex.multiSelection:return a(Vx,{...n});case Ex.questions:return a(qx,{...n});default:return null}}function Gx({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(ki,{open:r,onOpenChange:n,children:t(Ti,{className:"sm:max-w-[480px]",variant:"form",isDirty:x,children:[a(Ii,{children:a(zi,{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(ii,{children:"Etapa"}),t(Ki,{value:h??void 0,onValueChange:f,disabled:m,children:[a(Ji,{children:a(Qi,{placeholder:e.t("approval_select_step")})}),a(es,{children:o.map(e=>a(ts,{value:e.id,children:e.name},e.id))})]})]}),t("div",{className:"space-y-1.5",children:[a(ii,{children:e.t("approval_opinion")}),a(os,{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(Ri,{children:[a(ti,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),a(ti,{onClick:()=>{if(!g.trim())return void k.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 Kx({open:e,onOpenChange:r,approvers:n,isLoading:o=!1,ignoreUserIds:l=[],onSubmit:d}){const{t:c}=La(),[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(ki,{open:e,onOpenChange:r,children:t(Ti,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!u,children:[a(Ii,{children:a(zi,{children:c("approval_select_approver")})}),a(cs,{isLoading:o,type:"spinner",children:a("div",{className:"space-y-4",children:a(Gs,{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(Ri,{children:[a(ti,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a(ti,{onClick:()=>{if(!u)return;const e=p.find(e=>e.id===u);e&&d(e)},disabled:!u||o,children:"Concluir"})]})]})})}function Yx(e){const{t:a}=La();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Qx({text:e,maxLength:r=130}){const{t:n}=La(),[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 Jx({approver:e}){if(1===e.type&&e.approverId)return t($c,{className:"h-9 w-9 shrink-0",children:[a(Bc,{src:e.photoUrl,alt:e.name}),a(Vc,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const r=2===e.type?aa:3===e.type?wa:be;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 Xx({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(de,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Yx(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(Na,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Yx(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($,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function Zx({approver:e}){const{t:r}=La(),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(Xx,{approver:e})]})}function ey({config:e,isLoading:r=!1,onClose:n,onApprove:o,onDefineApprover:s,onRefreshSteps:d,availableApprovers:c=[],isLoadingApprovers:u=!1}){const{t:m}=La(),[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]),E=l(e=>{C(e),N(!0)},[]),D=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(ti,{variant:"ghost",size:"icon",onClick:n,className:"shrink-0",children:a(P,{className:"h-5 w-5"})}),a("span",{className:"text-lg font-medium",children:e.title})]}),k?a(cs,{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:Jo("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:Jo("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(Qx,{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 ",Yx(r.returnDate)]})]}),r.returnObservation&&a("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a(Qx,{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(Jx,{approver:e}),a(Zx,{approver:e})]}),I(r,e)&&a(ti,{size:"sm",onClick:()=>S(e.id),children:"Aprovar"}),M(r,e)&&a(ti,{size:"sm",variant:"outline",onClick:()=>E(e.id),children:"Selecionar"})]}),e.observation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Qx,{text:e.observation})}),e.returnObservation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Qx,{text:e.returnObservation})})]},e.id))]},r.id))]}),a(Gx,{open:f,onOpenChange:g,returnSteps:e.returnSteps,initialObservation:x,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:A}),a(Kx,{open:w,onOpenChange:N,approvers:c,isLoading:u,ignoreUserIds:T,onSubmit:D})]})}var ay=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(ay||{});function ty({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}=La(),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]),E=l(e=>{c?(_(e),w(!0)):n(r.filter(a=>a!==e))},[r,n,c]),D=l(()=>{N&&n(r.filter(e=>e!==N)),w(!1),_(null)},[N,r,n]);return t("div",{className:Jo("space-y-3",h),children:[a("div",{className:"flex items-start gap-3",children:a("div",{className:"flex-1",children:a(Gs,{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($c,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(Bc,{src:e.avatar,alt:e.name}),a(Vc,{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(_a,{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(wa,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a("button",{type:"button",className:Jo("text-muted-foreground hover:text-destructive transition-colors",o&&"opacity-50 pointer-events-none"),onClick:()=>!o&&E(e.id),title:f("remove"),children:a(P,{className:"h-4 w-4"})})]})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a(be,{className:"h-12 w-12 mb-2 opacity-30"}),a("p",{className:"text-sm",children:v})]}),a(ki,{open:y,onOpenChange:w,children:t(Ti,{className:"sm:max-w-[400px]",children:[a(Ii,{children:a(zi,{children:g})}),a("p",{className:"text-sm text-muted-foreground",children:m}),t(Ri,{children:[a(ti,{variant:"ghost",onClick:()=>w(!1),children:"Cancelar"}),a(ti,{variant:"destructive",onClick:D,children:"Remover"})]})]})})]})}export{nr as AUTH_CONFIG,im as AccessDeniedDialog,bm as Accordion,wm as AccordionContent,xm as AccordionItem,ym as AccordionTrigger,ri as ActionButton,ri as ActionMenu,jd as ActionMenuItems,Yf as AggregationType,Lc as Alert,Uc as AlertDescription,hi as AlertDialog,_i as AlertDialogAction,Ci as AlertDialogCancel,bi as AlertDialogContent,Ni as AlertDialogDescription,yi as AlertDialogFooter,xi as AlertDialogHeader,vi as AlertDialogOverlay,gi as AlertDialogPortal,wi as AlertDialogTitle,fi as AlertDialogTrigger,Fc as AlertTitle,Mc as AliasRedirect,Ic as AliasRouteGuard,Qf as AnalysisFunctionality,xb as AppHeader,Jb as AppLayout,Db as AppSidebar,ay as ApprovalFlowReturnStep,ey as ApprovalSidenav,Gx as ApproveDialog,Fl as AuthErrorInterceptor,td as AuthProvider,Xl as AuthService,Gs as AutoComplete,$c as Avatar,Vc as AvatarFallback,Bc as AvatarImage,ss as Badge,gc as BaseForm,pp as Blockquote,ex as BodyContent,Nm as Breadcrumb,Em as BreadcrumbEllipsis,Cm as BreadcrumbItem,km as BreadcrumbLink,_m as BreadcrumbList,Sm as BreadcrumbPage,Am as BreadcrumbSeparator,tv as BurndownPanel,ti as Button,Dm as ButtonGroup,or as CRUD_CONFIG,_g as CURRENCY_FIELDS,Tm as Calendar,Oc as CallbackPage,si as Card,ui as CardContent,ci as CardDescription,mi as CardFooter,li as CardHeader,vd as CardSkeleton,di as CardTitle,Jg as CartesianPanel,Gh as ChartContainer,Jh as ChartLegend,Xh as ChartLegendContent,Kh as ChartStyle,Yh as ChartTooltip,Qh as ChartTooltipContent,ns as Checkbox,Pu as Collapsible,Tu as CollapsibleContent,Du as CollapsibleTrigger,sc as ColorPicker,ac as ColumnSettingsPopover,Zs as ComboTree,Gs as Combobox,zs as Command,Ls as CommandDialog,Os as CommandEmpty,js as CommandGroup,Fs as CommandInput,Bs as CommandItem,Us as CommandList,$s as CommandSeparator,Vs as CommandShortcut,Zb as ContentContainer,kd as ContextMenu,zd as ContextMenuCheckboxItem,Md as ContextMenuContent,Ad as ContextMenuGroup,Rd as ContextMenuItem,Fd as ContextMenuLabel,Ed as ContextMenuPortal,Dd as ContextMenuRadioGroup,Ld as ContextMenuRadioItem,Ud as ContextMenuSeparator,Od as ContextMenuShortcut,Pd as ContextMenuSub,Id as ContextMenuSubContent,Td as ContextMenuSubTrigger,Sd as ContextMenuTrigger,fm as CoreProviders,Qd as CrudActionBar,ab as CrudActionMenu,Zv as CrudGrid,Cc as CrudPageInternal,bc as CrudPagination,tb as CrudPrimitiveFilterBar,vc as CrudPrimitivePagination,eb as CrudPrimitiveTable,rc as CrudTable,Wx as CustomFormFields,Ng as DASHBOARD_STORAGE_KEYS,xo as DATETIME_FORMATS,No as DEFAULT_DATETIME_FORMAT,wo as DEFAULT_LOCALE,_o as DEFAULT_TIMEZONE,Nv as DashboardForm,sg as DashboardFormTab,Jf as DashboardFunctionality,_v as DashboardGeneralView,dv as DashboardGrid,dg as DashboardLanguage,gv as DashboardList,Xf as DashboardListType,Zf as DashboardPageTime,eg as DashboardPanelDimension,tg as DashboardPanelOrderBy,ag as DashboardPanelOrderByType,rg as DashboardPanelPeriod,uv as DashboardPanelRenderer,ng as DashboardPanelType,lg as DashboardShareType,og as DashboardUpdateTime,mv as DashboardView,ig as DashboardViewType,tb as DataFilterBar,Im as DataList,vc as DataPagination,eb as DataTable,Mm as DatePicker,ki as Dialog,Mi as DialogBody,Ei as DialogClose,Ti as DialogContent,Li as DialogDescription,Ri as DialogFooter,Ii as DialogHeader,Pi as DialogOverlay,Ai as DialogPortal,zi as DialogTitle,Si as DialogTrigger,gf as DialogWizard,Ts as DisabledMenuItem,Rm as Drawer,Fm as DrawerClose,Om as DrawerContent,Vm as DrawerDescription,$m as DrawerFooter,jm as DrawerHeader,Um as DrawerOverlay,Lm as DrawerPortal,Bm as DrawerTitle,zm as DrawerTrigger,ms as DropdownMenu,Ns as DropdownMenuCheckboxItem,ys as DropdownMenuContent,hs as DropdownMenuGroup,ws as DropdownMenuItem,Cs as DropdownMenuLabel,fs as DropdownMenuPortal,vs as DropdownMenuRadioGroup,_s as DropdownMenuRadioItem,ks as DropdownMenuSeparator,Ss as DropdownMenuShortcut,gs as DropdownMenuSub,xs as DropdownMenuSubContent,bs as DropdownMenuSubTrigger,ps as DropdownMenuTrigger,Ex as ECustomFormFieldType,Px as EFieldViewMode,Dx as ESelectionFieldDataSource,ou as EditProfileDialog,hf as ElectronicSignatureDialog,_d as EllipsisText,ix as EmailService,Nd as EmptyState,Gs as EntitySelect,Ru as ErrorBoundary,mf as ExportDialog,df as ExportFormat,Cx as FORBIDDEN_FILE_TYPES,Nf as FilePrintType,wf as FileViewerType,_c as FilterBar,Fi as Form,qi as FormControl,Ux as FormDateField,Wi as FormDescription,Oi as FormField,Bi as FormItem,Vi as FormLabel,Hi as FormMessage,Vx as FormMultiSelectionField,$x as FormNumericField,qx as FormQuestionsField,Bx as FormSingleSelectionField,bd as FormSkeleton,Fx as FormTextField,Ox as FormTimeField,jx as FormUrlField,Hm as Grid,rp as H1,np as H2,op as H3,ip as H4,xd as HeaderSkeleton,Gm as HoverCard,Ym as HoverCardContent,Km as HoverCardTrigger,mc as IconPicker,If as IframeDialog,vx as ImageEditor,bx as ImageRenderer,mp as InlineCode,ni as Input,Qm as InputGroup,Xm as InputGroupAddon,ep as InputGroupButton,ap as InputGroupInput,tp as InputGroupTextarea,Cg as LINK_PROPERTIES,pr as LOGO_CONFIG,ii as Label,_u as LanguageBootstrap,dp as Large,lp as Lead,hp as List,Kg as ListPanel,cs as LoadingState,Au as LocaleProvider,jc as LoginPage,hr as MESSAGES,Zu as MODULES_DATA,wg as MONTHS_MAP,nv as MatrixRiskPanel,cg as MatrixViewType,Mh as Menubar,Oh as MenubarCheckboxItem,Fh as MenubarContent,Ph as MenubarGroup,Uh as MenubarItem,$h as MenubarLabel,Eh as MenubarMenu,Dh as MenubarPortal,Ih as MenubarRadioGroup,jh as MenubarRadioItem,Bh as MenubarSeparator,Vh as MenubarShortcut,Th as MenubarSub,Lh as MenubarSubContent,zh as MenubarSubTrigger,Rh as MenubarTrigger,Xv as MindMap,Sb as ModalStateProvider,lm as ModuleAccessGuard,tm as ModuleGrid,dm as ModuleOfferContent,vu as ModuleProvider,rm as ModulesContent,om as ModulesDialog,Xu as ModulesFooterCards,Gs as MultiSelect,Of as MultiselectPermissions,up as Muted,fp as NavigationMenu,yp as NavigationMenuContent,_p as NavigationMenuIndicator,vp as NavigationMenuItem,wp as NavigationMenuLink,gp as NavigationMenuList,xp as NavigationMenuTrigger,Np as NavigationMenuViewport,pb as NavigationProvider,Hg as NumericPanel,sf as OnboardingDialog,Tf as OnlineEditorDialog,sp as P,Cp as PageBreadcrumb,su as PageMetadataProvider,Sp as Pagination,Ap as PaginationContent,Ip as PaginationEllipsis,Ep as PaginationItem,Pp as PaginationLink,Tp as PaginationNext,Dp as PaginationPrevious,yg as PaletteType,$g as PanelError,jg as PanelHeader,ug as PanelItemsPerPanel,Bg as PanelLoader,Vg as PanelNoData,mg as PanelSortType,pg as PanelState,qg as PanelUnavailable,av as ParetoPanel,rv as PerformancePanel,ev as PiePanel,fg as PlanType,Is as Popover,Rs as PopoverContent,Ms as PopoverTrigger,Mp as Progress,Dc as ProtectedRoute,mr as QUALIEX_CONFIG,ur as QUERY_KEYS,Hl as QualiexEnrichmentService,Ol as QualiexErrorInterceptor,fc as QualiexUserField,gg as QueriesContextType,vg as QueriesShareType,bg as QuickFilterDashboard,Rp as RadioGroup,zp as RadioGroupItem,Lx as ReadOnlyTextField,qf as ReportRequestList,jf as ReportRequestStatus,Up as ResizableHandle,Fp as ResizablePanel,Lp as ResizablePanelGroup,tf as RichTextEditor,xg as RiskCriticality,ir as SEARCH_CONFIG,bo as SUPPORTED_LOCALES,lc as ScrollArea,dc as ScrollBar,Ki as Select,Kx as SelectApproverDialog,es as SelectContent,Yi as SelectGroup,ts as SelectItem,as as SelectLabel,Zi as SelectScrollDownButton,Xi as SelectScrollUpButton,Gs as SelectSearch,rs as SelectSeparator,Ji as SelectTrigger,Qi as SelectValue,pi as Separator,Op as Sheet,Gp as SheetBody,$p as SheetClose,Wp as SheetContent,Qp as SheetDescription,Kp as SheetFooter,Hp as SheetHeader,Vp as SheetOverlay,Bp as SheetPortal,Yp as SheetTitle,jp as SheetTrigger,ah as Sidebar,wb as SidebarActionTrigger,dh as SidebarContent,sh as SidebarFooter,ch as SidebarGroup,mh as SidebarGroupAction,ph as SidebarGroupContent,uh as SidebarGroupLabel,Xb as SidebarHeader,oh as SidebarInput,nh as SidebarInset,bb as SidebarLogo,hh as SidebarMenu,bh as SidebarMenuAction,xh as SidebarMenuBadge,vh as SidebarMenuButton,fh as SidebarMenuItem,yh as SidebarMenuSkeleton,wh as SidebarMenuSub,_h as SidebarMenuSubButton,Nh as SidebarMenuSubItem,eh as SidebarProvider,rh as SidebarRail,lh as SidebarSeparator,yd as SidebarSkeleton,th as SidebarTrigger,Ax as SingleFileUpload,qs as Skeleton,Ch as Slider,cp as Small,us as SonnerToaster,ds as Spinner,lf as SplitButton,Nc as Stack,Gf as StatusBadge,ff as StepSelector,ff as Stepper,Wf as StimulsoftViewer,pc as Switch,yo as TIMEZONES,Ah as TabPageContent,Sh as TabPageHeader,kh as TabPageLayout,ld as Table,cd as TableBody,fd as TableCaption,hd as TableCell,ud as TableFooter,pd as TableHead,dd as TableHeader,Cd as TableResizeHandle,md as TableRow,$d as TableRowActions,gd as TableSkeleton,zu as Tabs,Uu as TabsContent,Lu as TabsList,Fu as TabsTrigger,ty as TeamSelector,Mf as TermsOfUseDialog,Rf as TermsOfUseViewer,Gg as TextPanel,os as Textarea,pf as Timepicker,us as Toaster,Hd as Toggle,Kd as ToggleGroup,Yd as ToggleGroupItem,yl as TokenManager,ul as TokenService,Es as Tooltip,Ds as TooltipContent,As as TooltipProvider,Ps as TooltipTrigger,Zs as TreeSelect,sb as TreeTable,_d as TruncatedCell,Ub as UpdatesBar,Hb as UpdatesDialog,yf as UpdatesNotification,Qb as UserUpdatesViewer,Lf as UsersGroupsSelector,fx as VideoEditor,gx as VideoRenderer,Pf as ViewerDialog,hg as VisualizationType,fu as addAppTranslations,Dv as addChild,Tv as addSibling,dx as aliasSchema,Sr as assets,is as badgeVariants,Cr as brandLogos,Vo as buildModuleUrl,Lg as buildPlacesTree,Gc as buildQualiexHeaders,Ef as buildWopiUrl,Pm as buttonGroupVariants,ai as buttonVariants,xx as calculateAspectRatio,Jo as cn,kc as createCrudPage,db as createCrudRoutingConfig,kv as createMindMapNode,lb as createRoutingHandlers,Yl as createService,Sc as createSimpleSaveHandler,od as createSimpleService,Kf as createStatusConfig,fr as createTranslatedMessages,zg as currencyFormatter,Zo as debounce,Bl as deriveEmailField,$l as deriveNameField,Vl as deriveUsernameField,Do as detectBrowserLocale,Mo as detectBrowserPreferences,To as detectBrowserTimezone,qb as detectVideoProvider,lx as emailSchema,sx as emailService,_l as errorService,Yv as exportMindMap,Nx as extractImageFileName,Rg as extractNumberFromCurrency,$b as extractVimeoId,Ob as extractYouTubeId,ko as findDatetimeFormat,Co as findLocale,Sv as findNode,So as findTimezone,kx as formatBytes,Fo as formatCurrency,Lo as formatDate,zo as formatDatetime,_x as formatFileSize,Ac as generateCrudConfig,qo as generateId,Cv as generateNodeId,Oo as generatePastelBg,Jt as getAppEnv,tr as getBackendMode,qc as getCommonBaseUrl,$o as getContrastRatio,iv as getDefaultPanelSize,Xt as getEnvironmentConfig,Tx as getFieldValue,Sx as getFileExtension,Mx as getFormFieldValues,Wc as getIdentBaseUrl,Pg as getLinkFromRow,jo as getLuminance,sv as getMinPanelSize,kf as getOnlineViewerType,cr as getQualiexApiUrl,hm as getSecurityMode,Il as getSupabaseClient,tu as getUserProfile,Cf as getViewerType,Af as getWopiViewer,Bo as handleExternalLink,Jv as importMindMap,Io as inferDatetimeFormat,Jm as inputGroupAddonVariants,Zm as inputGroupButtonVariants,Mg as isCurrency,Zt as isDevEnv,dr as isDevEnvironment,wx as isImageUrl,sr as isLovablePreview,Ag as isNullOrEmptyField,rr as isSupabaseBackend,Pl as isSupabaseConfigured,Eo as isValidDatetimeFormat,Ao as isValidLocale,Po as isValidTimezone,um as loadForlogicFonts,Ar as logoSrc,Rb as markUpdateVisualized,nx as mergeTranslationFiles,Mv as moveNode,bp as navigationMenuTriggerStyle,Wb as normalizeVideoUrl,Bb as normalizeVimeoUrl,jb as normalizeYouTubeUrl,px as paginationSchema,Vb as parseIframeSrc,Eg as processUrl,jl as qualiexApi,Kc as qualiexFetch,Iv as removeNode,yx as resizeKeepingAspect,kr as resolveBrandLogo,ql as resolveFieldMappings,gb as resolvePageTitle,mx as safeStringSchema,Yo as sanitizeErrorMessage,ar as setBackendMode,zv as setCollapsedAll,Rx as setFormFieldValues,cu as setupQualiexCore,Ix as shouldShowField,lr as shouldUseDevTokens,ei as slugify,Er as smallLogoSrc,kg as sortByMonthYear,Qo as stripTechHeaders,Wo as timestampId,Dg as toQueryString,Rv as toggleCollapsed,Wd as toggleVariants,Ju as trackFooterClick,Qu as trackInterestClick,Yu as trackModuleClick,Xo as trimTextFields,Zc as updateUserProfile,Yc as uploadUserPhoto,ax as useActiveModules,Tc as useAliasFromUrl,rd as useAuth,nc as useBaseForm,mm as useClarity,Zd as useColumnManager,qd as useColumnResize,nd as useCrud,vb as useDebounce,nm as useDerivedContractedModules,ji as useFormField,Eb as useHasOpenModal,ox as useI18nFormatters,sd as useIsMobile,Eu as useLocale,id as useMediaQuery,hx as useMediaUpload,Ab as useModalState,wu as useModuleAccess,bu as useModuleConfig,hb as useNavigation,du as usePageMetadata,lu as usePageMetadataContext,fb as usePageTitle,yb as usePermissionQuery,Ib as useQualiexReady,hc as useQualiexUsers,kp as useRouteBreadcrumbs,tx as useRowResize,Zp as useSidebar,Cb as useSidebarResize,xf as useUpdatesNotification,Lb as useUserUpdatesBar,Fb as useUserUpdatesDialog,rx as useWizard,ux as userIdSchema,cx as uuidSchema,zx 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,useReducer as g}from"react";import{Slot as v}from"@radix-ui/react-slot";import{cva as b}from"class-variance-authority";import{clsx as x}from"clsx";import{twMerge as y}from"tailwind-merge";import{getDefaultOptions as w,parseISO as N,isValid as _,format as C}from"date-fns";import{toast as k,Toaster as S}from"sonner";export{toast as sonnerToast,toast}from"sonner";import*as A from"lucide-react";import{EllipsisVertical as E,X as P,ChevronDown as D,ChevronUp as T,Check as I,Loader2 as M,Loader2Icon as R,OctagonXIcon as z,TriangleAlertIcon as L,InfoIcon as F,CircleCheckIcon as U,ChevronRight as O,Circle as j,AlertCircle as B,Search as $,FileX as V,Edit as q,PowerOff as W,Power as H,Trash2 as G,Pencil as K,ToggleRight as Y,ToggleLeft as Q,Plus as J,LayoutGrid as X,List as Z,Table2 as ee,Columns3 as ae,GripVertical as te,Group as re,ArrowUp as ne,ArrowDown as oe,ChevronsLeft as ie,ChevronLeft as se,ChevronsRight as le,CheckCircle as de,AlertTriangle as ce,Info as ue,RefreshCw as me,Camera as pe,Copy as he,ExternalLink as fe,NotebookText as ge,Building2 as ve,User as be,LogOut as xe,Sparkles as ye,MoreHorizontal as we,Calendar as Ne,PanelLeft as _e,Edit3 as Ce,Code as ke,Eye as Se,Heading1 as Ae,Heading2 as Ee,Heading3 as Pe,Bold as De,Italic as Te,Underline as Ie,Strikethrough as Me,ListOrdered as Re,Highlighter as ze,Link as Le,RemoveFormatting as Fe,Undo as Ue,Redo as Oe,ImageIcon as je,ArrowLeft as Be,ArrowRight as $e,Image as Ve,FileImage as qe,FileText as We,FileSpreadsheet as He,Clock as Ge,Lock as Ke,ShieldCheck as Ye,Mail as Qe,Coffee as Je,CheckCheck as Xe,Star as Ze,Download as ea,Users as aa,TriangleAlert as ta,CheckCircle2 as ra,Hourglass as na,MoreVertical as oa,Minus as ia,CornerDownRight as sa,ChevronsUpDown as la,ChevronsDownUp as da,ZoomOut as ca,ZoomIn as ua,Maximize2 as ma,Undo2 as pa,Redo2 as ha,ArrowUpToLine as fa,UserPen as ga,Menu as va,Heart as ba,Upload as xa,CloudUpload as ya,MapPin as wa,XCircle as Na,Shield as _a}from"lucide-react";import*as Ca from"@radix-ui/react-label";import*as ka from"@radix-ui/react-dialog";export{ka as DialogPrimitive};import*as Sa from"@radix-ui/react-separator";import*as Aa from"@radix-ui/react-alert-dialog";import{useFormContext as Ea,FormProvider as Pa,Controller as Da}from"react-hook-form";import*as Ta from"@radix-ui/react-select";import*as Ia from"@radix-ui/react-checkbox";import*as Ma from"@radix-ui/react-dropdown-menu";import*as Ra from"@radix-ui/react-tooltip";import*as za from"@radix-ui/react-popover";import{useTranslation as La,initReactI18next as Fa,I18nextProvider as Ua}from"react-i18next";export{I18nextProvider,useTranslation}from"react-i18next";import{createClient as Oa}from"@supabase/supabase-js";import{useQueryClient as ja,useQuery as Ba,useMutation as $a,QueryClient as Va,QueryClientProvider as qa}from"@tanstack/react-query";import{useSearchParams as Wa,useParams as Ha,useNavigate as Ga,useLocation as Ka,Navigate as Ya,Link as Qa}from"react-router-dom";import*as Ja from"@radix-ui/react-context-menu";import*as Xa from"@radix-ui/react-toggle-group";import*as Za from"@radix-ui/react-toggle";import*as et from"@radix-ui/react-scroll-area";import*as at from"@radix-ui/react-switch";import*as tt from"@radix-ui/react-avatar";import*as rt from"@radix-ui/react-collapsible";import*as nt from"@radix-ui/react-tabs";import*as ot from"@radix-ui/react-accordion";export{ot as AccordionPrimitive};import{DayPicker as it}from"react-day-picker";import{Drawer as st}from"vaul";import*as lt from"@radix-ui/react-hover-card";import*as dt from"@radix-ui/react-navigation-menu";import*as ct from"@radix-ui/react-progress";import*as ut from"@radix-ui/react-radio-group";import*as mt from"react-resizable-panels";import*as pt from"@radix-ui/react-slider";import*as ht from"@radix-ui/react-menubar";import*as ft from"recharts";import{ResponsiveContainer as gt,Legend as vt,BarChart as bt,Bar as xt,AreaChart as yt,Area as wt,LineChart as Nt,Line as _t,CartesianGrid as Ct,XAxis as kt,YAxis as St,Tooltip as At,PieChart as Et,Pie as Pt,Cell as Dt,ComposedChart as Tt}from"recharts";import{useEditor as It,EditorContent as Mt}from"@tiptap/react";import Rt from"@tiptap/starter-kit";import zt from"@tiptap/extension-underline";import Lt from"@tiptap/extension-link";import{TextStyle as Ft}from"@tiptap/extension-text-style";import{Color as Ut}from"@tiptap/extension-color";import Ot from"@tiptap/extension-highlight";import{useSensors as jt,useSensor as Bt,PointerSensor as $t,DndContext as Vt,closestCenter as qt}from"@dnd-kit/core";import{SortableContext as Wt,rectSortingStrategy as Ht,useSortable as Gt}from"@dnd-kit/sortable";import{z as Kt}from"zod";const Yt={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api.qualiex.com",appBasePath:""},Qt={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com",appBasePath:""};function Jt(){return"DEV"===import.meta.env.VITE_APP_ENV?"DEV":"PROD"}let Xt={};function Zt(e){Xt={...Xt,...e,oauth:{...Xt.oauth,...e.oauth}}}function er(){const e="DEV"===Jt()?Qt:Yt;return{...e,...Xt,oauth:{...e.oauth,...Xt.oauth}}}function ar(){return"DEV"===Jt()}let tr="supabase";function rr(e){tr=e}function nr(){return tr}function or(){return"supabase"===tr}const ir={get oauth(){const e=er();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:e.oauth.responseType,scope:e.oauth.scope}}};function sr(e){const a=er().appBasePath||"";return`${window.location.origin}${a}${e}`}const lr={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},dr={debounceDelay:500},cr=()=>{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},ur=()=>cr()&&or(),mr=cr,pr=()=>er().qualiexApiUrl,hr={crud:e=>[e],list:(e,a)=>[e,"list",a],detail:(e,a)=>[e,"detail",a]},fr={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},gr={isQualiex:"true"===import.meta.env.VITE_IS_QUALIEX},vr={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}`}},br=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)}}),xr="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",yr={qualiex:`${xr}/logo-qualiex-white.svg`,qualitfy:`${xr}/logo-qualitfy-white.svg`,metroex:`${xr}/logo-metroex-white.svg`,qualiexSmall:`${xr}/logo-forlogic-white.svg`,saber:`${xr}/saber-gestao-white.png`,saberSmall:`${xr}/small.svg`},wr=`${xr}/favicon.png`;let Nr={};function _r(e){Nr={...Nr,...e,logos:{...Nr.logos,...e.logos}}}function Cr(e){return Nr.logos?.[e]??yr[e]}const kr={get qualiex(){return Cr("qualiex")},get qualitfy(){return Cr("qualitfy")},get metroex(){return Cr("metroex")},get saber(){return Cr("saber")},get qualiexSmall(){return Cr("qualiexSmall")},get saberSmall(){return Cr("saberSmall")}};function Sr(e){return Cr(gr.isQualiex?e?.isMetroex?"metroex":e?.isQualitfy?"qualitfy":"qualiex":"saber")}const Ar={get logo(){return Sr()},get smallLogo(){return Cr(gr.isQualiex?"qualiexSmall":"saberSmall")},get favicon(){return Nr.favicon??wr}},Er=Ar.logo,Pr=Ar.smallLogo;function Dr(){if("undefined"==typeof document)return;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=Ar.favicon,document.head.appendChild(e)}Dr();const Tr={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 Ir(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const Mr={date:Ir({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Ir({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:Ir({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Rr={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function zr(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]}}const Lr={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:zr({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:zr({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:zr({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:zr({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:zr({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"})};function Fr(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 Ur(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 Or={ordinalNumber:Ur({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Fr({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:Fr({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:Fr({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:Fr({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:Fr({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"})},jr={code:"en-US",formatDistance:(e,a,t)=>{let r;const n=Tr[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:Mr,formatRelative:(e,a,t,r)=>Rr[e],localize:Lr,match:Or,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Br={};function $r(){return Br}const Vr=6048e5;function qr(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 Wr(e){const a=qr(e);return a.setHours(0,0,0,0),a}function Hr(e){const a=qr(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 Gr(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}function Kr(e){const a=qr(e),t=function(e,a){const t=Wr(e),r=Wr(a),n=+t-Hr(t),o=+r-Hr(r);return Math.round((n-o)/864e5)}(a,function(e){const a=qr(e),t=Gr(e,0);return t.setFullYear(a.getFullYear(),0,1),t.setHours(0,0,0,0),t}(a));return t+1}function Yr(e,a){const t=$r(),r=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=qr(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 Qr(e){return Yr(e,{weekStartsOn:1})}function Jr(e){const a=qr(e),t=a.getFullYear(),r=Gr(e,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const n=Qr(r),o=Gr(e,0);o.setFullYear(t,0,4),o.setHours(0,0,0,0);const i=Qr(o);return a.getTime()>=n.getTime()?t+1:a.getTime()>=i.getTime()?t:t-1}function Xr(e){const a=qr(e),t=+Qr(a)-+function(e){const a=Jr(e),t=Gr(e,0);return t.setFullYear(a,0,4),t.setHours(0,0,0,0),Qr(t)}(a);return Math.round(t/Vr)+1}function Zr(e,a){const t=qr(e),r=t.getFullYear(),n=$r(),o=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Gr(e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const s=Yr(i,a),l=Gr(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const d=Yr(l,a);return t.getTime()>=s.getTime()?r+1:t.getTime()>=d.getTime()?r:r-1}function en(e,a){const t=qr(e),r=+Yr(t,a)-+function(e,a){const t=$r(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=Zr(e,a),o=Gr(e,0);return o.setFullYear(n,0,r),o.setHours(0,0,0,0),Yr(o,a)}(t,a);return Math.round(r/Vr)+1}function an(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const tn={y(e,a){const t=e.getFullYear(),r=t>0?t:1-t;return an("yy"===a?r%100:r,a.length)},M(e,a){const t=e.getMonth();return"M"===a?String(t+1):an(t+1,2)},d:(e,a)=>an(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)=>an(e.getHours()%12||12,a.length),H:(e,a)=>an(e.getHours(),a.length),m:(e,a)=>an(e.getMinutes(),a.length),s:(e,a)=>an(e.getSeconds(),a.length),S(e,a){const t=a.length,r=e.getMilliseconds();return an(Math.trunc(r*Math.pow(10,t-3)),a.length)}},rn="midnight",nn="noon",on="morning",sn="afternoon",ln="evening",dn="night",cn={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 tn.y(e,a)},Y:function(e,a,t,r){const n=Zr(e,r),o=n>0?n:1-n;if("YY"===a){return an(o%100,2)}return"Yo"===a?t.ordinalNumber(o,{unit:"year"}):an(o,a.length)},R:function(e,a){return an(Jr(e),a.length)},u:function(e,a){return an(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 an(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 an(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 tn.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 an(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=en(e,r);return"wo"===a?t.ordinalNumber(n,{unit:"week"}):an(n,a.length)},I:function(e,a,t){const r=Xr(e);return"Io"===a?t.ordinalNumber(r,{unit:"week"}):an(r,a.length)},d:function(e,a,t){return"do"===a?t.ordinalNumber(e.getDate(),{unit:"date"}):tn.d(e,a)},D:function(e,a,t){const r=Kr(e);return"Do"===a?t.ordinalNumber(r,{unit:"dayOfYear"}):an(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 an(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 an(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 an(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?nn:0===r?rn: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?ln:r>=12?sn:r>=4?on:dn,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 tn.h(e,a)},H:function(e,a,t){return"Ho"===a?t.ordinalNumber(e.getHours(),{unit:"hour"}):tn.H(e,a)},K:function(e,a,t){const r=e.getHours()%12;return"Ko"===a?t.ordinalNumber(r,{unit:"hour"}):an(r,a.length)},k:function(e,a,t){let r=e.getHours();return 0===r&&(r=24),"ko"===a?t.ordinalNumber(r,{unit:"hour"}):an(r,a.length)},m:function(e,a,t){return"mo"===a?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):tn.m(e,a)},s:function(e,a,t){return"so"===a?t.ordinalNumber(e.getSeconds(),{unit:"second"}):tn.s(e,a)},S:function(e,a){return tn.S(e,a)},X:function(e,a,t){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(a){case"X":return mn(r);case"XXXX":case"XX":return pn(r);default:return pn(r,":")}},x:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"x":return mn(r);case"xxxx":case"xx":return pn(r);default:return pn(r,":")}},O:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+un(r,":");default:return"GMT"+pn(r,":")}},z:function(e,a,t){const r=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+un(r,":");default:return"GMT"+pn(r,":")}},t:function(e,a,t){return an(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,t){return an(e.getTime(),a.length)}};function un(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+an(o,2)}function mn(e,a){if(e%60==0){return(e>0?"-":"+")+an(Math.abs(e)/60,2)}return pn(e,a)}function pn(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+an(Math.trunc(r/60),2)+a+an(r%60,2)}const hn=(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"})}},fn=(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"})}},gn={p:fn,P:(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],r=t[1],n=t[2];if(!n)return hn(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}}",hn(r,a)).replace("{{time}}",fn(n,a))}},vn=/^D+$/,bn=/^Y+$/,xn=["D","DD","YY","YYYY"];function yn(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=qr(e);return!isNaN(Number(t))}const wn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Nn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_n=/^'([^]*?)'?$/,Cn=/''/g,kn=/[a-zA-Z]/;function Sn(e,a,t){const r=$r(),n=t?.locale??r.locale??jr,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=qr(e);if(!yn(s))throw new RangeError("Invalid time value");let l=a.match(Nn).map(e=>{const a=e[0];if("p"===a||"P"===a){return(0,gn[a])(e,n.formatLong)}return e}).join("").match(wn).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:An(e)};if(cn[a])return{isToken:!0,value:e};if(a.match(kn))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 bn.test(e)}(o)||!t?.useAdditionalDayOfYearTokens&&function(e){return vn.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(xn.includes(e))throw new RangeError(r)}(o,a,String(e));return(0,cn[o[0]])(s,o,n.localize,d)}).join("")}function An(e){const a=e.match(_n);return a?a[1].replace(Cn,"'"):e}function En(e,a,t){const r=w(),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 Pn(e,a){const t=function(e){Tn[e]||(Tn[e]=Mn?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 Tn[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=Dn[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 Dn={year:0,month:1,day:2,hour:3,minute:4,second:5};const Tn={},In=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")),Mn="06/25/2014, 00:00:00"===In||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===In;function Rn(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 zn=36e5,Ln={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Fn(e,a,t){if(!e)return 0;let r,n,o=Ln.timezoneZ.exec(e);if(o)return 0;if(o=Ln.timezoneHH.exec(e),o)return r=parseInt(o[1],10),On(r)?-r*zn:NaN;if(o=Ln.timezoneHHMM.exec(e),o){r=parseInt(o[2],10);const e=parseInt(o[3],10);return On(r,e)?(n=Math.abs(r)*zn+6e4*e,"+"===o[1]?-n:n):NaN}if(function(e){if(jn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),jn[e]=!0,!0}catch(a){return!1}}(e)){a=new Date(a||Date.now());const r=t?a:function(e){return Rn(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(a),n=Un(r,e),o=t?n:function(e,a,t){const r=e.getTime();let n=r-a;const o=Un(new Date(n),t);if(a===o)return a;n-=o-a;const i=Un(new Date(n),t);if(o===i)return o;return Math.max(o,i)}(a,n,e);return-o}return NaN}function Un(e,a){const t=Pn(e,a),r=Rn(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 On(e,a){return-23<=e&&e<=23&&(null==a||0<=a&&a<=59)}const jn={};const Bn={X:function(e,a,t){const r=$n(t.timeZone,e);if(0===r)return"Z";switch(a){case"X":return Wn(r);case"XXXX":case"XX":return qn(r);default:return qn(r,":")}},x:function(e,a,t){const r=$n(t.timeZone,e);switch(a){case"x":return Wn(r);case"xxxx":case"xx":return qn(r);default:return qn(r,":")}},O:function(e,a,t){const r=$n(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+Vn(o,2)}(r,":");default:return"GMT"+qn(r,":")}},z:function(e,a,t){switch(a){case"z":case"zz":case"zzz":return En("short",e,t);default:return En("long",e,t)}}};function $n(e,a){const t=e?Fn(e,a,!0)/6e4:a?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+e);return t}function Vn(e,a){const t=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<a;)r="0"+r;return t+r}function qn(e,a=""){const t=e>0?"-":"+",r=Math.abs(e);return t+Vn(Math.floor(r/60),2)+a+Vn(Math.floor(r%60),2)}function Wn(e,a){if(e%60==0){return(e>0?"-":"+")+Vn(Math.abs(e)/60,2)}return qn(e,a)}function Hn(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 Gn=36e5,Kn=6e4,Yn={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 Qn(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=Yn.dateTimePattern.exec(e);r?(a.date=r[1],t=r[3]):(r=Yn.datePattern.exec(e),r?(a.date=r[1],t=r[2]):(a.date=null,t=e));if(t){const e=Yn.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=Yn.YYY[a],r=Yn.YYYYY[a];let n=Yn.YYYY.exec(e)||r.exec(e);if(n){const a=n[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(n=Yn.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=Yn.MM.exec(e);if(o)return t=new Date(0),r=parseInt(o[1],10)-1,ao(a,r)?(t.setUTCFullYear(a,r),t):new Date(NaN);if(o=Yn.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=eo(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=Yn.MMDD.exec(e),o){t=new Date(0),r=parseInt(o[1],10)-1;const e=parseInt(o[2],10);return ao(a,r,e)?(t.setUTCFullYear(a,r,e),t):new Date(NaN)}if(o=Yn.Www.exec(e),o)return n=parseInt(o[1],10)-1,to(n)?Jn(a,n):new Date(NaN);if(o=Yn.WwwD.exec(e),o){n=parseInt(o[1],10)-1;const e=parseInt(o[2],10)-1;return to(n,e)?Jn(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=Yn.HH.exec(e);if(r)return a=parseFloat(r[1].replace(",",".")),ro(a)?a%24*Gn:NaN;if(r=Yn.HHMM.exec(e),r)return a=parseInt(r[1],10),t=parseFloat(r[2].replace(",",".")),ro(a,t)?a%24*Gn+t*Kn:NaN;if(r=Yn.HHMMSS.exec(e),r){a=parseInt(r[1],10),t=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return ro(a,t,e)?a%24*Gn+t*Kn+1e3*e:NaN}return null}(r.time),null===n||isNaN(n)))return new Date(NaN);if(r.timeZone||a.timeZone){if(t=Fn(r.timeZone||a.timeZone,new Date(e+n)),isNaN(t))return new Date(NaN)}else t=Hn(new Date(e+n)),t=Hn(new Date(e+n+t));return new Date(e+n+t)}return new Date(NaN)}function Jn(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 Xn=[31,28,31,30,31,30,31,31,30,31,30,31],Zn=[31,29,31,30,31,30,31,31,30,31,30,31];function eo(e){return e%400==0||e%4==0&&e%100!=0}function ao(e,a,t){if(a<0||a>11)return!1;if(null!=t){if(t<1)return!1;const r=eo(e);if(r&&t>Zn[a])return!1;if(!r&&t>Xn[a])return!1}return!0}function to(e,a){return!(e<0||e>52)&&(null==a||!(a<0||a>6))}function ro(e,a,t){return!(e<0||e>=25)&&((null==a||!(a<0||a>=60))&&(null==t||!(t<0||t>=60)))}const no=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function oo(e,a,t,r){return function(e,a,t={}){const r=(a=String(a)).match(no);if(r){const n=Qn(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,"'"+Bn[a[0]](n,a,t)+"'");return o?i.substring(0,r-1)+i.substring(r+1):i},a)}return Sn(e,a,t)}(function(e,a,t){const r=Fn(a,e=Qn(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 io={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"}},so={date:Ir({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:Ir({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Ir({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lo={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"},co={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"},uo={ordinalNumber:(e,a)=>Number(e)+"º",era:zr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:zr({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:zr({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:zr({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:zr({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"})},mo={ordinalNumber:Ur({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Fr({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:Fr({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:Fr({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:Fr({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:Fr({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"})},po={code:"es",formatDistance:(e,a,t)=>{let r;const n=io[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:so,formatRelative:(e,a,t,r)=>1!==a.getHours()?co[e]:lo[e],localize:uo,match:mo,options:{weekStartsOn:1,firstWeekContainsDate:1}},ho={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"}},fo={date:Ir({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:Ir({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Ir({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},go={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"},vo={ordinalNumber:(e,a)=>{const t=Number(e);return"week"===a?.unit?t+"ª":t+"º"},era:zr({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:zr({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:zr({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:zr({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:zr({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"})},bo={ordinalNumber:Ur({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Fr({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:Fr({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:Fr({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:Fr({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:Fr({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"})},xo={code:"pt-BR",formatDistance:(e,a,t)=>{let r;const n=ho[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:fo,formatRelative:(e,a,t,r)=>{const n=go[e];return"function"==typeof n?n(a):n},localize:vo,match:bo,options:{weekStartsOn:0,firstWeekContainsDate:1}},yo=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],wo=[{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"}],No=[{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"}],_o="pt-BR",Co="dd/MM/yyyy HH:mm",ko="America/Sao_Paulo",So=e=>yo.find(a=>a.value===e),Ao=e=>wo.find(a=>a.value===e),Eo=e=>No.find(a=>a.value===e),Po=e=>yo.some(a=>a.value===e),Do=e=>wo.some(a=>a.value===e),To=e=>No.some(a=>a.value===e),Io=()=>{if("undefined"==typeof navigator)return _o;const e=navigator.language;if(Po(e))return e;const a=e.split("-")[0],t=yo.find(e=>e.value.startsWith(a));return t?.value||_o},Mo=()=>{if("undefined"==typeof Intl)return ko;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return To(e)?e:ko}catch{return ko}},Ro=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||Co),zo=()=>{const e=Io();return{locale:e,timezone:Mo(),datetimeFormat:Ro(e)}},Lo={"pt-BR":xo,"en-US":jr,"es-ES":po},Fo=(e,a=Co,t=ko,r=_o)=>{if(!e)return"";const n=N(e);if(!_(n))return"Data inválida";const o=Lo[r]||xo;try{return oo(n,t,a,{locale:o})}catch(i){return oo(n,ko,a,{locale:o})}},Uo=(e,a=_o,t=ko)=>{if(!e)return"";const r=N(e);if(!_(r))return"Data inválida";const n=Lo[a]||xo;try{return oo(r,t,"PP",{locale:n})}catch(o){return oo(r,ko,"PP",{locale:n})}},Oo=(e,a="BRL",t="pt-BR")=>null==e?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e);function jo(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 Bo(e,a=.1){const{r:t,g:r,b:n}=jo(e);return`rgba(${t}, ${r}, ${n}, ${a})`}function $o(e){const{r:a,g:t,b:r}=jo(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 Vo(e,a){const t=$o(e),r=$o(a);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)}function qo(e,a){a?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{k.info("Link copiado para a área de transferência")})}function Wo(e,a){return a?e.replace(/\{alias\}/g,a):e}function Ho(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const a=new Uint8Array(16);crypto.getRandomValues(a),a[6]=15&a[6]|64,a[8]=63&a[8]|128;const t=Array.from(a,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}const Go=()=>Date.now().toString(),Ko=["hint","details","code","where","schema","table","column"],Yo="Ocorreu um erro ao processar sua solicitação.",Qo=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function Jo(e){const a=function(e){if(!e)return Yo;if("string"==typeof e)return e;if(e instanceof Error)return e.message||Yo;if("object"==typeof e&&"message"in e)return String(e.message);return Yo}(e);return ar()?a:Qo.some(e=>e.test(a))?Yo:a}function Xo(e){if(!e||"object"!=typeof e)return e;const a={...e};for(const t of Ko)delete a[t];return a}function Zo(...e){return y(x(e))}const ei=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(ei);if("object"==typeof e&&e.constructor===Object){const a={};for(const[t,r]of Object.entries(e))a[t]=ei(r);return a}return e},ai=(e,a)=>{let t;return(...r)=>{clearTimeout(t),t=setTimeout(()=>e(...r),a)}},ti=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),ri=b("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"}}),ni=n.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>a(n?v:"button",{className:Zo(ri({variant:t,size:r,className:e})),ref:i,...o}));ni.displayName="Button";const oi=o.forwardRef(({className:e,children:t,variant:r="action",...n},o)=>a(ni,{ref:o,variant:r,size:"icon",className:Zo("h-8 w-8",e),...n,children:t||a(E,{size:16})}));oi.displayName="ActionButton";const ii=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:Zo("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]})]})});ii.displayName="Input";const si=b("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),li=n.forwardRef(({className:e,...t},r)=>a(Ca.Root,{ref:r,className:Zo(si(),e),...t}));li.displayName=Ca.Root.displayName;const di=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));di.displayName="Card";const ci=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("flex flex-col space-y-1.5 p-6",e),...t}));ci.displayName="CardHeader";const ui=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Zo("text-2xl font-semibold leading-none tracking-tight",e),...t}));ui.displayName="CardTitle";const mi=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));mi.displayName="CardDescription";const pi=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("p-6 pt-0",e),...t}));pi.displayName="CardContent";const hi=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("flex items-center p-6 pt-0",e),...t}));hi.displayName="CardFooter";const fi=n.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>a(Sa.Root,{ref:o,decorative:r,orientation:t,className:Zo("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));fi.displayName=Sa.Root.displayName;const gi=Aa.Root,vi=Aa.Trigger,bi=Aa.Portal,xi=n.forwardRef(({className:e,...t},r)=>a(Aa.Overlay,{className:Zo("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}));xi.displayName=Aa.Overlay.displayName;const yi=n.forwardRef(({className:e,...r},n)=>t(bi,{children:[a(xi,{}),a(Aa.Content,{ref:n,className:Zo("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})]}));yi.displayName=Aa.Content.displayName;const wi=({className:e,...t})=>a("div",{className:Zo("flex flex-col space-y-2 text-center sm:text-left",e),...t});wi.displayName="AlertDialogHeader";const Ni=({className:e,...t})=>a("div",{className:Zo("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ni.displayName="AlertDialogFooter";const _i=n.forwardRef(({className:e,...t},r)=>a(Aa.Title,{ref:r,className:Zo("text-lg font-semibold",e),...t}));_i.displayName=Aa.Title.displayName;const Ci=n.forwardRef(({className:e,...t},r)=>a(Aa.Description,{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));Ci.displayName=Aa.Description.displayName;const ki=n.forwardRef(({className:e,...t},r)=>a(Aa.Action,{ref:r,className:Zo(ri(),e),...t}));ki.displayName=Aa.Action.displayName;const Si=n.forwardRef(({className:e,...t},r)=>a(Aa.Cancel,{ref:r,className:Zo(ri({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Si.displayName=Aa.Cancel.displayName;const Ai=ka.Root,Ei=ka.Trigger,Pi=ka.Portal,Di=ka.Close,Ti=n.forwardRef(({className:e,...t},r)=>a(ka.Overlay,{ref:r,className:Zo("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}));Ti.displayName=ka.Overlay.displayName;const Ii={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"}},Mi=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),E=i??(d||c||u||m||p||h?void 0:"md"),D=E?Ii[E]:{},T={...d??D.width?{width:d??D.width}:{},...c??D.minWidth?{minWidth:c??D.minWidth}:{},...u??D.maxWidth?{maxWidth:u??D.maxWidth}:{},...m??D.height?{height:m??D.height}:{},...p??D.minHeight?{minHeight:p??D.minHeight}:{},...h??D.maxHeight?{maxHeight:h??D.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(Pi,{children:[a(Ti,{}),t(ka.Content,{ref:_,className:Zo("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(ka.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(P,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]}),a(gi,{open:C,onOpenChange:k,children:t(yi,{children:[t(wi,{children:[a(_i,{children:f}),a(Ci,{children:g})]}),t(Ni,{children:[a(Si,{onClick:()=>{k(!1),S.current=null},children:v}),a(ki,{onClick:()=>{k(!1),S.current?.(),S.current=null},children:b})]})]})})]})});Mi.displayName=ka.Content.displayName;const Ri=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:Zo("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(fi,{className:"mt-2"})]});Ri.displayName="DialogHeader";const zi=({className:e,...t})=>a("div",{className:Zo("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...t});zi.displayName="DialogBody";const Li=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(fi,{className:"mb-4"}),a("div",{className:Zo("flex flex-row justify-end gap-2",e),...n,children:r})]});Li.displayName="DialogFooter";const Fi=n.forwardRef(({className:e,...t},r)=>a(ka.Title,{ref:r,className:Zo("text-xl font-semibold leading-none tracking-tight",e),...t}));Fi.displayName=ka.Title.displayName;const Ui=n.forwardRef(({className:e,...t},r)=>a(ka.Description,{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));Ui.displayName=ka.Description.displayName;const Oi=Pa,ji=n.createContext({}),Bi=({...e})=>a(ji.Provider,{value:{name:e.name},children:a(Da,{...e})}),$i=()=>{const e=n.useContext(ji),a=n.useContext(Vi),{getFieldState:t,formState:r}=Ea(),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}},Vi=n.createContext({}),qi=n.forwardRef(({className:e,...t},r)=>{const o=n.useId();return a(Vi.Provider,{value:{id:o},children:a("div",{ref:r,className:Zo("space-y-1.5",e),...t})})});qi.displayName="FormItem";const Wi=n.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:o}=$i();return a(li,{ref:r,className:Zo(n&&"text-destructive",e),htmlFor:o,...t})});Wi.displayName="FormLabel";const Hi=n.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:i}=$i();return a(v,{ref:t,id:n,"aria-describedby":r?`${o} ${i}`:`${o}`,"aria-invalid":!!r,...e})});Hi.displayName="FormControl";const Gi=n.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=$i();return a("p",{ref:r,id:n,className:Zo("text-sm text-muted-foreground",e),...t})});Gi.displayName="FormDescription";const Ki=n.forwardRef(({className:e,children:t,...r},n)=>{const{error:o,formMessageId:i}=$i(),s=o?String(o?.message):t;return s?a("p",{ref:n,id:i,className:Zo("text-sm font-medium text-destructive",e),...r,children:s}):null});Ki.displayName="FormMessage";const Yi=n.createContext({showCheck:!1}),Qi=({showCheck:e=!1,...t})=>a(Yi.Provider,{value:{showCheck:e},children:a(Ta.Root,{...t})}),Ji=Ta.Group,Xi=Ta.Value,Zi=n.forwardRef(({className:e,children:r,...n},o)=>t(Ta.Trigger,{ref:o,className:Zo("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(Ta.Icon,{asChild:!0,children:a(D,{className:"h-4 w-4 opacity-50"})})]}));Zi.displayName=Ta.Trigger.displayName;const es=n.forwardRef(({className:e,...t},r)=>a(Ta.ScrollUpButton,{ref:r,className:Zo("flex cursor-default items-center justify-center py-1",e),...t,children:a(T,{className:"h-4 w-4"})}));es.displayName=Ta.ScrollUpButton.displayName;const as=n.forwardRef(({className:e,...t},r)=>a(Ta.ScrollDownButton,{ref:r,className:Zo("flex cursor-default items-center justify-center py-1",e),...t,children:a(D,{className:"h-4 w-4"})}));as.displayName=Ta.ScrollDownButton.displayName;const ts=n.forwardRef(({className:e,children:r,position:n="popper",container:o,collisionBoundary:i,...s},l)=>a(Ta.Portal,{container:o,children:t(Ta.Content,{ref:l,className:Zo("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(es,{}),a(Ta.Viewport,{className:Zo("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),a(as,{})]})}));ts.displayName=Ta.Content.displayName;const rs=n.forwardRef(({className:e,...t},r)=>a(Ta.Label,{ref:r,className:Zo("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));rs.displayName=Ta.Label.displayName;const ns=n.forwardRef(({className:e,children:r,...o},i)=>{const{showCheck:s}=n.useContext(Yi);return t(Ta.Item,{ref:i,className:Zo("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(Ta.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),a(Ta.ItemText,{children:r})]})});ns.displayName=Ta.Item.displayName;const os=n.forwardRef(({className:e,...t},r)=>a(Ta.Separator,{ref:r,className:Zo("-mx-1 my-1 h-px bg-muted",e),...t}));os.displayName=Ta.Separator.displayName;const is=n.forwardRef(({className:e,...t},r)=>a(Ia.Root,{ref:r,className:Zo("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(Ia.Indicator,{className:Zo("flex items-center justify-center text-current"),children:a(I,{className:"h-4 w-4"})})}));is.displayName=Ia.Root.displayName;const ss=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:Zo("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]})]})});ss.displayName="Textarea";const ls=b("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"}}),ds=n.forwardRef(({className:e,variant:t,...r},n)=>a("div",{ref:n,className:Zo(ls({variant:t}),e),...r}));ds.displayName="Badge";const cs={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function us({size:e="md",className:t}){return a(M,{className:Zo("animate-spin text-muted-foreground",cs[e],t)})}function ms({isLoading:e,children:n,className:o,type:i="spinner",size:s="md"}){return e?"overlay"===i?t("div",{className:Zo("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(us,{size:s})})]}):a("div","skeleton"===i?{className:Zo("animate-pulse",o),children:a("div",{className:"bg-muted rounded-md h-full w-full"})}:{className:Zo("flex items-center justify-center py-8",o),children:a(us,{size:s})}):a(r,{children:n})}const ps=({...e})=>a(S,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:a(U,{className:"h-4 w-4"}),info:a(F,{className:"h-4 w-4"}),warning:a(L,{className:"h-4 w-4"}),error:a(z,{className:"h-4 w-4"}),loading:a(R,{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}),hs=Ma.Root,fs=Ma.Trigger,gs=Ma.Group,vs=Ma.Portal,bs=Ma.Sub,xs=Ma.RadioGroup,ys=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ma.SubTrigger,{ref:i,className:Zo("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"})]}));ys.displayName=Ma.SubTrigger.displayName;const ws=n.forwardRef(({className:e,...t},r)=>a(Ma.SubContent,{ref:r,className:Zo("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}));ws.displayName=Ma.SubContent.displayName;const Ns=n.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a(Ma.Portal,{children:a(Ma.Content,{ref:n,sideOffset:t,className:Zo("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})}));Ns.displayName=Ma.Content.displayName;const _s=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ma.Item,{ref:n,className:Zo("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}));_s.displayName=Ma.Item.displayName;const Cs=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ma.CheckboxItem,{ref:i,className:Zo("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(Ma.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Cs.displayName=Ma.CheckboxItem.displayName;const ks=n.forwardRef(({className:e,children:r,...n},o)=>t(Ma.RadioItem,{ref:o,className:Zo("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(Ma.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));ks.displayName=Ma.RadioItem.displayName;const Ss=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ma.Label,{ref:n,className:Zo("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Ss.displayName=Ma.Label.displayName;const As=n.forwardRef(({className:e,...t},r)=>a(Ma.Separator,{ref:r,className:Zo("-mx-1 my-1 h-px bg-muted",e),...t}));As.displayName=Ma.Separator.displayName;const Es=({className:e,...t})=>a("span",{className:Zo("ml-auto text-xs tracking-widest opacity-60",e),...t});Es.displayName="DropdownMenuShortcut";const Ps=({delayDuration:e=300,...t})=>a(Ra.Provider,{delayDuration:e,...t}),Ds=Ra.Root,Ts=Ra.Trigger,Is=n.forwardRef(({className:e,sideOffset:t=4,container:r,...n},o)=>a(Ra.Portal,{container:r,children:a(Ra.Content,{ref:o,sideOffset:t,className:Zo("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})}));Is.displayName=Ra.Content.displayName;const Ms=n.forwardRef(({children:e,disabledReason:r,className:n},o)=>{const i=a(_s,{ref:o,className:Zo("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(Ps,{delayDuration:100,children:t(Ds,{children:[a(Ts,{asChild:!0,children:a("div",{className:"w-full",children:i})}),a(Is,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:r})]})}):i});Ms.displayName="DisabledMenuItem";const Rs=za.Root,zs=za.Trigger,Ls=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,container:n,...o},i)=>a(za.Portal,{container:n,children:a(za.Content,{ref:i,align:t,sideOffset:r,className:Zo("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})}));Ls.displayName=za.Content.displayName;const Fs=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Fs.displayName="Command";const Us=({children:e,...t})=>a("div",{...t,children:a(Fs,{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})}),Os=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:Zo("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})}));Os.displayName="CommandInput";const js=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));js.displayName="CommandList";const Bs=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("py-6 text-center text-sm text-muted-foreground",e),...t}));Bs.displayName="CommandEmpty";const $s=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("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}));$s.displayName="CommandGroup";const Vs=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("-mx-1 h-px bg-border",e),...t}));Vs.displayName="CommandSeparator";const qs=n.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...o},i)=>a("div",{ref:i,className:Zo("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}));qs.displayName="CommandItem";const Ws=({className:e,...t})=>a("span",{className:Zo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function Hs({className:e,...t}){return a("div",{className:Zo("animate-pulse rounded-md bg-muted",e),...t})}Ws.displayName="CommandShortcut";const Gs=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Ks({multiple:r,options:n,value:o,onChange:l,getOptionValue:d,getOptionLabel:c,renderOption:u,placeholder:m,label:p,icon:h,emptyMessage:f,searchPlaceholder:g,disabled:v,required:b,className:x,sortOptions:y,maxDisplayedBadges:w,popoverContainer:N,onOpen:_,onClose:C,clearable:k,showCheck:S}){const[A,E]=i(!1),[T,M]=i(""),R=s(()=>o?Array.isArray(o)?o:[o]:[],[o]),z=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 y?e.sort((e,a)=>e.label.localeCompare(a.label,"pt-BR",{sensitivity:"base"})):e},[n,d,c,y]),F=s(()=>{if(!T)return L;const e=Gs(T);return L.filter(a=>Gs(a.label).includes(e))},[L,T]),U=s(()=>L.filter(e=>R.includes(e.value)),[L,R]),O=e=>{E(e),e?_?.():(M(""),C?.())},j=(e,a)=>{a.preventDefault(),a.stopPropagation(),l&&l(r?R.filter(a=>a!==e):"")},B=w?U.slice(0,w):U,$=w&&U.length>w?U.length-w:0;return t("div",{className:Zo("space-y-2",x),children:[p&&t(li,{children:[p,b&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Rs,{open:A,onOpenChange:O,modal:!1,children:[r?a(zs,{asChild:!0,children:t("div",{role:"combobox","aria-expanded":A,"aria-disabled":v,tabIndex:v?-1:0,onKeyDown:e=>{v||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),O(!A))},className:Zo("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",v&&"pointer-events-none opacity-50 cursor-not-allowed",0===U.length&&"text-muted-foreground"),children:[0===U.length?t("span",{className:"flex items-center gap-2",children:[h&&a(h,{className:"h-4 w-4"}),m]}):t("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[B.map(e=>t(ds,{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(P,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),$>0&&t(ds,{variant:"outline",className:"gap-1",children:["+",$]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t("div",{className:"relative",children:[a(zs,{asChild:!0,children:t(ni,{variant:"outline",role:"combobox","aria-expanded":A,disabled:v,className:Zo("relative w-full justify-start min-h-10 h-auto pr-10",k&&U.length>0&&"pr-16",0===U.length&&"text-muted-foreground"),children:[0===U.length?t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[h&&a(h,{className:"h-4 w-4"}),a("span",{className:"truncate",children:m})]}):t("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[h&&a(h,{className:"h-4 w-4"}),a("span",{className:"truncate",children:U[0]?.label})]}),a(D,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),k&&U.length>0&&a("button",{type:"button",disabled:v,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(P,{className:"h-3.5 w-3.5"})})]}),a(Ls,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:z,collisionBoundary:z,children:t(Fs,{children:[t("div",{className:"relative",children:[a(Os,{placeholder:g,value:T,onChange:e=>M(e.target.value)}),T&&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:()=>M(""),children:a(P,{className:"h-3.5 w-3.5"})})]}),a(js,{children:0===n.length?a(Bs,{children:f}):0===F.length?a(Bs,{children:e.t("no_results")}):a($s,{children:F.map(e=>{const n=R.includes(e.value);return t(qs,{value:e.value,onSelect:()=>(e=>{if(l)if(r){const a=R.includes(e)?R.filter(a=>a!==e):[...R,e];l(a)}else l(e),E(!1)})(e.value),className:Zo("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:[S&&a(I,{className:Zo("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),u?u(e.original):e.label]},e.value)})})})]})})]})]})}function Ys({multiple:e=!1,options:r,items:n,value:o,onChange:i,onValueChange:s,getOptionValue:l=e=>e.value,getOptionLabel:d=e=>e.label,renderOption:c,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:f,disabled:g=!1,required:v=!1,isLoading:b=!1,error:x,className:y,sortOptions:w=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:E}=La(),P=r||n||[],D=s||i,T=u||E("select_placeholder","Selecione..."),I=h||E("no_results",E("no_results")),M=f||E("search_placeholder","Pesquisar...");if(b)return t("div",{className:Zo("space-y-2",y),children:[m&&t(li,{children:[m,v&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Hs,{className:"h-10 w-full"})]});const R="string"==typeof x?x:x instanceof Error?x.message:x?E("error_loading",E("error_loading")):void 0;return R?t("div",{className:Zo("space-y-2",y),children:[m&&t(li,{children:[m,v&&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(B,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:R})]})]}):a(Ks,{multiple:e,options:P,value:o||(e?[]:""),onChange:D,getOptionValue:l,getOptionLabel:d,renderOption:c,placeholder:T,label:m,icon:p,emptyMessage:I,searchPlaceholder:M,disabled:g,required:v,className:y,sortOptions:w,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const Qs=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function Js(e,a){if(!a)return null;const t=Qs(a),r=[];for(const n of e){const e=Qs(n.label).includes(t),o=n.children?Js(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 Xs(e,a){for(const t of e){if(t.value===a)return t.label;if(t.children){const e=Xs(t.children,a);if(e)return e}}}function Zs({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:Zo("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:Zo("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:Zo("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 el({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(Zs,{node:e,level:n,expanded:r,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c}),r&&e.children&&e.children.length>0&&a(el,{nodes:e.children,level:n+1,expandedIds:i,onToggleExpand:s,selectedValues:l,onSelect:d,showCheck:c})]},e.value)})})}function al({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}=La(),[S,A]=i(!1),[E,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]),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]),O=s(()=>Js(r,E),[r,E])??r,j=s(()=>E?function(e,a){const t=new Set,r=Qs(a);function n(e){if(!e.children||0===e.children.length)return Qs(e.label).includes(r);let a=!1;for(const t of e.children)n(t)&&(a=!0);return a&&t.add(e.value),a||Qs(e.label).includes(r)}for(const o of e)n(o);return t}(r,E):new Set,[r,E]),V=E?j:I,q=l(e=>{E||M(a=>{const t=new Set(a);return t.has(e)?t.delete(e):t.add(e),t})},[E]),W=s(()=>F.map(e=>({value:e,label:Xs(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:Zo("space-y-2",b),children:[c&&t(li,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Hs,{className:"h-10 w-full"})]});const J="string"==typeof v?v:v instanceof Error?v.message:v?k("error_loading",k("error_loading")):void 0;return t("div",J?{className:Zo("space-y-2",b),children:[c&&t(li,{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(B,{className:"h-4 w-4"}),a("span",{className:"text-sm",children:J})]})]}:{className:Zo("space-y-2",b),children:[c&&t(li,{children:[c,f&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Rs,{open:S,onOpenChange:H,modal:!1,children:[a(zs,{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:Zo("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(ds,{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(P,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),Q>0&&t(ds,{variant:"outline",className:"gap-1",children:["+",Q]})]}),a(D,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t(ni,{variant:"outline",role:"combobox","aria-expanded":S,disabled:h,className:Zo("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(Ls,{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($,{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:E,onChange:e=>T(e.target.value)}),E&&a("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:a(P,{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===O.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(el,{nodes:O,level:0,expandedIds:V,onToggleExpand:q,selectedValues:F,onSelect:G,showCheck:C})})})]})]})]})}const tl=void 0!==import.meta&&"true"===import.meta.env?.VITE_AUTH_DEBUG,rl=new Map;function nl(e,a=1/0){if(!tl)return 0;const t=(rl.get(e)??0)+1;return rl.set(e,t),t}function ol(e){if(tl)try{performance.mark(`auth:${e}`)}catch{}}async function il(e,a){if(!tl)return a();const t=performance.now();try{return await a()}finally{performance.now()}}function sl(e){if(!tl)return;if(0===rl.size)return;const a={};for(const[t,r]of rl.entries())a[t]=r}let ll=null;function dl(e,a,t){if(!tl||!a)return;if(t&&"object"==typeof t)for(const r in t)/^co\d+$/.test(r)&&0}const cl=()=>tl;var ul=Object.defineProperty;const ml=class e{static normalizeBase64Url(e){let a=e.replace(/-/g,"+").replace(/_/g,"/");const t=(4-a.length%4)%4;return a+="=".repeat(t),a}static parseJwtPayload(a){if(cl()){return nl(`parseJwtPayload:${a.length}:${a.slice(-8)}`,4),nl("parseJwtPayload:total"),function(e,a){if(!tl)return a();performance.now();try{return a()}finally{performance.now()}}(a.length,()=>e._parseJwtPayloadImpl(a))}return e._parseJwtPayloadImpl(a)}static _parseJwtPayloadImpl(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()}};((e,a,t)=>{a in e?ul(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t})(ml,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let pl=ml;const hl="qualiex_access_token",fl="qualiex_id_token",gl="supabase_token",vl="oauth_state",bl="oauth_nonce",xl="selected_alias",yl="manual_logout",wl="supabase_project_id",Nl={setAccessToken:e=>localStorage.setItem(hl,e),getAccessToken:()=>localStorage.getItem(hl),setIdToken:e=>localStorage.setItem(fl,e),getIdToken:()=>localStorage.getItem(fl),getSupabaseToken:()=>localStorage.getItem(gl),setOAuthState:e=>sessionStorage.setItem(vl,e),getOAuthState:()=>sessionStorage.getItem(vl),clearOAuthState:()=>sessionStorage.removeItem(vl),setOAuthNonce:e=>sessionStorage.setItem(bl,e),getOAuthNonce:()=>sessionStorage.getItem(bl),clearOAuthNonce:()=>sessionStorage.removeItem(bl),setSelectedAlias:e=>localStorage.setItem(xl,e),getSelectedAlias:()=>localStorage.getItem(xl),clearSelectedAlias:()=>localStorage.removeItem(xl),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Nl.getAccessToken()||!Nl.getIdToken()),checkProjectMismatch:()=>{const e=er().supabaseProjectId;if(!e)return!1;const a=localStorage.getItem(wl);return a&&a!==e?(Nl.clearAll(),localStorage.setItem(wl,e),!0):(a||localStorage.setItem(wl,e),!1)},setSupabaseToken:e=>{localStorage.setItem(gl,e),Nl._clearValidationCache()},areAllTokensValid:()=>{const e=Nl.getAccessToken(),a=Nl.getIdToken();if(!e||!a)return!1;try{const t=pl.validateTokens(e,a);return!!t.idTokenValid&&t.idTokenValid}catch(t){return!1}},clearExpiredTokens:()=>{let e=!1;const a=Nl.getAccessToken(),t=Nl.getIdToken(),r=Nl.getSupabaseToken();return a&&Nl.isTokenExpired(a)&&(localStorage.removeItem(hl),e=!0),t&&Nl.isTokenExpired(t)&&(localStorage.removeItem(fl),e=!0),r&&Nl.isTokenExpired(r)&&(localStorage.removeItem(gl),e=!0),e},clearAll:()=>{localStorage.removeItem(hl),localStorage.removeItem(fl),localStorage.removeItem(gl),localStorage.removeItem(xl),sessionStorage.removeItem(vl),sessionStorage.removeItem(bl),Nl._clearValidationCache()},setManualLogout:()=>localStorage.setItem(yl,"true"),isManualLogout:()=>"true"===localStorage.getItem(yl),clearManualLogout:()=>localStorage.removeItem(yl),isTokenExpired:e=>{try{return pl.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Nl._validationCache.isValid=!1,Nl._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Nl.getSupabaseToken();if(!e)return!1;if(Nl.isTokenExpired(e))return Nl._clearValidationCache(),Nl._handleExpiredToken(),!1;const a=Date.now();return a-Nl._validationCache.timestamp<Nl._validationCache.cacheValidityMs?Nl._validationCache.isValid:(Nl._validationCache.isValid=!0,Nl._validationCache.timestamp=a,!0)},getValidSupabaseToken:()=>Nl.isSupabaseTokenValid()?Nl.getSupabaseToken():null,_handleExpiredToken:()=>{Nl.clearAll()},extractTokenData:()=>{if(nl("TokenManager.extractTokenData"),!Nl.isSupabaseTokenValid())return null;const e=Nl.getSupabaseToken();if(!e)return null;try{const a=pl.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 Nl._handleExpiredToken(),null}},getCompanyId:e=>{nl("TokenManager.getCompanyId");const a=Nl.getAccessToken();if(a)try{const t=pl.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=Nl.extractTokenData();if(t?.companyId)return t.companyId;const r=Nl.getIdToken();if(r)try{const a=pl.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=>{nl("TokenManager.getCompanyIdInt");const a=[Nl.getAccessToken(),Nl.getIdToken()];for(const t of a)if(t)try{const a=pl.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=Nl.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{nl("TokenManager.getAllCompaniesData");const e=Nl.getIdToken();if(!e)return[];try{const a=pl.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[]}}};var _l=Object.defineProperty,Cl=(e,a,t)=>((e,a,t)=>a in e?_l(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);const kl=new class{constructor(){Cl(this,"errors",[]),Cl(this,"toastCount",0),Cl(this,"lastToastTime",0)}handleError(e,a=!0){const t="string"==typeof e?e:e.message,r=Jo(t);if(this.errors.push({id:Ho("short"),message:t,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),a&&this.shouldShowToast()){const e=this.getErrorTitle(r);k.error(e,{description:r})}}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){k.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 Sl(e){return!!e&&e.startsWith("eyJ")}let Al=!1;var El=Object.defineProperty,Pl=(e,a,t)=>((e,a,t)=>a in e?El(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);function Dl(){if(ar()){const e=er();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}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 Tl(){return null!==Dl()}const Il=class e{constructor(e){Pl(this,"client"),Pl(this,"currentToken",null),Pl(this,"config"),this.config=e,function(){const e=import.meta.env.VITE_SUPABASE_PK_OVERRIDE,a=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;Al?Sl(a):e&&Sl(a)?Al=!0:Sl(a)?Al=!0:Al=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const a={apikey:this.config.key};e&&this.isTokenValid(e)&&(a.Authorization=`Bearer ${e}`);return Oa(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:a,fetch:async(e,a)=>{const t="string"==typeof e?e:e.url;if(t.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(t.includes("apikey="))try{const e=new URL(t,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=t.startsWith("http")?e.toString():e.pathname+e.search+e.hash,n={...a,headers:{...a?.headers,apikey:this.config.key}};return fetch(r,n)}}catch{}return fetch(e,a)}}})}static getInstance(){if(!e.instance){const a=Dl();if(!a)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).");e.instance=new e(a)}return e.instance}getClient(){const e=Nl.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!pl.isTokenExpired(e)}catch(a){return kl.handleError(a instanceof Error?a:"Supabase - Error validating token",!1),!1}}};Pl(Il,"instance");let Ml=Il;function Rl(){return Ml.getInstance().getClient()}class zl{static async generateToken(e,a,t,r=!1){try{if(!r){const e=Nl.getSupabaseToken();if(e&&Nl.isSupabaseTokenValid())return e}const n=Rl();nl("SupabaseTokenService.generateToken:invoke");const{data:o,error:i}=await il(0,()=>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?(Nl.setSupabaseToken(o.access_token),o.access_token):null}catch(n){return n instanceof Error&&(n.message.includes("401")||n.message.includes("Unauthorized"))&&t?.(),null}}}var Ll=Object.defineProperty,Fl=(e,a,t)=>((e,a,t)=>a in e?Ll(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,"symbol"!=typeof a?a+"":a,t);class Ul{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=Nl.getAccessToken(),t=Nl.getSelectedAlias();if(!a||!t)return null;const r=await zl.generateToken(a,t,this.onLogoutCallback||void 0,e);return r||null}catch(a){return null}}}Fl(Ul,"regenerationPromise",null),Fl(Ul,"onLogoutCallback",null);class Ol{static handleError(e){if(!e)return!1;const a=e.message||e.toString();return!!this.isAuthenticationError(e,a)&&(Nl.clearAll(),window.location.href=sr("/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.")}}}var jl=Object.defineProperty;class Bl{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 Ul.attemptRegeneration()?(this.isRetrying=!1,!0):(Ol.handleError(e),this.isRetrying=!1,!1)}catch(r){return Ol.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Nl.getAccessToken();return e?Nl.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."}}}((e,a,t)=>{((e,a,t)=>{a in e?jl(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t})(e,a+"",t)})(Bl,"isRetrying",!1);const $l=new class{get baseUrl(){return pr()}async makeApiCall(e,a,t,r){const n=Bl.validateToken();if(!n.valid)throw new Error(n.message||"Token inválido");const o=Nl.getAccessToken();if(!o)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=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(a).forEach(([e,a])=>{i.searchParams.append(e,a)});const s=await fetch(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json",Accept:"application/json","un-alias":t}});if(!s.ok){const e=new Error(`API call failed: ${s.status} ${s.statusText}`);throw e.status=s.status,e.statusCode=s.status,e}return await s.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 kl.handleError(`[QualiexApi] Formato de resposta inesperado${a}`,!1),null;t=e}return Array.isArray(t)?t.map(e=>this.mapToQualiexUser(e)):(kl.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 Bl.handleApiError(n))try{const a=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(a," após retry")??[]}catch(o){return kl.handleError(o instanceof Error?o:"Erro ao buscar usuários após renovação de token",!0),[]}return kl.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 kl.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=Nl.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||""})):(kl.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(a){if(await Bl.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 kl.handleError(t instanceof Error?t:"Erro ao buscar softwares após renovação de token",!0),[]}return kl.handleError(a instanceof Error?a.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,a,t){const r=!!t?.baseUrl,n=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,o=r?t.baseUrl:void 0,i=e=>e.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}));try{const e=await this.makeApiCall(n,{},a,o),t=e?.data||e;return Array.isArray(t)?i(t):(kl.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(s){if(await Bl.handleApiError(s))try{const e=await this.makeApiCall(n,{},a,o),t=e?.data||e;return Array.isArray(t)?i(t):[]}catch(l){return kl.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return kl.handleError(s instanceof Error?s.message:"Erro ao buscar associações do usuário",!0),[]}}};function Vl(e,a){const t=a||fr.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function ql(e,a){const t=a||fr.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Wl(e,a){const t=a||fr.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,t):`${e}${t}`}function Hl(e,a){return a&&a.length>0?a.map(e=>({idField:e.idField,nameField:e.nameField||Vl(e.idField),emailField:e.emailField||ql(e.idField),usernameField:e.usernameField||Wl(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:Vl(e),emailField:ql(e),usernameField:Wl(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const Gl=new Map;class Kl{static async fetchQualiexUsers(e,a){const t=`${a}_${e}_all`,r=Gl.get(t);if(r&&Date.now()-r.timestamp<3e5)return r.users;let n=await $l.fetchUsers(e,a,"all");return 0===n.length&&(n=await $l.fetchUsers(e,a,"active")),Gl.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(!Nl.areAllTokensValid())return e;const t=Nl.extractTokenData();if(!t)return e;const{alias:r,companyId:n}=t;if(!r||!n)return e;const o=Hl(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 kl.handleError(t instanceof Error?t:new Error(`[QualiexEnrichment.${a.entityName}] Erro crítico`),!1),e}}}const Yl=["responsible_name"],Ql=e=>Yl.includes(e);function Jl(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(!Nl.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Rl().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||Ql(a)||(n=n.order(a,{ascending:"asc"===t})),{query:n,isForeignKey:s}},m=async(e,a,t,n,o)=>{const i=Hl(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===a||e.emailField===a||e.usernameField===a),s=a.includes(".");if(Ql(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 Kl.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 Kl.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=Hl(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=ei(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={...ei(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}const Xl={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},Zl=class{static async initialize(){try{const e=or();if(e){if(Nl.checkProjectMismatch())return{...Xl}}if(!Nl.hasAllTokens()||!Nl.areAllTokensValid())return Nl.clearExpiredTokens(),{...Xl};const a=Nl.getAccessToken(),t=Nl.getIdToken();Nl.clearManualLogout();const r=this.extractUserFromIdToken(t,a),n=this.extractCompaniesFromIdToken(t),o=e?Nl.extractTokenData():null,i=this.resolveAliasFromContext(n,a,o?.alias??null);if(e&&(!Nl.isSupabaseTokenValid()&&i&&await Ul.attemptRegeneration(),!Nl.isSupabaseTokenValid()))return{...Xl};let s=null;if(i){const e=Nl.getCompanyId(i),a=n.find(e=>e.alias===i);a&&(s={id:e||a.id,name:a.name,alias:a.alias})}const l=o?.placeId??null,d=o?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:i,companies:n,selectedUnit:s,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:d,activePlaceId:l,activePlaceName:d}}catch(e){return{...Xl}}}static async loginDev(){if(!or())return this.loginProd(),!0;try{const e=Rl(),{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(sr("/callback"));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==";Nl.setOAuthState(e);const a=Nl.generateOAuthNonce();Nl.setOAuthNonce(a);const t=sr("/callback"),r=new URL(ir.oauth.authUrl);r.searchParams.set("client_id",ir.oauth.clientId),r.searchParams.set("response_type",ir.oauth.responseType),r.searchParams.set("scope",ir.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=Nl.getAccessToken();e!==r&&Nl.clearAll()}const i=or();if(Nl.hasAllTokens()){if(i){Nl.getValidSupabaseToken()||await Ul.attemptRegeneration(!0)}return!0}const s=r,l=n;if(!s||!l)throw new Error("Tokens não encontrados na URL de callback");Nl.setAccessToken(s),Nl.setIdToken(l),Nl.clearManualLogout();const d=this.extractCompaniesFromIdToken(l),c=this.resolveAliasFromContext(d,s,null);if(!c)throw new Error("Nenhuma empresa encontrada nos tokens");if(Nl.setSelectedAlias(c),i){if(!await Ul.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return Nl.clearOAuthState(),Nl.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){const e=Nl.getIdToken();Nl.clearAll(),Nl.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}const a=sr("/login");if(e)try{const t=new URL(ir.oauth.logoutUrl);return t.searchParams.set("id_token_hint",e),t.searchParams.set("post_logout_redirect_uri",a),t.searchParams.set("client_id",ir.oauth.clientId),void(window.location.href=t.toString())}catch{}window.location.href=sr("/login")}static decodeToken(e){return pl.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=[];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()})}}});const r=new Map;for(const o of t){if(!o.alias)continue;const e=r.get(o.alias);(!e||!e.id&&o.id)&&r.set(o.alias,o)}const n=Array.from(r.values());t.length,n.length;return n.length,n}static extractAliasFromAccessToken(e){const a=this.decodeToken(e);return a?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const a=e.split(".");if(a.length<3)return null;const t=a[0];return"www"===t||"admin"===t?null:a.length>=4?a[1]:t}static resolveAliasFromContext(e,a,t){const r=a=>!!a&&e.some(e=>e.alias===a),n=this.getSubdomainAlias();if(r(n))return n;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(t))return t;const o=Nl.getSelectedAlias();if(r(o))return o;const i=this.extractAliasFromAccessToken(a);return r(i)?i:e[0]?.alias||null}};Ul.setLogoutCallback(()=>{Zl.logout()});let ed=Zl;const ad=e=>e?.placeId||null,td=e=>e?.placeName||null,rd=d(void 0),nd=({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=ja()}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=Nl.getAccessToken();if(!o)return;const i=or();let s=null;if(i){const t=await zl.generateToken(o,e.alias,void 0,!0);if(c.current!==a)return;if(!t)return;Nl.setSupabaseToken(t),s=Nl.extractTokenData()}Nl.setSelectedAlias(e.alias);const l=s?.alias||e.alias,d=s?.companyId||Nl.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 $l.fetchActiveUsersMap(l,d);if(c.current!==a)return;const r=e.get(t.user.id);if(r){const e=(e=>({placeId:ad(e),placeName:td(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()=>{nl("AuthContext.processCallback");const e=await il(0,()=>ed.processCallback());if(e){const e=await il(0,()=>ed.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 ed.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(Nl.areAllTokensValid()){if(or()&&!Nl.isSupabaseTokenValid())try{await Ul.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 ed.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&&(Ol.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(rd.Provider,{value:N,children:e})},od=()=>{const e=c(rd);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function id({queryKey:e,service:a,entityName:t,searchFields:r,additionalFilters:n={},onSuccess:o}){const[d,c]=Wa(),u=ja(),{alias:m,userId:p,isAuthenticated:h}=od(),{t:f}=La(),g=l(a=>{const t=`${e}_${a}`,r=d.get(t);return r||(d.get(a)||"")},[d,e]),v=g("search"),b=g("sortField")||lr.sorting.defaultField,x=g("sortDirection")||lr.sorting.defaultDirection,y=parseInt(g("page")||"1"),w=parseInt(g("limit")||String(lr.pagination.defaultPageSize)),N=v,_=s(()=>({search:N,sortField:b,sortDirection:x,page:y,limit:w,...n}),[N,b,x,y,w,n]),C=l(()=>a.getAll(_),[a,_]),S=Ba({queryKey:[e,m,p,_],queryFn:C,enabled:!!m&&h});if(!S)throw new Error(`useCrud: Query initialization failed for "${t}". Ensure QueryClientProvider is configured in your app root.`);const A=$a({mutationFn:a.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(vr.success.created(t)),o?.()},onError:e=>{k.error(`${vr.error.create(t)}: ${e.message}`)}}),E=$a({mutationFn:({id:e,data:t})=>a.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(vr.success.updated(t)),o?.()},onError:e=>{k.error(`${vr.error.update(t)}: ${e.message}`)}}),P=$a({mutationFn:a.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),k.success(vr.success.deleted(t))},onError:e=>{k.error(`${vr.error.delete(t)}: ${e.message}`)}}),D=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=>{D({search:e,page:1})},[D]),I=l(e=>{D({sortField:e,sortDirection:b===e&&"asc"===x?"desc":"asc",page:1})},[b,x,D]),M=l(e=>{D({page:e})},[D]),R=l(e=>{D({limit:e,page:1})},[D]),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([]),U=l(e=>{F(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),O=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]),$=$a({mutationFn:async e=>{await Promise.all(e.map(e=>a.delete(e)))},onSuccess:(a,r)=>{u.invalidateQueries({queryKey:[e]}),k.success(f("bulk_delete_success",`${r.length} ${t}(s) deletado(s) com sucesso`)),j()},onError:e=>{k.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||lr.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:P?.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:P.mutate,save:V,handleSearch:T,handleSort:I,handlePageChange:M,handleItemsPerPageChange:R,clearFilters:z,refetch:S.refetch,selectedIds:L,selectItem:U,selectAll:O,clearSelection:j,isAllSelected:B,bulkDelete:e=>$.mutateAsync(e),isBulkDeleting:$.isPending}}function sd(e){const a=Jl({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)=>id({queryKey:e.tableName,service:a,entityName:e.entityName,additionalFilters:t,onSuccess:r})}}function ld(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 dd(e=768){return ld(`(max-width: ${e-1}px)`)}const cd=n.forwardRef(({className:e,...t},r)=>a("table",{ref:r,className:Zo("w-full caption-bottom text-[13px] table-fixed",e),...t}));cd.displayName="Table";const ud=n.forwardRef(({className:e,...t},r)=>a("thead",{ref:r,className:Zo("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));ud.displayName="TableHeader";const md=n.forwardRef(({className:e,...t},r)=>a("tbody",{ref:r,className:Zo("[&_tr:last-child]:border-0",e),...t}));md.displayName="TableBody";const pd=n.forwardRef(({className:e,...t},r)=>a("tfoot",{ref:r,className:Zo("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));pd.displayName="TableFooter";const hd=n.forwardRef(({className:e,...t},r)=>a("tr",{ref:r,className:Zo("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...t}));hd.displayName="TableRow";const fd=n.forwardRef(({className:e,...t},r)=>a("th",{ref:r,className:Zo("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}));fd.displayName="TableHead";const gd=n.forwardRef(({className:e,...t},r)=>a("td",{ref:r,className:Zo("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...t}));gd.displayName="TableCell";const vd=n.forwardRef(({className:e,...t},r)=>a("caption",{ref:r,className:Zo("mt-4 text-sm text-muted-foreground",e),...t}));function bd({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(Hs,{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(Hs,{className:"h-4 w-20"},t))})},t))})]})})}function xd({count:e=3}){return a("div",{className:"space-y-4",children:Array.from({length:e}).map((e,r)=>t(di,{children:[t(ci,{children:[a(Hs,{className:"h-4 w-3/4"}),a(Hs,{className:"h-3 w-1/2"})]}),a(pi,{children:t("div",{className:"space-y-2",children:[a(Hs,{className:"h-3 w-full"}),a(Hs,{className:"h-3 w-2/3"})]})})]},r))})}function yd({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(Hs,{className:"h-4 w-24"}),a(Hs,{className:"h-10 w-full"})]},r)),t("div",{className:"flex justify-end space-x-2 pt-4",children:[a(Hs,{className:"h-10 w-20"}),a(Hs,{className:"h-10 w-20"})]})]})}function wd(){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(Hs,{className:"h-8 w-8 rounded-full"}),a(Hs,{className:"h-6 w-32"})]}),t("div",{className:"flex items-center space-x-2",children:[a(Hs,{className:"h-8 w-8"}),a(Hs,{className:"h-8 w-24"})]})]})}function Nd(){return a("div",{className:"w-64 border-r bg-muted/10",children:t("div",{className:"p-4",children:[a(Hs,{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(Hs,{className:"h-4 w-4"}),a(Hs,{className:"h-4 w-20"})]},r))})]})})}vd.displayName="TableCaption";const _d={default:V,search:$,error:B};function Cd({icon:e,title:r,description:n,action:o,className:i,variant:s="default"}){const{t:l}=La(),d=!!e,c=_d[s];return t("div",{className:Zo("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(ni,{onClick:o.onClick,variant:"outline",children:o.label})]})}function kd({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(Ps,{delayDuration:300,children:t(Ds,{children:[a(Ts,{asChild:!0,children:l}),a(Is,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):l}const Sd=n.forwardRef(({direction:e,onMouseDown:t,isDragging:r,className:n},o)=>{const i="horizontal"===e;return a("div",{ref:o,onMouseDown:t,className:Zo("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:Zo("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",i?"h-6 w-0.5":"w-6 h-0.5")})})});Sd.displayName="TableResizeHandle";const Ad=Ja.Root,Ed=Ja.Trigger,Pd=Ja.Group,Dd=Ja.Portal,Td=Ja.Sub,Id=Ja.RadioGroup,Md=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(Ja.SubTrigger,{ref:i,className:Zo("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"})]}));Md.displayName=Ja.SubTrigger.displayName;const Rd=n.forwardRef(({className:e,...t},r)=>a(Ja.SubContent,{ref:r,className:Zo("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}));Rd.displayName=Ja.SubContent.displayName;const zd=n.forwardRef(({className:e,...t},r)=>a(Ja.Portal,{children:a(Ja.Content,{ref:r,className:Zo("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})}));zd.displayName=Ja.Content.displayName;const Ld=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ja.Item,{ref:n,className:Zo("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}));Ld.displayName=Ja.Item.displayName;const Fd=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(Ja.CheckboxItem,{ref:i,className:Zo("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(Ja.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Fd.displayName=Ja.CheckboxItem.displayName;const Ud=n.forwardRef(({className:e,children:r,...n},o)=>t(Ja.RadioItem,{ref:o,className:Zo("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(Ja.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));Ud.displayName=Ja.RadioItem.displayName;const Od=n.forwardRef(({className:e,inset:t,...r},n)=>a(Ja.Label,{ref:n,className:Zo("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));Od.displayName=Ja.Label.displayName;const jd=n.forwardRef(({className:e,...t},r)=>a(Ja.Separator,{ref:r,className:Zo("-mx-1 my-1 h-px bg-border",e),...t}));jd.displayName=Ja.Separator.displayName;const Bd=({className:e,...t})=>a("span",{className:Zo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Bd.displayName="ContextMenuShortcut";const $d=({onEdit:e,onDelete:n,onToggleStatus:o,isActive:i=!0,canDelete:s=!0,customActions:l=[],renderAs:d})=>{const{t:c}=La(),u=[];if(e){const a={icon:q,label:c("edit"),onClick:e};u.push(a)}if(l.forEach(e=>{u.push(e)}),o){const e={icon:i?W:H,label:i?"Inativar":"Ativar",onClick:o};u.push(e)}if(s&&n){const e={icon:G,label:c("ap_delete"),onClick:n,destructive:!0};u.push(e)}const m="dropdown"===d?_s:Ld;return a(r,{children:u.map((e,r)=>t(m,{onClick:e.onClick,className:Zo("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))})},Vd=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>t(hs,{children:[a(fs,{asChild:!0,children:a(ni,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:a(E,{size:12})})}),a(Ns,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:a($d,{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"})})]}),qd=({onEdit:e,onDelete:r,canDelete:n=!0,onToggleStatus:o,isActive:i=!0,customActions:s=[]})=>{const{t:l}=La();return a(Ps,{delayDuration:200,children:t("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e()},children:a(K,{size:14})})}),a(Is,{children:l("edit")})]}),s.map((e,r)=>{const n=e.icon;return t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a=>{a.stopPropagation(),e.onClick()},children:a(n,{size:14})})}),a(Is,{children:e.label})]},r)}),o&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),o()},children:a(i?Y:Q,{size:14})})}),a(Is,{children:i?"Inativar":"Ativar"})]}),r&&n&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:Zo("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),r()},children:a(G,{size:14})})}),a(Is,{children:l("ap_delete")})]})]})})},Wd=150;function Hd({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??Wd,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??Wd,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]??Wd)},[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??Wd,e),{});o(r),a&&localStorage.removeItem(a),t?.(r)},[e,a,t]);return{columnWidths:n,isDragging:s,activeColumn:c,handleMouseDown:g,resetWidths:v}}const Gd=b("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"}}),Kd=n.forwardRef(({className:e,variant:t,size:r,...n},o)=>a(Za.Root,{ref:o,className:Zo(Gd({variant:t,size:r,className:e})),...n}));Kd.displayName=Za.Root.displayName;const Yd=n.createContext({size:"default",variant:"default"}),Qd=n.forwardRef(({className:e,variant:t,size:r,children:n,...o},i)=>a(Xa.Root,{ref:i,className:Zo("flex items-center justify-center gap-1",e),...o,children:a(Yd.Provider,{value:{variant:t,size:r},children:n})}));Qd.displayName=Xa.Root.displayName;const Jd=n.forwardRef(({className:e,children:t,variant:r,size:o,...i},s)=>{const l=n.useContext(Yd);return a(Xa.Item,{ref:s,className:Zo(Gd({variant:l.variant||r,size:l.size||o}),e),...i,children:t})});Jd.displayName=Xa.Item.displayName;const Xd=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}=La(),_=c>0,C=e&&n||h.length>0,k=f||b||y,S=o&&s;return C||S||k||d&&_?t("div",{className:Zo("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(ni,{onClick:e,children:[a(J,{size:16,className:"mr-2"}),r||"Novo"]}),h.map((e,r)=>{const n=e.icon;return t(ni,{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(ds,{variant:"secondary",className:"mr-1 tabular-nums",children:c}),t(Ps,{delayDuration:200,children:[u.length>0?u.map((e,r)=>{const n=e.icon,o=e.disabled;return t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:Zo("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(Is,{children:e.label})]},r)}):t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:a(G,{size:16})})}),a(Is,{children:N("ap_delete")})]}),t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:a(P,{size:16})})}),a(Is,{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($,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(ii,{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(Qd,{type:"single",value:g,onValueChange:e=>e&&v(e),size:"sm",children:x.map(e=>{const t=(e=>{switch(e){case"table":return ee;case"list":return Z;case"grid":return X}})(e);return a(Jd,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:a(t,{className:"h-4 w-4"})},e)})}),y]})]}):null}),Zd=p(({checked:e,onCheckedChange:t})=>a(is,{checked:e,onCheckedChange:t}),(e,a)=>e.checked===a.checked);function ec(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 ac({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=ec(a);return e?.hiddenColumns??o}),[u,p]=i(()=>{if(!t||!a)return n;const e=ec(a)?.columnOrder;return e&&e.length>0?e:n}),[h,f]=i(()=>t&&a?ec(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,P=l(e=>{f(e?[e]:[]),v(new Set)},[]),D=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:D,allColumns:e,isColumnHidden:b,toggleColumn:x,showAllColumns:y,resetColumns:w,columnOrder:u,reorderColumns:N,groupByColumn:E,setGroupByColumn:P,groupByColumns:h,setGroupByColumns:C,addGroupByColumn:k,removeGroupByColumn:S,reorderGroupByColumns:A,getGroupedData:T,collapsedGroups:g,toggleGroupCollapse:_}}function tc({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 rc({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}=La(),[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(zs,{asChild:!0,children:a(ni,{variant:"outline",size:"icon",className:"h-8 w-8",children:a(ae,{size:16})})}),t(Ls,{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(Ps,{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:Zo("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(te,{size:14,className:"text-muted-foreground shrink-0"}),a(is,{checked:!s,onCheckedChange:()=>u&&o(i),disabled:!u,className:"shrink-0"}),a("span",{className:Zo("flex-1 truncate",s&&"text-muted-foreground"),children:e.header}),f&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:Zo("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(re,{size:14})})}),a(Is,{children:g(N?"remove_grouping":"group_by_column")})]})]},i)})})}),t("div",{className:"border-t px-3 py-2 space-y-1",children:[a(ni,{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(ni,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:f,children:"Redefinir padrão"})]})]})]})}function nc({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:Zo("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(re,{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(ds,{variant:"secondary",className:Zo("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(P,{size:12})})]})]},e)}):a("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const oc=({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:$=!1,renderExpandedContent:V,expandedRowIds:q,onToggleExpand:W,defaultExpandAll:H=!1,hideActionsColumn:G=!1})=>{const{t:K}=La(),{setSearchVisible:Y}=od(),Q=dd(),[J,X]=i(()=>H&&$?new Set(r.entities.map(e=>e.id)):new Set),Z=void 0!==q,ee=Z?new Set(q):J,ae=l(e=>{Z&&W?W(e):X(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 re=ac({columns:n,storageKey:U,enabled:F,defaultHiddenColumns:j}),ie=tc({enabled:F,onReorder:re.reorderColumns}),se=F?re.visibleColumns:n,{columnWidths:le,isDragging:de,activeColumn:ce,handleMouseDown:ue}=Hd({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(gd,{className:"text-center",children:h?h(e):"inline"===v?a("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:a(qd,{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(Vd,{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(zd,{className:"w-[160px]",children:a($d,{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(rc,{columns:n,columnOrder:re.columnOrder,isColumnHidden:re.isColumnHidden,toggleColumn:re.toggleColumn,showAllColumns:re.showAllColumns,resetColumns:re.resetColumns,reorderColumns:re.reorderColumns,groupByColumn:B?re.groupByColumn:void 0,setGroupByColumn:B?re.setGroupByColumn:void 0,groupByColumns:B?re.groupByColumns:void 0,addGroupByColumn:B?re.addGroupByColumn:void 0,removeGroupByColumn:B?re.removeGroupByColumn:void 0}):void 0;if(Q)return r.isLoading?a(xd,{count:3}):0===r.entities.length?a(Cd,{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: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(Ad,{children:[a(Ed,{asChild:!0,children:a(di,{className:Zo("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(pi,{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(Zd,{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(Vd,{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&&re.groupByColumns.length>0?re.getGroupedData(r.entities):null,ye=null!==xe,we=($?1:0)+(g?1:0)+se.length+(G?0:1),Ne=e=>{const n=$&&ee.has(e.id);return t(o.Fragment,{children:[t(Ad,{children:[a(Ed,{asChild:!0,children:t(hd,{className:Zo("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(gd,{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(gd,{onClick:e=>e.stopPropagation(),children:a(Zd,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),se.map(t=>a(gd,{className:t.className,children:a(kd,{children:t.render?t.render(e):String(e[t.key]??"")})},String(t.key))),!G&&ge(e)]})}),ve(e)]}),n&&V&&a(hd,{className:"bg-muted/30 hover:bg-muted/30",children:a(gd,{colSpan:we,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:V(e)})})})]},e.id)},_e=(e,r)=>{const{t:n}=La();return e.map(e=>{const n=re.collapsedGroups.has(e.groupKey),i=16*e.level,s=Math.max(30,70-15*e.level);return t(o.Fragment,{children:[a(hd,{className:Zo("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${s}%)`},onClick:()=>re.toggleGroupCollapse(e.groupKey),children:a(gd,{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(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:w,filters:T,viewMode:I,onViewModeChange:M,showViewToggle:R}),r.isLoading?a(bd,{rows:5,columns:se.length}):t("div",{className:"flex flex-col h-full overflow-hidden",children:[B&&a(nc,{columns:n,groupByColumns:re.groupByColumns,addGroupByColumn:re.addGroupByColumn,removeGroupByColumn:re.removeGroupByColumn,reorderGroupByColumns:re.reorderGroupByColumns}),a("div",{className:"flex-1 overflow-auto",children:t(cd,{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(ud,{children:t(hd,{children:[$&&a(fd,{className:"w-[40px]"}),g&&a(fd,{className:"w-[50px]",children:a(Zd,{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(fd,{className:Zo(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(ne,{size:14,className:"ml-1"}):a(oe,{size:14,className:"ml-1"}))]}),o&&a(Sd,{direction:"horizontal",onMouseDown:a=>ue(String(e.key),a),isDragging:i})]},String(e.key));var c}),!G&&a(fd,{className:"w-[50px] text-center",children:be||e.t("actions")})]})}),a(md,{children:0===r.entities.length?a(hd,{children:a(gd,{colSpan:we,className:"h-32",children:a(Cd,{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 ic(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 sc=[{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}],lc=[10,22,35,45,55,68,78,87,94].flatMap(e=>sc.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))),dc=({value:e="#3b82f6",onChange:r,label:n,customColorLabel:i,presetColorsLabel:s,showHexValue:l=!0})=>{const{t:d}=La(),c=i??d("custom_color"),u=s??d("preset_colors"),[m,p]=o.useState(!1),h=o.useRef([]),f=sc.length,g=o.useMemo(()=>{const a=lc.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(lc.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(li,{children:n}),t(Rs,{open:m,onOpenChange:p,children:[a(zs,{asChild:!0,children:t(ni,{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(Ls,{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(li,{children:u}),a("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${sc.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(lc.length-1);break;case"Enter":e.preventDefault(),y(lc[v]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:lc.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(li,{htmlFor:"color-input",children:c}),a(ii,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},cc=n.forwardRef(({className:e,children:r,...n},o)=>t(et.Root,{ref:o,className:Zo("relative overflow-hidden",e),...n,children:[a(et.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),a(uc,{}),a(et.Corner,{})]}));cc.displayName=et.Root.displayName;const uc=n.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a(et.ScrollAreaScrollbar,{ref:n,orientation:t,className:Zo("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(et.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));uc.displayName=et.ScrollAreaScrollbar.displayName;const mc=[{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 pc({name:e,filled:t,className:r}){return a("span",{className:`material-symbols-outlined ${r??""}`,style:t?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const hc=({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,mc.find(e=>e.name===g)):null;var g;const v=s(()=>{if(!e)return 0;const a=mc.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(mc.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(mc.length-1);break;case"Enter":e.preventDefault(),w(mc[b]?.name??null);break;case"Tab":e.preventDefault(),p(!1)}},[b,y,w]);return t("div",{className:"space-y-2",children:[n&&a(li,{children:n}),t(Rs,{open:c,onOpenChange:p,children:[a(zs,{asChild:!0,children:t(ni,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:N,children:[f?a(pc,{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(Ls,{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(cc,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:a("div",{className:"grid grid-cols-10 gap-1",onKeyDown:_,role:"grid",children:mc.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(pc,{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})]})})]})]})},fc=n.forwardRef(({className:e,...t},r)=>a(at.Root,{className:Zo("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(at.Thumb,{className:Zo("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")})}));fc.displayName=at.Root.displayName;const gc=(e={})=>{const{user:a,alias:t}=od(),{enabled:r=!0,status:n="active"}=e;return Ba({queryKey:["qualiex-users",t,n],queryFn:()=>$l.getUsers(t,n),enabled:r&&!!t&&!!a,staleTime:3e5,retry:2,retryDelay:1e3})},vc=({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}=La(),{data:k=[],isLoading:S,error:A}=gc({enabled:g}),[E,P]=i(new Map),D=s(()=>t?Array.isArray(t)?t.filter(Boolean):[t].filter(Boolean):[],[t]),T=s(()=>{if(0===D.length||0===k.length)return"";const e=new Set(k.map(e=>e.userId||e.id||""));return D.filter(a=>a&&!e.has(a)&&!E.has(a)).sort().join(",")},[D,k,E]);m(()=>{if(!T)return;const e=T.split(",");let a=!1;const t=Nl.extractTokenData();return t?.alias&&t?.companyId?($l.fetchUsers(t.alias,t.companyId,"all").then(t=>{a||P(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===D.length)return I;const a=new Set(I.map(e=>e.userId||e.id||"")),t=D.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,D,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(Ys,{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 bc({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}=ic(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 P=A.find(e=>e.id===E),D=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?Zo("space-y-2 w-full",e.wrapperClassName):Zo("space-y-2",e.className,e.wrapperClassName);return t("div",{className:s,children:[e.label,a("div",{className:i,children:e.fields?.map(e=>D(e))})]},e.name);case"user-select":return t("div",{className:`space-y-2 ${e.className||""}`,children:[t(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(vc,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ss,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),t(Qi,{value:String(n),onValueChange:a=>{k(e.name,a),e.onValueChange&&e.onValueChange(a)},disabled:e.disabled,children:[a(Zi,{className:`${o?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:a(Xi,{placeholder:e.placeholder})}),a(ts,{children:e.options?.map(e=>a(ns,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(Ys,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ii,{id:e.name,type:"date",value:String(n),onChange:a=>k(e.name,a.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Zo("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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ii,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(dc,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(hc,{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(li,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ii,{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(is,{id:e.name,checked:!!n,onCheckedChange:a=>k(e.name,a),disabled:e.disabled}),t(li,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(fc,{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(li,{htmlFor:e.name,children:[e.label,e.required&&a("span",{className:"text-destructive ml-1",children:"*"})]}),a(ii,{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(!P)return null;if(P.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(P.component){const e=P.component;return a(e,{formData:_,updateField:k,errors:C,users:f,disabled:P.disabled})}return a("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:P.fields.map(D)})},[P,_,k,C,f,D]),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(ni,{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(ni,{type:"button",variant:"outline",onClick:c,children:"Cancelar"}),a(ni,{type:"submit",disabled:h,children:p||"Salvar"})]})]})})]});return a(Ai,{open:m,onOpenChange:e=>{!1===e&&!0===m&&c()},children:t(Mi,{ref:w,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t(Ri,{showSeparator:!0,children:[a(Fi,{children:e}),a(Ui,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),I]})})}function xc({currentPage:e,totalPages:n,totalItems:o,itemsPerPage:i,onPageChange:s,onItemsPerPageChange:l,variant:d="full"}){const{t:c}=La();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(Qi,{value:String(i),onValueChange:e=>l(Number(e)),children:[a(Zi,{className:"h-8 w-[70px]",children:a(Xi,{})}),t(ts,{children:[a(ns,{value:"10",children:"10"}),a(ns,{value:"25",children:"25"}),a(ns,{value:"50",children:"50"}),a(ns,{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(ni,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:1===e,className:"h-8 w-8 p-0",children:a(ie,{size:16})}),a(ni,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:a(se,{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(ni,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:e===n,className:"h-8 w-8 p-0",children:a(O,{size:16})}),a(ni,{variant:"outline",size:"sm",onClick:()=>s(n),disabled:e===n,className:"h-8 w-8 p-0",children:a(le,{size:16})})]})]})}function yc({manager:e}){return a(xc,{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 wc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Nc={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},_c={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Cc({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:o="start",wrap:i=!1,className:s}){return a("div",{className:Zo("flex","column"===t?"flex-col":"flex-row",wc[r],Nc[n],_c[o],i&&"flex-wrap",s),children:e})}function kc({manager:e,filters:n,inline:o=!1}){const{t:i}=La(),{isSearchVisible:s}=od(),l=e.searchTerm,d=t(r,{children:[n.some(e=>"search"===e.type)&&!s&&t("div",{className:"relative flex-1",children:[a($,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(ii,{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(Qi,{value:e.value||"",onValueChange:a=>e.onChange?.(a),children:[a(Zi,{className:"w-[180px]",children:a(Xi,{placeholder:e.placeholder})}),a(ts,{children:e.options.map(e=>a(ns,{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(ni,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[a(P,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return o?a("div",{className:"flex items-center gap-2",children:d}):a(Cc,{direction:"column",gap:"md",className:"mb-6",children:a(Cc,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:d})})}function Sc({manager:e,config:r,formSections:n,onSave:o,onToggleStatus:s,defaultSort:l}){e&&e.queryKey;const{setSearchVisible:d}=od(),[c,u]=Wa(),[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(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(kc,{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(oc,{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(yc,{manager:e})}),!r.useCustomRouting&&!r.onNew&&n.length>0&&a(bc,{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(Ai,{open:v.isOpen,onOpenChange:_,children:t(Mi,{size:"sm",variant:"destructive",children:[a(Ri,{showSeparator:!0,children:a(Fi,{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(Li,{children:[a(ni,{variant:"outline",onClick:_,children:"Cancelar"}),a(ni,{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(Ai,{open:x.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),children:t(Mi,{size:"sm",variant:"destructive",children:[a(Ri,{showSeparator:!0,children:a(Fi,{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(Li,{children:[a(ni,{variant:"outline",onClick:()=>y({isOpen:!1,count:0}),children:"Cancelar"}),a(ni,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),y({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Ac(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(Sc,{manager:l,config:d,formSections:n.formSections,onSave:o,onToggleStatus:s,defaultSort:n.defaultSort})}}function Ec(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 Pc(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:Tc(e),label:Tc(e),...Dc(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 Dc(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 Tc(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const Ic=({children:n})=>{const{isAuthenticated:i,isLoading:s}=od();if(o.useEffect(()=>{if(s)return;if(i)return;if(Nl.isManualLogout())return void(window.location.pathname.endsWith("/login")||(window.location.href=sr("/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=ur(),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 ed.loginDev():ed.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(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:a(ui,{className:"text-xl font-semibold",children:"Carregando..."})}),t(pi,{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(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:a(ui,{className:"text-xl font-semibold",children:"Processando..."})}),t(pi,{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(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:a(ui,{className:"text-xl font-semibold",children:"Iniciando..."})}),t(pi,{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:ur()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return a(r,{children:n})};function Mc(e={}){const{paramName:a="alias"}=e,t=Ha(),{alias:r,companies:n}=od(),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 Rc({children:e,paramName:n="alias"}){const o=Ga(),s=Ka(),d=Ha(),{alias:c,isAuthenticated:p,isLoading:h,switchUnit:f}=od(),{urlAlias:g,isAliasMismatch:v,isValidAlias:b,isMissing:x,matchedCompany:y}=Mc({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(us,{size:"lg"}),a("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):a(r,{children:e})}function zc(){const{alias:e}=od(),{pathname:t,search:r,hash:n}=Ka();return e?a(Ya,{to:`/${e}${t}${r}${n}`,replace:!0}):null}const Lc=b("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"}}),Fc={info:ue,warning:ue,danger:ce,success:de},Uc=n.forwardRef(({className:e,variant:r="info",showIcon:n=!0,children:o,...i},s)=>{const l=Fc[r||"info"];return t("div",{ref:s,role:"alert",className:Zo(Lc({variant:r}),e),...i,children:[n&&a(l,{className:"h-4 w-4"}),o]})});Uc.displayName="Alert";const Oc=n.forwardRef(({className:e,...t},r)=>a("h5",{ref:r,className:Zo("mb-1 font-medium leading-none tracking-tight",e),...t}));Oc.displayName="AlertTitle";const jc=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("text-sm [&_p]:leading-relaxed",e),...t}));jc.displayName="AlertDescription";const Bc=()=>{const{processCallback:e}=od(),n=Ga(),[o,s]=i(null),[l,d]=i(!1);m(()=>{let a=!1;if(cl()){rl.clear(),function(){if(tl&&"undefined"!=typeof PerformanceObserver&&!ll)try{ll=new PerformanceObserver(e=>{for(const a of e.getEntries())a.duration}),ll.observe({type:"longtask",buffered:!0})}catch{}}(),ol("callback:start");try{const e=Nl.getAccessToken(),a=Nl.getIdToken();if(e){dl(0,e,pl.parseJwtPayload(e))}if(a){dl(0,a,pl.parseJwtPayload(a))}}catch{}}const t=cl()?window.setTimeout(()=>{a||sl()},15e3):0;return(async()=>{try{const t=await e();if(a=!0,cl()&&(ol("callback:processCallback:end"),function(e,a,t){if(!tl)return null;try{return performance.measure(`auth:${e}`,`auth:${a}`,`auth:${t}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),sl()),t){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(t){a=!0,cl()&&sl(),localStorage.removeItem("auth_return_url"),s(t?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{t&&window.clearTimeout(t),function(){if(ll){try{ll.disconnect()}catch{}ll=null}}()}},[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=sr("/")};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(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:t(ui,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[a(B,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t(pi,{className:"space-y-4",children:[a(Uc,{variant:"danger",children:a(jc,{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(ni,{onClick:c,disabled:l,className:"flex-1",children:t(r,l?{children:[a(us,{size:"sm",className:"mr-2"}),"Tentando..."]}:{children:[a(me,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),a(ni,{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(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:a(ui,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t(pi,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(us,{size:"lg"})}),a("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},$c=()=>{const{t:e}=La();return a("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t(di,{className:"w-full max-w-md",children:[a(ci,{className:"text-center",children:a(ui,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t(pi,{className:"text-center space-y-4",children:[a("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),a(ni,{onClick:async()=>{ur()?await ed.loginDev():ed.loginProd()},className:"w-full",size:"lg",children:ur()?e("dev_login"):e("login_with_qualiex")})]})]})})},Vc=n.forwardRef(({className:e,...t},r)=>a(tt.Root,{ref:r,className:Zo("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Vc.displayName=tt.Root.displayName;const qc=n.forwardRef(({className:e,...t},r)=>a(tt.Image,{ref:r,className:Zo("aspect-square h-full w-full",e),...t}));qc.displayName=tt.Image.displayName;const Wc=n.forwardRef(({className:e,...t},r)=>a(tt.Fallback,{ref:r,className:Zo("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));function Hc(){return pr()||"https://common-v4-api.qualiex.com"}function Gc(){const e=Hc().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://ident-api${e[1]||""}.${e[2]}`}return"https://ident-api.qualiex.com"}function Kc(){const e=Hc().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(e){return`https://login-api${e[1]||""}.${e[2]}`}return"https://login-api.qualiex.com"}function Yc(e){const a=Nl.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function Qc(e,a,t){const r=async()=>{const r=await fetch(e,{...t,headers:{...Yc(a),...t?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(n){if(await Bl.handleApiError(n))return await r();throw n}}async function Jc(e){const a=Nl.getAccessToken(),t=Nl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const a=pl.parseJwtPayload(e),t="string"==typeof a?.subNewId?a.subNewId.trim():"";if(!t)throw new Error("NewId do usuário não encontrado no id-token.");return t}(t),n=Nl.getSelectedAlias()?.trim()||Nl.extractTokenData()?.alias||"",o=`${Kc()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,i=async()=>{const r=Nl.getAccessToken()||a,i=Nl.getIdToken()||t,s=new FormData;s.append(e.name,e,e.name);const l=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":i,Accept:"application/json, text/plain, */*",...n?{"un-alias":n}:{},AppGroupId:"1"},body:s});if(!l.ok){const e=new Error(`Upload falhou: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await i()}catch(s){if(await Bl.handleApiError(s))try{return void await i()}catch(l){throw kl.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw s}}Wc.displayName=tt.Fallback.displayName;const Xc={"en-US":1,"pt-BR":2,"es-ES":3};function Zc(e,a){const t=e?.trim();if(t)return t;const r=pl.parseJwtPayload(a),n="string"==typeof r?.subNewId?r.subNewId.trim():"";if(n)return n;throw new Error("Identificador do usuário não encontrado.")}function eu(e){const a=Nl.getSelectedAlias()?.trim();if(a)return a;const t=Nl.getSupabaseToken(),r=t?pl.parseJwtPayload(t):null,n="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(n)return n;const o=pl.parseJwtPayload(e),i="string"==typeof o?.default?o.default.trim():"string"==typeof o?.alias?o.alias.trim():"string"==typeof o?.user_alias?o.user_alias.trim():"";if(i)return i;for(const s in o||{}){if(!/^co\d+$/.test(s))continue;const e=o?.[s];if("string"!=typeof e)continue;const[a]=e.split(";");if(a?.trim())return a.trim()}}async function au(e){const a=Nl.getAccessToken(),t=Nl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=Zc(e.newId,t),n=eu(t),o={};e.name&&e.name.trim()&&(o.Name=e.name.trim()),e.email&&e.email.trim()&&(o.Email=e.email.trim());const i=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e?e:null:Xc[e]??null}(e.language);void 0!==i&&(o.LanguageId=i);const s=`${Kc()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=Nl.getAccessToken()||a,r=Nl.getIdToken()||t,i=await fetch(s,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...n?{"un-alias":n}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=new Error(`Falha ao atualizar perfil: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}};try{await l()}catch(d){if(await Bl.handleApiError(d))return void await l();throw d}}const tu={1:"en-US",2:"pt-BR",3:"es-ES"};function ru(e,...a){for(const t of a){const a=e[t];if("string"==typeof a&&a.trim())return a}return null}async function nu(e){const a=Nl.getAccessToken(),t=Nl.getIdToken();if(!a||!t)throw new Error("Sessão inválida. Faça login novamente.");const r=Zc(e,t),n=eu(t),o=`${Kc()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,i=async()=>{const e=Nl.getAccessToken()||a,i=Nl.getIdToken()||t,s=await fetch(o,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":i,...n?{"un-alias":n}:{},AppGroupId:"1",Accept:"application/json, text/plain, */*"}});if(404===s.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!s.ok){const e=new Error(`Falha ao obter perfil: ${s.status} ${s.statusText}`);throw e.status=s.status,e.statusCode=s.status,e}const l=await s.json(),d=function(e,...a){for(const t of a){const a=e[t];if("number"==typeof a&&Number.isFinite(a))return a;if("string"==typeof a&&a.trim()&&!Number.isNaN(Number(a)))return Number(a)}return null}(l,"languageId","LanguageId"),c=1===d||2===d||3===d?d:null,u=ru(l,"photoUrl","PhotoUrl");let m=null;if(u)if(/^https?:\/\//i.test(u))m=u;else{const e=u.replace(/^\/+/,""),a=e.includes("?")?"&":"?";m=`${Kc()}/api/${e}${a}size=96`}return{newId:r,name:ru(l,"name","Name"),email:ru(l,"email","Email"),languageId:c,language:c?tu[c]:null,photoUrl:m}};try{return await i()}catch(s){if(await Bl.handleApiError(s))return await i();throw s}}const ou=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],iu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,su=({open:e,onOpenChange:r,user:n,userPhotoUrl:o,userInitials:s})=>{const{t:l,i18n:d}=La(),c=u(null),[p,h]=i(null),[f,g]=i(null),[v,b]=i(d.language||"pt-BR"),[x,y]=i(n.name||""),[w,N]=i(n.email||""),[_,C]=i(!1),[S,A]=i(null);m(()=>{if(!e)return;y(n.name||""),N(n.email||""),b(d.language||"pt-BR"),A(null);let a=!1;return(async()=>{try{const e=await nu(n.id||void 0);if(a)return;e.name&&y(e.name),e.email&&N(e.email),e.language&&b(e.language),A(e.photoUrl)}catch{}})(),()=>{a=!0}},[e,n.id,n.name,n.email,d.language]);const E=p||S||o,P=e=>{_||(e||(h(null),g(null),b(d.language||"pt-BR"),y(n.name||""),N(n.email||"")),r(e))};return a(Ai,{open:e,onOpenChange:P,children:t(Mi,{className:"sm:max-w-md",children:[a(Ri,{children:a(Fi,{children:l("edit_profile","Editar Perfil")})}),t(zi,{className:"space-y-6",children:[t("div",{className:"flex items-center gap-4",children:[t(Vc,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[E&&a(qc,{src:E,alt:n.name||""}),a(Wc,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:s})]}),t("div",{children:[t(ni,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),children:[a(pe,{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);h(t),g(a)}})]})]}),t("div",{className:"space-y-2",children:[a(li,{htmlFor:"profile-name",children:l("name","Nome")}),a(ii,{id:"profile-name",value:x,onChange:e=>y(e.target.value),maxLength:150,autoComplete:"name"})]}),t("div",{className:"space-y-2",children:[a(li,{htmlFor:"profile-email",children:l("email","E-mail")}),a(ii,{id:"profile-email",type:"email",value:w,onChange:e=>N(e.target.value),maxLength:200,autoComplete:"email"})]}),t("div",{className:"space-y-2",children:[a(li,{children:l("language","Idioma")}),t(Qi,{value:v,onValueChange:b,children:[a(Zi,{children:a(Xi,{})}),a(ts,{children:ou.map(e=>a(ns,{value:e.value,children:e.label},e.value))})]})]})]}),t(Li,{children:[a(ni,{variant:"outline",onClick:()=>P(!1),disabled:_,children:l("cancel","Cancelar")}),t(ni,{onClick:async()=>{if(x.trim())if(iu.test(w.trim())){C(!0);try{if(f)try{await Jc(f),window.dispatchEvent(new Event("user-photo-updated")),k.success("Foto atualizada com sucesso")}catch(e){const a=e instanceof Error?e.message:String(e);k.error("Falha ao atualizar foto"+(a?`: ${a}`:""))}if(x.trim()!==(n.name||"")||w.trim()!==(n.email||"")||v!==d.language)try{await au({newId:n.id||void 0,name:x.trim(),email:w.trim(),language:v}),k.success("Perfil atualizado com sucesso")}catch(e){const a=e instanceof Error?e.message:String(e);k.error(a||"Falha ao atualizar perfil")}v!==d.language&&d.changeLanguage(v),g(null),h(null),r(!1)}finally{C(!1)}}else k.error("Informe um e-mail válido.");else k.error("Informe o nome.")},disabled:_,children:[_&&a(M,{className:"mr-2 h-4 w-4 animate-spin"}),_?l("saving","Salvando..."):l("save","Salvar")]})]})]})})},lu=d(void 0);function du({children:e,actions:t}){const{t:r}=La(),[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(lu.Provider,{value:p,children:e})}function cu(){const e=c(lu);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}function uu(e){const{setMetadata:a,clearMetadata:t}=cu(),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 mu(e){return{queryClient:e.queryClient||new Va({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}var pu={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",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_like:"Curtir",updates_dialog_do_not_show_again:"Não exibir novamente",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..."},hu={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",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_like:"Like",updates_dialog_do_not_show_again:"Do not show again",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..."},fu={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",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_like:"Me gusta",updates_dialog_do_not_show_again:"No mostrar de nuevo",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 gu="true"===import.meta.env.VITE_I18N_DEBUG_MODE;function vu(a,t){e.addResourceBundle(a,"app",t,!0,!0)}gu&&e.use({type:"postProcessor",name:"debugKeys",process:(e,a)=>`🔑 ${Array.isArray(a)?a[0]:a}`}),e.use(Fa).init({resources:{"pt-BR":{core:pu},"en-US":{core:hu},"es-ES":{core:fu}},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:gu?["debugKeys"]:[]});const bu=d({moduleAlias:null,associationsBaseUrl:null});function xu({moduleAlias:e=null,associationsBaseUrl:t=null,children:r}){return a(bu.Provider,{value:{moduleAlias:e,associationsBaseUrl:t},children:r})}function yu(){return c(bu)}const wu={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},Nu=6e5;function _u(e){const{moduleAlias:a,associationsBaseUrl:t}=yu(),{alias:r,user:n,isAuthenticated:o}=od(),i=e??a,d=n?.id??null,c=o&&!!r&&!!d,{data:u=[],isLoading:m}=Ba({queryKey:["qualiex-associations",d,r,t??null],queryFn:()=>$l.fetchUserAssociations(d,r,t?{baseUrl:t}:void 0),enabled:c,staleTime:Nu,gcTime:12e5}),p=s(()=>r&&0!==u.length?u.find(e=>e.companyAlias===r)??null:null,[u,r]),h=l(e=>{if(!p)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const a=wu[e];return void 0!==a&&p.softwares.includes(a)})},[p]);return{hasAccess:s(()=>!i||h(i),[i,h]),isLoading:c&&m,role:s(()=>p?{id:p.roleId,name:p.roleName}:null,[p]),association:p,hasAccessTo:h}}const Cu={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES"};function ku(){const{association:a}=_u(),t=a?.language;return m(()=>{if(!t)return;const a=Cu[t];a&&e.language!==a&&e.changeLanguage(a)},[t]),null}const Su=d(void 0),Au={locale:_o,timezone:ko,datetimeFormat:Co},Eu=async()=>{},Pu=({children:e})=>a(Su.Provider,{value:{...Au,setLocale:Eu,setTimezone:Eu,setDatetimeFormat:Eu,isLoading:!1},children:e}),Du=()=>{const e=c(Su);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Tu=rt.Root,Iu=rt.CollapsibleTrigger,Mu=rt.CollapsibleContent;var Ru=Object.defineProperty,zu=(e,a,t)=>((e,a,t)=>a in e?Ru(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t)(e,a+"",t);class Lu extends h{constructor(a){super(a),zu(this,"copyErrorDetails",()=>{const a=kl.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),k.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;kl.handleError(e,!1),this.setState({errorInfo:a})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const r=kl.getErrors().slice(0,2);return a("div",{className:"flex items-center justify-center min-h-screen p-4",children:t(di,{className:"w-full max-w-2xl",children:[t(ci,{className:"text-center",children:[a("div",{className:"flex justify-center mb-4",children:a(ce,{className:"h-12 w-12 text-destructive"})}),a(ui,{children:e.t("something_went_wrong")})]}),t(pi,{className:"space-y-4",children:[a("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t(Tu,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[a(Iu,{asChild:!0,children:t(ni,{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(Mu,{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(cc,{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(ni,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[a(he,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),a(ni,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const Fu=nt.Root,Uu=n.forwardRef(({className:e,...t},r)=>a(nt.List,{ref:r,className:Zo("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Uu.displayName=nt.List.displayName;const Ou=n.forwardRef(({className:e,...t},r)=>a(nt.Trigger,{ref:r,className:Zo("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}));Ou.displayName=nt.Trigger.displayName;const ju=n.forwardRef(({className:e,...t},r)=>a(nt.Content,{ref:r,className:Zo("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 Bu({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 $u({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"})]})}ju.displayName=nt.Content.displayName;const Vu={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)}},qu="forlogic_";function Wu(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Hu(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Gu(e){return Hu()?`${qu}${e}`:e}function Ku(e){return Hu()?`${qu}${e}`:e}function Yu(e){try{e()}catch(a){import.meta.env.DEV}}function Qu(e){for(const[a,t]of Object.entries(e))null!=t&&""!==t&&Vu.setTag(Ku(a),t)}function Ju({module:e,isContracted:a,sourceModule:t,alias:r}){Wu()&&Yu(()=>{Qu({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(a),source_module:t,alias:r}),Vu.event(Gu("module_menu_click"))})}function Xu({module:e,sourceModule:a,alias:t}){Wu()&&Yu(()=>{Qu({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:a,alias:t}),Vu.event(Gu("module_interest_click"))})}function Zu({resource:e,sourceModule:a,alias:t}){Wu()&&Yu(()=>{Qu({footer_resource:e,source_module:a,alias:t}),Vu.event(Gu("module_footer_click"))})}function em({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:r="https://sabergestao.com.br/",wikiUrl:n,alias:o,sourceModule:i}){const{t:s}=La(),l=Wo(e||n||"https://educacao.sabergestao.com.br/{alias}/fe",o),d=e=>{Zu({resource:e,sourceModule:i,alias:o})};return t("div",{className:"flex-shrink-0 pt-4",children:[a(fi,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a(Bu,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a($u,{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(fe,{className:"h-3.5 w-3.5"})]})]}),a(ge,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const am=[{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}"}]},{id:"admin",label:"Admin",modules:[{name:"Admin",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function tm({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:Zo("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 rm(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 nm({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=e=>!0===e.alwaysContracted||!d||n.includes(e.name),u=l.filter(c),p=d?l.filter(e=>!c(e)):[],h=rm(u,s),f=rm(p,s),g=(e,a)=>{a?r?.(e):o?.(e)};return t("div",{className:"space-y-6",children:[h.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:h.map(e=>a(tm,{module:e,onClick:()=>g(e,!0)},e.name))})}),f.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:f.map(e=>a(tm,{module:e,onClick:()=>g(e,!1)},e.name))})]})]})}function om({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,showAdminGroup:m=!1}){const[p,h]=i("qualiex"),f=m?am.find(e=>"admin"===e.id)?.modules??[]:[],g=am.filter(e=>"admin"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...f]}:e),v=e=>{Xu({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(Fu,{value:p,onValueChange:h,className:"flex-1 flex flex-col min-h-0",children:[a(Uu,{className:"w-fit shrink-0",children:g.map(e=>t(Ou,{value:e.id,children:[e.label,t("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),g.map(t=>a(ju,{value:t.id,className:"flex-1 mt-4 overflow-auto pr-2",children:a(nm,{modules:t.modules,onModuleClick:a=>{return n=a,o=t.id,Ju({module:n,isContracted:!!n.alwaysContracted||"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:v})},t.id))]}),a(em,{educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:c,sourceModule:u})]})}function im(e){const{association:a}=_u();return s(()=>{if(e)return e;if(!a?.softwares)return;const t=a.softwares,r=am.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const a=wu[e.softwareAlias];return void 0!==a&&t.includes(a)}).map(e=>e.name):void 0},[e,a])}function sm({open:e,onOpenChange:r,onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,sourceModule:c,showAdminGroup:u}){const{alias:m,user:p}=od(),h=im(o),f=u??!!p?.isSysAdmin;return a(Ai,{open:e,onOpenChange:r,children:t(Mi,{size:"lg",className:"overflow-hidden flex flex-col",children:[a(Ri,{className:"sr-only",children:a(Fi,{children:"Módulos"})}),a(om,{onModuleClick:e=>{n?n(e):e.url&&qo(Wo(e.url,m||void 0))},contractedModules:h,onModuleInterest:i,educaUrl:s,saberGestaoUrl:l,wikiUrl:d,alias:m||void 0,sourceModule:c,showAdminGroup:f})]})})}function lm({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}=La(),_=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(Ai,{open:r,onOpenChange:b?void 0:n,children:t(Mi,{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(Fi,{children:N("no_access_page")}),a(Ui,{children:"Selecione um módulo para continuar navegando!"})]}),t("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t(hs,{children:[a(fs,{asChild:!0,children:t(ni,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[a(ve,{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(Ns,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t(_s,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[a(ve,{className:"mr-2 h-4 w-4 shrink-0"}),a("span",{className:"truncate",children:e.name}),e.alias===m&&a(ds,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t(hs,{children:[a(fs,{asChild:!0,children:t(ni,{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(be,{className:"h-3.5 w-3.5 text-primary-foreground"})}),a(D,{className:"h-3 w-3"})]})}),t(Ns,{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(As,{}),t(_s,{onClick:h,children:[a(xe,{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(em,{educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]}):a(om,{onModuleClick:o,contractedModules:i,onModuleInterest:l,educaUrl:f,saberGestaoUrl:g,wikiUrl:v,alias:m,sourceModule:w})]})})}function dm(e,a){const{t:t}=La();return a.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a)}function cm({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}=La(),{hasAccess:f,isLoading:g,association:v}=_u(),{user:b,alias:x,companies:y,isAuthenticated:w,isLoading:N,logout:_,switchUnit:C}=od(),k=im(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]),P=l(e=>{n?n(e):e.url&&qo(Wo(e.url,x||void 0))},[n,x]),D=s(()=>{if(!m)return;const e=window.location.pathname,a=Object.keys(m).find(a=>dm(e,[a]));return a?m[a]:void 0},[m]);return N||!w||u?.length&&dm(window.location.pathname,u)?a(r,{children:e}):g?a("div",{className:"flex items-center justify-center min-h-screen",children:a(us,{size:"lg"})}):f?a(r,{children:e}):a(lm,{open:!0,onModuleClick:P,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:D})}function um({title:e,description:r,image:n,icon:o,ctaLabel:i,onCtaClick:s,children:l}){const{t:d}=La(),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(ni,{onClick:s,size:"lg",className:"gap-2",children:[a(ye,{className:"h-4 w-4"}),c]}):null]})}let mm=!1;function pm(){if(mm||"undefined"==typeof document)return;mm=!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 hm({projectId:e,mode:a="auto"}){const{user:t,alias:r,isAuthenticated:n}=od();m(()=>{if("undefined"!=typeof window&&"disabled"!==a&&e&&!ur()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Vu.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";Vu.identify(e,void 0,"modules-menu",t.name||void 0),r&&Vu.setTag("alias",r),"boolean"==typeof t.isSysAdmin&&Vu.setTag("isSysAdmin",String(t.isSysAdmin))}catch(e){import.meta.env.DEV}},[t,r,n,a])}let fm="legacy";function gm(){return fm}function vm({children:r,queryClient:n,moduleAlias:i,associationsBaseUrl:s,moduleAccessGuardProps:l,appTranslations:d,clarityProjectId:c,clarityMode:u="auto",backend:m="supabase",securityMode:p="legacy"}){rr(m),fm=p,pm();const[h]=o.useState(()=>new Va({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=n??h;o.useEffect(()=>{if(d)for(const[e,a]of Object.entries(d))vu(e,a)},[d]);const g={sourceModule:i,...l};return t(Lu,{children:[a(xm,{}),a(Ua,{i18n:e,children:a(qa,{client:f,children:t(nd,{children:[a(bm,{projectId:c,mode:u}),a(Pu,{children:t(xu,{moduleAlias:i,associationsBaseUrl:s,children:[a(ku,{}),a(cm,{...g,children:r})]})})]})})})]})}function bm({projectId:e,mode:a}){return hm({projectId:e,mode:a}),null}function xm(){if(!or())return null;const e=Sl(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 ym=ot.Root,wm=n.forwardRef(({className:e,...t},r)=>a(ot.Item,{ref:r,className:Zo("border-b",e),...t}));wm.displayName="AccordionItem";const Nm=n.forwardRef(({className:e,children:r,...n},o)=>a(ot.Header,{className:"flex",children:t(ot.Trigger,{ref:o,className:Zo("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"})]})}));Nm.displayName=ot.Trigger.displayName;const _m=n.forwardRef(({className:e,children:t,...r},n)=>a(ot.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:Zo("pb-4 pt-0",e),children:t})}));_m.displayName=ot.Content.displayName;const Cm=n.forwardRef(({...e},t)=>a("nav",{ref:t,"aria-label":"breadcrumb",...e}));Cm.displayName="Breadcrumb";const km=n.forwardRef(({className:e,...t},r)=>a("ol",{ref:r,className:Zo("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));km.displayName="BreadcrumbList";const Sm=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Zo("inline-flex items-center gap-1.5",e),...t}));Sm.displayName="BreadcrumbItem";const Am=n.forwardRef(({asChild:e,className:t,...r},n)=>a(e?v:"a",{ref:n,className:Zo("transition-colors hover:text-foreground",t),...r}));Am.displayName="BreadcrumbLink";const Em=n.forwardRef(({className:e,...t},r)=>a("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Zo("font-normal text-foreground",e),...t}));Em.displayName="BreadcrumbPage";const Pm=({children:e,className:t,...r})=>a("li",{role:"presentation","aria-hidden":"true",className:Zo("[&>svg]:h-3.5 [&>svg]:w-3.5",t),...r,children:e??a(O,{})});Pm.displayName="BreadcrumbSeparator";const Dm=({className:e,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:Zo("flex h-9 w-9 items-center justify-center",e),...r,children:[a(we,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Mais"})]});Dm.displayName="BreadcrumbEllipsis";const Tm=b("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"}}),Im=n.forwardRef(({className:e,orientation:t,...r},n)=>a("div",{ref:n,className:Zo(Tm({orientation:t}),e),...r}));function Mm({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a(it,{showOutsideDays:r,className:Zo("p-3 pointer-events-auto",e),locale:xo,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:Zo(ri({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Zo(ri({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:Zo(ri({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?se:O,{className:"h-4 w-4"})},...n})}Im.displayName="ButtonGroup",Mm.displayName="Calendar";const Rm={Root:function({children:e,className:t}){return a("div",{className:Zo("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return a(di,{className:Zo("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:a(pi,{className:"p-4",children:e})})},Field:function({label:e,value:r,className:n}){return t("div",{className:Zo("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 zm({date:e,onDateChange:r,placeholder:n,disabled:o=!1,className:i,disabledDates:s}){const{t:l}=La(),d=n??l("select_date");return t(Rs,{children:[a(zs,{asChild:!0,children:t(ni,{variant:"outline",disabled:o,className:Zo("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",i),children:[a(Ne,{className:"mr-2 h-4 w-4"}),e?C(e,"d 'de' MMMM 'de' yyyy",{locale:xo}):a("span",{children:d})]})}),a(Ls,{className:"w-auto p-0",align:"start",children:a(Mm,{mode:"single",selected:e,onSelect:r,disabled:s,initialFocus:!0,className:"pointer-events-auto"})})]})}const Lm=({shouldScaleBackground:e=!0,...t})=>a(st.Root,{shouldScaleBackground:e,...t});Lm.displayName="Drawer";const Fm=st.Trigger,Um=st.Portal,Om=st.Close,jm=n.forwardRef(({className:e,...t},r)=>a(st.Overlay,{ref:r,className:Zo("fixed inset-0 z-50 bg-black/80",e),...t}));jm.displayName=st.Overlay.displayName;const Bm=n.forwardRef(({className:e,children:r,...n},o)=>t(Um,{children:[a(jm,{}),t(st.Content,{ref:o,className:Zo("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]})]}));Bm.displayName="DrawerContent";const $m=({className:e,...t})=>a("div",{className:Zo("grid gap-1.5 p-4 text-center sm:text-left",e),...t});$m.displayName="DrawerHeader";const Vm=({className:e,...t})=>a("div",{className:Zo("mt-auto flex flex-col gap-2 p-4",e),...t});Vm.displayName="DrawerFooter";const qm=n.forwardRef(({className:e,...t},r)=>a(st.Title,{ref:r,className:Zo("text-lg font-semibold leading-none tracking-tight",e),...t}));qm.displayName=st.Title.displayName;const Wm=n.forwardRef(({className:e,...t},r)=>a(st.Description,{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));Wm.displayName=st.Description.displayName;const Hm={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))]"},Gm={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Km({children:e,cols:t="auto-fit",gap:r="md",className:n}){return a("div",{className:Zo("grid",Hm[t],Gm[r],n),children:e})}const Ym=lt.Root,Qm=lt.Trigger,Jm=n.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>a(lt.Content,{ref:o,align:t,sideOffset:r,className:Zo("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}));Jm.displayName=lt.Content.displayName;const Xm=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-slot":"input-group",className:Zo("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}));Xm.displayName="InputGroup";const Zm=b("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"}}),ep=n.forwardRef(({className:e,align:t,...r},n)=>a("div",{ref:n,"data-slot":"input-group-addon",className:Zo(Zm({align:t}),e),...r}));ep.displayName="InputGroupAddon";const ap=b("",{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"}}),tp=n.forwardRef(({className:e,size:t,variant:r="ghost",...n},o)=>a(ni,{ref:o,"data-slot":"input-group-button",variant:r,className:Zo(ap({size:t}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...n}));tp.displayName="InputGroupButton";const rp=n.forwardRef(({className:e,...t},r)=>a(ii,{ref:r,"data-slot":"input-group-control",className:Zo("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));rp.displayName="InputGroupInput";const np=n.forwardRef(({className:e,...t},r)=>a(ss,{ref:r,"data-slot":"input-group-control",className:Zo("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...t}));np.displayName="InputGroupTextarea";const op=n.forwardRef(({className:e,...t},r)=>a("h1",{ref:r,className:Zo("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...t}));op.displayName="H1";const ip=n.forwardRef(({className:e,...t},r)=>a("h2",{ref:r,className:Zo("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...t}));ip.displayName="H2";const sp=n.forwardRef(({className:e,...t},r)=>a("h3",{ref:r,className:Zo("scroll-m-20 text-2xl font-semibold tracking-tight",e),...t}));sp.displayName="H3";const lp=n.forwardRef(({className:e,...t},r)=>a("h4",{ref:r,className:Zo("scroll-m-20 text-xl font-semibold tracking-tight",e),...t}));lp.displayName="H4";const dp=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Zo("leading-7 [&:not(:first-child)]:mt-6",e),...t}));dp.displayName="P";const cp=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Zo("text-xl text-muted-foreground",e),...t}));cp.displayName="Lead";const up=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,className:Zo("text-lg font-semibold",e),...t}));up.displayName="Large";const mp=n.forwardRef(({className:e,...t},r)=>a("small",{ref:r,className:Zo("text-sm font-medium leading-none",e),...t}));mp.displayName="Small";const pp=n.forwardRef(({className:e,...t},r)=>a("p",{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));pp.displayName="Muted";const hp=n.forwardRef(({className:e,...t},r)=>a("code",{ref:r,className:Zo("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...t}));hp.displayName="InlineCode";const fp=n.forwardRef(({className:e,...t},r)=>a("blockquote",{ref:r,className:Zo("mt-6 border-l-2 pl-6 italic",e),...t}));fp.displayName="Blockquote";const gp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Zo("my-6 ml-6 list-disc [&>li]:mt-2",e),...t}));gp.displayName="List";const vp=n.forwardRef(({className:e,children:r,...n},o)=>t(dt.Root,{ref:o,className:Zo("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...n,children:[r,a(Cp,{})]}));vp.displayName=dt.Root.displayName;const bp=n.forwardRef(({className:e,...t},r)=>a(dt.List,{ref:r,className:Zo("group flex flex-1 list-none items-center justify-center space-x-1",e),...t}));bp.displayName=dt.List.displayName;const xp=dt.Item,yp=b("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"),wp=n.forwardRef(({className:e,children:r,...n},o)=>t(dt.Trigger,{ref:o,className:Zo(yp(),"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"})]}));wp.displayName=dt.Trigger.displayName;const Np=n.forwardRef(({className:e,...t},r)=>a(dt.Content,{ref:r,className:Zo("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}));Np.displayName=dt.Content.displayName;const _p=dt.Link,Cp=n.forwardRef(({className:e,...t},r)=>a("div",{className:Zo("absolute left-0 top-full flex justify-center"),children:a(dt.Viewport,{className:Zo("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})}));Cp.displayName=dt.Viewport.displayName;const kp=n.forwardRef(({className:e,...t},r)=>a(dt.Indicator,{ref:r,className:Zo("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 Sp({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(Cm,{className:o,children:a(km,{children:i.map((e,n)=>{const o=s&&1===n;return t(Sm,{children:[!(0===n)&&a(Pm,{}),o&&t(r,{children:[a(Dm,{}),a(Pm,{})]}),e.isCurrentPage?a(Em,{children:e.label}):a(Am,{asChild:!0,children:a(Qa,{to:e.href||"/",children:e.label})})]},e.label)})})})}function Ap(){const e=Ka();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})()}kp.displayName=dt.Indicator.displayName;const Ep=({className:e,...t})=>a("nav",{role:"navigation","aria-label":"pagination",className:Zo("mx-auto flex w-full justify-center",e),...t});Ep.displayName="Pagination";const Pp=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,className:Zo("flex flex-row items-center gap-1",e),...t}));Pp.displayName="PaginationContent";const Dp=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,className:Zo("",e),...t}));Dp.displayName="PaginationItem";const Tp=({className:e,isActive:t,size:r="icon",...n})=>a("a",{"aria-current":t?"page":void 0,className:Zo(ri({variant:t?"outline":"ghost",size:r}),e),...n});Tp.displayName="PaginationLink";const Ip=({className:r,...n})=>t(Tp,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Zo("gap-1 pl-2.5",r),...n,children:[a(se,{className:"h-4 w-4"}),a("span",{children:"Previous"})]});Ip.displayName="PaginationPrevious";const Mp=({className:r,...n})=>t(Tp,{"aria-label":e.t("go_to_next_page"),size:"default",className:Zo("gap-1 pr-2.5",r),...n,children:[a("span",{children:"Next"}),a(O,{className:"h-4 w-4"})]});Mp.displayName="PaginationNext";const Rp=({className:e,...r})=>t("span",{"aria-hidden":!0,className:Zo("flex h-9 w-9 items-center justify-center",e),...r,children:[a(we,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"More pages"})]});Rp.displayName="PaginationEllipsis";const zp=n.forwardRef(({className:e,value:t,...r},n)=>a(ct.Root,{ref:n,className:Zo("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:a(ct.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));zp.displayName=ct.Root.displayName;const Lp=n.forwardRef(({className:e,...t},r)=>a(ut.Root,{className:Zo("grid gap-2",e),...t,ref:r}));Lp.displayName=ut.Root.displayName;const Fp=n.forwardRef(({className:e,...t},r)=>a(ut.Item,{ref:r,className:Zo("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(ut.Indicator,{className:"flex items-center justify-center",children:a(j,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Fp.displayName=ut.Item.displayName;const Up=({className:e,...t})=>a(mt.PanelGroup,{className:Zo("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Op=mt.Panel,jp=({withHandle:e,className:t,...r})=>a(mt.PanelResizeHandle,{className:Zo("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(te,{className:"h-2.5 w-2.5"})})}),Bp=ka.Root,$p=ka.Trigger,Vp=ka.Close,qp=ka.Portal,Wp=n.forwardRef(({className:e,...t},r)=>a(ka.Overlay,{className:Zo("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}));Wp.displayName=ka.Overlay.displayName;const Hp=b("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"}}),Gp=n.forwardRef(({side:e="right",className:r,children:n,...o},i)=>t(qp,{children:[a(Wp,{}),t(ka.Content,{ref:i,className:Zo(Hp({side:e}),r),...o,children:[n,t(ka.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(P,{className:"h-4 w-4"}),a("span",{className:"sr-only",children:"Close"})]})]})]}));Gp.displayName=ka.Content.displayName;const Kp=({className:e,showSeparator:r=!1,children:n,...o})=>t("div",{className:Zo("flex flex-col flex-shrink-0",e),...o,children:[a("div",{className:"flex flex-col text-left",children:n}),r&&a(fi,{className:"mt-2"})]});Kp.displayName="SheetHeader";const Yp=({className:e,...t})=>a("div",{className:Zo("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...t});Yp.displayName="SheetBody";const Qp=({className:e,children:r,...n})=>t("div",{className:"flex-shrink-0 pt-4",children:[a(fi,{className:"mb-4"}),a("div",{className:Zo("flex flex-row justify-end gap-2",e),...n,children:r})]});Qp.displayName="SheetFooter";const Jp=n.forwardRef(({className:e,...t},r)=>a(ka.Title,{ref:r,className:Zo("text-lg font-semibold text-foreground",e),...t}));Jp.displayName=ka.Title.displayName;const Xp=n.forwardRef(({className:e,...t},r)=>a(ka.Description,{ref:r,className:Zo("text-sm text-muted-foreground",e),...t}));Xp.displayName=ka.Description.displayName;const Zp="sidebar:state",eh=n.createContext(null);function ah(){const e=n.useContext(eh);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const th=n.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:o,style:i,children:s,...l},d)=>{const c=dd(),[u,m]=n.useState(!1),[p,h]=n.useState(()=>{if("undefined"!=typeof window){const a=localStorage.getItem(Zp);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(Zp,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(eh.Provider,{value:x,children:a(Ps,{delayDuration:0,children:a("div",{className:Zo("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})})})});th.displayName="SidebarProvider";const rh=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}=ah();return"none"===n?a("div",{className:Zo("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",o),ref:l,...s,children:i}):d?a(Bp,{open:u,onOpenChange:m,...s,children:t(Gp,{"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(Jp,{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:Zo("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:Zo("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})})]})});rh.displayName="Sidebar";const nh=n.forwardRef(({className:e,onClick:r,...n},o)=>{const{toggleSidebar:i}=ah();return t(ni,{ref:o,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Zo("h-7 w-7",e),onClick:e=>{r?.(e),i()},...n,children:[a(_e,{}),a("span",{className:"sr-only",children:"Toggle Sidebar"})]})});nh.displayName="SidebarTrigger";const oh=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=ah();return a("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Zo("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})});oh.displayName="SidebarRail";const ih=n.forwardRef(({className:e,...t},r)=>a("main",{ref:r,className:Zo("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}));ih.displayName="SidebarInset";const sh=n.forwardRef(({className:e,...t},r)=>a(ii,{ref:r,"data-sidebar":"input",className:Zo("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));sh.displayName="SidebarInput";const lh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"header",className:Zo("flex flex-col gap-2 p-2",e),...t}));lh.displayName="SidebarHeader";const dh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"footer",className:Zo("flex flex-col gap-2 p-2",e),...t}));dh.displayName="SidebarFooter";const ch=n.forwardRef(({className:e,...t},r)=>a(fi,{ref:r,"data-sidebar":"separator",className:Zo("mx-2 w-auto bg-sidebar-border",e),...t}));ch.displayName="SidebarSeparator";const uh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"content",className:Zo("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));uh.displayName="SidebarContent";const mh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group",className:Zo("relative flex w-full min-w-0 flex-col p-2",e),...t}));mh.displayName="SidebarGroup";const ph=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?v:"div",{ref:n,"data-sidebar":"group-label",className:Zo("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}));ph.displayName="SidebarGroupLabel";const hh=n.forwardRef(({className:e,asChild:t=!1,...r},n)=>a(t?v:"button",{ref:n,"data-sidebar":"group-action",className:Zo("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}));hh.displayName="SidebarGroupAction";const fh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"group-content",className:Zo("w-full text-sm",e),...t}));fh.displayName="SidebarGroupContent";const gh=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu",className:Zo("flex w-full min-w-0 flex-col gap-1",e),...t}));gh.displayName="SidebarMenu";const vh=n.forwardRef(({className:e,...t},r)=>a("li",{ref:r,"data-sidebar":"menu-item",className:Zo("group/menu-item relative",e),...t}));vh.displayName="SidebarMenuItem";const bh=b("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"}}),xh=n.forwardRef(({asChild:e=!1,isActive:r=!1,variant:n="default",size:o="default",tooltip:i,className:s,...l},d)=>{const c=e?v:"button",{isMobile:u,state:m}=ah(),p=a(c,{ref:d,"data-sidebar":"menu-button","data-size":o,"data-active":r,className:Zo(bh({variant:n,size:o}),s),...l});return i?("string"==typeof i&&(i={children:i}),t(Ds,{children:[a(Ts,{asChild:!0,children:p}),a(Is,{side:"right",align:"center",hidden:"collapsed"!==m||u,...i})]})):p});xh.displayName="SidebarMenuButton";const yh=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>a(t?v:"button",{ref:o,"data-sidebar":"menu-action",className:Zo("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}));yh.displayName="SidebarMenuAction";const wh=n.forwardRef(({className:e,...t},r)=>a("div",{ref:r,"data-sidebar":"menu-badge",className:Zo("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}));wh.displayName="SidebarMenuBadge";const Nh=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:Zo("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}})]})});Nh.displayName="SidebarMenuSkeleton";const _h=n.forwardRef(({className:e,...t},r)=>a("ul",{ref:r,"data-sidebar":"menu-sub",className:Zo("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}));_h.displayName="SidebarMenuSub";const Ch=n.forwardRef(({...e},t)=>a("li",{ref:t,...e}));Ch.displayName="SidebarMenuSubItem";const kh=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},i)=>a(e?v:"a",{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Zo("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}));kh.displayName="SidebarMenuSubButton";const Sh=n.forwardRef(({className:e,value:r,defaultValue:n,...o},i)=>{const s=r||n||[0];return t(pt.Root,{ref:i,value:r,defaultValue:n,className:Zo("relative flex w-full touch-none select-none items-center",e),...o,children:[a(pt.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a(pt.Range,{className:"absolute h-full bg-primary"})}),s.map((e,t)=>a(pt.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 Ah({children:e,className:t}){return a("div",{className:Zo("flex flex-col h-full",t),children:a(cc,{className:"flex-1",children:a("div",{className:"space-y-6 p-6",children:e})})})}function Eh({title:e,description:r,actions:n,className:o}){return t("div",{className:Zo("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(fi,{})]})}function Ph({children:e,className:t}){return a("div",{className:Zo("space-y-6",t),children:e})}Sh.displayName=pt.Root.displayName;const Dh=ht.Menu,Th=ht.Group,Ih=ht.Portal,Mh=ht.Sub,Rh=ht.RadioGroup,zh=n.forwardRef(({className:e,...t},r)=>a(ht.Root,{ref:r,className:Zo("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...t}));zh.displayName=ht.Root.displayName;const Lh=n.forwardRef(({className:e,...t},r)=>a(ht.Trigger,{ref:r,className:Zo("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}));Lh.displayName=ht.Trigger.displayName;const Fh=n.forwardRef(({className:e,inset:r,children:n,...o},i)=>t(ht.SubTrigger,{ref:i,className:Zo("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"})]}));Fh.displayName=ht.SubTrigger.displayName;const Uh=n.forwardRef(({className:e,...t},r)=>a(ht.SubContent,{ref:r,className:Zo("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}));Uh.displayName=ht.SubContent.displayName;const Oh=n.forwardRef(({className:e,align:t="start",alignOffset:r=-4,sideOffset:n=8,...o},i)=>a(ht.Portal,{children:a(ht.Content,{ref:i,align:t,alignOffset:r,sideOffset:n,className:Zo("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})}));Oh.displayName=ht.Content.displayName;const jh=n.forwardRef(({className:e,inset:t,...r},n)=>a(ht.Item,{ref:n,className:Zo("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}));jh.displayName=ht.Item.displayName;const Bh=n.forwardRef(({className:e,children:r,checked:n,...o},i)=>t(ht.CheckboxItem,{ref:i,className:Zo("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(ht.ItemIndicator,{children:a(I,{className:"h-4 w-4"})})}),r]}));Bh.displayName=ht.CheckboxItem.displayName;const $h=n.forwardRef(({className:e,children:r,...n},o)=>t(ht.RadioItem,{ref:o,className:Zo("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(ht.ItemIndicator,{children:a(j,{className:"h-2 w-2 fill-current"})})}),r]}));$h.displayName=ht.RadioItem.displayName;const Vh=n.forwardRef(({className:e,inset:t,...r},n)=>a(ht.Label,{ref:n,className:Zo("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Vh.displayName=ht.Label.displayName;const qh=n.forwardRef(({className:e,...t},r)=>a(ht.Separator,{ref:r,className:Zo("-mx-1 my-1 h-px bg-muted",e),...t}));qh.displayName=ht.Separator.displayName;const Wh=({className:e,...t})=>a("span",{className:Zo("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Wh.displayname="MenubarShortcut";const Hh={light:"",dark:".dark"},Gh=n.createContext(null);function Kh(){const e=n.useContext(Gh);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Yh=n.forwardRef(({id:e,className:r,children:o,config:i,...s},l)=>{const d=n.useId(),c=`chart-${e||d.replace(/:/g,"")}`;return a(Gh.Provider,{value:{config:i},children:t("div",{"data-chart":c,ref:l,className:Zo("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(Qh,{id:c,config:i}),a(ft.ResponsiveContainer,{children:o})]})})});Yh.displayName="Chart";const Qh=({id:e,config:t})=>{const r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?a("style",{dangerouslySetInnerHTML:{__html:Object.entries(Hh).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},Jh=ft.Tooltip,Xh=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}=Kh(),x=n.useMemo(()=>{if(l||!o?.length)return null;const[e]=o,t=af(b,e,`${g||e?.dataKey||e?.name||"value"}`),r=g||"string"!=typeof c?t?.label:b[c]?.label||c;return u?a("div",{className:Zo("font-medium",m),children:u(r,o)}):r?a("div",{className:Zo("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:Zo("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=af(b,e,o),l=h||e.payload?.fill||e.color;return a("div",{className:Zo("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:Zo("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:Zo("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)})})]})});Xh.displayName="ChartTooltip";const Zh=ft.Legend,ef=n.forwardRef(({className:e,hideIcon:r=!1,payload:n,verticalAlign:o="bottom",nameKey:i},s)=>{const{config:l}=Kh();return n?.length?a("div",{ref:s,className:Zo("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=af(l,e,n);return t("div",{className:Zo("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 af(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]}ef.displayName="ChartLegend";const tf=({onClick:e,isActive:t,disabled:r,children:n,title:o})=>a("button",{type:"button",onClick:e,disabled:r,title:o,className:Zo("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}),rf=()=>a("div",{className:"w-px h-5 bg-border mx-1"}),nf=({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}=La(),[f,g]=i("visual"),v=It({extensions:[Rt.configure({heading:{levels:[1,2,3]}}),zt,Lt.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Ft,Ut,Ot.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:Zo("space-y-2",p),children:[u&&t("div",{className:"flex justify-between items-center",children:[t("div",{className:"flex gap-1",children:[t(ni,{type:"button",size:"sm",variant:"visual"===f?"default":"outline",onClick:()=>g("visual"),disabled:s,children:[a(Ce,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t(ni,{type:"button",size:"sm",variant:"code"===f?"default":"outline",onClick:()=>g("code"),disabled:s,children:[a(ke,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t(ni,{type:"button",size:"sm",variant:"preview"===f?"default":"outline",onClick:()=>g("preview"),disabled:s,children:[a(Se,{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(tf,{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),isActive:v.isActive("heading",{level:1}),disabled:s,title:e.t("heading_1"),children:a(Ae,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),isActive:v.isActive("heading",{level:2}),disabled:s,title:e.t("heading_2"),children:a(Ee,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),isActive:v.isActive("heading",{level:3}),disabled:s,title:e.t("heading_3"),children:a(Pe,{className:"h-4 w-4"})}),a(rf,{}),a(tf,{onClick:()=>v.chain().focus().toggleBold().run(),isActive:v.isActive("bold"),disabled:s,title:e.t("bold"),children:a(De,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleItalic().run(),isActive:v.isActive("italic"),disabled:s,title:e.t("italic"),children:a(Te,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleUnderline().run(),isActive:v.isActive("underline"),disabled:s,title:"Sublinhado",children:a(Ie,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleStrike().run(),isActive:v.isActive("strike"),disabled:s,title:"Riscado",children:a(Me,{className:"h-4 w-4"})}),a(rf,{}),a(tf,{onClick:()=>v.chain().focus().toggleBulletList().run(),isActive:v.isActive("bulletList"),disabled:s,title:"Lista",children:a(Z,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().toggleOrderedList().run(),isActive:v.isActive("orderedList"),disabled:s,title:h("ordered_list"),children:a(Re,{className:"h-4 w-4"})}),a(rf,{}),a(tf,{onClick:()=>v.chain().focus().toggleHighlight().run(),isActive:v.isActive("highlight"),disabled:s,title:"Destacar",children:a(ze,{className:"h-4 w-4"})}),a(tf,{onClick:b,isActive:v.isActive("link"),disabled:s,title:"Link",children:a(Le,{className:"h-4 w-4"})}),a(rf,{}),a(tf,{onClick:()=>v.chain().focus().unsetAllMarks().clearNodes().run(),disabled:s,title:h("clear_formatting"),children:a(Fe,{className:"h-4 w-4"})}),a(rf,{}),a(tf,{onClick:()=>v.chain().focus().undo().run(),disabled:s||!v.can().undo(),title:"Desfazer",children:a(Ue,{className:"h-4 w-4"})}),a(tf,{onClick:()=>v.chain().focus().redo().run(),disabled:s||!v.can().redo(),title:"Refazer",children:a(Oe,{className:"h-4 w-4"})})]}),a(Mt,{editor:v,className:Zo("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 of({image:e,title:t,className:r}){return a("div",{className:Zo("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(je,{className:"w-16 h-16 text-muted-foreground"})})})}function sf({steps:e,currentStepIndex:r,onStepSelect:n,stepLabel:o,className:i}){const{t:s}=La(),l=e.length,d=(r+1)/l*100;return t("div",{className:Zo("flex items-center gap-3",i),children:[t(hs,{children:[a(fs,{asChild:!0,children:t(ni,{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(Ns,{align:"start",children:e.map((e,a)=>t(_s,{onClick:()=>n(a),className:Zo(a===r&&"bg-accent"),children:[a+1,". ",e.title]},e.id))})]}),a(zp,{value:d,className:"w-32 h-2"})]})}function lf({currentStepIndex:e,totalSteps:r,onBack:n,onNext:o,onComplete:i,backButtonText:s,continueButtonText:l,finishButtonText:d,className:c}){const{t:u}=La(),m=0===e,p=e===r-1;return t("div",{className:Zo("flex items-center gap-2",c),children:[!m&&t(ni,{variant:"outline",onClick:n,size:"sm",children:[a(Be,{className:"h-4 w-4 mr-2"}),s]}),t(ni,{onClick:p?i:o,size:"sm",children:[p?d:l,!p&&a($e,{className:"h-4 w-4 ml-2"})]})]})}const df=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(Ai,{open:r,onOpenChange:o,children:t(Mi,{ref:b,size:p,variant:"informative",className:Zo("p-0 gap-0 overflow-hidden",v),children:[t(Di,{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(P,{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(of,{image:C.image,title:C.title}),a(Fi,{className:"text-xl font-semibold",children:C.title}),a(Ui,{className:"text-muted-foreground",children:C.description})]})}),t("div",{className:"flex-shrink-0",children:[a(fi,{}),t("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[h&&k>1?a(sf,{steps:i,currentStepIndex:N,onStepSelect:e=>{_(e)},stepLabel:m}):a("div",{}),a(lf,{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 cf({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}=La(),p=l||d;if(!(o.length>0))return t(ni,{variant:i,size:s,disabled:p,onClick:r,className:u,children:[d?a(M,{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:Zo("inline-flex rounded-md shadow-sm",u),children:[t(ni,{variant:i,size:s,disabled:p,onClick:r,className:"rounded-r-none border-r-0 focus:z-10",children:[d?a(M,{className:"mr-2 h-4 w-4 animate-spin"}):n?a(n,{className:"mr-2 h-4 w-4"}):null,e]}),t(hs,{children:[a(fs,{asChild:!0,children:a(ni,{variant:i,size:s,disabled:p,className:Zo("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(Ns,{align:c,className:"min-w-[160px]",children:o.map(e=>{const r=e.icon;return t(_s,{onClick:e.onClick,disabled:e.disabled,className:Zo("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[r&&a(r,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}df.displayName="OnboardingDialog";var uf=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(uf||{});const mf=[{value:"csv",label:"CSV",icon:a(We,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:a(We,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:a(He,{className:"h-5 w-5"})}],pf=[{value:"png",label:"PNG",icon:a(Ve,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:a(qe,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:a(qe,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:a(We,{className:"h-5 w-5"})}];function hf({open:e,onOpenChange:r,onExport:n,mode:o="table",options:s,title:l,description:d,cancelLabel:c="Cancelar",exportLabel:u="Exportar"}){const{t:m}=La(),[p,h]=i(""),f=s??("chart"===o?pf:mf),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(Ai,{open:e,onOpenChange:b,children:t(Mi,{className:"sm:max-w-md",variant:"form",isDirty:!!p,children:[a(Ri,{children:a(Fi,{children:g})}),t("div",{className:"py-4",children:[a("p",{className:"text-sm text-muted-foreground mb-4",children:v}),a(Lp,{value:p,onValueChange:h,className:"gap-3",children:f.map(e=>t("div",{className:"flex items-center space-x-3",children:[a(Fp,{value:e.value,id:`export-${e.value}`}),t(li,{htmlFor:`export-${e.value}`,className:Zo("flex items-center gap-2 cursor-pointer font-normal",p===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t(Li,{children:[a(ni,{variant:"outline",onClick:()=>b(!1),children:c}),a(ni,{onClick:()=>{p&&(n(p),r(!1),h(""))},disabled:!p,children:u})]})]})})}const ff=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:Zo("grid gap-1.5",c),children:[i&&a(li,{htmlFor:h,children:i}),t("div",{className:"relative",children:[a(ii,{ref:p,id:h,type:"time",value:e??"",onChange:f,onKeyDown:g,min:"00:00",max:"23:59",step:60,className:Zo("pr-9",s&&"border-destructive focus-visible:ring-destructive"),...m}),a(Ge,{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 gf({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),P=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]),D=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?Ke:Ye,M=b?"Senha":e.t("verification_code"),R=b?e.t("enter_password"):e.t("enter_code");return a(Ai,{open:r,onOpenChange:T,children:t(Mi,{className:"sm:max-w-md",variant:"form",isDirty:!!w,children:[a(Ri,{children:t(Fi,{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(Qe,{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(li,{htmlFor:"signature-input",children:M}),a(ii,{id:"signature-input",type:b?"password":"text",value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&w.trim()&&(e.preventDefault(),P())},maxLength:b?void 0:u,placeholder:R,autoFocus:!0,className:Zo(A&&"border-destructive focus-visible:ring-destructive")}),A&&a("p",{className:"text-sm text-destructive",children:A})]}),!b&&t(ni,{variant:"ghost",size:"sm",onClick:D,disabled:k,className:"text-primary",children:[a(me,{className:Zo("h-4 w-4 mr-1",k&&"animate-spin")}),g]})]}),t(Li,{children:[a(ni,{variant:"outline",onClick:()=>T(!1),disabled:_,children:f}),a(ni,{onClick:P,disabled:!w.trim()||_,children:_?"Validando...":h})]})]})})}function vf({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:Zo("flex items-center gap-3",l),children:[t(hs,{children:[a(fs,{asChild:!0,children:t(ni,{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(Ns,{align:"start",children:c.map(r=>t(_s,{onClick:()=>{var a;(a=r)<e?o(a):s&&!s(a)||o(a)},disabled:u(r),className:Zo("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(I,{className:"h-4 w-4 ml-auto"})]},r))})]}),a(zp,{value:e/r*100,className:Zo("h-2",d)})]})}function bf({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}=La(),E=s.length,P=o>=E,D=o<=1;return a(Ai,{open:r,onOpenChange:n,children:t(Mi,{size:b,variant:g,isDirty:v,unsavedChangesTitle:x,unsavedChangesDescription:y,cancelText:w,leaveWithoutSavingText:N,className:Zo("!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:Zo("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:Zo("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:Zo("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(Fi,{children:c}),u&&a("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),a(zi,{className:"px-6",children:d}),!k&&a(Li,{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:[!D&&a(ni,{variant:"outline",onClick:()=>i(o-1),children:f}),a(ni,P?{onClick:m,disabled:C,children:p}:{onClick:()=>i(o+1),disabled:C,children:h})]})]})})]})]})})}function xf(e){const a=Nl.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 yf(e,a,t){let r=await fetch(e,a);if(401===r.status){if(await Bl.handleApiError({status:401})){const n={...a,headers:xf(t)};r=await fetch(e,n)}}return r}function wf(e){const[a,t]=i([]),[r,n]=i(0),[o,s]=i(!1);m(()=>{if(!e)return;let a=!1;const r=`${pr().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){s(!0);try{const o=xf(e),i=await yf(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=`${pr().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const a=xf(e),r=JSON.stringify({id:t,idUpdateType:3});await yf(o,{method:"POST",headers:a,body:r},e)}catch(i){}},[e,r,a]);return{updates:a,badgeCount:r,loading:o,markAsVisualized:d}}ff.displayName="Timepicker";const Nf=o.forwardRef(({updates:r,badgeCount:n,onOpen:o,onViewAll:i},s)=>{const l=void 0===r,d=od(),c=d?.alias??null,u=wf(l?c:null),m=Ga(),p=l?u.updates??[]:r,h=l?u.badgeCount??0:n??0,f=o??(l?u.markAsVisualized:void 0),g=i??(l&&c?()=>{m(`/${c}/up/view`)}:void 0);return t(Rs,{children:[a(zs,{asChild:!0,children:t(ni,{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:f,title:e.t("updates"),children:[a(Je,{className:"h-7 w-7"}),h>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:h>99?"99+":h})]})}),t(Ls,{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:p.length>0?a("ul",{className:"divide-y divide-border",children:p.map(e=>t("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:g,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(Je,{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(ni,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:g,children:["Ver todas as atualizações",a($e,{className:"h-[18px] w-[18px]"})]})})]})]})});Nf.displayName="UpdatesNotification";var _f=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(_f||{}),Cf=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(Cf||{});const kf={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function Sf(e){const{t:a}=La();return e?kf[e.toLowerCase()]??0:0}function Af(e){const{t:a}=La();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"}const Ef={".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 Pf(e){const{t:a}=La();return Ef[e?.toLowerCase()]||""}function Df(e){const{t:a}=La(),{viewerUrl:t,wopiUrl:r,fileId:n,token:o,extension:i,language:s="pt-br"}=e,l=Pf(i);if(!l)return null;return`${t}${l}ui=${s}&rs=${s}&access_token=${o}&WOPISrc=${encodeURIComponent(`${r}${n}`)}`}function Tf({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}=La(),S=u(null),A=i??Sf(o.extension),E=p||w||v,D=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(Ai,{open:e,onOpenChange:n,children:t(Mi,{className:Zo("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===A||6===A)&&"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:D}),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(Xe,{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:If(N)}),a("span",{children:"segundos"})]}):t(ni,{variant:"default",size:"sm",disabled:E,onClick:()=>y?.(),className:"mr-2.5",children:[a(Ye,{className:"h-4 w-4 mr-1"}),w?"Confirmando...":k("terms_confirm_reading")]})}),0!==A&&h&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>g?.(f),children:a(Ze,{className:Zo("h-4 w-4",f&&"fill-accent text-accent")})})}),a(Is,{children:f?"Desfavoritar":"Favoritar"})]}),0!==A&&d&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>c?.(),children:a(ea,{className:"h-4 w-4"})})}),a(Is,{children:"Download"})]})]}),t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:E,onClick:()=>n(!1),children:a(P,{className:"h-4 w-4"})})}),a(Is,{children:"Fechar"})]})]})]}),a("div",{className:Zo("flex flex-col items-center justify-center min-h-[160px] w-full",s&&"relative -top-5",0===A&&"min-h-[124px]",1===A&&"max-h-[85vh]",(4===A||6===A)&&"min-w-[77vw] min-h-[80vh]"),children:s?a(us,{className:"h-14 w-14"}):t(r,{children:[(0===A||!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?"})]}),1===A&&a("img",{loading:"eager",src:o.url,alt:o.name,className:"max-w-full max-h-[85vh] object-contain"}),2===A&&a("video",{controls:!0,autoPlay:!0,src:o.url,className:"w-full h-full"}),3===A&&a("audio",{controls:!0,autoPlay:!0,src:o.url}),(4===A||6===A)&&t("div",{className:"relative w-full h-[79.5vh]",children:[a(us,{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&&0===A&&t("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[a(ni,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),d&&a(ni,{variant:"default",onClick:()=>c?.(),children:"Download"})]})]})})}function If(e){const{t:a}=La(),t=e%60;return`${Math.floor(e/60)}min ${t<10?"0":""}${t}`}function Mf({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(Ai,{open:e,onOpenChange:r,children:t(Mi,{className:Zo("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(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:g,children:a(P,{className:"h-4 w-4"})})}),a(Is,{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(us,{className:"h-14 w-14"}):t("div",{className:"relative w-full h-[79.5vh]",children:[a(us,{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 Rf({open:e,onOpenChange:r,url:n,title:o,className:i,minHeight:s="250px"}){const{t:d}=La(),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(Ai,{open:e,onOpenChange:r,children:t(Mi,{className:Zo("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(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,children:a(P,{className:"h-4 w-4"})})}),a(Is,{children:"Fechar"})]})]}),a("iframe",{src:n,className:"border-none w-full",style:{minHeight:s},title:o||d("embedded_content")})]})})}function zf({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(Ai,{open:o&&!h,onOpenChange:e=>!e&&s(),children:t(Mi,{className:"sm:max-w-md",children:[a(Ri,{children:t(Fi,{className:"flex items-center gap-2",children:[a(Ye,{className:"h-5 w-5 text-primary"}),c]})}),t("div",{className:"space-y-4",children:[n.description&&a(cc,{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(ni,{variant:"link",className:"px-0 text-primary",onClick:()=>f(!0),children:[a(fe,{className:"mr-1 h-4 w-4"}),p]})]}),t(Li,{className:"gap-2 sm:gap-0",children:[a(ni,{variant:"ghost",onClick:s,children:u}),a(ni,{onClick:g,children:m})]})]})}),h&&a(Lf,{term:n,open:h,onClose:()=>f(!1),viewOnly:!0})]})}function Lf({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}=La(),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(Ai,{open:n,onOpenChange:e=>!e&&p(),children:t(Mi,{className:Zo("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(We,{className:"h-5 w-5 text-primary"}),c]}),t("div",{className:"flex items-center gap-2",children:[f&&a(ni,{size:"sm",onClick:h,children:u}),a(ni,{variant:"ghost",size:"icon",onClick:p,children:a(P,{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 Ff(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Uf({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=Ff(_);e=e.filter(e=>Ff(e.name).includes(a)||Ff(e.email??"").includes(a))}return e},[r,k,_]),P=s(()=>w?E:r.filter(e=>A.has(e.id)),[w,E,r,A]),D=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:Zo("rounded-md border bg-muted/30",y),children:[(!c||D>0)&&t("div",{className:Zo("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:D>0&&`${D} ${1===D?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(Qi,{value:k??"__all__",onValueChange:e=>S("__all__"===e?void 0:e),children:[a(Zi,{className:"w-[200px] h-9 text-sm",children:a(Xi,{placeholder:e.t("approval_user_group")})}),t(ts,{children:[a(ns,{value:"__all__",children:e.t("team_all_groups")}),n.map(e=>a(ns,{value:e.id,children:e.name},e.id))]})]}),t("div",{className:"relative flex-1",children:[a($,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(ii,{className:"pl-8 h-9 text-sm",placeholder:p,value:_,onChange:e=>C(e.target.value)})]})]}),!w&&0===D&&t("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[a(aa,{className:"h-4 w-4 mr-2"}),v]}),w&&E.length>0&&t("div",{className:"flex items-center gap-2 mb-2",children:[a(is,{checked:T,onCheckedChange:e=>M(!!e)}),a("span",{className:"text-sm",children:g})]}),P.length>0&&a(cc,{style:{maxHeight:u},className:"pr-2",children:a("div",{className:"space-y-0.5",children:P.map(e=>{return t("div",{className:Zo("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(is,{checked:A.has(e.id),onCheckedChange:()=>I(e.id),onClick:e=>e.stopPropagation()}),t(Vc,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(qc,{src:e.avatar,alt:e.name}),a(Wc,{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 Of(e){const{t:a}=La();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function jf(e){const{t:a}=La(),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 Bf({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,E]=i([]),[T,M]=i(!1),R=s(()=>jf(o[_]),[o,_]),z=s(()=>function(e){const{t:a}=La(),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=Of(k);return r.filter(a=>!R.has(a.id)&&!(e&&!Of(a.name).includes(e)))},[r,R,k]),U=s(()=>{const e={};for(const a of n)e[a.id]=jf(o[a.id]).size;return e},[n,o]),O=l(e=>{C(e),E([]),S("")},[]),j=l(e=>{E(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},[]),B=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}),E([]),S(""),M(!1)},[A,o,_,r,d]),V=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:Zo("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:Zo("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(Qi,{value:_,onValueChange:O,children:[a(Zi,{className:"h-9 text-sm",children:a(Xi,{})}),a(ts,{children:n.map(e=>a(ns,{value:e.id,children:t("span",{className:"flex items-center gap-2",children:[e.icon,e.name,U[e.id]>0&&a(ds,{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(Rs,{open:T,onOpenChange:M,children:[a(zs,{asChild:!0,children:t(ni,{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(Ls,{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($,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(ii,{className:"pl-8 h-8 text-sm",placeholder:g,value:k,onChange:e=>S(e.target.value)})]})}),a(cc,{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:Zo("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:Zo("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(ni,{size:"sm",className:"h-9 gap-1",disabled:0===A.length,onClick:B,children:[a(J,{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:Zo("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(ds,{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(P,{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 $f=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))($f||{});const Vf={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 qf(e){const{t:a}=La();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Wf(e){const{t:a}=La();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Hf({requests:e,isLoading:n=!1,onGetReportUrl:o,formatDate:d=Wf,labels:c,className:u}){const{t:m}=La(),p={...Vf,...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=qf(h);return e.filter(e=>qf(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:Zo("space-y-3",u),children:Array.from({length:5}).map((e,t)=>a(Hs,{className:"h-12 w-full"},t))}):t(r,{children:[t("div",{className:Zo("space-y-3",u),children:[t("div",{className:"relative max-w-sm",children:[a($,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(ii,{className:"pl-8 h-9 text-sm",placeholder:p.searchPlaceholder,value:h,onChange:e=>f(e.target.value)})]}),a(cc,{className:"rounded-md border",children:t(cd,{children:[a(ud,{children:t(hd,{children:[a(fd,{className:"min-w-[140px]",children:p.report}),a(fd,{className:"min-w-[150px]",children:p.status}),a(fd,{className:"min-w-[160px]",children:p.requestDate}),a(fd,{className:"min-w-[160px]",children:p.lastUpdate}),a(fd,{className:"min-w-[160px]",children:p.expirationDate}),a(fd,{className:"min-w-[140px]"})]})}),a(md,{children:0===C.length?a(hd,{children:a(gd,{colSpan:6,className:"text-center text-muted-foreground py-8",children:p.noResults})}):C.map(e=>{const r=function(e){const{t:a}=La();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),n=function(e,t){const{t:r}=La();switch(e){case 1:return{label:t.statusWaiting,icon:a(na,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:t.statusProcessing,icon:a(me,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:t.statusCompleted,icon:a(ra,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:t.statusError,icon:a(B,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:t.statusExpired,icon:a(ta,{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=3===r,i=5===r;return t(hd,{children:[a(gd,{className:"font-medium",children:e.reportName}),a(gd,{children:t(ds,{variant:n.variant,className:Zo("gap-1",n.className),children:[n.icon,n.label]})}),a(gd,{className:"text-sm",children:d(new Date(e.requestDate))}),a(gd,{className:"text-sm",children:d(new Date(e.lastUpdate))}),a(gd,{className:Zo("text-sm",i&&"text-destructive"),children:d(new Date(e.expirationDate))}),a(gd,{children:t(ni,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!o||N===e.id,onClick:()=>k(e),children:[N===e.id?a(M,{className:"h-4 w-4 animate-spin"}):a(Se,{className:"h-4 w-4"}),p.viewReport]})})]},e.id)})})]})})]}),a(Rf,{open:g,onOpenChange:v,url:b,title:y})]})}function Gf({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(Rf,{...n,url:o,minHeight:r})}const Kf={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 Yf({label:e,color:r,icon:n,showIcon:o,size:i="md",variant:s="filled",backgroundColor:l,className:d}){const c=Kf[i],u=o??!!n;return t("span",{className:Zo("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:Bo(r,.3),backgroundColor:"transparent"};case"ghost":return{color:r,backgroundColor:"transparent"};default:return{color:r,backgroundColor:l||Bo(r,.1)}}})(),children:[u&&n&&a(n,{size:c.icon,strokeWidth:2}),e]})}function Qf(e){return a=>e[a]}var Jf=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Jf||{}),Xf=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(Xf||{}),Zf=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Zf||{}),eg=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(eg||{}),ag=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(ag||{}),tg=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(tg||{}),rg=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(rg||{}),ng=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(ng||{}),og=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(og||{}),ig=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(ig||{}),sg=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(sg||{}),lg=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(lg||{}),dg=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(dg||{}),cg=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(cg||{}),ug=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(ug||{}),mg=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))(mg||{}),pg=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(pg||{}),hg=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))(hg||{}),fg=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(fg||{}),gg=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))(gg||{}),vg=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(vg||{}),bg=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(bg||{}),xg=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(xg||{}),yg=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(yg||{}),wg=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(wg||{}),Ng=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(Ng||{});const _g={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},Cg={advancedFilter:"analysisDashboardsListFilter"},kg=["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"],Sg=["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 Eg(e.items[0]?.keyDate)-Eg(a.items[0]?.keyDate)})}function Eg(e){if(!e)return 0;const[a,t]=e.split("/"),r=_g[a?.toLowerCase()]??0;return 12*(parseInt(t)||0)+r}function Pg(e){return null==e?.value||""===e.value.trim()}function Dg(e){const a=e.split("/"),t=a[a.length-1];return`${a.slice(0,-1).join("/")}/${encodeURIComponent(t.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function Tg(e){for(const a of Sg)if(e[a])return e[a];return null}function Ig(e){return e?Mg(e).join("&"):null}function Mg(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(...Mg({[t]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||a.push(`${t}=${r}`))}return a}const Rg=/^-?\d+(,\d{3})*(\.\d+)?$/;function zg(e){return!!Rg.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))}function Lg(e){const a=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(a)}const Fg=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});function Ug(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 Og=new Set([ig.Text]),jg=new Set([ig.Text,ig.Numeric,ig.RiskMatrix,ig.Burndown,ig.PerformanceColumns]),Bg=new Set([ig.Text,ig.RiskMatrix,ig.Burndown,ig.PerformanceColumns]);function $g({config:e,viewOnly:n=!1,complement:o,complementPosition:d="before-options",queryUrlBuilder:c,onRefresh:u,onExport:m,onToggleOnlyMine:p,className:h}){const{t:f}=La(),[g,v]=i(e.onlyMine??!1),b=Og.has(e.typeId),x=!jg.has(e.typeId),y=!Bg.has(e.typeId),w=s(()=>{if(!e.jsonRules||e.typeId===ig.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:Zo("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(Ds,{children:[a(Ts,{asChild:!0,children:a("span",{className:"block truncate",children:e.title})}),a(Is,{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(hs,{children:[a(fs,{asChild:!0,children:a(ni,{variant:"ghost",size:"icon",className:"h-6 w-6",children:a(oa,{className:"h-3.5 w-3.5"})})}),t(Ns,{align:"end",className:"w-48",children:[e.canUpdate&&t(_s,{onClick:()=>e.onEdit?.(e.id),children:[a(K,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!b&&t(_s,{onClick:u,children:[a(me,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),x&&t(_s,{disabled:e.noData,onClick:m,children:[a(ea,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!b&&t(_s,{disabled:!e.openQueryEnabled,onClick:()=>window.open(N,"_blank"),children:[a(fe,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),y&&t(r,{children:[a(As,{}),t(_s,{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(As,{}),t(_s,{onClick:()=>e.onDuplicate?.(e.id),children:[a(he,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t(_s,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[a(G,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===d&&o]})]})}function Vg({config:e,queryUrl:r,className:n}){return t("div",{className:Zo("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",n),children:[a(ce,{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 qg({panelType:e,className:r}){const n=e===ig.Burndown;return t("div",{className:Zo("flex flex-1 flex-col items-center justify-center gap-2 p-4",r),children:[a(us,{className:"h-10 w-10 text-muted-foreground/40"}),n&&a("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function Wg({hasRemovedColumn:r=!1,className:n}){return t("div",{className:Zo("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 Hg({onRemove:e,className:r}){return t("div",{className:Zo("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[a(ce,{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 Gg={[Jf.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Jf.Sum]:"Sum",[Jf.Average]:e.t("dashboard_average"),[Jf.DistinctCount]:e.t("dashboard_distinct_count"),[Jf.Max]:e.t("dashboard_max_value"),[Jf.Min]:e.t("dashboard_min_value")};function Kg({config:e,state:r,value:n,label:o,viewOnly:i=!1,onClick:s,onRefresh:l,queryUrl:d,queryUrlBuilder:c,className:u}){const{t:m}=La(),p=o??Gg[e.aggregationType??""]??"",h=function(e,a){if(null==e)return"—";const t=kg.includes(a.field),r=a.aggregationType===Jf.Count||a.aggregationType===Jf.DistinctCount;return t&&!r?Fg.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:Zo("flex h-full flex-col",u),children:[a($g,{config:e,viewOnly:i,onRefresh:l,queryUrlBuilder:c}),r===fg.Loading&&a(qg,{}),r===fg.Loaded&&t("div",{className:Zo("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===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:d}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Yg({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:Zo("flex h-full flex-col",d),children:[a($g,{config:e,viewOnly:o,onRefresh:i,queryUrlBuilder:l}),r===fg.Loading&&a(qg,{}),r===fg.Loaded&&a("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),r===fg.Error&&a(Vg,{config:e,queryUrl:s})]})}function Qg({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=Tg(e);a&&window.open(Dg(a),"_blank")}},[d,h]);return t("div",{className:Zo("flex h-full flex-col",f),children:[a($g,{config:e,viewOnly:i,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===fg.Loading&&a(qg,{}),r===fg.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&&!!Tg(e);return a("tr",{className:Zo("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):Jg(e[t.columnName],t)},t.columnName))},t)})})]})}),r===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:m}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function Jg(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 Xg=["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 Zg({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:Xg,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:Zo("flex h-full flex-col",v),children:[a($g,{config:e,viewOnly:u,onRefresh:p,onExport:h,queryUrlBuilder:g}),n===fg.Loading&&a(qg,{}),n===fg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:ev({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===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),n===fg.Error&&a(Vg,{config:e,queryUrl:f}),n===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function ev({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(kt,{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(St,{dataKey:s?i:void 0,type:s?"category":"number",...m,width:s?100:60,tickFormatter:s?void 0:d}),f=a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),g=a(At,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),v=n.length>1?a(vt,{wrapperStyle:{fontSize:"11px"}}):null,b=u?(e,a)=>u(r[a],a):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t(bt,{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(xt,{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(yt,{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(wt,{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(Nt,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[f,p,h,g,v,n.map((e,t)=>a(_t,{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 av=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function tv({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:av,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:Zo("flex h-full flex-col",p),children:[a($g,{config:e,viewOnly:i,onRefresh:d,onExport:c,queryUrlBuilder:m}),r===fg.Loading&&a(qg,{}),r===fg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(Et,{children:[a(Pt,{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(Dt,{fill:h[t%h.length]},t))}),a(At,{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(vt,{wrapperStyle:{fontSize:"11px"}})]})})}),r===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:u}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function rv({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:Zo("flex h-full flex-col",h),children:[a($g,{config:e,viewOnly:l,onRefresh:c,onExport:u,queryUrlBuilder:p}),r===fg.Loading&&a(qg,{}),r===fg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(Tt,{data:v,margin:{top:5,right:30,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),a(St,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a(St,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),a(At,{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(vt,{wrapperStyle:{fontSize:"11px"}}),a(xt,{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(_t,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:i,strokeWidth:2,dot:{r:3,fill:i}})]})})}),r===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:m}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function nv({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}=La(),f=o??h("dashboard_work_done"),g=i??h("dashboard_work_planned");return t("div",{className:Zo("flex h-full flex-col",p),children:[a($g,{config:e,viewOnly:d,onRefresh:c,queryUrlBuilder:m}),r===fg.Loading&&a(qg,{panelType:ig.Burndown}),r===fg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(yt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),a(St,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),a(At,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(vt,{wrapperStyle:{fontSize:"11px"}}),a(wt,{type:"monotone",dataKey:"executedPercentage",name:f,stroke:s,fill:s,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),a(wt,{type:"monotone",dataKey:"plannedPercentage",name:g,stroke:l,fill:l,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),r===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:u}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function ov({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}=La(),g=o??f("dashboard_work_done"),v=i??f("dashboard_work_planned");return t("div",{className:Zo("flex h-full flex-col",h),children:[a($g,{config:e,viewOnly:d,onRefresh:u,queryUrlBuilder:p}),r===fg.Loading&&a(qg,{}),r===fg.Loaded&&a("div",{className:"flex-1 min-h-0 p-2",children:a(gt,{width:"100%",height:"100%",children:t(bt,{data:n,margin:{top:5,right:10,left:0,bottom:5},children:[a(Ct,{strokeDasharray:"3 3",className:"stroke-border/50"}),a(kt,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),a(St,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),a(At,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),a(vt,{wrapperStyle:{fontSize:"11px"}}),a(xt,{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(xt,{dataKey:"plannedWork",name:v,fill:l,radius:[2,2,0,0]})]})})}),r===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:m}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}function iv({config:e,state:r,rule:n,risks:o=[],matrixViewType:i=mg.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:Zo("flex h-full flex-col",h),children:[a($g,{config:e,viewOnly:l,onRefresh:u,queryUrlBuilder:p}),r===fg.Loading&&a(qg,{}),r===fg.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:Zo("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===mg.Quantity&&l.length>0&&t("span",{className:"text-xs font-semibold",children:[l.length," risco",1!==l.length?"s":""]}),i===mg.AllRisksList&&l.map(e=>t(Ds,{children:[a(Ts,{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(Is,{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===fg.NoData&&a(Wg,{hasRemovedColumn:e.hasRemovedColumn}),r===fg.Error&&a(Vg,{config:e,queryUrl:m}),r===fg.Unavailable&&a(Hg,{onRemove:()=>e.onRemove?.(e.id)})]})}const sv=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[sv.Translate.toString(e),sv.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:t,easing:r}=e;return a+" "+t+"ms "+r}}});function lv(e){switch(e){case ig.Bar:case ig.Column:case ig.Pie:case ig.List:case ig.Line:case ig.Area:case ig.Text:case ig.StackedColumn:return{x:4,y:2};case ig.Pareto:case ig.RiskMatrix:case ig.Burndown:case ig.PerformanceColumns:return{x:8,y:2};case ig.Numeric:return{x:1,y:1};default:return{x:2,y:2}}}function dv(e){switch(Number(e)){case ig.Area:case ig.Bar:case ig.Column:case ig.Line:case ig.Numeric:case ig.Pie:case ig.Text:return{x:1,y:1};default:return{x:2,y:2}}}function cv({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}=Gt({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:sv.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:Zo("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:Zo("dashboard-panel-drag-handle",i&&"cursor-grab active:cursor-grabbing"),...i?c:{}}),a("div",{className:"h-full",children:l})]})}function uv({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=jt(Bt($t,{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:Zo("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(Vt,{sensors:g,collisionDetection:qt,onDragEnd:x,children:a(Wt,{items:b,strategy:Ht,children:a("div",{style:y,className:Zo("relative w-full",c&&"bg-muted/30",p),children:h.map(e=>a(cv,{panel:e,columns:r,cellHeight:n,cellGap:o,allowDragging:d,children:u(e.id)},e.id))})})})}const mv={[ig.Bar]:"bar",[ig.Column]:"column",[ig.StackedColumn]:"stacked-column",[ig.Area]:"area",[ig.Line]:"line",[ig.EvolutionLine]:"evolution-line"};function pv({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=mv[e.typeId];if(h)return a(Zg,{config:e,variant:h,state:r,data:s,series:l});switch(e.typeId){case ig.Numeric:return a(Kg,{config:e,state:r,value:o});case ig.Text:return a(Yg,{config:e,state:r});case ig.List:return a(Qg,{config:e,state:r,data:n,columns:i??[]});case ig.Pie:return a(tv,{config:e,state:r,data:n});case ig.Pareto:return a(rv,{config:e,state:r,data:n});case ig.Burndown:return a(nv,{config:e,state:r,data:d});case ig.PerformanceColumns:return a(ov,{config:e,state:r,data:c});case ig.RiskMatrix:return a(iv,{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 hv({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}=La(),[A,E]=i(!1),P=e.idViewType===lg.Carousel,D=s(()=>r,[r,P,o]),T=s(()=>D.map(e=>{const a=dv(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:a.x,minSizeY:a.y}}),[D]),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=D.find(a=>a.id===e);if(!r)return null;const n=I(r),o=m?.(e)??{state:fg.Loaded};return t("div",{className:"flex flex-col h-full",children:[a($g,{config:n,onRefresh:()=>{}}),a("div",{className:"flex-1 min-h-0 p-2",children:a(pv,{config:n,...o})})]})},[D,I,m,d,x,y,w]);return t("div",{className:Zo("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:Zo("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:Zo("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"})})})]})]}),P&&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:Zo("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:Zo("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(uv,{panels:T,allowDragging:d,showGridLines:d,renderPanel:R,onLayoutChange:N})})]})}function fv(e,a=ug.PtBr){const{t:t}=La();switch(a){case ug.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case ug.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function gv(e){const{t:a}=La();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const vv=[{value:yg.All,label:"Todos"},{value:yg.OnlyMine,label:e.t("dashboard_my")},{value:yg.Favorites,label:"Favoritos"}];function bv({dashboards:e,limit:n,isLoading:o=!1,language:d=ug.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}=La(),[S,A]=i(""),[E,P]=i(yg.All),[D,T]=i(null),I=l(e=>{A(e),w?.(e)},[w]),M=l(e=>{P(e),N?.(e)},[N]),R=s(()=>{let a=e;if(S){const e=S.toLowerCase();a=a.filter(a=>a.code?.toLowerCase().includes(e)||fv(a,d).toLowerCase().includes(e)||a.responsibleName?.toLowerCase().includes(e))}switch(E){case yg.OnlyMine:break;case yg.Favorites:a=a.filter(e=>e.isFavorite)}return a},[e,S,E,d]);return t("div",{className:Zo("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:Zo("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:Zo("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:vv.map(e=>a("button",{onClick:()=>M(e.value),disabled:o,className:Zo("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:Zo("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:Zo("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:fv(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:gv(e.lastModified)}),a("td",{className:"px-3 py-2",children:a("span",{className:Zo("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(D===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"})]})}),D===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 xv=[{value:sg.NotUpdate,label:e.t("dashboard_no_refresh")},{value:sg.FiveMinutes,label:"5 minutos"},{value:sg.TenMinutes,label:"10 minutos"},{value:sg.FifteenMinutes,label:"15 minutos"},{value:sg.ThirtyMinutes,label:"30 minutos"},{value:sg.OneHour,label:"1 hora"}],yv=[{value:lg.NormalPage,label:e.t("dashboard_normal_page")},{value:lg.Carousel,label:"Carrossel"}],wv=[{value:ag.FiveSeconds,label:"5 segundos"},{value:ag.TenSeconds,label:"10 segundos"},{value:ag.FifteenSeconds,label:"15 segundos"},{value:ag.ThirtySeconds,label:"30 segundos"},{value:ag.OneMinute,label:"1 minuto"},{value:ag.ThreeMinutes,label:"3 minutos"},{value:ag.FiveMinutes,label:"5 minutos"},{value:ag.TenMinutes,label:"10 minutos"}],Nv=[{value:cg.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:cg.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:cg.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],_v=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Cv({dashboard:e,initialTab:r=dg.General,isSaving:n=!1,isQualitfy:o=!1,users:d=[],groups:c=[],places:u=[],collaborators:m=[],onSave:p,onCancel:h,className:f}){const{t:g}=La(),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,P]=i(e?.responsibleId??""),[D,T]=i(e?.isActive??!0),[I,M]=i(e?.idUpdateTime??sg.NotUpdate),[R,z]=i(e?.idViewType??lg.NormalPage),[L,F]=i(e?.idPageTime??ag.FifteenSeconds),[U,O]=i(e?.idShare??cg.NotShared),[j,B]=i(e?.groups??[]),[$,V]=i(e?.places??[]),[q,W]=i(e?.collaborators??[]),H=R===lg.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:D,idUpdateTime:I,idViewType:R,idPageTime:H?L:null,idShare:U,groups:U===cg.SharedWithUsersGroupsPlacesCollaborators?j:[],places:U===cg.SharedWithUsersGroupsPlacesCollaborators?$:[],collaborators:U===cg.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[K,n,p,y,N,C,S,E,D,I,R,L,H,U,j,$,q]);return t("div",{className:Zo("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:Zo("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(dg.General),className:Zo("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===dg.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),a("button",{onClick:()=>x(dg.Share),className:Zo("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",b===dg.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===dg.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:_v.map(e=>a("button",{onClick:()=>Y(e.key),className:Zo("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:Zo("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:Zo("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:Zo("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=>P(e.target.value),disabled:!v,className:Zo("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:Zo("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:xv.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(!D),disabled:e?.isGeneralViewUse,className:Zo("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",D?"bg-primary":"bg-muted","disabled:opacity-50"),children:a("span",{className:Zo("inline-block h-4 w-4 rounded-full bg-white transition-transform",D?"translate-x-6":"translate-x-1")})}),a("span",{className:"text-sm text-foreground",children:D?"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:Zo("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:yv.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:Zo("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:wv.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]})]}),b===dg.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:Nv.map(r=>t("label",{className:Zo("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:()=>O(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===cg.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:Zo("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:Zo("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:Zo("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 kv({dashboards:e,limit:r,generalView:n,language:o=ug.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:P,onRemove:D,onDuplicate:T,onShare:I,onAddPanel:M,onEditPanel:R,onRemovePanel:z,onDuplicatePanel:L,onLayoutChange:F,onSearch:U,onQuickFilterChange:O,onSetGeneralView:j,viewState:B,onViewStateChange:$,listToolbarExtra:V,viewToolbarActions:q,className:W}){const[H,G]=i({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]),[J,X]=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!==lg.Carousel||g.length<=1)return;const e=function(e){switch(e){case ag.FiveSeconds:return 5e3;case ag.TenSeconds:return 1e4;case ag.FifteenSeconds:return 15e3;case ag.ThirtySeconds:return 3e4;case ag.OneMinute:return 6e4;case ag.ThreeMinutes:return 18e4;case ag.FiveMinutes:return 3e5;case ag.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"}),X(!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?P?.(K.dashboardId,e):E?.(e)},[K,E,P]),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:Zo("flex flex-col h-full",W),children:["list"===K.mode&&a(bv,{dashboards:e,limit:r,isLoading:d,language:o,canAdd:c,canEdit:u,canRemove:p,onOpen:ae,onEdit:ne,onShare:oe,onDuplicate:T,onRemove:D,onAdd:re,onToggleFavorite:A,onRefresh:S,onSearch:U,onQuickFilterChange:O,toolbarExtra:V,className:"flex-1"}),"view"===K.mode&&Q&&t("div",{className:"flex flex-col h-full",children:[!J&&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(hv,{dashboard:Q,panels:f,pages:g,activePageId:Z,canEdit:u||h&&!!Q.isStandard,isFullscreen:J,isLoading:d,getPanelData:v,onRefresh:k,onToggleFullscreen:()=>X(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(Cv,{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(Cv,{dashboard:Q,initialTab:"share"===K.mode?dg.Share:dg.General,users:b,groups:x,places:y,collaborators:w,isSaving:N,isQualitfy:!!Q.isStandard&&!h,onSave:ie,onCancel:se,className:"flex-1"})]})]})}function Sv(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Av(e,a){return{id:a?.id??Sv(),text:e,children:a?.children,collapsed:a?.collapsed,color:a?.color,icon:a?.icon,note:a?.note,side:a?.side}}function Ev(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 Pv(e,a){const t=a(e);return t.children?.length?{...t,children:t.children.map(e=>Pv(e,a))}:t}function Dv(e,a,t){return Pv(e,e=>e.id===a?t(e):e)}function Tv(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function Iv(e,a,t){const r=Av(t||"");let n=r.id;return{root:Pv(e,t=>{if(t.id!==a)return t;let o=r;if(t.id===e.id){const a=Tv(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 Mv(e,a,t){if(e.id===a)return Iv(e,a,t);const r=Ev(e,a);if(!r||!r.parent)return{root:e,newId:a};const n=r.parent,o=Av(t||"",{side:r.node.side}),i=o.id;return{root:Pv(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 Rv(e,a){if(e.id===a)return{root:e,nextSelectedId:a};const t=Ev(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:Pv(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==a)}),nextSelectedId:i}}function zv(e,a,t){if(a===t)return e;if(a===e.id)return e;if(function(e,a,t){const r=Ev(e,a);return!!r&&!!Ev(r.node,t)}(e,a,t))return e;const r=Ev(e,a);if(!r)return e;const n=(()=>{if(t===e.id){const a=Tv(e);return{...r.node,side:a.left<=a.right?"left":"right"}}const a=Ev(e,t)?.node;return{...r.node,side:a?.side}})(),o=Pv(e,e=>e.children?.length&&e.children.some(e=>e.id===a)?{...e,children:e.children.filter(e=>e.id!==a)}:e);return Pv(o,e=>e.id!==t?e:{...e,collapsed:!1,children:[...e.children??[],n]})}function Lv(e,a){return Dv(e,a,e=>({...e,collapsed:!e.collapsed}))}function Fv(e,a){return Pv(e,t=>t.children?.length?t.id===e.id&&a?t:{...t,collapsed:a}:t)}function Uv(e){const{value:a,defaultValue:t,onChange:r,readOnly:n}=e,o=void 0!==a,[d,c]=i(()=>t??a??Av("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=Dv(m,e,e=>({...e,text:a}));v(t,m)},[m,v]),x=l((e,a)=>{const t=Dv(m,e,e=>({...e,...a}));v(t,m)},[m,v]),y=l((e,a="")=>{const{root:t,newId:r}=Iv(m,e,a);return v(t,m),h(r),r},[m,v]),w=l((e,a="")=>{const{root:t,newId:r}=Mv(m,e,a);return v(t,m),h(r),r},[m,v]),N=l(e=>{const{root:a,nextSelectedId:t}=Rv(m,e);a!==m&&(v(a,m),h(t))},[m,v]),_=l((e,a)=>{const t=zv(m,e,a);t!==m&&v(t,m)},[m,v]),C=l(e=>{const a=Ev(m,e);if(!a||!a.node.children?.length)return;const t=Lv(m,e);v(t,m)},[m,v]),k=l(()=>{v(Fv(m,!1),m)},[m,v]),S=l(()=>{v(Fv(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]),P=f.current.length>0,D=g.current.length>0,T=s(()=>p?Ev(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:P,canRedo:D}}const Ov=180,jv=80,Bv=16,$v=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)+Bv*(a.length-1);return{node:e,visibleChildren:a,height:Math.max(44,t)}}function qv(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)+Bv*(e.visibleChildren.length-1))/2;for(const c of e.visibleChildren){const a="right"===n?t+180+jv:t-jv-Ov,r=d+c.height/2-22,l=qv(c,e.node,a,r,n,o+1,i);s.push(l),d+=c.height+Bv}return l}function Wv(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)+Bv*Math.max(0,t.length-1),o=r.reduce((e,a)=>e+a.height,0)+Bv*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=$v+d,p=[],h={node:e,parent:null,x:m,y:$v+i/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let f=$v+i/2-n/2;for(const b of t){const a=f+b.height/2-22,t=qv(b,e,m+220+jv,a,"right",1,p);h.visibleChildren.push(t),f+=b.height+Bv}let g=$v+i/2-o/2;for(const b of r){const a=g+b.height/2-22,t=qv(b,e,m-jv-Ov,a,"left",1,p);h.visibleChildren.push(t),g+=b.height+Bv}const v=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:v,width:c,height:u}}(e),[e])}function Hv(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 Gv=({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)?A[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)},S=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:Zo("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:S},children:[x&&a(x,{className:Zo("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:Zo("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(Ds,{children:[a(Ts,{asChild:!0,children:a("button",{type:"button",onClick:e=>e.stopPropagation(),className:Zo("shrink-0 rounded p-0.5 hover:bg-muted/40",b&&"hover:bg-primary-foreground/10"),"aria-label":v.note,children:a(We,{className:"h-3.5 w-3.5 opacity-70"})})}),a(Is,{className:"max-w-xs whitespace-pre-line",children:v.note})]}),w&&a("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:Zo("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(J,{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(ia,{className:"h-3 w-3"})})]})},Kv=({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"})},Yv=({label:e,icon:r,onClick:n,disabled:o})=>t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{type:"button",variant:"ghost",size:"icon",onClick:n,disabled:o,"aria-label":e,className:"h-8 w-8",children:r})}),a(Is,{children:e})]}),Qv=e=>{const{t:r}=La();return t("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[a(Yv,{label:r("mind_map_add_child"),icon:a(sa,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),a(Yv,{label:r("mind_map_add_sibling"),icon:a(J,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),a(Yv,{label:r("mind_map_delete_node"),icon:a(G,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),a(fi,{orientation:"vertical",className:"mx-1 h-5"}),a(Yv,{label:r("mind_map_expand_all"),icon:a(la,{className:"h-4 w-4"}),onClick:e.onExpandAll}),a(Yv,{label:r("mind_map_collapse_all"),icon:a(da,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),a(fi,{orientation:"vertical",className:"mx-1 h-5"}),a(Yv,{label:r("mind_map_zoom_out"),icon:a(ca,{className:"h-4 w-4"}),onClick:e.onZoomOut}),a(Yv,{label:r("mind_map_zoom_in"),icon:a(ua,{className:"h-4 w-4"}),onClick:e.onZoomIn}),a(Yv,{label:r("mind_map_fit_to_screen"),icon:a(ma,{className:"h-4 w-4"}),onClick:e.onFit}),a(fi,{orientation:"vertical",className:"mx-1 h-5"}),a(Yv,{label:r("mind_map_undo"),icon:a(pa,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),a(Yv,{label:r("mind_map_redo"),icon:a(ha,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),a("div",{className:"flex-1"}),a(Yv,{label:r("mind_map_export_json"),icon:a(ea,{className:"h-4 w-4"}),onClick:e.onExportJson}),a(Yv,{label:r("mind_map_export_image"),icon:a(Ve,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function Jv(e){return JSON.stringify(e,null,2)}function Xv(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=>Xv(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 Zv(e){return Xv(JSON.parse(e))}const eb=({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}=La(),b=Uv({value:e,defaultValue:r,onChange:o,readOnly:d}),x=Wv(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 Hv("up",d);if("ArrowDown"===i.key)return i.preventDefault(),void Hv("down",d);if("ArrowLeft"===i.key)return i.preventDefault(),void Hv("left",d);if("ArrowRight"===i.key)return i.preventDefault(),void Hv("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 P=b.selectedId,D=b.selectedNode,T=P===b.root.id,I=n.useRef(null),M=e=>a=>{if(d)return;const t=I.current;if(!t||t===e)return;const r=Ev(b.root,t);r&&Ev(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(Ps,{children:t("div",{ref:w,tabIndex:0,role:"tree","aria-label":v("mind_map_aria_label"),className:Zo("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(Qv,{canAddChild:!!D&&!d,canAddSibling:!!D&&!d,canDelete:!!D&&!T&&!d,canUndo:b.canUndo&&!d,canRedo:b.canRedo&&!d,onAddChild:()=>{if(!P)return;const e=b.addChild(P,"");k(e)},onAddSibling:()=>{if(!P)return;if(T){const e=b.addChild(P,"");return void k(e)}const e=b.addSibling(P,"");k(e)},onDelete:()=>{P&&!T&&b.removeNode(P)},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)}(Jv(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(Kv,{parent:e,child:t},`${e.node.id}-${t.node.id}`)))}),x.nodes.map(e=>{return a(Gv,{layout:e,selected:P===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})]})})]})})},ab=({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:P,onViewModeChange:D,listCardRenderer:T,gridCardRenderer:I,showViewToggle:M=!1})=>{const{setSearchVisible:R}=od(),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)}),U=P||"grid",O="list"===U,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"}[O?1:A],B=z&&L?a(Xd,{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:U,onViewModeChange:D,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(xd,{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(Cd,{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:Zo("grid gap-4",j),children:n.entities.map(e=>{const m=(e=>{const{t:a}=La();return O&&T?T(e):!O&&I?I(e):E?E(e):null})(e);return t(Ad,{children:[a(Ed,{asChild:!0,children:m?a("div",{className:"cursor-pointer",onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:m}):a(di,{className:Zo("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",p&&n.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",O&&"flex-row"),onClick:a=>{a.stopPropagation(),p?n.selectItem(e.id):i?.(e)},children:t(pi,{className:Zo("p-4",O&&"flex items-center gap-4 w-full"),children:[p&&a("div",{className:Zo(O?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:a(Zd,{checked:n.selectedIds.includes(e.id),onCheckedChange:()=>n.selectItem(e.id)})}),O?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(Vd,{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(Zd,{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:Zo("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(Vd,{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(zd,{className:"w-[160px]",children:a($d,{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 tb({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}=La(),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,$=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:V,isDragging:q,activeColumn:W,handleMouseDown:H}=Hd({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=tc({enabled:_&&!!C,onReorder:C??(()=>{})}),K=s(()=>{if(w){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,w,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(Hs,{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(cd,{className:Zo("table-fixed w-full",f),children:[a(ud,{className:"sticky top-0 bg-background z-10",children:t(hd,{children:[S&&a(fd,{className:"w-[40px]"}),g&&a(fd,{className:"w-[40px]",children:a(is,{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(fd,{className:Zo(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?ne:oe,{size:14,className:"ml-1"}))]}):a("span",{className:"font-medium",children:e.header}),o&&a(Sd,{direction:"horizontal",onMouseDown:a=>H(String(e.key),a),isDragging:i})]},String(e.key));var p}),Y&&a(fd,{className:"w-[80px] text-right",children:R??z("actions","Ações")})]})}),a(md,{children:e.map(e=>{const n=S&&B.has(e.id);return t(o.Fragment,{children:[t(hd,{onClick:()=>u?.(e),className:Zo(u?"cursor-pointer":"","relative","inline"===I&&"group"),children:[S&&a(gd,{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?z("collapse_row","Recolher linha"):z("expand_row","Expandir linha"),children:a(n?D:O,{size:16,className:"text-muted-foreground"})})}),g&&a(gd,{children:a(is,{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(gd,{className:t.className,children:a(kd,{children:t.render?t.render(e):String(e[t.key]??"-")})},String(t.key))),Y&&a(gd,{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(hd,{className:"bg-muted/30 hover:bg-muted/30",children:a(gd,{colSpan:Q,className:"p-0",children:a("div",{className:"animate-accordion-down overflow-hidden",children:A(e)})})})]},e.id)})})]})})}function rb({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}=La(),p=s(()=>{const a=[];return e&&i&&a.push({key:"edit",icon:q,label:m("edit","Editar"),onClick:e,variant:"default"}),n&&a.push({key:"toggle-status",icon:o?W:H,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:G,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(Ps,{delayDuration:200,children:t(hs,{children:[a(fs,{asChild:!0,children:a(ni,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:a(E,{size:"compact"===u?14:16})})}),a(Ns,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t(Ms,{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(_s,{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(ni,{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 nb({searchValue:e="",onSearchChange:r,customFilters:n=[],onClearFilters:o,showClearButton:i=!0,layout:s="horizontal"}){const{t:l}=La(),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($,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a(ii,{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(ni,{variant:"ghost",size:"sm",onClick:o,className:"h-9 px-3 whitespace-nowrap",children:[a(P,{size:14,className:"mr-1"}),l("clear_filters","Limpar filtros")]})]})}function ob(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 ib({children:e,itemId:t,enableDrag:r,onDragStartCell:n,onDragEndCell:o,onDragOverCell:i,onDropCell:s,className:l}){return a(gd,{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 sb({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(hd,{className:Zo(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(ib,{...I,children:t("div",{className:"flex items-center gap-2",style:{paddingLeft:`${S}px`},children:[p&&a(is,{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(be,{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(ib,{...I,className:Zo("text-center",r.className),children:r.hoverContent?t(Ym,{openDelay:200,children:[a(Qm,{asChild:!0,children:a("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:i})}),a(Jm,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):i},String(r.key))}),u&&a(ib,{...I,className:"text-right",children:a("div",{onClick:e=>e.stopPropagation(),className:Zo("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(sb,{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 lb({onDrop:r,isDragOver:n,onDragOver:o,onDragLeave:i,label:s}){return t("div",{className:Zo("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(fa,{className:"h-4 w-4"}),s??e.t("leadership_make_root_short")]})}function db({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:P,actionsWidth:D=20,nameMinWidth:T=200}){const[I,M]=i(null),[R,z]=i(null),[L,F]=i(!1),[U,O]=i(1),j=u(null),B=u([]),$=u(null),V=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)ob(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=[],$.current=null,M(null),z(null),F(!1),O(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];j.current=e,B.current=t,$.current=null,M(e),O(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)?z(null):($.current=e,z(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]),J=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]),X=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(be,{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:Zo("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(lb,{onDrop:J,isDragOver:L,onDragOver:X,onDragLeave:()=>F(!1),label:P}),t(cd,{children:[a(ud,{children:t(hd,{children:[a(fd,{className:"text-left",style:{minWidth:T},children:t("div",{className:"flex items-center gap-2",children:[w&&a(is,{checked:k??!1,onCheckedChange:()=>C?.()}),d]})}),n.map(e=>a(fd,{className:Zo("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),f&&a(fd,{className:"text-right",style:{width:D},children:g})]})}),a(md,{children:r.map(e=>a(sb,{item:e,level:0,columns:n,nameKey:s,iconComponent:c,expandedIds:m,onToggleExpand:p,onRowClick:h,renderActions:f,rowActionsVariant:v,enableSelection:w,selectedIds:V,onSelectItem:_,enableRowDrag:S,draggedId:I,dragOverId:R,onDragStartCell:K,onDragEndCell:H,onDragOverCell:Y,onDropCell:Q,dragCount:U},e.id))})]})]})}function cb(e){const a=Ga();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 ub(e,a){const t=cb({basePath:e,newPath:a.newPath,editPath:a.editPath});return{useCustomRouting:!0,onNew:t.onNew,onEdit:t.onEdit}}const mb="true"===import.meta.env.VITE_SHOW_EDIT_PROFILE,pb=o.memo(({variant:e="card",className:n="",selectedUnit:l,onUnitChange:d})=>{const{t:c}=La(),{user:u,companies:m,alias:p,isAuthenticated:h,logout:f,switchUnit:g}=od(),{role:v}=_u(),b=v?.name||null,x=m?.[0]||null,y=p?m?.find(e=>e.alias===p):x,w=m||[],N=l||y||x||x,[_,C]=o.useState(0);o.useEffect(()=>{const e=()=>C(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const k=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&v=${_}`},[u?.id,_]),S=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=96&v=${_}`},[u?.id,_]),A=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]),E=o.useCallback(e=>{d?d(e):g(e)},[d,g]),P=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]),[T,I]=i(!1);if(!h||!u)return null;const M=()=>t(r,{children:[t("div",{className:"flex items-center space-x-3",children:[a("div",{className:"flex-shrink-0",children:t(Vc,{className:"w-10 h-10",children:[k&&a(qc,{src:k,alt:u.name||c("user_photo")}),a(Wc,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:A||a(be,{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(ve,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"text-sm font-medium",children:N.name})]})}),P.length>1&&t("div",{className:"mt-2",children:[t("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",P.length]}),t("div",{className:"flex flex-wrap gap-1",children:[P.slice(0,3).map(e=>a(ds,{variant:e.alias===N?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>E(e),children:e.name},e.alias)),P.length>3&&t(ds,{variant:"outline",className:"text-xs",children:["+",P.length-3]})]})]})]});return"dropdown"===e?t(r,{children:[t(hs,{children:[a(fs,{asChild:!0,children:a(ni,{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(Vc,{className:"w-8 h-8 border border-primary-foreground/30",children:[k&&a(qc,{src:k,alt:u.name||c("user_photo")}),a(Wc,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:A||a(be,{className:"h-4 w-4"})})]}),a(D,{className:"h-4 w-4"})]})})}),t(Ns,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t(bs,{children:[t(ys,{children:[a(me,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),a(ws,{children:P.map(e=>t(_s,{onClick:()=>E(e),className:e.alias===N?.alias?"bg-muted":"",children:[a(ve,{className:"mr-2 h-4 w-4"}),e.name,e.alias===N?.alias&&a(ds,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),mb&&t(r,{children:[a(As,{}),t(_s,{onClick:()=>I(!0),children:[a(ga,{className:"mr-2 h-4 w-4"}),c("edit_profile","Editar Perfil")]})]}),a(As,{}),t(_s,{onClick:f,children:[a(xe,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),mb&&a(su,{open:T,onOpenChange:I,user:u,userPhotoUrl:S,userInitials:A})]}):t(di,{className:n,children:[a(ci,{children:a(ui,{className:"text-lg",children:c("user_info")})}),t(pi,{className:"space-y-4",children:[a(M,{}),a(fi,{}),t(ni,{variant:"outline",onClick:f,size:"sm",className:"w-full",children:[a(xe,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),hb=d({});function fb({children:e,config:t}){const r=s(()=>{const e=ar(),a=t?.appName?e?`${t.appName} (Dev)`:t.appName:void 0;return{navigation:t?.navigation,appName:a}},[t?.navigation,t?.appName]);return a(hb.Provider,{value:r,children:e})}function gb(){return c(hb)}function vb(){const e=Ka(),{navigation:a}=gb();return bb(a,e.pathname)}function bb(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 xb(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 yb({appName:e}){const[n,o]=i(!1),{association:s}=_u(),l=Sr({isQualitfy:s?.isQualitfy,isMetroex:s?.isMetroex});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:l,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(sm,{open:n,onOpenChange:o})]})}const wb=p(function({actions:r}){const n=Ka(),o=Ga(),{navigation:s,appName:d}=gb(),c=bb(s,n.pathname),{metadata:u,headerActions:p}=cu(),{setOpenMobile:h}=ah(),{companies:f,alias:g,isSearchVisible:v,clearSearch:b,refreshData:x,switchUnit:y}=od(),w=g?f?.find(e=>e.alias===g)||f?.[0]||null:f?.[0]||null,[N,_]=Wa(),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,E]=xb(k,dr.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 D=s?.find(e=>e.path===n.pathname)||s?.find(e=>n.pathname.startsWith(e.path+"/")),T=u.title||c,I=u.subtitle||D?.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(ni,{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(va,{size:20})}),a("div",{className:"hidden md:flex items-center flex-shrink-0",children:a(yb,{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(Qa,{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($,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a(ii,{placeholder:"Pesquisar",value:k,onChange:e=>(e=>{S(e)})(e.target.value),className:"w-full pl-10 pr-8"}),k&&a(ni,{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:()=>{E(),S("");const e=new URLSearchParams(N);e.delete("search"),e.delete("page"),_(e)},title:e.t("clear_search"),children:a(P,{size:14})})]}),a(ni,{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(me,{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(ni,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>qo(import.meta.env.VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),a(Nf,{}),a("div",{className:"text-sm",children:a(pb,{variant:"dropdown",selectedUnit:w,onUnitChange:C})})]})]})})}),Nb=({key:e,enabled:a,checkFn:t,staleTime:r=3e5,gcTime:n=6e5})=>Ba({queryKey:["permission",e],queryFn:t,enabled:a,staleTime:r,gcTime:n,retry:0,refetchOnWindowFocus:!1});function _b({config:e,isCollapsed:n=!1,isDisabled:o=!1,className:i}){const{t:s}=La(),{actions:l,triggerLabel:d="Criar",triggerIcon:c=J,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(ni,{onClick:e.onClick,disabled:o||e.disabled,className:Zo("justify-center px-2 w-full",i),variant:"outline",size:"default",children:a(r,{className:"h-4 w-4 shrink-0"})});return t(Ds,{children:[a(Ts,{asChild:!0,children:n}),a(Is,{side:"right",children:a("p",{children:e.label})})]})}return a(cf,{label:e.label,onClick:e.onClick,icon:r,actions:s,variant:"outline",disabled:o||e.disabled,className:Zo("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(ni,{onClick:e.onClick,disabled:s,className:Zo("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(Ds,{children:[a(Ts,{asChild:!0,children:d}),a(Is,{side:"right",children:a("p",{children:e.label})})]}):d}const p=a(ni,{disabled:o,className:Zo("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(hs,{children:[a(fs,{asChild:!0,children:n?t(Ds,{children:[a(Ts,{asChild:!0,children:p}),a(Is,{side:"right",children:a("p",{children:d})})]}):p}),a(Ns,{align:"start",side:n?"right":"bottom",className:"w-56 bg-popover",children:l.map(e=>{const r=e.icon;return t(_s,{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 Cb="forlogic-sidebar-pinned",kb=()=>{try{const e=localStorage.getItem(Cb);return!!e&&JSON.parse(e)}catch{return!1}};function Sb({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 Ab=d(void 0);function Eb({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(Ab.Provider,{value:p,children:e})}function Pb(){const e=c(Ab);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Db(){const{hasOpenModal:e}=Pb();return e}const Tb="2.4.5";function Ib({config:e,customContent:r,resizable:n=!1,minWidth:o=224,maxWidth:s=384}={}){const{t:d}=La(),{open:c,setOpen:u,setOpenMobile:p}=ah(),h=Ka(),{alias:f,user:g}=od(),{appName:v}=gb(),{hasOpenModal:b}=Pb(),[x,y]=i(kb),w=dd(),N=!!w||c,_=l(()=>{w&&p(!1)},[w,p]),C=n?Sb({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(rh,{collapsible:"icon",className:Zo("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(Ps,{children:a(_b,{config:e.moduleActions,isCollapsed:!N,isDisabled:b})})}),a(uh,{className:Zo(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||a(mh,{className:"p-0",children:a(fh,{children:a(gh,{className:"gap-1",children:a(Ps,{children:e?.navigation?.map((e,r)=>{if("separator"===e.type)return a(ch,{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}=Nb({key:o,enabled:Boolean(e.permissionCheck&&f&&g?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!i,c=s?M:l?Ke:e.icon;l?d("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?N?a(Tu,{defaultOpen:!0,className:"group/collapsible",children:t(vh,{children:[a(Iu,{asChild:!0,children:a(xh,{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(Mu,{children:a(_h,{children:e.children.map((e,t)=>a(n,{item:e,index:t},e.path))})})]})},e.path):a(vh,{children:t(Ds,{children:[a(Ts,{asChild:!0,children:a("div",{className:Zo("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(Is,{side:"right",children:a("p",{children:e.label})})]})},e.path):a(vh,{children:l||s?t(Ds,{children:[a(Ts,{asChild:!0,children:N?a(xh,{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(Is,{side:"right",children:a("p",{children:s?"Verificando acesso...":d("restricted_access")})})]}):N?a(xh,{asChild:!0,isActive:k(e.path),size:"default",children:t(Qa,{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(Ds,{children:[a(Ts,{asChild:!0,children:a(Qa,{to:e.path,onClick:_,className:Zo("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(Is,{side:"right",children:a("p",{children:e.label})})]})},e.path)};return a(n,{item:e,index:r},e.path)})})})})})}),!w&&t("div",{className:Zo("mt-auto pb-4 pt-2 flex items-center gap-2",N?"justify-between px-1":"justify-center flex-col"),children:[N&&t("span",{className:"text-[10px] font-mono text-muted-foreground/70 select-text truncate",title:`forlogic-core v${Tb}`,children:["v",Tb]}),!N&&t(Ds,{children:[a(Ts,{asChild:!0,children:t("span",{className:"text-[9px] font-mono text-muted-foreground/60 select-text",children:["v",Tb.split(".").slice(0,2).join(".")]})}),a(Is,{side:"right",children:t("p",{children:["forlogic-core v",Tb]})})]}),t(Ds,{children:[a(Ts,{asChild:!0,children:a("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!x;y(e),(e=>{try{localStorage.setItem(Cb,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?se:O,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),a(Is,{side:"right",children:a("p",{children:c?"Recolher":"Expandir"})})]})]}),n&&C&&N&&a("div",{ref:C.dragRef,onMouseDown:C.handleMouseDown,className:Zo("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")})]})}function Mb(e){if("string"!=typeof e)return;return e.trim()||void 0}function Rb(){const{alias:e,isAuthenticated:a,isLoading:t,selectedUnit:r}=od(),n=r?.id??null,o=!!Nl.getAccessToken(),i=function(e,a){const t=Mb(a);if(t)return t;const r=Nl,n=Mb(r.getCurrentCompanyId?.());if(n)return n;const o=Nl.extractTokenData(),i=Mb(o?.companyId)??Mb(o?.company_id);if(i)return i;if(e){const a=Mb(Nl.getCompanyId(e));if(a)return a}}(e,n),s=!!e&&!!a&&o,l=s&&!!i,[,d]=g(e=>e+1,0);m(()=>{if(!a||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[a,o,i]);let c=null;return t?c="Carregando autenticação...":a?e?o?i||(c="Aguardando unidade ativa..."):c="Aguardando token de acesso Qualiex...":c="Aguardando alias...":c="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!t,isAuthenticated:!!a,isReadyForQualiex:s,isReadyForQualiexWithCompany:l,isWaitingCompanyId:!!a&&o&&!i,waitingReason:c}}async function zb(e,a){const t=await Qc(`${Hc()}/api/common/v1/updates/userView/${a}`,e),r=await t.json(),n=r?.data??r;return Array.isArray(n)?n:[]}async function Lb(e,a,t,r){const n=void 0===r?"undefined":String(r),o={id:a,idUpdateType:t};void 0!==r&&(o.liked=r),await Qc(`${Hc()}/api/common/v1/Updates/userVisualized/${t}/${n}`,e,{method:"POST",body:JSON.stringify(o)})}const Fb=3e5;function Ub(){const{alias:e,isReadyForQualiex:a}=Rb();return Ba({queryKey:["user-updates","bar",e],queryFn:()=>zb(e,1),enabled:a,staleTime:Fb})}function Ob(){const{alias:e,isReadyForQualiex:a}=Rb();return Ba({queryKey:["user-updates","dialog",e],queryFn:()=>zb(e,2),enabled:a,staleTime:Fb})}function jb({item:e,onDismiss:r}){const{t:n}=La(),o=e.text||e.title,i=e.color||"hsl(var(--primary))";return t("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:i},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[o,a(fe,{className:"h-3.5 w-3.5"})]}):a("span",{children:o}),a("button",{type:"button",onClick:()=>r(e.id),"aria-label":n("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:a(P,{className:"h-4 w-4"})})]})}function Bb(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 $b(e,a){const t=Bb(e);if(!t)return e;return`https://www.youtube.com/embed/${t}${a?"?autoplay=1&mute=1":""}`}function Vb(e){const a=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return a?a[1]:null}function qb(e,a){const t=Vb(e);if(!t)return e;return`https://player.vimeo.com/video/${t}${a?"?autoplay=1&muted=1":""}`}function Wb(e){if(!e)return;const a=e.match(/src="([^"]+)"/);return a?a[1]:void 0}function Hb(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function Gb(e,a,t){switch(a||Hb(e)){case"youtube":return $b(e,t);case"vimeo":return qb(e,t);default:return e}}function Kb({item:e,open:r,onClose:n}){const{t:o}=La(),[s,l]=i(!1),[d,c]=i(!1);m(()=>{l(!1),c(!1)},[e.id]);const u=e.countLiked+(s?1:0);return a(Ai,{open:r,onOpenChange:e=>{e||n({liked:s,doNotShowAgain:d})},children:t(Mi,{size:"md",children:[a(Ri,{showSeparator:!0,children:a(Fi,{style:e.color?{color:e.color}:void 0,children:e.title})}),t(zi,{children:[(()=>{const t=e.urlVideo??e.videoUrl??e.url??"",r=t?Bb(t):null;return r?a("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:a("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),a("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t(Li,{className:"!justify-between items-center",children:[t("div",{className:"flex items-center gap-2",children:[a("button",{type:"button",onClick:()=>l(e=>!e),"aria-pressed":s,"aria-label":o("updates_dialog_like","Curtir"),className:Zo("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",s?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:a(ba,{className:Zo("h-4 w-4",s&&"fill-current")})}),a("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t("div",{className:"flex items-center gap-4",children:[t("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[a(is,{checked:d,onCheckedChange:e=>c(!0===e)}),o("updates_dialog_do_not_show_again","Não exibir novamente")]}),a(ni,{variant:"ghost",onClick:()=>n({liked:s,doNotShowAgain:d}),children:o("updates_dialog_close","Fechar")})]})]})]})})}function Yb(e){return e&&e.trim()?e.trim():"anon"}function Qb(e){try{const a=localStorage.getItem(e);if(!a)return new Set;const t=JSON.parse(a);return new Set(Array.isArray(t)?t.map(String):[])}catch{return new Set}}function Jb(e,a){try{localStorage.setItem(e,JSON.stringify(Array.from(a)))}catch{}}function Xb(){const{alias:e}=Rb(),{data:n=[]}=Ub(),{data:o=[]}=Ob(),l=s(()=>function(e){return`updates.bar.dismissed.${Yb(e)}`}(e),[e]),d=s(()=>function(e){return`updates.dialog.seen.${Yb(e)}`}(e),[e]),[c,u]=i(()=>Qb(l)),[p,h]=i(()=>Qb(d)),[f,g]=i(new Set),[v,b]=i(0);if(m(()=>{u(Qb(l)),h(Qb(d)),g(new Set),b(0)},[l,d]),!e)return null;const x=n.find(e=>!c.has(e.id)),y=o.filter(e=>!p.has(e.id)&&!f.has(e.id))[v];return t(r,{children:[x&&a(jb,{item:x,onDismiss:async a=>{const t=new Set(c);t.add(a),u(t),Jb(l,t);try{await Lb(e,a,1)}catch{}}}),y&&a(Kb,{item:y,open:!0,onClose:async({liked:a,doNotShowAgain:t})=>{if(!y)return;const r=y.id;if(!t)return g(e=>{const a=new Set(e);return a.add(r),a}),void b(0);const n=new Set(p);n.add(r),h(n),Jb(d,n),b(0);try{await Lb(e,r,2,a)}catch{}}})]})}const Zb=p(function({children:e,sidebar:r,sidebarConfig:n,showHeader:o=!0,showSidebar:i=!0}){const d=s(()=>i?r||a(Ib,{config:n}):null,[r,n,i]),c=s(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),p=u(null),h=u(null),f=l(()=>{if(p.current&&h.current){const e=p.current.offsetHeight;h.current.style.setProperty("--header-height",`${e}px`)}},[]);return m(()=>{f();const e=new ResizeObserver(f);return p.current&&e.observe(p.current),()=>e.disconnect()},[f]),a(fb,{config:n,children:a(du,{children:a(th,{defaultOpen:!1,style:c,children:t("div",{ref:h,className:"flex flex-col h-screen w-full overflow-hidden",children:[o&&t("div",{ref:p,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[a(wb,{}),a(Xb,{})]}),t("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[d,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 ex({open:e,appName:n}){const[o,s]=i(!1),{association:l}=_u(),d=Sr({isQualitfy:l?.isQualitfy,isMetroex:l?.isMetroex});return t(r,{children:[a(lh,{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:d,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:Ar.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),a(sm,{open:o,onOpenChange:s})]})}function ax({title:e,subtitle:r,children:n,className:o,hasHeader:i=!0}){const s=e||r;return t("div",{className:Zo("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:Zo("p-6",!i&&s&&"pt-4"),children:n})]})}function tx({breadcrumbs:e,children:r,className:o}){return t("div",{className:Zo("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",o),children:[e&&e.length>0&&a(Cm,{className:"mb-4",children:a(km,{children:e.map((r,o)=>{const i=o===e.length-1;return t(n.Fragment,{children:[o>0&&a(Pm,{}),a(Sm,{children:i||!r.href?a(Em,{children:r.label}):r.asChild&&r.children?a(Am,{asChild:!0,children:r.children}):a(Am,{asChild:!0,children:a(Qa,{to:r.href||"/",children:r.label})})})]},`${r.label}-${o}`)})})}),a("div",{className:"space-y-6",children:r})]})}const rx=(e={})=>{const{enabled:a=!0}=e,{alias:t}=od();return Ba({queryKey:["active-modules",t],queryFn:async()=>{if(!t)return[];const e=Rl(),{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(!Ol.handleError(r))throw r;return[]}return a||[]},enabled:a&&!!t})};function nx({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 ox(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]),P=l(async()=>{N()&&!p&&(x?await E():c(e=>Math.min(e+1,v-1)))},[N,p,x,v,E]),D=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:P,back:D,goTo:T,canProceed:_,canGoBack:C,setData:k,updateField:S,reset:A,complete:E,setLoading:I,progress:w,stepIndex:d,totalSteps:v}}function ix(...e){return Object.assign({},...e)}const sx=()=>{const{locale:e,timezone:a}=Du(),t=Co;return{formatDatetime:r=>Fo(r,t,a,e),formatDate:t=>Uo(t,e,a),locale:e,timezone:a,datetimeFormat:t}};class lx{static async sendEmail(e){const a=Rl(),{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 dx=lx,cx=Kt.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),ux=Kt.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),mx=Kt.string().uuid("UUID inválido"),px=Kt.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),hx=(e=1e3)=>Kt.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),fx=Kt.object({page:Kt.coerce.number().int().min(1).default(1),pageSize:Kt.coerce.number().int().min(1).max(500).default(50)});function gx(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 k.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 k.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 k.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 k.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,a),k.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(t){throw k.error("Erro",{description:"Erro ao remover o arquivo"}),t}},uploading:a}}function vx({value:n,onChange:o,onSubmit:l,onCancel:d,uploadFunction:c,deleteFunction:m,uploadOptions:p}){const{t:h}=La(),[f,g]=i(n||{inputType:"url",controls:!0}),v=u(null),b=u(null),{upload:x,uploading:y}=gx({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["video/*"],maxSize:104857600}}),{upload:w,uploading:N}=gx({uploadFunction:c,deleteFunction:m,defaultOptions:{...p,allowedTypes:["image/*"],maxSize:5242880}}),_=s(()=>Hb(f.videoUrl||Wb(f.embedCode)||""),[f.videoUrl,f.embedCode]),C=(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(li,{children:h("input_type")}),t(Qi,{value:f.inputType||"url",onValueChange:e=>C("inputType",e),children:[a(Zi,{children:a(Xi,{})}),t(ts,{children:[a(ns,{value:"url",children:"URL"}),a(ns,{value:"upload",children:h("file_upload")}),a(ns,{value:"embed",children:h("embed_code")})]})]})]}),"upload"===f.inputType&&c&&t("div",{className:"space-y-2",children:[a(li,{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(ni,{type:"button",variant:"outline",onClick:()=>v.current?.click(),disabled:y,children:t(r,y?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(li,{children:h("embed_code")}),a(ss,{placeholder:h("paste_embed_code"),value:f.embedCode||"",onChange:e=>C("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),c&&t("div",{className:"space-y-2",children:[a(li,{children:"Thumbnail"}),t("div",{className:"flex gap-2",children:[a(ii,{type:"url",placeholder:"URL da thumbnail",value:f.thumbnail||"",onChange:e=>C("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(ni,{type:"button",variant:"outline",onClick:()=>b.current?.click(),disabled:N,children:t(r,N?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(li,{htmlFor:"title",children:"Título"}),a(ii,{id:"title",placeholder:h("video_title"),value:f.title||"",onChange:e=>C("title",e.target.value)})]}),t("div",{className:"flex gap-6",children:[t("div",{className:"flex items-center gap-2",children:[a(is,{id:"autoplay",checked:f.autoplay||!1,onCheckedChange:e=>C("autoplay",!0===e)}),a(li,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t("div",{className:"flex items-center gap-2",children:[a(is,{id:"controls",checked:!1!==f.controls,onCheckedChange:e=>C("controls",!0===e)}),a(li,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t("div",{className:"space-y-2",children:[a(li,{children:"Preview"}),a("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const r=f.videoUrl||Wb(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"===_?$b(r,f.autoplay):qb(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(ni,{variant:"outline",onClick:d,children:"Cancelar"}),a(ni,{onClick:()=>{f.videoUrl||f.embedCode?l(f):k.error("Erro",{description:h("no_video_selected")})},disabled:!(f.videoUrl||f.embedCode),children:"Salvar"})]})]})}function bx({content:r,className:n="",style:o}){const i=r.videoUrl||Wb(r.embedCode)||"";if(!i)return null;const s=Hb(i);return a(di,{className:`overflow-hidden my-4 ${n}`,style:o,children:t(pi,{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?$b(i,r.autoplay):qb(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 xx({value:e,onChange:n,onSubmit:o,onCancel:s,uploadFunction:l,deleteFunction:d,uploadOptions:c}){const{t:m}=La(),[p,h]=i(e||{alignment:"center",allowDownload:!1}),f=u(null),{upload:g,uploading:v}=gx({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(li,{children:"URL"}),t("div",{className:"flex gap-2",children:[a(ii,{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(ni,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:v,children:t(r,v?{children:[a(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}:{children:[a(xa,{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(li,{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(li,{htmlFor:"caption",children:"Legenda"}),a(ss,{id:"caption",placeholder:"Legenda",value:p.caption||"",onChange:e=>b("caption",e.target.value),rows:2})]}),t("div",{className:"space-y-2",children:[a(li,{htmlFor:"alt",children:m("alt_text")}),a(ii,{id:"alt",placeholder:m("alt_text"),value:p.alt||"",onChange:e=>b("alt",e.target.value)})]}),t("div",{className:"space-y-2",children:[a(li,{children:"Alinhamento"}),t(Qi,{value:p.alignment||"center",onValueChange:e=>b("alignment",e),children:[a(Zi,{children:a(Xi,{})}),t(ts,{children:[a(ns,{value:"left",children:"Esquerda"}),a(ns,{value:"center",children:"Centro"}),a(ns,{value:"right",children:"Direita"})]})]})]}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"space-y-2",children:[a(li,{htmlFor:"width",children:"Largura"}),a(ii,{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(li,{htmlFor:"height",children:"Altura"}),a(ii,{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(is,{id:"allowDownload",checked:p.allowDownload||!1,onCheckedChange:e=>b("allowDownload",!0===e)}),a(li,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[a(ni,{variant:"outline",onClick:s,children:"Cancelar"}),a(ni,{onClick:()=>{p.imageUrl?o(p):k.error("Erro",{description:m("no_image_selected")})},disabled:!p.imageUrl,children:"Salvar"})]})]})}function yx({content:e,className:r="",style:n}){const{t:o}=La();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(ea,{className:"h-4 w-4"}),"Baixar imagem"]})]})})}function wx(e,a){return e/a}function Nx(e,a,t,r){const n=wx(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 _x(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 Cx(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 kx(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const Sx=["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 Ax(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 Ex(e){const a=e.lastIndexOf(".");return-1===a?"":e.substring(a+1).toLowerCase()}function Px({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}=La(),S=u(null),[A,E]=i(null),[D,T]=i(null),[I,M]=i(!1),R=A||e,z=A?.name||e?.name||"",L=A?.size||e?.size;z&&Ex(z);const F=r||z,U=c&&!A&&!!e,O=m&&!A&&!!e,j=!!D||!!b||f&&g&&!R,B=!!R,$=l(e=>{if(Sx.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=Ex(e.name);if(!n.includes(a))return{type:"extension",message:o}}return null},[s,d,n,o]),V=l(e=>{const a=e.target.files?.[0];if(!a)return;const t=$(a);if(t)return T(t),E(null),void(S.current&&(S.current.value=""));T(null),E(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 T(t),void E(null);T(null),E(a),x?.(a)},[v,$,x]),W=l(e=>{e.preventDefault(),e.stopPropagation()},[]),H=l(()=>{w?.(),S.current?.click()},[w]),G=l(()=>{E(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]),J=(()=>{if(b)return b;if(!D)return f&&g&&!R?k("required_field"):null;switch(D.type){case"extension":return D.message||k("sign_file_not_allowed");case"forbidden-type":return k("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${Ax(s)}`;case"max-size":return`Tamanho máximo: ${Ax(d)}`;default:return k("file_error")}})();return t("div",{className:Zo("space-y-1",C),children:[a("div",{className:Zo("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(We,{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:Ax(L)}),t("div",{className:"flex items-center gap-0.5",children:[U&&N&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:I,onClick:K,children:a(ea,{className:"h-3.5 w-3.5 text-primary"})})}),a(Is,{children:"Download"})]}),O&&_&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Y,children:a(Se,{className:"h-3.5 w-3.5 text-primary"})})}),a(Is,{children:"Visualizar"})]}),p&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,children:a(me,{className:"h-3.5 w-3.5 text-primary"})})}),a(Is,{children:"Substituir"})]}),h&&t(Ds,{children:[a(Ts,{asChild:!0,children:a(ni,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:G,children:a(P,{className:"h-3 w-3 text-muted-foreground"})})}),a(Is,{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(ya,{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"})]})]})}),J&&a("p",{className:"text-xs text-destructive",children:J}),a("input",{ref:S,type:"file",className:"hidden",accept:n?.map(e=>`.${e}`).join(","),onChange:V,disabled:v})]})}var Dx=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(Dx||{}),Tx=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(Tx||{}),Ix=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Ix||{});function Mx(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function Rx(e,a){if(!a)return!0;const t=null!=Mx(e)&&""!==Mx(e)&&!(Array.isArray(Mx(e))&&0===Mx(e).length);return!1!==e.isActive||t}function zx(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))}function Lx(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 2:r.textValue=t.textValue;break;case 6:r.numberValue=t.numberValue;break;case 3:r.dateValue=t.dateValue;break;case 4:r.timeValue=t.timeValue;break;case 5:case 7:case 8:r.itemsValue=t.itemsValue||[];break;case 9:r.questionsValue=t.questionsValue||[]}return r}):e}function Fx(e){const a=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const t=Mx(e);if((null==t||""===t||Array.isArray(t)&&0===t.length)&&a.push(e.id),6===e.type&&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 Ux({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 Ox({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(li,{className:Zo(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(ss,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s,rows:4}):a(ii,{value:e.textValue||"",onChange:e=>l(e.target.value),placeholder:e.placeholder,disabled:s})]})}function jx({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(li,{className:Zo(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(ii,{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 Bx({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(li,{className:Zo(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(ii,{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 $x({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(li,{className:Zo(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(ii,{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(ni,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:a("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:a(fe,{className:"h-4 w-4"})})})]})]})}return t("div",{className:"space-y-1.5",children:[a(li,{className:Zo(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(ii,{type:"url",value:d,onChange:e=>c(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),a(ni,{variant:"outline",size:"icon",onClick:m,disabled:!d.trim(),className:"flex-shrink-0",children:a(J,{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(ni,{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(G,{className:"h-3 w-3"})})]},r.value))})]})}function Vx({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(li,{className:Zo(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(ii,{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 qx({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Tx.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(li,{className:Zo(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===Tx.dropdown&&t(Qi,{value:d,onValueChange:c,disabled:i,children:[a(Zi,{children:a(Xi,{placeholder:e.placeholder||"Selecione..."})}),a(ts,{children:l.map(e=>t(ns,{value:e.value,children:[e.text,!1===e.isActive&&a("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(s===Tx.radio||s===Tx.buttons)&&a(Lp,{value:d,onValueChange:c,disabled:i,className:Zo(s===Tx.buttons?"flex flex-wrap gap-2":"space-y-2"),children:l.map(r=>t("div",{className:"flex items-center gap-2",children:[a(Fp,{value:r.value,id:`${e.id}-${r.value}`}),t(li,{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 Wx({field:e,readOnly:r,onChange:n}){const o=e.config,i=r||e.readOnly,s=o?.viewMode??Tx.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(li,{className:Zo(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(ds,{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(P,{className:"h-3 w-3"})})]},r.value))}),!i&&a("div",{className:Zo(s===Tx.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(is,{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(li,{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 Hx({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(li,{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(li,{className:Zo(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:Zo(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(Lp,{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(Fp,{value:t.value,id:`${e.id}-${r.value}-${t.value}`})})},t.value);var o})]},r.value))})]})})]})}function Gx({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=>Rx(e,r));return 0===s.length?null:a("div",{className:"space-y-4",children:s.map(e=>a(Kx,{field:e,readOnly:t,onChange:i},e.id))})}function Kx({field:e,readOnly:t,onChange:r}){const n={field:e,readOnly:t,onChange:r};switch(e.type){case Dx.readOnlyText:return a(Ux,{...n});case Dx.text:return a(Ox,{...n});case Dx.date:return a(jx,{...n});case Dx.time:return a(Bx,{...n});case Dx.url:return a($x,{...n});case Dx.number:return a(Vx,{...n});case Dx.singleSelection:return a(qx,{...n});case Dx.multiSelection:return a(Wx,{...n});case Dx.questions:return a(Hx,{...n});default:return null}}function Yx({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(Ai,{open:r,onOpenChange:n,children:t(Mi,{className:"sm:max-w-[480px]",variant:"form",isDirty:x,children:[a(Ri,{children:a(Fi,{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(li,{children:"Etapa"}),t(Qi,{value:h??void 0,onValueChange:f,disabled:m,children:[a(Zi,{children:a(Xi,{placeholder:e.t("approval_select_step")})}),a(ts,{children:o.map(e=>a(ns,{value:e.id,children:e.name},e.id))})]})]}),t("div",{className:"space-y-1.5",children:[a(li,{children:e.t("approval_opinion")}),a(ss,{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(Li,{children:[a(ni,{variant:"ghost",onClick:()=>n(!1),children:"Cancelar"}),a(ni,{onClick:()=>{if(!g.trim())return void k.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 Qx({open:e,onOpenChange:r,approvers:n,isLoading:o=!1,ignoreUserIds:l=[],onSubmit:d}){const{t:c}=La(),[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(Ai,{open:e,onOpenChange:r,children:t(Mi,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!u,children:[a(Ri,{children:a(Fi,{children:c("approval_select_approver")})}),a(ms,{isLoading:o,type:"spinner",children:a("div",{className:"space-y-4",children:a(Ys,{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(Li,{children:[a(ni,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),a(ni,{onClick:()=>{if(!u)return;const e=p.find(e=>e.id===u);e&&d(e)},disabled:!u||o,children:"Concluir"})]})]})})}function Jx(e){const{t:a}=La();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Xx({text:e,maxLength:r=130}){const{t:n}=La(),[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 Zx({approver:e}){if(1===e.type&&e.approverId)return t(Vc,{className:"h-9 w-9 shrink-0",children:[a(qc,{src:e.photoUrl,alt:e.name}),a(Wc,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const r=2===e.type?aa:3===e.type?wa:be;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 ey({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(de,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Jx(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(Na,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),a("span",{className:"text-xs text-muted-foreground",children:Jx(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(B,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function ay({approver:e}){const{t:r}=La(),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(ey,{approver:e})]})}function ty({config:e,isLoading:r=!1,onClose:n,onApprove:o,onDefineApprover:s,onRefreshSteps:d,availableApprovers:c=[],isLoadingApprovers:u=!1}){const{t:m}=La(),[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]),E=l(e=>{C(e),N(!0)},[]),D=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(ni,{variant:"ghost",size:"icon",onClick:n,className:"shrink-0",children:a(P,{className:"h-5 w-5"})}),a("span",{className:"text-lg font-medium",children:e.title})]}),k?a(ms,{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:Zo("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:Zo("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(Xx,{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 ",Jx(r.returnDate)]})]}),r.returnObservation&&a("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:a(Xx,{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(Zx,{approver:e}),a(ay,{approver:e})]}),I(r,e)&&a(ni,{size:"sm",onClick:()=>S(e.id),children:"Aprovar"}),M(r,e)&&a(ni,{size:"sm",variant:"outline",onClick:()=>E(e.id),children:"Selecionar"})]}),e.observation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Xx,{text:e.observation})}),e.returnObservation&&a("p",{className:"text-sm text-muted-foreground break-words ml-11",children:a(Xx,{text:e.returnObservation})})]},e.id))]},r.id))]}),a(Yx,{open:f,onOpenChange:g,returnSteps:e.returnSteps,initialObservation:x,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:A}),a(Qx,{open:w,onOpenChange:N,approvers:c,isLoading:u,ignoreUserIds:T,onSubmit:D})]})}var ry=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(ry||{});function ny({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}=La(),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]),E=l(e=>{c?(_(e),w(!0)):n(r.filter(a=>a!==e))},[r,n,c]),D=l(()=>{N&&n(r.filter(e=>e!==N)),w(!1),_(null)},[N,r,n]);return t("div",{className:Zo("space-y-3",h),children:[a("div",{className:"flex items-start gap-3",children:a("div",{className:"flex-1",children:a(Ys,{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(Vc,{className:"h-8 w-8 shrink-0",children:[e.avatar&&a(qc,{src:e.avatar,alt:e.name}),a(Wc,{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(_a,{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(wa,{className:"h-3.5 w-3.5"}),a("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),a("button",{type:"button",className:Zo("text-muted-foreground hover:text-destructive transition-colors",o&&"opacity-50 pointer-events-none"),onClick:()=>!o&&E(e.id),title:f("remove"),children:a(P,{className:"h-4 w-4"})})]})]},e.id))}):t("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[a(be,{className:"h-12 w-12 mb-2 opacity-30"}),a("p",{className:"text-sm",children:v})]}),a(Ai,{open:y,onOpenChange:w,children:t(Mi,{className:"sm:max-w-[400px]",children:[a(Ri,{children:a(Fi,{children:g})}),a("p",{className:"text-sm text-muted-foreground",children:m}),t(Li,{children:[a(ni,{variant:"ghost",onClick:()=>w(!1),children:"Cancelar"}),a(ni,{variant:"destructive",onClick:D,children:"Remover"})]})]})})]})}export{ir as AUTH_CONFIG,lm as AccessDeniedDialog,ym as Accordion,_m as AccordionContent,wm as AccordionItem,Nm as AccordionTrigger,oi as ActionButton,oi as ActionMenu,$d as ActionMenuItems,Jf as AggregationType,Uc as Alert,jc as AlertDescription,gi as AlertDialog,ki as AlertDialogAction,Si as AlertDialogCancel,yi as AlertDialogContent,Ci as AlertDialogDescription,Ni as AlertDialogFooter,wi as AlertDialogHeader,xi as AlertDialogOverlay,bi as AlertDialogPortal,_i as AlertDialogTitle,vi as AlertDialogTrigger,Oc as AlertTitle,zc as AliasRedirect,Rc as AliasRouteGuard,Xf as AnalysisFunctionality,wb as AppHeader,Zb as AppLayout,Ib as AppSidebar,ry as ApprovalFlowReturnStep,ty as ApprovalSidenav,Yx as ApproveDialog,Ol as AuthErrorInterceptor,nd as AuthProvider,ed as AuthService,Ys as AutoComplete,Vc as Avatar,Wc as AvatarFallback,qc as AvatarImage,ds as Badge,bc as BaseForm,fp as Blockquote,tx as BodyContent,Cm as Breadcrumb,Dm as BreadcrumbEllipsis,Sm as BreadcrumbItem,Am as BreadcrumbLink,km as BreadcrumbList,Em as BreadcrumbPage,Pm as BreadcrumbSeparator,nv as BurndownPanel,ni as Button,Im as ButtonGroup,lr as CRUD_CONFIG,kg as CURRENCY_FIELDS,Mm as Calendar,Bc as CallbackPage,di as Card,pi as CardContent,mi as CardDescription,hi as CardFooter,ci as CardHeader,xd as CardSkeleton,ui as CardTitle,Zg as CartesianPanel,Yh as ChartContainer,Zh as ChartLegend,ef as ChartLegendContent,Qh as ChartStyle,Jh as ChartTooltip,Xh as ChartTooltipContent,is as Checkbox,Tu as Collapsible,Mu as CollapsibleContent,Iu as CollapsibleTrigger,dc as ColorPicker,rc as ColumnSettingsPopover,al as ComboTree,Ys as Combobox,Fs as Command,Us as CommandDialog,Bs as CommandEmpty,$s as CommandGroup,Os as CommandInput,qs as CommandItem,js as CommandList,Vs as CommandSeparator,Ws as CommandShortcut,ax as ContentContainer,Ad as ContextMenu,Fd as ContextMenuCheckboxItem,zd as ContextMenuContent,Pd as ContextMenuGroup,Ld as ContextMenuItem,Od as ContextMenuLabel,Dd as ContextMenuPortal,Id as ContextMenuRadioGroup,Ud as ContextMenuRadioItem,jd as ContextMenuSeparator,Bd as ContextMenuShortcut,Td as ContextMenuSub,Rd as ContextMenuSubContent,Md as ContextMenuSubTrigger,Ed as ContextMenuTrigger,vm as CoreProviders,Xd as CrudActionBar,rb as CrudActionMenu,ab as CrudGrid,Sc as CrudPageInternal,yc as CrudPagination,nb as CrudPrimitiveFilterBar,xc as CrudPrimitivePagination,tb as CrudPrimitiveTable,oc as CrudTable,Gx as CustomFormFields,Cg as DASHBOARD_STORAGE_KEYS,wo as DATETIME_FORMATS,Co as DEFAULT_DATETIME_FORMAT,_o as DEFAULT_LOCALE,ko as DEFAULT_TIMEZONE,Cv as DashboardForm,dg as DashboardFormTab,Zf as DashboardFunctionality,kv as DashboardGeneralView,uv as DashboardGrid,ug as DashboardLanguage,bv as DashboardList,eg as DashboardListType,ag as DashboardPageTime,tg as DashboardPanelDimension,ng as DashboardPanelOrderBy,rg as DashboardPanelOrderByType,og as DashboardPanelPeriod,pv as DashboardPanelRenderer,ig as DashboardPanelType,cg as DashboardShareType,sg as DashboardUpdateTime,hv as DashboardView,lg as DashboardViewType,nb as DataFilterBar,Rm as DataList,xc as DataPagination,tb as DataTable,zm as DatePicker,Ai as Dialog,zi as DialogBody,Di as DialogClose,Mi as DialogContent,Ui as DialogDescription,Li as DialogFooter,Ri as DialogHeader,Ti as DialogOverlay,Pi as DialogPortal,Fi as DialogTitle,Ei as DialogTrigger,bf as DialogWizard,Ms as DisabledMenuItem,Lm as Drawer,Om as DrawerClose,Bm as DrawerContent,Wm as DrawerDescription,Vm as DrawerFooter,$m as DrawerHeader,jm as DrawerOverlay,Um as DrawerPortal,qm as DrawerTitle,Fm as DrawerTrigger,hs as DropdownMenu,Cs as DropdownMenuCheckboxItem,Ns as DropdownMenuContent,gs as DropdownMenuGroup,_s as DropdownMenuItem,Ss as DropdownMenuLabel,vs as DropdownMenuPortal,xs as DropdownMenuRadioGroup,ks as DropdownMenuRadioItem,As as DropdownMenuSeparator,Es as DropdownMenuShortcut,bs as DropdownMenuSub,ws as DropdownMenuSubContent,ys as DropdownMenuSubTrigger,fs as DropdownMenuTrigger,Dx as ECustomFormFieldType,Tx as EFieldViewMode,Ix as ESelectionFieldDataSource,su as EditProfileDialog,gf as ElectronicSignatureDialog,kd as EllipsisText,lx as EmailService,Cd as EmptyState,Ys as EntitySelect,Lu as ErrorBoundary,hf as ExportDialog,uf as ExportFormat,Sx as FORBIDDEN_FILE_TYPES,Cf as FilePrintType,_f as FileViewerType,kc as FilterBar,Oi as Form,Hi as FormControl,jx as FormDateField,Gi as FormDescription,Bi as FormField,qi as FormItem,Wi as FormLabel,Ki as FormMessage,Wx as FormMultiSelectionField,Vx as FormNumericField,Hx as FormQuestionsField,qx as FormSingleSelectionField,yd as FormSkeleton,Ox as FormTextField,Bx as FormTimeField,$x as FormUrlField,Km as Grid,op as H1,ip as H2,sp as H3,lp as H4,wd as HeaderSkeleton,Ym as HoverCard,Jm as HoverCardContent,Qm as HoverCardTrigger,hc as IconPicker,Rf as IframeDialog,xx as ImageEditor,yx as ImageRenderer,hp as InlineCode,ii as Input,Xm as InputGroup,ep as InputGroupAddon,tp as InputGroupButton,rp as InputGroupInput,np as InputGroupTextarea,Sg as LINK_PROPERTIES,gr as LOGO_CONFIG,li as Label,ku as LanguageBootstrap,up as Large,cp as Lead,gp as List,Qg as ListPanel,ms as LoadingState,Pu as LocaleProvider,$c as LoginPage,vr as MESSAGES,am as MODULES_DATA,_g as MONTHS_MAP,iv as MatrixRiskPanel,mg as MatrixViewType,zh as Menubar,Bh as MenubarCheckboxItem,Oh as MenubarContent,Th as MenubarGroup,jh as MenubarItem,Vh as MenubarLabel,Dh as MenubarMenu,Ih as MenubarPortal,Rh as MenubarRadioGroup,$h as MenubarRadioItem,qh as MenubarSeparator,Wh as MenubarShortcut,Mh as MenubarSub,Uh as MenubarSubContent,Fh as MenubarSubTrigger,Lh as MenubarTrigger,eb as MindMap,Eb as ModalStateProvider,cm as ModuleAccessGuard,nm as ModuleGrid,um as ModuleOfferContent,xu as ModuleProvider,om as ModulesContent,sm as ModulesDialog,em as ModulesFooterCards,Ys as MultiSelect,Bf as MultiselectPermissions,pp as Muted,vp as NavigationMenu,Np as NavigationMenuContent,kp as NavigationMenuIndicator,xp as NavigationMenuItem,_p as NavigationMenuLink,bp as NavigationMenuList,wp as NavigationMenuTrigger,Cp as NavigationMenuViewport,fb as NavigationProvider,Kg as NumericPanel,df as OnboardingDialog,Mf as OnlineEditorDialog,dp as P,Sp as PageBreadcrumb,du as PageMetadataProvider,Ep as Pagination,Pp as PaginationContent,Rp as PaginationEllipsis,Dp as PaginationItem,Tp as PaginationLink,Mp as PaginationNext,Ip as PaginationPrevious,Ng as PaletteType,Vg as PanelError,$g as PanelHeader,pg as PanelItemsPerPanel,qg as PanelLoader,Wg as PanelNoData,hg as PanelSortType,fg as PanelState,Hg as PanelUnavailable,rv as ParetoPanel,ov as PerformancePanel,tv as PiePanel,vg as PlanType,Rs as Popover,Ls as PopoverContent,zs as PopoverTrigger,zp as Progress,Ic as ProtectedRoute,fr as QUALIEX_CONFIG,hr as QUERY_KEYS,Kl as QualiexEnrichmentService,Bl as QualiexErrorInterceptor,vc as QualiexUserField,bg as QueriesContextType,xg as QueriesShareType,yg as QuickFilterDashboard,Lp as RadioGroup,Fp as RadioGroupItem,Ux as ReadOnlyTextField,Hf as ReportRequestList,$f as ReportRequestStatus,jp as ResizableHandle,Op as ResizablePanel,Up as ResizablePanelGroup,nf as RichTextEditor,wg as RiskCriticality,dr as SEARCH_CONFIG,yo as SUPPORTED_LOCALES,cc as ScrollArea,uc as ScrollBar,Qi as Select,Qx as SelectApproverDialog,ts as SelectContent,Ji as SelectGroup,ns as SelectItem,rs as SelectLabel,as as SelectScrollDownButton,es as SelectScrollUpButton,Ys as SelectSearch,os as SelectSeparator,Zi as SelectTrigger,Xi as SelectValue,fi as Separator,Bp as Sheet,Yp as SheetBody,Vp as SheetClose,Gp as SheetContent,Xp as SheetDescription,Qp as SheetFooter,Kp as SheetHeader,Wp as SheetOverlay,qp as SheetPortal,Jp as SheetTitle,$p as SheetTrigger,rh as Sidebar,_b as SidebarActionTrigger,uh as SidebarContent,dh as SidebarFooter,mh as SidebarGroup,hh as SidebarGroupAction,fh as SidebarGroupContent,ph as SidebarGroupLabel,ex as SidebarHeader,sh as SidebarInput,ih as SidebarInset,yb as SidebarLogo,gh as SidebarMenu,yh as SidebarMenuAction,wh as SidebarMenuBadge,xh as SidebarMenuButton,vh as SidebarMenuItem,Nh as SidebarMenuSkeleton,_h as SidebarMenuSub,kh as SidebarMenuSubButton,Ch as SidebarMenuSubItem,th as SidebarProvider,oh as SidebarRail,ch as SidebarSeparator,Nd as SidebarSkeleton,nh as SidebarTrigger,Px as SingleFileUpload,Hs as Skeleton,Sh as Slider,mp as Small,ps as SonnerToaster,us as Spinner,cf as SplitButton,Cc as Stack,Yf as StatusBadge,vf as StepSelector,vf as Stepper,Gf as StimulsoftViewer,fc as Switch,No as TIMEZONES,Ph as TabPageContent,Eh as TabPageHeader,Ah as TabPageLayout,cd as Table,md as TableBody,vd as TableCaption,gd as TableCell,pd as TableFooter,fd as TableHead,ud as TableHeader,Sd as TableResizeHandle,hd as TableRow,Vd as TableRowActions,bd as TableSkeleton,Fu as Tabs,ju as TabsContent,Uu as TabsList,Ou as TabsTrigger,ny as TeamSelector,zf as TermsOfUseDialog,Lf as TermsOfUseViewer,Yg as TextPanel,ss as Textarea,ff as Timepicker,ps as Toaster,Kd as Toggle,Qd as ToggleGroup,Jd as ToggleGroupItem,Nl as TokenManager,pl as TokenService,Ds as Tooltip,Is as TooltipContent,Ps as TooltipProvider,Ts as TooltipTrigger,al as TreeSelect,db as TreeTable,kd as TruncatedCell,jb as UpdatesBar,Kb as UpdatesDialog,Nf as UpdatesNotification,Xb as UserUpdatesViewer,Uf as UsersGroupsSelector,vx as VideoEditor,bx as VideoRenderer,Tf as ViewerDialog,gg as VisualizationType,vu as addAppTranslations,Iv as addChild,Mv as addSibling,ux as aliasSchema,sr as appRedirectUrl,Dr as applyFavicon,Ar as assets,ls as badgeVariants,kr as brandLogos,Wo as buildModuleUrl,Ug as buildPlacesTree,Yc as buildQualiexHeaders,Df as buildWopiUrl,Tm as buttonGroupVariants,ri as buttonVariants,wx as calculateAspectRatio,Zo as cn,_r as configureBrandAssets,Zt as configureEnvironment,Ac as createCrudPage,ub as createCrudRoutingConfig,Av as createMindMapNode,cb as createRoutingHandlers,Jl as createService,Ec as createSimpleSaveHandler,sd as createSimpleService,Qf as createStatusConfig,br as createTranslatedMessages,Fg as currencyFormatter,ai as debounce,ql as deriveEmailField,Vl as deriveNameField,Wl as deriveUsernameField,Io as detectBrowserLocale,zo as detectBrowserPreferences,Mo as detectBrowserTimezone,Hb as detectVideoProvider,cx as emailSchema,dx as emailService,kl as errorService,Jv as exportMindMap,Cx as extractImageFileName,Lg as extractNumberFromCurrency,Vb as extractVimeoId,Bb as extractYouTubeId,Ao as findDatetimeFormat,So as findLocale,Ev as findNode,Eo as findTimezone,Ax as formatBytes,Oo as formatCurrency,Uo as formatDate,Fo as formatDatetime,kx as formatFileSize,Pc as generateCrudConfig,Ho as generateId,Sv as generateNodeId,Bo as generatePastelBg,Jt as getAppEnv,nr as getBackendMode,Hc as getCommonBaseUrl,Vo as getContrastRatio,lv as getDefaultPanelSize,er as getEnvironmentConfig,Mx as getFieldValue,Ex as getFileExtension,zx as getFormFieldValues,Gc as getIdentBaseUrl,Tg as getLinkFromRow,$o as getLuminance,dv as getMinPanelSize,Af as getOnlineViewerType,pr as getQualiexApiUrl,gm as getSecurityMode,Rl as getSupabaseClient,nu as getUserProfile,Sf as getViewerType,Pf as getWopiViewer,qo as handleExternalLink,Zv as importMindMap,Ro as inferDatetimeFormat,Zm as inputGroupAddonVariants,ap as inputGroupButtonVariants,zg as isCurrency,ar as isDevEnv,mr as isDevEnvironment,_x as isImageUrl,cr as isLovablePreview,Pg as isNullOrEmptyField,or as isSupabaseBackend,Tl as isSupabaseConfigured,Do as isValidDatetimeFormat,Po as isValidLocale,To as isValidTimezone,pm as loadForlogicFonts,Er as logoSrc,Lb as markUpdateVisualized,ix as mergeTranslationFiles,zv as moveNode,yp as navigationMenuTriggerStyle,Gb as normalizeVideoUrl,qb as normalizeVimeoUrl,$b as normalizeYouTubeUrl,fx as paginationSchema,Wb as parseIframeSrc,Dg as processUrl,$l as qualiexApi,Qc as qualiexFetch,Rv as removeNode,Nx as resizeKeepingAspect,Sr as resolveBrandLogo,Hl as resolveFieldMappings,bb as resolvePageTitle,hx as safeStringSchema,Jo as sanitizeErrorMessage,rr as setBackendMode,Fv as setCollapsedAll,Lx as setFormFieldValues,mu as setupQualiexCore,Rx as shouldShowField,ur as shouldUseDevTokens,ti as slugify,Pr as smallLogoSrc,Ag as sortByMonthYear,Xo as stripTechHeaders,Go as timestampId,Ig as toQueryString,Lv as toggleCollapsed,Gd as toggleVariants,Zu as trackFooterClick,Xu as trackInterestClick,Ju as trackModuleClick,ei as trimTextFields,au as updateUserProfile,Jc as uploadUserPhoto,rx as useActiveModules,Mc as useAliasFromUrl,od as useAuth,ic as useBaseForm,hm as useClarity,ac as useColumnManager,Hd as useColumnResize,id as useCrud,xb as useDebounce,im as useDerivedContractedModules,$i as useFormField,Db as useHasOpenModal,sx as useI18nFormatters,dd as useIsMobile,Du as useLocale,ld as useMediaQuery,gx as useMediaUpload,Pb as useModalState,_u as useModuleAccess,yu as useModuleConfig,gb as useNavigation,uu as usePageMetadata,cu as usePageMetadataContext,vb as usePageTitle,Nb as usePermissionQuery,Rb as useQualiexReady,gc as useQualiexUsers,Ap as useRouteBreadcrumbs,nx as useRowResize,ah as useSidebar,Sb as useSidebarResize,wf as useUpdatesNotification,Ub as useUserUpdatesBar,Ob as useUserUpdatesDialog,ox as useWizard,px as userIdSchema,mx as uuidSchema,Fx as validateFields};