@gymmymac/bob-widget 1.1.0 → 1.1.3

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.
package/dist/index.mjs CHANGED
@@ -1,12 +1,8 @@
1
- var sr = (e) => {
2
- throw TypeError(e);
3
- };
4
- var $t = (e, t, s) => t.has(e) || sr("Cannot " + s);
5
- var o = (e, t, s) => ($t(e, t, "read from private field"), s ? s.call(e) : t.get(e)), z = (e, t, s) => t.has(e) ? sr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), F = (e, t, s, n) => ($t(e, t, "write to private field"), n ? n.call(e, s) : t.set(e, s), s), Z = (e, t, s) => ($t(e, t, "access private method"), s);
6
- import * as we from "react";
7
- import Tt, { createContext as Lr, useMemo as Ft, useContext as Mr, useState as Q, useRef as H, useEffect as se, useCallback as G } from "react";
8
- import { createClient as Fr } from "@supabase/supabase-js";
9
- var Wt = { exports: {} }, wt = {};
1
+ import He, { createContext as Tt, useMemo as rt, useContext as Et, useState as U, useRef as V, useEffect as X, useCallback as q } from "react";
2
+ import { createClient as jt } from "@supabase/supabase-js";
3
+ import { useQueryClient as Rt, useQuery as ht } from "@tanstack/react-query";
4
+ const gt = "1.1.3", Gt = () => gt;
5
+ var it = { exports: {} }, Ye = {};
10
6
  /**
11
7
  * @license React
12
8
  * react-jsx-runtime.production.min.js
@@ -16,21 +12,21 @@ var Wt = { exports: {} }, wt = {};
16
12
  * This source code is licensed under the MIT license found in the
17
13
  * LICENSE file in the root directory of this source tree.
18
14
  */
