@curless/hotel-storefront 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/dist/server.d.ts +1 -1
  2. package/dist/server.js +1 -1
  3. package/dist/tools/accept-terms.d.ts +4 -0
  4. package/dist/tools/accept-terms.d.ts.map +1 -0
  5. package/dist/tools/accept-terms.js +26 -0
  6. package/dist/tools/accept-terms.js.map +1 -0
  7. package/dist/tools/add-booking-addon.d.ts +4 -0
  8. package/dist/tools/add-booking-addon.d.ts.map +1 -0
  9. package/dist/tools/add-booking-addon.js +44 -0
  10. package/dist/tools/add-booking-addon.js.map +1 -0
  11. package/dist/tools/add-to-trip.d.ts +4 -0
  12. package/dist/tools/add-to-trip.d.ts.map +1 -0
  13. package/dist/tools/add-to-trip.js +49 -0
  14. package/dist/tools/add-to-trip.js.map +1 -0
  15. package/dist/tools/all-tools.d.ts +19124 -0
  16. package/dist/tools/all-tools.d.ts.map +1 -0
  17. package/dist/tools/all-tools.js +43 -0
  18. package/dist/tools/all-tools.js.map +1 -0
  19. package/dist/tools/answer.d.ts +3 -0
  20. package/dist/tools/answer.d.ts.map +1 -0
  21. package/dist/tools/answer.js +104 -0
  22. package/dist/tools/answer.js.map +1 -0
  23. package/dist/tools/args.d.ts +149 -0
  24. package/dist/tools/args.d.ts.map +1 -0
  25. package/dist/tools/args.js +176 -0
  26. package/dist/tools/args.js.map +1 -0
  27. package/dist/tools/base-output-schemas.d.ts +3 -0
  28. package/dist/tools/base-output-schemas.d.ts.map +1 -0
  29. package/dist/tools/base-output-schemas.js +396 -0
  30. package/dist/tools/base-output-schemas.js.map +1 -0
  31. package/dist/tools/book-picked.d.ts +4 -0
  32. package/dist/tools/book-picked.d.ts.map +1 -0
  33. package/dist/tools/book-picked.js +14 -0
  34. package/dist/tools/book-picked.js.map +1 -0
  35. package/dist/tools/booking-answer.d.ts +24 -0
  36. package/dist/tools/booking-answer.d.ts.map +1 -0
  37. package/dist/tools/booking-answer.js +567 -0
  38. package/dist/tools/booking-answer.js.map +1 -0
  39. package/dist/tools/buy-shop-item.d.ts +4 -0
  40. package/dist/tools/buy-shop-item.d.ts.map +1 -0
  41. package/dist/tools/buy-shop-item.js +45 -0
  42. package/dist/tools/buy-shop-item.js.map +1 -0
  43. package/dist/tools/call.d.ts +11 -0
  44. package/dist/tools/call.d.ts.map +1 -0
  45. package/dist/tools/call.js +2 -0
  46. package/dist/tools/call.js.map +1 -0
  47. package/dist/tools/cancel-facts.d.ts +281 -0
  48. package/dist/tools/cancel-facts.d.ts.map +1 -0
  49. package/dist/tools/cancel-facts.js +309 -0
  50. package/dist/tools/cancel-facts.js.map +1 -0
  51. package/dist/tools/cancel.d.ts +4 -0
  52. package/dist/tools/cancel.d.ts.map +1 -0
  53. package/dist/tools/cancel.js +415 -0
  54. package/dist/tools/cancel.js.map +1 -0
  55. package/dist/tools/capability-adjust.d.ts +31 -0
  56. package/dist/tools/capability-adjust.d.ts.map +1 -0
  57. package/dist/tools/capability-adjust.js +299 -0
  58. package/dist/tools/capability-adjust.js.map +1 -0
  59. package/dist/tools/card-addons.d.ts +4 -0
  60. package/dist/tools/card-addons.d.ts.map +1 -0
  61. package/dist/tools/card-addons.js +76 -0
  62. package/dist/tools/card-addons.js.map +1 -0
  63. package/dist/tools/change-booking.d.ts +4 -0
  64. package/dist/tools/change-booking.d.ts.map +1 -0
  65. package/dist/tools/change-booking.js +145 -0
  66. package/dist/tools/change-booking.js.map +1 -0
  67. package/dist/tools/clear-trip.d.ts +4 -0
  68. package/dist/tools/clear-trip.d.ts.map +1 -0
  69. package/dist/tools/clear-trip.js +10 -0
  70. package/dist/tools/clear-trip.js.map +1 -0
  71. package/dist/tools/compare.d.ts +4 -0
  72. package/dist/tools/compare.d.ts.map +1 -0
  73. package/dist/tools/compare.js +114 -0
  74. package/dist/tools/compare.js.map +1 -0
  75. package/dist/tools/current-trip.d.ts +70 -0
  76. package/dist/tools/current-trip.d.ts.map +1 -0
  77. package/dist/tools/current-trip.js +269 -0
  78. package/dist/tools/current-trip.js.map +1 -0
  79. package/dist/tools/deps.d.ts +229 -0
  80. package/dist/tools/deps.d.ts.map +1 -0
  81. package/dist/tools/deps.js +2 -0
  82. package/dist/tools/deps.js.map +1 -0
  83. package/dist/tools/follow-ups.d.ts +120 -0
  84. package/dist/tools/follow-ups.d.ts.map +1 -0
  85. package/dist/tools/follow-ups.js +369 -0
  86. package/dist/tools/follow-ups.js.map +1 -0
  87. package/dist/tools/forget-preferences.d.ts +4 -0
  88. package/dist/tools/forget-preferences.d.ts.map +1 -0
  89. package/dist/tools/forget-preferences.js +24 -0
  90. package/dist/tools/forget-preferences.js.map +1 -0
  91. package/dist/tools/get-hotel.d.ts +4 -0
  92. package/dist/tools/get-hotel.d.ts.map +1 -0
  93. package/dist/tools/get-hotel.js +350 -0
  94. package/dist/tools/get-hotel.js.map +1 -0
  95. package/dist/tools/hotel-choices.d.ts +132 -0
  96. package/dist/tools/hotel-choices.d.ts.map +1 -0
  97. package/dist/tools/hotel-choices.js +587 -0
  98. package/dist/tools/hotel-choices.js.map +1 -0
  99. package/dist/tools/itinerary.d.ts +4 -0
  100. package/dist/tools/itinerary.d.ts.map +1 -0
  101. package/dist/tools/itinerary.js +158 -0
  102. package/dist/tools/itinerary.js.map +1 -0
  103. package/dist/tools/list-booking-addons.d.ts +4 -0
  104. package/dist/tools/list-booking-addons.d.ts.map +1 -0
  105. package/dist/tools/list-booking-addons.js +21 -0
  106. package/dist/tools/list-booking-addons.js.map +1 -0
  107. package/dist/tools/list-bookings.d.ts +4 -0
  108. package/dist/tools/list-bookings.d.ts.map +1 -0
  109. package/dist/tools/list-bookings.js +119 -0
  110. package/dist/tools/list-bookings.js.map +1 -0
  111. package/dist/tools/list-extras.d.ts +4 -0
  112. package/dist/tools/list-extras.d.ts.map +1 -0
  113. package/dist/tools/list-extras.js +90 -0
  114. package/dist/tools/list-extras.js.map +1 -0
  115. package/dist/tools/list-hotels-ask.d.ts +133 -0
  116. package/dist/tools/list-hotels-ask.d.ts.map +1 -0
  117. package/dist/tools/list-hotels-ask.js +326 -0
  118. package/dist/tools/list-hotels-ask.js.map +1 -0
  119. package/dist/tools/list-hotels-empty.d.ts +5 -0
  120. package/dist/tools/list-hotels-empty.d.ts.map +1 -0
  121. package/dist/tools/list-hotels-empty.js +130 -0
  122. package/dist/tools/list-hotels-empty.js.map +1 -0
  123. package/dist/tools/list-hotels-home.d.ts +9 -0
  124. package/dist/tools/list-hotels-home.d.ts.map +1 -0
  125. package/dist/tools/list-hotels-home.js +181 -0
  126. package/dist/tools/list-hotels-home.js.map +1 -0
  127. package/dist/tools/list-hotels-page.d.ts +43 -0
  128. package/dist/tools/list-hotels-page.d.ts.map +1 -0
  129. package/dist/tools/list-hotels-page.js +344 -0
  130. package/dist/tools/list-hotels-page.js.map +1 -0
  131. package/dist/tools/list-hotels.d.ts +4 -0
  132. package/dist/tools/list-hotels.d.ts.map +1 -0
  133. package/dist/tools/list-hotels.js +24 -0
  134. package/dist/tools/list-hotels.js.map +1 -0
  135. package/dist/tools/list-shop-items.d.ts +4 -0
  136. package/dist/tools/list-shop-items.d.ts.map +1 -0
  137. package/dist/tools/list-shop-items.js +34 -0
  138. package/dist/tools/list-shop-items.js.map +1 -0
  139. package/dist/tools/list-shop-orders.d.ts +4 -0
  140. package/dist/tools/list-shop-orders.d.ts.map +1 -0
  141. package/dist/tools/list-shop-orders.js +22 -0
  142. package/dist/tools/list-shop-orders.js.map +1 -0
  143. package/dist/tools/look-up.d.ts +4 -0
  144. package/dist/tools/look-up.d.ts.map +1 -0
  145. package/dist/tools/look-up.js +207 -0
  146. package/dist/tools/look-up.js.map +1 -0
  147. package/dist/tools/output-schemas.d.ts +645 -0
  148. package/dist/tools/output-schemas.d.ts.map +1 -0
  149. package/dist/tools/output-schemas.js +503 -0
  150. package/dist/tools/output-schemas.js.map +1 -0
  151. package/dist/tools/paid-lines.d.ts +718 -0
  152. package/dist/tools/paid-lines.d.ts.map +1 -0
  153. package/dist/tools/paid-lines.js +359 -0
  154. package/dist/tools/paid-lines.js.map +1 -0
  155. package/dist/tools/pay-with-union-pay.d.ts +4 -0
  156. package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
  157. package/dist/tools/pay-with-union-pay.js +112 -0
  158. package/dist/tools/pay-with-union-pay.js.map +1 -0
  159. package/dist/tools/payment-words.d.ts +269 -0
  160. package/dist/tools/payment-words.d.ts.map +1 -0
  161. package/dist/tools/payment-words.js +365 -0
  162. package/dist/tools/payment-words.js.map +1 -0
  163. package/dist/tools/pick-room.d.ts +4 -0
  164. package/dist/tools/pick-room.d.ts.map +1 -0
  165. package/dist/tools/pick-room.js +23 -0
  166. package/dist/tools/pick-room.js.map +1 -0
  167. package/dist/tools/policies.d.ts +4 -0
  168. package/dist/tools/policies.d.ts.map +1 -0
  169. package/dist/tools/policies.js +74 -0
  170. package/dist/tools/policies.js.map +1 -0
  171. package/dist/tools/pricing.d.ts +55 -0
  172. package/dist/tools/pricing.d.ts.map +1 -0
  173. package/dist/tools/pricing.js +260 -0
  174. package/dist/tools/pricing.js.map +1 -0
  175. package/dist/tools/put-room-line.d.ts +12 -0
  176. package/dist/tools/put-room-line.d.ts.map +1 -0
  177. package/dist/tools/put-room-line.js +347 -0
  178. package/dist/tools/put-room-line.js.map +1 -0
  179. package/dist/tools/quote-card.d.ts +234 -0
  180. package/dist/tools/quote-card.d.ts.map +1 -0
  181. package/dist/tools/quote-card.js +375 -0
  182. package/dist/tools/quote-card.js.map +1 -0
  183. package/dist/tools/refund-booking.d.ts +4 -0
  184. package/dist/tools/refund-booking.d.ts.map +1 -0
  185. package/dist/tools/refund-booking.js +112 -0
  186. package/dist/tools/refund-booking.js.map +1 -0
  187. package/dist/tools/request-booking.d.ts +4 -0
  188. package/dist/tools/request-booking.d.ts.map +1 -0
  189. package/dist/tools/request-booking.js +5 -0
  190. package/dist/tools/request-booking.js.map +1 -0
  191. package/dist/tools/request-words.d.ts +238 -0
  192. package/dist/tools/request-words.d.ts.map +1 -0
  193. package/dist/tools/request-words.js +487 -0
  194. package/dist/tools/request-words.js.map +1 -0
  195. package/dist/tools/room-choices.d.ts +64 -0
  196. package/dist/tools/room-choices.d.ts.map +1 -0
  197. package/dist/tools/room-choices.js +374 -0
  198. package/dist/tools/room-choices.js.map +1 -0
  199. package/dist/tools/session-notes.d.ts +164 -0
  200. package/dist/tools/session-notes.d.ts.map +1 -0
  201. package/dist/tools/session-notes.js +412 -0
  202. package/dist/tools/session-notes.js.map +1 -0
  203. package/dist/tools/sign-in.d.ts +4 -0
  204. package/dist/tools/sign-in.d.ts.map +1 -0
  205. package/dist/tools/sign-in.js +72 -0
  206. package/dist/tools/sign-in.js.map +1 -0
  207. package/dist/tools/sign-out.d.ts +4 -0
  208. package/dist/tools/sign-out.d.ts.map +1 -0
  209. package/dist/tools/sign-out.js +13 -0
  210. package/dist/tools/sign-out.js.map +1 -0
  211. package/dist/tools/terms-answer.d.ts +114 -0
  212. package/dist/tools/terms-answer.d.ts.map +1 -0
  213. package/dist/tools/terms-answer.js +492 -0
  214. package/dist/tools/terms-answer.js.map +1 -0
  215. package/dist/tools/tool-defs-account.d.ts +80 -0
  216. package/dist/tools/tool-defs-account.d.ts.map +1 -0
  217. package/dist/tools/tool-defs-account.js +65 -0
  218. package/dist/tools/tool-defs-account.js.map +1 -0
  219. package/dist/tools/tool-defs-addons.d.ts +251 -0
  220. package/dist/tools/tool-defs-addons.d.ts.map +1 -0
  221. package/dist/tools/tool-defs-addons.js +198 -0
  222. package/dist/tools/tool-defs-addons.js.map +1 -0
  223. package/dist/tools/tool-defs-booking.d.ts +410 -0
  224. package/dist/tools/tool-defs-booking.d.ts.map +1 -0
  225. package/dist/tools/tool-defs-booking.js +285 -0
  226. package/dist/tools/tool-defs-booking.js.map +1 -0
  227. package/dist/tools/tool-defs-browse.d.ts +444 -0
  228. package/dist/tools/tool-defs-browse.d.ts.map +1 -0
  229. package/dist/tools/tool-defs-browse.js +307 -0
  230. package/dist/tools/tool-defs-browse.js.map +1 -0
  231. package/dist/tools/tool-defs-trip.d.ts +136 -0
  232. package/dist/tools/tool-defs-trip.d.ts.map +1 -0
  233. package/dist/tools/tool-defs-trip.js +79 -0
  234. package/dist/tools/tool-defs-trip.js.map +1 -0
  235. package/dist/tools/tool-env.d.ts +64 -0
  236. package/dist/tools/tool-env.d.ts.map +1 -0
  237. package/dist/tools/tool-env.js +49 -0
  238. package/dist/tools/tool-env.js.map +1 -0
  239. package/dist/tools/tool-set.d.ts +1425 -0
  240. package/dist/tools/tool-set.d.ts.map +1 -0
  241. package/dist/tools/tool-set.js +244 -0
  242. package/dist/tools/tool-set.js.map +1 -0
  243. package/dist/tools/view-trip.d.ts +4 -0
  244. package/dist/tools/view-trip.d.ts.map +1 -0
  245. package/dist/tools/view-trip.js +7 -0
  246. package/dist/tools/view-trip.js.map +1 -0
  247. package/dist/tools.d.ts +13 -2089
  248. package/dist/tools.d.ts.map +1 -1
  249. package/dist/tools.js +11 -10685
  250. package/dist/tools.js.map +1 -1
  251. package/package.json +1 -1
