@kosdev-code/kos-dispense-sdk 0.1.0-dev.5053

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 (346) hide show
  1. package/dispense-registration-manager-BZ5L3AWX.cjs +2 -0
  2. package/dispense-registration-manager-BZ5L3AWX.cjs.map +1 -0
  3. package/dispense-registration-manager-CB_nSTZw.js +1912 -0
  4. package/dispense-registration-manager-CB_nSTZw.js.map +1 -0
  5. package/extension-utils-CkYqorcG.js +381 -0
  6. package/extension-utils-CkYqorcG.js.map +1 -0
  7. package/extension-utils-DUel3wIz.cjs +2 -0
  8. package/extension-utils-DUel3wIz.cjs.map +1 -0
  9. package/extensions/control-pour-extension.d.ts +70 -0
  10. package/extensions/control-pour-extension.d.ts.map +1 -0
  11. package/extensions/index.d.ts +2 -0
  12. package/extensions/index.d.ts.map +1 -0
  13. package/index.cjs +2 -0
  14. package/index.cjs.map +1 -0
  15. package/index.d.ts +6 -0
  16. package/index.d.ts.map +1 -0
  17. package/index.js +133 -0
  18. package/index.js.map +1 -0
  19. package/models/constants/constants.d.ts +230 -0
  20. package/models/constants/constants.d.ts.map +1 -0
  21. package/models/constants/index.d.ts +2 -0
  22. package/models/constants/index.d.ts.map +1 -0
  23. package/models/index.d.ts +6 -0
  24. package/models/index.d.ts.map +1 -0
  25. package/models/models/assembly/assembly-model.d.ts +41 -0
  26. package/models/models/assembly/assembly-model.d.ts.map +1 -0
  27. package/models/models/assembly/assembly-registration.d.ts +81 -0
  28. package/models/models/assembly/assembly-registration.d.ts.map +1 -0
  29. package/models/models/assembly/board-utils.d.ts +6 -0
  30. package/models/models/assembly/board-utils.d.ts.map +1 -0
  31. package/models/models/assembly/holder-utils.d.ts +5 -0
  32. package/models/models/assembly/holder-utils.d.ts.map +1 -0
  33. package/models/models/assembly/index.d.ts +5 -0
  34. package/models/models/assembly/index.d.ts.map +1 -0
  35. package/models/models/assembly/nozzle-utils.d.ts +6 -0
  36. package/models/models/assembly/nozzle-utils.d.ts.map +1 -0
  37. package/models/models/assembly/pump-utils.d.ts +7 -0
  38. package/models/models/assembly/pump-utils.d.ts.map +1 -0
  39. package/models/models/assembly/services/assembly-services.d.ts +8 -0
  40. package/models/models/assembly/services/assembly-services.d.ts.map +1 -0
  41. package/models/models/assembly/services/index.d.ts +2 -0
  42. package/models/models/assembly/services/index.d.ts.map +1 -0
  43. package/models/models/assembly/types/index.d.ts +64 -0
  44. package/models/models/availability/availability-model.d.ts +89 -0
  45. package/models/models/availability/availability-model.d.ts.map +1 -0
  46. package/models/models/availability/index.d.ts +3 -0
  47. package/models/models/availability/index.d.ts.map +1 -0
  48. package/models/models/availability/types/index.d.ts +79 -0
  49. package/models/models/board/board-container-model.d.ts +23 -0
  50. package/models/models/board/board-container-model.d.ts.map +1 -0
  51. package/models/models/board/board-container-registration.d.ts +87 -0
  52. package/models/models/board/board-container-registration.d.ts.map +1 -0
  53. package/models/models/board/board-model.d.ts +18 -0
  54. package/models/models/board/board-model.d.ts.map +1 -0
  55. package/models/models/board/board-registration.d.ts +84 -0
  56. package/models/models/board/board-registration.d.ts.map +1 -0
  57. package/models/models/board/index.d.ts +5 -0
  58. package/models/models/board/index.d.ts.map +1 -0
  59. package/models/models/board/types/index.d.ts +36 -0
  60. package/models/models/board/types/services.d.ts +12 -0
  61. package/models/models/board/types/services.d.ts.map +1 -0
  62. package/models/models/board/utils/board-trouble-data-mapper.d.ts +7 -0
  63. package/models/models/board/utils/board-trouble-data-mapper.d.ts.map +1 -0
  64. package/models/models/board/utils/board-trouble-resolver.d.ts +7 -0
  65. package/models/models/board/utils/board-trouble-resolver.d.ts.map +1 -0
  66. package/models/models/device-assembly/device-assembly-model.d.ts +17 -0
  67. package/models/models/device-assembly/device-assembly-model.d.ts.map +1 -0
  68. package/models/models/device-assembly/device-assembly-registration.d.ts +89 -0
  69. package/models/models/device-assembly/device-assembly-registration.d.ts.map +1 -0
  70. package/models/models/device-assembly/index.d.ts +4 -0
  71. package/models/models/device-assembly/index.d.ts.map +1 -0
  72. package/models/models/device-assembly/types/index.d.ts +1 -0
  73. package/models/models/generic-pour/generic-pour-model.d.ts +53 -0
  74. package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -0
  75. package/models/models/generic-pour/generic-pour-registration.d.ts +87 -0
  76. package/models/models/generic-pour/generic-pour-registration.d.ts.map +1 -0
  77. package/models/models/generic-pour/index.d.ts +5 -0
  78. package/models/models/generic-pour/index.d.ts.map +1 -0
  79. package/models/models/generic-pour/services/generic-pour-services.d.ts +16 -0
  80. package/models/models/generic-pour/services/generic-pour-services.d.ts.map +1 -0
  81. package/models/models/generic-pour/services/index.d.ts +2 -0
  82. package/models/models/generic-pour/services/index.d.ts.map +1 -0
  83. package/models/models/generic-pour/types/index.d.ts +5 -0
  84. package/models/models/holder/holder-model.d.ts +93 -0
  85. package/models/models/holder/holder-model.d.ts.map +1 -0
  86. package/models/models/holder/index.d.ts +5 -0
  87. package/models/models/holder/index.d.ts.map +1 -0
  88. package/models/models/holder/services/assignment-services.d.ts +25 -0
  89. package/models/models/holder/services/assignment-services.d.ts.map +1 -0
  90. package/models/models/holder/services/holder-services.d.ts +28 -0
  91. package/models/models/holder/services/holder-services.d.ts.map +1 -0
  92. package/models/models/holder/services/index.d.ts +3 -0
  93. package/models/models/holder/services/index.d.ts.map +1 -0
  94. package/models/models/holder/types/index.d.ts +170 -0
  95. package/models/models/holder/utils/holder-utils.d.ts +9 -0
  96. package/models/models/holder/utils/holder-utils.d.ts.map +1 -0
  97. package/models/models/holder-container/holder-container-model.d.ts +80 -0
  98. package/models/models/holder-container/holder-container-model.d.ts.map +1 -0
  99. package/models/models/holder-container/index.d.ts +3 -0
  100. package/models/models/holder-container/index.d.ts.map +1 -0
  101. package/models/models/holder-container/types/index.d.ts +69 -0
  102. package/models/models/index.d.ts +14 -0
  103. package/models/models/index.d.ts.map +1 -0
  104. package/models/models/ingredient/index.d.ts +4 -0
  105. package/models/models/ingredient/index.d.ts.map +1 -0
  106. package/models/models/ingredient/ingredient-model.d.ts +86 -0
  107. package/models/models/ingredient/ingredient-model.d.ts.map +1 -0
  108. package/models/models/ingredient/services/index.d.ts +2 -0
  109. package/models/models/ingredient/services/index.d.ts.map +1 -0
  110. package/models/models/ingredient/services/ingredient-services.d.ts +30 -0
  111. package/models/models/ingredient/services/ingredient-services.d.ts.map +1 -0
  112. package/models/models/ingredient/types/index.d.ts +67 -0
  113. package/models/models/ingredient-container/index.d.ts +3 -0
  114. package/models/models/ingredient-container/index.d.ts.map +1 -0
  115. package/models/models/ingredient-container/ingredient-container-model.d.ts +80 -0
  116. package/models/models/ingredient-container/ingredient-container-model.d.ts.map +1 -0
  117. package/models/models/ingredient-container/types/index.d.ts +67 -0
  118. package/models/models/nozzle/index.d.ts +5 -0
  119. package/models/models/nozzle/index.d.ts.map +1 -0
  120. package/models/models/nozzle/nozzle-model.d.ts +257 -0
  121. package/models/models/nozzle/nozzle-model.d.ts.map +1 -0
  122. package/models/models/nozzle/services/index.d.ts +2 -0
  123. package/models/models/nozzle/services/index.d.ts.map +1 -0
  124. package/models/models/nozzle/services/nozzle-services.d.ts +182 -0
  125. package/models/models/nozzle/services/nozzle-services.d.ts.map +1 -0
  126. package/models/models/nozzle/types/index.d.ts +85 -0
  127. package/models/models/pump/index.d.ts +4 -0
  128. package/models/models/pump/index.d.ts.map +1 -0
  129. package/models/models/pump/pump-model.d.ts +91 -0
  130. package/models/models/pump/pump-model.d.ts.map +1 -0
  131. package/models/models/pump/services/index.d.ts +2 -0
  132. package/models/models/pump/services/index.d.ts.map +1 -0
  133. package/models/models/pump/services/pump-services.d.ts +27 -0
  134. package/models/models/pump/services/pump-services.d.ts.map +1 -0
  135. package/models/models/pump/types/index.d.ts +56 -0
  136. package/models/models/pump/utils/pump-trouble-resolver.d.ts +8 -0
  137. package/models/models/pump/utils/pump-trouble-resolver.d.ts.map +1 -0
  138. package/models/models/pump-container/index.d.ts +3 -0
  139. package/models/models/pump-container/index.d.ts.map +1 -0
  140. package/models/models/pump-container/pump-container-model.d.ts +85 -0
  141. package/models/models/pump-container/pump-container-model.d.ts.map +1 -0
  142. package/models/models/pump-container/types/index.d.ts +31 -0
  143. package/models/models/types/assembly.d.ts +83 -0
  144. package/models/models/types/assembly.d.ts.map +1 -0
  145. package/models/models/types/index.d.ts +4 -0
  146. package/models/models/types/index.d.ts.map +1 -0
  147. package/models/models/types/intent.d.ts +19 -0
  148. package/models/models/types/intent.d.ts.map +1 -0
  149. package/models/models/types/pouring.d.ts +9 -0
  150. package/models/models/types/pouring.d.ts.map +1 -0
  151. package/models/utils/dispense-registration-manager.d.ts +28 -0
  152. package/models/utils/dispense-registration-manager.d.ts.map +1 -0
  153. package/models/utils/extension-utils.d.ts +266 -0
  154. package/models/utils/extension-utils.d.ts.map +1 -0
  155. package/models/utils/openapi.d.ts +9276 -0
  156. package/models/utils/registration.d.ts +4 -0
  157. package/models/utils/registration.d.ts.map +1 -0
  158. package/models/utils/service.d.ts +80 -0
  159. package/models/utils/service.d.ts.map +1 -0
  160. package/models.cjs +2 -0
  161. package/models.cjs.map +1 -0
  162. package/models.d.ts +1 -0
  163. package/models.js +42 -0
  164. package/models.js.map +1 -0
  165. package/package.json +39 -0
  166. package/pump-provider-86479YU2.cjs +2 -0
  167. package/pump-provider-86479YU2.cjs.map +1 -0
  168. package/pump-provider-DSyiDoPF.js +1304 -0
  169. package/pump-provider-DSyiDoPF.js.map +1 -0
  170. package/ui/contexts/assembly/assembly-provider.d.ts +12 -0
  171. package/ui/contexts/assembly/assembly-provider.d.ts.map +1 -0
  172. package/ui/contexts/assembly/index.d.ts +2 -0
  173. package/ui/contexts/assembly/index.d.ts.map +1 -0
  174. package/ui/contexts/availability/availability-provider.d.ts +13 -0
  175. package/ui/contexts/availability/availability-provider.d.ts.map +1 -0
  176. package/ui/contexts/availability/index.d.ts +2 -0
  177. package/ui/contexts/availability/index.d.ts.map +1 -0
  178. package/ui/contexts/board/board-provider.d.ts +13 -0
  179. package/ui/contexts/board/board-provider.d.ts.map +1 -0
  180. package/ui/contexts/board/index.d.ts +2 -0
  181. package/ui/contexts/board/index.d.ts.map +1 -0
  182. package/ui/contexts/board-container/board-container-provider.d.ts +12 -0
  183. package/ui/contexts/board-container/board-container-provider.d.ts.map +1 -0
  184. package/ui/contexts/board-container/index.d.ts +2 -0
  185. package/ui/contexts/board-container/index.d.ts.map +1 -0
  186. package/ui/contexts/cui-kit/cui-kit.d.ts +29 -0
  187. package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -0
  188. package/ui/contexts/cui-kit/index.d.ts +2 -0
  189. package/ui/contexts/cui-kit/index.d.ts.map +1 -0
  190. package/ui/contexts/device-assembly/device-assembly-provider.d.ts +12 -0
  191. package/ui/contexts/device-assembly/device-assembly-provider.d.ts.map +1 -0
  192. package/ui/contexts/device-assembly/index.d.ts +2 -0
  193. package/ui/contexts/device-assembly/index.d.ts.map +1 -0
  194. package/ui/contexts/holder/holder-provider.d.ts +13 -0
  195. package/ui/contexts/holder/holder-provider.d.ts.map +1 -0
  196. package/ui/contexts/holder/index.d.ts +2 -0
  197. package/ui/contexts/holder/index.d.ts.map +1 -0
  198. package/ui/contexts/holder-container/holder-container-provider.d.ts +13 -0
  199. package/ui/contexts/holder-container/holder-container-provider.d.ts.map +1 -0
  200. package/ui/contexts/holder-container/index.d.ts +2 -0
  201. package/ui/contexts/holder-container/index.d.ts.map +1 -0
  202. package/ui/contexts/index.d.ts +13 -0
  203. package/ui/contexts/index.d.ts.map +1 -0
  204. package/ui/contexts/ingredient/index.d.ts +2 -0
  205. package/ui/contexts/ingredient/index.d.ts.map +1 -0
  206. package/ui/contexts/ingredient/ingredient-provider.d.ts +13 -0
  207. package/ui/contexts/ingredient/ingredient-provider.d.ts.map +1 -0
  208. package/ui/contexts/ingredient-container/index.d.ts +2 -0
  209. package/ui/contexts/ingredient-container/index.d.ts.map +1 -0
  210. package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts +13 -0
  211. package/ui/contexts/ingredient-container/ingredient-container-provider.d.ts.map +1 -0
  212. package/ui/contexts/nozzle/index.d.ts +2 -0
  213. package/ui/contexts/nozzle/index.d.ts.map +1 -0
  214. package/ui/contexts/nozzle/nozzle-provider.d.ts +13 -0
  215. package/ui/contexts/nozzle/nozzle-provider.d.ts.map +1 -0
  216. package/ui/contexts/pump/index.d.ts +2 -0
  217. package/ui/contexts/pump/index.d.ts.map +1 -0
  218. package/ui/contexts/pump/pump-provider.d.ts +13 -0
  219. package/ui/contexts/pump/pump-provider.d.ts.map +1 -0
  220. package/ui/hooks/assembly/index.d.ts +3 -0
  221. package/ui/hooks/assembly/index.d.ts.map +1 -0
  222. package/ui/hooks/assembly/use-assembly.d.ts +14 -0
  223. package/ui/hooks/assembly/use-assembly.d.ts.map +1 -0
  224. package/ui/hooks/assembly/with-assembly.d.ts +8 -0
  225. package/ui/hooks/assembly/with-assembly.d.ts.map +1 -0
  226. package/ui/hooks/availability/index.d.ts +3 -0
  227. package/ui/hooks/availability/index.d.ts.map +1 -0
  228. package/ui/hooks/availability/use-availability.d.ts +14 -0
  229. package/ui/hooks/availability/use-availability.d.ts.map +1 -0
  230. package/ui/hooks/availability/with-availability.d.ts +8 -0
  231. package/ui/hooks/availability/with-availability.d.ts.map +1 -0
  232. package/ui/hooks/board/index.d.ts +3 -0
  233. package/ui/hooks/board/index.d.ts.map +1 -0
  234. package/ui/hooks/board/use-board.d.ts +14 -0
  235. package/ui/hooks/board/use-board.d.ts.map +1 -0
  236. package/ui/hooks/board/with-board.d.ts +8 -0
  237. package/ui/hooks/board/with-board.d.ts.map +1 -0
  238. package/ui/hooks/board-container/index.d.ts +3 -0
  239. package/ui/hooks/board-container/index.d.ts.map +1 -0
  240. package/ui/hooks/board-container/use-board-container.d.ts +14 -0
  241. package/ui/hooks/board-container/use-board-container.d.ts.map +1 -0
  242. package/ui/hooks/board-container/with-board-container.d.ts +8 -0
  243. package/ui/hooks/board-container/with-board-container.d.ts.map +1 -0
  244. package/ui/hooks/cui-kit/index.d.ts +8 -0
  245. package/ui/hooks/cui-kit/index.d.ts.map +1 -0
  246. package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts +18 -0
  247. package/ui/hooks/cui-kit/use-ambient-attract-timers.d.ts.map +1 -0
  248. package/ui/hooks/cui-kit/use-beverages.d.ts +17 -0
  249. package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -0
  250. package/ui/hooks/cui-kit/use-brands.d.ts +17 -0
  251. package/ui/hooks/cui-kit/use-brands.d.ts.map +1 -0
  252. package/ui/hooks/cui-kit/use-cui-kit.d.ts +192 -0
  253. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -0
  254. package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts +162 -0
  255. package/ui/hooks/cui-kit/use-default-cui-kit-lifecycle.d.ts.map +1 -0
  256. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +23 -0
  257. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -0
  258. package/ui/hooks/cui-kit/use-dispense-timers.d.ts +17 -0
  259. package/ui/hooks/cui-kit/use-dispense-timers.d.ts.map +1 -0
  260. package/ui/hooks/cui-kit/use-flavors.d.ts +17 -0
  261. package/ui/hooks/cui-kit/use-flavors.d.ts.map +1 -0
  262. package/ui/hooks/device-assembly/index.d.ts +3 -0
  263. package/ui/hooks/device-assembly/index.d.ts.map +1 -0
  264. package/ui/hooks/device-assembly/use-device-assembly.d.ts +14 -0
  265. package/ui/hooks/device-assembly/use-device-assembly.d.ts.map +1 -0
  266. package/ui/hooks/device-assembly/with-device-assembly.d.ts +9 -0
  267. package/ui/hooks/device-assembly/with-device-assembly.d.ts.map +1 -0
  268. package/ui/hooks/generic-pour/index.d.ts +3 -0
  269. package/ui/hooks/generic-pour/index.d.ts.map +1 -0
  270. package/ui/hooks/generic-pour/use-generic-pour.d.ts +15 -0
  271. package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -0
  272. package/ui/hooks/generic-pour/with-generic-pour.d.ts +14 -0
  273. package/ui/hooks/generic-pour/with-generic-pour.d.ts.map +1 -0
  274. package/ui/hooks/holder/index.d.ts +3 -0
  275. package/ui/hooks/holder/index.d.ts.map +1 -0
  276. package/ui/hooks/holder/use-holder.d.ts +14 -0
  277. package/ui/hooks/holder/use-holder.d.ts.map +1 -0
  278. package/ui/hooks/holder/with-holder.d.ts +8 -0
  279. package/ui/hooks/holder/with-holder.d.ts.map +1 -0
  280. package/ui/hooks/holder-container/index.d.ts +3 -0
  281. package/ui/hooks/holder-container/index.d.ts.map +1 -0
  282. package/ui/hooks/holder-container/use-holder-container.d.ts +14 -0
  283. package/ui/hooks/holder-container/use-holder-container.d.ts.map +1 -0
  284. package/ui/hooks/holder-container/with-holder-container.d.ts +8 -0
  285. package/ui/hooks/holder-container/with-holder-container.d.ts.map +1 -0
  286. package/ui/hooks/index.d.ts +16 -0
  287. package/ui/hooks/index.d.ts.map +1 -0
  288. package/ui/hooks/ingredient/index.d.ts +4 -0
  289. package/ui/hooks/ingredient/index.d.ts.map +1 -0
  290. package/ui/hooks/ingredient/use-ingredient-pour.d.ts +49 -0
  291. package/ui/hooks/ingredient/use-ingredient-pour.d.ts.map +1 -0
  292. package/ui/hooks/ingredient/use-ingredient.d.ts +14 -0
  293. package/ui/hooks/ingredient/use-ingredient.d.ts.map +1 -0
  294. package/ui/hooks/ingredient/with-ingredient.d.ts +8 -0
  295. package/ui/hooks/ingredient/with-ingredient.d.ts.map +1 -0
  296. package/ui/hooks/ingredient-container/index.d.ts +3 -0
  297. package/ui/hooks/ingredient-container/index.d.ts.map +1 -0
  298. package/ui/hooks/ingredient-container/use-ingredient-container.d.ts +14 -0
  299. package/ui/hooks/ingredient-container/use-ingredient-container.d.ts.map +1 -0
  300. package/ui/hooks/ingredient-container/with-ingredient-container.d.ts +8 -0
  301. package/ui/hooks/ingredient-container/with-ingredient-container.d.ts.map +1 -0
  302. package/ui/hooks/nozzle/index.d.ts +3 -0
  303. package/ui/hooks/nozzle/index.d.ts.map +1 -0
  304. package/ui/hooks/nozzle/use-dispense-kit.d.ts +22 -0
  305. package/ui/hooks/nozzle/use-dispense-kit.d.ts.map +1 -0
  306. package/ui/hooks/nozzle/use-nozzle.d.ts +14 -0
  307. package/ui/hooks/nozzle/use-nozzle.d.ts.map +1 -0
  308. package/ui/hooks/nozzle/with-nozzle.d.ts +8 -0
  309. package/ui/hooks/nozzle/with-nozzle.d.ts.map +1 -0
  310. package/ui/hooks/nozzle-pour/index.d.ts +2 -0
  311. package/ui/hooks/nozzle-pour/index.d.ts.map +1 -0
  312. package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts +57 -0
  313. package/ui/hooks/nozzle-pour/use-nozzle-pour.d.ts.map +1 -0
  314. package/ui/hooks/pour/index.d.ts +2 -0
  315. package/ui/hooks/pour/index.d.ts.map +1 -0
  316. package/ui/hooks/pour/use-pour.d.ts +55 -0
  317. package/ui/hooks/pour/use-pour.d.ts.map +1 -0
  318. package/ui/hooks/pump/index.d.ts +3 -0
  319. package/ui/hooks/pump/index.d.ts.map +1 -0
  320. package/ui/hooks/pump/use-pump.d.ts +14 -0
  321. package/ui/hooks/pump/use-pump.d.ts.map +1 -0
  322. package/ui/hooks/pump/with-pump.d.ts +8 -0
  323. package/ui/hooks/pump/with-pump.d.ts.map +1 -0
  324. package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts +5 -0
  325. package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -0
  326. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts +4 -0
  327. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -0
  328. package/ui/hooks/utils/pour-strategy/index.d.ts +7 -0
  329. package/ui/hooks/utils/pour-strategy/index.d.ts.map +1 -0
  330. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +16 -0
  331. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -0
  332. package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts +13 -0
  333. package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -0
  334. package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts +5 -0
  335. package/ui/hooks/utils/pour-strategy/tap-to-pour-intent-strategy.d.ts.map +1 -0
  336. package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts +4 -0
  337. package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -0
  338. package/ui/index.d.ts +4 -0
  339. package/ui/index.d.ts.map +1 -0
  340. package/ui/utils/pour-context.d.ts +8 -0
  341. package/ui/utils/pour-context.d.ts.map +1 -0
  342. package/ui.cjs +2 -0
  343. package/ui.cjs.map +1 -0
  344. package/ui.d.ts +1 -0
  345. package/ui.js +75 -0
  346. package/ui.js.map +1 -0
