@kosdev-code/kos-dispense-sdk 2.0.45 → 2.0.46

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 (121) hide show
  1. package/dispense-registration-manager-o2X21qmP.js +1972 -0
  2. package/dispense-registration-manager-o2X21qmP.js.map +1 -0
  3. package/dispense-registration-manager-oEcu0aLL.cjs +2 -0
  4. package/dispense-registration-manager-oEcu0aLL.cjs.map +1 -0
  5. package/extension-utils-CJ5qRklm.cjs +2 -0
  6. package/extension-utils-CJ5qRklm.cjs.map +1 -0
  7. package/extension-utils-CbCKII-5.js +381 -0
  8. package/extension-utils-CbCKII-5.js.map +1 -0
  9. package/index.cjs +1 -142
  10. package/index.cjs.map +1 -1
  11. package/index.d.ts +1 -2
  12. package/index.d.ts.map +1 -1
  13. package/index.js +103 -133
  14. package/index.js.map +1 -1
  15. package/models/models/assembly/assembly-model.d.ts +0 -4
  16. package/models/models/assembly/assembly-model.d.ts.map +1 -1
  17. package/models/models/assembly/pump-utils.d.ts.map +1 -1
  18. package/models/models/availability/availability-model.d.ts.map +1 -1
  19. package/models/models/board/board-container-model.d.ts +0 -4
  20. package/models/models/board/board-container-model.d.ts.map +1 -1
  21. package/models/models/board/board-model.d.ts +0 -4
  22. package/models/models/board/board-model.d.ts.map +1 -1
  23. package/models/models/device-assembly/device-assembly-model.d.ts +0 -4
  24. package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -1
  25. package/models/models/generic-pour/generic-pour-model.d.ts +13 -54
  26. package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
  27. package/models/models/generic-pour/index.d.ts +2 -2
  28. package/models/models/generic-pour/index.d.ts.map +1 -1
  29. package/models/models/generic-pour/types/index.d.ts +0 -1
  30. package/models/models/holder/holder-model.d.ts.map +1 -1
  31. package/models/models/holder-container/holder-container-model.d.ts.map +1 -1
  32. package/models/models/ingredient/ingredient-model.d.ts.map +1 -1
  33. package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -1
  34. package/models/models/nozzle/index.d.ts +1 -1
  35. package/models/models/nozzle/index.d.ts.map +1 -1
  36. package/models/models/nozzle/nozzle-model.d.ts +10 -28
  37. package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
  38. package/models/models/nozzle/types/index.d.ts +0 -8
  39. package/models/models/pump/pump-model.d.ts.map +1 -1
  40. package/models/models/pump/types/index.d.ts +2 -7
  41. package/models/models/pump-container/pump-container-model.d.ts.map +1 -1
  42. package/models/models/types/assembly.d.ts +0 -4
  43. package/models/models/types/assembly.d.ts.map +1 -1
  44. package/models/models/types/intent.d.ts +0 -98
  45. package/models/models/types/intent.d.ts.map +1 -1
  46. package/models/models/types/pouring.d.ts +3 -1
  47. package/models/models/types/pouring.d.ts.map +1 -1
  48. package/models/utils/dispense-registration-manager.d.ts +2 -2
  49. package/models/utils/extension-utils.d.ts +18 -90
  50. package/models/utils/extension-utils.d.ts.map +1 -1
  51. package/models/utils/service.d.ts +12 -16
  52. package/models/utils/service.d.ts.map +1 -1
  53. package/models.cjs +1 -47
  54. package/models.cjs.map +1 -1
  55. package/models.js +37 -40
  56. package/package.json +2 -19
  57. package/pump-provider-BQcKWjr8.cjs +2 -0
  58. package/pump-provider-BQcKWjr8.cjs.map +1 -0
  59. package/pump-provider-Bv-OLySq.js +1238 -0
  60. package/pump-provider-Bv-OLySq.js.map +1 -0
  61. package/ui/contexts/cui-kit/cui-kit.d.ts +4 -4
  62. package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
  63. package/ui/hooks/cui-kit/use-beverages.d.ts +2 -3
  64. package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
  65. package/ui/hooks/cui-kit/use-brands.d.ts +1 -1
  66. package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -1
  67. package/ui/hooks/cui-kit/use-cui-kit.d.ts +2 -3
  68. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  69. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +1 -2
  70. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
  71. package/ui/hooks/cui-kit/use-flavors.d.ts +1 -1
  72. package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -1
  73. package/ui/hooks/generic-pour/use-generic-pour.d.ts +2 -3
  74. package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
  75. package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +2 -6
  76. package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -1
  77. package/ui/hooks/pour/use-pour.d.ts +3 -8
  78. package/ui/hooks/pour/use-pour.d.ts.map +1 -1
  79. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
  80. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +9 -2
  81. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
  82. package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
  83. package/ui/index.d.ts +0 -1
  84. package/ui/index.d.ts.map +1 -1
  85. package/ui.cjs +1 -73
  86. package/ui.cjs.map +1 -1
  87. package/ui.js +65 -66
  88. package/dispense-registration-manager-C7GGaZ47.js +0 -2673
  89. package/dispense-registration-manager-C7GGaZ47.js.map +0 -1
  90. package/dispense-registration-manager-lQhkTFKW.cjs +0 -2671
  91. package/dispense-registration-manager-lQhkTFKW.cjs.map +0 -1
  92. package/extension-utils-50g2ril2.cjs +0 -500
  93. package/extension-utils-50g2ril2.cjs.map +0 -1
  94. package/extension-utils-Dt00FOJq.js +0 -501
  95. package/extension-utils-Dt00FOJq.js.map +0 -1
  96. package/extensions/control-pour-extension.d.ts +0 -70
  97. package/extensions/control-pour-extension.d.ts.map +0 -1
  98. package/extensions/index.d.ts +0 -2
  99. package/extensions/index.d.ts.map +0 -1
  100. package/kos-models.json +0 -180
  101. package/models/utils/openapi-index.d.ts +0 -2
  102. package/models/utils/openapi-index.d.ts.map +0 -1
  103. package/models/utils/services/dispense/1.6.5/openapi.d.ts +0 -845
  104. package/models/utils/services/dispense/1.6.5/service.d.ts +0 -122
  105. package/models/utils/services/dispense/1.6.5/service.d.ts.map +0 -1
  106. package/models/utils/services/dispense/1.8.1/openapi.d.ts +0 -1653
  107. package/models/utils/services/dispense/1.8.1/service.d.ts +0 -122
  108. package/models/utils/services/dispense/1.8.1/service.d.ts.map +0 -1
  109. package/models/utils/services/dispense/daily/openapi.d.ts +0 -1820
  110. package/models/utils/services/dispense/daily/service.d.ts +0 -122
  111. package/models/utils/services/dispense/daily/service.d.ts.map +0 -1
  112. package/models/utils/services-index.d.ts +0 -4
  113. package/models/utils/services-index.d.ts.map +0 -1
  114. package/pump-provider-CBFev3qg.cjs +0 -1824
  115. package/pump-provider-CBFev3qg.cjs.map +0 -1
  116. package/pump-provider-DyxEmFRT.js +0 -1825
  117. package/pump-provider-DyxEmFRT.js.map +0 -1
  118. package/ui/hooks/cui-kit/dispense-topics.d.ts +0 -47
  119. package/ui/hooks/cui-kit/dispense-topics.d.ts.map +0 -1
  120. package/ui/utils/pour-context.d.ts +0 -8
  121. package/ui/utils/pour-context.d.ts.map +0 -1
