@kosdev-code/kos-ddk-models 0.1.0-dev.10

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 (280) hide show
  1. package/constants.d.ts +3 -0
  2. package/constants.d.ts.map +1 -0
  3. package/index.d.ts +28 -0
  4. package/index.d.ts.map +1 -0
  5. package/index.js +3102 -0
  6. package/index.js.map +1 -0
  7. package/index.mjs +3102 -0
  8. package/index.mjs.map +1 -0
  9. package/lib/agitation-control/agitation-control-model.d.ts +53 -0
  10. package/lib/agitation-control/agitation-control-model.d.ts.map +1 -0
  11. package/lib/agitation-control/agitation-control-registration.d.ts +88 -0
  12. package/lib/agitation-control/agitation-control-registration.d.ts.map +1 -0
  13. package/lib/agitation-control/index.d.ts +4 -0
  14. package/lib/agitation-control/index.d.ts.map +1 -0
  15. package/lib/agitation-control/types/index.d.ts +5 -0
  16. package/lib/animation/animation-model.d.ts +17 -0
  17. package/lib/animation/animation-model.d.ts.map +1 -0
  18. package/lib/animation/animation-registration.d.ts +85 -0
  19. package/lib/animation/animation-registration.d.ts.map +1 -0
  20. package/lib/animation/index.d.ts +4 -0
  21. package/lib/animation/index.d.ts.map +1 -0
  22. package/lib/animation/services/animation-services.d.ts +10 -0
  23. package/lib/animation/services/animation-services.d.ts.map +1 -0
  24. package/lib/animation/services/index.d.ts +2 -0
  25. package/lib/animation/services/index.d.ts.map +1 -0
  26. package/lib/animation/types/index.d.ts +12 -0
  27. package/lib/application/application-model.d.ts +36 -0
  28. package/lib/application/application-model.d.ts.map +1 -0
  29. package/lib/application/application-registration.d.ts +85 -0
  30. package/lib/application/application-registration.d.ts.map +1 -0
  31. package/lib/application/index.d.ts +4 -0
  32. package/lib/application/index.d.ts.map +1 -0
  33. package/lib/application/services/application-services.d.ts +32 -0
  34. package/lib/application/services/application-services.d.ts.map +1 -0
  35. package/lib/application/services/index.d.ts +2 -0
  36. package/lib/application/services/index.d.ts.map +1 -0
  37. package/lib/application/types/index.d.ts +29 -0
  38. package/lib/auth/auth-model.d.ts +20 -0
  39. package/lib/auth/auth-model.d.ts.map +1 -0
  40. package/lib/auth/auth-registration.d.ts +83 -0
  41. package/lib/auth/auth-registration.d.ts.map +1 -0
  42. package/lib/auth/index.d.ts +4 -0
  43. package/lib/auth/index.d.ts.map +1 -0
  44. package/lib/auth/services/auth-services.d.ts +9 -0
  45. package/lib/auth/services/auth-services.d.ts.map +1 -0
  46. package/lib/auth/services/index.d.ts +2 -0
  47. package/lib/auth/services/index.d.ts.map +1 -0
  48. package/lib/auth/types/index.d.ts +10 -0
  49. package/lib/carb-water/carb-water-model.d.ts +20 -0
  50. package/lib/carb-water/carb-water-model.d.ts.map +1 -0
  51. package/lib/carb-water/carb-water-registration.d.ts +84 -0
  52. package/lib/carb-water/carb-water-registration.d.ts.map +1 -0
  53. package/lib/carb-water/index.d.ts +4 -0
  54. package/lib/carb-water/index.d.ts.map +1 -0
  55. package/lib/carb-water/services/carb-water-services.d.ts +6 -0
  56. package/lib/carb-water/services/carb-water-services.d.ts.map +1 -0
  57. package/lib/carb-water/services/index.d.ts +2 -0
  58. package/lib/carb-water/services/index.d.ts.map +1 -0
  59. package/lib/carb-water/types/index.d.ts +1 -0
  60. package/lib/copy-logs/copy-logs-model.d.ts +48 -0
  61. package/lib/copy-logs/copy-logs-model.d.ts.map +1 -0
  62. package/lib/copy-logs/index.d.ts +5 -0
  63. package/lib/copy-logs/index.d.ts.map +1 -0
  64. package/lib/copy-logs/services/copy-logs-services.d.ts +21 -0
  65. package/lib/copy-logs/services/copy-logs-services.d.ts.map +1 -0
  66. package/lib/copy-logs/services/index.d.ts +2 -0
  67. package/lib/copy-logs/services/index.d.ts.map +1 -0
  68. package/lib/copy-logs/types/index.d.ts +8 -0
  69. package/lib/dashboard-operations/dashboard-operations-model.d.ts +31 -0
  70. package/lib/dashboard-operations/dashboard-operations-model.d.ts.map +1 -0
  71. package/lib/dashboard-operations/dashboard-operations-registration.d.ts +85 -0
  72. package/lib/dashboard-operations/dashboard-operations-registration.d.ts.map +1 -0
  73. package/lib/dashboard-operations/index.d.ts +4 -0
  74. package/lib/dashboard-operations/index.d.ts.map +1 -0
  75. package/lib/dashboard-operations/services/dashboard-operations-services.d.ts +7 -0
  76. package/lib/dashboard-operations/services/dashboard-operations-services.d.ts.map +1 -0
  77. package/lib/dashboard-operations/services/index.d.ts +2 -0
  78. package/lib/dashboard-operations/services/index.d.ts.map +1 -0
  79. package/lib/dashboard-operations/types/index.d.ts +19 -0
  80. package/lib/dispenser/dispenser-model.d.ts +16 -0
  81. package/lib/dispenser/dispenser-model.d.ts.map +1 -0
  82. package/lib/dispenser/dispenser-registration.d.ts +85 -0
  83. package/lib/dispenser/dispenser-registration.d.ts.map +1 -0
  84. package/lib/dispenser/index.d.ts +4 -0
  85. package/lib/dispenser/index.d.ts.map +1 -0
  86. package/lib/dispenser/services/dispenser-services.d.ts +10 -0
  87. package/lib/dispenser/services/dispenser-services.d.ts.map +1 -0
  88. package/lib/dispenser/services/index.d.ts +2 -0
  89. package/lib/dispenser/services/index.d.ts.map +1 -0
  90. package/lib/dispenser/types/index.d.ts +7 -0
  91. package/lib/dispenser-info/dispenser-info-model.d.ts +16 -0
  92. package/lib/dispenser-info/dispenser-info-model.d.ts.map +1 -0
  93. package/lib/dispenser-info/dispenser-info-registration.d.ts +83 -0
  94. package/lib/dispenser-info/dispenser-info-registration.d.ts.map +1 -0
  95. package/lib/dispenser-info/index.d.ts +4 -0
  96. package/lib/dispenser-info/index.d.ts.map +1 -0
  97. package/lib/dispenser-info/services/dispenser-info-services.d.ts +10 -0
  98. package/lib/dispenser-info/services/dispenser-info-services.d.ts.map +1 -0
  99. package/lib/dispenser-info/services/index.d.ts +2 -0
  100. package/lib/dispenser-info/services/index.d.ts.map +1 -0
  101. package/lib/dispenser-info/types/index.d.ts +8 -0
  102. package/lib/door/door-model.d.ts +24 -0
  103. package/lib/door/door-model.d.ts.map +1 -0
  104. package/lib/door/door-registration.d.ts +86 -0
  105. package/lib/door/door-registration.d.ts.map +1 -0
  106. package/lib/door/index.d.ts +4 -0
  107. package/lib/door/index.d.ts.map +1 -0
  108. package/lib/door/types/index.d.ts +3 -0
  109. package/lib/enrollment/enrollment-model.d.ts +17 -0
  110. package/lib/enrollment/enrollment-model.d.ts.map +1 -0
  111. package/lib/enrollment/enrollment-registration.d.ts +83 -0
  112. package/lib/enrollment/enrollment-registration.d.ts.map +1 -0
  113. package/lib/enrollment/index.d.ts +4 -0
  114. package/lib/enrollment/index.d.ts.map +1 -0
  115. package/lib/enrollment/services/enrollment-services.d.ts +10 -0
  116. package/lib/enrollment/services/enrollment-services.d.ts.map +1 -0
  117. package/lib/enrollment/services/index.d.ts +2 -0
  118. package/lib/enrollment/services/index.d.ts.map +1 -0
  119. package/lib/enrollment/types/index.d.ts +8 -0
  120. package/lib/extension/index.d.ts +2 -0
  121. package/lib/extension/index.d.ts.map +1 -0
  122. package/lib/ingredient-summary/index.d.ts +3 -0
  123. package/lib/ingredient-summary/index.d.ts.map +1 -0
  124. package/lib/ingredient-summary/ingredient-summary-model.d.ts +21 -0
  125. package/lib/ingredient-summary/ingredient-summary-model.d.ts.map +1 -0
  126. package/lib/ingredient-summary/ingredient-summary-registration.d.ts +83 -0
  127. package/lib/ingredient-summary/ingredient-summary-registration.d.ts.map +1 -0
  128. package/lib/ingredient-summary/types/index.d.ts +9 -0
  129. package/lib/lockout/index.d.ts +5 -0
  130. package/lib/lockout/index.d.ts.map +1 -0
  131. package/lib/lockout/lockout-model.d.ts +82 -0
  132. package/lib/lockout/lockout-model.d.ts.map +1 -0
  133. package/lib/lockout/lockout-registration.d.ts +88 -0
  134. package/lib/lockout/lockout-registration.d.ts.map +1 -0
  135. package/lib/lockout/services/index.d.ts +2 -0
  136. package/lib/lockout/services/index.d.ts.map +1 -0
  137. package/lib/lockout/services/lockout-services.d.ts +3 -0
  138. package/lib/lockout/services/lockout-services.d.ts.map +1 -0
  139. package/lib/lockout/types/index.d.ts +1 -0
  140. package/lib/macro-assignment/index.d.ts +3 -0
  141. package/lib/macro-assignment/index.d.ts.map +1 -0
  142. package/lib/macro-assignment/macro-assignment-model.d.ts +81 -0
  143. package/lib/macro-assignment/macro-assignment-model.d.ts.map +1 -0
  144. package/lib/macro-assignment/macro-assignment-registration.d.ts +85 -0
  145. package/lib/macro-assignment/macro-assignment-registration.d.ts.map +1 -0
  146. package/lib/macro-assignment/services/index.d.ts +2 -0
  147. package/lib/macro-assignment/services/index.d.ts.map +1 -0
  148. package/lib/macro-assignment/services/macro-assignment-services.d.ts +2 -0
  149. package/lib/macro-assignment/services/macro-assignment-services.d.ts.map +1 -0
  150. package/lib/macro-assignment/types/index.d.ts +37 -0
  151. package/lib/network-test/index.d.ts +5 -0
  152. package/lib/network-test/index.d.ts.map +1 -0
  153. package/lib/network-test/network-test-container-model.d.ts +26 -0
  154. package/lib/network-test/network-test-container-model.d.ts.map +1 -0
  155. package/lib/network-test/network-test-container-registration.d.ts +85 -0
  156. package/lib/network-test/network-test-container-registration.d.ts.map +1 -0
  157. package/lib/network-test/network-test-model.d.ts +24 -0
  158. package/lib/network-test/network-test-model.d.ts.map +1 -0
  159. package/lib/network-test/network-test-registration.d.ts +83 -0
  160. package/lib/network-test/network-test-registration.d.ts.map +1 -0
  161. package/lib/network-test/services/index.d.ts +2 -0
  162. package/lib/network-test/services/index.d.ts.map +1 -0
  163. package/lib/network-test/services/network-test-services.d.ts +36 -0
  164. package/lib/network-test/services/network-test-services.d.ts.map +1 -0
  165. package/lib/network-test/types/index.d.ts +42 -0
  166. package/lib/nutritive-sweetener/index.d.ts +4 -0
  167. package/lib/nutritive-sweetener/index.d.ts.map +1 -0
  168. package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts +24 -0
  169. package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts.map +1 -0
  170. package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts +84 -0
  171. package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts.map +1 -0
  172. package/lib/nutritive-sweetener/services/index.d.ts +2 -0
  173. package/lib/nutritive-sweetener/services/index.d.ts.map +1 -0
  174. package/lib/nutritive-sweetener/services/nutritive-sweetener-services.d.ts +6 -0
  175. package/lib/nutritive-sweetener/services/nutritive-sweetener-services.d.ts.map +1 -0
  176. package/lib/nutritive-sweetener/types/index.d.ts +1 -0
  177. package/lib/plain-water/index.d.ts +4 -0
  178. package/lib/plain-water/index.d.ts.map +1 -0
  179. package/lib/plain-water/plain-water-model.d.ts +21 -0
  180. package/lib/plain-water/plain-water-model.d.ts.map +1 -0
  181. package/lib/plain-water/plain-water-registration.d.ts +84 -0
  182. package/lib/plain-water/plain-water-registration.d.ts.map +1 -0
  183. package/lib/plain-water/services/index.d.ts +2 -0
  184. package/lib/plain-water/services/index.d.ts.map +1 -0
  185. package/lib/plain-water/services/plain-water-services.d.ts +6 -0
  186. package/lib/plain-water/services/plain-water-services.d.ts.map +1 -0
  187. package/lib/plain-water/types/index.d.ts +1 -0
  188. package/lib/reboot/index.d.ts +4 -0
  189. package/lib/reboot/index.d.ts.map +1 -0
  190. package/lib/reboot/reboot-model.d.ts +17 -0
  191. package/lib/reboot/reboot-model.d.ts.map +1 -0
  192. package/lib/reboot/reboot-registration.d.ts +83 -0
  193. package/lib/reboot/reboot-registration.d.ts.map +1 -0
  194. package/lib/reboot/services/index.d.ts +2 -0
  195. package/lib/reboot/services/index.d.ts.map +1 -0
  196. package/lib/reboot/services/reboot-services.d.ts +2 -0
  197. package/lib/reboot/services/reboot-services.d.ts.map +1 -0
  198. package/lib/reboot/types/index.d.ts +6 -0
  199. package/lib/registration.d.ts +3 -0
  200. package/lib/registration.d.ts.map +1 -0
  201. package/lib/settings/index.d.ts +4 -0
  202. package/lib/settings/index.d.ts.map +1 -0
  203. package/lib/settings/services/index.d.ts +2 -0
  204. package/lib/settings/services/index.d.ts.map +1 -0
  205. package/lib/settings/services/settings-services.d.ts +12 -0
  206. package/lib/settings/services/settings-services.d.ts.map +1 -0
  207. package/lib/settings/settings-model.d.ts +28 -0
  208. package/lib/settings/settings-model.d.ts.map +1 -0
  209. package/lib/settings/settings-registration.d.ts +85 -0
  210. package/lib/settings/settings-registration.d.ts.map +1 -0
  211. package/lib/settings/types/index.d.ts +24 -0
  212. package/lib/setup-step/index.d.ts +5 -0
  213. package/lib/setup-step/index.d.ts.map +1 -0
  214. package/lib/setup-step/services/index.d.ts +2 -0
  215. package/lib/setup-step/services/index.d.ts.map +1 -0
  216. package/lib/setup-step/services/setup-step-services.d.ts +13 -0
  217. package/lib/setup-step/services/setup-step-services.d.ts.map +1 -0
  218. package/lib/setup-step/setup-step-container-model.d.ts +32 -0
  219. package/lib/setup-step/setup-step-container-model.d.ts.map +1 -0
  220. package/lib/setup-step/setup-step-container-registration.d.ts +85 -0
  221. package/lib/setup-step/setup-step-container-registration.d.ts.map +1 -0
  222. package/lib/setup-step/setup-step-model.d.ts +24 -0
  223. package/lib/setup-step/setup-step-model.d.ts.map +1 -0
  224. package/lib/setup-step/setup-step-registration.d.ts +83 -0
  225. package/lib/setup-step/setup-step-registration.d.ts.map +1 -0
  226. package/lib/setup-step/types/index.d.ts +38 -0
  227. package/lib/trouble-action/index.d.ts +7 -0
  228. package/lib/trouble-action/index.d.ts.map +1 -0
  229. package/lib/trouble-action/trouble-action-model.d.ts +279 -0
  230. package/lib/trouble-action/trouble-action-model.d.ts.map +1 -0
  231. package/lib/trouble-action/types/index.d.ts +103 -0
  232. package/lib/utilities/index.d.ts +5 -0
  233. package/lib/utilities/index.d.ts.map +1 -0
  234. package/lib/utilities/services/index.d.ts +2 -0
  235. package/lib/utilities/services/index.d.ts.map +1 -0
  236. package/lib/utilities/services/utilities-services.d.ts +13 -0
  237. package/lib/utilities/services/utilities-services.d.ts.map +1 -0
  238. package/lib/utilities/types/index.d.ts +30 -0
  239. package/lib/utilities/utilities-container-model.d.ts +22 -0
  240. package/lib/utilities/utilities-container-model.d.ts.map +1 -0
  241. package/lib/utilities/utilities-container-registration.d.ts +85 -0
  242. package/lib/utilities/utilities-container-registration.d.ts.map +1 -0
  243. package/lib/utilities/utilities-model.d.ts +22 -0
  244. package/lib/utilities/utilities-model.d.ts.map +1 -0
  245. package/lib/utilities/utilities-registration.d.ts +83 -0
  246. package/lib/utilities/utilities-registration.d.ts.map +1 -0
  247. package/lib/utils/assembly-utils.d.ts +16 -0
  248. package/lib/utils/assembly-utils.d.ts.map +1 -0
  249. package/lib/utils/holder-view-extension.d.ts +15 -0
  250. package/lib/utils/holder-view-extension.d.ts.map +1 -0
  251. package/lib/utils/index.d.ts +5 -0
  252. package/lib/utils/index.d.ts.map +1 -0
  253. package/lib/utils/time-utils.d.ts +9 -0
  254. package/lib/utils/time-utils.d.ts.map +1 -0
  255. package/lib/utils/trouble-visibility-filter.d.ts +4 -0
  256. package/lib/utils/trouble-visibility-filter.d.ts.map +1 -0
  257. package/package.json +21 -0
  258. package/start/index.d.ts +5 -0
  259. package/start/index.d.ts.map +1 -0
  260. package/start/services/index.d.ts +2 -0
  261. package/start/services/index.d.ts.map +1 -0
  262. package/start/services/start-services.d.ts +6 -0
  263. package/start/services/start-services.d.ts.map +1 -0
  264. package/start/start-model.d.ts +20 -0
  265. package/start/start-model.d.ts.map +1 -0
  266. package/start/start-registration.d.ts +88 -0
  267. package/start/start-registration.d.ts.map +1 -0
  268. package/start/types/index.d.ts +1 -0
  269. package/types/global.d.ts +19 -0
  270. package/types/global.d.ts.map +1 -0
  271. package/types/index.d.ts +2 -0
  272. package/types/index.d.ts.map +1 -0
  273. package/utils/openapi-index.d.ts +2 -0
  274. package/utils/openapi-index.d.ts.map +1 -0
  275. package/utils/openapi.d.ts +9271 -0
  276. package/utils/services/kosdev.ddk/snapshot/openapi.d.ts +971 -0
  277. package/utils/services/kosdev.ddk/snapshot/service.d.ts +121 -0
  278. package/utils/services/kosdev.ddk/snapshot/service.d.ts.map +1 -0
  279. package/utils/services-index.d.ts +2 -0
  280. package/utils/services-index.d.ts.map +1 -0
