homebridge-config-ui-x 5.4.2-beta.2 → 5.4.2-beta.4

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 (113) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +8 -8
  3. package/public/3rdpartylicenses.txt +94 -68
  4. package/public/{chunk-HT7KLIKB.js → chunk-2ETJ2W67.js} +1 -1
  5. package/public/{chunk-QVCO7S7N.js → chunk-2IPYU27V.js} +1 -1
  6. package/public/{chunk-QX6BFGHZ.js → chunk-3DFE4GXY.js} +1 -1
  7. package/public/{chunk-ZAIVLZNZ.js → chunk-4IS25CEL.js} +1 -1
  8. package/public/{chunk-NHNGZ4PI.js → chunk-4ZMTZF3W.js} +1 -1
  9. package/public/{chunk-BO3HTTPA.js → chunk-5J7OMTCR.js} +1 -1
  10. package/public/{chunk-DFFTJVRY.js → chunk-5KFQUVTY.js} +1 -1
  11. package/public/chunk-5KZJLK3B.js +4 -0
  12. package/public/{chunk-KZKL7DGI.js → chunk-6FXNHKMA.js} +1 -1
  13. package/public/{chunk-5PN3M3TS.js → chunk-6MRWZBRB.js} +1 -1
  14. package/public/{chunk-H45DK7IX.js → chunk-6N2SOTOL.js} +1 -1
  15. package/public/{chunk-MHTCWHP3.js → chunk-A76CGVLE.js} +1 -1
  16. package/public/{chunk-WX32WZFA.js → chunk-ABEVAIAL.js} +1 -1
  17. package/public/{chunk-5VJLO72Y.js → chunk-ABOVGRBT.js} +1 -1
  18. package/public/{chunk-LXAXEGMX.js → chunk-AIKHSPDS.js} +1 -1
  19. package/public/{chunk-IWFKJHPR.js → chunk-BEYU5GMW.js} +1 -1
  20. package/public/{chunk-D7VCPH6W.js → chunk-CQKCDD3I.js} +1 -1
  21. package/public/{chunk-FCJZJIQL.js → chunk-CV5P3VHY.js} +1 -1
  22. package/public/{chunk-TR3AIWBS.js → chunk-D32NWYHS.js} +1 -1
  23. package/public/{chunk-2C3X2ESN.js → chunk-DD4UIDDU.js} +1 -1
  24. package/public/{chunk-WTDK2HE6.js → chunk-E5M5VUTV.js} +1 -1
  25. package/public/{chunk-SULJOYSB.js → chunk-EUPINTFY.js} +1 -1
  26. package/public/{chunk-WYMH5QZG.js → chunk-EUQRX7LQ.js} +1 -1
  27. package/public/{chunk-ZUTM7S4U.js → chunk-FVSVQWIM.js} +1 -1
  28. package/public/{chunk-FXJWZ2UF.js → chunk-G3CSSNW3.js} +1 -1
  29. package/public/{chunk-A5YMO7NI.js → chunk-H6CYTQYR.js} +1 -1
  30. package/public/{chunk-6E4QOLAB.js → chunk-JWSIULJX.js} +1 -1
  31. package/public/{chunk-TWIBESLE.js → chunk-LIIIEDKB.js} +1 -1
  32. package/public/{chunk-OYULLXTP.js → chunk-LOC52TG7.js} +1 -1
  33. package/public/{chunk-ZLYGOSRJ.js → chunk-M5HYAGSQ.js} +1 -1
  34. package/public/{chunk-BG7RRQGG.js → chunk-MCRAOLRB.js} +1 -1
  35. package/public/{chunk-CMOVUX6R.js → chunk-NFD7N6TO.js} +1 -1
  36. package/public/chunk-NRU4C4QO.js +1 -0
  37. package/public/{chunk-NDBMU5RD.js → chunk-NRVKNZMW.js} +1 -1
  38. package/public/{chunk-FG5GS755.js → chunk-NVSHJ7LK.js} +1 -1
  39. package/public/{chunk-GHMFFLJG.js → chunk-OIV4KXSV.js} +1 -1
  40. package/public/{chunk-J6CJ26QN.js → chunk-OPYWX2UT.js} +1 -1
  41. package/public/{chunk-HWAWBYVQ.js → chunk-OUS4RGQP.js} +1 -1
  42. package/public/{chunk-WCOLHYTR.js → chunk-P5LYIXY6.js} +1 -1
  43. package/public/{chunk-RHZTPEXE.js → chunk-PFU546XJ.js} +1 -1
  44. package/public/{chunk-FVKMBZOU.js → chunk-PMVD4FUJ.js} +1 -1
  45. package/public/{chunk-OA7Y3E5A.js → chunk-PP5MH7GY.js} +1 -1
  46. package/public/{chunk-G3JSRG2Q.js → chunk-QABGEKAZ.js} +1 -1
  47. package/public/{chunk-RZXCKXEZ.js → chunk-QBGF33DL.js} +1 -1
  48. package/public/{chunk-SL5FI37R.js → chunk-QK7Z3CEZ.js} +1 -1
  49. package/public/{chunk-H5WTK5UT.js → chunk-QNF5ENQG.js} +1 -1
  50. package/public/{chunk-QE27FJRU.js → chunk-RPTZSO5O.js} +1 -1
  51. package/public/{chunk-6CQ7JJUY.js → chunk-RT24VDZP.js} +1 -1
  52. package/public/{chunk-JL4UQXPL.js → chunk-S6BASE5W.js} +1 -1
  53. package/public/{chunk-PA5E2G2J.js → chunk-S6W546ZE.js} +1 -1
  54. package/public/chunk-SD2QP7RK.js +1 -0
  55. package/public/{chunk-7ZUAPFH6.js → chunk-SMCVOWDV.js} +1 -1
  56. package/public/{chunk-NORBG6QU.js → chunk-T3KHQZNL.js} +1 -1
  57. package/public/{chunk-CN4SGKOR.js → chunk-TG5OFUMM.js} +1 -1
  58. package/public/{chunk-FMHXNJHJ.js → chunk-U6ROY5ZN.js} +1 -1
  59. package/public/{chunk-R3KUMAWN.js → chunk-UNUGLKWP.js} +1 -1
  60. package/public/chunk-UT3VB4SC.js +49 -0
  61. package/public/{chunk-FSWVJTPN.js → chunk-VWR3K52A.js} +1 -1
  62. package/public/chunk-WBMAWHKA.js +12 -0
  63. package/public/{chunk-5E4D6S2D.js → chunk-WCMFALUQ.js} +1 -1
  64. package/public/chunk-WMIMAPZH.js +1 -0
  65. package/public/chunk-XEXJIDEI.js +4 -0
  66. package/public/{chunk-IOKYXV5M.js → chunk-XWYKEZQQ.js} +3 -3
  67. package/public/{chunk-Z2T4OZ7I.js → chunk-YERWTYFA.js} +1 -1
  68. package/public/chunk-YSZKQXWK.js +1 -0
  69. package/public/{chunk-X5YIKTO6.js → chunk-ZKETDQ54.js} +1 -1
  70. package/public/{chunk-V6JVOQNN.js → chunk-ZM5B4KXN.js} +1 -1
  71. package/public/{chunk-ZKQAULZM.js → chunk-ZNONDSJT.js} +1 -1
  72. package/public/{chunk-3POLSI6J.js → chunk-ZVJPMFYX.js} +1 -1
  73. package/public/index.html +1 -1
  74. package/public/main-MRP2WE3O.js +1 -0
  75. package/public/assets/service-icons/air-purifier.svg +0 -50
  76. package/public/assets/service-icons/air-quality-sensor.svg +0 -30
  77. package/public/assets/service-icons/carbon-dioxide-sensor.svg +0 -53
  78. package/public/assets/service-icons/carbon-monoxide-sensor.svg +0 -53
  79. package/public/assets/service-icons/contact-sensor.svg +0 -45
  80. package/public/assets/service-icons/door.svg +0 -49
  81. package/public/assets/service-icons/doorbell.svg +0 -7
  82. package/public/assets/service-icons/fan.svg +0 -15
  83. package/public/assets/service-icons/filter-maintenance.svg +0 -54
  84. package/public/assets/service-icons/garage-door.svg +0 -120
  85. package/public/assets/service-icons/irrigation-system.svg +0 -34
  86. package/public/assets/service-icons/leak-sensor.svg +0 -42
  87. package/public/assets/service-icons/light-sensor.svg +0 -34
  88. package/public/assets/service-icons/lock-mechanism.svg +0 -39
  89. package/public/assets/service-icons/microphone.svg +0 -12
  90. package/public/assets/service-icons/motion-sensor.svg +0 -84
  91. package/public/assets/service-icons/occupancy-sensor.svg +0 -49
  92. package/public/assets/service-icons/robot-vacuum.svg +0 -76
  93. package/public/assets/service-icons/security-system.svg +0 -19
  94. package/public/assets/service-icons/smoke-sensor.svg +0 -38
  95. package/public/assets/service-icons/speaker.svg +0 -28
  96. package/public/assets/service-icons/stateless-programmable-switch.svg +0 -18
  97. package/public/assets/service-icons/television.svg +0 -17
  98. package/public/assets/service-icons/valve-faucet.svg +0 -22
  99. package/public/assets/service-icons/valve-generic.svg +0 -25
  100. package/public/assets/service-icons/valve-irrigation.svg +0 -34
  101. package/public/assets/service-icons/valve-shower-head.svg +0 -32
  102. package/public/assets/service-icons/washing-machine.svg +0 -34
  103. package/public/assets/service-icons/window-covering.svg +0 -44
  104. package/public/assets/service-icons/window.svg +0 -71
  105. package/public/chunk-2H6KO42L.js +0 -1
  106. package/public/chunk-3M6IUC74.js +0 -1
  107. package/public/chunk-7EQFLCW4.js +0 -1
  108. package/public/chunk-BEPC7IPQ.js +0 -23
  109. package/public/chunk-FUTRU3DJ.js +0 -4
  110. package/public/chunk-JFPT3QXX.js +0 -30
  111. package/public/chunk-LDCR6K2U.js +0 -12
  112. package/public/chunk-Q3EG5UQP.js +0 -1
  113. package/public/main-ILQAVUPM.js +0 -1
package/CHANGELOG.md CHANGED
@@ -10,12 +10,17 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
10
10
  - refreshed icons: lock mechanism
11
11
  - refreshed icons: irrigation system + valves
12
12
  - refreshed icons: light, leak, motion, occ. sensor
13
+ - Expand/Collapse state saving for Update Information - Docker Information #2529
13
14
 
14
15
  ### Other Changes
15
16
 
16
17
  - update `@homebridge/node-pty-prebuilt-multiarch` to `v0.14-beta`
17
18
  - fix saving custom attributes for ui layouts
18
19
 
20
+ ### Other Changes
21
+
22
+ - fix saving custom attributes for ui layouts
23
+
19
24
  ### Homebridge Dependencies
20
25
 
21
26
  - `@homebridge/hap-client` @ `v3.1.1`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-config-ui-x",
3
3
  "displayName": "Homebridge UI",
4
- "version": "5.4.2-beta.2",
4
+ "version": "5.4.2-beta.4",
5
5
  "description": "A web based management, configuration and control platform for Homebridge.",
