homebridge-config-ui-x 5.11.2-beta.9 → 5.11.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/dist/modules/plugins/plugins.service.js +1 -1
  3. package/package.json +6 -6
  4. package/public/chunk-46MS4ES2.js +1 -0
  5. package/public/{chunk-LO72RI4S.js → chunk-4MCJPZP7.js} +1 -1
  6. package/public/{chunk-LZTSIWKP.js → chunk-5OJY44K7.js} +1 -1
  7. package/public/{chunk-HBUIXUR3.js → chunk-5T4R2TG7.js} +1 -1
  8. package/public/{chunk-LI37IF2Z.js → chunk-5ZKKHQVJ.js} +1 -1
  9. package/public/{chunk-OS475ZQO.js → chunk-6TQHJYRY.js} +1 -1
  10. package/public/{chunk-IDVQIBZN.js → chunk-7XZWXKAH.js} +1 -1
  11. package/public/{chunk-HYHFIPBC.js → chunk-ADR4S74F.js} +1 -1
  12. package/public/{chunk-SPC2DLZR.js → chunk-AKPNXV2T.js} +1 -1
  13. package/public/chunk-ARENCESQ.js +1 -0
  14. package/public/chunk-BHFVACUP.js +2 -0
  15. package/public/{chunk-A2MXGFJ6.js → chunk-BZ2QQEKA.js} +1 -1
  16. package/public/{chunk-JWGWPSC6.js → chunk-CLZZPSYM.js} +1 -1
  17. package/public/{chunk-DFG4HJK5.js → chunk-CMILM3GM.js} +1 -1
  18. package/public/chunk-EA7AESPK.js +1 -0
  19. package/public/{chunk-GVFAT25G.js → chunk-EEKKVIA4.js} +1 -1
  20. package/public/chunk-GTENKZFZ.js +1 -0
  21. package/public/{chunk-MDHWQ5V2.js → chunk-H2Z7V5LU.js} +2 -2
  22. package/public/{chunk-CKURAGOR.js → chunk-H4W6QAC2.js} +1 -1
  23. package/public/{chunk-TCJMUYCJ.js → chunk-IB2WEG65.js} +1 -1
  24. package/public/{chunk-OVQGZ4C6.js → chunk-IHRICEJT.js} +1 -1
  25. package/public/chunk-IRKGD364.js +1 -0
  26. package/public/{chunk-F635TFLI.js → chunk-KCTJMMYS.js} +1 -1
  27. package/public/{chunk-BQRKHSGH.js → chunk-KTJDR6WA.js} +1 -1
  28. package/public/{chunk-X6RWNTC7.js → chunk-L4GVG4WS.js} +1 -1
  29. package/public/{chunk-DPITSP7F.js → chunk-LKFXBTGS.js} +1 -1
  30. package/public/chunk-LL6AFVK2.js +1 -0
  31. package/public/chunk-LUCN3LNQ.js +4 -0
  32. package/public/{chunk-PRGOUVRO.js → chunk-MIE7YXOK.js} +1 -1
  33. package/public/chunk-MIFZP2ZO.js +1 -0
  34. package/public/{chunk-NAICVRJH.js → chunk-NMDAPSGJ.js} +1 -1
  35. package/public/{chunk-5R6AJZGA.js → chunk-OG2B4MZN.js} +1 -1
  36. package/public/{chunk-RT25QBCQ.js → chunk-OQMG62H7.js} +1 -1
  37. package/public/chunk-P6DSGS6M.js +1 -0
  38. package/public/chunk-PHJW3U7W.js +1 -0
  39. package/public/{chunk-TJXF3MRO.js → chunk-PY5Y7RE5.js} +1 -1
  40. package/public/chunk-QIJUUUXH.js +1 -0
  41. package/public/chunk-R7G2HUC4.js +35 -0
  42. package/public/{chunk-HN6QQBDC.js → chunk-RGBORGOJ.js} +1 -1
  43. package/public/{chunk-6CBJSM3U.js → chunk-RJZU6B73.js} +1 -1
  44. package/public/{chunk-2OWZ4XP5.js → chunk-TJCUOGC4.js} +1 -1
  45. package/public/{chunk-6QWPGE2L.js → chunk-TLHI6ZOI.js} +1 -1
  46. package/public/chunk-TS66MDDS.js +1 -0
  47. package/public/chunk-UBRNIXM3.js +1 -0
  48. package/public/chunk-VQUWQONZ.js +1 -0
  49. package/public/chunk-VX4RXOTH.js +4 -0
  50. package/public/chunk-VXOUYKAC.js +1 -0
  51. package/public/chunk-WPYUSARH.js +1 -0
  52. package/public/chunk-WTG5NVOU.js +1 -0
  53. package/public/chunk-X7VB3AHW.js +68 -0
  54. package/public/{chunk-PYPOWROR.js → chunk-XJL5IKA2.js} +1 -1
  55. package/public/chunk-YUYO5SVM.js +1 -0
  56. package/public/chunk-Z5SOQKPW.js +19 -0
  57. package/public/{chunk-Z5PUNNUZ.js → chunk-ZGIZ2UDW.js} +1 -1
  58. package/public/index.html +1 -1
  59. package/public/{main-EZDP2TWN.js → main-KBV6ZN6L.js} +1 -1
  60. package/public/chunk-3N7C33O4.js +0 -1
  61. package/public/chunk-4XUH7NXA.js +0 -1
  62. package/public/chunk-7JIIKSDG.js +0 -1
  63. package/public/chunk-AWTSOXJ2.js +0 -2
  64. package/public/chunk-BBBDRQZR.js +0 -1
  65. package/public/chunk-DSSLC7R5.js +0 -1
  66. package/public/chunk-HUTYOGRH.js +0 -4
  67. package/public/chunk-IDJSTIFL.js +0 -1
  68. package/public/chunk-K7PJFUH4.js +0 -1
  69. package/public/chunk-KV4RQA3A.js +0 -1
  70. package/public/chunk-LAVT57X4.js +0 -1
  71. package/public/chunk-LLNAB3NM.js +0 -35
  72. package/public/chunk-N3SESV2P.js +0 -1
  73. package/public/chunk-PD3Q2PZE.js +0 -1
  74. package/public/chunk-R2CO54AK.js +0 -19
  75. package/public/chunk-UFVCK77E.js +0 -68
  76. package/public/chunk-V2TVR4X3.js +0 -1
  77. package/public/chunk-VKR3GG6K.js +0 -1
  78. package/public/chunk-W4WAFNIS.js +0 -1
  79. package/public/chunk-WU7URLRW.js +0 -1
  80. package/public/chunk-YHBVXMFX.js +0 -1
  81. package/public/chunk-ZAWMHW3P.js +0 -1
  82. package/public/chunk-ZSFO6PRU.js +0 -4
package/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to `homebridge-config-ui-x` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).
4
4
 
5
- ## v5.11.2 (Unreleased)
5
+ ## v5.11.3 (Unreleased)
6
6
 
7
7
  ### ⚠️ Browser Support
8
8
 
@@ -30,6 +30,22 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
30
30
  - `@homebridge/node-pty-prebuilt-multiarch` @ `v0.13.1`
31
31
  - `@homebridge/plugin-ui-utils` @ `v2.1.3-beta`
32
32
 
