@curless/hotel-storefront 0.85.0 → 0.86.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 (207) 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 +1342 -0
  16. package/dist/tools/all-tools.d.ts.map +1 -0
  17. package/dist/tools/all-tools.js +954 -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 +380 -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 +485 -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 +364 -0
  54. package/dist/tools/cancel.js.map +1 -0
  55. package/dist/tools/card-addons.d.ts +4 -0
  56. package/dist/tools/card-addons.d.ts.map +1 -0
  57. package/dist/tools/card-addons.js +76 -0
  58. package/dist/tools/card-addons.js.map +1 -0
  59. package/dist/tools/change-booking.d.ts +4 -0
  60. package/dist/tools/change-booking.d.ts.map +1 -0
  61. package/dist/tools/change-booking.js +145 -0
  62. package/dist/tools/change-booking.js.map +1 -0
  63. package/dist/tools/clear-trip.d.ts +4 -0
  64. package/dist/tools/clear-trip.d.ts.map +1 -0
  65. package/dist/tools/clear-trip.js +10 -0
  66. package/dist/tools/clear-trip.js.map +1 -0
  67. package/dist/tools/compare.d.ts +4 -0
  68. package/dist/tools/compare.d.ts.map +1 -0
  69. package/dist/tools/compare.js +114 -0
  70. package/dist/tools/compare.js.map +1 -0
  71. package/dist/tools/current-trip.d.ts +70 -0
  72. package/dist/tools/current-trip.d.ts.map +1 -0
  73. package/dist/tools/current-trip.js +261 -0
  74. package/dist/tools/current-trip.js.map +1 -0
  75. package/dist/tools/deps.d.ts +229 -0
  76. package/dist/tools/deps.d.ts.map +1 -0
  77. package/dist/tools/deps.js +2 -0
  78. package/dist/tools/deps.js.map +1 -0
  79. package/dist/tools/follow-ups.d.ts +120 -0
  80. package/dist/tools/follow-ups.d.ts.map +1 -0
  81. package/dist/tools/follow-ups.js +369 -0
  82. package/dist/tools/follow-ups.js.map +1 -0
  83. package/dist/tools/forget-preferences.d.ts +4 -0
  84. package/dist/tools/forget-preferences.d.ts.map +1 -0
  85. package/dist/tools/forget-preferences.js +24 -0
  86. package/dist/tools/forget-preferences.js.map +1 -0
  87. package/dist/tools/get-hotel.d.ts +4 -0
  88. package/dist/tools/get-hotel.d.ts.map +1 -0
  89. package/dist/tools/get-hotel.js +324 -0
  90. package/dist/tools/get-hotel.js.map +1 -0
  91. package/dist/tools/hotel-choices.d.ts +132 -0
  92. package/dist/tools/hotel-choices.d.ts.map +1 -0
  93. package/dist/tools/hotel-choices.js +558 -0
  94. package/dist/tools/hotel-choices.js.map +1 -0
  95. package/dist/tools/itinerary.d.ts +4 -0
  96. package/dist/tools/itinerary.d.ts.map +1 -0
  97. package/dist/tools/itinerary.js +148 -0
  98. package/dist/tools/itinerary.js.map +1 -0
  99. package/dist/tools/list-booking-addons.d.ts +4 -0
  100. package/dist/tools/list-booking-addons.d.ts.map +1 -0
  101. package/dist/tools/list-booking-addons.js +21 -0
  102. package/dist/tools/list-booking-addons.js.map +1 -0
  103. package/dist/tools/list-bookings.d.ts +4 -0
  104. package/dist/tools/list-bookings.d.ts.map +1 -0
  105. package/dist/tools/list-bookings.js +119 -0
  106. package/dist/tools/list-bookings.js.map +1 -0
  107. package/dist/tools/list-extras.d.ts +4 -0
  108. package/dist/tools/list-extras.d.ts.map +1 -0
  109. package/dist/tools/list-extras.js +90 -0
  110. package/dist/tools/list-extras.js.map +1 -0
  111. package/dist/tools/list-hotels.d.ts +4 -0
  112. package/dist/tools/list-hotels.d.ts.map +1 -0
  113. package/dist/tools/list-hotels.js +891 -0
  114. package/dist/tools/list-hotels.js.map +1 -0
  115. package/dist/tools/list-shop-items.d.ts +4 -0
  116. package/dist/tools/list-shop-items.d.ts.map +1 -0
  117. package/dist/tools/list-shop-items.js +34 -0
  118. package/dist/tools/list-shop-items.js.map +1 -0
  119. package/dist/tools/list-shop-orders.d.ts +4 -0
  120. package/dist/tools/list-shop-orders.d.ts.map +1 -0
  121. package/dist/tools/list-shop-orders.js +22 -0
  122. package/dist/tools/list-shop-orders.js.map +1 -0
  123. package/dist/tools/look-up.d.ts +4 -0
  124. package/dist/tools/look-up.d.ts.map +1 -0
  125. package/dist/tools/look-up.js +170 -0
  126. package/dist/tools/look-up.js.map +1 -0
  127. package/dist/tools/output-schemas.d.ts +645 -0
  128. package/dist/tools/output-schemas.d.ts.map +1 -0
  129. package/dist/tools/output-schemas.js +503 -0
  130. package/dist/tools/output-schemas.js.map +1 -0
  131. package/dist/tools/paid-lines.d.ts +718 -0
  132. package/dist/tools/paid-lines.d.ts.map +1 -0
  133. package/dist/tools/paid-lines.js +359 -0
  134. package/dist/tools/paid-lines.js.map +1 -0
  135. package/dist/tools/pay-with-union-pay.d.ts +4 -0
  136. package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
  137. package/dist/tools/pay-with-union-pay.js +112 -0
  138. package/dist/tools/pay-with-union-pay.js.map +1 -0
  139. package/dist/tools/payment-words.d.ts +269 -0
  140. package/dist/tools/payment-words.d.ts.map +1 -0
  141. package/dist/tools/payment-words.js +365 -0
  142. package/dist/tools/payment-words.js.map +1 -0
  143. package/dist/tools/pick-room.d.ts +4 -0
  144. package/dist/tools/pick-room.d.ts.map +1 -0
  145. package/dist/tools/pick-room.js +23 -0
  146. package/dist/tools/pick-room.js.map +1 -0
  147. package/dist/tools/policies.d.ts +4 -0
  148. package/dist/tools/policies.d.ts.map +1 -0
  149. package/dist/tools/policies.js +74 -0
  150. package/dist/tools/policies.js.map +1 -0
  151. package/dist/tools/pricing.d.ts +55 -0
  152. package/dist/tools/pricing.d.ts.map +1 -0
  153. package/dist/tools/pricing.js +260 -0
  154. package/dist/tools/pricing.js.map +1 -0
  155. package/dist/tools/put-room-line.d.ts +12 -0
  156. package/dist/tools/put-room-line.d.ts.map +1 -0
  157. package/dist/tools/put-room-line.js +314 -0
  158. package/dist/tools/put-room-line.js.map +1 -0
  159. package/dist/tools/quote-card.d.ts +234 -0
  160. package/dist/tools/quote-card.d.ts.map +1 -0
  161. package/dist/tools/quote-card.js +375 -0
  162. package/dist/tools/quote-card.js.map +1 -0
  163. package/dist/tools/refund-booking.d.ts +4 -0
  164. package/dist/tools/refund-booking.d.ts.map +1 -0
  165. package/dist/tools/refund-booking.js +112 -0
  166. package/dist/tools/refund-booking.js.map +1 -0
  167. package/dist/tools/request-booking.d.ts +4 -0
  168. package/dist/tools/request-booking.d.ts.map +1 -0
  169. package/dist/tools/request-booking.js +5 -0
  170. package/dist/tools/request-booking.js.map +1 -0
  171. package/dist/tools/request-words.d.ts +238 -0
  172. package/dist/tools/request-words.d.ts.map +1 -0
  173. package/dist/tools/request-words.js +487 -0
  174. package/dist/tools/request-words.js.map +1 -0
  175. package/dist/tools/room-choices.d.ts +64 -0
  176. package/dist/tools/room-choices.d.ts.map +1 -0
  177. package/dist/tools/room-choices.js +348 -0
  178. package/dist/tools/room-choices.js.map +1 -0
  179. package/dist/tools/session-notes.d.ts +164 -0
  180. package/dist/tools/session-notes.d.ts.map +1 -0
  181. package/dist/tools/session-notes.js +412 -0
  182. package/dist/tools/session-notes.js.map +1 -0
  183. package/dist/tools/sign-in.d.ts +4 -0
  184. package/dist/tools/sign-in.d.ts.map +1 -0
  185. package/dist/tools/sign-in.js +72 -0
  186. package/dist/tools/sign-in.js.map +1 -0
  187. package/dist/tools/sign-out.d.ts +4 -0
  188. package/dist/tools/sign-out.d.ts.map +1 -0
  189. package/dist/tools/sign-out.js +13 -0
  190. package/dist/tools/sign-out.js.map +1 -0
  191. package/dist/tools/terms-answer.d.ts +114 -0
  192. package/dist/tools/terms-answer.d.ts.map +1 -0
  193. package/dist/tools/terms-answer.js +475 -0
  194. package/dist/tools/terms-answer.js.map +1 -0
  195. package/dist/tools/tool-set.d.ts +1474 -0
  196. package/dist/tools/tool-set.d.ts.map +1 -0
  197. package/dist/tools/tool-set.js +497 -0
  198. package/dist/tools/tool-set.js.map +1 -0
  199. package/dist/tools/view-trip.d.ts +4 -0
  200. package/dist/tools/view-trip.d.ts.map +1 -0
  201. package/dist/tools/view-trip.js +7 -0
  202. package/dist/tools/view-trip.js.map +1 -0
  203. package/dist/tools.d.ts +13 -2089
  204. package/dist/tools.d.ts.map +1 -1
  205. package/dist/tools.js +11 -10685
  206. package/dist/tools.js.map +1 -1
  207. package/package.json +1 -1