19
- var nr;
20
- function Br() {
21
- if (nr) return wt;
22
- nr = 1;
23
- var e = Tt, t = Symbol.for("react.element"), s = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
24
- function u(g, d, y) {
25
- var h, l = {}, v = null, w = null;
26
- y !== void 0 && (v = "" + y), d.key !== void 0 && (v = "" + d.key), d.ref !== void 0 && (w = d.ref);
27
- for (h in d) n.call(d, h) && !f.hasOwnProperty(h) && (l[h] = d[h]);
28
- if (g && g.defaultProps) for (h in d = g.defaultProps, d) l[h] === void 0 && (l[h] = d[h]);
29
- return { $$typeof: t, type: g, key: v, ref: w, props: l, _owner: i.current };
15
+ var ct;
16
+ function Ct() {
17
+ if (ct) return Ye;
18
+ ct = 1;
19
+ var n = He, l = Symbol.for("react.element"), i = Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, d = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function b(E, g, x) {
21
+ var u, p = {}, h = null, j = null;
22
+ x !== void 0 && (h = "" + x), g.key !== void 0 && (h = "" + g.key), g.ref !== void 0 && (j = g.ref);
23
+ for (u in g) f.call(g, u) && !_.hasOwnProperty(u) && (p[u] = g[u]);
24
+ if (E && E.defaultProps) for (u in g = E.defaultProps, g) p[u] === void 0 && (p[u] = g[u]);
25
+ return { $$typeof: l, type: E, key: h, ref: j, props: p, _owner: d.current };
30
26
  }
31
- return wt.Fragment = s, wt.jsx = u, wt.jsxs = u, wt;
27
+ return Ye.Fragment = i, Ye.jsx = b, Ye.jsxs = b, Ye;
32
28
  }
33
- var Et = {};
29
+ var Ge = {};
34
30
  /**
35
31
  * @license React
36
32
  * react-jsx-runtime.development.js
@@ -40,91 +36,91 @@ var Et = {};
40
36
  * This source code is licensed under the MIT license found in the
41
37
  * LICENSE file in the root directory of this source tree.
42
38
  */
43
- var ir;
44
- function Ar() {
45
- return ir || (ir = 1, process.env.NODE_ENV !== "production" && function() {
46
- var e = Tt, t = Symbol.for("react.element"), s = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), g = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), k = Symbol.iterator, N = "@@iterator";
47
- function _(r) {
48
- if (r === null || typeof r != "object")
39
+ var ut;
40
+ function kt() {
41
+ return ut || (ut = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var n = He, l = Symbol.for("react.element"), i = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), E = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), C = Symbol.iterator, P = "@@iterator";
43
+ function R(e) {
44
+ if (e === null || typeof e != "object")
49
45
  return null;
50
- var c = k && r[k] || r[N];
51
- return typeof c == "function" ? c : null;
46
+ var r = C && e[C] || e[P];
47
+ return typeof r == "function" ? r : null;
52
48
  }
53
- var I = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54
- function p(r) {
49
+ var I = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function s(e) {
55
51
  {
56
- for (var c = arguments.length, x = new Array(c > 1 ? c - 1 : 0), O = 1; O < c; O++)
57
- x[O - 1] = arguments[O];
58
- E("error", r, x);
52
+ for (var r = arguments.length, c = new Array(r > 1 ? r - 1 : 0), T = 1; T < r; T++)
53
+ c[T - 1] = arguments[T];
54
+ m("error", e, c);
59
55
  }
60
56
  }
61
- function E(r, c, x) {
57
+ function m(e, r, c) {
62
58
  {
63
- var O = I.ReactDebugCurrentFrame, W = O.getStackAddendum();
64
- W !== "" && (c += "%s", x = x.concat([W]));
65
- var q = x.map(function($) {
66
- return String($);
59
+ var T = I.ReactDebugCurrentFrame, D = T.getStackAddendum();
60
+ D !== "" && (r += "%s", c = c.concat([D]));
61
+ var W = c.map(function(A) {
62
+ return String(A);
67
63
  });
68
- q.unshift("Warning: " + c), Function.prototype.apply.call(console[r], console, q);
64
+ W.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, W);
69
65
  }
70
66
  }
71
- var T = !1, b = !1, m = !1, S = !1, C = !1, P;
72
- P = Symbol.for("react.module.reference");
73
- function j(r) {
74
- return !!(typeof r == "string" || typeof r == "function" || r === n || r === f || C || r === i || r === y || r === h || S || r === w || T || b || m || typeof r == "object" && r !== null && (r.$$typeof === v || r.$$typeof === l || r.$$typeof === u || r.$$typeof === g || r.$$typeof === d || // This needs to include all possible module reference object
67
+ var v = !1, a = !1, o = !1, w = !1, k = !1, N;
68
+ N = Symbol.for("react.module.reference");
69
+ function O(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === f || e === _ || k || e === d || e === x || e === u || w || e === j || v || a || o || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === p || e.$$typeof === b || e.$$typeof === E || e.$$typeof === g || // This needs to include all possible module reference object
75
71
  // types supported by any Flight configuration anywhere since
76
72
  // we don't know which Flight build this will end up being used
77
73
  // with.
78
- r.$$typeof === P || r.getModuleId !== void 0));
74
+ e.$$typeof === N || e.getModuleId !== void 0));
79
75
  }
80
- function R(r, c, x) {
81
- var O = r.displayName;
82
- if (O)
83
- return O;
84
- var W = c.displayName || c.name || "";
85
- return W !== "" ? x + "(" + W + ")" : x;
76
+ function y(e, r, c) {
77
+ var T = e.displayName;
78
+ if (T)
79
+ return T;
80
+ var D = r.displayName || r.name || "";
81
+ return D !== "" ? c + "(" + D + ")" : c;
86
82
  }
87
- function M(r) {
88
- return r.displayName || "Context";
83
+ function M(e) {
84
+ return e.displayName || "Context";
89
85
  }
90
- function A(r) {
91
- if (r == null)
86
+ function $(e) {
87
+ if (e == null)
92
88
  return null;
93
- if (typeof r.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
94
- return r.displayName || r.name || null;
95
- if (typeof r == "string")
96
- return r;
97
- switch (r) {
98
- case n:
89
+ if (typeof e.tag == "number" && s("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
90
+ return e.displayName || e.name || null;
91
+ if (typeof e == "string")
92
+ return e;
93
+ switch (e) {
94
+ case f:
99
95
  return "Fragment";
100
- case s:
96
+ case i:
101
97
  return "Portal";
102
- case f:
98
+ case _:
103
99
  return "Profiler";
104
- case i:
100
+ case d:
105
101
  return "StrictMode";
106
- case y:
102
+ case x:
107
103
  return "Suspense";
108
- case h:
104
+ case u:
109
105
  return "SuspenseList";
110
106
  }
111
- if (typeof r == "object")
112
- switch (r.$$typeof) {
107
+ if (typeof e == "object")
108
+ switch (e.$$typeof) {
109
+ case E:
110
+ var r = e;
111
+ return M(r) + ".Consumer";
112
+ case b:
113
+ var c = e;
114
+ return M(c._context) + ".Provider";
113
115
  case g:
114
- var c = r;
115
- return M(c) + ".Consumer";
116
- case u:
117
- var x = r;
118
- return M(x._context) + ".Provider";
119
- case d:
120
- return R(r, r.render, "ForwardRef");
121
- case l:
122
- var O = r.displayName || null;
123
- return O !== null ? O : A(r.type) || "Memo";
124
- case v: {
125
- var W = r, q = W._payload, $ = W._init;
116
+ return y(e, e.render, "ForwardRef");
117
+ case p:
118
+ var T = e.displayName || null;
119
+ return T !== null ? T : $(e.type) || "Memo";
120
+ case h: {
121
+ var D = e, W = D._payload, A = D._init;
126
122
  try {
127
- return A($(q));
123
+ return $(A(W));
128
124
  } catch {
129
125
  return null;
130
126
  }
@@ -132,636 +128,647 @@ function Ar() {
132
128
  }
133
129
  return null;
134
130
  }
135
- var L = Object.assign, te = 0, Re, K, oe, ue, je, J, Ae;
136
- function kt() {
131
+ var S = Object.assign, H = 0, ge, F, ee, re, be, K, Ee;
132
+ function Je() {
137
133
  }
138
- kt.__reactDisabledLog = !0;
139
- function pe() {
134
+ Je.__reactDisabledLog = !0;
135
+ function ie() {
140
136
  {
141
- if (te === 0) {
142
- Re = console.log, K = console.info, oe = console.warn, ue = console.error, je = console.group, J = console.groupCollapsed, Ae = console.groupEnd;
143
- var r = {
137
+ if (H === 0) {
138
+ ge = console.log, F = console.info, ee = console.warn, re = console.error, be = console.group, K = console.groupCollapsed, Ee = console.groupEnd;
139
+ var e = {
144
140
  configurable: !0,
145
141
  enumerable: !0,
146
- value: kt,
142
+ value: Je,
147
143
  writable: !0
148
144
  };
149
145
  Object.defineProperties(console, {
150
- info: r,
151
- log: r,
152
- warn: r,
153
- error: r,
154
- group: r,
155
- groupCollapsed: r,
156
- groupEnd: r
146
+ info: e,
147
+ log: e,
148
+ warn: e,
149
+ error: e,
150
+ group: e,
151
+ groupCollapsed: e,
152
+ groupEnd: e
157
153
  });
158
154
  }
159
- te++;
155
+ H++;
160
156
  }
161
157
  }
162
- function Bt() {
158
+ function nt() {
163
159
  {
164
- if (te--, te === 0) {
165
- var r = {
160
+ if (H--, H === 0) {
161
+ var e = {
166
162
  configurable: !0,
167
163
  enumerable: !0,
168
164
  writable: !0
169
165
  };
170
166
  Object.defineProperties(console, {
171
- log: L({}, r, {
172
- value: Re
167
+ log: S({}, e, {
168
+ value: ge
173
169
  }),
174
- info: L({}, r, {
175
- value: K
170
+ info: S({}, e, {
171
+ value: F
176
172
  }),
177
- warn: L({}, r, {
178
- value: oe
173
+ warn: S({}, e, {
174
+ value: ee
179
175
  }),
180
- error: L({}, r, {
181
- value: ue
176
+ error: S({}, e, {
177
+ value: re
182
178
  }),
183
- group: L({}, r, {
184
- value: je
179
+ group: S({}, e, {
180
+ value: be
185
181
  }),
186
- groupCollapsed: L({}, r, {
187
- value: J
182
+ groupCollapsed: S({}, e, {
183
+ value: K
188
184
  }),
189
- groupEnd: L({}, r, {
190
- value: Ae
185
+ groupEnd: S({}, e, {
186
+ value: Ee
191
187
  })
192
188
  });
193
189
  }
194
- te < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ H < 0 && s("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
191
  }
196
192
  }
197
- var tt = I.ReactCurrentDispatcher, Ot;
198
- function pt(r, c, x) {
193
+ var Ae = I.ReactCurrentDispatcher, Xe;
194
+ function Fe(e, r, c) {
199
195
  {
200
- if (Ot === void 0)
196
+ if (Xe === void 0)
201
197
  try {
202
198
  throw Error();
203
- } catch (W) {
204
- var O = W.stack.trim().match(/\n( *(at )?)/);
205
- Ot = O && O[1] || "";
199
+ } catch (D) {
200
+ var T = D.stack.trim().match(/\n( *(at )?)/);
201
+ Xe = T && T[1] || "";
206
202
  }
207
203
  return `
208
- ` + Ot + r;
204
+ ` + Xe + e;
209
205
  }
210
206
  }
211
- var It = !1, gt;
207
+ var Qe = !1, We;
212
208
  {
213
- var rr = typeof WeakMap == "function" ? WeakMap : Map;
214
- gt = new rr();
209
+ var lt = typeof WeakMap == "function" ? WeakMap : Map;
210
+ We = new lt();
215
211
  }
216
- function At(r, c) {
217
- if (!r || It)
212
+ function st(e, r) {
213
+ if (!e || Qe)
218
214
  return "";
219
215
  {
220
- var x = gt.get(r);
221
- if (x !== void 0)
222
- return x;
216
+ var c = We.get(e);
217
+ if (c !== void 0)
218
+ return c;
223
219
  }
224
- var O;
225
- It = !0;
226
- var W = Error.prepareStackTrace;
220
+ var T;
221
+ Qe = !0;
222
+ var D = Error.prepareStackTrace;
227
223
  Error.prepareStackTrace = void 0;
228
- var q;
229
- q = tt.current, tt.current = null, pe();
224
+ var W;
225
+ W = Ae.current, Ae.current = null, ie();
230
226
  try {
231
- if (c) {
232
- var $ = function() {
227
+ if (r) {
228
+ var A = function() {
233
229
  throw Error();
234
230
  };
235
- if (Object.defineProperty($.prototype, "props", {
231
+ if (Object.defineProperty(A.prototype, "props", {
236
232
  set: function() {
237
233
  throw Error();
238
234
  }
239
235
  }), typeof Reflect == "object" && Reflect.construct) {
240
236
  try {
241
- Reflect.construct($, []);
242
- } catch (ce) {
243
- O = ce;
237
+ Reflect.construct(A, []);
238
+ } catch (te) {
239
+ T = te;
244
240
  }
245
- Reflect.construct(r, [], $);
241
+ Reflect.construct(e, [], A);
246
242
  } else {
247
243
  try {
248
- $.call();
249
- } catch (ce) {
250
- O = ce;
244
+ A.call();
245
+ } catch (te) {
246
+ T = te;
251
247
  }
252
- r.call($.prototype);
248
+ e.call(A.prototype);
253
249
  }
254
250
  } else {
255
251
  try {
256
252
  throw Error();
257
- } catch (ce) {
258
- O = ce;
253
+ } catch (te) {
254
+ T = te;
259
255
  }
260
- r();
256
+ e();
261
257
  }
262
- } catch (ce) {
263
- if (ce && O && typeof ce.stack == "string") {
264
- for (var B = ce.stack.split(`
265
- `), ie = O.stack.split(`
266
- `), Y = B.length - 1, X = ie.length - 1; Y >= 1 && X >= 0 && B[Y] !== ie[X]; )
267
- X--;
268
- for (; Y >= 1 && X >= 0; Y--, X--)
269
- if (B[Y] !== ie[X]) {
270
- if (Y !== 1 || X !== 1)
258
+ } catch (te) {
259
+ if (te && T && typeof te.stack == "string") {
260
+ for (var L = te.stack.split(`
261
+ `), Z = T.stack.split(`
262
+ `), z = L.length - 1, Y = Z.length - 1; z >= 1 && Y >= 0 && L[z] !== Z[Y]; )
263
+ Y--;
264
+ for (; z >= 1 && Y >= 0; z--, Y--)
265
+ if (L[z] !== Z[Y]) {
266
+ if (z !== 1 || Y !== 1)
271
267
  do
272
- if (Y--, X--, X < 0 || B[Y] !== ie[X]) {
273
- var he = `
274
- ` + B[Y].replace(" at new ", " at ");
275
- return r.displayName && he.includes("<anonymous>") && (he = he.replace("<anonymous>", r.displayName)), typeof r == "function" && gt.set(r, he), he;
268
+ if (z--, Y--, Y < 0 || L[z] !== Z[Y]) {
269
+ var oe = `
270
+ ` + L[z].replace(" at new ", " at ");
271
+ return e.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", e.displayName)), typeof e == "function" && We.set(e, oe), oe;
276
272
  }
277
- while (Y >= 1 && X >= 0);
273
+ while (z >= 1 && Y >= 0);
278
274
  break;
279
275
  }
280
276
  }
281
277
  } finally {
282
- It = !1, tt.current = q, Bt(), Error.prepareStackTrace = W;
278
+ Qe = !1, Ae.current = W, nt(), Error.prepareStackTrace = D;
283
279
  }
284
- var at = r ? r.displayName || r.name : "", He = at ? pt(at) : "";
285
- return typeof r == "function" && gt.set(r, He), He;
280
+ var De = e ? e.displayName || e.name : "", Pe = De ? Fe(De) : "";
281
+ return typeof e == "function" && We.set(e, Pe), Pe;
286
282
  }
287
- function Nt(r, c, x) {
288
- return At(r, !1);
283
+ function Ze(e, r, c) {
284
+ return st(e, !1);
289
285
  }
290
- function Pt(r) {
291
- var c = r.prototype;
292
- return !!(c && c.isReactComponent);
286
+ function et(e) {
287
+ var r = e.prototype;
288
+ return !!(r && r.isReactComponent);
293
289
  }
294
- function De(r, c, x) {
295
- if (r == null)
290
+ function je(e, r, c) {
291
+ if (e == null)
296
292
  return "";
297
- if (typeof r == "function")
298
- return At(r, Pt(r));
299
- if (typeof r == "string")
300
- return pt(r);
301
- switch (r) {
302
- case y:
303
- return pt("Suspense");
304
- case h:
305
- return pt("SuspenseList");
293
+ if (typeof e == "function")
294
+ return st(e, et(e));
295
+ if (typeof e == "string")
296
+ return Fe(e);
297
+ switch (e) {
298
+ case x:
299
+ return Fe("Suspense");
300
+ case u:
301
+ return Fe("SuspenseList");
306
302
  }
307
- if (typeof r == "object")
308
- switch (r.$$typeof) {
309
- case d:
310
- return Nt(r.render);
311
- case l:
312
- return De(r.type, c, x);
313
- case v: {
314
- var O = r, W = O._payload, q = O._init;
303
+ if (typeof e == "object")
304
+ switch (e.$$typeof) {
305
+ case g:
306
+ return Ze(e.render);
307
+ case p:
308
+ return je(e.type, r, c);
309
+ case h: {
310
+ var T = e, D = T._payload, W = T._init;
315
311
  try {
316
- return De(q(W), c, x);
312
+ return je(W(D), r, c);
317
313
  } catch {
318
314
  }
319
315
  }
320
316
  }
321
317
  return "";
322
318
  }
323
- var ke = Object.prototype.hasOwnProperty, D = {}, ee = I.ReactDebugCurrentFrame;
324
- function ne(r) {
325
- if (r) {
326
- var c = r._owner, x = De(r.type, r._source, c ? c.type : null);
327
- ee.setExtraStackFrame(x);
319
+ var ve = Object.prototype.hasOwnProperty, B = {}, G = I.ReactDebugCurrentFrame;
320
+ function Q(e) {
321
+ if (e) {
322
+ var r = e._owner, c = je(e.type, e._source, r ? r.type : null);
323
+ G.setExtraStackFrame(c);
328
324
  } else
329
- ee.setExtraStackFrame(null);
325
+ G.setExtraStackFrame(null);
330
326
  }
331
- function rt(r, c, x, O, W) {
327
+ function ne(e, r, c, T, D) {
332
328
  {
333
- var q = Function.call.bind(ke);
334
- for (var $ in r)
335
- if (q(r, $)) {
336
- var B = void 0;
329
+ var W = Function.call.bind(ve);
330
+ for (var A in e)
331
+ if (W(e, A)) {
332
+ var L = void 0;
337
333
  try {
338
- if (typeof r[$] != "function") {
339
- var ie = Error((O || "React class") + ": " + x + " type `" + $ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[$] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
340
- throw ie.name = "Invariant Violation", ie;
334
+ if (typeof e[A] != "function") {
335
+ var Z = Error((T || "React class") + ": " + c + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
+ throw Z.name = "Invariant Violation", Z;
341
337
  }
342
- B = r[$](c, $, O, x, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
343
- } catch (Y) {
344
- B = Y;
338
+ L = e[A](r, A, T, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch (z) {
340
+ L = z;
345
341
  }
346
- B && !(B instanceof Error) && (ne(W), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", O || "React class", x, $, typeof B), ne(null)), B instanceof Error && !(B.message in D) && (D[B.message] = !0, ne(W), p("Failed %s type: %s", x, B.message), ne(null));
342
+ L && !(L instanceof Error) && (Q(D), s("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", T || "React class", c, A, typeof L), Q(null)), L instanceof Error && !(L.message in B) && (B[L.message] = !0, Q(D), s("Failed %s type: %s", c, L.message), Q(null));
347
343
  }
348
344
  }
349
345
  }
350
- var st = Array.isArray;
351
- function Ue(r) {
352
- return st(r);
346
+ var xe = Array.isArray;
347
+ function Re(e) {
348
+ return xe(e);
353
349
  }
354
- function $e(r) {
350
+ function Ce(e) {
355
351
  {
356
- var c = typeof Symbol == "function" && Symbol.toStringTag, x = c && r[Symbol.toStringTag] || r.constructor.name || "Object";
357
- return x;
352
+ var r = typeof Symbol == "function" && Symbol.toStringTag, c = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return c;
358
354
  }
359
355
  }
360
- function We(r) {
356
+ function ke(e) {
361
357
  try {
362
- return Ve(r), !1;
358
+ return Se(e), !1;
363
359
  } catch {
364
360
  return !0;
365
361
  }
366
362
  }
367
- function Ve(r) {
368
- return "" + r;
363
+ function Se(e) {
364
+ return "" + e;
369
365
  }
370
- function Oe(r) {
371
- if (We(r))
372
- return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", $e(r)), Ve(r);
366
+ function ye(e) {
367
+ if (ke(e))
368
+ return s("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ce(e)), Se(e);
373
369
  }
374
- var Ie = I.ReactCurrentOwner, ge = {
370
+ var we = I.ReactCurrentOwner, le = {
375
371
  key: !0,
376
372
  ref: !0,
377
373
  __self: !0,
378
374
  __source: !0
379
- }, Ke, qe;
380
- function Ee(r) {
381
- if (ke.call(r, "ref")) {
382
- var c = Object.getOwnPropertyDescriptor(r, "ref").get;
383
- if (c && c.isReactWarning)
375
+ }, Ie, Ne;
376
+ function pe(e) {
377
+ if (ve.call(e, "ref")) {
378
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (r && r.isReactWarning)
384
380
  return !1;
385
381
  }
386
- return r.ref !== void 0;
382
+ return e.ref !== void 0;
387
383
  }
388
- function be(r) {
389
- if (ke.call(r, "key")) {
390
- var c = Object.getOwnPropertyDescriptor(r, "key").get;
391
- if (c && c.isReactWarning)
384
+ function ce(e) {
385
+ if (ve.call(e, "key")) {
386
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (r && r.isReactWarning)
392
388
  return !1;
393
389
  }
394
- return r.key !== void 0;
390
+ return e.key !== void 0;
395
391
  }
396
- function Se(r, c) {
397
- typeof r.ref == "string" && Ie.current;
392
+ function me(e, r) {
393
+ typeof e.ref == "string" && we.current;
398
394
  }
399
- function ze(r, c) {
395
+ function Oe(e, r) {
400
396
  {
401
- var x = function() {
402
- Ke || (Ke = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
397
+ var c = function() {
398
+ Ie || (Ie = !0, s("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
403
399
  };
404
- x.isReactWarning = !0, Object.defineProperty(r, "key", {
405
- get: x,
400
+ c.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: c,
406
402
  configurable: !0
407
403
  });
408
404
  }
409
405
  }
410
- function me(r, c) {
406
+ function ue(e, r) {
411
407
  {
412
- var x = function() {
413
- qe || (qe = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
408
+ var c = function() {
409
+ Ne || (Ne = !0, s("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
414
410
  };
415
- x.isReactWarning = !0, Object.defineProperty(r, "ref", {
416
- get: x,
411
+ c.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: c,
417
413
  configurable: !0
418
414
  });
419
415
  }
420
416
  }
421
- var de = function(r, c, x, O, W, q, $) {
422
- var B = {
417
+ var se = function(e, r, c, T, D, W, A) {
418
+ var L = {
423
419
  // This tag allows us to uniquely identify this as a React Element
424
- $$typeof: t,
420
+ $$typeof: l,
425
421
  // Built-in properties that belong on the element
426
- type: r,
427
- key: c,
428
- ref: x,
429
- props: $,
422
+ type: e,
423
+ key: r,
424
+ ref: c,
425
+ props: A,
430
426
  // Record the component responsible for creating this element.
431
- _owner: q
427
+ _owner: W
432
428
  };
433
- return B._store = {}, Object.defineProperty(B._store, "validated", {
429
+ return L._store = {}, Object.defineProperty(L._store, "validated", {
434
430
  configurable: !1,
435
431
  enumerable: !1,
436
432
  writable: !0,
437
433
  value: !1
438
- }), Object.defineProperty(B, "_self", {
434
+ }), Object.defineProperty(L, "_self", {
439
435
  configurable: !1,
440
436
  enumerable: !1,
441
437
  writable: !1,
442
- value: O
443
- }), Object.defineProperty(B, "_source", {
438
+ value: T
439
+ }), Object.defineProperty(L, "_source", {
444
440
  configurable: !1,
445
441
  enumerable: !1,
446
442
  writable: !1,
447
- value: W
448
- }), Object.freeze && (Object.freeze(B.props), Object.freeze(B)), B;
443
+ value: D
444
+ }), Object.freeze && (Object.freeze(L.props), Object.freeze(L)), L;
449
445
  };
450
- function ve(r, c, x, O, W) {
446
+ function de(e, r, c, T, D) {
451
447
  {
452
- var q, $ = {}, B = null, ie = null;
453
- x !== void 0 && (Oe(x), B = "" + x), be(c) && (Oe(c.key), B = "" + c.key), Ee(c) && (ie = c.ref, Se(c, W));
454
- for (q in c)
455
- ke.call(c, q) && !ge.hasOwnProperty(q) && ($[q] = c[q]);
456
- if (r && r.defaultProps) {
457
- var Y = r.defaultProps;
458
- for (q in Y)
459
- $[q] === void 0 && ($[q] = Y[q]);
448
+ var W, A = {}, L = null, Z = null;
449
+ c !== void 0 && (ye(c), L = "" + c), ce(r) && (ye(r.key), L = "" + r.key), pe(r) && (Z = r.ref, me(r, D));
450
+ for (W in r)
451
+ ve.call(r, W) && !le.hasOwnProperty(W) && (A[W] = r[W]);
452
+ if (e && e.defaultProps) {
453
+ var z = e.defaultProps;
454
+ for (W in z)
455
+ A[W] === void 0 && (A[W] = z[W]);
460
456
  }
461
- if (B || ie) {
462
- var X = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
463
- B && ze($, X), ie && me($, X);
457
+ if (L || Z) {
458
+ var Y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ L && Oe(A, Y), Z && ue(A, Y);
464
460
  }
465
- return de(r, B, ie, W, O, Ie.current, $);
461
+ return se(e, L, Z, D, T, we.current, A);
466
462
  }
467
463
  }
468
- var _e = I.ReactCurrentOwner, bt = I.ReactDebugCurrentFrame;
469
- function Ne(r) {
470
- if (r) {
471
- var c = r._owner, x = De(r.type, r._source, c ? c.type : null);
472
- bt.setExtraStackFrame(x);
464
+ var he = I.ReactCurrentOwner, Ue = I.ReactDebugCurrentFrame;
465
+ function _e(e) {
466
+ if (e) {
467
+ var r = e._owner, c = je(e.type, e._source, r ? r.type : null);
468
+ Ue.setExtraStackFrame(c);
473
469
  } else
474
- bt.setExtraStackFrame(null);
470
+ Ue.setExtraStackFrame(null);
475
471
  }
476
- var nt;
477
- nt = !1;
478
- function fe(r) {
479
- return typeof r == "object" && r !== null && r.$$typeof === t;
472
+ var Me;
473
+ Me = !1;
474
+ function ae(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === l;
480
476
  }
481
- function Pe() {
477
+ function Te() {
482
478
  {
483
- if (_e.current) {
484
- var r = A(_e.current.type);
485
- if (r)
479
+ if (he.current) {
480
+ var e = $(he.current.type);
481
+ if (e)
486
482
  return `
487
483
 
488
- Check the render method of \`` + r + "`.";
484
+ Check the render method of \`` + e + "`.";
489
485
  }
490
486
  return "";
491
487
  }
492
488
  }
493
- function mt(r) {
489
+ function Ve(e) {
494
490
  return "";
495
491
  }
496
- var ye = {};
497
- function Lt(r) {
492
+ var fe = {};
493
+ function tt(e) {
498
494
  {
499
- var c = Pe();
500
- if (!c) {
501
- var x = typeof r == "string" ? r : r.displayName || r.name;
502
- x && (c = `
495
+ var r = Te();
496
+ if (!r) {
497
+ var c = typeof e == "string" ? e : e.displayName || e.name;
498
+ c && (r = `
503
499
 
504
- Check the top-level render call using <` + x + ">.");
500
+ Check the top-level render call using <` + c + ">.");
505
501
  }
506
- return c;
502
+ return r;
507
503
  }
508
504
  }
509
- function re(r, c) {
505
+ function J(e, r) {
510
506
  {
511
- if (!r._store || r._store.validated || r.key != null)
507
+ if (!e._store || e._store.validated || e.key != null)
512
508
  return;
513
- r._store.validated = !0;
514
- var x = Lt(c);
515
- if (ye[x])
509
+ e._store.validated = !0;
510
+ var c = tt(r);
511
+ if (fe[c])
516
512
  return;
517
- ye[x] = !0;
518
- var O = "";
519
- r && r._owner && r._owner !== _e.current && (O = " It was passed a child from " + A(r._owner.type) + "."), Ne(r), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', x, O), Ne(null);
513
+ fe[c] = !0;
514
+ var T = "";
515
+ e && e._owner && e._owner !== he.current && (T = " It was passed a child from " + $(e._owner.type) + "."), _e(e), s('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, T), _e(null);
520
516
  }
521
517
  }
522
- function vt(r, c) {
518
+ function Ke(e, r) {
523
519
  {
524
- if (typeof r != "object")
520
+ if (typeof e != "object")
525
521
  return;
526
- if (Ue(r))
527
- for (var x = 0; x < r.length; x++) {
528
- var O = r[x];
529
- fe(O) && re(O, c);
522
+ if (Re(e))
523
+ for (var c = 0; c < e.length; c++) {
524
+ var T = e[c];
525
+ ae(T) && J(T, r);
530
526
  }
531
- else if (fe(r))
532
- r._store && (r._store.validated = !0);
533
- else if (r) {
534
- var W = _(r);
535
- if (typeof W == "function" && W !== r.entries)
536
- for (var q = W.call(r), $; !($ = q.next()).done; )
537
- fe($.value) && re($.value, c);
527
+ else if (ae(e))
528
+ e._store && (e._store.validated = !0);
529
+ else if (e) {
530
+ var D = R(e);
531
+ if (typeof D == "function" && D !== e.entries)
532
+ for (var W = D.call(e), A; !(A = W.next()).done; )
533
+ ae(A.value) && J(A.value, r);
538
534
  }
539
535
  }
540
536
  }
541
- function yt(r) {
537
+ function ze(e) {
542
538
  {
543
- var c = r.type;
544
- if (c == null || typeof c == "string")
539
+ var r = e.type;
540
+ if (r == null || typeof r == "string")
545
541
  return;
546
- var x;
547
- if (typeof c == "function")
548
- x = c.propTypes;
549
- else if (typeof c == "object" && (c.$$typeof === d || // Note: Memo only checks outer props here.
542
+ var c;
543
+ if (typeof r == "function")
544
+ c = r.propTypes;
545
+ else if (typeof r == "object" && (r.$$typeof === g || // Note: Memo only checks outer props here.
550
546
  // Inner props are checked in the reconciler.
551
- c.$$typeof === l))
552
- x = c.propTypes;
547
+ r.$$typeof === p))
548
+ c = r.propTypes;
553
549
  else
554
550
  return;
555
- if (x) {
556
- var O = A(c);
557
- rt(x, r.props, "prop", O, r);
558
- } else if (c.PropTypes !== void 0 && !nt) {
559
- nt = !0;
560
- var W = A(c);
561
- p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", W || "Unknown");
551
+ if (c) {
552
+ var T = $(r);
553
+ ne(c, e.props, "prop", T, e);
554
+ } else if (r.PropTypes !== void 0 && !Me) {
555
+ Me = !0;
556
+ var D = $(r);
557
+ s("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
562
558
  }
563
- typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && s("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
564
560
  }
565
561
  }
566
- function Qe(r) {
562
+ function Le(e) {
567
563
  {
568
- for (var c = Object.keys(r.props), x = 0; x < c.length; x++) {
569
- var O = c[x];
570
- if (O !== "children" && O !== "key") {
571
- Ne(r), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), Ne(null);
564
+ for (var r = Object.keys(e.props), c = 0; c < r.length; c++) {
565
+ var T = r[c];
566
+ if (T !== "children" && T !== "key") {
567
+ _e(e), s("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", T), _e(null);
572
568
  break;
573
569
  }
574
570
  }
575
- r.ref !== null && (Ne(r), p("Invalid attribute `ref` supplied to `React.Fragment`."), Ne(null));
571
+ e.ref !== null && (_e(e), s("Invalid attribute `ref` supplied to `React.Fragment`."), _e(null));
576
572
  }
577
573
  }
578
- var it = {};
579
- function xt(r, c, x, O, W, q) {
574
+ var $e = {};
575
+ function qe(e, r, c, T, D, W) {
580
576
  {
581
- var $ = j(r);
582
- if (!$) {
583
- var B = "";
584
- (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (B += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
585
- var ie = mt();
586
- ie ? B += ie : B += Pe();
587
- var Y;
588
- r === null ? Y = "null" : Ue(r) ? Y = "array" : r !== void 0 && r.$$typeof === t ? (Y = "<" + (A(r.type) || "Unknown") + " />", B = " Did you accidentally export a JSX literal instead of a component?") : Y = typeof r, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Y, B);
577
+ var A = O(e);
578
+ if (!A) {
579
+ var L = "";
580
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (L += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
+ var Z = Ve();
582
+ Z ? L += Z : L += Te();
583
+ var z;
584
+ e === null ? z = "null" : Re(e) ? z = "array" : e !== void 0 && e.$$typeof === l ? (z = "<" + ($(e.type) || "Unknown") + " />", L = " Did you accidentally export a JSX literal instead of a component?") : z = typeof e, s("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", z, L);
589
585
  }
590
- var X = ve(r, c, x, W, q);
591
- if (X == null)
592
- return X;
593
- if ($) {
594
- var he = c.children;
595
- if (he !== void 0)
596
- if (O)
597
- if (Ue(he)) {
598
- for (var at = 0; at < he.length; at++)
599
- vt(he[at], r);
600
- Object.freeze && Object.freeze(he);
586
+ var Y = de(e, r, c, D, W);
587
+ if (Y == null)
588
+ return Y;
589
+ if (A) {
590
+ var oe = r.children;
591
+ if (oe !== void 0)
592
+ if (T)
593
+ if (Re(oe)) {
594
+ for (var De = 0; De < oe.length; De++)
595
+ Ke(oe[De], e);
596
+ Object.freeze && Object.freeze(oe);
601
597
  } else
602
- p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
+ s("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
603
599
  else
604
- vt(he, r);
600
+ Ke(oe, e);
605
601
  }
606
- if (ke.call(c, "key")) {
607
- var He = A(r), ce = Object.keys(c).filter(function(Pr) {
608
- return Pr !== "key";
609
- }), Ut = ce.length > 0 ? "{key: someKey, " + ce.join(": ..., ") + ": ...}" : "{key: someKey}";
610
- if (!it[He + Ut]) {
611
- var Nr = ce.length > 0 ? "{" + ce.join(": ..., ") + ": ...}" : "{}";
612
- p(`A props object containing a "key" prop is being spread into JSX:
602
+ if (ve.call(r, "key")) {
603
+ var Pe = $(e), te = Object.keys(r).filter(function(_t) {
604
+ return _t !== "key";
605
+ }), ot = te.length > 0 ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!$e[Pe + ot]) {
607
+ var wt = te.length > 0 ? "{" + te.join(": ..., ") + ": ...}" : "{}";
608
+ s(`A props object containing a "key" prop is being spread into JSX:
613
609
  let props = %s;
614
610
  <%s {...props} />
615
611
  React keys must be passed directly to JSX without using spread:
616
612
  let props = %s;
617
- <%s key={someKey} {...props} />`, Ut, He, Nr, He), it[He + Ut] = !0;
613
+ <%s key={someKey} {...props} />`, ot, Pe, wt, Pe), $e[Pe + ot] = !0;
618
614
  }
619
615
  }
620
- return r === n ? Qe(X) : yt(X), X;
616
+ return e === f ? Le(Y) : ze(Y), Y;
621
617
  }
622
618
  }
623
- function Dt(r, c, x) {
624
- return xt(r, c, x, !0);
619
+ function at(e, r, c) {
620
+ return qe(e, r, c, !0);
625
621
  }
626
- function kr(r, c, x) {
627
- return xt(r, c, x, !1);
622
+ function vt(e, r, c) {
623
+ return qe(e, r, c, !1);
628
624
  }
629
- var Or = kr, Ir = Dt;
630
- Et.Fragment = n, Et.jsx = Or, Et.jsxs = Ir;
631
- }()), Et;
625
+ var xt = vt, yt = at;
626
+ Ge.Fragment = f, Ge.jsx = xt, Ge.jsxs = yt;
627
+ }()), Ge;
632
628
  }
633
- process.env.NODE_ENV === "production" ? Wt.exports = Br() : Wt.exports = Ar();
634
- var a = Wt.exports;
635
- const Er = Lr(null);
636
- function Ns({
637
- children: e,
638
- bobConfig: t,
639
- hostApiConfig: s,
640
- hostContext: n = {},
641
- callbacks: i = {}
629
+ process.env.NODE_ENV === "production" ? it.exports = Ct() : it.exports = kt();
630
+ var t = it.exports;
631
+ const mt = Tt(null);
632
+ function Ht({
633
+ children: n,
634
+ bobConfig: l,
635
+ hostApiConfig: i,
636
+ hostContext: f = {},
637
+ callbacks: d = {}
642
638
  }) {
643
- const f = Ft(() => Fr(t.supabaseUrl, t.supabaseKey), [t.supabaseUrl, t.supabaseKey]), [u, g] = Tt.useState(n);
644
- Tt.useEffect(() => {
645
- g(n);
646
- }, [n]);
647
- const d = Tt.useCallback((h) => {
648
- g((l) => ({
649
- ...l,
650
- ...h
639
+ const _ = rt(() => jt(l.supabaseUrl, l.supabaseKey), [l.supabaseUrl, l.supabaseKey]), [b, E] = He.useState(f);
640
+ He.useEffect(() => {
641
+ E(f);
642
+ }, [f]);
643
+ const g = He.useCallback((u) => {
644
+ E((p) => ({
645
+ ...p,
646
+ ...u
651
647
  }));
652
- }, []), y = Ft(
648
+ }, []), x = rt(
653
649
  () => ({
654
- bobSupabase: f,
655
- bobConfig: t,
656
- hostApiConfig: s,
657
- hostContext: u,
658
- callbacks: i,
659
- updateHostContext: d
650
+ bobSupabase: _,
651
+ bobConfig: l,
652
+ hostApiConfig: i,
653
+ hostContext: b,
654
+ callbacks: d,
655
+ updateHostContext: g
660
656
  }),
661
- [f, t, s, u, i, d]
657
+ [_, l, i, b, d, g]
662
658
  );
663
- return /* @__PURE__ */ a.jsx(Er.Provider, { value: y, children: e });
659
+ return /* @__PURE__ */ t.jsx(mt.Provider, { value: x, children: n });
664
660
  }
665
- function et() {
666
- const e = Mr(Er);
667
- if (!e)
661
+ function Be() {
662
+ const n = Et(mt);
663
+ if (!n)
668
664
  throw new Error("useBobContext must be used within a BobProvider");
669
- return e;
665
+ return n;
670
666
  }
671
- function _r() {
672
- const { bobSupabase: e } = et();
673
- return e;
667
+ function bt() {
668
+ const { bobSupabase: n } = Be();
669
+ return n;
674
670
  }
675
- function Ps() {
676
- const { hostContext: e } = et();
677
- return e;
671
+ function Jt() {
672
+ const { hostContext: n } = Be();
673
+ return n;
678
674
  }
679
- function Ls() {
680
- const { hostApiConfig: e } = et();
681
- return e;
675
+ function Xt() {
676
+ const { hostApiConfig: n } = Be();
677
+ return n;
682
678
  }
683
- function Ms() {
684
- const { callbacks: e } = et();
685
- return e;
679
+ function Qt() {
680
+ const { callbacks: n } = Be();
681
+ return n;
686
682
  }
687
- const ar = 5e3, Dr = ({
688
- onStart: e,
689
- onEnd: t,
690
- onFailed: s
683
+ const dt = 5e3, St = ({
684
+ onStart: n,
685
+ onEnd: l,
686
+ onFailed: i
691
687
  } = {}) => {
692
- const { bobConfig: n } = et(), [i, f] = Q(!1), u = H(null), g = H(null), d = H(!1), y = H(e), h = H(t), l = H(s);
693
- se(() => {
694
- y.current = e, h.current = t, l.current = s;
695
- }, [e, t, s]);
696
- const v = G(() => {
697
- g.current && (clearTimeout(g.current), g.current = null);
698
- }, []), w = G(() => {
699
- var p;
700
- d.current || (d.current = !0, console.log("[BobWidget TTS] Fallback: triggering onStart without audio"), (p = y.current) == null || p.call(y));
701
- }, []), k = G(async (p) => {
702
- var E, T, b, m;
703
- if (p.trim()) {
704
- d.current = !1, v(), u.current && (u.current.pause(), u.current = null), g.current = setTimeout(() => {
705
- var S, C;
706
- console.warn("[BobWidget TTS] Timeout after 5s - triggering fallback callbacks"), w(), f(!1), (S = h.current) == null || S.call(h), (C = l.current) == null || C.call(l), u.current = null;
707
- }, ar);
688
+ const { bobConfig: f } = Be(), [d, _] = U(!1), b = V(null), E = V(null), g = V(!1), x = V(n), u = V(l), p = V(i);
689
+ X(() => {
690
+ x.current = n, u.current = l, p.current = i;
691
+ }, [n, l, i]);
692
+ const h = q(() => {
693
+ E.current && (clearTimeout(E.current), E.current = null);
694
+ }, []), j = q(() => {
695
+ var s;
696
+ g.current || (g.current = !0, console.log("[BobWidget TTS] Fallback: triggering onStart without audio"), (s = x.current) == null || s.call(x));
697
+ }, []), C = q(async (s) => {
698
+ var m, v, a, o;
699
+ if (s.trim()) {
700
+ g.current = !1, h(), b.current && (b.current.pause(), b.current = null), E.current = setTimeout(() => {
701
+ var w, k;
702
+ console.warn("[BobWidget TTS] Timeout after 5s - triggering fallback callbacks"), j(), _(!1), (w = u.current) == null || w.call(u), (k = p.current) == null || k.call(p), b.current = null;
703
+ }, dt);
708
704
  try {
709
- const S = new AbortController(), C = setTimeout(() => S.abort(), ar - 1e3), P = await fetch(
710
- `${n.supabaseUrl}/functions/v1/bob-tts`,
705
+ const w = new AbortController(), k = setTimeout(() => w.abort(), dt - 1e3), N = await fetch(
706
+ `${f.supabaseUrl}/functions/v1/bob-tts`,
711
707
  {
712
708
  method: "POST",
713
709
  headers: {
714
710
  "Content-Type": "application/json",
715
- Authorization: `Bearer ${n.supabaseKey}`
711
+ Authorization: `Bearer ${f.supabaseKey}`
716
712
  },
717
- body: JSON.stringify({ text: p }),
718
- signal: S.signal
713
+ body: JSON.stringify({ text: s }),
714
+ signal: w.signal
719
715
  }
720
716
  );
721
- if (clearTimeout(C), !P.ok) {
722
- const M = await P.json().catch(() => ({}));
717
+ if (clearTimeout(k), !N.ok) {
718
+ const M = await N.json().catch(() => ({}));
723
719
  throw console.error("[BobWidget TTS] Request failed:", M), new Error("TTS request failed");
724
720
  }
725
- const { audioContent: j } = await P.json(), R = new Audio(`data:audio/mp3;base64,${j}`);
726
- u.current = R, R.onplay = () => {
721
+ const { audioContent: O } = await N.json(), y = new Audio(`data:audio/mp3;base64,${O}`);
722
+ b.current = y, y.onplay = () => {
727
723
  var M;
728
- v(), d.current || (d.current = !0, f(!0), console.log("[BobWidget TTS] Audio playing, triggering onStart"), (M = y.current) == null || M.call(y));
729
- }, R.onended = () => {
724
+ h(), g.current || (g.current = !0, _(!0), console.log("[BobWidget TTS] Audio playing, triggering onStart"), (M = x.current) == null || M.call(x));
725
+ }, y.onended = () => {
730
726
  var M;
731
- v(), f(!1), (M = h.current) == null || M.call(h), u.current = null;
732
- }, R.onerror = (M) => {
733
- var A, L;
734
- v(), console.warn("[BobWidget TTS] Audio playback error:", M), w(), f(!1), (A = h.current) == null || A.call(h), (L = l.current) == null || L.call(l), u.current = null;
727
+ h(), _(!1), (M = u.current) == null || M.call(u), b.current = null;
728
+ }, y.onerror = (M) => {
729
+ var $, S;
730
+ h(), console.warn("[BobWidget TTS] Audio playback error:", M), j(), _(!1), ($ = u.current) == null || $.call(u), (S = p.current) == null || S.call(p), b.current = null;
735
731
  };
736
732
  try {
737
- await R.play();
733
+ await y.play();
738
734
  } catch (M) {
739
- console.warn("[BobWidget TTS] Audio play() failed (likely autoplay policy):", M), v(), w(), f(!1), (E = h.current) == null || E.call(h), (T = l.current) == null || T.call(l), u.current = null;
735
+ console.warn("[BobWidget TTS] Audio play() failed (likely autoplay policy):", M), h(), j(), _(!1), (m = u.current) == null || m.call(u), (v = p.current) == null || v.call(p), b.current = null;
740
736
  }
741
- } catch (S) {
742
- v(), console.error("[BobWidget TTS] Speech synthesis error:", S), w(), f(!1), (b = h.current) == null || b.call(h), (m = l.current) == null || m.call(l);
737
+ } catch (w) {
738
+ h(), console.error("[BobWidget TTS] Speech synthesis error:", w), j(), _(!1), (a = u.current) == null || a.call(u), (o = p.current) == null || o.call(p);
743
739
  }
744
740
  }
745
- }, [n.supabaseUrl, n.supabaseKey, v, w]), N = G(() => {
746
- v(), u.current && (u.current.pause(), u.current = null), f(!1);
747
- }, [v]), _ = G(() => {
748
- var p;
749
- (p = u.current) == null || p.pause();
750
- }, []), I = G(() => {
751
- var p;
752
- (p = u.current) == null || p.play();
741
+ }, [f.supabaseUrl, f.supabaseKey, h, j]), P = q(() => {
742
+ h(), b.current && (b.current.pause(), b.current = null), _(!1);
743
+ }, [h]), R = q(() => {
744
+ var s;
745
+ (s = b.current) == null || s.pause();
746
+ }, []), I = q(() => {
747
+ var s;
748
+ (s = b.current) == null || s.play();
753
749
  }, []);
754
- return se(() => () => {
755
- v(), u.current && (u.current.pause(), u.current = null);
756
- }, [v]), {
757
- speak: k,
758
- stop: N,
759
- pause: _,
750
+ return X(() => () => {
751
+ h(), b.current && (b.current.pause(), b.current = null);
752
+ }, [h]), {
753
+ speak: C,
754
+ stop: P,
755
+ pause: R,
760
756
  resume: I,
761
- isSpeaking: i,
757
+ isSpeaking: d,
762
758
  isSupported: !0
763
759
  };
764
- }, or = [
760
+ }, It = [
761
+ "what version",
762
+ "which version",
763
+ "software version",
764
+ "bob version",
765
+ "your version",
766
+ "current version",
767
+ "running version",
768
+ "version number",
769
+ "what ver",
770
+ "which ver"
771
+ ], ft = [
765
772
  "recommend",
766
773
  "suggest",
767
774
  "need",
@@ -787,7 +794,7 @@ const ar = 5e3, Dr = ({
787
794
  "add-on",
788
795
  "tyre shine",
789
796
  "windscreen wash"
790
- ], Ur = [
797
+ ], Nt = [
791
798
  "WIPER BLADE FRONT",
792
799
  "WIPER BLADE REAR",
793
800
  "WIPER BLADE SET",
@@ -854,1044 +861,343 @@ const ar = 5e3, Dr = ({
854
861
  "shock absorber",
855
862
  "struts",
856
863
  "suspension"
857
- ], $r = ({
858
- setAnimationState: e,
859
- manualMode: t = !1,
860
- talkingState: s = "talk",
861
- thinkingState: n = "research",
862
- completeState: i = "complete",
863
- idleState: f = "idle",
864
- listenState: u = "talk_pause",
865
- onStreamStart: g,
866
- onStreamComplete: d,
867
- onShowingProduct: y,
868
- onResearchStart: h,
869
- onReadyToSpeak: l,
870
- onHighlightPart: v,
871
- onHighlightProduct: w,
872
- onNoPartsFound: k,
873
- onAutoFetchComplete: N
864
+ ], Ot = ({
865
+ setAnimationState: n,
866
+ manualMode: l = !1,
867
+ talkingState: i = "talk",
868
+ thinkingState: f = "research",
869
+ completeState: d = "complete",
870
+ idleState: _ = "idle",
871
+ listenState: b = "talk_pause",
872
+ onStreamStart: E,
873
+ onStreamComplete: g,
874
+ onShowingProduct: x,
875
+ onResearchStart: u,
876
+ onReadyToSpeak: p,
877
+ onHighlightPart: h,
878
+ onHighlightProduct: j,
879
+ onNoPartsFound: C,
880
+ onAutoFetchComplete: P
874
881
  }) => {
875
- var Nt, Pt, De, ke;
876
- const { bobConfig: _, hostApiConfig: I, hostContext: p, callbacks: E } = et(), [T, b] = Q([]), [m, S] = Q(""), [C, P] = Q(!1), [j, R] = Q(!1), [M, A] = Q(null), L = H(null), te = H(!1), Re = H(!1), K = H(""), oe = H(!1), ue = H(null), je = () => {
877
- ue.current && (clearTimeout(ue.current), ue.current = null);
878
- }, { speak: J, stop: Ae, isSpeaking: kt } = Dr({
882
+ var Ze, et, je, ve;
883
+ const { bobConfig: R, hostApiConfig: I, hostContext: s, callbacks: m } = Be(), [v, a] = U([]), [o, w] = U(""), [k, N] = U(!1), [O, y] = U(!1), [M, $] = U(null), S = V(null), H = V(!1), ge = V(!1), F = V(""), ee = V(!1), re = V(null), be = () => {
884
+ re.current && (clearTimeout(re.current), re.current = null);
885
+ }, { speak: K, stop: Ee, isSpeaking: Je } = St({
879
886
  onStart: () => {
880
- je(), oe.current = !0, console.log("[BobWidget] Speech started - revealing products"), l == null || l(), t || pe(s);
887
+ be(), ee.current = !0, console.log("[BobWidget] Speech started - revealing products"), p == null || p(), l || ie(i);
881
888
  },
882
889
  onEnd: () => {
883
- je();
884
- const D = or.some(
885
- (ee) => K.current.toLowerCase().includes(ee.toLowerCase())
890
+ be();
891
+ const B = ft.some(
892
+ (G) => F.current.toLowerCase().includes(G.toLowerCase())
886
893
  );
887
- t || (D && y ? y() : d ? d() : (pe(i), setTimeout(() => pe(u), 3e3)));
894
+ l || (B && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3)));
888
895
  },
889
896
  onFailed: () => {
890
897
  console.warn("[BobWidget] Speech synthesis failed - fallback triggered");
891
898
  }
892
899
  });
893
- se(() => {
894
- var D;
895
- (D = L.current) == null || D.scrollIntoView({ behavior: "smooth" });
896
- }, [T]), se(() => {
897
- var ee, ne;
898
- const D = (ee = p.vehicle) == null ? void 0 : ee.selectedVehicle;
899
- D && !M && (console.log("[BobWidget] Setting vehicle from host context:", D), A(D), (ne = E.onVehicleIdentified) == null || ne.call(E, D));
900
- }, [(Nt = p.vehicle) == null ? void 0 : Nt.selectedVehicle]), se(() => {
901
- var D;
902
- if (T.length === 0 && !Re.current) {
903
- const ee = (D = p.vehicle) == null ? void 0 : D.selectedVehicle;
904
- if (ee) {
905
- Re.current = !0;
906
- const ne = `${ee.year} ${ee.make} ${ee.model}`;
907
- b([{
900
+ X(() => {
901
+ var B;
902
+ (B = S.current) == null || B.scrollIntoView({ behavior: "smooth" });
903
+ }, [v]), X(() => {
904
+ var G, Q;
905
+ const B = (G = s.vehicle) == null ? void 0 : G.selectedVehicle;
906
+ B && !M && (console.log("[BobWidget] Setting vehicle from host context:", B), $(B), (Q = m.onVehicleIdentified) == null || Q.call(m, B));
907
+ }, [(Ze = s.vehicle) == null ? void 0 : Ze.selectedVehicle]), X(() => {
908
+ var B;
909
+ if (v.length === 0 && !ge.current) {
910
+ const G = (B = s.vehicle) == null ? void 0 : B.selectedVehicle;
911
+ if (G) {
912
+ ge.current = !0;
913
+ const Q = `${G.year} ${G.make} ${G.model}`;
914
+ a([{
908
915
  role: "assistant",
909
- content: `G'day! Saw you've got the ${ne} - choice wagon! What can I help you find for it today?`
916
+ content: `G'day! Saw you've got the ${Q} - choice wagon! What can I help you find for it today?`
910
917
  }]);
911
918
  } else
912
- b([{
919
+ a([{
913
920
  role: "assistant",
914
921
  content: "G'day! Bob from CARFIX here. How can I help ya today?"
915
922
  }]);
916
923
  }
917
- }, [(Pt = p.vehicle) == null ? void 0 : Pt.selectedVehicle, T.length]), se(() => {
918
- var $e, We;
919
- const D = ($e = p.vehicle) == null ? void 0 : $e.selectedVehicle;
920
- if (!D || te.current) return;
921
- const ee = D.vehicle_id ?? D.id, ne = Number.parseInt(String(ee), 10);
922
- if (!Number.isFinite(ne)) {
923
- console.warn("[BobWidget] Vehicle has invalid vehicle_id, cannot auto-fetch:", D);
924
+ }, [(et = s.vehicle) == null ? void 0 : et.selectedVehicle, v.length]), X(() => {
925
+ var Ce, ke;
926
+ const B = (Ce = s.vehicle) == null ? void 0 : Ce.selectedVehicle;
927
+ if (!B || H.current) return;
928
+ const G = B.vehicle_id ?? B.id, Q = Number.parseInt(String(G), 10);
929
+ if (!Number.isFinite(Q)) {
930
+ console.warn("[BobWidget] Vehicle has invalid vehicle_id, cannot auto-fetch:", B);
924
931
  return;
925
932
  }
926
- te.current = !0;
927
- const rt = { ...D, vehicle_id: String(ne) }, st = (We = p.user) == null ? void 0 : We.email;
933
+ H.current = !0;
934
+ const ne = { ...B, vehicle_id: String(Q) }, xe = (ke = s.user) == null ? void 0 : ke.email;
928
935
  (async () => {
929
- var Oe, Ie;
930
- const Ve = `${_.supabaseUrl}/functions/v1/bob-chat`;
936
+ var ye, we;
937
+ const Se = `${R.supabaseUrl}/functions/v1/bob-chat`;
931
938
  try {
932
- const ge = await fetch(Ve, {
939
+ const le = await fetch(Se, {
933
940
  method: "POST",
934
941
  headers: {
935
942
  "Content-Type": "application/json",
936
- Authorization: `Bearer ${_.supabaseKey}`
943
+ Authorization: `Bearer ${R.supabaseKey}`
937
944
  },
938
945
  body: JSON.stringify({
939
946
  messages: [],
940
- vehicleContext: rt,
941
- customerEmail: st,
947
+ vehicleContext: ne,
948
+ customerEmail: xe,
942
949
  autoFetchParts: !0,
943
950
  hostConfig: I,
944
- hostContext: p
951
+ hostContext: s
945
952
  })
946
953
  });
947
- if (!ge.ok || !ge.body) {
948
- console.error("[BobWidget] Auto-fetch failed:", ge.status);
954
+ if (!le.ok || !le.body) {
955
+ console.error("[BobWidget] Auto-fetch failed:", le.status);
949
956
  return;
950
957
  }
951
- const Ke = ge.body.getReader(), qe = new TextDecoder();
952
- let Ee = "";
958
+ const Ie = le.body.getReader(), Ne = new TextDecoder();
959
+ let pe = "";
953
960
  for (; ; ) {
954
- const { done: be, value: Se } = await Ke.read();
955
- if (be) break;
956
- Ee += qe.decode(Se, { stream: !0 });
957
- let ze;
958
- for (; (ze = Ee.indexOf(`
961
+ const { done: ce, value: me } = await Ie.read();
962
+ if (ce) break;
963
+ pe += Ne.decode(me, { stream: !0 });
964
+ let Oe;
965
+ for (; (Oe = pe.indexOf(`
959
966
  `)) !== -1; ) {
960
- let me = Ee.slice(0, ze);
961
- if (Ee = Ee.slice(ze + 1), me.endsWith("\r") && (me = me.slice(0, -1)), me.startsWith(":") || me.trim() === "" || !me.startsWith("data: ")) continue;
962
- const de = me.slice(6).trim();
963
- if (de === "[DONE]") break;
967
+ let ue = pe.slice(0, Oe);
968
+ if (pe = pe.slice(Oe + 1), ue.endsWith("\r") && (ue = ue.slice(0, -1)), ue.startsWith(":") || ue.trim() === "" || !ue.startsWith("data: ")) continue;
969
+ const se = ue.slice(6).trim();
970
+ if (se === "[DONE]") break;
964
971
  try {
965
- const ve = JSON.parse(de);
966
- ve.type === "service_packages_found" && ve.packages && ((Oe = E.onServicePackagesFound) == null || Oe.call(E, ve.packages)), ve.type === "parts_found" && ve.parts && ((Ie = E.onPartsFound) == null || Ie.call(E, ve.parts));
972
+ const de = JSON.parse(se);
973
+ de.type === "service_packages_found" && de.packages && ((ye = m.onServicePackagesFound) == null || ye.call(m, de.packages)), de.type === "parts_found" && de.parts && ((we = m.onPartsFound) == null || we.call(m, de.parts));
967
974
  } catch {
968
975
  }
969
976
  }
970
977
  }
971
- N == null || N();
972
- } catch (ge) {
973
- console.error("[BobWidget] Auto-fetch error:", ge);
978
+ P == null || P();
979
+ } catch (le) {
980
+ console.error("[BobWidget] Auto-fetch error:", le);
974
981
  }
975
982
  })();
976
- }, [(De = p.vehicle) == null ? void 0 : De.selectedVehicle, (ke = p.user) == null ? void 0 : ke.email]);
977
- const pe = (D) => {
983
+ }, [(je = s.vehicle) == null ? void 0 : je.selectedVehicle, (ve = s.user) == null ? void 0 : ve.email]);
984
+ const ie = (B) => {
978
985
  try {
979
- e(D);
986
+ n(B);
980
987
  } catch {
981
- console.warn(`[BobWidget] State "${D}" not available`);
988
+ console.warn(`[BobWidget] State "${B}" not available`);
982
989
  }
983
- }, Bt = async (D) => {
984
- var rt, st, Ue, $e, We, Ve, Oe, Ie, ge, Ke, qe, Ee;
985
- const ee = `${_.supabaseUrl}/functions/v1/bob-chat`, ne = (rt = p.user) == null ? void 0 : rt.email;
990
+ }, nt = async (B) => {
991
+ var ne, xe, Re, Ce, ke, Se, ye, we, le, Ie, Ne, pe;
992
+ const G = `${R.supabaseUrl}/functions/v1/bob-chat`, Q = (ne = s.user) == null ? void 0 : ne.email;
986
993
  try {
987
- const be = {
988
- messages: [...T, D],
994
+ const ce = {
995
+ messages: [...v, B],
989
996
  hostConfig: I,
990
- hostContext: p
997
+ hostContext: s
991
998
  };
992
- M && (be.vehicleContext = M), ne && (be.customerEmail = ne);
993
- const Se = await fetch(ee, {
999
+ M && (ce.vehicleContext = M), Q && (ce.customerEmail = Q);
1000
+ const me = await fetch(G, {
994
1001
  method: "POST",
995
1002
  headers: {
996
1003
  "Content-Type": "application/json",
997
- Authorization: `Bearer ${_.supabaseKey}`
1004
+ Authorization: `Bearer ${R.supabaseKey}`
998
1005
  },
999
- body: JSON.stringify(be)
1006
+ body: JSON.stringify(ce)
1000
1007
  });
1001
- if (!Se.ok) {
1002
- if (Se.status === 429) {
1003
- (st = E.onError) == null || st.call(E, new Error("Rate limit exceeded"));
1008
+ if (!me.ok) {
1009
+ if (me.status === 429) {
1010
+ (xe = m.onError) == null || xe.call(m, new Error("Rate limit exceeded"));
1004
1011
  return;
1005
1012
  }
1006
- if (Se.status === 402) {
1007
- (Ue = E.onError) == null || Ue.call(E, new Error("Payment required"));
1013
+ if (me.status === 402) {
1014
+ (Re = m.onError) == null || Re.call(m, new Error("Payment required"));
1008
1015
  return;
1009
1016
  }
1010
1017
  throw new Error("Failed to start stream");
1011
1018
  }
1012
- if (!Se.body) throw new Error("No response body");
1013
- const ze = Se.body.getReader(), me = new TextDecoder();
1014
- let de = "", ve = !1, _e = "";
1015
- for (; !ve; ) {
1016
- const { done: fe, value: Pe } = await ze.read();
1017
- if (fe) break;
1018
- de += me.decode(Pe, { stream: !0 });
1019
- let mt;
1020
- for (; (mt = de.indexOf(`
1019
+ if (!me.body) throw new Error("No response body");
1020
+ const Oe = me.body.getReader(), ue = new TextDecoder();
1021
+ let se = "", de = !1, he = "";
1022
+ for (; !de; ) {
1023
+ const { done: ae, value: Te } = await Oe.read();
1024
+ if (ae) break;
1025
+ se += ue.decode(Te, { stream: !0 });
1026
+ let Ve;
1027
+ for (; (Ve = se.indexOf(`
1021
1028
  `)) !== -1; ) {
1022
- let ye = de.slice(0, mt);
1023
- if (de = de.slice(mt + 1), ye.endsWith("\r") && (ye = ye.slice(0, -1)), ye.startsWith(":") || ye.trim() === "" || !ye.startsWith("data: ")) continue;
1024
- const Lt = ye.slice(6).trim();
1025
- if (Lt === "[DONE]") {
1026
- ve = !0;
1029
+ let fe = se.slice(0, Ve);
1030
+ if (se = se.slice(Ve + 1), fe.endsWith("\r") && (fe = fe.slice(0, -1)), fe.startsWith(":") || fe.trim() === "" || !fe.startsWith("data: ")) continue;
1031
+ const tt = fe.slice(6).trim();
1032
+ if (tt === "[DONE]") {
1033
+ de = !0;
1027
1034
  break;
1028
1035
  }
1029
1036
  try {
1030
- const re = JSON.parse(Lt);
1031
- if (re.type === "vehicle_identified" && re.vehicle) {
1032
- A(re.vehicle), ($e = E.onVehicleIdentified) == null || $e.call(E, re.vehicle);
1037
+ const J = JSON.parse(tt);
1038
+ if (J.type === "vehicle_identified" && J.vehicle) {
1039
+ $(J.vehicle), (Ce = m.onVehicleIdentified) == null || Ce.call(m, J.vehicle);
1033
1040
  continue;
1034
1041
  }
1035
- if (re.type === "service_packages_found" && re.packages) {
1036
- (We = E.onServicePackagesFound) == null || We.call(E, re.packages);
1042
+ if (J.type === "service_packages_found" && J.packages) {
1043
+ (ke = m.onServicePackagesFound) == null || ke.call(m, J.packages);
1037
1044
  continue;
1038
1045
  }
1039
- if (re.type === "parts_found" && re.parts) {
1040
- (Ve = E.onPartsFound) == null || Ve.call(E, re.parts);
1046
+ if (J.type === "parts_found" && J.parts) {
1047
+ (Se = m.onPartsFound) == null || Se.call(m, J.parts);
1041
1048
  continue;
1042
1049
  }
1043
- if (re.type === "no_parts_found") {
1044
- k == null || k();
1050
+ if (J.type === "no_parts_found") {
1051
+ C == null || C();
1045
1052
  continue;
1046
1053
  }
1047
- if (re.type === "cart_updated" && re.items) {
1048
- (Oe = E.onCartUpdated) == null || Oe.call(E, re.items);
1054
+ if (J.type === "cart_updated" && J.items) {
1055
+ (ye = m.onCartUpdated) == null || ye.call(m, J.items);
1049
1056
  continue;
1050
1057
  }
1051
- const vt = (Ke = (ge = (Ie = re.choices) == null ? void 0 : Ie[0]) == null ? void 0 : ge.delta) == null ? void 0 : Ke.content;
1052
- if (vt) {
1053
- _e += vt;
1054
- const yt = _e.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
1055
- b((Qe) => {
1056
- const it = Qe[Qe.length - 1];
1057
- return (it == null ? void 0 : it.role) === "assistant" ? Qe.map(
1058
- (xt, Dt) => Dt === Qe.length - 1 ? { ...xt, content: yt } : xt
1059
- ) : [...Qe, { role: "assistant", content: yt }];
1060
- }), (qe = E.onBobMessage) == null || qe.call(E, yt);
1058
+ const Ke = (Ie = (le = (we = J.choices) == null ? void 0 : we[0]) == null ? void 0 : le.delta) == null ? void 0 : Ie.content;
1059
+ if (Ke) {
1060
+ he += Ke;
1061
+ const ze = he.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
1062
+ a((Le) => {
1063
+ const $e = Le[Le.length - 1];
1064
+ return ($e == null ? void 0 : $e.role) === "assistant" ? Le.map(
1065
+ (qe, at) => at === Le.length - 1 ? { ...qe, content: ze } : qe
1066
+ ) : [...Le, { role: "assistant", content: ze }];
1067
+ }), (Ne = m.onBobMessage) == null || Ne.call(m, ze);
1061
1068
  }
1062
1069
  } catch {
1063
- de = ye + `
1064
- ` + de;
1070
+ se = fe + `
1071
+ ` + se;
1065
1072
  break;
1066
1073
  }
1067
1074
  }
1068
1075
  }
1069
- K.current = _e.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
1070
- const bt = or.some(
1071
- (fe) => _e.toLowerCase().includes(fe.toLowerCase())
1072
- ), Ne = _e.toLowerCase();
1073
- for (const fe of Ur)
1074
- if (Ne.includes(fe.toLowerCase())) {
1075
- const Pe = fe.replace(/s\s*$/i, "").toUpperCase();
1076
- v == null || v(Pe);
1076
+ F.current = he.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
1077
+ const Ue = ft.some(
1078
+ (ae) => he.toLowerCase().includes(ae.toLowerCase())
1079
+ ), _e = he.toLowerCase();
1080
+ for (const ae of Nt)
1081
+ if (_e.includes(ae.toLowerCase())) {
1082
+ const Te = ae.replace(/s\s*$/i, "").toUpperCase();
1083
+ h == null || h(Te);
1077
1084
  break;
1078
1085
  }
1079
- const nt = _e.match(/(?:go with|recommend|suggest|grab|try)\s+(?:the\s+)?(\w+)\s+(?:at|for)\s+\$(\d+(?:\.\d{2})?)/i);
1080
- if (nt) {
1081
- const [, fe, Pe] = nt;
1082
- w == null || w({ brand: fe, price: parseFloat(Pe) });
1086
+ const Me = he.match(/(?:go with|recommend|suggest|grab|try)\s+(?:the\s+)?(\w+)\s+(?:at|for)\s+\$(\d+(?:\.\d{2})?)/i);
1087
+ if (Me) {
1088
+ const [, ae, Te] = Me;
1089
+ j == null || j({ brand: ae, price: parseFloat(Te) });
1083
1090
  }
1084
- !j && K.current.trim() ? (oe.current = !1, je(), J(K.current), ue.current = setTimeout(() => {
1085
- oe.current || (console.warn("[BobWidget] Speech fallback after 2s"), l == null || l(), t || (bt && y ? y() : d ? d() : (pe(i), setTimeout(() => pe(u), 3e3))));
1086
- }, 2e3)) : (l == null || l(), t || (bt && y ? y() : d ? d() : (pe(i), setTimeout(() => pe(u), 3e3))));
1087
- } catch (be) {
1088
- console.error("[BobWidget] Chat error:", be), (Ee = E.onError) == null || Ee.call(E, be instanceof Error ? be : new Error("Unknown error")), t || pe(f);
1091
+ !O && F.current.trim() ? (ee.current = !1, be(), K(F.current), re.current = setTimeout(() => {
1092
+ ee.current || (console.warn("[BobWidget] Speech fallback after 2s"), p == null || p(), l || (Ue && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3))));
1093
+ }, 2e3)) : (p == null || p(), l || (Ue && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3))));
1094
+ } catch (ce) {
1095
+ console.error("[BobWidget] Chat error:", ce), (pe = m.onError) == null || pe.call(m, ce instanceof Error ? ce : new Error("Unknown error")), l || ie(_);
1089
1096
  }
1090
- }, tt = async () => {
1091
- if (!m.trim() || C) return;
1092
- Ae();
1093
- const D = { role: "user", content: m };
1094
- b((ee) => [...ee, D]), S(""), P(!0), h == null || h(), t || pe(n), await Bt(D), P(!1);
1097
+ }, Ae = async () => {
1098
+ if (!o.trim() || k) return;
1099
+ Ee();
1100
+ const B = { role: "user", content: o };
1101
+ a((ne) => [...ne, B]), w("");
1102
+ const G = o.toLowerCase();
1103
+ if (It.some((ne) => G.includes(ne))) {
1104
+ const ne = `G'day mate! I'm running Bob v${gt} - she's running sweet as! Anything else I can help ya with?`;
1105
+ a((xe) => [...xe, { role: "assistant", content: ne }]), O || K(ne);
1106
+ return;
1107
+ }
1108
+ N(!0), u == null || u(), l || ie(f), await nt(B), N(!1);
1095
1109
  };
1096
1110
  return {
1097
- messages: T,
1098
- input: m,
1099
- setInput: S,
1100
- isLoading: C,
1101
- handleSend: tt,
1102
- handleKeyPress: (D) => {
1103
- D.key === "Enter" && !D.shiftKey && (D.preventDefault(), tt());
1111
+ messages: v,
1112
+ input: o,
1113
+ setInput: w,
1114
+ isLoading: k,
1115
+ handleSend: Ae,
1116
+ handleKeyPress: (B) => {
1117
+ B.key === "Enter" && !B.shiftKey && (B.preventDefault(), Ae());
1104
1118
  },
1105
1119
  handleInputFocus: () => {
1106
1120
  },
1107
1121
  handleInputBlur: () => {
1108
1122
  },
1109
- chatEndRef: L,
1123
+ chatEndRef: S,
1110
1124
  clearMessages: () => {
1111
- b([{
1125
+ a([{
1112
1126
  role: "assistant",
1113
1127
  content: "G'day! Bob from CARFIX here. How can I help ya today?"
1114
1128
  }]);
1115
1129
  },
1116
- isMuted: j,
1130
+ isMuted: O,
1117
1131
  toggleMute: () => {
1118
- R((D) => !D), j || Ae();
1132
+ y((B) => !B), O || Ee();
1119
1133
  },
1120
- isSpeaking: kt,
1134
+ isSpeaking: Je,
1121
1135
  identifiedVehicle: M,
1122
1136
  clearVehicle: () => {
1123
- A(null);
1137
+ $(null);
1124
1138
  }
1125
1139
  };
1126
- };
1127
- var er = class {
1128
- constructor() {
1129
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
1130
- }
1131
- subscribe(e) {
1132
- return this.listeners.add(e), this.onSubscribe(), () => {
1133
- this.listeners.delete(e), this.onUnsubscribe();
1134
- };
1135
- }
1136
- hasListeners() {
1137
- return this.listeners.size > 0;
1138
- }
1139
- onSubscribe() {
1140
- }
1141
- onUnsubscribe() {
1142
- }
1143
- }, Wr = {
1144
- // We need the wrapper function syntax below instead of direct references to
1145
- // global setTimeout etc.
1146
- //
1147
- // BAD: `setTimeout: setTimeout`
1148
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
1149
- //
1150
- // If we use direct references here, then anything that wants to spy on or
1151
- // replace the global setTimeout (like tests) won't work since we'll already
1152
- // have a hard reference to the original implementation at the time when this
1153
- // file was imported.
1154
- setTimeout: (e, t) => setTimeout(e, t),
1155
- clearTimeout: (e) => clearTimeout(e),
1156
- setInterval: (e, t) => setInterval(e, t),
1157
- clearInterval: (e) => clearInterval(e)
1158
- }, Te, Ye, vr, Vr = (vr = class {
1159
- constructor() {
1160
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
1161
- // type at app boot; and if we leave that type, then any new timer provider
1162
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
1163
- //
1164
- // We settle for type safety for the TimeoutProvider type, and accept that
1165
- // this class is unsafe internally to allow for extension.
1166
- z(this, Te, Wr);
1167
- z(this, Ye, !1);
1168
- }
1169
- setTimeoutProvider(e) {
1170
- process.env.NODE_ENV !== "production" && o(this, Ye) && e !== o(this, Te) && console.error(
1171
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
1172
- { previous: o(this, Te), provider: e }
1173
- ), F(this, Te, e), process.env.NODE_ENV !== "production" && F(this, Ye, !1);
1174
- }
1175
- setTimeout(e, t) {
1176
- return process.env.NODE_ENV !== "production" && F(this, Ye, !0), o(this, Te).setTimeout(e, t);
1177
- }
1178
- clearTimeout(e) {
1179
- o(this, Te).clearTimeout(e);
1180
- }
1181
- setInterval(e, t) {
1182
- return process.env.NODE_ENV !== "production" && F(this, Ye, !0), o(this, Te).setInterval(e, t);
1183
- }
1184
- clearInterval(e) {
1185
- o(this, Te).clearInterval(e);
1186
- }
1187
- }, Te = new WeakMap(), Ye = new WeakMap(), vr), Mt = new Vr();
1188
- function Kr(e) {
1189
- setTimeout(e, 0);
1190
- }
1191
- var St = typeof window > "u" || "Deno" in globalThis;
1192
- function Vt() {
1193
- }
1194
- function cr(e) {
1195
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
1196
- }
1197
- function qr(e, t) {
1198
- return Math.max(e + (t || 0) - Date.now(), 0);
1199
- }
1200
- function Rt(e, t) {
1201
- return typeof e == "function" ? e(t) : e;
1202
- }
1203
- function xe(e, t) {
1204
- return typeof e == "function" ? e(t) : e;
1205
- }
1206
- var zr = Object.prototype.hasOwnProperty;
1207
- function Kt(e, t) {
1208
- if (e === t)
1209
- return e;
1210
- const s = lr(e) && lr(t);
1211
- if (!s && !(ur(e) && ur(t))) return t;
1212
- const i = (s ? e : Object.keys(e)).length, f = s ? t : Object.keys(t), u = f.length, g = s ? new Array(u) : {};
1213
- let d = 0;
1214
- for (let y = 0; y < u; y++) {
1215
- const h = s ? y : f[y], l = e[h], v = t[h];
1216
- if (l === v) {
1217
- g[h] = l, (s ? y < i : zr.call(e, h)) && d++;
1218
- continue;
1219
- }
1220
- if (l === null || v === null || typeof l != "object" || typeof v != "object") {
1221
- g[h] = v;
1222
- continue;
1223
- }
1224
- const w = Kt(l, v);
1225
- g[h] = w, w === l && d++;
1226
- }
1227
- return i === u && d === i ? e : g;
1228
- }
1229
- function qt(e, t) {
1230
- if (!t || Object.keys(e).length !== Object.keys(t).length)
1231
- return !1;
1232
- for (const s in e)
1233
- if (e[s] !== t[s])
1234
- return !1;
1235
- return !0;
1236
- }
1237
- function lr(e) {
1238
- return Array.isArray(e) && e.length === Object.keys(e).length;
1239
- }
1240
- function ur(e) {
1241
- if (!dr(e))
1242
- return !1;
1243
- const t = e.constructor;
1244
- if (t === void 0)
1245
- return !0;
1246
- const s = t.prototype;
1247
- return !(!dr(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
1248
- }
1249
- function dr(e) {
1250
- return Object.prototype.toString.call(e) === "[object Object]";
1251
- }
1252
- function fr(e, t, s) {
1253
- if (typeof s.structuralSharing == "function")
1254
- return s.structuralSharing(e, t);
1255
- if (s.structuralSharing !== !1) {
1256
- if (process.env.NODE_ENV !== "production")
1257
- try {
1258
- return Kt(e, t);
1259
- } catch (n) {
1260
- throw console.error(
1261
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${n}`
1262
- ), n;
1263
- }
1264
- return Kt(e, t);
1265
- }
1266
- return t;
1267
- }
1268
- function Qr(e, t) {
1269
- return typeof e == "function" ? e(...t) : !!e;
1270
- }
1271
- var Ge, Le, ot, yr, Hr = (yr = class extends er {
1272
- constructor() {
1273
- super();
1274
- z(this, Ge);
1275
- z(this, Le);
1276
- z(this, ot);
1277
- F(this, ot, (t) => {
1278
- if (!St && window.addEventListener) {
1279
- const s = () => t();
1280
- return window.addEventListener("visibilitychange", s, !1), () => {
1281
- window.removeEventListener("visibilitychange", s);
1282
- };
1283
- }
1284
- });
1285
- }
1286
- onSubscribe() {
1287
- o(this, Le) || this.setEventListener(o(this, ot));
1288
- }
1289
- onUnsubscribe() {
1290
- var t;
1291
- this.hasListeners() || ((t = o(this, Le)) == null || t.call(this), F(this, Le, void 0));
1292
- }
1293
- setEventListener(t) {
1294
- var s;
1295
- F(this, ot, t), (s = o(this, Le)) == null || s.call(this), F(this, Le, t((n) => {
1296
- typeof n == "boolean" ? this.setFocused(n) : this.onFocus();
1297
- }));
1298
- }
1299
- setFocused(t) {
1300
- o(this, Ge) !== t && (F(this, Ge, t), this.onFocus());
1301
- }
1302
- onFocus() {
1303
- const t = this.isFocused();
1304
- this.listeners.forEach((s) => {
1305
- s(t);
1306
- });
1307
- }
1308
- isFocused() {
1309
- var t;
1310
- return typeof o(this, Ge) == "boolean" ? o(this, Ge) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
1311
- }
1312
- }, Ge = new WeakMap(), Le = new WeakMap(), ot = new WeakMap(), yr), Yr = new Hr();
1313
- function hr() {
1314
- let e, t;
1315
- const s = new Promise((i, f) => {
1316
- e = i, t = f;
1317
- });
1318
- s.status = "pending", s.catch(() => {
1319
- });
1320
- function n(i) {
1321
- Object.assign(s, i), delete s.resolve, delete s.reject;
1322
- }
1323
- return s.resolve = (i) => {
1324
- n({
1325
- status: "fulfilled",
1326
- value: i
1327
- }), e(i);
1328
- }, s.reject = (i) => {
1329
- n({
1330
- status: "rejected",
1331
- reason: i
1332
- }), t(i);
1333
- }, s;
1334
- }
1335
- var Gr = Kr;
1336
- function Jr() {
1337
- let e = [], t = 0, s = (g) => {
1338
- g();
1339
- }, n = (g) => {
1340
- g();
1341
- }, i = Gr;
1342
- const f = (g) => {
1343
- t ? e.push(g) : i(() => {
1344
- s(g);
1345
- });
1346
- }, u = () => {
1347
- const g = e;
1348
- e = [], g.length && i(() => {
1349
- n(() => {
1350
- g.forEach((d) => {
1351
- s(d);
1352
- });
1353
- });
1354
- });
1355
- };
1356
- return {
1357
- batch: (g) => {
1358
- let d;
1359
- t++;
1360
- try {
1361
- d = g();
1362
- } finally {
1363
- t--, t || u();
1364
- }
1365
- return d;
1366
- },
1367
- /**
1368
- * All calls to the wrapped function will be batched.
1369
- */
1370
- batchCalls: (g) => (...d) => {
1371
- f(() => {
1372
- g(...d);
1373
- });
1374
- },
1375
- schedule: f,
1376
- /**
1377
- * Use this method to set a custom notify function.
1378
- * This can be used to for example wrap notifications with `React.act` while running tests.
1379
- */
1380
- setNotifyFunction: (g) => {
1381
- s = g;
1382
- },
1383
- /**
1384
- * Use this method to set a custom function to batch notifications together into a single tick.
1385
- * By default React Query will use the batch function provided by ReactDOM or React Native.
1386
- */
1387
- setBatchNotifyFunction: (g) => {
1388
- n = g;
1389
- },
1390
- setScheduler: (g) => {
1391
- i = g;
1392
- }
1393
- };
1394
- }
1395
- var Tr = Jr(), ct, Me, lt, xr, Xr = (xr = class extends er {
1396
- constructor() {
1397
- super();
1398
- z(this, ct, !0);
1399
- z(this, Me);
1400
- z(this, lt);
1401
- F(this, lt, (t) => {
1402
- if (!St && window.addEventListener) {
1403
- const s = () => t(!0), n = () => t(!1);
1404
- return window.addEventListener("online", s, !1), window.addEventListener("offline", n, !1), () => {
1405
- window.removeEventListener("online", s), window.removeEventListener("offline", n);
1406
- };
1407
- }
1408
- });
1409
- }
1410
- onSubscribe() {
1411
- o(this, Me) || this.setEventListener(o(this, lt));
1412
- }
1413
- onUnsubscribe() {
1414
- var t;
1415
- this.hasListeners() || ((t = o(this, Me)) == null || t.call(this), F(this, Me, void 0));
1416
- }
1417
- setEventListener(t) {
1418
- var s;
1419
- F(this, lt, t), (s = o(this, Me)) == null || s.call(this), F(this, Me, t(this.setOnline.bind(this)));
1420
- }
1421
- setOnline(t) {
1422
- o(this, ct) !== t && (F(this, ct, t), this.listeners.forEach((n) => {
1423
- n(t);
1424
- }));
1425
- }
1426
- isOnline() {
1427
- return o(this, ct);
1428
- }
1429
- }, ct = new WeakMap(), Me = new WeakMap(), lt = new WeakMap(), xr), Zr = new Xr();
1430
- function es(e) {
1431
- return (e ?? "online") === "online" ? Zr.isOnline() : !0;
1432
- }
1433
- function ts(e, t) {
1434
- return {
1435
- fetchFailureCount: 0,
1436
- fetchFailureReason: null,
1437
- fetchStatus: es(t.networkMode) ? "fetching" : "paused",
1438
- ...e === void 0 && {
1439
- error: null,
1440
- status: "pending"
1441
- }
1442
- };
1443
- }
1444
- var le, U, Ct, ae, Je, ut, Ce, Fe, jt, dt, ft, Xe, Ze, Be, ht, V, _t, zt, Qt, Ht, Yt, Gt, Jt, Xt, Rr, wr, rs = (wr = class extends er {
1445
- constructor(t, s) {
1446
- super();
1447
- z(this, V);
1448
- z(this, le);
1449
- z(this, U);
1450
- z(this, Ct);
1451
- z(this, ae);
1452
- z(this, Je);
1453
- z(this, ut);
1454
- z(this, Ce);
1455
- z(this, Fe);
1456
- z(this, jt);
1457
- z(this, dt);
1458
- // This property keeps track of the last query with defined data.
1459
- // It will be used to pass the previous data and query to the placeholder function between renders.
1460
- z(this, ft);
1461
- z(this, Xe);
1462
- z(this, Ze);
1463
- z(this, Be);
1464
- z(this, ht, /* @__PURE__ */ new Set());
1465
- this.options = s, F(this, le, t), F(this, Fe, null), F(this, Ce, hr()), this.bindMethods(), this.setOptions(s);
1466
- }
1467
- bindMethods() {
1468
- this.refetch = this.refetch.bind(this);
1469
- }
1470
- onSubscribe() {
1471
- this.listeners.size === 1 && (o(this, U).addObserver(this), pr(o(this, U), this.options) ? Z(this, V, _t).call(this) : this.updateResult(), Z(this, V, Yt).call(this));
1472
- }
1473
- onUnsubscribe() {
1474
- this.hasListeners() || this.destroy();
1475
- }
1476
- shouldFetchOnReconnect() {
1477
- return Zt(
1478
- o(this, U),
1479
- this.options,
1480
- this.options.refetchOnReconnect
1481
- );
1482
- }
1483
- shouldFetchOnWindowFocus() {
1484
- return Zt(
1485
- o(this, U),
1486
- this.options,
1487
- this.options.refetchOnWindowFocus
1488
- );
1489
- }
1490
- destroy() {
1491
- this.listeners = /* @__PURE__ */ new Set(), Z(this, V, Gt).call(this), Z(this, V, Jt).call(this), o(this, U).removeObserver(this);
1492
- }
1493
- setOptions(t) {
1494
- const s = this.options, n = o(this, U);
1495
- if (this.options = o(this, le).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof xe(this.options.enabled, o(this, U)) != "boolean")
1496
- throw new Error(
1497
- "Expected enabled to be a boolean or a callback that returns a boolean"
1498
- );
1499
- Z(this, V, Xt).call(this), o(this, U).setOptions(this.options), s._defaulted && !qt(this.options, s) && o(this, le).getQueryCache().notify({
1500
- type: "observerOptionsUpdated",
1501
- query: o(this, U),
1502
- observer: this
1503
- });
1504
- const i = this.hasListeners();
1505
- i && gr(
1506
- o(this, U),
1507
- n,
1508
- this.options,
1509
- s
1510
- ) && Z(this, V, _t).call(this), this.updateResult(), i && (o(this, U) !== n || xe(this.options.enabled, o(this, U)) !== xe(s.enabled, o(this, U)) || Rt(this.options.staleTime, o(this, U)) !== Rt(s.staleTime, o(this, U))) && Z(this, V, zt).call(this);
1511
- const f = Z(this, V, Qt).call(this);
1512
- i && (o(this, U) !== n || xe(this.options.enabled, o(this, U)) !== xe(s.enabled, o(this, U)) || f !== o(this, Be)) && Z(this, V, Ht).call(this, f);
1513
- }
1514
- getOptimisticResult(t) {
1515
- const s = o(this, le).getQueryCache().build(o(this, le), t), n = this.createResult(s, t);
1516
- return ns(this, n) && (F(this, ae, n), F(this, ut, this.options), F(this, Je, o(this, U).state)), n;
1517
- }
1518
- getCurrentResult() {
1519
- return o(this, ae);
1520
- }
1521
- trackResult(t, s) {
1522
- return new Proxy(t, {
1523
- get: (n, i) => (this.trackProp(i), s == null || s(i), i === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && o(this, Ce).status === "pending" && o(this, Ce).reject(
1524
- new Error(
1525
- "experimental_prefetchInRender feature flag is not enabled"
1526
- )
1527
- )), Reflect.get(n, i))
1528
- });
1529
- }
1530
- trackProp(t) {
1531
- o(this, ht).add(t);
1532
- }
1533
- getCurrentQuery() {
1534
- return o(this, U);
1535
- }
1536
- refetch({ ...t } = {}) {
1537
- return this.fetch({
1538
- ...t
1539
- });
1540
- }
1541
- fetchOptimistic(t) {
1542
- const s = o(this, le).defaultQueryOptions(t), n = o(this, le).getQueryCache().build(o(this, le), s);
1543
- return n.fetch().then(() => this.createResult(n, s));
1544
- }
1545
- fetch(t) {
1546
- return Z(this, V, _t).call(this, {
1547
- ...t,
1548
- cancelRefetch: t.cancelRefetch ?? !0
1549
- }).then(() => (this.updateResult(), o(this, ae)));
1550
- }
1551
- createResult(t, s) {
1552
- var P;
1553
- const n = o(this, U), i = this.options, f = o(this, ae), u = o(this, Je), g = o(this, ut), y = t !== n ? t.state : o(this, Ct), { state: h } = t;
1554
- let l = { ...h }, v = !1, w;
1555
- if (s._optimisticResults) {
1556
- const j = this.hasListeners(), R = !j && pr(t, s), M = j && gr(t, n, s, i);
1557
- (R || M) && (l = {
1558
- ...l,
1559
- ...ts(h.data, t.options)
1560
- }), s._optimisticResults === "isRestoring" && (l.fetchStatus = "idle");
1561
- }
1562
- let { error: k, errorUpdatedAt: N, status: _ } = l;
1563
- w = l.data;
1564
- let I = !1;
1565
- if (s.placeholderData !== void 0 && w === void 0 && _ === "pending") {
1566
- let j;
1567
- f != null && f.isPlaceholderData && s.placeholderData === (g == null ? void 0 : g.placeholderData) ? (j = f.data, I = !0) : j = typeof s.placeholderData == "function" ? s.placeholderData(
1568
- (P = o(this, ft)) == null ? void 0 : P.state.data,
1569
- o(this, ft)
1570
- ) : s.placeholderData, j !== void 0 && (_ = "success", w = fr(
1571
- f == null ? void 0 : f.data,
1572
- j,
1573
- s
1574
- ), v = !0);
1575
- }
1576
- if (s.select && w !== void 0 && !I)
1577
- if (f && w === (u == null ? void 0 : u.data) && s.select === o(this, jt))
1578
- w = o(this, dt);
1579
- else
1580
- try {
1581
- F(this, jt, s.select), w = s.select(w), w = fr(f == null ? void 0 : f.data, w, s), F(this, dt, w), F(this, Fe, null);
1582
- } catch (j) {
1583
- F(this, Fe, j);
1584
- }
1585
- o(this, Fe) && (k = o(this, Fe), w = o(this, dt), N = Date.now(), _ = "error");
1586
- const p = l.fetchStatus === "fetching", E = _ === "pending", T = _ === "error", b = E && p, m = w !== void 0, C = {
1587
- status: _,
1588
- fetchStatus: l.fetchStatus,
1589
- isPending: E,
1590
- isSuccess: _ === "success",
1591
- isError: T,
1592
- isInitialLoading: b,
1593
- isLoading: b,
1594
- data: w,
1595
- dataUpdatedAt: l.dataUpdatedAt,
1596
- error: k,
1597
- errorUpdatedAt: N,
1598
- failureCount: l.fetchFailureCount,
1599
- failureReason: l.fetchFailureReason,
1600
- errorUpdateCount: l.errorUpdateCount,
1601
- isFetched: l.dataUpdateCount > 0 || l.errorUpdateCount > 0,
1602
- isFetchedAfterMount: l.dataUpdateCount > y.dataUpdateCount || l.errorUpdateCount > y.errorUpdateCount,
1603
- isFetching: p,
1604
- isRefetching: p && !E,
1605
- isLoadingError: T && !m,
1606
- isPaused: l.fetchStatus === "paused",
1607
- isPlaceholderData: v,
1608
- isRefetchError: T && m,
1609
- isStale: tr(t, s),
1610
- refetch: this.refetch,
1611
- promise: o(this, Ce),
1612
- isEnabled: xe(s.enabled, t) !== !1
1613
- };
1614
- if (this.options.experimental_prefetchInRender) {
1615
- const j = (A) => {
1616
- C.status === "error" ? A.reject(C.error) : C.data !== void 0 && A.resolve(C.data);
1617
- }, R = () => {
1618
- const A = F(this, Ce, C.promise = hr());
1619
- j(A);
1620
- }, M = o(this, Ce);
1621
- switch (M.status) {
1622
- case "pending":
1623
- t.queryHash === n.queryHash && j(M);
1624
- break;
1625
- case "fulfilled":
1626
- (C.status === "error" || C.data !== M.value) && R();
1627
- break;
1628
- case "rejected":
1629
- (C.status !== "error" || C.error !== M.reason) && R();
1630
- break;
1631
- }
1632
- }
1633
- return C;
1634
- }
1635
- updateResult() {
1636
- const t = o(this, ae), s = this.createResult(o(this, U), this.options);
1637
- if (F(this, Je, o(this, U).state), F(this, ut, this.options), o(this, Je).data !== void 0 && F(this, ft, o(this, U)), qt(s, t))
1638
- return;
1639
- F(this, ae, s);
1640
- const n = () => {
1641
- if (!t)
1642
- return !0;
1643
- const { notifyOnChangeProps: i } = this.options, f = typeof i == "function" ? i() : i;
1644
- if (f === "all" || !f && !o(this, ht).size)
1645
- return !0;
1646
- const u = new Set(
1647
- f ?? o(this, ht)
1648
- );
1649
- return this.options.throwOnError && u.add("error"), Object.keys(o(this, ae)).some((g) => {
1650
- const d = g;
1651
- return o(this, ae)[d] !== t[d] && u.has(d);
1652
- });
1653
- };
1654
- Z(this, V, Rr).call(this, { listeners: n() });
1655
- }
1656
- onQueryUpdate() {
1657
- this.updateResult(), this.hasListeners() && Z(this, V, Yt).call(this);
1658
- }
1659
- }, le = new WeakMap(), U = new WeakMap(), Ct = new WeakMap(), ae = new WeakMap(), Je = new WeakMap(), ut = new WeakMap(), Ce = new WeakMap(), Fe = new WeakMap(), jt = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), Xe = new WeakMap(), Ze = new WeakMap(), Be = new WeakMap(), ht = new WeakMap(), V = new WeakSet(), _t = function(t) {
1660
- Z(this, V, Xt).call(this);
1661
- let s = o(this, U).fetch(
1662
- this.options,
1663
- t
1664
- );
1665
- return t != null && t.throwOnError || (s = s.catch(Vt)), s;
1666
- }, zt = function() {
1667
- Z(this, V, Gt).call(this);
1668
- const t = Rt(
1669
- this.options.staleTime,
1670
- o(this, U)
1671
- );
1672
- if (St || o(this, ae).isStale || !cr(t))
1673
- return;
1674
- const n = qr(o(this, ae).dataUpdatedAt, t) + 1;
1675
- F(this, Xe, Mt.setTimeout(() => {
1676
- o(this, ae).isStale || this.updateResult();
1677
- }, n));
1678
- }, Qt = function() {
1679
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(o(this, U)) : this.options.refetchInterval) ?? !1;
1680
- }, Ht = function(t) {
1681
- Z(this, V, Jt).call(this), F(this, Be, t), !(St || xe(this.options.enabled, o(this, U)) === !1 || !cr(o(this, Be)) || o(this, Be) === 0) && F(this, Ze, Mt.setInterval(() => {
1682
- (this.options.refetchIntervalInBackground || Yr.isFocused()) && Z(this, V, _t).call(this);
1683
- }, o(this, Be)));
1684
- }, Yt = function() {
1685
- Z(this, V, zt).call(this), Z(this, V, Ht).call(this, Z(this, V, Qt).call(this));
1686
- }, Gt = function() {
1687
- o(this, Xe) && (Mt.clearTimeout(o(this, Xe)), F(this, Xe, void 0));
1688
- }, Jt = function() {
1689
- o(this, Ze) && (Mt.clearInterval(o(this, Ze)), F(this, Ze, void 0));
1690
- }, Xt = function() {
1691
- const t = o(this, le).getQueryCache().build(o(this, le), this.options);
1692
- if (t === o(this, U))
1693
- return;
1694
- const s = o(this, U);
1695
- F(this, U, t), F(this, Ct, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
1696
- }, Rr = function(t) {
1697
- Tr.batch(() => {
1698
- t.listeners && this.listeners.forEach((s) => {
1699
- s(o(this, ae));
1700
- }), o(this, le).getQueryCache().notify({
1701
- query: o(this, U),
1702
- type: "observerResultsUpdated"
1703
- });
1704
- });
1705
- }, wr);
1706
- function ss(e, t) {
1707
- return xe(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
1708
- }
1709
- function pr(e, t) {
1710
- return ss(e, t) || e.state.data !== void 0 && Zt(e, t, t.refetchOnMount);
1711
- }
1712
- function Zt(e, t, s) {
1713
- if (xe(t.enabled, e) !== !1 && Rt(t.staleTime, e) !== "static") {
1714
- const n = typeof s == "function" ? s(e) : s;
1715
- return n === "always" || n !== !1 && tr(e, t);
1716
- }
1717
- return !1;
1718
- }
1719
- function gr(e, t, s, n) {
1720
- return (e !== t || xe(n.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && tr(e, s);
1721
- }
1722
- function tr(e, t) {
1723
- return xe(t.enabled, e) !== !1 && e.isStaleByTime(Rt(t.staleTime, e));
1724
- }
1725
- function ns(e, t) {
1726
- return !qt(e.getCurrentResult(), t);
1727
- }
1728
- var is = we.createContext(
1729
- void 0
1730
- ), Sr = (e) => {
1731
- const t = we.useContext(is);
1732
- if (!t)
1733
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1734
- return t;
1735
- }, Cr = we.createContext(!1), as = () => we.useContext(Cr);
1736
- Cr.Provider;
1737
- function os() {
1738
- let e = !1;
1739
- return {
1740
- clearReset: () => {
1741
- e = !1;
1742
- },
1743
- reset: () => {
1744
- e = !0;
1745
- },
1746
- isReset: () => e
1747
- };
1748
- }
1749
- var cs = we.createContext(os()), ls = () => we.useContext(cs), us = (e, t) => {
1750
- (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
1751
- }, ds = (e) => {
1752
- we.useEffect(() => {
1753
- e.clearReset();
1754
- }, [e]);
1755
- }, fs = ({
1756
- result: e,
1757
- errorResetBoundary: t,
1758
- throwOnError: s,
1759
- query: n,
1760
- suspense: i
1761
- }) => e.isError && !t.isReset() && !e.isFetching && n && (i && e.data === void 0 || Qr(s, [e.error, n])), hs = (e) => {
1762
- if (e.suspense) {
1763
- const s = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), n = e.staleTime;
1764
- e.staleTime = typeof n == "function" ? (...i) => s(n(...i)) : s(n), typeof e.gcTime == "number" && (e.gcTime = Math.max(
1765
- e.gcTime,
1766
- 1e3
1767
- ));
1768
- }
1769
- }, ps = (e, t) => e.isLoading && e.isFetching && !t, gs = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, br = (e, t, s) => t.fetchOptimistic(e).catch(() => {
1770
- s.clearReset();
1771
- });
1772
- function bs(e, t, s) {
1773
- var l, v, w, k, N;
1774
- if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
1775
- throw new Error(
1776
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1777
- );
1778
- const n = as(), i = ls(), f = Sr(), u = f.defaultQueryOptions(e);
1779
- (v = (l = f.getDefaultOptions().queries) == null ? void 0 : l._experimental_beforeQuery) == null || v.call(
1780
- l,
1781
- u
1782
- ), process.env.NODE_ENV !== "production" && (u.queryFn || console.error(
1783
- `[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
1784
- )), u._optimisticResults = n ? "isRestoring" : "optimistic", hs(u), us(u, i), ds(i);
1785
- const g = !f.getQueryCache().get(u.queryHash), [d] = we.useState(
1786
- () => new t(
1787
- f,
1788
- u
1789
- )
1790
- ), y = d.getOptimisticResult(u), h = !n && e.subscribed !== !1;
1791
- if (we.useSyncExternalStore(
1792
- we.useCallback(
1793
- (_) => {
1794
- const I = h ? d.subscribe(Tr.batchCalls(_)) : Vt;
1795
- return d.updateResult(), I;
1796
- },
1797
- [d, h]
1798
- ),
1799
- () => d.getCurrentResult(),
1800
- () => d.getCurrentResult()
1801
- ), we.useEffect(() => {
1802
- d.setOptions(u);
1803
- }, [u, d]), gs(u, y))
1804
- throw br(u, d, i);
1805
- if (fs({
1806
- result: y,
1807
- errorResetBoundary: i,
1808
- throwOnError: u.throwOnError,
1809
- query: f.getQueryCache().get(u.queryHash),
1810
- suspense: u.suspense
1811
- }))
1812
- throw y.error;
1813
- if ((k = (w = f.getDefaultOptions().queries) == null ? void 0 : w._experimental_afterQuery) == null || k.call(
1814
- w,
1815
- u,
1816
- y
1817
- ), u.experimental_prefetchInRender && !St && ps(y, n)) {
1818
- const _ = g ? (
1819
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1820
- br(u, d, i)
1821
- ) : (
1822
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1823
- (N = f.getQueryCache().get(u.queryHash)) == null ? void 0 : N.promise
1824
- );
1825
- _ == null || _.catch(Vt).finally(() => {
1826
- d.updateResult();
1827
- });
1828
- }
1829
- return u.notifyOnChangeProps ? y : d.trackResult(y);
1830
- }
1831
- function jr(e, t) {
1832
- return bs(e, rs);
1833
- }
1834
- const ms = (e) => {
1835
- const t = Sr(), s = _r();
1836
- return se(() => {
1837
- const n = s.channel("animation-states-changes").on("postgres_changes", {
1140
+ }, Lt = (n) => {
1141
+ const l = Rt(), i = bt();
1142
+ return X(() => {
1143
+ const f = i.channel("animation-states-changes").on("postgres_changes", {
1838
1144
  event: "*",
1839
1145
  schema: "public",
1840
1146
  table: "animation_states"
1841
1147
  }, () => {
1842
- t.invalidateQueries({ queryKey: ["bob-animation-data"] });
1843
- }).subscribe(), i = s.channel("bob-animations-changes").on("postgres_changes", {
1148
+ l.invalidateQueries({ queryKey: ["bob-animation-data"] });
1149
+ }).subscribe(), d = i.channel("bob-animations-changes").on("postgres_changes", {
1844
1150
  event: "*",
1845
1151
  schema: "public",
1846
1152
  table: "bob_animations"
1847
1153
  }, () => {
1848
- t.invalidateQueries({ queryKey: ["bob-animation-data"] });
1154
+ l.invalidateQueries({ queryKey: ["bob-animation-data"] });
1849
1155
  }).subscribe();
1850
1156
  return () => {
1851
- s.removeChannel(n), s.removeChannel(i);
1157
+ i.removeChannel(f), i.removeChannel(d);
1852
1158
  };
1853
- }, [t, s]), jr({
1854
- queryKey: ["bob-animation-data", e],
1159
+ }, [l, i]), ht({
1160
+ queryKey: ["bob-animation-data", n],
1855
1161
  queryFn: async () => {
1856
- var _;
1857
- const { data: n, error: i } = await s.from("bob_looks").select("*").order("display_order");
1858
- if (i) throw i;
1859
- const f = (n || []).find((I) => I.is_active), u = e || (f == null ? void 0 : f.id) || n && ((_ = n[0]) == null ? void 0 : _.id) || null;
1860
- if (!u)
1162
+ var R;
1163
+ const { data: f, error: d } = await i.from("bob_looks").select("*").order("display_order");
1164
+ if (d) throw d;
1165
+ const _ = (f || []).find((I) => I.is_active), b = n || (_ == null ? void 0 : _.id) || f && ((R = f[0]) == null ? void 0 : R.id) || null;
1166
+ if (!b)
1861
1167
  return {
1862
1168
  states: [],
1863
1169
  configs: [],
1864
1170
  uploadedImages: [],
1865
- looks: n || [],
1171
+ looks: f || [],
1866
1172
  activeLookId: null
1867
1173
  };
1868
- const { data: g, error: d } = await s.from("animation_states").select("*").eq("is_active", !0).eq("look_id", u).order("display_order");
1869
- if (d) throw d;
1870
- const { data: y, error: h } = await s.from("bob_animations").select("*").eq("is_active", !0).eq("look_id", u).order("animation_state").order("sequence_order");
1871
- if (h) throw h;
1872
- const l = new Set((g || []).map((I) => I.state_key)), v = (y || []).filter((I) => l.has(I.animation_state)), { data: w, error: k } = await s.storage.from("bob-images").list();
1873
- if (k) throw k;
1874
- const N = (w || []).map((I) => {
1875
- const { data: p } = s.storage.from("bob-images").getPublicUrl(I.name);
1876
- return p.publicUrl;
1174
+ const { data: E, error: g } = await i.from("animation_states").select("*").eq("is_active", !0).eq("look_id", b).order("display_order");
1175
+ if (g) throw g;
1176
+ const { data: x, error: u } = await i.from("bob_animations").select("*").eq("is_active", !0).eq("look_id", b).order("animation_state").order("sequence_order");
1177
+ if (u) throw u;
1178
+ const p = new Set((E || []).map((I) => I.state_key)), h = (x || []).filter((I) => p.has(I.animation_state)), { data: j, error: C } = await i.storage.from("bob-images").list();
1179
+ if (C) throw C;
1180
+ const P = (j || []).map((I) => {
1181
+ const { data: s } = i.storage.from("bob-images").getPublicUrl(I.name);
1182
+ return s.publicUrl;
1877
1183
  });
1878
- return v.forEach((I) => {
1879
- const p = new Image();
1880
- p.src = I.image_url;
1184
+ return h.forEach((I) => {
1185
+ const s = new Image();
1186
+ s.src = I.image_url;
1881
1187
  }), {
1882
- states: g || [],
1883
- configs: v,
1884
- uploadedImages: N,
1885
- looks: n || [],
1886
- activeLookId: u
1188
+ states: E || [],
1189
+ configs: h,
1190
+ uploadedImages: P,
1191
+ looks: f || [],
1192
+ activeLookId: b
1887
1193
  };
1888
1194
  },
1889
1195
  staleTime: 30 * 1e3,
1890
1196
  gcTime: 5 * 60 * 1e3
1891
1197
  });
1892
- }, vs = () => {
1893
- const [e, t] = Q(""), [s, n] = Q(0), [i, f] = Q(400), [u, g] = Q(!1), d = H(), { data: y, isLoading: h } = ms(), l = H({}), { imageUrlsMap: v, alternateImages: w, offsetsMap: k, scalesMap: N, availableStates: _ } = Ft(() => {
1894
- if (!y)
1198
+ }, Pt = () => {
1199
+ const [n, l] = U(""), [i, f] = U(0), [d, _] = U(400), [b, E] = U(!1), g = V(), { data: x, isLoading: u } = Lt(), p = V({}), { imageUrlsMap: h, alternateImages: j, offsetsMap: C, scalesMap: P, availableStates: R } = rt(() => {
1200
+ if (!x)
1895
1201
  return {
1896
1202
  imageUrlsMap: {},
1897
1203
  alternateImages: {},
@@ -1899,261 +1205,261 @@ const ms = (e) => {
1899
1205
  scalesMap: {},
1900
1206
  availableStates: []
1901
1207
  };
1902
- const T = {}, b = {}, m = {}, S = {}, C = y.states.map((P) => P.state_key);
1903
- return C.forEach((P) => {
1904
- const j = y.configs.filter((L) => L.animation_state === P), R = j.map((L) => L.image_url), M = j.map((L) => L.vertical_offset || 0), A = j.map((L) => L.scale || 100);
1905
- if (R.length > 0) {
1906
- const L = y.states.find((te) => te.state_key === P);
1907
- T[P] = {
1908
- url: R[0],
1909
- animation_speed: (L == null ? void 0 : L.animation_speed) || 400,
1910
- pause_duration: (L == null ? void 0 : L.pause_duration) || 0,
1911
- loop_count: (L == null ? void 0 : L.loop_count) || 0
1912
- }, b[P] = R, m[P] = M, S[P] = A;
1208
+ const v = {}, a = {}, o = {}, w = {}, k = x.states.map((N) => N.state_key);
1209
+ return k.forEach((N) => {
1210
+ const O = x.configs.filter((S) => S.animation_state === N), y = O.map((S) => S.image_url), M = O.map((S) => S.vertical_offset || 0), $ = O.map((S) => S.scale || 100);
1211
+ if (y.length > 0) {
1212
+ const S = x.states.find((H) => H.state_key === N);
1213
+ v[N] = {
1214
+ url: y[0],
1215
+ animation_speed: (S == null ? void 0 : S.animation_speed) || 400,
1216
+ pause_duration: (S == null ? void 0 : S.pause_duration) || 0,
1217
+ loop_count: (S == null ? void 0 : S.loop_count) || 0
1218
+ }, a[N] = y, o[N] = M, w[N] = $;
1913
1219
  }
1914
1220
  }), {
1915
- imageUrlsMap: T,
1916
- alternateImages: b,
1917
- offsetsMap: m,
1918
- scalesMap: S,
1919
- availableStates: C
1221
+ imageUrlsMap: v,
1222
+ alternateImages: a,
1223
+ offsetsMap: o,
1224
+ scalesMap: w,
1225
+ availableStates: k
1920
1226
  };
1921
- }, [y]);
1922
- return se(() => {
1923
- l.current = v;
1924
- }, [v]), se(() => {
1925
- _.length > 0 && !e && t(_[0]);
1926
- }, [_, e]), se(() => {
1927
- const T = w[e];
1928
- if (d.current && clearInterval(d.current), T && T.length > 1) {
1929
- n(0);
1930
- const b = l.current[e], m = (b == null ? void 0 : b.animation_speed) || i || 400, S = (b == null ? void 0 : b.loop_count) || 0, C = (b == null ? void 0 : b.pause_duration) || 0;
1931
- let P = 0, j = !1;
1932
- const R = () => {
1933
- d.current = setInterval(() => {
1934
- j || n((M) => {
1935
- const A = (M + 1) % T.length;
1936
- return A === 0 && (P++, S > 0 && P >= S) ? (clearInterval(d.current), C > 0 && (j = !0, setTimeout(() => {
1937
- P = 0, j = !1, R();
1938
- }, C)), M) : A;
1227
+ }, [x]);
1228
+ return X(() => {
1229
+ p.current = h;
1230
+ }, [h]), X(() => {
1231
+ R.length > 0 && !n && l(R[0]);
1232
+ }, [R, n]), X(() => {
1233
+ const v = j[n];
1234
+ if (g.current && clearInterval(g.current), v && v.length > 1) {
1235
+ f(0);
1236
+ const a = p.current[n], o = (a == null ? void 0 : a.animation_speed) || d || 400, w = (a == null ? void 0 : a.loop_count) || 0, k = (a == null ? void 0 : a.pause_duration) || 0;
1237
+ let N = 0, O = !1;
1238
+ const y = () => {
1239
+ g.current = setInterval(() => {
1240
+ O || f((M) => {
1241
+ const $ = (M + 1) % v.length;
1242
+ return $ === 0 && (N++, w > 0 && N >= w) ? (clearInterval(g.current), k > 0 && (O = !0, setTimeout(() => {
1243
+ N = 0, O = !1, y();
1244
+ }, k)), M) : $;
1939
1245
  });
1940
- }, m);
1246
+ }, o);
1941
1247
  };
1942
- R();
1248
+ y();
1943
1249
  } else
1944
- n(0);
1250
+ f(0);
1945
1251
  return () => {
1946
- d.current && clearInterval(d.current);
1252
+ g.current && clearInterval(g.current);
1947
1253
  };
1948
- }, [e, w]), {
1949
- animationState: e,
1950
- setAnimationState: t,
1254
+ }, [n, j]), {
1255
+ animationState: n,
1256
+ setAnimationState: l,
1951
1257
  getCurrentImage: () => {
1952
- const T = w[e];
1953
- if (!T || T.length === 0) {
1954
- const b = _.find((m) => {
1955
- var S;
1956
- return ((S = w[m]) == null ? void 0 : S.length) > 0;
1258
+ const v = j[n];
1259
+ if (!v || v.length === 0) {
1260
+ const a = R.find((o) => {
1261
+ var w;
1262
+ return ((w = j[o]) == null ? void 0 : w.length) > 0;
1957
1263
  });
1958
- return b ? w[b][0] : "";
1264
+ return a ? j[a][0] : "";
1959
1265
  }
1960
- return T[s] || T[0];
1266
+ return v[i] || v[0];
1961
1267
  },
1962
1268
  getCurrentOffset: () => {
1963
- const T = k[e];
1964
- if (!T || T.length === 0) {
1965
- const b = _.find((m) => {
1966
- var S;
1967
- return ((S = k[m]) == null ? void 0 : S.length) > 0;
1269
+ const v = C[n];
1270
+ if (!v || v.length === 0) {
1271
+ const a = R.find((o) => {
1272
+ var w;
1273
+ return ((w = C[o]) == null ? void 0 : w.length) > 0;
1968
1274
  });
1969
- return b ? k[b][0] : 0;
1275
+ return a ? C[a][0] : 0;
1970
1276
  }
1971
- return T[s] || T[0];
1277
+ return v[i] || v[0];
1972
1278
  },
1973
1279
  getCurrentScale: () => {
1974
- const T = N[e];
1975
- if (!T || T.length === 0) {
1976
- const b = _.find((m) => {
1977
- var S;
1978
- return ((S = N[m]) == null ? void 0 : S.length) > 0;
1280
+ const v = P[n];
1281
+ if (!v || v.length === 0) {
1282
+ const a = R.find((o) => {
1283
+ var w;
1284
+ return ((w = P[o]) == null ? void 0 : w.length) > 0;
1979
1285
  });
1980
- return b ? N[b][0] : 100;
1286
+ return a ? P[a][0] : 100;
1981
1287
  }
1982
- return T[s] || T[0];
1288
+ return v[i] || v[0];
1983
1289
  },
1984
- imageUrls: v,
1985
- availableStates: _,
1986
- setTalkSpeed: f,
1987
- manualMode: u,
1988
- setManualMode: g,
1989
- isLoading: h
1290
+ imageUrls: h,
1291
+ availableStates: R,
1292
+ setTalkSpeed: _,
1293
+ manualMode: b,
1294
+ setManualMode: E,
1295
+ isLoading: u
1990
1296
  };
1991
- }, ys = () => {
1992
- const e = _r(), { data: t = [], isLoading: s } = jr({
1297
+ }, Bt = () => {
1298
+ const n = bt(), { data: l = [], isLoading: i } = ht({
1993
1299
  queryKey: ["bob-backdrops"],
1994
1300
  queryFn: async () => {
1995
- const { data: i, error: f } = await e.from("bob_backdrops").select("*").order("display_order", { ascending: !0 });
1996
- if (f) throw f;
1997
- return i;
1301
+ const { data: d, error: _ } = await n.from("bob_backdrops").select("*").order("display_order", { ascending: !0 });
1302
+ if (_) throw _;
1303
+ return d;
1998
1304
  },
1999
1305
  staleTime: 5 * 60 * 1e3,
2000
1306
  gcTime: 10 * 60 * 1e3
2001
- }), n = t.find((i) => i.is_active);
1307
+ }), f = l.find((d) => d.is_active);
2002
1308
  return {
2003
- backdrops: t,
2004
- activeBackdrop: n,
2005
- isLoading: s
1309
+ backdrops: l,
1310
+ activeBackdrop: f,
1311
+ isLoading: i
2006
1312
  };
2007
- }, xs = ({
2008
- currentImage: e,
2009
- animationState: t,
2010
- backdropUrl: s,
2011
- counterOverlayUrl: n,
2012
- counterHeightPercent: i = 12,
2013
- className: f = "",
2014
- verticalOffset: u = 0,
2015
- scale: g = 100
1313
+ }, At = ({
1314
+ currentImage: n,
1315
+ animationState: l,
1316
+ backdropUrl: i,
1317
+ counterOverlayUrl: f,
1318
+ counterHeightPercent: d = 12,
1319
+ className: _ = "",
1320
+ verticalOffset: b = 0,
1321
+ scale: E = 100
2016
1322
  }) => {
2017
- const d = u + i, y = 55 * (g / 100);
2018
- return /* @__PURE__ */ a.jsx("div", { className: `flex flex-col items-center justify-center gap-6 w-full ${f}`, children: /* @__PURE__ */ a.jsxs("div", { className: "relative w-full max-w-[600px] mx-auto aspect-[16/10] overflow-hidden", children: [
2019
- s && /* @__PURE__ */ a.jsx(
1323
+ const g = b + d, x = 55 * (E / 100);
1324
+ return /* @__PURE__ */ t.jsx("div", { className: `flex flex-col items-center justify-center gap-6 w-full ${_}`, children: /* @__PURE__ */ t.jsxs("div", { className: "relative w-full max-w-[600px] mx-auto aspect-[16/10] overflow-hidden", children: [
1325
+ i && /* @__PURE__ */ t.jsx(
2020
1326
  "img",
2021
1327
  {
2022
- src: s,
1328
+ src: i,
2023
1329
  alt: "Backdrop",
2024
1330
  className: "absolute inset-0 z-0 w-full h-full object-cover object-bottom"
2025
1331
  }
2026
1332
  ),
2027
- /* @__PURE__ */ a.jsx(
1333
+ /* @__PURE__ */ t.jsx(
2028
1334
  "img",
2029
1335
  {
2030
- src: e,
2031
- alt: `Bob ${t}`,
1336
+ src: n,
1337
+ alt: `Bob ${l}`,
2032
1338
  className: "absolute z-10 h-auto object-contain left-1/2 -translate-x-1/2",
2033
1339
  style: {
2034
- bottom: `${d}%`,
2035
- width: `${y}%`,
2036
- maxWidth: `${220 * (g / 100)}px`,
1340
+ bottom: `${g}%`,
1341
+ width: `${x}%`,
1342
+ maxWidth: `${220 * (E / 100)}px`,
2037
1343
  transformOrigin: "center bottom"
2038
1344
  }
2039
1345
  }
2040
1346
  ),
2041
- n && /* @__PURE__ */ a.jsx(
1347
+ f && /* @__PURE__ */ t.jsx(
2042
1348
  "img",
2043
1349
  {
2044
- src: n,
1350
+ src: f,
2045
1351
  alt: "Counter",
2046
1352
  className: "absolute z-20 bottom-0 left-0 w-full object-cover object-bottom",
2047
- style: { height: `${i}%` }
1353
+ style: { height: `${d}%` }
2048
1354
  }
2049
1355
  )
2050
1356
  ] }) });
2051
- }, ws = ({
2052
- messages: e,
2053
- input: t,
2054
- setInput: s,
2055
- isLoading: n,
2056
- onSend: i,
2057
- onKeyPress: f,
2058
- onInputFocus: u,
2059
- onInputBlur: g,
2060
- chatEndRef: d,
2061
- isMuted: y = !1,
2062
- onToggleMute: h,
2063
- isSpeaking: l = !1,
2064
- className: v = ""
2065
- }) => /* @__PURE__ */ a.jsx("div", { className: `w-full max-w-6xl mx-auto px-4 pb-8 ${v}`, children: /* @__PURE__ */ a.jsxs("div", { className: "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden", children: [
2066
- /* @__PURE__ */ a.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800", children: /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2", children: [
2067
- /* @__PURE__ */ a.jsx(
1357
+ }, Mt = ({
1358
+ messages: n,
1359
+ input: l,
1360
+ setInput: i,
1361
+ isLoading: f,
1362
+ onSend: d,
1363
+ onKeyPress: _,
1364
+ onInputFocus: b,
1365
+ onInputBlur: E,
1366
+ chatEndRef: g,
1367
+ isMuted: x = !1,
1368
+ onToggleMute: u,
1369
+ isSpeaking: p = !1,
1370
+ className: h = ""
1371
+ }) => /* @__PURE__ */ t.jsx("div", { className: `w-full max-w-6xl mx-auto px-4 pb-8 ${h}`, children: /* @__PURE__ */ t.jsxs("div", { className: "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden", children: [
1372
+ /* @__PURE__ */ t.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800", children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
1373
+ /* @__PURE__ */ t.jsx(
2068
1374
  "input",
2069
1375
  {
2070
- value: t,
2071
- onChange: (w) => s(w.target.value),
2072
- onKeyPress: f,
2073
- onFocus: u,
2074
- onBlur: g,
1376
+ value: l,
1377
+ onChange: (j) => i(j.target.value),
1378
+ onKeyPress: _,
1379
+ onFocus: b,
1380
+ onBlur: E,
2075
1381
  placeholder: "Ask Bob about car parts...",
2076
- disabled: n,
1382
+ disabled: f,
2077
1383
  className: "flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
2078
1384
  }
2079
1385
  ),
2080
- h && /* @__PURE__ */ a.jsx(
1386
+ u && /* @__PURE__ */ t.jsx(
2081
1387
  "button",
2082
1388
  {
2083
- onClick: h,
2084
- className: `shrink-0 p-2 border border-gray-300 dark:border-gray-600 rounded-md ${l ? "animate-pulse" : ""}`,
2085
- title: y ? "Unmute Bob's voice" : "Mute Bob's voice",
2086
- children: y ? "🔇" : "🔊"
1389
+ onClick: u,
1390
+ className: `shrink-0 p-2 border border-gray-300 dark:border-gray-600 rounded-md ${p ? "animate-pulse" : ""}`,
1391
+ title: x ? "Unmute Bob's voice" : "Mute Bob's voice",
1392
+ children: x ? "🔇" : "🔊"
2087
1393
  }
2088
1394
  ),
2089
- /* @__PURE__ */ a.jsx(
1395
+ /* @__PURE__ */ t.jsx(
2090
1396
  "button",
2091
1397
  {
2092
- onClick: i,
2093
- disabled: n || !t.trim(),
1398
+ onClick: d,
1399
+ disabled: f || !l.trim(),
2094
1400
  className: "shrink-0 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",
2095
1401
  children: "Send"
2096
1402
  }
2097
1403
  )
2098
1404
  ] }) }),
2099
- /* @__PURE__ */ a.jsxs("div", { className: "overflow-y-auto p-4 space-y-3 h-[300px] md:h-[400px]", children: [
2100
- [...e].reverse().map((w, k) => /* @__PURE__ */ a.jsx(
1405
+ /* @__PURE__ */ t.jsxs("div", { className: "overflow-y-auto p-4 space-y-3 h-[300px] md:h-[400px]", children: [
1406
+ [...n].reverse().map((j, C) => /* @__PURE__ */ t.jsx(
2101
1407
  "div",
2102
1408
  {
2103
- className: `flex ${w.role === "user" ? "justify-end" : "justify-start"}`,
2104
- children: /* @__PURE__ */ a.jsx(
1409
+ className: `flex ${j.role === "user" ? "justify-end" : "justify-start"}`,
1410
+ children: /* @__PURE__ */ t.jsx(
2105
1411
  "div",
2106
1412
  {
2107
- className: `max-w-[80%] rounded-lg px-4 py-2 text-sm md:text-base ${w.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100"}`,
2108
- children: w.content
1413
+ className: `max-w-[80%] rounded-lg px-4 py-2 text-sm md:text-base ${j.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100"}`,
1414
+ children: j.content
2109
1415
  }
2110
1416
  )
2111
1417
  },
2112
- k
1418
+ C
2113
1419
  )),
2114
- /* @__PURE__ */ a.jsx("div", { ref: d })
1420
+ /* @__PURE__ */ t.jsx("div", { ref: g })
2115
1421
  ] })
2116
- ] }) }), Es = ({
2117
- currentImage: e,
2118
- animationState: t,
2119
- counterOverlayUrl: s,
2120
- counterHeightPercent: n = 15,
2121
- scale: i = 100,
2122
- position: f = "center"
1422
+ ] }) }), $t = ({
1423
+ currentImage: n,
1424
+ animationState: l,
1425
+ counterOverlayUrl: i,
1426
+ counterHeightPercent: f = 15,
1427
+ scale: d = 100,
1428
+ position: _ = "center"
2123
1429
  }) => {
2124
- const u = 85 * i / 100, g = 400 * i / 100, d = f === "center" ? "-20%" : "-35%";
2125
- return /* @__PURE__ */ a.jsxs("div", { className: "absolute inset-0 pointer-events-none overflow-hidden", children: [
2126
- /* @__PURE__ */ a.jsx(
1430
+ const b = 85 * d / 100, E = 400 * d / 100, g = _ === "center" ? "-20%" : "-35%";
1431
+ return /* @__PURE__ */ t.jsxs("div", { className: "absolute inset-0 pointer-events-none overflow-hidden", children: [
1432
+ /* @__PURE__ */ t.jsx(
2127
1433
  "div",
2128
1434
  {
2129
1435
  className: "absolute left-0 z-40",
2130
1436
  style: {
2131
- bottom: `${n - 2}%`,
2132
- transform: `translateX(${d})`,
2133
- width: `${u}%`,
2134
- maxWidth: `${g}px`,
1437
+ bottom: `${f - 2}%`,
1438
+ transform: `translateX(${g})`,
1439
+ width: `${b}%`,
1440
+ maxWidth: `${E}px`,
2135
1441
  transition: "transform 0.4s ease-out"
2136
1442
  },
2137
- children: /* @__PURE__ */ a.jsx(
1443
+ children: /* @__PURE__ */ t.jsx(
2138
1444
  "img",
2139
1445
  {
2140
- src: e,
2141
- alt: `Bob ${t}`,
1446
+ src: n,
1447
+ alt: `Bob ${l}`,
2142
1448
  className: "w-full h-auto object-contain",
2143
1449
  style: { display: "block" }
2144
1450
  }
2145
1451
  )
2146
1452
  }
2147
1453
  ),
2148
- s && /* @__PURE__ */ a.jsx(
1454
+ i && /* @__PURE__ */ t.jsx(
2149
1455
  "div",
2150
1456
  {
2151
1457
  className: "absolute bottom-0 left-0 right-0 z-50",
2152
- style: { height: `${n}%` },
2153
- children: /* @__PURE__ */ a.jsx(
1458
+ style: { height: `${f}%` },
1459
+ children: /* @__PURE__ */ t.jsx(
2154
1460
  "img",
2155
1461
  {
2156
- src: s,
1462
+ src: i,
2157
1463
  alt: "Shop counter",
2158
1464
  className: "w-full h-full object-cover object-top"
2159
1465
  }
@@ -2161,308 +1467,308 @@ const ms = (e) => {
2161
1467
  }
2162
1468
  )
2163
1469
  ] });
2164
- }, mr = (e, t) => {
2165
- if (!e || !t) return !1;
2166
- const s = e.toLowerCase();
2167
- return t.toLowerCase().replace(/s\b/g, "").split(/\s+/).filter(Boolean).every((i) => s.includes(i));
2168
- }, _s = (e, t) => {
2169
- var i;
2170
- const s = ((i = e.brand) == null ? void 0 : i.toLowerCase()) === t.brand.toLowerCase(), n = Math.abs(e.price - t.price) < 1;
2171
- return s && n;
2172
- }, Ts = ({
2173
- products: e,
2174
- servicePackages: t,
2175
- highlightedPartType: s,
2176
- highlightedProduct: n,
2177
- onProductClick: i,
2178
- onPackageSelect: f,
2179
- isResearching: u,
2180
- visible: g = !0,
2181
- counterHeightPercent: d = 22,
2182
- hasVehicle: y = !1
1470
+ }, pt = (n, l) => {
1471
+ if (!n || !l) return !1;
1472
+ const i = n.toLowerCase();
1473
+ return l.toLowerCase().replace(/s\b/g, "").split(/\s+/).filter(Boolean).every((d) => i.includes(d));
1474
+ }, Dt = (n, l) => {
1475
+ var d;
1476
+ const i = ((d = n.brand) == null ? void 0 : d.toLowerCase()) === l.brand.toLowerCase(), f = Math.abs(n.price - l.price) < 1;
1477
+ return i && f;
1478
+ }, Ft = ({
1479
+ products: n,
1480
+ servicePackages: l,
1481
+ highlightedPartType: i,
1482
+ highlightedProduct: f,
1483
+ onProductClick: d,
1484
+ onPackageSelect: _,
1485
+ isResearching: b,
1486
+ visible: E = !0,
1487
+ counterHeightPercent: g = 22,
1488
+ hasVehicle: x = !1
2183
1489
  }) => {
2184
- const h = H(null), l = H({}), v = H(null), w = Ft(() => {
2185
- const p = {};
2186
- return e.forEach((T) => {
2187
- const b = T.partslotDescription || "Other Parts";
2188
- p[b] || (p[b] = []), p[b].push(T);
2189
- }), Object.keys(p).sort((T, b) => T.localeCompare(b)).map((T) => ({ name: T, products: p[T] }));
2190
- }, [e]);
2191
- se(() => {
2192
- var p;
2193
- if (s) {
2194
- const E = w.find((T) => mr(T.name, s));
2195
- E && l.current[E.name] && ((p = l.current[E.name]) == null || p.scrollIntoView({ behavior: "smooth", block: "start" }));
2196
- }
2197
- }, [s, w]), se(() => {
2198
- n && v.current && v.current.scrollIntoView({ behavior: "smooth", block: "center" });
1490
+ const u = V(null), p = V({}), h = V(null), j = rt(() => {
1491
+ const s = {};
1492
+ return n.forEach((v) => {
1493
+ const a = v.partslotDescription || "Other Parts";
1494
+ s[a] || (s[a] = []), s[a].push(v);
1495
+ }), Object.keys(s).sort((v, a) => v.localeCompare(a)).map((v) => ({ name: v, products: s[v] }));
2199
1496
  }, [n]);
2200
- const k = e.length > 0 || t.length > 0, N = u, _ = k && !u, I = y ? "56px" : "8px";
2201
- return /* @__PURE__ */ a.jsxs(
1497
+ X(() => {
1498
+ var s;
1499
+ if (i) {
1500
+ const m = j.find((v) => pt(v.name, i));
1501
+ m && p.current[m.name] && ((s = p.current[m.name]) == null || s.scrollIntoView({ behavior: "smooth", block: "start" }));
1502
+ }
1503
+ }, [i, j]), X(() => {
1504
+ f && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "center" });
1505
+ }, [f]);
1506
+ const C = n.length > 0 || l.length > 0, P = b, R = C && !b, I = x ? "56px" : "8px";
1507
+ return /* @__PURE__ */ t.jsxs(
2202
1508
  "div",
2203
1509
  {
2204
- ref: h,
2205
- className: `absolute right-2 w-[52%] max-w-[220px] overflow-y-auto overflow-x-hidden z-30 flex flex-col gap-2 pb-4 transition-all duration-300 ease-out ${g ? "opacity-100 translate-x-0" : "opacity-0 translate-x-8 pointer-events-none"}`,
1510
+ ref: u,
1511
+ className: `absolute right-2 w-[52%] max-w-[220px] overflow-y-auto overflow-x-hidden z-30 flex flex-col gap-2 pb-4 transition-all duration-300 ease-out ${E ? "opacity-100 translate-x-0" : "opacity-0 translate-x-8 pointer-events-none"}`,
2206
1512
  style: {
2207
1513
  top: I,
2208
- bottom: `calc(${d}% + 16px)`,
1514
+ bottom: `calc(${g}% + 16px)`,
2209
1515
  paddingTop: "env(safe-area-inset-top, 4px)"
2210
1516
  },
2211
1517
  children: [
2212
- N && /* @__PURE__ */ a.jsx("div", { className: "rounded-lg p-3", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
2213
- /* @__PURE__ */ a.jsx("div", { className: "w-4 h-4 border-2 border-blue-600 border-t-transparent rounded-full animate-spin" }),
2214
- /* @__PURE__ */ a.jsx("span", { children: "Finding parts..." })
1518
+ P && /* @__PURE__ */ t.jsx("div", { className: "rounded-lg p-3", children: /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
1519
+ /* @__PURE__ */ t.jsx("div", { className: "w-4 h-4 border-2 border-blue-600 border-t-transparent rounded-full animate-spin" }),
1520
+ /* @__PURE__ */ t.jsx("span", { children: "Finding parts..." })
2215
1521
  ] }) }),
2216
- _ && t.length > 0 && /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
2217
- /* @__PURE__ */ a.jsxs("div", { className: "text-xs font-semibold text-blue-600 flex items-center gap-1 px-1", children: [
2218
- /* @__PURE__ */ a.jsx("svg", { className: "h-3 w-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
1522
+ R && l.length > 0 && /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
1523
+ /* @__PURE__ */ t.jsxs("div", { className: "text-xs font-semibold text-blue-600 flex items-center gap-1 px-1", children: [
1524
+ /* @__PURE__ */ t.jsx("svg", { className: "h-3 w-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
2219
1525
  "Service Packages"
2220
1526
  ] }),
2221
- t.map((p) => /* @__PURE__ */ a.jsxs(
1527
+ l.map((s) => /* @__PURE__ */ t.jsxs(
2222
1528
  "div",
2223
1529
  {
2224
- onClick: () => f == null ? void 0 : f(p),
1530
+ onClick: () => _ == null ? void 0 : _(s),
2225
1531
  className: "cursor-pointer hover:shadow-md transition-all bg-white/80 rounded-lg border border-gray-200 p-2",
2226
1532
  children: [
2227
- /* @__PURE__ */ a.jsx("p", { className: "text-xs font-medium line-clamp-1", children: p.title }),
2228
- /* @__PURE__ */ a.jsxs("p", { className: "text-sm font-bold text-blue-600", children: [
1533
+ /* @__PURE__ */ t.jsx("p", { className: "text-xs font-medium line-clamp-1", children: s.title }),
1534
+ /* @__PURE__ */ t.jsxs("p", { className: "text-sm font-bold text-blue-600", children: [
2229
1535
  "$",
2230
- p.from_price.toFixed(0)
1536
+ s.from_price.toFixed(0)
2231
1537
  ] })
2232
1538
  ]
2233
1539
  },
2234
- p.id
1540
+ s.id
2235
1541
  ))
2236
1542
  ] }),
2237
- _ && w.map(({ name: p, products: E }, T) => {
2238
- const b = s && mr(p, s);
2239
- return /* @__PURE__ */ a.jsxs(
1543
+ R && j.map(({ name: s, products: m }, v) => {
1544
+ const a = i && pt(s, i);
1545
+ return /* @__PURE__ */ t.jsxs(
2240
1546
  "section",
2241
1547
  {
2242
- ref: (m) => {
2243
- l.current[p] = m;
1548
+ ref: (o) => {
1549
+ p.current[s] = o;
2244
1550
  },
2245
- className: `rounded-lg transition-all border border-transparent ${b ? "ring-2 ring-blue-600 p-2 bg-blue-50/50 shadow-lg" : ""}`,
1551
+ className: `rounded-lg transition-all border border-transparent ${a ? "ring-2 ring-blue-600 p-2 bg-blue-50/50 shadow-lg" : ""}`,
2246
1552
  children: [
2247
- /* @__PURE__ */ a.jsxs("h3", { className: "text-xs font-semibold mb-2 flex items-center gap-1 px-1 text-gray-900", children: [
2248
- /* @__PURE__ */ a.jsx("svg", { className: "h-3 w-3 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
2249
- /* @__PURE__ */ a.jsx("span", { className: "truncate", children: p }),
2250
- /* @__PURE__ */ a.jsxs("span", { className: "text-[10px] text-gray-500", children: [
1553
+ /* @__PURE__ */ t.jsxs("h3", { className: "text-xs font-semibold mb-2 flex items-center gap-1 px-1 text-gray-900", children: [
1554
+ /* @__PURE__ */ t.jsx("svg", { className: "h-3 w-3 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
1555
+ /* @__PURE__ */ t.jsx("span", { className: "truncate", children: s }),
1556
+ /* @__PURE__ */ t.jsxs("span", { className: "text-[10px] text-gray-500", children: [
2251
1557
  "(",
2252
- E.length,
1558
+ m.length,
2253
1559
  ")"
2254
1560
  ] })
2255
1561
  ] }),
2256
- /* @__PURE__ */ a.jsx("div", { className: "space-y-2", children: E.map((m, S) => {
2257
- const C = n && _s(m, n);
2258
- return /* @__PURE__ */ a.jsxs(
1562
+ /* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: m.map((o, w) => {
1563
+ const k = f && Dt(o, f);
1564
+ return /* @__PURE__ */ t.jsxs(
2259
1565
  "div",
2260
1566
  {
2261
- ref: C ? v : void 0,
2262
- onClick: () => i == null ? void 0 : i(m),
2263
- className: `cursor-pointer transition-all bg-white/80 rounded-lg border border-gray-200 relative ${C ? "ring-4 ring-blue-600 scale-105 z-10" : "hover:shadow-md"}`,
1567
+ ref: k ? h : void 0,
1568
+ onClick: () => d == null ? void 0 : d(o),
1569
+ className: `cursor-pointer transition-all bg-white/80 rounded-lg border border-gray-200 relative ${k ? "ring-4 ring-blue-600 scale-105 z-10" : "hover:shadow-md"}`,
2264
1570
  children: [
2265
- C && /* @__PURE__ */ a.jsxs("span", { className: "absolute -top-2 -right-2 bg-blue-600 text-white text-[8px] px-1 py-0.5 rounded z-20 flex items-center", children: [
2266
- /* @__PURE__ */ a.jsx("svg", { className: "h-2 w-2 mr-0.5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ a.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) }),
1571
+ k && /* @__PURE__ */ t.jsxs("span", { className: "absolute -top-2 -right-2 bg-blue-600 text-white text-[8px] px-1 py-0.5 rounded z-20 flex items-center", children: [
1572
+ /* @__PURE__ */ t.jsx("svg", { className: "h-2 w-2 mr-0.5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) }),
2267
1573
  "Pick"
2268
1574
  ] }),
2269
- /* @__PURE__ */ a.jsxs("div", { className: "p-2", children: [
2270
- /* @__PURE__ */ a.jsx("div", { className: "aspect-square bg-gray-100 rounded-md mb-1 flex items-center justify-center overflow-hidden", children: m.image_url ? /* @__PURE__ */ a.jsx("img", { src: m.image_url, alt: m.name, className: "w-full h-full object-contain" }) : /* @__PURE__ */ a.jsx("svg", { className: "h-8 w-8 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }) }),
2271
- /* @__PURE__ */ a.jsx("p", { className: "text-xs font-medium line-clamp-2", children: m.name }),
2272
- m.brand && /* @__PURE__ */ a.jsx("p", { className: "text-[10px] text-gray-500", children: m.brand })
1575
+ /* @__PURE__ */ t.jsxs("div", { className: "p-2", children: [
1576
+ /* @__PURE__ */ t.jsx("div", { className: "aspect-square bg-gray-100 rounded-md mb-1 flex items-center justify-center overflow-hidden", children: o.image_url ? /* @__PURE__ */ t.jsx("img", { src: o.image_url, alt: o.name, className: "w-full h-full object-contain" }) : /* @__PURE__ */ t.jsx("svg", { className: "h-8 w-8 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }) }),
1577
+ /* @__PURE__ */ t.jsx("p", { className: "text-xs font-medium line-clamp-2", children: o.name }),
1578
+ o.brand && /* @__PURE__ */ t.jsx("p", { className: "text-[10px] text-gray-500", children: o.brand })
2273
1579
  ] }),
2274
- /* @__PURE__ */ a.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ a.jsx("span", { className: "text-sm font-bold text-blue-600", children: m.price > 0 ? `$${m.price.toFixed(2)}` : "Price on request" }) }),
2275
- /* @__PURE__ */ a.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ a.jsx(
1580
+ /* @__PURE__ */ t.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ t.jsx("span", { className: "text-sm font-bold text-blue-600", children: o.price > 0 ? `$${o.price.toFixed(2)}` : "Price on request" }) }),
1581
+ /* @__PURE__ */ t.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ t.jsx(
2276
1582
  "button",
2277
1583
  {
2278
1584
  className: "w-full bg-blue-600 text-white text-xs py-1.5 rounded-md hover:bg-blue-700",
2279
- onClick: (P) => {
2280
- P.stopPropagation(), i == null || i(m);
1585
+ onClick: (N) => {
1586
+ N.stopPropagation(), d == null || d(o);
2281
1587
  },
2282
1588
  children: "Buy Now"
2283
1589
  }
2284
1590
  ) })
2285
1591
  ]
2286
1592
  },
2287
- `${m.id}-${S}`
1593
+ `${o.id}-${w}`
2288
1594
  );
2289
1595
  }) })
2290
1596
  ]
2291
1597
  },
2292
- p
1598
+ s
2293
1599
  );
2294
1600
  })
2295
1601
  ]
2296
1602
  }
2297
1603
  );
2298
- }, Rs = ({
2299
- onTranscript: e,
2300
- onSpeechEnd: t,
2301
- language: s = "en-NZ",
2302
- mode: n = "toggle"
1604
+ }, Wt = ({
1605
+ onTranscript: n,
1606
+ onSpeechEnd: l,
1607
+ language: i = "en-NZ",
1608
+ mode: f = "toggle"
2303
1609
  } = {}) => {
2304
- const [i, f] = Q(!1), [u, g] = Q(""), [d, y] = Q(""), [h, l] = Q(null), [v, w] = Q(!1), k = H(null), N = H(""), _ = H(e), I = H(t);
2305
- se(() => {
2306
- _.current = e, I.current = t;
2307
- }, [e, t]), se(() => {
2308
- const b = window.SpeechRecognition || window.webkitSpeechRecognition;
2309
- if (b) {
2310
- w(!0);
2311
- const m = new b();
2312
- m.continuous = n === "ptt", m.interimResults = !0, m.lang = s, m.maxAlternatives = 1, m.onstart = () => {
2313
- f(!0), l(null);
2314
- }, m.onresult = (S) => {
2315
- let C = "", P = "";
2316
- for (let j = S.resultIndex; j < S.results.length; j++) {
2317
- const R = S.results[j][0].transcript;
2318
- S.results[j].isFinal ? P += R : C += R;
1610
+ const [d, _] = U(!1), [b, E] = U(""), [g, x] = U(""), [u, p] = U(null), [h, j] = U(!1), C = V(null), P = V(""), R = V(n), I = V(l);
1611
+ X(() => {
1612
+ R.current = n, I.current = l;
1613
+ }, [n, l]), X(() => {
1614
+ const a = window.SpeechRecognition || window.webkitSpeechRecognition;
1615
+ if (a) {
1616
+ j(!0);
1617
+ const o = new a();
1618
+ o.continuous = f === "ptt", o.interimResults = !0, o.lang = i, o.maxAlternatives = 1, o.onstart = () => {
1619
+ _(!0), p(null);
1620
+ }, o.onresult = (w) => {
1621
+ let k = "", N = "";
1622
+ for (let O = w.resultIndex; O < w.results.length; O++) {
1623
+ const y = w.results[O][0].transcript;
1624
+ w.results[O].isFinal ? N += y : k += y;
2319
1625
  }
2320
- P && (N.current = P, g(P), _.current && _.current(P)), y(C);
2321
- }, m.onerror = (S) => {
2322
- switch (f(!1), S.error) {
1626
+ N && (P.current = N, E(N), R.current && R.current(N)), x(k);
1627
+ }, o.onerror = (w) => {
1628
+ switch (_(!1), w.error) {
2323
1629
  case "no-speech":
2324
- l("No speech detected. Please try again.");
1630
+ p("No speech detected. Please try again.");
2325
1631
  break;
2326
1632
  case "audio-capture":
2327
- l("No microphone found. Please check your device.");
1633
+ p("No microphone found. Please check your device.");
2328
1634
  break;
2329
1635
  case "not-allowed":
2330
- l("Microphone permission denied. Please allow access.");
1636
+ p("Microphone permission denied. Please allow access.");
2331
1637
  break;
2332
1638
  default:
2333
- l("Speech recognition error. Please try again.");
1639
+ p("Speech recognition error. Please try again.");
2334
1640
  }
2335
- }, m.onend = () => {
2336
- f(!1), y(""), N.current && I.current && I.current(N.current), N.current = "";
2337
- }, k.current = m;
1641
+ }, o.onend = () => {
1642
+ _(!1), x(""), P.current && I.current && I.current(P.current), P.current = "";
1643
+ }, C.current = o;
2338
1644
  }
2339
1645
  return () => {
2340
- k.current && k.current.stop();
1646
+ C.current && C.current.stop();
2341
1647
  };
2342
- }, [s, n]);
2343
- const p = () => {
2344
- k.current && !i && (g(""), y(""), l(null), k.current.start());
2345
- }, E = () => {
2346
- k.current && i && k.current.stop();
1648
+ }, [i, f]);
1649
+ const s = () => {
1650
+ C.current && !d && (E(""), x(""), p(null), C.current.start());
1651
+ }, m = () => {
1652
+ C.current && d && C.current.stop();
2347
1653
  };
2348
1654
  return {
2349
- isListening: i,
2350
- transcript: u,
2351
- interimTranscript: d,
2352
- error: h,
2353
- isSupported: v,
2354
- startListening: p,
2355
- stopListening: E,
1655
+ isListening: d,
1656
+ transcript: b,
1657
+ interimTranscript: g,
1658
+ error: u,
1659
+ isSupported: h,
1660
+ startListening: s,
1661
+ stopListening: m,
2356
1662
  toggleListening: () => {
2357
- i ? E() : p();
1663
+ d ? m() : s();
2358
1664
  }
2359
1665
  };
2360
- }, Ss = ({
2361
- messages: e,
2362
- input: t,
2363
- setInput: s,
2364
- isLoading: n,
2365
- onSend: i,
2366
- onKeyPress: f,
2367
- onInputFocus: u,
2368
- onInputBlur: g,
2369
- chatEndRef: d,
2370
- isMuted: y = !1,
2371
- onToggleMute: h,
2372
- isSpeaking: l = !1
1666
+ }, Ut = ({
1667
+ messages: n,
1668
+ input: l,
1669
+ setInput: i,
1670
+ isLoading: f,
1671
+ onSend: d,
1672
+ onKeyPress: _,
1673
+ onInputFocus: b,
1674
+ onInputBlur: E,
1675
+ chatEndRef: g,
1676
+ isMuted: x = !1,
1677
+ onToggleMute: u,
1678
+ isSpeaking: p = !1
2373
1679
  }) => {
2374
- const [v, w] = Q(!1), k = H(null), N = H(!1), {
2375
- isListening: _,
1680
+ const [h, j] = U(!1), C = V(null), P = V(!1), {
1681
+ isListening: R,
2376
1682
  interimTranscript: I,
2377
- error: p,
2378
- isSupported: E,
2379
- startListening: T,
2380
- stopListening: b
2381
- } = Rs({
2382
- onTranscript: (j) => s(j),
1683
+ error: s,
1684
+ isSupported: m,
1685
+ startListening: v,
1686
+ stopListening: a
1687
+ } = Wt({
1688
+ onTranscript: (O) => i(O),
2383
1689
  language: "en-NZ",
2384
1690
  mode: "ptt"
2385
1691
  });
2386
- se(() => {
2387
- I && s(I);
2388
- }, [I, s]);
2389
- const m = G(() => {
2390
- n || N.current || (N.current = !0, navigator.vibrate && navigator.vibrate(10), T());
2391
- }, [n, T]), S = G(() => {
2392
- N.current && (N.current = !1, navigator.vibrate && navigator.vibrate(10), b(), setTimeout(() => {
2393
- i();
1692
+ X(() => {
1693
+ I && i(I);
1694
+ }, [I, i]);
1695
+ const o = q(() => {
1696
+ f || P.current || (P.current = !0, navigator.vibrate && navigator.vibrate(10), v());
1697
+ }, [f, v]), w = q(() => {
1698
+ P.current && (P.current = !1, navigator.vibrate && navigator.vibrate(10), a(), setTimeout(() => {
1699
+ d();
2394
1700
  }, 150));
2395
- }, [b, i]), C = [...e].reverse().find((j) => j.role === "assistant"), P = C != null && C.content ? C.content.length > 50 ? C.content.slice(0, 50) + "..." : C.content : "Ask Bob about car parts...";
2396
- return /* @__PURE__ */ a.jsxs(
1701
+ }, [a, d]), k = [...n].reverse().find((O) => O.role === "assistant"), N = k != null && k.content ? k.content.length > 50 ? k.content.slice(0, 50) + "..." : k.content : "Ask Bob about car parts...";
1702
+ return /* @__PURE__ */ t.jsxs(
2397
1703
  "div",
2398
1704
  {
2399
- ref: k,
2400
- className: `fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-md border-t border-gray-200 transition-all duration-300 ease-out shadow-[0_-4px_20px_rgba(0,0,0,0.15)] ${v ? "h-[55vh]" : "h-auto"}`,
1705
+ ref: C,
1706
+ className: `fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-md border-t border-gray-200 transition-all duration-300 ease-out shadow-[0_-4px_20px_rgba(0,0,0,0.15)] ${h ? "h-[55vh]" : "h-auto"}`,
2401
1707
  style: {
2402
1708
  zIndex: 60,
2403
1709
  paddingBottom: "env(safe-area-inset-bottom, 8px)"
2404
1710
  },
2405
1711
  children: [
2406
- /* @__PURE__ */ a.jsx(
1712
+ /* @__PURE__ */ t.jsx(
2407
1713
  "button",
2408
1714
  {
2409
- onClick: () => w(!v),
1715
+ onClick: () => j(!h),
2410
1716
  className: "absolute -top-5 left-1/2 -translate-x-1/2 bg-white border border-gray-200 rounded-full p-1.5 shadow-lg z-40",
2411
- "aria-label": v ? "Collapse chat" : "Expand chat",
2412
- children: v ? /* @__PURE__ */ a.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) : /* @__PURE__ */ a.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 15l7-7 7 7" }) })
1717
+ "aria-label": h ? "Collapse chat" : "Expand chat",
1718
+ children: h ? /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) : /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 15l7-7 7 7" }) })
2413
1719
  }
2414
1720
  ),
2415
- !v && /* @__PURE__ */ a.jsx("div", { className: "px-3 pt-2 pb-0.5", onClick: () => w(!0), children: /* @__PURE__ */ a.jsx("p", { className: "text-xs text-gray-500 line-clamp-1", children: P }) }),
2416
- v && /* @__PURE__ */ a.jsxs("div", { className: "h-[calc(100%-100px)] overflow-y-auto p-4 space-y-2", children: [
2417
- [...e].reverse().map((j, R) => /* @__PURE__ */ a.jsx("div", { className: `flex ${j.role === "user" ? "justify-end" : "justify-start"}`, children: /* @__PURE__ */ a.jsx("div", { className: `max-w-[85%] rounded-lg px-3 py-2 text-sm ${j.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-900"}`, children: j.content }) }, R)),
2418
- /* @__PURE__ */ a.jsx("div", { ref: d })
1721
+ !h && /* @__PURE__ */ t.jsx("div", { className: "px-3 pt-2 pb-0.5", onClick: () => j(!0), children: /* @__PURE__ */ t.jsx("p", { className: "text-xs text-gray-500 line-clamp-1", children: N }) }),
1722
+ h && /* @__PURE__ */ t.jsxs("div", { className: "h-[calc(100%-100px)] overflow-y-auto p-4 space-y-2", children: [
1723
+ [...n].reverse().map((O, y) => /* @__PURE__ */ t.jsx("div", { className: `flex ${O.role === "user" ? "justify-end" : "justify-start"}`, children: /* @__PURE__ */ t.jsx("div", { className: `max-w-[85%] rounded-lg px-3 py-2 text-sm ${O.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-900"}`, children: O.content }) }, y)),
1724
+ /* @__PURE__ */ t.jsx("div", { ref: g })
2419
1725
  ] }),
2420
- /* @__PURE__ */ a.jsxs("div", { className: `px-2 pb-1.5 ${v ? "pt-2 border-t border-gray-200" : "pt-0.5"}`, children: [
2421
- _ && /* @__PURE__ */ a.jsxs("div", { className: "mb-2 text-xs text-gray-500 flex items-center gap-2", children: [
2422
- /* @__PURE__ */ a.jsx("span", { className: "inline-block w-2 h-2 bg-red-500 rounded-full animate-pulse" }),
1726
+ /* @__PURE__ */ t.jsxs("div", { className: `px-2 pb-1.5 ${h ? "pt-2 border-t border-gray-200" : "pt-0.5"}`, children: [
1727
+ R && /* @__PURE__ */ t.jsxs("div", { className: "mb-2 text-xs text-gray-500 flex items-center gap-2", children: [
1728
+ /* @__PURE__ */ t.jsx("span", { className: "inline-block w-2 h-2 bg-red-500 rounded-full animate-pulse" }),
2423
1729
  "Listening..."
2424
1730
  ] }),
2425
- p && /* @__PURE__ */ a.jsx("div", { className: "mb-2 text-xs text-red-500", children: p }),
2426
- /* @__PURE__ */ a.jsxs("div", { className: "flex gap-1.5 items-center", children: [
2427
- h && v && /* @__PURE__ */ a.jsx(
1731
+ s && /* @__PURE__ */ t.jsx("div", { className: "mb-2 text-xs text-red-500", children: s }),
1732
+ /* @__PURE__ */ t.jsxs("div", { className: "flex gap-1.5 items-center", children: [
1733
+ u && h && /* @__PURE__ */ t.jsx(
2428
1734
  "button",
2429
1735
  {
2430
- onClick: h,
2431
- className: `shrink-0 h-9 w-9 flex items-center justify-center rounded-md hover:bg-gray-100 ${l ? "text-blue-600 animate-pulse" : "text-gray-600"}`,
2432
- title: y ? "Unmute" : "Mute",
2433
- children: y ? /* @__PURE__ */ a.jsxs("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
2434
- /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
2435
- /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
2436
- ] }) : /* @__PURE__ */ a.jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }) })
1736
+ onClick: u,
1737
+ className: `shrink-0 h-9 w-9 flex items-center justify-center rounded-md hover:bg-gray-100 ${p ? "text-blue-600 animate-pulse" : "text-gray-600"}`,
1738
+ title: x ? "Unmute" : "Mute",
1739
+ children: x ? /* @__PURE__ */ t.jsxs("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
1740
+ /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
1741
+ /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
1742
+ ] }) : /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }) })
2437
1743
  }
2438
1744
  ),
2439
- /* @__PURE__ */ a.jsx(
1745
+ /* @__PURE__ */ t.jsx(
2440
1746
  "input",
2441
1747
  {
2442
1748
  type: "text",
2443
- value: t,
2444
- onChange: (j) => s(j.target.value),
2445
- onKeyPress: f,
2446
- onFocus: u,
2447
- onBlur: g,
1749
+ value: l,
1750
+ onChange: (O) => i(O.target.value),
1751
+ onKeyPress: _,
1752
+ onFocus: b,
1753
+ onBlur: E,
2448
1754
  placeholder: "Message Bob...",
2449
- disabled: n,
1755
+ disabled: f,
2450
1756
  className: "flex-1 h-10 text-base px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50"
2451
1757
  }
2452
1758
  ),
2453
- E && /* @__PURE__ */ a.jsx(
1759
+ m && /* @__PURE__ */ t.jsx(
2454
1760
  "button",
2455
1761
  {
2456
- onTouchStart: m,
2457
- onTouchEnd: S,
2458
- onTouchCancel: S,
2459
- onMouseDown: m,
2460
- onMouseUp: S,
2461
- onMouseLeave: S,
2462
- disabled: n,
2463
- className: `shrink-0 h-12 w-12 rounded-full flex items-center justify-center select-none touch-none ${_ ? "bg-red-500 text-white animate-pulse ring-2 ring-red-300 scale-110" : "bg-blue-600 text-white"} disabled:opacity-50`,
1762
+ onTouchStart: o,
1763
+ onTouchEnd: w,
1764
+ onTouchCancel: w,
1765
+ onMouseDown: o,
1766
+ onMouseUp: w,
1767
+ onMouseLeave: w,
1768
+ disabled: f,
1769
+ className: `shrink-0 h-12 w-12 rounded-full flex items-center justify-center select-none touch-none ${R ? "bg-red-500 text-white animate-pulse ring-2 ring-red-300 scale-110" : "bg-blue-600 text-white"} disabled:opacity-50`,
2464
1770
  title: "Hold to talk",
2465
- children: /* @__PURE__ */ a.jsx("svg", { className: "h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" }) })
1771
+ children: /* @__PURE__ */ t.jsx("svg", { className: "h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" }) })
2466
1772
  }
2467
1773
  )
2468
1774
  ] })
@@ -2470,51 +1776,51 @@ const ms = (e) => {
2470
1776
  ]
2471
1777
  }
2472
1778
  );
2473
- }, Cs = ({
2474
- currentImage: e,
2475
- animationState: t,
2476
- backdropUrl: s,
2477
- counterOverlayUrl: n,
2478
- counterHeightPercent: i = 22,
2479
- messages: f,
2480
- input: u,
2481
- setInput: g,
2482
- isLoading: d,
2483
- onSend: y,
2484
- onKeyPress: h,
2485
- onInputFocus: l,
2486
- onInputBlur: v,
2487
- chatEndRef: w,
2488
- isMuted: k,
2489
- onToggleMute: N,
2490
- isSpeaking: _,
1779
+ }, Vt = ({
1780
+ currentImage: n,
1781
+ animationState: l,
1782
+ backdropUrl: i,
1783
+ counterOverlayUrl: f,
1784
+ counterHeightPercent: d = 22,
1785
+ messages: _,
1786
+ input: b,
1787
+ setInput: E,
1788
+ isLoading: g,
1789
+ onSend: x,
1790
+ onKeyPress: u,
1791
+ onInputFocus: p,
1792
+ onInputBlur: h,
1793
+ chatEndRef: j,
1794
+ isMuted: C,
1795
+ onToggleMute: P,
1796
+ isSpeaking: R,
2491
1797
  products: I,
2492
- servicePackages: p,
2493
- highlightedPartType: E,
2494
- highlightedProduct: T,
2495
- onProductClick: b,
2496
- onPackageSelect: m,
2497
- isResearching: S,
2498
- vehicle: C,
2499
- onChangeVehicle: P
1798
+ servicePackages: s,
1799
+ highlightedPartType: m,
1800
+ highlightedProduct: v,
1801
+ onProductClick: a,
1802
+ onPackageSelect: o,
1803
+ isResearching: w,
1804
+ vehicle: k,
1805
+ onChangeVehicle: N
2500
1806
  }) => {
2501
- const j = typeof window < "u" && window.self !== window.top, [R, M] = Q("center"), [A, L] = Q("hidden"), te = I.length > 0 || p.length > 0;
2502
- se(() => {
2503
- if (S && A !== "loading" && A !== "visible")
2504
- L("loading"), R === "center" && M("left");
2505
- else if (te && A !== "visible")
2506
- if (R === "center") {
2507
- M("left"), L("transitioning");
2508
- const K = setTimeout(() => {
2509
- L("visible");
1807
+ const O = typeof window < "u" && window.self !== window.top, [y, M] = U("center"), [$, S] = U("hidden"), H = I.length > 0 || s.length > 0;
1808
+ X(() => {
1809
+ if (w && $ !== "loading" && $ !== "visible")
1810
+ S("loading"), y === "center" && M("left");
1811
+ else if (H && $ !== "visible")
1812
+ if (y === "center") {
1813
+ M("left"), S("transitioning");
1814
+ const F = setTimeout(() => {
1815
+ S("visible");
2510
1816
  }, 400);
2511
- return () => clearTimeout(K);
1817
+ return () => clearTimeout(F);
2512
1818
  } else
2513
- L("visible");
2514
- else !te && !S && A !== "hidden" && (L("hidden"), M("center"));
2515
- }, [te, S, A, R]);
2516
- const Re = A !== "hidden";
2517
- return /* @__PURE__ */ a.jsxs(
1819
+ S("visible");
1820
+ else !H && !w && $ !== "hidden" && (S("hidden"), M("center"));
1821
+ }, [H, w, $, y]);
1822
+ const ge = $ !== "hidden";
1823
+ return /* @__PURE__ */ t.jsxs(
2518
1824
  "div",
2519
1825
  {
2520
1826
  className: "fixed inset-0 overflow-hidden",
@@ -2523,13 +1829,13 @@ const ms = (e) => {
2523
1829
  touchAction: "manipulation"
2524
1830
  },
2525
1831
  children: [
2526
- s && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2527
- /* @__PURE__ */ a.jsx(
1832
+ i && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1833
+ /* @__PURE__ */ t.jsx(
2528
1834
  "div",
2529
1835
  {
2530
1836
  className: "absolute inset-0 z-0",
2531
1837
  style: {
2532
- backgroundImage: `url(${s})`,
1838
+ backgroundImage: `url(${i})`,
2533
1839
  backgroundSize: "cover",
2534
1840
  backgroundPosition: "center bottom",
2535
1841
  filter: "blur(12px) brightness(0.7)",
@@ -2537,7 +1843,7 @@ const ms = (e) => {
2537
1843
  }
2538
1844
  }
2539
1845
  ),
2540
- /* @__PURE__ */ a.jsx(
1846
+ /* @__PURE__ */ t.jsx(
2541
1847
  "div",
2542
1848
  {
2543
1849
  className: "absolute inset-0 z-[1]",
@@ -2547,37 +1853,37 @@ const ms = (e) => {
2547
1853
  }
2548
1854
  )
2549
1855
  ] }),
2550
- /* @__PURE__ */ a.jsx(
2551
- Es,
1856
+ /* @__PURE__ */ t.jsx(
1857
+ $t,
2552
1858
  {
2553
- currentImage: e,
2554
- animationState: t,
2555
- counterOverlayUrl: n,
2556
- counterHeightPercent: i,
1859
+ currentImage: n,
1860
+ animationState: l,
1861
+ counterOverlayUrl: f,
1862
+ counterHeightPercent: d,
2557
1863
  scale: 200,
2558
- position: R
1864
+ position: y
2559
1865
  }
2560
1866
  ),
2561
- C && !j && /* @__PURE__ */ a.jsx("div", { className: "absolute top-2 left-2 right-2 z-20", children: /* @__PURE__ */ a.jsxs(
1867
+ k && !O && /* @__PURE__ */ t.jsx("div", { className: "absolute top-2 left-2 right-2 z-20", children: /* @__PURE__ */ t.jsxs(
2562
1868
  "div",
2563
1869
  {
2564
1870
  className: "bg-white/90 backdrop-blur-sm rounded-lg px-3 py-2 border border-gray-200 shadow-lg flex items-center justify-between",
2565
1871
  style: { paddingTop: "calc(env(safe-area-inset-top, 4px) + 8px)" },
2566
1872
  children: [
2567
- /* @__PURE__ */ a.jsxs("div", { className: "flex-1 min-w-0", children: [
2568
- /* @__PURE__ */ a.jsxs("p", { className: "text-xs font-medium text-gray-900 truncate", children: [
2569
- C.year,
1873
+ /* @__PURE__ */ t.jsxs("div", { className: "flex-1 min-w-0", children: [
1874
+ /* @__PURE__ */ t.jsxs("p", { className: "text-xs font-medium text-gray-900 truncate", children: [
1875
+ k.year,
2570
1876
  " ",
2571
- C.make,
1877
+ k.make,
2572
1878
  " ",
2573
- C.model
1879
+ k.model
2574
1880
  ] }),
2575
- C.rego && /* @__PURE__ */ a.jsx("p", { className: "text-[10px] text-gray-500", children: C.rego })
1881
+ k.rego && /* @__PURE__ */ t.jsx("p", { className: "text-[10px] text-gray-500", children: k.rego })
2576
1882
  ] }),
2577
- P && /* @__PURE__ */ a.jsx(
1883
+ N && /* @__PURE__ */ t.jsx(
2578
1884
  "button",
2579
1885
  {
2580
- onClick: P,
1886
+ onClick: N,
2581
1887
  className: "text-xs text-blue-600 hover:underline ml-2 shrink-0",
2582
1888
  children: "Change"
2583
1889
  }
@@ -2585,262 +1891,264 @@ const ms = (e) => {
2585
1891
  ]
2586
1892
  }
2587
1893
  ) }),
2588
- /* @__PURE__ */ a.jsx(
2589
- Ts,
1894
+ /* @__PURE__ */ t.jsx(
1895
+ Ft,
2590
1896
  {
2591
1897
  products: I,
2592
- servicePackages: p,
2593
- highlightedPartType: E,
2594
- highlightedProduct: T,
2595
- onProductClick: b,
2596
- onPackageSelect: m,
2597
- isResearching: S,
2598
- visible: Re,
2599
- counterHeightPercent: i,
2600
- hasVehicle: !!C
1898
+ servicePackages: s,
1899
+ highlightedPartType: m,
1900
+ highlightedProduct: v,
1901
+ onProductClick: a,
1902
+ onPackageSelect: o,
1903
+ isResearching: w,
1904
+ visible: ge,
1905
+ counterHeightPercent: d,
1906
+ hasVehicle: !!k
2601
1907
  }
2602
1908
  ),
2603
- /* @__PURE__ */ a.jsx(
2604
- Ss,
1909
+ /* @__PURE__ */ t.jsx(
1910
+ Ut,
2605
1911
  {
2606
- messages: f,
2607
- input: u,
2608
- setInput: g,
2609
- isLoading: d,
2610
- onSend: y,
2611
- onKeyPress: h,
2612
- onInputFocus: l,
2613
- onInputBlur: v,
2614
- chatEndRef: w,
2615
- isMuted: k,
2616
- onToggleMute: N,
2617
- isSpeaking: _
1912
+ messages: _,
1913
+ input: b,
1914
+ setInput: E,
1915
+ isLoading: g,
1916
+ onSend: x,
1917
+ onKeyPress: u,
1918
+ onInputFocus: p,
1919
+ onInputBlur: h,
1920
+ chatEndRef: j,
1921
+ isMuted: C,
1922
+ onToggleMute: P,
1923
+ isSpeaking: R
2618
1924
  }
2619
1925
  )
2620
1926
  ]
2621
1927
  }
2622
1928
  );
2623
- }, Fs = ({
2624
- variant: e = "inline",
2625
- initialState: t = "idle",
2626
- showChat: s = !0,
2627
- className: n = "",
2628
- backdropUrl: i,
2629
- counterOverlayUrl: f,
2630
- counterHeightPercent: u,
2631
- defaultBobImage: g,
2632
- verticalOffset: d = 0,
2633
- scale: y = 100
1929
+ }, Zt = ({
1930
+ variant: n = "inline",
1931
+ initialState: l = "idle",
1932
+ showChat: i = !0,
1933
+ className: f = "",
1934
+ backdropUrl: d,
1935
+ counterOverlayUrl: _,
1936
+ counterHeightPercent: b,
1937
+ defaultBobImage: E,
1938
+ verticalOffset: g = 0,
1939
+ scale: x = 100
2634
1940
  }) => {
2635
- const { callbacks: h } = et(), {
2636
- animationState: l,
2637
- setAnimationState: v,
2638
- getCurrentImage: w,
2639
- availableStates: k,
2640
- isLoading: N
2641
- } = vs(), { activeBackdrop: _ } = ys(), [I, p] = Q([]), [E, T] = Q([]), [b, m] = Q(null), [S, C] = Q(null), [P, j] = Q(!1), R = $r({
2642
- setAnimationState: v,
1941
+ const { callbacks: u } = Be(), {
1942
+ animationState: p,
1943
+ setAnimationState: h,
1944
+ getCurrentImage: j,
1945
+ availableStates: C,
1946
+ isLoading: P
1947
+ } = Pt(), { activeBackdrop: R } = Bt(), [I, s] = U([]), [m, v] = U([]), [a, o] = U(null), [w, k] = U(null), [N, O] = U(!1), y = Ot({
1948
+ setAnimationState: h,
2643
1949
  manualMode: !1,
2644
1950
  onReadyToSpeak: () => {
2645
1951
  console.log("[BobWidget] Ready to speak");
2646
1952
  },
2647
1953
  onStreamComplete: () => {
2648
- v(k.find((K) => K.includes("idle")) || "idle");
1954
+ h(C.find((F) => F.includes("idle")) || "idle");
2649
1955
  },
2650
1956
  onResearchStart: () => {
2651
- j(!0);
1957
+ O(!0);
2652
1958
  },
2653
- onHighlightPart: (K) => {
2654
- m(K), setTimeout(() => m(null), 8e3);
1959
+ onHighlightPart: (F) => {
1960
+ o(F), setTimeout(() => o(null), 8e3);
2655
1961
  },
2656
- onHighlightProduct: (K) => {
2657
- C(K), setTimeout(() => C(null), 8e3);
1962
+ onHighlightProduct: (F) => {
1963
+ k(F), setTimeout(() => k(null), 8e3);
2658
1964
  },
2659
1965
  onAutoFetchComplete: () => {
2660
- j(!1);
1966
+ O(!1);
2661
1967
  }
2662
1968
  });
2663
- se(() => {
2664
- const K = h.onPartsFound, oe = h.onServicePackagesFound;
2665
- return h.onPartsFound = (ue) => {
2666
- j(!1);
2667
- const je = ue.map((J, Ae) => ({
2668
- id: J.SKU || J.sku || `part-${Ae}`,
2669
- name: J["Part Product Type"] || J.partslot_description || "Unknown Part",
2670
- brand: J.Brand || J.brand,
2671
- price: J["Metro Retail Price"] || J.price || 0,
2672
- sku: J.SKU || J.sku,
2673
- partNumber: J["Part Number"] || J.part_number,
2674
- partslotDescription: J["Part Product Type"] || J.partslot_description,
2675
- image_url: J.image_url
1969
+ X(() => {
1970
+ const F = u.onPartsFound, ee = u.onServicePackagesFound;
1971
+ return u.onPartsFound = (re) => {
1972
+ O(!1);
1973
+ const be = re.map((K, Ee) => ({
1974
+ id: K.SKU || K.sku || `part-${Ee}`,
1975
+ name: K["Part Product Type"] || K.partslot_description || "Unknown Part",
1976
+ brand: K.Brand || K.brand,
1977
+ price: K["Metro Retail Price"] || K.price || 0,
1978
+ sku: K.SKU || K.sku,
1979
+ partNumber: K["Part Number"] || K.part_number,
1980
+ partslotDescription: K["Part Product Type"] || K.partslot_description,
1981
+ image_url: K.image_url
2676
1982
  }));
2677
- p(je), K == null || K(ue);
2678
- }, h.onServicePackagesFound = (ue) => {
2679
- T(ue), oe == null || oe(ue);
1983
+ s(be), F == null || F(re);
1984
+ }, u.onServicePackagesFound = (re) => {
1985
+ v(re), ee == null || ee(re);
2680
1986
  }, () => {
2681
- h.onPartsFound = K, h.onServicePackagesFound = oe;
1987
+ u.onPartsFound = F, u.onServicePackagesFound = ee;
2682
1988
  };
2683
- }, [h]);
2684
- const M = i || (_ == null ? void 0 : _.image_url), A = f || (_ == null ? void 0 : _.counter_overlay_url) || void 0, L = u || (_ == null ? void 0 : _.counter_height_percent) || 12, te = w() || g || "";
2685
- if (e === "mobile" || e === "fullscreen")
2686
- return /* @__PURE__ */ a.jsx(
2687
- Cs,
1989
+ }, [u]);
1990
+ const M = d || (R == null ? void 0 : R.image_url), $ = _ || (R == null ? void 0 : R.counter_overlay_url) || void 0, S = b || (R == null ? void 0 : R.counter_height_percent) || 12, H = j() || E || "";
1991
+ if (n === "mobile" || n === "fullscreen")
1992
+ return /* @__PURE__ */ t.jsx(
1993
+ Vt,
2688
1994
  {
2689
- currentImage: te,
2690
- animationState: l,
1995
+ currentImage: H,
1996
+ animationState: p,
2691
1997
  backdropUrl: M,
2692
- counterOverlayUrl: A,
2693
- counterHeightPercent: L,
2694
- messages: R.messages,
2695
- input: R.input,
2696
- setInput: R.setInput,
2697
- isLoading: R.isLoading,
2698
- onSend: R.handleSend,
2699
- onKeyPress: R.handleKeyPress,
2700
- onInputFocus: R.handleInputFocus,
2701
- onInputBlur: R.handleInputBlur,
2702
- chatEndRef: R.chatEndRef,
2703
- isMuted: R.isMuted,
2704
- onToggleMute: R.toggleMute,
2705
- isSpeaking: R.isSpeaking,
1998
+ counterOverlayUrl: $,
1999
+ counterHeightPercent: S,
2000
+ messages: y.messages,
2001
+ input: y.input,
2002
+ setInput: y.setInput,
2003
+ isLoading: y.isLoading,
2004
+ onSend: y.handleSend,
2005
+ onKeyPress: y.handleKeyPress,
2006
+ onInputFocus: y.handleInputFocus,
2007
+ onInputBlur: y.handleInputBlur,
2008
+ chatEndRef: y.chatEndRef,
2009
+ isMuted: y.isMuted,
2010
+ onToggleMute: y.toggleMute,
2011
+ isSpeaking: y.isSpeaking,
2706
2012
  products: I,
2707
- servicePackages: E,
2708
- highlightedPartType: b,
2709
- highlightedProduct: S,
2710
- onProductClick: (K) => {
2711
- var oe;
2712
- return (oe = h.onAddToCart) == null ? void 0 : oe.call(h, {
2713
- product_id: K.id,
2714
- product_name: K.name,
2013
+ servicePackages: m,
2014
+ highlightedPartType: a,
2015
+ highlightedProduct: w,
2016
+ onProductClick: (F) => {
2017
+ var ee;
2018
+ return (ee = u.onAddToCart) == null ? void 0 : ee.call(u, {
2019
+ product_id: F.id,
2020
+ product_name: F.name,
2715
2021
  quantity: 1,
2716
- unit_price: K.price,
2717
- sku: K.sku,
2718
- brand: K.brand
2022
+ unit_price: F.price,
2023
+ sku: F.sku,
2024
+ brand: F.brand
2719
2025
  });
2720
2026
  },
2721
- onPackageSelect: (K) => console.log("[BobWidget] Package selected:", K),
2722
- isResearching: P,
2723
- vehicle: R.identifiedVehicle
2027
+ onPackageSelect: (F) => console.log("[BobWidget] Package selected:", F),
2028
+ isResearching: N,
2029
+ vehicle: y.identifiedVehicle
2724
2030
  }
2725
2031
  );
2726
- const Re = {
2032
+ const ge = {
2727
2033
  inline: "",
2728
2034
  floating: "fixed bottom-4 right-4 w-96 z-50 shadow-2xl rounded-lg overflow-hidden",
2729
2035
  fullscreen: "fixed inset-0 z-50 bg-black/80",
2730
2036
  mobile: ""
2731
2037
  };
2732
- return /* @__PURE__ */ a.jsxs("div", { className: `${Re[e]} ${n}`, children: [
2733
- te && /* @__PURE__ */ a.jsx(
2734
- xs,
2038
+ return /* @__PURE__ */ t.jsxs("div", { className: `${ge[n]} ${f}`, children: [
2039
+ H && /* @__PURE__ */ t.jsx(
2040
+ At,
2735
2041
  {
2736
- currentImage: te,
2737
- animationState: l,
2042
+ currentImage: H,
2043
+ animationState: p,
2738
2044
  backdropUrl: M,
2739
- counterOverlayUrl: A,
2740
- counterHeightPercent: L,
2741
- verticalOffset: d,
2742
- scale: y
2045
+ counterOverlayUrl: $,
2046
+ counterHeightPercent: S,
2047
+ verticalOffset: g,
2048
+ scale: x
2743
2049
  }
2744
2050
  ),
2745
- s && /* @__PURE__ */ a.jsx(
2746
- ws,
2051
+ i && /* @__PURE__ */ t.jsx(
2052
+ Mt,
2747
2053
  {
2748
- messages: R.messages,
2749
- input: R.input,
2750
- setInput: R.setInput,
2751
- isLoading: R.isLoading,
2752
- onSend: R.handleSend,
2753
- onKeyPress: R.handleKeyPress,
2754
- onInputFocus: R.handleInputFocus,
2755
- onInputBlur: R.handleInputBlur,
2756
- chatEndRef: R.chatEndRef,
2757
- isMuted: R.isMuted,
2758
- onToggleMute: R.toggleMute,
2759
- isSpeaking: R.isSpeaking
2054
+ messages: y.messages,
2055
+ input: y.input,
2056
+ setInput: y.setInput,
2057
+ isLoading: y.isLoading,
2058
+ onSend: y.handleSend,
2059
+ onKeyPress: y.handleKeyPress,
2060
+ onInputFocus: y.handleInputFocus,
2061
+ onInputBlur: y.handleInputBlur,
2062
+ chatEndRef: y.chatEndRef,
2063
+ isMuted: y.isMuted,
2064
+ onToggleMute: y.toggleMute,
2065
+ isSpeaking: y.isSpeaking
2760
2066
  }
2761
2067
  )
2762
2068
  ] });
2763
- }, js = 6e4, Bs = ({
2764
- states: e,
2765
- setAnimationState: t,
2766
- manualMode: s
2069
+ }, Kt = 6e4, er = ({
2070
+ states: n,
2071
+ setAnimationState: l,
2072
+ manualMode: i
2767
2073
  }) => {
2768
- const [n, i] = Q("page_load"), [f, u] = Q(!1), g = H(null), d = G((b) => e.find((m) => m.chat_trigger === b && m.is_active), [e]), y = G(() => e.find(
2769
- (b) => b.chat_trigger === "awaiting_input" || b.state_key === "talk_pause" || b.title.toLowerCase().includes("listen") || b.title.toLowerCase().includes("pause")
2770
- ), [e]), h = G(() => e.find(
2771
- (b) => b.state_key === "idle" || b.title.toLowerCase().includes("idle")
2772
- ), [e]), l = G((b) => {
2773
- const m = e.find((S) => S.state_key === b);
2074
+ const [f, d] = U("page_load"), [_, b] = U(!1), E = V(null), g = q((a) => n.find((o) => o.chat_trigger === a && o.is_active), [n]), x = q(() => n.find(
2075
+ (a) => a.chat_trigger === "awaiting_input" || a.state_key === "talk_pause" || a.title.toLowerCase().includes("listen") || a.title.toLowerCase().includes("pause")
2076
+ ), [n]), u = q(() => n.find(
2077
+ (a) => a.state_key === "idle" || a.title.toLowerCase().includes("idle")
2078
+ ), [n]), p = q((a) => {
2079
+ const o = n.find((w) => w.state_key === a);
2774
2080
  return {
2775
- speed: (m == null ? void 0 : m.animation_speed) || 400,
2776
- pauseDuration: (m == null ? void 0 : m.pause_duration) || 0,
2777
- loopCount: (m == null ? void 0 : m.loop_count) || 0
2081
+ speed: (o == null ? void 0 : o.animation_speed) || 400,
2082
+ pauseDuration: (o == null ? void 0 : o.pause_duration) || 0,
2083
+ loopCount: (o == null ? void 0 : o.loop_count) || 0
2778
2084
  };
2779
- }, [e]), v = G(() => {
2780
- g.current && (clearTimeout(g.current), g.current = null);
2781
- }, []), w = G(() => {
2782
- v(), !s && (g.current = setTimeout(() => {
2783
- const b = h();
2784
- b && (i("idle"), t(b.state_key));
2785
- }, js));
2786
- }, [s, h, t, v]), k = G((b) => {
2787
- if (s) return;
2788
- const m = d(b);
2789
- m && t(m.state_key);
2790
- }, [s, d, t]), N = G(() => {
2791
- if (s) return;
2792
- const b = y();
2793
- b && (i("awaiting_input"), t(b.state_key), w());
2794
- }, [s, y, t, w]), _ = G(() => {
2795
- f || s || (u(!0), i("page_load"), k("page_load"), setTimeout(() => {
2796
- N();
2085
+ }, [n]), h = q(() => {
2086
+ E.current && (clearTimeout(E.current), E.current = null);
2087
+ }, []), j = q(() => {
2088
+ h(), !i && (E.current = setTimeout(() => {
2089
+ const a = u();
2090
+ a && (d("idle"), l(a.state_key));
2091
+ }, Kt));
2092
+ }, [i, u, l, h]), C = q((a) => {
2093
+ if (i) return;
2094
+ const o = g(a);
2095
+ o && l(o.state_key);
2096
+ }, [i, g, l]), P = q(() => {
2097
+ if (i) return;
2098
+ const a = x();
2099
+ a && (d("awaiting_input"), l(a.state_key), j());
2100
+ }, [i, x, l, j]), R = q(() => {
2101
+ _ || i || (b(!0), d("page_load"), C("page_load"), setTimeout(() => {
2102
+ P();
2797
2103
  }, 3e3));
2798
- }, [f, s, k, N]), I = G(() => {
2799
- v(), i("processing_input"), k("processing_input");
2800
- }, [k, v]), p = G(() => {
2801
- v(), i("streaming_response"), k("streaming_response");
2802
- }, [k, v]), E = G(() => {
2803
- i("response_complete"), k("response_complete"), setTimeout(() => {
2804
- N();
2104
+ }, [_, i, C, P]), I = q(() => {
2105
+ h(), d("processing_input"), C("processing_input");
2106
+ }, [C, h]), s = q(() => {
2107
+ h(), d("streaming_response"), C("streaming_response");
2108
+ }, [C, h]), m = q(() => {
2109
+ d("response_complete"), C("response_complete"), setTimeout(() => {
2110
+ P();
2805
2111
  }, 3e3);
2806
- }, [k, N]), T = G(() => {
2807
- i("showing_product");
2808
- const b = e.find(
2809
- (m) => m.chat_trigger === "showing_product" || m.state_key === "showing_product"
2112
+ }, [C, P]), v = q(() => {
2113
+ d("showing_product");
2114
+ const a = n.find(
2115
+ (o) => o.chat_trigger === "showing_product" || o.state_key === "showing_product"
2810
2116
  );
2811
- b && t(b.state_key), setTimeout(() => {
2812
- N();
2117
+ a && l(a.state_key), setTimeout(() => {
2118
+ P();
2813
2119
  }, 4e3);
2814
- }, [e, t, N]);
2815
- return se(() => () => v(), [v]), {
2816
- chatStage: n,
2817
- initialize: _,
2120
+ }, [n, l, P]);
2121
+ return X(() => () => h(), [h]), {
2122
+ chatStage: f,
2123
+ initialize: R,
2818
2124
  onUserInput: I,
2819
- onStreamStart: p,
2820
- onStreamComplete: E,
2821
- onShowingProduct: T,
2822
- getStateSettings: l
2125
+ onStreamStart: s,
2126
+ onStreamComplete: m,
2127
+ onShowingProduct: v,
2128
+ getStateSettings: p
2823
2129
  };
2824
2130
  };
2825
2131
  export {
2826
- Fs as Bob,
2827
- xs as BobCharacter,
2828
- Ns as BobProvider,
2829
- ws as ChatInterface,
2830
- Es as MobileBobCharacter,
2831
- Cs as MobileBobLayout,
2832
- Ss as MobileChatDrawer,
2833
- Ts as MobileProductColumn,
2834
- vs as useBobAnimation,
2835
- ms as useBobAnimationData,
2836
- ys as useBobBackdrop,
2837
- Ms as useBobCallbacks,
2838
- $r as useBobChat,
2839
- et as useBobContext,
2840
- Bs as useBobStateTransitions,
2841
- _r as useBobSupabase,
2842
- Ls as useHostApiConfig,
2843
- Ps as useHostContext,
2844
- Rs as useSpeechRecognition,
2845
- Dr as useSpeechSynthesis
2132
+ gt as BOB_VERSION,
2133
+ Zt as Bob,
2134
+ At as BobCharacter,
2135
+ Ht as BobProvider,
2136
+ Mt as ChatInterface,
2137
+ $t as MobileBobCharacter,
2138
+ Vt as MobileBobLayout,
2139
+ Ut as MobileChatDrawer,
2140
+ Ft as MobileProductColumn,
2141
+ Gt as getBobVersion,
2142
+ Pt as useBobAnimation,
2143
+ Lt as useBobAnimationData,
2144
+ Bt as useBobBackdrop,
2145
+ Qt as useBobCallbacks,
2146
+ Ot as useBobChat,
2147
+ Be as useBobContext,
2148
+ er as useBobStateTransitions,
2149
+ bt as useBobSupabase,
2150
+ Xt as useHostApiConfig,
2151
+ Jt as useHostContext,
2152
+ Wt as useSpeechRecognition,
2153
+ St as useSpeechSynthesis
2846
2154
  };