33
+ ## v5.11.2 (2025-12-06)
34
+
35
+ ### UI Changes
36
+
37
+ - updates to the `th.json` language file (#2659) (@tomzt)
38
+
39
+ ### Other Changes
40
+
41
+ - dependency updates
42
+
43
+ ### Homebridge Dependencies
44
+
45
+ - `@homebridge/hap-client` @ `v3.1.2`
46
+ - `@homebridge/node-pty-prebuilt-multiarch` @ `v0.13.1`
47
+ - `@homebridge/plugin-ui-utils` @ `v2.1.2`
48
+
33
49
  ## v5.11.1 (2025-11-27)
34
50
 
35
51
  ### Other Changes
@@ -378,7 +378,7 @@ let PluginsService = class PluginsService {
378
378
  pluginAction.version = await this.getNpmModuleLatestVersion(pluginAction.name);
379
379
  }
380
380
  const userPlatform = platform();
381
- if (this.configService.ui.webroot && lt(pluginAction.version, '5.11.1-alpha.0')) {
381
+ if (this.configService.ui.webroot && lt(pluginAction.version, '5.11.3-alpha.0')) {
382
382
  throw new Error(`Cannot install HB UI v${pluginAction.version} when a webroot is configured.\n\r`
383
383
  + 'Please either:\n\r'
384
384
  + ' - Remove the configured webroot, restart Homebridge, then try the install again, or\n\r'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "homebridge-config-ui-x",
3
3
  "displayName": "Homebridge UI",
4
4
  "type": "module",
5
- "version": "5.11.2-beta.9",
5
+ "version": "5.11.3-beta.0",
6
6
  "description": "A web based management, configuration and control platform for Homebridge.",
7
7
  "author": "oznu <dev@oz.nu>",
8
8
  "license": "MIT",
@@ -87,7 +87,7 @@
87
87
  "@nestjs/axios": "4.0.1",
88
88
  "@nestjs/common": "11.1.9",
89
89
  "@nestjs/core": "11.1.9",
90
- "@nestjs/jwt": "11.0.1",
90
+ "@nestjs/jwt": "11.0.2",
91
91
  "@nestjs/passport": "11.0.5",
92
92
  "@nestjs/platform-fastify": "11.1.9",
93
93
  "@nestjs/platform-socket.io": "11.1.9",
@@ -102,10 +102,10 @@
102
102
  "dayjs": "1.11.19",
103
103
  "fastify": "5.6.2",
104
104
  "fs-extra": "11.3.2",
105
- "jsonwebtoken": "9.0.2",
105
+ "jsonwebtoken": "9.0.3",
106
106
  "lodash": "4.17.21",
107
107
  "node-cache": "5.1.2",
108
- "node-forge": "1.3.2",
108
+ "node-forge": "1.3.3",
109
109
  "node-schedule": "2.1.1",
110
110
  "ora": "9.0.0",
111
111
  "otplib": "12.0.1",
@@ -122,7 +122,7 @@
122
122
  "unzipper": "0.12.3"
123
123
  },
124
124
  "devDependencies": {
125
- "@antfu/eslint-config": "^6.2.0",
125
+ "@antfu/eslint-config": "^6.4.2",
126
126
  "@nestjs/testing": "^11.1.9",
127
127
  "@prettier/plugin-xml": "^3.4.2",
128
128
  "@types/fs-extra": "^11.0.4",
@@ -137,7 +137,7 @@
137
137
  "@types/unzipper": "^0.10.11",
138
138
  "@vitest/coverage-v8": "^4.0.15",
139
139
  "concurrently": "^9.2.1",
140
- "eslint-plugin-format": "^1.0.2",
140
+ "eslint-plugin-format": "^1.1.0",
141
141
  "form-data": "^4.0.5",
142
142
  "nodemon": "^3.1.11",
143
143
  "rimraf": "^6.1.2",
@@ -0,0 +1 @@
1
+ import{a as Ce}from"./chunk-H2Z7V5LU.js";import{a as we}from"./chunk-PY5Y7RE5.js";import{n as R}from"./chunk-MIE7YXOK.js";import{g as ie,m as F,n as xe}from"./chunk-TJCUOGC4.js";import{c as be}from"./chunk-LL6AFVK2.js";import{a as fe}from"./chunk-ZGIZ2UDW.js";import{b as K}from"./chunk-H4W6QAC2.js";import{B as ve,C as G,D as z,b as W,c as N,d as g,e as j,f as X,g as P,j as E,m as Y,q as Z,r as ee,s as te}from"./chunk-GTENKZFZ.js";import{a as Te,b as _e}from"./chunk-ADR4S74F.js";import{C as D,D as U,F as I,I as V}from"./chunk-BHFVACUP.js";import{Ab as h,Cb as oe,Db as se,Dc as o,Eb as le,Ec as s,Fb as y,Fc as ue,Gb as a,Hb as i,Ib as c,Jb as $,Kb as k,Lb as q,Rb as A,Sb as H,Xb as _,Yb as L,Za as e,Zb as f,aa as p,ea as ae,ga as B,ha as M,ic as O,jc as me,kc as m,lc as d,ma as re,mb as Q,mc as v,nb as S,nc as de,sa as T,xc as pe,yb as u,yc as ce,zb as w}from"./chunk-VX4RXOTH.js";import{g as Ue,h as C}from"./chunk-B4AJQJMI.js";function ke(n,x){n&1&&(a(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),i()()),n&2&&(y("dismissible",!1),e(2),d(s(3,2,"login.invalid_password")))}var he=(()=>{class n{$activeModal=p(F);$api=p(V);$toastr=p(I);$translate=p(D);invalidCredentials=T(!1);formGroup=new P({password:new E("",[g.required])});disable2fa(){return C(this,null,function*(){this.invalidCredentials.set(!1);try{yield this.$api.post("/users/otp/deactivate",this.formGroup.value),this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))}catch{this.formGroup.setValue({password:""}),this.invalidCredentials.set(!0)}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["ng-component"]],decls:34,vars:27,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(l,r){l&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),i(),a(5,"button",3),o(6,"translate"),_("click",function(){return r.dismissModal()}),i()(),a(7,"div",4)(8,"div",5),c(9,"i",6),i(),a(10,"ul",7)(11,"li"),m(12),o(13,"translate"),i()(),a(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),i(),a(19,"div",11),c(20,"input",12),o(21,"translate"),i()()(),w(22,ke,4,4,"ngb-alert",13),i(),a(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),_("click",function(){return r.dismissModal()}),m(27),o(28,"translate"),i()(),c(29,"div",17),a(30,"div",18)(31,"button",19),_("click",function(){return r.disable2fa()}),m(32),o(33,"translate"),i()()()()),l&2&&(e(3),d(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),d(s(13,15,"users.setup_2fa_disable_current_password")),e(5),d(s(18,17,"users.label_password")),e(3),y("formControl",r.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),h(r.invalidCredentials()&&!r.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),v(" ",s(28,23,"form.button_close")," "),e(4),y("disabled",r.formGroup.invalid),e(),v(" ",s(33,25,"form.button_disable")," "))},dependencies:[G,N,j,z,Z,ie,U],encapsulation:2})}return n})();var ge=Ue(Te(),1);var Be=n=>({timeDiffError:n});function Me(n,x){n&1&&(a(0,"li"),m(1),o(2,"translate"),i()),n&2&&(e(),d(s(2,1,"users.setup_2fa_scan_qr_code")))}function De(n,x){if(n&1&&(a(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),i(),a(4,"p",17),m(5),o(6,"translate"),i()()),n&2){let t=f();y("dismissible",!1),e(2),d(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ue(6,5,"users.setup_2fa_server_time_out",pe(8,Be,t.timeDiffError())))}}function Ie(n,x){n&1&&c(0,"i",27)}function Ve(n,x){n&1&&c(0,"i",28)}function Fe(n,x){if(n&1){let t=A();a(0,"div",21),m(1),o(2,"translate"),c(3,"br"),m(4),a(5,"a",26),_("click",function(){B(t);let r=f(2);return M(r.copySecretToClipboard())}),w(6,Ie,1,0,"i",27)(7,Ve,1,0,"i",28),i()()}if(n&2){let t=f(2);e(),v(" ",s(2,3,"users.setup_2fa_scan_qr_manual")),e(3),v(" ",t.otpSecret()," "),e(2),h(t.secretCopied()?6:7)}}function Ae(n,x){if(n&1&&(a(0,"ul",9)(1,"li",18)(2,"div",19),c(3,"app-qrcode",20),i(),w(4,Fe,8,5,"div",21),i(),a(5,"li",22)(6,"label",23),m(7),o(8,"translate"),i(),a(9,"div",24),c(10,"input",25),i()()()),n&2){let t=f();e(3),y("data",t.otpString()),e(),h(t.otpSecret()?4:-1),e(3),d(s(8,4,"users.setup_2fa_enter_code")),e(3),y("formControl",t.formGroup.controls.code)}}function Ne(n,x){if(n&1){let t=A();a(0,"button",29),o(1,"translate"),_("click",function(){B(t);let r=f();return M(r.dismissModal())}),m(2),o(3,"translate"),i()}n&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),v(" ",s(3,4,"form.button_close")," "))}function je(n,x){if(n&1){let t=A();a(0,"button",29),o(1,"translate"),_("click",function(){B(t);let r=f();return M(r.dismissModal())}),m(2),o(3,"translate"),i()}n&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),v(" ",s(3,4,"form.button_close")," "))}function Pe(n,x){if(n&1){let t=A();a(0,"button",30),_("click",function(){B(t);let r=f();return M(r.enable2fa())}),m(1),o(2,"translate"),i()}if(n&2){let t=f();y("disabled",t.formGroup.invalid),e(),v(" ",s(2,2,"form.button_enable")," ")}}var Ee=(()=>{class n{$activeModal=p(F);$api=p(V);$toastr=p(I);$translate=p(D);modalData=p(R);user=this.modalData.user;timeDiffError=T(null);otpString=T(void 0);otpSecret=T(void 0);secretCopied=T(!1);copyTimeout=null;formGroup=new P({code:new E("",[g.required,g.minLength(6),g.maxLength(6)])});ngOnInit(){this.initialize()}initialize(){return C(this,null,function*(){try{let t=yield this.$api.post("/users/otp/setup",{});this.checkTimeDiff(t.timestamp),this.timeDiffError()||(this.otpString.set(t.otpauth),this.otpSecret.set(new URL(t.otpauth).searchParams.get("secret")||""))}catch(t){this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){return C(this,null,function*(){try{yield this.$api.post("/users/otp/activate",this.formGroup.value),this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}copySecretToClipboard(){return C(this,null,function*(){let t=this.otpSecret();t&&(yield navigator.clipboard.writeText(t),this.secretCopied.set(!0),this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.secretCopied.set(!1)},3e3))})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let l=(0,ge.default)(t).diff(new Date,"millisecond");l<-5e3||l>5e3?this.timeDiffError.set(l):this.timeDiffError.set(null)}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["ng-component"]],decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center","my-2"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"grey-text","small","mt-0","mb-1"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["href","javascript:void(0)",1,"ms-1","text-primary",3,"click"],[1,"fas","fa-check","green-text"],[1,"fas","fa-copy"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(l,r){l&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),i(),a(5,"button",3),o(6,"translate"),_("click",function(){return r.dismissModal()}),i()(),a(7,"div",4)(8,"div",5),c(9,"i",6),i(),a(10,"ul",7)(11,"li"),m(12),o(13,"translate"),i(),w(14,Me,3,3,"li"),i(),w(15,De,7,10,"ngb-alert",8),w(16,Ae,11,6,"ul",9),i(),a(17,"div",10)(18,"div",11),w(19,Ne,4,6,"button",12),i(),a(20,"div",13),w(21,je,4,6,"button",12),i(),a(22,"div",14),w(23,Pe,3,4,"button",15),i()()()),l&2&&(e(3),d(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),d(s(13,13,"users.setup_2fa_warning")),e(2),h(r.timeDiffError()?-1:14),e(),h(r.timeDiffError()?15:-1),e(),h(r.timeDiffError()?-1:16),e(3),h(r.timeDiffError()?-1:19),e(2),h(r.timeDiffError()?21:-1),e(2),h(r.timeDiffError()?-1:23))},dependencies:[ie,Ce,G,N,j,ve,z,Z,U],encapsulation:2})}return n})();var ye=(()=>{class n{$activeModal=p(F);$api=p(V);$toastr=p(I);$translate=p(D);form=new P({username:new E("",[g.required]),name:new E("",[g.required]),password:new E("",[g.compose([g.required,g.minLength(4)])]),passwordConfirm:new E("",[g.required]),admin:new E(!0)},this.matchPassword);onSubmit(l){return C(this,arguments,function*({value:t}){try{yield this.$api.post("/users",t),this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))}catch(r){this.$toastr.error(r.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let l=t.get("password")?.value,r=t.get("passwordConfirm")?.value;return l!==r?(t.get("passwordConfirm")?.setErrors({matchPassword:!0}),{matchPassword:!0}):null}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["ng-component"]],decls:58,vars:48,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["formControlName","admin","type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(l,r){l&1&&(a(0,"div",0)(1,"form",1),_("ngSubmit",function(){return r.onSubmit(r.form)}),a(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),i(),a(6,"button",4),o(7,"translate"),_("click",function(){return r.dismissModal()}),i()(),a(8,"div",5)(9,"div",6),c(10,"i",7),i(),a(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),i(),a(16,"div",11),c(17,"input",12),o(18,"translate"),i()(),a(19,"li",9)(20,"label",13),m(21),o(22,"translate"),i(),a(23,"div",11),c(24,"input",14),o(25,"translate"),i()(),a(26,"li",9)(27,"label",15),m(28),o(29,"translate"),i(),a(30,"div",11),c(31,"input",16),o(32,"translate"),i()(),a(33,"li",9)(34,"label",17),m(35),o(36,"translate"),i(),a(37,"div",11),c(38,"input",18),o(39,"translate"),i()(),a(40,"li",19)(41,"span",20),m(42),o(43,"translate"),i(),a(44,"div",21),c(45,"input",22),o(46,"translate"),c(47,"label",23),i()()()(),a(48,"div",24)(49,"div",20)(50,"button",25),_("click",function(){return r.dismissModal()}),m(51),o(52,"translate"),i()(),c(53,"div",26),a(54,"div",27)(55,"button",28),m(56),o(57,"translate"),i()()()()()),l&2&&(e(),y("formGroup",r.form),e(3),d(s(5,20,"users.title_add_user")),e(2),u("aria-label",s(7,22,"form.button_close")),e(8),d(s(15,24,"users.label_username")),e(3),u("aria-label",s(18,26,"users.label_username")),e(4),d(s(22,28,"users.label_full_name")),e(3),u("aria-label",s(25,30,"users.label_full_name")),e(4),d(s(29,32,"users.label_password")),e(3),O("is-invalid",r.form.controls.password.dirty&&r.form.controls.password.errors),u("aria-label",s(32,34,"users.label_password")),e(4),d(s(36,36,"users.label_confirm_password")),e(3),O("is-invalid",r.form.controls.passwordConfirm.dirty&&r.form.controls.passwordConfirm.errors),u("aria-label",s(39,38,"users.label_confirm_password")),e(4),d(s(43,40,"users.label_admin_user")),e(3),u("aria-label",s(46,42,"users.label_admin_user")),e(6),v(" ",s(52,44,"form.button_close")," "),e(4),y("disabled",!r.form.valid),e(),v(" ",s(57,46,"form.button_save")," "))},dependencies:[G,Y,N,W,j,X,z,te,ee,U],encapsulation:2})}return n})();function Ge(n,x){if(n&1&&(a(0,"li",9)(1,"label",27),m(2),o(3,"translate"),i(),a(4,"div",11),c(5,"input",28),o(6,"translate"),i()()),n&2){let t=f();e(2),d(s(3,4,"users.label_confirm_password")),e(3),O("is-invalid",t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors),u("aria-label",s(6,6,"users.label_confirm_password"))}}var Se=(()=>{class n{$activeModal=p(F);$api=p(V);$auth=p(K);$toastr=p(I);$translate=p(D);modalData=p(R);user=this.modalData.user;isCurrentUser=T(!1);initialFormValue={};form=new P({username:new E("",[g.required]),name:new E("",[g.required]),password:new E(""),passwordConfirm:new E(""),admin:new E(!0)},this.matchPassword);ngOnInit(){this.user&&(this.isCurrentUser.set(this.$auth.user.username===this.user.username),this.form.patchValue(this.user),this.initialFormValue=this.form.getRawValue())}onSubmit(l){return C(this,arguments,function*({value:t}){if(this.user)try{yield this.$api.patch(`/users/${this.user.id}`,t),this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser()&&t.username!==this.$auth.user.username&&this.$auth.logout()}catch(r){console.error(r),this.$toastr.error(r.error?.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}isFormUnchanged(){return this.form.controls.password.value?!1:JSON.stringify(this.form.getRawValue())===JSON.stringify(this.initialFormValue)}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let l=t.get("password")?.value,r=t.get("passwordConfirm")?.value;return l!==r?(t.get("passwordConfirm")?.setErrors({matchPassword:!0}),{matchPassword:!0}):null}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["ng-component"]],decls:52,vars:41,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input"]],template:function(l,r){l&1&&(a(0,"div",0)(1,"form",1),_("ngSubmit",function(){return r.onSubmit(r.form)}),a(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),i(),a(6,"button",4),o(7,"translate"),_("click",function(){return r.dismissModal()}),i()(),a(8,"div",5)(9,"div",6),c(10,"i",7),i(),a(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),i(),a(16,"div",11),c(17,"input",12),o(18,"translate"),i()(),a(19,"li",9)(20,"label",13),m(21),o(22,"translate"),i(),a(23,"div",11),c(24,"input",14),o(25,"translate"),i()(),a(26,"li",9)(27,"label",15),m(28),o(29,"translate"),i(),a(30,"div",11),c(31,"input",16),o(32,"translate"),i()(),w(33,Ge,7,8,"li",9),a(34,"li",17)(35,"span",18),m(36),o(37,"translate"),i(),a(38,"div",19),c(39,"input",20),o(40,"translate"),c(41,"label",21),i()()()(),a(42,"div",22)(43,"div",18)(44,"button",23),_("click",function(){return r.dismissModal()}),m(45),o(46,"translate"),i()(),c(47,"div",24),a(48,"div",25)(49,"button",26),m(50),o(51,"translate"),i()()()()()),l&2&&(e(),y("formGroup",r.form),e(3),d(s(5,17,"users.title_edit_user")),e(2),u("aria-label",s(7,19,"form.button_close")),e(8),d(s(15,21,"users.label_username")),e(3),u("aria-label",s(18,23,"users.label_username")),e(4),d(s(22,25,"users.label_full_name")),e(3),u("aria-label",s(25,27,"users.label_full_name")),e(4),d(s(29,29,"users.label_new_password")),e(3),O("is-invalid",r.form.controls.password.dirty&&r.form.controls.password.errors),u("aria-label",s(32,31,"users.label_new_password")),e(2),h(r.form.controls.password.value?33:-1),e(3),d(s(37,33,"users.label_admin_user")),e(3),u("aria-label",s(40,35,"users.label_admin_user")),e(6),v(" ",s(46,37,"form.button_close")," "),e(4),y("disabled",!r.form.valid||r.isFormUnchanged()),e(),v(" ",s(51,39,"form.button_save")," "))},dependencies:[G,Y,N,W,j,X,z,te,ee,U],encapsulation:2})}return n})();var $e=(()=>{class n{$activeModal=p(F);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["ng-component"]],decls:46,vars:36,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fa","fa-question-circle-o","primary-text",2,"font-size","75px"],[1,"ms-2"],[1,"mb-0"],[1,"mb-2","grey-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"]],template:function(l,r){l&1&&(a(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),m(4),o(5,"translate"),i(),a(6,"button",3),o(7,"translate"),_("click",function(){return r.dismissModal()}),i()(),a(8,"div",4)(9,"div",5),c(10,"i",6),i(),a(11,"h5",7),m(12),o(13,"translate"),i(),a(14,"ul",8)(15,"li"),m(16),o(17,"translate"),i(),a(18,"ul",9)(19,"li"),m(20),o(21,"translate"),i(),a(22,"li"),m(23),o(24,"translate"),i(),a(25,"li"),m(26),o(27,"translate"),o(28,"translate"),i(),a(29,"li"),m(30),o(31,"translate"),i(),a(32,"li"),m(33),o(34,"translate"),i()(),a(35,"li"),m(36),o(37,"translate"),i()(),c(38,"app-support-banner"),i(),a(39,"div",10),c(40,"div",11),a(41,"div",12)(42,"button",13),_("click",function(){return r.dismissModal()}),m(43),o(44,"translate"),i()(),c(45,"div",14),i()()()),l&2&&(e(4),d(s(5,12,"support.title")),e(2),u("aria-label",s(7,14,"form.button_close")),e(6),d(s(13,16,"users.title_users")),e(4),d(s(17,18,"users.support.acc_1")),e(4),d(s(21,20,"menu.label_status")),e(3),d(s(24,22,"menu.label_plugins")),e(3),de("",s(27,24,"menu.label_accessories")," (",s(28,26,"users.support.control"),")"),e(4),d(s(31,28,"menu.linux.label_logs")),e(3),d(s(34,30,"support.title")),e(3),d(s(37,32,"users.support.acc_2")),e(7),v(" ",s(44,34,"form.button_close")," "))},dependencies:[we,U],encapsulation:2})}return n})();var ze=(n,x)=>({"fa-user-secret":n,"fa-user":x});function Re(n,x){if(n&1){let t=A();$(0,"button",23),L("click",function(){B(t);let r=f(2).$implicit,b=f();return M(b.disable2fa(r))}),m(1),o(2,"translate"),k()}if(n&2){let t=f(2).$implicit,l=f();H("disabled",t.username!==l.username),e(),v(" ",s(2,2,"users.setup_2fa_disable")," ")}}function qe(n,x){if(n&1){let t=A();$(0,"button",24),L("click",function(){B(t);let r=f(2).$implicit,b=f();return M(b.setup2fa(r))}),m(1),o(2,"translate"),k()}if(n&2){let t=f(2).$implicit,l=f();H("disabled",t.username!==l.username),e(),v(" ",s(2,2,"users.setup_2fa")," ")}}function Le(n,x){if(n&1&&w(0,Re,3,4,"button",21)(1,qe,3,4,"button",22),n&2){let t=f().$implicit;h(t.otpActive?0:1)}}function Oe(n,x){n&1&&q(0,"div")}function Je(n,x){if(n&1){let t=A();$(0,"div",9)(1,"div",10)(2,"div",11)(3,"div",12)(4,"span",13)(5,"h4"),m(6),k(),$(7,"h5",14),q(8,"i",15),m(9),k()()(),$(10,"div",16),w(11,Le,2,1)(12,Oe,1,0,"div"),$(13,"div")(14,"button",17),o(15,"translate"),L("click",function(){let r=B(t).$implicit,b=f();return M(b.openEditUser(r))}),q(16,"i",18),k(),$(17,"button",19),o(18,"translate"),L("click",function(){let r=B(t).$implicit,b=f();return M(b.deleteUser(r.id))}),q(19,"i",20),k()()()()()()}if(n&2){let t=x.$implicit,l=f();e(6),d(t.name),e(2),me(ce(12,ze,t.admin,!t.admin)),e(),v(" ",t.username," "),e(2),h(t.admin?11:12),e(3),u("aria-label",s(15,8,"form.button_edit")),e(3),H("disabled",l.username===t.username),u("aria-label",s(18,10,"form.button_delete"))}}var ti=(()=>{class n{injector=p(ae);destroyRef=p(re);$api=p(V);$auth=p(K);$modal=p(xe);$route=p(be);$settings=p(_e);$toastr=p(I);$translate=p(D);homebridgeUsers=T([]);username=this.$auth.user.username;isAdmin=this.$auth.user.admin;ngOnInit(){let t=this.$translate.instant("users.title_users");this.$settings.setPageTitle(t),this.$route.data.pipe(fe(this.destroyRef)).subscribe(l=>{this.homebridgeUsers.set(l.homebridgeUsers)})}reloadUsers(){return C(this,null,function*(){let t=yield this.$api.get("/users");this.homebridgeUsers.set(t)})}openAddNewUser(){return C(this,null,function*(){let t=this.$modal.open(ye,{size:"lg",backdrop:"static"});try{yield t.result,this.reloadUsers()}catch{}})}openEditUser(t){return C(this,null,function*(){let l=Q([{provide:R,useValue:{user:t}}],this.injector),r=this.$modal.open(Se,{size:"lg",backdrop:"static",injector:l});try{yield r.result,this.reloadUsers()}catch{}})}deleteUser(t){return C(this,null,function*(){try{yield this.$api.delete(`/users/${t}`),this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()}catch(l){console.error(l),this.$toastr.error(l.error?.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){return C(this,null,function*(){let l=Q([{provide:R,useValue:{user:t}}],this.injector),r=this.$modal.open(Ee,{size:"lg",backdrop:"static",injector:l});try{yield r.result,this.reloadUsers()}catch{}})}disable2fa(t){return C(this,null,function*(){let l=Q([{provide:R,useValue:{user:t}}],this.injector),r=this.$modal.open(he,{size:"lg",backdrop:"static",injector:l});try{yield r.result,this.reloadUsers()}catch{}})}openSupport(){this.$modal.open($e,{size:"lg",backdrop:"static"})}static \u0275fac=function(l){return new(l||n)};static \u0275cmp=S({type:n,selectors:[["app-users"]],decls:15,vars:9,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"btn","btn-elegant","waves-effect","m-0","me-2",3,"click"],[1,"fas","fa-user-plus"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-question-circle-o"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[1,"small","text-truncate","grey-text"],[1,"fas"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-trash"],[1,"btn","btn-elegant","m-0",3,"disabled"],[1,"btn","btn-primary","m-0",3,"disabled"],[1,"btn","btn-elegant","m-0",3,"click","disabled"],[1,"btn","btn-primary","m-0",3,"click","disabled"]],template:function(l,r){l&1&&($(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),k()(),$(5,"div",3)(6,"button",4),o(7,"translate"),L("click",function(){return r.openAddNewUser()}),q(8,"i",5),k(),$(9,"button",6),o(10,"translate"),L("click",function(){return r.openSupport()}),q(11,"i",7),k()()(),$(12,"div",8),se(13,Je,20,15,"div",9,oe),k()),l&2&&(e(3),d(s(4,3,"users.title_users")),e(3),u("aria-label",s(7,5,"users.button_add_user")),e(3),u("aria-label",s(10,7,"support.title")),e(4),le(r.homebridgeUsers()))},dependencies:[U],encapsulation:2})}return n})();export{ti as UsersComponent};
@@ -1 +1 @@
1
- import{a as p}from"./chunk-DPITSP7F.js";import{a as u}from"./chunk-F635TFLI.js";import{a as f}from"./chunk-PRGOUVRO.js";import{n as c}from"./chunk-2OWZ4XP5.js";import{b as l}from"./chunk-HYHFIPBC.js";import{E as m}from"./chunk-AWTSOXJ2.js";import{X as a,aa as e,ea as s,mb as o}from"./chunk-HUTYOGRH.js";import{h as i}from"./chunk-B4AJQJMI.js";var S=(()=>{class n{injector=e(s);$terminal=e(p);$settings=e(l);$modal=e(c);$translate=e(m);handleBeforeUnload(r){if(!this.$settings.env.terminal?.persistence&&!this.$settings.env.terminal?.hideWarning&&this.$terminal.hasActiveSession()&&this.$terminal.hasUserTypedInSession()){let t=this.$translate.instant("platform.terminal.terminate_unload");return r.preventDefault(),r.returnValue=t,t}}canDeactivate(){return i(this,null,function*(){if(this.$settings.env.terminal?.persistence||this.$settings.env.terminal?.hideWarning||!this.$terminal.hasActiveSession()||!this.$terminal.hasUserTypedInSession())return!0;let r=o([{provide:f,useValue:{title:this.$translate.instant("platform.terminal.terminate_title"),message:this.$translate.instant("platform.terminal.terminate_message_1"),message2:this.$translate.instant("platform.terminal.terminate_message_2"),message3:this.$translate.instant("common.phrases.are_you_sure"),confirmButtonLabel:this.$translate.instant("form.button_continue"),confirmButtonClass:"btn-primary",faIconClass:"fas fa-exclamation-triangle text-warning"}}],this.injector),t=this.$modal.open(u,{size:"lg",backdrop:"static",injector:r});try{return yield t.result,!0}catch{return!1}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=a({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();export{S as a};
1
+ import{a as p}from"./chunk-LKFXBTGS.js";import{a as u}from"./chunk-KCTJMMYS.js";import{a as f}from"./chunk-MIE7YXOK.js";import{n as c}from"./chunk-TJCUOGC4.js";import{b as l}from"./chunk-ADR4S74F.js";import{C as m}from"./chunk-BHFVACUP.js";import{X as a,aa as e,ea as s,mb as o}from"./chunk-VX4RXOTH.js";import{h as i}from"./chunk-B4AJQJMI.js";var S=(()=>{class n{injector=e(s);$terminal=e(p);$settings=e(l);$modal=e(c);$translate=e(m);handleBeforeUnload(r){if(!this.$settings.env.terminal?.persistence&&!this.$settings.env.terminal?.hideWarning&&this.$terminal.hasActiveSession()&&this.$terminal.hasUserTypedInSession()){let t=this.$translate.instant("platform.terminal.terminate_unload");return r.preventDefault(),r.returnValue=t,t}}canDeactivate(){return i(this,null,function*(){if(this.$settings.env.terminal?.persistence||this.$settings.env.terminal?.hideWarning||!this.$terminal.hasActiveSession()||!this.$terminal.hasUserTypedInSession())return!0;let r=o([{provide:f,useValue:{title:this.$translate.instant("platform.terminal.terminate_title"),message:this.$translate.instant("platform.terminal.terminate_message_1"),message2:this.$translate.instant("platform.terminal.terminate_message_2"),message3:this.$translate.instant("common.phrases.are_you_sure"),confirmButtonLabel:this.$translate.instant("form.button_continue"),confirmButtonClass:"btn-primary",faIconClass:"fas fa-exclamation-triangle text-warning"}}],this.injector),t=this.$modal.open(u,{size:"lg",backdrop:"static",injector:r});try{return yield t.result,!0}catch{return!1}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=a({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();export{S as a};
@@ -1,4 +1,4 @@
1
- import{a as vt,b as $t,c as Ht,d as St}from"./chunk-TCJMUYCJ.js";import{a as Ct}from"./chunk-JWGWPSC6.js";import{a as Ot}from"./chunk-H7F7H5MW.js";import{t as q,w as wt}from"./chunk-PRGOUVRO.js";import{a as Et}from"./chunk-RT25QBCQ.js";import{b as B}from"./chunk-ZCGZM7LU.js";import{a as kt,b as xt}from"./chunk-OVQGZ4C6.js";import{m as _t,n as yt,t as U}from"./chunk-2OWZ4XP5.js";import{c as pt,e as I}from"./chunk-PD3Q2PZE.js";import"./chunk-Z5PUNNUZ.js";import{C as ut,D as bt,c as mt,e as ft,l as ht}from"./chunk-K7PJFUH4.js";import{b as gt}from"./chunk-HYHFIPBC.js";import{E as O,F as H,H as N,K as F,j as ct}from"./chunk-AWTSOXJ2.js";import{Ab as S,Cb as rt,Db as at,Dc as r,Eb as lt,Ec as l,Fb as _,Fc as X,Gb as a,Hb as d,Ib as m,Rb as E,Xb as y,Za as o,Zb as p,aa as g,ea as st,ga as u,ha as b,hb as ot,ic as dt,jc as Y,kc as C,lc as M,mb as G,mc as V,n as nt,nb as R,sa as k,yb as $,yc as Q,zb as x}from"./chunk-HUTYOGRH.js";import{a as j,b as K,d as et,g as it,h as w}from"./chunk-B4AJQJMI.js";var Dt=it(Ht(),1);var Mt=it(Ot(),1);var Tt=(s,v)=>({"fa-trash":s,"fa-cog fa-spin":v});function Ft(s,v){s&1&&(a(0,"div",13),m(1,"i",20),d())}function Ut(s,v){if(s&1){let t=E();a(0,"li",9)(1,"span"),C(2),r(3,"date"),m(4,"br"),a(5,"span",21),C(6),r(7,"date"),d()(),a(8,"span",22)(9,"button",25),r(10,"translate"),r(11,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.restore(i.id))}),m(12,"i",26),d(),a(13,"button",27),r(14,"translate"),r(15,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.download(i.id))}),m(16,"i",28),d(),a(17,"button",23),r(18,"translate"),r(19,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.delete(i.id))}),m(20,"i",24),d()()()}if(s&2){let t=v.$implicit,e=p(2);o(2),V(" ",X(3,16,t.timestamp,"mediumDate")),o(4),M(X(7,19,t.timestamp,"shortTime")),o(3),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(10,22,"config.restore.copy_to_editor"))("openDelay",150),$("aria-label",l(11,24,"config.restore.copy_to_editor")),o(4),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(14,26,"form.button_download"))("openDelay",150),$("aria-label",l(15,28,"form.button_download")),o(4),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(18,30,"form.button_delete"))("openDelay",150),$("aria-label",l(19,32,"form.button_delete")),o(3),Y(Q(34,Tt,t.id!==e.deleting(),t.id===e.deleting()))}}function qt(s,v){if(s&1){let t=E();a(0,"ul",14),at(1,Ut,21,37,"li",9,rt),a(3,"li",9)(4,"span"),C(5),r(6,"translate"),m(7,"br"),a(8,"span",21),C(9),r(10,"translate"),d()(),a(11,"span",22)(12,"button",23),r(13,"translate"),r(14,"translate"),y("click",function(){u(t);let i=p();return b(i.deleteAllBackups())}),m(15,"i",24),d()()()()}if(s&2){let t=p();o(),lt(t.backupList()),o(4),V(" ",l(6,8,"form.button_delete_all")),o(4),M(l(10,10,"common.labels.no_confirmation")),o(3),_("disabled",t.clicked()||t.deleting())("ngbTooltip",l(13,12,"form.button_delete_all"))("openDelay",150),$("aria-label",l(14,14,"form.button_delete")),o(3),Y(Q(16,Tt,t.deleting()!=="all",t.deleting()==="all"))}}var Bt=(()=>{class s{$activeModal=g(_t);$api=g(F);$router=g(I);$toastr=g(N);$translate=g(O);modalData=g(q);currentConfig=this.modalData.currentConfig;fromSettings=this.modalData.fromSettings??!1;loading=k(!0,{});backupList=k([],{});clicked=k(!1,{});deleting=k(null,{});ngOnInit(){this.getConfigBackups()}getConfigBackups(){return w(this,null,function*(){try{let t=yield this.$api.get("/config-editor/backups");this.loading.set(!1),this.backupList.set(t)}catch(t){this.loading.set(!1),console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.dismissModal()}})}restore(t){return this.$activeModal.close(t)}download(t){return w(this,null,function*(){this.clicked.set(!0);try{let e=yield this.$api.get(`/config-editor/backups/${t}`),i=JSON.stringify(e,null,4),n=new Blob([i],{type:"application/json"}),f=`config-backup-${t}.json`;(0,Mt.saveAs)(n,f),this.clicked.set(!1)}catch(e){this.clicked.set(!1),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}downloadCurrentConfig(){let t=`data:text/json;charset=utf-8,${encodeURIComponent(this.currentConfig)}`,e=document.createElement("a");e.setAttribute("href",t),e.setAttribute("download","config.json"),document.body.appendChild(e),e.click(),e.remove()}delete(t){return w(this,null,function*(){this.deleting.set(t);try{yield this.$api.delete(`/config-editor/backups/${t}`),yield this.getConfigBackups(),this.deleting.set(null)}catch(e){this.deleting.set(null),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}deleteAllBackups(){return w(this,null,function*(){this.deleting.set("all");try{yield this.$api.delete("/config-editor/backups"),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success")),this.backupList.set([]),this.deleting.set(null)}catch(t){this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t),this.deleting.set(null)}})}dismissModal(){this.fromSettings&&this.$router.navigate(["/settings"]),this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=R({type:s,selectors:[["ng-component"]],decls:40,vars:31,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-history","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"btn","btn-primary","m-0","ms-3","py-1",3,"click","disabled"],[1,"fas","fa-arrow-right"],[1,"text-center","primary-text"],[1,"list-group","list-group-box","mt-3"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-end"],[1,"fa","fa-cog","fa-spin","mt-3",2,"font-size","75px"],[1,"grey-text","small"],[2,"display","flex","flex-wrap","nowrap"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-3","py-1",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-history"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-download"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),C(3),r(4,"translate"),d(),a(5,"button",3),r(6,"translate"),y("click",function(){return i.dismissModal()}),d()(),a(7,"div",4)(8,"div",5),m(9,"i",6),d(),a(10,"ul",7)(11,"li"),C(12),r(13,"translate"),d(),a(14,"li"),C(15),r(16,"translate"),d()(),a(17,"ul",8)(18,"li",9)(19,"div")(20,"span"),C(21),r(22,"translate"),d(),m(23,"br"),a(24,"small",10),C(25),r(26,"translate"),d()(),a(27,"button",11),r(28,"translate"),y("click",function(){return i.downloadCurrentConfig()}),m(29,"i",12),d()()(),x(30,Ft,2,0,"div",13)(31,qt,16,19,"ul",14),d(),a(32,"div",15),m(33,"div",16),a(34,"div",17)(35,"button",18),r(36,"translate"),y("click",function(){return i.dismissModal()}),C(37),r(38,"translate"),d()(),m(39,"div",19),d()()),e&2&&(o(3),M(l(4,13,"config.restore.title")),o(2),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(6,15,"form.button_close")),o(7),M(l(13,17,"config.restore.help_1")),o(3),M(l(16,19,"config.restore.help_2")),o(6),M(l(22,21,"form.button_download")),o(4),M(l(26,23,"config.restore.download")),o(2),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(28,25,"backup.backup_now")),o(3),S(i.loading()?30:i.backupList().length?31:-1),o(5),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(36,27,"form.button_close")),o(2),V(" ",l(38,29,"form.button_close")," "))},dependencies:[U,bt,ct,H],encapsulation:2})}return s})();function zt(s,v){if(s&1){let t=E();a(0,"button",13),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.onCancelRestore())}),m(3,"i",14),d()}if(s&2){let t=p();_("disabled",t.saveInProgress())("openDelay",150)("ngbTooltip",l(1,4,"form.button_cancel")),$("aria-label",l(2,6,"form.button_cancel"))}}function Lt(s,v){if(s&1){let t=E();a(0,"button",15),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.onRestore())}),m(3,"i",16),d()}s&2&&(_("openDelay",150)("ngbTooltip",l(1,3,"form.button_restore")),$("aria-label",l(2,5,"form.button_restore")))}function Jt(s,v){if(s&1){let t=E();a(0,"button",15),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.toggleSideBySide())}),m(3,"i",17),d()}if(s&2){let t=p();_("openDelay",150)("ngbTooltip",l(1,7,t.renderSideBySide()?"config.restore.view_inline":"config.restore.view_side_by_side")),$("aria-label",l(2,9,t.renderSideBySide()?"config.restore.view_inline":"config.restore.view_side_by_side")),o(3),dt("fa-columns",!t.renderSideBySide())("fa-bars",t.renderSideBySide())}}function Wt(s,v){s&1&&m(0,"i",8)}function Kt(s,v){s&1&&m(0,"i",9)}function Gt(s,v){if(s&1){let t=E();a(0,"ngx-monaco-editor",18),y("onInit",function(i){u(t);let n=p();return b(n.onEditorInit(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())}),d()}if(s&2){let t=p();_("options",t.editorOptions)("model",t.monacoEditorModel)}}function Yt(s,v){if(s&1){let t=E();a(0,"ngx-monaco-diff-editor",19),y("onInit",function(i){u(t);let n=p();return b(n.onInitDiffEditor(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())}),d()}if(s&2){let t=p();_("options",t.editorOptions)("originalModel",t.diffOriginalModel)("modifiedModel",t.diffModifiedModel)}}function Qt(s,v){if(s&1){let t=E();a(0,"textarea",20),y("ngModelChange",function(i){u(t);let n=p();return b(n.homebridgeConfig.set(i))}),C(1," "),d()}if(s&2){let t=p();_("ngModel",t.homebridgeConfig())}}var De=(()=>{class s{injector=g(st);$api=g(F);$md=g(Ct);$modal=g(yt);$monacoEditor=g(Et);$renderer=g(ot);$route=g(pt);$router=g(I);$settings=g(gt);$toastr=g(N);$translate=g(O);editorDecorations=[];lastHeight;visualViewPortEventCallback;latestSavedConfig;childBridgesToRestart=[];hbPendingRestart=!1;isDebugModeEnabled=this.$settings.isFeatureEnabled("childBridgeDebugMode");isMatterSupported=this.$settings.isFeatureEnabled("matterSupport");homebridgeConfig=k("",{});originalConfig=k("",{});saveInProgress=k(!1,{});isMobile=k(!1,{});monacoEditor;editorOptions;monacoEditorModel;diffOriginalModel;diffModifiedModel;renderSideBySide=k(!1,{});constructor(){this.isMobile.set(!!this.$md.detect.mobile())}ngOnInit(){let t=this.$translate.instant("menu.config_json_editor");this.$settings.setPageTitle(t),this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",renderSideBySide:this.renderSideBySide(),renderIndicators:!0,ignoreTrimWhitespace:!1,glyphMargin:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile()&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile()&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(n=>{this.homebridgeConfig.set(n.config),this.latestSavedConfig=JSON.parse(n.config),this.diffModifiedModel&&this.updateDiffModels()}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},this.diffOriginalModel={code:"",language:"json"},this.diffModifiedModel={code:this.homebridgeConfig()||"{}",language:"json"},window.monaco?this.setMonacoEditorModel():this.waitForMonaco();let{action:i}=this.$router.parseUrl(this.$router.url).queryParams;if(i){switch(i){case"restore":{this.onRestore(!0);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}}waitForMonaco(){return w(this,null,function*(){try{yield nt(this.$monacoEditor.readyEvent),this.setMonacoEditorModel()}catch(t){console.error("Failed to wait for monaco ready event:",t)}})}onEditorInit(t){window.editor=t,this.monacoEditor=t;let e=this.monacoEditor.getModel();e&&e.setValue(this.homebridgeConfig())}onInitDiffEditor(t){this.monacoEditor=t.getModifiedEditor(),this.updateDiffModels(),window.editor=t}updateDiffModels(){if(this.diffOriginalModel&&(this.diffOriginalModel.code=this.originalConfig()||""),this.diffModifiedModel&&(this.diffModifiedModel.code=this.homebridgeConfig()||"{}"),window.editor&&window.editor.getOriginalEditor){let t=window.editor.getOriginalEditor(),e=window.editor.getModifiedEditor();if(t&&e){let i=t.getModel(),n=e.getModel();i&&i.setValue(this.originalConfig()||""),n&&n.setValue(this.homebridgeConfig()||"{}")}}}onSave(){return w(this,null,function*(){if(!this.saveInProgress()){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress.set(!0);try{if(!this.isMobile()){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let e=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of e)if(i.message==="Duplicate object key"){this.saveInProgress.set(!1),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig.set(this.monacoEditor.getModel().getValue())}let t=this.parseConfigFromEditor();this.homebridgeConfig.set(JSON.stringify(t,null,4)),typeof t.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(t.bridge.username)?t.accessories&&!Array.isArray(t.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&!Array.isArray(t.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&Array.isArray(t.platforms)&&!this.validateSection(t.platforms,"platform")||t.accessories&&Array.isArray(t.accessories)&&!this.validateSection(t.accessories,"accessory")||t.plugins&&Array.isArray(t.plugins)&&!this.validatePlugins(t.plugins,"plugins")||t.disabledPlugins&&Array.isArray(t.disabledPlugins)&&!this.validatePlugins(t.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(t),this.originalConfig.set("")):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress.set(!1)}})}onRestore(t=!1){return w(this,null,function*(){let e=G([{provide:q,useValue:{currentConfig:this.homebridgeConfig(),fromSettings:t}}],this.injector),i=this.$modal.open(Bt,{size:"lg",backdrop:"static",injector:e});try{let n=yield i.result;try{this.originalConfig()||(this.originalConfig.set(this.homebridgeConfig()),this.updateDiffModels());let f=yield this.$api.get(`/config-editor/backups/${n}`);this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig.set(JSON.stringify(f,null,4)),this.updateDiffModels(),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig(),forceMoveMarkers:!0}]))}catch(f){console.error(f);let h=f?.error?.message||this.$translate.instant("backup.load_error");this.$toastr.error(h,this.$translate.instant("toast.title_error"))}}catch{}})}onCancelRestore(){if(window.editor&&window.editor.dispose)try{window.editor.dispose(),window.editor=void 0}catch{}this.homebridgeConfig.set(this.originalConfig()),this.originalConfig.set(""),this.renderSideBySide()&&this.toggleSideBySide(),this.updateDiffModels(),this.onRestore()}toggleSideBySide(){this.renderSideBySide.set(!this.renderSideBySide()),this.editorOptions=K(j({},this.editorOptions),{renderSideBySide:this.renderSideBySide()})}ngOnDestroy(){let t=document.querySelector(".content");this.$renderer.removeStyle(t,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove());try{if(window.editor&&window.editor.dispose&&(window.editor.dispose(),window.editor=void 0),window.monaco){let e=window.monaco.Uri.parse("file:///original.json"),i=window.monaco.Uri.parse("file:///modified.json"),n=window.monaco.editor.getModel(e);n&&n.dispose();let f=window.monaco.editor.getModel(i);f&&f.dispose();let T=(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas||[]).filter(D=>D.uri!=="http://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:T})}this.monacoEditor&&this.monacoEditor.dispose()}catch{}}validateSection(t,e){for(let i of t){if(typeof i!="object"||i===null||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1;if(!(e in i))return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1;if(typeof i[e]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1}return!0}validatePlugins(t,e){for(let i of t)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:e}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(t){this.monacoEditor&&(t=JSON.stringify(t,null,4).split(`
1
+ import{a as vt,b as $t,c as Ht,d as St}from"./chunk-IB2WEG65.js";import{a as Ct}from"./chunk-CLZZPSYM.js";import{a as Ot}from"./chunk-H7F7H5MW.js";import{t as q,w as wt}from"./chunk-MIE7YXOK.js";import{a as Et}from"./chunk-OQMG62H7.js";import{b as B}from"./chunk-ZCGZM7LU.js";import{a as kt,b as xt}from"./chunk-IHRICEJT.js";import{m as _t,n as yt,t as U}from"./chunk-TJCUOGC4.js";import{c as pt,e as I}from"./chunk-LL6AFVK2.js";import"./chunk-ZGIZ2UDW.js";import{C as ut,D as bt,c as mt,e as ft,l as ht}from"./chunk-GTENKZFZ.js";import{b as gt}from"./chunk-ADR4S74F.js";import{C as O,D as H,F as N,I as F,h as ct}from"./chunk-BHFVACUP.js";import{Ab as S,Cb as rt,Db as at,Dc as r,Eb as lt,Ec as l,Fb as _,Fc as X,Gb as a,Hb as d,Ib as m,Rb as E,Xb as y,Za as o,Zb as p,aa as g,ea as st,ga as u,ha as b,hb as ot,ic as dt,jc as Y,kc as C,lc as M,mb as G,mc as V,n as nt,nb as R,sa as k,yb as $,yc as Q,zb as x}from"./chunk-VX4RXOTH.js";import{a as j,b as K,d as et,g as it,h as w}from"./chunk-B4AJQJMI.js";var Dt=it(Ht(),1);var Mt=it(Ot(),1);var Tt=(s,v)=>({"fa-trash":s,"fa-cog fa-spin":v});function Ft(s,v){s&1&&(a(0,"div",13),m(1,"i",20),d())}function Ut(s,v){if(s&1){let t=E();a(0,"li",9)(1,"span"),C(2),r(3,"date"),m(4,"br"),a(5,"span",21),C(6),r(7,"date"),d()(),a(8,"span",22)(9,"button",25),r(10,"translate"),r(11,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.restore(i.id))}),m(12,"i",26),d(),a(13,"button",27),r(14,"translate"),r(15,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.download(i.id))}),m(16,"i",28),d(),a(17,"button",23),r(18,"translate"),r(19,"translate"),y("click",function(){let i=u(t).$implicit,n=p(2);return b(n.delete(i.id))}),m(20,"i",24),d()()()}if(s&2){let t=v.$implicit,e=p(2);o(2),V(" ",X(3,16,t.timestamp,"mediumDate")),o(4),M(X(7,19,t.timestamp,"shortTime")),o(3),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(10,22,"config.restore.copy_to_editor"))("openDelay",150),$("aria-label",l(11,24,"config.restore.copy_to_editor")),o(4),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(14,26,"form.button_download"))("openDelay",150),$("aria-label",l(15,28,"form.button_download")),o(4),_("disabled",e.clicked()||e.deleting())("ngbTooltip",l(18,30,"form.button_delete"))("openDelay",150),$("aria-label",l(19,32,"form.button_delete")),o(3),Y(Q(34,Tt,t.id!==e.deleting(),t.id===e.deleting()))}}function qt(s,v){if(s&1){let t=E();a(0,"ul",14),at(1,Ut,21,37,"li",9,rt),a(3,"li",9)(4,"span"),C(5),r(6,"translate"),m(7,"br"),a(8,"span",21),C(9),r(10,"translate"),d()(),a(11,"span",22)(12,"button",23),r(13,"translate"),r(14,"translate"),y("click",function(){u(t);let i=p();return b(i.deleteAllBackups())}),m(15,"i",24),d()()()()}if(s&2){let t=p();o(),lt(t.backupList()),o(4),V(" ",l(6,8,"form.button_delete_all")),o(4),M(l(10,10,"common.labels.no_confirmation")),o(3),_("disabled",t.clicked()||t.deleting())("ngbTooltip",l(13,12,"form.button_delete_all"))("openDelay",150),$("aria-label",l(14,14,"form.button_delete")),o(3),Y(Q(16,Tt,t.deleting()!=="all",t.deleting()==="all"))}}var Bt=(()=>{class s{$activeModal=g(_t);$api=g(F);$router=g(I);$toastr=g(N);$translate=g(O);modalData=g(q);currentConfig=this.modalData.currentConfig;fromSettings=this.modalData.fromSettings??!1;loading=k(!0);backupList=k([]);clicked=k(!1);deleting=k(null);ngOnInit(){this.getConfigBackups()}getConfigBackups(){return w(this,null,function*(){try{let t=yield this.$api.get("/config-editor/backups");this.loading.set(!1),this.backupList.set(t)}catch(t){this.loading.set(!1),console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.dismissModal()}})}restore(t){return this.$activeModal.close(t)}download(t){return w(this,null,function*(){this.clicked.set(!0);try{let e=yield this.$api.get(`/config-editor/backups/${t}`),i=JSON.stringify(e,null,4),n=new Blob([i],{type:"application/json"}),f=`config-backup-${t}.json`;(0,Mt.saveAs)(n,f),this.clicked.set(!1)}catch(e){this.clicked.set(!1),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}downloadCurrentConfig(){let t=`data:text/json;charset=utf-8,${encodeURIComponent(this.currentConfig)}`,e=document.createElement("a");e.setAttribute("href",t),e.setAttribute("download","config.json"),document.body.appendChild(e),e.click(),e.remove()}delete(t){return w(this,null,function*(){this.deleting.set(t);try{yield this.$api.delete(`/config-editor/backups/${t}`),yield this.getConfigBackups(),this.deleting.set(null)}catch(e){this.deleting.set(null),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e)}})}deleteAllBackups(){return w(this,null,function*(){this.deleting.set("all");try{yield this.$api.delete("/config-editor/backups"),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success")),this.backupList.set([]),this.deleting.set(null)}catch(t){this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t),this.deleting.set(null)}})}dismissModal(){this.fromSettings&&this.$router.navigate(["/settings"]),this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=R({type:s,selectors:[["ng-component"]],decls:40,vars:31,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-history","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"btn","btn-primary","m-0","ms-3","py-1",3,"click","disabled"],[1,"fas","fa-arrow-right"],[1,"text-center","primary-text"],[1,"list-group","list-group-box","mt-3"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-end"],[1,"fa","fa-cog","fa-spin","mt-3",2,"font-size","75px"],[1,"grey-text","small"],[2,"display","flex","flex-wrap","nowrap"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-3","py-1",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-history"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-download"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),C(3),r(4,"translate"),d(),a(5,"button",3),r(6,"translate"),y("click",function(){return i.dismissModal()}),d()(),a(7,"div",4)(8,"div",5),m(9,"i",6),d(),a(10,"ul",7)(11,"li"),C(12),r(13,"translate"),d(),a(14,"li"),C(15),r(16,"translate"),d()(),a(17,"ul",8)(18,"li",9)(19,"div")(20,"span"),C(21),r(22,"translate"),d(),m(23,"br"),a(24,"small",10),C(25),r(26,"translate"),d()(),a(27,"button",11),r(28,"translate"),y("click",function(){return i.downloadCurrentConfig()}),m(29,"i",12),d()()(),x(30,Ft,2,0,"div",13)(31,qt,16,19,"ul",14),d(),a(32,"div",15),m(33,"div",16),a(34,"div",17)(35,"button",18),r(36,"translate"),y("click",function(){return i.dismissModal()}),C(37),r(38,"translate"),d()(),m(39,"div",19),d()()),e&2&&(o(3),M(l(4,13,"config.restore.title")),o(2),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(6,15,"form.button_close")),o(7),M(l(13,17,"config.restore.help_1")),o(3),M(l(16,19,"config.restore.help_2")),o(6),M(l(22,21,"form.button_download")),o(4),M(l(26,23,"config.restore.download")),o(2),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(28,25,"backup.backup_now")),o(3),S(i.loading()?30:i.backupList().length?31:-1),o(5),_("disabled",i.clicked()||i.deleting()),$("aria-label",l(36,27,"form.button_close")),o(2),V(" ",l(38,29,"form.button_close")," "))},dependencies:[U,bt,ct,H],encapsulation:2})}return s})();function zt(s,v){if(s&1){let t=E();a(0,"button",13),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.onCancelRestore())}),m(3,"i",14),d()}if(s&2){let t=p();_("disabled",t.saveInProgress())("openDelay",150)("ngbTooltip",l(1,4,"form.button_cancel")),$("aria-label",l(2,6,"form.button_cancel"))}}function Lt(s,v){if(s&1){let t=E();a(0,"button",15),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.onRestore())}),m(3,"i",16),d()}s&2&&(_("openDelay",150)("ngbTooltip",l(1,3,"form.button_restore")),$("aria-label",l(2,5,"form.button_restore")))}function Jt(s,v){if(s&1){let t=E();a(0,"button",15),r(1,"translate"),r(2,"translate"),y("click",function(){u(t);let i=p();return b(i.toggleSideBySide())}),m(3,"i",17),d()}if(s&2){let t=p();_("openDelay",150)("ngbTooltip",l(1,7,t.renderSideBySide()?"config.restore.view_inline":"config.restore.view_side_by_side")),$("aria-label",l(2,9,t.renderSideBySide()?"config.restore.view_inline":"config.restore.view_side_by_side")),o(3),dt("fa-columns",!t.renderSideBySide())("fa-bars",t.renderSideBySide())}}function Wt(s,v){s&1&&m(0,"i",8)}function Kt(s,v){s&1&&m(0,"i",9)}function Gt(s,v){if(s&1){let t=E();a(0,"ngx-monaco-editor",18),y("onInit",function(i){u(t);let n=p();return b(n.onEditorInit(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())}),d()}if(s&2){let t=p();_("options",t.editorOptions)("model",t.monacoEditorModel)}}function Yt(s,v){if(s&1){let t=E();a(0,"ngx-monaco-diff-editor",19),y("onInit",function(i){u(t);let n=p();return b(n.onInitDiffEditor(i))})("keydown.control.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())})("keydown.meta.s",function(i){u(t);let n=p();return i.preventDefault(),b(n.onSave())}),d()}if(s&2){let t=p();_("options",t.editorOptions)("originalModel",t.diffOriginalModel)("modifiedModel",t.diffModifiedModel)}}function Qt(s,v){if(s&1){let t=E();a(0,"textarea",20),y("ngModelChange",function(i){u(t);let n=p();return b(n.homebridgeConfig.set(i))}),C(1," "),d()}if(s&2){let t=p();_("ngModel",t.homebridgeConfig())}}var De=(()=>{class s{injector=g(st);$api=g(F);$md=g(Ct);$modal=g(yt);$monacoEditor=g(Et);$renderer=g(ot);$route=g(pt);$router=g(I);$settings=g(gt);$toastr=g(N);$translate=g(O);editorDecorations=[];lastHeight;visualViewPortEventCallback;latestSavedConfig;childBridgesToRestart=[];hbPendingRestart=!1;isDebugModeEnabled=this.$settings.isFeatureEnabled("childBridgeDebugMode");isMatterSupported=this.$settings.isFeatureEnabled("matterSupport");homebridgeConfig=k("");originalConfig=k("");saveInProgress=k(!1);isMobile=k(!1);monacoEditor;editorOptions;monacoEditorModel;diffOriginalModel;diffModifiedModel;renderSideBySide=k(!1);constructor(){this.isMobile.set(!!this.$md.detect.mobile())}ngOnInit(){let t=this.$translate.instant("menu.config_json_editor");this.$settings.setPageTitle(t),this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",renderSideBySide:this.renderSideBySide(),renderIndicators:!0,ignoreTrimWhitespace:!1,glyphMargin:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile()&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile()&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(n=>{this.homebridgeConfig.set(n.config),this.latestSavedConfig=JSON.parse(n.config),this.diffModifiedModel&&this.updateDiffModels()}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},this.diffOriginalModel={code:"",language:"json"},this.diffModifiedModel={code:this.homebridgeConfig()||"{}",language:"json"},window.monaco?this.setMonacoEditorModel():this.waitForMonaco();let{action:i}=this.$router.parseUrl(this.$router.url).queryParams;if(i){switch(i){case"restore":{this.onRestore(!0);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}}waitForMonaco(){return w(this,null,function*(){try{yield nt(this.$monacoEditor.readyEvent),this.setMonacoEditorModel()}catch(t){console.error("Failed to wait for monaco ready event:",t)}})}onEditorInit(t){window.editor=t,this.monacoEditor=t;let e=this.monacoEditor.getModel();e&&e.setValue(this.homebridgeConfig())}onInitDiffEditor(t){this.monacoEditor=t.getModifiedEditor(),this.updateDiffModels(),window.editor=t}updateDiffModels(){if(this.diffOriginalModel&&(this.diffOriginalModel.code=this.originalConfig()||""),this.diffModifiedModel&&(this.diffModifiedModel.code=this.homebridgeConfig()||"{}"),window.editor&&window.editor.getOriginalEditor){let t=window.editor.getOriginalEditor(),e=window.editor.getModifiedEditor();if(t&&e){let i=t.getModel(),n=e.getModel();i&&i.setValue(this.originalConfig()||""),n&&n.setValue(this.homebridgeConfig()||"{}")}}}onSave(){return w(this,null,function*(){if(!this.saveInProgress()){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress.set(!0);try{if(!this.isMobile()){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let e=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of e)if(i.message==="Duplicate object key"){this.saveInProgress.set(!1),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig.set(this.monacoEditor.getModel().getValue())}let t=this.parseConfigFromEditor();this.homebridgeConfig.set(JSON.stringify(t,null,4)),typeof t.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(t.bridge.username)?t.accessories&&!Array.isArray(t.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&!Array.isArray(t.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):t.platforms&&Array.isArray(t.platforms)&&!this.validateSection(t.platforms,"platform")||t.accessories&&Array.isArray(t.accessories)&&!this.validateSection(t.accessories,"accessory")||t.plugins&&Array.isArray(t.plugins)&&!this.validatePlugins(t.plugins,"plugins")||t.disabledPlugins&&Array.isArray(t.disabledPlugins)&&!this.validatePlugins(t.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(t),this.originalConfig.set("")):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress.set(!1)}})}onRestore(t=!1){return w(this,null,function*(){let e=G([{provide:q,useValue:{currentConfig:this.homebridgeConfig(),fromSettings:t}}],this.injector),i=this.$modal.open(Bt,{size:"lg",backdrop:"static",injector:e});try{let n=yield i.result;try{this.originalConfig()||(this.originalConfig.set(this.homebridgeConfig()),this.updateDiffModels());let f=yield this.$api.get(`/config-editor/backups/${n}`);this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig.set(JSON.stringify(f,null,4)),this.updateDiffModels(),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig(),forceMoveMarkers:!0}]))}catch(f){console.error(f);let h=f?.error?.message||this.$translate.instant("backup.load_error");this.$toastr.error(h,this.$translate.instant("toast.title_error"))}}catch{}})}onCancelRestore(){if(window.editor&&window.editor.dispose)try{window.editor.dispose(),window.editor=void 0}catch{}this.homebridgeConfig.set(this.originalConfig()),this.originalConfig.set(""),this.renderSideBySide()&&this.toggleSideBySide(),this.updateDiffModels(),this.onRestore()}toggleSideBySide(){this.renderSideBySide.set(!this.renderSideBySide()),this.editorOptions=K(j({},this.editorOptions),{renderSideBySide:this.renderSideBySide()})}ngOnDestroy(){let t=document.querySelector(".content");this.$renderer.removeStyle(t,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove());try{if(window.editor&&window.editor.dispose&&(window.editor.dispose(),window.editor=void 0),window.monaco){let e=window.monaco.Uri.parse("file:///original.json"),i=window.monaco.Uri.parse("file:///modified.json"),n=window.monaco.editor.getModel(e);n&&n.dispose();let f=window.monaco.editor.getModel(i);f&&f.dispose();let T=(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas||[]).filter(D=>D.uri!=="http://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:T})}this.monacoEditor&&this.monacoEditor.dispose()}catch{}}validateSection(t,e){for(let i of t){if(typeof i!="object"||i===null||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1;if(!(e in i))return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1;if(typeof i[e]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:e}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(JSON.stringify(i)),!1}return!0}validatePlugins(t,e){for(let i of t)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:e}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(t){this.monacoEditor&&(t=JSON.stringify(t,null,4).split(`
2
2
  `).map(e=>` ${e}`).join(`
3
3
  `),requestAnimationFrame(()=>{let e=this.monacoEditor.getModel().findMatches(t);if(e.length){let i=e[0].range,n=new monaco.Range(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:n,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}}))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(i=>i.uri==="http://homebridge/config.json"))return;let t=monaco.Uri.parse("a://homebridge/config.json"),e=St(this.$translate,{isDebugModeEnabled:this.isDebugModeEnabled,isMatterSupported:this.isMatterSupported});window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[t.toString()],schema:{type:"object",additionalProperties:!1,required:["bridge"],properties:{bridge:{type:"object",additionalProperties:!1,required:["name","username","port","pin"],properties:j({name:{type:"string",title:this.$translate.instant("settings.name"),description:`The Homebridge instance name.
4
4
  This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",title:this.$translate.instant("users.label_username"),description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
@@ -1,4 +1,4 @@
1
- import{a as z,b as S,c as F}from"./chunk-BMOLDRJ3.js";import{a}from"./chunk-OS475ZQO.js";import{F as c,X as f,aa as u,d as m}from"./chunk-HUTYOGRH.js";import{g as h}from"./chunk-B4AJQJMI.js";var d=h(z(),1),p=h(S(),1),b=h(F(),1);var B=(()=>{class s{$ws=u(a);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;connectedSubscription;resizeSubscription;elementResizeSubscription;searchFilter=null;logBuffer=[];maxBufferSize=1e3;term;startTerminal(e,r={},n,w){this.pluginName=w,this.elementResize=n,this.io=this.$ws.connectToNamespace("log"),this.fitAddon=new d.FitAddon,this.webLinksAddon=new p.WebLinksAddon,this.term=new b.Terminal(r),this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon),this.resize=new m,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.fit()}),this.connectedSubscription=this.io.connected.subscribe(()=>{this.term.reset(),this.logBuffer=[],this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.connected&&this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows}),this.io.socket.on("disconnect",()=>{this.term.write(`
1
+ import{a as z,b as S,c as F}from"./chunk-BMOLDRJ3.js";import{a}from"./chunk-6TQHJYRY.js";import{F as c,X as f,aa as u,d as m}from"./chunk-VX4RXOTH.js";import{g as h}from"./chunk-B4AJQJMI.js";var d=h(z(),1),p=h(S(),1),b=h(F(),1);var B=(()=>{class s{$ws=u(a);io;fitAddon;webLinksAddon;resize;elementResize;pluginName;connectedSubscription;resizeSubscription;elementResizeSubscription;searchFilter=null;logBuffer=[];maxBufferSize=1e3;term;startTerminal(e,r={},n,w){this.pluginName=w,this.elementResize=n,this.io=this.$ws.connectToNamespace("log"),this.fitAddon=new d.FitAddon,this.webLinksAddon=new p.WebLinksAddon,this.term=new b.Terminal(r),this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon),this.resize=new m,this.term.open(e.nativeElement),setTimeout(()=>{this.fitAddon.fit()}),this.connectedSubscription=this.io.connected.subscribe(()=>{this.term.reset(),this.logBuffer=[],this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows})}),this.io.socket.connected&&this.io.socket.emit("tail-log",{cols:this.term.cols,rows:this.term.rows}),this.io.socket.on("disconnect",()=>{this.term.write(`
2
2
  \r
3
3
  \rWebsocket failed to connect. Is the server running?
4
4
  \r
@@ -1 +1 @@
1
- import{b as D,c as S,d as H}from"./chunk-IDVQIBZN.js";import{b as B}from"./chunk-PRGOUVRO.js";import{m as L}from"./chunk-2OWZ4XP5.js";import{F as T}from"./chunk-AWTSOXJ2.js";import{Ab as l,Dc as g,Ec as _,Fb as p,Gb as i,Hb as a,Ib as m,Rb as P,Ua as C,Va as k,Xb as b,Za as o,Zb as d,aa as h,ga as x,ha as O,jc as y,kc as u,lc as I,mc as M,nb as v,uc as w,yb as f,zb as r}from"./chunk-HUTYOGRH.js";function E(t,c){if(t&1&&m(0,"i",16),t&2){let n=d();y(w("fas ",n.faIconClass," mb-3"))}}function z(t,c){if(t&1&&m(0,"h5",6),t&2){let n=d();p("innerHTML",n.subtitle,C)}}function A(t,c){if(t&1&&m(0,"p",8),t&2){let n=d();p("innerHTML",n.message2,C)}}function V(t,c){if(t&1&&m(0,"markdown",9),t&2){let n=d();p("data",n.markdownMessage2)}}function N(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function F(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function j(t,c){if(t&1&&(i(0,"a",15),u(1),m(2,"i",18),a()),t&2){let n=d();p("href",n.ctaButtonLink,k),o(),M(" ",n.ctaButtonLabel," ")}}var Y=(()=>{class t{$activeModal=h(L);modalData=h(B);title=this.modalData.title;subtitle=this.modalData.subtitle;message=this.modalData.message;message2=this.modalData.markdownMessage2;ctaButtonLabel=this.modalData.ctaButtonLabel;ctaButtonLink=this.modalData.ctaButtonLink;faIconClass=this.modalData.faIconClass;markdownMessage2=this.modalData.markdownMessage2;dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=v({type:t,selectors:[["ng-component"]],decls:19,vars:13,consts:[["role","dialog","aria-modal","true",1,"modal-content"],[1,"modal-header"],["id","information-modal-title",1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],[2,"font-size","75px",3,"class"],[1,"mb-3",3,"innerHTML"],[1,"mb-0",3,"innerHTML"],[1,"mb-0","mt-3",3,"innerHTML"],[1,"plugin-md",3,"data"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[2,"font-size","75px"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"fas","fa-external-link-alt"]],template:function(s,e){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),u(3),a(),i(4,"button",3),g(5,"translate"),b("click",function(){return e.dismissModal()}),a()(),i(6,"div",4),r(7,E,1,3,"i",5),r(8,z,1,1,"h5",6),m(9,"p",7),r(10,A,1,1,"p",8),r(11,V,1,1,"markdown",9),a(),i(12,"div",10)(13,"div",11),r(14,N,4,6,"button",12),a(),i(15,"div",13),r(16,F,4,6,"button",12),a(),i(17,"div",14),r(18,j,3,2,"a",15),a()()()),s&2&&(f("aria-labelledby","information-modal-title"),o(3),I(e.title),o(),f("aria-label",_(5,11,"form.button_close")),o(3),l(e.faIconClass?7:-1),o(),l(e.subtitle?8:-1),o(),p("innerHTML",e.message,C),o(),l(e.message2?10:-1),o(),l(e.markdownMessage2?11:-1),o(3),l(e.ctaButtonLink?14:-1),o(2),l(e.ctaButtonLink?-1:16),o(2),l(e.ctaButtonLink?18:-1))},dependencies:[S,D,H,T],styles:["[_nghost-%COMP%] .plugin-md{display:block!important;background-color:#f6f8fa!important;border-radius:6px!important;padding:16px!important;margin:16px auto!important;width:100%!important;max-width:632px!important}[_nghost-%COMP%] .plugin-md table{width:100%;max-width:600px;margin:0 auto!important;border-collapse:collapse;border:1px solid #d0d7de!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif!important;font-size:14px!important;color:#24292e!important}[_nghost-%COMP%] .plugin-md th, [_nghost-%COMP%] .plugin-md td{padding:6px 13px!important;border:1px solid #d0d7de!important;text-align:left;color:#24292e!important}[_nghost-%COMP%] .plugin-md th{background-color:#f6f8fa!important;font-weight:600!important;text-align:center!important}[_nghost-%COMP%] .plugin-md td[align=center]{text-align:center!important}[_nghost-%COMP%] .plugin-md tr{color:#24292e!important}[_nghost-%COMP%] .plugin-md tr:nth-child(odd){background-color:#fff!important}[_nghost-%COMP%] .plugin-md tr:nth-child(2n){background-color:#f6f8fa!important}[_nghost-%COMP%] .plugin-md tr:hover{background-color:#f0f2f5!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%]{background-color:#2b2b2b!important;color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] table[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#3c3c3c!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(odd){background-color:#323232!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#2b2b2b!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:#454545!important}"]})}return t})();export{Y as a};
1
+ import{b as D,c as S,d as H}from"./chunk-7XZWXKAH.js";import{b as B}from"./chunk-MIE7YXOK.js";import{m as L}from"./chunk-TJCUOGC4.js";import{D as T}from"./chunk-BHFVACUP.js";import{Ab as l,Dc as g,Ec as _,Fb as p,Gb as i,Hb as a,Ib as m,Rb as P,Ua as C,Va as k,Xb as b,Za as o,Zb as d,aa as h,ga as x,ha as O,jc as y,kc as u,lc as I,mc as M,nb as v,uc as w,yb as f,zb as r}from"./chunk-VX4RXOTH.js";function E(t,c){if(t&1&&m(0,"i",16),t&2){let n=d();y(w("fas ",n.faIconClass," mb-3"))}}function z(t,c){if(t&1&&m(0,"h5",6),t&2){let n=d();p("innerHTML",n.subtitle,C)}}function A(t,c){if(t&1&&m(0,"p",8),t&2){let n=d();p("innerHTML",n.message2,C)}}function V(t,c){if(t&1&&m(0,"markdown",9),t&2){let n=d();p("data",n.markdownMessage2)}}function N(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function F(t,c){if(t&1){let n=P();i(0,"button",17),g(1,"translate"),b("click",function(){x(n);let e=d();return O(e.dismissModal())}),u(2),g(3,"translate"),a()}t&2&&(f("aria-label",_(1,2,"form.button_close")),o(2),M(" ",_(3,4,"form.button_close")," "))}function j(t,c){if(t&1&&(i(0,"a",15),u(1),m(2,"i",18),a()),t&2){let n=d();p("href",n.ctaButtonLink,k),o(),M(" ",n.ctaButtonLabel," ")}}var Y=(()=>{class t{$activeModal=h(L);modalData=h(B);title=this.modalData.title;subtitle=this.modalData.subtitle;message=this.modalData.message;message2=this.modalData.markdownMessage2;ctaButtonLabel=this.modalData.ctaButtonLabel;ctaButtonLink=this.modalData.ctaButtonLink;faIconClass=this.modalData.faIconClass;markdownMessage2=this.modalData.markdownMessage2;dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=v({type:t,selectors:[["ng-component"]],decls:19,vars:13,consts:[["role","dialog","aria-modal","true",1,"modal-content"],[1,"modal-header"],["id","information-modal-title",1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],[2,"font-size","75px",3,"class"],[1,"mb-3",3,"innerHTML"],[1,"mb-0",3,"innerHTML"],[1,"mb-0","mt-3",3,"innerHTML"],[1,"plugin-md",3,"data"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["target","_blank","rel","noopener noreferrer",1,"btn","btn-primary","text-decoration-none",3,"href"],[2,"font-size","75px"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"fas","fa-external-link-alt"]],template:function(s,e){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),u(3),a(),i(4,"button",3),g(5,"translate"),b("click",function(){return e.dismissModal()}),a()(),i(6,"div",4),r(7,E,1,3,"i",5),r(8,z,1,1,"h5",6),m(9,"p",7),r(10,A,1,1,"p",8),r(11,V,1,1,"markdown",9),a(),i(12,"div",10)(13,"div",11),r(14,N,4,6,"button",12),a(),i(15,"div",13),r(16,F,4,6,"button",12),a(),i(17,"div",14),r(18,j,3,2,"a",15),a()()()),s&2&&(f("aria-labelledby","information-modal-title"),o(3),I(e.title),o(),f("aria-label",_(5,11,"form.button_close")),o(3),l(e.faIconClass?7:-1),o(),l(e.subtitle?8:-1),o(),p("innerHTML",e.message,C),o(),l(e.message2?10:-1),o(),l(e.markdownMessage2?11:-1),o(3),l(e.ctaButtonLink?14:-1),o(2),l(e.ctaButtonLink?-1:16),o(2),l(e.ctaButtonLink?18:-1))},dependencies:[S,D,H,T],styles:["[_nghost-%COMP%] .plugin-md{display:block!important;background-color:#f6f8fa!important;border-radius:6px!important;padding:16px!important;margin:16px auto!important;width:100%!important;max-width:632px!important}[_nghost-%COMP%] .plugin-md table{width:100%;max-width:600px;margin:0 auto!important;border-collapse:collapse;border:1px solid #d0d7de!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif!important;font-size:14px!important;color:#24292e!important}[_nghost-%COMP%] .plugin-md th, [_nghost-%COMP%] .plugin-md td{padding:6px 13px!important;border:1px solid #d0d7de!important;text-align:left;color:#24292e!important}[_nghost-%COMP%] .plugin-md th{background-color:#f6f8fa!important;font-weight:600!important;text-align:center!important}[_nghost-%COMP%] .plugin-md td[align=center]{text-align:center!important}[_nghost-%COMP%] .plugin-md tr{color:#24292e!important}[_nghost-%COMP%] .plugin-md tr:nth-child(odd){background-color:#fff!important}[_nghost-%COMP%] .plugin-md tr:nth-child(2n){background-color:#f6f8fa!important}[_nghost-%COMP%] .plugin-md tr:hover{background-color:#f0f2f5!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%]{background-color:#2b2b2b!important;color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] table[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%], [_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{color:#fff!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#3c3c3c!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(odd){background-color:#323232!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#2b2b2b!important}[_nghost-%COMP%] body.dark-mode[_ngcontent-%COMP%] .plugin-md[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:#454545!important}"]})}return t})();export{Y as a};
@@ -1 +1 @@
1
- import{b as pe}from"./chunk-CKURAGOR.js";import{J as le}from"./chunk-AWTSOXJ2.js";import{X as fe,aa as ue,c as he,d as X}from"./chunk-HUTYOGRH.js";import{f as We}from"./chunk-B4AJQJMI.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=(function(){let r=qe({xdomain:!1});return r&&r.responseType!==null})(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(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"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}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",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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){let 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 s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,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=e,this.nsp=t,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;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,s.socket.connected&&s.connected.next(void 0),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};
1
+ import{b as pe}from"./chunk-H4W6QAC2.js";import{H as le}from"./chunk-BHFVACUP.js";import{X as fe,aa as ue,c as he,d as X}from"./chunk-VX4RXOTH.js";import{f as We}from"./chunk-B4AJQJMI.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=(function(){let r=qe({xdomain:!1});return r&&r.responseType!==null})(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(this.opts.query)),se&&(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"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}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",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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){let 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 s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,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=e,this.nsp=t,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;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,s.socket.connected&&s.connected.next(void 0),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};