@kosdev-code/kos-freestyle-sdk 0.1.0-dev.5170 → 0.1.0-dev.5179

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 (32) hide show
  1. package/{extension-utils-CIeLBxMW.cjs → extension-utils-CbiToj2v.cjs} +2 -2
  2. package/{extension-utils-CIeLBxMW.cjs.map → extension-utils-CbiToj2v.cjs.map} +1 -1
  3. package/{extension-utils-mrQ_wiPv.js → extension-utils-DP5eulYE.js} +2 -2
  4. package/{extension-utils-mrQ_wiPv.js.map → extension-utils-DP5eulYE.js.map} +1 -1
  5. package/index.cjs +1 -1
  6. package/index.js +3 -3
  7. package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts +195 -5
  8. package/models/models/agitation-required-trouble/agitation-required-trouble-model.d.ts.map +1 -1
  9. package/models/models/agitation-required-trouble/index.d.ts +4 -2
  10. package/models/models/agitation-required-trouble/index.d.ts.map +1 -1
  11. package/models/models/carb-agitator/carb-agitator-model.d.ts +258 -0
  12. package/models/models/carb-agitator/carb-agitator-model.d.ts.map +1 -1
  13. package/models/models/carb-agitator/services/carb-tank-services.d.ts +25 -0
  14. package/models/models/carb-agitator/services/carb-tank-services.d.ts.map +1 -1
  15. package/models/utils/freestyle-registration-manager.d.ts.map +1 -1
  16. package/models.cjs +1 -1
  17. package/models.js +2 -2
  18. package/package.json +4 -4
  19. package/{service-DrOwtgpN.cjs → service-BYZ3LYEa.cjs} +2 -2
  20. package/service-BYZ3LYEa.cjs.map +1 -0
  21. package/{service-Rmefh9Kc.js → service-_jG-Kd3m.js} +539 -413
  22. package/service-_jG-Kd3m.js.map +1 -0
  23. package/ui.cjs +1 -1
  24. package/ui.js +2 -2
  25. package/{use-nutrition-info-Cb4qW_qq.js → use-nutrition-info-B9ybCLwb.js} +2 -2
  26. package/{use-nutrition-info-Cb4qW_qq.js.map → use-nutrition-info-B9ybCLwb.js.map} +1 -1
  27. package/{use-nutrition-info-DOOjBBqm.cjs → use-nutrition-info-C-RDcG4S.cjs} +2 -2
  28. package/{use-nutrition-info-DOOjBBqm.cjs.map → use-nutrition-info-C-RDcG4S.cjs.map} +1 -1
  29. package/models/models/agitation-required-trouble/agitation-required-trouble-registration.d.ts +0 -87
  30. package/models/models/agitation-required-trouble/agitation-required-trouble-registration.d.ts.map +0 -1
  31. package/service-DrOwtgpN.cjs.map +0 -1
  32. package/service-Rmefh9Kc.js.map +0 -1
@@ -3,44 +3,302 @@ import { ProbeAware } from '../types/assembly';
3
3
  import { IKosDataModel, KosCompanionComposition, KosConfigProperty, KosCreationContext, KosFutureAwareFull, KosLoggerAware, KosModelRegistrationType, KosStateMachineAware, KosStateProp, PublicModelInterface } from '@kosdev-code/kos-ui-sdk';
4
4
  import { AssemblyModel } from '@kosdev-code/kos-dispense-sdk';
5
5
 
6
+ /**
7
+ * Unique identifier for the carb agitator model type used in KOS model registration.
8
+ *
9
+ * @category Constants
10
+ */
6
11
  export declare const MODEL_TYPE = "carb-agitator-model";
12
+ /**
13
+ * State machine states for carb agitator initialization workflow.
14
+ *
15
+ * The carb agitator progresses through these states during setup and operation:
16
+ * - UNINITIALIZED: Initial state, awaiting user action
17
+ * - ACTIVATING: Carb tank is being initialized
18
+ * - INITIALIZED: Carb tank is ready for operation
19
+ * - SKIPPED: User chose to proceed without carbonation
20
+ *
21
+ * @category State Machine
22
+ */
7
23
  export declare enum CarbAgitatorState {
24
+ /**
25
+ * Initial state before any action is taken.
26
+ * Can transition to ACTIVATING or SKIPPED.
27
+ */
8
28
  UNINITIALIZED = "UNINITIALIZED",
29
+ /**
30
+ * Carb tank activation is in progress.
31
+ * Transitions to INITIALIZED when complete.
32
+ */
9
33
  ACTIVATING = "ACTIVATING",
34
+ /**
35
+ * Carb tank is initialized and ready for operation.
36
+ * Can transition back to UNINITIALIZED via RESET.
37
+ */
10
38
  INITIALIZED = "INITIALIZED",
39
+ /**
40
+ * User chose to skip carbonation for this workflow.
41
+ * Can transition back to UNINITIALIZED via RESET.
42
+ */
11
43
  SKIPPED = "SKIPPED"
12
44
  }
45
+ /**
46
+ * Events that trigger state transitions in the carb agitator state machine.
47
+ *
48
+ * - ACTIVATE: Begin carb tank activation process
49
+ * - ACTIVATION_COMPLETE: Carb tank activation finished successfully
50
+ * - SKIP: Bypass carbonation for this workflow
51
+ * - RESET: Return to uninitialized state
52
+ *
53
+ * @category State Machine
54
+ */
13
55
  export type CarbAgitatorEvent = "ACTIVATE" | "ACTIVATION_COMPLETE" | "SKIP" | "RESET";
56
+ /**
57
+ * Public interface type for the carb agitator model.
58
+ *
59
+ * This type represents the public-facing API of the carb agitator model,
60
+ * exposing only public methods and properties while hiding internal implementation details.
61
+ *
62
+ * @category Types
63
+ */
14
64
  export type CarbAgitatorModel = PublicModelInterface<CarbAgitatorModelImpl>;
65
+ /**
66
+ * Interface defining the capabilities of the carb agitator model implementation.
67
+ *
68
+ * This interface combines multiple KOS aware interfaces to provide:
69
+ * - Logging capabilities via KosLoggerAware
70
+ * - Probe monitoring via ProbeAware (high/low probes, filling status)
71
+ * - State machine management via KosStateMachineAware
72
+ * - Async operations via KosFutureAwareFull
73
+ * - Parent-child relationships via KosCompanionComposition
74
+ *
75
+ * @category Types
76
+ */
15
77
  export interface CarbAgitatorModelImpl extends KosLoggerAware, ProbeAware, KosStateMachineAware<CarbAgitatorState, CarbAgitatorEvent>, KosFutureAwareFull, KosCompanionComposition<AssemblyModel> {
16
78
  }
17
79
  export declare class CarbAgitatorModelImpl implements IKosDataModel {
80
+ /**
81
+ * Registration factory for creating CarbAgitator model instances.
82
+ *
83
+ * Automatically injected by the `@kosModel` decorator.
84
+ *
85
+ * @see {@link CarbAgitator}
86
+ */
18
87
  static Registration: KosModelRegistrationType<CarbAgitatorModel, CarbAgitatorOptions>;
88
+ /**
89
+ * Unique identifier for this carb agitator instance.
90
+ */
19
91
  id: string;
92
+ /**
93
+ * Display name for this carb agitator.
94
+ */
20
95
  name: string;
96
+ /**
97
+ * Device path for carb tank operations.
98
+ */
21
99
  path: string;
100
+ /**
101
+ * State path for accessing probe and filling status.
102
+ */
22
103
  statePath: string;
104
+ /**
105
+ * High probe wet status indicator.
106
+ *
107
+ * Monitors whether the high-level probe in the carb tank is detecting liquid.
108
+ */
23
109
  highProbeWet: KosStateProp<boolean>;
110
+ /**
111
+ * Low probe wet status indicator.
112
+ *
113
+ * Monitors whether the low-level probe in the carb tank is detecting liquid.
114
+ */
24
115
  lowProbeWet: KosStateProp<boolean>;
116
+ /**
117
+ * Carb tank filling status indicator.
118
+ *
119
+ * Indicates whether the carb tank is currently being filled with liquid.
120
+ */
25
121
  filling: KosStateProp<boolean>;
122
+ /**
123
+ * Configuration property controlling carb tank enable/disable state.
124
+ *
125
+ * When enabled, the carb tank is operational and carbonation is active.
126
+ * When disabled, carbonation is bypassed.
127
+ */
26
128
  enabled: KosConfigProperty<boolean>;
129
+ /**
130
+ * Creates a new carb agitator model instance.
131
+ *
132
+ * @param modelId - Unique identifier for this instance
133
+ * @param options - Configuration options including name
134
+ * @param context - KOS creation context providing assembly paths
135
+ */
27
136
  constructor(modelId: string, options: CarbAgitatorOptions, context: KosCreationContext);
137
+ /**
138
+ * Gets the carb holder associated with this agitator.
139
+ *
140
+ * Retrieves the first holder from the "carb" group in the parent assembly.
141
+ *
142
+ * @returns The carb holder model, or undefined if not found
143
+ */
28
144
  get holder(): import('@kosdev-code/kos-dispense-sdk').HolderModel<any>;
145
+ /**
146
+ * Gets the pump associated with the carb holder.
147
+ *
148
+ * Returns the first pump from the holder's pump collection.
149
+ *
150
+ * @returns The pump model, or undefined if holder or pump not available
151
+ */
29
152
  get pump(): import('@kosdev-code/kos-dispense-sdk').PumpModel<any>;
153
+ /**
154
+ * Indicates whether the carb tank is currently being filled.
155
+ *
156
+ * @returns true if the filling state property indicates active filling
157
+ */
30
158
  get isFilling(): boolean;
159
+ /**
160
+ * Indicates whether the carb tank has been initialized.
161
+ *
162
+ * @returns true if the carb tank enabled configuration is set to true
163
+ */
31
164
  get isCarbInitialized(): boolean;
165
+ /**
166
+ * Indicates whether carb tank activation is allowed.
167
+ *
168
+ * Activation is only allowed when the carb tank is not already enabled.
169
+ *
170
+ * @returns true if the carb tank can be activated
171
+ */
32
172
  get canActivate(): boolean;
173
+ /**
174
+ * Indicates whether the workflow can proceed past carb initialization.
175
+ *
176
+ * The workflow can proceed when the state machine is in either INITIALIZED
177
+ * (carb tank activated) or SKIPPED (user chose to bypass carbonation).
178
+ *
179
+ * @returns true if ready to proceed with beverage operations
180
+ */
33
181
  get canProceed(): boolean;
182
+ /**
183
+ * State entry handler when entering ACTIVATING state.
184
+ *
185
+ * Logs the start of carb tank activation process.
186
+ *
187
+ * @internal
188
+ */
34
189
  handleActivationStart(): void;
190
+ /**
191
+ * State exit handler when leaving ACTIVATING state.
192
+ *
193
+ * Logs successful completion of carb tank initialization.
194
+ *
195
+ * @internal
196
+ */
35
197
  handleActivationComplete(): void;
198
+ /**
199
+ * State entry handler when entering INITIALIZED state.
200
+ *
201
+ * Logs that the carb tank is ready for beverage operations.
202
+ *
203
+ * @internal
204
+ */
36
205
  handleInitialized(): void;
206
+ /**
207
+ * State entry handler when entering SKIPPED state.
208
+ *
209
+ * Logs that the user has chosen to proceed without carbonation.
210
+ *
211
+ * @internal
212
+ */
37
213
  handleSkipped(): void;
214
+ /**
215
+ * Activates the carb tank and transitions through initialization workflow.
216
+ *
217
+ * This method:
218
+ * 1. Transitions to ACTIVATING state
219
+ * 2. Updates the enabled configuration property to true
220
+ * 3. Transitions to INITIALIZED state
221
+ *
222
+ * Can only be called when in UNINITIALIZED state (enforced by state guard).
223
+ *
224
+ * @throws {Error} If called from an invalid state
225
+ */
38
226
  activateCarbTank(): Promise<void>;
227
+ /**
228
+ * Deactivates the carb tank and resets to uninitialized state.
229
+ *
230
+ * This method:
231
+ * 1. Updates the enabled configuration property to false
232
+ * 2. Transitions back to UNINITIALIZED state
233
+ *
234
+ * Can be called from any state.
235
+ */
39
236
  deactivateCarbTank(): Promise<void>;
237
+ /**
238
+ * Skips carb tank initialization and proceeds without carbonation.
239
+ *
240
+ * Allows the workflow to continue without activating the carb tank.
241
+ * Transitions from UNINITIALIZED to SKIPPED state.
242
+ *
243
+ * Can only be called when in UNINITIALIZED state (enforced by state guard).
244
+ *
245
+ * @throws {Error} If called from an invalid state
246
+ */
40
247
  skip(): void;
248
+ /**
249
+ * Resets the carb tank to uninitialized state.
250
+ *
251
+ * This method:
252
+ * 1. Updates the enabled configuration property to false
253
+ * 2. Transitions back to UNINITIALIZED state
254
+ *
255
+ * Can only be called when in INITIALIZED or SKIPPED states (enforced by state guard).
256
+ *
257
+ * @throws {Error} If called from an invalid state
258
+ */
41
259
  reset(): void;
260
+ /**
261
+ * Toggles the carb tank between enabled and disabled states.
262
+ *
263
+ * If currently enabled, calls {@link deactivateCarbTank}.
264
+ * If currently disabled, calls {@link activateCarbTank}.
265
+ */
42
266
  toggleCarbTank(): void;
267
+ /**
268
+ * Tests the carb tank operation and returns a future for tracking progress.
269
+ *
270
+ * Initiates a carb tank test operation on the device and returns a future
271
+ * that can be monitored for progress and completion status.
272
+ *
273
+ * @param tracker - Future tracker ID (injected by @kosFuture decorator)
274
+ * @returns Promise resolving to a FutureResponse for operation tracking
275
+ * @throws {Error} If tracker is not provided by the decorator
276
+ */
43
277
  handleTestCarbTank(tracker?: string): Promise<import('@kosdev-code/kos-ui-sdk').FutureResponse>;
44
278
  }
