@new-vintage-labs/guest-prep 0.1.0 → 0.1.2

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.
@@ -1,51 +1,51 @@
1
- class ee extends Error {
1
+ class ne extends Error {
2
2
  constructor(t) {
3
3
  super(t.kind === "tool" ? t.message : t.kind), this.failure = t;
4
4
  }
5
5
  }
6
- const un = ["New Vintage", "New Vintage Staging"];
7
- function jt() {
6
+ const Sn = ["New Vintage", "New Vintage Staging"];
7
+ function Qt() {
8
8
  const e = globalThis.claude;
9
9
  return e && typeof e.use == "function" ? e : null;
10
10
  }
11
- function Ft() {
11
+ function Xt() {
12
12
  const e = globalThis.openai;
13
13
  return e && typeof e == "object" ? e : null;
14
14
  }
15
- function ke() {
16
- return jt() ? "claude" : Ft() ? "chatgpt" : "browser";
15
+ function Ae() {
16
+ return Qt() ? "claude" : Xt() ? "chatgpt" : "browser";
17
17
  }
18
- function dn(e, t) {
18
+ function $n(e, t) {
19
19
  let n = t.length === 1 ? t[0] : null;
20
- return async (r, a) => {
21
- var c;
22
- if (n) return e.callTool(n, r, a);
23
- const s = [];
24
- for (const l of t)
20
+ return async (r, s) => {
21
+ var l;
22
+ if (n) return e.callTool(n, r, s);
23
+ const a = [];
24
+ for (const c of t)
25
25
  try {
26
- const d = await e.callTool(l, r, a);
27
- return n = l, d;
26
+ const d = await e.callTool(c, r, s);
27
+ return n = c, d;
28
28
  } catch (d) {
29
- s.push(d);
29
+ a.push(d);
30
30
  }
31
- throw (c = s.find((l) => ue(l).kind !== "reconnect")) != null ? c : s[0];
31
+ throw (l = a.find((c) => ye(c).kind !== "reconnect")) != null ? l : a[0];
32
32
  };
33
33
  }
34
- async function pn(e) {
35
- const t = jt();
34
+ async function Tn(e) {
35
+ const t = Qt();
36
36
  if (t != null && t.use)
37
37
  try {
38
38
  const n = await Promise.race([
39
39
  t.use("mcp"),
40
40
  new Promise((r) => setTimeout(() => r(null), 1e4))
41
41
  ]);
42
- return !n || typeof n.callTool != "function" ? null : dn(n, e ? [e] : un);
42
+ return !n || typeof n.callTool != "function" ? null : $n(n, e ? [e] : Sn);
43
43
  } catch {
44
44
  return null;
45
45
  }
46
46
  return null;
47
47
  }
48
- function gn(e) {
48
+ function Nn(e) {
49
49
  const t = e.content;
50
50
  if (!Array.isArray(t)) return;
51
51
  const n = t.find((r) => r && typeof r == "object" && r.type === "text");
@@ -56,44 +56,44 @@ function gn(e) {
56
56
  return n.text;
57
57
  }
58
58
  }
59
- function xt(e) {
60
- var r, a, s;
61
- if (!e || typeof e != "object") throw new ee({ kind: "tool", message: "The connector returned nothing." });
62
- const t = e, n = (s = (a = (r = t.payload) != null ? r : t.structuredContent) != null ? a : gn(t)) != null ? s : t;
59
+ function Mt(e) {
60
+ var r, s, a;
61
+ if (!e || typeof e != "object") throw new ne({ kind: "tool", message: "The connector returned nothing." });
62
+ const t = e, n = (a = (s = (r = t.payload) != null ? r : t.structuredContent) != null ? s : Nn(t)) != null ? a : t;
63
63
  if (t.isError === !0 || n && typeof n == "object" && n.ok === !1) {
64
- const c = n.error, l = typeof (c == null ? void 0 : c.message) == "string" ? c.message : typeof n == "string" ? n : "The New Vintage tool returned an error.";
65
- throw new ee({ kind: "tool", message: l });
64
+ const l = n.error, c = typeof (l == null ? void 0 : l.message) == "string" ? l.message : typeof n == "string" ? n : "The New Vintage tool returned an error.";
65
+ throw new ne({ kind: "tool", message: c });
66
66
  }
67
- if (!n || typeof n != "object") throw new ee({ kind: "tool", message: String(n) });
67
+ if (!n || typeof n != "object") throw new ne({ kind: "tool", message: String(n) });
68
68
  return n;
69
69
  }
70
- function ue(e) {
71
- var r, a, s;
72
- if (e instanceof ee) return e.failure;
73
- const t = String((r = e == null ? void 0 : e.code) != null ? r : ""), n = String((s = (a = e == null ? void 0 : e.message) != null ? a : e) != null ? s : "");
70
+ function ye(e) {
71
+ var r, s, a;
72
+ if (e instanceof ne) return e.failure;
73
+ const t = String((r = e == null ? void 0 : e.code) != null ? r : ""), n = String((a = (s = e == null ? void 0 : e.message) != null ? s : e) != null ? a : "");
74
74
  return /not_granted|consent|permission|denied/i.test(t) ? { kind: "approval" } : /server_not_connected|unauthori[sz]ed|auth|reconnect/i.test(t + " " + n) ? { kind: "reconnect" } : (e == null ? void 0 : e.retryable) === !0 || /timeout|unavailable|rate_limited|network|5\d\d/i.test(t + " " + n) ? { kind: "temporary" } : /cannot access|not in this session|tenant/i.test(n) ? { kind: "unavailable" } : { kind: "tool", message: n || "The New Vintage tool returned an error." };
75
75
  }
76
- function fn(e = ke()) {
76
+ function An(e = Ae()) {
77
77
  return e === "claude" ? "Reconnect New Vintage in claude.ai Settings → Connectors." : "Reconnect New Vintage in your chat's connector settings.";
78
78
  }
79
- async function mn(e, t = {}) {
80
- var a, s, c;
81
- const n = Ft(), r = (a = t.followUp) != null ? a : n && typeof n.sendFollowUpMessage == "function" ? (l) => n.sendFollowUpMessage({ prompt: l, ...t.title ? { title: t.title } : {} }) : null;
79
+ async function Mn(e, t = {}) {
80
+ var s, a, l;
81
+ const n = Xt(), r = (s = t.followUp) != null ? s : n && typeof n.sendFollowUpMessage == "function" ? (c) => n.sendFollowUpMessage({ prompt: c, ...t.title ? { title: t.title } : {} }) : null;
82
82
  if (r)
83
83
  try {
84
84
  return await r(e), { kind: "sent" };
85
- } catch (l) {
86
- return { kind: "failed", message: String((s = l == null ? void 0 : l.message) != null ? s : "The request was not sent.") };
85
+ } catch (c) {
86
+ return { kind: "failed", message: String((a = c == null ? void 0 : c.message) != null ? a : "The request was not sent.") };
87
87
  }
88
88
  try {
89
- const l = (c = globalThis.navigator) == null ? void 0 : c.clipboard;
90
- if (!l || typeof l.writeText != "function") throw new Error("no clipboard");
91
- return await l.writeText(e), { kind: "copied" };
89
+ const c = (l = globalThis.navigator) == null ? void 0 : l.clipboard;
90
+ if (!c || typeof c.writeText != "function") throw new Error("no clipboard");
91
+ return await c.writeText(e), { kind: "copied" };
92
92
  } catch {
93
93
  return { kind: "manual", text: e };
94
94
  }
95
95
  }
96
- const Zt = [
96
+ const en = [
97
97
  "America/Los_Angeles",
98
98
  "America/Denver",
99
99
  "America/Phoenix",
@@ -101,43 +101,43 @@ const Zt = [
101
101
  "America/New_York",
102
102
  "America/Anchorage",
103
103
  "Pacific/Honolulu"
104
- ], hn = /^\d{4}-\d{2}-\d{2}$/, yn = /^[A-Za-z0-9-]{1,100}$/, wt = /timestamptz '(\d{4}-\d{2}-\d{2}) 00:00:00 [^']*'/g, kt = /(\bfocus as \(\s*(?:--[^\n]*\n\s*)?select \* from \(\s*values )\([^()]*\)(\s*\) focus_rows \()/;
105
- function te(e) {
104
+ ], _n = /^\d{4}-\d{2}-\d{2}$/, Cn = /^[A-Za-z0-9-]{1,100}$/, _t = /timestamptz '(\d{4}-\d{2}-\d{2}) 00:00:00 [^']*'/g, Ct = /(\bfocus as \(\s*(?:--[^\n]*\n\s*)?select \* from \(\s*values )\([^()]*\)(\s*\) focus_rows \()/;
105
+ function re(e) {
106
106
  throw new Error("fillGuestPrepQuery: " + e);
107
107
  }
108
- function bn(e) {
109
- (typeof e != "string" || !hn.test(e)) && te("day must be YYYY-MM-DD");
110
- const [t, n, r] = e.split("-").map(Number), a = new Date(Date.UTC(t, n - 1, r));
111
- return a.toISOString().slice(0, 10) !== e && te("bad date " + e), new Date(a.getTime() + 864e5).toISOString().slice(0, 10);
108
+ function En(e) {
109
+ (typeof e != "string" || !_n.test(e)) && re("day must be YYYY-MM-DD");
110
+ const [t, n, r] = e.split("-").map(Number), s = new Date(Date.UTC(t, n - 1, r));
111
+ return s.toISOString().slice(0, 10) !== e && re("bad date " + e), new Date(s.getTime() + 864e5).toISOString().slice(0, 10);
112
112
  }
113
- function vn(e) {
114
- return e == null ? "(null::text, null::text)" : (e.source !== "commerce7" && e.source !== "tock" && te("unexpected source " + String(e.source)), (typeof e.id != "string" || !yn.test(e.id)) && te("arrival id may only hold letters, digits and hyphens"), "('" + e.source + "'::text, '" + e.id + "'::text)");
113
+ function zn(e) {
114
+ return e == null ? "(null::text, null::text)" : (e.source !== "commerce7" && e.source !== "tock" && re("unexpected source " + String(e.source)), (typeof e.id != "string" || !Cn.test(e.id)) && re("arrival id may only hold letters, digits and hyphens"), "('" + e.source + "'::text, '" + e.id + "'::text)");
115
115
  }
116
- function xn(e, t) {
116
+ function Pn(e, t) {
117
117
  const n = t || {};
118
- Zt.indexOf(n.timeZone) < 0 && te("unsupported time zone");
119
- const r = bn(n.day);
120
- let a = String(e);
121
- const s = Array.from(new Set(Array.from(a.matchAll(wt), (l) => l[1]))).sort();
122
- s.length > 2 && te("expected at most two day literals"), a = a.replace(wt, (l, d) => "timestamptz '" + (s.length === 2 && d === s[1] ? r : n.day) + " 00:00:00 " + n.timeZone + "'"), a = a.replace(/at time zone '[^']*'/gi, (l) => l.slice(0, l.indexOf("'")) + "'" + n.timeZone + "'");
123
- const c = vn(n.arrival);
124
- return kt.test(a) ? a = a.replace(kt, (l, d, m) => d + c + m) : n.arrival && te("this query has no focus row"), a;
125
- }
126
- function E(e) {
118
+ en.indexOf(n.timeZone) < 0 && re("unsupported time zone");
119
+ const r = En(n.day);
120
+ let s = String(e);
121
+ const a = Array.from(new Set(Array.from(s.matchAll(_t), (c) => c[1]))).sort();
122
+ a.length > 2 && re("expected at most two day literals"), s = s.replace(_t, (c, d) => "timestamptz '" + (a.length === 2 && d === a[1] ? r : n.day) + " 00:00:00 " + n.timeZone + "'"), s = s.replace(/at time zone '[^']*'/gi, (c) => c.slice(0, c.indexOf("'")) + "'" + n.timeZone + "'");
123
+ const l = zn(n.arrival);
124
+ return Ct.test(s) ? s = s.replace(Ct, (c, d, m) => d + l + m) : n.arrival && re("this query has no focus row"), s;
125
+ }
126
+ function U(e) {
127
127
  if (e == null || e === "") return null;
128
128
  const t = typeof e == "number" ? e : Number(e);
129
129
  return Number.isFinite(t) ? t : null;
130
130
  }
131
- const wn = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2, maximumFractionDigits: 2 }), kn = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
132
- function G(e) {
131
+ const Ln = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2, maximumFractionDigits: 2 }), In = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
132
+ function Y(e) {
133
133
  var n;
134
- const t = (n = E(e)) != null ? n : 0;
135
- return Number.isInteger(Math.round(t * 100) / 100) ? kn.format(t) : wn.format(t);
134
+ const t = (n = U(e)) != null ? n : 0;
135
+ return Number.isInteger(Math.round(t * 100) / 100) ? In.format(t) : Ln.format(t);
136
136
  }
137
- function P(e, t, n = `${t}s`) {
137
+ function A(e, t, n = `${t}s`) {
138
138
  return `${e} ${e === 1 ? t : n}`;
139
139
  }
140
- function Sn(e) {
140
+ function On(e) {
141
141
  if (e) return e;
142
142
  try {
143
143
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "America/Los_Angeles";
@@ -145,155 +145,156 @@ function Sn(e) {
145
145
  return "America/Los_Angeles";
146
146
  }
147
147
  }
148
- function St(e, t) {
149
- const n = new Intl.DateTimeFormat("en-CA", { timeZone: t, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).formatToParts(e), r = (a) => {
150
- var s, c;
151
- return (c = (s = n.find((l) => l.type === a)) == null ? void 0 : s.value) != null ? c : "00";
148
+ function Et(e, t) {
149
+ const n = new Intl.DateTimeFormat("en-CA", { timeZone: t, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).formatToParts(e), r = (s) => {
150
+ var a, l;
151
+ return (l = (a = n.find((c) => c.type === s)) == null ? void 0 : a.value) != null ? l : "00";
152
152
  };
153
153
  return { day: `${r("year")}-${r("month")}-${r("day")}`, minutes: Number(r("hour")) % 24 * 60 + Number(r("minute")) };
154
154
  }
155
- const Tn = /^(\d{4})-(\d{2})-(\d{2})$/;
156
- function Tt(e) {
157
- return typeof e != "string" || !Tn.test(e) ? !1 : de(e).toISOString().slice(0, 10) === e;
155
+ const Rn = /^(\d{4})-(\d{2})-(\d{2})$/;
156
+ function zt(e) {
157
+ return typeof e != "string" || !Rn.test(e) ? !1 : be(e).toISOString().slice(0, 10) === e;
158
158
  }
159
- function de(e) {
159
+ function be(e) {
160
160
  const [t, n, r] = e.split("-").map(Number);
161
161
  return new Date(Date.UTC(t, n - 1, r));
162
162
  }
163
- function j(e, t) {
164
- return new Date(de(e).getTime() + t * 864e5).toISOString().slice(0, 10);
163
+ function W(e, t) {
164
+ return new Date(be(e).getTime() + t * 864e5).toISOString().slice(0, 10);
165
165
  }
166
- function we(e, t) {
167
- const [n, r] = e.split("-").map(Number), a = n * 12 + r - 1 + t;
168
- return `${Math.floor(a / 12)}-${String(a % 12 + 1).padStart(2, "0")}`;
166
+ function Ne(e, t) {
167
+ const [n, r] = e.split("-").map(Number), s = n * 12 + r - 1 + t;
168
+ return `${Math.floor(s / 12)}-${String(s % 12 + 1).padStart(2, "0")}`;
169
169
  }
170
- function be(e, t) {
171
- return Math.round((de(t).getTime() - de(e).getTime()) / 864e5);
170
+ function Se(e, t) {
171
+ return Math.round((be(t).getTime() - be(e).getTime()) / 864e5);
172
172
  }
173
- function pe(e) {
174
- return de(e).getUTCDay();
173
+ function ve(e) {
174
+ return be(e).getUTCDay();
175
175
  }
176
- const Ie = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Se = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], Bt = (e, t) => e.slice(0, 4) !== t.slice(0, 4) ? `, ${e.slice(0, 4)}` : "";
177
- function Ht(e, t) {
178
- return `${Se[Number(e.slice(5, 7)) - 1].slice(0, 3)} ${Number(e.slice(8, 10))}${Bt(e, t)}`;
176
+ const Ue = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Me = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], tn = (e, t) => e.slice(0, 4) !== t.slice(0, 4) ? `, ${e.slice(0, 4)}` : "";
177
+ function nn(e, t) {
178
+ return `${Me[Number(e.slice(5, 7)) - 1].slice(0, 3)} ${Number(e.slice(8, 10))}${tn(e, t)}`;
179
179
  }
180
- function ne(e, t) {
181
- return `${Ie[pe(e)].slice(0, 3)}, ${Ht(e, t)}`;
180
+ function ae(e, t) {
181
+ return `${Ue[ve(e)].slice(0, 3)}, ${nn(e, t)}`;
182
182
  }
183
- function Oe(e, t) {
184
- return `${Ie[pe(e)]}, ${Se[Number(e.slice(5, 7)) - 1]} ${Number(e.slice(8, 10))}${Bt(e, t)}`;
183
+ function je(e, t) {
184
+ return `${Ue[ve(e)]}, ${Me[Number(e.slice(5, 7)) - 1]} ${Number(e.slice(8, 10))}${tn(e, t)}`;
185
185
  }
186
- function $t(e) {
187
- return `${Se[Number(e.slice(5, 7)) - 1]} ${e.slice(0, 4)}`;
186
+ function Pt(e) {
187
+ return `${Me[Number(e.slice(5, 7)) - 1]} ${e.slice(0, 4)}`;
188
188
  }
189
- function $n(e) {
189
+ function qn(e) {
190
190
  const t = /^(\d{1,2}):(\d{2})/.exec(String(e != null ? e : ""));
191
191
  return t ? Number(t[1]) * 60 + Number(t[2]) : null;
192
192
  }
193
- function se(e) {
193
+ function J(e) {
194
194
  const t = Math.floor(e / 60) % 24;
195
195
  return `${t % 12 === 0 ? 12 : t % 12}:${String(e % 60).padStart(2, "0")} ${t < 12 ? "AM" : "PM"}`;
196
196
  }
197
- function fe(e, t, n) {
198
- return `${ne(e, n)}, ${se(t)}`;
197
+ function we(e, t, n) {
198
+ return `${ae(e, n)}, ${J(t)}`;
199
199
  }
200
- function De(e) {
200
+ function Ge(e) {
201
201
  if (e <= 0) return "now";
202
202
  const t = Math.floor(e / 60), n = e % 60;
203
203
  return t ? n ? `in ${t} hr ${n} min` : `in ${t} hr` : `in ${n} min`;
204
204
  }
205
- function Nn(e, t) {
206
- const n = be(e, t);
205
+ function Dn(e, t) {
206
+ const n = Se(e, t);
207
207
  if (n <= 0) return "today";
208
208
  if (n === 1) return "yesterday";
209
209
  if (n < 14) return `${n} days ago`;
210
210
  let r = (Number(t.slice(0, 4)) - Number(e.slice(0, 4))) * 12 + Number(t.slice(5, 7)) - Number(e.slice(5, 7));
211
- return Number(t.slice(8, 10)) < Number(e.slice(8, 10)) && (r -= 1), r < 2 ? `${Math.max(2, Math.floor(n / 7))} weeks ago` : r < 12 ? `${r} months ago` : `${P(Math.floor(r / 12), "year")} ago`;
211
+ return Number(t.slice(8, 10)) < Number(e.slice(8, 10)) && (r -= 1), r < 2 ? `${Math.max(2, Math.floor(n / 7))} weeks ago` : r < 12 ? `${r} months ago` : `${A(Math.floor(r / 12), "year")} ago`;
212
212
  }
213
- function An(e, t) {
214
- var s;
215
- const n = ((s = E(e)) != null ? s : 0) - 1, r = Se[n], a = E(t);
216
- return r && a ? `${r} ${a}` : r != null ? r : a ? String(a) : "";
213
+ function Vn(e, t) {
214
+ var a;
215
+ const n = ((a = U(e)) != null ? a : 0) - 1, r = Me[n], s = U(t);
216
+ return r && s ? `${r} ${s}` : r != null ? r : s ? String(s) : "";
217
217
  }
218
- function Nt(e) {
218
+ function Lt(e) {
219
219
  const t = e.trim().toLowerCase();
220
220
  return t.charAt(0).toUpperCase() + t.slice(1);
221
221
  }
222
- const _n = "guest-prep", Le = "guest-prep-day-arrivals";
223
- function _e(e, t) {
222
+ const Un = "guest-prep", De = "guest-prep-day-arrivals";
223
+ function Le(e, t) {
224
224
  return {
225
225
  call: async (n, r) => {
226
- const a = n === "get_analysis_guide" || !t ? r : { tenantId: t, ...r };
226
+ const s = n === "get_analysis_guide" || !t ? r : { tenantId: t, ...r };
227
227
  try {
228
- return xt(await e(n, a));
229
- } catch (s) {
230
- if (ue(s).kind !== "temporary") throw s;
231
- return await new Promise((c) => setTimeout(c, 2e3)), xt(await e(n, a));
228
+ return Mt(await e(n, s));
229
+ } catch (a) {
230
+ if (ye(a).kind !== "temporary") throw a;
231
+ return await new Promise((l) => setTimeout(l, 2e3)), Mt(await e(n, s));
232
232
  }
233
233
  }
234
234
  };
235
235
  }
236
- async function At(e, t) {
237
- var s, c, l;
236
+ async function It(e, t) {
237
+ var a, l, c;
238
238
  const n = await e.call("get_analysis_guide", {
239
239
  context: "Opening the Guest Prep briefing with the latest day query.",
240
- slug: _n,
240
+ slug: Un,
241
241
  includeReferenceQueries: !0,
242
242
  ...t ? { pageSetup: t } : {}
243
- }), r = (s = n.item) != null ? s : n, a = {};
244
- for (const d of (c = r.referenceQueries) != null ? c : [])
245
- typeof d.slug == "string" && typeof d.sqlText == "string" && (a[d.slug] = d.sqlText);
246
- if (!a[Le]) throw new ee({ kind: "tool", message: `The guide is missing the ${Le} query.` });
247
- return { version: (l = E(r.version)) != null ? l : 0, queries: a };
243
+ }), r = (a = n.item) != null ? a : n, s = {};
244
+ for (const d of (l = r.referenceQueries) != null ? l : [])
245
+ typeof d.slug == "string" && typeof d.sqlText == "string" && (s[d.slug] = d.sqlText);
246
+ if (!s[De]) throw new ne({ kind: "tool", message: `The guide is missing the ${De} query.` });
247
+ return { version: (c = U(r.version)) != null ? c : 0, queries: s };
248
248
  }
249
- async function Yt(e, t, n) {
249
+ async function rn(e, t, n) {
250
250
  const r = await e.call("safe_tenant_sql", { context: n, sqlText: t });
251
251
  return { rows: Array.isArray(r.rows) ? r.rows : [], complete: r.resultMode === "complete" };
252
252
  }
253
- function Mn(e, t, n, r) {
253
+ function jn(e, t, n, r) {
254
254
  try {
255
- return xn(e.queries[Le], { timeZone: t, day: n, arrival: r });
255
+ return Pn(e.queries[De], { timeZone: t, day: n, arrival: r });
256
256
  } catch {
257
- throw new ee({ kind: "needs_update" });
257
+ throw new ne({ kind: "needs_update" });
258
258
  }
259
259
  }
260
- async function _t(e, t, n) {
261
- var s;
262
- const r = Mn(t, n.timeZone, n.day, (s = n.arrival) != null ? s : null), a = n.arrival ? "Refreshing one guest's briefing for the Guest Prep page." : "Loading one day's arrivals for the Guest Prep briefing.";
263
- for (let c = 0; c < 2; c += 1) {
264
- const l = await Yt(e, r, a);
265
- if (l.complete) return l.rows;
260
+ async function Ot(e, t, n) {
261
+ var a;
262
+ const r = jn(t, n.timeZone, n.day, (a = n.arrival) != null ? a : null), s = n.arrival ? "Refreshing one guest's briefing for the Guest Prep page." : "Loading one day's arrivals for the Guest Prep briefing.";
263
+ for (let l = 0; l < 2; l += 1) {
264
+ const c = await rn(e, r, s);
265
+ if (c.complete) return c.rows;
266
266
  }
267
- throw new ee({ kind: "tool", message: "New Vintage returned only a preview of this day, so it wasn't loaded. Try again." });
267
+ throw new ne({ kind: "tool", message: "New Vintage returned only a preview of this day, so it wasn't loaded. Try again." });
268
268
  }
269
- async function Cn(e) {
269
+ async function Gn(e) {
270
270
  var t, n;
271
271
  try {
272
- const r = await e.call("discover_tenant_data_sources", { context: "Finding which wineries the Guest Prep page can load." }), a = (t = r.accessibleTenants) != null ? t : r.tenants;
273
- return Array.isArray(a) ? a.filter((s) => typeof (s == null ? void 0 : s.tenantId) == "string").map((s) => ({ tenantId: String(s.tenantId), name: typeof s.name == "string" && s.name ? s.name : String(s.tenantId) })) : typeof r.tenantId == "string" ? [{ tenantId: r.tenantId, name: typeof r.tenantName == "string" ? r.tenantName : r.tenantId }] : [];
272
+ const r = await e.call("discover_tenant_data_sources", { context: "Finding which wineries the Guest Prep page can load." }), s = (t = r.accessibleTenants) != null ? t : r.tenants;
273
+ return Array.isArray(s) ? s.filter((a) => typeof (a == null ? void 0 : a.tenantId) == "string").map((a) => ({ tenantId: String(a.tenantId), name: typeof a.name == "string" && a.name ? a.name : String(a.tenantId) })) : typeof r.tenantId == "string" ? [{ tenantId: r.tenantId, name: typeof r.tenantName == "string" ? r.tenantName : r.tenantId }] : [];
274
274
  } catch (r) {
275
- const a = String((n = r == null ? void 0 : r.message) != null ? n : ""), s = Array.from(a.matchAll(/(?:([^,:]+?) -> )?tenantId "([^"]+)"/g)).map((c) => {
276
- var l;
275
+ const s = String((n = r == null ? void 0 : r.message) != null ? n : ""), a = Array.from(s.matchAll(/(?:([^,:]+?) -> )?tenantId "([^"]+)"/g)).map((l) => {
276
+ var c;
277
277
  return {
278
- tenantId: c[2],
279
- name: ((l = c[1]) != null ? l : "").replace(/^.*(?:values|these)[^:]*:\s*/i, "").trim() || c[2]
278
+ tenantId: l[2],
279
+ name: ((c = l[1]) != null ? c : "").replace(/^.*(?:values|these)[^:]*:\s*/i, "").trim() || l[2]
280
280
  };
281
281
  });
282
- if (s.length) return s;
282
+ if (a.length) return a;
283
283
  throw r;
284
284
  }
285
285
  }
286
- const En = "Name not on file";
287
- function ge(e) {
286
+ const Fn = "Name not on file";
287
+ function xe(e) {
288
288
  var t;
289
- return (t = e.name) != null ? t : En;
289
+ return (t = e.name) != null ? t : Fn;
290
290
  }
291
- const Ln = /[A-Z0-9._%+-]+@[A-Z0-9-]+(?:\.[A-Z0-9-]+)*\.[A-Z]{2,}/gi, zn = /(?:\+?\d{1,3}[\s.-]?)?(?:\(\d{3}\)\s?|\b\d{3}[\s.-]?)\d{3}[\s.-]?\d{4}\b|\b\d{3}[\s.-]\d{4}\b/g;
292
- function Mt(e) {
293
- const t = String(e != null ? e : "").replace(Ln, "").replace(zn, "").replace(/\(\s*\)/g, "").replace(/\s{2,}/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/([,;:])(?=[.!?]|$)/g, "").replace(/^[\s,;:.-]+|[\s,;:-]+$/g, "");
291
+ const Zn = /[A-Z0-9._%+-]+@[A-Z0-9-]+(?:\.[A-Z0-9-]+)*\.[A-Z]{2,}/gi, Bn = /(?:\+?\d{1,3}[\s.-]?)?(?:\(\d{3}\)\s?|\b\d{3}[\s.-]?)\d{3}[\s.-]?\d{4}\b|\b\d{3}[\s.-]\d{4}\b/g;
292
+ function Rt(e) {
293
+ const t = String(e != null ? e : "").replace(Zn, "[email]").replace(Bn, "[phone]").replace(/\s{2,}/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/([,;:])(?=[.!?]|$)/g, "").replace(/^[\s,;:.-]+|[\s,;:-]+$/g, "");
294
294
  return t || null;
295
295
  }
296
- function Pn(e) {
296
+ const Ie = (e) => String(e != null ? e : "").trim().replace(/\s+/g, " ").toLowerCase();
297
+ function Hn(e) {
297
298
  const t = (n) => (n != null ? n : []).flatMap((r) => {
298
299
  try {
299
300
  return [new RegExp(r, "i")];
@@ -303,27 +304,27 @@ function Pn(e) {
303
304
  });
304
305
  return { hide: t(e.hide), interests: t(e.interests), vip: t(e.vip), club: t(e.club) };
305
306
  }
306
- function In(e, t) {
307
+ function Yn(e, t) {
307
308
  var r;
308
309
  const n = { vip: !1, interests: [], clubTags: [], accountTags: [] };
309
- for (const a of e) {
310
- const s = a.trim();
311
- if (!s || t.hide.some((l) => l.test(s))) continue;
312
- const c = t.interests.map((l) => l.exec(s)).find(Boolean);
313
- if (c) {
314
- n.interests.push(((r = c[1]) != null ? r : c[0]).trim());
310
+ for (const s of e) {
311
+ const a = s.trim();
312
+ if (!a || t.hide.some((c) => c.test(a))) continue;
313
+ const l = t.interests.map((c) => c.exec(a)).find(Boolean);
314
+ if (l) {
315
+ n.interests.push(((r = l[1]) != null ? r : l[0]).trim());
315
316
  continue;
316
317
  }
317
- t.vip.some((l) => l.test(s)) ? n.vip = !0 : t.club.some((l) => l.test(s)) ? n.clubTags.push(s) : n.accountTags.push(s);
318
+ t.vip.some((c) => c.test(a)) ? n.vip = !0 : t.club.some((c) => c.test(a)) ? n.clubTags.push(a) : n.accountTags.push(a);
318
319
  }
319
320
  return n;
320
321
  }
321
- function M(e) {
322
+ function R(e) {
322
323
  if (e == null) return null;
323
324
  const t = String(e).trim();
324
325
  return t || null;
325
326
  }
326
- function ve(e) {
327
+ function $e(e) {
327
328
  if (Array.isArray(e)) return e;
328
329
  if (typeof e == "string" && e.trim().startsWith("["))
329
330
  try {
@@ -334,149 +335,188 @@ function ve(e) {
334
335
  }
335
336
  return [];
336
337
  }
337
- function ze(e) {
338
- return typeof e == "string" && !e.trim().startsWith("[") ? e.split(",").map((t) => t.trim()).filter(Boolean) : ve(e).map((t) => M(t)).filter((t) => !!t);
338
+ function ce(e) {
339
+ return typeof e == "string" && !e.trim().startsWith("[") ? e.split(",").map((t) => t.trim()).filter(Boolean) : $e(e).map((t) => R(t)).filter((t) => !!t);
339
340
  }
340
- const Ct = (e) => ze(e).map((t) => t.toLowerCase());
341
- function Et(e, t) {
341
+ const Wn = (e) => /^rose$/i.test(e) ? "Rosé" : e, qt = (e) => ce(e).map((t) => t.toLowerCase());
342
+ function Dt(e, t) {
342
343
  if (!/^\d{2}-\d{2}$/.test(e)) return null;
343
- const n = Number(t.slice(0, 4)), a = [n - 1, n, n + 1].map((s) => `${s}-${e}`).filter((s) => j(s, 0) === s).sort((s, c) => Math.abs(be(t, s)) - Math.abs(be(t, c)))[0];
344
- return a && Math.abs(be(t, a)) <= 30 ? a : null;
345
- }
346
- function On(e, t, n) {
347
- const r = [], a = M(e.bday_md), s = a ? Et(a, t) : null;
348
- s && r.push(s === t ? "Birthday on this day" : `Birthday ${ne(s, n)}`);
349
- const c = M(e.club_signup), l = c && /^\d{4}-\d{2}-\d{2}$/.test(c) ? Et(c.slice(5), t) : null, d = l && c ? Number(l.slice(0, 4)) - Number(c.slice(0, 4)) : 0;
350
- return l && d > 0 && r.push(`${P(d, "year")} in the club ${l === t ? "on this day" : ne(l, n)}`), r;
351
- }
352
- function Dn(e, t) {
353
- var H, A, R;
354
- const n = e.source === "tock" ? "tock" : "commerce7", r = String((H = e.arr_id) != null ? H : ""), a = (A = E(e.party)) != null ? A : 0, s = e.visit === "First visit" ? "first" : e.visit === "Return" ? "return" : "unknown", c = In(ze(e.tags), t.rules), l = M(e.club_titles), d = l !== null, m = M(e.signup_tier), S = M(e.churn_tier), f = !d && Ct(m).some((h) => h === "high" || h === "very high"), b = d && Ct(S).some((h) => h === "medium" || h === "high"), F = M(e.last_taste), C = F ? { title: F, day: M(e.last_taste_date) } : null, Z = ve(e.last_taste_items).map((h) => h).map((h) => {
355
- var $, T;
356
- return { title: ($ = M(h == null ? void 0 : h.title)) != null ? $ : "", qty: (T = E(h == null ? void 0 : h.qty)) != null ? T : 0 };
357
- }).filter((h) => h.title), I = ve(e.notes).map((h) => h).map((h) => ({ content: Mt(h == null ? void 0 : h.content), when: An(h == null ? void 0 : h.month, h == null ? void 0 : h.year) })).filter((h) => !!h.content).slice(0, 3), N = new Set(I.map((h) => h.content.toLowerCase())), O = [];
358
- for (const h of ve(e.last_taste_notes)) {
359
- const $ = Mt(h);
360
- if (!(!$ || N.has($.toLowerCase())) && (N.add($.toLowerCase()), O.push($), O.length === 3))
344
+ const n = Number(t.slice(0, 4)), s = [n - 1, n, n + 1].map((a) => `${a}-${e}`).filter((a) => W(a, 0) === a).sort((a, l) => Math.abs(Se(t, a)) - Math.abs(Se(t, l)))[0];
345
+ return s && Math.abs(Se(t, s)) <= 30 ? s : null;
346
+ }
347
+ function Kn(e, t, n) {
348
+ const r = [], s = R(e.bday_md), a = s ? Dt(s, t) : null;
349
+ a && r.push(a === t ? "Birthday on this day" : `Birthday ${ae(a, n)}`);
350
+ const l = R(e.club_signup), c = l && /^\d{4}-\d{2}-\d{2}$/.test(l) ? Dt(l.slice(5), t) : null, d = c && l ? Number(c.slice(0, 4)) - Number(l.slice(0, 4)) : 0;
351
+ return c && d > 0 && r.push(`${A(d, "year")} in the club ${c === t ? "on this day" : ae(c, n)}`), r;
352
+ }
353
+ function Jn(e, t) {
354
+ var Q, z, B;
355
+ const n = e.source === "tock" ? "tock" : "commerce7", r = String((Q = e.arr_id) != null ? Q : ""), s = (z = U(e.party)) != null ? z : 0, a = e.visit === "First visit" ? "first" : e.visit === "Return" ? "return" : "unknown", l = Yn(ce(e.tags), t.rules), c = R(e.club_titles), d = c !== null, m = R(e.signup_tier), M = R(e.churn_tier), k = !d && qt(m).some((g) => g === "high" || g === "very high"), h = d && qt(M).some((g) => g === "medium" || g === "high"), x = R(e.last_taste), y = x ? { title: x, day: R(e.last_taste_date) } : null, _ = $e(e.last_taste_items).map((g) => g).map((g) => {
356
+ var E, N;
357
+ return { title: (E = R(g == null ? void 0 : g.title)) != null ? E : "", qty: (N = U(g == null ? void 0 : g.qty)) != null ? N : 0 };
358
+ }).filter((g) => g.title), C = $e(e.notes).map((g) => g).map((g) => ({ content: Rt(g == null ? void 0 : g.content), when: Vn(g == null ? void 0 : g.month, g == null ? void 0 : g.year), original: Ie(g == null ? void 0 : g.content) })).filter((g) => !!g.content).slice(0, 3), L = C.map(({ content: g, when: E }) => ({ content: g, when: E })), T = new Set(C.map((g) => g.original)), q = [];
359
+ for (const g of $e(e.last_taste_notes)) {
360
+ const E = Rt(g);
361
+ if (!(!E || T.has(Ie(g))) && (T.add(Ie(g)), q.push(E), q.length === 3))
361
362
  break;
362
363
  }
363
- const J = E(e.price_floor), L = E(e.price_ceiling), B = E(e.avg_unit_price), D = E(e.ltv_cents), z = E(e.order_count);
364
+ const F = U(e.price_floor), I = U(e.price_ceiling), O = U(e.avg_unit_price), Z = U(e.ltv_cents), j = U(e.order_count);
364
365
  return {
365
366
  key: `${n}:${r}`,
366
367
  source: n,
367
368
  id: r,
368
369
  row: e,
369
- minutes: (R = $n(e.t)) != null ? R : 0,
370
- party: a,
371
- experience: M(e.experience),
372
- name: M(e.name),
373
- visit: s,
374
- vip: c.vip,
370
+ minutes: (B = qn(e.t)) != null ? B : 0,
371
+ party: s,
372
+ experience: R(e.experience),
373
+ name: R(e.name),
374
+ visit: a,
375
+ vip: l.vip,
375
376
  clubMember: d,
376
- clubTitles: l,
377
- prospect: f,
377
+ clubTitles: c,
378
+ prospect: k,
378
379
  signupTier: m,
379
- atRisk: b,
380
- churnTier: S,
381
- clubPickup: M(e.next_ship) === t.day,
382
- large: a >= t.largeParty,
383
- occasions: On(e, t.day, t.today),
384
- interests: c.interests,
385
- clubTags: c.clubTags,
386
- accountTags: c.accountTags,
387
- varietals: ze(e.top_varietals).slice(0, 3),
388
- lastTaste: C,
389
- bought: C ? { items: Z, total: E(e.last_taste_spend) } : null,
390
- orderNotes: O,
391
- personalNotes: I,
392
- price: J !== null || L !== null || B !== null ? { floor: J, ceiling: L, avg: B } : null,
393
- lifetime: D !== null && (D > 0 || (z != null ? z : 0) > 0) ? { spend: D / 100, orders: z } : null,
394
- since: M(e.since_year)
380
+ atRisk: h,
381
+ churnTier: M,
382
+ clubPickup: R(e.next_ship) === t.day,
383
+ large: s >= t.largeParty,
384
+ partlyRefunded: e.refund_state === "partial",
385
+ occasions: Kn(e, t.day, t.today),
386
+ interests: l.interests,
387
+ clubTags: l.clubTags,
388
+ accountTags: l.accountTags,
389
+ varietals: ce(e.top_varietals).slice(0, 3),
390
+ wineTypes: ce(e.top_wine_types).map(Wn).slice(0, 2),
391
+ vintages: ce(e.top_vintages).slice(0, 3),
392
+ appellations: ce(e.top_appellations).slice(0, 2),
393
+ lastTaste: y,
394
+ bought: y ? { items: _, total: U(e.last_taste_spend) } : null,
395
+ orderNotes: q,
396
+ personalNotes: L,
397
+ price: F !== null || I !== null || O !== null ? { floor: F, ceiling: I, avg: O } : null,
398
+ lifetime: Z !== null && (Z > 0 || (j != null ? j : 0) > 0) ? { spend: Z / 100, orders: j } : null,
399
+ since: R(e.since_year)
395
400
  };
396
401
  }
397
- function Rn(e, t) {
398
- return e.map((n) => Dn(n, t)).map((n, r) => ({ arrival: n, index: r })).sort((n, r) => n.arrival.minutes - r.arrival.minutes || n.index - r.index).map(({ arrival: n }) => n);
402
+ function Qn(e, t) {
403
+ return e.map((n) => Jn(n, t)).map((n, r) => ({ arrival: n, index: r })).sort((n, r) => n.arrival.minutes - r.arrival.minutes || n.index - r.index).map(({ arrival: n }) => n);
399
404
  }
400
- function Pe(e, t) {
405
+ function Xn(e, t) {
406
+ const n = [...e].sort((a, l) => a.minutes - l.minutes), r = [];
407
+ for (const a of n) {
408
+ const l = r[r.length - 1];
409
+ l && a.minutes - l[l.length - 1].minutes < t ? l.push(a) : r.push([a]);
410
+ }
411
+ return r.flatMap((a) => {
412
+ var c;
413
+ if (a[a.length - 1].minutes - a[0].minutes <= 120) return [a];
414
+ const l = /* @__PURE__ */ new Map();
415
+ for (const d of a) {
416
+ const m = Math.floor(d.minutes / 60);
417
+ l.set(m, [...(c = l.get(m)) != null ? c : [], d]);
418
+ }
419
+ return Array.from(l.values());
420
+ }).map((a) => ({ key: String(a[0].minutes), first: a[0].minutes, last: a[a.length - 1].minutes, arrivals: a }));
421
+ }
422
+ function er(e) {
423
+ const t = [], n = e.filter((a) => a.vip).length, r = e.filter((a) => a.large).length, s = e.filter((a) => a.clubPickup).length;
424
+ return n && t.push(A(n, "VIP")), r && t.push(A(r, "large party", "large parties")), s && t.push(A(s, "club pickup")), t.length ? t.join(", ") : null;
425
+ }
426
+ const an = [
427
+ { id: "vip", label: "VIP", test: (e) => e.vip },
428
+ { id: "first", label: "First visit", test: (e) => e.visit === "first" },
429
+ { id: "club", label: "Club member", test: (e) => e.clubMember },
430
+ { id: "large", label: "Large party", test: (e) => e.large }
431
+ ];
432
+ function Vt(e) {
433
+ return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim();
434
+ }
435
+ function Oe(e, t, n) {
436
+ var s;
437
+ const r = Vt(t);
438
+ return r && !Vt((s = e.name) != null ? s : "").includes(r) ? !1 : an.every((a) => !n.includes(a.id) || a.test(e));
439
+ }
440
+ function Ve(e, t) {
401
441
  return e < t ? "past" : e > t ? "future" : "today";
402
442
  }
403
- function Re(e, t, n) {
443
+ function sn(e, t, n) {
404
444
  return t !== "today" ? { upcoming: e, earlier: [] } : { upcoming: e.filter((r) => r.minutes >= n), earlier: e.filter((r) => r.minutes < n) };
405
445
  }
406
- function qn(e, t, n) {
446
+ function tr(e, t, n) {
407
447
  if (t !== "today") return null;
408
448
  const r = e.minutes - n;
409
- return r >= 0 && r <= 120 ? De(r) : null;
449
+ return r >= 0 && r <= 120 ? Ge(r) : null;
410
450
  }
411
- function Un(e) {
412
- const t = e.slice(0, 2).map(ge).join(", ");
451
+ function nr(e) {
452
+ const t = e.slice(0, 2).map(xe).join(", ");
413
453
  return e.length > 2 ? `${t} and ${e.length - 2} more` : t;
414
454
  }
415
- function Me(e, t, n, r, a) {
416
- return n.length ? n.length === 1 ? { label: e, value: ge(n[0]), detail: fe(r, n[0].minutes, a) } : { label: t, value: P(n.length, "guest"), detail: Un(n) } : null;
455
+ function Re(e, t, n, r, s) {
456
+ return n.length ? n.length === 1 ? { label: e, value: xe(n[0]), detail: we(r, n[0].minutes, s) } : { label: t, value: A(n.length, "guest"), detail: nr(n) } : null;
417
457
  }
418
- function Lt(e, t, n) {
458
+ function Ut(e, t, n) {
419
459
  const r = [];
420
- r.push(Me("Club pickup", "Club pickups", e.filter((s) => s.clubPickup), t, n));
421
- const a = e.filter((s) => s.large);
422
- if (a.length === 1) r.push({ label: "Large party", value: `Party of ${a[0].party}`, detail: fe(t, a[0].minutes, n) });
423
- else if (a.length > 1) {
424
- const s = a.reduce((l, d) => l + d.party, 0), c = a.slice(0, 2).map((l) => `${se(l.minutes)} for ${l.party}`).join(", ");
460
+ r.push(Re("Club pickup", "Club pickups", e.filter((a) => a.clubPickup), t, n));
461
+ const s = e.filter((a) => a.large);
462
+ if (s.length === 1) r.push({ label: "Large party", value: `Party of ${s[0].party}`, detail: we(t, s[0].minutes, n) });
463
+ else if (s.length > 1) {
464
+ const a = s.reduce((c, d) => c + d.party, 0), l = s.slice(0, 2).map((c) => `${J(c.minutes)} for ${c.party}`).join(", ");
425
465
  r.push({
426
466
  label: "Large parties",
427
- value: `${P(a.length, "party", "parties")}, ${P(s, "guest")}`,
428
- detail: `${ne(t, n)}, ${c}${a.length > 2 ? ` and ${a.length - 2} more` : ""}`
467
+ value: `${A(s.length, "party", "parties")}, ${A(a, "guest")}`,
468
+ detail: `${ae(t, n)}, ${l}${s.length > 2 ? ` and ${s.length - 2} more` : ""}`
429
469
  });
430
470
  }
431
- return r.push(Me("VIP", "VIPs", e.filter((s) => s.vip), t, n)), r.push(Me("Club prospect", "Club prospects", e.filter((s) => s.prospect), t, n)), r.filter((s) => s !== null);
471
+ return r.push(Re("VIP", "VIPs", e.filter((a) => a.vip), t, n)), r.push(Re("Club prospect", "Club prospects", e.filter((a) => a.prospect), t, n)), r.filter((a) => a !== null);
432
472
  }
433
- function Vn(e, t, n) {
434
- var l;
473
+ function rr(e, t, n) {
474
+ var c;
435
475
  const r = /* @__PURE__ */ new Map();
436
476
  for (const d of e) {
437
- const m = Math.floor(d.minutes / 30) * 30, S = (l = r.get(m)) != null ? l : { parties: 0, guests: 0 };
438
- r.set(m, { parties: S.parties + 1, guests: S.guests + d.party });
477
+ const m = Math.floor(d.minutes / 30) * 30, M = (c = r.get(m)) != null ? c : { parties: 0, guests: 0 };
478
+ r.set(m, { parties: M.parties + 1, guests: M.guests + d.party });
439
479
  }
440
- const a = Array.from(r.entries()).sort((d, m) => m[1].guests - d[1].guests || m[1].parties - d[1].parties || d[0] - m[0])[0];
441
- if (!a) return null;
442
- const [s, c] = a;
480
+ const s = Array.from(r.entries()).sort((d, m) => m[1].guests - d[1].guests || m[1].parties - d[1].parties || d[0] - m[0])[0];
481
+ if (!s) return null;
482
+ const [a, l] = s;
443
483
  return {
444
484
  label: "Busiest half hour",
445
- value: `${se(s)} to ${se(s + 30)}`,
446
- detail: `${ne(t, n)}, ${P(c.parties, "party", "parties")}, ${P(c.guests, "guest")}`
485
+ value: `${J(a)} to ${J(a + 30)}`,
486
+ detail: `${ae(t, n)}, ${A(l.parties, "party", "parties")}, ${A(l.guests, "guest")}`
447
487
  };
448
488
  }
449
- function Gn(e, t, n, r) {
450
- const a = { reservations: e.length, guests: e.reduce((m, S) => m + S.party, 0) };
451
- if (!e.length) return { ...a, message: "No reservations on this day", facts: [] };
452
- const s = Pe(t, n);
453
- if (s === "past") return { ...a, message: "This day has passed", facts: [] };
454
- const { upcoming: c, earlier: l } = Re(e, s, r);
455
- if (!c.length) return { ...a, message: "No more arrivals today", facts: [] };
456
- if (l.length) {
457
- const m = c[0];
489
+ function ar(e, t, n, r) {
490
+ const s = { reservations: e.length, guests: e.reduce((m, M) => m + M.party, 0) };
491
+ if (!e.length) return { ...s, message: "No reservations on this day", facts: [] };
492
+ const a = Ve(t, n);
493
+ if (a === "past") return { ...s, message: "This day has passed", facts: [] };
494
+ const { upcoming: l, earlier: c } = sn(e, a, r);
495
+ if (!l.length) return { ...s, message: "No more arrivals today", facts: [] };
496
+ if (c.length) {
497
+ const m = l[0];
458
498
  return {
459
- ...a,
499
+ ...s,
460
500
  message: null,
461
501
  facts: [
462
- { label: "Still to arrive", value: `${c.length} of ${e.length}` },
463
- { label: "Next arrival", value: fe(t, m.minutes, n), detail: De(m.minutes - r) },
464
- ...Lt(c, t, n)
502
+ { label: "Still to arrive", value: `${l.length} of ${e.length}` },
503
+ { label: "Next arrival", value: we(t, m.minutes, n), detail: Ge(m.minutes - r) },
504
+ ...Ut(l, t, n)
465
505
  ]
466
506
  };
467
507
  }
468
- const d = Lt(c, t, n);
508
+ const d = Ut(l, t, n);
469
509
  if (!d.length) {
470
- const m = Vn(c, t, n);
510
+ const m = rr(l, t, n);
471
511
  m && d.push(m);
472
512
  }
473
- return { ...a, message: null, facts: d };
513
+ return { ...s, message: null, facts: d };
474
514
  }
475
- function jn(e) {
515
+ function sr(e) {
476
516
  return new Set(e.map((n) => n.source)).size === 1 ? e[0].source : null;
477
517
  }
478
- const qe = { commerce7: "Commerce7", tock: "Tock" }, Fn = "Load Guest Prep day";
479
- function Zn(e) {
518
+ const Fe = { commerce7: "Commerce7", tock: "Tock" }, ir = "Load Guest Prep day";
519
+ function or(e) {
480
520
  var n;
481
521
  const t = ((n = e.wineryName) == null ? void 0 : n.trim()) || "this winery";
482
522
  return [
@@ -489,30 +529,30 @@ function Zn(e) {
489
529
  "Do not use exports or invent guests."
490
530
  ].join(" ");
491
531
  }
492
- const Bn = "0.1.0", ce = (e, t) => String(e != null ? e : "").replace(/\s+/g, " ").trim().slice(0, t);
493
- function Hn(e = {}, t = []) {
494
- var n, r, a, s, c, l;
532
+ const lr = "0.1.2", fe = (e, t) => String(e != null ? e : "").replace(/\s+/g, " ").trim().slice(0, t);
533
+ function cr(e = {}, t = []) {
534
+ var n, r, s, a, l, c;
495
535
  return {
496
- packageVersion: Bn,
497
- hiddenSections: ((n = e.hide) != null ? n : []).slice(0, 20).map((d) => ce(d, 40)),
536
+ packageVersion: lr,
537
+ hiddenSections: ((n = e.hide) != null ? n : []).slice(0, 20).map((d) => fe(d, 40)),
498
538
  // Guest Prep has one view and no reordering.
499
539
  reorderedViews: [],
500
- renamedSections: Object.keys((r = e.labels) != null ? r : {}).slice(0, 20).map((d) => ce(d, 40)),
501
- themeChanged: Object.keys((a = e.theme) != null ? a : {}).length + Object.keys((s = e.themeDark) != null ? s : {}).length > 0,
502
- fontsChanged: !!((c = e.fonts) != null && c.display || (l = e.fonts) != null && l.body),
540
+ renamedSections: Object.keys((r = e.labels) != null ? r : {}).slice(0, 20).map((d) => fe(d, 40)),
541
+ themeChanged: Object.keys((s = e.theme) != null ? s : {}).length + Object.keys((a = e.themeDark) != null ? a : {}).length > 0,
542
+ fontsChanged: !!((l = e.fonts) != null && l.display || (c = e.fonts) != null && c.body),
503
543
  titleChanged: !!e.title,
504
544
  customCards: t.slice(0, 10).map((d) => {
505
545
  var m;
506
- return { title: ce(d.title, 80), purpose: ce(d.purpose, 160), view: ce((m = d.after) != null ? m : "page", 20) };
546
+ return { title: fe(d.title, 80), purpose: fe(d.purpose, 160), view: fe((m = d.after) != null ? m : "page", 20) };
507
547
  })
508
548
  };
509
549
  }
510
- const zt = "guest-prep.tenant", Pt = (e) => `guest-prep:${e}`;
511
- function Yn() {
550
+ const jt = "guest-prep.tenant", Gt = (e) => `guest-prep:${e}`;
551
+ function ur() {
512
552
  const e = globalThis.storage;
513
553
  return e && typeof e.get == "function" && typeof e.set == "function" ? e : null;
514
554
  }
515
- function Kn() {
555
+ function dr() {
516
556
  try {
517
557
  const e = globalThis.localStorage, t = "__nv_probe__";
518
558
  return e.setItem(t, "1"), e.removeItem(t), e;
@@ -520,29 +560,29 @@ function Kn() {
520
560
  return null;
521
561
  }
522
562
  }
523
- function Wn(e) {
563
+ function pr(e) {
524
564
  return typeof e == "string" ? e : e && typeof e == "object" && typeof e.value == "string" ? e.value : null;
525
565
  }
526
- function Jn(e) {
566
+ function gr(e) {
527
567
  if (e) return { adapter: e, mode: "artifact" };
528
- const t = Yn();
568
+ const t = ur();
529
569
  if (t)
530
570
  return {
531
571
  mode: "artifact",
532
572
  adapter: {
533
- get: async (r, a) => Wn(await t.get(r, a)),
534
- set: async (r, a, s) => {
535
- await t.set(r, a, s);
573
+ get: async (r, s) => pr(await t.get(r, s)),
574
+ set: async (r, s, a) => {
575
+ await t.set(r, s, a);
536
576
  }
537
577
  }
538
578
  };
539
- const n = Kn();
579
+ const n = dr();
540
580
  return n ? {
541
581
  mode: "browser",
542
- adapter: { get: async (r) => n.getItem(r), set: async (r, a) => n.setItem(r, a) }
582
+ adapter: { get: async (r) => n.getItem(r), set: async (r, s) => n.setItem(r, s) }
543
583
  } : { adapter: null, mode: "none" };
544
584
  }
545
- async function It(e, t) {
585
+ async function Ft(e, t) {
546
586
  if (!e) return null;
547
587
  try {
548
588
  return await e.get(t, !1);
@@ -550,14 +590,14 @@ async function It(e, t) {
550
590
  return null;
551
591
  }
552
592
  }
553
- async function Ot(e, t, n) {
593
+ async function Zt(e, t, n) {
554
594
  if (e)
555
595
  try {
556
596
  await e.set(t, n, !1);
557
597
  } catch {
558
598
  }
559
599
  }
560
- function Qn(e) {
600
+ function fr(e) {
561
601
  if (!e) return null;
562
602
  try {
563
603
  const t = JSON.parse(e);
@@ -566,7 +606,7 @@ function Qn(e) {
566
606
  return null;
567
607
  }
568
608
  }
569
- const Xn = {
609
+ const mr = {
570
610
  "surface-base": "#f7f5f1",
571
611
  "surface-subtle": "#f2efea",
572
612
  "surface-raised": "#ffffff",
@@ -584,7 +624,7 @@ const Xn = {
584
624
  "status-warning-bg": "#fff7e7",
585
625
  "font-display": "'Newsreader', Georgia, serif",
586
626
  "font-body": "'Be Vietnam Pro', system-ui, sans-serif"
587
- }, er = {
627
+ }, hr = {
588
628
  "surface-base": "#171614",
589
629
  "surface-subtle": "#24211f",
590
630
  "surface-raised": "#34302d",
@@ -600,18 +640,18 @@ const Xn = {
600
640
  "focus-ring-color": "#8cd0a0",
601
641
  "status-warning": "#f0c36a",
602
642
  "status-warning-bg": "rgba(240,195,106,.16)"
603
- }, tr = /^[a-z][a-z0-9-]{0,40}$/, nr = /^[^;{}<>\\]{1,120}$/;
604
- function Dt(e) {
605
- return Object.entries(e).filter(([t, n]) => tr.test(t) && typeof n == "string" && nr.test(n)).map(([t, n]) => `--${t}:${n};`).join("");
643
+ }, yr = /^[a-z][a-z0-9-]{0,40}$/, br = /^[^;{}<>\\]{1,120}$/;
644
+ function Bt(e) {
645
+ return Object.entries(e).filter(([t, n]) => yr.test(t) && typeof n == "string" && br.test(n)).map(([t, n]) => `--${t}:${n};`).join("");
606
646
  }
607
- function rr(e) {
647
+ function vr(e) {
608
648
  return `https://fonts.googleapis.com/css2?${e.map((n) => `family=${encodeURIComponent(n).replace(/%20/g, "+")}:wght@300;400;500;600`).join("&")}&display=swap`;
609
649
  }
610
- function ar(e = {}, t = {}) {
611
- const n = Dt({ ...Xn, ...e }), r = Dt({ ...er, ...t });
650
+ function xr(e = {}, t = {}) {
651
+ const n = Bt({ ...mr, ...e }), r = Bt({ ...hr, ...t });
612
652
  return `:root,.nvgp{${n}}@media (prefers-color-scheme: dark){:root,.nvgp{${r}}}`;
613
653
  }
614
- const Ce = "120ms cubic-bezier(0.2,0,0.2,1)", sr = `
654
+ const me = "120ms cubic-bezier(0.2,0,0.2,1)", wr = `
615
655
  html,body{margin:0;background:var(--surface-base,#f7f5f1)}
616
656
  .nvgp{background:var(--surface-base);color:var(--text-primary);font:16px/1.5 var(--font-body);-webkit-font-smoothing:antialiased;min-height:100vh;overflow-x:clip}
617
657
  .nvgp *{box-sizing:border-box}
@@ -632,7 +672,7 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
632
672
  .nvgp .storage-note{font-size:13px;color:var(--text-tertiary);margin:0 0 8px}
633
673
  .nvgp .daybar{position:sticky;top:0;z-index:20;background:var(--surface-base);display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;padding:12px 0;padding-top:max(12px,env(safe-area-inset-top))}
634
674
  .nvgp .day-wrap{position:relative;max-width:100%}
635
- .nvgp .day-button{display:inline-flex;align-items:center;gap:8px;min-height:40px;max-width:100%;padding:0 14px;border:1px solid var(--border-default);border-radius:10px;background:var(--surface-raised);font-size:15px;font-weight:600;cursor:pointer;transition:border-color ${Ce}}
675
+ .nvgp .day-button{display:inline-flex;align-items:center;gap:8px;min-height:40px;max-width:100%;padding:0 14px;border:1px solid var(--border-default);border-radius:10px;background:var(--surface-raised);font-size:15px;font-weight:600;cursor:pointer;transition:border-color ${me}}
636
676
  .nvgp .day-button:hover{border-color:var(--border-strong)}
637
677
  .nvgp .day-button svg{flex:none;color:var(--text-secondary)}
638
678
  .nvgp .day-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@@ -665,12 +705,34 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
665
705
  .nvgp .fact-detail{font-size:13px;color:var(--text-secondary);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
666
706
  .nvgp .fact-countdown .fact-detail,.nvgp .soon{color:var(--action-primary-bg);font-weight:500}
667
707
  .nvgp .layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);gap:16px;align-items:start}
668
- .nvgp .list-card{padding:0;overflow:hidden}
708
+ .nvgp .list-card{padding:0;overflow:clip}
669
709
  .nvgp .card-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:16px 24px;border-bottom:1px solid var(--border-subtle)}
670
710
  .nvgp h2{font:300 22px/1.3 var(--font-display);margin:0}
671
711
  .nvgp .card-aside{font-size:13px;color:var(--text-secondary)}
672
712
  .nvgp .rows{list-style:none;margin:0;padding:0}
673
- .nvgp .row{display:grid;grid-template-columns:88px minmax(0,1fr) auto;gap:12px;width:100%;padding:12px 24px;border:0;border-bottom:1px solid var(--border-subtle);border-left:3px solid transparent;background:none;text-align:left;cursor:pointer;transition:background ${Ce}}
713
+ .nvgp .finder{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;padding:12px 24px;border-bottom:1px solid var(--border-subtle)}
714
+ .nvgp .search{display:flex;align-items:center;gap:8px;flex:1 1 200px;min-width:0;min-height:40px;padding:0 12px;border:1px solid var(--border-default);border-radius:10px;background:var(--surface-raised);color:var(--text-secondary)}
715
+ .nvgp .search:focus-within{outline:2px solid var(--focus-ring-color);outline-offset:2px}
716
+ .nvgp .search-input{flex:1;min-width:0;border:0;background:none;color:var(--text-primary);font:inherit;font-size:15px;outline:none}
717
+ .nvgp .filters{display:flex;flex-wrap:wrap;gap:8px}
718
+ .nvgp .filter-chip{display:inline-flex;align-items:center;min-height:32px;padding:0 12px;border:1px solid var(--border-default);border-radius:999px;background:var(--surface-raised);color:var(--text-primary);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background ${me},border-color ${me}}
719
+ .nvgp .filter-chip:hover{border-color:var(--text-tertiary)}
720
+ .nvgp .filter-chip[aria-pressed="true"]{background:var(--action-primary-bg);border-color:var(--action-primary-bg);color:var(--action-primary-fg)}
721
+ .nvgp .filter-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 12px;padding:8px 24px;font-size:14px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)}
722
+ .nvgp .link-button{min-height:32px;padding:0;border:0;background:none;color:var(--action-primary-bg);font:inherit;font-weight:500;cursor:pointer}
723
+ .nvgp .seatings{list-style:none;margin:0;padding:0}
724
+ .nvgp .seat-head{position:sticky;top:var(--seat-top,0px);z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:40px;padding:8px 24px;border:0;border-bottom:1px solid var(--border-subtle);background:var(--surface-raised);color:var(--text-primary);font:inherit;text-align:left}
725
+ .nvgp .seating:not(:first-child) .seat-head{border-top:1px solid var(--border-subtle)}
726
+ .nvgp .seat-label{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 12px;min-width:0}
727
+ .nvgp .seat-time{margin:0;font-size:14px;font-weight:600;font-variant-numeric:tabular-nums}
728
+ .nvgp .seat-counts{font-size:13px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
729
+ .nvgp .seat-marker{flex:none;padding:0 8px;border-radius:999px;font-size:12px;font-weight:600;line-height:20px}
730
+ .nvgp .seat-now{background:var(--action-primary-bg);color:var(--action-primary-fg)}
731
+ .nvgp .seat-next{border:1px solid var(--action-primary-bg);color:var(--action-primary-bg)}
732
+ .nvgp .seat-toggle{justify-content:flex-start;background:var(--surface-subtle);color:var(--text-secondary);cursor:pointer}
733
+ .nvgp .seat-toggle .seat-time{font-weight:500}
734
+ .nvgp .seat-chevron{display:inline-flex;flex:none}
735
+ .nvgp .row{display:grid;grid-template-columns:88px minmax(0,1fr) auto;gap:12px;width:100%;padding:12px 24px;border:0;border-bottom:1px solid var(--border-subtle);border-left:3px solid transparent;background:none;text-align:left;cursor:pointer;transition:background ${me}}
674
736
  .nvgp .row:hover{background:var(--surface-subtle)}
675
737
  .nvgp .row[aria-current="true"]{border-left-color:var(--action-primary-bg);background:var(--surface-subtle)}
676
738
  .nvgp .row-time{font-weight:600;font-variant-numeric:tabular-nums}
@@ -691,7 +753,7 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
691
753
  .nvgp .empty-title{font:300 22px/1.3 var(--font-display);color:var(--text-primary);margin:0 0 8px}
692
754
  .nvgp .note{font-size:14px;color:var(--text-secondary);margin:8px 0 0}
693
755
  .nvgp .problem{color:var(--status-warning)}
694
- .nvgp .button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 16px;border:0;border-radius:8px;background:var(--action-primary-bg);color:var(--action-primary-fg);font-weight:500;cursor:pointer;transition:background ${Ce}}
756
+ .nvgp .button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 16px;border:0;border-radius:8px;background:var(--action-primary-bg);color:var(--action-primary-fg);font-weight:500;cursor:pointer;transition:background ${me}}
695
757
  .nvgp .button:hover{background:var(--action-primary-hover)}
696
758
  .nvgp .button:disabled{opacity:.55;cursor:default}
697
759
  .nvgp .button-quiet{background:transparent;color:var(--text-primary);border:1px solid var(--border-strong)}
@@ -714,11 +776,21 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
714
776
  .nvgp .tile-warning{background:var(--status-warning-bg);color:var(--status-warning)}
715
777
  .nvgp .psec-facts{display:grid;gap:12px}
716
778
  .nvgp .fact-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
779
+ .nvgp .fact-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
717
780
  .nvgp .soft{margin:4px 0 0;padding:8px 12px;border-radius:8px;background:var(--surface-subtle);font-size:14px;overflow-wrap:anywhere}
718
781
  .nvgp .soft-when{display:block;font-size:12px;color:var(--text-tertiary);margin-top:2px}
719
- .nvgp .bought{list-style:none;margin:4px 0 0;padding:4px 12px;border-radius:8px;background:var(--surface-subtle);font-size:14px}
720
- .nvgp .bought li{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-top:1px solid var(--border-subtle)}
721
- .nvgp .bought li:first-child{border-top:0}
782
+ .nvgp .psec-source{margin:-8px 0 12px 36px;font-size:13px;color:var(--text-secondary)}
783
+ .nvgp .visit{margin-top:4px;padding:10px 12px;border-radius:8px;background:var(--surface-subtle);font-size:14px;overflow-wrap:anywhere}
784
+ .nvgp .visit-title{margin:0;font-weight:500}
785
+ .nvgp .visit-muted{margin:2px 0 0;font-size:13px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
786
+ .nvgp .visit-bought .visit-muted{margin:0}
787
+ .nvgp .visit-divider{margin:10px 0;border:0;border-top:1px solid var(--border-default)}
788
+ .nvgp .visit-note{margin:0}
789
+ .nvgp .visit-note+.visit-note{margin-top:6px;padding-top:6px;border-top:1px solid var(--border-default)}
790
+ .nvgp .bought{list-style:none;margin:0;padding:0}
791
+ .nvgp .bought li{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-top:1px solid var(--border-default)}
792
+ .nvgp .bought li:first-child{border-top:0;padding-top:0}
793
+ .nvgp .bought li:last-child{padding-bottom:0}
722
794
  .nvgp .bought .qty{color:var(--text-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap}
723
795
  .nvgp .bought .total{font-weight:500}
724
796
  .nvgp .research{margin-top:8px}
@@ -752,14 +824,20 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
752
824
  .nvgp .card-head,.nvgp .panel-head{padding:12px 16px}
753
825
  .nvgp .row{grid-template-columns:72px minmax(0,1fr) auto;padding:12px 16px;min-height:44px}
754
826
  .nvgp .earlier-head{padding:8px 16px}
827
+ .nvgp .finder{padding:12px 16px}
828
+ .nvgp .search,.nvgp .filter-chip,.nvgp .link-button,.nvgp .seat-head{min-height:44px}
829
+ .nvgp .filter-status{padding:8px 16px}
830
+ .nvgp .seat-head{padding:8px 16px}
755
831
  .nvgp .panel-body{padding:0 16px 24px}
756
832
  .nvgp .fact-row{grid-template-columns:repeat(2,minmax(0,1fr))}
833
+ .nvgp .fact-grid{grid-template-columns:minmax(0,1fr)}
757
834
  .nvgp .custom-card{padding:12px 16px}
758
835
  }
759
836
  @media (prefers-reduced-motion: reduce){.nvgp *{transition-duration:0ms!important;animation:none!important}}
760
- `, or = ["summary", "guestList"], Kt = ["reservation", "talkAbout", "relationship", "headsUp", "personalNotes"], zr = [...or, ...Kt], ye = {
837
+ `, kr = ["summary", "guestList"], on = ["reservation", "talkAbout", "newVintageProfile", "relationship", "headsUp", "personalNotes"], ea = [...kr, ...on], he = {
761
838
  timeZone: "America/Los_Angeles",
762
839
  largeParty: 10,
840
+ seatingGapMinutes: 45,
763
841
  tagRules: {
764
842
  interests: ["^(?:client\\s+)?interest(?:ed)?(?:\\s+in)?\\s*[-–—:]\\s*(.+)$"],
765
843
  vip: ["\\bvip\\b"],
@@ -767,23 +845,23 @@ html,body{margin:0;background:var(--surface-base,#f7f5f1)}
767
845
  hide: ["^\\*+\\s*test\\s*\\*+$", "^test\\b"]
768
846
  }
769
847
  };
770
- function o(e, t = null, ...n) {
848
+ function i(e, t = null, ...n) {
771
849
  const r = document.createElement(e);
772
- for (const [a, s] of Object.entries(t != null ? t : {}))
773
- s == null || s === !1 || (typeof s == "function" ? r.addEventListener(a.replace(/^on/, "").toLowerCase(), s) : s === !0 ? r.setAttribute(a, "") : r.setAttribute(a, String(s)));
774
- return Wt(r, n), r;
850
+ for (const [s, a] of Object.entries(t != null ? t : {}))
851
+ a == null || a === !1 || (typeof a == "function" ? r.addEventListener(s.replace(/^on/, "").toLowerCase(), a) : a === !0 ? r.setAttribute(s, "") : r.setAttribute(s, String(a)));
852
+ return ln(r, n), r;
775
853
  }
776
- function Wt(e, t) {
854
+ function ln(e, t) {
777
855
  for (const n of t)
778
- n == null || n === !1 || (Array.isArray(n) ? Wt(e, n) : e.append(n instanceof Node ? n : String(n)));
856
+ n == null || n === !1 || (Array.isArray(n) ? ln(e, n) : e.append(n instanceof Node ? n : String(n)));
779
857
  }
780
- const ir = "http://www.w3.org/2000/svg";
781
- function Rt(e, t = {}, ...n) {
782
- const r = document.createElementNS(ir, e);
783
- for (const [a, s] of Object.entries(t)) r.setAttribute(a, String(s));
858
+ const Sr = "http://www.w3.org/2000/svg";
859
+ function Ht(e, t = {}, ...n) {
860
+ const r = document.createElementNS(Sr, e);
861
+ for (const [s, a] of Object.entries(t)) r.setAttribute(s, String(a));
784
862
  return r.append(...n), r;
785
863
  }
786
- const lr = {
864
+ const $r = {
787
865
  "chevron-left": ["M15 18l-6-6 6-6"],
788
866
  "chevron-right": ["M9 18l6-6-6-6"],
789
867
  "chevron-down": ["M6 9l6 6 6-6"],
@@ -792,173 +870,179 @@ const lr = {
792
870
  heart: ["M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7z"],
793
871
  "triangle-alert": ["M21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3z", "M12 9v4", "M12 17h.01"],
794
872
  "sticky-note": ["M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8z", "M15 3v4a2 2 0 0 0 2 2h4"],
873
+ wine: ["M8 22h8", "M7 10h10", "M12 15v7", "M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5z"],
874
+ search: ["M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0z", "M21 21l-4.3-4.3"],
795
875
  x: ["M18 6L6 18", "M6 6l12 12"],
796
876
  "refresh-cw": ["M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", "M21 3v5h-5", "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", "M8 16H3v5"]
797
877
  };
798
- function W(e, t = 16) {
878
+ function K(e, t = 16) {
799
879
  var n;
800
- return Rt(
880
+ return Ht(
801
881
  "svg",
802
882
  { width: t, height: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" },
803
- ...((n = lr[e]) != null ? n : []).map((r) => Rt("path", { d: r }))
883
+ ...((n = $r[e]) != null ? n : []).map((r) => Ht("path", { d: r }))
804
884
  );
805
885
  }
806
- function _(e, t = "note") {
807
- return o("p", { class: t }, e);
886
+ function P(e, t = "note") {
887
+ return i("p", { class: t }, e);
808
888
  }
809
- function w(e, t, n, r = "") {
810
- return o(
889
+ function S(e, t, n, r = "") {
890
+ return i(
811
891
  "div",
812
892
  { class: `fact${r ? ` ${r}` : ""}` },
813
- o("div", { class: "fact-label" }, e),
814
- o("div", { class: "fact-value" }, t),
815
- n ? o("div", { class: "fact-detail" }, n) : null
893
+ i("div", { class: "fact-label" }, e),
894
+ i("div", { class: "fact-value" }, t),
895
+ n ? i("div", { class: "fact-detail" }, n) : null
816
896
  );
817
897
  }
818
- function xe(e, t = "neutral") {
819
- return o("div", { class: "chips" }, e.map((n) => o("span", { class: `chip chip-${t}` }, n)));
898
+ function Te(e, t = "neutral") {
899
+ return i("div", { class: "chips" }, e.map((n) => i("span", { class: `chip chip-${t}` }, n)));
820
900
  }
821
- function Jt(e) {
822
- return o("span", { class: `badge${e === "VIP" ? " badge-vip" : ""}` }, e);
901
+ function cn(e) {
902
+ return i("span", { class: `badge${e === "VIP" ? " badge-vip" : ""}` }, e);
823
903
  }
824
- function Qt(e) {
825
- return Number(j(`${we(e, 1)}-01`, -1).slice(8, 10));
904
+ function un(e) {
905
+ return Number(W(`${Ne(e, 1)}-01`, -1).slice(8, 10));
826
906
  }
827
- function qt(e, t) {
828
- const n = we(e.slice(0, 7), t);
829
- return `${n}-${String(Math.min(Number(e.slice(8, 10)), Qt(n))).padStart(2, "0")}`;
907
+ function Yt(e, t) {
908
+ const n = Ne(e.slice(0, 7), t);
909
+ return `${n}-${String(Math.min(Number(e.slice(8, 10)), un(n))).padStart(2, "0")}`;
830
910
  }
831
- function cr(e) {
832
- const t = `${e}-01`, n = Array.from({ length: pe(t) }, () => null);
833
- for (let r = 0; r < Qt(e); r += 1) n.push(j(t, r));
911
+ function Tr(e) {
912
+ const t = `${e}-01`, n = Array.from({ length: ve(t) }, () => null);
913
+ for (let r = 0; r < un(e); r += 1) n.push(W(t, r));
834
914
  return n;
835
915
  }
836
- function ur(e, t) {
916
+ function Nr(e, t) {
837
917
  switch (t) {
838
918
  case "ArrowLeft":
839
- return j(e, -1);
919
+ return W(e, -1);
840
920
  case "ArrowRight":
841
- return j(e, 1);
921
+ return W(e, 1);
842
922
  case "ArrowUp":
843
- return j(e, -7);
923
+ return W(e, -7);
844
924
  case "ArrowDown":
845
- return j(e, 7);
925
+ return W(e, 7);
846
926
  case "PageUp":
847
- return qt(e, -1);
927
+ return Yt(e, -1);
848
928
  case "PageDown":
849
- return qt(e, 1);
929
+ return Yt(e, 1);
850
930
  case "Home":
851
- return j(e, -pe(e));
931
+ return W(e, -ve(e));
852
932
  case "End":
853
- return j(e, 6 - pe(e));
933
+ return W(e, 6 - ve(e));
854
934
  default:
855
935
  return null;
856
936
  }
857
937
  }
858
- function dr(e) {
859
- const { state: t } = e, n = cr(t.month).map((s, c) => {
860
- if (!s) return o("span", { "aria-hidden": "true", "data-blank": c });
861
- const l = s === t.focus;
862
- return o(
938
+ function Ar(e) {
939
+ const { state: t } = e, n = Tr(t.month).map((a, l) => {
940
+ if (!a) return i("span", { "aria-hidden": "true", "data-blank": l });
941
+ const c = a === t.focus;
942
+ return i(
863
943
  "button",
864
944
  {
865
945
  type: "button",
866
- class: `cal-day${s === e.today ? " is-today" : ""}`,
867
- "aria-label": Oe(s, e.today) + (s === e.today ? ", today" : ""),
868
- "aria-selected": s === e.selected ? "true" : "false",
869
- "aria-current": s === e.today ? "date" : null,
870
- tabindex: l ? 0 : -1,
871
- "data-day": s,
872
- "data-fid": l ? "cal-focus" : null,
873
- onclick: () => e.onPick(s)
946
+ class: `cal-day${a === e.today ? " is-today" : ""}`,
947
+ "aria-label": je(a, e.today) + (a === e.today ? ", today" : ""),
948
+ "aria-selected": a === e.selected ? "true" : "false",
949
+ "aria-current": a === e.today ? "date" : null,
950
+ tabindex: c ? 0 : -1,
951
+ "data-day": a,
952
+ "data-fid": c ? "cal-focus" : null,
953
+ onclick: () => e.onPick(a)
874
954
  },
875
- String(Number(s.slice(8, 10)))
955
+ String(Number(a.slice(8, 10)))
876
956
  );
877
- }), r = o(
957
+ }), r = i(
878
958
  "div",
879
- { class: "cal-grid", role: "group", "aria-label": $t(t.month) },
880
- Ie.map((s) => o("span", { class: "cal-dow", "aria-hidden": "true" }, s.slice(0, 2))),
959
+ { class: "cal-grid", role: "group", "aria-label": Pt(t.month) },
960
+ Ue.map((a) => i("span", { class: "cal-dow", "aria-hidden": "true" }, a.slice(0, 2))),
881
961
  n
882
962
  );
883
- r.addEventListener("keydown", (s) => {
884
- const c = s.key, l = ur(t.focus, c);
885
- l && (s.preventDefault(), e.onFocus(l));
963
+ r.addEventListener("keydown", (a) => {
964
+ const l = a.key, c = Nr(t.focus, l);
965
+ c && (a.preventDefault(), e.onFocus(c));
886
966
  });
887
- const a = o(
967
+ const s = i(
888
968
  "div",
889
969
  { class: "calendar", role: "dialog", "aria-label": "Choose a day" },
890
- o(
970
+ i(
891
971
  "div",
892
972
  { class: "cal-head" },
893
- o("button", { type: "button", class: "icon-button", "aria-label": "Previous month", onclick: () => e.onMonth(we(t.month, -1)) }, W("chevron-left")),
894
- o("span", { class: "cal-title", "aria-live": "polite" }, $t(t.month)),
895
- o("button", { type: "button", class: "icon-button", "aria-label": "Next month", onclick: () => e.onMonth(we(t.month, 1)) }, W("chevron-right"))
973
+ i("button", { type: "button", class: "icon-button", "aria-label": "Previous month", onclick: () => e.onMonth(Ne(t.month, -1)) }, K("chevron-left")),
974
+ i("span", { class: "cal-title", "aria-live": "polite" }, Pt(t.month)),
975
+ i("button", { type: "button", class: "icon-button", "aria-label": "Next month", onclick: () => e.onMonth(Ne(t.month, 1)) }, K("chevron-right"))
896
976
  ),
897
977
  r
898
978
  );
899
- return a.addEventListener("keydown", (s) => {
900
- s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), e.onClose());
901
- }), a;
979
+ return s.addEventListener("keydown", (a) => {
980
+ a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), e.onClose());
981
+ }), s;
902
982
  }
903
- const pr = "https://newvintage.ai/?utm_source=guest-prep&utm_medium=referral&utm_campaign=guest-prep&utm_content=season-bar-logo", gr = {
983
+ const Mr = "https://newvintage.ai/?utm_source=guest-prep&utm_medium=referral&utm_campaign=guest-prep&utm_content=season-bar-logo", _r = {
904
984
  summary: "Summary",
905
985
  guestList: "Everyone coming in",
906
986
  reservation: "Reservation",
907
987
  talkAbout: "Talk about",
988
+ newVintageProfile: "New Vintage profile",
908
989
  relationship: "Relationship",
909
990
  headsUp: "Heads-up",
910
991
  personalNotes: "Personal notes"
911
- }, fr = {
992
+ }, Cr = {
912
993
  reservation: "calendar",
913
994
  talkAbout: "message-circle",
995
+ newVintageProfile: "wine",
914
996
  relationship: "heart",
915
997
  headsUp: "triangle-alert",
916
998
  personalNotes: "sticky-note"
999
+ }, Wt = {
1000
+ newVintageProfile: "From New Vintage's analysis of their wine purchases."
917
1001
  };
918
- function Ue(e, t) {
919
- var r, a;
920
- const n = (a = (r = e.options.customize) == null ? void 0 : r.labels) == null ? void 0 : a[t];
921
- return typeof n == "string" && n.trim() ? n.trim() : gr[t];
1002
+ function Ze(e, t) {
1003
+ var r, s;
1004
+ const n = (s = (r = e.options.customize) == null ? void 0 : r.labels) == null ? void 0 : s[t];
1005
+ return typeof n == "string" && n.trim() ? n.trim() : _r[t];
922
1006
  }
923
- function Ve(e, t) {
1007
+ function Be(e, t) {
924
1008
  var n, r;
925
1009
  return ((r = (n = e.options.customize) == null ? void 0 : n.hide) != null ? r : []).includes(t);
926
1010
  }
927
- const mr = () => ke() === "claude";
928
- function hr(e) {
1011
+ const Er = () => Ae() === "claude";
1012
+ function zr(e) {
929
1013
  const t = e.dayState;
930
- let n = "idle", r, a = null;
931
- return t.status === "choose" ? r = "Choose a winery to load reservations" : t.status === "loading" ? r = "Loading reservations" : t.status === "unloaded" ? r = "This day isn't loaded yet" : t.status === "failed" ? (n = "problem", r = "This day couldn't load") : t.arrivals.length ? (n = "loaded", r = "Commerce7 reservations and Tock orders", a = "Commerce7 and Tock") : r = "No arrivals on this day", o(
1014
+ let n = "idle", r, s = null;
1015
+ return t.status === "choose" ? r = "Choose a winery to load reservations" : t.status === "loading" ? r = "Loading reservations" : t.status === "unloaded" ? r = "This day isn't loaded yet" : t.status === "failed" ? (n = "problem", r = "This day couldn't load") : t.arrivals.length ? (n = "loaded", r = "Commerce7 reservations and Tock orders", s = "Commerce7 and Tock") : r = "No arrivals on this day", i(
932
1016
  "div",
933
1017
  { class: `status status-${n}`, role: "status", "aria-live": "polite" },
934
- o("span", { class: "dot", "aria-hidden": "true" }),
935
- a ? [o("span", { class: "status-long" }, r), o("span", { class: "status-short", "aria-hidden": "true" }, a)] : o("span", null, r)
1018
+ i("span", { class: "dot", "aria-hidden": "true" }),
1019
+ s ? [i("span", { class: "status-long" }, r), i("span", { class: "status-short", "aria-hidden": "true" }, s)] : i("span", null, r)
936
1020
  );
937
1021
  }
938
- function yr(e, t) {
1022
+ function Pr(e, t) {
939
1023
  if (!e.wineries || e.wineries.length < 2) return null;
940
- const n = o(
1024
+ const n = i(
941
1025
  "select",
942
1026
  { id: "winery-picker", "data-fid": "winery-picker", onchange: (r) => t.chooseWinery(r.target.value) },
943
- o("option", { value: "", disabled: !0, selected: !e.tenantId }, "Choose a winery"),
944
- e.wineries.map((r) => o("option", { value: r.tenantId, selected: r.tenantId === e.tenantId }, r.name))
1027
+ i("option", { value: "", disabled: !0, selected: !e.tenantId }, "Choose a winery"),
1028
+ e.wineries.map((r) => i("option", { value: r.tenantId, selected: r.tenantId === e.tenantId }, r.name))
945
1029
  );
946
- return o("label", { class: "picker", for: "winery-picker" }, "Winery", n);
1030
+ return i("label", { class: "picker", for: "winery-picker" }, "Winery", n);
947
1031
  }
948
- function br(e, t) {
949
- return o(
1032
+ function Lr(e, t) {
1033
+ return i(
950
1034
  "header",
951
1035
  { class: "header" },
952
- o(
1036
+ i(
953
1037
  "a",
954
- { class: "logo", href: pr, target: "_blank", rel: "noopener", "aria-label": "New Vintage" },
955
- o("span", { class: "logo-mark", "aria-hidden": "true" }, "New Vintage")
1038
+ { class: "logo", href: Mr, target: "_blank", rel: "noopener", "aria-label": "New Vintage" },
1039
+ i("span", { class: "logo-mark", "aria-hidden": "true" }, "New Vintage")
956
1040
  ),
957
- o("div", { class: "heading" }, o("h1", null, e.title), hr(e), yr(e, t))
1041
+ i("div", { class: "heading" }, i("h1", null, e.title), zr(e), Pr(e, t))
958
1042
  );
959
1043
  }
960
- function vr(e, t) {
961
- const n = e.day === e.today ? "Today" : e.day === j(e.today, 1) ? "Tomorrow" : null, r = o(
1044
+ function Ir(e, t) {
1045
+ const n = e.day === e.today ? "Today" : e.day === W(e.today, 1) ? "Tomorrow" : null, r = i(
962
1046
  "button",
963
1047
  {
964
1048
  type: "button",
@@ -968,267 +1052,366 @@ function vr(e, t) {
968
1052
  "aria-expanded": e.calendar.open ? "true" : "false",
969
1053
  onclick: () => t.toggleCalendar()
970
1054
  },
971
- W("calendar", 18),
972
- o("span", { class: "day-label" }, Oe(e.day, e.today)),
973
- n ? o("span", { class: "day-relative" }, n) : null,
974
- W("chevron-down", 16)
975
- ), a = e.calendar.open ? dr({ state: e.calendar, selected: e.day, today: e.today, onPick: t.pickDay, onFocus: t.focusDay, onMonth: t.showMonth, onClose: t.closeCalendar }) : null;
976
- return o(
1055
+ K("calendar", 18),
1056
+ i("span", { class: "day-label" }, je(e.day, e.today)),
1057
+ n ? i("span", { class: "day-relative" }, n) : null,
1058
+ K("chevron-down", 16)
1059
+ ), s = e.calendar.open ? Ar({ state: e.calendar, selected: e.day, today: e.today, onPick: t.pickDay, onFocus: t.focusDay, onMonth: t.showMonth, onClose: t.closeCalendar }) : null;
1060
+ return i(
977
1061
  "div",
978
1062
  { class: "daybar" },
979
- o("div", { class: "day-wrap" }, r, a),
980
- e.dayNote ? o("span", { class: `day-note${e.dayNote.problem ? " problem" : ""}`, "aria-live": "polite" }, e.dayNote.text) : null
1063
+ i("div", { class: "day-wrap" }, r, s),
1064
+ e.dayNote ? i("span", { class: `day-note${e.dayNote.problem ? " problem" : ""}`, "aria-live": "polite" }, e.dayNote.text) : null
981
1065
  );
982
1066
  }
983
- function xr(e) {
984
- if (e.dayState.status !== "ready" || Ve(e, "summary")) return null;
985
- const t = Gn(e.dayState.arrivals, e.day, e.today, e.nowMinutes), n = (r, a, s) => o("div", { class: "number" }, o("div", { class: "number-value" }, String(r)), o("div", { class: "number-label" }, r === 1 ? a : s));
986
- return o(
1067
+ function Or(e) {
1068
+ if (e.dayState.status !== "ready" || Be(e, "summary")) return null;
1069
+ const t = ar(e.dayState.arrivals, e.day, e.today, e.nowMinutes), n = (r, s, a) => i("div", { class: "number" }, i("div", { class: "number-value" }, String(r)), i("div", { class: "number-label" }, r === 1 ? s : a));
1070
+ return i(
987
1071
  "section",
988
- { class: "card summary", "data-section": "summary", "aria-label": Ue(e, "summary") },
989
- o("div", { class: "numbers" }, n(t.reservations, "Reservation", "Reservations"), n(t.guests, "Guest", "Guests")),
990
- o(
1072
+ { class: "card summary", "data-section": "summary", "aria-label": Ze(e, "summary") },
1073
+ i("div", { class: "numbers" }, n(t.reservations, "Reservation", "Reservations"), n(t.guests, "Guest", "Guests")),
1074
+ i(
991
1075
  "div",
992
1076
  { class: "facts" },
993
- t.message ? o("div", { class: "summary-message" }, t.message) : t.facts.map((r) => w(r.label, r.value, r.detail, r.label === "Next arrival" ? "fact-countdown" : ""))
1077
+ t.message ? i("div", { class: "summary-message" }, t.message) : t.facts.map((r) => S(r.label, r.value, r.detail, r.label === "Next arrival" ? "fact-countdown" : ""))
994
1078
  ),
995
- w("Now", se(e.nowMinutes), ne(e.today, e.today), "now")
1079
+ S("Now", J(e.nowMinutes), ae(e.today, e.today), "now")
996
1080
  );
997
1081
  }
998
- function wr(e) {
1082
+ function Rr(e) {
999
1083
  const t = [];
1000
- return e.vip && t.push("VIP"), e.clubMember && t.push("Club member"), e.prospect && t.push("Club prospect"), e.atRisk && t.push("Membership at risk"), e.visit === "first" && t.push("First visit"), t.map(Jt);
1084
+ return e.vip && t.push("VIP"), e.clubMember && t.push("Club member"), e.prospect && t.push("Club prospect"), e.atRisk && t.push("Membership at risk"), e.visit === "first" && t.push("First visit"), e.partlyRefunded && t.push("Partly refunded"), t.map(cn);
1001
1085
  }
1002
- function Ut(e, t, n, r, a) {
1003
- var l;
1004
- const s = a ? null : qn(n, e.kind, e.nowMinutes), c = [n.experience, r ? qe[n.source] : null].filter(Boolean).join(", ");
1005
- return o(
1086
+ function qr(e, t, n, r, s) {
1087
+ var c;
1088
+ const a = s ? null : tr(n, e.kind, e.nowMinutes), l = [n.experience, r ? Fe[n.source] : null].filter(Boolean).join(", ");
1089
+ return i(
1006
1090
  "li",
1007
1091
  null,
1008
- o(
1092
+ i(
1009
1093
  "button",
1010
1094
  {
1011
1095
  type: "button",
1012
- class: `row${a ? " row-earlier" : ""}`,
1096
+ class: `row${s ? " row-earlier" : ""}`,
1013
1097
  "data-key": n.key,
1014
1098
  "data-fid": `row-${n.key}`,
1015
- "aria-current": ((l = e.selected) == null ? void 0 : l.key) === n.key ? "true" : "false",
1099
+ "aria-current": ((c = e.selected) == null ? void 0 : c.key) === n.key ? "true" : "false",
1016
1100
  onclick: () => t.select(n.key)
1017
1101
  },
1018
- o(
1102
+ i(
1019
1103
  "span",
1020
1104
  { class: "row-when" },
1021
- o("span", { class: "row-time" }, se(n.minutes)),
1022
- o("span", { class: "row-date", style: "display:block" }, ne(e.day, e.today)),
1023
- s ? o("span", { class: "row-soon soon", style: "display:block" }, s) : null
1105
+ i("span", { class: "row-time" }, J(n.minutes)),
1106
+ i("span", { class: "row-date", style: "display:block" }, ae(e.day, e.today)),
1107
+ a ? i("span", { class: "row-soon soon", style: "display:block" }, a) : null
1024
1108
  ),
1025
- o(
1109
+ i(
1026
1110
  "span",
1027
1111
  { style: "min-width:0" },
1028
- o("span", { class: "row-name" }, o("span", null, ge(n)), wr(n)),
1029
- c ? o("span", { class: "row-experience", style: "display:block" }, c) : null
1112
+ i("span", { class: "row-name" }, i("span", null, xe(n)), Rr(n)),
1113
+ l ? i("span", { class: "row-experience", style: "display:block" }, l) : null
1030
1114
  ),
1031
- o("span", { class: "row-party" }, P(n.party, "guest"))
1115
+ i("span", { class: "row-party" }, A(n.party, "guest"))
1032
1116
  )
1033
1117
  );
1034
1118
  }
1035
- function kr() {
1036
- return o(
1119
+ function Dr() {
1120
+ return i(
1037
1121
  "div",
1038
1122
  { "aria-hidden": "true" },
1039
- [0, 1, 2, 3].map(() => o("div", { class: "skeleton-row" }, o("span", { class: "skel", style: "flex:0 0 72px" }), o("span", { class: "skel", style: "flex:2" }), o("span", { class: "skel", style: "flex:0 0 56px" })))
1123
+ [0, 1, 2, 3].map(() => i("div", { class: "skeleton-row" }, i("span", { class: "skel", style: "flex:0 0 72px" }), i("span", { class: "skel", style: "flex:2" }), i("span", { class: "skel", style: "flex:0 0 56px" })))
1040
1124
  );
1041
1125
  }
1042
- function Sr(e) {
1043
- const t = e.request, n = Oe(e.day, e.today);
1044
- return (t == null ? void 0 : t.kind) === "sent" ? _(`Request sent. You may need to finish sending it in the chat. The briefing updates after the assistant loads ${n}.`) : (t == null ? void 0 : t.kind) === "copied" ? _(`Request copied. Paste it into this chat to load ${n}.`) : (t == null ? void 0 : t.kind) === "manual" ? o(
1126
+ function Vr(e) {
1127
+ const t = e.request, n = je(e.day, e.today);
1128
+ return (t == null ? void 0 : t.kind) === "sent" ? P(`Request sent. You may need to finish sending it in the chat. The briefing updates after the assistant loads ${n}.`) : (t == null ? void 0 : t.kind) === "copied" ? P(`Request copied. Paste it into this chat to load ${n}.`) : (t == null ? void 0 : t.kind) === "manual" ? i(
1045
1129
  "div",
1046
1130
  null,
1047
- _(`Copy this request into the chat to load ${n}.`),
1048
- o("textarea", { class: "request-text", readonly: !0, rows: 6, "aria-label": "Request to copy", onfocus: (r) => r.target.select() }, t.text)
1049
- ) : (t == null ? void 0 : t.kind) === "failed" ? _(`The request wasn't sent. ${t.message}`, "note problem") : null;
1131
+ P(`Copy this request into the chat to load ${n}.`),
1132
+ i("textarea", { class: "request-text", readonly: !0, rows: 6, "aria-label": "Request to copy", onfocus: (r) => r.target.select() }, t.text)
1133
+ ) : (t == null ? void 0 : t.kind) === "failed" ? P(`The request wasn't sent. ${t.message}`, "note problem") : null;
1050
1134
  }
1051
- function Tr(e, t) {
1052
- var a;
1053
- const n = ((a = e.request) == null ? void 0 : a.kind) === "pending", r = mr() ? "This page holds the days loaded in this chat. Load this day asks the chat for it, or open the page where the New Vintage connector can run to load any day." : "This page holds the days loaded in this chat. Load this day asks the chat for it.";
1054
- return o(
1135
+ function Ur(e, t) {
1136
+ var s;
1137
+ const n = ((s = e.request) == null ? void 0 : s.kind) === "pending", r = Er() ? "This page holds the days loaded in this chat. Load this day asks the chat for it, or open the page where the New Vintage connector can run to load any day." : "This page holds the days loaded in this chat. Load this day asks the chat for it.";
1138
+ return i(
1055
1139
  "div",
1056
1140
  { class: "empty" },
1057
- o("p", { class: "empty-title" }, "This day isn't loaded yet"),
1058
- _(r),
1059
- o(
1141
+ i("p", { class: "empty-title" }, "This day isn't loaded yet"),
1142
+ P(r),
1143
+ i(
1060
1144
  "div",
1061
1145
  { class: "actions" },
1062
- o(
1146
+ i(
1063
1147
  "button",
1064
1148
  { type: "button", class: "button", "data-fid": "load-day", disabled: n, "aria-busy": n ? "true" : "false", onclick: () => t.requestDay() },
1065
1149
  n ? "Sending…" : "Load this day"
1066
1150
  )
1067
1151
  ),
1068
- Sr(e)
1152
+ Vr(e)
1069
1153
  );
1070
1154
  }
1071
- function $r(e, t) {
1072
- if (Ve(e, "guestList")) return null;
1073
- const n = e.dayState, r = Ue(e, "guestList");
1074
- let a = null, s;
1075
- if (n.status === "loading") s = kr();
1076
- else if (n.status === "choose") s = o("div", { class: "empty" }, o("p", { class: "empty-title" }, "Choose a winery"), n.message ? _(n.message) : null);
1077
- else if (n.status === "unloaded") s = Tr(e, t);
1155
+ function jr(e, t) {
1156
+ if (Be(e, "guestList")) return null;
1157
+ const n = e.dayState, r = Ze(e, "guestList");
1158
+ let s = null, a;
1159
+ if (n.status === "loading") a = Dr();
1160
+ else if (n.status === "choose") a = i("div", { class: "empty" }, i("p", { class: "empty-title" }, "Choose a winery"), n.message ? P(n.message) : null);
1161
+ else if (n.status === "unloaded") a = Ur(e, t);
1078
1162
  else if (n.status === "failed")
1079
- s = o(
1163
+ a = i(
1080
1164
  "div",
1081
1165
  { class: "empty" },
1082
- o("p", { class: "empty-title" }, "This day couldn't load"),
1083
- _(n.message, "note problem"),
1084
- o("div", { class: "actions" }, o("button", { type: "button", class: "button", "data-fid": "retry", onclick: () => t.retry() }, "Try again"))
1166
+ i("p", { class: "empty-title" }, "This day couldn't load"),
1167
+ P(n.message, "note problem"),
1168
+ i("div", { class: "actions" }, i("button", { type: "button", class: "button", "data-fid": "retry", onclick: () => t.retry() }, "Try again"))
1085
1169
  );
1086
- else if (!n.arrivals.length) s = o("div", { class: "empty" }, o("p", { class: "empty-title" }, "No one is coming in on this day."));
1170
+ else if (!n.arrivals.length) a = i("div", { class: "empty" }, i("p", { class: "empty-title" }, "No one is coming in on this day."));
1087
1171
  else {
1088
- const c = jn(n.arrivals);
1089
- c && (a = `All from ${qe[c]}`);
1090
- const { upcoming: l, earlier: d } = Re(n.arrivals, e.kind, e.nowMinutes);
1091
- s = o(
1092
- "ul",
1093
- { class: "rows" },
1094
- l.map((m) => Ut(e, t, m, !c, !1)),
1095
- d.length ? o("li", { class: "earlier-head" }, "Earlier today", o("span", { class: "count", "aria-label": P(d.length, "reservation") }, String(d.length))) : null,
1096
- d.map((m) => Ut(e, t, m, !c, !0))
1097
- );
1172
+ const l = sr(n.arrivals);
1173
+ l && (s = `All from ${Fe[l]}`), a = i("div", null, Gr(e, t), dn(e, t, n.arrivals, !l));
1098
1174
  }
1099
- return o(
1175
+ return i(
1100
1176
  "section",
1101
1177
  { class: "card list-card", "data-section": "guestList", "aria-busy": n.status === "loading" ? "true" : "false" },
1102
- o("div", { class: "card-head" }, o("h2", null, r), a ? o("span", { class: "card-aside" }, a) : null),
1103
- s
1178
+ i("div", { class: "card-head" }, i("h2", null, r), s ? i("span", { class: "card-aside" }, s) : null),
1179
+ a
1104
1180
  );
1105
1181
  }
1106
- function Vt(e) {
1107
- return e.map((t) => o("p", { class: "soft" }, t.text, t.when ? o("span", { class: "soft-when" }, t.when) : null));
1182
+ function Gr(e, t) {
1183
+ return i(
1184
+ "div",
1185
+ { class: "finder" },
1186
+ i(
1187
+ "label",
1188
+ { class: "search" },
1189
+ K("search", 16),
1190
+ i("span", { class: "sr-only" }, "Search guests by name"),
1191
+ i("input", {
1192
+ type: "search",
1193
+ class: "search-input",
1194
+ placeholder: "Search guests",
1195
+ autocomplete: "off",
1196
+ spellcheck: "false",
1197
+ value: e.query,
1198
+ "data-fid": "search",
1199
+ oninput: (n) => t.search(n.target.value)
1200
+ })
1201
+ ),
1202
+ i(
1203
+ "div",
1204
+ { class: "filters", role: "group", "aria-label": "Show only" },
1205
+ an.map(
1206
+ (n) => i(
1207
+ "button",
1208
+ {
1209
+ type: "button",
1210
+ class: "filter-chip",
1211
+ "aria-pressed": e.filters.includes(n.id) ? "true" : "false",
1212
+ "data-filter": n.id,
1213
+ "data-fid": `filter-${n.id}`,
1214
+ onclick: () => t.toggleFilter(n.id)
1215
+ },
1216
+ n.label
1217
+ )
1218
+ )
1219
+ )
1220
+ );
1221
+ }
1222
+ function Kt(e) {
1223
+ return e.first === e.last ? J(e.first) : `${J(e.first)} to ${J(e.last)}`;
1224
+ }
1225
+ function Fr(e, t, n) {
1226
+ const r = t.reduce((a, l) => a + l.party, 0);
1227
+ return [n ? `${t.length} of ${A(e.arrivals.length, "party", "parties")}` : A(t.length, "party", "parties"), A(r, "guest"), er(t)].filter(Boolean).join(", ");
1228
+ }
1229
+ function dn(e, t, n, r) {
1230
+ const s = !!e.query.trim() || e.filters.length > 0, a = Xn(n, e.seatingGap), l = e.kind === "today", c = (y) => l && y.last < e.nowMinutes, d = l ? a.find((y) => !c(y)) : void 0, m = n.filter((y) => Oe(y, e.query, e.filters)).length, M = (y) => {
1231
+ const _ = y.arrivals.filter((O) => Oe(O, e.query, e.filters));
1232
+ if (!_.length) return null;
1233
+ const C = c(y), L = !C || e.openEarlier.includes(y.key), T = y === d ? y.first <= e.nowMinutes ? "Now" : "Next" : null, q = i("span", { class: "seat-time" }, Kt(y)), F = i("span", { class: "seat-counts" }, Fr(y, _, s)), I = C ? i(
1234
+ "button",
1235
+ {
1236
+ type: "button",
1237
+ class: "seat-head seat-toggle",
1238
+ "aria-expanded": L ? "true" : "false",
1239
+ "data-fid": `seating-${y.key}`,
1240
+ onclick: () => t.toggleSeating(y.key)
1241
+ },
1242
+ i("span", { class: "seat-chevron" }, K(L ? "chevron-down" : "chevron-right", 16)),
1243
+ i("span", { class: "seat-label" }, q, F)
1244
+ ) : i("div", { class: "seat-head" }, i("span", { class: "seat-label" }, i("h3", { class: "seat-time" }, Kt(y)), F), T ? i("span", { class: `seat-marker seat-${T.toLowerCase()}` }, T) : null);
1245
+ return i(
1246
+ "li",
1247
+ { class: `seating${C ? " seating-earlier" : ""}`, "data-seating": y.key, "data-state": C ? "earlier" : T ? T.toLowerCase() : "later" },
1248
+ I,
1249
+ L ? i(
1250
+ "ul",
1251
+ { class: "rows" },
1252
+ _.map((O) => qr(e, t, O, r, l && O.minutes < e.nowMinutes))
1253
+ ) : null
1254
+ );
1255
+ }, k = a.filter((y) => !c(y)).map(M).filter((y) => y !== null), h = a.filter(c).map(M).filter((y) => y !== null), x = a.filter(c).reduce((y, _) => y + _.arrivals.filter((C) => Oe(C, e.query, e.filters)).length, 0);
1256
+ return i(
1257
+ "div",
1258
+ { class: "list-results", "aria-live": "polite" },
1259
+ s ? i(
1260
+ "div",
1261
+ { class: "filter-status" },
1262
+ i("span", null, m ? `${m} of ${A(n.length, "party", "parties")}` : "No guests match."),
1263
+ i("button", { type: "button", class: "link-button", "data-fid": "clear-filters", onclick: () => t.clearFilters() }, "Clear filters")
1264
+ ) : null,
1265
+ k.length || h.length ? i(
1266
+ "ol",
1267
+ { class: "seatings" },
1268
+ k,
1269
+ h.length ? i("li", { class: "earlier-head" }, "Earlier today", i("span", { class: "count", "aria-label": A(x, "reservation") }, String(x))) : null,
1270
+ h
1271
+ ) : null
1272
+ );
1273
+ }
1274
+ function Zr(e) {
1275
+ return e.map((t) => i("p", { class: "soft" }, t.text, t.when ? i("span", { class: "soft-when" }, t.when) : null));
1108
1276
  }
1109
- function Nr(e) {
1277
+ function Br(e) {
1110
1278
  const t = e.bought;
1111
- return t ? t.items.length ? o(
1279
+ return t ? t.items.length ? i(
1112
1280
  "ul",
1113
1281
  { class: "bought" },
1114
- t.items.map((n) => o("li", null, o("span", null, n.title), o("span", { class: "qty" }, `× ${n.qty}`))),
1115
- t.total !== null ? o("li", { class: "total" }, o("span", null, "Total"), o("span", null, G(t.total))) : null
1116
- ) : "Nothing beyond the tasting" : null;
1282
+ t.items.map((n) => i("li", null, i("span", null, n.title), i("span", { class: "qty" }, `× ${n.qty}`))),
1283
+ t.total !== null ? i("li", { class: "total" }, i("span", null, "Total"), i("span", null, Y(t.total))) : null
1284
+ ) : i("p", { class: "visit-muted" }, "Nothing beyond the tasting") : null;
1285
+ }
1286
+ function Hr(e, t) {
1287
+ const n = t.lastTaste, r = [];
1288
+ if (n) {
1289
+ const l = n.day ? `${nn(n.day, e.today)}, ${Dn(n.day, e.today)}` : null;
1290
+ r.push(i("div", { class: "visit-part visit-taste" }, i("p", { class: "visit-title" }, n.title), l ? i("p", { class: "visit-muted" }, l) : null));
1291
+ }
1292
+ const s = Br(t);
1293
+ if (s && r.push(i("div", { class: "visit-part visit-bought" }, s)), t.orderNotes.length && r.push(i("div", { class: "visit-part visit-notes" }, t.orderNotes.map((l) => i("p", { class: "visit-note" }, l)))), !r.length) return null;
1294
+ const a = r.flatMap((l, c) => c ? [i("hr", { class: "visit-divider" }), l] : [l]);
1295
+ return i("div", { class: "fact fact-visit" }, i("div", { class: "fact-label" }, "Last visit"), i("div", { class: "visit" }, a));
1117
1296
  }
1118
- function Ar(e) {
1297
+ function Yr(e) {
1119
1298
  const { floor: t, ceiling: n } = e;
1120
- return t !== null && n !== null ? t === n ? G(t) : `${G(t)} to ${G(n)}` : t !== null ? `From ${G(t)}` : n !== null ? `Up to ${G(n)}` : e.avg !== null ? G(e.avg) : null;
1299
+ return t !== null && n !== null ? t === n ? Y(t) : `${Y(t)} to ${Y(n)}` : t !== null ? `From ${Y(t)}` : n !== null ? `Up to ${Y(n)}` : e.avg !== null ? Y(e.avg) : null;
1121
1300
  }
1122
- function _r(e, t, n) {
1123
- var s, c;
1124
- const r = [], a = (l) => {
1125
- l && r.push(l);
1301
+ function Wr(e, t, n) {
1302
+ var a, l;
1303
+ const r = [], s = (c) => {
1304
+ c && r.push(c);
1126
1305
  };
1127
1306
  switch (n) {
1128
1307
  case "reservation": {
1129
- const l = e.kind === "today" && t.minutes >= e.nowMinutes;
1308
+ const c = e.kind === "today" && t.minutes >= e.nowMinutes;
1130
1309
  r.push(
1131
- o(
1310
+ i(
1132
1311
  "div",
1133
1312
  { class: "fact-row" },
1134
- w("Arrives", fe(e.day, t.minutes, e.today), l ? De(t.minutes - e.nowMinutes) : null, l ? "fact-countdown" : ""),
1135
- w("Party", P(t.party, "guest")),
1136
- w("Booked via", qe[t.source])
1313
+ S("Arrives", we(e.day, t.minutes, e.today), c ? Ge(t.minutes - e.nowMinutes) : null, c ? "fact-countdown" : ""),
1314
+ S("Party", A(t.party, "guest")),
1315
+ S("Booked via", Fe[t.source])
1137
1316
  )
1138
- ), a(t.experience ? w("Experience", t.experience) : null);
1317
+ ), s(t.experience ? S("Experience", t.experience) : null);
1139
1318
  break;
1140
1319
  }
1141
1320
  case "talkAbout": {
1142
- if (a(t.occasions.length ? w("Occasion", t.occasions.map((d, m) => o("div", { "data-line": m }, d))) : null), a(t.interests.length ? w("Interested in", xe(t.interests)) : null), a(t.varietals.length ? w("Favorite varietals", t.varietals.join(", ")) : null), t.lastTaste) {
1143
- const d = t.lastTaste.day ? `${Ht(t.lastTaste.day, e.today)}, ${Nn(t.lastTaste.day, e.today)}` : null;
1144
- a(w("Last taste", t.lastTaste.title, d));
1145
- const m = Nr(t);
1146
- a(m ? w("Bought that visit", m) : null);
1147
- }
1148
- a(t.orderNotes.length ? w("Order notes", Vt(t.orderNotes.map((d) => ({ text: d })))) : null);
1149
- const l = t.price ? Ar(t.price) : null;
1150
- a(l ? w("Usual bottle price", l, ((s = t.price) == null ? void 0 : s.avg) !== null && ((c = t.price) == null ? void 0 : c.avg) !== void 0 ? `Average ${G(t.price.avg)}` : null) : null);
1321
+ s(t.occasions.length ? S("Occasion", t.occasions.map((c, d) => i("div", { "data-line": d }, c))) : null), s(t.interests.length ? S("Interested in", Te(t.interests)) : null), s(Hr(e, t));
1322
+ break;
1323
+ }
1324
+ case "newVintageProfile": {
1325
+ const c = t.price ? Yr(t.price) : null, d = [
1326
+ c ? S("Usual bottle price", c, ((a = t.price) == null ? void 0 : a.avg) !== null && ((l = t.price) == null ? void 0 : l.avg) !== void 0 ? `Average ${Y(t.price.avg)}` : null) : null,
1327
+ t.wineTypes.length ? S("Wine types", t.wineTypes.join(", ")) : null,
1328
+ t.varietals.length ? S("Favorite varietals", t.varietals.join(", ")) : null,
1329
+ t.vintages.length ? S("Vintages", t.vintages.join(", ")) : null,
1330
+ t.appellations.length ? S("Appellations", t.appellations.join(", ")) : null
1331
+ ].filter((m) => m !== null);
1332
+ d.length && r.push(i("div", { class: "fact-grid" }, d));
1151
1333
  break;
1152
1334
  }
1153
1335
  case "relationship":
1154
- a(t.since ? w("Customer since", t.since) : null), a(t.lifetime ? w("Lifetime spend", G(t.lifetime.spend), t.lifetime.orders !== null ? P(t.lifetime.orders, "order") : null) : null), a(t.clubTitles ? w("Club", t.clubTitles) : null), a(t.clubPickup ? w("Club pickup", "Shipment ready to hand over") : null), a(t.prospect && t.signupTier ? w("Likely to join the club", Nt(t.signupTier)) : null), a(t.atRisk && t.churnTier ? w("Membership at risk", Nt(t.churnTier)) : null), a(t.clubTags.length ? w("Club tags", xe(t.clubTags)) : null);
1336
+ s(t.since ? S("Customer since", t.since) : null), s(t.lifetime ? S("Lifetime spend", Y(t.lifetime.spend), t.lifetime.orders !== null ? A(t.lifetime.orders, "order") : null) : null), s(t.clubTitles ? S("Club", t.clubTitles) : null), s(t.clubPickup ? S("Club pickup", "Shipment ready to hand over") : null), s(t.prospect && t.signupTier ? S("Likely to join the club", Lt(t.signupTier)) : null), s(t.atRisk && t.churnTier ? S("Membership at risk", Lt(t.churnTier)) : null), s(t.clubTags.length ? S("Club tags", Te(t.clubTags)) : null);
1155
1337
  break;
1156
1338
  case "headsUp":
1157
- a(t.accountTags.length ? w("Account tags", xe(t.accountTags, "warning")) : null);
1339
+ s(t.accountTags.length ? S("Account tags", Te(t.accountTags, "warning")) : null);
1158
1340
  break;
1159
1341
  case "personalNotes":
1160
- r.push(...Vt(t.personalNotes.map((l) => ({ text: l.content, when: l.when }))));
1342
+ r.push(...Zr(t.personalNotes.map((c) => ({ text: c.content, when: c.when }))));
1161
1343
  break;
1162
1344
  }
1163
1345
  return r;
1164
1346
  }
1165
- function Mr(e) {
1347
+ function Kr(e) {
1166
1348
  const t = [];
1167
- return e.vip && t.push("VIP"), t.push(e.visit === "first" ? "First visit" : e.visit === "return" ? "Returning guest" : "Visit history unknown"), e.clubMember && t.push("Club member"), e.prospect && t.push("Club prospect"), e.atRisk && t.push("Membership at risk"), o("div", { class: "chips" }, t.map(Jt));
1349
+ return e.vip && t.push("VIP"), t.push(e.visit === "first" ? "First visit" : e.visit === "return" ? "Returning guest" : "Visit history unknown"), e.clubMember && t.push("Club member"), e.prospect && t.push("Club prospect"), e.atRisk && t.push("Membership at risk"), e.partlyRefunded && t.push("Partly refunded"), i("div", { class: "chips" }, t.map(cn));
1168
1350
  }
1169
- const Cr = ["reservation", "talkAbout", "relationship", "headsUp", "personalNotes"];
1170
- function Er(e, t, n) {
1171
- var d, m, S;
1351
+ const Jr = ["reservation", "talkAbout", "newVintageProfile", "relationship", "headsUp", "personalNotes"];
1352
+ function Qr(e, t, n) {
1353
+ var d, m, M;
1172
1354
  const r = e.selected;
1173
1355
  if (!r || e.dayState.status !== "ready") return null;
1174
- const a = [];
1175
- for (const f of Cr) {
1176
- if (!Ve(e, f)) {
1177
- const b = _r(e, r, f);
1178
- b.length && a.push(
1179
- o(
1356
+ const s = [];
1357
+ for (const k of Jr) {
1358
+ if (!Be(e, k)) {
1359
+ const h = Wr(e, r, k);
1360
+ h.length && s.push(
1361
+ i(
1180
1362
  "section",
1181
- { class: "psec", "data-section": f },
1182
- o("h3", { class: "psec-title" }, o("span", { class: `tile${f === "headsUp" ? " tile-warning" : ""}` }, W((d = fr[f]) != null ? d : "", 16)), Ue(e, f)),
1183
- o("div", { class: "psec-facts" }, b)
1363
+ { class: "psec", "data-section": k },
1364
+ i("h3", { class: "psec-title" }, i("span", { class: `tile${k === "headsUp" ? " tile-warning" : ""}` }, K((d = Cr[k]) != null ? d : "", 16)), Ze(e, k)),
1365
+ Wt[k] ? i("p", { class: "psec-source" }, Wt[k]) : null,
1366
+ i("div", { class: "psec-facts" }, h)
1184
1367
  )
1185
1368
  );
1186
1369
  }
1187
- a.push(...n(f));
1370
+ s.push(...n(k));
1188
1371
  }
1189
- const s = ((m = e.research) == null ? void 0 : m.key) === r.key ? e.research : null, c = (s == null ? void 0 : s.status) === "pending", l = e.live ? o(
1372
+ const a = ((m = e.research) == null ? void 0 : m.key) === r.key ? e.research : null, l = (a == null ? void 0 : a.status) === "pending", c = e.live ? i(
1190
1373
  "div",
1191
1374
  { class: "research" },
1192
- o(
1375
+ i(
1193
1376
  "button",
1194
- { type: "button", class: "button button-quiet", "data-fid": "research", disabled: c, "aria-busy": c ? "true" : "false", onclick: () => t.research() },
1195
- W("refresh-cw", 16),
1196
- c ? "Researching…" : "Research this guest again"
1377
+ { type: "button", class: "button button-quiet", "data-fid": "research", disabled: l, "aria-busy": l ? "true" : "false", onclick: () => t.research() },
1378
+ K("refresh-cw", 16),
1379
+ l ? "Researching…" : "Research this guest again"
1197
1380
  ),
1198
- (s == null ? void 0 : s.status) === "failed" ? _((S = s.message) != null ? S : "This guest couldn't refresh.", "note problem") : null
1199
- ) : o(
1381
+ (a == null ? void 0 : a.status) === "failed" ? P((M = a.message) != null ? M : "This guest couldn't refresh.", "note problem") : null
1382
+ ) : i(
1200
1383
  "div",
1201
1384
  { class: "research" },
1202
- o("button", { type: "button", class: "button button-quiet", disabled: !0, "aria-describedby": "research-reason" }, W("refresh-cw", 16), "Research this guest again"),
1203
- o("p", { class: "note", id: "research-reason" }, "Ask in this chat to refresh this guest.")
1385
+ i("button", { type: "button", class: "button button-quiet", disabled: !0, "aria-describedby": "research-reason" }, K("refresh-cw", 16), "Research this guest again"),
1386
+ i("p", { class: "note", id: "research-reason" }, "Ask in this chat to refresh this guest.")
1204
1387
  );
1205
- return o(
1388
+ return i(
1206
1389
  "aside",
1207
- { class: "card panel", "aria-label": `Guest: ${ge(r)}`, "data-key": r.key },
1208
- o(
1390
+ { class: "card panel", "aria-label": `Guest: ${xe(r)}`, "data-key": r.key },
1391
+ i(
1209
1392
  "div",
1210
1393
  { class: "panel-head" },
1211
- o("div", { class: "handle", "aria-hidden": "true" }),
1212
- o(
1394
+ i("div", { class: "handle", "aria-hidden": "true" }),
1395
+ i(
1213
1396
  "div",
1214
1397
  { class: "panel-head-row" },
1215
- o("h2", { class: "panel-name" }, ge(r)),
1216
- o("button", { type: "button", class: "icon-button close", "aria-label": "Close", "data-fid": "close-sheet", onclick: () => t.closeSheet() }, W("x", 20))
1398
+ i("h2", { class: "panel-name" }, xe(r)),
1399
+ i("button", { type: "button", class: "icon-button close", "aria-label": "Close", "data-fid": "close-sheet", onclick: () => t.closeSheet() }, K("x", 20))
1217
1400
  ),
1218
- Mr(r)
1401
+ Kr(r)
1219
1402
  ),
1220
- o("div", { class: "panel-body" }, a, l)
1403
+ i("div", { class: "panel-body" }, s, c)
1221
1404
  );
1222
1405
  }
1223
- const Gt = 900 * 1e3;
1224
- function Ee(e) {
1406
+ const Jt = 900 * 1e3;
1407
+ function qe(e) {
1225
1408
  switch (e.kind) {
1226
1409
  case "unavailable":
1227
- return ke() === "claude" ? "Loading a day needs the New Vintage connector with access to this winery. Add the connector in this chat, then try again." : "This page shows the days loaded in the chat. Ask in the chat to load another.";
1410
+ return Ae() === "claude" ? "Loading a day needs the New Vintage connector with access to this winery. Add the connector in this chat, then try again." : "This page shows the days loaded in the chat. Ask in the chat to load another.";
1228
1411
  case "approval":
1229
1412
  return "Loading a day needs your permission to use the New Vintage connector. Allow it for this page, then try again.";
1230
1413
  case "reconnect":
1231
- return fn();
1414
+ return An();
1232
1415
  case "temporary":
1233
1416
  return "New Vintage didn't answer. Try again in a moment.";
1234
1417
  case "needs_update":
@@ -1239,305 +1422,332 @@ function Ee(e) {
1239
1422
  return e.message;
1240
1423
  }
1241
1424
  }
1242
- function Lr(e, t) {
1243
- var et, tt, nt, rt, at, st, ot, it, lt, ct, ut, dt, pt, gt, ft, mt, ht, yt, bt;
1244
- const n = (et = t.now) != null ? et : (() => /* @__PURE__ */ new Date()), r = {
1245
- ...ye,
1246
- ...(tt = t.settings) != null ? tt : {},
1247
- tagRules: { ...ye.tagRules, ...(rt = (nt = t.settings) == null ? void 0 : nt.tagRules) != null ? rt : {} }
1248
- }, a = Sn(t.settings ? t.settings.timeZone : ye.timeZone), s = Pn(r.tagRules), c = Number(r.largeParty) > 0 ? Number(r.largeParty) : ye.largeParty, l = Hn(t.customize, t.cards), d = Jn(t.storage), m = () => St(n(), a);
1249
- let S = m().day, f = S, b = (at = t.tenantId) != null ? at : null, F = (st = t.wineryName) != null ? st : null, C = null, Z = null, I = !0, N = null, O = null, J = !1, L = 0;
1250
- const B = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Map();
1251
- let H = null, A = null, R = !1;
1252
- const h = /* @__PURE__ */ new Map();
1253
- let $ = null, T = { open: !1, month: f.slice(0, 7), focus: f }, q = null, Te = null, me = null, oe = !1;
1254
- const Ge = /* @__PURE__ */ new Map();
1425
+ function Xr(e, t) {
1426
+ var st, it, ot, lt, ct, ut, dt, pt, gt, ft, mt, ht, yt, bt, vt, xt, wt, kt, St, $t;
1427
+ const n = (st = t.now) != null ? st : (() => /* @__PURE__ */ new Date()), r = {
1428
+ ...he,
1429
+ ...(it = t.settings) != null ? it : {},
1430
+ tagRules: { ...he.tagRules, ...(lt = (ot = t.settings) == null ? void 0 : ot.tagRules) != null ? lt : {} }
1431
+ }, s = On(t.settings ? t.settings.timeZone : he.timeZone), a = Hn(r.tagRules), l = Number(r.largeParty) > 0 ? Number(r.largeParty) : he.largeParty, c = Number(r.seatingGapMinutes) > 0 ? Number(r.seatingGapMinutes) : (ct = he.seatingGapMinutes) != null ? ct : 45, d = cr(t.customize, t.cards), m = gr(t.storage), M = () => Et(n(), s);
1432
+ let k = M().day, h = k, x = (ut = t.tenantId) != null ? ut : null, y = (dt = t.wineryName) != null ? dt : null, _ = null, C = null, L = !0, T = null, q = null, F = !1, I = 0;
1433
+ const O = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Map();
1434
+ let Q = null, z = null, B = !1;
1435
+ const g = /* @__PURE__ */ new Map();
1436
+ let E = null, N = { open: !1, month: h.slice(0, 7), focus: h }, D = null, _e = "", se = [], te = [], Ce = null, ke = null, ue = !1;
1437
+ const He = /* @__PURE__ */ new Map();
1255
1438
  e.innerHTML = "";
1256
- const Xt = [(lt = (it = (ot = t.customize) == null ? void 0 : ot.fonts) == null ? void 0 : it.display) != null ? lt : "Newsreader", (dt = (ut = (ct = t.customize) == null ? void 0 : ct.fonts) == null ? void 0 : ut.body) != null ? dt : "Be Vietnam Pro"], je = o("link", { rel: "stylesheet", href: rr(Xt.filter((i) => /^[A-Za-z0-9 ]{1,40}$/.test(i))) }), $e = {};
1257
- (gt = (pt = t.customize) == null ? void 0 : pt.fonts) != null && gt.display && ($e["font-display"] = `'${t.customize.fonts.display}', Georgia, serif`), (mt = (ft = t.customize) == null ? void 0 : ft.fonts) != null && mt.body && ($e["font-body"] = `'${t.customize.fonts.body}', system-ui, sans-serif`);
1258
- const Fe = o("style", null, ar({ ...$e, ...(yt = (ht = t.customize) == null ? void 0 : ht.theme) != null ? yt : {} }, (bt = t.customize) == null ? void 0 : bt.themeDark) + sr);
1259
- document.head.append(je, Fe);
1260
- const U = o("div", { class: "nvgp" });
1261
- e.append(U);
1262
- const Ze = () => Ye();
1263
- window.addEventListener("resize", Ze);
1264
- const Be = (i) => {
1265
- i.key === "Escape" && (T.open ? Q.closeCalendar() : R && Q.closeSheet());
1266
- }, He = (i) => {
1439
+ const pn = [(ft = (gt = (pt = t.customize) == null ? void 0 : pt.fonts) == null ? void 0 : gt.display) != null ? ft : "Newsreader", (yt = (ht = (mt = t.customize) == null ? void 0 : mt.fonts) == null ? void 0 : ht.body) != null ? yt : "Be Vietnam Pro"], Ye = i("link", { rel: "stylesheet", href: vr(pn.filter((o) => /^[A-Za-z0-9 ]{1,40}$/.test(o))) }), Ee = {};
1440
+ (vt = (bt = t.customize) == null ? void 0 : bt.fonts) != null && vt.display && (Ee["font-display"] = `'${t.customize.fonts.display}', Georgia, serif`), (wt = (xt = t.customize) == null ? void 0 : xt.fonts) != null && wt.body && (Ee["font-body"] = `'${t.customize.fonts.body}', system-ui, sans-serif`);
1441
+ const We = i("style", null, xr({ ...Ee, ...(St = (kt = t.customize) == null ? void 0 : kt.theme) != null ? St : {} }, ($t = t.customize) == null ? void 0 : $t.themeDark) + wr);
1442
+ document.head.append(Ye, We);
1443
+ const V = i("div", { class: "nvgp" });
1444
+ e.append(V);
1445
+ const Ke = () => Xe();
1446
+ window.addEventListener("resize", Ke);
1447
+ const Je = (o) => {
1448
+ o.key === "Escape" && (N.open ? ee.closeCalendar() : B && ee.closeSheet());
1449
+ }, Qe = (o) => {
1267
1450
  var p;
1268
- if (!T.open) return;
1269
- const u = i.target;
1270
- (p = u == null ? void 0 : u.closest) != null && p.call(u, ".day-wrap") || (T = { ...T, open: !1 }, v());
1451
+ if (!N.open) return;
1452
+ const u = o.target;
1453
+ (p = u == null ? void 0 : u.closest) != null && p.call(u, ".day-wrap") || (N = { ...N, open: !1 }, w());
1271
1454
  };
1272
- document.addEventListener("keydown", Be), document.addEventListener("mousedown", He);
1273
- function Ye() {
1274
- const i = U.querySelector(".daybar");
1275
- i && U.style.setProperty("--daybar-h", `${i.offsetHeight}px`);
1276
- const u = U.querySelector(".summary");
1277
- U.style.setProperty("--summary-h", `${u ? u.offsetHeight + 16 : 0}px`);
1455
+ document.addEventListener("keydown", Je), document.addEventListener("mousedown", Qe);
1456
+ function Xe() {
1457
+ var f;
1458
+ const o = V.querySelector(".daybar");
1459
+ o && V.style.setProperty("--daybar-h", `${o.offsetHeight}px`);
1460
+ const u = V.querySelector(".summary");
1461
+ V.style.setProperty("--summary-h", `${u ? u.offsetHeight + 16 : 0}px`);
1462
+ const p = u && window.getComputedStyle(u).position === "sticky" ? u.offsetHeight : 0;
1463
+ V.style.setProperty("--seat-top", `${((f = o == null ? void 0 : o.offsetHeight) != null ? f : 0) + p}px`);
1278
1464
  }
1279
- const Y = () => !!(Z && N && b);
1280
- function en(i) {
1281
- var p, g;
1282
- const u = (p = t.days) == null ? void 0 : p[i];
1283
- return u && Array.isArray(u.arrivals) ? { rows: u.arrivals, loadedAt: String((g = u.loadedAt) != null ? g : ""), live: !1 } : null;
1465
+ const X = () => !!(C && T && x);
1466
+ function gn(o) {
1467
+ var p, f;
1468
+ const u = (p = t.days) == null ? void 0 : p[o];
1469
+ return u && Array.isArray(u.arrivals) ? { rows: u.arrivals, loadedAt: String((f = u.loadedAt) != null ? f : ""), live: !1 } : null;
1284
1470
  }
1285
- function Ne(i) {
1471
+ function ze(o) {
1286
1472
  var u;
1287
- return (u = B.get(i)) != null ? u : en(i);
1473
+ return (u = O.get(o)) != null ? u : gn(o);
1288
1474
  }
1289
- function Ke() {
1290
- if (!b) return I ? { status: "loading" } : { status: "choose", message: H };
1291
- const i = Ne(f);
1292
- if (i)
1293
- return { status: "ready", arrivals: Rn(i.rows, { day: f, today: S, largeParty: c, rules: s }), rows: i.rows, loadedAt: i.loadedAt, live: i.live };
1294
- if (I || D.has(f)) return { status: "loading" };
1295
- const u = z.get(f);
1296
- return u ? { status: "failed", message: u } : Y() ? { status: "loading" } : { status: "unloaded" };
1475
+ function et() {
1476
+ if (!x) return L ? { status: "loading" } : { status: "choose", message: Q };
1477
+ const o = ze(h);
1478
+ if (o)
1479
+ return { status: "ready", arrivals: Qn(o.rows, { day: h, today: k, largeParty: l, rules: a }), rows: o.rows, loadedAt: o.loadedAt, live: o.live };
1480
+ if (L || Z.has(h)) return { status: "loading" };
1481
+ const u = j.get(h);
1482
+ return u ? { status: "failed", message: u } : X() ? { status: "loading" } : { status: "unloaded" };
1297
1483
  }
1298
- function tn(i, u) {
1299
- var g, y;
1300
- const { upcoming: p } = Re(i, Pe(f, S), u);
1301
- return (y = (g = p[0]) != null ? g : i[0]) != null ? y : null;
1484
+ function fn(o, u) {
1485
+ var f, v;
1486
+ const { upcoming: p } = sn(o, Ve(h, k), u);
1487
+ return (v = (f = p[0]) != null ? f : o[0]) != null ? v : null;
1302
1488
  }
1303
- function nn(i) {
1304
- const u = z.get(f);
1305
- if (i && u) return { text: u, problem: !0 };
1306
- if (!i) return null;
1307
- if (D.has(f)) return { text: "Checking for changes", problem: !1 };
1308
- if (i.live) return { text: "Up to date", problem: !1 };
1309
- const p = new Date(i.loadedAt);
1489
+ function mn(o) {
1490
+ const u = j.get(h);
1491
+ if (o && u) return { text: u, problem: !0 };
1492
+ if (!o) return null;
1493
+ if (Z.has(h)) return { text: "Checking for changes", problem: !1 };
1494
+ if (o.live) return { text: "Up to date", problem: !1 };
1495
+ const p = new Date(o.loadedAt);
1310
1496
  if (Number.isNaN(p.getTime())) return { text: "Loaded in the chat", problem: !1 };
1311
- const g = St(p, a);
1312
- return { text: `Loaded in the chat ${fe(g.day, g.minutes, S)}`, problem: !1 };
1497
+ const f = Et(p, s);
1498
+ return { text: `Loaded in the chat ${we(f.day, f.minutes, k)}`, problem: !1 };
1313
1499
  }
1314
- function he() {
1315
- var y, k, x, X;
1316
- const i = m(), u = Ke(), p = u.status === "ready" ? u.arrivals : [], g = (y = p.find((K) => K.key === A)) != null ? y : tn(p, i.minutes);
1500
+ function de() {
1501
+ var v, b, $, oe;
1502
+ const o = M(), u = et(), p = u.status === "ready" ? u.arrivals : [], f = (v = p.find((G) => G.key === z)) != null ? v : fn(p, o.minutes);
1317
1503
  return {
1318
1504
  options: t,
1319
- title: ((x = (k = t.customize) == null ? void 0 : k.title) == null ? void 0 : x.trim()) || (F ? `${F} Guest Prep` : "Guest Prep"),
1320
- timeZone: a,
1321
- today: S,
1322
- nowMinutes: i.minutes,
1323
- day: f,
1324
- kind: Pe(f, S),
1325
- live: Y(),
1505
+ title: (($ = (b = t.customize) == null ? void 0 : b.title) == null ? void 0 : $.trim()) || (y ? `${y} Guest Prep` : "Guest Prep"),
1506
+ timeZone: s,
1507
+ today: k,
1508
+ nowMinutes: o.minutes,
1509
+ day: h,
1510
+ kind: Ve(h, k),
1511
+ live: X(),
1326
1512
  dayState: u,
1327
- selected: g,
1328
- sheetOpen: R,
1329
- request: (X = h.get(f)) != null ? X : null,
1330
- research: $,
1331
- calendar: T,
1332
- dayNote: nn(b ? Ne(f) : null),
1333
- wineries: C,
1334
- tenantId: b,
1335
- storageNote: d.mode === "none" ? "Changes won't be saved in this browser." : null
1513
+ selected: f,
1514
+ sheetOpen: B,
1515
+ request: (oe = g.get(h)) != null ? oe : null,
1516
+ research: E,
1517
+ calendar: N,
1518
+ dayNote: mn(x ? ze(h) : null),
1519
+ wineries: _,
1520
+ tenantId: x,
1521
+ storageNote: m.mode === "none" ? "Changes won't be saved in this browser." : null,
1522
+ seatingGap: c,
1523
+ query: _e,
1524
+ filters: se,
1525
+ openEarlier: te
1336
1526
  };
1337
1527
  }
1338
- const rn = () => typeof window.matchMedia == "function" && window.matchMedia("(max-width: 900px)").matches, Q = {
1528
+ const hn = () => typeof window.matchMedia == "function" && window.matchMedia("(max-width: 900px)").matches, ee = {
1339
1529
  toggleCalendar: () => {
1340
- T = T.open ? { ...T, open: !1 } : { open: !0, month: f.slice(0, 7), focus: f }, q = T.open ? "cal-focus" : "day-button", v();
1530
+ N = N.open ? { ...N, open: !1 } : { open: !0, month: h.slice(0, 7), focus: h }, D = N.open ? "cal-focus" : "day-button", w();
1341
1531
  },
1342
1532
  closeCalendar: () => {
1343
- T = { ...T, open: !1 }, q = "day-button", v();
1533
+ N = { ...N, open: !1 }, D = "day-button", w();
1344
1534
  },
1345
- pickDay: (i) => {
1346
- T = { open: !1, month: i.slice(0, 7), focus: i }, q = "day-button", i !== f && (f = i, A = null, R = !1, $ = null, We()), v();
1347
- const u = B.get(f);
1348
- Y() && (!u || Date.parse(u.loadedAt) < n().getTime() - Gt) && re();
1535
+ pickDay: (o) => {
1536
+ N = { open: !1, month: o.slice(0, 7), focus: o }, D = "day-button", o !== h && (h = o, z = null, te = [], B = !1, E = null, tt()), w();
1537
+ const u = O.get(h);
1538
+ X() && (!u || Date.parse(u.loadedAt) < n().getTime() - Jt) && ie();
1349
1539
  },
1350
- focusDay: (i) => {
1351
- T = { ...T, focus: i, month: i.slice(0, 7) }, q = "cal-focus", v();
1540
+ focusDay: (o) => {
1541
+ N = { ...N, focus: o, month: o.slice(0, 7) }, D = "cal-focus", w();
1352
1542
  },
1353
- showMonth: (i) => {
1354
- var g;
1355
- const p = (g = [Number(T.focus.slice(8, 10)), 30, 29, 28].map((y) => `${i}-${String(y).padStart(2, "0")}`).find(Tt)) != null ? g : `${i}-01`;
1356
- T = { open: !0, month: i, focus: p }, v();
1543
+ showMonth: (o) => {
1544
+ var f;
1545
+ const p = (f = [Number(N.focus.slice(8, 10)), 30, 29, 28].map((v) => `${o}-${String(v).padStart(2, "0")}`).find(zt)) != null ? f : `${o}-01`;
1546
+ N = { open: !0, month: o, focus: p }, w();
1357
1547
  },
1358
- select: (i) => {
1359
- A = i, R = !0, rn() && (q = "close-sheet"), We(), v();
1548
+ select: (o) => {
1549
+ z = o, B = !0, hn() && (D = "close-sheet"), tt(), w();
1360
1550
  },
1361
1551
  closeSheet: () => {
1362
- R = !1, q = A ? `row-${A}` : null, v();
1552
+ B = !1, D = z ? `row-${z}` : null, w();
1553
+ },
1554
+ retry: () => void (x ? ie() : rt()),
1555
+ requestDay: () => void wn(),
1556
+ research: () => void xn(),
1557
+ chooseWinery: (o) => void kn(o),
1558
+ // Typing updates only the list, so the search box keeps focus and its caret.
1559
+ search: (o) => {
1560
+ _e = o, yn();
1561
+ },
1562
+ toggleFilter: (o) => {
1563
+ se = se.includes(o) ? se.filter((u) => u !== o) : [...se, o], w();
1564
+ },
1565
+ clearFilters: () => {
1566
+ _e = "", se = [], D = "search", w();
1363
1567
  },
1364
- retry: () => void (b ? re() : Qe()),
1365
- requestDay: () => void ln(),
1366
- research: () => void on(),
1367
- chooseWinery: (i) => void cn(i)
1568
+ toggleSeating: (o) => {
1569
+ te = te.includes(o) ? te.filter((u) => u !== o) : [...te, o], w();
1570
+ }
1368
1571
  };
1369
- async function We() {
1370
- b && await Ot(d.adapter, Pt(b), JSON.stringify({ day: f, guest: A, savedOn: S }));
1572
+ function yn() {
1573
+ const o = de(), u = V.querySelector(".list-results");
1574
+ if (!u || o.dayState.status !== "ready") return w();
1575
+ const p = new Set(o.dayState.arrivals.map((f) => f.source)).size === 1;
1576
+ u.replaceWith(dn(o, ee, o.dayState.arrivals, !p));
1577
+ }
1578
+ async function tt() {
1579
+ x && await Zt(m.adapter, Gt(x), JSON.stringify({ day: h, guest: z, savedOn: k }));
1371
1580
  }
1372
- async function Je() {
1373
- if (!b) return;
1374
- const i = Qn(await It(d.adapter, Pt(b)));
1375
- !i || i.savedOn !== S || !Tt(i.day) || (f = i.day, A = i.guest, T = { open: !1, month: f.slice(0, 7), focus: f });
1581
+ async function nt() {
1582
+ if (!x) return;
1583
+ const o = fr(await Ft(m.adapter, Gt(x)));
1584
+ !o || o.savedOn !== k || !zt(o.day) || (h = o.day, z = o.guest, N = { open: !1, month: h.slice(0, 7), focus: h });
1376
1585
  }
1377
- function an(i) {
1378
- var p, g;
1379
- const u = he();
1586
+ function bn(o) {
1587
+ var p, f;
1588
+ const u = de();
1380
1589
  return {
1381
- day: f,
1382
- timeZone: a,
1383
- live: Y(),
1590
+ day: h,
1591
+ timeZone: s,
1592
+ live: X(),
1384
1593
  arrivals: u.dayState.status === "ready" ? u.dayState.rows : null,
1385
- selected: (g = (p = u.selected) == null ? void 0 : p.row) != null ? g : null,
1386
- ui: { h: o, money: G, note: (y) => _(y), fact: (y, k, x) => w(y, k, x), chips: xe },
1387
- runSql: async (y) => {
1388
- if (!N || !Y()) throw new Error(`${i.title} needs the New Vintage connector.`);
1389
- const k = await Yt(N, y, "Loading a custom card on the Guest Prep page.");
1390
- if (!k.complete) throw new Error("New Vintage returned only a preview for this card.");
1391
- return k.rows;
1594
+ selected: (f = (p = u.selected) == null ? void 0 : p.row) != null ? f : null,
1595
+ ui: { h: i, money: Y, note: (v) => P(v), fact: (v, b, $) => S(v, b, $), chips: Te },
1596
+ runSql: async (v) => {
1597
+ if (!T || !X()) throw new Error(`${o.title} needs the New Vintage connector.`);
1598
+ const b = await rn(T, v, "Loading a custom card on the Guest Prep page.");
1599
+ if (!b.complete) throw new Error("New Vintage returned only a preview for this card.");
1600
+ return b.rows;
1392
1601
  }
1393
1602
  };
1394
1603
  }
1395
- function sn(i) {
1396
- const u = Ke(), p = [f, A != null ? A : "", u.status, u.status === "ready" ? u.loadedAt + u.rows.length : ""].join("|"), g = Ge.get(i.id);
1397
- if (g && g.signature === p) return g.element;
1398
- const y = o("div", null, _("Loading…")), k = o("section", { class: "card custom-card", "data-card": i.id }, o("h2", null, i.title), o("p", { class: "card-purpose" }, i.purpose), y);
1399
- return Ge.set(i.id, { signature: p, element: k }), Promise.resolve().then(() => i.render(an(i))).then((x) => y.replaceChildren(x == null ? _("Nothing to show yet.") : typeof x == "string" ? _(x) : x)).catch((x) => y.replaceChildren(_(`This card couldn't load: ${x instanceof Error ? x.message : String(x)}`, "note problem"))), k;
1604
+ function vn(o) {
1605
+ const u = et(), p = [h, z != null ? z : "", u.status, u.status === "ready" ? u.loadedAt + u.rows.length : ""].join("|"), f = He.get(o.id);
1606
+ if (f && f.signature === p) return f.element;
1607
+ const v = i("div", null, P("Loading…")), b = i("section", { class: "card custom-card", "data-card": o.id }, i("h2", null, o.title), i("p", { class: "card-purpose" }, o.purpose), v);
1608
+ return He.set(o.id, { signature: p, element: b }), Promise.resolve().then(() => o.render(bn(o))).then(($) => v.replaceChildren($ == null ? P("Nothing to show yet.") : typeof $ == "string" ? P($) : $)).catch(($) => v.replaceChildren(P(`This card couldn't load: ${$ instanceof Error ? $.message : String($)}`, "note problem"))), b;
1400
1609
  }
1401
- function Ae(i) {
1610
+ function Pe(o) {
1402
1611
  var p;
1403
- return ((p = t.cards) != null ? p : []).filter((g) => i === null ? !g.after || !(g.after === "summary" || Kt.includes(g.after)) : g.after === i).map(sn);
1612
+ return ((p = t.cards) != null ? p : []).filter((f) => o === null ? !f.after || !(f.after === "summary" || on.includes(f.after)) : f.after === o).map(vn);
1404
1613
  }
1405
- function v() {
1406
- var x, X, K, ie, V, le, vt;
1407
- if (oe) return;
1408
- const i = (K = q != null ? q : (X = (x = document.activeElement) == null ? void 0 : x.getAttribute) == null ? void 0 : X.call(x, "data-fid")) != null ? K : null;
1409
- q = null;
1410
- const u = U.querySelector(".panel"), p = u ? { key: u.getAttribute("data-key"), top: (V = (ie = u.querySelector(".panel-body")) == null ? void 0 : ie.scrollTop) != null ? V : 0 } : null, g = he(), y = Er(g, Q, (ae) => Ae(ae)), k = o(
1614
+ function w() {
1615
+ var pe, H, ge, Tt, Nt, At;
1616
+ if (ue) return;
1617
+ const o = document.activeElement, u = (H = D != null ? D : (pe = o == null ? void 0 : o.getAttribute) == null ? void 0 : pe.call(o, "data-fid")) != null ? H : null, p = !D && o instanceof HTMLInputElement ? [o.selectionStart, o.selectionEnd] : null;
1618
+ D = null;
1619
+ const f = V.querySelector(".panel"), v = f ? { key: f.getAttribute("data-key"), top: (Tt = (ge = f.querySelector(".panel-body")) == null ? void 0 : ge.scrollTop) != null ? Tt : 0 } : null, b = de(), $ = Qr(b, ee, (le) => Pe(le)), oe = i(
1411
1620
  "div",
1412
- { class: `page${R && y ? " sheet-open" : ""}` },
1413
- br(g, Q),
1414
- g.storageNote ? _(g.storageNote, "storage-note") : null,
1415
- vr(g, Q),
1416
- xr(g),
1417
- g.dayState.status === "ready" ? Ae("summary") : null,
1418
- o("div", { class: "layout" }, o("div", { style: "min-width:0" }, $r(g, Q), Ae(null)), y),
1419
- R && y ? o("div", { class: "backdrop", "aria-hidden": "true", onclick: () => Q.closeSheet() }) : null
1621
+ { class: `page${B && $ ? " sheet-open" : ""}` },
1622
+ Lr(b, ee),
1623
+ b.storageNote ? P(b.storageNote, "storage-note") : null,
1624
+ Ir(b, ee),
1625
+ Or(b),
1626
+ b.dayState.status === "ready" ? Pe("summary") : null,
1627
+ i("div", { class: "layout" }, i("div", { style: "min-width:0" }, jr(b, ee), Pe(null)), $),
1628
+ B && $ ? i("div", { class: "backdrop", "aria-hidden": "true", onclick: () => ee.closeSheet() }) : null
1420
1629
  );
1421
- if (U.replaceChildren(k), p && p.key === ((le = g.selected) == null ? void 0 : le.key)) {
1422
- const ae = U.querySelector(".panel-body");
1423
- ae && (ae.scrollTop = p.top);
1630
+ if (V.replaceChildren(oe), v && v.key === ((Nt = b.selected) == null ? void 0 : Nt.key)) {
1631
+ const le = V.querySelector(".panel-body");
1632
+ le && (le.scrollTop = v.top);
1424
1633
  }
1425
- i && ((vt = Array.from(U.querySelectorAll("[data-fid]")).find((ae) => ae.getAttribute("data-fid") === i)) == null || vt.focus()), Ye();
1634
+ const G = u ? Array.from(V.querySelectorAll("[data-fid]")).find((le) => le.getAttribute("data-fid") === u) : null;
1635
+ G == null || G.focus(), p && G instanceof HTMLInputElement && p[0] !== null && G.setSelectionRange(p[0], (At = p[1]) != null ? At : p[0]), Xe();
1426
1636
  }
1427
- async function re(i = f) {
1428
- if (!N || !b || oe) return;
1429
- const u = L;
1430
- if (!Zt.includes(a)) {
1431
- z.set(i, `Guest Prep can't load days in the ${a} time zone yet. Ask in this chat to set the winery's time zone.`), v();
1637
+ async function ie(o = h) {
1638
+ if (!T || !x || ue) return;
1639
+ const u = I;
1640
+ if (!en.includes(s)) {
1641
+ j.set(o, `Guest Prep can't load days in the ${s} time zone yet. Ask in this chat to set the winery's time zone.`), w();
1432
1642
  return;
1433
1643
  }
1434
- D.add(i), z.delete(i), v();
1644
+ Z.add(o), j.delete(o), w();
1435
1645
  try {
1436
- O || (O = await At(N, J ? null : l), J = !0);
1437
- const p = await _t(N, O, { timeZone: a, day: i });
1438
- if (u !== L) return;
1439
- B.set(i, { rows: p, loadedAt: n().toISOString(), live: !0 });
1646
+ q || (q = await It(T, F ? null : d), F = !0);
1647
+ const p = await Ot(T, q, { timeZone: s, day: o });
1648
+ if (u !== I) return;
1649
+ O.set(o, { rows: p, loadedAt: n().toISOString(), live: !0 });
1440
1650
  } catch (p) {
1441
- if (u !== L) return;
1442
- z.set(i, Ee(ue(p)));
1651
+ if (u !== I) return;
1652
+ j.set(o, qe(ye(p)));
1443
1653
  } finally {
1444
- u === L && D.delete(i), v();
1654
+ u === I && Z.delete(o), w();
1445
1655
  }
1446
1656
  }
1447
- async function on() {
1448
- const i = he().selected;
1449
- if (!i || !N || !b || ($ == null ? void 0 : $.status) === "pending") return;
1450
- const u = f, p = L;
1451
- $ = { key: i.key, status: "pending" }, v();
1657
+ async function xn() {
1658
+ const o = de().selected;
1659
+ if (!o || !T || !x || (E == null ? void 0 : E.status) === "pending") return;
1660
+ const u = h, p = I;
1661
+ E = { key: o.key, status: "pending" }, w();
1452
1662
  try {
1453
- O || (O = await At(N, J ? null : l), J = !0);
1454
- const g = i.id.replace(/[^A-Za-z0-9-]/g, ""), y = await _t(N, O, { timeZone: a, day: u, arrival: { source: i.source, id: g } });
1455
- if (p !== L) return;
1456
- const k = Ne(u);
1457
- if (k) {
1458
- const x = (V) => {
1459
- var le;
1460
- return `${V.source === "tock" ? "tock" : "commerce7"}:${String((le = V.arr_id) != null ? le : "")}`;
1461
- }, X = y.filter((V) => x(V) === i.key), K = [];
1462
- let ie = !1;
1463
- for (const V of k.rows)
1464
- x(V) !== i.key ? K.push(V) : ie || (K.push(...X), ie = !0);
1465
- B.set(u, { rows: K, loadedAt: k.loadedAt, live: k.live });
1663
+ q || (q = await It(T, F ? null : d), F = !0);
1664
+ const f = o.id.replace(/[^A-Za-z0-9-]/g, ""), v = await Ot(T, q, { timeZone: s, day: u, arrival: { source: o.source, id: f } });
1665
+ if (p !== I) return;
1666
+ const b = ze(u);
1667
+ if (b) {
1668
+ const $ = (H) => {
1669
+ var ge;
1670
+ return `${H.source === "tock" ? "tock" : "commerce7"}:${String((ge = H.arr_id) != null ? ge : "")}`;
1671
+ }, oe = v.filter((H) => $(H) === o.key), G = [];
1672
+ let pe = !1;
1673
+ for (const H of b.rows)
1674
+ $(H) !== o.key ? G.push(H) : pe || (G.push(...oe), pe = !0);
1675
+ O.set(u, { rows: G, loadedAt: b.loadedAt, live: b.live });
1466
1676
  }
1467
- $ = null;
1468
- } catch (g) {
1469
- if (p !== L) return;
1470
- $ = { key: i.key, status: "failed", message: Ee(ue(g)) };
1677
+ E = null;
1678
+ } catch (f) {
1679
+ if (p !== I) return;
1680
+ E = { key: o.key, status: "failed", message: qe(ye(f)) };
1471
1681
  }
1472
- v();
1682
+ w();
1473
1683
  }
1474
- async function ln() {
1684
+ async function wn() {
1475
1685
  var p;
1476
- if (!b || ((p = h.get(f)) == null ? void 0 : p.kind) === "pending") return;
1477
- const i = f;
1478
- h.set(i, { kind: "pending" }), v();
1479
- const u = await mn(Zn({ day: i, wineryName: F, tenantId: b, timeZone: a }), { title: Fn, followUp: t.followUp });
1480
- h.set(i, u), v();
1686
+ if (!x || ((p = g.get(h)) == null ? void 0 : p.kind) === "pending") return;
1687
+ const o = h;
1688
+ g.set(o, { kind: "pending" }), w();
1689
+ const u = await Mn(or({ day: o, wineryName: y, tenantId: x, timeZone: s }), { title: ir, followUp: t.followUp });
1690
+ g.set(o, u), w();
1481
1691
  }
1482
- async function cn(i) {
1692
+ async function kn(o) {
1483
1693
  var u, p;
1484
- !Z || !i || i === b || (L += 1, b = i, F = (p = (u = C == null ? void 0 : C.find((g) => g.tenantId === i)) == null ? void 0 : u.name) != null ? p : F, N = _e(Z, i), B.clear(), z.clear(), D.clear(), A = null, $ = null, await Ot(d.adapter, zt, i), v(), await re());
1694
+ !C || !o || o === x || (I += 1, x = o, y = (p = (u = _ == null ? void 0 : _.find((f) => f.tenantId === o)) == null ? void 0 : u.name) != null ? p : y, T = Le(C, o), O.clear(), j.clear(), Z.clear(), z = null, E = null, te = [], await Zt(m.adapter, jt, o), w(), await ie());
1485
1695
  }
1486
- async function Qe() {
1487
- var u, p, g;
1488
- I = !0, H = null, v();
1489
- const i = t.tenantId ? null : await It(d.adapter, zt);
1490
- if (Z = (u = t.callTool) != null ? u : await pn(t.connectorName), !oe) {
1491
- if (!Z) {
1492
- I = !1, b || (H = ke() === "claude" ? "Picking a winery needs the New Vintage connector. Add it in this chat, then reload the page." : "Ask in the chat which winery this page is for."), await Je(), v();
1696
+ async function rt() {
1697
+ var u, p, f;
1698
+ L = !0, Q = null, w();
1699
+ const o = t.tenantId ? null : await Ft(m.adapter, jt);
1700
+ if (C = (u = t.callTool) != null ? u : await Tn(t.connectorName), !ue) {
1701
+ if (!C) {
1702
+ L = !1, x || (Q = Ae() === "claude" ? "Picking a winery needs the New Vintage connector. Add it in this chat, then reload the page." : "Ask in the chat which winery this page is for."), await nt(), w();
1493
1703
  return;
1494
1704
  }
1495
- if (!b) {
1705
+ if (!x) {
1496
1706
  try {
1497
- C = await Cn(_e(Z, null));
1498
- } catch (k) {
1499
- I = !1, H = Ee(ue(k)), v();
1707
+ _ = await Gn(Le(C, null));
1708
+ } catch (b) {
1709
+ L = !1, Q = qe(ye(b)), w();
1500
1710
  return;
1501
1711
  }
1502
- const y = (p = C.find((k) => k.tenantId === i)) != null ? p : C.length === 1 ? C[0] : null;
1503
- if (!y) {
1504
- I = !1, H = C.length ? null : "The New Vintage connector can't reach any winery for this account.", v();
1712
+ const v = (p = _.find((b) => b.tenantId === o)) != null ? p : _.length === 1 ? _[0] : null;
1713
+ if (!v) {
1714
+ L = !1, Q = _.length ? null : "The New Vintage connector can't reach any winery for this account.", w();
1505
1715
  return;
1506
1716
  }
1507
- b = y.tenantId, F = (g = t.wineryName) != null ? g : y.name;
1717
+ x = v.tenantId, y = (f = t.wineryName) != null ? f : v.name;
1508
1718
  }
1509
- N = _e(Z, b), await Je(), I = !1, await re(), !oe && !me && (me = setInterval(() => void (Y() && !D.has(f) ? re() : void 0), Gt));
1719
+ T = Le(C, x), await nt(), L = !1, await ie(), !ue && !ke && (ke = setInterval(() => void (X() && !Z.has(h) ? ie() : void 0), Jt));
1510
1720
  }
1511
1721
  }
1512
- function Xe() {
1513
- const i = 6e4 - n().getTime() % 6e4 + 50;
1514
- Te = setTimeout(() => {
1515
- S = m().day, v(), Xe();
1516
- }, i);
1722
+ function at() {
1723
+ const o = 6e4 - n().getTime() % 6e4 + 50;
1724
+ Ce = setTimeout(() => {
1725
+ k = M().day, w(), at();
1726
+ }, o);
1517
1727
  }
1518
- return v(), Xe(), Qe(), {
1519
- refresh: () => Y() ? re() : Promise.resolve(),
1728
+ return w(), at(), rt(), {
1729
+ refresh: () => X() ? ie() : Promise.resolve(),
1520
1730
  destroy: () => {
1521
- oe = !0, Te && clearTimeout(Te), me && clearInterval(me), window.removeEventListener("resize", Ze), document.removeEventListener("keydown", Be), document.removeEventListener("mousedown", He), Fe.remove(), je.remove(), U.remove();
1731
+ ue = !0, Ce && clearTimeout(Ce), ke && clearInterval(ke), window.removeEventListener("resize", Ke), document.removeEventListener("keydown", Je), document.removeEventListener("mousedown", Qe), We.remove(), Ye.remove(), V.remove();
1522
1732
  },
1523
1733
  state: () => {
1524
1734
  var u, p;
1525
- const i = he();
1526
- return { day: f, tenantId: b, live: Y(), selected: (p = (u = i.selected) == null ? void 0 : u.key) != null ? p : null, status: i.dayState.status };
1735
+ const o = de();
1736
+ return { day: h, tenantId: x, live: X(), selected: (p = (u = o.selected) == null ? void 0 : u.key) != null ? p : null, status: o.dayState.status };
1527
1737
  }
1528
1738
  };
1529
1739
  }
1530
- function Pr(e, t) {
1740
+ function ta(e, t) {
1531
1741
  const n = typeof e == "string" ? document.querySelector(e) : e;
1532
1742
  if (!n) throw new Error(`NVGuestPrep: no element matches ${String(e)}`);
1533
- return Lr(n, t);
1743
+ return Xr(n, t);
1534
1744
  }
1535
1745
  export {
1536
- ye as DEFAULT_SETTINGS,
1537
- zr as SECTION_IDS,
1538
- Zt as SUPPORTED_TIME_ZONES,
1539
- Bn as VERSION,
1540
- xn as fillGuestPrepQuery,
1541
- Pr as mount,
1542
- Hn as pageSetup
1746
+ he as DEFAULT_SETTINGS,
1747
+ ea as SECTION_IDS,
1748
+ en as SUPPORTED_TIME_ZONES,
1749
+ lr as VERSION,
1750
+ Pn as fillGuestPrepQuery,
1751
+ ta as mount,
1752
+ cr as pageSetup
1543
1753
  };