@iobroker/adapter-react-v5 3.1.34 → 3.1.35

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 (243) hide show
  1. package/Components/404.js +0 -23
  2. package/Components/404.js.map +1 -1
  3. package/Components/ColorPicker.js +6 -37
  4. package/Components/ColorPicker.js.map +1 -1
  5. package/Components/ComplexCron.js +10 -84
  6. package/Components/ComplexCron.js.map +1 -1
  7. package/Components/CustomModal.js +29 -54
  8. package/Components/CustomModal.js.map +1 -1
  9. package/Components/FileBrowser.js +15 -265
  10. package/Components/FileBrowser.js.map +1 -1
  11. package/Components/FileViewer.js +7 -68
  12. package/Components/FileViewer.js.map +1 -1
  13. package/Components/Icon.d.ts +1 -1
  14. package/Components/Icon.js +2 -42
  15. package/Components/Icon.js.map +1 -1
  16. package/Components/IconPicker.js +6 -28
  17. package/Components/IconPicker.js.map +1 -1
  18. package/Components/IconSelector.js +3 -55
  19. package/Components/IconSelector.js.map +1 -1
  20. package/Components/Image.js +1 -38
  21. package/Components/Image.js.map +1 -1
  22. package/Components/JsonConfigComponent/ChipInput.js +66 -197
  23. package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
  24. package/Components/JsonConfigComponent/ConfigAlive.js +0 -31
  25. package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
  26. package/Components/JsonConfigComponent/ConfigAutocomplete.js +6 -39
  27. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
  28. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +6 -52
  29. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
  30. package/Components/JsonConfigComponent/ConfigCRON.js +5 -39
  31. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
  32. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +4 -42
  33. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
  34. package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -28
  35. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
  36. package/Components/JsonConfigComponent/ConfigChip.js +4 -33
  37. package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
  38. package/Components/JsonConfigComponent/ConfigColor.js +0 -34
  39. package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
  40. package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -33
  41. package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
  42. package/Components/JsonConfigComponent/ConfigCustom.js +14 -73
  43. package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
  44. package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -25
  45. package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
  46. package/Components/JsonConfigComponent/ConfigFile.js +0 -46
  47. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
  48. package/Components/JsonConfigComponent/ConfigFileSelector.js +7 -126
  49. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
  50. package/Components/JsonConfigComponent/ConfigFunc.js +0 -34
  51. package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
  52. package/Components/JsonConfigComponent/ConfigGeneric.js +15 -110
  53. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  54. package/Components/JsonConfigComponent/ConfigIP.js +2 -35
  55. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
  56. package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -44
  57. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
  58. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -59
  59. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
  60. package/Components/JsonConfigComponent/ConfigJsonEditor.js +7 -40
  61. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  62. package/Components/JsonConfigComponent/ConfigLanguage.js +2 -42
  63. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
  64. package/Components/JsonConfigComponent/ConfigNumber.js +2 -45
  65. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
  66. package/Components/JsonConfigComponent/ConfigObjectId.js +6 -40
  67. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
  68. package/Components/JsonConfigComponent/ConfigPanel.js +7 -91
  69. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
  70. package/Components/JsonConfigComponent/ConfigPassword.js +0 -42
  71. package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
  72. package/Components/JsonConfigComponent/ConfigPattern.js +0 -25
  73. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
  74. package/Components/JsonConfigComponent/ConfigRoom.js +0 -34
  75. package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
  76. package/Components/JsonConfigComponent/ConfigSelect.js +4 -34
  77. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
  78. package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -67
  79. package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
  80. package/Components/JsonConfigComponent/ConfigSendto.js +8 -91
  81. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
  82. package/Components/JsonConfigComponent/ConfigSetState.js +0 -55
  83. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
  84. package/Components/JsonConfigComponent/ConfigSlider.js +0 -28
  85. package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
  86. package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -21
  87. package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
  88. package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -24
  89. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
  90. package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -23
  91. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
  92. package/Components/JsonConfigComponent/ConfigStaticText.js +0 -31
  93. package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
  94. package/Components/JsonConfigComponent/ConfigTable.js +13 -105
  95. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
  96. package/Components/JsonConfigComponent/ConfigTabs.js +2 -35
  97. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
  98. package/Components/JsonConfigComponent/ConfigText.js +0 -34
  99. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  100. package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -37
  101. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
  102. package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -25
  103. package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
  104. package/Components/JsonConfigComponent/ConfigTopic.js +0 -29
  105. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
  106. package/Components/JsonConfigComponent/ConfigUser.js +2 -40
  107. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
  108. package/Components/JsonConfigComponent/index.js +5 -81
  109. package/Components/JsonConfigComponent/index.js.map +1 -1
  110. package/Components/Loader.js +2 -20
  111. package/Components/Loader.js.map +1 -1
  112. package/Components/Loaders/PT.js +2 -20
  113. package/Components/Loaders/PT.js.map +1 -1
  114. package/Components/Loaders/Vendor.js +2 -21
  115. package/Components/Loaders/Vendor.js.map +1 -1
  116. package/Components/Logo.js +6 -39
  117. package/Components/Logo.js.map +1 -1
  118. package/Components/MDUtils.js +3 -27
  119. package/Components/MDUtils.js.map +1 -1
  120. package/Components/ObjectBrowser.d.ts +1 -1
  121. package/Components/ObjectBrowser.js +181 -788
  122. package/Components/ObjectBrowser.js.map +1 -1
  123. package/Components/Router.js +7 -31
  124. package/Components/Router.js.map +1 -1
  125. package/Components/SaveCloseButtons.js +2 -32
  126. package/Components/SaveCloseButtons.js.map +1 -1
  127. package/Components/Schedule.js +29 -251
  128. package/Components/Schedule.js.map +1 -1
  129. package/Components/SelectWithIcon.d.ts +1 -1
  130. package/Components/SelectWithIcon.js +0 -48
  131. package/Components/SelectWithIcon.js.map +1 -1
  132. package/Components/SimpleCron/cron2text.js +45 -91
  133. package/Components/SimpleCron/cron2text.js.map +1 -1
  134. package/Components/SimpleCron/cronText.js +0 -6
  135. package/Components/SimpleCron/cronText.js.map +1 -1
  136. package/Components/SimpleCron/index.js +19 -102
  137. package/Components/SimpleCron/index.js.map +1 -1
  138. package/Components/SimpleCron/jquery.cron.locale.js +44 -24
  139. package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
  140. package/Components/TabContainer.js +2 -23
  141. package/Components/TabContainer.js.map +1 -1
  142. package/Components/TabContent.js +2 -22
  143. package/Components/TabContent.js.map +1 -1
  144. package/Components/TabHeader.js +1 -17
  145. package/Components/TabHeader.js.map +1 -1
  146. package/Components/TableResize.js +6 -51
  147. package/Components/TableResize.js.map +1 -1
  148. package/Components/TextWithIcon.js +0 -20
  149. package/Components/TextWithIcon.js.map +1 -1
  150. package/Components/ToggleThemeMenu.js +5 -13
  151. package/Components/ToggleThemeMenu.js.map +1 -1
  152. package/Components/TreeTable.js +4 -121
  153. package/Components/TreeTable.js.map +1 -1
  154. package/Components/UploadImage.js +17 -60
  155. package/Components/UploadImage.js.map +1 -1
  156. package/Components/Utils.js +87 -263
  157. package/Components/Utils.js.map +1 -1
  158. package/Components/copy-to-clipboard.js +16 -38
  159. package/Components/copy-to-clipboard.js.map +1 -1
  160. package/Components/withWidth.js +2 -10
  161. package/Components/withWidth.js.map +1 -1
  162. package/Connection.d.ts +1 -0
  163. package/Connection.js +156 -527
  164. package/Connection.js.map +1 -1
  165. package/Dialogs/ComplexCron.js +0 -34
  166. package/Dialogs/ComplexCron.js.map +1 -1
  167. package/Dialogs/Confirm.js +1 -39
  168. package/Dialogs/Confirm.js.map +1 -1
  169. package/Dialogs/Cron.js +1 -37
  170. package/Dialogs/Cron.js.map +1 -1
  171. package/Dialogs/Error.d.ts +1 -1
  172. package/Dialogs/Error.js +2 -29
  173. package/Dialogs/Error.js.map +1 -1
  174. package/Dialogs/FileSelect.js +2 -36
  175. package/Dialogs/FileSelect.js.map +1 -1
  176. package/Dialogs/Message.js +2 -27
  177. package/Dialogs/Message.js.map +1 -1
  178. package/Dialogs/SelectID.d.ts +1 -1
  179. package/Dialogs/SelectID.js +3 -40
  180. package/Dialogs/SelectID.js.map +1 -1
  181. package/Dialogs/SimpleCron.js +1 -33
  182. package/Dialogs/SimpleCron.js.map +1 -1
  183. package/Dialogs/TextInput.js +2 -34
  184. package/Dialogs/TextInput.js.map +1 -1
  185. package/GenericApp.js +54 -150
  186. package/GenericApp.js.map +1 -1
  187. package/Prompt.js +0 -2
  188. package/Prompt.js.map +1 -1
  189. package/README.md +8 -4
  190. package/Theme.js +7 -22
  191. package/Theme.js.map +1 -1
  192. package/i18n.d.ts +2 -0
  193. package/i18n.js +9 -29
  194. package/i18n.js.map +1 -1
  195. package/icons/IconAdapter.d.ts +2 -2
  196. package/icons/IconAdapter.js +2 -6
  197. package/icons/IconAdapter.js.map +1 -1
  198. package/icons/IconAlias.d.ts +2 -2
  199. package/icons/IconAlias.js +2 -6
  200. package/icons/IconAlias.js.map +1 -1
  201. package/icons/IconChannel.d.ts +2 -2
  202. package/icons/IconChannel.js +2 -6
  203. package/icons/IconChannel.js.map +1 -1
  204. package/icons/IconClearFilter.d.ts +2 -2
  205. package/icons/IconClearFilter.js +0 -5
  206. package/icons/IconClearFilter.js.map +1 -1
  207. package/icons/IconClosed.d.ts +2 -2
  208. package/icons/IconClosed.js +0 -5
  209. package/icons/IconClosed.js.map +1 -1
  210. package/icons/IconCopy.d.ts +2 -2
  211. package/icons/IconCopy.js +0 -5
  212. package/icons/IconCopy.js.map +1 -1
  213. package/icons/IconDevice.d.ts +2 -2
  214. package/icons/IconDevice.js +0 -5
  215. package/icons/IconDevice.js.map +1 -1
  216. package/icons/IconDocument.d.ts +2 -2
  217. package/icons/IconDocument.js +0 -5
  218. package/icons/IconDocument.js.map +1 -1
  219. package/icons/IconDocumentReadOnly.d.ts +2 -2
  220. package/icons/IconDocumentReadOnly.js +0 -5
  221. package/icons/IconDocumentReadOnly.js.map +1 -1
  222. package/icons/IconExpert.d.ts +2 -2
  223. package/icons/IconExpert.js +0 -5
  224. package/icons/IconExpert.js.map +1 -1
  225. package/icons/IconFx.d.ts +2 -2
  226. package/icons/IconFx.js +0 -5
  227. package/icons/IconFx.js.map +1 -1
  228. package/icons/IconInstance.d.ts +2 -2
  229. package/icons/IconInstance.js +0 -5
  230. package/icons/IconInstance.js.map +1 -1
  231. package/icons/IconLogout.d.ts +2 -2
  232. package/icons/IconLogout.js +0 -5
  233. package/icons/IconLogout.js.map +1 -1
  234. package/icons/IconNoIcon.d.ts +2 -2
  235. package/icons/IconNoIcon.js +0 -5
  236. package/icons/IconNoIcon.js.map +1 -1
  237. package/icons/IconOpen.d.ts +2 -2
  238. package/icons/IconOpen.js +0 -5
  239. package/icons/IconOpen.js.map +1 -1
  240. package/icons/IconState.d.ts +2 -2
  241. package/icons/IconState.js +0 -6
  242. package/icons/IconState.js.map +1 -1
  243. package/package.json +15 -15