279
+ /**
280
+ * Registration factory for creating CarbAgitator model instances.
281
+ *
282
+ * Use this constant to create new carb agitator instances using the fluent factory pattern.
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * // Create a new carb agitator model
287
+ * const carbAgitator = CarbAgitator
288
+ * .instance("carb-agitator-1")
289
+ * .options({ name: "Carb Tank" })
290
+ * .build();
291
+ *
292
+ * // Activate carb tank
293
+ * await carbAgitator.activateCarbTank();
294
+ *
295
+ * // Check readiness
296
+ * if (carbAgitator.canProceed) {
297
+ * console.log("Ready for beverage operations");
298
+ * }
299
+ * ```
300
+ *
301
+ * @category Models
302
+ */
45
303
  export declare const CarbAgitator: KosModelRegistrationType<CarbAgitatorModel, CarbAgitatorOptions>;
46
304
  //# sourceMappingURL=carb-agitator-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carb-agitator-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/carb-agitator/carb-agitator-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAiBjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAGhD,oBAAY,iBAAiB;IAC3B,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,qBAAqB,GACrB,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;AAE5E,MAAM,WAAW,qBACf,SAAQ,cAAc,EACpB,UAAU,EACV,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAC1D,kBAAkB,EAClB,uBAAuB,CAAC,aAAa,CAAC;CAAG;AAC7C,qBA+Ba,qBAAsB,YAAW,aAAa;IAEzD,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAC3C,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;IACF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAKlB,YAAY,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAMrC,WAAW,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAMpC,OAAO,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAMhC,OAAO,EAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAGnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,kBAAkB;IAU7B,IAAI,MAAM,6DAGT;IACD,IAAI,IAAI,2DAEP;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,UAAU,IAAI,OAAO,CAKxB;IAGD,qBAAqB,IAAI,IAAI;IAK7B,wBAAwB,IAAI,IAAI;IAKhC,iBAAiB,IAAI,IAAI;IAKzB,aAAa,IAAI,IAAI;IAKf,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzC,IAAI,IAAI,IAAI;IAOZ,KAAK,IAAI,IAAI;IAKb,cAAc,IAAI,IAAI;IAStB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM;CAUpC;AAED,eAAO,MAAM,YAAY,kEAAqC,CAAC"}
1
+ {"version":3,"file":"carb-agitator-model.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/carb-agitator/carb-agitator-model.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAiBjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAShD;;;;;;;;;;GAUG;AACH,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,aAAa,kBAAkB;IAE/B;;;OAGG;IACH,UAAU,eAAe;IAEzB;;;OAGG;IACH,WAAW,gBAAgB;IAE3B;;;OAGG;IACH,OAAO,YAAY;CACpB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,qBAAqB,GACrB,MAAM,GACN,OAAO,CAAC;AAEZ;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;AAE5E;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,qBACf,SAAQ,cAAc,EACpB,UAAU,EACV,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAC1D,kBAAkB,EAClB,uBAAuB,CAAC,aAAa,CAAC;CAAG;AAC7C,qBAwEa,qBAAsB,YAAW,aAAa;IACzD;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAC3C,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;IAEF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IAKH,YAAY,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAErC;;;;OAIG;IAKH,WAAW,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEpC;;;;OAIG;IAKH,OAAO,EAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEhC;;;;;OAKG;IAKH,OAAO,EAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAErC;;;;;;OAMG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,kBAAkB;IAU7B;;;;;;OAMG;IACH,IAAI,MAAM,6DAGT;IAED;;;;;;OAMG;IACH,IAAI,IAAI,2DAEP;IAED;;;;OAIG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;IACH,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;;;;;;OAMG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;;;;;OAOG;IACH,IAAI,UAAU,IAAI,OAAO,CAKxB;IAED;;;;;;OAMG;IAEH,qBAAqB,IAAI,IAAI;IAI7B;;;;;;OAMG;IAEH,wBAAwB,IAAI,IAAI;IAIhC;;;;;;OAMG;IAEH,iBAAiB,IAAI,IAAI;IAIzB;;;;;;OAMG;IAEH,aAAa,IAAI,IAAI;IAIrB;;;;;;;;;;;OAWG;IAEG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMvC;;;;;;;;OAQG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC;;;;;;;;;OASG;IAEH,IAAI,IAAI,IAAI;IAIZ;;;;;;;;;;OAUG;IAIH,KAAK,IAAI,IAAI;IAKb;;;;;OAKG;IACH,cAAc,IAAI,IAAI;IAQtB;;;;;;;;;OASG;IAEH,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM;CAUpC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,YAAY,kEAAqC,CAAC"}
@@ -1,4 +1,29 @@
1
1
  import { FutureResponse } from '@kosdev-code/kos-ui-sdk';
2
2
 
3
+ /**
4
+ * Initiates a carb tank test operation on the device.
5
+ *
6
+ * Sends a test command to the carb tank hardware at the specified path and returns
7
+ * a future response that can be used to track the test operation's progress and
8
+ * completion status.
9
+ *
10
+ * @param path - Device path to the carb tank hardware (e.g., "assembly:core:board:macksm:carbTank:carbTank")
11
+ * @param tracker - Future tracker ID for monitoring operation progress
12
+ * @returns Promise resolving to a FutureResponse for operation tracking
13
+ * @throws {Error} If the server returns no response data
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const future = await testCarbTank(
18
+ * "assembly:core:board:macksm:carbTank:carbTank",
19
+ * "tracker-123"
20
+ * );
21
+ *
22
+ * // Monitor future progress
23
+ * console.log(`Test status: ${future.status}`);
24
+ * ```
25
+ *
26
+ * @category Services
27
+ */
3
28
  export declare const testCarbTank: (path: string, tracker: string) => Promise<FutureResponse>;
4
29
  //# sourceMappingURL=carb-tank-services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carb-tank-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/carb-agitator/services/carb-tank-services.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,yBAAyB,CAAC;AAWjC,eAAO,MAAM,YAAY,SAAgB,MAAM,WAAW,MAAM,4BAY/D,CAAC"}
1
+ {"version":3,"file":"carb-tank-services.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-freestyle-sdk/src/models/models/carb-agitator/services/carb-tank-services.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,yBAAyB,CAAC;AAYjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,YAAY,SAAgB,MAAM,WAAW,MAAM,4BAY/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"freestyle-registration-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/freestyle-registration-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,yBAAyB,EAU9C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKL,mBAAmB,EAEnB,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAC;AAgBjC,eAAO,MAAM,uBAAuB,YACxB,CAAC;;;;;CA+GV,CAAC;AAEJ,KAAK,aAAa,CAAC,CAAC,IAAI,OAAO,yBAAyB,GAAG;IACzD,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAA;KAAE,CAAC;IACnD,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnE,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;CACtE,CAAC;AAEF,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAEtB,CAAC;AAcF,KAAK,oBAAoB,GAAG,aAAa,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEpE,QAAA,MAAM,gBAAgB,EAAE,oBAA+C,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"freestyle-registration-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-freestyle-sdk/src/models/utils/freestyle-registration-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,IAAI,yBAAyB,EAU9C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKL,mBAAmB,EAEnB,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAC;AAmBjC,eAAO,MAAM,uBAAuB,YACxB,CAAC;;;;;CA+GV,CAAC;AAEJ,KAAK,aAAa,CAAC,CAAC,IAAI,OAAO,yBAAyB,GAAG;IACzD,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAA;KAAE,CAAC;IACnD,OAAO,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnE,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;CACtE,CAAC;AAEF,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAEtB,CAAC;AAcF,KAAK,oBAAoB,GAAG,aAAa,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEpE,QAAA,MAAM,gBAAgB,EAAE,oBAA+C,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/models.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-DrOwtgpN.cjs"),r=require("./extension-utils-CIeLBxMW.cjs");require("@kosdev-code/kos-ui-sdk");require("@kosdev-code/kos-dispense-sdk");exports.AGITATION_REQUIRED_TROUBLE=e.AGITATION_REQUIRED_TROUBLE;exports.AgitationRequiredTrouble=e.AgitationRequiredTrouble;exports.CarbAgitator=e.CarbAgitator;exports.CartridgeAgitator=e.CartridgeAgitator;exports.CartridgeAgitatorContainer=e.CartridgeAgitatorContainer;exports.CartridgeAgitatorEvents=e.CartridgeAgitatorEvents;exports.CgpPump=e.CgpPump;exports.FREESTYLE_SERVICE=e.service$2;exports.FREESTYLE_SERVICE_1_6_5=e.service;exports.FREESTYLE_SERVICE_1_8_1=e.service$1;exports.FcmPump=e.FcmPump;exports.FreestyleAssembly=e.FreestyleAssembly;exports.FreestyleHolder=e.FreestyleHolder;exports.FreestyleNozzle=e.FreestyleNozzle;exports.FreestylePump=e.FreestylePump;exports.HANDLE_SERVICE=e.service$4;exports.HANDLE_SERVICE_1_8_1=e.service$3;exports.IceAgitator=e.IceAgitator;exports.IceAgitatorEvents=e.IceAgitatorEvents;exports.KosModelRegistry=e.KosModelRegistry;exports.LfcvPump=e.LfcvPump;exports.SpmPump=e.SpmPump;exports.registerFreestyleModels=e.registerFreestyleModels;exports.EXTENSION_PLUGIN_VISIBILITY=r.EXTENSION_PLUGIN_VISIBILITY;exports.FcmPumpServices=r.index;exports.FreestyleExtensionManager=r.FreestyleExtensionManager;exports.FreestyleNozzleServices=r.index$1;exports.FreestylePumpServices=r.index$2;exports.KosExtensionManager=r.KosExtensionManager;exports.LfcvPumpServices=r.index$3;exports.SpmPumpServices=r.index$4;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./service-BYZ3LYEa.cjs"),r=require("./extension-utils-CbiToj2v.cjs");require("@kosdev-code/kos-ui-sdk");require("@kosdev-code/kos-dispense-sdk");exports.AGITATION_REQUIRED_TROUBLE=e.AGITATION_REQUIRED_TROUBLE;exports.AgitationRequiredTrouble=e.AgitationRequiredTrouble;exports.CarbAgitator=e.CarbAgitator;exports.CartridgeAgitator=e.CartridgeAgitator;exports.CartridgeAgitatorContainer=e.CartridgeAgitatorContainer;exports.CartridgeAgitatorEvents=e.CartridgeAgitatorEvents;exports.CgpPump=e.CgpPump;exports.FREESTYLE_SERVICE=e.service$2;exports.FREESTYLE_SERVICE_1_6_5=e.service;exports.FREESTYLE_SERVICE_1_8_1=e.service$1;exports.FcmPump=e.FcmPump;exports.FreestyleAssembly=e.FreestyleAssembly;exports.FreestyleHolder=e.FreestyleHolder;exports.FreestyleNozzle=e.FreestyleNozzle;exports.FreestylePump=e.FreestylePump;exports.HANDLE_SERVICE=e.service$4;exports.HANDLE_SERVICE_1_8_1=e.service$3;exports.IceAgitator=e.IceAgitator;exports.IceAgitatorEvents=e.IceAgitatorEvents;exports.KosModelRegistry=e.KosModelRegistry;exports.LfcvPump=e.LfcvPump;exports.SpmPump=e.SpmPump;exports.registerFreestyleModels=e.registerFreestyleModels;exports.EXTENSION_PLUGIN_VISIBILITY=r.EXTENSION_PLUGIN_VISIBILITY;exports.FcmPumpServices=r.index;exports.FreestyleExtensionManager=r.FreestyleExtensionManager;exports.FreestyleNozzleServices=r.index$1;exports.FreestylePumpServices=r.index$2;exports.KosExtensionManager=r.KosExtensionManager;exports.LfcvPumpServices=r.index$3;exports.SpmPumpServices=r.index$4;
2
2
  //# sourceMappingURL=models.cjs.map
package/models.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as t, j as E, C as i, c as o, a as m, b as S, d as _, l as I, s as g, k as l, F as p, e as F, f as c, g as A, h as R, n, m as C, i as u, I as L, K as y, L as P, S as d, r as v } from "./service-Rmefh9Kc.js";
2
- import { E as N, i as V, F as b, a as f, b as x, K as z, c as K, d as M } from "./extension-utils-mrQ_wiPv.js";
1
+ import { A as t, j as E, C as i, c as o, a as m, b as S, d as _, l as I, s as g, k as l, F as p, e as F, f as c, g as A, h as R, n, m as C, i as u, I as L, K as y, L as P, S as d, r as v } from "./service-_jG-Kd3m.js";
2
+ import { E as N, i as V, F as b, a as f, b as x, K as z, c as K, d as M } from "./extension-utils-DP5eulYE.js";
3
3
  import "@kosdev-code/kos-ui-sdk";
4
4
  import "@kosdev-code/kos-dispense-sdk";
5
5
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-freestyle-sdk",
3
- "version": "0.1.0-dev.5170",
3
+ "version": "0.1.0-dev.5179",
4
4
  "type": "module",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./index.js",