@@ -0,0 +1,1238 @@
1
+ var it = Object.defineProperty;
2
+ var at = (e, t, r) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var J = (e, t, r) => (at(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { jsx as m } from "@emotion/react/jsx-runtime";
5
+ import { A as Ie, b as Ae, e as ot, d as xe, N as ct, f as ke, H as dt, g as Ee, I as Se, h as Ne, G as ut, P as He } from "./dispense-registration-manager-o2X21qmP.js";
6
+ import { useKosModel as N, getKosCompanionModel as be, kosAutoEffect as Re, KosLog as P, usePressGesture as ve, EventBus as g, TimerManager as Be } from "@kosdev-code/kos-ui-sdk";
7
+ import lt, { createContext as L, useMemo as A, useContext as H, useState as S, useCallback as o, useEffect as Y, useRef as Ce } from "react";
8
+ const ye = () => {
9
+ const e = Ie.type;
10
+ return N({
11
+ modelId: e,
12
+ modelType: Ie.type,
13
+ options: {}
14
+ });
15
+ };
16
+ function yt(e) {
17
+ return (t) => {
18
+ const { model: r, status: n, KosModelLoader: s } = ye();
19
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, assembly: r }) });
20
+ };
21
+ }
22
+ const De = () => {
23
+ const e = Ae.type;
24
+ return N({
25
+ modelId: e,
26
+ modelType: Ae.type,
27
+ options: {}
28
+ });
29
+ };
30
+ function Dt(e) {
31
+ return (t) => {
32
+ const { model: r, status: n, KosModelLoader: s } = De();
33
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, beverage: r }) });
34
+ };
35
+ }
36
+ const Me = (e) => N({
37
+ modelId: e,
38
+ modelType: ot.type,
39
+ options: {}
40
+ });
41
+ function Mt(e) {
42
+ return (t) => (r) => {
43
+ const { model: n, status: s, KosModelLoader: i } = Me(t);
44
+ return /* @__PURE__ */ m(i, { ...s, children: /* @__PURE__ */ m(e, { ...r, board: n }) });
45
+ };
46
+ }
47
+ const Oe = () => {
48
+ const e = xe.type;
49
+ return N({
50
+ modelId: e,
51
+ modelType: xe.type,
52
+ options: {}
53
+ });
54
+ };
55
+ function Ot(e) {
56
+ return (t) => {
57
+ const { model: r, status: n, KosModelLoader: s } = Oe();
58
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, boardContainer: r }) });
59
+ };
60
+ }
61
+ const Ye = (e) => N({
62
+ modelId: e,
63
+ modelType: ct.type,
64
+ options: {
65
+ path: e
66
+ }
67
+ }), _e = L(void 0), mt = ({ children: e, path: t }) => {
68
+ const { model: r, ready: n } = Ye(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
69
+ return /* @__PURE__ */ m(_e.Provider, { value: s, children: e });
70
+ }, D = () => {
71
+ const e = H(_e);
72
+ if (!e)
73
+ throw new Error("useNozzleContext must be used within a NozzleProvider");
74
+ return e;
75
+ }, pt = ({
76
+ onBeverageSelected: e,
77
+ onClearBeverage: t,
78
+ companionType: r
79
+ }) => {
80
+ const { model: n } = D(), [s, i] = S([]), [u, l] = S(null), f = A(() => r ? s.map(
81
+ (d) => be(d, r)
82
+ ) : [], [s, r]), h = o(
83
+ async (d) => {
84
+ l(d), await (n == null ? void 0 : n.setSelectedPourable({ beverage: d })), e == null || e(d);
85
+ },
86
+ [n, e]
87
+ ), c = o(async () => {
88
+ l(null), await (n == null ? void 0 : n.setSelectedPourable({ beverage: void 0 })), t == null || t();
89
+ }, [n, t]);
90
+ return Y(() => {
91
+ const d = Re(() => {
92
+ if (!n)
93
+ return;
94
+ const $ = n.selectedBrand;
95
+ if (!$) {
96
+ const b = n.getGroupAvailabilityItems("beverages").filter((v) => v.visible);
97
+ i(b ?? []);
98
+ return;
99
+ }
100
+ const x = n.getAvailabilityByParent($.id).filter((b) => b.visible);
101
+ i(x ?? []);
102
+ });
103
+ return () => {
104
+ d();
105
+ };
106
+ }, [n]), {
107
+ beverages: s,
108
+ beverageCompanions: f,
109
+ selectBeverage: h,
110
+ selectedBeverage: u,
111
+ clearBeverage: c
112
+ };
113
+ }, ht = ({
114
+ onBrandSelected: e,
115
+ onBrandCleared: t,
116
+ companionType: r
117
+ }) => {
118
+ const { model: n } = D(), [s, i] = S(null), [u, l] = S([]), f = A(() => r ? u.map((d) => be(d, r)) : [], [u, r]), h = o(
119
+ async (d) => {
120
+ i(d), n == null || n.setSelectedBrand(d), e == null || e(d);
121
+ },
122
+ [n, e]
123
+ ), c = o(() => {
124
+ i(null), n == null || n.setSelectedBrand(void 0), t == null || t();
125
+ }, [n, t]);
126
+ return Y(() => {
127
+ const d = Re(() => {
128
+ n && l(n.visibleBrands);
129
+ });
130
+ return () => {
131
+ d();
132
+ };
133
+ }, [n]), {
134
+ brands: u,
135
+ brandCompanions: f,
136
+ selectedBrand: s,
137
+ selectBrand: h,
138
+ clearBrand: c
139
+ };
140
+ }, ft = P.createLogger({
141
+ name: "HoldToPourStrategy",
142
+ group: "kos-hooks"
143
+ }), Ge = {
144
+ name: "HoldToPourStrategy",
145
+ async initiate(e) {
146
+ if (!(e != null && e.canPour)) {
147
+ ft.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
148
+ return;
149
+ }
150
+ await (e == null ? void 0 : e.pour());
151
+ },
152
+ async initiateEnded(e) {
153
+ await (e == null ? void 0 : e.cancelPour());
154
+ }
155
+ }, re = P.createLogger({
156
+ name: "useNozzlePour",
157
+ group: "kos-hooks"
158
+ }), bt = ({
159
+ onPour: e,
160
+ onPourCancel: t,
161
+ onBeforePour: r,
162
+ onBeforePourRejected: n,
163
+ strategy: s = Ge
164
+ }) => {
165
+ const { model: i } = D(), u = o(async () => {
166
+ (r ? await (r == null ? void 0 : r()) : !0) ? (re.debug(
167
+ `[${s == null ? void 0 : s.name}] - Pour initiated for nozzle ${i == null ? void 0 : i.id}.`
168
+ ), s == null || s.initiate(i), e == null || e()) : (re.debug(
169
+ `[${s == null ? void 0 : s.name}] - Did not pass onBeforePour gate for nozzle ${i == null ? void 0 : i.id}. Cancelling pour.`
170
+ ), n == null || n());
171
+ }, [e, i, s, r, t]), l = o(() => {
172
+ var c;
173
+ re.debug(
174
+ `[${s == null ? void 0 : s.name}] - Pour initiate ended called for nozzle ${i == null ? void 0 : i.id}.`
175
+ ), (c = s == null ? void 0 : s.initiateEnded) == null || c.call(s, i), t == null || t();
176
+ }, [t, i, s]), f = o(() => {
177
+ re.debug(`Force cancelling pour for nozzle ${i == null ? void 0 : i.id}.`), i == null || i.cancelPour(), t == null || t();
178
+ }, [t, i]);
179
+ return {
180
+ handlers: ve({
181
+ onPressed: u,
182
+ onRelease: l
183
+ }).dom,
184
+ cancel: f,
185
+ status: i
186
+ };
187
+ }, vt = ({
188
+ onFlavorSelected: e,
189
+ onFlavorCleared: t,
190
+ companionType: r
191
+ }) => {
192
+ const { model: n } = D(), s = A(
193
+ () => (n == null ? void 0 : n.getGroupAvailabilityItems("flavors").filter((c) => c.visible)) ?? [],
194
+ [n]
195
+ ), i = A(() => r ? s.map(
196
+ (c) => be(c, r)
197
+ ) : [], [s, r]), [u, l] = S([]), f = o(
198
+ async (c) => {
199
+ if (l(
200
+ (d) => d != null && d.includes(c) ? [...d.filter(($) => $ !== c)] : [...d ?? [], c]
201
+ ), n != null && n.selectedPourable) {
202
+ const { beverage: d } = n.selectedPourable;
203
+ await n.setSelectedPourable({
204
+ beverage: d,
205
+ additional: u ?? []
206
+ });
207
+ }
208
+ e == null || e(c, u ?? []);
209
+ },
210
+ [n, e, u]
211
+ ), h = o(async () => {
212
+ if (l([]), n != null && n.selectedPourable) {
213
+ const { beverage: c } = n.selectedPourable;
214
+ n.setSelectedPourable({ beverage: c }), t == null || t();
215
+ }
216
+ }, [n, t]);
217
+ return {
218
+ flavors: s,
219
+ flavorCompanions: i,
220
+ selectFlavor: f,
221
+ selectedFlavors: u,
222
+ clearFlavors: h
223
+ };
224
+ }, Q = "brands", ne = "beverages", X = "flavors", O = P.createLogger({ name: "use-cui-kit" }), $t = ({
225
+ initialGroup: e = Q,
226
+ options: t = {}
227
+ }) => {
228
+ var ee, te, se;
229
+ const [r, n] = S(e), { model: s } = D(), i = Ce([]), u = o(
230
+ (p) => {
231
+ n(X);
232
+ const C = `/kos/dispense/${s == null ? void 0 : s.path}/brand/selected/`;
233
+ g.publish(C, p);
234
+ },
235
+ [s == null ? void 0 : s.path]
236
+ ), l = o(() => {
237
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/brand/cleared/`;
238
+ g.publish(p, {});
239
+ }, [s == null ? void 0 : s.path]), f = o(
240
+ (p) => {
241
+ n(X);
242
+ const C = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/selected/`;
243
+ g.publish(C, p);
244
+ },
245
+ [s == null ? void 0 : s.path]
246
+ ), h = o(() => {
247
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/cleared/`;
248
+ g.publish(p, {});
249
+ }, [s == null ? void 0 : s.path]), c = o(
250
+ (p) => {
251
+ const C = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/selected/`;
252
+ g.publish(C, p);
253
+ },
254
+ [s == null ? void 0 : s.path]
255
+ ), d = o(() => {
256
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/cleared/`;
257
+ g.publish(p, {});
258
+ }, [s == null ? void 0 : s.path]), $ = o(() => {
259
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/pour/`;
260
+ g.publish(p, {});
261
+ }, [s == null ? void 0 : s.path]), x = o(async () => {
262
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/`;
263
+ return g.publish(p, {}), await (M == null ? void 0 : M()) || !0;
264
+ }, [s == null ? void 0 : s.path]), b = o(async () => {
265
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/rejected/`;
266
+ g.publish(p, {});
267
+ }, [s == null ? void 0 : s.path]), v = o(() => {
268
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/pour/cancel/`;
269
+ g.publish(p, {});
270
+ }, [s == null ? void 0 : s.path]), { brands: a, selectBrand: F, selectedBrand: R, clearBrand: w, brandCompanions: W } = ht({
271
+ companionType: (ee = t.companionTypes) == null ? void 0 : ee.brand,
272
+ onBrandSelected: u,
273
+ onBrandCleared: l
274
+ }), {
275
+ beverages: ae,
276
+ selectBeverage: oe,
277
+ selectedBeverage: ce,
278
+ clearBeverage: T,
279
+ beverageCompanions: B
280
+ } = pt({
281
+ companionType: (te = t.companionTypes) == null ? void 0 : te.beverage,
282
+ onBeverageSelected: f,
283
+ onClearBeverage: h
284
+ }), {
285
+ clearFlavors: q,
286
+ flavors: de,
287
+ selectFlavor: U,
288
+ selectedFlavors: I,
289
+ flavorCompanions: K
290
+ } = vt({
291
+ companionType: (se = t.companionTypes) == null ? void 0 : se.flavor,
292
+ onFlavorSelected: c,
293
+ onFlavorCleared: d
294
+ }), [M, k] = S(), _ = o((p) => {
295
+ k(() => p);
296
+ }, []), j = bt({
297
+ onPour: $,
298
+ onPourCancel: v,
299
+ onBeforePour: x,
300
+ onBeforePourRejected: b
301
+ }), V = o(() => {
302
+ switch (O.debug(`Navigating back from group: ${r}`), r) {
303
+ case Q:
304
+ T(), w();
305
+ break;
306
+ case ne:
307
+ case X:
308
+ n(e), T(), w();
309
+ break;
310
+ }
311
+ }, [T, w, r, e]), ue = o(() => {
312
+ const p = `/kos/dispense/${s == null ? void 0 : s.path}/home/`;
313
+ g.publish(p, {}), n(e), e === Q && (T(), w()), e === ne && T();
314
+ }, [T, w, e]), le = o(() => {
315
+ if (i.current.length === 0) {
316
+ O.debug("No timers to pause.");
317
+ return;
318
+ }
319
+ O.debug(`Pausing ${i.current.length} timers.`), i.current.forEach((p) => {
320
+ O.debug(`Pausing timer with id ${p.id}.`), p.pause();
321
+ });
322
+ }, []), me = o(() => {
323
+ if (i.current.length === 0) {
324
+ O.debug("No timers to restart.");
325
+ return;
326
+ }
327
+ O.debug(`Restarting ${i.current.length} timers.`), i.current.forEach((p) => {
328
+ O.debug(`Restarting timer with id ${p.id}.`), p.restart();
329
+ });
330
+ }, []);
331
+ return {
332
+ timers: {
333
+ add: o((p) => {
334
+ if (p) {
335
+ if (i.current.some((C) => C.id === p.id)) {
336
+ O.debug(`Timer with id ${p.id} already exists.`);
337
+ return;
338
+ }
339
+ i.current.push(p);
340
+ }
341
+ }, []),
342
+ pause: le,
343
+ restart: me
344
+ },
345
+ nav: {
346
+ currentGroup: r,
347
+ back: V,
348
+ home: ue
349
+ },
350
+ pour: j,
351
+ updateOnBeforePour: _,
352
+ selections: {
353
+ [Q]: R,
354
+ [ne]: ce,
355
+ [X]: I
356
+ },
357
+ [Q]: {
358
+ models: a,
359
+ companions: W,
360
+ clear: w,
361
+ handlers: {
362
+ onSelected: F
363
+ }
364
+ },
365
+ [ne]: {
366
+ models: ae,
367
+ companions: B,
368
+ clear: T,
369
+ handlers: {
370
+ onSelected: oe
371
+ }
372
+ },
373
+ [X]: {
374
+ models: de,
375
+ companions: K,
376
+ clear: q,
377
+ handlers: {
378
+ onSelected: U
379
+ }
380
+ }
381
+ };
382
+ }, gt = (e) => {
383
+ const { model: t } = D(), [r, n] = S(null), {
384
+ onAmbientTimer: s,
385
+ onAttractTimer: i,
386
+ onResetAttractTimer: u,
387
+ onResumeAttractTimer: l,
388
+ defaultAttractTime: f,
389
+ defaultAmbientTime: h
390
+ } = e, c = o(() => {
391
+ s && (P.info("Ambient timer expired. Calling callback"), s == null || s());
392
+ }, [s]), d = o(() => {
393
+ i && (P.info("Attract timer expired. Calling callback"), i == null || i());
394
+ }, [i]), $ = o(() => {
395
+ r && (r.restart(), u == null || u());
396
+ }, [r, u]), x = o(() => {
397
+ r && (r.reset(), u == null || u());
398
+ }, [r, u]), b = o(() => {
399
+ r && (r.pause(), l == null || l());
400
+ }, [r, l]);
401
+ return Y(() => {
402
+ if (t && f) {
403
+ P.info("Nozzle is available. Creating timers");
404
+ const v = Be.createTimer(
405
+ "attract-timer-" + t.path,
406
+ f
407
+ );
408
+ return f && (v == null || v.addTimeoutAction({
409
+ name: "attract-timer",
410
+ remainingTime: 0,
411
+ action: d
412
+ })), h && (v == null || v.addTimeoutAction({
413
+ name: "ambient-timer",
414
+ remainingTime: h,
415
+ action: c
416
+ })), f && (v == null || v.start()), n(v ?? null), () => {
417
+ v == null || v.reset(), n(null);
418
+ };
419
+ }
420
+ return () => {
421
+ P.info("Nozzle is not available. No timers to clear");
422
+ };
423
+ }, [
424
+ h,
425
+ f,
426
+ c,
427
+ d,
428
+ t
429
+ ]), {
430
+ attractTimer: r,
431
+ restart: $,
432
+ pause: x,
433
+ resume: b
434
+ };
435
+ }, wt = (e, t) => {
436
+ if (t)
437
+ return g.subscribe(e, t).unsubscribe;
438
+ }, Tt = ({
439
+ onInit: e,
440
+ onBrandSelected: t,
441
+ onBrandCleared: r,
442
+ onBeverageCleared: n,
443
+ onBeverageSelected: s,
444
+ onFlavorCleared: i,
445
+ onFlavorSelected: u,
446
+ onReturnToHome: l,
447
+ onPour: f,
448
+ onPourCancel: h,
449
+ onBeforePourRejected: c,
450
+ onAmbientTimer: d,
451
+ onAttractTimer: $,
452
+ onResumeAttractTimer: x,
453
+ onIdleTimeout: b,
454
+ onAreYouThereTimeout: v
455
+ }) => {
456
+ const { model: a } = D();
457
+ Y(() => {
458
+ const R = [
459
+ {
460
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/brand/selected/`,
461
+ callback: t
462
+ },
463
+ {
464
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/brand/cleared/`,
465
+ callback: r
466
+ },
467
+ {
468
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/beverage/selected/`,
469
+ callback: s
470
+ },
471
+ {
472
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/beverage/cleared/`,
473
+ callback: n
474
+ },
475
+ {
476
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/flavor/selected/`,
477
+ callback: u
478
+ },
479
+ {
480
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/flavor/cleared/`,
481
+ callback: i
482
+ },
483
+ { topic: `/kos/dispense/${a == null ? void 0 : a.path}/pour/`, callback: f },
484
+ {
485
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/pour/cancel/`,
486
+ callback: h
487
+ },
488
+ {
489
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/pre/pour/rejected/`,
490
+ callback: c
491
+ },
492
+ {
493
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/ambient/start/`,
494
+ callback: d
495
+ },
496
+ {
497
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/attract/start/`,
498
+ callback: $
499
+ },
500
+ {
501
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/attract/resume/`,
502
+ callback: x
503
+ },
504
+ {
505
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/idle/timeout/`,
506
+ callback: b
507
+ },
508
+ {
509
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/are-you-there/timeout/`,
510
+ callback: v
511
+ },
512
+ {
513
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/init/`,
514
+ callback: e
515
+ },
516
+ {
517
+ topic: `/kos/dispense/${a == null ? void 0 : a.path}/home/`,
518
+ callback: l
519
+ }
520
+ ].map(
521
+ ({ topic: w, callback: W }) => wt(w, W)
522
+ );
523
+ return () => {
524
+ R.forEach((w) => w == null ? void 0 : w());
525
+ };
526
+ }, [
527
+ a == null ? void 0 : a.path,
528
+ d,
529
+ $,
530
+ n,
531
+ s,
532
+ r,
533
+ t,
534
+ i,
535
+ u,
536
+ f,
537
+ h,
538
+ x,
539
+ b,
540
+ v,
541
+ e,
542
+ l
543
+ ]);
544
+ }, y = P.createLogger({ name: "useCuiKitTimers" }), Ke = (e) => {
545
+ const { model: t } = D(), [r, n] = S(null), {
546
+ onAreYouThereTimer: s,
547
+ onIdleTimer: i,
548
+ onResetIdleTimer: u,
549
+ defaultAreYouThereTime: l = 10,
550
+ defaultIdleTime: f = 20
551
+ } = e, h = Ce(!1), c = o(() => {
552
+ !h.current && s && (P.info("Are you there timer expired. Calling callback"), h.current = !0, s == null || s());
553
+ }, [s]), d = o(() => {
554
+ y.debug(
555
+ "handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:",
556
+ !!i
557
+ ), i ? (y.debug("Idle timer expired. Calling callback"), i == null || i()) : y.debug("No onIdleTimer callback provided!");
558
+ }, [i]), $ = o(() => {
559
+ y.debug(`TIMER RESTART called for ${e.prefix ?? ""}timer`), r && (r.restart(), h.current = !1, u == null || u());
560
+ }, [r, u, e.prefix]), x = o(() => {
561
+ y.debug(`TIMER PAUSE/RESET called for ${e.prefix ?? ""}timer`), r && (r.reset(), h.current = !1, u == null || u());
562
+ }, [r, u, e.prefix]);
563
+ return Y(() => {
564
+ if (y.debug(
565
+ `useCuiKitTimers effect triggered - nozzle: ${!!t}, path: ${t == null ? void 0 : t.path}, callbacks: handleIdle=${!!d}, handleAreYouThere=${!!c}`
566
+ ), t) {
567
+ y.info("Nozzle is available. Creating timers");
568
+ const b = Be.createTimer(
569
+ `${e.prefix ?? ""}idle-timer-${t.path}`,
570
+ f
571
+ );
572
+ return y.debug(
573
+ `Adding idle timer action for ${e.prefix ?? ""}idle-timer-${t.path} with callback:`,
574
+ !!d
575
+ ), b == null || b.addTimeoutAction({
576
+ name: "idle-timer",
577
+ remainingTime: 0,
578
+ action: d
579
+ }), b == null || b.addTimeoutAction({
580
+ name: "are-you-there-timer",
581
+ remainingTime: l,
582
+ action: c
583
+ }), n(b ?? null), () => {
584
+ b == null || b.reset(), n(null);
585
+ };
586
+ }
587
+ return () => {
588
+ y.info("Nozzle is not available. No timers to clear");
589
+ };
590
+ }, [
591
+ l,
592
+ f,
593
+ c,
594
+ d,
595
+ t,
596
+ e.prefix
597
+ ]), {
598
+ idleTimer: r,
599
+ restart: $,
600
+ pause: x
601
+ };
602
+ }, G = P.createLogger({ name: "useDefaultCuiKitLifecycle" }), Yt = ({
603
+ kit: e,
604
+ inactivity: t,
605
+ pour: r,
606
+ screens: n,
607
+ onBeforeAreYouThereTimer: s,
608
+ areYouThereRejectionPolicy: i = "pause"
609
+ }) => {
610
+ var ge, we, Te, Pe;
611
+ const [u, l] = S(!1), [f, h] = S(!1), { model: c } = D(), [d, $] = S(!1), x = (t == null ? void 0 : t.idleTimeout) ?? 15, b = (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 10, v = (r == null ? void 0 : r.idleTimeout) ?? (t == null ? void 0 : t.idleTimeout) ?? 10, a = (r == null ? void 0 : r.areYouThereTimeoutOffset) ?? (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 5, F = n == null ? void 0 : n.ambientTimeoutOffset, R = n == null ? void 0 : n.attractTimeout, w = o(() => {
612
+ if (G.info("handleIdleTimeout called - navigating home and publishing event"), U(!1), e == null || e.nav.home(), c) {
613
+ const E = `/kos/dispense/${c.path}/idle/timeout/`;
614
+ g.publish(E, {});
615
+ }
616
+ }, [(ge = e == null ? void 0 : e.nav) == null ? void 0 : ge.home, c]), W = o(() => {
617
+ G.info("handleResetIdleTimer called - resetting idle timer"), U(!1);
618
+ }, []), ae = o(() => {
619
+ if (F && (l(!0), h(!1), c)) {
620
+ const E = `/kos/dispense/${c.path}/ambient/start/`;
621
+ g.publish(E, {});
622
+ }
623
+ }, [F, c]), oe = o(() => {
624
+ if (R && (h(!0), l(!1), c)) {
625
+ const E = `/kos/dispense/${c.path}/attract/start/`;
626
+ g.publish(E, {});
627
+ }
628
+ }, [R, c]), ce = o(() => {
629
+ if (R && (h(!1), l(!1), e == null || e.nav.home(), c)) {
630
+ const E = `/kos/dispense/${c.path}/attract/resume/`;
631
+ g.publish(E, {});
632
+ }
633
+ }, [e == null ? void 0 : e.nav, R, c]), {
634
+ pause: T,
635
+ restart: B,
636
+ attractTimer: q
637
+ } = gt({
638
+ defaultAmbientTime: F,
639
+ defaultAttractTime: R,
640
+ onAmbientTimer: ae,
641
+ onAttractTimer: oe,
642
+ onResumeAttractTimer: ce
643
+ });
644
+ (we = e == null ? void 0 : e.timers) == null || we.add(q);
645
+ const [de, U] = S(!1);
646
+ G.info(
647
+ "Creating idle timer with timeout:",
648
+ x,
649
+ "seconds and callback:",
650
+ !!w
651
+ );
652
+ const { pause: I, restart: K, idleTimer: M } = Ke({
653
+ defaultAreYouThereTime: b,
654
+ defaultIdleTime: x,
655
+ onIdleTimer: w,
656
+ onResetIdleTimer: W
657
+ });
658
+ G.info(
659
+ `Creating pour timer with timeout: ${v} seconds and callback: ${!!w}`
660
+ );
661
+ const {
662
+ pause: k,
663
+ restart: _,
664
+ idleTimer: j
665
+ } = Ke({
666
+ defaultAreYouThereTime: a,
667
+ defaultIdleTime: v,
668
+ onIdleTimer: w,
669
+ prefix: "pour-"
670
+ }), V = o(async () => {
671
+ let E = !0;
672
+ if (s)
673
+ try {
674
+ E = await s();
675
+ } catch (pe) {
676
+ G.error(`onBeforeAreYouThereTimer callback failed: ${pe}`), E = !1;
677
+ }
678
+ if (E) {
679
+ if (c) {
680
+ const pe = `/kos/dispense/${c.path}/are-you-there/timeout/`;
681
+ g.publish(pe, {});
682
+ }
683
+ U(!0), d ? k() : I();
684
+ } else
685
+ switch (i) {
686
+ case "pause":
687
+ d ? k() : I();
688
+ break;
689
+ case "restart":
690
+ d ? _() : K();
691
+ break;
692
+ }
693
+ }, [s, c, i, d]), ue = o(() => {
694
+ U(!1), T(), d ? (_(), I()) : (K(), k());
695
+ }, [d, I, k, K, _]);
696
+ Y(() => {
697
+ M && M.addTimeoutAction({
698
+ name: "are-you-there-timer",
699
+ remainingTime: b,
700
+ action: V
701
+ });
702
+ }, [M, b, V]), Y(() => {
703
+ j && j.addTimeoutAction({
704
+ name: "pour-are-you-there-timer",
705
+ remainingTime: a,
706
+ action: V
707
+ });
708
+ }, [j, a, V]), (Te = e == null ? void 0 : e.timers) == null || Te.add(M), (Pe = e == null ? void 0 : e.timers) == null || Pe.add(j);
709
+ const le = o(() => {
710
+ $(!1), k(), I(), T();
711
+ }, [I, k]), me = o(() => {
712
+ $(!0), G.info("restarting pour timer"), _(), T(), I();
713
+ }, [I, _]), $e = o(() => {
714
+ $(!1), G.info("restarting pour timer on before pour rejected"), k(), K();
715
+ }, []), ee = o(() => {
716
+ T(), h(!1), l(!1), K();
717
+ }, [T, K]), te = o(() => {
718
+ h(!1), l(!1), $(!1), k(), B();
719
+ }, [B, k]), se = o(() => {
720
+ h(!1), l(!1), $(!1), T(), K();
721
+ }, [T, K]), p = o(() => {
722
+ h(!1), l(!1), $(!1), B(), I(), k();
723
+ }, [B, I, k]), C = o(() => {
724
+ h(!1), l(!1), B(), I();
725
+ }, [B, I]);
726
+ Tt({
727
+ onBrandSelected: ee,
728
+ onBrandCleared: te,
729
+ onBeverageSelected: se,
730
+ onBeverageCleared: p,
731
+ onPour: le,
732
+ onPourCancel: me,
733
+ onBeforePourRejected: $e,
734
+ onInit: C
735
+ // Note: Timer-related handlers (onIdleTimeout, onAmbientTimer, onAttractTimer,
736
+ // onResumeAttractTimer, onAreYouThereTimeout) are NOT included here since this
737
+ // component's own timer hooks call those handlers directly. Including them would
738
+ // create circular event loops.
739
+ });
740
+ const nt = d ? a : b;
741
+ return Y(() => {
742
+ if (c && q) {
743
+ const E = `/kos/dispense/${c == null ? void 0 : c.path}/init/`;
744
+ g.publish(E, {});
745
+ }
746
+ }, [c, q]), {
747
+ showAreYouThere: de,
748
+ clearAreYouThere: ue,
749
+ pauseIdleTimer: I,
750
+ restartIdleTimer: K,
751
+ areYouThereCountdown: nt,
752
+ showAmbientScreen: u,
753
+ showAttractScreen: f,
754
+ pauseScreenTimer: T,
755
+ restartScreenTimer: B
756
+ };
757
+ }, Fe = () => {
758
+ const e = ke.type;
759
+ return N({
760
+ modelId: e,
761
+ modelType: ke.type,
762
+ options: {}
763
+ });
764
+ };
765
+ function _t(e) {
766
+ return (t) => {
767
+ const { model: r, status: n, KosModelLoader: s } = Fe();
768
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, deviceAssembly: r }) });
769
+ };
770
+ }
771
+ const Ue = (e) => N({
772
+ modelId: e,
773
+ modelType: dt.type,
774
+ options: {}
775
+ });
776
+ function Gt(e, t) {
777
+ return (r) => {
778
+ const { model: n, status: s, KosModelLoader: i } = Ue(e);
779
+ return /* @__PURE__ */ m(i, { ...s, children: /* @__PURE__ */ m(t, { ...r, holder: n }) });
780
+ };
781
+ }
782
+ const je = () => {
783
+ const e = Ee.type;
784
+ return N({
785
+ modelId: e,
786
+ modelType: Ee.type,
787
+ options: {}
788
+ });
789
+ };
790
+ function Ft(e) {
791
+ return (t) => {
792
+ const { model: r, status: n, KosModelLoader: s } = je();
793
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, holderContainer: r }) });
794
+ };
795
+ }
796
+ const Ve = () => {
797
+ const e = Se.type;
798
+ return N({
799
+ modelId: e,
800
+ modelType: Se.type,
801
+ options: {}
802
+ });
803
+ }, he = P.createLogger({
804
+ name: "HoldToPourIntentStrategy",
805
+ group: "kos-hooks"
806
+ }), Pt = {
807
+ name: "HoldToPourIntentStrategy",
808
+ async initiate(e, t) {
809
+ if (!(e != null && e.canPour)) {
810
+ he.debug(`${e == null ? void 0 : e.id} cannot pour. Returning early.`);
811
+ return;
812
+ }
813
+ t ? (he.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : he.debug("no intent provided. Returning early.");
814
+ },
815
+ async initiateEnded(e) {
816
+ await (e == null ? void 0 : e.cancelPour());
817
+ }
818
+ }, fe = P.createLogger({
819
+ name: "useNozzlePour",
820
+ group: "kos-hooks"
821
+ }), Ut = ({
822
+ onPour: e,
823
+ onPourCancel: t,
824
+ intentContainer: r,
825
+ strategy: n = Pt
826
+ }) => {
827
+ const s = o(() => {
828
+ fe.debug(
829
+ `[${n == null ? void 0 : n.name}] - Pour initiated for model ${r == null ? void 0 : r.id}.`
830
+ ), n == null || n.initiate(r), e == null || e();
831
+ }, [e, r, n]), i = o(() => {
832
+ var f;
833
+ fe.debug(
834
+ `[${n == null ? void 0 : n.name}] - Pour initiate ended called for nozzle ${r == null ? void 0 : r.id}.`
835
+ ), (f = n == null ? void 0 : n.initiateEnded) == null || f.call(n, r), t == null || t();
836
+ }, [t, r, n]), u = o(() => {
837
+ fe.debug(`Force cancelling pour for nozzle ${r == null ? void 0 : r.id}.`), r == null || r.cancelPour(), t == null || t();
838
+ }, [t, r]);
839
+ return {
840
+ handlers: ve({
841
+ onPressed: s,
842
+ onRelease: i
843
+ }).dom,
844
+ cancel: u,
845
+ status: r
846
+ };
847
+ };
848
+ function jt(e) {
849
+ return (t) => {
850
+ const { model: r, status: n, KosModelLoader: s } = Ve();
851
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, ingredient: r }) });
852
+ };
853
+ }
854
+ const We = () => {
855
+ const e = Ne.type;
856
+ return N({
857
+ modelId: e,
858
+ modelType: Ne.type,
859
+ options: {}
860
+ });
861
+ };
862
+ function Vt(e) {
863
+ return (t) => {
864
+ const { model: r, status: n, KosModelLoader: s } = We();
865
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, ingredientContainer: r }) });
866
+ };
867
+ }
868
+ function Wt(e, t) {
869
+ return (r) => {
870
+ const { model: n, status: s, KosModelLoader: i } = Ye(e);
871
+ return /* @__PURE__ */ m(i, { ...s, children: /* @__PURE__ */ m(t, { ...r, nozzle: n }) });
872
+ };
873
+ }
874
+ const Z = P.createLogger({
875
+ name: "usePour",
876
+ group: "kos-hooks"
877
+ }), qt = ({
878
+ onBeforePour: e,
879
+ onPour: t,
880
+ onPourCancel: r,
881
+ onPourAbort: n,
882
+ pourTarget: s,
883
+ strategy: i = Ge
884
+ }) => {
885
+ const u = o(async () => {
886
+ Z.debug(
887
+ `[${i == null ? void 0 : i.name}] - calling before pour for pour target ${s == null ? void 0 : s.id}.`
888
+ ), (e ? await (e == null ? void 0 : e()) : !0) ? (Z.debug(
889
+ `[${i == null ? void 0 : i.name}] - Pour initiated for pour target ${s == null ? void 0 : s.id}.`
890
+ ), await (i == null ? void 0 : i.initiate(s)), t == null || t(), s != null && s.isPouring || n == null || n()) : (Z.debug(
891
+ `[${i == null ? void 0 : i.name}] - Pour cancelled for pour target ${s == null ? void 0 : s.id}.`
892
+ ), r == null || r());
893
+ }, [t, s, i]), l = o(async () => {
894
+ var d;
895
+ Z.debug(
896
+ `[${i == null ? void 0 : i.name}] - Pour initiate ended called for pour target ${s == null ? void 0 : s.id}.`
897
+ ), await ((d = i == null ? void 0 : i.initiateEnded) == null ? void 0 : d.call(i, s)) || r == null || r();
898
+ }, [r, s, i]), f = o(async () => {
899
+ Z.debug(`Force cancelling pour for pour target ${s == null ? void 0 : s.id}.`), await (s == null ? void 0 : s.cancelPour()), r == null || r();
900
+ }, [r, s]);
901
+ return {
902
+ handlers: ve({
903
+ onPressed: u,
904
+ onRelease: l
905
+ }).dom,
906
+ cancel: f,
907
+ status: s
908
+ };
909
+ }, z = P.createLogger({
910
+ name: "TapOrHoldIntentStrategy",
911
+ group: "kos-hooks"
912
+ });
913
+ class Jt {
914
+ constructor(t) {
915
+ J(this, "intent");
916
+ J(this, "name", "TapOrHoldIntentStrategy");
917
+ J(this, "isHold", !1);
918
+ J(this, "disposer", null);
919
+ this.intent = t;
920
+ }
921
+ async initiate(t, r) {
922
+ if (this.disposer = setTimeout(() => {
923
+ this.isHold = !0;
924
+ }, 250), t != null && t.isPouring && !this.isHold) {
925
+ z.debug("additional tap detected. cancelling pour"), await t.cancelPour();
926
+ return;
927
+ }
928
+ if (!(t != null && t.canPour)) {
929
+ z.debug(`${t == null ? void 0 : t.id} cannot pour. Returning early.`);
930
+ return;
931
+ }
932
+ r ? (z.debug(`performing intent: ${r}`), await (t == null ? void 0 : t.performIntent(r))) : z.debug("no intent provided. Returning early.");
933
+ }
934
+ async initiateEnded(t) {
935
+ return this.disposer && clearTimeout(this.disposer), this.disposer = null, this.isHold ? (await (t == null ? void 0 : t.cancelPour()), !1) : (z.debug("Tap detected. don't cancel and return."), !0);
936
+ }
937
+ }
938
+ const ie = P.createLogger({
939
+ name: "TapToPourIntentStrategy",
940
+ group: "kos-hooks"
941
+ }), Qt = {
942
+ name: "TapToPourIntentStrategy",
943
+ async initiate(e, t) {
944
+ if (e != null && e.isPouring) {
945
+ ie.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
946
+ return;
947
+ }
948
+ if (!(e != null && e.canPour)) {
949
+ ie.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
950
+ return;
951
+ }
952
+ t ? (ie.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : ie.debug("no intent provided. Returning early.");
953
+ },
954
+ async initiateEnded(e) {
955
+ return !0;
956
+ }
957
+ }, Le = P.createLogger({
958
+ name: "HoldToPourStrategy",
959
+ group: "kos-hooks"
960
+ }), Xt = {
961
+ name: "TapToPourStrategy",
962
+ async initiate(e) {
963
+ if (e != null && e.isPouring) {
964
+ Le.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
965
+ return;
966
+ }
967
+ if (!(e != null && e.canPour)) {
968
+ Le.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
969
+ return;
970
+ }
971
+ await (e == null ? void 0 : e.pour());
972
+ },
973
+ async initiateEnded(e) {
974
+ return !0;
975
+ }
976
+ }, It = (e, t, r) => N({
977
+ modelId: e,
978
+ modelType: ut.type,
979
+ options: {
980
+ servicePathFactory: t,
981
+ selectedId: r
982
+ }
983
+ });
984
+ function Zt(e) {
985
+ return (t) => {
986
+ const { model: r, status: n, KosModelLoader: s } = It(
987
+ t.id,
988
+ t.servicePathFactory,
989
+ t.itemId
990
+ );
991
+ return /* @__PURE__ */ m(s, { ...n, children: /* @__PURE__ */ m(e, { ...t, genericPour: r }) });
992
+ };
993
+ }
994
+ const qe = L(void 0), zt = ({ children: e }) => {
995
+ const { model: t, ready: r } = ye(), n = A(() => r && t ? { model: t } : {}, [r, t]);
996
+ return /* @__PURE__ */ m(qe.Provider, { value: n, children: e });
997
+ }, es = () => {
998
+ const e = H(
999
+ qe
1000
+ );
1001
+ if (!e)
1002
+ throw new Error(
1003
+ "useAssemblyContext must be used within a AssemblyProvider"
1004
+ );
1005
+ return e;
1006
+ }, Je = L(void 0), ts = ({ children: e }) => {
1007
+ const { model: t, ready: r } = De(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1008
+ return /* @__PURE__ */ m(Je.Provider, { value: n, children: e });
1009
+ }, ss = () => {
1010
+ const e = H(Je);
1011
+ if (!e)
1012
+ throw new Error(
1013
+ "useAvailabilityContext must be used within a AvailabilityProvider"
1014
+ );
1015
+ return e;
1016
+ }, Qe = L(void 0), rs = ({ children: e, id: t }) => {
1017
+ const { model: r, ready: n } = Me(t), s = A(() => n && r ? { model: r } : {}, [n, r]);
1018
+ return /* @__PURE__ */ m(Qe.Provider, { value: s, children: e });
1019
+ }, ns = () => {
1020
+ const e = H(Qe);
1021
+ if (!e)
1022
+ throw new Error("useBoardContext must be used within a BoardProvider");
1023
+ return e;
1024
+ }, Xe = L(void 0), is = ({ children: e }) => {
1025
+ const { model: t, ready: r } = Oe(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1026
+ return /* @__PURE__ */ m(Xe.Provider, { value: n, children: e });
1027
+ }, as = () => {
1028
+ const e = H(Xe);
1029
+ if (!e)
1030
+ throw new Error(
1031
+ "useBoardContainerContext must be used within a BoardContainerProvider"
1032
+ );
1033
+ return e;
1034
+ }, Ze = L(
1035
+ void 0
1036
+ ), At = ({ children: e }) => {
1037
+ const { model: t, ready: r } = Fe(), n = A(() => {
1038
+ if (r && t) {
1039
+ const i = t.nozzlePaths;
1040
+ return { model: t, nozzlePaths: i };
1041
+ }
1042
+ return {};
1043
+ }, [r, t]), s = r && t ? e : null;
1044
+ return /* @__PURE__ */ m(Ze.Provider, { value: n, children: s });
1045
+ }, xt = () => {
1046
+ const e = H(Ze);
1047
+ if (!e)
1048
+ throw new Error(
1049
+ "useDeviceAssemblyContext must be used within a DeviceAssemblyProvider"
1050
+ );
1051
+ return e;
1052
+ };
1053
+ function kt() {
1054
+ const e = lt.createContext(null);
1055
+ return [() => {
1056
+ const r = H(e);
1057
+ if (r === void 0)
1058
+ throw new Error("useDispenseKitContext must be used within a Provider");
1059
+ return r;
1060
+ }, e.Provider];
1061
+ }
1062
+ function Et({
1063
+ children: e,
1064
+ provider: t,
1065
+ props: r,
1066
+ nozzleProps: n
1067
+ }) {
1068
+ const s = $t(r);
1069
+ return /* @__PURE__ */ m(t, { value: s, children: e(n || {}) });
1070
+ }
1071
+ function St({
1072
+ children: e,
1073
+ provider: t,
1074
+ props: r
1075
+ }) {
1076
+ const { nozzlePaths: n } = xt(), s = (n == null ? void 0 : n.length) || 0;
1077
+ return (n == null ? void 0 : n.map((u, l) => /* @__PURE__ */ m(mt, { path: u, children: /* @__PURE__ */ m(
1078
+ Et,
1079
+ {
1080
+ provider: t,
1081
+ props: r,
1082
+ nozzleProps: {
1083
+ nozzleIndex: l,
1084
+ nozzlePath: u,
1085
+ totalNozzles: s,
1086
+ isFirstNozzle: l === 0,
1087
+ isLastNozzle: l === s - 1
1088
+ },
1089
+ children: e
1090
+ }
1091
+ ) }, u))) || [];
1092
+ }
1093
+ function Nt({
1094
+ provider: e,
1095
+ props: t
1096
+ }) {
1097
+ return ({ children: r }) => e ? /* @__PURE__ */ m(At, { children: /* @__PURE__ */ m(
1098
+ St,
1099
+ {
1100
+ provider: e,
1101
+ props: t,
1102
+ children: r
1103
+ }
1104
+ ) }) : null;
1105
+ }
1106
+ function os(e) {
1107
+ const [t, r] = kt();
1108
+ return [
1109
+ t,
1110
+ Nt({ provider: r, props: e })
1111
+ ];
1112
+ }
1113
+ const ze = L(void 0), cs = ({ children: e, id: t }) => {
1114
+ const { model: r, ready: n } = Ue(t || ""), s = A(() => n && r ? { model: r } : {}, [n, r]);
1115
+ return /* @__PURE__ */ m(ze.Provider, { value: s, children: e });
1116
+ }, ds = () => {
1117
+ const e = H(ze);
1118
+ if (!e)
1119
+ throw new Error("useHolderContext must be used within a HolderProvider");
1120
+ return e;
1121
+ }, et = L(
1122
+ void 0
1123
+ ), us = ({ children: e }) => {
1124
+ const { model: t, ready: r } = je(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1125
+ return /* @__PURE__ */ m(et.Provider, { value: n, children: e });
1126
+ }, ls = () => {
1127
+ const e = H(et);
1128
+ if (!e)
1129
+ throw new Error(
1130
+ "useHolderContainerContext must be used within a HolderContainerProvider"
1131
+ );
1132
+ return e;
1133
+ }, tt = L(void 0), ms = ({ children: e }) => {
1134
+ const { model: t, ready: r } = Ve(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1135
+ return /* @__PURE__ */ m(tt.Provider, { value: n, children: e });
1136
+ }, ps = () => {
1137
+ const e = H(tt);
1138
+ if (!e)
1139
+ throw new Error(
1140
+ "useIngredientContext must be used within a IngredientProvider"
1141
+ );
1142
+ return e;
1143
+ }, st = L(
1144
+ void 0
1145
+ ), hs = ({ children: e }) => {
1146
+ const { model: t, ready: r } = We(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1147
+ return /* @__PURE__ */ m(st.Provider, { value: n, children: e });
1148
+ }, fs = () => {
1149
+ const e = H(st);
1150
+ if (!e)
1151
+ throw new Error(
1152
+ "useIngredientContainerContext must be used within a IngredientContainerProvider"
1153
+ );
1154
+ return e;
1155
+ }, Ht = () => {
1156
+ const e = He.type;
1157
+ return N({
1158
+ modelId: e,
1159
+ modelType: He.type,
1160
+ options: {}
1161
+ });
1162
+ }, rt = L(void 0), bs = ({ children: e }) => {
1163
+ const { model: t, ready: r } = Ht(), n = A(() => r && t ? { model: t } : {}, [r, t]);
1164
+ return /* @__PURE__ */ m(rt.Provider, { value: n, children: e });
1165
+ }, vs = () => {
1166
+ const e = H(rt);
1167
+ if (!e)
1168
+ throw new Error("usePumpContext must be used within a PumpProvider");
1169
+ return e;
1170
+ };
1171
+ export {
1172
+ Vt as $,
1173
+ zt as A,
1174
+ rs as B,
1175
+ Et as C,
1176
+ At as D,
1177
+ ht as E,
1178
+ Q as F,
1179
+ ne as G,
1180
+ cs as H,
1181
+ ms as I,
1182
+ X as J,
1183
+ $t as K,
1184
+ Yt as L,
1185
+ Tt as M,
1186
+ mt as N,
1187
+ Ke as O,
1188
+ bs as P,
1189
+ vt as Q,
1190
+ Fe as R,
1191
+ _t as S,
1192
+ Ue as T,
1193
+ Gt as U,
1194
+ je as V,
1195
+ Ft as W,
1196
+ Ve as X,
1197
+ Ut as Y,
1198
+ jt as Z,
1199
+ We as _,
1200
+ ts as a,
1201
+ Ye as a0,
1202
+ Wt as a1,
1203
+ bt as a2,
1204
+ qt as a3,
1205
+ Pt as a4,
1206
+ Ge as a5,
1207
+ Jt as a6,
1208
+ Qt as a7,
1209
+ Xt as a8,
1210
+ It as a9,
1211
+ Zt as aa,
1212
+ ss as b,
1213
+ ns as c,
1214
+ is as d,
1215
+ as as e,
1216
+ Nt as f,
1217
+ xt as g,
1218
+ ds as h,
1219
+ os as i,
1220
+ us as j,
1221
+ ls as k,
1222
+ ps as l,
1223
+ hs as m,
1224
+ fs as n,
1225
+ D as o,
1226
+ vs as p,
1227
+ ye as q,
1228
+ De as r,
1229
+ Dt as s,
1230
+ Me as t,
1231
+ es as u,
1232
+ Mt as v,
1233
+ yt as w,
1234
+ Oe as x,
1235
+ Ot as y,
1236
+ pt as z
1237
+ };
1238
+ //# sourceMappingURL=pump-provider-Bv-OLySq.js.map