@kosdev-code/kos-freestyle-sdk 2.1.38 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/extension-utils-BFJb3AYW.cjs +344 -0
  2. package/extension-utils-BFJb3AYW.cjs.map +1 -0
  3. package/extension-utils-uGVieAa8.js +345 -0
  4. package/extension-utils-uGVieAa8.js.map +1 -0
  5. package/index.cjs +46 -1
  6. package/index.cjs.map +1 -1
  7. package/index.d.ts.map +1 -1
  8. package/index.js +44 -48
  9. package/index.js.map +1 -1
  10. package/models/constants/index.d.ts.map +1 -1
  11. package/models/index.d.ts.map +1 -1
  12. package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts +2 -3
  13. package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts.map +1 -1
  14. package/models/models/agitation-required-trouble/index.d.ts.map +1 -1
  15. package/models/models/agitation-required-trouble/types/index.d.ts +1 -3
  16. package/models/models/carb-agitator/carb-agitator-model.d.ts +3 -4
  17. package/models/models/carb-agitator/carb-agitator-model.d.ts.map +1 -1
  18. package/models/models/carb-agitator/index.d.ts.map +1 -1
  19. package/models/models/carb-agitator/services/carb-tank-services.d.ts +0 -1
  20. package/models/models/carb-agitator/services/carb-tank-services.d.ts.map +1 -1
  21. package/models/models/cartridge-agitator/cartridge-agitator-container-model.d.ts +2 -3
  22. package/models/models/cartridge-agitator/cartridge-agitator-container-model.d.ts.map +1 -1
  23. package/models/models/cartridge-agitator/cartridge-agitator-container-registration.d.ts +2 -3
  24. package/models/models/cartridge-agitator/cartridge-agitator-container-registration.d.ts.map +1 -1
  25. package/models/models/cartridge-agitator/cartridge-agitator-model.d.ts +1 -2
  26. package/models/models/cartridge-agitator/cartridge-agitator-model.d.ts.map +1 -1
  27. package/models/models/cartridge-agitator/cartridge-agitator-registration.d.ts +2 -3
  28. package/models/models/cartridge-agitator/cartridge-agitator-registration.d.ts.map +1 -1
  29. package/models/models/cartridge-agitator/index.d.ts.map +1 -1
  30. package/models/models/cartridge-agitator/services/cartridge-agitator-services.d.ts +0 -1
  31. package/models/models/cartridge-agitator/services/cartridge-agitator-services.d.ts.map +1 -1
  32. package/models/models/cgp-pump/cgp-pump-model.d.ts +3 -4
  33. package/models/models/cgp-pump/cgp-pump-model.d.ts.map +1 -1
  34. package/models/models/cgp-pump/index.d.ts.map +1 -1
  35. package/models/models/cgp-pump/types/index.d.ts +1 -3
  36. package/models/models/fcm-pump/fcm-pump-model.d.ts +2 -3
  37. package/models/models/fcm-pump/fcm-pump-model.d.ts.map +1 -1
  38. package/models/models/fcm-pump/fcm-pump-registration.d.ts +2 -3
  39. package/models/models/fcm-pump/fcm-pump-registration.d.ts.map +1 -1
  40. package/models/models/fcm-pump/index.d.ts.map +1 -1
  41. package/models/models/fcm-pump/services/fcm-pump-services.d.ts +0 -1
  42. package/models/models/fcm-pump/services/fcm-pump-services.d.ts.map +1 -1
  43. package/models/models/fcm-pump/services/index.d.ts.map +1 -1
  44. package/models/models/fcm-pump/types/index.d.ts +1 -3
  45. package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts +7 -8
  46. package/models/models/freestyle-assembly/freestyle-assembly-model.d.ts.map +1 -1
  47. package/models/models/freestyle-assembly/freestyle-assembly-registration.d.ts +2 -3
  48. package/models/models/freestyle-assembly/freestyle-assembly-registration.d.ts.map +1 -1
  49. package/models/models/freestyle-assembly/index.d.ts.map +1 -1
  50. package/models/models/freestyle-assembly/types/index.d.ts +1 -3
  51. package/models/models/freestyle-holder/freestyle-holder-model.d.ts +3 -3
  52. package/models/models/freestyle-holder/freestyle-holder-model.d.ts.map +1 -1
  53. package/models/models/freestyle-holder/freestyle-holder-registration.d.ts +2 -3
  54. package/models/models/freestyle-holder/freestyle-holder-registration.d.ts.map +1 -1
  55. package/models/models/freestyle-holder/index.d.ts.map +1 -1
  56. package/models/models/freestyle-holder/types/index.d.ts +1 -3
  57. package/models/models/freestyle-nozzle/freestyle-nozzle-model.d.ts +2 -3
  58. package/models/models/freestyle-nozzle/freestyle-nozzle-model.d.ts.map +1 -1
  59. package/models/models/freestyle-nozzle/freestyle-nozzle-registration.d.ts +2 -3
  60. package/models/models/freestyle-nozzle/freestyle-nozzle-registration.d.ts.map +1 -1
  61. package/models/models/freestyle-nozzle/index.d.ts.map +1 -1
  62. package/models/models/freestyle-nozzle/services/freestyle-nozzle-services.d.ts.map +1 -1
  63. package/models/models/freestyle-nozzle/services/index.d.ts.map +1 -1
  64. package/models/models/freestyle-nozzle/types/index.d.ts +1 -3
  65. package/models/models/freestyle-pump/freestyle-pump-model.d.ts +2 -3
  66. package/models/models/freestyle-pump/freestyle-pump-model.d.ts.map +1 -1
  67. package/models/models/freestyle-pump/freestyle-pump-registration.d.ts +2 -3
  68. package/models/models/freestyle-pump/freestyle-pump-registration.d.ts.map +1 -1
  69. package/models/models/freestyle-pump/index.d.ts.map +1 -1
  70. package/models/models/freestyle-pump/services/freestyle-pump-services.d.ts.map +1 -1
  71. package/models/models/freestyle-pump/services/index.d.ts.map +1 -1
  72. package/models/models/freestyle-pump/types/index.d.ts +1 -3
  73. package/models/models/ice-agitator/ice-agitator-model.d.ts +2 -3
  74. package/models/models/ice-agitator/ice-agitator-model.d.ts.map +1 -1
  75. package/models/models/ice-agitator/index.d.ts.map +1 -1
  76. package/models/models/ice-agitator/services/ice-agitator-services.d.ts +0 -1
  77. package/models/models/ice-agitator/services/ice-agitator-services.d.ts.map +1 -1
  78. package/models/models/ice-agitator/services/index.d.ts.map +1 -1
  79. package/models/models/index.d.ts.map +1 -1
  80. package/models/models/lfcv-pump/index.d.ts.map +1 -1
  81. package/models/models/lfcv-pump/lfcv-pump-model.d.ts +2 -3
  82. package/models/models/lfcv-pump/lfcv-pump-model.d.ts.map +1 -1
  83. package/models/models/lfcv-pump/types/index.d.ts +1 -3
  84. package/models/models/remote-tray/index.d.ts.map +1 -1
  85. package/models/models/remote-tray/remote-tray-container-model.d.ts +1 -2
  86. package/models/models/remote-tray/remote-tray-container-model.d.ts.map +1 -1
  87. package/models/models/remote-tray/remote-tray-container-registration.d.ts +2 -3
  88. package/models/models/remote-tray/remote-tray-container-registration.d.ts.map +1 -1
  89. package/models/models/remote-tray/remote-tray-model.d.ts +3 -4
  90. package/models/models/remote-tray/remote-tray-model.d.ts.map +1 -1
  91. package/models/models/remote-tray/remote-tray-registration.d.ts +2 -3
  92. package/models/models/remote-tray/remote-tray-registration.d.ts.map +1 -1
  93. package/models/models/spm-pump/index.d.ts.map +1 -1
  94. package/models/models/spm-pump/services/index.d.ts.map +1 -1
  95. package/models/models/spm-pump/services/spm-pump-services.d.ts +0 -1
  96. package/models/models/spm-pump/services/spm-pump-services.d.ts.map +1 -1
  97. package/models/models/spm-pump/spm-pump-model.d.ts +2 -3
  98. package/models/models/spm-pump/spm-pump-model.d.ts.map +1 -1
  99. package/models/models/spm-pump/spm-pump-registration.d.ts +2 -3
  100. package/models/models/spm-pump/spm-pump-registration.d.ts.map +1 -1
  101. package/models/models/spm-pump/types/index.d.ts +1 -3
  102. package/models/models/types/assembly.d.ts +3 -4
  103. package/models/models/types/assembly.d.ts.map +1 -1
  104. package/models/models/types/ingredients.d.ts +0 -1
  105. package/models/models/types/ingredients.d.ts.map +1 -1
  106. package/models/models/types/pumps.d.ts +0 -1
  107. package/models/models/types/pumps.d.ts.map +1 -1
  108. package/models/utils/extension-utils.d.ts +2 -3
  109. package/models/utils/extension-utils.d.ts.map +1 -1
  110. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts +2 -3
  111. package/models/utils/extensions/assembly/assembly-data-mapper.d.ts.map +1 -1
  112. package/models/utils/extensions/assembly/types.d.ts +2 -3
  113. package/models/utils/extensions/assembly/types.d.ts.map +1 -1
  114. package/models/utils/extensions/availability/freestyle-loader.d.ts +1 -2
  115. package/models/utils/extensions/availability/freestyle-loader.d.ts.map +1 -1
  116. package/models/utils/extensions/availability/freestyle-mapper.d.ts +2 -3
  117. package/models/utils/extensions/availability/freestyle-mapper.d.ts.map +1 -1
  118. package/models/utils/extensions/availability/middleware/assets.d.ts +1 -2
  119. package/models/utils/extensions/availability/middleware/assets.d.ts.map +1 -1
  120. package/models/utils/extensions/availability/middleware/beverage-screen.d.ts +1 -2
  121. package/models/utils/extensions/availability/middleware/beverage-screen.d.ts.map +1 -1
  122. package/models/utils/extensions/availability/middleware/beverages.d.ts +1 -2
  123. package/models/utils/extensions/availability/middleware/beverages.d.ts.map +1 -1
  124. package/models/utils/extensions/availability/middleware/brand-screen.d.ts +1 -2
  125. package/models/utils/extensions/availability/middleware/brand-screen.d.ts.map +1 -1
  126. package/models/utils/extensions/availability/middleware/brands.d.ts +1 -2
  127. package/models/utils/extensions/availability/middleware/brands.d.ts.map +1 -1
  128. package/models/utils/extensions/availability/middleware/copy-input.d.ts +0 -1
  129. package/models/utils/extensions/availability/middleware/copy-input.d.ts.map +1 -1
  130. package/models/utils/extensions/availability/middleware/flavors.d.ts +1 -2
  131. package/models/utils/extensions/availability/middleware/flavors.d.ts.map +1 -1
  132. package/models/utils/extensions/availability/middleware/nutrition.d.ts +1 -2
  133. package/models/utils/extensions/availability/middleware/nutrition.d.ts.map +1 -1
  134. package/models/utils/extensions/availability/middleware/related-brands.d.ts +1 -2
  135. package/models/utils/extensions/availability/middleware/related-brands.d.ts.map +1 -1
  136. package/models/utils/extensions/availability/types.d.ts.map +1 -1
  137. package/models/utils/extensions/availability/util/locate-brand.d.ts.map +1 -1
  138. package/models/utils/extensions/availability/util/process-related-brand.d.ts +0 -1
  139. package/models/utils/extensions/availability/util/process-related-brand.d.ts.map +1 -1
  140. package/models/utils/extensions/ingredient/index.d.ts.map +1 -1
  141. package/models/utils/extensions/ingredient/model-extension.d.ts +1 -2
  142. package/models/utils/extensions/ingredient/model-extension.d.ts.map +1 -1
  143. package/models/utils/extensions/pourable/select-pourable-mapper.d.ts +0 -1
  144. package/models/utils/extensions/pourable/select-pourable-mapper.d.ts.map +1 -1
  145. package/models/utils/extensions/trouble/trouble-utils.d.ts +0 -1
  146. package/models/utils/extensions/trouble/trouble-utils.d.ts.map +1 -1
  147. package/models/utils/freestyle-registration-manager.d.ts +9 -10
  148. package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
  149. package/models/utils/index.d.ts.map +1 -1
  150. package/models/utils/openapi-index.d.ts.map +1 -1
  151. package/models/utils/services/freestyle/1.6.5/service.d.ts +34 -35
  152. package/models/utils/services/freestyle/1.6.5/service.d.ts.map +1 -1
  153. package/models/utils/services/freestyle/1.8.1/service.d.ts +34 -35
  154. package/models/utils/services/freestyle/1.8.1/service.d.ts.map +1 -1
  155. package/models/utils/services/freestyle/daily/service.d.ts +34 -35
  156. package/models/utils/services/freestyle/daily/service.d.ts.map +1 -1
  157. package/models/utils/services/handle/1.8.1/service.d.ts +34 -35
  158. package/models/utils/services/handle/1.8.1/service.d.ts.map +1 -1
  159. package/models/utils/services/handle/daily/service.d.ts +34 -35
  160. package/models/utils/services/handle/daily/service.d.ts.map +1 -1
  161. package/models/utils/services-index.d.ts.map +1 -1
  162. package/models.cjs +38 -1
  163. package/models.cjs.map +1 -1
  164. package/models.d.ts +1 -0
  165. package/models.js +35 -37
  166. package/models.js.map +1 -1
  167. package/package.json +9 -10
  168. package/service-BRuYqmJg.js +2277 -0
  169. package/service-BRuYqmJg.js.map +1 -0
  170. package/service-E5IuBoLR.cjs +2276 -0
  171. package/service-E5IuBoLR.cjs.map +1 -0
  172. package/ui/contexts/index.d.ts.map +1 -1
  173. package/ui/hooks/freestyle-assembly/index.d.ts.map +1 -1
  174. package/ui/hooks/freestyle-assembly/use-freestyle-assembly.d.ts +0 -1
  175. package/ui/hooks/freestyle-assembly/use-freestyle-assembly.d.ts.map +1 -1
  176. package/ui/hooks/freestyle-nozzle/index.d.ts.map +1 -1
  177. package/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.d.ts +0 -1
  178. package/ui/hooks/freestyle-nozzle/use-freestyle-nozzle.d.ts.map +1 -1
  179. package/ui/hooks/ice-agitator/index.d.ts.map +1 -1
  180. package/ui/hooks/ice-agitator/use-ice-agitator.d.ts +1 -2
  181. package/ui/hooks/ice-agitator/use-ice-agitator.d.ts.map +1 -1
  182. package/ui/hooks/ice-agitator/with-ice-agitator.d.ts +0 -1
  183. package/ui/hooks/ice-agitator/with-ice-agitator.d.ts.map +1 -1
  184. package/ui/hooks/index.d.ts.map +1 -1
  185. package/ui/hooks/nutrition/index.d.ts.map +1 -1
  186. package/ui/hooks/nutrition/use-nutrition-info.d.ts +0 -1
  187. package/ui/hooks/nutrition/use-nutrition-info.d.ts.map +1 -1
  188. package/ui/index.d.ts.map +1 -1
  189. package/ui.cjs +8 -1
  190. package/ui.cjs.map +1 -1
  191. package/ui.d.ts +1 -0
  192. package/ui.js +6 -11
  193. package/ui.js.map +1 -1
  194. package/use-nutrition-info-B1EB2iYY.js +68 -0
  195. package/use-nutrition-info-B1EB2iYY.js.map +1 -0
  196. package/use-nutrition-info-BDv3r-Gf.cjs +67 -0
  197. package/use-nutrition-info-BDv3r-Gf.cjs.map +1 -0
  198. package/extension-utils--qB2FP1I.js +0 -237
  199. package/extension-utils--qB2FP1I.js.map +0 -1
  200. package/extension-utils-DQSu9dSv.cjs +0 -2
  201. package/extension-utils-DQSu9dSv.cjs.map +0 -1
  202. package/kos-models.json +0 -180
  203. package/service-BuugCicr.js +0 -1907
  204. package/service-BuugCicr.js.map +0 -1
  205. package/service-DSV9Dr2d.cjs +0 -2
  206. package/service-DSV9Dr2d.cjs.map +0 -1
  207. package/use-nutrition-info-CPEwk_O-.js +0 -52
  208. package/use-nutrition-info-CPEwk_O-.js.map +0 -1
  209. package/use-nutrition-info-C_myxRvf.cjs +0 -2
  210. package/use-nutrition-info-C_myxRvf.cjs.map +0 -1
