adminizer 4.6.0 → 4.7.0-build.221

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 (335) hide show
  1. package/Readme.md +12 -0
  2. package/assets/RelationDialogStack-CnHFOYyR.css +1 -0
  3. package/assets/RelationDialogStack-DI2bZxQX.js +20 -0
  4. package/assets/add-4213XScp.js +1 -0
  5. package/assets/add-group--F1XxfJ1.js +1 -0
  6. package/assets/add-group-form-DKRXC2n-.js +1 -0
  7. package/assets/add-user-b9HfMq7z.js +1 -0
  8. package/assets/add-user-form-UXAToWQd.js +1 -0
  9. package/assets/app-Clx8f5hd.css +1 -0
  10. package/assets/app-layout-C02ja4OI.js +1 -0
  11. package/assets/app-shell-D8wtkECO.js +1 -0
  12. package/assets/app-sidebar-BR5_zwxj.js +1 -0
  13. package/assets/app-sidebar-header-BZbIBQjq.js +1 -0
  14. package/assets/app.js +59 -7990
  15. package/assets/breadcrumbs-CODaqVkB.js +1 -0
  16. package/assets/catalog-6ZZjWdFs.js +6 -0
  17. package/assets/dashboard-CftAdKiH.js +3 -0
  18. package/assets/date-picker-DSOkNiNo.js +1 -0
  19. package/assets/del-modal-Cd4M7af8.js +1 -0
  20. package/assets/dynamic-controls-BsrJhPDY.js +1 -0
  21. package/assets/geo-json-CzR5JBXL.js +1 -0
  22. package/assets/handsontable-BI98OF5R.js +336 -0
  23. package/assets/history-DLHSU7Ak.js +1 -0
  24. package/assets/home-NcQ7nnU0.js +2 -0
  25. package/assets/icon-C2JNaLxH.js +1 -0
  26. package/assets/init-user-D2HSyXup.js +1 -0
  27. package/assets/input-error-CH2caTtO.js +1 -0
  28. package/assets/jsoneditor-DVNQmA6G.js +3869 -0
  29. package/assets/list-CFU0-TgN.js +4 -0
  30. package/assets/login-DFSLEO17.js +1 -0
  31. package/assets/manifest.json +246 -273
  32. package/assets/material-icon-Bx9pGQiQ.js +1 -0
  33. package/assets/media-manager-WcKe1EvD.js +6 -0
  34. package/assets/module-CT7PC6pc.js +1 -0
  35. package/assets/monaco-Bl4zdWCn.js +11 -0
  36. package/assets/nav-footer-BiSQkPt4.js +1 -0
  37. package/assets/nav-main-rTH0PfDw.js +1 -0
  38. package/assets/nav-user-Bj6cWs0a.js +1 -0
  39. package/assets/notification-Bi-PX87D.js +20 -0
  40. package/assets/pagination-render-AKJvTIRA.js +1 -0
  41. package/assets/register-BTP4uxsK.js +1 -0
  42. package/assets/ru-eW0WKkga.js +1 -0
  43. package/assets/theme-switcher-Dm8EOGzx.js +1 -0
  44. package/assets/toast-editor-DOg_gvSp.js +668 -0
  45. package/assets/user-filters-list-YUfR4XMI.js +1 -0
  46. package/assets/user-info-BgSbT02v.js +1 -0
  47. package/assets/user-menu-content-TQTXHIv6.js +1 -0
  48. package/assets/{vanilla-picker-l5rcX3cq.js → vanilla-picker-B3LgXoKV.js} +1 -7
  49. package/assets/welcome-vLwTu1R6.js +1 -0
  50. package/controllers/add.d.ts +1 -1
  51. package/controllers/add.js +20 -26
  52. package/controllers/addGroup.d.ts +1 -1
  53. package/controllers/addGroup.js +7 -15
  54. package/controllers/addUser.d.ts +1 -1
  55. package/controllers/addUser.js +10 -16
  56. package/controllers/catalog/Catalog.d.ts +1 -1
  57. package/controllers/catalog/Catalog.js +1 -10
  58. package/controllers/catalog/FrontendCatalogAdapter.d.ts +3 -3
  59. package/controllers/catalog/FrontendCatalogAdapter.js +0 -6
  60. package/controllers/catalog/FrontentCatalogAdapter.d.ts +3 -3
  61. package/controllers/catalog/FrontentCatalogAdapter.js +0 -4
  62. package/controllers/ckeditorUpload.js +2 -18
  63. package/controllers/dashboard.d.ts +1 -1
  64. package/controllers/dashboard.js +2 -5
  65. package/controllers/edit.js +24 -37
  66. package/controllers/editGroup.d.ts +1 -1
  67. package/controllers/editGroup.js +10 -21
  68. package/controllers/editUser.d.ts +1 -1
  69. package/controllers/editUser.js +11 -23
  70. package/controllers/exportData.d.ts +6 -0
  71. package/controllers/exportData.js +315 -0
  72. package/controllers/feed.d.ts +6 -0
  73. package/controllers/feed.js +73 -0
  74. package/controllers/feedback/feedbackController.d.ts +1 -1
  75. package/controllers/feedback/feedbackController.js +5 -7
  76. package/controllers/filter-fields/columns.d.ts +11 -0
  77. package/controllers/filter-fields/columns.js +106 -0
  78. package/controllers/filter-fields/filterFields.d.ts +10 -0
  79. package/controllers/filter-fields/filterFields.js +141 -0
  80. package/controllers/filter-fields/getAllUserFilters.d.ts +6 -0
  81. package/controllers/filter-fields/getAllUserFilters.js +115 -0
  82. package/controllers/filter-fields/groups.d.ts +5 -0
  83. package/controllers/filter-fields/groups.js +26 -0
  84. package/controllers/filter-fields/savedFilters.d.ts +25 -0
  85. package/controllers/filter-fields/savedFilters.js +317 -0
  86. package/controllers/getAllWidgets.d.ts +1 -1
  87. package/controllers/getAllWidgets.js +1 -9
  88. package/controllers/history-actions/HistoryController.js +6 -31
  89. package/controllers/initUser.js +6 -5
  90. package/controllers/inlineUpdate.d.ts +7 -0
  91. package/controllers/inlineUpdate.js +148 -0
  92. package/controllers/list.d.ts +1 -1
  93. package/controllers/list.js +383 -70
  94. package/controllers/listUserFilters.d.ts +5 -0
  95. package/controllers/listUserFilters.js +26 -0
  96. package/controllers/login.js +2 -2
  97. package/controllers/media-manager/mediaManagerApi.js +0 -9
  98. package/controllers/navigation/edit.js +3 -9
  99. package/controllers/notifications/NotificationController.d.ts +1 -1
  100. package/controllers/notifications/NotificationController.js +12 -36
  101. package/controllers/register.js +10 -9
  102. package/controllers/remove.js +10 -19
  103. package/controllers/timezones.d.ts +1 -1
  104. package/controllers/timezones.js +0 -6
  105. package/controllers/userApiKey.d.ts +7 -0
  106. package/controllers/userApiKey.js +36 -0
  107. package/controllers/view.js +14 -26
  108. package/controllers/welcome.d.ts +1 -1
  109. package/controllers/welcome.js +0 -4
  110. package/controllers/widgets/Action.d.ts +1 -1
  111. package/controllers/widgets/Action.js +1 -9
  112. package/controllers/widgets/Custom.d.ts +1 -1
  113. package/controllers/widgets/Custom.js +1 -9
  114. package/controllers/widgets/Info.d.ts +1 -1
  115. package/controllers/widgets/Info.js +1 -9
  116. package/controllers/widgets/filterInfo.d.ts +1 -0
  117. package/controllers/widgets/filterInfo.js +44 -0
  118. package/controllers/widgets/switch.d.ts +1 -1
  119. package/controllers/widgets/switch.js +1 -9
  120. package/controllers/widgetsDB.d.ts +1 -1
  121. package/controllers/widgetsDB.js +2 -8
  122. package/helpers/accessRightsHelper.d.ts +1 -1
  123. package/helpers/accessRightsHelper.js +5 -4
  124. package/helpers/apiKeyHelper.d.ts +5 -0
  125. package/helpers/apiKeyHelper.js +8 -0
  126. package/helpers/configHelper.js +12 -15
  127. package/helpers/controllerHelper.d.ts +14 -21
  128. package/helpers/controllerHelper.js +50 -83
  129. package/helpers/fieldsHelper.js +3 -3
  130. package/helpers/filterDatetimeHelper.d.ts +5 -0
  131. package/helpers/filterDatetimeHelper.js +84 -0
  132. package/helpers/inertiaActionsHelper.d.ts +2 -2
  133. package/helpers/inertiaActionsHelper.js +5 -4
  134. package/helpers/inertiaAddHelper.d.ts +3 -414
  135. package/helpers/inertiaAddHelper.js +39 -15
  136. package/helpers/inertiaGroupHelper.d.ts +2 -2
  137. package/helpers/inertiaGroupHelper.js +3 -3
  138. package/helpers/inertiaListHelper.d.ts +7 -3
  139. package/helpers/inertiaListHelper.js +26 -12
  140. package/helpers/inertiaMenuHelper.d.ts +1 -0
  141. package/helpers/inertiaMenuHelper.js +15 -3
  142. package/helpers/inertiaUserHelper.d.ts +3 -2
  143. package/helpers/inertiaUserHelper.js +7 -3
  144. package/helpers/menuHelper.d.ts +5 -2
  145. package/helpers/menuHelper.js +64 -12
  146. package/helpers/viteHelper.js +1 -2
  147. package/index.d.ts +6 -2
  148. package/index.js +6 -2
  149. package/interfaces/adminpanelConfig.d.ts +126 -39
  150. package/interfaces/internalModelAccess.d.ts +37 -0
  151. package/interfaces/internalModelAccess.js +1 -0
  152. package/interfaces/listQueryBuilder.d.ts +22 -0
  153. package/interfaces/listQueryBuilder.js +1 -0
  154. package/interfaces/queryCriteria.d.ts +54 -0
  155. package/interfaces/queryCriteria.js +1 -0
  156. package/interfaces/types.d.ts +1 -13
  157. package/lib/Adminizer.d.ts +4 -2
  158. package/lib/Adminizer.js +29 -10
  159. package/lib/DataAccessor.d.ts +8 -5
  160. package/lib/DataAccessor.js +89 -42
  161. package/lib/I18n.d.ts +5 -1
  162. package/lib/I18n.js +45 -19
  163. package/lib/MiddlewareManager.d.ts +8 -0
  164. package/lib/MiddlewareManager.js +53 -0
  165. package/lib/ai-assistant/OpenAiModelService.d.ts +3 -3
  166. package/lib/ai-assistant/OpenAiModelService.js +23 -24
  167. package/lib/catalog/Navigation.d.ts +1 -0
  168. package/lib/catalog/Navigation.js +12 -11
  169. package/lib/controls/jsoneditor/JsonEditor.d.ts +1 -2
  170. package/lib/controls/markdown/ToastUiEditor.d.ts +1 -2
  171. package/lib/feedback/FeedbackHandler.js +2 -2
  172. package/lib/filters/ConditionValidator.d.ts +107 -0
  173. package/lib/filters/ConditionValidator.js +483 -0
  174. package/lib/filters/CustomFilterHandler.d.ts +122 -0
  175. package/lib/filters/CustomFilterHandler.js +131 -0
  176. package/lib/filters/FilterCustomFieldHandler.d.ts +2 -0
  177. package/lib/filters/FilterCustomFieldHandler.js +2 -0
  178. package/lib/filters/FilterService.d.ts +82 -0
  179. package/lib/filters/FilterService.js +323 -0
  180. package/lib/filters/index.d.ts +6 -0
  181. package/lib/filters/index.js +4 -0
  182. package/lib/history-actions/AbstractHistoryAdapter.d.ts +5 -4
  183. package/lib/history-actions/AbstractHistoryAdapter.js +45 -30
  184. package/lib/history-actions/DefaultHistoryAdapter.d.ts +2 -0
  185. package/lib/history-actions/DefaultHistoryAdapter.js +12 -6
  186. package/lib/history-actions/HistoryHandler.js +1 -1
  187. package/lib/list-query-builder/ListQueryBuilder.d.ts +117 -0
  188. package/lib/list-query-builder/ListQueryBuilder.js +707 -0
  189. package/lib/media-manager/AbstractMediaManager.d.ts +9 -8
  190. package/lib/media-manager/DefaultMediaManager.d.ts +2 -0
  191. package/lib/media-manager/DefaultMediaManager.js +27 -15
  192. package/lib/media-manager/Items.d.ts +4 -1
  193. package/lib/media-manager/Items.js +62 -59
  194. package/lib/media-manager/MediaManagerHandler.js +1 -1
  195. package/lib/media-manager/helpers/MediaManagerHelper.d.ts +5 -1
  196. package/lib/media-manager/helpers/MediaManagerHelper.js +38 -4
  197. package/lib/model/AbstractModel.d.ts +33 -25
  198. package/lib/model/AbstractModel.js +54 -2
  199. package/lib/model/InternalModelAccessFactory.d.ts +18 -0
  200. package/lib/model/InternalModelAccessFactory.js +82 -0
  201. package/lib/model/ModelHandler.d.ts +6 -0
  202. package/lib/model/ModelHandler.js +14 -0
  203. package/lib/model/adapter/sequelize.d.ts +32 -10
  204. package/lib/model/adapter/sequelize.js +409 -62
  205. package/lib/model/adapter/typeorm.d.ts +62 -0
  206. package/lib/model/adapter/typeorm.js +777 -0
  207. package/lib/model/internalModelAccessToken.d.ts +1 -0
  208. package/lib/model/internalModelAccessToken.js +1 -0
  209. package/lib/model/internalModelRepository.d.ts +3 -0
  210. package/lib/model/internalModelRepository.js +4 -0
  211. package/lib/notifications/AbstractNotificationService.d.ts +3 -0
  212. package/lib/notifications/AbstractNotificationService.js +42 -36
  213. package/lib/notifications/GeneralNotificationService.js +37 -40
  214. package/lib/notifications/SystemNotificationService.js +33 -36
  215. package/lib/requestProcessor.js +0 -3
  216. package/lib/ui-i18n/getUiTranslations.d.ts +1 -0
  217. package/lib/ui-i18n/getUiTranslations.js +3 -0
  218. package/lib/ui-i18n/uiTranslationKeys.d.ts +6 -0
  219. package/lib/ui-i18n/uiTranslationKeys.js +268 -0
  220. package/lib/widgets/widgetHandler.d.ts +7 -2
  221. package/lib/widgets/widgetHandler.js +98 -18
  222. package/models/FilterAP.d.ts +116 -0
  223. package/models/FilterAP.js +68 -0
  224. package/models/FilterColumnAP.d.ts +32 -0
  225. package/models/FilterColumnAP.js +21 -0
  226. package/models/GroupAP.d.ts +1 -1
  227. package/models/HistoryActionsAP.d.ts +3 -3
  228. package/models/MediaManagerMetaAP.d.ts +1 -1
  229. package/models/NavigationAP.d.ts +1 -1
  230. package/models/UserAP.d.ts +6 -1
  231. package/models/UserAP.js +4 -0
  232. package/package.json +39 -32
  233. package/policies/authPolicies.d.ts +12 -0
  234. package/policies/authPolicies.js +104 -0
  235. package/policies/permissionResolvers.d.ts +12 -0
  236. package/policies/permissionResolvers.js +52 -0
  237. package/services/FeedService.d.ts +70 -0
  238. package/services/FeedService.js +334 -0
  239. package/system/Router.d.ts +1 -0
  240. package/system/Router.js +136 -59
  241. package/system/bindAccessRights.js +11 -30
  242. package/system/bindAuthorization.js +18 -18
  243. package/system/bindCors.js +16 -1
  244. package/system/bindCustomFilterHandlers.d.ts +2 -0
  245. package/system/bindCustomFilterHandlers.js +4 -0
  246. package/system/bindInertia.js +18 -61
  247. package/system/bindReqFunctions.js +10 -2
  248. package/system/bindTranslations.js +7 -3
  249. package/system/buildInternalModelAccess.d.ts +4 -0
  250. package/system/buildInternalModelAccess.js +59 -0
  251. package/system/defaults.js +18 -14
  252. package/system/routePolicies.d.ts +2 -0
  253. package/system/routePolicies.js +29 -0
  254. package/translations/en.json +151 -39
  255. package/translations/ru.json +211 -64
  256. package/ui/components/handsontable.js +13 -27
  257. package/ui/components/ui/dialog-stack.js +1 -3
  258. package/ui/components/ui/popover.js +1 -1
  259. package/ui/components/ui/sidebar.js +1 -1
  260. package/assets/RelationDialogStack-D9UVEF9s.js +0 -407
  261. package/assets/RelationDialogStack-DV8OITPR.css +0 -4
  262. package/assets/add-BlvzWQKF.js +0 -1
  263. package/assets/add-group-1Uoq9NWe.js +0 -1
  264. package/assets/add-group-form-B01gwDGu.js +0 -1
  265. package/assets/add-user-BQCAsaRy.js +0 -1
  266. package/assets/add-user-form-Cgwc9JkI.js +0 -1
  267. package/assets/app-DaOMy1nl.css +0 -72
  268. package/assets/app-layout-CAm60qoE.js +0 -1
  269. package/assets/app-shell-QWCtn9ye.js +0 -1
  270. package/assets/app-sidebar-CfaYbnSy.js +0 -1
  271. package/assets/app-sidebar-header-BsPFDhZ8.js +0 -1
  272. package/assets/breadcrumbs-CZZirDj8.js +0 -1
  273. package/assets/catalog-k5myk7fk.js +0 -6
  274. package/assets/dashboard-BkL9ybBw.js +0 -3
  275. package/assets/date-picker-B5AZ_7Q9.js +0 -1
  276. package/assets/del-modal-BoyXZloG.js +0 -1
  277. package/assets/dynamic-controls-k61T9W2P.js +0 -1
  278. package/assets/form-1WGY0YgG.js +0 -1
  279. package/assets/form-DJapG3qF.js +0 -1
  280. package/assets/geo-json-DsMUHo0l.js +0 -4
  281. package/assets/handsontable-PxYdjN8c.js +0 -298
  282. package/assets/history-CluyR-yJ.js +0 -1
  283. package/assets/home-Dug9zBzM.js +0 -2
  284. package/assets/icon-DfDLMG5f.js +0 -1
  285. package/assets/init-user-CF80MEnT.js +0 -1
  286. package/assets/input-error-DuuqFgZa.js +0 -1
  287. package/assets/jsoneditor-De1FvcYu.js +0 -3882
  288. package/assets/list-CuexshNt.js +0 -1
  289. package/assets/list-table-BsEWjTKY.js +0 -22
  290. package/assets/login-eDemYzN-.js +0 -1
  291. package/assets/material-icon-DMT8KdmE.js +0 -1
  292. package/assets/media-manager-DfYa_mT_.js +0 -14
  293. package/assets/module-Cd4Tm6uq.js +0 -1
  294. package/assets/monaco-BhBYtg3d.js +0 -11
  295. package/assets/nav-footer-D3olYxtz.js +0 -1
  296. package/assets/nav-main-BctqyzeV.js +0 -1
  297. package/assets/nav-user-Bn1Lt-BZ.js +0 -1
  298. package/assets/notification-D64qvni-.js +0 -27
  299. package/assets/pagination-render-DxD78ahJ.js +0 -1
  300. package/assets/register-349PwYbe.js +0 -1
  301. package/assets/theme-switcher-DfExsHW2.js +0 -1
  302. package/assets/toast-editor-ESK5iWPx.js +0 -845
  303. package/assets/user-info-DtBK5Kh8.js +0 -1
  304. package/assets/user-menu-content-0XYOCMaA.js +0 -1
  305. package/assets/welcome-PDp-gUei.js +0 -1
  306. package/controllers/form.d.ts +0 -1
  307. package/controllers/form.js +0 -86
  308. package/helpers/formHelper.d.ts +0 -6
  309. package/helpers/formHelper.js +0 -38
  310. package/helpers/inertiaFromHelper.d.ts +0 -11
  311. package/helpers/inertiaFromHelper.js +0 -98
  312. package/helpers/runtimeMode.d.ts +0 -1
  313. package/helpers/runtimeMode.js +0 -3
  314. package/lib/PolicyManager.d.ts +0 -8
  315. package/lib/PolicyManager.js +0 -53
  316. package/lib/datatable/NodeTable.d.ts +0 -49
  317. package/lib/datatable/NodeTable.js +0 -207
  318. package/lib/model/adapter/waterline.d.ts +0 -32
  319. package/lib/model/adapter/waterline.js +0 -180
  320. package/migrations/index.d.ts +0 -3
  321. package/migrations/index.js +0 -4
  322. package/migrations/knex/20250106000001_adminizer_init.d.ts +0 -8
  323. package/migrations/knex/20250106000001_adminizer_init.js +0 -164
  324. package/migrations/umzug/0001.d.ts +0 -7
  325. package/migrations/umzug/0001.js +0 -121
  326. package/migrations/umzugExports.d.ts +0 -2
  327. package/migrations/umzugExports.js +0 -9
  328. package/system/bindForms.d.ts +0 -2
  329. package/system/bindForms.js +0 -20
  330. /package/{policies → middlewares}/addMessages.d.ts +0 -0
  331. /package/{policies → middlewares}/addMessages.js +0 -0
  332. /package/{policies → middlewares}/checkAuth.d.ts +0 -0
  333. /package/{policies → middlewares}/checkAuth.js +0 -0
  334. /package/{policies → middlewares}/setLocale.d.ts +0 -0
  335. /package/{policies → middlewares}/setLocale.js +0 -0
