@camera.ui/server 0.0.13-alpha.0 → 0.0.13-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/interface/assets/{@tanstack-BvYNCsQh.js → @tanstack-CBqECT9Y.js} +1 -1
  2. package/dist/interface/assets/{@vee-validate-BY5H7fGS.js → @vee-validate-CWdaG3kt.js} +1 -1
  3. package/dist/interface/assets/{@vue-DMh6qW6s.js → @vue-DL9UVr_o.js} +1 -1
  4. package/dist/interface/assets/{@vueform-B62o9zLe.js → @vueform-8UOOtZD4.js} +1 -1
  5. package/dist/interface/assets/{@vueuse-D76s02Ot.js → @vueuse-Dir68MUw.js} +1 -1
  6. package/dist/interface/assets/{Account-ztef-k66.js → Account-DIyLTayx.js} +1 -1
  7. package/dist/interface/assets/{Adminpanel-BEcJey3P.js → Adminpanel-HbC8CMrH.js} +2 -2
  8. package/dist/interface/assets/{Appearance-CsfsWFip.js → Appearance-D7jOLM0M.js} +1 -1
  9. package/dist/interface/assets/{Backup-BwyitGhD.js → Backup-2hg7N8bX.js} +1 -1
  10. package/dist/interface/assets/{Camera-C3krHJdP.js → Camera-CzsBQTrn.js} +1 -1
  11. package/dist/interface/assets/{Cameras-B3CGK5bP.js → Cameras-BsFSPUqe.js} +1 -1
  12. package/dist/interface/assets/{Camview-DYA9NpZ3.js → Camview-rK8gAIq1.js} +1 -1
  13. package/dist/interface/assets/{Config-C4Yj-UzO.js → Config-DLeBAE_a.js} +1 -1
  14. package/dist/interface/assets/{Console-CqFPXqb4.js → Console-DUMi6dpk.js} +1 -1
  15. package/dist/interface/assets/{FirstSteps-DZRXrwSw.js → FirstSteps-DiJrcnu3.js} +1 -1
  16. package/dist/interface/assets/{NewCamera-8rlzf_6H.js → NewCamera-CaZ8KccU.js} +1 -1
  17. package/dist/interface/assets/{Plugin-mw4kghIK.js → Plugin-C6LSJToC.js} +1 -1
  18. package/dist/interface/assets/{Plugins-roT2R7G-.js → Plugins-Vi-pGdZ9.js} +1 -1
  19. package/dist/interface/assets/Recordings-DS0l39MO.js +1 -0
  20. package/dist/interface/assets/Recordings-goAd_BPx.js +1 -0
  21. package/dist/interface/assets/{Settings-DO7S-9Ob.css → Settings-B4CtAGoD.css} +1 -1
  22. package/dist/interface/assets/Settings-DEb_eHGS.js +1 -0
  23. package/dist/interface/assets/{System-D9FiXyM6.js → System-DgUHNQS1.js} +1 -1
  24. package/dist/interface/assets/{User-D97-Rs68.js → User-BAxYeQHr.js} +1 -1
  25. package/dist/interface/assets/{VConfigEditor.vue_vue_type_script_setup_true_lang-DE77uadd.js → VConfigEditor.vue_vue_type_script_setup_true_lang-CqJmioUl.js} +1 -1
  26. package/dist/interface/assets/{VConsole-Bf-WItOk.js → VConsole-CCrJQT3v.js} +1 -1
  27. package/dist/interface/assets/VPlayer-Bpk-n5Iq.js +1 -0
  28. package/dist/interface/assets/{VPlayer-BWeNP9xt.css → VPlayer-CJu9D4Ha.css} +1 -1
  29. package/dist/interface/assets/VPluginCard-B2NnTL3V.js +4 -0
  30. package/dist/interface/assets/VPluginCard-Dom2ud4Q.css +1 -0
  31. package/dist/interface/assets/{axios-BI2i94Vb.js → axios--Jv2L996.js} +1 -1
  32. package/dist/interface/assets/{main-CTF7x7Fg.css → main-B0_ewtlD.css} +1 -1
  33. package/dist/interface/assets/main-DGpiuR7E.js +9 -0
  34. package/dist/interface/assets/{pinia-BQbsPkIS.js → pinia-DvQcsQmR.js} +1 -1
  35. package/dist/interface/assets/{plugins-BvEiuWHs.js → plugins-CMB4ORW-.js} +1 -1
  36. package/dist/interface/assets/{system-4fS8k88J.js → system-N-zgarul.js} +1 -1
  37. package/dist/interface/assets/{ui-CyEgSsGE.js → ui-buWmfohM.js} +1 -1
  38. package/dist/interface/assets/{v-calendar-CVkp7hgG.js → v-calendar-CghEhjvD.js} +1 -1
  39. package/dist/interface/assets/{vee-validate-9vrYaQFq.js → vee-validate-PbgW_0me.js} +1 -1
  40. package/dist/interface/assets/{vue-i18n-DqKZtX1N.js → vue-i18n-DYaQP6Tc.js} +1 -1
  41. package/dist/interface/assets/{vue-inline-svg-D1BV6A5r.js → vue-inline-svg-DZpyzRHr.js} +1 -1
  42. package/dist/interface/assets/{vue-router-Bje-Muh5.js → vue-router-DWO1Myem.js} +2 -2
  43. package/dist/interface/assets/{vue3-apexcharts-B8Nznyy3.js → vue3-apexcharts-rlKvKWKE.js} +1 -1
  44. package/dist/interface/assets/{vue3-dnd-CvPSCHQb.js → vue3-dnd-Kv-U-2jL.js} +1 -1
  45. package/dist/interface/assets/{vue3-toastify-D8Ru9hkX.js → vue3-toastify-Dw-XOd2Z.js} +1 -1
  46. package/dist/interface/assets/{vuetify-DYU2dOLI.js → vuetify-B9MADlxz.js} +1 -1
  47. package/dist/interface/index.html +15 -15
  48. package/dist/interface/pwa/pwa-120x120.png +0 -0
  49. package/dist/interface/pwa/pwa-144x144.png +0 -0
  50. package/dist/interface/pwa/pwa-152x152.png +0 -0
  51. package/dist/interface/pwa/pwa-167x167.png +0 -0
  52. package/dist/interface/pwa/pwa-192x192.png +0 -0
  53. package/dist/interface/pwa/pwa-24x24.png +0 -0
  54. package/dist/interface/pwa/pwa-36x36.png +0 -0
  55. package/dist/interface/pwa/pwa-48x48.png +0 -0
  56. package/dist/interface/pwa/pwa-50x50.png +0 -0
  57. package/dist/interface/pwa/pwa-64x64.png +0 -0
  58. package/dist/interface/pwa/pwa-72x72.png +0 -0
  59. package/dist/interface/pwa/pwa-88x88.png +0 -0
  60. package/dist/interface/pwa/pwa-96x96.png +0 -0
  61. package/dist/interface/sw.js +1 -1
  62. package/dist/server/package.json +1 -2
  63. package/dist/server/src/plugins/worker.js +1 -0
  64. package/dist/server/src/plugins/worker.js.map +1 -1
  65. package/dist/server/src/polyglot/node/decoder/wasm/test/imageUtils.py +106 -0
  66. package/dist/server/src/polyglot/node/plugins/child.d.ts +2 -0
  67. package/dist/server/src/polyglot/node/plugins/child.js +24 -9
  68. package/dist/server/src/polyglot/node/plugins/child.js.map +1 -1
  69. package/dist/server/src/polyglot/node/plugins/pluginApi.d.ts +0 -3
  70. package/dist/server/src/polyglot/node/plugins/pluginApi.js +0 -14
  71. package/dist/server/src/polyglot/node/plugins/pluginApi.js.map +1 -1
  72. package/dist/server/src/polyglot/python/plugins/child.py +83 -16
  73. package/dist/server/src/polyglot/python/plugins/plugin_api.py +0 -76
  74. package/package.json +1 -2
  75. package/dist/interface/assets/Recordings-C8o1REyq.js +0 -1
  76. package/dist/interface/assets/Recordings-Cb66bgzd.js +0 -1
  77. package/dist/interface/assets/Settings-CIMHAESW.js +0 -1
  78. package/dist/interface/assets/VPlayer-CjBoAE42.js +0 -1
  79. package/dist/interface/assets/VPluginCard-23hHloPd.js +0 -4
  80. package/dist/interface/assets/VPluginCard-D_XHVDOF.css +0 -1
  81. package/dist/interface/assets/main-CltTNKYj.js +0 -9
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import importlib.util
2
3
  import inspect