@@ -23,15 +23,15 @@
23
23
  "./package.json": "./package.json"
24
24
  },
25
25
  "dependencies": {
26
- "@kosdev-code/kos-ui-sdk": "0.1.0-dev.5170",
27
- "@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5170"
26
+ "@kosdev-code/kos-ui-sdk": "0.1.0-dev.5179",
27
+ "@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5179"
28
28
  },
29
29
  "publishConfig": {
30
30
  "registry": "https://registry.npmjs.org/"
31
31
  },
32
32
  "kos": {
33
33
  "build": {
34
- "gitHash": "d43cb137cc7c4fa1e215474491d3c4119e2442f6"
34
+ "gitHash": "3cccaa001498c93157d1c1ba3d006f453b0c061a"
35
35
  }
36
36
  }
37
37
  }
@@ -1,2 +1,2 @@
1
- "use strict";var st=Object.defineProperty;var nt=(e,t,r)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var s=(e,t,r)=>(nt(e,typeof t!="symbol"?t+"":t,r),r);const o=require("@kosdev-code/kos-ui-sdk"),d=require("@kosdev-code/kos-dispense-sdk"),{URL:fe}=o.resolveServiceUrl("ICE_AGITATOR_SERVICE"),{postModel:lt}=o.ServiceFactory.build({basePath:`${fe}/api/ext/freestyle/ice`});o.KosLog.createLogger({name:"carb-tank-service",group:"Services"});const ut=async(e,t)=>{const r=await lt({model:{},tracker:t,urlOverride:`${fe}/api/handle/${e}/test`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data};var ye=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,dt=(e,t,r)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r,i)=>{for(var a=i>1?void 0:i?ct(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&ye(t,r,a),a},pt=(e,t,r)=>(dt(e,t+"",r),r);const gt="carb-agitator-model",oe=o.createPropKey("statePath");let h=class{constructor(e,t,r){s(this,"id");s(this,"name");s(this,"path");s(this,"statePath");s(this,"highProbeWet");s(this,"lowProbeWet");s(this,"filling");s(this,"enabled");var a;this.id=e,this.name=t.name,this.path=((a=r.kosContext.get("assembly-feature-carbTank"))==null?void 0:a.path)||"";const i=r.kosContext.get("assembly-state-path-carbTank");this.statePath=i}get holder(){var t;return(t=this.getCompanionParent())==null?void 0:t.getHoldersByGroup("carb")[0]}get pump(){var e;return(e=this.holder)==null?void 0:e.pumps.data[0]}get isFilling(){return!!this.filling.value}get isCarbInitialized(){return!!this.enabled.value}get canActivate(){return!this.enabled.value}get canProceed(){return this.isInState("INITIALIZED")||this.isInState("SKIPPED")}handleActivationStart(){this.logger.info("Carb tank activation started")}handleActivationComplete(){this.logger.info("Carb tank initialized")}handleInitialized(){this.logger.info("Carb tank ready to proceed")}handleSkipped(){this.logger.info("Proceeding without carbinator")}async activateCarbTank(){this.transition("ACTIVATE"),this.enabled.updateProperty(!0),this.transition("ACTIVATION_COMPLETE")}async deactivateCarbTank(){this.enabled.updateProperty(!1),this.transition("RESET")}skip(){this.transition("SKIP")}reset(){this.enabled.updateProperty(!1),this.transition("RESET")}toggleCarbTank(){this.enabled.value?this.deactivateCarbTank():this.activateCarbTank()}handleTestCarbTank(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`testing carb tank: ${this.id}`),ut(this.path,e)}};pt(h,"Registration");y([o.kosStateProp({path:oe,attribute:"highProbeWet"})],h.prototype,"highProbeWet",2);y([o.kosStateProp({path:oe,attribute:"lowProbeWet"})],h.prototype,"lowProbeWet",2);y([o.kosStateProp({path:oe,attribute:"filling"})],h.prototype,"filling",2);y([o.kosConfigProperty({path:"assembly:core:board:macksm:carbTank:carbTank",attribute:"enabled"})],h.prototype,"enabled",2);y([o.kosStateEntry("ACTIVATING")],h.prototype,"handleActivationStart",1);y([o.kosStateExit("ACTIVATING")],h.prototype,"handleActivationComplete",1);y([o.kosStateEntry("INITIALIZED")],h.prototype,"handleInitialized",1);y([o.kosStateEntry("SKIPPED")],h.prototype,"handleSkipped",1);y([o.kosStateGuard({allowedStates:["UNINITIALIZED"]})],h.prototype,"activateCarbTank",1);y([o.kosStateGuard({allowedStates:["UNINITIALIZED"]})],h.prototype,"skip",1);y([o.kosStateGuard({allowedStates:["INITIALIZED","SKIPPED"]})],h.prototype,"reset",1);y([o.kosFuture()],h.prototype,"handleTestCarbTank",1);h=y([o.kosModel({modelTypeId:gt,singleton:!1}),o.kosLoggerAware(),o.kosCompanion({mode:"composition",lifecycle:o.DependencyLifecycle.LOAD}),o.kosFutureAware(),o.kosStateMachine({initial:"UNINITIALIZED",states:{UNINITIALIZED:{on:{ACTIVATE:"ACTIVATING",SKIP:"SKIPPED"}},ACTIVATING:{on:{ACTIVATION_COMPLETE:"INITIALIZED"}},INITIALIZED:{on:{RESET:"UNINITIALIZED"}},SKIPPED:{on:{RESET:"UNINITIALIZED"}}}},{throwOnInvalid:!1})],h);const ae=h.Registration;var ht=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,me=(e,t,r,i)=>{for(var a=i>1?void 0:i?ft(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&ht(t,r,a),a};const Pe="cartridge-agitator-container-model";let L=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"_models");this.id=e,this.logger=r.logger,this._models=new o.KosModelContainer({parentId:e})}getModel(e){return this._models.getModel(e)}get models(){return this._models}get data(){return this._models.data}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}async init(){this.logger.debug(`initializing cartridge-agitator-container container ${this.id}`)}async load(){this.logger.debug(`loading cartridge-agitator-container container ${this.id}`)}};me([o.kosChild],L.prototype,"_models",2);L=me([o.kosModel(Pe)],L);const{URL:be}=o.resolveServiceUrl("CARTRIDGE_AGITATOR_SERVICE"),{postModel:yt}=o.ServiceFactory.build({basePath:`${be}/api/ext/freestyle/freestyle/ice`}),mt=async(e,t)=>{const r=await yt({model:{},tracker:t,urlOverride:`${be}/api/handle/${e}/test`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data};var Pt=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,U=(e,t,r,i)=>{for(var a=i>1?void 0:i?bt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Pt(t,r,a),a};const ve="cartridge-agitator-model";class O{}s(O,"TOPIC_AGITATION_STARTED","/kos/events/ddk/agitation-started"),s(O,"TOPIC_AGITATION_ENDED","/kos/events/ddk/agitation-ended");const vt=o.createPropKey("statePath");let I=class{constructor(e,t){s(this,"id");s(this,"agitating");s(this,"path");s(this,"statePath");s(this,"name");this.id=e,this.path=t.path,this.name=t.name,this.statePath=t.statePath}get isAgitating(){return!!this.agitating.value}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating cartridge-agitator ${this.id}`),mt(this.path,e)}handleAgitation(){var e;this.isAgitating?(this.logger.info(`agitating cartridge-agitator ${this.id}`),o.EventBus.publish(O.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.future)==null?void 0:e.futureId})):o.EventBus.publish(O.TOPIC_AGITATION_ENDED,{path:this.path})}};U([o.kosStateProp({path:vt,attribute:"agitating"})],I.prototype,"agitating",2);U([o.kosFuture()],I.prototype,"testAgitate",1);U([o.kosModelEffect({dependencies:e=>[e.isAgitating]})],I.prototype,"handleAgitation",1);I=U([o.kosModel(ve),o.kosFutureAware(),o.kosLoggerAware()],I);const ie=new o.KosModelRegistrationFactory({class:I,type:ve}),x=new o.SingletonKosModelRegistrationFactory({class:L,type:Pe});x.addRelatedModel(ie);var _e=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,Tt=(e,t,r)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,q=(e,t,r,i)=>{for(var a=i>1?void 0:i?_t(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&_e(t,r,a),a},St=(e,t,r)=>(Tt(e,t+"",r),r);const It="cgp-pump-model",se=o.createPropKey("statePath");let T=class{constructor(e,t){s(this,"highProbeWet");s(this,"lowProbeWet");s(this,"filling");s(this,"id");s(this,"state");var r;this.id=e,this.state=((r=t.data)==null?void 0:r.state)??{name:"unknown",path:""}}get statePath(){return this.state.path}};St(T,"Registration");q([o.kosStateProp({path:se,attribute:"highProbeWet"})],T.prototype,"highProbeWet",2);q([o.kosStateProp({path:se,attribute:"lowProbeWet"})],T.prototype,"lowProbeWet",2);q([o.kosStateProp({path:se,attribute:"filling"})],T.prototype,"filling",2);T=q([o.kosModel({modelTypeId:It,singleton:!1}),o.kosCompanion({mode:"composition"}),o.kosLoggerAware()],T);const Te=T.Registration,{URL:M}=o.resolveServiceUrl("FCM-PUMP_SERVICE"),{postModel:w}=o.ServiceFactory.build({basePath:`${M}/api/fcm-pump`}),f=o.KosLog.createLogger({name:"fcm-pump-service",group:"Services"}),Se=async e=>{var t,r,i,a,l;f.debug(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`);try{const n=await w({model:{},urlOverride:`${M}/api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`});return f.debug("performElectricalTest - response:",n),((n==null?void 0:n.status)===200||(n==null?void 0:n.status)===499)&&((t=n.data)!=null&&t.error)?[n.data.error||"unknownError",n.data]:[void 0,n==null?void 0:n.data]}catch(n){if(f.error(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`,n),n instanceof o.FetchError){const c=((i=(r=n.payload)==null?void 0:r.data)==null?void 0:i.error)||((a=n.payload)==null?void 0:a.error)||"unknownError";return[c,((l=n.payload)==null?void 0:l.data)||{error:c}]}}return["unknownError",{error:"unknownError"}]},Ie=async(e,t)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`);try{const r=await w({model:{},urlOverride:`${M}/api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,tracker:t});return f.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Ce=async(e,t)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`);try{const r=await w({model:{},urlOverride:`${M}/api/ext/freestyle/fcm/calibration/${e}/calibrate`,tracker:t});return f.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Ee=async(e,t,r)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`);try{const i=await w({model:{},urlOverride:`${M}/api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,tracker:r});return f.debug("performVerify - response:",i),i!=null&&i.data&&o.FutureManager.initiateFuture(i.data),i==null?void 0:i.data}catch(i){f.error(`performVerify - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,i);const a={id:r||"",endState:o.FutureEndState.Fail,tracker:r,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(a),a}},Ct=e=>e?e.data==="success"||!e.data?"success":e.data:"error",$e=async(e,t,r)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`);try{const i=await w({model:{},urlOverride:`${M}/api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`});return f.debug("performPreCalibrate - response:",i),Ct(i==null?void 0:i.data)}catch(i){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`,i);return}};var Et=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,G=(e,t,r,i)=>{for(var a=i>1?void 0:i?$t(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Et(t,r,a),a};const Me="fcm-pump-model",Mt=o.KosLog.createLogger({name:"fcm-pump-model"});let C=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pumpModel");s(this,"futureHandler");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent,this.futureHandler=new o.FutureHandler(this)}get future(){return this.futureHandler.future}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async performElectricalTest(){const[e,t]=await Se(this.pumpModel.path);return e&&Mt.error(`Failed to perform electrical test on pump ${this.id}`,e),t}getChildren(){return[...this.futureHandler.allFutures]}async performPreCalibrate(e){return Ie(this.pumpModel.path,e)}async performCalibrate(e){return Ce(this.pumpModel.path,e)}async performVerify(e,t){return Ee(this.pumpModel.path,e,t)}async performComplete(e,t){return $e(this.pumpModel.path,e,t)}async init(){this.logger.debug(`initializing fcm-pump ${this.id}`)}async load(){this.logger.debug(`loading fcm-pump ${this.id}`)}};G([o.kosFuture()],C.prototype,"performPreCalibrate",1);G([o.kosFuture()],C.prototype,"performCalibrate",1);G([o.kosFuture()],C.prototype,"performVerify",1);C=G([o.kosModel(Me)],C);const Oe=new o.KosModelRegistrationFactory({class:C,type:Me});var Ot=Object.defineProperty,At=Object.getOwnPropertyDescriptor,Ae=(e,t,r,i)=>{for(var a=i>1?void 0:i?At(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Ot(t,r,a),a};const Re="freestyle-assembly-model",we="iceAgitator",Rt="carbTank",wt="remoteTrays";let N=class{constructor(e,t,r){s(this,"id");s(this,"_carbTankModel");s(this,"logger");s(this,"assembly");s(this,"_remoteTrays");this.id=e,this.logger=r.logger,this.assembly=t.companionParent}get holderGroups(){return this.assembly.holderGroups}get nozzlePaths(){return this.assembly.nozzlePaths}get allHolders(){return this.assembly.allHolders}getHoldersByGroup(e){return this.assembly.getHoldersByGroup(e)}getHoldersByNozzle(e){return this.assembly.getHoldersByNozzle(e)}get pumpsByNozzle(){return this.assembly.pumpsByNozzle}get pumpPaths(){return this.assembly.pumpPaths}get boards(){return this.assembly.boards}updateModel(e){return this.assembly.updateModel(e)}get iceAgitator(){return this.assembly.iceAgitator}get carbTank(){return this._carbTankModel}get cartridgeAgitators(){return this.assembly.cartridgeAgitators}get defaultCartridgeAgitator(){return this.assembly.cartridgeAgitators.data[0]}get cartridgeAgitatorModels(){return this.assembly.cartridgeAgitators.data}get hasCartridgeAgitators(){return this.assembly.cartridgeAgitators.data.length>0}get remoteTrays(){return this.assembly.remoteTrays}get hasRemoteTrays(){return this.assembly.remoteTrays?this.assembly.remoteTrays.data.length>0:!1}get supportsRemoteTrays(){return o.KosFeatureFlags.isFeatureEnabled(wt)}get supportsIce(){return o.KosFeatureFlags.isFeatureEnabled(we)}get supportsCarb(){return o.KosFeatureFlags.isFeatureEnabled(Rt)}async init(){this.logger.debug(`initializing freestyle-assembly ${this.id}`)}async ready(){const e=o.getKosCompanionModel(this.assembly,ae.type);this._carbTankModel=e}};Ae([o.kosChild],N.prototype,"_remoteTrays",2);N=Ae([o.kosParentAware(),o.kosModel(Re)],N);const z=new o.SingletonKosModelRegistrationFactory({class:N,type:Re});var Ft=Object.defineProperty,Dt=Object.getOwnPropertyDescriptor,Fe=(e,t,r,i)=>{for(var a=i>1?void 0:i?Dt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Ft(t,r,a),a};const De="remote-tray-model";o.createPropKey("holderPath");const Lt=o.createPropKey("configPath");let k=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"holderPath");s(this,"configPath");s(this,"name");s(this,"remoteTrayEnabled");this.id=e,this.logger=r.logger,this.holderPath=t.holderPath,this.configPath=t.configPath,this.name=t.name}get troubles(){var e;return((e=this.holder)==null?void 0:e.troubles)??[]}get troubleStatus(){return""}get troublesByType(){var e;return((e=this.holder)==null?void 0:e.troublesByType)??{}}updateModel(e){}get holder(){return o.getKosModelSync(this.holderPath).model}get active(){return!!this.remoteTrayEnabled.value}async init(){this.logger.debug(`initializing remote-tray ${this.id}`)}async load(){this.logger.debug(`loading remote-tray ${this.id}`)}};Fe([o.kosConfigProperty({path:Lt,attribute:"enabled"})],k.prototype,"remoteTrayEnabled",2);k=Fe([o.kosModel(De)],k);const E=new o.KosModelRegistrationFactory({class:k,type:De});var Nt=Object.getOwnPropertyDescriptor,zt=(e,t,r,i)=>{for(var a=i>1?void 0:i?Nt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const Le="remote-tray-container-model";let W=class{constructor(e){s(this,"id");this.id=e}};W=zt([o.kosModel(Le),o.kosLoggerAware(),o.kosContainerAware()],W);const j=new o.SingletonKosModelRegistrationFactory({class:W,type:Le});j.addRelatedModel(E);var kt=Object.getOwnPropertyDescriptor,Kt=(e,t,r,i)=>{for(var a=i>1?void 0:i?kt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const Ne="freestyle-holder-model";function Ut(e){const t=o.KosContextManager.getContext(e),r=t==null?void 0:t.get(z.type);if(!r){o.KosLog.error("Freestyle assembly not found");return}return r}async function xt(e,t){if(!e||!t)return;const r=await e[t]();if(r!=null&&r.tracker)return o.FutureManager.getFuture(r.tracker)}let Z=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"holder");s(this,"context");s(this,"future");this.id=e,this.logger=r.logger,this.context=r.kosContext,this.holder=t.companionParent}get agitated(){return this.holder.data.agitated}async agitate(){if(!this.holder.data.agitated)return;this.future=void 0;const e=Ut(this.id);if(!e)return;if(!e.defaultCartridgeAgitator){this.logger.error("Agitator not found");return}return this.future=await xt(e.defaultCartridgeAgitator,"testAgitate"),this.future}get isRemote(){const e=`${E.type}-${this.holder.path}`,t=o.getKosModelSync(e);return t!=null&&t.model?!!t.model.remoteTrayEnabled.value:!1}async init(){this.logger.debug(`initializing freestyle-holder ${this.id}`)}async load(){this.logger.debug(`loading freestyle-holder ${this.id}`)}};Z=Kt([o.kosModel(Ne)],Z);const X=new o.KosModelRegistrationFactory({class:Z,type:Ne}),{URL:qt}=o.resolveServiceUrl("FREESTYLE-NOZZLE_SERVICE"),{getOne:Gt}=o.ServiceFactory.build({basePath:`${qt}/api/freestyle-nozzle`}),D=o.KosLog.createLogger({name:"freestyle-nozzle-service",group:"Services"});class ze extends Error{constructor(t){super(t),this.name="NutritionInfoError"}}class Q extends Error{constructor(t){super(t),this.name="InvalidRequestError"}}const ke=async(e,t,r,i="http://localhost:8081")=>{if(D.debug("sending GET for freestyle-nozzle"),!t)throw D.error("Invalid freestyle-nozzle request: beverageId is required"),new Q("No beverageId provided");if(!r||r.length===0)throw D.error("Invalid freestyle-nozzle request: volumes are required"),new Q("No volumes provided");const a=await Gt({urlOverride:`${i}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(",")}`});if(!(a!=null&&a.data))throw D.error("Failed to retrieve freestyle-nozzle data"),new Error("Failed to retrieve freestyle-nozzle data");if(a.data.error)throw new ze(a.data.error);return a.data};var jt=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Ke=(e,t,r,i)=>{for(var a=i>1?void 0:i?Vt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&jt(t,r,a),a};const Ue="freestyle-nozzle-model";let K=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"nozzleModel");s(this,"_cupSizes");s(this,"_nutritionInfo");this.id=e,this.logger=r.logger,this.nozzleModel=t.companionParent,this._cupSizes=[100]}set cupSizes(e){this._cupSizes=e}get nutritionInfo(){return this._nutritionInfo}get selectedPourable(){return this.nozzleModel.selectedPourable}async handleBeverageSelection(){if(this.nozzleModel.selectedPourable.beverage&&this._cupSizes.length){this.logger.debug(`selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`);const e=this.nozzleModel.selectedPourable.beverage.rawId,t=this.nozzleModel.urlPrefix;try{const r=await ke(t,e,this._cupSizes);o.kosAction(()=>{this._nutritionInfo=r})}catch(r){this.logger.error(`Error fetching nutrition info: ${r}`)}}}async init(){this.logger.debug(`initializing freestyle-nozzle ${this.id}`)}unload(){this.logger.debug(`unloading freestyle-nozzle ${this.id}`)}async load(){this.logger.debug(`loading freestyle-nozzle ${this.id}`)}};Ke([o.kosModelEffect({dependencies:e=>[e.selectedPourable.beverage]})],K.prototype,"handleBeverageSelection",1);K=Ke([o.kosParentAware(),o.kosModel(Ue)],K);const J=new o.KosModelRegistrationFactory({class:K,type:Ue}),{URL:xe}=o.resolveServiceUrl("PUMP_SERVICE"),{postModel:Bt}=o.ServiceFactory.build({basePath:`${xe}/api/ext/freestyle/microCalibration`}),Y=o.KosLog.createLogger({name:"freestyle-pump-service",group:"Services"}),qe=async(e,t)=>{var r,i,a,l,n;Y.debug(`replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`);try{const c=await Bt({model:{},urlOverride:`${xe}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`});return Y.debug("replacePump - response:",c),((c==null?void 0:c.status)===200||(c==null?void 0:c.status)===499)&&((r=c.data)!=null&&r.error)?[c.data.error||"unknownError",c.data]:[void 0,c==null?void 0:c.data]}catch(c){if(Y.error(`replacePump - sending POST request to /api/cal/${e}/code/${t}`,c),c instanceof o.FetchError){const v=((a=(i=c.payload)==null?void 0:i.data)==null?void 0:a.error)||((l=c.payload)==null?void 0:l.error)||"unknownError";return[v,((n=c.payload)==null?void 0:n.data)||{error:v}]}}return["unknownError",{error:"unknownError"}]};var Ht=Object.getOwnPropertyDescriptor,Yt=(e,t,r,i)=>{for(var a=i>1?void 0:i?Ht(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const Ge="freestyle-pump-model";let ee=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pump");this.id=e,this.logger=r.logger,this.pump=t.companionParent}async replacePump(e){const[t,r]=await qe(this.pump.path,e);return t&&this.logger.error(`Failed to replace the pump, ${this.pump.id}`,t),[t,r]}};ee=Yt([o.kosModel(Ge)],ee);const te=new o.KosModelRegistrationFactory({class:ee,type:Ge}),{URL:S}=o.resolveServiceUrl("ICE_AGITATOR_SERVICE"),{getAll:je,postModel:V}=o.ServiceFactory.build({basePath:`${S}/api/ext/freestyle/ice`}),Ve=o.KosLog.createLogger({name:"ice-agitator-service",group:"Services"}),Wt=async e=>(Ve.debug("sending GET for ice types"),await je({urlOverride:`${S}/api/handle/${e}/types`})),Zt=async(e,t)=>(Ve.debug("sending POST for ice types"),await V({urlOverride:`${S}/api/handle/${e}/type/${t}`,model:{}})),Xt=async e=>await je({urlOverride:`${S}/api/kos/config/details/${e}/4`}),Qt=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${S}/api/handle/${e}/pour`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},Jt=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${S}/api/handle/${e}/test/agitation`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},er=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${S}/api/handle/${e}/test/gate`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data};var tr=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,g=(e,t,r,i)=>{for(var a=i>1?void 0:i?rr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&tr(t,r,a),a};class A{}s(A,"TOPIC_AGITATION_STARTED","/kos/events/ddk/ice-agitation-started"),s(A,"TOPIC_AGITATION_ENDED","/kos/events/ddk/ice-agitation-ended");const Be="ice-agitator-model",He=o.createPropKey("statePath");let p=class{constructor(e,t,r){s(this,"id");s(this,"name");s(this,"path");s(this,"volWithoutIceMl");s(this,"durationSec");s(this,"enableIceChuteClear");s(this,"iceChuteClearDurationMs");s(this,"iceChuteClearIntervalSec");s(this,"iceChuteClearRetryIntervalSec");s(this,"maxDispenseSec");s(this,"type");s(this,"dilutionOffset");s(this,"inactivitySec");s(this,"agitating");s(this,"iceChuteOpen");s(this,"statePath");s(this,"_allIceTypes");s(this,"logger");s(this,"currentState",d.PourState.IDLE);s(this,"resetDefaultValues",async()=>await Xt(this.path));this.id=e,this.name=t.name,this.path=t.path,this.statePath=t.statePath,this._allIceTypes=[],this.logger=r.logger}get iceTypes(){return this._allIceTypes}get isAgitating(){return!!this.agitating.value}get isIceChuteOpen(){return!!this.iceChuteOpen.value}get isPouring(){var e;return!!(this.pourFuture&&!((e=this.pourFuture)!=null&&e.endState))||this.currentState===d.PourState.POUR_STARTING||this.currentState===d.PourState.POURING||this.currentState===d.PourState.POUR_CANCELING}get canPour(){return this.currentState===d.PourState.IDLE}updateIfCurrent(e,t){this.currentState===e&&o.kosAction(()=>{this.currentState=t})}async pourIce(e){try{if(this.currentState===d.PourState.IDLE){if(this.updateIfCurrent(d.PourState.IDLE,d.PourState.POUR_STARTING),!e)throw new Error("No tracker provided");const t=await Qt(this.path,e);return this.updateIfCurrent(d.PourState.POUR_STARTING,d.PourState.POURING),t!=null&&t.endState&&this.updateIfCurrent(d.PourState.POURING,d.PourState.IDLE),t}else throw new Error(`Cannot pour in state ${this.currentState}`)}catch(t){throw this.logger.error(t),this.currentState=d.PourState.IDLE,t}}async cancelIceDispense(){var e;this.currentState===d.PourState.POURING||this.currentState===d.PourState.POUR_STARTING?(this.currentState=d.PourState.POUR_CANCELING,await((e=this.pourFuture)==null?void 0:e.cancelFuture()),o.kosAction(()=>{this.currentState=d.PourState.IDLE})):this.logger.warn(`Cannot cancel ice dispense in state ${this.currentState}`)}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating ice-agitator ${this.id}`),Jt(this.path,e)}async testGate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`testing ice gate: ${this.id}`),er(this.path,e)}handleAgitationChange(){var e;this.isAgitating?(this.logger.info(`agitating ice-agitator ${this.id}`),o.EventBus.publish(A.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.futureHandler.future)==null?void 0:e.futureId})):o.EventBus.publish(A.TOPIC_AGITATION_ENDED,{path:this.path})}async updateIceType(e){await Zt(this.path,e)}async init(){this.logger.debug(`initializing ice-agitator ${this.id}`)}async load(){this.logger.debug(`loading ice-agitator ${this.id}`);const e=await Wt(this.path);(e==null?void 0:e.status)===200&&o.kosAction(()=>{this._allIceTypes=e.data||[]})}};g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.volWithoutIceMl"})],p.prototype,"volWithoutIceMl",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.durationSec",converter:{to:"second"}})],p.prototype,"durationSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"enableIceChuteClear"})],p.prototype,"enableIceChuteClear",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearDurationMs"})],p.prototype,"iceChuteClearDurationMs",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearIntervalSec"})],p.prototype,"iceChuteClearIntervalSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearRetryIntervalSec"})],p.prototype,"iceChuteClearRetryIntervalSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"maxDispenseSec"})],p.prototype,"maxDispenseSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"type"})],p.prototype,"type",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.dilutionOffset"})],p.prototype,"dilutionOffset",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.inactivitySec",converter:{to:"minute"}})],p.prototype,"inactivitySec",2);g([o.kosStateProp({path:He,attribute:"agitating"})],p.prototype,"agitating",2);g([o.kosStateProp({path:He,attribute:"iceChuteOpen"})],p.prototype,"iceChuteOpen",2);g([o.kosFuture({alias:"pour"})],p.prototype,"pourIce",1);g([o.kosFuture({alias:"agitate"})],p.prototype,"testAgitate",1);g([o.kosFuture({alias:"gate"})],p.prototype,"testGate",1);g([o.kosModelEffect({dependencies:e=>[e.isAgitating]})],p.prototype,"handleAgitationChange",1);p=g([o.kosModel(Be),o.kosMultipleFutureAware()],p);const ne=new o.KosModelRegistrationFactory({class:p,type:Be});var or=Object.getOwnPropertyDescriptor,ar=(e,t,r,i)=>{for(var a=i>1?void 0:i?or(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const Ye="lfcv-pump-model";let re=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pumpModel");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async init(){this.logger.debug(`initializing lfcv-pump ${this.id}`)}async load(){this.logger.debug(`loading lfcv-pump ${this.id}`)}};re=ar([o.kosModel(Ye)],re);const We=new o.KosModelRegistrationFactory({class:re,type:Ye}),{URL:ir}=o.resolveServiceUrl("LFCV-PUMP_SERVICE"),{getAll:sr}=o.ServiceFactory.build({basePath:`${ir}/api/lfcv-pump`}),nr=o.KosLog.createLogger({name:"lfcv-pump-service",group:"Services"}),lr=async()=>(nr.debug("sending GET for lfcv-pump"),await sr({})),{URL:F}=o.resolveServiceUrl("SPM-PUMP_SERVICE"),{postModel:B}=o.ServiceFactory.build({basePath:`${F}/api/spm-pump`}),P=o.KosLog.createLogger({name:"spm-pump-service",group:"Services"}),Ze=async(e,t)=>{P.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`);try{const r=await B({model:{},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,tracker:t});return P.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){P.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Xe=async(e,t)=>{P.debug(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`);try{const r=await B({model:{},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/calibrate`,tracker:t});return P.debug("performCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){P.error(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Qe=async(e,t,r,i)=>{P.debug(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`);try{const a=await B({model:{...r,measuredCalibrationVolume:t},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/verify`,tracker:i});return P.debug("performVerify - response:",a),a!=null&&a.data&&o.FutureManager.initiateFuture(a.data),a==null?void 0:a.data}catch(a){P.error(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`,a);const l={id:i||"",endState:o.FutureEndState.Fail,tracker:i,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(l),l}},Je=async(e,t,r,i)=>{var a,l,n,c,v;P.debug(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`);try{const u=await B({model:{...i,measuredCalibrationVolume:t,measuredVerificationVolume:r},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/complete`});return P.debug("performComplete - response:",u),((u==null?void 0:u.status)===200||(u==null?void 0:u.status)===499)&&((a=u.data)!=null&&a.error)?[u.data.error||"unknownError",u.data]:[void 0,u==null?void 0:u.data]}catch(u){if(P.error(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`,u),u instanceof o.FetchError){const m=((n=(l=u.payload)==null?void 0:l.data)==null?void 0:n.error)||((c=u.payload)==null?void 0:c.error)||"unknownError";return[m,((v=u.payload)==null?void 0:v.data)||{error:m}]}}return["unknownError",{error:"unknownError"}]};var ur=Object.defineProperty,cr=Object.getOwnPropertyDescriptor,H=(e,t,r,i)=>{for(var a=i>1?void 0:i?cr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&ur(t,r,a),a};const et="spm-pump-model";let $=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pump");s(this,"futureHandler");this.id=e,this.logger=r.logger,this.pump=t.companionParent,this.futureHandler=new o.FutureHandler(this)}get name(){return this.pump.name}get canPour(){return this.pump.canPour}get isPouring(){return this.pump.isPouring}async cancelPour(){return this.pump.cancelPour()}performIntent(e){return this.pump.performIntent(e)}get future(){return this.futureHandler.future}async performPreCalibrate(e){return Ze(this.pump.path,e)}async performCalibrate(e){return Xe(this.pump.path,e)}async performVerify(e,t,r){return Qe(this.pump.path,e,t,r)}async performComplete(e,t,r){return Je(this.pump.path,e,t,r)}async init(){this.logger.debug(`initializing spm-pump ${this.id}`)}async load(){this.logger.debug(`loading spm-pump ${this.id}`)}};H([o.kosFuture()],$.prototype,"performPreCalibrate",1);H([o.kosFuture()],$.prototype,"performCalibrate",1);H([o.kosFuture()],$.prototype,"performVerify",1);$=H([o.kosModel(et)],$);const tt=new o.KosModelRegistrationFactory({class:$,type:et});var dr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,le=(e,t,r,i)=>{for(var a=i>1?void 0:i?pr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&dr(t,r,a),a};const ue="agitation-required-trouble-model",gr=e=>{if(e.data.agitationRequired)return ue},rt="InsufficientAgitationTrouble";let R=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"trouble");s(this,"_deferred");s(this,"_holdersLoaded",!1);s(this,"agitateBeforePour");this.id=e,this.logger=r.logger,this._deferred=!1,this.trouble=t.companionParent}async resolve(){return this.trouble.resolve()}get holder(){const e=this.trouble.data.holderPaths[0],t=o.getKosModelSync(e);if(!(!this._holdersLoaded&&!t.model))return t==null?void 0:t.model}updateHolder(){if(!this._holdersLoaded){const e=this.trouble.data.holderPaths[0];o.getKosModelSync(e).model&&(this._holdersLoaded=!0)}}get shouldDefer(){var i,a;if(!this.holder)return!0;const t=(((i=this.holder)==null?void 0:i.troublesByType[rt])||[]).length>0;return!!((a=this.agitateBeforePour)!=null&&a.value)&&t}get deferred(){return this._deferred}defer(){this._deferred=!0}clearDefer(){this._deferred=!1}};le([o.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.agitateBeforePour"})],R.prototype,"agitateBeforePour",2);le([o.kosTopicHandler({topic:o.modelTypeEventTopicFactory(d.Assembly.type),lifecycle:o.DependencyLifecycle.INIT})],R.prototype,"updateHolder",1);R=le([o.kosModel(ue)],R);const ot=new o.KosModelRegistrationFactory({class:R,type:ue}),hr=["iceAgitator"],fr={iceAgitator:ne.factory},yr=o.KosLog.createLogger({name:"freestyle-assembly-data-mapper"}),mr=async e=>{const t=x.instance().options({}).build(),r=j.instance().options({}).build(),i=e.assemblies.reduce((n,c)=>{var v;return hr.forEach(u=>{var _;const m=c[u];if(m){const it=fr[u](m.path);n[u]=it({name:m.name,path:m.path,statePath:((_=m.state)==null?void 0:_.path)||""})}}),(v=c.cartridgeAgitators)==null||v.forEach(u=>{var _;const m=ie.instance(u.path).options({name:u.name,path:u.path,statePath:((_=u.state)==null?void 0:_.path)||""}).build();t.addModel(m)}),c.remoteTrays&&c.remoteTrays.forEach(u=>{yr.info(`Found remote tray ${u.name} with path ${u.path}`);const m=`${E.type}-${u.holderPath}`,_=E.instance(m).options({holderPath:u.holderPath,configPath:u.path,name:u.name}).build();r.addModel(_)}),n},{}),a=!!i.iceAgitator,l=!!i.carbTank;return{...i,cartridgeAgitators:t,remoteTrays:r,supportsCarb:l,supportsIce:a}},at=e=>()=>(o.registerCoreModels(e)(),d.registerDispenseModels(e)(),J.register(),z.register(),ne.register(),ae.register(),x.register(),tt.register(),Oe.register(),We.register(),Te.register(),te.register(),X.register(),E.register(),j.register(),o.RegistrationManager.companion.register(e)(d.Nozzle.type,J.type),o.RegistrationManager.companion.register(e)(d.Assembly.type,z.type),ot.register(),o.RegistrationManager.companion.register(e)(o.Trouble.type,gr),o.RegistrationManager.companion.register(e)(d.Pump.type,te.type),o.RegistrationManager.companion.register(e)(d.Holder.type,X.type),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("EnjoyByTrouble",async t=>{if(t.data.enjoyByDate){const r=new Date(t.data.enjoyByDate);return{enjoyByDays:Math.floor((new Date().getTime()-r.getTime())/(1e3*60*60*24))||""}}return{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("SuperPumpRequiredTrouble",async t=>{const{model:r}=o.getKosModelSync(d.PumpContainer.type);return r?{superPumps:r.models.getIndexByKey(d.PumpIndex.byType,"microSuper").map(l=>l.name).join(", ")}:{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("MicroPumpAirDetectTrouble",async t=>{if(t.ifaces.includes("container"))return{};if(t.data.pumpPath){const{model:r}=o.getKosModelSync(t.data.pumpPath);if(r){const i=r.ingredientId?o.getKosModelSync(r.ingredientId).model:void 0;return{ingredientId:r.ingredientId,ingredientName:(i==null?void 0:i.name)||""}}}return{}}),{preload:o.RegistrationManager.model.preloadModel(e),model:o.RegistrationManager.model.register(e),companion:o.RegistrationManager.companion.register(e),legacy:o.RegistrationManager.model.registerLegacyModel(e)}),b={...d.KosModelRegistry};b.freestyle={models:at(b)};b.preload=o.RegistrationManager.model.preloadModel(b);b.model=o.RegistrationManager.model.register(b);b.companion=o.RegistrationManager.companion.register(b);b.legacy=o.RegistrationManager.model.registerLegacyModel(b);const Pr=b;function br(e){return o.kosServiceRequest(e)}const ce=o.createClient(),vr=Object.freeze(Object.defineProperty({__proto__:null,api:ce,default:ce,kosServiceRequest:br},Symbol.toStringTag,{value:"Module"}));function _r(e){return o.kosServiceRequest(e)}const de=o.createClient(),Tr=Object.freeze(Object.defineProperty({__proto__:null,api:de,default:de,kosServiceRequest:_r},Symbol.toStringTag,{value:"Module"}));function Sr(e){return o.kosServiceRequest(e)}const pe=o.createClient(),Ir=Object.freeze(Object.defineProperty({__proto__:null,api:pe,default:pe,kosServiceRequest:Sr},Symbol.toStringTag,{value:"Module"}));function Cr(e){return o.kosServiceRequest(e)}const ge=o.createClient(),Er=Object.freeze(Object.defineProperty({__proto__:null,api:ge,default:ge,kosServiceRequest:Cr},Symbol.toStringTag,{value:"Module"}));function $r(e){return o.kosServiceRequest(e)}const he=o.createClient(),Mr=Object.freeze(Object.defineProperty({__proto__:null,api:he,default:he,kosServiceRequest:$r},Symbol.toStringTag,{value:"Module"}));exports.AGITATION_REQUIRED_TROUBLE=rt;exports.AgitationRequiredTrouble=ot;exports.CarbAgitator=ae;exports.CartridgeAgitator=ie;exports.CartridgeAgitatorContainer=x;exports.CartridgeAgitatorEvents=O;exports.CgpPump=Te;exports.FEATURE_SUPPORTS_ICE=we;exports.FcmPump=Oe;exports.FreestyleAssembly=z;exports.FreestyleHolder=X;exports.FreestyleNozzle=J;exports.FreestylePump=te;exports.IceAgitator=ne;exports.IceAgitatorEvents=A;exports.InvalidRequestError=Q;exports.KosModelRegistry=Pr;exports.LfcvPump=We;exports.NutritionInfoError=ze;exports.RemoteTray=E;exports.RemoteTrayContainer=j;exports.SpmPump=tt;exports.freestyleAssemblyDataMapper=mr;exports.getFreestyleNutritionInfo=ke;exports.getLfcvPumps=lr;exports.performCalibrate=Ce;exports.performCalibrate$1=Xe;exports.performComplete=$e;exports.performComplete$1=Je;exports.performElectricalTest=Se;exports.performPreCalibrate=Ie;exports.performPreCalibrate$1=Ze;exports.performVerify=Ee;exports.performVerify$1=Qe;exports.registerFreestyleModels=at;exports.replacePump=qe;exports.service=vr;exports.service$1=Tr;exports.service$2=Ir;exports.service$3=Er;exports.service$4=Mr;
2
- //# sourceMappingURL=service-DrOwtgpN.cjs.map
1
+ "use strict";var nt=Object.defineProperty;var lt=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var s=(e,t,r)=>(lt(e,typeof t!="symbol"?t+"":t,r),r);const o=require("@kosdev-code/kos-ui-sdk"),d=require("@kosdev-code/kos-dispense-sdk"),{URL:he}=o.resolveServiceUrl("ICE_AGITATOR_SERVICE"),{postModel:ut}=o.ServiceFactory.build({basePath:`${he}/api/ext/freestyle/ice`});o.KosLog.createLogger({name:"carb-tank-service",group:"Services"});const ct=async(e,t)=>{const r=await ut({model:{},tracker:t,urlOverride:`${he}/api/handle/${e}/test`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data};var fe=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,pt=(e,t,r)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r,i)=>{for(var a=i>1?void 0:i?dt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&fe(t,r,a),a},gt=(e,t,r)=>(pt(e,t+"",r),r);const ht="carb-agitator-model",oe=o.createPropKey("statePath");let h=class{constructor(e,t,r){s(this,"id");s(this,"name");s(this,"path");s(this,"statePath");s(this,"highProbeWet");s(this,"lowProbeWet");s(this,"filling");s(this,"enabled");var a;this.id=e,this.name=t.name,this.path=((a=r.kosContext.get("assembly-feature-carbTank"))==null?void 0:a.path)||"";const i=r.kosContext.get("assembly-state-path-carbTank");this.statePath=i}get holder(){var t;return(t=this.getCompanionParent())==null?void 0:t.getHoldersByGroup("carb")[0]}get pump(){var e;return(e=this.holder)==null?void 0:e.pumps.data[0]}get isFilling(){return!!this.filling.value}get isCarbInitialized(){return!!this.enabled.value}get canActivate(){return!this.enabled.value}get canProceed(){return this.isInState("INITIALIZED")||this.isInState("SKIPPED")}handleActivationStart(){this.logger.info("Carb tank activation started")}handleActivationComplete(){this.logger.info("Carb tank initialized")}handleInitialized(){this.logger.info("Carb tank ready to proceed")}handleSkipped(){this.logger.info("Proceeding without carbinator")}async activateCarbTank(){this.transition("ACTIVATE"),this.enabled.updateProperty(!0),this.transition("ACTIVATION_COMPLETE")}async deactivateCarbTank(){this.enabled.updateProperty(!1),this.transition("RESET")}skip(){this.transition("SKIP")}reset(){this.enabled.updateProperty(!1),this.transition("RESET")}toggleCarbTank(){this.enabled.value?this.deactivateCarbTank():this.activateCarbTank()}handleTestCarbTank(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`testing carb tank: ${this.id}`),ct(this.path,e)}};gt(h,"Registration");y([o.kosStateProp({path:oe,attribute:"highProbeWet"})],h.prototype,"highProbeWet",2);y([o.kosStateProp({path:oe,attribute:"lowProbeWet"})],h.prototype,"lowProbeWet",2);y([o.kosStateProp({path:oe,attribute:"filling"})],h.prototype,"filling",2);y([o.kosConfigProperty({path:"assembly:core:board:macksm:carbTank:carbTank",attribute:"enabled"})],h.prototype,"enabled",2);y([o.kosStateEntry("ACTIVATING")],h.prototype,"handleActivationStart",1);y([o.kosStateExit("ACTIVATING")],h.prototype,"handleActivationComplete",1);y([o.kosStateEntry("INITIALIZED")],h.prototype,"handleInitialized",1);y([o.kosStateEntry("SKIPPED")],h.prototype,"handleSkipped",1);y([o.kosStateGuard({allowedStates:["UNINITIALIZED"]})],h.prototype,"activateCarbTank",1);y([o.kosStateGuard({allowedStates:["UNINITIALIZED"]})],h.prototype,"skip",1);y([o.kosStateGuard({allowedStates:["INITIALIZED","SKIPPED"]})],h.prototype,"reset",1);y([o.kosFuture()],h.prototype,"handleTestCarbTank",1);h=y([o.kosModel({modelTypeId:ht,singleton:!1}),o.kosLoggerAware(),o.kosCompanion({mode:"composition",lifecycle:o.DependencyLifecycle.LOAD}),o.kosFutureAware(),o.kosStateMachine({initial:"UNINITIALIZED",states:{UNINITIALIZED:{on:{ACTIVATE:"ACTIVATING",SKIP:"SKIPPED"}},ACTIVATING:{on:{ACTIVATION_COMPLETE:"INITIALIZED"}},INITIALIZED:{on:{RESET:"UNINITIALIZED"}},SKIPPED:{on:{RESET:"UNINITIALIZED"}}}},{throwOnInvalid:!1})],h);const ae=h.Registration;var ft=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,ye=(e,t,r,i)=>{for(var a=i>1?void 0:i?yt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&ft(t,r,a),a};const me="cartridge-agitator-container-model";let L=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"_models");this.id=e,this.logger=r.logger,this._models=new o.KosModelContainer({parentId:e})}getModel(e){return this._models.getModel(e)}get models(){return this._models}get data(){return this._models.data}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}async init(){this.logger.debug(`initializing cartridge-agitator-container container ${this.id}`)}async load(){this.logger.debug(`loading cartridge-agitator-container container ${this.id}`)}};ye([o.kosChild],L.prototype,"_models",2);L=ye([o.kosModel(me)],L);const{URL:Pe}=o.resolveServiceUrl("CARTRIDGE_AGITATOR_SERVICE"),{postModel:mt}=o.ServiceFactory.build({basePath:`${Pe}/api/ext/freestyle/freestyle/ice`}),Pt=async(e,t)=>{const r=await mt({model:{},tracker:t,urlOverride:`${Pe}/api/handle/${e}/test`});if(!(r!=null&&r.data))throw new Error("No response from server");return r.data};var bt=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,U=(e,t,r,i)=>{for(var a=i>1?void 0:i?vt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&bt(t,r,a),a};const be="cartridge-agitator-model";class A{}s(A,"TOPIC_AGITATION_STARTED","/kos/events/ddk/agitation-started"),s(A,"TOPIC_AGITATION_ENDED","/kos/events/ddk/agitation-ended");const _t=o.createPropKey("statePath");let S=class{constructor(e,t){s(this,"id");s(this,"agitating");s(this,"path");s(this,"statePath");s(this,"name");this.id=e,this.path=t.path,this.name=t.name,this.statePath=t.statePath}get isAgitating(){return!!this.agitating.value}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating cartridge-agitator ${this.id}`),Pt(this.path,e)}handleAgitation(){var e;this.isAgitating?(this.logger.info(`agitating cartridge-agitator ${this.id}`),o.EventBus.publish(A.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.future)==null?void 0:e.futureId})):o.EventBus.publish(A.TOPIC_AGITATION_ENDED,{path:this.path})}};U([o.kosStateProp({path:_t,attribute:"agitating"})],S.prototype,"agitating",2);U([o.kosFuture()],S.prototype,"testAgitate",1);U([o.kosModelEffect({dependencies:e=>[e.isAgitating]})],S.prototype,"handleAgitation",1);S=U([o.kosModel(be),o.kosFutureAware(),o.kosLoggerAware()],S);const ie=new o.KosModelRegistrationFactory({class:S,type:be}),x=new o.SingletonKosModelRegistrationFactory({class:L,type:me});x.addRelatedModel(ie);var ve=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,It=(e,t,r)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,q=(e,t,r,i)=>{for(var a=i>1?void 0:i?Tt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&ve(t,r,a),a},St=(e,t,r)=>(It(e,t+"",r),r);const Ct="cgp-pump-model",se=o.createPropKey("statePath");let T=class{constructor(e,t){s(this,"highProbeWet");s(this,"lowProbeWet");s(this,"filling");s(this,"id");s(this,"state");var r;this.id=e,this.state=((r=t.data)==null?void 0:r.state)??{name:"unknown",path:""}}get statePath(){return this.state.path}};St(T,"Registration");q([o.kosStateProp({path:se,attribute:"highProbeWet"})],T.prototype,"highProbeWet",2);q([o.kosStateProp({path:se,attribute:"lowProbeWet"})],T.prototype,"lowProbeWet",2);q([o.kosStateProp({path:se,attribute:"filling"})],T.prototype,"filling",2);T=q([o.kosModel({modelTypeId:Ct,singleton:!1}),o.kosCompanion({mode:"composition"}),o.kosLoggerAware()],T);const _e=T.Registration,{URL:O}=o.resolveServiceUrl("FCM-PUMP_SERVICE"),{postModel:w}=o.ServiceFactory.build({basePath:`${O}/api/fcm-pump`}),f=o.KosLog.createLogger({name:"fcm-pump-service",group:"Services"}),Te=async e=>{var t,r,i,a,l;f.debug(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`);try{const n=await w({model:{},urlOverride:`${O}/api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`});return f.debug("performElectricalTest - response:",n),((n==null?void 0:n.status)===200||(n==null?void 0:n.status)===499)&&((t=n.data)!=null&&t.error)?[n.data.error||"unknownError",n.data]:[void 0,n==null?void 0:n.data]}catch(n){if(f.error(`performElectricalTest - sending POST request to /api/ext/freestyle/fcm/diagnostics/${e}/electricalTest`,n),n instanceof o.FetchError){const c=((i=(r=n.payload)==null?void 0:r.data)==null?void 0:i.error)||((a=n.payload)==null?void 0:a.error)||"unknownError";return[c,((l=n.payload)==null?void 0:l.data)||{error:c}]}}return["unknownError",{error:"unknownError"}]},Ie=async(e,t)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`);try{const r=await w({model:{},urlOverride:`${O}/api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,tracker:t});return f.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/preCalibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Se=async(e,t)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`);try{const r=await w({model:{},urlOverride:`${O}/api/ext/freestyle/fcm/calibration/${e}/calibrate`,tracker:t});return f.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/calibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Ce=async(e,t,r)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`);try{const i=await w({model:{},urlOverride:`${O}/api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,tracker:r});return f.debug("performVerify - response:",i),i!=null&&i.data&&o.FutureManager.initiateFuture(i.data),i==null?void 0:i.data}catch(i){f.error(`performVerify - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/verify/${t}`,i);const a={id:r||"",endState:o.FutureEndState.Fail,tracker:r,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(a),a}},Et=e=>e?e.data==="success"||!e.data?"success":e.data:"error",Ee=async(e,t,r)=>{f.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`);try{const i=await w({model:{},urlOverride:`${O}/api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`});return f.debug("performPreCalibrate - response:",i),Et(i==null?void 0:i.data)}catch(i){f.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/fcm/calibration/${e}/complete/${t}/${r}`,i);return}};var $t=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,G=(e,t,r,i)=>{for(var a=i>1?void 0:i?Mt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&$t(t,r,a),a};const $e="fcm-pump-model",Ot=o.KosLog.createLogger({name:"fcm-pump-model"});let C=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pumpModel");s(this,"futureHandler");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent,this.futureHandler=new o.FutureHandler(this)}get future(){return this.futureHandler.future}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async performElectricalTest(){const[e,t]=await Te(this.pumpModel.path);return e&&Ot.error(`Failed to perform electrical test on pump ${this.id}`,e),t}getChildren(){return[...this.futureHandler.allFutures]}async performPreCalibrate(e){return Ie(this.pumpModel.path,e)}async performCalibrate(e){return Se(this.pumpModel.path,e)}async performVerify(e,t){return Ce(this.pumpModel.path,e,t)}async performComplete(e,t){return Ee(this.pumpModel.path,e,t)}async init(){this.logger.debug(`initializing fcm-pump ${this.id}`)}async load(){this.logger.debug(`loading fcm-pump ${this.id}`)}};G([o.kosFuture()],C.prototype,"performPreCalibrate",1);G([o.kosFuture()],C.prototype,"performCalibrate",1);G([o.kosFuture()],C.prototype,"performVerify",1);C=G([o.kosModel($e)],C);const Me=new o.KosModelRegistrationFactory({class:C,type:$e});var At=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,Oe=(e,t,r,i)=>{for(var a=i>1?void 0:i?Rt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&At(t,r,a),a};const Ae="freestyle-assembly-model",Re="iceAgitator",wt="carbTank",Ft="remoteTrays";let N=class{constructor(e,t,r){s(this,"id");s(this,"_carbTankModel");s(this,"logger");s(this,"assembly");s(this,"_remoteTrays");this.id=e,this.logger=r.logger,this.assembly=t.companionParent}get holderGroups(){return this.assembly.holderGroups}get nozzlePaths(){return this.assembly.nozzlePaths}get allHolders(){return this.assembly.allHolders}getHoldersByGroup(e){return this.assembly.getHoldersByGroup(e)}getHoldersByNozzle(e){return this.assembly.getHoldersByNozzle(e)}get pumpsByNozzle(){return this.assembly.pumpsByNozzle}get pumpPaths(){return this.assembly.pumpPaths}get boards(){return this.assembly.boards}updateModel(e){return this.assembly.updateModel(e)}get iceAgitator(){return this.assembly.iceAgitator}get carbTank(){return this._carbTankModel}get cartridgeAgitators(){return this.assembly.cartridgeAgitators}get defaultCartridgeAgitator(){return this.assembly.cartridgeAgitators.data[0]}get cartridgeAgitatorModels(){return this.assembly.cartridgeAgitators.data}get hasCartridgeAgitators(){return this.assembly.cartridgeAgitators.data.length>0}get remoteTrays(){return this.assembly.remoteTrays}get hasRemoteTrays(){return this.assembly.remoteTrays?this.assembly.remoteTrays.data.length>0:!1}get supportsRemoteTrays(){return o.KosFeatureFlags.isFeatureEnabled(Ft)}get supportsIce(){return o.KosFeatureFlags.isFeatureEnabled(Re)}get supportsCarb(){return o.KosFeatureFlags.isFeatureEnabled(wt)}async init(){this.logger.debug(`initializing freestyle-assembly ${this.id}`)}async ready(){const e=o.getKosCompanionModel(this.assembly,ae.type);this._carbTankModel=e}};Oe([o.kosChild],N.prototype,"_remoteTrays",2);N=Oe([o.kosParentAware(),o.kosModel(Ae)],N);const z=new o.SingletonKosModelRegistrationFactory({class:N,type:Ae});var Dt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,we=(e,t,r,i)=>{for(var a=i>1?void 0:i?Lt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Dt(t,r,a),a};const Fe="remote-tray-model";o.createPropKey("holderPath");const Nt=o.createPropKey("configPath");let k=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"holderPath");s(this,"configPath");s(this,"name");s(this,"remoteTrayEnabled");this.id=e,this.logger=r.logger,this.holderPath=t.holderPath,this.configPath=t.configPath,this.name=t.name}get troubles(){var e;return((e=this.holder)==null?void 0:e.troubles)??[]}get troubleStatus(){return""}get troublesByType(){var e;return((e=this.holder)==null?void 0:e.troublesByType)??{}}updateModel(e){}get holder(){return o.getKosModelSync(this.holderPath).model}get active(){return!!this.remoteTrayEnabled.value}async init(){this.logger.debug(`initializing remote-tray ${this.id}`)}async load(){this.logger.debug(`loading remote-tray ${this.id}`)}};we([o.kosConfigProperty({path:Nt,attribute:"enabled"})],k.prototype,"remoteTrayEnabled",2);k=we([o.kosModel(Fe)],k);const E=new o.KosModelRegistrationFactory({class:k,type:Fe});var zt=Object.getOwnPropertyDescriptor,kt=(e,t,r,i)=>{for(var a=i>1?void 0:i?zt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const De="remote-tray-container-model";let W=class{constructor(e){s(this,"id");this.id=e}};W=kt([o.kosModel(De),o.kosLoggerAware(),o.kosContainerAware()],W);const j=new o.SingletonKosModelRegistrationFactory({class:W,type:De});j.addRelatedModel(E);var Kt=Object.getOwnPropertyDescriptor,Ut=(e,t,r,i)=>{for(var a=i>1?void 0:i?Kt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const Le="freestyle-holder-model";function xt(e){const t=o.KosContextManager.getContext(e),r=t==null?void 0:t.get(z.type);if(!r){o.KosLog.error("Freestyle assembly not found");return}return r}async function qt(e,t){if(!e||!t)return;const r=await e[t]();if(r!=null&&r.tracker)return o.FutureManager.getFuture(r.tracker)}let Z=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"holder");s(this,"context");s(this,"future");this.id=e,this.logger=r.logger,this.context=r.kosContext,this.holder=t.companionParent}get agitated(){return this.holder.data.agitated}async agitate(){if(!this.holder.data.agitated)return;this.future=void 0;const e=xt(this.id);if(!e)return;if(!e.defaultCartridgeAgitator){this.logger.error("Agitator not found");return}return this.future=await qt(e.defaultCartridgeAgitator,"testAgitate"),this.future}get isRemote(){const e=`${E.type}-${this.holder.path}`,t=o.getKosModelSync(e);return t!=null&&t.model?!!t.model.remoteTrayEnabled.value:!1}async init(){this.logger.debug(`initializing freestyle-holder ${this.id}`)}async load(){this.logger.debug(`loading freestyle-holder ${this.id}`)}};Z=Ut([o.kosModel(Le)],Z);const X=new o.KosModelRegistrationFactory({class:Z,type:Le}),{URL:Gt}=o.resolveServiceUrl("FREESTYLE-NOZZLE_SERVICE"),{getOne:jt}=o.ServiceFactory.build({basePath:`${Gt}/api/freestyle-nozzle`}),D=o.KosLog.createLogger({name:"freestyle-nozzle-service",group:"Services"});class Ne extends Error{constructor(t){super(t),this.name="NutritionInfoError"}}class Q extends Error{constructor(t){super(t),this.name="InvalidRequestError"}}const ze=async(e,t,r,i="http://localhost:8081")=>{if(D.debug("sending GET for freestyle-nozzle"),!t)throw D.error("Invalid freestyle-nozzle request: beverageId is required"),new Q("No beverageId provided");if(!r||r.length===0)throw D.error("Invalid freestyle-nozzle request: volumes are required"),new Q("No volumes provided");const a=await jt({urlOverride:`${i}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(",")}`});if(!(a!=null&&a.data))throw D.error("Failed to retrieve freestyle-nozzle data"),new Error("Failed to retrieve freestyle-nozzle data");if(a.data.error)throw new Ne(a.data.error);return a.data};var Vt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,ke=(e,t,r,i)=>{for(var a=i>1?void 0:i?Bt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&Vt(t,r,a),a};const Ke="freestyle-nozzle-model";let K=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"nozzleModel");s(this,"_cupSizes");s(this,"_nutritionInfo");this.id=e,this.logger=r.logger,this.nozzleModel=t.companionParent,this._cupSizes=[100]}set cupSizes(e){this._cupSizes=e}get nutritionInfo(){return this._nutritionInfo}get selectedPourable(){return this.nozzleModel.selectedPourable}async handleBeverageSelection(){if(this.nozzleModel.selectedPourable.beverage&&this._cupSizes.length){this.logger.debug(`selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`);const e=this.nozzleModel.selectedPourable.beverage.rawId,t=this.nozzleModel.urlPrefix;try{const r=await ze(t,e,this._cupSizes);o.kosAction(()=>{this._nutritionInfo=r})}catch(r){this.logger.error(`Error fetching nutrition info: ${r}`)}}}async init(){this.logger.debug(`initializing freestyle-nozzle ${this.id}`)}unload(){this.logger.debug(`unloading freestyle-nozzle ${this.id}`)}async load(){this.logger.debug(`loading freestyle-nozzle ${this.id}`)}};ke([o.kosModelEffect({dependencies:e=>[e.selectedPourable.beverage]})],K.prototype,"handleBeverageSelection",1);K=ke([o.kosParentAware(),o.kosModel(Ke)],K);const J=new o.KosModelRegistrationFactory({class:K,type:Ke}),{URL:Ue}=o.resolveServiceUrl("PUMP_SERVICE"),{postModel:Ht}=o.ServiceFactory.build({basePath:`${Ue}/api/ext/freestyle/microCalibration`}),Y=o.KosLog.createLogger({name:"freestyle-pump-service",group:"Services"}),xe=async(e,t)=>{var r,i,a,l,n;Y.debug(`replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`);try{const c=await Ht({model:{},urlOverride:`${Ue}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`});return Y.debug("replacePump - response:",c),((c==null?void 0:c.status)===200||(c==null?void 0:c.status)===499)&&((r=c.data)!=null&&r.error)?[c.data.error||"unknownError",c.data]:[void 0,c==null?void 0:c.data]}catch(c){if(Y.error(`replacePump - sending POST request to /api/cal/${e}/code/${t}`,c),c instanceof o.FetchError){const v=((a=(i=c.payload)==null?void 0:i.data)==null?void 0:a.error)||((l=c.payload)==null?void 0:l.error)||"unknownError";return[v,((n=c.payload)==null?void 0:n.data)||{error:v}]}}return["unknownError",{error:"unknownError"}]};var Yt=Object.getOwnPropertyDescriptor,Wt=(e,t,r,i)=>{for(var a=i>1?void 0:i?Yt(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const qe="freestyle-pump-model";let ee=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pump");this.id=e,this.logger=r.logger,this.pump=t.companionParent}async replacePump(e){const[t,r]=await xe(this.pump.path,e);return t&&this.logger.error(`Failed to replace the pump, ${this.pump.id}`,t),[t,r]}};ee=Wt([o.kosModel(qe)],ee);const te=new o.KosModelRegistrationFactory({class:ee,type:qe}),{URL:I}=o.resolveServiceUrl("ICE_AGITATOR_SERVICE"),{getAll:Ge,postModel:V}=o.ServiceFactory.build({basePath:`${I}/api/ext/freestyle/ice`}),je=o.KosLog.createLogger({name:"ice-agitator-service",group:"Services"}),Zt=async e=>(je.debug("sending GET for ice types"),await Ge({urlOverride:`${I}/api/handle/${e}/types`})),Xt=async(e,t)=>(je.debug("sending POST for ice types"),await V({urlOverride:`${I}/api/handle/${e}/type/${t}`,model:{}})),Qt=async e=>await Ge({urlOverride:`${I}/api/kos/config/details/${e}/4`}),Jt=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${I}/api/handle/${e}/pour`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},er=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${I}/api/handle/${e}/test/agitation`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data},tr=async(e,t)=>{const r=await V({model:{},tracker:t,urlOverride:`${I}/api/handle/${e}/test/gate`});if(!(r!=null&&r.data))throw new Error("No response from server");return r==null?void 0:r.data};var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,g=(e,t,r,i)=>{for(var a=i>1?void 0:i?or(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&rr(t,r,a),a};class R{}s(R,"TOPIC_AGITATION_STARTED","/kos/events/ddk/ice-agitation-started"),s(R,"TOPIC_AGITATION_ENDED","/kos/events/ddk/ice-agitation-ended");const Ve="ice-agitator-model",Be=o.createPropKey("statePath");let p=class{constructor(e,t,r){s(this,"id");s(this,"name");s(this,"path");s(this,"volWithoutIceMl");s(this,"durationSec");s(this,"enableIceChuteClear");s(this,"iceChuteClearDurationMs");s(this,"iceChuteClearIntervalSec");s(this,"iceChuteClearRetryIntervalSec");s(this,"maxDispenseSec");s(this,"type");s(this,"dilutionOffset");s(this,"inactivitySec");s(this,"agitating");s(this,"iceChuteOpen");s(this,"statePath");s(this,"_allIceTypes");s(this,"logger");s(this,"currentState",d.PourState.IDLE);s(this,"resetDefaultValues",async()=>await Qt(this.path));this.id=e,this.name=t.name,this.path=t.path,this.statePath=t.statePath,this._allIceTypes=[],this.logger=r.logger}get iceTypes(){return this._allIceTypes}get isAgitating(){return!!this.agitating.value}get isIceChuteOpen(){return!!this.iceChuteOpen.value}get isPouring(){var e;return!!(this.pourFuture&&!((e=this.pourFuture)!=null&&e.endState))||this.currentState===d.PourState.POUR_STARTING||this.currentState===d.PourState.POURING||this.currentState===d.PourState.POUR_CANCELING}get canPour(){return this.currentState===d.PourState.IDLE}updateIfCurrent(e,t){this.currentState===e&&o.kosAction(()=>{this.currentState=t})}async pourIce(e){try{if(this.currentState===d.PourState.IDLE){if(this.updateIfCurrent(d.PourState.IDLE,d.PourState.POUR_STARTING),!e)throw new Error("No tracker provided");const t=await Jt(this.path,e);return this.updateIfCurrent(d.PourState.POUR_STARTING,d.PourState.POURING),t!=null&&t.endState&&this.updateIfCurrent(d.PourState.POURING,d.PourState.IDLE),t}else throw new Error(`Cannot pour in state ${this.currentState}`)}catch(t){throw this.logger.error(t),this.currentState=d.PourState.IDLE,t}}async cancelIceDispense(){var e;this.currentState===d.PourState.POURING||this.currentState===d.PourState.POUR_STARTING?(this.currentState=d.PourState.POUR_CANCELING,await((e=this.pourFuture)==null?void 0:e.cancelFuture()),o.kosAction(()=>{this.currentState=d.PourState.IDLE})):this.logger.warn(`Cannot cancel ice dispense in state ${this.currentState}`)}async testAgitate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`agitating ice-agitator ${this.id}`),er(this.path,e)}async testGate(e){if(!e)throw new Error("No tracker provided");return this.logger.info(`testing ice gate: ${this.id}`),tr(this.path,e)}handleAgitationChange(){var e;this.isAgitating?(this.logger.info(`agitating ice-agitator ${this.id}`),o.EventBus.publish(R.TOPIC_AGITATION_STARTED,{path:this.path,futureId:(e=this.futureHandler.future)==null?void 0:e.futureId})):o.EventBus.publish(R.TOPIC_AGITATION_ENDED,{path:this.path})}async updateIceType(e){await Xt(this.path,e)}async init(){this.logger.debug(`initializing ice-agitator ${this.id}`)}async load(){this.logger.debug(`loading ice-agitator ${this.id}`);const e=await Zt(this.path);(e==null?void 0:e.status)===200&&o.kosAction(()=>{this._allIceTypes=e.data||[]})}};g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.volWithoutIceMl"})],p.prototype,"volWithoutIceMl",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.durationSec",converter:{to:"second"}})],p.prototype,"durationSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"enableIceChuteClear"})],p.prototype,"enableIceChuteClear",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearDurationMs"})],p.prototype,"iceChuteClearDurationMs",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearIntervalSec"})],p.prototype,"iceChuteClearIntervalSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"iceChuteClearRetryIntervalSec"})],p.prototype,"iceChuteClearRetryIntervalSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"maxDispenseSec"})],p.prototype,"maxDispenseSec",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"type"})],p.prototype,"type",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.dilutionOffset"})],p.prototype,"dilutionOffset",2);g([o.kosConfigProperty({path:o.KOS_MODEL_ID,attribute:"settings.inactivitySec",converter:{to:"minute"}})],p.prototype,"inactivitySec",2);g([o.kosStateProp({path:Be,attribute:"agitating"})],p.prototype,"agitating",2);g([o.kosStateProp({path:Be,attribute:"iceChuteOpen"})],p.prototype,"iceChuteOpen",2);g([o.kosFuture({alias:"pour"})],p.prototype,"pourIce",1);g([o.kosFuture({alias:"agitate"})],p.prototype,"testAgitate",1);g([o.kosFuture({alias:"gate"})],p.prototype,"testGate",1);g([o.kosModelEffect({dependencies:e=>[e.isAgitating]})],p.prototype,"handleAgitationChange",1);p=g([o.kosModel(Ve),o.kosMultipleFutureAware()],p);const ne=new o.KosModelRegistrationFactory({class:p,type:Ve});var ar=Object.getOwnPropertyDescriptor,ir=(e,t,r,i)=>{for(var a=i>1?void 0:i?ar(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=n(a)||a);return a};const He="lfcv-pump-model";let re=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pumpModel");this.id=e,this.logger=r.logger,this.pumpModel=t.companionParent}get name(){return this.pumpModel.name}get canPour(){return this.pumpModel.canPour}get isPouring(){return this.pumpModel.isPouring}async cancelPour(){return this.pumpModel.cancelPour()}performIntent(e){return this.pumpModel.performIntent(e)}async init(){this.logger.debug(`initializing lfcv-pump ${this.id}`)}async load(){this.logger.debug(`loading lfcv-pump ${this.id}`)}};re=ir([o.kosModel(He)],re);const Ye=new o.KosModelRegistrationFactory({class:re,type:He}),{URL:sr}=o.resolveServiceUrl("LFCV-PUMP_SERVICE"),{getAll:nr}=o.ServiceFactory.build({basePath:`${sr}/api/lfcv-pump`}),lr=o.KosLog.createLogger({name:"lfcv-pump-service",group:"Services"}),ur=async()=>(lr.debug("sending GET for lfcv-pump"),await nr({})),{URL:F}=o.resolveServiceUrl("SPM-PUMP_SERVICE"),{postModel:B}=o.ServiceFactory.build({basePath:`${F}/api/spm-pump`}),P=o.KosLog.createLogger({name:"spm-pump-service",group:"Services"}),We=async(e,t)=>{P.debug(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`);try{const r=await B({model:{},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,tracker:t});return P.debug("performPreCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){P.error(`performPreCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/preCalibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Ze=async(e,t)=>{P.debug(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`);try{const r=await B({model:{},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/calibrate`,tracker:t});return P.debug("performCalibrate - response:",r),r!=null&&r.data&&o.FutureManager.initiateFuture(r.data),r==null?void 0:r.data}catch(r){P.error(`performCalibrate - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/calibrate`,r);const i={id:t||"",endState:o.FutureEndState.Fail,tracker:t,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(i),i}},Xe=async(e,t,r,i)=>{P.debug(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`);try{const a=await B({model:{...r,measuredCalibrationVolume:t},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/verify`,tracker:i});return P.debug("performVerify - response:",a),a!=null&&a.data&&o.FutureManager.initiateFuture(a.data),a==null?void 0:a.data}catch(a){P.error(`performVerify - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/verify`,a);const l={id:i||"",endState:o.FutureEndState.Fail,tracker:i,reason:"Failed to resolve trouble"};return o.FutureManager.initiateFuture(l),l}},Qe=async(e,t,r,i)=>{var a,l,n,c,v;P.debug(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`);try{const u=await B({model:{...i,measuredCalibrationVolume:t,measuredVerificationVolume:r},urlOverride:`${F}/api/ext/freestyle/microCalibration/pour/${e}/complete`});return P.debug("performComplete - response:",u),((u==null?void 0:u.status)===200||(u==null?void 0:u.status)===499)&&((a=u.data)!=null&&a.error)?[u.data.error||"unknownError",u.data]:[void 0,u==null?void 0:u.data]}catch(u){if(P.error(`performComplete - sending POST request to /api/ext/freestyle/microCalibration/pour/${e}/complete`,u),u instanceof o.FetchError){const m=((n=(l=u.payload)==null?void 0:l.data)==null?void 0:n.error)||((c=u.payload)==null?void 0:c.error)||"unknownError";return[m,((v=u.payload)==null?void 0:v.data)||{error:m}]}}return["unknownError",{error:"unknownError"}]};var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,H=(e,t,r,i)=>{for(var a=i>1?void 0:i?dr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&cr(t,r,a),a};const Je="spm-pump-model";let $=class{constructor(e,t,r){s(this,"id");s(this,"logger");s(this,"pump");s(this,"futureHandler");this.id=e,this.logger=r.logger,this.pump=t.companionParent,this.futureHandler=new o.FutureHandler(this)}get name(){return this.pump.name}get canPour(){return this.pump.canPour}get isPouring(){return this.pump.isPouring}async cancelPour(){return this.pump.cancelPour()}performIntent(e){return this.pump.performIntent(e)}get future(){return this.futureHandler.future}async performPreCalibrate(e){return We(this.pump.path,e)}async performCalibrate(e){return Ze(this.pump.path,e)}async performVerify(e,t,r){return Xe(this.pump.path,e,t,r)}async performComplete(e,t,r){return Qe(this.pump.path,e,t,r)}async init(){this.logger.debug(`initializing spm-pump ${this.id}`)}async load(){this.logger.debug(`loading spm-pump ${this.id}`)}};H([o.kosFuture()],$.prototype,"performPreCalibrate",1);H([o.kosFuture()],$.prototype,"performCalibrate",1);H([o.kosFuture()],$.prototype,"performVerify",1);$=H([o.kosModel(Je)],$);const et=new o.KosModelRegistrationFactory({class:$,type:Je});var tt=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,gr=(e,t,r)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,le=(e,t,r,i)=>{for(var a=i>1?void 0:i?pr(t,r):t,l=e.length-1,n;l>=0;l--)(n=e[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&tt(t,r,a),a},hr=(e,t,r)=>(gr(e,t+"",r),r);const rt="agitation-required-trouble-model",fr=e=>{if(e.data.agitationRequired)return rt},ot="InsufficientAgitationTrouble";let M=class{constructor(e){s(this,"id");s(this,"_deferred");s(this,"_holdersLoaded",!1);s(this,"agitateBeforePour");this.id=e,this._deferred=!1}async resolve(){return this.trouble.resolve()}get holder(){const e=this.trouble.data.holderPaths[0],t=o.getKosModelSync(e);if(!(!this._holdersLoaded&&!t.model))return t==null?void 0:t.model}updateHolder(){if(!this._holdersLoaded){const e=this.trouble.data.holderPaths[0];o.getKosModelSync(e).model&&(this._holdersLoaded=!0)}}get shouldDefer(){var i,a;if(!this.holder)return!0;const t=(((i=this.holder)==null?void 0:i.troublesByType[ot])||[]).length>0;return!!((a=this.agitateBeforePour)!=null&&a.value)&&t}get deferred(){return this._deferred}defer(){this._deferred=!0}clearDefer(){this._deferred=!1}};hr(M,"Registration");le([o.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.agitateBeforePour"})],M.prototype,"agitateBeforePour",2);le([o.kosTopicHandler({topic:o.modelTypeEventTopicFactory(d.Assembly.type),lifecycle:o.DependencyLifecycle.INIT})],M.prototype,"updateHolder",1);M=le([o.kosModel({modelTypeId:rt,singleton:!1}),o.kosLoggerAware(),o.kosCompanion({mode:"composition",parentProperty:"trouble"})],M);const at=M.Registration,yr=["iceAgitator"],mr={iceAgitator:ne.factory},Pr=o.KosLog.createLogger({name:"freestyle-assembly-data-mapper"}),br=async e=>{const t=x.instance().options({}).build(),r=j.instance().options({}).build(),i=e.assemblies.reduce((n,c)=>{var v;return yr.forEach(u=>{var _;const m=c[u];if(m){const st=mr[u](m.path);n[u]=st({name:m.name,path:m.path,statePath:((_=m.state)==null?void 0:_.path)||""})}}),(v=c.cartridgeAgitators)==null||v.forEach(u=>{var _;const m=ie.instance(u.path).options({name:u.name,path:u.path,statePath:((_=u.state)==null?void 0:_.path)||""}).build();t.addModel(m)}),c.remoteTrays&&c.remoteTrays.forEach(u=>{Pr.info(`Found remote tray ${u.name} with path ${u.path}`);const m=`${E.type}-${u.holderPath}`,_=E.instance(m).options({holderPath:u.holderPath,configPath:u.path,name:u.name}).build();r.addModel(_)}),n},{}),a=!!i.iceAgitator,l=!!i.carbTank;return{...i,cartridgeAgitators:t,remoteTrays:r,supportsCarb:l,supportsIce:a}},it=e=>()=>(o.registerCoreModels(e)(),d.registerDispenseModels(e)(),J.register(),z.register(),ne.register(),ae.register(),x.register(),et.register(),Me.register(),Ye.register(),_e.register(),te.register(),X.register(),E.register(),j.register(),o.RegistrationManager.companion.register(e)(d.Nozzle.type,J.type),o.RegistrationManager.companion.register(e)(d.Assembly.type,z.type),at.register(),o.RegistrationManager.companion.register(e)(o.Trouble.type,fr),o.RegistrationManager.companion.register(e)(d.Pump.type,te.type),o.RegistrationManager.companion.register(e)(d.Holder.type,X.type),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("EnjoyByTrouble",async t=>{if(t.data.enjoyByDate){const r=new Date(t.data.enjoyByDate);return{enjoyByDays:Math.floor((new Date().getTime()-r.getTime())/(1e3*60*60*24))||""}}return{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("SuperPumpRequiredTrouble",async t=>{const{model:r}=o.getKosModelSync(d.PumpContainer.type);return r?{superPumps:r.models.getIndexByKey(d.PumpIndex.byType,"microSuper").map(l=>l.name).join(", ")}:{}}),o.ExtensionManager[o.EXTENSION_TROUBLE_DATA_MAPPER].register("MicroPumpAirDetectTrouble",async t=>{if(t.ifaces.includes("container"))return{};if(t.data.pumpPath){const{model:r}=o.getKosModelSync(t.data.pumpPath);if(r){const i=r.ingredientId?o.getKosModelSync(r.ingredientId).model:void 0;return{ingredientId:r.ingredientId,ingredientName:(i==null?void 0:i.name)||""}}}return{}}),{preload:o.RegistrationManager.model.preloadModel(e),model:o.RegistrationManager.model.register(e),companion:o.RegistrationManager.companion.register(e),legacy:o.RegistrationManager.model.registerLegacyModel(e)}),b={...d.KosModelRegistry};b.freestyle={models:it(b)};b.preload=o.RegistrationManager.model.preloadModel(b);b.model=o.RegistrationManager.model.register(b);b.companion=o.RegistrationManager.companion.register(b);b.legacy=o.RegistrationManager.model.registerLegacyModel(b);const vr=b;function _r(e){return o.kosServiceRequest(e)}const ue=o.createClient(),Tr=Object.freeze(Object.defineProperty({__proto__:null,api:ue,default:ue,kosServiceRequest:_r},Symbol.toStringTag,{value:"Module"}));function Ir(e){return o.kosServiceRequest(e)}const ce=o.createClient(),Sr=Object.freeze(Object.defineProperty({__proto__:null,api:ce,default:ce,kosServiceRequest:Ir},Symbol.toStringTag,{value:"Module"}));function Cr(e){return o.kosServiceRequest(e)}const de=o.createClient(),Er=Object.freeze(Object.defineProperty({__proto__:null,api:de,default:de,kosServiceRequest:Cr},Symbol.toStringTag,{value:"Module"}));function $r(e){return o.kosServiceRequest(e)}const pe=o.createClient(),Mr=Object.freeze(Object.defineProperty({__proto__:null,api:pe,default:pe,kosServiceRequest:$r},Symbol.toStringTag,{value:"Module"}));function Or(e){return o.kosServiceRequest(e)}const ge=o.createClient(),Ar=Object.freeze(Object.defineProperty({__proto__:null,api:ge,default:ge,kosServiceRequest:Or},Symbol.toStringTag,{value:"Module"}));exports.AGITATION_REQUIRED_TROUBLE=ot;exports.AgitationRequiredTrouble=at;exports.CarbAgitator=ae;exports.CartridgeAgitator=ie;exports.CartridgeAgitatorContainer=x;exports.CartridgeAgitatorEvents=A;exports.CgpPump=_e;exports.FEATURE_SUPPORTS_ICE=Re;exports.FcmPump=Me;exports.FreestyleAssembly=z;exports.FreestyleHolder=X;exports.FreestyleNozzle=J;exports.FreestylePump=te;exports.IceAgitator=ne;exports.IceAgitatorEvents=R;exports.InvalidRequestError=Q;exports.KosModelRegistry=vr;exports.LfcvPump=Ye;exports.NutritionInfoError=Ne;exports.RemoteTray=E;exports.RemoteTrayContainer=j;exports.SpmPump=et;exports.freestyleAssemblyDataMapper=br;exports.getFreestyleNutritionInfo=ze;exports.getLfcvPumps=ur;exports.performCalibrate=Se;exports.performCalibrate$1=Ze;exports.performComplete=Ee;exports.performComplete$1=Qe;exports.performElectricalTest=Te;exports.performPreCalibrate=Ie;exports.performPreCalibrate$1=We;exports.performVerify=Ce;exports.performVerify$1=Xe;exports.registerFreestyleModels=it;exports.replacePump=xe;exports.service=Tr;exports.service$1=Sr;exports.service$2=Er;exports.service$3=Mr;exports.service$4=Ar;
2
+ //# sourceMappingURL=service-BYZ3LYEa.cjs.map