@@ -0,0 +1,350 @@
1
+ import { aboutLines } from '../about.js';
2
+ import { FULL_CAPABILITIES } from '../backend.js';
3
+ import { addDays, dayWords, stayDayWords, weekendOf, weekendWords } from '../dates.js';
4
+ import { DESCRIPTION_MAX, hotelText } from '../fence.js';
5
+ import { formatMoney, multiplyMoney } from '../money.js';
6
+ import { candidatesFor, namesMoreThanOne } from '../present.js';
7
+ import { activeKeysOf, facetsOf, matchesTerms, optionsOf, roomTermsOf, termWords, } from '../room-filters.js';
8
+ import { MAX_ROOMS_PER_LINE } from '../trip.js';
9
+ import { branded } from '../vocab.js';
10
+ import { answerTool } from './answer.js';
11
+ import { asStay, str } from './args.js';
12
+ import { ON_CARD } from './follow-ups.js';
13
+ import { common } from './paid-lines.js';
14
+ import { freeUntilText, memberRatesOf, withZh } from './quote-card.js';
15
+ import { groupNameOf, guestsOf, notBookableOf, notOnSaleWords, notSoldHereWords, offerCount, unpaidBookingWords, } from './request-words.js';
16
+ import { roomChoicesOf, roomsText, stayDefaultWords, todayOfHotel } from './room-choices.js';
17
+ import { askLater, identity } from './session-notes.js';
18
+ import { HOTEL_GEO_META_KEY, HOTEL_PHOTOS_META_KEY, ROOM_PHOTOS_META_KEY, dateFlex, hotelFactsText, soldOutTypesOf, } from './terms-answer.js';
19
+ export const answerGetHotel = async (call) => {
20
+ const { deps, args, ctx, t, key } = call;
21
+ const wanted = str(args.hotel);
22
+ const who = identity(deps, ctx, key);
23
+ // Today's rooms by the hour, on the hotel's own date - see `hourlyRooms`.
24
+ const byTheHour = args.hourly === true && !!deps.backend.hourlyRooms;
25
+ const detail = byTheHour
26
+ ? await deps.backend.hourlyRooms?.(wanted, guestsOf(args), who)
27
+ : await deps.backend.getHotel(wanted, asStay(args), who);
28
+ const stay = byTheHour ? detail?.stay : asStay(args);
29
+ if (!detail) {
30
+ const candidates = candidatesFor(deps.backend, wanted);
31
+ return {
32
+ structured: {
33
+ view: 'hotel-not-found',
34
+ ...common(deps, key),
35
+ query: wanted,
36
+ ...(candidates.length ? { candidates } : {}),
37
+ },
38
+ text: candidates.length
39
+ ? `"${wanted}" ${namesMoreThanOne(candidates, branded(deps.vocab, deps.vocab.noun))}`
40
+ : `No ${branded(deps.vocab, deps.vocab.noun)} by that name. ${t.listHotels} lists them.`,
41
+ };
42
+ }
43
+ const view = await hotelViewOf(call, detail, stay);
44
+ const { h } = view;
45
+ if (!stay && ctx.noCards && !byTheHour)
46
+ return pricedForTonight(call, view);
47
+ if (!stay)
48
+ return datesNeededAnswer(call, view);
49
+ // ⚠️ THE ROOM COUNT FILTERS THE LIST, it does not just ride along. A guest
50
+ // who needs two rooms and is shown a type with one left finds out when the
51
+ // trip drops the line, which is later and worse than not offering it.
52
+ const roomsWanted = Math.max(1, Math.min(MAX_ROOMS_PER_LINE, Math.floor(Number(args.rooms) || 1)));
53
+ // ⚠️ ONLY WHEN SHIFTING THE DATES COULD HELP. `detail.rooms` is undefined
54
+ // for the two reasons a different arrival cannot fix - the dates are not
55
+ // bookable at all, or no room type here sleeps this party - and offering a
56
+ // week of alternatives to either is noise dressed as help.
57
+ // Other arrival dates mean nothing to a room sold for today only.
58
+ const dates = detail.rooms && !byTheHour
59
+ ? await deps.backend.datesAround(h.id, stay, { rooms: roomsWanted, span: 3 }, who)
60
+ : [];
61
+ const flex = dateFlex(dates, stay);
62
+ if (detail.noRooms || !detail.rooms)
63
+ return noRoomsAnswer(call, view, detail, stay, flex);
64
+ const enough = detail.rooms.filter((r) => r.roomsLeft >= roomsWanted);
65
+ if (enough.length === 0)
66
+ return soldOutAnswer(view, stay, roomsWanted, flex);
67
+ return hotelWithRooms(call, view, { detail, stay, byTheHour, roomsWanted, flex, enough });
68
+ };
69
+ /** The hotel as every answer about it opens - read once, before any of them is picked. */
70
+ const hotelViewOf = async ({ deps, ctx, key }, detail, stay) => {
71
+ const h = detail.hotel;
72
+ const description = hotelText('description', h.name,
73
+ // Its 【…】 parts a line each, the words as they came (`aboutLines`).
74
+ aboutLines(h.summary), DESCRIPTION_MAX, deps.vocab.demo);
75
+ // ⚠️ NO POLICIES WHERE THE POLICIES TOOL IS NOT OFFERED (总线程 11-04): Atour's
76
+ // single store (`policies: false`) still listed its topics on every hotel, and
77
+ // the card drew six rows of 「入住须知」 that each opened on "could not load
78
+ // this policy". Not read, not in the answer - the model is not told of a
79
+ // policy nobody can open either.
80
+ const offersPolicies = (deps.backend.capabilities ?? FULL_CAPABILITIES).policies !== false;
81
+ const policies = offersPolicies ? await deps.backend.policies(h.id) : [];
82
+ const extras = await deps.backend.extrasFor(h.id, stay);
83
+ const base = {
84
+ ...common(deps, key),
85
+ hotel: {
86
+ ...h,
87
+ // The hotel's own phone, years and room count: the model reads them (`HotelFacts`).
88
+ ...(detail.facts ?? {}),
89
+ summary: description.text,
90
+ fromNightly: h.fromNightly ? formatMoney(h.fromNightly) : undefined,
91
+ },
92
+ extras: extras.map((e) => ({ ...e, price: formatMoney(e.price) })),
93
+ ...(offersPolicies
94
+ ? { policies: policies.map((p) => ({ topic: p.topic, title: p.title })) }
95
+ : {}),
96
+ };
97
+ const aboutSaid = hotelFactsText(detail.facts);
98
+ // The photographs and the place, for the card alone (`HOTEL_PHOTOS_META_KEY`, `HOTEL_GEO_META_KEY`).
99
+ const hotelMeta = ctx.drawsCards
100
+ ? {
101
+ ...(detail.hotelPhotos && detail.hotelPhotos.photos.length > 1
102
+ ? { [HOTEL_PHOTOS_META_KEY]: { [h.id]: detail.hotelPhotos } }
103
+ : {}),
104
+ ...(detail.geo ? { [HOTEL_GEO_META_KEY]: { [h.id]: detail.geo } } : {}),
105
+ }
106
+ : {};
107
+ const metaWith = (more = {}) => {
108
+ const all = { ...hotelMeta, ...more };
109
+ return Object.keys(all).length ? { meta: all } : {};
110
+ };
111
+ return { h, description, base, aboutSaid, metaWith };
112
+ };
113
+ // ⚠️ TO A CLIENT THAT DRAWS NO CARD, NO DATES IS TONIGHT, PRICED - AND SAID
114
+ // (robin 11-06, with 总线程 after RollingGo and robin's Manus run): the card
115
+ // fills in tonight itself, so a guest who can tap sees rooms at once; in
116
+ // words, "which nights?" was a turn with nothing to look at. Tonight on the
117
+ // hotel's own calendar, as the card and a short list open (robin 10-30:
118
+ // 「默认今晚并直接出价」); the answer opens on that default and on this
119
+ // weekend and next by their dates - see `stayDefaultWords`.
120
+ const pricedForTonight = async ({ deps, args, ctx, t }, { h, description }) => {
121
+ const today = todayOfHotel(h, deps.trips.now());
122
+ const priced = await answerTool(deps, t.getHotel, {
123
+ ...args,
124
+ hotel: h.id,
125
+ checkIn: today,
126
+ checkOut: addDays(today, 1),
127
+ guests: guestsOf(args),
128
+ }, ctx);
129
+ const stayDefault = stayDefaultWords(today, guestsOf(args), args.rooms, 'rooms');
130
+ return {
131
+ ...priced,
132
+ // In both, in the same words: the model reads the structure.
133
+ structured: { ...priced.structured, stayDefault },
134
+ // The hotel's own words stay: a dateless question is often "what is it like".
135
+ text: [stayDefault, description.fenced, priced.text].filter(Boolean).join('\n\n'),
136
+ };
137
+ };
138
+ /** No dates yet, to a client that draws a card: the hotel and what it needs to price its rooms. */
139
+ const datesNeededAnswer = ({ args, ctx }, { h, description, base, aboutSaid, metaWith }) => {
140
+ return {
141
+ ...metaWith(),
142
+ // ⚠️ THE FILTERS RIDE ALONG WITHOUT DATES: the card prices the dates
143
+ // itself and draws its chips from this answer, so a model that asked
144
+ // for breakfast before any night was named still has it asked.
145
+ structured: {
146
+ view: 'hotel',
147
+ ...base,
148
+ needsDates: true,
149
+ activeFilters: activeKeysOf(roomTermsOf(args)),
150
+ },
151
+ text: [
152
+ `**${ctx.noCards ? withZh(h.name, h.names?.name, true) : h.name}** · ${[h.area, h.city].filter(Boolean).join(', ')}`,
153
+ description.fenced,
154
+ aboutSaid,
155
+ 'Rooms and prices need the dates - which nights is the guest staying?',
156
+ ]
157
+ .filter(Boolean)
158
+ .join('\n\n'),
159
+ };
160
+ };
161
+ /** The hotel has no rooms to show for these nights. */
162
+ const noRoomsAnswer = ({ deps, ctx }, { h, base, aboutSaid, metaWith }, detail, stay, flex) => {
163
+ // ⚠️ NOTHING ON SALE HERE SAYS WHERE TO BOOK IT (T5): the same sentence
164
+ // in the text and in `noRooms`, which the card does not draw for this code
165
+ // (it says it in the guest's language from `noRoomsCode`).
166
+ const said = detail.noRooms && detail.noRoomsCode === 'none-on-sale'
167
+ ? notOnSaleWords(groupNameOf(deps, h.id), detail.noRooms)
168
+ : // Rooms that could not be read just now: asked for again by the guest.
169
+ detail.noRooms && detail.noRoomsCode === 'unreachable'
170
+ ? `${detail.noRooms} ${askLater(!ctx.noCards)}`
171
+ : detail.noRooms;
172
+ return {
173
+ ...metaWith(),
174
+ structured: {
175
+ view: 'no-rooms',
176
+ ...base,
177
+ stay,
178
+ noRooms: said,
179
+ ...(detail.noRoomsCode ? { noRoomsCode: detail.noRoomsCode } : {}),
180
+ ...(detail.noRoomsArgs ? { noRoomsArgs: detail.noRoomsArgs } : {}),
181
+ ...flex.structured,
182
+ },
183
+ text: [said ?? 'Nothing is available for those nights.', flex.text, aboutSaid]
184
+ .filter(Boolean)
185
+ .join(' '),
186
+ };
187
+ };
188
+ /** Rooms there are, but none with as many left as the guest needs. */
189
+ const soldOutAnswer = ({ h, base, aboutSaid, metaWith }, stay, roomsWanted, flex) => {
190
+ return {
191
+ ...metaWith(),
192
+ structured: {
193
+ view: 'no-rooms',
194
+ ...base,
195
+ stay,
196
+ rooms_wanted: roomsWanted,
197
+ noRooms: `No room type here has ${roomsWanted} left for those nights.`,
198
+ noRoomsCode: 'sold-out',
199
+ noRoomsArgs: { rooms: roomsWanted },
200
+ ...flex.structured,
201
+ },
202
+ text: [
203
+ `No room type at ${h.name} has ${roomsWanted} left for ${stay.checkIn} to ${stay.checkOut}.`,
204
+ flex.text,
205
+ aboutSaid,
206
+ ]
207
+ .filter(Boolean)
208
+ .join(' '),
209
+ };
210
+ };
211
+ /** The rooms that can be booked for these nights, as the card holds them. */
212
+ const roomsForCard = (enough, roomsWanted) => {
213
+ return enough.map(({ roomsLeft, refundable, ...r }) => ({
214
+ ...r,
215
+ // ⚠️ NO COUNT WHERE THE SUPPLIER GIVES NONE, and no yes / no on
216
+ // cancelling beside its own sentence (`Room.uncounted`, `Room.terms`).
217
+ ...(r.uncounted ? {} : { roomsLeft }),
218
+ ...(r.terms !== undefined ? {} : { refundable }),
219
+ facets: facetsOf({ ...r, roomsLeft, refundable }),
220
+ nightly: formatMoney(r.nightly),
221
+ // The room charges for the stay, where `nightly` is a rounded average (0.79.1).
222
+ ...(r.roomCharges ? { roomCharges: formatMoney(r.roomCharges) } : {}),
223
+ // ⚠️ NO STAY TOTAL WHERE IT IS OURS (总线程 11-13, `Room.stayTotalUnquoted`):
224
+ // absent here, so neither the card nor the model reads nights times a night
225
+ // as a price the group gave for the stay.
226
+ // (Undefined, so the key does not travel: the answer is JSON.)
227
+ stayTotal: r.stayTotalUnquoted ? undefined : formatMoney(r.stayTotal),
228
+ // ⚠️ "INCLUDED", NOT "¥0", where the supplier's price has its taxes in and
229
+ // gives no split (`Room.terms`, Otaless): told "taxesAndFees ¥0", the
230
+ // model said "税费 ¥0" - no tax - of a price the group says includes it.
231
+ taxesAndFees: r.terms !== undefined && r.taxesAndFees.minor === 0
232
+ ? 'Included'
233
+ : formatMoney(r.taxesAndFees),
234
+ // ⚠️ THE NUMBER THE GUEST IS LOOKING AT HAS TO BE THE ONE THEY ASKED FOR.
235
+ // With two rooms picked, the card was still showing one room's total and
236
+ // nothing said so - robin changed the count and watched the price not
237
+ // move (2026-09-18). Multiplied HERE, in minor units, because the card
238
+ // holds formatted strings and must never do arithmetic on money.
239
+ ...(roomsWanted > 1 && !r.stayTotalUnquoted
240
+ ? { roomsTotal: formatMoney(multiplyMoney(r.stayTotal, roomsWanted)) }
241
+ : {}),
242
+ // ⚠️ THE PUBLIC RATE IS MONEY TOO. It went out as a raw
243
+ // `{ minor, currency }` and the card would have drawn "[object Object]"
244
+ // through the middle with a line - caught by the test that asserted the
245
+ // string, not by anyone looking at it.
246
+ ...(r.publicNightly ? { publicNightly: formatMoney(r.publicNightly) } : {}),
247
+ ...(r.publicStayTotal ? { publicStayTotal: formatMoney(r.publicStayTotal) } : {}),
248
+ // ⚠️ AND STRUCK THROUGH FOR AS MANY ROOMS AS THE PRICE BESIDE IT. One
249
+ // room's public rate drawn over two rooms' member rate put a "was" price
250
+ // BELOW the price a member pays (2026-10-05 audit).
251
+ ...(r.publicStayTotal && roomsWanted > 1
252
+ ? { publicRoomsTotal: formatMoney(multiplyMoney(r.publicStayTotal, roomsWanted)) }
253
+ : {}),
254
+ ...(r.freeCancellationUntil ? { freeCancellationLocal: freeUntilText(r) } : {}),
255
+ }));
256
+ };
257
+ /** The hotel's page with the rooms to book for the nights asked: the card's and the words. */
258
+ const hotelWithRooms = ({ deps, args, ctx }, { h, base, aboutSaid, metaWith }, { detail, stay, byTheHour, roomsWanted, flex, enough, }) => {
259
+ // ⚠️ THE CARD KEEPS EVERY ROOM, THE TEXT KEEPS THE ONES THAT MATCH. The
260
+ // filters narrow what the assistant is told; the card is sent all of them
261
+ // with what is true of each (`facets`), so a chip switched on or off on the
262
+ // card needs no call to the server.
263
+ const terms = roomTermsOf(args);
264
+ const soldOut = soldOutTypesOf(detail, enough, roomsWanted);
265
+ // Rates paid in advance booked here without payment (0.77.5) - said beside, never instead of,
266
+ // what is said of the ones not booked here.
267
+ const unpaidHere = enough.some((r) => r.paymentNotConnected)
268
+ ? unpaidBookingWords(groupNameOf(deps, h.id))
269
+ : '';
270
+ const notSold = enough.some((r) => r.notSoldHere)
271
+ ? notSoldHereWords(groupNameOf(deps, h.id), !!unpaidHere)
272
+ : '';
273
+ const rooms = roomsForCard(enough, roomsWanted);
274
+ const memberRates = memberRatesOf(enough, roomsWanted);
275
+ // To a client that draws no card, the rooms are numbered choices - in the
276
+ // text and, word for word, here: the model reads the structure.
277
+ const choosable = terms ? enough.filter((r) => matchesTerms(r, terms)) : enough;
278
+ // The other arrivals are priced on the cheapest room of any kind.
279
+ const flexSaid = terms && flex.text
280
+ ? `${flex.text} (That is the cheapest room of any kind, not only one with ${termWords(terms)}.)`
281
+ : flex.text;
282
+ // ⚠️ BEFORE THE LIST, NOT AFTER IT (总线程 11-06, robin's Manus run): "arriving
283
+ // the 18th is ¥253 less", last in the answer, was never passed on. (Rates not booked
284
+ // here are no longer said before it - 0.75.1, `notSoldHereWords`.)
285
+ const before = flexSaid ? `${flexSaid} Say that in one sentence before the list too.` : '';
286
+ const saidWhen = byTheHour
287
+ ? `today, ${dayWords(stay.checkIn)}, ${stay.guests} ${stay.guests === 1 ? 'guest' : 'guests'}`
288
+ : `${stayDayWords(stay.checkIn, stay.checkOut)}, ${stay.guests} ${stay.guests === 1 ? 'guest' : 'guests'}${roomsWanted > 1 ? `, ${roomsWanted} rooms` : ''}`;
289
+ const notBookable = notBookableOf(deps);
290
+ const roomChoices = ctx.noCards && choosable.length
291
+ ? roomChoicesOf(choosable, roomsWanted, saidWhen, before, groupNameOf(deps, h.id), !!notBookable).join('\n')
292
+ : undefined;
293
+ // ⚠️ 「这周末」 WORKED OUT AS SATURDAY NIGHT (总线程 11-09, claude.ai and Manus
294
+ // both) is said back first, in both - see `weekendOf`.
295
+ const weekendFor = byTheHour
296
+ ? null
297
+ : weekendOf(stay.checkIn, stay.checkOut, todayOfHotel(h, deps.trips.now()));
298
+ const weekend = weekendFor ? weekendWords(weekendFor) : '';
299
+ // Each listed type's photographs, for the card alone (`ROOM_PHOTOS_META_KEY`).
300
+ const galleries = Object.fromEntries(Object.entries(detail.roomPhotos ?? {}).filter(([id, list]) => list.length > 1 && enough.some((r) => (r.roomType?.id ?? r.id) === id)));
301
+ return {
302
+ ...metaWith(ctx.drawsCards && Object.keys(galleries).length
303
+ ? { [ROOM_PHOTOS_META_KEY]: { [h.id]: galleries } }
304
+ : {}),
305
+ structured: {
306
+ view: 'hotel',
307
+ ...base,
308
+ stay,
309
+ ...(weekend ? { weekend } : {}),
310
+ ...(roomChoices ? { roomChoices } : {}),
311
+ rooms,
312
+ rooms_wanted: roomsWanted,
313
+ roomFilters: optionsOf(enough),
314
+ activeFilters: activeKeysOf(terms),
315
+ // Types with no room to book for these nights, said and not left out.
316
+ ...(byTheHour || !soldOut.length ? {} : { soldOut }),
317
+ ...(unpaidHere ? { bookedWithoutPayment: unpaidHere } : {}),
318
+ ...(notSold ? { notSoldHere: notSold } : {}),
319
+ ...(memberRates ? { memberRates } : {}),
320
+ ...flex.structured,
321
+ ...(ctx.drawsCards && enough.length ? { cardShows: ON_CARD.rooms } : {}),
322
+ ...(notBookable ? { notBookable } : {}),
323
+ // ⚠️ THE GROUP'S TWO PRICE ANSWERS DISAGREE (总线程 11-13): in both, the model reads either.
324
+ ...(detail.priceNotes?.length ? { priceNotes: detail.priceNotes } : {}),
325
+ },
326
+ text: [
327
+ weekend,
328
+ memberRates?.said ?? '',
329
+ notBookable,
330
+ aboutSaid,
331
+ ...(detail.priceNotes ?? []),
332
+ ...roomsText(ctx.noCards ? withZh(h.name, h.names?.name, true) : h.name, byTheHour
333
+ ? (rs) => `${rs.length} ${rs.length === 1 ? 'room' : 'rooms'} by the hour for today, ${stay.checkIn}, ${stay.guests} guests`
334
+ : (rs) =>
335
+ // ⚠️ THE WEEKDAYS, to a client that draws no card: the dates
336
+ // the model worked out of 「下周五住两晚」 are said back as the
337
+ // guest can check them (robin 11-06).
338
+ `${offerCount(rs)} for ${ctx.noCards ? `${stayDayWords(stay.checkIn, stay.checkOut)}, ${stay.checkIn} to ${stay.checkOut}` : `${stay.checkIn} to ${stay.checkOut}`}, ${stay.guests} guests${roomsWanted > 1 ? `, ${roomsWanted} rooms` : ''}`, byTheHour ? `today, ${stay.checkIn}` : `${stay.checkIn} to ${stay.checkOut}`, enough, roomsWanted, terms, ctx.noCards, saidWhen, before, groupNameOf(deps, h.id), !!notBookable),
339
+ // Said before the list to a client that draws no card (`before`).
340
+ ctx.noCards && choosable.length ? '' : flexSaid,
341
+ // After the rooms, never before them: for when the guest wants one (0.75.1).
342
+ unpaidHere,
343
+ notSold,
344
+ ctx.drawsCards && enough.length ? ON_CARD.rooms : '',
345
+ ]
346
+ .filter(Boolean)
347
+ .join('\n'),
348
+ };
349
+ };
350
+ //# sourceMappingURL=get-hotel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-hotel.js","sourceRoot":"","sources":["../../src/tools/get-hotel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM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,CAAC,WAAW,CACd;YACD,kEAAkE;YAClE,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;YAC/C,6EAA6E;YAC7E,UAAU;YACV,OAAO;YACP,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;SACrD;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC;KACd,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,132 @@
1
+ import { type SupplierInfo } from '../backend.js';
2
+ import { type ComparedColumn, type ItineraryDay, type ItineraryItem } from '../present.js';
3
+ import type { Booking, Hotel, HotelDetail, Identity } from '../types.js';
4
+ import type { ToolAnswer, ToolContext, ToolDeps } from './deps.js';
5
+ /**
6
+ * A list's hotels as the numbered choices a client that shows no cards tells
7
+ * the guest - one paragraph each (robin 11-09; see choices.ts): its name; a
8
+ * sentence of where it is, its group where the name does not carry it, its
9
+ * rating, a few of its own facilities and the room it is priced at; two tags
10
+ * at most and its price. What every hotel here has - the same facilities, the
11
+ * same terms, how the prices are paid - is said once before them.
12
+ *
13
+ * ⚠️ ONLY WHAT THE GROUP SAYS OF IT (总线程 11-06): never a word the data does not
14
+ * carry - a distance is not given, so "nearest" is not said.
15
+ *
16
+ * ⚠️ WHETHER EACH PRICE CAN BE BOOKED HERE CAN BE TOLD (2026-11-02 audit, P1-5): a
17
+ * Huazhu hotel whose only rate tonight is paid in advance was listed as
18
+ * "¥783.02 for the stay" - a model reading the line could tell the guest it can
19
+ * be booked. See `paymentOf`.
20
+ */
21
+ export declare const hotelChoicesBlock: (hotels: Hotel[],
22
+ /** The first hotel's number less one - a list is numbered across its pages. */
23
+ offset: number,
24
+ /** The group a hotel is with, in a market - its name is ours, not the backend's code. */
25
+ groupOf: (h: Hotel) => SupplierInfo | undefined,
26
+ /** The deployment's group, where a hotel's own is not known. */
27
+ group: string,
28
+ /** Nothing can be booked here (`capabilities.readOnly`): said once, and no payment told apart. */
29
+ readOnly?: boolean) => {
30
+ said: string;
31
+ blocks: string[];
32
+ notes: string[];
33
+ };
34
+ /**
35
+ * What a client that draws no card is told of a list asked for without dates
36
+ * (总线程 11-06, robin's Manus run: an Atour list said only "from ¥368 a night",
37
+ * and the model asked the dates, the party, the rooms, the area, the budget,
38
+ * breakfast and cancelling all at once). Its prices are from-prices, said in
39
+ * the reply's first sentence with the nights they could be priced for by their
40
+ * dates (`dateOptions`) - and nothing asked before the list. A list is not
41
+ * priced for tonight as a hotel's page is: a city is up to twenty quotes, and the
42
+ * guest opens one hotel next, which is. In both, in the same words (`stayDefault`).
43
+ */
44
+ export declare const fromPricesWords: (today: string) => string;
45
+ /**
46
+ * One column of a comparison as a line, for a client that shows no cards:
47
+ * what the card's rows say - where, the rating, the room, the price - and the
48
+ * terms the rows only answer yes or no to.
49
+ */
50
+ export declare const comparedInWords: (c: ComparedColumn) => string;
51
+ /**
52
+ * For each priced stay of four nights or more, the other areas of its city that
53
+ * have a hotel - for the model, in the tool's text, never on the card or in the
54
+ * schema.
55
+ *
56
+ * ⚠️ A WEEK AT ONE HOTEL WAS THE PLAN, AND THE MODEL NEVER SAW WHAT ELSE THE
57
+ * CITY HAS (the owner, 2026-10-26, on the live Atour connector: both Beijing
58
+ * weeks, all six nights at one hotel). The instructions say a long stay in a big
59
+ * city usually spans areas; this is the answer saying it at the moment the plan
60
+ * has just been drawn that way, with the hotels of the other areas by id, so the
61
+ * model can plan the stay in parts - or offer the move - without a second
62
+ * look-up. Nothing where the city has no other area, or the backend cannot say:
63
+ * a nudge that guesses is worse than none.
64
+ *
65
+ * ⚠️ AND A WHOLE TRIP AT ONE HOTEL SAYS WHEN THAT FITS (0.47.9, after live
66
+ * 0.47.8: six nights in Dongcheng, "only one day is far, not worth a move").
67
+ * One hotel throughout is the plan only when every day is within about 45
68
+ * minutes of it; otherwise the reply names the split as the other way. A day
69
+ * whose own words name another area's hotel is named here - also for a trip
70
+ * shorter than four nights - so the model does not have to find it again.
71
+ */
72
+ export declare const longStayNudges: (deps: ToolDeps, stays: ItineraryItem[], days: ItineraryDay[], who?: Identity) => Promise<string[]>;
73
+ /** The hotel a call named - or the answer that says there is none, or several by that name. */
74
+ export declare const hotelNamed: (deps: ToolDeps, key: string, wanted: string) => Promise<{
75
+ detail: HotelDetail;
76
+ } | {
77
+ answer: ToolAnswer;
78
+ }>;
79
+ /** An answer of the card's own pick: it says so, so the card knows it never touched the trip. */
80
+ export declare const direct: (a: ToolAnswer) => ToolAnswer;
81
+ /**
82
+ * The booking form's room, when it is NOT the room picked now: the refusal to
83
+ * book it. Undefined when the form books what it shows.
84
+ *
85
+ * ⚠️ THE PICK IS THE CONVERSATION'S, THE FORM IS ONE CARD'S (2026-10-27 audit,
86
+ * F1). Two cards of one conversation share the slot (`pickedKey`): Reserve on
87
+ * the second replaced the first's room, and the first card's form then booked
88
+ * the second's room under its own picture of another. The form says which room
89
+ * it shows; one that is not the slot's - or a slot emptied since, by a booking
90
+ * or "Don't book" on the other card - books nothing, and `again` is the pick
91
+ * that would put the form's room back.
92
+ *
93
+ * A form that names no room is a card from before 0.48.0, booked as before.
94
+ */
95
+ export declare const pickChanged: (deps: ToolDeps, key: string, args: Record<string, unknown>) => ToolAnswer | undefined;
96
+ /**
97
+ * A coupon asked for on a booking that was already made, without it - or
98
+ * nothing.
99
+ *
100
+ * ⚠️ NEVER SILENT THAT THE COUPON WAS NOT USED (2026-11-03 review, C3). The
101
+ * same stay asked for again within minutes is answered with the first
102
+ * booking (`repeat`); a member who first booked without a coupon and then said
103
+ * "use the 满500减50" was handed the first booking at its first price, with
104
+ * nothing said of the coupon they had just agreed to. The coupon is NOT put in
105
+ * the repeat key - that would book the stay twice - so the answer says it:
106
+ * the booking stands as it was, the coupon was not spent, and what it takes to
107
+ * use it is cancelling this one (free until when, or what it costs) and
108
+ * booking again. In the structure as `couponNotUsed` and in the same words.
109
+ */
110
+ export declare const couponNotUsedOf: (deps: ToolDeps, key: string, asked: string | undefined,
111
+ /** The bookings that were asked for before and returned as they were. */
112
+ reusedBookings: Booking[],
113
+ /** Every booking in the answer: the coupon may have gone on one made now. */
114
+ answered: Booking[]) => {
115
+ structured: Record<string, unknown>;
116
+ said: string;
117
+ } | undefined;
118
+ /**
119
+ * The booking this very form made a few minutes ago, when the slot is empty
120
+ * because of it - or undefined.
121
+ *
122
+ * ⚠️ THE GUEST'S OWN BOOKING IS NOT "ANOTHER CARD'S" (2026-10-29 audit, H2c).
123
+ * A booking empties the pick; when its answer is lost on the way (a host that
124
+ * gives up before 华住 has answered), the guest presses again on the same form
125
+ * and was told another card had booked or let go of the room - about the
126
+ * booking they had just made. A live booking of this conversation, for this
127
+ * email, this room, these nights and this count, made within the minutes a
128
+ * repeat is recognised in (`SAME_BOOKING_MS`), is that booking: said as one,
129
+ * and nothing is booked again.
130
+ */
131
+ export declare const bookedFromThisForm: (deps: ToolDeps, ctx: ToolContext, key: string, args: Record<string, unknown>) => Promise<ToolAnswer | undefined>;
132
+ //# sourceMappingURL=hotel-choices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hotel-choices.d.ts","sourceRoot":"","sources":["../../src/tools/hotel-choices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB5D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAQnE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,KAAK,EAAE;AACf,+EAA+E;AAC/E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