3
4
  import os
4
5
  import signal
@@ -6,9 +7,10 @@ import sys
6
7
  import traceback
7
8
  from asyncio import AbstractEventLoop
8
9
  from contextlib import suppress
10
+ from types import ModuleType
9
11
  from typing import Any, Optional, cast
10
12
 
11
- from camera_ui_types import CameraDevice
13
+ from camera_ui_types import BasePlugin, CameraDevice
12
14
  from decoder.typings import AuthConfig
13
15
  from message_queue import MessageQueue
14
16
  from nats.aio.msg import Msg
@@ -30,6 +32,47 @@ from utilities.subscriptions import ProxySubscription
30
32
  from utilities.task import TaskSet
31
33
 
32
34
 
35
+ def find_plugin_constructor(module: ModuleType) -> Any:
36
+ if hasattr(module, "__main__"):
37
+ main_func = module.__main__
38
+ if callable(main_func):
39
+ plugin_base_class: BasePlugin = main_func()
40
+ if isinstance(plugin_base_class, type):
41
+ return plugin_base_class
42
+ else:
43
+ raise Exception("Plugin's __main__ must return a plugin constructor.")
44
+ else:
45
+ raise Exception("Plugin's __main__ is not callable.")
46
+
47
+ else:
48
+ raise Exception("Plugin does not have a __main__ function.")
49
+
50
+
51
+ def check_plugin_class_methods(cls: Any) -> None:
52
+ base_plugin_methods = {
53
+ name for name in dir(BasePlugin) if callable(getattr(BasePlugin, name)) and not name.startswith("__")
54
+ }
55
+
56
+ for method_name in base_plugin_methods:
57
+ if not hasattr(cls, method_name):
58
+ raise Exception(f"Method '{method_name}' is not implemented in plugin.")
59
+
60
+ cls_method = getattr(cls, method_name)
61
+ if not callable(cls_method):
62
+ raise Exception(f"Method '{method_name}' is not callable.")
63
+
64
+ # base_method = getattr(BasePlugin, method_name)
65
+ # cls_signature = inspect.signature(cls_method)
66
+ # base_signature = inspect.signature(base_method)
67
+
68
+ # if cls_signature.return_annotation != base_signature.return_annotation:
69
+ # raise Exception(
70
+ # f"Method '{method_name}' has a different return type than the one in BasePlugin. "
71
+ # f"Expected: {base_signature.return_annotation}, "
72
+ # f"Actual: {cls_signature.return_annotation}"
73
+ # )
74
+
75
+
33
76
  class PluginChild:
