@camera.ui/server 0.0.6 → 0.0.8

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 (238) hide show
  1. package/dist/interface/assets/{@tanstack-BqH4GyO-.js → @tanstack-B-9PO-kT.js} +1 -1
  2. package/dist/interface/assets/{@vee-validate-DCBdnGo-.js → @vee-validate-D_G0ehOl.js} +1 -1
  3. package/dist/interface/assets/{@vue-C7-KaDG4.js → @vue-C10tA4b9.js} +6 -6
  4. package/dist/interface/assets/{@vueform-arggO0eF.js → @vueform-Bj73kRPS.js} +1 -1
  5. package/dist/interface/assets/{@vueuse-C3WMTDqL.js → @vueuse-BPeqNGoM.js} +1 -1
  6. package/dist/interface/assets/Account-MEaGtu1D.js +1 -0
  7. package/dist/interface/assets/Adminpanel-D1ycltxf.js +1 -0
  8. package/dist/interface/assets/Appearance-Jlzp_P21.js +1 -0
  9. package/dist/interface/assets/Backup-1-ju9NDo.js +1 -0
  10. package/dist/interface/assets/Camera-BOu5dUel.js +1 -0
  11. package/dist/interface/assets/Cameras-C7eUXdZk.js +1 -0
  12. package/dist/interface/assets/Cameras-tmTzi1M6.css +1 -0
  13. package/dist/interface/assets/Camview-CEgwGCGR.js +1 -0
  14. package/dist/interface/assets/{Camview-vUAs5YHU.css → Camview-CWTrsoY0.css} +1 -1
  15. package/dist/interface/assets/Config-Dt-etQ3h.js +1 -0
  16. package/dist/interface/assets/{Console-Caz7y-T0.js → Console-FCve5CKy.js} +2 -2
  17. package/dist/interface/assets/FirstSteps-DLkKDSe9.js +1 -0
  18. package/dist/interface/assets/{NewCamera-B9t-0NCc.js → NewCamera-Cc1X79Ns.js} +2 -2
  19. package/dist/interface/assets/Plugin-CnQjafMC.js +1 -0
  20. package/dist/interface/assets/{Plugin-BSHKKjrl.css → Plugin-DzKKCoqQ.css} +1 -1
  21. package/dist/interface/assets/Plugins-B8gCgxOx.css +1 -0
  22. package/dist/interface/assets/Plugins-CwyUdMlv.js +1 -0
  23. package/dist/interface/assets/Recordings-Boeev1lV.js +1 -0
  24. package/dist/interface/assets/Recordings-D5ta7AYS.js +1 -0
  25. package/dist/interface/assets/Settings-Cvm2jnBr.js +1 -0
  26. package/dist/interface/assets/System-fHQ7XKri.js +1 -0
  27. package/dist/interface/assets/User-5o1VKizc.js +1 -0
  28. package/dist/interface/assets/VConfigEditor.vue_vue_type_script_setup_true_lang-C_95ELTZ.js +2 -0
  29. package/dist/interface/assets/VConsole-BHy92Ws0.js +1 -0
  30. package/dist/interface/assets/VConsole-MV9pQtJj.css +1 -0
  31. package/dist/interface/assets/{VPlayer-YdRn97Bs.js → VPlayer-LX5HGLrY.js} +1 -1
  32. package/dist/interface/assets/{VPluginCard--3bx6UJb.js → VPluginCard-CFpg0LM4.js} +2 -2
  33. package/dist/interface/assets/VPluginCard-Fl0AYmnF.css +1 -0
  34. package/dist/interface/assets/main-BCWSiwnj.js +9 -0
  35. package/dist/interface/assets/{main-B3IVLctZ.css → main-CQNVVncO.css} +1 -1
  36. package/dist/interface/assets/{pinia-D8MtiGcH.js → pinia-CitQ5b66.js} +2 -2
  37. package/dist/interface/assets/{plugins-Bf03y242.js → plugins-D80RNVmI.js} +1 -1
  38. package/dist/interface/assets/qrcode-SHonoxyK.js +8 -0
  39. package/dist/interface/assets/{system-BONnDA4y.js → system-CS_ZOs3_.js} +1 -1
  40. package/dist/interface/assets/{ui-CNpIJotI.js → ui-CHKoHLl-.js} +1 -1
  41. package/dist/interface/assets/{v-calendar-uh0aTGqP.js → v-calendar-C-8W4FeM.js} +1 -1
  42. package/dist/interface/assets/{vee-validate-D3FqbChK.js → vee-validate-Ck3I2guh.js} +1 -1
  43. package/dist/interface/assets/{vue-i18n-1AU8MPys.js → vue-i18n-DuCDz9TJ.js} +1 -1
  44. package/dist/interface/assets/{vue-inline-svg-2DDwYW6V.js → vue-inline-svg-C2gR6nRD.js} +1 -1
  45. package/dist/interface/assets/{vue-router-DfeQ8s4I.js → vue-router-OPGDMnws.js} +1 -1
  46. package/dist/interface/assets/{vue3-dnd-BwxcSU9Z.js → vue3-dnd-Hf295yge.js} +1 -1
  47. package/dist/interface/assets/{vue3-toastify-Ul-rf53I.js → vue3-toastify-DQr2dOCx.js} +1 -1
  48. package/dist/interface/assets/vuetify-CrcT8VHB.js +5 -0
  49. package/dist/interface/index.html +14 -15
  50. package/dist/interface/sw.js +1 -1
  51. package/dist/server/bin/cui-service.d.ts +1 -0
  52. package/dist/server/bin/cui-service.js +41 -9
  53. package/dist/server/bin/cui-service.js.map +1 -1
  54. package/dist/server/package.json +8 -7
  55. package/dist/server/requirements.txt +2 -3
  56. package/dist/server/src/api/controllers/cameras.controller.js +2 -2
  57. package/dist/server/src/api/controllers/cameras.controller.js.map +1 -1
  58. package/dist/server/src/api/controllers/plugins.controller.js +7 -6
  59. package/dist/server/src/api/controllers/plugins.controller.js.map +1 -1
  60. package/dist/server/src/api/go2rtc/api/streams.d.ts +4 -4
  61. package/dist/server/src/api/go2rtc/api/streams.js +2 -24
  62. package/dist/server/src/api/go2rtc/api/streams.js.map +1 -1
  63. package/dist/server/src/api/go2rtc/types.d.ts +6 -2
  64. package/dist/server/src/api/schemas/go2rtc.schema.d.ts +5 -5
  65. package/dist/server/src/api/services/cameras.service.d.ts +6 -5
  66. package/dist/server/src/api/services/cameras.service.js +72 -59
  67. package/dist/server/src/api/services/cameras.service.js.map +1 -1
  68. package/dist/server/src/api/services/plugins.service.js +11 -13
  69. package/dist/server/src/api/services/plugins.service.js.map +1 -1
  70. package/dist/server/src/api.d.ts +2 -2
  71. package/dist/server/src/camera/controller.d.ts +9 -4
  72. package/dist/server/src/camera/controller.js +21 -7
  73. package/dist/server/src/camera/controller.js.map +1 -1
  74. package/dist/server/src/camera/device.d.ts +15 -3
  75. package/dist/server/src/camera/device.js.map +1 -1
  76. package/dist/server/src/camera/index.d.ts +18 -39
  77. package/dist/server/src/camera/index.js +137 -165
  78. package/dist/server/src/camera/index.js.map +1 -1
  79. package/dist/server/src/camera/interfaces/camera.d.ts +0 -1
  80. package/dist/server/src/camera/interfaces/camera.js +0 -8
  81. package/dist/server/src/camera/interfaces/camera.js.map +1 -1
  82. package/dist/server/src/camera/streaming/werift-session.d.ts +10 -1
  83. package/dist/server/src/camera/streaming/werift-session.js +16 -1
  84. package/dist/server/src/camera/streaming/werift-session.js.map +1 -1
  85. package/dist/server/src/camera/types.d.ts +0 -1
  86. package/dist/server/src/camera/types.js.map +1 -1
  87. package/dist/server/src/camera/videoFrame.d.ts +3 -3
  88. package/dist/server/src/camera/videoFrame.js +6 -7
  89. package/dist/server/src/camera/videoFrame.js.map +1 -1
  90. package/dist/server/src/decoder/types.d.ts +4 -9
  91. package/dist/server/src/decoder/worker.d.ts +3 -5
  92. package/dist/server/src/decoder/worker.js +40 -64
  93. package/dist/server/src/decoder/worker.js.map +1 -1
  94. package/dist/server/src/go2rtc/index.js +1 -1
  95. package/dist/server/src/go2rtc/index.js.map +1 -1
  96. package/dist/server/src/index.d.ts +3 -3
  97. package/dist/server/src/main.js +1 -2
  98. package/dist/server/src/main.js.map +1 -1
  99. package/dist/server/src/nats/connection.d.ts +17 -0
  100. package/dist/server/src/nats/connection.js +66 -0
  101. package/dist/server/src/nats/connection.js.map +1 -0
  102. package/dist/server/src/nats/error.d.ts +9 -0
  103. package/dist/server/src/nats/error.js +11 -0
  104. package/dist/server/src/nats/error.js.map +1 -0
  105. package/dist/server/src/nats/index.d.ts +6 -4
  106. package/dist/server/src/nats/index.js +22 -17
  107. package/dist/server/src/nats/index.js.map +1 -1
  108. package/dist/server/src/nats/messageQueue.d.ts +7 -4
  109. package/dist/server/src/nats/messageQueue.js +43 -59
  110. package/dist/server/src/nats/messageQueue.js.map +1 -1
  111. package/dist/server/src/nats/proxy/cameraDevice.js +19 -24
  112. package/dist/server/src/nats/proxy/cameraDevice.js.map +1 -1
  113. package/dist/server/src/nats/proxy/deviceManager.d.ts +2 -2
  114. package/dist/server/src/nats/proxy/deviceManager.js +4 -14
  115. package/dist/server/src/nats/proxy/deviceManager.js.map +1 -1
  116. package/dist/server/src/nats/server.js +4 -10
  117. package/dist/server/src/nats/server.js.map +1 -1
  118. package/dist/server/src/nats/subscription.d.ts +12 -0
  119. package/dist/server/src/nats/subscription.js +21 -0
  120. package/dist/server/src/nats/subscription.js.map +1 -0
  121. package/dist/server/src/nats/types.d.ts +25 -40
  122. package/dist/server/src/nats/types.js +1 -10
  123. package/dist/server/src/nats/types.js.map +1 -1
  124. package/dist/server/src/nats/utils.d.ts +2 -4
  125. package/dist/server/src/nats/utils.js +3 -3
  126. package/dist/server/src/nats/utils.js.map +1 -1
  127. package/dist/server/src/plugins/index.d.ts +3 -5
  128. package/dist/server/src/plugins/index.js +54 -141
  129. package/dist/server/src/plugins/index.js.map +1 -1
  130. package/dist/server/src/plugins/plugin.d.ts +4 -13
  131. package/dist/server/src/plugins/plugin.js +40 -90
  132. package/dist/server/src/plugins/plugin.js.map +1 -1
  133. package/dist/server/src/plugins/types.d.ts +4 -0
  134. package/dist/server/src/plugins/types.js.map +1 -1
  135. package/dist/server/src/plugins/worker.d.ts +1 -1
  136. package/dist/server/src/plugins/worker.js +52 -66
  137. package/dist/server/src/plugins/worker.js.map +1 -1
  138. package/dist/server/src/polyglot/node/decoder/child.js +87 -159
  139. package/dist/server/src/polyglot/node/decoder/child.js.map +1 -1
  140. package/dist/server/src/polyglot/node/decoder/imageUtils.d.ts +1 -1
  141. package/dist/server/src/polyglot/node/plugins/cameraStorage.d.ts +2 -2
  142. package/dist/server/src/polyglot/node/plugins/cameraStorage.js.map +1 -1
  143. package/dist/server/src/polyglot/node/plugins/child.d.ts +1 -1
  144. package/dist/server/src/polyglot/node/plugins/child.js +34 -60
  145. package/dist/server/src/polyglot/node/plugins/child.js.map +1 -1
  146. package/dist/server/src/polyglot/node/plugins/{config.js → configService.js} +1 -1
  147. package/dist/server/src/polyglot/node/plugins/configService.js.map +1 -0
  148. package/dist/server/src/polyglot/node/plugins/{api.d.ts → pluginApi.d.ts} +9 -12
  149. package/dist/server/src/polyglot/node/plugins/pluginApi.js +34 -0
  150. package/dist/server/src/polyglot/node/plugins/pluginApi.js.map +1 -0
  151. package/dist/server/src/polyglot/node/plugins/{logger.d.ts → pluginLogger.d.ts} +2 -0
  152. package/dist/server/src/polyglot/node/plugins/pluginLogger.js +89 -0
  153. package/dist/server/src/polyglot/node/plugins/pluginLogger.js.map +1 -0
  154. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +8 -11
  155. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js +67 -129
  156. package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js.map +1 -1
  157. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +6 -8
  158. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js +15 -43
  159. package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js.map +1 -1
  160. package/dist/server/src/polyglot/node/plugins/storageController.d.ts +2 -2
  161. package/dist/server/src/polyglot/node/plugins/storageController.js.map +1 -1
  162. package/dist/server/src/polyglot/python/camera/interfaces/camera.py +0 -6
  163. package/dist/server/src/polyglot/python/camera/video_frame.py +10 -18
  164. package/dist/server/src/polyglot/python/camera_ui_types/__init__.py +1 -5
  165. package/dist/server/src/polyglot/python/decoder/child.py +102 -161
  166. package/dist/server/src/polyglot/python/plugins/camera_storage.py +10 -23
  167. package/dist/server/src/polyglot/python/plugins/child.py +35 -60
  168. package/dist/server/src/polyglot/python/plugins/{proxy/message_queue.py → message_queue.py} +50 -81
  169. package/dist/server/src/polyglot/python/plugins/plugin_api.py +13 -21
  170. package/dist/server/src/polyglot/python/plugins/proxy/camera_device.py +90 -173
  171. package/dist/server/src/polyglot/python/plugins/proxy/device_manager.py +25 -64
  172. package/dist/server/src/polyglot/python/plugins/storage_controller.py +3 -4
  173. package/dist/server/src/polyglot/python/utilities/connection.py +86 -0
  174. package/dist/server/src/polyglot/python/utilities/object_path.py +12 -4
  175. package/dist/server/src/polyglot/python/utilities/subscriptions.py +20 -0
  176. package/dist/server/src/polyglot/python/utilities/task.py +11 -1
  177. package/dist/server/src/services/config/index.js +4 -2
  178. package/dist/server/src/services/config/index.js.map +1 -1
  179. package/dist/server/src/services/logger/index.js +11 -8
  180. package/dist/server/src/services/logger/index.js.map +1 -1
  181. package/dist/server/src/utils/ffmpeg.d.ts +2 -0
  182. package/dist/server/src/{decoder → utils}/ffmpeg.js +2 -2
  183. package/dist/server/src/utils/ffmpeg.js.map +1 -0
  184. package/dist/server/src/utils/pythonInstaller.d.ts +1 -1
  185. package/dist/server/src/utils/pythonInstaller.js +10 -4
  186. package/dist/server/src/utils/pythonInstaller.js.map +1 -1
  187. package/dist/server/src/utils/reader.js.map +1 -0
  188. package/dist/server/src/utils/subscribed.d.ts +4 -4
  189. package/dist/server/src/utils/subscribed.js.map +1 -1
  190. package/package.json +8 -7
  191. package/dist/interface/assets/@camera.ui-2NVnv26v.js +0 -8
  192. package/dist/interface/assets/Account-gJpkf0nE.js +0 -1
  193. package/dist/interface/assets/Adminpanel-Bge9nu5N.js +0 -1
  194. package/dist/interface/assets/Appearance-D22q-X_I.js +0 -1
  195. package/dist/interface/assets/Backup-pJm6s10G.js +0 -1
  196. package/dist/interface/assets/Camera-BgO2yRjb.js +0 -1
  197. package/dist/interface/assets/Cameras-BM3vSM_R.css +0 -1
  198. package/dist/interface/assets/Cameras-DjeKruR_.js +0 -1
  199. package/dist/interface/assets/Camview-DfzlprzN.js +0 -1
  200. package/dist/interface/assets/Config-BKIOIkjC.js +0 -1
  201. package/dist/interface/assets/FirstSteps-mQK4XFTs.js +0 -1
  202. package/dist/interface/assets/Plugin-Di_bBsg-.js +0 -1
  203. package/dist/interface/assets/Plugins-BsMITags.css +0 -1
  204. package/dist/interface/assets/Plugins-DhmzMNuO.js +0 -1
  205. package/dist/interface/assets/Recordings-Bu53bSBp.js +0 -1
  206. package/dist/interface/assets/Recordings-XY20w8yp.js +0 -1
  207. package/dist/interface/assets/Settings-gGRBRVST.js +0 -1
  208. package/dist/interface/assets/System-ZDrcLNk0.js +0 -1
  209. package/dist/interface/assets/User-D4vEhhzi.js +0 -1
  210. package/dist/interface/assets/VConfigEditor.vue_vue_type_script_setup_true_lang-CXFI-IeE.js +0 -2
  211. package/dist/interface/assets/VConsole-BHo3xprq.js +0 -1
  212. package/dist/interface/assets/VConsole-f-nUkOuD.css +0 -1
  213. package/dist/interface/assets/VPluginCard-BJYMuCLk.css +0 -1
  214. package/dist/interface/assets/encode-utf8-Cn5aGd7v.js +0 -1
  215. package/dist/interface/assets/main-C4rYiRNz.js +0 -2
  216. package/dist/interface/assets/qrcode-CGiDONbL.js +0 -8
  217. package/dist/interface/assets/vuetify-_-Oqac3B.js +0 -5
  218. package/dist/server/src/decoder/ffmpeg.d.ts +0 -2
  219. package/dist/server/src/decoder/ffmpeg.js.map +0 -1
  220. package/dist/server/src/nats/proxy/index.d.ts +0 -2
  221. package/dist/server/src/nats/proxy/index.js +0 -3
  222. package/dist/server/src/nats/proxy/index.js.map +0 -1
  223. package/dist/server/src/polyglot/node/decoder/reader.js.map +0 -1
  224. package/dist/server/src/polyglot/node/plugins/api.js +0 -34
  225. package/dist/server/src/polyglot/node/plugins/api.js.map +0 -1
  226. package/dist/server/src/polyglot/node/plugins/config.js.map +0 -1
  227. package/dist/server/src/polyglot/node/plugins/logger.js +0 -128
  228. package/dist/server/src/polyglot/node/plugins/logger.js.map +0 -1
  229. package/dist/server/src/polyglot/node/plugins/proxy/index.d.ts +0 -2
  230. package/dist/server/src/polyglot/node/plugins/proxy/index.js +0 -3
  231. package/dist/server/src/polyglot/node/plugins/proxy/index.js.map +0 -1
  232. package/dist/server/src/polyglot/node/plugins/proxy/messageQueue.d.ts +0 -20
  233. package/dist/server/src/polyglot/node/plugins/proxy/messageQueue.js +0 -152
  234. package/dist/server/src/polyglot/node/plugins/proxy/messageQueue.js.map +0 -1
  235. /package/dist/server/src/polyglot/node/plugins/{config.d.ts → configService.d.ts} +0 -0
  236. /package/dist/server/src/polyglot/python/plugins/{logger.py → plugin_logger.py} +0 -0
  237. /package/dist/server/src/{polyglot/node/decoder → utils}/reader.d.ts +0 -0
  238. /package/dist/server/src/{polyglot/node/decoder → utils}/reader.js +0 -0