@@ -1 +0,0 @@
1
- import{u as E,j as e,ah as I,ar as P,as as L,B as y,at as R,S as z,c as C,d as D,e as M,f as T,au as w,av as k,L as O}from"./app.js";import B from"./app-shell-QWCtn9ye.js";import{AppSidebar as K}from"./app-sidebar-CfaYbnSy.js";import{A as V,a as N,N as _,b as F}from"./app-sidebar-header-BsPFDhZ8.js";import{r as l}from"./handsontable-PxYdjN8c.js";import{R as H}from"./RelationDialogStack-D9UVEF9s.js";const $=l.memo(({children:o,breadcrumbs:a=[],className:i})=>{const n=E();return e.jsxs(B,{variant:"sidebar",children:[e.jsx(I,{title:n.props.title}),e.jsx(K,{}),e.jsxs(P,{className:i,children:[e.jsx(V,{breadcrumbs:a}),e.jsx("div",{className:"relative flex-1 overflow-hidden",children:e.jsx("div",{className:"h-full",children:o})})]})]})});function q({width:o="min(25vw, 420px)"}){const{isEnabled:a,isOpen:i,closeChat:n,models:s,activeModel:r,setActiveModel:d,messages:c,loading:m,sending:x,error:g,sendMessage:v}=N(),[f,h]=l.useState(""),j=l.useRef(null);l.useEffect(()=>{i||h("")},[i]),l.useEffect(()=>{j.current&&j.current.scrollIntoView({behavior:"smooth"})},[c]);const u=s.length>0,A=async t=>{t.preventDefault();const p=f.trim();p&&(await v(p),h(""))},S=t=>{if((t.ctrlKey||t.metaKey)&&t.key==="Enter"){t.preventDefault();const p=f.trim();p&&!x&&(v(p),h(""))}};return a?e.jsxs("aside",{id:"ai-assistant-panel","aria-label":"AI assistant chat","aria-hidden":!i,className:w("bg-card text-card-foreground fixed bottom-0 right-0 top-0 z-[60] flex h-full flex-col border-l shadow-xl transition-all duration-300 ease-in-out","md:w-auto w-full",i?"translate-x-0 opacity-100":"translate-x-full opacity-0 pointer-events-none"),style:{width:"var(--ai-assistant-panel-actual-width, "+o+")"},children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"size-5 text-primary"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold leading-tight",children:"AI assistant"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Chat with your selected model."})]})]}),e.jsx(y,{variant:"ghost",size:"icon",onClick:n,"aria-label":"Close AI assistant",children:e.jsx(R,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-hidden px-4 py-4",children:[!u&&!m&&e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-md border border-dashed p-6 text-sm text-muted-foreground",children:"No AI models are available for your account."}),u&&e.jsxs(e.Fragment,{children:[e.jsxs(z,{value:r,onValueChange:d,children:[e.jsx(C,{className:"w-full",children:e.jsx(D,{placeholder:"Select a model"})}),e.jsx(M,{className:"z-[70]",children:s.map(t=>e.jsx(T,{value:t.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:t.name}),t.description&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.id))})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-hidden rounded-md border bg-background p-4",children:[e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto pr-2","data-ai-assistant-messages":!0,children:[m&&e.jsx("div",{className:"flex justify-center py-6 text-sm text-muted-foreground",children:"Loading conversation..."}),!m&&c.length===0&&e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Start a conversation to see responses here."}),c.map(t=>e.jsxs("div",{className:w("flex flex-col gap-1 rounded-md border p-3 text-sm shadow-xs",t.role==="assistant"?"border-primary/30 bg-primary/5":"border-border bg-background"),children:[e.jsx("span",{className:"font-semibold",children:t.role==="assistant"?"Assistant":"You"}),e.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:t.content}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.timestamp).toLocaleTimeString()})]},t.id)),e.jsx("div",{ref:j})]}),e.jsxs("form",{className:"space-y-2",onSubmit:A,children:[e.jsx(k,{placeholder:u?"Type your question... (Ctrl+Enter to send)":"No models available",value:f,onChange:t=>h(t.target.value),onKeyDown:S,disabled:!u||x,rows:3}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g&&e.jsx("span",{className:"text-xs text-destructive",children:g}),e.jsx(y,{type:"submit",disabled:!u||x||!f.trim(),children:x?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"size-4 animate-spin"}),"Sending…"]}):"Send"})]})]})]})]})]})]}):null}const G="min(25vw, 420px)",b="margin-right 300ms ease-in-out";function U({children:o,panelWidth:a=G}){const{isEnabled:i,isOpen:n}=N();return l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const r=s.style.transition,d=r==null?void 0:r.includes("margin-right");return d||(s.style.transition=r?`${r}, ${b}`:b),s.classList.add("ai-assistant-host"),s.style.setProperty("--ai-assistant-panel-width",a),()=>{s.classList.remove("ai-assistant-host"),s.style.removeProperty("--ai-assistant-panel-width"),s.style.removeProperty("--ai-assistant-panel-actual-width"),s.style.removeProperty("margin-right"),delete s.dataset.aiAssistantOpen,d||(s.style.transition=r)}},[a]),l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const r=window.innerWidth<768,d=r?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",d),i&&n?(s.style.marginRight=r?"0":a,s.dataset.aiAssistantOpen="true"):(s.style.removeProperty("margin-right"),s.dataset.aiAssistantOpen="false");const c=()=>{const m=window.innerWidth<768,x=m?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",x),i&&n&&(s.style.marginRight=m?"0":a)};return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[i,n,a]),e.jsxs(e.Fragment,{children:[o,e.jsx(q,{width:a})]})}const ee=l.memo(({children:o,className:a,breadcrumbs:i,...n})=>e.jsx(_,{children:e.jsx(F,{children:e.jsxs(H,{children:[e.jsx($,{breadcrumbs:i,className:a,...n,children:o}),e.jsx(U,{})]})})}));export{ee as A};
@@ -1 +0,0 @@
1
- import{j as a,aP as d}from"./app.js";import{r as o}from"./handsontable-PxYdjN8c.js";import"./jsoneditor-De1FvcYu.js";import"./monaco-BhBYtg3d.js";const u=o.memo(({children:e,variant:s="header"})=>{const[t,n]=o.useState(()=>typeof window<"u"?localStorage.getItem("sidebar")!=="false":!0),i=r=>{n(r),typeof window<"u"&&localStorage.setItem("sidebar",String(r))};return s==="header"?a.jsx("div",{className:"flex min-h-screen w-full flex-col",children:e}):a.jsx(d,{defaultOpen:t,open:t,onOpenChange:i,children:e})});export{u as default};
@@ -1 +0,0 @@
1
- import{u as R,j as e,D as V,U as G,aX as Y,i as J,k as Q,l as W,aY as I,aZ as ee,V as se,b as M,I as ae,av as re,B as D,a_ as te,at as le,a$ as ne,L as ie,h as ce,b0 as de,b1 as oe,b2 as F,b3 as S,b4 as xe,b5 as pe,b6 as he,b7 as w,b8 as me,b9 as ue,ba as je,bb as be,bc as fe,bd as z,ai as v,be as ge,bf as E,bg as L,C as P,bh as B,bi as O,bj as $,bk as A,bl as Ne,bm as ve}from"./app.js";import{NavMain as ke}from"./nav-main-BctqyzeV.js";import{r as i,a as ye}from"./handsontable-PxYdjN8c.js";import d from"./material-icon-DMT8KdmE.js";import"./jsoneditor-De1FvcYu.js";import"./monaco-BhBYtg3d.js";const Ce=5*1024*1024,X=i.memo(({routePrefix:t,triggerLabel:s,placeholder:a,ui:x,onClose:p})=>{const l=r=>x[r]??r,[m,k]=i.useState(""),[g,y]=i.useState(""),[j,b]=i.useState([]),[o,N]=i.useState({}),[h,_]=i.useState(!1),[C,Z]=i.useState(!1),T=i.useRef(null),q=r=>{if(!r)return;const n={},u=[];Array.from(r).forEach(c=>{c.size>Ce?n[c.name]=l("File size exceeds the 5 MB limit"):u.push(c)}),b(c=>[...c,...u]),Object.keys(n).length&&N(c=>({...c,...n}))},H=r=>b(n=>n.filter((u,c)=>c!==r)),K=async r=>{var u,c;if(r.preventDefault(),!m.trim()){N({title:l("Title is required")});return}_(!0),N({});const n=new FormData;n.append("title",m.trim()),n.append("description",g.trim()),j.forEach(f=>n.append("files",f));try{await ce.post(`${t}/api/feedback`,n),Z(!0)}catch(f){const U=((c=(u=f==null?void 0:f.response)==null?void 0:u.data)==null?void 0:c.error)??l("Internal server error");N({_global:U}),_(!1)}};return i.useEffect(()=>{if(!C)return;const r=setTimeout(p,2e3);return()=>clearTimeout(r)},[C,p]),C?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-24 text-center",children:[e.jsx(I,{size:48,className:"text-green-500 dark:text-green-400"}),e.jsx("p",{className:"text-base font-medium",children:l("Feedback sent successfully")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ee,{className:"mb-4",children:[e.jsx(se,{children:s??l("Feedback")}),a&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a})]}),e.jsxs("form",{onSubmit:K,className:"space-y-5",noValidate:!0,children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{htmlFor:"fb-title",children:l("Title")}),e.jsx(ae,{id:"fb-title",value:m,onChange:r=>k(r.target.value),disabled:h,placeholder:l("Title"),className:o.title?"border-destructive":""}),o.title&&e.jsx("p",{className:"text-xs text-destructive",children:o.title})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{htmlFor:"fb-desc",children:l("Description")}),e.jsx(re,{id:"fb-desc",value:g,onChange:r=>y(r.target.value),disabled:h,placeholder:l("Description"),rows:5,className:"resize-none"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{children:l("Attach files")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:()=>{var r;return(r=T.current)==null?void 0:r.click()},disabled:h,children:[e.jsx(te,{size:14,className:"mr-1"}),l("Attach files")]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:l("Max 5 MB per file")})]}),e.jsx("input",{ref:T,type:"file",multiple:!0,className:"hidden",onChange:r=>q(r.target.files),disabled:h}),j.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:j.map((r,n)=>e.jsxs("li",{className:"flex items-center justify-between rounded-md border bg-muted/40 px-3 py-1.5 text-xs",children:[e.jsx("span",{className:"truncate max-w-[340px]",children:r.name}),e.jsx("button",{type:"button",onClick:()=>H(n),className:"ml-2 text-muted-foreground hover:text-destructive transition-colors","aria-label":l("Remove file"),disabled:h,children:e.jsx(le,{size:13})})]},n))}),Object.entries(o).filter(([r])=>r!=="title"&&r!=="_global").map(([r,n])=>e.jsx("p",{className:"text-xs text-destructive",children:n},r))]}),o._global&&e.jsx("p",{className:"text-xs text-destructive",children:o._global}),e.jsx(ne,{children:e.jsx(D,{type:"submit",disabled:h,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ie,{size:14,className:"mr-1.5 animate-spin"}),l("Sending...")]}):l("Send")})})]})]})});X.displayName="FeedbackForm";function Me(){const t=R(),s=t.props.uiMessages??{},a=t.props.routePrefix??window.routePrefix??"",x=t.props.feedbackTriggerLabel??null,p=t.props.feedbackPlaceholder??null,[l,m]=i.useState(!1),[k,g]=i.useState(0),y=i.useCallback(()=>m(!1),[]),j=i.useCallback(b=>{m(b),b||g(o=>o+1)},[]);return e.jsxs(V,{open:l,onOpenChange:j,children:[e.jsx(G,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1.5 text-xs opacity-60 hover:opacity-100 transition-opacity cursor-pointer mt-1 mx-auto","aria-label":x??s["Send feedback"]??"Send feedback",children:[e.jsx(Y,{size:13}),x??s["Send feedback"]??"Send feedback"]})}),ye.createPortal(e.jsx(J,{}),document.body),e.jsx(Q,{children:e.jsx(W,{children:e.jsx(X,{routePrefix:a,triggerLabel:x,placeholder:p,ui:s,onClose:y},k)})})]})}function ze(){const t=R();return e.jsxs(de,{collapsible:"icon",variant:"inset",children:[e.jsx(oe,{children:e.jsx(F,{children:e.jsxs(S,{children:[e.jsx(xe,{className:"p-0 shadow-none border-none bg-transparent hidden md:block",children:e.jsxs(pe,{children:[e.jsx(he,{asChild:!0,className:"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground rounded-md",children:e.jsx(w,{asChild:!0,children:e.jsx(D,{variant:"ghost",asChild:!0,className:`w-full ${t.props.section?"":"pointer-events-none"}`,children:e.jsxs("div",{children:[e.jsx(d,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"group-data-[state=collapsed]:hidden",children:t.props.brand}),t.props.section&&e.jsx(me,{className:"ml-auto group-data-[state=collapsed]:hidden"})]})})})}),t.props.section&&e.jsx(ue,{side:"right",className:"z-[1003]",children:t.props.section.map(s=>e.jsx("div",{children:s.subItems?e.jsxs(je,{children:[e.jsxs(be,{className:"flex gap-2 items-center cursor-pointer",children:[e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}),e.jsx(fe,{children:s.subItems.map(a=>e.jsx(z,{children:a.type==="blank"?e.jsxs("a",{href:a.link,target:"_blank",className:"flex gap-2 items-center",children:[a.icon&&e.jsx(d,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]},a.id):e.jsxs(v,{href:a.link,className:"flex gap-2 items-center",children:[a.icon&&e.jsx(d,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]},a.id)},a.id))})]}):e.jsx(z,{children:s.type==="blank"?e.jsxs("a",{href:s.link,target:"_blank",className:"flex gap-2 items-center",children:[s.icon&&e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(v,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})]})}),e.jsx(ge,{className:"px-2 py-0 block md:hidden",children:e.jsx(F,{children:e.jsx(E,{asChild:!0,className:"group/collapsible",children:e.jsxs(S,{children:[e.jsx(L,{asChild:!0,children:e.jsxs(w,{children:[e.jsx(d,{name:"rocket_launch",className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:t.props.brand}),t.props.section&&e.jsx(P,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]})}),t.props.section&&e.jsx(B,{children:e.jsx(O,{children:t.props.section&&t.props.section.map(s=>s.subItems?e.jsx(F,{children:e.jsx(E,{asChild:!0,className:"group/collapsible-sub",children:e.jsxs(S,{children:[e.jsx(L,{asChild:!0,children:e.jsxs(w,{children:[e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.title}),e.jsx(P,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible-sub:rotate-90"})]})}),e.jsx(B,{children:e.jsx(O,{children:s.subItems.map(a=>e.jsx($,{children:e.jsx(A,{asChild:!0,children:a.type==="blank"?e.jsxs("a",{href:a.link,target:"_blank",className:"flex gap-2 items-center",children:[a.icon&&e.jsx(d,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]}):e.jsxs(v,{href:a.link,className:"flex gap-2 items-center",children:[a.icon&&e.jsx(d,{name:a.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:a.title})]})})},a.id))})})]})})},s.id):e.jsx($,{children:e.jsx(A,{asChild:!0,children:s.type==="blank"?e.jsxs("a",{href:s.link,target:"_blank",className:"flex gap-2 items-center",children:[s.icon&&e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]}):e.jsxs(v,{href:s.link,className:"flex gap-2 items-center",children:[s.icon&&e.jsx(d,{name:s.icon,className:"!text-[18px]"}),e.jsx("span",{className:"hover:underline",children:s.title})]})})},s.id))})})]})})})})]},t.props.brand)})}),e.jsx(Ne,{children:e.jsx(ke,{items:t.props.menu})}),e.jsx(ve,{children:e.jsxs("div",{className:"flex flex-col items-center",children:[t.props.version&&(()=>{const s=t.props.version,a=s.text||"4.6.0",x=new Date("2026-05-22T02:42:31.050Z").toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),p=s.text?`v.${a}`:`v.${a} · ${x}`,l="text-center opacity-70 hover:opacity-100 transition-opacity text-xs";return s.link?e.jsx("a",{href:s.link,target:"_blank",rel:"noreferrer",title:s.hint??void 0,className:l,children:p}):e.jsx("span",{title:s.hint??void 0,className:l,children:p})})(),t.props.showFeedback&&e.jsx(Me,{})]})})]})}export{ze as AppSidebar};
@@ -1 +0,0 @@
1
- import{h as O,aQ as G,u as z,j as e,aR as Y,s as K,B as k,aS as X,w as Z,x as ee,aT as te,N as R,O as B,E as se,Q as F,r as ae,aU as re,ai as U,L as D,as as oe,au as ne,aV as ie,aW as ce}from"./app.js";import{Breadcrumbs as le}from"./breadcrumbs-CZZirDj8.js";import{NavUser as de}from"./nav-user-Bn1Lt-BZ.js";import{ThemeSwitcher as ue}from"./theme-switcher-DfExsHW2.js";import{r as n}from"./handsontable-PxYdjN8c.js";import fe from"./material-icon-DMT8KdmE.js";const pe={"Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"},H=s=>{if(typeof s!="string")return!1;const c=s.trim().toLowerCase();return c.startsWith("<!doctype html")||c.startsWith("<html")||c.startsWith("<")},he=s=>({...s??{},_ts:Date.now()}),_=async(s,c,a,u)=>{var x,m,S,l;const f={...u,headers:{...pe,...(u==null?void 0:u.headers)??{}},params:he(u==null?void 0:u.params)};try{let o;s==="get"?o=await O.get(c,f):s==="post"?o=await O.post(c,a,f):s==="put"?o=await O.put(c,a,f):o=await O.delete(c,{...f,data:a});const p=String(((x=o.headers)==null?void 0:x["content-type"])??"").toLowerCase();if(p&&!p.includes("application/json")||H(o.data))throw new Error(`Expected JSON response from "${c}", but received "${p||"unknown"}". This usually means the session expired and server returned an HTML login page.`);return o}catch(o){if(o instanceof G){const p=String(((S=(m=o.response)==null?void 0:m.headers)==null?void 0:S["content-type"])??"").toLowerCase();if(H((l=o.response)==null?void 0:l.data)||p.includes("text/html"))throw new Error("Server returned HTML instead of JSON. Most likely auth session expired. Please reload the page and log in again.")}throw o}},y={getJson:(s,c)=>_("get",s,void 0,c),postJson:(s,c,a)=>_("post",s,c,a),putJson:(s,c,a)=>_("put",s,c,a),deleteJson:(s,c,a)=>_("delete",s,c,a)},W=n.createContext(void 0),Ae=({children:s})=>{const[c,a]=n.useState([]),[u,f]=n.useState([]),[x,m]=n.useState([]),[S,l]=n.useState(!1),[o,p]=n.useState(null),[j,A]=n.useState(""),v=z(),[g,C]=n.useState({}),M=[...u,...x],w=async()=>{try{const t=await y.getJson(`${window.routePrefix}/notifications/api`,{params:{unreadOnly:!0,limit:4}});a(t.data)}catch(t){console.error("Error fetching bell notifications:",t)}},d=async()=>{try{const t=await y.postJson(`${window.routePrefix}/notifications`);C(t.data)}catch(t){console.log(t)}},E=async()=>{await w()},b=async()=>{try{const t=await y.getJson(`${window.routePrefix}/notifications/api/get-classes`);t.data&&(p(t.data.activeServices),A(t.data.initTab))}catch(t){console.error("Error fetching tabs:",t)}},$=async(t,r)=>{try{if(!t){await P(r);return}const i=await y.postJson(`${window.routePrefix}/notifications/api/search`,{s:t,notificationClass:r});m(i.data)}catch(i){console.error("Error searching notifications:",i)}},P=async t=>{l(!0);try{const r=`${window.routePrefix}/notifications/api/${t}`,i=await y.getJson(r,{params:{limit:20,skip:0,unreadOnly:!1}});return f([]),m(i.data),i.data}catch(r){return console.error("Error fetching all notifications:",r),[]}finally{l(!1)}},T=async(t,r)=>{try{const i=`${window.routePrefix}/notifications/api/${t}`,h=await y.getJson(i,{params:{limit:20,skip:r,unreadOnly:!1}});return m(N=>[...N,...h.data]),h.data}catch(i){return console.error("Error paginating notifications:",i),[]}};n.useEffect(()=>{if(!v.props.notifications)return;d(),w();const t=new EventSource(`${window.routePrefix}/notifications/api/stream`);return t.addEventListener("connected",r=>{const i=JSON.parse(r.data);console.log("Connected event:",i),b()}),t.addEventListener("notification",r=>{const i=JSON.parse(r.data);f(h=>[i,...h]),a(h=>[i,...h].slice(0,4))}),t.onerror=()=>{console.error("SSE connection error")},()=>t.close()},[]);const I=async(t,r)=>{try{await y.putJson(`${window.routePrefix}/notifications/api/${t}/${r}/read`,{}),f(i=>i.map(h=>h.id===r?{...h,read:!0}:h)),m(i=>i.map(h=>h.id===r?{...h,read:!0}:h)),a([])}catch(i){console.error("Error marking as read:",i)}},J=async()=>{try{await y.putJson(`${window.routePrefix}/notifications/api/read-all`,{}),f(t=>t.map(r=>({...r,read:!0}))),m(t=>t.map(r=>({...r,read:!0}))),await w()}catch(t){console.error("Error marking all as read:",t)}},L=c.filter(t=>!t.read).length;return e.jsx(W.Provider,{value:{bellNotifications:c,allNotifications:M,unreadCount:L,getTabs:b,tabs:o,initTab:j,search:$,markAsRead:I,markAllAsRead:J,getLocale:d,messages:g,fetchAllNotifications:P,paginateNotifications:T,loading:S,refreshBellNotifications:E},children:s})},q=()=>{const s=n.useContext(W);if(s===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return s};function me(){const{bellNotifications:s,markAsRead:c,unreadCount:a,refreshBellNotifications:u,messages:f}=q(),[x,m]=n.useState(!1),S=async(o,p)=>{m(!0);try{await c(o,p),await u()}catch(j){console.error("Error marking as read:",j)}finally{m(!1)}},l=o=>{const p=new Date,j=new Date(o),A=p.getTime()-j.getTime(),v=Math.floor(A/1e3),g=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(v<60)return g.format(-v,"second");const C=Math.floor(v/60);if(C<60)return g.format(-C,"minute");const M=Math.floor(C/60);if(M<24)return g.format(-M,"hour");const w=Math.floor(M/24);if(w<30)return g.format(-w,"day");const d=Math.floor(w/30);if(d<12)return g.format(-d,"month");const E=Math.floor(d/12);return g.format(-E,"year")};return e.jsxs(Y,{children:[e.jsx(K,{asChild:!0,className:"cursor-pointer data-[state=open]:bg-sidebar-accent",children:e.jsxs(k,{variant:"ghost",className:"relative",children:[e.jsx(X,{}),a>0&&e.jsx("div",{className:"absolute top-1.5 right-1.5 size-1.5 rounded-full bg-destructive"})]})}),e.jsxs(Z,{className:"z-[1002] p-2",align:"end",onCloseAutoFocus:o=>o.preventDefault(),children:[e.jsx(ee,{className:`${x?"opacity-50 pointer-events-none":""}`,children:s.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"No notifications"}):s.map(o=>e.jsxs("div",{children:[e.jsx(te,{asChild:!0,className:"cursor-pointer",onSelect:p=>{p.preventDefault(),ae.visit(`${window.routePrefix}/notifications?type=${o.notificationClass}`)},children:e.jsxs("div",{className:"grid grid-cols-[32px_250px] grid-rows-[auto_1fr] items-start gap-x-4 gap-y-2",children:[o.icon?e.jsx(fe,{name:o.icon.icon,style:{color:o.icon.iconColor},className:"!text-[32px]"}):e.jsx("div",{}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:o.title}),e.jsx("span",{className:"truncate",children:o.message})]}),e.jsxs("div",{className:"col-start-2 flex justify-between flex-nowrap items-center",children:[e.jsx("div",{className:"flex flex-nowrap gap-2 items-center",children:e.jsx("div",{children:l(o.createdAt)})}),e.jsxs(R,{children:[e.jsx(B,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"icon",className:"size-4",onClick:p=>{p.stopPropagation(),S(o.notificationClass,o.id)},children:e.jsx(se,{className:"text-primary"})})}),e.jsx(F,{side:"left",className:"z-[1003]",children:e.jsx("p",{children:f["Make read"]})})]})]})]})}),e.jsx(re,{})]},o.id))}),e.jsx(k,{variant:"secondary",asChild:!0,children:e.jsxs(U,{href:`${window.routePrefix}/notifications`,className:`w-full ${x?"opacity-50 pointer-events-none":""}`,children:[f["View All"],x&&e.jsx(D,{className:"h-4 w-4 animate-spin"})]})})]})]})}const xe=()=>{if(!(typeof window>"u"))return window.__adminizerAiAssistantState__??void 0},we=s=>{typeof window>"u"||(window.__adminizerAiAssistantState__=s)},Q=n.createContext(void 0),Ee=({children:s})=>{const a=z().props.aiAssistant,u=n.useMemo(()=>xe(),[]),[f,x]=n.useState(()=>(u==null?void 0:u.isOpen)??!1),[m,S]=n.useState([]),[l,o]=n.useState(()=>(u==null?void 0:u.activeModel)??(a==null?void 0:a.defaultModel)??void 0),[p,j]=n.useState([]),[A,v]=n.useState(!1),[g,C]=n.useState(!1),[M,w]=n.useState(null),d=(a==null?void 0:a.enabled)??!1,E=n.useCallback(async()=>{if(d)try{v(!0);const{data:r}=await y.getJson(`${window.routePrefix}/api/ai-assistant/models`);S(r),o(i=>{var N;return i||(a!=null&&a.defaultModel&&r.some(V=>V.id===a.defaultModel)?a.defaultModel:(N=r[0])==null?void 0:N.id)})}catch(r){console.error("Failed to load AI assistant models",r),w("Unable to load AI assistant models")}finally{v(!1)}},[a==null?void 0:a.defaultModel,d]),b=n.useCallback(async r=>{if(!(!d||!r))try{v(!0);const{data:i}=await y.getJson(`${window.routePrefix}/api/ai-assistant/history/${r}`);j(i.history??[])}catch(i){console.error("Failed to load AI assistant history",i),w("Unable to load AI assistant history")}finally{v(!1)}},[d]);n.useEffect(()=>{if(!d){j([]);return}E()},[E,d]),n.useEffect(()=>{!d||!l||b(l)},[l,b,d]);const $=n.useCallback(r=>{o(r)},[]),P=n.useCallback(()=>x(!0),[]),T=n.useCallback(()=>x(!1),[]),I=n.useCallback(()=>x(r=>!r),[]),J=n.useCallback(async r=>{if(!d||!l)return;const i=r.trim();if(!i)return;const h={id:`tmp-${Date.now()}`,role:"user",content:i,timestamp:new Date().toISOString(),modelId:l};j(N=>[...N,h]),C(!0),w(null);try{const{data:N}=await y.postJson(`${window.routePrefix}/api/ai-assistant/query`,{modelId:l,message:i});j(N.history??[])}catch(N){console.error("Failed to send AI assistant message",N),w("Unable to reach AI assistant"),await b(l)}finally{C(!1)}},[l,b,d]),L=n.useCallback(async()=>{l&&await b(l)},[l,b]);n.useEffect(()=>{d||x(!1)},[d]),n.useEffect(()=>{we({isOpen:f,activeModel:l})},[l,f]);const t=n.useMemo(()=>({isEnabled:d,isOpen:f,openChat:P,closeChat:T,toggleChat:I,models:m,activeModel:l,setActiveModel:$,messages:p,loading:A,sending:g,error:M,sendMessage:J,refreshHistory:L}),[l,T,M,d,f,A,p,m,P,L,J,g,$,I]);return e.jsx(Q.Provider,{value:t,children:s})},ge=()=>{const s=n.useContext(Q);if(!s)throw new Error("useAiAssistant must be used within an AiAssistantProvider");return s};function ye(){const{isEnabled:s,isOpen:c,toggleChat:a,models:u,sending:f,loading:x}=ge();if(!s)return null;const m=u.length>0;return e.jsx(e.Fragment,{children:e.jsxs(R,{children:[e.jsx(B,{asChild:!0,children:e.jsx(k,{variant:"ghost",className:ne("relative",{"text-primary":c}),onClick:a,"aria-expanded":c,"aria-haspopup":"true","aria-controls":"ai-assistant-panel",disabled:!m&&x,children:f?e.jsx(D,{className:"size-4 animate-spin"}):e.jsx(oe,{className:"size-4"})})}),e.jsx(F,{side:"bottom",className:"z-[1002]",children:e.jsx("span",{children:"AI assistant"})})]})})}function je({breadcrumbs:s=[]}){const{tabs:c}=q(),a=z();return e.jsx("header",{className:"border-sidebar-border/50 flex h-16 shrink-0 items-center gap-2 border-b px-6 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 md:px-4",children:e.jsxs("div",{className:"flex justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"-ml-1"}),e.jsx(le,{breadcrumbs:s})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(ye,{}),a.props.history&&e.jsx(U,{href:`${window.routePrefix}/history/view-all`,children:e.jsx(k,{variant:"ghost",size:"icon",className:"shrink-0",children:e.jsx(ce,{})})}),e.jsx(ue,{}),a.props.notifications&&(c===null?e.jsx("div",{className:"w-[40px] flex-none flex justify-center",children:e.jsx(D,{className:"size-4 animate-spin"})}):c.length?e.jsx(me,{}):null),e.jsx(de,{})]})]})})}const Pe=Object.freeze(Object.defineProperty({__proto__:null,AppSidebarHeader:je},Symbol.toStringTag,{value:"Module"}));export{je as A,Ae as N,ge as a,Ee as b,Pe as c,q as u};
@@ -1 +0,0 @@
1
- import{j as r,bn as n,bo as i,bp as c,bq as d,br as l,ai as m,bs as h}from"./app.js";import{r as o}from"./handsontable-PxYdjN8c.js";import"./jsoneditor-De1FvcYu.js";import"./monaco-BhBYtg3d.js";function b({breadcrumbs:e}){return r.jsx(r.Fragment,{children:e.length>0&&r.jsx(n,{children:r.jsx(i,{children:e.map((s,a)=>{const t=a===e.length-1;return r.jsxs(o.Fragment,{children:[r.jsx(c,{children:t?r.jsx(d,{children:s.title}):r.jsx(l,{asChild:!0,children:r.jsx(m,{href:s.href,children:s.title})})}),!t&&r.jsx(h,{})]},a)})})})})}export{b as Breadcrumbs};