34
77
  def __init__(self) -> None:
35
78
  self.proxy_endpoints = [endpoint for endpoint in os.environ["PROXY_ENDPOINTS"].split(",")]
@@ -57,7 +100,9 @@ class PluginChild:
57
100
  self.tasks: TaskSet = TaskSet(f"{self.display_name} PluginChild")
58
101
  self.message_queue: Optional[MessageQueue] = None
59
102
 
60
- self.api = None
103
+ self.api: Optional[PluginAPI] = None
104
+ self.plugin: Optional[BasePlugin] = None
105
+
61
106
  self.stopped = False
62
107
 
63
108
  async def run(self):
@@ -80,7 +125,7 @@ class PluginChild:
80
125
  self.logger,
81
126
  self.publisher,
82
127
  self.plugin_subscriber,
83
- self.__request_handler,
128
+ self.request_handler,
84
129
  )
85
130
 
86
131
  await self.send_message({"type": PLUGIN_STATUS.READY.value})
@@ -88,10 +133,16 @@ class PluginChild:
88
133
  async def start(self, data: ProcessLoadMessage) -> None:
89
134
  storage_path = data["storage"]["storagePath"]
90
135
  config_file = data["storage"]["configFile"]
91
- plugin = data["plugin"]
136
+ plugin_info = data["plugin"]
92
137
  cameras = data["cameras"]