@@ -0,0 +1,487 @@
1
+ import { FULL_CAPABILITIES, REQUEST_KINDS, REQUEST_NOTE_MAX, } from '../backend.js';
2
+ import { MAX_GUESTS } from '../dates.js';
3
+ import { formatMoney, multiplyMoney } from '../money.js';
4
+ import { nightIsTheStay, nightlyIncludesTaxes } from '../present.js';
5
+ import { byRoomType, facetsOf } from '../room-filters.js';
6
+ import { str } from './args.js';
7
+ import { holderOf } from './cancel-facts.js';
8
+ import { freeUntilText, withZh } from './quote-card.js';
9
+ import { notBookableWords } from './tool-set.js';
10
+ /**
11
+ * What each preference is called when a person reads it back.
12
+ *
13
+ * ⚠️ IT IS A REQUEST IN THE WORDING, not only in a footnote. "High floor" on a
14
+ * confirmation reads as a fact about the room; "asked for a high floor" reads
15
+ * as what actually happened. The footnote is there too, once.
16
+ */
17
+ export const REQUEST_WORDS = {
18
+ 'king-bed': 'a king bed',
19
+ 'twin-beds': 'twin beds',
20
+ 'high-floor': 'a high floor',
21
+ 'low-floor': 'a low floor',
22
+ 'quiet-room': 'a quiet room',
23
+ 'connecting-rooms': 'connecting rooms',
24
+ 'early-check-in': 'an early check-in',
25
+ 'late-arrival': 'a late arrival',
26
+ 'accessible-room': 'an accessible room',
27
+ };
28
+ /**
29
+ * Two of these cannot both be honoured, so a booking carrying both is a booking
30
+ * the desk will resolve by guessing. The first one asked for wins, and the
31
+ * answer says which was dropped - silently keeping one would leave the guest
32
+ * believing they asked for the other.
33
+ */
34
+ export const OPPOSITES = [
35
+ ['king-bed', 'twin-beds'],
36
+ ['high-floor', 'low-floor'],
37
+ ];
38
+ const ARRIVAL_TIME = /^([01]\d|2[0-3]):[0-5]\d$/;
39
+ /** The requests as the tool will send them, and what had to be dropped to get there. */
40
+ export const readRequests = (args) => {
41
+ const asked = Array.isArray(args.requests) ? args.requests : [];
42
+ const kinds = [];
43
+ const dropped = [];
44
+ for (const raw of asked) {
45
+ const kind = String(raw);
46
+ if (!REQUEST_KINDS.includes(kind) || kinds.includes(kind))
47
+ continue;
48
+ const clash = OPPOSITES.find((pair) => pair.includes(kind))?.find((x) => x !== kind);
49
+ if (clash && kinds.includes(clash)) {
50
+ dropped.push(kind);
51
+ continue;
52
+ }
53
+ kinds.push(kind);
54
+ }
55
+ const arrivingAt = ARRIVAL_TIME.test(str(args.arrivingAt)) ? str(args.arrivingAt) : undefined;
56
+ // ⚠️ A TIME IS A LATE ARRIVAL. A guest who says they land at 23:40 has made
57
+ // the request; making them also tick a box would be a booking that carries
58
+ // the hour and no reason for the desk to hold the room past it.
59
+ if (arrivingAt && !kinds.includes('late-arrival'))
60
+ kinds.push('late-arrival');
61
+ const note = str(args.notes).replace(/\s+/g, ' ').trim().slice(0, REQUEST_NOTE_MAX);
62
+ if (kinds.length === 0 && !arrivingAt && !note)
63
+ return { requests: undefined, dropped };
64
+ return {
65
+ requests: { kinds, ...(arrivingAt ? { arrivingAt } : {}), ...(note ? { note } : {}) },
66
+ dropped,
67
+ };
68
+ };
69
+ /** Said of a booking that carries the guest's note - see `requestLines`. */
70
+ export const NOTE_PASSED = 'A note from the guest was passed to the hotel.';
71
+ /**
72
+ * The sentences a booking's requests earn, in the order a guest reads them.
73
+ *
74
+ * ⚠️ ACCESSIBILITY GETS ITS OWN SENTENCE AND IT IS NOT A REASSURING ONE. A
75
+ * room a wheelchair user cannot use is not a disappointment on arrival, it is a
76
+ * trip that does not work; saying "we have asked" in the same breath as "a high
77
+ * floor" invites exactly the reading that it is handled. It is not handled
78
+ * here, and the answer says so and says who does handle it.
79
+ */
80
+ export const requestLines = (b, dropped, checkInFrom) => {
81
+ const r = b.requests;
82
+ const out = [];
83
+ if (!r)
84
+ return out;
85
+ const soft = r.kinds.filter((k) => k !== 'accessible-room');
86
+ if (soft.length) {
87
+ const words = soft.map((k) => k === 'late-arrival' && r.arrivingAt
88
+ ? `a late arrival, around ${r.arrivingAt}`
89
+ : REQUEST_WORDS[k]);
90
+ out.push(`Asked for on the booking: ${words.join(', ')}. The desk meets what it can on the day; none of it is held.`);
91
+ }
92
+ // ⚠️ THAT THERE IS A NOTE, NOT WHAT IT SAYS (2026-10-27 audit, F3): the
93
+ // guest's own words are theirs, typed on the card's form - the card shows
94
+ // them from `_meta` (server.ts, `guestsApart`), and the model is told only
95
+ // that one went to the hotel.
96
+ if (r.note)
97
+ out.push(NOTE_PASSED);
98
+ if (r.kinds.includes('accessible-room')) {
99
+ out.push(`An accessible room is a room type, and this booking does not hold one - ${b.hotelName} confirms accessible rooms directly, quoting ${b.confirmationCode}.`);
100
+ }
101
+ if (r.kinds.includes('early-check-in') && checkInFrom) {
102
+ out.push(`Check-in here opens at ${checkInFrom}; anything before that is the desk's to offer.`);
103
+ }
104
+ for (const kind of dropped) {
105
+ const kept = OPPOSITES.find((pair) => pair.includes(kind))?.find((x) => x !== kind);
106
+ if (kept)
107
+ out.push(`${sentence(REQUEST_WORDS[kind])} and ${REQUEST_WORDS[kept]} cannot both be asked for; the booking asks for ${REQUEST_WORDS[kept]}.`);
108
+ }
109
+ return out;
110
+ };
111
+ /** These phrases are written to sit mid-sentence; one of them has to open one. */
112
+ export const sentence = (text) => text.charAt(0).toUpperCase() + text.slice(1);
113
+ /** "a king bed" reads well in a sentence; a list wants "king bed". */
114
+ export const bare = (kind) => REQUEST_WORDS[kind].replace(/^an? /, '');
115
+ /**
116
+ * ⚠️ THE REQUESTS COME WITH THE BOOKING when it is listed, not only when it is
117
+ * made. A guest who asked for a high floor and then closes the card has no
118
+ * other way to check it was recorded, and "I think I asked" is exactly what a
119
+ * desk cannot act on.
120
+ */
121
+ export const SORTS = ['group', 'price-low', 'price-high', 'rating'];
122
+ /** How long a market's every city is kept - see `everyCityOf`. */
123
+ const CITIES_KEPT_MS = 60_000;
124
+ const citiesKept = new WeakMap();
125
+ /**
126
+ * Every city a market has, for its lists' city field (0.68.0) - asked with nothing named.
127
+ *
128
+ * ⚠️ KEPT A MINUTE, WHATEVER CAME BACK, AND ASKED AS NOBODY'S (0.68.1, 总线程's review of
129
+ * 0.68.0, 5): a group that failed was kept failed by Otaless's client for 3 seconds only, so
130
+ * every narrowed search asked it again - on the guest's own outbound limit, which could then
131
+ * call the search they did want "too busy". Now one ask a minute per deployment, on
132
+ * everyone's limit alone (no conversation, no address); a failure is no menu for that minute.
133
+ */
134
+ export const everyCityOf = (deps) => {
135
+ const now = deps.trips.now();
136
+ const kept = citiesKept.get(deps.backend);
137
+ if (kept && now - kept.at < CITIES_KEPT_MS)
138
+ return kept.cities;
139
+ const cities = deps.backend.searchHotels({}).then((r) => r.facets?.cities ?? [], () => []);
140
+ citiesKept.set(deps.backend, { at: now, cities });
141
+ return cities;
142
+ };
143
+ export const widen = (ask) => {
144
+ if (ask.city && ask.query) {
145
+ return {
146
+ ask: { ...ask, query: undefined },
147
+ from: `${ask.city} and "${ask.query}"`,
148
+ to: ask.city,
149
+ how: 'words',
150
+ city: ask.city,
151
+ query: ask.query,
152
+ };
153
+ }
154
+ // A place nobody has filed under that name may still be in a hotel's own
155
+ // name, area or description - "Pudong", "Shangri-La Bengaluru".
156
+ if (ask.city) {
157
+ return {
158
+ ask: { ...ask, city: undefined, query: ask.city },
159
+ from: `the city "${ask.city}"`,
160
+ to: `"${ask.city}" anywhere in the record`,
161
+ how: 'place',
162
+ city: ask.city,
163
+ };
164
+ }
165
+ // Several words that match nothing together may match on the longest one.
166
+ const words = (ask.query ?? '').split(/\s+/).filter((w) => w.length > 2);
167
+ if (words.length > 1) {
168
+ const longest = words.reduce((a, b) => (b.length > a.length ? b : a));
169
+ return {
170
+ ask: { ...ask, query: longest },
171
+ from: `all of "${ask.query}"`,
172
+ to: `"${longest}"`,
173
+ how: 'word',
174
+ query: ask.query ?? '',
175
+ word: longest,
176
+ };
177
+ }
178
+ return undefined;
179
+ };
180
+ /** What a change would do, in one sentence - the nights, and the add-on when it sets one. */
181
+ export const changeSentence = (p) => {
182
+ // ⚠️ EACH THING THAT CHANGES, NAMED AS WHAT IT IS. Two rooms down to one
183
+ // was said as "would move to" the nights it already held, and an add-on set
184
+ // to the count it already had as "take it off" (2026-09-28 audit).
185
+ const to = p.to;
186
+ const rooms = (n) => `${n} room${n === 1 ? '' : 's'}`;
187
+ const a = p.addOn;
188
+ const parts = [
189
+ to && (to.stay.checkIn !== p.from.stay.checkIn || to.stay.checkOut !== p.from.stay.checkOut)
190
+ ? `move to ${to.stay.checkIn} - ${to.stay.checkOut}`
191
+ : '',
192
+ to && to.roomName !== p.from.roomName ? `change the room to ${to.roomName}` : '',
193
+ to && to.rooms !== p.from.rooms ? `go from ${rooms(p.from.rooms)} to ${rooms(to.rooms)}` : '',
194
+ !a || a.from === a.to
195
+ ? ''
196
+ : a.to === 0
197
+ ? `take ${a.name} off`
198
+ : a.from === 0
199
+ ? `add ${a.to}× ${a.name}`
200
+ : `change ${a.name} from ${a.from} to ${a.to}`,
201
+ ].filter(Boolean);
202
+ const said = parts.length > 1
203
+ ? `${parts.slice(0, -1).join(', ')} and ${parts.at(-1)}`
204
+ : (parts[0] ?? 'change');
205
+ return `${p.confirmationCode} would ${said}.`;
206
+ };
207
+ /**
208
+ * How much of a plan is real, in the one sentence the model is told to repeat:
209
+ * what is booked, what is in the trip, and that the rest is only a plan.
210
+ * Counted by stay - see `Itinerary.inTrip`.
211
+ */
212
+ export const planGap = (plan) => {
213
+ const { planned, inTrip, booked } = plan;
214
+ if (planned === 0)
215
+ return 'Nothing on this plan is in the trip yet.';
216
+ if (booked === planned)
217
+ return `All ${planned} are booked - held under their confirmation codes, nothing paid.`;
218
+ if (inTrip === planned)
219
+ return planned === 1 ? 'It is in the trip.' : `All ${planned} are in the trip.`;
220
+ const parts = [
221
+ booked ? `${booked} of ${planned} booked` : '',
222
+ inTrip || !booked ? `${inTrip} of ${planned} in the trip` : '',
223
+ ].filter(Boolean);
224
+ const rest = planned - booked - inTrip;
225
+ return rest > 0
226
+ ? `${parts.join(', ')}; the rest are a plan, not a booking.`
227
+ : `${parts.join(', ')}.`;
228
+ };
229
+ /** How many people, for a room by the hour asked for without dates. Default 2. */
230
+ export const guestsOf = (args) => Math.max(1, Math.min(MAX_GUESTS, Math.floor(Number(args.guests) || 2)));
231
+ /**
232
+ * "3 room types", or - where a group sells several rates on one type - "5 rates
233
+ * on 2 room types": five rows are not five kinds of room.
234
+ */
235
+ export const offerCount = (rooms) => {
236
+ const types = new Set(rooms.map((r) => r.roomType?.id ?? r.id)).size;
237
+ return types === rooms.length
238
+ ? `${types} room ${types === 1 ? 'type' : 'types'}`
239
+ : `${rooms.length} rates on ${types} room ${types === 1 ? 'type' : 'types'}`;
240
+ };
241
+ /** What one room costs, as the text says it: nights, or the hours of a room by the hour. */
242
+ export const priceWords = (r, noCards, roomsWanted = 1) => r.hourly
243
+ ? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours incl. taxes and fees, starting between ${r.hourly.earliestStart} and ${r.hourly.latestStart} today and out by ${r.hourly.latestEnd}`
244
+ : nightIsTheStay(r, roomsWanted)
245
+ ? wholeStayWords(r)
246
+ : `${nightlyPart(r, noCards)}, ${wholeStayWords(r)}`;
247
+ /**
248
+ * A night - or, where the night is a rounded average (`Room.roomCharges`, 0.79.1), the stay's room
249
+ * charges before taxes, so that charges + taxes = the total the text gives beside it.
250
+ */
251
+ export const nightlyPart = (r, noCards) => r.roomCharges
252
+ ? `${formatMoney(r.roomCharges)} room charges for ${r.nights} nights before taxes (${formatMoney(r.taxesAndFees)} tax and fees on top)`
253
+ : `${formatMoney(r.nightly)} ${nightWords(noCards, nightlyIncludesTaxes(r))}`;
254
+ /**
255
+ * The whole stay, as the text says it - or that the group has quoted none.
256
+ *
257
+ * ⚠️ NO STAY TOTAL THAT IS OURS (总线程 11-13, `Room.stayTotalUnquoted`): the
258
+ * nights times a night was said as "CN¥172 for the stay incl. taxes and fees"
259
+ * for a rate the group had priced for one night only.
260
+ */
261
+ export const wholeStayWords = (r) => r.stayTotalUnquoted
262
+ ? // ⚠️ SAID AS NOT A TOTAL (0.76.1, the review of 11-18, H1): a night's price read beside
263
+ // a stay's was taken for one.
264
+ 'not a total for these nights - no price from the group for the whole stay yet'
265
+ : `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
266
+ /**
267
+ * "a night" - and to a client that draws no card, "a night before taxes".
268
+ *
269
+ * ⚠️ THE NIGHTLY RATE HAS NO TAX IN IT, the stay total has (2026-11-02 audit,
270
+ * P3-1): read side by side with "incl. taxes and fees", a model told the guest
271
+ * "含税费 … 每晚 ¥1,668". The card says 每晚价不含税 under its prices (0.50.1).
272
+ */
273
+ export const nightWords = (noCards, taxesUnsaid) =>
274
+ // ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3): a from-price whose taxes the
275
+ // supplier does not say (`Hotel.fromNightlyTaxes`, the Otaless backend) is
276
+ // "a night" alone in words too - as the card says it (每晚).
277
+ noCards && !taxesUnsaid ? 'a night before taxes' : 'a night';
278
+ export const LABEL_WORDS = {
279
+ 'room-only': 'room only',
280
+ breakfast: 'breakfast',
281
+ 'breakfast-1': 'breakfast for 1',
282
+ 'breakfast-2': 'breakfast for 2',
283
+ 'breakfast-3': 'breakfast for 3',
284
+ package: 'package',
285
+ 'flash-sale': 'flash sale',
286
+ 'night-snack': 'late-night rate',
287
+ 'early-booking': 'booked-ahead rate',
288
+ promotion: 'promotion',
289
+ };
290
+ /** A rate's labels after its name - " [breakfast for 2, promotion]" - or nothing. */
291
+ const labelWords = (r) => {
292
+ const words = [
293
+ ...(r.labels ?? []).map((l) => LABEL_WORDS[l]),
294
+ // Paid in advance, and nothing more - not "not booked here" (0.75.1, robin 11-18:
295
+ // that is said when the guest wants one - `notSoldHereWords`).
296
+ ...(r.payment === 'prepaid' ? ['paid in advance'] : []),
297
+ // …and booked here all the same, with nothing charged (0.77.5 - `unpaidBookingWords`).
298
+ ...(r.paymentNotConnected ? [UNPAID_TAG] : []),
299
+ ];
300
+ return words.length ? ` [${words.join(', ')}]` : '';
301
+ };
302
+ /** What a list and a page both say of a hotel with nothing on sale here: other nights would not help. */
303
+ export const NOT_SOLD_OUT = 'not sold out, and other nights make no difference';
304
+ /**
305
+ * The whys of a list's unpriced hotel that are not "no room for those nights",
306
+ * each counted on its own: nothing on sale here (U11), and a group that did not
307
+ * answer this time (总线程 11-13: 华住生产's 2001 "System error" was counted as no room).
308
+ */
309
+ export const NOT_NO_ROOM = new Set([
310
+ 'none-on-sale',
311
+ 'unreachable',
312
+ 'too-far',
313
+ 'prepaid-only',
314
+ 'stay-rule',
315
+ ]);
316
+ /**
317
+ * ⚠️ NOT "NO ROOM" EITHER, AND SAID IN THE GROUP'S OWN WHY (总线程's review of 0.71.0, P3 4 -
318
+ * 华住's list): not on sale yet that far ahead, only rates paid in advance where a stay is paid
319
+ * at the hotel here, or a rule of those dates. Each hotel's line says its `noRoomsForStay`, and
320
+ * the count says how many of each - never in the no-room count.
321
+ */
322
+ export const OWN_WHY = {
323
+ 'too-far': {
324
+ price: 'Not on sale yet',
325
+ many: (n) => `${n} in this answer ${n === 1 ? 'is' : 'are'} not on sale yet that far ahead`,
326
+ },
327
+ 'prepaid-only': {
328
+ price: 'Paid in advance only',
329
+ many: (n) => `${n} in this answer ${n === 1 ? 'sells' : 'sell'} those nights only on rates paid in advance, which are not booked here`,
330
+ },
331
+ 'stay-rule': {
332
+ price: 'Not for those nights',
333
+ many: (n) => `${n} in this answer ${n === 1 ? 'has' : 'have'} a rule of those dates that keeps this stay from being booked - each line says which`,
334
+ },
335
+ };
336
+ /**
337
+ * What is said of rates listed but not booked here (`Room.notSoldHere`) - in
338
+ * the text and, word for word, in the structure (`notSoldHere`): the model reads
339
+ * the structure (2026-10-28). Listed and marked as the group sells them; the
340
+ * card says no more than 预付 on them (robin, 2026-10-30), so the assistant is
341
+ * the one who knows - and says it when the guest wants one.
342
+ *
343
+ * ⚠️ WHEN THE GUEST WANTS ONE, NEVER BEFORE (0.75.1, robin 11-18 on 华住生产: 「这两段话去掉
344
+ * 吧,预订按钮给我加上,但是跳转的时候再提示暂时还不能预订」): a list or a page says nothing of
345
+ * it - no sentence first, no "not booked here" on a price (0.65.0 said it before anything was
346
+ * chosen). The card says it when Reserve is pressed; the assistant when the guest asks to
347
+ * book one, or when it goes to book one (and the booking is refused, with the same ways on).
348
+ *
349
+ * ⚠️ "PAID IN ADVANCE" IS SAID, "NOT HERE" IS NOT (0.76.2, 总线程 11-18 for robin): 0.75.1's
350
+ * "Do not bring that up on your own" was read as "do not bring up paid in advance" - the
351
+ * model dropped it from a list whose text said "Paid in advance." (eval
352
+ * `huazhu-prod-text-one-hotel-is-numbered`, 0/3). robin meant not to volunteer that it cannot
353
+ * be booked here, never to hide how a rate is paid: the two are said apart.
354
+ */
355
+ export const notSoldHereWords = (group, someBookedHere = false) => someBookedHere
356
+ ? // ⚠️ BESIDE RATES PAID IN ADVANCE THAT ARE BOOKED HERE (0.77.5, `unpaidBookingWords`):
357
+ // "only rates paid at the hotel can be" would not be true of this answer.
358
+ `Rates marked paid in advance are listed as ${group} sells them. Say "paid in advance" of each, as this answer marks it: it is how that rate is paid, and it stays in your reply. Those also marked "${UNPAID_TAG}" can be booked here; what you do not bring up on your own is that the other rates paid in advance cannot be booked here yet. Only when the guest wants one of those - asks to book it, or you go to book it - say that plainly - nothing is booked or charged - and ${waysOnWords(group, `a rate marked "${UNPAID_TAG}" or one paid at the hotel, where this answer lists one`)}`
359
+ : `Rates marked paid in advance are listed as ${group} sells them. Say "paid in advance" of each, as this answer marks it: it is how that rate is paid, and it stays in your reply. What you do not bring up on your own is that a stay paid in advance cannot be booked here yet; only rates paid at the hotel can be. Only when the guest wants one - asks to book it, or you go to book it - say that plainly - nothing is booked or charged - and ${waysOnWords(group, 'a rate paid at the hotel, where this answer lists one')}`;
360
+ /** The tag a rate paid in advance that is booked here without its payment carries (0.77.5). */
361
+ export const UNPAID_TAG = 'booked here, nothing charged';
362
+ /**
363
+ * What is said of rates paid in advance that ARE booked here, without their payment (0.77.5,
364
+ * robin 2026-11-19 - `Room.paymentNotConnected`, Huazhu's `data.api.demoBooking`): in the text
365
+ * and, word for word, in the structure (`bookedWithoutPayment`) - the model reads the structure.
366
+ * The fact, and nothing about what kind of booking it is.
367
+ */
368
+ export const unpaidBookingWords = (group) => `Rates marked "${UNPAID_TAG}" are paid in advance and CAN be booked here now: booking one creates the order with ${group} at once, and no payment is taken - nothing is charged, because payment is not connected here yet. Say that when the guest wants one; never that it is paid at the hotel, and never that it cannot be booked here.`;
369
+ /**
370
+ * Where a guest goes from a rate paid in advance (总线程 11-09, Manus on Huazhu:
371
+ * 「选最便宜那个」 was answered "it cannot be booked here" and nothing more,
372
+ * where claude.ai had said a rate paid at the hotel, or Huazhu's own app or
373
+ * site). Only what is so: a rate paid at the hotel where the answer has one,
374
+ * other nights looked up here, and the group's own channels - by name, never a
375
+ * link to its site (`server.websiteUrl`: a link reads as the official way in).
376
+ */
377
+ export const waysOnWords = (group, atHotel) => `give the ways on in the same reply, never stopping at "it cannot be booked here": ${atHotel ? `${atHotel}; ` : ''}other nights, looked up here again; or booking with ${group} directly, in its own app or on its website.`;
378
+ /**
379
+ * A hotel none of whose rooms are on sale here (`none-on-sale`), said on its page
380
+ * with the way out (2026-11-03 review, T5). The page's text had one sentence -
381
+ * "This hotel has no rooms on sale here." - and the card said where to book it
382
+ * instead, so a client that draws no card left the guest with a dead end. The
383
+ * clause is the list's (see `NOT_SOLD_OUT`), so the list and the page say one
384
+ * thing; the group is the deployment's own, or the hotel's in a market, never a
385
+ * name written into the sentence. In the text and, word for word, in the
386
+ * structure (`noRooms`): the model reads the structure.
387
+ */
388
+ export const notOnSaleWords = (group, why) => `${why.replace(/[.\s]+$/, '')} - ${NOT_SOLD_OUT}. To book it, the guest can use ${group}'s own channels: its app, its website or by phone.`;
389
+ /** `notBookableWords` where nothing can be booked here, else nothing - see there. */
390
+ export const notBookableOf = (deps) => (deps.backend.capabilities ?? FULL_CAPABILITIES).readOnly ? notBookableWords(deps.vocab) : '';
391
+ /** The group a hotel is with, by name - the deployment's own brand outside a market. */
392
+ export const groupNameOf = (deps, hotelId) => holderOf(deps, deps.backend.supplierOf?.(hotelId)).name;
393
+ /** A rate's cancellation terms in the supplier's own words (`Room.terms`), quoted - or that none were given. */
394
+ export const termsWords = (terms) => terms
395
+ ? `cancellation terms, in the hotel group's own words: "${terms}"`
396
+ : 'no cancellation terms given';
397
+ /** What a rate says about cancelling, as the text puts it. */
398
+ export const cancelWords = (r) =>
399
+ // The supplier's own sentence, as it came - see `Room.terms`.
400
+ r.terms !== undefined
401
+ ? termsWords(r.terms)
402
+ : r.freeCancellationUntil
403
+ ? `free to cancel until ${freeUntilText(r)}`
404
+ : r.refundable
405
+ ? 'the free cancellation window has closed - cancelling now has a fee'
406
+ : 'non-refundable';
407
+ /**
408
+ * What a room is, in a parenthesis: its beds, how many it sleeps and - for one
409
+ * rate, not a type whose rates differ - breakfast, unless the rate's labels
410
+ * already say it.
411
+ */
412
+ const roomFactsWords = (r, rate = false) => {
413
+ const facts = [
414
+ r.beds,
415
+ `sleeps ${r.sleeps}`,
416
+ rate && facetsOf(r).breakfast && !(r.labels ?? []).some((l) => l.startsWith('breakfast'))
417
+ ? 'breakfast included'
418
+ : '',
419
+ ]
420
+ .filter(Boolean)
421
+ .join(', ');
422
+ return ` (${facts})`;
423
+ };
424
+ /** The cheapest price a rate quotes, as the text says it: "from" a night, or the hours of a block. */
425
+ const fromWords = (r, noCards, roomsWanted = 1) => r.hourly
426
+ ? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours incl. taxes and fees`
427
+ : nightIsTheStay(r, roomsWanted)
428
+ ? wholeStayWords(r)
429
+ : `${nightlyPart(r, noCards)}, ${wholeStayWords(r)}`;
430
+ /**
431
+ * A hotel's rooms for the nights, one line per ROOM TYPE.
432
+ *
433
+ * ⚠️ A TYPE IS ONE LINE, NOT ONE LINE PER RATE CODE. A Huazhu hotel sells a
434
+ * dozen rates on three types, and every code in one long run buried the types
435
+ * (robin, 2026-10-23, after Qunar's page). A type with one rate is that rate,
436
+ * in full; a type with several says how many, its lowest price, which rate that
437
+ * is - the name `room` takes - and what the rest have, in a few words.
438
+ * Another rate is reached by narrowing: `bed`, `breakfast`, `freeCancellation`.
439
+ */
440
+ export const roomTypeLines = (rooms, roomsWanted,
441
+ /** The terms already applied: what they say is true of every rate here, so it is not counted again. */
442
+ terms,
443
+ /**
444
+ * To a client that draws no card, each line also says the id the next call
445
+ * takes and the group's Chinese name (2026-11-02 audit, P1-1, P1-4): the
446
+ * card is what books a room for a card host.
447
+ */
448
+ noCards) => {
449
+ const forRooms = (r) => roomsWanted > 1 && !r.stayTotalUnquoted
450
+ ? ` (${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms)`
451
+ : '';
452
+ return byRoomType(rooms).map((type) => {
453
+ const cheapest = type.rooms.reduce((a, b) => (b.stayTotal.minor < a.stayTotal.minor ? b : a));
454
+ const n = type.rooms.length;
455
+ if (n === 1)
456
+ return noCards
457
+ ? `- ${withZh(cheapest.name, cheapest.names, true)}${labelWords(cheapest)}${roomFactsWords(cheapest, true)}, room \`${cheapest.id}\` — ${priceWords(cheapest, true, roomsWanted)}${forRooms(cheapest)}, ${cancelWords(cheapest)}`
458
+ : `- ${cheapest.name}${labelWords(cheapest)}${roomFactsWords(cheapest, true)} — ${priceWords(cheapest, undefined, roomsWanted)}${forRooms(cheapest)}, ${cancelWords(cheapest)}`;
459
+ const some = (k, all, part) => k === n ? all : k > 0 ? `${k} of ${n} ${part}` : '';
460
+ const also = [
461
+ terms?.breakfast
462
+ ? ''
463
+ : some(type.rooms.filter((r) => facetsOf(r).breakfast).length, 'all include breakfast', 'include breakfast'),
464
+ terms?.freeCancellation
465
+ ? ''
466
+ : some(type.rooms.filter((r) => facetsOf(r).freeCancellation).length, 'all are free to cancel', 'are free to cancel'),
467
+ ].filter(Boolean);
468
+ return noCards
469
+ ? `- ${withZh(type.name, cheapest.roomType?.names, true)}${roomFactsWords(cheapest)}, room type \`${type.id}\` — ${n} rates from ${fromWords(cheapest, true, roomsWanted)}${forRooms(cheapest)}. Lowest price: "${withZh(cheapest.name, cheapest.names, true)}", room \`${cheapest.id}\`${labelWords(cheapest)}, ${cancelWords(cheapest)}.${also.length ? ` ${also.join('; ')}.` : ''}`
470
+ : `- ${type.name}${roomFactsWords(cheapest)} — ${n} rates from ${fromWords(cheapest, undefined, roomsWanted)}${forRooms(cheapest)}. Lowest price: "${cheapest.name}"${labelWords(cheapest)}, ${cancelWords(cheapest)}.${also.length ? ` ${also.join('; ')}.` : ''}`;
471
+ });
472
+ };
473
+ /**
474
+ * ⚠️ A ROOM'S BOOKING LINK ON THE GROUP'S OWN SITE (0.67.1, robin 11-12): said once a
475
+ * room type, where one of its rates has one (`Room.bookingUrl`, already checked against
476
+ * the deployment's `bookingUrlHosts`). Nothing where none has - so a deployment without
477
+ * them says nothing new.
478
+ */
479
+ export const siteBookingLines = (rooms, group) => byRoomType(rooms).flatMap((type) => {
480
+ const url = type.rooms.find((r) => r.bookingUrl)?.bookingUrl;
481
+ if (!url)
482
+ return [];
483
+ return [
484
+ `${type.name}: Also bookable on ${group}'s own site (${new URL(url).hostname}), not through here: ${url}`,
485
+ ];
486
+ });
487
+ //# sourceMappingURL=request-words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-words.js","sourceRoot":"","sources":["../../src/tools/request-words.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OA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,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACvX,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,QAAQ,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACxQ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,KAAa,EAAY,EAAE,CACzE,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IAC7D,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO;QACL,GAAG,IAAI,CAAC,IAAI,sBAAsB,KAAK,gBAAgB,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,wBAAwB,GAAG,EAAE;KAC1G,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { type RoomTerms } from '../room-filters.js';
2
+ import type { Hotel, Room } from '../types.js';
3
+ /** How many room types a client that draws no card shows the guest at once - see `roomChoiceRows`. */
4
+ export declare const ROOM_CHOICES_SHOWN = 5;
5
+ /**
6
+ * The ids behind numbered choices, in one line after them (总线程 11-09): with the
7
+ * id on each line - "— room `x`" - the model was to copy the line and drop its
8
+ * end, and on Manus it rewrote the lines and dropped the numbers instead. The
9
+ * choices are the guest's as they stand; this line is the model's - and it
10
+ * marks each one paid in advance too (P1-5), where the choices may say it once
11
+ * for all.
12
+ */
13
+ export declare const idsByNumber: (what: "Room" | "Hotel", ids: string[], from?: number, notes?: string[]) => string;
14
+ /**
15
+ * Today at a hotel, for the dates offered to a guest who named none: its own
16
+ * date where the backend gives it (`todayThere`); else the sun's, from where it
17
+ * is (15° of longitude an hour - the Otaless backend gives no clock); else UTC's.
18
+ */
19
+ export declare const todayOfHotel: (h: Hotel, now: number) => string;
20
+ /**
21
+ * What a client that draws no card is told of the night a dateless answer is
22
+ * priced for (robin 11-06: 「日期选择…文字版优化」): tonight, on the hotel's own
23
+ * calendar, said in the reply's first sentence - with this weekend and next by
24
+ * their weekdays and dates (`dateOptions`) as the other choices, in the same
25
+ * sentence. Named, not numbered: the numbers in that reply are the rooms' or the
26
+ * hotels', and "2" has to mean one thing. In the text and, word for word, in the
27
+ * structure (`stayDefault`).
28
+ */
29
+ export declare const stayDefaultWords: (today: string, guests: number, roomsAsked: unknown,
30
+ /** What the reply numbers - the rooms of a hotel, or the hotels of a list. */
31
+ numbers: "rooms" | "hotels") => string;
32
+ /**
33
+ * The lead, what the rooms share and the choices - in the text and, word for
34
+ * word, in `roomChoices`.
35
+ *
36
+ * `before`: what is said before the list (other arrivals that cost less). Since 0.75.1
37
+ * (robin 11-18) that rates paid in advance cannot be booked here is not among it: it was
38
+ * first since robin's Manus run (11-06, via 总线程), and now it is said when the guest wants
39
+ * one (`notSoldHereWords`).
40
+ */
41
+ export declare const roomChoicesOf: (rooms: Room[], roomsWanted: number, when: string, before: string | undefined, group: string, readOnly?: boolean) => string[];
42
+ /**
43
+ * What a hotel's rooms look like to the assistant for the nights: one line per
44
+ * type, and with filters only the rates that meet ALL of them. None meeting
45
+ * them is said plainly - which filters were asked, what each leaves on its own
46
+ * - and that the full list is there without them.
47
+ */
48
+ export declare const roomsText: (hotelName: string,
49
+ /** "3 room types for 2026-11-04 to 2026-11-06, 2 guests" - what the rooms are, counted. */
50
+ counted: (rooms: Room[]) => string,
51
+ /** "2026-11-04 to 2026-11-06" - when, for the sentence that says none fit. */
52
+ when: string, enough: Room[], roomsWanted: number, terms: RoomTerms | undefined, noCards?: boolean,
53
+ /** The nights as the guest reads them - weekdays first - for a client that draws no card. */
54
+ saidWhen?: string,
55
+ /**
56
+ * What is said before the list to a client that draws no card: other arrivals
57
+ * that cost less (`dateFlex`).
58
+ */
59
+ before?: string,
60
+ /** The group a stay paid in advance is booked with instead - see `paymentOf`. */
61
+ group?: string,
62
+ /** Nothing can be booked here - see `roomChoicesBlock`. */
63
+ readOnly?: boolean) => string[];
64
+ //# sourceMappingURL=room-choices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-choices.d.ts","sourceRoot":"","sources":["../../src/tools/room-choices.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,SAAS,EAOf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,KAAK,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAW1D,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAmOpC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,GAAG,OAAO,EACtB,KAAK,MAAM,EAAE,EACb,aAAQ,EACR,QAAO,MAAM,EAAO,KACnB,MAGe,CAAC;AAanB;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,KAAK,EAAE,KAAK,MAAM,KAAG,MAMpD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,YAAY,OAAO;AACnB,8EAA8E;AAC9E,SAAS,OAAO,GAAG,QAAQ,KAC1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