@@ -1,32 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
-
20
13
  var _react = _interopRequireDefault(require("react"));
21
-
22
14
  var _i18n = _interopRequireDefault(require("../i18n"));
23
-
24
15
  /**
25
16
  * Copyright 2018-2022 bluefox <dogafox@gmail.com>
26
17
  *
27
18
  * MIT License
28
19
  *
29
20
  **/
21
+
30
22
  var NAMESPACE = 'material';
31
23
  var days = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
32
24
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -56,14 +48,11 @@ var SIGNATURES = {
56
48
  PHN2Zw: 'svg',
57
49
  Qk1: 'bmp',
58
50
  AAABAA: 'ico' // 00 00 01 00 according to https://en.wikipedia.org/wiki/List_of_file_signatures
59
-
60
51
  };
61
-
62
52
  var Utils = /*#__PURE__*/function () {
63
53
  function Utils() {
64
54
  (0, _classCallCheck2["default"])(this, Utils);
65
55
  }
66
-
67
56
  (0, _createClass2["default"])(Utils, null, [{
68
57
  key: "CapitalWords",
69
58
  value:
@@ -85,34 +74,27 @@ var Utils = /*#__PURE__*/function () {
85
74
  var days = Math.floor(seconds / (3600 * 24));
86
75
  seconds %= 3600 * 24;
87
76
  var hours = Math.floor(seconds / 3600);
88
-
89
77
  if (hours < 10) {
90
78
  hours = '0' + hours;
91
79
  }
92
-
93
80
  seconds %= 3600;
94
81
  var minutes = Math.floor(seconds / 60);
95
-
96
82
  if (minutes < 10) {
97
83
  minutes = '0' + minutes;
98
84
  }
99
-
100
85
  seconds %= 60;
101
86
  seconds = Math.floor(seconds);
102
-
103
87
  if (seconds < 10) {
104
88
  seconds = '0' + seconds;
105
89
  }
106
-
107
90
  var text = '';
108
-
109
91
  if (days) {
110
92
  text += "".concat(days, " ").concat(_i18n["default"].t('ra_daysShortText'), " ");
111
93
  }
112
-
113
94
  text += "".concat(hours, ":").concat(minutes, ":").concat(seconds);
114
95
  return text;
115
96
  }
97
+
116
98
  /**
117
99
  * Get the name of the object by id from the name or description.
118
100
  * @param {Record<string, ioBroker.Object>} objects
@@ -122,46 +104,36 @@ var Utils = /*#__PURE__*/function () {
122
104
  * @param {boolean} [isDesc] Set to true to get the description.
123
105
  * @returns {string}
124
106
  */
125
-
126
107
  }, {
127
108
  key: "getObjectName",
128
109
  value: function getObjectName(objects, id, settings, options, isDesc) {
129
110
  var item = objects[id];
130
111
  var text = id;
131
112
  var attr = isDesc ? 'desc' : 'name';
132
-
133
113
  if (typeof settings === 'string' && !options) {
134
114
  options = {
135
115
  language: settings
136
116
  };
137
117
  settings = null;
138
118
  }
139
-
140
119
  options = options || {};
141
-
142
120
  if (!options.language) {
143
121
  options.language = objects['system.config'] && objects['system.config'].common && objects['system.config'].common.language || window.sysLang || 'en';
144
122
  }
145
-
146
123
  if (settings && settings.name) {
147
124
  text = settings.name;
148
-
149
125
  if ((0, _typeof2["default"])(text) === 'object') {
150
126
  text = text[options.language] || text.en;
151
127
  }
152
128
  } else if (item && item.common && item.common[attr]) {
153
129
  text = item.common[attr];
154
-
155
130
  if (attr !== 'desc' && !text && item.common.desc) {
156
131
  text = item.common.desc;
157
132
  }
158
-
159
133
  if ((0, _typeof2["default"])(text) === 'object') {
160
134
  text = text[options.language] || text.en || text.de || text.ru || '';
161
135
  }
162
-
163
136
  text = (text || '').toString().replace(/[_.]/g, ' ');
164
-
165
137
  if (text === text.toUpperCase()) {
166
138
  text = text[0] + text.substring(1).toLowerCase();
167
139
  }
@@ -170,9 +142,9 @@ var Utils = /*#__PURE__*/function () {
170
142
  text = id.substring(pos + 1).replace(/[_.]/g, ' ');
171
143
  text = Utils.CapitalWords(text);
172
144
  }
173
-
174
145
  return text.trim();
175
146
  }
147
+
176
148
  /**
177
149
  * Get the name of the object from the name or description.
178
150
  * @param {ioBroker.PartialObject} obj
@@ -182,69 +154,56 @@ var Utils = /*#__PURE__*/function () {
182
154
  * @param {boolean} [noTrim] Allow to use spaces in name (by edit)
183
155
  * @returns {string}
184
156
  */
185
-
186
157
  }, {
187
158
  key: "getObjectNameFromObj",
188
159
  value: function getObjectNameFromObj(obj, settings, options, isDesc, noTrim) {
189
160
  var item = obj;
190
161
  var text = obj && obj._id || '';
191
162
  var attr = isDesc ? 'desc' : 'name';
192
-
193
163
  if (typeof settings === 'string' && !options) {
194
164
  options = {
195
165
  language: settings
196
166
  };
197
167
  settings = null;
198
168
  }
199
-
200
169
  options = options || {};
201
-
202
170
  if (settings && settings.name) {
203
171
  text = settings.name;
204
-
205
172
  if ((0, _typeof2["default"])(text) === 'object') {
206
173
  text = text[options.language] || text.en;
207
174
  }
208
175
  } else if (item && item.common && item.common[attr]) {
209
176
  text = item.common[attr];
210
-
211
177
  if (attr !== 'desc' && !text && item.common.desc) {
212
178
  text = item.common.desc;
213
179
  }
214
-
215
180
  if ((0, _typeof2["default"])(text) === 'object') {
216
181
  text = text[options.language] || text.en;
217
182
  }
218
-
219
183
  text = (text || '').toString().replace(/[_.]/g, ' ');
220
-
221
184
  if (text === text.toUpperCase()) {
222
185
  text = text[0] + text.substring(1).toLowerCase();
223
186
  }
224
187
  }
225
-
226
188
  return noTrim ? text : text.trim();
227
189
  }
190
+
228
191
  /**
229
192
  * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj
230
193
  * @param {string} forEnumId
231
194
  * @param {{ user: string; }} options
232
195
  * @returns {string | null}
233
196
  */
234
-
235
197
  }, {
236
198
  key: "getSettingsOrder",
237
199
  value: function getSettingsOrder(obj, forEnumId, options) {
238
200
  if (obj && obj.hasOwnProperty('common')) {
239
201
  obj = obj.common;
240
202
  }
241
-
242
203
  var settings;
243
-
244
204
  if (obj && obj.custom) {
245
205
  settings = (obj.custom || {})[NAMESPACE];
246
206
  var user = options.user || 'admin';
247
-
248
207
  if (settings && settings[user]) {
249
208
  if (forEnumId) {
250
209
  if (settings[user].subOrder && settings[user].subOrder[forEnumId]) {
@@ -257,28 +216,24 @@ var Utils = /*#__PURE__*/function () {
257
216
  }
258
217
  }
259
218
  }
260
-
261
219
  return null;
262
220
  }
221
+
263
222
  /**
264
223
  * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj
265
224
  * @param {string} forEnumId
266
225
  * @param {{ user: string; }} options
267
226
  */
268
-
269
227
  }, {
270
228
  key: "getSettingsCustomURLs",
271
229
  value: function getSettingsCustomURLs(obj, forEnumId, options) {
272
230
  if (obj && obj.hasOwnProperty('common')) {
273
231
  obj = obj.common;
274
232
  }
275
-
276
233
  var settings;
277
-
278
234
  if (obj && obj.custom) {
279
235
  settings = (obj.custom || {})[NAMESPACE];
280
236
  var user = options.user || 'admin';
281
-
282
237
  if (settings && settings[user]) {
283
238
  if (forEnumId) {
284
239
  if (settings[user].subURLs && settings[user].subURLs[forEnumId]) {
@@ -291,25 +246,22 @@ var Utils = /*#__PURE__*/function () {
291
246
  }
292
247
  }
293
248
  }
294
-
295
249
  return null;
296
250
  }
251
+
297
252
  /**
298
253
  * Reorder the array items in list between source and dest.
299
254
  * @param {Iterable<any> | ArrayLike<any>} list
300
255
  * @param {number} source
301
256
  * @param {number} dest
302
257
  */
303
-
304
258
  }, {
305
259
  key: "reorder",
306
260
  value: function reorder(list, source, dest) {
307
261
  var result = Array.from(list);
308
-
309
262
  var _result$splice = result.splice(source, 1),
310
- _result$splice2 = (0, _slicedToArray2["default"])(_result$splice, 1),
311
- removed = _result$splice2[0];
312
-
263
+ _result$splice2 = (0, _slicedToArray2["default"])(_result$splice, 1),
264
+ removed = _result$splice2[0];
313
265
  result.splice(dest, 0, removed);
314
266
  return result;
315
267
  }
@@ -324,11 +276,9 @@ var Utils = /*#__PURE__*/function () {
324
276
  function getSettings(obj, options, defaultEnabling) {
325
277
  var settings;
326
278
  var id = obj && obj._id || options && options.id;
327
-
328
279
  if (obj && obj.hasOwnProperty('common')) {
329
280
  obj = obj.common;
330
281
  }
331
-
332
282
  if (obj && obj.custom) {
333
283
  settings = obj.custom || {};
334
284
  settings = settings[NAMESPACE] && settings[NAMESPACE][options.user || 'admin'] ? JSON.parse(JSON.stringify(settings[NAMESPACE][options.user || 'admin'])) : {
@@ -340,11 +290,9 @@ var Utils = /*#__PURE__*/function () {
340
290
  useCustom: false
341
291
  };
342
292
  }
343
-
344
293
  if (!settings.hasOwnProperty('enabled')) {
345
294
  settings.enabled = defaultEnabling === undefined ? true : defaultEnabling;
346
295
  }
347
-
348
296
  if (false && settings.useCommon) {
349
297
  if (obj.color) settings.color = obj.color;
350
298
  if (obj.icon) settings.icon = obj.icon;
@@ -355,38 +303,33 @@ var Utils = /*#__PURE__*/function () {
355
303
  if (!settings.icon && options.icon) settings.icon = options.icon;
356
304
  if (!settings.color && options.color) settings.color = options.color;
357
305
  }
358
-
359
306
  if (obj) {
360
307
  if (!settings.color && obj.color) settings.color = obj.color;
361
308
  if (!settings.icon && obj.icon) settings.icon = obj.icon;
362
309
  if (!settings.name && obj.name) settings.name = obj.name;
363
310
  }
364
311
  }
365
-
366
312
  if ((0, _typeof2["default"])(settings.name) === 'object') {
367
313
  settings.name = settings.name[options.language] || settings.name.en;
368
314
  settings.name = (settings.name || '').toString().replace(/_/g, ' ');
369
-
370
315
  if (settings.name === settings.name.toUpperCase()) {
371
316
  settings.name = settings.name[0] + settings.name.substring(1).toLowerCase();
372
317
  }
373
318
  }
374
-
375
319
  if (!settings.name && id) {
376
320
  var pos = id.lastIndexOf('.');
377
321
  settings.name = id.substring(pos + 1).replace(/[_.]/g, ' ');
378
322
  settings.name = (settings.name || '').toString().replace(/_/g, ' ');
379
323
  settings.name = Utils.CapitalWords(settings.name);
380
324
  }
381
-
382
325
  return settings;
383
326
  }
327
+
384
328
  /**
385
329
  * @param {any} obj
386
330
  * @param {any} settings
387
331
  * @param {{ user: any; language: ioBroker.Languages; }} options
388
332
  */
389
-
390
333
  }, {
391
334
  key: "setSettings",
392
335
  value: function setSettings(obj, settings, options) {
@@ -396,18 +339,15 @@ var Utils = /*#__PURE__*/function () {
396
339
  obj.common.custom[NAMESPACE] = obj.common.custom[NAMESPACE] || {};
397
340
  obj.common.custom[NAMESPACE][options.user || 'admin'] = settings;
398
341
  var s = obj.common.custom[NAMESPACE][options.user || 'admin'];
399
-
400
342
  if (s.useCommon) {
401
343
  if (s.color !== undefined) {
402
344
  obj.common.color = s.color;
403
345
  delete s.color;
404
346
  }
405
-
406
347
  if (s.icon !== undefined) {
407
348
  obj.common.icon = s.icon;
408
349
  delete s.icon;
409
350
  }
410
-
411
351
  if (s.name !== undefined) {
412
352
  if ((0, _typeof2["default"])(obj.common.name) !== 'object') {
413
353
  obj.common.name = {};
@@ -415,23 +355,21 @@ var Utils = /*#__PURE__*/function () {
415
355
  } else {
416
356
  obj.common.name[options.language] = s.name;
417
357
  }
418
-
419
358
  delete s.name;
420
359
  }
421
360
  }
422
-
423
361
  return true;
424
362
  } else {
425
363
  return false;
426
364
  }
427
365
  }
366
+
428
367
  /**
429
368
  * Get the icon for the given settings.
430
369
  * @param {{ icon: string | undefined; name: string | undefined; prefix: string | undefined}} settings
431
370
  * @param {any} style
432
371
  * @returns {JSX.Element | null}
433
372
  */
434
-
435
373
  }, {
436
374
  key: "getIcon",
437
375
  value: function getIcon(settings, style) {
@@ -456,16 +394,15 @@ var Utils = /*#__PURE__*/function () {
456
394
  });
457
395
  }
458
396
  }
459
-
460
397
  return null;
461
398
  }
399
+
462
400
  /**
463
401
  * Get the icon for the given object.
464
402
  * @param {string} id
465
403
  * @param {{ common: { icon: any; }; }} obj
466
404
  * @returns {string | null}
467
405
  */
468
-
469
406
  }, {
470
407
  key: "getObjectIcon",
471
408
  value: function getObjectIcon(id, obj) {
@@ -474,23 +411,20 @@ var Utils = /*#__PURE__*/function () {
474
411
  obj = id;
475
412
  id = obj._id;
476
413
  }
477
-
478
414
  if (obj && obj.common && obj.common.icon) {
479
- var icon = obj.common.icon; // If UTF-8 icon
480
-
415
+ var icon = obj.common.icon;
416
+ // If UTF-8 icon
481
417
  if (typeof icon === 'string' && icon.length <= 2) {
482
418
  return icon;
483
419
  } else if (icon.startsWith('data:image')) {
484
420
  return icon;
485
421
  } else {
486
422
  var parts = id.split('.');
487
-
488
423
  if (parts[0] === 'system') {
489
424
  icon = 'adapter/' + parts[2] + (icon.startsWith('/') ? '' : '/') + icon;
490
425
  } else {
491
426
  icon = 'adapter/' + parts[0] + (icon.startsWith('/') ? '' : '/') + icon;
492
427
  }
493
-
494
428
  if (window.location.pathname.match(/adapter\/[^/]+\/[^/]+\.html/)) {
495
429
  icon = '../../' + icon;
496
430
  } else if (window.location.pathname.match(/material\/[.\d]+/)) {
@@ -498,67 +432,57 @@ var Utils = /*#__PURE__*/function () {
498
432
  } else if (window.location.pathname.match(/material\//)) {
499
433
  icon = '../' + icon;
500
434
  }
501
-
502
435
  return icon;
503
436
  }
504
437
  } else {
505
438
  return null;
506
439
  }
507
440
  }
441
+
508
442
  /**
509
443
  * Splits CamelCase into words.
510
444
  * @param {string | undefined} text
511
445
  * @returns {string}
512
446
  */
513
-
514
447
  }, {
515
448
  key: "splitCamelCase",
516
449
  value: function splitCamelCase(text) {
517
450
  if (false && text !== text.toUpperCase()) {
518
451
  var words = text.split(/\s+/);
519
-
520
452
  for (var i = 0; i < words.length; i++) {
521
453
  var word = words[i];
522
-
523
454
  if (word.toLowerCase() !== word && word.toUpperCase() !== word) {
524
455
  var z = 0;
525
456
  var ww = [];
526
457
  var start = 0;
527
-
528
458
  while (z < word.length) {
529
459
  if (word[z].match(/[A-ZÜÄÖА-Я]/)) {
530
460
  ww.push(word.substring(start, z));
531
461
  start = z;
532
462
  }
533
-
534
463
  z++;
535
464
  }
536
-
537
465
  if (start !== z) {
538
466
  ww.push(word.substring(start, z));
539
467
  }
540
-
541
468
  for (var k = 0; k < ww.length; k++) {
542
469
  words.splice(i + k, 0, ww[k]);
543
470
  }
544
-
545
471
  i += ww.length;
546
472
  }
547
473
  }
548
-
549
474
  return words.map(function (w) {
550
475
  w = w.trim();
551
-
552
476
  if (w) {
553
477
  return w[0].toUpperCase() + w.substring(1).toLowerCase();
554
478
  }
555
-
556
479
  return '';
557
480
  }).join(' ');
558
481
  } else {
559
482
  return Utils.CapitalWords(text);
560
483
  }
561
484
  }
485
+
562
486
  /**
563
487
  * Check if the given color is bright.
564
488
  * https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
@@ -566,25 +490,20 @@ var Utils = /*#__PURE__*/function () {
566
490
  * @param {boolean} [defaultValue]
567
491
  * @returns {boolean}
568
492
  */
569
-
570
493
  }, {
571
494
  key: "isUseBright",
572
495
  value: function isUseBright(color, defaultValue) {
573
496
  if (color === null || color === undefined || color === '') {
574
497
  return defaultValue === undefined ? true : defaultValue;
575
498
  }
576
-
577
499
  color = color.toString();
578
-
579
500
  if (color.indexOf('#') === 0) {
580
501
  color = color.slice(1);
581
502
  }
582
-
583
503
  var r;
584
504
  var g;
585
505
  var b;
586
506
  var rgb = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
587
-
588
507
  if (rgb && rgb.length === 4) {
589
508
  r = parseInt(rgb[1], 10);
590
509
  g = parseInt(rgb[2], 10);
@@ -594,17 +513,15 @@ var Utils = /*#__PURE__*/function () {
594
513
  if (color.length === 3) {
595
514
  color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
596
515
  }
597
-
598
516
  if (color.length !== 6) {
599
517
  return false;
600
518
  }
601
-
602
519
  r = parseInt(color.slice(0, 2), 16);
603
520
  g = parseInt(color.slice(2, 4), 16);
604
521
  b = parseInt(color.slice(4, 6), 16);
605
- } // http://stackoverflow.com/a/3943023/112731
606
-
522
+ }
607
523
 
524
+ // http://stackoverflow.com/a/3943023/112731
608
525
  return r * 0.299 + g * 0.587 + b * 0.114 <= 186;
609
526
  }
610
527
  }, {
@@ -616,15 +533,12 @@ var Utils = /*#__PURE__*/function () {
616
533
  */
617
534
  function getTimeString(seconds) {
618
535
  seconds = parseFloat(seconds);
619
-
620
536
  if (isNaN(seconds)) {
621
537
  return '--:--';
622
538
  }
623
-
624
539
  var hours = Math.floor(seconds / 3600);
625
540
  var minutes = Math.floor(seconds % 3600 / 60);
626
541
  var secs = seconds % 60;
627
-
628
542
  if (hours) {
629
543
  if (minutes < 10) minutes = '0' + minutes;
630
544
  if (secs < 10) secs = '0' + secs;
@@ -634,12 +548,12 @@ var Utils = /*#__PURE__*/function () {
634
548
  return minutes + ':' + secs;
635
549
  }
636
550
  }
551
+
637
552
  /**
638
553
  * Gets the wind direction with the given angle (degrees).
639
554
  * @param {number} angle in degrees.
640
555
  * @returns {string | undefined}
641
556
  */
642
-
643
557
  }, {
644
558
  key: "getWindDirection",
645
559
  value: function getWindDirection(angle) {
@@ -679,11 +593,11 @@ var Utils = /*#__PURE__*/function () {
679
593
  return 'N';
680
594
  }
681
595
  }
596
+
682
597
  /**
683
598
  * Pad the given number with a zero if its not 2 digits long.
684
599
  * @param {string | number} num
685
600
  */
686
-
687
601
  }, {
688
602
  key: "padding",
689
603
  value: function padding(num) {
@@ -699,11 +613,11 @@ var Utils = /*#__PURE__*/function () {
699
613
  return num;
700
614
  }
701
615
  }
616
+
702
617
  /**
703
618
  * Sets the date format.
704
619
  * @param {string} format
705
620
  */
706
-
707
621
  }, {
708
622
  key: "setDataFormat",
709
623
  value: function setDataFormat(format) {
@@ -712,26 +626,24 @@ var Utils = /*#__PURE__*/function () {
712
626
  Utils.dateFormat.splice(Utils.dateFormat.indexOf('YYYY'), 1);
713
627
  }
714
628
  }
629
+
715
630
  /**
716
631
  * Converts the date to a string.
717
632
  * @param {string | number | Date} now
718
633
  * @returns {string}
719
634
  */
720
-
721
635
  }, {
722
636
  key: "date2string",
723
637
  value: function date2string(now) {
724
638
  if (typeof now === 'string') {
725
639
  now = now.trim();
726
- if (!now) return ''; // only letters
727
-
640
+ if (!now) return '';
641
+ // only letters
728
642
  if (now.match(/^[\w\s]+$/)) {
729
643
  // Day of week
730
644
  return now;
731
645
  }
732
-
733
646
  var m = now.match(/(\d{1,4})[-./](\d{1,2})[-./](\d{1,4})/);
734
-
735
647
  if (m) {
736
648
  var a = [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)];
737
649
  var year = a.find(function (y) {
@@ -741,7 +653,6 @@ var Utils = /*#__PURE__*/function () {
741
653
  var day = a.find(function (m) {
742
654
  return m > 12;
743
655
  });
744
-
745
656
  if (day) {
746
657
  a.splice(a.indexOf(day), 1);
747
658
  now = new Date(year, a[0] - 1, day);
@@ -749,14 +660,13 @@ var Utils = /*#__PURE__*/function () {
749
660
  // MM DD
750
661
  if (Utils.dateFormat[0][0] === 'M' && Utils.dateFormat[1][0] === 'D') {
751
662
  now = new Date(year, a[0] - 1, a[1]);
752
-
753
663
  if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
754
664
  now = new Date(year, a[1] - 1, a[0]);
755
665
  }
756
- } else // DD MM
666
+ } else
667
+ // DD MM
757
668
  if (Utils.dateFormat[0][0] === 'D' && Utils.dateFormat[1][0] === 'M') {
758
669
  now = new Date(year, a[1] - 1, a[0]);
759
-
760
670
  if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
761
671
  now = new Date(year, a[0] - 1, a[1]);
762
672
  }
@@ -770,33 +680,28 @@ var Utils = /*#__PURE__*/function () {
770
680
  } else {
771
681
  now = new Date(now);
772
682
  }
773
-
774
683
  var date = _i18n["default"].t('ra_dow_' + days[now.getDay()]).replace('ra_dow_', '');
775
-
776
684
  date += '. ' + now.getDate() + ' ' + _i18n["default"].t('ra_month_' + months[now.getMonth()]).replace('ra_month_', '');
777
685
  return date;
778
686
  }
687
+
779
688
  /**
780
689
  * Render a text as a link.
781
690
  * @param {string} text
782
691
  * @returns {string | JSX.Element[]}
783
692
  */
784
-
785
693
  }, {
786
694
  key: "renderTextWithA",
787
695
  value: function renderTextWithA(text) {
788
696
  var m = text.match(/<a [^<]+<\/a>|<br\/?>/);
789
-
790
697
  if (m) {
791
698
  var result = [];
792
699
  var key = 1;
793
-
794
700
  do {
795
701
  var p = text.split(m[0]);
796
702
  p[0] && result.push( /*#__PURE__*/_react["default"].createElement("span", {
797
703
  key: 'a' + key++
798
704
  }, p[0]));
799
-
800
705
  if (m[0].startsWith('<br')) {
801
706
  result.push( /*#__PURE__*/_react["default"].createElement("br", {
802
707
  key: 'a' + key++
@@ -805,8 +710,9 @@ var Utils = /*#__PURE__*/function () {
805
710
  var href = m[0].match(/href="([^"]+)"/) || m[0].match(/href='([^']+)'/);
806
711
  var target = m[0].match(/target="([^"]+)"/) || m[0].match(/target='([^']+)'/);
807
712
  var rel = m[0].match(/rel="([^"]+)"/) || m[0].match(/rel='([^']+)'/);
808
- var title = m[0].match(/>([^<]*)</); // eslint-disable-next-line
713
+ var title = m[0].match(/>([^<]*)</);
809
714
 
715
+ // eslint-disable-next-line
810
716
  result.push( /*#__PURE__*/_react["default"].createElement("a", {
811
717
  key: 'a' + key++,
812
718
  href: href ? href[1] : '',
@@ -814,22 +720,20 @@ var Utils = /*#__PURE__*/function () {
814
720
  rel: rel ? rel[1] : ''
815
721
  }, title ? title[1] : ''));
816
722
  }
817
-
818
723
  text = p[1];
819
724
  m = text && text.match(/<a [^<]+<\/a>|<br\/?>/);
820
-
821
725
  if (!m) {
822
726
  p[1] && result.push( /*#__PURE__*/_react["default"].createElement("span", {
823
727
  key: 'a' + key++
824
728
  }, p[1]));
825
729
  }
826
730
  } while (m);
827
-
828
731
  return result;
829
732
  } else {
830
733
  return text;
831
734
  }
832
735
  }
736
+
833
737
  /**
834
738
  * Get the smart name of the given state.
835
739
  * @param {Record<string, ioBroker.StateObject> | ioBroker.StateObject} states
@@ -837,7 +741,6 @@ var Utils = /*#__PURE__*/function () {
837
741
  * @param {string} instanceId
838
742
  * @param {boolean} [noCommon]
839
743
  */
840
-
841
744
  }, {
842
745
  key: "getSmartName",
843
746
  value: function getSmartName(states, id, instanceId, noCommon) {
@@ -865,13 +768,13 @@ var Utils = /*#__PURE__*/function () {
865
768
  return states[id] && states[id].common && states[id].common.custom && states[id].common.custom[instanceId] ? states[id].common.custom[instanceId].smartName || null : null;
866
769
  }
867
770
  }
771
+
868
772
  /**
869
773
  * Get the smart name from a state.
870
774
  * @param {ioBroker.StateObject} obj
871
775
  * @param {string} instanceId
872
776
  * @param {boolean} [noCommon]
873
777
  */
874
-
875
778
  }, {
876
779
  key: "getSmartNameFromObj",
877
780
  value: function getSmartNameFromObj(obj, instanceId, noCommon) {
@@ -893,13 +796,13 @@ var Utils = /*#__PURE__*/function () {
893
796
  }
894
797
  }
895
798
  }
799
+
896
800
  /**
897
801
  * Enable smart name for a state.
898
802
  * @param {ioBroker.StateObject} obj
899
803
  * @param {string} instanceId
900
804
  * @param {boolean} [noCommon]
901
805
  */
902
-
903
806
  }, {
904
807
  key: "enableSmartName",
905
808
  value: function enableSmartName(obj, instanceId, noCommon) {
@@ -911,13 +814,13 @@ var Utils = /*#__PURE__*/function () {
911
814
  obj.common.smartName = {};
912
815
  }
913
816
  }
817
+
914
818
  /**
915
819
  * Completely remove smart name from a state.
916
820
  * @param {ioBroker.StateObject} obj
917
821
  * @param {string | number} instanceId
918
822
  * @param {boolean} [noCommon]
919
823
  */
920
-
921
824
  }, {
922
825
  key: "removeSmartName",
923
826
  value: function removeSmartName(obj, instanceId, noCommon) {
@@ -929,6 +832,7 @@ var Utils = /*#__PURE__*/function () {
929
832
  obj.common.smartName = null;
930
833
  }
931
834
  }
835
+
932
836
  /**
933
837
  * Update the smartname of a state.
934
838
  * @param {ioBroker.StateObject} obj
@@ -938,40 +842,35 @@ var Utils = /*#__PURE__*/function () {
938
842
  * @param {string} instanceId
939
843
  * @param {boolean} [noCommon]
940
844
  */
941
-
942
845
  }, {
943
846
  key: "updateSmartName",
944
847
  value: function updateSmartName(obj, newSmartName, byON, smartType, instanceId, noCommon) {
945
- var language = _i18n["default"].getLanguage(); // convert Old format
946
-
848
+ var language = _i18n["default"].getLanguage();
947
849
 
850
+ // convert Old format
948
851
  if (typeof obj.common.smartName === 'string') {
949
852
  var nnn = obj.common.smartName;
950
853
  obj.common.smartName = {};
951
854
  obj.common.smartName[language] = nnn;
952
- } // convert old settings
953
-
855
+ }
954
856
 
857
+ // convert old settings
955
858
  if (obj["native"] && obj["native"].byON) {
956
859
  delete obj["native"].byON;
957
860
  var _smartName = obj.common.smartName;
958
-
959
861
  if (!_smartName || (0, _typeof2["default"])(_smartName) !== 'object') {
960
862
  _smartName = {
961
863
  en: _smartName
962
864
  };
963
865
  _smartName[language] = _smartName.en;
964
866
  }
965
-
966
867
  obj.common.smartName = _smartName;
967
868
  }
968
-
969
869
  if (smartType !== undefined) {
970
870
  if (noCommon) {
971
871
  obj.common.custom = obj.common.custom || {};
972
872
  obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
973
873
  obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};
974
-
975
874
  if (!smartType) {
976
875
  delete obj.common.custom[instanceId].smartName.smartType;
977
876
  } else {
@@ -979,7 +878,6 @@ var Utils = /*#__PURE__*/function () {
979
878
  }
980
879
  } else {
981
880
  obj.common.smartName = obj.common.smartName || {};
982
-
983
881
  if (!smartType) {
984
882
  delete obj.common.smartName.smartType;
985
883
  } else {
@@ -987,7 +885,6 @@ var Utils = /*#__PURE__*/function () {
987
885
  }
988
886
  }
989
887
  }
990
-
991
888
  if (byON !== undefined) {
992
889
  if (noCommon) {
993
890
  obj.common.custom = obj.common.custom || {};
@@ -999,10 +896,8 @@ var Utils = /*#__PURE__*/function () {
999
896
  obj.common.smartName.byON = byON;
1000
897
  }
1001
898
  }
1002
-
1003
899
  if (newSmartName !== undefined) {
1004
900
  var smartName;
1005
-
1006
901
  if (noCommon) {
1007
902
  obj.common.custom = obj.common.custom || {};
1008
903
  obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
@@ -1012,21 +907,20 @@ var Utils = /*#__PURE__*/function () {
1012
907
  obj.common.smartName = obj.common.smartName || {};
1013
908
  smartName = obj.common.smartName;
1014
909
  }
910
+ smartName[language] = newSmartName;
1015
911
 
1016
- smartName[language] = newSmartName; // If smart name deleted
1017
-
912
+ // If smart name deleted
1018
913
  if (smartName && (!smartName[language] || smartName[language] === obj.common.name && (!obj.common.role || obj.common.role.indexOf('button') >= 0))) {
1019
914
  delete smartName[language];
1020
- var empty = true; // Check if structure has any definitions
1021
-
915
+ var empty = true;
916
+ // Check if structure has any definitions
1022
917
  for (var key in smartName) {
1023
918
  if (smartName.hasOwnProperty(key)) {
1024
919
  empty = false;
1025
920
  break;
1026
921
  }
1027
- } // If empty => delete smartName completely
1028
-
1029
-
922
+ }
923
+ // If empty => delete smartName completely
1030
924
  if (empty) {
1031
925
  if (noCommon) {
1032
926
  if (obj.common.custom[instanceId].smartName.byON === undefined) {
@@ -1063,13 +957,13 @@ var Utils = /*#__PURE__*/function () {
1063
957
  }
1064
958
  }
1065
959
  }
960
+
1066
961
  /**
1067
962
  * Disable the smart name of a state.
1068
963
  * @param {ioBroker.StateObject} obj
1069
964
  * @param {string} instanceId
1070
965
  * @param {boolean} [noCommon]
1071
966
  */
1072
-
1073
967
  }, {
1074
968
  key: "disableSmartName",
1075
969
  value: function disableSmartName(obj, instanceId, noCommon) {
@@ -1081,12 +975,12 @@ var Utils = /*#__PURE__*/function () {
1081
975
  obj.common.smartName = false;
1082
976
  }
1083
977
  }
978
+
1084
979
  /**
1085
980
  * Copy text to the clipboard.
1086
981
  * @param {string} text
1087
982
  * @param {Event} [e]
1088
983
  */
1089
-
1090
984
  }, {
1091
985
  key: "copyToClipboard",
1092
986
  value: function copyToClipboard(text, e) {
@@ -1100,48 +994,45 @@ var Utils = /*#__PURE__*/function () {
1100
994
  e && e.stopPropagation();
1101
995
  e && e.preventDefault();
1102
996
  }
997
+
1103
998
  /**
1104
999
  * Gets the extension of a file name.
1105
1000
  * @param {string | null} [fileName] the file name.
1106
1001
  * @returns {string | null} The extension in lower case.
1107
1002
  */
1108
-
1109
1003
  }, {
1110
1004
  key: "getFileExtension",
1111
1005
  value: function getFileExtension(fileName) {
1112
1006
  var pos = (fileName || '').lastIndexOf('.');
1113
-
1114
1007
  if (pos !== -1) {
1115
1008
  return fileName.substring(pos + 1).toLowerCase();
1116
1009
  } else {
1117
1010
  return null;
1118
1011
  }
1119
1012
  }
1013
+
1120
1014
  /**
1121
1015
  * Format number of bytes as a string with B, KB, MB or GB.
1122
1016
  * The base for all calculations is 1024.
1123
1017
  * @param {number} bytes The number of bytes.
1124
1018
  * @returns {string} The formatted string (e.g. '723.5 KB')
1125
1019
  */
1126
-
1127
1020
  }, {
1128
1021
  key: "formatBytes",
1129
1022
  value: function formatBytes(bytes) {
1130
1023
  if (Math.abs(bytes) < 1024) {
1131
1024
  return bytes + ' B';
1132
1025
  }
1133
-
1134
- var units = ['KB', 'MB', 'GB']; //const units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
1135
-
1026
+ var units = ['KB', 'MB', 'GB'];
1027
+ //const units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
1136
1028
  var u = -1;
1137
-
1138
1029
  do {
1139
1030
  bytes /= 1024;
1140
1031
  ++u;
1141
1032
  } while (Math.abs(bytes) >= 1024 && u < units.length - 1);
1142
-
1143
1033
  return bytes.toFixed(1) + ' ' + units[u];
1144
1034
  }
1035
+
1145
1036
  /**
1146
1037
  * Invert the given color according to theme type to get the inverted text color for background
1147
1038
  * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without hash)
@@ -1149,7 +1040,6 @@ var Utils = /*#__PURE__*/function () {
1149
1040
  * @param {string} invert dark theme has light color in control or light theme has light color in control
1150
1041
  * @returns {string}
1151
1042
  */
1152
-
1153
1043
  }, {
1154
1044
  key: "getInvertedColor",
1155
1045
  value: function getInvertedColor(color, themeType, invert) {
@@ -1157,7 +1047,6 @@ var Utils = /*#__PURE__*/function () {
1157
1047
  return undefined;
1158
1048
  } else {
1159
1049
  var invertedColor = Utils.invertColor(color, true);
1160
-
1161
1050
  if (invertedColor === '#FFFFFF' && (themeType === 'dark' || invert && themeType === 'light')) {
1162
1051
  return '#DDD';
1163
1052
  } else if (invertedColor === '#000000' && (themeType === 'light' || invert && themeType === 'dark')) {
@@ -1166,80 +1055,71 @@ var Utils = /*#__PURE__*/function () {
1166
1055
  return undefined;
1167
1056
  }
1168
1057
  }
1169
- } // Big thanks to: https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
1058
+ }
1170
1059
 
1060
+ // Big thanks to: https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
1171
1061
  /**
1172
1062
  * Invert the given color
1173
1063
  * @param {string} hex Color in the format '#rrggbb' or '#rgb' (or without hash)
1174
1064
  * @param {boolean} bw Set to black or white.
1175
1065
  * @returns {string}
1176
1066
  */
1177
-
1178
1067
  }, {
1179
1068
  key: "invertColor",
1180
1069
  value: function invertColor(hex, bw) {
1181
1070
  if (hex === undefined || hex === null || hex === '' || typeof hex !== 'string') {
1182
1071
  return '';
1183
1072
  }
1184
-
1185
1073
  if (hex.startsWith('rgba')) {
1186
1074
  var m = hex.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([.\d]+)\)/);
1187
-
1188
1075
  if (m) {
1189
1076
  hex = parseInt(m[1], 10).toString(16).padStart(2, '0') + parseInt(m[2], 10).toString(16).padStart(2, '0') + parseInt(m[2], 10).toString(16).padStart(2, '0');
1190
1077
  }
1191
1078
  } else if (hex.startsWith('rgba')) {
1192
1079
  var _m = hex.match(/rgb?\((\d+),\s*(\d+),\s*(\d+)\)/);
1193
-
1194
1080
  if (_m) {
1195
1081
  hex = parseInt(_m[1], 10).toString(16).padStart(2, '0') + parseInt(_m[2], 10).toString(16).padStart(2, '0') + parseInt(_m[2], 10).toString(16).padStart(2, '0');
1196
1082
  }
1197
1083
  } else if (hex.startsWith('#')) {
1198
1084
  hex = hex.slice(1);
1199
- } // convert 3-digit hex to 6-digits.
1200
-
1201
-
1085
+ }
1086
+ // convert 3-digit hex to 6-digits.
1202
1087
  if (hex.length === 3) {
1203
1088
  hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
1204
1089
  }
1205
-
1206
1090
  if (hex.length !== 6) {
1207
1091
  console.warn('Cannot invert color: ' + hex);
1208
1092
  return hex;
1209
1093
  }
1210
-
1211
1094
  var r = parseInt(hex.slice(0, 2), 16);
1212
1095
  var g = parseInt(hex.slice(2, 4), 16);
1213
1096
  var b = parseInt(hex.slice(4, 6), 16);
1214
-
1215
1097
  if (bw) {
1216
1098
  // http://stackoverflow.com/a/3943023/112731
1217
1099
  return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF';
1218
- } // invert color components
1219
-
1220
-
1100
+ }
1101
+ // invert color components
1221
1102
  r = (255 - r).toString(16);
1222
1103
  g = (255 - g).toString(16);
1223
- b = (255 - b).toString(16); // pad each with zeros and return
1224
-
1104
+ b = (255 - b).toString(16);
1105
+ // pad each with zeros and return
1225
1106
  return '#' + r.padStart(2, '0') + g.padStart(2, '0') + b.padStart(2, '0');
1226
- } // https://github.com/lukeed/clsx/blob/master/src/index.js
1107
+ }
1108
+
1109
+ // https://github.com/lukeed/clsx/blob/master/src/index.js
1227
1110
  // License
1228
1111
  // MIT © Luke Edwards
1229
-
1230
1112
  /**
1231
1113
  * @private
1232
1114
  * @param {any} mix
1233
1115
  * @returns {string}
1234
1116
  */
1235
-
1236
1117
  }, {
1237
1118
  key: "_toVal",
1238
1119
  value: function _toVal(mix) {
1239
1120
  var k;
1240
1121
  var y;
1241
1122
  var str = '';
1242
-
1243
1123
  if (typeof mix === 'string' || typeof mix === 'number') {
1244
1124
  str += mix;
1245
1125
  } else if ((0, _typeof2["default"])(mix) === 'object') {
@@ -1261,17 +1141,16 @@ var Utils = /*#__PURE__*/function () {
1261
1141
  }
1262
1142
  }
1263
1143
  }
1264
-
1265
1144
  return str;
1266
- } // https://github.com/lukeed/clsx/blob/master/src/index.js
1145
+ }
1146
+
1147
+ // https://github.com/lukeed/clsx/blob/master/src/index.js
1267
1148
  // License
1268
1149
  // MIT © Luke Edwards
1269
-
1270
1150
  /**
1271
1151
  * Convert any object to a string with its values.
1272
1152
  * @returns {string}
1273
1153
  */
1274
-
1275
1154
  }, {
1276
1155
  key: "clsx",
1277
1156
  value: function clsx() {
@@ -1279,7 +1158,6 @@ var Utils = /*#__PURE__*/function () {
1279
1158
  var tmp;
1280
1159
  var x;
1281
1160
  var str = '';
1282
-
1283
1161
  while (i < arguments.length) {
1284
1162
  if (tmp = arguments[i++]) {
1285
1163
  if (x = Utils._toVal(tmp)) {
@@ -1288,49 +1166,44 @@ var Utils = /*#__PURE__*/function () {
1288
1166
  }
1289
1167
  }
1290
1168
  }
1291
-
1292
1169
  return str;
1293
1170
  }
1171
+
1294
1172
  /**
1295
1173
  * Get the current theme name (either from local storage or the browser settings).
1296
1174
  * @param {string} [themeName]
1297
1175
  * @returns {string}
1298
1176
  */
1299
-
1300
1177
  }, {
1301
1178
  key: "getThemeName",
1302
1179
  value: function getThemeName() {
1303
1180
  var themeName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1304
-
1305
1181
  if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {
1306
1182
  return window.vendorPrefix;
1307
1183
  }
1308
-
1309
1184
  return themeName ? themeName : (window._localStorage || window.localStorage) && (window._localStorage || window.localStorage).getItem('App.themeName') ? (window._localStorage || window.localStorage).getItem('App.themeName') : window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'colored';
1310
1185
  }
1186
+
1311
1187
  /**
1312
1188
  * Get the type of theme.
1313
1189
  * @param {string} [themeName]
1314
1190
  * @returns {'dark' | 'light'}
1315
1191
  */
1316
-
1317
1192
  }, {
1318
1193
  key: "getThemeType",
1319
1194
  value: function getThemeType() {
1320
1195
  var themeName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1321
-
1322
1196
  if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {
1323
1197
  return 'light';
1324
1198
  }
1325
-
1326
1199
  themeName = themeName || (window._localStorage || window.localStorage) && (window._localStorage || window.localStorage).getItem('App.themeName');
1327
1200
  return themeName === 'dark' || themeName === 'blue' ? 'dark' : 'light';
1328
1201
  }
1202
+
1329
1203
  /**
1330
1204
  * Set the theme name and theme type.
1331
1205
  * @param {string} themeName
1332
1206
  */
1333
-
1334
1207
  }, {
1335
1208
  key: "setThemeName",
1336
1209
  value: function setThemeName(themeName) {
@@ -1341,78 +1214,70 @@ var Utils = /*#__PURE__*/function () {
1341
1214
  (window._localStorage || window.localStorage).setItem('App.themeName', themeName);
1342
1215
  (window._localStorage || window.localStorage).setItem('App.theme', themeName === 'dark' || themeName === 'blue' ? 'dark' : 'light');
1343
1216
  }
1217
+
1344
1218
  /**
1345
1219
  * Toggle the theme name between 'dark' and 'colored'.
1346
1220
  * @param {string | null} themeName
1347
1221
  * @returns {string} the new theme name.
1348
1222
  */
1349
-
1350
1223
  }, {
1351
1224
  key: "toggleTheme",
1352
1225
  value: function toggleTheme(themeName) {
1353
1226
  if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {
1354
1227
  return window.vendorPrefix;
1355
1228
  }
1229
+ themeName = themeName || (window._localStorage || window.localStorage) && (window._localStorage || window.localStorage).getItem('App.themeName');
1356
1230
 
1357
- themeName = themeName || (window._localStorage || window.localStorage) && (window._localStorage || window.localStorage).getItem('App.themeName'); // dark => blue => colored => light => dark
1358
-
1231
+ // dark => blue => colored => light => dark
1359
1232
  var themes = Utils.getThemeNames();
1360
1233
  var pos = themes.indexOf(themeName);
1361
1234
  var newTheme;
1362
-
1363
1235
  if (pos !== -1) {
1364
1236
  newTheme = themes[(pos + 1) % themes.length];
1365
1237
  } else {
1366
1238
  newTheme = themes[0];
1367
1239
  }
1368
-
1369
1240
  Utils.setThemeName(newTheme);
1370
1241
  return newTheme;
1371
1242
  }
1243
+
1372
1244
  /**
1373
1245
  * Get the list of themes
1374
1246
  * @returns {array<string>} list of possible themes
1375
1247
  */
1376
-
1377
1248
  }, {
1378
1249
  key: "getThemeNames",
1379
1250
  value: function getThemeNames() {
1380
1251
  if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {
1381
1252
  return [window.vendorPrefix];
1382
1253
  }
1383
-
1384
1254
  return ['light', 'dark', 'blue', 'colored'];
1385
1255
  }
1256
+
1386
1257
  /**
1387
1258
  * Parse a query string into its parts.
1388
1259
  * @param {string} query
1389
1260
  * @returns {Record<string, string | boolean | number>}
1390
1261
  */
1391
-
1392
1262
  }, {
1393
1263
  key: "parseQuery",
1394
1264
  value: function parseQuery(query) {
1395
1265
  query = (query || '').toString().replace(/^\?/, '');
1396
1266
  /** @type {Record<string, string | boolean | number>} */
1397
-
1398
1267
  var result = {};
1399
1268
  query.split('&').forEach(function (part) {
1400
1269
  part = part.trim();
1401
-
1402
1270
  if (part) {
1403
1271
  var parts = part.split('=');
1404
1272
  var attr = decodeURIComponent(parts[0]).trim();
1405
-
1406
1273
  if (parts.length > 1) {
1407
1274
  result[attr] = decodeURIComponent(parts[1]);
1408
-
1409
1275
  if (result[attr] === 'true') {
1410
1276
  result[attr] = true;
1411
1277
  } else if (result[attr] === 'false') {
1412
1278
  result[attr] = false;
1413
1279
  } else {
1414
1280
  var f = parseFloat(result[attr]);
1415
-
1416
1281
  if (f.toString() === result[attr]) {
1417
1282
  result[attr] = f;
1418
1283
  }
@@ -1424,17 +1289,16 @@ var Utils = /*#__PURE__*/function () {
1424
1289
  });
1425
1290
  return result;
1426
1291
  }
1292
+
1427
1293
  /**
1428
1294
  * Returns parent ID.
1429
1295
  * @param {string} id
1430
1296
  * @returns {string | null} parent ID or null if no parent
1431
1297
  */
1432
-
1433
1298
  }, {
1434
1299
  key: "getParentId",
1435
1300
  value: function getParentId(id) {
1436
1301
  var p = (id || '').toString().split('.');
1437
-
1438
1302
  if (p.length > 1) {
1439
1303
  p.pop();
1440
1304
  return p.join('.');
@@ -1446,56 +1310,45 @@ var Utils = /*#__PURE__*/function () {
1446
1310
  key: "formatDate",
1447
1311
  value: function formatDate(dateObj, dateFormat) {
1448
1312
  // format could be DD.MM.YYYY, YYYY.MM.DD or MM/DD/YYYY
1313
+
1449
1314
  if (!dateObj) {
1450
1315
  return '';
1451
1316
  }
1452
-
1453
1317
  var text;
1454
1318
  var mm = dateObj.getMonth() + 1;
1455
-
1456
1319
  if (mm < 10) {
1457
1320
  mm = '0' + mm;
1458
1321
  }
1459
-
1460
1322
  var dd = dateObj.getDate();
1461
-
1462
1323
  if (dd < 10) {
1463
1324
  dd = '0' + dd;
1464
1325
  }
1465
-
1466
1326
  if (dateFormat === 'MM/DD/YYYY') {
1467
1327
  text = mm + '/' + dd + '/' + dateObj.getFullYear();
1468
1328
  } else {
1469
1329
  text = dateObj.getFullYear() + '-' + mm + '-' + dd;
1470
- } // time
1471
-
1330
+ }
1472
1331
 
1332
+ // time
1473
1333
  var v = dateObj.getHours();
1474
-
1475
1334
  if (v < 10) {
1476
1335
  text += ' 0' + v;
1477
1336
  } else {
1478
1337
  text += ' ' + v;
1479
1338
  }
1480
-
1481
1339
  v = dateObj.getMinutes();
1482
-
1483
1340
  if (v < 10) {
1484
1341
  text += ':0' + v;
1485
1342
  } else {
1486
1343
  text += ':' + v;
1487
1344
  }
1488
-
1489
1345
  v = dateObj.getSeconds();
1490
-
1491
1346
  if (v < 10) {
1492
1347
  text += ':0' + v;
1493
1348
  } else {
1494
1349
  text += ':' + v;
1495
1350
  }
1496
-
1497
1351
  v = dateObj.getMilliseconds();
1498
-
1499
1352
  if (v < 10) {
1500
1353
  text += '.00' + v;
1501
1354
  } else if (v < 100) {
@@ -1503,7 +1356,6 @@ var Utils = /*#__PURE__*/function () {
1503
1356
  } else {
1504
1357
  text += '.' + v;
1505
1358
  }
1506
-
1507
1359
  return text;
1508
1360
  }
1509
1361
  }, {
@@ -1515,7 +1367,6 @@ var Utils = /*#__PURE__*/function () {
1515
1367
  var h = Math.floor(seconds % (3600 * 24) / 3600);
1516
1368
  var m = Math.floor(seconds % 3600 / 60);
1517
1369
  var s = seconds % 60;
1518
-
1519
1370
  if (d) {
1520
1371
  return "".concat(d, ".").concat(h.toString().padStart(2, '0'), ":").concat(m.toString().padStart(2, '0'), ":").concat(s.toString().padStart(2, '0'));
1521
1372
  } else if (h) {
@@ -1531,11 +1382,9 @@ var Utils = /*#__PURE__*/function () {
1531
1382
  key: "MDtext2link",
1532
1383
  value: function MDtext2link(text) {
1533
1384
  var m = text.match(/\d+\.\)\s/);
1534
-
1535
1385
  if (m) {
1536
1386
  text = text.replace(m[0], m[0].replace(/\s/, '&nbsp;'));
1537
1387
  }
1538
-
1539
1388
  return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
1540
1389
  }
1541
1390
  }, {
@@ -1543,7 +1392,6 @@ var Utils = /*#__PURE__*/function () {
1543
1392
  value: function openLink(url, target) {
1544
1393
  // replace IPv6 Address with [ipv6]:port
1545
1394
  url = url.replace(/\/\/([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*)(:\d+)?\//i, '//[$1]$2/');
1546
-
1547
1395
  if (target === 'this') {
1548
1396
  window.location = url;
1549
1397
  } else {
@@ -1554,21 +1402,18 @@ var Utils = /*#__PURE__*/function () {
1554
1402
  key: "MDgetTitle",
1555
1403
  value: function MDgetTitle(text) {
1556
1404
  var _Utils$extractHeader = Utils.extractHeader(text),
1557
- body = _Utils$extractHeader.body,
1558
- header = _Utils$extractHeader.header;
1559
-
1405
+ body = _Utils$extractHeader.body,
1406
+ header = _Utils$extractHeader.header;
1560
1407
  if (!header.title) {
1561
1408
  // remove {docsify-bla}
1562
1409
  body = body.replace(/{[^}]*}/g, '');
1563
1410
  body = body.trim();
1564
1411
  var lines = body.replace(/\r/g, '').split('\n');
1565
-
1566
1412
  for (var i = 0; i < lines.length; i++) {
1567
1413
  if (lines[i].startsWith('# ')) {
1568
1414
  return lines[i].substring(2).trim();
1569
1415
  }
1570
1416
  }
1571
-
1572
1417
  return '';
1573
1418
  } else {
1574
1419
  return header.title;
@@ -1578,27 +1423,20 @@ var Utils = /*#__PURE__*/function () {
1578
1423
  key: "MDextractHeader",
1579
1424
  value: function MDextractHeader(text) {
1580
1425
  var attrs = {};
1581
-
1582
1426
  if (text.substring(0, 3) === '---') {
1583
1427
  var pos = text.substring(3).indexOf('\n---');
1584
-
1585
1428
  if (pos !== -1) {
1586
1429
  var _header = text.substring(3, pos + 3);
1587
-
1588
1430
  var lines = _header.replace(/\r/g, '').split('\n');
1589
-
1590
1431
  lines.forEach(function (line) {
1591
1432
  if (!line.trim()) {
1592
1433
  return;
1593
1434
  }
1594
-
1595
1435
  var pos = line.indexOf(':');
1596
-
1597
1436
  if (pos !== -1) {
1598
1437
  var attr = line.substring(0, pos).trim();
1599
1438
  attrs[attr] = line.substring(pos + 1).trim();
1600
1439
  attrs[attr] = attrs[attr].replace(/^['"]|['"]$/g, '');
1601
-
1602
1440
  if (attrs[attr] === 'true') {
1603
1441
  attrs[attr] = true;
1604
1442
  } else if (attrs[attr] === 'false') {
@@ -1613,7 +1451,6 @@ var Utils = /*#__PURE__*/function () {
1613
1451
  text = text.substring(pos + 7);
1614
1452
  }
1615
1453
  }
1616
-
1617
1454
  return {
1618
1455
  header: attrs,
1619
1456
  body: text
@@ -1623,21 +1460,19 @@ var Utils = /*#__PURE__*/function () {
1623
1460
  key: "MDremoveDocsify",
1624
1461
  value: function MDremoveDocsify(text) {
1625
1462
  var m = text.match(/{docsify-[^}]*}/g);
1626
-
1627
1463
  if (m) {
1628
1464
  m.forEach(function (doc) {
1629
1465
  return text = text.replace(doc, '');
1630
1466
  });
1631
1467
  }
1632
-
1633
1468
  return text;
1634
1469
  }
1470
+
1635
1471
  /**
1636
1472
  * Generate the json file on the file for download.
1637
1473
  * @param {string} filename file name
1638
1474
  * @returns {object} json structure (not stringified)
1639
1475
  */
1640
-
1641
1476
  }, {
1642
1477
  key: "generateFile",
1643
1478
  value: function generateFile(filename, json) {
@@ -1649,19 +1484,18 @@ var Utils = /*#__PURE__*/function () {
1649
1484
  el.click();
1650
1485
  document.body.removeChild(el);
1651
1486
  }
1487
+
1652
1488
  /**
1653
1489
  * Convert quality code into text
1654
1490
  * @param {number} quality code
1655
1491
  * @returns {array<string>} lines that decode qulity
1656
1492
  */
1657
-
1658
1493
  }, {
1659
1494
  key: "quality2text",
1660
1495
  value: function quality2text(quality) {
1661
1496
  var custom = quality & 0xFFFF0000;
1662
1497
  var text = QUALITY_BITS[quality];
1663
1498
  var result;
1664
-
1665
1499
  if (text) {
1666
1500
  result = [text];
1667
1501
  } else if (quality & 0x01) {
@@ -1671,37 +1505,33 @@ var Utils = /*#__PURE__*/function () {
1671
1505
  } else {
1672
1506
  result = ['0x' + quality.toString(16)];
1673
1507
  }
1674
-
1675
1508
  if (custom) {
1676
1509
  result.push('0x' + (custom >> 16).toString(16).toUpperCase());
1677
1510
  }
1678
-
1679
1511
  return result;
1680
1512
  }
1513
+
1681
1514
  /**
1682
1515
  * Deep copy object
1683
1516
  * @param {object} object
1684
1517
  * @returns {object}
1685
1518
  */
1686
-
1687
1519
  }, {
1688
1520
  key: "clone",
1689
1521
  value: function clone(object) {
1690
1522
  return JSON.parse(JSON.stringify(object));
1691
1523
  }
1524
+
1692
1525
  /**
1693
1526
  * Get states of object
1694
1527
  * @param {object} obj
1695
1528
  * @returns {object} states as an object in form {"value1": "label1", "value2": "label2"} or null
1696
1529
  */
1697
-
1698
1530
  }, {
1699
1531
  key: "getStates",
1700
1532
  value: function getStates(obj) {
1701
1533
  var _obj$common;
1702
-
1703
1534
  var states = obj === null || obj === void 0 ? void 0 : (_obj$common = obj.common) === null || _obj$common === void 0 ? void 0 : _obj$common.states;
1704
-
1705
1535
  if (states) {
1706
1536
  if (typeof states === 'string' && states[0] === '{') {
1707
1537
  try {
@@ -1710,18 +1540,17 @@ var Utils = /*#__PURE__*/function () {
1710
1540
  console.error("Cannot parse states: ".concat(states));
1711
1541
  states = null;
1712
1542
  }
1713
- } else // if old format val1:text1;val2:text2
1543
+ } else
1544
+ // if old format val1:text1;val2:text2
1714
1545
  if (typeof states === 'string') {
1715
1546
  var parts = states.split(';');
1716
1547
  states = {};
1717
-
1718
1548
  for (var p = 0; p < parts.length; p++) {
1719
1549
  var s = parts[p].split(':');
1720
1550
  states[s[0]] = s[1];
1721
1551
  }
1722
1552
  } else if (Array.isArray(states)) {
1723
1553
  var result = {};
1724
-
1725
1554
  if (obj.common.type === 'number') {
1726
1555
  states.forEach(function (value, key) {
1727
1556
  return result[key] = value;
@@ -1734,19 +1563,17 @@ var Utils = /*#__PURE__*/function () {
1734
1563
  result['false'] = states[0];
1735
1564
  result['true'] = states[1];
1736
1565
  }
1737
-
1738
1566
  return result;
1739
1567
  }
1740
1568
  }
1741
-
1742
1569
  return states;
1743
1570
  }
1571
+
1744
1572
  /**
1745
1573
  * Get svg file as text
1746
1574
  * @param {string} url URL of SVG file
1747
1575
  * @returns {object} Promise with "data:image..."
1748
1576
  */
1749
-
1750
1577
  }, {
1751
1578
  key: "getSvg",
1752
1579
  value: function getSvg(url) {
@@ -1755,22 +1582,20 @@ var Utils = /*#__PURE__*/function () {
1755
1582
  }).then(function (blob) {
1756
1583
  return new Promise(function (resolve) {
1757
1584
  var reader = new FileReader();
1758
-
1759
1585
  reader.onload = function () {
1760
1586
  // do not optimize this function. "this" is important.
1761
1587
  resolve(this.result);
1762
1588
  };
1763
-
1764
1589
  reader.readAsDataURL(blob);
1765
1590
  });
1766
1591
  });
1767
1592
  }
1593
+
1768
1594
  /**
1769
1595
  * Detect file xtension by its content
1770
1596
  * @param {string} base64 Base64 encoded binary file
1771
1597
  * @returns {string} Detected extension, like 'jpg'
1772
1598
  */
1773
-
1774
1599
  }, {
1775
1600
  key: "detectMimeType",
1776
1601
  value: function detectMimeType(base64) {
@@ -1782,11 +1607,10 @@ var Utils = /*#__PURE__*/function () {
1782
1607
  }]);
1783
1608
  return Utils;
1784
1609
  }();
1785
-
1786
1610
  (0, _defineProperty2["default"])(Utils, "namespace", NAMESPACE);
1787
1611
  (0, _defineProperty2["default"])(Utils, "INSTANCES", 'instances');
1788
1612
  (0, _defineProperty2["default"])(Utils, "dateFormat", ['DD', 'MM']);
1789
- (0, _defineProperty2["default"])(Utils, "FORBIDDEN_CHARS", /(?:(?![ !#-&\(\)\+\x2D-:=@-Z\^_a-~\xB5\xC0-\xD6\xD8-\xF6\xF8-\u01BA\u01BC-\u01BF\u01C4\u01C6\u01C7\u01C9\u01CA\u01CC-\u01F1\u01F3-\u0293\u0295-\u02AF\u0370-\u0373\u0376\u0377\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0560-\u0588\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FD-\u10FF\u13A0-\u13F5\u13F8-\u13FD\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FBB\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCB\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFB\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2134\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C7B\u2C7E-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA620-\uA629\uA640-\uA66D\uA680-\uA69B\uA722-\uA76F\uA771-\uA787\uA78B-\uA78E\uA790-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F5\uA7F6\uA7FA\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uABF0-\uABF9\uFB00-\uFB06\uFB13-\uFB17\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]|\uD801[\uDC00-\uDC4F\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDD30-\uDD39]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDD50-\uDD59]|\uD807[\uDC50-\uDC59\uDD50-\uDD59\uDDA0-\uDDA9]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59]|\uD81B[\uDE40-\uDE7F]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDD00-\uDD43\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9])[\s\S])+/g);
1613
+ (0, _defineProperty2["default"])(Utils, "FORBIDDEN_CHARS", /(?:(?![ !#-&\(\)\+\x2D-:=@-Z\^_a-~\xB5\xC0-\xD6\xD8-\xF6\xF8-\u01BA\u01BC-\u01BF\u01C4\u01C6\u01C7\u01C9\u01CA\u01CC-\u01F1\u01F3-\u0293\u0295-\u02AF\u0370-\u0373\u0376\u0377\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0560-\u0588\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FD-\u10FF\u13A0-\u13F5\u13F8-\u13FD\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FBB\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCB\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFB\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2134\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C7B\u2C7E-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA620-\uA629\uA640-\uA66D\uA680-\uA69B\uA722-\uA76F\uA771-\uA787\uA78B-\uA78E\uA790-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F5\uA7F6\uA7FA\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uABF0-\uABF9\uFB00-\uFB06\uFB13-\uFB17\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]|\uD801[\uDC00-\uDC4F\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDD30-\uDD39]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDD50-\uDD59]|\uD807[\uDC50-\uDC59\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59]|\uD81B[\uDE40-\uDE7F]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E\uDF25-\uDF2A]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDD00-\uDD43\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9])[\s\S])+/g);
1790
1614
  var _default = Utils;
1791
1615
  exports["default"] = _default;
1792
1616
  //# sourceMappingURL=Utils.js.map