93
138
 
94
- self.api = PluginAPI(plugin, storage_path, config_file, self.logger, self.proxy_endpoints, self.auth)
139
+ self.api = PluginAPI(
140
+ plugin_info, storage_path, config_file, self.logger, self.proxy_endpoints, self.auth
141
+ )
142
+
143
+ plugin_constructor = self.load_plugin()
144
+ self.plugin = cast(BasePlugin, plugin_constructor(self.logger, self.api))
145
+
95
146
  await self.api.device_manager.init()
96
147
 
97
148
  cameras_devices = [
@@ -99,7 +150,7 @@ class PluginChild:
99
150
  self.api,
100
151
  self.logger,
101
152
  camera,
102
- plugin,
153
+ plugin_info,
103
154
  self.proxy_endpoints,
104
155
  self.auth,
105
156
  )
@@ -109,7 +160,7 @@ class PluginChild:
109
160
  await asyncio.gather(*(camera_device.init() for camera_device in cameras_devices))
110
161
 
111
162
  self.api.device_manager.configure_cameras(cameras_devices)
112
- self.api.plugin.configure_cameras(cast(list[CameraDevice], cameras_devices))
163
+ self.plugin.configure_cameras(cast(list[CameraDevice], cameras_devices))
113
164
 
114
165
  await self.send_message({"type": PLUGIN_STATUS.STARTED.value})
115
166
 
@@ -133,13 +184,34 @@ class PluginChild:
133
184
 
134
185
  self.shutdown_event.set()
135
186
 
187
+ def load_plugin(self) -> Any:
188
+ module_path = os.environ.get("MODULE_PATH")
189
+
190
+ spec = importlib.util.spec_from_file_location("plugin_module", module_path)
191
+ if spec is None:
192
+ raise Exception(f"Could not load module from '{module_path}'.")
193
+
194
+ module = importlib.util.module_from_spec(spec)
195
+ sys.modules["plugin_module"] = module
196
+
197
+ if spec.loader is None:
198
+ raise Exception(f"Could not load module from '{module_path}'.")
199
+
200
+ spec.loader.exec_module(module)
201
+
202
+ plugin_constructor = find_plugin_constructor(module)
203
+
204
+ check_plugin_class_methods(plugin_constructor)
205
+
206
+ return plugin_constructor
207
+
136
208
  async def send_message(self, message: ProcessResponse) -> None:
137
209
  if not self.publisher:
138
210
  raise Exception("Publisher is not initialized")
139
211
 
140
212
  await self.publisher.publish(self.target_subject, message)
141
213
 
142
- async def __request_handler(self, message: ProxyMessageStructure) -> None:
214
+ async def request_handler(self, message: ProxyMessageStructure) -> None:
143
215
  if not self.message_queue:
144
216
  raise Exception("Message queue not initialized")
145
217
 
@@ -147,12 +219,7 @@ class PluginChild:
147
219
  reply["type"] = "reply"
148
220
 