@@ -0,0 +1,1912 @@
1
+ var ct = Object.defineProperty;
2
+ var pt = (e, t, r) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var o = (e, t, r) => (pt(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { kosModel as I, Kos as v, isKosModel as b, resolveServiceUrl as S, ServiceFactory as C, KosLog as f, KosModelContainer as R, KosExtensionUtils as T, kosChild as M, FetchError as ht, ExtensionManager as u, EXTENSION_TROUBLE_MAPPER as be, EXTENSION_TROUBLE_DATA_MAPPER as q, getKosModelSync as z, kosDependency as Le, kosTroubleAware as ut, kosAction as g, kosTopicHandler as W, DependencyLifecycle as xe, getKosModel as Ae, FutureManager as ce, kosFuture as pe, FutureHandler as Be, EXTENSION_FEATURE_FLAG_RESOLVER as gt, isKosDataModel as yt, ChildModels as It, KosFeatureFlags as mt, kosParentAware as ft, createPropKey as Pt, MultipleFutureHandler as vt, arraysEqual as bt, getAllKosCompanionModels as E, EventBus as _, KosContextManager as _t, destroyKosModel as Mt, SingletonKosModelRegistrationFactory as Ot, kosLoggerAware as Et, kosFutureAware as wt, ObservableData as Ce, KosModelRegistrationFactory as $t, KosModelRegistry as St, RegistrationManager as O, registerCoreModels as Ct, registerLegacyModel as Rt } from "@kosdev-code/kos-ui-sdk";
5
+ import "react";
6
+ var h = /* @__PURE__ */ ((e) => (e.IngredientLoader = "kos.ingredient.loader", e.IngredientMapper = "kos.ingredient.mapper", e.IngredientIndex = "kos.ingredient.index", e.IngredientTypeMapper = "kos.ingredient.type.mapper", e.HolderTypeMapper = "kos.holder.type.mapper", e.HolderMapper = "kos.holder.mapper", e.HolderIndex = "kos.holder.index", e.HolderIngredientMapper = "kos.holder.ingredient.mapper", e.AvailabilityMapper = "kos.availability.mapper", e.AvailabilityLoader = "kos.availability.loader", e.SelectedPourableMapper = "kos.selected.pourable.mapper", e.AssemblyMapper = "kos.assembly.mapper", e.BoardMapper = "kos.board.mapper", e.BoardIndex = "kos.board.index", e.PumpIndex = "kos.pump.index", e.AssemblyFeatureFlags = "kos.assembly.feature.flags", e))(h || {}), D = /* @__PURE__ */ ((e) => (e.Nozzle = "nozzle-model", e.Availability = "availability-model", e.Holder = "holder-model", e.HolderContainer = "holder-container-model", e.IngredientContainer = "ingredient-container-model", e.Ingredient = "ingredient-model", e.Pump = "pump-model", e.PumpContainer = "pump-container-model", e))(D || {}), Dt = Object.getOwnPropertyDescriptor, Nt = (e, t, r, a) => {
7
+ for (var i = a > 1 ? void 0 : a ? Dt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
8
+ (n = e[s]) && (i = n(i) || i);
9
+ return i;
10
+ };
11
+ const U = "ingredient-model";
12
+ let me = class {
13
+ constructor(e, {
14
+ name: t,
15
+ type: r,
16
+ data: a,
17
+ ingredientId: i,
18
+ ...s
19
+ }) {
20
+ o(this, "id");
21
+ o(this, "ingredientId");
22
+ o(this, "name");
23
+ o(this, "type");
24
+ o(this, "data");
25
+ this.id = e, this.ingredientId = i, this.name = t, this.type = r, this.data = a, Object.assign(this, s);
26
+ }
27
+ updateModel({
28
+ name: e,
29
+ type: t,
30
+ data: r,
31
+ ingredientId: a,
32
+ ...i
33
+ }) {
34
+ this.name = e, this.type = t, this.ingredientId = a, this.data = r, Object.assign(this, i);
35
+ }
36
+ // -------------------LIFECYCLE----------------------------
37
+ // -------------------ENTITY----------------------------
38
+ };
39
+ me = Nt([
40
+ I(U)
41
+ ], me);
42
+ const Ue = {
43
+ registration: {
44
+ [U]: {
45
+ class: me,
46
+ singleton: !1
47
+ }
48
+ },
49
+ type: U,
50
+ predicate: b(U),
51
+ factory: v.Factory.create(U)
52
+ }, { URL: Ge } = S("INGREDIENT_SERVICE"), { getOne: Tt } = C.build({
53
+ basePath: `${Ge}/api/ext/dispense/ingredients`
54
+ }), zt = async () => await Tt({
55
+ urlOverride: `${Ge}/api/ext/dispense/ingredients`
56
+ });
57
+ var Lt = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, je = (e, t, r, a) => {
58
+ for (var i = a > 1 ? void 0 : a ? xt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
59
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
60
+ return a && i && Lt(t, r, i), i;
61
+ };
62
+ const G = "ingredient-container-model", At = f.createLogger({ name: "ingredient-container-model" });
63
+ let ie = class {
64
+ constructor(e, t) {
65
+ o(this, "id");
66
+ o(this, "ingredients");
67
+ this.id = e, this.ingredients = new R({
68
+ indexMap: {
69
+ ingredientType: "type"
70
+ },
71
+ extensionId: h.IngredientIndex,
72
+ parentId: e
73
+ });
74
+ }
75
+ updateModel() {
76
+ }
77
+ // -------------------LIFECYCLE----------------------------
78
+ getIngredientsByType(e) {
79
+ return this.ingredients.getIndexByKey("ingredientType", e);
80
+ }
81
+ async load(e) {
82
+ var i;
83
+ At.debug(`loading ingredient container ${this.id}`);
84
+ const t = await zt();
85
+ if ((t == null ? void 0 : t.status) !== 200)
86
+ throw new Error("Failed to load ingredients");
87
+ const r = await T.executeLoaderExtension({
88
+ context: e,
89
+ extension: h.IngredientLoader
90
+ }), a = (t == null ? void 0 : t.data) ?? {};
91
+ for (const s of Object.keys(a))
92
+ for (const n of ((i = t == null ? void 0 : t.data) == null ? void 0 : i[s]) || []) {
93
+ const c = await T.executeDataMapperExtension({
94
+ extension: h.IngredientMapper,
95
+ data: n,
96
+ contextData: r
97
+ }), l = await T.executePropertyMapperExtension({
98
+ extension: h.IngredientTypeMapper,
99
+ data: n,
100
+ contextData: r
101
+ }), p = {
102
+ ...n,
103
+ type: l || n.type,
104
+ ...c,
105
+ data: c
106
+ }, y = Ue.factory(n.id)(
107
+ p
108
+ );
109
+ this.ingredients.addModel(y);
110
+ }
111
+ }
112
+ // -------------------ENTITY----------------------------
113
+ };
114
+ je([
115
+ M
116
+ ], ie.prototype, "ingredients", 2);
117
+ ie = je([
118
+ I(G)
119
+ ], ie);
120
+ const Fe = {
121
+ registration: {
122
+ [G]: {
123
+ class: ie,
124
+ singleton: !0
125
+ }
126
+ },
127
+ type: G,
128
+ predicate: b(G),
129
+ factory: v.Singleton.create(G)
130
+ }, { URL: he } = S("HOLDER_SERVICE"), { getAll: Bt, postModel: He, deleteModel: Ut } = C.build({
131
+ basePath: `${he}/api/kos/holders`
132
+ }), Gt = f.createLogger({
133
+ name: "holder-service",
134
+ group: "Services"
135
+ }), ai = async () => await Bt({}), jt = async (e, t) => {
136
+ if (!e || !t)
137
+ throw new Error("Missing holderPath or ingredientId");
138
+ return await He({
139
+ model: { holderPath: e, ingredientId: t },
140
+ urlOverride: `${he}/api/ext/dispense/assignments`
141
+ });
142
+ }, Ft = async (e) => {
143
+ if (!e)
144
+ throw new Error("Missing holderPath");
145
+ return await Ut({
146
+ id: e,
147
+ urlOverride: `${he}/api/ext/dispense/assignments/${e}`
148
+ });
149
+ }, Ht = async (e) => {
150
+ if (!e)
151
+ throw new Error("Missing holderPath");
152
+ return Gt.debug(
153
+ `sending POST request to /api/ext/dispense/pumpEvents/replaceLine/${e}`
154
+ ), await He({
155
+ model: {},
156
+ urlOverride: `${he}/api/ext/dispense/pumpEvents/replaceLine/${e}`
157
+ });
158
+ }, { URL: ae } = S("ASSIGNMENT_SERVICE"), { getAll: Vt, postModel: Ve, deleteModel: Kt } = C.build({
159
+ destinationAddress: "",
160
+ basePath: `${ae}/api/ext/dispense/assignments`
161
+ }), se = window.kosUseFos, si = async () => await Vt({ fos: se }), kt = async (e, t) => {
162
+ var i, s, n, c;
163
+ const r = JSON.stringify(t), a = `${ae}/api/ext/dispense/assignments`;
164
+ try {
165
+ const l = await Ve({
166
+ model: { holderPath: e, factoryJson: r },
167
+ urlOverride: a
168
+ });
169
+ return (l == null ? void 0 : l.status) === 200 && ((i = l == null ? void 0 : l.data) != null && i.error) ? [l.data.error || "unknownError", l.data] : [void 0, l == null ? void 0 : l.data];
170
+ } catch (l) {
171
+ if (l instanceof ht)
172
+ return [
173
+ ((n = (s = l.payload) == null ? void 0 : s.data) == null ? void 0 : n.error) || "unknownError",
174
+ (c = l.payload) == null ? void 0 : c.data
175
+ ];
176
+ }
177
+ return ["unknownError", void 0];
178
+ }, ni = async (e) => {
179
+ const t = se ? `${ae}/api/ingredients/assignments/${e.holderPath}` : `${ae}/api/ext/dispense/assignments`;
180
+ return await Ve({
181
+ model: { ...e, fuelGauge: 680 },
182
+ fos: se,
183
+ urlOverride: t
184
+ });
185
+ }, oi = async (e) => await Kt({ id: e, fos: se });
186
+ var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, _e = (e, t, r, a) => {
187
+ for (var i = a > 1 ? void 0 : a ? Zt(t, r) : t, s = e.length - 1, n; s >= 0; s--)
188
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
189
+ return a && i && Yt(t, r, i), i;
190
+ };
191
+ const j = D.Holder, Re = f.createLogger({ name: "holder-model" });
192
+ u[be].register(
193
+ "holder",
194
+ async (e) => {
195
+ const t = [];
196
+ return t.push(...e.data.holderPaths), t;
197
+ }
198
+ );
199
+ u[q].register(
200
+ "pump",
201
+ async (e) => {
202
+ if (e.data.pumpPath) {
203
+ const { model: t } = z(
204
+ e.data.pumpPath
205
+ );
206
+ if (t) {
207
+ const r = t.ingredientId ? z(t.ingredientId).model : void 0;
208
+ return {
209
+ ingredientId: t.ingredientId,
210
+ ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
211
+ childPumpName: t.name
212
+ };
213
+ }
214
+ }
215
+ return {};
216
+ }
217
+ );
218
+ u[q].register(
219
+ "holder",
220
+ async (e) => e.data.holderNames.length > 0 ? {
221
+ holderName: e.data.holderNames[0] || ""
222
+ } : {}
223
+ );
224
+ u[q].register(
225
+ "container",
226
+ async (e) => {
227
+ if (e.data.ingredients.length > 0) {
228
+ const t = e.data.ingredients[0], { model: r } = z(t);
229
+ return {
230
+ ingredientName: (r == null ? void 0 : r.displayName) ?? ((r == null ? void 0 : r.name) || ""),
231
+ ingredients: e.data.ingredients ? e.data.ingredients : [],
232
+ unknonwnIngredientId: e.data.unknonwnIngredientId ?? ""
233
+ };
234
+ }
235
+ return {};
236
+ }
237
+ );
238
+ class Xt extends Error {
239
+ constructor(r, a) {
240
+ super(a);
241
+ o(this, "type");
242
+ this.name = "AssignmentError", this.type = r;
243
+ }
244
+ }
245
+ let J = class {
246
+ constructor(e, {
247
+ path: t,
248
+ name: r,
249
+ ingredientSource: a,
250
+ ingredientId: i,
251
+ ingredientType: s,
252
+ slice: n,
253
+ group: c,
254
+ data: l,
255
+ enjoyByDate: p
256
+ }, y) {
257
+ o(this, "id");
258
+ o(this, "path");
259
+ o(this, "name");
260
+ o(this, "ingredientId");
261
+ o(this, "ingredientType");
262
+ o(this, "ingredientSource");
263
+ o(this, "group");
264
+ o(this, "slice");
265
+ o(this, "logger");
266
+ o(this, "data");
267
+ o(this, "enjoyByDate");
268
+ o(this, "pumps");
269
+ o(this, "ingredientContainer");
270
+ this.id = e, this.path = t, this.name = r, this.ingredientType = s, this.ingredientSource = a, this.ingredientId = i, this.group = c, this.slice = n, this.enjoyByDate = p, this.data = l, this.pumps = new R({
271
+ parentId: e,
272
+ sortKey: "path"
273
+ }), this.logger = y.logger;
274
+ }
275
+ updateModel({
276
+ path: e,
277
+ name: t,
278
+ ingredientSource: r,
279
+ ingredientId: a,
280
+ ingredientType: i,
281
+ group: s,
282
+ slice: n,
283
+ enjoyByDate: c,
284
+ data: l
285
+ }) {
286
+ this.path = e, this.name = t, this.ingredientId = a, this.ingredientType = i, this.ingredientSource = r, this.enjoyByDate = c, this.slice = n, this.group = s, this.data = l;
287
+ }
288
+ get hasEnjoyByDate() {
289
+ return !!this.enjoyByDate && !this.unassigned;
290
+ }
291
+ get hasEnjoyByWarning() {
292
+ var e;
293
+ return ((e = this.troublesByType.EnjoyByTrouble) == null ? void 0 : e.length) > 0;
294
+ }
295
+ get nozzlePaths() {
296
+ return this.pumps.data.map((e) => e.nozzlePath);
297
+ }
298
+ async cancelPour() {
299
+ await Promise.all(
300
+ this.pumps.data.filter((e) => e.isPouring).map((e) => e.cancelPour())
301
+ );
302
+ }
303
+ get canPour() {
304
+ return !this.shouldDefer && this.pumps.data.every((e) => e.canPour);
305
+ }
306
+ get isPouring() {
307
+ const e = this.pumps.data.some((t) => t.isPouring);
308
+ return this.logger.debug(`isPouring: ${!!e}`), e;
309
+ }
310
+ async performIntent(e) {
311
+ const t = typeof e == "string" ? e : e.intent, r = typeof e == "string" ? void 0 : e.pumpPath, a = r ? this.pumps.getModel(r) : this.pumps.data[0];
312
+ return a == null ? void 0 : a.performIntent({ intent: t });
313
+ }
314
+ get pourState() {
315
+ return this.pumps.data.reduce((t, r) => r.pouringState ? r.pouringState : t, "");
316
+ }
317
+ get nozzlePath() {
318
+ var e;
319
+ return (e = this.pumps.data[0]) == null ? void 0 : e.nozzlePath;
320
+ }
321
+ get pumpPaths() {
322
+ return this.pumps.data.map((e) => e.id);
323
+ }
324
+ get sortedPumps() {
325
+ return this.pumps.data.sort((e, t) => e.virtual && !t.virtual ? -1 : !e.virtual && t.virtual ? 1 : e.name.localeCompare(t.name));
326
+ }
327
+ get ingredient() {
328
+ var t;
329
+ return this.ingredientId ? (t = this.ingredientContainer) == null ? void 0 : t.ingredients.getModel(
330
+ this.ingredientId
331
+ ) : void 0;
332
+ }
333
+ get ingredientName() {
334
+ return this.ingredient ? this.ingredient.displayName ?? this.ingredient.name : this.ingredientId ? "unknown" : "";
335
+ }
336
+ get previousIngredient() {
337
+ var t;
338
+ return this.prevIngredientId ? (t = this.ingredientContainer) == null ? void 0 : t.ingredients.getModel(
339
+ this.prevIngredientId
340
+ ) : void 0;
341
+ }
342
+ get previousIngredientName() {
343
+ return this.previousIngredient ? this.previousIngredient.displayName ?? this.previousIngredient.name : this.prevIngredientId ? "unknown" : "";
344
+ }
345
+ get prevIngredientId() {
346
+ var e, t;
347
+ return (t = (e = this.pumps.data) == null ? void 0 : e[0]) == null ? void 0 : t.prevIngredientId;
348
+ }
349
+ get unassigned() {
350
+ return (!this.ingredientId || this.ingredientId === "0") && (!this.prevIngredientId || this.prevIngredientId === "0");
351
+ }
352
+ get removed() {
353
+ return (!this.ingredientId || this.ingredientId === "0") && this.prevIngredientId !== void 0 && this.prevIngredientId !== "0";
354
+ }
355
+ get maxVolume() {
356
+ return this.slice.maxVolMl ?? 0;
357
+ }
358
+ get remainingVolume() {
359
+ return this.slice.currentVolMl ?? 0;
360
+ }
361
+ get hasMaxVolume() {
362
+ return this.slice.maxVolMl !== void 0;
363
+ }
364
+ get hasRemainingVolume() {
365
+ return this.slice.currentVolMl !== void 0;
366
+ }
367
+ get fillPercent() {
368
+ return this.remainingVolume <= 0 ? 0 : Math.floor((this.remainingVolume || 1) / (this.maxVolume || 1) * 100);
369
+ }
370
+ get hasFuelGuage() {
371
+ return this.hasMaxVolume && this.hasRemainingVolume;
372
+ }
373
+ updateIngredient(e) {
374
+ this.ingredientId !== e && g(() => {
375
+ this.ingredientId = e;
376
+ });
377
+ }
378
+ async resolveIntentVolume(e) {
379
+ const t = this.pumps.data[0];
380
+ return t ? t.resolveIntentVolume(e) : { volume: -1 };
381
+ }
382
+ async overrideRfidCode(e) {
383
+ if (!e)
384
+ throw new Error("Invalid override");
385
+ try {
386
+ const [t, r] = await kt(this.path, e);
387
+ if (t)
388
+ throw new Xt(
389
+ t,
390
+ `Failed to perform rfid override on holder ${this.id}`
391
+ );
392
+ return g(() => {
393
+ this.ingredientId = r == null ? void 0 : r.ingredientId;
394
+ }), r;
395
+ } catch (t) {
396
+ throw Re.error(`Failed to perform rfid override on holder ${this.id}`, t), t;
397
+ }
398
+ }
399
+ async assignIngredient(e) {
400
+ try {
401
+ e ? await jt(this.path, e) : await Ft(this.path), g(() => {
402
+ this.ingredientId = e;
403
+ });
404
+ } catch (t) {
405
+ throw Re.error(`Failed to perform assign ingredient to holder ${this.id}`, t), t;
406
+ }
407
+ }
408
+ get shouldDefer() {
409
+ return this.troubles.some((e) => e.shouldDefer);
410
+ }
411
+ async replaceLine() {
412
+ await Ht(this.path);
413
+ }
414
+ // -------------------LIFECYCLE----------------------------
415
+ // ----------------------------------
416
+ // UNCOMMENT FOR TESTING FUEL GAUGE
417
+ // ----------------------------------
418
+ // async load() {
419
+ // const random = Math.max(1000, Math.floor(Math.random() * 5000));
420
+ // this.slice.maxVolMl = 1000;
421
+ // setInterval(() => {
422
+ // kosAction(() => {
423
+ // if (this.remainingVolume < -100) {
424
+ // this.slice.maxVolMl = 1000;
425
+ // this.slice.currentVolMl = this.maxVolume;
426
+ // } else {
427
+ // this.slice.currentVolMl = this.remainingVolume - 50;
428
+ // }
429
+ // });
430
+ // }, random);
431
+ // }
432
+ // -------------------ENTITY----------------------------
433
+ };
434
+ _e([
435
+ M
436
+ ], J.prototype, "pumps", 2);
437
+ _e([
438
+ Le({ modelType: Fe.type })
439
+ ], J.prototype, "ingredientContainer", 2);
440
+ J = _e([
441
+ I(j),
442
+ ut()
443
+ ], J);
444
+ const Ke = {
445
+ registration: {
446
+ [j]: {
447
+ class: J,
448
+ singleton: !1
449
+ }
450
+ },
451
+ type: j,
452
+ predicate: b(j),
453
+ factory: v.Factory.create(j)
454
+ }, Jt = async (e, t) => {
455
+ var Se;
456
+ const r = u.propertyMapper.executeMapper(
457
+ h.HolderIngredientMapper,
458
+ t
459
+ ), a = u.propertyMapper.executeMapper(
460
+ h.HolderTypeMapper,
461
+ t
462
+ ) || t.ingType, i = await T.executeDataMapperExtension({
463
+ extension: h.HolderMapper,
464
+ data: t,
465
+ contextData: {}
466
+ }), { name: s, path: n, ingredientId: c, ingType: l, ingSource: p, slice: y, ...B } = t, m = { ...B, ...i }, N = y || { pos: 0 }, te = {
467
+ name: s,
468
+ path: n,
469
+ ingredientId: r || c,
470
+ ingredientType: a || l,
471
+ ingredientSource: p,
472
+ enjoyByDate: (Se = t.container) != null && Se.enjoyByDate ? new Date(t.container.enjoyByDate) : void 0,
473
+ slice: N,
474
+ group: e,
475
+ data: m
476
+ };
477
+ return Ke.factory(t.path)(te);
478
+ }, { URL: qt } = S("ASSEMBLY_SERVICE"), { getOne: Wt } = C.build({
479
+ basePath: `${qt}/api/kos/device/assemblies`
480
+ }), Qt = f.createLogger({
481
+ name: "assembly-service",
482
+ group: "Services"
483
+ }), ke = async () => (Qt.debug("sending GET for assembly"), await Wt({}));
484
+ var er = Object.defineProperty, tr = Object.getOwnPropertyDescriptor, ue = (e, t, r, a) => {
485
+ for (var i = a > 1 ? void 0 : a ? tr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
486
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
487
+ return a && i && er(t, r, i), i;
488
+ };
489
+ const F = "board-container-model", Ye = "/kos/hardware/board/linked", Ze = "/kos/hardware/board/unlinked";
490
+ let L = class {
491
+ constructor(e, t, r) {
492
+ o(this, "id");
493
+ o(this, "logger");
494
+ o(this, "models");
495
+ this.id = e, this.logger = r.logger, this.models = new R({
496
+ parentId: e,
497
+ extensionId: h.BoardIndex
498
+ });
499
+ }
500
+ get boardList() {
501
+ return this.models.data;
502
+ }
503
+ updateModel() {
504
+ }
505
+ addModel(e) {
506
+ this.models.addModel(e);
507
+ }
508
+ removeModel(e) {
509
+ this.models.removeModel(e);
510
+ }
511
+ updateBoard(e) {
512
+ const t = e.path, r = this.models.getModel(t);
513
+ if (!r) {
514
+ this.logger.warn(`board ${t} not found`);
515
+ return;
516
+ }
517
+ r.updateModel(e);
518
+ }
519
+ handleBoardLinkEvent(e) {
520
+ this.logger.debug(`handling ${Ye} event ${e}`), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
521
+ }
522
+ handleBoardUnlinkEvent(e) {
523
+ this.logger.debug(
524
+ `handling ${Ze} event ${e}`
525
+ ), e ? this.updateBoard(e) : this.logger.debug("- boardLinkEvent is undefined");
526
+ }
527
+ };
528
+ ue([
529
+ M
530
+ ], L.prototype, "models", 2);
531
+ ue([
532
+ W({
533
+ lifecycle: xe.INIT,
534
+ topic: Ye,
535
+ websocket: !0
536
+ })
537
+ ], L.prototype, "handleBoardLinkEvent", 1);
538
+ ue([
539
+ W({
540
+ lifecycle: xe.INIT,
541
+ topic: Ze,
542
+ websocket: !0
543
+ })
544
+ ], L.prototype, "handleBoardUnlinkEvent", 1);
545
+ L = ue([
546
+ I(F)
547
+ ], L);
548
+ const rr = async (e) => {
549
+ const t = e.data.boardPath, { model: r } = z(t);
550
+ return {
551
+ boardName: (r == null ? void 0 : r.name) || ""
552
+ };
553
+ };
554
+ var ir = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, Xe = (e, t, r, a) => {
555
+ for (var i = a > 1 ? void 0 : a ? ar(t, r) : t, s = e.length - 1, n; s >= 0; s--)
556
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
557
+ return a && i && ir(t, r, i), i;
558
+ };
559
+ const H = D.PumpContainer;
560
+ var Je = /* @__PURE__ */ ((e) => (e.byBoard = "byBoard", e.byType = "byType", e.byNozzle = "byNozzle", e))(Je || {});
561
+ let ne = class {
562
+ constructor(e, t) {
563
+ o(this, "id");
564
+ o(this, "pumps");
565
+ this.id = e, this.pumps = new R({
566
+ indexMap: {
567
+ byNozzle: (r) => r.nozzlePaths,
568
+ byBoard: (r) => r.boardPath,
569
+ byType: "type"
570
+ },
571
+ parentId: e,
572
+ extensionId: h.PumpIndex
573
+ });
574
+ }
575
+ /**
576
+ * The collection of pump models.
577
+ */
578
+ get pumpModels() {
579
+ return this.pumps.data;
580
+ }
581
+ /**
582
+ * The collection of pump paths.
583
+ */
584
+ get pumpPaths() {
585
+ return this.pumpModels.map((e) => e.path);
586
+ }
587
+ addModel(e) {
588
+ this.pumps.addModel(e);
589
+ }
590
+ removeModel(e) {
591
+ this.pumps.removeModel(e);
592
+ }
593
+ getModel(e) {
594
+ return this.pumps.getModel(e);
595
+ }
596
+ get models() {
597
+ return this.pumps;
598
+ }
599
+ get data() {
600
+ return this.pumps.data;
601
+ }
602
+ updateModel() {
603
+ }
604
+ // -------------------LIFECYCLE----------------------------
605
+ async load() {
606
+ }
607
+ // -------------------ENTITY----------------------------
608
+ };
609
+ Xe([
610
+ M
611
+ ], ne.prototype, "pumps", 2);
612
+ ne = Xe([
613
+ I(H)
614
+ ], ne);
615
+ const Me = {
616
+ registration: {
617
+ [H]: {
618
+ class: ne,
619
+ singleton: !0
620
+ }
621
+ },
622
+ type: H,
623
+ predicate: b(H),
624
+ factory: v.Singleton.create(
625
+ H
626
+ )
627
+ }, qe = async (e) => {
628
+ const t = [], { model: r } = await Ae(e);
629
+ return r && (t.push(r.boardPath), t.push(r.nozzlePath), t.push(r.holderPath)), t;
630
+ }, sr = async (e) => {
631
+ const t = [], r = e.data.pumpPath;
632
+ t.push(r);
633
+ const a = await qe(r);
634
+ return [...t, ...a];
635
+ }, nr = async (e) => {
636
+ const t = [], r = e.data.boardPath;
637
+ t.push(e.data.boardPath);
638
+ const a = await Ae(
639
+ Me.type
640
+ );
641
+ if (a != null && a.model) {
642
+ const s = a.model.models.getIndexByKey(
643
+ Je.byBoard,
644
+ r
645
+ ).map(
646
+ (c) => qe(c.path)
647
+ );
648
+ (await Promise.allSettled(s)).forEach((c) => {
649
+ c.status === "fulfilled" && c.value.forEach((l) => t.push(l));
650
+ });
651
+ }
652
+ return Array.from(new Set(t));
653
+ };
654
+ var or = Object.getOwnPropertyDescriptor, dr = (e, t, r, a) => {
655
+ for (var i = a > 1 ? void 0 : a ? or(t, r) : t, s = e.length - 1, n; s >= 0; s--)
656
+ (n = e[s]) && (i = n(i) || i);
657
+ return i;
658
+ };
659
+ const V = "board-model", De = (e, t) => {
660
+ const { type: r, name: a, path: i, linked: s, instanceId: n, link: c, ...l } = e;
661
+ t.type = r, t.name = a, t.path = i, t.linked = s, t.link = Object.freeze(c), t.instanceId = n, Object.assign(t, l);
662
+ };
663
+ u[be].register(
664
+ "board",
665
+ nr
666
+ );
667
+ u[q].register(
668
+ "board",
669
+ rr
670
+ );
671
+ let fe = class {
672
+ constructor(e, t, r) {
673
+ o(this, "id");
674
+ o(this, "type");
675
+ o(this, "name");
676
+ o(this, "path");
677
+ o(this, "linked");
678
+ o(this, "instanceId");
679
+ o(this, "logger");
680
+ this.id = e, this.logger = r.logger, De(t, this);
681
+ }
682
+ updateModel(e) {
683
+ De(e, this);
684
+ }
685
+ // -------------------LIFECYCLE----------------------------
686
+ async init() {
687
+ this.logger.debug(`initializing board ${this.id}`);
688
+ }
689
+ async load() {
690
+ this.logger.debug(`loading board ${this.id}`);
691
+ }
692
+ };
693
+ fe = dr([
694
+ I(V)
695
+ ], fe);
696
+ const We = {
697
+ registration: {
698
+ [V]: {
699
+ class: fe,
700
+ singleton: !1
701
+ }
702
+ },
703
+ type: V,
704
+ predicate: b(V),
705
+ factory: v.Factory.create(V)
706
+ }, Qe = {
707
+ registration: {
708
+ [F]: {
709
+ class: L,
710
+ singleton: !0
711
+ },
712
+ ...We.registration
713
+ },
714
+ type: F,
715
+ predicate: b(F),
716
+ factory: v.Singleton.create(
717
+ F
718
+ )
719
+ };
720
+ var lr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, ge = (e, t, r, a) => {
721
+ for (var i = a > 1 ? void 0 : a ? cr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
722
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
723
+ return a && i && lr(t, r, i), i;
724
+ };
725
+ const K = D.HolderContainer, pr = "/kos/insertion/insert/start", hr = "/kos/insertion/insert/complete", ur = "/kos/insertion/insert/update", gr = "/kos/insertion/remove", yr = "/kos/pumpEvent/replaceLine", Ir = "/kos/handle/*";
726
+ let x = class {
727
+ constructor(e, t, r) {
728
+ o(this, "id");
729
+ o(this, "holders");
730
+ o(this, "logger");
731
+ this.id = e, this.holders = new R({
732
+ indexMap: {
733
+ nozzle: (a) => a.nozzlePaths,
734
+ group: "group"
735
+ },
736
+ parentId: e,
737
+ extensionId: h.HolderIndex
738
+ }), this.logger = r.logger;
739
+ }
740
+ updateModel() {
741
+ }
742
+ handleHolderEvents(e) {
743
+ var r, a, i;
744
+ f.ifDebug(
745
+ () => this.logger.debug("Received holder change event", JSON.stringify(e))
746
+ );
747
+ const t = this.holders.getModel(e.path);
748
+ t && (this.logger.info(
749
+ `Received change event for holder ${t.path}. Updating fuel gauge data.`
750
+ ), t.slice.currentVolMl = (r = e.slice) == null ? void 0 : r.currentVolMl, t.slice.maxVolMl = (a = e.slice) == null ? void 0 : a.maxVolMl, (i = e == null ? void 0 : e.container) != null && i.enjoyByDate ? t.enjoyByDate = new Date(e.container.enjoyByDate) : t.enjoyByDate = void 0);
751
+ }
752
+ handleInsertion(e) {
753
+ f.ifDebug(
754
+ () => this.logger.debug("Received insertion event", JSON.stringify(e))
755
+ ), (Array.isArray(e) ? e : [e]).forEach((r) => {
756
+ g(() => {
757
+ var s, n, c;
758
+ const a = r.ingredientId, i = this.holders.getModel(r.path);
759
+ i && (this.logger.info(
760
+ `Received insertion event for holder ${i.path}`
761
+ ), i.updateIngredient(a), i.slice.currentVolMl = (s = r.slice) == null ? void 0 : s.currentVolMl, i.slice.maxVolMl = (n = r.slice) == null ? void 0 : n.maxVolMl, (c = r == null ? void 0 : r.container) != null && c.enjoyByDate ? i.enjoyByDate = new Date(r.container.enjoyByDate) : i.enjoyByDate = void 0, r.pumps.forEach((l) => {
762
+ g(() => {
763
+ const p = i.pumps.getModel(l.path);
764
+ p && (p.ingredientId = l.ingredientId, p.inserted = l.inserted, p.prevIngredientId = l.prevIngredientId);
765
+ });
766
+ }));
767
+ });
768
+ });
769
+ }
770
+ // -------------------ENTITY----------------------------
771
+ };
772
+ ge([
773
+ M
774
+ ], x.prototype, "holders", 2);
775
+ ge([
776
+ W({
777
+ topic: Ir,
778
+ websocket: !0,
779
+ condition: (e, t) => t.holders.getModel(e.path) !== void 0
780
+ })
781
+ ], x.prototype, "handleHolderEvents", 1);
782
+ ge([
783
+ W({
784
+ topic: [
785
+ pr,
786
+ hr,
787
+ ur,
788
+ gr,
789
+ yr
790
+ ],
791
+ websocket: !0
792
+ })
793
+ ], x.prototype, "handleInsertion", 1);
794
+ x = ge([
795
+ I(K)
796
+ ], x);
797
+ const et = {
798
+ registration: {
799
+ [K]: {
800
+ class: x,
801
+ singleton: !0
802
+ }
803
+ },
804
+ type: K,
805
+ predicate: b(K),
806
+ factory: v.Singleton.create(
807
+ K
808
+ )
809
+ }, mr = f.createLogger({ name: "board-utils" }), fr = async (e) => {
810
+ const t = await T.executeDataMapperExtension({
811
+ extension: h.BoardMapper,
812
+ data: e,
813
+ contextData: {}
814
+ }), { type: r, name: a, path: i, linked: s, instanceId: n, ...c } = e, l = { ...c, ...t }, p = {
815
+ type: r,
816
+ name: a,
817
+ path: i,
818
+ linked: s,
819
+ instanceId: n,
820
+ ...l
821
+ }, y = We.factory(e.path)(p);
822
+ return y.updateModel(p), y;
823
+ }, Pr = (e) => async (t) => {
824
+ mr.debug(`adding board ${t.name}`);
825
+ const r = await fr(t);
826
+ e.addModel(r);
827
+ };
828
+ var d = /* @__PURE__ */ ((e) => (e.IDLE = "IDLE", e.POURING = "POURING", e.POUR_STARTING = "POUR_STARTING", e.POUR_CANCELING = "POUR_CANCELING", e.POUR_CANCELED = "POUR_CANCELED", e.POUR_COMPLETE = "POUR_COMPLETE", e))(d || {});
829
+ const { URL: Oe } = S("PUMP_SERVICE"), { postModel: vr, getOne: br } = C.build({
830
+ basePath: `${Oe}/api/kos/holders`
831
+ });
832
+ f.createLogger({
833
+ name: "pump-service",
834
+ group: "Services"
835
+ });
836
+ const _r = async ({
837
+ intent: e,
838
+ pumpId: t,
839
+ tracker: r
840
+ }) => {
841
+ const a = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/pour/${t}/${e}`, i = await vr({ model: {}, urlOverride: a, tracker: r });
842
+ return i != null && i.data && ce.initiateFuture(i.data), i;
843
+ }, Mr = async (e, t) => {
844
+ const r = `${Oe}/api/ext/dispense/nozzle/nozzle/pipeline/ingredient/intent/${e}/${t}/volume`, a = await br({ urlOverride: r });
845
+ return a != null && a.data ? a.data : { volume: -1 };
846
+ };
847
+ var Or = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, tt = (e, t, r, a) => {
848
+ for (var i = a > 1 ? void 0 : a ? Er(t, r) : t, s = e.length - 1, n; s >= 0; s--)
849
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
850
+ return a && i && Or(t, r, i), i;
851
+ };
852
+ const k = D.Pump;
853
+ u[be].register(
854
+ "pump",
855
+ sr
856
+ );
857
+ let oe = class {
858
+ constructor(e, t) {
859
+ o(this, "id");
860
+ o(this, "inserted");
861
+ o(this, "type");
862
+ o(this, "virtual");
863
+ o(this, "ingredientId");
864
+ o(this, "holderPath");
865
+ o(this, "boardPath");
866
+ o(this, "nozzlePath");
867
+ o(this, "childPump");
868
+ o(this, "name");
869
+ o(this, "path");
870
+ o(this, "prevIngredientId");
871
+ o(this, "futureHandler");
872
+ o(this, "currentState", d.IDLE);
873
+ this.id = e;
874
+ const {
875
+ inserted: r,
876
+ holderPath: a,
877
+ boardPath: i,
878
+ nozzlePath: s,
879
+ name: n,
880
+ path: c,
881
+ childPump: l,
882
+ virtual: p,
883
+ prevIngredientId: y,
884
+ ...B
885
+ } = t;
886
+ this.inserted = r, this.type = t.type, this.ingredientId = t.ingredientId, this.holderPath = a, this.boardPath = i, this.nozzlePath = s, this.name = n, this.path = c, this.childPump = !!l, this.virtual = !!p, this.prevIngredientId = y, Object.assign(this, B), this.futureHandler = new Be(this);
887
+ }
888
+ updateModel(e) {
889
+ const {
890
+ inserted: t,
891
+ holderPath: r,
892
+ boardPath: a,
893
+ nozzlePath: i,
894
+ childPump: s,
895
+ name: n,
896
+ path: c,
897
+ ...l
898
+ } = e;
899
+ this.inserted = t, this.type = e.type, this.ingredientId = e.ingredientId, this.holderPath = r, this.boardPath = a, this.nozzlePath = i, this.childPump = this.childPump ? this.childPump : !!s, this.name = n, this.path = c, this.prevIngredientId = e.prevIngredientId, Object.assign(this, l);
900
+ }
901
+ // -------------------LIFECYCLE----------------------------
902
+ get pouringState() {
903
+ var e;
904
+ return ((e = this.future) == null ? void 0 : e.endState) || "";
905
+ }
906
+ get isPouring() {
907
+ var e;
908
+ return !!(this.future && !((e = this.future) != null && e.endState)) || this.currentState === d.POUR_STARTING || this.currentState === d.POURING;
909
+ }
910
+ get canPour() {
911
+ return !!this.ingredientId && !this.isPouring;
912
+ }
913
+ onFutureUpdate(e) {
914
+ e.endState && g(() => {
915
+ this.currentState = d.IDLE;
916
+ });
917
+ }
918
+ async cancelPour() {
919
+ var e;
920
+ this.currentState === d.POURING || this.currentState === d.POUR_STARTING ? (this.currentState = d.POUR_CANCELING, await ((e = this.future) == null ? void 0 : e.cancelFuture()), g(() => {
921
+ this.currentState = d.IDLE;
922
+ })) : f.warn(`Cannot cancel pour in state ${this.currentState}`);
923
+ }
924
+ get future() {
925
+ return this.futureHandler.future;
926
+ }
927
+ async resolveIntentVolume(e) {
928
+ return await Mr(this.path, e);
929
+ }
930
+ async performIntent(e, t) {
931
+ const r = typeof e == "string" ? e : e.intent;
932
+ if (!r)
933
+ throw new Error("No intent provided");
934
+ try {
935
+ if (this.currentState === d.IDLE) {
936
+ if (this.currentState = d.POUR_STARTING, !t)
937
+ throw new Error("No tracker provided");
938
+ const a = await _r({
939
+ tracker: t,
940
+ intent: r,
941
+ pumpId: this.path
942
+ });
943
+ return this.currentState === d.POUR_STARTING && g(() => {
944
+ this.currentState = d.POURING;
945
+ }), a == null ? void 0 : a.data;
946
+ } else
947
+ throw new Error(`Cannot pour in state ${this.currentState}`);
948
+ } catch (a) {
949
+ throw f.error(a), this.currentState = d.IDLE, a;
950
+ }
951
+ }
952
+ // -------------------ENTITY----------------------------
953
+ };
954
+ tt([
955
+ pe()
956
+ ], oe.prototype, "performIntent", 1);
957
+ oe = tt([
958
+ I(k)
959
+ ], oe);
960
+ const rt = {
961
+ registration: {
962
+ [k]: {
963
+ class: oe,
964
+ singleton: !1
965
+ }
966
+ },
967
+ type: k,
968
+ predicate: b(k),
969
+ factory: v.Factory.create(k)
970
+ }, wr = f.createLogger({ name: "pump-utils" }), $r = (e, t) => {
971
+ const r = (t.pumps ?? []).length > 1, a = {
972
+ boardPath: t.boardPath,
973
+ holderPath: t.holderPath,
974
+ ingredientId: t.ingredientId,
975
+ childPump: !!t.childPump,
976
+ virtual: r,
977
+ inserted: t.inserted,
978
+ name: t.name,
979
+ path: t.path,
980
+ type: t.type,
981
+ nozzlePath: e,
982
+ prevIngredientId: t.prevIngredientId
983
+ }, i = rt.factory(t.path)(a);
984
+ return i.updateModel(a), i;
985
+ }, it = (e) => (t) => (r) => (a) => {
986
+ var c;
987
+ wr.debug(`adding pump ${a.name}`);
988
+ const i = $r(r.path, a);
989
+ e.addModel(i);
990
+ const s = i.holderPath, n = t.holders.getModel(s);
991
+ n == null || n.pumps.addModel(i), n != null && n.nozzlePaths.includes(r.path) || n == null || n.nozzlePaths.push(r.path), (c = a == null ? void 0 : a.pumps) == null || c.forEach((l) => {
992
+ const p = i.holderPath, y = {
993
+ ...l,
994
+ childPump: !0,
995
+ holderPath: p,
996
+ ingredientId: i.ingredientId
997
+ };
998
+ it(e)(t)(r)(y);
999
+ });
1000
+ };
1001
+ var Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Q = (e, t, r, a) => {
1002
+ for (var i = a > 1 ? void 0 : a ? Cr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
1003
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
1004
+ return a && i && Sr(t, r, i), i;
1005
+ };
1006
+ const Y = "assembly-model", Rr = "assembly-data", Dr = "assembly-raw-data";
1007
+ let w = class {
1008
+ constructor(e, t, r) {
1009
+ o(this, "id");
1010
+ o(this, "_nozzlePaths", /* @__PURE__ */ new Set());
1011
+ o(this, "troubleContainer");
1012
+ o(this, "holderContainer");
1013
+ o(this, "boardContainer");
1014
+ o(this, "pumpContainer");
1015
+ o(this, "logger");
1016
+ this.id = e, this.holderContainer = et.factory({}), this.boardContainer = Qe.factory({}), this.pumpContainer = Me.factory({}), this.logger = r.logger;
1017
+ }
1018
+ updateModel(e) {
1019
+ }
1020
+ get allHolders() {
1021
+ return this.holderContainer.holders.data;
1022
+ }
1023
+ get holderGroups() {
1024
+ return this.holderContainer.holders.getIndexKeys("group");
1025
+ }
1026
+ get nozzlePaths() {
1027
+ return Array.from(this._nozzlePaths);
1028
+ }
1029
+ getHoldersByGroup(e) {
1030
+ return this.holderContainer.holders.getIndexByKey("group", e);
1031
+ }
1032
+ getHoldersByNozzle(e) {
1033
+ return this.holderContainer.holders.getIndexByKey("nozzle", e);
1034
+ }
1035
+ /**
1036
+ * Returns a map of the pumps associated with each nozzle
1037
+ *
1038
+ * Can be used in conjunction with the nozzlePaths to get the pumps associated with each nozzle
1039
+ * @returns Record<string, PumpModel[]>
1040
+ */
1041
+ get pumpsByNozzle() {
1042
+ return this.pumpContainer.models.idx.byNozzle;
1043
+ }
1044
+ /**
1045
+ * Returns a list of all fo the pumps paths across the entire assembly.
1046
+ */
1047
+ get pumpPaths() {
1048
+ return this.pumpContainer.models.data.map((e) => e.path);
1049
+ }
1050
+ get boards() {
1051
+ return this.boardContainer.boardList;
1052
+ }
1053
+ // -------------------LIFECYCLE----------------------------
1054
+ async init() {
1055
+ this.logger.debug(`initializing assembly ${this.id}`);
1056
+ }
1057
+ async ready() {
1058
+ var e;
1059
+ (e = this.troubleContainer) == null || e.troubles.increment(), u[gt].execute(
1060
+ h.AssemblyFeatureFlags,
1061
+ this
1062
+ );
1063
+ }
1064
+ async load(e) {
1065
+ this.logger.debug(`loading assembly ${this.id}`);
1066
+ const t = await ke();
1067
+ if ((t == null ? void 0 : t.status) === 200) {
1068
+ const r = await T.executeDataMapperExtension({
1069
+ extension: h.AssemblyMapper,
1070
+ data: t.data,
1071
+ contextData: {}
1072
+ });
1073
+ e.set(Rr, r), Object.assign(this, r), Object.entries(r).forEach(([a, i]) => {
1074
+ yt(i) && (this.logger.debug(`adding child model ${a} from extension data`), this[It][a] = !0);
1075
+ }), e.set(Dr, t.data);
1076
+ for await (const a of t.data.assemblies) {
1077
+ const {
1078
+ boards: i = [],
1079
+ holders: s = {},
1080
+ nozzles: n = [],
1081
+ core: c,
1082
+ name: l,
1083
+ path: p,
1084
+ ...y
1085
+ } = a;
1086
+ this.logger.debug(`adding assembly ${l}`), Object.keys(y).forEach((m) => {
1087
+ mt.enableFeature(m);
1088
+ });
1089
+ for await (const m of i)
1090
+ this.logger.debug(`adding board ${m.name}`), await Pr(this.boardContainer)(m);
1091
+ for await (const [m, N] of Object.entries(
1092
+ s ?? {}
1093
+ ))
1094
+ for await (const te of N) {
1095
+ this.logger.debug(`adding holder ${te.name}`);
1096
+ const $e = await Jt(m, te);
1097
+ this.holderContainer.holders.addModel($e);
1098
+ }
1099
+ const B = it(this.pumpContainer)(
1100
+ this.holderContainer
1101
+ );
1102
+ n.forEach((m) => {
1103
+ this._nozzlePaths.add(m.path);
1104
+ const N = B(m);
1105
+ m.pumps.forEach(N);
1106
+ });
1107
+ }
1108
+ }
1109
+ }
1110
+ };
1111
+ Q([
1112
+ Le({
1113
+ modelType: "trouble-container-model"
1114
+ })
1115
+ ], w.prototype, "troubleContainer", 2);
1116
+ Q([
1117
+ M
1118
+ ], w.prototype, "holderContainer", 2);
1119
+ Q([
1120
+ M
1121
+ ], w.prototype, "boardContainer", 2);
1122
+ Q([
1123
+ M
1124
+ ], w.prototype, "pumpContainer", 2);
1125
+ w = Q([
1126
+ I(Y)
1127
+ ], w);
1128
+ const at = {
1129
+ registration: {
1130
+ [Y]: {
1131
+ class: w,
1132
+ singleton: !0
1133
+ }
1134
+ },
1135
+ type: Y,
1136
+ predicate: b(Y),
1137
+ factory: v.Singleton.create(Y)
1138
+ };
1139
+ var Nr = Object.getOwnPropertyDescriptor, Tr = (e, t, r, a) => {
1140
+ for (var i = a > 1 ? void 0 : a ? Nr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
1141
+ (n = e[s]) && (i = n(i) || i);
1142
+ return i;
1143
+ };
1144
+ const Z = D.Availability;
1145
+ let Pe = class {
1146
+ constructor(e, t, r) {
1147
+ o(this, "id");
1148
+ o(this, "data");
1149
+ o(this, "properties");
1150
+ o(this, "available");
1151
+ o(this, "visible");
1152
+ o(this, "groupId");
1153
+ o(this, "rawId");
1154
+ o(this, "altId");
1155
+ o(this, "type");
1156
+ o(this, "note");
1157
+ o(this, "taggedIds");
1158
+ o(this, "parentId");
1159
+ o(this, "logger");
1160
+ this.id = e, this.taggedIds = t.taggedIds || [], this.logger = r.logger, this.available = t.available, this.visible = t.visible, this.groupId = t.groupId, this.rawId = t.rawId, this.altId = t.altId, this.type = t.type, this.parentId = t.kosParentId, this.data = t.data, this.note = t.note, this.properties = t.properties || {};
1161
+ }
1162
+ updateModel(e) {
1163
+ this.taggedIds = e.taggedIds || [], this.available = e.available, this.visible = e.visible, this.groupId = e.groupId, this.rawId = e.rawId, this.altId = e.altId, this.type = e.type, this.data = e.data;
1164
+ }
1165
+ updateAvailability(e) {
1166
+ this.available = e;
1167
+ }
1168
+ // -------------------LIFECYCLE----------------------------
1169
+ // -------------------ENTITY----------------------------
1170
+ };
1171
+ Pe = Tr([
1172
+ ft(),
1173
+ I(Z)
1174
+ ], Pe);
1175
+ const ve = {
1176
+ registration: {
1177
+ [Z]: {
1178
+ class: Pe,
1179
+ singleton: !1
1180
+ }
1181
+ },
1182
+ type: Z,
1183
+ predicate: b(Z),
1184
+ factory: v.Factory.create(
1185
+ Z
1186
+ )
1187
+ }, { URL: A } = S("NOZZLE_SERVICE"), { postModel: Ee, deleteModel: zr, getOne: Lr } = C.build({
1188
+ basePath: `${A}/api/nozzle`
1189
+ }), xr = async (e, t) => {
1190
+ const r = await Ee({
1191
+ model: {},
1192
+ urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/pour`,
1193
+ ordered: !0,
1194
+ tracker: t
1195
+ });
1196
+ return r != null && r.data && ce.initiateFuture(r.data), r;
1197
+ }, Ar = async (e, t, r) => {
1198
+ const a = await Ee({
1199
+ model: {},
1200
+ urlOverride: `${A}/api/ext/dispense/nozzle/${t}/pipeline/beverage/fixed/${e}`,
1201
+ ordered: !0,
1202
+ tracker: r
1203
+ });
1204
+ return a != null && a.data && ce.initiateFuture(a.data), a;
1205
+ }, Br = async (e) => await Lr({
1206
+ urlOverride: `${A}${e}/pipeline/beverage/availability`
1207
+ }), Ur = async (e, t) => await Ee({
1208
+ model: t,
1209
+ urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
1210
+ }), Gr = async (e) => await zr({
1211
+ id: e,
1212
+ urlOverride: `${A}/api/ext/dispense/nozzle/${e}/pipeline/beverage/select`
1213
+ });
1214
+ var jr = Object.defineProperty, Fr = Object.getOwnPropertyDescriptor, ee = (e, t, r, a) => {
1215
+ for (var i = a > 1 ? void 0 : a ? Fr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
1216
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
1217
+ return a && i && jr(t, r, i), i;
1218
+ };
1219
+ const X = D.Nozzle, Hr = Pt(
1220
+ "beverageTopicPrefix"
1221
+ ), re = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0, Ne = "/kos/nozzle/pour/started", Vr = "/kos/nozzle/pour/progress", ye = "/kos/nozzle/pour/cancel";
1222
+ let $ = class {
1223
+ constructor(e, t, r) {
1224
+ /** the unique identifier for this nozzle.*/
1225
+ o(this, "id");
1226
+ o(this, "path");
1227
+ o(this, "logger");
1228
+ o(this, "name");
1229
+ o(this, "_selectedBeverage");
1230
+ o(this, "_selectedBrand");
1231
+ o(this, "_additionalItems");
1232
+ o(this, "_availabilityItems");
1233
+ o(this, "futureHandler");
1234
+ o(this, "currentState", d.IDLE);
1235
+ o(this, "beverageTopicPrefix");
1236
+ o(this, "topicPrefix");
1237
+ o(this, "urlPrefix");
1238
+ this.id = e, this.path = t.path, this.name = t.name, this.beverageTopicPrefix = t.beverageTopicPrefix, this.topicPrefix = t.topicPrefix, this.urlPrefix = t.urlPrefix, this._selectedBeverage = void 0, this._selectedBrand = void 0, this._additionalItems = [], this.futureHandler = new vt(this), this._availabilityItems = new R({
1239
+ indexMap: {
1240
+ byGroup: "groupId",
1241
+ byParent: "parentId"
1242
+ },
1243
+ parentId: e
1244
+ }), this.logger = r.logger;
1245
+ }
1246
+ /**
1247
+ * The availability nodes that can be dispensed from this nozzle.
1248
+ * This is a subset of the availability for the entire dispenser
1249
+ * and is determined by the nodes associated with a nozzle.
1250
+ */
1251
+ get beverages() {
1252
+ return this._availabilityItems.getIndexByKey("byGroup", "beverages");
1253
+ }
1254
+ /**
1255
+ * The availability nodes that have been grouped into the "brands" group.
1256
+ *
1257
+ */
1258
+ get brands() {
1259
+ return this._availabilityItems.getIndexByKey("byGroup", "brands");
1260
+ }
1261
+ get visibleBrands() {
1262
+ return this.brands.filter((e) => e.visible);
1263
+ }
1264
+ get visibleBeverages() {
1265
+ return this.beverages.filter((e) => e.visible);
1266
+ }
1267
+ /**
1268
+ * A derived value that indicates if the nozzle is currently pouring a beverage.
1269
+ * @readonly
1270
+ */
1271
+ get isPouring() {
1272
+ var e;
1273
+ return !!(this.futureHandler.getFuture() && !((e = this.futureHandler.getFuture()) != null && e.endState)) || this.currentState === d.POUR_STARTING || this.currentState === d.POURING || this.currentState === d.POUR_CANCELING;
1274
+ }
1275
+ /**
1276
+ * A derived value that indicates if the nozzle is currently available to pour a beverage.
1277
+ *
1278
+ * This will generally be determined by whether there is a currently selected pourable AND
1279
+ * the nozzle is not currently pouring.
1280
+ *
1281
+ * The value is observable and will change when the selected pourable changes or the nozzle
1282
+ * starts or stops pouring.
1283
+ * @readonly
1284
+ * */
1285
+ get canPour() {
1286
+ return !!this._selectedBeverage && this._selectedBeverage.available && this.currentState === d.IDLE;
1287
+ }
1288
+ /**
1289
+ * The selected pourable for this nozzle. Its shape is determined by the results of the
1290
+ * {@link ExtensionType.SelectedPourableMapper} extension.
1291
+ * @readonly
1292
+ *
1293
+ * */
1294
+ get selectedPourable() {
1295
+ return {
1296
+ beverage: this._selectedBeverage,
1297
+ additional: this._additionalItems
1298
+ };
1299
+ }
1300
+ get future() {
1301
+ return this.futureHandler.getFuture();
1302
+ }
1303
+ get pourProgress() {
1304
+ var e;
1305
+ return ((e = this.future) == null ? void 0 : e.progress) ?? 0;
1306
+ }
1307
+ updateModel() {
1308
+ }
1309
+ // -------------------LIFECYCLE----------------------------
1310
+ setSelectedBrand(e) {
1311
+ this._selectedBrand = e, this._selectedBeverage = void 0;
1312
+ }
1313
+ get selectedBrand() {
1314
+ return this._selectedBrand;
1315
+ }
1316
+ /**
1317
+ * Set the values used to determine the selected pourable for this nozzle.
1318
+ *
1319
+ * @param pourable The pourable to set.
1320
+ * @param pourable.beverage The beverage selected.
1321
+ * @param pourable.additional The additional items such as flavors or other items that could be incorporated
1322
+ * into the pourable.
1323
+ * */
1324
+ async setSelectedPourable({
1325
+ beverage: e,
1326
+ additional: t,
1327
+ context: r
1328
+ }) {
1329
+ if (!e) {
1330
+ const c = await Gr(this.name);
1331
+ if ((c == null ? void 0 : c.status) !== 200)
1332
+ throw new Error("Failed to clear pourable");
1333
+ this._selectedBeverage = void 0;
1334
+ return;
1335
+ }
1336
+ if (e === this._selectedBeverage && bt(this._additionalItems, t)) {
1337
+ this.logger.info("No change in selected pourable");
1338
+ return;
1339
+ }
1340
+ this._selectedBeverage = e, this._additionalItems = t;
1341
+ let a = await u.dataMapper.executeMapper(
1342
+ h.SelectedPourableMapper,
1343
+ {
1344
+ beverage: e,
1345
+ additional: t,
1346
+ context: r
1347
+ }
1348
+ );
1349
+ const i = {
1350
+ bevId: e.rawId
1351
+ };
1352
+ (!a || Object.keys(a).length === 0) && (this.logger.info(
1353
+ `No selected pourable mapper defined, using the default payload ${i}`
1354
+ ), a = i);
1355
+ const s = a ?? i, n = await Ur(this.name, s);
1356
+ if ((n == null ? void 0 : n.status) !== 200)
1357
+ throw new Error("Failed to select pourable");
1358
+ }
1359
+ /**
1360
+ * Utility method that will return the availability nodes that belong to the specified
1361
+ * group as defined in the dispenser beverage graph. For example, a dispenser
1362
+ * implementation may group availability nodes by Brand, Beverage, or Flavors
1363
+ *
1364
+ * @param groupId The group to filter by.
1365
+ * @returns The availability nodes that are available to be dispensed from this nozzle
1366
+ * and are in the specified group.
1367
+ * */
1368
+ getGroupAvailabilityItems(e) {
1369
+ return this._availabilityItems.getIndexByKey(
1370
+ "byGroup",
1371
+ e
1372
+ );
1373
+ }
1374
+ /**
1375
+ * Utility method that will return the availability nodes that are tagged with the specified parent id.
1376
+ *
1377
+ * This is useful when brandsets use the taggedIds property to associate nodes with a parent node. For example,
1378
+ * when organizing a brandset into brands and beverages, the brand nodes will be tagged with the beverage nodes.
1379
+ *
1380
+ * @param parentId - The parent id to filter by.
1381
+ * @returns the availability nodes that are tagged with the specified parent id.
1382
+ */
1383
+ getAvailabilityByParent(e) {
1384
+ return this._availabilityItems.getIndexByKey(
1385
+ "byParent",
1386
+ e
1387
+ );
1388
+ }
1389
+ updateIfCurrent(e, t) {
1390
+ this.currentState === e && g(() => {
1391
+ this.currentState = t;
1392
+ });
1393
+ }
1394
+ onFutureUpdate(e) {
1395
+ E(this).forEach((a) => {
1396
+ re(a) && a.onPourProgress(e);
1397
+ });
1398
+ const r = {
1399
+ nozzleId: this.id,
1400
+ progress: e.progress,
1401
+ status: e.status,
1402
+ clientData: e.clientData,
1403
+ futureId: e.futureId,
1404
+ remainingTimeMs: e.remainingTimeMs,
1405
+ endState: e.endState,
1406
+ reason: e.reason,
1407
+ timeRemaining: e.timeRemaining
1408
+ };
1409
+ _.publish(Vr, r), e.endState && g(() => {
1410
+ this.currentState = d.IDLE;
1411
+ });
1412
+ }
1413
+ async pour(e) {
1414
+ var t;
1415
+ try {
1416
+ if (this.currentState === d.IDLE) {
1417
+ if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
1418
+ throw new Error("No tracker provided");
1419
+ const r = await xr(this.name, e);
1420
+ this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
1421
+ var s;
1422
+ re(i) && ((s = i.onPourStart) == null || s.call(i));
1423
+ });
1424
+ const a = {
1425
+ nozzleId: this.id,
1426
+ type: "free"
1427
+ };
1428
+ if (_.publish(Ne, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
1429
+ this.updateIfCurrent(d.POURING, d.IDLE);
1430
+ const i = {
1431
+ nozzleId: this.id
1432
+ };
1433
+ _.publish(ye, i);
1434
+ }
1435
+ return r;
1436
+ } else
1437
+ throw new Error(`Cannot pour in state ${this.currentState}`);
1438
+ } catch (r) {
1439
+ throw this.logger.error(r), this.currentState = d.IDLE, r;
1440
+ }
1441
+ }
1442
+ async fixedPour(e, t) {
1443
+ var r;
1444
+ try {
1445
+ if (this.currentState === d.IDLE) {
1446
+ if (this.currentState = d.POUR_STARTING, !t)
1447
+ throw new Error("No tracker provided");
1448
+ const a = await Ar(e, this.name, t);
1449
+ this.currentState === d.POUR_STARTING && g(() => {
1450
+ this.currentState = d.POURING;
1451
+ }), E(this).forEach((s) => {
1452
+ var n;
1453
+ re(s) && ((n = s.onPourStart) == null || n.call(s));
1454
+ });
1455
+ const i = {
1456
+ nozzleId: this.id,
1457
+ type: "fixed"
1458
+ };
1459
+ if (_.publish(Ne, i), (r = a == null ? void 0 : a.data) != null && r.endState) {
1460
+ this.updateIfCurrent(d.POURING, d.IDLE);
1461
+ const s = {
1462
+ nozzleId: this.id
1463
+ };
1464
+ _.publish(ye, s);
1465
+ }
1466
+ return a;
1467
+ } else
1468
+ throw new Error(`Cannot pour in state ${this.currentState}`);
1469
+ } catch (a) {
1470
+ throw this.logger.error(a), this.currentState = d.IDLE, a;
1471
+ }
1472
+ }
1473
+ /**
1474
+ * An action that will cancel a pour for this nozzle.
1475
+ * */
1476
+ async cancelPour() {
1477
+ var e;
1478
+ if (this.currentState === d.POURING || this.currentState === d.POUR_STARTING) {
1479
+ this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), g(() => {
1480
+ this.currentState = d.IDLE;
1481
+ }), E(this).forEach((r) => {
1482
+ var a;
1483
+ re(r) && ((a = r.onPourCancel) == null || a.call(r));
1484
+ });
1485
+ const t = {
1486
+ nozzleId: this.id
1487
+ };
1488
+ _.publish(ye, t);
1489
+ } else
1490
+ this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
1491
+ }
1492
+ updateGroupMembers() {
1493
+ this._availabilityItems.data.forEach((e) => {
1494
+ (e.taggedIds || []).forEach((r) => {
1495
+ const a = this._availabilityItems.data.find(
1496
+ (i) => i.rawId === r
1497
+ );
1498
+ a && a.parentId !== e.id && (a.parentId = e.id, this._availabilityItems.updateModel(a));
1499
+ });
1500
+ });
1501
+ }
1502
+ /** @internal */
1503
+ async load(e) {
1504
+ var a, i;
1505
+ this.logger.debug(`loading nozzle ${this.id}`);
1506
+ const t = await Br(this.urlPrefix);
1507
+ if ((t == null ? void 0 : t.status) !== 200)
1508
+ throw new Error("Failed to load nozzle availability");
1509
+ const r = await u.loader.executeLoader(
1510
+ h.AvailabilityLoader,
1511
+ {}
1512
+ );
1513
+ e == null || e.set(h.AvailabilityLoader, r), e == null || e.set(we.type, this);
1514
+ for (const s of Object.keys((a = t.data) == null ? void 0 : a.groups) || [])
1515
+ for (const n of ((i = t.data) == null ? void 0 : i.groups[s]) || []) {
1516
+ const c = await u.dataMapper.executeMapper(
1517
+ h.AvailabilityMapper,
1518
+ { ...n, groupId: s },
1519
+ r
1520
+ ), l = {
1521
+ ...n,
1522
+ note: n.note ?? void 0,
1523
+ kosParentId: this.id,
1524
+ rawId: n.id,
1525
+ groupId: s,
1526
+ data: c,
1527
+ properties: n.properties || {}
1528
+ }, p = ve.factory(
1529
+ `${this.id}-${s}-${n.id}`
1530
+ )(l);
1531
+ this._availabilityItems.addModel(p);
1532
+ }
1533
+ this.updateGroupMembers();
1534
+ }
1535
+ async updateAvailability(e) {
1536
+ const t = _t.getContext(this.id), r = (t == null ? void 0 : t.get(h.AvailabilityLoader)) || {};
1537
+ if (e.rebuild)
1538
+ for (const a of Object.keys(e == null ? void 0 : e.groups) || []) {
1539
+ this._availabilityItems.getIndexByKey("group", a).filter(
1540
+ (s) => !e.groups[a].find(
1541
+ (n) => `${this.id}-${a}-${n.id}` === s.id
1542
+ )
1543
+ ).forEach((s) => {
1544
+ this._availabilityItems.removeModel(s.id), Mt(s);
1545
+ });
1546
+ for (const s of (e == null ? void 0 : e.groups[a]) || []) {
1547
+ const n = await u.dataMapper.executeMapper(
1548
+ h.AvailabilityMapper,
1549
+ { ...s, groupId: a },
1550
+ r
1551
+ ), c = {
1552
+ ...s,
1553
+ note: s.note ?? void 0,
1554
+ kosParentId: this.id,
1555
+ groupId: a,
1556
+ rawId: s.id,
1557
+ data: n,
1558
+ taggedIds: s.taggedIds,
1559
+ properties: s.properties || {}
1560
+ }, l = this._availabilityItems.getModel(
1561
+ `${this.id}-${a}-${s.id}`
1562
+ );
1563
+ if (l)
1564
+ l.updateModel(c);
1565
+ else {
1566
+ const p = ve.factory(
1567
+ `${this.id}-${a}-${s.id}`
1568
+ )(c);
1569
+ this._availabilityItems.addModel(p);
1570
+ }
1571
+ }
1572
+ }
1573
+ else
1574
+ for (const a of Object.keys(e == null ? void 0 : e.groups) || [])
1575
+ for (const i of (e == null ? void 0 : e.groups[a]) || []) {
1576
+ const s = await u.dataMapper.executeMapper(
1577
+ h.AvailabilityMapper,
1578
+ { ...i, groupId: a },
1579
+ r
1580
+ ), n = {
1581
+ ...i,
1582
+ note: i.note ?? void 0,
1583
+ kosParentId: this.id,
1584
+ groupId: a,
1585
+ rawId: i.id,
1586
+ data: s,
1587
+ type: i.type,
1588
+ taggedIds: i.taggedIds,
1589
+ properties: i.properties || {}
1590
+ }, c = this._availabilityItems.getModel(
1591
+ `${this.id}-${a}-${i.id}`
1592
+ );
1593
+ c && c.updateModel(n);
1594
+ }
1595
+ this.updateGroupMembers();
1596
+ }
1597
+ // -------------------ENTITY----------------------------
1598
+ };
1599
+ ee([
1600
+ M
1601
+ ], $.prototype, "_availabilityItems", 2);
1602
+ ee([
1603
+ pe()
1604
+ ], $.prototype, "pour", 1);
1605
+ ee([
1606
+ pe()
1607
+ ], $.prototype, "fixedPour", 1);
1608
+ ee([
1609
+ W({
1610
+ topic: `${Hr}/availability`,
1611
+ websocket: !0
1612
+ })
1613
+ ], $.prototype, "updateAvailability", 1);
1614
+ $ = ee([
1615
+ I(X)
1616
+ ], $);
1617
+ const we = {
1618
+ registration: {
1619
+ [X]: {
1620
+ class: $,
1621
+ singleton: !1
1622
+ }
1623
+ },
1624
+ type: X,
1625
+ predicate: b(X),
1626
+ factory: v.Factory.create(X)
1627
+ };
1628
+ var Kr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, st = (e, t, r, a) => {
1629
+ for (var i = a > 1 ? void 0 : a ? kr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
1630
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
1631
+ return a && i && Kr(t, r, i), i;
1632
+ };
1633
+ const nt = "device-assembly-model";
1634
+ let de = class {
1635
+ constructor(e, t, r) {
1636
+ o(this, "id");
1637
+ o(this, "deviceNozzles");
1638
+ o(this, "logger");
1639
+ this.id = e, this.logger = r.logger, this.deviceNozzles = new R();
1640
+ }
1641
+ // -------------------LIFECYCLE----------------------------
1642
+ async init() {
1643
+ this.logger.debug(`initializing device-assembly ${this.id}`);
1644
+ }
1645
+ getNozzle(e) {
1646
+ return this.deviceNozzles.getModel(e);
1647
+ }
1648
+ get nozzlePaths() {
1649
+ return this.deviceNozzles.data.map((e) => e.path);
1650
+ }
1651
+ async load() {
1652
+ this.logger.debug(`loading device-assembly ${this.id}`);
1653
+ const e = await ke();
1654
+ (e == null ? void 0 : e.status) === 200 && e.data.assemblies.map((r) => r.nozzles ?? []).flat().forEach((r) => {
1655
+ var n;
1656
+ const a = r.path, i = ((n = r.pipelines.find((c) => c.name === "beverage")) == null ? void 0 : n.topicPrefix) || "", s = we.factory(a)({
1657
+ path: r.path,
1658
+ name: r.name,
1659
+ urlPrefix: r.urlPrefix,
1660
+ topicPrefix: r.topicPrefix,
1661
+ beverageTopicPrefix: i
1662
+ });
1663
+ this.deviceNozzles.addModel(s);
1664
+ });
1665
+ }
1666
+ };
1667
+ st([
1668
+ M
1669
+ ], de.prototype, "deviceNozzles", 2);
1670
+ de = st([
1671
+ I(nt)
1672
+ ], de);
1673
+ const Yr = new Ot({
1674
+ class: de,
1675
+ type: nt
1676
+ }), { URL: ot } = S("GENERIC_POUR_SERVICE"), { postModel: Zr } = C.build({
1677
+ basePath: `${ot}/api/nozzle`
1678
+ }), Xr = async (e, t) => {
1679
+ const r = await Zr({
1680
+ model: {},
1681
+ urlOverride: `${ot}${e}`,
1682
+ ordered: !0,
1683
+ tracker: t
1684
+ });
1685
+ return r != null && r.data && ce.initiateFuture(r.data), r;
1686
+ };
1687
+ var Jr = Object.defineProperty, qr = Object.getOwnPropertyDescriptor, dt = (e, t, r, a) => {
1688
+ for (var i = a > 1 ? void 0 : a ? qr(t, r) : t, s = e.length - 1, n; s >= 0; s--)
1689
+ (n = e[s]) && (i = (a ? n(t, r, i) : n(i)) || i);
1690
+ return a && i && Jr(t, r, i), i;
1691
+ };
1692
+ const lt = "generic-pour-model", Wr = "/kos/generic/pour/started", Qr = "/kos/generic/pour/progress", Te = "/kos/generic/pour/cancel", Ie = (e) => e.onPourStart !== void 0 && e.onPourCancel !== void 0 && e.onPourProgress !== void 0;
1693
+ let le = class {
1694
+ constructor(e, t) {
1695
+ o(this, "id");
1696
+ o(this, "currentState", d.IDLE);
1697
+ o(this, "servicePathFactory");
1698
+ o(this, "pourType");
1699
+ o(this, "selectedId");
1700
+ o(this, "state");
1701
+ this.id = e, this.futureHandler = new Be(this), this.servicePathFactory = t.servicePathFactory, this.pourType = t.pourType || "free", this.selectedId = t.selectedId, this.state = Ce();
1702
+ }
1703
+ get servicePath() {
1704
+ return this.selectedId ? this.servicePathFactory(this.selectedId, this.state) : "";
1705
+ }
1706
+ updateContextData(e, t) {
1707
+ this.state[e] = t;
1708
+ }
1709
+ removeContextData(e) {
1710
+ delete this.state[e];
1711
+ }
1712
+ clearContextData() {
1713
+ this.state = Ce();
1714
+ }
1715
+ async pour(e) {
1716
+ var t;
1717
+ try {
1718
+ if (this.currentState === d.IDLE) {
1719
+ if (this.updateIfCurrent(d.IDLE, d.POUR_STARTING), !e)
1720
+ throw new Error("No tracker provided");
1721
+ const r = await Xr(this.servicePath, e);
1722
+ this.updateIfCurrent(d.POUR_STARTING, d.POURING), E(this).forEach((i) => {
1723
+ var s;
1724
+ Ie(i) && ((s = i.onPourStart) == null || s.call(i));
1725
+ });
1726
+ const a = {
1727
+ pourTarget: this.id,
1728
+ type: this.pourType
1729
+ };
1730
+ if (_.publish(Wr, a), (t = r == null ? void 0 : r.data) != null && t.endState) {
1731
+ this.updateIfCurrent(d.POURING, d.IDLE);
1732
+ const i = {
1733
+ pourTarget: this.id
1734
+ };
1735
+ _.publish(Te, i);
1736
+ }
1737
+ return r;
1738
+ } else
1739
+ throw new Error(`Cannot pour in state ${this.currentState}`);
1740
+ } catch (r) {
1741
+ throw this.logger.error(r), this.currentState = d.IDLE, r;
1742
+ }
1743
+ }
1744
+ async cancelPour() {
1745
+ var e;
1746
+ if (this.currentState === d.POURING || this.currentState === d.POUR_STARTING) {
1747
+ this.currentState = d.POUR_CANCELING, await ((e = this.futureHandler.getFuture()) == null ? void 0 : e.cancelFuture()), g(() => {
1748
+ this.currentState = d.IDLE;
1749
+ }), E(this).forEach((r) => {
1750
+ var a;
1751
+ Ie(r) && ((a = r.onPourCancel) == null || a.call(r));
1752
+ });
1753
+ const t = {
1754
+ pourTarget: this.id
1755
+ };
1756
+ _.publish(Te, t);
1757
+ }
1758
+ this.currentState === d.IDLE ? this.logger.info("Pour already idle, nothing to cancel.") : this.logger.warn(`Cannot cancel pour in state ${this.currentState}`);
1759
+ }
1760
+ updateIfCurrent(e, t) {
1761
+ this.currentState === e && g(() => {
1762
+ this.currentState = t;
1763
+ });
1764
+ }
1765
+ /**
1766
+ * A derived value that indicates if the nozzle is currently pouring a beverage.
1767
+ * @readonly
1768
+ */
1769
+ get isPouring() {
1770
+ var e;
1771
+ return !!(this.future && !((e = this.future) != null && e.endState)) || this.currentState === d.POUR_STARTING || this.currentState === d.POURING || this.currentState === d.POUR_CANCELING;
1772
+ }
1773
+ /**
1774
+ * A derived value that indicates if the pour target is currently available to pour a beverage.
1775
+ *
1776
+ * Generally this means that the pour target is currently idle and not in the process of pouring, initiating a pour, or canceling a pour.
1777
+ * The value is observable and will change when the selected pourable changes or the pour target
1778
+ * starts or stops pouring.
1779
+ * @readonly
1780
+ */
1781
+ get canPour() {
1782
+ return this.currentState === d.IDLE;
1783
+ }
1784
+ get pourProgress() {
1785
+ return this.progress ?? 0;
1786
+ }
1787
+ onFutureUpdate(e) {
1788
+ E(this).forEach((r) => {
1789
+ Ie(r) && r.onPourProgress(e);
1790
+ });
1791
+ const t = {
1792
+ pourTarget: this.id,
1793
+ progress: e.progress,
1794
+ status: e.status,
1795
+ clientData: e.clientData,
1796
+ futureId: e.futureId,
1797
+ remainingTimeMs: e.remainingTimeMs,
1798
+ endState: e.endState,
1799
+ reason: e.reason,
1800
+ timeRemaining: e.timeRemaining
1801
+ };
1802
+ _.publish(Qr, t), e.endState && g(() => {
1803
+ this.currentState = d.IDLE;
1804
+ });
1805
+ }
1806
+ };
1807
+ dt([
1808
+ pe()
1809
+ ], le.prototype, "pour", 1);
1810
+ le = dt([
1811
+ I(lt),
1812
+ Et(),
1813
+ wt()
1814
+ ], le);
1815
+ const di = new $t({
1816
+ class: le,
1817
+ type: lt
1818
+ }), ze = {
1819
+ ...Fe.registration,
1820
+ ...Ue.registration,
1821
+ ...et.registration,
1822
+ ...Ke.registration,
1823
+ ...we.registration,
1824
+ ...rt.registration,
1825
+ ...Me.registration,
1826
+ ...ve.registration,
1827
+ ...at.registration,
1828
+ ...Qe.registration
1829
+ }, ei = (e) => () => (Ct(e)(), Yr.register(), Object.keys(ze).forEach((t) => {
1830
+ const r = ze[t];
1831
+ Rt(e)(t, r);
1832
+ }), u[q].register(
1833
+ "FirmwareUpdateInProgressTrouble",
1834
+ async (t) => {
1835
+ var r;
1836
+ if ((r = t.data) != null && r.deviceId) {
1837
+ const { model: a } = z(
1838
+ at.type
1839
+ );
1840
+ if (a) {
1841
+ const i = a.boards.find(
1842
+ (s) => s.id === t.data.deviceId
1843
+ ) ? z(t.data.deviceId).model : void 0;
1844
+ return {
1845
+ devices: i ? i.name : ""
1846
+ };
1847
+ }
1848
+ }
1849
+ return {};
1850
+ }
1851
+ ), {
1852
+ preload: O.model.preloadModel(e),
1853
+ model: O.model.register(e),
1854
+ companion: O.companion.register(e),
1855
+ legacy: O.model.registerLegacyModel(e)
1856
+ }), P = {
1857
+ ...St
1858
+ };
1859
+ P.dispense = {
1860
+ models: ei(P)
1861
+ };
1862
+ P.preload = O.model.preloadModel(P);
1863
+ P.model = O.model.register(P);
1864
+ P.companion = O.companion.register(P);
1865
+ P.legacy = O.model.registerLegacyModel(P);
1866
+ const li = P;
1867
+ export {
1868
+ at as A,
1869
+ L as B,
1870
+ Rr as C,
1871
+ D,
1872
+ h as E,
1873
+ Br as F,
1874
+ di as G,
1875
+ Ke as H,
1876
+ Ue as I,
1877
+ Ar as J,
1878
+ li as K,
1879
+ xr as L,
1880
+ Ur as M,
1881
+ we as N,
1882
+ Xr as O,
1883
+ rt as P,
1884
+ Ye as T,
1885
+ Dr as a,
1886
+ ve as b,
1887
+ Ze as c,
1888
+ Qe as d,
1889
+ We as e,
1890
+ Yr as f,
1891
+ et as g,
1892
+ Fe as h,
1893
+ Me as i,
1894
+ Je as j,
1895
+ d as k,
1896
+ ze as l,
1897
+ zt as m,
1898
+ ni as n,
1899
+ jt as o,
1900
+ oi as p,
1901
+ si as q,
1902
+ ei as r,
1903
+ ai as s,
1904
+ Ht as t,
1905
+ kt as u,
1906
+ Ft as v,
1907
+ ke as w,
1908
+ Mr as x,
1909
+ _r as y,
1910
+ Gr as z
1911
+ };
1912
+ //# sourceMappingURL=dispense-registration-manager-CB_nSTZw.js.map