6
6
  "author": "oznu <dev@oz.nu>",
7
7
  "license": "MIT",
@@ -84,14 +84,14 @@
84
84
  "@homebridge/hap-client": "3.1.1",
85
85
  "@homebridge/node-pty-prebuilt-multiarch": "0.14.1-beta.1",
86
86
  "@nestjs/axios": "4.0.1",
87
- "@nestjs/common": "11.1.5",
88
- "@nestjs/core": "11.1.5",
87
+ "@nestjs/common": "11.1.6",
88
+ "@nestjs/core": "11.1.6",
89
89
  "@nestjs/jwt": "11.0.0",
90
90
  "@nestjs/passport": "11.0.5",
91
- "@nestjs/platform-fastify": "11.1.5",
92
- "@nestjs/platform-socket.io": "11.1.5",
91
+ "@nestjs/platform-fastify": "11.1.6",
92
+ "@nestjs/platform-socket.io": "11.1.6",
93
93
  "@nestjs/swagger": "11.2.0",
94
- "@nestjs/websockets": "11.1.5",
94
+ "@nestjs/websockets": "11.1.6",
95
95
  "axios": "1.11.0",
96
96
  "bash-color": "0.0.4",
97
97
  "class-transformer": "0.5.1",
@@ -120,11 +120,11 @@
120
120
  },