149
221
  try:
150
- plugin = None
151
-
152
- if self.api:
153
- plugin = self.api.plugin
154
-
155
- if not plugin or not self.api:
222
+ if not self.plugin or not self.api:
156
223
  raise Exception("Plugin not initialized")
157
224
 
158
225
  fn = message["fn"]
@@ -160,8 +227,8 @@ class PluginChild:
160
227
  camera_id = message.get("cameraId", None)
161
228
  camera_storage = self.api.storage_controller.get_camera_storage(camera_id or "")
162
229
 
163
- if hasattr(plugin, fn) and callable(getattr(plugin, fn)):
164
- method_to_call = getattr(plugin, fn)
230
+ if hasattr(self.plugin, fn) and callable(getattr(self.plugin, fn)):
231
+ method_to_call = getattr(self.plugin, fn)
165
232
 
166
233
  if inspect.iscoroutinefunction(method_to_call):
167
234
  response = await method_to_call(*args)
@@ -1,13 +1,3 @@
1
- import importlib.util
2
-
3
- # import inspect
4
- import os
5
- import sys
6
- from types import ModuleType
7
- from typing import Any, cast
8
-
9
- from camera_ui_types import BasePlugin
10
- from camera_ui_types import PluginAPI as IPluginAPI
11
1
  from config_service import PluginConfigService
12
2
  from decoder.typings import AuthConfig
13
3
  from plugin_logger import PluginLogger
@@ -30,75 +20,9 @@ class PluginAPI(AsyncIOEventEmitter):
30
20
  from proxy.device_manager import DeviceManager
31
21
  from storage_controller import StorageController
32
22
 
33
- api_instance = cast(IPluginAPI, self)
34
-
35
23
  self.storage_path = storage_path
36
24
  self.config_file = config_file
37
25
 
38
26
  self.config_service = PluginConfigService(config_file)
39
27
  self.storage_controller = StorageController(self)
40
28
  self.device_manager = DeviceManager(self, logger, plugin, proxy_endpoints, auth)