package/index.mjs ADDED
@@ -0,0 +1,3102 @@
1
+ import { resolveServiceUrl, ServiceFactory, KosLog, kosTopicHandler, kosModel, kosAction, Kos, isKosModel, createPropKey, kosStateProp, kosConfigProperty, KosModelRegistrationFactory, kosDependency, KosModelContainer, resolveContainerDeltas, kosChild, Device, kosFuture, kosModelEffect, MultipleFutureHandler, FutureEndState, TroubleServices, Troubles, SingletonKosModelRegistrationFactory, getKosCompanionModel, FetchError, StorageDeviceContainer, kosFutureAware, kosLoggerAware, KosDataContainer, TroubleContainer, FutureHandler, troubleByTypeReducer, registerExtensionPoint, ExtensionManager, kosConfigBean, kosStateBean, ObservableData } from "@kosdev-code/kos-ui-sdk";
2
+ import { AGITATION_REQUIRED_TROUBLE, CartridgeAgitatorEvents, FcmPump, FreestyleHolder } from "@kosdev-code/kos-freestyle-sdk";
3
+ import { Assembly, HolderContainer, IngredientContainer } from "@kosdev-code/kos-dispense-sdk";
4
+ const TROUBLE_TYPE_PURGE$1 = "PurgeTrouble";
5
+ const TROUBLE_TYPE_PRIME$1 = "PrimeTrouble";
6
+ const { URL: URL$d } = resolveServiceUrl("AUTH_SERVICE");
7
+ const { getOne: getOne$4, postModel: postModel$4 } = ServiceFactory.build({
8
+ basePath: `${URL$d}/api/auth`
9
+ });
10
+ const log$e = KosLog.createLogger({ name: "auth-service", group: "Services" });
11
+ const getCurrentRole = async () => {
12
+ log$e.debug("sending GET for auth");
13
+ const response = await getOne$4({
14
+ urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/role`
15
+ });
16
+ return response;
17
+ };
18
+ const sendPinCode = async (pinCode) => {
19
+ log$e.debug("sending POST for auth");
20
+ const response = await postModel$4({
21
+ urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/pincode/${pinCode}`,
22
+ model: {}
23
+ });
24
+ return response;
25
+ };
26
+ const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
27
+ __proto__: null,
28
+ getCurrentRole,
29
+ sendPinCode
30
+ }, Symbol.toStringTag, { value: "Module" }));
31
+ var __defProp$j = Object.defineProperty;
32
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
33
+ var __decorateClass$p = (decorators, target, key, kind) => {
34
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
35
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
36
+ if (decorator = decorators[i])
37
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
38
+ if (kind && result) __defProp$j(target, key, result);
39
+ return result;
40
+ };
41
+ const MODEL_TYPE$p = "auth-model";
42
+ const convertAuthResponse = (response) => response.toLowerCase();
43
+ let AuthModelImpl = class {
44
+ id;
45
+ logger;
46
+ currentRole;
47
+ constructor(modelId, options, context) {
48
+ this.id = modelId;
49
+ this.logger = context.logger;
50
+ this.currentRole = "crew";
51
+ }
52
+ async authorize(pinCode) {
53
+ if (!pinCode) {
54
+ return false;
55
+ }
56
+ const response = await sendPinCode(pinCode);
57
+ if (response?.status === 200) {
58
+ return response.data;
59
+ } else {
60
+ return false;
61
+ }
62
+ }
63
+ // -------------------LIFECYCLE----------------------------
64
+ async init() {
65
+ this.logger.debug(`initializing auth ${this.id}`);
66
+ }
67
+ async load() {
68
+ this.logger.debug(`loading auth ${this.id}`);
69
+ const response = await getCurrentRole();
70
+ if (response?.status === 200) {
71
+ this.logger.debug(`response ${response.data}`);
72
+ kosAction(() => {
73
+ this.currentRole = convertAuthResponse(response.data);
74
+ });
75
+ }
76
+ }
77
+ handleRoleChange(role) {
78
+ this.currentRole = convertAuthResponse(role);
79
+ }
80
+ forceRole(role) {
81
+ this.currentRole = role;
82
+ }
83
+ };
84
+ __decorateClass$p([
85
+ kosTopicHandler({
86
+ topic: "/app/kosdev.ddk/auth/role",
87
+ websocket: true
88
+ })
89
+ ], AuthModelImpl.prototype, "handleRoleChange", 1);
90
+ AuthModelImpl = __decorateClass$p([
91
+ kosModel(MODEL_TYPE$p)
92
+ ], AuthModelImpl);
93
+ const Auth = {
94
+ registration: {
95
+ [MODEL_TYPE$p]: {
96
+ class: AuthModelImpl,
97
+ singleton: false
98
+ }
99
+ },
100
+ type: MODEL_TYPE$p,
101
+ predicate: isKosModel(MODEL_TYPE$p),
102
+ factory: Kos.Factory.create(MODEL_TYPE$p)
103
+ };
104
+ var __defProp$i = Object.defineProperty;
105
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
106
+ var __decorateClass$o = (decorators, target, key, kind) => {
107
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
108
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
109
+ if (decorator = decorators[i])
110
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
111
+ if (kind && result) __defProp$i(target, key, result);
112
+ return result;
113
+ };
114
+ const MODEL_TYPE$o = "door-model";
115
+ const PROP_PATH = createPropKey("doorPath");
116
+ let DoorModelImpl = class {
117
+ id;
118
+ logger;
119
+ doorPath;
120
+ open;
121
+ ignoreDoor;
122
+ constructor(modelId, options, context) {
123
+ this.id = modelId;
124
+ this.logger = context.logger;
125
+ this.doorPath = options.doorPath;
126
+ }
127
+ get currentState() {
128
+ if (this.open.value === void 0) {
129
+ return "UNKNOWN";
130
+ }
131
+ return this.open.value ? "OPEN" : "CLOSED";
132
+ }
133
+ get isOpen() {
134
+ const value = this.open.value === void 0 ? true : this.open.value;
135
+ const ignore = this.ignoreDoor.value;
136
+ if (ignore) {
137
+ this.logger.debug(
138
+ `Door state is being ignored (treating as closed) due to ignoreDoor config property being true.`
139
+ );
140
+ return false;
141
+ }
142
+ return value;
143
+ }
144
+ };
145
+ __decorateClass$o([
146
+ kosStateProp({ path: PROP_PATH, attribute: "state" })
147
+ ], DoorModelImpl.prototype, "open", 2);
148
+ __decorateClass$o([
149
+ kosConfigProperty({
150
+ path: "app:kosdev.ddk:app",
151
+ attribute: "ncui.ignoreDoorStateOnExit"
152
+ })
153
+ ], DoorModelImpl.prototype, "ignoreDoor", 2);
154
+ DoorModelImpl = __decorateClass$o([
155
+ kosModel(MODEL_TYPE$o)
156
+ ], DoorModelImpl);
157
+ const Door = new KosModelRegistrationFactory({
158
+ class: DoorModelImpl,
159
+ type: MODEL_TYPE$o
160
+ });
161
+ const { URL: URL$c } = resolveServiceUrl("SETUP-STEP_SERVICE");
162
+ const { getAll: getAll$9, postModel: postModel$3 } = ServiceFactory.build({
163
+ basePath: `${URL$c}/api/setup-step`
164
+ });
165
+ const log$d = KosLog.createLogger({
166
+ name: "setup-step-service",
167
+ group: "Services"
168
+ });
169
+ const getSetupSteps = async () => {
170
+ log$d.debug("sending GET for setup-step");
171
+ const response = await getAll$9({
172
+ urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/steps`
173
+ });
174
+ return response;
175
+ };
176
+ const markStepComplete = async (stepId) => {
177
+ log$d.debug("sending POST for setup-step");
178
+ const response = await postModel$3({
179
+ urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/complete/${stepId}`,
180
+ model: {}
181
+ });
182
+ return response;
183
+ };
184
+ const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
185
+ __proto__: null,
186
+ getSetupSteps,
187
+ markStepComplete
188
+ }, Symbol.toStringTag, { value: "Module" }));
189
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
190
+ var __decorateClass$n = (decorators, target, key, kind) => {
191
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
192
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
193
+ if (decorator = decorators[i])
194
+ result = decorator(result) || result;
195
+ return result;
196
+ };
197
+ const MODEL_TYPE$n = "setup-step-model";
198
+ let SetupStepModelImpl = class {
199
+ id;
200
+ idx;
201
+ name;
202
+ complete;
203
+ preStep;
204
+ exclusive;
205
+ logger;
206
+ constructor(modelId, options, context) {
207
+ this.id = modelId;
208
+ this.idx = options.idx;
209
+ this.logger = context.logger;
210
+ this.name = options.name;
211
+ this.complete = options.complete;
212
+ this.preStep = options.preStep;
213
+ this.exclusive = options.exclusive;
214
+ }
215
+ updateModel(options) {
216
+ this.name = options.name;
217
+ this.idx = options.idx;
218
+ this.complete = options.complete;
219
+ this.preStep = options.preStep;
220
+ this.exclusive = options.exclusive;
221
+ }
222
+ get titleKey() {
223
+ return `setup.${this.name}.title`;
224
+ }
225
+ get bodyKey() {
226
+ return `setup.${this.name}.body`;
227
+ }
228
+ async completeStep() {
229
+ const response = await markStepComplete(this.name);
230
+ if (response?.status === 200) {
231
+ kosAction(() => {
232
+ this.complete = true;
233
+ });
234
+ }
235
+ }
236
+ // -------------------LIFECYCLE----------------------------
237
+ async init() {
238
+ this.logger.debug(`initializing setup-step ${this.id}`);
239
+ }
240
+ async load() {
241
+ this.logger.debug(`loading setup-step ${this.id}`);
242
+ }
243
+ };
244
+ SetupStepModelImpl = __decorateClass$n([
245
+ kosModel(MODEL_TYPE$n)
246
+ ], SetupStepModelImpl);
247
+ const SetupStep = {
248
+ registration: {
249
+ [MODEL_TYPE$n]: {
250
+ class: SetupStepModelImpl,
251
+ singleton: false
252
+ }
253
+ },
254
+ type: MODEL_TYPE$n,
255
+ predicate: isKosModel(MODEL_TYPE$n),
256
+ factory: Kos.Factory.create(MODEL_TYPE$n)
257
+ };
258
+ var __defProp$h = Object.defineProperty;
259
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
260
+ var __decorateClass$m = (decorators, target, key, kind) => {
261
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
262
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
263
+ if (decorator = decorators[i])
264
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
265
+ if (kind && result) __defProp$h(target, key, result);
266
+ return result;
267
+ };
268
+ const MODEL_TYPE$m = "setup-step-container-model";
269
+ function addStep(container) {
270
+ return (step) => {
271
+ const model = SetupStep.factory(step.id)(step);
272
+ model.updateModel(step);
273
+ container.addModel(model);
274
+ };
275
+ }
276
+ function removeStep(container) {
277
+ return (id) => {
278
+ container.removeModel(id);
279
+ };
280
+ }
281
+ let SetupStepContainerModelImpl = class {
282
+ id;
283
+ _currentStep;
284
+ logger;
285
+ models;
286
+ authModel;
287
+ constructor(modelId, options, context) {
288
+ this.id = modelId;
289
+ this.logger = context.logger;
290
+ this._currentStep = void 0;
291
+ this.models = new KosModelContainer({
292
+ parentId: modelId,
293
+ sortKey: "idx"
294
+ });
295
+ }
296
+ get currentStep() {
297
+ return this._currentStep;
298
+ }
299
+ setCurrentStep(id) {
300
+ const step = this.models.getModel(id);
301
+ if (step) {
302
+ this._currentStep = step;
303
+ }
304
+ }
305
+ nextStep() {
306
+ if (!this._currentStep) {
307
+ this._currentStep = this.firstIncompleteStep;
308
+ } else {
309
+ const currentIdx = this._currentStep.idx;
310
+ const nextStep = this.models.data.find((step) => step.idx > currentIdx);
311
+ if (nextStep) {
312
+ this._currentStep = nextStep;
313
+ }
314
+ }
315
+ }
316
+ get hasIncompletePreSteps() {
317
+ return this.models.data.some((step) => step.preStep && !step.complete);
318
+ }
319
+ get setupRequired() {
320
+ return this.models.data.some((step) => !step.complete);
321
+ }
322
+ get firstIncompleteStep() {
323
+ return this.models.data.find((step) => !step.complete);
324
+ }
325
+ get isLastStep() {
326
+ return this.models.data[this.models.data.length - 1].id === this._currentStep?.id;
327
+ }
328
+ get data() {
329
+ return this.models.data;
330
+ }
331
+ getModel(id) {
332
+ return this.models.getModel(id);
333
+ }
334
+ addModel(model) {
335
+ this.models.addModel(model);
336
+ }
337
+ removeModel(id) {
338
+ this.models.removeModel(id);
339
+ }
340
+ // -------------------LIFECYCLE----------------------------
341
+ async init() {
342
+ this.logger.debug(`initializing setup-step-container container ${this.id}`);
343
+ }
344
+ async load() {
345
+ this.logger.debug(`loading setup-step-container container ${this.id}`);
346
+ const response = await getSetupSteps();
347
+ if (response?.data) {
348
+ const identifiableSteps = response.data.map(
349
+ (step, index2) => {
350
+ return {
351
+ ...step,
352
+ idx: index2,
353
+ id: `setup-${step.name}`
354
+ };
355
+ }
356
+ );
357
+ resolveContainerDeltas({
358
+ container: this.models,
359
+ onAddItem: addStep(this),
360
+ onRemoveItem: removeStep(this)
361
+ })(identifiableSteps);
362
+ }
363
+ this.nextStep();
364
+ }
365
+ handleStepChanges(steps) {
366
+ const identifiableSteps = steps.map((step, index2) => {
367
+ return {
368
+ ...step,
369
+ idx: index2,
370
+ id: `setup-${step.name}`
371
+ };
372
+ });
373
+ resolveContainerDeltas({
374
+ container: this.models,
375
+ onAddItem: addStep(this),
376
+ onRemoveItem: removeStep(this)
377
+ })(identifiableSteps);
378
+ }
379
+ };
380
+ __decorateClass$m([
381
+ kosChild
382
+ ], SetupStepContainerModelImpl.prototype, "models", 2);
383
+ __decorateClass$m([
384
+ kosDependency({ modelType: Auth.type })
385
+ ], SetupStepContainerModelImpl.prototype, "authModel", 2);
386
+ __decorateClass$m([
387
+ kosTopicHandler({
388
+ topic: "/app/kosdev.ddk/setup/steps",
389
+ websocket: true
390
+ })
391
+ ], SetupStepContainerModelImpl.prototype, "handleStepChanges", 1);
392
+ SetupStepContainerModelImpl = __decorateClass$m([
393
+ kosModel(MODEL_TYPE$m)
394
+ ], SetupStepContainerModelImpl);
395
+ const SetupStepContainer = {
396
+ registration: {
397
+ [MODEL_TYPE$m]: {
398
+ class: SetupStepContainerModelImpl,
399
+ singleton: true
400
+ },
401
+ ...SetupStep.registration
402
+ },
403
+ type: MODEL_TYPE$m,
404
+ predicate: isKosModel(MODEL_TYPE$m),
405
+ factory: Kos.Singleton.create(MODEL_TYPE$m)
406
+ };
407
+ const { URL: URL$b } = resolveServiceUrl("AUTH_SERVICE");
408
+ const { getOne: getOne$3, getAll: getAll$8 } = ServiceFactory.build({
409
+ basePath: `${URL$b}/api/app/kosdev.ddk/ncui/`
410
+ });
411
+ const log$c = KosLog.createLogger({ name: "auth-service", group: "Services" });
412
+ const getCuis = async () => {
413
+ log$c.debug("sending GET for cuis");
414
+ const response = await getAll$8({
415
+ urlOverride: `${URL$b}/api/app/kosdev.ddk/cui`
416
+ });
417
+ if (response?.status !== 200) {
418
+ throw new Error("Failed to retrieve cuis");
419
+ }
420
+ return response.data;
421
+ };
422
+ const getNavigation = async () => {
423
+ log$c.debug("sending GET for navigation");
424
+ try {
425
+ const extensionResponse = await getAll$8({
426
+ urlOverride: `${URL$b}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`
427
+ });
428
+ if (extensionResponse?.status !== 200) {
429
+ log$c.info(`no extensions found, using base data`);
430
+ const response = await getAll$8({
431
+ urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
432
+ });
433
+ return response?.data ?? [];
434
+ }
435
+ return extensionResponse?.data ?? [];
436
+ } catch (error) {
437
+ const response = await getAll$8({
438
+ urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
439
+ });
440
+ return response?.data ?? [];
441
+ }
442
+ };
443
+ const navigateToCui = async () => {
444
+ log$c.debug("navigating to CUI");
445
+ const response = await getOne$3({
446
+ urlOverride: `${URL$b}/api/app/kosdev.ddk/cui/open`
447
+ });
448
+ return response;
449
+ };
450
+ const navigateToNCui$1 = async () => {
451
+ log$c.debug("navigating to NCUI");
452
+ const response = await getOne$3({
453
+ urlOverride: `${URL$b}/api/app/kosdev.ddk/ncui/open`
454
+ });
455
+ return response;
456
+ };
457
+ var __defProp$g = Object.defineProperty;
458
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
459
+ var __decorateClass$l = (decorators, target, key, kind) => {
460
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
461
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
462
+ if (decorator = decorators[i])
463
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
464
+ if (kind && result) __defProp$g(target, key, result);
465
+ return result;
466
+ };
467
+ const MODEL_TYPE$l = "application-model";
468
+ const flattenNavigationItems = (items, path = "") => items.reduce((acc, item) => {
469
+ const itemPath = path ? `${path}.${item.name}` : item.name;
470
+ acc[itemPath] = { ...item, root: !path };
471
+ if (item.children) {
472
+ const childItems = flattenNavigationItems(item.children, itemPath);
473
+ Object.keys(childItems).forEach((key) => {
474
+ acc[key] = childItems[key];
475
+ });
476
+ }
477
+ return acc;
478
+ }, {});
479
+ let ApplicationModelImpl = class {
480
+ id;
481
+ device;
482
+ authModel;
483
+ setupStepContainer;
484
+ door;
485
+ ncuiLanguage;
486
+ activeCui;
487
+ fallbackCui;
488
+ _cuis = [];
489
+ _navigationItems = [];
490
+ // @kosConfigProperty({
491
+ // path: 'somewhere.enable.dial.animation',
492
+ // attribute: 'enableDialAnimation',
493
+ // })
494
+ // enableDialAnimation!: KosConfigProperty<boolean>;
495
+ // @kosConfigProperty({
496
+ // path: 'somewhere.enable.modal.animation',
497
+ // attribute: 'enableModalAnimation',
498
+ // })
499
+ // enableModalAnimation!: KosConfigProperty<boolean>;
500
+ // @kosConfigProperty({
501
+ // path: 'somewhere.enable.sidebar.animation',
502
+ // attribute: 'enableSidebarAnimation',
503
+ // })
504
+ // enableSidebarAnimation!: KosConfigProperty<boolean>;
505
+ languages;
506
+ logger;
507
+ constructor(modelId, _options, context) {
508
+ this.id = modelId;
509
+ this.languages = [];
510
+ this._cuis = [];
511
+ this.logger = context.logger;
512
+ this.door = Door.instance("app:kosdev.ddk:service:door:door").options({
513
+ doorPath: "app:kosdev.ddk:service:door:door"
514
+ }).build();
515
+ }
516
+ get setupRequired() {
517
+ return this.authModel.currentRole === "crew" ? false : this.setupStepContainer.setupRequired;
518
+ }
519
+ get currentRole() {
520
+ return this.authModel.currentRole;
521
+ }
522
+ get cuis() {
523
+ return this._cuis.reduce((acc, cui) => {
524
+ acc[cui.appId] = cui;
525
+ return acc;
526
+ }, {});
527
+ }
528
+ get navigationItems() {
529
+ return flattenNavigationItems(this._navigationItems);
530
+ }
531
+ get hasCuiDefined() {
532
+ return !!this.activeCui.value || !!this.fallbackCui.value;
533
+ }
534
+ get doorIsOpen() {
535
+ return this.door.isOpen;
536
+ }
537
+ async enter() {
538
+ this.logger.info("navigating to NCUI");
539
+ await navigateToNCui$1();
540
+ }
541
+ async exit() {
542
+ this.logger.info("navigating to CUI");
543
+ await navigateToCui();
544
+ }
545
+ // -------------------LIFECYCLE----------------------------
546
+ async load() {
547
+ this.logger.debug(`loading application ${this.id}`);
548
+ const navigationItems = await getNavigation();
549
+ this._navigationItems = navigationItems;
550
+ const cuis = await getCuis();
551
+ this._cuis = cuis;
552
+ if (this.setupStepContainer?.hasIncompletePreSteps) {
553
+ this.authModel?.forceRole("technician");
554
+ }
555
+ this.languages = [
556
+ {
557
+ name: "English",
558
+ locale: "en"
559
+ }
560
+ ];
561
+ }
562
+ };
563
+ __decorateClass$l([
564
+ kosDependency({ modelType: Device.type })
565
+ ], ApplicationModelImpl.prototype, "device", 2);
566
+ __decorateClass$l([
567
+ kosDependency({ modelType: Auth.type })
568
+ ], ApplicationModelImpl.prototype, "authModel", 2);
569
+ __decorateClass$l([
570
+ kosDependency({ modelType: SetupStepContainer.type })
571
+ ], ApplicationModelImpl.prototype, "setupStepContainer", 2);
572
+ __decorateClass$l([
573
+ kosChild
574
+ ], ApplicationModelImpl.prototype, "door", 2);
575
+ __decorateClass$l([
576
+ kosConfigProperty({
577
+ path: "app:kosdev.ddk:app",
578
+ attribute: "ncui.ncuiLanguage"
579
+ //updated attribute for language config property
580
+ })
581
+ ], ApplicationModelImpl.prototype, "ncuiLanguage", 2);
582
+ __decorateClass$l([
583
+ kosConfigProperty({
584
+ path: "app:kosdev.ddk:service:cui",
585
+ attribute: "activeCui"
586
+ })
587
+ ], ApplicationModelImpl.prototype, "activeCui", 2);
588
+ __decorateClass$l([
589
+ kosConfigProperty({
590
+ path: "app:kosdev.ddk:service:cui",
591
+ attribute: "fallbackCui"
592
+ })
593
+ ], ApplicationModelImpl.prototype, "fallbackCui", 2);
594
+ ApplicationModelImpl = __decorateClass$l([
595
+ kosModel(MODEL_TYPE$l)
596
+ ], ApplicationModelImpl);
597
+ const Application = {
598
+ registration: {
599
+ [MODEL_TYPE$l]: {
600
+ class: ApplicationModelImpl,
601
+ singleton: true
602
+ }
603
+ },
604
+ type: MODEL_TYPE$l,
605
+ predicate: isKosModel(MODEL_TYPE$l),
606
+ factory: Kos.Singleton.create(
607
+ MODEL_TYPE$l
608
+ )
609
+ };
610
+ const RoleMap = {
611
+ none: 999,
612
+ crew: 0,
613
+ technician: 1,
614
+ manager: 2
615
+ };
616
+ const troubleVisibilityFilter = (currentRole) => (trouble) => {
617
+ if (trouble.type === AGITATION_REQUIRED_TROUBLE) {
618
+ return false;
619
+ }
620
+ const visibleRole = trouble?.role || "technician";
621
+ if (currentRole && visibleRole) {
622
+ const currentRoleIndex = RoleMap[currentRole.toLowerCase()] ?? RoleMap["crew"];
623
+ const visibleRoleIndex = RoleMap[visibleRole.toLowerCase()] ?? RoleMap["crew"];
624
+ return currentRoleIndex >= visibleRoleIndex;
625
+ }
626
+ return false;
627
+ };
628
+ var __defProp$f = Object.defineProperty;
629
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
630
+ var __decorateClass$k = (decorators, target, key, kind) => {
631
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
632
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
633
+ if (decorator = decorators[i])
634
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
635
+ if (kind && result) __defProp$f(target, key, result);
636
+ return result;
637
+ };
638
+ const MODEL_TYPE$k = "agitation-control-model";
639
+ const FUTURE_RESOLVE = "resolve";
640
+ const FUTURE_AGITATE = "agitate";
641
+ let AgitationControlModelImpl = class {
642
+ id;
643
+ futureHandler;
644
+ logger;
645
+ troubleContainer;
646
+ _agitationFutureId;
647
+ _canExit = true;
648
+ _exiting = false;
649
+ _isFailed = false;
650
+ disposer;
651
+ application;
652
+ constructor(modelId, options, context) {
653
+ this.id = modelId;
654
+ this.logger = context.logger;
655
+ this.troubleContainer = options.companionParent;
656
+ this.futureHandler = new MultipleFutureHandler(this, FUTURE_RESOLVE);
657
+ }
658
+ set isFailed(value) {
659
+ this._isFailed = value;
660
+ }
661
+ get isFailed() {
662
+ return this._isFailed;
663
+ }
664
+ get isDoorClosed() {
665
+ return !this.application.doorIsOpen;
666
+ }
667
+ get isAgitating() {
668
+ return !!this._agitationFutureId;
669
+ }
670
+ set exiting(value) {
671
+ this._exiting = value;
672
+ }
673
+ get exiting() {
674
+ return this._exiting;
675
+ }
676
+ get canExit() {
677
+ const allDeferredCount = this.queuedTroubles.length;
678
+ return allDeferredCount === 0 && this._canExit;
679
+ }
680
+ clearAll() {
681
+ this.queuedTroubles.forEach((trouble) => {
682
+ trouble.clearDefer();
683
+ });
684
+ }
685
+ get readyToResolve() {
686
+ const allDeferredCount = this.queuedTroubles.length;
687
+ const notResolvable = this.queuedTroubles.filter((t) => t.shouldDefer);
688
+ const _readyToResolve = allDeferredCount > 0 && notResolvable.length === 0;
689
+ return this.isDoorClosed && _readyToResolve && this.exiting;
690
+ }
691
+ onFutureUpdate(future) {
692
+ if (future.endState === FutureEndState.Success) {
693
+ this.logger.debug(
694
+ `Resolve deferred troubles future ${future.id} completed successfully`
695
+ );
696
+ this.queuedTroubles.forEach((trouble) => {
697
+ trouble.clearDefer();
698
+ });
699
+ kosAction(() => {
700
+ this._canExit = true;
701
+ this._isFailed = false;
702
+ });
703
+ } else if (future.endState === FutureEndState.Fail || future.endState === FutureEndState.Canceled || future.endState === FutureEndState.Aborted) {
704
+ this.logger.error(`Resolve deferred troubles future ${future.id} failed`);
705
+ this.clearAll();
706
+ kosAction(() => {
707
+ this._canExit = false;
708
+ this._isFailed = true;
709
+ });
710
+ }
711
+ }
712
+ inProgress = [];
713
+ async resolveDeferredTroubles(tracker) {
714
+ const toResolve = this.queuedTroubles.filter((t) => !t.shouldDefer).map((trouble) => trouble.rawId).filter((id) => !this.inProgress.includes(id));
715
+ this.inProgress.push(...toResolve);
716
+ if (toResolve.length === 0) {
717
+ return void 0;
718
+ }
719
+ const response = await TroubleServices.bulkResolveTroubles(
720
+ toResolve,
721
+ void 0,
722
+ tracker
723
+ );
724
+ return response;
725
+ }
726
+ get hasQueuedTroubles() {
727
+ return this.queuedTroubles.length > 0;
728
+ }
729
+ get queuedTroubles() {
730
+ return this.troubleContainer.troubles.getIndexByKey(
731
+ Troubles.INDEX_TROUBLES_BY_DEFERRED,
732
+ Troubles.TROUBLES_DEFERRED
733
+ );
734
+ }
735
+ get visibleTroubles() {
736
+ const currentRole = this.application.currentRole;
737
+ return this.troubleContainer.troubles.data.filter(troubleVisibilityFilter(currentRole)).filter((trouble) => trouble.type !== AGITATION_REQUIRED_TROUBLE);
738
+ }
739
+ // -------------------LIFECYCLE----------------------------
740
+ get future() {
741
+ return this.futureHandler.future;
742
+ }
743
+ get resolveFuture() {
744
+ return this.futureHandler.getFuture(FUTURE_RESOLVE);
745
+ }
746
+ get agitateFuture() {
747
+ return this.futureHandler.getFuture(FUTURE_AGITATE);
748
+ }
749
+ handleAgitationStarted(event) {
750
+ this.logger.info(`Agitation started for ${event.path}`);
751
+ this._agitationFutureId = String(event.futureId);
752
+ }
753
+ handleAgitationEnded(event) {
754
+ this.logger.info(`Agitation ended for ${event.path}`);
755
+ this._agitationFutureId = void 0;
756
+ }
757
+ async init() {
758
+ this.logger.debug(`initializing agitation-control ${this.id}`);
759
+ }
760
+ unload() {
761
+ this.logger.debug(`unloading agitation-control ${this.id}`);
762
+ if (this.disposer) {
763
+ this.disposer();
764
+ }
765
+ }
766
+ handleReadyToResolve() {
767
+ if (this.readyToResolve) {
768
+ this.logger.info(`AgitationControl - Resolving deferred troubles`);
769
+ this.resolveDeferredTroubles();
770
+ }
771
+ if (this._agitationFutureId) {
772
+ this.logger.info(`AgitationControl - Agitation started`);
773
+ }
774
+ }
775
+ async load() {
776
+ this.logger.debug(`loading agitation-control ${this.id}`);
777
+ }
778
+ };
779
+ __decorateClass$k([
780
+ kosDependency({ modelType: Application.type })
781
+ ], AgitationControlModelImpl.prototype, "application", 2);
782
+ __decorateClass$k([
783
+ kosFuture({ alias: FUTURE_RESOLVE })
784
+ ], AgitationControlModelImpl.prototype, "resolveDeferredTroubles", 1);
785
+ __decorateClass$k([
786
+ kosTopicHandler({ topic: CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED })
787
+ ], AgitationControlModelImpl.prototype, "handleAgitationStarted", 1);
788
+ __decorateClass$k([
789
+ kosTopicHandler({ topic: CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED })
790
+ ], AgitationControlModelImpl.prototype, "handleAgitationEnded", 1);
791
+ __decorateClass$k([
792
+ kosModelEffect({
793
+ dependencies: (model) => [model.readyToResolve, model._agitationFutureId]
794
+ })
795
+ ], AgitationControlModelImpl.prototype, "handleReadyToResolve", 1);
796
+ AgitationControlModelImpl = __decorateClass$k([
797
+ kosModel(MODEL_TYPE$k)
798
+ ], AgitationControlModelImpl);
799
+ const AgitationControl = new SingletonKosModelRegistrationFactory({
800
+ class: AgitationControlModelImpl,
801
+ type: MODEL_TYPE$k
802
+ });
803
+ var __defProp$e = Object.defineProperty;
804
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
805
+ var __decorateClass$j = (decorators, target, key, kind) => {
806
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
807
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
808
+ if (decorator = decorators[i])
809
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
810
+ if (kind && result) __defProp$e(target, key, result);
811
+ return result;
812
+ };
813
+ const MODEL_TYPE$j = "animation-model";
814
+ let AnimationModelImpl = class {
815
+ id;
816
+ logger;
817
+ disableAll;
818
+ enableDial;
819
+ enableModal;
820
+ enableSideBar;
821
+ constructor(modelId, options, context) {
822
+ this.id = modelId;
823
+ this.logger = context.logger;
824
+ }
825
+ };
826
+ __decorateClass$j([
827
+ kosConfigProperty({
828
+ path: "app:kosdev.ddk:app",
829
+ attribute: "ncui.uiConfig.animations.disableAll"
830
+ })
831
+ ], AnimationModelImpl.prototype, "disableAll", 2);
832
+ __decorateClass$j([
833
+ kosConfigProperty({
834
+ path: "app:kosdev.ddk:app",
835
+ attribute: "ncui.uiConfig.animations.enableDial"
836
+ })
837
+ ], AnimationModelImpl.prototype, "enableDial", 2);
838
+ __decorateClass$j([
839
+ kosConfigProperty({
840
+ path: "app:kosdev.ddk:app",
841
+ attribute: "ncui.uiConfig.animations.enableModal"
842
+ })
843
+ ], AnimationModelImpl.prototype, "enableModal", 2);
844
+ __decorateClass$j([
845
+ kosConfigProperty({
846
+ path: "app:kosdev.ddk:app",
847
+ attribute: "ncui.uiConfig.animations.enableSideBar"
848
+ })
849
+ ], AnimationModelImpl.prototype, "enableSideBar", 2);
850
+ AnimationModelImpl = __decorateClass$j([
851
+ kosModel(MODEL_TYPE$j)
852
+ ], AnimationModelImpl);
853
+ const Animation = {
854
+ registration: {
855
+ [MODEL_TYPE$j]: {
856
+ class: AnimationModelImpl,
857
+ singleton: true
858
+ }
859
+ },
860
+ type: MODEL_TYPE$j,
861
+ predicate: isKosModel(MODEL_TYPE$j),
862
+ factory: Kos.Singleton.create(MODEL_TYPE$j)
863
+ };
864
+ const { URL: URL$a } = resolveServiceUrl("ANIMATION_SERVICE");
865
+ const { getAll: getAll$7 } = ServiceFactory.build({
866
+ basePath: `${URL$a}/api/animation`
867
+ });
868
+ const log$b = KosLog.createLogger({
869
+ name: "animation-service",
870
+ group: "Services"
871
+ });
872
+ const getAnimations = async () => {
873
+ log$b.debug("sending GET for animation");
874
+ const response = await getAll$7({});
875
+ return response;
876
+ };
877
+ const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
878
+ __proto__: null,
879
+ getAnimations
880
+ }, Symbol.toStringTag, { value: "Module" }));
881
+ var __defProp$d = Object.defineProperty;
882
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
883
+ var __decorateClass$i = (decorators, target, key, kind) => {
884
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
885
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
886
+ if (decorator = decorators[i])
887
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
888
+ if (kind && result) __defProp$d(target, key, result);
889
+ return result;
890
+ };
891
+ const MODEL_TYPE$i = "carb-water-model";
892
+ let CarbWaterModelImpl = class {
893
+ id;
894
+ assemblyModel;
895
+ logger;
896
+ constructor(modelId, _options, context) {
897
+ this.id = modelId;
898
+ this.logger = context.logger;
899
+ }
900
+ getPump() {
901
+ const carbHolder = this.assemblyModel.getHoldersByGroup("carb")[0];
902
+ const pump = carbHolder.pumps.data[0];
903
+ const model = getKosCompanionModel(pump, FcmPump.type);
904
+ return model;
905
+ }
906
+ // -------------------LIFECYCLE----------------------------
907
+ async init() {
908
+ this.logger.debug(`initializing carb-water ${this.id}`);
909
+ }
910
+ async load() {
911
+ this.logger.debug(`loading carb-water ${this.id}`);
912
+ }
913
+ };
914
+ __decorateClass$i([
915
+ kosDependency({ modelType: Assembly.type })
916
+ ], CarbWaterModelImpl.prototype, "assemblyModel", 2);
917
+ CarbWaterModelImpl = __decorateClass$i([
918
+ kosModel(MODEL_TYPE$i)
919
+ ], CarbWaterModelImpl);
920
+ const CarbWater = {
921
+ registration: {
922
+ [MODEL_TYPE$i]: {
923
+ class: CarbWaterModelImpl,
924
+ singleton: false
925
+ }
926
+ },
927
+ type: MODEL_TYPE$i,
928
+ predicate: isKosModel(MODEL_TYPE$i),
929
+ factory: Kos.Factory.create(MODEL_TYPE$i)
930
+ };
931
+ const { URL: URL$9 } = resolveServiceUrl("COPY-LOGS_SERVICE");
932
+ const { getAll: getAll$6, getOne: getOne$2, postModel: postModel$2, deleteModel } = ServiceFactory.build({
933
+ basePath: `${URL$9}/api/copy-logs`
934
+ });
935
+ const log$a = KosLog.createLogger({
936
+ name: "copy-logs-service",
937
+ group: "Services"
938
+ });
939
+ const eraseVolume = async (volumeId, tracker) => {
940
+ const response = await deleteModel({
941
+ tracker,
942
+ id: volumeId,
943
+ urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
944
+ });
945
+ if (!response?.data) {
946
+ throw new Error("No response from server");
947
+ }
948
+ return response.data;
949
+ };
950
+ const eraseAndCopyLogsToVolume = async (volumeId, tracker) => {
951
+ const response = await postModel$2({
952
+ model: {},
953
+ tracker,
954
+ urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${volumeId}`
955
+ });
956
+ if (!response?.data) {
957
+ throw new Error("No response from server");
958
+ }
959
+ return response.data;
960
+ };
961
+ const copyLogFromVolume = async (volumeId, tracker) => {
962
+ const response = await postModel$2({
963
+ model: {},
964
+ tracker,
965
+ urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
966
+ });
967
+ if (!response?.data) {
968
+ throw new Error("No response from server");
969
+ }
970
+ return response.data;
971
+ };
972
+ const getVolumes = async () => {
973
+ log$a.debug("sending GET for copy-logs");
974
+ try {
975
+ const response = await getAll$6({
976
+ urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/volumes/size`
977
+ });
978
+ return [void 0, response?.data];
979
+ } catch (error) {
980
+ if (error instanceof FetchError) {
981
+ log$a.error(`Error fetching log file size: ${error.payload.error}`);
982
+ return [error.payload.error, void 0];
983
+ }
984
+ }
985
+ return ["unknownError", void 0];
986
+ };
987
+ const getLogFileSize = async () => {
988
+ log$a.debug("sending GET for log file size");
989
+ try {
990
+ const response = await getOne$2({
991
+ urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/files/size`
992
+ });
993
+ return [void 0, response?.data];
994
+ } catch (error) {
995
+ if (error instanceof FetchError) {
996
+ log$a.error(`Error fetching log file size: ${error.payload.error}`);
997
+ return [error.payload.error, void 0];
998
+ }
999
+ }
1000
+ return ["unknownError", void 0];
1001
+ };
1002
+ const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1003
+ __proto__: null,
1004
+ copyLogFromVolume,
1005
+ eraseAndCopyLogsToVolume,
1006
+ eraseVolume,
1007
+ getLogFileSize,
1008
+ getVolumes
1009
+ }, Symbol.toStringTag, { value: "Module" }));
1010
+ var __defProp$c = Object.defineProperty;
1011
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
1012
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1013
+ var __decorateClass$h = (decorators, target, key, kind) => {
1014
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
1015
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1016
+ if (decorator = decorators[i])
1017
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1018
+ if (kind && result) __defProp$c(target, key, result);
1019
+ return result;
1020
+ };
1021
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "", value);
1022
+ const MODEL_TYPE$h = "copy-logs-model";
1023
+ let CopyLogsModelImpl = class {
1024
+ id;
1025
+ _volumes;
1026
+ storageDeviceContainer;
1027
+ _activeVolume;
1028
+ _logFileSize = 0;
1029
+ _actionState = "idle";
1030
+ copyProgress;
1031
+ constructor(modelId) {
1032
+ this.id = modelId;
1033
+ this._volumes = new KosDataContainer();
1034
+ this._activeVolume = void 0;
1035
+ this.copyProgress = {
1036
+ bytesCopied: 0,
1037
+ bytesToCopy: 0,
1038
+ filesCopied: 0,
1039
+ filesSkipped: 0
1040
+ };
1041
+ }
1042
+ // -------------------LIFECYCLE----------------------------
1043
+ get volumes() {
1044
+ return this._volumes.data;
1045
+ }
1046
+ get activeVolume() {
1047
+ return this._activeVolume;
1048
+ }
1049
+ get logFileSize() {
1050
+ return this._logFileSize;
1051
+ }
1052
+ reset() {
1053
+ this.clearActiveVolume();
1054
+ this.futureHandler.removeFuture();
1055
+ }
1056
+ clearActiveVolume() {
1057
+ this._activeVolume = void 0;
1058
+ }
1059
+ updateActiveVolume(volume) {
1060
+ this._activeVolume = volume;
1061
+ }
1062
+ get inserted() {
1063
+ return this.storageDeviceContainer.isStorageInserted;
1064
+ }
1065
+ updateLogFileSize(size) {
1066
+ this._logFileSize = size;
1067
+ }
1068
+ get canCopyLogs() {
1069
+ return this.inserted && this._activeVolume;
1070
+ }
1071
+ get actionState() {
1072
+ return this._actionState;
1073
+ }
1074
+ get diskFull() {
1075
+ return this.future?.status === FutureEndState.Success && this.copyProgress.filesSkipped > 0;
1076
+ }
1077
+ onFutureUpdate(update) {
1078
+ this.logger.info(`Future update: ${update.status}`);
1079
+ if (update.status === FutureEndState.Success) {
1080
+ this.logger.info(`Future success: ${update.status}`);
1081
+ if (this.diskFull) {
1082
+ kosAction(() => {
1083
+ update.endState = FutureEndState.Fail;
1084
+ update.reason = "errDiskFull";
1085
+ });
1086
+ }
1087
+ }
1088
+ if (update.status === FutureEndState.Fail) {
1089
+ this.logger.error(`Future failed: ${update.status}`);
1090
+ }
1091
+ if (update.note === "copy") {
1092
+ kosAction(() => {
1093
+ this._actionState = "copying";
1094
+ this.copyProgress = update.clientData || {
1095
+ bytesCopied: 0,
1096
+ bytesToCopy: 0,
1097
+ filesCopied: 0,
1098
+ filesSkipped: 0
1099
+ };
1100
+ });
1101
+ } else {
1102
+ this._actionState = "erasing";
1103
+ kosAction(() => {
1104
+ this.copyProgress = {
1105
+ bytesCopied: 0,
1106
+ bytesToCopy: 0,
1107
+ filesCopied: 0,
1108
+ filesSkipped: 0
1109
+ };
1110
+ });
1111
+ }
1112
+ }
1113
+ async eraseAndCopyVolume(tracker) {
1114
+ if (!tracker) {
1115
+ throw new Error("No tracker provided");
1116
+ }
1117
+ kosAction(() => {
1118
+ this._actionState = "erasing";
1119
+ });
1120
+ if (!this._activeVolume) {
1121
+ this.logger.error("No active volume selected");
1122
+ throw new Error("No active volume selected");
1123
+ }
1124
+ this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
1125
+ return eraseAndCopyLogsToVolume(this._activeVolume.id, tracker);
1126
+ }
1127
+ async eraseVolume(tracker) {
1128
+ if (!tracker) {
1129
+ throw new Error("No tracker provided");
1130
+ }
1131
+ kosAction(() => {
1132
+ this._actionState = "erasing";
1133
+ });
1134
+ if (!this._activeVolume) {
1135
+ this.logger.error("No active volume selected");
1136
+ throw new Error("No active volume selected");
1137
+ }
1138
+ this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
1139
+ return eraseVolume(this._activeVolume.id, tracker);
1140
+ }
1141
+ async copyLogs(tracker) {
1142
+ if (!tracker) {
1143
+ throw new Error("No tracker provided");
1144
+ }
1145
+ kosAction(() => {
1146
+ this._actionState = "copying";
1147
+ });
1148
+ if (!this._activeVolume) {
1149
+ this.logger.error("No active volume selected");
1150
+ throw new Error("No active volume selected");
1151
+ }
1152
+ this.logger.info(`Copying logs to ${this._activeVolume?.name}`);
1153
+ return copyLogFromVolume(this._activeVolume.id, tracker);
1154
+ }
1155
+ handleInsertion() {
1156
+ if (this.inserted) {
1157
+ this.syncVolumes();
1158
+ } else {
1159
+ this._volumes.clear();
1160
+ this.clearActiveVolume();
1161
+ }
1162
+ }
1163
+ async init() {
1164
+ this.logger.debug(`initializing copy-logs ${this.id}`);
1165
+ }
1166
+ async syncVolumes() {
1167
+ const [volumeError, volumes] = await getVolumes();
1168
+ const [error, logSize] = await getLogFileSize();
1169
+ if (error) {
1170
+ this.logger.error(`Error fetching log file size: ${error}`);
1171
+ return;
1172
+ }
1173
+ if (volumeError) {
1174
+ this.logger.error(`Error fetching volumes: ${volumeError}`);
1175
+ return;
1176
+ }
1177
+ if (volumes) {
1178
+ volumes.forEach((volume) => {
1179
+ const storageVolume = this.storageDeviceContainer.getModel(volume.id);
1180
+ if (storageVolume) {
1181
+ const _volume = {
1182
+ id: volume.id,
1183
+ name: storageVolume.label,
1184
+ freeBytes: volume.info.freeBytes,
1185
+ totalBytes: volume.info.totalBytes
1186
+ };
1187
+ this._volumes.addModel(_volume);
1188
+ }
1189
+ });
1190
+ if (volumes.length === 1) {
1191
+ this.updateActiveVolume(this._volumes.data[0]);
1192
+ } else {
1193
+ this.clearActiveVolume();
1194
+ }
1195
+ }
1196
+ if (logSize) {
1197
+ this.logger.info(`Log file size: ${logSize}`);
1198
+ this.updateLogFileSize(parseInt(logSize, 10));
1199
+ }
1200
+ }
1201
+ async activate() {
1202
+ this.logger.debug(`activating copy-logs ${this.id}`);
1203
+ await this.syncVolumes();
1204
+ }
1205
+ async load() {
1206
+ this.logger.debug(`loading copy-logs ${this.id}`);
1207
+ }
1208
+ };
1209
+ __publicField$1(CopyLogsModelImpl, "Registration");
1210
+ __decorateClass$h([
1211
+ kosDependency({ modelType: StorageDeviceContainer.type })
1212
+ ], CopyLogsModelImpl.prototype, "storageDeviceContainer", 2);
1213
+ __decorateClass$h([
1214
+ kosFuture()
1215
+ ], CopyLogsModelImpl.prototype, "eraseAndCopyVolume", 1);
1216
+ __decorateClass$h([
1217
+ kosFuture()
1218
+ ], CopyLogsModelImpl.prototype, "eraseVolume", 1);
1219
+ __decorateClass$h([
1220
+ kosFuture()
1221
+ ], CopyLogsModelImpl.prototype, "copyLogs", 1);
1222
+ __decorateClass$h([
1223
+ kosModelEffect({
1224
+ dependencies: (model) => [model.inserted]
1225
+ })
1226
+ ], CopyLogsModelImpl.prototype, "handleInsertion", 1);
1227
+ CopyLogsModelImpl = __decorateClass$h([
1228
+ kosModel({ modelTypeId: MODEL_TYPE$h, singleton: true }),
1229
+ kosFutureAware(),
1230
+ kosLoggerAware()
1231
+ ], CopyLogsModelImpl);
1232
+ const CopyLogs = CopyLogsModelImpl.Registration;
1233
+ const log$9 = KosLog.createLogger({
1234
+ name: "dashboard-operations-service",
1235
+ group: "Services"
1236
+ });
1237
+ const resolveAll = async (troubleIds, tracker) => {
1238
+ log$9.debug("resolveAll");
1239
+ const response = await TroubleServices.bulkResolveTroubles(
1240
+ troubleIds,
1241
+ void 0,
1242
+ tracker
1243
+ );
1244
+ return response;
1245
+ };
1246
+ const resolveTrouble = async (troubleId, tracker) => {
1247
+ log$9.debug("resolveTrouble");
1248
+ const response = await TroubleServices.resolveTrouble(
1249
+ troubleId,
1250
+ void 0,
1251
+ tracker
1252
+ );
1253
+ return response;
1254
+ };
1255
+ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1256
+ __proto__: null,
1257
+ resolveAll,
1258
+ resolveTrouble
1259
+ }, Symbol.toStringTag, { value: "Module" }));
1260
+ var __defProp$b = Object.defineProperty;
1261
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
1262
+ var __decorateClass$g = (decorators, target, key, kind) => {
1263
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
1264
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1265
+ if (decorator = decorators[i])
1266
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1267
+ if (kind && result) __defProp$b(target, key, result);
1268
+ return result;
1269
+ };
1270
+ const MODEL_TYPE$g = "dashboard-operations-model";
1271
+ function resolvableTroubleFilter(trouble) {
1272
+ return !trouble.deferred;
1273
+ }
1274
+ function deferredTroubleFilter(trouble) {
1275
+ return trouble.deferred;
1276
+ }
1277
+ let DashboardOperationsModelImpl = class {
1278
+ id;
1279
+ troubles;
1280
+ futureHandler;
1281
+ logger;
1282
+ constructor(modelId, options, context) {
1283
+ this.id = modelId;
1284
+ this.futureHandler = new FutureHandler(this);
1285
+ this.logger = context.logger;
1286
+ }
1287
+ get troublesByType() {
1288
+ return this.troubles.troubles.data.reduce(
1289
+ troubleByTypeReducer,
1290
+ {}
1291
+ );
1292
+ }
1293
+ get queuedPurgeTroubles() {
1294
+ return this.purgeTroubles.filter(deferredTroubleFilter);
1295
+ }
1296
+ get queuedPrimeTroubles() {
1297
+ return this.primeTroubles.filter(deferredTroubleFilter);
1298
+ }
1299
+ get resolvablePrimeTroubles() {
1300
+ return this.primeTroubles.filter(resolvableTroubleFilter);
1301
+ }
1302
+ get resolvablePurgeTroubles() {
1303
+ return this.purgeTroubles.filter(resolvableTroubleFilter);
1304
+ }
1305
+ get hasResolvablePurgeTroubles() {
1306
+ return this.resolvablePurgeTroubles.length > 0;
1307
+ }
1308
+ get hasResolvablePrimeTroubles() {
1309
+ return this.resolvablePrimeTroubles.length > 0;
1310
+ }
1311
+ get hasPurgeTroubles() {
1312
+ return this.purgeTroubles.length > 0;
1313
+ }
1314
+ get hasPrimeTroubles() {
1315
+ return this.primeTroubles.length > 0;
1316
+ }
1317
+ get purgeTroubles() {
1318
+ return this.troublesByType[TROUBLE_TYPE_PURGE$1] || [];
1319
+ }
1320
+ get primeTroubles() {
1321
+ return this.troublesByType[TROUBLE_TYPE_PRIME$1] || [];
1322
+ }
1323
+ get future() {
1324
+ return this.futureHandler.getFuture();
1325
+ }
1326
+ async resolveAllTroubles(type, tracker) {
1327
+ if (!tracker) {
1328
+ throw new Error("No tracker provided");
1329
+ }
1330
+ const container = type === TROUBLE_TYPE_PURGE$1 ? this.purgeTroubles : this.primeTroubles;
1331
+ const shouldDefer = container.filter((trouble) => trouble.shouldDefer);
1332
+ shouldDefer.forEach((trouble) => {
1333
+ this.logger.info(`Deferring trouble ${trouble.rawId}`);
1334
+ trouble.defer();
1335
+ });
1336
+ const allTroubles = container.filter((trouble) => !trouble.shouldDefer).map((trouble) => trouble.rawId);
1337
+ if (allTroubles.length === 0) {
1338
+ return void 0;
1339
+ }
1340
+ const response = await resolveAll(allTroubles, tracker);
1341
+ return response;
1342
+ }
1343
+ async resolveTrouble(troubleId, tracker) {
1344
+ if (!tracker) {
1345
+ throw new Error("No tracker provided");
1346
+ }
1347
+ const response = await resolveTrouble(troubleId, tracker);
1348
+ return response;
1349
+ }
1350
+ // -------------------LIFECYCLE----------------------------
1351
+ async init() {
1352
+ this.logger.debug(`initializing dashboard-operations ${this.id}`);
1353
+ }
1354
+ async load() {
1355
+ this.logger.debug(`loading dashboard-operations ${this.id}`);
1356
+ }
1357
+ };
1358
+ __decorateClass$g([
1359
+ kosDependency({
1360
+ modelType: TroubleContainer.type
1361
+ })
1362
+ ], DashboardOperationsModelImpl.prototype, "troubles", 2);
1363
+ __decorateClass$g([
1364
+ kosFuture()
1365
+ ], DashboardOperationsModelImpl.prototype, "resolveAllTroubles", 1);
1366
+ __decorateClass$g([
1367
+ kosFuture()
1368
+ ], DashboardOperationsModelImpl.prototype, "resolveTrouble", 1);
1369
+ DashboardOperationsModelImpl = __decorateClass$g([
1370
+ kosModel(MODEL_TYPE$g)
1371
+ ], DashboardOperationsModelImpl);
1372
+ const DashboardOperations = {
1373
+ registration: {
1374
+ [MODEL_TYPE$g]: {
1375
+ class: DashboardOperationsModelImpl,
1376
+ singleton: true
1377
+ }
1378
+ },
1379
+ type: MODEL_TYPE$g,
1380
+ predicate: isKosModel(MODEL_TYPE$g),
1381
+ factory: Kos.Singleton.create(MODEL_TYPE$g)
1382
+ };
1383
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
1384
+ var __decorateClass$f = (decorators, target, key, kind) => {
1385
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
1386
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1387
+ if (decorator = decorators[i])
1388
+ result = decorator(result) || result;
1389
+ return result;
1390
+ };
1391
+ const MODEL_TYPE$f = "dispenser-model";
1392
+ let DispenserModelImpl = class {
1393
+ id;
1394
+ logger;
1395
+ constructor(modelId, options, context) {
1396
+ this.id = modelId;
1397
+ this.logger = context.logger;
1398
+ }
1399
+ updateModel() {
1400
+ }
1401
+ // -------------------LIFECYCLE----------------------------
1402
+ async init() {
1403
+ this.logger.debug(`initializing dispenser ${this.id}`);
1404
+ }
1405
+ async load() {
1406
+ this.logger.debug(`loading dispenser ${this.id}`);
1407
+ }
1408
+ };
1409
+ DispenserModelImpl = __decorateClass$f([
1410
+ kosModel(MODEL_TYPE$f)
1411
+ ], DispenserModelImpl);
1412
+ const Dispenser = {
1413
+ registration: {
1414
+ [MODEL_TYPE$f]: {
1415
+ class: DispenserModelImpl,
1416
+ singleton: true
1417
+ }
1418
+ },
1419
+ type: MODEL_TYPE$f,
1420
+ predicate: isKosModel(MODEL_TYPE$f),
1421
+ factory: Kos.Singleton.create(MODEL_TYPE$f)
1422
+ };
1423
+ const { URL: URL$8 } = resolveServiceUrl("DISPENSER_SERVICE");
1424
+ const { getAll: getAll$5 } = ServiceFactory.build({
1425
+ basePath: `${URL$8}/api/dispenser`
1426
+ });
1427
+ const log$8 = KosLog.createLogger({
1428
+ name: "dispenser-service",
1429
+ group: "Services"
1430
+ });
1431
+ const getDispensers = async () => {
1432
+ log$8.debug("sending GET for dispenser");
1433
+ const response = await getAll$5({});
1434
+ return response;
1435
+ };
1436
+ const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1437
+ __proto__: null,
1438
+ getDispensers
1439
+ }, Symbol.toStringTag, { value: "Module" }));
1440
+ var __defProp$a = Object.defineProperty;
1441
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
1442
+ var __decorateClass$e = (decorators, target, key, kind) => {
1443
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
1444
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1445
+ if (decorator = decorators[i])
1446
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1447
+ if (kind && result) __defProp$a(target, key, result);
1448
+ return result;
1449
+ };
1450
+ const MODEL_TYPE$e = "dispenser-info-model";
1451
+ let DispenserInfoModelImpl = class {
1452
+ logger;
1453
+ id;
1454
+ name;
1455
+ constructor(modelId, _options, context) {
1456
+ this.id = modelId;
1457
+ this.logger = context.logger;
1458
+ }
1459
+ // -------------------LIFECYCLE----------------------------
1460
+ async init() {
1461
+ this.logger.debug(`initializing dispenser-info ${this.id}`);
1462
+ }
1463
+ async load() {
1464
+ this.logger.debug(`loading dispenser-info ${this.id}`);
1465
+ }
1466
+ };
1467
+ __decorateClass$e([
1468
+ kosConfigProperty({
1469
+ path: "kos:device",
1470
+ attribute: "name"
1471
+ })
1472
+ ], DispenserInfoModelImpl.prototype, "name", 2);
1473
+ DispenserInfoModelImpl = __decorateClass$e([
1474
+ kosModel(MODEL_TYPE$e)
1475
+ ], DispenserInfoModelImpl);
1476
+ const DispenserInfo = {
1477
+ registration: {
1478
+ [MODEL_TYPE$e]: {
1479
+ class: DispenserInfoModelImpl,
1480
+ singleton: false
1481
+ }
1482
+ },
1483
+ type: MODEL_TYPE$e,
1484
+ predicate: isKosModel(MODEL_TYPE$e),
1485
+ factory: Kos.Factory.create(
1486
+ MODEL_TYPE$e
1487
+ )
1488
+ };
1489
+ const { URL: URL$7 } = resolveServiceUrl("DISPENSER-INFO_SERVICE");
1490
+ const { getAll: getAll$4 } = ServiceFactory.build({
1491
+ basePath: `${URL$7}/api/dispenser-info`
1492
+ });
1493
+ const log$7 = KosLog.createLogger({
1494
+ name: "dispenser-info-service",
1495
+ group: "Services"
1496
+ });
1497
+ const getDispenserInfos = async () => {
1498
+ log$7.debug("sending GET for dispenser-info");
1499
+ const response = await getAll$4({});
1500
+ return response;
1501
+ };
1502
+ const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1503
+ __proto__: null,
1504
+ getDispenserInfos
1505
+ }, Symbol.toStringTag, { value: "Module" }));
1506
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
1507
+ var __decorateClass$d = (decorators, target, key, kind) => {
1508
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
1509
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1510
+ if (decorator = decorators[i])
1511
+ result = decorator(result) || result;
1512
+ return result;
1513
+ };
1514
+ const MODEL_TYPE$d = "enrollment-model";
1515
+ let EnrollmentModelImpl = class {
1516
+ id;
1517
+ logger;
1518
+ enrolled;
1519
+ constructor(modelId, _options, context) {
1520
+ this.id = modelId;
1521
+ this.logger = context.logger;
1522
+ this.enrolled = false;
1523
+ }
1524
+ updateModel(options) {
1525
+ console.log("updateModel:", options);
1526
+ }
1527
+ // -------------------LIFECYCLE----------------------------
1528
+ async init() {
1529
+ this.logger.debug(`initializing enrollment ${this.id}`);
1530
+ }
1531
+ async load() {
1532
+ this.logger.debug(`loading enrollment ${this.id}`);
1533
+ }
1534
+ };
1535
+ EnrollmentModelImpl = __decorateClass$d([
1536
+ kosModel(MODEL_TYPE$d)
1537
+ ], EnrollmentModelImpl);
1538
+ const Enrollment = {
1539
+ registration: {
1540
+ [MODEL_TYPE$d]: {
1541
+ class: EnrollmentModelImpl,
1542
+ singleton: true
1543
+ }
1544
+ },
1545
+ type: MODEL_TYPE$d,
1546
+ predicate: isKosModel(MODEL_TYPE$d),
1547
+ factory: Kos.Singleton.create(MODEL_TYPE$d)
1548
+ };
1549
+ const { URL: URL$6 } = resolveServiceUrl("ENROLLMENT_SERVICE");
1550
+ const { getAll: getAll$3 } = ServiceFactory.build({
1551
+ basePath: `${URL$6}/api/enrollment`
1552
+ });
1553
+ const log$6 = KosLog.createLogger({
1554
+ name: "enrollment-service",
1555
+ group: "Services"
1556
+ });
1557
+ const getEnrollments = async () => {
1558
+ log$6.debug("sending GET for enrollment");
1559
+ const response = await getAll$3({});
1560
+ return response;
1561
+ };
1562
+ const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1563
+ __proto__: null,
1564
+ getEnrollments
1565
+ }, Symbol.toStringTag, { value: "Module" }));
1566
+ const isMicroGroup = (group) => group.toLowerCase().includes("micros");
1567
+ const isMacroGroup = (group) => !group.toLowerCase().includes("micros");
1568
+ const macroHolderMap = (assembly) => (holderName) => {
1569
+ const holderGroup = assembly?.getHoldersByGroup(holderName);
1570
+ if (!holderGroup) {
1571
+ return null;
1572
+ }
1573
+ return holderGroup.map((holder) => {
1574
+ return { id: holder.id, name: holder.ingredientName, path: holder.path };
1575
+ });
1576
+ };
1577
+ const MACRO_KEYS = ["water", "carb", "ns", "nss"];
1578
+ const EXTENSION_POINT_DASHBOARD_KEY_FACTORY = "dashboardKeyFactory";
1579
+ const dashboardKeyFactories = [];
1580
+ registerExtensionPoint(EXTENSION_POINT_DASHBOARD_KEY_FACTORY, {
1581
+ register: (_id, factory) => {
1582
+ if (dashboardKeyFactories.includes(factory)) {
1583
+ return;
1584
+ }
1585
+ dashboardKeyFactories.push(factory);
1586
+ },
1587
+ execute: (_id, holder) => {
1588
+ const factories = dashboardKeyFactories.sort((a, b) => a.rank - b.rank);
1589
+ for (const factory of factories) {
1590
+ const key = factory.factory(holder);
1591
+ if (key) {
1592
+ return key;
1593
+ }
1594
+ }
1595
+ return void 0;
1596
+ }
1597
+ });
1598
+ const registerDashboardKeyFactory = (factory) => {
1599
+ ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].register(
1600
+ EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
1601
+ factory
1602
+ );
1603
+ };
1604
+ const executeDashboardKeyFactory = (holder) => ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].execute(
1605
+ EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
1606
+ holder
1607
+ );
1608
+ ExtensionManager.registerDashboardKeyFactory = registerDashboardKeyFactory;
1609
+ ExtensionManager.executeDashboardKeyFactory = executeDashboardKeyFactory;
1610
+ const HOUR = 3600;
1611
+ const MINUTE = 60;
1612
+ const toTimeComponents = (seconds) => {
1613
+ const hours = Math.floor(seconds / HOUR);
1614
+ const minutes = Math.floor(seconds % HOUR / MINUTE);
1615
+ return { hours, minutes };
1616
+ };
1617
+ const toSeconds = (hours, minutes) => {
1618
+ const time = hours * HOUR + minutes * MINUTE;
1619
+ return time;
1620
+ };
1621
+ const calculateTimeDifference = (date) => {
1622
+ const currentDate = /* @__PURE__ */ new Date();
1623
+ const timeDifference = currentDate.valueOf() - date.valueOf();
1624
+ const minutes = Math.floor(timeDifference / (1e3 * 60));
1625
+ const hours = Math.floor(minutes / 60);
1626
+ const days = Math.floor(hours / 24);
1627
+ const remainingMinutes = minutes % 60;
1628
+ const remainingHours = hours % 24;
1629
+ let result = "";
1630
+ if (days > 0) {
1631
+ result += `${days} day${days > 1 ? "s" : ""} `;
1632
+ }
1633
+ if (remainingHours > 0) {
1634
+ result += `${remainingHours} hour${remainingHours > 1 ? "s" : ""} `;
1635
+ }
1636
+ if (remainingMinutes > 0 || days === 0 && remainingHours === 0) {
1637
+ result += `${remainingMinutes} minute${remainingMinutes > 1 ? "s" : ""} `;
1638
+ }
1639
+ return result;
1640
+ };
1641
+ var __defProp$9 = Object.defineProperty;
1642
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
1643
+ var __decorateClass$c = (decorators, target, key, kind) => {
1644
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
1645
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1646
+ if (decorator = decorators[i])
1647
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1648
+ if (kind && result) __defProp$9(target, key, result);
1649
+ return result;
1650
+ };
1651
+ const MODEL_TYPE$c = "ingredient-summary-model";
1652
+ let IngredientSummaryModelImpl = class {
1653
+ id;
1654
+ assemblyModel;
1655
+ dashboardOperationModel;
1656
+ appModel;
1657
+ logger;
1658
+ constructor(modelId, options, context) {
1659
+ this.id = modelId;
1660
+ this.logger = context.logger;
1661
+ this.dashboardOperationModel = DashboardOperations.factory({});
1662
+ }
1663
+ get highPriorityHolders() {
1664
+ return this.assemblyModel.allHolders.filter(
1665
+ (holder) => holder.troubles.length > 0 && holder.troubles.find((trouble) => trouble.rank >= 400)
1666
+ );
1667
+ }
1668
+ get actionRequiredHolders() {
1669
+ const currentRole = this.appModel.currentRole;
1670
+ const filter = troubleVisibilityFilter(currentRole);
1671
+ return this.assemblyModel.allHolders.filter((holder) => {
1672
+ const companionModel = getKosCompanionModel(
1673
+ holder,
1674
+ FreestyleHolder.type
1675
+ );
1676
+ if (companionModel?.isRemote) {
1677
+ return false;
1678
+ }
1679
+ const visibleTroubles = holder.troubles.filter(filter);
1680
+ return visibleTroubles.length > 0 && visibleTroubles.find((trouble) => trouble.resolvable);
1681
+ });
1682
+ }
1683
+ get lowLevelHolders() {
1684
+ return this.assemblyModel.allHolders.filter((holder) => {
1685
+ const fillPercent = holder.fillPercent;
1686
+ const hasFuelGuage = holder.hasFuelGuage;
1687
+ return hasFuelGuage && fillPercent < 20;
1688
+ });
1689
+ }
1690
+ // -------------------LIFECYCLE----------------------------
1691
+ async init() {
1692
+ this.logger.debug(`initializing ingredient-summary ${this.id}`);
1693
+ }
1694
+ async load() {
1695
+ this.logger.debug(`loading ingredient-summary ${this.id}`);
1696
+ }
1697
+ };
1698
+ __decorateClass$c([
1699
+ kosDependency({ modelType: Assembly.type })
1700
+ ], IngredientSummaryModelImpl.prototype, "assemblyModel", 2);
1701
+ __decorateClass$c([
1702
+ kosDependency({ modelType: DashboardOperations.type })
1703
+ ], IngredientSummaryModelImpl.prototype, "dashboardOperationModel", 2);
1704
+ __decorateClass$c([
1705
+ kosDependency({ modelType: Application.type })
1706
+ ], IngredientSummaryModelImpl.prototype, "appModel", 2);
1707
+ IngredientSummaryModelImpl = __decorateClass$c([
1708
+ kosModel(MODEL_TYPE$c)
1709
+ ], IngredientSummaryModelImpl);
1710
+ const IngredientSummary = {
1711
+ registration: {
1712
+ [MODEL_TYPE$c]: {
1713
+ class: IngredientSummaryModelImpl,
1714
+ singleton: false
1715
+ }
1716
+ },
1717
+ type: MODEL_TYPE$c,
1718
+ predicate: isKosModel(MODEL_TYPE$c),
1719
+ factory: Kos.Factory.create(
1720
+ MODEL_TYPE$c
1721
+ )
1722
+ };
1723
+ const { URL: URL$5 } = resolveServiceUrl("LOCKOUT_SERVICE");
1724
+ const { postModel: postModel$1 } = ServiceFactory.build({
1725
+ basePath: `${URL$5}/api/app/kosdev.ddk/lockout`
1726
+ });
1727
+ const log$5 = KosLog.createLogger({ name: "lockout-service", group: "Services" });
1728
+ const lock = async () => {
1729
+ log$5.info("lock");
1730
+ const response = await postModel$1({
1731
+ model: {},
1732
+ urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/lockNow`
1733
+ });
1734
+ return response;
1735
+ };
1736
+ const unlock = async (pin) => {
1737
+ log$5.info("unlock");
1738
+ const response = await postModel$1({
1739
+ model: {},
1740
+ urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/unlock/${pin}`
1741
+ });
1742
+ return response?.data;
1743
+ };
1744
+ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1745
+ __proto__: null,
1746
+ lock,
1747
+ unlock
1748
+ }, Symbol.toStringTag, { value: "Module" }));
1749
+ var __defProp$8 = Object.defineProperty;
1750
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
1751
+ var __decorateClass$b = (decorators, target, key, kind) => {
1752
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
1753
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1754
+ if (decorator = decorators[i])
1755
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1756
+ if (kind && result) __defProp$8(target, key, result);
1757
+ return result;
1758
+ };
1759
+ const MODEL_TYPE$b = "lockout-model";
1760
+ const scheduleData = [
1761
+ { day: "monday", lock: "dayWiseLockConfigMap.Mon.enabled", open: "dayWiseLockConfigMap.Mon.unlockTime", close: "dayWiseLockConfigMap.Mon.lockTime" },
1762
+ { day: "tuesday", lock: "dayWiseLockConfigMap.Tue.enabled", open: "dayWiseLockConfigMap.Tue.unlockTime", close: "dayWiseLockConfigMap.Tue.lockTime" },
1763
+ { day: "wednesday", lock: "dayWiseLockConfigMap.Wed.enabled", open: "dayWiseLockConfigMap.Wed.unlockTime", close: "dayWiseLockConfigMap.Wed.lockTime" },
1764
+ { day: "thursday", lock: "dayWiseLockConfigMap.Thu.enabled", open: "dayWiseLockConfigMap.Thu.unlockTime", close: "dayWiseLockConfigMap.Thu.lockTime" },
1765
+ { day: "friday", lock: "dayWiseLockConfigMap.Fri.enabled", open: "dayWiseLockConfigMap.Fri.unlockTime", close: "dayWiseLockConfigMap.Fri.lockTime" },
1766
+ { day: "saturday", lock: "dayWiseLockConfigMap.Sat.enabled", open: "dayWiseLockConfigMap.Sat.unlockTime", close: "dayWiseLockConfigMap.Sat.lockTime" },
1767
+ { day: "sunday", lock: "dayWiseLockConfigMap.Sun.enabled", open: "dayWiseLockConfigMap.Sun.unlockTime", close: "dayWiseLockConfigMap.Sun.lockTime" }
1768
+ ];
1769
+ let LockoutModelImpl = class {
1770
+ id;
1771
+ logger;
1772
+ dayEnabledList = [
1773
+ "dayWiseLockConfigMap.Sun.enabled",
1774
+ "dayWiseLockConfigMap.Mon.enabled",
1775
+ "dayWiseLockConfigMap.Tue.enabled",
1776
+ "dayWiseLockConfigMap.Wed.enabled",
1777
+ "dayWiseLockConfigMap.Thu.enabled",
1778
+ "dayWiseLockConfigMap.Fri.enabled",
1779
+ "dayWiseLockConfigMap.Sat.enabled"
1780
+ ];
1781
+ dayOpenAtList = [
1782
+ "dayWiseLockConfigMap.Sun.unlockTime",
1783
+ "dayWiseLockConfigMap.Mon.unlockTime",
1784
+ "dayWiseLockConfigMap.Tue.unlockTime",
1785
+ "dayWiseLockConfigMap.Wed.unlockTime",
1786
+ "dayWiseLockConfigMap.Thu.unlockTime",
1787
+ "dayWiseLockConfigMap.Fri.unlockTime",
1788
+ "dayWiseLockConfigMap.Sat.unlockTime"
1789
+ ];
1790
+ dayCloseAtList = [
1791
+ "dayWiseLockConfigMap.Sun.lockTime",
1792
+ "dayWiseLockConfigMap.Mon.lockTime",
1793
+ "dayWiseLockConfigMap.Tue.lockTime",
1794
+ "dayWiseLockConfigMap.Wed.lockTime",
1795
+ "dayWiseLockConfigMap.Thu.lockTime",
1796
+ "dayWiseLockConfigMap.Fri.lockTime",
1797
+ "dayWiseLockConfigMap.Sat.lockTime"
1798
+ ];
1799
+ saveMap;
1800
+ pin;
1801
+ nextLockSkipped;
1802
+ nextLockTime;
1803
+ nextUnLockTime;
1804
+ cuiLockout;
1805
+ get enabled() {
1806
+ const oneTimeLockConfigLockTime = this.getProp(
1807
+ "oneTimeLockConfig.lockTime"
1808
+ );
1809
+ const oneTimeLockEnabled = oneTimeLockConfigLockTime !== void 0 && oneTimeLockConfigLockTime !== "";
1810
+ const lockScheduleEnabled = this.getProp("lockScheduleEnabled");
1811
+ const enabled = oneTimeLockEnabled || lockScheduleEnabled;
1812
+ return enabled;
1813
+ }
1814
+ get schedule() {
1815
+ return scheduleData;
1816
+ }
1817
+ constructor(modelId, _options, context) {
1818
+ this.id = modelId;
1819
+ this.logger = context.logger;
1820
+ this.saveMap = /* @__PURE__ */ new Map();
1821
+ }
1822
+ getProp(key) {
1823
+ return this.saveMap.get(key);
1824
+ }
1825
+ setProp(key, value) {
1826
+ this.saveMap.set(key, value);
1827
+ }
1828
+ // Skip or resume the next lock...
1829
+ toggleSkip() {
1830
+ const nextLockSkipped = this.nextLockSkipped.value;
1831
+ if (nextLockSkipped === "0") {
1832
+ const nextLockTime = this.nextLockTime.value;
1833
+ if (nextLockTime !== void 0)
1834
+ this.nextLockSkipped.updateProperty(nextLockTime);
1835
+ } else {
1836
+ this.nextLockSkipped.updateProperty("0");
1837
+ }
1838
+ }
1839
+ async unlock(pin) {
1840
+ return await unlock(pin);
1841
+ }
1842
+ async save() {
1843
+ this.saveMap.forEach((value, key) => {
1844
+ if (value !== this.cuiLockout.props[key])
1845
+ this.cuiLockout.props[key] = value;
1846
+ });
1847
+ return this.cuiLockout.updateConfigBean();
1848
+ }
1849
+ reset() {
1850
+ this.cuiLockout.props.entries.forEach(
1851
+ ([key, value]) => this.saveMap.set(key, value)
1852
+ );
1853
+ }
1854
+ // -------------------LIFECYCLE----------------------------
1855
+ async init() {
1856
+ this.logger.debug(`initializing lockout ${this.id}`);
1857
+ this.cuiLockout.props.entries.forEach(
1858
+ ([key, value]) => this.saveMap.set(key, value)
1859
+ );
1860
+ }
1861
+ async load() {
1862
+ this.logger.debug(`loading lockout ${this.id}`);
1863
+ }
1864
+ };
1865
+ __decorateClass$b([
1866
+ kosConfigProperty({
1867
+ path: "app:kosdev.ddk:service:cuiLockout",
1868
+ attribute: "pin"
1869
+ })
1870
+ ], LockoutModelImpl.prototype, "pin", 2);
1871
+ __decorateClass$b([
1872
+ kosConfigProperty({
1873
+ path: "app:kosdev.ddk:service:cuiLockout",
1874
+ attribute: "nextLockSkipped"
1875
+ })
1876
+ ], LockoutModelImpl.prototype, "nextLockSkipped", 2);
1877
+ __decorateClass$b([
1878
+ kosConfigProperty({
1879
+ path: "app:kosdev.ddk:service:cuiLockout",
1880
+ attribute: "nextLockTime"
1881
+ })
1882
+ ], LockoutModelImpl.prototype, "nextLockTime", 2);
1883
+ __decorateClass$b([
1884
+ kosConfigProperty({
1885
+ path: "app:kosdev.ddk:service:cuiLockout",
1886
+ attribute: "nextUnLockTime"
1887
+ })
1888
+ ], LockoutModelImpl.prototype, "nextUnLockTime", 2);
1889
+ __decorateClass$b([
1890
+ kosConfigBean({ path: "app:kosdev.ddk:service:cuiLockout" })
1891
+ ], LockoutModelImpl.prototype, "cuiLockout", 2);
1892
+ LockoutModelImpl = __decorateClass$b([
1893
+ kosModel(MODEL_TYPE$b)
1894
+ ], LockoutModelImpl);
1895
+ const Lockout = new SingletonKosModelRegistrationFactory({
1896
+ class: LockoutModelImpl,
1897
+ type: MODEL_TYPE$b
1898
+ });
1899
+ const purgeMacroPumps = async (troubleIds, tracker) => {
1900
+ const response = await TroubleServices.bulkResolveTroubles(
1901
+ troubleIds,
1902
+ void 0,
1903
+ tracker
1904
+ );
1905
+ return response;
1906
+ };
1907
+ var __defProp$7 = Object.defineProperty;
1908
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
1909
+ var __decorateClass$a = (decorators, target, key, kind) => {
1910
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
1911
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1912
+ if (decorator = decorators[i])
1913
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1914
+ if (kind && result) __defProp$7(target, key, result);
1915
+ return result;
1916
+ };
1917
+ const MODEL_TYPE$a = "macro-assignment-model";
1918
+ const TROUBLE_TYPE_PURGE = "PurgeTrouble";
1919
+ const TROUBLE_TYPE_PRIME = "PrimeTrouble";
1920
+ let MacroAssignmentModelImpl = class {
1921
+ id;
1922
+ logger;
1923
+ /**
1924
+ * futureHandler is used to handle async operations
1925
+ */
1926
+ futureHandler;
1927
+ holders;
1928
+ ingredients;
1929
+ constructor(modelId, _options, context) {
1930
+ this.id = modelId;
1931
+ this.futureHandler = new FutureHandler();
1932
+ this.logger = context.logger;
1933
+ }
1934
+ /**
1935
+ * shortcut to the current running future
1936
+ */
1937
+ get future() {
1938
+ return this.futureHandler.future;
1939
+ }
1940
+ /**
1941
+ * Represents the subset of holder that are identified as holding macros.
1942
+ *
1943
+ * This is determined by the group property of the holder which is determined
1944
+ * by the holders position in the dispenser assembly.
1945
+ */
1946
+ get macroHolders() {
1947
+ return this.holders.holders.getIndexByKey("group", "macros").sort((a, b) => {
1948
+ if (a.name < b.name) return -1;
1949
+ if (a.name > b.name) return 1;
1950
+ return 0;
1951
+ });
1952
+ }
1953
+ /**
1954
+ * Returns true if there are any macro holders in the dispenser assembly
1955
+ */
1956
+ get hasMacroHolders() {
1957
+ return this.macroHolders.length > 0;
1958
+ }
1959
+ /**
1960
+ * Returns all of the purge troubles for the macro holders.
1961
+ *
1962
+ * Relying on the indexing of troubles by type to find the purge troubles.
1963
+ */
1964
+ get holderPurgeTroubles() {
1965
+ const troubles = this.macroHolders.reduce((acc, curr) => {
1966
+ const purgeTroubles = curr.troublesByType[TROUBLE_TYPE_PURGE] || [];
1967
+ acc = [...acc, ...purgeTroubles];
1968
+ return acc;
1969
+ }, []);
1970
+ return troubles;
1971
+ }
1972
+ get holderPrimeTroubles() {
1973
+ const troubles = this.macroHolders.reduce((acc, curr) => {
1974
+ const primeTroubles = curr.troublesByType[TROUBLE_TYPE_PRIME] || [];
1975
+ acc = [...acc, ...primeTroubles];
1976
+ return acc;
1977
+ }, []);
1978
+ return troubles;
1979
+ }
1980
+ /**
1981
+ * Returns true if there are any purge troubles for the macro holders.
1982
+ */
1983
+ get hasHolderPurgeTroubles() {
1984
+ return this.holderPurgeTroubles.length > 0;
1985
+ }
1986
+ get hasHolderPrimeTroubles() {
1987
+ return this.holderPrimeTroubles.length > 0;
1988
+ }
1989
+ /**
1990
+ * Represents the subset of ingredients that are identified as macros
1991
+ *
1992
+ * This is determined by the `ingredientMacro` property of the ingredient
1993
+ * which is derived from the `bib` and `sweetener` properties of the ingredient.
1994
+ *
1995
+ * The `ingredientMacro` property is set by the `ingredientDataMapper` extension point.
1996
+ *
1997
+ * The macro ingredients are indexed by the `ingredientIndexExtension` extension point using
1998
+ * the `ingredientMacro` property.
1999
+ */
2000
+ get macroIngredients() {
2001
+ return this.ingredients.ingredients.getIndexByKey("macro", "macro");
2002
+ }
2003
+ /**
2004
+ * Returns true if there are any macro ingredients in the dispenser brandset
2005
+ */
2006
+ get hasMacroIngredients() {
2007
+ return this.macroIngredients.length > 0;
2008
+ }
2009
+ async resolveAll(type, tracker) {
2010
+ if (!tracker) {
2011
+ throw new Error("No tracker provided");
2012
+ }
2013
+ const container = type === TROUBLE_TYPE_PURGE ? this.holderPurgeTroubles : this.holderPrimeTroubles;
2014
+ const allTroubles = container.map((trouble) => trouble.rawId);
2015
+ const response = await purgeMacroPumps(allTroubles, tracker);
2016
+ return response;
2017
+ }
2018
+ };
2019
+ __decorateClass$a([
2020
+ kosDependency({ modelType: HolderContainer.type })
2021
+ ], MacroAssignmentModelImpl.prototype, "holders", 2);
2022
+ __decorateClass$a([
2023
+ kosDependency({ modelType: IngredientContainer.type })
2024
+ ], MacroAssignmentModelImpl.prototype, "ingredients", 2);
2025
+ __decorateClass$a([
2026
+ kosFuture()
2027
+ ], MacroAssignmentModelImpl.prototype, "resolveAll", 1);
2028
+ MacroAssignmentModelImpl = __decorateClass$a([
2029
+ kosModel(MODEL_TYPE$a)
2030
+ ], MacroAssignmentModelImpl);
2031
+ const MacroAssignment = {
2032
+ registration: {
2033
+ [MODEL_TYPE$a]: {
2034
+ class: MacroAssignmentModelImpl,
2035
+ singleton: true
2036
+ }
2037
+ },
2038
+ type: MODEL_TYPE$a,
2039
+ predicate: isKosModel(MODEL_TYPE$a),
2040
+ factory: Kos.Singleton.create(
2041
+ MODEL_TYPE$a
2042
+ )
2043
+ };
2044
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
2045
+ var __decorateClass$9 = (decorators, target, key, kind) => {
2046
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
2047
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2048
+ if (decorator = decorators[i])
2049
+ result = decorator(result) || result;
2050
+ return result;
2051
+ };
2052
+ const MODEL_TYPE$9 = "network-test-model";
2053
+ let NetworkTestModelImpl = class {
2054
+ id;
2055
+ group;
2056
+ passed;
2057
+ inProgress;
2058
+ failureTime;
2059
+ timestamp;
2060
+ name;
2061
+ results;
2062
+ logger;
2063
+ constructor(modelId, options, context) {
2064
+ this.id = modelId;
2065
+ this.logger = context.logger;
2066
+ this.group = options.group;
2067
+ this.passed = false;
2068
+ this.inProgress = false;
2069
+ this.name = options.name;
2070
+ this.results = [];
2071
+ }
2072
+ updateModel(options) {
2073
+ this.group = options.group;
2074
+ this.name = options.name;
2075
+ this.passed = options.passed;
2076
+ this.failureTime = options.failureTime;
2077
+ this.inProgress = options.inProgress;
2078
+ this.timestamp = options.timestamp;
2079
+ this.results = options.results;
2080
+ }
2081
+ // -------------------LIFECYCLE----------------------------
2082
+ async init() {
2083
+ this.logger.debug(`initializing network-test ${this.id}`);
2084
+ }
2085
+ async load() {
2086
+ this.logger.debug(`loading network-test ${this.id}`);
2087
+ }
2088
+ };
2089
+ NetworkTestModelImpl = __decorateClass$9([
2090
+ kosModel(MODEL_TYPE$9)
2091
+ ], NetworkTestModelImpl);
2092
+ const NetworkTest = {
2093
+ registration: {
2094
+ [MODEL_TYPE$9]: {
2095
+ class: NetworkTestModelImpl,
2096
+ singleton: false
2097
+ }
2098
+ },
2099
+ type: MODEL_TYPE$9,
2100
+ predicate: isKosModel(MODEL_TYPE$9),
2101
+ factory: Kos.Factory.create(MODEL_TYPE$9)
2102
+ };
2103
+ const { URL: URL$4 } = resolveServiceUrl("NETWORK-TEST_SERVICE");
2104
+ const { getAll: getAll$2, getOne: getOne$1 } = ServiceFactory.build({
2105
+ basePath: `${URL$4}/api/app/ncui/network/tests`
2106
+ });
2107
+ const log$4 = KosLog.createLogger({
2108
+ name: "network-test-service",
2109
+ group: "Services"
2110
+ });
2111
+ const getNetworkTests = async () => {
2112
+ log$4.debug("sending GET for network-test");
2113
+ const response = await getAll$2({
2114
+ urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests`
2115
+ });
2116
+ return response?.data;
2117
+ };
2118
+ const getTestsReports = async () => {
2119
+ const response = await getOne$1({
2120
+ urlOverride: `${URL$4}/api/app/kosdev.ddk/network/reports`
2121
+ });
2122
+ return response?.data;
2123
+ };
2124
+ const performGroupTest = async (group, tracker) => {
2125
+ const response = await getOne$1({
2126
+ urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests/run/group/${group}`,
2127
+ tracker
2128
+ });
2129
+ return response;
2130
+ };
2131
+ const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2132
+ __proto__: null,
2133
+ getNetworkTests,
2134
+ getTestsReports,
2135
+ performGroupTest
2136
+ }, Symbol.toStringTag, { value: "Module" }));
2137
+ var __defProp$6 = Object.defineProperty;
2138
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
2139
+ var __decorateClass$8 = (decorators, target, key, kind) => {
2140
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
2141
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2142
+ if (decorator = decorators[i])
2143
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2144
+ if (kind && result) __defProp$6(target, key, result);
2145
+ return result;
2146
+ };
2147
+ const MODEL_TYPE$8 = "network-test-container-model";
2148
+ let NetworkTestContainerModelImpl = class {
2149
+ id;
2150
+ logger;
2151
+ lastTested;
2152
+ futureHandler;
2153
+ models;
2154
+ constructor(modelId, options, context) {
2155
+ this.id = modelId;
2156
+ this.logger = context.logger;
2157
+ this.futureHandler = new FutureHandler(this);
2158
+ this.models = new KosModelContainer({
2159
+ parentId: modelId,
2160
+ indexMap: {
2161
+ group: "group"
2162
+ }
2163
+ });
2164
+ this.lastTested = /* @__PURE__ */ new Date("default");
2165
+ }
2166
+ get data() {
2167
+ return this.models.data;
2168
+ }
2169
+ addModel(model) {
2170
+ this.models.addModel(model);
2171
+ }
2172
+ removeModel(id) {
2173
+ this.models.removeModel(id);
2174
+ }
2175
+ getModel(id) {
2176
+ return this.models.getModel(id);
2177
+ }
2178
+ // -------------------LIFECYCLE----------------------------
2179
+ async init() {
2180
+ this.logger.debug(
2181
+ `initializing network-test-container container ${this.id}`
2182
+ );
2183
+ }
2184
+ getLastTested(groupName) {
2185
+ const dateArray = this.models.getIndexByKey("group", groupName).map((obj) => obj.timestamp && new Date(obj.timestamp));
2186
+ const latestDate = Math.max(
2187
+ ...dateArray.map((date) => date ? date.getTime() : 0)
2188
+ );
2189
+ return latestDate ? calculateTimeDifference(new Date(latestDate)) : "";
2190
+ }
2191
+ async load() {
2192
+ this.logger.debug(`loading network-test-container container ${this.id}`);
2193
+ const testResponse = await getNetworkTests();
2194
+ const testReportResponse = await getTestsReports();
2195
+ if (testResponse) {
2196
+ testResponse.forEach((item) => {
2197
+ const testModel = NetworkTest.factory(item.id)(item);
2198
+ this.addModel(testModel);
2199
+ });
2200
+ }
2201
+ if (testResponse && testReportResponse) {
2202
+ testResponse.forEach((item) => {
2203
+ const groupReport = testReportResponse?.[item.group];
2204
+ const testReport = groupReport?.[item.id];
2205
+ const testModel = this.getModel(item.id);
2206
+ if (testModel && testReport) {
2207
+ const update = {
2208
+ group: testReport.group,
2209
+ name: testReport.name,
2210
+ passed: testReport.passed,
2211
+ failureTime: testReport.failureTime ? new Date(testReport.failureTime) : void 0,
2212
+ inProgress: testReport.inProgress,
2213
+ timestamp: new Date(testReport.timestamp),
2214
+ results: testReport.results
2215
+ };
2216
+ testModel.updateModel(update);
2217
+ }
2218
+ });
2219
+ }
2220
+ }
2221
+ async performTest(group, tracker) {
2222
+ if (!tracker) {
2223
+ throw new Error("No tracker provided");
2224
+ }
2225
+ const result = await performGroupTest(group, tracker);
2226
+ return result?.data;
2227
+ }
2228
+ onFutureUpdate(future) {
2229
+ const { clientData } = future;
2230
+ if (clientData) {
2231
+ clientData.forEach((item) => {
2232
+ const testModel = this.getModel(item.id);
2233
+ kosAction(() => {
2234
+ this.lastTested = this.lastTested > new Date(item.timestamp) ? this.lastTested : new Date(item.timestamp);
2235
+ });
2236
+ if (testModel) {
2237
+ const update = {
2238
+ group: item.group,
2239
+ name: item.name,
2240
+ passed: item.passed,
2241
+ failureTime: item.failureTime ? new Date(item.failureTime) : void 0,
2242
+ inProgress: item.inProgress,
2243
+ timestamp: new Date(item.timestamp),
2244
+ results: item.results
2245
+ };
2246
+ kosAction(() => {
2247
+ testModel.updateModel(update);
2248
+ });
2249
+ }
2250
+ });
2251
+ }
2252
+ }
2253
+ };
2254
+ __decorateClass$8([
2255
+ kosChild
2256
+ ], NetworkTestContainerModelImpl.prototype, "models", 2);
2257
+ __decorateClass$8([
2258
+ kosFuture()
2259
+ ], NetworkTestContainerModelImpl.prototype, "performTest", 1);
2260
+ NetworkTestContainerModelImpl = __decorateClass$8([
2261
+ kosModel(MODEL_TYPE$8)
2262
+ ], NetworkTestContainerModelImpl);
2263
+ const NetworkTestContainer = {
2264
+ registration: {
2265
+ [MODEL_TYPE$8]: {
2266
+ class: NetworkTestContainerModelImpl,
2267
+ singleton: true
2268
+ },
2269
+ ...NetworkTest.registration
2270
+ },
2271
+ type: MODEL_TYPE$8,
2272
+ predicate: isKosModel(MODEL_TYPE$8),
2273
+ factory: Kos.Singleton.create(MODEL_TYPE$8)
2274
+ };
2275
+ var __defProp$5 = Object.defineProperty;
2276
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
2277
+ var __decorateClass$7 = (decorators, target, key, kind) => {
2278
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
2279
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2280
+ if (decorator = decorators[i])
2281
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2282
+ if (kind && result) __defProp$5(target, key, result);
2283
+ return result;
2284
+ };
2285
+ const MODEL_TYPE$7 = "nutritive-sweetener-model";
2286
+ const PATH_PUMP_STATE = createPropKey("statePath");
2287
+ let NutritiveSweetenerModelImpl = class {
2288
+ id;
2289
+ assemblyModel;
2290
+ pumpState;
2291
+ constructor(modelId, _options) {
2292
+ this.id = modelId;
2293
+ }
2294
+ get holder() {
2295
+ const nsHolder = this.assemblyModel.getHoldersByGroup("ns")[0];
2296
+ return nsHolder;
2297
+ }
2298
+ getHolder() {
2299
+ return this.holder;
2300
+ }
2301
+ get statePath() {
2302
+ return `${this.pump.path}:airVent:state`;
2303
+ }
2304
+ get pump() {
2305
+ return this.holder.pumps.data[0];
2306
+ }
2307
+ getPump() {
2308
+ return this.pump;
2309
+ }
2310
+ };
2311
+ __decorateClass$7([
2312
+ kosDependency({ modelType: Assembly.type })
2313
+ ], NutritiveSweetenerModelImpl.prototype, "assemblyModel", 2);
2314
+ __decorateClass$7([
2315
+ kosStateBean({
2316
+ path: PATH_PUMP_STATE
2317
+ })
2318
+ ], NutritiveSweetenerModelImpl.prototype, "pumpState", 2);
2319
+ NutritiveSweetenerModelImpl = __decorateClass$7([
2320
+ kosModel(MODEL_TYPE$7),
2321
+ kosLoggerAware()
2322
+ ], NutritiveSweetenerModelImpl);
2323
+ const NutritiveSweetener = {
2324
+ registration: {
2325
+ [MODEL_TYPE$7]: {
2326
+ class: NutritiveSweetenerModelImpl,
2327
+ singleton: false
2328
+ }
2329
+ },
2330
+ type: MODEL_TYPE$7,
2331
+ predicate: isKosModel(MODEL_TYPE$7),
2332
+ factory: Kos.Factory.create(MODEL_TYPE$7)
2333
+ };
2334
+ var __defProp$4 = Object.defineProperty;
2335
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
2336
+ var __decorateClass$6 = (decorators, target, key, kind) => {
2337
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
2338
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2339
+ if (decorator = decorators[i])
2340
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2341
+ if (kind && result) __defProp$4(target, key, result);
2342
+ return result;
2343
+ };
2344
+ const MODEL_TYPE$6 = "plain-water-model";
2345
+ let PlainWaterModelImpl = class {
2346
+ id;
2347
+ assemblyModel;
2348
+ logger;
2349
+ constructor(modelId, _options, context) {
2350
+ this.id = modelId;
2351
+ this.logger = context.logger;
2352
+ }
2353
+ getHolder() {
2354
+ const waterHolder = this.assemblyModel.getHoldersByGroup("water")[0];
2355
+ return waterHolder;
2356
+ }
2357
+ getPump() {
2358
+ const waterHolder = this.getHolder();
2359
+ const pump = waterHolder?.pumps?.data?.[0];
2360
+ const model = getKosCompanionModel(pump, FcmPump.type);
2361
+ return model;
2362
+ }
2363
+ // -------------------LIFECYCLE----------------------------
2364
+ async init() {
2365
+ this.logger.debug(`initializing plain-water ${this.id}`);
2366
+ }
2367
+ async load() {
2368
+ this.logger.debug(`loading plain-water ${this.id}`);
2369
+ }
2370
+ };
2371
+ __decorateClass$6([
2372
+ kosDependency({ modelType: Assembly.type })
2373
+ ], PlainWaterModelImpl.prototype, "assemblyModel", 2);
2374
+ PlainWaterModelImpl = __decorateClass$6([
2375
+ kosModel(MODEL_TYPE$6)
2376
+ ], PlainWaterModelImpl);
2377
+ const PlainWater = {
2378
+ registration: {
2379
+ [MODEL_TYPE$6]: {
2380
+ class: PlainWaterModelImpl,
2381
+ singleton: false
2382
+ }
2383
+ },
2384
+ type: MODEL_TYPE$6,
2385
+ predicate: isKosModel(MODEL_TYPE$6),
2386
+ factory: Kos.Factory.create(MODEL_TYPE$6)
2387
+ };
2388
+ const { URL: URL$3 } = resolveServiceUrl("REBOOT_SERVICE");
2389
+ const { postModel } = ServiceFactory.build({
2390
+ basePath: `${URL$3}/api/reboot`
2391
+ });
2392
+ const log$3 = KosLog.createLogger({ name: "reboot-service", group: "Services" });
2393
+ const rebootDispenser = async () => {
2394
+ log$3.debug("sending POST call for Reboot Dispenser");
2395
+ const response = await postModel({
2396
+ urlOverride: `${URL$3}/api/app/kosdev.ddk/ncui/reboot`,
2397
+ model: {}
2398
+ });
2399
+ return response;
2400
+ };
2401
+ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2402
+ __proto__: null,
2403
+ rebootDispenser
2404
+ }, Symbol.toStringTag, { value: "Module" }));
2405
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
2406
+ var __decorateClass$5 = (decorators, target, key, kind) => {
2407
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
2408
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2409
+ if (decorator = decorators[i])
2410
+ result = decorator(result) || result;
2411
+ return result;
2412
+ };
2413
+ const MODEL_TYPE$5 = "reboot-model";
2414
+ let RebootModelImpl = class {
2415
+ id;
2416
+ logger;
2417
+ constructor(modelId, options, context) {
2418
+ this.id = modelId;
2419
+ this.logger = context.logger;
2420
+ }
2421
+ async completeReboot() {
2422
+ await rebootDispenser();
2423
+ }
2424
+ updateModel() {
2425
+ }
2426
+ // -------------------LIFECYCLE----------------------------
2427
+ async init() {
2428
+ this.logger.debug(`initializing reboot ${this.id}`);
2429
+ }
2430
+ async load() {
2431
+ this.logger.debug(`loading reboot ${this.id}`);
2432
+ }
2433
+ };
2434
+ RebootModelImpl = __decorateClass$5([
2435
+ kosModel(MODEL_TYPE$5)
2436
+ ], RebootModelImpl);
2437
+ const Reboot = {
2438
+ registration: {
2439
+ [MODEL_TYPE$5]: {
2440
+ class: RebootModelImpl,
2441
+ singleton: false
2442
+ }
2443
+ },
2444
+ type: MODEL_TYPE$5,
2445
+ predicate: isKosModel(MODEL_TYPE$5),
2446
+ factory: Kos.Factory.create(MODEL_TYPE$5)
2447
+ };
2448
+ var __defProp$3 = Object.defineProperty;
2449
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
2450
+ var __decorateClass$4 = (decorators, target, key, kind) => {
2451
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
2452
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2453
+ if (decorator = decorators[i])
2454
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2455
+ if (kind && result) __defProp$3(target, key, result);
2456
+ return result;
2457
+ };
2458
+ const MODEL_TYPE$4 = "settings-model";
2459
+ let SettingsModelImpl = class {
2460
+ id;
2461
+ logger;
2462
+ ncuiLanguageData;
2463
+ resolveDelaysMs;
2464
+ dateFormat;
2465
+ timeFormat;
2466
+ hidePlainWaterBev;
2467
+ hideCarbWaterBev;
2468
+ ncuiLanguage;
2469
+ name;
2470
+ activateAndRebootTime;
2471
+ horizontalMode;
2472
+ constructor(modelId, _options, context) {
2473
+ this.id = modelId;
2474
+ this.logger = context.logger;
2475
+ }
2476
+ // -------------------LIFECYCLE----------------------------
2477
+ async ready() {
2478
+ this.updateDisplayMode();
2479
+ }
2480
+ async getNcuiLanguageList() {
2481
+ this.ncuiLanguageData = {
2482
+ status: 200,
2483
+ data: {
2484
+ languages: [
2485
+ {
2486
+ name: "English",
2487
+ locale: "en"
2488
+ }
2489
+ ]
2490
+ }
2491
+ };
2492
+ }
2493
+ async load() {
2494
+ this.logger.debug(`loading settings ${this.id}`);
2495
+ this.ncuiLanguageData = {
2496
+ status: 200,
2497
+ data: {
2498
+ languages: [
2499
+ {
2500
+ name: "English",
2501
+ locale: "en"
2502
+ }
2503
+ ]
2504
+ }
2505
+ };
2506
+ }
2507
+ handleUpdateDisplayMode() {
2508
+ this.updateDisplayMode();
2509
+ }
2510
+ updateDisplayMode() {
2511
+ if (this.horizontalMode.value) {
2512
+ document.body.setAttribute("data-dashboard-layout", "horizontal");
2513
+ } else {
2514
+ document.body.setAttribute("data-dashboard-layout", "vertical");
2515
+ }
2516
+ }
2517
+ };
2518
+ __decorateClass$4([
2519
+ kosConfigProperty({
2520
+ path: "system:app",
2521
+ attribute: "resolveDelaysMs"
2522
+ // optionsExpander: () => [],
2523
+ })
2524
+ ], SettingsModelImpl.prototype, "resolveDelaysMs", 2);
2525
+ __decorateClass$4([
2526
+ kosConfigProperty({
2527
+ path: "system:app",
2528
+ attribute: "dateFormat"
2529
+ // optionsExpander: () => [],
2530
+ })
2531
+ ], SettingsModelImpl.prototype, "dateFormat", 2);
2532
+ __decorateClass$4([
2533
+ kosConfigProperty({
2534
+ path: "system:app",
2535
+ attribute: "timeFormat"
2536
+ // optionsExpander: () => [],
2537
+ })
2538
+ ], SettingsModelImpl.prototype, "timeFormat", 2);
2539
+ __decorateClass$4([
2540
+ kosConfigProperty({
2541
+ path: "app:kosdev.ddk:app",
2542
+ attribute: "ncui.hidePlainWaterBev"
2543
+ })
2544
+ ], SettingsModelImpl.prototype, "hidePlainWaterBev", 2);
2545
+ __decorateClass$4([
2546
+ kosConfigProperty({
2547
+ path: "app:kosdev.ddk:app",
2548
+ attribute: "ncui.hideCarbWaterBev"
2549
+ })
2550
+ ], SettingsModelImpl.prototype, "hideCarbWaterBev", 2);
2551
+ __decorateClass$4([
2552
+ kosConfigProperty({
2553
+ path: "app:kosdev.ddk:app",
2554
+ attribute: "ncui.ncuiLanguage"
2555
+ })
2556
+ ], SettingsModelImpl.prototype, "ncuiLanguage", 2);
2557
+ __decorateClass$4([
2558
+ kosConfigProperty({
2559
+ path: "kos:device",
2560
+ attribute: "name"
2561
+ })
2562
+ ], SettingsModelImpl.prototype, "name", 2);
2563
+ __decorateClass$4([
2564
+ kosConfigProperty({
2565
+ path: "kos:service:OTA",
2566
+ attribute: "activateAndRebootTime"
2567
+ })
2568
+ ], SettingsModelImpl.prototype, "activateAndRebootTime", 2);
2569
+ __decorateClass$4([
2570
+ kosConfigProperty({
2571
+ path: "app:kosdev.ddk:app",
2572
+ attribute: "ncui.uiConfig.display.horizontalMode"
2573
+ })
2574
+ ], SettingsModelImpl.prototype, "horizontalMode", 2);
2575
+ __decorateClass$4([
2576
+ kosModelEffect({
2577
+ dependencies: (model) => [model.horizontalMode.value]
2578
+ })
2579
+ ], SettingsModelImpl.prototype, "handleUpdateDisplayMode", 1);
2580
+ SettingsModelImpl = __decorateClass$4([
2581
+ kosModel(MODEL_TYPE$4)
2582
+ ], SettingsModelImpl);
2583
+ const Settings = {
2584
+ registration: {
2585
+ [MODEL_TYPE$4]: {
2586
+ class: SettingsModelImpl,
2587
+ singleton: true
2588
+ }
2589
+ },
2590
+ type: MODEL_TYPE$4,
2591
+ predicate: isKosModel(MODEL_TYPE$4),
2592
+ factory: Kos.Singleton.create(MODEL_TYPE$4)
2593
+ };
2594
+ const { URL: URL$2 } = resolveServiceUrl("SETTINGS_SERVICE");
2595
+ const { getAll: getAll$1 } = ServiceFactory.build({
2596
+ basePath: `${URL$2}/api/settings`
2597
+ });
2598
+ const log$2 = KosLog.createLogger({
2599
+ name: "settings-service",
2600
+ group: "Services"
2601
+ });
2602
+ const getSettings = async () => {
2603
+ log$2.debug("sending GET for settings");
2604
+ const response = await getAll$1({});
2605
+ return response;
2606
+ };
2607
+ const getNcuiLanguage = async () => {
2608
+ const response = await getAll$1({
2609
+ urlOverride: `${URL$2}api/app/kosdev.ddk/ncui/languages`
2610
+ });
2611
+ return response;
2612
+ };
2613
+ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2614
+ __proto__: null,
2615
+ getNcuiLanguage,
2616
+ getSettings
2617
+ }, Symbol.toStringTag, { value: "Module" }));
2618
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
2619
+ var __decorateClass$3 = (decorators, target, key, kind) => {
2620
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
2621
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2622
+ if (decorator = decorators[i])
2623
+ result = decorator(result) || result;
2624
+ return result;
2625
+ };
2626
+ const MODEL_TYPE$3 = "utilities-model";
2627
+ let UtilitiesModelImpl = class {
2628
+ id;
2629
+ name;
2630
+ options;
2631
+ roles;
2632
+ columnId;
2633
+ logger;
2634
+ constructor(modelId, options, context) {
2635
+ this.id = modelId;
2636
+ this.logger = context.logger;
2637
+ this.name = options.name;
2638
+ this.options = options.options;
2639
+ this.roles = options?.roles;
2640
+ this.columnId = options.columnId;
2641
+ }
2642
+ updateModel(options) {
2643
+ this.name = options.name;
2644
+ this.options = options.options;
2645
+ this.roles = options?.roles;
2646
+ }
2647
+ get titleKey() {
2648
+ return `utility.${this.id}.title`;
2649
+ }
2650
+ get bodyKey() {
2651
+ return `utility.${this.id}.body`;
2652
+ }
2653
+ // -------------------LIFECYCLE----------------------------
2654
+ async init() {
2655
+ this.logger.debug(`initializing utilities ${this.id}`);
2656
+ }
2657
+ async load() {
2658
+ this.logger.debug(`loading utilities ${this.id}`);
2659
+ }
2660
+ };
2661
+ UtilitiesModelImpl = __decorateClass$3([
2662
+ kosModel(MODEL_TYPE$3)
2663
+ ], UtilitiesModelImpl);
2664
+ const Utilities = {
2665
+ registration: {
2666
+ [MODEL_TYPE$3]: {
2667
+ class: UtilitiesModelImpl,
2668
+ singleton: false
2669
+ }
2670
+ },
2671
+ type: MODEL_TYPE$3,
2672
+ predicate: isKosModel(MODEL_TYPE$3),
2673
+ factory: Kos.Factory.create(MODEL_TYPE$3)
2674
+ };
2675
+ const { URL: URL$1 } = resolveServiceUrl("UTILITIES_SERVICE");
2676
+ const { getAll } = ServiceFactory.build({
2677
+ basePath: `${URL$1}/api/utilities`
2678
+ });
2679
+ const log$1 = KosLog.createLogger({
2680
+ name: "utilities-service",
2681
+ group: "Services"
2682
+ });
2683
+ const getUtilities = async () => {
2684
+ log$1.debug("sending GET for utilities");
2685
+ try {
2686
+ const extensionResponse = await getAll({
2687
+ urlOverride: `${URL$1}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`
2688
+ });
2689
+ if (extensionResponse?.status !== 200) {
2690
+ log$1.info(`no extensions found, using base data`);
2691
+ const response = await getAll({
2692
+ urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
2693
+ });
2694
+ return response?.data ?? [];
2695
+ }
2696
+ return extensionResponse?.data ?? [];
2697
+ } catch (error) {
2698
+ log$1.info(`error fetching utilities: ${error}. Using base data`);
2699
+ const response = await getAll({
2700
+ urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
2701
+ });
2702
+ return response?.data ?? [];
2703
+ }
2704
+ };
2705
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2706
+ __proto__: null,
2707
+ getUtilities
2708
+ }, Symbol.toStringTag, { value: "Module" }));
2709
+ var __defProp$2 = Object.defineProperty;
2710
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2711
+ var __decorateClass$2 = (decorators, target, key, kind) => {
2712
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
2713
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2714
+ if (decorator = decorators[i])
2715
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2716
+ if (kind && result) __defProp$2(target, key, result);
2717
+ return result;
2718
+ };
2719
+ const MODEL_TYPE$2 = "utilities-container-model";
2720
+ let UtilitiesContainerModelImpl = class {
2721
+ id;
2722
+ logger;
2723
+ _models;
2724
+ constructor(modelId, _options, context) {
2725
+ this.id = modelId;
2726
+ this.logger = context.logger;
2727
+ this._models = new KosModelContainer({
2728
+ parentId: modelId,
2729
+ sortKey: "id",
2730
+ indexMap: {
2731
+ byColumn: "columnId"
2732
+ }
2733
+ });
2734
+ }
2735
+ get data() {
2736
+ return this._models.data;
2737
+ }
2738
+ get models() {
2739
+ return this._models;
2740
+ }
2741
+ get columns() {
2742
+ return this._models.getIndexKeys("byColumn").sort((a, b) => a.localeCompare(b));
2743
+ }
2744
+ addModel(model) {
2745
+ this._models.addModel(model);
2746
+ }
2747
+ removeModel(id) {
2748
+ this._models.removeModel(id);
2749
+ }
2750
+ getModel(id) {
2751
+ return this._models.getModel(id);
2752
+ }
2753
+ getUtilitiesByColumn(id) {
2754
+ return this._models.getIndexByKey("byColumn", id);
2755
+ }
2756
+ // -------------------LIFECYCLE----------------------------
2757
+ async load() {
2758
+ this.logger.debug(`loading utilities-container container ${this.id}`);
2759
+ const utilitiesResponse = await getUtilities();
2760
+ utilitiesResponse?.forEach((utilityColumnsResponse, columnId) => {
2761
+ utilityColumnsResponse.forEach((utilityResponse) => {
2762
+ const utilityOptions = {
2763
+ ...utilityResponse,
2764
+ columnId: String(columnId)
2765
+ };
2766
+ const utilityModel = Utilities.factory(utilityResponse.name)(
2767
+ utilityOptions
2768
+ );
2769
+ this.addModel(utilityModel);
2770
+ });
2771
+ });
2772
+ }
2773
+ };
2774
+ __decorateClass$2([
2775
+ kosChild
2776
+ ], UtilitiesContainerModelImpl.prototype, "_models", 2);
2777
+ UtilitiesContainerModelImpl = __decorateClass$2([
2778
+ kosModel(MODEL_TYPE$2)
2779
+ ], UtilitiesContainerModelImpl);
2780
+ const UtilitiesContainer = {
2781
+ registration: {
2782
+ [MODEL_TYPE$2]: {
2783
+ class: UtilitiesContainerModelImpl,
2784
+ singleton: true
2785
+ },
2786
+ ...Utilities.registration
2787
+ },
2788
+ type: MODEL_TYPE$2,
2789
+ predicate: isKosModel(MODEL_TYPE$2),
2790
+ factory: Kos.Singleton.create(MODEL_TYPE$2)
2791
+ };
2792
+ const DDKModels = {
2793
+ ...Animation.registration,
2794
+ ...Application.registration,
2795
+ ...Auth.registration,
2796
+ ...CarbWater.registration,
2797
+ ...DashboardOperations.registration,
2798
+ ...Dispenser.registration,
2799
+ ...DispenserInfo.registration,
2800
+ ...Enrollment.registration,
2801
+ ...IngredientSummary.registration,
2802
+ ...MacroAssignment.registration,
2803
+ ...NetworkTestContainer.registration,
2804
+ ...NutritiveSweetener.registration,
2805
+ ...PlainWater.registration,
2806
+ ...Reboot.registration,
2807
+ ...Settings.registration,
2808
+ ...SetupStepContainer.registration,
2809
+ ...UtilitiesContainer.registration
2810
+ };
2811
+ var __defProp$1 = Object.defineProperty;
2812
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2813
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2814
+ var __decorateClass$1 = (decorators, target, key, kind) => {
2815
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
2816
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2817
+ if (decorator = decorators[i])
2818
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2819
+ if (kind && result) __defProp$1(target, key, result);
2820
+ return result;
2821
+ };
2822
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
2823
+ const MODEL_TYPE$1 = "trouble-action-model";
2824
+ let TroubleActionModelImpl = class {
2825
+ /**
2826
+ * Unique identifier for this model instance.
2827
+ *
2828
+ * Set during construction and used for model lifecycle management
2829
+ * and debugging purposes.
2830
+ *
2831
+ * @category Model Properties
2832
+ */
2833
+ id;
2834
+ troubleContainer;
2835
+ /**
2836
+ * Observable state object mapping trouble state keys to values.
2837
+ *
2838
+ * This reactive state object is automatically updated when troubles are
2839
+ * added or removed from the system. Keys and values are determined by
2840
+ * the trouble action definitions provided during model initialization.
2841
+ *
2842
+ * State keys that no longer have associated active troubles are set to
2843
+ * undefined.
2844
+ *
2845
+ * @example
2846
+ * ```typescript
2847
+ * // Access state values
2848
+ * const isAgitationRequired = troubleActionModel.state.agitationRequired;
2849
+ *
2850
+ * // State is reactive - updates automatically propagate to React components
2851
+ * ```
2852
+ *
2853
+ * @category Model State
2854
+ */
2855
+ state;
2856
+ /**
2857
+ * Internal mapping of trouble types to their action definitions.
2858
+ *
2859
+ * Built from the definitions array provided in TroubleActionOptions during
2860
+ * construction. Used for efficient lookup when processing trouble changes.
2861
+ *
2862
+ * @category Internal State
2863
+ */
2864
+ troubleActionData;
2865
+ /**
2866
+ * Creates a new TroubleActionModel instance.
2867
+ *
2868
+ * Initializes the model with trouble action definitions that map trouble
2869
+ * types to state key-value pairs. The model begins monitoring the trouble
2870
+ * container immediately upon creation.
2871
+ *
2872
+ * @param modelId - Unique identifier for this model instance
2873
+ * @param options - Configuration options containing trouble action definitions
2874
+ * @param context - KOS creation context providing logger and framework services
2875
+ *
2876
+ * @category Lifecycle
2877
+ */
2878
+ constructor(modelId, options) {
2879
+ this.id = modelId;
2880
+ this.state = ObservableData();
2881
+ this.troubleActionData = options.definitions.reduce((acc, curr) => {
2882
+ acc[curr.troubleType] = curr;
2883
+ return acc;
2884
+ }, {});
2885
+ }
2886
+ // -------------------LIFECYCLE----------------------------
2887
+ /**
2888
+ * Gets the first active trouble that has an associated action definition.
2889
+ *
2890
+ * Returns the first trouble found that matches any of the configured trouble
2891
+ * action definitions. If multiple troubles are active, priority is determined
2892
+ * by the order of trouble type keys in the troubleActionData object.
2893
+ *
2894
+ * @returns The active trouble model, or undefined if no matching troubles exist
2895
+ *
2896
+ * @example
2897
+ * ```typescript
2898
+ * const trouble = troubleActionModel.activeTrouble;
2899
+ * if (trouble) {
2900
+ * console.log(`Active trouble: ${trouble.type}`);
2901
+ * console.log(`Resolvable: ${trouble.resolvable}`);
2902
+ * }
2903
+ * ```
2904
+ *
2905
+ * @category Trouble Access
2906
+ * @see {@link TroubleContainerModel} for trouble data structure
2907
+ */
2908
+ get activeTrouble() {
2909
+ const actions = Object.keys(this.troubleActionData);
2910
+ if (actions.length > 0) {
2911
+ const firstAction = actions[0];
2912
+ const troubles = this.troubleContainer.troubles.getIndexByKey(
2913
+ "byType",
2914
+ firstAction
2915
+ );
2916
+ if (troubles.length > 0) {
2917
+ return troubles[0];
2918
+ } else {
2919
+ return void 0;
2920
+ }
2921
+ }
2922
+ return void 0;
2923
+ }
2924
+ /**
2925
+ * Gets the type of the first active trouble with an associated action definition.
2926
+ *
2927
+ * Convenience getter that extracts the trouble type from the active trouble.
2928
+ * Commonly used for conditional UI rendering based on trouble type.
2929
+ *
2930
+ * @returns The active trouble type string, or undefined if no troubles are active
2931
+ *
2932
+ * @example
2933
+ * ```typescript
2934
+ * const troubleType = troubleActionModel.activeTroubleType;
2935
+ * if (troubleType === 'InsufficientAgitationTrouble') {
2936
+ * // Show agitation required UI
2937
+ * }
2938
+ * ```
2939
+ *
2940
+ * @category Trouble Access
2941
+ */
2942
+ get activeTroubleType() {
2943
+ return this.activeTrouble?.type;
2944
+ }
2945
+ handleTroubleActions() {
2946
+ const _state = this.troubleContainer.troubles.data.reduce((acc, curr) => {
2947
+ const _troubleType = curr.type;
2948
+ if (this.troubleActionData[_troubleType]) {
2949
+ const _stateKey = this.troubleActionData[_troubleType].stateKey ?? _troubleType;
2950
+ const _stateValue = this.troubleActionData[_troubleType].stateValue ?? _troubleType;
2951
+ acc[_stateKey] = _stateValue;
2952
+ }
2953
+ return acc;
2954
+ }, {});
2955
+ this.state.setValues(_state);
2956
+ Object.keys(this.troubleActionData).forEach((key) => {
2957
+ if (this.troubleContainer.troubles.getIndexByKey("byType", key).length === 0) {
2958
+ const _stateKey = this.troubleActionData[key].stateKey ?? key;
2959
+ this.state[_stateKey] = void 0;
2960
+ }
2961
+ });
2962
+ }
2963
+ };
2964
+ __publicField(TroubleActionModelImpl, "Registration");
2965
+ __decorateClass$1([
2966
+ kosDependency({ modelType: TroubleContainer.type })
2967
+ ], TroubleActionModelImpl.prototype, "troubleContainer", 2);
2968
+ __decorateClass$1([
2969
+ kosModelEffect({
2970
+ dependencies: (model) => [model.troubleContainer.troubles.data]
2971
+ })
2972
+ ], TroubleActionModelImpl.prototype, "handleTroubleActions", 1);
2973
+ TroubleActionModelImpl = __decorateClass$1([
2974
+ kosModel({ modelTypeId: MODEL_TYPE$1, singleton: true }),
2975
+ kosLoggerAware()
2976
+ ], TroubleActionModelImpl);
2977
+ const TroubleAction = TroubleActionModelImpl.Registration;
2978
+ const { URL } = resolveServiceUrl("START_SERVICE");
2979
+ const { getOne } = ServiceFactory.build({
2980
+ basePath: `${URL}/api/start`
2981
+ });
2982
+ const log = KosLog.createLogger({ name: "start-service", group: "Services" });
2983
+ const navigateToNCui = async () => {
2984
+ log.debug("navigating to NCUI");
2985
+ const response = await getOne({
2986
+ urlOverride: `${URL}/api/app/kosdev.ddk/ncui/open`
2987
+ });
2988
+ return response;
2989
+ };
2990
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2991
+ __proto__: null,
2992
+ navigateToNCui
2993
+ }, Symbol.toStringTag, { value: "Module" }));
2994
+ var __defProp = Object.defineProperty;
2995
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2996
+ var __decorateClass = (decorators, target, key, kind) => {
2997
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2998
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2999
+ if (decorator = decorators[i])
3000
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3001
+ if (kind && result) __defProp(target, key, result);
3002
+ return result;
3003
+ };
3004
+ const MODEL_TYPE = "start-model";
3005
+ let StartModelImpl = class {
3006
+ id;
3007
+ logger;
3008
+ troubles;
3009
+ constructor(modelId, options, context) {
3010
+ this.id = modelId;
3011
+ this.logger = context.logger;
3012
+ }
3013
+ get firmwareFailed() {
3014
+ return this.troubles.troubles.getIndexByKey(
3015
+ "byType",
3016
+ "FirmwareUpdateFailedTrouble"
3017
+ ).length > 0;
3018
+ }
3019
+ get firmwareInProgress() {
3020
+ return this.troubles.troubles.getIndexByKey(
3021
+ "byType",
3022
+ "FirmwareUpdateInProgressTrouble"
3023
+ ).length > 0;
3024
+ }
3025
+ async navigate() {
3026
+ await navigateToNCui();
3027
+ }
3028
+ // -------------------LIFECYCLE----------------------------
3029
+ async init() {
3030
+ this.logger.debug(`initializing start ${this.id}`);
3031
+ }
3032
+ async load() {
3033
+ this.logger.debug(`loading start ${this.id}`);
3034
+ }
3035
+ };
3036
+ __decorateClass([
3037
+ kosDependency({ modelType: TroubleContainer.type })
3038
+ ], StartModelImpl.prototype, "troubles", 2);
3039
+ StartModelImpl = __decorateClass([
3040
+ kosModel(MODEL_TYPE)
3041
+ ], StartModelImpl);
3042
+ const Start = new SingletonKosModelRegistrationFactory({
3043
+ class: StartModelImpl,
3044
+ type: MODEL_TYPE
3045
+ });
3046
+ export {
3047
+ AgitationControl,
3048
+ Animation,
3049
+ index$b as AnimationServices,
3050
+ Application,
3051
+ Auth,
3052
+ index$d as AuthServices,
3053
+ CarbWater,
3054
+ CopyLogs,
3055
+ index$a as CopyLogsServices,
3056
+ DDKModels,
3057
+ DashboardOperations,
3058
+ index$9 as DashboardOperationsServices,
3059
+ Dispenser,
3060
+ DispenserInfo,
3061
+ index$7 as DispenserInfoServices,
3062
+ index$8 as DispenserServices,
3063
+ Door,
3064
+ EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
3065
+ Enrollment,
3066
+ index$6 as EnrollmentServices,
3067
+ IngredientSummary,
3068
+ Lockout,
3069
+ index$5 as LockoutServices,
3070
+ MACRO_KEYS,
3071
+ MacroAssignment,
3072
+ NetworkTest,
3073
+ NetworkTestContainer,
3074
+ index$4 as NetworkTestServices,
3075
+ NutritiveSweetener,
3076
+ PlainWater,
3077
+ Reboot,
3078
+ index$3 as RebootServices,
3079
+ Settings,
3080
+ index$2 as SettingsServices,
3081
+ SetupStep,
3082
+ SetupStepContainer,
3083
+ index$c as SetupStepServices,
3084
+ Start,
3085
+ index as StartServices,
3086
+ TROUBLE_TYPE_PRIME$1 as TROUBLE_TYPE_PRIME,
3087
+ TROUBLE_TYPE_PURGE$1 as TROUBLE_TYPE_PURGE,
3088
+ TroubleAction as TroubleActionManager,
3089
+ Utilities,
3090
+ UtilitiesContainer,
3091
+ index$1 as UtilitiesServices,
3092
+ calculateTimeDifference,
3093
+ executeDashboardKeyFactory,
3094
+ isMacroGroup,
3095
+ isMicroGroup,
3096
+ macroHolderMap,
3097
+ registerDashboardKeyFactory,
3098
+ toSeconds,
3099
+ toTimeComponents,
3100
+ troubleVisibilityFilter
3101
+ };
3102
+ //# sourceMappingURL=index.mjs.map