@@ -1,8 +0,0 @@
1
- var mr=Object.defineProperty;var xs=n=>{throw TypeError(n)};var yr=(n,t,e)=>t in n?mr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>yr(n,typeof t!="symbol"?t+"":t,e),Dt=(n,t,e)=>t.has(n)||xs("Cannot "+e);var u=(n,t,e)=>(Dt(n,t,"read from private field"),e?e.call(n):t.get(n)),x=(n,t,e)=>t.has(n)?xs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),O=(n,t,e,s)=>(Dt(n,t,"write to private field"),s?s.call(n,e):t.set(n,e),e),S=(n,t,e)=>(Dt(n,t,"access private method"),e);var tt=(n,t,e,s)=>({set _(r){O(n,t,r,e)},get _(){return u(n,t,s)}});var Te={d:(n,t)=>{for(var e in t)Te.o(t,e)&&!Te.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},o:(n,t)=>Object.prototype.hasOwnProperty.call(n,t),r:n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},Tn={};Te.d(Tn,{j:()=>Wi});var Xt={};Te.r(Xt),Te.d(Xt,{hasBrowserEnv:()=>ws,hasStandardBrowserEnv:()=>Nr,hasStandardBrowserWebWorkerEnv:()=>Fr,origin:()=>Ur});var Qt={};function xn(n,t){return function(){return n.apply(t,arguments)}}Te.r(Qt),Te.d(Qt,{Decoder:()=>As,Encoder:()=>Ii,PacketType:()=>T,protocol:()=>qi});const{toString:br}=Object.prototype,{getPrototypeOf:vs}=Object,St=(n=>t=>{const e=br.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),de=n=>(n=n.toLowerCase(),t=>St(t)===n),Ct=n=>t=>typeof t===n,{isArray:Pe}=Array,$e=Ct("undefined"),Cs=de("ArrayBuffer"),vr=Ct("string"),Z=Ct("function"),js=Ct("number"),st=n=>n!==null&&typeof n=="object",nt=n=>{if(St(n)!=="object")return!1;const t=vs(n);return!(t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.toStringTag in n||Symbol.iterator in n)},wr=de("Date"),Sr=de("File"),Er=de("Blob"),_r=de("FileList"),Or=de("URLSearchParams"),[kr,Rr,Ar,Tr]=["ReadableStream","Request","Response","Headers"].map(de);function Je(n,t,{allOwnKeys:e=!1}={}){if(n==null)return;let s,r;if(typeof n!="object"&&(n=[n]),Pe(n))for(s=0,r=n.length;s<r;s++)t.call(null,n[s],s,n);else{const i=e?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(s=0;s<o;s++)a=i[s],t.call(null,n[a],a,n)}}function Ps(n,t){t=t.toLowerCase();const e=Object.keys(n);let s,r=e.length;for(;r-- >0;)if(s=e[r],t===s.toLowerCase())return s;return null}const Cn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ls=n=>!$e(n)&&n!==Cn,xr=(Nt=typeof Uint8Array<"u"&&vs(Uint8Array),n=>Nt&&n instanceof Nt);var Nt;const Cr=de("HTMLFormElement"),Bs=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),jr=de("RegExp"),Ds=(n,t)=>{const e=Object.getOwnPropertyDescriptors(n),s={};Je(e,(r,i)=>{let o;(o=t(r,i,n))!==!1&&(s[i]=o||r)}),Object.defineProperties(n,s)},Ft="abcdefghijklmnopqrstuvwxyz",Ns="0123456789",Fs={DIGIT:Ns,ALPHA:Ft,ALPHA_DIGIT:Ft+Ft.toUpperCase()+Ns},Pr=de("AsyncFunction"),f={isArray:Pe,isArrayBuffer:Cs,isBuffer:function(n){return n!==null&&!$e(n)&&n.constructor!==null&&!$e(n.constructor)&&Z(n.constructor.isBuffer)&&n.constructor.isBuffer(n)},isFormData:n=>{let t;return n&&(typeof FormData=="function"&&n instanceof FormData||Z(n.append)&&((t=St(n))==="formdata"||t==="object"&&Z(n.toString)&&n.toString()==="[object FormData]"))},isArrayBufferView:function(n){let t;return t=typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer&&Cs(n.buffer),t},isString:vr,isNumber:js,isBoolean:n=>n===!0||n===!1,isObject:st,isPlainObject:nt,isReadableStream:kr,isRequest:Rr,isResponse:Ar,isHeaders:Tr,isUndefined:$e,isDate:wr,isFile:Sr,isBlob:Er,isRegExp:jr,isFunction:Z,isStream:n=>st(n)&&Z(n.pipe),isURLSearchParams:Or,isTypedArray:xr,isFileList:_r,forEach:Je,merge:function n(){const{caseless:t}=Ls(this)&&this||{},e={},s=(r,i)=>{const o=t&&Ps(e,i)||i;nt(e[o])&&nt(r)?e[o]=n(e[o],r):nt(r)?e[o]=n({},r):Pe(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&Je(arguments[r],s);return e},extend:(n,t,e,{allOwnKeys:s}={})=>(Je(t,(r,i)=>{e&&Z(r)?n[i]=xn(r,e):n[i]=r},{allOwnKeys:s}),n),trim:n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),inherits:(n,t,e,s)=>{n.prototype=Object.create(t.prototype,s),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:t.prototype}),e&&Object.assign(n.prototype,e)},toFlatObject:(n,t,e,s)=>{let r,i,o;const a={};if(t=t||{},n==null)return t;do{for(r=Object.getOwnPropertyNames(n),i=r.length;i-- >0;)o=r[i],s&&!s(o,n,t)||a[o]||(t[o]=n[o],a[o]=!0);n=e!==!1&&vs(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},kindOf:St,kindOfTest:de,endsWith:(n,t,e)=>{n=String(n),(e===void 0||e>n.length)&&(e=n.length),e-=t.length;const s=n.indexOf(t,e);return s!==-1&&s===e},toArray:n=>{if(!n)return null;if(Pe(n))return n;let t=n.length;if(!js(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=n[t];return e},forEachEntry:(n,t)=>{const e=(n&&n[Symbol.iterator]).call(n);let s;for(;(s=e.next())&&!s.done;){const r=s.value;t.call(n,r[0],r[1])}},matchAll:(n,t)=>{let e;const s=[];for(;(e=n.exec(t))!==null;)s.push(e);return s},isHTMLForm:Cr,hasOwnProperty:Bs,hasOwnProp:Bs,reduceDescriptors:Ds,freezeMethods:n=>{Ds(n,(t,e)=>{if(Z(n)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const s=n[e];Z(s)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")}))})},toObjectSet:(n,t)=>{const e={},s=r=>{r.forEach(i=>{e[i]=!0})};return Pe(n)?s(n):s(String(n).split(t)),e},toCamelCase:n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,s){return e.toUpperCase()+s}),noop:()=>{},toFiniteNumber:(n,t)=>n!=null&&Number.isFinite(n=+n)?n:t,findKey:Ps,global:Cn,isContextDefined:Ls,ALPHABET:Fs,generateString:(n=16,t=Fs.ALPHA_DIGIT)=>{let e="";const{length:s}=t;for(;n--;)e+=t[Math.random()*s|0];return e},isSpecCompliantForm:function(n){return!!(n&&Z(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])},toJSONObject:n=>{const t=new Array(10),e=(s,r)=>{if(st(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[r]=s;const i=Pe(s)?[]:{};return Je(s,(o,a)=>{const c=e(o,r+1);!$e(c)&&(i[a]=c)}),t[r]=void 0,i}}return s};return e(n,0)},isAsyncFn:Pr,isThenable:n=>n&&(st(n)||Z(n))&&Z(n.then)&&Z(n.catch)};function De(n,t,e,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),s&&(this.request=s),r&&(this.response=r)}f.inherits(De,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:f.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Us=De.prototype,qs={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{qs[n]={value:n}}),Object.defineProperties(De,qs),Object.defineProperty(Us,"isAxiosError",{value:!0}),De.from=(n,t,e,s,r,i)=>{const o=Object.create(Us);return f.toFlatObject(n,o,function(a){return a!==Error.prototype},a=>a!=="isAxiosError"),De.call(o,n.message,t,e,s,r),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};const A=De;function Ut(n){return f.isPlainObject(n)||f.isArray(n)}function jn(n){return f.endsWith(n,"[]")?n.slice(0,-2):n}function Is(n,t,e){return n?n.concat(t).map(function(s,r){return s=jn(s),!e&&r?"["+s+"]":s}).join(e?".":""):t}const Lr=f.toFlatObject(f,{},null,function(n){return/^is[A-Z]/.test(n)}),Et=function(n,t,e){if(!f.isObject(n))throw new TypeError("target must be an object");t=t||new FormData;const s=(e=f.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,y){return!f.isUndefined(y[p])})).metaTokens,r=e.visitor||h,i=e.dots,o=e.indexes,a=(e.Blob||typeof Blob<"u"&&Blob)&&f.isSpecCompliantForm(t);if(!f.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(f.isDate(p))return p.toISOString();if(!a&&f.isBlob(p))throw new A("Blob is not supported. Use a Buffer instead.");return f.isArrayBuffer(p)||f.isTypedArray(p)?a&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function h(p,y,g){let E=p;if(p&&!g&&typeof p=="object"){if(f.endsWith(y,"{}"))y=s?y:y.slice(0,-2),p=JSON.stringify(p);else if(f.isArray(p)&&function(w){return f.isArray(w)&&!w.some(Ut)}(p)||(f.isFileList(p)||f.endsWith(y,"[]"))&&(E=f.toArray(p)))return y=jn(y),E.forEach(function(w,b){!f.isUndefined(w)&&w!==null&&t.append(o===!0?Is([y],b,i):o===null?y:y+"[]",c(w))}),!1}return!!Ut(p)||(t.append(Is(g,y,i),c(p)),!1)}const l=[],d=Object.assign(Lr,{defaultVisitor:h,convertValue:c,isVisitable:Ut});if(!f.isObject(n))throw new TypeError("data must be an object");return function p(y,g){if(!f.isUndefined(y)){if(l.indexOf(y)!==-1)throw Error("Circular reference detected in "+g.join("."));l.push(y),f.forEach(y,function(E,w){(!(f.isUndefined(E)||E===null)&&r.call(t,E,f.isString(w)?w.trim():w,g,d))===!0&&p(E,g?g.concat(w):[w])}),l.pop()}}(n),t};function Ms(n){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Pn(n,t){this._pairs=[],n&&Et(n,this,t)}const zs=Pn.prototype;zs.append=function(n,t){this._pairs.push([n,t])},zs.toString=function(n){const t=n?function(e){return n.call(this,e,Ms)}:Ms;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ln=Pn;function Br(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Bn(n,t,e){if(!t)return n;const s=e&&e.encode||Br,r=e&&e.serialize;let i;if(i=r?r(t,e):f.isURLSearchParams(t)?t.toString():new Ln(t,e).toString(s),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}const Vs=class{constructor(){this.handlers=[]}use(n,t,e){return this.handlers.push({fulfilled:n,rejected:t,synchronous:!!e&&e.synchronous,runWhen:e?e.runWhen:null}),this.handlers.length-1}eject(n){this.handlers[n]&&(this.handlers[n]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(n){f.forEach(this.handlers,function(t){t!==null&&n(t)})}},Dn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ln,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ws=typeof window<"u"&&typeof document<"u",Nr=(Ws=typeof navigator<"u"&&navigator.product,ws&&["ReactNative","NativeScript","NS"].indexOf(Ws)<0);var Ws;const Fr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ur=ws&&window.location.href||"http://localhost",ue={...Xt,...Dr},Nn=function(n){function t(e,s,r,i){let o=e[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=e.length;return o=!o&&f.isArray(r)?r.length:o,c?(f.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):(r[o]&&f.isObject(r[o])||(r[o]=[]),t(e,s,r[o],i)&&f.isArray(r[o])&&(r[o]=function(h){const l={},d=Object.keys(h);let p;const y=d.length;let g;for(p=0;p<y;p++)g=d[p],l[g]=h[g];return l}(r[o])),!a)}if(f.isFormData(n)&&f.isFunction(n.entries)){const e={};return f.forEachEntry(n,(s,r)=>{t(function(i){return f.matchAll(/\w+|\[(\w*)]/g,i).map(o=>o[0]==="[]"?"":o[1]||o[0])}(s),r,e,0)}),e}return null},Ss={transitional:Dn,adapter:["xhr","http","fetch"],transformRequest:[function(n,t){const e=t.getContentType()||"",s=e.indexOf("application/json")>-1,r=f.isObject(n);if(r&&f.isHTMLForm(n)&&(n=new FormData(n)),f.isFormData(n))return s?JSON.stringify(Nn(n)):n;if(f.isArrayBuffer(n)||f.isBuffer(n)||f.isStream(n)||f.isFile(n)||f.isBlob(n)||f.isReadableStream(n))return n;if(f.isArrayBufferView(n))return n.buffer;if(f.isURLSearchParams(n))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),n.toString();let i;if(r){if(e.indexOf("application/x-www-form-urlencoded")>-1)return function(o,a){return Et(o,new ue.classes.URLSearchParams,Object.assign({visitor:function(c,h,l,d){return ue.isNode&&f.isBuffer(c)?(this.append(h,c.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},a))}(n,this.formSerializer).toString();if((i=f.isFileList(n))||e.indexOf("multipart/form-data")>-1){const o=this.env&&this.env.FormData;return Et(i?{"files[]":n}:n,o&&new o,this.formSerializer)}}return r||s?(t.setContentType("application/json",!1),function(o,a,c){if(f.isString(o))try{return(0,JSON.parse)(o),f.trim(o)}catch(h){if(h.name!=="SyntaxError")throw h}return(0,JSON.stringify)(o)}(n)):n}],transformResponse:[function(n){const t=this.transitional||Ss.transitional,e=t&&t.forcedJSONParsing,s=this.responseType==="json";if(f.isResponse(n)||f.isReadableStream(n))return n;if(n&&f.isString(n)&&(e&&!this.responseType||s)){const r=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(n)}catch(i){if(r)throw i.name==="SyntaxError"?A.from(i,A.ERR_BAD_RESPONSE,this,null,this.response):i}}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ue.classes.FormData,Blob:ue.classes.Blob},validateStatus:function(n){return n>=200&&n<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};f.forEach(["delete","get","head","post","put","patch"],n=>{Ss.headers[n]={}});const Es=Ss,qr=f.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Hs=Symbol("internals");function Ve(n){return n&&String(n).trim().toLowerCase()}function lt(n){return n===!1||n==null?n:f.isArray(n)?n.map(lt):String(n)}function qt(n,t,e,s,r){return f.isFunction(s)?s.call(this,t,e):(r&&(t=e),f.isString(t)?f.isString(s)?t.indexOf(s)!==-1:f.isRegExp(s)?s.test(t):void 0:void 0)}class dt{constructor(t){t&&this.set(t)}set(t,e,s){const r=this;function i(a,c,h){const l=Ve(c);if(!l)throw new Error("header name must be a non-empty string");const d=f.findKey(r,l);(!d||r[d]===void 0||h===!0||h===void 0&&r[d]!==!1)&&(r[d||c]=lt(a))}const o=(a,c)=>f.forEach(a,(h,l)=>i(h,l,c));if(f.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(f.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))o((a=>{const c={};let h,l,d;return a&&a.split(`
2
- `).forEach(function(p){d=p.indexOf(":"),h=p.substring(0,d).trim().toLowerCase(),l=p.substring(d+1).trim(),!h||c[h]&&qr[h]||(h==="set-cookie"?c[h]?c[h].push(l):c[h]=[l]:c[h]=c[h]?c[h]+", "+l:l)}),c})(t),e);else if(f.isHeaders(t))for(const[a,c]of t.entries())i(c,a,s);else t!=null&&i(e,t,s);return this}get(t,e){if(t=Ve(t)){const s=f.findKey(this,t);if(s){const r=this[s];if(!e)return r;if(e===!0)return function(i){const o=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let c;for(;c=a.exec(i);)o[c[1]]=c[2];return o}(r);if(f.isFunction(e))return e.call(this,r,s);if(f.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ve(t)){const s=f.findKey(this,t);return!(!s||this[s]===void 0||e&&!qt(0,this[s],s,e))}return!1}delete(t,e){const s=this;let r=!1;function i(o){if(o=Ve(o)){const a=f.findKey(s,o);!a||e&&!qt(0,s[a],a,e)||(delete s[a],r=!0)}}return f.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let s=e.length,r=!1;for(;s--;){const i=e[s];t&&!qt(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,s={};return f.forEach(this,(r,i)=>{const o=f.findKey(s,i);if(o)return e[o]=lt(r),void delete e[i];const a=t?function(c){return c.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(h,l,d)=>l.toUpperCase()+d)}(i):String(i).trim();a!==i&&delete e[i],e[a]=lt(r),s[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return f.forEach(this,(s,r)=>{s!=null&&s!==!1&&(e[r]=t&&f.isArray(s)?s.join(", "):s)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
3
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const s=new this(t);return e.forEach(r=>s.set(r)),s}static accessor(t){const e=(this[Hs]=this[Hs]={accessors:{}}).accessors,s=this.prototype;function r(i){const o=Ve(i);e[o]||(function(a,c){const h=f.toCamelCase(" "+c);["get","set","has"].forEach(l=>{Object.defineProperty(a,l+h,{value:function(d,p,y){return this[l].call(this,c,d,p,y)},configurable:!0})})}(s,i),e[o]=!0)}return f.isArray(t)?t.forEach(r):r(t),this}}dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),f.reduceDescriptors(dt.prototype,({value:n},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>n,set(s){this[e]=s}}}),f.freezeMethods(dt);const le=dt;function It(n,t){const e=this||Es,s=t||e,r=le.from(s.headers);let i=s.data;return f.forEach(n,function(o){i=o.call(e,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function Fn(n){return!(!n||!n.__CANCEL__)}function Un(n,t,e){A.call(this,n??"canceled",A.ERR_CANCELED,t,e),this.name="CanceledError"}f.inherits(Un,A,{__CANCEL__:!0});const et=Un;function qn(n,t,e){const s=e.config.validateStatus;e.status&&s&&!s(e.status)?t(new A("Request failed with status code "+e.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e)):n(e)}const _t=(n,t,e=3)=>{let s=0;const r=function(i,o){i=i||10;const a=new Array(i),c=new Array(i);let h,l=0,d=0;return o=o!==void 0?o:1e3,function(p){const y=Date.now(),g=c[d];h||(h=y),a[l]=p,c[l]=y;let E=d,w=0;for(;E!==l;)w+=a[E++],E%=i;if(l=(l+1)%i,l===d&&(d=(d+1)%i),y-h<o)return;const b=g&&y-g;return b?Math.round(1e3*w/b):void 0}}(50,250);return function(i,o){let a=0;const c=1e3/o;let h=null;return function(){const l=this===!0,d=Date.now();if(l||d-a>c)return h&&(clearTimeout(h),h=null),a=d,i.apply(null,arguments);h||(h=setTimeout(()=>(h=null,a=Date.now(),i.apply(null,arguments)),c-(d-a)))}}(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=o-s,h=r(c);s=o;const l={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:h||void 0,estimated:h&&a&&o<=a?(a-o)/h:void 0,event:i,lengthComputable:a!=null};l[t?"download":"upload"]=!0,n(l)},e)},Ir=ue.hasStandardBrowserEnv?function(){const n=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let e;function s(r){let i=r;return n&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return e=s(window.location.href),function(r){const i=f.isString(r)?s(r):r;return i.protocol===e.protocol&&i.host===e.host}}():function(){return!0},Mr=ue.hasStandardBrowserEnv?{write(n,t,e,s,r,i){const o=[n+"="+encodeURIComponent(t)];f.isNumber(e)&&o.push("expires="+new Date(e).toGMTString()),f.isString(s)&&o.push("path="+s),f.isString(r)&&o.push("domain="+r),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const t=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function In(n,t){return n&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,s){return s?e.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):e}(n,t):t}const $s=n=>n instanceof le?{...n}:n;function xe(n,t){t=t||{};const e={};function s(h,l,d){return f.isPlainObject(h)&&f.isPlainObject(l)?f.merge.call({caseless:d},h,l):f.isPlainObject(l)?f.merge({},l):f.isArray(l)?l.slice():l}function r(h,l,d){return f.isUndefined(l)?f.isUndefined(h)?void 0:s(void 0,h,d):s(h,l,d)}function i(h,l){if(!f.isUndefined(l))return s(void 0,l)}function o(h,l){return f.isUndefined(l)?f.isUndefined(h)?void 0:s(void 0,h):s(void 0,l)}function a(h,l,d){return d in t?s(h,l):d in n?s(void 0,h):void 0}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(h,l)=>r($s(h),$s(l),!0)};return f.forEach(Object.keys(Object.assign({},n,t)),function(h){const l=c[h]||r,d=l(n[h],t[h],h);f.isUndefined(d)&&l!==a||(e[h]=d)}),e}const Mn=n=>{const t=xe({},n);let e,{data:s,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=le.from(a),t.url=Bn(In(t.baseURL,t.url),n.params,n.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),f.isFormData(s)){if(ue.hasStandardBrowserEnv||ue.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((e=a.getContentType())!==!1){const[h,...l]=e?e.split(";").map(d=>d.trim()).filter(Boolean):[];a.setContentType([h||"multipart/form-data",...l].join("; "))}}if(ue.hasStandardBrowserEnv&&(r&&f.isFunction(r)&&(r=r(t)),r||r!==!1&&Ir(t.url))){const h=i&&o&&Mr.read(o);h&&a.set(i,h)}return t},zr=typeof XMLHttpRequest<"u"&&function(n){return new Promise(function(t,e){const s=Mn(n);let r=s.data;const i=le.from(s.headers).normalize();let o,{responseType:a}=s;function c(){s.cancelToken&&s.cancelToken.unsubscribe(o),s.signal&&s.signal.removeEventListener("abort",o)}let h=new XMLHttpRequest;function l(){if(!h)return;const p=le.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());qn(function(y){t(y),c()},function(y){e(y),c()},{data:a&&a!=="text"&&a!=="json"?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:p,config:n,request:h}),h=null}h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout,"onloadend"in h?h.onloadend=l:h.onreadystatechange=function(){h&&h.readyState===4&&(h.status!==0||h.responseURL&&h.responseURL.indexOf("file:")===0)&&setTimeout(l)},h.onabort=function(){h&&(e(new A("Request aborted",A.ECONNABORTED,s,h)),h=null)},h.onerror=function(){e(new A("Network Error",A.ERR_NETWORK,s,h)),h=null},h.ontimeout=function(){let p=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const y=s.transitional||Dn;s.timeoutErrorMessage&&(p=s.timeoutErrorMessage),e(new A(p,y.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,s,h)),h=null},r===void 0&&i.setContentType(null),"setRequestHeader"in h&&f.forEach(i.toJSON(),function(p,y){h.setRequestHeader(y,p)}),f.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&h.addEventListener("progress",_t(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",_t(s.onUploadProgress)),(s.cancelToken||s.signal)&&(o=p=>{h&&(e(!p||p.type?new et(null,n,h):p),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(o),s.signal&&(s.signal.aborted?o():s.signal.addEventListener("abort",o)));const d=function(p){const y=/^([-+\w]{1,25})(:?\/\/|:)/.exec(p);return y&&y[1]||""}(s.url);d&&ue.protocols.indexOf(d)===-1?e(new A("Unsupported protocol "+d+":",A.ERR_BAD_REQUEST,n)):h.send(r||null)})},Vr=(n,t)=>{let e,s=new AbortController;const r=function(c){if(!e){e=!0,o();const h=c instanceof Error?c:this.reason;s.abort(h instanceof A?h:new et(h instanceof Error?h.message:h))}};let i=t&&setTimeout(()=>{r(new A(`timeout ${t} of ms exceeded`,A.ETIMEDOUT))},t);const o=()=>{n&&(i&&clearTimeout(i),i=null,n.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",r):c.unsubscribe(r))}),n=null)};n.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",r));const{signal:a}=s;return a.unsubscribe=o,[a,()=>{i&&clearTimeout(i),i=null}]},Wr=function*(n,t){let e=n.byteLength;if(e<t)return void(yield n);let s,r=0;for(;r<e;)s=r+t,yield n.slice(r,s),r=s},Js=(n,t,e,s,r)=>{const i=async function*(a,c,h){for await(const l of a)yield*Wr(ArrayBuffer.isView(l)?l:await h(String(l)),c)}(n,t,r);let o=0;return new ReadableStream({type:"bytes",async pull(a){const{done:c,value:h}=await i.next();if(c)return a.close(),void s();let l=h.byteLength;e&&e(o+=l),a.enqueue(new Uint8Array(h))},cancel:a=>(s(a),i.return())},{highWaterMark:2})},Gs=(n,t)=>{const e=n!=null;return s=>setTimeout(()=>t({lengthComputable:e,total:n,loaded:s}))},jt=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",zn=jt&&typeof ReadableStream=="function",Mt=jt&&(typeof TextEncoder=="function"?(Ks=new TextEncoder,n=>Ks.encode(n)):async n=>new Uint8Array(await new Response(n).arrayBuffer()));var Ks;const Hr=zn&&(()=>{let n=!1;const t=new Request(ue.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!t})(),Zt=zn&&!!(()=>{try{return f.isReadableStream(new Response("").body)}catch{}})(),Ot={stream:Zt&&(n=>n.body)};var Ys;jt&&(Ys=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(n=>{!Ot[n]&&(Ot[n]=f.isFunction(Ys[n])?t=>t[n]():(t,e)=>{throw new A(`Response type '${n}' is not supported`,A.ERR_NOT_SUPPORT,e)})}));const $r=jt&&(async n=>{let{url:t,method:e,data:s,signal:r,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:h,headers:l,withCredentials:d="same-origin",fetchOptions:p}=Mn(n);h=h?(h+"").toLowerCase():"text";let y,g,[E,w]=r||i||o?Vr([r,i],o):[];const b=()=>{!y&&setTimeout(()=>{E&&E.unsubscribe()}),y=!0};let _;try{if(c&&Hr&&e!=="get"&&e!=="head"&&(_=await(async(j,D)=>{const J=f.toFiniteNumber(j.getContentLength());return J??(async I=>I==null?0:f.isBlob(I)?I.size:f.isSpecCompliantForm(I)?(await new Request(I).arrayBuffer()).byteLength:f.isArrayBufferView(I)?I.byteLength:(f.isURLSearchParams(I)&&(I+=""),f.isString(I)?(await Mt(I)).byteLength:void 0))(D)})(l,s))!==0){let j,D=new Request(t,{method:"POST",body:s,duplex:"half"});f.isFormData(s)&&(j=D.headers.get("content-type"))&&l.setContentType(j),D.body&&(s=Js(D.body,65536,Gs(_,_t(c)),null,Mt))}f.isString(d)||(d=d?"cors":"omit"),g=new Request(t,{...p,signal:E,method:e.toUpperCase(),headers:l.normalize().toJSON(),body:s,duplex:"half",withCredentials:d});let R=await fetch(g);const C=Zt&&(h==="stream"||h==="response");if(Zt&&(a||C)){const j={};["status","statusText","headers"].forEach(J=>{j[J]=R[J]});const D=f.toFiniteNumber(R.headers.get("content-length"));R=new Response(Js(R.body,65536,a&&Gs(D,_t(a,!0)),C&&b,Mt),j)}h=h||"text";let P=await Ot[f.findKey(Ot,h)||"text"](R,n);return!C&&b(),w&&w(),await new Promise((j,D)=>{qn(j,D,{data:P,headers:le.from(R.headers),status:R.status,statusText:R.statusText,config:n,request:g})})}catch(R){throw b(),R&&R.name==="TypeError"&&/fetch/i.test(R.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,n,g),{cause:R.cause||R}):A.from(R,R&&R.code,n,g)}}),Vn={http:null,xhr:zr,fetch:$r};f.forEach(Vn,(n,t)=>{if(n){try{Object.defineProperty(n,"name",{value:t})}catch{}Object.defineProperty(n,"adapterName",{value:t})}});const Xs=n=>`- ${n}`,Jr=n=>f.isFunction(n)||n===null||n===!1,Wn=n=>{n=f.isArray(n)?n:[n];const{length:t}=n;let e,s;const r={};for(let i=0;i<t;i++){let o;if(e=n[i],s=e,!Jr(e)&&(s=Vn[(o=String(e)).toLowerCase()],s===void 0))throw new A(`Unknown adapter '${o}'`);if(s)break;r[o||"#"+i]=s}if(!s){const i=Object.entries(r).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?i.length>1?`since :
4
- `+i.map(Xs).join(`
5
- `):" "+Xs(i[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s};function zt(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new et(null,n)}function Qs(n){return zt(n),n.headers=le.from(n.headers),n.data=It.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Wn(n.adapter||Es.adapter)(n).then(function(t){return zt(n),t.data=It.call(n,n.transformResponse,t),t.headers=le.from(t.headers),t},function(t){return Fn(t)||(zt(n),t&&t.response&&(t.response.data=It.call(n,n.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)})}const _s={};["object","boolean","number","function","string","symbol"].forEach((n,t)=>{_s[n]=function(e){return typeof e===n||"a"+(t<1?"n ":" ")+n}});const Zs={};_s.transitional=function(n,t,e){function s(r,i){return"[Axios v1.7.2] Transitional option '"+r+"'"+i+(e?". "+e:"")}return(r,i,o)=>{if(n===!1)throw new A(s(i," has been removed"+(t?" in "+t:"")),A.ERR_DEPRECATED);return t&&!Zs[i]&&(Zs[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),!n||n(r,i,o)}};const es={assertOptions:function(n,t,e){if(typeof n!="object")throw new A("options must be an object",A.ERR_BAD_OPTION_VALUE);const s=Object.keys(n);let r=s.length;for(;r-- >0;){const i=s[r],o=t[i];if(o){const a=n[i],c=a===void 0||o(a,i,n);if(c!==!0)throw new A("option "+i+" must be "+c,A.ERR_BAD_OPTION_VALUE)}else if(e!==!0)throw new A("Unknown option "+i,A.ERR_BAD_OPTION)}},validators:_s},ye=es.validators;class ft{constructor(t){this.defaults=t,this.interceptors={request:new Vs,response:new Vs}}async request(t,e){try{return await this._request(t,e)}catch(s){if(s instanceof Error){let r;Error.captureStackTrace?Error.captureStackTrace(r={}):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+i):s.stack=i}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{}).url=t:e=t||{},e=xe(this.defaults,e);const{transitional:s,paramsSerializer:r,headers:i}=e;s!==void 0&&es.assertOptions(s,{silentJSONParsing:ye.transitional(ye.boolean),forcedJSONParsing:ye.transitional(ye.boolean),clarifyTimeoutError:ye.transitional(ye.boolean)},!1),r!=null&&(f.isFunction(r)?e.paramsSerializer={serialize:r}:es.assertOptions(r,{encode:ye.function,serialize:ye.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&f.merge(i.common,i[e.method]);i&&f.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),e.headers=le.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(c=c&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const h=[];let l;this.interceptors.response.forEach(function(g){h.push(g.fulfilled,g.rejected)});let d,p=0;if(!c){const g=[Qs.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,h),d=g.length,l=Promise.resolve(e);p<d;)l=l.then(g[p++],g[p++]);return l}d=a.length;let y=e;for(p=0;p<d;){const g=a[p++],E=a[p++];try{y=g(y)}catch(w){E.call(this,w);break}}try{l=Qs.call(this,y)}catch(g){return Promise.reject(g)}for(p=0,d=h.length;p<d;)l=l.then(h[p++],h[p++]);return l}getUri(t){return Bn(In((t=xe(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}f.forEach(["delete","get","head","options"],function(n){ft.prototype[n]=function(t,e){return this.request(xe(e||{},{method:n,url:t,data:(e||{}).data}))}}),f.forEach(["post","put","patch"],function(n){function t(e){return function(s,r,i){return this.request(xe(i||{},{method:n,headers:e?{"Content-Type":"multipart/form-data"}:{},url:s,data:r}))}}ft.prototype[n]=t(),ft.prototype[n+"Form"]=t(!0)});const pt=ft;class Os{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(r){e=r});const s=this;this.promise.then(r=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},t(function(r,i,o){s.reason||(s.reason=new et(r,i,o),e(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new Os(function(e){t=e}),cancel:t}}}const Gr=Os,ts={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ts).forEach(([n,t])=>{ts[t]=n});const Kr=ts,N=function n(t){const e=new pt(t),s=xn(pt.prototype.request,e);return f.extend(s,pt.prototype,e,{allOwnKeys:!0}),f.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return n(xe(t,r))},s}(Es);N.Axios=pt,N.CanceledError=et,N.CancelToken=Gr,N.isCancel=Fn,N.VERSION="1.7.2",N.toFormData=Et,N.AxiosError=A,N.Cancel=N.CanceledError,N.all=function(n){return Promise.all(n)},N.spread=function(n){return function(t){return n.apply(null,t)}},N.isAxiosError=function(n){return f.isObject(n)&&n.isAxiosError===!0},N.mergeConfig=xe,N.AxiosHeaders=le,N.formToJSON=n=>Nn(f.isHTMLForm(n)?new FormData(n):n),N.getAdapter=Wn,N.HttpStatusCode=Kr,N.default=N;const en=N;class Yr{constructor(t){m(this,"interceptor");this.interceptor=en.create({baseURL:`${t}/api`}),this.interceptor.interceptors.request.use(e=>{const s=en.CancelToken.source();return e.cancelToken=s.token,setTimeout(()=>{s.cancel("Timeout: request took more than 15 seconds")},15e3),e},e=>Promise.reject(e))}}const je=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,tn=new Set,ss=typeof process=="object"&&process?process:{},Hn=(n,t,e,s)=>{typeof ss.emitWarning=="function"?ss.emitWarning(n,t,e,s):console.error(`[${e}] ${t}: ${n}`)};let kt=globalThis.AbortController,sn=globalThis.AbortSignal;var kn;if(kt===void 0){sn=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",!1)}addEventListener(e,s){this._onabort.push(s)}},kt=class{constructor(){m(this,"signal",new sn);t()}abort(e){var s,r;if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const i of this.signal._onabort)i(e);(r=(s=this.signal).onabort)==null||r.call(s,e)}}};let n=((kn=ss.env)==null?void 0:kn.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const t=()=>{n&&(n=!1,Hn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const be=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),$n=n=>be(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?gt:null:null;class gt extends Array{constructor(t){super(t),this.fill(0)}}var Fe;const ke=class ke{constructor(t,e){m(this,"heap");m(this,"length");if(!u(ke,Fe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}static create(t){const e=$n(t);if(!e)return[];O(ke,Fe,!0);const s=new ke(t,e);return O(ke,Fe,!1),s}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};Fe=new WeakMap,x(ke,Fe,!1);let ns=ke;var Rn,An,te,K,se,ne,Ue,qe,q,re,F,B,k,H,Y,W,M,ie,z,oe,ae,X,ce,Oe,$,v,is,Re,me,Qe,Q,Jn,Ae,Ie,Ze,ve,we,os,mt,yt,L,as,Ge,Se,cs;const Ts=class Ts{constructor(t){x(this,v);x(this,te);x(this,K);x(this,se);x(this,ne);x(this,Ue);x(this,qe);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");x(this,q);x(this,re);x(this,F);x(this,B);x(this,k);x(this,H);x(this,Y);x(this,W);x(this,M);x(this,ie);x(this,z);x(this,oe);x(this,ae);x(this,X);x(this,ce);x(this,Oe);x(this,$);x(this,Re,()=>{});x(this,me,()=>{});x(this,Qe,()=>{});x(this,Q,()=>!1);x(this,Ae,t=>{});x(this,Ie,(t,e,s)=>{});x(this,Ze,(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Rn,"LRUCache");const{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:h,disposeAfter:l,noDisposeOnSet:d,noUpdateTTL:p,maxSize:y=0,maxEntrySize:g=0,sizeCalculation:E,fetchMethod:w,memoMethod:b,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:P,ignoreFetchAbort:j}=t;if(e!==0&&!be(e))throw new TypeError("max option must be a nonnegative integer");const D=e?$n(e):Array;if(!D)throw new Error("invalid max value: "+e);if(O(this,te,e),O(this,K,y),this.maxEntrySize=g||u(this,K),this.sizeCalculation=E,this.sizeCalculation){if(!u(this,K)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(O(this,qe,b),w!==void 0&&typeof w!="function")throw new TypeError("fetchMethod must be a function if specified");if(O(this,Ue,w),O(this,Oe,!!w),O(this,F,new Map),O(this,B,new Array(e).fill(void 0)),O(this,k,new Array(e).fill(void 0)),O(this,H,new D(e)),O(this,Y,new D(e)),O(this,W,0),O(this,M,0),O(this,ie,ns.create(e)),O(this,q,0),O(this,re,0),typeof h=="function"&&O(this,se,h),typeof l=="function"?(O(this,ne,l),O(this,z,[])):(O(this,ne,void 0),O(this,z,void 0)),O(this,ce,!!u(this,se)),O(this,$,!!u(this,ne)),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!j,this.maxEntrySize!==0){if(u(this,K)!==0&&!be(u(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!be(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");S(this,v,Jn).call(this)}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=be(r)||r===0?r:1,this.ttlAutopurge=!!i,this.ttl=s||0,this.ttl){if(!be(this.ttl))throw new TypeError("ttl must be a positive integer if specified");S(this,v,is).call(this)}if(u(this,te)===0&&this.ttl===0&&u(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!u(this,te)&&!u(this,K)){const J="LRU_CACHE_UNBOUNDED";(I=>!tn.has(I))(J)&&(tn.add(J),Hn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,Ts))}}static unsafeExposeInternals(t){return{starts:u(t,ae),ttls:u(t,X),sizes:u(t,oe),keyMap:u(t,F),keyList:u(t,B),valList:u(t,k),next:u(t,H),prev:u(t,Y),get head(){return u(t,W)},get tail(){return u(t,M)},free:u(t,ie),isBackgroundFetch:e=>{var s;return S(s=t,v,L).call(s,e)},backgroundFetch:(e,s,r,i)=>{var o;return S(o=t,v,yt).call(o,e,s,r,i)},moveToTail:e=>{var s;return S(s=t,v,Ge).call(s,e)},indexes:e=>{var s;return S(s=t,v,ve).call(s,e)},rindexes:e=>{var s;return S(s=t,v,we).call(s,e)},isStale:e=>{var s;return u(s=t,Q).call(s,e)}}}get max(){return u(this,te)}get maxSize(){return u(this,K)}get calculatedSize(){return u(this,re)}get size(){return u(this,q)}get fetchMethod(){return u(this,Ue)}get memoMethod(){return u(this,qe)}get dispose(){return u(this,se)}get disposeAfter(){return u(this,ne)}getRemainingTTL(t){return u(this,F).has(t)?1/0:0}*entries(){for(const t of S(this,v,ve).call(this))u(this,k)[t]===void 0||u(this,B)[t]===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield[u(this,B)[t],u(this,k)[t]])}*rentries(){for(const t of S(this,v,we).call(this))u(this,k)[t]===void 0||u(this,B)[t]===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield[u(this,B)[t],u(this,k)[t]])}*keys(){for(const t of S(this,v,ve).call(this)){const e=u(this,B)[t];e===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield e)}}*rkeys(){for(const t of S(this,v,we).call(this)){const e=u(this,B)[t];e===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield e)}}*values(){for(const t of S(this,v,ve).call(this))u(this,k)[t]===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield u(this,k)[t])}*rvalues(){for(const t of S(this,v,we).call(this))u(this,k)[t]===void 0||S(this,v,L).call(this,u(this,k)[t])||(yield u(this,k)[t])}[(An=Symbol.iterator,Rn=Symbol.toStringTag,An)](){return this.entries()}find(t,e={}){for(const s of S(this,v,ve).call(this)){const r=u(this,k)[s],i=S(this,v,L).call(this,r)?r.__staleWhileFetching:r;if(i!==void 0&&t(i,u(this,B)[s],this))return this.get(u(this,B)[s],e)}}forEach(t,e=this){for(const s of S(this,v,ve).call(this)){const r=u(this,k)[s],i=S(this,v,L).call(this,r)?r.__staleWhileFetching:r;i!==void 0&&t.call(e,i,u(this,B)[s],this)}}rforEach(t,e=this){for(const s of S(this,v,we).call(this)){const r=u(this,k)[s],i=S(this,v,L).call(this,r)?r.__staleWhileFetching:r;i!==void 0&&t.call(e,i,u(this,B)[s],this)}}purgeStale(){let t=!1;for(const e of S(this,v,we).call(this,{allowStale:!0}))u(this,Q).call(this,e)&&(S(this,v,Se).call(this,u(this,B)[e],"expire"),t=!0);return t}info(t){const e=u(this,F).get(t);if(e===void 0)return;const s=u(this,k)[e],r=S(this,v,L).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;const i={value:r};if(u(this,X)&&u(this,ae)){const o=u(this,X)[e],a=u(this,ae)[e];if(o&&a){const c=o-(je.now()-a);i.ttl=c,i.start=Date.now()}}return u(this,oe)&&(i.size=u(this,oe)[e]),i}dump(){const t=[];for(const e of S(this,v,ve).call(this,{allowStale:!0})){const s=u(this,B)[e],r=u(this,k)[e],i=S(this,v,L).call(this,r)?r.__staleWhileFetching:r;if(i===void 0||s===void 0)continue;const o={value:i};if(u(this,X)&&u(this,ae)){o.ttl=u(this,X)[e];const a=je.now()-u(this,ae)[e];o.start=Math.floor(Date.now()-a)}u(this,oe)&&(o.size=u(this,oe)[e]),t.unshift([s,o])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const r=Date.now()-s.start;s.start=je.now()-r}this.set(e,s.value,s)}}set(t,e,s={}){var p,y,g,E,w;if(e===void 0)return this.delete(t),this;const{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=s;let{noUpdateTTL:h=this.noUpdateTTL}=s;const l=u(this,Ze).call(this,t,e,s.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),S(this,v,Se).call(this,t,"set"),this;let d=u(this,q)===0?void 0:u(this,F).get(t);if(d===void 0)d=u(this,q)===0?u(this,M):u(this,ie).length!==0?u(this,ie).pop():u(this,q)===u(this,te)?S(this,v,mt).call(this,!1):u(this,q),u(this,B)[d]=t,u(this,k)[d]=e,u(this,F).set(t,d),u(this,H)[u(this,M)]=d,u(this,Y)[d]=u(this,M),O(this,M,d),tt(this,q)._++,u(this,Ie).call(this,d,l,c),c&&(c.set="add"),h=!1;else{S(this,v,Ge).call(this,d);const b=u(this,k)[d];if(e!==b){if(u(this,Oe)&&S(this,v,L).call(this,b)){b.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:_}=b;_===void 0||o||(u(this,ce)&&((p=u(this,se))==null||p.call(this,_,t,"set")),u(this,$)&&((y=u(this,z))==null||y.push([_,t,"set"])))}else o||(u(this,ce)&&((g=u(this,se))==null||g.call(this,b,t,"set")),u(this,$)&&((E=u(this,z))==null||E.push([b,t,"set"])));if(u(this,Ae).call(this,d),u(this,Ie).call(this,d,l,c),u(this,k)[d]=e,c){c.set="replace";const _=b&&S(this,v,L).call(this,b)?b.__staleWhileFetching:b;_!==void 0&&(c.oldValue=_)}}else c&&(c.set="update")}if(r===0||u(this,X)||S(this,v,is).call(this),u(this,X)&&(h||u(this,Qe).call(this,d,r,i),c&&u(this,me).call(this,c,d)),!o&&u(this,$)&&u(this,z)){const b=u(this,z);let _;for(;_=b==null?void 0:b.shift();)(w=u(this,ne))==null||w.call(this,..._)}return this}pop(){var t;try{for(;u(this,q);){const e=u(this,k)[u(this,W)];if(S(this,v,mt).call(this,!0),S(this,v,L).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(u(this,$)&&u(this,z)){const e=u(this,z);let s;for(;s=e==null?void 0:e.shift();)(t=u(this,ne))==null||t.call(this,...s)}}}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,i=u(this,F).get(t);if(i!==void 0){const o=u(this,k)[i];if(S(this,v,L).call(this,o)&&o.__staleWhileFetching===void 0)return!1;if(!u(this,Q).call(this,i))return s&&u(this,Re).call(this,i),r&&(r.has="hit",u(this,me).call(this,r,i)),!0;r&&(r.has="stale",u(this,me).call(this,r,i))}else r&&(r.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,r=u(this,F).get(t);if(r===void 0||!s&&u(this,Q).call(this,r))return;const i=u(this,k)[r];return S(this,v,L).call(this,i)?i.__staleWhileFetching:i}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:E,forceRefresh:w=!1,status:b,signal:_}=e;if(!u(this,Oe))return b&&(b.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:b});const R={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:y,status:b,signal:_};let C=u(this,F).get(t);if(C===void 0){b&&(b.fetch="miss");const P=S(this,v,yt).call(this,t,C,R,E);return P.__returned=P}{const P=u(this,k)[C];if(S(this,v,L).call(this,P)){const I=s&&P.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",I&&(b.returnedStale=!0)),I?P.__staleWhileFetching:P.__returned=P}const j=u(this,Q).call(this,C);if(!w&&!j)return b&&(b.fetch="hit"),S(this,v,Ge).call(this,C),r&&u(this,Re).call(this,C),b&&u(this,me).call(this,b,C),P;const D=S(this,v,yt).call(this,t,C,R,E),J=D.__staleWhileFetching!==void 0&&s;return b&&(b.fetch=j?"stale":"refresh",J&&j&&(b.returnedStale=!0)),J?D.__staleWhileFetching:D.__returned=D}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=u(this,qe);if(!s)throw new Error("no memoMethod provided to constructor");const{context:r,forceRefresh:i,...o}=e,a=this.get(t,o);if(!i&&a!==void 0)return a;const c=s(t,a,{options:o,context:r});return this.set(t,c,o),c}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=e,a=u(this,F).get(t);if(a!==void 0){const c=u(this,k)[a],h=S(this,v,L).call(this,c);return o&&u(this,me).call(this,o,a),u(this,Q).call(this,a)?(o&&(o.get="stale"),h?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?c.__staleWhileFetching:void 0):(i||S(this,v,Se).call(this,t,"expire"),o&&s&&(o.returnedStale=!0),s?c:void 0)):(o&&(o.get="hit"),h?c.__staleWhileFetching:(S(this,v,Ge).call(this,a),r&&u(this,Re).call(this,a),c))}o&&(o.get="miss")}delete(t){return S(this,v,Se).call(this,t,"delete")}clear(){return S(this,v,cs).call(this,"delete")}};te=new WeakMap,K=new WeakMap,se=new WeakMap,ne=new WeakMap,Ue=new WeakMap,qe=new WeakMap,q=new WeakMap,re=new WeakMap,F=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,Y=new WeakMap,W=new WeakMap,M=new WeakMap,ie=new WeakMap,z=new WeakMap,oe=new WeakMap,ae=new WeakMap,X=new WeakMap,ce=new WeakMap,Oe=new WeakMap,$=new WeakMap,v=new WeakSet,is=function(){const t=new gt(u(this,te)),e=new gt(u(this,te));O(this,X,t),O(this,ae,e),O(this,Qe,(i,o,a=je.now())=>{if(e[i]=o!==0?a:0,t[i]=o,o!==0&&this.ttlAutopurge){const c=setTimeout(()=>{u(this,Q).call(this,i)&&S(this,v,Se).call(this,u(this,B)[i],"expire")},o+1);c.unref&&c.unref()}}),O(this,Re,i=>{e[i]=t[i]!==0?je.now():0}),O(this,me,(i,o)=>{if(t[o]){const a=t[o],c=e[o];if(!a||!c)return;i.ttl=a,i.start=c,i.now=s||r();const h=i.now-c;i.remainingTTL=a-h}});let s=0;const r=()=>{const i=je.now();if(this.ttlResolution>0){s=i;const o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return i};this.getRemainingTTL=i=>{const o=u(this,F).get(i);if(o===void 0)return 0;const a=t[o],c=e[o];return a&&c?a-((s||r())-c):1/0},O(this,Q,i=>{const o=e[i],a=t[i];return!!a&&!!o&&(s||r())-o>a})},Re=new WeakMap,me=new WeakMap,Qe=new WeakMap,Q=new WeakMap,Jn=function(){const t=new gt(u(this,te));O(this,re,0),O(this,oe,t),O(this,Ae,e=>{O(this,re,u(this,re)-t[e]),t[e]=0}),O(this,Ze,(e,s,r,i)=>{if(S(this,v,L).call(this,s))return 0;if(!be(r)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(r=i(s,e),!be(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r}),O(this,Ie,(e,s,r)=>{if(t[e]=s,u(this,K)){const i=u(this,K)-t[e];for(;u(this,re)>i;)S(this,v,mt).call(this,!0)}O(this,re,u(this,re)+t[e]),r&&(r.entrySize=s,r.totalCalculatedSize=u(this,re))})},Ae=new WeakMap,Ie=new WeakMap,Ze=new WeakMap,ve=function*({allowStale:t=this.allowStale}={}){if(u(this,q))for(let e=u(this,M);S(this,v,os).call(this,e)&&(!t&&u(this,Q).call(this,e)||(yield e),e!==u(this,W));)e=u(this,Y)[e]},we=function*({allowStale:t=this.allowStale}={}){if(u(this,q))for(let e=u(this,W);S(this,v,os).call(this,e)&&(!t&&u(this,Q).call(this,e)||(yield e),e!==u(this,M));)e=u(this,H)[e]},os=function(t){return t!==void 0&&u(this,F).get(u(this,B)[t])===t},mt=function(t){var i,o;const e=u(this,W),s=u(this,B)[e],r=u(this,k)[e];return u(this,Oe)&&S(this,v,L).call(this,r)?r.__abortController.abort(new Error("evicted")):(u(this,ce)||u(this,$))&&(u(this,ce)&&((i=u(this,se))==null||i.call(this,r,s,"evict")),u(this,$)&&((o=u(this,z))==null||o.push([r,s,"evict"]))),u(this,Ae).call(this,e),t&&(u(this,B)[e]=void 0,u(this,k)[e]=void 0,u(this,ie).push(e)),u(this,q)===1?(O(this,W,O(this,M,0)),u(this,ie).length=0):O(this,W,u(this,H)[e]),u(this,F).delete(s),tt(this,q)._--,e},yt=function(t,e,s,r){const i=e===void 0?void 0:u(this,k)[e];if(S(this,v,L).call(this,i))return i;const o=new kt,{signal:a}=s;a==null||a.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});const c={signal:o.signal,options:s,context:r},h=(y,g=!1)=>{const{aborted:E}=o.signal,w=s.ignoreFetchAbort&&y!==void 0;if(s.status&&(E&&!g?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,w&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),E&&!w&&!g)return l(o.signal.reason);const b=d;return u(this,k)[e]===d&&(y===void 0?b.__staleWhileFetching?u(this,k)[e]=b.__staleWhileFetching:S(this,v,Se).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,y,c.options))),y},l=y=>{const{aborted:g}=o.signal,E=g&&s.allowStaleOnFetchAbort,w=E||s.allowStaleOnFetchRejection,b=w||s.noDeleteOnFetchRejection,_=d;if(u(this,k)[e]===d&&(b&&_.__staleWhileFetching!==void 0?E||(u(this,k)[e]=_.__staleWhileFetching):S(this,v,Se).call(this,t,"fetch")),w)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw y};s.status&&(s.status.fetchDispatched=!0);const d=new Promise((y,g)=>{var w;const E=(w=u(this,Ue))==null?void 0:w.call(this,t,i,c);E&&E instanceof Promise&&E.then(b=>y(b===void 0?void 0:b),g),o.signal.addEventListener("abort",()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(y(void 0),s.allowStaleOnFetchAbort&&(y=b=>h(b,!0)))})}).then(h,y=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=y),l(y))),p=Object.assign(d,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return e===void 0?(this.set(t,p,{...c.options,status:void 0}),e=u(this,F).get(t)):u(this,k)[e]=p,p},L=function(t){if(!u(this,Oe))return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof kt},as=function(t,e){u(this,Y)[e]=t,u(this,H)[t]=e},Ge=function(t){t!==u(this,M)&&(t===u(this,W)?O(this,W,u(this,H)[t]):S(this,v,as).call(this,u(this,Y)[t],u(this,H)[t]),S(this,v,as).call(this,u(this,M),t),O(this,M,t))},Se=function(t,e){var r,i,o,a;let s=!1;if(u(this,q)!==0){const c=u(this,F).get(t);if(c!==void 0)if(s=!0,u(this,q)===1)S(this,v,cs).call(this,e);else{u(this,Ae).call(this,c);const h=u(this,k)[c];if(S(this,v,L).call(this,h)?h.__abortController.abort(new Error("deleted")):(u(this,ce)||u(this,$))&&(u(this,ce)&&((r=u(this,se))==null||r.call(this,h,t,e)),u(this,$)&&((i=u(this,z))==null||i.push([h,t,e]))),u(this,F).delete(t),u(this,B)[c]=void 0,u(this,k)[c]=void 0,c===u(this,M))O(this,M,u(this,Y)[c]);else if(c===u(this,W))O(this,W,u(this,H)[c]);else{const l=u(this,Y)[c];u(this,H)[l]=u(this,H)[c];const d=u(this,H)[c];u(this,Y)[d]=u(this,Y)[c]}tt(this,q)._--,u(this,ie).push(c)}}if(u(this,$)&&((o=u(this,z))!=null&&o.length)){const c=u(this,z);let h;for(;h=c==null?void 0:c.shift();)(a=u(this,ne))==null||a.call(this,...h)}return s},cs=function(t){var e,s,r;for(const i of S(this,v,we).call(this,{allowStale:!0})){const o=u(this,k)[i];if(S(this,v,L).call(this,o))o.__abortController.abort(new Error("deleted"));else{const a=u(this,B)[i];u(this,ce)&&((e=u(this,se))==null||e.call(this,o,a,t)),u(this,$)&&((s=u(this,z))==null||s.push([o,a,t]))}}if(u(this,F).clear(),u(this,k).fill(void 0),u(this,B).fill(void 0),u(this,X)&&u(this,ae)&&(u(this,X).fill(0),u(this,ae).fill(0)),u(this,oe)&&u(this,oe).fill(0),O(this,W,0),O(this,M,0),u(this,ie).length=0,O(this,re,0),O(this,q,0),u(this,$)&&u(this,z)){const i=u(this,z);let o;for(;o=i==null?void 0:i.shift();)(r=u(this,ne))==null||r.call(this,...o)}};let rs=Ts;var hs=function(n,t){return hs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,s){e.__proto__=s}||function(e,s){for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])},hs(n,t)};function Ce(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=n}hs(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Gn(n,t){var e,s,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(h){return function(l){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(e=1,s&&(r=2&l[0]?s.return:l[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,l[1])).done)return r;switch(s=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,s=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||l[0]!==6&&l[0]!==2)){o=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){o.label=l[1];break}if(l[0]===6&&o.label<r[1]){o.label=r[1],r=l;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(l);break}r[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(n,o)}catch(d){l=[6,d],s=0}finally{e=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([c,h])}}}function Ye(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],s=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&s>=n.length&&(n=void 0),{value:n&&n[s++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var s,r,i=e.call(n),o=[];try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(a){r={error:a}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}return o}function At(n,t,e){if(arguments.length===2)for(var s,r=0,i=t.length;r<i;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return n.concat(s||Array.prototype.slice.call(t))}function Be(n){return this instanceof Be?(this.v=n,this):new Be(n)}function V(n){return typeof n=="function"}function Kn(n){var t=n(function(e){Error.call(e),e.stack=new Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Vt=Kn(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
7
- `+t.map(function(e,s){return s+1+") "+e.toString()}).join(`
8
- `):"",this.name="UnsubscriptionError",this.errors=t}});function us(n,t){if(n){var e=n.indexOf(t);0<=e&&n.splice(e,1)}}var Pt=function(){function n(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var t,e,s,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Ye(o),c=a.next();!c.done;c=a.next())c.value.remove(this)}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var h=this.initialTeardown;if(V(h))try{h()}catch(g){i=g instanceof Vt?g.errors:[g]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=Ye(l),p=d.next();!p.done;p=d.next()){var y=p.value;try{nn(y)}catch(g){i=i??[],g instanceof Vt?i=At(At([],Rt(i)),Rt(g.errors)):i.push(g)}}}catch(g){s={error:g}}finally{try{p&&!p.done&&(r=d.return)&&r.call(d)}finally{if(s)throw s.error}}}if(i)throw new Vt(i)}},n.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)nn(t);else{if(t instanceof n){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},n.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},n.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},n.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&us(e,t)},n.prototype.remove=function(t){var e=this._finalizers;e&&us(e,t),t instanceof n&&t._removeParent(this)},n.EMPTY=function(){var t=new n;return t.closed=!0,t}(),n}(),Yn=Pt.EMPTY;function Xn(n){return n instanceof Pt||n&&"closed"in n&&V(n.remove)&&V(n.add)&&V(n.unsubscribe)}function nn(n){V(n)?n():n.unsubscribe()}var Qn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Xr={setTimeout:function(n,t){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];return setTimeout.apply(void 0,At([n,t],Rt(e)))},clearTimeout:function(n){return clearTimeout(n)},delegate:void 0};function Zn(n){Xr.setTimeout(function(){throw n})}function rn(){}function bt(n){n()}var ks=function(n){function t(e){var s=n.call(this)||this;return s.isStopped=!1,e?(s.destination=e,Xn(e)&&e.add(s)):s.destination=ei,s}return Ce(t,n),t.create=function(e,s,r){return new Xe(e,s,r)},t.prototype.next=function(e){this.isStopped?void 0:this._next(e)},t.prototype.error=function(e){this.isStopped?void 0:(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?void 0:(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Pt),Qr=Function.prototype.bind;function Wt(n,t){return Qr.call(n,t)}var Zr=function(){function n(t){this.partialObserver=t}return n.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(s){rt(s)}},n.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(s){rt(s)}else rt(t)},n.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){rt(e)}},n}(),Xe=function(n){function t(e,s,r){var i,o,a=n.call(this)||this;return V(e)||!e?i={next:e??void 0,error:s??void 0,complete:r??void 0}:a&&Qn.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return a.unsubscribe()},i={next:e.next&&Wt(e.next,o),error:e.error&&Wt(e.error,o),complete:e.complete&&Wt(e.complete,o)}):i=e,a.destination=new Zr(i),a}return Ce(t,n),t}(ks);function rt(n){Zn(n)}var ei={closed:!0,next:rn,error:function(n){throw n},complete:rn},ls=typeof Symbol=="function"&&Symbol.observable||"@@observable";function er(n){return n}var Ee=function(){function n(t){t&&(this._subscribe=t)}return n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.subscribe=function(t,e,s){var r=this,i=function(o){return o&&o instanceof ks||function(a){return a&&V(a.next)&&V(a.error)&&V(a.complete)}(o)&&Xn(o)}(t)?t:new Xe(t,e,s);return bt(function(){var o=r,a=o.operator,c=o.source;i.add(a?a.call(i,c):c?r._subscribe(i):r._trySubscribe(i))}),i},n.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},n.prototype.forEach=function(t,e){var s=this;return new(e=on(e))(function(r,i){var o=new Xe({next:function(a){try{t(a)}catch(c){i(c),o.unsubscribe()}},error:i,complete:r});s.subscribe(o)})},n.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},n.prototype[ls]=function(){return this},n.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return((s=t).length===0?er:s.length===1?s[0]:function(r){return s.reduce(function(i,o){return o(i)},r)})(this);var s},n.prototype.toPromise=function(t){var e=this;return new(t=on(t))(function(s,r){var i;e.subscribe(function(o){return i=o},function(o){return r(o)},function(){return s(i)})})},n.create=function(t){return new n(t)},n}();function on(n){var t;return(t=n??Qn.Promise)!==null&&t!==void 0?t:Promise}var ti=Kn(function(n){return function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Lt=function(n){function t(){var e=n.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return Ce(t,n),t.prototype.lift=function(e){var s=new an(this,this);return s.operator=e,s},t.prototype._throwIfClosed=function(){if(this.closed)throw new ti},t.prototype.next=function(e){var s=this;bt(function(){var r,i;if(s._throwIfClosed(),!s.isStopped){s.currentObservers||(s.currentObservers=Array.from(s.observers));try{for(var o=Ye(s.currentObservers),a=o.next();!a.done;a=o.next())a.value.next(e)}catch(c){r={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var s=this;bt(function(){if(s._throwIfClosed(),!s.isStopped){s.hasError=s.isStopped=!0,s.thrownError=e;for(var r=s.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;bt(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var s=e.observers;s.length;)s.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var s=this,r=this,i=r.hasError,o=r.isStopped,a=r.observers;return i||o?Yn:(this.currentObservers=null,a.push(e),new Pt(function(){s.currentObservers=null,us(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var s=this,r=s.hasError,i=s.thrownError,o=s.isStopped;r?e.error(i):o&&e.complete()},t.prototype.asObservable=function(){var e=new Ee;return e.source=this,e},t.create=function(e,s){return new an(e,s)},t}(Ee),an=function(n){function t(e,s){var r=n.call(this)||this;return r.destination=e,r.source=s,r}return Ce(t,n),t.prototype.next=function(e){var s,r;(r=(s=this.destination)===null||s===void 0?void 0:s.next)===null||r===void 0||r.call(s,e)},t.prototype.error=function(e){var s,r;(r=(s=this.destination)===null||s===void 0?void 0:s.error)===null||r===void 0||r.call(s,e)},t.prototype.complete=function(){var e,s;(s=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||s===void 0||s.call(e)},t.prototype._subscribe=function(e){var s,r;return(r=(s=this.source)===null||s===void 0?void 0:s.subscribe(e))!==null&&r!==void 0?r:Yn},t}(Lt),fe=function(n){function t(e){var s=n.call(this)||this;return s._value=e,s}return Ce(t,n),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var s=n.prototype._subscribe.call(this,e);return!s.closed&&e.next(this._value),s},t.prototype.getValue=function(){var e=this,s=e.hasError,r=e.thrownError,i=e._value;if(s)throw r;return this._throwIfClosed(),i},t.prototype.next=function(e){n.prototype.next.call(this,this._value=e)},t}(Lt),tr={now:function(){return(tr.delegate||Date).now()},delegate:void 0},it=function(n){function t(e,s,r){e===void 0&&(e=1/0),s===void 0&&(s=1/0),r===void 0&&(r=tr);var i=n.call(this)||this;return i._bufferSize=e,i._windowTime=s,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=s===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,s),i}return Ce(t,n),t.prototype.next=function(e){var s=this,r=s.isStopped,i=s._buffer,o=s._infiniteTimeWindow,a=s._timestampProvider,c=s._windowTime;r||(i.push(e),!o&&i.push(a.now()+c)),this._trimBuffer(),n.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var s=this._innerSubscribe(e),r=this._infiniteTimeWindow,i=this._buffer.slice(),o=0;o<i.length&&!e.closed;o+=r?1:2)e.next(i[o]);return this._checkFinalizedStatuses(e),s},t.prototype._trimBuffer=function(){var e=this,s=e._bufferSize,r=e._timestampProvider,i=e._buffer,o=e._infiniteTimeWindow,a=(o?1:2)*s;if(s<1/0&&a<i.length&&i.splice(0,i.length-a),!o){for(var c=r.now(),h=0,l=1;l<i.length&&i[l]<=c;l+=2)h=l;h&&i.splice(0,h+1)}},t}(Lt);function ze(n){return function(t){if(function(e){return V(e==null?void 0:e.lift)}(t))return t.lift(function(e){try{return n(e,this)}catch(s){this.error(s)}});throw new TypeError("Unable to lift unknown Observable type")}}function Me(n,t,e,s,r){return new si(n,t,e,s,r)}var si=function(n){function t(e,s,r,i,o,a){var c=n.call(this,e)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=s?function(h){try{s(h)}catch(l){e.error(l)}}:n.prototype._next,c._error=i?function(h){try{i(h)}catch(l){e.error(l)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=r?function(){try{r()}catch(h){e.error(h)}finally{this.unsubscribe()}}:n.prototype._complete,c}return Ce(t,n),t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var s=this.closed;n.prototype.unsubscribe.call(this),!s&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(ks);function cn(){return ze(function(n,t){var e,s=!1;n.subscribe(Me(t,function(r){var i=e;e=r,s&&t.next([i,r]),s=!0}))})}function hn(n,t){return ze(function(e,s){var r=0;e.subscribe(Me(s,function(i){return n.call(t,i,r++)&&s.next(i)}))})}function sr(n,t){return ze(function(e,s){var r=0;e.subscribe(Me(s,function(i){s.next(n.call(t,i,r++))}))})}var ni=function(n){return n&&typeof n.length=="number"&&typeof n!="function"},ri=typeof Symbol=="function"&&Symbol.iterator?Symbol.iterator:"@@iterator";function Tt(n){if(n instanceof Ee)return n;if(n!=null){if(function(i){return V(i[ls])}(n))return r=n,new Ee(function(i){var o=r[ls]();if(V(o.subscribe))return o.subscribe(i);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(ni(n))return s=n,new Ee(function(i){for(var o=0;o<s.length&&!i.closed;o++)i.next(s[o]);i.complete()});if(function(i){return V(i==null?void 0:i.then)}(n))return e=n,new Ee(function(i){e.then(function(o){i.closed||(i.next(o),i.complete())},function(o){return i.error(o)}).then(null,Zn)});if(function(i){return Symbol.asyncIterator&&V(i==null?void 0:i[Symbol.asyncIterator])}(n))return un(n);if(function(i){return V(i==null?void 0:i[ri])}(n))return t=n,new Ee(function(i){var o,a;try{for(var c=Ye(t),h=c.next();!h.done;h=c.next()){var l=h.value;if(i.next(l),i.closed)return}}catch(d){o={error:d}}finally{try{h&&!h.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}i.complete()});if(function(i){return V(i==null?void 0:i.getReader)}(n))return un(function(i){return function(o,a,c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h,l=c.apply(o,a||[]),d=[];return h={},p("next"),p("throw"),p("return",function(b){return function(_){return Promise.resolve(_).then(b,E)}}),h[Symbol.asyncIterator]=function(){return this},h;function p(b,_){l[b]&&(h[b]=function(R){return new Promise(function(C,P){d.push([b,R,C,P])>1||y(b,R)})},_&&(h[b]=_(h[b])))}function y(b,_){try{(R=l[b](_)).value instanceof Be?Promise.resolve(R.value.v).then(g,E):w(d[0][2],R)}catch(C){w(d[0][3],C)}var R}function g(b){y("next",b)}function E(b){y("throw",b)}function w(b,_){b(_),d.shift(),d.length&&y(d[0][0],d[0][1])}}(this,arguments,function(){var o,a,c;return Gn(this,function(h){switch(h.label){case 0:o=i.getReader(),h.label=1;case 1:h.trys.push([1,,9,10]),h.label=2;case 2:return[4,Be(o.read())];case 3:return a=h.sent(),c=a.value,a.done?[4,Be(void 0)]:[3,5];case 4:return[2,h.sent()];case 5:return[4,Be(c)];case 6:return[4,h.sent()];case 7:return h.sent(),[3,2];case 8:return[3,10];case 9:return o.releaseLock(),[7];case 10:return[2]}})})}(n))}var t,e,s,r;throw function(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(n)}function un(n){return new Ee(function(t){(function(e,s){var r,i,o,a,c,h,l,d;return c=this,h=void 0,d=function(){var p,y;return Gn(this,function(g){switch(g.label){case 0:g.trys.push([0,5,6,11]),r=function(E){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var w,b=E[Symbol.asyncIterator];return b?b.call(E):(E=Ye(E),w={},_("next"),_("throw"),_("return"),w[Symbol.asyncIterator]=function(){return this},w);function _(R){w[R]=E[R]&&function(C){return new Promise(function(P,j){(function(D,J,I,pr){Promise.resolve(pr).then(function(gr){D({value:gr,done:I})},J)})(P,j,(C=E[R](C)).done,C.value)})}}}(e),g.label=1;case 1:return[4,r.next()];case 2:if((i=g.sent()).done)return[3,4];if(p=i.value,s.next(p),s.closed)return[2];g.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return y=g.sent(),o={error:y},[3,11];case 6:return g.trys.push([6,,9,10]),i&&!i.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:g.sent(),g.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return s.complete(),[2]}})},new((l=void 0)||(l=Promise))(function(p,y){function g(b){try{w(d.next(b))}catch(_){y(_)}}function E(b){try{w(d.throw(b))}catch(_){y(_)}}function w(b){b.done?p(b.value):function(_){return _ instanceof l?_:new l(function(R){R(_)})}(b.value).then(g,E)}w((d=d.apply(c,h||[])).next())})})(n,t).catch(function(e){return t.error(e)})})}function ot(n){n===void 0&&(n={});var t=n.connector,e=t===void 0?function(){return new Lt}:t,s=n.resetOnError,r=s===void 0||s,i=n.resetOnComplete,o=i===void 0||i,a=n.resetOnRefCountZero,c=a===void 0||a;return function(h){var l,d,p,y=0,g=!1,E=!1,w=function(){d==null||d.unsubscribe(),d=void 0},b=function(){w(),l=p=void 0,g=E=!1},_=function(){var R=l;b(),R==null||R.unsubscribe()};return ze(function(R,C){y++,E||g||w();var P=p=p??e();C.add(function(){--y!=0||E||g||(d=Ht(_,c))}),P.subscribe(C),!l&&y>0&&(l=new Xe({next:function(j){return P.next(j)},error:function(j){E=!0,w(),d=Ht(b,r,j),P.error(j)},complete:function(){g=!0,w(),d=Ht(b,o),P.complete()}}),Tt(R).subscribe(l))})(h)}}function Ht(n,t){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];if(t!==!0){if(t!==!1){var r=new Xe({next:function(){r.unsubscribe(),n()}});return Tt(t.apply(void 0,At([],Rt(e)))).subscribe(r)}}else n()}function nr(n,t,e){return e===void 0&&(e=1/0),V(t)?nr(function(s,r){return sr(function(i,o){return t(s,i,r,o)})(Tt(n(s,r)))},e):(typeof t=="number"&&(e=t),ze(function(s,r){return function(i,o,a,c,h,l,d,p){var y=[],g=0,E=0,w=!1,b=function(){!w||y.length||g||o.complete()},_=function(C){return g<c?R(C):y.push(C)},R=function(C){g++;var P=!1;Tt(a(C,E++)).subscribe(Me(o,function(j){o.next(j)},function(){P=!0},void 0,function(){if(P)try{g--;for(var j=function(){var D=y.shift();R(D)};y.length&&g<c;)j();b()}catch(D){o.error(D)}}))};return i.subscribe(Me(o,_,function(){w=!0,b()})),function(){}}(s,r,n,e)}))}function ii(n,t){return n===t}const Ne=(n,t,e=!1)=>{if(n===t)return!0;if((n===void 0||t===void 0||n===null||t===null)&&(n||t))return!1;const s=n==null?void 0:n.constructor.name,r=t==null?void 0:t.constructor.name;if(s!==r)return!1;if(s==="Array"&&r==="Array"){if(n.length!==t.length)return!1;if(e){const i=[...t];return n.every(o=>{const a=i.findIndex(c=>Ne(o,c,e));return a!==-1&&(i.splice(a,1),!0)})}{let i=!0;for(let o=0;o<n.length;o++)if(!Ne(n[o],t[o],e)){i=!1;break}return i}}if(s==="Object"&&r==="Object"){let i=!0;const o=Object.keys(n),a=Object.keys(t);if(o.length!==a.length)return!1;for(let c=0;c<o.length;c++)if(n[o[c]]&&t[o[c]]){if(n[o[c]]===t[o[c]])continue;if(!n[o[c]]||n[o[c]].constructor.name!=="Array"&&n[o[c]].constructor.name!=="Object"){if(n[o[c]]!==t[o[c]]){i=!1;break}}else if(i=Ne(n[o[c]],t[o[c]],e),!i)break}else if(n[o[c]]&&!t[o[c]]||!n[o[c]]&&t[o[c]]){i=!1;break}return i}return n===t},G=n=>JSON.parse(JSON.stringify(n)),oi=(n,t)=>{const{origWidth:e,origHeight:s}=t,r=n.points.map(([i,o])=>[i*e/100,o*s/100]);return{...n,points:r}},ln=n=>{const{origWidth:t,origHeight:e,inputWidth:s,inputHeight:r}=n,[i,o,a,c]=n.boundingBox,h=i*t/s,l=o*e/r,d=a*t/s,p=c*e/r;return{...n,boundingBox:[h,l,d,p]}},dn=(n,t,e)=>{if(n.confidence<e.object.confidence)return!1;if(t.length===0)return!0;const[s,r,i,o]=n.boundingBox,a={xmin:s,ymin:r,xmax:i,ymax:o};let c=!1;for(const h of t){const l=oi(h,n);if(l.isPrivacyMask){if(We(a,l.points)){c=!1;break}}else l.filter==="include"?l.type==="contain"?We(a,l.points)&&(c=!0):l.type==="intersect"&&(fn(a,l.points)||We(a,l.points))&&(c=!0):l.filter==="exclude"&&(l.type==="contain"?We(a,l.points)||(c=!0):l.type==="intersect"&&(fn(a,l.points)||We(a,l.points)||(c=!0)))}return c},fn=(n,t)=>{const e=ai(n);for(const s of e)for(let r=0;r<t.length;r++){const i=[t[r],t[(r+1)%t.length]];if(ci(s,i))return!0}return!1},We=(n,t)=>[[n.xmin,n.ymin],[n.xmax,n.ymin],[n.xmax,n.ymax],[n.xmin,n.ymax]].every(e=>hi(e,t)),ai=n=>{const{xmin:t,ymin:e,xmax:s,ymax:r}=n;return[[[t,e],[s,e]],[[s,e],[s,r]],[[s,r],[t,r]],[[t,r],[t,e]]]},ci=(n,t)=>{const e=(a,c,h)=>(h[1]-a[1])*(c[0]-a[0])>(c[1]-a[1])*(h[0]-a[0]);return s=n[0],r=n[1],e(s,i=t[0],o=t[1])!==e(r,i,o)&&e(s,r,i)!==e(s,r,o);var s,r,i,o},hi=(n,t)=>{const[e,s]=n;let r=!1,[i,o]=t[t.length-1];for(const[a,c]of t)c>s!=o>s&&e<(i-a)*(s-c)/(o-c)+a&&(r=!r),[i,o]=[a,c];return r};class ui{constructor(){m(this,"subscriptions",[]);m(this,"additionalSubscriptions",[])}addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach(t=>t.unsubscribe())}unsubscribeAdditional(){this.additionalSubscriptions.forEach(t=>t.unsubscribe())}}class li extends ui{constructor(e,s){super();m(this,"logger");m(this,"snapshotCache",new rs({max:100,ttl:3e5}));m(this,"cameraSubject");m(this,"cameraState",new fe(!1));m(this,"lightState",new fe(this.getLightState({state:!1},!0)));m(this,"motionState",new fe(this.getMotionState({detections:[],state:!1},!0)));m(this,"audioState",new fe(this.getAudioState({state:!1,db:0},!0)));m(this,"objectState",new fe(this.getObjectState({detections:[]},!0)));m(this,"doorbellState",new fe(this.getDoorbellState({state:!1},!0)));m(this,"sirenState",new fe(this.getSirenState({state:!1,level:0},!0)));m(this,"batteryState",new fe(this.getBatteryState({level:100,charging:!1,lowBattery:!1},!0)));m(this,"prebufferStateSubjects",{});m(this,"onConnected",this.createStateObservable(this.cameraState));m(this,"onLightSwitched",this.createStateObservable(this.lightState));m(this,"onMotionDetected",this.createStateObservable(this.motionState));m(this,"onAudioDetected",this.createStateObservable(this.audioState));m(this,"onObjectDetected",this.createStateObservable(this.objectState));m(this,"onDoorbellPressed",this.createStateObservable(this.doorbellState));m(this,"onSirenDetected",this.createStateObservable(this.sirenState));m(this,"onBatteryChanged",this.createStateObservable(this.batteryState));this.logger=s,this.cameraSubject=new fe(e),e.pluginId==="native"&&this.cameraState.next(!0)}get cameraObject(){return G(this.cameraSubject.getValue())}get id(){return this.cameraSubject.getValue()._id}get nativeId(){return this.cameraSubject.getValue().nativeId}get pluginId(){return this.cameraSubject.getValue().pluginId}get connected(){return this.cameraState.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 G(this.cameraSubject.getValue().info)}get isCloud(){return this.cameraSubject.getValue().isCloud}get hasLight(){return this.cameraSubject.getValue().hasLight}get hasSiren(){return this.cameraSubject.getValue().hasSiren}get hasBinarySensor(){return this.cameraSubject.getValue().hasBinarySensor}get hasBattery(){return this.cameraSubject.getValue().hasBattery}get hasMotionDetector(){return this.cameraSubject.getValue().hasMotionDetector}get hasAudioDetector(){return this.cameraSubject.getValue().hasAudioDetector}get hasObjectDetector(){return this.cameraSubject.getValue().hasObjectDetector}get hasPtz(){return this.cameraSubject.getValue().hasPtz}get hasPrebuffer(){return this.cameraSubject.getValue().hasPrebuffer}get activityZones(){return G(this.cameraSubject.getValue().activityZones)}get activitySettings(){return G(this.cameraSubject.getValue().activitySettings)}get frameWorkerSettings(){return G(this.cameraSubject.getValue().frameWorkerSettings)}get sources(){return G(this.cameraSubject.getValue().sources).map(e=>({...e,updatePrebufferingState:async(s,r)=>this.updatePrebuffer(e._id,s,r),getPrebufferingState:s=>this.cameraSourcePrebufferState(e._id,s),onPrebuffering:s=>this.createPrebufferStateObservable(e._id,s),getStreamInfo:async()=>this.prebufferDelegate.getStreamInfo(e.name)}))}get streamSource(){return this.highResolutionSource||this.midResolutionSource||this.lowResolutionSource}get snapshotSource(){return this.sources.find(e=>e.roles.includes("snapshot"))}get highResolutionSource(){return this.sources.find(e=>e.roles.includes("high-resolution"))}get midResolutionSource(){return this.sources.find(e=>e.roles.includes("mid-resolution"))}get lowResolutionSource(){return this.sources.find(e=>e.roles.includes("low-resolution"))}getValue(e){switch(e){case"light":return G(this.lightState.getValue());case"motion":return G(this.motionState.getValue());case"audio":return G(this.audioState.getValue());case"object":return G(this.objectState.getValue());case"doorbell":return G(this.doorbellState.getValue());case"siren":return G(this.sirenState.getValue());case"battery":return G(this.batteryState.getValue());default:throw new Error(`Unknown state: ${e}`)}}async snapshot(e){const s=this.snapshotSource||this.streamSource,r=s.urls.www.jpegSnapshot,i=this.snapshotCache.get(s._id);if(!e&&i)return i;if(!s.roles.includes("snapshot")&&this.cameraObject.pluginId!=="native"){const c=await this.cameraDelegate.snapshot();return c.byteLength>0&&this.snapshotCache.set(s._id,c),c}const o=await fetch(r);if(!o.ok)throw new Error("Status Code: "+o.status);const a=await o.arrayBuffer();return a.byteLength>0&&this.snapshotCache.set(s._id,a),a}onStateChange(e){return this[`${e}State`].pipe(cn(),hn(([s,r])=>typeof s=="boolean"||typeof r=="boolean"?s!==r:this.stateChanged(s,r,e)),sr(([s,r])=>({oldState:s,newState:r})),ot({connector:()=>new it(1)}))}updateStateInternal(e,s,r){let i,o=!1;if(r)o=!0,i=s;else{const a=this.checkStateInternal(e,s);o=a.changed,i=a.event}if(o)switch(e){case"light":this.lightState.next(this.getLightState(i));break;case"motion":this.motionState.next(this.getMotionState(i));break;case"audio":this.audioState.next(this.getAudioState(i));break;case"object":this.objectState.next(this.getObjectState(i));break;case"doorbell":this.doorbellState.next(this.getDoorbellState(i));break;case"siren":this.sirenState.next(this.getSirenState(i));break;case"battery":this.batteryState.next(this.getBatteryState(i));break;default:throw new Error(`Unknown state: ${e}`)}}onPropertyChange(e){return this.cameraSubject.pipe(cn(),nr(([s,r])=>(Array.isArray(e)?e:[e]).map(i=>({property:i,oldData:s[i],newData:r[i]}))),hn(({oldData:s,newData:r})=>!Ne(s,r,!0)),ot({connector:()=>new it(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()}checkStateInternal(e,s){let r,i=!1;switch(e){case"audio":const o=s;r=this.getAudioState(o),i=this.stateChanged(this.getValue("audio"),r,"audio");break;case"light":const a=s;r=this.getLightState(a),i=this.stateChanged(this.getValue("light"),r,"light");break;case"motion":const c=s;c.state!==void 0&&(c.detections=[]),c.detections=((y,g,E)=>{const w=[];for(const b of y)dn(ln(b),g,E)&&g.some(_=>!_.classes.length||_.classes.includes(b.label))&&w.push(b);return w})(c.detections,this.activityZones,this.activitySettings),r=this.getMotionState(c),i=this.stateChanged(this.getValue("motion"),r,"motion");break;case"object":const h=s;h.detections=((y,g,E)=>{const w=[];for(const b of y)dn(ln(b),g,E)&&g.some(_=>!_.classes.length||_.classes.includes(b.label))&&w.push(b);return w})(h.detections,this.activityZones,this.activitySettings),r=this.getObjectState(h),i=this.stateChanged(this.getValue("object"),r,"object");break;case"doorbell":const l=s;r=this.getDoorbellState(l),i=this.stateChanged(this.getValue("doorbell"),r,"doorbell");break;case"siren":const d=s;r=this.getSirenState(d),i=this.stateChanged(this.getValue("siren"),r,"siren");break;case"battery":const p=s;r=this.getBatteryState(p),i=this.stateChanged(this.getValue("battery"),r,"battery");break;default:throw new Error(`Unknown state: ${e}`)}return{changed:i,event:r}}getAudioState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("audio");a.state?r=a:(o=a.lastEvent)!=null&&o.state&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,db:a.db||(r==null?void 0:r.db)||0,lastEvent:r||(a.state?a:void 0)}}return i}getMotionState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("motion");a.detections.length?r=a:(o=a.lastEvent)!=null&&o.detections.length&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,lastEvent:r||(a.detections.length?a:void 0)}}return i}getObjectState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("object");a.detections.length?r=a:(o=a.lastEvent)!=null&&o.detections.length&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,lastEvent:r||(a.detections.length?a:void 0)}}return i}getDoorbellState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("doorbell");a.state?r=a:(o=a.lastEvent)!=null&&o.state&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,lastEvent:r||(a.state?a:void 0)}}return i}getLightState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("light");a.state?r=a:(o=a.lastEvent)!=null&&o.state&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,lastEvent:r||(a.state?a:void 0)}}return i}getSirenState(e,s=!1){var o;let r,i;if(!s){const a=this.getValue("siren");a.state?r=a:(o=a.lastEvent)!=null&&o.state&&(r=a.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const a={...e,timestamp:Date.now()};i={...a,level:a.level||(r==null?void 0:r.level)||0,lastEvent:r||(a.state?a:void 0)}}return i}getBatteryState(e,s=!1){let r,i;if(!s){const o=this.getValue("battery");this.stateChanged(o,e,"battery")?r=o:o.lastEvent&&this.stateChanged(o.lastEvent,e,"battery")&&(r=o.lastEvent),r&&delete r.lastEvent}if(this.isStateEvent(e))i=e;else{const o={...e,timestamp:Date.now()};i={...o,charging:e.charging||(r==null?void 0:r.charging)||!1,lowBattery:e.lowBattery||(r==null?void 0:r.lowBattery)||!1,lastEvent:r||o}}return i}updateCamera(e){this.cameraSubject.next(e),this.updateCameraSourcesState()}async updatePrebuffer(e,s,r){this.prebufferStateSubjects[e]&&this.prebufferStateSubjects[e][s]&&this.prebufferStateSubjects[e][s].next({state:r.state,url:r.url||void 0,maxDuration:r.maxDuration,availableDuration:r.availableDuration})}updateCameraSourcesState(){const e=this.cameraSubject.getValue().sources;for(const s in this.prebufferStateSubjects)if(!e.some(r=>r._id===s)){for(const r in this.prebufferStateSubjects[s])this.prebufferStateSubjects[s][r].complete();delete this.prebufferStateSubjects[s]}}updateCameraState(e){this.cameraState.next(e)}cameraSourcePrebufferState(e,s){let r={state:!1,maxDuration:0,availableDuration:0};return this.prebufferStateSubjects[e]&&this.prebufferStateSubjects[e][s]&&(r=this.prebufferStateSubjects[e][s].getValue()),r}createStateObservable(e){return e.pipe(ot({connector:()=>new it(1)}))}createPrebufferStateObservable(e,s){return this.prebufferStateSubjects[e]||(this.prebufferStateSubjects[e]={}),this.prebufferStateSubjects[e][s]||(this.prebufferStateSubjects[e][s]=new fe({state:!1,maxDuration:0,availableDuration:0})),this.prebufferStateSubjects[e][s].pipe((i===void 0&&(i=er),r=(r=(o,a)=>o.state===a.state&&o.url===a.url)!=null?r:ii,ze(function(o,a){var c,h=!0;o.subscribe(Me(a,function(l){var d=i(l);!h&&r(c,d)||(h=!1,c=d,a.next(l))}))})),ot({connector:()=>new it(1)}));var r,i}stateChanged(e,s,r){if(!e||!s||!r)return!1;if(r=="audio"){if(!this.hasAudioDetector)return!1;const i=e,o=s;return i.state!==o.state||i.db!==o.db}if(r=="motion"){if(!this.hasMotionDetector)return!1;const i=e,o=s;return o.state!==void 0?i.state!==o.state:!Ne(i.detections,o.detections,!0)}if(r=="object"){if(!this.hasObjectDetector)return!1;const i=s;return!Ne(e.detections,i.detections,!0)}if(r=="siren"){if(!this.hasSiren)return!1;const i=e,o=s;return i.state!==o.state||i.level!==o.level}if(r=="battery"){if(!this.hasBattery)return!1;const i=e,o=s;return i.level!==o.level||i.lowBattery!==o.lowBattery||i.charging!==o.charging}if(r=="doorbell"){if(!this.hasBinarySensor)return!1;const i=s;return e.state!==i.state}if(r=="light"){if(!this.hasLight)return!1;const i=s;return e.state!==i.state}return!1}isStateEvent(e){return"timestamp"in e}}class di{}class fi{}class pi{}class gi extends di{constructor(e,s){super();m(this,"delegate");m(this,"onRequest");m(this,"logger");this.onRequest=e,this.logger=s}async snapshot(){return this.delegate?this.delegate.snapshot():this._onRequest("snapshot")}async reboot(){return this.delegate?this.delegate.reboot():this._onRequest("reboot")}_onRequest(e,s,r){return this.onRequest("cameraDelegate",e,s,r)}}class mi extends fi{constructor(e,s){super();m(this,"delegate");m(this,"onRequest");m(this,"logger");this.onRequest=e,this.logger=s}async getStreamInfo(e){return this.delegate?this.delegate.getStreamInfo(e):this._onRequest("prebuffer","getStreamInfo",[e])}async updatePrebufferState(e,s,r){return this._onRequest("cameraFn","updatePrebufferState",[e,s,r],0)}_onRequest(e,s,r,i){return this.onRequest("ptzDelegate",s,r,i)}}class yi extends pi{constructor(e,s){super();m(this,"delegate");m(this,"onRequest");m(this,"logger");this.onRequest=e,this.logger=s}async moveAbsolute(e,s,r){return this.delegate?this.delegate.moveAbsolute(e,s,r):this._onRequest("moveAbsolute",[e,s,r])}async moveRelative(e,s,r){return this.delegate?this.delegate.moveRelative(e,s,r):this._onRequest("moveRelative",[e,s,r])}async moveContinuous(e,s,r){return this.delegate?this.delegate.moveContinuous(e,s,r):this._onRequest("moveContinuous",[e,s,r])}async stop(){return this.delegate?this.delegate.stop():this._onRequest("stop",[])}_onRequest(e,s,r){return this.onRequest("ptzDelegate",e,s,r)}}class bi extends EventTarget{constructor(e,s,r,i){super();m(this,"cameraDevice");m(this,"socketService");m(this,"logger");m(this,"options");m(this,"videoPlayer");m(this,"socket");m(this,"streamId");m(this,"hasBackchannel",!1);m(this,"closed",!1);m(this,"micTransceiver",null);m(this,"pc",null);m(this,"buf",new Uint8Array(2097152));m(this,"mediaSource",null);m(this,"sourceBuffer",null);m(this,"bufLen",0);m(this,"mseCodecs","");m(this,"videoPlayerMp4");m(this,"media",["video","audio","microphone"]);m(this,"codecList",[]);m(this,"reconnectTimeout");m(this,"_finishLoading",!1);m(this,"webrtcReconnectTimeout");this.options=i,this.videoPlayer=i.videoElement,this.cameraDevice=e,this.socketService=s,this.logger=r;const{socket:o}=this.socketService.getSocket(`${e.id}-go2rtcSession`,!0);this.socket=o,this.socket.connect(),this.streamId=this.uuidv4(),this.createCodecsList()}get mode(){return this.options.mode}connect(e){e&&(this.options.mode=e),this.socket.on("ws-open",this.onWsOpen.bind(this)),this.socket.on("ws-close",this.onWsClose.bind(this)),this.socket.on("ws-message",this.onWsMessage.bind(this)),this.socket.emit("ws-open",{id:this.streamId,cameraSource:this.options.sourceName,mode:this.options.mode})}disconnect(){this.socket.removeListener("ws-open",this.onWsOpen.bind(this)),this.socket.removeListener("ws-close",this.onWsClose.bind(this)),this.socket.removeListener("ws-message",this.onWsMessage.bind(this)),this.socket.emit("ws-close",{id:this.streamId})}async reconnect(e){this.dispatchEvent(new Event("reconnect")),this.close(),await new Promise(s=>setTimeout(s,100)),this.connect(e)}reset(){var e,s,r;this._finishLoading=!1,(e=this.pc)==null||e.getTransceivers().forEach(i=>{var o,a;return(a=(o=i.sender)==null?void 0:o.track)==null?void 0:a.stop()}),(s=this.pc)==null||s.close(),this.pc=null,(r=this.videoPlayerMp4)==null||r.remove(),this.videoPlayerMp4=void 0,this.videoPlayer.srcObject=null,this.videoPlayer.src="",this.videoPlayer.poster=""}close(){this.closed=!0,this.reset(),this.disconnect(),this.socket.emit("end"),this.socket.removeAllListeners()}onWsOpen({id:e}){if(e===this.streamId)switch(this.options.mode){case"webrtc":case"webrtc/tcp":this.requestWebrtc();break;case"mse":this.requestMse();break;case"hls":this.requestHls();break;case"mp4":this.requestMp4();break;case"mjpeg":this.requestMjpeg();break;default:this.dispatchEvent(new ErrorEvent("error",{message:"Unknown mode: "+this.options.mode}))}}onWsClose({id:e}){e===this.streamId&&(this.closed||this.options.reconnectInterval===void 0||(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{this.reconnect()},this.options.reconnectInterval)))}onWsMessage({id:e,data:s}){if(e===this.streamId&&s.type)switch(s.type){case"mse":this.onMseData(s);break;case"hls":this.onHlsData(s);break;case"webrtc/candidate":case"webrtc/answer":this.onWebrtcData(s);break;case"mse-binary":this.onMseBuffer(s);break;case"mjpeg-binary":this.onMjpegBuffer(s);break;case"mp4-binary":this.onMp4Buffer(s);break;case"stream-info":this.onStreamInfo(s);break;case"error":this.dispatchEvent(new ErrorEvent("error",{error:s,message:s.value}))}}async requestWebrtc(){this.reset(),this.pc=new RTCPeerConnection({bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"}),this.pc.addEventListener("icecandidate",s=>{var i,o;if(this.options.mode==="webrtc/tcp"&&((i=s.candidate)==null?void 0:i.protocol)==="udp")return;const r=((o=s.candidate)==null?void 0:o.toJSON().candidate)||"";this.socket.emit("stream-payload",{id:this.streamId,data:{type:"webrtc/candidate",value:r}})}),this.pc.addEventListener("connectionstatechange",()=>{var s,r,i,o;if(((s=this.pc)==null?void 0:s.connectionState)==="connected"){const a=(r=this.pc)==null?void 0:r.getTransceivers().filter(c=>c.currentDirection==="recvonly").map(c=>c.receiver.track);this.videoPlayer.srcObject=new MediaStream(a),this.finishLoading(),this.play(),this.disconnect()}else((i=this.pc)==null?void 0:i.connectionState)!=="failed"&&((o=this.pc)==null?void 0:o.connectionState)!=="disconnected"||(clearTimeout(this.webrtcReconnectTimeout),this.webrtcReconnectTimeout=setTimeout(()=>{var a,c;((a=this.pc)==null?void 0:a.connectionState)!=="failed"&&((c=this.pc)==null?void 0:c.connectionState)!=="disconnected"||this.reconnect()},1e3))});const e=await this.createOffer();e&&this.socket.emit("stream-payload",{id:this.streamId,data:{type:"webrtc/offer",value:e.sdp}})}async onWebrtcData(e){var s,r,i;try{switch(e.type){case"webrtc/candidate":if(this.options.mode==="webrtc/tcp"&&e.value.indexOf(" udp ")>0)return;await((s=this.pc)==null?void 0:s.addIceCandidate({candidate:e.value,sdpMid:"0"}));break;case"webrtc/answer":await((r=this.pc)==null?void 0:r.setRemoteDescription({type:"answer",sdp:e.value}));break;case"error":if(e.value.indexOf("webrtc/offer")<0)return;(i=this.pc)==null||i.close()}}catch(o){this.dispatchEvent(new ErrorEvent("error",{error:o,message:o.message}))}}async createOffer(){if(this.pc){this.pc.addTransceiver("video",{direction:"recvonly"}),this.pc.addTransceiver("audio",{direction:"recvonly"}),this.micTransceiver=this.pc.addTransceiver("audio",{direction:"sendonly"});const e=await this.pc.createOffer();return await this.pc.setLocalDescription(e),e}}requestMse(){if(this.reset(),"ManagedMediaSource"in window){const e=window.ManagedMediaSource;this.mediaSource=new e,this.mediaSource.addEventListener("sourceopen",()=>{this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mse",value:this.parseCodecs(e.isTypeSupported)}})},{once:!0}),this.videoPlayer.disableRemotePlayback=!0,this.videoPlayer.srcObject=this.mediaSource}else this.mediaSource=new MediaSource,this.mediaSource.addEventListener("sourceopen",()=>{URL.revokeObjectURL(this.videoPlayer.src),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mse",value:this.parseCodecs(MediaSource.isTypeSupported)}})},{once:!0}),this.videoPlayer.src=URL.createObjectURL(this.mediaSource),this.videoPlayer.srcObject=null;this.play(),this.mseCodecs=""}onMseData(e){this.mediaSource&&(this.mseCodecs=e.value,this.bufLen=0,this.buf=new Uint8Array(2097152),this.sourceBuffer=this.mediaSource.addSourceBuffer(e.value),this.sourceBuffer.mode="segments",this.sourceBuffer.addEventListener("updateend",()=>{var s,r,i,o,a;if(!((s=this.sourceBuffer)!=null&&s.updating))try{if(this.bufLen>0){const c=this.buf.slice(0,this.bufLen);this.bufLen=0,(r=this.sourceBuffer)==null||r.appendBuffer(c)}else if((o=(i=this.sourceBuffer)==null?void 0:i.buffered)!=null&&o.length){const c=this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1)-15,h=this.sourceBuffer.buffered.start(0);c>h&&(this.sourceBuffer.remove(h,c),(a=this.mediaSource)==null||a.setLiveSeekableRange(c,c+15))}}catch{}}))}async onMseBuffer(e){var s,r,i;if(((s=this.mediaSource)==null?void 0:s.readyState)!=="closed")if(this.finishLoading(),((r=this.sourceBuffer)==null?void 0:r.updating)||this.bufLen>0){const o=new Uint8Array(e.value);this.buf.set(o,this.bufLen),this.bufLen+=o.byteLength}else try{(i=this.sourceBuffer)==null||i.appendBuffer(e.value)}catch{}else this.closed||(this.closed=!0,this.dispatchEvent(new ErrorEvent("error",{message:"MediaSource closed"})),this.options.mode="webrtc",this.requestWebrtc())}requestMjpeg(){this.reset(),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mjpeg"}})}onMjpegBuffer(e){this.videoPlayer.controls=!1,this.videoPlayer.poster="data:image/jpeg;base64,"+this.btoaBinary(e.value),this.finishLoading()}requestMp4(){this.reset();const e=document.createElement("canvas");let s=null;this.videoPlayerMp4=document.createElement("video"),this.videoPlayerMp4.autoplay=!0,this.videoPlayerMp4.playsInline=!0,this.videoPlayerMp4.muted=!0,this.videoPlayerMp4.addEventListener("loadeddata",()=>{this.videoPlayerMp4&&(s||(e.width=this.videoPlayerMp4.videoWidth,e.height=this.videoPlayerMp4.videoHeight,s=e.getContext("2d")),s==null||s.drawImage(this.videoPlayerMp4,0,0,e.width,e.height),this.videoPlayer.controls=!1,this.videoPlayer.poster=e.toDataURL("image/jpeg"))});const r=this.codecList.filter(i=>this.media.includes(i.indexOf("vc1")>0?"video":"audio")).filter(i=>this.videoPlayer.canPlayType(`video/mp4; codecs="${i}"`)).join();this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mp4",value:r}})}onMp4Buffer(e){this.finishLoading(),this.videoPlayerMp4&&(this.videoPlayerMp4.src="data:video/mp4;base64,"+this.btoaBinary(e.value))}requestHls(){this.reset(),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"hls",value:this.parseCodecs(e=>this.videoPlayer.canPlayType(e))}})}onHlsData(e){const s="http"+e.wsURL.substring(2,e.wsURL.indexOf("/ws"))+"/hls/",r=e.value.replace("hls/",s),i="data:application/vnd.apple.mpegurl;base64,"+btoa(r.toString());this.videoPlayer.src=i,this.finishLoading(),this.play()}onStreamInfo(e){var r;const s=e.value;(r=s==null?void 0:s.producers)!=null&&r.length&&(this.hasBackchannel=s.producers.some(i=>{var o;return(o=i.senders)==null?void 0:o.length}))}async play(){try{await this.videoPlayer.play()}catch(e){if(!this.videoPlayer.muted)return this.videoPlayer.muted=!0,this.play();this.logger.warn(this.cameraDevice.name,e)}}finishLoading(){this._finishLoading||(this._finishLoading=!0,this.dispatchEvent(new Event("finishLoading")))}createCodecsList(){const e=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],s=typeof window>"u"?null:navigator.userAgent.match(/Version\/(\d+).+Safari/);if(s!=null&&s[1]){const r=s[1]<"13"?"mp4a.40.2":s[1]<"14"?"flac":"opus";e.splice(e.indexOf(r))}this.codecList=e}parseCodecs(e){return this.codecList.filter(s=>this.media.includes(s.indexOf("vc1")>0?"video":"audio")).filter(s=>e(`video/mp4; codecs="${s}"`)).join()}btoaBinary(e){const s=new Uint8Array(e),r=s.byteLength;let i="";for(let o=0;o<r;o++)i+=String.fromCharCode(s[o]);return window.btoa(i)}uuidv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}}class pn extends li{constructor(e,s,r){super(e,r);m(this,"socketService");m(this,"socket");m(this,"pluginName","@camera.ui/client");m(this,"subject");m(this,"_started",!1);m(this,"cameraDelegate",new gi(this.onRequest.bind(this),this.logger));m(this,"prebufferDelegate",new mi(this.onRequest.bind(this),this.logger));m(this,"ptzDelegate",new yi(this.onRequest.bind(this),this.logger));this.socketService=s;const{socket:i}=this.socketService.getSocket(this.id,!0);this.socket=i,this.socket.connect(),this.subject=`${this.pluginName}.camera.${this.id}`,this.listenToMessages()}get started(){return this._started}get sources(){return super.sources.map(e=>({...e,updatePrebufferingState:(s,r)=>this.prebufferDelegate.updatePrebufferState(e._id,s,r),getPrebufferingState:s=>super.cameraSourcePrebufferState(e._id,s),onPrebuffering:s=>super.createPrebufferStateObservable(e._id,s),getStreamInfo:async()=>this.prebufferDelegate.getStreamInfo(e.name)}))}async start(){this._started||(this._started=!0,await this.refreshStates(),this.socket.emit("joinRoomStates",this.id))}stop(){this._started=!1,this.socket.emit("leaveRoomStates",this.id)}close(){this.cleanup()}connect(){return this.onRequest("cameraFn","connect")}disconnect(){return this.onRequest("cameraFn","disconnect")}getIceServers(){return this.onRequest("cameraFn","getIceServers")}createSession(e){return new bi(this,this.socketService,this.logger,e)}async updateState(e,s){const{changed:r,event:i}=super.checkStateInternal(e,s);if(r)return super.updateStateInternal(e,i,!0),this.onRequest("cameraFn","updateState",[e,i])}addCameraSource(e){return this.onRequest("cameraFn","addCameraSource",[e])}updateCameraSource(e,s){return this.onRequest("cameraFn","updateCameraSource",[e,s])}removeCameraSource(e){return this.onRequest("cameraFn","removeCameraSource",[e])}async refreshStates(){const e=await this.onRequest("cameraFn","refreshStates");super.updateCamera(e.camera),super.updateCameraState(e.cameraState);for(const[s,r]of Object.entries(e.states))super.updateStateInternal(s,r,!0)}async cleanup(){this.stop(),this.removeAllListeners(),this.unsubscribe(),this.socket.removeAllListeners()}listenToMessages(){this.socket.emit("joinRoomDevice",this.id),this.socket.on("updateState",e=>{e.cameraId===this.id&&super.updateStateInternal(e.stateName,e.data.newEvent,!0)}),this.socket.on("updateDevice",e=>{if(e.cameraId===this.id)switch(e.type){case"removed":this.cleanup();break;case"updated":super.updateCamera(e.data);break;case"cameraState":super.updateCameraState(e.data);break;case"prebufferState":super.updatePrebuffer(e.data.sourceId,e.data.container,e.data.state)}})}onRequest(e,s,r=[]){const i={requestId:crypto.randomUUID(),targetId:this.subject,targetName:this.name,pluginId:this.pluginName,cameraId:this.id,type:"request",proxy:"camera",client:e,fn:s,args:r,timestamp:Date.now(),timeout:5e3};return new Promise((o,a)=>{this.socket.emit("request",i,c=>{c.error?a(c.error):o(c.response)})})}}class vi{constructor(t,e){m(this,"socketService");m(this,"socket");m(this,"logger");m(this,"pluginName","@camera.ui/client");m(this,"subject");this.socketService=t,this.socket=t.socket,this.logger=e,this.subject=`${this.pluginName}.deviceManager`}async getCameraById(t){const e=await this.onRequest("getCameraById",[t]);if(e){const s=new pn(e,this.socketService,this.logger);return await s.refreshStates(),s}}async getCameraByName(t){const e=await this.onRequest("getCameraByName",[t]);if(e){const s=new pn(e,this.socketService,this.logger);return await s.refreshStates(),s}}onRequest(t,e){const s={requestId:crypto.randomUUID(),targetId:this.subject,targetName:this.pluginName,pluginId:this.pluginName,type:"request",proxy:"device",client:"deviceFn",fn:t,args:e||[],timestamp:Date.now(),timeout:5e3};return new Promise((r,i)=>{this.socket.emit("request",s,o=>{o.error?i(o.error):r(o.response)})})}}const pe=Object.create(null);pe.open="0",pe.close="1",pe.ping="2",pe.pong="3",pe.message="4",pe.upgrade="5",pe.noop="6";const vt=Object.create(null);Object.keys(pe).forEach(n=>{vt[pe[n]]=n});const ds={type:"error",data:"parser error"},rr=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ir=typeof ArrayBuffer=="function",or=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,$t=({type:n,data:t},e,s)=>rr&&t instanceof Blob?e?s(t):gn(t,s):ir&&(t instanceof ArrayBuffer||or(t))?e?s(t):gn(new Blob([t]),s):s(pe[n]+(t||"")),gn=(n,t)=>{const e=new FileReader;return e.onload=function(){const s=e.result.split(",")[1];t("b"+(s||""))},e.readAsDataURL(n)};function mn(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Jt;const Ke=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<64;n++)Ke["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(n)]=n;const wi=typeof ArrayBuffer=="function",fs=(n,t)=>{if(typeof n!="string")return{type:"message",data:ar(n,t)};const e=n.charAt(0);return e==="b"?{type:"message",data:Si(n.substring(1),t)}:vt[e]?n.length>1?{type:vt[e],data:n.substring(1)}:{type:vt[e]}:ds},Si=(n,t)=>{if(wi){const e=(s=>{let r,i,o,a,c,h=.75*s.length,l=s.length,d=0;s[s.length-1]==="="&&(h--,s[s.length-2]==="="&&h--);const p=new ArrayBuffer(h),y=new Uint8Array(p);for(r=0;r<l;r+=4)i=Ke[s.charCodeAt(r)],o=Ke[s.charCodeAt(r+1)],a=Ke[s.charCodeAt(r+2)],c=Ke[s.charCodeAt(r+3)],y[d++]=i<<2|o>>4,y[d++]=(15&o)<<4|a>>2,y[d++]=(3&a)<<6|63&c;return p})(n);return ar(e,t)}return{base64:!0,data:n}},ar=(n,t)=>t==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,yn="";let Gt;function at(n){return n.reduce((t,e)=>t+e.length,0)}function ct(n,t){if(n[0].length===t)return n.shift();const e=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)e[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),e}function U(n){if(n)return function(t){for(var e in U.prototype)t[e]=U.prototype[e];return t}(n)}U.prototype.on=U.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this},U.prototype.once=function(n,t){function e(){this.off(n,e),t.apply(this,arguments)}return e.fn=t,this.on(n,e),this},U.prototype.off=U.prototype.removeListener=U.prototype.removeAllListeners=U.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e,s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r=0;r<s.length;r++)if((e=s[r])===t||e.fn===t){s.splice(r,1);break}return s.length===0&&delete this._callbacks["$"+n],this},U.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+n],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(e){s=0;for(var r=(e=e.slice(0)).length;s<r;++s)e[s].apply(this,t)}return this},U.prototype.emitReserved=U.prototype.emit,U.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},U.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ee=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function cr(n,...t){return t.reduce((e,s)=>(n.hasOwnProperty(s)&&(e[s]=n[s]),e),{})}const Ei=ee.setTimeout,_i=ee.clearTimeout;function Bt(n,t){t.useNativeTimers?(n.setTimeoutFn=Ei.bind(ee),n.clearTimeoutFn=_i.bind(ee)):(n.setTimeoutFn=ee.setTimeout.bind(ee),n.clearTimeoutFn=ee.clearTimeout.bind(ee))}class Oi extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class Kt extends U{constructor(t){super(),this.writable=!1,Bt(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,s){return super.emitReserved("error",new Oi(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return this.readyState!=="opening"&&this.readyState!=="open"||(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=fs(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const e=function(s){let r="";for(let i in s)s.hasOwnProperty(i)&&(r.length&&(r+="&"),r+=encodeURIComponent(i)+"="+encodeURIComponent(s[i]));return r}(t);return e.length?"?"+e:""}}const hr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ps=64,ki={};let bn,vn=0,ht=0;function wn(n){let t="";do t=hr[n%ps]+t,n=Math.floor(n/ps);while(n>0);return t}function Sn(){const n=wn(+new Date);return n!==bn?(vn=0,bn=n):n+"."+wn(vn++)}for(;ht<ps;ht++)ki[hr[ht]]=ht;let ur=!1;try{ur=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ri=ur;function lr(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ri))return new XMLHttpRequest}catch{}if(!t)try{return new ee[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ai(){}const Ti=new lr({xdomain:!1}).responseType!=null;class ge extends U{constructor(t,e){super(),Bt(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=e.data!==void 0?e.data:null,this.create()}create(){var t;const e=cr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const s=this.xhr=new lr(e);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this.opts.cookieJar)===null||r===void 0||r.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(r){return void this.setTimeoutFn(()=>{this.onError(r)},0)}typeof document<"u"&&(this.index=ge.requestsCount++,ge.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(this.xhr!==void 0&&this.xhr!==null){if(this.xhr.onreadystatechange=Ai,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ge.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function En(){for(let n in ge.requests)ge.requests.hasOwnProperty(n)&&ge.requests[n].abort()}ge.requestsCount=0,ge.requests={},typeof document<"u"&&(typeof attachEvent=="function"?attachEvent("onunload",En):typeof addEventListener=="function"&&addEventListener("onpagehide"in ee?"pagehide":"unload",En,!1));const gs=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,t)=>t(n,0),ut=ee.WebSocket||ee.MozWebSocket,_n=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",xi={websocket:class extends Kt{constructor(n){super(n),this.supportsBinary=!n.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const n=this.uri(),t=this.opts.protocols,e=_n?{}:cr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(e.headers=this.opts.extraHeaders);try{this.ws=_n?new ut(n,t,e):t?new ut(n,t):new ut(n)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let t=0;t<n.length;t++){const e=n[t],s=t===n.length-1;$t(e,this.supportsBinary,r=>{try{this.ws.send(r)}catch{}s&&gs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Sn()),this.supportsBinary||(t.b64=1),this.createUri(n,t)}check(){return!!ut}},webtransport:class extends Kt{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(n=>{const t=function(o,a){Gt||(Gt=new TextDecoder);const c=[];let h=0,l=-1,d=!1;return new TransformStream({transform(p,y){for(c.push(p);;){if(h===0){if(at(c)<1)break;const g=ct(c,1);d=!(128&~g[0]),l=127&g[0],h=l<126?3:l===126?1:2}else if(h===1){if(at(c)<2)break;const g=ct(c,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),h=3}else if(h===2){if(at(c)<8)break;const g=ct(c,8),E=new DataView(g.buffer,g.byteOffset,g.length),w=E.getUint32(0);if(w>Math.pow(2,21)-1){y.enqueue(ds);break}l=w*Math.pow(2,32)+E.getUint32(4),h=3}else{if(at(c)<l)break;const g=ct(c,l);y.enqueue(fs(d?g:Gt.decode(g),a)),h=0}if(l===0||l>o){y.enqueue(ds);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),e=n.readable.pipeThrough(t).getReader(),s=new TransformStream({transform(o,a){(function(c,h){rr&&c.data instanceof Blob?c.data.arrayBuffer().then(mn).then(h):ir&&(c.data instanceof ArrayBuffer||or(c.data))?h(mn(c.data)):$t(c,!1,l=>{Jt||(Jt=new TextEncoder),h(Jt.encode(l))})})(o,c=>{const h=c.length;let l;if(h<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,h);else if(h<65536){l=new Uint8Array(3);const d=new DataView(l.buffer);d.setUint8(0,126),d.setUint16(1,h)}else{l=new Uint8Array(9);const d=new DataView(l.buffer);d.setUint8(0,127),d.setBigUint64(1,BigInt(h))}o.data&&typeof o.data!="string"&&(l[0]|=128),a.enqueue(l),a.enqueue(c)})}});s.readable.pipeTo(n.writable),this.writer=s.writable.getWriter();const r=()=>{e.read().then(({done:o,value:a})=>{o||(this.onPacket(a),r())}).catch(o=>{})};r();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this.writer.write(i).then(()=>this.onOpen())})}))}write(n){this.writable=!1;for(let t=0;t<n.length;t++){const e=n[t],s=t===n.length-1;this.writer.write(e).then(()=>{s&&gs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this.transport)===null||n===void 0||n.close()}},polling:class extends Kt{constructor(n){if(super(n),this.polling=!1,typeof location<"u"){const e=location.protocol==="https:";let s=location.port;s||(s=e?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||s!==n.port}const t=n&&n.forceBase64;this.supportsBinary=Ti&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(n){this.readyState="pausing";const t=()=>{this.readyState="paused",n()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){((t,e)=>{const s=t.split(yn),r=[];for(let i=0;i<s.length;i++){const o=fs(s[i],e);if(r.push(o),o.type==="error")break}return r})(n,this.socket.binaryType).forEach(t=>{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)}),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,((t,e)=>{const s=t.length,r=new Array(s);let i=0;t.forEach((o,a)=>{$t(o,!1,c=>{r[a]=c,++i===s&&e(r.join(yn))})})})(n,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Sn()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(n,t)}request(n={}){return Object.assign(n,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ge(this.uri(),n)}doWrite(n,t){const e=this.request({method:"POST",data:n});e.on("success",t),e.on("error",(s,r)=>{this.onError("xhr post error",s,r)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=n}}},Ci=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ji=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ms(n){if(n.length>2e3)throw"URI too long";const t=n,e=n.indexOf("["),s=n.indexOf("]");e!=-1&&s!=-1&&(n=n.substring(0,e)+n.substring(e,s).replace(/:/g,";")+n.substring(s,n.length));let r=Ci.exec(n||""),i={},o=14;for(;o--;)i[ji[o]]=r[o]||"";return e!=-1&&s!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(a,c){const h=c.replace(/\/{2,9}/g,"/").split("/");return c.slice(0,1)!="/"&&c.length!==0||h.splice(0,1),c.slice(-1)=="/"&&h.splice(h.length-1,1),h}(0,i.path),i.queryKey=function(a,c){const h={};return c.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,d,p){d&&(h[d]=p)}),h}(0,i.query),i}class _e extends U{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&typeof t=="object"&&(e=t,t=null),t?(t=ms(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=ms(e.host).host),Bt(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=function(s){let r={},i=s.split("&");for(let o=0,a=i.length;o<a;o++){let c=i[o].split("=");r[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return r}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new xi[t](s)}open(){let t;if(this.opts.rememberUpgrade&&_e.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(this.transports.length===0)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch{return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(t){let e=this.createTransport(t),s=!1;_e.priorWebsocketSuccess=!1;const r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",d=>{if(!s)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;_e.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(l(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=e.name,this.emitReserved("upgradeError",p)}}))};function i(){s||(s=!0,l(),e.close(),e=null)}const o=d=>{const p=new Error("probe error: "+d);p.transport=e.name,i(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function c(){o("socket closed")}function h(d){e&&d.name!==e.name&&i()}const l=()=>{e.removeListener("open",r),e.removeListener("error",o),e.removeListener("close",a),this.off("close",c),this.off("upgrading",h)};e.once("open",r),e.once("error",o),e.once("close",a),this.once("close",c),this.once("upgrading",h),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onOpen(){if(this.readyState="open",_e.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=typeof(e=r)=="string"?function(i){let o=0,a=0;for(let c=0,h=i.length;c<h;c++)o=i.charCodeAt(c),o<128?a+=1:o<2048?a+=2:o<55296||o>=57344?a+=3:(c++,a+=4);return a}(e):Math.ceil(1.33*(e.byteLength||e.size))),s>0&&t>this.maxPayload)return this.writeBuffer.slice(0,s);t+=2}var e;return this.writeBuffer}write(t,e,s){return this.sendPacket("message",t,e,s),this}send(t,e,s){return this.sendPacket("message",t,e,s),this}sendPacket(t,e,s,r){if(typeof e=="function"&&(r=e,e=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;(s=s||{}).compress=s.compress!==!1;const i={type:t,data:e,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return this.readyState!=="opening"&&this.readyState!=="open"||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}onError(t){_e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){this.readyState!=="opening"&&this.readyState!=="open"&&this.readyState!=="closing"||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let s=0;const r=t.length;for(;s<r;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}_e.protocol=4;const Pi=typeof ArrayBuffer=="function",Li=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,dr=Object.prototype.toString,Bi=typeof Blob=="function"||typeof Blob<"u"&&dr.call(Blob)==="[object BlobConstructor]",Di=typeof File=="function"||typeof File<"u"&&dr.call(File)==="[object FileConstructor]";function Rs(n){return Pi&&(n instanceof ArrayBuffer||Li(n))||Bi&&n instanceof Blob||Di&&n instanceof File}function wt(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let e=0,s=n.length;e<s;e++)if(wt(n[e]))return!0;return!1}if(Rs(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return wt(n.toJSON(),!0);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&wt(n[e]))return!0;return!1}function Ni(n){const t=[],e=n.data,s=n;return s.data=ys(e,t),s.attachments=t.length,{packet:s,buffers:t}}function ys(n,t){if(!n)return n;if(Rs(n)){const e={_placeholder:!0,num:t.length};return t.push(n),e}if(Array.isArray(n)){const e=new Array(n.length);for(let s=0;s<n.length;s++)e[s]=ys(n[s],t);return e}if(typeof n=="object"&&!(n instanceof Date)){const e={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=ys(n[s],t));return e}return n}function Fi(n,t){return n.data=bs(n.data,t),delete n.attachments,n}function bs(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=bs(n[e],t);else if(typeof n=="object")for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(n[e]=bs(n[e],t));return n}const Ui=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qi=5;var T;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(T||(T={}));class Ii{constructor(t){this.replacer=t}encode(t){return t.type!==T.EVENT&&t.type!==T.ACK||!wt(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===T.EVENT?T.BINARY_EVENT:T.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==T.BINARY_EVENT&&t.type!==T.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=Ni(t),s=this.encodeAsString(e.packet),r=e.buffers;return r.unshift(s),r}}function On(n){return Object.prototype.toString.call(n)==="[object Object]"}class As extends U{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const s=e.type===T.BINARY_EVENT;s||e.type===T.BINARY_ACK?(e.type=s?T.EVENT:T.ACK,this.reconstructor=new Mi(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!Rs(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const s={type:Number(t.charAt(0))};if(T[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===T.BINARY_EVENT||s.type===T.BINARY_ACK){const i=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);const o=t.substring(i,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(e+1)==="/"){const i=e+1;for(;++e&&t.charAt(e)!==","&&e!==t.length;);s.nsp=t.substring(i,e)}else s.nsp="/";const r=t.charAt(e+1);if(r!==""&&Number(r)==r){const i=e+1;for(;++e;){const o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}s.id=Number(t.substring(i,e+1))}if(t.charAt(++e)){const i=this.tryParse(t.substr(e));if(!As.isPayloadValid(s.type,i))throw new Error("invalid payload");s.data=i}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case T.CONNECT:return On(e);case T.DISCONNECT:return e===void 0;case T.CONNECT_ERROR:return typeof e=="string"||On(e);case T.EVENT:case T.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Ui.indexOf(e[0])===-1);case T.ACK:case T.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Mi{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const e=Fi(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function he(n,t,e){return n.on(t,e),function(){n.off(t,e)}}const zi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class fr extends U{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[he(t,"open",this.onopen.bind(this)),he(t,"packet",this.onpacket.bind(this)),he(t,"error",this.onerror.bind(this)),he(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(zi.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const s={type:T.EVENT,data:e,options:{}};if(s.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const i=this.ids++,o=e.pop();this._registerAckCallback(i,o),s.id=i}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,e){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0)return void(this.acks[t]=e);const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>{if(s===this._queue[0])return r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(r)):(this._queue.shift(),e&&e(null,...i)),s.pending=!1,this._drainQueue()}),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:T.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){const e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case T.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case T.EVENT:case T.BINARY_EVENT:this.onevent(t);break;case T.ACK:case T.BINARY_ACK:this.onack(t);break;case T.DISCONNECT:this.ondisconnect();break;case T.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const s of e)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let s=!1;return function(...r){s||(s=!0,e.packet({type:T.ACK,id:t,data:r}))}}onack(t){const e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:T.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s])return e.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s])return e.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const s of e)s.apply(this,t.data)}}}function Le(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Le.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*n);n=1&Math.floor(10*t)?n+e:n-e}return 0|Math.min(n,this.max)},Le.prototype.reset=function(){this.attempts=0},Le.prototype.setMin=function(n){this.ms=n},Le.prototype.setMax=function(n){this.max=n},Le.prototype.setJitter=function(n){this.jitter=n};class xt extends U{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,Bt(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((s=e.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Le({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;const r=e.parser||Qt;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new _e(this.uri,this.opts);const e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=he(e,"open",function(){s.onopen(),t&&t()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=he(e,"error",i);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),e.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(he(t,"ping",this.onping.bind(this)),he(t,"data",this.ondata.bind(this)),he(t,"error",this.onerror.bind(this)),he(t,"close",this.onclose.bind(this)),he(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){gs(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new fr(this,t,e),this.nsps[t]=s),s}_destroy(t){const e=Object.keys(this.nsps);for(const s of e)if(this.nsps[s].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const He={};function Yt(n,t){typeof n=="object"&&(t=n,n=void 0);const e=function(c,h="",l){let d=c;l=l||typeof location<"u"&&location,c==null&&(c=l.protocol+"//"+l.host),typeof c=="string"&&(c.charAt(0)==="/"&&(c=c.charAt(1)==="/"?l.protocol+c:l.host+c),/^(https?|wss?):\/\//.test(c)||(c=l!==void 0?l.protocol+"//"+c:"https://"+c),d=ms(c)),d.port||(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/";const p=d.host.indexOf(":")!==-1?"["+d.host+"]":d.host;return d.id=d.protocol+"://"+p+":"+d.port+h,d.href=d.protocol+"://"+p+(l&&l.port===d.port?"":":"+d.port),d}(n,(t=t||{}).path||"/socket.io"),s=e.source,r=e.id,i=e.path,o=He[r]&&i in He[r].nsps;let a;return t.forceNew||t["force new connection"]||t.multiplex===!1||o?a=new xt(s,t):(He[r]||(He[r]=new xt(s,t)),a=He[r]),e.query&&!t.query&&(t.query=e.queryKey),a.socket(e.path,t)}Object.assign(Yt,{Manager:xt,Socket:fr,io:Yt,connect:Yt});class Vi{constructor(t,e){m(this,"socket");m(this,"token");m(this,"endpoint");m(this,"socketList",new Map);this.endpoint=t.replace("https://","wss://").replace("http://","ws://"),this.token=e,this.socket=this.getSocket("default").socket,this.socket.connect()}close(){this.socket.emit("end"),this.socket.removeAllListeners(),this.socket.disconnect()}getSocket(t,e){return this.socketList.has(t)||this.socketList.set(t,this.createManager(e)),this.socketList.get(t)}createManager(t){const e=new xt(this.endpoint,{reconnection:!0,reconnectionDelay:500,rejectUnauthorized:!1,transports:["websocket"],forceNew:t}),s=e.socket("/proxy",{auth:{token:`Bearer ${this.token}`}});return{manager:e,socket:s}}}class Wi{constructor(t){m(this,"api");m(this,"socketService");m(this,"config");m(this,"logger");m(this,"token");m(this,"deviceManager");this.config=t,this.logger=t.logger||{...console,attention:console.warn},this.api=new Yr(t.endpoint)}async connect(){return this.deviceManager||(this.cleanUpClient(),await this.login(),this.token=this.token||this.config.token,this.socketService=new Vi(this.config.endpoint,this.token),this.deviceManager=new vi(this.socketService,this.logger),this.checkSession()),{deviceManager:this.deviceManager}}async disconnect(){var t;(t=this.socketService)==null||t.close(),this.cleanUpClient(),this.config.username&&this.config.password&&await this.api.interceptor.post("/auth/logout",void 0,{headers:{Authorization:`Bearer ${this.token}`}})}async updateCredentials(t){this.config={...this.config,...t},this.socketService&&await this.disconnect(),await this.connect()}async login(){var t;if(this.config.username&&this.config.password)try{const e=await this.api.interceptor.post("/auth/login",{username:this.config.username,password:this.config.password});this.token=e.data.access_token}catch(e){throw((t=e.response)==null?void 0:t.status)===401?new Error("Invalid credentials"):new Error(`Failed to get token: ${e.message}`)}else if(this.config.token&&!this.config.skipCheck)try{await this.api.interceptor.get("/auth/check",{headers:{Authorization:`Bearer ${this.config.token}`}})}catch(e){throw new Error(`Invalid token: ${e.message}`)}this.token=this.token||this.config.token}getDeviceManager(){return this.deviceManager}checkSession(){var t,e;(t=this.socketService)==null||t.socket.removeListener("invalidToken"),(e=this.socketService)==null||e.socket.on("invalidToken",async s=>{s===this.token&&await this.disconnect()})}cleanUpClient(){this.deviceManager=void 0}}var $i=Tn.j;export{$i as g};
@@ -1 +0,0 @@
1
- import{f as q,u as J,c as G,r as H,_ as K,d as Q}from"./main-C4rYiRNz.js";import{F as W,r as p,J as X,e as M,O as P,R as r,u as e,j as s,T as n,M as a,m as $,V as k,l as Y,q as Z,n as z,ah as L,ai as ee}from"./@vue-C7-KaDG4.js";import{m as B,a as O}from"./@mdi-C-QA1nE3.js";import{F as C,a as se}from"./vee-validate-D3FqbChK.js";import{s as oe}from"./pinia-D8MtiGcH.js";import{c as F,y as te,V as j,b as N}from"./vuetify-_-Oqac3B.js";import"./vue-inline-svg-2DDwYW6V.js";import"./vue3-toastify-Ul-rf53I.js";import"./vue-i18n-1AU8MPys.js";import"./@intlify-Ck2ZoCVz.js";import"./axios--Jv2L996.js";import"./@tanstack-BqH4GyO-.js";import"./@camera.ui-2NVnv26v.js";import"./vue-router-DfeQ8s4I.js";import"./@vueuse-C3WMTDqL.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./@vee-validate-DCBdnGo-.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-B53o3e_J.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-uh0aTGqP.js";import"./@popperjs-BQBsAJpH.js";const D=b=>(L("data-v-a7eb4a7f"),b=b(),ee(),b),ae={class:"relative"},re={class:"subview-title text-color"},ne={class:"image-upload ml-auto"},ie={for:"file-input"},le={class:"inner-component p-4"},me={class:"relative"},de={for:"username",class:"v-label"},pe=D(()=>s("div",{class:"py-2"},null,-1)),ce={class:"relative"},ue={for:"sessionTimer",class:"v-label"},ve=D(()=>s("div",{class:"my-5"},null,-1)),fe={class:"subview-title text-color"},_e={class:"inner-component p-4"},be={class:"relative"},ge={for:"password",class:"v-label"},he={class:"relative"},we={for:"passwordConfirm",class:"v-label"},ye=W({__name:"Account",setup(b){const{smallMobileActive:I}=q(),T=J(),{loginState:c}=oe(T),x=p("avatar"),g=p(),S=p(),u=p(!1),h=p(!1),w=p(!1),E=()=>{S.value&&(S.value.resetForm(),x.value="avatar",g.value=void 0)},R=async t=>{var i;const o=(i=t.target)==null?void 0:i.files;g.value=o==null?void 0:o[0],x.value=await H(t)},U=async t=>{var d,v;u.value=!0;let o;const i={...t};delete i.upload;const V=Object.entries(i).some(([,l])=>l!==void 0);if(g.value&&(o=new FormData,o.append("upload",g.value)),!V&&!o){u.value=!1;return}try{await T.updateUser(i,o,!0)}catch(l){console.error(((v=(d=l.response)==null?void 0:d.data)==null?void 0:v.message)??l.message??l)}u.value=!1};return(t,o)=>{const i=K,V=X("v-number-input");return M(),P(e(se),{ref_key:"form",ref:S,class:"flex flex-col w-full","validation-schema":e(G),onSubmit:o[3]||(o[3]=d=>U(d))},{default:r(()=>{var d,v,l;return[s("div",ae,[s("span",re,n(t.$t("views.settings.profile")),1),s("div",ne,[s("label",ie,[a(i,{src:e(x),size:"4rem",style:{"border-radius":"4rem",border:"1px solid var(--border)"}},null,8,["src"]),a(e(C),{id:"file-input",type:"file",name:"upload",accept:"image/png,image/jpeg,image/jpg",onChange:o[0]||(o[0]=m=>R(m))})])]),s("div",le,[s("div",me,[s("label",de,n(t.$t("components.form.label.username")),1),a(F,{variant:"outlined",density:"compact",type:"text",disabled:"","hide-details":"",value:(d=e(c).user)==null?void 0:d.username},null,8,["value"])]),pe,s("div",ce,[s("label",ue,n(t.$t("components.form.label.session_timer")),1),a(e(C),{name:"sessionTimer",value:(v=e(c).user)==null?void 0:v.sessionTimer},{default:r(({field:m,errorMessage:f,errors:_})=>{var y,A;return[a(V,$({"model-value":m.value,name:"sessionTimer",variant:"outlined",density:"compact"},m,{type:"number",step:600,error:_.length>0,"error-messages":f,disabled:(y=e(c).user)==null?void 0:y.rememberMe,"hide-details":(A=e(c).user)==null?void 0:A.rememberMe}),null,16,["model-value","error","error-messages","disabled","hide-details"])]}),_:1},8,["value"]),(l=e(c).user)!=null&&l.rememberMe?(M(),P(te,{key:0,class:"mt-3",theme:"dark",density:"compact",variant:"tonal",type:"warning",style:{"font-size":"0.7rem",color:"var(--color-disabled)"}},{default:r(()=>[k(n(t.$t("components.form.hint.remember_me_is_enabled")),1)]),_:1})):Y("",!0)])])]),ve,s("div",null,[s("span",fe,n(t.$t("views.settings.password")),1),s("div",_e,[s("div",be,[s("label",ge,n(t.$t("components.form.label.new_password")),1),a(e(C),{name:"password"},{default:r(({field:m,errorMessage:f,errors:_})=>[a(F,$({name:"password",variant:"outlined",density:"compact"},m,{type:e(h)?"text":"password",error:_.length>0,"error-messages":f,"append-inner-icon":e(h)?e(B):e(O),"onClick:appendInner":o[1]||(o[1]=y=>h.value=!e(h))}),null,16,["type","error","error-messages","append-inner-icon"])]),_:1})]),s("div",he,[s("label",we,n(t.$t("components.form.label.new_password_confirm")),1),a(e(C),{name:"passwordConfirm"},{default:r(({field:m,errorMessage:f,errors:_})=>[a(F,$({name:"passwordConfirm",variant:"outlined",density:"compact"},m,{type:e(w)?"text":"password",error:_.length>0,"error-messages":f,"append-inner-icon":e(w)?e(B):e(O),"onClick:appendInner":o[2]||(o[2]=y=>w.value=!e(w))}),null,16,["type","error","error-messages","append-inner-icon"])]),_:1})])])]),s("div",{class:z(["flex flex-row my-5",{"mr-3":e(I)}])},[a(N,{class:"ml-auto mr-2 text-color bg-color-lighten",elevation:"0",tonal:"",style:{border:"1px solid rgba(var(--border-rgb), 0.75)"},loading:e(u),onClick:Z(E,["prevent"])},{loader:r(()=>[a(j,{class:"text-color",size:"14",width:"2",indeterminate:""})]),default:r(()=>[k(n(t.$t("components.form.button.cancel")),1)]),_:1},8,["loading"]),a(N,{class:z(["text-white bg-color-primary",{"mr-2":e(I)}]),loading:e(u),elevation:"0",tonal:"",style:{border:"1px solid var(--color-primary-darken-2)"},type:"submit"},{loader:r(()=>[a(j,{color:"#fff",size:"14",width:"2",indeterminate:""})]),default:r(()=>[k(n(t.$t("components.form.button.save")),1)]),_:1},8,["loading","class"])],2)]}),_:1},8,["validation-schema"])}}}),Ye=Q(ye,[["__scopeId","data-v-a7eb4a7f"]]);export{Ye as default};
@@ -1 +0,0 @@
1
- var me=Object.defineProperty;var de=(g,o,d)=>o in g?me(g,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):g[o]=d;var ae=(g,o,d)=>de(g,typeof o!="symbol"?o+"":o,d);import{F as B,t as pe,r as v,b as U,c as q,J as re,e as T,O as V,R as i,j as p,u as c,V as F,T as b,f as ie,l as ce,M as f,q as Q,m as M,w as le,aa as Y,U as j,X as K,n as ne}from"./@vue-C7-KaDG4.js";import{y as ve}from"./@mdi-C-QA1nE3.js";import{f as G,i as z,u as ge,O as _e,Q as fe,d as J,z as X,P as l,x as ue}from"./main-C4rYiRNz.js";import{s as be}from"./pinia-D8MtiGcH.js";import{l as H,b as I,W as Z,e as he,$ as ee,a0 as ke,a1 as te}from"./vuetify-_-Oqac3B.js";import{i as se}from"./vue3-toastify-Ul-rf53I.js";import{P as ye}from"./plugins-Bf03y242.js";import{i as oe}from"./rxjs-B53o3e_J.js";import{u as we,a as Le,b as xe}from"./@tanstack-BqH4GyO-.js";import{S as Ne}from"./system-BONnDA4y.js";import"./vue-inline-svg-2DDwYW6V.js";import"./vue-i18n-1AU8MPys.js";import"./@intlify-Ck2ZoCVz.js";import"./axios--Jv2L996.js";import"./@camera.ui-2NVnv26v.js";import"./vue-router-DfeQ8s4I.js";import"./@vueuse-C3WMTDqL.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./vee-validate-D3FqbChK.js";import"./@vee-validate-DCBdnGo-.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./v-calendar-uh0aTGqP.js";import"./@popperjs-BQBsAJpH.js";import"./tslib-9k7AwCpt.js";var R=(g=>(g.READY="ready",g.RESTARTING="restarting",g.STARTING="starting",g.STARTED="started",g.STOPPED="stopped",g.ERROR="error",g.UNKNOWN="unknown",g))(R||{});const Se={class:"flex items-center first-item"},Pe={key:1},Re={class:"text-center pt-2"},$e=B({__name:"VUserTable",props:{loading:{type:Boolean,default:!1}},setup(g){const{smallMobileActive:o}=G(),d=g,{t:w}=z.global,x=new fe,k=ge(),{loginState:u}=be(k),{loading:N}=pe(d),_=v({pageSize:5,page:1}),y=U([{title:w("components.user_table.title_username"),align:"start",key:"username",value:"decoded.username",sortable:!0},{title:w("components.user_table.title_role"),align:"start",key:"role",value:"decoded.role",sortable:!0},{title:w("components.user_table.title_address"),align:"start",key:"address",value:"clientData.address",sortable:!0},{title:w("components.user_table.title_device"),align:"start",key:"device",value:"clientData.device",sortable:!0},{title:"",align:"end",key:"delete",value:"delete",width:"120px",sortable:!1}]),h=q(()=>W.value||A.value||N.value),L=q(()=>{var r;const S=Math.ceil((((r=P.value)==null?void 0:r.pagination.totalItems)||0)/_.value.pageSize);return S===1&&(_.value.page=1),S}),$=q(()=>{var S;return(S=P.value)==null?void 0:S.result.map(r=>({encoded:r.token,decoded:_e(r.token.access_token),clientData:r.clientData}))}),{data:P,isLoading:A,isPlaceholderData:O}=x.listQuery(_,!0),{mutate:E,isPending:W}=x.logoutTokenQuery(),D=()=>{_.value.page=Math.max(_.value.page-1,1)},C=()=>{O.value||(_.value.page=_.value.page+1)};return(S,r)=>{const e=re("router-link");return T(),V(te,{"items-per-page":c(_).pageSize,headers:c(y),items:c($),class:"elevation-0","item-value":"username","hide-default-footer":"","mobile-breakpoint":"sm"},{"item.username":i(({item:t})=>[p("div",Se,[t.encoded.access_token===c(u).access_token?(T(),V(e,{key:0,to:"/settings/account"},{default:i(()=>[F(b(t.decoded.username),1)]),_:2},1024)):(T(),ie("div",Pe,b(t.decoded.username),1)),t.encoded.access_token===c(u).access_token?(T(),V(H,{key:2,color:"#df2a4c",class:"ml-2",inline:"",content:S.$t("components.user_table.you")},null,8,["content"])):ce("",!0)])]),"item.delete":i(({item:t})=>[f(ee,{color:"red",density:"compact",divided:"",class:"table-button"},{default:i(()=>[f(I,{loading:c(h),block:c(o),onClick:Q(s=>c(E)({id:t.encoded._id,access_token:t.encoded.access_token}),["prevent"])},{default:i(()=>[F(b(S.$t("components.form.button.logout")),1)]),_:2},1032,["loading","block","onClick"]),f(Z,{text:S.$t("components.form.button.logout_all"),location:"top"},{activator:i(({props:s})=>[f(I,M(s,{icon:"",onClick:Q(a=>c(E)({id:t.encoded._id}),["prevent"])}),{default:i(()=>[f(he,{size:"20"},{default:i(()=>[F(b(c(ve)),1)]),_:1})]),_:2},1040,["onClick"])]),_:2},1032,["text"])]),_:2},1024)]),bottom:i(()=>[p("div",Re,[f(ke,{modelValue:c(_).page,"onUpdate:modelValue":r[0]||(r[0]=t=>c(_).page=t),length:c(L),onPrev:Q(D,["prevent"]),onNext:Q(C,["prevent"])},null,8,["modelValue","length"])])]),_:1},8,["items-per-page","headers","items"])}}}),Te=J($e,[["__scopeId","data-v-025598d2"]]),Ee={class:"flex items-center first-item"},We=B({__name:"VPluginTable",setup(g){const{t:o}=z.global,{smallMobileActive:d}=G(),w=X(),x=new ye,k=v(),u=v(),N=v(),_=v({page:1,pageSize:-1}),y=v(),h=v([]),L=v([]),$=U([{title:o("components.process_table.title_name"),align:"start",key:"name",value:"name",sortable:!0},{title:o("components.process_table.title_pid"),align:"start",key:"pid",value:"pid",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_cpu"),align:"start",key:"cpuLoad",value:"cpuLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_memory"),align:"start",key:"memLoad",value:"memLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:"",align:"end",key:"restart",value:"restart",width:"50px",sortable:!1}]),{data:P,isLoading:A,suspense:O}=x.getPluginsQuery(_),{mutateAsync:E}=x.restartPluginQuery(),W=q(()=>e=>L.value.includes(e));le(P,()=>{var e;(e=P.value)!=null&&e.result&&(h.value=P.value.result.filter(t=>!t.disabled).map(t=>{var s,a,n;return{name:t.pluginName,pid:((s=h.value.find(m=>m.name===t.pluginName))==null?void 0:s.pid)??-1,cpuLoad:((a=h.value.find(m=>m.name===t.pluginName))==null?void 0:a.cpuLoad)??-1,memLoad:((n=h.value.find(m=>m.name===t.pluginName))==null?void 0:n.memLoad)??-1}}),y.value=P.value.result.filter(t=>!t.disabled).map(t=>({name:t.pluginName,status:l.UNKNOWN})))},{deep:!0,immediate:!0});const D=e=>{var s,a;switch(((a=(s=y.value)==null?void 0:s.find(n=>n.name===e))==null?void 0:a.status)??l.UNKNOWN){case l.ERROR:return"#9d5752";case l.STARTING:return"orange";case l.READY:return"yellow";case l.STARTED:return"green";case l.STOPPED:return"red";case l.DISABLED:return"#2196f3";case l.UNKNOWN:return"gray";default:return"gray"}},C=e=>{var s,a;switch(((a=(s=y.value)==null?void 0:s.find(n=>n.name===e))==null?void 0:a.status)??l.UNKNOWN){case l.ERROR:return o("components.process_table.status_error");case l.STOPPED:return o("components.process_table.status_stopped");case l.READY:return o("components.process_table.status_ready");case l.STARTING:return o("components.process_table.status_starting");case l.STARTED:return o("components.process_table.status_started");default:return o("components.process_table.status_unknown")}},S=async e=>{var t,s,a,n;L.value.push(e);try{await E({pluginName:e})}catch(m){console.error(((s=(t=m.response)==null?void 0:t.data)==null?void 0:s.message)??m.message??m),se.error(((n=(a=m.response)==null?void 0:a.data)==null?void 0:n.message)??m.message??m)}finally{L.value=L.value.filter(m=>m!==e)}},r=()=>{var e;(e=k.value)==null||e.request("get-plugins-process-info").subscribe(t=>{h.value.forEach(s=>{const a=t.plugins.find(n=>n.name===s.name);a&&(s.pid=a.pid,s.cpuLoad=a.cpuLoad,s.memLoad=a.memLoad)})})};return Y(async()=>{if(k.value=w.getExistingNamespace("/metrics"),u.value=w.getExistingNamespace("/status"),!k.value)throw new Error("Not connected to metrics!");if(!u.value)throw new Error("Not connected to status!");await O(),await new Promise(e=>setTimeout(e,10)),u.value.socket.emit("get-plugin-process-status"),u.value.socket.on("plugin-process-status",e=>{var t;(t=y.value)==null||t.forEach(s=>{const a=e.find(n=>n.name===s.name);a&&(s.status=a.status)})}),N.value=oe(2e3).subscribe(()=>{var e;(e=k.value)!=null&&e.socket.connected&&r()}),r()}),j(()=>{var e;(e=N.value)==null||e.unsubscribe()}),(e,t)=>{const s=re("router-link");return T(),V(te,{"items-per-page":-1,headers:c($),items:c(h),class:"elevation-0","hide-default-footer":"",loading:c(A),"mobile-breakpoint":"sm"},{"item.name":i(({item:a})=>[p("div",Ee,[f(Z,{location:"top",text:C(a.name)},{activator:i(({props:n})=>[f(H,M(n,{color:D(a.name),dot:"",inline:""}),null,16,["color"])]),_:2},1032,["text"]),f(s,{to:`/plugins/${a.name}`,class:"ml-1"},{default:i(()=>[F(b(a.name),1)]),_:2},1032,["to"])])]),"item.cpuLoad":i(({item:a})=>[p("div",{style:K(`color: ${a.cpuLoad>=15?"red":"unset"}`)},b(a.cpuLoad)+" %",5)]),"item.memLoad":i(({item:a})=>[p("div",{style:K(`color: ${a.memLoad>=15?"red":"unset"}`)},b(a.memLoad)+" %",5)]),"item.restart":i(({item:a})=>[f(ee,{color:"red",density:"compact",divided:"",class:"table-button"},{default:i(()=>[f(I,{loading:c(W)(a.name),block:c(d),onClick:Q(n=>S(a.name),["prevent"])},{default:i(()=>[F(b(e.$t("components.form.button.restart")),1)]),_:2},1032,["loading","block","onClick"])]),_:2},1024)]),bottom:i(()=>[]),_:1},8,["headers","items","loading"])}}}),Ae=J(We,[["__scopeId","data-v-99190126"]]),Oe=async({parameter:g,signal:o})=>(await ue.get("/frameworkers",{params:g,signal:o})).data,De=async({frameWorkerName:g})=>(await ue.put(`/frameworkers/${g}/restart`)).data;class Ce{constructor(){ae(this,"_queryClient",we());ae(this,"queryActivator",v([{name:"getFrameWorkersQuery",enabled:!0}]))}get queryClient(){return this._queryClient}getFrameWorkersQuery(o){return Le({queryKey:["frameWorkerList",o],queryFn:({signal:d})=>Oe({parameter:c(o),signal:d}),placeholderData:d=>d,enabled:()=>this.queryActivator.value.some(d=>d.name==="getFrameWorkersQuery"&&d.enabled)})}restartFrameWorkerQuery(){return xe({mutationFn:De,onSuccess:async(o,d)=>{await this._queryClient.refetchQueries({queryKey:["frameWorkers",d.frameWorkerName]}),se.success(z.global.t("components.toast.frame_worker_restarted"))}})}toggleQueryActivator(o,d){const w=this.queryActivator.value.find(x=>x.name===o);w&&(w.enabled=d)}}const Qe={class:"flex items-center first-item"},Ve={class:"ml-1"},Fe=B({__name:"VFrameWorkerTable",setup(g){const{t:o}=z.global,d=X(),{smallMobileActive:w}=G(),x=new Ce,k=v(),u=v(),N=v(),_=v({page:1,pageSize:-1}),y=v(),h=v([]),L=v([]),$=U([{title:o("components.process_table.title_name"),align:"start",key:"name",value:"name",sortable:!0},{title:o("components.process_table.title_pid"),align:"start",key:"pid",value:"pid",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_cpu"),align:"start",key:"cpuLoad",value:"cpuLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_memory"),align:"start",key:"memLoad",value:"memLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:"",align:"end",key:"restart",value:"restart",width:"50px",sortable:!1}]),{data:P,isLoading:A,suspense:O}=x.getFrameWorkersQuery(_),{mutateAsync:E}=x.restartFrameWorkerQuery(),W=q(()=>e=>L.value.includes(e));le(P,()=>{var e;(e=P.value)!=null&&e.result&&(h.value=P.value.result.map(t=>{var s,a,n;return{name:t.name,pid:((s=h.value.find(m=>m.name===t.name))==null?void 0:s.pid)??-1,cpuLoad:((a=h.value.find(m=>m.name===t.name))==null?void 0:a.cpuLoad)??-1,memLoad:((n=h.value.find(m=>m.name===t.name))==null?void 0:n.memLoad)??-1}}),y.value=P.value.result.map(t=>({name:t.name,status:l.UNKNOWN})))},{deep:!0,immediate:!0});const D=e=>{var s,a;switch(((a=(s=y.value)==null?void 0:s.find(n=>n.name===e))==null?void 0:a.status)??l.UNKNOWN){case l.ERROR:return"#9d5752";case l.STARTING:return"orange";case l.READY:return"yellow";case l.STARTED:return"green";case l.STOPPED:return"red";case l.DISABLED:return"#2196f3";case l.UNKNOWN:return"gray";default:return"gray"}},C=e=>{var s,a;switch(((a=(s=y.value)==null?void 0:s.find(n=>n.name===e))==null?void 0:a.status)??l.UNKNOWN){case l.ERROR:return o("components.process_table.status_error");case l.STOPPED:return o("components.process_table.status_stopped");case l.READY:return o("components.process_table.status_ready");case l.STARTING:return o("components.process_table.status_starting");case l.STARTED:return o("components.process_table.status_started");default:return o("components.process_table.status_unknown")}},S=async e=>{var t,s,a,n;L.value.push(e);try{await E({frameWorkerName:e})}catch(m){console.error(((s=(t=m.response)==null?void 0:t.data)==null?void 0:s.message)??m.message??m),se.error(((n=(a=m.response)==null?void 0:a.data)==null?void 0:n.message)??m.message??m)}finally{L.value=L.value.filter(m=>m!==e)}},r=()=>{var e;(e=k.value)==null||e.request("get-frameworker-process-info").subscribe(t=>{h.value.forEach(s=>{const a=t.worker.find(n=>n.name===s.name);a&&(s.pid=a.pid,s.cpuLoad=a.cpuLoad,s.memLoad=a.memLoad)})})};return Y(async()=>{if(k.value=d.getExistingNamespace("/metrics"),u.value=d.getExistingNamespace("/status"),!k.value)throw new Error("Not connected to metrics!");if(!u.value)throw new Error("Not connected to status!");await O(),await new Promise(e=>setTimeout(e,10)),u.value.socket.emit("get-frameworker-process-status"),u.value.socket.on("frameworker-process-status",e=>{var t;(t=y.value)==null||t.forEach(s=>{const a=e.find(n=>n.name===s.name);a&&(s.status=a.status)})}),N.value=oe(2e3).subscribe(()=>{var e;(e=k.value)!=null&&e.socket.connected&&r()}),r()}),j(()=>{var e;(e=N.value)==null||e.unsubscribe()}),(e,t)=>(T(),V(te,{"items-per-page":-1,headers:c($),items:c(h),class:"elevation-0","hide-default-footer":"",loading:c(A),"mobile-breakpoint":"sm"},{"item.name":i(({item:s})=>[p("div",Qe,[f(Z,{location:"top",text:C(s.name)},{activator:i(({props:a})=>[f(H,M(a,{color:D(s.name),dot:"",inline:""}),null,16,["color"])]),_:2},1032,["text"]),p("div",Ve,b(s.name),1)])]),"item.cpuLoad":i(({item:s})=>[p("div",{style:K(`color: ${s.cpuLoad>=15?"red":"unset"}`)},b(s.cpuLoad)+" %",5)]),"item.memLoad":i(({item:s})=>[p("div",{style:K(`color: ${s.memLoad>=15?"red":"unset"}`)},b(s.memLoad)+" %",5)]),"item.restart":i(({item:s})=>[f(ee,{color:"red",density:"compact",divided:"",class:"table-button"},{default:i(()=>[f(I,{loading:c(W)(s.name),block:c(w),onClick:Q(a=>S(s.name),["prevent"])},{default:i(()=>[F(b(e.$t("components.form.button.restart")),1)]),_:2},1032,["loading","block","onClick"])]),_:2},1024)]),bottom:i(()=>[]),_:1},8,["headers","items","loading"]))}}),Ke=J(Fe,[["__scopeId","data-v-e5729ecc"]]),qe={class:"flex items-center first-item"},Ie={class:"ml-1"},Be=B({__name:"VProcessTable",setup(g){const{t:o}=z.global,{smallMobileActive:d}=G(),w=X(),x=new Ne,k=v(),u=v(),N=v(),_=v(R.UNKNOWN),y=v(R.UNKNOWN),h=v(R.UNKNOWN),L=v([{name:"server",pid:-1,cpuLoad:-1,memLoad:-1},{name:"go2rtc",pid:-1,cpuLoad:-1,memLoad:-1},{name:"nats",pid:-1,cpuLoad:-1,memLoad:-1}]),$=U([{title:o("components.process_table.title_name"),align:"start",key:"name",value:"name",sortable:!0},{title:o("components.process_table.title_pid"),align:"start",key:"pid",value:"pid",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_cpu"),align:"start",key:"cpuLoad",value:"cpuLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:o("components.process_table.title_memory"),align:"start",key:"memLoad",value:"memLoad",width:"150px","min-width":"150px","max-width":"150px",sortable:!0},{title:"",align:"end",key:"restart",value:"restart",width:"50px",sortable:!1}]),{mutateAsync:P,isPending:A}=x.restartGo2Rtc(),{mutateAsync:O,isPending:E}=x.restartSystem(),W=r=>{switch(r){case"server":return _.value;case"go2rtc":return y.value;case"nats":return h.value;default:return R.UNKNOWN}},D=r=>{switch(W(r)){case R.ERROR:return"#9d5752";case R.STARTING:return"orange";case R.READY:return"yellow";case R.STARTED:return"green";case R.STOPPED:return"red";case R.UNKNOWN:return"gray";default:return"gray"}},C=async r=>{var e,t,s,a;try{r==="server"?await O():await P()}catch(n){console.error(((t=(e=n.response)==null?void 0:e.data)==null?void 0:t.message)??n.message??n),se.error(((a=(s=n.response)==null?void 0:s.data)==null?void 0:a.message)??n.message??n)}},S=()=>{var r;(r=k.value)==null||r.request("get-process-info").subscribe(e=>{const t=L.value.find(n=>n.name==="server"),s=L.value.find(n=>n.name==="go2rtc"),a=L.value.find(n=>n.name==="nats");t&&(t.pid=e.server.pid,t.cpuLoad=e.server.cpuLoad,t.memLoad=e.server.memLoad),s&&(s.pid=e.go2rtc.pid,s.cpuLoad=e.go2rtc.cpuLoad,s.memLoad=e.go2rtc.memLoad),a&&(a.pid=e.nats.pid,a.cpuLoad=e.nats.cpuLoad,a.memLoad=e.nats.memLoad)})};return Y(async()=>{if(k.value=w.getExistingNamespace("/metrics"),u.value=w.getExistingNamespace("/status"),!k.value)throw new Error("Not connected to metrics!");if(!u.value)throw new Error("Not connected to status!");await new Promise(r=>setTimeout(r,10)),u.value.socket.emit("get-process-status"),u.value.socket.on("process-status",r=>{const e=r.find(a=>a.name==="server"),t=r.find(a=>a.name==="go2rtc"),s=r.find(a=>a.name==="nats");e&&(_.value=e.status),t&&(y.value=t.status),s&&(h.value=s.status)}),N.value=oe(2e3).subscribe(()=>{var r;(r=k.value)!=null&&r.socket.connected&&S()}),S()}),j(()=>{var r;(r=N.value)==null||r.unsubscribe()}),(r,e)=>(T(),V(te,{"items-per-page":-1,headers:c($),items:c(L),class:"elevation-0","hide-default-footer":"","mobile-breakpoint":"sm"},{"item.name":i(({item:t})=>[p("div",qe,[f(Z,{location:"top",text:r.$t(`components.process_table.status_${W(t.name)}`)},{activator:i(({props:s})=>[f(H,M(s,{color:D(t.name),dot:"",inline:""}),null,16,["color"])]),_:2},1032,["text"]),p("div",Ie,b(t.name),1)])]),"item.cpuLoad":i(({item:t})=>[p("div",{style:K(`color: ${t.cpuLoad>=15?"red":"unset"}`)},b(t.cpuLoad)+" %",5)]),"item.memLoad":i(({item:t})=>[p("div",{style:K(`color: ${t.memLoad>=15?"red":"unset"}`)},b(t.memLoad)+" %",5)]),"item.restart":i(({item:t})=>[t.name!=="nats"?(T(),V(ee,{key:0,color:"red",density:"compact",divided:"",class:"table-button"},{default:i(()=>[f(I,{loading:t.name==="server"?c(E):c(A),block:c(d),onClick:Q(s=>C(t.name),["prevent"])},{default:i(()=>[F(b(r.$t("components.form.button.restart")),1)]),_:2},1032,["loading","block","onClick"])]),_:2},1024)):ce("",!0)]),bottom:i(()=>[]),_:1},8,["headers","items"]))}}),Ge=J(Be,[["__scopeId","data-v-f4aaa556"]]),ze={class:"h-full w-full inline-size mb-safe"},Ue={class:"page-title"},Me={class:"subview-title text-color"},Ye={class:"inner-component p-4"},je={class:"mt-10"},Je={class:"subview-title text-color"},Xe={class:"inner-component p-4"},He={class:"mt-10"},Ze={class:"subview-title text-color"},et={class:"inner-component p-4"},tt={class:"mt-10"},st={class:"subview-title text-color"},at={class:"inner-component p-4"},Ct=B({__name:"Adminpanel",setup(g){const o=X(),{smallMobileActive:d}=G(),w=v(),x=v(),k=v(!1);return Y(()=>{w.value=o.connectToNamespace("/metrics"),x.value=o.connectToNamespace("/status")}),j(()=>{var u,N,_,y;(N=(u=w.value)==null?void 0:u.end)==null||N.call(u),(y=(_=x.value)==null?void 0:_.end)==null||y.call(_)}),(u,N)=>{const _=Ge,y=Ke,h=Ae,L=Te;return T(),ie("main",{class:ne({"px-0":c(d)})},[p("div",ze,[p("div",{class:ne(["mb-3 flex w-full items-center",{"px-2":c(d)}]),style:{height:"30px"}},[p("h1",Ue,b(u.$t(`views.${String(u.$route.name).toLowerCase()}.title`)),1)],2),p("div",null,[p("span",Me,b(u.$t("views.adminpanel.system")),1),p("div",Ye,[f(_,{onAction:N[0]||(N[0]=$=>k.value=$)})])]),p("div",je,[p("span",Je,b(u.$t("views.adminpanel.frameworker")),1),p("div",Xe,[f(y)])]),p("div",He,[p("span",Ze,b(u.$t("views.adminpanel.plugins")),1),p("div",et,[f(h)])]),p("div",tt,[p("span",st,b(u.$t("views.adminpanel.currently_loggedin_users")),1),p("div",at,[f(L,{loading:c(k)},null,8,["loading"])])])])],2)}}});export{Ct as default};
@@ -1 +0,0 @@
1
- import{b as _,a as f}from"./main-C4rYiRNz.js";import{s as p}from"./pinia-D8MtiGcH.js";import{z as u,d as h}from"./vuetify-_-Oqac3B.js";import{F as b,e as V,f as g,j as e,T as a,M as r,u as t,i as d}from"./@vue-C7-KaDG4.js";import"./vue-inline-svg-2DDwYW6V.js";import"./vue3-toastify-Ul-rf53I.js";import"./vue-i18n-1AU8MPys.js";import"./@intlify-Ck2ZoCVz.js";import"./axios--Jv2L996.js";import"./@tanstack-BqH4GyO-.js";import"./@camera.ui-2NVnv26v.js";import"./vue-router-DfeQ8s4I.js";import"./@vueuse-C3WMTDqL.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./@mdi-C-QA1nE3.js";import"./vee-validate-D3FqbChK.js";import"./@vee-validate-DCBdnGo-.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-B53o3e_J.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-uh0aTGqP.js";import"./@popperjs-BQBsAJpH.js";const y={class:"subview-title text-color"},$={class:"inner-component p-4"},k={class:"relative"},w={for:"theme",class:"v-label"},S=e("div",{class:"py-2"},null,-1),B={class:"ml-auto flex"},T=e("div",{class:"my-8"},null,-1),U={class:"subview-title text-color"},x={class:"inner-component p-4"},C={class:"relative"},M={for:"language",class:"v-label"},me=b({__name:"Appearance",setup(N){const{locale:n,languages:c}=p(_()),{colors:v,theme:m,autoMode:i}=p(f());return(l,o)=>(V(),g("div",null,[e("div",null,[e("span",y,a(l.$t("views.settings.theme")),1),e("div",$,[e("div",k,[e("label",w,a(l.$t("components.form.label.theme")),1),r(u,{modelValue:t(m),"onUpdate:modelValue":o[0]||(o[0]=s=>d(m)?m.value=s:null),variant:"outlined",density:"compact",name:"theme","hide-details":"",items:t(v),disabled:t(i)},null,8,["modelValue","items","disabled"])]),S,e("div",null,[e("div",B,[r(h,{modelValue:t(i),"onUpdate:modelValue":o[1]||(o[1]=s=>d(i)?i.value=s:null),color:"#df2a4c",type:"checkbox",label:l.$t("components.form.label.system_preference"),"hide-details":""},null,8,["modelValue","label"])])])])]),T,e("div",null,[e("span",U,a(l.$t("views.settings.locale")),1),e("div",x,[e("div",C,[e("label",M,a(l.$t("components.form.label.language")),1),r(u,{modelValue:t(n),"onUpdate:modelValue":o[2]||(o[2]=s=>d(n)?n.value=s:null),variant:"outlined",density:"compact",name:"language","hide-details":"",items:t(c)},null,8,["modelValue","items"])])])])]))}});export{me as default};
@@ -1 +0,0 @@
1
- import{x as j,y as T,w as R}from"./main-C4rYiRNz.js";import{F as L,t as U,r as f,e as v,f as I,j as a,M as g,R as b,T as i,u as p,l as C,O as D,q as y,V as B,ae as J,i as E}from"./@vue-C7-KaDG4.js";import{i as F}from"./vue3-toastify-Ul-rf53I.js";import{r as M}from"./system-BONnDA4y.js";import{ay as q,Y as A}from"./@mdi-C-QA1nE3.js";import{e as O,a2 as Y,b as z,n as G}from"./vuetify-_-Oqac3B.js";import{u as H}from"./vue-i18n-1AU8MPys.js";import"./vue-inline-svg-2DDwYW6V.js";import"./axios--Jv2L996.js";import"./@tanstack-BqH4GyO-.js";import"./@camera.ui-2NVnv26v.js";import"./pinia-D8MtiGcH.js";import"./vue-router-DfeQ8s4I.js";import"./@vueuse-C3WMTDqL.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./vee-validate-D3FqbChK.js";import"./@vee-validate-DCBdnGo-.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-B53o3e_J.js";import"./tslib-9k7AwCpt.js";import"./v-calendar-uh0aTGqP.js";import"./@popperjs-BQBsAJpH.js";import"./@intlify-Ck2ZoCVz.js";const K=async h=>(await j.post("/backup/download",{localStorage:h},{responseType:"arraybuffer"})).data,P=async h=>(await j.post("/backup/restore",h)).data,Q={class:"w-full"},W={class:"flex flex-col justify-center items-center mb-5"},X={for:"restoreInput",class:"cursor-pointer text-center"},Z=["accept"],ee={key:0,class:"text-red"},te={class:"mx-2"},oe={class:"text-disabled"},se=L({__name:"VUploadFiles",props:{multiple:{type:Boolean,default:!1},accept:{},icon:{default:q}},emits:["files-uploaded"],setup(h,{expose:S,emit:V}){const u=V,x=h,{accept:k,multiple:w}=U(x),$=f(!1),_=f(!1),r=f([]),e=f(null),n=l=>{const t=r.value.findIndex(s=>s.name===l);t>-1&&(r.value.splice(t,1),o())},d=l=>{if($.value=!1,_.value=!1,r.value=[],console.log(l),l.dataTransfer)if(!w.value&&l.dataTransfer.files.length>1)_.value=!0;else{for(const[,t]of Object.entries(l.dataTransfer.files))r.value.push(t);u("files-uploaded",r.value)}},m=l=>{var s;_.value=!1,r.value=[];const t=l.target;if(t&&t.files)if(!w.value&&((s=t.files)==null?void 0:s.length)>1)_.value=!0;else{for(const[,N]of Object.entries(t.files))r.value.push(N);u("files-uploaded",r.value)}},o=()=>{e.value&&(e.value.value="")};return S({reset:()=>{r.value=[],o()}}),(l,t)=>(v(),I("div",{class:"file-upload-box p-4",onDrop:t[0]||(t[0]=y(s=>d(s),["prevent"])),onDragover:t[1]||(t[1]=y(s=>$.value=!0,["prevent"])),onDragenter:t[2]||(t[2]=y(s=>$.value=!0,["prevent"])),onDragleave:t[3]||(t[3]=y(s=>$.value=!1,["prevent"]))},[a("div",Q,[a("div",W,[g(O,{class:"mt-5",size:"60"},{default:b(()=>[B(i(l.icon),1)]),_:1}),a("label",X,i(l.$t("components.upload_files.drop_or_select_file")),1),a("input",{id:"restoreInput",ref_key:"fileInput",ref:e,type:"file",class:"d-none",accept:p(k),onChange:m},null,40,Z),p(_)?(v(),I("p",ee,i(l.$t("components.upload_files.only_one_file_allowed")),1)):C("",!0)]),p(r).length>0?(v(),D(Y,{key:0,items:p(r),"max-height":"150","item-height":"50"},{default:b(({item:s})=>[(v(),I("div",{key:s.name,class:"w-full flex flex-row items-center justify-start p-2"},[g(z,{size:"28",variant:"text",color:"red",rounded:"",onClick:y(N=>n(s.name),["stop"])},{default:b(()=>[g(O,{size:"20"},{default:b(()=>[B(i(p(A)),1)]),_:1})]),_:2},1032,["onClick"]),a("b",te,i(s.name),1),a("span",oe,"("+i(s.size)+" bytes)",1)])),p(r).length>1?(v(),D(G,{key:0})):C("",!0)]),_:1},8,["items"])):C("",!0)])],32))}}),ae={key:0,class:"flex w-full h-full justify-center items-center fixed top-0 left-0",style:{"z-index":"9000"}},ne={class:"subview-title text-color"},le={class:"inner-component p-4"},re={class:"text-sm"},ie=a("br",null,null,-1),ce=a("div",{class:"my-8"},null,-1),pe={class:"subview-title text-color"},ue={class:"inner-component p-4"},de={class:"text-sm"},qe=L({__name:"Backup",setup(h){const{t:S}=H(),V=f(null),u=f(!1),x=f(!1),k=f(!1),w=f([]),$=async()=>{var e,n,d,m;u.value=!0;try{const o={};if(localStorage.getItem("ui")){const s=localStorage.getItem("ui");o.ui=JSON.parse(s)}if(localStorage.getItem("locale")){const s=localStorage.getItem("locale");o.locale=s}if(localStorage.getItem("theme")){const s=localStorage.getItem("theme");o.theme=JSON.parse(s)}const c=await K(o),l=window.URL.createObjectURL(new Blob([c])),t=document.createElement("a");t.href=l,t.setAttribute("download","cameraui-backup.tar.gz"),document.body.appendChild(t),t.click(),t.remove()}catch(o){console.error(((n=(e=o.response)==null?void 0:e.data)==null?void 0:n.message)??o.message??o),F.error(((m=(d=o.response)==null?void 0:d.data)==null?void 0:m.message)??o.message??o)}u.value=!1},_=async()=>{var e,n,d,m,o;u.value=!0;try{const c=new FormData;c.append("upload",w.value[0]);const l=await P(c);r(l),(e=V.value)==null||e.reset(),F.success(S("components.toast.backup_restored")),x.value=!0,M()}catch(c){console.error(((d=(n=c.response)==null?void 0:n.data)==null?void 0:d.message)??c.message??c),F.error(((o=(m=c.response)==null?void 0:m.data)==null?void 0:o.message)??c.message??c),u.value=!1,x.value=!1}},r=e=>{e.theme&&localStorage.setItem("theme",JSON.stringify(e.theme)),e.locale&&localStorage.setItem("locale",e.locale),e.ui&&localStorage.setItem("ui",JSON.stringify(e.ui))};return(e,n)=>{const d=T,m=R;return v(),I("div",null,[(v(),D(J,{to:".app"},[p(x)?(v(),I("div",ae,[g(d,{reload:""})])):C("",!0)])),a("div",null,[a("span",ne,i(e.$t("views.settings.create_backup")),1),a("div",le,[a("span",re,i(e.$t("views.settings.create_backup_info")),1),ie,g(z,{loading:p(u),class:"mt-3",color:"#df2a4c",onClick:y($,["prevent"])},{default:b(()=>[B(i(e.$t("components.form.button.download")),1)]),_:1},8,["loading"])])]),ce,a("div",null,[a("span",pe,i(e.$t("views.settings.restore_backup")),1),a("div",ue,[a("span",de,i(e.$t("views.settings.restore_backup_info")),1),g(se,{ref_key:"input",ref:V,class:"mt-5",accept:"application/gzip, .tar, .tar.gz",onFilesUploaded:n[0]||(n[0]=o=>w.value=o)},null,512),g(z,{loading:p(u),disabled:!p(w).length,class:"mt-5",color:"#df2a4c",onClick:n[1]||(n[1]=y(o=>k.value=!0,["prevent"]))},{default:b(()=>[B(i(e.$t("components.form.button.upload")),1)]),_:1},8,["loading","disabled"])])]),g(m,{modelValue:p(k),"onUpdate:modelValue":n[2]||(n[2]=o=>E(k)?k.value=o:null),title:e.$t("components.dialog.title.confirm"),"confirm-text":"components.form.button.restore_and_restart",loading:p(u),onConfirm:n[3]||(n[3]=o=>_())},{content:b(()=>[a("span",null,i(e.$t("components.dialog.message.confirm_restore")),1)]),_:1},8,["modelValue","title","loading"])])}}});export{qe as default};
@@ -1 +0,0 @@
1
- import{F as me,t as he,r as i,c as S,w as U,z as $e,aa as Be,y as Ne,a0 as Tt,e as n,f as x,M as w,R as k,g as ae,v as ce,u as t,X as L,j as g,O as R,T as q,l as Z,N as De,Q as Ce,ah as Ht,ai as kt,ao as $t,i as fe,J as Et,n as We,V as ge,b as Dt,q as Ct,ap as Ft}from"./@vue-C7-KaDG4.js";import{E as zt,F as je,G as Vt,C as Ge,H as Ot,I as Mt,J as It}from"./@mdi-C-QA1nE3.js";import{a as Ue,f as qe,j as Rt,k as ue,l as Lt,m as Gt,n as At,o as Bt,p as Nt,q as Wt,d as ye,i as jt}from"./main-C4rYiRNz.js";import{s as Qe}from"./pinia-D8MtiGcH.js";import{m as Ut,n as qt,p as Xe,q as Qt,s as Xt,d as Je,t as Ae,v as Jt,l as Zt}from"./@vueuse-C3WMTDqL.js";import{b as te,B as Ee,C as Yt,V as Fe,D as Kt,E as ea,R as ta,e as re,F as aa}from"./vuetify-_-Oqac3B.js";import{C as Ze,_ as Ye}from"./VPlayer-YdRn97Bs.js";import{u as Ke}from"./vue-router-DfeQ8s4I.js";import{D as la}from"./v-calendar-uh0aTGqP.js";import"./vue-inline-svg-2DDwYW6V.js";import"./vue3-toastify-Ul-rf53I.js";import"./vue-i18n-1AU8MPys.js";import"./@intlify-Ck2ZoCVz.js";import"./axios--Jv2L996.js";import"./@tanstack-BqH4GyO-.js";import"./@camera.ui-2NVnv26v.js";import"./vee-validate-D3FqbChK.js";import"./@vee-validate-DCBdnGo-.js";import"./zod-BaF2dDCd.js";import"./uuid-DvF23Exx.js";import"./socket.io-client-Bq_SHkin.js";import"./engine.io-client-DBBxzneW.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./rxjs-B53o3e_J.js";import"./tslib-9k7AwCpt.js";import"./nprogress-DSyAi0LF.js";import"./@xterm-B4Ga69iL.js";import"./@popperjs-BQBsAJpH.js";import"./qrcode-CGiDONbL.js";import"./encode-utf8-Cn5aGd7v.js";import"./dijkstrajs-D_NXgYpA.js";import"./plugins-Bf03y242.js";import"./draggabilly-Arakw9Dk.js";import"./get-size-D1dS-IaP.js";import"./unidragger-BYtqgAQ0.js";import"./ev-emitter-CXYwG0eJ.js";var r=(e=>(e[e.HEIGHT=8]="HEIGHT",e[e.WIDTH=85]="WIDTH",e.COLOR="#000000",e[e.OFFSET=50]="OFFSET",e[e.TIME_OFFSET=15]="TIME_OFFSET",e[e.TIME_START_POSITION=15]="TIME_START_POSITION",e[e.MAX_SCROLL_PX=720]="MAX_SCROLL_PX",e))(r||{}),et=(e=>(e.type="seconds",e[e.bigTickInterval=5]="bigTickInterval",e[e.labelInterval=15]="labelInterval",e[e.duration=15e3]="duration",e[e.timeMsFactor=15e3]="timeMsFactor",e[e.timeMsPerTick=1e3]="timeMsPerTick",e[e.timeMsPerPx=125]="timeMsPerPx",e[e.pxPerSecond=8]="pxPerSecond",e))(et||{}),tt=(e=>(e.type="two-minutes",e[e.bigTickInterval=4]="bigTickInterval",e[e.labelInterval=8]="labelInterval",e[e.duration=12e4]="duration",e[e.timeMsFactor=12e4]="timeMsFactor",e[e.timeMsPerTick=15e3]="timeMsPerTick",e[e.timeMsPerPx=1875]="timeMsPerPx",e[e.pxPerSecond=.5333333333333333]="pxPerSecond",e))(tt||{}),at=(e=>(e.type="fifteen-minutes",e[e.bigTickInterval=5]="bigTickInterval",e[e.labelInterval=15]="labelInterval",e[e.duration=9e5]="duration",e[e.timeMsFactor=9e5]="timeMsFactor",e[e.timeMsPerTick=6e4]="timeMsPerTick",e[e.timeMsPerPx=7500]="timeMsPerPx",e[e.pxPerSecond=.13333333333333333]="pxPerSecond",e))(at||{}),lt=(e=>(e.type="thirty-minutes",e[e.bigTickInterval=3]="bigTickInterval",e[e.labelInterval=9]="labelInterval",e[e.duration=18e5]="duration",e[e.timeMsFactor=18e5]="timeMsFactor",e[e.timeMsPerTick=2e5]="timeMsPerTick",e[e.timeMsPerPx=25e3]="timeMsPerPx",e[e.pxPerSecond=.04]="pxPerSecond",e))(lt||{}),ot=(e=>(e.type="hours",e[e.bigTickInterval=3]="bigTickInterval",e[e.labelInterval=18]="labelInterval",e[e.duration=36e5]="duration",e[e.timeMsFactor=36e5]="timeMsFactor",e[e.timeMsPerTick=2e5]="timeMsPerTick",e[e.timeMsPerPx=25e3]="timeMsPerPx",e[e.pxPerSecond=.04]="pxPerSecond",e))(ot||{});const st=e=>(Ht("data-v-e8bb6d1c"),e=e(),kt(),e),oa={class:"absolute z-10 top-0 left-0 right-0 w-full"},sa={key:1},ia={key:0,class:"timeline-gradient-bg-top"},na=st(()=>g("div",{class:"timeline-gradient-bg-dark-top"},null,-1)),ra=st(()=>g("div",{class:"timeline-gradient-bg-white-top"},null,-1)),ua=[na,ra],ca=["data-tick-index"],ma=["data-tick-index"],da={key:0,class:"tick-label"},va={key:2},pa=me({__name:"VLiveTimeline",props:{zoomModel:{default:1},dateModel:{default:()=>new Date},modifier:{default:0},segment:{default:"0"}},emits:["is-loading","is-scrolling"],setup(e,{emit:N}){const W=e,M=N,{theme:P}=Qe(Ue()),{dateModel:z,modifier:$,zoomModel:f}=he(W),E=i(0),D=i(0),T=i(new Date),p=i(0),u=i(),s=i(!1),C=i(!1),F=i([]),O=i(!1),v=i(0),Y=i(0),le=i(new Date),K=i(0),A=i(0),oe=i("#5b5b5b"),V=i({timestamp:Date.now(),live:!0}),h=i(null),ee=i(null),H=i([]),c=i(0),{tabletActive:se,mobileActive:xe}=qe(),_e=Ut(h),be=qt({touch:!1,target:ee}),{isOutside:ie}=Xe(ee),{pressed:_}=Qt({touch:!1,target:ee}),B=Xt(h),ze=Je();Ae("ArrowDown",a=>{ie.value||(a.preventDefault(),ke(),h.value&&h.value.scrollTop++)}),Ae("ArrowUp",a=>{ie.value||(a.preventDefault(),ke(),h.value&&h.value.scrollTop--)});let we,Pe,Ve;const Oe=S(()=>B.y.value>0?"#0173ff":"#df2a4c"),it=S(()=>{let a=`transition: all .2s ease-out; background-color: ${Oe.value};`;return s.value?a+="width: 20px; left: 9px; border-radius: 30px":m.value.type==="seconds"?a+="width: 60px; left: 9px;":B.y.value===0?a+="width: 40px; left: 9px;":a+="width: 55px; left: 9px;",a}),nt=S(()=>`transition: all .5s ease-out; position: absolute; top: ${ne.value.px}px; background-color: ${Oe.value};`),ne=S(()=>{var d;const a=T.value.getTime(),l=r.TIME_OFFSET*r.HEIGHT-1;let o=((d=u.value)==null?void 0:d.timestamp)||a;return B.y.value===0&&(o=a),u.value&&(u.value.timestamp=o),{px:l,timestamp:o}}),rt=S(()=>m.value.type==="seconds"),Se=S(()=>r.HEIGHT*m.value.labelInterval),Me=S(()=>m.value.pxPerSecond*E.value+A.value),ut=S(()=>m.value.pxPerSecond*E.value-v.value*r.HEIGHT-3+A.value),ct=S(()=>`transition: all .5s ease-out; mask-image: url('data:image/svg+xml,${Ie.value}'); -webkit-mask-image: url('data:image/svg+xml,${Ie.value}'); mask-size: ${r.WIDTH}px ${Se.value}px; -webkit-mask-size: ${r.WIDTH}px ${Se.value}px; width: ${r.WIDTH}px; height: ${c.value}px; mask-position: 0px ${p.value+Me.value}px; -webkit-mask-position: 0px ${p.value+Me.value}px`),Ie=S(()=>{let a=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r.WIDTH} ${Se.value}" vector-effect="non-scaling-stroke" stroke-width="${1/(window.devicePixelRatio||1)}px" shape-rendering="crispEdges">`;if(!s.value)for(let l=0;l<m.value.labelInterval;l++){const o=l%m.value.labelInterval==0,d=0,b=o?4:l%m.value.bigTickInterval===0?2:1,y=l*r.HEIGHT+r.HEIGHT/2;a+=`<line x1="${d}" y1="${y}" x2="${2*b}" y2="${y}" stroke="${oe.value}" stroke-opacity="100%"/>`}return a+="</svg>",encodeURIComponent(a)}),mt=S(()=>`transition: top .5s ease-out; height: ${r.HEIGHT}px;`),dt=S(()=>{var b;const a=(b=h.value)==null?void 0:b.getBoundingClientRect(),l=ze.width.value,o=($==null?void 0:$.value)||0,d=l-l+(o-o);return a?ze.height.value-a.top+d:null}),m=S(()=>gt(f.value)),vt=S(()=>`height: 100%; cursor: ${s.value?"default":_.value?"grabbing":"grab"}`);U(s,a=>{_e.value=a,M("is-loading",a)}),U(z,a=>{if(a){if(a.getTime()===ne.value.timestamp)return;a==null||a.setSeconds(0,0),Te(a)}}),U(be.y,(a,l)=>{if(_.value&&a!==l&&h.value){let o=Math.abs(a-l);a<l&&(o=o*-1),h.value.scrollTop=h.value.scrollTop-=o}}),U(B.isScrolling,a=>{M("is-scrolling",a),!a&&O.value&&(O.value=!1)}),U(B.y,(a,l)=>{var b,y;if(ke(),a===0&&de(-F.value.length),a!==l)if(a===0)V.value={timestamp:ne.value.timestamp,live:!0};else{const Q=(a-l)*m.value.timeMsPerPx,G=O.value?V.value.timestamp:V.value.timestamp-Q;V.value={timestamp:G,live:!1}}const d=(((b=h.value)==null?void 0:b.scrollHeight)||0)-(((y=h.value)==null?void 0:y.clientHeight)||0)-r.OFFSET*r.HEIGHT;a>=d&&de(r.OFFSET)}),U(f,async()=>{await He(),B.y.value>0&&Te(V.value.timestamp,"auto",!0)});const Re=a=>{var o;const l=(dt.value||((o=h.value)==null?void 0:o.clientHeight)||0)+r.OFFSET*r.HEIGHT;a!==void 0?c.value+a*r.HEIGHT>=l&&(c.value+=a*r.HEIGHT):c.value=l},de=(a,l,o)=>{var Q;if(a===0)return;const d=Math.abs(a);let b=H.value.length-d,y=a<0;if(l){y||(y=!0,a=-a);for(let G=0;G<d;G++){const I=H.value[0],ve=I.index,j=I.timestamp,X=ve-1,J={index:X,format:m.value.type,timestamp:j+m.value.timeMsPerTick,label:X%m.value.labelInterval==0};H.value.unshift(J)}}if(Re(a),y)b!==0&&d===1?H.value.pop():H.value.splice(b,d),F.value=[];else{const G=(((Q=h.value)==null?void 0:Q.clientHeight)||0)+r.OFFSET*r.HEIGHT,I=Math.ceil(G/r.HEIGHT),ve=H.value.length>=I?0:I-H.value.length+1;for(let j=0;j<d;j++){const X=H.value[H.value.length-1],pe=X.index+1,Le={index:pe,format:m.value.type,timestamp:X.timestamp-m.value.timeMsPerTick,label:pe%m.value.labelInterval==0};j>=ve&&F.value.push(Le),H.value.push(Le)}}},pt=a=>{let l;a&&typeof a!="number"&&(a=a.getTime()),a||(a=T.value.getTime());const o=H.value.map(y=>y.timestamp),d=Wt(o,a),b=H.value.find(y=>y.timestamp===d.timestamp);return b&&(l={...b}),l},ft=a=>{typeof a!="number"&&(a=a.getTime());const l=ne.value.timestamp-a,o=new Date(ne.value.timestamp-l);return{y:l/m.value.timeMsPerTick*r.HEIGHT,timestamp:o.getTime()}},gt=a=>{switch(a){case 1:return ot;case 2:return lt;case 3:return at;case 4:return tt}return et},ht=a=>new Promise(l=>{var X;yt();let o=T.value.getTime();a&&(o=typeof a=="object"?a.getTime():a);const d=r.TIME_OFFSET*m.value.timeMsPerTick,b=new Date(o+d),Q=xt(b).date.getTime(),G=Math.ceil(c.value/r.HEIGHT);for(let J=0;J<G;J++){const pe={index:J,format:m.value.type,timestamp:Q-J*m.value.timeMsPerTick,label:J%m.value.labelInterval==0};H.value.push(pe)}const I=pt(o);I&&(K.value=I.timestamp-o,u.value=I,u.value.timestamp=o);let j=(((X=u.value)==null?void 0:X.index)||0)*r.HEIGHT-r.TIME_OFFSET*r.HEIGHT;K.value<0?j+=K.value/m.value.timeMsPerPx:K.value>0&&(j-=K.value/m.value.timeMsPerPx),p.value=-(r.HEIGHT/2)-j,l()}),yt=()=>{v.value=0,Y.value=0,E.value=0,D.value=0,H.value=[]},xt=a=>{switch(m.value.type){case"seconds":return Nt(a);case"two-minutes":return Bt(a);case"fifteen-minutes":return At(a);case"thirty-minutes":return Gt(a);case"hours":return Lt(a)}},Te=async(a,l="smooth",o=!1)=>{var b;if(a===0){(b=h.value)==null||b.scrollTo({top:0,behavior:"smooth"});return}O.value=o;const d=ft(a).y;if(d>=600){const y=r.OFFSET*m.value.timeMsPerTick,Q=y/m.value.timeMsPerPx,G=typeof a=="object"?a.getTime():a;await He(!0,G+y),O.value=!0,V.value.timestamp=G,$e(()=>{var I;return(I=h.value)==null?void 0:I.scrollTo({top:Q,behavior:l})});return}$e(()=>{var y;return(y=h.value)==null?void 0:y.scrollTo({top:d,behavior:l})})},He=async(a,l)=>new Promise(o=>{s.value=!0;const d=Date.now(),b=setInterval(async()=>{Rt(new Date).date.getTime()-d>=999&&(clearInterval(b),le.value=new Date,T.value=new Date,Pt(),wt(),await ht(l),s.value=!1,o())},1)}),_t=()=>{clearInterval(we),clearInterval(Pe)},bt=()=>{T.value=new Date,D.value++,B.y.value===0?(E.value=D.value,V.value={timestamp:T.value.getTime(),live:!0}):B.y.value>0&&!C.value&&(E.value++,V.value={timestamp:V.value.timestamp+1e3,live:!1})},wt=()=>{clearInterval(we),we=setInterval(bt,1e3)},Pt=()=>{clearInterval(Pe),Pe=setInterval(St,m.value.timeMsPerTick)},St=()=>{s.value||(le.value=new Date,Y.value++,B.y.value===0?(de(Y.value-v.value,!0),u.value&&(u.value.index-=Y.value-v.value),v.value=Y.value):B.y.value>0&&!C.value&&(de(1,!0),v.value++,u.value&&u.value.index--))},ke=()=>{clearTimeout(Ve),Ve=setTimeout(()=>{C.value=!1},500),C.value=!0};return Be(()=>{P.value==="light"?oe.value="#5b5b5b":oe.value="#888888"}),Ne(()=>{Re(),He()}),Tt(()=>{_t()}),(a,l)=>(n(),x("div",{ref_key:"timelineComponent",ref:ee,class:"relative h-full w-full"},[w(Ee,null,{default:k(()=>[ae(w(te,{disabled:t(s),icon:t(zt),transition:"fade-transition",position:"absolute",location:"bottom right",class:"timeline-btn",style:L(`transition: all .3s ease-out; ${t(V).live?"":"right: 100px !important;"}`)},null,8,["disabled","icon","style"]),[[ce,t(xe)&&!t(ie)]])]),_:1}),w(Ee,null,{default:k(()=>[ae(w(te,{disabled:t(s),icon:t(je),transition:"fade-transition",position:"absolute",location:"bottom right",class:"timeline-btn",onClick:l[0]||(l[0]=o=>Te(0))},null,8,["disabled","icon"]),[[ce,!t(V).live]])]),_:1}),g("div",oa,[w(Yt,{active:t(s),indeterminate:t(s),color:"#df2a4c",height:"2px"},null,8,["active","indeterminate"])]),g("div",{class:"timeline-annotation",style:L(t(nt))},[g("div",{ref:"annotationLabel",class:"timeline-annotation-label",style:L(t(it))},[t(s)?(n(),R(Fe,{key:0,indeterminate:"",color:"white",size:"10",width:"2"})):(n(),x("div",sa,q(t(V).live?"LIVE":t(ue)(t(V).timestamp,"HH:mm:ss")),1))],4)],4),g("div",{ref_key:"timeline",ref:h,class:"timeline hide-scrollbar disable-overflow-scroll w-full relative",style:L(t(vt))},[t(se)?Z("",!0):(n(),x("div",ia,ua)),a.segment==="0"?(n(),x("div",{key:1,class:"relative h-full",style:L(t(se)?"":"top: -100px")},[g("div",{class:"timeline-scale",style:L(t(ct))},null,4),(n(!0),x(De,null,Ce(t(H),(o,d)=>(n(),x("div",{key:o.index,"data-tick-index":o.index,class:"tick-container flex justify-center items-center absolute",style:L(`${t(mt)}; top: ${t(p)+t(ut)+d*t(r).HEIGHT}px`)},[g("div",{"data-tick-index":`${o.index}`,class:"tick-line relative"},[o.label&&!t(s)?(n(),x("div",da,q(t(ue)(o.timestamp,t(rt)?"HH:mm:ss":"HH:mm")),1)):Z("",!0)],8,ma)],12,ca))),128))],4)):(n(),x("div",va))],4)],512))}}),fa=ye(pa,[["__scopeId","data-v-e8bb6d1c"]]),ga={class:"vue-ios13-segmented-control"},ha=["id","name","value"],ya=["for"],xa=me({__name:"VSegmentedControl",props:{modelValue:{},segments:{}},emits:["update:modelValue"],setup(e,{emit:N}){const W=e,M=N,P=i(0),{modelValue:z,segments:$}=he(W),f=S({get(){return z.value},set(p){M("update:modelValue",p)}}),E=S(()=>$.value.findIndex(p=>p.id===z.value)),D=S(()=>{let p=P.value*E.value;return P.value*E.value<0&&(p=0),`transform:translateX(${p}px)`}),T=()=>{$e(()=>{const p=document.querySelector(`input[type='radio'][value='${z.value}']`);P.value=p&&p.offsetWidth})};return U([$,z],()=>{T()},{deep:!0}),Jt(window,"resize",T),(p,u)=>(n(),x("div",ga,[g("span",{class:"selection-pill",style:L(t(D))},null,4),(n(!0),x(De,null,Ce(t($),s=>(n(),x("div",{key:s.id,class:"option"},[ae(g("input",{id:s.id,"onUpdate:modelValue":u[0]||(u[0]=C=>fe(f)?f.value=C:null),type:"radio",name:s.title,value:s.id},null,8,ha),[[$t,t(f)]]),g("label",{for:s.id,class:"w-full cursor-pointer"},[g("span",{style:L(t(f)===s.id?"color: var(--color-segment-text);":"color: var(--color-segment-text-disabled)")},q(s.title),5)],8,ya)]))),128))]))}}),_a={key:0,class:"w-full flex items-center justify-center mt-10"},ba={class:"flex flex-col justify-center items-center"},wa=me({__name:"VCameraCarousel",props:{showLabel:{type:Boolean,default:!1}},setup(e){const N=new Ze,W=Ke(),M=e,{showLabel:P}=he(M),z=i({page:1,pageSize:-1}),{data:$,isLoading:f}=N.getCamerasQuery(z),E=S(()=>{var D;return(D=$.value)==null?void 0:D.result.findIndex(T=>T.name===W.params.cameraname)});return(D,T)=>{const p=Ye,u=Et("router-link");return t(f)?(n(),x("div",_a,[w(Fe,{color:"#df2a4c",indeterminate:""})])):(n(),R(ea,{key:1,"model-value":t(E),class:"mt-3","show-arrows":"",mandatory:"force"},{default:k(()=>{var s;return[(n(!0),x(De,null,Ce(((s=t($))==null?void 0:s.result)||[],(C,F)=>(n(),R(Kt,{key:C.name,value:F},{default:k(({toggle:O,isSelected:v})=>[g("div",ba,[w(u,{to:`/cameras/${C.name}`,onClick:O},{default:k(()=>[ae(w(p,{class:"ma-3","current-camera":C.name,"border-radius":8,border:!1,target:"snapshot",style:{width:"140px"}},null,8,["current-camera"]),[[ta]])]),_:2},1032,["to","onClick"]),t(P)?(n(),x("div",{key:0,class:We(["add-transition slide-item-title",{"slide-item-title-active":v}])},q(C.name||D.$t("general.loading")),3)):Z("",!0)])]),_:2},1032,["value"]))),128))]}),_:1},8,["model-value"]))}}}),Pa=ye(wa,[["__scopeId","data-v-ec891350"]]),Sa=["onClick"],Ta=me({__name:"VCalendar",props:{showPicker:{type:Boolean,default:!1},showButton:{type:Boolean,default:!1},transitionTrigger:{type:Boolean,default:!0},loading:{type:Boolean,default:!0}},emits:["dateChanged","calendarOpen"],setup(e,{emit:N}){const W=e,M=N,{loading:P}=he(W),{theme:z}=Qe(Ue()),$=i(!1),f=i(new Date),E=Je();U(f,(u,s)=>{u?M("dateChanged",f.value):f.value=s});const D=()=>{$.value=!1,M("calendarOpen",!1)},T=()=>{$.value=!0,M("calendarOpen",!0)},p=u=>{P.value||u()};return(u,s)=>{const C=la;return n(),x("div",null,[w(C,{modelValue:t(f),"onUpdate:modelValue":s[0]||(s[0]=F=>fe(f)?f.value=F:null),"is-required":"",color:"gray","is-dark":t(z)==="dark","max-date":new Date,mode:"dateTime",is24hr:"",onPopoverDidShow:T,onPopoverDidHide:D},{default:k(({togglePopover:F})=>[w(Ee,null,{default:k(()=>[u.showButton?ae((n(),R(te,{key:0,disabled:t(P),transition:"fade-transition",position:"fixed",location:"bottom left",class:"date-fixed-btn rounded-xl",onClick:O=>p(F)},{default:k(()=>[ge(q(t(ue)(t(f))),1)]),_:2},1032,["disabled","onClick"])),[[ce,u.transitionTrigger]]):Z("",!0)]),_:2},1024),u.showPicker?(n(),x("div",{key:0,onClick:O=>p(F)},[g("span",{class:"text-sm cursor-pointer",style:L(t(P)?"color: #a8a8a8;":"")},q(t(E).width.value<875?t(ue)(t(f),"ddd., D. MMM."):t(ue)(t(f))),5),w(re,{size:"20",color:t(P)?"#a8a8a8":"#4a4a4a",class:"cursor-pointer"},{default:k(()=>[ge(q(t($)?t(je):t(Vt)),1)]),_:1},8,["color"])],8,Sa)):Z("",!0)]),_:1},8,["modelValue","is-dark","max-date"])])}}}),Ha=ye(Ta,[["__scopeId","data-v-818d397f"]]),ka={key:0,class:"flex items-center justify-center w-full h-full"},$a={key:1,class:"w-full h-full"},Ea={class:"absolute z-5 left-1 top-2"},Da={class:"left-content"},Ca={key:0,class:"timeline-toggle"},Fa={class:"flex flex-col items-center h-full sidebar camera-no-outside"},za={key:0,class:"sidebar-header p-1 relative"},Va={class:"flex flex-row mb-2"},Oa={class:"w-1/2 flex justify-center items-center"},Ma={class:"w-1/2 flex justify-center items-center"},Ia=me({__name:"Camera",setup(e){const N=new Ze,W=Ke(),{desktopActive:M,mobileActive:P,tabletActive:z,extraSmallMobileActive:$}=qe(),{t:f}=jt.global,E=i(!1),D=i(new Date),T=i(),p=i(0),u=i("0"),s=i(!1),C=i(null),F=i(!1),O=i(!1),v=i(1),Y=Dt([{title:f("views.camera.timeline"),id:"0"},{title:f("views.camera.detections"),id:"1"}]),le=Zt(T),{isOutside:K}=Xe(C),A=S(()=>W.params.cameraname),{data:oe,isLoading:V}=N.getCameraQuery(A);U(v,()=>{});const h=()=>{v.value!==5&&(O.value||(v.value=(v.value||1)+1))},ee=()=>{v.value!==1&&(O.value||(v.value=(v.value||1)-1))};return Be(async()=>{v.value=1}),Ne(async()=>{setTimeout(()=>{T.value=document.querySelector(".player-container-main")},100)}),(H,c)=>{const se=Ha,xe=Ye,_e=Pa,be=xa,ie=fa;return n(),x("main",{class:"w-full h-full",style:L(t(P)?"padding: 0 !important":"")},[!t(oe)||t(V)?(n(),x("div",ka,[w(Fe,{color:"#df2a4c",indeterminate:""})])):(n(),x("div",$a,[ae((n(),R(se,{key:t(A),layout:"text","show-button":"","transition-trigger":!t(K)||t(E),"max-date":new Date,loading:t(F),onDateChanged:c[0]||(c[0]=_=>D.value=_),onCalendarOpen:c[1]||(c[1]=_=>E.value=_)},null,8,["transition-trigger","max-date","loading"])),[[ce,t(P)||t(E)]]),g("div",{class:We(["relative z-5 w-full h-full flex flex-col md:flex-row overflow-hidden",{"gap-4":t(M)}])},[g("div",Ea,[t($)?(n(),R(te,{key:0,size:"32",icon:"",density:"compact",variant:"elevated",class:"no-drag camera-no-outside opacity-50",onClick:c[2]||(c[2]=Ct(_=>H.$router.push("/cameras"),["prevent"]))},{default:k(()=>[w(re,{size:"24"},{default:k(()=>[ge(q(t(Ge)),1)]),_:1})]),_:1})):Z("",!0)]),g("div",Da,[(n(),R(xe,{key:t(A),"show-title":"",settings:"",share:"",snapshot:"",target:"stream",zoom:(t(P)||t(z))&&t(s),"current-camera":t(oe).name,"timeline-scrolling":t(O)||t(F),"border-radius":t(P)?0:3,"zoom-model":t(v),"enable-control":"",shortcuts:"",motions:"",objects:"",zones:"","auto-hide-control":!1,"source-role":"high-resolution",onResize:c[3]||(c[3]=_=>p.value=_),onZoomIn:h,onZoomOut:ee},null,8,["zoom","current-camera","timeline-scrolling","border-radius","zoom-model"])),(n(),R(Ft,null,[ae(w(_e,{"show-label":"","focus-index":""},null,512),[[ce,!t(P)]])],1024))]),g("div",{class:"right-content",style:L(t(z)?`height: ${t(le).height.value}px; width: ${t(le).width.value/3}px; right: ${t(s)?0:-2-t(le).width.value/3}px`:"")},[t(z)?(n(),x("div",Ca,[w(te,{class:"camera-no-outside",color:"#212121",size:"30",variant:"elevated",icon:"",onClick:c[4]||(c[4]=_=>s.value=!t(s))},{default:k(()=>[w(re,{color:"#fff",size:"20"},{default:k(()=>[ge(q(t(s)?t(Ot):t(Ge)),1)]),_:1})]),_:1})])):Z("",!0),g("div",Fa,[!t(P)&&!t(z)?(n(),x("div",za,[g("div",Va,[g("div",Oa,[(n(),R(se,{key:t(A),loading:t(F),layout:"text","show-picker":"",onDateChanged:c[5]||(c[5]=_=>D.value=_)},null,8,["loading"]))]),g("div",Ma,[(n(),R(aa,{key:t(A),modelValue:t(v),"onUpdate:modelValue":c[6]||(c[6]=_=>fe(v)?v.value=_:null),disabled:t(F),readonly:"",min:"1",max:"5",step:"1","track-size":"1","thumb-size":"10","hide-details":""},{prepend:k(()=>[w(te,{size:"28",density:"compact",variant:"text",disabled:t(v)==1,icon:"",onClick:ee},{default:k(()=>[w(re,{size:"20",icon:t(Mt)},null,8,["icon"])]),_:1},8,["disabled"])]),append:k(()=>[w(te,{size:"28",density:"compact",variant:"text",disabled:t(v)==5,icon:"",onClick:h},{default:k(()=>[w(re,{size:"20",icon:t(It)},null,8,["icon"])]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"]))])]),(n(),R(be,{key:t(A),modelValue:t(u),"onUpdate:modelValue":c[7]||(c[7]=_=>fe(u)?u.value=_:null),segments:t(Y)},null,8,["modelValue","segments"]))])):Z("",!0),(n(),R(ie,{key:t(A),ref_key:"timeline",ref:C,"date-model":t(D),"zoom-model":t(v),modifier:t(p),segment:t(u),onIsScrolling:c[8]||(c[8]=_=>O.value=_),onIsLoading:c[9]||(c[9]=_=>F.value=_)},null,8,["date-model","zoom-model","modifier","segment"]))])],4)],2)]))],4)}}}),wl=ye(Ia,[["__scopeId","data-v-7f3148ff"]]);export{wl as default};
@@ -1 +0,0 @@
1
- .camera-events[data-v-73511135]{overflow-x:scroll;overflow-y:hidden;scroll-snap-type:x mandatory;flex-wrap:nowrap}.camera-event-card[data-v-73511135]{width:140px;aspect-ratio:1/1;scroll-snap-align:start;border-radius:5px}.camera-event-card[data-v-73511135] .v-skeleton-loader__bone{border-radius:5px!important}.camera-event-card[data-v-73511135] .v-skeleton-loader__image{height:140px}div[data-v-73511135] .v-skeleton-loader__text{margin-top:6px!important;width:60px;height:15px}.cameras-title[data-v-c5a3e47c]{font-size:.9rem;color:var(--color-disabled)}.camera-gallery[data-v-c5a3e47c]{align-content:flex-start}.camera-card[data-v-c5a3e47c]{padding:.25rem;transition:.2s all ease-out;cursor:pointer}.grid[data-v-c5a3e47c]{display:grid;grid-template-rows:1fr;grid-gap:4px}.item[data-v-c5a3e47c]{display:flex;aspect-ratio:16/9;width:100%}.grid[data-v-c5a3e47c] .v-skeleton-loader__bone{border-radius:5px!important;height:100%}.new-camera[data-v-c5a3e47c]{opacity:.5;transition:.2s all ease-out}.new-camera[data-v-c5a3e47c]:hover{opacity:1}@media screen and (max-width: 639px){.grid[data-v-c5a3e47c] .v-skeleton-loader{border-radius:0!important;aspect-ratio:16/9}.grid[data-v-c5a3e47c] .v-skeleton-loader__bone{border-radius:0!important}}