41
-
42
- plugin_constructor = self.__load_module()
43
- self.plugin: BasePlugin = plugin_constructor(logger, api_instance)
44
-
45
- def __load_module(self) -> Any:
46
- module_path = os.environ.get("MODULE_PATH")
47
-
48
- spec = importlib.util.spec_from_file_location("plugin_module", module_path)
49
- if spec is None:
50
- raise Exception(f"Could not load module from '{module_path}'.")
51
-
52
- module = importlib.util.module_from_spec(spec)
53
- sys.modules["plugin_module"] = module
54
-
55
- if spec.loader is None:
56
- raise Exception(f"Could not load module from '{module_path}'.")
57
-
58
- spec.loader.exec_module(module)
59
-
60
- plugin_constructor = self.__find_plugin_constructor(module)
61
- self.__check_plugin_class_methods(plugin_constructor)
62
-
63
- return plugin_constructor
64
-
65
- def __find_plugin_constructor(self, module: ModuleType) -> Any:
66
- if hasattr(module, "__main__"):
67
- main_func = module.__main__
68
- if callable(main_func):
69
- plugin_base_class: BasePlugin = main_func()
70
- if isinstance(plugin_base_class, type):
71
- return plugin_base_class
72
- else:
73
- raise Exception("Plugin's __main__ must return a plugin constructor.")
74
- else:
75
- raise Exception("Plugin's __main__ is not callable.")
76
-
77
- else:
78
- raise Exception("Plugin does not have a __main__ function.")
79
-
80
- def __check_plugin_class_methods(self, cls: Any) -> None:
81
- base_plugin_methods = {
82
- name
83
- for name in dir(BasePlugin)
84
- if callable(getattr(BasePlugin, name)) and not name.startswith("__")
85
- }
86
-
87
- for method_name in base_plugin_methods:
88
- if not hasattr(cls, method_name):
89
- raise Exception(f"Method '{method_name}' is not implemented in plugin.")
90
-
91
- cls_method = getattr(cls, method_name)
92
- if not callable(cls_method):
93
- raise Exception(f"Method '{method_name}' is not callable.")
94
-
95
- # base_method = getattr(BasePlugin, method_name)
96
- # cls_signature = inspect.signature(cls_method)
97
- # base_signature = inspect.signature(base_method)
98
-
99
- # if cls_signature.return_annotation != base_signature.return_annotation:
100
- # raise Exception(
101
- # f"Method '{method_name}' has a different return type than the one in BasePlugin. "
102
- # f"Expected: {base_signature.return_annotation}, "
103
- # f"Actual: {cls_signature.return_annotation}"
104
- # )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/server",
3
- "version": "0.0.13-alpha.0",
3
+ "version": "0.0.13-alpha.1",
4
4
  "description": "camera.ui",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "bin": {
@@ -51,7 +51,6 @@
51
51
  "fastify-type-provider-zod": "^2.0.0",
52
52
  "fs-extra": "^11.2.0",
53
53
  "get-port": "^7.1.0",
54
- "import-sync": "^2.2.2",
55
54
  "js-yaml": "^4.1.0",
56
55
  "jsonwebtoken": "^9.0.2",
57
56
  "lmdb": "^3.0.13",
@@ -1 +0,0 @@
1
- import{d as r}from"./main-CltTNKYj.js";import{f as o,e as t}from"./@vue-DMh6qW6s.js";import"./vue-inline-svg-D1BV6A5r.js";import"./vue3-toastify-D8Ru9hkX.js";import"./vue-i18n-DqKZtX1N.js";import"./@intlify-Ck2ZoCVz.js";import"./axios-BI2i94Vb.js";import"./@tanstack-BvYNCsQh.js";import"./pinia-BQbsPkIS.js";import"./vue-router-Bje-Muh5.js";import"./@vueuse-D76s02Ot.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./vuetify-DYU2dOLI.js";import"./@mdi-CmcijEFB.js";import"./vee-validate-9vrYaQFq.js";import"./@vee-validate-BY5H7fGS.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-CQrF441D.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-CVkp7hgG.js";import"./@popperjs-BQBsAJpH.js";const i={};function m(p,e){return t(),o("div",null,"Test")}const G=r(i,[["render",m]]);export{G as default};
@@ -1 +0,0 @@
1
- import{f as m}from"./main-CltTNKYj.js";import{F as p,e as s,f as a,j as t,n as r,u as e,T as l}from"./@vue-DMh6qW6s.js";import"./vue-inline-svg-D1BV6A5r.js";import"./vue3-toastify-D8Ru9hkX.js";import"./vue-i18n-DqKZtX1N.js";import"./@intlify-Ck2ZoCVz.js";import"./axios-BI2i94Vb.js";import"./@tanstack-BvYNCsQh.js";import"./pinia-BQbsPkIS.js";import"./vue-router-Bje-Muh5.js";import"./@vueuse-D76s02Ot.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./vuetify-DYU2dOLI.js";import"./@mdi-CmcijEFB.js";import"./vee-validate-9vrYaQFq.js";import"./@vee-validate-BY5H7fGS.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-CQrF441D.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-CVkp7hgG.js";import"./@popperjs-BQBsAJpH.js";const n={class:"h-full w-full inline-size mb-safe"},c={class:"page-title"},H=p({__name:"Recordings",setup(f){const{smallMobileActive:o}=m();return(i,u)=>(s(),a("main",{class:r({"px-0":e(o)})},[t("div",n,[t("div",{class:r(["flex w-full items-center",{"px-2":e(o)}]),style:{height:"30px"}},[t("h1",c,l(i.$t(`views.${String(i.$route.name).toLowerCase()}.title`)),1)],2)])],2))}});export{H as default};
@@ -1 +0,0 @@
1
- import{F as q,t as Y,r as u,c as $,w as b,a3 as U,y as ee,J,e as p,f as h,j as i,N as L,Q as te,O as T,R as S,M as x,V as oe,T as C,u as o,l as V,X as N,W as K,b as ae,n as z,q as se,S as ne}from"./@vue-DMh6qW6s.js";import{f as P,S as O,T as ie,Q as re,d as Z,R as F,h as Q,V as j}from"./main-CltTNKYj.js";import{u as G}from"./vue-router-Bje-Muh5.js";import{o as le,g as ce,h as de}from"./@vueuse-D76s02Ot.js";import{e as ue,b as pe}from"./vuetify-DYU2dOLI.js";import{C as me,H as fe}from"./@mdi-CmcijEFB.js";import"./vue-inline-svg-D1BV6A5r.js";import"./vue3-toastify-D8Ru9hkX.js";import"./vue-i18n-DqKZtX1N.js";import"./@intlify-Ck2ZoCVz.js";import"./axios-BI2i94Vb.js";import"./@tanstack-BvYNCsQh.js";import"./pinia-BQbsPkIS.js";import"./vee-validate-9vrYaQFq.js";import"./@vee-validate-BY5H7fGS.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-CQrF441D.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-CVkp7hgG.js";import"./@popperjs-BQBsAJpH.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";var B=(f=>(f[f.MAXWIDTH=280]="MAXWIDTH",f))(B||{});const ve={class:"flex flex-col w-full pb-safe"},_e={class:"flex flex-row navigation-text"},be={class:"ml-5"},ge={class:"navigation-title"},he={key:0},Se={key:0,class:"overlay"},xe=q({__name:"VSubNavigation",props:{routes:{},description:{type:Boolean,default:!1},state:{type:Boolean,default:!1}},emits:["inner-sidebar-state"],setup(f,{emit:y}){const{desktopActive:r,mobileActive:M}=P(),l=G(),k=ce(re),w=y,c=f,{routes:I,state:v,description:R}=Y(c),g=u(null),s=u(),m=u(),t=$(()=>{let e=`calc(${a.value}px + env(safe-area-inset-left, 0px))`;return m.value==="closed"&&s.value==="closed"&&(e=`calc(${a.value}px - env(safe-area-inset-left, 0px))`),e}),a=$(()=>{let e=0;switch(m.value){case"opened":e=O.MAXWIDTH;break;case"minified":e=O.MINWIDTH;break;case"closed":e=0;break}return!r.value&&!v.value&&(e-=B.MAXWIDTH),e});return le(g,e=>{if(r.value||s.value==="closed")return;e.target.closest(".no-outside")||(s.value="closed")}),k.on(e=>{e.sidebarState&&(m.value=e.sidebarState)}),b(r,e=>{s.value=e?"opened":"closed"}),b(v,e=>{s.value=e?r.value?"opened":"overlay":"closed"}),b(s,e=>{e&&(k.emit({subNavigationState:e}),w("inner-sidebar-state",e))}),U(()=>{var e;M.value||(e=l.meta)!=null&&e.ui.noMinifiedSidebar?m.value="closed":m.value="minified"}),ee(()=>{var d;s.value=r.value?"opened":"closed";const e=(d=l.name)==null?void 0:d.toString().toLowerCase(),_=document.getElementById(e);_&&setTimeout(()=>{_.scrollIntoView({behavior:"smooth"})},100)}),(e,_)=>{const d=J("router-link");return p(),h(L,null,[i("div",{ref_key:"innerSidebar",ref:g,class:"inner-sidebar-settings pb-safe",style:N({left:o(t),maxWidth:`${o(B).MAXWIDTH}px`,height:`calc(100dvh - ${o(ie).MINHEIGHT}px)`})},[i("div",ve,[(p(!0),h(L,null,te(o(I),(n,A)=>{var D;return p(),T(d,{id:(D=n.name)==null?void 0:D.toString().toLowerCase(),key:A,class:"navigation-inner",to:n.path,style:N({"border-bottom":A!==o(I).length-1?"1px solid var(--border)":void 0})},{default:S(()=>{var H,W,X;return[i("div",_e,[x(ue,{size:((H=n.meta)==null?void 0:H.navigation.iconSize)||"20",class:"navigation-icon"},{default:S(()=>{var E;return[oe(C((E=n.meta)==null?void 0:E.navigation.icon),1)]}),_:2},1032,["size"]),i("div",be,[i("b",ge,C(e.$t(`navigation.${(W=n.meta)==null?void 0:W.name}`)),1),o(R)?(p(),h("p",he,C(e.$t(`navigation_description.${(X=n.meta)==null?void 0:X.description}`)),1)):V("",!0)])])]}),_:2},1032,["id","to","style"])}),128))])],4),x(K,{name:"overlay-fade",mode:"in-out"},{default:S(()=>[o(s)==="overlay"?(p(),h("div",Se)):V("",!0)]),_:1})],64)}}}),ye=Z(xe,[["__scopeId","data-v-7a51011d"]]),ke={class:"flex flex-row",style:{padding:"0 !important"}},we={class:"flex flex-row items-center"},Ie=q({__name:"Settings",setup(f){const y=G(),{desktopActive:r,smallMobileActive:M}=P(),l=u(),k=u(null),w=u(null),c=u(!1),I=u(0),v=ae(F.find(t=>t.name==="Settings").children.filter(t=>Q(t))),R=$(()=>F.find(t=>t.name==="Settings").children.filter(t=>Q(t))),{isSwiping:g,direction:s}=de(w),m=$(()=>{let t="0px";switch(l.value){case"closed":case"overlay":t="0px";break;case"opened":t=`${B.MAXWIDTH}px`;break}return`padding-left: ${t}`});return b([g,s],()=>{if(g.value){const t=v.findIndex(a=>a.path===y.path.split("/settings/")[1]);switch(s.value){case"right":{const a=v[t-1];a&&j.push({path:a.path})}break;case"left":{const a=v[t+1];a&&j.push({path:a.path})}break}}}),b(l,()=>{c.value=l.value!=="closed"}),b(y,()=>{r.value||(c.value=!1)},{deep:!0}),(t,a)=>{var d;const e=ye,_=J("router-view");return p(),h("main",ke,[x(e,{description:"",state:o(c),routes:o(R),onInnerSidebarState:a[0]||(a[0]=n=>l.value=n)},null,8,["state","routes"]),i("div",{class:"router-container",style:N(`transition: 0.2s all ease-in-out;${o(m)};`)},[i("div",{ref_key:"routerContainer",ref:k,class:"router-container-inner h-full w-full flex flex-col"},[i("div",we,[o(r)?V("",!0):(p(),T(pe,{key:0,ref:"innerSidebarButton",density:"compact",icon:o(c)?o(me):o(fe),class:z(["no-outside",{"ml-2":o(M)}]),elevation:"0",style:{border:"1px solid rgba(var(--border-rgb), 0.75)"},onClick:a[1]||(a[1]=se(n=>c.value=!o(c),["prevent"]))},null,8,["icon","class"])),i("h1",{class:z(["page-title text-color",{"mx-3":o(l)!=="opened"}])},C(t.$t(`views.settings.title_${(d=t.$route.meta)==null?void 0:d.name}`)),3)]),i("div",{ref_key:"subviewContainer",ref:w},[x(_,null,{default:S(({Component:n})=>[x(K,{name:"fade",mode:"out-in"},{default:S(()=>[(p(),T(ne(n),{key:o(I),class:"mt-10 pb-5"}))]),_:2},1024)]),_:1})],512)],512)],4)])}}}),et=Z(Ie,[["__scopeId","data-v-602520f5"]]);export{et as default};