@@ -1,1907 +0,0 @@
1
- var Pt = Object.defineProperty;
2
- var vt = (e, t, r) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var s = (e, t, r) => (vt(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { resolveServiceUrl as M, ServiceFactory as R, KosLog as C, createPropKey as G, kosStateProp as O, kosConfigProperty as b, kosStateEntry as Pe, kosStateExit as _t, kosStateGuard as ve, kosFuture as I, kosModel as f, kosLoggerAware as D, kosCompanion as oe, kosFutureAware as xe, kosStateMachine as Tt, DependencyLifecycle as qe, KosModelContainer as It, kosChild as Ge, kosModelEffect as _e, EventBus as k, KosModelRegistrationFactory as F, SingletonKosModelRegistrationFactory as Te, FetchError as Ie, FutureManager as y, FutureEndState as U, FutureHandler as Ue, kosParentAware as je, KosFeatureFlags as de, getKosCompanionModel as $t, getKosModelSync as A, kosContainerAware as Ct, KosContextManager as Ot, kosAction as Z, KOS_MODEL_ID as $, kosMultipleFutureAware as Et, kosTopicHandler as St, modelTypeEventTopicFactory as At, RegistrationManager as m, registerCoreModels as wt, Trouble as Mt, ExtensionManager as pe, EXTENSION_TROUBLE_DATA_MAPPER as ge, createClient as H, kosServiceRequest as B } from "@kosdev-code/kos-ui-sdk";
5
- import { PourState as d, Assembly as Ve, KosModelRegistry as Rt, registerDispenseModels as Dt, Nozzle as Ft, Pump as Nt, Holder as zt, PumpContainer as Lt, PumpIndex as xt } from "@kosdev-code/kos-dispense-sdk";
6
- const { URL: He } = M("ICE_AGITATOR_SERVICE"), { postModel: qt } = R.build({
7
- basePath: `${He}/api/ext/freestyle/ice`
8
- });
9
- C.createLogger({
10
- name: "carb-tank-service",
11
- group: "Services"
12
- });
13
- const Gt = async (e, t) => {
14
- const r = await qt({
15
- model: {},
16
- tracker: t,
17
- urlOverride: `${He}/api/handle/${e}/test`
18
- });
19
- if (!(r != null && r.data))
20
- throw new Error("No response from server");
21
- return r == null ? void 0 : r.data;
22
- };
23
- var Be = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, jt = (e, t, r) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, P = (e, t, r, o) => {
24
- for (var a = o > 1 ? void 0 : o ? Ut(t, r) : t, n = e.length - 1, i; n >= 0; n--)
25
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
26
- return o && a && Be(t, r, a), a;
27
- }, Vt = (e, t, r) => (jt(e, t + "", r), r);
28
- const Ht = "carb-agitator-model", $e = G("statePath");
29
- let g = class {
30
- /**
31
- * Creates a new carb agitator model instance.
32
- *
33
- * @param modelId - Unique identifier for this instance
34
- * @param options - Configuration options including name
35
- * @param context - KOS creation context providing assembly paths
36
- */
37
- constructor(e, t, r) {
38
- /**
39
- * Unique identifier for this carb agitator instance.
40
- */
41
- s(this, "id");
42
- /**
43
- * Display name for this carb agitator.
44
- */
45
- s(this, "name");
46
- /**
47
- * Device path for carb tank operations.
48
- */
49
- s(this, "path");
50
- /**
51
- * State path for accessing probe and filling status.
52
- */
53
- s(this, "statePath");
54
- s(this, "highProbeWet");
55
- s(this, "lowProbeWet");
56
- s(this, "filling");
57
- s(this, "enabled");
58
- var a;
59
- this.id = e, this.name = t.name, this.path = ((a = r.kosContext.get("assembly-feature-carbTank")) == null ? void 0 : a.path) || "";
60
- const o = r.kosContext.get("assembly-state-path-carbTank");
61
- this.statePath = o;
62
- }
63
- /**
64
- * Gets the carb holder associated with this agitator.
65
- *
66
- * Retrieves the first holder from the "carb" group in the parent assembly.
67
- *
68
- * @returns The carb holder model, or undefined if not found
69
- */
70
- get holder() {
71
- var t;
72
- return (t = this.getCompanionParent()) == null ? void 0 : t.getHoldersByGroup("carb")[0];
73
- }
74
- /**
75
- * Gets the pump associated with the carb holder.
76
- *
77
- * Returns the first pump from the holder's pump collection.
78
- *
79
- * @returns The pump model, or undefined if holder or pump not available
80
- */
81
- get pump() {
82
- var e;
83
- return (e = this.holder) == null ? void 0 : e.pumps.data[0];
84
- }
85
- /**
86
- * Indicates whether the carb tank is currently being filled.
87
- *
88
- * @returns true if the filling state property indicates active filling
89
- */
90
- get isFilling() {
91
- return !!this.filling.value;
92
- }
93
- /**
94
- * Indicates whether the carb tank has been initialized.
95
- *
96
- * @returns true if the carb tank enabled configuration is set to true
97
- */
98
- get isCarbInitialized() {
99
- return !!this.enabled.value;
100
- }
101
- /**
102
- * Indicates whether carb tank activation is allowed.
103
- *
104
- * Activation is only allowed when the carb tank is not already enabled.
105
- *
106
- * @returns true if the carb tank can be activated
107
- */
108
- get canActivate() {
109
- return !this.enabled.value;
110
- }
111
- /**
112
- * Indicates whether the workflow can proceed past carb initialization.
113
- *
114
- * The workflow can proceed when the state machine is in either INITIALIZED
115
- * (carb tank activated) or SKIPPED (user chose to bypass carbonation).
116
- *
117
- * @returns true if ready to proceed with beverage operations
118
- */
119
- get canProceed() {
120
- return this.isInState(
121
- "INITIALIZED"
122
- /* INITIALIZED */
123
- ) || this.isInState(
124
- "SKIPPED"
125
- /* SKIPPED */
126
- );
127
- }
128
- handleActivationStart() {
129
- this.logger.info("Carb tank activation started");
130
- }
131
- handleActivationComplete() {
132
- this.logger.info("Carb tank initialized");
133
- }
134
- handleInitialized() {
135
- this.logger.info("Carb tank ready to proceed");
136
- }
137
- handleSkipped() {
138
- this.logger.info("Proceeding without carbinator");
139
- }
140
- async activateCarbTank() {
141
- this.transition("ACTIVATE"), this.enabled.updateProperty(!0), this.transition("ACTIVATION_COMPLETE");
142
- }
143
- /**
144
- * Deactivates the carb tank and resets to uninitialized state.
145
- *
146
- * This method:
147
- * 1. Updates the enabled configuration property to false
148
- * 2. Transitions back to UNINITIALIZED state
149
- *
150
- * Can be called from any state.
151
- */
152
- async deactivateCarbTank() {
153
- this.enabled.updateProperty(!1), this.transition("RESET");
154
- }
155
- skip() {
156
- this.transition("SKIP");
157
- }
158
- reset() {
159
- this.enabled.updateProperty(!1), this.transition("RESET");
160
- }
161
- /**
162
- * Toggles the carb tank between enabled and disabled states.
163
- *
164
- * If currently enabled, calls {@link deactivateCarbTank}.
165
- * If currently disabled, calls {@link activateCarbTank}.
166
- */
167
- toggleCarbTank() {
168
- this.enabled.value ? this.deactivateCarbTank() : this.activateCarbTank();
169
- }
170
- handleTestCarbTank(e) {
171
- if (!e)
172
- throw new Error("No tracker provided");
173
- return this.logger.info(`testing carb tank: ${this.id}`), Gt(this.path, e);
174
- }
175
- };
176
- Vt(g, "Registration");
177
- P([
178
- O({
179
- path: $e,
180
- attribute: "highProbeWet"
181
- })
182
- ], g.prototype, "highProbeWet", 2);
183
- P([
184
- O({
185
- path: $e,
186
- attribute: "lowProbeWet"
187
- })
188
- ], g.prototype, "lowProbeWet", 2);
189
- P([
190
- O({
191
- path: $e,
192
- attribute: "filling"
193
- })
194
- ], g.prototype, "filling", 2);
195
- P([
196
- b({
197
- path: "assembly:core:board:macksm:carbTank:carbTank",
198
- attribute: "enabled"
199
- })
200
- ], g.prototype, "enabled", 2);
201
- P([
202
- Pe(
203
- "ACTIVATING"
204
- /* ACTIVATING */
205
- )
206
- ], g.prototype, "handleActivationStart", 1);
207
- P([
208
- _t(
209
- "ACTIVATING"
210
- /* ACTIVATING */
211
- )
212
- ], g.prototype, "handleActivationComplete", 1);
213
- P([
214
- Pe(
215
- "INITIALIZED"
216
- /* INITIALIZED */
217
- )
218
- ], g.prototype, "handleInitialized", 1);
219
- P([
220
- Pe(
221
- "SKIPPED"
222
- /* SKIPPED */
223
- )
224
- ], g.prototype, "handleSkipped", 1);
225
- P([
226
- ve({ allowedStates: [
227
- "UNINITIALIZED"
228
- /* UNINITIALIZED */
229
- ] })
230
- ], g.prototype, "activateCarbTank", 1);
231
- P([
232
- ve({ allowedStates: [
233
- "UNINITIALIZED"
234
- /* UNINITIALIZED */
235
- ] })
236
- ], g.prototype, "skip", 1);
237
- P([
238
- ve({
239
- allowedStates: [
240
- "INITIALIZED",
241
- "SKIPPED"
242
- /* SKIPPED */
243
- ]
244
- })
245
- ], g.prototype, "reset", 1);
246
- P([
247
- I()
248
- ], g.prototype, "handleTestCarbTank", 1);
249
- g = P([
250
- f({ modelTypeId: Ht, singleton: !1 }),
251
- D(),
252
- oe({ mode: "composition", lifecycle: qe.LOAD }),
253
- xe(),
254
- Tt(
255
- {
256
- initial: "UNINITIALIZED",
257
- states: {
258
- UNINITIALIZED: {
259
- on: {
260
- ACTIVATE: "ACTIVATING",
261
- SKIP: "SKIPPED"
262
- /* SKIPPED */
263
- }
264
- },
265
- ACTIVATING: {
266
- on: {
267
- ACTIVATION_COMPLETE: "INITIALIZED"
268
- /* INITIALIZED */
269
- }
270
- },
271
- INITIALIZED: {
272
- on: {
273
- RESET: "UNINITIALIZED"
274
- /* UNINITIALIZED */
275
- }
276
- },
277
- SKIPPED: {
278
- on: {
279
- RESET: "UNINITIALIZED"
280
- /* UNINITIALIZED */
281
- }
282
- }
283
- }
284
- },
285
- {
286
- throwOnInvalid: !1
287
- // Graceful handling for button clicks
288
- }
289
- )
290
- ], g);
291
- const Ke = g.Registration;
292
- var Bt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Ye = (e, t, r, o) => {
293
- for (var a = o > 1 ? void 0 : o ? Kt(t, r) : t, n = e.length - 1, i; n >= 0; n--)
294
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
295
- return o && a && Bt(t, r, a), a;
296
- };
297
- const We = "cartridge-agitator-container-model";
298
- let Q = class {
299
- constructor(e, t, r) {
300
- s(this, "id");
301
- s(this, "logger");
302
- s(this, "_models");
303
- this.id = e, this.logger = r.logger, this._models = new It({
304
- parentId: e
305
- });
306
- }
307
- getModel(e) {
308
- return this._models.getModel(e);
309
- }
310
- get models() {
311
- return this._models;
312
- }
313
- get data() {
314
- return this._models.data;
315
- }
316
- addModel(e) {
317
- this._models.addModel(e);
318
- }
319
- removeModel(e) {
320
- this._models.removeModel(e);
321
- }
322
- // -------------------LIFECYCLE----------------------------
323
- async init() {
324
- this.logger.debug(
325
- `initializing cartridge-agitator-container container ${this.id}`
326
- );
327
- }
328
- async load() {
329
- this.logger.debug(
330
- `loading cartridge-agitator-container container ${this.id}`
331
- );
332
- }
333
- };
334
- Ye([
335
- Ge
336
- ], Q.prototype, "_models", 2);
337
- Q = Ye([
338
- f(We)
339
- ], Q);
340
- const { URL: Ze } = M("CARTRIDGE_AGITATOR_SERVICE"), { postModel: Yt } = R.build({
341
- basePath: `${Ze}/api/ext/freestyle/freestyle/ice`
342
- }), Wt = async (e, t) => {
343
- const r = await Yt({
344
- model: {},
345
- tracker: t,
346
- urlOverride: `${Ze}/api/handle/${e}/test`
347
- });
348
- if (!(r != null && r.data))
349
- throw new Error("No response from server");
350
- return r.data;
351
- };
352
- var Zt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, ie = (e, t, r, o) => {
353
- for (var a = o > 1 ? void 0 : o ? kt(t, r) : t, n = e.length - 1, i; n >= 0; n--)
354
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
355
- return o && a && Zt(t, r, a), a;
356
- };
357
- const ke = "cartridge-agitator-model";
358
- class X {
359
- }
360
- s(X, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/agitation-started"), s(X, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/agitation-ended");
361
- const Qt = G("statePath");
362
- let z = class {
363
- constructor(e, t) {
364
- s(this, "id");
365
- s(this, "agitating");
366
- s(this, "path");
367
- s(this, "statePath");
368
- s(this, "name");
369
- this.id = e, this.path = t.path, this.name = t.name, this.statePath = t.statePath;
370
- }
371
- get isAgitating() {
372
- return !!this.agitating.value;
373
- }
374
- async testAgitate(e) {
375
- if (!e)
376
- throw new Error("No tracker provided");
377
- return this.logger.info(`agitating cartridge-agitator ${this.id}`), Wt(this.path, e);
378
- }
379
- handleAgitation() {
380
- var e;
381
- this.isAgitating ? (this.logger.info(`agitating cartridge-agitator ${this.id}`), k.publish(X.TOPIC_AGITATION_STARTED, {
382
- path: this.path,
383
- futureId: (e = this.future) == null ? void 0 : e.futureId
384
- })) : k.publish(X.TOPIC_AGITATION_ENDED, {
385
- path: this.path
386
- });
387
- }
388
- };
389
- ie([
390
- O({ path: Qt, attribute: "agitating" })
391
- ], z.prototype, "agitating", 2);
392
- ie([
393
- I()
394
- ], z.prototype, "testAgitate", 1);
395
- ie([
396
- _e({
397
- dependencies: (e) => [e.isAgitating]
398
- })
399
- ], z.prototype, "handleAgitation", 1);
400
- z = ie([
401
- f(ke),
402
- xe(),
403
- D()
404
- ], z);
405
- const Qe = new F({
406
- class: z,
407
- type: ke
408
- }), Ce = new Te({
409
- class: Q,
410
- type: We
411
- });
412
- Ce.addRelatedModel(Qe);
413
- var Xe = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Jt = (e, t, r) => t in e ? Xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, se = (e, t, r, o) => {
414
- for (var a = o > 1 ? void 0 : o ? Xt(t, r) : t, n = e.length - 1, i; n >= 0; n--)
415
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
416
- return o && a && Xe(t, r, a), a;
417
- }, er = (e, t, r) => (Jt(e, t + "", r), r);
418
- const tr = "cgp-pump-model", Oe = G("statePath");
419
- let w = class {
420
- constructor(e, t) {
421
- s(this, "highProbeWet");
422
- s(this, "lowProbeWet");
423
- s(this, "filling");
424
- s(this, "id");
425
- s(this, "state");
426
- var r;
427
- this.id = e, this.state = ((r = t.data) == null ? void 0 : r.state) ?? { name: "unknown", path: "" };
428
- }
429
- get statePath() {
430
- return this.state.path;
431
- }
432
- };
433
- er(w, "Registration");
434
- se([
435
- O({
436
- path: Oe,
437
- attribute: "highProbeWet"
438
- })
439
- ], w.prototype, "highProbeWet", 2);
440
- se([
441
- O({
442
- path: Oe,
443
- attribute: "lowProbeWet"
444
- })
445
- ], w.prototype, "lowProbeWet", 2);
446
- se([
447
- O({
448
- path: Oe,
449
- attribute: "filling"
450
- })
451
- ], w.prototype, "filling", 2);
452
- w = se([
453
- f({ modelTypeId: tr, singleton: !1 }),
454
- oe({
455
- mode: "composition"
456
- }),
457
- D()
458
- ], w);
459
- const rr = w.Registration, { URL: j } = M("FCM-PUMP_SERVICE"), { postModel: K } = R.build({
460
- basePath: `${j}/api/fcm-pump`
461
- }), h = C.createLogger({
462
- name: "fcm-pump-service",
463
- group: "Services"
464
- }), ar = async (e) => {
465
- var t, r, o, a, n;
466
- h.debug(
467
- `performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`
468
- );
469
- try {
470
- const i = await K({
471
- model: {},
472
- urlOverride: `${j}/api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`
473
- });
474
- return h.debug("performElectricalTest - response:", i), ((i == null ? void 0 : i.status) === 200 || (i == null ? void 0 : i.status) === 499) && ((t = i.data) != null && t.error) ? [i.data.error || "unknownError", i.data] : [void 0, i == null ? void 0 : i.data];
475
- } catch (i) {
476
- if (h.error(
477
- `performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`,
478
- i
479
- ), i instanceof Ie) {
480
- const u = ((o = (r = i.payload) == null ? void 0 : r.data) == null ? void 0 : o.error) || ((a = i.payload) == null ? void 0 : a.error) || "unknownError";
481
- return [u, ((n = i.payload) == null ? void 0 : n.data) || { error: u }];
482
- }
483
- }
484
- return ["unknownError", { error: "unknownError" }];
485
- }, or = async (e, t) => {
486
- h.debug(
487
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`
488
- );
489
- try {
490
- const r = await K({
491
- model: {},
492
- urlOverride: `${j}/api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,
493
- tracker: t
494
- });
495
- return h.debug("performPreCalibrate - response:", r), r != null && r.data && y.initiateFuture(r.data), r == null ? void 0 : r.data;
496
- } catch (r) {
497
- h.error(
498
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,
499
- r
500
- );
501
- const o = {
502
- id: t || "",
503
- endState: U.Fail,
504
- tracker: t,
505
- reason: "Failed to resolve trouble"
506
- };
507
- return y.initiateFuture(o), o;
508
- }
509
- }, ir = async (e, t) => {
510
- h.debug(
511
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`
512
- );
513
- try {
514
- const r = await K({
515
- model: {},
516
- urlOverride: `${j}/api/ext/freestyle/fcm/calibration/${e}/calibrate`,
517
- tracker: t
518
- });
519
- return h.debug("performPreCalibrate - response:", r), r != null && r.data && y.initiateFuture(r.data), r == null ? void 0 : r.data;
520
- } catch (r) {
521
- h.error(
522
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`,
523
- r
524
- );
525
- const o = {
526
- id: t || "",
527
- endState: U.Fail,
528
- tracker: t,
529
- reason: "Failed to resolve trouble"
530
- };
531
- return y.initiateFuture(o), o;
532
- }
533
- }, sr = async (e, t, r) => {
534
- h.debug(
535
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`
536
- );
537
- try {
538
- const o = await K({
539
- model: {},
540
- urlOverride: `${j}/api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,
541
- tracker: r
542
- });
543
- return h.debug("performVerify - response:", o), o != null && o.data && y.initiateFuture(o.data), o == null ? void 0 : o.data;
544
- } catch (o) {
545
- h.error(
546
- `performVerify - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,
547
- o
548
- );
549
- const a = {
550
- id: r || "",
551
- endState: U.Fail,
552
- tracker: r,
553
- reason: "Failed to resolve trouble"
554
- };
555
- return y.initiateFuture(a), a;
556
- }
557
- }, nr = (e) => e ? e.data === "success" || !e.data ? "success" : e.data : "error", lr = async (e, t, r) => {
558
- h.debug(
559
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`
560
- );
561
- try {
562
- const o = await K({
563
- model: {},
564
- urlOverride: `${j}/api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`
565
- });
566
- return h.debug("performPreCalibrate - response:", o), nr(o == null ? void 0 : o.data);
567
- } catch (o) {
568
- h.error(
569
- `performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`,
570
- o
571
- );
572
- return;
573
- }
574
- };
575
- var ur = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, ne = (e, t, r, o) => {
576
- for (var a = o > 1 ? void 0 : o ? cr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
577
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
578
- return o && a && ur(t, r, a), a;
579
- };
580
- const Je = "fcm-pump-model", dr = C.createLogger({ name: "fcm-pump-model" });
581
- let L = class {
582
- constructor(e, t, r) {
583
- s(this, "id");
584
- s(this, "logger");
585
- s(this, "pumpModel");
586
- s(this, "futureHandler");
587
- this.id = e, this.logger = r.logger, this.pumpModel = t.companionParent, this.futureHandler = new Ue(this);
588
- }
589
- get future() {
590
- return this.futureHandler.future;
591
- }
592
- get name() {
593
- return this.pumpModel.name;
594
- }
595
- get canPour() {
596
- return this.pumpModel.canPour;
597
- }
598
- get isPouring() {
599
- return this.pumpModel.isPouring;
600
- }
601
- async cancelPour() {
602
- return this.pumpModel.cancelPour();
603
- }
604
- performIntent(e) {
605
- return this.pumpModel.performIntent(e);
606
- }
607
- async performElectricalTest() {
608
- const [e, t] = await ar(this.pumpModel.path);
609
- return e && dr.error(`Failed to perform electrical test on pump ${this.id}`, e), t;
610
- }
611
- getChildren() {
612
- return [...this.futureHandler.allFutures];
613
- }
614
- async performPreCalibrate(e) {
615
- return or(this.pumpModel.path, e);
616
- }
617
- async performCalibrate(e) {
618
- return ir(this.pumpModel.path, e);
619
- }
620
- async performVerify(e, t) {
621
- return sr(this.pumpModel.path, e, t);
622
- }
623
- async performComplete(e, t) {
624
- return lr(this.pumpModel.path, e, t);
625
- }
626
- // -------------------LIFECYCLE----------------------------
627
- async init() {
628
- this.logger.debug(`initializing fcm-pump ${this.id}`);
629
- }
630
- async load() {
631
- this.logger.debug(`loading fcm-pump ${this.id}`);
632
- }
633
- };
634
- ne([
635
- I()
636
- ], L.prototype, "performPreCalibrate", 1);
637
- ne([
638
- I()
639
- ], L.prototype, "performCalibrate", 1);
640
- ne([
641
- I()
642
- ], L.prototype, "performVerify", 1);
643
- L = ne([
644
- f(Je)
645
- ], L);
646
- const pr = new F({
647
- class: L,
648
- type: Je
649
- });
650
- var gr = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, et = (e, t, r, o) => {
651
- for (var a = o > 1 ? void 0 : o ? hr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
652
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
653
- return o && a && gr(t, r, a), a;
654
- };
655
- const tt = "freestyle-assembly-model", fr = "iceAgitator", mr = "carbTank", yr = "remoteTrays";
656
- let J = class {
657
- constructor(e, t, r) {
658
- s(this, "id");
659
- s(this, "_carbTankModel");
660
- s(this, "logger");
661
- s(this, "assembly");
662
- s(this, "_remoteTrays");
663
- this.id = e, this.logger = r.logger, this.assembly = t.companionParent;
664
- }
665
- get holderGroups() {
666
- return this.assembly.holderGroups;
667
- }
668
- get nozzlePaths() {
669
- return this.assembly.nozzlePaths;
670
- }
671
- get allHolders() {
672
- return this.assembly.allHolders;
673
- }
674
- getHoldersByGroup(e) {
675
- return this.assembly.getHoldersByGroup(e);
676
- }
677
- getHoldersByNozzle(e) {
678
- return this.assembly.getHoldersByNozzle(e);
679
- }
680
- get pumpsByNozzle() {
681
- return this.assembly.pumpsByNozzle;
682
- }
683
- get pumpPaths() {
684
- return this.assembly.pumpPaths;
685
- }
686
- get boards() {
687
- return this.assembly.boards;
688
- }
689
- updateModel(e) {
690
- return this.assembly.updateModel(e);
691
- }
692
- get iceAgitator() {
693
- return this.assembly.iceAgitator;
694
- }
695
- get carbTank() {
696
- return this._carbTankModel;
697
- }
698
- get cartridgeAgitators() {
699
- return this.assembly.cartridgeAgitators;
700
- }
701
- get defaultCartridgeAgitator() {
702
- return this.assembly.cartridgeAgitators.data[0];
703
- }
704
- get cartridgeAgitatorModels() {
705
- return this.assembly.cartridgeAgitators.data;
706
- }
707
- get hasCartridgeAgitators() {
708
- return this.assembly.cartridgeAgitators.data.length > 0;
709
- }
710
- get remoteTrays() {
711
- return this.assembly.remoteTrays;
712
- }
713
- get hasRemoteTrays() {
714
- return this.assembly.remoteTrays ? this.assembly.remoteTrays.data.length > 0 : !1;
715
- }
716
- // -------------------LIFECYCLE----------------------------
717
- get supportsRemoteTrays() {
718
- return de.isFeatureEnabled(yr);
719
- }
720
- get supportsIce() {
721
- return de.isFeatureEnabled(fr);
722
- }
723
- get supportsCarb() {
724
- return de.isFeatureEnabled(mr);
725
- }
726
- async init() {
727
- this.logger.debug(`initializing freestyle-assembly ${this.id}`);
728
- }
729
- async ready() {
730
- const e = $t(
731
- this.assembly,
732
- Ke.type
733
- );
734
- this._carbTankModel = e;
735
- }
736
- };
737
- et([
738
- Ge
739
- ], J.prototype, "_remoteTrays", 2);
740
- J = et([
741
- je(),
742
- f(tt)
743
- ], J);
744
- const fe = new Te({
745
- class: J,
746
- type: tt
747
- });
748
- var br = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, rt = (e, t, r, o) => {
749
- for (var a = o > 1 ? void 0 : o ? Pr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
750
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
751
- return o && a && br(t, r, a), a;
752
- };
753
- const at = "remote-tray-model";
754
- G("holderPath");
755
- const vr = G("configPath");
756
- let ee = class {
757
- constructor(e, t, r) {
758
- /** Unique identifier for the remote tray instance */
759
- s(this, "id");
760
- s(this, "logger");
761
- /** Path reference to the associated holder model */
762
- s(this, "holderPath");
763
- /** Configuration path for tray-specific settings */
764
- s(this, "configPath");
765
- /** Display name of the remote tray */
766
- s(this, "name");
767
- s(this, "remoteTrayEnabled");
768
- this.id = e, this.logger = r.logger, this.holderPath = t.holderPath, this.configPath = t.configPath, this.name = t.name;
769
- }
770
- /**
771
- * Gets the troubles from the associated holder model.
772
- * Propagates trouble states from the holder to this remote tray.
773
- *
774
- * @returns Array of trouble models from the holder, or empty array if no holder
775
- */
776
- get troubles() {
777
- var e;
778
- return ((e = this.holder) == null ? void 0 : e.troubles) ?? [];
779
- }
780
- /**
781
- * Gets the highest priority trouble status.
782
- * Currently returns empty string as troubles are managed by the holder.
783
- *
784
- * @returns Empty string (trouble status handled by holder)
785
- */
786
- get troubleStatus() {
787
- return "";
788
- }
789
- /**
790
- * Gets troubles grouped by type from the associated holder.
791
- *
792
- * @returns Record of troubles grouped by type from the holder, or empty object if no holder
793
- */
794
- get troublesByType() {
795
- var e;
796
- return ((e = this.holder) == null ? void 0 : e.troublesByType) ?? {};
797
- }
798
- /**
799
- * Updates the model with new configuration options.
800
- * Can be used to modify the holder path, config path, or name after initialization.
801
- *
802
- * @param _options - New configuration options for the remote tray
803
- */
804
- updateModel(e) {
805
- }
806
- /**
807
- * Gets the associated holder model for this remote tray.
808
- * Uses synchronous model lookup to retrieve the holder by path.
809
- *
810
- * @returns The HolderModel instance referenced by holderPath, or undefined if not found
811
- */
812
- get holder() {
813
- return A(this.holderPath).model;
814
- }
815
- /**
816
- * Determines if the remote tray is currently active.
817
- * Active state is based on the remoteTrayEnabled configuration property.
818
- *
819
- * @returns true if the tray is enabled, false otherwise
820
- */
821
- get active() {
822
- return !!this.remoteTrayEnabled.value;
823
- }
824
- // -------------------LIFECYCLE----------------------------
825
- /**
826
- * Initializes the remote tray model.
827
- * Called during the model lifecycle initialization phase.
828
- * Sets up initial state and prepares the model for use.
829
- *
830
- * @returns Promise that resolves when initialization is complete
831
- */
832
- async init() {
833
- this.logger.debug(`initializing remote-tray ${this.id}`);
834
- }
835
- /**
836
- * Loads the remote tray configuration and associated data.
837
- * Called during the model lifecycle load phase.
838
- * Typically loads configuration settings and establishes holder references.
839
- *
840
- * @returns Promise that resolves when loading is complete
841
- */
842
- async load() {
843
- this.logger.debug(`loading remote-tray ${this.id}`);
844
- }
845
- };
846
- rt([
847
- b({
848
- path: vr,
849
- attribute: "enabled"
850
- })
851
- ], ee.prototype, "remoteTrayEnabled", 2);
852
- ee = rt([
853
- f(at)
854
- ], ee);
855
- const V = new F({
856
- class: ee,
857
- type: at
858
- });
859
- var _r = Object.getOwnPropertyDescriptor, Tr = (e, t, r, o) => {
860
- for (var a = o > 1 ? void 0 : o ? _r(t, r) : t, n = e.length - 1, i; n >= 0; n--)
861
- (i = e[n]) && (a = i(a) || a);
862
- return a;
863
- };
864
- const ot = "remote-tray-container-model";
865
- let me = class {
866
- constructor(e) {
867
- s(this, "id");
868
- this.id = e;
869
- }
870
- };
871
- me = Tr([
872
- f(ot),
873
- D(),
874
- Ct()
875
- ], me);
876
- const Ee = new Te({
877
- class: me,
878
- type: ot
879
- });
880
- Ee.addRelatedModel(V);
881
- var Ir = Object.getOwnPropertyDescriptor, $r = (e, t, r, o) => {
882
- for (var a = o > 1 ? void 0 : o ? Ir(t, r) : t, n = e.length - 1, i; n >= 0; n--)
883
- (i = e[n]) && (a = i(a) || a);
884
- return a;
885
- };
886
- const it = "freestyle-holder-model";
887
- function Cr(e) {
888
- const t = Ot.getContext(e), r = t == null ? void 0 : t.get(
889
- fe.type
890
- );
891
- if (!r) {
892
- C.error("Freestyle assembly not found");
893
- return;
894
- }
895
- return r;
896
- }
897
- async function Or(e, t) {
898
- if (!e || !t)
899
- return;
900
- const r = await e[t]();
901
- if (r != null && r.tracker)
902
- return y.getFuture(r.tracker);
903
- }
904
- let ye = class {
905
- constructor(e, t, r) {
906
- s(this, "id");
907
- s(this, "logger");
908
- s(this, "holder");
909
- s(this, "context");
910
- s(this, "future");
911
- this.id = e, this.logger = r.logger, this.context = r.kosContext, this.holder = t.companionParent;
912
- }
913
- get agitated() {
914
- return this.holder.data.agitated;
915
- }
916
- async agitate() {
917
- if (!this.holder.data.agitated)
918
- return;
919
- this.future = void 0;
920
- const e = Cr(this.id);
921
- if (!e)
922
- return;
923
- if (!e.defaultCartridgeAgitator) {
924
- this.logger.error("Agitator not found");
925
- return;
926
- }
927
- return this.future = await Or(
928
- e.defaultCartridgeAgitator,
929
- "testAgitate"
930
- ), this.future;
931
- }
932
- get isRemote() {
933
- const e = `${V.type}-${this.holder.path}`, t = A(e);
934
- return t != null && t.model ? !!t.model.remoteTrayEnabled.value : !1;
935
- }
936
- // -------------------LIFECYCLE----------------------------
937
- async init() {
938
- this.logger.debug(`initializing freestyle-holder ${this.id}`);
939
- }
940
- async load() {
941
- this.logger.debug(`loading freestyle-holder ${this.id}`);
942
- }
943
- };
944
- ye = $r([
945
- f(it)
946
- ], ye);
947
- const Ae = new F({
948
- class: ye,
949
- type: it
950
- }), { URL: Er } = M("FREESTYLE-NOZZLE_SERVICE"), { getOne: Sr } = R.build({
951
- basePath: `${Er}/api/freestyle-nozzle`
952
- }), W = C.createLogger({
953
- name: "freestyle-nozzle-service",
954
- group: "Services"
955
- });
956
- class Ar extends Error {
957
- constructor(t) {
958
- super(t), this.name = "NutritionInfoError";
959
- }
960
- }
961
- class we extends Error {
962
- constructor(t) {
963
- super(t), this.name = "InvalidRequestError";
964
- }
965
- }
966
- const wr = async (e, t, r, o = "http://localhost:8081") => {
967
- if (W.debug("sending GET for freestyle-nozzle"), !t)
968
- throw W.error("Invalid freestyle-nozzle request: beverageId is required"), new we("No beverageId provided");
969
- if (!r || r.length === 0)
970
- throw W.error("Invalid freestyle-nozzle request: volumes are required"), new we("No volumes provided");
971
- const a = await Sr({
972
- urlOverride: `${o}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(
973
- ","
974
- )}`
975
- });
976
- if (!(a != null && a.data))
977
- throw W.error("Failed to retrieve freestyle-nozzle data"), new Error("Failed to retrieve freestyle-nozzle data");
978
- if (a.data.error)
979
- throw new Ar(a.data.error);
980
- return a.data;
981
- };
982
- var Mr = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, st = (e, t, r, o) => {
983
- for (var a = o > 1 ? void 0 : o ? Rr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
984
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
985
- return o && a && Mr(t, r, a), a;
986
- };
987
- const nt = "freestyle-nozzle-model";
988
- let te = class {
989
- constructor(e, t, r) {
990
- s(this, "id");
991
- s(this, "logger");
992
- s(this, "nozzleModel");
993
- s(this, "_cupSizes");
994
- s(this, "_nutritionInfo");
995
- this.id = e, this.logger = r.logger, this.nozzleModel = t.companionParent, this._cupSizes = [100];
996
- }
997
- set cupSizes(e) {
998
- this._cupSizes = e;
999
- }
1000
- get nutritionInfo() {
1001
- return this._nutritionInfo;
1002
- }
1003
- get selectedPourable() {
1004
- return this.nozzleModel.selectedPourable;
1005
- }
1006
- async handleBeverageSelection() {
1007
- if (this.nozzleModel.selectedPourable.beverage && this._cupSizes.length) {
1008
- this.logger.debug(
1009
- `selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`
1010
- );
1011
- const e = this.nozzleModel.selectedPourable.beverage.rawId, t = this.nozzleModel.urlPrefix;
1012
- try {
1013
- const r = await wr(
1014
- t,
1015
- e,
1016
- this._cupSizes
1017
- );
1018
- Z(() => {
1019
- this._nutritionInfo = r;
1020
- });
1021
- } catch (r) {
1022
- this.logger.error(`Error fetching nutrition info: ${r}`);
1023
- }
1024
- }
1025
- }
1026
- // -------------------LIFECYCLE----------------------------
1027
- async init() {
1028
- this.logger.debug(`initializing freestyle-nozzle ${this.id}`);
1029
- }
1030
- unload() {
1031
- this.logger.debug(`unloading freestyle-nozzle ${this.id}`);
1032
- }
1033
- async load() {
1034
- this.logger.debug(`loading freestyle-nozzle ${this.id}`);
1035
- }
1036
- };
1037
- st([
1038
- _e({
1039
- dependencies: (e) => [
1040
- e.selectedPourable.beverage
1041
- ]
1042
- })
1043
- ], te.prototype, "handleBeverageSelection", 1);
1044
- te = st([
1045
- je(),
1046
- f(nt)
1047
- ], te);
1048
- const Me = new F({
1049
- class: te,
1050
- type: nt
1051
- }), { URL: lt } = M("PUMP_SERVICE"), { postModel: Dr } = R.build({
1052
- basePath: `${lt}/api/ext/freestyle/microCalibration`
1053
- }), he = C.createLogger({
1054
- name: "freestyle-pump-service",
1055
- group: "Services"
1056
- }), Fr = async (e, t) => {
1057
- var r, o, a, n, i;
1058
- he.debug(
1059
- `replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
1060
- );
1061
- try {
1062
- const u = await Dr({
1063
- model: {},
1064
- urlOverride: `${lt}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
1065
- });
1066
- return he.debug("replacePump - response:", u), ((u == null ? void 0 : u.status) === 200 || (u == null ? void 0 : u.status) === 499) && ((r = u.data) != null && r.error) ? [u.data.error || "unknownError", u.data] : [void 0, u == null ? void 0 : u.data];
1067
- } catch (u) {
1068
- if (he.error(
1069
- `replacePump - sending POST request to /api/cal/${e}/code/${t}`,
1070
- u
1071
- ), u instanceof Ie) {
1072
- const E = ((a = (o = u.payload) == null ? void 0 : o.data) == null ? void 0 : a.error) || ((n = u.payload) == null ? void 0 : n.error) || "unknownError";
1073
- return [E, ((i = u.payload) == null ? void 0 : i.data) || { error: E }];
1074
- }
1075
- }
1076
- return ["unknownError", { error: "unknownError" }];
1077
- };
1078
- var Nr = Object.getOwnPropertyDescriptor, zr = (e, t, r, o) => {
1079
- for (var a = o > 1 ? void 0 : o ? Nr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
1080
- (i = e[n]) && (a = i(a) || a);
1081
- return a;
1082
- };
1083
- const ut = "freestyle-pump-model";
1084
- let be = class {
1085
- constructor(e, t, r) {
1086
- s(this, "id");
1087
- s(this, "logger");
1088
- s(this, "pump");
1089
- this.id = e, this.logger = r.logger, this.pump = t.companionParent;
1090
- }
1091
- // -------------------LIFECYCLE----------------------------
1092
- async replacePump(e) {
1093
- const [t, r] = await Fr(this.pump.path, e);
1094
- return t && this.logger.error(`Failed to replace the pump, ${this.pump.id}`, t), [t, r];
1095
- }
1096
- };
1097
- be = zr([
1098
- f(ut)
1099
- ], be);
1100
- const Re = new F({
1101
- class: be,
1102
- type: ut
1103
- }), { URL: N } = M("ICE_AGITATOR_SERVICE"), { getAll: ct, postModel: le } = R.build({
1104
- basePath: `${N}/api/ext/freestyle/ice`
1105
- }), dt = C.createLogger({
1106
- name: "ice-agitator-service",
1107
- group: "Services"
1108
- }), Lr = async (e) => (dt.debug("sending GET for ice types"), await ct({
1109
- urlOverride: `${N}/api/handle/${e}/types`
1110
- })), xr = async (e, t) => (dt.debug("sending POST for ice types"), await le({
1111
- urlOverride: `${N}/api/handle/${e}/type/${t}`,
1112
- model: {}
1113
- })), qr = async (e) => await ct({
1114
- urlOverride: `${N}/api/kos/config/details/${e}/4`
1115
- }), Gr = async (e, t) => {
1116
- const r = await le({
1117
- model: {},
1118
- tracker: t,
1119
- urlOverride: `${N}/api/handle/${e}/pour`
1120
- });
1121
- if (!(r != null && r.data))
1122
- throw new Error("No response from server");
1123
- return r == null ? void 0 : r.data;
1124
- }, Ur = async (e, t) => {
1125
- const r = await le({
1126
- model: {},
1127
- tracker: t,
1128
- urlOverride: `${N}/api/handle/${e}/test/agitation`
1129
- });
1130
- if (!(r != null && r.data))
1131
- throw new Error("No response from server");
1132
- return r == null ? void 0 : r.data;
1133
- }, jr = async (e, t) => {
1134
- const r = await le({
1135
- model: {},
1136
- tracker: t,
1137
- urlOverride: `${N}/api/handle/${e}/test/gate`
1138
- });
1139
- if (!(r != null && r.data))
1140
- throw new Error("No response from server");
1141
- return r == null ? void 0 : r.data;
1142
- };
1143
- var pt = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Hr = (e, t, r) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, p = (e, t, r, o) => {
1144
- for (var a = o > 1 ? void 0 : o ? Vr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
1145
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
1146
- return o && a && pt(t, r, a), a;
1147
- }, Br = (e, t, r) => (Hr(e, t + "", r), r);
1148
- class re {
1149
- }
1150
- s(re, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/ice-agitation-started"), s(re, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/ice-agitation-ended");
1151
- const Kr = "ice-agitator-model", gt = G("statePath");
1152
- let c = class {
1153
- constructor(e, t) {
1154
- s(this, "id");
1155
- s(this, "name");
1156
- s(this, "path");
1157
- s(this, "volWithoutIceMl");
1158
- s(this, "durationSec");
1159
- s(this, "enableIceChuteClear");
1160
- s(this, "iceChuteClearDurationMs");
1161
- s(this, "iceChuteClearIntervalSec");
1162
- s(this, "iceChuteClearRetryIntervalSec");
1163
- s(this, "maxDispenseSec");
1164
- s(this, "type");
1165
- s(this, "dilutionOffset");
1166
- s(this, "inactivitySec");
1167
- s(this, "agitating");
1168
- s(this, "iceChuteOpen");
1169
- s(this, "statePath");
1170
- s(this, "_allIceTypes");
1171
- s(this, "currentState", d.IDLE);
1172
- s(this, "resetDefaultValues", async () => await qr(this.path));
1173
- this.id = e, this.name = t.name, this.path = t.path, this.statePath = t.statePath, this._allIceTypes = [];
1174
- }
1175
- get iceTypes() {
1176
- return this._allIceTypes;
1177
- }
1178
- get isAgitating() {
1179
- return !!this.agitating.value;
1180
- }
1181
- get isIceChuteOpen() {
1182
- return !!this.iceChuteOpen.value;
1183
- }
1184
- // future, pourFuture, agitateFuture, gateFuture getters are now provided by @kosMultipleFutureAware decorator
1185
- /**
1186
- * A derived value that indicates if the nozzle is currently pouring a beverage.
1187
- * @readonly
1188
- */
1189
- get isPouring() {
1190
- var e;
1191
- return !!(this.pourFuture && !((e = this.pourFuture) != null && e.endState)) || this.currentState === d.POUR_STARTING || this.currentState === d.POURING || this.currentState === d.POUR_CANCELING;
1192
- }
1193
- /**
1194
- * A derived value that indicates if it is possible to dispense ice.
1195
- *
1196
- * The value is observable and will change as the current dispense state changes
1197
- * @readonly
1198
- * */
1199
- get canPour() {
1200
- return this.currentState === d.IDLE;
1201
- }
1202
- updateIfCurrent(e, t) {
1203
- this.currentState === e && Z(() => {
1204
- this.currentState = t;
1205
- });
1206
- }
1207
- async pourIce(e) {
1208
- try {
1209
- if (this.currentState === d.IDLE) {
1210
- if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
1211
- throw new Error("No tracker provided");
1212
- const t = await Gr(this.path, e);
1213
- return this.updateIfCurrent(d.POUR_STARTING, d.POURING), t != null && t.endState && this.updateIfCurrent(d.POURING, d.IDLE), t;
1214
- } else
1215
- throw new Error(`Cannot pour in state ${this.currentState}`);
1216
- } catch (t) {
1217
- throw this.logger.error(t), this.currentState = d.IDLE, t;
1218
- }
1219
- }
1220
- /**
1221
- * An action that will cancel the ice dispense if it is currently in progress.
1222
- * */
1223
- async cancelIceDispense() {
1224
- var e;
1225
- this.currentState === d.POURING || this.currentState === d.POUR_STARTING ? (this.currentState = d.POUR_CANCELING, await ((e = this.pourFuture) == null ? void 0 : e.cancelFuture()), Z(() => {
1226
- this.currentState = d.IDLE;
1227
- })) : this.logger.warn(
1228
- `Cannot cancel ice dispense in state ${this.currentState}`
1229
- );
1230
- }
1231
- async testAgitate(e) {
1232
- if (!e)
1233
- throw new Error("No tracker provided");
1234
- return this.logger.info(`agitating ice-agitator ${this.id}`), Ur(this.path, e);
1235
- }
1236
- async testGate(e) {
1237
- if (!e)
1238
- throw new Error("No tracker provided");
1239
- return this.logger.info(`testing ice gate: ${this.id}`), jr(this.path, e);
1240
- }
1241
- handleAgitationChange() {
1242
- var e;
1243
- this.isAgitating ? (this.logger.info(`agitating ice-agitator ${this.id}`), k.publish(re.TOPIC_AGITATION_STARTED, {
1244
- path: this.path,
1245
- futureId: (e = this.futureHandler.future) == null ? void 0 : e.futureId
1246
- })) : k.publish(re.TOPIC_AGITATION_ENDED, {
1247
- path: this.path
1248
- });
1249
- }
1250
- async updateIceType(e) {
1251
- await xr(this.path, e);
1252
- }
1253
- async init() {
1254
- this.logger.debug(`initializing ice-agitator ${this.id}`);
1255
- }
1256
- async load() {
1257
- try {
1258
- this.logger.debug(`loading ice-agitator ${this.id}`);
1259
- const e = await Lr(this.path);
1260
- (e == null ? void 0 : e.status) === 200 && Z(() => {
1261
- this._allIceTypes = e.data || [];
1262
- });
1263
- } catch (e) {
1264
- this.logger.error(e);
1265
- }
1266
- }
1267
- };
1268
- Br(c, "Registration");
1269
- p([
1270
- b({
1271
- path: $,
1272
- attribute: "settings.volWithoutIceMl"
1273
- })
1274
- ], c.prototype, "volWithoutIceMl", 2);
1275
- p([
1276
- b({
1277
- path: $,
1278
- attribute: "settings.durationSec",
1279
- converter: {
1280
- to: "second"
1281
- }
1282
- })
1283
- ], c.prototype, "durationSec", 2);
1284
- p([
1285
- b({
1286
- path: $,
1287
- attribute: "enableIceChuteClear"
1288
- })
1289
- ], c.prototype, "enableIceChuteClear", 2);
1290
- p([
1291
- b({
1292
- path: $,
1293
- attribute: "iceChuteClearDurationMs"
1294
- })
1295
- ], c.prototype, "iceChuteClearDurationMs", 2);
1296
- p([
1297
- b({
1298
- path: $,
1299
- attribute: "iceChuteClearIntervalSec"
1300
- })
1301
- ], c.prototype, "iceChuteClearIntervalSec", 2);
1302
- p([
1303
- b({
1304
- path: $,
1305
- attribute: "iceChuteClearRetryIntervalSec"
1306
- })
1307
- ], c.prototype, "iceChuteClearRetryIntervalSec", 2);
1308
- p([
1309
- b({
1310
- path: $,
1311
- attribute: "maxDispenseSec"
1312
- })
1313
- ], c.prototype, "maxDispenseSec", 2);
1314
- p([
1315
- b({
1316
- path: $,
1317
- attribute: "type"
1318
- })
1319
- ], c.prototype, "type", 2);
1320
- p([
1321
- b({
1322
- path: $,
1323
- attribute: "settings.dilutionOffset"
1324
- })
1325
- ], c.prototype, "dilutionOffset", 2);
1326
- p([
1327
- b({
1328
- path: $,
1329
- attribute: "settings.inactivitySec",
1330
- converter: {
1331
- to: "minute"
1332
- }
1333
- })
1334
- ], c.prototype, "inactivitySec", 2);
1335
- p([
1336
- O({ path: gt, attribute: "agitating" })
1337
- ], c.prototype, "agitating", 2);
1338
- p([
1339
- O({ path: gt, attribute: "iceChuteOpen" })
1340
- ], c.prototype, "iceChuteOpen", 2);
1341
- p([
1342
- I({ alias: "pour" })
1343
- ], c.prototype, "pourIce", 1);
1344
- p([
1345
- I({ alias: "agitate" })
1346
- ], c.prototype, "testAgitate", 1);
1347
- p([
1348
- I({
1349
- alias: "gate"
1350
- })
1351
- ], c.prototype, "testGate", 1);
1352
- p([
1353
- _e({
1354
- dependencies: (e) => [e.isAgitating]
1355
- })
1356
- ], c.prototype, "handleAgitationChange", 1);
1357
- c = p([
1358
- f({ modelTypeId: Kr, singleton: !1 }),
1359
- D(),
1360
- Et()
1361
- ], c);
1362
- const ht = c.Registration;
1363
- var Yr = Object.defineProperty, Wr = Object.getOwnPropertyDescriptor, Zr = (e, t, r) => t in e ? Yr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, kr = (e, t, r, o) => {
1364
- for (var a = o > 1 ? void 0 : o ? Wr(t, r) : t, n = e.length - 1, i; n >= 0; n--)
1365
- (i = e[n]) && (a = i(a) || a);
1366
- return a;
1367
- }, Qr = (e, t, r) => (Zr(e, t + "", r), r);
1368
- const Xr = "lfcv-pump-model";
1369
- let ae = class {
1370
- constructor(e, t) {
1371
- s(this, "id");
1372
- this.id = e;
1373
- }
1374
- get name() {
1375
- return this.pumpModel.name;
1376
- }
1377
- get canPour() {
1378
- return this.pumpModel.canPour;
1379
- }
1380
- get isPouring() {
1381
- return this.pumpModel.isPouring;
1382
- }
1383
- async cancelPour() {
1384
- return this.pumpModel.cancelPour();
1385
- }
1386
- performIntent(e) {
1387
- return this.pumpModel.performIntent(e);
1388
- }
1389
- };
1390
- Qr(ae, "Registration");
1391
- ae = kr([
1392
- f({ modelTypeId: Xr, singleton: !1 }),
1393
- D(),
1394
- oe({
1395
- mode: "composition",
1396
- parentProperty: "pumpModel"
1397
- })
1398
- ], ae);
1399
- const Jr = ae.Registration, { URL: Y } = M("SPM-PUMP_SERVICE"), { postModel: ue } = R.build({
1400
- basePath: `${Y}/api/spm-pump`
1401
- }), _ = C.createLogger({
1402
- name: "spm-pump-service",
1403
- group: "Services"
1404
- }), ea = async (e, t) => {
1405
- _.debug(
1406
- `performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`
1407
- );
1408
- try {
1409
- const r = await ue({
1410
- model: {},
1411
- urlOverride: `${Y}/api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,
1412
- tracker: t
1413
- });
1414
- return _.debug("performPreCalibrate - response:", r), r != null && r.data && y.initiateFuture(r.data), r == null ? void 0 : r.data;
1415
- } catch (r) {
1416
- _.error(
1417
- `performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,
1418
- r
1419
- );
1420
- const o = {
1421
- id: t || "",
1422
- endState: U.Fail,
1423
- tracker: t,
1424
- reason: "Failed to resolve trouble"
1425
- };
1426
- return y.initiateFuture(o), o;
1427
- }
1428
- }, ta = async (e, t) => {
1429
- _.debug(
1430
- `performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`
1431
- );
1432
- try {
1433
- const r = await ue({
1434
- model: {},
1435
- urlOverride: `${Y}/api/ext/freestyle/microCalibration/pour/${e}/calibrate`,
1436
- tracker: t
1437
- });
1438
- return _.debug("performCalibrate - response:", r), r != null && r.data && y.initiateFuture(r.data), r == null ? void 0 : r.data;
1439
- } catch (r) {
1440
- _.error(
1441
- `performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`,
1442
- r
1443
- );
1444
- const o = {
1445
- id: t || "",
1446
- endState: U.Fail,
1447
- tracker: t,
1448
- reason: "Failed to resolve trouble"
1449
- };
1450
- return y.initiateFuture(o), o;
1451
- }
1452
- }, ra = async (e, t, r, o) => {
1453
- _.debug(
1454
- `performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`
1455
- );
1456
- try {
1457
- const a = await ue({
1458
- model: {
1459
- ...r,
1460
- // commandedCalibrationVolume: 0,
1461
- measuredCalibrationVolume: t
1462
- // measuredVerificationVolume: 0,
1463
- // newCalibrationValue: 0,
1464
- // pouredCalibrationVolume: 0,
1465
- },
1466
- urlOverride: `${Y}/api/ext/freestyle/microCalibration/pour/${e}/verify`,
1467
- tracker: o
1468
- });
1469
- return _.debug("performVerify - response:", a), a != null && a.data && y.initiateFuture(a.data), a == null ? void 0 : a.data;
1470
- } catch (a) {
1471
- _.error(
1472
- `performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`,
1473
- a
1474
- );
1475
- const n = {
1476
- id: o || "",
1477
- endState: U.Fail,
1478
- tracker: o,
1479
- reason: "Failed to resolve trouble"
1480
- };
1481
- return y.initiateFuture(n), n;
1482
- }
1483
- }, aa = async (e, t, r, o) => {
1484
- var a, n, i, u, E;
1485
- _.debug(
1486
- `performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`
1487
- );
1488
- try {
1489
- const l = await ue({
1490
- model: {
1491
- ...o,
1492
- // commandedCalibrationVolume: 0,
1493
- measuredCalibrationVolume: t,
1494
- measuredVerificationVolume: r
1495
- // newCalibrationValue: 0,
1496
- // pouredCalibrationVolume: 0,
1497
- },
1498
- urlOverride: `${Y}/api/ext/freestyle/microCalibration/pour/${e}/complete`
1499
- });
1500
- return _.debug("performComplete - response:", l), ((l == null ? void 0 : l.status) === 200 || (l == null ? void 0 : l.status) === 499) && ((a = l.data) != null && a.error) ? [l.data.error || "unknownError", l.data] : [void 0, l == null ? void 0 : l.data];
1501
- } catch (l) {
1502
- if (_.error(
1503
- `performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`,
1504
- l
1505
- ), l instanceof Ie) {
1506
- const v = ((i = (n = l.payload) == null ? void 0 : n.data) == null ? void 0 : i.error) || ((u = l.payload) == null ? void 0 : u.error) || "unknownError";
1507
- return [v, ((E = l.payload) == null ? void 0 : E.data) || { error: v }];
1508
- }
1509
- }
1510
- return ["unknownError", { error: "unknownError" }];
1511
- };
1512
- var oa = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, ce = (e, t, r, o) => {
1513
- for (var a = o > 1 ? void 0 : o ? ia(t, r) : t, n = e.length - 1, i; n >= 0; n--)
1514
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
1515
- return o && a && oa(t, r, a), a;
1516
- };
1517
- const ft = "spm-pump-model";
1518
- let x = class {
1519
- constructor(e, t, r) {
1520
- s(this, "id");
1521
- s(this, "logger");
1522
- s(this, "pump");
1523
- s(this, "futureHandler");
1524
- this.id = e, this.logger = r.logger, this.pump = t.companionParent, this.futureHandler = new Ue(this);
1525
- }
1526
- get name() {
1527
- return this.pump.name;
1528
- }
1529
- get canPour() {
1530
- return this.pump.canPour;
1531
- }
1532
- get isPouring() {
1533
- return this.pump.isPouring;
1534
- }
1535
- async cancelPour() {
1536
- return this.pump.cancelPour();
1537
- }
1538
- performIntent(e) {
1539
- return this.pump.performIntent(e);
1540
- }
1541
- get future() {
1542
- return this.futureHandler.future;
1543
- }
1544
- async performPreCalibrate(e) {
1545
- return ea(this.pump.path, e);
1546
- }
1547
- async performCalibrate(e) {
1548
- return ta(this.pump.path, e);
1549
- }
1550
- async performVerify(e, t, r) {
1551
- return ra(this.pump.path, e, t, r);
1552
- }
1553
- async performComplete(e, t, r) {
1554
- return aa(this.pump.path, e, t, r);
1555
- }
1556
- // -------------------LIFECYCLE----------------------------
1557
- async init() {
1558
- this.logger.debug(`initializing spm-pump ${this.id}`);
1559
- }
1560
- async load() {
1561
- this.logger.debug(`loading spm-pump ${this.id}`);
1562
- }
1563
- };
1564
- ce([
1565
- I()
1566
- ], x.prototype, "performPreCalibrate", 1);
1567
- ce([
1568
- I()
1569
- ], x.prototype, "performCalibrate", 1);
1570
- ce([
1571
- I()
1572
- ], x.prototype, "performVerify", 1);
1573
- x = ce([
1574
- f(ft)
1575
- ], x);
1576
- const sa = new F({
1577
- class: x,
1578
- type: ft
1579
- });
1580
- var mt = Object.defineProperty, na = Object.getOwnPropertyDescriptor, la = (e, t, r) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Se = (e, t, r, o) => {
1581
- for (var a = o > 1 ? void 0 : o ? na(t, r) : t, n = e.length - 1, i; n >= 0; n--)
1582
- (i = e[n]) && (a = (o ? i(t, r, a) : i(a)) || a);
1583
- return o && a && mt(t, r, a), a;
1584
- }, ua = (e, t, r) => (la(e, t + "", r), r);
1585
- const yt = "agitation-required-trouble-model", ca = (e) => {
1586
- if (e.data.agitationRequired)
1587
- return yt;
1588
- }, da = "InsufficientAgitationTrouble";
1589
- let q = class {
1590
- /**
1591
- * Creates a new AgitationRequiredTrouble model instance.
1592
- *
1593
- * @param modelId - Unique identifier for this model instance (typically matches parent trouble ID)
1594
- */
1595
- constructor(e) {
1596
- /**
1597
- * Unique identifier for this model instance.
1598
- */
1599
- s(this, "id");
1600
- s(this, "_deferred");
1601
- s(this, "_holdersLoaded", !1);
1602
- s(this, "agitateBeforePour");
1603
- this.id = e, this._deferred = !1;
1604
- }
1605
- /**
1606
- * Resolves the agitation trouble by delegating to the parent trouble model.
1607
- *
1608
- * Resolution typically involves completing the agitation process and clearing
1609
- * the trouble state once carbonation or mixing levels are acceptable.
1610
- *
1611
- * @returns Promise resolving to the future response from the parent trouble's resolution
1612
- */
1613
- async resolve() {
1614
- return this.trouble.resolve();
1615
- }
1616
- /**
1617
- * Gets the holder model associated with this agitation trouble.
1618
- *
1619
- * The holder is the physical container (cartridge holder, ingredient holder, etc.)
1620
- * that requires agitation. Returns undefined if the holder model hasn't been
1621
- * loaded yet through the Assembly model initialization.
1622
- *
1623
- * @returns The holder model or undefined if not yet loaded
1624
- */
1625
- get holder() {
1626
- if (!this.trouble)
1627
- return;
1628
- const e = this.trouble.data.holderPaths[0], t = A(e);
1629
- if (!(!this._holdersLoaded && !t.model))
1630
- return t == null ? void 0 : t.model;
1631
- }
1632
- updateHolder() {
1633
- if (!this._holdersLoaded && this.trouble) {
1634
- const e = this.trouble.data.holderPaths[0];
1635
- A(e).model && (this._holdersLoaded = !0);
1636
- }
1637
- }
1638
- /**
1639
- * Determines if trouble resolution should be deferred until agitation completes.
1640
- *
1641
- * Trouble resolution is deferred when:
1642
- * 1. The holder has active insufficient agitation troubles
1643
- * 2. The `agitateBeforePour` configuration is enabled
1644
- *
1645
- * This ensures that operations requiring agitation (prime, purge, or other
1646
- * holder-related troubles) wait for proper carbonation or mixing before
1647
- * being marked as resolved.
1648
- *
1649
- * @returns true if trouble resolution should wait for agitation to complete
1650
- */
1651
- get shouldDefer() {
1652
- var o, a;
1653
- if (!this.holder)
1654
- return !0;
1655
- const t = (((o = this.holder) == null ? void 0 : o.troublesByType[da]) || []).length > 0;
1656
- return !!((a = this.agitateBeforePour) != null && a.value) && t;
1657
- }
1658
- /**
1659
- * Gets the current deferral state of this trouble.
1660
- *
1661
- * @returns true if this trouble resolution is currently deferred
1662
- */
1663
- get deferred() {
1664
- return this._deferred;
1665
- }
1666
- /**
1667
- * Marks this trouble as deferred, preventing immediate resolution.
1668
- *
1669
- * Called by the trouble system to indicate that trouble resolution
1670
- * should wait for agitation to complete before being marked as resolved.
1671
- */
1672
- defer() {
1673
- this._deferred = !0;
1674
- }
1675
- /**
1676
- * Clears the deferral state, allowing trouble resolution to proceed.
1677
- *
1678
- * Typically called after agitation has completed and the trouble can
1679
- * now be safely resolved.
1680
- */
1681
- clearDefer() {
1682
- this._deferred = !1;
1683
- }
1684
- };
1685
- ua(q, "Registration");
1686
- Se([
1687
- b({
1688
- path: "app:kosdev.ddk:app",
1689
- attribute: "ncui.agitateBeforePour"
1690
- })
1691
- ], q.prototype, "agitateBeforePour", 2);
1692
- Se([
1693
- St({
1694
- topic: At(Ve.type),
1695
- lifecycle: qe.INIT
1696
- })
1697
- ], q.prototype, "updateHolder", 1);
1698
- q = Se([
1699
- f({ modelTypeId: yt, singleton: !1 }),
1700
- D(),
1701
- oe({ mode: "composition", parentProperty: "trouble" })
1702
- ], q);
1703
- const pa = q.Registration, ga = ["iceAgitator"], ha = {
1704
- iceAgitator: ht
1705
- }, fa = C.createLogger({ name: "freestyle-assembly-data-mapper" }), Ca = async (e) => {
1706
- const t = Ce.instance().options({}).build(), r = Ee.instance().options({}).build(), o = e.assemblies.reduce((i, u) => {
1707
- var E;
1708
- return ga.forEach((l) => {
1709
- var S;
1710
- const v = u[l];
1711
- if (v) {
1712
- const bt = ha[l];
1713
- i[l] = bt.instance(v.path).options({
1714
- name: v.name,
1715
- path: v.path,
1716
- statePath: ((S = v.state) == null ? void 0 : S.path) || ""
1717
- }).build();
1718
- }
1719
- }), (E = u.cartridgeAgitators) == null || E.forEach((l) => {
1720
- var S;
1721
- const v = Qe.instance(
1722
- l.path
1723
- ).options({
1724
- name: l.name,
1725
- path: l.path,
1726
- statePath: ((S = l.state) == null ? void 0 : S.path) || ""
1727
- }).build();
1728
- t.addModel(v);
1729
- }), u.remoteTrays && u.remoteTrays.forEach((l) => {
1730
- fa.info(`Found remote tray ${l.name} with path ${l.path}`);
1731
- const v = `${V.type}-${l.holderPath}`, S = V.instance(v).options({
1732
- holderPath: l.holderPath,
1733
- configPath: l.path,
1734
- name: l.name
1735
- }).build();
1736
- r.addModel(S);
1737
- }), i;
1738
- }, {}), a = !!o.iceAgitator, n = !!o.carbTank;
1739
- return {
1740
- ...o,
1741
- cartridgeAgitators: t,
1742
- remoteTrays: r,
1743
- supportsCarb: n,
1744
- supportsIce: a
1745
- };
1746
- }, ma = (e) => () => (wt(e)(), Dt(e)(), Me.register(), fe.register(), ht.register(), Ke.register(), Ce.register(), sa.register(), pr.register(), Jr.register(), rr.register(), Re.register(), Ae.register(), V.register(), Ee.register(), m.companion.register(e)(
1747
- Ft.type,
1748
- Me.type
1749
- ), m.companion.register(e)(
1750
- Ve.type,
1751
- fe.type
1752
- ), pa.register(), m.companion.register(e)(
1753
- Mt.type,
1754
- ca
1755
- ), m.companion.register(e)(Nt.type, Re.type), m.companion.register(e)(
1756
- zt.type,
1757
- Ae.type
1758
- ), pe[ge].register(
1759
- "EnjoyByTrouble",
1760
- async (t) => {
1761
- if (t.data.enjoyByDate) {
1762
- const r = new Date(t.data.enjoyByDate);
1763
- return {
1764
- enjoyByDays: Math.floor(
1765
- ((/* @__PURE__ */ new Date()).getTime() - r.getTime()) / (1e3 * 60 * 60 * 24)
1766
- ) || ""
1767
- };
1768
- }
1769
- return {};
1770
- }
1771
- ), pe[ge].register(
1772
- "SuperPumpRequiredTrouble",
1773
- // This is the trouble type
1774
- async (t) => {
1775
- const { model: r } = A(
1776
- Lt.type
1777
- );
1778
- return r ? {
1779
- superPumps: r.models.getIndexByKey(
1780
- xt.byType,
1781
- "microSuper"
1782
- ).map((n) => n.name).join(", ")
1783
- } : {};
1784
- }
1785
- ), pe[ge].register(
1786
- "MicroPumpAirDetectTrouble",
1787
- async (t) => {
1788
- if (t.ifaces.includes("container"))
1789
- return {};
1790
- if (t.data.pumpPath) {
1791
- const { model: r } = A(
1792
- t.data.pumpPath
1793
- );
1794
- if (r) {
1795
- const o = r.ingredientId ? A(r.ingredientId).model : void 0;
1796
- return {
1797
- ingredientId: r.ingredientId,
1798
- ingredientName: (o == null ? void 0 : o.name) || ""
1799
- };
1800
- }
1801
- }
1802
- return {};
1803
- }
1804
- ), {
1805
- preload: m.model.preloadModel(e),
1806
- model: m.model.register(e),
1807
- companion: m.companion.register(e),
1808
- legacy: m.model.registerLegacyModel(e)
1809
- }), T = {
1810
- ...Rt
1811
- };
1812
- T.freestyle = {
1813
- models: ma(T)
1814
- };
1815
- T.preload = m.model.preloadModel(T);
1816
- T.model = m.model.register(T);
1817
- T.companion = m.companion.register(T);
1818
- T.legacy = m.model.registerLegacyModel(T);
1819
- const Oa = T;
1820
- function ya(e) {
1821
- return B(e);
1822
- }
1823
- const De = H(), Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1824
- __proto__: null,
1825
- api: De,
1826
- default: De,
1827
- kosServiceRequest: ya
1828
- }, Symbol.toStringTag, { value: "Module" }));
1829
- function ba(e) {
1830
- return B(e);
1831
- }
1832
- const Fe = H(), Sa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1833
- __proto__: null,
1834
- api: Fe,
1835
- default: Fe,
1836
- kosServiceRequest: ba
1837
- }, Symbol.toStringTag, { value: "Module" }));
1838
- function Pa(e) {
1839
- return B(e);
1840
- }
1841
- const Ne = H(), Aa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1842
- __proto__: null,
1843
- api: Ne,
1844
- default: Ne,
1845
- kosServiceRequest: Pa
1846
- }, Symbol.toStringTag, { value: "Module" }));
1847
- function va(e) {
1848
- return B(e);
1849
- }
1850
- const ze = H(), wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1851
- __proto__: null,
1852
- api: ze,
1853
- default: ze,
1854
- kosServiceRequest: va
1855
- }, Symbol.toStringTag, { value: "Module" }));
1856
- function _a(e) {
1857
- return B(e);
1858
- }
1859
- const Le = H(), Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1860
- __proto__: null,
1861
- api: Le,
1862
- default: Le,
1863
- kosServiceRequest: _a
1864
- }, Symbol.toStringTag, { value: "Module" }));
1865
- export {
1866
- da as A,
1867
- aa as B,
1868
- Ke as C,
1869
- ea as D,
1870
- ra as E,
1871
- pr as F,
1872
- Ca as G,
1873
- fr as H,
1874
- ht as I,
1875
- Oa as K,
1876
- Jr as L,
1877
- Ar as N,
1878
- Ee as R,
1879
- sa as S,
1880
- Ce as a,
1881
- X as b,
1882
- Qe as c,
1883
- rr as d,
1884
- fe as e,
1885
- Ae as f,
1886
- Me as g,
1887
- Re as h,
1888
- re as i,
1889
- pa as j,
1890
- Sa as k,
1891
- Aa as l,
1892
- wa as m,
1893
- Ma as n,
1894
- V as o,
1895
- ir as p,
1896
- lr as q,
1897
- ma as r,
1898
- Ea as s,
1899
- ar as t,
1900
- or as u,
1901
- sr as v,
1902
- we as w,
1903
- wr as x,
1904
- Fr as y,
1905
- ta as z
1906
- };
1907
- //# sourceMappingURL=service-BuugCicr.js.map