121
121
  "devDependencies": {
122
122
  "@antfu/eslint-config": "^5.2.0",
123
- "@nestjs/testing": "^11.1.5",
123
+ "@nestjs/testing": "^11.1.6",
124
124
  "@prettier/plugin-xml": "^3.4.2",
125
125
  "@types/fs-extra": "^11.0.4",
126
126
  "@types/lodash": "^4.17.20",
127
- "@types/node": "^24.2.0",
127
+ "@types/node": "^24.2.1",
128
128
  "@types/node-schedule": "^2.1.8",
129
129
  "@types/passport-jwt": "^4.0.1",
130
130
  "@types/semver": "^7.7.0",
@@ -77,58 +77,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77
77
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
78
78
  THE SOFTWARE.
79
79
 
80
- --------------------------------------------------------------------------------
81
- Package: lodash
82
- License: "MIT"
83
-
84
- Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
85
-
86
- Based on Underscore.js, copyright Jeremy Ashkenas,
87
- DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
88
-
89
- This software consists of voluntary contributions made by many
90
- individuals. For exact contribution history, see the revision history
91
- available at https://github.com/lodash/lodash
92
-
93
- The following license applies to all parts of this software except as
94
- documented below:
95
-
96
- ====
97
-
98
- Permission is hereby granted, free of charge, to any person obtaining
99
- a copy of this software and associated documentation files (the
100
- "Software"), to deal in the Software without restriction, including
101
- without limitation the rights to use, copy, modify, merge, publish,
102
- distribute, sublicense, and/or sell copies of the Software, and to
103
- permit persons to whom the Software is furnished to do so, subject to
104
- the following conditions:
105
-
106
- The above copyright notice and this permission notice shall be
107
- included in all copies or substantial portions of the Software.
108
-
109
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
110
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
111
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
112
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
113
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
114
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
115
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
116
-
117
- ====
118
-
119
- Copyright and related rights for sample code are waived via CC0. Sample
120
- code is defined as all source code displayed within the prose of the
121
- documentation.
122
-
123
- CC0: http://creativecommons.org/publicdomain/zero/1.0/
124
-
125
- ====
126
-
127
- Files located in the node_modules and vendor directories are externally
128
- maintained libraries used by this software which have their own
129
- licenses; we recommend you read them, as their terms may differ from the
130
- terms above.
131
-
132
80
  --------------------------------------------------------------------------------
133
81
  Package: @ng-formworks/cssframework
134
82
  License: "MIT"
@@ -234,12 +182,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
234
182
  SOFTWARE.
235
183
 
236
184
  --------------------------------------------------------------------------------
237
- Package: ng-inline-svg-2
185
+ Package: nouislider
238
186
  License: "MIT"
239
187
 
240
- The MIT License (MIT)
188
+ MIT License
241
189
 
242
- Copyright (c) 2016 Eugene Cheung
190
+ Copyright (c) 2019 Léon Gersen
243
191
 
244
192
  Permission is hereby granted, free of charge, to any person obtaining a copy
245
193
  of this software and associated documentation files (the "Software"), to deal
@@ -248,24 +196,24 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
248
196
  copies of the Software, and to permit persons to whom the Software is
249
197
  furnished to do so, subject to the following conditions:
250
198
 
251
- The above copyright notice and this permission notice shall be included in
252
- all copies or substantial portions of the Software.
199
+ The above copyright notice and this permission notice shall be included in all
200
+ copies or substantial portions of the Software.
253
201
 
254
202
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
255
203
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
256
204
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
257
205
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
258
206
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
259
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
260
- THE SOFTWARE.
207
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
208
+ SOFTWARE.
261
209
 
262
210
  --------------------------------------------------------------------------------
263
- Package: nouislider
211
+ Package: ng2-nouislider
264
212
  License: "MIT"
265
213
 
266
214
  MIT License
267
215
 
268
- Copyright (c) 2019 Léon Gersen
216
+ Copyright (c) 2017-2019 Tomasz Bak https://www.tomaszbak.com/
269
217
 
270
218
  Permission is hereby granted, free of charge, to any person obtaining a copy
271
219
  of this software and associated documentation files (the "Software"), to deal
@@ -286,12 +234,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
286
234
  SOFTWARE.
287
235
 
288
236
  --------------------------------------------------------------------------------
289
- Package: ng2-nouislider
237
+ Package: ng-inline-svg-2
290
238
  License: "MIT"
291
239
 
292
- MIT License
240
+ The MIT License (MIT)
293
241
 
294
- Copyright (c) 2017-2019 Tomasz Bak https://www.tomaszbak.com/
242
+ Copyright (c) 2016 Eugene Cheung
295
243
 
296
244
  Permission is hereby granted, free of charge, to any person obtaining a copy
297
245
  of this software and associated documentation files (the "Software"), to deal
@@ -300,16 +248,16 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
300
248
  copies of the Software, and to permit persons to whom the Software is
301
249
  furnished to do so, subject to the following conditions:
302
250
 
303
- The above copyright notice and this permission notice shall be included in all
304
- copies or substantial portions of the Software.
251
+ The above copyright notice and this permission notice shall be included in
252
+ all copies or substantial portions of the Software.
305
253
 
306
254
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
307
255
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
308
256
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
309
257
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
310
258
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
311
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
312
- SOFTWARE.
259
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
260
+ THE SOFTWARE.
313
261
 
314
262
  --------------------------------------------------------------------------------
315
263
  Package: @kurkle/color
@@ -488,6 +436,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
488
436
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
489
437
  SOFTWARE.
490
438
 
439
+ --------------------------------------------------------------------------------
440
+ Package: ajv-formats
441
+ License: "MIT"
442
+
443
+ MIT License
444
+
445
+ Copyright (c) 2020 Evgeny Poberezkin
446
+
447
+ Permission is hereby granted, free of charge, to any person obtaining a copy
448
+ of this software and associated documentation files (the "Software"), to deal
449
+ in the Software without restriction, including without limitation the rights
450
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
451
+ copies of the Software, and to permit persons to whom the Software is
452
+ furnished to do so, subject to the following conditions:
453
+
454
+ The above copyright notice and this permission notice shall be included in all
455
+ copies or substantial portions of the Software.
456
+
457
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
458
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
459
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
460
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
461
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
462
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
463
+ SOFTWARE.
464
+
491
465
  --------------------------------------------------------------------------------
492
466
  Package: ajv
493
467
  License: "MIT"
@@ -601,6 +575,58 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
601
575
 
602
576
  The complete list of contributors can be found at:
603
577
  - https://github.com/garycourt/uri-js/graphs/contributors
578
+ --------------------------------------------------------------------------------
579
+ Package: lodash
580
+ License: "MIT"
581
+
582
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
583
+
584
+ Based on Underscore.js, copyright Jeremy Ashkenas,
585
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
586
+
587
+ This software consists of voluntary contributions made by many
588
+ individuals. For exact contribution history, see the revision history
589
+ available at https://github.com/lodash/lodash
590
+
591
+ The following license applies to all parts of this software except as
592
+ documented below:
593
+
594
+ ====
595
+
596
+ Permission is hereby granted, free of charge, to any person obtaining
597
+ a copy of this software and associated documentation files (the
598
+ "Software"), to deal in the Software without restriction, including
599
+ without limitation the rights to use, copy, modify, merge, publish,
600
+ distribute, sublicense, and/or sell copies of the Software, and to
601
+ permit persons to whom the Software is furnished to do so, subject to
602
+ the following conditions:
603
+
604
+ The above copyright notice and this permission notice shall be
605
+ included in all copies or substantial portions of the Software.
606
+
607
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
608
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
609
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
610
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
611
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
612
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
613
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
614
+
615
+ ====
616
+
617
+ Copyright and related rights for sample code are waived via CC0. Sample
618
+ code is defined as all source code displayed within the prose of the
619
+ documentation.
620
+
621
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
622
+
623
+ ====
624
+
625
+ Files located in the node_modules and vendor directories are externally
626
+ maintained libraries used by this software which have their own
627
+ licenses; we recommend you read them, as their terms may differ from the
628
+ terms above.
629
+
604
630
  --------------------------------------------------------------------------------
605
631
  Package: ajv-keywords
606
632
  License: "MIT"
@@ -1 +1 @@
1
- import{k as et,n as it}from"./chunk-5PN3M3TS.js";import{a as tt}from"./chunk-KZKL7DGI.js";import{m as X}from"./chunk-OA7Y3E5A.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-IOKYXV5M.js";var st=ut((J,K)=>{(function(w,D){typeof J=="object"&&typeof K<"u"?K.exports=D():typeof define=="function"&&define.amd?define(D):(w=typeof globalThis<"u"?globalThis:w||self).dayjs=D()})(J,function(){"use strict";var w=1e3,D=6e4,n=36e5,h="millisecond",d="second",m="minute",M="hour",y="day",f="week",b="month",E="quarter",S="year",x="date",Z="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ot={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},F=function(r,i,t){var s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},at={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(s,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,b),o=t-e<0,a=i.clone().add(s+(o?-1:1),b);return+(-(s+(t-e)/(o?e-a:a-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:b,y:S,w:f,d:y,D:x,h:M,m,s:d,ms:h,Q:E}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",T={};T[A]=ot;var z="$isDayjsObject",U=function(r){return r instanceof V||!(!r||!r[z])},C=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var o=i.toLowerCase();T[o]&&(e=o),t&&(T[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;T[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},g=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new V(t)},u=at;u.l=C,u.i=U,u.w=function(r,i){return g(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var V=function(){function r(t){this.$L=C(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[z]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,o=s.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(nt);if(a){var c=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==Z},i.isSame=function(t,s){var e=g(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return g(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<g(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,o=!!u.u(s)||s,a=u.p(t),c=function(_,v){var k=u.w(e.$u?Date.UTC(e.$y,v,_):new Date(e.$y,v,_),e);return o?k:k.endOf(y)},l=function(_,v){return u.w(e.toDate()[_].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(v)),e)},$=this.$W,p=this.$M,L=this.$D,j="set"+(this.$u?"UTC":"");switch(a){case S:return o?c(1,0):c(31,11);case b:return o?c(1,p):c(0,p+1);case f:var O=this.$locale().weekStart||0,H=($<O?$+7:$)-O;return c(o?L-H:L+(6-H),p);case y:case x:return l(j+"Hours",0);case M:return l(j+"Minutes",1);case m:return l(j+"Seconds",2);case d:return l(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[y]=a+"Date",e[x]=a+"Date",e[b]=a+"Month",e[S]=a+"FullYear",e[M]=a+"Hours",e[m]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],l=o===y?this.$D+(s-this.$W):s;if(o===b||o===S){var $=this.clone().set(x,1);$.$d[c](l),$.init(),this.$d=$.set(x,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](l);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,o=this;t=Number(t);var a=u.p(s),c=function(p){var L=g(o);return u.w(L.date(L.date()+Math.round(p*t)),o)};if(a===b)return this.set(b,this.$M+t);if(a===S)return this.set(S,this.$y+t);if(a===y)return c(1);if(a===f)return c(7);var l=(e={},e[m]=D,e[M]=n,e[d]=w,e)[a]||1,$=this.$d.getTime()+t*l;return u.w($,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||Z;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,l=this.$m,$=this.$M,p=e.weekdays,L=e.months,j=e.meridiem,O=function(v,k,I,W){return v&&(v[k]||v(s,o))||I[k].slice(0,W)},H=function(v){return u.s(c%12||12,v,"0")},_=j||function(v,k,I){var W=v<12?"AM":"PM";return I?W.toLowerCase():W};return o.replace(rt,function(v,k){return k||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return $+1;case"MM":return u.s($+1,2,"0");case"MMM":return O(e.monthsShort,$,L,3);case"MMMM":return O(L,$);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,p,2);case"ddd":return O(e.weekdaysShort,s.$W,p,3);case"dddd":return p[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,l,!0);case"A":return _(c,l,!1);case"m":return String(l);case"mm":return u.s(l,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$ms,3,"0");case"Z":return a}return null}(v)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,s,e){var o,a=this,c=u.p(s),l=g(t),$=(l.utcOffset()-this.utcOffset())*D,p=this-l,L=function(){return u.m(a,l)};switch(c){case S:o=L()/12;break;case b:o=L();break;case E:o=L()/3;break;case f:o=(p-$)/6048e5;break;case y:o=(p-$)/864e5;break;case M:o=p/n;break;case m:o=p/D;break;case d:o=p/w;break;default:o=p}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(b).$D},i.$locale=function(){return T[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),o=C(t,s,!0);return o&&(e.$L=o),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r}(),B=V.prototype;return g.prototype=B,[["$ms",h],["$s",d],["$m",m],["$H",M],["$W",y],["$M",b],["$y",S],["$D",x]].forEach(function(r){B[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),g.extend=function(r,i){return r.$i||(r(i,V,g),r.$i=!0),g},g.locale=C,g.isDayjs=U,g.unix=function(r){return g(1e3*r)},g.en=T[A],g.Ls=T,g.p={},g})});var q=ct(st(),1);var vt=(()=>{class w{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;keepOrphans;wallpaper;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return P(this,null,function*(){let n=yield N(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setKeepOrphans(n.keepOrphans),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(m=>console.error("Error saving setTheme:",m)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=n,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((m,M)=>{try{let y=m.contentDocument;if(y){let f=y.body;this.actualLightingMode==="dark"?(f.classList.contains(`config-ui-x-${this.theme}`)&&f.classList.remove(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)||f.classList.add(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")||f.classList.add("dark-mode"),f.style.backgroundColor="#242424 !important",f.style.color="#ffffff !important"):(f.classList.contains(`config-ui-x-${this.theme}`)||f.classList.add(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)&&f.classList.remove(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")&&f.classList.remove("dark-mode"),f.style.backgroundColor="#ffffff !important",f.style.color="#000000 !important"),m.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(y){console.warn(`Iframe ${M}: Access denied (cross-origin?)`,{error:y,src:m.src})}})}setMenuMode(n){this.menuMode=n}setKeepOrphans(n){this.keepOrphans=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),m=this.env;for(let M=0;M<d.length-1;M++){if(this.forbiddenKeys.includes(d[M]))return;m[d[M]]||(m[d[M]]={}),m=m[d[M]]}this.forbiddenKeys.includes(d[d.length-1])||(m[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,q.default)(n).diff((0,q.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||w)};static \u0275prov=R({token:w,factory:w.\u0275fac,providedIn:"root"})}return w})();export{st as a,vt as b};
1
+ import{k as et,n as it}from"./chunk-6MRWZBRB.js";import{a as tt}from"./chunk-6FXNHKMA.js";import{m as X}from"./chunk-PP5MH7GY.js";import{T as G,e as ut,g as ct,ga as R,h as P,la as Y,n as Q,w as N}from"./chunk-XWYKEZQQ.js";var st=ut((J,K)=>{(function(w,D){typeof J=="object"&&typeof K<"u"?K.exports=D():typeof define=="function"&&define.amd?define(D):(w=typeof globalThis<"u"?globalThis:w||self).dayjs=D()})(J,function(){"use strict";var w=1e3,D=6e4,n=36e5,h="millisecond",d="second",m="minute",M="hour",y="day",f="week",b="month",E="quarter",S="year",x="date",Z="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ot={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(r){var i=["th","st","nd","rd"],t=r%100;return"["+r+(i[(t-20)%10]||i[t]||i[0])+"]"}},F=function(r,i,t){var s=String(r);return!s||s.length>=i?r:""+Array(i+1-s.length).join(t)+r},at={s:F,z:function(r){var i=-r.utcOffset(),t=Math.abs(i),s=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+F(s,2,"0")+":"+F(e,2,"0")},m:function r(i,t){if(i.date()<t.date())return-r(t,i);var s=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(s,b),o=t-e<0,a=i.clone().add(s+(o?-1:1),b);return+(-(s+(t-e)/(o?e-a:a-e))||0)},a:function(r){return r<0?Math.ceil(r)||0:Math.floor(r)},p:function(r){return{M:b,y:S,w:f,d:y,D:x,h:M,m,s:d,ms:h,Q:E}[r]||String(r||"").toLowerCase().replace(/s$/,"")},u:function(r){return r===void 0}},A="en",T={};T[A]=ot;var z="$isDayjsObject",U=function(r){return r instanceof V||!(!r||!r[z])},C=function r(i,t,s){var e;if(!i)return A;if(typeof i=="string"){var o=i.toLowerCase();T[o]&&(e=o),t&&(T[o]=t,e=o);var a=i.split("-");if(!e&&a.length>1)return r(a[0])}else{var c=i.name;T[c]=i,e=c}return!s&&e&&(A=e),e||!s&&A},g=function(r,i){if(U(r))return r.clone();var t=typeof i=="object"?i:{};return t.date=r,t.args=arguments,new V(t)},u=at;u.l=C,u.i=U,u.w=function(r,i){return g(r,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var V=function(){function r(t){this.$L=C(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[z]=!0}var i=r.prototype;return i.parse=function(t){this.$d=function(s){var e=s.date,o=s.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(nt);if(a){var c=a[2]-1||0,l=(a[7]||"0").substring(0,3);return o?new Date(Date.UTC(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)):new Date(a[1],c,a[3]||1,a[4]||0,a[5]||0,a[6]||0,l)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return u},i.isValid=function(){return this.$d.toString()!==Z},i.isSame=function(t,s){var e=g(t);return this.startOf(s)<=e&&e<=this.endOf(s)},i.isAfter=function(t,s){return g(t)<this.startOf(s)},i.isBefore=function(t,s){return this.endOf(s)<g(t)},i.$g=function(t,s,e){return u.u(t)?this[s]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,s){var e=this,o=!!u.u(s)||s,a=u.p(t),c=function(_,v){var k=u.w(e.$u?Date.UTC(e.$y,v,_):new Date(e.$y,v,_),e);return o?k:k.endOf(y)},l=function(_,v){return u.w(e.toDate()[_].apply(e.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(v)),e)},$=this.$W,p=this.$M,L=this.$D,j="set"+(this.$u?"UTC":"");switch(a){case S:return o?c(1,0):c(31,11);case b:return o?c(1,p):c(0,p+1);case f:var O=this.$locale().weekStart||0,H=($<O?$+7:$)-O;return c(o?L-H:L+(6-H),p);case y:case x:return l(j+"Hours",0);case M:return l(j+"Minutes",1);case m:return l(j+"Seconds",2);case d:return l(j+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,s){var e,o=u.p(t),a="set"+(this.$u?"UTC":""),c=(e={},e[y]=a+"Date",e[x]=a+"Date",e[b]=a+"Month",e[S]=a+"FullYear",e[M]=a+"Hours",e[m]=a+"Minutes",e[d]=a+"Seconds",e[h]=a+"Milliseconds",e)[o],l=o===y?this.$D+(s-this.$W):s;if(o===b||o===S){var $=this.clone().set(x,1);$.$d[c](l),$.init(),this.$d=$.set(x,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](l);return this.init(),this},i.set=function(t,s){return this.clone().$set(t,s)},i.get=function(t){return this[u.p(t)]()},i.add=function(t,s){var e,o=this;t=Number(t);var a=u.p(s),c=function(p){var L=g(o);return u.w(L.date(L.date()+Math.round(p*t)),o)};if(a===b)return this.set(b,this.$M+t);if(a===S)return this.set(S,this.$y+t);if(a===y)return c(1);if(a===f)return c(7);var l=(e={},e[m]=D,e[M]=n,e[d]=w,e)[a]||1,$=this.$d.getTime()+t*l;return u.w($,this)},i.subtract=function(t,s){return this.add(-1*t,s)},i.format=function(t){var s=this,e=this.$locale();if(!this.isValid())return e.invalidDate||Z;var o=t||"YYYY-MM-DDTHH:mm:ssZ",a=u.z(this),c=this.$H,l=this.$m,$=this.$M,p=e.weekdays,L=e.months,j=e.meridiem,O=function(v,k,I,W){return v&&(v[k]||v(s,o))||I[k].slice(0,W)},H=function(v){return u.s(c%12||12,v,"0")},_=j||function(v,k,I){var W=v<12?"AM":"PM";return I?W.toLowerCase():W};return o.replace(rt,function(v,k){return k||function(I){switch(I){case"YY":return String(s.$y).slice(-2);case"YYYY":return u.s(s.$y,4,"0");case"M":return $+1;case"MM":return u.s($+1,2,"0");case"MMM":return O(e.monthsShort,$,L,3);case"MMMM":return O(L,$);case"D":return s.$D;case"DD":return u.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return O(e.weekdaysMin,s.$W,p,2);case"ddd":return O(e.weekdaysShort,s.$W,p,3);case"dddd":return p[s.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return _(c,l,!0);case"A":return _(c,l,!1);case"m":return String(l);case"mm":return u.s(l,2,"0");case"s":return String(s.$s);case"ss":return u.s(s.$s,2,"0");case"SSS":return u.s(s.$ms,3,"0");case"Z":return a}return null}(v)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,s,e){var o,a=this,c=u.p(s),l=g(t),$=(l.utcOffset()-this.utcOffset())*D,p=this-l,L=function(){return u.m(a,l)};switch(c){case S:o=L()/12;break;case b:o=L();break;case E:o=L()/3;break;case f:o=(p-$)/6048e5;break;case y:o=(p-$)/864e5;break;case M:o=p/n;break;case m:o=p/D;break;case d:o=p/w;break;default:o=p}return e?o:u.a(o)},i.daysInMonth=function(){return this.endOf(b).$D},i.$locale=function(){return T[this.$L]},i.locale=function(t,s){if(!t)return this.$L;var e=this.clone(),o=C(t,s,!0);return o&&(e.$L=o),e},i.clone=function(){return u.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},r}(),B=V.prototype;return g.prototype=B,[["$ms",h],["$s",d],["$m",m],["$H",M],["$W",y],["$M",b],["$y",S],["$D",x]].forEach(function(r){B[r[1]]=function(i){return this.$g(i,r[0],r[1])}}),g.extend=function(r,i){return r.$i||(r(i,V,g),r.$i=!0),g},g.locale=C,g.isDayjs=U,g.unix=function(r){return g(1e3*r)},g.en=T[A],g.Ls=T,g.p={},g})});var q=ct(st(),1);var vt=(()=>{class w{$api=Y(it);$title=Y(X);$toastr=Y(et);$translate=Y(tt);settingsLoadedSubject=new Q;defaultTheme="deep-purple";forbiddenKeys=["__proto__","constructor","prototype"];env={};formAuth=!0;sessionTimeout=28800;uiVersion;theme;lightingMode;currentLightingMode;actualLightingMode;browserLightingMode;menuMode;keepOrphans;wallpaper;serverTimeOffset=0;rtl=!1;onSettingsLoaded=this.settingsLoadedSubject.pipe(G());settingsLoaded=!1;themeList=["orange","red","pink","purple","deep-purple","indigo","blue","blue-grey","cyan","green","teal","grey","brown"];constructor(){this.getAppSettings()}getAppSettings(){return P(this,null,function*(){let n=yield N(this.$api.get("/auth/settings"));this.formAuth=n.formAuth,this.sessionTimeout=n.sessionTimeout,this.env=n.env,this.lightingMode=n.lightingMode,this.wallpaper=n.wallpaper,this.setLightingMode(this.lightingMode,"user"),this.setTheme(n.theme),this.setMenuMode(n.menuMode),this.setKeepOrphans(n.keepOrphans),this.setTitle(this.env.homebridgeInstanceName),this.checkServerTime(n.serverTimestamp),this.setUiVersion(n.env.packageVersion),this.setLang(this.env.lang),this.settingsLoaded=!0,this.settingsLoadedSubject.next(void 0)})}setBrowserLightingMode(n){this.browserLightingMode=n,this.lightingMode==="auto"&&this.setLightingMode(n,"browser")}setLightingMode(n,h){h==="user"&&(this.lightingMode=n),this.currentLightingMode=n,this.actualLightingMode=this.currentLightingMode==="auto"?this.browserLightingMode:this.currentLightingMode,this.theme&&this.setTheme(this.theme)}setTheme(n){(!n||!this.themeList.includes(n))&&(n=this.defaultTheme,N(this.$api.put("/config-editor/ui",{key:"theme",value:n})).catch(m=>console.error("Error saving setTheme:",m)));let h=window.document.querySelector("body");h.classList.remove(`config-ui-x-${this.theme}`),h.classList.remove(`config-ui-x-dark-mode-${this.theme}`),this.theme=n,this.actualLightingMode==="dark"?(h.classList.add(`config-ui-x-dark-mode-${this.theme}`),h.classList.contains("dark-mode")||h.classList.add("dark-mode")):(h.classList.add(`config-ui-x-${this.theme}`),h.classList.contains("dark-mode")&&h.classList.remove("dark-mode")),window.document.querySelectorAll("iframe").forEach((m,M)=>{try{let y=m.contentDocument;if(y){let f=y.body;this.actualLightingMode==="dark"?(f.classList.contains(`config-ui-x-${this.theme}`)&&f.classList.remove(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)||f.classList.add(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")||f.classList.add("dark-mode"),f.style.backgroundColor="#242424 !important",f.style.color="#ffffff !important"):(f.classList.contains(`config-ui-x-${this.theme}`)||f.classList.add(`config-ui-x-${this.theme}`),f.classList.contains(`config-ui-x-dark-mode-${this.theme}`)&&f.classList.remove(`config-ui-x-dark-mode-${this.theme}`),f.classList.contains("dark-mode")&&f.classList.remove("dark-mode"),f.style.backgroundColor="#ffffff !important",f.style.color="#000000 !important"),m.contentWindow.postMessage({type:"theme-update",isDark:this.actualLightingMode==="dark",theme:n},window.location.origin)}}catch(y){console.warn(`Iframe ${M}: Access denied (cross-origin?)`,{error:y,src:m.src})}})}setMenuMode(n){this.menuMode=n}setKeepOrphans(n){this.keepOrphans=n}setLang(n){n?this.$translate.use(n):n="auto",this.env.lang=n}setItem(n,h){this[n]=h}setEnvItem(n,h){if(n.includes(".")){let d=n.split("."),m=this.env;for(let M=0;M<d.length-1;M++){if(this.forbiddenKeys.includes(d[M]))return;m[d[M]]||(m[d[M]]={}),m=m[d[M]]}this.forbiddenKeys.includes(d[d.length-1])||(m[d[d.length-1]]=h)}else this.env[n]=h}checkServerTime(n){let d=(0,q.default)(n).diff((0,q.default)(),"hour");this.serverTimeOffset=d*60*60,(d>=8||d<=-8)&&this.$toastr.warning(this.$translate.instant("settings.datetime.incorrect"),this.$translate.instant("toast.title_warning"),{timeOut:2e4,tapToDismiss:!1}).onTap.subscribe(()=>{window.open("https://homebridge.io/w/JqTFs","_blank")})}setUiVersion(n){this.uiVersion||(this.uiVersion=n)}setTitle(n){this.$title.setTitle(n||"Homebridge")}static \u0275fac=function(h){return new(h||w)};static \u0275prov=R({token:w,factory:w.\u0275fac,providedIn:"root"})}return w})();export{st as a,vt as b};
@@ -1,4 +1,4 @@
1
- import{a as we}from"./chunk-QX6BFGHZ.js";import{b as A,e as ye,f as Ce,g as Re}from"./chunk-NDBMU5RD.js";import{a as fe,b as he}from"./chunk-2C3X2ESN.js";import{a as _e}from"./chunk-D7VCPH6W.js";import{a as De}from"./chunk-H5WTK5UT.js";import{m as pe,n as ge,t as D}from"./chunk-IWFKJHPR.js";import{A as me,c as se,e as le,l as de,z as ce}from"./chunk-7EQFLCW4.js";import{b as ue,d as j}from"./chunk-DFFTJVRY.js";import{b as be}from"./chunk-HT7KLIKB.js";import{k as I,n as H}from"./chunk-5PN3M3TS.js";import{a as R,b as P}from"./chunk-KZKL7DGI.js";import"./chunk-OA7Y3E5A.js";import{Ec as z,Hb as C,Ib as w,Jb as v,Jc as s,Kc as d,Lb as Z,Lc as K,Mb as ee,Nb as te,Ob as f,Pb as a,Qb as l,Rb as p,_b as x,ab as r,bc as b,d as G,dc as m,fb as X,g as Q,h as E,kd as re,la as g,mb as B,qc as _,ra as h,rc as k,rd as ae,sa as u,sc as M,w as $,xc as ie,yc as oe,zc as ne}from"./chunk-IOKYXV5M.js";var ke=Q(Re(),1);var ve=Q(De(),1);var Ee=(n,y)=>({"fa-trash":n,"fa-cog fa-spin":y});function Ie(n,y){n&1&&(a(0,"div",13),p(1,"i",20),l())}function je(n,y){if(n&1){let e=x();a(0,"li",9)(1,"span"),_(2),s(3,"date"),p(4,"br"),a(5,"span",21),_(6),s(7,"date"),l()(),a(8,"span",22)(9,"button",25),s(10,"translate"),s(11,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.restore(i.id))}),p(12,"i",26),l(),a(13,"button",27),s(14,"translate"),s(15,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.download(i.id))}),p(16,"i",28),l(),a(17,"button",23),s(18,"translate"),s(19,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.delete(i.id))}),p(20,"i",24),l()()()}if(n&2){let e=y.$implicit,t=m(2);r(2),M(" ",K(3,15,e.timestamp,"mediumDate")),r(4),k(K(7,18,e.timestamp,"shortTime")),r(3),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(10,21,"config.restore.copy_to_editor"))("openDelay",150),C("aria-label",d(11,23,"config.restore.copy_to_editor")),r(4),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(14,25,"form.button_download"))("openDelay",150),C("aria-label",d(15,27,"form.button_download")),r(4),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(18,29,"form.button_delete"))("openDelay",150),C("aria-label",d(19,31,"form.button_delete")),r(3),f("ngClass",z(33,Ee,e.id!==t.deleting,e.id===t.deleting))}}function He(n,y){if(n&1){let e=x();a(0,"ul",14),ee(1,je,21,36,"li",9,Z),a(3,"li",9)(4,"span"),_(5),s(6,"translate"),p(7,"br"),a(8,"span",21),_(9),s(10,"translate"),l()(),a(11,"span",22)(12,"button",23),s(13,"translate"),s(14,"translate"),b("click",function(){h(e);let i=m();return u(i.deleteAllBackups())}),p(15,"i",24),l()()()()}if(n&2){let e=m();r(),te(e.backupList),r(4),M(" ",d(6,7,"form.button_delete_all")),r(4),M(" ",d(10,9,"common.labels.no_confirmation")," "),r(3),f("disabled",e.clicked||e.deleting)("ngbTooltip",d(13,11,"form.button_delete_all"))("openDelay",150),C("aria-label",d(14,13,"form.button_delete")),r(3),f("ngClass",z(15,Ee,e.deleting!=="all",e.deleting==="all"))}}var xe=(()=>{class n{$activeModal=g(pe);$api=g(H);$router=g(j);$toastr=g(I);$translate=g(R);currentConfig;fromSettings=!1;loading=!0;backupList=[];clicked=!1;deleting=null;ngOnInit(){this.getConfigBackups()}getConfigBackups(){return E(this,null,function*(){try{let e=yield $(this.$api.get("/config-editor/backups"));this.loading=!1,this.backupList=e}catch(e){this.loading=!1,console.error(e),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),this.dismissModal()}})}restore(e){return this.$activeModal.close(e)}download(e){return E(this,null,function*(){this.clicked=!0;try{let t=yield $(this.$api.get(`/config-editor/backups/${e}`)),i=JSON.stringify(t,null,4),o=new Blob([i],{type:"application/json"}),T=`config-backup-${e}.json`;(0,ve.saveAs)(o,T),this.clicked=!1}catch(t){this.clicked=!1,this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t)}})}downloadCurrentConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.currentConfig)}`,t=document.createElement("a");t.setAttribute("href",e),t.setAttribute("download","config.json"),document.body.appendChild(t),t.click(),t.remove()}delete(e){return E(this,null,function*(){this.deleting=e;try{yield $(this.$api.delete(`/config-editor/backups/${e}`)),yield this.getConfigBackups(),this.deleting=null}catch(t){this.deleting=null,this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t)}})}deleteAllBackups(){return E(this,null,function*(){this.deleting="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=[],this.deleting=null}catch(e){this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e),this.deleting=null}})}dismissModal(){this.fromSettings&&this.$router.navigate(["/settings"]),this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-component"]],inputs:{currentConfig:"currentConfig",fromSettings:"fromSettings"},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-fw","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",3,"click","disabled"],[1,"fas","fa-fw","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-fw","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","fa-fw",3,"ngClass"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-3",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-fw","fa-history"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-fw","fa-download"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),_(3),s(4,"translate"),l(),a(5,"button",3),s(6,"translate"),b("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"div",5),p(9,"i",6),l(),a(10,"ul",7)(11,"li"),_(12),s(13,"translate"),l(),a(14,"li"),_(15),s(16,"translate"),l()(),a(17,"ul",8)(18,"li",9)(19,"div")(20,"span"),_(21),s(22,"translate"),l(),p(23,"br"),a(24,"small",10),_(25),s(26,"translate"),l()(),a(27,"button",11),s(28,"translate"),b("click",function(){return i.downloadCurrentConfig()}),p(29,"i",12),l()()(),w(30,Ie,2,0,"div",13)(31,He,16,18,"ul",14),l(),a(32,"div",15),p(33,"div",16),a(34,"div",17)(35,"button",18),s(36,"translate"),b("click",function(){return i.dismissModal()}),_(37),s(38,"translate"),l()(),p(39,"div",19),l()()),t&2&&(r(3),k(d(4,13,"config.restore.title")),r(2),f("disabled",i.clicked||i.deleting),C("aria-label",d(6,15,"form.button_close")),r(7),k(d(13,17,"config.restore.help_1")),r(3),k(d(16,19,"config.restore.help_2")),r(6),k(d(22,21,"form.button_download")),r(4),k(d(26,23,"config.restore.download")),r(2),f("disabled",i.clicked||i.deleting),C("aria-label",d(28,25,"backup.backup_now")),r(3),v(i.loading?30:i.backupList.length?31:-1),r(5),f("disabled",i.clicked||i.deleting),C("aria-label",d(36,27,"form.button_close")),r(2),M(" ",d(38,29,"form.button_close")," "))},dependencies:[D,re,me,ae,P],encapsulation:2})}return n})();function Oe(n,y){if(n&1){let e=x();a(0,"button",13),s(1,"translate"),s(2,"translate"),b("click",function(){h(e);let i=m();return u(i.onCancelRestore())}),p(3,"i",14),l()}if(n&2){let e=m();f("disabled",e.saveInProgress)("openDelay",150)("ngbTooltip",d(1,4,"form.button_cancel")),C("aria-label",d(2,6,"form.button_cancel"))}}function Ne(n,y){if(n&1){let e=x();a(0,"button",15),s(1,"translate"),s(2,"translate"),b("click",function(){h(e);let i=m();return u(i.onRestore())}),p(3,"i",16),l()}n&2&&(f("openDelay",150)("ngbTooltip",d(1,3,"form.button_restore")),C("aria-label",d(2,5,"form.button_restore")))}function qe(n,y){n&1&&p(0,"i",8)}function Fe(n,y){n&1&&p(0,"i",9)}function Le(n,y){if(n&1){let e=x();a(0,"ngx-monaco-editor",17),b("onInit",function(i){h(e);let o=m();return u(o.onEditorInit(i))})("keydown.control.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())})("keydown.meta.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())}),l()}if(n&2){let e=m();f("options",e.editorOptions)("model",e.monacoEditorModel)}}function Je(n,y){if(n&1){let e=x();a(0,"ngx-monaco-diff-editor",18),b("onInit",function(i){h(e);let o=m();return u(o.onInitDiffEditor(i))})("keydown.control.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())})("keydown.meta.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())}),l()}if(n&2){let e=m();f("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function ze(n,y){if(n&1){let e=x();a(0,"textarea",19),ne("ngModelChange",function(i){h(e);let o=m();return oe(o.homebridgeConfig,i)||(o.homebridgeConfig=i),u(i)}),_(1," "),l()}if(n&2){let e=m();ie("ngModel",e.homebridgeConfig)}}var xt=(()=>{class n{$api=g(H);$md=g(_e);$modal=g(ge);$monacoEditor=g(we);$route=g(ue);$renderer=g(X);$router=g(j);$settings=g(be);$toastr=g(I);$translate=g(R);editorDecorations=[];lastHeight;visualViewPortEventCallback;latestSavedConfig;childBridgesToRestart=[];hbPendingRestart=!1;homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!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(i=>{this.homebridgeConfig=i.config,this.latestSavedConfig=JSON.parse(i.config)}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}});let{action:t}=this.$router.parseUrl(this.$router.url).queryParams;if(t){switch(t){case"restore":{this.onRestore(!0);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return E(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let t=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of t)if(i.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.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(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}onRestore(e=!1){let t=this.$modal.open(xe,{size:"lg",backdrop:"static"});t.componentInstance.currentConfig=this.homebridgeConfig,t.componentInstance.fromSettings=e,t.result.then(i=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${i}`).subscribe({next:o=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(o,null,4),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}]))},error:o=>{console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig="",this.onRestore()}ngOnDestroy(){let e=document.querySelector(".content");this.$renderer.removeStyle(e,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}validateSection(e,t){for(let i of e){if(typeof i!="object"||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(!i[t])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(typeof i[t]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1}return!0}validatePlugins(e,t){for(let i of e)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:t}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
1
+ import{a as we}from"./chunk-3DFE4GXY.js";import{b as A,e as ye,f as Ce,g as Re}from"./chunk-NRVKNZMW.js";import{a as fe,b as he}from"./chunk-DD4UIDDU.js";import{a as _e}from"./chunk-CQKCDD3I.js";import{a as De}from"./chunk-QNF5ENQG.js";import{m as pe,n as ge,t as D}from"./chunk-BEYU5GMW.js";import{B as ce,C as me,c as se,e as le,l as de}from"./chunk-WMIMAPZH.js";import{b as ue,d as j}from"./chunk-5KFQUVTY.js";import{b as be}from"./chunk-2ETJ2W67.js";import{k as I,n as H}from"./chunk-6MRWZBRB.js";import{a as R,b as P}from"./chunk-6FXNHKMA.js";import"./chunk-PP5MH7GY.js";import{$b as x,Ac as ne,Fc as z,Ib as C,Jb as w,Kb as v,Kc as s,Lc as d,Mb as Z,Mc as K,Nb as ee,Ob as te,Pb as f,Qb as a,Rb as l,Sb as p,bb as r,cc as b,d as G,ec as m,g as Q,gb as X,h as E,la as g,ld as re,nb as B,ra as h,rc as _,sa as u,sc as k,sd as ae,tc as M,w as $,yc as ie,zc as oe}from"./chunk-XWYKEZQQ.js";var ke=Q(Re(),1);var ve=Q(De(),1);var Ee=(n,y)=>({"fa-trash":n,"fa-cog fa-spin":y});function Ie(n,y){n&1&&(a(0,"div",13),p(1,"i",20),l())}function je(n,y){if(n&1){let e=x();a(0,"li",9)(1,"span"),_(2),s(3,"date"),p(4,"br"),a(5,"span",21),_(6),s(7,"date"),l()(),a(8,"span",22)(9,"button",25),s(10,"translate"),s(11,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.restore(i.id))}),p(12,"i",26),l(),a(13,"button",27),s(14,"translate"),s(15,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.download(i.id))}),p(16,"i",28),l(),a(17,"button",23),s(18,"translate"),s(19,"translate"),b("click",function(){let i=h(e).$implicit,o=m(2);return u(o.delete(i.id))}),p(20,"i",24),l()()()}if(n&2){let e=y.$implicit,t=m(2);r(2),M(" ",K(3,15,e.timestamp,"mediumDate")),r(4),k(K(7,18,e.timestamp,"shortTime")),r(3),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(10,21,"config.restore.copy_to_editor"))("openDelay",150),C("aria-label",d(11,23,"config.restore.copy_to_editor")),r(4),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(14,25,"form.button_download"))("openDelay",150),C("aria-label",d(15,27,"form.button_download")),r(4),f("disabled",t.clicked||t.deleting)("ngbTooltip",d(18,29,"form.button_delete"))("openDelay",150),C("aria-label",d(19,31,"form.button_delete")),r(3),f("ngClass",z(33,Ee,e.id!==t.deleting,e.id===t.deleting))}}function He(n,y){if(n&1){let e=x();a(0,"ul",14),ee(1,je,21,36,"li",9,Z),a(3,"li",9)(4,"span"),_(5),s(6,"translate"),p(7,"br"),a(8,"span",21),_(9),s(10,"translate"),l()(),a(11,"span",22)(12,"button",23),s(13,"translate"),s(14,"translate"),b("click",function(){h(e);let i=m();return u(i.deleteAllBackups())}),p(15,"i",24),l()()()()}if(n&2){let e=m();r(),te(e.backupList),r(4),M(" ",d(6,7,"form.button_delete_all")),r(4),M(" ",d(10,9,"common.labels.no_confirmation")," "),r(3),f("disabled",e.clicked||e.deleting)("ngbTooltip",d(13,11,"form.button_delete_all"))("openDelay",150),C("aria-label",d(14,13,"form.button_delete")),r(3),f("ngClass",z(15,Ee,e.deleting!=="all",e.deleting==="all"))}}var xe=(()=>{class n{$activeModal=g(pe);$api=g(H);$router=g(j);$toastr=g(I);$translate=g(R);currentConfig;fromSettings=!1;loading=!0;backupList=[];clicked=!1;deleting=null;ngOnInit(){this.getConfigBackups()}getConfigBackups(){return E(this,null,function*(){try{let e=yield $(this.$api.get("/config-editor/backups"));this.loading=!1,this.backupList=e}catch(e){this.loading=!1,console.error(e),this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),this.dismissModal()}})}restore(e){return this.$activeModal.close(e)}download(e){return E(this,null,function*(){this.clicked=!0;try{let t=yield $(this.$api.get(`/config-editor/backups/${e}`)),i=JSON.stringify(t,null,4),o=new Blob([i],{type:"application/json"}),T=`config-backup-${e}.json`;(0,ve.saveAs)(o,T),this.clicked=!1}catch(t){this.clicked=!1,this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t)}})}downloadCurrentConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.currentConfig)}`,t=document.createElement("a");t.setAttribute("href",e),t.setAttribute("download","config.json"),document.body.appendChild(t),t.click(),t.remove()}delete(e){return E(this,null,function*(){this.deleting=e;try{yield $(this.$api.delete(`/config-editor/backups/${e}`)),yield this.getConfigBackups(),this.deleting=null}catch(t){this.deleting=null,this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),console.error(t)}})}deleteAllBackups(){return E(this,null,function*(){this.deleting="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=[],this.deleting=null}catch(e){this.$toastr.error(e.error?.message||e.message,this.$translate.instant("toast.title_error")),console.error(e),this.deleting=null}})}dismissModal(){this.fromSettings&&this.$router.navigate(["/settings"]),this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=B({type:n,selectors:[["ng-component"]],inputs:{currentConfig:"currentConfig",fromSettings:"fromSettings"},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-fw","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",3,"click","disabled"],[1,"fas","fa-fw","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-fw","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","fa-fw",3,"ngClass"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-3",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-fw","fa-history"],["placement","bottom","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip","openDelay"],[1,"fas","fa-fw","fa-download"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"h5",2),_(3),s(4,"translate"),l(),a(5,"button",3),s(6,"translate"),b("click",function(){return i.dismissModal()}),l()(),a(7,"div",4)(8,"div",5),p(9,"i",6),l(),a(10,"ul",7)(11,"li"),_(12),s(13,"translate"),l(),a(14,"li"),_(15),s(16,"translate"),l()(),a(17,"ul",8)(18,"li",9)(19,"div")(20,"span"),_(21),s(22,"translate"),l(),p(23,"br"),a(24,"small",10),_(25),s(26,"translate"),l()(),a(27,"button",11),s(28,"translate"),b("click",function(){return i.downloadCurrentConfig()}),p(29,"i",12),l()()(),w(30,Ie,2,0,"div",13)(31,He,16,18,"ul",14),l(),a(32,"div",15),p(33,"div",16),a(34,"div",17)(35,"button",18),s(36,"translate"),b("click",function(){return i.dismissModal()}),_(37),s(38,"translate"),l()(),p(39,"div",19),l()()),t&2&&(r(3),k(d(4,13,"config.restore.title")),r(2),f("disabled",i.clicked||i.deleting),C("aria-label",d(6,15,"form.button_close")),r(7),k(d(13,17,"config.restore.help_1")),r(3),k(d(16,19,"config.restore.help_2")),r(6),k(d(22,21,"form.button_download")),r(4),k(d(26,23,"config.restore.download")),r(2),f("disabled",i.clicked||i.deleting),C("aria-label",d(28,25,"backup.backup_now")),r(3),v(i.loading?30:i.backupList.length?31:-1),r(5),f("disabled",i.clicked||i.deleting),C("aria-label",d(36,27,"form.button_close")),r(2),M(" ",d(38,29,"form.button_close")," "))},dependencies:[D,re,me,ae,P],encapsulation:2})}return n})();function Oe(n,y){if(n&1){let e=x();a(0,"button",13),s(1,"translate"),s(2,"translate"),b("click",function(){h(e);let i=m();return u(i.onCancelRestore())}),p(3,"i",14),l()}if(n&2){let e=m();f("disabled",e.saveInProgress)("openDelay",150)("ngbTooltip",d(1,4,"form.button_cancel")),C("aria-label",d(2,6,"form.button_cancel"))}}function Ne(n,y){if(n&1){let e=x();a(0,"button",15),s(1,"translate"),s(2,"translate"),b("click",function(){h(e);let i=m();return u(i.onRestore())}),p(3,"i",16),l()}n&2&&(f("openDelay",150)("ngbTooltip",d(1,3,"form.button_restore")),C("aria-label",d(2,5,"form.button_restore")))}function qe(n,y){n&1&&p(0,"i",8)}function Fe(n,y){n&1&&p(0,"i",9)}function Le(n,y){if(n&1){let e=x();a(0,"ngx-monaco-editor",17),b("onInit",function(i){h(e);let o=m();return u(o.onEditorInit(i))})("keydown.control.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())})("keydown.meta.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())}),l()}if(n&2){let e=m();f("options",e.editorOptions)("model",e.monacoEditorModel)}}function Je(n,y){if(n&1){let e=x();a(0,"ngx-monaco-diff-editor",18),b("onInit",function(i){h(e);let o=m();return u(o.onInitDiffEditor(i))})("keydown.control.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())})("keydown.meta.s",function(i){h(e);let o=m();return i.preventDefault(),u(o.onSave())}),l()}if(n&2){let e=m();f("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function ze(n,y){if(n&1){let e=x();a(0,"textarea",19),ne("ngModelChange",function(i){h(e);let o=m();return oe(o.homebridgeConfig,i)||(o.homebridgeConfig=i),u(i)}),_(1," "),l()}if(n&2){let e=m();ie("ngModel",e.homebridgeConfig)}}var xt=(()=>{class n{$api=g(H);$md=g(_e);$modal=g(ge);$monacoEditor=g(we);$route=g(ue);$renderer=g(X);$router=g(j);$settings=g(be);$toastr=g(I);$translate=g(R);editorDecorations=[];lastHeight;visualViewPortEventCallback;latestSavedConfig;childBridgesToRestart=[];hbPendingRestart=!1;homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!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(i=>{this.homebridgeConfig=i.config,this.latestSavedConfig=JSON.parse(i.config)}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}});let{action:t}=this.$router.parseUrl(this.$router.url).queryParams;if(t){switch(t){case"restore":{this.onRestore(!0);break}}this.$router.navigate([],{queryParams:{},replaceUrl:!0,queryParamsHandling:""})}}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return E(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let t=window.monaco.editor.getModelMarkers({owner:"json"});for(let i of t)if(i.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.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(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}onRestore(e=!1){let t=this.$modal.open(xe,{size:"lg",backdrop:"static"});t.componentInstance.currentConfig=this.homebridgeConfig,t.componentInstance.fromSettings=e,t.result.then(i=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${i}`).subscribe({next:o=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(o,null,4),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}]))},error:o=>{console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig="",this.onRestore()}ngOnDestroy(){let e=document.querySelector(".content");this.$renderer.removeStyle(e,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}validateSection(e,t){for(let i of e){if(typeof i!="object"||Array.isArray(i))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(!i[t])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1;if(typeof i[t]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:t}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(i),!1}return!0}validatePlugins(e,t){for(let i of e)if(typeof i!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:t}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
2
2
  `).map(t=>` ${t}`).join(`
3
3
  `),setTimeout(()=>{let t=this.monacoEditor.getModel().findMatches(e);if(t.length){let i=t[0].range,o=new monaco.Range(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:o,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}},200))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(t=>t.uri==="http://homebridge/config.json"))return;let e=monaco.Uri.parse("a://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[e.toString()],schema:{type:"object",required:["bridge"],properties:{bridge:{type:"object",required:["name","username","port","pin"],properties:{name:{type:"string",description:`The Homebridge instance name.
4
4
  This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
@@ -1 +1 @@
1
- import{ga as o,n as e}from"./chunk-IOKYXV5M.js";var n=new e,f=(()=>{class t{readyEvent;constructor(){this.readyEvent=n}static \u0275fac=function(r){return new(r||t)};static \u0275prov=o({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function d(){n.next(void 0)}export{f as a,d as b};
1
+ import{ga as o,n as e}from"./chunk-XWYKEZQQ.js";var n=new e,f=(()=>{class t{readyEvent;constructor(){this.readyEvent=n}static \u0275fac=function(r){return new(r||t)};static \u0275prov=o({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function d(){n.next(void 0)}export{f as a,d as b};
@@ -1 +1 @@
1
- import{A as Q,c as $,d as C,e as B,f as O,g as T,j as w,m as q,p as z,q as D,w as H,x as A,z as G}from"./chunk-7EQFLCW4.js";import{b as K}from"./chunk-BO3HTTPA.js";import{d as U}from"./chunk-DFFTJVRY.js";import{b as J}from"./chunk-HT7KLIKB.js";import{m as W}from"./chunk-5PN3M3TS.js";import{b as j}from"./chunk-KZKL7DGI.js";import"./chunk-OA7Y3E5A.js";import{Bd as P,Dc as f,Ib as u,Jb as c,Jc as l,Kc as d,M as I,Ob as m,Pb as r,Qb as a,Rb as s,Uc as b,Wc as L,Xa as x,ab as i,bc as E,dc as M,h as y,kc as v,kd as N,la as p,lc as F,mb as k,nd as V,qc as g,rc as h,sc as R,w as S}from"./chunk-IOKYXV5M.js";var Y=["password"],Z=["username"],ee=["otp"],te=e=>({background:e}),ie=e=>({anim:e}),X=e=>({"is-invalid":e});function ne(e,_){if(e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",13),a(),s(3,"input",14,0),l(5,"translate"),a(),r(6,"div",8)(7,"span",12),s(8,"i",15),a(),s(9,"input",16,1),l(11,"translate"),a()),e&2){let n=M();i(3),m("placeholder",d(5,4,"users.label_username"))("ngClass",f(8,X,n.form.controls.username.dirty&&n.form.controls.username.errors)),i(6),m("placeholder",d(11,6,"users.label_password"))("ngClass",f(10,X,n.form.controls.password.dirty&&n.form.controls.password.errors))}}function oe(e,_){e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",17),a(),s(3,"input",18,2),l(5,"translate"),a()),e&2&&(i(3),m("placeholder",d(5,1,"login.label_2fa_code")))}function ae(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_credentials")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}function re(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_code")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}var _e=(()=>{class e{$auth=p(K);$cdr=p(L);$router=p(U);$settings=p(J);targetRoute;validNonAdminRoutes=["/accessories","/plugins","/logs","/support"];passwordInput=b("password");usernameInput=b("username");otpInput=b("otp");backgroundStyle;invalidCredentials=!1;invalid2faCode=!1;twoFactorCodeRequired=!1;inProgress=!1;form;ngOnInit(){this.form=new T({username:new w(""),password:new w("")}),this.form.valueChanges.pipe(I(500)).subscribe(n=>{let o=this.passwordInput()?.nativeElement.value;o&&o!==n.password&&this.form.controls.password.setValue(o)}),this.targetRoute=window.sessionStorage.getItem("target_route")||"",this.setBackground()}ngAfterViewChecked(){this.$cdr.detectChanges()}onSubmit(){return y(this,null,function*(){this.invalidCredentials=!1,this.invalid2faCode=!1,this.inProgress=!0,document.getElementById("submit-button")?.blur();let n=this.passwordInput()?.nativeElement.value;n&&n!==this.form.get("password").value&&this.form.controls.password.setValue(n);let o=this.usernameInput()?.nativeElement.value;if(o&&o!==this.form.get("username").value&&this.form.controls.username.setValue(o),this.twoFactorCodeRequired){let t=this.otpInput()?.nativeElement.value;t&&t!==this.form.get("otp").value&&this.form.controls.username.setValue(t)}try{yield this.$auth.login(this.form.getRawValue()),!this.$auth.user.admin&&!this.validNonAdminRoutes.includes(this.targetRoute)&&(this.targetRoute="/"),this.$router.navigateByUrl(this.targetRoute),window.sessionStorage.removeItem("target_route")}catch(t){t.status===412?(this.form.controls.otp?(this.form.controls.otp.setErrors(["Invalid Code"]),this.invalid2faCode=!0):this.form.addControl("otp",new w("",[C.required,C.minLength(6),C.maxLength(6)])),this.twoFactorCodeRequired=!0,setTimeout(()=>{document.getElementById("form-ota").focus()},100)):this.invalidCredentials=!0}this.inProgress=!1})}setBackground(){return y(this,null,function*(){if(this.$settings.settingsLoaded||(yield S(this.$settings.onSettingsLoaded)),this.$settings.env.customWallpaperHash){let n=`${W.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`;this.backgroundStyle=`url('${n}') center/cover`}})}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=k({type:e,selectors:[["ng-component"]],viewQuery:function(o,t){o&1&&(v(t.passwordInput,Y,5),v(t.usernameInput,Z,5),v(t.otpInput,ee,5)),o&2&&F(3)},decls:15,vars:18,consts:[["username",""],["password",""],["otp",""],[1,"login-container","gradient","d-flex","align-items-start","justify-content-center",3,"ngStyle","ngClass"],[1,"w-100","login-card","d-flex","py-4","flex-column"],["ngSrc","/assets/homebridge-color-round.svg","alt","Homebridge Logo","height","100","width","100","priority","true",1,"homebridge-logo","mx-auto","my-3"],["novalidate","",3,"ngSubmit","formGroup"],[1,"mb-4","text-center"],[1,"input-group","mb-4"],[1,"input-group","no-border","mb-4"],[1,"text-center"],["tabindex","3","id","submit-button","type","submit",1,"btn","btn-primary","mb-2",3,"disabled"],[1,"input-group-text","custom-input"],[1,"fas","fa-fw","fa-user","primary-text","fa-lg"],["formControlName","username","type","text","id","form-username","autofocus","","autocomplete","username","autocapitalize","none","tabindex","1","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-lock","primary-text","fa-lg"],["formControlName","password","type","password","id","form-pass","autocomplete","current-password","tabindex","2","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-key","primary-text","fa-lg"],["formControlName","otp","type","text","id","form-ota","autofocus","","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*","tabindex","1",1,"form-control","custom-input",3,"placeholder"],[1,"fas","fa-fw","fa-exclamation-triangle","pink-text","fa-lg"],[1,"form-control","custom-input"],[1,"small","grey-text","fw-semibold"],[1,"small","grey-text",3,"innerHTML"]],template:function(o,t){o&1&&(r(0,"div",3)(1,"div",4),s(2,"img",5),r(3,"form",6),E("ngSubmit",function(){return t.onSubmit()}),r(4,"h4",7),g(5),l(6,"translate"),a(),u(7,ne,12,12),u(8,oe,6,3,"div",8),u(9,ae,9,6,"div",9),u(10,re,9,6,"div",9),r(11,"div",10)(12,"button",11),g(13),l(14,"translate"),a()()()()()),o&2&&(m("ngStyle",f(14,te,t.backgroundStyle))("ngClass",f(16,ie,!t.backgroundStyle)),i(3),m("formGroup",t.form),i(2),h(d(6,10,"setup.welcome_to_homebridge")),i(2),c(t.twoFactorCodeRequired?-1:7),i(),c(t.twoFactorCodeRequired?8:-1),i(),c(t.invalidCredentials?9:-1),i(),c(t.invalid2faCode?10:-1),i(2),m("disabled",t.form.invalid),i(),R(" ",d(14,12,"form.button_continue")," "))},dependencies:[V,G,q,$,B,O,H,A,Q,z,D,N,P,j],styles:["body{overflow:scroll!important} body.dark-mode .login-card{background-color:#2b2b2b;color:#fff}.login-container[_ngcontent-%COMP%]{z-index:-1;padding-top:2em;padding-bottom:2em;min-height:100%;background-size:300% 300%}.anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.login-card[_ngcontent-%COMP%]{max-width:550px;border-radius:1rem;padding-right:25px;padding-left:25px;background-color:#ffffffe6}.login-card[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{background-color:inherit!important}@media screen and (max-width: 575px){.login-card[_ngcontent-%COMP%]{margin-left:1em;margin-right:1em}}.homebridge-logo[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return e})();export{_e as LoginComponent};
1
+ import{B as G,C as Q,c as $,d as C,e as B,f as O,g as T,j as w,m as q,q as z,r as D,y as H,z as A}from"./chunk-WMIMAPZH.js";import{b as K}from"./chunk-5J7OMTCR.js";import{d as U}from"./chunk-5KFQUVTY.js";import{b as J}from"./chunk-2ETJ2W67.js";import{m as W}from"./chunk-6MRWZBRB.js";import{b as j}from"./chunk-6FXNHKMA.js";import"./chunk-PP5MH7GY.js";import{Cd as P,Ec as f,Jb as u,Kb as c,Kc as l,Lc as d,M as I,Pb as m,Qb as r,Rb as a,Sb as s,Vc as b,Xc as L,Ya as x,bb as i,cc as E,ec as M,h as y,la as p,lc as v,ld as N,mc as F,nb as k,od as V,rc as g,sc as h,tc as R,w as S}from"./chunk-XWYKEZQQ.js";var Y=["password"],Z=["username"],ee=["otp"],te=e=>({background:e}),ie=e=>({anim:e}),X=e=>({"is-invalid":e});function ne(e,_){if(e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",13),a(),s(3,"input",14,0),l(5,"translate"),a(),r(6,"div",8)(7,"span",12),s(8,"i",15),a(),s(9,"input",16,1),l(11,"translate"),a()),e&2){let n=M();i(3),m("placeholder",d(5,4,"users.label_username"))("ngClass",f(8,X,n.form.controls.username.dirty&&n.form.controls.username.errors)),i(6),m("placeholder",d(11,6,"users.label_password"))("ngClass",f(10,X,n.form.controls.password.dirty&&n.form.controls.password.errors))}}function oe(e,_){e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",17),a(),s(3,"input",18,2),l(5,"translate"),a()),e&2&&(i(3),m("placeholder",d(5,1,"login.label_2fa_code")))}function ae(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_credentials")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}function re(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_code")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}var _e=(()=>{class e{$auth=p(K);$cdr=p(L);$router=p(U);$settings=p(J);targetRoute;validNonAdminRoutes=["/accessories","/plugins","/logs","/support"];passwordInput=b("password");usernameInput=b("username");otpInput=b("otp");backgroundStyle;invalidCredentials=!1;invalid2faCode=!1;twoFactorCodeRequired=!1;inProgress=!1;form;ngOnInit(){this.form=new T({username:new w(""),password:new w("")}),this.form.valueChanges.pipe(I(500)).subscribe(n=>{let o=this.passwordInput()?.nativeElement.value;o&&o!==n.password&&this.form.controls.password.setValue(o)}),this.targetRoute=window.sessionStorage.getItem("target_route")||"",this.setBackground()}ngAfterViewChecked(){this.$cdr.detectChanges()}onSubmit(){return y(this,null,function*(){this.invalidCredentials=!1,this.invalid2faCode=!1,this.inProgress=!0,document.getElementById("submit-button")?.blur();let n=this.passwordInput()?.nativeElement.value;n&&n!==this.form.get("password").value&&this.form.controls.password.setValue(n);let o=this.usernameInput()?.nativeElement.value;if(o&&o!==this.form.get("username").value&&this.form.controls.username.setValue(o),this.twoFactorCodeRequired){let t=this.otpInput()?.nativeElement.value;t&&t!==this.form.get("otp").value&&this.form.controls.username.setValue(t)}try{yield this.$auth.login(this.form.getRawValue()),!this.$auth.user.admin&&!this.validNonAdminRoutes.includes(this.targetRoute)&&(this.targetRoute="/"),this.$router.navigateByUrl(this.targetRoute),window.sessionStorage.removeItem("target_route")}catch(t){t.status===412?(this.form.controls.otp?(this.form.controls.otp.setErrors(["Invalid Code"]),this.invalid2faCode=!0):this.form.addControl("otp",new w("",[C.required,C.minLength(6),C.maxLength(6)])),this.twoFactorCodeRequired=!0,setTimeout(()=>{document.getElementById("form-ota").focus()},100)):this.invalidCredentials=!0}this.inProgress=!1})}setBackground(){return y(this,null,function*(){if(this.$settings.settingsLoaded||(yield S(this.$settings.onSettingsLoaded)),this.$settings.env.customWallpaperHash){let n=`${W.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`;this.backgroundStyle=`url('${n}') center/cover`}})}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=k({type:e,selectors:[["ng-component"]],viewQuery:function(o,t){o&1&&(v(t.passwordInput,Y,5),v(t.usernameInput,Z,5),v(t.otpInput,ee,5)),o&2&&F(3)},decls:15,vars:18,consts:[["username",""],["password",""],["otp",""],[1,"login-container","gradient","d-flex","align-items-start","justify-content-center",3,"ngStyle","ngClass"],[1,"w-100","login-card","d-flex","py-4","flex-column"],["ngSrc","/assets/homebridge-color-round.svg","alt","Homebridge Logo","height","100","width","100","priority","true",1,"homebridge-logo","mx-auto","my-3"],["novalidate","",3,"ngSubmit","formGroup"],[1,"mb-4","text-center"],[1,"input-group","mb-4"],[1,"input-group","no-border","mb-4"],[1,"text-center"],["tabindex","3","id","submit-button","type","submit",1,"btn","btn-primary","mb-2",3,"disabled"],[1,"input-group-text","custom-input"],[1,"fas","fa-fw","fa-user","primary-text","fa-lg"],["formControlName","username","type","text","id","form-username","autofocus","","autocomplete","username","autocapitalize","none","tabindex","1","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-lock","primary-text","fa-lg"],["formControlName","password","type","password","id","form-pass","autocomplete","current-password","tabindex","2","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-key","primary-text","fa-lg"],["formControlName","otp","type","text","id","form-ota","autofocus","","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*","tabindex","1",1,"form-control","custom-input",3,"placeholder"],[1,"fas","fa-fw","fa-exclamation-triangle","pink-text","fa-lg"],[1,"form-control","custom-input"],[1,"small","grey-text","fw-semibold"],[1,"small","grey-text",3,"innerHTML"]],template:function(o,t){o&1&&(r(0,"div",3)(1,"div",4),s(2,"img",5),r(3,"form",6),E("ngSubmit",function(){return t.onSubmit()}),r(4,"h4",7),g(5),l(6,"translate"),a(),u(7,ne,12,12),u(8,oe,6,3,"div",8),u(9,ae,9,6,"div",9),u(10,re,9,6,"div",9),r(11,"div",10)(12,"button",11),g(13),l(14,"translate"),a()()()()()),o&2&&(m("ngStyle",f(14,te,t.backgroundStyle))("ngClass",f(16,ie,!t.backgroundStyle)),i(3),m("formGroup",t.form),i(2),h(d(6,10,"setup.welcome_to_homebridge")),i(2),c(t.twoFactorCodeRequired?-1:7),i(),c(t.twoFactorCodeRequired?8:-1),i(),c(t.invalidCredentials?9:-1),i(),c(t.invalid2faCode?10:-1),i(2),m("disabled",t.form.invalid),i(),R(" ",d(14,12,"form.button_continue")," "))},dependencies:[V,G,q,$,B,O,H,A,Q,z,D,N,P,j],styles:["body{overflow:scroll!important} body.dark-mode .login-card{background-color:#2b2b2b;color:#fff}.login-container[_ngcontent-%COMP%]{z-index:-1;padding-top:2em;padding-bottom:2em;min-height:100%;background-size:300% 300%}.anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.login-card[_ngcontent-%COMP%]{max-width:550px;border-radius:1rem;padding-right:25px;padding-left:25px;background-color:#ffffffe6}.login-card[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{background-color:inherit!important}@media screen and (max-width: 575px){.login-card[_ngcontent-%COMP%]{margin-left:1em;margin-right:1em}}.homebridge-logo[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return e})();export{_e as LoginComponent};
@@ -1 +1 @@
1
- import{b as s}from"./chunk-BO3HTTPA.js";import{d as i}from"./chunk-DFFTJVRY.js";import{k as o}from"./chunk-5PN3M3TS.js";import{a}from"./chunk-KZKL7DGI.js";import{ga as e,la as r}from"./chunk-IOKYXV5M.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
1
+ import{b as s}from"./chunk-5J7OMTCR.js";import{d as i}from"./chunk-5KFQUVTY.js";import{k as o}from"./chunk-6MRWZBRB.js";import{a}from"./chunk-6FXNHKMA.js";import{ga as e,la as r}from"./chunk-XWYKEZQQ.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
@@ -1 +1 @@
1
- import{a as _,b as D}from"./chunk-HT7KLIKB.js";import{m as c,n as S}from"./chunk-5PN3M3TS.js";import{f as x}from"./chunk-OA7Y3E5A.js";import{C as v,g as O,ga as h,h as a,ha as E,ja as y,ka as l,la as f,nb as I,r as p,va as j,w as d,x as T,z as w}from"./chunk-IOKYXV5M.js";var g=new y("JWT_OPTIONS"),m=(()=>{class r{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let i=0,s,n,b=0;n=e.charAt(b++);~n&&(s=i%4?s*64+n:n,i++%4)?o+=String.fromCharCode(255&s>>(-2*i&6)):0)n=t.indexOf(n);return o}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let o=this.urlBase64Decode(t[1]);if(!o)throw new Error("Cannot decode the token.");return JSON.parse(o)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let o=new Date(0);return o.setUTCSeconds(t.exp),o}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(o=>this._isTokenExpired(o,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let o=this.getTokenExpirationDate(e);return t=t||0,o===null?!1:!(o.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return r.\u0275fac=function(e){return new(e||r)(l(g))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),$=r=>r instanceof Promise?v(()=>r):p(r),R=(()=>{class r{constructor(e,t,o){this.jwtHelper=t,this.document=o,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let o=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===o:i instanceof RegExp?i.test(o):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(o=>{if(typeof o=="string"){let i=new URL(o,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return o instanceof RegExp?o.test(e.url):!1})>-1}handleInterception(e,t,o){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=p(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):p(!0)),e?s.pipe(T(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(n=>o.handle(n))):o.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let o=this.tokenGetter(e);return $(o).pipe(w(i=>this.handleInterception(i,e,t)))}}return r.\u0275fac=function(e){return new(e||r)(l(g),l(m),l(j))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),F=(()=>{class r{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:r,providers:[{provide:x,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return r.\u0275fac=function(e){return new(e||r)(l(r,12))},r.\u0275mod=I({type:r}),r.\u0275inj=E({}),r})();var k=O(_(),1);var q=(()=>{class r{$api=f(S);$jwtHelper=f(m);$settings=f(D);token;user={};logoutTimer;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield d(this.$api.post("/auth/login",e));if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(c.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield d(this.$api.post("/auth/noauth",{}));if(this.validateToken(e.access_token))window.localStorage.setItem(c.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(c.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield d(this.$settings.onSettingsLoaded));let e=window.localStorage.getItem(c.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){try{return yield d(this.$api.get("/auth/check"))}catch(e){e.status===401&&(console.error("Current token is not valid"),this.logout())}})}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}validateToken(e){try{return this.$jwtHelper.isTokenExpired(e,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(e),this.token=e,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(c.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let t=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");t<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),t))}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=h({token:r,factory:r.\u0275fac})}return r})();export{F as a,q as b};
1
+ import{a as _,b as D}from"./chunk-2ETJ2W67.js";import{m as c,n as S}from"./chunk-6MRWZBRB.js";import{f as x}from"./chunk-PP5MH7GY.js";import{C as v,g as O,ga as h,h as a,ha as E,ja as y,ka as l,la as f,ob as I,r as p,w as d,wa as j,x as T,z as w}from"./chunk-XWYKEZQQ.js";var g=new y("JWT_OPTIONS"),m=(()=>{class r{constructor(e=null){this.tokenGetter=e&&e.tokenGetter||function(){}}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:{t+="==";break}case 3:{t+="=";break}default:throw new Error("Illegal base64url string!")}return this.b64DecodeUnicode(t)}b64decode(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="";if(e=String(e).replace(/=+$/,""),e.length%4===1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(let i=0,s,n,b=0;n=e.charAt(b++);~n&&(s=i%4?s*64+n:n,i++%4)?o+=String.fromCharCode(255&s>>(-2*i&6)):0)n=t.indexOf(n);return o}b64DecodeUnicode(e){return decodeURIComponent(Array.prototype.map.call(this.b64decode(e),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}decodeToken(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._decodeToken(t)):this._decodeToken(e)}_decodeToken(e){if(!e||e==="")return null;let t=e.split(".");if(t.length!==3)throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");let o=this.urlBase64Decode(t[1]);if(!o)throw new Error("Cannot decode the token.");return JSON.parse(o)}getTokenExpirationDate(e=this.tokenGetter()){return e instanceof Promise?e.then(t=>this._getTokenExpirationDate(t)):this._getTokenExpirationDate(e)}_getTokenExpirationDate(e){let t;if(t=this.decodeToken(e),!t||!t.hasOwnProperty("exp"))return null;let o=new Date(0);return o.setUTCSeconds(t.exp),o}isTokenExpired(e=this.tokenGetter(),t){return e instanceof Promise?e.then(o=>this._isTokenExpired(o,t)):this._isTokenExpired(e,t)}_isTokenExpired(e,t){if(!e||e==="")return!0;let o=this.getTokenExpirationDate(e);return t=t||0,o===null?!1:!(o.valueOf()>new Date().valueOf()+t*1e3)}getAuthScheme(e,t){return typeof e=="function"?e(t):e}}return r.\u0275fac=function(e){return new(e||r)(l(g))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),$=r=>r instanceof Promise?v(()=>r):p(r),R=(()=>{class r{constructor(e,t,o){this.jwtHelper=t,this.document=o,this.standardPorts=["80","443"],this.tokenGetter=e.tokenGetter,this.headerName=e.headerName||"Authorization",this.authScheme=e.authScheme||e.authScheme===""?e.authScheme:"Bearer ",this.allowedDomains=e.allowedDomains||[],this.disallowedRoutes=e.disallowedRoutes||[],this.throwNoTokenError=e.throwNoTokenError||!1,this.skipWhenExpired=e.skipWhenExpired}isAllowedDomain(e){let t=new URL(e.url,this.document.location.origin);if(t.host===this.document.location.host)return!0;let o=`${t.hostname}${t.port&&!this.standardPorts.includes(t.port)?":"+t.port:""}`;return this.allowedDomains.findIndex(i=>typeof i=="string"?i===o:i instanceof RegExp?i.test(o):!1)>-1}isDisallowedRoute(e){let t=new URL(e.url,this.document.location.origin);return this.disallowedRoutes.findIndex(o=>{if(typeof o=="string"){let i=new URL(o,this.document.location.origin);return i.hostname===t.hostname&&i.pathname===t.pathname}return o instanceof RegExp?o.test(e.url):!1})>-1}handleInterception(e,t,o){let i=this.jwtHelper.getAuthScheme(this.authScheme,t);if(!e&&this.throwNoTokenError)throw new Error("Could not get token from tokenGetter function.");let s=p(!1);return this.skipWhenExpired&&(s=e?$(this.jwtHelper.isTokenExpired(e)):p(!0)),e?s.pipe(T(n=>n&&this.skipWhenExpired?t.clone():t.clone({setHeaders:{[this.headerName]:`${i}${e}`}})),w(n=>o.handle(n))):o.handle(t)}intercept(e,t){if(!this.isAllowedDomain(e)||this.isDisallowedRoute(e))return t.handle(e);let o=this.tokenGetter(e);return $(o).pipe(w(i=>this.handleInterception(i,e,t)))}}return r.\u0275fac=function(e){return new(e||r)(l(g),l(m),l(j))},r.\u0275prov=h({token:r,factory:r.\u0275fac}),r})(),F=(()=>{class r{constructor(e){if(e)throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.")}static forRoot(e){return{ngModule:r,providers:[{provide:x,useClass:R,multi:!0},e.jwtOptionsProvider||{provide:g,useValue:e.config},m]}}}return r.\u0275fac=function(e){return new(e||r)(l(r,12))},r.\u0275mod=I({type:r}),r.\u0275inj=E({}),r})();var k=O(_(),1);var q=(()=>{class r{$api=f(S);$jwtHelper=f(m);$settings=f(D);token;user={};logoutTimer;constructor(){this.loadToken()}login(e){return a(this,null,function*(){let t=yield d(this.$api.post("/auth/login",e));if(!this.validateToken(t.access_token))throw new Error("Invalid username or password.");window.localStorage.setItem(c.jwt.tokenKey,t.access_token),yield this.$settings.getAppSettings()})}noauth(){return a(this,null,function*(){let e=yield d(this.$api.post("/auth/noauth",{}));if(this.validateToken(e.access_token))window.localStorage.setItem(c.jwt.tokenKey,e.access_token),yield this.$settings.getAppSettings();else throw new Error("Invalid username or password.")})}logout(){this.user=null,this.token=null,window.localStorage.removeItem(c.jwt.tokenKey),window.location.reload()}loadToken(){return a(this,null,function*(){this.$settings.settingsLoaded||(yield d(this.$settings.onSettingsLoaded));let e=window.localStorage.getItem(c.jwt.tokenKey);e&&this.validateToken(e)})}checkToken(){return a(this,null,function*(){try{return yield d(this.$api.get("/auth/check"))}catch(e){e.status===401&&(console.error("Current token is not valid"),this.logout())}})}isLoggedIn(){return this.$settings.env.instanceId!==this.user.instanceId?(console.error("Token does not match instance"),!1):this.user&&this.token&&!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)}validateToken(e){try{return this.$jwtHelper.isTokenExpired(e,this.$settings.serverTimeOffset)&&this.logout(),this.user=this.$jwtHelper.decodeToken(e),this.token=e,this.setLogoutTimer(),!0}catch{return window.localStorage.removeItem(c.jwt.tokenKey),this.token=null,!1}}setLogoutTimer(){if(clearTimeout(this.logoutTimer),!this.$jwtHelper.isTokenExpired(this.token,this.$settings.serverTimeOffset)){let t=(0,k.default)(this.$jwtHelper.getTokenExpirationDate(this.token)).diff((0,k.default)().add(this.$settings.serverTimeOffset,"s"),"millisecond");t<=2147483647&&(this.logoutTimer=setTimeout(()=>a(this,null,function*(){this.$settings.formAuth===!1?(yield this.noauth(),window.location.reload()):this.logout()}),t))}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=h({token:r,factory:r.\u0275fac})}return r})();export{F as a,q as b};