@camera.ui/server 0.0.70 → 0.0.71-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1328) hide show
  1. package/CLAUDE.md +91 -0
  2. package/README.md +0 -24
  3. package/cupdate.config.txt +0 -1
  4. package/dist/interface/assets/404-CIsBB4A0.js +1 -0
  5. package/dist/interface/assets/About-CkxZb9D-.js +1 -0
  6. package/dist/interface/assets/Adminpanel-BrZ55JBx.js +1 -0
  7. package/dist/interface/assets/Automation-BKhuIS2v.js +2 -0
  8. package/dist/interface/assets/Automation-Csu8t0D7.css +1 -0
  9. package/dist/interface/assets/Automations-CzdnqGGU.js +1 -0
  10. package/dist/interface/assets/Camera-BhCDJE7I.css +1 -0
  11. package/dist/interface/assets/Camera-CU3aKdBR.js +2 -0
  12. package/dist/interface/assets/CameraConsole-D7KxwRxQ.js +7 -0
  13. package/dist/interface/assets/Cameras-807mspcl.css +1 -0
  14. package/dist/interface/assets/Cameras-DJcAfGpU.js +656 -0
  15. package/dist/interface/assets/Camview-ArBQ3nES.js +1 -0
  16. package/dist/interface/assets/Camview-Dd7DwMHG.css +1 -0
  17. package/dist/interface/assets/Config-D2ftkjl2.js +2 -0
  18. package/dist/interface/assets/Config-JgftUZFe.css +1 -0
  19. package/dist/interface/assets/ConfigActionCameraControl-94iyzBzJ.js +1 -0
  20. package/dist/interface/assets/ConfigActionDelay-DKhE0Xr8.js +1 -0
  21. package/dist/interface/assets/ConfigActionHttp-BbfN1UGF.js +1 -0
  22. package/dist/interface/assets/ConfigActionImageInput-P39gRfld.js +1 -0
  23. package/dist/interface/assets/ConfigActionNotification-CuDDnksK.js +1 -0
  24. package/dist/interface/assets/ConfigActionOutput-BIHvC1Z5.js +1 -0
  25. package/dist/interface/assets/ConfigActionPlugin-CDA53LwA.js +1 -0
  26. package/dist/interface/assets/ConfigActionSensor-BBkfWT_r.js +1 -0
  27. package/dist/interface/assets/ConfigActionSnapshot-C5enxVcl.js +1 -0
  28. package/dist/interface/assets/ConfigActionVariable-CVaOMoOi.js +1 -0
  29. package/dist/interface/assets/ConfigConditionIfElse-DiIOUqA5.js +1 -0
  30. package/dist/interface/assets/ConfigConditionSensorState-DBktbA8F.js +1 -0
  31. package/dist/interface/assets/ConfigConditionSwitch-DWqcQ3Ip.js +1 -0
  32. package/dist/interface/assets/ConfigConditionTime-BEaHclqa.js +1 -0
  33. package/dist/interface/assets/ConfigTriggerDetection-CRnZR91p.js +1 -0
  34. package/dist/interface/assets/ConfigTriggerGeofence-DODdJBZW.js +1 -0
  35. package/dist/interface/assets/ConfigTriggerManual-V8-5hrdl.js +1 -0
  36. package/dist/interface/assets/ConfigTriggerSchedule-CqID85d1.js +1 -0
  37. package/dist/interface/assets/ConfigTriggerSensor-DR6ifBrK.js +1 -0
  38. package/dist/interface/assets/ConfigTriggerSystem-K1ohOW18.js +1 -0
  39. package/dist/interface/assets/ConfigTriggerWebhook-Cmwu5IU4.js +1 -0
  40. package/dist/interface/assets/Console-IC7AOnvc.js +6 -0
  41. package/dist/interface/assets/CuiActionButton-Ba5wT-4n.js +1 -0
  42. package/dist/interface/assets/CuiAvatar-BtMXnhxd.css +1 -0
  43. package/dist/interface/assets/CuiAvatar-Bu4NixiB.js +1 -0
  44. package/dist/interface/assets/CuiBBoxPlayground-Cmbd4_qG.js +1 -0
  45. package/dist/interface/assets/CuiBBoxPlayground-EFkdOBvq.css +1 -0
  46. package/dist/interface/assets/CuiBottomSheet-BN5exkJm.js +1 -0
  47. package/dist/interface/assets/CuiBottomSheet-CHspaYgP.js +1 -0
  48. package/dist/interface/assets/CuiBottomSheet-DxQ6D_RM.css +1 -0
  49. package/dist/interface/assets/CuiCameraCard-C7eDwhgw.js +1 -0
  50. package/dist/interface/assets/CuiCameraCard-dNsAwlKS.css +1 -0
  51. package/dist/interface/assets/CuiCameraPipCard-C8Pg7xT9.js +1 -0
  52. package/dist/interface/assets/CuiCameraPipCard-D3o29_wc.css +1 -0
  53. package/dist/interface/assets/CuiCameraRecordings-CQHbo-_J.js +1 -0
  54. package/dist/interface/assets/CuiCameraRecordings-DM_o0Lya.css +1 -0
  55. package/dist/interface/assets/CuiCameraShares-DNuCgk4b.js +1 -0
  56. package/dist/interface/assets/CuiCameraSnapshot-BpUMwSoR.js +1 -0
  57. package/dist/interface/assets/CuiCameraTable-DQffvTtY.js +2 -0
  58. package/dist/interface/assets/CuiFloatingButton-RaxwbGht.js +1 -0
  59. package/dist/interface/assets/CuiImage-60jwFIqc.js +1 -0
  60. package/dist/interface/assets/CuiImage-Bxf7z2N4.css +1 -0
  61. package/dist/interface/assets/CuiMarkdownContent-M5v8bBmS.js +1 -0
  62. package/dist/interface/assets/CuiMenu-B4CHT2F_.js +1 -0
  63. package/dist/interface/assets/CuiMenu-BWUfWLQP.css +1 -0
  64. package/dist/interface/assets/CuiPluginCard-5ItfIe1Z.js +2 -0
  65. package/dist/interface/assets/CuiPluginCard-CTTsEM9M.css +1 -0
  66. package/dist/interface/assets/CuiPluginOAuthButton-BJRU2JBX.js +2 -0
  67. package/dist/interface/assets/CuiQRCode-CNeepRQw.js +1 -0
  68. package/dist/interface/assets/CuiQRCode-DfUba6JB.css +1 -0
  69. package/dist/interface/assets/CuiRecordingsGrid-CKHFeJlJ.js +1 -0
  70. package/dist/interface/assets/CuiRecordingsGrid-CZIZiEuT.css +1 -0
  71. package/dist/interface/assets/CuiSchema--yMBD996.css +1 -0
  72. package/dist/interface/assets/CuiSchema-CTRLO0uq.js +1 -0
  73. package/dist/interface/assets/CuiTopNavbarItem-CgaR_X1z.js +1 -0
  74. package/dist/interface/assets/CuiTopNavbarItem-w54CrODK.css +1 -0
  75. package/dist/interface/assets/CuiTopbarSlot-BDZoZ_yn.js +1 -0
  76. package/dist/interface/assets/Faces-JoBk1Mcv.js +1 -0
  77. package/dist/interface/assets/FirstSteps-CSMvd_p0.js +1 -0
  78. package/dist/interface/assets/Instances-DwNihvsL.js +1 -0
  79. package/dist/interface/assets/Menu-CUnOgtD5.js +1 -0
  80. package/dist/interface/assets/OAuthDeviceFlow-aUHpE7wP.js +1 -0
  81. package/dist/interface/assets/Plugin-DoxdkvWR.css +1 -0
  82. package/dist/interface/assets/Plugin-LjpUwn17.js +1 -0
  83. package/dist/interface/assets/PluginConsole-CvDWPKOs.js +7 -0
  84. package/dist/interface/assets/PluginSchema-DL7Bfd_U.js +1 -0
  85. package/dist/interface/assets/Plugins-B207FOsG.js +2 -0
  86. package/dist/interface/assets/Plugins-BPt1RSKT.css +1 -0
  87. package/dist/interface/assets/Recordings-Bt_GlPOK.css +1 -0
  88. package/dist/interface/assets/Recordings-adHTSogQ.js +1 -0
  89. package/dist/interface/assets/Settings-bwLTNAxX.css +1 -0
  90. package/dist/interface/assets/Settings-iBjUbXTH.js +1 -0
  91. package/dist/interface/assets/SettingsAccount-Ce0UnkLb.js +1 -0
  92. package/dist/interface/assets/SettingsAccount-DXKQY4Iz.css +1 -0
  93. package/dist/interface/assets/SettingsAccount-f2wkt4kx.js +1 -0
  94. package/dist/interface/assets/SettingsAppearance-2TfnSgkI.js +1 -0
  95. package/dist/interface/assets/SettingsAppearance-Dca237An.js +1 -0
  96. package/dist/interface/assets/SettingsBackup-Bh5x-GU_.js +1 -0
  97. package/dist/interface/assets/SettingsNotifications-BVmhorXq.js +2 -0
  98. package/dist/interface/assets/SettingsRecordings-dPUm5hma.js +1 -0
  99. package/dist/interface/assets/SettingsRemote-BcVzn2m3.js +1 -0
  100. package/dist/interface/assets/SettingsRemote-CjVK9pGg.css +1 -0
  101. package/dist/interface/assets/SettingsSystem-Dz76BUJ-.js +2 -0
  102. package/dist/interface/assets/SettingsUsers-Dzj--Rmf.js +1 -0
  103. package/dist/interface/assets/Terminal-BAMMh8Px.js +4 -0
  104. package/dist/interface/assets/Terminal-CrOfQJ-O.css +1 -0
  105. package/dist/interface/assets/VariableInput-D_-qKfZK.js +1 -0
  106. package/dist/interface/assets/VariableSuggestions-Br4yDsLZ.js +1 -0
  107. package/dist/interface/assets/VersionsHandler-CfNT3Yke.js +7 -0
  108. package/dist/interface/assets/Workers-D3jFWBjm.js +1 -0
  109. package/dist/interface/assets/_plugin-vue_export-helper-BDNMzG2s.js +1 -0
  110. package/dist/interface/assets/ace-BRyQJK-L.js +1 -0
  111. package/dist/interface/assets/ace.config-fXRdG20S.js +1 -0
  112. package/dist/interface/assets/alert-outline-D3FCIX7_.js +1 -0
  113. package/dist/interface/assets/api-BaywoTCE.js +2 -0
  114. package/dist/interface/assets/api-Cna9Poda.css +2 -0
  115. package/dist/interface/assets/api-DvuXV3Xb.js +1 -0
  116. package/dist/interface/assets/auth-Cu-pUvKk.js +1 -0
  117. package/dist/interface/assets/automation-CbEPnAW4.js +1 -0
  118. package/dist/interface/assets/automations-Bj3wF0wR.js +1 -0
  119. package/dist/interface/assets/automations-C6ssihoC.js +1 -0
  120. package/dist/interface/assets/back-filled-CvLD0CND.js +1 -0
  121. package/dist/interface/assets/backup-DK5aZBLo.js +1 -0
  122. package/dist/interface/assets/bell-outline-JZZKpcfS.js +1 -0
  123. package/dist/interface/assets/camera-preview-C7GT5VHo.png +0 -0
  124. package/dist/interface/assets/cameras-DQ28quQb.js +1 -0
  125. package/dist/interface/assets/cameras.schema-CDeB5JeE.js +1 -0
  126. package/dist/interface/assets/cctv-SQFfbBnL.js +1 -0
  127. package/dist/interface/assets/check-BQQidcYi.js +1 -0
  128. package/dist/interface/assets/chevron-down-Dd1qHXVA.js +1 -0
  129. package/dist/interface/assets/chevron-right-DOmJR2OL.js +1 -0
  130. package/dist/interface/assets/circular-connection-nKCVm4QI.js +1 -0
  131. package/dist/interface/assets/close-Dhjo4o57.js +1 -0
  132. package/dist/interface/assets/close-WdhW_91X.js +1 -0
  133. package/dist/interface/assets/close-circle-i5PrRG0X.js +1 -0
  134. package/dist/interface/assets/close-rounded-6nzLVPw0.js +1 -0
  135. package/dist/interface/assets/cloud-check-DeN6leiB.js +1 -0
  136. package/dist/interface/assets/cloud-outline-BHjUiP9q.js +1 -0
  137. package/dist/interface/assets/cloud-outline-BQddJElX.js +1 -0
  138. package/dist/interface/assets/cloudHandoff-DxhttWWd.js +1 -0
  139. package/dist/interface/assets/cog-Batjj1se.js +1 -0
  140. package/dist/interface/assets/copy-16-filled-DuAEBVEX.js +1 -0
  141. package/dist/interface/assets/copy-BeuZDsJN.js +1 -0
  142. package/dist/interface/assets/delete-DvMWXBFV.js +1 -0
  143. package/dist/interface/assets/dist-CcCNy5h7.js +1 -0
  144. package/dist/interface/assets/download-Cna5QEEj.js +1 -0
  145. package/dist/interface/assets/esm-B4Pd2w1t.js +1 -0
  146. package/dist/interface/assets/esm-B4l8-ACY.js +1 -0
  147. package/dist/interface/assets/esm-BE98HKPg.js +1 -0
  148. package/dist/interface/assets/esm-BNSLSv2m.js +1 -0
  149. package/dist/interface/assets/esm-BnT9fzsT.js +1 -0
  150. package/dist/interface/assets/esm-C-uLCRX1.js +1 -0
  151. package/dist/interface/assets/esm-C6JCcz6o.js +1 -0
  152. package/dist/interface/assets/esm-D5_rxfjE.js +1 -0
  153. package/dist/interface/assets/esm-D6ymjVa1.js +1 -0
  154. package/dist/interface/assets/esm-D8teZoG1.js +1 -0
  155. package/dist/interface/assets/esm-DnSGrmvg.js +1 -0
  156. package/dist/interface/assets/esm-DqkQVzkL.js +1 -0
  157. package/dist/interface/assets/esm-tnu6qUMk.js +1 -0
  158. package/dist/interface/assets/eventIcons-2hVCNchU.css +1 -0
  159. package/dist/interface/assets/eventIcons-DVykqtE5.js +1 -0
  160. package/dist/interface/assets/face-recognition-5Yp1IcUb.js +1 -0
  161. package/dist/interface/assets/github-37yEERpu.js +1 -0
  162. package/dist/interface/assets/grid-fill-BGU3gqir.js +1 -0
  163. package/dist/interface/assets/hasPermission-DIF0bX8u.js +1 -0
  164. package/dist/interface/assets/home-sSF_NnOu.js +1 -0
  165. package/dist/interface/assets/information-outline-fu18_QSH.js +1 -0
  166. package/dist/interface/assets/instances-DGPhZWRw.js +1 -0
  167. package/dist/interface/assets/lightbulb-outline-DWc53kV7.js +1 -0
  168. package/dist/interface/assets/locale-Bm1nXzqV.js +1 -0
  169. package/dist/interface/assets/main-BqVSZVz1.css +1 -0
  170. package/dist/interface/assets/main-D1gFWXGG.js +3 -0
  171. package/dist/interface/assets/microphone-ChDR4mkG.js +1 -0
  172. package/dist/interface/assets/native-Cq3ra8E-.js +1 -0
  173. package/dist/interface/assets/native-DfLBhmBo.js +1 -0
  174. package/dist/interface/assets/nodeDefinitions-BLSMZueH.js +1 -0
  175. package/dist/interface/assets/notifications-DNRzOl89.js +1 -0
  176. package/dist/interface/assets/play-solid-B_749j1A.js +1 -0
  177. package/dist/interface/assets/plugin-C1NakF2p.js +1 -0
  178. package/dist/interface/assets/plugins-DzRwEcA4.js +1 -0
  179. package/dist/interface/assets/plus-B5eEboLZ.js +1 -0
  180. package/dist/interface/assets/plus-Dis0MPt8.js +1 -0
  181. package/dist/interface/assets/power-CxGfHa98.js +1 -0
  182. package/dist/interface/assets/ring-resize-fOkdAS5R.js +1 -0
  183. package/dist/interface/assets/rolldown-runtime-CMxvf4Kt.js +1 -0
  184. package/dist/interface/assets/round-alt-arrow-left-bold-ekP_ATNV.js +1 -0
  185. package/dist/interface/assets/round-restart-alt-BWTTuG_j.js +1 -0
  186. package/dist/interface/assets/round-restart-alt-CJgRaJjF.css +1 -0
  187. package/dist/interface/assets/router-CuAn6JZ_.css +1 -0
  188. package/dist/interface/assets/router-DGyFln7e.js +2 -0
  189. package/dist/interface/assets/routerState-DMVeYr60.js +1 -0
  190. package/dist/interface/assets/search-YdrT6au7.js +1 -0
  191. package/dist/interface/assets/server-BWxbeZzY.js +1 -0
  192. package/dist/interface/assets/settings-D2-mWioF.js +1 -0
  193. package/dist/interface/assets/shares-BLuBJftj.js +1 -0
  194. package/dist/interface/assets/shield-check-DFR-xg-g.js +1 -0
  195. package/dist/interface/assets/terminal-BYi6cqd4.js +1 -0
  196. package/dist/interface/assets/theme-D08Upl8q.js +1 -0
  197. package/dist/interface/assets/trash-2-Du7oioNA.js +1 -0
  198. package/dist/interface/assets/trash-can-YTXLzAmt.js +1 -0
  199. package/dist/interface/assets/trash-fill-ZI3YYgNp.js +1 -0
  200. package/dist/interface/assets/types-B_isDU64.js +1 -0
  201. package/dist/interface/assets/types-BxFyoO54.js +1 -0
  202. package/dist/interface/assets/types-kxdn9XBW.js +1 -0
  203. package/dist/interface/assets/ui-aYGNqaHi.js +1 -0
  204. package/dist/interface/assets/upload-Chr4Uunq.js +1 -0
  205. package/dist/interface/assets/useBiometricCredentials-B-zA6b-X.js +1 -0
  206. package/dist/interface/assets/useCameraOptions-0w0LNh72.js +1 -0
  207. package/dist/interface/assets/useCuiCameraDrawer-Dn97MLFe.js +1 -0
  208. package/dist/interface/assets/useCuiDialog-BbkaNkQN.js +2 -0
  209. package/dist/interface/assets/useElectron-mh8HQUAI.js +1 -0
  210. package/dist/interface/assets/useFileDownload-g3sM8lp6.js +1 -0
  211. package/dist/interface/assets/useLogsSocket-CZld674d.js +4 -0
  212. package/dist/interface/assets/useLogsSocket-pqdh7jNG.css +1 -0
  213. package/dist/interface/assets/useSharedComposables-riqEUgwX.js +1 -0
  214. package/dist/interface/assets/useStreamStatus-2lguNuWT.js +1 -0
  215. package/dist/interface/assets/users.schema-CUZOYClB.js +1 -0
  216. package/dist/interface/assets/vendor-DmhYd_sB.js +22 -0
  217. package/dist/interface/assets/vendor-ace-B9YSA4ub.js +1085 -0
  218. package/dist/interface/assets/vendor-cameraui-DggYb17u.js +1976 -0
  219. package/dist/interface/assets/vendor-capacitor-IA6kwsx8.js +2 -0
  220. package/dist/interface/assets/vendor-chart-Dnlz1Jgy.js +3 -0
  221. package/dist/interface/assets/vendor-core-B6F-imJj.js +1 -0
  222. package/dist/interface/assets/vendor-dnd-Dp0ottZI.js +2 -0
  223. package/dist/interface/assets/vendor-draggabilly-C2ae3o70.js +1 -0
  224. package/dist/interface/assets/vendor-gridstack-Dxjc1EeA.js +3 -0
  225. package/dist/interface/assets/vendor-gridstack-Rg2RhwAc.css +1 -0
  226. package/dist/interface/assets/vendor-leaflet-B5L2Aw8Y.js +1 -0
  227. package/dist/interface/assets/vendor-leaflet-vh-t_kPv.css +1 -0
  228. package/dist/interface/assets/vendor-markdown-D3nVi7gw.js +15 -0
  229. package/dist/interface/assets/vendor-markdown-DtOhvyRx.css +1 -0
  230. package/dist/interface/assets/vendor-primevue--pcuf6kA.js +4289 -0
  231. package/dist/interface/assets/vendor-vueflow-CBuKPASC.js +26 -0
  232. package/dist/interface/assets/vendor-xterm-BrP-ENHg.css +1 -0
  233. package/dist/interface/assets/vendor-xterm-D8Z_h2U0.js +145 -0
  234. package/dist/interface/assets/vendor-zod-CmGeQCqy.js +127 -0
  235. package/dist/interface/assets/view-grid-96p9T-KQ.js +1 -0
  236. package/dist/interface/assets/view-grid-SdzaC3O_.css +1 -0
  237. package/dist/interface/assets/web-3Sh2qjiP.js +1 -0
  238. package/dist/interface/assets/web-B0BK4Q2M.js +1 -0
  239. package/dist/interface/assets/web-BjKL51lK-DzG2kK8Q.js +1 -0
  240. package/dist/interface/assets/web-COttRPza.js +1 -0
  241. package/dist/interface/assets/web-Ck1J3gUt.js +1 -0
  242. package/dist/interface/assets/web-DPxPmEOR.js +1 -0
  243. package/dist/interface/assets/web-DRprnZwc.js +1 -0
  244. package/dist/interface/assets/web-DusfFKJE.js +1 -0
  245. package/dist/interface/assets/web-U3ajDFzM.js +1 -0
  246. package/dist/interface/assets/web-jcLz0P7f.js +1 -0
  247. package/dist/interface/assets/web-tQAiC0W2.js +1 -0
  248. package/dist/interface/assets/web-x9pvmNMf.js +1 -0
  249. package/dist/interface/assets/workbox-window.prod.es5-DkzC-kEO.js +1 -0
  250. package/dist/interface/assets/worker-base-ybazWkNy.js +1337 -0
  251. package/dist/interface/assets/worker-yaml-crtWQpDN.js +5824 -0
  252. package/dist/interface/assets/zoom-in-zoFmMkYM.js +1 -0
  253. package/dist/interface/index.html +96 -45
  254. package/dist/interface/manifest.webmanifest +1 -1
  255. package/dist/interface/og-share.png +0 -0
  256. package/dist/interface/sw.js +1 -1
  257. package/dist/interface/workbox-5f44db27.js +1 -0
  258. package/dist/server/package.json +73 -79
  259. package/dist/server/requirements.txt +9 -14
  260. package/dist/server/src/_camera_ui_tools/camera_ui_common/__init__.py +19 -11
  261. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/__init__.py +23 -0
  262. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/object_path.py +35 -22
  263. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/promise.py +41 -0
  264. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/reactive.py +17 -14
  265. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/signal_handler.py +12 -4
  266. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/subscribed.py +15 -2
  267. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/task.py +9 -3
  268. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/thread.py +10 -2
  269. package/dist/server/src/_camera_ui_tools/camera_ui_common/common_utils/utils.py +21 -13
  270. package/dist/server/src/_camera_ui_tools/camera_ui_common/logger_service/__init__.py +8 -0
  271. package/dist/server/src/_camera_ui_tools/camera_ui_common/logger_service/logger.py +237 -99
  272. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/__init__.py +77 -0
  273. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/channel.py +321 -0
  274. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/chunking.py +290 -0
  275. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/client.py +1694 -0
  276. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/codec.py +73 -0
  277. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/decorators.py +307 -0
  278. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/errors.py +76 -0
  279. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/executor.py +29 -0
  280. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/handler.py +523 -0
  281. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/service.py +524 -0
  282. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/svcm.py +15 -0
  283. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/types.py +427 -0
  284. package/dist/server/src/_camera_ui_tools/camera_ui_rpc/utils.py +332 -0
  285. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/__init__.py +515 -0
  286. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/__init__.py +173 -0
  287. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/config.py +256 -0
  288. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/detection.py +135 -0
  289. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/device.py +432 -0
  290. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/enums.py +111 -0
  291. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/events.py +146 -0
  292. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/frames.py +21 -0
  293. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/camera/streaming.py +188 -0
  294. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/__init__.py +92 -0
  295. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/camera_config_internal.py +46 -0
  296. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/camera_enums.py +9 -0
  297. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/camera_wire.py +15 -0
  298. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/event_emitter.py +102 -0
  299. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/manager_rpc.py +27 -0
  300. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/sensor_rpc.py +89 -0
  301. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/sensor_triggers.py +4 -0
  302. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/shared_utils.py +73 -0
  303. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/internal/streaming_internal.py +16 -0
  304. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/manager/__init__.py +348 -0
  305. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/observable/__init__.py +557 -0
  306. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/__init__.py +104 -0
  307. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/api.py +137 -0
  308. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/contract.py +164 -0
  309. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/helper.py +242 -0
  310. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/interfaces.py +427 -0
  311. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/notifier.py +142 -0
  312. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/plugin/oauth.py +150 -0
  313. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/__init__.py +203 -0
  314. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/audio.py +241 -0
  315. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/base.py +551 -0
  316. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/battery.py +167 -0
  317. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/classifier.py +196 -0
  318. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/clip.py +67 -0
  319. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/contact.py +88 -0
  320. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/detection.py +60 -0
  321. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/doorbell.py +122 -0
  322. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/face.py +184 -0
  323. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/garage.py +174 -0
  324. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/humidity.py +79 -0
  325. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/leak.py +88 -0
  326. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/license_plate.py +186 -0
  327. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/light.py +157 -0
  328. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/lock.py +149 -0
  329. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/motion.py +203 -0
  330. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/object.py +210 -0
  331. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/occupancy.py +88 -0
  332. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/ptz.py +256 -0
  333. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/security_system.py +157 -0
  334. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/siren.py +150 -0
  335. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/smoke.py +88 -0
  336. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/spec.py +56 -0
  337. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/switch.py +107 -0
  338. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/sensor/temperature.py +80 -0
  339. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/storage/__init__.py +695 -0
  340. package/dist/server/src/_camera_ui_tools/camera_ui_sdk/types.py +54 -0
  341. package/dist/server/src/api/controllers/api.controller.d.ts +2 -2
  342. package/dist/server/src/api/controllers/api.controller.js +3 -3
  343. package/dist/server/src/api/controllers/api.controller.js.map +1 -1
  344. package/dist/server/src/api/controllers/auth.controller.d.ts +20 -5
  345. package/dist/server/src/api/controllers/auth.controller.js +418 -134
  346. package/dist/server/src/api/controllers/auth.controller.js.map +1 -1
  347. package/dist/server/src/api/controllers/automations.controller.d.ts +17 -0
  348. package/dist/server/src/api/controllers/automations.controller.js +146 -0
  349. package/dist/server/src/api/controllers/automations.controller.js.map +1 -0
  350. package/dist/server/src/api/controllers/backup.controller.js +0 -1
  351. package/dist/server/src/api/controllers/backup.controller.js.map +1 -1
  352. package/dist/server/src/api/controllers/cameras.controller.d.ts +14 -5
  353. package/dist/server/src/api/controllers/cameras.controller.js +490 -69
  354. package/dist/server/src/api/controllers/cameras.controller.js.map +1 -1
  355. package/dist/server/src/api/controllers/config.controller.d.ts +2 -2
  356. package/dist/server/src/api/controllers/config.controller.js +2 -2
  357. package/dist/server/src/api/controllers/config.controller.js.map +1 -1
  358. package/dist/server/src/api/controllers/download.controller.d.ts +7 -0
  359. package/dist/server/src/api/controllers/download.controller.js +12 -0
  360. package/dist/server/src/api/controllers/download.controller.js.map +1 -0
  361. package/dist/server/src/api/controllers/files.controller.js.map +1 -1
  362. package/dist/server/src/api/controllers/frameWorkers.controller.d.ts +1 -1
  363. package/dist/server/src/api/controllers/frameWorkers.controller.js +1 -1
  364. package/dist/server/src/api/controllers/frameWorkers.controller.js.map +1 -1
  365. package/dist/server/src/api/controllers/instances.controller.d.ts +15 -0
  366. package/dist/server/src/api/controllers/instances.controller.js +100 -0
  367. package/dist/server/src/api/controllers/instances.controller.js.map +1 -0
  368. package/dist/server/src/api/controllers/notifications.controller.d.ts +15 -0
  369. package/dist/server/src/api/controllers/notifications.controller.js +121 -0
  370. package/dist/server/src/api/controllers/notifications.controller.js.map +1 -0
  371. package/dist/server/src/api/controllers/oauthCallback.controller.d.ts +15 -0
  372. package/dist/server/src/api/controllers/oauthCallback.controller.js +53 -0
  373. package/dist/server/src/api/controllers/oauthCallback.controller.js.map +1 -0
  374. package/dist/server/src/api/controllers/plugins.controller.d.ts +5 -9
  375. package/dist/server/src/api/controllers/plugins.controller.js +129 -246
  376. package/dist/server/src/api/controllers/plugins.controller.js.map +1 -1
  377. package/dist/server/src/api/controllers/remote.controller.d.ts +27 -0
  378. package/dist/server/src/api/controllers/remote.controller.js +247 -0
  379. package/dist/server/src/api/controllers/remote.controller.js.map +1 -0
  380. package/dist/server/src/api/controllers/server.controller.d.ts +24 -0
  381. package/dist/server/src/api/controllers/server.controller.js +236 -0
  382. package/dist/server/src/api/controllers/server.controller.js.map +1 -0
  383. package/dist/server/src/api/controllers/shares.controller.d.ts +12 -0
  384. package/dist/server/src/api/controllers/shares.controller.js +121 -0
  385. package/dist/server/src/api/controllers/shares.controller.js.map +1 -0
  386. package/dist/server/src/api/controllers/tunnel.controller.d.ts +9 -0
  387. package/dist/server/src/api/controllers/tunnel.controller.js +39 -0
  388. package/dist/server/src/api/controllers/tunnel.controller.js.map +1 -0
  389. package/dist/server/src/api/controllers/users.controller.d.ts +2 -2
  390. package/dist/server/src/api/controllers/users.controller.js +11 -2
  391. package/dist/server/src/api/controllers/users.controller.js.map +1 -1
  392. package/dist/server/src/api/controllers/workers.controller.d.ts +14 -0
  393. package/dist/server/src/api/controllers/workers.controller.js +69 -0
  394. package/dist/server/src/api/controllers/workers.controller.js.map +1 -0
  395. package/dist/server/src/api/database/checks.js +2 -2
  396. package/dist/server/src/api/database/checks.js.map +1 -1
  397. package/dist/server/src/api/database/constants.d.ts +10 -1
  398. package/dist/server/src/api/database/constants.js +10 -1
  399. package/dist/server/src/api/database/constants.js.map +1 -1
  400. package/dist/server/src/api/database/index.d.ts +24 -12
  401. package/dist/server/src/api/database/index.js +182 -126
  402. package/dist/server/src/api/database/index.js.map +1 -1
  403. package/dist/server/src/api/database/migration.d.ts +4 -13
  404. package/dist/server/src/api/database/migration.js +20 -80
  405. package/dist/server/src/api/database/migration.js.map +1 -1
  406. package/dist/server/src/api/database/migrations/index.d.ts +2 -0
  407. package/dist/server/src/api/database/migrations/index.js +24 -0
  408. package/dist/server/src/api/database/migrations/index.js.map +1 -0
  409. package/dist/server/src/api/database/migrations/types.d.ts +13 -0
  410. package/dist/server/src/api/database/migrations/types.js.map +1 -0
  411. package/dist/server/src/api/database/selfcheck.js +3 -0
  412. package/dist/server/src/api/database/selfcheck.js.map +1 -1
  413. package/dist/server/src/api/database/types.d.ts +173 -28
  414. package/dist/server/src/api/index.d.ts +8 -2
  415. package/dist/server/src/api/index.js +122 -43
  416. package/dist/server/src/api/index.js.map +1 -1
  417. package/dist/server/src/api/middlewares/authPermission.middleware.d.ts +4 -4
  418. package/dist/server/src/api/middlewares/authPermission.middleware.js +8 -8
  419. package/dist/server/src/api/middlewares/authPermission.middleware.js.map +1 -1
  420. package/dist/server/src/api/middlewares/authValidation.middleware.d.ts +5 -2
  421. package/dist/server/src/api/middlewares/authValidation.middleware.js +75 -114
  422. package/dist/server/src/api/middlewares/authValidation.middleware.js.map +1 -1
  423. package/dist/server/src/api/middlewares/pagination.middleware.d.ts +1 -1
  424. package/dist/server/src/api/middlewares/pagination.middleware.js +2 -2
  425. package/dist/server/src/api/middlewares/pagination.middleware.js.map +1 -1
  426. package/dist/server/src/api/middlewares/socketAuth.middleware.d.ts +2 -2
  427. package/dist/server/src/api/middlewares/socketAuth.middleware.js +5 -4
  428. package/dist/server/src/api/middlewares/socketAuth.middleware.js.map +1 -1
  429. package/dist/server/src/api/plugins/header.plugin.js +1 -1
  430. package/dist/server/src/api/plugins/header.plugin.js.map +1 -1
  431. package/dist/server/src/api/plugins/logger.plugin.js +13 -10
  432. package/dist/server/src/api/plugins/logger.plugin.js.map +1 -1
  433. package/dist/server/src/api/plugins/proxy.plugin.js +76 -105
  434. package/dist/server/src/api/plugins/proxy.plugin.js.map +1 -1
  435. package/dist/server/src/api/plugins/system.plugin.js.map +1 -1
  436. package/dist/server/src/api/plugins/useragent.plugin.d.ts +2 -2
  437. package/dist/server/src/api/plugins/useragent.plugin.js +2 -2
  438. package/dist/server/src/api/plugins/useragent.plugin.js.map +1 -1
  439. package/dist/server/src/api/routes/api.routes.js +18 -2
  440. package/dist/server/src/api/routes/api.routes.js.map +1 -1
  441. package/dist/server/src/api/routes/auth.routes.js +131 -9
  442. package/dist/server/src/api/routes/auth.routes.js.map +1 -1
  443. package/dist/server/src/api/routes/automations.routes.d.ts +2 -0
  444. package/dist/server/src/api/routes/automations.routes.js +128 -0
  445. package/dist/server/src/api/routes/automations.routes.js.map +1 -0
  446. package/dist/server/src/api/routes/backup.routes.js +6 -0
  447. package/dist/server/src/api/routes/backup.routes.js.map +1 -1
  448. package/dist/server/src/api/routes/cameras.routes.js +346 -33
  449. package/dist/server/src/api/routes/cameras.routes.js.map +1 -1
  450. package/dist/server/src/api/routes/config.routes.js +26 -4
  451. package/dist/server/src/api/routes/config.routes.js.map +1 -1
  452. package/dist/server/src/api/routes/download.routes.d.ts +2 -0
  453. package/dist/server/src/api/routes/download.routes.js +16 -0
  454. package/dist/server/src/api/routes/download.routes.js.map +1 -0
  455. package/dist/server/src/api/routes/files.routes.js +7 -1
  456. package/dist/server/src/api/routes/files.routes.js.map +1 -1
  457. package/dist/server/src/api/routes/frameWorkers.routes.js +26 -4
  458. package/dist/server/src/api/routes/frameWorkers.routes.js.map +1 -1
  459. package/dist/server/src/api/routes/index.d.ts +1 -0
  460. package/dist/server/src/api/routes/index.js +23 -3
  461. package/dist/server/src/api/routes/index.js.map +1 -1
  462. package/dist/server/src/api/routes/instances.routes.d.ts +2 -0
  463. package/dist/server/src/api/routes/instances.routes.js +105 -0
  464. package/dist/server/src/api/routes/instances.routes.js.map +1 -0
  465. package/dist/server/src/api/routes/notifications.routes.d.ts +2 -0
  466. package/dist/server/src/api/routes/notifications.routes.js +102 -0
  467. package/dist/server/src/api/routes/notifications.routes.js.map +1 -0
  468. package/dist/server/src/api/routes/oauthCallback.routes.d.ts +2 -0
  469. package/dist/server/src/api/routes/oauthCallback.routes.js +17 -0
  470. package/dist/server/src/api/routes/oauthCallback.routes.js.map +1 -0
  471. package/dist/server/src/api/routes/plugins.routes.js +259 -95
  472. package/dist/server/src/api/routes/plugins.routes.js.map +1 -1
  473. package/dist/server/src/api/routes/remote.routes.d.ts +2 -0
  474. package/dist/server/src/api/routes/remote.routes.js +164 -0
  475. package/dist/server/src/api/routes/remote.routes.js.map +1 -0
  476. package/dist/server/src/api/routes/server.routes.d.ts +2 -0
  477. package/dist/server/src/api/routes/server.routes.js +130 -0
  478. package/dist/server/src/api/routes/server.routes.js.map +1 -0
  479. package/dist/server/src/api/routes/shares.routes.d.ts +2 -0
  480. package/dist/server/src/api/routes/shares.routes.js +71 -0
  481. package/dist/server/src/api/routes/shares.routes.js.map +1 -0
  482. package/dist/server/src/api/routes/tunnel.routes.d.ts +2 -0
  483. package/dist/server/src/api/routes/tunnel.routes.js +14 -0
  484. package/dist/server/src/api/routes/tunnel.routes.js.map +1 -0
  485. package/dist/server/src/api/routes/users.routes.js +92 -12
  486. package/dist/server/src/api/routes/users.routes.js.map +1 -1
  487. package/dist/server/src/api/routes/workers.routes.d.ts +2 -0
  488. package/dist/server/src/api/routes/workers.routes.js +71 -0
  489. package/dist/server/src/api/routes/workers.routes.js.map +1 -0
  490. package/dist/server/src/api/schemas/auth.schema.d.ts +35 -0
  491. package/dist/server/src/api/schemas/auth.schema.js +37 -0
  492. package/dist/server/src/api/schemas/auth.schema.js.map +1 -0
  493. package/dist/server/src/api/schemas/automations.schema.d.ts +151 -0
  494. package/dist/server/src/api/schemas/automations.schema.js +84 -0
  495. package/dist/server/src/api/schemas/automations.schema.js.map +1 -0
  496. package/dist/server/src/api/schemas/backup.schema.d.ts +15 -190
  497. package/dist/server/src/api/schemas/backup.schema.js +5 -23
  498. package/dist/server/src/api/schemas/backup.schema.js.map +1 -1
  499. package/dist/server/src/api/schemas/cameras.schema.d.ts +1062 -1647
  500. package/dist/server/src/api/schemas/cameras.schema.js +218 -49
  501. package/dist/server/src/api/schemas/cameras.schema.js.map +1 -1
  502. package/dist/server/src/api/schemas/common.schema.d.ts +7 -0
  503. package/dist/server/src/api/schemas/common.schema.js +7 -0
  504. package/dist/server/src/api/schemas/common.schema.js.map +1 -0
  505. package/dist/server/src/api/schemas/config.schema.d.ts +41 -79
  506. package/dist/server/src/api/schemas/config.schema.js +19 -1
  507. package/dist/server/src/api/schemas/config.schema.js.map +1 -1
  508. package/dist/server/src/api/schemas/download.schema.d.ts +5 -0
  509. package/dist/server/src/api/schemas/download.schema.js +5 -0
  510. package/dist/server/src/api/schemas/download.schema.js.map +1 -0
  511. package/dist/server/src/api/schemas/files.schema.d.ts +5 -0
  512. package/dist/server/src/api/schemas/files.schema.js +5 -0
  513. package/dist/server/src/api/schemas/files.schema.js.map +1 -0
  514. package/dist/server/src/api/schemas/frameWorkers.schema.d.ts +5 -0
  515. package/dist/server/src/api/schemas/frameWorkers.schema.js +5 -0
  516. package/dist/server/src/api/schemas/frameWorkers.schema.js.map +1 -0
  517. package/dist/server/src/api/schemas/go2rtc.schema.d.ts +90 -640
  518. package/dist/server/src/api/schemas/go2rtc.schema.js +1 -16
  519. package/dist/server/src/api/schemas/go2rtc.schema.js.map +1 -1
  520. package/dist/server/src/api/schemas/instances.schema.d.ts +23 -0
  521. package/dist/server/src/api/schemas/instances.schema.js +24 -0
  522. package/dist/server/src/api/schemas/instances.schema.js.map +1 -0
  523. package/dist/server/src/api/schemas/notifications.schema.d.ts +26 -0
  524. package/dist/server/src/api/schemas/notifications.schema.js +25 -0
  525. package/dist/server/src/api/schemas/notifications.schema.js.map +1 -0
  526. package/dist/server/src/api/schemas/oauthCallback.schema.d.ts +11 -0
  527. package/dist/server/src/api/schemas/oauthCallback.schema.js +10 -0
  528. package/dist/server/src/api/schemas/oauthCallback.schema.js.map +1 -0
  529. package/dist/server/src/api/schemas/plugins.schema.d.ts +62 -59
  530. package/dist/server/src/api/schemas/plugins.schema.js +54 -81
  531. package/dist/server/src/api/schemas/plugins.schema.js.map +1 -1
  532. package/dist/server/src/api/schemas/remote.schema.d.ts +44 -0
  533. package/dist/server/src/api/schemas/remote.schema.js +80 -0
  534. package/dist/server/src/api/schemas/remote.schema.js.map +1 -0
  535. package/dist/server/src/api/schemas/server.schema.d.ts +9 -0
  536. package/dist/server/src/api/schemas/server.schema.js +12 -0
  537. package/dist/server/src/api/schemas/server.schema.js.map +1 -0
  538. package/dist/server/src/api/schemas/shares.schema.d.ts +21 -0
  539. package/dist/server/src/api/schemas/shares.schema.js +22 -0
  540. package/dist/server/src/api/schemas/shares.schema.js.map +1 -0
  541. package/dist/server/src/api/schemas/storage.schema.d.ts +5 -15
  542. package/dist/server/src/api/schemas/users.schema.d.ts +294 -786
  543. package/dist/server/src/api/schemas/users.schema.js +76 -39
  544. package/dist/server/src/api/schemas/users.schema.js.map +1 -1
  545. package/dist/server/src/api/schemas/workers.schema.d.ts +14 -0
  546. package/dist/server/src/api/schemas/workers.schema.js +12 -0
  547. package/dist/server/src/api/schemas/workers.schema.js.map +1 -0
  548. package/dist/server/src/api/services/auth.service.d.ts +27 -17
  549. package/dist/server/src/api/services/auth.service.js +106 -134
  550. package/dist/server/src/api/services/auth.service.js.map +1 -1
  551. package/dist/server/src/api/services/automations.service.d.ts +24 -0
  552. package/dist/server/src/api/services/automations.service.js +157 -0
  553. package/dist/server/src/api/services/automations.service.js.map +1 -0
  554. package/dist/server/src/api/services/backup.service.js +0 -5
  555. package/dist/server/src/api/services/backup.service.js.map +1 -1
  556. package/dist/server/src/api/services/cameras.service.d.ts +28 -15
  557. package/dist/server/src/api/services/cameras.service.js +532 -305
  558. package/dist/server/src/api/services/cameras.service.js.map +1 -1
  559. package/dist/server/src/api/services/downloads.service.d.ts +9 -0
  560. package/dist/server/src/api/services/downloads.service.js +20 -0
  561. package/dist/server/src/api/services/downloads.service.js.map +1 -0
  562. package/dist/server/src/api/services/instances.service.d.ts +52 -0
  563. package/dist/server/src/api/services/instances.service.js +344 -0
  564. package/dist/server/src/api/services/instances.service.js.map +1 -0
  565. package/dist/server/src/api/services/notifications.service.d.ts +21 -0
  566. package/dist/server/src/api/services/notifications.service.js +48 -0
  567. package/dist/server/src/api/services/notifications.service.js.map +1 -0
  568. package/dist/server/src/api/services/plugins.service.js +31 -35
  569. package/dist/server/src/api/services/plugins.service.js.map +1 -1
  570. package/dist/server/src/api/services/remote.service.d.ts +35 -0
  571. package/dist/server/src/api/services/remote.service.js +207 -0
  572. package/dist/server/src/api/services/remote.service.js.map +1 -0
  573. package/dist/server/src/api/services/server.service.d.ts +15 -0
  574. package/dist/server/src/api/services/server.service.js +75 -0
  575. package/dist/server/src/api/services/server.service.js.map +1 -0
  576. package/dist/server/src/api/services/shares.service.d.ts +46 -0
  577. package/dist/server/src/api/services/shares.service.js +233 -0
  578. package/dist/server/src/api/services/shares.service.js.map +1 -0
  579. package/dist/server/src/api/services/twoFactor.service.d.ts +22 -0
  580. package/dist/server/src/api/services/twoFactor.service.js +81 -0
  581. package/dist/server/src/api/services/twoFactor.service.js.map +1 -0
  582. package/dist/server/src/api/services/users.service.d.ts +9 -5
  583. package/dist/server/src/api/services/users.service.js +157 -121
  584. package/dist/server/src/api/services/users.service.js.map +1 -1
  585. package/dist/server/src/api/services/workers.service.d.ts +5 -0
  586. package/dist/server/src/api/services/workers.service.js +19 -0
  587. package/dist/server/src/api/services/workers.service.js.map +1 -0
  588. package/dist/server/src/api/types/index.d.ts +350 -133
  589. package/dist/server/src/api/types/index.js +5 -4
  590. package/dist/server/src/api/types/index.js.map +1 -1
  591. package/dist/server/src/api/utils/cert.js +1 -1
  592. package/dist/server/src/api/utils/cert.js.map +1 -1
  593. package/dist/server/src/api/utils/encryption.d.ts +5 -0
  594. package/dist/server/src/api/utils/encryption.js +25 -0
  595. package/dist/server/src/api/utils/encryption.js.map +1 -0
  596. package/dist/server/src/api/utils/plugin.d.ts +4 -0
  597. package/dist/server/src/api/utils/plugin.js +8 -0
  598. package/dist/server/src/api/utils/plugin.js.map +1 -0
  599. package/dist/server/src/api/utils/regex.d.ts +3 -0
  600. package/dist/server/src/api/utils/regex.js +4 -0
  601. package/dist/server/src/api/utils/regex.js.map +1 -0
  602. package/dist/server/src/api/utils/upload.d.ts +3 -0
  603. package/dist/server/src/api/utils/upload.js +23 -0
  604. package/dist/server/src/api/utils/upload.js.map +1 -0
  605. package/dist/server/src/api/websocket/index.js +18 -16
  606. package/dist/server/src/api/websocket/index.js.map +1 -1
  607. package/dist/server/src/api/websocket/nsp/cameras.d.ts +21 -0
  608. package/dist/server/src/api/websocket/nsp/cameras.js +152 -0
  609. package/dist/server/src/api/websocket/nsp/cameras.js.map +1 -0
  610. package/dist/server/src/api/websocket/nsp/logs.d.ts +1 -1
  611. package/dist/server/src/api/websocket/nsp/logs.js +65 -52
  612. package/dist/server/src/api/websocket/nsp/logs.js.map +1 -1
  613. package/dist/server/src/api/websocket/nsp/main.d.ts +4 -1
  614. package/dist/server/src/api/websocket/nsp/main.js +29 -1
  615. package/dist/server/src/api/websocket/nsp/main.js.map +1 -1
  616. package/dist/server/src/api/websocket/nsp/metrics.js +4 -4
  617. package/dist/server/src/api/websocket/nsp/metrics.js.map +1 -1
  618. package/dist/server/src/api/websocket/nsp/notifications.d.ts +3 -3
  619. package/dist/server/src/api/websocket/nsp/notifications.js +10 -11
  620. package/dist/server/src/api/websocket/nsp/notifications.js.map +1 -1
  621. package/dist/server/src/api/websocket/nsp/server.d.ts +4 -4
  622. package/dist/server/src/api/websocket/nsp/server.js +48 -27
  623. package/dist/server/src/api/websocket/nsp/server.js.map +1 -1
  624. package/dist/server/src/api/websocket/nsp/status.d.ts +3 -3
  625. package/dist/server/src/api/websocket/nsp/status.js +3 -3
  626. package/dist/server/src/api/websocket/nsp/status.js.map +1 -1
  627. package/dist/server/src/api/websocket/nsp/workers.d.ts +17 -0
  628. package/dist/server/src/api/websocket/nsp/workers.js +46 -0
  629. package/dist/server/src/api/websocket/nsp/workers.js.map +1 -0
  630. package/dist/server/src/api/websocket/types.d.ts +2 -1
  631. package/dist/server/src/api.d.ts +11 -16
  632. package/dist/server/src/api.js +62 -48
  633. package/dist/server/src/api.js.map +1 -1
  634. package/dist/server/src/automations/actions/cameraControl.d.ts +2 -0
  635. package/dist/server/src/automations/actions/cameraControl.js +35 -0
  636. package/dist/server/src/automations/actions/cameraControl.js.map +1 -0
  637. package/dist/server/src/automations/actions/delay.d.ts +2 -0
  638. package/dist/server/src/automations/actions/delay.js +8 -0
  639. package/dist/server/src/automations/actions/delay.js.map +1 -0
  640. package/dist/server/src/automations/actions/http.d.ts +2 -0
  641. package/dist/server/src/automations/actions/http.js +44 -0
  642. package/dist/server/src/automations/actions/http.js.map +1 -0
  643. package/dist/server/src/automations/actions/index.d.ts +4 -0
  644. package/dist/server/src/automations/actions/index.js +20 -0
  645. package/dist/server/src/automations/actions/index.js.map +1 -0
  646. package/dist/server/src/automations/actions/notification.d.ts +2 -0
  647. package/dist/server/src/automations/actions/notification.js +76 -0
  648. package/dist/server/src/automations/actions/notification.js.map +1 -0
  649. package/dist/server/src/automations/actions/plugin.d.ts +3 -0
  650. package/dist/server/src/automations/actions/plugin.js +73 -0
  651. package/dist/server/src/automations/actions/plugin.js.map +1 -0
  652. package/dist/server/src/automations/actions/sensor.d.ts +2 -0
  653. package/dist/server/src/automations/actions/sensor.js +17 -0
  654. package/dist/server/src/automations/actions/sensor.js.map +1 -0
  655. package/dist/server/src/automations/actions/snapshot.d.ts +2 -0
  656. package/dist/server/src/automations/actions/snapshot.js +20 -0
  657. package/dist/server/src/automations/actions/snapshot.js.map +1 -0
  658. package/dist/server/src/automations/actions/types.d.ts +14 -0
  659. package/dist/server/src/automations/actions/types.js.map +1 -0
  660. package/dist/server/src/automations/actions/variable.d.ts +2 -0
  661. package/dist/server/src/automations/actions/variable.js +17 -0
  662. package/dist/server/src/automations/actions/variable.js.map +1 -0
  663. package/dist/server/src/automations/conditions/ifelse.d.ts +3 -0
  664. package/dist/server/src/automations/conditions/ifelse.js +39 -0
  665. package/dist/server/src/automations/conditions/ifelse.js.map +1 -0
  666. package/dist/server/src/automations/conditions/index.d.ts +4 -0
  667. package/dist/server/src/automations/conditions/index.js +20 -0
  668. package/dist/server/src/automations/conditions/index.js.map +1 -0
  669. package/dist/server/src/automations/conditions/sensorState.d.ts +3 -0
  670. package/dist/server/src/automations/conditions/sensorState.js +21 -0
  671. package/dist/server/src/automations/conditions/sensorState.js.map +1 -0
  672. package/dist/server/src/automations/conditions/switch.d.ts +3 -0
  673. package/dist/server/src/automations/conditions/switch.js +9 -0
  674. package/dist/server/src/automations/conditions/switch.js.map +1 -0
  675. package/dist/server/src/automations/conditions/time.d.ts +3 -0
  676. package/dist/server/src/automations/conditions/time.js +24 -0
  677. package/dist/server/src/automations/conditions/time.js.map +1 -0
  678. package/dist/server/src/automations/conditions/types.d.ts +7 -0
  679. package/dist/server/src/automations/conditions/types.js.map +1 -0
  680. package/dist/server/src/automations/context.d.ts +48 -0
  681. package/dist/server/src/automations/context.js +146 -0
  682. package/dist/server/src/automations/context.js.map +1 -0
  683. package/dist/server/src/automations/engine.d.ts +35 -0
  684. package/dist/server/src/automations/engine.js +321 -0
  685. package/dist/server/src/automations/engine.js.map +1 -0
  686. package/dist/server/src/automations/haversine.d.ts +1 -0
  687. package/dist/server/src/automations/haversine.js +9 -0
  688. package/dist/server/src/automations/haversine.js.map +1 -0
  689. package/dist/server/src/automations/parseValue.d.ts +1 -0
  690. package/dist/server/src/automations/parseValue.js +11 -0
  691. package/dist/server/src/automations/parseValue.js.map +1 -0
  692. package/dist/server/src/automations/pluginMethodRegistry.d.ts +37 -0
  693. package/dist/server/src/automations/pluginMethodRegistry.js +162 -0
  694. package/dist/server/src/automations/pluginMethodRegistry.js.map +1 -0
  695. package/dist/server/src/automations/runner.d.ts +23 -0
  696. package/dist/server/src/automations/runner.js +166 -0
  697. package/dist/server/src/automations/runner.js.map +1 -0
  698. package/dist/server/src/automations/triggers/detection.d.ts +3 -0
  699. package/dist/server/src/automations/triggers/detection.js +102 -0
  700. package/dist/server/src/automations/triggers/detection.js.map +1 -0
  701. package/dist/server/src/automations/triggers/geofence.d.ts +13 -0
  702. package/dist/server/src/automations/triggers/geofence.js +8 -0
  703. package/dist/server/src/automations/triggers/geofence.js.map +1 -0
  704. package/dist/server/src/automations/triggers/index.d.ts +9 -0
  705. package/dist/server/src/automations/triggers/index.js +7 -0
  706. package/dist/server/src/automations/triggers/index.js.map +1 -0
  707. package/dist/server/src/automations/triggers/schedule.d.ts +3 -0
  708. package/dist/server/src/automations/triggers/schedule.js +54 -0
  709. package/dist/server/src/automations/triggers/schedule.js.map +1 -0
  710. package/dist/server/src/automations/triggers/sensor.d.ts +3 -0
  711. package/dist/server/src/automations/triggers/sensor.js +44 -0
  712. package/dist/server/src/automations/triggers/sensor.js.map +1 -0
  713. package/dist/server/src/automations/triggers/system.d.ts +3 -0
  714. package/dist/server/src/automations/triggers/system.js +31 -0
  715. package/dist/server/src/automations/triggers/system.js.map +1 -0
  716. package/dist/server/src/automations/triggers/types.d.ts +12 -0
  717. package/dist/server/src/automations/triggers/types.js.map +1 -0
  718. package/dist/server/src/automations/triggers/webhook.d.ts +7 -0
  719. package/dist/server/src/automations/triggers/webhook.js +8 -0
  720. package/dist/server/src/automations/triggers/webhook.js.map +1 -0
  721. package/dist/server/src/automations/utilities/imageInput.d.ts +2 -0
  722. package/dist/server/src/automations/utilities/imageInput.js +139 -0
  723. package/dist/server/src/automations/utilities/imageInput.js.map +1 -0
  724. package/dist/server/src/automations/utilities/index.d.ts +2 -0
  725. package/dist/server/src/automations/utilities/index.js +7 -0
  726. package/dist/server/src/automations/utilities/index.js.map +1 -0
  727. package/dist/server/src/automations/utilities/output.d.ts +2 -0
  728. package/dist/server/src/automations/utilities/output.js +10 -0
  729. package/dist/server/src/automations/utilities/output.js.map +1 -0
  730. package/dist/server/src/camera/controller.d.ts +56 -45
  731. package/dist/server/src/camera/controller.js +468 -326
  732. package/dist/server/src/camera/controller.js.map +1 -1
  733. package/dist/server/src/camera/decoder/audio-source.d.ts +34 -0
  734. package/dist/server/src/camera/decoder/audio-source.js +170 -0
  735. package/dist/server/src/camera/decoder/audio-source.js.map +1 -0
  736. package/dist/server/src/camera/decoder/cascade-manager.d.ts +22 -0
  737. package/dist/server/src/camera/decoder/cascade-manager.js +82 -0
  738. package/dist/server/src/camera/decoder/cascade-manager.js.map +1 -0
  739. package/dist/server/src/camera/decoder/child.d.ts +28 -0
  740. package/dist/server/src/camera/decoder/child.js +187 -0
  741. package/dist/server/src/camera/decoder/child.js.map +1 -0
  742. package/dist/server/src/camera/decoder/detection-coordinator.d.ts +142 -0
  743. package/dist/server/src/camera/decoder/detection-coordinator.js +1844 -0
  744. package/dist/server/src/camera/decoder/detection-coordinator.js.map +1 -0
  745. package/dist/server/src/camera/decoder/detection-pipeline.d.ts +41 -0
  746. package/dist/server/src/camera/decoder/detection-pipeline.js +216 -0
  747. package/dist/server/src/camera/decoder/detection-pipeline.js.map +1 -0
  748. package/dist/server/src/camera/decoder/dwell-manager.d.ts +23 -0
  749. package/dist/server/src/camera/decoder/dwell-manager.js +82 -0
  750. package/dist/server/src/camera/decoder/dwell-manager.js.map +1 -0
  751. package/dist/server/src/camera/decoder/event-manager.d.ts +97 -0
  752. package/dist/server/src/camera/decoder/event-manager.js +674 -0
  753. package/dist/server/src/camera/decoder/event-manager.js.map +1 -0
  754. package/dist/server/src/camera/decoder/frame-scaler.d.ts +53 -0
  755. package/dist/server/src/camera/decoder/frame-scaler.js +136 -0
  756. package/dist/server/src/camera/decoder/frame-scaler.js.map +1 -0
  757. package/dist/server/src/camera/decoder/frame-source.d.ts +54 -0
  758. package/dist/server/src/camera/decoder/frame-source.js +341 -0
  759. package/dist/server/src/camera/decoder/frame-source.js.map +1 -0
  760. package/dist/server/src/camera/decoder/ptz-autotracker.d.ts +57 -0
  761. package/dist/server/src/camera/decoder/ptz-autotracker.js +369 -0
  762. package/dist/server/src/camera/decoder/ptz-autotracker.js.map +1 -0
  763. package/dist/server/src/camera/decoder/types.d.ts +7 -0
  764. package/dist/server/src/camera/decoder/types.js +6 -0
  765. package/dist/server/src/camera/decoder/types.js.map +1 -0
  766. package/dist/server/src/camera/decoder/worker.d.ts +48 -0
  767. package/dist/server/src/camera/decoder/worker.js +465 -0
  768. package/dist/server/src/camera/decoder/worker.js.map +1 -0
  769. package/dist/server/src/camera/index.d.ts +43 -59
  770. package/dist/server/src/camera/index.js +72 -438
  771. package/dist/server/src/camera/index.js.map +1 -1
  772. package/dist/server/src/camera/sensors/controller.d.ts +96 -0
  773. package/dist/server/src/camera/sensors/controller.js +517 -0
  774. package/dist/server/src/camera/sensors/controller.js.map +1 -0
  775. package/dist/server/src/camera/sensors/sensor.d.ts +34 -0
  776. package/dist/server/src/camera/sensors/sensor.js +176 -0
  777. package/dist/server/src/camera/sensors/sensor.js.map +1 -0
  778. package/dist/server/src/camera/sensors/types.d.ts +27 -0
  779. package/dist/server/src/camera/sensors/types.js +225 -0
  780. package/dist/server/src/camera/sensors/types.js.map +1 -0
  781. package/dist/server/src/camera/streaming/fmp4-session.d.ts +10 -12
  782. package/dist/server/src/camera/streaming/fmp4-session.js +162 -268
  783. package/dist/server/src/camera/streaming/fmp4-session.js.map +1 -1
  784. package/dist/server/src/camera/streaming/rtp-session.d.ts +19 -0
  785. package/dist/server/src/camera/streaming/rtp-session.js +363 -0
  786. package/dist/server/src/camera/streaming/rtp-session.js.map +1 -0
  787. package/dist/server/src/camera/utils/filter.d.ts +6 -0
  788. package/dist/server/src/camera/utils/filter.js +83 -0
  789. package/dist/server/src/camera/utils/filter.js.map +1 -0
  790. package/dist/server/src/camera/utils.d.ts +2 -7
  791. package/dist/server/src/camera/utils.js +53 -194
  792. package/dist/server/src/camera/utils.js.map +1 -1
  793. package/dist/server/src/go2rtc/api/index.d.ts +16 -0
  794. package/dist/server/src/go2rtc/api/index.js +33 -0
  795. package/dist/server/src/go2rtc/api/index.js.map +1 -0
  796. package/dist/server/src/go2rtc/api/instance.d.ts +7 -0
  797. package/dist/server/src/go2rtc/api/instance.js +49 -0
  798. package/dist/server/src/go2rtc/api/instance.js.map +1 -0
  799. package/dist/server/src/go2rtc/api/manager.d.ts +11 -0
  800. package/dist/server/src/go2rtc/api/manager.js +38 -0
  801. package/dist/server/src/go2rtc/api/manager.js.map +1 -0
  802. package/dist/server/src/go2rtc/api/routes/application.d.ts +9 -0
  803. package/dist/server/src/go2rtc/api/routes/application.js +40 -0
  804. package/dist/server/src/go2rtc/api/routes/application.js.map +1 -0
  805. package/dist/server/src/go2rtc/api/routes/config.d.ts +8 -0
  806. package/dist/server/src/go2rtc/api/routes/config.js +42 -0
  807. package/dist/server/src/go2rtc/api/routes/config.js.map +1 -0
  808. package/dist/server/src/go2rtc/api/routes/discover.d.ts +30 -0
  809. package/dist/server/src/go2rtc/api/routes/discover.js +158 -0
  810. package/dist/server/src/go2rtc/api/routes/discover.js.map +1 -0
  811. package/dist/server/src/go2rtc/api/routes/snapshot.d.ts +8 -0
  812. package/dist/server/src/go2rtc/api/routes/snapshot.js +34 -0
  813. package/dist/server/src/go2rtc/api/routes/snapshot.js.map +1 -0
  814. package/dist/server/src/go2rtc/api/routes/streams.d.ts +18 -0
  815. package/dist/server/src/go2rtc/api/routes/streams.js +161 -0
  816. package/dist/server/src/go2rtc/api/routes/streams.js.map +1 -0
  817. package/dist/server/src/go2rtc/index.d.ts +7 -2
  818. package/dist/server/src/go2rtc/index.js +52 -30
  819. package/dist/server/src/go2rtc/index.js.map +1 -1
  820. package/dist/server/src/go2rtc/types.d.ts +167 -1
  821. package/dist/server/src/go2rtc/types.js +3 -0
  822. package/dist/server/src/go2rtc/types.js.map +1 -1
  823. package/dist/server/src/internal-bus.d.ts +41 -0
  824. package/dist/server/src/internal-bus.js +19 -0
  825. package/dist/server/src/internal-bus.js.map +1 -0
  826. package/dist/server/src/main.d.ts +8 -2
  827. package/dist/server/src/main.js +110 -21
  828. package/dist/server/src/main.js.map +1 -1
  829. package/dist/server/src/manager/coreManager.d.ts +12 -9
  830. package/dist/server/src/manager/coreManager.js +45 -48
  831. package/dist/server/src/manager/coreManager.js.map +1 -1
  832. package/dist/server/src/manager/deviceManager.d.ts +10 -8
  833. package/dist/server/src/manager/deviceManager.js +31 -96
  834. package/dist/server/src/manager/deviceManager.js.map +1 -1
  835. package/dist/server/src/manager/discoveryManager.d.ts +73 -0
  836. package/dist/server/src/manager/discoveryManager.js +800 -0
  837. package/dist/server/src/manager/discoveryManager.js.map +1 -0
  838. package/dist/server/src/manager/downloadManager.d.ts +27 -0
  839. package/dist/server/src/manager/downloadManager.js +353 -0
  840. package/dist/server/src/manager/downloadManager.js.map +1 -0
  841. package/dist/server/src/manager/notificationManager.d.ts +37 -0
  842. package/dist/server/src/manager/notificationManager.js +334 -0
  843. package/dist/server/src/manager/notificationManager.js.map +1 -0
  844. package/dist/server/src/manager/terminalManager.d.ts +27 -0
  845. package/dist/server/src/manager/terminalManager.js +239 -0
  846. package/dist/server/src/manager/terminalManager.js.map +1 -0
  847. package/dist/server/src/manager/types.d.ts +39 -14
  848. package/dist/server/src/manager/types.js +12 -1
  849. package/dist/server/src/manager/types.js.map +1 -1
  850. package/dist/server/src/plugins/index.d.ts +9 -6
  851. package/dist/server/src/plugins/index.js +69 -52
  852. package/dist/server/src/plugins/index.js.map +1 -1
  853. package/dist/server/src/plugins/plugin.d.ts +16 -16
  854. package/dist/server/src/plugins/plugin.js +42 -36
  855. package/dist/server/src/plugins/plugin.js.map +1 -1
  856. package/dist/server/src/plugins/runtime/base.d.ts +5 -14
  857. package/dist/server/src/plugins/runtime/base.js +39 -111
  858. package/dist/server/src/plugins/runtime/base.js.map +1 -1
  859. package/dist/server/src/plugins/runtime/go/index.d.ts +7 -0
  860. package/dist/server/src/plugins/runtime/go/index.js +110 -0
  861. package/dist/server/src/plugins/runtime/go/index.js.map +1 -0
  862. package/dist/server/src/plugins/runtime/index.js +5 -1
  863. package/dist/server/src/plugins/runtime/index.js.map +1 -1
  864. package/dist/server/src/plugins/runtime/node/child.d.ts +7 -6
  865. package/dist/server/src/plugins/runtime/node/child.js +70 -38
  866. package/dist/server/src/plugins/runtime/node/child.js.map +1 -1
  867. package/dist/server/src/plugins/runtime/node/index.d.ts +1 -0
  868. package/dist/server/src/plugins/runtime/node/index.js +31 -5
  869. package/dist/server/src/plugins/runtime/node/index.js.map +1 -1
  870. package/dist/server/src/plugins/runtime/node/pluginApi.d.ts +9 -6
  871. package/dist/server/src/plugins/runtime/node/pluginApi.js +10 -4
  872. package/dist/server/src/plugins/runtime/node/pluginApi.js.map +1 -1
  873. package/dist/server/src/plugins/runtime/node/proxy/cameraDevice.d.ts +27 -15
  874. package/dist/server/src/plugins/runtime/node/proxy/cameraDevice.js +312 -173
  875. package/dist/server/src/plugins/runtime/node/proxy/cameraDevice.js.map +1 -1
  876. package/dist/server/src/plugins/runtime/node/proxy/coreManager.d.ts +7 -10
  877. package/dist/server/src/plugins/runtime/node/proxy/coreManager.js +28 -43
  878. package/dist/server/src/plugins/runtime/node/proxy/coreManager.js.map +1 -1
  879. package/dist/server/src/plugins/runtime/node/proxy/deviceManager.d.ts +7 -11
  880. package/dist/server/src/plugins/runtime/node/proxy/deviceManager.js +40 -57
  881. package/dist/server/src/plugins/runtime/node/proxy/deviceManager.js.map +1 -1
  882. package/dist/server/src/plugins/runtime/node/proxy/downloadManager.d.ts +9 -0
  883. package/dist/server/src/plugins/runtime/node/proxy/downloadManager.js +22 -0
  884. package/dist/server/src/plugins/runtime/node/proxy/downloadManager.js.map +1 -0
  885. package/dist/server/src/plugins/runtime/node/proxy/notificationManager.d.ts +7 -0
  886. package/dist/server/src/plugins/runtime/node/proxy/notificationManager.js +20 -0
  887. package/dist/server/src/plugins/runtime/node/proxy/notificationManager.js.map +1 -0
  888. package/dist/server/src/plugins/runtime/node/proxy/sensor.d.ts +45 -0
  889. package/dist/server/src/plugins/runtime/node/proxy/sensor.js +149 -0
  890. package/dist/server/src/plugins/runtime/node/proxy/sensor.js.map +1 -0
  891. package/dist/server/src/plugins/runtime/node/storage.d.ts +6 -11
  892. package/dist/server/src/plugins/runtime/node/storage.js +69 -46
  893. package/dist/server/src/plugins/runtime/node/storage.js.map +1 -1
  894. package/dist/server/src/plugins/runtime/node/storageController.d.ts +10 -7
  895. package/dist/server/src/plugins/runtime/node/storageController.js +57 -17
  896. package/dist/server/src/plugins/runtime/node/storageController.js.map +1 -1
  897. package/dist/server/src/plugins/runtime/python/camera/utils.py +105 -0
  898. package/dist/server/src/plugins/runtime/python/child.py +108 -68
  899. package/dist/server/src/plugins/runtime/python/index.js.map +1 -1
  900. package/dist/server/src/plugins/runtime/python/namespaces.py +155 -60
  901. package/dist/server/src/plugins/runtime/python/plugin_api.py +72 -6
  902. package/dist/server/src/plugins/runtime/python/proxy/camera_device.py +592 -1522
  903. package/dist/server/src/plugins/runtime/python/proxy/core_manager.py +75 -76
  904. package/dist/server/src/plugins/runtime/python/proxy/device_manager.py +81 -93
  905. package/dist/server/src/plugins/runtime/python/proxy/download_manager.py +33 -0
  906. package/dist/server/src/plugins/runtime/python/proxy/notification_manager.py +31 -0
  907. package/dist/server/src/plugins/runtime/python/proxy/sensor.py +169 -0
  908. package/dist/server/src/plugins/runtime/python/rpc/typings.py +56 -0
  909. package/dist/server/src/plugins/runtime/python/schema.py +54 -19
  910. package/dist/server/src/plugins/runtime/python/storage.py +84 -66
  911. package/dist/server/src/plugins/runtime/python/storage_controller.py +132 -38
  912. package/dist/server/src/plugins/runtime/python/typings.py +78 -152
  913. package/dist/server/src/plugins/schema.d.ts +27 -26
  914. package/dist/server/src/plugins/schema.js +183 -103
  915. package/dist/server/src/plugins/schema.js.map +1 -1
  916. package/dist/server/src/plugins/types.d.ts +2 -14
  917. package/dist/server/src/plugins/types.js +0 -1
  918. package/dist/server/src/plugins/types.js.map +1 -1
  919. package/dist/server/src/plugins/worker.d.ts +7 -7
  920. package/dist/server/src/plugins/worker.js +37 -26
  921. package/dist/server/src/plugins/worker.js.map +1 -1
  922. package/dist/server/src/remote/api/credentialStore.d.ts +18 -0
  923. package/dist/server/src/remote/api/credentialStore.js +101 -0
  924. package/dist/server/src/remote/api/credentialStore.js.map +1 -0
  925. package/dist/server/src/remote/api/index.d.ts +9 -0
  926. package/dist/server/src/remote/api/index.js +16 -0
  927. package/dist/server/src/remote/api/index.js.map +1 -0
  928. package/dist/server/src/remote/api/instance.d.ts +9 -0
  929. package/dist/server/src/remote/api/instance.js +44 -0
  930. package/dist/server/src/remote/api/instance.js.map +1 -0
  931. package/dist/server/src/remote/api/routes/oauth.d.ts +23 -0
  932. package/dist/server/src/remote/api/routes/oauth.js +79 -0
  933. package/dist/server/src/remote/api/routes/oauth.js.map +1 -0
  934. package/dist/server/src/remote/api/routes/server.d.ts +20 -0
  935. package/dist/server/src/remote/api/routes/server.js +58 -0
  936. package/dist/server/src/remote/api/routes/server.js.map +1 -0
  937. package/dist/server/src/remote/index.d.ts +25 -0
  938. package/dist/server/src/remote/index.js +70 -0
  939. package/dist/server/src/remote/index.js.map +1 -0
  940. package/dist/server/src/remote/push.d.ts +15 -0
  941. package/dist/server/src/remote/push.js +85 -0
  942. package/dist/server/src/remote/push.js.map +1 -0
  943. package/dist/server/src/remote/services/cloudflare-managed.d.ts +42 -0
  944. package/dist/server/src/remote/services/cloudflare-managed.js +284 -0
  945. package/dist/server/src/remote/services/cloudflare-managed.js.map +1 -0
  946. package/dist/server/src/remote/services/cloudflare.d.ts +38 -0
  947. package/dist/server/src/remote/services/cloudflare.js +232 -0
  948. package/dist/server/src/remote/services/cloudflare.js.map +1 -0
  949. package/dist/server/src/remote/services/customDomain.d.ts +9 -0
  950. package/dist/server/src/remote/services/customDomain.js +40 -0
  951. package/dist/server/src/remote/services/customDomain.js.map +1 -0
  952. package/dist/server/src/remote/services/index.d.ts +43 -0
  953. package/dist/server/src/remote/services/index.js +285 -0
  954. package/dist/server/src/remote/services/index.js.map +1 -0
  955. package/dist/server/src/remote/services/upnp.js +2 -0
  956. package/dist/server/src/remote/services/upnp.js.map +1 -0
  957. package/dist/server/src/remote/tunnel/client.d.ts +38 -0
  958. package/dist/server/src/remote/tunnel/client.js +241 -0
  959. package/dist/server/src/remote/tunnel/client.js.map +1 -0
  960. package/dist/server/src/remote/tunnel/index.d.ts +15 -0
  961. package/dist/server/src/remote/tunnel/index.js +68 -0
  962. package/dist/server/src/remote/tunnel/index.js.map +1 -0
  963. package/dist/server/src/remote/types.d.ts +31 -0
  964. package/dist/server/src/remote/types.js +2 -0
  965. package/dist/server/src/remote/types.js.map +1 -0
  966. package/dist/server/src/rpc/index.d.ts +24 -25
  967. package/dist/server/src/rpc/index.js +93 -77
  968. package/dist/server/src/rpc/index.js.map +1 -1
  969. package/dist/server/src/rpc/interfaces/config.d.ts +74 -0
  970. package/dist/server/src/rpc/interfaces/config.js +2 -0
  971. package/dist/server/src/rpc/interfaces/config.js.map +1 -0
  972. package/dist/server/src/rpc/interfaces/core.d.ts +25 -0
  973. package/dist/server/src/rpc/interfaces/core.js +2 -0
  974. package/dist/server/src/rpc/interfaces/core.js.map +1 -0
  975. package/dist/server/src/rpc/interfaces/detection.d.ts +70 -0
  976. package/dist/server/src/rpc/interfaces/detection.js +2 -0
  977. package/dist/server/src/rpc/interfaces/detection.js.map +1 -0
  978. package/dist/server/src/rpc/interfaces/device.d.ts +62 -0
  979. package/dist/server/src/rpc/interfaces/device.js +2 -0
  980. package/dist/server/src/rpc/interfaces/device.js.map +1 -0
  981. package/dist/server/src/rpc/interfaces/discovery.d.ts +46 -0
  982. package/dist/server/src/rpc/interfaces/discovery.js +2 -0
  983. package/dist/server/src/rpc/interfaces/discovery.js.map +1 -0
  984. package/dist/server/src/rpc/interfaces/download.d.ts +22 -0
  985. package/dist/server/src/rpc/interfaces/download.js +2 -0
  986. package/dist/server/src/rpc/interfaces/download.js.map +1 -0
  987. package/dist/server/src/rpc/interfaces/frameworker.d.ts +12 -0
  988. package/dist/server/src/rpc/interfaces/frameworker.js +2 -0
  989. package/dist/server/src/rpc/interfaces/frameworker.js.map +1 -0
  990. package/dist/server/src/rpc/interfaces/notification.d.ts +6 -0
  991. package/dist/server/src/rpc/interfaces/notification.js +2 -0
  992. package/dist/server/src/rpc/interfaces/notification.js.map +1 -0
  993. package/dist/server/src/rpc/interfaces/sensor.d.ts +75 -0
  994. package/dist/server/src/rpc/interfaces/sensor.js +2 -0
  995. package/dist/server/src/rpc/interfaces/sensor.js.map +1 -0
  996. package/dist/server/src/rpc/interfaces/terminal.d.ts +34 -0
  997. package/dist/server/src/rpc/interfaces/terminal.js +2 -0
  998. package/dist/server/src/rpc/interfaces/terminal.js.map +1 -0
  999. package/dist/server/src/rpc/namespaces.d.ts +50 -2
  1000. package/dist/server/src/rpc/namespaces.js +70 -4
  1001. package/dist/server/src/rpc/namespaces.js.map +1 -1
  1002. package/dist/server/src/rpc/server.d.ts +22 -3
  1003. package/dist/server/src/rpc/server.js +110 -37
  1004. package/dist/server/src/rpc/server.js.map +1 -1
  1005. package/dist/server/src/rpc/utils.d.ts +2 -1
  1006. package/dist/server/src/rpc/utils.js +8 -0
  1007. package/dist/server/src/rpc/utils.js.map +1 -1
  1008. package/dist/server/src/services/config/constants.d.ts +7 -1
  1009. package/dist/server/src/services/config/constants.js +17 -2
  1010. package/dist/server/src/services/config/constants.js.map +1 -1
  1011. package/dist/server/src/services/config/defaults.js +3 -3
  1012. package/dist/server/src/services/config/defaults.js.map +1 -1
  1013. package/dist/server/src/services/config/index.d.ts +6 -43
  1014. package/dist/server/src/services/config/index.js +56 -108
  1015. package/dist/server/src/services/config/index.js.map +1 -1
  1016. package/dist/server/src/services/config/types.d.ts +14 -2
  1017. package/dist/server/src/services/config/types.js.map +1 -1
  1018. package/dist/server/src/services/logger/index.d.ts +13 -11
  1019. package/dist/server/src/services/logger/index.js +47 -50
  1020. package/dist/server/src/services/logger/index.js.map +1 -1
  1021. package/dist/server/src/services/logger/logManager.d.ts +35 -0
  1022. package/dist/server/src/services/logger/logManager.js +196 -0
  1023. package/dist/server/src/services/logger/logManager.js.map +1 -0
  1024. package/dist/server/src/services/logger/transports/fileTransport.d.ts +34 -0
  1025. package/dist/server/src/services/logger/transports/fileTransport.js +152 -0
  1026. package/dist/server/src/services/logger/transports/fileTransport.js.map +1 -0
  1027. package/dist/server/src/services/logger/transports/index.d.ts +1 -0
  1028. package/dist/server/src/services/logger/transports/index.js +2 -0
  1029. package/dist/server/src/services/logger/transports/index.js.map +1 -0
  1030. package/dist/server/src/types.d.ts +3 -0
  1031. package/dist/server/src/utils/camera.d.ts +4 -0
  1032. package/dist/server/src/utils/camera.js +79 -0
  1033. package/dist/server/src/utils/camera.js.map +1 -0
  1034. package/dist/server/src/utils/env.js +8 -0
  1035. package/dist/server/src/utils/env.js.map +1 -0
  1036. package/dist/server/src/utils/ipc.d.ts +1 -1
  1037. package/dist/server/src/utils/ipc.js +2 -2
  1038. package/dist/server/src/utils/ipc.js.map +1 -1
  1039. package/dist/server/src/utils/path.js +3 -3
  1040. package/dist/server/src/utils/path.js.map +1 -1
  1041. package/dist/server/src/utils/pythonInstaller.d.ts +2 -1
  1042. package/dist/server/src/utils/pythonInstaller.js +6 -6
  1043. package/dist/server/src/utils/pythonInstaller.js.map +1 -1
  1044. package/dist/server/src/workers/agent.d.ts +27 -0
  1045. package/dist/server/src/workers/agent.js +161 -0
  1046. package/dist/server/src/workers/agent.js.map +1 -0
  1047. package/dist/server/src/workers/capabilities/frame-decoding.d.ts +24 -0
  1048. package/dist/server/src/workers/capabilities/frame-decoding.js +180 -0
  1049. package/dist/server/src/workers/capabilities/frame-decoding.js.map +1 -0
  1050. package/dist/server/src/workers/capabilities/handler.d.ts +8 -0
  1051. package/dist/server/src/workers/capabilities/handler.js +2 -0
  1052. package/dist/server/src/workers/capabilities/handler.js.map +1 -0
  1053. package/dist/server/src/workers/manager.d.ts +31 -0
  1054. package/dist/server/src/workers/manager.js +260 -0
  1055. package/dist/server/src/workers/manager.js.map +1 -0
  1056. package/dist/server/src/workers/types.d.ts +59 -0
  1057. package/dist/server/src/workers/types.js +5 -0
  1058. package/dist/server/src/workers/types.js.map +1 -0
  1059. package/package.json +73 -79
  1060. package/dist/interface/assets/@xterm.DYP7pi_n.0.0.70.css +0 -32
  1061. package/dist/interface/assets/Adminpanel.BKek2EMH.0.0.70.css +0 -1
  1062. package/dist/interface/assets/Cameras.BDWZJqPN.0.0.70.css +0 -1
  1063. package/dist/interface/assets/Camview.Cvhuou6V.0.0.70.css +0 -1
  1064. package/dist/interface/assets/CuiConsole.DCYyxdVg.0.0.70.css +0 -1
  1065. package/dist/interface/assets/CuiPluginCard.yF8V0SZY.0.0.70.css +0 -1
  1066. package/dist/interface/assets/CuiTimeline.BkIwlYtw.0.0.70.css +0 -1
  1067. package/dist/interface/assets/Plugin.DJElsAn5.0.0.70.css +0 -1
  1068. package/dist/interface/assets/Plugins.BwPlcRrV.0.0.70.css +0 -1
  1069. package/dist/interface/assets/Settings.CkgfRkQr.0.0.70.css +0 -1
  1070. package/dist/interface/assets/SettingsAccount.CDZT7gN-.0.0.70.css +0 -1
  1071. package/dist/interface/assets/highlight.Ch2EwETz.0.0.70.css +0 -1
  1072. package/dist/interface/assets/main.BmO7mnW4.0.0.70.css +0 -1
  1073. package/dist/interface/assets/worker-base.jEXLGV2h.0.0.70.js +0 -1332
  1074. package/dist/interface/assets/worker-yaml.B3uUYINB.0.0.70.js +0 -5819
  1075. package/dist/interface/js/@babel.l0sNRNKZ.0.0.70.js +0 -1
  1076. package/dist/interface/js/@intlify.6ljJeWIl.0.0.70.js +0 -15
  1077. package/dist/interface/js/@kurkle.D8fDXNIl.0.0.70.js +0 -6
  1078. package/dist/interface/js/@primeuix.bRNqZjQz.0.0.70.js +0 -5889
  1079. package/dist/interface/js/@primevue.DH9ak_9x.0.0.70.js +0 -57
  1080. package/dist/interface/js/@react-dnd.CcwRs9xb.0.0.70.js +0 -1
  1081. package/dist/interface/js/@socket.io.Dkula2eQ.0.0.70.js +0 -1
  1082. package/dist/interface/js/@tanstack.Dk2rc1Gz.0.0.70.js +0 -1
  1083. package/dist/interface/js/@vee-validate.i4o6WINE.0.0.70.js +0 -5
  1084. package/dist/interface/js/@vue.BsSvBeCe.0.0.70.js +0 -17
  1085. package/dist/interface/js/@vueuse.T3qy5Jq4.0.0.70.js +0 -1
  1086. package/dist/interface/js/@xterm.CJZZM5vf.0.0.70.js +0 -66
  1087. package/dist/interface/js/Adminpanel.CBQfnvy1.0.0.70.js +0 -1
  1088. package/dist/interface/js/Camera.D39v2Qae.0.0.70.js +0 -1
  1089. package/dist/interface/js/Cameras.BOXzVzD9.0.0.70.js +0 -482
  1090. package/dist/interface/js/Cammesh.bs93Or8F.0.0.70.js +0 -1
  1091. package/dist/interface/js/Camview.R2Zpw-wS.0.0.70.js +0 -1
  1092. package/dist/interface/js/Config.D89tTvo2.0.0.70.js +0 -2
  1093. package/dist/interface/js/Console.DX4_ZVPM.0.0.70.js +0 -4
  1094. package/dist/interface/js/CuiConsole.B-YJZ4uY.0.0.70.js +0 -1
  1095. package/dist/interface/js/CuiPluginCard.CFaLdBEf.0.0.70.js +0 -4
  1096. package/dist/interface/js/CuiTimeline.DbPA3XCf.0.0.70.js +0 -1
  1097. package/dist/interface/js/FirstSteps.BjUQYXwF.0.0.70.js +0 -1
  1098. package/dist/interface/js/Plugin.Dl21oK_u.0.0.70.js +0 -1
  1099. package/dist/interface/js/Plugins.DphA9uPk.0.0.70.js +0 -1
  1100. package/dist/interface/js/Recordings.B2b7JutC.0.0.70.js +0 -1
  1101. package/dist/interface/js/Settings.D_hL6kBb.0.0.70.js +0 -1
  1102. package/dist/interface/js/SettingsAccount.2ETTD3p8.0.0.70.js +0 -1
  1103. package/dist/interface/js/SettingsAppearance.DkI9GlMu.0.0.70.js +0 -1
  1104. package/dist/interface/js/SettingsAppearance.vue_vue_type_script_setup_true_lang.D6sykhe2.0.0.70.js +0 -1
  1105. package/dist/interface/js/SettingsBackup.Ce3e31yn.0.0.70.js +0 -1
  1106. package/dist/interface/js/SettingsRecordings.C_hEpi6y.0.0.70.js +0 -1
  1107. package/dist/interface/js/SettingsRemote.BDp_l894.0.0.70.js +0 -1
  1108. package/dist/interface/js/SettingsSystem.CFjS9i7G.0.0.70.js +0 -1
  1109. package/dist/interface/js/SettingsUsers.BpTad4f8.0.0.70.js +0 -1
  1110. package/dist/interface/js/VersionsHandler.vue_vue_type_script_setup_true_lang.MC8r914h.0.0.70.js +0 -4
  1111. package/dist/interface/js/ace-builds.DPRnfcwI.0.0.70.js +0 -1091
  1112. package/dist/interface/js/ace.config.DReCZ4VN.0.0.70.js +0 -1
  1113. package/dist/interface/js/axios.lj9VQs0f.0.0.70.js +0 -6
  1114. package/dist/interface/js/backup.CqN-DI7C.0.0.70.js +0 -1
  1115. package/dist/interface/js/birpc.l0sNRNKZ.0.0.70.js +0 -1
  1116. package/dist/interface/js/chart.js.B5ohq2tj.0.0.70.js +0 -13
  1117. package/dist/interface/js/close-circle.CMnO5OKl.0.0.70.js +0 -1
  1118. package/dist/interface/js/compare-versions.DqEOhma6.0.0.70.js +0 -1
  1119. package/dist/interface/js/dijkstrajs.C00ieaqj.0.0.70.js +0 -1
  1120. package/dist/interface/js/dnd-core.DuFbUDJC.0.0.70.js +0 -1
  1121. package/dist/interface/js/draggabilly.Cuzjcd7v.0.0.70.js +0 -6
  1122. package/dist/interface/js/engine.io-client.CnosWdRP.0.0.70.js +0 -1
  1123. package/dist/interface/js/engine.io-parser.BiEtp6m2.0.0.70.js +0 -1
  1124. package/dist/interface/js/entities.C20TfXL6.0.0.70.js +0 -1
  1125. package/dist/interface/js/ev-emitter.X5f1qa-c.0.0.70.js +0 -1
  1126. package/dist/interface/js/fast-deep-equal.D0g7BF3f.0.0.70.js +0 -1
  1127. package/dist/interface/js/get-size.D1dS-IaP.0.0.70.js +0 -5
  1128. package/dist/interface/js/highlight.js.DTPofZhc.0.0.70.js +0 -3
  1129. package/dist/interface/js/hookable.l0sNRNKZ.0.0.70.js +0 -1
  1130. package/dist/interface/js/linkify-it.imhCvGRq.0.0.70.js +0 -1
  1131. package/dist/interface/js/main.D2NZuTnM.0.0.70.js +0 -31
  1132. package/dist/interface/js/markdown-it.VQvmcJVu.0.0.70.js +0 -15
  1133. package/dist/interface/js/mdurl.k9Sl0PQj.0.0.70.js +0 -2
  1134. package/dist/interface/js/nprogress.DuNJBXnf.0.0.70.js +0 -2
  1135. package/dist/interface/js/perfect-debounce.l0sNRNKZ.0.0.70.js +0 -1
  1136. package/dist/interface/js/pinia.BeBGFuqK.0.0.70.js +0 -5
  1137. package/dist/interface/js/primelocale.Bga3dOQu.0.0.70.js +0 -1
  1138. package/dist/interface/js/primevue.BVVo-ukB.0.0.70.js +0 -142
  1139. package/dist/interface/js/punycode.js.Dj65hjkv.0.0.70.js +0 -1
  1140. package/dist/interface/js/qrcode.D7KqKQTM.0.0.70.js +0 -8
  1141. package/dist/interface/js/react-dnd-html5-backend.1HQjlkwI.0.0.70.js +0 -2
  1142. package/dist/interface/js/react-dnd-touch-backend.4hAOsMRp.0.0.70.js +0 -1
  1143. package/dist/interface/js/redux.BFxtlG_c.0.0.70.js +0 -1
  1144. package/dist/interface/js/refresh-rounded.BzWz29y2.0.0.70.js +0 -1
  1145. package/dist/interface/js/rxjs.UbFxmZ7q.0.0.70.js +0 -3
  1146. package/dist/interface/js/socket.io-client.DC_wUGxw.0.0.70.js +0 -1
  1147. package/dist/interface/js/socket.io-parser.ChgZ8FD_.0.0.70.js +0 -1
  1148. package/dist/interface/js/system.Ccn9lMgI.0.0.70.js +0 -1
  1149. package/dist/interface/js/trash-fill.C8ZgD-Jz.0.0.70.js +0 -1
  1150. package/dist/interface/js/tslib.9k7AwCpt.0.0.70.js +0 -1
  1151. package/dist/interface/js/uc.micro.kMc2yuuw.0.0.70.js +0 -1
  1152. package/dist/interface/js/unidragger.DahEY3cm.0.0.70.js +0 -5
  1153. package/dist/interface/js/uuid.C6aID195.0.0.70.js +0 -1
  1154. package/dist/interface/js/vee-validate.DwwGVNzx.0.0.70.js +0 -5
  1155. package/dist/interface/js/vue-chartjs.KCIQuea5.0.0.70.js +0 -1
  1156. package/dist/interface/js/vue-i18n.BLwVbi61.0.0.70.js +0 -5
  1157. package/dist/interface/js/vue-inline-svg.B52C1cW8.0.0.70.js +0 -1
  1158. package/dist/interface/js/vue-router.BQuUBAAr.0.0.70.js +0 -5
  1159. package/dist/interface/js/vue-zoomable.Cq7IVJt5.0.0.70.js +0 -1
  1160. package/dist/interface/js/vue.l0sNRNKZ.0.0.70.js +0 -1
  1161. package/dist/interface/js/vue3-dnd.2Dj_EakH.0.0.70.js +0 -1
  1162. package/dist/interface/js/zod.2bfLsWMZ.0.0.70.js +0 -1
  1163. package/dist/interface/js/zoom-out.D4ga9c-w.0.0.70.js +0 -1
  1164. package/dist/interface/registerSW.js +0 -1
  1165. package/dist/interface/workbox-5ffe50d4.js +0 -1
  1166. package/dist/server/src/_camera_ui_tools/camera_ui_common/camera_utils/utils.py +0 -52
  1167. package/dist/server/src/_camera_ui_tools/camera_ui_common/logger_service/test.py +0 -116
  1168. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/__init__.py +0 -350
  1169. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/__init__.py +0 -0
  1170. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/base.py +0 -237
  1171. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/client.py +0 -256
  1172. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/connection.py +0 -784
  1173. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/errors.py +0 -745
  1174. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/messaging.py +0 -57
  1175. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/rpc.py +0 -227
  1176. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/base/rpc_generator.py +0 -584
  1177. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/constants.py +0 -96
  1178. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/typings.py +0 -218
  1179. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/__init__.py +0 -0
  1180. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/connection_state.py +0 -86
  1181. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/logger.py +0 -30
  1182. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/metrics.py +0 -152
  1183. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/packer.py +0 -20
  1184. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/routing.py +0 -75
  1185. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/rpc.py +0 -177
  1186. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/subscriptions.py +0 -24
  1187. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/tasks.py +0 -39
  1188. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/uid.py +0 -37
  1189. package/dist/server/src/_camera_ui_tools/camera_ui_rpc_client/utils/validate.py +0 -119
  1190. package/dist/server/src/_camera_ui_tools/camera_ui_types/__init__.py +0 -1369
  1191. package/dist/server/src/_camera_ui_tools/camera_ui_types/hybrid_observer.py +0 -338
  1192. package/dist/server/src/_camera_ui_tools/camera_ui_types/test.py +0 -196
  1193. package/dist/server/src/api/controllers/system.controller.d.ts +0 -24
  1194. package/dist/server/src/api/controllers/system.controller.js +0 -235
  1195. package/dist/server/src/api/controllers/system.controller.js.map +0 -1
  1196. package/dist/server/src/api/go2rtc/api/application.d.ts +0 -9
  1197. package/dist/server/src/api/go2rtc/api/application.js +0 -39
  1198. package/dist/server/src/api/go2rtc/api/application.js.map +0 -1
  1199. package/dist/server/src/api/go2rtc/api/config.d.ts +0 -8
  1200. package/dist/server/src/api/go2rtc/api/config.js +0 -44
  1201. package/dist/server/src/api/go2rtc/api/config.js.map +0 -1
  1202. package/dist/server/src/api/go2rtc/api/discover.d.ts +0 -30
  1203. package/dist/server/src/api/go2rtc/api/discover.js +0 -162
  1204. package/dist/server/src/api/go2rtc/api/discover.js.map +0 -1
  1205. package/dist/server/src/api/go2rtc/api/index.d.ts +0 -1
  1206. package/dist/server/src/api/go2rtc/api/index.js +0 -42
  1207. package/dist/server/src/api/go2rtc/api/index.js.map +0 -1
  1208. package/dist/server/src/api/go2rtc/api/snapshot.d.ts +0 -8
  1209. package/dist/server/src/api/go2rtc/api/snapshot.js +0 -34
  1210. package/dist/server/src/api/go2rtc/api/snapshot.js.map +0 -1
  1211. package/dist/server/src/api/go2rtc/api/streams.d.ts +0 -20
  1212. package/dist/server/src/api/go2rtc/api/streams.js +0 -190
  1213. package/dist/server/src/api/go2rtc/api/streams.js.map +0 -1
  1214. package/dist/server/src/api/go2rtc/index.d.ts +0 -16
  1215. package/dist/server/src/api/go2rtc/index.js +0 -33
  1216. package/dist/server/src/api/go2rtc/index.js.map +0 -1
  1217. package/dist/server/src/api/go2rtc/queue.d.ts +0 -10
  1218. package/dist/server/src/api/go2rtc/queue.js +0 -38
  1219. package/dist/server/src/api/go2rtc/queue.js.map +0 -1
  1220. package/dist/server/src/api/go2rtc/types.d.ts +0 -151
  1221. package/dist/server/src/api/go2rtc/types.js.map +0 -1
  1222. package/dist/server/src/api/routes/system.routes.d.ts +0 -2
  1223. package/dist/server/src/api/routes/system.routes.js +0 -86
  1224. package/dist/server/src/api/routes/system.routes.js.map +0 -1
  1225. package/dist/server/src/api/schemas/system.schema.d.ts +0 -185
  1226. package/dist/server/src/api/schemas/system.schema.js +0 -40
  1227. package/dist/server/src/api/schemas/system.schema.js.map +0 -1
  1228. package/dist/server/src/api/services/system.service.d.ts +0 -13
  1229. package/dist/server/src/api/services/system.service.js +0 -63
  1230. package/dist/server/src/api/services/system.service.js.map +0 -1
  1231. package/dist/server/src/camera/classes.d.ts +0 -2
  1232. package/dist/server/src/camera/classes.js +0 -24
  1233. package/dist/server/src/camera/classes.js.map +0 -1
  1234. package/dist/server/src/camera/device.d.ts +0 -34
  1235. package/dist/server/src/camera/device.js +0 -327
  1236. package/dist/server/src/camera/device.js.map +0 -1
  1237. package/dist/server/src/camera/frameWorker.d.ts +0 -46
  1238. package/dist/server/src/camera/frameWorker.js +0 -347
  1239. package/dist/server/src/camera/frameWorker.js.map +0 -1
  1240. package/dist/server/src/camera/interfaces.d.ts +0 -17
  1241. package/dist/server/src/camera/interfaces.js +0 -99
  1242. package/dist/server/src/camera/interfaces.js.map +0 -1
  1243. package/dist/server/src/camera/iou.d.ts +0 -2
  1244. package/dist/server/src/camera/iou.js +0 -122
  1245. package/dist/server/src/camera/iou.js.map +0 -1
  1246. package/dist/server/src/camera/polygon.d.ts +0 -4
  1247. package/dist/server/src/camera/polygon.js +0 -192
  1248. package/dist/server/src/camera/polygon.js.map +0 -1
  1249. package/dist/server/src/camera/python/__init__.py +0 -0
  1250. package/dist/server/src/camera/python/classes.py +0 -41
  1251. package/dist/server/src/camera/python/interfaces.py +0 -131
  1252. package/dist/server/src/camera/python/iou.py +0 -158
  1253. package/dist/server/src/camera/python/polygon.py +0 -230
  1254. package/dist/server/src/camera/python/typings.py +0 -50
  1255. package/dist/server/src/camera/python/video_frame.py +0 -143
  1256. package/dist/server/src/camera/streaming/peer-connection.d.ts +0 -26
  1257. package/dist/server/src/camera/streaming/peer-connection.js +0 -213
  1258. package/dist/server/src/camera/streaming/peer-connection.js.map +0 -1
  1259. package/dist/server/src/camera/streaming/rtsp-session.d.ts +0 -19
  1260. package/dist/server/src/camera/streaming/rtsp-session.js +0 -196
  1261. package/dist/server/src/camera/streaming/rtsp-session.js.map +0 -1
  1262. package/dist/server/src/camera/streaming/webrtc-connection.d.ts +0 -44
  1263. package/dist/server/src/camera/streaming/webrtc-connection.js +0 -177
  1264. package/dist/server/src/camera/streaming/webrtc-connection.js.map +0 -1
  1265. package/dist/server/src/camera/streaming/werift-session.d.ts +0 -19
  1266. package/dist/server/src/camera/streaming/werift-session.js +0 -246
  1267. package/dist/server/src/camera/streaming/werift-session.js.map +0 -1
  1268. package/dist/server/src/camera/types.d.ts +0 -17
  1269. package/dist/server/src/camera/types.js.map +0 -1
  1270. package/dist/server/src/camera/videoFrame.d.ts +0 -18
  1271. package/dist/server/src/camera/videoFrame.js +0 -88
  1272. package/dist/server/src/camera/videoFrame.js.map +0 -1
  1273. package/dist/server/src/cloud/index.d.ts +0 -12
  1274. package/dist/server/src/cloud/index.js +0 -49
  1275. package/dist/server/src/cloud/index.js.map +0 -1
  1276. package/dist/server/src/cloud/remote/cloudflare.d.ts +0 -7
  1277. package/dist/server/src/cloud/remote/cloudflare.js +0 -12
  1278. package/dist/server/src/cloud/remote/cloudflare.js.map +0 -1
  1279. package/dist/server/src/cloud/remote/upnp.d.ts +0 -7
  1280. package/dist/server/src/cloud/remote/upnp.js +0 -12
  1281. package/dist/server/src/cloud/remote/upnp.js.map +0 -1
  1282. package/dist/server/src/cloud/remote/utils.d.ts +0 -3
  1283. package/dist/server/src/cloud/remote/utils.js +0 -21
  1284. package/dist/server/src/cloud/remote/utils.js.map +0 -1
  1285. package/dist/server/src/cloud/types.d.ts +0 -15
  1286. package/dist/server/src/cloud/types.js +0 -11
  1287. package/dist/server/src/cloud/types.js.map +0 -1
  1288. package/dist/server/src/decoder/child.js +0 -748
  1289. package/dist/server/src/decoder/child.js.map +0 -1
  1290. package/dist/server/src/decoder/imageUtils.d.ts +0 -21
  1291. package/dist/server/src/decoder/imageUtils.js +0 -204
  1292. package/dist/server/src/decoder/imageUtils.js.map +0 -1
  1293. package/dist/server/src/decoder/manager.d.ts +0 -19
  1294. package/dist/server/src/decoder/manager.js +0 -208
  1295. package/dist/server/src/decoder/manager.js.map +0 -1
  1296. package/dist/server/src/decoder/python/__init__.py +0 -0
  1297. package/dist/server/src/decoder/python/child.py +0 -902
  1298. package/dist/server/src/decoder/python/image_utils.py +0 -196
  1299. package/dist/server/src/decoder/python/pool.py +0 -45
  1300. package/dist/server/src/decoder/python/typings.py +0 -57
  1301. package/dist/server/src/decoder/python/utils.py +0 -70
  1302. package/dist/server/src/decoder/types.d.ts +0 -23
  1303. package/dist/server/src/decoder/types.js.map +0 -1
  1304. package/dist/server/src/decoder/utils.d.ts +0 -13
  1305. package/dist/server/src/decoder/utils.js +0 -45
  1306. package/dist/server/src/decoder/utils.js.map +0 -1
  1307. package/dist/server/src/decoder/wasm/build/decoder.d.ts +0 -43
  1308. package/dist/server/src/decoder/wasm/build/decoder.js +0 -108
  1309. package/dist/server/src/decoder/wasm/build/decoder.wasm +0 -0
  1310. package/dist/server/src/decoder/worker.js +0 -79
  1311. package/dist/server/src/decoder/worker.js.map +0 -1
  1312. package/dist/server/src/plugins/runtime/node/plugin.d.ts +0 -24
  1313. package/dist/server/src/plugins/runtime/node/plugin.js +0 -128
  1314. package/dist/server/src/plugins/runtime/node/plugin.js.map +0 -1
  1315. package/dist/server/src/plugins/runtime/python/plugin.py +0 -155
  1316. package/dist/server/src/rpc/types.d.ts +0 -112
  1317. package/dist/server/src/rpc/types.js.map +0 -1
  1318. /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.70.css → SettingsBackup-CX0rT0QJ.css} +0 -0
  1319. /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.70.png → error-256-DLKVOU2S.png} +0 -0
  1320. /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.70.png → logo-256-BCQk9H1-.png} +0 -0
  1321. /package/dist/interface/assets/{logo.DmEiRk0z.0.0.70.png → logo-DmEiRk0z.png} +0 -0
  1322. /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.70.js → mode-yaml-CIYL8U3d.js} +0 -0
  1323. /package/dist/server/src/api/{go2rtc → database/migrations}/types.js +0 -0
  1324. /package/dist/server/src/{camera → automations/actions}/types.js +0 -0
  1325. /package/dist/server/src/{decoder → automations/conditions}/types.js +0 -0
  1326. /package/dist/server/src/{rpc → automations/triggers}/types.js +0 -0
  1327. /package/dist/server/src/{decoder/child.d.ts → remote/services/upnp.d.ts} +0 -0
  1328. /package/dist/server/src/{decoder/worker.d.ts → utils/env.d.ts} +0 -0
@@ -1,31 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/FirstSteps.BjUQYXwF.0.0.70.js","js/primevue.BVVo-ukB.0.0.70.js","js/@primeuix.bRNqZjQz.0.0.70.js","js/@vue.BsSvBeCe.0.0.70.js","js/@primevue.DH9ak_9x.0.0.70.js","js/vue-inline-svg.B52C1cW8.0.0.70.js","js/backup.CqN-DI7C.0.0.70.js","js/system.Ccn9lMgI.0.0.70.js","js/@tanstack.Dk2rc1Gz.0.0.70.js","js/vue-i18n.BLwVbi61.0.0.70.js","js/@intlify.6ljJeWIl.0.0.70.js","js/SettingsAccount.2ETTD3p8.0.0.70.js","js/vee-validate.DwwGVNzx.0.0.70.js","js/pinia.BeBGFuqK.0.0.70.js","js/@vueuse.T3qy5Jq4.0.0.70.js","js/nprogress.DuNJBXnf.0.0.70.js","js/@xterm.CJZZM5vf.0.0.70.js","assets/@xterm.DYP7pi_n.0.0.70.css","js/axios.lj9VQs0f.0.0.70.js","js/vue-router.BQuUBAAr.0.0.70.js","js/@vee-validate.i4o6WINE.0.0.70.js","js/zod.2bfLsWMZ.0.0.70.js","js/uuid.C6aID195.0.0.70.js","js/socket.io-client.DC_wUGxw.0.0.70.js","js/engine.io-client.CnosWdRP.0.0.70.js","js/engine.io-parser.BiEtp6m2.0.0.70.js","js/@socket.io.Dkula2eQ.0.0.70.js","js/socket.io-parser.ChgZ8FD_.0.0.70.js","js/rxjs.UbFxmZ7q.0.0.70.js","js/tslib.9k7AwCpt.0.0.70.js","js/highlight.js.DTPofZhc.0.0.70.js","assets/highlight.Ch2EwETz.0.0.70.css","js/markdown-it.VQvmcJVu.0.0.70.js","js/mdurl.k9Sl0PQj.0.0.70.js","js/uc.micro.kMc2yuuw.0.0.70.js","js/entities.C20TfXL6.0.0.70.js","js/linkify-it.imhCvGRq.0.0.70.js","js/punycode.js.Dj65hjkv.0.0.70.js","js/qrcode.D7KqKQTM.0.0.70.js","js/dijkstrajs.C00ieaqj.0.0.70.js","js/draggabilly.Cuzjcd7v.0.0.70.js","js/get-size.D1dS-IaP.0.0.70.js","js/unidragger.DahEY3cm.0.0.70.js","js/ev-emitter.X5f1qa-c.0.0.70.js","js/vue-zoomable.Cq7IVJt5.0.0.70.js","js/primelocale.Bga3dOQu.0.0.70.js","assets/SettingsAccount.CDZT7gN-.0.0.70.css","js/SettingsAppearance.vue_vue_type_script_setup_true_lang.D6sykhe2.0.0.70.js","js/Cameras.BOXzVzD9.0.0.70.js","js/refresh-rounded.BzWz29y2.0.0.70.js","js/CuiConsole.B-YJZ4uY.0.0.70.js","assets/CuiConsole.DCYyxdVg.0.0.70.css","assets/Cameras.BDWZJqPN.0.0.70.css","js/Camera.D39v2Qae.0.0.70.js","js/CuiTimeline.DbPA3XCf.0.0.70.js","assets/CuiTimeline.BkIwlYtw.0.0.70.css","js/Camview.R2Zpw-wS.0.0.70.js","js/vue3-dnd.2Dj_EakH.0.0.70.js","js/dnd-core.DuFbUDJC.0.0.70.js","js/redux.BFxtlG_c.0.0.70.js","js/@react-dnd.CcwRs9xb.0.0.70.js","js/fast-deep-equal.D0g7BF3f.0.0.70.js","js/react-dnd-html5-backend.1HQjlkwI.0.0.70.js","js/react-dnd-touch-backend.4hAOsMRp.0.0.70.js","assets/Camview.Cvhuou6V.0.0.70.css","js/Recordings.B2b7JutC.0.0.70.js","js/Config.D89tTvo2.0.0.70.js","js/zoom-out.D4ga9c-w.0.0.70.js","js/Console.DX4_ZVPM.0.0.70.js","js/Plugins.DphA9uPk.0.0.70.js","js/CuiPluginCard.CFaLdBEf.0.0.70.js","js/trash-fill.C8ZgD-Jz.0.0.70.js","js/VersionsHandler.vue_vue_type_script_setup_true_lang.MC8r914h.0.0.70.js","assets/CuiPluginCard.yF8V0SZY.0.0.70.css","assets/Plugins.BwPlcRrV.0.0.70.css","js/Plugin.Dl21oK_u.0.0.70.js","js/close-circle.CMnO5OKl.0.0.70.js","assets/Plugin.DJElsAn5.0.0.70.css","js/Adminpanel.CBQfnvy1.0.0.70.js","js/chart.js.B5ohq2tj.0.0.70.js","js/@kurkle.D8fDXNIl.0.0.70.js","js/vue-chartjs.KCIQuea5.0.0.70.js","assets/Adminpanel.BKek2EMH.0.0.70.css","js/Cammesh.bs93Or8F.0.0.70.js","js/Settings.D_hL6kBb.0.0.70.js","assets/Settings.CkgfRkQr.0.0.70.css","js/SettingsAppearance.DkI9GlMu.0.0.70.js","js/SettingsUsers.BpTad4f8.0.0.70.js","js/SettingsRecordings.C_hEpi6y.0.0.70.js","js/SettingsBackup.Ce3e31yn.0.0.70.js","assets/SettingsBackup.CX0rT0QJ.0.0.70.css","js/SettingsRemote.BDp_l894.0.0.70.js","js/SettingsSystem.CFjS9i7G.0.0.70.js","js/compare-versions.DqEOhma6.0.0.70.js"])))=>i.map(i=>d[i]);
2
- var M0=Object.defineProperty;var yu=s=>{throw TypeError(s)};var $0=(s,e,t)=>e in s?M0(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var p=(s,e,t)=>$0(s,typeof e!="symbol"?e+"":e,t),qa=(s,e,t)=>e.has(s)||yu("Cannot "+t);var kn=(s,e,t)=>(qa(s,e,"read from private field"),t?t.call(s):e.get(s)),Jn=(s,e,t)=>e.has(s)?yu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),Gr=(s,e,t,n)=>(qa(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),gt=(s,e,t)=>(qa(s,e,"access private method"),t);import{u as Ci,a as qt,b as ut,V as T0}from"./@tanstack.Dk2rc1Gz.0.0.70.js";import{T as P0,s as R0,a as jr,b as ws,c as qr,d as Ea,e as ki,f as Oh,g as I0,h as Nh,D as bu,i as Zc,j as fo,k as O0,l as go,m as Aa,n as Gc,o as Fh,p as Wc,q as Lh,r as jh,t as Jc,u as Yc,v as Xc,w as el,x as qh,y as Dh,z as Bh,A as N0,B as F0,C as L0,E as j0,F as q0,G as D0,H as B0,I as z0,J as U0,K as V0}from"./primevue.BVVo-ukB.0.0.70.js";import{F as pe,c as A,d as m,e as g,B as Et,r as ce,o as Sn,a4 as Ma,L as $t,h as c,R as y,P as ct,M as j,O as ae,W as at,z as Ls,k as te,w as Ke,t as Yt,N as $,Y as Tr,J as Ei,m as et,V as Ct,I as de,ac as Vt,f as ps,ab as zh,b as Pr,A as Xs,a7 as vo,H as Qt,X as yt,Z as Dt,i as pi,a5 as tl,a0 as H0,Q as Ai,ad as sl,n as Zs,G as ti,D as wu,_ as Uh,S as Q0,ae as Qn,af as Rr,$ as cr,ag as K0,a1 as Z0,T as Vh,ah as G0}from"./@vue.BsSvBeCe.0.0.70.js";import{v as Hh,u as nl,a as W0,c as rl,b as J0,d as Y0,e as Qh,o as il,f as Kh,g as X0,h as ef,i as tf,r as xu,j as dc,k as sf,l as ii,m as ol,n as nf,p as fn,q as Zh,s as rf,t as Su,w as of,x as af,y as Ao,z as cf}from"./@vueuse.T3qy5Jq4.0.0.70.js";import{a as lf,A as uf}from"./axios.lj9VQs0f.0.0.70.js";import{u as js,c as df}from"./vue-i18n.BLwVbi61.0.0.70.js";import{d as Mi,s as Vs,c as hf}from"./pinia.BeBGFuqK.0.0.70.js";import{u as Dr,a as $i,c as mf,b as pf}from"./vue-router.BQuUBAAr.0.0.70.js";import{R as $a}from"./vue-inline-svg.B52C1cW8.0.0.70.js";import{F as al,a as Nt,E as Ft}from"./vee-validate.DwwGVNzx.0.0.70.js";import{t as Gn}from"./@vee-validate.i4o6WINE.0.0.70.js";import{v as dn}from"./uuid.C6aID195.0.0.70.js";import{o as bt,c as vs,u as Os,l as we,t as ff,n as xn,s as Ze,d as lr,r as cl,e as Vn,f as gf,g as Cu,h as vf,i as ll,j as Gh,k as Da}from"./zod.2bfLsWMZ.0.0.70.js";import{M as _f}from"./socket.io-client.DC_wUGxw.0.0.70.js";import{O as yf}from"./rxjs.UbFxmZ7q.0.0.70.js";import{H as Wr,t as bf,y as wf,j as xf,p as Sf}from"./highlight.js.DTPofZhc.0.0.70.js";import{M as Cf}from"./markdown-it.VQvmcJVu.0.0.70.js";import{q as kf}from"./qrcode.D7KqKQTM.0.0.70.js";import{D as Wh}from"./draggabilly.Cuzjcd7v.0.0.70.js";import{m as Ef}from"./vue-zoomable.Cq7IVJt5.0.0.70.js";import{e as Af,d as Mf}from"./primelocale.Bga3dOQu.0.0.70.js";import{Y as $f,Z as Tf}from"./@primevue.DH9ak_9x.0.0.70.js";import{b0 as Pf,b1 as Rf}from"./@primeuix.bRNqZjQz.0.0.70.js";import"./nprogress.DuNJBXnf.0.0.70.js";import"./@xterm.CJZZM5vf.0.0.70.js";import"./@intlify.6ljJeWIl.0.0.70.js";import"./engine.io-client.CnosWdRP.0.0.70.js";import"./engine.io-parser.BiEtp6m2.0.0.70.js";import"./@socket.io.Dkula2eQ.0.0.70.js";import"./socket.io-parser.ChgZ8FD_.0.0.70.js";import"./tslib.9k7AwCpt.0.0.70.js";import"./mdurl.k9Sl0PQj.0.0.70.js";import"./uc.micro.kMc2yuuw.0.0.70.js";import"./entities.C20TfXL6.0.0.70.js";import"./linkify-it.imhCvGRq.0.0.70.js";import"./punycode.js.Dj65hjkv.0.0.70.js";import"./dijkstrajs.C00ieaqj.0.0.70.js";import"./get-size.D1dS-IaP.0.0.70.js";import"./unidragger.DahEY3cm.0.0.70.js";import"./ev-emitter.X5f1qa-c.0.0.70.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=t(r);fetch(r.href,i)}})();const If=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Of=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Nf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ff=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Lf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),jf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),qf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Df=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Bf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zf(s,e){return m(),A("svg",Bf,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M5.41 7.41L10 12l-4.59 4.59L4 15.17L7.17 12L4 8.83zm13.18 9.18L14 12l4.59-4.58L20 8.83L16.83 12L20 15.17z"},null,-1)]))}const Uf=pe({name:"mdi-unfold-less-vertical",render:zf}),Vf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hf(s,e){return m(),A("svg",Vf,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 18.17L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15M12 5.83L15.17 9l1.41-1.41L12 3L7.41 7.59L8.83 9z"},null,-1)]))}const Qf=pe({name:"mdi-unfold-more-horizontal",render:Hf}),Kf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zf(s,e){return m(),A("svg",Kf,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19 13H5v-2h14z"},null,-1)]))}const Gf=pe({name:"mdi-minus",render:Zf}),Wf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Jf(s,e){return m(),A("svg",Wf,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"},null,-1)]))}const _o=pe({name:"mdi-close",render:Jf}),Yf={class:"fixed flex flex-row items-center z-[99999] top-0 left-[7px] gap-2 p-2 non-draggable-region"},Xf=Et({__name:"CuiWindowButtons",setup(s){const e=ce(!1),t=ce(!1),n=()=>{var a;t.value||(a=window.electron)==null||a.send("change-window","minify")},r=()=>{var a;(a=window.electron)==null||a.send("change-window","close")},i=()=>{var a;(a=window.electron)==null||a.send("change-window","expand")},o=(a,l)=>{t.value=l};return Sn(()=>{var a;(a=window.electron)==null||a.on("fullscreen",o)}),Ma(()=>{var a;(a=window.electron)==null||a.removeListener("fullscreen",o)}),(a,l)=>{const u=_o,d=Gf,h=Qf,v=Uf;return $t((m(),A("div",Yf,[g("div",{class:"close-button",onClick:r},[y(u,{color:"#7f050a",width:"100%",height:"100%",class:ct(["transition-opacity opacity-0",{"opacity-100":c(e)}])},null,8,["class"])]),g("div",{class:ct({"disabled-button":c(t),"minify-button":!c(t)}),onClick:n},[c(t)?ae("",!0):(m(),j(d,{key:0,color:"#995712",width:"100%",height:"100%",class:ct(["transition-opacity opacity-0",{"opacity-100":c(e)}])},null,8,["class"]))],2),g("div",{class:"expand-button",style:at(`${c(t)?"transform: rotate(45deg)":"transform: rotate(-45deg)"}`),onClick:i},[c(t)?(m(),j(v,{key:1,color:"#0d650d",width:"100%",height:"100%",class:ct(["transition-opacity opacity-0",{"opacity-100":c(e)}])},null,8,["class"])):(m(),j(h,{key:0,color:"#0d650d",width:"100%",height:"100%",class:ct(["transition-opacity opacity-0",{"opacity-100":c(e)}])},null,8,["class"]))],4)])),[[c(Hh),f=>e.value=f]])}}}),qs=(s,e)=>{const t=s.__vccOpts||s;for(const[n,r]of e)t[n]=r;return t},e1=qs(Xf,[["__scopeId","data-v-8dab6fc2"]]),t1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function s1(s,e){return m(),A("svg",t1,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 6a7.75 7.75 0 1 0 10 0m-5-2v8"},null,-1)]))}const Jh=pe({name:"tabler-power",render:s1}),n1="/assets/logo-512.DLKVOU2S.0.0.70.png",r1=Object.freeze(Object.defineProperty({__proto__:null,default:n1},Symbol.toStringTag,{value:"Module"})),i1="/assets/logo-256.BCQk9H1-.0.0.70.png",o1=Object.freeze(Object.defineProperty({__proto__:null,default:i1},Symbol.toStringTag,{value:"Module"})),a1="/assets/logo-512.DLKVOU2S.0.0.70.png",c1=Object.freeze(Object.defineProperty({__proto__:null,default:a1},Symbol.toStringTag,{value:"Module"})),l1="/assets/logo.DmEiRk0z.0.0.70.png",u1=Object.freeze(Object.defineProperty({__proto__:null,default:l1},Symbol.toStringTag,{value:"Module"})),d1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20233.63%20233.63'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:url(%23dark_wine);}.cls-2{fill:url(%23light_wine);}.cls-3{fill:none;stroke:%23000;stroke-miterlimit:10;opacity:0;}.cls-4{fill:%23c5c6c8;}.cls-5{fill:%231a1e21;stroke:%233a3a3a;stroke-width:2px;}.cls-6{fill:%23fff;}%3c/style%3e%3clinearGradient%20id='dark_wine'%20x1='87.36'%20y1='158.67'%20x2='87.36'%20y2='59.85'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23730000'/%3e%3cstop%20offset='0.49'%20stop-color='%23a51733'/%3e%3c/linearGradient%3e%3clinearGradient%20id='light_wine'%20x1='113.06'%20y1='197.59'%20x2='113.06'%20y2='80.87'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23f44a6b'/%3e%3cstop%20offset='0.28'%20stop-color='%23df294c'/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='CameraUI_U'%3e%3cpath%20id='U_Left'%20class='cls-1'%20d='M47.05,119.47s7.58,16,14.12,23.42a45.28,45.28,0,0,0,16.37,11.86A49.46,49.46,0,0,0,99,158.62c9.43-.46,20.55-3.87,29.24-11.86-3.9,2.5-9.87,5.1-15.9,4.77a25.63,25.63,0,0,1-18.38-9.09c-9.39-10.31-7.62-28.35-7.75-32.68-.35-11.42.77-21.92-1.76-36.19-.46-2.64-1.79-5.19-4.55-8-1.83-1.86-8.4-5.75-13.42-5.74-7.31,0-12.95,3.71-15.38,7.84-2,3.41-3.06,4.22-4.23,25.08a217.23,217.23,0,0,0,.22,26.76Z'%20transform='translate(0.5%200.5)'/%3e%3cpath%20id='U_Right'%20class='cls-2'%20d='M144.12,89.6a16.24,16.24,0,0,1,4.06-4.9c4.16-3.4,9-3.67,10.92-3.82a19.7,19.7,0,0,1,12.53,4.58c1.19,1,6.11,5.58,7.13,17.29.73,8.51,3.31,65.93-37,87.14-4.22,2.22-18,9.25-35.66,7.38a62.43,62.43,0,0,1-20.8-6.11,65.8,65.8,0,0,1-18.89-14.23c-20.21-21.67-19.36-57.46-19.36-57.46s7.58,16,14.12,23.42a45.28,45.28,0,0,0,16.37,11.86A49.46,49.46,0,0,0,99,158.62c11.66-.57,25.93-5.64,35-18.32C143.52,126.8,138.46,100.51,144.12,89.6Z'%20transform='translate(0.5%200.5)'/%3e%3c/g%3e%3cg%20id='CameraUI_Lens'%3e%3ccircle%20id='ellipse'%20class='cls-3'%20cx='116.81'%20cy='116.81'%20r='116.31'/%3e%3cg%20id='lens'%3e%3ccircle%20id='lens_bg'%20class='cls-4'%20cx='159.13'%20cy='58.39'%20r='18.66'/%3e%3cpath%20id='lens_inner'%20class='cls-5'%20d='M169.64,58.31a11,11,0,1,1-22,0c0-6.08,4.93-11.86,11-11.86S169.64,52.23,169.64,58.31Z'%20transform='translate(0.5%200.5)'/%3e%3cg%20id='reflections'%3e%3cellipse%20id='dot_1'%20class='cls-6'%20cx='174.36'%20cy='53.69'%20rx='1.84'%20ry='1.42'/%3e%3cellipse%20id='dot_2'%20class='cls-6'%20cx='174.36'%20cy='57.08'%20rx='1.84'%20ry='1.42'/%3e%3cellipse%20id='dot_3'%20class='cls-6'%20cx='174.36'%20cy='60.46'%20rx='1.84'%20ry='1.42'/%3e%3ccircle%20id='dot_4'%20class='cls-6'%20cx='164.09'%20cy='63.77'%20r='1.66'/%3e%3cpath%20id='wide_1'%20class='cls-6'%20d='M156.63,48.9c-1.07-.88-5.52,3.09-6.31,5.43a1.53,1.53,0,0,0,0,1.26c.43.69,1.73.61,2.19.54,2.68-.44,4.71-4.09,4.8-4.37A3.21,3.21,0,0,0,156.63,48.9Z'%20transform='translate(0.5%200.5)'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",h1=Object.freeze(Object.defineProperty({__proto__:null,default:d1},Symbol.toStringTag,{value:"Module"})),m1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20132.55%20158.35'%20width='132.5500030517578'%20height='158.35000610351562'%3e%3cdefs%3e%3cstyle%3e.cls-2-1{fill:url(%23dark_wine);}.cls-2-2{fill:url(%23light_wine);}.cls-2-3{fill:%23c5c6c8;}.cls-2-4{fill:%231a1e21;stroke:%233a3a3a;stroke-width:2px;}.cls-2-5{fill:%23fff;}%3c/style%3e%3clinearGradient%20id='dark_wine'%20x1='45.89'%20y1='124.26'%20x2='45.89'%20y2='25.44'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23730000'%3e%3c/stop%3e%3cstop%20offset='0.49'%20stop-color='%23a51733'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20id='light_wine'%20x1='71.59'%20y1='163.18'%20x2='71.59'%20y2='46.47'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23f44a6b'%3e%3c/stop%3e%3cstop%20offset='0.28'%20stop-color='%23df294c'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='CameraUI_U'%3e%3cpath%20id='U_Left'%20class='cls-2-1%20svg-elem-1'%20d='M5.58,85.06s7.58,16,14.12,23.42a45.28,45.28,0,0,0,16.37,11.86,49.46,49.46,0,0,0,21.42,3.87c9.43-.46,20.55-3.87,29.24-11.86-3.9,2.5-9.87,5.1-15.9,4.77A25.68,25.68,0,0,1,52.44,108c-9.38-10.31-7.61-28.35-7.74-32.68-.35-11.42.77-21.92-1.76-36.19-.46-2.64-1.79-5.19-4.55-8C36.55,29.33,30,25.43,25,25.44c-7.31,0-12.95,3.72-15.38,7.84-2,3.41-3.07,4.22-4.23,25.08a217.23,217.23,0,0,0,.22,26.76Z'%20transform='translate(-5.05%20-4.82)'%3e%3c/path%3e%3cpath%20id='U_Right'%20class='cls-2-2%20svg-elem-2'%20d='M102.65,55.19a16.24,16.24,0,0,1,4.06-4.9c4.16-3.4,9-3.67,10.92-3.82a19.7,19.7,0,0,1,12.53,4.58c1.19,1,6.11,5.58,7.12,17.29.74,8.51,3.32,65.93-37,87.14-4.22,2.22-18,9.26-35.66,7.38a62.43,62.43,0,0,1-20.8-6.11,65.8,65.8,0,0,1-18.89-14.23C4.73,120.85,5.58,85.06,5.58,85.06s7.58,16,14.12,23.42a45.28,45.28,0,0,0,16.37,11.86,49.46,49.46,0,0,0,21.42,3.87c11.66-.57,25.93-5.64,35-18.32C102.05,92.39,97,66.1,102.65,55.19Z'%20transform='translate(-5.05%20-4.82)'%3e%3c/path%3e%3c/g%3e%3cg%20id='CameraUI_Lens'%3e%3ccircle%20id='lens_bg'%20class='cls-2-3%20svg-elem-3'%20cx='112.11'%20cy='18.66'%20r='18.66'%3e%3c/circle%3e%3cpath%20id='lens_inner'%20class='cls-2-4%20svg-elem-4'%20d='M128.17,23.9a11,11,0,1,1-22,0c0-6.08,4.93-11.86,11-11.86S128.17,17.82,128.17,23.9Z'%20transform='translate(-5.05%20-4.82)'%3e%3c/path%3e%3cg%20id='reflections'%3e%3cellipse%20id='dot_1'%20class='cls-2-5%20svg-elem-5'%20cx='127.34'%20cy='13.96'%20rx='1.84'%20ry='1.42'%3e%3c/ellipse%3e%3cellipse%20id='dot_2'%20class='cls-2-5%20svg-elem-6'%20cx='127.34'%20cy='17.34'%20rx='1.84'%20ry='1.42'%3e%3c/ellipse%3e%3cellipse%20id='dot_3'%20class='cls-2-5%20svg-elem-7'%20cx='127.34'%20cy='20.73'%20rx='1.84'%20ry='1.42'%3e%3c/ellipse%3e%3ccircle%20id='dot_4'%20class='cls-2-5%20svg-elem-8'%20cx='117.07'%20cy='24.04'%20r='1.66'%3e%3c/circle%3e%3cpath%20id='wide_1'%20class='cls-2-5%20svg-elem-9'%20d='M115.16,14.49c-1.07-.88-5.52,3.09-6.31,5.43a1.53,1.53,0,0,0,0,1.26c.43.69,1.73.61,2.18.54,2.69-.44,4.72-4.09,4.81-4.37A3.21,3.21,0,0,0,115.16,14.49Z'%20transform='translate(-5.05%20-4.82)'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",p1=Object.freeze(Object.defineProperty({__proto__:null,default:m1},Symbol.toStringTag,{value:"Module"})),f1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='-40%20-30%20300%20300'%3e%3cdefs%3e%3cstyle%3e.cls-3-1%20{fill:%20url(%23dark_wine);}%20.cls-3-2%20{fill:%20url(%23light_wine);}%20.cls-3-3%20{fill:%20none;stroke:%20%23000;stroke-miterlimit:%2010;opacity:%200;}%20.cls-3-4%20{fill:%20%23c5c6c8;}%20.cls-3-5%20{fill:%20%231a1e21;stroke:%20%233a3a3a;stroke-width:%202px;}%20.cls-3-6%20{fill:%20%23fff;}%3c/style%3e%3clinearGradient%20id='dark_wine'%20x1='220.57'%20y1='310.8'%20x2='220.57'%20y2='211.98'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23730000'%20/%3e%3cstop%20offset='0.49'%20stop-color='%23a51733'%20/%3e%3c/linearGradient%3e%3clinearGradient%20id='light_wine'%20x1='246.27'%20y1='349.71'%20x2='246.27'%20y2='233'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23f44a6b'%20/%3e%3cstop%20offset='0.28'%20stop-color='%23df294c'%20/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='CameraUI_U'%20class='cameraLetter'%3e%3cpath%20id='U_Left'%20class='cls-3-1'%20d='M180.26,271.6s7.57,16,14.11,23.42a45.43,45.43,0,0,0,16.38,11.86,49.46,49.46,0,0,0,21.42,3.87c9.42-.46,20.55-3.87,29.24-11.86-3.9,2.5-9.87,5.1-15.9,4.77a25.66,25.66,0,0,1-18.39-9.09c-9.38-10.31-7.61-28.35-7.74-32.68-.35-11.43.77-21.92-1.76-36.2-.47-2.63-1.79-5.18-4.55-8-1.84-1.86-8.41-5.75-13.43-5.74-7.3,0-12.94,3.71-15.38,7.84-2,3.41-3.06,4.22-4.22,25.08a215.27,215.27,0,0,0,.22,26.76Z'%20transform='translate(-132.71%20-151.63)'%20/%3e%3cpath%20id='U_Right'%20class='cls-3-2'%20d='M277.33,241.73a16.41,16.41,0,0,1,4.05-4.91c4.17-3.39,9-3.66,10.92-3.81a19.67,19.67,0,0,1,12.53,4.58c1.2,1,6.12,5.58,7.13,17.29.74,8.51,3.31,65.93-37,87.13-4.23,2.22-18,9.26-35.67,7.39a62.35,62.35,0,0,1-20.79-6.11,65.68,65.68,0,0,1-18.9-14.24c-20.2-21.66-19.35-57.45-19.35-57.45s7.57,16,14.11,23.42a45.43,45.43,0,0,0,16.38,11.86,49.46,49.46,0,0,0,21.42,3.87c11.66-.57,25.92-5.64,35-18.33C276.73,278.93,271.67,252.64,277.33,241.73Z'%20transform='translate(-132.71%20-151.63)'%20/%3e%3c/g%3e%3cg%20id='CameraUI_Lens'%3e%3cg%20id='lens'%20class='cameraLens'%3e%3ccircle%20id='lens_bg'%20class='cls-3-4'%20cx='159.13'%20cy='58.39'%20r='18.66'%20/%3e%3cpath%20id='lens_inner'%20class='cls-3-5'%20d='M302.85,210.44a11,11,0,1,1-22,0c0-6.08,4.93-11.86,11-11.86S302.85,204.36,302.85,210.44Z'%20transform='translate(-132.71%20-151.63)'%20/%3e%3cg%20id='reflections'%3e%3cellipse%20id='dot_1'%20class='cls-3-6'%20cx='174.36'%20cy='53.69'%20rx='1.84'%20ry='1.42'%20/%3e%3cellipse%20id='dot_2'%20class='cls-3-6'%20cx='174.36'%20cy='57.08'%20rx='1.84'%20ry='1.42'%20/%3e%3cellipse%20id='dot_3'%20class='cls-3-6'%20cx='174.36'%20cy='60.46'%20rx='1.84'%20ry='1.42'%20/%3e%3ccircle%20id='dot_4'%20class='cls-3-6'%20cx='164.09'%20cy='63.77'%20r='1.66'%20/%3e%3cpath%20id='wide_1'%20class='cls-3-6'%20d='M289.83,201c-1.07-.88-5.52,3.09-6.3,5.43a1.52,1.52,0,0,0,0,1.26c.43.69,1.72.61,2.18.53,2.68-.43,4.72-4.08,4.8-4.36A3.18,3.18,0,0,0,289.83,201Z'%20transform='translate(-132.71%20-151.63)'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",g1=Object.freeze(Object.defineProperty({__proto__:null,default:f1},Symbol.toStringTag,{value:"Module"}));var ku={};/*! For license information please see bundle.js.LICENSE.txt */var v1={69:s=>{var e=1e3,t=60*e,n=60*t,r=24*n,i=7*r,o=365.25*r;function a(l,u,d,h){var v=u>=1.5*d;return Math.round(l/d)+" "+h+(v?"s":"")}s.exports=function(l,u){u=u||{};var d=typeof l;if(d==="string"&&l.length>0)return function(h){if(!((h=String(h)).length>100)){var v=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(v){var f=parseFloat(v[1]);switch((v[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return f*o;case"weeks":case"week":case"w":return f*i;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}(l);if(d==="number"&&isFinite(l))return u.long?function(h){var v=Math.abs(h);return v>=r?a(h,v,r,"day"):v>=n?a(h,v,n,"hour"):v>=t?a(h,v,t,"minute"):v>=e?a(h,v,e,"second"):h+" ms"}(l):function(h){var v=Math.abs(h);return v>=r?Math.round(h/r)+"d":v>=n?Math.round(h/n)+"h":v>=t?Math.round(h/t)+"m":v>=e?Math.round(h/e)+"s":h+"ms"}(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))}},142:s=>{var e=1e3,t=60*e,n=60*t,r=24*n,i=7*r,o=365.25*r;function a(l,u,d,h){var v=u>=1.5*d;return Math.round(l/d)+" "+h+(v?"s":"")}s.exports=function(l,u){u=u||{};var d=typeof l;if(d==="string"&&l.length>0)return function(h){if(!((h=String(h)).length>100)){var v=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(v){var f=parseFloat(v[1]);switch((v[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return f*o;case"weeks":case"week":case"w":return f*i;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}(l);if(d==="number"&&isFinite(l))return u.long?function(h){var v=Math.abs(h);return v>=r?a(h,v,r,"day"):v>=n?a(h,v,n,"hour"):v>=t?a(h,v,t,"minute"):v>=e?a(h,v,e,"second"):h+" ms"}(l):function(h){var v=Math.abs(h);return v>=r?Math.round(h/r)+"d":v>=n?Math.round(h/n)+"h":v>=t?Math.round(h/t)+"m":v>=e?Math.round(h/e)+"s":h+"ms"}(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))}},287:(s,e,t)=>{s.exports=function(n){function r(a){let l,u,d,h=null;function v(...f){if(!v.enabled)return;const b=v,k=Number(new Date),z=k-(l||k);b.diff=z,b.prev=l,b.curr=k,l=k,f[0]=r.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let L=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(se,Z)=>{if(se==="%%")return"%";L++;const N=r.formatters[Z];if(typeof N=="function"){const E=f[L];se=N.call(b,E),f.splice(L,1),L--}return se}),r.formatArgs.call(b,f),(b.log||r.log).apply(b,f)}return v.namespace=a,v.useColors=r.useColors(),v.color=r.selectColor(a),v.extend=i,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(u!==r.namespaces&&(u=r.namespaces,d=r.enabled(a)),d),set:f=>{h=f}}),typeof r.init=="function"&&r.init(v),v}function i(a,l){const u=r(this.namespace+(l===void 0?":":l)+a);return u.log=this.log,u}function o(a,l){let u=0,d=0,h=-1,v=0;for(;u<a.length;)if(d<l.length&&(l[d]===a[u]||l[d]==="*"))l[d]==="*"?(h=d,v=u,d++):(u++,d++);else{if(h===-1)return!1;d=h+1,v++,u=v}for(;d<l.length&&l[d]==="*";)d++;return d===l.length}return r.debug=r,r.default=r,r.coerce=function(a){return a instanceof Error?a.stack||a.message:a},r.disable=function(){const a=[...r.names,...r.skips.map(l=>"-"+l)].join(",");return r.enable(""),a},r.enable=function(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];const l=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const u of l)u[0]==="-"?r.skips.push(u.slice(1)):r.names.push(u)},r.enabled=function(a){for(const l of r.skips)if(o(a,l))return!1;for(const l of r.names)if(o(a,l))return!0;return!1},r.humanize=t(142),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(n).forEach(a=>{r[a]=n[a]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(a){let l=0;for(let u=0;u<a.length;u++)l=(l<<5)-l+a.charCodeAt(u),l|=0;return r.colors[Math.abs(l)%r.colors.length]},r.enable(r.load()),r}},288:(s,e,t)=>{e.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+s.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;r.splice(1,0,i,"color: inherit");let o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(a=o))}),r.splice(a,0,i)},e.save=function(r){try{r?e.storage.setItem("debug",r):e.storage.removeItem("debug")}catch{}},e.load=function(){let r;try{r=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=ku.DEBUG),r},e.useColors=function(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch{}}(),e.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),s.exports=t(287)(e);const{formatters:n}=s.exports;n.j=function(r){try{return JSON.stringify(r)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}}},413:(s,e,t)=>{e.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+s.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;r.splice(1,0,i,"color: inherit");let o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(o++,l==="%c"&&(a=o))}),r.splice(a,0,i)},e.save=function(r){try{r?e.storage.setItem("debug",r):e.storage.removeItem("debug")}catch{}},e.load=function(){let r;try{r=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=ku.DEBUG),r},e.useColors=function(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch{}}(),e.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),s.exports=t(692)(e);const{formatters:n}=s.exports;n.j=function(r){try{return JSON.stringify(r)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}}},672:s=>{const e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t=()=>e.now(),n=i=>i===1/0||(o=>o&&o===Math.floor(o)&&o>0&&isFinite(o))(i);class r{constructor({max:o=1/0,ttl:a,updateAgeOnGet:l=!1,checkAgeOnGet:u=!1,noUpdateTTL:d=!1,dispose:h,noDisposeOnSet:v=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,a!==void 0&&!n(a))throw new TypeError("ttl must be positive integer or Infinity if set");if(!n(o))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=a,this.max=o,this.updateAgeOnGet=!!l,this.checkAgeOnGet=!!u,this.noUpdateTTL=!!d,this.noDisposeOnSet=!!v,h!==void 0){if(typeof h!="function")throw new TypeError("dispose must be function if set");this.dispose=h}this.timer=void 0,this.timerExpiration=void 0}setTimer(o,a){if(this.timerExpiration<o)return;this.timer&&clearTimeout(this.timer);const l=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(const u in this.expirations){this.setTimer(u,u-t());break}},a);l.unref&&l.unref(),this.timerExpiration=o,this.timer=l}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){const o=this.dispose!==r.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(const[a,l]of o)this.dispose(l,a,"delete")}setTTL(o,a=this.ttl){const l=this.expirationMap.get(o);if(l!==void 0){const u=this.expirations[l];!u||u.length<=1?delete this.expirations[l]:this.expirations[l]=u.filter(d=>d!==o)}if(a!==1/0){const u=Math.floor(t()+a);this.expirationMap.set(o,u),this.expirations[u]||(this.expirations[u]=[],this.setTimer(u,a)),this.expirations[u].push(o)}else this.expirationMap.set(o,1/0)}set(o,a,{ttl:l=this.ttl,noUpdateTTL:u=this.noUpdateTTL,noDisposeOnSet:d=this.noDisposeOnSet}={}){if(!n(l))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(o)){u||this.setTTL(o,l);const h=this.data.get(o);h!==a&&(this.data.set(o,a),d||this.dispose(h,o,"set"))}else this.setTTL(o,l),this.data.set(o,a);for(;this.size>this.max;)this.purgeToCapacity();return this}has(o){return this.data.has(o)}getRemainingTTL(o){const a=this.expirationMap.get(o);return a===1/0?a:a!==void 0?Math.max(0,Math.ceil(a-t())):0}get(o,{updateAgeOnGet:a=this.updateAgeOnGet,ttl:l=this.ttl,checkAgeOnGet:u=this.checkAgeOnGet}={}){const d=this.data.get(o);if(!u||this.getRemainingTTL(o)!==0)return a&&this.setTTL(o,l),d;this.delete(o)}dispose(o,a){}delete(o){const a=this.expirationMap.get(o);if(a!==void 0){const l=this.data.get(o);this.data.delete(o),this.expirationMap.delete(o);const u=this.expirations[a];return u&&(u.length<=1?delete this.expirations[a]:this.expirations[a]=u.filter(d=>d!==o)),this.dispose(l,o,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(const o in this.expirations){const a=this.expirations[o];if(!(this.size-a.length>=this.max)){const l=this.size-this.max,u=[];for(const d of a.splice(0,l))u.push([d,this.data.get(d)]),this.data.delete(d),this.expirationMap.delete(d);for(const[d,h]of u)this.dispose(h,d,"evict");return}{delete this.expirations[o];const l=[];for(const u of a)l.push([u,this.data.get(u)]),this.data.delete(u),this.expirationMap.delete(u);for(const[u,d]of l)this.dispose(d,u,"evict")}}}get size(){return this.data.size}purgeStale(){const o=Math.ceil(t());for(const a in this.expirations){if(a==="Infinity"||a>o)return;const l=[...this.expirations[a]||[]],u=[];delete this.expirations[a];for(const d of l)u.push([d,this.data.get(d)]),this.data.delete(d),this.expirationMap.delete(d);for(const[d,h]of u)this.dispose(h,d,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(const o in this.expirations)for(const a of this.expirations[o])yield[a,this.data.get(a)]}*keys(){for(const o in this.expirations)for(const a of this.expirations[o])yield a}*values(){for(const o in this.expirations)for(const a of this.expirations[o])yield this.data.get(a)}[Symbol.iterator](){return this.entries()}}s.exports=r},692:(s,e,t)=>{s.exports=function(n){function r(a){let l,u,d,h=null;function v(...f){if(!v.enabled)return;const b=v,k=Number(new Date),z=k-(l||k);b.diff=z,b.prev=l,b.curr=k,l=k,f[0]=r.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let L=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(se,Z)=>{if(se==="%%")return"%";L++;const N=r.formatters[Z];if(typeof N=="function"){const E=f[L];se=N.call(b,E),f.splice(L,1),L--}return se}),r.formatArgs.call(b,f),(b.log||r.log).apply(b,f)}return v.namespace=a,v.useColors=r.useColors(),v.color=r.selectColor(a),v.extend=i,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(u!==r.namespaces&&(u=r.namespaces,d=r.enabled(a)),d),set:f=>{h=f}}),typeof r.init=="function"&&r.init(v),v}function i(a,l){const u=r(this.namespace+(l===void 0?":":l)+a);return u.log=this.log,u}function o(a,l){let u=0,d=0,h=-1,v=0;for(;u<a.length;)if(d<l.length&&(l[d]===a[u]||l[d]==="*"))l[d]==="*"?(h=d,v=u,d++):(u++,d++);else{if(h===-1)return!1;d=h+1,v++,u=v}for(;d<l.length&&l[d]==="*";)d++;return d===l.length}return r.debug=r,r.default=r,r.coerce=function(a){return a instanceof Error?a.stack||a.message:a},r.disable=function(){const a=[...r.names,...r.skips.map(l=>"-"+l)].join(",");return r.enable(""),a},r.enable=function(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];const l=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const u of l)u[0]==="-"?r.skips.push(u.slice(1)):r.names.push(u)},r.enabled=function(a){for(const l of r.skips)if(o(a,l))return!1;for(const l of r.names)if(o(a,l))return!0;return!1},r.humanize=t(69),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(n).forEach(a=>{r[a]=n[a]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(a){let l=0;for(let u=0;u<a.length;u++)l=(l<<5)-l+a.charCodeAt(u),l|=0;return r.colors[Math.abs(l)%r.colors.length]},r.enable(r.load()),r}},779:(s,e,t)=>{var n;(function(r){(function(){var i=typeof globalThis=="object"?globalThis:typeof t.g=="object"?t.g:typeof self=="object"?self:typeof this=="object"?this:function(){try{return Function("return this;")()}catch{}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch{}}(),o=a(r);function a(l,u){return function(d,h){Object.defineProperty(l,d,{configurable:!0,writable:!0,value:h}),u&&u(d,h)}}i.Reflect!==void 0&&(o=a(i.Reflect,o)),function(l,u){var d=Object.prototype.hasOwnProperty,h=typeof Symbol=="function",v=h&&Symbol.toPrimitive!==void 0?Symbol.toPrimitive:"@@toPrimitive",f=h&&Symbol.iterator!==void 0?Symbol.iterator:"@@iterator",b=typeof Object.create=="function",k={__proto__:[]}instanceof Array,z=!b&&!k,L={create:b?function(){return ns(Object.create(null))}:k?function(){return ns({__proto__:null})}:function(){return ns({})},has:z?function(I,ne){return d.call(I,ne)}:function(I,ne){return ne in I},get:z?function(I,ne){return d.call(I,ne)?I[ne]:void 0}:function(I,ne){return I[ne]}},se=Object.getPrototypeOf(Function),Z=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:$s(),N=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:hs(),E=typeof WeakMap=="function"?WeakMap:Cs(),O=h?Symbol.for("@reflect-metadata:registry"):void 0,U=Zt(),S=_s(U);function M(I,ne,ge,Ae){if(ve(ge)){if(!V(I))throw new TypeError;if(!_e(ne))throw new TypeError;return Ce(I,ne)}if(!V(I))throw new TypeError;if(!wt(ne))throw new TypeError;if(!wt(Ae)&&!ve(Ae)&&!ft(Ae))throw new TypeError;return ft(Ae)&&(Ae=void 0),F(I,ne,ge=Ue(ge),Ae)}function B(I,ne){function ge(Ae,nt){if(!wt(Ae))throw new TypeError;if(!ve(nt)&&!ye(nt))throw new TypeError;ht(I,ne,Ae,nt)}return ge}function K(I,ne,ge,Ae){if(!wt(ge))throw new TypeError;return ve(Ae)||(Ae=Ue(Ae)),ht(I,ne,ge,Ae)}function R(I,ne,ge){if(!wt(ne))throw new TypeError;return ve(ge)||(ge=Ue(ge)),D(I,ne,ge)}function w(I,ne,ge){if(!wt(ne))throw new TypeError;return ve(ge)||(ge=Ue(ge)),Y(I,ne,ge)}function H(I,ne,ge){if(!wt(ne))throw new TypeError;return ve(ge)||(ge=Ue(ge)),Te(I,ne,ge)}function J(I,ne,ge){if(!wt(ne))throw new TypeError;return ve(ge)||(ge=Ue(ge)),He(I,ne,ge)}function q(I,ne){if(!wt(I))throw new TypeError;return ve(ne)||(ne=Ue(ne)),At(I,ne)}function oe(I,ne){if(!wt(I))throw new TypeError;return ve(ne)||(ne=Ue(ne)),Qe(I,ne)}function ue(I,ne,ge){if(!wt(ne))throw new TypeError;if(ve(ge)||(ge=Ue(ge)),!wt(ne))throw new TypeError;ve(ge)||(ge=Ue(ge));var Ae=ls(ne,ge,!1);return!ve(Ae)&&Ae.OrdinaryDeleteMetadata(I,ne,ge)}function Ce(I,ne){for(var ge=I.length-1;ge>=0;--ge){var Ae=(0,I[ge])(ne);if(!ve(Ae)&&!ft(Ae)){if(!_e(Ae))throw new TypeError;ne=Ae}}return ne}function F(I,ne,ge,Ae){for(var nt=I.length-1;nt>=0;--nt){var Ot=(0,I[nt])(ne,ge,Ae);if(!ve(Ot)&&!ft(Ot)){if(!wt(Ot))throw new TypeError;Ae=Ot}}return Ae}function D(I,ne,ge){if(Y(I,ne,ge))return!0;var Ae=Le(ne);return!ft(Ae)&&D(I,Ae,ge)}function Y(I,ne,ge){var Ae=ls(ne,ge,!1);return!ve(Ae)&&es(Ae.OrdinaryHasOwnMetadata(I,ne,ge))}function Te(I,ne,ge){if(Y(I,ne,ge))return He(I,ne,ge);var Ae=Le(ne);return ft(Ae)?void 0:Te(I,Ae,ge)}function He(I,ne,ge){var Ae=ls(ne,ge,!1);if(!ve(Ae))return Ae.OrdinaryGetOwnMetadata(I,ne,ge)}function ht(I,ne,ge,Ae){ls(ge,Ae,!0).OrdinaryDefineOwnMetadata(I,ne,ge,Ae)}function At(I,ne){var ge=Qe(I,ne),Ae=Le(I);if(Ae===null)return ge;var nt=At(Ae,ne);if(nt.length<=0)return ge;if(ge.length<=0)return nt;for(var Ot=new N,Kt=[],Ye=0,ke=ge;Ye<ke.length;Ye++){var Oe=ke[Ye];Ot.has(Oe)||(Ot.add(Oe),Kt.push(Oe))}for(var Fe=0,be=nt;Fe<be.length;Fe++)Oe=be[Fe],Ot.has(Oe)||(Ot.add(Oe),Kt.push(Oe));return Kt}function Qe(I,ne){var ge=ls(I,ne,!1);return ge?ge.OrdinaryOwnMetadataKeys(I,ne):[]}function ze(I){if(I===null)return 1;switch(typeof I){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return I===null?1:6;default:return 6}}function ve(I){return I===void 0}function ft(I){return I===null}function Xt(I){return typeof I=="symbol"}function wt(I){return typeof I=="object"?I!==null:typeof I=="function"}function zt(I,ne){switch(ze(I)){case 0:case 1:case 2:case 3:case 4:case 5:return I}var ge="string",Ae=vt(I,v);if(Ae!==void 0){var nt=Ae.call(I,ge);if(wt(nt))throw new TypeError;return nt}return it(I)}function it(I,ne){var ge,Ae;{var nt=I.toString;if(X(nt)&&!wt(Ae=nt.call(I))||X(ge=I.valueOf)&&!wt(Ae=ge.call(I)))return Ae}throw new TypeError}function es(I){return!!I}function Be(I){return""+I}function Ue(I){var ne=zt(I);return Xt(ne)?ne:Be(ne)}function V(I){return Array.isArray?Array.isArray(I):I instanceof Object?I instanceof Array:Object.prototype.toString.call(I)==="[object Array]"}function X(I){return typeof I=="function"}function _e(I){return typeof I=="function"}function ye(I){switch(ze(I)){case 3:case 4:return!0;default:return!1}}function fe(I,ne){return I===ne||I!=I&&ne!=ne}function vt(I,ne){var ge=I[ne];if(ge!=null){if(!X(ge))throw new TypeError;return ge}}function Tt(I){var ne=vt(I,f);if(!X(ne))throw new TypeError;var ge=ne.call(I);if(!wt(ge))throw new TypeError;return ge}function me(I){return I.value}function ie(I){var ne=I.next();return!ne.done&&ne}function he(I){var ne=I.return;ne&&ne.call(I)}function Le(I){var ne=Object.getPrototypeOf(I);if(typeof I!="function"||I===se||ne!==se)return ne;var ge=I.prototype,Ae=ge&&Object.getPrototypeOf(ge);if(Ae==null||Ae===Object.prototype)return ne;var nt=Ae.constructor;return typeof nt!="function"||nt===I?ne:nt}function st(){var I,ne,ge,Ae;ve(O)||u.Reflect===void 0||O in u.Reflect||typeof u.Reflect.defineMetadata!="function"||(I=Gt(u.Reflect));var nt=new E,Ot={registerProvider:Kt,getProvider:ke,setProvider:Fe};return Ot;function Kt(be){if(!Object.isExtensible(Ot))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case I===be:break;case ve(ne):ne=be;break;case ne===be:break;case ve(ge):ge=be;break;case ge===be:break;default:Ae===void 0&&(Ae=new N),Ae.add(be)}}function Ye(be,ot){if(!ve(ne)){if(ne.isProviderFor(be,ot))return ne;if(!ve(ge)){if(ge.isProviderFor(be,ot))return ne;if(!ve(Ae))for(var _=Tt(Ae);;){var x=ie(_);if(!x)return;var C=me(x);if(C.isProviderFor(be,ot))return he(_),C}}}if(!ve(I)&&I.isProviderFor(be,ot))return I}function ke(be,ot){var _,x=nt.get(be);return ve(x)||(_=x.get(ot)),ve(_)&&(ve(_=Ye(be,ot))||(ve(x)&&(x=new Z,nt.set(be,x)),x.set(ot,_))),_}function Oe(be){if(ve(be))throw new TypeError;return ne===be||ge===be||!ve(Ae)&&Ae.has(be)}function Fe(be,ot,_){if(!Oe(_))throw new Error("Metadata provider not registered.");var x=ke(be,ot);if(x!==_){if(!ve(x))return!1;var C=nt.get(be);ve(C)&&(C=new Z,nt.set(be,C)),C.set(ot,_)}return!0}}function Zt(){var I;return!ve(O)&&wt(u.Reflect)&&Object.isExtensible(u.Reflect)&&(I=u.Reflect[O]),ve(I)&&(I=st()),!ve(O)&&wt(u.Reflect)&&Object.isExtensible(u.Reflect)&&Object.defineProperty(u.Reflect,O,{enumerable:!1,configurable:!1,writable:!1,value:I}),I}function _s(I){var ne=new E,ge={isProviderFor:function(Oe,Fe){var be=ne.get(Oe);return!ve(be)&&be.has(Fe)},OrdinaryDefineOwnMetadata:Kt,OrdinaryHasOwnMetadata:nt,OrdinaryGetOwnMetadata:Ot,OrdinaryOwnMetadataKeys:Ye,OrdinaryDeleteMetadata:ke};return U.registerProvider(ge),ge;function Ae(Oe,Fe,be){var ot=ne.get(Oe),_=!1;if(ve(ot)){if(!be)return;ot=new Z,ne.set(Oe,ot),_=!0}var x=ot.get(Fe);if(ve(x)){if(!be)return;if(x=new Z,ot.set(Fe,x),!I.setProvider(Oe,Fe,ge))throw ot.delete(Fe),_&&ne.delete(Oe),new Error("Wrong provider for target.")}return x}function nt(Oe,Fe,be){var ot=Ae(Fe,be,!1);return!ve(ot)&&es(ot.has(Oe))}function Ot(Oe,Fe,be){var ot=Ae(Fe,be,!1);if(!ve(ot))return ot.get(Oe)}function Kt(Oe,Fe,be,ot){Ae(be,ot,!0).set(Oe,Fe)}function Ye(Oe,Fe){var be=[],ot=Ae(Oe,Fe,!1);if(ve(ot))return be;for(var _=Tt(ot.keys()),x=0;;){var C=ie(_);if(!C)return be.length=x,be;var T=me(C);try{be[x]=T}catch(P){try{he(_)}finally{throw P}}x++}}function ke(Oe,Fe,be){var ot=Ae(Fe,be,!1);if(ve(ot)||!ot.delete(Oe))return!1;if(ot.size===0){var _=ne.get(Fe);ve(_)||(_.delete(be),_.size===0&&ne.delete(_))}return!0}}function Gt(I){var ne=I.defineMetadata,ge=I.hasOwnMetadata,Ae=I.getOwnMetadata,nt=I.getOwnMetadataKeys,Ot=I.deleteMetadata,Kt=new E,Ye={isProviderFor:function(ke,Oe){var Fe=Kt.get(ke);return!(ve(Fe)||!Fe.has(Oe))||!!nt(ke,Oe).length&&(ve(Fe)&&(Fe=new N,Kt.set(ke,Fe)),Fe.add(Oe),!0)},OrdinaryDefineOwnMetadata:ne,OrdinaryHasOwnMetadata:ge,OrdinaryGetOwnMetadata:Ae,OrdinaryOwnMetadataKeys:nt,OrdinaryDeleteMetadata:Ot};return Ye}function ls(I,ne,ge){var Ae=U.getProvider(I,ne);if(!ve(Ae))return Ae;if(ge){if(U.setProvider(I,ne,S))return S;throw new Error("Illegal state.")}}function $s(){var I={},ne=[],ge=function(){function Ye(ke,Oe,Fe){this._index=0,this._keys=ke,this._values=Oe,this._selector=Fe}return Ye.prototype["@@iterator"]=function(){return this},Ye.prototype[f]=function(){return this},Ye.prototype.next=function(){var ke=this._index;if(ke>=0&&ke<this._keys.length){var Oe=this._selector(this._keys[ke],this._values[ke]);return ke+1>=this._keys.length?(this._index=-1,this._keys=ne,this._values=ne):this._index++,{value:Oe,done:!1}}return{value:void 0,done:!0}},Ye.prototype.throw=function(ke){throw this._index>=0&&(this._index=-1,this._keys=ne,this._values=ne),ke},Ye.prototype.return=function(ke){return this._index>=0&&(this._index=-1,this._keys=ne,this._values=ne),{value:ke,done:!0}},Ye}(),Ae=function(){function Ye(){this._keys=[],this._values=[],this._cacheKey=I,this._cacheIndex=-2}return Object.defineProperty(Ye.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ye.prototype.has=function(ke){return this._find(ke,!1)>=0},Ye.prototype.get=function(ke){var Oe=this._find(ke,!1);return Oe>=0?this._values[Oe]:void 0},Ye.prototype.set=function(ke,Oe){var Fe=this._find(ke,!0);return this._values[Fe]=Oe,this},Ye.prototype.delete=function(ke){var Oe=this._find(ke,!1);if(Oe>=0){for(var Fe=this._keys.length,be=Oe+1;be<Fe;be++)this._keys[be-1]=this._keys[be],this._values[be-1]=this._values[be];return this._keys.length--,this._values.length--,fe(ke,this._cacheKey)&&(this._cacheKey=I,this._cacheIndex=-2),!0}return!1},Ye.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=I,this._cacheIndex=-2},Ye.prototype.keys=function(){return new ge(this._keys,this._values,nt)},Ye.prototype.values=function(){return new ge(this._keys,this._values,Ot)},Ye.prototype.entries=function(){return new ge(this._keys,this._values,Kt)},Ye.prototype["@@iterator"]=function(){return this.entries()},Ye.prototype[f]=function(){return this.entries()},Ye.prototype._find=function(ke,Oe){if(!fe(this._cacheKey,ke)){this._cacheIndex=-1;for(var Fe=0;Fe<this._keys.length;Fe++)if(fe(this._keys[Fe],ke)){this._cacheIndex=Fe;break}}return this._cacheIndex<0&&Oe&&(this._cacheIndex=this._keys.length,this._keys.push(ke),this._values.push(void 0)),this._cacheIndex},Ye}();return Ae;function nt(Ye,ke){return Ye}function Ot(Ye,ke){return ke}function Kt(Ye,ke){return[Ye,ke]}}function hs(){return function(){function I(){this._map=new Z}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(ne){return this._map.has(ne)},I.prototype.add=function(ne){return this._map.set(ne,ne),this},I.prototype.delete=function(ne){return this._map.delete(ne)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[f]=function(){return this.keys()},I}()}function Cs(){var I=16,ne=L.create(),ge=Ae();return function(){function ke(){this._key=Ae()}return ke.prototype.has=function(Oe){var Fe=nt(Oe,!1);return Fe!==void 0&&L.has(Fe,this._key)},ke.prototype.get=function(Oe){var Fe=nt(Oe,!1);return Fe!==void 0?L.get(Fe,this._key):void 0},ke.prototype.set=function(Oe,Fe){return nt(Oe,!0)[this._key]=Fe,this},ke.prototype.delete=function(Oe){var Fe=nt(Oe,!1);return Fe!==void 0&&delete Fe[this._key]},ke.prototype.clear=function(){this._key=Ae()},ke}();function Ae(){var ke;do ke="@@WeakMap@@"+Ye();while(L.has(ne,ke));return ne[ke]=!0,ke}function nt(ke,Oe){if(!d.call(ke,ge)){if(!Oe)return;Object.defineProperty(ke,ge,{value:L.create()})}return ke[ge]}function Ot(ke,Oe){for(var Fe=0;Fe<Oe;++Fe)ke[Fe]=255*Math.random()|0;return ke}function Kt(ke){if(typeof Uint8Array=="function"){var Oe=new Uint8Array(ke);return typeof crypto<"u"?crypto.getRandomValues(Oe):typeof msCrypto<"u"?msCrypto.getRandomValues(Oe):Ot(Oe,ke),Oe}return Ot(new Array(ke),ke)}function Ye(){var ke=Kt(I);ke[6]=79&ke[6]|64,ke[8]=191&ke[8]|128;for(var Oe="",Fe=0;Fe<I;++Fe){var be=ke[Fe];Fe!==4&&Fe!==6&&Fe!==8||(Oe+="-"),be<16&&(Oe+="0"),Oe+=be.toString(16).toLowerCase()}return Oe}}function ns(I){return I.__=void 0,delete I.__,I}l("decorate",M),l("metadata",B),l("defineMetadata",K),l("hasMetadata",R),l("hasOwnMetadata",w),l("getMetadata",H),l("getOwnMetadata",J),l("getMetadataKeys",q),l("getOwnMetadataKeys",oe),l("deleteMetadata",ue)}(o,i),i.Reflect===void 0&&(i.Reflect=r)})()})(n||(n={}))}},Eu={};function tn(s){var e=Eu[s];if(e!==void 0)return e.exports;var t=Eu[s]={exports:{}};return v1[s](t,t.exports,tn),t.exports}tn.n=s=>{var e=s&&s.__esModule?()=>s.default:()=>s;return tn.d(e,{a:e}),e},tn.d=(s,e)=>{for(var t in e)tn.o(e,t)&&!tn.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},tn.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),tn.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e);class _1{constructor(e){p(this,"baseURL");p(this,"abortControllers",new Set);this.baseURL=`${e}/api`}async request(e,t,n,r={}){const i=new AbortController;this.abortControllers.add(i);const o=setTimeout(()=>{i.abort(),this.abortControllers.delete(i)},15e3);try{const a=await fetch(`${this.baseURL}${t}`,{method:e,headers:{"Content-Type":"application/json",...r.headers},body:n?JSON.stringify(n):void 0,signal:i.signal,...r});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a}finally{clearTimeout(o),this.abortControllers.delete(i)}}get(e,t){return this.request("GET",e,void 0,t)}post(e,t,n){return this.request("POST",e,t,n)}}const As={FAILED:"CONNECTION_FAILED",TIMEOUT:"CONNECTION_TIMEOUT",NOT_CONNECTED:"CONNECTION_NOT_CONNECTED",INVALID_STATE:"CONNECTION_INVALID_STATE",INTERNAL_ERROR:"CONNECTION_INTERNAL_ERROR"},Ir={MISSING:"CONFIG_MISSING",INVALID:"CONFIG_INVALID",INTERNAL_ERROR:"CONFIG_INTERNAL_ERROR"},en={INVALID_CREDENTIALS:"AUTH_INVALID_CREDENTIALS",UNAUTHORIZED:"AUTH_UNAUTHORIZED",FORBIDDEN:"AUTH_FORBIDDEN",INTERNAL_ERROR:"AUTH_INTERNAL_ERROR"},An={REGISTRATION_FAILED:"CLIENT_REGISTRATION_FAILED",UNREGISTRATION_FAILED:"CLIENT_UNREGISTRATION_FAILED",NOT_FOUND:"CLIENT_NOT_FOUND",INVALID_STATE:"CLIENT_INVALID_STATE",INTERNAL_ERROR:"CLIENT_INTERNAL_ERROR"},Bn={INVALID_FORMAT:"MESSAGE_INVALID_FORMAT",DELIVERY_FAILED:"MESSAGE_DELIVERY_FAILED",TIMEOUT:"MESSAGE_TIMEOUT",EXECUTION_FAILED:"MESSAGE_EXECUTION_FAILED",INTERNAL_ERROR:"MESSAGE_INTERNAL_ERROR"},nr={METHOD_NOT_FOUND:"RPC_METHOD_NOT_FOUND",INVALID_REQUEST:"RPC_INVALID_REQUEST",INTERNAL_ERROR:"RPC_INTERNAL_ERROR",CONNECTION_FAILED:"RPC_CONNECTION_FAILED"},Yh={INTERNAL_ERROR:"REGISTRY_INTERNAL_ERROR"},tr={JOIN_FAILED:"CLUSTER_JOIN_FAILED",SYNC_FAILED:"CLUSTER_SYNC_FAILED",COMMUNICATION_FAILED:"CLUSTER_COMMUNICATION_FAILED",INVALID_STATE:"CLUSTER_INVALID_STATE",NODE_NOT_FOUND:"CLUSTER_NODE_NOT_FOUND",INSTANCE_NOT_FOUND:"CLUSTER_INSTANCE_NOT_FOUND",INTERNAL_ERROR:"CLUSTER_INTERNAL_ERROR"};class Ss extends Error{constructor(t,n,r,i){super(t);p(this,"code");p(this,"details");p(this,"cause");this.code=n,this.details=r,this.cause=i,this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),this.cause&&(this.cause={name:this.cause.name,message:this.cause.message,...this.cause instanceof Ss?{code:this.cause.code,details:this.cause.details}:{code:"INTERNAL_ERROR",details:{description:this.cause.message}}})}toJSON(){return{name:this.name,message:this.message,code:this.code,details:this.details,stack:this.stack,cause:this.cause}}static fromJSON(t){return new Ss(t.message,t.code,t.details,t.cause?Ss.fromJSON(t.cause):void 0)}}class y1 extends Ss{constructor(e,t,n){super(e,As.INTERNAL_ERROR,t,n)}}class b1 extends Ss{constructor(e,t,n){super(e,Ir.INTERNAL_ERROR,t,n)}}class w1 extends Ss{constructor(e,t,n){super(e,en.INTERNAL_ERROR,t,n)}}class x1 extends Ss{constructor(e,t,n){super(e,An.INTERNAL_ERROR,t,n)}}class S1 extends Ss{constructor(e,t,n){super(e,Bn.INTERNAL_ERROR,t,n)}}class C1 extends Ss{constructor(e,t,n){super(e,nr.INTERNAL_ERROR,t,n)}}class k1 extends Ss{constructor(e,t,n){super(e,Yh.INTERNAL_ERROR,t,n)}}class E1 extends Ss{constructor(e,t,n){super(e,tr.INTERNAL_ERROR,t,n)}}const lt=class lt{static create(e,t,n,r){if(t instanceof Ss)return t;const i=t instanceof Error?t:new Error(String(t)),o=function(a){function l(u){let d=!1;try{typeof Buffer<"u"&&(d=u instanceof Buffer)}catch{d=!1}return u instanceof ArrayBuffer||u instanceof Uint8Array||d||ArrayBuffer.isView(u)?"<binary>":Array.isArray(u)?u.map(l):u&&typeof u=="object"?Object.fromEntries(Object.entries(u).map(([h,v])=>[h,l(v)])):u}return l(a??{})}(r);switch(e){case"connection":return new y1(n,o,i);case"config":return new b1(n,o,i);case"auth":return new w1(n,o,i);case"client":return new x1(n,o,i);case"message":return new S1(n,o,i);case"rpc":return new C1(n,o,i);case"registry":return new k1(n,o,i);case"cluster":return new E1(n,o,i)}}static async handle(e,t,n,r){try{return await e()}catch(i){throw lt.create(t,i,n,r)}}};p(lt,"connection",{connectionFailed:(e,t)=>lt.create("connection",e,"Connection failed",{description:"Failed to establish connection",code:As.FAILED,...t}),subscribeFailed:(e,t)=>lt.create("connection",e,"Subscription failed",{description:"Failed to subscribe to subject",code:As.INTERNAL_ERROR,...t}),requestFailed:(e,t)=>lt.create("connection",e,"Request failed",{description:"Failed to send request",code:As.INTERNAL_ERROR,...t}),timeout:(e,t)=>lt.create("connection",e,"Connection timeout",{description:"Connection attempt timed out",code:As.TIMEOUT,...t}),notConnected:(e,t)=>lt.create("connection",e,"Not connected",{description:"Connection is not established",code:As.INTERNAL_ERROR,...t}),invalidState:(e,t)=>lt.create("connection",e,"Invalid connection state",{description:"Connection is in invalid state",code:As.INVALID_STATE,...t}),internalError:(e,t)=>lt.create("connection",e,"Internal connection error",{description:"Internal connection error",code:As.INTERNAL_ERROR,...t})}),p(lt,"config",{missing:(e,t)=>lt.create("config",e,"Missing configuration",{description:"Required configuration is missing",code:Ir.MISSING,...t}),invalid:(e,t)=>lt.create("config",e,"Invalid configuration",{description:"Invalid configuration provided",code:Ir.INVALID,...t}),internalError:(e,t)=>lt.create("config",e,"Internal configuration error",{description:"Internal configuration error",code:Ir.INTERNAL_ERROR,...t})}),p(lt,"auth",{unauthorized:(e,t)=>lt.create("auth",e,"Unauthorized",{description:"Authentication failed",code:en.UNAUTHORIZED,...t}),forbidden:(e,t)=>lt.create("auth",e,"Forbidden",{description:"Insufficient permissions",code:en.FORBIDDEN,...t}),internalError:(e,t)=>lt.create("auth",e,"Internal auth error",{description:"Internal auth error",code:en.INTERNAL_ERROR,...t})}),p(lt,"client",{registrationFailed:(e,t)=>lt.create("client",e,"Registration failed",{description:"Failed to register client",code:An.REGISTRATION_FAILED,...t}),notFound:(e,t)=>lt.create("client",e,"Client not found",{description:"Requested client could not be found",code:An.NOT_FOUND,...t}),invalidState:(e,t)=>lt.create("client",e,"Invalid client state",{description:"Client is in invalid state",code:An.INVALID_STATE,...t}),internalError:(e,t)=>lt.create("client",e,"Internal client error",{description:"Internal client error",code:An.INTERNAL_ERROR,...t})}),p(lt,"message",{invalidFormat:(e,t)=>lt.create("message",e,"Invalid message format",{description:"Failed to parse message",code:Bn.INVALID_FORMAT,...t}),deliveryFailed:(e,t)=>lt.create("message",e,"Message delivery failed",{description:"Failed to deliver message",code:Bn.DELIVERY_FAILED,...t}),timeout:(e,t)=>lt.create("message",e,"Message timeout",{description:"Message processing timed out",code:Bn.TIMEOUT,...t}),executionFailed:(e,t)=>lt.create("message",e,"Message execution failed",{description:"Failed to execute message",code:Bn.EXECUTION_FAILED,...t}),internalError:(e,t)=>lt.create("message",e,"Internal message error",{description:"Internal message error",code:Bn.INTERNAL_ERROR,...t})}),p(lt,"cluster",{joinFailed:(e,t)=>lt.create("cluster",e,"Failed to join cluster",{description:"Failed to join cluster",code:tr.JOIN_FAILED,...t}),syncFailed:(e,t)=>lt.create("cluster",e,"Failed to sync cluster",{description:"Failed to sync cluster",code:tr.SYNC_FAILED,...t}),nodeNotFound:(e,t)=>lt.create("cluster",e,"Node not found",{description:"Requested node could not be found",code:tr.NODE_NOT_FOUND,...t}),instanceNotFound:(e,t)=>lt.create("cluster",e,"Instance not found",{description:"Requested instance could not be found",code:tr.INSTANCE_NOT_FOUND,...t}),communicationFailed:(e,t)=>lt.create("cluster",e,"Communication failed",{description:"Cluster communication failed",code:tr.COMMUNICATION_FAILED,...t}),invalidState:(e,t)=>lt.create("cluster",e,"Invalid cluster state",{description:"Cluster is in invalid state",code:tr.INVALID_STATE,...t}),internalError:(e,t)=>lt.create("cluster",e,"Internal cluster error",{description:"Internal cluster error",code:tr.INTERNAL_ERROR,...t})}),p(lt,"registry",{internalError:(e,t)=>lt.create("registry",e,"Internal registry error",{description:"Internal registry error",code:Yh.INTERNAL_ERROR,...t})}),p(lt,"rpc",{methodNotFound:(e,t,n)=>lt.create("rpc",t,`Method not found: ${e}`,{description:"Requested method could not be found",code:nr.METHOD_NOT_FOUND,...n}),invalidRequest:(e,t)=>lt.create("rpc",e,"Invalid request",{description:"Invalid RPC request",code:nr.INVALID_REQUEST,...t}),requestFailed:(e,t)=>lt.create("rpc",e,"RPC request failed",{description:"Failed to send RPC request",code:nr.INTERNAL_ERROR,...t}),executionFailed:(e,t)=>lt.create("rpc",e,"RPC execution failed",{description:"Failed to execute RPC request",code:nr.INTERNAL_ERROR,...t}),connectionFailed:(e,t)=>lt.create("rpc",e,"Failed to get RPC connection",{description:"Failed to get RPC connection",code:nr.CONNECTION_FAILED,...t}),internalError:(e,t)=>lt.create("rpc",e,"Internal RPC error",{description:"Internal RPC error",code:nr.INTERNAL_ERROR,...t})});let kt=lt;class os{static getPluginToPluginSubject(e,t){return this.createRoutingPattern("plugin","plugin",e,t)}static getPluginToServiceSubject(e,t){return this.createRoutingPattern("plugin","service",e,t)}static getServiceToServiceSubject(e,t){return this.createRoutingPattern("service","service",e,t)}static getServiceToPluginSubject(e,t){return this.createRoutingPattern("service","plugin",e,t)}static getPluginToServerSubject(e,t){return this.createRoutingPattern("plugin","server",e,t)}static getServiceToServerSubject(e,t){return this.createRoutingPattern("service","server",e,t)}static getServerToPluginSubject(e,t){return this.createRoutingPattern("server","plugin",e,t)}static getServerToServiceSubject(e,t){return this.createRoutingPattern("server","service",e,t)}static createRoutingMetadata(e,t,n,r){const i={source:{type:e,id:t}};return n&&r&&(i.target={type:n,id:r}),i}static createRoutingPattern(e,t,n,r){return r?`${e}.${t}.${n}.${r}`:`${e}.${t}.${n}.*`}}class yo{static validateMetadata(e){if(!e.id)throw kt.config.invalid(void 0,{description:"Invalid ID in metadata",code:Ir.INVALID,metadata:{metadata:e}});if(!e.name)throw kt.config.invalid(void 0,{description:"Invalid name in metadata",code:Ir.INVALID,metadata:{metadata:e}})}static validateConnectionOptions(e){if(yo.validateMetadata(e.metadata),!e.endpoints||e.endpoints.length===0)throw kt.config.invalid(void 0,{description:"No NATS endpoints provided",code:Ir.INVALID,metadata:{endpoints:e.endpoints}});if(!e.auth)throw kt.config.invalid(void 0,{description:"No authentication configuration provided",code:en.INVALID_CREDENTIALS});if("server"in e.auth){const{server:t,cluster:n}=e.auth;if(!t||typeof t!="object")throw kt.config.invalid(void 0,{description:"Missing server authentication configuration",code:en.INVALID_CREDENTIALS});if(!n||typeof n!="object")throw kt.config.invalid(void 0,{description:"Missing cluster authentication configuration",code:en.INVALID_CREDENTIALS});if(typeof t.user!="string"||t.user.length===0)throw kt.config.invalid(void 0,{description:"Invalid server username provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{user:t.user}}});if(typeof t.password!="string"||t.password.length===0)throw kt.config.invalid(void 0,{description:"Invalid server password provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{password:"***"}}});if(typeof n.user!="string"||n.user.length===0)throw kt.config.invalid(void 0,{description:"Invalid cluster username provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{user:n.user}}});if(typeof n.password!="string"||n.password.length===0)throw kt.config.invalid(void 0,{description:"Invalid cluster password provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{password:"***"}}})}else{const{user:t,password:n}=e.auth;if(typeof t!="string"||t.length===0)throw kt.config.invalid(void 0,{description:"Invalid username provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{user:t}}});if(typeof n!="string"||n.length===0)throw kt.config.invalid(void 0,{description:"Invalid password provided",code:en.INVALID_CREDENTIALS,metadata:{provided:{password:"***"}}})}}}var Ti=tn(288);const rn=new Uint8Array(0),Br=new TextEncoder,sn=new TextDecoder;function Zi(...s){const e=[];for(let t=0;t<s.length;t++)e.push(Br.encode(s[t]));return e.length===0?rn:e.length===1?e[0]:function(...t){let n=0;for(let o=0;o<t.length;o++)n+=t[o].length;const r=new Uint8Array(n);let i=0;for(let o=0;o<t.length;o++)r.set(t[o],i),i+=t[o].length;return r}(...e)}function Au(s){return s&&s.length!==0?sn.decode(s):""}const Mu="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";function A1(s){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(s):function(t){for(let n=0;n<t.length;n++)t[n]=Math.floor(255*Math.random())}(s)}const gr=new class{constructor(){p(this,"buf");p(this,"seq");p(this,"inc");p(this,"inited");this.buf=new Uint8Array(22),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(0xcfd41b9100000*Math.random()),this.inc=Math.floor(300*Math.random()+33)}setPre(){const s=new Uint8Array(12);A1(s);for(let e=0;e<12;e++){const t=s[e]%36;this.buf[e]=Mu.charCodeAt(t)}}fillSeq(){let s=this.seq;for(let e=21;e>=12;e--)this.buf[e]=Mu.charCodeAt(s%36),s=Math.floor(s/36)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}};var Mn,oi,Pe;(function(s){s.Disconnect="disconnect",s.Reconnect="reconnect",s.Update="update",s.LDM="ldm",s.Error="error"})(Mn||(Mn={})),function(s){s.Reconnecting="reconnecting",s.PingTimer="pingTimer",s.StaleConnection="staleConnection",s.ClientInitiatedReconnect="client initiated reconnect"}(oi||(oi={})),function(s){s.ApiError="BAD API",s.BadAuthentication="BAD_AUTHENTICATION",s.BadCreds="BAD_CREDS",s.BadHeader="BAD_HEADER",s.BadJson="BAD_JSON",s.BadPayload="BAD_PAYLOAD",s.BadSubject="BAD_SUBJECT",s.Cancelled="CANCELLED",s.ConnectionClosed="CONNECTION_CLOSED",s.ConnectionDraining="CONNECTION_DRAINING",s.ConnectionRefused="CONNECTION_REFUSED",s.ConnectionTimeout="CONNECTION_TIMEOUT",s.Disconnect="DISCONNECT",s.InvalidOption="INVALID_OPTION",s.InvalidPayload="INVALID_PAYLOAD",s.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",s.NoResponders="503",s.NotFunction="NOT_FUNC",s.RequestError="REQUEST_ERROR",s.ServerOptionNotAvailable="SERVER_OPT_NA",s.SubClosed="SUB_CLOSED",s.SubDraining="SUB_DRAINING",s.Timeout="TIMEOUT",s.Tls="TLS",s.Unknown="UNKNOWN_ERROR",s.WssRequired="WSS_REQUIRED",s.JetStreamInvalidAck="JESTREAM_INVALID_ACK",s.JetStream404NoMessages="404",s.JetStream408RequestTimeout="408",s.JetStream409MaxAckPendingExceeded="409",s.JetStream409="409",s.JetStreamNotEnabled="503",s.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",s.AuthorizationViolation="AUTHORIZATION_VIOLATION",s.AuthenticationExpired="AUTHENTICATION_EXPIRED",s.ProtocolError="NATS_PROTOCOL_ERR",s.PermissionsViolation="PERMISSIONS_VIOLATION",s.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",s.AccountExpired="ACCOUNT_EXPIRED"}(Pe||(Pe={}));class Xh{constructor(){p(this,"messages");this.messages=new Map,this.messages.set(Pe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Pe.BadJson,"Bad JSON"),this.messages.set(Pe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return M1.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const M1=new Xh;class Ve extends Error{constructor(t,n,r){super(t);p(this,"name");p(this,"message");p(this,"code");p(this,"permissionContext");p(this,"chainedError");p(this,"api_error");this.name="NatsError",this.message=t,this.code=n,this.chainedError=r}static errorForCode(t,n){const r=Xh.getMessage(t);return new Ve(r,t,n)}isAuthError(){return this.code===Pe.AuthenticationExpired||this.code===Pe.AuthorizationViolation||this.code===Pe.AccountExpired}isAuthTimeout(){return this.code===Pe.AuthenticationTimeout}isPermissionError(){return this.code===Pe.PermissionsViolation}isProtocolError(){return this.code===Pe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Ys,bn,Gi;(function(s){s[s.Exact=0]="Exact",s[s.CanonicalMIME=1]="CanonicalMIME",s[s.IgnoreCase=2]="IgnoreCase"})(Ys||(Ys={})),function(s){s.Timer="timer",s.Count="count",s.JitterTimer="jitterTimer",s.SentinelMsg="sentinelMsg"}(bn||(bn={})),function(s){s.STATS="io.nats.micro.v1.stats_response",s.INFO="io.nats.micro.v1.info_response",s.PING="io.nats.micro.v1.ping_response"}(Gi||(Gi={}));const ia="Nats-Service-Error",oa="Nats-Service-Error-Code";class aa extends Error{constructor(t,n){super(n);p(this,"code");this.code=t}static isServiceError(t){return aa.toServiceError(t)!==null}static toServiceError(t){var r,i;const n=((r=t==null?void 0:t.headers)==null?void 0:r.get(oa))||"";if(n!==""){const o=parseInt(n)||400,a=((i=t==null?void 0:t.headers)==null?void 0:i.get(ia))||"";return new aa(o,a.length?a:n)}return null}}function Hn(s=""){if(typeof(s=s||"_INBOX")!="string")throw new Error("prefix must be a string");return s.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${s}'`)}),`${s}.${gr.next()}`}const hc="127.0.0.1";var ur;function Ta(s,...e){for(let t=0;t<e.length;t++){const n=e[t];Object.keys(n).forEach(function(r){s[r]=n[r]})}return s}function Mo(s){return sn.decode(s).replace(/\n/g,"␊").replace(/\r/g,"␍")}function fi(s,e=!0){const t=e?Ve.errorForCode(Pe.Timeout):null;let n,r;const i=new Promise((o,a)=>{n={cancel:()=>{r&&clearTimeout(r)}},r=setTimeout(()=>{a(t===null?Ve.errorForCode(Pe.Timeout):t)},s)});return Object.assign(i,n)}function Pi(s=0){let e;const t=new Promise(n=>{const r=setTimeout(()=>{n()},s);e={cancel:()=>{r&&clearTimeout(r)}}});return Object.assign(t,e)}function cs(){let s={};const e=new Promise((t,n)=>{s={resolve:t,reject:n}});return Object.assign(e,s)}function em(s){for(let e=s.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1));[s[e],s[t]]=[s[t],s[e]]}return s}(function(s){s.PING="PING",s.STATS="STATS",s.INFO="INFO"})(ur||(ur={}));function ul(s=[0,250,250,500,500,3e3,5e3]){Array.isArray(s)||(s=[0,250,250,500,500,3e3,5e3]);const e=s.length-1;return{backoff:t=>function(n){return n===0?0:Math.floor(n/2+Math.random()*n)}(t>e?s[e]:s[t])}}function as(s){return 1e6*s}function dl(s){return Math.floor(s/1e6)}function $u(s){let e=!0;const t=new Array(s.length);for(let n=0;n<s.length;n++){let r=s.charCodeAt(n);if(r===58||r<33||r>126)throw new Ve(`'${s[n]}' is not a valid character for a header key`,Pe.BadHeader);e&&97<=r&&r<=122?r-=32:!e&&65<=r&&r<=90&&(r+=32),t[n]=r,e=r==45}return String.fromCharCode(...t)}function Kn(s=0,e=""){if(s===0&&e!==""||s>0&&e==="")throw new Error("setting status requires both code and description");return new dr(s,e)}const Ba="NATS/1.0";class dr{constructor(e=0,t=""){p(this,"_code");p(this,"headers");p(this,"_description");this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[t,n]of this.headers){const r=e.values(t);if(n.length!==r.length)return!1;const i=[...n].sort(),o=[...r].sort();for(let a=0;a<i.length;a++)if(i[a]!==o[a])return!1}return!0}return!1}static decode(e){const t=new dr,n=sn.decode(e).split(`\r
3
- `),r=n[0];if(r!==Ba){let i=r.replace(Ba,"").trim();if(i.length>0){t._code=parseInt(i,10),isNaN(t._code)&&(t._code=0);const o=t._code.toString();i=i.replace(o,""),t._description=i.trim()}}return n.length>=1&&n.slice(1).map(i=>{if(i){const o=i.indexOf(":");if(o>-1){const a=i.slice(0,o),l=i.slice(o+1).trim();t.append(a,l)}}}),t}toString(){if(this.headers.size===0&&this._code===0)return"";let e=Ba;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[t,n]of this.headers)for(let r=0;r<n.length;r++)e=`${e}\r
4
- ${t}: ${n[r]}`;return`${e}\r
5
- \r
6
- `}encode(){return Br.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new Ve("invalid header value - \\r and \\n are not allowed.",Pe.BadHeader);return e.trim()}keys(){const e=[];for(const t of this.headers.keys())e.push(t);return e}findKeys(e,t=Ys.Exact){const n=this.keys();switch(t){case Ys.Exact:return n.filter(r=>r===e);case Ys.CanonicalMIME:return e=$u(e),n.filter(r=>r===e);default:{const r=e.toLowerCase();return n.filter(i=>r===i.toLowerCase())}}}get(e,t=Ys.Exact){const n=this.findKeys(e,t);if(n.length){const r=this.headers.get(n[0]);if(r)return Array.isArray(r)?r[0]:r}return""}last(e,t=Ys.Exact){const n=this.findKeys(e,t);if(n.length){const r=this.headers.get(n[0]);if(r)return Array.isArray(r)?r[r.length-1]:r}return""}has(e,t=Ys.Exact){return this.findKeys(e,t).length>0}set(e,t,n=Ys.Exact){this.delete(e,n),this.append(e,t,n)}append(e,t,n=Ys.Exact){const r=$u(e);n===Ys.CanonicalMIME&&(e=r);const i=this.findKeys(e,n);e=i.length>0?i[0]:e;const o=dr.validHeaderValue(t);let a=this.headers.get(e);a||(a=[],this.headers.set(e,a)),a.push(o)}values(e,t=Ys.Exact){const n=[];return this.findKeys(e,t).forEach(r=>{const i=this.headers.get(r);i&&n.push(...i)}),n}delete(e,t=Ys.Exact){this.findKeys(e,t).forEach(n=>{this.headers.delete(n)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(t=>{e[t]=this.values(t)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const t=new dr;for(const n in e)t.headers.set(n,e[n]);return t}}function Tu(){return{encode:s=>Br.encode(s),decode:s=>sn.decode(s)}}function wn(s){return{encode(e){try{return e===void 0&&(e=null),Br.encode(JSON.stringify(e))}catch(t){throw Ve.errorForCode(Pe.BadJson,t)}},decode(e){try{return JSON.parse(sn.decode(e),s)}catch(t){throw Ve.errorForCode(Pe.BadJson,t)}}}}function tm(s){var e;return s&&s.data.length===0&&((e=s.headers)==null?void 0:e.code)===503?Ve.errorForCode(Pe.NoResponders):null}class hl{constructor(e,t,n){p(this,"_headers");p(this,"_msg");p(this,"_rdata");p(this,"_reply");p(this,"_subject");p(this,"publisher");this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject||(this._subject=sn.decode(this._msg.subject)),this._subject}get reply(){return this._reply||(this._reply=sn.decode(this._msg.reply)),this._reply}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=dr.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=rn,t){return!!this.reply&&(this.publisher.publish(this.reply,e,t),!0)}size(){var e;return this._msg.subject.length+(((e=this._msg.reply)==null?void 0:e.length)||0)+(this._msg.size===-1?0:this._msg.size)}json(e){return wn(e).decode(this.data)}string(){return sn.decode(this.data)}requestInfo(){var t;const e=(t=this.headers)==null?void 0:t.get("Nats-Request-Info");return e?JSON.parse(e,function(n,r){return n!=="start"&&n!=="stop"||r===""?r:new Date(Date.parse(r))}):null}}p(hl,"jc");function ai(s){return Pa("durable",s)}function zs(s){return Pa("stream",s)}function Pa(s,e=""){if(e==="")throw Error(`${s} name required`);return[".","*",">","/","\\"," "," ",`
7
- `,"\r"].forEach(t=>{if(e.indexOf(t)!==-1){switch(t){case`
8
- `:t="\\n";break;case"\r":t="\\r";break;case" ":t="\\t"}throw Error(`invalid ${s} name - ${s} name cannot contain '${t}'`)}}),""}function Hi(s,e=""){if(e==="")throw Error(`${s} name required`);const t=function(n=""){if(n==="")throw Error("name required");const r=/^[-\w]+$/g;if(n.match(r)===null){for(const o of n.split(""))if(o.match(r)===null)return`cannot contain '${o}'`}return""}(e);if(t.length)throw new Error(`invalid ${s} name - ${s} name ${t}`)}function mc(s){if(s.data.length>0)return!1;const e=s.headers;return!!e&&e.code>=100&&e.code<200}function pc(s){var e;return mc(s)&&((e=s.headers)==null?void 0:e.description)==="Idle Heartbeat"}function Xr(s){if(s.data.length!==0)return null;const e=s.headers;return e?sm(e.code,e.description):null}var ln;(function(s){s.MaxBatchExceeded="exceeded maxrequestbatch of",s.MaxExpiresExceeded="exceeded maxrequestexpires of",s.MaxBytesExceeded="exceeded maxrequestmaxbytes of",s.MaxMessageSizeExceeded="message size exceeds maxbytes",s.PushConsumer="consumer is push based",s.MaxWaitingExceeded="exceeded maxwaiting",s.IdleHeartbeatMissed="idle heartbeats missed",s.ConsumerDeleted="consumer deleted"})(ln||(ln={}));function sm(s,e=""){if(s<300)return null;switch(e=e.toLowerCase(),s){case 404:return new Ve(e,Pe.JetStream404NoMessages);case 408:return new Ve(e,Pe.JetStream408RequestTimeout);case 409:{const t=e.startsWith(ln.IdleHeartbeatMissed)?Pe.JetStreamIdleHeartBeat:Pe.JetStream409;return new Ve(e,t)}case 503:return Ve.errorForCode(Pe.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=Pe.Unknown),new Ve(e,`${s}`)}}class Ms{constructor(){p(this,"inflight");p(this,"processed");p(this,"received");p(this,"noIterator");p(this,"iterClosed");p(this,"done");p(this,"signal");p(this,"yields");p(this,"filtered");p(this,"pendingFiltered");p(this,"ingestionFilterFn");p(this,"protocolFilterFn");p(this,"dispatchedFn");p(this,"ctx");p(this,"_data");p(this,"err");p(this,"time");p(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=cs(),this.yields=[],this.iterClosed=cs(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function")return this.yields.push(e),void this.signal.resolve();const{ingest:t,protocol:n}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};t&&(n&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Ve("unsupported iterator",Pe.ApiError);if(this.yielding)throw new Ve("already yielding",Pe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]=="function"){const n=e[t];try{n()}catch(r){throw r}if(this.err)throw this.err;continue}if(!this.protocolFilterFn||this.protocolFilterFn(e[t])){this.processed++;const n=Date.now();yield e[t],this.time=Date.now()-n,this.dispatchedFn&&e[t]&&this.dispatchedFn(e[t])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=cs())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class ml{constructor(e,t,n={maxOut:2}){p(this,"interval");p(this,"maxOut");p(this,"cancelAfter");p(this,"timer");p(this,"autoCancelTimer");p(this,"last");p(this,"missed");p(this,"count");p(this,"callback");this.interval=e,this.maxOut=(n==null?void 0:n.maxOut)||2,this.cancelAfter=(n==null?void 0:n.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}var fc,eo,gc,fs,Es,ci,vr,ca,Pu,Hs,_n,si,Ru;(function(s){s.Limits="limits",s.Interest="interest",s.Workqueue="workqueue"})(fc||(fc={})),function(s){s.Old="old",s.New="new"}(eo||(eo={})),function(s){s.File="file",s.Memory="memory"}(gc||(gc={})),function(s){s.All="all",s.Last="last",s.New="new",s.StartSequence="by_start_sequence",s.StartTime="by_start_time",s.LastPerSubject="last_per_subject"}(fs||(fs={})),function(s){s.None="none",s.All="all",s.Explicit="explicit",s.NotSet=""}(Es||(Es={})),function(s){s.Instant="instant",s.Original="original"}(ci||(ci={})),function(s){s.None="none",s.S2="s2"}(vr||(vr={})),function(s){s.CreateOrUpdate="",s.Update="update",s.Create="create"}(ca||(ca={})),function(s){s.API="api_audit",s.StreamAction="stream_action",s.ConsumerAction="consumer_action",s.SnapshotCreate="snapshot_create",s.SnapshotComplete="snapshot_complete",s.RestoreCreate="restore_create",s.RestoreComplete="restore_complete",s.MaxDeliver="max_deliver",s.Terminated="terminated",s.Ack="consumer_ack",s.StreamLeaderElected="stream_leader_elected",s.StreamQuorumLost="stream_quorum_lost",s.ConsumerLeaderElected="consumer_leader_elected",s.ConsumerQuorumLost="consumer_quorum_lost"}(Pu||(Pu={})),function(s){s.StreamSourceHdr="Nats-Stream-Source",s.LastConsumerSeqHdr="Nats-Last-Consumer",s.LastStreamSeqHdr="Nats-Last-Stream",s.ConsumerStalledHdr="Nats-Consumer-Stalled",s.MessageSizeHdr="Nats-Msg-Size",s.RollupHdr="Nats-Rollup",s.RollupValueSubject="sub",s.RollupValueAll="all",s.PendingMessagesHdr="Nats-Pending-Messages",s.PendingBytesHdr="Nats-Pending-Bytes"}(Hs||(Hs={})),function(s){s.LastValue="",s.AllHistory="history",s.UpdatesOnly="updates"}(_n||(_n={})),function(s){s.Stream="Nats-Stream",s.Sequence="Nats-Sequence",s.TimeStamp="Nats-Time-Stamp",s.Subject="Nats-Subject"}(si||(si={})),function(s){s.Stream="Nats-Stream",s.Subject="Nats-Subject",s.Sequence="Nats-Sequence",s.LastSequence="Nats-Last-Sequence",s.Size="Nats-Msg-Size"}(Ru||(Ru={}));const qn="KV_";class $1{constructor(e){p(this,"config");p(this,"ordered");p(this,"mack");p(this,"stream");p(this,"callbackFn");p(this,"max");p(this,"qname");p(this,"isBind");p(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=function(t,n={}){return Object.assign({name:t,deliver_policy:fs.All,ack_policy:Es.Explicit,ack_wait:as(3e4),replay_policy:ci.Instant},n)}("",e||{})}getOpts(){var t;const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&((t=e.config.filter_subjects)==null||t.forEach(n=>{this.filterSubject(n)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Es.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return ai(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=fs.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=fs.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=fs.All,this}deliverLastPerSubject(){return this.config.deliver_policy=fs.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=fs.Last,this}deliverNew(){return this.config.deliver_policy=fs.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Es.None,this}ackAll(){return this.config.ack_policy=Es.All,this}ackExplicit(){return this.config.ack_policy=Es.Explicit,this}ackWait(e){return this.config.ack_wait=as(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=ci.Instant,this}replayOriginal(){return this.config.replay_policy=ci.Original,this}sample(e){if((e=Math.trunc(e))<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=as(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,t){return this.stream=e,this.config.durable_name=t,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=as(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=as(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function hr(s){return new $1(s)}function Iu(s){return typeof s.getOpts=="function"}class T1{static encode(e){if(typeof e=="string")return btoa(e);const t=Array.from(e);return btoa(String.fromCharCode(...t))}static decode(e,t=!1){const n=atob(e);return t?Uint8Array.from(n,r=>r.charCodeAt(0)):n}}class li{static encode(e){return li.toB64URLEncoding(T1.encode(e))}static decode(e,t=!1){return li.decode(li.fromB64URLEncoding(e),t)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class gi{constructor(){p(this,"buffers");p(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let i=0;i<e.length;i++)t+=e[i].length;const n=new Uint8Array(t);let r=0;for(let i=0;i<e.length;i++)n.set(e[i],r),r+=e[i].length;return n}static fromAscii(e){return e||(e=""),Br.encode(e)}static toAscii(e){return sn.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const t=this.buffers.pop();if(t){const n=this.byteLength;(e===void 0||e>n)&&(e=n);const r=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,r}}return new Uint8Array(0)}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let n=0;n<t.length;n++)t[n]&&t[n].length&&(this.buffers.push(t[n]),this.byteLength+=t[n].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}var P1=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Li=P1.performance||{};Li.now||Li.mozNow||Li.msNow||Li.oNow||Li.webkitNow;var Ou={versions:{}},R1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},za,pl={exports:{}},Nu={},Fu=function(s){if(s.__esModule)return s;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(s).forEach(function(t){var n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:function(){return s[t]}})}),e}(function(s,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in s)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(s)}({__proto__:null,default:Nu},[Nu]));za=pl,function(){var s="input is invalid type",e=typeof window=="object",t=e?window:{};t.JS_SHA256_NO_WINDOW&&(e=!1);var n=!e&&typeof self=="object",r=!t.JS_SHA256_NO_NODE_JS&&Ou.versions&&Ou.versions.node;r?t=R1:n&&(t=self);var i=!t.JS_SHA256_NO_COMMON_JS&&za.exports,o=!t.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],u=[24,16,8,0],d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],h=["hex","array","digest","arrayBuffer"],v=[];!t.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),!o||!t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var f=function(E,O){return function(U){return new se(O,!0).update(U)[E]()}},b=function(E){var O=f("hex",E);r&&(O=k(O,E)),O.create=function(){return new se(E)},O.update=function(M){return O.create().update(M)};for(var U=0;U<h.length;++U){var S=h[U];O[S]=f(S,E)}return O},k=function(E,O){var U,S=Fu,M=Fu.Buffer,B=O?"sha224":"sha256";return U=M.from&&!t.JS_SHA256_NO_BUFFER_FROM?M.from:function(K){return new M(K)},function(K){if(typeof K=="string")return S.createHash(B).update(K,"utf8").digest("hex");if(K==null)throw new Error(s);return K.constructor===ArrayBuffer&&(K=new Uint8Array(K)),Array.isArray(K)||ArrayBuffer.isView(K)||K.constructor===M?S.createHash(B).update(U(K)).digest("hex"):E(K)}},z=function(E,O){return function(U,S){return new Z(U,O,!0).update(S)[E]()}},L=function(E){var O=z("hex",E);O.create=function(M){return new Z(M,E)},O.update=function(M,B){return O.create(M).update(B)};for(var U=0;U<h.length;++U){var S=h[U];O[S]=z(S,E)}return O};function se(E,O){O?(v[0]=v[16]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=0,this.blocks=v):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],E?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=E}function Z(E,O,U){var S,M=typeof E;if(M==="string"){var B,K=[],R=E.length,w=0;for(S=0;S<R;++S)(B=E.charCodeAt(S))<128?K[w++]=B:B<2048?(K[w++]=192|B>>>6,K[w++]=128|63&B):B<55296||B>=57344?(K[w++]=224|B>>>12,K[w++]=128|B>>>6&63,K[w++]=128|63&B):(B=65536+((1023&B)<<10|1023&E.charCodeAt(++S)),K[w++]=240|B>>>18,K[w++]=128|B>>>12&63,K[w++]=128|B>>>6&63,K[w++]=128|63&B);E=K}else{if(M!=="object")throw new Error(s);if(E===null)throw new Error(s);if(o&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!(Array.isArray(E)||o&&ArrayBuffer.isView(E)))throw new Error(s)}E.length>64&&(E=new se(O,!0).update(E).array());var H=[],J=[];for(S=0;S<64;++S){var q=E[S]||0;H[S]=92^q,J[S]=54^q}se.call(this,O,U),this.update(J),this.oKeyPad=H,this.inner=!0,this.sharedMemory=U}se.prototype.update=function(E){if(!this.finalized){var O,U=typeof E;if(U!=="string"){if(U!=="object")throw new Error(s);if(E===null)throw new Error(s);if(o&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!(Array.isArray(E)||o&&ArrayBuffer.isView(E)))throw new Error(s);O=!0}for(var S,M,B=0,K=E.length,R=this.blocks;B<K;){if(this.hashed&&(this.hashed=!1,R[0]=this.block,this.block=R[16]=R[1]=R[2]=R[3]=R[4]=R[5]=R[6]=R[7]=R[8]=R[9]=R[10]=R[11]=R[12]=R[13]=R[14]=R[15]=0),O)for(M=this.start;B<K&&M<64;++B)R[M>>>2]|=E[B]<<u[3&M++];else for(M=this.start;B<K&&M<64;++B)(S=E.charCodeAt(B))<128?R[M>>>2]|=S<<u[3&M++]:S<2048?(R[M>>>2]|=(192|S>>>6)<<u[3&M++],R[M>>>2]|=(128|63&S)<<u[3&M++]):S<55296||S>=57344?(R[M>>>2]|=(224|S>>>12)<<u[3&M++],R[M>>>2]|=(128|S>>>6&63)<<u[3&M++],R[M>>>2]|=(128|63&S)<<u[3&M++]):(S=65536+((1023&S)<<10|1023&E.charCodeAt(++B)),R[M>>>2]|=(240|S>>>18)<<u[3&M++],R[M>>>2]|=(128|S>>>12&63)<<u[3&M++],R[M>>>2]|=(128|S>>>6&63)<<u[3&M++],R[M>>>2]|=(128|63&S)<<u[3&M++]);this.lastByteIndex=M,this.bytes+=M-this.start,M>=64?(this.block=R[16],this.start=M-64,this.hash(),this.hashed=!0):this.start=M}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},se.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,O=this.lastByteIndex;E[16]=this.block,E[O>>>2]|=l[3&O],this.block=E[16],O>=56&&(this.hashed||this.hash(),E[0]=this.block,E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.hBytes<<3|this.bytes>>>29,E[15]=this.bytes<<3,this.hash()}},se.prototype.hash=function(){var E,O,U,S,M,B,K,R,w,H=this.h0,J=this.h1,q=this.h2,oe=this.h3,ue=this.h4,Ce=this.h5,F=this.h6,D=this.h7,Y=this.blocks;for(E=16;E<64;++E)O=((M=Y[E-15])>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,U=((M=Y[E-2])>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,Y[E]=Y[E-16]+O+Y[E-7]+U|0;for(w=J&q,E=0;E<64;E+=4)this.first?(this.is224?(B=300032,D=(M=Y[0]-1413257819)-150054599|0,oe=M+24177077|0):(B=704751109,D=(M=Y[0]-210244248)-1521486534|0,oe=M+143694565|0),this.first=!1):(O=(H>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),S=(B=H&J)^H&q^w,D=oe+(M=D+(U=(ue>>>6|ue<<26)^(ue>>>11|ue<<21)^(ue>>>25|ue<<7))+(ue&Ce^~ue&F)+d[E]+Y[E])|0,oe=M+(O+S)|0),O=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),S=(K=oe&H)^oe&J^B,F=q+(M=F+(U=(D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))+(D&ue^~D&Ce)+d[E+1]+Y[E+1])|0,O=((q=M+(O+S)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),S=(R=q&oe)^q&H^K,Ce=J+(M=Ce+(U=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(F&D^~F&ue)+d[E+2]+Y[E+2])|0,O=((J=M+(O+S)|0)>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),S=(w=J&q)^J&oe^R,ue=H+(M=ue+(U=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&F^~Ce&D)+d[E+3]+Y[E+3])|0,H=M+(O+S)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+H|0,this.h1=this.h1+J|0,this.h2=this.h2+q|0,this.h3=this.h3+oe|0,this.h4=this.h4+ue|0,this.h5=this.h5+Ce|0,this.h6=this.h6+F|0,this.h7=this.h7+D|0},se.prototype.hex=function(){this.finalize();var E=this.h0,O=this.h1,U=this.h2,S=this.h3,M=this.h4,B=this.h5,K=this.h6,R=this.h7,w=a[E>>>28&15]+a[E>>>24&15]+a[E>>>20&15]+a[E>>>16&15]+a[E>>>12&15]+a[E>>>8&15]+a[E>>>4&15]+a[15&E]+a[O>>>28&15]+a[O>>>24&15]+a[O>>>20&15]+a[O>>>16&15]+a[O>>>12&15]+a[O>>>8&15]+a[O>>>4&15]+a[15&O]+a[U>>>28&15]+a[U>>>24&15]+a[U>>>20&15]+a[U>>>16&15]+a[U>>>12&15]+a[U>>>8&15]+a[U>>>4&15]+a[15&U]+a[S>>>28&15]+a[S>>>24&15]+a[S>>>20&15]+a[S>>>16&15]+a[S>>>12&15]+a[S>>>8&15]+a[S>>>4&15]+a[15&S]+a[M>>>28&15]+a[M>>>24&15]+a[M>>>20&15]+a[M>>>16&15]+a[M>>>12&15]+a[M>>>8&15]+a[M>>>4&15]+a[15&M]+a[B>>>28&15]+a[B>>>24&15]+a[B>>>20&15]+a[B>>>16&15]+a[B>>>12&15]+a[B>>>8&15]+a[B>>>4&15]+a[15&B]+a[K>>>28&15]+a[K>>>24&15]+a[K>>>20&15]+a[K>>>16&15]+a[K>>>12&15]+a[K>>>8&15]+a[K>>>4&15]+a[15&K];return this.is224||(w+=a[R>>>28&15]+a[R>>>24&15]+a[R>>>20&15]+a[R>>>16&15]+a[R>>>12&15]+a[R>>>8&15]+a[R>>>4&15]+a[15&R]),w},se.prototype.toString=se.prototype.hex,se.prototype.digest=function(){this.finalize();var E=this.h0,O=this.h1,U=this.h2,S=this.h3,M=this.h4,B=this.h5,K=this.h6,R=this.h7,w=[E>>>24&255,E>>>16&255,E>>>8&255,255&E,O>>>24&255,O>>>16&255,O>>>8&255,255&O,U>>>24&255,U>>>16&255,U>>>8&255,255&U,S>>>24&255,S>>>16&255,S>>>8&255,255&S,M>>>24&255,M>>>16&255,M>>>8&255,255&M,B>>>24&255,B>>>16&255,B>>>8&255,255&B,K>>>24&255,K>>>16&255,K>>>8&255,255&K];return this.is224||w.push(R>>>24&255,R>>>16&255,R>>>8&255,255&R),w},se.prototype.array=se.prototype.digest,se.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(this.is224?28:32),O=new DataView(E);return O.setUint32(0,this.h0),O.setUint32(4,this.h1),O.setUint32(8,this.h2),O.setUint32(12,this.h3),O.setUint32(16,this.h4),O.setUint32(20,this.h5),O.setUint32(24,this.h6),this.is224||O.setUint32(28,this.h7),E},Z.prototype=new se,Z.prototype.finalize=function(){if(se.prototype.finalize.call(this),this.inner){this.inner=!1;var E=this.array();se.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(E),se.prototype.finalize.call(this)}};var N=b();N.sha256=N,N.sha224=b(!0),N.sha256.hmac=L(),N.sha224.hmac=L(!0),i?za.exports=N:(t.sha256=N.sha256,t.sha224=N.sha224)}();pl.exports.sha224;var Lu=pl.exports.sha256;function vc(s){return function(e){switch(function(t){return function(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const r=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return!r&&!i?!1:n.length%2==0}(t)?"hex":function(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}(t)?"b64":""}(e)){case"hex":return function(t){if(t.length%2!=0)throw new Error("hex string must have an even length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=parseInt(t.substring(r,r+2),16);return n}(e);case"b64":return function(t){t=t.replace(/-/g,"+"),t=t.replace(/_/g,"/");const n=atob(t);return Uint8Array.from(n,r=>r.charCodeAt(0))}(e)}return null}(s)}function I1(s,e){const t=typeof s=="string"?vc(s):s,n=typeof e=="string"?vc(e):e;if(t===null||n===null||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}class nm{constructor(e,t,n=!0){p(this,"token");p(this,"received");p(this,"ctx");p(this,"requestSubject");p(this,"mux");this.mux=e,this.requestSubject=t,this.received=0,this.token=gr.next(),n&&(this.ctx=new Error)}}class O1 extends nm{constructor(t,n,r={maxWait:1e3}){super(t,n);p(this,"callback");p(this,"done");p(this,"timer");p(this,"max");p(this,"opts");if(this.opts=r,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof r.maxMessages=="number"&&r.maxMessages>0?r.maxMessages:-1,this.done=cs(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},r.maxWait)}cancel(t){t&&this.callback(t,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(t,n){t?(this.ctx&&(t.stack+=`
9
-
10
- ${this.ctx.stack}`),this.cancel(t)):(this.callback(null,n),this.opts.strategy===bn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===bn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===bn.SentinelMsg&&n&&n.data.length===0&&this.cancel())}}class rm extends nm{constructor(t,n,r={timeout:1e3},i=!0){super(t,n,i);p(this,"deferred");p(this,"timer");this.deferred=cs(),this.timer=fi(r.timeout,i)}resolver(t,n){this.timer&&this.timer.cancel(),t?(this.ctx&&(t.stack+=`
11
-
12
- ${this.ctx.stack}`),this.deferred.reject(t)):this.deferred.resolve(n),this.cancel()}cancel(t){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(t||Ve.errorForCode(Pe.Cancelled))}}class bo{constructor(e,t){p(this,"nc");p(this,"opts");p(this,"prefix");p(this,"timeout");p(this,"jc");this.nc=e,this.opts=function(n){return(n=n||{}).domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Ta({apiPrefix:"$JS.API",timeout:5e3},n)}(t),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=wn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,t=null,n){(n=n||{}).timeout=this.timeout;let r=rn;t&&(r=this.jc.encode(t));let{retries:i}=n;i=i||1,i=i===-1?Number.MAX_SAFE_INTEGER:i;const o=ul();for(let a=0;a<i;a++)try{const l=await this.nc.request(e,r,n);return this.parseJsResponse(l)}catch(l){const u=l;if(u.code!=="503"&&u.code!==Pe.Timeout||!(a+1<i))throw l;await Pi(o.backoff(a))}}async findStream(e){const t={subject:e},n=await this._request(`${this.prefix}.STREAM.NAMES`,t);if(!n.streams||n.streams.length!==1)throw new Error("no stream matches subject");return n.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const t=this.jc.decode(e.data),n=t;if(n.error){const r=sm(n.error.code,n.error.description);if(r!==null)throw r.api_error=n.error,r}return t}}class Qi{constructor(e,t,n,r){p(this,"err");p(this,"offset");p(this,"pageInfo");p(this,"subject");p(this,"jsm");p(this,"filter");p(this,"payload");if(!e)throw new Error("subject is required");this.subject=e,this.jsm=n,this.offset=0,this.pageInfo={},this.filter=t,this.payload=r||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const t=await this.jsm._request(this.subject,e,{timeout:this.jsm.timeout});this.pageInfo=t;const n=this.countResponse(t);return n===0?[]:(this.offset+=n,this.filter(t))}catch(t){throw this.err=t,t}}countResponse(e){var t,n,r;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((t=e.streams)==null?void 0:t.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((n=e.consumers)==null?void 0:n.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((r=e.streams)==null?void 0:r.length)||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const t of e)yield t;e=await this.next()}}}function Or(s=""){const e=s.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${s}' is not a semver value`)}function _c(s,e){return s.major<e.major?-1:s.major>e.major?1:s.minor<e.minor?-1:s.minor>e.minor?1:s.micro<e.micro?-1:s.micro>e.micro?1:0}var Lt;(function(s){s.JS_KV="js_kv",s.JS_OBJECTSTORE="js_objectstore",s.JS_PULL_MAX_BYTES="js_pull_max_bytes",s.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",s.JS_ALLOW_DIRECT="js_allow_direct",s.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",s.JS_SIMPLIFICATION="js_simplification",s.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",s.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",s.JS_STREAM_FIRST_SEQ="js_stream_first_seq",s.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",s.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",s.JS_STREAM_COMPRESSION="js_stream_compression",s.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",s.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Lt||(Lt={}));class N1{constructor(e){p(this,"server");p(this,"features");p(this,"disabled");this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=Or(e)),this.server=e,this.set(Lt.JS_KV,"2.6.2"),this.set(Lt.JS_OBJECTSTORE,"2.6.3"),this.set(Lt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Lt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Lt.JS_ALLOW_DIRECT,"2.9.0"),this.set(Lt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Lt.JS_SIMPLIFICATION,"2.9.4"),this.set(Lt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Lt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Lt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Lt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Lt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Lt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Lt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Lt.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(t=>{this.features.delete(t)})}set(e,t){this.features.set(e,{min:t,ok:_c(this.server,Or(t))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var t;return((t=this.get(e))==null?void 0:t.ok)||!1}require(e){return typeof e=="string"&&(e=Or(e)),_c(this.server,e)>=0}}class la extends bo{constructor(e,t){super(e,t)}async add(e,t,n=ca.Create){if(zs(e),t.deliver_group&&t.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(t.deliver_group&&t.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const r={};r.config=t,r.stream_name=e,r.action=n,r.config.durable_name&&ai(r.config.durable_name);const i=this.nc;let{min:o,ok:a}=i.features.get(Lt.JS_NEW_CONSUMER_CREATE_API);const l=t.name===""?void 0:t.name;if(l&&!a)throw new Error(`consumer 'name' requires server ${o}`);if(l)try{Pa("name",l)}catch(h){const v=h.message,f=v.indexOf("cannot contain");throw f!==-1?new Error(`consumer 'name' ${v.substring(f)}`):h}let u,d="";if(Array.isArray(t.filter_subjects)){const{min:h,ok:v}=i.features.get(Lt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${h}`);a=!1}if(t.metadata){const{min:h,ok:v}=i.features.get(Lt.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${h}`)}if(a&&(d=t.name??t.durable_name??""),d!==""){let h=t.filter_subject??void 0;h===">"&&(h=void 0),u=h!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${d}.${h}`:`${this.prefix}.CONSUMER.CREATE.${e}.${d}`}else u=t.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(u,r)}async update(e,t,n){const r=await this.info(e,t),i=n;return this.add(e,Object.assign(r.config,i),ca.Update)}async info(e,t){return zs(e),ai(t),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`)}async delete(e,t){return zs(e),ai(t),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success}list(e){zs(e);const t=`${this.prefix}.CONSUMER.LIST.${e}`;return new Qi(t,n=>n.consumers,this)}pause(e,t,n){const r=`${this.prefix}.CONSUMER.PAUSE.${e}.${t}`,i={pause_until:n.toISOString()};return this._request(r,i)}resume(e,t){return this.pause(e,t,new Date(0))}}function Jr(s,e,t=!1){if(t===!0&&!s)throw Ve.errorForCode(Pe.ApiError,new Error(`${e} is not a function`));if(s&&typeof s!="function")throw Ve.errorForCode(Pe.ApiError,new Error(`${e} is not a function`))}class F1 extends Ms{constructor(t,n,r){super();p(this,"sub");p(this,"adapter");p(this,"subIterDone");Jr(r.adapter,"adapter",!0),this.adapter=r.adapter,r.callback&&Jr(r.callback,"callback"),this.noIterator=typeof r.callback=="function",r.ingestionFilterFn&&(Jr(r.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=r.ingestionFilterFn),r.protocolFilterFn&&(Jr(r.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=r.protocolFilterFn),r.dispatchedFn&&(Jr(r.dispatchedFn,"dispatchedFn"),this.dispatchedFn=r.dispatchedFn),r.cleanupFn&&Jr(r.cleanupFn,"cleanupFn");let i=(d,h)=>{this.callback(d,h)};if(r.callback){const d=r.callback;i=(h,v)=>{const[f,b]=this.adapter(h,v);if(f)return void d(f,null);const{ingest:k}=this.ingestionFilterFn?this.ingestionFilterFn(b,this):{ingest:!0};k&&(!this.protocolFilterFn||this.protocolFilterFn(b))&&(d(f,b),this.dispatchedFn&&b&&this.dispatchedFn(b))}}const{max:o,queue:a,timeout:l}=r,u={queue:a,timeout:l,callback:i};o&&o>0&&(u.max=o),this.sub=t.subscribe(n,u),r.cleanupFn&&(this.sub.cleanupFn=r.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=cs(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async d=>{await d.closed,this.stop()})(this.sub).then().catch()}unsubscribe(t){this.sub.unsubscribe(t)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(t,n){this.sub.cancelTimeout();const[r,i]=this.adapter(t,n);r&&this.stop(r),i&&this.push(i)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let nn;function im(){return nn!==void 0&&nn.defaultPort!==void 0?nn.defaultPort:4222}function Ua(){return nn!==void 0&&nn.urlParseFn?nn.urlParseFn:void 0}function yc(){return nn!==void 0&&nn.dnsResolveFn?nn.dnsResolveFn:void 0}const zo=`\r
13
- `,ua=gi.fromAscii(zo),L1=new Uint8Array(ua)[0],j1=new Uint8Array(ua)[1];function q1(s){const e=function(t){for(let n=0;n<t.length;n++){const r=n+1;if(t.byteLength>r&&t[n]===L1&&t[r]===j1)return r+1}return 0}(s);if(e>0){const t=new Uint8Array(s).slice(0,e);return sn.decode(t)}return""}function bc(s){return function(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return om(e);case":":return D1(e)}}(s)!==void 0}function om(s){const e=new Uint8Array(4);for(let t=0;t<4;t++){if(s.length===0)return;if(t>0){if(s[0]!==".")return;s=s.substring(1)}const{n,c:r,ok:i}=B1(s);if(!i||n>255)return;s=s.substring(r),e[t]=n}return function(t,n,r,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((a,l)=>{o[l]=a}),o[12]=t,o[13]=n,o[14]=r,o[15]=i,o}(e[0],e[1],e[2],e[3])}function D1(s){const e=new Uint8Array(16);let t=-1;if(s.length>=2&&s[0]===":"&&s[1]===":"&&(t=0,(s=s.substring(2)).length===0))return e;let n=0;for(;n<16;){const{n:r,c:i,ok:o}=z1(s);if(!o||r>65535)return;if(i<s.length&&s[i]==="."){if(t<0&&n!=12||n+4>16)return;const a=om(s);if(a===void 0)return;e[n]=a[12],e[n+1]=a[13],e[n+2]=a[14],e[n+3]=a[15],s="",n+=4;break}if(e[n]=r>>8,e[n+1]=r,n+=2,(s=s.substring(i)).length===0)break;if(s[0]!==":"||s.length==1)return;if((s=s.substring(1))[0]===":"){if(t>=0)return;if(t=n,(s=s.substring(1)).length===0)break}}if(s.length===0){if(n<16){if(t<0)return;const r=16-n;for(let i=n-1;i>=t;i--)e[i+r]=e[i];for(let i=t+r-1;i>=t;i--)e[i]=0}else if(t>=0)return;return e}}function B1(s){let e=0,t=0;for(e=0;e<s.length&&48<=s.charCodeAt(e)&&s.charCodeAt(e)<=57;e++)if(t=10*t+(s.charCodeAt(e)-48),t>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:t,c:e,ok:!0}}function z1(s){let e=0,t=0;for(t=0;t<s.length;t++){if(48<=s.charCodeAt(t)&&s.charCodeAt(t)<=57)e*=16,e+=s.charCodeAt(t)-48;else if(97<=s.charCodeAt(t)&&s.charCodeAt(t)<=102)e*=16,e+=s.charCodeAt(t)-97+10;else{if(!(65<=s.charCodeAt(t)&&s.charCodeAt(t)<=70))break;e*=16,e+=s.charCodeAt(t)-65+10}if(e>=16777215)return{n:0,c:t,ok:!1}}return t===0?{n:0,c:t,ok:!1}:{n:e,c:t,ok:!0}}function Va(s){return!function(e){return e.indexOf("[")===-1&&e.indexOf("::")===-1&&(e.indexOf(".")!==-1||e.split(":").length<=2)}(s)}class Wi{constructor(e,t=!1){p(this,"src");p(this,"listen");p(this,"hostname");p(this,"port");p(this,"didConnect");p(this,"reconnects");p(this,"lastConnect");p(this,"gossiped");p(this,"tlsName");p(this,"resolves");this.src=e,this.tlsName="";const n=function(r){(r=r.trim()).match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),Va(r=function(u){const d="::FFFF:",h=u.toUpperCase().indexOf(d);if(h!==-1&&u.indexOf(".")!==-1){let v=u.substring(h+7);return v=v.replace("[",""),v.replace("]","")}return u}(r))&&r.indexOf("[")===-1&&(r=`[${r}]`);const i=Va(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),o=i&&i.length===3&&i[1]&&i[2]?parseInt(i[2]):4222,a=new URL(`${o===80?"https":"http"}://${r}`);a.port=`${o}`;let l=a.hostname;return l.charAt(0)==="["&&(l=l.substring(1,l.length-1)),{listen:a.host,hostname:l,port:o}}(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(e){if(!e.fn||e.resolve===!1)return[this];const t=[];if(bc(this.hostname))return[this];{const n=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${n.join(",")}`);for(const r of n){const i=this.port===80?"https":"http",o=new URL(`${i}://${Va(r)?"["+r+"]":r}`);o.port=`${this.port}`;const a=new Wi(o.host,!1);a.tlsName=this.hostname,t.push(a)}}return e.randomize&&em(t),this.resolves=t,t}}class U1{constructor(e=[],t={}){p(this,"firstSelect");p(this,"servers");p(this,"currentServer");p(this,"tlsName");p(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=t.randomize||!1;const n=Ua();e&&(e.forEach(r=>{r=n?n(r):r,this.servers.push(new Wi(r))}),this.randomize&&(this.servers=em(this.servers))),this.servers.length===0&&this.addServer(`${hc}:${im()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();bc(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(t=>{t.gossiped&&(t.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){const n=Ua();e=n?n(e):e;const r=new Wi(e,t);bc(r.hostname)&&(r.tlsName=this.tlsName),this.servers.push(r)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const t=this.servers.indexOf(e);this.servers.splice(t,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){const n=[];let r=[];const i=Ua(),o=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(l=>{l=i?i(l,t):l;const u=new Wi(l,!0);o.set(l,u)});const a=[];return this.servers.forEach((l,u)=>{const d=l.listen;l.gossiped&&this.currentServer.listen!==d&&o.get(d)===void 0&&a.push(u),o.delete(d)}),a.reverse(),a.forEach(l=>{const u=this.servers.splice(l,1);r=r.concat(u[0].listen)}),o.forEach((l,u)=>{this.servers.push(l),n.push(u)}),{added:n,deleted:r}}}class V1{constructor(){p(this,"baseInbox");p(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Hn(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const t=e.subject||"";return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(t&&t.permissionContext){if(e)return this.all().forEach(r=>{r.resolver(t,{})}),!0;const n=t.permissionContext;if(n.operation==="publish"){const r=this.all().find(i=>i.requestSubject===n.subject);if(r)return r.resolver(t,{}),!0}}return!1}dispatcher(){return(e,t)=>{const n=this.getToken(t);if(n){const r=this.get(n);r&&(e===null&&t.headers&&(e=tm(t)),r.resolver(e,t))}}}close(){const e=Ve.errorForCode(Pe.Timeout);this.reqs.forEach(t=>{t.resolver(e,{})})}}class H1{constructor(e,t,n){p(this,"ph");p(this,"interval");p(this,"maxOut");p(this,"timer");p(this,"pendings");this.ph=e,this.interval=t,this.maxOut=n,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:oi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut)return void this.cancel(!0);const e=cs();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class Q1 extends Error{constructor(e){super(e),this.name="AssertionError"}}const Ha=2**32-2;function $o(s,e,t=0){const n=e.byteLength-t;return s.byteLength>n&&(s=s.subarray(0,n)),e.set(s,t),s.byteLength}class Qa{constructor(e){p(this,"_buf");p(this,"_off");this._off=0,this._buf=e!=null?new Uint8Array(e):new Uint8Array(0)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e!==0){if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}else this.reset()}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){(function(t,n="Assertion failed."){if(!t)throw new Q1(n)})(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const t=$o(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(Br.encode(e))}write(e){const t=this._grow(e.byteLength);return $o(e,this._buf,t)}_grow(e){const t=this.length;t===0&&this._off!==0&&this.reset();const n=this._tryGrowByReslice(e);if(n>=0)return n;const r=this.capacity;if(e<=Math.floor(r/2)-t)$o(this._buf.subarray(this._off),this._buf);else{if(r+e>Ha)throw new Error("The buffer cannot be grown beyond the maximum size.");{const i=new Uint8Array(Math.min(2*r+e,Ha));$o(this._buf.subarray(this._off),i),this._buf=i}}return this._off=0,this._reslice(Math.min(t+e,Ha)),t}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const t=this._grow(e);this._reslice(t)}readFrom(e){let t=0;const n=new Uint8Array(32768);for(;;){const r=this.capacity-this.length<32768,i=r?n:new Uint8Array(this._buf.buffer,this.length),o=e.read(i);if(o===null)return t;r?this.write(i.subarray(0,o)):this._reslice(this.length+o),t+=o}}}var Us;function ju(){return{sid:-1,hdr:-1,size:-1}}(function(s){s[s.OK=0]="OK",s[s.ERR=1]="ERR",s[s.MSG=2]="MSG",s[s.INFO=3]="INFO",s[s.PING=4]="PING",s[s.PONG=5]="PONG"})(Us||(Us={}));class qu{constructor(e){p(this,"dispatcher");p(this,"state");p(this,"as");p(this,"drop");p(this,"hdr");p(this,"ma");p(this,"argBuf");p(this,"msgBuf");this.dispatcher=e,this.state=je.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){const n=e[t];switch(this.state){case je.OP_START:switch(n){case qe.M:case qe.m:this.state=je.OP_M,this.hdr=-1,this.ma=ju();break;case qe.H:case qe.h:this.state=je.OP_H,this.hdr=0,this.ma=ju();break;case qe.P:case qe.p:this.state=je.OP_P;break;case qe.PLUS:this.state=je.OP_PLUS;break;case qe.MINUS:this.state=je.OP_MINUS;break;case qe.I:case qe.i:this.state=je.OP_I;break;default:throw this.fail(e.subarray(t))}break;case je.OP_H:switch(n){case qe.M:case qe.m:this.state=je.OP_M;break;default:throw this.fail(e.subarray(t))}break;case je.OP_M:switch(n){case qe.S:case qe.s:this.state=je.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MS:switch(n){case qe.G:case qe.g:this.state=je.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MSG:switch(n){case qe.SPACE:case qe.TAB:this.state=je.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MSG_SPC:switch(n){case qe.SPACE:case qe.TAB:continue;default:this.state=je.MSG_ARG,this.as=t}break;case je.MSG_ARG:switch(n){case qe.CR:this.drop=1;break;case qe.NL:{const r=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(r),this.drop=0,this.as=t+1,this.state=je.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case je.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const r=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Us.MSG,msg:this.ma,data:r}),this.argBuf=void 0,this.msgBuf=void 0,this.state=je.MSG_END}else{let r=this.ma.size-this.msgBuf.length;const i=e.length-t;i<r&&(r=i),r>0?(this.msgBuf.write(e.subarray(t,t+r)),t=t+r-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:Us.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=je.MSG_END);break;case je.MSG_END:if(n!==qe.NL)continue;this.drop=0,this.as=t+1,this.state=je.OP_START;break;case je.OP_PLUS:switch(n){case qe.O:case qe.o:this.state=je.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PLUS_O:switch(n){case qe.K:case qe.k:this.state=je.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PLUS_OK:n===qe.NL&&(this.dispatcher.push({kind:Us.OK}),this.drop=0,this.state=je.OP_START);break;case je.OP_MINUS:switch(n){case qe.E:case qe.e:this.state=je.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MINUS_E:switch(n){case qe.R:case qe.r:this.state=je.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MINUS_ER:switch(n){case qe.R:case qe.r:this.state=je.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MINUS_ERR:switch(n){case qe.SPACE:case qe.TAB:this.state=je.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case je.OP_MINUS_ERR_SPC:switch(n){case qe.SPACE:case qe.TAB:continue;default:this.state=je.MINUS_ERR_ARG,this.as=t}break;case je.MINUS_ERR_ARG:switch(n){case qe.CR:this.drop=1;break;case qe.NL:{let r;this.argBuf?(r=this.argBuf.bytes(),this.argBuf=void 0):r=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:Us.ERR,data:r}),this.drop=0,this.as=t+1,this.state=je.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case je.OP_P:switch(n){case qe.I:case qe.i:this.state=je.OP_PI;break;case qe.O:case qe.o:this.state=je.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PO:switch(n){case qe.N:case qe.n:this.state=je.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PON:switch(n){case qe.G:case qe.g:this.state=je.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PONG:n===qe.NL&&(this.dispatcher.push({kind:Us.PONG}),this.drop=0,this.state=je.OP_START);break;case je.OP_PI:switch(n){case qe.N:case qe.n:this.state=je.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PIN:switch(n){case qe.G:case qe.g:this.state=je.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case je.OP_PING:n===qe.NL&&(this.dispatcher.push({kind:Us.PING}),this.drop=0,this.state=je.OP_START);break;case je.OP_I:switch(n){case qe.N:case qe.n:this.state=je.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case je.OP_IN:switch(n){case qe.F:case qe.f:this.state=je.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case je.OP_INF:switch(n){case qe.O:case qe.o:this.state=je.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case je.OP_INFO:switch(n){case qe.SPACE:case qe.TAB:this.state=je.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case je.OP_INFO_SPC:switch(n){case qe.SPACE:case qe.TAB:continue;default:this.state=je.INFO_ARG,this.as=t}break;case je.INFO_ARG:switch(n){case qe.CR:this.drop=1;break;case qe.NL:{let r;this.argBuf?(r=this.argBuf.bytes(),this.argBuf=void 0):r=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:Us.INFO,data:r}),this.drop=0,this.as=t+1,this.state=je.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}this.state!==je.MSG_ARG&&this.state!==je.MINUS_ERR_ARG&&this.state!==je.INFO_ARG||this.argBuf||(this.argBuf=new Qa(e.subarray(this.as,t-this.drop))),this.state!==je.MSG_PAYLOAD||this.msgBuf||(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Qa(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new Qa(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const t=[];let n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case qe.SPACE:case qe.TAB:case qe.CR:case qe.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2]);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3]);break;default:throw this.fail(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,t=""){return t=t?`${t} [${this.state}]`:`parse error [${this.state}]`,new Error(`${t}: ${sn.decode(e)}`)}processHeaderMsgArgs(e){const t=[];let n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case qe.SPACE:case qe.TAB:case qe.CR:case qe.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2]),this.ma.size=this.protoParseInt(t[3]);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3]),this.ma.size=this.protoParseInt(t[4]);break;default:throw this.fail(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let t=0;for(let n=0;n<e.length;n++){if(e[n]<48||e[n]>57)return-1;t=10*t+(e[n]-48)}return t}}var je,qe;(function(s){s[s.OP_START=0]="OP_START",s[s.OP_PLUS=1]="OP_PLUS",s[s.OP_PLUS_O=2]="OP_PLUS_O",s[s.OP_PLUS_OK=3]="OP_PLUS_OK",s[s.OP_MINUS=4]="OP_MINUS",s[s.OP_MINUS_E=5]="OP_MINUS_E",s[s.OP_MINUS_ER=6]="OP_MINUS_ER",s[s.OP_MINUS_ERR=7]="OP_MINUS_ERR",s[s.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",s[s.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",s[s.OP_M=10]="OP_M",s[s.OP_MS=11]="OP_MS",s[s.OP_MSG=12]="OP_MSG",s[s.OP_MSG_SPC=13]="OP_MSG_SPC",s[s.MSG_ARG=14]="MSG_ARG",s[s.MSG_PAYLOAD=15]="MSG_PAYLOAD",s[s.MSG_END=16]="MSG_END",s[s.OP_H=17]="OP_H",s[s.OP_P=18]="OP_P",s[s.OP_PI=19]="OP_PI",s[s.OP_PIN=20]="OP_PIN",s[s.OP_PING=21]="OP_PING",s[s.OP_PO=22]="OP_PO",s[s.OP_PON=23]="OP_PON",s[s.OP_PONG=24]="OP_PONG",s[s.OP_I=25]="OP_I",s[s.OP_IN=26]="OP_IN",s[s.OP_INF=27]="OP_INF",s[s.OP_INFO=28]="OP_INFO",s[s.OP_INFO_SPC=29]="OP_INFO_SPC",s[s.INFO_ARG=30]="INFO_ARG"})(je||(je={})),function(s){s[s.CR=13]="CR",s[s.E=69]="E",s[s.e=101]="e",s[s.F=70]="F",s[s.f=102]="f",s[s.G=71]="G",s[s.g=103]="g",s[s.H=72]="H",s[s.h=104]="h",s[s.I=73]="I",s[s.i=105]="i",s[s.K=75]="K",s[s.k=107]="k",s[s.M=77]="M",s[s.m=109]="m",s[s.MINUS=45]="MINUS",s[s.N=78]="N",s[s.n=110]="n",s[s.NL=10]="NL",s[s.O=79]="O",s[s.o=111]="o",s[s.P=80]="P",s[s.p=112]="p",s[s.PLUS=43]="PLUS",s[s.R=82]="R",s[s.r=114]="r",s[s.S=83]="S",s[s.s=115]="s",s[s.SPACE=32]="SPACE",s[s.TAB=9]="TAB"}(qe||(qe={})),function(s){var e=function(_,x){this.hi=0|_,this.lo=0|x},t=function(_){var x,C=new Float64Array(16);if(_)for(x=0;x<_.length;x++)C[x]=_[x];return C},n=function(){throw new Error("no PRNG")},r=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=t(),a=t([1]),l=t([56129,1]),u=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(_,x){return _<<x|_>>>32-x}function k(_,x){var C=255&_[x+3];return(C=(C=C<<8|255&_[x+2])<<8|255&_[x+1])<<8|255&_[x+0]}function z(_,x){var C=_[x]<<24|_[x+1]<<16|_[x+2]<<8|_[x+3],T=_[x+4]<<24|_[x+5]<<16|_[x+6]<<8|_[x+7];return new e(C,T)}function L(_,x,C){var T;for(T=0;T<4;T++)_[x+T]=255&C,C>>>=8}function se(_,x,C){_[x]=C.hi>>24&255,_[x+1]=C.hi>>16&255,_[x+2]=C.hi>>8&255,_[x+3]=255&C.hi,_[x+4]=C.lo>>24&255,_[x+5]=C.lo>>16&255,_[x+6]=C.lo>>8&255,_[x+7]=255&C.lo}function Z(_,x,C,T,P){var G,Ie=0;for(G=0;G<P;G++)Ie|=_[x+G]^C[T+G];return(1&Ie-1>>>8)-1}function N(_,x,C,T){return Z(_,x,C,T,16)}function E(_,x,C,T){return Z(_,x,C,T,32)}function O(_,x,C,T,P){var G,Ie,Se,le=new Uint32Array(16),Me=new Uint32Array(16),_t=new Uint32Array(16),rt=new Uint32Array(4);for(G=0;G<4;G++)Me[5*G]=k(T,4*G),Me[1+G]=k(C,4*G),Me[6+G]=k(x,4*G),Me[11+G]=k(C,16+4*G);for(G=0;G<16;G++)_t[G]=Me[G];for(G=0;G<20;G++){for(Ie=0;Ie<4;Ie++){for(Se=0;Se<4;Se++)rt[Se]=Me[(5*Ie+4*Se)%16];for(rt[1]^=b(rt[0]+rt[3]|0,7),rt[2]^=b(rt[1]+rt[0]|0,9),rt[3]^=b(rt[2]+rt[1]|0,13),rt[0]^=b(rt[3]+rt[2]|0,18),Se=0;Se<4;Se++)le[4*Ie+(Ie+Se)%4]=rt[Se]}for(Se=0;Se<16;Se++)Me[Se]=le[Se]}if(P){for(G=0;G<16;G++)Me[G]=Me[G]+_t[G]|0;for(G=0;G<4;G++)Me[5*G]=Me[5*G]-k(T,4*G)|0,Me[6+G]=Me[6+G]-k(x,4*G)|0;for(G=0;G<4;G++)L(_,4*G,Me[5*G]),L(_,16+4*G,Me[6+G])}else for(G=0;G<16;G++)L(_,4*G,Me[G]+_t[G]|0)}function U(_,x,C,T){return O(_,x,C,T,!1),0}function S(_,x,C,T){return O(_,x,C,T,!0),0}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function B(_,x,C,T,P,G,Ie){var Se,le,Me=new Uint8Array(16),_t=new Uint8Array(64);if(!P)return 0;for(le=0;le<16;le++)Me[le]=0;for(le=0;le<8;le++)Me[le]=G[le];for(;P>=64;){for(U(_t,Me,Ie,M),le=0;le<64;le++)_[x+le]=(C?C[T+le]:0)^_t[le];for(Se=1,le=8;le<16;le++)Se=Se+(255&Me[le])|0,Me[le]=255&Se,Se>>>=8;P-=64,x+=64,C&&(T+=64)}if(P>0)for(U(_t,Me,Ie,M),le=0;le<P;le++)_[x+le]=(C?C[T+le]:0)^_t[le];return 0}function K(_,x,C,T,P){return B(_,x,null,0,C,T,P)}function R(_,x,C,T,P){var G=new Uint8Array(32);return S(G,T,P,M),K(_,x,C,T.subarray(16),G)}function w(_,x,C,T,P,G,Ie){var Se=new Uint8Array(32);return S(Se,G,Ie,M),B(_,x,C,T,P,G.subarray(16),Se)}function H(_,x){var C,T=0;for(C=0;C<17;C++)T=T+(_[C]+x[C]|0)|0,_[C]=255&T,T>>>=8}var J=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function q(_,x,C,T,P,G){var Ie,Se,le,Me,_t=new Uint32Array(17),rt=new Uint32Array(17),Pt=new Uint32Array(17),rs=new Uint32Array(17),Ht=new Uint32Array(17);for(le=0;le<17;le++)rt[le]=Pt[le]=0;for(le=0;le<16;le++)rt[le]=G[le];for(rt[3]&=15,rt[4]&=252,rt[7]&=15,rt[8]&=252,rt[11]&=15,rt[12]&=252,rt[15]&=15;P>0;){for(le=0;le<17;le++)rs[le]=0;for(le=0;le<16&&le<P;++le)rs[le]=C[T+le];for(rs[le]=1,T+=le,P-=le,H(Pt,rs),Se=0;Se<17;Se++)for(_t[Se]=0,le=0;le<17;le++)_t[Se]=_t[Se]+Pt[le]*(le<=Se?rt[Se-le]:320*rt[Se+17-le]|0)|0;for(Se=0;Se<17;Se++)Pt[Se]=_t[Se];for(Me=0,le=0;le<16;le++)Me=Me+Pt[le]|0,Pt[le]=255&Me,Me>>>=8;for(Me=Me+Pt[16]|0,Pt[16]=3&Me,Me=5*(Me>>>2)|0,le=0;le<16;le++)Me=Me+Pt[le]|0,Pt[le]=255&Me,Me>>>=8;Me=Me+Pt[16]|0,Pt[16]=Me}for(le=0;le<17;le++)Ht[le]=Pt[le];for(H(Pt,J),Ie=0|-(Pt[16]>>>7),le=0;le<17;le++)Pt[le]^=Ie&(Ht[le]^Pt[le]);for(le=0;le<16;le++)rs[le]=G[le+16];for(rs[16]=0,H(Pt,rs),le=0;le<16;le++)_[x+le]=Pt[le];return 0}function oe(_,x,C,T,P,G){var Ie=new Uint8Array(16);return q(Ie,0,C,T,P,G),N(_,x,Ie,0)}function ue(_,x,C,T,P){var G;if(C<32)return-1;for(w(_,0,x,0,C,T,P),q(_,16,_,32,C-32,_),G=0;G<16;G++)_[G]=0;return 0}function Ce(_,x,C,T,P){var G,Ie=new Uint8Array(32);if(C<32||(R(Ie,0,32,T,P),oe(x,16,x,32,C-32,Ie)!==0))return-1;for(w(_,0,x,0,C,T,P),G=0;G<32;G++)_[G]=0;return 0}function F(_,x){var C;for(C=0;C<16;C++)_[C]=0|x[C]}function D(_){var x,C;for(C=0;C<16;C++)_[C]+=65536,x=Math.floor(_[C]/65536),_[(C+1)*(C<15?1:0)]+=x-1+37*(x-1)*(C===15?1:0),_[C]-=65536*x}function Y(_,x,C){for(var T,P=~(C-1),G=0;G<16;G++)T=P&(_[G]^x[G]),_[G]^=T,x[G]^=T}function Te(_,x){var C,T,P,G=t(),Ie=t();for(C=0;C<16;C++)Ie[C]=x[C];for(D(Ie),D(Ie),D(Ie),T=0;T<2;T++){for(G[0]=Ie[0]-65517,C=1;C<15;C++)G[C]=Ie[C]-65535-(G[C-1]>>16&1),G[C-1]&=65535;G[15]=Ie[15]-32767-(G[14]>>16&1),P=G[15]>>16&1,G[14]&=65535,Y(Ie,G,1-P)}for(C=0;C<16;C++)_[2*C]=255&Ie[C],_[2*C+1]=Ie[C]>>8}function He(_,x){var C=new Uint8Array(32),T=new Uint8Array(32);return Te(C,_),Te(T,x),E(C,0,T,0)}function ht(_){var x=new Uint8Array(32);return Te(x,_),1&x[0]}function At(_,x){var C;for(C=0;C<16;C++)_[C]=x[2*C]+(x[2*C+1]<<8);_[15]&=32767}function Qe(_,x,C){var T;for(T=0;T<16;T++)_[T]=x[T]+C[T]|0}function ze(_,x,C){var T;for(T=0;T<16;T++)_[T]=x[T]-C[T]|0}function ve(_,x,C){var T,P,G=new Float64Array(31);for(T=0;T<31;T++)G[T]=0;for(T=0;T<16;T++)for(P=0;P<16;P++)G[T+P]+=x[T]*C[P];for(T=0;T<15;T++)G[T]+=38*G[T+16];for(T=0;T<16;T++)_[T]=G[T];D(_),D(_)}function ft(_,x){ve(_,x,x)}function Xt(_,x){var C,T=t();for(C=0;C<16;C++)T[C]=x[C];for(C=253;C>=0;C--)ft(T,T),C!==2&&C!==4&&ve(T,T,x);for(C=0;C<16;C++)_[C]=T[C]}function wt(_,x){var C,T=t();for(C=0;C<16;C++)T[C]=x[C];for(C=250;C>=0;C--)ft(T,T),C!==1&&ve(T,T,x);for(C=0;C<16;C++)_[C]=T[C]}function zt(_,x,C){var T,P,G=new Uint8Array(32),Ie=new Float64Array(80),Se=t(),le=t(),Me=t(),_t=t(),rt=t(),Pt=t();for(P=0;P<31;P++)G[P]=x[P];for(G[31]=127&x[31]|64,G[0]&=248,At(Ie,C),P=0;P<16;P++)le[P]=Ie[P],_t[P]=Se[P]=Me[P]=0;for(Se[0]=_t[0]=1,P=254;P>=0;--P)Y(Se,le,T=G[P>>>3]>>>(7&P)&1),Y(Me,_t,T),Qe(rt,Se,Me),ze(Se,Se,Me),Qe(Me,le,_t),ze(le,le,_t),ft(_t,rt),ft(Pt,Se),ve(Se,Me,Se),ve(Me,le,rt),Qe(rt,Se,Me),ze(Se,Se,Me),ft(le,Se),ze(Me,_t,Pt),ve(Se,Me,l),Qe(Se,Se,_t),ve(Me,Me,Se),ve(Se,_t,Pt),ve(_t,le,Ie),ft(le,rt),Y(Se,le,T),Y(Me,_t,T);for(P=0;P<16;P++)Ie[P+16]=Se[P],Ie[P+32]=Me[P],Ie[P+48]=le[P],Ie[P+64]=_t[P];var rs=Ie.subarray(32),Ht=Ie.subarray(16);return Xt(rs,rs),ve(Ht,Ht,rs),Te(_,Ht),0}function it(_,x){return zt(_,x,i)}function es(_,x){return n(x,32),it(_,x)}function Be(_,x,C){var T=new Uint8Array(32);return zt(T,C,x),S(_,r,T,M)}var Ue=ue,V=Ce;function X(){var _,x,C,T=0,P=0,G=0,Ie=0,Se=65535;for(C=0;C<arguments.length;C++)T+=(_=arguments[C].lo)&Se,P+=_>>>16,G+=(x=arguments[C].hi)&Se,Ie+=x>>>16;return new e((G+=(P+=T>>>16)>>>16)&Se|(Ie+=G>>>16)<<16,T&Se|P<<16)}function _e(_,x){return new e(_.hi>>>x,_.lo>>>x|_.hi<<32-x)}function ye(){var _,x=0,C=0;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,C^=arguments[_].hi;return new e(C,x)}function fe(_,x){var C,T,P=32-x;return x<32?(C=_.hi>>>x|_.lo<<P,T=_.lo>>>x|_.hi<<P):x<64&&(C=_.lo>>>x|_.hi<<P,T=_.hi>>>x|_.lo<<P),new e(C,T)}function vt(_,x,C){var T=_.hi&x.hi^~_.hi&C.hi,P=_.lo&x.lo^~_.lo&C.lo;return new e(T,P)}function Tt(_,x,C){var T=_.hi&x.hi^_.hi&C.hi^x.hi&C.hi,P=_.lo&x.lo^_.lo&C.lo^x.lo&C.lo;return new e(T,P)}function me(_){return ye(fe(_,28),fe(_,34),fe(_,39))}function ie(_){return ye(fe(_,14),fe(_,18),fe(_,41))}function he(_){return ye(fe(_,1),fe(_,8),_e(_,7))}function Le(_){return ye(fe(_,19),fe(_,61),_e(_,6))}var st=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Zt(_,x,C){var T,P,G,Ie=[],Se=[],le=[],Me=[];for(P=0;P<8;P++)Ie[P]=le[P]=z(_,8*P);for(var _t=0;C>=128;){for(P=0;P<16;P++)Me[P]=z(x,8*P+_t);for(P=0;P<80;P++){for(G=0;G<8;G++)Se[G]=le[G];for(T=X(le[7],ie(le[4]),vt(le[4],le[5],le[6]),st[P],Me[P%16]),Se[7]=X(T,me(le[0]),Tt(le[0],le[1],le[2])),Se[3]=X(Se[3],T),G=0;G<8;G++)le[(G+1)%8]=Se[G];if(P%16==15)for(G=0;G<16;G++)Me[G]=X(Me[G],Me[(G+9)%16],he(Me[(G+1)%16]),Le(Me[(G+14)%16]))}for(P=0;P<8;P++)le[P]=X(le[P],Ie[P]),Ie[P]=le[P];_t+=128,C-=128}for(P=0;P<8;P++)se(_,8*P,Ie[P]);return C}var _s=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function Gt(_,x,C){var T,P=new Uint8Array(64),G=new Uint8Array(256),Ie=C;for(T=0;T<64;T++)P[T]=_s[T];for(Zt(P,x,C),C%=128,T=0;T<256;T++)G[T]=0;for(T=0;T<C;T++)G[T]=x[Ie-C+T];for(G[C]=128,G[(C=256-128*(C<112?1:0))-9]=0,se(G,C-8,new e(Ie/536870912|0,Ie<<3)),Zt(P,G,C),T=0;T<64;T++)_[T]=P[T];return 0}function ls(_,x){var C=t(),T=t(),P=t(),G=t(),Ie=t(),Se=t(),le=t(),Me=t(),_t=t();ze(C,_[1],_[0]),ze(_t,x[1],x[0]),ve(C,C,_t),Qe(T,_[0],_[1]),Qe(_t,x[0],x[1]),ve(T,T,_t),ve(P,_[3],x[3]),ve(P,P,d),ve(G,_[2],x[2]),Qe(G,G,G),ze(Ie,T,C),ze(Se,G,P),Qe(le,G,P),Qe(Me,T,C),ve(_[0],Ie,Se),ve(_[1],Me,le),ve(_[2],le,Se),ve(_[3],Ie,Me)}function $s(_,x,C){var T;for(T=0;T<4;T++)Y(_[T],x[T],C)}function hs(_,x){var C=t(),T=t(),P=t();Xt(P,x[2]),ve(C,x[0],P),ve(T,x[1],P),Te(_,T),_[31]^=ht(C)<<7}function Cs(_,x,C){var T,P;for(F(_[0],o),F(_[1],a),F(_[2],a),F(_[3],o),P=255;P>=0;--P)$s(_,x,T=C[P/8|0]>>(7&P)&1),ls(x,_),ls(_,_),$s(_,x,T)}function ns(_,x){var C=[t(),t(),t(),t()];F(C[0],h),F(C[1],v),F(C[2],a),ve(C[3],h,v),Cs(_,C,x)}function I(_,x,C){var T,P=new Uint8Array(64),G=[t(),t(),t(),t()];for(C||n(x,32),Gt(P,x,32),P[0]&=248,P[31]&=127,P[31]|=64,ns(G,P),hs(_,G),T=0;T<32;T++)x[T+32]=_[T];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ge(_,x){var C,T,P,G;for(T=63;T>=32;--T){for(C=0,P=T-32,G=T-12;P<G;++P)x[P]+=C-16*x[T]*ne[P-(T-32)],C=Math.floor((x[P]+128)/256),x[P]-=256*C;x[P]+=C,x[T]=0}for(C=0,P=0;P<32;P++)x[P]+=C-(x[31]>>4)*ne[P],C=x[P]>>8,x[P]&=255;for(P=0;P<32;P++)x[P]-=C*ne[P];for(T=0;T<32;T++)x[T+1]+=x[T]>>8,_[T]=255&x[T]}function Ae(_){var x,C=new Float64Array(64);for(x=0;x<64;x++)C[x]=_[x];for(x=0;x<64;x++)_[x]=0;ge(_,C)}function nt(_,x,C,T){var P,G,Ie=new Uint8Array(64),Se=new Uint8Array(64),le=new Uint8Array(64),Me=new Float64Array(64),_t=[t(),t(),t(),t()];Gt(Ie,T,32),Ie[0]&=248,Ie[31]&=127,Ie[31]|=64;var rt=C+64;for(P=0;P<C;P++)_[64+P]=x[P];for(P=0;P<32;P++)_[32+P]=Ie[32+P];for(Gt(le,_.subarray(32),C+32),Ae(le),ns(_t,le),hs(_,_t),P=32;P<64;P++)_[P]=T[P];for(Gt(Se,_,C+64),Ae(Se),P=0;P<64;P++)Me[P]=0;for(P=0;P<32;P++)Me[P]=le[P];for(P=0;P<32;P++)for(G=0;G<32;G++)Me[P+G]+=Se[P]*Ie[G];return ge(_.subarray(32),Me),rt}function Ot(_,x,C,T){var P,G=new Uint8Array(32),Ie=new Uint8Array(64),Se=[t(),t(),t(),t()],le=[t(),t(),t(),t()];if(C<64||function(Me,_t){var rt=t(),Pt=t(),rs=t(),Ht=t(),Ii=t(),So=t(),Oi=t();return F(Me[2],a),At(Me[1],_t),ft(rs,Me[1]),ve(Ht,rs,u),ze(rs,rs,Me[2]),Qe(Ht,Me[2],Ht),ft(Ii,Ht),ft(So,Ii),ve(Oi,So,Ii),ve(rt,Oi,rs),ve(rt,rt,Ht),wt(rt,rt),ve(rt,rt,rs),ve(rt,rt,Ht),ve(rt,rt,Ht),ve(Me[0],rt,Ht),ft(Pt,Me[0]),ve(Pt,Pt,Ht),He(Pt,rs)&&ve(Me[0],Me[0],f),ft(Pt,Me[0]),ve(Pt,Pt,Ht),He(Pt,rs)?-1:(ht(Me[0])===_t[31]>>7&&ze(Me[0],o,Me[0]),ve(Me[3],Me[0],Me[1]),0)}(le,T))return-1;for(P=0;P<C;P++)_[P]=x[P];for(P=0;P<32;P++)_[P+32]=T[P];if(Gt(Ie,_,C),Ae(Ie),Cs(Se,le,Ie),ns(le,x.subarray(32)),ls(Se,le),hs(G,Se),C-=64,E(x,0,G,0)){for(P=0;P<C;P++)_[P]=0;return-1}for(P=0;P<C;P++)_[P]=x[P+64];return C}var Kt=16,Ye=64,ke=32,Oe=64;function Fe(_,x){if(_.length!==32)throw new Error("bad key size");if(x.length!==24)throw new Error("bad nonce size")}function be(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ot(_){for(var x=0;x<_.length;x++)_[x]=0}s.lowlevel={crypto_core_hsalsa20:S,crypto_stream_xor:w,crypto_stream:R,crypto_stream_salsa20_xor:B,crypto_stream_salsa20:K,crypto_onetimeauth:q,crypto_onetimeauth_verify:oe,crypto_verify_16:N,crypto_verify_32:E,crypto_secretbox:ue,crypto_secretbox_open:Ce,crypto_scalarmult:zt,crypto_scalarmult_base:it,crypto_box_beforenm:Be,crypto_box_afternm:Ue,crypto_box:function(_,x,C,T,P,G){var Ie=new Uint8Array(32);return Be(Ie,P,G),Ue(_,x,C,T,Ie)},crypto_box_open:function(_,x,C,T,P,G){var Ie=new Uint8Array(32);return Be(Ie,P,G),V(_,x,C,T,Ie)},crypto_box_keypair:es,crypto_hash:Gt,crypto_sign:nt,crypto_sign_keypair:I,crypto_sign_open:Ot,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:Kt,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:Ye,crypto_sign_PUBLICKEYBYTES:ke,crypto_sign_SECRETKEYBYTES:Oe,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:u,L:ne,pack25519:Te,unpack25519:At,M:ve,A:Qe,S:ft,Z:ze,pow2523:wt,add:ls,set25519:F,modL:ge,scalarmult:Cs,scalarbase:ns},s.randomBytes=function(_){var x=new Uint8Array(_);return n(x,_),x},s.secretbox=function(_,x,C){be(_,x,C),Fe(C,x);for(var T=new Uint8Array(32+_.length),P=new Uint8Array(T.length),G=0;G<_.length;G++)T[G+32]=_[G];return ue(P,T,T.length,x,C),P.subarray(Kt)},s.secretbox.open=function(_,x,C){be(_,x,C),Fe(C,x);for(var T=new Uint8Array(Kt+_.length),P=new Uint8Array(T.length),G=0;G<_.length;G++)T[G+Kt]=_[G];return T.length<32||Ce(P,T,T.length,x,C)!==0?null:P.subarray(32)},s.secretbox.keyLength=32,s.secretbox.nonceLength=24,s.secretbox.overheadLength=Kt,s.scalarMult=function(_,x){if(be(_,x),_.length!==32)throw new Error("bad n size");if(x.length!==32)throw new Error("bad p size");var C=new Uint8Array(32);return zt(C,_,x),C},s.scalarMult.base=function(_){if(be(_),_.length!==32)throw new Error("bad n size");var x=new Uint8Array(32);return it(x,_),x},s.scalarMult.scalarLength=32,s.scalarMult.groupElementLength=32,s.box=function(_,x,C,T){var P=s.box.before(C,T);return s.secretbox(_,x,P)},s.box.before=function(_,x){be(_,x),function(T,P){if(T.length!==32)throw new Error("bad public key size");if(P.length!==32)throw new Error("bad secret key size")}(_,x);var C=new Uint8Array(32);return Be(C,_,x),C},s.box.after=s.secretbox,s.box.open=function(_,x,C,T){var P=s.box.before(C,T);return s.secretbox.open(_,x,P)},s.box.open.after=s.secretbox.open,s.box.keyPair=function(){var _=new Uint8Array(32),x=new Uint8Array(32);return es(_,x),{publicKey:_,secretKey:x}},s.box.keyPair.fromSecretKey=function(_){if(be(_),_.length!==32)throw new Error("bad secret key size");var x=new Uint8Array(32);return it(x,_),{publicKey:x,secretKey:new Uint8Array(_)}},s.box.publicKeyLength=32,s.box.secretKeyLength=32,s.box.sharedKeyLength=32,s.box.nonceLength=24,s.box.overheadLength=s.secretbox.overheadLength,s.sign=function(_,x){if(be(_,x),x.length!==Oe)throw new Error("bad secret key size");var C=new Uint8Array(Ye+_.length);return nt(C,_,_.length,x),C},s.sign.open=function(_,x){if(be(_,x),x.length!==ke)throw new Error("bad public key size");var C=new Uint8Array(_.length),T=Ot(C,_,_.length,x);if(T<0)return null;for(var P=new Uint8Array(T),G=0;G<P.length;G++)P[G]=C[G];return P},s.sign.detached=function(_,x){for(var C=s.sign(_,x),T=new Uint8Array(Ye),P=0;P<T.length;P++)T[P]=C[P];return T},s.sign.detached.verify=function(_,x,C){if(be(_,x,C),x.length!==Ye)throw new Error("bad signature size");if(C.length!==ke)throw new Error("bad public key size");var T,P=new Uint8Array(Ye+_.length),G=new Uint8Array(Ye+_.length);for(T=0;T<Ye;T++)P[T]=x[T];for(T=0;T<_.length;T++)P[T+Ye]=_[T];return Ot(G,P,P.length,C)>=0},s.sign.keyPair=function(){var _=new Uint8Array(ke),x=new Uint8Array(Oe);return I(_,x),{publicKey:_,secretKey:x}},s.sign.keyPair.fromSecretKey=function(_){if(be(_),_.length!==Oe)throw new Error("bad secret key size");for(var x=new Uint8Array(ke),C=0;C<x.length;C++)x[C]=_[32+C];return{publicKey:x,secretKey:new Uint8Array(_)}},s.sign.keyPair.fromSeed=function(_){if(be(_),_.length!==32)throw new Error("bad seed size");for(var x=new Uint8Array(ke),C=new Uint8Array(Oe),T=0;T<32;T++)C[T]=_[T];return I(x,C,!0),{publicKey:x,secretKey:C}},s.sign.publicKeyLength=ke,s.sign.secretKeyLength=Oe,s.sign.seedLength=32,s.sign.signatureLength=Ye,s.hash=function(_){be(_);var x=new Uint8Array(64);return Gt(x,_,_.length),x},s.hash.hashLength=64,s.verify=function(_,x){return be(_,x),_.length!==0&&x.length!==0&&_.length===x.length&&Z(_,0,x,0,_.length)===0},s.setPRNG=function(_){n=_},function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;_&&_.getRandomValues?s.setPRNG(function(x,C){var T,P=new Uint8Array(C);for(T=0;T<C;T+=65536)_.getRandomValues(P.subarray(T,T+Math.min(C-T,65536)));for(T=0;T<C;T++)x[T]=P[T];ot(P)}):typeof require<"u"&&(_=require("crypto"))&&_.randomBytes&&s.setPRNG(function(x,C){var T,P=_.randomBytes(C);for(T=0;T<C;T++)x[T]=P[T];ot(P)})}()}(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const To=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;To.sign.keyPair.fromSeed,To.sign.detached,To.sign.detached.verify,To.randomBytes;var Du,Bu;(function(s){s.InvalidPrefixByte="nkeys: invalid prefix byte",s.InvalidKey="nkeys: invalid key",s.InvalidPublicKey="nkeys: invalid public key",s.InvalidSeedLen="nkeys: invalid seed length",s.InvalidSeed="nkeys: invalid seed",s.InvalidEncoding="nkeys: invalid encoded key",s.InvalidSignature="nkeys: signature verification failed",s.CannotSign="nkeys: cannot sign, no private key available",s.PublicKeyOnly="nkeys: no seed or private key available",s.InvalidChecksum="nkeys: invalid checksum",s.SerializationError="nkeys: serialization error",s.ApiError="nkeys: api error",s.ClearedPair="nkeys: pair is cleared"})(Du||(Du={})),function(s){s[s.Seed=144]="Seed",s[s.Private=120]="Private",s[s.Operator=112]="Operator",s[s.Server=104]="Server",s[s.Cluster=16]="Cluster",s[s.Account=0]="Account",s[s.User=160]="User"}(Bu||(Bu={}));const am=12e4;function K1(s){const e=[];var t,n,r,i;return typeof s.authenticator=="function"&&e.push(s.authenticator),Array.isArray(s.authenticator)&&e.push(...s.authenticator),s.token&&e.push((t=s.token,()=>({auth_token:typeof t=="function"?t():t}))),s.user&&e.push((n=s.user,r=s.pass,()=>({user:typeof n=="function"?n():n,pass:typeof r=="function"?r():r}))),e.length===0?()=>{}:(i=e,o=>{let a={};return i.forEach(l=>{const u=l(o)||{};a=Object.assign(a,u)}),a})}function Z1(s){const e=`${hc}:${im()}`;if((s=s||{servers:[e]}).servers=s.servers||[],typeof s.servers=="string"&&(s.servers=[s.servers]),s.servers.length>0&&s.port)throw new Ve("port and servers options are mutually exclusive",Pe.InvalidOption);s.servers.length===0&&s.port&&(s.servers=[`${hc}:${s.port}`]),s.servers&&s.servers.length===0&&(s.servers=[e]);const t=Ta({maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:am,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:2e3,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1},s);if(t.authenticator=K1(t),["reconnectDelayHandler","authenticator"].forEach(n=>{if(t[n]&&typeof t[n]!="function")throw new Ve(`${n} option should be a function`,Pe.NotFunction)}),t.reconnectDelayHandler||(t.reconnectDelayHandler=()=>{let n=t.tls?t.reconnectJitterTLS:t.reconnectJitter;return n&&(n++,n=Math.floor(Math.random()*n)),t.reconnectTimeWait+n}),t.inboxPrefix)try{Hn(t.inboxPrefix)}catch(n){throw new Ve(n.message,Pe.ApiError)}if(t.resolve===void 0&&(t.resolve=typeof yc()=="function"),t.resolve&&typeof yc()!="function")throw new Ve("'resolve' is not supported on this client",Pe.InvalidOption);return t}const G1=/^INFO\s+([^\r\n]+)\r\n/i,W1=Zi(`PONG\r
14
- `),zu=Zi(`PING\r
15
- `);class J1{constructor(e,t,n){p(this,"echo");p(this,"no_responders");p(this,"protocol");p(this,"verbose");p(this,"pedantic");p(this,"jwt");p(this,"nkey");p(this,"sig");p(this,"user");p(this,"pass");p(this,"auth_token");p(this,"tls_required");p(this,"name");p(this,"lang");p(this,"version");p(this,"headers");this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=!t.noEcho&&void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=!!t.tls||void 0,this.name=t.name,Ta(this,(t&&typeof t.authenticator=="function"?t.authenticator(n):{})||{})}}class cm extends Ms{constructor(t,n,r={}){var o;super();p(this,"sid");p(this,"queue");p(this,"draining");p(this,"max");p(this,"subject");p(this,"drained");p(this,"protocol");p(this,"timer");p(this,"info");p(this,"cleanupFn");p(this,"closed");p(this,"requestSubject");Ta(this,r),this.protocol=t,this.subject=n,this.draining=!1,this.noIterator=typeof r.callback=="function",this.closed=cs();const i=!((o=t.options)!=null&&o.noAsyncTraces);r.timeout&&(this.timer=fi(r.timeout,i),this.timer.then(()=>{this.timer=void 0}).catch(a=>{this.stop(a),this.noIterator&&this.callback(a,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(t){if(this.noIterator){const n=this.callback,r=t.ingestionFilterFn?t.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),i=t.protocolFilterFn?t.protocolFilterFn:()=>!0,o=t.dispatchedFn?t.dispatchedFn:()=>{};this.callback=(a,l)=>{const{ingest:u}=r(l);u&&i(l)&&(n(a,l),o(l))}}else this.protocolFilterFn=t.protocolFilterFn,this.dispatchedFn=t.dispatchedFn}callback(t,n){this.cancelTimeout(),t?this.stop(t):this.push(n)}close(){if(!this.isClosed()){this.cancelTimeout();const t=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?t():this.push(t)}}unsubscribe(t){this.protocol.unsubscribe(this,t)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Ve.errorForCode(Pe.ConnectionClosed)):this.isClosed()?Promise.reject(Ve.errorForCode(Pe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(cs()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class Y1{constructor(){p(this,"mux");p(this,"subs");p(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const t=e.permissionContext,n=this.all();let r;if(t.operation==="subscription"&&(r=n.find(i=>i.subject===t.subject&&i.queue===t.queue)),t.operation==="publish"&&(r=n.find(i=>i.requestSubject===t.subject)),r)return r.callback(e,{}),r.close(),this.subs.delete(r.sid),r!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class da{constructor(e,t){p(this,"connected");p(this,"connectedOnce");p(this,"infoReceived");p(this,"info");p(this,"muxSubscriptions");p(this,"options");p(this,"outbound");p(this,"pongs");p(this,"subscriptions");p(this,"transport");p(this,"noMorePublishing");p(this,"connectError");p(this,"publisher");p(this,"_closed");p(this,"closed");p(this,"listeners");p(this,"heartbeats");p(this,"parser");p(this,"outMsgs");p(this,"inMsgs");p(this,"outBytes");p(this,"inBytes");p(this,"pendingLimit");p(this,"lastError");p(this,"abortReconnect");p(this,"whyClosed");p(this,"servers");p(this,"server");p(this,"features");p(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=32768,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new Y1,this.muxSubscriptions=new V1,this.outbound=new gi,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new N1({major:0,minor:0,micro:0}),this.connectPromise=null;const n=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new U1(n,{randomize:!e.noRandomize}),this.closed=cs(),this.parser=new qu(this),this.heartbeats=new H1(this,this.options.pingInterval||am,this.options.maxPingOut||2)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const t=Ve.errorForCode(Pe.Disconnect);t.stack="",e.forEach(n=>{n.reject(t)}),this.parser=new qu(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}status(){const e=new Ms;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=cs();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=function(){if(!nn||typeof nn.factory!="function")throw new Error("transport fn is not set");return nn.factory()}(),this.transport.closed().then(async t=>{this.connected=!1,this.isClosed()||await this.disconnected(this.transport.closeError||this.lastError)}),e}disconnect(){this.dispatchStatus({type:oi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:oi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Mn.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var t;this.dispatchStatus({type:Mn.Reconnect,data:this.servers.getCurrentServer().toString()}),((t=this.lastError)==null?void 0:t.code)===Pe.AuthenticationExpired&&(this.lastError=void 0)}).catch(t=>{this._close(t)}):await this._close(e)}async dial(e){const t=this.prepare();let n;try{n=fi(this.options.timeout||2e4);const r=this.transport.connect(e,this.options);await Promise.race([r,n]),(async()=>{try{for await(const i of this.transport)this.parser.parse(i)}catch(i){console.log("reader closed",i)}})().then()}catch(r){t.reject(r)}try{await Promise.race([n,t]),n&&n.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(r){throw n&&n.cancel(),await this.transport.close(r),r}}async _doDial(e){const{resolve:t}=this.options,n=await e.resolve({fn:yc(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t});let r=null;for(const i of n)try{return r=null,this.dispatchStatus({type:oi.Reconnecting,data:i.toString()}),void await this.dial(i)}catch(o){r=o}throw r}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const t=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():2e3;let n=t;const r=this.selectServer();if(!r||this.abortReconnect)throw e||(this.lastError?this.lastError:Ve.errorForCode(Pe.ConnectionRefused));const i=Date.now();if(r.lastConnect===0||r.lastConnect+t<=i){r.lastConnect=Date.now();try{await this._doDial(r);break}catch(o){if(e=o,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}r.reconnects++;const a=this.options.maxReconnectAttempts||0;a!==-1&&r.reconnects>=a&&this.servers.removeCurrentServer()}}else n=Math.min(n,r.lastConnect+t-i),await Pi(n)}}static async connect(e,t){const n=new da(e,t);return await n.dialLoop(),n}static toError(e){const t=e?e.toLowerCase():"";if(t.indexOf("permissions violation")!==-1){const n=new Ve(e,Pe.PermissionsViolation),r=e.match(/(Publish|Subscription) to "(\S+)"/);if(r){n.permissionContext={operation:r[1].toLowerCase(),subject:r[2],queue:void 0};const i=e.match(/using queue "(\S+)"/);i&&(n.permissionContext.queue=i[1])}return n}return t.indexOf("authorization violation")!==-1?new Ve(e,Pe.AuthorizationViolation):t.indexOf("user authentication expired")!==-1?new Ve(e,Pe.AuthenticationExpired):t.indexOf("account authentication expired")!=-1?new Ve(e,Pe.AccountExpired):t.indexOf("authentication timeout")!==-1?new Ve(e,Pe.AuthenticationTimeout):new Ve(e,Pe.ProtocolError)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;const n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new hl(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(e){const t=Au(e),n=da.toError(t),r={type:Mn.Error,data:n.code};if(n.isPermissionError()){let i=!1;if(n.permissionContext){r.permissionContext=n.permissionContext;const o=this.subscriptions.getMux();i=(o==null?void 0:o.subject)===n.permissionContext.subject}this.subscriptions.handleError(n),this.muxSubscriptions.handleError(i,n),i&&this.subscriptions.setMux(null)}this.dispatchStatus(r),this.handleError(n)}handleError(e){e.isAuthError()?this.handleAuthError(e):(e.isProtocolError()||e.isAuthTimeout())&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(W1)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const t=JSON.parse(Au(e));this.info=t;const n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Or(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:r,lang:i}=this.transport;try{const o=new J1({version:r,lang:i},this.options,t.nonce);t.headers&&(o.headers=!0,o.no_responders=!0);const a=JSON.stringify(o);this.transport.send(Zi(`CONNECT ${a}${zo}`)),this.transport.send(zu)}catch(o){this._close(o)}}n&&this.dispatchStatus({type:Mn.Update,data:n}),t.ldm!==void 0&&t.ldm&&this.dispatchStatus({type:Mn.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Us.MSG:{const{msg:t,data:n}=e;this.processMsg(t,n);break}case Us.OK:break;case Us.ERR:this.processError(e.data);break;case Us.PING:this.processPing();break;case Us.PONG:this.processPong();break;case Us.INFO:this.processInfo(e.data)}}sendCommand(e,...t){const n=this.outbound.length();let r;r=typeof e=="string"?Zi(e):e,this.outbound.fill(r,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=rn,n){let r;if(t instanceof Uint8Array)r=t;else{if(typeof t!="string")throw Ve.errorForCode(Pe.BadPayload);r=Br.encode(t)}let i=r.length;(n=n||{}).reply=n.reply||"";let o,a=rn,l=0;if(n.headers){if(this.info&&!this.info.headers)throw new Ve("headers",Pe.ServerOptionNotAvailable);a=n.headers.encode(),l=a.length,i=r.length+l}if(this.info&&i>this.info.max_payload)throw Ve.errorForCode(Pe.MaxPayloadExceeded);this.outBytes+=i,this.outMsgs++,n.headers?(o=n.reply?`HPUB ${e} ${n.reply} ${l} ${i}\r
16
- `:`HPUB ${e} ${l} ${i}\r
17
- `,this.sendCommand(o,a,r,ua)):(o=n.reply?`PUB ${e} ${n.reply} ${i}\r
18
- `:`PUB ${e} ${i}\r
19
- `,this.sendCommand(o,r,ua))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\r
20
- `):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
21
- `)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,t){this.unsub(e,t),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,t){e&&!this.isClosed()&&(t?this.sendCommand(`UNSUB ${e.sid} ${t}\r
22
- `):this.sendCommand(`UNSUB ${e.sid}\r
23
- `),e.max=t)}resub(e,t){e&&!this.isClosed()&&(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=cs()),this.pongs.push(e),this.outbound.fill(zu),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(t=>{const n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}${zo}`):e.push(`SUB ${n.subject} ${n.sid}${zo}`)}),e.length&&this.transport.send(Zi(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(t=>{t.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),t=[];return e.forEach(n=>{t.push(n.drain())}),Promise.all(t).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(this.infoReceived&&this.connected&&this.outbound.size()){const e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const e=this.muxSubscriptions.init(this.options.inboxPrefix),t=new cm(this,`${e}*`);t.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(t),this.subscribe(t)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}class Uu{constructor(e){p(this,"msg");this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,t,n,r){var i,o;return(r=r||{}).headers=r.headers||Kn(),(i=r.headers)==null||i.set(oa,`${e}`),(o=r.headers)==null||o.set(ia,t),this.msg.respond(n,r)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class to{constructor(e,t="",n=""){p(this,"subject");p(this,"queue");p(this,"srv");t!==""&&function(i,o){if(o.indexOf(" ")!==-1)throw new Error(`${i} cannot contain spaces: '${o}'`);o.split(".").forEach(a=>{if(a===">")throw new Error(`${i} name cannot contain internal '>': '${o}'`)})}("service group",t);let r="";if(e instanceof wo)this.srv=e,r="";else{if(!(e instanceof to))throw new Error("unknown ServiceGroup type");{const i=e;this.srv=i.srv,n===""&&i.queue!==""&&(n=i.queue),r=i.subject}}this.subject=this.calcSubject(r,t),this.queue=n}calcSubject(e,t=""){return t===""?e:e!==""?`${e}.${t}`:t}addEndpoint(e="",t){const n=typeof(t=t||{subject:e})=="function"?{handler:t,subject:e}:t;Hi("endpoint",e);let{subject:r,handler:i,metadata:o,queue:a}=n;r=r||e,a=a||this.queue,function(u,d){if(d==="")throw new Error(`${u} cannot be empty`);if(d.indexOf(" ")!==-1)throw new Error(`${u} cannot contain spaces: '${d}'`);const h=d.split(".");h.forEach((v,f)=>{if(v===">"&&f!==h.length-1)throw new Error(`${u} cannot have internal '>': '${d}'`)})}("endpoint subject",r),r=this.calcSubject(this.subject,r);const l={name:e,subject:r,queue:a,handler:i,metadata:o};return this.srv._addEndpoint(l)}addGroup(e="",t=""){return new to(this,e,t)}}class wo{constructor(e,t={name:"",version:""}){p(this,"nc");p(this,"_id");p(this,"config");p(this,"handlers");p(this,"internal");p(this,"_stopped");p(this,"_done");p(this,"started");this.nc=e,this.config=Object.assign({},t),this.config.queue||(this.config.queue="q"),Hi("name",this.config.name),Hi("queue",this.config.queue),Or(this.config.version),this._id=gr.next(),this.internal=[],this._done=cs(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(n=>{this.close(n).catch()})}static controlSubject(e,t="",n="",r){const i=r??"$SRV";return t===""&&n===""?`${i}.${e}`:(Hi("control subject name",t),n!==""?(Hi("control subject id",n),`${i}.${e}.${t}.${n}`):`${i}.${e}.${t}`)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){const t=Kn();if(e instanceof aa){const n=e;t.set(ia,n.message),t.set(oa,`${n.code}`)}else t.set(ia,e.message),t.set(oa,"500");return t}setupHandler(e,t=!1){const n=t?"":e.queue?e.queue:this.config.queue,{name:r,subject:i,handler:o}=e,a=e;a.internal=t,t&&this.internal.push(a),a.stats=new X1(r,i,n),a.queue=n;const l=o?(u,d)=>{if(u)return void this.close(u);const h=Date.now();try{o(u,new Uu(d))}catch(v){a.stats.countError(v),d==null||d.respond(rn,{headers:this.errorToHeader(v)})}finally{a.stats.countLatency(h)}}:void 0;return a.sub=this.nc.subscribe(i,{callback:l,queue:n}),a.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const d=new Error(`required subscription ${e.subject} errored: ${u.message}`);d.stack=u.stack,this.close(d).catch()}}),a}info(){return{type:Gi.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:t,metadata:n,name:r,queue:i}=e;return{subject:t,metadata:n,name:r,queue_group:i}})}async stats(){const e=[];for(const t of this.handlers){if(typeof this.config.statsHandler=="function")try{t.stats.data=await this.config.statsHandler(t)}catch(n){t.stats.countError(n)}e.push(t.stats.stats(t.qi))}return{type:Gi.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){const n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(e,t,n,r="",i=""){const o={};o.name=e,o.subject=wo.controlSubject(t,r,i),o.handler=n,this.setupHandler(o,!0)}start(){const e=wn(),t=e.encode(this.ping());return this.addInternalHandler(ur.PING,(n,r)=>n?(this.close(n).then().catch(),Promise.reject(n)):(r.respond(t),Promise.resolve())),this.addInternalHandler(ur.STATS,(n,r)=>n?(this.close(n),Promise.reject(n)):this.stats().then(i=>(r==null||r.respond(e.encode(i)),Promise.resolve()))),this.addInternalHandler(ur.INFO,(n,r)=>n?(this.close(n),Promise.reject(n)):(r==null||r.respond(e.encode(this.info())),Promise.resolve())),this.handlers.forEach(n=>{const{subject:r}=n;typeof r=="string"&&n.handler!==null&&this.setupHandler(n)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0;let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(n=>n.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:Gi.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new to(this,e,t)}addEndpoint(e,t){return new to(this).addEndpoint(e,t)}_addEndpoint(e){const t=new Ms;t.noIterator=typeof e.handler=="function",t.noIterator||(e.handler=(r,i)=>{r?this.stop(r).catch():t.push(new Uu(i))},t.iterClosed.then(()=>{this.close().catch()}));const n=this.setupHandler(e,!1);return n.qi=t,this.handlers.push(n),t}}class X1{constructor(e,t,n=""){p(this,"name");p(this,"subject");p(this,"average_processing_time");p(this,"num_requests");p(this,"processing_time");p(this,"num_errors");p(this,"last_error");p(this,"data");p(this,"metadata");p(this,"queue");this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=as(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:o,last_error:a,data:l,queue:u}=this;return{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:o,last_error:a,data:l,queue_group:u}}stats(e){const t=e;return(t==null?void 0:t.noIterator)===!1&&(this.processing_time=as(t.time),this.num_requests=t.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class eg{constructor(e,t={strategy:bn.JitterTimer,maxWait:2e3},n){p(this,"nc");p(this,"prefix");p(this,"opts");this.nc=e,this.prefix=n,this.opts=t}ping(e="",t=""){return this.q(ur.PING,e,t)}stats(e="",t=""){return this.q(ur.STATS,e,t)}info(e="",t=""){return this.q(ur.INFO,e,t)}async q(e,t="",n=""){const r=new Ms,i=wn(),o=wo.controlSubject(e,t,n,this.prefix),a=await this.nc.requestMany(o,rn,this.opts);return(async()=>{for await(const l of a)try{const u=i.decode(l.data);r.push(u)}catch(u){r.push(()=>{r.stop(u)})}r.push(()=>{r.stop()})})().catch(l=>{r.stop(l)}),r}}const ha="KV-Operation",tg=/^[-/=.\w]+$/,sg=/^[-/=.>*\w]+$/,ng=/^[-\w]+$/;function rg(s){if(s.startsWith(".")||s.endsWith(".")||!tg.test(s))throw new Error(`invalid key: ${s}`)}function ig(s){if(s.startsWith(".")||s.endsWith(".")||!sg.test(s))throw new Error(`invalid key: ${s}`)}function og(s){if(s.startsWith(".")||s.endsWith("."))throw new Error(`invalid key: ${s}`);const e=s.split(".");let t=!1;for(let n=0;n<e.length;n++)switch(e[n]){case"*":t=!0;break;case">":if(n!==e.length-1)throw new Error(`invalid key: ${s}`);t=!0}return t}function Uo(s){if(!ng.test(s))throw new Error(`invalid bucket name: ${s}`)}var $n;(function(s){s.MsgIdHdr="Nats-Msg-Id",s.ExpectedStreamHdr="Nats-Expected-Stream",s.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",s.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",s.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})($n||($n={}));class so{constructor(e,t,n){p(this,"js");p(this,"jsm");p(this,"stream");p(this,"bucket");p(this,"direct");p(this,"codec");p(this,"prefix");p(this,"editPrefix");p(this,"useJsPrefix");p(this,"_prefixLen");p(this,"validateKey",rg);p(this,"validateSearchKey",ig);p(this,"hasWildcards",og);Uo(e),this.js=t,this.jsm=n,this.bucket=e,this.prefix="$KV",this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,t,n={}){Uo(t);const r=await e.jetstreamManager(),i=new so(t,e,r);return await i.init(n),i}static async bind(e,t,n={}){const r=await e.jetstreamManager(),i={config:{allow_direct:n.allow_direct}};Uo(t);const o=new so(t,e,r);return i.config.name=n.streamName??o.bucketName(),Object.assign(o,i),o.stream=i.config.name,o.codec=n.codec||{key:{encode:a=>a,decode:a=>a},value:{encode:a=>a,decode:a=>a}},o.direct=i.config.allow_direct??!1,o.initializePrefixes(i),o}async init(e={}){const t=Object.assign({replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:{key:{encode:h=>h,decode:h=>h},value:{encode:h=>h,decode:h=>h}},storage:gc.File},e);this.codec=t.codec;const n={};this.stream=n.name=e.streamName??this.bucketName(),n.retention=fc.Limits,n.max_msgs_per_subject=t.history,t.maxBucketSize&&(t.max_bytes=t.maxBucketSize),t.max_bytes&&(n.max_bytes=t.max_bytes),n.max_msg_size=t.maxValueSize,n.storage=t.storage;const r=e.placementCluster??"";if(r&&(e.placement={},e.placement.cluster=r,e.placement.tags=[]),e.placement&&(n.placement=e.placement),e.republish&&(n.republish=e.republish),e.description&&(n.description=e.description),e.mirror){const h=Object.assign({},e.mirror);h.name.startsWith(qn)||(h.name=`${qn}${h.name}`),n.mirror=h,n.mirror_direct=!0}else if(e.sources){const h=e.sources.map(v=>{const f=Object.assign({},v),b=f.name.startsWith(qn)?f.name.substring(3):f.name;return f.name.startsWith(qn)||(f.name=`${qn}${f.name}`),v.external||b===this.bucket||(f.subject_transforms=[{src:`$KV.${b}.>`,dest:`$KV.${this.bucket}.>`}]),f});n.sources=h,n.subjects=[this.subjectForBucket()]}else n.subjects=[this.subjectForBucket()];e.metadata&&(n.metadata=e.metadata),typeof e.compression=="boolean"&&(n.compression=e.compression?vr.S2:vr.None);const i=this.js.nc,o=i.getServerVersion(),a=!!o&&_c(o,Or("2.7.2"))>=0;n.discard=a?eo.New:eo.Old;const{ok:l,min:u}=i.features.get(Lt.JS_ALLOW_DIRECT);if(!l&&e.allow_direct===!0){const h=o?`${o.major}.${o.minor}.${o.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${h} - requires ${u}`))}let d;e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:l,n.allow_direct=e.allow_direct,this.direct=n.allow_direct,n.num_replicas=t.replicas,t.ttl&&(n.max_age=as(t.ttl)),n.allow_rollup_hdrs=!0;try{d=await this.jsm.streams.info(n.name),d.config.allow_direct||this.direct!==!0||(this.direct=!1)}catch(h){if(h.message!=="stream not found")throw h;d=await this.jsm.streams.add(n)}this.initializePrefixes(d)}initializePrefixes(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:t}=e.config;if(t){let n=t.name;if(n.startsWith(qn)&&(n=n.substring(3)),t.external&&t.external.api!==""){const r=t.name.substring(3);this.useJsPrefix=!1,this.prefix=`$KV.${r}`,this.editPrefix=`${t.external.api}.$KV.${n}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${qn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,t=!1){const n=[];return t?(this.useJsPrefix&&n.push(this.js.apiPrefix),this.editPrefix!==""?n.push(this.editPrefix):n.push(this.prefix)):this.prefix&&n.push(this.prefix),n.push(e),n.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`$KV.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.encode(n))}return t.join(".")}decodeKey(e){const t=[];for(const n of e.split("."))switch(n){case">":case"*":t.push(n);break;default:t.push(this.codec.key.decode(n))}return t.join(".")}close(){return Promise.resolve()}dataLen(e,t){const n=t&&t.get(Hs.MessageSizeHdr)||"";return n!==""?parseInt(n,10):e.length}smToEntry(e){return new _g(this.bucket,this.prefixLen,e)}jmToEntry(e){const t=this.decodeKey(e.subject.substring(this.prefixLen));return new yg(this.bucket,t,e)}async create(e,t){var i;let n;try{const o=await this.put(e,t,{previousSeq:0});return Promise.resolve(o)}catch(o){if(n=o,((i=o==null?void 0:o.api_error)==null?void 0:i.err_code)!==10071)return Promise.reject(o)}let r=0;try{const o=await this.get(e);return(o==null?void 0:o.operation)==="DEL"||(o==null?void 0:o.operation)==="PURGE"?(r=o!==null?o.revision:0,this.update(e,t,r)):Promise.reject(n)}catch(o){return Promise.reject(o)}}update(e,t,n){if(n<=0)throw new Error("version must be greater than 0");return this.put(e,t,{previousSeq:n})}async put(e,t,n={}){var o,a;const r=this.encodeKey(e);this.validateKey(r);const i={};if(n.previousSeq!==void 0){const l=Kn();i.headers=l,l.set($n.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(r,!0),t,i)).seq}catch(l){const u=l;return u.isJetStreamError()?(u.message=(o=u.api_error)==null?void 0:o.description,u.code=`${(a=u.api_error)==null?void 0:a.code}`,Promise.reject(u)):Promise.reject(l)}}async get(e,t){const n=this.encodeKey(e);this.validateKey(n);let r,i={last_by_subj:this.subjectForKey(n)};t&&t.revision>0&&(i={seq:t.revision});try{this.direct?r=await this.jsm.direct.getMessage(this.bucketName(),i):r=await this.jsm.streams.getMessage(this.bucketName(),i);const o=this.smToEntry(r);return o.key!==n?null:o}catch(o){if(o.code===Pe.JetStream404NoMessages)return null;throw o}}purge(e,t){return this._deleteOrPurge(e,"PURGE",t)}delete(e,t){return this._deleteOrPurge(e,"DEL",t)}async purgeDeletes(e=18e5){const t=cs(),n=[],r=await this.watch({key:">",initializedFn:()=>{t.resolve()}});(async()=>{for await(const l of r)l.operation!=="DEL"&&l.operation!=="PURGE"||n.push(l)})().then(),await t,r.stop();const i=Date.now()-e,o=n.map(l=>{const u=this.subjectForKey(l.key);return l.created.getTime()>=i?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),a=await Promise.all(o);return a.unshift({success:!0,purged:0}),a.reduce((l,u)=>(l.purged+=u.purged,l))}async _deleteOrPurge(e,t,n){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,t,n);const r=await this.keys(e),i=[];for await(const o of r)i.push(this._doDeleteOrPurge(o,t)),i.length===100&&(await Promise.all(i),i.length=0);i.length>0&&await Promise.all(i)}async _doDeleteOrPurge(e,t,n){const r=this.encodeKey(e);this.validateKey(r);const i=Kn();i.set(ha,t),t==="PURGE"&&i.set(Hs.RollupHdr,Hs.RollupValueSubject),n!=null&&n.previousSeq&&i.set($n.ExpectedLastSubjectSequenceHdr,`${n.previousSeq}`),await this.js.publish(this.subjectForKey(r,!0),rn,{headers:i})}_buildCC(e,t,n={}){let r,i=(Array.isArray(e)?e:[e]).map(a=>{const l=this.encodeKey(a);return this.validateSearchKey(a),this.fullKeyName(l)}),o=fs.LastPerSubject;return t===_n.AllHistory&&(o=fs.All),t===_n.UpdatesOnly&&(o=fs.New),i.length===1&&(r=i[0],i=void 0),Object.assign({deliver_policy:o,ack_policy:Es.None,filter_subjects:i,filter_subject:r,flow_control:!0,idle_heartbeat:as(5e3)},n)}remove(e){return this.purge(e)}async history(e={}){const t=e.key??">",n=new Ms,r={};let i;r.headers_only=e.headers_only||!1,i=()=>{n.stop()};let o=0;const a=this._buildCC(t,_n.AllHistory,r),l=a.filter_subject,u=hr(a);u.bindStream(this.stream),u.orderedConsumer(),u.callback((h,v)=>{if(h)n.stop(h);else if(v){const f=this.jmToEntry(v);n.push(f),n.received++,(i&&o>0&&n.received>=o||v.info.pending===0)&&(n.push(i),i=void 0)}});const d=await this.js.subscribe(l,u);if(i){const{info:{last:h}}=d,v=h.num_pending+h.delivered.consumer_seq;if(v===0||n.received>=v)try{i()}catch(f){n.stop(f)}finally{i=void 0}else o=v}return n._data=d,n.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{n.stop()}).catch(h=>{n.stop(h)}),n}canSetWatcherName(){const e=this.js.nc,{ok:t}=e.features.get(Lt.JS_NEW_CONSUMER_CREATE_API);return t}async watch(e={}){const t=e.key??">",n=new Ms,r={};r.headers_only=e.headers_only||!1;let i=_n.LastValue;e.include===_n.AllHistory?i=_n.AllHistory:e.include===_n.UpdatesOnly&&(i=_n.UpdatesOnly);const o=e.ignoreDeletes===!0;let a=e.initializedFn,l=0;const u=this._buildCC(t,i,r),d=u.filter_subject,h=hr(u);this.canSetWatcherName()&&h.consumerName(gr.next()),h.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&h.startSequence(e.resumeFromRevision),h.orderedConsumer(),h.callback((f,b)=>{if(f)n.stop(f);else if(b){const k=this.jmToEntry(b);if(o&&k.operation==="DEL")return;n.push(k),n.received++,a&&(l>0&&n.received>=l||b.info.pending===0)&&(n.push(a),a=void 0)}});const v=await this.js.subscribe(d,h);if(a){const{info:{last:f}}=v,b=f.num_pending+f.delivered.consumer_seq;if(b===0||n.received>=b)try{a()}catch(k){n.stop(k)}finally{a=void 0}else l=b}return n._data=v,n.iterClosed.then(()=>{v.unsubscribe()}),v.closed.then(()=>{n.stop()}).catch(f=>{n.stop(f)}),n}async keys(e=">"){const t=new Ms,n=this._buildCC(e,_n.LastValue,{headers_only:!0}),r=Array.isArray(e)?">":n.filter_subject,i=hr(n);i.bindStream(this.stream),i.orderedConsumer();const o=await this.js.subscribe(r,i);return(async()=>{var a;for await(const l of o){const u=(a=l.headers)==null?void 0:a.get(ha);if(u!=="DEL"&&u!=="PURGE"){const d=this.decodeKey(l.subject.substring(this.prefixLen));t.push(d)}l.info.pending===0&&o.unsubscribe()}})().then(()=>{t.stop()}).catch(a=>{t.stop(a)}),o.info.last.num_pending===0&&o.unsubscribe(),t}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var i;const e=this.js.nc,t=((i=e.info)==null?void 0:i.cluster)??"",n=this.bucketName(),r=await this.jsm.streams.info(n);return new lm(r,t)}}class lm{constructor(e,t=""){p(this,"si");p(this,"cluster");this.si=e,this.cluster=t}get bucket(){return this.si.config.name.startsWith(qn)?this.si.config.name.substring(3):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return dl(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var e;return((e=this.si.config.placement)==null?void 0:e.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return!!this.si.config.compression&&this.si.config.compression!==vr.None}}const fl="OBJ_",Vu="SHA-256=";class wc{constructor(e){p(this,"si");p(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return(e=this.si.config.name).startsWith(fl)?e.substring(4):e;var e}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return!!this.si.config.compression&&this.si.config.compression!==vr.None}}function Po(s){if(s===void 0)return;const{domain:e}=s;if(e===void 0)return s;const t=Object.assign({},s);if(delete t.domain,e==="")return t;if(t.external)throw new Error("domain and external are both set");return t.external={api:`$JS.${e}.API`},t}var an,Tn,ui;(function(s){s[s.Unset=-1]="Unset",s[s.Consume=0]="Consume",s[s.Fetch=1]="Fetch"})(an||(an={})),function(s){s.HeartbeatsMissed="heartbeats_missed",s.ConsumerNotFound="consumer_not_found",s.StreamNotFound="stream_not_found",s.ConsumerDeleted="consumer_deleted",s.OrderedConsumerRecreated="ordered_consumer_recreated",s.NoResponders="no_responders"}(Tn||(Tn={})),function(s){s.DebugEvent="debug",s.Discard="discard",s.Reset="reset",s.Next="next"}(ui||(ui={}));const Hu=Uint8Array.of(43,65,67,75),ag=Uint8Array.of(45,78,65,75),ji=Uint8Array.of(43,87,80,73),cg=Uint8Array.of(43,78,88,84),lg=Uint8Array.of(43,84,69,82,77),ug=Uint8Array.of(32);function Ki(s,e=5e3){return new xg(s,e)}class Ka extends Ms{constructor(t,n,r=!1){super();p(this,"consumer");p(this,"opts");p(this,"sub");p(this,"monitor");p(this,"pending");p(this,"inbox");p(this,"refilling");p(this,"pong");p(this,"callback");p(this,"timeout");p(this,"cleanupHandler");p(this,"listeners");p(this,"statusIterator");p(this,"forOrderedConsumer");p(this,"resetHandler");p(this,"abortOnMissingResource");p(this,"bind");p(this,"inBackOff");this.consumer=t;const i=n;this.opts=this.parseOptions(n,r),this.callback=i.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=r,this.timeout=null,this.inbox=Hn(t.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=i.abort_on_missing_resource===!0,this.bind=i.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:t,max_bytes:n,idle_heartbeat:r,threshold_bytes:i,threshold_messages:o}=this.opts;this.closed().then(l=>{if(this.cleanupHandler)try{this.cleanupHandler(l)}catch{}});const{sub:a}=this;a&&a.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(l,u)=>{var d,h,v,f;if(l)return void this.stop(l);if((d=this.monitor)==null||d.work(),u.subject===this.inbox){if(pc(u))return;const b=(h=u.headers)==null?void 0:h.code,k=((f=(v=u.headers)==null?void 0:v.description)==null?void 0:f.toLowerCase())||"unknown",{msgsLeft:z,bytesLeft:L}=this.parseDiscard(u.headers);if(z>0||L>0)this.pending.msgs-=z,this.pending.bytes-=L,this.pending.requests--,this.notify(ui.Discard,{msgsLeft:z,bytesLeft:L});else{if(b===400)return void this.stop(new Ve(k,`${b}`));if(b===409&&k==="consumer deleted"){if(this.notify(Tn.ConsumerDeleted,`${b} ${k}`),!this.refilling||this.abortOnMissingResource){const se=new Ve(k,`${b}`);return void this.stop(se)}}else if(b===503){if(this.notify(Tn.NoResponders,`${b} No Responders`),!this.refilling||this.abortOnMissingResource){const se=new Ve("no responders",`${b}`);return void this.stop(se)}}else this.notify(ui.DebugEvent,`${b} ${k}`)}}else this._push(Ki(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(t&&this.pending.msgs<=o||n&&this.pending.bytes<=i){const b=this.pullOptions();this.pull(b)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),r&&(this.monitor=new ml(r,l=>(this.notify(Tn.HeartbeatsMissed,l),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const l=this.consumer.api.nc.status();this.statusIterator=l;for await(const d of l)switch(d.type){case Mn.Disconnect:(u=this.monitor)==null||u.cancel();break;case Mn.Reconnect:this.resetPending().then(h=>{var v;h&&((v=this.monitor)==null||v.restart())}).catch(()=>{})}})(),this.pull(this.pullOptions())}_push(t){if(this.callback){const n=typeof t=="function"?t:null;try{n?n():this.callback(t)}catch(r){this.stop(r)}}else super.push(t)}notify(t,n){this.listeners.length>0&&this.listeners.forEach(r=>{r.done||r.push({type:t,data:n})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let t=0,n=0;const r=ul([this.opts.expires]);let i=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,t=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(o){if(o.message==="stream not found"){if(n++,this.notify(Tn.StreamNotFound,n),!this.refilling||this.abortOnMissingResource)return this.stop(o),!1}else if(o.message==="consumer not found"){if(t++,this.notify(Tn.ConsumerNotFound,t),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(o),!1;if(this.forOrderedConsumer)return!1}else t=0,n=0;this.inBackOff=!0;const a=Pi(r.backoff(i));await Promise.race([a,this.consumer.api.nc.closed()]),a.cancel(),i++}}}pull(t){this.pending.bytes+=t.max_bytes??0,this.pending.msgs+=t.batch??0,this.pending.requests++;const n=this.consumer.api.nc;this._push(()=>{n.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(t),{reply:this.inbox}),this.notify(ui.Next,t)})}pullOptions(){return{batch:this.opts.max_messages-this.pending.msgs,max_bytes:this.opts.max_bytes-this.pending.bytes,idle_heartbeat:as(this.opts.idle_heartbeat),expires:as(this.opts.expires)}}parseDiscard(t){const n={msgsLeft:0,bytesLeft:0},r=t==null?void 0:t.get(Hs.PendingMessagesHdr);r&&(n.msgsLeft=parseInt(r));const i=t==null?void 0:t.get(Hs.PendingBytesHdr);return i&&(n.bytesLeft=parseInt(i)),n}trackTimeout(t){this.timeout=t}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var t,n;(t=this.monitor)==null||t.cancel(),this.monitor=null,(n=this.timeout)==null||n.cancel(),this.timeout=null}setCleanupHandler(t){this.cleanupHandler=t}stop(t){var n,r;this.done||((n=this.sub)==null||n.unsubscribe(),this.clearTimers(),(r=this.statusIterator)==null||r.stop(),this._push(()=>{super.stop(t),this.listeners.forEach(i=>{i.stop()})}))}parseOptions(t,n=!1){const r=t||{};if(r.max_messages=r.max_messages||0,r.max_bytes=r.max_bytes||0,r.max_messages!==0&&r.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(r.max_messages===0&&(r.max_messages=100),r.expires=r.expires||3e4,r.expires<1e3)throw new Error("expires should be at least 1000ms");if(r.idle_heartbeat=r.idle_heartbeat||r.expires/2,r.idle_heartbeat=r.idle_heartbeat>3e4?3e4:r.idle_heartbeat,n){const i=Math.round(.75*r.max_messages)||1;r.threshold_messages=r.threshold_messages||i;const o=Math.round(.75*r.max_bytes)||1;r.threshold_bytes=r.threshold_bytes||o}return r}status(){const t=new Ms;return this.listeners.push(t),Promise.resolve(t)}}class dg extends Ms{constructor(){super();p(this,"src");p(this,"listeners");this.listeners=[]}setSource(t){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=t,this.src.setCleanupHandler(n=>{this.stop(n||void 0)}),(async()=>{const n=await this.src.status();for await(const r of n)this.notify(r.type,r.data)})().catch(()=>{})}notify(t,n){this.listeners.length>0&&this.listeners.forEach(r=>{r.done||r.push({type:t,data:n})})}stop(t){var n;this.done||((n=this.src)==null||n.stop(t),super.stop(t),this.listeners.forEach(r=>{r.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const t=new Ms;return this.listeners.push(t),Promise.resolve(t)}}class xc{constructor(e,t){p(this,"api");p(this,"_info");p(this,"stream");p(this,"name");this.api=e,this._info=t,this.stream=t.stream_name,this.name=t.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new Ka(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const t=new Ka(this,e,!1),n=fi(Math.round(1.05*t.opts.expires));return t.closed().catch(()=>{}).finally(()=>{n.cancel()}),n.catch(()=>{t.close().catch()}),t.trackTimeout(n),Promise.resolve(t)}next(e={expires:3e4}){const t=cs(),n=e;n.max_messages=1;const r=new Ka(this,n,!1),i=Math.round(1.05*r.opts.expires);i>=6e4&&(async()=>{for await(const a of await r.status())if(a.type===Tn.HeartbeatsMissed&&a.data>=2){t.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const a of r){t.resolve(a);break}})().catch(()=>{});const o=fi(i);return r.closed().then(a=>{a?t.reject(a):t.resolve(null)}).catch(a=>{t.reject(a)}).finally(()=>{o.cancel()}),o.catch(a=>{t.resolve(null),r.close().catch()}),r.trackTimeout(o),t}delete(){const{stream_name:e,name:t}=this._info;return this.api.delete(e,t)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:t,name:n}=this._info;return this.api.info(t,n).then(r=>(this._info=r,this._info))}}class hg{constructor(e,t,n={}){p(this,"api");p(this,"consumerOpts");p(this,"consumer");p(this,"opts");p(this,"cursor");p(this,"stream");p(this,"namePrefix");p(this,"serial");p(this,"currentConsumer");p(this,"userCallback");p(this,"iter");p(this,"type");p(this,"startSeq");p(this,"maxInitialReset");this.api=e,this.stream=t,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=gr.next(),typeof n.name_prefix=="string"&&(Pa("name_prefix",n.name_prefix),this.namePrefix=n.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=an.Unset,this.consumerOpts=n,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(e){this.serial++,e=e===0?1:e;const t={name:`${this.namePrefix}_${this.serial}`,deliver_policy:fs.StartSequence,opt_start_seq:e,ack_policy:Es.None,inactive_threshold:as(3e5),num_replicas:1};return this.consumerOpts.headers_only===!0&&(t.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(t.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(t.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(t.replay_policy=this.consumerOpts.replay_policy),e===this.startSeq+1&&(t.deliver_policy=this.consumerOpts.deliver_policy||fs.StartSequence,this.consumerOpts.deliver_policy!==fs.LastPerSubject&&this.consumerOpts.deliver_policy!==fs.New&&this.consumerOpts.deliver_policy!==fs.Last||(delete t.opt_start_seq,t.deliver_policy=this.consumerOpts.deliver_policy),t.deliver_policy===fs.LastPerSubject&&t.filter_subjects===void 0&&t.filter_subject===void 0&&(t.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete t.opt_start_seq,t.deliver_policy=fs.StartTime,t.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(t.inactive_threshold=as(this.consumerOpts.inactive_threshold))),t}async resetConsumer(e=0){var o,a,l,u,d;gr.next();const t=this.serial===0;(o=this.consumer)==null||o.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const n=this.getConsumerOpts(e);n.max_deliver=1,n.mem_storage=!0;const r=ul([((a=this.opts)==null?void 0:a.expires)||3e4]);let i;for(let h=0;;h++)try{i=await this.api.add(this.stream,n),(l=this.iter)==null||l.notify(Tn.OrderedConsumerRecreated,i.name);break}catch(v){if(v.message==="stream not found"&&((u=this.iter)==null||u.notify(Tn.StreamNotFound,h),this.type===an.Fetch||this.opts.abort_on_missing_resource===!0))return(d=this.iter)==null||d.stop(v),Promise.reject(v);if(t&&h>=this.maxInitialReset)throw v;await Pi(r.backoff(h+1))}return i}internalHandler(e){return t=>{var r;if(this.serial!==e)return;const n=t.info.deliverySequence;n===this.cursor.deliver_seq+1?(this.cursor.deliver_seq=n,this.cursor.stream_seq=t.info.streamSequence,this.userCallback?this.userCallback(t):(r=this.iter)==null||r.push(t)):this.notifyOrderedResetAndReset()}}async reset(e={max_messages:100,expires:3e4},t){var a,l;const n=(t=t||{}).fromFetch||!1,r=t.orderedReset||!1;if(this.type===an.Fetch&&r)return(a=this.iter)==null||a.src.stop(),await((l=this.iter)==null?void 0:l.closed()),void(this.currentConsumer=null);(this.currentConsumer===null||r)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||n)&&(this.iter=new dg),this.consumer=new xc(this.api,this.currentConsumer),e.callback=this.internalHandler(this.serial);let i=null;this.type===an.Fetch&&n?i=await this.consumer.fetch(e):this.type===an.Consume&&(i=await this.consumer.consume(e));const o=i;o.forOrderedConsumer=!0,o.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(o)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(ui.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===an.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===an.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:t}=e;return t&&(this.userCallback=t),this.type=an.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var n;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===an.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((n=this.iter)==null?void 0:n.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:t}=e;return t&&(this.userCallback=t),this.type=an.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const t=e;if(t.bind)return Promise.reject(new Error("bind is not supported"));t.max_messages=1;const n=cs();return t.callback=r=>{this.userCallback=null,n.resolve(r)},(await this.fetch(t)).iterClosed.then(r=>{r&&n.reject(r),n.resolve(null)}).catch(r=>{n.reject(r)}),n}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Sc{constructor(e){p(this,"api");p(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Lt.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new xc(this.api,e)}async get(e,t={}){return typeof t=="object"?this.ordered(e,t):(await this.checkVersion(),this.api.info(e,t).then(n=>n.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new xc(this.api,n)).catch(n=>Promise.reject(n)))}async ordered(e,t){await this.checkVersion();const n=this.api;return new gl(n.nc,n.opts).info(e).then(r=>Promise.resolve(new hg(this.api,e,t))).catch(r=>Promise.reject(r))}}class Ra{constructor(e,t){p(this,"api");p(this,"_info");this.api=e,this._info=t}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new Ra(this.api,e)}return this}info(e=!1,t){return e?Promise.resolve(this._info):this.api.info(this.name,t).then(n=>(this._info=n,this._info))}getConsumerFromInfo(e){return new Sc(new la(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new Sc(new la(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,t){return this.api.deleteMessage(this.name,e,t)}}class gl extends bo{constructor(e,t){super(e,t)}checkStreamConfigVersions(e){const t=this.nc;if(e.metadata){const{min:r,ok:i}=t.features.get(Lt.JS_STREAM_CONSUMER_METADATA);if(!i)throw new Error(`stream 'metadata' requires server ${r}`)}if(e.first_seq){const{min:r,ok:i}=t.features.get(Lt.JS_STREAM_FIRST_SEQ);if(!i)throw new Error(`stream 'first_seq' requires server ${r}`)}if(e.subject_transform){const{min:r,ok:i}=t.features.get(Lt.JS_STREAM_SUBJECT_TRANSFORM);if(!i)throw new Error(`stream 'subject_transform' requires server ${r}`)}if(e.compression){const{min:r,ok:i}=t.features.get(Lt.JS_STREAM_COMPRESSION);if(!i)throw new Error(`stream 'compression' requires server ${r}`)}if(e.consumer_limits){const{min:r,ok:i}=t.features.get(Lt.JS_DEFAULT_CONSUMER_LIMITS);if(!i)throw new Error(`stream 'consumer_limits' requires server ${r}`)}function n(r,i){var o;if((((o=i==null?void 0:i.subject_transforms)==null?void 0:o.length)||0)>0){const{min:a,ok:l}=t.features.get(Lt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!l)throw new Error(`${r} 'subject_transforms' requires server ${a}`)}}e.sources&&e.sources.forEach(r=>{n("stream sources",r)}),e.mirror&&n("stream mirror",e.mirror)}async add(e={}){var n;this.checkStreamConfigVersions(e),zs(e.name),e.mirror=Po(e.mirror),e.sources=(n=e.sources)==null?void 0:n.map(Po);const t=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(t),t}async delete(e){return zs(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,t={}){var o;if(typeof e=="object"){const a=e;e=a.name,t=a,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(t),zs(e);const n=await this.info(e),r=Object.assign(n.config,t);r.mirror=Po(r.mirror),r.sources=(o=r.sources)==null?void 0:o.map(Po);const i=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,r);return this._fixInfo(i),i}async info(e,t){zs(e);const n=`${this.prefix}.STREAM.INFO.${e}`;let r=await this._request(n,t),{total:i,limit:o}=r,a=r.state.subjects?Object.getOwnPropertyNames(r.state.subjects).length:1;if(i&&i>a){const l=[r],u=t||{};let d=0;for(;i>a;){d++,u.offset=o*d;const v=await this._request(n,u);i=v.total,l.push(v);const f=Object.getOwnPropertyNames(v.state.subjects).length;if(a+=f,f<o)break}let h={};for(let v=0;v<l.length;v++)r=l[v],r.state.subjects&&(h=Object.assign(h,r.state.subjects));r.offset=0,r.total=0,r.limit=0,r.state.subjects=h}return this._fixInfo(r),r}list(e=""){const t=e!=null&&e.length?{subject:e}:{},n=`${this.prefix}.STREAM.LIST`;return new Qi(n,r=>{const i=r;return i.streams.forEach(o=>{this._fixInfo(o)}),i.streams},this,t)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,t){if(t){const{keep:n,seq:r}=t;if(typeof n=="number"&&typeof r=="number")throw new Error("can specify one of keep or seq")}return zs(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,t)}async deleteMessage(e,t,n=!0){zs(e);const r={seq:t};return n||(r.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,r)).success}async getMessage(e,t){zs(e);const n=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,t);return new um(n)}find(e){return this.findStream(e)}listKvs(){const e=`${this.prefix}.STREAM.LIST`;return new Qi(e,t=>{var i;const n=t.streams.filter(o=>o.config.name.startsWith(qn));n.forEach(o=>{this._fixInfo(o)});let r="";return n.length&&(r=((i=this.nc.info)==null?void 0:i.cluster)??""),n.map(o=>new lm(o,r))},this)}listObjectStores(){const e=`${this.prefix}.STREAM.LIST`;return new Qi(e,t=>{const n=t.streams.filter(r=>r.config.name.startsWith(fl));return n.forEach(r=>{this._fixInfo(r)}),n.map(r=>new wc(r))},this)}names(e=""){const t=e!=null&&e.length?{subject:e}:{},n=`${this.prefix}.STREAM.NAMES`;return new Qi(n,r=>r.streams,this,t)}async get(e){const t=await this.info(e);return Promise.resolve(new Ra(this,t))}}class mg extends bo{constructor(e,t){super(e,t)}async getMessage(e,t){zs(e);let n=t;const{last_by_subj:r}=n;r&&(n=null);const i=n?this.jc.encode(n):rn,o=this.opts.apiPrefix||"$JS.API",a=r?`${o}.DIRECT.GET.${e}.${r}`:`${o}.DIRECT.GET.${e}`,l=await this.nc.request(a,i,{timeout:this.timeout}),u=Xr(l);if(u)return Promise.reject(u);const d=new Cc(l);return Promise.resolve(d)}async getBatch(e,t){zs(e);const n=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(t.multi_last)||t.multi_last.length===0)return Promise.reject("multi_last is required");const r=JSON.stringify(t,(a,l)=>a==="up_to_time"&&l instanceof Date?l.toISOString():l),i=new Ms,o=await this.nc.requestMany(n,r,{strategy:bn.SentinelMsg});return(async()=>{var d,h,v;let a,l=!1,u=!1;for await(const f of o){if(!l){l=!0;const b=((d=f.headers)==null?void 0:d.code)||0;if(b!==0&&b<200||b>299){a=(h=f.headers)==null?void 0:h.description.toLowerCase();break}if(((v=f.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(f.data.length===0)break;i.push(new Cc(f))}i.push(()=>{if(u)throw new Error("batch direct get not supported by the server");if(a)throw new Error(`bad request: ${a}`);i.stop()})})(),Promise.resolve(i)}}class Cc{constructor(e){p(this,"data");p(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(si.Subject)}get seq(){const e=this.header.last(si.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(si.TimeStamp)}get stream(){return this.header.last(si.Stream)}json(e){return wn(e).decode(this.data)}string(){return sn.decode(this.data)}}p(Cc,"jc");class pg extends bo{constructor(t,n){super(t,n);p(this,"streams");p(this,"consumers");p(this,"direct");this.streams=new gl(t,n),this.consumers=new la(t,n),this.direct=new mg(t,n)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const t=new Ms;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(n,r)=>{if(n)throw n;try{const i=this.parseJsResponse(r),o=i.type.split("."),a=o[o.length-1];t.push({kind:a,data:i})}catch(i){t.stop(i)}}}),t}}class um{constructor(e){p(this,"_header");p(this,"smr");this.smr=e}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):rn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=dr.decode(e)}else this._header=Kn();return this._header}_parse(e){const t=atob(e),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r}json(e){return wn(e).decode(this.data)}string(){return sn.decode(this.data)}}p(um,"jc");class fg{constructor(e){p(this,"api");this.api=e}get(e){return this.api.info(e).then(t=>new Ra(this.api,t))}}class Za{constructor(e){p(this,"info");p(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=dr.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var e,t;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((t=this.info.options)==null?void 0:t.link)!==null}}function Qu(s){const e={name:s.name,description:s.description??"",options:s.options,metadata:s.metadata};if(s.headers){const t=s.headers;e.headers=t.toRecord()}return e}class Ji{constructor(e,t,n){p(this,"jsm");p(this,"js");p(this,"stream");p(this,"name");this.name=e,this.jsm=t,this.js=n}_checkNotEmpty(e){return e&&e.length!==0?{name:e}:{name:e,error:new Error("name cannot be empty")}}async info(e){const t=await this.rawInfo(e);return t?new Za(t):null}async list(){const e=[],t=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const n of t){if(n===null)break;e.push(n)}return Promise.resolve(e)}async rawInfo(e){const{name:t,error:n}=this._checkNotEmpty(e);if(n)return Promise.reject(n);const r=this._metaSubject(t);try{const i=await this.jsm.streams.getMessage(this.stream,{last_by_subj:r}),o=wn().decode(i.data);return o.revision=i.seq,o}catch(i){return i.code==="404"?null:Promise.reject(i)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(t){return t.code==="404"?null:Promise.reject(t)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new wc(e)))}async status(e){const t=await this._si(e);return t===null?Promise.reject(new Error("object store not found")):Promise.resolve(new wc(t))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,t,n){var N;const r=this.js.getOptions();(n=n||{timeout:r.timeout}).timeout=n.timeout||r.timeout,n.previousRevision=n.previousRevision??void 0;const{timeout:i,previousRevision:o}=n,a=this.js.nc.info,l=(a==null?void 0:a.max_payload)||1024;(e=e||{}).options=e.options||{};let u=((N=e.options)==null?void 0:N.max_chunk_size)||131072;u=u>l?l:u,e.options.max_chunk_size=u;const d=await this.info(e.name),{name:h,error:v}=this._checkNotEmpty(e.name);if(v)return Promise.reject(v);const f=gr.next(),b=this._chunkSubject(f),k=this._metaSubject(h),z=Object.assign({bucket:this.name,nuid:f,size:0,chunks:0},Qu(e)),L=cs(),se=[],Z=new gi;try{const E=t?t.getReader():null,O=Lu.create();for(;;){const{done:U,value:S}=E?await E.read():{done:!0,value:void 0};if(U){if(Z.size()>0){const R=Z.drain();O.update(R),z.chunks++,z.size+=R.length,se.push(this.js.publish(b,R,{timeout:i}))}await Promise.all(se),se.length=0,z.mtime=new Date().toISOString();const M=li.encode(O.digest());z.digest=`${Vu}${M}`,z.deleted=!1;const B=Kn();typeof o=="number"&&B.set($n.ExpectedLastSubjectSequenceHdr,`${o}`),B.set(Hs.RollupHdr,Hs.RollupValueSubject);const K=await this.js.publish(k,wn().encode(z),{headers:B,timeout:i});if(z.revision=K.seq,d)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${d.nuid}`})}catch{}L.resolve(new Za(z));break}if(S)for(Z.fill(S);Z.size()>u;){z.chunks++,z.size+=u;const M=Z.drain(e.options.max_chunk_size);O.update(M),se.push(this.js.publish(b,M,{timeout:i}))}}}catch(E){await this.jsm.streams.purge(this.stream,{filter:b}),L.reject(E)}return L}putBlob(e,t,n){return t===null&&(t=new Uint8Array(0)),this.put(e,function(r){return new ReadableStream({pull(i){i.enqueue(r),i.close()}})}(t),n)}put(e,t,n){var r;return(r=e==null?void 0:e.options)!=null&&r.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,t,n)}async getBlob(e){const t=await this.get(e);if(t===null)return Promise.resolve(null);const n=await Promise.all([t.error,async function(r){const i=new gi,o=r.getReader();for(;;){const{done:a,value:l}=await o.read();if(a)return i.drain();l&&l.length&&i.fill(l)}}(t.data)]);return n[0]?Promise.reject(n[0]):Promise.resolve(n[1])}async get(e){const t=await this.rawInfo(e);if(t===null||t.deleted)return Promise.resolve(null);if(t.options&&t.options.link){const h=t.options.link.name||"";if(h==="")throw new Error("link is a bucket");return(t.options.link.bucket!==this.name?await Ji.create(this.js,t.options.link.bucket):this).get(h)}if(!t.digest.startsWith(Vu))return Promise.reject(new Error(`unknown digest type: ${t.digest}`));const n=vc(t.digest.substring(8));if(n===null)return Promise.reject(new Error(`unable to parse digest: ${t.digest}`));const r=cs(),i={info:new Za(t),error:r};if(t.size===0)return i.data=new ReadableStream({pull(h){h.enqueue(new Uint8Array(0)),h.close()}}),r.resolve(null),Promise.resolve(i);let o;const a=hr();a.orderedConsumer();const l=Lu.create(),u=`$O.${this.name}.C.${t.nuid}`,d=await this.js.subscribe(u,a);return(async()=>{for await(const h of d)h.data.length>0&&(l.update(h.data),o.enqueue(h.data)),h.info.pending===0&&(I1(n,l.digest())?o.close():o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${n}`)),d.unsubscribe())})().then(()=>{r.resolve()}).catch(h=>{o.error(h),r.reject(h)}),i.data=new ReadableStream({start(h){o=h},cancel(){d.unsubscribe()}}),i}linkStore(e,t){if(!(t instanceof Ji))return Promise.reject("bucket required");const n=t,{name:r,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);const o={name:r,options:{link:{bucket:n.name}}};return this._put(o,null)}async link(e,t){const{name:n,error:r}=this._checkNotEmpty(e);if(r)return Promise.reject(r);if(t.deleted)return Promise.reject(new Error("src object is deleted"));if(t.isLink())return Promise.reject(new Error("src object is a link"));const i=await this.rawInfo(e);if(i!==null&&!i.deleted)return Promise.reject(new Error("an object already exists with that name"));const o={bucket:t.bucket,name:t.name},a={name:n,bucket:t.bucket,options:{link:o}};await this.js.publish(this._metaSubject(e),JSON.stringify(a));const l=await this.info(e);return Promise.resolve(l)}async delete(e){const t=await this.rawInfo(e);if(t===null)return Promise.resolve({purged:0,success:!1});t.deleted=!0,t.size=0,t.chunks=0,t.digest="";const n=wn(),r=Kn();return r.set(Hs.RollupHdr,Hs.RollupValueSubject),await this.js.publish(this._metaSubject(t.name),n.encode(t),{headers:r}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(t.nuid)})}async update(e,t={}){const n=await this.rawInfo(e);if(n===null)return Promise.reject(new Error("object not found"));if(n.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));t.name=t.name??n.name;const{name:r,error:i}=this._checkNotEmpty(t.name);if(i)return Promise.reject(i);if(e!==t.name){const l=await this.info(t.name);if(l&&!l.deleted)return Promise.reject(new Error("an object already exists with that name"))}t.name=r;const o=Object.assign({},n,Qu(t)),a=await this.js.publish(this._metaSubject(o.name),JSON.stringify(o));return e!==t.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(a)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let t=!1;const n=new Ms,r=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:r})}catch(l){l.code==="404"?(n.push(null),t=!0):n.stop(l)}const i=wn(),o=hr();o.orderedConsumer(),e.includeHistory?o.deliverLastPerSubject():(t=!0,o.deliverNew()),o.callback((l,u)=>{var d;if(l)n.stop(l);else if(u!==null){const h=i.decode(u.data);h.deleted&&e.ignoreDeletes===!0||n.push(h),((d=u.info)==null?void 0:d.pending)!==0||t||(t=!0,n.push(null))}});const a=await this.js.subscribe(r,o);return n._data=a,n.iterClosed.then(()=>{a.unsubscribe()}),a.closed.then(()=>{n.stop()}).catch(l=>{n.stop(l)}),n}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${li.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=(Uo(t=this.name),`${fl}${t}`)}catch(i){return Promise.reject(i)}var t;const n=(e==null?void 0:e.ttl)||0;delete e.ttl;const r=Object.assign({max_age:n},e);r.name=this.stream,r.num_replicas=e.replicas??1,r.allow_direct=!0,r.allow_rollup_hdrs=!0,r.discard=eo.New,r.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(r.placement=e.placement),e.metadata&&(r.metadata=e.metadata),typeof e.compression=="boolean"&&(r.compression=e.compression?vr.S2:vr.None);try{await this.jsm.streams.info(r.name)}catch(i){i.message==="stream not found"&&await this.jsm.streams.add(r)}}static async create(e,t,n={}){const r=await e.jetstreamManager(),i=new Ji(t,r,e);return await i.init(n),Promise.resolve(i)}}class gg{constructor(e){p(this,"js");this.js=e}kv(e,t={}){const n=this.js,{ok:r,min:i}=n.nc.features.get(Lt.JS_KV);return r?t.bindOnly?so.bind(this.js,e,t):so.create(this.js,e,t):Promise.reject(new Error(`kv is only supported on servers ${i} or better`))}os(e,t={}){var o;if(typeof((o=crypto==null?void 0:crypto.subtle)==null?void 0:o.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const n=this.js,{ok:r,min:i}=n.nc.features.get(Lt.JS_OBJECTSTORE);return r?Ji.create(this.js,e,t):Promise.reject(new Error(`objectstore is only supported on servers ${i} or better`))}}class vl extends bo{constructor(t,n){super(t,n);p(this,"consumers");p(this,"streams");p(this,"consumerAPI");p(this,"streamAPI");this.consumerAPI=new la(t,n),this.streamAPI=new gl(t,n),this.consumers=new Sc(this.consumerAPI),this.streams=new fg(this.streamAPI)}jetstreamManager(t){t===void 0&&(t=this.opts.checkAPI);const n=Object.assign({},this.opts,{checkAPI:t});return this.nc.jetstreamManager(n)}get apiPrefix(){return this.prefix}get views(){return new gg(this)}async publish(t,n=rn,r){(r=r||{}).expect=r.expect||{};const i=(r==null?void 0:r.headers)||Kn();r&&(r.msgID&&i.set($n.MsgIdHdr,r.msgID),r.expect.lastMsgID&&i.set($n.ExpectedLastMsgIdHdr,r.expect.lastMsgID),r.expect.streamName&&i.set($n.ExpectedStreamHdr,r.expect.streamName),typeof r.expect.lastSequence=="number"&&i.set($n.ExpectedLastSeqHdr,`${r.expect.lastSequence}`),typeof r.expect.lastSubjectSequence=="number"&&i.set($n.ExpectedLastSubjectSequenceHdr,`${r.expect.lastSubjectSequence}`));const o=r.timeout||this.timeout,a={};o&&(a.timeout=o),r&&(a.headers=i);let l,{retries:u,retry_delay:d}=r;u=u||1,d=d||250;for(let v=0;v<u;v++)try{l=await this.nc.request(t,n,a);break}catch(f){if(!(f.code==="503"&&v+1<u))throw f;await Pi(d)}const h=this.parseJsResponse(l);if(h.stream==="")throw Ve.errorForCode(Pe.JetStreamInvalidAck);return h.duplicate=!!h.duplicate&&h.duplicate,h}async pull(t,n,r=0){zs(t),ai(n);let i=this.timeout;r>i&&(i=r);const o={batch:1,no_wait:(r=r<0?0:as(r))===0,expires:r},a=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(o),{noMux:!0,timeout:i}),l=Xr(a);if(l)throw l;return Ki(a,this.timeout)}fetch(t,n,r={}){zs(t),ai(n);let i=null;const o=(r.max_bytes??0)>0;let a=0;const l=o?r.max_bytes:0;let u=null;const d={};if(d.batch=r.batch||1,l){const se=this.nc.features.get(Lt.JS_PULL_MAX_BYTES);if(!se.ok)throw new Error(`max_bytes is only supported on servers ${se.min} or better`);d.max_bytes=l}d.no_wait=r.no_wait||!1,d.no_wait&&d.expires&&(d.expires=0);const h=r.expires||0;if(h&&(d.expires=as(h)),h===0&&d.no_wait===!1)throw new Error("expires or no_wait is required");const v=r.idle_heartbeat||0;v&&(d.idle_heartbeat=as(v),r.delay_heartbeat===!0&&(d.idle_heartbeat=as(4*v)));const f=new Ms,b=d.batch;let k=0;f.protocolFilterFn=(se,Z=!1)=>!pc(se.msg)||(u==null||u.work(),!1),f.dispatchedFn=se=>{if(se){if(o&&(a+=se.data.length),k++,i&&se.info.pending===0)return;(f.getPending()===1&&se.info.pending===0||b===k||l>0&&a>=l)&&f.stop()}};const z=Hn(this.nc.options.inboxPrefix),L=this.nc.subscribe(z,{max:r.batch,callback:(se,Z)=>{se===null&&(se=Xr(Z)),se!==null?(i&&(i.cancel(),i=null),function(N){return typeof N.code=="string"}(se)?f.stop(Ku(se)===null?void 0:se):f.stop(se)):(u==null||u.work(),f.received++,f.push(Ki(Z,this.timeout)))}});return h&&(i=fi(h),i.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),i=null),u&&u.cancel()})),(async()=>{try{v&&(u=new ml(v,se=>(f.push(()=>{f.err=new Ve(`${ln.IdleHeartbeatMissed}: ${se}`,Pe.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,i!==null&&(i.cancel(),i=null),u&&u.cancel(),f.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`,this.jc.encode(d),{reply:z}),f}async pullSubscribe(t,n=hr()){const r=await this._processOptions(t,n);if(r.ordered)throw new Error("pull subscribers cannot be be ordered");if(r.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const i=r.config.ack_policy;if(i===Es.None||i===Es.All)throw new Error("ack policy for pull consumers must be explicit");const o=this._buildTypedSubscriptionOpts(r),a=new bg(this,r.deliver,o);a.info=r;try{await this._maybeCreateConsumer(r)}catch(l){throw a.unsubscribe(),l}return a}async subscribe(t,n=hr()){const r=await this._processOptions(t,n);if(!r.isBind&&!r.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const i=this._buildTypedSubscriptionOpts(r),o=new dm(this,r.deliver,i);o.info=r;try{await this._maybeCreateConsumer(r)}catch(a){throw o.unsubscribe(),a}return o._maybeSetupHbMonitoring(),o}async _processOptions(t,n=hr()){const r=Iu(n)?n.getOpts():n;if(r.isBind=!!Iu(n)&&n.isBind,r.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},r.ordered){if(r.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},r.config.ack_policy!==Es.NotSet&&r.config.ack_policy!==Es.None)throw new Ve("ordered consumer: ack_policy can only be set to 'none'",Pe.ApiError);if(r.config.durable_name&&r.config.durable_name.length>0)throw new Ve("ordered consumer: durable_name cannot be set",Pe.ApiError);if(r.config.deliver_subject&&r.config.deliver_subject.length>0)throw new Ve("ordered consumer: deliver_subject cannot be set",Pe.ApiError);if(r.config.max_deliver!==void 0&&r.config.max_deliver>1)throw new Ve("ordered consumer: max_deliver cannot be set",Pe.ApiError);if(r.config.deliver_group&&r.config.deliver_group.length>0)throw new Ve("ordered consumer: deliver_group cannot be set",Pe.ApiError);r.config.deliver_subject=Hn(this.nc.options.inboxPrefix),r.config.ack_policy=Es.None,r.config.max_deliver=1,r.config.flow_control=!0,r.config.idle_heartbeat=r.config.idle_heartbeat||as(5e3),r.config.ack_wait=as(792e5),r.config.mem_storage=!0,r.config.num_replicas=1}if(r.config.ack_policy===Es.NotSet&&(r.config.ack_policy=Es.All),r.api=this,r.config=r.config||{},r.stream=r.stream?r.stream:await this.findStream(t),r.attached=!1,r.config.durable_name)try{const i=await this.consumerAPI.info(r.stream,r.config.durable_name);if(i){if(i.config.filter_subject&&i.config.filter_subject!==t)throw new Error("subject does not match consumer");const o=r.config.deliver_group??"";if(o===""&&i.push_bound===!0)throw new Error("duplicate subscription");const a=i.config.deliver_group??"";if(o!==a)throw a===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${a}'`);r.last=i,r.config=i.config,r.attached=!0,r.config.durable_name||(r.name=i.name)}}catch(i){if(i.code!=="404")throw i}return r.attached||r.config.filter_subject!==void 0||r.config.filter_subjects!==void 0||(r.config.filter_subject=t),r.deliver=r.config.deliver_subject||Hn(this.nc.options.inboxPrefix),r}_buildTypedSubscriptionOpts(t){const n={};return n.adapter=function(r,i){return r?function(o){return(a,l)=>{if(a)return[a,null];const u=Xr(l);return u!==null?[Ku(u),null]:[null,Ki(l,o)]}}(i):function(o){return(a,l)=>a||(a=Xr(l))?[a,null]:[null,Ki(l,o)]}(i)}(t.callbackFn===void 0,this.timeout),n.ingestionFilterFn=vl.ingestionFn(t.ordered),n.protocolFilterFn=(r,i=!1)=>{const o=r;return!mc(o.msg)||(i||o.msg.respond(),!1)},t.mack||t.config.ack_policy===Es.None||(n.dispatchedFn=wg),t.callbackFn&&(n.callback=t.callbackFn),n.max=t.max||0,n.queue=t.queue,n}async _maybeCreateConsumer(t){if(t.attached)return;if(t.isBind)throw new Error(`unable to bind - durable consumer ${t.config.durable_name} doesn't exist in ${t.stream}`);t.config=Object.assign({deliver_policy:fs.All,ack_policy:Es.Explicit,ack_wait:as(3e4),replay_policy:ci.Instant},t.config);const n=await this.consumerAPI.add(t.stream,t.config);if(Array.isArray(t.config.filter_subjects&&!Array.isArray(n.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");t.name=n.name,t.config=n.config,t.last=n}static ingestionFn(t){return(n,r)=>{var a;const i=r;if(!n)return{ingest:!1,protocol:!1};const o=n;if(Xr(o.msg)||((a=i.monitor)==null||a.work()),pc(o.msg)){const l=!t||i._checkHbOrderConsumer(o.msg);return t||i.info.flow_control.heartbeat_count++,{ingest:l,protocol:!0}}return mc(o.msg)?(i.info.flow_control.fc_count++,{ingest:!0,protocol:!0}):{ingest:!t||i._checkOrderedConsumer(n),protocol:!1}}}}class _l{constructor(e){p(this,"options");p(this,"protocol");p(this,"draining");p(this,"listeners");p(this,"_services");this.draining=!1,this.options=Z1(e),this.listeners=[]}static connect(e={}){return new Promise((t,n)=>{const r=new _l(e);da.connect(r.options,r).then(i=>{r.protocol=i,async function(){for await(const o of i.status())r.listeners.forEach(a=>{a.push(o)})}(),t(r)}).catch(i=>{n(i)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,t,n){if(this.isClosed())throw Ve.errorForCode(Pe.ConnectionClosed);if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw Ve.errorForCode(Pe.ConnectionDraining);if((e=e||"").length===0)throw Ve.errorForCode(Pe.BadSubject)}publish(e,t,n){this._check(e,!1,!0),this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return!!e.reply&&(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0)}subscribe(e,t={}){this._check(e,!0,!1);const n=new cm(this.protocol,e,t);return this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);const r=e;r.max=n,n&&(r.max=n+r.received),this.protocol.resub(r,t)}requestMany(e,t=rn,n={maxWait:1e3,maxMessages:-1}){const r=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(l){return Promise.reject(l)}if(n.strategy=n.strategy||bn.Timer,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(new Ve("timeout",Pe.InvalidOption));const i=new Ms;function o(l){i.push(()=>{i.stop(l)})}function a(l,u){l||u===null?o(l===null?void 0:l):i.push(u)}if(n.noMux){const l=r?new Error().stack:null;let u=typeof n.maxMessages=="number"&&n.maxMessages>0?n.maxMessages:-1;const d=this.subscribe(Hn(this.options.inboxPrefix),{callback:(b,k)=>{var z,L;if(((z=k==null?void 0:k.data)==null?void 0:z.length)===0&&((L=k==null?void 0:k.headers)==null?void 0:L.status)===Pe.NoResponders&&(b=Ve.errorForCode(Pe.NoResponders)),b)return l&&(b.stack+=`
24
-
25
- ${l}`),void h(b);a(null,k),n.strategy===bn.Count&&(u--,u===0&&h()),n.strategy===bn.JitterTimer&&(f(),v=setTimeout(()=>{h()},300)),n.strategy===bn.SentinelMsg&&k&&k.data.length===0&&h()}});d.requestSubject=e,d.closed.then(()=>{o()}).catch(b=>{i.stop(b)});const h=b=>{b&&i.push(()=>{throw b}),f(),d.drain().then(()=>{o()}).catch(k=>{o()})};i.iterClosed.then(()=>{f(),d==null||d.unsubscribe()}).catch(b=>{f(),d==null||d.unsubscribe()});try{this.publish(e,t,{reply:d.getSubject()})}catch(b){h(b)}let v=setTimeout(()=>{h()},n.maxWait);const f=()=>{v&&clearTimeout(v)}}else{const l=n;l.callback=a,i.iterClosed.then(()=>{u.cancel()}).catch(d=>{u.cancel(d)});const u=new O1(this.protocol.muxSubscriptions,e,l);this.protocol.request(u);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:n.headers})}catch(d){u.cancel(d)}}return Promise.resolve(i)}request(e,t,n={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(i){return Promise.reject(i)}const r=!this.protocol.options.noAsyncTraces;if(n.timeout=n.timeout||1e3,n.timeout<1)return Promise.reject(new Ve("timeout",Pe.InvalidOption));if(!n.noMux&&n.reply)return Promise.reject(new Ve("reply can only be used with noMux",Pe.InvalidOption));if(n.noMux){const i=n.reply?n.reply:Hn(this.options.inboxPrefix),o=cs(),a=r?new Error:null,l=this.subscribe(i,{max:1,timeout:n.timeout,callback:(u,d)=>{u?(a&&u.code!==Pe.Timeout&&(u.stack+=`
26
-
27
- ${a.stack}`),l.unsubscribe(),o.reject(u)):(u=tm(d))?(a&&(u.stack+=`
28
-
29
- ${a.stack}`),o.reject(u)):o.resolve(d)}});return l.requestSubject=e,this.protocol.publish(e,t,{reply:i,headers:n.headers}),o}{const i=new rm(this.protocol.muxSubscriptions,e,n,r);this.protocol.request(i);try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${i.token}`,headers:n.headers})}catch(a){i.cancel(a)}const o=Promise.race([i.timer,i.deferred]);return o.catch(()=>{i.cancel()}),o}}flush(){return this.isClosed()?Promise.reject(Ve.errorForCode(Pe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ve.errorForCode(Pe.ConnectionClosed)):this.isDraining()?Promise.reject(Ve.errorForCode(Pe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ms;return e.iterClosed.then(()=>{const t=this.listeners.indexOf(e);this.listeners.splice(t,1)}),this.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((e,t)=>e==="time"?new Date(Date.parse(t)):t)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(e={}){const t=new pg(this,e);if(e.checkAPI!==!1)try{await t.getAccountInfo()}catch(n){const r=n;throw r.code===Pe.NoResponders&&(r.code=Pe.JetStreamNotEnabled),r}return t}jetstream(e={}){return new vl(this,e)}getServerVersion(){const e=this.info;return e?Or(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ve.errorForCode(Pe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new vg(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ve.errorForCode(Pe.ConnectionClosed)):this.isDraining()?Promise.reject(Ve.errorForCode(Pe.ConnectionDraining)):this.protocol.reconnect()}}class vg{constructor(e){p(this,"nc");this.nc=e}add(e){try{return new wo(this.nc,e).start()}catch(t){return Promise.reject(t)}}client(e,t){return new eg(this.nc,e,t)}}class _g{constructor(e,t,n){p(this,"bucket");p(this,"sm");p(this,"prefixLen");this.bucket=e,this.prefixLen=t,this.sm=n}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(ha)||"PUT"}get length(){const e=this.sm.header.get(Hs.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yg{constructor(e,t,n){p(this,"bucket");p(this,"key");p(this,"sm");this.bucket=e,this.key=t,this.sm=n}get value(){return this.sm.data}get created(){return new Date(dl(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(ha))||"PUT"}get delta(){return this.sm.info.pending}get length(){var t;const e=((t=this.sm.headers)==null?void 0:t.get(Hs.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class dm extends F1{constructor(t,n,r){super(t.nc,n,r);p(this,"js");p(this,"monitor");this.js=t,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(t){this.sub.info=t}get info(){return this.sub.info}_resetOrderedConsumer(t){if(this.info===null||this.sub.isClosed())return;const n=Hn(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,n);const r=this.info;r.config.name=gr.next(),r.ordered_consumer_sequence.delivery_seq=0,r.flow_control.heartbeat_count=0,r.flow_control.fc_count=0,r.flow_control.consumer_restarts++,r.deliver=n,r.config.deliver_subject=n,r.config.deliver_policy=fs.StartSequence,r.config.opt_start_seq=t;const i={};i.stream_name=this.info.stream,i.config=r.config;const o=`${r.api.prefix}.CONSUMER.CREATE.${r.stream}`;this.js._request(o,i,{retries:-1}).then(a=>{const l=a;this.sub.info.last=l,this.info.config=l.config,this.info.name=l.name}).catch(a=>{const l=new Ve(`unable to recreate ordered consumer ${r.stream} at seq ${t}`,Pe.RequestError,a);this.sub.callback(l,{})})}_maybeSetupHbMonitoring(){var n,r;const t=((r=(n=this.info)==null?void 0:n.config)==null?void 0:r.idle_heartbeat)||0;t&&this._setupHbMonitoring(dl(t))}_setupHbMonitoring(t,n=0){const r={cancelAfter:0,maxOut:2};n&&(r.cancelAfter=n);const i=this.sub;this.monitor=new ml(t,o=>{var u,d,h,v;const a=function(f,b,k){const z=Kn(f,b),L=new hl({hdr:1,sid:0,size:0},rn,{});return L._headers=z,L._subject=k,L}(409,`${ln.IdleHeartbeatMissed}: ${o}`,this.sub.subject);if((u=this.info)==null?void 0:u.ordered){if(!this.js.nc.protocol.connected)return!1;const f=((h=(d=this.info)==null?void 0:d.ordered_consumer_sequence)==null?void 0:h.stream_seq)||0;return this._resetOrderedConsumer(f+1),(v=this.monitor)==null||v.restart(),!1}return this.sub.callback(null,a),!i.noIterator},r)}_checkHbOrderConsumer(t){const n=t.headers.get(Hs.ConsumerStalledHdr);n!==""&&this.js.nc.publish(n);const r=parseInt(t.headers.get(Hs.LastConsumerSeqHdr),10),i=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,r!==i.delivery_seq&&this._resetOrderedConsumer(i.stream_seq+1),!1}_checkOrderedConsumer(t){const n=this.info.ordered_consumer_sequence,r=t.info.streamSequence,i=t.info.deliverySequence;return i!=n.delivery_seq+1?(this._resetOrderedConsumer(n.stream_seq+1),!1):(n.delivery_seq=i,n.stream_seq=r,!0)}async destroy(){this.isClosed()||await this.drain();const t=this.sub.info,n=t.config.durable_name||t.name,r=`${t.api.prefix}.CONSUMER.DELETE.${t.stream}.${n}`;await t.api._request(r)}async consumerInfo(){const t=this.sub.info,n=t.config.durable_name||t.name,r=`${t.api.prefix}.CONSUMER.INFO.${t.stream}.${n}`,i=await t.api._request(r);return t.last=i,i}}class bg extends dm{constructor(e,t,n){super(e,t,n)}pull(e={batch:1}){const{stream:t,config:n,name:r}=this.sub.info,i=n.durable_name??r,o={};if(o.batch=e.batch||1,o.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Lt.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);o.max_bytes=e.max_bytes}let a=0;e.expires&&e.expires>0&&(a=e.expires,o.expires=as(a));let l=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(l=e.idle_heartbeat,o.idle_heartbeat=as(l)),l&&a===0)throw new Error("idle_heartbeat requires expires");if(l>a)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),a&&l&&(this.monitor?this.monitor._change(l,a):this._setupHbMonitoring(l,a));const u=this.info.api,d=`${u.prefix}.CONSUMER.MSG.NEXT.${t}.${i}`,h=this.sub.subject;u.nc.publish(d,u.jc.encode(o),{reply:h})}}}function Ku(s){if(s!==null)switch(s.code){case Pe.JetStream404NoMessages:case Pe.JetStream408RequestTimeout:return null;case Pe.JetStream409:return function(e){return e.code!==Pe.JetStream409?!1:[ln.MaxBatchExceeded,ln.MaxExpiresExceeded,ln.MaxBytesExceeded,ln.MaxMessageSizeExceeded,ln.PushConsumer,ln.IdleHeartbeatMissed,ln.ConsumerDeleted].find(t=>e.message.indexOf(t)!==-1)!==void 0}(s)?s:null;default:return s}return null}function wg(s){s&&s.ack()}class xg{constructor(e,t){p(this,"msg");p(this,"di");p(this,"didAck");p(this,"timeout");this.msg=e,this.didAck=!1,this.timeout=t}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=function(e){const t=e.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const n={};return n.domain=t[2]==="_"?"":t[2],n.account_hash=t[3],n.stream=t[4],n.consumer=t[5],n.deliveryCount=parseInt(t[6],10),n.redeliveryCount=n.deliveryCount,n.redelivered=n.deliveryCount>1,n.streamSequence=parseInt(t[7],10),n.deliverySequence=parseInt(t[8],10),n.timestampNanos=parseInt(t[9],10),n.pending=parseInt(t[10],10),n}(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===ji[0]&&e[1]===ji[1]&&e[2]===ji[2]&&e[3]===ji[3]}async ackAck(e){var n;(e=e||{}).timeout=e.timeout||this.timeout;const t=cs();if(this.didAck)t.resolve(!1);else if(this.didAck=!0,this.msg.reply){const r=this.msg.publisher,i=!((n=r.options)!=null&&n.noAsyncTraces),o=new rm(r.muxSubscriptions,this.msg.reply,{timeout:e.timeout},i);r.request(o);try{r.publish(this.msg.reply,Hu,{reply:`${r.muxSubscriptions.baseInbox}${o.token}`})}catch(a){o.cancel(a)}try{await Promise.race([o.timer,o.deferred]),t.resolve(!0)}catch(a){o.cancel(a),t.reject(a)}}else t.resolve(!1);return t}ack(){this.doAck(Hu)}nak(e){let t=ag;e&&(t=Tu().encode(`-NAK ${JSON.stringify({delay:as(e)})}`)),this.doAck(t)}working(){this.doAck(ji)}next(e,t={batch:1}){const n={};n.batch=t.batch||1,n.no_wait=t.no_wait||!1,t.expires&&t.expires>0&&(n.expires=as(t.expires));const r=wn().encode(n),i=gi.concat(cg,ug,r),o=e?{reply:e}:void 0;this.msg.respond(i,o)}term(e=""){let t=lg;(e==null?void 0:e.length)>0&&(t=Tu().encode(`+TERM ${e}`)),this.doAck(t)}json(){return this.msg.json()}string(){return this.msg.string()}}class Sg{constructor(){p(this,"version");p(this,"lang");p(this,"closeError");p(this,"connected");p(this,"done");p(this,"socket");p(this,"options");p(this,"socketClosed");p(this,"encrypted");p(this,"peeked");p(this,"yields");p(this,"signal");p(this,"closedNotification");this.version="1.30.3",this.lang="nats.ws",this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=cs(),this.closedNotification=cs()}async connect(e,t){const n=cs();if(t.tls)return n.reject(new Ve("tls",Pe.InvalidOption)),n;this.options=t;const r=e.src;if(t.wsFactory){const{socket:i,encrypted:o}=await t.wsFactory(e.src,t);this.socket=i,this.encrypted=o}else this.encrypted=r.indexOf("wss://")===0,this.socket=new WebSocket(r);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=i=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(i.data)),this.peeked)return void this.signal.resolve();const o=gi.concat(...this.yields),a=q1(o);if(a!==""){const l=G1.exec(a);if(!l)return t.debug&&console.error("!!!",Mo(o)),void n.reject(new Error("unexpected response from server"));try{(function(u,d){const{proto:h,tls_required:v,tls_available:f}=u;if((h===void 0||h<1)&&d.noEcho)throw new Ve("noEcho",Pe.ServerOptionNotAvailable);const b=v||f||!1;if(d.tls&&!b)throw new Ve("tls",Pe.ServerOptionNotAvailable)})(JSON.parse(l[1]),this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(u){return void n.reject(u)}}},this.socket.onclose=i=>{if(this.isDiscarded())return;let o;this.socketClosed=!0,this.done||(i.wasClean||(o=new Error(i.reason)),this._closed(o))},this.socket.onerror=i=>{if(this.isDiscarded())return;const o=i,a=new Ve(o.message,Pe.Unknown,new Error(o.error));n.reject(a)},n}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Pi(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}t&&this.closedNotification.resolve(e)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${Mo(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=cs())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{return this.socket.send(e.buffer),void(this.options.debug&&console.info(`< ${Mo(e)}`))}catch(t){this.options.debug&&console.error(`!!! ${Mo(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return!!this.done&&(this.discard(),!0)}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function Cg(s,e){/^(.*:\/\/)(.*)/.test(s)||(s=typeof e=="boolean"?`${e===!0?"https":"http"}://${s}`:`https://${s}`);let t=new URL(s);const n=t.protocol.toLowerCase();let r,i;n==="ws:"&&(e=!1),n==="wss:"&&(e=!0),n!=="https:"&&n!=="http"&&(s=s.replace(/^(.*:\/\/)(.*)/gm,"$2"),t=new URL(`http://${s}`));const o=t.hostname,a=t.pathname,l=t.search||"";switch(n){case"http:":case"ws:":case"nats:":i=t.port||"80",r="ws:";break;case"https:":case"wss:":case"tls:":i=t.port||"443",r="wss:";break;default:i=t.port||e===!0?"443":"80",r=e===!0?"wss:":"ws:"}return`${r}//${o}:${i}${a}${l}`}function kg(s={}){return function(e){nn=e}({defaultPort:443,urlParseFn:Cg,factory:()=>new Sg}),_l.connect(s)}const Dn={HEALTH:{PING:"health.ping",PONG:"health.pong"},SERVER:{STATUS:"server.status",BROADCAST:"server.broadcast"},PLUGIN:{REGISTER:"plugin.register",UNREGISTER:"plugin.unregister",STATUS:"plugin.status"},SERVICE:{REGISTER:"service.register",UNREGISTER:"service.unregister",STATUS:"service.status"},METRICS:{UPDATE:"metrics.update"}},Vo="running",kc="stopping",Yi="stopped",qi={REQUEST:"request",RESPONSE:"response",BROADCAST:"broadcast",RPC_REQUEST:"rpcrequest",RPC_RESPONSE:"rpcresponse",RPC_STREAM_REQUEST:"rpcstreamrequest"},Ga={CONNECTION:5e3,REQUEST:5e3,RPC:5e3},Eg={METRICS:6e4},Zu={MAX_RECONNECT_ATTEMPTS:-1,DELAY:2e3},Ag={TTL:3e4},Gu={requests:{total:0,active:0,errors:0,timings:new Map,inWindow:{count:0,errors:0,responseTimes:[],startTime:Date.now()}},messages:{published:0,received:0,errors:0},rpc:{total:0,active:0,errors:0},subscriptions:{active:0,messageHandlers:0,requestHandlers:0,rpcHandlers:0}},Yn=Ti("camera:ui:metrics");class Mg{constructor(){p(this,"startTime",Date.now());p(this,"metricsWindow",Ag.TTL);p(this,"metrics",{...Gu})}trackRequestStart(e){Yn("Tracking request start",e),this.metrics.requests.active++,this.metrics.requests.total++,this.metrics.requests.timings.set(e,Date.now()),this.metrics.requests.inWindow.count++}trackRequestEnd(e,t){Yn("Tracking request end",e);const n=this.metrics.requests.timings.get(e);n&&(this.metrics.requests.inWindow.responseTimes.push(Date.now()-n),this.metrics.requests.timings.delete(e)),this.metrics.requests.active--,t&&(this.metrics.requests.errors++,this.metrics.requests.inWindow.errors++)}trackPublish(){Yn("Tracking message publish"),this.metrics.messages.published++}trackReceive(){Yn("Tracking message receive"),this.metrics.messages.received++}trackMessageError(){Yn("Tracking message error"),this.metrics.messages.errors++}trackRPCStart(){Yn("Tracking RPC start"),this.metrics.rpc.active++,this.metrics.rpc.total++}trackRPCEnd(e){Yn("Tracking RPC end"),this.metrics.rpc.active--,e&&this.metrics.rpc.errors++}trackSubscriptionChange(e,t){switch(Yn("Tracking subscription change",e,t),t){case"message":this.metrics.subscriptions.messageHandlers=Math.max(0,this.metrics.subscriptions.messageHandlers+e);break;case"request":this.metrics.subscriptions.requestHandlers=Math.max(0,this.metrics.subscriptions.requestHandlers+e);break;case"rpc":case"generator":this.metrics.subscriptions.rpcHandlers=Math.max(0,this.metrics.subscriptions.rpcHandlers+e)}this.metrics.subscriptions.active=this.metrics.subscriptions.messageHandlers+this.metrics.subscriptions.requestHandlers+this.metrics.subscriptions.rpcHandlers}getMetrics(){this.cleanOldMetrics();const e=Date.now(),t=(e-this.metrics.requests.inWindow.startTime)/1e3,n=t>0?this.metrics.requests.inWindow.count/Math.max(1,t):0,r=this.metrics.requests.inWindow.responseTimes.length>0?this.metrics.requests.inWindow.responseTimes.reduce((i,o)=>i+o,0)/this.metrics.requests.inWindow.responseTimes.length:0;return{timestamp:e,startTime:this.startTime,requests:{total:this.metrics.requests.total,active:this.metrics.requests.active,errors:this.metrics.requests.errors,perSecond:Number.isFinite(n)?n:0,avgResponseTime:r},messages:{published:this.metrics.messages.published,received:this.metrics.messages.received,errors:this.metrics.messages.errors},rpc:{total:this.metrics.rpc.total,active:this.metrics.rpc.active,errors:this.metrics.rpc.errors},subscriptions:{active:this.metrics.subscriptions.active,messageHandlers:this.metrics.subscriptions.messageHandlers,requestHandlers:this.metrics.subscriptions.requestHandlers,rpcHandlers:this.metrics.subscriptions.rpcHandlers}}}resetMetrics(){this.metrics={...Gu}}cleanOldMetrics(){const e=Date.now();e-this.metrics.requests.inWindow.startTime>=this.metricsWindow&&(this.metrics.requests.inWindow={count:0,errors:0,responseTimes:[],startTime:e})}}var Ec,Ne,un;try{Ec=new TextDecoder}catch{}var Q=0,It,ar,Rs,zn,Mt,Wt={},cn=0,Pn=0,Gs=[],Wu={useRecords:!1,mapsAsObjects:!0};class hm{}const mm=new hm;mm.name="MessagePack 0xC1";var Ju,mr=!1,pm=2;try{new Function("")}catch{pm=1/0}class vi{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,e.structures||e.useRecords==0||(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(Ne)return bm(()=>(Mc(),this?this.unpack(e,t):vi.prototype.unpack.call(Wu,e,t)));e.buffer||e.constructor!==ArrayBuffer||(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(un=t.end||e.length,Q=t.start||0):(Q=0,un=t>-1?t:e.length),Pn=0,ar=null,Rs=null,Ne=e;try{Mt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw Ne=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof vi){if(Wt=this,this.structures)return It=this.structures,Ro(t);(!It||It.length>0)&&(It=[])}else Wt=Wu,(!It||It.length>0)&&(It=[]);return Ro(t)}unpackMultiple(e,t){let n,r=0;try{mr=!0;let i=e.length,o=this?this.unpack(e,i):Ho.unpack(e,i);if(!t){for(n=[o];Q<i;)r=Q,n.push(Ro());return n}if(t(o,r,Q)===!1)return;for(;Q<i;)if(r=Q,t(Ro(),r,Q)===!1)return}catch(i){throw i.lastPosition=r,i.values=n,i}finally{mr=!1,Mc()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,r=e.length;n<r;n++){let i=e[n];i&&(i.isShared=!0,n>=32&&(i.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function Ro(s){try{if(!Wt.trusted&&!mr){let t=It.sharedLength||0;t<It.length&&(It.length=t)}let e;if(Wt.randomAccessStructure&&Ne[Q]<64&&Ne[Q]>=32&&Ju?(e=Ju(Ne,Q,un,Wt),Ne=null,s&&s.lazy||!e||(e=e.toJSON()),Q=un):e=gs(),Rs&&(Q=Rs.postBundlePosition,Rs=null),mr&&(It.restoreStructures=null),Q==un)It&&It.restoreStructures&&Yu(),It=null,Ne=null,zn&&(zn=null);else{if(Q>un)throw new Error("Unexpected end of MessagePack data");if(!mr){let t;try{t=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw It&&It.restoreStructures&&Yu(),Mc(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||Q>un)&&(e.incomplete=!0),e}}function Yu(){for(let s in It.restoreStructures)It[s]=It.restoreStructures[s];It.restoreStructures=null}function gs(){let s=Ne[Q++];if(s<160){if(s<128){if(s<64)return s;{let e=It[63&s]||Wt.getStructures&&fm()[63&s];return e?(e.read||(e.read=yl(e,63&s)),e.read()):s}}if(s<144){if(s-=128,Wt.mapsAsObjects){let e={};for(let t=0;t<s;t++){let n=vm();n==="__proto__"&&(n="__proto_"),e[n]=gs()}return e}{let e=new Map;for(let t=0;t<s;t++)e.set(gs(),gs());return e}}{s-=144;let e=new Array(s);for(let t=0;t<s;t++)e[t]=gs();return Wt.freezeData?Object.freeze(e):e}}if(s<192){let e=s-160;if(Pn>=Q)return ar.slice(Q-cn,(Q+=e)-cn);if(Pn==0&&un<140){let t=e<16?bl(e):gm(e);if(t!=null)return t}return Ac(e)}{let e;switch(s){case 192:return null;case 193:return Rs?(e=gs(),e>0?Rs[1].slice(Rs.position1,Rs.position1+=e):Rs[0].slice(Rs.position0,Rs.position0-=e)):mm;case 194:return!1;case 195:return!0;case 196:if(e=Ne[Q++],e===void 0)throw new Error("Unexpected end of buffer");return Wa(e);case 197:return e=Mt.getUint16(Q),Q+=2,Wa(e);case 198:return e=Mt.getUint32(Q),Q+=4,Wa(e);case 199:return xr(Ne[Q++]);case 200:return e=Mt.getUint16(Q),Q+=2,xr(e);case 201:return e=Mt.getUint32(Q),Q+=4,xr(e);case 202:if(e=Mt.getFloat32(Q),Wt.useFloat32>2){let t=wl[(127&Ne[Q])<<1|Ne[Q+1]>>7];return Q+=4,(t*e+(e>0?.5:-.5)|0)/t}return Q+=4,e;case 203:return e=Mt.getFloat64(Q),Q+=8,e;case 204:return Ne[Q++];case 205:return e=Mt.getUint16(Q),Q+=2,e;case 206:return e=Mt.getUint32(Q),Q+=4,e;case 207:return Wt.int64AsType==="number"?(e=4294967296*Mt.getUint32(Q),e+=Mt.getUint32(Q+4)):Wt.int64AsType==="string"?e=Mt.getBigUint64(Q).toString():Wt.int64AsType==="auto"?(e=Mt.getBigUint64(Q),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=Mt.getBigUint64(Q),Q+=8,e;case 208:return Mt.getInt8(Q++);case 209:return e=Mt.getInt16(Q),Q+=2,e;case 210:return e=Mt.getInt32(Q),Q+=4,e;case 211:return Wt.int64AsType==="number"?(e=4294967296*Mt.getInt32(Q),e+=Mt.getUint32(Q+4)):Wt.int64AsType==="string"?e=Mt.getBigInt64(Q).toString():Wt.int64AsType==="auto"?(e=Mt.getBigInt64(Q),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=Mt.getBigInt64(Q),Q+=8,e;case 212:if(e=Ne[Q++],e==114)return rd(63&Ne[Q++]);{let t=Gs[e];if(t)return t.read?(Q++,t.read(gs())):t.noBuffer?(Q++,t()):t(Ne.subarray(Q,++Q));throw new Error("Unknown extension "+e)}case 213:return e=Ne[Q],e==114?(Q++,rd(63&Ne[Q++],Ne[Q++])):xr(2);case 214:return xr(4);case 215:return xr(8);case 216:return xr(16);case 217:return e=Ne[Q++],Pn>=Q?ar.slice(Q-cn,(Q+=e)-cn):Tg(e);case 218:return e=Mt.getUint16(Q),Pn>=(Q+=2)?ar.slice(Q-cn,(Q+=e)-cn):Pg(e);case 219:return e=Mt.getUint32(Q),Pn>=(Q+=4)?ar.slice(Q-cn,(Q+=e)-cn):Rg(e);case 220:return e=Mt.getUint16(Q),Q+=2,ed(e);case 221:return e=Mt.getUint32(Q),Q+=4,ed(e);case 222:return e=Mt.getUint16(Q),Q+=2,td(e);case 223:return e=Mt.getUint32(Q),Q+=4,td(e);default:if(s>=224)return s-256;if(s===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+s)}}}const $g=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function yl(s,e){function t(){if(t.count++>pm){let r=s.read=new Function("r","return function(){return "+(Wt.freezeData?"Object.freeze":"")+"({"+s.map(i=>i==="__proto__"?"__proto_:r()":$g.test(i)?i+":r()":"["+JSON.stringify(i)+"]:r()").join(",")+"})}")(gs);return s.highByte===0&&(s.read=Xu(e,s.read)),r()}let n={};for(let r=0,i=s.length;r<i;r++){let o=s[r];o==="__proto__"&&(o="__proto_"),n[o]=gs()}return Wt.freezeData?Object.freeze(n):n}return t.count=0,s.highByte===0?Xu(e,t):t}const Xu=(s,e)=>function(){let t=Ne[Q++];if(t===0)return e();let n=s<32?-(s+(t<<5)):s+(t<<5),r=It[n]||fm()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=yl(r,s)),r.read()};function fm(){let s=bm(()=>(Ne=null,Wt.getStructures()));return It=Wt._mergeStructures(s,It)}var Ac=xo,Tg=xo,Pg=xo,Rg=xo;function xo(s){let e;if(s<16&&(e=bl(s)))return e;if(s>64&&Ec)return Ec.decode(Ne.subarray(Q,Q+=s));const t=Q+s,n=[];for(e="";Q<t;){const r=Ne[Q++];if(128&r)if((224&r)==192){const i=63&Ne[Q++];n.push((31&r)<<6|i)}else if((240&r)==224){const i=63&Ne[Q++],o=63&Ne[Q++];n.push((31&r)<<12|i<<6|o)}else if((248&r)==240){let i=(7&r)<<18|(63&Ne[Q++])<<12|(63&Ne[Q++])<<6|63&Ne[Q++];i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i)}else n.push(r);else n.push(r);n.length>=4096&&(e+=ks.apply(String,n),n.length=0)}return n.length>0&&(e+=ks.apply(String,n)),e}function ed(s){let e=new Array(s);for(let t=0;t<s;t++)e[t]=gs();return Wt.freezeData?Object.freeze(e):e}function td(s){if(Wt.mapsAsObjects){let e={};for(let t=0;t<s;t++){let n=vm();n==="__proto__"&&(n="__proto_"),e[n]=gs()}return e}{let e=new Map;for(let t=0;t<s;t++)e.set(gs(),gs());return e}}var ks=String.fromCharCode;function gm(s){let e=Q,t=new Array(s);for(let n=0;n<s;n++){const r=Ne[Q++];if((128&r)>0)return void(Q=e);t[n]=r}return ks.apply(String,t)}function bl(s){if(s<4){if(s<2){if(s===0)return"";{let e=Ne[Q++];return(128&e)>1?void(Q-=1):ks(e)}}{let e=Ne[Q++],t=Ne[Q++];if((128&e)>0||(128&t)>0)return void(Q-=2);if(s<3)return ks(e,t);let n=Ne[Q++];return(128&n)>0?void(Q-=3):ks(e,t,n)}}{let e=Ne[Q++],t=Ne[Q++],n=Ne[Q++],r=Ne[Q++];if((128&e)>0||(128&t)>0||(128&n)>0||(128&r)>0)return void(Q-=4);if(s<6){if(s===4)return ks(e,t,n,r);{let i=Ne[Q++];return(128&i)>0?void(Q-=5):ks(e,t,n,r,i)}}if(s<8){let i=Ne[Q++],o=Ne[Q++];if((128&i)>0||(128&o)>0)return void(Q-=6);if(s<7)return ks(e,t,n,r,i,o);let a=Ne[Q++];return(128&a)>0?void(Q-=7):ks(e,t,n,r,i,o,a)}{let i=Ne[Q++],o=Ne[Q++],a=Ne[Q++],l=Ne[Q++];if((128&i)>0||(128&o)>0||(128&a)>0||(128&l)>0)return void(Q-=8);if(s<10){if(s===8)return ks(e,t,n,r,i,o,a,l);{let u=Ne[Q++];return(128&u)>0?void(Q-=9):ks(e,t,n,r,i,o,a,l,u)}}if(s<12){let u=Ne[Q++],d=Ne[Q++];if((128&u)>0||(128&d)>0)return void(Q-=10);if(s<11)return ks(e,t,n,r,i,o,a,l,u,d);let h=Ne[Q++];return(128&h)>0?void(Q-=11):ks(e,t,n,r,i,o,a,l,u,d,h)}{let u=Ne[Q++],d=Ne[Q++],h=Ne[Q++],v=Ne[Q++];if((128&u)>0||(128&d)>0||(128&h)>0||(128&v)>0)return void(Q-=12);if(s<14){if(s===12)return ks(e,t,n,r,i,o,a,l,u,d,h,v);{let f=Ne[Q++];return(128&f)>0?void(Q-=13):ks(e,t,n,r,i,o,a,l,u,d,h,v,f)}}{let f=Ne[Q++],b=Ne[Q++];if((128&f)>0||(128&b)>0)return void(Q-=14);if(s<15)return ks(e,t,n,r,i,o,a,l,u,d,h,v,f,b);let k=Ne[Q++];return(128&k)>0?void(Q-=15):ks(e,t,n,r,i,o,a,l,u,d,h,v,f,b,k)}}}}}function sd(){let s,e=Ne[Q++];if(e<192)s=e-160;else switch(e){case 217:s=Ne[Q++];break;case 218:s=Mt.getUint16(Q),Q+=2;break;case 219:s=Mt.getUint32(Q),Q+=4;break;default:throw new Error("Expected string")}return xo(s)}function Wa(s){return Wt.copyBuffers?Uint8Array.prototype.slice.call(Ne,Q,Q+=s):Ne.subarray(Q,Q+=s)}function xr(s){let e=Ne[Q++];if(Gs[e]){let t;return Gs[e](Ne.subarray(Q,t=Q+=s),n=>{Q=n;try{return gs()}finally{Q=t}})}throw new Error("Unknown extension type "+e)}var nd=new Array(4096);function vm(){let s=Ne[Q++];if(!(s>=160&&s<192))return Q--,_m(gs());if(s-=160,Pn>=Q)return ar.slice(Q-cn,(Q+=s)-cn);if(!(Pn==0&&un<180))return Ac(s);let e,t=4095&(s<<5^(s>1?Mt.getUint16(Q):s>0?Ne[Q]:0)),n=nd[t],r=Q,i=Q+s-3,o=0;if(n&&n.bytes==s){for(;r<i;){if(e=Mt.getUint32(r),e!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(e=Ne[r++],e!=n[o++]){r=1879048192;break}if(r===i)return Q=r,n.string;i-=3,r=Q}for(n=[],nd[t]=n,n.bytes=s;r<i;)e=Mt.getUint32(r),n.push(e),r+=4;for(i+=3;r<i;)e=Ne[r++],n.push(e);let a=s<16?bl(s):gm(s);return n.string=a??Ac(s)}function _m(s){if(typeof s=="string")return s;if(typeof s=="number"||typeof s=="boolean"||typeof s=="bigint")return s.toString();if(s==null)return s+"";if(Wt.allowArraysInMapKeys&&Array.isArray(s)&&s.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return s.flat().toString();throw new Error("Invalid property type for record: "+typeof s)}const rd=(s,e)=>{let t=gs().map(_m),n=s;e!==void 0&&(s=s<32?-((e<<5)+s):(e<<5)+s,t.highByte=e);let r=It[s];return r&&(r.isShared||mr)&&((It.restoreStructures||(It.restoreStructures=[]))[s]=r),It[s]=t,t.read=yl(t,n),t.read()};Gs[0]=()=>{},Gs[0].noBuffer=!0,Gs[66]=s=>{let e=s.length,t=BigInt(128&s[0]?s[0]-256:s[0]);for(let n=1;n<e;n++)t<<=BigInt(8),t+=BigInt(s[n]);return t};let Ig={Error,TypeError,ReferenceError};Gs[101]=()=>{let s=gs();return(Ig[s[0]]||Error)(s[1],{cause:s[2]})},Gs[105]=s=>{if(Wt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=Mt.getUint32(Q-4);zn||(zn=new Map);let t,n=Ne[Q];t=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&Ne[Q+1]===115?new Set:{};let r={target:t};zn.set(e,r);let i=gs();if(!r.used)return r.target=i;if(Object.assign(t,i),t instanceof Map)for(let[o,a]of i.entries())t.set(o,a);if(t instanceof Set)for(let o of Array.from(i))t.add(o);return t},Gs[112]=s=>{if(Wt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=Mt.getUint32(Q-4),t=zn.get(e);return t.used=!0,t.target},Gs[115]=()=>new Set(gs());const ym=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(s=>s+"Array");let Og=typeof globalThis=="object"?globalThis:window;Gs[116]=s=>{let e=s[0],t=Uint8Array.prototype.slice.call(s,1).buffer,n=ym[e];if(!n){if(e===16)return t;if(e===17)return new DataView(t);throw new Error("Could not find typed array for code "+e)}return new Og[n](t)},Gs[120]=()=>{let s=gs();return new RegExp(s[0],s[1])};const Ng=[];function bm(s){let e=un,t=Q,n=cn,r=Pn,i=ar,o=zn,a=Rs,l=new Uint8Array(Ne.slice(0,un)),u=It,d=It.slice(0,It.length),h=Wt,v=mr,f=s();return un=e,Q=t,cn=n,Pn=r,ar=i,zn=o,Rs=a,Ne=l,mr=v,(It=u).splice(0,It.length,...d),Wt=h,Mt=new DataView(Ne.buffer,Ne.byteOffset,Ne.byteLength),f}function Mc(){Ne=null,zn=null,It=null}Gs[98]=s=>{let e=(s[0]<<24)+(s[1]<<16)+(s[2]<<8)+s[3],t=Q;return Q+=e-s.length,Rs=Ng,(Rs=[sd(),sd()]).position0=0,Rs.position1=0,Rs.postBundlePosition=Q,Q=t,gs()},Gs[255]=s=>s.length==4?new Date(1e3*(16777216*s[0]+(s[1]<<16)+(s[2]<<8)+s[3])):s.length==8?new Date(((s[0]<<22)+(s[1]<<14)+(s[2]<<6)+(s[3]>>2))/1e6+1e3*(4294967296*(3&s[3])+16777216*s[4]+(s[5]<<16)+(s[6]<<8)+s[7])):s.length==12?new Date(((s[0]<<24)+(s[1]<<16)+(s[2]<<8)+s[3])/1e6+1e3*((128&s[4]?-281474976710656:0)+1099511627776*s[6]+4294967296*s[7]+16777216*s[8]+(s[9]<<16)+(s[10]<<8)+s[11])):new Date("invalid");const wl=new Array(147);for(let s=0;s<256;s++)wl[s]=+("1e"+Math.floor(45.15-.30103*s));var Ho=new vi({useRecords:!1});Ho.unpack,Ho.unpackMultiple,Ho.unpack;let Qo,$c,wm,Fg=new Float32Array(1);new Uint8Array(Fg.buffer,0,4);try{Qo=new TextEncoder}catch{}const no=typeof Buffer<"u",Io=no?function(s){return Buffer.allocUnsafeSlow(s)}:Uint8Array,xm=no?Buffer:Uint8Array,id=no?4294967296:2144337920;let re,Di,ss,Ds,Lg,W=0,ds=null;const jg=/[\u0080-\uFFFF]/,Yr=Symbol("record-id");class Sm extends vi{constructor(e){let t,n,r,i;super(e),this.offset=0;let o=xm.prototype.utf8Write?function(w,H){return re.utf8Write(w,H,re.byteLength-H)}:!(!Qo||!Qo.encodeInto)&&function(w,H){return Qo.encodeInto(w,re.subarray(H)).written},a=this;e||(e={});let l=e&&e.sequential,u=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=u?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let h=e.maxOwnStructures;h==null&&(h=u?32:64),this.structures||e.useRecords==0||(this.structures=[]);let v=d>32||h+d>64,f=d+64,b=d+h+64;if(b>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let k=[],z=0,L=0;this.pack=this.encode=function(w,H){if(re||(re=new Io(8192),ss=re.dataView||(re.dataView=new DataView(re.buffer,0,8192)),W=0),Ds=re.length-10,Ds-W<2048?(re=new Io(re.length),ss=re.dataView||(re.dataView=new DataView(re.buffer,0,re.length)),Ds=re.length-10,W=0):W=W+7&2147483640,t=W,H&Ug&&(W+=255&H),i=a.structuredClone?new Map:null,a.bundleStrings&&typeof w!="string"?(ds=[],ds.size=1/0):ds=null,r=a.structures,r){r.uninitialized&&(r=a._mergeStructures(a.getStructures()));let q=r.sharedLength||0;if(q>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let oe=0;oe<q;oe++){let ue=r[oe];if(!ue)continue;let Ce,F=r.transitions;for(let D=0,Y=ue.length;D<Y;D++){let Te=ue[D];Ce=F[Te],Ce||(Ce=F[Te]=Object.create(null)),F=Ce}F[Yr]=oe+64}this.lastNamedStructuresLength=q}l||(r.nextId=q+64)}let J;n&&(n=!1);try{a.randomAccessStructure&&w&&w.constructor&&w.constructor===Object?R(w):N(w);let q=ds;if(ds&&od(t,N,0),i&&i.idsToInsert){let oe=i.idsToInsert.sort((D,Y)=>D.offset>Y.offset?1:-1),ue=oe.length,Ce=-1;for(;q&&ue>0;){let D=oe[--ue].offset+t;D<q.stringsPosition+t&&Ce===-1&&(Ce=0),D>q.position+t?Ce>=0&&(Ce+=6):(Ce>=0&&(ss.setUint32(q.position+t,ss.getUint32(q.position+t)+Ce),Ce=-1),q=q.previous,ue++)}Ce>=0&&q&&ss.setUint32(q.position+t,ss.getUint32(q.position+t)+Ce),W+=6*oe.length,W>Ds&&M(W),a.offset=W;let F=function(D,Y){let Te,He=6*Y.length,ht=D.length-He;for(;Te=Y.pop();){let At=Te.offset,Qe=Te.id;D.copyWithin(At+He,At,ht),He-=6;let ze=At+He;D[ze++]=214,D[ze++]=105,D[ze++]=Qe>>24,D[ze++]=Qe>>16&255,D[ze++]=Qe>>8&255,D[ze++]=255&Qe,ht=At}return D}(re.subarray(t,W),oe);return i=null,F}return a.offset=W,H&Bg?(re.start=t,re.end=W,re):re.subarray(t,W)}catch(q){throw J=q,q}finally{if(r&&(se(),n&&a.saveStructures)){let q=r.sharedLength||0,oe=re.subarray(t,W),ue=Dg(r,a);if(!J)return a.saveStructures(ue,ue.isCompatible)===!1?a.pack(w,H):(a.lastNamedStructuresLength=q,re.length>1073741824&&(re=null),oe)}re.length>1073741824&&(re=null),H&zg&&(W=t)}};const se=()=>{L<10&&L++;let w=r.sharedLength||0;if(r.length>w&&!l&&(r.length=w),z>1e4)r.transitions=null,L=0,z=0,k.length>0&&(k=[]);else if(k.length>0&&!l){for(let H=0,J=k.length;H<J;H++)k[H][Yr]=0;k=[]}},Z=w=>{var H=w.length;H<16?re[W++]=144|H:H<65536?(re[W++]=220,re[W++]=H>>8,re[W++]=255&H):(re[W++]=221,ss.setUint32(W,H),W+=4);for(let J=0;J<H;J++)N(w[J])},N=w=>{W>Ds&&(re=M(W));var H,J=typeof w;if(J==="string"){let q,oe=w.length;if(ds&&oe>=4&&oe<4096){if((ds.size+=oe)>21760){let F,D,Y=(ds[0]?3*ds[0].length+ds[1].length:0)+10;W+Y>Ds&&(re=M(W+Y)),ds.position?(D=ds,re[W]=200,W+=3,re[W++]=98,F=W-t,W+=4,od(t,N,0),ss.setUint16(F+t-3,W-t-F)):(re[W++]=214,re[W++]=98,F=W-t,W+=4),ds=["",""],ds.previous=D,ds.size=0,ds.position=F}let Ce=jg.test(w);return ds[Ce?0:1]+=w,re[W++]=193,void N(Ce?-oe:oe)}q=oe<32?1:oe<256?2:oe<65536?3:5;let ue=3*oe;if(W+ue>Ds&&(re=M(W+ue)),oe<64||!o){let Ce,F,D,Y=W+q;for(Ce=0;Ce<oe;Ce++)F=w.charCodeAt(Ce),F<128?re[Y++]=F:F<2048?(re[Y++]=F>>6|192,re[Y++]=63&F|128):(64512&F)==55296&&(64512&(D=w.charCodeAt(Ce+1)))==56320?(F=65536+((1023&F)<<10)+(1023&D),Ce++,re[Y++]=F>>18|240,re[Y++]=F>>12&63|128,re[Y++]=F>>6&63|128,re[Y++]=63&F|128):(re[Y++]=F>>12|224,re[Y++]=F>>6&63|128,re[Y++]=63&F|128);H=Y-W-q}else H=o(w,W+q);H<32?re[W++]=160|H:H<256?(q<2&&re.copyWithin(W+2,W+1,W+1+H),re[W++]=217,re[W++]=H):H<65536?(q<3&&re.copyWithin(W+3,W+2,W+2+H),re[W++]=218,re[W++]=H>>8,re[W++]=255&H):(q<5&&re.copyWithin(W+5,W+3,W+3+H),re[W++]=219,ss.setUint32(W,H),W+=4),W+=H}else if(J==="number")if(w>>>0===w)w<32||w<128&&this.useRecords===!1||w<64&&!this.randomAccessStructure?re[W++]=w:w<256?(re[W++]=204,re[W++]=w):w<65536?(re[W++]=205,re[W++]=w>>8,re[W++]=255&w):(re[W++]=206,ss.setUint32(W,w),W+=4);else if((w|0)===w)w>=-32?re[W++]=256+w:w>=-128?(re[W++]=208,re[W++]=w+256):w>=-32768?(re[W++]=209,ss.setInt16(W,w),W+=2):(re[W++]=210,ss.setInt32(W,w),W+=4);else{let q;if((q=this.useFloat32)>0&&w<4294967296&&w>=-2147483648){let oe;if(re[W++]=202,ss.setFloat32(W,w),q<4||((oe=w*wl[(127&re[W])<<1|re[W+1]>>7])|0)===oe)return void(W+=4);W--}re[W++]=203,ss.setFloat64(W,w),W+=8}else if(J==="object"||J==="function")if(w){if(i){let oe=i.get(w);if(oe){if(!oe.id){let ue=i.idsToInsert||(i.idsToInsert=[]);oe.id=ue.push(oe)}return re[W++]=214,re[W++]=112,ss.setUint32(W,oe.id),void(W+=4)}i.set(w,{offset:W-t})}let q=w.constructor;if(q===Object)S(w);else if(q===Array)Z(w);else if(q===Map)if(this.mapAsEmptyObject)re[W++]=128;else{(H=w.size)<16?re[W++]=128|H:H<65536?(re[W++]=222,re[W++]=H>>8,re[W++]=255&H):(re[W++]=223,ss.setUint32(W,H),W+=4);for(let[oe,ue]of w)N(oe),N(ue)}else{for(let oe=0,ue=$c.length;oe<ue;oe++)if(w instanceof wm[oe]){let Ce=$c[oe];if(Ce.write){Ce.type&&(re[W++]=212,re[W++]=Ce.type,re[W++]=0);let He=Ce.write.call(this,w);return void(He===w?Array.isArray(w)?Z(w):S(w):N(He))}let F,D=re,Y=ss,Te=W;re=null;try{F=Ce.pack.call(this,w,He=>(re=D,D=null,W+=He,W>Ds&&M(W),{target:re,targetView:ss,position:W-He}),N)}finally{D&&(re=D,ss=Y,W=Te,Ds=re.length-10)}return void(F&&(F.length+W>Ds&&M(F.length+W),W=qg(F,re,W,Ce.type)))}if(Array.isArray(w))Z(w);else{if(w.toJSON){const oe=w.toJSON();if(oe!==w)return N(oe)}if(J==="function")return N(this.writeFunction&&this.writeFunction(w));S(w)}}}else re[W++]=192;else if(J==="boolean")re[W++]=w?195:194;else if(J==="bigint"){if(w<9223372036854776e3&&w>=-9223372036854776e3)re[W++]=211,ss.setBigInt64(W,w);else if(w<18446744073709552e3&&w>0)re[W++]=207,ss.setBigUint64(W,w);else{if(!this.largeBigIntToFloat){if(this.largeBigIntToString)return N(w.toString());if((this.useBigIntExtension||this.moreTypes)&&w<BigInt(2)**BigInt(1023)&&w>-(BigInt(2)**BigInt(1023))){re[W++]=199,W++,re[W++]=66;let q,oe=[];do{let ue=w&BigInt(255);q=(ue&BigInt(128))===(w<BigInt(0)?BigInt(128):BigInt(0)),oe.push(ue),w>>=BigInt(8)}while(w!==BigInt(0)&&w!==BigInt(-1)||!q);re[W-2]=oe.length;for(let ue=oe.length;ue>0;)re[W++]=Number(oe[--ue]);return}throw new RangeError(w+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}re[W++]=203,ss.setFloat64(W,Number(w))}W+=8}else{if(J!=="undefined")throw new Error("Unknown type: "+J);this.encodeUndefinedAsNil?re[W++]=192:(re[W++]=212,re[W++]=0,re[W++]=0)}},E=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?w=>{let H;if(this.skipValues){H=[];for(let oe in w)typeof w.hasOwnProperty=="function"&&!w.hasOwnProperty(oe)||this.skipValues.includes(w[oe])||H.push(oe)}else H=Object.keys(w);let J,q=H.length;if(q<16?re[W++]=128|q:q<65536?(re[W++]=222,re[W++]=q>>8,re[W++]=255&q):(re[W++]=223,ss.setUint32(W,q),W+=4),this.coercibleKeyAsNumber)for(let oe=0;oe<q;oe++){J=H[oe];let ue=Number(J);N(isNaN(ue)?J:ue),N(w[J])}else for(let oe=0;oe<q;oe++)N(J=H[oe]),N(w[J])}:w=>{re[W++]=222;let H=W-t;W+=2;let J=0;for(let q in w)(typeof w.hasOwnProperty!="function"||w.hasOwnProperty(q))&&(N(q),N(w[q]),J++);if(J>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');re[H+++t]=J>>8,re[H+t]=255&J},O=this.useRecords===!1?E:e.progressiveRecords&&!v?w=>{let H,J,q=r.transitions||(r.transitions=Object.create(null)),oe=W++-t;for(let ue in w)if(typeof w.hasOwnProperty!="function"||w.hasOwnProperty(ue)){if(H=q[ue],H)q=H;else{let Ce=Object.keys(w),F=q;q=r.transitions;let D=0;for(let Y=0,Te=Ce.length;Y<Te;Y++){let He=Ce[Y];H=q[He],H||(H=q[He]=Object.create(null),D++),q=H}oe+t+1==W?(W--,B(q,Ce,D)):K(q,Ce,oe,D),J=!0,q=F[ue]}N(w[ue])}if(!J){let ue=q[Yr];ue?re[oe+t]=ue:K(q,Object.keys(w),oe,0)}}:w=>{let H,J=r.transitions||(r.transitions=Object.create(null)),q=0;for(let ue in w)(typeof w.hasOwnProperty!="function"||w.hasOwnProperty(ue))&&(H=J[ue],H||(H=J[ue]=Object.create(null),q++),J=H);let oe=J[Yr];oe?oe>=96&&v?(re[W++]=96+(31&(oe-=96)),re[W++]=oe>>5):re[W++]=oe:B(J,J.__keys__||Object.keys(w),q);for(let ue in w)(typeof w.hasOwnProperty!="function"||w.hasOwnProperty(ue))&&N(w[ue])},U=typeof this.useRecords=="function"&&this.useRecords,S=U?w=>{U(w)?O(w):E(w)}:O,M=w=>{let H;if(w>16777216){if(w-t>id)throw new Error("Packed buffer would be larger than maximum buffer size");H=Math.min(id,4096*Math.round(Math.max((w-t)*(w>67108864?1.25:2),4194304)/4096))}else H=1+(Math.max(w-t<<2,re.length-1)>>12)<<12;let J=new Io(H);return ss=J.dataView||(J.dataView=new DataView(J.buffer,0,H)),w=Math.min(w,re.length),re.copy?re.copy(J,0,t,w):J.set(re.slice(t,w)),W-=t,t=0,Ds=J.length-10,re=J},B=(w,H,J)=>{let q=r.nextId;q||(q=64),q<f&&this.shouldShareStructure&&!this.shouldShareStructure(H)?(q=r.nextOwnId,q<b||(q=f),r.nextOwnId=q+1):(q>=b&&(q=f),r.nextId=q+1);let oe=H.highByte=q>=96&&v?q-96>>5:-1;w[Yr]=q,w.__keys__=H,r[q-64]=H,q<f?(H.isShared=!0,r.sharedLength=q-63,n=!0,oe>=0?(re[W++]=96+(31&q),re[W++]=oe):re[W++]=q):(oe>=0?(re[W++]=213,re[W++]=114,re[W++]=96+(31&q),re[W++]=oe):(re[W++]=212,re[W++]=114,re[W++]=q),J&&(z+=L*J),k.length>=h&&(k.shift()[Yr]=0),k.push(w),N(H))},K=(w,H,J,q)=>{let oe=re,ue=W,Ce=Ds,F=t;re=Di,W=0,t=0,re||(Di=re=new Io(8192)),Ds=re.length-10,B(w,H,q),Di=re;let D=W;if(re=oe,W=ue,Ds=Ce,t=F,D>1){let Y=W+D-1;Y>Ds&&M(Y);let Te=J+t;re.copyWithin(Te+D,Te+1,W),re.set(Di.slice(0,D),Te),W=Y}else re[J+t]=Di[0]},R=w=>{let H=Lg(w,re,t,W,r,M,(J,q,oe)=>{if(oe)return n=!0;W=q;let ue=re;return N(J),se(),ue!==re?{position:W,targetView:ss,target:re}:W},this);if(H===0)return S(w);W=H}}useBuffer(e){re=e,re.dataView||(re.dataView=new DataView(re.buffer,re.byteOffset,re.byteLength)),W=0}set position(e){W=e}get position(){return W}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}function Ja(s,e,t,n){let r=s.byteLength;if(r+1<256){var{target:i,position:o}=t(4+r);i[o++]=199,i[o++]=r+1}else if(r+1<65536){var{target:i,position:o}=t(5+r);i[o++]=200,i[o++]=r+1>>8,i[o++]=r+1&255}else{var{target:i,position:o,targetView:a}=t(7+r);i[o++]=201,a.setUint32(o,r+1),o+=4}i[o++]=116,i[o++]=e,s.buffer||(s=new Uint8Array(s)),i.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),o)}function Ya(s,e){let t=s.byteLength;var n,r;if(t<256){var{target:n,position:r}=e(t+2);n[r++]=196,n[r++]=t}else if(t<65536){var{target:n,position:r}=e(t+3);n[r++]=197,n[r++]=t>>8,n[r++]=255&t}else{var{target:n,position:r,targetView:i}=e(t+5);n[r++]=198,i.setUint32(r,t),r+=4}n.set(s,r)}function qg(s,e,t,n){let r=s.length;switch(r){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:r<256?(e[t++]=199,e[t++]=r):r<65536?(e[t++]=200,e[t++]=r>>8,e[t++]=255&r):(e[t++]=201,e[t++]=r>>24,e[t++]=r>>16&255,e[t++]=r>>8&255,e[t++]=255&r)}return e[t++]=n,e.set(s,t),t+=r}function od(s,e,t){if(ds.length>0){ss.setUint32(ds.position+s,W+t-ds.position-s),ds.stringsPosition=W-s;let n=ds;ds=null,e(n[0]),e(n[1])}}function Dg(s,e){return s.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},s}wm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,hm],$c=[{pack(s,e,t){let n=s.getTime()/1e3;if((this.useTimestamp32||s.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:r,targetView:i,position:o}=e(6);r[o++]=214,r[o++]=255,i.setUint32(o,n)}else if(n>0&&n<4294967296){let{target:r,targetView:i,position:o}=e(10);r[o++]=215,r[o++]=255,i.setUint32(o,4e6*s.getMilliseconds()+(n/1e3/4294967296|0)),i.setUint32(o+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:r,targetView:i,position:o}=e(3);r[o++]=212,r[o++]=255,r[o++]=255}else{let{target:r,targetView:i,position:o}=e(15);r[o++]=199,r[o++]=12,r[o++]=255,i.setUint32(o,1e6*s.getMilliseconds()),i.setBigInt64(o+4,BigInt(Math.floor(n)))}}},{pack(s,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(s),{target:r,position:i}=e(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=115,r[i++]=0),t(n)}},{pack(s,e,t){let{target:n,position:r}=e(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=101,n[r++]=0),t([s.name,s.message,s.cause])}},{pack(s,e,t){let{target:n,position:r}=e(this.moreTypes?3:0);this.moreTypes&&(n[r++]=212,n[r++]=120,n[r++]=0),t([s.source,s.flags])}},{pack(s,e){this.moreTypes?Ja(s,16,e):Ya(no?Buffer.from(s):new Uint8Array(s),e)}},{pack(s,e){let t=s.constructor;t!==xm&&this.moreTypes?Ja(s,ym.indexOf(t.name),e):Ya(s,e)}},{pack(s,e){this.moreTypes?Ja(s,17,e):Ya(no?Buffer.from(s):new Uint8Array(s),e)}},{pack(s,e){let{target:t,position:n}=e(1);t[n]=193}}];let ad=new Sm({useRecords:!1});ad.pack,ad.pack;const Bg=512,zg=1024,Ug=2048,Vg=new Sm({useRecords:!1,encodeUndefinedAsNil:!0,int64AsType:"number"}),Hg=new vi({useRecords:!1,int64AsType:"number"});class Qg{constructor(e,t,n){p(this,"subject");p(this,"handlerId");p(this,"unsubscribeFn");this.subject=e,this.handlerId=t,this.unsubscribeFn=n}unsubscribe(){try{this.unsubscribeFn(this.subject,this.handlerId)}catch{}}}let Ar=256;const Cm=[];let Oo;for(;Ar--;)Cm[Ar]=(Ar+256).toString(16).substring(1);function yn(s){let e=0;const t=11;if(!Oo||Ar+t>512)for(Oo="",Ar=0;e<256;e++)Oo+=Cm[256*Math.random()|0];return Oo.substring(Ar,Ar+++t)}const Ut=Ti("camera:ui:connection");class Xi{constructor(e,t){p(this,"type");p(this,"options");p(this,"connection",null);p(this,"connectionPromise");p(this,"subscriptionGroups",new Map);p(this,"metricsTracker");p(this,"isDisconnected",!1);this.type=e,this.options=t,yo.validateConnectionOptions(t),this.metricsTracker=new Mg}async connect(){this.isConnected()||(this.connectionPromise?await this.connectionPromise:(Ut(`[${this.options.metadata.id}] Establishing connection...`),this.connectionPromise=this.establishConnection(),await this.connectionPromise,Ut(`[${this.options.metadata.id}] Connection established successfully.`)))}async disconnect(){this.isDisconnected=!0,Ut(`[${this.options.metadata.id}] Disconnecting...`),await this.drainConnection(),this.connection=null,Ut(`[${this.options.metadata.id}] Disconnected.`)}isConnected(){return this.connection!==null&&!this.connection.isClosed()&&!this.connection.isDraining()}isClosed(){return this.connection===null||this.connection.isClosed()||this.connection.isDraining()}getConnection(){if(!this.isConnected())throw kt.connection.invalidState(void 0,{description:"Connection is not established",code:As.INVALID_STATE});return this.connection}publish(e,t,n,r){if(this.isClosed())throw Ut(`[${this.options.metadata.id}] Publish skipped: Connection closed or draining`),kt.connection.notConnected(void 0,{description:"Failed to publish message: Connection closed or draining",code:As.NOT_CONNECTED,subject:e});const i={id:yn(),type:qi.BROADCAST,data:t,metadata:this.options.metadata,timestamp:Date.now(),routing:r,error:n};try{this.getConnection().publish(e,this.packMessage(i)),this.metricsTracker.trackPublish(),Ut("Published message to",e,i.id)}catch(o){throw this.metricsTracker.trackMessageError(),kt.message.deliveryFailed(o,{description:"Failed to publish message",code:Bn.DELIVERY_FAILED,subject:e})}}async request(e,t,n,r){if(this.isClosed())throw Ut(`[${this.options.metadata.id}] Request skipped: Connection closed or draining. Subject: ${e}`),kt.connection.notConnected(void 0,{description:"Failed to send request: Connection closed or draining",code:As.NOT_CONNECTED,subject:e});const i=yn(),o={id:i,type:qi.REQUEST,subject:e,data:t,metadata:this.options.metadata,timestamp:Date.now(),routing:r};this.metricsTracker.trackRequestStart(i);try{const a=await this.getConnection().request(e,this.packMessage(o),{timeout:n??this.getTimeoutOptions().request}),l=this.unpackMessage(a);if(this.metricsTracker.trackRequestEnd(i,!!l.error),l.error)throw Ss.fromJSON(l.error);return l}catch(a){throw this.metricsTracker.trackRequestEnd(i,!0),a instanceof Ss?a:kt.connection.requestFailed(a,{description:"Failed to send request or process response",code:"CONNECTION_REQUEST_FAILED",subject:e})}}async requestRPC(e,t,n){if(this.isClosed())throw Ut(`[${this.options.metadata.id}] RPC Request skipped: Connection closed or draining. Subject: ${e}`),kt.connection.notConnected(void 0,{description:"Failed to send RPC request: Connection closed or draining",code:As.NOT_CONNECTED,subject:e});const r={id:yn(),type:qi.RPC_REQUEST,subject:e,data:t,metadata:this.options.metadata,timestamp:Date.now()};this.metricsTracker.trackRPCStart();try{const i=await this.getConnection().request(e,this.packMessage(r),{timeout:n??this.getTimeoutOptions().rpc}),o=this.unpackMessage(i);if(this.metricsTracker.trackRPCEnd(!!o.error),o.error)throw Ss.fromJSON(o.error);return o}catch(i){throw this.metricsTracker.trackRPCEnd(!0),i instanceof Ss?i:kt.rpc.requestFailed(i,{description:"Failed to send RPC request or process response",code:"RPC_REQUEST_FAILED",subject:e})}}handleRequest(e,t){return this.subscribe(e,t,void 0,"request")}subscribe(e,t,n=yn(),r="message"){if(this.isClosed())throw Ut(`[${this.options.metadata.id}] Subscribe skipped: Connection closed or draining. Subject: ${e}`),kt.connection.notConnected(void 0,{description:"Failed to subscribe: Connection closed or draining",code:As.NOT_CONNECTED,subject:e});let i=this.subscriptionGroups.get(e);if(i){if(i.type!==r)throw new Error(`Cannot mix on subject ${e}`);if((r==="request"||r==="rpc"||r==="generator")&&i.handlers.size>0)throw new Error(`Request/RPC/Generator handler already registered for subject ${e}`)}else{let o;try{o=this.getConnection().subscribe(e)}catch(a){throw kt.connection.subscribeFailed(a,{description:`Failed to create NATS subscription for subject ${e}`,code:"CONNECTION_SUBSCRIBE_FAILED",subject:e,metadata:{type:r}})}i={subscription:o,handlers:new Map,type:r,refCount:0},this.subscriptionGroups.set(e,i),this.handleSubscription(o,e,i),Ut(`[${this.options.metadata.id}] Created subscription group for %s`,e)}return i.handlers.has(n)&&Ut(`[${this.options.metadata.id}] Handler %s already registered for subject %s`,n,e),i.handlers.set(n,t),i.refCount++,this.metricsTracker.trackSubscriptionChange(1,r),Ut(`[${this.options.metadata.id}] Subscribed to %s (handler: %s, type: %s, refCount: %d)`,e,n,r,i.refCount),new Qg(e,n,this.unsubscribe.bind(this))}unsubscribe(e,t){const n=this.subscriptionGroups.get(e);if(n&&n.handlers.delete(t)&&(n.refCount--,this.metricsTracker.trackSubscriptionChange(-1,n.type),n.refCount<=0))try{n.subscription.unsubscribe(),this.subscriptionGroups.delete(e)}catch{this.subscriptionGroups.delete(e)}}getMetrics(){return this.metricsTracker.getMetrics()}async establishConnection(){try{this.isDisconnected=!1;const e=this.getTimeoutOptions(),{waitForServer:t}=this.getConnectOptions(),{maxAttempts:n,delay:r,enabled:i}=this.getReconnectOptions();let o=0;for(;!this.isDisconnected;){o++;try{Ut(`[${this.options.metadata.id}] Connection attempt ${o}...`);const a=await kg({...this.getNatsAuthOptions(),name:this.options.metadata.id,servers:this.options.endpoints,tls:this.options.tls,timeout:e.connection,maxReconnectAttempts:i?n:0,reconnect:i,reconnectTimeWait:r,noEcho:!0,noAsyncTraces:!0,waitOnFirstConnect:!0});return Ut(`[${this.options.metadata.id}] NATS connect() successful.`),(async()=>{for await(const l of a.status())l.type===Mn.Reconnect&&Ut(`[${this.options.metadata.id}] Connection reconnected.`)})().catch(l=>{Ut(`[${this.options.metadata.id}] Error in status monitoring:`,l)}),a.closed().then(l=>{Ut(`[${this.options.metadata.id}] Connection closed:`,l),this.subscriptionGroups.clear(),this.metricsTracker.resetMetrics(),this.isDisconnected=!0,this.connection=null}),void(this.connection=a)}catch(a){if(this.isDisconnected)return;if(!t)throw Ut(`[${this.options.metadata.id}] Connection attempt ${o} failed:`,a),kt.connection.connectionFailed(a,{description:"Failed to connect to NATS server",code:As.FAILED,metadata:{attempts:o}});Ut(`[${this.options.metadata.id}] Connection attempt ${o} failed:`,a),await new Promise(l=>setTimeout(l,r))}}}finally{this.connectionPromise=void 0}}async drainConnection(){if(this.connection&&!this.connection.isClosed())try{await this.connection.drain()}catch(e){Ut("Error draining connection:",e)}}async handleSubscription(e,t,n){Ut(`[${this.options.metadata.id}] Starting message loop for subscription ${t}`);for await(const r of e){if(!this.subscriptionGroups.has(t)){Ut(`[${this.options.metadata.id}] Message loop for ${t} exiting: Group removed.`);break}let i;try{i=this.unpackMessage(r);const o={subject:r.subject,timestamp:Date.now(),id:i.id};switch(this.metricsTracker.trackReceive(),n.type){case"request":this.handleRequestMessage(r,i,n);break;case"rpc":this.handleRPCMessage(r,i,n);break;case"generator":this.handleGeneratorInitiationMessage(r,i,n);break;default:this.handleNormalMessage(i,o,n)}}catch(o){this.metricsTracker.trackMessageError(),Ut(`[${this.options.metadata.id}] Error processing message for ${t}:`,o)}}Ut(`[${this.options.metadata.id}] Message loop for subscription ${t} terminated.`),this.subscriptionGroups.has(t)&&this.subscriptionGroups.delete(t)}async handleRequestMessage(e,t,n){const r=n.handlers.values().next().value;if(r)try{const i=await r(t);this.respondTo(e,i,t.id)}catch(i){this.metricsTracker.trackMessageError();const o=kt.message.executionFailed(i,{description:"Handler execution failed"});this.respondTo(e,null,t.id,o.toJSON())}}async handleRPCMessage(e,t,n){const r=n.handlers.values().next().value;if(r)try{const i=Array.isArray(t.data)?t.data:t.data!==void 0?[t.data]:[],o=await r(...i);this.respondToRPC(e,o,t.id)}catch(i){this.metricsTracker.trackMessageError();const o=kt.rpc.executionFailed(i,{description:"RPC handler execution failed"});this.respondToRPC(e,null,t.id,void 0,!0,o.toJSON())}}async handleGeneratorInitiationMessage(e,t,n){const r=n.handlers.values().next().value;if(r)try{await r(t)}catch(i){this.metricsTracker.trackMessageError(),Ut("Error processing generator request:",i)}}async handleNormalMessage(e,t,n){const r=Array.from(n.handlers.values());if(r.length===0)return;const i=[];for(const o of r)try{const a=o(e);a instanceof Promise&&i.push(a.catch(this.metricsTracker.trackMessageError.bind(this)))}catch(a){this.metricsTracker.trackMessageError(),Ut("Error in sync handler:",a)}await Promise.allSettled(i)}respondTo(e,t,n,r){try{if(this.isClosed())throw Ut(`[${this.options.metadata.id}] Respond skipped: Connection closed or draining. Subject: ${e.subject}`),kt.connection.notConnected(void 0,{description:"Failed to respond: Connection closed or draining",code:As.NOT_CONNECTED,subject:e.subject});const i={id:yn(),type:qi.RESPONSE,requestId:n,data:t,metadata:this.options.metadata,error:r,timestamp:Date.now()};e.respond(this.packMessage(i))}catch(i){this.metricsTracker.trackMessageError(),Ut("Error sending request response:",i)}}respondToRPC(e,t,n,r,i,o){try{if(this.isClosed())throw Ut(`[${this.options.metadata.id}] RPC Respond skipped: Connection closed or draining. Subject: ${e.subject}`),kt.connection.notConnected(void 0,{description:"Failed to respond: Connection closed or draining",code:As.NOT_CONNECTED,subject:e.subject});const a={id:yn(),type:qi.RPC_RESPONSE,requestId:n,data:t,metadata:this.options.metadata,streamId:r,done:i,error:o,timestamp:Date.now()};e.respond(this.packMessage(a))}catch(a){this.metricsTracker.trackMessageError(),Ut("Error sending RPC response:",a)}}packMessage(e){try{return t=e,Vg.pack(t)}catch(n){throw this.metricsTracker.trackMessageError(),kt.message.invalidFormat(n,{description:"Failed to pack message",code:Bn.INVALID_FORMAT,metadata:{raw:e}})}var t}unpackMessage(e){try{return t=e.data,Hg.unpack(t)}catch{throw kt.message.invalidFormat(void 0,{description:"Failed to parse message",code:Bn.INVALID_FORMAT,subject:e.subject,metadata:{raw:e.data}})}var t}getNatsAuthOptions(){return"server"in this.options.auth?{user:this.options.auth.server.user,pass:this.options.auth.server.password}:{user:this.options.auth.user,pass:this.options.auth.password}}getConnectOptions(){return{waitForServer:!1,...this.options.connect}}getReconnectOptions(){return{enabled:!1,maxAttempts:Zu.MAX_RECONNECT_ATTEMPTS,delay:Zu.DELAY,...this.options.reconnect}}getTimeoutOptions(){return{rpc:Ga.RPC,request:Ga.REQUEST,connection:Ga.CONNECTION,...this.options.timeout}}}class Kg{constructor(){}publish(e,t,n){this.getConnectionManager().publish(e,t,void 0,n)}async request(e,t,n,r){return this.getConnectionManager().request(e,t,n,r)}handleRequest(e,t){return this.getConnectionManager().handleRequest(e,t)}subscribe(e,t){return this.getConnectionManager().subscribe(e,t)}unsubscribe(e,t){return this.getConnectionManager().unsubscribe(e,t)}}tn(779);function Xa(s={name:void 0,public:!0}){return function(e,t){const n=typeof t=="object"?t.name:t,r=s.name??n.toString();if(typeof t=="object"){const i=e;return Reflect.defineMetadata("rpc:config",{name:r,public:s.public??!0},i,n),i}{const i=e[n];Reflect.defineMetadata("rpc:config",{name:r,public:s.public??!0},e,n),Object.defineProperty(e,n,{value:function(...o){return i.apply(this,o)},enumerable:!0,configurable:!0})}}}class Er{static extractMethods(e){const t={},n=(o,a)=>{if(!((u,d)=>typeof d=="function"&&!u.startsWith("_")&&!u.startsWith("#")&&u!=="constructor"&&!Object.prototype.hasOwnProperty.call(Object.prototype,u))(o,a))return;const l=Reflect.getMetadata("rpc:config",Object.getPrototypeOf(e),o)??Reflect.getMetadata("rpc:config",a,o);l!=null&&l.public&&(t[l.name]={name:l.name,public:!0,type:Er.getMethodType(a),method:a})};let r=e;const i=new Set;for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).forEach(o=>{if(!i.has(o)){i.add(o);const a=e[o];n(o,a)}}),r=Object.getPrototypeOf(r);return t._discover={name:"_discover",public:!0,type:"async",method:async()=>Object.entries(Er.extractMethods(e)).reduce((o,[a,l])=>(o[a]={name:a,type:l.type},o),{})},t}static isAsyncFunction(e){return!!e&&(e.constructor?e.constructor.name==="AsyncFunction":e.toString().includes("async ")&&!e.toString().includes("async*"))}static isGeneratorFunction(e){return!!e&&(e.constructor?e.constructor.name==="GeneratorFunction":e.toString().includes("function*"))}static isAsyncGeneratorFunction(e){return!!e&&(e.constructor?e.constructor.name==="AsyncGeneratorFunction":e.toString().includes("async*"))}static getMethodType(e){return Er.isAsyncGeneratorFunction(e)||Er.isGeneratorFunction(e)?"asyncGenerator":(Er.isAsyncFunction(e),"async")}}const jt=Ti("camera:ui:rpc:generator");class Zg{constructor(e,t,n){p(this,"namespace");p(this,"mainConnection");p(this,"options");p(this,"MAX_QUEUE_SIZE",100);p(this,"pendingReadySignals",new Map);p(this,"consumerGeneratorStates",new Map);p(this,"producerGeneratorStates",new Map);p(this,"handlerSubscriptions",new Map);this.namespace=e,this.mainConnection=t,this.options=n}async*createGenerator(e,...t){var u;const n=yn(),r=`${this.namespace}.${e}.generator`,i=`${r}.stream.${n}`,o=`${r}.control.${n}`;jt(`[C:${n}] Starting generator stream for ${e}`);let a=null,l=null;try{jt(`[C:${n}] Creating dedicated consumer connection...`),a=new Xi(this.mainConnection.type,{...this.options,metadata:{...this.options.metadata,id:`${this.options.metadata.id}-cg-${n.substring(0,8)}`},bundledConnection:!1,timeout:this.options.timeout}),await a.connect(),jt(`[C:${n}] Dedicated consumer connection established.`);const d=a.subscribe(i,h=>this.handleStreamMessage(n,h),yn(),"generator");for(jt(`[C:${n}] Subscribed to data stream: ${i}`),l={messageQueue:[],resolveNext:null,error:void 0,isDone:!1,streamSubscription:d,controlSubject:o,lastProcessedTime:Date.now(),isProcessing:!1,dedicatedConnection:a},this.consumerGeneratorStates.set(n,l),jt(`[C:${n}] Sending initiation request via main connection to ${r}`),this.mainConnection.publish(r,{streamId:n,args:t});!l.isDone;){if(l.error)throw l.error;if(l.messageQueue.length>0){const v=l.messageQueue.shift();l.isProcessing=!0;try{yield v.value}finally{l.isProcessing=!1,l.lastProcessedTime=Date.now(),this.sendReadySignal(n,l.controlSubject,l.dedicatedConnection)}continue}l.isProcessing=!1;const h=await new Promise(v=>{const f=this.consumerGeneratorStates.get(n);f?f.resolveNext=v:v({done:!0,value:void 0})});if(h.done||(u=this.consumerGeneratorStates.get(n))!=null&&u.isDone)break;l=this.consumerGeneratorStates.get(n),l.isProcessing=!0;try{yield h.value.value}finally{l.isProcessing=!1,l.lastProcessedTime=Date.now(),this.sendReadySignal(n,l.controlSubject,l.dedicatedConnection)}}jt(`[C:${n}] Consumption loop finished.`)}finally{jt(`[C:${n}] Cleaning up consumer side...`);const d=this.consumerGeneratorStates.get(n);if(d)await this.cleanupConsumerGenerator(n,d);else if(a&&!a.isClosed()){const h=`${this.namespace}.${e}.generator.control.${n}`;await this.cleanupConsumerConnection(n,a,h)}this.consumerGeneratorStates.delete(n),jt(`[C:${n}] Consumer cleanup finished.`)}}async handleGenerator(e,t){var i;const n=`${this.namespace}.${e}.generator`;jt(`[P] Setting up generator handler for: ${n}`),(i=this.handlerSubscriptions.get(n))==null||i.unsubscribe();const r=this.mainConnection.subscribe(n,async o=>{var a;try{await this.handleGeneratorRequest(e,t,o)}catch(l){jt(`[P:${((a=o.data)==null?void 0:a.streamId)||"unknown"}] Critical error setting up generator handler for ${e}:`,l)}},yn(),"generator");this.handlerSubscriptions.set(n,r)}async handleGeneratorRequest(e,t,n){var h;const r=(h=n.data)==null?void 0:h.streamId;if(!r)return void jt(`[P:unknown] Received generator request for ${e} without streamId. Discarding.`);const i=`${this.namespace}.${e}.generator`,o=`${i}.stream.${r}`,a=`${i}.control.${r}`;jt(`[P:${r}] Received generator request for ${e}`);let l=null,u=null,d=null;try{jt(`[P:${r}] Creating dedicated producer connection...`),l=new Xi(this.mainConnection.type,{...this.options,metadata:{...this.options.metadata,id:`${this.options.metadata.id}-pg-${r.substring(0,8)}`},bundledConnection:!1,timeout:this.options.timeout}),await l.connect(),jt(`[P:${r}] Dedicated producer connection established.`),this.pendingReadySignals.has(r)||this.pendingReadySignals.set(r,new Set);const v=l.subscribe(a,b=>this.handleControlMessage(r,b),yn(),"generator");jt(`[P:${r}] Subscribed to control subject: ${a}`),d=t(...n.data.args?Array.isArray(n.data.args)?n.data.args:[n.data.args]:[]),u={streamSubject:o,controlSubject:a,requestId:n.id,streamId:r,generator:d,isWaitingForClient:!1,lastSentTime:Date.now(),dedicatedConnection:l,controlSubscription:v},this.producerGeneratorStates.set(r,u),jt(`[P:${r}] Generator handler invoked. Processing frames...`);let f=await d.next();for(;;){if(this.producerGeneratorStates.get(r)!==u){jt(`[P:${r}] Producer state removed. Aborting loop.`);break}if(f.done){l.publish(o,{requestId:n.id,streamId:r,done:!0}),jt(`[P:${r}] Generator completed normally.`);break}l.publish(o,{requestId:n.id,streamId:r,value:f.value,done:!1}),u.lastSentTime=Date.now(),u.isWaitingForClient=!0;const b=new Promise(L=>{var se;return(se=this.pendingReadySignals.get(r))==null?void 0:se.add(L)});let k;const z=new Promise(L=>{k=setTimeout(()=>{jt(`[P:${r}] Ready signal timeout.`),L()},1e4)});if(await Promise.race([b.finally(()=>clearTimeout(k)),z]),clearTimeout(k),this.producerGeneratorStates.get(r)!==u){jt(`[P:${r}] Producer state changed during wait. Aborting loop.`);break}f=await d.next()}}catch(v){if(jt(`[P:${r}] Error during generator execution:`,v),l&&this.producerGeneratorStates.has(r)){const f=kt.rpc.internalError(v,{description:"Error processing generator request"});try{l.publish(o,{requestId:n.id,streamId:r,done:!0,error:f.toJSON()})}catch(b){jt(`[P:${r}] Error sending error message:`,b)}}}finally{jt(`[P:${r}] Cleaning up producer side...`);const v=this.producerGeneratorStates.get(r);v?await this.cleanupProducerGenerator(r,v):l&&!l.isClosed()&&await this.cleanupProducerConnection(l,null),this.producerGeneratorStates.delete(r),this.pendingReadySignals.delete(r),jt(`[P:${r}] Producer side cleanup finished.`)}}async dispose(){jt("Disposing RPCGeneratorManager..."),await Promise.allSettled([...Array.from(this.consumerGeneratorStates.entries()).map(([e,t])=>this.cleanupConsumerGenerator(e,t)),...Array.from(this.producerGeneratorStates.entries()).map(([e,t])=>this.cleanupProducerGenerator(e,t))]),this.consumerGeneratorStates.clear(),this.producerGeneratorStates.clear(),this.pendingReadySignals.clear(),this.handlerSubscriptions.forEach(e=>e.unsubscribe()),this.handlerSubscriptions.clear(),jt("RPCGeneratorManager disposed.")}handleStreamMessage(e,t){const n=this.consumerGeneratorStates.get(e);if(n)return t.error?(n.error=Ss.fromJSON(t.error),n.isDone=!0,void(n.resolveNext&&(n.resolveNext({done:!0,value:void 0}),n.resolveNext=null))):t.data.done?(n.isDone=!0,void(n.resolveNext&&(n.resolveNext({done:!0,value:t.data}),n.resolveNext=null))):void(n.resolveNext?(n.resolveNext({done:!1,value:t.data}),n.resolveNext=null):(n.messageQueue.length>=this.MAX_QUEUE_SIZE&&n.messageQueue.shift(),n.messageQueue.push(t.data)))}handleControlMessage(e,t){const n=this.producerGeneratorStates.get(e);if(n){if(t.data.type==="return"||t.data.type==="throw")this.cleanupProducerGenerator(e,n).catch(()=>{});else if(t.data.type==="ready"){n.isWaitingForClient=!1;const r=this.pendingReadySignals.get(e);r&&(r.forEach(i=>i()),r.clear())}}}sendReadySignal(e,t,n){n.isClosed()||n.publish(t,{type:"ready"})}async cleanupConsumerGenerator(e,t){this.consumerGeneratorStates.has(e)&&(this.consumerGeneratorStates.delete(e),jt(`[C:${e}] Cleaning up consumer generator...`),t.streamSubscription.unsubscribe(),await this.cleanupConsumerConnection(e,t.dedicatedConnection,t.controlSubject))}async cleanupConsumerConnection(e,t,n){if(jt(`[C:${e}] Cleaning up consumer connection...`),n&&!t.isClosed())try{t.publish(n,{type:"return"})}catch{}t.isClosed()||await t.disconnect().catch(r=>jt(`[C:${e}] Error disconnecting consumer connection:`,r))}async cleanupProducerGenerator(e,t){this.producerGeneratorStates.has(e)&&(this.producerGeneratorStates.delete(e),this.pendingReadySignals.delete(e),jt(`[P:${e}] Cleaning up producer generator...`),await t.generator.return(void 0).catch(()=>{}),await this.cleanupProducerConnection(t.dedicatedConnection,t.controlSubscription))}async cleanupProducerConnection(e,t){var r,i;const n=((i=(r=e==null?void 0:e.options)==null?void 0:r.metadata)==null?void 0:i.id)||"unknown-producer";jt(`[P:${n}] Cleaning up producer connection...`),t==null||t.unsubscribe(),e&&!e.isClosed()&&await e.disconnect().catch(o=>jt(`[P:${n}] Error disconnecting producer connection:`,o))}}const Bs=Ti("camera:ui:rpc");class cd{constructor(e,t,n,r){p(this,"namespace");p(this,"connection");p(this,"options");p(this,"rpcOptions");p(this,"generatorManager");p(this,"handlers",new Map);p(this,"remoteMethodTypes",new Map);this.namespace=e,this.connection=t,this.options=n,this.rpcOptions=r,this.generatorManager=new Zg(this.namespace,this.connection,this.options)}async connect(){if(this.options.bundledConnection)Bs(`[${this.namespace}] Main connection is bundled, skipping connect.`);else try{await this.connection.connect(),Bs(`[${this.namespace}] Main connection established.`)}catch(e){throw Bs(`[${this.namespace}] Failed to establish main connection:`,e),e}}async disconnect(){if(Bs(`[${this.namespace}] Disconnecting RPCConnection...`),await this.dispose(),this.options.bundledConnection)Bs(`[${this.namespace}] Skipping disconnect of bundled main connection.`);else{if(!this.connection.isClosed())try{await this.connection.disconnect(),Bs(`[${this.namespace}] Main connection disconnected.`)}catch(e){Bs(`[${this.namespace}] Error disconnecting main connection:`,e)}Bs(`[${this.namespace}] RPCConnection disconnected.`)}}isConnected(){return this.connection.isConnected()}registerHandler(e){const t=Er.extractMethods(e);Object.entries(t).forEach(([n,r])=>{const i=r.name||n;if(this.handlers.has(i))return void Bs(`[${this.namespace}] Handler for method '${i}' already registered.`);const o={handler:e,subscriptions:[]};if(this.handlers.set(i,o),Bs(`[${this.namespace}] Registering handler for method: ${i} (${r.type})`),r.type==="asyncGenerator")this.generatorManager.handleGenerator(i,r.method.bind(e));else{const a=`${this.namespace}.${i}`,l=yn();try{this.connection.subscribe(a,r.method.bind(e),l,"rpc"),o.subscriptions.push({subject:a,handlerId:l})}catch(u){Bs(`[${this.namespace}] Failed to register handler for method: "${i}":`,u),this.handlers.delete(i)}}})}async call(e,...t){var r;const n=`${this.namespace}.${e}`;return this.connection.requestRPC(n,t,(r=this.rpcOptions)==null?void 0:r.timeout).then(i=>i.data)}callGenerator(e,...t){return this.generatorManager.createGenerator(e,...t)}createProxy(){const e=new Set(["toString","toJSON","valueOf","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","then","catch","finally"]);return new Proxy({},{get:(t,n)=>{if(typeof n!="symbol"&&!e.has(n))return(...r)=>{var o,a;return((o=r[0])==null?void 0:o.isGenerator)?(Bs("Creating generator proxy for:",n),this.callGenerator(n,...r.slice(1))):(Bs("Creating async proxy for:",n),this.connection.requestRPC(`${this.namespace}.${n}`,r,(a=this.rpcOptions)==null?void 0:a.timeout).then(l=>l.data))}}})}getConnectionManager(){return this.connection}async dispose(){Bs(`[${this.namespace}] Disposing RPCConnection resources...`),this.generatorManager&&await this.generatorManager.dispose();const e=[];this.handlers.forEach(t=>{t.subscriptions.forEach(({subject:n,handlerId:r})=>{e.push(new Promise(i=>{try{this.connection.unsubscribe(n,r)}finally{i()}}))})}),await Promise.allSettled(e),this.handlers.clear(),this.remoteMethodTypes.clear(),Bs(`[${this.namespace}] Finished disposing RPCConnection resources.`)}}class Gg extends Kg{constructor(t,n){super();p(this,"type");p(this,"options");p(this,"rpcManagers",new Map);p(this,"remoteRpcManagers",new Map);p(this,"connection");this.type=t,this.options=n,yo.validateConnectionOptions(n),this.connection=new Xi(this.type,n)}sendToPlugin(t,n){const r=os.createRoutingMetadata(this.type,this.options.metadata.id,"plugin",t);this.publish(this.getPluginSubject(t),n,r)}sendToService(t,n){const r=os.createRoutingMetadata(this.type,this.options.metadata.id,"service",t);this.publish(this.getServiceSubject(t),n,r)}async requestFromPlugin(t,n,r){const i=os.createRoutingMetadata(this.type,this.options.metadata.id,"plugin",t);return this.request(this.getPluginSubject(t),n,r,i)}async requestFromService(t,n,r){const i=os.createRoutingMetadata(this.type,this.options.metadata.id,"service",t);return this.request(this.getServiceSubject(t),n,r,i)}onPluginMessage(t="*",n){const r=this.type==="plugin"?os.getPluginToPluginSubject(t,this.options.metadata.id):this.type==="service"?os.getPluginToServiceSubject(t,this.options.metadata.id):os.getPluginToServerSubject(t,this.options.metadata.id);return this.handleRequest(r,async i=>await n(i.data))}onServiceMessage(t="*",n){const r=this.type==="plugin"?os.getServiceToPluginSubject(t,this.options.metadata.id):this.type==="service"?os.getServiceToServiceSubject(t,this.options.metadata.id):os.getServiceToServerSubject(t,this.options.metadata.id);return this.handleRequest(r,async i=>await n(i.data))}async registerRPCHandler(t,n,r){let i=this.rpcManagers.get(t);if(i)return;const o=this.options.bundledConnection??!0?this.connection:new Xi(this.type,this.options);i=new cd(t,o,this.options,r),await i.connect(),i.registerHandler(n),this.rpcManagers.set(t,i)}async unregisterRPCHandler(t){const n=this.rpcManagers.get(t);await(n==null?void 0:n.disconnect()),this.rpcManagers.delete(t)}async createRPCProxy(t,n){return(await this.createRPCConnection(t,n)).createProxy()}async createRPCConnection(t,n){try{let r=this.remoteRpcManagers.get(t);if(!r){const i=this.options.bundledConnection??!0?this.connection:new Xi(this.type,this.options);r=new cd(t,i,this.options,n),await r.connect(),this.remoteRpcManagers.set(t,r)}return r}catch(r){throw kt.rpc.connectionFailed(r,{description:"Failed to connect to remote RPC",code:nr.CONNECTION_FAILED,metadata:{namespace:t,rpcOptions:n}})}}async disconnectRPCConnection(t){const n=this.remoteRpcManagers.get(t);await(n==null?void 0:n.disconnect()),this.remoteRpcManagers.delete(t)}async cleanup(){await this.cleanupRPCConnections(),await this.cleanupRemoteRPCConnections()}async cleanupRPCConnections(t){if(t){const n=this.rpcManagers.get(t);await(n==null?void 0:n.disconnect()),this.rpcManagers.delete(t)}else await Promise.allSettled([...this.rpcManagers.values()].map(n=>n.disconnect())),this.rpcManagers.clear()}async cleanupRemoteRPCConnections(t){if(t){const n=this.remoteRpcManagers.get(t);await(n==null?void 0:n.disconnect()),this.remoteRpcManagers.delete(t)}else await Promise.allSettled([...this.remoteRpcManagers.values()].map(n=>n.disconnect())),this.remoteRpcManagers.clear()}getPluginSubject(t){return this.type==="plugin"?os.getPluginToPluginSubject(this.options.metadata.id,t):this.type==="service"?os.getServiceToPluginSubject(this.options.metadata.id,t):os.getServerToPluginSubject(this.options.metadata.id,t)}getServiceSubject(t){return this.type==="plugin"?os.getPluginToServiceSubject(this.options.metadata.id,t):this.type==="service"?os.getServiceToServiceSubject(this.options.metadata.id,t):os.getServerToServiceSubject(this.options.metadata.id,t)}}const No=Ti("camera:ui:client");class Wg extends Gg{constructor(t,n,r=!1){super(t,n);p(this,"type");p(this,"options");p(this,"isProxy");p(this,"serverStatus",Yi);p(this,"registered",!1);p(this,"serverMetadata");this.type=t,this.options=n,this.isProxy=r}async connect(){await this.initialize(),this.setupSubscriptions(),No("Connected successfully")}async disconnect(){await super.cleanup(),await this.connection.disconnect(),this.registered=!1,No("Disconnected from NATS")}sendToServer(t){if(!this.serverMetadata)throw kt.client.invalidState(void 0,{description:"Server metadata is not available",code:An.INVALID_STATE});const n=this.type==="plugin"?os.getPluginToServerSubject(this.options.metadata.id,this.serverMetadata.id):os.getServiceToServerSubject(this.options.metadata.id,this.serverMetadata.id),r=os.createRoutingMetadata(this.type,this.options.metadata.id,"server",this.serverMetadata.id);this.publish(n,t,r)}async requestFromServer(t,n){if(!this.serverMetadata)throw kt.client.invalidState(void 0,{description:"Server metadata is not available",code:An.INVALID_STATE});const r=this.type==="plugin"?os.getPluginToServerSubject(this.options.metadata.id,this.serverMetadata.id):os.getServiceToServerSubject(this.options.metadata.id,this.serverMetadata.id),i=os.createRoutingMetadata(this.type,this.options.metadata.id,"server",this.serverMetadata.id);return this.request(r,t,n,i)}onServerMessage(t){if(!this.serverMetadata)throw kt.client.invalidState(void 0,{description:"Server metadata is not available",code:An.INVALID_STATE});const n=this.type==="plugin"?os.getServerToPluginSubject(this.serverMetadata.id,this.options.metadata.id):os.getServerToServiceSubject(this.serverMetadata.id,this.options.metadata.id);return this.handleRequest(n,async r=>await t(r.data))}isServerRunning(){return this.serverStatus==="running"}isConnected(){return this.connection.isConnected()}isRegistered(){return this.registered}async createRPCProxy(t,n){return super.createRPCProxy(t,n)}createRPCConnection(t,n){return super.createRPCConnection(t,n)}disconnectRPCConnection(t){return super.disconnectRPCConnection(t)}getConnectionManager(){return this.connection}getRPCConnectionManagers(){const t=Array.from(this.rpcManagers.values()).map(n=>n.getConnectionManager());return[this.connection,...t]}async initialize(){await this.connection.connect(),await this.register()}setupSubscriptions(){this.isProxy||this.handleRequest(`${Dn.HEALTH.PING}.${this.options.metadata.id}`,async()=>({clientId:this.options.metadata.id})),this.subscribe(Dn.SERVER.STATUS,async t=>{No("Server status update:",t),this.serverStatus=t.data,this.serverStatus===kc||this.serverStatus===Yi?this.registered=!1:this.serverStatus!==Vo||this.isRegistered()||(this.isProxy?(this.registered=!0,this.serverStatus="running"):await this.register())})}async register(){if(this.isRegistered()||this.isProxy)return;const t=this.type.toUpperCase(),n=Dn[t].REGISTER;try{const r=await this.request(n,this.options.metadata);if(r.error)throw Ss.fromJSON(r.error);if(!r.data.success)throw kt.client.registrationFailed(void 0,{description:"Failed to register client",subject:n,code:An.REGISTRATION_FAILED,metadata:{response:r,isProxy:this.isProxy,registered:this.registered,type:this.type,metadata:this.options.metadata}});this.serverMetadata=r.data.serverMetadata,this.registered=!0,this.serverStatus="running",No("Registration successful")}catch(r){throw this.registered=!1,kt.client.registrationFailed(r,{description:"Failed to register client",code:An.REGISTRATION_FAILED,subject:n,metadata:{isProxy:this.isProxy,registered:this.registered,type:this.type,metadata:this.options.metadata}})}}}Ti("camera:ui:connection:state");const Xn=tn(413)("camera:ui:client:instance");class Jg extends Wg{constructor(t,n){super(t,n);p(this,"type");p(this,"options");p(this,"status",Yi);p(this,"error");p(this,"metricsInterval");this.type=t,this.options=n,yo.validateConnectionOptions(n)}async start(){try{if(this.status===Vo)return;await this.connect(),this.setupSubscriptions(),this.options.metrics&&this.startMetricsInterval(),this.updateStatus(Vo),this.onStart(),Xn(`Client ${this.options.metadata.id} started successfully`)}catch(t){throw kt.connection.connectionFailed(t,{description:"Failed to start client",code:As.FAILED,metadata:{type:this.type,metadata:this.options.metadata}})}}async stop(){var t;try{if(this.status===Yi||this.status===kc)return;this.stopMetricsInterval(),this.updateStatus(kc),await((t=this.onBeforeStop)==null?void 0:t.call(this)),this.updateStatus(Yi),await this.disconnect();try{await async function(n,r,i,o){let a;const l=new Promise((u,d)=>{a=setTimeout(()=>{i==null||i(),d(new Error(o??`Operation timed out after ${r}ms`))},r)});try{const u=typeof n=="function"?n:()=>n;return await Promise.race([u(),l])}finally{clearTimeout(a)}}(this.onStop(),3e3,void 0,"Failed to stop client")}catch{}Xn(`Client ${this.options.metadata.name} stopped successfully`)}catch(n){throw kt.connection.connectionFailed(n,{description:"Failed to stop client",code:As.FAILED,metadata:{type:this.type,metadata:this.options.metadata}})}}getStatus(){return{id:this.options.metadata.id,type:this.type,state:this.status,error:this.error,metadata:this.options.metadata}}isRunning(){return this.status===Vo}setupSubscriptions(){this.subscribe(`${Dn.HEALTH.PING}.${this.type}.${this.options.metadata.id}`,async()=>{const t=this.type==="plugin"?Dn.PLUGIN.STATUS:Dn.SERVICE.STATUS;this.publish(`${t}.${this.options.metadata.id}`,this.getStatus().state)})}updateStatus(t,n){if(this.status!==t){this.status=t,this.error=n,Xn(`Client ${this.options.metadata.name} state changed to ${t}`);try{if(this.isConnected()){const r=this.type==="plugin"?Dn.PLUGIN.STATUS:Dn.SERVICE.STATUS;this.publish(`${r}.${this.options.metadata.id}`,this.getStatus().state)}else Xn("Skipping status update: Not connected to server")}catch(r){Xn("Failed to update state:",r)}}}startMetricsInterval(){this.stopMetricsInterval(),this.metricsInterval=setInterval(()=>{try{const t=this.aggregateMetrics(),n=`${Dn.METRICS.UPDATE}.${this.type}.${this.options.metadata.id}`;this.publish(n,t),Xn(`Published metrics for ${this.options.metadata.id}:`,t)}catch(t){Xn(`Failed to publish metrics for ${this.options.metadata.id}:`,t)}},Eg.METRICS)}stopMetricsInterval(){this.metricsInterval&&(clearInterval(this.metricsInterval),this.metricsInterval=void 0)}aggregateMetrics(){const t=this.getRPCConnectionManagers();Xn(`Aggregating metrics from connection managers: ${t.length}`);const n={timestamp:Date.now(),startTime:Math.min(...t.map(o=>o.getMetrics().startTime)),requests:{total:0,active:0,errors:0,perSecond:0,avgResponseTime:0},messages:{published:0,received:0,errors:0},rpc:{total:0,active:0,errors:0},subscriptions:{active:0,messageHandlers:0,requestHandlers:0,rpcHandlers:0}};let r=0,i=0;for(const o of t){const a=o.getMetrics();n.requests.total+=a.requests.total,n.requests.active+=a.requests.active,n.requests.errors+=a.requests.errors;const l=a.requests.total;l>0&&(r+=l,i+=a.requests.avgResponseTime*l,n.requests.perSecond+=a.requests.perSecond),n.messages.published+=a.messages.published,n.messages.received+=a.messages.received,n.messages.errors+=a.messages.errors,n.rpc.total+=a.rpc.total,n.rpc.active+=a.rpc.active,n.rpc.errors+=a.rpc.errors,n.subscriptions.active+=a.subscriptions.active,n.subscriptions.messageHandlers+=a.subscriptions.messageHandlers,n.subscriptions.requestHandlers+=a.subscriptions.requestHandlers,n.subscriptions.rpcHandlers+=a.subscriptions.rpcHandlers}return r>0&&(n.requests.avgResponseTime=i/r),n.requests.perSecond=n.requests.perSecond/t.length,n}}class Yg extends Jg{constructor(e){super("service",e)}async onStart(){console.log("Proxy started")}async onStop(){console.log("Proxy stopped")}}class Xg{constructor(){p(this,"subscriptions",[]);p(this,"additionalSubscriptions",[])}addSubscriptions(...e){this.subscriptions.push(...e)}addAdditionalSubscriptions(...e){this.additionalSubscriptions.push(...e)}unsubscribe(){this.subscriptions.forEach(e=>e.unsubscribe())}unsubscribeAdditional(){this.additionalSubscriptions.forEach(e=>e.unsubscribe())}}function di(s,e,t=!1){if(s===e)return!0;if((s===void 0||e===void 0||s===null||e===null)&&(s||e))return!1;const n=s==null?void 0:s.constructor.name,r=e==null?void 0:e.constructor.name;if(n!==r)return!1;if(n==="Array"&&r==="Array"){if(s.length!==e.length)return!1;if(t){const i=[...e];return s.every(o=>{const a=i.findIndex(l=>di(o,l,t));return a!==-1&&(i.splice(a,1),!0)})}{let i=!0;for(let o=0;o<s.length;o++)if(!di(s[o],e[o],t)){i=!1;break}return i}}if(n==="Object"&&r==="Object"){let i=!0;const o=Object.keys(s),a=Object.keys(e);if(o.length!==a.length)return!1;for(let l=0;l<o.length;l++)if(s[o[l]]&&e[o[l]]){if(s[o[l]]===e[o[l]])continue;if(!s[o[l]]||s[o[l]].constructor.name!=="Array"&&s[o[l]].constructor.name!=="Object"){if(s[o[l]]!==e[o[l]]){i=!1;break}}else if(i=di(s[o[l]],e[o[l]],t),!i)break}else if(s[o[l]]&&!e[o[l]]||!s[o[l]]&&e[o[l]]){i=!1;break}return i}return s===e}function Ks(s){return JSON.parse(JSON.stringify(s))}var Jt,ld,ud;(function(s){s.MotionSensor="MotionSensor",s.MotionDetector="MotionDetector",s.AudioSensor="AudioSensor",s.ObjectSensor="ObjectSensor",s.ObjectDetector="ObjectDetector",s.Light="Light",s.Siren="Siren",s.Doorbell="Doorbell",s.Battery="Battery",s.PTZ="PTZ",s.PTZZoom="PTZZoom",s.PTZHome="PTZHome",s.PTZPresets="PTZPresets",s.Snapshot="Snapshot",s.StreamUrl="StreamUrl",s.Reboot="Reboot"})(Jt||(Jt={})),function(s){s.Opened="Opened",s.Closed="Closed",s.Jammed="Jammed",s.Unknown="Unknown"}(ld||(ld={})),function(s){s.MotionDetector="MotionDetector",s.ObjectDetector="ObjectDetector",s.AudioDetector="AudioDetector"}(ud||(ud={}));var ev=tn(672),tv=tn.n(ev),Tc=function(s,e){return Tc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},Tc(s,e)};function zr(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=s}Tc(s,e),s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function sv(s,e,t,n){return new(t||(t=Promise))(function(r,i){function o(u){try{l(n.next(u))}catch(d){i(d)}}function a(u){try{l(n.throw(u))}catch(d){i(d)}}function l(u){var d;u.done?r(u.value):(d=u.value,d instanceof t?d:new t(function(h){h(d)})).then(o,a)}l((n=n.apply(s,[])).next())})}function km(s,e){var t,n,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return function(d){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(i=0)),i;)try{if(t=1,n&&(r=2&d[0]?n.return:d[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,d[1])).done)return r;switch(n=0,r&&(d=[2&d[0],r.value]),d[0]){case 0:case 1:r=d;break;case 4:return i.label++,{value:d[1],done:!1};case 5:i.label++,n=d[1],d=[0];continue;case 7:d=i.ops.pop(),i.trys.pop();continue;default:if(r=i.trys,!((r=r.length>0&&r[r.length-1])||d[0]!==6&&d[0]!==2)){i=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]<r[3])){i.label=d[1];break}if(d[0]===6&&i.label<r[1]){i.label=r[1],r=d;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(d);break}r[2]&&i.ops.pop(),i.trys.pop();continue}d=e.call(s,i)}catch(h){d=[6,h],n=0}finally{t=r=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([l,u])}}}function ro(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],n=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&n>=s.length&&(s=void 0),{value:s&&s[n++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ma(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var n,r,i=t.call(s),o=[];try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){r={error:a}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}return o}function pa(s,e,t){if(arguments.length===2)for(var n,r=0,i=e.length;r<i;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return s.concat(n||Array.prototype.slice.call(e))}function hi(s){return this instanceof hi?(this.v=s,this):new hi(s)}function nv(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t.apply(s,e||[]),i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(h){return function(v){return Promise.resolve(v).then(h,u)}}),n[Symbol.asyncIterator]=function(){return this},n;function o(h,v){r[h]&&(n[h]=function(f){return new Promise(function(b,k){i.push([h,f,b,k])>1||a(h,f)})},v&&(n[h]=v(n[h])))}function a(h,v){try{(function(f){f.value instanceof hi?Promise.resolve(f.value.v).then(l,u):d(i[0][2],f)})(r[h](v))}catch(f){d(i[0][3],f)}}function l(h){a("next",h)}function u(h){a("throw",h)}function d(h,v){h(v),i.shift(),i.length&&a(i[0][0],i[0][1])}}function rv(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,t=s[Symbol.asyncIterator];return t?t.call(s):(s=ro(s),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=s[r]&&function(i){return new Promise(function(o,a){(function(l,u,d,h){Promise.resolve(h).then(function(v){l({value:v,done:d})},u)})(o,a,(i=s[r](i)).done,i.value)})}}}function Is(s){return typeof s=="function"}function Em(s){var e=s(function(t){Error.call(t),t.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var ec=Em(function(s){return function(e){s(this),this.message=e?e.length+` errors occurred during unsubscription:
30
- `+e.map(function(t,n){return n+1+") "+t.toString()}).join(`
31
- `):"",this.name="UnsubscriptionError",this.errors=e}});function Pc(s,e){if(s){var t=s.indexOf(e);0<=t&&s.splice(t,1)}}var Ia=function(){function s(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return s.prototype.unsubscribe=function(){var t,n,r,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var l=ro(a),u=l.next();!u.done;u=l.next())u.value.remove(this)}catch(k){t={error:k}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else a.remove(this);var d=this.initialTeardown;if(Is(d))try{d()}catch(k){o=k instanceof ec?k.errors:[k]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var v=ro(h),f=v.next();!f.done;f=v.next()){var b=f.value;try{dd(b)}catch(k){o=o??[],k instanceof ec?o=pa(pa([],ma(o)),ma(k.errors)):o.push(k)}}}catch(k){r={error:k}}finally{try{f&&!f.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}}if(o)throw new ec(o)}},s.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)dd(t);else{if(t instanceof s){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},s.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},s.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},s.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Pc(n,t)},s.prototype.remove=function(t){var n=this._finalizers;n&&Pc(n,t),t instanceof s&&t._removeParent(this)},s.EMPTY=((e=new s).closed=!0,e),s}(),Am=Ia.EMPTY;function Mm(s){return s instanceof Ia||s&&"closed"in s&&Is(s.remove)&&Is(s.add)&&Is(s.unsubscribe)}function dd(s){Is(s)?s():s.unsubscribe()}var iv={Promise:void 0},ov={setTimeout:function(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setTimeout.apply(void 0,pa([s,e],ma(t)))},clearTimeout:function(s){return clearTimeout(s)},delegate:void 0};function $m(s){ov.setTimeout(function(){throw s})}function hd(){}function Ko(s){s()}var xl=function(s){function e(t){var n=s.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Mm(t)&&t.add(n)):n.destination=cv,n}return zr(e,s),e.create=function(t,n,r){return new io(t,n,r)},e.prototype.next=function(t){this.isStopped?void 0:this._next(t)},e.prototype.error=function(t){this.isStopped?void 0:(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?void 0:(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ia),av=function(){function s(e){this.partialObserver=e}return s.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Fo(n)}},s.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Fo(n)}else Fo(e)},s.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Fo(t)}},s}(),io=function(s){function e(t,n,r){var i,o=s.call(this)||this;return Is(t)||!t?i={next:t??void 0,error:n??void 0,complete:r??void 0}:i=t,o.destination=new av(i),o}return zr(e,s),e}(xl);function Fo(s){$m(s)}var cv={closed:!0,next:hd,error:function(s){throw s},complete:hd},Rc=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Tm(s){return s}function lv(s){return s.length===0?Tm:s.length===1?s[0]:function(e){return s.reduce(function(t,n){return n(t)},e)}}var ir=function(){function s(e){e&&(this._subscribe=e)}return s.prototype.lift=function(e){var t=new s;return t.source=this,t.operator=e,t},s.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof xl||function(a){return a&&Is(a.next)&&Is(a.error)&&Is(a.complete)}(r)&&Mm(r)?e:new io(e,t,n);return Ko(function(){var a=i,l=a.operator,u=a.source;o.add(l?l.call(o,u):u?i._subscribe(o):i._trySubscribe(o))}),o},s.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},s.prototype.forEach=function(e,t){var n=this;return new(t=md(t))(function(r,i){var o=new io({next:function(a){try{e(a)}catch(l){i(l),o.unsubscribe()}},error:i,complete:r});n.subscribe(o)})},s.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},s.prototype[Rc]=function(){return this},s.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return lv(e)(this)},s.prototype.toPromise=function(e){var t=this;return new(e=md(e))(function(n,r){var i;t.subscribe(function(o){return i=o},function(o){return r(o)},function(){return n(i)})})},s.create=function(e){return new s(e)},s}();function md(s){var e;return(e=s??iv.Promise)!==null&&e!==void 0?e:Promise}var uv=Em(function(s){return function(){s(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Oa=function(s){function e(){var t=s.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return zr(e,s),e.prototype.lift=function(t){var n=new pd(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new uv},e.prototype.next=function(t){var n=this;Ko(function(){var r,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var o=ro(n.currentObservers),a=o.next();!a.done;a=o.next())a.value.next(t)}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}})},e.prototype.error=function(t){var n=this;Ko(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var r=n.observers;r.length;)r.shift().error(t)}})},e.prototype.complete=function(){var t=this;Ko(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),s.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,r=this,i=r.hasError,o=r.isStopped,a=r.observers;return i||o?Am:(this.currentObservers=null,a.push(t),new Ia(function(){n.currentObservers=null,Pc(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,r=n.hasError,i=n.thrownError,o=n.isStopped;r?t.error(i):o&&t.complete()},e.prototype.asObservable=function(){var t=new ir;return t.source=this,t},e.create=function(t,n){return new pd(t,n)},e}(ir),pd=function(s){function e(t,n){var r=s.call(this)||this;return r.destination=t,r.source=n,r}return zr(e,s),e.prototype.next=function(t){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.next)===null||r===void 0||r.call(n,t)},e.prototype.error=function(t){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.error)===null||r===void 0||r.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,r;return(r=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&r!==void 0?r:Am},e}(Oa),gn=function(s){function e(t){var n=s.call(this)||this;return n._value=t,n}return zr(e,s),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=s.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,r=t.thrownError,i=t._value;if(n)throw r;return this._throwIfClosed(),i},e.prototype.next=function(t){s.prototype.next.call(this,this._value=t)},e}(Oa),Pm={now:function(){return(Pm.delegate||Date).now()},delegate:void 0},Lo=function(s){function e(t,n,r){t===void 0&&(t=1/0),n===void 0&&(n=1/0),r===void 0&&(r=Pm);var i=s.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return zr(e,s),e.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;r||(i.push(t),!o&&i.push(a.now()+l)),this._trimBuffer(),s.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),r=this._infiniteTimeWindow,i=this._buffer.slice(),o=0;o<i.length&&!t.closed;o+=r?1:2)t.next(i[o]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,r=t._timestampProvider,i=t._buffer,o=t._infiniteTimeWindow,a=(o?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!o){for(var l=r.now(),u=0,d=1;d<i.length&&i[d]<=l;d+=2)u=d;u&&i.splice(0,u+1)}},e}(Oa);function Ri(s){return function(e){if(function(t){return Is(t==null?void 0:t.lift)}(e))return e.lift(function(t){try{return s(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function _i(s,e,t,n,r){return new dv(s,e,t,n,r)}var dv=function(s){function e(t,n,r,i,o,a){var l=s.call(this,t)||this;return l.onFinalize=o,l.shouldUnsubscribe=a,l._next=n?function(u){try{n(u)}catch(d){t.error(d)}}:s.prototype._next,l._error=i?function(u){try{i(u)}catch(d){t.error(d)}finally{this.unsubscribe()}}:s.prototype._error,l._complete=r?function(){try{r()}catch(u){t.error(u)}finally{this.unsubscribe()}}:s.prototype._complete,l}return zr(e,s),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;s.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(xl);function tc(){return Ri(function(s,e){var t,n=!1;s.subscribe(_i(e,function(r){var i=t;t=r,n&&e.next([i,r]),n=!0}))})}function sc(s,e){return Ri(function(t,n){var r=0;t.subscribe(_i(n,function(i){return s.call(e,i,r++)&&n.next(i)}))})}function Ic(s,e){return Ri(function(t,n){var r=0;t.subscribe(_i(n,function(i){n.next(s.call(e,i,r++))}))})}var hv=typeof Symbol=="function"&&Symbol.iterator?Symbol.iterator:"@@iterator";function fa(s){if(s instanceof ir)return s;if(s!=null){if(function(o){return Is(o[Rc])}(s))return i=s,new ir(function(o){var a=i[Rc]();if(Is(a.subscribe))return a.subscribe(o);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(function(o){return o&&typeof o.length=="number"&&typeof o!="function"}(s))return r=s,new ir(function(o){for(var a=0;a<r.length&&!o.closed;a++)o.next(r[a]);o.complete()});if(Is((n=s)==null?void 0:n.then))return t=s,new ir(function(o){t.then(function(a){o.closed||(o.next(a),o.complete())},function(a){return o.error(a)}).then(null,$m)});if(function(o){return Symbol.asyncIterator&&Is(o==null?void 0:o[Symbol.asyncIterator])}(s))return fd(s);if(function(o){return Is(o==null?void 0:o[hv])}(s))return e=s,new ir(function(o){var a,l;try{for(var u=ro(e),d=u.next();!d.done;d=u.next()){var h=d.value;if(o.next(h),o.closed)return}}catch(v){a={error:v}}finally{try{d&&!d.done&&(l=u.return)&&l.call(u)}finally{if(a)throw a.error}}o.complete()});if(function(o){return Is(o==null?void 0:o.getReader)}(s))return fd(function(o){return nv(this,arguments,function(){var a,l,u;return km(this,function(d){switch(d.label){case 0:a=o.getReader(),d.label=1;case 1:d.trys.push([1,,9,10]),d.label=2;case 2:return[4,hi(a.read())];case 3:return l=d.sent(),u=l.value,l.done?[4,hi(void 0)]:[3,5];case 4:return[2,d.sent()];case 5:return[4,hi(u)];case 6:return[4,d.sent()];case 7:return d.sent(),[3,2];case 8:return[3,10];case 9:return a.releaseLock(),[7];case 10:return[2]}})})}(s))}var e,t,n,r,i;throw function(o){return new TypeError("You provided "+(o!==null&&typeof o=="object"?"an invalid object":"'"+o+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(s)}function fd(s){return new ir(function(e){(function(t,n){var r,i,o,a;return sv(this,void 0,void 0,function(){var l,u;return km(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),r=rv(t),d.label=1;case 1:return[4,r.next()];case 2:if((i=d.sent()).done)return[3,4];if(l=i.value,n.next(l),n.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=d.sent(),o={error:u},[3,11];case 6:return d.trys.push([6,,9,10]),i&&!i.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})})(s,e).catch(function(t){return e.error(t)})})}function jo(s){s===void 0&&(s={});var e=s.connector,t=e===void 0?function(){return new Oa}:e,n=s.resetOnError,r=n===void 0||n,i=s.resetOnComplete,o=i===void 0||i,a=s.resetOnRefCountZero,l=a===void 0||a;return function(u){var d,h,v,f=0,b=!1,k=!1,z=function(){h==null||h.unsubscribe(),h=void 0},L=function(){z(),d=v=void 0,b=k=!1},se=function(){var Z=d;L(),Z==null||Z.unsubscribe()};return Ri(function(Z,N){f++,k||b||z();var E=v=v??t();N.add(function(){--f!==0||k||b||(h=nc(se,l))}),E.subscribe(N),!d&&f>0&&(d=new io({next:function(O){return E.next(O)},error:function(O){k=!0,z(),h=nc(L,r,O),E.error(O)},complete:function(){b=!0,z(),h=nc(L,o),E.complete()}}),fa(Z).subscribe(d))})(u)}}function nc(s,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];if(e!==!0){if(e!==!1){var r=new io({next:function(){r.unsubscribe(),s()}});return fa(e.apply(void 0,pa([],ma(t)))).subscribe(r)}}else s()}function Rm(s,e,t){return t===void 0&&(t=1/0),Is(e)?Rm(function(n,r){return Ic(function(i,o){return e(n,i,r,o)})(fa(s(n,r)))},t):(typeof e=="number"&&(t=e),Ri(function(n,r){return function(i,o,a,l,u,d,h,v){var f=[],b=0,k=0,z=!1,L=function(){!z||f.length||b||o.complete()},se=function(N){return b<l?Z(N):f.push(N)},Z=function(N){d&&o.next(N),b++;var E=!1;fa(a(N,k++)).subscribe(_i(o,function(O){u==null||u(O),d?se(O):o.next(O)},function(){E=!0},void 0,function(){if(E)try{b--;for(var O=function(){var U=f.shift();h?function(S,M,B,K,R){K===void 0&&(K=0),R===void 0&&(R=!1);var w=M.schedule(function(){B(),R?S.add(this.schedule(null,K)):this.unsubscribe()},K);S.add(w)}(o,h,function(){return Z(U)}):Z(U)};f.length&&b<l;)O();L()}catch(U){o.error(U)}}))};return i.subscribe(_i(o,se,function(){z=!0,L()})),function(){v==null||v()}}(n,r,s,t)}))}function mv(s,e){return s===e}const pv=s=>s==="person"?"person":s==="motion"?"motion":new Set(["bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","teddy bear"]).has(s)?"animal":new Set(["bicycle","car","motorcycle","airplane","bus","train","truck","boat"]).has(s)?"vehicle":"other";function gd(s){return s.map(e=>({...e,label:pv(e.label)}))}class fv{constructor(e=100){p(this,"cells",new Map);p(this,"cellSize");this.cellSize=e}insert(e){const t=e.boundingBox,n=this.getCellsForBox(t);for(const r of n)this.cells.has(r)||this.cells.set(r,[]),this.cells.get(r).push(e)}search(e,t=0){const n=this.getCellsForBox(e,t),r=new Set;for(const i of n){const o=this.cells.get(i)??[];for(const a of o)r.add(a)}return Array.from(r)}getCellsForBox(e,t=0){const n=Math.floor((e[0]-t)/this.cellSize),r=Math.floor((e[1]-t)/this.cellSize),i=Math.floor((e[2]+t)/this.cellSize),o=Math.floor((e[3]+t)/this.cellSize),a=[];for(let l=n;l<=i;l++)for(let u=r;u<=o;u++)a.push(`${l},${u}`);return a}}function gv(s,e){const t=Math.max(s[0],e[0]),n=Math.max(s[1],e[1]),r=Math.min(s[2],e[2]),i=Math.min(s[3],e[3]);if(r<t||i<n)return 0;const o=(r-t)*(i-n);return o/((s[2]-s[0])*(s[3]-s[1])+(e[2]-e[0])*(e[3]-e[1])-o)}function vd(s){return s[0]<s[2]&&s[1]<s[3]}function _d(s,e=.01,t=100){if(s.length===0)return[];const n=new fv(t),r=new Set,i=[],o=s.map(l=>({...l,id:l.id??Math.random().toString(36).slice(2,9)}));for(const l of o)n.insert(l);for(const l of o){if(r.has(l.id))continue;const u={...l};let d=u.confidence;const h=[u.boundingBox],v=Math.max(t,10),f=n.search(u.boundingBox,v);for(const b of f){if(b.id===u.id||r.has(b.id)||b.label!==u.label)continue;const k=gv(u.boundingBox,b.boundingBox),z=Math.abs(u.boundingBox[0]-b.boundingBox[0])<=t&&Math.abs(u.boundingBox[1]-b.boundingBox[1])<=t;(k>e||z)&&(h.push(b.boundingBox),r.add(b.id),d=Math.max(d,b.confidence))}if(h.length>1){const b=(a=h,[Math.max(0,Math.round(Math.min(...a.map(k=>k[0])))),Math.max(0,Math.round(Math.min(...a.map(k=>k[1])))),Math.min(1e3,Math.round(Math.max(...a.map(k=>k[2])))),Math.min(1e3,Math.round(Math.max(...a.map(k=>k[3]))))]);vd(b)&&(u.boundingBox=b,u.confidence=d)}vd(u.boundingBox)&&i.push(u),r.add(u.id)}var a;return i}function yd(s,e){return[[s[0],s[1]],[s[2],s[1]],[s[2],s[3]],[s[0],s[3]]].every(t=>Sl(t,e))}function vv(s,e){const t=[[s[0],s[1]],[s[2],s[1]],[s[2],s[3]],[s[0],s[3]]];return!Im(s,e)&&t.every(n=>!Sl(n,e))}function Sl(s,e){const[t,n]=s;let r=!1;for(let i=0;i<e.length;i++){const o=(i+1)%e.length,[a,l]=e[i],[u,d]=e[o];if(t>=Math.min(a,u)&&t<=Math.max(a,u)&&n>=Math.min(l,d)&&n<=Math.max(l,d))if(Math.abs(a-u)<1e-6){if(Math.abs(t-a)<1e-6)return!0}else{const h=(d-l)/(u-a),v=h*t+(l-h*a);if(Math.abs(n-v)<1e-6)return!0}l>n!=d>n&&t<(u-a)*(n-l)/(d-l)+a&&(r=!r)}return r}function _v(s,e,t,n){const r=(n[1]-t[1])*(e[0]-s[0])-(n[0]-t[0])*(e[1]-s[1]);if(r===0)return!1;const i=((n[0]-t[0])*(s[1]-t[1])-(n[1]-t[1])*(s[0]-t[0]))/r,o=((e[0]-s[0])*(s[1]-t[1])-(e[1]-s[1])*(s[0]-t[0]))/r;return i>=0&&i<=1&&o>=0&&o<=1}function Im(s,e){const t=[[s[0],s[1]],[s[2],s[1]],[s[2],s[3]],[s[0],s[3]],[s[0],s[1]]];if(t.some(n=>Sl(n,e))||e.some(n=>n[0]>=s[0]&&n[0]<=s[2]&&n[1]>=s[1]&&n[1]<=s[3]))return!0;for(let n=0;n<t.length-1;n++)for(let r=0;r<e.length-1;r++)if(_v(t[n],t[n+1],e[r],e[r+1]))return!0;return!1}const bd=(s,e)=>{const{origWidth:t,origHeight:n}=e,r=s.points.map(([a,l])=>[a*t/100,l*n/100]);var i,o;return r.length>0&&(i=r[0],o=r[r.length-1],i[0]!==o[0]||i[1]!==o[1])&&r.push(r[0]),{...s,points:r}},wd=(s,e,t)=>{if(e.length===0)return[];if(s.length===0)return[];const n=new Set;for(const r of e)r.classes.length>0&&r.classes.forEach(i=>n.add(i));return s.filter(r=>{if(r.confidence<t.object.confidence||!n.has(r.label))return!1;const i=(l=>{const{origWidth:u,origHeight:d,inputWidth:h,inputHeight:v}=l;let[f,b,k,z]=l.boundingBox;return f=f*u/h,b=b*d/v,k=k*u/h,z=z*d/v,f=Math.max(0,Math.min(f,u)),b=Math.max(0,Math.min(b,d)),k=Math.max(0,Math.min(k,u)),z=Math.max(0,Math.min(z,d)),{...l,boundingBox:[f,b,k,z]}})(r);for(const l of e){if(!l.isPrivacyMask)continue;const u=bd(l,i);if(yd(i.boundingBox,u.points))return!1}let o=!1,a=!1;for(const l of e){if(l.isPrivacyMask||!l.classes.includes(r.label))continue;const u=bd(l,i),d=Im(i.boundingBox,u.points),h=yd(i.boundingBox,u.points);if(l.filter==="include"){if(o=!0,l.type==="contain"&&h||l.type==="intersect"&&(d||h)){a=!0;break}}else if(l.type==="contain"){if(!vv(i.boundingBox,u.points))return!1}else if(d||h)return!1}return!o||a})};var tt,Zo,Go,Wo,Jo,Yo,Xo,ea,Oc,sr,En;class yv extends Xg{constructor(t,n){super();Jn(this,tt);p(this,"logger");p(this,"snapshotCache");p(this,"cameraSubject");p(this,"cameraState",new gn(!1));p(this,"frameWorkerState",new gn(!1));p(this,"lightState",new gn(gt(this,tt,Yo).call(this,{state:!1},!0)));p(this,"motionState",new gn(gt(this,tt,Go).call(this,{detections:[],state:!1},!0)));p(this,"audioState",new gn(gt(this,tt,Zo).call(this,{state:!1,db:0},!0)));p(this,"objectState",new gn(gt(this,tt,Wo).call(this,{detections:[]},!0)));p(this,"doorbellState",new gn(gt(this,tt,Jo).call(this,{state:!1},!0)));p(this,"sirenState",new gn(gt(this,tt,Xo).call(this,{state:!1,level:0},!0)));p(this,"batteryState",new gn(gt(this,tt,ea).call(this,{level:100,charging:!1,lowBattery:!1},!0)));p(this,"capabilities",new gn([]));p(this,"onConnected",gt(this,tt,En).call(this,this.cameraState));p(this,"onFrameWorkerConnected",gt(this,tt,En).call(this,this.frameWorkerState));p(this,"onLightSwitched",gt(this,tt,En).call(this,this.lightState));p(this,"onMotionDetected",gt(this,tt,En).call(this,this.motionState));p(this,"onAudioDetected",gt(this,tt,En).call(this,this.audioState));p(this,"onObjectDetected",gt(this,tt,En).call(this,this.objectState));p(this,"onDoorbellPressed",gt(this,tt,En).call(this,this.doorbellState));p(this,"onSirenDetected",gt(this,tt,En).call(this,this.sirenState));p(this,"onBatteryChanged",gt(this,tt,En).call(this,this.batteryState));this.logger=n,this.cameraSubject=new gn(t),this.snapshotCache=new(tv())({max:100,ttl:1e3*this.snapshotTTL}),t.pluginInfo||this.cameraState.next(!0)}get cameraObject(){return Ks(this.cameraSubject.getValue())}get id(){return this.cameraSubject.getValue()._id}get nativeId(){return this.cameraSubject.getValue().nativeId}get pluginInfo(){return this.cameraSubject.getValue().pluginInfo}get connected(){return this.cameraState.getValue()}get frameWorkerConnected(){return this.frameWorkerState.getValue()}get disabled(){return this.cameraSubject.getValue().disabled}get name(){return this.cameraSubject.getValue().name}get type(){return this.cameraSubject.getValue().type}get info(){return Ks(this.cameraSubject.getValue().info)}get isCloud(){return this.cameraSubject.getValue().isCloud}get hasLight(){return this.hasCapability(Jt.Light)}get hasSiren(){return this.hasCapability(Jt.Siren)}get hasDoorbell(){return this.hasCapability(Jt.Doorbell)}get hasBattery(){return this.hasCapability(Jt.Battery)}get hasAudioDetector(){return this.hasCapability(Jt.AudioSensor)}get hasMotionDetector(){return this.hasCapability(Jt.MotionSensor)||this.hasCapability(Jt.MotionDetector)}get hasObjectDetector(){return this.hasCapability(Jt.ObjectSensor)||this.hasCapability(Jt.ObjectDetector)}get hasPtz(){return this.hasCapability(Jt.PTZ)}get snapshotTTL(){return this.cameraSubject.getValue().snapshotTTL}get detectionZones(){return Ks(this.cameraSubject.getValue().detectionZones)}get detectionSettings(){return Ks(this.cameraSubject.getValue().detectionSettings)}get frameWorkerSettings(){return Ks(this.cameraSubject.getValue().frameWorkerSettings)}get streamSource(){return this.highResolutionSource??this.midResolutionSource??this.lowResolutionSource}get snapshotSource(){return this.sources.find(t=>t.role=="snapshot")??this.sources.find(t=>t.useForSnapshot)}get highResolutionSource(){return this.sources.find(t=>t.role==="high-resolution")}get midResolutionSource(){return this.sources.find(t=>t.role==="mid-resolution")}get lowResolutionSource(){return this.sources.find(t=>t.role==="low-resolution")}get interfaces(){return this.cameraInterfaces}getCapabilities(){return Ks(this.capabilities.getValue().map(t=>t.capabilities).flat())}hasCapability(t){return this.getCapabilities().some(n=>n===t)}getValue(t){switch(t){case"light":return Ks(this.lightState.getValue());case"motion":return Ks(this.motionState.getValue());case"audio":return Ks(this.audioState.getValue());case"object":return Ks(this.objectState.getValue());case"doorbell":return Ks(this.doorbellState.getValue());case"siren":return Ks(this.sirenState.getValue());case"battery":return Ks(this.batteryState.getValue());default:throw new Error(`Unknown state: ${t}`)}}onStateChange(t){return this[`${t}State`].pipe(tc(),sc(([n,r])=>this.stateChanged(n,r,t)),Ic(([n,r])=>({oldState:n,newState:r})),jo({connector:()=>new Lo(1)}))}onPropertyChange(t){return this.cameraSubject.pipe(tc(),Rm(([n,r])=>(Array.isArray(t)?t:[t]).map(i=>({property:i,oldData:n[i],newData:r[i]}))),sc(({oldData:n,newData:r})=>!di(n,r,!0)),jo({connector:()=>new Lo(1)}))}onCapabilitiesChange(){return this.capabilities.pipe(tc(),sc(([t,n])=>!di(t,n,!0)),Ic(([t,n])=>({oldCapabilities:t.map(r=>r.capabilities).flat(),newCapabilities:n.map(r=>r.capabilities).flat()})),jo({connector:()=>new Lo(1)}))}removeAllListeners(){this.lightState.complete(),this.motionState.complete(),this.audioState.complete(),this.objectState.complete(),this.doorbellState.complete(),this.sirenState.complete(),this.batteryState.complete(),this.cameraSubject.complete(),this.cameraState.complete(),this.frameWorkerState.complete(),this.capabilities.complete(),this.snapshotCache.clear()}updateCamera(t){t.snapshotTTL!==this.snapshotTTL&&this.snapshotCache.clear(),this.cameraSubject.next(t)}updateCameraState(t){this.cameraState.next(t)}updateFrameWorkerState(t){this.frameWorkerState.next(t)}updateCapabilities(t){this.capabilities.next(t)}updateStateInternal(t,n,r,i){let o,a=!1;if(r)a=!0,o=n;else{const l=this.checkStateInternal(t,n,i);a=l.changed,o=l.event}if(a)switch(t){case"light":this.lightState.next(gt(this,tt,Yo).call(this,o));break;case"motion":this.motionState.next(gt(this,tt,Go).call(this,o));break;case"audio":this.audioState.next(gt(this,tt,Zo).call(this,o));break;case"object":this.objectState.next(gt(this,tt,Wo).call(this,o));break;case"doorbell":this.doorbellState.next(gt(this,tt,Jo).call(this,o));break;case"siren":this.sirenState.next(gt(this,tt,Xo).call(this,o));break;case"battery":this.batteryState.next(gt(this,tt,ea).call(this,o))}}checkStateInternal(t,n,r){let i,o=!1;switch(t){case"audio":const a=n;i=gt(this,tt,Zo).call(this,a),o=this.stateChanged(this.getValue("audio"),i,"audio");break;case"light":const l=n;i=gt(this,tt,Yo).call(this,l),o=this.stateChanged(this.getValue("light"),i,"light");break;case"motion":const u=n;if(u.state||(u.detections=[]),!r&&u.detections){const b=u.detections.length>0;u.detections=gd(u.detections),u.detections=_d(u.detections),u.detections=wd(u.detections,this.detectionZones,this.detectionSettings),b&&u.detections.length===0&&(u.state=!1)}i=gt(this,tt,Go).call(this,u),o=this.stateChanged(this.getValue("motion"),i,"motion");break;case"object":const d=n;r||(d.detections=gd(d.detections),d.detections=_d(d.detections),d.detections=wd(d.detections,this.detectionZones,this.detectionSettings)),i=gt(this,tt,Wo).call(this,d),o=this.stateChanged(this.getValue("object"),i,"object");break;case"doorbell":const h=n;i=gt(this,tt,Jo).call(this,h),o=this.stateChanged(this.getValue("doorbell"),i,"doorbell");break;case"siren":const v=n;i=gt(this,tt,Xo).call(this,v),o=this.stateChanged(this.getValue("siren"),i,"siren");break;case"battery":const f=n;i=gt(this,tt,ea).call(this,f),o=this.stateChanged(this.getValue("battery"),i,"battery");break;default:throw new Error(`Unknown state: ${t}`)}return{changed:o,event:i}}stateChanged(t,n,r){return t===void 0||n===void 0||r===void 0||r==="audio"&&!this.hasAudioDetector||r==="motion"&&!this.hasMotionDetector||r==="object"&&!this.hasObjectDetector||r==="siren"&&!this.hasSiren||r==="battery"&&!this.hasBattery||r==="doorbell"&&!this.hasDoorbell||r==="light"&&!this.hasLight?!1:!di(gt(this,tt,Oc).call(this,t),gt(this,tt,Oc).call(this,n),!0)}}tt=new WeakSet,Zo=function(t,n=!1){let r,i;if(n||(r=this.getValue("audio"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t))i=t;else{const o={...t,timestamp:Date.now()};i={...o,db:o.db??(r==null?void 0:r.db)??0,lastEvent:r}}return i},Go=function(t,n=!1){let r,i;return n||(r=this.getValue("motion"),r!=null&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t)?i=t:i={...t,timestamp:Date.now(),lastEvent:r},i},Wo=function(t,n=!1){let r,i;return n||(r=this.getValue("object"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t)?i=t:i={...t,timestamp:Date.now(),lastEvent:r},i},Jo=function(t,n=!1){let r,i;return n||(r=this.getValue("doorbell"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t)?i=t:i={...t,timestamp:Date.now(),lastEvent:r},i},Yo=function(t,n=!1){let r,i;return n||(r=this.getValue("light"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t)?i=t:i={...t,timestamp:Date.now(),lastEvent:r},i},Xo=function(t,n=!1){let r,i;if(n||(r=this.getValue("siren"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t))i=t;else{const o={...t,timestamp:Date.now()};i={...o,level:o.level??(r==null?void 0:r.level)??0,lastEvent:r}}return i},ea=function(t,n=!1){let r,i;return n||(r=this.getValue("battery"),r&&r.lastEvent&&delete r.lastEvent),gt(this,tt,sr).call(this,t)?i=t:i={...t,timestamp:Date.now(),charging:t.charging??(r==null?void 0:r.charging)??!1,lowBattery:t.lowBattery??(r==null?void 0:r.lowBattery)??!1,lastEvent:r},i},Oc=function(t){const n=Ks(t);return"timestamp"in n&&delete n.timestamp,"lastEvent"in n&&delete n.lastEvent,n},sr=function(t){return"timestamp"in t},En=function(t){return t.pipe((r===void 0&&(r=Tm),n=n??mv,Ri(function(i,o){var a,l=!0;i.subscribe(_i(o,function(u){var d=r(u);!l&&n(a,d)||(l=!1,a=d,o.next(u))}))})),jo({connector:()=>new Lo(1)}));var n,r};class oo{static coreManagerNamespaces(){return{coreManagerSubject:"coreManager.subscriber",coreManagerRpc:"coreManager.rpc"}}static deviceManagerNamespaces(){return{deviceManagerSubject:"deviceManager.subscriber",deviceManagerRpc:"deviceManager.rpc"}}static frameWorkerNamespaces(e){return{frameWorkerChildRpc:`camera.${e}.frameWorker.child.rpc`,frameWorkerChild:`camera.${e}.frameWorker.child`}}static pluginNamespaces(e){return{pluginDeviceManagerSubject:`plugin.${e}.deviceManager.subscriber`,pluginChildRpc:`plugin.${e}.child.rpc`,pluginChild:`plugin.${e}.child`,pluginStorageRpc:`plugin.${e}.storage.rpc`}}static cameraNamespaces(e){return{cameraSubject:`camera.${e}.subscriber`,cameraMotionFrameSubject:`camera.${e}.motionFrame.subscriber`,cameraControllerRpc:`camera.${e}.controller.rpc`}}static pluginCameraNamespaces(e,t){return{cameraInterfacesRpc:`plugin.${e}.camera.${t}.cameraInterfaces.rpc`,cameraStorageRpc:`plugin.${e}.camera.${t}.cameraStorage.rpc`}}}var rc=function(s,e,t,n){var r,i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,n);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(i<3?r(o):i>3?r(e,t,o):r(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ln=function(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)},ho,Mr,mo,po,$r,mi,sa;class ta{constructor(e,t,n,r){Jn(this,mi);p(this,"interfaces");Jn(this,ho);Jn(this,Mr);Jn(this,mo);Jn(this,po);Jn(this,$r,[]);Gr(this,ho,e),Gr(this,Mr,t),Gr(this,mo,n),Gr(this,po,r)}async streamUrl(e){const t=kn(this,Mr).getValue().find(n=>n.capabilities.some(r=>r===Jt.StreamUrl));if(!t)throw new Error("No capability found for streamUrl");return this.interfaces&&"streamUrl"in this.interfaces?this.interfaces.streamUrl(e):(await gt(this,mi,sa).call(this,t.pluginId)).streamUrl(e)}async snapshot(e,t){const n=kn(this,Mr).getValue().find(r=>r.capabilities.some(i=>i===Jt.Snapshot));if(!n)throw new Error("No capability found for snapshot");return this.interfaces&&"snapshot"in this.interfaces?this.interfaces.snapshot(e,t):(await gt(this,mi,sa).call(this,n.pluginId)).snapshot(e,t)}async ptzCommand(e){const t=kn(this,Mr).getValue().find(n=>n.capabilities.some(r=>r===Jt.PTZ));if(!t)throw new Error("No capability found for PTZ");return this.interfaces&&"ptzCommand"in this.interfaces?this.interfaces.ptzCommand(e):(await gt(this,mi,sa).call(this,t.pluginId)).ptzCommand(e)}async disconnect(){await Promise.allSettled(kn(this,$r).map(e=>e.connection.disconnect())),Gr(this,$r,[])}}ho=new WeakMap,Mr=new WeakMap,mo=new WeakMap,po=new WeakMap,$r=new WeakMap,mi=new WeakSet,sa=async function(e){var r;if(e===((r=kn(this,po))==null?void 0:r.id))throw new Error("Can not create camera proxy for the same plugin");const t=oo.pluginCameraNamespaces(e,kn(this,mo)).cameraInterfacesRpc,n=await kn(this,ho).createRPCConnection(t);return kn(this,$r).some(i=>i.namespace===t)||kn(this,$r).push({namespace:t,connection:n}),n.createProxy()};rc([Xa({public:!0}),Ln("design:type",Function),Ln("design:paramtypes",[String]),Ln("design:returntype",Promise)],ta.prototype,"streamUrl",null),rc([Xa({public:!0}),Ln("design:type",Function),Ln("design:paramtypes",[String,Boolean]),Ln("design:returntype",Promise)],ta.prototype,"snapshot",null),rc([Xa({public:!0}),Ln("design:type",Function),Ln("design:paramtypes",[Object]),Ln("design:returntype",Promise)],ta.prototype,"ptzCommand",null);const xd={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ic;const bv=new Uint8Array(16),Ps=[];for(let s=0;s<256;++s)Ps.push((s+256).toString(16).slice(1));function wv(s,e=0){return(Ps[s[e+0]]+Ps[s[e+1]]+Ps[s[e+2]]+Ps[s[e+3]]+"-"+Ps[s[e+4]]+Ps[s[e+5]]+"-"+Ps[s[e+6]]+Ps[s[e+7]]+"-"+Ps[s[e+8]]+Ps[s[e+9]]+"-"+Ps[s[e+10]]+Ps[s[e+11]]+Ps[s[e+12]]+Ps[s[e+13]]+Ps[s[e+14]]+Ps[s[e+15]]).toLowerCase()}const hn=function(s,e,t){var r;if(xd.randomUUID&&!s)return xd.randomUUID();const n=(s=s||{}).random??((r=s.rng)==null?void 0:r.call(s))??function(){if(!ic){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ic=crypto.getRandomValues.bind(crypto)}return ic(bv)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=15&n[6]|64,n[8]=63&n[8]|128,wv(n)};var Bt,Sd;(function(s){s.assertEqual=e=>{},s.assertIs=function(e){},s.assertNever=function(e){throw new Error},s.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},s.getValidEnumValues=e=>{const t=s.objectKeys(e).filter(r=>typeof e[e[r]]!="number"),n={};for(const r of t)n[r]=e[r];return s.objectValues(n)},s.objectValues=e=>s.objectKeys(e).map(function(t){return e[t]}),s.objectKeys=typeof Object.keys=="function"?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},s.find=(e,t)=>{for(const n of e)if(t(n))return n},s.isInteger=typeof Number.isInteger=="function"?e=>Number.isInteger(e):e=>typeof e=="number"&&Number.isFinite(e)&&Math.floor(e)===e,s.joinValues=function(e,t=" | "){return e.map(n=>typeof n=="string"?`'${n}'`:n).join(t)},s.jsonStringifyReplacer=(e,t)=>typeof t=="bigint"?t.toString():t})(Bt||(Bt={})),function(s){s.mergeShapes=(e,t)=>({...e,...t})}(Sd||(Sd={}));const Ge=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rr=s=>{switch(typeof s){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return Number.isNaN(s)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(s)?Ge.array:s===null?Ge.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?Ge.promise:typeof Map<"u"&&s instanceof Map?Ge.map:typeof Set<"u"&&s instanceof Set?Ge.set:typeof Date<"u"&&s instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},$e=Bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Zn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,l=0;for(;l<o.path.length;){const u=o.path[l];l===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return r(this),n}static assert(e){if(!(e instanceof Zn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Zn.create=s=>new Zn(s);const Nc=(s,e)=>{let t;switch(s.code){case $e.invalid_type:t=s.received===Ge.undefined?"Required":`Expected ${s.expected}, received ${s.received}`;break;case $e.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,Bt.jsonStringifyReplacer)}`;break;case $e.unrecognized_keys:t=`Unrecognized key(s) in object: ${Bt.joinValues(s.keys,", ")}`;break;case $e.invalid_union:t="Invalid input";break;case $e.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Bt.joinValues(s.options)}`;break;case $e.invalid_enum_value:t=`Invalid enum value. Expected ${Bt.joinValues(s.options)}, received '${s.received}'`;break;case $e.invalid_arguments:t="Invalid function arguments";break;case $e.invalid_return_type:t="Invalid function return type";break;case $e.invalid_date:t="Invalid date";break;case $e.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:Bt.assertNever(s.validation):t=s.validation!=="regex"?`Invalid ${s.validation}`:"Invalid";break;case $e.too_small:t=s.type==="array"?`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:"Invalid input";break;case $e.too_big:t=s.type==="array"?`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:"Invalid input";break;case $e.custom:t="Invalid input";break;case $e.invalid_intersection_types:t="Intersection results could not be merged";break;case $e.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case $e.not_finite:t="Number must be finite";break;default:t=e.defaultError,Bt.assertNever(s)}return{message:t}};let xv=Nc;function Sv(){return xv}const Cv=s=>{const{data:e,path:t,errorMaps:n,issueData:r}=s,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let a="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)a=u(o,{data:e,defaultError:a}).message;return{...r,path:i,message:a}};function De(s,e){const t=Sv(),n=Cv({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Nc?void 0:Nc].filter(r=>!!r)});s.common.issues.push(n)}class Qs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return mt;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const i=await r.key,o=await r.value;n.push({key:i,value:o})}return Qs.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return mt;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value==="__proto__"||o.value===void 0&&!r.alwaysSet||(n[i.value]=o.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),Fc=s=>({status:"dirty",value:s}),mn=s=>({status:"valid",value:s}),Cd=s=>s.status==="aborted",kd=s=>s.status==="dirty",yi=s=>s.status==="valid",ga=s=>typeof Promise<"u"&&s instanceof Promise;var Je;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Je||(Je={}));class In{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ed=(s,e)=>{if(yi(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Zn(s.common.issues);return this._error=t,this._error}}};function St(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{const{message:a}=s;return i.code==="invalid_enum_value"?{message:a??o.defaultError}:o.data===void 0?{message:a??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:a??t??o.defaultError}},description:r}}class Rt{get description(){return this._def.description}_getType(e){return rr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qs,ctx:{common:e.parent.common,data:e.data,parsedType:rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ga(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rr(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Ed(n,r)}"~validate"(e){var n,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rr(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return yi(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(r=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>yi(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rr(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(ga(r)?r:Promise.resolve(r));return Ed(n,i)}refine(e,t){const n=r=>typeof t=="string"||t===void 0?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const o=e(r),a=()=>i.addIssue({code:$e.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>!!l||(a(),!1)):!!o||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new ni({schema:this,typeName:dt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return fr.create(this,this._def)}nullable(){return xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rn.create(this)}promise(){return ba.create(this,this._def)}or(e){return _a.create([this,e],this._def)}and(e){return ya.create(this,e,this._def)}transform(e){return new ni({...St(this._def),schema:this,typeName:dt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Dc({...St(this._def),innerType:this,defaultValue:t,typeName:dt.ZodDefault})}brand(){return new Vv({typeName:dt.ZodBranded,type:this,...St(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Bc({...St(this._def),innerType:this,catchValue:t,typeName:dt.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return kl.create(this,e)}readonly(){return zc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const kv=/^c[^\s-]{8,}$/i,Ev=/^[0-9a-z]+$/,Av=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Mv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$v=/^[a-z0-9_-]{21}$/i,Tv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let oc;const Iv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ov=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Nv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Fv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Om="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qv=new RegExp(`^${Om}$`);function Nm(s){let e="[0-5]\\d";return s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s.precision?"+":"?"}`}function Dv(s){let e=`${Om}T${Nm(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Bv(s,e){if(!Tv.test(s))return!1;try{const[t]=s.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return typeof r=="object"&&r!==null&&(!("typ"in r)||(r==null?void 0:r.typ)==="JWT")&&!!r.alg&&(!e||r.alg===e)}catch{return!1}}function zv(s,e){return!(e!=="v4"&&e||!Ov.test(s))||!(e!=="v6"&&e||!Fv.test(s))}class Un extends Rt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ge.string){const o=this._getOrReturnCtx(e);return De(o,{code:$e.invalid_type,expected:Ge.string,received:o.parsedType}),mt}const t=new Qs;let n;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),De(n,{code:$e.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),De(n,{code:$e.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if(o.kind==="length"){const a=e.data.length>o.value,l=e.data.length<o.value;(a||l)&&(n=this._getOrReturnCtx(e,n),a?De(n,{code:$e.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):l&&De(n,{code:$e.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),t.dirty())}else if(o.kind==="email")Rv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"email",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="emoji")oc||(oc=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),oc.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"emoji",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="uuid")Mv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"uuid",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="nanoid")$v.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"nanoid",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="cuid")kv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"cuid",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="cuid2")Ev.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"cuid2",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="ulid")Av.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"ulid",code:$e.invalid_string,message:o.message}),t.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),De(n,{validation:"url",code:$e.invalid_string,message:o.message}),t.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"regex",code:$e.invalid_string,message:o.message}),t.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),t.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:{startsWith:o.value},message:o.message}),t.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:{endsWith:o.value},message:o.message}),t.dirty()):o.kind==="datetime"?Dv(o).test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:"datetime",message:o.message}),t.dirty()):o.kind==="date"?qv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:"date",message:o.message}),t.dirty()):o.kind==="time"?new RegExp(`^${Nm(o)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{code:$e.invalid_string,validation:"time",message:o.message}),t.dirty()):o.kind==="duration"?Pv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"duration",code:$e.invalid_string,message:o.message}),t.dirty()):o.kind==="ip"?(r=e.data,((i=o.version)!=="v4"&&i||!Iv.test(r))&&(i!=="v6"&&i||!Nv.test(r))&&(n=this._getOrReturnCtx(e,n),De(n,{validation:"ip",code:$e.invalid_string,message:o.message}),t.dirty())):o.kind==="jwt"?Bv(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"jwt",code:$e.invalid_string,message:o.message}),t.dirty()):o.kind==="cidr"?zv(e.data,o.version)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"cidr",code:$e.invalid_string,message:o.message}),t.dirty()):o.kind==="base64"?Lv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"base64",code:$e.invalid_string,message:o.message}),t.dirty()):o.kind==="base64url"?jv.test(e.data)||(n=this._getOrReturnCtx(e,n),De(n,{validation:"base64url",code:$e.invalid_string,message:o.message}),t.dirty()):Bt.assertNever(o);var r,i;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:$e.invalid_string,...Je.errToObj(n)})}_addCheck(e){return new Un({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Je.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Je.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Je.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Je.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Je.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,...Je.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Je.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Je.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Je.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Je.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Je.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Je.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Je.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Je.errToObj(t)})}nonempty(e){return this.min(1,Je.errToObj(e))}trim(){return new Un({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Un({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Un({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}function Uv(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n;return Number.parseInt(s.toFixed(r).replace(".",""))%Number.parseInt(e.toFixed(r).replace(".",""))/10**r}Un.create=s=>new Un({checks:[],typeName:dt.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...St(s)});class bi extends Rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ge.number){const r=this._getOrReturnCtx(e);return De(r,{code:$e.invalid_type,expected:Ge.number,received:r.parsedType}),mt}let t;const n=new Qs;for(const r of this._def.checks)r.kind==="int"?Bt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:$e.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="multipleOf"?Uv(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:$e.not_finite,message:r.message}),n.dirty()):Bt.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,n,r){return new bi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Je.toString(r)}]})}_addCheck(e){return new bi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Bt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}bi.create=s=>new bi({checks:[],typeName:dt.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...St(s)});class ao extends Rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ge.bigint)return this._getInvalidInput(e);let t;const n=new Qs;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),De(t,{code:$e.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Bt.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.bigint,received:t.parsedType}),mt}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,n,r){return new ao({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Je.toString(r)}]})}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ao.create=s=>new ao({checks:[],typeName:dt.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...St(s)});class Lc extends Rt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ge.boolean){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.boolean,received:t.parsedType}),mt}return mn(e.data)}}Lc.create=s=>new Lc({typeName:dt.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...St(s)});class va extends Rt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ge.date){const r=this._getOrReturnCtx(e);return De(r,{code:$e.invalid_type,expected:Ge.date,received:r.parsedType}),mt}if(Number.isNaN(e.data.getTime()))return De(this._getOrReturnCtx(e),{code:$e.invalid_date}),mt;const t=new Qs;let n;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),De(n,{code:$e.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),De(n,{code:$e.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Bt.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new va({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Je.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Je.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}va.create=s=>new va({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:dt.ZodDate,...St(s)});class Ad extends Rt{_parse(e){if(this._getType(e)!==Ge.symbol){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.symbol,received:t.parsedType}),mt}return mn(e.data)}}Ad.create=s=>new Ad({typeName:dt.ZodSymbol,...St(s)});class Md extends Rt{_parse(e){if(this._getType(e)!==Ge.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.undefined,received:t.parsedType}),mt}return mn(e.data)}}Md.create=s=>new Md({typeName:dt.ZodUndefined,...St(s)});class $d extends Rt{_parse(e){if(this._getType(e)!==Ge.null){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.null,received:t.parsedType}),mt}return mn(e.data)}}$d.create=s=>new $d({typeName:dt.ZodNull,...St(s)});class co extends Rt{constructor(){super(...arguments),this._any=!0}_parse(e){return mn(e.data)}}co.create=s=>new co({typeName:dt.ZodAny,...St(s)});class Td extends Rt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return mn(e.data)}}Td.create=s=>new Td({typeName:dt.ZodUnknown,...St(s)});class pr extends Rt{_parse(e){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.never,received:t.parsedType}),mt}}pr.create=s=>new pr({typeName:dt.ZodNever,...St(s)});class Pd extends Rt{_parse(e){if(this._getType(e)!==Ge.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.void,received:t.parsedType}),mt}return mn(e.data)}}Pd.create=s=>new Pd({typeName:dt.ZodVoid,...St(s)});class Rn extends Rt{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Ge.array)return De(t,{code:$e.invalid_type,expected:Ge.array,received:t.parsedType}),mt;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&(De(t,{code:o?$e.too_big:$e.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(De(t,{code:$e.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(De(t,{code:$e.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new In(t,o,t.path,a)))).then(o=>Qs.mergeArray(n,o));const i=[...t.data].map((o,a)=>r.type._parseSync(new In(t,o,t.path,a)));return Qs.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new Rn({...this._def,minLength:{value:e,message:Je.toString(t)}})}max(e,t){return new Rn({...this._def,maxLength:{value:e,message:Je.toString(t)}})}length(e,t){return new Rn({...this._def,exactLength:{value:e,message:Je.toString(t)}})}nonempty(e){return this.min(1,e)}}function ei(s){if(s instanceof bs){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=fr.create(ei(n))}return new bs({...s._def,shape:()=>e})}return s instanceof Rn?new Rn({...s._def,type:ei(s.element)}):s instanceof fr?fr.create(ei(s.unwrap())):s instanceof xi?xi.create(ei(s.unwrap())):s instanceof Nr?Nr.create(s.items.map(e=>ei(e))):s}Rn.create=(s,e)=>new Rn({type:s,minLength:null,maxLength:null,exactLength:null,typeName:dt.ZodArray,...St(e)});class bs extends Rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=Bt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ge.object){const l=this._getOrReturnCtx(e);return De(l,{code:$e.invalid_type,expected:Ge.object,received:l.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof pr&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const a=[];for(const l of i){const u=r[l],d=n.data[l];a.push({key:{status:"valid",value:l},value:u._parse(new In(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof pr){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&(De(n,{code:$e.unrecognized_keys,keys:o}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const d=n.data[u];a.push({key:{status:"valid",value:u},value:l._parse(new In(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of a){const d=await u.key,h=await u.value;l.push({key:d,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>Qs.mergeObjectSync(t,l)):Qs.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return Je.errToObj,new bs({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,o;const r=((o=(i=this._def).errorMap)==null?void 0:o.call(i,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:Je.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new bs({...this._def,unknownKeys:"strip"})}passthrough(){return new bs({...this._def,unknownKeys:"passthrough"})}extend(e){return new bs({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new bs({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:dt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new bs({...this._def,catchall:e})}pick(e){const t={};for(const n of Bt.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new bs({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Bt.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new bs({...this._def,shape:()=>t})}deepPartial(){return ei(this)}partial(e){const t={};for(const n of Bt.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new bs({...this._def,shape:()=>t})}required(e){const t={};for(const n of Bt.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof fr;)r=r._def.innerType;t[n]=r}return new bs({...this._def,shape:()=>t})}keyof(){return Fm(Bt.objectKeys(this.shape))}}bs.create=(s,e)=>new bs({shape:()=>s,unknownKeys:"strip",catchall:pr.create(),typeName:dt.ZodObject,...St(e)}),bs.strictCreate=(s,e)=>new bs({shape:()=>s,unknownKeys:"strict",catchall:pr.create(),typeName:dt.ZodObject,...St(e)}),bs.lazycreate=(s,e)=>new bs({shape:s,unknownKeys:"strip",catchall:pr.create(),typeName:dt.ZodObject,...St(e)});class _a extends Rt{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(function(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new Zn(o.ctx.common.issues));return De(t,{code:$e.invalid_union,unionErrors:i}),mt});{let r;const i=[];for(const a of n){const l={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status!=="dirty"||r||(r={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(a=>new Zn(a));return De(t,{code:$e.invalid_union,unionErrors:o}),mt}}get options(){return this._def.options}}_a.create=(s,e)=>new _a({options:s,typeName:dt.ZodUnion,...St(e)});function jc(s,e){const t=rr(s),n=rr(e);if(s===e)return{valid:!0,data:s};if(t===Ge.object&&n===Ge.object){const r=Bt.objectKeys(e),i=Bt.objectKeys(s).filter(a=>r.indexOf(a)!==-1),o={...s,...e};for(const a of i){const l=jc(s[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}if(t===Ge.array&&n===Ge.array){if(s.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<s.length;i++){const o=jc(s[i],e[i]);if(!o.valid)return{valid:!1};r.push(o.data)}return{valid:!0,data:r}}return t===Ge.date&&n===Ge.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class ya extends Rt{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(i,o)=>{if(Cd(i)||Cd(o))return mt;const a=jc(i.value,o.value);return a.valid?((kd(i)||kd(o))&&t.dirty(),{status:t.value,value:a.data}):(De(n,{code:$e.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ya.create=(s,e,t)=>new ya({left:s,right:e,typeName:dt.ZodIntersection,...St(t)});class Nr extends Rt{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.array)return De(n,{code:$e.invalid_type,expected:Ge.array,received:n.parsedType}),mt;if(n.data.length<this._def.items.length)return De(n,{code:$e.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mt;!this._def.rest&&n.data.length>this._def.items.length&&(De(n,{code:$e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((i,o)=>{const a=this._def.items[o]||this._def.rest;return a?a._parse(new In(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>Qs.mergeArray(t,i)):Qs.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Nr({...this._def,rest:e})}}Nr.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Nr({items:s,typeName:dt.ZodTuple,rest:null,...St(e)})};class Cl extends Rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.object)return De(n,{code:$e.invalid_type,expected:Ge.object,received:n.parsedType}),mt;const r=[],i=this._def.keyType,o=this._def.valueType;for(const a in n.data)r.push({key:i._parse(new In(n,a,n.path,a)),value:o._parse(new In(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Qs.mergeObjectAsync(t,r):Qs.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new Cl(t instanceof Rt?{keyType:e,valueType:t,typeName:dt.ZodRecord,...St(n)}:{keyType:Un.create(),valueType:e,typeName:dt.ZodRecord,...St(t)})}}class Rd extends Rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.map)return De(n,{code:$e.invalid_type,expected:Ge.map,received:n.parsedType}),mt;const r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,l],u)=>({key:r._parse(new In(n,a,n.path,[u,"key"])),value:i._parse(new In(n,l,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return mt;u.status!=="dirty"&&d.status!=="dirty"||t.dirty(),a.set(u.value,d.value)}return{status:t.value,value:a}})}{const a=new Map;for(const l of o){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return mt;u.status!=="dirty"&&d.status!=="dirty"||t.dirty(),a.set(u.value,d.value)}return{status:t.value,value:a}}}}Rd.create=(s,e,t)=>new Rd({valueType:e,keyType:s,typeName:dt.ZodMap,...St(t)});class lo extends Rt{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.set)return De(n,{code:$e.invalid_type,expected:Ge.set,received:n.parsedType}),mt;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(De(n,{code:$e.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(De(n,{code:$e.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(l){const u=new Set;for(const d of l){if(d.status==="aborted")return mt;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const a=[...n.data.values()].map((l,u)=>i._parse(new In(n,l,n.path,u)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new lo({...this._def,minSize:{value:e,message:Je.toString(t)}})}max(e,t){return new lo({...this._def,maxSize:{value:e,message:Je.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}lo.create=(s,e)=>new lo({valueType:s,minSize:null,maxSize:null,typeName:dt.ZodSet,...St(e)});class Id extends Rt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Id.create=(s,e)=>new Id({getter:s,typeName:dt.ZodLazy,...St(e)});class qc extends Rt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return De(t,{received:t.data,code:$e.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Fm(s,e){return new wi({values:s,typeName:dt.ZodEnum,...St(e)})}qc.create=(s,e)=>new qc({value:s,typeName:dt.ZodLiteral,...St(e)});class wi extends Rt{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return De(t,{expected:Bt.joinValues(n),received:t.parsedType,code:$e.invalid_type}),mt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return De(t,{received:t.data,code:$e.invalid_enum_value,options:n}),mt}return mn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return wi.create(e,{...this._def,...t})}exclude(e,t=this._def){return wi.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}wi.create=Fm;class Od extends Rt{_parse(e){const t=Bt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ge.string&&n.parsedType!==Ge.number){const r=Bt.objectValues(t);return De(n,{expected:Bt.joinValues(r),received:n.parsedType,code:$e.invalid_type}),mt}if(this._cache||(this._cache=new Set(Bt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=Bt.objectValues(t);return De(n,{received:n.data,code:$e.invalid_enum_value,options:r}),mt}return mn(e.data)}get enum(){return this._def.values}}Od.create=(s,e)=>new Od({values:s,typeName:dt.ZodNativeEnum,...St(e)});class ba extends Rt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ge.promise&&t.common.async===!1)return De(t,{code:$e.invalid_type,expected:Ge.promise,received:t.parsedType}),mt;const n=t.parsedType===Ge.promise?t.data:Promise.resolve(t.data);return mn(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ba.create=(s,e)=>new ba({type:s,typeName:dt.ZodPromise,...St(e)});class ni extends Rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{De(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return mt;const l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?mt:l.status==="dirty"||t.value==="dirty"?Fc(l.value):l});{if(t.value==="aborted")return mt;const a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?mt:a.status==="dirty"||t.value==="dirty"?Fc(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?mt:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?mt:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform"){if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yi(o))return mt;const a=r.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>yi(o)?Promise.resolve(r.transform(o.value,i)).then(a=>({status:t.value,value:a})):mt)}Bt.assertNever(r)}}ni.create=(s,e,t)=>new ni({schema:s,typeName:dt.ZodEffects,effect:e,...St(t)}),ni.createWithPreprocess=(s,e,t)=>new ni({schema:e,effect:{type:"preprocess",transform:s},typeName:dt.ZodEffects,...St(t)});class fr extends Rt{_parse(e){return this._getType(e)===Ge.undefined?mn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fr.create=(s,e)=>new fr({innerType:s,typeName:dt.ZodOptional,...St(e)});class xi extends Rt{_parse(e){return this._getType(e)===Ge.null?mn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xi.create=(s,e)=>new xi({innerType:s,typeName:dt.ZodNullable,...St(e)});class Dc extends Rt{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Ge.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Dc.create=(s,e)=>new Dc({innerType:s,typeName:dt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...St(e)});class Bc extends Rt{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ga(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zn(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Zn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Bc.create=(s,e)=>new Bc({innerType:s,typeName:dt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...St(e)});class Nd extends Rt{_parse(e){if(this._getType(e)!==Ge.nan){const t=this._getOrReturnCtx(e);return De(t,{code:$e.invalid_type,expected:Ge.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}Nd.create=s=>new Nd({typeName:dt.ZodNaN,...St(s)});class Vv extends Rt{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class kl extends Rt{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?mt:r.status==="dirty"?(t.dirty(),Fc(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?mt:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new kl({in:e,out:t,typeName:dt.ZodPipeline})}}class zc extends Rt{_parse(e){const t=this._def.innerType._parse(e),n=r=>(yi(r)&&(r.value=Object.freeze(r.value)),r);return ga(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}function Fd(s,e){const t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function jn(s,e={},t){return s?co.create().superRefine((n,r)=>{const i=s(n);if(i instanceof Promise)return i.then(o=>{if(!o){const a=Fd(e,n),l=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:l})}});if(!i){const o=Fd(e,n),a=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:a})}}):co.create()}zc.create=(s,e)=>new zc({innerType:s,typeName:dt.ZodReadonly,...St(e)});var dt;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(dt||(dt={}));const We=Un.create,On=bi.create,xs=Lc.create,Bi=co.create,xt=(pr.create,Rn.create,bs.create),Ns=_a.create,Hv=(ya.create,Nr.create),Uc=Cl.create,xe=qc.create,Qv=(wi.create,ba.create,fr.create);xi.create;function Ld(s){const e=["kasa://","nest:","ring:","tapo://"];return s.some(t=>e.some(n=>t.startsWith(n)))}const jd=xt({enabled:xs().default(!1)}).strict(),Kv=Ns([xe("animal"),xe("person"),xe("vehicle"),xe("other"),xe("motion")]),El=Hv([On(),On()]),qd=xt({name:We().trim().min(1,"Zone Name is required"),points:El.array().min(3,"At least 3 points are required"),type:Ns([xe("intersect"),xe("contain")]),filter:Ns([xe("include"),xe("exclude")]),classes:Kv.array(),isPrivacyMask:xs(),color:We().trim().regex(/^#([0-9A-Fa-f]{3}){1,2}$/,"Must be a valid hex color (e.g. #FF0000 or #F00)").default("#df2a4c")}).array(),Dd=xt({motion:xt({timeout:On().min(10,"Minimum 10 seconds")}),object:xt({confidence:On().min(.3,"Minimum 0.3").max(1,"Maximum 1")})}),Lm=Ns([xe("high-resolution"),xe("mid-resolution"),xe("low-resolution"),xe("snapshot")]),Zv=Ns([xe("high-resolution"),xe("mid-resolution"),xe("low-resolution"),xe("auto")]),Gv=Ns([xe("bubble://"),xe("cui://"),xe("doorbird://"),xe("dvrip://"),xe("echo:"),xe("eseecloud://"),xe("exec:"),xe("expr:"),xe("ffmpeg:"),xe("flussonic://"),xe("gopro://"),xe("hass:"),xe("homekit://"),xe("http://"),xe("https://"),xe("httpx://"),xe("isapi://"),xe("ivideon:"),xe("kasa://"),xe("nest:"),xe("onvif://"),xe("ring:"),xe("roborock://"),xe("rtmp://"),xe("rtsp://"),xe("rtspx://"),xe("tapo://"),xe("tcp://"),xe("tuya://"),xe("webrtc:"),xe("webtorrent:")]).options.map(s=>s.value),Wv=new RegExp(`^(${Gv.join("|")})`),jm=We().refine(s=>{if(!Wv.test(s))return!1;try{return new URL(s),!0}catch{return!1}},{message:"Invalid URL format or unsupported protocol"}),Jv=xt({_id:We().default(hn()).transform(()=>hn()),name:We().trim().min(1,"Camera Source Name is required").transform(s=>s.replace(/ /g,"_").toLowerCase()),role:Lm,useForSnapshot:xs().default(!1),hotMode:xs().default(!0),preload:xs().default(!0),urls:jm.array().min(1,"At least one valid URL is required")}).strict(),Yv=xt({_id:We().default(hn()).transform(()=>hn()),name:We().trim().min(1,"Camera Source Name is required").transform(s=>s.replace(/ /g,"_").toLowerCase()),role:Lm,useForSnapshot:xs().default(!1),hotMode:xs().default(!0),preload:xs().default(!0),urls:jm.array().min(1,"At least one valid URL is required")}).strict(),Sr=xt({id:We(),name:We().trim()}),Bd=xt({hub:Sr.array().optional(),cameraController:Sr.optional(),motionDetection:Sr.optional(),audioDetection:Sr.optional(),objectDetection:Sr.optional(),ptz:Sr.optional(),plugins:Sr.array()}).strict(),Xv=Ns([xe("auto"),xe("mse"),xe("webrtc"),xe("webrtc/tcp")]),e_=Ns([xe("16:9"),xe("8:3"),xe("4:3"),xe("auto")]),zd=xt({decoder:Ns([xe("pillow"),xe("wasm"),xe("rust"),xe("gpu")]),fps:On().min(0,"Minimum 0 fps").max(30,"Maximum 30 fps"),resolution:Ns([xe("640x480"),xe("640x360"),xe("320x240"),xe("320x180")])}),Ud=Ns([xe("camera"),xe("doorbell")]),Vd=xt({streamingMode:Xv,streamingSource:Zv,aspectRatio:e_}),Hd=xt({model:We().trim().optional(),manufacturer:We().trim().optional(),hardware:We().trim().optional(),serialNumber:We().trim().optional(),firmwareVersion:We().trim().optional(),supportUrl:We().trim().optional()}),t_=(xt({name:We().trim().min(1,"Camera name is required"),url:We().trim().url().min(1,"Camera URL is required"),type:Ns([xe("Google"),xe("Ring"),xe("HomeKit"),xe("Onvif"),xe("Hass"),xe("GoPro"),xe("Roborock"),xe("FFmpeg"),xe("DVRip"),xe("Webtorrent")]),username:We().trim().optional(),email:We().trim().email().optional(),password:We().trim().optional(),pin:We().trim().length(8,{message:"PIN must be 8 characters long"}).optional(),clientId:We().trim().optional(),clientSecret:We().trim().optional(),refreshToken:We().trim().optional(),projectId:We().trim().optional()}).strict().refine(s=>s.type!=="HomeKit"||!!s.pin,{message:"PIN is required for HomeKit cameras",path:["pin"]}).refine(s=>s.type!=="Google"||!!s.clientId,{message:"Client ID is required for Google cameras",path:["clientId"]}).refine(s=>s.type!=="Google"||!!s.clientSecret,{message:"Client Secret is required for Google cameras",path:["clientSecret"]}).refine(s=>s.type!=="Google"||!!s.projectId,{message:"Project ID is required for Google cameras",path:["projectId"]}).refine(s=>s.type!=="Google"||!!s.refreshToken,{message:"Refresh Token is required for Google cameras",path:["refreshToken"]}).refine(s=>s.type!=="Ring"||!!s.email,{message:"Email is required",path:["email"]}).refine(s=>s.type!=="Roborock"||!!s.username,{message:"Username is required",path:["username"]}).refine(s=>s.type!=="Roborock"&&s.type!=="Ring"||!!s.password,{message:"Password is required",path:["password"]}),xt({id:We(),name:We()}).strict()),s_=(xt({_id:We().default(hn()).transform(()=>hn()),nativeId:We().trim().optional(),pluginInfo:t_.optional(),disabled:xs().default(!1),name:We().trim().min(1,"Camera name is required"),type:Ud.default("camera"),isCloud:xs().default(!1),snapshotTTL:On().min(30,"Minimum cache time must be 30").default(600),info:Hd.default({model:"IP Camera",manufacturer:"camera.ui",hardware:"Camera",serialNumber:"Unknown",firmwareVersion:"Unknown",supportUrl:"Unknown"}),sources:Jv.array().refine(s=>s.some(e=>e.role==="high-resolution"||e.role==="mid-resolution"||e.role==="low-resolution"),{path:["sources[].role"],message:'One of the roles "high-resolution", "mid-resolution" or "low-resolution" is required'}).refine(s=>s.filter(e=>e.useForSnapshot).length<=1,{message:"Only one source can be used for snapshot",path:["sources"]}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.useForSnapshot),{message:"Snapshot source can not be used with useForSnapshot",path:["sources"]}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.hotMode),{message:"Snapshot source can not be used with hotMode"}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.preload),{message:"Snapshot source can not be used with preload"}),extensions:Bd.default({hub:[],plugins:[]}),recording:jd.default({enabled:!1}),interface:Vd.default({streamingMode:"webrtc",streamingSource:"auto",aspectRatio:"16:9"}),detectionZones:qd.default([]),detectionSettings:Dd.default({motion:{timeout:60},object:{confidence:.7}}),frameWorkerSettings:zd.default({decoder:"rust",fps:10,resolution:"320x180"})}).strict().transform(s=>{const e=s.sources.flatMap(t=>t.urls);return s.isCloud||Ld(e)?{...s,isCloud:!0}:s}),xt({disabled:xs().optional(),type:Ud.optional(),name:We().trim().min(1,"Camera name is required").optional(),isCloud:xs().optional(),snapshotTTL:On().min(30,"Minimum cache time must be 30").optional(),info:Hd.partial().optional(),sources:Yv.array().refine(s=>s.some(e=>e.role==="high-resolution"||e.role==="mid-resolution"||e.role==="low-resolution"),{path:["sources[].role"],message:'One of the roles "high-resolution", "mid-resolution" or "low-resolution" is required'}).refine(s=>s.filter(e=>e.useForSnapshot).length<=1,{message:"Only one source can be used for snapshot",path:["sources"]}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.useForSnapshot),{message:"Snapshot source can not be used with useForSnapshot",path:["sources"]}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.hotMode),{message:"Snapshot source can not be used with hotMode"}).refine(s=>s.filter(e=>e.role==="snapshot").every(e=>!e.preload),{message:"Snapshot source can not be used with preload"}).optional(),extensions:Bd.partial().optional(),interface:Vd.partial().optional(),recording:jd.partial().optional(),detectionZones:qd.optional(),detectionSettings:Dd.partial().optional(),frameWorkerSettings:zd.partial().optional()}).strict().transform(s=>{if(s.sources){const e=s.sources.flatMap(t=>t.urls);if(s.isCloud===!0||Ld(e))return{...s,isCloud:!0}}return s}),xt({url:We().trim()}).strict(),/^((@[\w-.]*)\/)?(camera-ui-[\w-]*)$/);var Qd,Kd;(function(s){s.READY="ready",s.STARTING="starting",s.STARTED="started",s.STOPPING="stopping",s.STOPPED="stopped",s.ERROR="error",s.UNKNOWN="unknown",s.DISABLED="disabled"})(Qd||(Qd={})),function(s){s.START="start",s.STOP="stop"}(Kd||(Kd={}));const Zd=["image/jpeg","image/png"],Gd=2097152,Wd=["video/mp4","video/quicktime"],Jd=10485760,Yd=["audio/mpeg","audio/wav","audio/ogg"],Xd=2097152,n_=(xt({pluginname:We().trim().refine(s=>s_.test(s),"Not a valid plugin name"),pluginversion:We().trim().optional().default("latest")}).strict(),xt({actionId:We(),payload:Bi()}).strict(),Uc(Bi(),Bi()),xt({upload:jn().refine(s=>(e=>e.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=Gd:s.size<=Gd,"Max file size is 2 MB").refine(s=>(e=>e.mimetype!==void 0)(s)?Zd.includes(s.mimetype):Zd.includes(s.type),".jpeg and .png files are accepted"),metadata:jn().transform(s=>JSON.parse(s.value)),config:jn().transform(s=>JSON.parse(s.value))}),xt({upload:jn().refine(s=>(e=>e.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=Xd:s.size<=Xd,"Max file size is 2 MB").refine(s=>(e=>e.mimetype!==void 0)(s)?Yd.includes(s.mimetype):Yd.includes(s.type),".mp3, .wav and .ogg files are accepted"),metadata:jn().transform(s=>JSON.parse(s.value)),config:jn().transform(s=>JSON.parse(s.value))}),xt({upload:jn().refine(s=>(e=>e.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=Jd:s.size<=Jd,"Max file size is 5 MB").refine(s=>(e=>e.mimetype!==void 0)(s)?Wd.includes(s.mimetype):Wd.includes(s.type),".mp4 files are accepted"),config:jn().transform(s=>JSON.parse(s.value))}),Uc(We(),Bi()),xt({key:We()}).strict(),xt({key:We(),payload:Bi()}).strict(),xt({version:We().trim().optional().default("latest")}).strict(),xt({mode:Ns([xe("disabled"),xe("port-forward"),xe("router-forward"),xe("cloudflare"),xe("custom-domain")]).default("disabled"),cloudflare:xt({tunnelToken:We().trim(),customDomain:We().trim(),tunnelUrl:We().trim(),tunnelCredentials:xt({username:We().trim(),password:We().trim()}).partial()}).partial().strict(),customDomain:xt({url:We().trim().optional()}).partial().strict()}).strict()),eh=(xt({serverAddresses:We().trim().ip().array().default([]),remoteAccess:n_}).strict(),["image/jpeg","image/jpg","image/png"]),th=5242880,qm=xt({index:On(),cameraId:We()}),Dm=Ns([xe(1),xe(4),xe(6),xe(7),xe(9),xe(10),xe(12),xe(13),xe(15),xe(16),xe(20),xe(26)]),r_=Ns([xe("dnd"),xe("view")]),i_=xt({_id:We().default(hn()).transform(()=>hn()),name:We().trim().min(1,"Layout name is required"),viewSize:Dm,cameras:qm.array(),type:r_}),o_=(xt({name:We().trim().min(1,"Layout name is required"),viewSize:Dm,cameras:qm.array()}).partial().optional(),xt({views:i_.array()})),a_=xt({_id:We().default(hn()).transform(()=>hn()),cameraId:We(),points:El}),c_=(xt({cameraId:We(),points:El}).partial().optional(),xt({shortcuts:a_.array()})),sh=xt({camview:o_,cameras:Uc(We().trim(),c_)});xt({_id:We().default(hn()).transform(()=>hn()),username:We().trim().min(1,"Username is required"),password:We().trim().min(10,"Password must be at least 10 characters long").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,`Password must contain at least one special character (!@#$%^&*()_+-=[]{};:'"\\|,.<>/?)`).max(32,"Password cannot be more than 32 characters"),passwordConfirm:We().trim().min(1,"Please confirm your password"),role:Ns([xe("admin"),xe("user")]),sessionTimer:On().min(3600,"Session timer must not be less than 3600 seconds (1h)").max(86400,"Session timer must not be greater than 86400 seconds (24h)").default(14400),rememberMe:xs().default(!1),singleSession:xs().default(!1),firstLogin:xs().default(!0),preferences:sh.default({camview:{views:[]},cameras:{}})}).strict().refine(s=>s.password===s.passwordConfirm,{path:["passwordConfirm"],message:"Passwords do not match"}),xt({username:We().trim().min(1,"Username is required"),password:We().trim().min(1,"Password is required"),rememberMe:xs().default(!1)}).strict(),xt({username:We().trim().min(1,"Username is required").optional(),password:We().trim().min(10,"Password must be at least 10 characters long").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,`Password must contain at least one special character (!@#$%^&*()_+-=[]{};:'"\\|,.<>/?)`).max(32,"Password cannot be more than 32 characters").optional(),passwordConfirm:We().trim().optional(),role:Ns([xe("admin"),xe("user")]).optional(),sessionTimer:On().min(3600,"Session timer must not be less than 3600 seconds (1h)").max(86400,"Session timer must not be greater than 86400 seconds (24h)").optional(),upload:Qv(jn().refine(s=>(e=>e.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=th:s.size<=th,"Max file size is 5MB.").refine(s=>(e=>e.mimetype!==void 0)(s)?eh.includes(s.mimetype):eh.includes(s.type),".jpg, .jpeg, .png files are accepted.")),rememberMe:xs().optional(),singleSession:xs().optional(),firstLogin:xs().optional(),preferences:sh.partial().optional()}).strict().refine(s=>s.password===s.passwordConfirm,{path:["passwordConfirm"],message:"Passwords do not match"});var nh;(function(s){s.READY="ready",s.RESTARTING="restarting",s.STARTING="starting",s.STARTED="started",s.STOPPED="stopped",s.ERROR="error",s.UNKNOWN="unknown"})(nh||(nh={}));class l_ extends EventTarget{constructor(t,n,r,i,o){super();p(this,"cameraDevice");p(this,"logger");p(this,"config");p(this,"token");p(this,"initialOptions");p(this,"videoPlayer");p(this,"CONFIG",{WEBRTC:{RECONNECT_TIMER:1e3,TIMEOUT_TIMER:1e4,ICE_SERVERS:[{urls:"stun:stun.l.google.com:19302"}]},QUALITY:{METRICS_INTERVAL:5e3,METRICS_WINDOW:6e4,STABILITY_PERIOD:3e4,PACKET_LOSS_THRESHOLD:.05,FRAME_DROP_THRESHOLD:.1,QUALITY_CHANGE_COOLDOWN:5e3},MEDIA:{BUFFER_SIZE:2097152,DEFAULT_CODECS:["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"]}});p(this,"ws");p(this,"pc",null);p(this,"micTransceiver",null);p(this,"mediaSource",null);p(this,"sourceBuffer",null);p(this,"buf",new Uint8Array(0));p(this,"bufLen",0);p(this,"codecList");p(this,"streamProbe");p(this,"metrics",[]);p(this,"metricsInterval");p(this,"lastQualityChange",0);p(this,"isMonitoring",!1);p(this,"wsReconnectTimer");p(this,"wsReconnectTimeout");p(this,"webrtcConnectTimeout");p(this,"webrtcReconnectTimeout");p(this,"firstFrameReceived",!1);p(this,"animationFrameId");p(this,"userRequestedMode");p(this,"internalMode");p(this,"activeMode");p(this,"isAutoSwitchingInProgress",!1);p(this,"_closed",!0);p(this,"_hasBackchannel",!1);p(this,"_hasAudio",!0);p(this,"_hasVideo",!0);p(this,"_finishLoading",!1);p(this,"userRequestedRole");p(this,"effectiveRole");p(this,"_streamingSource");this.cameraDevice=t,this.config=n,this.token=r,this.logger=i,this.initialOptions={...o},this.videoPlayer=o.videoElement,this.CONFIG.WEBRTC.RECONNECT_TIMER=o.webrtcConnectTimeout??this.CONFIG.WEBRTC.RECONNECT_TIMER,this.userRequestedMode=o.mode,this.userRequestedRole=o.role,this.internalMode=o.mode,this.activeMode=o.mode==="auto"?"webrtc":o.mode,this.setActiveMode(this.activeMode,!0),this.effectiveRole=o.role==="auto"?"low-resolution":o.role,this.buf=new Uint8Array(this.CONFIG.MEDIA.BUFFER_SIZE),this.codecList=this.createCodecsList()}get streamingSource(){return this._streamingSource}get closed(){return this._closed}get hasBackchannel(){return this._hasBackchannel}get hasAudio(){return this._hasAudio}get hasVideo(){return this._hasVideo}get finishLoading(){return this._finishLoading}get mode(){return this.userRequestedMode}get currentMode(){return this.activeMode}get currentResolution(){return this.effectiveRole}get logPrefix(){const t=new Date,n=t.toLocaleTimeString()+"."+t.getMilliseconds().toString().padStart(3,"0");return this.userRequestedMode==="auto"?`[${n}] [${this.cameraDevice.name}] [auto→${this.activeMode}]`:`[${n}] [${this.cameraDevice.name}] [${this.activeMode}]`}get wsUrl(){const t=new URL(this.config.endpoint),n=t.port!=="",r=t.protocol==="https:"?"wss:":"ws:",i=n?t.port:t.protocol==="https:"?"443":"80";return`${r}//${t.hostname}:${i}/go2rtc?src=${this.createWsSourceName()}&token=${this.token}`}async start(t){console.log(this.logPrefix,"Starting session..."),this.reset(),this._closed=!1,this.videoPlayer.addEventListener("loadeddata",this.onLoadedData.bind(this)),t&&(this.userRequestedMode=t,this.internalMode=t,this.setActiveMode(t==="auto"?"webrtc":t)),await this.initializeStreamingSource(),this.streamProbe=await this.probeStream(),this.streamProbe&&this.userRequestedMode==="auto"&&this.selectInitialMode(),this.connectWs()}close(){this._closed||(console.log(this.logPrefix,"Closing session..."),this._closed=!0,this.stopQualityMonitoring(),this.reset(),this.disconnectWs())}async restart(t,n=!1){console.log(this.logPrefix,"Restarting session..."),n?this.dispatchEvent(new Event("onSourceChange")):this.dispatchEvent(new Event("reconnect")),this.close(),await new Promise(r=>setTimeout(r,1e3)),await this.start(t)}async toggleMicrophone(t){if(this.micTransceiver)try{await this.micTransceiver.sender.replaceTrack(t)}catch(n){if(!this.micTransceiver||!t)return;console.error(this.logPrefix,"Microphone error:",n)}}async toggleRole(t){var n;if(this.userRequestedRole!==t)if(console.log(this.logPrefix,`Switching source resolution to "${t}"...`),this.userRequestedRole=t,t==="auto")await this.initializeAdaptiveStreaming();else{this.effectiveRole=t;const{source:r}=this.getSourceForResolution(t);((n=this._streamingSource)==null?void 0:n._id)!==r._id&&(this._streamingSource=r,await this.restart(void 0,!0))}}async toggleMode(t){this.userRequestedMode!==t&&(console.log(this.logPrefix,`Switching transport mode to "${t}"...`),this.userRequestedMode=t,this.internalMode=t,this.setActiveMode(t==="auto"?"webrtc":t),await this.restart())}async initializeStreamingSource(){if(this.userRequestedRole==="auto")await this.initializeAdaptiveStreaming();else{const{source:t}=this.getSourceForResolution(this.userRequestedRole);if(this._streamingSource=t,this.userRequestedMode==="auto"&&t){const n=await this.probeStream();n&&(this.checkWebRTCCompatibility(n).compatible||(console.log(`${this.logPrefix} Source not compatible with WebRTC, starting with MSE...`),this.setActiveMode("mse")))}}}checkWebRTCCompatibility(t){const n=t.audio.filter(u=>u.direction==="sendonly"),r=t.video.filter(u=>u.direction==="sendonly"),i=n.some(u=>this.isWebRtcCompatibleAudioCodec(u.codec)),o=r.some(u=>this.isWebRtcCompatibleVideoCodec(u.codec)),a=n.length>0,l=r.length>0;return{compatible:(!a||i)&&(!l||o),audioCompatible:i,videoCompatible:o}}async initializeAdaptiveStreaming(){this.userRequestedRole==="auto"&&(await this.setStreamResolution(this.effectiveRole,void 0,!0),this.startQualityMonitoring())}selectInitialMode(){if(!this.streamProbe||this.userRequestedMode!=="auto")return;const t=this.checkWebRTCCompatibility(this.streamProbe);if(t.compatible)this.internalMode="auto";else{if(t.videoCompatible){if(!t.audioCompatible){const n=this.streamProbe.audio.filter(r=>r.direction==="sendonly");console.warn(this.logPrefix,`Incompatible audio codec(s): "${n.map(r=>r.codec).join(", ")}" - Using MSE directly`)}}else{const n=this.streamProbe.video.filter(r=>r.direction==="sendonly");console.warn(this.logPrefix,`Incompatible video codec(s): "${n.map(r=>r.codec).join(", ")}" - Using MSE directly`)}this.setActiveMode("mse")}}connectWs(){this.ws=new WebSocket(this.wsUrl),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",this.onWsOpen.bind(this)),this.ws.addEventListener("close",this.onWsClose.bind(this)),this.ws.addEventListener("message",this.onWsMessage.bind(this))}disconnectWs(){this.ws&&(this.ws.removeEventListener("open",this.onWsOpen.bind(this)),this.ws.removeEventListener("close",this.onWsClose.bind(this)),this.ws.removeEventListener("message",this.onWsMessage.bind(this)),this.ws.close(),this.ws=void 0)}reset(){var t;(t=this.videoPlayer)==null||t.removeEventListener("loadeddata",this.onLoadedData.bind(this)),clearTimeout(this.wsReconnectTimeout),clearTimeout(this.webrtcConnectTimeout),clearTimeout(this.webrtcReconnectTimeout),this._finishLoading=!1,this.firstFrameReceived=!1,this.isAutoSwitchingInProgress=!1,this.micTransceiver&&(this.micTransceiver.sender.replaceTrack(null).catch(()=>{}),this.micTransceiver=null),this.pc&&(this.pc.getTransceivers().forEach(n=>{var r,i;return(i=(r=n.sender)==null?void 0:r.track)==null?void 0:i.stop()}),this.pc.close(),this.pc=null),this.videoPlayer.srcObject=null,this.videoPlayer.src="",this.videoPlayer.poster="",this.animationFrameId!==void 0&&("cancelVideoFrameCallback"in this.videoPlayer?this.videoPlayer.cancelVideoFrameCallback(this.animationFrameId):cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}onWsOpen(){switch(this.internalMode){case"webrtc":case"webrtc/tcp":console.log(this.logPrefix,"Requesting WebRTC session..."),this.requestWebrtc();break;case"mse":console.log(this.logPrefix,"Requesting MSE session..."),this.requestMse();break;case"auto":console.log(this.logPrefix,"Requesting auto session (both WebRTC and MSE)..."),this.requestAuto();break;default:console.error(this.logPrefix,"Unknown mode!"),this.dispatchEvent(new ErrorEvent("error",{message:"Unknown mode!"}))}}onWsClose(){this._closed||this.wsReconnectTimer===void 0||(clearTimeout(this.wsReconnectTimeout),this.wsReconnectTimeout=setTimeout(()=>{this.restart()},this.wsReconnectTimer))}onWsMessage(t){if(typeof t.data=="string"){const n=JSON.parse(t.data);if(n.type)switch(n.type){case"mse":this.onMseData(n);break;case"webrtc/candidate":case"webrtc/answer":this.onWebrtcData(n);break;case"error":this.handleStreamError(n)}}else this.onMseBuffer(t.data),this.onFirstFrame()}handleStreamError(t){this.isAutoSwitchingInProgress||this.internalMode==="auto"||(this.dispatchEvent(new ErrorEvent("error",{error:t,message:t.value})),this.close())}async requestWebrtc(t){t||this.reset(),t&&this.mediaSource||(this.webrtcConnectTimeout=setTimeout(()=>{if(console.log(this.logPrefix,"WebRTC connection timeout"),this.pc&&this.pc.connectionState!=="connected")if(this.pc.close(),this.pc=null,this.userRequestedMode==="auto"){if(this.mediaSource&&this.sourceBuffer&&this._finishLoading)return console.log(this.logPrefix,"WebRTC timed out but MSE is working - staying with MSE"),this.setActiveMode("mse"),void(this.isAutoSwitchingInProgress=!1);this.setActiveMode("mse"),this.requestMse()}else this.userRequestedMode==="webrtc"?this.restart("mse"):this.restart()},this.CONFIG.WEBRTC.TIMEOUT_TIMER)),this.pc=new RTCPeerConnection({bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"}),this.pc.onicecandidate=r=>{var o,a;if(this.activeMode==="webrtc/tcp"&&((o=r.candidate)==null?void 0:o.protocol)==="udp")return;const i=((a=r.candidate)==null?void 0:a.toJSON().candidate)??"";i&&this.send({type:"webrtc/candidate",value:i})},this.pc.onconnectionstatechange=async()=>{var r,i,o,a;if(console.log(this.logPrefix,"onconnectionstatechange:",(r=this.pc)==null?void 0:r.connectionState),((i=this.pc)==null?void 0:i.connectionState)==="connected"){clearTimeout(this.webrtcConnectTimeout);const l=new MediaStream(this.pc.getTransceivers().filter(d=>d.currentDirection==="recvonly").map(d=>d.receiver.track)),u=l.getVideoTracks().length>0;this.userRequestedMode==="auto"?this.mediaSource&&this.sourceBuffer&&this._finishLoading&&this.activeMode==="mse"?u?(console.log(this.logPrefix,"WebRTC connected successfully - switching from MSE to WebRTC"),await this.switchToWebRTC(l)):console.log(this.logPrefix,"WebRTC connected but no video - staying with MSE"):u?(this.setActiveMode("webrtc"),this.videoPlayer.srcObject=l,this.onFinishLoading(void 0,"webrtc"),this.onFirstFrameWebrtc(l)):console.log(this.logPrefix,"WebRTC connected but no video - waiting for MSE"):(this.videoPlayer.srcObject=l,this.onFinishLoading(void 0,"webrtc"),this.onFirstFrameWebrtc(l))}else((o=this.pc)==null?void 0:o.connectionState)!=="failed"&&((a=this.pc)==null?void 0:a.connectionState)!=="disconnected"||(clearTimeout(this.webrtcConnectTimeout),clearTimeout(this.webrtcReconnectTimeout),this.webrtcReconnectTimeout=setTimeout(()=>{var l,u,d;if(((l=this.pc)==null?void 0:l.connectionState)==="failed"||((u=this.pc)==null?void 0:u.connectionState)==="disconnected"){if(this.userRequestedMode==="auto"&&this.mediaSource&&this.sourceBuffer&&this._finishLoading)return console.log(this.logPrefix,"WebRTC failed but MSE is working - staying with MSE"),this.setActiveMode("mse"),(d=this.pc)==null||d.close(),this.pc=null,void(this.isAutoSwitchingInProgress=!1);this.userRequestedMode==="auto"?(console.warn(this.logPrefix,"WebRTC failed - switching to MSE"),this.setActiveMode("mse"),this.restart()):this.activeMode==="webrtc"?(console.warn(this.logPrefix,"WebRTC failed - switching to MSE fallback"),this.restart("mse")):this.restart()}},this.CONFIG.WEBRTC.RECONNECT_TIMER))},this.pc.oniceconnectionstatechange=()=>{var r;console.log(this.logPrefix,"iceconnectionstatechange",(r=this.pc)==null?void 0:r.iceConnectionState)},this.pc.onicecandidateerror=r=>{console.log(this.logPrefix,"onicecandidateerror",r)},this.pc.onsignalingstatechange=()=>{var r;console.log(this.logPrefix,"onsignalingstatechange",(r=this.pc)==null?void 0:r.signalingState)},this.pc.onicegatheringstatechange=()=>{var r;console.log(this.logPrefix,"onicegatheringstatechange",(r=this.pc)==null?void 0:r.iceGatheringState)},this.pc.onnegotiationneeded=r=>{console.log(this.logPrefix,"onnegotiationneeded",r)},this.pc.addTransceiver("video",{direction:"recvonly"}),this.pc.addTransceiver("audio",{direction:"recvonly"}),this.micTransceiver=this.pc.addTransceiver("audio",{direction:"sendonly"});const n=await this.pc.createOffer();await this.pc.setLocalDescription(n),console.log(this.logPrefix,"Offer:",{type:n.type,sdp:n.sdp}),n.sdp?this.send({type:"webrtc/offer",value:n.sdp}):this.dispatchEvent(new ErrorEvent("error",{message:"Failed to create offer"}))}async onWebrtcData(t){var n,r;try{switch(t.type){case"webrtc/candidate":if(!t.value||this.activeMode==="webrtc/tcp"&&t.value.indexOf(" udp ")>0)return;await((n=this.pc)==null?void 0:n.addIceCandidate({candidate:t.value,sdpMid:"0"}));break;case"webrtc/answer":console.log(this.logPrefix,"Answer:",{type:"answer",sdp:t.value}),await((r=this.pc)==null?void 0:r.setRemoteDescription({type:"answer",sdp:t.value}))}}catch(i){this.dispatchEvent(new ErrorEvent("error",{error:i,message:i.message}))}}requestMse(){this.userRequestedMode==="auto"&&this.pc||this.reset();const t="ManagedMediaSource"in window;let n;if(t)n=window.ManagedMediaSource;else{if(!("MediaSource"in window))return void this.dispatchEvent(new ErrorEvent("error",{message:"MediaSource not supported"}));n=window.MediaSource}this.mediaSource=new n,this.mediaSource.addEventListener("sourceopen",()=>{t||URL.revokeObjectURL(this.videoPlayer.src),this.send({type:"mse",value:this.parseCodecs(n.isTypeSupported.bind(this))})},{once:!0}),t?(this.videoPlayer.disableRemotePlayback=!0,this.videoPlayer.srcObject=this.mediaSource):(this.videoPlayer.src=URL.createObjectURL(this.mediaSource),this.videoPlayer.srcObject=null),this.play()}onMseData(t){if(this.mediaSource&&this.mediaSource.readyState==="open")if(this.userRequestedMode==="auto"&&this.pc&&this.pc.connectionState!=="failed"||this.setActiveMode("mse"),this.bufLen=0,this.buf=new Uint8Array(this.CONFIG.MEDIA.BUFFER_SIZE),this.sourceBuffer=this.mediaSource.addSourceBuffer(t.value),this.sourceBuffer.mode="segments",this.sourceBuffer.addEventListener("updateend",()=>{var n,r;if(this.sourceBuffer&&!this.sourceBuffer.updating&&this.bufLen>0)try{const i=this.buf.slice(0,this.bufLen);this.sourceBuffer.appendBuffer(i),this.bufLen=0}catch{}if(this.sourceBuffer&&!this.sourceBuffer.updating&&((n=this.sourceBuffer.buffered)!=null&&n.length)){const i=this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1),o=i-5,a=this.sourceBuffer.buffered.start(0);o>a&&(this.sourceBuffer.remove(a,o),(r=this.mediaSource)==null||r.setLiveSeekableRange(o,i)),this.videoPlayer.currentTime<o&&(this.videoPlayer.currentTime=o);const l=i-this.videoPlayer.currentTime;this.videoPlayer.playbackRate=l>.1?l:.1}}),this.userRequestedMode==="auto"){if(this.pc&&this.pc.connectionState==="connected")return void console.log(this.logPrefix,"MSE ready but WebRTC already connected");console.log(this.logPrefix,"MSE ready - using while waiting for WebRTC"),this.setActiveMode("mse"),this.onFinishLoading(void 0,"mse")}else this.onFinishLoading(void 0,"mse")}async onMseBuffer(t){var n,r,i;if(((n=this.mediaSource)==null?void 0:n.readyState)!=="closed")if((r=this.sourceBuffer)!=null&&r.updating||this.bufLen>0){const o=new Uint8Array(t);this.buf.set(o,this.bufLen),this.bufLen+=o.byteLength}else try{(i=this.sourceBuffer)==null||i.appendBuffer(t)}catch{}else this._closed||this.internalMode==="auto"||(this.dispatchEvent(new ErrorEvent("error",{message:"MediaSource closed"})),this.userRequestedMode==="auto"?(this.setActiveMode("webrtc"),this.restart()):this.restart("webrtc"))}requestAuto(){if(this.isAutoSwitchingInProgress=!0,this.streamProbe&&!this.checkWebRTCCompatibility(this.streamProbe).compatible)return console.log(this.logPrefix,"Stream not compatible with WebRTC, using MSE only"),void this.requestMse();console.log(this.logPrefix,"Starting both WebRTC and MSE transports in parallel"),this.requestMse(),this.requestWebrtc(!0)}send(t){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(t))}async switchToWebRTC(t){this.setActiveMode("webrtc"),this.videoPlayer.srcObject=t,this.play(),this.onFinishLoading(!0,"webrtc"),this.onFirstFrameWebrtc(t),this.mediaSource&&(this.mediaSource.readyState==="open"&&this.mediaSource.endOfStream(),this.mediaSource=null,this.sourceBuffer=null),this.disconnectWs()}async play(){try{await this.videoPlayer.play()}catch(t){if(!this.videoPlayer.muted)return this.videoPlayer.muted=!0,this.play();this.logger.warn(this.cameraDevice.name,t)}}startQualityMonitoring(){this.isMonitoring||this.userRequestedRole!=="auto"||(clearInterval(this.metricsInterval),this.isMonitoring=!0,this.metrics=[],this.metricsInterval=setInterval(async()=>{if(this._closed)return void this.stopQualityMonitoring();const t=await this.gatherMetrics();if(t){this.metrics.push(t);const n=Date.now()-this.CONFIG.QUALITY.METRICS_WINDOW;this.metrics=this.metrics.filter(r=>r.timestamp>n),this.userRequestedRole==="auto"&&this.analyzeAndAdaptQuality()}},this.CONFIG.QUALITY.METRICS_INTERVAL))}stopQualityMonitoring(){clearInterval(this.metricsInterval),this.metricsInterval=void 0,this.isMonitoring=!1,this.metrics=[]}async gatherMetrics(){if(this._closed)return null;if(this.pc&&this.activeMode==="webrtc")try{const t=await this.pc.getStats(),n={packetsLost:0,packetsReceived:0,framesDropped:0,framesReceived:0,timestamp:Date.now()};for(const[,r]of t.entries())r.type==="inbound-rtp"&&r.kind==="video"?(n.packetsLost=r.packetsLost,n.packetsReceived=r.packetsReceived):r.type==="media-source"&&r.kind==="video"&&(n.framesDropped=r.framesDropped,n.framesReceived=r.framesReceived);return n}catch(t){return console.warn(`${this.logPrefix} Error gathering WebRTC metrics:`,t),null}else if(this.activeMode==="mse"&&this.videoPlayer)try{const t=this.videoPlayer.getVideoPlaybackQuality();return{packetsLost:0,packetsReceived:0,framesDropped:t.droppedVideoFrames,framesReceived:t.totalVideoFrames,timestamp:Date.now()}}catch(t){return console.warn(`${this.logPrefix} Error gathering MSE metrics:`,t),null}return null}analyzeQualityMetrics(){if(Date.now()-this.lastQualityChange<this.CONFIG.QUALITY.QUALITY_CHANGE_COOLDOWN)return{packetLossRate:0,frameDropRate:0,isStable:!0};if(this.metrics.length<2)return{packetLossRate:0,frameDropRate:0,isStable:!0};const t=this.metrics[this.metrics.length-1],n=this.metrics[0],r=(t.packetsLost-n.packetsLost)/Math.max(t.packetsReceived-n.packetsReceived,1),i=(t.framesDropped-n.framesDropped)/Math.max(t.framesReceived-n.framesReceived,1);return{packetLossRate:r,frameDropRate:i,isStable:r<this.CONFIG.QUALITY.PACKET_LOSS_THRESHOLD&&i<this.CONFIG.QUALITY.FRAME_DROP_THRESHOLD}}async analyzeAndAdaptQuality(){if(this.userRequestedRole!=="auto"||this._closed)return;const t=this.analyzeQualityMetrics(),n=Date.now()-this.lastQualityChange;if(t.isStable){if(t.isStable&&n>this.CONFIG.QUALITY.STABILITY_PERIOD){const r=t.packetLossRate,i=t.frameDropRate;r<this.CONFIG.QUALITY.PACKET_LOSS_THRESHOLD/2&&i<this.CONFIG.QUALITY.FRAME_DROP_THRESHOLD/2&&(this.effectiveRole==="low-resolution"?await this.setStreamResolution("mid-resolution","upgrade"):this.effectiveRole==="mid-resolution"&&await this.setStreamResolution("high-resolution","upgrade"))}}else this.effectiveRole==="high-resolution"?await this.setStreamResolution("mid-resolution","downgrade"):this.effectiveRole==="mid-resolution"&&await this.setStreamResolution("low-resolution","downgrade")}async setStreamResolution(t,n,r){var l;if(this._closed)return;const{source:i,sourceResolution:o,isRequestedSource:a}=this.getSourceForResolution(t);if(i._id!==((l=this._streamingSource)==null?void 0:l._id)){if(n==="upgrade"?console.log(`${this.logPrefix} Quality stable, upgrading to "${t}" source...`):n==="downgrade"&&console.log(`${this.logPrefix} Quality unstable, downgrading to "${t}" source...`),console.log(a||r?`${this.logPrefix} Switching to "${o}" source...`:`${this.logPrefix} Source "${t}" not available, switching to next best available: ${o}`),this.effectiveRole=o,this._streamingSource=i,this.lastQualityChange=Date.now(),!r&&this.userRequestedMode==="auto"){const u=await this.probeStream();if(u){const d=this.checkWebRTCCompatibility(u);if(this.activeMode.startsWith("webrtc")&&!d.compatible)return console.log(`${this.logPrefix} New source not compatible with WebRTC, switching to MSE...`),this.isAutoSwitchingInProgress=!0,void await this.restart("mse",!0);if(this.activeMode==="mse"&&d.compatible)return console.log(`${this.logPrefix} New source compatible with WebRTC, switching back...`),this.isAutoSwitchingInProgress=!0,void await this.restart("webrtc",!0)}}r||await this.restart(this.activeMode,!0)}else this.effectiveRole=r||a?o:t}getSourceForResolution(t){const n=["high-resolution","mid-resolution","low-resolution"],r=this.cameraDevice.sources.map(u=>u.role).filter(u=>n.includes(u)),i=r.reduce((u,d)=>n.indexOf(u)>n.indexOf(d)?u:d,"low-resolution"),o=this.cameraDevice.sources.find(u=>u.role===t),a=this.cameraDevice.sources.find(u=>u.role===i),l=o??a??this.cameraDevice.streamSource;if(this._streamingSource){if(this._streamingSource.role===t)return{source:this._streamingSource,sourceResolution:t,isRequestedSource:!0};const u=n.indexOf(t);if(u===-1)return{source:l,sourceResolution:l.role,isRequestedSource:!0};for(let d=u;d<n.length;d++){const h=n[d],v=`${h.split("-")[0]}ResolutionSource`,f=this.cameraDevice[v];if(f)return f._id===this._streamingSource._id?{source:this._streamingSource,sourceResolution:this._streamingSource.role,isRequestedSource:this._streamingSource.role===t}:{source:f,sourceResolution:h,isRequestedSource:h===t}}}return{source:l,sourceResolution:l.role,isRequestedSource:!1}}onFirstFrameWebrtc(t){const n=this.isAutoSwitchingInProgress,r=t.getVideoTracks()[0];if((!this.firstFrameReceived||n)&&r)if("requestVideoFrameCallback"in this.videoPlayer)this.animationFrameId=this.videoPlayer.requestVideoFrameCallback(()=>{this.onFirstFrame(n)});else{const i=()=>{this.videoPlayer.readyState>=2&&this.videoPlayer.videoWidth>0?this.onFirstFrame(n):this.animationFrameId=requestAnimationFrame(i)};this.animationFrameId=requestAnimationFrame(i)}}setActiveMode(t,n){(this.activeMode!==t||n)&&(this.activeMode=t,this.dispatchEvent(new Event("onModeChange")))}onFirstFrame(t){this.firstFrameReceived&&!t||(console.log(this.logPrefix,"First frame received"),this.firstFrameReceived=!0,this.dispatchEvent(new Event("onFirstFrame")))}onLoadedData(){console.log(this.logPrefix,"Loaded data"),this.dispatchEvent(new Event("onLoadedData"))}onFinishLoading(t,n){this._finishLoading&&!t||(this._finishLoading=!0,this.dispatchEvent(new Event("onFinishLoading"))),n&&n!=="auto"&&this.setActiveMode(n)}createCodecsList(){const t=[...this.CONFIG.MEDIA.DEFAULT_CODECS],n=typeof window>"u"?null:/Version\/(\d+).+Safari/.exec(navigator.userAgent);if(n!=null&&n[1]){const r=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";t.splice(t.indexOf(r))}return t}parseCodecs(t){return this.codecList.filter(n=>["video","audio","microphone"].includes(n.indexOf("vc1")>0?"video":"audio")).filter(n=>t(`video/mp4; codecs="${n}"`)).join()}async probeStream(){try{if(!this.streamingSource)throw new Error("No streaming source set");const t=await this.cameraDevice.probeStream(this.streamingSource._id,{video:!0,audio:["pcma","opus"],microphone:!0});return console.log(this.logPrefix,"Stream probe:",t),t&&(this._hasBackchannel=t.audio.some(n=>n.direction==="recvonly"),this._hasAudio=t.audio.filter(n=>n.direction==="sendonly").length>0,this._hasVideo=t.video.filter(n=>n.direction==="sendonly").length>0,this.dispatchEvent(new Event("onStreamProbe"))),t}catch(t){return void console.error("Error probing stream",t)}}isWebRtcCompatibleAudioCodec(t){return["opus","G722","PCMU","PCMA"].includes(t)}isWebRtcCompatibleVideoCodec(t){return["H264","VP8","VP9"].includes(t)||t==="H265"&&this.isWebRTCH265Supported()}createWsSourceName(){if(!this.cameraDevice||!this.streamingSource)throw new Error("Camera device or streaming source not set");return`${this.cameraDevice.name.replace(/ /g,"_").toLowerCase()}_${this.streamingSource.name.replace(/ /g,"_").toLowerCase()}`}isWebRTCH265Supported(){var t;try{console.log(this.logPrefix,"Checking for H.265 support...",RTCRtpSender==null?void 0:RTCRtpSender.getCapabilities("video"));const n=(t=RTCRtpSender==null?void 0:RTCRtpSender.getCapabilities("video"))==null?void 0:t.codecs;return!!n&&n.some(r=>r.mimeType.toLowerCase().includes("h265")||r.mimeType.toLowerCase().includes("hevc"))}catch{return!1}}}class u_ extends yv{constructor(t,n,r,i,o){super(i,o);p(this,"proxy");p(this,"config");p(this,"token");p(this,"subscription");p(this,"namespaces");p(this,"cameraInterfaces");this.proxy=t,this.config=n,this.token=r,this.namespaces=oo.cameraNamespaces(this.id),this.cameraInterfaces=new ta(this.proxy,this.capabilities,this.id)}get sources(){return JSON.parse(JSON.stringify(this.cameraSubject.getValue().sources)).map(t=>({...t,snapshot:async n=>this.snapshot(t._id,n),probeStream:async(n,r=!1)=>this.probeStream(t._id,n,r)}))}async init(){var t;(t=this.subscription)==null||t.unsubscribe(),this.subscription=this.proxy.subscribe(this.namespaces.cameraSubject,this.onEventMessage.bind(this)),await this.refreshStates()}async close(){await this.cleanup()}createWebRTCSession(t){return new l_(this,this.config,this.token,this.logger,t)}async refreshStates(){const t=await this.cameraControllerProxy(),n=await t.refreshStates();super.updateCamera(n.camera),super.updateCameraState(n.cameraState),super.updateFrameWorkerState(n.frameWorkerState),super.updateCapabilities(n.capabilities);for(const[r,i]of Object.entries(n.states))super.updateStateInternal(r,i,!0)}async cleanup(){var t;this.removeAllListeners(),this.unsubscribe(),(t=this.subscription)==null||t.unsubscribe(),this.subscription=void 0,await this.disconnectRpc()}async snapshot(t,n){const r=this.snapshotCache.get(t);if(!n&&r)return r;const i=await this.cameraControllerProxy(),o=await i.snapshot(t,n);return o&&o.byteLength>0?(this.snapshotCache.set(t,o),o):void 0}async probeStream(t,n,r=!1){return(await this.cameraControllerProxy()).probeStream(t,n,r)}async onEventMessage(t){const n=t.data;if("type"in n)switch(n.type){case"removed":this.cleanup();break;case"updated":super.updateCamera(n.data);break;case"cameraState":super.updateCameraState(n.data);break;case"frameWorkerState":super.updateFrameWorkerState(n.data);break;case"capabilities":super.updateCapabilities(n.data)}else{const r=n.stateName,i=n.data.newEvent;super.updateStateInternal(r,i,!0)}}async cameraControllerProxy(){return await this.proxy.createRPCProxy(this.namespaces.cameraControllerRpc,{timeout:1e4})}async disconnectRpc(){await this.proxy.disconnectRPCConnection(this.namespaces.cameraControllerRpc),await this.cameraInterfaces.disconnect()}}class d_{constructor(e){p(this,"proxy");p(this,"namespaces");p(this,"rpcConnections",new Map);this.proxy=e,this.namespaces=oo.coreManagerNamespaces()}async connectToPlugin(e){const t=await this.coreManagerProxy(),n=await t.getPlugin(e);if(n){const r=oo.pluginNamespaces(n.id);try{let i;return this.rpcConnections.has(r.pluginChildRpc)?(i=this.rpcConnections.get(r.pluginChildRpc),await i.connect()):(i=await this.proxy.createRPCConnection(r.pluginChildRpc),this.rpcConnections.set(r.pluginChildRpc,i)),i.createProxy()}catch{return}}}async getFFmpegPath(){return await(await this.coreManagerProxy()).getFFmpegPath()}async getHwaccelInfo(e){return await(await this.coreManagerProxy()).getHwaccelInfo(e)}async getServerAddresses(){return await(await this.coreManagerProxy()).getServerAddresses()}async getIceServers(){return await(await this.coreManagerProxy()).getIceServers()}async coreManagerProxy(){return await this.proxy.createRPCProxy(this.namespaces.coreManagerRpc)}}class h_{constructor(e,t,n,r){p(this,"proxy");p(this,"config");p(this,"token");p(this,"logger");p(this,"namespaces");this.proxy=e,this.config=t,this.token=n,this.logger=r,this.namespaces=oo.deviceManagerNamespaces()}async getCamera(e){const t=await this.deviceManagerProxy(),n=await t.getCamera(e,"@camera.ui/client");if(n){const r=new u_(this.proxy,this.config,this.token,n,this.logger);return await r.init(),r}}async deviceManagerProxy(){return await this.proxy.createRPCProxy(this.namespaces.deviceManagerRpc)}}class m_{constructor(e){p(this,"interceptor");p(this,"config");p(this,"logger");p(this,"proxy");p(this,"token");p(this,"_api");this.config=e,this.logger=e.logger??{...console,attention:console.warn,success:console.log},this.interceptor=new _1(e.endpoint)}get api(){return this._api}async connect(){if(this._api)return this._api;this.token=await this.login(),this.proxy=new Yg({endpoints:this.getNatsEndpoint(this.token),tls:void 0,auth:{user:"secret",password:"secret"},metadata:{id:"@camera-ui/browser-client",name:"@camera-ui/browser-client"},connect:{waitForServer:!0},reconnect:{enabled:!0},metrics:!1,bundledConnection:!0}),await this.proxy.start();const e=new d_(this.proxy),t=new h_(this.proxy,this.config,this.token,this.logger);return this._api={coreManager:e,deviceManager:t},this._api}async disconnect(){var e;if(await((e=this.proxy)==null?void 0:e.stop()),this.token)try{await this.interceptor.post("/auth/logout",void 0,{headers:{Authorization:`Bearer ${this.token}`}})}catch{}this._api=void 0,this.token=void 0}async updateCredentials(e){this.config={...this.config,...e}}async login(){if(this.config.username&&this.config.password)try{return(await(await this.interceptor.post("/auth/login",{username:this.config.username,password:this.config.password})).json()).access_token}catch(e){throw new Error(`Invalid credentials: ${e.message}`)}else{if(this.config.skipCheck)return this.config.token;try{return await this.interceptor.get("/auth/check",{headers:{Authorization:`Bearer ${this.config.token}`}}),this.config.token}catch(e){throw new Error(`Invalid token: ${e.message}`)}}}getNatsEndpoint(e){const t=new URL(this.config.endpoint),n=t.port!=="",r=t.protocol==="https:"?"wss:":"ws:",i=n?t.port:t.protocol==="https:"?"443":"80";return[`${r}//${t.hostname}:${i}/proxy?token=${e}`]}}const Re=lf.create({baseURL:`${location.origin}/api`});Re.interceptors.request.use(s=>{const{accessToken:e}=Fs();return e&&(s.headers.Authorization=`Bearer ${e}`),s},s=>Promise.reject(s));Re.interceptors.response.use(s=>s,async s=>{var n,r,i,o,a,l;const e=s.config,t=((r=(n=s.response)==null?void 0:n.data)==null?void 0:r.message)==="Token expired"||((a=(o=(i=s.response)==null?void 0:i.data)==null?void 0:o.message)==null?void 0:a.name)==="TokenExpiredError";if(((l=s.response)==null?void 0:l.status)===401&&t&&!e._retry){e._retry=!0;try{const{refreshToken:u}=Fs();return await u(),Re(e)}catch(u){return Promise.reject(u)}}return Promise.reject(s)});const Cn=()=>({add:e=>{P0.emit("add",e)}}),Bm=async s=>(await Re.get("/auth/check",{signal:s})).data,p_=async({parameter:s,signal:e})=>(await Re.get("/auth/tokens",{params:s,signal:e})).data,zm=async({loginInformation:s})=>(await Re.post("/auth/login",s)).data,Um=async()=>(await Re.post("/auth/logout")).data,f_=async({id:s,access_token:e})=>(await Re.post(`/auth/logout/${s}`,null,{params:{token:e}})).data,Vm=async({refresh_token:s})=>(await Re.post("/auth/refresh",{refresh_token:s})).data;class f9{constructor(){p(this,"_queryClient",Ci());p(this,"authStore",Fs());p(this,"t",js().t);p(this,"toast",Cn());p(this,"queryActivator",ce([{name:"checkQuery",enabled:!0},{name:"listQuery",enabled:!0}]))}get queryClient(){return this._queryClient}checkQuery(){var e;return qt({queryKey:["auth",(e=this.authStore.user)==null?void 0:e.username],queryFn:({signal:t})=>Bm(t),enabled:()=>this.queryActivator.value.some(t=>t.name==="checkQuery"&&t.enabled)})}listQuery(e){return qt({queryKey:["tokensList",e],queryFn:({signal:t})=>p_({parameter:c(e),signal:t}),placeholderData:t=>t,enabled:()=>this.queryActivator.value.some(t=>t.name==="listQuery"&&t.enabled)})}loginQuery(){return ut({mutationFn:zm})}logoutQuery(){return ut({mutationFn:Um})}logoutTokenQuery(){return ut({mutationFn:f_,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["tokensList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.user_logged_out"),life:3e3})}})}refreshQuery(){return ut({mutationFn:Vm})}toggleQueryActivator(e,t){const n=this.queryActivator.value.find(r=>r.name===e);n&&(n.enabled=t)}}const g_=async({userData:s})=>(await Re.post("/users",s)).data,v_=async({username:s,signal:e})=>(await Re.get(`/users/${s}`,{signal:e})).data,__=async({parameter:s,signal:e})=>(await Re.get("/users",{params:s,signal:e})).data,wa=async({username:s,userData:e})=>(await Re.patch(`/users/${s}`,e)).data,y_=async({username:s})=>(await Re.delete(`/users/${s}`)).data,b_=async()=>(await Re.delete("/users")).data,w_=async({username:s,cameraname:e,shortcutData:t})=>(await Re.post(`/users/${s}/preferences/cameras/${e}/shortcuts`,t)).data,x_=async({username:s,cameraname:e,shortcutid:t,signal:n})=>(await Re.get(`/users/${s}/preferences/cameras/${e}/shortcuts/${t}`,{signal:n})).data,S_=async({username:s,cameraname:e,signal:t})=>(await Re.get(`/users/${s}/preferences/cameras/${e}/shortcuts`,{signal:t})).data,C_=async({username:s,cameraname:e,shortcutid:t,shortcutData:n})=>(await Re.patch(`/users/${s}/preferences/cameras/${e}/shortcuts/${t}`,n)).data,k_=async({username:s,cameraname:e,shortcutid:t})=>(await Re.delete(`/users/${s}/preferences/cameras/${e}/shortcuts/${t}`)).data,E_=async({username:s,cameraname:e})=>(await Re.delete(`/users/${s}/preferences/cameras/${e}/shortcuts`)).data,A_=async({username:s,viewData:e})=>(await Re.post(`/users/${s}/preferences/camview/views`,e)).data,M_=async({username:s,viewid:e,signal:t})=>(await Re.get(`/users/${s}/preferences/camview/views/${e}`,{signal:t})).data,$_=async({username:s,parameter:e,signal:t})=>(await Re.get(`/users/${s}/preferences/camview/views`,{params:e,signal:t})).data,rh=async({username:s,viewid:e,viewData:t})=>(await Re.patch(`/users/${s}/preferences/camview/views/${e}`,t)).data,T_=async({username:s,viewid:e})=>(await Re.delete(`/users/${s}/preferences/camview/views/${e}`)).data,P_=async({username:s})=>(await Re.delete(`/users/${s}/preferences/camview/views`)).data;class R_{constructor(){p(this,"_queryClient",Ci());p(this,"t",js().t);p(this,"toast",Cn());p(this,"queryActivator",ce([{name:"getUserQuery",enabled:!0},{name:"getUsersQuery",enabled:!0},{name:"getShortcutQuery",enabled:!0},{name:"getShortcutsQuery",enabled:!0},{name:"getViewQuery",enabled:!0},{name:"getViewsQuery",enabled:!0}]))}get queryClient(){return this._queryClient}createUserQuery(){return ut({mutationFn:g_,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["usersList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.user_added"),life:3e3})}})}getUserQuery(e){return qt({queryKey:["users",e],queryFn:({signal:t})=>v_({username:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getUserQuery"&&t.enabled)})}getUsersQuery(e){return qt({queryKey:["usersList",e],queryFn:({signal:t})=>__({parameter:c(e),signal:t}),placeholderData:t=>t,enabled:()=>this.queryActivator.value.some(t=>t.name==="getUsersQuery"&&t.enabled)})}patchUserQuery(){return ut({mutationFn:async({username:e,userData:t,formData:n})=>{await wa({username:e,userData:t}),n&&await wa({username:e,userData:n})},onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["users",t.username]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.user_updated"),life:3e3})}})}removeUserQuery(){return ut({mutationFn:y_,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["usersList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.user_removed"),life:3e3})}})}removeUsersQuery(){return ut({mutationFn:b_,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["usersList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.users_removed"),life:3e3})}})}createShortcutQuery(){return ut({mutationFn:w_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["shortcutsList",t.username]})}})}getShortcutQuery(e,t,n){return qt({queryKey:["shortcutsList",e,t,n],queryFn:({signal:r})=>x_({username:c(e),cameraname:c(t),shortcutid:c(n),signal:r}),enabled:()=>this.queryActivator.value.some(r=>r.name==="getShortcutQuery"&&r.enabled)})}getShortcutsQuery(e,t){return qt({queryKey:["shortcutsList",e,t],queryFn:({signal:n})=>S_({username:c(e),cameraname:c(t),signal:n}),placeholderData:n=>n,enabled:()=>this.queryActivator.value.some(n=>n.name==="getShortcutsQuery"&&n.enabled)})}patchShortcutQuery(){return ut({mutationFn:C_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["shortcutsList",t.username]})},onError:e=>{console.log(e),this.toast.add({severity:"error",summary:this.t("components.toast.title_error"),detail:this.t("components.toast.error_see_console"),life:3e3})}})}removeShortcutQuery(){return ut({mutationFn:k_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["shortcutsList",t.username]})},onError:e=>{console.log(e),this.toast.add({severity:"error",summary:this.t("components.toast.title_error"),detail:this.t("components.toast.error_see_console"),life:3e3})}})}removeShortcutsQuery(){return ut({mutationFn:E_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["shortcutsList",t.username]})},onError:e=>{console.log(e),this.toast.add({severity:"error",summary:this.t("components.toast.title_error"),detail:this.t("components.toast.error_see_console"),life:3e3})}})}createViewQuery(){return ut({mutationFn:A_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["viewsList",t.username]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.view_added"),life:3e3})}})}getViewQuery(e,t){return qt({queryKey:["viewsList",e],queryFn:({signal:n})=>M_({username:c(e),viewid:c(t),signal:n}),enabled:()=>this.queryActivator.value.some(n=>n.name==="getUserQuery"&&n.enabled)})}getViewsQuery(e,t){return qt({queryKey:["viewsList",e,t],queryFn:({signal:n})=>$_({username:c(e),parameter:c(t),signal:n}),placeholderData:n=>n,enabled:()=>this.queryActivator.value.some(n=>n.name==="getViewsQuery"&&n.enabled)})}patchViewQuery(){return ut({mutationFn:rh,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["viewsList",t.username]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.view_updated"),life:3e3})}})}patchViewQuerySilent(){return ut({mutationFn:rh,onSuccess:async(e,t)=>{await this._queryClient.invalidateQueries({queryKey:["viewsList",t.username]})}})}removeViewQuery(){return ut({mutationFn:T_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["viewsList",t.username]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.view_removed"),life:3e3})}})}removeViewsQuery(){return ut({mutationFn:P_,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["viewsList",t.username]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.views_removed"),life:3e3})}})}toggleQueryActivator(e,t){const n=this.queryActivator.value.find(r=>r.name===e);n&&(n.enabled=t)}}function Al(s,e,t,n=[]){if(Array.isArray(s)&&Array.isArray(e)){const r=t?t(s,e,void 0,s,e,n):void 0;return r!==void 0?r:[...s,...e]}if(typeof e!="object")return s;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=s[r],o=e[r];n.push({key:r,sourceObject:s,targetObject:e}),Array.isArray(i)&&Array.isArray(o)?s[r]=[...i,...o]:typeof i=="object"&&i!==null&&typeof o=="object"&&o!==null?s[r]=Al({...i},o,t,n):s[r]=o,n.pop()}return s}function I_(s){return new Promise(e=>setTimeout(e,s))}function na(s,e,t=!1){if(s===e)return!0;if((s===void 0||e===void 0||s===null||e===null)&&(s||e))return!1;const n=s==null?void 0:s.constructor.name,r=e==null?void 0:e.constructor.name;if(n!==r)return!1;if(n==="Array"&&r==="Array"){if(s.length!==e.length)return!1;if(t){const i=[...e];return s.every(o=>{const a=i.findIndex(l=>na(o,l,t));return a===-1?!1:(i.splice(a,1),!0)})}else{let i=!0;for(let o=0;o<s.length;o++)if(!na(s[o],e[o],t)){i=!1;break}return i}}if(n==="Object"&&r==="Object"){let i=!0;const o=Object.keys(s),a=Object.keys(e);if(o.length!==a.length)return!1;for(let l=0;l<o.length;l++)if(s[o[l]]&&e[o[l]]){if(s[o[l]]===e[o[l]])continue;if(s[o[l]]&&(s[o[l]].constructor.name==="Array"||s[o[l]].constructor.name==="Object")){if(i=na(s[o[l]],e[o[l]],t),!i)break}else if(s[o[l]]!==e[o[l]]){i=!1;break}}else if(s[o[l]]&&!e[o[l]]||!s[o[l]]&&e[o[l]]){i=!1;break}return i}return s===e}const Fs=Mi("auth",()=>{const s=$i(),e=Dr(),t=nl("user",null,{serializer:{read:Z=>Z?JSON.parse(Z):null,write:Z=>JSON.stringify(Z)}}),n=Ls(null),r=Ls(null),i=Ls(null),o=ce(!1),a=ce(!1),l=ce(!1),u=te(()=>t.value!==null),d=te(()=>r.value!==null&&!i.value&&!o.value),h=te(()=>{var Z;return((Z=t.value)==null?void 0:Z.access_token)??null});Ke(s,()=>{a.value=!1},{deep:!0}),Ke(t,Z=>{!a.value&&!na(Z,t.value)&&k()},{deep:!0});const v=async Z=>{if(r.value)return r.value;o.value=!0,i.value=null;try{n.value||(n.value=new m_({endpoint:window.origin,token:Z,skipCheck:!0,logger:{...console,attention:console.warn,success:console.log}}));const N=await n.value.connect();return r.value=N,N}catch(N){const E=N instanceof Error?N:new Error(String(N));throw i.value=E,E}finally{o.value=!1}},f=async()=>{n.value&&(await n.value.disconnect(),n.value=null,r.value=null,i.value=null,o.value=!1)},b=async Z=>{if(!u.value){l.value=!1,a.value=!0;try{const N=await zm({loginInformation:Z});t.value=N,await v(N.access_token),e.push("/cameras")}finally{a.value=!1}}},k=async()=>{!u.value||l.value||(l.value=!0,a.value=!0,await f(),L(),await Um(),t.value=null,e.push("/"),window.location.reload(),a.value=!1)},z=async()=>{if(!t.value)return;const Z=await Vm({refresh_token:t.value.refresh_token});n.value&&await n.value.updateCredentials({endpoint:window.origin,token:Z.access_token}),t.value.access_token=Z.access_token},L=async()=>{try{if("serviceWorker"in navigator){const N=await(await navigator.serviceWorker.ready).pushManager.getSubscription();N&&await N.unsubscribe()}}catch{}},se=async(Z,N)=>{t.value&&(Z&&await wa({username:t.value.username,userData:Z}),N&&await wa({username:t.value.username,userData:N}))};return u.value&&h.value&&v(h.value).catch(Z=>{console.error("Error initializing API:",Z)}),{isLoggedIn:u,isApiReady:d,loginLoading:a,api:r,apiError:i,accessToken:h,user:t,login:b,logout:k,refreshToken:z,updateUser:se,initializeApi:v,disconnectApi:f}}),zi=(s,e="ddd., D. MMM. YY")=>(typeof s=="number"&&(s=new Date(s)),W0(s,e).value),Fr=(s="logo-512.png")=>{var r,i,o,a;if(s.startsWith("data:")||s.startsWith("blob:")||s.startsWith("http:")||s.startsWith("https:"))return s;if(s.startsWith(location.origin))return location.origin+s;if((s==="ERROR"||s==="")&&(s="logo-256.png"),s==="avatar"){const l=Fs(),u=(r=l.user)==null?void 0:r.avatar,d=(i=l.user)==null?void 0:i._id,h=(o=l.user)==null?void 0:o.access_token;if(h&&u)return`${location.origin}/api/files/${d}_avatar.jpeg?token=${h}`;s="logo-256.png"}if(s.includes("avatar")){const u=(a=Fs().user)==null?void 0:a.access_token;if(u)return`${location.origin}/api/files/${s}?token=${u}`;s="logo-256.png"}const t=`/src/assets/images/${s}`,n=Object.assign({"/src/assets/css/extras.css":Of,"/src/assets/css/inter.css":Nf,"/src/assets/css/main.css":Ff,"/src/assets/css/markdown.css":Lf,"/src/assets/css/tailwind.css":If,"/src/assets/css/theme.css":jf,"/src/assets/css/transitions.css":qf,"/src/assets/css/utils.css":Df,"/src/assets/images/error-256.png":r1,"/src/assets/images/logo-256.png":o1,"/src/assets/images/logo-512.png":c1,"/src/assets/images/logo.png":u1,"/src/assets/images/logo.svg":h1,"/src/assets/images/logo_animated.svg":p1,"/src/assets/images/logo_loading_circle.svg":g1});return n[t]?n[t].default:""},g9=async s=>new Promise(e=>{var n;s.preventDefault();const t=(n=s.target)==null?void 0:n.files;if(t){const r=t[0],i=new FileReader;r?(i.onload=o=>{var l,u;const a=(l=o.target)!=null&&l.result?(u=o.target)==null?void 0:u.result:void 0;e(a)},i.readAsDataURL(r)):e(void 0)}}),O_=(s=10)=>{const e=()=>Math.floor(Math.random()*25+10).toString(36);return Array.from({length:s},e).join("")};function Si(s,e=new WeakMap){if(typeof s!="object"||s===null)return s;if(e.has(s))return e.get(s);if(Array.isArray(s)){const n=[];return e.set(s,n),s.forEach((r,i)=>{n[i]=Si(r,e)}),n}const t={};return e.set(s,t),Object.keys(s).forEach(n=>{t[n]=Si(s[n],e)}),t}const Hm=s=>{switch(s){case"error":return"error";case"info":return"info";case"success":return"success";case"warning":return"warn";default:return"info"}},v9=s=>{s||(s=new Date);const e=new Date(s);return e.setMilliseconds(0),e},_9=s=>{s||(s=new Date);const e=new Date(s);return e.setSeconds(0,0),e.setMilliseconds(0),e},N_=["src","alt"],F_=["src","alt","width","height"],L_=Et({__name:"CuiImage",props:{src:{},alt:{default:"Image"},width:{default:"100%"},height:{default:"100%"},aspectRatio:{},cover:{type:Boolean},imageContainerClass:{},imageContainerStyle:{}},setup(s){const e=s,{src:t,width:n,height:r,aspectRatio:i,cover:o,imageContainerClass:a,imageContainerStyle:l}=Yt(e),u=ce(!1),d=ce(!1),h=te(()=>d.value?Fr():Fr(t.value)),v=()=>{u.value=!0,d.value=!1},f=()=>{u.value=!1,d.value=!0},b=k=>k?typeof k=="number"?`${k}px`:k:"auto";return(k,z)=>{const L=jr,se=R0;return m(),j(se,{alt:k.alt,class:"w-full h-full flex items-center justify-center"},{image:$(()=>[!c(u)&&!c(d)?(m(),j(L,{key:0,"stroke-width":"6",class:"w-[50%] h-[50%] max-w-[30px] max-h-[30px]"})):ae("",!0),$t(g("div",{class:ct(c(a)),style:at(c(l))},[c(d)?ae("",!0):$t((m(),A("img",{key:0,src:c(h),alt:k.alt,style:at({width:b(c(n)),height:b(c(r)),aspectRatio:c(i),objectFit:c(o)?"cover":"contain"}),onLoad:v,onError:f},null,44,N_)),[[Tr,c(u)]]),c(d)?(m(),A("img",{key:1,src:c(h),alt:k.alt,width:c(n),height:c(r),class:"contain",style:at({aspectRatio:c(i)})},null,12,F_)):ae("",!0)],6),[[Tr,c(u)||c(d)]])]),_:1},8,["alt"])}}}),Na=qs(L_,[["__scopeId","data-v-6696d637"]]),j_=Et({__name:"CuiAvatar",props:{src:{},showBorder:{type:Boolean,default:!0},size:{default:22}},setup(s){const e=s,{showBorder:t,size:n,src:r}=Yt(e);return(i,o)=>{const a=Na;return m(),A("div",{class:ct(["bg-neutral-900 overflow-hidden rounded-full",{"avatar-border":c(t)}])},[y(a,{src:c(r),height:c(n),width:c(n),cover:"","image-container-class":"w-full h-full"},null,8,["src","height","width"])],2)}}}),Qm=qs(j_,[["__scopeId","data-v-82af9e29"]]),q_={class:"flex items-center justify-center absolute left-3 h-full"},D_={key:0,class:"flex items-center shrink-0"},B_={key:1,class:"shrink-0"},z_={key:2,class:"shrink-0"},U_={key:0,class:"overflow-hidden flex-1 ml-10"},V_={class:"flex flex-row items-center justify-between"},H_={class:"text-start flex-1"},Q_={key:0,class:"text-xs text-muted"},K_=Et({__name:"CuiNavItem",props:{label:{},to:{},expanded:{type:Boolean},description:{},icon:{},iconSize:{default:24},iconClass:{},labelClass:{},activeIcon:{},avatar:{},avatarSize:{default:24},showLogout:{type:Boolean},darkMode:{type:Boolean},buttonProps:{},showTooltip:{type:Boolean},fallbackActivePath:{}},setup(s){const e=Fs(),t=$i(),n=s,{icon:r,iconSize:i,iconClass:o,activeIcon:a,avatarSize:l,avatar:u,labelClass:d,label:h,description:v,expanded:f,to:b,showLogout:k,darkMode:z,buttonProps:L,showTooltip:se,fallbackActivePath:Z}=Yt(n),N=te(()=>t.path===b.value||b.value!=="/"&&(t.path.startsWith(b.value+"/")||t.path.startsWith((Z.value??b.value)+"/"))),E=()=>{e.logout()};return(O,U)=>{const S=Qm,M=Jh,B=ws,K=Ei("RouterLink"),R=qr;return m(),j(K,{to:c(b)},{default:$(({isActive:w})=>[$t((m(),j(B,et({text:"",severity:"secondary",class:["cui-button navitem-button w-full h-full flex items-center relative",{"dark-mode":c(z),"!text-primary navitem-active":(w||c(N))&&!c(u),"hover:!text-color active:!text-color focus:!text-color":!w&&!c(N)}],fluid:""},c(L)),{default:$(()=>[g("div",q_,[c(u)?(m(),A("div",D_,[y(S,{src:c(Fr)(c(u)),size:c(l),style:at({width:`${c(l)}px`,height:`${c(l)}px`})},null,8,["src","size","style"])])):c(r)&&!w&&!c(N)||!c(a)?(m(),A("div",B_,[y(c(r),{class:ct(c(o)),style:at({width:`${c(i)}px`,height:`${c(i)}px`})},null,8,["class","style"])])):c(a)&&(w||c(N))?(m(),A("div",z_,[y(c(a),{style:at({width:`${c(i)}px`,height:`${c(i)}px`})},null,8,["style"])])):ae("",!0)]),y(Ct,{name:"fade"},{default:$(()=>[c(f)?(m(),A("div",U_,[g("div",V_,[g("div",H_,[g("div",{class:ct(["text-sm max-w-100 truncate font-semibold",[c(d),{"text-color font-bold":c(u)}]])},de(c(h)),3),c(v)?(m(),A("div",Q_,de(c(v)),1)):ae("",!0)]),c(k)?(m(),j(B,{key:0,text:"",rounded:"",class:"dark-mode cui-icon-md",onClick:E},{icon:$(()=>[y(M,{width:"100%",height:"100%"})]),_:1})):ae("",!0)])])):ae("",!0)]),_:1})]),_:2},1040,["class"])),[[R,{value:c(se)&&!c(f)?c(h):"",pt:{root:{class:"dark-mode"}}}]])]),_:1},8,["to"])}}}),Km=qs(K_,[["__scopeId","data-v-13c365f7"]]),Z_="modulepreload",G_=function(s){return"/"+s},ih={},ys=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let o=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=o(t.map(u=>{if(u=G_(u),u in ih)return;ih[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const v=document.createElement("link");if(v.rel=d?"stylesheet":Z_,d||(v.as="script"),v.crossOrigin="",v.href=u,l&&v.setAttribute("nonce",l),document.head.appendChild(v),d)return new Promise((f,b)=>{v.addEventListener("load",f),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})},W_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J_(s,e){return m(),A("svg",W_,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m4 10l-.707.707L2.586 10l.707-.707zm17 8a1 1 0 1 1-2 0zM8.293 15.707l-5-5l1.414-1.414l5 5zm-5-6.414l5-5l1.414 1.414l-5 5zM4 9h10v2H4zm17 7v2h-2v-2zm-7-7a7 7 0 0 1 7 7h-2a5 5 0 0 0-5-5z"},null,-1)]))}const Y_=pe({name:"lets-icons-back",render:J_}),X_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ey(s,e){return m(),A("svg",X_,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8z"},null,-1)]))}const ty=pe({name:"mdi-home",render:ey}),sy={class:"relative flex items-center justify-center draggable-region"},ny={class:"container mx-auto px-6 relative z-10"},ry={class:"text-center"},iy={class:"text-8xl font-bold mb-4 relative flex items-center justify-center"},oy={class:"relative w-24 h-24 mx-2 group"},ay={class:"relative z-1 scale-150 non-draggable-region"},cy={class:"text-muted max-w-md mx-auto mb-8"},ly={class:"flex items-center justify-center gap-4"},uy={class:"text-white"},dy=Et({__name:"404",setup(s){return(e,t)=>{const n=ty,r=ws,i=Ei("RouterLink"),o=Y_;return m(),A("div",sy,[g("div",ny,[g("div",ry,[g("h1",iy,[t[1]||(t[1]=g("span",null,"4",-1)),g("div",oy,[g("div",ay,[y(c($a),{src:c(Fr)("logo_animated.svg"),width:"95px",height:"80px",title:"camera.ui","aria-label":"camera.ui",class:"transform transition-transform duration-300 group-hover:scale-110"},null,8,["src"])])]),t[2]||(t[2]=g("span",null,"4",-1))]),t[3]||(t[3]=g("h2",{class:"text-3xl font-semibold mb-4"},"Oops!",-1)),g("p",cy,de(e.$t("views.404.error_message")),1),g("div",ly,[y(i,{to:"/"},{default:$(()=>[y(r,{class:"cui-button flex items-center gap-2 non-draggable-region"},{default:$(()=>[y(n,{class:"text-white"}),g("span",uy,de(e.$t("components.form.button.home")),1)]),_:1})]),_:1}),y(r,{severity:"secondary",class:"cui-button flex items-center gap-2 non-draggable-region",onClick:t[0]||(t[0]=a=>e.$router.back())},{default:$(()=>[y(o,{class:"text-muted"}),g("span",null,de(e.$t("components.form.button.back")),1)]),_:1})])])])])}}}),hy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function my(s,e){return m(),A("svg",hy,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.1.1 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.1 16.1 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09c-.01-.02-.04-.03-.07-.03c-1.5.26-2.93.71-4.27 1.33c-.01 0-.02.01-.03.02c-2.72 4.07-3.47 8.03-3.1 11.95c0 .02.01.04.03.05c1.8 1.32 3.53 2.12 5.24 2.65c.03.01.06 0 .07-.02c.4-.55.76-1.13 1.07-1.74c.02-.04 0-.08-.04-.09c-.57-.22-1.11-.48-1.64-.78c-.04-.02-.04-.08-.01-.11c.11-.08.22-.17.33-.25c.02-.02.05-.02.07-.01c3.44 1.57 7.15 1.57 10.55 0c.02-.01.05-.01.07.01c.11.09.22.17.33.26c.04.03.04.09-.01.11c-.52.31-1.07.56-1.64.78c-.04.01-.05.06-.04.09c.32.61.68 1.19 1.07 1.74c.03.01.06.02.09.01c1.72-.53 3.45-1.33 5.25-2.65c.02-.01.03-.03.03-.05c.44-4.53-.73-8.46-3.1-11.95c-.01-.01-.02-.02-.04-.02M8.52 14.91c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12c0 1.17-.84 2.12-1.89 2.12m6.97 0c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12c0 1.17-.83 2.12-1.89 2.12"},null,-1)]))}const py=pe({name:"ic-baseline-discord",render:my}),fy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function gy(s,e){return m(),A("svg",fy,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"},null,-1)]))}const vy=pe({name:"mdi-github",render:gy});function Zm(s){const e=["kasa://","nest:","ring:","tapo://"];return s.some(t=>e.some(n=>t.startsWith(n)))}const Gm=bt({enabled:vs().default(!1)}).strict(),_y=Os([we("animal"),we("person"),we("vehicle"),we("other"),we("motion")]),Ml=ff([xn(),xn()]),$l=bt({name:Ze().trim().min(1,"Zone Name is required"),points:Ml.array().min(3,"At least 3 points are required"),type:Os([we("intersect"),we("contain")]),filter:Os([we("include"),we("exclude")]),classes:_y.array(),isPrivacyMask:vs(),color:Ze().trim().regex(/^#([0-9A-Fa-f]{3}){1,2}$/,"Must be a valid hex color (e.g. #FF0000 or #F00)").default("#df2a4c")}).array(),Wm=bt({motion:bt({timeout:xn().min(10,"Minimum 10 seconds")}),object:bt({confidence:xn().min(.3,"Minimum 0.3").max(1,"Maximum 1")})}),Tl=Os([we("high-resolution"),we("mid-resolution"),we("low-resolution"),we("snapshot")]),yy=Os([we("high-resolution"),we("mid-resolution"),we("low-resolution"),we("auto")]),Jm=Os([we("bubble://"),we("cui://"),we("doorbird://"),we("dvrip://"),we("echo:"),we("eseecloud://"),we("exec:"),we("expr:"),we("ffmpeg:"),we("flussonic://"),we("gopro://"),we("hass:"),we("homekit://"),we("http://"),we("https://"),we("httpx://"),we("isapi://"),we("ivideon:"),we("kasa://"),we("nest:"),we("onvif://"),we("ring:"),we("roborock://"),we("rtmp://"),we("rtsp://"),we("rtspx://"),we("tapo://"),we("tcp://"),we("tuya://"),we("webrtc:"),we("webtorrent:")]),by=Jm.options.map(s=>s.value),wy=new RegExp(`^(${by.join("|")})`),Ym=Ze().refine(s=>{if(!wy.test(s))return!1;try{return new URL(s),!0}catch{return!1}},{message:"Invalid URL format or unsupported protocol"}),xy=bt({_id:Ze().default(dn()).transform(()=>dn()),name:Ze().trim().min(1,"Camera Source Name is required").transform(s=>s.replace(/ /g,"_").toLowerCase()),role:Tl,useForSnapshot:vs().default(!1),hotMode:vs().default(!0),preload:vs().default(!0),urls:Ym.array().min(1,"At least one valid URL is required")}).strict(),Sy=bt({_id:Ze().default(dn()).transform(()=>dn()),name:Ze().trim().min(1,"Camera Source Name is required").transform(s=>s.replace(/ /g,"_").toLowerCase()),role:Tl,useForSnapshot:vs().default(!1),hotMode:vs().default(!0),preload:vs().default(!0),urls:Ym.array().min(1,"At least one valid URL is required")}).strict(),Cr=bt({id:Ze(),name:Ze().trim()}),Xm=bt({hub:Cr.array().optional(),cameraController:Cr.optional(),motionDetection:Cr.optional(),audioDetection:Cr.optional(),objectDetection:Cr.optional(),ptz:Cr.optional(),plugins:Cr.array()}).strict(),Cy=Os([we("auto"),we("mse"),we("webrtc"),we("webrtc/tcp")]),ky=Os([we("16:9"),we("8:3"),we("4:3"),we("auto")]),ep=bt({decoder:Os([we("pillow"),we("wasm"),we("rust"),we("gpu")]),fps:xn().min(0,"Minimum 0 fps").max(30,"Maximum 30 fps"),resolution:Os([we("640x480"),we("640x360"),we("320x240"),we("320x180")])}),tp=Os([we("camera"),we("doorbell")]),sp=bt({streamingMode:Cy,streamingSource:yy,aspectRatio:ky}),np=bt({model:Ze().trim().optional(),manufacturer:Ze().trim().optional(),hardware:Ze().trim().optional(),serialNumber:Ze().trim().optional(),firmwareVersion:Ze().trim().optional(),supportUrl:Ze().trim().optional()}),Ey=bt({name:Ze().trim().min(1,"Camera name is required"),url:Ze().trim().url().min(1,"Camera URL is required"),type:Os([we("Google"),we("Ring"),we("HomeKit"),we("Onvif"),we("Hass"),we("GoPro"),we("Roborock"),we("FFmpeg"),we("DVRip"),we("Webtorrent")]),username:Ze().trim().optional(),email:Ze().trim().email().optional(),password:Ze().trim().optional(),pin:Ze().trim().length(8,{message:"PIN must be 8 characters long"}).optional(),clientId:Ze().trim().optional(),clientSecret:Ze().trim().optional(),refreshToken:Ze().trim().optional(),projectId:Ze().trim().optional()}).strict().refine(s=>s.type==="HomeKit"?!!s.pin:!0,{message:"PIN is required for HomeKit cameras",path:["pin"]}).refine(s=>s.type==="Google"?!!s.clientId:!0,{message:"Client ID is required for Google cameras",path:["clientId"]}).refine(s=>s.type==="Google"?!!s.clientSecret:!0,{message:"Client Secret is required for Google cameras",path:["clientSecret"]}).refine(s=>s.type==="Google"?!!s.projectId:!0,{message:"Project ID is required for Google cameras",path:["projectId"]}).refine(s=>s.type==="Google"?!!s.refreshToken:!0,{message:"Refresh Token is required for Google cameras",path:["refreshToken"]}).refine(s=>s.type==="Ring"?!!s.email:!0,{message:"Email is required",path:["email"]}).refine(s=>s.type==="Roborock"?!!s.username:!0,{message:"Username is required",path:["username"]}).refine(s=>s.type==="Roborock"||s.type==="Ring"?!!s.password:!0,{message:"Password is required",path:["password"]}),Ay=bt({id:Ze(),name:Ze()}).strict(),My=bt({_id:Ze().default(dn()).transform(()=>dn()),nativeId:Ze().trim().optional(),pluginInfo:Ay.optional(),disabled:vs().default(!1),name:Ze().trim().min(1,"Camera name is required"),type:tp.default("camera"),isCloud:vs().default(!1),snapshotTTL:xn().min(10,"Minimum cache time must be 10").default(10),info:np.default({model:"IP Camera",manufacturer:"camera.ui",hardware:"Camera",serialNumber:"Unknown",firmwareVersion:"Unknown",supportUrl:"Unknown"}),sources:xy.array().refine(s=>s.some(e=>e.role==="high-resolution"||e.role==="mid-resolution"||e.role==="low-resolution"),{path:["sources[].role"],message:'One of the roles "high-resolution", "mid-resolution" or "low-resolution" is required'}).refine(s=>s.filter(t=>t.useForSnapshot).length<=1,{message:"Only one source can be used for snapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.useForSnapshot),{message:"Snapshot source can not be used with useForSnapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.hotMode),{message:"Snapshot source can not be used with hotMode"}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.preload),{message:"Snapshot source can not be used with preload"}),extensions:Xm.default({hub:[],plugins:[]}),recording:Gm.default({enabled:!1}),interface:sp.default({streamingMode:"webrtc",streamingSource:"auto",aspectRatio:"16:9"}),detectionZones:$l.default([]),detectionSettings:Wm.default({motion:{timeout:60},object:{confidence:.7}}),frameWorkerSettings:ep.default({decoder:"rust",fps:10,resolution:"320x180"})}).strict().transform(s=>{const e=s.sources.flatMap(t=>t.urls);return s.isCloud||Zm(e)?{...s,isCloud:!0}:s}),$y=bt({disabled:vs().optional(),type:tp.optional(),name:Ze().trim().min(1,"Camera name is required").optional(),isCloud:vs().optional(),snapshotTTL:xn().min(10,"Minimum cache time must be 10").optional(),info:np.partial().optional(),sources:Sy.array().refine(s=>s.some(e=>e.role==="high-resolution"||e.role==="mid-resolution"||e.role==="low-resolution"),{path:["sources[].role"],message:'One of the roles "high-resolution", "mid-resolution" or "low-resolution" is required'}).refine(s=>s.filter(t=>t.useForSnapshot).length<=1,{message:"Only one source can be used for snapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.useForSnapshot),{message:"Snapshot source can not be used with useForSnapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.hotMode),{message:"Snapshot source can not be used with hotMode"}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.preload),{message:"Snapshot source can not be used with preload"}).optional(),extensions:Xm.partial().optional(),interface:sp.partial().optional(),recording:Gm.partial().optional(),detectionZones:$l.optional(),detectionSettings:Wm.partial().optional(),frameWorkerSettings:ep.partial().optional()}).strict().transform(s=>{if(s.sources){const e=s.sources.flatMap(t=>t.urls);if(s.isCloud===!0||Zm(e))return{...s,isCloud:!0}}return s});bt({url:Ze().trim()}).strict();const Ty=/^((@[\w-.]*)\/)?(camera-ui-[\w-]*)$/;var Py=(s=>(s.READY="ready",s.STARTING="starting",s.STARTED="started",s.STOPPING="stopping",s.STOPPED="stopped",s.ERROR="error",s.UNKNOWN="unknown",s.DISABLED="disabled",s))(Py||{});const oh=["image/jpeg","image/png"],ah=1024*1024*2,ch=["video/mp4","video/quicktime"],lh=1024*1024*10,uh=["audio/mpeg","audio/wav","audio/ogg"],dh=1024*1024*2;bt({pluginname:Ze().trim().refine(s=>Ty.test(s),"Not a valid plugin name"),pluginversion:Ze().trim().optional().default("latest")}).strict();bt({actionId:Ze(),payload:lr()}).strict();cl(lr(),lr());bt({upload:Vn().refine(s=>(t=>t.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=ah:s.size<=ah,"Max file size is 2 MB").refine(s=>(t=>t.mimetype!==void 0)(s)?oh.includes(s.mimetype):oh.includes(s.type),".jpeg and .png files are accepted"),metadata:Vn().transform(s=>JSON.parse(s.value)),config:Vn().transform(s=>JSON.parse(s.value))});bt({upload:Vn().refine(s=>(t=>t.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=dh:s.size<=dh,"Max file size is 2 MB").refine(s=>(t=>t.mimetype!==void 0)(s)?uh.includes(s.mimetype):uh.includes(s.type),".mp3, .wav and .ogg files are accepted"),metadata:Vn().transform(s=>JSON.parse(s.value)),config:Vn().transform(s=>JSON.parse(s.value))});bt({upload:Vn().refine(s=>(t=>t.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=lh:s.size<=lh,"Max file size is 5 MB").refine(s=>(t=>t.mimetype!==void 0)(s)?ch.includes(s.mimetype):ch.includes(s.type),".mp4 files are accepted"),config:Vn().transform(s=>JSON.parse(s.value))});cl(Ze(),lr());bt({key:Ze()}).strict();bt({key:Ze(),payload:lr()}).strict();bt({version:Ze().trim().optional().default("latest")}).strict();const Ry=bt({mode:Os([we("disabled"),we("port-forward"),we("router-forward"),we("cloudflare"),we("custom-domain")]).default("disabled"),cloudflare:bt({tunnelToken:Ze().trim(),customDomain:Ze().trim(),tunnelUrl:Ze().trim(),tunnelCredentials:bt({username:Ze().trim(),password:Ze().trim()}).partial()}).partial().strict(),customDomain:bt({url:Ze().trim().optional()}).partial().strict()}).strict(),y9=bt({serverAddresses:Ze().trim().ip().array().default([]),remoteAccess:Ry}).strict(),hh=["image/jpeg","image/jpg","image/png"],mh=1024*1024*5,rp=bt({index:xn(),cameraId:Ze()}),ip=Os([we(1),we(4),we(6),we(7),we(9),we(10),we(12),we(13),we(15),we(16),we(20),we(26)]),Iy=Os([we("dnd"),we("view")]),op=bt({_id:Ze().default(dn()).transform(()=>dn()),name:Ze().trim().min(1,"Layout name is required"),viewSize:ip,cameras:rp.array(),type:Iy});bt({name:Ze().trim().min(1,"Layout name is required"),viewSize:ip,cameras:rp.array()}).partial().optional();const Oy=bt({views:op.array()}),Ny=bt({_id:Ze().default(dn()).transform(()=>dn()),cameraId:Ze(),points:Ml});bt({cameraId:Ze(),points:Ml}).partial().optional();const Fy=bt({shortcuts:Ny.array()}),ap=bt({camview:Oy,cameras:cl(Ze().trim(),Fy)}),Ly=bt({_id:Ze().default(dn()).transform(()=>dn()),username:Ze().trim().min(1,"Username is required"),password:Ze().trim().min(10,"Password must be at least 10 characters long").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,`Password must contain at least one special character (!@#$%^&*()_+-=[]{};:'"\\|,.<>/?)`).max(32,"Password cannot be more than 32 characters"),passwordConfirm:Ze().trim().min(1,"Please confirm your password"),role:Os([we("admin"),we("user")]),sessionTimer:xn().min(3600,"Session timer must not be less than 3600 seconds (1h)").max(86400,"Session timer must not be greater than 86400 seconds (24h)").default(14400),rememberMe:vs().default(!1),singleSession:vs().default(!1),firstLogin:vs().default(!0),preferences:ap.default({camview:{views:[]},cameras:{}})}).strict().refine(s=>s.password===s.passwordConfirm,{path:["passwordConfirm"],message:"Passwords do not match"}),jy=bt({username:Ze().trim().min(1,"Username is required"),password:Ze().trim().min(1,"Password is required"),rememberMe:vs().default(!1)}).strict(),qy=bt({username:Ze().trim().min(1,"Username is required").optional(),password:Ze().trim().min(10,"Password must be at least 10 characters long").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,`Password must contain at least one special character (!@#$%^&*()_+-=[]{};:'"\\|,.<>/?)`).max(32,"Password cannot be more than 32 characters").optional(),passwordConfirm:Ze().trim().optional(),role:Os([we("admin"),we("user")]).optional(),sessionTimer:xn().min(3600,"Session timer must not be less than 3600 seconds (1h)").max(86400,"Session timer must not be greater than 86400 seconds (24h)").optional(),upload:gf(Vn().refine(s=>(t=>t.mimetype!==void 0)(s)?Buffer.byteLength(s._buf)<=mh:s.size<=mh,"Max file size is 5MB.").refine(s=>(t=>t.mimetype!==void 0)(s)?hh.includes(s.mimetype):hh.includes(s.type),".jpg, .jpeg, .png files are accepted.")),rememberMe:vs().optional(),singleSession:vs().optional(),firstLogin:vs().optional(),preferences:ap.partial().optional()}).strict().refine(s=>s.password===s.passwordConfirm,{path:["passwordConfirm"],message:"Passwords do not match"});function ra(s,e,t=!1){if(s===e)return!0;if((s===void 0||e===void 0||s===null||e===null)&&(s||e))return!1;const n=s==null?void 0:s.constructor.name,r=e==null?void 0:e.constructor.name;if(n!==r)return!1;if(n==="Array"&&r==="Array"){if(s.length!==e.length)return!1;if(t){const i=[...e];return s.every(o=>{const a=i.findIndex(l=>ra(o,l,t));return a===-1?!1:(i.splice(a,1),!0)})}else{let i=!0;for(let o=0;o<s.length;o++)if(!ra(s[o],e[o],t)){i=!1;break}return i}}if(n==="Object"&&r==="Object"){let i=!0;const o=Object.keys(s),a=Object.keys(e);if(o.length!==a.length)return!1;for(let l=0;l<o.length;l++)if(s[o[l]]&&e[o[l]]){if(s[o[l]]===e[o[l]])continue;if(s[o[l]]&&(s[o[l]].constructor.name==="Array"||s[o[l]].constructor.name==="Object")){if(i=ra(s[o[l]],e[o[l]],t),!i)break}else if(s[o[l]]!==e[o[l]]){i=!1;break}}else if(s[o[l]]&&!e[o[l]]||!s[o[l]]&&e[o[l]]){i=!1;break}return i}return s===e}const or=s=>s.type==="string"&&!("enum"in s),ph=s=>s.type==="number",fh=s=>s.type==="boolean",xa=s=>s.type==="string"&&"enum"in s,gh=s=>s.type==="array",Ur=s=>s.type==="button",Vr=s=>s.type==="submit",Dy=s=>or(s)&&(!s.format||s.format!=="qrCode"&&s.format!=="image"),By=(s,e)=>{if(!s||Object.keys(s).length===0)return!0;const t=e.filter(n=>!Ur(n)&&!Vr(n));for(const n of t){const r=ri(s,n.key),i=Pl(n);if(r!==void 0&&!ra(r,i,!0))return!1}return!0},Pl=s=>{if("defaultValue"in s&&s.defaultValue!==void 0)return s.defaultValue;switch(s.type){case"string":return xa(s)?s.multiple?[]:s.required?s.enum[0]:"":"";case"number":return 0;case"boolean":return!1;case"array":return[];default:return}},zy=s=>{const e={};for(const t of s)Ur(t)||Vr(t)||(e[t.key]=Pl(t));return e},ri=(s={},e)=>{if(!e.includes(".")&&!e.includes("["))return s[e];const t=e.split(".").reduce((r,i)=>{if(i.includes("[")){const[o,a]=i.split("[");r.push(o,a.slice(0,-1))}else r.push(i);return r},[]);let n=s;for(const r of t){if(n==null)return;n=n[r]}return n},ac=(s,e,t)=>{if(!e.includes(".")&&!e.includes("[")){s[e]=t;return}const n=e.split(".").reduce((o,a)=>{if(a.includes("[")){const[l,u]=a.split("[");o.push(l,u.slice(0,-1))}else o.push(a);return o},[]),r=n.pop();if(!r)return;let i=s;for(const o of n){if(i[o]===void 0||i[o]===null){const a=n[n.indexOf(o)+1];i[o]=isNaN(Number(a))?{}:[]}i=i[o]}i[r]=t},b9=(s,e)=>{const t={};for(const n of s)if("store"in n&&n.store&&!Ur(n)&&!Vr(n)){const r=ri(e,n.key);r!==void 0&&(t[n.key]=r)}return t},cp=(s,e)=>e?s.filter(t=>"group"in t&&t.group===e):s,Uy=(s,e)=>{const t=cp(s,e);return t.length>0&&t.every(n=>"readonly"in n&&n.readonly)},Vy=(s,e)=>{const t=cp(s,e);return t.length>0&&t.some(n=>"store"in n&&n.store)},Hy=(s,e)=>{if(!e)return!0;const t={"date-time":n=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})?$/.test(n),date:n=>/^\d{4}-\d{2}-\d{2}$/.test(n),time:n=>/^([01]?[0-9]|2[0-3]):([0-5][0-9])(:([0-5][0-9]))?$/.test(n),email:n=>/^\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b$/.test(n),uuid:n=>/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(n),ipv4:n=>/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(n),ipv6:n=>/^\s*([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})\s*$/.test(n)};return e in t?t[e](s):!0},lp=s=>{if(Ur(s)||Vr(s))return lr();switch(s.type){case"string":if(xa(s))if(s.multiple){let i=Cu(Ze().trim().refine(o=>s.enum.includes(o),{message:"Invalid selection"}));return s.required&&(i=i.min(1,{message:"Required"})),s.required?i:i.optional()}else{const i=vf(s.enum);return s.required?i:i.optional()}let e=Ze().trim();return s.required&&(e=e.nonempty("Required")),s.minLength!==void 0&&(e=e.min(s.minLength)),s.maxLength!==void 0&&(e=e.max(s.maxLength)),s.format&&(e=e.refine(i=>!i||i.trim()===""||Hy(i,s.format),{message:`Invalid ${s.format} format`})),s.required?e:e.optional();case"number":let t=xn();return s.minimum!==void 0&&(t=t.min(s.minimum)),s.maximum!==void 0&&(t=t.max(s.maximum)),s.required&&(t=t.refine(i=>i!=null,{message:"Required"})),s.required?t:t.optional();case"boolean":return s.required?vs():vs().optional();case"array":const n=lp(s.items),r=Cu(n);return s.required?r:r.optional();default:return s.required?lr():lr().optional()}},Qy=s=>{const e={};return s.forEach(t=>{!Ur(t)&&!Vr(t)&&(e[t.key]=lp(t))}),bt(e)},Ky=Gn(jy),w9=Gn(Ly),x9=Gn(qy),S9=Gn(op),Zy={class:"flex justify-center items-center draggable-region"},Gy={class:"card-background border-color relative w-full md:w-[400px] rounded-none md:rounded-2xl md:border-[1px] shadow-none md:shadow-xl h-full md:h-auto md:my-4"},Wy={class:"flex flex-col h-full p-10 non-draggable-region"},Jy={class:"flex flex-col items-center justify-center mb-10"},Yy={class:"flex flex-col gap-10 md:gap-6 w-full mt-10 md:mt-0"},Xy={for:"username",class:"cui-label"},e2={for:"password",class:"cui-label"},t2={class:"flex flex-col gap-6 mt-10"},s2={class:"flex items-center field-checkbox-gap"},n2={for:"rememberMe",class:"cui-label-checkbox"},r2={class:"flex justify-end items-center gap-1"},i2=Et({__name:"Login",setup(s){const e=Cn(),t=Fs(),{t:n}=js(),{loginLoading:r}=Vs(t),i=Vt("formRef"),o=ce(""),a=ce(""),l=ce(!1),u=async()=>{var h;const d=await((h=i.value)==null?void 0:h.validate());if(d!=null&&d.valid&&d.values)try{await t.login({username:o.value,password:a.value,rememberMe:l.value})}catch(v){console.error(v),e.add({severity:"error",summary:n("components.toast.title_error"),detail:v.message,life:3e3}),r.value=!1}};return(d,h)=>{const v=ki,f=Oh,b=I0,k=ws,z=Ea,L=vy,se=py;return m(),A("div",Zy,[g("div",Gy,[g("div",Wy,[g("div",Jy,[y(c($a),{src:c(Fr)("logo_animated.svg"),height:"60px",title:"camera.ui","aria-label":"camera.ui",class:"hover:scale-105 active:scale-105 focus:scale-105 transition-all"},null,8,["src"]),h[3]||(h[3]=g("span",{class:"text-2xl ml-3 mt-2 font-bold text-color"},"camera.ui",-1))]),y(c(al),{ref_key:"formRef",ref:i,"validation-schema":c(Ky),class:"flex flex-col h-full",onSubmit:u},{default:$(()=>[g("div",Yy,[y(c(Nt),{modelValue:c(o),"onUpdate:modelValue":h[0]||(h[0]=Z=>ps(o)?o.value=Z:null),modelModifiers:{trim:!0},name:"username",as:"div",class:"flex flex-col field-gap"},{default:$(({field:Z,errors:N})=>[g("label",Xy,de(d.$t("components.form.label.username")),1),y(v,et({invalid:N.length>0,type:"text",size:"large",loading:c(r),fluid:""},Z),null,16,["invalid","loading"]),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"username",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:c(a),"onUpdate:modelValue":h[1]||(h[1]=Z=>ps(a)?a.value=Z:null),name:"password",as:"div",class:"flex flex-col field-gap"},{default:$(({field:Z,errors:N})=>[g("label",e2,de(d.$t("components.form.label.password")),1),y(f,et({invalid:N.length>0,size:"large",loading:c(r),feedback:!1,"toggle-mask":"",fluid:""},Z),null,16,["invalid","loading"]),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"password",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"])]),g("div",t2,[y(c(Nt),{"model-value":c(l),name:"rememberMe",type:"checkbox","checked-value":!0,"unchecked-value":!1,as:"div",class:"flex flex-col field-gap"},{default:$(({field:Z,errors:N})=>[g("div",s2,[y(b,et({"model-value":c(l)},Z,{invalid:N.length>0,class:"mr-2",binary:"",loading:c(r),onValueChange:h[2]||(h[2]=E=>l.value=E)}),null,16,["model-value","invalid","loading"]),g("label",n2,de(d.$t("components.form.label.remember_me")),1)]),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"rememberMe",class:"cui-input-checkbox-error"})]),_:1})]),_:1},8,["model-value"]),y(k,{type:"submit",class:"text-white font-semibold cui-button-large",loading:c(r),label:d.$t("components.form.button.login"),fluid:""},null,8,["loading","label"])])]),_:1},8,["validation-schema"]),y(z,{class:"mt-15"}),g("div",r2,[y(k,{severity:"secondary",class:"cui-icon-md",text:"",rounded:""},{icon:$(()=>[y(L,{class:"text-muted",width:"100%",height:"100%"})]),_:1}),y(k,{severity:"secondary",class:"cui-icon-md",text:"",rounded:""},{icon:$(()=>[y(se,{class:"text-muted",width:"100%",height:"100%"})]),_:1})])]),h[4]||(h[4]=g("div",{class:"bg-primary-500 opacity-0 md:opacity-100 absolute blur-3xl w-[200px] h-[30px] left-[50%] -translate-x-[50%] bottom-0 -z-1"},null,-1))])])}}}),up=Mi("loading",()=>({routerLoading:ce(!1)})),o2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function a2(s,e){return m(),A("svg",o2,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M9 13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2zm10 0a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2zM9 3a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm10 0a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"})],-1)]))}const vh=pe({name:"mingcute-grid-fill",render:a2}),c2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function l2(s,e){return m(),A("svg",c2,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M9 13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2zm10 0a2 2 0 0 1 1.995 1.85L21 15v4a2 2 0 0 1-1.85 1.995L19 21h-4a2 2 0 0 1-1.995-1.85L13 19v-4a2 2 0 0 1 1.85-1.995L15 13zM9 15H5v4h4zm10 0h-4v4h4zm0-12a2 2 0 0 1 1.995 1.85L21 5v4a2 2 0 0 1-1.85 1.995L19 11h-4a2 2 0 0 1-1.995-1.85L13 9V5a2 2 0 0 1 1.85-1.995L15 3zM9 3a2 2 0 0 1 1.995 1.85L11 5v4a2 2 0 0 1-1.85 1.995L9 11H5a2 2 0 0 1-1.995-1.85L3 9V5a2 2 0 0 1 1.85-1.995L5 3zm10 2h-4v4h4zM9 5H5v4h4z"})],-1)]))}const _h=pe({name:"mingcute-grid-line",render:l2}),u2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function d2(s,e){return m(),A("svg",u2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M20.916 9.564a1 1 0 0 0-.513-1.316L7.328 2.492c-.995-.438-2.22.051-2.645 1.042l-2.21 5.154a2 2 0 0 0 1.052 2.624L9.563 13.9L8.323 17H4v-3H2v8h2v-3h4.323c.823 0 1.552-.494 1.856-1.258l1.222-3.054l5.205 2.23a1 1 0 0 0 1.31-.517l.312-.71l1.701.68l2-5l-1.536-.613zm-4.434 5.126L4.313 9.475l2.208-5.152l12.162 5.354z"},null,-1)]))}const yh=pe({name:"bx-cctv",render:d2}),h2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function m2(s,e){return m(),A("svg",h2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M18.618 7.462L6.403 2.085a1 1 0 0 0-.77-.016a1 1 0 0 0-.552.537l-3 7a1 1 0 0 0 .525 1.313L9.563 13.9L8.323 17H4v-3H2v8h2v-3h4.323c.823 0 1.552-.494 1.856-1.258l1.222-3.054l3.419 1.465a1 1 0 0 0 1.311-.518l3-6.857a1 1 0 0 0-.513-1.316m1.312 8.91l-1.858-.742l1.998-5l1.858.741z"},null,-1)]))}const Vc=pe({name:"bxs-cctv",render:m2}),p2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function f2(s,e){return m(),A("svg",p2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M21 10V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h6v-1.87l8.39-8.39c.44-.44 1-.68 1.61-.74m-7-5.5l5.5 5.5H14zm8.85 9.69l-.98.98l-2.04-2.04l.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72m-3.72-.36l2.04 2.04L15.04 22H13v-2.04z"},null,-1)]))}const bh=pe({name:"mdi-note-edit",render:f2}),g2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v2(s,e){return m(),A("svg",g2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h6v-1.87l.13-.13H5V5h7v7zM14 4.5l5.5 5.5H14zm5.13 9.33l2.04 2.04L15.04 22H13v-2.04zm3.72.36l-.98.98l-2.04-2.04l.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72"},null,-1)]))}const wh=pe({name:"mdi-note-edit-outline",render:v2}),_2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function y2(s,e){return m(),A("svg",_2,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h3a1 1 0 0 0 1-1V5a2 2 0 0 1 4 0v1a1 1 0 0 0 1 1h3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h1a2 2 0 0 1 0 4h-1a1 1 0 0 0-1 1v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1"},null,-1)]))}const xh=pe({name:"tabler-puzzle",render:y2}),b2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function w2(s,e){return m(),A("svg",b2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M10 2a3 3 0 0 1 2.995 2.824L13 5v1h3a2 2 0 0 1 1.995 1.85L18 8v3h1a3 3 0 0 1 .176 5.995L19 17h-1v3a2 2 0 0 1-1.85 1.995L16 22h-3a2 2 0 0 1-1.995-1.85L11 20v-1a1 1 0 0 0-1.993-.117L9 19v1a2 2 0 0 1-1.85 1.995L7 22H4a2 2 0 0 1-1.995-1.85L2 20v-3a2 2 0 0 1 1.85-1.995L4 15h1a1 1 0 0 0 .117-1.993L5 13H4a2 2 0 0 1-1.995-1.85L2 11V8a2 2 0 0 1 1.85-1.995L4 6h3V5a3 3 0 0 1 3-3"},null,-1)]))}const Hc=pe({name:"tabler-puzzle-filled",render:w2}),x2={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function S2(s,e){return m(),A("svg",x2,e[0]||(e[0]=[g("g",{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"4"},[g("rect",{width:"40",height:"32",x:"4",y:"8",rx:"2"}),g("path",{"stroke-linecap":"round",d:"m12 18l7 6l-7 6m11 2h13"})],-1)]))}const Sh=pe({name:"icon-park-outline-terminal",render:S2}),C2={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"},k2=["id"],E2=["mask"];function A2(s,e){return m(),A("svg",C2,[g("defs",null,[g("mask",{id:s.idMap.ipSTerminal0},e[0]||(e[0]=[g("g",{fill:"none","stroke-linejoin":"round","stroke-width":"4"},[g("rect",{width:"40",height:"32",x:"4",y:"8",fill:"#fff",stroke:"#fff",rx:"2"}),g("path",{stroke:"#000","stroke-linecap":"round",d:"m12 18l7 6l-7 6m11 2h13"})],-1)]),8,k2)]),g("path",{fill:"currentColor",d:"M0 0h48v48H0z",mask:"url(#"+s.idMap.ipSTerminal0+")"},null,8,E2)])}const Ch=pe({name:"icon-park-solid-terminal",render:A2,setup(){return{idMap:{ipSTerminal0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),M2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $2(s,e){return m(),A("svg",M2,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M5 3a3 3 0 0 0-3 3v10a2 2 0 0 0 2 2V6a1 1 0 0 1 1-1h14a2 2 0 0 0-2-2zm0 5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v11.333a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2zm15 0H7v7.848L10.848 12a1.25 1.25 0 0 1 1.768 0l3.241 3.24l.884-.883a1.25 1.25 0 0 1 1.768 0L20 15.848zm-2 3a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0"})],-1)]))}const cc=pe({name:"mingcute-photo-album-fill",render:$2}),T2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function P2(s,e){return m(),A("svg",T2,e[0]||(e[0]=[g("g",{fill:"none"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M20 6a2 2 0 0 1 2 2v11.333a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2zm-8.268 7.944L7.136 18.54l-.066.06l-.07.054v.68h13v-.68l-.07-.053l-.066-.06l-2.24-2.24l-.353.354l.055.055a1 1 0 0 1-1.32 1.497l-.094-.083zM17 3a2 2 0 0 1 1.995 1.85L19 5H5a1 1 0 0 0-.993.883L4 6v12a2 2 0 0 1-1.995-1.85L2 16V6a3 3 0 0 1 2.824-2.995L5 3zm3 5H7v7.848L10.848 12a1.25 1.25 0 0 1 1.768 0l3.241 3.24l.884-.883a1.25 1.25 0 0 1 1.768 0L20 15.848zm-3.5 1.5a1.5 1.5 0 1 1 0 3a1.5 1.5 0 0 1 0-3"})],-1)]))}const lc=pe({name:"mingcute-photo-album-line",render:P2}),R2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function I2(s,e){return m(),A("svg",R2,e[0]||(e[0]=[g("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.464 3.464C2 4.93 2 7.286 2 12s0 7.071 1.464 8.535C4.93 22 7.286 22 12 22s7.071 0 8.535-1.465C22 19.072 22 16.714 22 12s0-7.071-1.465-8.536C19.072 2 16.714 2 12 2S4.929 2 3.464 3.464m14.112 7.016a.75.75 0 0 0-1.152-.96l-1.797 2.156c-.37.445-.599.716-.786.885a.8.8 0 0 1-.163.122l-.011.005l-.008-.004l-.003-.001a.8.8 0 0 1-.164-.122c-.187-.17-.415-.44-.786-.885l-.292-.35c-.328-.395-.625-.75-.901-1c-.301-.272-.68-.514-1.18-.514s-.878.242-1.18.514c-.276.25-.572.605-.9 1l-1.83 2.194a.75.75 0 1 0 1.153.96l1.797-2.156c.37-.445.599-.716.786-.885a.8.8 0 0 1 .163-.122l.007-.003l.004-.002l.011.005a.8.8 0 0 1 .164.122c.187.17.415.44.786.885l.292.35c.329.395.625.75.901 1c.301.272.68.514 1.18.514s.878-.242 1.18-.514c.276-.25.572-.605.9-1z","clip-rule":"evenodd"},null,-1)]))}const kh=pe({name:"solar-graph-bold",render:I2}),O2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function N2(s,e){return m(),A("svg",O2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M17.576 10.48a.75.75 0 0 0-1.152-.96l-1.797 2.156c-.37.445-.599.716-.786.885a.8.8 0 0 1-.163.122l-.011.005l-.011-.005a.8.8 0 0 1-.164-.122c-.187-.17-.415-.44-.786-.885l-.292-.35c-.328-.395-.625-.75-.901-1c-.301-.272-.68-.514-1.18-.514s-.878.242-1.18.514c-.276.25-.572.605-.9 1l-1.83 2.194a.75.75 0 1 0 1.153.96l1.797-2.156c.37-.445.599-.716.786-.885a.8.8 0 0 1 .163-.122l.011-.005l.011.005a.8.8 0 0 1 .164.122c.187.17.415.44.786.885l.292.35c.329.395.625.75.901 1c.301.272.68.514 1.18.514s.878-.242 1.18-.514c.276-.25.572-.605.9-1z"},null,-1),g("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.943 1.25c-2.309 0-4.118 0-5.53.19c-1.444.194-2.584.6-3.479 1.494c-.895.895-1.3 2.035-1.494 3.48c-.19 1.411-.19 3.22-.19 5.529v.114c0 2.309 0 4.118.19 5.53c.194 1.444.6 2.584 1.494 3.479c.895.895 2.035 1.3 3.48 1.494c1.411.19 3.22.19 5.529.19h.114c2.309 0 4.118 0 5.53-.19c1.444-.194 2.584-.6 3.479-1.494c.895-.895 1.3-2.035 1.494-3.48c.19-1.411.19-3.22.19-5.529v-.114c0-2.309 0-4.118-.19-5.53c-.194-1.444-.6-2.584-1.494-3.479c-.895-.895-2.035-1.3-3.48-1.494c-1.411-.19-3.22-.19-5.529-.19zM3.995 3.995c.57-.57 1.34-.897 2.619-1.069c1.3-.174 3.008-.176 5.386-.176s4.086.002 5.386.176c1.279.172 2.05.5 2.62 1.069c.569.57.896 1.34 1.068 2.619c.174 1.3.176 3.008.176 5.386s-.002 4.086-.176 5.386c-.172 1.279-.5 2.05-1.069 2.62c-.57.569-1.34.896-2.619 1.068c-1.3.174-3.008.176-5.386.176s-4.086-.002-5.386-.176c-1.279-.172-2.05-.5-2.62-1.069c-.569-.57-.896-1.34-1.068-2.619c-.174-1.3-.176-3.008-.176-5.386s.002-4.086.176-5.386c.172-1.279.5-2.05 1.069-2.62","clip-rule":"evenodd"},null,-1)]))}const Eh=pe({name:"solar-graph-outline",render:N2}),F2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function L2(s,e){return m(),A("svg",F2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19 3c-1.654 0-3 1.346-3 3c0 .502.136.968.354 1.385l-1.116 1.302A4 4 0 0 0 13 8c-.739 0-1.425.216-2.02.566L9.566 7.152A3.45 3.45 0 0 0 10 5.5C10 3.57 8.43 2 6.5 2S3 3.57 3 5.5S4.57 9 6.5 9c.601 0 1.158-.166 1.652-.434L9.566 9.98A3.97 3.97 0 0 0 9 12c0 .997.38 1.899.985 2.601l-1.692 1.692l.025.025A2.96 2.96 0 0 0 7 16c-1.654 0-3 1.346-3 3s1.346 3 3 3s3-1.346 3-3c0-.476-.121-.919-.318-1.318l.025.025l1.954-1.954c.421.15.867.247 1.339.247c2.206 0 4-1.794 4-4a3.96 3.96 0 0 0-.439-1.785l1.253-1.462c.364.158.764.247 1.186.247c1.654 0 3-1.346 3-3s-1.346-3-3-3M7 20a1 1 0 1 1 0-2a1 1 0 0 1 0 2M5 5.5C5 4.673 5.673 4 6.5 4S8 4.673 8 5.5S7.327 7 6.5 7S5 6.327 5 5.5m8 8.5c-1.103 0-2-.897-2-2s.897-2 2-2s2 .897 2 2s-.897 2-2 2m6-7a1 1 0 1 1 0-2a1 1 0 0 1 0 2"},null,-1)]))}const Ah=pe({name:"bx-network-chart",render:L2}),j2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function q2(s,e){return m(),A("svg",j2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19.5 3A2.5 2.5 0 0 0 17 5.5c0 .357.078.696.214 1.005l-1.955 2.199A4 4 0 0 0 13 8c-.74 0-1.424.216-2.019.566L8.707 6.293l-.023.023C8.88 5.918 9 5.475 9 5a3 3 0 1 0-3 3c.475 0 .917-.12 1.316-.316l-.023.023L9.567 9.98A3.96 3.96 0 0 0 9 12c0 .997.38 1.899.985 2.601l-2.577 2.576A2.5 2.5 0 0 0 6.5 17C5.122 17 4 18.121 4 19.5S5.122 22 6.5 22S9 20.879 9 19.5c0-.321-.066-.626-.177-.909l2.838-2.838c.421.15.867.247 1.339.247c2.206 0 4-1.794 4-4c0-.636-.163-1.229-.428-1.764l2.117-2.383c.256.088.526.147.811.147C20.879 8 22 6.879 22 5.5S20.879 3 19.5 3M13 14c-1.103 0-2-.897-2-2s.897-2 2-2s2 .897 2 2s-.897 2-2 2"},null,-1)]))}const Mh=pe({name:"bxs-network-chart",render:q2}),D2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function B2(s,e){return m(),A("svg",D2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97s-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1s.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64z"},null,-1)]))}const Sa=pe({name:"mdi-cog",render:B2}),z2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function U2(s,e){return m(),A("svg",z2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)]))}const Qc=pe({name:"mdi-cog-outline",render:U2}),V2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function H2(s,e){return m(),A("svg",V2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 19.2c-2.5 0-4.71-1.28-6-3.2c.03-2 4-3.1 6-3.1s5.97 1.1 6 3.1a7.23 7.23 0 0 1-6 3.2M12 5a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3m0-3A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10c0-5.53-4.5-10-10-10"},null,-1)]))}const Q2=pe({name:"mdi-account-circle",render:H2}),K2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Z2(s,e){return m(),A("svg",K2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2M7.07 18.28c.43-.9 3.05-1.78 4.93-1.78s4.5.88 4.93 1.78A7.9 7.9 0 0 1 12 20c-1.86 0-3.57-.64-4.93-1.72m11.29-1.45c-1.43-1.74-4.9-2.33-6.36-2.33s-4.93.59-6.36 2.33A7.93 7.93 0 0 1 4 12c0-4.41 3.59-8 8-8s8 3.59 8 8c0 1.82-.62 3.5-1.64 4.83M12 6c-1.94 0-3.5 1.56-3.5 3.5S10.06 13 12 13s3.5-1.56 3.5-3.5S13.94 6 12 6m0 5a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 12 8a1.5 1.5 0 0 1 1.5 1.5A1.5 1.5 0 0 1 12 11"},null,-1)]))}const G2=pe({name:"mdi-account-circle-outline",render:Z2}),W2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J2(s,e){return m(),A("svg",W2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M20.97 7.27a.996.996 0 0 0 0-1.41l-2.83-2.83a.996.996 0 0 0-1.41 0l-4.49 4.49l-3.89-3.89c-.78-.78-2.05-.78-2.83 0l-1.9 1.9c-.78.78-.78 2.05 0 2.83l3.89 3.89L3 16.76V21h4.24l4.52-4.52l3.89 3.89c.95.95 2.23.6 2.83 0l1.9-1.9c.78-.78.78-2.05 0-2.83l-3.89-3.89zM5.04 6.94l1.89-1.9L8.2 6.31L7.02 7.5l1.41 1.41l1.19-1.19l1.2 1.2l-1.9 1.9zm11.23 7.44l-1.19 1.19l1.41 1.41l1.19-1.19l1.27 1.27l-1.9 1.9l-3.89-3.89l1.9-1.9zM6.41 19H5v-1.41l9.61-9.61l1.3 1.3l.11.11zm9.61-12.44l1.41-1.41l1.41 1.41l-1.41 1.41z"},null,-1)]))}const Y2=pe({name:"ic-outline-design-services",render:J2}),X2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eb(s,e){return m(),A("svg",X2,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m16.24 11.51l1.57-1.57l-3.75-3.75l-1.57 1.57l-4.14-4.13c-.78-.78-2.05-.78-2.83 0l-1.9 1.9c-.78.78-.78 2.05 0 2.83l4.13 4.13l-4.6 4.61q-.15.15-.15.36v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15l4.62-4.62l4.13 4.13c1.32 1.32 2.76.07 2.83 0l1.9-1.9c.78-.78.78-2.05 0-2.83zm-7.06-.44L5.04 6.94l1.89-1.9L8.2 6.31l-.47.49a.996.996 0 1 0 1.41 1.41l.48-.48l1.45 1.45zm7.88 7.89l-4.13-4.13l1.9-1.9l1.45 1.45l-.48.48a.996.996 0 1 0 1.41 1.41l.48-.48l1.27 1.27zm3.65-11.92a.996.996 0 0 0 0-1.41l-2.34-2.34c-.47-.47-1.12-.29-1.41 0l-1.83 1.83l3.75 3.75z"},null,-1)]))}const tb=pe({name:"ic-round-design-services",render:eb}),sb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function nb(s,e){return m(),A("svg",sb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M16 17v2H2v-2s0-4 7-4s7 4 7 4m-3.5-9.5A3.5 3.5 0 1 0 9 11a3.5 3.5 0 0 0 3.5-3.5m3.44 5.5A5.32 5.32 0 0 1 18 17v2h4v-2s0-3.63-6.06-4M15 4a3.4 3.4 0 0 0-1.93.59a5 5 0 0 1 0 5.82A3.4 3.4 0 0 0 15 11a3.5 3.5 0 0 0 0-7"},null,-1)]))}const rb=pe({name:"mdi-users",render:nb}),ib={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ob(s,e){return m(),A("svg",ib,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M13.07 10.41a5 5 0 0 0 0-5.82A3.4 3.4 0 0 1 15 4a3.5 3.5 0 0 1 0 7a3.4 3.4 0 0 1-1.93-.59M5.5 7.5A3.5 3.5 0 1 1 9 11a3.5 3.5 0 0 1-3.5-3.5m2 0A1.5 1.5 0 1 0 9 6a1.5 1.5 0 0 0-1.5 1.5M16 17v2H2v-2s0-4 7-4s7 4 7 4m-2 0c-.14-.78-1.33-2-5-2s-4.93 1.31-5 2m11.95-4A5.32 5.32 0 0 1 18 17v2h4v-2s0-3.63-6.06-4Z"},null,-1)]))}const ab=pe({name:"mdi-users-outline",render:ob}),cb={viewBox:"0 0 36 36",width:"1.2em",height:"1.2em"};function lb(s,e){return m(),A("svg",cb,e[0]||(e[0]=[zh('<path fill="currentColor" d="M6 22h24v2H6z" class="clr-i-outline clr-i-outline-path-1"></path><path fill="currentColor" d="M26 26h4v2h-4z" class="clr-i-outline clr-i-outline-path-2"></path><path fill="currentColor" d="M13 9.92L17 6v13a1 1 0 1 0 2 0V6l4 3.95a1 1 0 1 0 1.38-1.45L18 2.16L11.61 8.5A1 1 0 0 0 13 9.92" class="clr-i-outline clr-i-outline-path-3"></path><path fill="currentColor" d="M30.84 13.37A1.94 1.94 0 0 0 28.93 12H21v2h7.95c1.05 2.94 2.77 7.65 3.05 8.48V30H4v-7.52C4.28 21.65 7.05 14 7.05 14H15v-2H7.07a1.92 1.92 0 0 0-1.9 1.32C2 22 2 22.1 2 22.33V30a2 2 0 0 0 2 2h28a2 2 0 0 0 2-2v-7.67c0-.23 0-.33-3.16-8.96" class="clr-i-outline clr-i-outline-path-4"></path><path fill="none" d="M0 0h36v36H0z"></path>',5)]))}const ub=pe({name:"clarity-backup-restore-line",render:lb}),db={viewBox:"0 0 36 36",width:"1.2em",height:"1.2em"};function hb(s,e){return m(),A("svg",db,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M2 24v6a2 2 0 0 0 2 2h28a2 2 0 0 0 2-2v-6Zm28 5h-4v-2h4Z",class:"clr-i-solid clr-i-solid-path-1"},null,-1),g("path",{fill:"currentColor",d:"M30.84 13.37A1.94 1.94 0 0 0 28.93 12H21v6a3 3 0 1 1-6 0v-6H7.07a1.92 1.92 0 0 0-1.9 1.32c-2.31 6.36-2.93 8.11-3.1 8.68h31.86c-.16-.57-.79-2.31-3.09-8.63",class:"clr-i-solid clr-i-solid-path-2"},null,-1),g("path",{fill:"currentColor",d:"M13 9.92L17 6v12a1 1 0 1 0 2 0V6l4 3.95a1 1 0 1 0 1.38-1.45L18 2.16L11.61 8.5A1 1 0 0 0 13 9.92",class:"clr-i-solid clr-i-solid-path-3"},null,-1),g("path",{fill:"none",d:"M0 0h36v36H0z"},null,-1)]))}const mb=pe({name:"clarity-backup-restore-solid",render:hb}),pb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fb(s,e){return m(),A("svg",pb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M6.5 20q-2.275 0-3.887-1.575T1 14.575q0-1.95 1.175-3.475T5.25 9.15q.625-2.3 2.5-3.725T12 4q2.925 0 4.963 2.038T19 11q1.725.2 2.863 1.488T23 15.5q0 1.875-1.312 3.188T18.5 20z"},null,-1)]))}const gb=pe({name:"material-symbols-cloud",render:fb}),vb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _b(s,e){return m(),A("svg",vb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M6.5 20q-2.275 0-3.887-1.575T1 14.575q0-1.95 1.175-3.475T5.25 9.15q.625-2.3 2.5-3.725T12 4q2.925 0 4.963 2.038T19 11q1.725.2 2.863 1.488T23 15.5q0 1.875-1.312 3.188T18.5 20zm0-2h12q1.05 0 1.775-.725T21 15.5t-.725-1.775T18.5 13H17v-2q0-2.075-1.463-3.538T12 6T8.463 7.463T7 11h-.5q-1.45 0-2.475 1.025T3 14.5t1.025 2.475T6.5 18m5.5-6"},null,-1)]))}const yb=pe({name:"material-symbols-cloud-outline",render:_b}),bb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wb(s,e){return m(),A("svg",bb,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M18.5 4a1.5 1.5 0 0 0-3 0v.5H4a1.5 1.5 0 1 0 0 3h11.5V8a1.5 1.5 0 0 0 3 0v-.5H20a1.5 1.5 0 0 0 0-3h-1.5zM4 10.5a1.5 1.5 0 0 0 0 3h1.5v.5a1.5 1.5 0 0 0 3 0v-.5H20a1.5 1.5 0 0 0 0-3H8.5V10a1.5 1.5 0 1 0-3 0v.5zM2.5 18A1.5 1.5 0 0 1 4 16.5h11.5V16a1.5 1.5 0 0 1 3 0v.5H20a1.5 1.5 0 0 1 0 3h-1.5v.5a1.5 1.5 0 0 1-3 0v-.5H4A1.5 1.5 0 0 1 2.5 18"})],-1)]))}const xb=pe({name:"mingcute-settings-2-fill",render:wb}),Sb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cb(s,e){return m(),A("svg",Sb,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M18 4a1 1 0 1 0-2 0v1H4a1 1 0 0 0 0 2h12v1a1 1 0 1 0 2 0V7h2a1 1 0 1 0 0-2h-2zM4 11a1 1 0 1 0 0 2h2v1a1 1 0 1 0 2 0v-1h12a1 1 0 1 0 0-2H8v-1a1 1 0 0 0-2 0v1zm-1 7a1 1 0 0 1 1-1h12v-1a1 1 0 1 1 2 0v1h2a1 1 0 1 1 0 2h-2v1a1 1 0 1 1-2 0v-1H4a1 1 0 0 1-1-1"})],-1)]))}const kb=pe({name:"mingcute-settings-2-line",render:Cb}),Eb=rl(Y0),Ab=rl(J0);function Hr(){const{angle:s}=Eb(),e=Ab({listenOrientation:!0}),t=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d<=360}),n=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d<=450}),r=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d<640}),i=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d<768}),o=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d>768&&d<1024}),a=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d>=1024}),l=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d>=1280}),u=te(()=>{let d=e.width.value;return s.value>0&&(screen.height>screen.width?d=screen.height:d=screen.width),d>=1536});return{xxsBreakpoint:t,xsBreakpoint:n,smBreakpoint:r,mdBreakpoint:i,xmdBreakpoint:o,lgBreakpoint:a,xlBreakpoint:l,xxlBreakpoint:u}}const{mdBreakpoint:Ts,smBreakpoint:uc}=Hr(),uo=[{name:"NotFound",path:"/:pathMatch(.*)*",component:dy,meta:{name:"notfound",auth:{requiresAuth:!1,role:"none"}}},{name:"Login",path:"/login",alias:"/",component:i2,meta:{name:"login",auth:{requiresAuth:!1,role:"none"},ui:{background:te(()=>Ts.value?"var(--card-background)":void 0)}}},{name:"FirstSteps",path:"/first-steps",component:()=>ys(()=>import("./FirstSteps.BjUQYXwF.0.0.70.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])),meta:{name:"firststeps",auth:{requiresAuth:!0,role:"user"}}},{name:"Cameras",path:"/cameras",component:()=>ys(()=>import("./Cameras.BOXzVzD9.0.0.70.js"),__vite__mapDeps([48,1,2,3,4,49,14,15,16,17,50,51,12,9,10,13,8,18,19,5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,52])),meta:{name:"cameras",auth:{requiresAuth:!0,role:"user"},ui:{containerSettings:{showTitle:!0,padding:te(()=>!uc.value),fullwidth:te(()=>uc.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:yh,active:Vc}},bottombar:{icon:{default:yh,active:Vc}}}},{name:"Camera",path:"/cameras/:cameraname",component:()=>ys(()=>import("./Camera.D39v2Qae.0.0.70.js"),__vite__mapDeps([53,54,1,2,3,4,9,10,14,15,16,17,55,19,8,18,13,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"camera",auth:{requiresAuth:!0,role:"user"},ui:{containerSettings:{disableScroll:te(()=>Ts.value),ignoreSafeAreaBottom:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:te(()=>!Ts.value)}}},{name:"Camview",path:"/camview",component:()=>ys(()=>import("./Camview.R2Zpw-wS.0.0.70.js"),__vite__mapDeps([56,1,2,3,4,54,9,10,14,15,16,17,55,57,58,59,60,61,62,63,13,12,8,18,19,5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,64])),meta:{name:"camview",auth:{requiresAuth:!0,role:"user"},ui:{containerSettings:{disableScroll:te(()=>!uc.value)},background:"#000000",showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:_h,active:vh}},bottombar:{icon:{default:_h,active:vh}}}},{name:"Recordings",path:"/recordings",component:()=>ys(()=>import("./Recordings.B2b7JutC.0.0.70.js"),__vite__mapDeps([65,3,8,1,2,4,14,15,16,17,18,9,10,13,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"recordings",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{showTitle:!0,padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:lc,active:cc}},bottombar:{icon:{default:lc,active:cc}}}},{name:"Config",path:"/config",component:()=>ys(()=>import("./Config.D89tTvo2.0.0.70.js"),__vite__mapDeps([66,1,2,3,4,14,15,16,17,67,8,9,10,7,13,18,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"config",auth:{requiresAuth:!0,role:"admin"},ui:{background:"#000000",containerSettings:{disableScroll:!0},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:wh,active:bh}},profileMenu:{icon:{default:wh,active:bh}}}},{name:"Console",path:"/console",component:()=>ys(()=>import("./Console.DX4_ZVPM.0.0.70.js"),__vite__mapDeps([68,1,2,3,4,67,7,8,9,10,50,16,17,14,15,51,13,18,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"console",auth:{requiresAuth:!0,role:"admin"},ui:{background:"#000000",containerSettings:{disableScroll:!0},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:Sh,active:Ch}},profileMenu:{icon:{default:Sh,active:Ch}}}},{name:"Plugins",path:"/plugins",component:()=>ys(()=>import("./Plugins.DphA9uPk.0.0.70.js"),__vite__mapDeps([69,1,2,3,4,49,70,71,50,16,17,14,15,51,72,30,31,32,33,34,35,36,37,7,8,9,10,19,73,18,13,5,12,20,21,22,23,24,25,26,27,28,29,38,39,40,41,42,43,44,45,74])),meta:{name:"plugins",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{showTitle:!0,padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"top",icon:{default:xh,active:Hc}},profileMenu:{icon:{default:xh,active:Hc}}}},{name:"ScopedPlugin",path:"/plugins/:scope/:pluginname",component:()=>ys(()=>import("./Plugin.Dl21oK_u.0.0.70.js"),__vite__mapDeps([75,1,2,3,4,76,9,10,70,71,50,16,17,14,15,51,72,30,31,32,33,34,35,36,37,7,8,19,73,18,13,5,12,20,21,22,23,24,25,26,27,28,29,38,39,40,41,42,43,44,45,77])),meta:{name:"plugin",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0}}},{name:"Plugin",path:"/plugins/:pluginname",component:()=>ys(()=>import("./Plugin.Dl21oK_u.0.0.70.js"),__vite__mapDeps([75,1,2,3,4,76,9,10,70,71,50,16,17,14,15,51,72,30,31,32,33,34,35,36,37,7,8,19,73,18,13,5,12,20,21,22,23,24,25,26,27,28,29,38,39,40,41,42,43,44,45,77])),meta:{name:"plugin",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0}}},{name:"Adminpanel",path:"/admin",component:()=>ys(()=>import("./Adminpanel.CBQfnvy1.0.0.70.js"),__vite__mapDeps([78,1,2,3,4,79,80,81,13,8,9,10,7,14,15,16,17,18,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,82])),meta:{name:"adminpanel",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{showTitle:!0,padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"bottom",icon:{default:Eh,active:kh}},profileMenu:{icon:{default:Eh,active:kh}}}},{name:"Cammesh",path:"/cammesh",component:()=>ys(()=>import("./Cammesh.bs93Or8F.0.0.70.js"),__vite__mapDeps([83,3,8,1,2,4,14,15,16,17,18,9,10,13,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"cammesh",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{showTitle:!0,padding:!0,fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},navbar:{position:"bottom",icon:{default:Ah,active:Mh}},profileMenu:{icon:{default:Ah,active:Mh}}}},{name:"Settings",path:"/settings",component:()=>ys(()=>import("./Settings.D_hL6kBb.0.0.70.js"),__vite__mapDeps([84,1,2,3,4,19,14,15,16,17,8,18,9,10,13,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,85])),meta:{name:"settings",path:"/settings/account",auth:{requiresAuth:!0,role:"user"},navbar:{position:"bottom",icon:{default:Qc,active:Sa}},bottombar:{icon:{default:Qc,active:Sa}}},children:[{name:"SettingsAccount",path:"account",component:()=>ys(()=>import("./SettingsAccount.2ETTD3p8.0.0.70.js"),__vite__mapDeps([11,1,2,3,4,12,9,10,13,8,14,15,16,17,18,19,5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),meta:{name:"account",description:"account_description",auth:{requiresAuth:!0,role:"user"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:G2,active:Q2}}}},{name:"SettingsAppearance",path:"appearance",component:()=>ys(()=>import("./SettingsAppearance.DkI9GlMu.0.0.70.js"),__vite__mapDeps([86,47,1,2,3,4,13,8,14,15,16,17,18,9,10,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"appearance",description:"appearance_description",auth:{requiresAuth:!0,role:"user"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:Y2,active:tb}}}},{name:"SettingsUsers",path:"user",component:()=>ys(()=>import("./SettingsUsers.BpTad4f8.0.0.70.js"),__vite__mapDeps([87,1,2,3,4,71,12,9,10,8,14,15,16,17,18,13,19,5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"user",description:"user_description",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:ab,active:rb}}}},{name:"SettingsRecordings",path:"recordings",component:()=>ys(()=>import("./SettingsRecordings.C_hEpi6y.0.0.70.js"),__vite__mapDeps([88,3,8,1,2,4,14,15,16,17,18,9,10,13,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"recordings",description:"recordings_description",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:lc,active:cc}}}},{name:"SettingsBackup",path:"backup",component:()=>ys(()=>import("./SettingsBackup.Ce3e31yn.0.0.70.js"),__vite__mapDeps([89,1,2,3,4,76,6,7,8,9,10,14,15,16,17,18,13,19,5,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,90])),meta:{name:"backup",description:"backup_description",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:ub,active:mb}}}},{name:"SettingsRemote",path:"remote",component:()=>ys(()=>import("./SettingsRemote.BDp_l894.0.0.70.js"),__vite__mapDeps([91,1,2,3,4,12,7,8,9,10,20,21,14,15,16,17,18,13,19,5,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45])),meta:{name:"remote",description:"remote_access_description",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:yb,active:gb}}}},{name:"SettingsSystem",path:"system",component:()=>ys(()=>import("./SettingsSystem.CFjS9i7G.0.0.70.js"),__vite__mapDeps([92,1,2,3,4,8,7,9,10,72,50,16,17,14,15,51,30,31,32,33,34,35,36,37,93,18,13,19,5,12,20,21,22,23,24,25,26,27,28,29,38,39,40,41,42,43,44,45])),meta:{name:"system",description:"system_description",auth:{requiresAuth:!0,role:"admin"},ui:{containerSettings:{fullwidth:te(()=>Ts.value)},showNavbar:!0,showTopbar:!0,showBottombar:!0},settingsBar:{icon:{default:kb,active:xb}}}}]}],Fa=mf({history:pf("/"),routes:uo,scrollBehavior:async()=>(await I_(10),{top:0,left:0,behavior:"smooth"})});Fa.absUrl=(s="#",e=!0)=>{const t=document.createElement("a");t.href=s,t.target=e&&s!=="#"?"_blank":"",e&&(t.rel="noopener noreferrer"),t.click()};Fa.beforeEach(async(s,e,t)=>{var l;const n=Ci(),r=Fs(),i=up(),o=s.name.toLowerCase(),a=localStorage.getItem("lastPage");if(i.routerLoading=!0,r.user){await n.cancelQueries(void 0,{revert:!1});try{s.path!=="/settings"&&await Bm()}catch(u){console.error(u),await r.logout();return}r.user.firstLogin&&s.path!=="/first-steps"?t("/first-steps"):!r.user.firstLogin&&s.path==="/first-steps"||(l=s.meta.auth)!=null&&l.requiresAuth&&s.meta.auth.role&&r.user.role!==s.meta.auth.role&&r.user.role!=="admin"&&r.user.role!=="master"?t("/cameras"):o==="login"&&a&&a!=="/"?t(a):s.path==="/settings"?t("/settings/account"):t()}else o!=="login"?t("/"):t();i.routerLoading=!1});Fa.afterEach(s=>{const e=["login","notfound","firststeps"],t=s.name.toLowerCase();e.includes(t)||localStorage.setItem("lastPage",s.path)});const ka=class ka{constructor(){}static get manager(){return this._manager||this.createManager(),this._manager}static createManager(){ka._manager=new _f(window.origin,{reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.5,timeout:2e4,autoConnect:!0,transports:["websocket","polling"],rejectUnauthorized:!1,secure:!0})}};p(ka,"_manager");let Kc=ka;const Rl=Mi("socket",()=>{const s=ce(new Map),e=ce(!1),t=ce(!0),n=()=>{const h=Fs(),v=s.value.get("/camera.ui");return v||i("/camera.ui",h)},r=h=>{const v=Fs(),f=s.value.get(h);return f||i(h,v)},i=(h,v)=>{const f=Ls(a(h,v));return o(f.value,h,v),s.value.set(h,f.value),f.value},o=(h,v,f)=>{h.socket.on("connect",()=>{var b;(b=h.connected)==null||b.next()}),v==="/camera.ui"&&(h.socket.on("connect",()=>{t.value?(e.value=!0,t.value=!1):d()}),h.socket.on("disconnect",()=>{e.value=!1}),h.socket.on("unauthenticated",()=>{e.value=!1,f.logout()}),h.socket.on("invalidToken",b=>{f.accessToken===b&&(e.value=!1,f.logout())})),h.end=b=>{var k;v==="/camera.ui"&&(e.value=!1),h.socket.emit("end",b),h.socket.removeAllListeners(),(k=h.connected)==null||k.complete()},h.disconnect=b=>{var k;v==="/camera.ui"&&(e.value=!1),(k=h.end)==null||k.call(h,b),h.socket.disconnect(),s.value.delete(v)}},a=(h,v)=>{const f=`Bearer ${v.accessToken}`,b=Kc.manager.socket(h,{auth:{token:f}});return{socket:b,request:(z,L)=>new yf(se=>{b.emit(z,L,Z=>{typeof Z=="object"&&Z.error?se.error(Z):se.next(Z),se.complete()})})}},l=te(()=>h=>s.value.get(h)),u=h=>{s.value.forEach(v=>{var f;(f=v.disconnect)==null||f.call(v,h)}),e.value=!1},d=()=>{window.location.reload()};return{isConnected:e,namespaceConnectionCache:s,connect:n,connectToNamespace:r,getExistingNamespace:l,disconnect:u}}),C9=["account","appearance","user","recordings","backup","system"],Il=Mi("ui",()=>{const s=nl("ui",{cameras:{showEvents:!0},camview:{dragDisabled:!1},config:{zoom:12},console:{zoom:12},interface:{showBottomBarOnMobile:!0,selectedSettingsView:"account",navbarStayCollapsed:!1}});return s.value.cameras||(s.value.cameras={showEvents:!0}),s.value.cameras.showEvents===void 0&&(s.value.cameras.showEvents=!0),s.value.camview||(s.value.camview={dragDisabled:!1}),s.value.camview.dragDisabled===void 0&&(s.value.camview.dragDisabled=!1),s.value.config||(s.value.config={zoom:12}),s.value.console.zoom===void 0&&(s.value.console.zoom=12),s.value.console||(s.value.console={zoom:12}),s.value.interface.showBottomBarOnMobile===void 0&&(s.value.interface.showBottomBarOnMobile=!0),s.value.interface||(s.value.interface={showBottomBarOnMobile:!0,selectedSettingsView:"account",navbarStayCollapsed:!1}),!s.value.interface.showBottomBarOnMobile===void 0&&(s.value.interface.showBottomBarOnMobile=!0),s.value.interface.selectedSettingsView||(s.value.interface.selectedSettingsView="account"),s.value.interface.navbarStayCollapsed||(s.value.interface.navbarStayCollapsed=!1),{uiSettings:s}}),vn={CLOSED:0,MINIFIED:80,EXPANDED:288},Mb=Symbol("cui-app-bus"),Ui=Pr({navbarState:void 0,subbarState:void 0}),Ol=()=>{const s=Qh(Mb);return s.on(({subbarState:e,navbarState:t})=>{e&&e!==Ui.subbarState&&(Ui.subbarState=e),t&&t!==Ui.navbarState&&(Ui.navbarState=t)}),{state:Ui,bus:s}},La=()=>{const s=Il(),e=$i(),{state:t}=Ol(),{mdBreakpoint:n,xsBreakpoint:r,xlBreakpoint:i}=Hr(),{uiSettings:o}=Vs(s),a=te(()=>u.value?o.value.interface.navbarStayCollapsed&&t.navbarState!=="opened"?n.value?"closed":"minified":i.value?"opened":t.navbarState?t.navbarState:n.value?"closed":"minified":void 0),l=te(()=>e.path.includes("/settings")?i.value?"opened":t.subbarState?t.subbarState:"closed":void 0),u=te(()=>{var v;return!!Xs((v=e.meta.ui)==null?void 0:v.showNavbar)}),d=te(()=>{var v;return!!(Xs((v=e.meta.ui)==null?void 0:v.showBottombar)&&o.value.interface.showBottomBarOnMobile&&r.value)}),h=te(()=>{var v;return!!Xs((v=e.meta.ui)==null?void 0:v.showTopbar)});return{navbarState:a,subbarState:l,showBottombar:d,showNavbar:u,showTopbar:h}},Lr=(s,e,t)=>{var a,l,u,d,h;s=s??$i();const{user:n}=Vs(Fs()),r=!((a=s==null?void 0:s.meta)!=null&&a.auth)||((l=s==null?void 0:s.meta)==null?void 0:l.auth.requiresAuth)===!1,i=e??((d=(u=s.meta)==null?void 0:u.auth)==null?void 0:d.role)??"user",o=((h=n.value)==null?void 0:h.role)??"user";return r||i==="none"?!0:i==="user"?t?o==="user":o==="user"||o==="admin"||o==="master":i==="admin"?o==="admin"||o==="master":i==="master"?o==="master":!1},$b={class:"pl-safe pt-safe h-full flex flex-col"},Tb={class:"overflow-hidden w-full pr-4"},Pb={key:0,class:"ml-2 w-full flex flex-row items-center"},Rb={class:"flex flex-col flex-1 my-4 px-[0.9rem]"},Ib={class:"flex flex-col space-y-1"},Ob={class:"flex flex-col space-y-1 pb-safe"},Nb={key:0,class:"dark-mode text-muted pl-3 uppercase text-xs font-bold"},Fb=Et({__name:"CuiNavbar",setup(s,{expose:e}){const t=Dr(),n=Fs(),r=Il(),i=Rl(),{bus:o}=Ol(),{mdBreakpoint:a,xlBreakpoint:l}=Hr(),{navbarState:u}=La(),{uiSettings:d}=Vs(r),{user:h}=Vs(n),v=Vt("navbarRef"),f=ce("closed"),b=Ls(),k=ce(!1),z=ce(!1),L=ce(!1),se=ce(!1);il(v,R=>{const w=R.target,H=w.closest("#menu-icon"),J=w.closest("#submenu-icon"),q=w.closest("#navbar-icon");!H&&!J&&!q&&S()});const Z=te(()=>d.value.interface.selectedSettingsView),N=te(()=>uo.filter(R=>{var w,H;return((H=(w=R.meta)==null?void 0:w.navbar)==null?void 0:H.position)==="top"&&R.meta&&Lr(R)})),E=te(()=>uo.filter(R=>{var w,H;return((H=(w=R.meta)==null?void 0:w.navbar)==null?void 0:H.position)==="bottom"&&Lr(R)})),O=te(()=>d.value.interface.navbarStayCollapsed&&f.value!=="opened"?"closed":l.value?"opened":f.value),U=te(()=>O.value==="closed"?a.value?vn.CLOSED:vn.MINIFIED:vn.EXPANDED);Ke(u,R=>{R&&R!==f.value&&(f.value=R==="minified"||R==="closed"?"closed":"opened")}),Ke(t.currentRoute,(R,w)=>{R.path!==w.path&&S()}),Ke(h,()=>{var R,w,H,J;((R=h.value)==null?void 0:R.role)==="admin"||((w=h.value)==null?void 0:w.role)==="master"?(b.value=i.connectToNamespace("/server"),b.value.socket.on("plugin-updates",q=>{z.value=q.length>0||!1}),b.value.socket.on("server-updates",q=>{k.value=q.updateAvailable||q.betaUpdateAvailable||!1}),b.value.request("get-updates").subscribe(q=>{z.value=q.plugins.length>0||!1,k.value=q.server.updateAvailable||q.server.betaUpdateAvailable||!1})):(J=(H=b.value)==null?void 0:H.disconnect)==null||J.call(H)},{deep:!0,immediate:!0}),Ke(L,R=>{R&&B()});const S=()=>{o.emit({navbarState:"closed"})},M=(R,w)=>{L.value&&w.channel==="update-check"&&w.status==="available"&&(k.value=!0)},B=async()=>{if(L.value){window.electron.removeListener("app-status",M),window.electron.on("app-status",M),window.electron.send("check-for-updates");try{const R=await window.electron.invoke("get-update-available");k.value=R.isUpdateAvailable}catch{}}},K=()=>{const R=document.querySelector('meta[name="electron-server"]'),w=R!==null&&R.getAttribute("content")==="true";L.value=window.electron!==void 0,se.value=w,setTimeout(()=>{L.value=window.electron!==void 0,se.value=w},100)};return Sn(()=>{K()}),vo(()=>{var R;(R=window.electron)==null||R.removeListener("app-status",M)}),e({navbarState:O}),(R,w)=>{var Ce,F;const H=Ei("RouterLink"),J=_o,q=ws,oe=Nh,ue=Km;return m(),A("nav",{ref_key:"navbarRef",ref:v,class:ct(["navbar-background fixed h-full transition-[width] duration-300 overflow-x-hidden overflow-y-scroll shadow-black/50 overflow-hidden border-r-[1px] border-base-color",{"shadow-xl":c(a)&&c(U)===c(vn).EXPANDED}]),style:at({left:c(U)===0?"-1px":"0px",width:`calc(${c(U)}px + env(safe-area-inset-left, 0px))`,clipPath:"inset(0)"})},[w[3]||(w[3]=g("div",{class:"fixed blur-2xl h-[20px] w-full -z-1 opacity-70 bg-primary-500"},null,-1)),g("div",$b,[g("div",{class:ct(["w-full flex items-center shrink-0 h-[60px]",{"mt-[25px]":c(L)}])},[y(H,{to:"/cameras",class:"pl-6"},{default:$(()=>[y(c($a),{src:c(Fr)("logo_animated.svg"),width:"32px",height:"32px",title:"camera.ui","aria-label":"camera.ui",class:"hover:scale-105 active:scale-105 focus:scale-105 transition-all"},null,8,["src"])]),_:1}),g("div",Tb,[y(Ct,{name:"fade"},{default:$(()=>[c(U)===c(vn).EXPANDED?(m(),A("div",Pb,[y(H,{to:"/cameras",class:"text-white font-bold text-lg text-shadow"},{default:$(()=>w[0]||(w[0]=[Qt("camera.ui")])),_:1,__:[0]}),c(O)==="opened"&&c(a)?(m(),j(q,{key:0,id:"navbar-icon",class:"dark-mode ml-auto cui-icon-md text-white",text:"",rounded:"",onClick:S},{icon:$(()=>[y(J,{width:"100%",height:"100%"})]),_:1})):ae("",!0)])):ae("",!0)]),_:1})])],2),g("div",Rb,[g("div",Ib,[(m(!0),A(yt,null,Dt(c(N),D=>(m(),A("div",{key:D.name,class:"w-full h-[50px] relative"},[c(z)&&D.name==="Plugins"?(m(),j(oe,{key:0,class:"absolute min-w-[8px] w-[8px] h-[8px] left-[31px] top-[10px] z-1"})):ae("",!0),y(ue,{icon:D.meta.navbar.icon.default,"active-icon":D.meta.navbar.icon.active,to:D.path,label:R.$t(`navigation.${D.name.toLowerCase()}`),expanded:c(U)===c(vn).EXPANDED,"dark-mode":"","show-tooltip":"","icon-size":22,"button-props":{style:{color:"#a4a4a4"}},class:ct(["w-[50px] h-[50px]",{"w-full":c(U)===c(vn).EXPANDED}])},null,8,["icon","active-icon","to","label","expanded","class"])]))),128))]),w[2]||(w[2]=g("div",{class:"flex-1 mt-10"},null,-1)),g("div",Ob,[y(Ct,{name:"fade"},{default:$(()=>[c(O)==="opened"?(m(),A("span",Nb,de(R.$t("navigation.extras")),1)):ae("",!0)]),_:1}),(m(!0),A(yt,null,Dt(c(E),D=>(m(),A("div",{key:D.name,class:"w-full h-[50px] relative"},[c(k)&&D.name==="Settings"?(m(),j(oe,{key:0,class:"absolute min-w-[8px] w-[8px] h-[8px] left-[31px] top-[10px] z-1"})):ae("",!0),y(ue,{icon:D.meta.navbar.icon.default,"active-icon":D.meta.navbar.icon.active,to:D.path==="/settings"?`/settings/${c(Z)}`:D.path,"fallback-active-path":D.path,label:R.$t(`navigation.${D.name.toLowerCase()}`),expanded:c(U)===c(vn).EXPANDED,"dark-mode":"","show-tooltip":"","icon-size":22,"button-props":{style:{color:"#a4a4a4"}},class:ct(["w-[50px] h-[50px]",{"w-full":c(U)===c(vn).EXPANDED}])},null,8,["icon","active-icon","to","fallback-active-path","label","expanded","class"])]))),128)),w[1]||(w[1]=g("div",{class:"my-2",style:{borderTop:"1px solid #313131"}},null,-1)),y(ue,{avatar:"avatar",label:((Ce=c(h))==null?void 0:Ce.username)??"unknown",description:((F=c(h))==null?void 0:F.role)??"unknown",expanded:c(U)===c(vn).EXPANDED,"show-logout":"",to:"/settings/account","dark-mode":"","avatar-size":22,class:ct(["w-[50px] h-[50px]",{"w-full":c(U)===c(vn).EXPANDED}])},null,8,["label","description","expanded","class"])])])])],6)}}}),Lb={HEIGHT:60},jb={class:"px-2 h-full pb-safe-offset-1 flex items-center justify-around"},qb=Et({__name:"CuiBottombar",setup(s,{expose:e}){const t=Vt("bottombarRef"),n=te(()=>uo.filter(r=>{var i;return((i=r.meta)==null?void 0:i.bottombar)&&r.meta.auth&&Lr(r)}));return e({bottombarRef:t}),(r,i)=>{const o=Km;return m(),A("nav",{ref_key:"bottombarRef",ref:t,class:"cui-bottombar bottombar-background fixed bottom-0 left-0 right-0 border-t-[1px] border-color bottombar-background",style:at({height:`calc(${c(Lb).HEIGHT}px + env(safe-area-inset-bottom, 0px))`})},[g("div",jb,[(m(!0),A(yt,null,Dt(c(n),a=>(m(),j(o,{key:a.name,icon:a.meta.bottombar.icon.default,"active-icon":a.meta.bottombar.icon.active,to:a.path,label:"",expanded:!1,"icon-class":"text-color",class:"w-[50px] h-[50px] transition-all duration-300"},null,8,["icon","active-icon","to"]))),128))]),i[0]||(i[0]=g("div",{class:"fixed blur-2xl h-[20px] w-full opacity-70 bg-primary-500",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) - 40px)"}},null,-1))],4)}}}),Db=qs(qb,[["__scopeId","data-v-78d01fd3"]]),Bb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zb(s,e){return m(),A("svg",Bb,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 6h18m-2 0v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6m3 0V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2m-6 5v6m4-6v6"},null,-1)]))}const Ub=pe({name:"lucide-trash2",render:zb}),Vb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hb(s,e){return m(),A("svg",Vb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M8.352 20.242A4.63 4.63 0 0 0 12 22a4.63 4.63 0 0 0 3.648-1.758a27.2 27.2 0 0 1-7.296 0M18.75 9v.704c0 .845.24 1.671.692 2.374l1.108 1.723c1.011 1.574.239 3.713-1.52 4.21a25.8 25.8 0 0 1-14.06 0c-1.759-.497-2.531-2.636-1.52-4.21l1.108-1.723a4.4 4.4 0 0 0 .693-2.374V9c0-3.866 3.022-7 6.749-7s6.75 3.134 6.75 7"},null,-1)]))}const Qb=pe({name:"solar-bell-bold",render:Hb}),Kb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zb(s,e){return m(),A("svg",Kb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m12 13.4l-4.9 4.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l4.9-4.9l-4.9-4.9q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l4.9 4.9l4.9-4.9q.275-.275.7-.275t.7.275t.275.7t-.275.7L13.4 12l4.9 4.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275z"},null,-1)]))}const Gb=pe({name:"material-symbols-close-rounded",render:Zb}),Wb={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function Jb(s,e){return m(),A("svg",Wb,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9.78 12.78a.75.75 0 0 1-1.06 0L4.47 8.53a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.042.018a.75.75 0 0 1 .018 1.042L6.06 8l3.72 3.72a.75.75 0 0 1 0 1.06"},null,-1)]))}const Yb=pe({name:"octicon-chevron-left16",render:Jb}),dp=Symbol("DialogStepper");function Xb(s){const e=ce(s),t=ce(void 0),n={},r=(f,b)=>{n[f]||(n[f]=[]),n[f].push(b)},i=(f,b)=>{const k=n[f];if(k){const z=k.indexOf(b);z!==-1&&k.splice(z,1)}},o=(f,b)=>{const k=n[f];k&&k.forEach(z=>{z(b)})},a=te(()=>!t.value),v={currentTab:t,tabs:e,isMainTab:a,goToTab:f=>{const b=e.value.find(k=>k.id===f);b&&(t.value=f,o("tabChange",b))},goToMainTab:()=>{t.value=void 0,o("tabChange",void 0)},registerTab:f=>{e.value.some(b=>b.id===f.id)||e.value.push(f)},updateTabConfig:(f,b)=>{const k=e.value.findIndex(z=>z.id===f);k!==-1&&(e.value[k]={...e.value[k],...b},b.title&&o("updateTabTitle",{tabId:f,title:b.title}))},on:r,off:i,emit:o};return tl(dp,v),v}function k9(){const s=pi(dp);if(!s)throw new Error("useCuiDialogStepperContext must be used within a dialog that uses useCuiDialogStepper");return s}const e5={class:"p-dialog-header justify-start gap-1"},t5={key:0,class:"p-dialog-header-actions"},s5={class:"p-dialog-title"},n5={class:"p-dialog-header-actions ml-auto"},r5={key:0},i5=["innerHTML"],o5={class:"flex items-center justify-center shrink-0 w-full p-5 not-md:pb-safe-offset-5 mt-5 self-end",style:{background:"var(--border-color)"}},a5=Et({__name:"CuiDialog",setup(s){Wr.registerLanguage("typescript",bf),Wr.registerLanguage("yaml",wf),Wr.registerLanguage("json",xf),Wr.registerLanguage("python",Sf);const e=Cn(),{t}=js(),n=pi("dialogRef"),r=Yt(n.value.data),{contentText:i,contentProps:o,loading:a,disabled:l,cancelButtonProps:u,confirmButtonProps:d,hideCancelButton:h,hideConfirmButton:v,dialogContentClass:f,dialogContentStyle:b,cancelText:k,confirmText:z,stayActive:L,src:se,title:Z,fullscreen:N,tabs:E,markdown:O}=r;tl("dialogRefProps",r);const U=ce(!1),S=ce(null),M=ce(!1),B=ce(Z.value);let K;const R=n.value.options.templates,w=te(()=>{var Y;return!!(U.value||a!=null&&a.value||Xs((Y=S.value)==null?void 0:Y.isLoading))}),H=te(()=>E.value!==void 0&&E.value.length>0),J=te(()=>k!=null&&k.value?k.value:t("components.form.button.close")),q=te(()=>z!=null&&z.value?z.value:t("components.form.button.save")),oe=te(()=>({...u==null?void 0:u.value,label:J.value,loading:void 0,size:"small",severity:u!=null&&u.value&&"severity"in u.value?u.value.severity:"secondary",class:void 0})),ue=te(()=>({...d==null?void 0:d.value,label:q.value,loading:void 0,size:"small",severity:d!=null&&d.value&&"severity"in d.value?d.value.severity:"success",class:"ml-auto",disabled:l.value}));H.value&&(K=Xb(E.value??[]),Ke(K.isMainTab,Y=>{M.value=!Y},{immediate:!0}),K.on("updateTabTitle",({tabId:Y,title:Te})=>{(K==null?void 0:K.currentTab.value)===Y&&(Z!=null&&Z.value)&&(B.value=Te)}),K.on("tabChange",Y=>{B.value=(Y==null?void 0:Y.title)??Z.value}));const Ce=Cf("commonmark",{highlight(Y,Te){if(Te&&Wr.getLanguage(Te))try{return'<pre><code class="hljs">'+Wr.highlight(Y,{language:Te,ignoreIllegals:!0}).value+"</code></pre>"}catch{}return'<pre><code class="hljs">'+Ce.utils.escapeHtml(Y)+"</code></pre>"}}),F=async()=>{var Y,Te;try{U.value=!0;const He=await((Te=(Y=S.value)==null?void 0:Y.onCancel)==null?void 0:Te.call(Y));n.value.close({status:"cancel",data:He})}catch(He){console.error(He),e.add({severity:"error",summary:t("components.toast.title_error"),detail:He.message,life:3e3})}finally{U.value=!1}},D=async()=>{var Y,Te,He,ht;try{U.value=!0;const At=await((Te=(Y=S.value)==null?void 0:Y.onConfirm)==null?void 0:Te.call(Y));if(At===null)return;L!=null&&L.value?(ht=(He=n.value.options).onConfirm)==null||ht.call(He,At):n.value.close({status:"confirm",data:At})}catch(At){console.error(At),e.add({severity:"error",summary:t("components.toast.title_error"),detail:At.message,life:3e3})}finally{U.value=!1}};return(Y,Te)=>{var ze;const He=Yb,ht=ws,At=Gb,Qe=Na;return m(),A(yt,null,[g("div",e5,[y(Ct,{name:"slide-left"},{default:$(()=>{var ve;return[c(M)?(m(),A("div",t5,[y(ht,{severity:"secondary",text:"",rounded:"",class:"p-dialog-back-button",onClick:(ve=c(K))==null?void 0:ve.goToMainTab},{icon:$(()=>[y(He,{width:"100%",height:"100%"})]),_:1},8,["onClick"])])):ae("",!0)]}),_:1}),g("span",s5,de(c(B)),1),g("div",n5,[y(ht,{severity:"secondary",text:"",rounded:"",class:"p-dialog-close-button",onClick:c(n).close},{icon:$(()=>[y(At,{width:"100%",height:"100%"})]),_:1},8,["onClick"])])]),g("div",{class:ct(["flex justify-center w-full overflow-y-auto px-5 text-balance",{"h-full":c(N)},c(f)]),style:at(c(b))},[c(i)&&!c(O)?(m(),A("span",r5,de(c(i)),1)):c(i)&&c(O)?(m(),A("div",{key:1,class:"w-full markdown-body",innerHTML:c(Ce).render(c(i))},null,8,i5)):c(se)?(m(),j(Qe,{key:2,src:c(se),"image-container-class":"w-full h-full"},null,8,["src"])):(m(),j(Ai((ze=c(R))==null?void 0:ze.content),et({key:3,ref_key:"componentRef",ref:S,class:"w-full h-full relative"},c(o),H0(c(n).options.events||{})),null,16))],6),Te[1]||(Te[1]=g("div",{class:"mt-auto"},null,-1)),g("div",o5,[c(h)?ae("",!0):(m(),j(ht,et({key:0},c(oe),{class:"cui-button-medium",onClick:F}),null,16)),Te[0]||(Te[0]=g("div",{class:"ml-auto"},null,-1)),c(v)?ae("",!0):(m(),j(ht,et({key:1},c(ue),{loading:c(w),disabled:c(l),class:"cui-button-medium",onClick:D}),null,16,["loading","disabled"]))])],64)}}}),Vi={modal:!0,closable:!0,blockScroll:!0,draggable:!1,dismissableMask:!0,baseZIndex:1100,showHeader:!1},qo={pt:{root:{class:"p-dialog-maximized pt-safe border-none"}}},Do={pt:{root:{class:"shadow-xl shadow-black/30 overflow-hidden"}}},er={mobile:{textDialog:{style:{maxWidth:"100%",maxHeight:"100%"},...qo},imageDialog:{style:{maxWidth:"100%",maxHeight:"100%"},...qo},componentDialog:{style:{maxWidth:"100%",maxHeight:"100%"},...qo},stepperDialog:{style:{maxWidth:"100%",maxHeight:"100%"},...qo}},desktop:{textDialog:{style:{maxWidth:"70vw",maxHeight:"90vh",width:"auto"},...Do},imageDialog:{style:{maxWidth:"70vw",maxHeight:"90vh",width:"70vw"},...Do},componentDialog:{style:{maxWidth:"70vw",maxHeight:"90vh",width:"70vw"},...Do},stepperDialog:{style:{maxWidth:"70vw",maxHeight:"90vh",width:"70vw"},...Do}}};function c5(){return{open:(e,t)=>{const n={content:e&&pe(e),options:t||{},data:t&&t.data,close:r=>{bu.emit("close",{instance:n,params:r})}};return bu.emit("open",{instance:n}),n}}}function Nl(){const s=c5(),{mdBreakpoint:e}=Hr(),t=(u,d)=>{const h=Pr({...u});Al(h.options.props,d)},n=(u,d)=>(Ke(e,h=>{if(h)switch(d){case"text":t(u,er.mobile.textDialog);break;case"image":t(u,er.mobile.imageDialog);break;case"component":t(u,er.mobile.componentDialog);break;case"stepper":t(u,er.mobile.stepperDialog);break}else switch(d){case"text":t(u,er.desktop.textDialog);break;case"image":t(u,er.desktop.imageDialog);break;case"component":t(u,er.desktop.componentDialog);break;case"stepper":t(u,er.desktop.stepperDialog);break}},{immediate:!0}),u);function r(u,d,h){const{component:v,data:f,onConfirm:b,onCancel:k,onSettled:z,events:L,...se}=d,Z={content:v?pe(v):void 0},N=s.open(a5,{data:Yt(Pr({confirmText:f.confirmText??void 0,cancelText:f.cancelText??void 0,hideConfirmButton:f.hideConfirmButton??!1,hideCancelButton:f.hideCancelButton??!1,loading:f.loading??!1,disabled:f.disabled??!1,confirmButtonProps:f.confirmButtonProps??void 0,cancelButtonProps:f.cancelButtonProps??void 0,dialogContentClass:f.dialogContentClass??void 0,dialogContentStyle:f.dialogContentStyle??void 0,stayActive:f.stayActive??!1,fullscreen:f.fullscreen??!1,contentText:f.contentText??void 0,src:f.src??void 0,markdown:f.markdown??!1,contentProps:f.contentProps??void 0,tabs:f.tabs??void 0,...f})),props:h,templates:Z,...se,events:L,onConfirm:b,onCancel:k,onClose:E=>{var O,U;if(((O=E==null?void 0:E.data)==null?void 0:O.status)==="confirm"){const{status:S,...M}=E.data;b==null||b((M==null?void 0:M.data)??M)}else k==null||k();z==null||z(((U=E==null?void 0:E.data)==null?void 0:U.data)??(E==null?void 0:E.data))}});return f.fullscreen?N:n(N,u)}function i(u){const{data:d,...h}=u,v=structuredClone(Vi);return v.style={...Vi.style,width:"auto",minWidth:"400px"},d.fullscreen&&(v.style={...v.style,maxWidth:"none",maxHeight:"none"},v.pt={root:{class:"p-dialog-maximized pt-safe border-none"}}),r("text",{data:d,...h},v)}function o(u){const{data:d,...h}=u,v=structuredClone(Vi);return d.fullscreen&&(v.style={...v.style,maxWidth:"none",maxHeight:"none"},v.pt={root:{class:"p-dialog-maximized pt-safe border-none"}}),r("image",{data:d,...h},v)}function a(u,d){const{data:h,...v}=d,f=structuredClone(Vi);return h.fullscreen&&(f.style={...f.style,maxWidth:"none",maxHeight:"none"},f.pt={root:{class:"p-dialog-maximized pt-safe border-none"}}),r("component",{component:u,data:h,...v},f)}function l(u,d){const{data:h,...v}=d,f=structuredClone(Vi);return h.fullscreen&&(f.style={...f.style,maxWidth:"none",maxHeight:"none"},f.pt={root:{class:"p-dialog-maximized pt-safe border-none"}}),r("stepper",{component:u,data:h,...v},f)}return{openTextDialog:i,openImageDialog:o,openComponentDialog:a,openStepperDialog:l}}const l5=rl(Kh);function Fl(){const s=te(()=>typeof window>"u"?!1:[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(k=>navigator.userAgent.match(k))),e=te(()=>typeof window>"u"?!1:[/Android/i].some(k=>navigator.userAgent.match(k))),t=te(()=>typeof window>"u"?!1:n.value||r.value),n=te(()=>typeof window>"u"?!1:[/iPhone/i].some(k=>navigator.userAgent.match(k))),r=te(()=>typeof window>"u"?!1:[/Macintosh/i].some(k=>navigator.userAgent.match(k)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1)),i=te(()=>{var k;if(typeof window>"u")return[0,0];const b=/OS [\d_]+/i;return n.value?((k=navigator.userAgent.match(b))==null?void 0:k[0].substr(3).split("_").map(z=>parseInt(z)))||[0,0]:[0,0]}),o=te(()=>typeof window>"u"?!1:[/Safari/i].some(k=>navigator.userAgent.match(k))),a=te(()=>{if(typeof window>"u")return null;const b=/Version\/(\d+).+Safari/;return navigator.userAgent.match(b)}),l=te(()=>typeof window>"u"?!1:[/Firefox/i].some(k=>navigator.userAgent.match(k))),u=te(()=>typeof window>"u"?!1:[/Chrome/i].some(k=>navigator.userAgent.match(k))),d=te(()=>{let b=!1;if("maxTouchPoints"in navigator)b=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)navigator!==null&&(b=navigator.msMaxTouchPoints>0);else{const k=matchMedia("(pointer:coarse)");if(k&&k.media==="(pointer:coarse)")b=!!k.matches;else if("orientation"in window)b=!0;else{const z=navigator.userAgent;b=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(z)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(z)}}return b}),h=te(()=>l5("(display-mode: standalone)").value||window.navigator.standalone||document.referrer.includes("android-app://")),v=te(()=>{const b=typeof document.body.requestFullscreen<"u"||typeof document.body.mozRequestFullScreen<"u"||typeof document.body.webkitRequestFullscreen<"u"||typeof document.body.msRequestFullscreen<"u"||typeof document.exitFullscreen<"u"||typeof document.mozCancelFullScreen<"u"||typeof document.webkitExitFullscreen<"u",[k,z]=i.value,L=k&&k>=17&&z&&z>=2;return!!(b||!n.value||n.value&&L)}),f=te(()=>{const b="pictureInPictureEnabled"in document;return t.value&&h.value?!1:b});return{isPWA:h,isMobile:s,isAndroid:e,isIos:t,isIphone:n,isIpad:r,iosVersion:i,isSafari:o,safariVersion:a,isFirefox:l,isChrome:u,isTouch:d,isPipSupported:f,isFsSupported:v}}const u5={class:"flex justify-between items-center mb-4 h-9"},d5={class:"flex items-center gap-2"},h5={class:"text-base font-semibold"},m5={class:"overflow-y-auto",style:{maxHeight:"234px"}},p5={class:"flex gap-3"},f5={class:"flex-1 min-w-0"},g5={class:"flex justify-between items-center"},v5={class:"font-semibold text-sm text-color truncate max-w-[200px]"},_5={class:"text-xs text-muted shrink-0"},y5={class:"text-xs text-muted mt-1 text-left line-clamp-2 overflow-hidden"},b5={key:0,class:"text-center py-8 text-muted text-sm"},w5=Et({__name:"CuiNotificationMenu",setup(s){const{t:e}=js(),t=Dr(),n=Rl(),r=Nl(),{isTouch:i}=Fl(),o=Ls(),a=Vt("notificationsMenuRef"),l=ce([]),u=ce({}),d=ce(!1),h=ce(!1);Ke(d,S=>{S&&O()});const v=(S,[M])=>{var oe,ue;if(!M.isIntersecting){(oe=u.value[S])==null||oe.resetFn(),(ue=u.value[S])==null||ue.stopFn(),delete u.value[S];return}if(u.value[S])return;const B=M.target;if(!B.parentElement)return;const R=il(B,()=>{u.value[S]&&u.value[S].resetFn()});let w;const H=i.value?ef:tf,{direction:J,stop:q}=H(B,{threshold:10,disableTextSelect:!0,onSwipe(){var Ce,F;for(const D in u.value)D!==S&&((Ce=u.value[D])==null||Ce.resetFn());J.value==="left"?u.value[S]={left:"-75px",opacity:1,deleteOpacity:1,isSwiping:!0,resetFn(){this.left="0",this.opacity=1,this.deleteOpacity=0},stopFn:()=>{delete u.value[S],q(),R(),clearTimeout(w)}}:(F=u.value[S])==null||F.resetFn()},onSwipeEnd(){clearTimeout(w),w=setTimeout(()=>{u.value[S]&&(u.value[S].isSwiping=!1)},10)}})},f=S=>{var M;(M=a.value)==null||M.toggle(S)},b=S=>{const M=Date.now()-S,B=Math.floor(M/(1e3*60)),K=Math.floor(M/(1e3*60*60)),R=Math.floor(M/(1e3*60*60*24));return B<60?`${B}${e("components.notification_menu.short_minutes")}`:K<24?`${K}${e("components.notification_menu.short_hours")}`:R<7?`${R}${e("components.notification_menu.short_days")}`:R<30?`${Math.floor(R/7)}${e("components.notification_menu.short_weeks")}`:R<365?`${Math.floor(R/30)}${e("components.notification_menu.short_months")}`:`${Math.floor(R/365)}${e("components.notification_menu.short_years")}`},k=S=>{var B;const M=S.link;(B=a.value)==null||B.hide(),z(S),M&&t.push({path:M})},z=S=>{var M;if(S){const B=u.value[S._id];B==null||B.stopFn();const K=l.value.findIndex(R=>R._id===S._id);K!==-1&&(l.value.splice(K,1),(M=o.value)==null||M.socket.emit("remove-notification",S._id))}},L=()=>{var S,M;for(const B in u.value)(S=u.value[B])==null||S.stopFn();l.value.splice(0,l.value.length),(M=o.value)==null||M.socket.emit("clear-notifications")},se=S=>{switch(S){case"info":return"rgb(33, 150, 243)";case"warn":return"rgb(251, 140, 0)";case"error":return"rgb(176, 0, 32)";default:return"rgb(69, 69, 69)"}},Z=S=>{const M=u.value[S._id];M!=null&&M.isSwiping||r.openTextDialog({data:{title:S.title,contentText:S.text,confirmText:S!=null&&S.link?e("components.form.button.go_to_message"):e("components.form.button.mark_as_read")},onConfirm:()=>k(S),onCancel:()=>z(S)})},N=()=>{var S,M;for(const B in u.value)(S=u.value[B])==null||S.resetFn(),(M=u.value[B])==null||M.stopFn()},E=(S,M)=>{if(d.value&&M.channel==="update-check"&&M.status==="available"){const B={_id:"system-update",title:"Update",text:"New camera.ui app update available",type:"info",link:"/settings/system",timestamp:Date.now()};if(l.value.find(K=>K._id===B._id))return;l.value.push(B)}},O=async()=>{if(d.value){window.electron.removeListener("app-status",E),window.electron.on("app-status",E),window.electron.send("check-for-updates");try{if((await window.electron.invoke("get-update-available")).isUpdateAvailable){const M={_id:"system-update",title:"Update",text:"New camera.ui app update available",type:"info",link:"/settings/system",timestamp:Date.now()};if(l.value.find(B=>B._id===M._id))return;l.value.push(M)}}catch{}}};sl(()=>{o.value=n.connectToNamespace("/notifications"),o.value.request("get-notifications").subscribe(S=>{l.value=S}),o.value.socket.on("notifications",S=>{l.value=S}),o.value.socket.on("remove-notification",S=>{const M=l.value.findIndex(B=>B._id===S||B.title===S);M!==-1&&l.value.splice(M,1)}),o.value.socket.on("clear-notifications",()=>{l.value=[]})});const U=()=>{const S=document.querySelector('meta[name="electron-server"]'),M=S!==null&&S.getAttribute("content")==="true";d.value=window.electron!==void 0,h.value=M,setTimeout(()=>{d.value=window.electron!==void 0,h.value=M},100)};return Sn(()=>{U()}),vo(()=>{var S,M,B;(M=(S=o.value)==null?void 0:S.end)==null||M.call(S),(B=window.electron)==null||B.removeListener("app-status",E)}),(S,M)=>{const B=Qb,K=Nh,R=ws,w=Ub,H=Ea,J=Zc;return m(),A(yt,null,[y(R,{severity:"secondary",text:"",class:"cui-button p-2 text-color non-draggable-region",onClick:f},{icon:$(()=>[y(B,{class:"w-6 h-6"}),c(l).length?(m(),j(K,{key:0,class:"absolute min-w-[8px] w-[8px] h-[8px] right-[10px] top-[7px]"})):ae("",!0)]),_:1}),y(J,{ref_key:"notificationsMenuRef",ref:a,"append-to":"self",class:"w-[20rem] cui-rounded-corner shadow-lg notification-menu isolate overscroll-contain non-draggable-region",onHide:N},{default:$(()=>[g("div",u5,[g("div",d5,[g("h3",h5,de(S.$t("components.notification_menu.notifications")),1),y(K,{class:"rounded-full text-xs p-1"},{default:$(()=>[Qt(de(c(l).length>99?"99+":c(l).length),1)]),_:1})]),c(l).length?(m(),j(R,{key:0,severity:"danger",text:"",rounded:"",class:"p-2 cui-icon-md",onClick:L},{icon:$(()=>[y(w,{width:"100%",height:"100%"})]),_:1})):ae("",!0)]),g("div",m5,[(m(!0),A(yt,null,Dt(c(l),q=>{var oe,ue,Ce;return m(),A("div",{key:q._id,class:"relative overflow-hidden"},[$t((m(),A("div",{class:"relative transition-all duration-200",style:at({left:((oe=c(u)[q._id])==null?void 0:oe.left)||"0",opacity:((ue=c(u)[q._id])==null?void 0:ue.opacity)||1})},[y(R,{severity:"secondary",text:"",class:"cui-button p-2 block w-full",onClick:F=>Z(q)},{default:$(()=>[g("div",p5,[g("div",{class:"w-2 h-2 rounded-full mt-2",style:at({backgroundColor:se(q.type)})},null,4),g("div",f5,[g("div",g5,[g("h4",v5,de(q.title),1),g("span",_5,de(b(q.timestamp)),1)]),g("p",y5,de(q.text),1)])])]),_:2},1032,["onClick"])],4)),[[c(X0),F=>v(q._id,F)]]),g("div",{class:"absolute right-0 top-0 h-full flex items-center pr-4",style:at({opacity:((Ce=c(u)[q._id])==null?void 0:Ce.deleteOpacity)||0})},[y(R,{severity:"danger",class:"cui-icon-sm",text:"",rounded:"",onClick:F=>z(q)},{icon:$(()=>[y(w,{width:"100%",height:"100%"})]),_:2},1032,["onClick"])],4),c(l).indexOf(q)!==c(l).length-1?(m(),j(H,{key:0,class:"my-0 py-1"})):ae("",!0)])}),128))]),c(l).length===0?(m(),A("div",b5,de(S.$t("components.notification_menu.no_notifications")),1)):ae("",!0)]),_:1},512)],64)}}}),x5={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function S5(s,e){return m(),A("svg",x5,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 17q-2.075 0-3.537-1.463T7 12t1.463-3.537T12 7t3.538 1.463T17 12t-1.463 3.538T12 17M2 13q-.425 0-.712-.288T1 12t.288-.712T2 11h2q.425 0 .713.288T5 12t-.288.713T4 13zm18 0q-.425 0-.712-.288T19 12t.288-.712T20 11h2q.425 0 .713.288T23 12t-.288.713T22 13zm-8-8q-.425 0-.712-.288T11 4V2q0-.425.288-.712T12 1t.713.288T13 2v2q0 .425-.288.713T12 5m0 18q-.425 0-.712-.288T11 22v-2q0-.425.288-.712T12 19t.713.288T13 20v2q0 .425-.288.713T12 23M5.65 7.05L4.575 6q-.3-.275-.288-.7t.288-.725q.3-.3.725-.3t.7.3L7.05 5.65q.275.3.275.7t-.275.7t-.687.288t-.713-.288M18 19.425l-1.05-1.075q-.275-.3-.275-.712t.275-.688q.275-.3.688-.287t.712.287L19.425 18q.3.275.288.7t-.288.725q-.3.3-.725.3t-.7-.3M16.95 7.05q-.3-.275-.288-.687t.288-.713L18 4.575q.275-.3.7-.288t.725.288q.3.3.3.725t-.3.7L18.35 7.05q-.3.275-.7.275t-.7-.275M4.575 19.425q-.3-.3-.3-.725t.3-.7l1.075-1.05q.3-.275.712-.275t.688.275q.3.275.288.688t-.288.712L6 19.425q-.275.3-.7.288t-.725-.288"},null,-1)]))}const C5=pe({name:"material-symbols-light-mode-rounded",render:S5}),k5={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function E5(s,e){return m(),A("svg",k5,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 21q-3.75 0-6.375-2.625T3 12t2.625-6.375T12 3q.35 0 .688.025t.662.075q-1.025.725-1.638 1.888T11.1 7.5q0 2.25 1.575 3.825T16.5 12.9q1.375 0 2.525-.613T20.9 10.65q.05.325.075.662T21 12q0 3.75-2.625 6.375T12 21"},null,-1)]))}const A5=pe({name:"material-symbols-dark-mode",render:E5}),M5={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"},$5=["id"],T5=["mask"];function P5(s,e){return m(),A("svg",M5,[g("defs",null,[g("mask",{id:s.idMap.ipSDarkMode0},e[0]||(e[0]=[g("g",{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":"10","stroke-width":"4"},[g("path",{fill:"#fff",stroke:"#fff",d:"m24.003 4l5.27 5.27h9.457v9.456l5.27 5.27l-5.27 5.278v9.456h-9.456L24.004 44l-5.278-5.27H9.27v-9.456L4 23.997l5.27-5.27V9.27h9.456z"}),g("path",{fill:"#000",stroke:"#000",d:"M27 17c0 8-5 9-10 9c0 4 6.5 8 12 4s2-13-2-13"})],-1)]),8,$5)]),g("path",{fill:"currentColor",d:"M0 0h48v48H0z",mask:"url(#"+s.idMap.ipSDarkMode0+")"},null,8,T5)])}const R5=pe({name:"icon-park-solid-dark-mode",render:P5,setup(){return{idMap:{ipSDarkMode0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Ll=Mi("theme",()=>{const s=localStorage.getItem("theme"),e=s?JSON.parse(s):{theme:"dark",autoMode:!0},t=xu(e.theme,{onBeforeChange(){if(!r.value)return!1},onChanged(h){e.theme=h,localStorage.setItem("theme",JSON.stringify(e))}}),n=xu(e.autoMode,{onBeforeChange(h){if(h&&!r.value)return!1},onChanged(h){e.autoMode=h,localStorage.setItem("theme",JSON.stringify(e))}}),r=ce(!0),i=Pr(["light","dark"]);Ke(n,h=>{h&&(t.value=o())}),Ke(t,h=>{Zs(()=>{l(h),r.value=!0}),r.value=!1});const o=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",a=()=>n.value?o():t.value,l=h=>{switch(document.documentElement.setAttribute("data-mode",h),h){case"light":document.documentElement.classList.remove("dark-mode");break;case"dark":document.documentElement.classList.add("dark-mode");break}},u=()=>{n.value?(n.value=!1,t.value="light"):t.value==="light"?t.value="dark":n.value=!0},d=Kh("(prefers-color-scheme: dark)");return Ke(d,h=>{n.value&&(t.value=h?"dark":"light")}),l(a()),{colors:i,theme:t,autoMode:n,setAppTheme:l,getSystemMode:o,toggleTheme:u}}),I5=Et({__name:"CuiThemeSwitch",setup(s){const e=Ll(),{theme:t,autoMode:n}=Vs(e),r=()=>{e.toggleTheme()};return(i,o)=>{const a=R5,l=A5,u=C5,d=ws;return m(),j(d,{severity:"secondary",text:"",class:"cui-button p-2 text-color",onClick:r},{default:$(()=>[c(n)?(m(),j(a,{key:0,class:"w-6 h-6"})):c(t)==="dark"?(m(),j(l,{key:1,class:"w-6 h-6"})):c(t)==="light"?(m(),j(u,{key:2,class:"w-6 h-6"})):ae("",!0)]),_:1})}}}),O5={class:"relative flex overflow-hidden items-center justify-center w-5 h-5"},N5={class:"flex flex-col justify-between w-4 h-3 transform transition-all duration-100 origin-center overflow-hidden"},F5=Et({__name:"CuiNavbarToggle",setup(s){const e=Il(),{bus:t}=Ol(),{navbarState:n}=La(),{xlBreakpoint:r}=Hr(),{uiSettings:i}=Vs(e),o=ce("closed"),a=te(()=>o.value==="opened");Ke(n,u=>{u&&u!==o.value&&(o.value=u==="minified"||u==="closed"?"closed":"opened")});const l=()=>{t.emit({navbarState:o.value==="opened"?"closed":"opened"})};return(u,d)=>{const h=ws;return!c(r)||c(i).interface.navbarStayCollapsed?(m(),j(h,{key:0,id:"menu-icon",class:"cui-button relative group p-2 transition-colors duration-100",severity:"secondary",text:"",onClick:l},{default:$(()=>[g("div",O5,[g("div",N5,[g("div",{class:ct(["h-0.5 w-2 transform transition-all duration-100 origin-center",{"w-4 rotate-45 translate-y-[5px]":c(a)}]),style:{backgroundColor:"var(--text-color)"}},null,2),g("div",{class:ct(["h-0.5 w-4 rounded transform transition-all duration-100",{"opacity-0":c(a)}]),style:{backgroundColor:"var(--text-color)"}},null,2),g("div",{class:ct(["h-0.5 w-3 transform transition-all duration-100 origin-center",{"w-4 -rotate-45 -translate-y-[5px]":c(a)}]),style:{backgroundColor:"var(--text-color)"}},null,2)])])]),_:1})):ae("",!0)}}}),L5={class:"group relative flex items-center"},j5={key:0,class:"flex items-center mr-3 pointer-events-auto"},q5={class:"flex-1 min-w-0 text-left"},D5={class:"text-sm font-medium truncate"},B5=["is-exact-active"],z5=["is-exact-active"],U5=Et({__name:"CuiListItem",props:{active:{type:Boolean},disabled:{type:Boolean},to:{},activeClass:{},buttonProps:{},tooltip:{}},emits:["click"],setup(s,{emit:e}){const t=e,n=s,{disabled:r,active:i,to:o,activeClass:a,buttonProps:l,tooltip:u}=Yt(n),[d,h]=dc(),[v,f]=dc(),b=k=>{r.value||t("click",k)};return(k,z)=>{const L=ws,se=Ei("RouterLink"),Z=qr;return m(),A("div",L5,[y(c(v),null,{default:$(({isExactActive:N})=>[g("div",{class:ct(["relative z-10 flex items-center w-full px-3 py-2 pointer-events-none",{"opacity-80 text-muted pointer-events-none disabled cursor-not-allowed":c(r)}])},[k.$slots.prepend?(m(),A("div",j5,[ti(k.$slots,"prepend",{isExactActive:N??!1},void 0,!0)])):ae("",!0),g("div",q5,[g("div",D5,[ti(k.$slots,"default",{isExactActive:N??!1},void 0,!0)]),k.$slots.subtitle?(m(),A("div",{key:0,"is-exact-active":N??!1,class:"text-sm text-muted mt-0.5"},[ti(k.$slots,"subtitle",{},void 0,!0)],8,B5)):ae("",!0)]),k.$slots.append?(m(),A("div",{key:1,"is-exact-active":N??!1,class:"flex items-center ml-3 pointer-events-auto"},[ti(k.$slots,"append",{},void 0,!0)],8,z5)):ae("",!0)],2)]),_:3}),y(c(d),null,{default:$(({isExactActive:N})=>[$t(y(L,et({text:"",fluid:"",disabled:c(r),severity:"contrast",class:["cui-button absolute inset-0",[{active:c(i)||N,"cursor-not-allowed disabled":c(r)},c(i)||N?c(a):void 0]]},c(l),{onClick:b}),null,16,["disabled","class"]),[[Z,{value:c(u)}]]),y(c(f),{"is-exact-active":N},null,8,["is-exact-active"])]),_:1}),c(o)?(m(),j(se,{key:0,to:c(o),class:"block transition-all duration-300"},{default:$(({isExactActive:N})=>[y(c(h),{"is-exact-active":N},null,8,["is-exact-active"])]),_:1},8,["to"])):(m(),j(c(h),{key:1}))])}}}),hp=qs(U5,[["__scopeId","data-v-115e51ef"]]),V5={key:0,class:"flex flex-col gap-1"},H5={key:2,class:"flex flex-col gap-1"},Q5={key:4,class:"flex flex-col gap-1"},mp=Et({__name:"CuiMenu",props:{items:{},autoHide:{type:Boolean,default:!0},popover:{},sortList:{type:Boolean}},emits:["show","hide","click:menu-item"],setup(s,{expose:e,emit:t}){const n=t,r=s,{items:i,autoHide:o,popover:a,sortList:l}=Yt(r),u=Vt("menuRef"),d=ce(!1),h=ce(),[v,f]=dc(),b=te(()=>{const S=i.value.filter(M=>!M.hide);return l.value?S.sort((M,B)=>M.key&&B.key?M.key.localeCompare(B.key):M.label&&B.label?M.label.localeCompare(B.label):0):S}),k=te(()=>b.value.filter(S=>S.position==="header")),z=te(()=>b.value.filter(S=>S.position==="footer")),L=te(()=>b.value.filter(S=>!S.position)),se=S=>{var M;o.value&&O(),(M=S.onClick)==null||M.call(S,wu(h.value)),n("click:menu-item",S)},Z=()=>{d.value=!0,n("show")},N=()=>{h.value=void 0,d.value=!1,n("hide")},E=(S,M,B)=>{var K;h.value=B,(K=u.value)==null||K.toggle(S,M)},O=()=>{var S;(S=u.value)==null||S.hide()},U=(S,M)=>{var B;(B=u.value)==null||B.show(S,M)};return e({menu:u,isOpen:d,data:wu(h),toggleMenu:E,hide:O,show:U}),(S,M)=>{const B=Qm,K=fo,R=hp,w=Ea,H=Zc;return m(),j(H,et({ref_key:"menuRef",ref:u,class:"shadow-lg cui-rounded-corner"},c(a),{onShow:Z,onHide:N}),{default:$(()=>[y(c(v),null,{default:$(({item:J})=>[(m(),j(R,{key:J.key,to:J.to,class:"min-h-10","active-class":"!bg-primary-500/10",disabled:J.disabled,"button-props":J.buttonProps,tooltip:J.tooltip,onClick:q=>se(J)},Uh({default:$(({isExactActive:q})=>[g("span",et(J.labelProps,{class:{"text-primary":q||J.active,"!font-bold":J.avatarProps,"opacity-70":!J.disabled}}),de(J.label),17)]),_:2},[J.avatarProps||J.icon?{name:"prepend",fn:$(({isExactActive:q})=>[J.avatarProps?(m(),j(B,Q0(et({key:0},J.avatarProps)),null,16)):ae("",!0),J.icon?(m(),j(Ai(J.icon),et({key:1},J.iconProps,{class:{"text-primary":q||J.active,"opacity-70":!J.disabled}}),null,16,["class"])):ae("",!0)]),key:"0"}:void 0,J.description?{name:"subtitle",fn:$(()=>[g("span",et(J.descriptionProps,{class:{"opacity-70":!J.disabled}}),de(J.description),17)]),key:"1"}:void 0,J.toggle?{name:"append",fn:$(()=>[y(K,{"model-value":J.toggleState,disabled:J.disabled,"onUpdate:modelValue":q=>se(J)},null,8,["model-value","disabled","onUpdate:modelValue"])]),key:"2"}:void 0]),1032,["to","disabled","button-props","tooltip","onClick"]))]),_:1}),c(k).length?(m(),A("div",V5,[(m(!0),A(yt,null,Dt(c(k),(J,q)=>(m(),j(c(f),{key:q,item:J},null,8,["item"]))),128))])):ae("",!0),c(k).length&&c(L).length?(m(),j(w,{key:1,class:"m-0 py-3"})):ae("",!0),c(L).length?(m(),A("div",H5,[(m(!0),A(yt,null,Dt(c(L),(J,q)=>(m(),j(c(f),{key:q,item:J},null,8,["item"]))),128))])):ae("",!0),c(L).length&&c(z).length?(m(),j(w,{key:3,class:"m-0 py-3"})):ae("",!0),c(z).length?(m(),A("div",Q5,[(m(!0),A(yt,null,Dt(c(z),(J,q)=>(m(),j(c(f),{key:q,item:J},null,8,["item"]))),128))])):ae("",!0)]),_:1},16)}}}),K5={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Z5(s,e){return m(),A("svg",K5,e[0]||(e[0]=[zh('<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"><path d="M11 21H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v7"></path><path stroke-linejoin="round" d="M2 7h20M5 5.01l.01-.011M8 5.01l.01-.011M11 5.01l.01-.011m10.657 11.668C21.047 15.097 19.635 14 17.99 14c-1.758 0-3.252 1.255-3.793 3"></path><path stroke-linejoin="round" d="M19.995 16.772H21.4a.6.6 0 0 0 .6-.6V14.55m-7.666 4.783C14.953 20.903 16.366 22 18.01 22c1.758 0 3.252-1.255 3.793-3"></path><path stroke-linejoin="round" d="M16.005 19.228H14.6a.6.6 0 0 0-.6.6v1.622"></path></g>',1)]))}const G5=pe({name:"iconoir-reload-window",render:Z5}),W5={class:"relative w-6 h-6"},J5=Et({__name:"CuiProfileMenu",setup(s){const{t:e}=js(),t=Fs(),{user:n}=Vs(t),r=Vt("menuRef"),i=te(()=>uo.filter(l=>{var u;return((u=l.meta)==null?void 0:u.profileMenu)&&l.meta.auth&&Lr(l)})),o=te(()=>{var h,v;const l={label:(h=n.value)==null?void 0:h.username,description:(v=n.value)==null?void 0:v.role,to:"/settings/account",position:"header",avatarProps:{src:"avatar",size:35,style:{width:"35px",height:"35px"}}},u=[...i.value.map(f=>({label:e(`navigation.${f.name.toLowerCase()}`),icon:f.meta.profileMenu.icon.default,to:f.path})),{label:e("components.user_menu.reload"),icon:G5,onClick:a}],d={label:e("components.user_menu.logout"),icon:Jh,position:"footer",iconProps:{class:"!text-primary"},labelProps:{class:"!text-primary"},buttonProps:{class:"hover:!bg-primary-500/10 active:!bg-primary-500/10 focus:!bg-primary-500/10"},onClick:t.logout};return[l,...u,d]}),a=()=>{window.location.reload()};return(l,u)=>{var v;const d=ws,h=mp;return m(),A(yt,null,[y(d,{severity:"secondary",text:"",class:"cui-button p-2 text-color",onClick:(v=c(r))==null?void 0:v.toggleMenu},{default:$(()=>{var f,b,k;return[g("div",W5,[g("div",{class:ct(["absolute top-0.5 left-1/2 -translate-x-1/2 w-1.5 h-1.5 rounded-full transform transition-all duration-100 origin-center",{"w-4 h-[2px] rotate-45 top-1/2 -translate-y-1/2 rounded-none":(f=c(r))==null?void 0:f.isOpen}]),style:{backgroundColor:"var(--text-color)"}},null,2),g("div",{class:ct(["absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full transition-all duration-100",{"opacity-0 scale-0":(b=c(r))==null?void 0:b.isOpen}]),style:{backgroundColor:"var(--text-color)"}},null,2),g("div",{class:ct(["absolute bottom-0.5 left-1/2 -translate-x-1/2 w-1.5 h-1.5 rounded-full transform transition-all duration-100 origin-center",{"w-4 h-[2px] -rotate-45 bottom-1/2 translate-y-1/2 rounded-none":(k=c(r))==null?void 0:k.isOpen}]),style:{backgroundColor:"var(--text-color)"}},null,2)])]}),_:1},8,["onClick"]),y(h,{ref_key:"menuRef",ref:r,items:c(o),popover:{appendTo:"self",pt:{root:{class:"w-[18rem] profile-menu"}}}},null,8,["items"])],64)}}}),Y5={HEIGHT:60},X5={class:"flex flex-row items-center flex-1 p-2"},ew=Et({__name:"CuiTopbar",setup(s){const{showBottombar:e}=La();return(t,n)=>{const r=J5,i=F5,o=I5,a=w5;return m(),A("header",{class:"cui-topbar fixed flex flex-row items-center right-0 pt-safe pr-safe draggable-region",style:at({height:`calc(${c(Y5).HEIGHT}px + env(safe-area-inset-top, 0px))`})},[g("div",X5,[c(e)?(m(),j(r,{key:0,class:"non-draggable-region"})):(m(),j(i,{key:1,class:"non-draggable-region"})),y(o,{class:"ml-auto non-draggable-region"}),("useCuiPermission"in t?t.useCuiPermission:c(Lr))(void 0,"admin")?(m(),j(a,{key:2})):ae("",!0)])],4)}}}),tw=qs(ew,[["__scopeId","data-v-162b131f"]]),sw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function nw(s,e){return m(),A("svg",sw,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4m-8-2l8-8m0 0v5m0-5h-5"},null,-1)]))}const rw=pe({name:"majesticons-open",render:nw}),pp=Et({__name:"CuiChipGroup",props:Qn({selectedClass:{},disabled:{type:Boolean},mandatory:{type:Boolean},multiple:{type:Boolean}},{modelValue:{required:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const e=Rr(s,"modelValue"),t=s,{selectedClass:n,disabled:r,mandatory:i,multiple:o}=Yt(t);return tl("chipGroup",{modelValue:e,selectedClass:n,disabled:r,mandatory:i,updateSelected:l=>{if(!r.value)if(o.value){let u=[...Array.isArray(e.value)?e.value:[]];u.includes(l)?(!i.value||u.length>1)&&(u=u.filter(d=>d!==l)):u.push(l),e.value=u}else e.value===l?i.value||(e.value=void 0):e.value=l}}),(l,u)=>(m(),A("div",{class:ct(["flex flex-wrap gap-2",{"opacity-60 pointer-events-none":c(r)}])},[ti(l.$slots,"default")],2))}}),iw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ow(s,e){return m(),A("svg",iw,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z"},null,-1)]))}const fp=pe({name:"mdi-check",render:ow}),aw={key:0,class:"absolute left-1 top-1/2 transform -translate-y-1/2 flex items-center justify-center cui-icon-sm"},cw=Et({__name:"CuiChip",props:{value:{},removable:{type:Boolean},disabled:{type:Boolean},size:{},filter:{type:Boolean}},setup(s){const e=s,{value:t,removable:n,disabled:r,size:i,filter:o}=Yt(e),a=pi("chipGroup"),l=te(()=>r.value||(a==null?void 0:a.disabled.value)),u=te(()=>{if(!a)return!1;const v=a.modelValue.value;return Array.isArray(v)?v.includes(t.value):v===t.value}),d=te(()=>u.value?a==null?void 0:a.selectedClass.value:void 0),h=()=>{l.value||a==null||a.updateSelected(t.value)};return(v,f)=>{const b=fp,k=O0;return m(),j(k,{removable:c(n),disabled:c(l),class:ct(["cui-chip inline-flex cursor-pointer transition-all rounded-full py-1 px-2 relative",[{"cui-chip-selected":c(u),"cui-chip-disabled":c(l),"cui-chip-small":c(i)==="small","cui-chip-medium":c(i)==="medium","cui-chip-large":c(i)==="large","pl-7":c(o)&&c(u)},c(d)]]),onClick:h},{default:$(()=>[y(Ct,{name:"fade"},{default:$(()=>[c(o)&&c(u)?(m(),A("div",aw,[y(b,{width:"100%",height:"100%"})])):ae("",!0)]),_:1}),ti(v.$slots,"default",{},void 0,!0)]),_:3},8,["removable","disabled","class"])}}}),gp=qs(cw,[["__scopeId","data-v-3b79f904"]]),lw=async({cameraData:s})=>(await Re.post("/cameras",s)).data,uw=async({cameraData:s})=>(await Re.post("/cameras/pair",s)).data,dw=async({cameraData:s})=>(await Re.post("/cameras/preview",s)).data,vp=async({cameraname:s,signal:e})=>(await Re.get(`/cameras/${s}`,{signal:e})).data,hw=async({cameraname:s})=>(await Re.delete(`/cameras/${s}/log`)).data,mw=async({cameraname:s,signal:e})=>(await Re.get(`/cameras/${s}/log/download`,{signal:e})).data,_p=async({cameraname:s,sourcename:e,signal:t})=>(await Re.get(`/cameras/${s}/info/${e}`,{signal:t})).data,pw=async({cameraname:s,sourcename:e,probeConfig:t,signal:n})=>(await Re.get(`/cameras/${s}/probe/${e}`,{params:{...t},signal:n})).data,fw=async({cameraname:s,forceNew:e,signal:t})=>(await Re.get(`/cameras/${s}/snapshot`,{signal:t,params:{forceNew:e}})).data,gw=async({parameter:s,signal:e})=>(await Re.get("/cameras",{params:s,signal:e})).data,vw=async({type:s,src:e,signal:t})=>(await Re.get("/cameras/discover",{params:{type:s,src:e},signal:t})).data,_w=async({cameraname:s,cameraData:e})=>(await Re.patch(`/cameras/${s}`,e)).data,yw=async({cameraname:s,signal:e})=>(await Re.get(`/cameras/${s}/extensions`,{signal:e})).data,bw=async({cameraname:s,pluginname:e,signal:t})=>(await Re.get(`/cameras/${s}/${e}/config`,{signal:t})).data,ww=async({cameraname:s,pluginname:e,configData:t})=>(await Re.patch(`/cameras/${s}/${e}/config`,t)).data,xw=async({cameraname:s,pluginname:e,configData:t})=>(await Re.put(`/cameras/${s}/${e}/config`,t)).data,Sw=async({cameraname:s,pluginname:e,configData:t})=>(await Re.post(`/cameras/${s}/${e}/config`,t)).data,Cw=async({cameraname:s,pluginname:e,type:t})=>(await Re.put(`/cameras/${s}/${e}/enable`,null,{params:{type:t}})).data,kw=async({cameraname:s,pluginname:e,type:t})=>(await Re.put(`/cameras/${s}/${e}/disable`,null,{params:{type:t}})).data,Ew=async({cameraname:s,pluginname:e,type:t})=>(await Re.post(`/cameras/${s}/${e}`,null,{params:{type:t}})).data,Aw=async({cameraname:s,pluginname:e,type:t})=>(await Re.delete(`/cameras/${s}/${e}`,{params:{type:t}})).data,Mw=async({cameraname:s,signal:e})=>(await Re.get(`/cameras/${s}/zones`,{signal:e})).data,$w=async({cameraname:s,zoneData:e})=>(await Re.patch(`/cameras/${s}/zones`,e)).data,Tw=async({cameraname:s})=>(await Re.delete(`/cameras/${s}`)).data,Pw=async()=>(await Re.delete("/cameras")).data;class Wn{constructor(){p(this,"_queryClient",Ci());p(this,"t",js().t);p(this,"toast",Cn());p(this,"queryActivator",ce([{name:"getCameraQuery",enabled:!0},{name:"getCamerasQuery",enabled:!0},{name:"discoverCamerasQuery",enabled:!0},{name:"getCameraSnapshotQuery",enabled:!0},{name:"getCameraExtensionsQuery",enabled:!0},{name:"getCameraExtensionConfigQuery",enabled:!0},{name:"getZonesQuery",enabled:!0},{name:"streamSourceInfoQuery",enabled:!0},{name:"probeCameraSourceQuery",enabled:!0},{name:"downloadLogQuery",enabled:!0}]))}get queryClient(){return this._queryClient}createCameraQuery(){return ut({mutationFn:lw,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["camerasList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.camera_added"),life:3e3})}})}pairCameraQuery(){return ut({mutationFn:uw,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["camerasList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.camera_added"),life:3e3})}})}previewCameraQuery(){return ut({mutationFn:dw})}getCameraQuery(e){return qt({queryKey:["cameras",e],queryFn:({signal:t})=>vp({cameraname:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getCameraQuery"&&t.enabled)})}getCameraExtensionsQuery(e){return qt({queryKey:["camerasExtensions",e],queryFn:({signal:t})=>yw({cameraname:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getCameraExtensionsQuery"&&t.enabled)})}streamSourceInfoQuery(e,t){return qt({queryKey:["cameras",e,"info",t],queryFn:({signal:n})=>_p({cameraname:c(e),sourcename:c(t),signal:n}),enabled:()=>this.queryActivator.value.some(n=>n.name==="streamSourceInfoQuery"&&n.enabled)})}probeCameraSourceQuery(e,t,n){return qt({queryKey:["cameras",e,"probe",t],queryFn:({signal:r})=>pw({cameraname:c(e),sourcename:c(t),probeConfig:c(n),signal:r}),enabled:()=>this.queryActivator.value.some(r=>r.name==="probeCameraSourceQuery"&&r.enabled)})}getCameraSnapshotQuery(e,t){return qt({queryKey:["camerasSnapshot",e],queryFn:({signal:n})=>fw({cameraname:c(e),forceNew:c(t),signal:n}),enabled:()=>this.queryActivator.value.some(n=>n.name==="getCameraSnapshotQuery"&&n.enabled),retry:!1})}getCamerasQuery(e){return qt({queryKey:["camerasList",e],queryFn:({signal:t})=>gw({parameter:c(e),signal:t}),placeholderData:t=>t,enabled:()=>this.queryActivator.value.some(t=>t.name==="getCamerasQuery"&&t.enabled)})}discoverCamerasQuery(e){return qt({queryKey:["cameras","discover",e],queryFn:({signal:t})=>vw({...c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="discoverCamerasQuery"&&t.enabled)})}patchCameraQuery(){return ut({mutationFn:_w,onSuccess:async(e,t)=>{if(t.cameraData.name&&t.cameraData.name!==t.cameraname){const r=t.cameraname;await this._queryClient.invalidateQueries({queryKey:[r]}),await this._queryClient.refetchQueries({queryKey:["camerasList"]})}else await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname]}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]}),await this._queryClient.refetchQueries({queryKey:["cameras","extensions",t.cameraname]});this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.camera_updated"),life:3e3})}})}getCameraExtensionConfigQuery(e,t,n){return qt({queryKey:["cameras","extensions",e,t],queryFn:({signal:r})=>bw({cameraname:c(e),pluginname:c(t),signal:r}),enabled:()=>this.queryActivator.value.some(r=>r.name==="getCameraExtensionConfigQuery"&&r.enabled),refetchInterval(){if(n.value)return 15e3},retry:10,retryDelay:500,staleTime:0})}patchCameraExtensionConfigQuery(){return ut({mutationFn:ww,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["cameras","extensions",t.cameraname]}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}setCameraExtensionConfigQuery(){return ut({mutationFn:xw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["cameras","extensions",t.cameraname]}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}submitCameraExtensionConfigQuery(){return ut({mutationFn:Sw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["cameras","extensions",t.cameraname]}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}enableCameraExtensionQuery(){return ut({mutationFn:Cw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}disableCameraExtensionQuery(){return ut({mutationFn:kw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}addCameraExtensionQuery(){return ut({mutationFn:Ew,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}getZonesQuery(e){return qt({queryKey:["cameras",e,"zones"],queryFn:({signal:t})=>Mw({cameraname:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getZonesQuery"&&t.enabled)})}patchZonesQuery(){return ut({mutationFn:$w,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.zone_updated"),life:3e3})}})}removeCameraExtensionQuery(){return ut({mutationFn:Aw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["cameras",t.cameraname],exact:!0}),await this._queryClient.refetchQueries({queryKey:["camerasExtensions",t.cameraname]})}})}removeCameraQuery(){return ut({mutationFn:Tw,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["camerasList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.camera_removed"),life:3e3})}})}removeCamerasQuery(){return ut({mutationFn:Pw,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["camerasList"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.cameras_removed"),life:3e3})}})}downloadLogQuery(e){return qt({queryKey:["logs",e],queryFn:({signal:t})=>mw({cameraname:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="downloadLogQuery"&&t.enabled)})}clearLogQuery(){return ut({mutationFn:hw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["logs",t.cameraname],exact:!0}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.log_cleared"),life:3e3})}})}toggleQueryActivator(e,t){const n=this.queryActivator.value.find(r=>r.name===e);n&&(n.enabled=t)}}const Rw=async({pluginData:s})=>(await Re.post("/plugins",s)).data,Iw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}`,{signal:e})).data,Ow=async({pluginname:s,signal:e})=>(await Re.get(`/plugins/${s}/versions`,{signal:e})).data,Nw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/update`,{signal:e})).data,Fw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/logo`,{signal:e})).data,Lw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/config`,{signal:e})).data,jw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/contract`,{signal:e})).data,qw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/readme`,{signal:e})).data,Dw=async({pluginName:s,query:e,signal:t})=>(await Re.get(`/plugins/${s}/changelog`,{params:e,signal:t})).data,Bw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/interface`,{signal:e})).data,zw=async({parameter:s,signal:e})=>(await Re.get("/plugins",{params:s,signal:e})).data,Uw=async({parameter:s,signal:e})=>(await Re.get("/plugins/extensions",{params:s,signal:e})).data,Vw=async({pluginName:s})=>(await Re.delete(`/plugins/${s}/log`)).data,Hw=async({pluginName:s,signal:e})=>(await Re.get(`/plugins/${s}/log/download`,{signal:e})).data,Qw=async({parameter:s,signal:e})=>(await Re.get("/plugins/progress",{params:s,signal:e})).data,Kw=async({query:s,parameter:e,signal:t})=>(await Re.get("/plugins/search",{params:{...s,...e},signal:t})).data,Zw=async({pluginName:s})=>(await Re.put(`/plugins/${s}/enable`)).data,Gw=async({pluginName:s,configData:e})=>(await Re.patch(`/plugins/${s}/config`,e)).data,Ww=async({pluginname:s,configData:e})=>(await Re.put(`/plugins/${s}/config`,e)).data,Jw=async({pluginname:s,configData:e})=>(await Re.post(`/plugins/${s}/config`,e)).data,Yw=async({pluginName:s})=>(await Re.put(`/plugins/${s}/disable`)).data,Xw=async({pluginName:s})=>(await Re.put(`/plugins/${s}/start`)).data,e3=async({pluginName:s})=>(await Re.put(`/plugins/${s}/stop`)).data,t3=async({pluginName:s})=>(await Re.put(`/plugins/${s}/restart`)).data,s3=async({pluginName:s,formData:e})=>(await Re.post(`/plugins/${s}/detect/motion`,e,{responseType:"arraybuffer"})).data,n3=async({pluginName:s,formData:e})=>(await Re.post(`/plugins/${s}/detect/objects`,e)).data,r3=async({pluginName:s,formData:e})=>(await Re.post(`/plugins/${s}/detect/audio`,e)).data,i3=async({pluginName:s,removeStorage:e})=>(await Re.delete(`/plugins/${s}`,{params:{removeStorage:e}})).data,o3=async()=>(await Re.delete("/plugins")).data;class yp{constructor(){p(this,"_queryClient",Ci());p(this,"t",js().t);p(this,"toast",Cn());p(this,"queryActivator",ce([{name:"getPluginQuery",enabled:!0},{name:"getPluginsQuery",enabled:!0},{name:"getPluginsExtensionsQuery",enabled:!0},{name:"searchPluginsQuery",enabled:!0},{name:"getPluginVersionsQuery",enabled:!0},{name:"getPluginUpdateQuery",enabled:!0},{name:"getPluginLogoQuery",enabled:!0},{name:"getPluginConfigQuery",enabled:!0},{name:"getPluginContractQuery",enabled:!0},{name:"getPluginReadmeQuery",enabled:!0},{name:"getPluginInterfaceQuery",enabled:!0},{name:"getPluginChangelogQuery",enabled:!0},{name:"getPluginsProgressQuery",enabled:!0},{name:"installPluginQuery",enabled:!0},{name:"enablePluginQuery",enabled:!0},{name:"disablePluginQuery",enabled:!0},{name:"patchPluginConfigQuery",enabled:!0},{name:"setPluginConfigQuery",enabled:!0},{name:"submitPluginConfigQuery",enabled:!0},{name:"startPluginQuery",enabled:!0},{name:"stopPluginQuery",enabled:!0},{name:"restartPluginQuery",enabled:!0},{name:"detectMotionQuery",enabled:!0},{name:"detectObjectsQuery",enabled:!0},{name:"detectAudioQuery",enabled:!0},{name:"uninstallPluginQuery",enabled:!0},{name:"uninstallPluginsQuery",enabled:!0},{name:"downloadLogQuery",enabled:!0}]))}get queryClient(){return this._queryClient}installPluginQuery(){return ut({mutationFn:Rw,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["pluginsList"]}),await this._queryClient.refetchQueries({queryKey:["plugins"]}),await this._queryClient.refetchQueries({queryKey:["pluginsSearch"]}),await this._queryClient.refetchQueries({queryKey:["pluginsProgress"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_installed"),life:3e3})}})}getPluginQuery(e){return qt({queryKey:["plugins",e],queryFn:({signal:t})=>Iw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginQuery"&&t.enabled)})}getPluginsQuery(e){return qt({queryKey:["pluginsList",e],queryFn:({signal:t})=>zw({parameter:c(e),signal:t}),placeholderData:t=>t,enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginsQuery"&&t.enabled)})}getPluginsExtensionsQuery(e){return qt({queryKey:["extensionsList",e],queryFn:({signal:t})=>Uw({parameter:c(e),signal:t}),placeholderData:t=>t,enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginsExtensionsQuery"&&t.enabled)})}getPluginsProgressQuery(e){return qt({queryKey:["pluginsProgress",e],queryFn:({signal:t})=>Qw({parameter:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginsProgressQuery"&&t.enabled)})}searchPluginsQuery(e,t){return qt({queryKey:["pluginsSearch",e,t],queryFn:({signal:n})=>Kw({query:c(e),parameter:c(t),signal:n}),placeholderData:n=>n,enabled:()=>this.queryActivator.value.some(n=>n.name==="searchPluginsQuery"&&n.enabled)})}getPluginVersionsQuery(e){return qt({queryKey:["plugins",e,"versions"],queryFn:({signal:t})=>Ow({pluginname:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginVersionsQuery"&&t.enabled)})}getPluginUpdateQuery(e){return qt({queryKey:["plugins",e,"update"],queryFn:({signal:t})=>Nw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginUpdateQuery"&&t.enabled)})}getPluginLogoQuery(e){return qt({queryKey:["plugins",e,"logo"],queryFn:({signal:t})=>Fw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginLogoQuery"&&t.enabled)})}getPluginConfigQuery(e){return qt({queryKey:["plugins",e,"config"],queryFn:({signal:t})=>Lw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginConfigQuery"&&t.enabled)})}getPluginContractQuery(e){return qt({queryKey:["plugins",e,"contract"],queryFn:({signal:t})=>jw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginContractQuery"&&t.enabled)})}getPluginReadmeQuery(e){return qt({queryKey:["plugins",e,"readme"],queryFn:({signal:t})=>qw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginReadmeQuery"&&t.enabled)})}getPluginInterfaceQuery(e){return qt({queryKey:["plugins",e,"interface"],queryFn:({signal:t})=>Bw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="getPluginInterfaceQuery"&&t.enabled)})}getPluginChangelogQuery(e,t){return qt({queryKey:["plugins",e,"changelog"],queryFn:({signal:n})=>Dw({pluginName:c(e),query:c(t),signal:n}),enabled:()=>this.queryActivator.value.some(n=>n.name==="getPluginChangelogQuery"&&n.enabled)})}patchPluginConfigQuery(){return ut({mutationFn:Gw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_config_updated"),life:3e3})}})}startPluginQuery(){return ut({mutationFn:Xw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_started"),life:3e3})}})}stopPluginQuery(){return ut({mutationFn:e3,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_stopped"),life:3e3})}})}restartPluginQuery(){return ut({mutationFn:t3,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_restarted"),life:3e3})}})}detectMotionQuery(){return ut({mutationFn:s3})}detectObjectsQuery(){return ut({mutationFn:n3})}detectAudioQuery(){return ut({mutationFn:r3})}setPluginConfigQuery(){return ut({mutationFn:Ww,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginname,t.configData]})}})}submitPluginConfigQuery(){return ut({mutationFn:Jw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginname,t.configData]})}})}enablePluginQuery(){return ut({mutationFn:Zw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["pluginsList"]}),await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_enabled"),life:3e3})}})}disablePluginQuery(){return ut({mutationFn:Yw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["pluginsList"]}),await this._queryClient.refetchQueries({queryKey:["plugins",t.pluginName]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_disabled"),life:3e3})}})}uninstallPluginQuery(){return ut({mutationFn:i3,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["pluginsList"]}),await this._queryClient.refetchQueries({queryKey:["pluginsSearch"]}),await this._queryClient.refetchQueries({queryKey:["pluginsProgress"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugin_removed"),life:3e3})}})}uninstallPluginsQuery(){return ut({mutationFn:o3,onSuccess:async()=>{await this._queryClient.refetchQueries({queryKey:["pluginsList"]}),await this._queryClient.refetchQueries({queryKey:["pluginsSearch"]}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.plugins_removed"),life:3e3})}})}downloadLogQuery(e){return qt({queryKey:["logs",e],queryFn:({signal:t})=>Hw({pluginName:c(e),signal:t}),enabled:()=>this.queryActivator.value.some(t=>t.name==="downloadLogQuery"&&t.enabled)})}clearLogQuery(){return ut({mutationFn:Vw,onSuccess:async(e,t)=>{await this._queryClient.refetchQueries({queryKey:["logs",t.pluginName],exact:!0}),this.toast.add({severity:"success",summary:this.t("components.toast.title_success"),detail:this.t("components.toast.log_cleared"),life:3e3})}})}toggleQueryActivator(e,t){const n=this.queryActivator.value.find(r=>r.name===e);n&&(n.enabled=t)}}const a3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function c3(s,e){return m(),A("svg",a3,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M17 13h-4v4h-2v-4H7v-2h4V7h2v4h4m-5-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2"},null,-1)]))}const bp=pe({name:"mdi-plus-circle",render:c3}),l3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function u3(s,e){return m(),A("svg",l3,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2"},null,-1)]))}const d3=pe({name:"mdi-information",render:u3}),h3={key:0,class:"flex flex-col field-gap"},m3=["for"],p3={key:1,class:"flex flex-col field-gap"},f3=["for"],g3=["for"],v3=["for"],_3={class:"flex items-center gap-4"},y3={class:"flex flex-col field-switch-gap"},b3=["for"],w3=["for"],x3={class:"flex gap-2 items-center w-full"},S3={class:"text-color"},C3={class:"w-full h-full flex flex-col gap-6"},k3={class:"flex flex-row w-full items-center justify-center mt-3"},E3=Et({__name:"CuiSchemaField",props:Qn({schemaField:{},configKey:{},arrayItem:{},loading:{type:Boolean,default:!1}},{modelValue:{type:Object,required:!0},modelModifiers:{}}),emits:Qn(["onAction","onSubmit","onTrigger"],["update:modelValue"]),setup(s,{emit:e}){const t=Ll(),n=e,r=Rr(s,"modelValue"),i=s,{theme:o}=Vs(t),{schemaField:a,configKey:l,arrayItem:u,loading:d}=Yt(i),h=ce(0),v=ce(0),f=ce(a.value.opened?[l.value]:[]);Ke(r,()=>{h.value++},{deep:!0});const b=sf(async()=>{if(or(a.value)&&a.value.format==="qrCode"){let N;return o.value==="dark"?N={dark:"#FFFFFFFF",light:"#FF000000"}:N={dark:"#404040FF",light:"#FFFFFFFF"},await kf.toDataURL(Z.value||"",{margin:.5,type:"image/png",color:N,scale:10})}},void 0,{lazy:!0}),k=te(()=>{if(or(a.value)&&a.value.format==="image")return Z.value}),z=(N,E)=>{const O=ri(N,E);return Array.isArray(O)?O:[]},L=N=>{const E=ri(r.value,N),O=Array.isArray(E)?[...E]:[];gh(a.value)&&a.value.items&&(O.push(Pl(a.value.items)),ac(r.value,N,O),v.value++)},se=(N,E)=>{const O=ri(r.value,N);if(Array.isArray(O)){const U=[...O];U.splice(E,1),ac(r.value,N,U),v.value++,n("onTrigger")}},Z=te({get:()=>(h.value,ri(r.value,l.value)),set:N=>{const E=a.value;let O=N;xa(E)?E.multiple?O=Array.isArray(N)?N:[N]:O=N&&N.toString():or(E)?O=N!=null?N.toString():"":ph(E)?O=typeof N=="number"?N:parseFloat(N)||0:fh(E)&&(O=N==="true"||N===!0),ac(r.value,l.value,O),h.value++}});return(N,E)=>{const O=Na,U=ki,S=Oh,M=_o,B=ws,K=Aa,R=go,w=Gc,H=Fh,J=fo,q=Wc,oe=Lh,ue=d3,Ce=Xc,F=Ei("CuiSchemaField",!0),D=bp,Y=el,Te=Yc,He=Jc,ht=jh,At=qr;return m(),A("div",null,[c(or)(c(a))&&c(a).format==="qrCode"?(m(),A("div",h3,[g("label",{for:c(l),class:"cui-label"},de(c(a).title),9,m3),y(O,{src:c(b),class:"mb-3","image-container-class":"w-full h-full"},null,8,["src"])])):ae("",!0),c(or)(c(a))&&c(a).format==="image"?(m(),A("div",p3,[g("label",{for:c(l),class:"cui-label"},de(c(a).title),9,f3),y(O,{src:c(k),class:"mb-3","image-container-class":"w-full h-full"},null,8,["src"])])):c(Dy)(c(a))?(m(),j(c(Nt),{key:2,modelValue:c(Z),"onUpdate:modelValue":E[1]||(E[1]=Qe=>ps(Z)?Z.value=Qe:null),modelModifiers:{trim:!0},name:c(l),as:"div",class:"flex flex-col field-gap"},{default:$(({field:Qe,errors:ze})=>[g("label",{for:c(l),class:"cui-label"},de(c(a).title),9,g3),y(R,null,{default:$(()=>[c(a).format!=="password"?(m(),j(U,et({key:0},Qe,{invalid:ze.length>0,readonly:c(a).readonly,placeholder:c(a).placeholder,loading:c(d),type:"text"}),null,16,["invalid","readonly","placeholder","loading"])):(m(),j(S,et({key:1,"model-value":c(Z),invalid:ze.length>0,readonly:c(a).readonly},Qe,{feedback:!1,"toggle-mask":""}),null,16,["model-value","invalid","readonly"])),c(u)?(m(),j(K,{key:2},{default:$(()=>[y(B,{text:"",severity:"secondary",loading:c(d),onClick:E[0]||(E[0]=ve=>se(c(u).key,c(u).index))},{icon:$(()=>[y(M)]),_:1},8,["loading"])]),_:1})):ae("",!0)]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:c(l),class:"cui-input-error"},null,8,["name"])]),_:1}),!ze.length&&c(a).description?(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1})):ae("",!0)]),_:1},8,["modelValue","name"])):c(ph)(c(a))?(m(),j(c(Nt),{key:3,"model-value":c(Z),name:c(l),as:"div",class:"flex flex-col field-gap"},{default:$(({field:Qe,errors:ze})=>[g("label",{for:c(l),class:"cui-label"},de(c(a).title),9,v3),y(R,null,{default:$(()=>[y(H,et(Qe,{modelValue:c(Z),"onUpdate:modelValue":E[2]||(E[2]=ve=>ps(Z)?Z.value=ve:null),invalid:ze.length>0,readonly:c(a).readonly,step:c(a).step||1,min:c(a).minimum,max:c(a).maximum,"use-grouping":!1,loading:c(d),onValueChange:E[3]||(E[3]=ve=>Z.value=ve),onInput:E[4]||(E[4]=ve=>Z.value=ve.value)}),null,16,["modelValue","invalid","readonly","step","min","max","loading"]),c(u)?(m(),j(K,{key:0},{default:$(()=>[y(B,{text:"",rounded:"",severity:"danger",loading:c(d),onClick:E[5]||(E[5]=ve=>se(c(u).key,c(u).index))},{icon:$(()=>[y(M)]),_:1},8,["loading"])]),_:1})):ae("",!0)]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:c(l),class:"cui-input-error"},null,8,["name"])]),_:1}),!ze.length&&c(a).description?(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1})):ae("",!0)]),_:1},8,["model-value","name"])):c(fh)(c(a))?(m(),j(c(Nt),{key:4,"model-value":c(Z),value:!0,"unchecked-value":!1,type:"checkbox",name:c(l),as:"div",class:"flex flex-col field-gap"},{default:$(({field:Qe,errors:ze})=>[g("div",_3,[g("div",y3,[g("label",{for:c(l),class:"cui-label-switch"},de(c(a).title),9,b3),y(w,{severity:"secondary",variant:"simple",size:"small",class:"cui-input-switch-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1}),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:c(l),class:"cui-input-switch-error"},null,8,["name"])]),_:1})]),y(J,et({"model-value":c(Z)},Qe,{invalid:ze.length>0,loading:c(d),class:"ml-auto shrink-0",onValueChange:E[6]||(E[6]=ve=>Z.value=ve)}),null,16,["model-value","invalid","loading"])])]),_:1},8,["model-value","name"])):c(xa)(c(a))?(m(),j(c(Nt),{key:5,"model-value":c(Z),name:c(l),as:"div",class:"flex flex-col field-gap"},{default:$(({field:Qe,errors:ze})=>[g("label",{for:c(l),class:"cui-label"},de(c(a).title),9,w3),y(R,null,{default:$(()=>[c(a).multiple?(m(),j(oe,et({key:1},Qe,{"model-value":c(Z),options:c(a).enum,invalid:ze.length>0,disabled:c(a).readonly,placeholder:c(a).placeholder,"show-clear":!c(a).required&&!c(a).readonly,"show-toggle-all":!1,"max-selected-labels":3,loading:c(d),onValueChange:E[8]||(E[8]=ve=>Z.value=ve)}),null,16,["model-value","options","invalid","disabled","placeholder","show-clear","loading"])):(m(),j(q,et({key:0},Qe,{"model-value":c(Z),options:c(a).enum,invalid:ze.length>0,disabled:c(a).readonly,placeholder:c(a).placeholder,loading:c(d),onValueChange:E[7]||(E[7]=ve=>Z.value=ve)}),null,16,["model-value","options","invalid","disabled","placeholder","loading"])),c(u)?(m(),j(K,{key:2},{default:$(()=>[y(B,{text:"",rounded:"",severity:"danger",loading:c(d),onClick:E[9]||(E[9]=ve=>se(c(u).key,c(u).index))},{icon:$(()=>[y(M)]),_:1},8,["loading"])]),_:1})):ae("",!0)]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:c(l),class:"cui-input-error"},null,8,["name"])]),_:1}),!ze.length&&c(a).description?(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1})):ae("",!0)]),_:1},8,["model-value","name"])):c(Ur)(c(a))?(m(),A(yt,{key:6},[y(B,{fluid:"",class:"mt-3 mb-1 cui-button-medium",severity:c(a).color??"secondary",loading:c(d),label:c(a).title,onClick:E[10]||(E[10]=cr(Qe=>n("onAction",{key:c(l)}),["prevent"]))},null,8,["severity","loading","label"]),c(a).description?(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1})):ae("",!0)],64)):c(Vr)(c(a))?(m(),A(yt,{key:7},[y(B,{fluid:"",class:"mt-3 mb-1 cui-button-medium",severity:c(a).color??"secondary",loading:c(d),label:c(a).title,onClick:E[11]||(E[11]=cr(Qe=>n("onSubmit",{key:c(a).key}),["prevent"]))},null,8,["severity","loading","label"]),c(a).description?(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(c(a).description),1)]),_:1})):ae("",!0)],64)):c(gh)(c(a))&&c(a).items?(m(),j(ht,{key:8,class:"cui-card border-color-inner",pt:{body:{class:"p-1"}}},{content:$(()=>[(m(),j(He,{key:c(v),value:c(f),"onUpdate:value":E[18]||(E[18]=Qe=>ps(f)?f.value=Qe:null),multiple:""},{default:$(()=>[y(Te,{value:c(l)??"0",class:"border-none"},{default:$(()=>[y(Ce,null,{default:$(()=>[g("div",x3,[c(a).description?$t((m(),j(ue,{key:0,class:"text-muted"},null,512)),[[At,{value:c(a).description}]]):ae("",!0),g("span",S3,de(c(a).title||c(l)),1),c(u)?(m(),j(B,{key:1,text:"",rounded:"",severity:"danger",class:"cui-icon-md ml-auto mr-2",loading:c(d),onClick:E[12]||(E[12]=Qe=>se(c(u).key,c(u).index))},{icon:$(()=>[y(M,{width:"100%",height:"100%"})]),_:1},8,["loading"])):ae("",!0)])]),_:1}),y(Y,null,{default:$(()=>[g("div",C3,[(m(!0),A(yt,null,Dt(z(r.value,c(l)),(Qe,ze)=>(m(),j(F,{key:`item-${ze}`,modelValue:r.value,"onUpdate:modelValue":E[13]||(E[13]=ve=>r.value=ve),"schema-field":c(a).items,"config-key":`${c(l)}[${ze}]`,"array-item":{key:c(l),index:ze},loading:c(d),onOnAction:E[14]||(E[14]=ve=>n("onAction",ve)),onOnSubmit:E[15]||(E[15]=ve=>n("onSubmit",ve)),onOnTrigger:E[16]||(E[16]=()=>v.value++)},null,8,["modelValue","schema-field","config-key","array-item","loading"]))),128)),g("div",k3,[y(B,{text:"",rounded:"",class:"cui-icon-md",loading:c(d),onClick:E[17]||(E[17]=cr(Qe=>L(c(l)),["prevent"]))},{icon:$(()=>[y(D,{width:"100%",height:"100%"})]),_:1},8,["loading"])])])]),_:1})]),_:1},8,["value"])]),_:1},8,["value"]))]),_:1})):ae("",!0)])}}}),A3={key:0,class:"flex flex-col gap-6"},M3={key:1,class:"flex flex-col gap-6"},wp=Et({__name:"CuiSchema",props:{schemaForm:{},loading:{type:Boolean,default:!1},disableButton:{type:Boolean},saveButton:{type:Boolean,default:!0},saveButtonLabel:{},saveButtonColor:{},showButton:{type:Boolean,default:!1}},emits:["onSubmit","onAction","onFormSubmit","changeGroup"],setup(s,{expose:e,emit:t}){const n=t,r=s,{schemaForm:i,loading:o,saveButton:a,saveButtonLabel:l,showButton:u,disableButton:d,saveButtonColor:h}=Yt(r),v=Vt("formRef"),f=ce(""),b=ce(!1),k=ce({});Ke([i,v],([])=>{v.value&&(!By(v.value.values,i.value.schema)||b.value)&&(k.value=v.value.values),i.value.config&&Object.keys(i.value.config).length?k.value=Si(i.value.config):k.value=zy(i.value.schema)},{immediate:!0,deep:!0});const z=te(()=>{const R=Qy(i.value.schema);return Gn(R)}),L=te(()=>{const R=[];return i.value.schema.forEach(w=>{w.group&&!w.hidden&&!R.includes(w.group)&&R.push(w.group)}),R.length&&!f.value&&(f.value=R[0]),R}),se=te(()=>Uy(i.value.schema,f.value)),Z=te(()=>Vy(i.value.schema,f.value));Ke(f,R=>{R&&n("changeGroup",R)});const N=R=>i.value.schema.filter(w=>(w.group===R||!w.group&&R===L.value[0])&&!w.hidden),E=R=>{const w=or(R)&&R.format==="qrCode",H=or(R)&&R.format==="image",J=Ur(R)||Vr(R);return!w&&!H&&!J},O=R=>!R.hidden||R.hidden&&E(R),U=async()=>{var R;return await((R=v.value)==null?void 0:R.validate())},S=R=>{n("onAction",R)},M=async R=>{const w=await U();w!=null&&w.valid&&(w!=null&&w.values)?(b.value=!1,n("onSubmit",{key:R.key,payload:w.values})):(b.value=!0,console.error("result",w))},B=async()=>{const R=await U();R!=null&&R.valid&&(R!=null&&R.values)?(b.value=!1,n("onFormSubmit",R.values)):(b.value=!0,console.error("Form validation failed:",R))};return e({reset:()=>{var R;(R=v.value)==null||R.resetForm()}}),(R,w)=>{const H=gp,J=pp,q=E3,oe=Bh,ue=Dh,Ce=qh,F=ws;return m(),A("div",null,[y(c(al),{ref_key:"formRef",ref:v,"validation-schema":c(z),onSubmit:B},{default:$(()=>[c(L).length?(m(),A("div",A3,[y(J,{modelValue:c(f),"onUpdate:modelValue":w[0]||(w[0]=D=>ps(f)?f.value=D:null),mandatory:""},{default:$(()=>[(m(!0),A(yt,null,Dt(c(L),D=>(m(),j(H,{key:D,size:"small",value:D},{default:$(()=>[Qt(de(D),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),y(Ce,{value:c(f),"onUpdate:value":w[2]||(w[2]=D=>ps(f)?f.value=D:null),scrollable:"",class:"w-full h-full"},{default:$(()=>[y(ue,{class:"p-0"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(L),(D,Y)=>(m(),j(oe,{key:Y,value:D,"as-child":""},{default:$(Te=>[$t(g("div",et({class:Te.class},{ref_for:!0},Te.a11yAttrs,{class:"flex flex-col gap-6"}),[(m(!0),A(yt,null,Dt(N(D),He=>(m(),A(yt,{key:He.key},[O(He)&&(He.group===D||!He.group&&Y===0)?$t((m(),j(q,{key:0,modelValue:c(k),"onUpdate:modelValue":w[1]||(w[1]=ht=>ps(k)?k.value=ht:null),"schema-field":He,"config-key":He.key,loading:c(o),onOnAction:S,onOnSubmit:M},null,8,["modelValue","schema-field","config-key","loading"])),[[Tr,!He.hidden]]):ae("",!0)],64))),128))],16),[[Tr,Te.active]])]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["value"])])):(m(),A("div",M3,[(m(!0),A(yt,null,Dt(c(i).schema,D=>(m(),A(yt,{key:D.key},[O(D)?$t((m(),j(q,{key:0,modelValue:c(k),"onUpdate:modelValue":w[3]||(w[3]=Y=>ps(k)?k.value=Y:null),"schema-field":D,"config-key":D.key,loading:c(o),onOnAction:S,onOnSubmit:M},null,8,["modelValue","schema-field","config-key","loading"])),[[Tr,!D.hidden]]):ae("",!0)],64))),128))])),!c(se)&&c(Z)&&c(a)||c(u)?(m(),j(F,{key:2,fluid:"",class:"mt-7 cui-button-medium",severity:c(h),type:"submit",loading:c(o),disabled:c(d),label:c(l)||R.$t("components.form.button.save")},null,8,["severity","loading","disabled","label"])):ae("",!0)]),_:1},8,["validation-schema"])])}}}),$3=Et({__name:"PluginSchema",props:{schemaConfig:{},pluginName:{},cameraName:{},buttonKey:{}},setup(s,{expose:e}){const t=new yp,n=new Wn,r=Cn(),{t:i}=js(),o=pi("dialogRef"),a=pi("dialogRefProps"),l=s,{schemaConfig:u,pluginName:d,cameraName:h,buttonKey:v}=Yt(l),f=ce({schema:[],config:{}}),{mutate:b,isPending:k}=t.submitPluginConfigQuery(),{mutateAsync:z,isPending:L}=t.setPluginConfigQuery(),{mutate:se,isPending:Z}=n.submitCameraExtensionConfigQuery(),{mutateAsync:N,isPending:E}=n.setCameraExtensionConfigQuery(),O=te(()=>{var M;return!!((M=a.loading)!=null&&M.value||k.value||L.value||Z.value||E.value)});Ke(u,M=>{f.value=M},{deep:!0,immediate:!0});const U=async M=>{h.value?await N({cameraname:h.value,pluginname:d.value,configData:{key:M.key}}):await z({pluginname:d.value,configData:{key:M.key}})},S=async M=>{console.log("onFormSubmit",M);const B={...u.value.config,...M};console.log("onFormSubmit payload",B);const K=R=>{if(R!=null&&R.toast){const w=Hm(R.toast.type);r.add({severity:w,summary:i(`components.toast.title_${w}`),detail:R.toast.message,life:3e3})}R!=null&&R.schema&&Object.keys(R.schema).length&&f.value?f.value.schema=R.schema:o.value.close()};h.value?se({cameraname:h.value,pluginname:d.value,configData:{key:v.value,payload:B}},{onSuccess:K}):b({pluginname:d.value,configData:{key:v.value,payload:B}},{onSuccess:K})};return e({isLoading:O}),(M,B)=>{const K=wp;return m(),j(K,{"schema-form":c(f),loading:c(O),"show-button":"",onOnAction:U,onOnFormSubmit:S},null,8,["schema-form","loading"])}}}),T3={class:"p-4 flex flex-col gap-2"},P3={class:"cui-label"},R3={key:0,class:"flex flex-col gap-2"},I3={class:"cui-label"},O3={key:6,class:"text-sm text-muted text-center min-h-[30px]"},N3={class:"cui-label"},F3={key:7,class:"w-full flex items-center justify-center my-5"},L3={key:1,class:"text-sm text-muted text-center"},j3={key:1,class:"flex flex-col gap-2"},q3={class:"cui-label"},D3={key:0,class:"w-full flex items-center justify-center"},B3={key:1,class:"text-sm text-muted text-center"},z3={key:1,class:"w-full h-full"},U3={class:"cui-list-item"},V3=Et({__name:"Plugins",props:{camera:{},cameraDevice:{},loading:{type:Boolean},latestSnapshotSrc:{}},emits:["close"],setup(s,{emit:e}){const t=new Wn,n=new yp,r=Cn(),i=Nl(),{t:o}=js(),a=s,{camera:l,loading:u}=Yt(a),d=Vt("schemaRef"),h=ce("hub"),v=ce(["hub","motionDetection","objectDetection","audioDetection","ptz","more"]),f=ce(""),b=ce(),k=ce(),z=ce(),L=ce(),se=ce(),Z=ce(),N=ce(!0);t.toggleQueryActivator("getCameraExtensionConfigQuery",!1);const{data:E}=n.getPluginsQuery({page:1,pageSize:-1}),{data:O,isFetching:U,suspense:S}=t.getCameraExtensionsQuery(l.value.name),{data:M,isFetching:B}=t.getCameraExtensionConfigQuery(l.value.name,f,N),{data:K,isFetching:R}=n.getPluginsExtensionsQuery({page:1,pageSize:-1}),{mutate:w,isPending:H}=t.submitCameraExtensionConfigQuery(),{mutateAsync:J,isPending:q}=t.patchCameraExtensionConfigQuery(),{mutateAsync:oe,isPending:ue}=t.setCameraExtensionConfigQuery(),{mutateAsync:Ce,isPending:F}=t.addCameraExtensionQuery(),{mutateAsync:D,isPending:Y}=t.removeCameraExtensionQuery(),{mutateAsync:Te,isPending:He}=t.enableCameraExtensionQuery(),{mutateAsync:ht,isPending:At}=t.disableCameraExtensionQuery(),Qe=te(()=>U.value||R.value||F.value||Y.value||He.value||At.value),ze=te(()=>Qe.value||u.value||H.value||q.value||ue.value),ve=te(()=>{const me=h.value==="cameraController"&&ft.value,ie=h.value==="hub"&&Xt.value.length,he=h.value==="motionDetection"&&wt.value.length,Le=h.value==="audioDetection"&&zt.value.length,st=h.value==="objectDetection"&&it.value.length,Zt=h.value==="ptz"&&es.value.length;return!ie&&!he&&!Le&&!st&&!Zt&&!me}),ft=te(()=>{var ie;const me=((ie=K.value)==null?void 0:ie.result.filter(he=>{var Le;return he.type.includes("cameraController")&&he.pluginName===((Le=l.value.pluginInfo)==null?void 0:Le.name)}))||[];return me.length&&E.value&&E.value.result.some(he=>he.pluginName===me[0].pluginName&&Ue(he.pluginName))?(b.value=me[0].pluginName,f.value=me[0].pluginName):b.value=void 0,me[0]}),Xt=te(()=>{var ie;const me=((ie=O.value)==null?void 0:ie.filter(he=>he.type.includes("hub")))||[];return me.length&&E.value&&E.value.result.some(he=>he.pluginName===me[0].pluginName&&Ue(he.pluginName))?(k.value=me[0].pluginName,f.value=me[0].pluginName):k.value=void 0,V(me)}),wt=te(()=>{var ie,he;const me=((ie=O.value)==null?void 0:ie.filter(Le=>Le.type.includes("motionDetection")))||[];return me.length&&Ue(l.value.extensions.motionDetection)?z.value=(he=l.value.extensions.motionDetection)==null?void 0:he.name:z.value=void 0,V(me)}),zt=te(()=>{var ie,he;const me=((ie=O.value)==null?void 0:ie.filter(Le=>Le.type.includes("audioDetection")))||[];return me.length&&Ue(l.value.extensions.audioDetection)?L.value=(he=l.value.extensions.audioDetection)==null?void 0:he.name:L.value=void 0,V(me)}),it=te(()=>{var ie,he;const me=((ie=O.value)==null?void 0:ie.filter(Le=>Le.type.includes("objectDetection")))||[];return me.length&&Ue(l.value.extensions.objectDetection)?se.value=(he=l.value.extensions.objectDetection)==null?void 0:he.name:se.value=void 0,V(me)}),es=te(()=>{var ie,he;const me=((ie=O.value)==null?void 0:ie.filter(Le=>Le.type.includes("ptz")))||[];return me.length&&Ue(l.value.extensions.ptz)?Z.value=(he=l.value.extensions.ptz)==null?void 0:he.name:Z.value=void 0,V(me)}),Be=te(()=>{var he,Le;const me=((he=E.value)==null?void 0:he.result)||[];return(((Le=K.value)==null?void 0:Le.result)||[]).filter(st=>{const Zt=me.find(Gt=>Gt.pluginName===st.pluginName);return((Zt==null?void 0:Zt["camera.ui"].extensions)??[]).filter(Gt=>Gt!=="cameraController").length>0})});Ke(b,(me,ie)=>{me&&me!==ie&&X()}),Ke(k,(me,ie)=>{me&&me!==ie&&X(me)}),Ke(z,(me,ie)=>{me!==ie&&(!me&&ie?ye(ie,!1,"motionDetection"):me&&ye(me,!0,"motionDetection"))}),Ke(se,(me,ie)=>{me!==ie&&(!me&&ie?ye(ie,!1,"objectDetection"):me&&ye(me,!0,"objectDetection"))}),Ke(Z,(me,ie)=>{me!==ie&&(!me&&ie?ye(ie,!1,"ptz"):me&&ye(me,!0,"ptz"))}),Ke(L,(me,ie)=>{me!==ie&&(!me&&ie?ye(ie,!1,"audioDetection"):me&&ye(me,!0,"audioDetection"))});const Ue=me=>{const ie=typeof me=="string"?me:me==null?void 0:me.name;if(ie&&E.value&&E.value.result.some(he=>he.pluginName===ie&&!he.disabled))return ie},V=me=>me.sort((ie,he)=>!Ue(ie.pluginName)&&Ue(he.pluginName)?1:Ue(ie.pluginName)&&!Ue(he.pluginName)?-1:ie.displayName.localeCompare(he.displayName)),X=me=>{var ie,he;if(t.toggleQueryActivator("getCameraExtensionConfigQuery",!1),me!==void 0)f.value=me;else switch(h.value){case"hub":f.value=Ue((ie=Xt.value[0])==null?void 0:ie.pluginName)||"";break;case"motionDetection":f.value=Ue(l.value.extensions.motionDetection)||"";break;case"audioDetection":f.value=Ue(l.value.extensions.audioDetection)||"";break;case"objectDetection":f.value=Ue(l.value.extensions.objectDetection)||"";break;case"ptz":f.value=Ue(l.value.extensions.ptz)||"";break;case"cameraController":f.value=Ue((he=ft.value)==null?void 0:he.pluginName)||"";break;default:f.value="";break}f.value&&f.value!==""&&t.toggleQueryActivator("getCameraExtensionConfigQuery",!0)},_e=async me=>{var ie;if(O.value)if(O.value.some(he=>he.pluginName===me.pluginName)){for(const he of me.type)await D({cameraname:l.value.name,pluginname:me.pluginName,type:he});(ie=d.value)==null||ie.reset()}else for(const he of me.type)await Ce({cameraname:l.value.name,pluginname:me.pluginName,type:he})},ye=async(me,ie,he)=>{var st;const Le=he in l.value.extensions?l.value.extensions[he]:void 0;l.value&&(ie?(Le==null?void 0:Le.name)!==me&&(await Te({cameraname:l.value.name,pluginname:me,type:he}),Zs(()=>X(me))):(Le==null?void 0:Le.name)===me&&(await ht({cameraname:l.value.name,pluginname:me,type:he}),(st=d.value)==null||st.reset(),Zs(()=>X())))},fe=async(me,ie)=>{await oe({cameraname:l.value.name,pluginname:ie,configData:{key:me.key}})},vt=(me,ie)=>{w({cameraname:l.value.name,pluginname:ie,configData:{key:me.key,payload:me.payload}},{onSuccess:he=>{if(he!=null&&he.toast){const Le=Hm(he.toast.type);r.add({severity:Le,summary:o(`components.toast.title_${Le}`),detail:he.toast.message,life:3e3})}he!=null&&he.schema&&Object.keys(he.schema).length&&i.openComponentDialog($3,{data:{title:o("components.dialog.title.config"),hideConfirmButton:!0,contentProps:{schemaConfig:{schema:he.schema,config:me.payload},pluginName:ie,cameraName:l.value.name,buttonKey:me.key}}})}})},Tt=async(me,ie)=>{await J({cameraname:l.value.name,pluginname:me,configData:ie})};return sl(async()=>{l.value.pluginInfo&&(v.value.unshift("cameraController"),h.value="cameraController"),await S(),X()}),(me,ie)=>{var Cs,ns;const he=gp,Le=pp,st=Ea,Zt=jr,_s=fo,Gt=hp,ls=rw,$s=ws,hs=qr;return m(),A("div",T3,[g("span",P3,de(me.$t("components.camera_options.categories")),1),y(Le,{modelValue:c(h),"onUpdate:modelValue":[ie[0]||(ie[0]=I=>ps(h)?h.value=I:null),ie[1]||(ie[1]=I=>X())],disabled:c(Qe),mandatory:""},{default:$(()=>[(m(!0),A(yt,null,Dt(c(v),I=>(m(),j(he,{key:I,size:"small",disabled:c(ze),value:I},{default:$(()=>[Qt(de(me.$t(`components.camera_options.chip_${I}`)),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"]),y(st,{class:"m-0 py-3"}),c(h)!=="more"?(m(),A("div",R3,[g("span",I3,de(me.$t("components.camera_options.chip_plugins")),1),c(h)==="cameraController"&&c(ft)?(m(),j(Le,{key:0,modelValue:c(b),"onUpdate:modelValue":ie[2]||(ie[2]=I=>ps(b)?b.value=I:null),disabled:c(Qe),mandatory:"",class:"min-h-[30px]"},{default:$(()=>[(m(),j(he,{key:c(ft).pluginName,size:"small",disabled:!Ue(c(ft).pluginName)||c(ze),value:c(ft).pluginName},{default:$(()=>[Qt(de(c(ft).displayName),1)]),_:1},8,["disabled","value"]))]),_:1},8,["modelValue","disabled"])):ae("",!0),c(h)==="hub"&&c(Xt).length?(m(),j(Le,{key:1,modelValue:c(k),"onUpdate:modelValue":ie[3]||(ie[3]=I=>ps(k)?k.value=I:null),disabled:c(Qe),mandatory:"",class:"min-h-[30px]"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(Xt),I=>(m(),j(he,{key:I.pluginName,size:"small",disabled:!Ue(I.pluginName)||c(ze),value:I.pluginName},{default:$(()=>[Qt(de(I.displayName),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"])):ae("",!0),c(h)==="motionDetection"&&c(wt).length?(m(),j(Le,{key:2,modelValue:c(z),"onUpdate:modelValue":ie[4]||(ie[4]=I=>ps(z)?z.value=I:null),disabled:c(Qe),class:"min-h-[30px]"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(wt),I=>(m(),j(he,{key:I.pluginName,size:"small",filter:"",disabled:!Ue(I.pluginName)||c(ze),value:I.pluginName},{default:$(()=>[Qt(de(I.displayName),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"])):ae("",!0),c(h)==="objectDetection"&&c(it).length?(m(),j(Le,{key:3,modelValue:c(se),"onUpdate:modelValue":ie[5]||(ie[5]=I=>ps(se)?se.value=I:null),disabled:c(Qe),class:"min-h-[30px]"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(it),I=>(m(),j(he,{key:I.pluginName,size:"small",filter:"",disabled:!Ue(I.pluginName)||c(ze),value:I.pluginName},{default:$(()=>[Qt(de(I.displayName),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"])):ae("",!0),c(h)==="audioDetection"&&c(zt).length?(m(),j(Le,{key:4,modelValue:c(L),"onUpdate:modelValue":ie[6]||(ie[6]=I=>ps(L)?L.value=I:null),disabled:c(Qe),class:"min-h-[30px]"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(zt),I=>(m(),j(he,{key:I.pluginName,size:"small",filter:"",disabled:!Ue(I.pluginName)||c(ze),value:I.pluginName},{default:$(()=>[Qt(de(I.displayName),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"])):ae("",!0),c(h)==="ptz"&&c(es).length?(m(),j(Le,{key:5,modelValue:c(Z),"onUpdate:modelValue":ie[7]||(ie[7]=I=>ps(Z)?Z.value=I:null),disabled:c(Qe),class:"min-h-[30px]"},{default:$(()=>[(m(!0),A(yt,null,Dt(c(es),I=>(m(),j(he,{key:I.pluginName,size:"small",filter:"",disabled:!Ue(I.pluginName)||c(ze),value:I.pluginName},{default:$(()=>[Qt(de(I.displayName),1)]),_:2},1032,["disabled","value"]))),128))]),_:1},8,["modelValue","disabled"])):c(ve)?(m(),A("span",O3,de(me.$t("components.camera_options.no_plugins_enabled")),1)):ae("",!0),y(st,{class:"m-0 py-3"}),g("span",N3,de(me.$t("components.camera_options.plugin_settings")),1),c(B)||!c(f)||!c(M)||!((Cs=c(M))!=null&&Cs.schema)||((ns=c(M))==null?void 0:ns.schema.length)===0?(m(),A("div",F3,[c(B)?(m(),j(Zt,{key:0,class:"w-[30px] h-[30px]","stroke-width":"5"})):(m(),A("span",L3,de(me.$t("components.camera_options.no_config")),1))])):(m(),j(wp,{ref_key:"schemaRef",ref:d,key:c(f),"schema-form":{schema:c(M).schema,config:c(M).config},loading:c(ze),onOnFormSubmit:ie[8]||(ie[8]=I=>Tt(c(f),I)),onOnSubmit:ie[9]||(ie[9]=I=>vt(I,c(f))),onOnAction:ie[10]||(ie[10]=I=>fe(I,c(f)))},null,8,["schema-form","loading"]))])):c(h)==="more"?(m(),A("div",j3,[g("span",q3,de(me.$t("components.camera_options.manage_plugins")),1),c(R)||!c(Be).length?(m(),A("div",D3,[c(R)?(m(),j(Zt,{key:0,class:"w-[30px] h-[30px]","stroke-width":"5"})):(m(),A("span",B3,de(me.$t("components.camera_options.no_plugins_found")),1))])):(m(),A("div",z3,[(m(!0),A(yt,null,Dt(c(Be),I=>$t((m(),A("div",{key:I.pluginName,class:"cui-list-item"},[y(Gt,{disabled:c(Qe)||!Ue(I.pluginName),class:"h-14",onClick:ne=>me.$router.push(`/plugins/${I.pluginName}`)},{append:$(()=>{var ne;return[y(_s,{"model-value":(ne=c(O))==null?void 0:ne.some(ge=>ge.pluginName===I.pluginName),disabled:c(Qe)||!Ue(I.pluginName),"onUpdate:modelValue":ge=>_e(I)},null,8,["model-value","disabled","onUpdate:modelValue"])]}),default:$(()=>[g("span",null,de(I.displayName),1)]),_:2},1032,["disabled","onClick"])])),[[hs,{value:Ue(I.pluginName)===void 0?me.$t("components.form.tooltip.disabled"):""},void 0,{top:!0}]])),128))])),g("div",U3,[y(Gt,{class:"h-14",onClick:ie[11]||(ie[11]=I=>me.$router.push("/plugins"))},{append:$(()=>[y($s,{text:"",rounded:"",severity:"secondary",class:"cui-icon-md"},{icon:$(()=>[y(ls,{width:"100%",height:"100%"})]),_:1})]),default:$(()=>[g("span",null,de(me.$t("components.camera_options.more_plugins")),1)]),_:1})])])):ae("",!0)])}}}),H3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Q3(s,e){return m(),A("svg",H3,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H5V5h14zm-2-2H7V7h10z"},null,-1)]))}const K3=pe({name:"mdi-checkbox-intermediate",render:Q3}),Z3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function G3(s,e){return m(),A("svg",Z3,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M3.14 1A2.14 2.14 0 0 0 1 3.14V5h2V3h2V1zM7 1v2h3V1zm5 0v2h2v2h2V3.14C16 1.96 15.04 1 13.86 1zM1 7v3h2V7zm8 0c-1.11 0-2 .89-2 2v7h6.86A2.14 2.14 0 0 0 16 13.86V7zm9 0v2h2v2h2V9c0-1.11-.89-2-2-2zM9 9h5v5H9zm-8 3v1.86C1 15.04 1.96 16 3.14 16H5v-2H3v-2zm19 1v3h2v-3zM7 18v2c0 1.11.89 2 2 2h2v-2H9v-2zm13 0v2h-2v2h2c1.11 0 2-.89 2-2v-2zm-7 2v2h3v-2z"},null,-1)]))}const W3=pe({name:"mdi-vector-intersection",render:G3}),J3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Y3(s,e){return m(),A("svg",J3,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M4 6v13h16V6zm14 11H6V8h12z"},null,-1)]))}const X3=pe({name:"mdi-rectangle-outline",render:Y3}),e4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function t4(s,e){return m(),A("svg",e4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M4 6v13h16V6z"},null,-1)]))}const s4=pe({name:"mdi-rectangle",render:t4}),n4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function r4(s,e){return m(),A("svg",n4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m6.03 12.03l2 3.47l-2.53 3.18L2 12.62zM17 18v-2.71c.88-.39 1.5-1.26 1.5-2.29c0-.57-.2-1.1-.53-1.5l1.97-1.15c1.01-.59 1.36-1.88.77-2.89l-1.38-2.4a2.125 2.125 0 0 0-2.89-.78L8.31 9c-.95.53-1.28 1.75-.73 2.71l1.5 2.6c.55.95 1.78 1.28 2.73.73l1.88-1.08c.25.59.72 1.07 1.31 1.33V18c0 1.1.9 2 2 2h5v-2z"},null,-1)]))}const i4=pe({name:"mdi-cctv",render:r4}),o4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function a4(s,e){return m(),A("svg",o4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M20.84 22.73L18.11 20H17c-1.1 0-2-.9-2-2v-1.11l-2.34-2.34l-.85.49c-.95.55-2.18.22-2.73-.73l-1.5-2.6c-.4-.71-.33-1.53.1-2.14L1.11 3l1.28-1.27l19.72 19.73zM18.5 13c0-.57-.2-1.1-.53-1.5l1.97-1.15c1.01-.59 1.36-1.88.77-2.89l-1.38-2.4a2.125 2.125 0 0 0-2.89-.78l-5.67 3.29l7.09 7.09c.4-.44.64-1.02.64-1.66M2 12.62l3.5 6.06l2.53-3.18l-2-3.47z"},null,-1)]))}const c4=pe({name:"mdi-cctv-off",render:a4}),l4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function u4(s,e){return m(),A("svg",l4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2m0 2c-1.9 0-3.6.6-4.9 1.7l11.2 11.2c1-1.4 1.7-3.1 1.7-4.9c0-4.4-3.6-8-8-8m4.9 14.3L5.7 7.1C4.6 8.4 4 10.1 4 12c0 4.4 3.6 8 8 8c1.9 0 3.6-.6 4.9-1.7"},null,-1)]))}const d4=pe({name:"mdi-cancel",render:u4}),h4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function m4(s,e){return m(),A("svg",h4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"},null,-1)]))}const p4=pe({name:"mdi-undo",render:m4}),f4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function g4(s,e){return m(),A("svg",f4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zm0 5h2v9H9zm4 0h2v9h-2z"},null,-1)]))}const v4=pe({name:"mdi-trash-can",render:g4}),_4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function y4(s,e){return m(),A("svg",_4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75z"},null,-1)]))}const b4=pe({name:"mdi-pencil",render:y4}),w4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x4(s,e){return m(),A("svg",w4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"},null,-1)]))}const S4=pe({name:"mdi-plus",render:x4}),C4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function k4(s,e){return m(),A("svg",C4,e[0]||(e[0]=[g("g",{fill:"none"},[g("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M13 4a1 1 0 1 0-2 0v17a1 1 0 1 0 2 0zM7 4h3v5H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m-2 6h5v5H5a2 2 0 0 1-2-2v-1a2 2 0 0 1 2-2m9 0v5h2a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2zm-6 6h2v5H8a2 2 0 0 1-2-2v-1a2 2 0 0 1 2-2m6 0v5h5a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2zm0-12v5h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"})],-1)]))}const E4=pe({name:"mingcute-timeline-fill",render:k4}),A4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function M4(s,e){return m(),A("svg",A4,e[0]||(e[0]=[g("g",{fill:"none"},[g("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M13 4a1 1 0 1 0-2 0v17a1 1 0 1 0 2 0zM7 4h3v2H7v1h3v2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m11 3h-4v2h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4v2h4zm-8 3H5a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h5v-2H5v-1h5zm4 0v2h2v1h-2v2h2a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2zm-4 6H8a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h2v-2H8v-1h2zm4 0v2h5v1h-5v2h5a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2z"})],-1)]))}const $4=pe({name:"mingcute-timeline-line",render:M4}),T4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function P4(s,e){return m(),A("svg",T4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9 11.5A2.5 2.5 0 0 0 11.5 9A2.5 2.5 0 0 0 9 6.5A2.5 2.5 0 0 0 6.5 9A2.5 2.5 0 0 0 9 11.5M9 2c3.86 0 7 3.13 7 7c0 5.25-7 13-7 13S2 14.25 2 9a7 7 0 0 1 7-7m6 15h3v-3h2v3h3v2h-3v3h-2v-3h-3z"},null,-1)]))}const R4=pe({name:"mdi-map-marker-add",render:P4}),I4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function O4(s,e){return m(),A("svg",I4,e[0]||(e[0]=[g("g",{fill:"none"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M19.26 16.877c.413.402.74.932.74 1.596c0 .753-.426 1.339-.9 1.745c-.48.408-1.114.731-1.81.983c-1.402.505-3.272.799-5.29.799s-3.888-.294-5.29-.8c-.696-.25-1.33-.574-1.809-.982c-.475-.406-.901-.992-.901-1.745c0-.663.327-1.194.74-1.596A9.97 9.97 0 0 0 12 20c2.859 0 5.438-1.2 7.26-3.123M12 2a8 8 0 1 1 0 16a8 8 0 0 1 0-16m0 4a4 4 0 1 0 0 8a4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4a2 2 0 0 1 0-4"})],-1)]))}const xp=pe({name:"mingcute-computer-camera-fill",render:O4}),N4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function F4(s,e){return m(),A("svg",N4,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M6.593 16.744a1 1 0 0 1-.246 1.393a1.3 1.3 0 0 0-.319.294l-.024.042l.035.058c.03.04.078.095.16.165c.23.196.62.417 1.19.623C8.523 19.728 10.153 20 12 20c1.848 0 3.478-.272 4.61-.68c.57-.207.961-.428 1.19-.624a1 1 0 0 0 .16-.165l.036-.058l-.024-.04a1.2 1.2 0 0 0-.314-.293a1 1 0 1 1 1.151-1.635c.598.421 1.191 1.074 1.191 1.968c0 .753-.426 1.339-.9 1.744c-.48.41-1.114.732-1.81.984c-1.402.505-3.272.799-5.29.799s-3.888-.294-5.29-.8c-.696-.25-1.33-.574-1.809-.983c-.475-.405-.901-.99-.901-1.744c0-.898.598-1.553 1.2-1.975a1 1 0 0 1 1.393.246M12 2a8 8 0 1 1 0 16a8 8 0 0 1 0-16m0 2a6 6 0 1 0 0 12a6 6 0 0 0 0-12m0 2a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4"})],-1)]))}const L4=pe({name:"mingcute-computer-camera-line",render:F4}),j4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function q4(s,e){return m(),A("svg",j4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M2 6V4q0-.825.588-1.412T4 2h2q.425 0 .713.288T7 3t-.288.713T6 4H4v2q0 .425-.288.713T3 7t-.712-.288T2 6m2 16q-.825 0-1.412-.587T2 20v-2q0-.425.288-.712T3 17t.713.288T4 18v2h2q.425 0 .713.288T7 21t-.288.713T6 22zm16 0h-2q-.425 0-.712-.288T17 21t.288-.712T18 20h2v-2q0-.425.288-.712T21 17t.713.288T22 18v2q0 .825-.587 1.413T20 22m0-16V4h-2q-.425 0-.712-.288T17 3t.288-.712T18 2h2q.825 0 1.413.588T22 4v2q0 .425-.288.713T21 7t-.712-.288T20 6m-6.5 3.5q-.825 0-1.412-.587T11.5 7.5t.588-1.412T13.5 5.5t1.413.588T15.5 7.5t-.587 1.413T13.5 9.5m-.7 8.5h-4l1-5.1l-1.8.7V16q0 .425-.288.712T7 17t-.712-.288T6 16v-3.05q0-.3.163-.537t.437-.363l3.35-1.45q.875-.375 1.288-.487T12 10q.525 0 .975.275T13.7 11l1 1.6q.525.85 1.363 1.475T18 14.9q.425.075.713.375T19 16t-.288.7t-.687.225q-1.35-.2-2.525-.837t-2-1.588z"},null,-1)]))}const D4=pe({name:"material-symbols-detection-and-zone-rounded",render:q4}),B4={viewBox:"0 0 640 512",width:"1.5em",height:"1.2em"};function z4(s,e){return m(),A("svg",B4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M32 119.4C12.9 108.4 0 87.7 0 64C0 28.7 28.7 0 64 0c23.7 0 44.4 12.9 55.4 32h209.1C339.6 12.9 360.3 0 384 0c35.3 0 64 28.7 64 64c0 23.7-12.9 44.4-32 55.4v113.1c19.1 11.1 32 31.7 32 55.4c0 35.3-28.7 64-64 64c-23.7 0-44.4-12.9-55.4-32H119.5c-11.1 19.1-31.7 32-55.4 32c-35.3 0-64-28.7-64-64c0-23.7 12.9-44.4 32-55.4V119.4zM119.4 96c-5.6 9.7-13.7 17.8-23.4 23.4v113.1c9.7 5.6 17.8 13.7 23.4 23.4h209.1c5.6-9.7 13.7-17.8 23.4-23.4V119.4c-9.7-5.6-17.8-13.7-23.4-23.4zm192 384c-11.1 19.1-31.7 32-55.4 32c-35.3 0-64-28.7-64-64c0-23.7 12.9-44.4 32-55.4V352h64v40.6c9.7 5.6 17.8 13.7 23.4 23.4h209.1c5.6-9.7 13.7-17.8 23.4-23.4V279.5c-9.7-5.6-17.8-13.7-23.4-23.4h-46c-5.4-15.4-14.6-28.9-26.5-39.6v-24.4h72.6c11.1-19.1 31.7-32 55.4-32c35.3 0 64 28.7 64 64c0 23.7-12.9 44.4-32 55.4v113.1c19.1 11.1 32 31.7 32 55.4c0 35.3-28.7 64-64 64c-23.7 0-44.4-12.9-55.4-32H311.5z"},null,-1)]))}const U4=pe({name:"fa6-solid-object-ungroup",render:z4}),V4={viewBox:"0 0 640 512",width:"1.5em",height:"1.2em"};function H4(s,e){return m(),A("svg",V4,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M48.2 66.8c-.1-.8-.2-1.7-.2-2.5v-.2c0-8.8 7.2-16 16-16c.9 0 1.9.1 2.8.2C74.3 49.5 80 56.1 80 64c0 8.8-7.2 16-16 16c-7.9 0-14.5-5.7-15.8-13.2M0 64c0 26.9 16.5 49.9 40 59.3v105.3C16.5 238.1 0 261.1 0 288c0 35.3 28.7 64 64 64c26.9 0 49.9-16.5 59.3-40h201.3c9.5 23.5 32.5 40 59.3 40c35.3 0 64-28.7 64-64c0-26.9-16.5-49.9-40-59.3V123.4c23.5-9.5 40-32.5 40-59.3c0-35.3-28.7-64-64-64c-26.9 0-49.9 16.5-59.3 40L123.3 40C113.9 16.5 90.9 0 64 0C28.7 0 0 28.7 0 64m368 0a16 16 0 1 1 32 0a16 16 0 1 1-32 0m-43.3 24c6.5 16 19.3 28.9 35.3 35.3v105.3c-16 6.5-28.9 19.3-35.3 35.3H123.4c-6.5-16-19.3-28.9-35.3-35.3V123.3c16-6.5 28.9-19.3 35.3-35.3zM384 272a16 16 0 1 1 0 32a16 16 0 1 1 0-32M80 288c0 7.9-5.7 14.5-13.2 15.8c-.8.1-1.7.2-2.5.2h-.2c-8.8 0-16-7.2-16-16c0-.9.1-1.9.2-2.8c1.2-7.5 7.8-13.2 15.7-13.2c8.8 0 16 7.2 16 16m391.3-40h45.4c6.5 16 19.3 28.9 35.3 35.3v105.3c-16 6.5-28.9 19.3-35.3 35.3H315.4c-6.5-16-19.3-28.9-35.3-35.3v-36.7h-48v36.7c-23.5 9.5-40 32.5-40 59.3c0 35.3 28.7 64 64 64c26.9 0 49.9-16.5 59.3-40h201.3c9.5 23.5 32.5 40 59.3 40c35.3 0 64-28.7 64-64c0-26.9-16.5-49.9-40-59.3V283.3c23.5-9.5 40-32.5 40-59.3c0-35.3-28.7-64-64-64c-26.9 0-49.9 16.5-59.3 40H448v16.4c9.8 8.8 17.8 19.5 23.3 31.6m88.9-26.7a16 16 0 1 1 31.5 5.5a16 16 0 1 1-31.5-5.5M271.8 450.7a16 16 0 1 1-31.5-5.5a16 16 0 1 1 31.5 5.5m307-18.5a16 16 0 1 1-5.5 31.5a16 16 0 1 1 5.5-31.5"},null,-1)]))}const Q4=pe({name:"fa6-regular-object-ungroup",render:H4}),K4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Z4(s,e){return m(),A("svg",K4,e[0]||(e[0]=[g("g",{fill:"none",stroke:"currentColor","stroke-width":"1.5"},[g("path",{d:"M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2s7.071 0 8.535 1.464C22 4.93 22 7.286 22 12s0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z"}),g("circle",{cx:"12",cy:"12",r:"4"})],-1)]))}const G4=pe({name:"solar-camera-square-linear",render:Z4}),W4={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J4(s,e){return m(),A("svg",W4,e[0]||(e[0]=[g("path",{fill:"currentColor","fill-rule":"evenodd",d:"M15.75 6a3.75 3.75 0 1 0-7.5 0a3.75 3.75 0 0 0 7.5 0M12 3.75a2.25 2.25 0 1 1 0 4.5a2.25 2.25 0 0 1 0-4.5M9.25 18a3.75 3.75 0 1 0-7.5 0a3.75 3.75 0 0 0 7.5 0M5.5 15.75a2.25 2.25 0 1 1 0 4.5a2.25 2.25 0 0 1 0-4.5m13-1.5a3.75 3.75 0 1 1 0 7.5a3.75 3.75 0 0 1 0-7.5M20.75 18a2.25 2.25 0 1 0-4.5 0a2.25 2.25 0 0 0 4.5 0","clip-rule":"evenodd"},null,-1),g("path",{fill:"currentColor",d:"M7.205 7.562a.75.75 0 0 0-.993-1.124A8.73 8.73 0 0 0 3.25 13a.75.75 0 0 0 1.5 0a7.23 7.23 0 0 1 2.455-5.438m10.583-1.124a.75.75 0 0 0-.993 1.124A7.23 7.23 0 0 1 19.25 13a.75.75 0 0 0 1.5 0a8.73 8.73 0 0 0-2.962-6.562m-7.601 13.584a.75.75 0 1 0-.374 1.452a8.8 8.8 0 0 0 4.374 0a.75.75 0 1 0-.374-1.452A7.3 7.3 0 0 1 12 20.25a7.3 7.3 0 0 1-1.813-.228"},null,-1)]))}const Y4=pe({name:"solar-share-circle-outline",render:J4}),jl=Et({__name:"CuiSnapshot",props:{cameraName:{},src:{},loading:{type:Boolean},showLoadingScreen:{type:Boolean,default:!0},width:{default:"100%"},height:{default:"100%"},imageWidth:{},imageHeight:{},imageContainerClass:{},imageContainerStyle:{}},setup(s,{expose:e}){const t=new Wn,n=s,{cameraName:r,loading:i,src:o,width:a,height:l,imageHeight:u,imageWidth:d,imageContainerClass:h,imageContainerStyle:v,showLoadingScreen:f}=Yt(n),b=ce(!1);o.value&&t.toggleQueryActivator("getCameraSnapshotQuery",!1);const{data:k,isFetching:z,refetch:L,isRefetching:se}=t.getCameraSnapshotQuery(r,b),Z=te(()=>(i.value||z.value||se.value)&&f.value),N=te(()=>{if(o.value)return o.value;if(k.value)return`data:image/jpeg;base64,${k.value}`});return e({download:()=>{if(N.value){const U=`${r.value.replace(/ /g,"_").toLowerCase()}_${new Date().toISOString()}.png`,S=document.createElement("a");S.setAttribute("download",U),S.href=N.value,document.body.appendChild(S),S.click(),S.remove()}},refresh:()=>{b.value=!0,L(),b.value=!1},isLoading:Z,snapshotSrc:N}),(U,S)=>{const M=jr,B=Na;return m(),A("div",{class:"w-full h-full flex items-center justify-center bg-black aspect-video",style:at({width:`${c(a)}`,height:`${c(l)}`})},[c(Z)?(m(),j(M,{key:0,class:"m-0 max-w-[30px] max-h-[30px]","stroke-width":"5",style:at({width:`calc(${c(a)} / 2)`,height:`calc(${c(l)} / 2)`})},null,8,["style"])):(m(),j(B,{key:1,src:c(N),"aspect-ratio":"16/9",cover:"",width:c(d),height:c(u),"image-container-class":c(h),"image-container-style":c(v)},null,8,["src","width","height","image-container-class","image-container-style"]))],4)}}}),X4=["d"],e6=Et({__name:"CuiPolygon",props:{cameraZones:{}},setup(s){const e=s,{cameraZones:t}=Yt(e),n=Vt("zoneRef"),r=ii(n),i=o=>{if(!o)return"";const a=o.map(u=>{const d=Math.round(u[0]/100*r.width.value),h=Math.round(u[1]/100*r.height.value);return`${d},${h}`});if(a.length===0)return"";let l=`M ${a[0]}`;for(let u=1;u<a.length;u++)l+=` L ${a[u]}`;return l+=" Z",l};return(o,a)=>(m(),A("svg",{ref_key:"zoneRef",ref:n,width:"100%",height:"100%",class:"zones-container polygon-container"},[(m(!0),A(yt,null,Dt(c(t),(l,u)=>(m(),A("path",{key:u,d:i(l.points.map(d=>d)),class:ct({dash:l.type==="intersect"&&!l.isPrivacyMask}),style:at({fill:l.isPrivacyMask?"rgba(16, 16, 16, 0.9)":l.filter==="exclude"?"transparent":`${l.color}4D`,stroke:l.isPrivacyMask?"#333333":l.color,"stroke-width":"2"})},null,14,X4))),128))],512))}}),t6=qs(e6,[["__scopeId","data-v-bcfe05d5"]]),s6={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function n6(s,e){return m(),A("svg",s6,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M3 14s-1 0-1-1s1-4 6-4s6 3 6 4s-1 1-1 1zm5-6a3 3 0 1 0 0-6a3 3 0 0 0 0 6"},null,-1)]))}const r6=pe({name:"bi-person-fill",render:n6}),i6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o6(s,e){return m(),A("svg",i6,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M6.25 5.25c0-1.422 1.028-2.75 2.5-2.75s2.5 1.328 2.5 2.75S10.222 8 8.75 8s-2.5-1.328-2.5-2.75M1 8.75C1 7.328 2.028 6 3.5 6S6 7.328 6 8.75S4.972 11.5 3.5 11.5S1 10.172 1 8.75M12 10a7 7 0 0 0-7 7c0 1.36.72 2.388 1.7 3.044c.963.645 2.198.956 3.378.956h3.844c1.18 0 2.415-.311 3.377-.956C18.28 19.388 19 18.361 19 17a7 7 0 0 0-7-7m.75-4.75c0-1.422 1.028-2.75 2.5-2.75s2.5 1.328 2.5 2.75S16.722 8 15.25 8s-2.5-1.328-2.5-2.75M18 8.75C18 7.328 19.028 6 20.5 6S23 7.328 23 8.75s-1.028 2.75-2.5 2.75S18 10.172 18 8.75"},null,-1)]))}const a6=pe({name:"fluent-animal-paw-print-24-filled",render:o6}),c6={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function l6(s,e){return m(),A("svg",c6,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m3.044 6l-.01.074A1.5 1.5 0 0 0 2 7.5v3A1.5 1.5 0 0 0 3.5 12h9a1.5 1.5 0 0 0 1.5-1.5v-3a1.5 1.5 0 0 0-1.04-1.428L12.951 6h.549a.5.5 0 0 0 0-1h-.677l-.16-1.253A2 2 0 0 0 10.68 2H5.319a2 2 0 0 0-1.984 1.744L3.173 5H2.5a.5.5 0 0 0 0 1zm2.275-3h5.36a1 1 0 0 1 .992.873L11.943 6h-7.89l.274-2.128A1 1 0 0 1 5.319 3M5.25 9.749a.749.749 0 1 1 0-1.498a.749.749 0 0 1 0 1.498m5.498 0a.749.749 0 1 1 0-1.498a.749.749 0 0 1 0 1.498M12.497 13h-1.5v.25a.75.75 0 0 0 1.5 0zM5 13H3.5v.25a.75.75 0 0 0 1.5 0z"},null,-1)]))}const u6=pe({name:"fluent-vehicle-car-16-filled",render:l6}),d6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function h6(s,e){return m(),A("svg",d6,e[0]||(e[0]=[g("g",{fill:"currentColor"},[g("path",{d:"M15.25 6.5a2.25 2.25 0 1 0 0-4.5a2.25 2.25 0 0 0 0 4.5m-2.867-.001c-1.495-.21-4.912.397-6.32 4.15a1 1 0 1 0 1.873.702c.584-1.555 1.636-2.316 2.574-2.655l-1.17 3.006q-.029.075-.045.15a1 1 0 0 0 .164.91l3.562 4.607l.231 3.693a1 1 0 1 0 1.996-.124l-.27-4.307l-2.092-2.707l1.373-2.661l.093.134a2 2 0 0 0 2.42.711l2.115-.886a1 1 0 0 0-.773-1.844l-2.115.886l-1.606-2.335a3.04 3.04 0 0 0-1.661-1.36a1.4 1.4 0 0 0-.35-.07"}),g("path",{d:"m8.45 16.45l.827-2.452l1.469 1.9l-.402 1.191a2 2 0 0 1-2.032 1.356l-2.88-.197a1 1 0 1 1 .136-1.996z"})],-1)]))}const m6=pe({name:"healthicons-running-24px",render:h6}),p6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function f6(s,e){return m(),A("svg",p6,e[0]||(e[0]=[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3zM7 16.5l-4.74-2.85M7 16.5l5-3m-5 3v5.17m5-8.17V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5zm5 3l-5-3m5 3l4.74-2.85M17 16.5v5.17"}),g("path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3l5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0zM12 8L7.26 5.15M12 8l4.74-2.85M12 13.5V8"})],-1)]))}const g6=pe({name:"lucide-boxes",render:f6}),v6={class:"w-full h-full"},_6={key:1,class:"label-text"},y6=Et({__name:"CuiBBoxPlayground",props:{showIcon:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!1},showConfidence:{type:Boolean,default:!0},detections:{default(){return[]}},classes:{default(){return["animal","person","vehicle","motion","other"]}}},setup(s,{expose:e}){const t=s,{detections:n,classes:r,showConfidence:i,showIcon:o,showLabel:a}=Yt(t),l=Vt("containerRef"),u=Ls([]),{width:d,height:h}=ol(l),v={motion:{color:"#A855F7",icon:m6},animal:{color:"#22C55E",icon:a6},person:{color:"#3B82F6",icon:r6},vehicle:{color:"#EF4444",icon:u6},other:{color:"#CAC443",icon:g6}},f=te(()=>Math.min(d.value||800,h.value||600)),b=te(()=>f.value<200?.8:1),k=te(()=>S=>{if(!u.value.length||!d.value)return 0;const{inputWidth:M}=u.value[0];return Math.round(S*d.value/M)}),z=te(()=>S=>{if(!u.value.length||!h.value)return 0;const{inputHeight:M}=u.value[0];return Math.round(S*h.value/M)}),L=te(()=>(S,M)=>k.value(M)-k.value(S)),se=te(()=>(S,M)=>z.value(M)-z.value(S)),Z=te(()=>S=>{const M=L.value(S.boundingBox[0],S.boundingBox[2]),B=se.value(S.boundingBox[1],S.boundingBox[3]),K=M<200?.3:M<400?.25:.2;return Math.min(M,B)*K}),N=te(()=>S=>{const M=z.value(S.boundingBox[1]),B=30*b.value;return M<B}),E=te(()=>S=>k.value(S.boundingBox[0])>d.value*.7),O=S=>{u.value=S.filter(M=>r.value.includes(M.label))},U=()=>{u.value=[]};return Ke(n,S=>{S.length&&O(S)},{immediate:!0}),e({draw:O,clear:U}),(S,M)=>(m(),A("div",{ref_key:"containerRef",ref:l,class:"bbox-container"},[(m(!0),A(yt,null,Dt(c(u),B=>{var K,R;return m(),A("div",{key:B.id,class:"bbox-corners",style:at({left:`${c(k)(B.boundingBox[0])}px`,top:`${c(z)(B.boundingBox[1])}px`,width:`${c(L)(B.boundingBox[0],B.boundingBox[2])}px`,height:`${c(se)(B.boundingBox[1],B.boundingBox[3])}px`})},[g("div",v6,[(m(),A(yt,null,Dt(["tl","tr","bl","br"],w=>{var H;return g("div",{key:w,class:ct(["corner-lines",w]),style:at({"--corner-color":((H=v[B.label])==null?void 0:H.color)||v.other.color,"--corner-size":`${c(Z)(B)}px`})},M[0]||(M[0]=[g("div",{class:"line horizontal"},null,-1),g("div",{class:"line vertical"},null,-1)]),6)}),64))]),c(a)||c(i)||c(o)?(m(),A("div",{key:0,class:ct(["label z-1",{"label-bottom":c(N)(B),"label-right":c(E)(B)}]),style:at({backgroundColor:((K=v[B.label])==null?void 0:K.color)||v.other.color,fontSize:`${12*c(b)}px`,padding:`${4*c(b)}px ${8*c(b)}px`,gap:`${4*c(b)}px`})},[c(o)?(m(),j(Ai(((R=v[B.label])==null?void 0:R.icon)||v.other.icon),{key:0})):ae("",!0),c(a)&&c(f)>250?(m(),A("span",_6,de(B.label),1)):ae("",!0),c(i)&&c(f)>250?(m(),A("span",{key:2,class:"confidence",style:at({fontSize:`${11*c(b)}px`})},de((B.confidence*100).toFixed(1))+"% ",5)):ae("",!0)],6)):ae("",!0)],4)}),128))],512))}}),b6=qs(y6,[["__scopeId","data-v-870e7d93"]]),w6={class:"snapshot-hover-container flex items-center justify-center aspect-video"},x6={class:"shortcut-menu"},S6=Et({__name:"CuiCameraShortcuts",props:{cameraName:{},addingShortcuts:{type:Boolean}},setup(s){var Ue;const e=new Wn,t=new R_,n=Fs(),r=Dr(),i=s,{cameraName:o,addingShortcuts:a}=Yt(i),{user:l}=Vs(n),u=Vt("placeholderRef"),d=Vt("shortcutContainerRef"),h=Vt("camerasMenuRef"),v=Ls({}),f=Ls({}),b=Ls({}),k=ce({}),z=ce(!1),L=ce(),se=ce(!1),Z=ce(!1),N=ce([]),E=ce({}),O=ce(!1),U=ol(d);e.toggleQueryActivator("getCamerasQuery",!1);const{data:S,isFetching:M}=e.getCameraQuery(o),{data:B,isFetching:K}=e.getCamerasQuery({page:1,pageSize:-1}),{data:R,isFetching:w}=t.getShortcutsQuery(((Ue=l.value)==null?void 0:Ue.username)||"",o),{mutate:H,isPending:J}=t.patchShortcutQuery(),{mutate:q,isPending:oe}=t.createShortcutQuery(),{mutate:ue,isPending:Ce}=t.removeShortcutQuery(),F=te(()=>M.value||w.value||J.value||K.value||oe.value||Ce.value),D=te(()=>{var V;return(V=B.value)!=null&&V.result?B.value.result.filter(X=>X.name!==o.value):[]}),Y=te(()=>{var V;return((V=l.value)==null?void 0:V.username)??""});Ke([R,S],()=>{R.value&&S.value&&(N.value=Si(R.value))},{immediate:!0,deep:!0}),Ke([U.width,U.height],()=>{Z.value=!0,Zs(()=>{ve()})}),Ke(N,()=>{Zs(()=>{ft()})},{deep:!0,immediate:!0}),Ke(Z,V=>{V&&(L.value=void 0)});const Te=V=>{se.value||(L.value=void 0),O.value=V,e.toggleQueryActivator("getCamerasQuery",V)};Ke([u,L],([V,X])=>{V&&X&&setTimeout(()=>{var _e;(_e=h.value)==null||_e.show({currentTarget:V})},50)},{deep:!0}),Ke(E,()=>{Object.entries(E.value).forEach(([V,X])=>{var _e,ye;if(X&&f.value[V]){const fe=v.value[V];fe&&((_e=f.value[V])==null||_e.show({currentTarget:fe}))}else(ye=f.value[V])==null||ye.hide()})},{deep:!0});const He=(V,X)=>{z.value||(e.toggleQueryActivator("getCamerasQuery",X),E.value[V]=z.value?!1:X,Object.entries(E.value).forEach(([_e,ye])=>{_e!==V&&ye&&(E.value[_e]=!1)}))},ht=V=>{z.value||zt(V)},At=(V,X)=>{V||(E.value[X._id]?(He(X._id,!1),Be(X.cameraId)):He(X._id,!0))},Qe=()=>{Object.entries(b.value).forEach(([V,X])=>{const _e=d.value;if(!_e)return;const ye=_e.getBoundingClientRect(),fe=X.element.getBoundingClientRect(),vt=(fe.left-ye.left)/ye.width*100,Tt=(fe.top-ye.top)/ye.height*100;k.value[V]={x:Math.max(0,Math.min(vt,100)),y:Math.max(0,Math.min(Tt,100))}})},ze=()=>{Object.entries(b.value).forEach(([V,X])=>{const _e=k.value[V];if(!_e)return;const ye=d.value;if(!ye)return;const fe=ye.getBoundingClientRect(),vt=X.element.getBoundingClientRect(),Tt=fe.width-vt.width,me=fe.height-vt.height,ie=Math.max(0,Math.min(_e.x/100*fe.width,Tt)),he=Math.max(0,Math.min(_e.y/100*fe.height,me));X.setPosition(ie,he)}),Z.value=!1},ve=()=>{Object.entries(k.value).forEach(([V,X])=>{k.value[V]={x:Math.max(0,Math.min(X.x,100)),y:Math.max(0,Math.min(X.y,100))}}),ze()},ft=()=>{for(const[V,X]of Object.entries(b.value))N.value.find(_e=>_e._id===V)||(X.destroy(),delete b.value[V],delete k.value[V]);for(const[V]of Object.entries(k.value))N.value.find(X=>X._id===V)||delete k.value[V];for(const[V,X]of Object.entries(v.value)){const _e=N.value.find(ye=>ye._id===V);if(X&&_e&&d.value){b.value[_e._id]&&b.value[_e._id].destroy();const ye=new Wh(X,{containment:d.value});b.value[_e._id]=ye;const[fe,vt]=_e.points,Tt=d.value.getBoundingClientRect(),me=fe/100*Tt.width,ie=vt/100*Tt.height;ye.setPosition(me,ie),k.value[_e._id]={x:fe,y:vt},ye.on("dragMove",()=>{z.value=!0;const he=f.value[V];he==null||he.alignOverlay()}),ye.on("dragEnd",()=>{setTimeout(()=>{z.value=!1},50),Qe();const he=k.value[_e._id];H({username:Y.value,cameraname:o.value,shortcutid:_e._id,shortcutData:{points:[he.x,he.y]}})})}}ze()},Xt=V=>{if(!a.value||!d.value)return;se.value=!0;const X=d.value.getBoundingClientRect(),_e=35,ye=35;L.value={x:Math.max(0,Math.min(V.clientX-X.left-_e/2,X.width-_e)),y:Math.max(0,Math.min(V.clientY-X.top-ye/2,X.height-ye))}},wt=async V=>{if(!u.value||!d.value)return;const X=d.value,_e=u.value,ye=X.getBoundingClientRect(),fe=_e.getBoundingClientRect(),vt=fe.left-ye.left,Tt=fe.top-ye.top,me=vt/ye.width*100,ie=Tt/ye.height*100;q({username:Y.value,cameraname:o.value,shortcutData:{_id:"",points:[me,ie],cameraId:V._id}},{onSettled:()=>{var he;se.value=!1,L.value=void 0,(he=h.value)==null||he.hide()}})},zt=V=>{const X=b.value[V._id];X==null||X.destroy(),ue({username:Y.value,cameraname:o.value,shortcutid:V._id})},it=(V,X)=>{v.value[X]=V},es=(V,X)=>{f.value[X]=V},Be=async V=>{if(z.value)return;const X=new AbortController,ye=(await vp({cameraname:V,signal:X.signal})).name;ye&&r.push(`/cameras/${ye}`)};return K0(()=>{v.value={}}),Sn(()=>{Zs(()=>{ft()})}),vo(()=>{Object.values(b.value).forEach(V=>V.destroy())}),(V,X)=>{const _e=xp,ye=ws,fe=jr,vt=Ep,Tt=Zc,me=jl;return m(),A("div",{ref_key:"shortcutContainerRef",ref:d,class:ct(["shortcut-container",{"!pointer-events-auto":c(a)}]),style:at({cursor:c(a)?"pointer":"default"}),onClick:cr(Xt,["self"])},[(m(!0),A(yt,null,Dt(c(N),ie=>$t((m(),A("div",{ref_for:!0,ref:he=>it(he,ie._id),key:ie._id,class:"draggable absolute pointer-events-auto",style:at({background:c(E)[ie._id]?"#545454":void 0})},[y(ye,{severity:"secondary",rounded:"",class:"cui-icon-lg shadow-sm pointer-events-auto"},{icon:$(()=>[y(_e,{width:"100%",height:"100%"})]),_:1}),y(Tt,{ref_for:!0,ref:he=>es(he,ie._id),class:"shadow-lg cui-rounded-corner overflow-hidden",pt:{content:{class:"p-0"}}},{default:$(()=>{var he;return[g("div",w6,[(he=c(B))!=null&&he.result.find(Le=>Le._id===ie.cameraId)?(m(),j(vt,{key:1,"source-role":"low-resolution","camera-info":c(B).result.find(Le=>Le._id===ie.cameraId),toolbar:!1,control:!1,subcontrol:!1,"live-indicator-overlay":""},null,8,["camera-info"])):(m(),j(fe,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])]}),_:2},1536)],4)),[[c(Hh),[he=>He(ie._id,he),{delayEnter:0,delayLeave:1e3}]],[c(nf),[()=>ht(ie),{distanceThreshold:24,delay:500,onMouseUp:(he,Le,st)=>At(st,ie)}]]])),128)),c(L)?(m(),A("div",{key:0,ref_key:"placeholderRef",ref:u,class:"draggable absolute pointer-events-auto",style:at(`left: ${c(L).x}px; top: ${c(L).y}px;`)},[y(ye,{severity:"secondary",rounded:"",class:"cui-icon-lg shadow-sm pointer-events-auto"},{icon:$(()=>[y(_e,{width:"100%",height:"100%"})]),_:1})],4)):ae("",!0),c(a)&&!c(z)&&!c(Z)?(m(),j(Tt,{key:1,ref_key:"camerasMenuRef",ref:h,class:"shadow-lg cui-rounded-corner","auto-z-index":!0,"append-to":"body",onShow:X[0]||(X[0]=ie=>O.value=!0),onHide:X[1]||(X[1]=ie=>Te(!1))},{default:$(()=>[g("div",x6,[(m(!0),A(yt,null,Dt(c(D),ie=>(m(),j(me,{key:ie._id,class:"shortcut-menu-item","camera-name":ie.name,width:"100%",loading:c(F),onClick:cr(he=>wt(ie),["prevent"])},null,8,["camera-name","loading","onClick"]))),128))])]),_:1},512)):ae("",!0)],6)}}}),C6=qs(S6,[["__scopeId","data-v-98006b6f"]]),k6={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function E6(s,e){return m(),A("svg",k6,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m184 112l144 144l-144 144"},null,-1)]))}const A6=pe({name:"ion-chevron-forward-outline",render:E6}),M6={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $6(s,e){return m(),A("svg",M6,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M328 112L184 256l144 144"},null,-1)]))}const T6=pe({name:"ion-chevron-back-outline",render:$6}),P6={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function R6(s,e){return m(),A("svg",P6,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m112 184l144 144l144-144"},null,-1)]))}const I6=pe({name:"ion-chevron-down-outline",render:R6}),O6={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N6(s,e){return m(),A("svg",O6,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m112 328l144-144l144 144"},null,-1)]))}const F6=pe({name:"ion-chevron-up-outline",render:N6}),L6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function j6(s,e){return m(),A("svg",L6,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M18 12.998H6a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2"},null,-1)]))}const q6=pe({name:"ic-round-minus",render:j6}),D6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function B6(s,e){return m(),A("svg",D6,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M18 12.998h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5v-5a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2"},null,-1)]))}const z6=pe({name:"ic-round-plus",render:B6});function ql(s){const e=ce(),t=ce(!1),n=ce(!1),r=ce(),i=ce(),o=ce(),a=ce(),l=ce(),u=ce(),d=ce(),h=ce([]),v=te(()=>t.value),f=te(()=>n.value),b=te(()=>h.value.includes(Jt.Light)),k=te(()=>h.value.includes(Jt.Siren)),z=te(()=>h.value.includes(Jt.Doorbell)),L=te(()=>h.value.includes(Jt.Battery)),se=te(()=>h.value.includes(Jt.AudioSensor)),Z=te(()=>h.value.includes(Jt.MotionSensor)||h.value.includes(Jt.MotionDetector)),N=te(()=>h.value.includes(Jt.ObjectSensor)||h.value.includes(Jt.ObjectDetector)),E=te(()=>h.value.includes(Jt.PTZ));return Ke(s,O=>{if(!O)return;e.value=O.cameraSubject.value,t.value=O.connected,n.value=O.frameWorkerConnected,h.value=O.getCapabilities(),r.value=O.getValue("light"),i.value=O.getValue("motion"),o.value=O.getValue("audio"),a.value=O.getValue("object"),l.value=O.getValue("doorbell"),u.value=O.getValue("siren"),d.value=O.getValue("battery");const U=fn(O.cameraSubject);Ke(U,ue=>{ue&&(e.value=ue)});const S=fn(O.onConnected);Ke(S,ue=>{t.value=!!ue});const M=fn(O.onFrameWorkerConnected);Ke(M,ue=>{n.value=!!ue});const B=fn(O.capabilities);Ke(B,ue=>{ue&&(h.value=ue.map(Ce=>Ce.capabilities).flat())});const K=fn(O.onLightSwitched);Ke(K,ue=>{r.value=ue});const R=fn(O.onMotionDetected);Ke(R,ue=>{i.value=ue});const w=fn(O.onAudioDetected);Ke(w,ue=>{o.value=ue});const H=fn(O.onObjectDetected);Ke(H,ue=>{a.value=ue});const J=fn(O.onDoorbellPressed);Ke(J,ue=>{l.value=ue});const q=fn(O.onSirenDetected);Ke(q,ue=>{u.value=ue});const oe=fn(O.onBatteryChanged);Ke(oe,ue=>{d.value=ue})},{immediate:!0}),{cameraObject:e,connected:v,frameWorkerConnected:f,hasLight:b,hasSiren:k,hasDoorbell:z,hasBattery:L,hasAudioDetector:se,hasMotionDetector:Z,hasObjectDetector:N,hasPtz:E,capabilities:h,lightState:r,motionState:i,audioState:o,objectState:a,doorbellState:l,sirenState:u,batteryState:d}}const U6={class:"relative w-full h-full"},V6={class:"absolute top-1 text-muted"},H6={class:"absolute bottom-1 text-muted"},Q6={class:"absolute left-1 text-muted"},K6={class:"absolute right-1 text-muted"},$h=100,kr=2e3,us=.05,Th=.05,Z6=.03,G6=Et({__name:"CuiCameraPTZ",props:{cameraDevice:{},size:{default:"small"}},emits:["panTiltChange","zoomChange"],setup(s,{expose:e,emit:t}){const n=t,r=s,{cameraDevice:i,size:o}=Yt(r),{capabilities:a}=ql(i),l=Vt("panTiltRef"),u=Vt("zoomRef"),d=Pr({x:0,y:0}),h=Pr({x:0,y:0}),v=Pr({x:0,y:0}),f=ce(!1),b=ce(!1),k=ce(0),z=ce(0),L=ce(0),se=ce(!1),Z=ce(0),N=ce(0),E=ce(0),O=ce(0),U=ce(0),S=ce(0),M=ce(0),B=ce("none"),K=ce(0),R=ce(0),w=ce(0),H=ce(null),J=ce(Date.now()),q=te(()=>f.value||b.value),oe=te(()=>o.value==="small"?45:60),ue=te(()=>o.value==="small"?10:15),Ce=te(()=>se.value),F=Be=>Math.round(Be*100)/100,D=Be=>F(Math.max(0,Math.min(1,Be))),Y=async Be=>{const Ue=Date.now();if(!(se.value&&Ue-Z.value<$h)){"pan"in Be&&Be.pan!==void 0&&(Be.pan=F(Be.pan)),"tilt"in Be&&Be.tilt!==void 0&&(Be.tilt=F(Be.tilt)),"zoom"in Be&&Be.zoom!==void 0&&(Be.zoom=D(Be.zoom)),se.value=!0,Z.value=Ue;try{await i.value.interfaces.ptzCommand(Be)}catch(V){console.error("PTZ command failed:",V)}finally{se.value=!1}}},Te=()=>{const Be=Date.now(),Ue=(Be-J.value)/1e3;J.value=Be;let V=!1;if(f.value&&(Math.abs(U.value)>=us||Math.abs(S.value)>=us)){const X=U.value*Th*Ue*5,_e=S.value*Th*Ue*5;K.value=Math.max(-1,Math.min(1,K.value+X)),R.value=Math.max(-1,Math.min(1,R.value+_e));const ye=F(K.value),fe=F(R.value);(h.x!==ye||h.y!==fe)&&(h.x=ye,h.y=fe,n("panTiltChange",{x:h.x,y:h.y}),V=!0)}if(b.value&&Math.abs(M.value)>=us){const X=M.value*Z6*Ue*10;w.value=Math.max(0,Math.min(1,w.value+X));const _e=F(w.value);z.value!==_e&&(z.value=_e,n("zoomChange",_e),V=!0)}if(V&&q.value&&Date.now()-Z.value>=$h*2){if(f.value&&(Math.abs(U.value)>=us||Math.abs(S.value)>=us)){const _e=F(U.value),ye=F(S.value);B.value==="pan"?Y({type:"continuous",pan:_e,tilt:0,timeout:kr}):B.value==="tilt"?Y({type:"continuous",pan:0,tilt:ye,timeout:kr}):Y({type:"continuous",pan:_e,tilt:ye,timeout:kr})}else if(b.value&&Math.abs(M.value)>=us){const _e=D(Math.abs(M.value)),ye=M.value>0;Y({type:"continuous",zoom:ye?_e:-_e,timeout:kr})}}q.value&&(H.value=requestAnimationFrame(Te))},He=()=>{H.value!==null&&cancelAnimationFrame(H.value),J.value=Date.now(),H.value=requestAnimationFrame(Te)},ht=()=>{H.value!==null&&(cancelAnimationFrame(H.value),H.value=null)},At=async()=>{await new Promise(Be=>setTimeout(Be,50)),!q.value&&(Math.abs(N.value)>=us||Math.abs(E.value)>=us||Math.abs(O.value)>=us)&&(U.value=0,S.value=0,M.value=0,B.value="none",N.value=0,E.value=0,O.value=0,await Y({type:"stop"}),ht())},Qe=Be=>{b.value=!0,J.value=Date.now(),w.value=z.value,He(),Be instanceof MouseEvent?ze(Be.clientY):ze(Be.touches[0].clientY)},ze=async Be=>{if(!u.value||!b.value)return;const Ue=u.value.getBoundingClientRect(),V=Ue.top+Ue.height/2,X=oe.value;let _e=Be-V;_e=Math.max(-X,Math.min(X,_e)),k.value=_e;const ye=-_e/X;M.value=ye;const fe=F(ye);if(Math.abs(fe)>=us&&Math.abs(fe-O.value)>=us){O.value=fe;const vt=fe>0,Tt=D(Math.abs(fe));await Y({type:"continuous",zoom:vt?Tt:-Tt,timeout:kr})}else b.value&&Math.abs(fe)<us&&Math.abs(O.value)>=us&&(M.value=0,O.value=0,await Y({type:"stop"}))},ve=Be=>{f.value=!0,J.value=Date.now(),He(),Be instanceof MouseEvent?ft(Be.clientX,Be.clientY):ft(Be.touches[0].clientX,Be.touches[0].clientY)},ft=async(Be,Ue)=>{if(!l.value||!f.value)return;const V=l.value.getBoundingClientRect(),X=V.width/2,_e=V.height/2;let ye=Be-V.left-X,fe=Ue-V.top-_e;const vt=Math.min(X,_e)-ue.value,Tt=Math.sqrt(ye*ye+fe*fe);Tt>vt&&(ye=ye/Tt*vt,fe=fe/Tt*vt),d.x=ye,d.y=fe;const me=ye/vt,ie=-fe/vt,he=Math.abs(me),Le=Math.abs(ie);he>=us||Le>=us?he>Le?(B.value="pan",U.value=me,S.value=0):(B.value="tilt",U.value=0,S.value=ie):(B.value="none",U.value=0,S.value=0),(he>us||Le>us)&&(v.x=U.value,v.y=S.value);const st=Math.abs(U.value-N.value),Zt=Math.abs(S.value-E.value),_s=st>=us||Zt>=us,Gt=Math.abs(U.value)>=us||Math.abs(S.value)>=us;if(Gt&&_s){N.value=U.value,E.value=S.value;const ls=F(U.value),$s=F(S.value);B.value==="pan"?await Y({type:"continuous",pan:ls,tilt:0,timeout:kr}):B.value==="tilt"&&await Y({type:"continuous",pan:0,tilt:$s,timeout:kr})}else f.value&&!Gt&&(Math.abs(N.value)>=us||Math.abs(E.value)>=us)&&(U.value=0,S.value=0,B.value="none",N.value=0,E.value=0,await Y({type:"stop"}))},Xt=Be=>{f.value&&ft(Be.clientX,Be.clientY),b.value&&ze(Be.clientY)},wt=Be=>{Be.preventDefault(),f.value&&ft(Be.touches[0].clientX,Be.touches[0].clientY),b.value&&ze(Be.touches[0].clientY)},zt=()=>{f.value&&(f.value=!1,d.x=0,d.y=0),b.value&&(L.value=z.value,b.value=!1,k.value=0),At()},it=async(Be,Ue)=>{await Y({type:"preset",preset:Be,speed:Ue})},es=async Be=>{await Y({type:"home",speed:Be})};return Sn(()=>{window.addEventListener("mousemove",Xt),window.addEventListener("mouseup",zt),window.addEventListener("touchmove",wt,{passive:!1}),window.addEventListener("touchend",zt)}),vo(()=>{window.removeEventListener("mousemove",Xt),window.removeEventListener("mouseup",zt),window.removeEventListener("touchmove",wt),window.removeEventListener("touchend",zt),ht(),Y({type:"stop"})}),e({goToPreset:it,goToHome:es,isLoading:Ce}),(Be,Ue)=>{const V=z6,X=q6,_e=F6,ye=I6,fe=T6,vt=A6;return m(),A("div",U6,[c(a).includes(c(Jt).PTZZoom)?(m(),A("div",{key:0,ref_key:"zoomRef",ref:u,class:ct(["pointer-events-auto",["absolute left-4 bottom-4 bg-black/70 rounded-full flex flex-col items-center justify-center border border-white/10 shadow-md",c(o)==="small"?"w-12 h-36":"w-16 h-48"]]),onMousedown:Qe,onTouchstart:cr(Qe,["prevent"])},[g("div",{class:ct(["absolute top-4 text-muted",c(o)==="small"?"text-base":"text-lg"])},[y(V)],2),g("div",{class:ct(["absolute bottom-4 text-muted",c(o)==="small"?"text-base":"text-lg"])},[y(X)],2),g("div",{class:ct(["bg-white rounded-full absolute cursor-grab active:cursor-grabbing shadow-lg",c(o)==="small"?"w-8 h-8":"w-10 h-10"]),style:at({transform:`translateY(${c(k)}px)`})},null,6)],34)):ae("",!0),c(a).includes(c(Jt).PTZ)?(m(),A("div",{key:1,ref_key:"panTiltRef",ref:l,class:ct(["pointer-events-auto",["absolute right-4 bottom-4 bg-black/70 rounded-full flex items-center justify-center border border-white/10 shadow-md",c(o)==="small"?"w-24 h-24":"w-32 h-32"]]),onMousedown:ve,onTouchstart:cr(ve,["prevent"])},[g("div",V6,[y(_e)]),g("div",H6,[y(ye)]),g("div",Q6,[y(fe)]),g("div",K6,[y(vt)]),g("div",{class:ct(["bg-white rounded-full absolute cursor-grab active:cursor-grabbing shadow-lg transform -translate-x-1/2 -translate-y-1/2",c(o)==="small"?"w-8 h-8":"w-10 h-10"]),style:at({left:`calc(50% + ${c(d).x}px)`,top:`calc(50% + ${c(d).y}px)`})},null,6)],34)):ae("",!0)])}}}),W6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J6(s,e){return m(),A("svg",W6,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M17.5 6.5H20a1.5 1.5 0 0 1 0 3h-3A2.5 2.5 0 0 1 14.5 7V4a1.5 1.5 0 0 1 3 0zM4 6.5h2.5V4a1.5 1.5 0 1 1 3 0v3A2.5 2.5 0 0 1 7 9.5H4a1.5 1.5 0 1 1 0-3m0 11h2.5V20a1.5 1.5 0 0 0 3 0v-3A2.5 2.5 0 0 0 7 14.5H4a1.5 1.5 0 0 0 0 3m16 0h-2.5V20a1.5 1.5 0 0 1-3 0v-3a2.5 2.5 0 0 1 2.5-2.5h3a1.5 1.5 0 0 1 0 3"})],-1)]))}const Y6=pe({name:"mingcute-fullscreen-exit-fill",render:J6}),X6={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function e8(s,e){return m(),A("svg",X6,e[0]||(e[0]=[g("g",{fill:"none","fill-rule":"evenodd"},[g("path",{d:"m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),g("path",{fill:"currentColor",d:"M18.5 5.5H16a1.5 1.5 0 0 1 0-3h3A2.5 2.5 0 0 1 21.5 5v3a1.5 1.5 0 0 1-3 0zM8 5.5H5.5V8a1.5 1.5 0 1 1-3 0V5A2.5 2.5 0 0 1 5 2.5h3a1.5 1.5 0 1 1 0 3m0 13H5.5V16a1.5 1.5 0 0 0-3 0v3A2.5 2.5 0 0 0 5 21.5h3a1.5 1.5 0 0 0 0-3m8 0h2.5V16a1.5 1.5 0 0 1 3 0v3a2.5 2.5 0 0 1-2.5 2.5h-3a1.5 1.5 0 0 1 0-3"})],-1)]))}const t8=pe({name:"mingcute-fullscreen-fill",render:e8}),s8={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function n8(s,e){return m(),A("svg",s8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M3.5 2A2.5 2.5 0 0 0 1 4.5v5A2.5 2.5 0 0 0 3.5 12H7v-2a2 2 0 0 1 2-2h5V4.5A2.5 2.5 0 0 0 11.5 2zM8 10a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1z"},null,-1)]))}const r8=pe({name:"fluent-picture-in-picture16-filled",render:n8}),i8={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function o8(s,e){return m(),A("svg",i8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M1 4.5A2.5 2.5 0 0 1 3.5 2h8A2.5 2.5 0 0 1 14 4.5V8h-1V4.5A1.5 1.5 0 0 0 11.5 3h-8A1.5 1.5 0 0 0 2 4.5v5A1.5 1.5 0 0 0 3.5 11H7v1H3.5A2.5 2.5 0 0 1 1 9.5zM9 9a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1z"},null,-1)]))}const a8=pe({name:"fluent-picture-in-picture16-regular",render:o8}),c8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function l8(s,e){return m(),A("svg",c8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M13.986 14.776a.73.73 0 0 1-.66-.4a.74.74 0 0 1 .3-1a2.45 2.45 0 0 0 1-1.001a.739.739 0 0 1 1.359.127a.75.75 0 0 1-.048.563a3.85 3.85 0 0 1-1.611 1.61a.7.7 0 0 1-.34.1"},null,-1),g("path",{fill:"currentColor",d:"M19.409 10.644a7.55 7.55 0 0 1-.7 3.141a7.48 7.48 0 0 1-4.823 4.003a6.4 6.4 0 0 1-1.151.2v2.511h2.892a.75.75 0 0 1 0 1.501H8.342a.75.75 0 0 1 0-1.5h2.892v-2.512a6 6 0 0 1-.57-.07a.752.752 0 0 1 .27-1.481q.442.078.89.08h.33a5.5 5.5 0 0 0 1.341-.19a5.9 5.9 0 0 0 2.282-1.18a5.9 5.9 0 0 0 2.13-4.543a.75.75 0 0 1 1.502 0zM20.52 4.56l-4.363 4.353l-5.623 5.623l-6.004 6.003a.8.8 0 0 1-.53.22a.75.75 0 0 1-.53-.22a.74.74 0 0 1 0-1.06l3.462-3.462l-.18-.2a7.3 7.3 0 0 1-2.172-5.183a.75.75 0 0 1 .74-.76a.76.76 0 0 1 .751.75a5.92 5.92 0 0 0 1.771 4.172l.14.16l.85-.84a4 4 0 0 1-.65-.77a3.66 3.66 0 0 1-.59-1.892V5.851a4.13 4.13 0 0 1 1.45-2.872a4.92 4.92 0 0 1 5.894 0a4.13 4.13 0 0 1 1.441 2.802v.79l3.092-3.091a.74.74 0 0 1 1.06 0a.75.75 0 0 1-.01 1.08"},null,-1)]))}const u8=pe({name:"mage-microphone-mute-fill",render:l8}),d8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function h8(s,e){return m(),A("svg",d8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M16.43 5.838v5.57a4.43 4.43 0 0 1-8.78 0v-5.57a4.43 4.43 0 0 1 8.78 0"},null,-1),g("path",{fill:"currentColor",d:"M12.79 17.998v2.5h2.89a.75.75 0 0 1 0 1.5H8.4a.75.75 0 1 1 0-1.5h2.85v-2.5a7.4 7.4 0 0 1-6.67-7.38a.75.75 0 0 1 1.5 0a5.92 5.92 0 1 0 11.84 0a.75.75 0 0 1 1.5 0a7.4 7.4 0 0 1-6.67 7.38z"},null,-1)]))}const m8=pe({name:"mage-microphone-fill",render:h8}),p8={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function f8(s,e){return m(),A("svg",p8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M7.557 2.066A.75.75 0 0 1 8 2.75v10.5a.75.75 0 0 1-1.248.56L3.59 11H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.59l3.162-2.81a.75.75 0 0 1 .805-.124M11.28 5.72a.75.75 0 1 0-1.06 1.06L11.44 8l-1.22 1.22a.75.75 0 1 0 1.06 1.06l1.22-1.22l1.22 1.22a.75.75 0 1 0 1.06-1.06L13.56 8l1.22-1.22a.75.75 0 0 0-1.06-1.06L12.5 6.94z"},null,-1)]))}const g8=pe({name:"heroicons-speaker-x-mark16-solid",render:f8}),v8={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function _8(s,e){return m(),A("svg",v8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M7.557 2.066A.75.75 0 0 1 8 2.75v10.5a.75.75 0 0 1-1.248.56L3.59 11H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.59l3.162-2.81a.75.75 0 0 1 .805-.124m5.393.984a.75.75 0 1 0-1.06 1.06a5.5 5.5 0 0 1 0 7.78a.75.75 0 1 0 1.06 1.06a7 7 0 0 0 0-9.9"},null,-1),g("path",{fill:"currentColor",d:"M10.828 5.172a.75.75 0 1 0-1.06 1.06a2.5 2.5 0 0 1 0 3.536a.75.75 0 1 0 1.06 1.06a4 4 0 0 0 0-5.656"},null,-1)]))}const y8=pe({name:"heroicons-speaker-wave16-solid",render:_8}),b8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function w8(s,e){return m(),A("svg",b8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M10 12v10H8v-8H6v-2zm8 2v6c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-4 0v6h2v-6zM11.5 3c2.65 0 5.05 1 6.9 2.6L21 3v7h-7l2.62-2.62C15.23 6.22 13.46 5.5 11.5 5.5c-3.54 0-6.55 2.31-7.6 5.5l-2.37-.78C2.92 6.03 6.85 3 11.5 3"},null,-1)]))}const x8=pe({name:"mdi-fast-forward10",render:w8}),S8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function C8(s,e){return m(),A("svg",S8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M17.276 5.47c.435.16.724.575.724 1.039V17.49c0 .464-.29.879-.724 1.039a3.7 3.7 0 0 1-2.552 0A1.11 1.11 0 0 1 14 17.491V6.51c0-.464.29-.879.724-1.04a3.7 3.7 0 0 1 2.552 0m-8 0c.435.16.724.575.724 1.039V17.49c0 .464-.29.879-.724 1.039a3.7 3.7 0 0 1-2.552 0A1.11 1.11 0 0 1 6 17.491V6.51c0-.464.29-.879.724-1.04a3.7 3.7 0 0 1 2.552 0"},null,-1)]))}const k8=pe({name:"basil-pause-solid",render:C8}),E8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function A8(s,e){return m(),A("svg",E8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M19.266 13.516a1.917 1.917 0 0 0 0-3.032A35.8 35.8 0 0 0 9.35 5.068l-.653-.232c-1.248-.443-2.567.401-2.736 1.69a42.5 42.5 0 0 0 0 10.948c.17 1.289 1.488 2.133 2.736 1.69l.653-.232a35.8 35.8 0 0 0 9.916-5.416"},null,-1)]))}const M8=pe({name:"basil-play-solid",render:A8}),$8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function T8(s,e){return m(),A("svg",$8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12.5 3c4.65 0 8.58 3.03 9.97 7.22L20.1 11c-1.05-3.19-4.06-5.5-7.6-5.5c-1.96 0-3.73.72-5.12 1.88L10 10H3V3l2.6 2.6C7.45 4 9.85 3 12.5 3M10 12v10H8v-8H6v-2zm8 2v6c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-4 0v6h2v-6z"},null,-1)]))}const P8=pe({name:"mdi-rewind10",render:T8}),R8={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"};function I8(s,e){return m(),A("svg",R8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372"},null,-1),g("path",{fill:"currentColor",d:"M464 336a48 48 0 1 0 96 0a48 48 0 1 0-96 0m72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8"},null,-1)]))}const O8=pe({name:"ant-design-info-circle-outlined",render:I8}),N8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function F8(s,e){return m(),A("svg",N8,e[0]||(e[0]=[g("g",{fill:"currentColor"},[g("path",{d:"M10.243 16.314L6 12.07l1.414-1.414l2.829 2.828l5.656-5.657l1.415 1.415z"}),g("path",{"fill-rule":"evenodd",d:"M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12m11 9a9 9 0 1 1 0-18a9 9 0 0 1 0 18","clip-rule":"evenodd"})],-1)]))}const L8=pe({name:"gg-check-o",render:F8}),j8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function q8(s,e){return m(),A("svg",j8,e[0]||(e[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-width":"2",d:"M8.5 5.5L12 2l3.5 3.5M22 12H2m3.5-3.5L2 12l3.5 3.5m13 0L22 12l-3.5-3.5M12 22V2M8.5 18.5L12 22l3.5-3.5"},null,-1)]))}const D8=pe({name:"grommet-icons-pan",render:q8}),B8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function z8(s,e){return m(),A("svg",B8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M4 19v-9q0-.475.213-.9t.587-.7l6-4.5q.525-.4 1.2-.4t1.2.4l6 4.5q.375.275.588.7T20 10v9q0 .825-.588 1.413T18 21h-3q-.425 0-.712-.288T14 20v-5q0-.425-.288-.712T13 14h-2q-.425 0-.712.288T10 15v5q0 .425-.288.713T9 21H6q-.825 0-1.412-.587T4 19"},null,-1)]))}const U8=pe({name:"material-symbols-home-rounded",render:z8}),V8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function H8(s,e){return m(),A("svg",V8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 .36A5.4 5.4 0 0 0 6.62 5.3a5.4 5.4 0 0 0-1.22-.14a5.4 5.4 0 0 0-2.143 10.357a5.4 5.4 0 0 0-.737 2.723a5.4 5.4 0 0 0 9.54 3.466a5.4 5.4 0 0 0 8.833-6.137a5.4 5.4 0 0 0-3.505-10.152A5.4 5.4 0 0 0 12 .36M6.283 7.228h10.592c.746 0 1.352.605 1.352 1.349v7.646a1.35 1.35 0 0 1-1.352 1.348h-3.608l-7.24 3.55l1.1-3.55h-.844a1.35 1.35 0 0 1-1.352-1.348V8.577c0-.744.606-1.349 1.352-1.349"},null,-1)]))}const Q8=pe({name:"simple-icons-webrtc",render:H8}),K8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Z8(s,e){return m(),A("svg",K8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M17.41 2H6.59A4.58 4.58 0 0 0 2 6.59v10.82A4.58 4.58 0 0 0 6.59 22h10.82A4.58 4.58 0 0 0 22 17.41V6.59A4.58 4.58 0 0 0 17.41 2m-2.653 12.447a1.924 1.924 0 0 1-1.924 1.923h-5.86a1.924 1.924 0 0 1-1.923-1.923v-4.87a1.923 1.923 0 0 1 1.927-1.924h5.856a1.925 1.925 0 0 1 1.924 1.924zm4.2.74a.771.771 0 0 1-1.266.59l-2.211-1.854a.85.85 0 0 1-.3-.653v-2.52a.85.85 0 0 1 .31-.657l2.206-1.82a.769.769 0 0 1 1.26.594z"},null,-1)]))}const G8=pe({name:"cbi-iosfacetime",render:Z8}),W8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J8(s,e){return m(),A("svg",W8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M10.4 13.45h3.2l.6 1.625q.075.2.238.313t.362.112q.35 0 .538-.275t.062-.6l-2.55-6.7q-.075-.2-.237-.312T12.25 7.5h-.5q-.2 0-.363.113t-.237.312L8.625 14.65q-.125.3.05.575t.525.275q.2 0 .363-.112t.237-.313zm.4-1.15L11.95 9h.1l1.15 3.3zM12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12q0-.8.125-1.6T2.5 8.825q.125-.4.513-.537t.737.062q.375.2.538.588t.037.812q-.15.55-.238 1.113T4 12q0 3.35 2.325 5.675T12 20t5.675-2.325T20 12t-2.325-5.675T12 4q-.6 0-1.187.087T9.65 4.35q-.425.125-.8-.025T8.3 3.8t-.013-.762t.563-.513q.75-.275 1.55-.4T12 2q2.075 0 3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22M5.5 7q-.625 0-1.062-.437T4 5.5t.438-1.062T5.5 4t1.063.438T7 5.5t-.437 1.063T5.5 7m6.5 5"},null,-1)]))}const Y8=pe({name:"material-symbols-motion-photos-auto-outline-rounded",render:J8}),X8={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ex(s,e){return m(),A("svg",X8,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"m8.471 7.237l3.056 12.992c.233.993 1.63 1.04 1.929.065l2.945-9.58l.384 1.527a1 1 0 0 0 .97.756H21a1 1 0 1 0 0-2h-2.466l-1.069-4.241c-.247-.981-1.628-1.017-1.925-.05l-2.912 9.472L9.475 2.771c-.24-1.02-1.688-1.03-1.943-.014l-2.065 8.24H3a1 1 0 0 0 0 2h3.247a1 1 0 0 0 .97-.757z"},null,-1)]))}const tx=pe({name:"fluent-pulse24-filled",render:ex}),sx={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function nx(s,e){return m(),A("svg",sx,e[0]||(e[0]=[g("g",{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"4"},[g("path",{fill:"currentColor",d:"M16.866 7.47A18 18 0 0 0 16 13c0 9.941 8.059 18 18 18a17.9 17.9 0 0 0 7.134-1.47C38.801 36.767 32.012 42 24 42c-9.941 0-18-8.059-18-18c0-7.407 4.473-13.768 10.866-16.53Z"}),g("path",{"stroke-linecap":"round",d:"M31.66 10H41l-10 8h10"})],-1)]))}const rx=pe({name:"icon-park-solid-sleep",render:nx}),ix={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ox(s,e){return m(),A("svg",ix,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 2a7 7 0 0 1 7 7a7 7 0 0 1-7 7a7 7 0 0 1-7-7a7 7 0 0 1 7-7m0 2a5 5 0 0 0-5 5a5 5 0 0 0 5 5a5 5 0 0 0 5-5a5 5 0 0 0-5-5m0 2a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3M6 22a2 2 0 0 1-2-2c0-.38.1-.73.29-1.03l1.82-3.16A9 9 0 0 0 12 18c2.25 0 4.31-.83 5.89-2.19l1.82 3.16c.19.3.29.65.29 1.03a2 2 0 0 1-2 2z"},null,-1)]))}const ax=pe({name:"mdi-webcam",render:ox}),cx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lx(s,e){return m(),A("svg",cx,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9.367 2.25h5.266c1.092 0 1.958 0 2.655.057c.714.058 1.317.18 1.869.46a4.75 4.75 0 0 1 2.075 2.077c.281.55.403 1.154.461 1.868c.057.697.057 1.563.057 2.655v5.266c0 1.092 0 1.958-.057 2.655c-.058.714-.18 1.317-.46 1.869a4.75 4.75 0 0 1-2.076 2.075c-.552.281-1.155.403-1.869.461c-.697.057-1.563.057-2.655.057H9.367c-1.092 0-1.958 0-2.655-.057c-.714-.058-1.317-.18-1.868-.46a4.75 4.75 0 0 1-2.076-2.076c-.281-.552-.403-1.155-.461-1.869c-.057-.697-.057-1.563-.057-2.655V9.367c0-1.092 0-1.958.057-2.655c.058-.714.18-1.317.46-1.868a4.75 4.75 0 0 1 2.077-2.076c.55-.281 1.154-.403 1.868-.461c.697-.057 1.563-.057 2.655-.057M10.25 8a.75.75 0 0 0-1.5 0v8a.75.75 0 0 0 1.5 0v-3.25h3.5V16a.75.75 0 0 0 1.5 0V8a.75.75 0 0 0-1.5 0v3.25h-3.5z"},null,-1)]))}const ux=pe({name:"mynaui-letter-h-square-solid",render:lx}),dx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hx(s,e){return m(),A("svg",dx,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9.367 2.25h5.266c1.092 0 1.958 0 2.655.057c.714.058 1.317.18 1.869.46a4.75 4.75 0 0 1 2.075 2.077c.281.55.403 1.154.461 1.868c.057.697.057 1.563.057 2.655v5.266c0 1.092 0 1.958-.057 2.655c-.058.714-.18 1.317-.46 1.869a4.75 4.75 0 0 1-2.076 2.075c-.552.281-1.155.403-1.869.461c-.697.057-1.563.057-2.655.057H9.367c-1.092 0-1.958 0-2.655-.057c-.714-.058-1.317-.18-1.868-.46a4.75 4.75 0 0 1-2.076-2.076c-.281-.552-.403-1.155-.461-1.869c-.057-.697-.057-1.563-.057-2.655V9.367c0-1.092 0-1.958.057-2.655c.058-.714.18-1.317.46-1.868a4.75 4.75 0 0 1 2.077-2.076c.55-.281 1.154-.403 1.868-.461c.697-.057 1.563-.057 2.655-.057m.233 5.3A.75.75 0 0 0 8.25 8v8a.75.75 0 0 0 1.5 0v-5.75l1.65 2.2a.75.75 0 0 0 1.2 0l1.65-2.2V16a.75.75 0 0 0 1.5 0V8a.75.75 0 0 0-1.35-.45l-2.4 3.2z"},null,-1)]))}const mx=pe({name:"mynaui-letter-m-square-solid",render:hx}),px={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fx(s,e){return m(),A("svg",px,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M9.367 2.25h5.266c1.092 0 1.958 0 2.655.057c.714.058 1.317.18 1.869.46a4.75 4.75 0 0 1 2.075 2.077c.281.55.403 1.154.461 1.868c.057.697.057 1.563.057 2.655v5.266c0 1.092 0 1.958-.057 2.655c-.058.714-.18 1.317-.46 1.869a4.75 4.75 0 0 1-2.076 2.075c-.552.281-1.155.403-1.869.461c-.697.057-1.563.057-2.655.057H9.367c-1.092 0-1.958 0-2.655-.057c-.714-.058-1.317-.18-1.868-.46a4.75 4.75 0 0 1-2.076-2.076c-.281-.552-.403-1.155-.461-1.869c-.057-.697-.057-1.563-.057-2.655V9.367c0-1.092 0-1.958.057-2.655c.058-.714.18-1.317.46-1.868a4.75 4.75 0 0 1 2.077-2.076c.55-.281 1.154-.403 1.868-.461c.697-.057 1.563-.057 2.655-.057M10.25 8a.75.75 0 0 0-1.5 0v7.5c0 .414.336.75.75.75H15a.75.75 0 0 0 0-1.5h-4.75z"},null,-1)]))}const gx=pe({name:"mynaui-letter-l-square-solid",render:fx}),vx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _x(s,e){return m(),A("svg",vx,e[0]||(e[0]=[g("g",{fill:"currentColor"},[g("path",{d:"M12.918 12.083h-1.836L12 9.636z"}),g("path",{d:"M9.367 2.25h5.266c1.092 0 1.958 0 2.655.057c.714.058 1.317.18 1.869.46a4.75 4.75 0 0 1 2.075 2.077c.281.55.403 1.154.461 1.868c.057.697.057 1.563.057 2.655v5.266c0 1.092 0 1.958-.057 2.655c-.058.714-.18 1.317-.46 1.869a4.75 4.75 0 0 1-2.076 2.075c-.552.281-1.155.403-1.869.461c-.697.057-1.563.057-2.655.057H9.367c-1.092 0-1.958 0-2.655-.057c-.714-.058-1.317-.18-1.868-.46a4.75 4.75 0 0 1-2.076-2.076c-.281-.552-.403-1.155-.461-1.869c-.057-.697-.057-1.563-.057-2.655V9.367c0-1.092 0-1.958.057-2.655c.058-.714.18-1.317.46-1.868a4.75 4.75 0 0 1 2.077-2.076c.55-.281 1.154-.403 1.868-.461c.697-.057 1.563-.057 2.655-.057m3.335 4.987a.75.75 0 0 0-1.404 0l-3 8a.75.75 0 1 0 1.404.526l.818-2.18h2.96l.818 2.18a.75.75 0 1 0 1.404-.526z"})],-1)]))}const yx=pe({name:"mynaui-letter-a-square-solid",render:_x}),bx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wx(s,e){return m(),A("svg",bx,e[0]||(e[0]=[g("path",{fill:"currentColor","fill-rule":"evenodd",d:"M18 2.75a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .53 1.28l-2.72 2.72H22a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.53-1.28l2.72-2.72zm-4.5 6a.75.75 0 0 1 0-1.5h3a.75.75 0 0 1 .53 1.28l-1.72 1.72h1.19a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1-.53-1.28l1.72-1.72z","clip-rule":"evenodd"},null,-1),g("path",{fill:"currentColor",d:"M12 22c5.523 0 10-4.477 10-10c0-.463-.694-.54-.933-.143a6.5 6.5 0 1 1-8.924-8.924C12.54 2.693 12.463 2 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10"},null,-1)]))}const xx=pe({name:"solar-moon-sleep-bold",render:wx}),Sx=Symbol("cui-camera-drawer"),Bo=Qh(Sx),Sp={position:"right",showCloseIcon:!1,modal:!0,dismissable:!0,baseZIndex:1e3,blockScroll:!0,pt:{root:{class:"w-full sm:w-[400px]"}}},Cp=()=>{const s=ce(!1),e=te(()=>s.value),t=(r,i)=>{Bo.emit({type:"open",options:r,props:{...Sp,...i}}),s.value=!0},n=()=>{Bo.emit({type:"close"}),s.value=!1};return Bo.on(r=>{switch(r.type){case"close":s.value=!1;break;case"open":s.value=!0;break}}),{open:t,close:n,isOpen:e,getEventBus:()=>Bo}};async function kp(){const s=Fs(),{api:e,isApiReady:t}=Vs(s);return t.value?e.value:new Promise((n,r)=>{const i=Ke(t,o=>{o&&e.value&&(i(),n(e.value))});setTimeout(()=>{i(),r(new Error("Timeout waiting for API"))},15e3)})}const Cx={key:"sleep",class:"absolute left-0 right-0 top-0 bottom-0 bg-black/80 flex items-center justify-center z-7"},kx={class:"flex flex-col items-center justify-center text-center"},Ex={key:0,class:"text-white/80 text-sm max-w-xs mt-3"},Ax={key:"loading",class:"absolute w-full h-full flex flex-col items-center justify-center z-6 pointer-events-none"},Mx={key:0,class:"mt-3 text-white text-sm text-shadow"},$x={key:2,class:"absolute w-full flex justify-center z-6 pointer-events-none mt-4"},Tx={class:"camera-card-info-box"},Px={key:"overlay",class:"absolute w-full p-4 flex items-center justify-between gap-2 z-6 pointer-events-none"},Rx={key:1,class:"text-sm font-semibold p-2 bg-black/60 rounded-xl text-white"},Ix={id:"timeline-container",key:"timeline",class:"absolute w-full h-full z-5 pointer-events-none"},Ox={key:6,class:"absolute top-0 left-0 w-full h-full z-5 pointer-events-none"},Nx=["data-player-id","muted"],Fx={class:"flex items-center gap-2"},Lx={key:1,class:"w-[10px] h-[10px] rounded-full bg-red-500"},jx={class:"text-base font-semibold"},Ph=6,qx=5e3,Rh=5e3,Dx=1e4,Bx=1e3,zx=Et({__name:"CuiCameraCard",props:Qn({cameraInfo:{},expandableCard:{type:Boolean,default:!1},flatCard:{type:Boolean,default:!1},cardProps:{},control:{type:Boolean,default:!0},controlFastForwardButton:{type:Boolean,default:!0},controlFsButton:{type:Boolean,default:!0},controlMicrophoneButton:{type:Boolean,default:!0},controlPipButton:{type:Boolean,default:!0},controlPlayPauseButton:{type:Boolean,default:!0},controlRewindButton:{type:Boolean,default:!0},controlSpeakerButton:{type:Boolean,default:!0},subcontrol:{type:Boolean,default:!0},subcontrolActivityModeButton:{type:Boolean,default:!0},subcontrolPtzButton:{type:Boolean,default:!0},subcontrolQualityButton:{type:Boolean,default:!0},subcontrolStreamingModeButton:{type:Boolean,default:!0},cameraNameOverlay:{type:Boolean,default:!0},liveIndicatorOverlay:{type:Boolean,default:!1},modeOverlay:{type:Boolean},toolbar:{type:Boolean,default:!0},toolbarClass:{},toolbarDetectionButton:{type:Boolean,default:!0},toolbarSettingsButton:{type:Boolean,default:!0},toolbarShareButton:{type:Boolean,default:!0},toolbarShortcutsButton:{type:Boolean,default:!0},toolbarSnapshotButton:{type:Boolean,default:!0},toolbarStyle:{},toolbarTimelineButton:{type:Boolean,default:!0},toolbarZoneButton:{type:Boolean,default:!0}},{activityMode:{default:"always-on"},activityModeModifiers:{},sourceRole:{},sourceRoleModifiers:{},streamingMode:{},streamingModeModifiers:{}}),emits:Qn(["streamFinishedLoading","expand"],["update:activityMode","update:sourceRole","update:streamingMode"]),setup(s,{expose:e,emit:t}){const n=new Wn,r=Cp(),{mdBreakpoint:i}=Hr(),{isFsSupported:o,isIos:a,isPipSupported:l}=Fl(),{t:u}=js(),d=t,h=Rr(s,"activityMode"),v=Rr(s,"sourceRole"),f=Rr(s,"streamingMode"),b=s,{cameraInfo:k,expandableCard:z,flatCard:L,cardProps:se,cameraNameOverlay:Z,liveIndicatorOverlay:N,control:E,controlFastForwardButton:O,controlFsButton:U,controlMicrophoneButton:S,controlPipButton:M,controlPlayPauseButton:B,controlRewindButton:K,controlSpeakerButton:R,subcontrol:w,subcontrolActivityModeButton:H,subcontrolPtzButton:J,subcontrolQualityButton:q,subcontrolStreamingModeButton:oe,toolbar:ue,toolbarClass:Ce,toolbarDetectionButton:F,toolbarSettingsButton:D,toolbarShareButton:Y,toolbarShortcutsButton:Te,toolbarSnapshotButton:He,toolbarStyle:ht,toolbarTimelineButton:At,toolbarZoneButton:Qe}=Yt(b),ze=Vt("snapshotRef"),ve=Vt("menuRef"),ft=Vt("motionDetectionCanvasRef"),Xt=Vt("objectDetectionCanvasRef"),wt=Vt("ptzRef"),zt=Vt("playerContainerRef"),it=Vt("videoPlayerRef"),es=Ls(),{cameraObject:Be,motionState:Ue,objectState:V,hasPtz:X,hasMotionDetector:_e,hasObjectDetector:ye}=ql(es),fe=Ls(null),vt=Ls(),Tt=ce(!1),me=ce(!1),ie=ce(!1),he=ce("loading"),Le=ce(!1),st=ce(!1),Zt=ce(!1),_s=ce(!1),Gt=ce(!1),ls=ce({x:0,y:0}),$s=ce(1),hs=ce("hide"),Cs=ce(!1),ns=ce(!1),I=ce(!1),ne=ce(!0),ge=ce(!1),Ae=ce(!1),nt=ce(!0),Ot=ce(!1),Kt=ce(!1),Ye=ce(!1),ke=ce(["animal","motion","other","person","vehicle"]),Oe=O_();let Fe,be,ot;n.toggleQueryActivator("getCameraQuery",!1);const{data:_,isFetching:x,suspense:C}=n.getCameraQuery(typeof k.value=="string"?k.value:""),{copy:T}=Zh({legacy:!0}),P=rf(),G=Su(zt,{delayLeave:1e3}),Ie=Su(zt,{delayLeave:0}),Se=ii(zt),{isFullscreen:le,toggle:Me}=of(a.value?it:zt),{idle:_t,reset:rt}=af(qx,{initialState:!1});Ao(it,"enterpictureinpicture",()=>Kt.value=!0),Ao(it,"leavepictureinpicture",()=>Kt.value=!1),Ao(it,"pause",()=>{Ae.value=!1,Gt.value||ko()}),Ao(it,"play",()=>{Gt.value=!1,Ae.value=!0});const Pt=te(()=>{if(hs.value=="add")return u("components.player.add_shortcut_info")}),rs=te(()=>(G.value||ne.value)&&E.value&&hs.value!=="add"),Ht=te(()=>typeof k.value=="string"&&x.value||!ie.value||Le.value),Ii=te(()=>me.value&&he.value!=="error"),So=te(()=>!!navigator.mediaDevices&&Tt.value&&(he.value==="webrtc"||he.value==="webrtc/tcp")),Oi=te(()=>Ye.value||!ie.value),_r=te(()=>{var ee;return f.value??((ee=Co.value)==null?void 0:ee.interface.streamingMode)??"webrtc"}),Nn=te(()=>{var ee;return v.value??((ee=Co.value)==null?void 0:ee.interface.streamingSource)??"high-resolution"}),Dl=te(()=>Z.value&&rs.value&&!i.value&&Se.width.value>=350),Mp=te(()=>E.value&&rs.value&&!st.value&&Se.width.value>=150),$p=te(()=>w.value&&rs.value&&!st.value&&Se.width.value>=150),Ni=te(()=>Cs.value&&Se.width.value>=350&&X.value),Bl=te(()=>{var Ee;let ee=(Ee=Co.value)==null?void 0:Ee.interface.aspectRatio;return ee=!ee||ee==="auto"?"16:9":ee,ee.replace(":","/")}),Co=te(()=>typeof k.value=="string"?_.value:k.value),pn=te(()=>typeof k.value=="string"?k.value:k.value.name),Tp=te(()=>[{key:"animal",label:"Animal",toggle:!0,toggleState:ke.value.includes("animal"),disabled:!Fi.value.includes("animal"),onClick:()=>Kr("animal")},{key:"motion",label:"Motion",toggle:!0,toggleState:ke.value.includes("motion"),disabled:!Fi.value.includes("motion"),onClick:()=>Kr("motion")},{key:"other",label:"Other",toggle:!0,toggleState:ke.value.includes("other"),disabled:!Fi.value.includes("other"),onClick:()=>Kr("other")},{key:"person",label:"Person",toggle:!0,toggleState:ke.value.includes("person"),disabled:!Fi.value.includes("person"),onClick:()=>Kr("person")},{key:"vehicle",label:"Vehicle",toggle:!0,toggleState:ke.value.includes("vehicle"),disabled:!Fi.value.includes("vehicle"),onClick:()=>Kr("vehicle")}]),Pp=te(()=>{var Ee;const ee={body:{class:"w-full h-full p-0 overflow-hidden justify-center"},root:{class:{}}};return L.value&&(ee.root.class={...ee.root.class,"!rounded-none !border-0":!0}),Al(ee,(Ee=se.value)==null?void 0:Ee.pt)}),zl=te(()=>{const ee=Se.width.value;return ee?ee<=150?.4:ee<250?.5:ee<350?.7:ee<450?.85:1:1}),Rp=te(()=>{const ee=Se.height.value,Ee=zl.value;return ee?`${Math.min(Math.max(ee*.05,15),30)*Ee}px`:"20px"}),Ip=te(()=>{const ee=Se.height.value,Ee=zl.value;return ee?`${Math.min(Math.max(ee*.05,15),30)*Ee}px`:"20px"}),Xe=te(()=>{const ee=Se.width.value;return ee?ee<=150?8:ee<225?10:ee<250?12:ee<350?14:ee<450?16:18:18}),on=te(()=>{const ee=Se.width.value;return ee?ee<=170?18:ee<225?20:ee<250?22:ee<350?28:ee<450?34:40:40}),Ws=te(()=>`${on.value}px`),Fi=te(()=>{var Ee;const ee=new Set(((Ee=Co.value)==null?void 0:Ee.detectionZones.map(pt=>pt.classes).flat())??[]);return _e.value||ee.delete("motion"),ye.value||(ee.delete("animal"),ee.delete("person"),ee.delete("vehicle"),ee.delete("other")),Array.from(ee)});Ke(P,ee=>{var Ee,pt;ee==="hidden"?(clearTimeout(be),be=setTimeout(()=>{Qr()},Dx)):(clearTimeout(be),(Ee=fe.value)!=null&&Ee.finishLoading?ko():(yr(),(pt=fe.value)==null||pt.start()))}),Ke(Le,async ee=>{ee&&await ja(!1,!1)}),Ke(ie,ee=>{ee||jp(),d("streamFinishedLoading",ee)}),Ke(he,ee=>{clearInterval(ot),ee==="mse"&&(ot=setInterval(qp,Bx))}),Ke(h,()=>{Yl()}),Ke(_t,ee=>{h.value==="standby"&&ee&&(st.value=!0,Qr())}),Ke(Ue,()=>{var ee,Ee,pt;((ee=_.value)==null?void 0:ee.detectionZones.length)!==0&&(Xl(((Ee=Ue.value)==null?void 0:Ee.detections)??[]),tu("motion",((pt=Ue.value)==null?void 0:pt.detections)??[]))},{deep:!0}),Ke(V,()=>{var ee,Ee,pt;((ee=_.value)==null?void 0:ee.detectionZones.length)!==0&&(Xl(((Ee=V.value)==null?void 0:Ee.detections)??[]),tu("object",((pt=V.value)==null?void 0:pt.detections)??[]))},{deep:!0}),Ke(i,()=>{i.value&&(ns.value=!1)});const Op=async()=>{if(!it.value)throw new Error("Video player not found!");typeof k.value=="string"&&await C();const ee=await kp();if(es.value=await ee.deviceManager.getCamera(pn.value),!es.value)throw new Error("Camera not found!");fe.value=es.value.createWebRTCSession({role:Nn.value,mode:_r.value,videoElement:it.value,webrtcConnectTimeout:2e3}),fe.value.addEventListener("error",Hl),fe.value.addEventListener("reconnect",yr),fe.value.addEventListener("onModeChange",Ql),fe.value.addEventListener("onSourceChange",Kl),fe.value.addEventListener("onStreamProbe",Zl),fe.value.addEventListener("onFinishLoading",Gl),fe.value.addEventListener("onFirstFrame",Wl),fe.value.addEventListener("onLoadedData",Jl),Yl(!0)},Np=()=>{var ee;if(_r.value==="auto"){const Ee=(ee=fe.value)!=null&&ee.currentMode?u(`components.player.streaming_mode_${fe.value.currentMode}`):u("components.player.streaming_mode_unknown");return`${u("components.player.streaming_mode_auto")}: ${Ee}`}else return _r.value.startsWith("webrtc")?u("components.player.streaming_mode_webrtc"):_r.value==="mse"?u("components.player.streaming_mode_mse"):u("components.player.streaming_mode_unknown")},Fp=()=>{var ee;if(Nn.value==="auto"){const Ee=(ee=fe.value)!=null&&ee.currentResolution?u(`components.player.source_role_${fe.value.currentResolution.split("-")[0]}`):u("components.player.source_role_unknown");return`${u("components.player.source_role_auto")}: ${Ee}`}else return Nn.value==="high-resolution"?u("components.player.source_role_high"):Nn.value==="mid-resolution"?u("components.player.source_role_mid"):Nn.value==="low-resolution"?u("components.player.source_role_low"):u("components.player.source_role_unknown")},Ul=ee=>{if(!it.value||!zt.value||!G.value){ls.value={x:0,y:0},$s.value=1;return}const Ee=zt.value.getBoundingClientRect(),pt=it.value.getBoundingClientRect(),ms=Math.max(0,(pt.width-Ee.width)/2),is=Math.max(0,(pt.height-Ee.height)/2),br=Math.max(-ms,Math.min(ms,ee.pan.x)),wr=Math.max(-is,Math.min(is,ee.pan.y));(ee.pan.x!==br||ee.pan.y!==wr)&&(ls.value={x:br,y:wr});const Zr=1,ts=Ph-1;ee.zoom>ts?ee.type==="dblClick"?Zs(()=>{$s.value=Zr}):Zs(()=>{$s.value=ts}):ee.zoom===1&&setTimeout(()=>{ls.value={x:0,y:0}},10)},Vl=()=>{z.value&&!st.value&&d("expand")},Hl=ee=>{console.error(pn.value,ee),he.value="error",ie.value=!1,Le.value=!1},yr=()=>{he.value="reconnecting",ie.value=!1,Le.value=!0},Ql=()=>{he.value=fe.value.currentMode,Le.value=!1,ie.value=!1},Kl=()=>{he.value="adapting",Zt.value=!0},Zl=()=>{he.value=fe.value.currentMode,Tt.value=fe.value.hasBackchannel,me.value=fe.value.hasAudio},Gl=()=>{he.value=fe.value.currentMode,Le.value=!1},Wl=()=>{he.value=fe.value.currentMode,ie.value=!0,Zt.value=!1},Jl=()=>{he.value=fe.value.currentMode,ie.value=!0,Zt.value=!1},Yl=ee=>{var Ee,pt,ms,is;clearTimeout(Fe),h.value==="always-on"?(st.value=!1,(Ee=fe.value)!=null&&Ee.finishLoading||(ee||yr(),(pt=fe.value)==null||pt.start())):h.value==="standby"?st.value||(rt(),(ms=fe.value)!=null&&ms.finishLoading||(yr(),(is=fe.value)==null||is.start())):h.value==="activity"&&(_s.value||(st.value=!0,Qr()))},Xl=ee=>{var Ee,pt;h.value==="activity"&&(!!(ee!=null&&ee.length&&ee.some(is=>ke.value.includes(is.label)))?(_s.value=!0,clearTimeout(Fe),(st.value||!((Ee=fe.value)!=null&&Ee.finishLoading))&&(st.value=!1,yr(),(pt=fe.value)==null||pt.start())):(clearTimeout(Fe),Fe=setTimeout(()=>{_s.value||(st.value=!0,Qr())},Rh),_s.value=!1))},Lp=()=>{var ee;st.value&&(st.value=!1,yr(),(ee=fe.value)==null||ee.start(),h.value==="standby"?rt():h.value==="activity"&&(clearTimeout(Fe),_s.value||(Fe=setTimeout(()=>{st.value=!0,Qr()},Rh))))},Qr=()=>{var ee;(ee=fe.value)==null||ee.close(),ie.value=!1},eu=()=>{var ee;if(it.value){const Ee=document.createElement("canvas");Ee.width=it.value.videoWidth,Ee.height=it.value.videoHeight,(ee=Ee.getContext("2d"))==null||ee.drawImage(it.value,0,0,Ee.width,Ee.height);const pt=Ee.toDataURL("image/png"),ms=`${pn.value.replace(/ /g,"_").toLowerCase()}_${new Date().toISOString()}.png`,is=document.createElement("a");is.setAttribute("download",ms),is.href=pt,document.body.appendChild(is),is.click(),is.remove()}},jp=()=>{var ee,Ee;(ee=ft.value)==null||ee.clear(),(Ee=Xt.value)==null||Ee.clear()},tu=(ee,Ee)=>{var pt,ms;ie.value&&(ee==="motion"?(pt=ft.value)==null||pt.draw(Ee):ee==="object"&&((ms=Xt.value)==null||ms.draw(Ee)))},ko=async()=>{if(it.value)try{await it.value.play()}catch(ee){if(it.value&&!it.value.muted)return it.value.muted=!0,ko();console.warn(pn.value,ee)}},qp=()=>{if(it.value&&he.value==="mse"&&!Le.value&&ie.value&&it.value.buffered.length>0){const ee=it.value.buffered.end(it.value.buffered.length-1);ee-it.value.currentTime>1&&(it.value.currentTime=ee)}},Dp=async()=>{var Ee;if(ge.value)return;const ee=(Ee=fe.value)==null?void 0:Ee.streamingSource;if(!ee){console.warn("No stream source available to copy info from.");return}try{const pt=await _p({cameraname:pn.value,sourcename:ee.name}),ms=JSON.stringify(pt,null,2);await T(ms),ge.value=!0,setTimeout(()=>{ge.value=!1},1e3)}catch(pt){console.error("Error copying stream info:",pt)}},Kr=ee=>{const Ee=ke.value.indexOf(ee);Ee>-1?ke.value.splice(Ee,1):ke.value.push(ee)},su=ee=>{ee=ee??!I.value,I.value=ee},nu=ee=>{nt.value=ee!==void 0?ee:!nt.value},ja=async(ee,Ee=!1)=>{var pt,ms;if((pt=fe.value)!=null&&pt.currentMode.includes("webrtc"))if(Ot.value=ee!==void 0?ee:!Ot.value,Ot.value)try{vt.value=await navigator.mediaDevices.getUserMedia({audio:!0});const is=vt.value.getAudioTracks()[0];nt.value=!Ee,await fe.value.toggleMicrophone(is)}catch(is){console.warn(pn.value,is)}else(ms=vt.value)==null||ms.getTracks().forEach(is=>is.stop()),vt.value=void 0,await fe.value.toggleMicrophone(null)},ru=ee=>{h.value=ee||(h.value==="always-on"?"standby":h.value==="standby"?"activity":"always-on")},iu=async ee=>{var pt;let Ee=Nn.value;Ee=ee||(Ee==="auto"?"low-resolution":Ee==="low-resolution"?"mid-resolution":Ee==="mid-resolution"?"high-resolution":"auto"),await((pt=fe.value)==null?void 0:pt.toggleRole(Ee)),v.value=Ee},ou=async ee=>{var pt;let Ee=_r.value;Ee=ee||(Ee==="auto"?"webrtc":Ee==="webrtc"?"mse":"auto"),await((pt=fe.value)==null?void 0:pt.toggleMode(Ee)),f.value=Ee},au=()=>{var ee;document.pictureInPictureElement?document.exitPictureInPicture():document.pictureInPictureEnabled&&((ee=it.value)==null||ee.requestPictureInPicture())},cu=()=>{it.value&&(Ae.value?(Gt.value=!0,it.value.pause()):ko())},lu=()=>{o.value?Me():le.value=!le.value},uu=()=>{hs.value==="show"?hs.value="add":hs.value==="add"?hs.value="hide":hs.value="show"},du=()=>{Cs.value=!Cs.value},hu=()=>{ns.value=!ns.value},mu=()=>{},pu=()=>{},Bp=ee=>{Ye.value=ee};return sl(()=>{typeof k.value=="string"&&n.toggleQueryActivator("getCameraQuery",!0)}),Sn(async()=>{try{await Op(),setTimeout(()=>{ne.value=!1},1500)}catch(ee){console.error(ee)}}),Ma(()=>{var ee,Ee,pt,ms,is,br,wr,Zr,ts;clearTimeout(Fe),(ee=fe.value)==null||ee.removeEventListener("error",Hl),(Ee=fe.value)==null||Ee.removeEventListener("reconnect",yr),(pt=fe.value)==null||pt.removeEventListener("onModeChange",Ql),(ms=fe.value)==null||ms.removeEventListener("onSourceChange",Kl),(is=fe.value)==null||is.removeEventListener("onStreamProbe",Zl),(br=fe.value)==null||br.removeEventListener("onFinishLoading",Gl),(wr=fe.value)==null||wr.removeEventListener("onFirstFrame",Wl),(Zr=fe.value)==null||Zr.removeEventListener("onLoadedData",Jl),Qr(),(ts=es.value)==null||ts.close()}),e({togglePlay:cu,toggleSourceRole:iu,togglePictureInPicture:au,toggleActivityMode:ru,toggleStreamingMode:ou,toggleFs:lu,toggleMute:nu,toggleMicrophone:ja,toggleShortcuts:uu,togglePtz:du,toggleFastForward:pu,toggleRewind:mu,toggleZones:su,toggleDetectionClass:Kr,toggleTimeline:hu,timelineScroll:Bp,captureScreenshot:eu}),(ee,Ee)=>{const pt=xx,ms=jr,is=yx,br=gx,wr=mx,Zr=ux,ts=ws,zp=ax,Up=rx,Vp=tx,Hp=Y8,Qp=G8,Kp=Q8,Zp=U8,Gp=D8,Wp=L8,Jp=O8,Yp=P8,Xp=M8,e0=k8,t0=x8,s0=y8,n0=g8,r0=m8,i0=u8,o0=a8,a0=r8,c0=t8,l0=Y6,u0=G6,d0=C6,fu=b6,h0=t6,m0=jl,p0=Y4,f0=G4,g0=Q4,v0=U4,_0=D4,y0=L4,b0=xp,w0=R4,x0=$4,S0=E4,C0=Qc,k0=Sa,E0=jh,A0=mp,Js=qr;return m(),A("div",null,[y(E0,{class:"cui-card",pt:c(Pp)},{content:$(()=>{var gu;return[g("div",{id:"video-container",ref_key:"playerContainerRef",ref:zt,class:"bg-black flex items-center justify-center relative",onClick:Lp},[y(Z0,{name:"fade",tag:"div",class:"w-full relative",style:at({aspectRatio:c(Bl)})},{default:$(()=>{var Eo,vu;return[c(st)?(m(),A("div",Cx,[g("div",kx,[y(pt,{class:"text-white w-[50px] h-[50px]"}),c(Se).width.value>=350?(m(),A("p",Ex,de(ee.$t("components.player.stream_paused")),1)):ae("",!0)])])):ae("",!0),c(Ht)&&!c(st)?(m(),A("div",Ax,[y(ms,{class:"w-[30px] h-[30px] m-0","stroke-width":"5"}),c(Le)?(m(),A("span",Mx,de(ee.$t("components.player.reconnecting"))+"...",1)):ae("",!0)])):ae("",!0),c(Pt)&&!c(st)?(m(),A("div",$x,[g("span",Tx,de(c(Pt)),1)])):ae("",!0),!c(st)&&(c(Dl)||c(N))?(m(),A("div",Px,[c(N)?(m(),A("div",{key:0,class:ct(["w-[10px] h-[10px] rounded-full shadow-md",{"bg-red-500":c(ie),"bg-gray-500":!c(ie)}])},null,2)):ae("",!0),c(Dl)?(m(),A("span",Rx,de(c(pn)),1)):ae("",!0)])):ae("",!0),c($p)?(m(),A("div",{key:"subcontrol",class:"absolute top-4 right-4 cui-rounded-corner overflow-hidden bg-black/60 flex flex-row items-center justify-center shadow-md z-6 dark-mode",style:at({top:c(Ip),height:c(Ws)})},[c(q)&&!c(Cs)?$t((m(),j(ts,{key:0,disabled:c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[0]||(Ee[0]=Fn=>iu())},{icon:$(()=>[c(Nn)==="auto"?(m(),j(is,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):c(Nn)==="low-resolution"?(m(),j(br,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):c(Nn)==="mid-resolution"?(m(),j(wr,{key:2,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(Zr,{key:3,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])),[[Js,{value:Fp()},void 0,{top:!0}]]):ae("",!0),c(H)&&!c(Cs)?$t((m(),j(ts,{key:1,disabled:c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[1]||(Ee[1]=Fn=>ru())},{icon:$(()=>[h.value==="always-on"?(m(),j(zp,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):h.value==="standby"?(m(),j(Up,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(Vp,{key:2,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])),[[Js,{value:h.value==="always-on"?ee.$t("components.player.activity_mode_always_on"):h.value==="standby"?ee.$t("components.player.activity_mode_standby"):ee.$t("components.player.activity_mode_activity")},void 0,{top:!0}]]):ae("",!0),c(oe)&&!c(Cs)?$t((m(),j(ts,{key:2,disabled:c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[2]||(Ee[2]=Fn=>ou())},{icon:$(()=>[c(_r)==="auto"?(m(),j(Hp,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):c(_r)==="mse"?(m(),j(Qp,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(Kp,{key:2,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])),[[Js,{value:Np()},void 0,{top:!0}]]):ae("",!0),c(Cs)&&c(X)&&c(Se).width.value>=350?$t((m(),j(ts,{key:3,disabled:c(Ht)||((Eo=c(wt))==null?void 0:Eo.isLoading),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[3]||(Ee[3]=Fn=>{var _u;return(_u=c(wt))==null?void 0:_u.goToHome()})},{icon:$(()=>[y(Zp,{width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])]),_:1},8,["disabled","style"])),[[Js,{value:ee.$t("components.player.ptz_go_to_home")},void 0,{top:!0}]]):ae("",!0),c(J)&&c(Se).width.value>=350&&c(X)?$t((m(),j(ts,{key:4,disabled:c(Ht)||c(ns),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:du},{icon:$(()=>[y(Gp,{width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])]),_:1},8,["disabled","style"])),[[Js,{value:ee.$t("components.player.ptz")},void 0,{top:!0}]]):ae("",!0),("useCuiPermission"in ee?ee.useCuiPermission:c(Lr))(void 0,"admin")?$t((m(),j(ts,{key:5,disabled:c(Oi),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",onClick:Dp},{icon:$(()=>[c(ge)?(m(),j(Wp,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(Jp,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled"])),[[Js,{value:c(ge)?ee.$t("components.player.copied"):ee.$t("components.player.stream_info")},void 0,{top:!0}]]):ae("",!0)],4)):ae("",!0),c(Mp)&&!c(ns)&&!c(Ni)?(m(),A("div",{key:"control",class:"absolute left-[50%] -translate-x-[50%] cui-rounded-corner overflow-hidden bg-black/60 flex flex-row items-center justify-center shadow-md z-6 dark-mode",style:at({bottom:c(Rp),height:c(Ws)})},[c(K)?(m(),j(ts,{key:0,disabled:"",fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",onClick:mu},{icon:$(()=>[y(Yp,{width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])]),_:1})):ae("",!0),c(B)?(m(),j(ts,{key:1,disabled:c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:cu},{icon:$(()=>[c(Ae)?(m(),j(e0,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(Xp,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])):ae("",!0),c(O)?(m(),j(ts,{key:2,disabled:"",fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:pu},{icon:$(()=>[y(t0,{width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])]),_:1},8,["style"])):ae("",!0),c(R)?(m(),j(ts,{key:3,disabled:!c(Ii)||c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[4]||(Ee[4]=Fn=>nu())},{icon:$(()=>[c(nt)?(m(),j(n0,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(s0,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])):ae("",!0),c(S)?(m(),j(ts,{key:4,disabled:!c(So)||c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:Ee[5]||(Ee[5]=Fn=>ja(void 0,!0))},{icon:$(()=>[c(Ot)?(m(),j(r0,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(i0,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])):ae("",!0),c(M)?(m(),j(ts,{key:5,disabled:!c(l)||c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:au},{icon:$(()=>[c(Kt)?(m(),j(a0,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(o0,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])):ae("",!0),c(U)?(m(),j(ts,{key:6,disabled:!c(o)||c(Ht),fluid:"",text:"",severity:"contrast",class:"!rounded-none !h-full",style:at({width:`${c(on)}px`,height:`${c(Ws)}px`}),onClick:lu},{icon:$(()=>[c(le)?(m(),j(l0,{key:1,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"])):(m(),j(c0,{key:0,width:`${c(Xe)}px`,height:`${c(Xe)}px`},null,8,["width","height"]))]),_:1},8,["disabled","style"])):ae("",!0)],4)):ae("",!0),$t(g("div",Ix,null,512),[[Tr,c(ns)&&!c(Ni)&&!c(st)]]),c(Ni)&&!c(ns)&&!c(st)&&c(es)?(m(),A("div",Ox,[y(u0,{ref_key:"ptzRef",ref:wt,"camera-device":c(es)},null,8,["camera-device"])])):ae("",!0),c(hs)!=="hide"&&!c(st)?(m(),j(d0,{key:7,"camera-name":c(pn),"adding-shortcuts":c(hs)==="add",class:"z-4 pointer-events-none"},null,8,["camera-name","adding-shortcuts"])):ae("",!0),c(_e)&&!c(st)?(m(),j(fu,{key:8,ref_key:"motionDetectionCanvasRef",ref:ft,classes:c(ke),class:"z-3 pointer-events-none"},null,8,["classes"])):ae("",!0),c(ye)&&!c(st)?(m(),j(fu,{key:9,ref_key:"objectDetectionCanvasRef",ref:Xt,classes:c(ke),class:"z-3 pointer-events-none"},null,8,["classes"])):ae("",!0),c(I)&&!c(st)?(m(),j(h0,{key:10,"camera-zones":((vu=c(Be))==null?void 0:vu.detectionZones)??[],class:"z-2 pointer-events-none"},null,8,["camera-zones"])):ae("",!0),$t(y(m0,{key:"snapshot",ref_key:"snapshotRef",ref:ze,"camera-name":c(pn),"show-loading-screen":!1,class:ct(["object-contain absolute cursor-[inherit] z-1",{"cursor-pointer":c(z)}]),"image-container-class":"w-full h-full",onClick:Vl},null,8,["camera-name","class"]),[[Tr,(!c(ie)||c(st)||c(Zt))&&!c(Kt)]]),y(c(Ef),{key:"zoomable",pan:c(ls),"onUpdate:pan":Ee[6]||(Ee[6]=Fn=>ps(ls)?ls.value=Fn:null),zoom:c($s),"onUpdate:zoom":Ee[7]||(Ee[7]=Fn=>ps($s)?$s.value=Fn:null),disabled:!c(Ie)||c(ns)||c(Ni)||c(st),"enable-control-button":!1,"dbl-click-enabled":!1,"min-zoom":1,"max-zoom":Ph,selector:c(Ie)?`[data-player-id='${c(Oe)}']`:"disabled","zoom-origin":"pointer",class:"h-full w-full items-center justfiy-center",onPanned:Ul,onZoom:Ul},{default:$(()=>[g("video",{ref_key:"videoPlayerRef",ref:it,"data-player-id":c(Oe),playsinline:"",autoplay:"",preload:"auto",muted:c(nt),class:ct(["w-full cursor-[inherit] object-fill",{"cursor-pointer":c(z),"object-contain":c(le)}]),style:at({aspectRatio:c(Bl)}),onClick:Vl},null,14,Nx)]),_:1},8,["pan","zoom","disabled","selector"])]}),_:1},8,["style"])],512),c(ue)?(m(),A("div",{key:0,class:ct(["relative w-full h-[60px] camera-toolbar-background border-t-[1px] border-color flex items-center justify-between py-2 px-4 gap-1 z-1",c(Ce)]),style:at([c(ht)])},[g("div",Fx,[c(Oi)?(m(),j(ms,{key:0,"stroke-width":"5",class:"w-[10px] h-[10px]"})):(m(),A("div",Lx)),g("span",jx,de(c(pn)),1)]),Ee[10]||(Ee[10]=g("div",{class:"ml-auto"},null,-1)),c(Y)?$t((m(),j(ts,{key:0,fluid:"",text:"",severity:"contrast",class:"cui-icon-lg not-hover:text-surface-400"},{icon:$(()=>[y(p0,{width:"100%",height:"100%"})]),_:1})),[[Js,{value:ee.$t("components.player.share_camera")},void 0,{top:!0}]]):ae("",!0),c(He)?$t((m(),j(ts,{key:1,fluid:"",text:"",severity:"contrast",class:"cui-icon-lg not-hover:text-surface-400",onClick:eu},{icon:$(()=>[y(f0,{width:"100%",height:"100%"})]),_:1})),[[Js,{value:ee.$t("components.player.capture_snapshot")},void 0,{top:!0}]]):ae("",!0),c(Qe)?$t((m(),j(ts,{key:2,fluid:"",text:"",severity:"contrast",class:ct(["cui-icon-lg not-hover:text-surface-400",{active:c(I)}]),onClick:Ee[8]||(Ee[8]=Eo=>su())},{icon:$(()=>[c(I)?(m(),j(v0,{key:1,width:"100%",height:"100%"})):(m(),j(g0,{key:0,width:"100%",height:"100%"}))]),_:1},8,["class"])),[[Js,{value:ee.$t("components.player.zones")},void 0,{top:!0}]]):ae("",!0),c(F)&&(c(_e)||c(ye))?$t((m(),j(ts,{key:3,fluid:"",text:"",severity:"contrast",class:ct(["cui-icon-lg not-hover:text-surface-400",{active:c(ke).length}]),onClick:(gu=c(ve))==null?void 0:gu.toggleMenu},{icon:$(()=>[y(_0,{width:"100%",height:"100%"})]),_:1},8,["class","onClick"])),[[Js,{value:ee.$t("components.player.detections")},void 0,{top:!0}]]):ae("",!0),c(Te)?$t((m(),j(ts,{key:4,fluid:"",text:"",severity:"contrast",class:ct(["cui-icon-lg not-hover:text-surface-400",{active:c(hs)!=="hide"}]),onClick:uu},{icon:$(()=>[c(hs)==="hide"?(m(),j(y0,{key:0,width:"100%",height:"100%"})):c(hs)==="show"?(m(),j(b0,{key:1,width:"100%",height:"100%"})):(m(),j(w0,{key:2,width:"100%",height:"100%"}))]),_:1},8,["class"])),[[Js,{value:ee.$t("components.player.shortcuts")},void 0,{top:!0}]]):ae("",!0),c(At)?$t((m(),j(ts,{key:5,disabled:c(Ni),fluid:"",text:"",severity:"contrast",class:ct(["cui-icon-lg not-hover:text-surface-400",{active:c(ns)}]),onClick:hu},{icon:$(()=>[c(ns)?(m(),j(S0,{key:1,width:"100%",height:"100%"})):(m(),j(x0,{key:0,width:"100%",height:"100%"}))]),_:1},8,["disabled","class"])),[[Js,{value:c(ns)?ee.$t("components.player.hide_timeline"):ee.$t("components.player.show_timeline")},void 0,{top:!0}]]):ae("",!0),c(D)&&("useCuiPermission"in ee?ee.useCuiPermission:c(Lr))(void 0,"admin")?$t((m(),j(ts,{key:6,fluid:"",text:"",severity:"contrast",class:ct(["cui-icon-lg not-hover:text-surface-400",{active:c(r).isOpen.value}]),onClick:Ee[9]||(Ee[9]=Eo=>c(r).open({cameraName:c(pn)}))},{icon:$(()=>[c(r).isOpen.value?(m(),j(k0,{key:1,width:"100%",height:"100%"})):(m(),j(C0,{key:0,width:"100%",height:"100%"}))]),_:1},8,["class"])),[[Js,{value:ee.$t("components.player.settings")},void 0,{top:!0}]]):ae("",!0)],6)):ae("",!0)]}),_:1},8,["pt"]),y(A0,{ref_key:"menuRef",ref:ve,items:c(Tp),"sort-list":"","auto-hide":!1},null,8,["items"])])}}}),Ep=qs(zx,[["__scopeId","data-v-d46f07f8"]]),Ux=ll({protocol:Jm,url:Gh().trim().min(1,"Camera Source is required").array().nonempty("Camera Source is required")}).strict(),Vx=ll({name:Gh().trim().min(1,"Camera Source Name is required"),urls:Ux.array(),role:Tl,useForSnapshot:Da().default(!1),hotMode:Da().default(!0),preload:Da().default(!0)}).strict(),Hx=ll({...My.innerType().shape,sources:Vx.array().refine(s=>s.some(e=>e.role==="high-resolution"||e.role==="mid-resolution"||e.role==="low-resolution"),{path:["sources[].role"],message:'One of the roles "high-resolution", "mid-resolution" or "low-resolution" is required'}).refine(s=>s.filter(t=>t.useForSnapshot).length<=1,{message:"Only one source can be used for snapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.useForSnapshot),{message:"Snapshot source can not be used with useForSnapshot",path:["sources"]}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.hotMode),{message:"Snapshot source can not be used with hotMode"}).refine(s=>s.filter(t=>t.role==="snapshot").every(t=>!t.preload),{message:"Snapshot source can not be used with preload"})}).strict(),E9=Gn(Hx),A9=Gn(Ey),Qx=Gn($y),Kx=Gn($l),Zx={class:"w-full h-full relative"},Gx={class:"flex flex-col justify-center items-center"},Wx={class:"relative w-full"},Jx={class:"w-full flex flex-col items-center justify-center gap-6"},Yx={class:"relative w-full flex flex-col items-center justify-center"},Xx={class:"absolute top-0 left-0 right-0 bottom-0"},eS={class:"playground-container flex w-full h-full"},tS={class:"sandbox w-full h-full"},sS={class:"handles"},nS=["data-id","data-point","data-point-index","data-zone-index","onDblclick"],rS={class:"clipboard"},iS={width:"100%",height:"100%",class:"polygon-container"},oS=["d","onClick","onDblclick","onMousedown","onTouchstart"],aS={class:"flex flex-col gap-6 zone-buttons justify-center items-center"},cS=["for"],lS=["for"],uS={class:"flex flex-row h-[50px] rounded-full overflow-hidden justify-self-center max-w-max border-[1px] border-color-inner"},dS={class:"flex flex-row h-[50px] rounded-full overflow-hidden justify-self-center max-w-max border-[1px] border-color-inner"},hS=Et({__name:"ZoneEditor",props:{cameraName:{},zones:{}},setup(s,{expose:e}){const t=new Wn,n=Cn(),{t:r}=js(),i=s,o=pi("dialogRefProps"),{cameraName:a,zones:l}=Yt(i),u=Vt("draggablesRef"),d=Vt("outsideRef"),h=Vt("playerRef"),v=Ls([]),f=ce([]),b=ce(!1),k=ce([]),z=ce(void 0),L=ce(-1),se=ce(-1),Z=ce(["animal","vehicle","person","other","motion"]);let N=!1;const E={x:0,y:0},O=ol(h);il(d,V=>{const X=V.target,_e=X.closest(".polygon"),ye=X.closest(".edit-button"),fe=X.closest(".remove-button"),vt=X.closest(".handle"),Tt=X.closest(".zone-buttons"),me=X.closest(".p-multiselect-list"),ie=X.closest(".p-colorpicker-panel");!_e&&!ye&&!fe&&!vt&&!b.value&&!Tt&&!me&&!ie&&(L.value=-1)});const{mutateAsync:U,isPending:S}=t.patchZonesQuery(),M=te(()=>{var V;return!!((V=o.loading)!=null&&V.value||S.value)}),B=te(()=>{var X;const V=[];return b.value&&V.push("customizing"),(X=f.value)!=null&&X.length||V.push("start"),V.join(" ")});Ke(se,()=>{se.value=-1}),Ke(L,(V,X)=>{var _e,ye;if(V===-1&&((_e=f.value)!=null&&_e.length)&&f.value[X]){L.value=X;return}V===-1&&((ye=f.value)!=null&&ye.length)&&(se.value=0)}),Ke(l,()=>{f.value=Si(l.value),K()},{deep:!0,immediate:!0});function K(){if(f.value){if(f.value.length===0){k.value=[];return}k.value=f.value.flatMap((V,X)=>V.points.map((_e,ye)=>({_id:`${V.name}-${ye}`,zoneIndex:X,pointIndex:ye,point:[_e[0],_e[1]]})))}}Ke([O.width,O.height],()=>{Xt()});const R=V=>{if("touches"in V){const X=V.touches[0];return{x:X.clientX,y:X.clientY}}return{x:V.clientX,y:V.clientY}},w=(V,X)=>{if(V.stopPropagation(),!h.value)return;Te(b.value),N=!0,L.value=X;const _e=h.value.getBoundingClientRect(),{x:ye,y:fe}=R(V);E.x=(ye-_e.left)/_e.width*100,E.y=(fe-_e.top)/_e.height*100},H=V=>{if(!N||!h.value||L.value===-1||!f.value.length)return;const X=h.value.getBoundingClientRect(),{x:_e,y:ye}=R(V),fe=(_e-X.left)/X.width*100,vt=(ye-X.top)/X.height*100,Tt=fe-E.x,me=vt-E.y,ie=f.value[L.value].points;let he=!1;for(let Le=0;Le<ie.length;Le++){const st=ie[Le][0]+Tt,Zt=ie[Le][1]+me;if(st<0||st>100||Zt<0||Zt>100){he=!0;break}}if(!he)for(let Le=0;Le<ie.length;Le++){ie[Le][0]+=Tt,ie[Le][1]+=me,ie[Le][0]=Math.max(0,Math.min(100,ie[Le][0])),ie[Le][1]=Math.max(0,Math.min(100,ie[Le][1]));const st=ie[Le][0]/100*X.width,Zt=ie[Le][1]/100*X.height,_s=v.value.find(Gt=>Gt.id===`${f.value[L.value].name}-${Le}`);_s==null||_s.setPosition(st,Zt)}E.x=fe,E.y=vt},J=()=>{setTimeout(()=>{N=!1},100)},q=()=>{!f.value.length||L.value===-1||(f.value[L.value].isPrivacyMask=!f.value[L.value].isPrivacyMask)},oe=()=>{f.value[L.value]&&(f.value[L.value].filter=f.value[L.value].filter==="include"?"exclude":"include")},ue=()=>{f.value[L.value]&&(f.value[L.value].type=f.value[L.value].type==="intersect"?"contain":"intersect")},Ce=V=>{if(!b.value||N)return;const X=z.value!==void 0?z.value:f.value.length,_e=Math.min(Math.max(Math.round((V.offsetX-10)/O.width.value*100),0),100),ye=Math.min(Math.max(Math.round((V.offsetY-10)/O.height.value*100),0),100);if(z.value===void 0){const fe=`zone-${Date.now()}`;f.value.push({name:fe,points:[],filter:"include",type:"contain",classes:["animal","motion","person","vehicle"],isPrivacyMask:!1,color:ze()}),z.value=f.value.length-1}f.value[X].points.push([_e,ye]),K(),Zs(()=>{const fe=f.value[X].points.length-1;F({_id:`${f.value[X].name}-${fe}`,zoneIndex:X,pointIndex:fe,point:[_e,ye]})})},F=V=>{var _e;if(V.zoneIndex===void 0||V.pointIndex===void 0)return;const X=(_e=u.value)==null?void 0:_e.filter(ye=>ye.dataset.pointIndex===V.pointIndex.toString()&&ye.dataset.zoneIndex===V.zoneIndex.toString());!X||X.length===0||it(X[0],V.point)},D=V=>{if(!f.value.length)return;const X=Math.round(V.point[0]/O.width.value*100),_e=Math.round(V.point[1]/O.height.value*100);f.value[V.zoneIndex].points[V.pointIndex]=[X,_e]},Y=()=>{b.value=!0,z.value=void 0},Te=V=>{var _e;if(z.value===void 0){b.value=!1;return}b.value=V||!1;const X=z.value;!f.value[X]||!f.value[X].points||(f.value[X].points.length<3?(f.value.splice(X,1),K()):((_e=u.value)==null||_e.forEach(ye=>Be(ye)),L.value=X),z.value=void 0)},He=()=>{b.value=!0,z.value=L.value},ht=()=>{L.value===-1||!f.value.length||(f.value.splice(L.value,1),L.value=Math.max(-1,L.value-1),K(),Zs(()=>{Xt()}))},At=()=>{var V;if((V=f.value)!=null&&V.length){if(b.value&&z.value!==void 0){const X=f.value[z.value];X.points.length&&(X.points.pop(),X.points.length===0&&(f.value.splice(z.value,1),z.value=void 0),K());return}f.value.length>0&&(f.value.pop(),K(),Zs(()=>{Xt()}))}},Qe=()=>{N=!1,b.value=!1,z.value=void 0,f.value&&(f.value.length=0,k.value=[],Zs(()=>{wt()}))},ze=()=>{const V=Math.floor(Math.random()*256),X=Math.floor(Math.random()*256),_e=Math.floor(Math.random()*256);return"#"+[V,X,_e].map(ye=>ye.toString(16).padStart(2,"0")).join("")},ve=V=>{if(!V||!V.length)return"";const X=V.map(ye=>{const fe=Math.round(ye[0]/100*O.width.value),vt=Math.round(ye[1]/100*O.height.value);return`${fe+10},${vt+10}`});if(X.length===0)return"";let _e=`M ${X[0]}`;for(let ye=1;ye<X.length;ye++)_e+=` L ${X[ye]}`;return _e+=" Z",_e},ft=V=>{b.value||(L.value=V)},Xt=()=>{var V;wt(),(V=u.value)==null||V.forEach(X=>{if(!X.dataset.zoneIndex||!X.dataset.pointIndex)return;const _e=parseInt(X.dataset.zoneIndex),ye=parseInt(X.dataset.pointIndex);if(!f.value[_e]||!f.value[_e].points[ye])return;const fe=f.value[_e].points[ye];fe&&(it(X,fe),Be(X))})},wt=()=>{v.value.forEach(V=>V.destroy()),v.value=[]},zt=V=>{!f.value.length||!f.value[V.zoneIndex]||f.value[V.zoneIndex].points.length<4||(f.value[V.zoneIndex].points.splice(V.pointIndex,1),K(),Zs(()=>{Xt()}))},it=(V,X)=>{Object.assign(V.style,es(X))},es=V=>({left:Math.round(V[0]/100*O.width.value)+"px",top:Math.round(V[1]/100*O.height.value)+"px"}),Be=V=>{V.classList.add("draggable");const X=new Wh(V,{containment:!0,grid:[0,0]}).on("pointerDown",()=>{var _e;(_e=document.querySelectorAll(`[data-point="${V.dataset.zoneIndex}-${V.dataset.pointIndex}"]`)[0])==null||_e.classList.add("changing")}).on("dragMove",()=>{if(!V.dataset.zoneIndex||!V.dataset.pointIndex||!V.dataset.id)return;const _e=X.position.x,ye=X.position.y;D({_id:V.dataset.id,point:[_e,ye],pointIndex:parseInt(V.dataset.pointIndex),zoneIndex:parseInt(V.dataset.zoneIndex)})}).on("pointerUp",()=>{document.querySelectorAll(".point").forEach(_e=>_e.classList.remove("changing"))});X.id=V.dataset.id,v.value.push(X)},Ue=async()=>{if(f.value.length)try{const V=await Kx.parse(f.value);if(!V.value)return n.add({severity:"error",summary:r("components.toast.title_error"),detail:r("components.toast.validation_failed"),life:3e3}),console.log("Validation failed",V.errors),null;await U({cameraname:a.value,zoneData:f.value})}catch(V){return console.error("Error saving zones:",V),n.add({severity:"error",summary:r("components.toast.title_error"),detail:r("components.toast.save_failed"),life:3e3}),null}};return Sn(async()=>{var V;setTimeout(()=>{Xt()}),(V=f.value)!=null&&V.length&&(L.value=0)}),e({isLoading:M,onConfirm:Ue}),(V,X)=>{var ge,Ae,nt,Ot,Kt,Ye,ke,Oe,Fe;const _e=Ep,ye=Lh,fe=go,vt=ki,Tt=N0,me=Aa,ie=S4,he=ws,Le=fp,st=b4,Zt=v4,_s=p4,Gt=d4,ls=c4,$s=i4,hs=s4,Cs=X3,ns=W3,I=K3,ne=qr;return m(),A("div",Zx,[g("div",Gx,[g("div",Wx,[g("div",{ref_key:"outsideRef",ref:d},null,512),g("div",Jx,[g("div",Yx,[g("div",Xx,[g("div",eS,[g("section",{class:ct(["playground w-full h-full",c(B)]),onClick:Ce},[g("div",tS,[g("div",sS,[(m(!0),A(yt,null,Dt(c(k),be=>(m(),A("div",{key:be._id,ref_for:!0,ref_key:"draggablesRef",ref:u,class:"handle","data-id":be._id,"data-point":`${be.zoneIndex}-${be.pointIndex}`,"data-point-index":be.pointIndex,"data-zone-index":be.zoneIndex,onDblclick:cr(ot=>zt(be),["prevent"])},X[3]||(X[3]=[g("div",{class:"delete-point"},null,-1)]),40,nS))),128)),g("div",rS,[(m(),A("svg",iS,[(m(!0),A(yt,null,Dt(c(f),(be,ot)=>(m(),A("path",{key:be.name,d:ve(be.points),class:ct(["cursor-pointer",{dash:be.type==="intersect"&&!be.isPrivacyMask,selected:c(L)===ot}]),style:at({fill:be.isPrivacyMask?"rgba(16, 16, 16, 0.9)":be.filter==="exclude"?"transparent":`${be.color}4D`,stroke:be.isPrivacyMask?"#333333":be.color,"stroke-width":"2"}),onClick:_=>ft(ot),onDblclick:()=>be.isPrivacyMask=!be.isPrivacyMask,onMousedown:_=>w(_,ot),onMousemove:H,onMouseup:J,onTouchstart:_=>w(_,ot),onTouchmove:H,onTouchend:J},null,46,oS))),128))]))])]),X[4]||(X[4]=g("div",{class:"shadowboard on"},null,-1))])],2)])]),g("div",{ref_key:"playerRef",ref:h,class:"w-full h-full flex flex-col items-center justify-center",style:{width:"calc(100% - 20px)","margin-top":"10px","margin-bottom":"10px"}},[y(_e,{"camera-info":c(a),"source-role":"low-resolution","streaming-mode":"webrtc",toolbar:!1,control:!1,subcontrol:!1,"flat-card":"",class:"w-full h-full border-[1px] border-color-inner"},null,8,["camera-info"])],512)]),g("div",aS,[y(c(Nt),{"model-value":(ge=c(f)[c(L)])==null?void 0:ge.classes,name:`zone[${c(L)}].classes`,as:"div",class:"flex flex-col field-gap w-full"},{default:$(({field:be,errors:ot})=>[g("label",{for:`zone[${c(L)}].classes`,class:"cui-label"},de(V.$t("components.form.label.classes")),9,cS),y(fe,null,{default:$(()=>{var _,x;return[y(ye,et(be,{"model-value":(_=c(f)[c(L)])==null?void 0:_.classes,options:c(Z),disabled:(x=c(f)[c(L)])==null?void 0:x.isPrivacyMask,invalid:ot.length>0,loading:c(M),"max-selected-labels":2,"show-toggle-all":!1,"show-clear":"",type:"text",onValueChange:X[0]||(X[0]=C=>c(f)[c(L)].classes=C)}),null,16,["model-value","options","disabled","invalid","loading"])]}),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`zone[${c(L)}].classes`,class:"cui-input-error"},null,8,["name"])]),_:1})]),_:1},8,["model-value","name"]),y(c(Nt),{"model-value":(Ae=c(f)[c(L)])==null?void 0:Ae.color,name:`zone[${c(L)}].color`,as:"div",class:"flex flex-col field-gap w-full"},{default:$(({field:be,errors:ot})=>[g("label",{for:`zone[${c(L)}].color`,class:"cui-label"},de(V.$t("components.form.label.color")),9,lS),y(fe,null,{default:$(()=>{var _;return[y(vt,et(be,{disabled:(_=c(f)[c(L)])==null?void 0:_.isPrivacyMask,invalid:ot.length>0,loading:c(M),readonly:"",type:"text"}),null,16,["disabled","invalid","loading"]),y(me,null,{default:$(()=>{var x,C;return[(m(),j(Tt,{key:c(L),"model-value":(x=c(f)[c(L)])==null?void 0:x.color,format:"hex",disabled:(C=c(f)[c(L)])==null?void 0:C.isPrivacyMask,onValueChange:X[1]||(X[1]=T=>T?c(f)[c(L)].color=`#${T}`:null)},null,8,["model-value","disabled"]))]}),_:1})]}),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`zone[${c(L)}].color`,class:"cui-input-error"},null,8,["name"])]),_:1})]),_:1},8,["model-value","name"]),g("div",uS,[c(b)?$t((m(),j(he,{key:1,disabled:c(z)!==void 0&&((Ot=(nt=c(f)[c(z)])==null?void 0:nt.points)==null?void 0:Ot.length)<3,loading:c(M),severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:X[2]||(X[2]=be=>Te(!1))},{icon:$(()=>[y(Le,{width:"20px",height:"20px"})]),_:1},8,["disabled","loading"])),[[ne,{value:V.$t("components.form.tooltip.finish")},void 0,{top:!0}]]):$t((m(),j(he,{key:0,loading:c(M),severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:Y},{icon:$(()=>[y(ie,{width:"20px",height:"20px"})]),_:1},8,["loading"])),[[ne,{value:V.$t("components.form.tooltip.new")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:!c(f).length||c(L)<0||c(b),severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:He},{icon:$(()=>[y(st,{width:"20px",height:"20px"})]),_:1},8,["loading","disabled"])),[[ne,{value:V.$t("components.form.tooltip.edit")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:!c(f).length||c(L)<0,severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:ht},{icon:$(()=>[y(Zt,{width:"20px",height:"20px"})]),_:1},8,["loading","disabled"])),[[ne,{value:V.$t("components.form.tooltip.delete")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:!c(f).length,severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:At},{icon:$(()=>[y(_s,{width:"20px",height:"20px"})]),_:1},8,["loading","disabled"])),[[ne,{value:V.$t("components.form.tooltip.undo")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:!c(f).length,severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:Qe},{icon:$(()=>[y(Gt,{width:"20px",height:"20px"})]),_:1},8,["loading","disabled"])),[[ne,{value:V.$t("components.form.tooltip.clear")},void 0,{top:!0}]])]),g("div",dS,[$t((m(),j(he,{loading:c(M),disabled:!(c(f).length&&c(L)>=0&&c(f)[c(L)]),severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:q},{icon:$(()=>{var be;return[(be=c(f)[c(L)])!=null&&be.isPrivacyMask?(m(),j(ls,{key:0,width:"20px",height:"20px"})):(m(),j($s,{key:1,width:"20px",height:"20px"}))]}),_:1},8,["loading","disabled"])),[[ne,{value:(Kt=c(f)[c(L)])!=null&&Kt.isPrivacyMask?V.$t("components.form.tooltip.privacy_mask"):V.$t("components.form.tooltip.public_mask")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:(Ye=c(f)[c(L)])==null?void 0:Ye.isPrivacyMask,severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:oe},{icon:$(()=>{var be;return[((be=c(f)[c(L)])==null?void 0:be.filter)==="include"?(m(),j(hs,{key:0,width:"20px",height:"20px"})):(m(),j(Cs,{key:1,width:"20px",height:"20px"}))]}),_:1},8,["loading","disabled"])),[[ne,{value:((ke=c(f)[c(L)])==null?void 0:ke.filter)==="include"?V.$t("components.form.tooltip.include"):V.$t("components.form.tooltip.exclude")},void 0,{top:!0}]]),$t((m(),j(he,{loading:c(M),disabled:(Oe=c(f)[c(L)])==null?void 0:Oe.isPrivacyMask,severity:"secondary",class:"!rounded-none !h-full w-[60px]",onClick:ue},{icon:$(()=>{var be;return[((be=c(f)[c(L)])==null?void 0:be.type)==="intersect"?(m(),j(ns,{key:0,width:"20px",height:"20px"})):(m(),j(I,{key:1,width:"20px",height:"20px"}))]}),_:1},8,["loading","disabled"])),[[ne,{value:((Fe=c(f)[c(L)])==null?void 0:Fe.type)==="intersect"?V.$t("components.form.tooltip.intersect"):V.$t("components.form.tooltip.contain")},void 0,{top:!0}]])])])])])])])}}}),mS=qs(hS,[["__scopeId","data-v-51a8517c"]]),pS={class:"text-color font-normal"},fS={class:"flex flex-col gap-6"},gS={for:"name",class:"cui-label"},vS={for:"type",class:"cui-label"},_S={class:"flex items-center gap-4"},yS={class:"flex flex-col field-switch-gap"},bS={for:"disabled",class:"cui-label-switch"},wS={class:"text-color font-normal"},xS={class:"flex flex-col gap-6"},SS={for:"info.manufacturer",class:"cui-label"},CS={for:"info.model",class:"cui-label"},kS={for:"info.hardware",class:"cui-label"},ES={for:"info.serialNumber",class:"cui-label"},AS={for:"info.firmwareVersion",class:"cui-label"},MS={for:"info.supportUrl",class:"cui-label"},$S={class:"text-color font-normal"},TS={class:"flex flex-col gap-6"},PS={for:"interface.streamingMode",class:"cui-label"},RS={for:"interface.streamingSource",class:"cui-label"},IS={for:"interface.aspectRatio",class:"cui-label"},OS={class:"text-color font-normal"},NS={class:"flex flex-col gap-6"},FS={for:"detectionSettings.motion.timeout",class:"cui-label"},LS={for:"detectionSettings.object.confidence",class:"cui-label"},jS={class:"text-color font-normal"},qS={class:"flex flex-col gap-6 w-full items-center justify-center"},DS={class:"text-color font-normal"},BS={class:"flex flex-col gap-6"},zS={for:"snapshotTTL",class:"cui-label"},US={class:"text-color font-normal"},VS={class:"flex flex-col gap-6"},HS={for:"frameWorkerSettings.decoder",class:"cui-label"},QS={for:"frameWorkerSettings.resolution",class:"cui-label"},KS={for:"frameWorkerSettings.fps",class:"cui-label"},ZS=Et({__name:"Settings",props:Qn({camera:{},cameraDevice:{},loading:{type:Boolean},latestSnapshotSrc:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:Qn(["close"],["update:modelValue"]),setup(s,{emit:e}){const t=new Wn,n=$i(),r=Dr(),i=Nl(),{t:o}=js(),a=Rr(s,"modelValue"),l=e,u=s,{camera:d,loading:h}=Yt(u),v=ce(["camera","doorbell"]),f=ce(["auto","mse","webrtc","webrtc/tcp"]),b=ce(["auto","high-resolution","mid-resolution","low-resolution"]),k=ce(["16:9","8:3","4:3","auto"]),z=ce(["pillow","wasm","rust","gpu"]),L=ce(["640x480","640x360","320x240","320x180"]),{mutateAsync:se,isPending:Z}=t.removeCameraQuery(),N=te(()=>h.value||Z.value),E=()=>{i.openTextDialog({data:{title:o("components.dialog.title.confirm"),confirmText:o("components.form.button.remove"),contentText:o("components.dialog.message.confirm_remove"),confirmButtonProps:{severity:"danger"}},onConfirm:async()=>{try{await se({cameraname:d.value.name}),n.path.includes(d.value.name)&&r.push({path:"/cameras"}),l("close")}catch{}}})},O=(U=[])=>{i.openComponentDialog(mS,{data:{title:o("components.zone_editor.edit_zones"),loading:N,contentProps:{cameraName:d.value.name,zones:U}}})};return(U,S)=>{const M=Xc,B=ki,K=go,R=Wc,w=Gc,H=fo,J=ws,q=el,oe=Yc,ue=Fh,Ce=Jc;return m(),j(Ce,{multiple:"",class:"p-4"},{default:$(()=>[y(oe,{value:"general"},{default:$(()=>[y(M,{class:"px-0 pt-0"},{default:$(()=>[g("span",pS,de(U.$t("components.camera_options.general")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",fS,[y(c(Nt),{modelValue:a.value.name,"onUpdate:modelValue":S[0]||(S[0]=F=>a.value.name=F),modelModifiers:{trim:!0},name:"name",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",gS,de(U.$t("components.form.label.name")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"name",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{"model-value":a.value.type,name:"type",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",vS,de(U.$t("components.form.label.type")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.type,options:c(v),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[1]||(S[1]=Y=>a.value.type=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"type",class:"cui-input-error"})]),_:1})]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.disabled,value:!0,"unchecked-value":!1,type:"checkbox",name:"disabled",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("div",_S,[g("div",yS,[g("label",bS,de(U.$t("components.form.label.disabled")),1),y(w,{severity:"secondary",variant:"simple",size:"small",class:"cui-input-switch-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.disable_camera")),1)]),_:1}),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"disabled",class:"cui-input-switch-error"})]),_:1})]),y(H,et({"model-value":a.value.disabled},F,{invalid:D.length>0,loading:c(N),class:"ml-auto shrink-0",onValueChange:S[2]||(S[2]=Y=>a.value.disabled=Y)}),null,16,["model-value","invalid","loading"])])]),_:1},8,["model-value"]),y(J,{fluid:"",severity:"danger",loading:c(N),class:"cui-button-medium",label:U.$t("components.form.button.remove"),onClick:S[3]||(S[3]=F=>E())},null,8,["loading","label"])])]),_:1})]),_:1}),y(oe,{value:"branding"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",wS,de(U.$t("components.camera_options.branding")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",xS,[y(c(Nt),{modelValue:a.value.info.manufacturer,"onUpdate:modelValue":S[4]||(S[4]=F=>a.value.info.manufacturer=F),modelModifiers:{trim:!0},name:"info.manufacturer",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",SS,de(U.$t("components.form.label.manufacturer")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.manufacturer",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:a.value.info.model,"onUpdate:modelValue":S[5]||(S[5]=F=>a.value.info.model=F),modelModifiers:{trim:!0},name:"info.model",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",CS,de(U.$t("components.form.label.model")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.model",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:a.value.info.hardware,"onUpdate:modelValue":S[6]||(S[6]=F=>a.value.info.hardware=F),modelModifiers:{trim:!0},name:"info.hardware",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",kS,de(U.$t("components.form.label.hardware_version")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.hardware",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:a.value.info.serialNumber,"onUpdate:modelValue":S[7]||(S[7]=F=>a.value.info.serialNumber=F),modelModifiers:{trim:!0},name:"info.serialNumber",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",ES,de(U.$t("components.form.label.serial_number")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.serialNumber",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:a.value.info.firmwareVersion,"onUpdate:modelValue":S[8]||(S[8]=F=>a.value.info.firmwareVersion=F),modelModifiers:{trim:!0},name:"info.firmwareVersion",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",AS,de(U.$t("components.form.label.firmware_version")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.firmwareVersion",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"]),y(c(Nt),{modelValue:a.value.info.supportUrl,"onUpdate:modelValue":S[9]||(S[9]=F=>a.value.info.supportUrl=F),modelModifiers:{trim:!0},name:"info.supportUrl",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",MS,de(U.$t("components.form.label.support_url")),1),y(K,null,{default:$(()=>[y(B,et(F,{invalid:D.length>0,loading:c(N),type:"text"}),null,16,["invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"info.supportUrl",class:"cui-input-error"})]),_:1})]),_:1},8,["modelValue"])])]),_:1})]),_:1}),y(oe,{value:"interface"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",$S,de(U.$t("components.camera_options.interface")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",TS,[y(c(Nt),{"model-value":a.value.interface.streamingMode,name:"interface.streamingMode",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",PS,de(U.$t("components.form.label.streaming_mode")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.interface.streamingMode,options:c(f),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[10]||(S[10]=Y=>a.value.interface.streamingMode=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"interface.streamingMode",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.streaming_mode")),1)]),_:1}))]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.interface.streamingSource,name:"interface.streamingSource",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",RS,de(U.$t("components.form.label.streaming_source")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.interface.streamingSource,options:c(b),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[11]||(S[11]=Y=>a.value.interface.streamingSource=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"interface.streamingSource",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.streaming_source")),1)]),_:1}))]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.interface.aspectRatio,name:"interface.aspectRatio",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",IS,de(U.$t("components.form.label.aspect_ratio")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.interface.aspectRatio,options:c(k),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[12]||(S[12]=Y=>a.value.interface.aspectRatio=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"interface.aspectRatio",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.aspect_ratio")),1)]),_:1}))]),_:1},8,["model-value"])])]),_:1})]),_:1}),y(oe,{value:"detection"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",OS,de(U.$t("components.camera_options.detection")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",NS,[y(c(Nt),{"model-value":a.value.detectionSettings.motion.timeout,name:"detectionSettings.motion.timeout",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",FS,de(U.$t("components.form.label.motion_duration")),1),y(K,null,{default:$(()=>[y(ue,et({"model-value":a.value.detectionSettings.motion.timeout},F,{invalid:D.length>0,loading:c(N),"show-buttons":"","use-grouping":!1,onValueChange:S[13]||(S[13]=Y=>a.value.detectionSettings.motion.timeout=Y),onInput:S[14]||(S[14]=Y=>a.value.detectionSettings.motion.timeout=Y.value)}),null,16,["model-value","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"detectionSettings.motion.timeout",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.motion_duration")),1)]),_:1}))]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.detectionSettings.object.confidence,name:"detectionSettings.object.confidence",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",LS,de(U.$t("components.form.label.confidence")),1),y(K,null,{default:$(()=>[y(ue,et({"model-value":a.value.detectionSettings.object.confidence},F,{invalid:D.length>0,loading:c(N),"show-buttons":"",step:.01,max:1,mode:"decimal","use-grouping":!1,onValueChange:S[15]||(S[15]=Y=>a.value.detectionSettings.object.confidence=Y),onInput:S[16]||(S[16]=Y=>a.value.detectionSettings.object.confidence=Y.value)}),null,16,["model-value","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"detectionSettings.object.confidence",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.confidence")),1)]),_:1}))]),_:1},8,["model-value"])])]),_:1})]),_:1}),y(oe,{value:"zones"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",jS,de(U.$t("components.camera_options.zones")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",qS,[y(J,{fluid:"",class:"cui-button-medium",loading:c(N),label:U.$t("components.form.button.edit_zones"),onClick:S[17]||(S[17]=F=>O(c(d).detectionZones))},null,8,["loading","label"])])]),_:1})]),_:1}),y(oe,{value:"snapshot"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",DS,de(U.$t("components.camera_options.snapshot")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",BS,[y(c(Nt),{"model-value":a.value.snapshotTTL,name:"snapshotTTL",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",zS,de(U.$t("components.form.label.cache_time")),1),y(K,null,{default:$(()=>[y(ue,et({"model-value":a.value.snapshotTTL},F,{invalid:D.length>0,loading:c(N),"show-buttons":"","use-grouping":!1,onValueChange:S[18]||(S[18]=Y=>a.value.snapshotTTL=Y),onInput:S[19]||(S[19]=Y=>a.value.snapshotTTL=Y.value)}),null,16,["model-value","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"snapshotTTL",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.cache_time")),1)]),_:1}))]),_:1},8,["model-value"])])]),_:1})]),_:1}),y(oe,{value:"frameworker"},{default:$(()=>[y(M,{class:"px-0"},{default:$(()=>[g("span",US,de(U.$t("components.camera_options.frame_worker")),1)]),_:1}),y(q,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",VS,[y(c(Nt),{"model-value":a.value.frameWorkerSettings.decoder,name:"frameWorkerSettings.decoder",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",HS,de(U.$t("components.form.label.decoder")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.frameWorkerSettings.decoder,options:c(z),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[20]||(S[20]=Y=>a.value.frameWorkerSettings.decoder=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"frameWorkerSettings.decoder",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.frameworker_decoder")),1)]),_:1}))]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.frameWorkerSettings.resolution,name:"frameWorkerSettings.resolution",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",QS,de(U.$t("components.form.label.resolution")),1),y(K,null,{default:$(()=>[y(R,et(F,{"model-value":a.value.frameWorkerSettings.resolution,options:c(L),invalid:D.length>0,loading:c(N),type:"text",onValueChange:S[21]||(S[21]=Y=>a.value.frameWorkerSettings.resolution=Y)}),null,16,["model-value","options","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"frameWorkerSettings.resolution",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.frameworker_resolution")),1)]),_:1}))]),_:1},8,["model-value"]),y(c(Nt),{"model-value":a.value.frameWorkerSettings.fps,name:"frameWorkerSettings.fps",as:"div",class:"flex flex-col field-gap"},{default:$(({field:F,errors:D})=>[g("label",KS,de(U.$t("components.form.label.fps")),1),y(K,null,{default:$(()=>[y(ue,et({"model-value":a.value.frameWorkerSettings.fps},F,{invalid:D.length>0,loading:c(N),min:0,"show-buttons":"","use-grouping":!1,onValueChange:S[22]||(S[22]=Y=>a.value.frameWorkerSettings.fps=Y),onInput:S[23]||(S[23]=Y=>a.value.frameWorkerSettings.fps=Y.value)}),null,16,["model-value","invalid","loading"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:"frameWorkerSettings.fps",class:"cui-input-error"})]),_:1}),D.length?ae("",!0):(m(),j(w,{key:0,severity:"secondary",variant:"simple",size:"small",class:"cui-input-hint"},{default:$(()=>[Qt(de(U.$t("components.form.hint.frameworker_fps")),1)]),_:1}))]),_:1},8,["model-value"])])]),_:1})]),_:1})]),_:1})}}}),GS={class:"relative"},WS=Et({__name:"CuiActionButton",props:{label:{},icon:{},buttonProps:{},tooltipProps:{},actionText:{},actionDuration:{default:1500}},emits:["action"],setup(s,{emit:e}){const t=s,n=e,{label:r,icon:i,buttonProps:o,actionText:a,actionDuration:l,tooltipProps:u}=Yt(t),d=Vt("buttonRef"),h=ce(!1),v=ii(d);let f;const b=te(()=>({top:`${v.top.value}px`,left:`${v.left.value}px`,transform:"translate(-50%, -100%)",marginTop:"-8px"})),k=z=>{h.value=!1,clearTimeout(f),n("action",z),h.value=!0,f=setTimeout(()=>{h.value=!1},l.value)};return Ma(()=>{f&&clearTimeout(f)}),(z,L)=>{const se=ws;return m(),A("div",{ref_key:"buttonRef",ref:d,class:"relative"},[y(se,et(c(o),{label:c(r),onClick:k}),Uh({_:2},[c(i)?{name:"icon",fn:$(()=>[g("div",GS,[(m(),j(Ai(c(i))))])]),key:"0"}:void 0]),1040,["label"]),(m(),j(Vh,{to:"body"},[y(Ct,{name:"fade"},{default:$(()=>[c(h)?(m(),j(se,et({key:0,as:"div"},c(u),{class:"fixed text-xs px-2 py-1 rounded whitespace-nowrap z-[99999] cursor-default pointer-events-none",style:c(b),label:c(a)}),null,16,["style","label"])):ae("",!0)]),_:1})]))],512)}}}),JS={viewBox:"0 0 16 16",width:"1.2em",height:"1.2em"};function YS(s,e){return m(),A("svg",JS,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M4 4.085V10.5a2.5 2.5 0 0 0 2.336 2.495L6.5 13h4.414A1.5 1.5 0 0 1 9.5 14H6a3 3 0 0 1-3-3V5.5a1.5 1.5 0 0 1 1-1.415M11.5 2A1.5 1.5 0 0 1 13 3.5v7a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 5 10.5v-7A1.5 1.5 0 0 1 6.5 2z"},null,-1)]))}const Ih=pe({name:"fluent-copy-16-filled",render:YS}),XS={class:"flex flex-col field-gap"},e7={class:"cui-label"},t7={class:"cui-label"},s7={class:"cui-label"},n7={key:0,class:"flex flex-col field-gap"},r7={class:"cui-label"},i7={key:1,class:"flex flex-col field-gap"},o7={class:"cui-label"},a7=Et({__name:"CameraSource",props:{cameraName:{},source:{},loading:{type:Boolean}},setup(s){const e=new Wn,t=s,{cameraName:n,source:r,loading:i}=Yt(t),{data:o,isFetching:a}=e.probeCameraSourceQuery(n.value,r.value.name,{video:!0,audio:!0,microphone:!0}),{copy:l}=Zh({legacy:!0}),u=te(()=>!!(i.value||a.value)),d=te(()=>{var f;return((f=o.value)==null?void 0:f.probe.consumers.filter(b=>b.format_name!=="probe").length)||0}),h=te(()=>{var k,z;const f=(k=o.value)==null?void 0:k.probe.consumers.find(L=>L.format_name==="probe"),b=(z=f==null?void 0:f.senders)==null?void 0:z.filter(L=>L.codec.codec_type==="video");return(b==null?void 0:b.map(L=>L.codec.codec_name))||[]}),v=te(()=>{var k,z;const f=(k=o.value)==null?void 0:k.probe.consumers.find(L=>L.format_name==="probe"),b=(z=f==null?void 0:f.senders)==null?void 0:z.filter(L=>L.codec.codec_type==="audio");return(b==null?void 0:b.map(L=>L.codec.codec_name))||[]});return(f,b)=>{const k=ki,z=go,L=WS,se=Aa;return m(),A(yt,null,[g("div",XS,[g("label",e7,de(f.$t("components.form.label.connections")),1),y(z,null,{default:$(()=>[y(k,{value:c(d),loading:c(u),readonly:"",type:"text"},null,8,["value","loading"])]),_:1})]),(m(!0),A(yt,null,Dt(c(h),(Z,N)=>(m(),A("div",{key:N,class:"flex flex-col field-gap"},[g("label",t7,de(f.$t("components.form.label.video_codec")),1),y(z,null,{default:$(()=>[y(k,{"model-value":Z,loading:c(u),readonly:"",type:"text"},null,8,["model-value","loading"])]),_:2},1024)]))),128)),(m(!0),A(yt,null,Dt(c(v),(Z,N)=>(m(),A("div",{key:N,class:"flex flex-col field-gap"},[g("label",s7,de(f.$t("components.form.label.audio_codec")),1),y(z,null,{default:$(()=>[y(k,{"model-value":Z,loading:c(u),readonly:"",type:"text"},null,8,["model-value","loading"])]),_:2},1024)]))),128)),c(r).role!=="snapshot"?(m(),A("div",n7,[g("label",r7,de(f.$t("components.form.label.rtsp_url")),1),y(z,null,{default:$(()=>{var Z;return[y(k,{"model-value":(Z=c(o))==null?void 0:Z.rtspUrl,loading:c(u),readonly:"",type:"text"},null,8,["model-value","loading"]),y(se,null,{default:$(()=>{var N;return[y(L,{"action-text":f.$t("components.form.tooltip.copied"),icon:c(Ih),"button-props":{severity:"secondary",disabled:!((N=c(o))!=null&&N.rtspUrl),loading:c(u),text:!0},onAction:b[0]||(b[0]=E=>c(l)(c(o).rtspUrl))},null,8,["action-text","icon","button-props"])]}),_:1})]}),_:1})])):ae("",!0),c(r).role!=="snapshot"?(m(),A("div",i7,[g("label",o7,de(f.$t("components.form.label.onvif_url")),1),y(z,null,{default:$(()=>{var Z;return[y(k,{"model-value":(Z=c(o))==null?void 0:Z.onvifUrl,loading:c(u),readonly:"",type:"text"},null,8,["model-value","loading"]),y(se,null,{default:$(()=>{var N;return[y(L,{"action-text":f.$t("components.form.tooltip.copied"),icon:c(Ih),"button-props":{severity:"secondary",disabled:!((N=c(o))!=null&&N.onvifUrl),loading:c(u),text:!0},onAction:b[1]||(b[1]=E=>c(l)(c(o).onvifUrl))},null,8,["action-text","icon","button-props"])]}),_:1})]}),_:1})])):ae("",!0)],64)}}}),c7={class:"flex gap-2 items-center w-full"},l7={class:"text-color font-normal"},u7={class:"flex flex-col gap-6"},d7=["for"],h7=["for"],m7={class:"flex items-center gap-4"},p7={class:"flex flex-col field-switch-gap"},f7=["for"],g7={class:"flex items-center gap-4"},v7={class:"flex flex-col field-switch-gap"},_7=["for"],y7={class:"flex items-center gap-4"},b7={class:"flex flex-col field-switch-gap"},w7=["for"],x7={class:"flex flex-col gap-6"},S7=["for"],C7={class:"w-full flex items-center justify-center my-3"},k7=Et({__name:"Sources",props:Qn({camera:{},cameraDevice:{},loading:{type:Boolean},latestSnapshotSrc:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:Qn(["close"],["update:modelValue"]),setup(s,{emit:e}){const t=Rr(s,"modelValue"),n=s,{camera:r,loading:i}=Yt(n),o=ce(["high-resolution","mid-resolution","low-resolution","snapshot"]),a=h=>{t.value.sources[h].urls.push("")},l=h=>{t.value.sources.splice(h,1)},u=(h,v)=>{t.value.sources[h].urls.splice(v,1)},d=()=>{t.value&&t.value.sources.push({_id:"",name:"",role:null,urls:[],useForSnapshot:!1,hotMode:!0,preload:!0})};return(h,v)=>{const f=_o,b=ws,k=Xc,z=ki,L=go,se=a7,Z=Wc,N=Gc,E=fo,O=Aa,U=el,S=Yc,M=Jc,B=bp;return m(),A(yt,null,[y(M,{multiple:"",class:"p-4"},{default:$(()=>[(m(!0),A(yt,null,Dt(t.value.sources,(K,R)=>(m(),j(S,{key:R,value:R},{default:$(()=>[y(k,{class:ct({"px-0 pt-0":R===0,"px-0":R!==0})},{default:$(()=>[g("div",c7,[g("span",l7,de(h.$t("components.camera_options.source")+": "+K.name.replace(/ /g,"_").toLowerCase()),1),y(b,{text:"",rounded:"",loading:c(i),disabled:t.value.sources.length<2,severity:"danger",class:"cui-icon-md ml-auto mr-2",onClick:w=>l(R)},{icon:$(()=>[y(f,{width:"100%",height:"100%"})]),_:2},1032,["loading","disabled","onClick"])])]),_:2},1032,["class"]),y(U,{pt:{content:{class:"px-0"}}},{default:$(()=>[g("div",u7,[y(c(Nt),{modelValue:K.name,"onUpdate:modelValue":w=>K.name=w,modelModifiers:{trim:!0},name:`sources[${R}].name`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:w,errors:H})=>[g("label",{for:`sources[${R}].name`,class:"cui-label"},de(h.$t("components.form.label.source_name")),9,d7),y(L,null,{default:$(()=>[y(z,et({ref_for:!0},w,{invalid:H.length>0,loading:c(i),readonly:c(r).sources.some(J=>J.name===K.name),type:"text"}),null,16,["invalid","loading","readonly"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].name`,class:"cui-input-error"},null,8,["name"])]),_:2},1024)]),_:2},1032,["modelValue","onUpdate:modelValue","name"]),K._id?(m(),j(se,{key:0,"camera-name":c(r).name,source:K,loading:c(i)},null,8,["camera-name","source","loading"])):ae("",!0),y(c(Nt),{"model-value":K.role,name:`sources[${R}].role`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:w,errors:H})=>[g("label",{for:`sources[${R}].role`,class:"cui-label"},de(h.$t("components.form.label.source_role")),9,h7),y(L,null,{default:$(()=>[y(Z,et({"model-value":K.role},{ref_for:!0},w,{options:c(o).filter(J=>!t.value.sources.some(q=>q.role===J&&q._id!==K._id)),invalid:H.length>0,loading:c(i),onValueChange:J=>K.role=J}),null,16,["model-value","options","invalid","loading","onValueChange"])]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].role`,class:"cui-input-error"},null,8,["name"])]),_:2},1024)]),_:2},1032,["model-value","name"]),K.role!=="snapshot"&&t.value.sources.length>1&&!t.value.sources.some(w=>(w.useForSnapshot||w.role==="snapshot")&&w._id!==K._id)?(m(),j(c(Nt),{key:1,"model-value":K.useForSnapshot,value:!0,"unchecked-value":!1,type:"checkbox",name:`sources[${R}].useForSnapshot`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:w,errors:H})=>[g("div",m7,[g("div",p7,[g("label",{for:`sources[${R}].useForSnapshot`,class:"cui-label-switch"},de(h.$t("components.form.label.use_for_snapshot")),9,f7),y(N,{severity:"secondary",variant:"simple",size:"small",class:"cui-input-switch-hint"},{default:$(()=>[Qt(de(h.$t("components.form.hint.use_for_snapshot")),1)]),_:1}),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].useForSnapshot`,class:"cui-input-switch-error"},null,8,["name"])]),_:2},1024)]),y(E,et({"model-value":K.useForSnapshot},{ref_for:!0},w,{invalid:H.length>0,loading:c(i),class:"ml-auto shrink-0",onValueChange:J=>K.useForSnapshot=J}),null,16,["model-value","invalid","loading","onValueChange"])])]),_:2},1032,["model-value","name"])):ae("",!0),K.role!=="snapshot"?(m(),j(c(Nt),{key:2,"model-value":K.hotMode,value:!0,"unchecked-value":!1,type:"checkbox",name:`sources[${R}].hotMode`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:w,errors:H})=>[g("div",g7,[g("div",v7,[g("label",{for:`sources[${R}].hotMode`,class:"cui-label-switch"},de(h.$t("components.form.label.hot_mode")),9,_7),y(N,{severity:"secondary",variant:"simple",size:"small",class:"cui-input-switch-hint"},{default:$(()=>[Qt(de(h.$t("components.form.hint.hot_mode")),1)]),_:1}),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].hotMode`,class:"cui-input-switch-error"},null,8,["name"])]),_:2},1024)]),y(E,et({"model-value":K.hotMode},{ref_for:!0},w,{invalid:H.length>0,loading:c(i),class:"ml-auto shrink-0",onValueChange:J=>K.hotMode=J}),null,16,["model-value","invalid","loading","onValueChange"])])]),_:2},1032,["model-value","name"])):ae("",!0),K.role!=="snapshot"?(m(),j(c(Nt),{key:3,"model-value":K.preload,value:!0,"unchecked-value":!1,type:"checkbox",name:`sources[${R}].preload`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:w,errors:H})=>[g("div",y7,[g("div",b7,[g("label",{for:`sources[${R}].preload`,class:"cui-label-switch"},de(h.$t("components.form.label.preload")),9,w7),y(N,{severity:"secondary",variant:"simple",size:"small",class:"cui-input-switch-hint"},{default:$(()=>[Qt(de(h.$t("components.form.hint.preload")),1)]),_:1}),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].preload`,class:"cui-input-switch-error"},null,8,["name"])]),_:2},1024)]),y(E,et({"model-value":K.preload},{ref_for:!0},w,{invalid:H.length>0,loading:c(i),class:"ml-auto shrink-0",onValueChange:J=>K.preload=J}),null,16,["model-value","invalid","loading","onValueChange"])])]),_:2},1032,["model-value","name"])):ae("",!0),g("div",x7,[g("label",{for:`sources[${R}].urls[]`,class:"cui-label"},de(h.$t("components.form.label.sources")),9,S7),(m(!0),A(yt,null,Dt(K.urls,(w,H)=>(m(),j(c(Nt),{key:H,modelValue:K.urls[H],"onUpdate:modelValue":J=>K.urls[H]=J,modelModifiers:{trim:!0},name:`sources[${R}].urls[${H}]`,as:"div",class:"flex flex-col field-gap"},{default:$(({field:J,errors:q})=>[y(L,null,{default:$(()=>[y(z,et({ref_for:!0},J,{invalid:q.length>0,loading:c(i),type:"text"}),null,16,["invalid","loading"]),K.urls.length>1?(m(),j(O,{key:0},{default:$(()=>[y(b,{text:"",severity:"secondary",loading:c(i),onClick:oe=>u(R,H)},{icon:$(()=>[y(f)]),_:2},1032,["loading","onClick"])]),_:2},1024)):ae("",!0)]),_:2},1024),y(Ct,{name:"fade"},{default:$(()=>[y(c(Ft),{name:`sources[${R}].urls[${H}]`,class:"cui-input-error"},null,8,["name"])]),_:2},1024)]),_:2},1032,["modelValue","onUpdate:modelValue","name"]))),128)),y(b,{loading:c(i),label:h.$t("components.form.button.add_source"),class:"ml-auto cui-button-medium",onClick:w=>a(R)},null,8,["loading","label","onClick"])])])]),_:2},1024)]),_:2},1032,["value"]))),128))]),_:1}),g("div",C7,[y(b,{text:"",rounded:"",loading:c(i),class:"cui-icon-xl",onClick:d},{icon:$(()=>[y(B,{width:"100%",height:"100%"})]),_:1},8,["loading"])])],64)}}}),E7={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function A7(s,e){return m(),A("svg",E7,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 2C9.76 2 7.78 3.05 6.5 4.68l9.81 9.82C17.94 13.21 19 11.24 19 9a7 7 0 0 0-7-7M3.28 4L2 5.27L5.04 8.3C5 8.53 5 8.76 5 9c0 2.38 1.19 4.47 3 5.74V17a1 1 0 0 0 1 1h5.73l4 4L20 20.72zM9 20v1a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-1z"},null,-1)]))}const M7=pe({name:"mdi-lightbulb-off",render:A7}),$7={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function T7(s,e){return m(),A("svg",$7,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M12 6a6 6 0 0 1 6 6c0 2.22-1.21 4.16-3 5.2V19a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-1.8c-1.79-1.04-3-2.98-3-5.2a6 6 0 0 1 6-6m2 15v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1zm6-10h3v2h-3zM1 11h3v2H1zM13 1v3h-2V1zM4.92 3.5l2.13 2.14l-1.42 1.41L3.5 4.93zm12.03 2.13l2.12-2.13l1.43 1.43l-2.13 2.12z"},null,-1)]))}const P7=pe({name:"mdi-lightbulb-on",render:T7}),R7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function I7(s,e){return m(),A("svg",R7,e[0]||(e[0]=[g("g",{fill:"#CFD8DC"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1)]))}const O7=pe({name:"flat-color-icons-empty-battery",render:I7}),N7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function F7(s,e){return m(),A("svg",N7,e[0]||(e[0]=[g("g",{fill:"#CFD8DC"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1),g("path",{fill:"#8BC34A",d:"M34 44H14c-1.1 0-2-.9-2-2v-9h24v9c0 1.1-.9 2-2 2"},null,-1)]))}const L7=pe({name:"flat-color-icons-low-battery",render:F7}),j7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function q7(s,e){return m(),A("svg",j7,e[0]||(e[0]=[g("g",{fill:"#CFD8DC"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1),g("path",{fill:"#8BC34A",d:"M34 44H14c-1.1 0-2-.9-2-2V23h24v19c0 1.1-.9 2-2 2"},null,-1)]))}const D7=pe({name:"flat-color-icons-middle-battery",render:q7}),B7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function z7(s,e){return m(),A("svg",B7,e[0]||(e[0]=[g("g",{fill:"#CFD8DC"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1),g("path",{fill:"#8BC34A",d:"M34 44H14c-1.1 0-2-.9-2-2V13h24v29c0 1.1-.9 2-2 2"},null,-1)]))}const U7=pe({name:"flat-color-icons-high-battery",render:z7}),V7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function H7(s,e){return m(),A("svg",V7,e[0]||(e[0]=[g("g",{fill:"#8BC34A"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1)]))}const Q7=pe({name:"flat-color-icons-full-battery",render:H7}),K7={viewBox:"0 0 48 48",width:"1.2em",height:"1.2em"};function Z7(s,e){return m(),A("svg",K7,e[0]||(e[0]=[g("g",{fill:"#8BC34A"},[g("path",{d:"M34 44H14c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h20c1.1 0 2 .9 2 2v34c0 1.1-.9 2-2 2"}),g("path",{d:"M28 13h-8c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h8c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1"})],-1),g("path",{fill:"#FFEB3B",d:"M30 24h-5.5l2.2-11L18 26h5.5l-2.2 11z"},null,-1)]))}const G7=pe({name:"flat-color-icons-charge-battery",render:Z7}),W7={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J7(s,e){return m(),A("svg",W7,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M6.5 20q-2.28 0-3.89-1.57Q1 16.85 1 14.58q0-1.95 1.17-3.48q1.18-1.53 3.08-1.95q.63-2.3 2.5-3.72Q9.63 4 12 4q2.93 0 4.96 2.04Q19 8.07 19 11q1.73.2 2.86 1.5q1.14 1.28 1.14 3q0 1.88-1.31 3.19T18.5 20Z"},null,-1)]))}const Y7=pe({name:"mdi-cloud",render:J7}),X7={key:0,class:"flex items-center justify-center h-full"},eC={key:1},tC={class:"flex flex-col p-4"},sC={class:"camera-info flex justify-between items-center text-sm"},nC={class:"font-bold"},rC={class:"flex items-center gap-2"},iC={class:"camera-info flex justify-between items-center text-sm"},oC={class:"font-bold"},aC={class:"flex items-center"},cC={key:0,class:"camera-info flex justify-between items-center text-sm"},lC={class:"font-bold"},uC={class:"flex items-center gap-2"},dC={key:0},hC={key:1,class:"camera-info flex justify-between items-center text-sm"},mC={class:"font-bold"},pC={class:"flex items-center"},fC={key:2,class:"camera-info flex justify-between items-center text-sm"},gC={class:"font-bold"},vC={class:"flex items-center"},_C={key:1},yC={key:2},bC={key:3,class:"camera-info flex justify-between items-center text-sm"},wC={class:"font-bold"},xC={class:"flex items-center"},SC={key:1},CC={key:2},kC={key:4,class:"camera-info flex justify-between items-center text-sm"},EC={class:"font-bold"},AC={class:"flex items-center"},MC={key:1},$C={key:2},TC={key:5,class:"camera-info flex justify-between items-center text-sm"},PC={class:"font-bold"},RC={class:"flex items-center"},IC={key:1},OC={key:2},NC={key:6,class:"camera-info flex justify-between items-center text-sm"},FC={class:"font-bold"},LC={class:"flex items-center"},jC={key:1},qC={key:2},DC=Et({__name:"Overview",props:{camera:{},cameraDevice:{},loading:{type:Boolean},latestSnapshotSrc:{}},emits:["close"],setup(s,{emit:e}){const t=s,{cameraDevice:n,loading:r,latestSnapshotSrc:i}=Yt(t),{cameraObject:o,hasBattery:a,hasLight:l,hasAudioDetector:u,hasDoorbell:d,hasMotionDetector:h,hasObjectDetector:v,hasSiren:f,lightState:b,batteryState:k,motionState:z,objectState:L,audioState:se,doorbellState:Z,sirenState:N}=ql(n),E=te(()=>r.value);return(O,U)=>{var Ce,F,D,Y,Te,He,ht,At,Qe,ze;const S=jr,M=jl,B=Y7,K=G7,R=Q7,w=U7,H=D7,J=L7,q=O7,oe=P7,ue=M7;return c(o)?(m(),A("div",eC,[y(M,{"camera-name":c(o).name,src:c(i),class:"w-full aspect-video bg-black","image-container-class":"w-full h-full"},null,8,["camera-name","src"]),g("div",tC,[g("div",sC,[g("span",nC,de(O.$t("components.camera_options.name")),1),g("div",rC,[g("span",null,de(c(o).name),1),c(o).isCloud?(m(),j(B,{key:0,class:"w-5 h-5"})):ae("",!0)])]),g("div",iC,[g("span",oC,de(O.$t("components.camera_options.plugin")),1),g("div",aC,[c(E)?(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"})):ae("",!0),g("span",null,de(((Ce=c(o).pluginInfo)==null?void 0:Ce.name)??O.$t("components.camera_options.native")),1)])]),c(a)?(m(),A("div",cC,[g("span",lC,de(O.$t("components.camera_options.battery_state")),1),g("div",uC,[c(k)!==void 0?(m(),A("span",dC,de(c(k).level)+"%",1)):ae("",!0),c(k)?c(k).charging?(m(),j(K,{key:2,class:"w-5 h-5"})):c(k).level===100?(m(),j(R,{key:3,class:"w-5 h-5"})):c(k).level>=75?(m(),j(w,{key:4,class:"w-5 h-5"})):c(k).level>=50?(m(),j(H,{key:5,class:"w-5 h-5"})):c(k).level>=25?(m(),j(J,{key:6,class:"w-5 h-5"})):(m(),j(q,{key:7,class:"w-5 h-5"})):(m(),j(S,{key:1,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(l)?(m(),A("div",hC,[g("span",mC,de(O.$t("components.camera_options.light_state")),1),g("div",pC,[c(b)?c(b).state?(m(),j(oe,{key:1,class:"text-yellow-400 w-5 h-5"})):(m(),j(ue,{key:2,class:"text-muted w-5 h-5"})):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(u)?(m(),A("div",fC,[g("span",gC,de(O.$t("components.camera_options.audio_state")),1),g("div",vC,[c(se)?c(se).state||(F=c(se).lastEvent)!=null&&F.state?(m(),A("span",_C,de(c(zi)(c(se).state?c(se).timestamp:c(se).lastEvent.timestamp,"DD.MM.YYYY, HH:mm:ss")),1)):(m(),A("span",yC,"-")):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(d)?(m(),A("div",bC,[g("span",wC,de(O.$t("components.camera_options.doorbell_state")),1),g("div",xC,[c(Z)?c(Z).state||(D=c(Z).lastEvent)!=null&&D.state?(m(),A("span",SC,de(c(zi)(c(Z).state?c(Z).timestamp:c(Z).lastEvent.timestamp,"DD.MM.YYYY, HH:mm:ss")),1)):(m(),A("span",CC,"-")):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(h)?(m(),A("div",kC,[g("span",EC,de(O.$t("components.camera_options.motion_state")),1),g("div",AC,[c(z)?c(z).state||(Y=c(z).detections)!=null&&Y.length||(Te=c(z).lastEvent)!=null&&Te.state||(ht=(He=c(z).lastEvent)==null?void 0:He.detections)!=null&&ht.length?(m(),A("span",MC,de(c(zi)(c(z).state||(At=c(z).detections)!=null&&At.length?c(z).timestamp:c(z).lastEvent.timestamp,"DD.MM.YYYY, HH:mm:ss")),1)):(m(),A("span",$C,"-")):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(v)?(m(),A("div",TC,[g("span",PC,de(O.$t("components.camera_options.object_state")),1),g("div",RC,[c(L)?c(L).detections.length||(Qe=c(L).lastEvent)!=null&&Qe.detections.length?(m(),A("span",IC,de(c(zi)(c(L).detections.length?c(L).timestamp:c(L).lastEvent.timestamp,"DD.MM.YYYY, HH:mm:ss")),1)):(m(),A("span",OC,"-")):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0),c(f)?(m(),A("div",NC,[g("span",FC,de(O.$t("components.camera_options.siren_state")),1),g("div",LC,[c(N)?c(N).state||(ze=c(N).lastEvent)!=null&&ze.state?(m(),A("span",jC,de(c(zi)(c(N).state?c(N).timestamp:c(N).lastEvent.timestamp,"DD.MM.YYYY, HH:mm:ss")),1)):(m(),A("span",qC,"-")):(m(),j(S,{key:0,"stroke-width":"5",class:"w-[30px] h-[30px]"}))])])):ae("",!0)])])):(m(),A("div",X7,[y(S,{"stroke-width":"5",class:"w-[30px] h-[30px]"})]))}}}),BC=qs(DC,[["__scopeId","data-v-95baba33"]]),zC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function UC(s,e){return m(),A("svg",zC,e[0]||(e[0]=[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},[g("path",{"stroke-width":"3",d:"M5 10h.01M5 16h.01"}),g("path",{"stroke-width":"2",d:"m10 17l4-10m2 10l4-10"})],-1)]))}const VC=pe({name:"humbleicons-url",render:UC}),HC={class:"flex items-center w-full h-[45px] border-b-[1px] border-color px-3"},QC={class:"font-semibold text-lg truncate"},KC=["onClick"],ZC={class:"text-xs truncate"},GC={class:"w-full h-full max-h-full overflow-y-scroll"},WC={key:0,class:"flex w-full h-full items-center justify-center mt-5"},JC={key:1,class:"w-full h-full"},YC={key:0,class:"w-full flex items-center justify-center p-4 h-[70px]"},XC=Et({__name:"CameraOptions",props:{cameraName:{},latestSnapshotSrc:{}},emits:["close"],setup(s,{emit:e}){const t=new Wn,n=Cn(),{t:r}=js(),i=e,o=s,{cameraName:a,latestSnapshotSrc:l}=Yt(o),u=Vt("formRef"),d=Ls(),h=ce(),v=ce("overview"),f=ce([{name:"overview",icon:Vc},{name:"sources",icon:VC},{name:"settings",icon:Sa},{name:"plugins",icon:Hc}]),{data:b,isFetching:k,suspense:z}=t.getCameraQuery(a),{mutate:L,isPending:se}=t.patchCameraQuery(),Z=te(()=>k.value||se.value),N=te(()=>v.value==="sources"||v.value==="settings");Ke(b,O=>{O&&(h.value=Si(O))},{deep:!0,immediate:!0});const E=async()=>{var U;const O=await((U=u.value)==null?void 0:U.validate());O!=null&&O.valid&&O.values?L({cameraname:a.value,cameraData:O.values}):(n.add({severity:"error",summary:r("components.toast.title_error"),detail:r("components.toast.validation_failed"),life:3e3}),console.log("Validation failed",O))};return Sn(async()=>{if(await z(),!b.value)return;const O=await kp();d.value=await O.deviceManager.getCamera(b.value.name)}),Ma(()=>{var O;(O=d.value)==null||O.close()}),(O,U)=>{const S=_o,M=ws,B=L0,K=F0,R=jr,w=BC,H=k7,J=ZS,q=V3,oe=Bh,ue=Dh,Ce=qh;return m(),A(yt,null,[g("div",HC,[g("span",QC,de(c(a)),1),y(M,{text:"",rounded:"",severity:"secondary",class:"ml-auto cui-icon-md shrink-0",onClick:U[0]||(U[0]=F=>i("close"))},{icon:$(()=>[y(S,{width:"100%",height:"100%"})]),_:1})]),y(c(al),{ref_key:"formRef",ref:u,class:"w-full",style:at({height:`calc(100% - 45px - ${c(N)?"70px":"0px"})`}),"validation-schema":c(Qx)},{default:$(()=>[y(Ce,{value:c(v),"onUpdate:value":U[7]||(U[7]=F=>ps(v)?v.value=F:null),scrollable:"",class:"w-full h-full"},{default:$(()=>[y(K,{class:"justify-between",pt:{tablist:{class:"h-[65px]"},activeBar:{class:"!w-auto"}}},{default:$(()=>[(m(!0),A(yt,null,Dt(c(f),(F,D)=>(m(),j(B,{key:D,value:F.name,"as-child":""},{default:$(Y=>[g("div",et({ref_for:!0},Y.a11yAttrs,{class:["flex flex-col items-center justify-center flex-1 content-background !py-3",[{"hover:!text-color active:!text-color focus:!text-color":!Y.active},Y.class]],onClick:Y.onClick}),[(m(),j(Ai(F.icon),{class:"w-5 h-5"})),g("span",ZC,de(O.$t(`components.options_sidebar.segment_tab_${F.name}`)),1)],16,KC)]),_:2},1032,["value"]))),128))]),_:1}),y(ue,{class:"p-0 h-[calc(100%-65px)]"},{default:$(()=>[g("div",GC,[(m(!0),A(yt,null,Dt(c(f),(F,D)=>(m(),j(oe,{key:D,value:F.name,"as-child":""},{default:$(Y=>[Y.active?(m(),A("div",et({key:0,class:Y.class},{ref_for:!0},Y.a11yAttrs),[!c(h)||!c(b)||!c(d)?(m(),A("div",WC,[y(R,{"stroke-width":"5",class:"w-[30px] h-[30px]"})])):(m(),A("div",JC,[c(v)==="overview"?(m(),j(w,{key:0,camera:c(b),"camera-device":c(d),loading:c(Z),"latest-snapshot-src":c(l),onClose:U[1]||(U[1]=Te=>i("close"))},null,8,["camera","camera-device","loading","latest-snapshot-src"])):ae("",!0),c(v)==="sources"?(m(),j(H,{key:1,modelValue:c(h),"onUpdate:modelValue":U[2]||(U[2]=Te=>ps(h)?h.value=Te:null),camera:c(b),"camera-device":c(d),loading:c(Z),onClose:U[3]||(U[3]=Te=>i("close"))},null,8,["modelValue","camera","camera-device","loading"])):ae("",!0),c(v)==="settings"?(m(),j(J,{key:2,modelValue:c(h),"onUpdate:modelValue":U[4]||(U[4]=Te=>ps(h)?h.value=Te:null),camera:c(b),"camera-device":c(d),loading:c(Z),onClose:U[5]||(U[5]=Te=>i("close"))},null,8,["modelValue","camera","camera-device","loading"])):ae("",!0),c(v)==="plugins"?(m(),j(q,{key:3,camera:c(b),"camera-device":c(d),loading:c(Z),onClose:U[6]||(U[6]=Te=>i("close"))},null,8,["camera","camera-device","loading"])):ae("",!0)]))],16)):ae("",!0)]),_:2},1032,["value"]))),128))])]),_:1})]),_:1},8,["value"]),c(N)?(m(),A("div",YC,[y(M,{fluid:"",severity:"success",class:"cui-button-medium",label:O.$t("components.form.button.save"),onClick:E},null,8,["label"])])):ae("",!0)]),_:1},8,["style","validation-schema"])],64)}}}),ek={class:"w-full h-full p-safe !pb-0 md:!pl-0"},tk={class:"w-full h-full border-0 md:border-r-[1px] border-color overflow-y-auto pb-safe"},sk=Et({__name:"CuiCameraDrawer",setup(s){const e=Dr(),t=Cp(),n=t.getEventBus(),r=ce(!1),i=ce(),o=ce(),a=te(()=>Sp.pt);Ke(e.currentRoute,(u,d)=>{u.path!==d.path&&t.close()});const l=()=>{r.value=!1,t.close()};return Sn(()=>{n.on(u=>{u.type==="open"?(i.value=u.options,o.value=u.props,r.value=!0):u.type==="close"&&(r.value=!1,i.value=void 0)})}),(u,d)=>{const h=XC,v=j0;return m(),j(v,et({visible:c(r),"onUpdate:visible":d[0]||(d[0]=f=>ps(r)?r.value=f:null)},c(o),{class:"border-0 md:border-l-[1px]",pt:c(a),onHide:l}),{container:$(({closeCallback:f})=>[g("div",ek,[g("div",tk,[c(i)?(m(),j(h,et({key:0},c(i),{onClose:f}),null,16,["onClose"])):ae("",!0)])])]),_:1},16,["visible","pt"])}}}),nk={class:"loader flex flex-col justify-center items-center"},rk={key:0,class:"absolute flex flex-col items-center justify-center pb-safe bottom-10"},ik={key:0,class:"offline"},ok={key:1,class:"text-center text-white text-sm font-bold mt-2"},ak=Et({__name:"CuiLoadingScreen",props:{reload:{type:Boolean,default:!1},height:{default:"200px"},width:{default:"200px"},text:{},icon:{}},setup(s){const e=s,{reload:t,width:n,height:r,text:i,icon:o}=Yt(e);let a,l;const u=()=>{clearInterval(a),clearTimeout(l)};return Sn(()=>{u(),t.value&&(a=setInterval(()=>{const d=document.getElementById("lens");d==null||d.classList.remove("cameraLens");const h=document.getElementById("CameraUI_U");h==null||h.classList.remove("cameraLetter"),l=setTimeout(()=>{d==null||d.classList.add("cameraLens"),h==null||h.classList.add("cameraLetter")},100)},2300))}),vo(()=>{u()}),(d,h)=>(m(),A("div",nk,[y(c($a),{src:c(Fr)("logo_loading_circle.svg"),width:c(n),height:c(r),title:"camera.ui","aria-label":"camera.ui"},null,8,["src","width","height"]),c(o)||c(i)?(m(),A("div",rk,[c(o)?(m(),A("div",ik,[(m(),j(Ai(c(o)),{class:"w-8 h-8 text-primary"}))])):ae("",!0),c(i)?(m(),A("div",ok,de(c(i)),1)):ae("",!0)])):ae("",!0)]))}}),ck=qs(ak,[["__scopeId","data-v-d2a6a09b"]]),lk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function uk(s,e){return m(),A("svg",lk,e[0]||(e[0]=[g("path",{fill:"currentColor",d:"M10 3h8l-4 6h4L6 21l4-9H6z"},null,-1)]))}const dk=pe({name:"gridicons-offline",render:uk}),hk={components:{camera_draggable:{no_cameras:"Keine Kameras verfügbar"},camera_events:{no_events:"Keine Ereignisse verfügbar"},camera_options:{advanced:"Erweitert",audio_state:"Audiozustand",battery_state:"Batteriezustand",branding:"Branding",categories:"Kategorien",chip_audioDetection:"Geräuscherkennung",chip_cameraController:"Kamera",chip_hub:"Hub",chip_more:"Mehr",chip_motionDetection:"Bewegungserkennung",chip_objectDetection:"Objekterkennung",chip_plugins:"Plugins",chip_ptz:"PTZ",detection:"Erkennung",doorbell_state:"Türklingelzustand",enabled_extension:"Aktivierte Erweiterung",frame_worker:"Frame Worker",general:"Allgemein",interface:"Interface",light_state:"Lichtzustand",manage_plugins:"Plugins verwalten",model:"Modell",more_plugins:"Mehr Plugins",motion_detection:"Bewegungserkennung",motion_state:"Bewegungszustand",name:"Name",native:"Nativ",no_config:"Keine Konfiguration verfügbar",no_plugins_enabled:"Keine Plugins aktiviert",no_plugins_found:"Keine Plugins gefunden",object_detection:"Objekterkennung",object_state:"Objektzustand",plugin:"Plugin",plugin_settings:"Plugin Einstellungen",recordings:"Aufnahmeeinstellungen",settings:"Einstellungen",siren_state:"Sirenenzustand",source:"Quelle",snapshot:"Snapshot",streaming_mode:"Streaming Modus",unknown:"Unbekannt",zones:"Zonen"},camera_table:{cameras:"Kameras",name:"Name",offline:"Offline",online:"Online",status:"Status"},charts:{no_data:"Keine Daten verfügbar"},detection_interface:{audio_detected:"Audio erkannt",audio_not_detected:"Audio nicht erkannt",audio_required:"Audio Datei erforderlich",detect:"Erkennen",drop_or_select_audio_to_detect:"Audio ablegen oder auswählen, um Geräusche zu erkennen",drop_or_select_image_to_detect_objects:"Bild ablegen oder auswählen, um Objekte zu erkennen",drop_or_select_video_to_detect_motion:"Video ablegen oder auswählen, um Bewegung zu erkennen",file_size_error:"Dateigröße zu groß",image_required:"Image required",interface_config:"Interface-Konfiguration",no_interface_config:"Keine Interface-Konfiguration verfügbar",only_one_audio_allowed:"Es ist nur ein Audio erlaubt",only_one_image_allowed:"Es ist nur ein Bild erlaubt",only_one_video_allowed:"Es ist nur ein Video erlaubt",video_required:"Video required"},dialog:{components:{new_camera:{add_camera:"Kamera hinzufügen",add_camera_description:"Fügen Sie eine Kamera hinzu, die mit Ihrem lokalen Netzwerk verbunden ist",camera:"Kamera",discover_cameras:"Kameras suchen",discover_cameras_description:"Suchen Sie nach Kameras in Ihrem lokalen Netzwerk",no_cameras_found:"Keine Kameras gefunden",protocol_info:"Informationen zum gewählten Protokoll",scan_again:"Erneut scannen",search_camera:"Kamera suchen",source:"Quelle",test_source:"Kameraquelle testen",title:"Neue Kamera",unknown:"Unbekannt"}},message:{confirm_clear_log:"Sind Sie sicher, dass Sie das Protokoll löschen möchten?",confirm_remove:"Sind Sie sicher, dass Sie diese Kamera entfernen möchten?",confirm_remove_layout:"Sind Sie sicher, dass Sie dieses Layout entfernen möchten?",confirm_reset_server:"Sind Sie sicher, dass Sie den Server zurücksetzen möchten?",confirm_restart_go2rtc:"Sind Sie sicher, dass Sie Go2RTC neu starten möchten?",confirm_restart_plugin:"Sind Sie sicher, dass Sie dieses Plugin neu starten möchten?",confirm_restart_server:"Sind Sie sicher, dass Sie den Server neu starten möchten?",confirm_restore:"Sind Sie sicher, dass Sie dieses Backup wiederherstellen möchten?",confirm_uninstall_plugin:"Sind Sie sicher, dass Sie dieses Plugin deinstallieren möchten?",intercom_info:"Sprechen Sie gleichzeitig mit allen Kameras, die eine Sprechanlage haben"},title:{config:"Konfiguration",confirm:"Bestätigen",create_new_user:"Neuer Benuter",edit_dnd:"DND bearbeiten",edit_layout:"Layout bearbeiten",edit_user:"Benutzer bearbeiten",edit_view:"Ansicht bearbeiten",information:"Information",install:"Installieren",install_version:"Version installieren",intercom:"Gegensprechanlage",log:"Log",new_dnd:"Neue DND",new_view:"Neue Ansicht",new_zone:"Neue Zone",plugin_config:"Plugin-Konfiguration",preview:"Vorschau",remove_layout:"Layout entfernen",reset_server:"Server zurücksetzen",restart:"Neustart",result:"Ergebnis",search_plugin:"Plugin suchen",update:"Aktualisieren",unknown:"Unbekannt",zone:"Zone",zone_editor:"Zonen-Editor"}},form:{button:{add:"Hinzufügen",add_source:"Quelle hinzufügen",add_view:"Ansicht hinzufügen",back:"Zurück",cancel:"Abbrechen",change_view:"Ansicht wechseln",clear:"Löschen",close:"Schließen",continue:"Fortfahren",create_new_user:"Neuen Benutzer erstellen",download:"Herunterladen",download_backup_archive:"Backup-Archiv herunterladen",download_cert:"Zertifikat herunterladen",edit:"Bearbeiten",edit_zones:"Zonen bearbeiten",finish:"Fertig",go_to_message:"Zur Nachricht gehen",home:"Startseite",install:"Installieren",login:"Anmelden",logout:"Abmelden",logout_all:"Alle abmelden",manage:"Verwalten",mark_as_read:"Als gelesen markieren",new:"Neu",new_zone:"Neue Zone",next:"Weiter",open_editor:"Editor öffnen",previous:"Zurück",reinstall:"Neu installieren",remove:"Entfernen",reset:"Zurücksetzen",restart:"Neustarten",restore_backup_archive:"Backup-Archiv wiederherstellen",restore_and_restart:"Wiederherstellen und neustarten",save:"Speichern",save_and_restart:"Speichern und neustarten",submit:"Absenden",test_connection:"Verbindung testen",undo:"Rückgängig",uninstall:"Deinstallieren",update:"Aktualisieren",upload:"Hochladen"},error:{no_cameras_selected:"Keine Kameras ausgewählt",no_view_selected:"Keine Ansicht ausgewählt"},hint:{aspect_ratio:"Zwingt das Seitenverhältnis der Kamera auf den gewählten Wert",cache_time:"Zeit in Sekunden, die der Cache für die Kamerabilder verwendet",confidence:"Die benötigte Konfidenz für die Erkennung eines Objekts",default_settings_page:"Die Standardseite, die beim Öffnen der Einstellungen angezeigt wird",disable_camera:"Deaktiviert die Kamera und stoppt alle Aktivitäten. Die Kamera wird weiterhin angezeigt",frameworker_decoder:"Der Decoder, der für den Frame Worker verwendet wird",frameworker_fps:"Die Anzahl der Frames pro Sekunde, welche für den Frame Worker verwendet werden. '0' verwendet die native Framerate",frameworker_resolution:"Die Auflösung der Kamera, welche für den Frame Worker verwendet wird",hot_mode:"Lässt die Verbindung zur Kamera aktiv, um die Verzögerung zu minimieren",motion_duration:"Zeit in Sekunden, die die Kamera benötigt, um nach einer Bewegungserkennung wieder in den normalen Modus zurückzukehren",navbar_stay_collapsed:"Lässt die Navbar eingeklappt, auch auf größeren Bildschirmen",preload:"Vorladen der Kameraquelle, um die Verzögerung zu minimieren",remember_me:"Erlaubt, dass die Sitzung nicht abläuft",session_timer:"Die Zeit in Millisekunden, bevor die Sitzung abläuft",show_bottombar_on_mobile:"Zeigt die untere Leiste auf Mobilgeräten",show_camera_events:"Zeigt die Kameraereignisse in der Kameraansicht",single_session:"Erlaubt nur eine aktive Sitzung pro Benutzer",streaming_mode:"Stream Transport Protokoll für die Benutzeroberfläche. In 'auto' wird der beste Modus automatisch ausgewählt",streaming_source:"Kameraquelle für den Stream. In 'auto' wird die beste Quelle automatisch ausgewählt",system_preference:"Systemeinstellung für die Benutzeroberfläche",type_and_enter:"Text eingeben und mit Enter hinzufügen",use_for_snapshot:"Verwendet diese Quelle für Snapshots (wenn sonst keine geeignete Quelle existiert)"},label:{actions:"Aktionen",aspect_ratio:"Seitenverhältnis",audio_codec:"Audio-Codec",cache_time:"Cache Zeit",camera:"Kamera",cameras:"Kameras",changelog:"Änderungsprotokoll",classes:"Klassen",color:"Farbe",confidence:"Konfidenz",connections:"Verbindungen",custom_domain:"Benutzerdefinierte Domain",decoder:"Decoder",default_settings_page:"Standard Einstellungsseite",disabled:"Deaktiviert",enabled:"Aktiviert",firmware_version:"Firmware Version",fps:"FPS",frame_worker:"Frame Worker",hardware_version:"Hardware Version",hot_mode:"Hot Modus",language:"Sprache",layout_name:"Layoutname",manufacturer:"Hersteller",model:"Modell",motion_duration:"Bewegungsdauer",name:"Name",navbar_stay_collapsed:"Navbar eingeklappt lassen",new_password:"Neues Passwort",new_password_confirm:"Neues Passwort bestätigen",onvif_url:"ONVIF URL",password:"Passwort",pin:"PIN",plugin_version:"Plugin-Version",preload:"Vorladen",recording:"Aufnahme",remember_me:"Erinnere mich",remote_access_mode:"Remote Zugriffsmodus",remove_storage:"Speicher entfernen",resolution:"Auflösung",role:"Rolle",rtsp_url:"RTSP-URL",select_all:"Alle auswählen",select_cameras:"Kameras auswählen",serial_number:"Seriennummer",server_addresses:"Server-Adressen",server_version:"Server-Version",session_timer:"Sitzungstimer",settings:"Einstellungen",show_bottombar_on_mobile:"Bottombar auf Mobilgeräten anzeigen",show_camera_events:"Kameraereignisse anzeigen",single_session:"Einzelne Sitzung",source:"Quelle",source_label:"Quellenbezeichnung",source_name:"Quellenname",source_role:"Quellenrolle",sources:"Quellen",snapshot_url:"Snapshot URL",streaming_mode:"Streaming Modus",streaming_source:"Streaming Quelle",support_url:"Support URL",system_preference:"Systemeinstellung",theme:"Thema",type:"Typ",url:"URL",use_for_snapshot:"Für Snapshot verwenden",username:"Benutzername",version:"Version",video_codec:"Video-Codec",views:"Ansichten",zone_name:"Zonenname"},tooltip:{activity_mode_activity:"Aktivität",activity_mode_always_on:"Immer An",activity_mode_standby:"Standby",clear:"Säubern",contain:"Enthalten",copied:"Kopiert",delete:"Löschen",disable_drag:"Ziehen deaktivieren",disabled:"Deaktiviert",download:"Herunterladen",edit:"Bearbeiten",enable_drag:"Ziehen aktivieren",exclude:"Ausschließen",finish:"Fertig",fullscreen_off:"Vollbildmodus ausschalten",fullscreen_on:"Vollbildmodus einschalten",hide_timeline:"Zeitleiste ausblenden",include:"Einschließen",intercom:"Gegensprechanlage",intersect:"Schneiden",logout:"Abmelden",mode:"Modus",mute:"Stumm",new:"Neu",privacy_mask:"Privatsphärenmaske",public_mask:"Öffentliche Maske",resolution:"Auflösung",restart:"Neustarten",show_timeline:"Zeitleiste anzeigen",source_role_auto:"Auto",source_role_low:"Niedrige Auflösung",source_role_mid:"Mittlere Auflösung",source_role_high:"Hohe Auflösung",source_role_snapshot:"Snapshot",source_role_unknown:"Unbekannt",streaming_mode_auto:"Auto",streaming_mode_mse:"MSE",streaming_mode_unknown:"Unbekannt",streaming_mode_webrtc:"WebRTC ",undo:"Rückgängig",unmute:"Stummschalten aufheben",update_available:"Aktualisierung verfügbar",zoom_in:"Vergrößern",zoom_out:"Verkleinern"}},notification_menu:{clear_notifications:"Benachrichtigungen löschen",debug:"Debug",error:"Fehler",info:"Info",no_notifications:"Keine Benachrichtigungen",notifications:"Benachrichtigungen",short_days:"Tg.",short_hours:"Std.",short_minutes:"Min.",short_months:"M.",short_years:"J.",verbose:"Ausführlich",warn:"Warnung"},options_sidebar:{segment_tab_default:"Standard",segment_tab_overview:"Übersicht",segment_tab_plugins:"Plugins",segment_tab_settings:"Einstellungen",segment_tab_sources:"Quellen"},player:{activity_mode_activity:"Aktivität",activity_mode_always_on:"Immer An",activity_mode_standby:"Standby",add_shortcut_info:"Klicken Sie auf einen beliebigen Ort im Video, um einen Shortcut hinzuzufügen",capture_snapshot:"Snapshot aufnehmen",copied:"Kopiert",detections:"Erkennungen",hide_timeline:"Zeitleiste ausblenden",live:"Live",log:"Log",ptz:"PTZ",ptz_go_to_home:"Zurück zur Startposition",reconnecting:"Wiederverbinden...",refresh_snapshot:"Snapshot aktualisieren",settings:"Einstellungen",share_camera:"Kamera teilen",shortcuts:"Shortcuts",show_timeline:"Zeitleiste anzeigen",source_role_auto:"Auto",source_role_low:"Niedrige Auflösung",source_role_mid:"Mittlere Auflösung",source_role_high:"Hohe Auflösung",source_role_snapshot:"Snapshot",source_role_unknown:"Unbekannt",stream_info:"Stream-Informationen",stream_paused:"Stream pausiert, um Ressourcen zu schonen. Klicken Sie auf den Stream, um fortzufahren.",streaming_mode_auto:"Auto",streaming_mode_mse:"MSE",streaming_mode_unknown:"Unbekannt",streaming_mode_webrtc:"WebRTC ",zones:"Zonen",zoom_in:"Zoom rein",zoom_out:"Zoom raus"},plugin_card:{author:"Autor",installed:"Installiert",no_description:"Keine Beschreibung verfügbar",restart:"Neustart",select_version:"Version auswählen",settings:"Einstellungen",start:"Start",status_disabled:"Deaktiviert",status_error:"Fehler",status_ready:"Bereit",status_started:"Gestartet",status_starting:"Startet",status_stopped:"Gestoppt",status_unknown:"Unbekannt",stop:"Stop",uninstall:"Deinstallieren",update:"Aktualisieren",update_available:"Aktualisierung verfügbar",updated:"Aktualisiert",version:"Version"},plugin_search:{plugins:"Plugins",refresh:"Aktualisieren"},plugin_types:{hub:"Hub",cameraController:"Kamera-Controller",motionDetection:"Bewegungserkennung",objectDetection:"Objekterkennung",audioDetection:"Geräuscherkennung",ptz:"PTZ"},process_table:{status_error:"Fehler",status_ready:"Bereit",status_started:"Gestartet",status_starting:"Startet",status_stopped:"Gestoppt",status_stopping:"Stoppt",status_unknown:"Unbekannt",system:"System",title_cpu:"CPU",title_cpu_load:"CPU-Auslastung",title_memory:"Speicher",title_memory_load:"Speicherauslastung",title_name:"Name",title_pid:"PID"},timeline:{live:"Live"},topbar:{syncing_data:"Daten synchronisieren..."},toast:{backup_downloaded:"Backup-Datei erfolgreich heruntergeladen",backup_restored:"Backup-Datei erfolgreich wiederhergestellt",camera_added:"Kamera erfolgreich hinzugefügt",camera_removed:"Kamera erfolgreich entfernt",camera_updated:"Kamera erfolgreich aktualisiert",cameras_removed:"Kameras erfolgreich entfernt",config_deleted:"Konfiguration erfolgreich gelöscht",config_go2rtc_deleted:"Go2RTC-Konfiguration erfolgreich gelöscht",config_go2rtc_updated:"Go2RTC-Konfiguration erfolgreich aktualisiert",config_updated:"Konfiguration erfolgreich aktualisiert",error_see_console:"Fehler, siehe Konsole",frame_worker_restarted:"Frame Worker erfolgreich neugestartet",go2rtc_restarted:"Go2RTC erfolgreich neugestartet",log_cleared:"Log erfolgreich gelöscht",no_version_selected:"Keine Version ausgewählt",plugin_config_updated:"Plugin-Konfiguration erfolgreich aktualisiert",plugin_disabled:"Plugin erfolgreich deaktiviert",plugin_enabled:"Plugin erfolgreich aktiviert",plugin_installed:"Plugin erfolgreich installiert",plugin_removed:"Plugin erfolgreich entfernt",plugin_request_sent:"Plugin-Anfrage erfolgreich gesendet",plugin_restarted:"Plugin erfolgreich neugestartet",plugin_settings_updated:"Plugin-Einstellungen erfolgreich aktualisiert",plugin_started:"Plugin erfolgreich gestartet",plugin_stopped:"Plugin erfolgreich gestoppt",plugins_removed:"Plugins erfolgreich entfernt",profile_updated:"Profil erfolgreich aktualisiert",server_resetted:"Server erfolgreich zurückgesetzt",server_restarted:"Server erfolgreich neugestartet",server_updated:"Server erfolgreich aktualisiert",title_error:"Fehler",title_info:"Info",title_success:"Erfolgreich",title_warn:"Warnung",user_added:"Benutzer erfolgreich hinzugefügt",user_logged_out:"Benutzer erfolgreich abgemeldet",user_removed:"Benutzer erfolgreich entfernt",user_updated:"Benutzer erfolgreich aktualisiert",users_removed:"Benutzer erfolgreich entfernt",view_added:"Ansicht erfolgreich hinzugefügt",validation_failed:"Validierung fehlgeschlagen. Überprüfen Sie die Konsole für weitere Informationen",view_removed:"Ansicht erfolgreich entfernt",view_updated:"Ansicht erfolgreich aktualisiert",views_removed:"Ansichten erfolgreich entfernt",zone_updated:"Zone erfolgreich aktualisiert",zone_removed:"Zone erfolgreich entfernt"},upload_files:{drop_or_select_file:"Datei ablegen oder auswählen",only_one_file_allowed:"Es ist nur eine Datei erlaubt"},user_menu:{account:"Konto",admin_panel:"Admin Panel",config:"Konfiguration",console:"Logs",logout:"Abmelden",plugins:"Plugins",reload:"Neu laden"},user_table:{title_address:"Adresse",title_device:"Gerät",title_username:"Benutzername",you:"Du"},view_box:{available_streams:"Verfügbare Streams"},zone_editor:{edit_zones:"Zonen bearbeiten",zone:"Zone"}},general:{loading:"Laden...",role_admin:"Admin",role_user:"Benutzer"},navigation:{account:"Konto",adminpanel:"Admin-Panel",appearance:"Erscheinungsbild",backup:"Backup",cameras:"Kameras",cammesh:"Cammesh",camview:"Kameransicht",config:"Konfiguration",console:"Logs",extras:"Extras",nvr:"NVR",plugins:"Plugins",recordings:"Aufnahmen",remote:"Remote Zugriff",settings:"Einstellungen",system:"System",user:"Benutzer"},navigation_description:{account_description:"Verwalten Sie Kontoeinstellungen und Erfahrungen.",appearance_description:"Verwalten Sie das Erscheinungsbild und die Benutzeroberfläche der App.",backup_description:"Verwalten, planen Sie Backups und stellen Sie Daten wieder her.",nvr_description:"Verwalten Sie das Netzwerk-Videorekorder-System.",recordings_description:"Verwalten Sie Aufnahmen und Speicheroptionen.",remote_access_description:"Verwalten Sie den Remote-Zugriff und die Verbindungseinstellungen.",system_description:"Verwalten Sie das System, überwachen Sie den Status und die Aufgaben.",user_description:"Verwalten Sie Benutzer, Rollen und Berechtigungen."},views:{404:{error_message:"Wir haben überall gesucht, aber diese Seite scheint Verstecken zu spielen... und sie gewinnt! Lass uns dich zurück an einen Ort bringen, der existiert."},adminpanel:{core:"Core",frameworker:"Frameworker",general:"Allgemein",logged_in_users:"Derzeit angemeldete Benutzer",plugins:"Plugins",title:"Admin Panel"},camera:{detections:"Erkennungen",timeline:"Zeitleiste",title:"Kamera"},cameras:{add_camera:"Kamera hinzufügen",events:"Ereignisse",new_camera:"Neue Kamera",no_cameras:"Keine Kameras verfügbar",title:"Kameras"},cammesh:{title:"Cammesh"},camview:{all_cameras:"Alle Kameras",cameras:"Kameras",new_dnd:"Neue DND",new_view:"Neue Ansicht",no_dnds_configured:"Keine DNDs konfiguriert",no_views_configured:"Keine Ansichten konfiguriert",title:"Camview"},config:{title:"Konfiguration"},console:{title:"Logs"},firststeps:{complete:"Fertig",enjoy:"Viel Spaß!",finish_message:"Sie haben die ersten Schritte erfolgreich abgeschlossen. Sie können nun die Anwendung nutzen.",from_backup:"Aus Backup wiederherstellen",new_installation:"Neue Installation",slogan:"Die moderne Lösung für professionelle Videoüberwachung.",start:"Start",start_message:"Bitte wählen Sie, ob Sie eine neue Installation starten oder ein Backup wiederherstellen möchten.",step_account:"Konto",step_appearance:"Erscheinungsbild",step_finish:"Fertig",step_welcome:"Willkommen",title:"Erste Schritte",welcome_to:"Willkommen bei"},login:{title:"Anmelden"},plugin:{changelog:"Änderungsprotokoll",disabled_info:"Plugin ist deaktiviert",no_cameras:"Keine Kamera verfügbar",no_changelog:"Kein Änderungsprotokoll verfügbar",no_readme:"Keine Leseanleitung verfügbar",plugin_is_disabled:"Plugin ist deaktiviert",readme:"Leseanleitung",segment_tab_cameras:"Kameras",segment_tab_interface:"Interface",segment_tab_plugins:"Plugins",segment_tab_settings:"Einstellungen",settings:"Einstellungen",title:"Plugin"},plugins:{no_plugins:"Keine Plugins verfügbar",search_plugins:"Plugins suchen",title:"Plugins"},recordings:{title:"Aufnahmen"},settings:{app:"App",available_updates:"Verfügbare Aktualisierungen",available_updates_info:"Es sind Aktualisierungen für camera.ui verfügbar.",certificate:"Zertifikat",certificate_info:"Laden Sie hier das SSL-Zertifikat der Webseite herunter. Durch das Hinzufügen dieses Zertifikats zu Ihrem Keychain oder Ihrer Zertifikatsverwaltung wird die Seite als sicher erkannt. Dies verbessert die Browsererfahrung und vermeidet Sicherheitswarnungen.",connection:"Verbindung",create_backup:"Backup erstellen",create_backup_info:"Laden Sie ein Sicherungsarchiv Ihrere gesamten camera.ui Umgebung herunter. Dadurch wird der Inhalt Ihres camera.ui Speicherungsverzeichnisses gesichert. Diesen können Sie später auf jeder Plattform wiederherstellen auf der camera.ui läuft.",edit:"Bearbeiten",interface:"Interface",locale:"Sprache",network:"Netzwerk",network_info:"Konfigurieren Sie hier die IP-Adressen, die der Server für die WebRTC-Kommunikation mit den Kameras verwendet. Diese Einstellung ermöglicht eine stabile und effiziente Verbindung zwischen Ihrem System und den angeschlossenen Kameras.",not_available_updates_info:"Ihre camera.ui Version ist auf dem neuesten Stand.",password:"Passwort",profile:"Profil",registered_users:"Registrierte Benutzer",remote_access_info:"Konfigurieren Sie hier die Remote-Zugriffseinstellungen. Diese Einstellungen ermöglichen es Ihnen, von überall auf Ihre camera.ui Umgebung zuzugreifen.",remote_access_settings:"Remote Zugriff Einstellungen",remove:"Entfernen",reset_server:"Server zurücksetzen",reset_server_info:"Durch Klicken auf diesen Button setzen Sie die Konfiguration auf die Standardwerte zurück. Dies entfernt alle Ihre Einstellungen und Daten. Diese Aktion kann nicht rückgängig gemacht werden.",restart_server:"Server neustarten",restart_server_info:"Durch Klicken auf diesen Button starten Sie den Server neu. Ein Ladebildschirm wird angezeigt, bis der Neustart abgeschlossen ist. Anschließend wird die Seite automatisch aktualisiert und steht Ihnen wieder zur Verfügung.",restore_backup:"Backup wiederherstellen",restore_backup_info:"Stellen Sie ein Sicherungsarchiv wieder her, das Sie zuvor mit camera.ui erstellt haben. Ihre camera.ui Konfiguration, Datenbank, Benutzerkonten und Medien werden wiederhergestellt.",search_by_name:"Nach Namen suchen",searching_updates:"Suche nach Aktualisierungen...",server:"Server",sheduled_backup:"Geplantes Backup",sheduled_backup_info:"Planen Sie ein Backup der aktuellen Konfiguration",status:"Status",theme:"Thema",title:"Einstellungen",title_account:"Konto",title_appearance:"Erscheinungsbild",title_backup:"Backup",title_go2rtc:"Go2RTC",title_remote:"Remote Zugriff",title_nvr:"NVR",title_recordings:"Aufnahmen",title_system:"System",title_user:"Benutzer",unknown:"Unbekannt",update_available:"Aktualisierung verfügbar",version:"Version"}}},mk={components:{camera_draggable:{no_cameras:"No cameras available"},camera_events:{no_events:"No events available"},camera_options:{advanced:"Advanced",audio_state:"Audio state",battery_state:"Battery state",branding:"Branding",categories:"Categories",chip_audioDetection:"Audio detection",chip_cameraController:"Camera",chip_hub:"Hub",chip_more:"More",chip_motionDetection:"Motion detection",chip_objectDetection:"Object detection",chip_plugins:"Plugins",chip_ptz:"PTZ",detection:"Detection",doorbell_state:"Doorbell state",enabled_extension:"Enabled extension",frame_worker:"Frame Worker",general:"General",interface:"Interface",light_state:"Light state",manage_plugins:"Manage plugins",model:"Model",more_plugins:"More plugins",motion_detection:"Motion detection",motion_state:"Motion state",name:"Name",native:"Native",no_config:"No configuration available",no_plugins_enabled:"No plugins enabled",no_plugins_found:"No plugins found",object_detection:"Object detection",object_state:"Object state",plugin:"Plugin",plugin_settings:"Plugin settings",recordings:"Recordings",settings:"Settings",siren_state:"Siren state",source:"Source",snapshot:"Snapshot",streaming_mode:"Streaming mode",unknown:"Unknown",zones:"Zones"},camera_table:{cameras:"Cameras",name:"Name",offline:"Offline",online:"Online",status:"Status"},charts:{no_data:"No data available"},detection_interface:{audio_detected:"Audio detected",audio_not_detected:"Audio not detected",audio_required:"Audio required",detect:"Detect",drop_or_select_audio_to_detect:"Drop or select audio to detect",drop_or_select_image_to_detect_objects:"Drop or select image to detect objects",drop_or_select_video_to_detect_motion:"Drop or select video to detect motion",file_size_error:"File size error",image_required:"Image required",interface_config:"Interface configuration",no_interface_config:"No interface configuration available",only_one_audio_allowed:"Es ist nur ein Audio erlaubt",only_one_image_allowed:"Only one image allowed",only_one_video_allowed:"Only one video allowed",video_required:"Video required"},dialog:{components:{new_camera:{add_camera:"Add camera",add_camera_description:"Add a camera connected to your local network",camera:"Camera",discover_cameras:"Discover cameras",discover_cameras_description:"Search for cameras in your local network",no_cameras_found:"No cameras found",protocol_info:"Information about the selected protocol",scan_again:"Scan again",search_camera:"Search camera",source:"Source",test_source:"Test camera source",title:"New camera",unknown:"Unknown"}},message:{confirm_clear_log:"Are you sure you want to clear the log?",confirm_remove:"Are you sure you want to remove this camera?",confirm_remove_layout:"Are you sure you want to remove this layout?",confirm_reset_server:"Are you sure you want to reset the server?",confirm_restart_go2rtc:"Are you sure you want to restart the Go2RTC?",confirm_restart_plugin:"Are you sure you want to restart this plugin?",confirm_restart_server:"Are you sure you want to restart the server?",confirm_restore:"Are you sure you want to restore this backup?",confirm_uninstall_plugin:"Are you sure you want to uninstall this plugin?",intercom_info:"Speak simultaneously to all cameras that have intercom"},title:{config:"Configuration",confirm:"Confirm",create_new_user:"New user",edit_dnd:"Edit DND",edit_layout:"Edit layout",edit_user:"Edit user",edit_view:"Edit view",information:"Information",install:"Install",install_version:"Install version",intercom:"Intercom",log:"Log",new_dnd:"New DND",new_view:"New view",new_zone:"New zone",plugin_config:"Plugin config",preview:"Preview",remove_layout:"Remove layout",reset_server:"Reset server",restart:"Restart",result:"Result",search_plugin:"Search plugin",update:"Update",unknown:"Unknown",zone:"Zone",zone_editor:"Zone editor"}},form:{button:{add:"Add",add_source:"Add source",add_view:"Add view",back:"Back",cancel:"Cancel",change_view:"Change view",clear:"Clear",close:"Close",continue:"Continue",create_new_user:"Create new user",download:"Download",download_backup_archive:"Download backup archive",download_cert:"Download certificate",edit:"Edit",edit_zones:"Edit zones",finish:"Finish",go_to_message:"Go to message",home:"Home",install:"Install",login:"Login",logout:"Logout",logout_all:"Logout all",manage:"Manage",mark_as_read:"Mark as read",new:"New",new_zone:"New zone",next:"Next",open_editor:"Open editor",previous:"Previous",reinstall:"Reinstall",remove:"Remove",reset:"Reset",restart:"Restart",restore_backup_archive:"Restore backup archive",restore_and_restart:"Restore and restart",save:"Save",save_and_restart:"Save and restart",submit:"Submit",test_connection:"Test connection",update:"Update",undo:"Undo",uninstall:"Uninstall",upload:"Upload"},error:{no_cameras_selected:"No cameras selected",no_view_selected:"No view selected"},hint:{aspect_ratio:"Forces the camera aspect ratio to the selected value",cache_time:"Time in seconds used for the camera image cache",confidence:"The required confidence level for object detection",default_settings_page:"The default page shown when opening settings",disable_camera:"Deactivates the camera and stops all activities. The camera will still be displayed",frameworker_decoder:"The decoder used for the frame worker",frameworker_fps:"The number of frames per second used for the frame worker. '0' uses the native frame rate",frameworker_resolution:"The camera resolution used for the frame worker",hot_mode:"Keeps the connection to the camera active to minimize delay",motion_duration:"Time in seconds the camera needs to return to normal mode after motion detection",navbar_stay_collapsed:"Keeps the navbar collapsed, even on larger screens",preload:"Preloads the camera stream to reduce delay when opening the camera view",remember_me:"Allows the session not to expire",session_timer:"Time in milliseconds before the session expires",show_bottombar_on_mobile:"Shows the bottom bar on mobile devices",show_camera_events:"Shows camera events in the camera view",single_session:"Allows only one active session per user",streaming_mode:"Stream transport protocol for the user interface. In 'auto' mode, the best mode is automatically selected",streaming_source:"Camera source for the stream. In 'auto' mode, the best source is automatically selected",system_preference:"System setting for the user interface",type_and_enter:"Type and press Enter",use_for_snapshot:"Uses this source for snapshots (if no other suitable source exists)"},label:{actions:"Actions",aspect_ratio:"Aspect ratio",audio_codec:"Audio codec",cache_time:"Cache time",camera:"Camera",cameras:"Cameras",changelog:"Changelog",classes:"Classes",color:"Color",confidence:"Confidence",connections:"Connections",custom_domain:"Custom domain",decoder:"Decoder",default_settings_page:"Default Settings page",disabled:"Disabled",enabled:"Enabled",firmware_version:"Firmware version",fps:"FPS",frame_worker:"Frame Worker",hardware_version:"Hardware version",hot_mode:"Hot mode",language:"Language",layout_name:"Layout name",manufacturer:"Manufacturer",model:"Model",motion_duration:"Motion duration",name:"Name",navbar_stay_collapsed:"Stay navbar collapsed",new_password:"New password",new_password_confirm:"Confirm new password",onvif_url:"ONVIF URL",password:"Password",pin:"PIN",plugin_version:"Plugin version",preload:"Preload",recording:"Recording",remember_me:"Remember me",remote_access_mode:"Remote access mode",remove_storage:"Remove storage",resolution:"Resolution",role:"Role",rtsp_url:"RTSP URL",select_all:"Select all",select_cameras:"Select cameras",serial_number:"Serial number",server_addresses:"Server addresses",server_version:"Server version",session_timer:"Session timer",settings:"Settings",show_bottombar_on_mobile:"Show bottombar on mobile",show_camera_events:"Show camera events",single_session:"Single Session",source:"Source",source_label:"Source label",source_name:"Source name",source_role:"Source role",sources:"Sources",snapshot_url:"Snapshot URL",streaming_mode:"Streaming mode",streaming_source:"Streaming source",support_url:"Support URL",system_preference:"System preference",theme:"Theme",type:"Type",url:"URL",use_for_snapshot:"Use for snapshot",username:"Username",version:"Version",video_codec:"Video codec",views:"Views",zone_name:"Zone name"},tooltip:{activity_mode_activity:"Activity",activity_mode_always_on:"Always On",activity_mode_standby:"Standby",clear:"Clear",contain:"Contain",copied:"Copied",delete:"Delete",disable_drag:"Disable drag",disabled:"Disabled",download:"Download",edit:"Edit",enable_drag:"Enable drag",exclude:"Exclude",finish:"Finish",fullscreen_off:"Fullscreen off",fullscreen_on:"Fullscreen on",hide_timeline:"Hide timeline",include:"Include",intercom:"Intercom",intersect:"Intersect",logout:"Logout",mode:"Mode",mute:"Mute",new:"New",privacy_mask:"Privacy mask",public_mask:"Public mask",resolution:"Resolution",restart:"Restart",show_timeline:"Show timeline",source_role_auto:"Auto",source_role_low:"Low Resolution",source_role_mid:"Mid Resolution",source_role_high:"High Resolution",source_role_snapshot:"Snapshot",source_role_unknown:"Unknown",streaming_mode_auto:"Auto",streaming_mode_mse:"MSE",streaming_mode_unknown:"Unknown",streaming_mode_webrtc:"WebRTC ",undo:"Undo",unmute:"Unmute",update_available:"Update available",zoom_in:"Zoom in",zoom_out:"Zoom out"}},notification_menu:{clear_notifications:"Clear notifications",debug:"Debug",error:"Error",info:"Info",no_notifications:"No notifications",notifications:"Notifications",short_days:"d",short_hours:"hr",short_minutes:"min",short_months:"mo",short_years:"yr",verbose:"Verbose",warn:"Warning"},options_sidebar:{segment_tab_default:"Default",segment_tab_overview:"Overview",segment_tab_plugins:"Plugins",segment_tab_settings:"Settings",segment_tab_sources:"Sources"},player:{activity_mode_activity:"Activity",activity_mode_always_on:"Always On",activity_mode_standby:"Standby",add_shortcut_info:"Click on any place in the video to add a shortcut",capture_snapshot:"Capture snapshot",copied:"Copied",detections:"Detections",hide_timeline:"Hide timeline",live:"Live",log:"Log",ptz:"PTZ",ptz_go_to_home:"Go to home",reconnecting:"Reconnecting...",refresh_snapshot:"Refresh snapshot",settings:"Settings",share_camera:"Share Camera",shortcuts:"Shortcuts",show_timeline:"Show timeline",source_role_auto:"Auto",source_role_low:"Low Resolution",source_role_mid:"Mid Resolution",source_role_high:"High Resolution",source_role_snapshot:"Snapshot",source_role_unknown:"Unknown",stream_info:"Stream info",stream_paused:"Stream paused to conserve resources. Click on stream to resume.",streaming_mode_auto:"Auto",streaming_mode_mse:"MSE",streaming_mode_unknown:"Unknown",streaming_mode_webrtc:"WebRTC ",zones:"Zones",zoom_in:"Zoom in",zoom_out:"Zoom out"},plugin_card:{author:"Author",installed:"Installed",no_description:"No description available",restart:"Restart",select_version:"Select version",settings:"Settings",start:"Start",status_disabled:"Disabled",status_error:"Error",status_ready:"Ready",status_started:"Started",status_starting:"Starting",status_stopped:"Stopped",status_unknown:"Unknown",stop:"Stop",uninstall:"Uninstall",update:"Update",update_available:"Update available",updated:"Updated",version:"Version"},plugin_search:{plugins:"Plugins",refresh:"Refresh"},plugin_types:{hub:"Hub",cameraController:"Camera Controller",motionDetection:"Motion Detection",objectDetection:"Object Detection",audioDetection:"Audio Detection",ptz:"PTZ"},process_table:{status_error:"Error",status_ready:"Ready",status_started:"Started",status_starting:"Starting",status_stopped:"Stopped",status_stopping:"Stopping",status_unknown:"Unknown",system:"System",title_cpu:"CPU",title_cpu_load:"CPU load",title_memory:"Memory",title_memory_load:"Memory load",title_name:"Name",title_pid:"PID"},timeline:{live:"Live"},topbar:{syncing_data:"Syncing data..."},toast:{backup_downloaded:"Backup file download successfully",backup_restored:"Backup file restored successfully",camera_added:"Camera added successfully",camera_removed:"Camera removed successfully",camera_updated:"Camera updated successfully",cameras_removed:"Cameras removed successfully",config_deleted:"Configuration deleted successfully",config_go2rtc_deleted:"Go2RTC configuration deleted successfully",config_go2rtc_updated:"Go2RTC configuration updated successfully",config_updated:"Configuration updated successfully",error_see_console:"Error, see console",frame_worker_restarted:"Frame worker restarted successfully",go2rtc_restarted:"Go2RTC restarted successfully",log_cleared:"Log cleared successfully",no_version_selected:"No version selected",plugin_config_updated:"Plugin configuration updated successfully",plugin_disabled:"Plugin disabled successfully",plugin_enabled:"Plugin enabled successfully",plugin_installed:"Plugin installed successfully",plugin_removed:"Plugin removed successfully",plugin_request_sent:"Plugin request send successfully",plugin_restarted:"Plugin restarted successfully",plugin_settings_updated:"Plugin settings updated successfully",plugin_started:"Plugin started successfully",plugin_stopped:"Plugin stopped successfully",plugins_removed:"Plugins removed successfully",profile_updated:"Profile updated successfully",server_resetted:"Server resetted successfully",server_restarted:"Server restarted successfully",server_updated:"Server updated successfully",title_error:"Error",title_info:"Info",title_success:"Success",title_warn:"Warning",user_added:"User added successfully",user_logged_out:"User logged out successfully",user_removed:"User removed successfully",user_updated:"User updated successfully",users_removed:"Users removed successfully",validation_failed:"Validation failed. Check console for more information",view_added:"View added successfully",view_removed:"View removed successfully",view_updated:"View updated successfully",views_removed:"Views removed successfully",zone_updated:"Zone updated successfully",zone_removed:"Zone removed successfully"},upload_files:{drop_or_select_file:"Drop or select file",only_one_file_allowed:"Only one file allowed"},user_menu:{account:"Account",admin_panel:"Adminpanel",config:"Configuration",console:"Logs",logout:"Logout",plugins:"Plugins",reload:"Reload"},user_table:{title_address:"Address",title_device:"Device",title_username:"Username",you:"You"},view_box:{available_streams:"Available streams"},zone_editor:{edit_zones:"Zonen bearbeiten",zone:"Zone"}},general:{loading:"Loading...",role_admin:"Admin",role_user:"User"},navigation:{account:"Account",adminpanel:"Adminpanel",appearance:"Appearance",backup:"Backup",cameras:"Cameras",cammesh:"Cammesh",camview:"Camview",config:"Configuration",console:"Logs",extras:"Extras",nvr:"NVR",plugins:"Plugins",recordings:"Recordings",remote:"Remote Access",settings:"Settings",system:"System",user:"Users"},navigation_description:{account_description:"Manage account settings & experience.",appearance_description:"Manage app appearance & interface.",backup_description:"Manage, schedule backups & restore data.",nvr_description:"Manage Network Video Recorder system.",recordings_description:"Manage recordings & storage options.",remote_access_description:"Manage remote access and connection settings.",system_description:"Manage system, monitor status & tasks.",user_description:"Manage users, roles & permissions."},views:{404:{error_message:"We've looked everywhere, but this page seems to be playing hide and seek... and it's winning! Let's get you back to somewhere that exists."},adminpanel:{core:"Core",frameworker:"Frameworker",general:"General",logged_in_users:"Logged in users",plugins:"Plugins",title:"Adminpanel"},camera:{detections:"Detections",timeline:"Timeline",title:"Camera"},cameras:{add_camera:"Add camera",events:"Events",new_camera:"New camera",no_cameras:"No cameras available",title:"Cameras"},cammesh:{title:"Cammesh"},camview:{all_cameras:"All cameras",cameras:"Cameras",new_dnd:"New DND",new_view:"New View",no_dnds_configured:"No DNDs configured",no_views_configured:"No views configured",title:"Camview"},config:{title:"Configuration"},console:{title:"Logs"},firststeps:{complete:"Complete",enjoy:"Enjoy!",finish_message:"You have successfully completed the first steps. You can now start using the application.",from_backup:"Restore from Backup",new_installation:"New Installation",slogan:"The modern solution for professional video surveillance.",start:"Start",start_message:"Please choose whether you want to start a new installation or restore from a backup.",step_account:"Account",step_appearance:"Appearance",step_finish:"Finish",step_welcome:"Welcome",title:"First steps",welcome_to:"Welcome to"},login:{title:"Login"},plugin:{changelog:"Changelog",disabled_info:"Plugin is disabled",no_cameras:"No cameras available",no_changelog:"No changelog available",no_readme:"No readme available",plugin_is_disabled:"Plugin is disabled",readme:"Readme",segment_tab_cameras:"Cameras",segment_tab_interface:"Interface",segment_tab_plugins:"Plugins",segment_tab_settings:"Settings",settings:"Settings",title:"Plugin"},plugins:{no_plugins:"No plugins available",search_plugins:"Search plugins",title:"Plugins"},recordings:{title:"Recordings"},settings:{app:"App",available_updates:"Available updates",available_updates_info:"Updates are available for camera.ui.",certificate:"Certificate",certificate_info:"Download the SSL certificate of the website here. By adding this certificate to your keychain or certificate management, the site is recognized as secure. This improves the browser experience and avoids security warnings.",connection:"Connection",create_backup:"Create backup",create_backup_info:"Create a backup of the current configuration. Download a backup archive of your entire camera.ui environment. This will backup the contents of your camera.ui storage directory. You can restore this later on any platform where camera.ui is running.",edit:"Edit",interface:"Interface",locale:"Locale",network:"Network",network_info:"Configure here the IP addresses the server uses for WebRTC communication with the cameras. This setting allows for a stable and efficient connection between your system and the connected cameras.",not_available_updates_info:"You are using the latest version of camera.ui",password:"Password",profile:"Profile",registered_users:"Registered users",remote_access_info:"Configure the remote access settings here. These settings allow you to access your camera.ui environment from anywhere.",remote_access_settings:"Remote access settings",remove:"Remove",reset_server:"Reset server",reset_server_info:"By clicking this button you reset the configuration to the default values. This removes all your settings and data. This action cannot be undone.",restart_server:"Restart server",restart_server_info:"By clicking this button you restart the server. A loading screen will be displayed until the restart is complete. The page will then be automatically refreshed and available to you again.",restore_backup:"Restore backup",restore_backup_info:"Restore a backup archive you previously created with camera.ui. Your camera.ui configuration, database, user accounts, and media will be restored.",search_by_name:"Search by name",searching_updates:"Searching for updates...",server:"Server",sheduled_backup:"Sheduled backup",sheduled_backup_info:"Shedule a backup of the current configuration",status:"Status",theme:"Theme",title:"Settings",title_account:"Account",title_appearance:"Appearance",title_backup:"Backup",title_go2rtc:"Go2RTC",title_nvr:"NVR",title_recordings:"Recordings",title_remote:"Remote Access",title_system:"System",title_user:"User",unknown:"Unknown",update_available:"Update available",version:"Version"}}},pk={de:hk,en:mk},fk=["af","ar","ar-ae","ar-bh","ar-dz","ar-eg","ar-iq","ar-jo","ar-kw","ar-lb","ar-ly","ar-ma","ar-om","ar-qa","ar-sa","ar-sy","ar-tn","ar-ye","as","ast","az","be","bg","bn","br","bs","ca","ce","ch","co","cr","cs","cv","cy","da","de","de-at","de-ch","de-de","de-li","de-lu","el","en","en-au","en-bz","en-ca","en-gb","en-ie","en-jm","en-nz","en-ph","en-tt","en-us","en-za","en-zw","eo","es","es-ar","es-bo","es-cl","es-co","es-cr","es-do","es-ec","es-es","es-gt","es-hn","es-mx","es-ni","es-pa","es-pe","es-pr","es-py","es-sv","es-uy","es-ve","et","eu","fa","fa-ir","fi","fj","fo","fr","fr-be","fr-ca","fr-ch","fr-fr","fr-lu","fr-mc","fur","fy","ga","gd","gd-ie","gl","gu","he","hi","hr","hsb","ht","hu","hy","id","is","it","it-ch","iu","ja","ji","ka","kk","km","kn","ko","ko-kp","ko-kr","ks","ky","la","lb","lt","lv","mi","mk","ml","mo","mr","ms","mt","my","nb","ne","ng","nl","nl-be","nn","no","nv","oc","om","or","pa","pa-in","pa-pk","pl","pt","pt-br","qu","rm","ro","ro-mo","ru","ru-mo","sa","sb","sc","sd","sg","si","sk","sl","so","sq","sr","sv","sv-fi","sv-sv","sw","sx","sz","ta","te","th","tig","tk","tlh","tn","tr","ts","tt","uk","ur","ve","vi","vo","wa","xh","zh","zh-cn","zh-hk","zh-sg","zh-tw","zu"],Ca="en",Ap=["de","en"],gk=s=>{var t;const e=n=>vk(fk.find(r=>r===(n==null?void 0:n.toLowerCase())));return(t=window.navigator)!=null&&t.language?e(window.navigator.language):e("en")},vk=s=>{if(!s)return Ca;switch(s){case Ap.find(e=>e===s):return s;default:return Ca}},_k=df({locale:gk(),fallbackLocale:Ca,legacy:!1,globalInjection:!0,messages:pk}),yk={de:Mf,en:Af},bk=Mi("locale",()=>{const s=nl("locale",Ca),e=ce(Ap),t=$f(),n=js();Ke(s,o=>{r(o),i(o)});const r=o=>{var a;(a=window.electron)==null||a.send("change-language",o),n.locale.value=o},i=async o=>{const a=yk[o];a&&(t.config.locale=a)};return r(s.value),i(s.value),{languages:e,locale:s,setI18Nlocale:r,setPrimeVueLocale:i}}),wk={key:1},xk=Et({__name:"App",setup(s){const{navbarState:e,subbarState:t,showBottombar:n,showNavbar:r,showTopbar:i}=La(),o=Ci(),a=$i(),l=Dr(),u=Cn(),d=Ll(),h=up(),v=Fs(),f=Rl(),{mdBreakpoint:b}=Hr(),{isPWA:k}=Fl(),{t:z}=js();bk();const{theme:L}=Vs(d),{routerLoading:se}=Vs(h),{isLoggedIn:Z}=Vs(v),{isConnected:N}=Vs(f),E=Vt("navbarRef"),O=Vt("topbarRef"),U=Vt("bottombarRef"),S=ce(!0),M=ce(!0),B=Ls(),K=ce(!1),R=ce(!1),w=ii(E),H=ii(O),J=ii(U);o.setDefaultOptions({queries:{refetchOnWindowFocus:!1,gcTime:5*60*1e3,staleTime:1e4,networkMode:"always",retry:(F,D)=>{var Y,Te,He;if(D instanceof uf&&((Y=D.response)==null?void 0:Y.status)===401)return Fs().logout(),!1;if(F===0){const ht=((He=(Te=D.response)==null?void 0:Te.data)==null?void 0:He.message)??D.message??D;u.add({severity:"error",summary:z("components.toast.title_error"),detail:ht,life:3e3}),console.error(ht)}return F<2}},mutations:{retry:0,networkMode:"always",onError:F=>{var Y,Te,He,ht;const D=((Te=(Y=F.response)==null?void 0:Y.data)==null?void 0:Te.message)??F.message??F;u.add({severity:"error",summary:z("components.toast.title_error"),detail:D,life:3e3}),console.error(((ht=(He=F.response)==null?void 0:He.data)==null?void 0:ht.message)??F.message??F)}}});const q=te(()=>{var Y,Te;let F="var(--ground-background)";const D=Xs((Y=a==null?void 0:a.meta.ui)==null?void 0:Y.background);return(Te=a==null?void 0:a.meta.ui)!=null&&Te.showTopbar?F="var(--topbar-background)":D&&(F=D),F}),oe=te(()=>{var Y,Te;const F=O.value?`${H.height.value}px`:"env(safe-area-inset-top, 0px)",D=U.value?`${J.height.value}px`:Xs((Te=(Y=a.meta.ui)==null?void 0:Y.containerSettings)==null?void 0:Te.ignoreSafeAreaBottom)?"0px":"env(safe-area-inset-bottom, 0px)";return k.value?`calc(100vh - ${F} - ${D})`:`calc(100dvh - ${F} - ${D})`}),ue=te(()=>{var F;return((F=a.meta.auth)==null?void 0:F.requiresAuth)&&!Z.value||S.value});Ke(M,(F,D)=>{D===!1&&F===!0&&o.refetchQueries()}),Ke(Z,F=>{F?B.value=f.connect():(B.value=void 0,f.disconnect())},{immediate:!0}),Ke(N,F=>{Z.value?M.value=F:M.value=!0}),Ke(se,F=>{const{isLoading:D}=cf(0,{parent:"body"});D.value=F},{immediate:!0}),Ke([q,L],()=>{Zs(()=>{var D,Y;if(/^var\([^)]+\)$/.test(q.value)){const Te=window.getComputedStyle(document.body),He=q.value.split("var(")[1].split(")")[0],ht=Te.getPropertyValue(He);(D=document.querySelector('meta[name="theme-color"]'))==null||D.setAttribute("content",ht)}else(Y=document.querySelector('meta[name="theme-color"]'))==null||Y.setAttribute("content",q.value)})},{immediate:!0}),Ke(a,F=>{var D,Y;Xs((Y=(D=F.meta.ui)==null?void 0:D.containerSettings)==null?void 0:Y.disableScroll)?(document.body.classList.add("disable-overflow-scroll"),document.documentElement.classList.add("disable-overflow-scroll")):(document.body.classList.remove("disable-overflow-scroll"),document.documentElement.classList.remove("disable-overflow-scroll"))},{immediate:!0,deep:!0});const Ce=()=>{const F=document.querySelector('meta[name="electron-server"]'),D=F!==null&&F.getAttribute("content")==="true";K.value=window.electron!==void 0,R.value=D,setTimeout(()=>{K.value=window.electron!==void 0,R.value=D},100)};return Sn(async()=>{await l.isReady(),S.value=!1,Ce()}),(F,D)=>{var wt,zt,it,es,Be,Ue,V,X,_e,ye,fe;const Y=ck,Te=q0,He=D0,ht=B0,At=sk,Qe=tw,ze=Db,ve=Fb,ft=Ei("RouterView"),Xt=e1;return c(ue)||!c(M)?(m(),A("div",{key:0,class:"flex w-full h-full justify-center items-center absolute z-50",style:at({minHeight:c(k)?"100vh !important":"100dvh !important"})},[y(Y,{reload:"",icon:!c(M)&&c(Z)?c(dk):void 0},null,8,["icon"])],4)):(m(),A("div",wk,[y(Te,{position:"bottom-right"}),y(He),y(ht),y(At),c(i)?(m(),j(Qe,{key:0,ref_key:"topbarRef",ref:O,style:at({left:c(b)?"0px":`${c(w).width.value}px`}),class:"z-2 top-0"},null,8,["style"])):ae("",!0),c(n)?(m(),j(ze,{key:1,ref_key:"bottombarRef",ref:U,class:"z-2"},null,512)):ae("",!0),c(r)?(m(),j(ve,{key:2,ref_key:"navbarRef",ref:E,class:"z-3 top-0 left-0"},null,512)):ae("",!0),g("main",{id:"container",class:"relative w-dvw z-1",style:at({paddingTop:c(O)?`${c(H).height.value}px`:"env(safe-area-inset-top, 0px)",paddingLeft:c(E)&&!c(b)?`${c(w).width.value}px`:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)",paddingBottom:c(U)?`${c(J).height.value}px`:("toValue"in F?F.toValue:c(Xs))((zt=(wt=F.$route.meta.ui)==null?void 0:wt.containerSettings)==null?void 0:zt.ignoreSafeAreaBottom)?"0px":"env(safe-area-inset-bottom, 0px)"})},[g("div",{class:ct(["w-full max-w-full h-full grid",{"p-4":("toValue"in F?F.toValue:c(Xs))((es=(it=F.$route.meta.ui)==null?void 0:it.containerSettings)==null?void 0:es.padding)}]),style:at({minHeight:c(oe),maxHeight:("toValue"in F?F.toValue:c(Xs))((Ue=(Be=F.$route.meta.ui)==null?void 0:Be.containerSettings)==null?void 0:Ue.disableScroll)?c(oe):void 0,height:("toValue"in F?F.toValue:c(Xs))((X=(V=F.$route.meta.ui)==null?void 0:V.containerSettings)==null?void 0:X.disableScroll)?c(oe):void 0,overflow:("toValue"in F?F.toValue:c(Xs))((ye=(_e=F.$route.meta.ui)==null?void 0:_e.containerSettings)==null?void 0:ye.disableScroll)?"hidden":void 0})},[y(ft,{class:"w-full h-full relative overflow-x-hidden"})],6)],4),c(K)?(m(),j(Xt,{key:3})):ae("",!0),c(e)==="opened"||c(t)==="opened"&&c(b)?(m(),j(Vh,{key:4,to:c(e)==="opened"?"#app":"#container",defer:""},[c(b)?(m(),A("div",{key:0,class:ct(["fixed top-0 left-0 right-0 bottom-0 w-full h-full bg-black/50 z-1",{"z-2":c(e)==="opened"}])},null,2)):ae("",!0)],8,["to"])):ae("",!0),g("div",{class:"fixed-bg",style:at({background:("toValue"in F?F.toValue:c(Xs))((fe=F.$route.meta.ui)==null?void 0:fe.background)})},null,4)]))}}}),Sk=qs(xk,[["__scopeId","data-v-9eabf359"]]),Ck=hf(),kk=Pf(Rf,{primitive:{borderRadius:{none:"0",xs:"2px",sm:"4px",md:"6px",lg:"8px",xl:"12px"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"}},semantic:{transitionDuration:"0.2s",focusRing:{width:"1px",style:"solid",color:"{primary.color}",offset:"2px",shadow:"none"},disabledOpacity:"0.6",iconSize:"1rem",anchorGutter:"2px",primary:{50:"#fdf4f6",100:"#f7ccd4",200:"#f1a3b2",300:"#eb7b90",400:"#e5526e",500:"#df2a4c",600:"#be2441",700:"#9c1d35",800:"#7b172a",900:"#59111e",950:"#380b13"},formField:{paddingX:"0.75rem",paddingY:"0.5rem",sm:{fontSize:"0.875rem",paddingX:"0.625rem",paddingY:"0.375rem"},lg:{fontSize:"1.125rem",paddingX:"0.875rem",paddingY:"0.625rem"},borderRadius:"{border.radius.md}",focusRing:{width:"0",style:"none",color:"transparent",offset:"0",shadow:"none"},transitionDuration:"{transition.duration}"},list:{padding:"0.25rem 0.25rem",gap:"2px",header:{padding:"0.5rem 1rem 0.25rem 1rem"},option:{padding:"0.5rem 0.75rem",borderRadius:"{border.radius.sm}"},optionGroup:{padding:"0.5rem 0.75rem",fontWeight:"600"}},content:{borderRadius:"{border.radius.md}"},mask:{transitionDuration:"0.15s"},navigation:{list:{padding:"0.25rem 0.25rem",gap:"2px"},item:{padding:"0.5rem 0.75rem",borderRadius:"{border.radius.sm}",gap:"0.5rem"},submenuLabel:{padding:"0.5rem 0.75rem",fontWeight:"600"},submenuIcon:{size:"0.875rem"}},overlay:{select:{borderRadius:"{border.radius.md}",shadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)"},popover:{borderRadius:"{border.radius.md}",padding:"0.75rem",shadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)"},modal:{borderRadius:"{border.radius.xl}",padding:"1.25rem",shadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"},navigation:{shadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)"}},colorScheme:{light:{surface:{0:"#ffffff",50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",850:"#0f172a",900:"#0f172a",925:"#0c1421",950:"#020617",1e3:"#000000"},primary:{color:"{primary.500}",contrastColor:"#ffffff",hoverColor:"{primary.600}",activeColor:"{primary.700}"},highlight:{background:"{primary.50}",focusBackground:"{primary.100}",color:"{primary.700}",focusColor:"{primary.800}"},mask:{background:"rgba(0,0,0,0.4)",color:"{surface.200}"},formField:{background:"{surface.50}",disabledBackground:"{surface.200}",filledBackground:"{surface.50}",filledHoverBackground:"{surface.50}",filledFocusBackground:"{surface.50}",borderColor:"{surface.300}",hoverBorderColor:"{surface.400}",focusBorderColor:"{primary.color}",invalidBorderColor:"{red.400}",color:"{surface.700}",disabledColor:"{surface.500}",placeholderColor:"{surface.500}",invalidPlaceholderColor:"{red.600}",floatLabelColor:"{surface.500}",floatLabelFocusColor:"{primary.600}",floatLabelActiveColor:"{surface.500}",floatLabelInvalidColor:"{form.field.invalid.placeholder.color}",iconColor:"{surface.400}",shadow:"0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)"},text:{color:"{surface.700}",hoverColor:"{surface.800}",mutedColor:"{surface.500}",hoverMutedColor:"{surface.600}"},content:{background:"{surface.0}",hoverBackground:"{surface.100}",borderColor:"{surface.200}",color:"{text.color}",hoverColor:"{text.hover.color}"},overlay:{select:{background:"{surface.0}",borderColor:"{surface.200}",color:"{text.color}"},popover:{background:"{surface.0}",borderColor:"{surface.200}",color:"{text.color}"},modal:{background:"{surface.0}",borderColor:"{surface.200}",color:"{text.color}"}},list:{option:{focusBackground:"{surface.100}",selectedBackground:"{highlight.background}",selectedFocusBackground:"{highlight.focus.background}",color:"{text.color}",focusColor:"{text.hover.color}",selectedColor:"{highlight.color}",selectedFocusColor:"{highlight.focus.color}",icon:{color:"{surface.400}",focusColor:"{surface.500}"}},optionGroup:{background:"transparent",color:"{text.muted.color}"}},navigation:{item:{focusBackground:"{surface.100}",activeBackground:"{surface.100}",color:"{text.color}",focusColor:"{text.hover.color}",activeColor:"{text.hover.color}",icon:{color:"{surface.400}",focusColor:"{surface.500}",activeColor:"{surface.500}"}},submenuLabel:{background:"transparent",color:"{text.muted.color}"},submenuIcon:{color:"{surface.400}",focusColor:"{surface.500}",activeColor:"{surface.500}"}}},dark:{surface:{0:"#ffffff",50:"#f5f5f5",100:"#d1d1d1",200:"#adadad",300:"#898989",400:"#646464",500:"#404040",600:"#363636",700:"#2d2d2d",800:"#232323",850:"#1d1d1d",900:"#1a1a1a",925:"#161616",950:"#101010",1e3:"#0d0d0d"},primary:{color:"{primary.500}",contrastColor:"{surface.900}",hoverColor:"{primary.600}",activeColor:"{primary.700}"},highlight:{background:"color-mix(in srgb, {primary.400}, transparent 84%)",focusBackground:"color-mix(in srgb, {primary.400}, transparent 76%)",color:"rgba(255,255,255,.87)",focusColor:"rgba(255,255,255,.87)"},mask:{background:"rgba(0,0,0,0.6)",color:"{surface.200}"},formField:{background:"{surface.925}",disabledBackground:"{surface.700}",filledBackground:"{surface.800}",filledHoverBackground:"{surface.800}",filledFocusBackground:"{surface.800}",borderColor:"{surface.800}",hoverBorderColor:"{surface.500}",focusBorderColor:"{primary.color}",invalidBorderColor:"{red.300}",color:"{surface.0}",disabledColor:"{surface.400}",placeholderColor:"{surface.400}",invalidPlaceholderColor:"{red.400}",floatLabelColor:"{surface.400}",floatLabelFocusColor:"{primary.color}",floatLabelActiveColor:"{surface.400}",floatLabelInvalidColor:"{form.field.invalid.placeholder.color}",iconColor:"{surface.400}",shadow:"0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)"},text:{color:"{surface.0}",hoverColor:"{surface.0}",mutedColor:"{surface.400}",hoverMutedColor:"{surface.300}"},content:{background:"{surface.900}",hoverBackground:"{surface.800}",borderColor:"{surface.700}",color:"{text.color}",hoverColor:"{text.hover.color}"},overlay:{select:{background:"{surface.900}",borderColor:"{surface.700}",color:"{text.color}"},popover:{background:"{surface.900}",borderColor:"{surface.700}",color:"{text.color}"},modal:{background:"{surface.900}",borderColor:"{surface.700}",color:"{text.color}"}},list:{option:{focusBackground:"{surface.800}",selectedBackground:"{highlight.background}",selectedFocusBackground:"{highlight.focus.background}",color:"{text.color}",focusColor:"{text.hover.color}",selectedColor:"{highlight.color}",selectedFocusColor:"{highlight.focus.color}",icon:{color:"{surface.500}",focusColor:"{surface.400}"}},optionGroup:{background:"transparent",color:"{text.muted.color}"}},navigation:{item:{focusBackground:"{surface.800}",activeBackground:"{surface.800}",color:"{text.color}",focusColor:"{text.hover.color}",activeColor:"{text.hover.color}",icon:{color:"{surface.500}",focusColor:"{surface.400}",activeColor:"{surface.400}"}},submenuLabel:{background:"transparent",color:"{text.muted.color}"},submenuIcon:{color:"{surface.500}",focusColor:"{surface.400}",activeColor:"{surface.400}"}}}}}}),Ek=()=>{const s=G0(Sk);return s.directive("tooltip",qr),s.use(Fa).use(Ck).use(_k).use(z0).use(U0).use(V0).use(Tf,{theme:{preset:kk,options:{cssLayer:{name:"primevue",order:"theme, base, primevue"},darkModeSelector:".dark-mode"}}}).use(T0),s},Ak=Ek();Ak.mount("#app");export{zi as $,S4 as A,Lb as B,Wn as C,mp as D,S9 as E,hp as F,Y6 as G,t8 as H,Y8 as I,Q8 as J,G8 as K,ax as L,m8 as M,rx as N,yx as O,gx as P,mx as Q,ux as R,Sa as S,Y5 as T,R_ as U,D4 as V,$4 as W,E4 as X,b4 as Y,v9 as Z,Na as _,Nl as a,_9 as a0,ys as a1,Re as a2,yp as a3,vy as a4,b6 as a5,uh as a6,ch as a7,oh as a8,dh as a9,lh as aa,mh as ab,wp as ac,kp as ad,Hm as ae,$3 as af,b9 as ag,ud as ah,Hc as ai,Py as aj,Ll as ak,f9 as al,Ol as am,uo as an,x9 as ao,Qm as ap,g9 as aq,bk as ar,C9 as as,w9 as at,y9 as au,Lr as b,Cn as c,Si as d,Fl as e,Rl as f,Fr as g,Hr as h,_o as i,Vc as j,A9 as k,E9 as l,d3 as m,bp as n,k9 as o,Cp as p,Il as q,O_ as r,I_ as s,La as t,Fs as u,Sh as v,jl as w,Al as x,Ep as y,qs as z};