@foisit/vue-wrapper 2.4.1 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +22 -3
  2. package/index.mjs +518 -460
  3. package/package.json +16 -6
package/index.mjs CHANGED
@@ -3,16 +3,16 @@
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- const ne = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {}, qe = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [], ve = () => {
6
+ const ie = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {}, qe = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [], we = () => {
7
7
  }, ze = (t) => t.charCodeAt(0) === 111 && t.charCodeAt(1) === 110 && // uppercase letter
8
- (t.charCodeAt(2) > 122 || t.charCodeAt(2) < 97), z = Object.assign, k = Array.isArray, R = (t) => typeof t == "function", T = (t) => typeof t == "string", we = (t) => typeof t == "symbol", O = (t) => t !== null && typeof t == "object";
9
- let he;
10
- const Z = () => he || (he = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
8
+ (t.charCodeAt(2) > 122 || t.charCodeAt(2) < 97), z = Object.assign, k = Array.isArray, R = (t) => typeof t == "function", T = (t) => typeof t == "string", ve = (t) => typeof t == "symbol", O = (t) => t !== null && typeof t == "object";
9
+ let me;
10
+ const Q = () => me || (me = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
11
11
  function ae(t) {
12
12
  if (k(t)) {
13
13
  const e = {};
14
- for (let i = 0; i < t.length; i++) {
15
- const n = t[i], s = T(n) ? je(n) : ae(n);
14
+ for (let n = 0; n < t.length; n++) {
15
+ const i = t[n], s = T(i) ? je(i) : ae(i);
16
16
  if (s)
17
17
  for (const o in s)
18
18
  e[o] = s[o];
@@ -21,13 +21,13 @@ function ae(t) {
21
21
  } else if (T(t) || O(t))
22
22
  return t;
23
23
  }
24
- const Be = /;(?![^(]*\))/g, We = /:([^]+)/, Ue = /\/\*[^]*?\*\//g;
24
+ const Be = /;(?![^(]*\))/g, Ue = /:([^]+)/, We = /\/\*[^]*?\*\//g;
25
25
  function je(t) {
26
26
  const e = {};
27
- return t.replace(Ue, "").split(Be).forEach((i) => {
28
- if (i) {
29
- const n = i.split(We);
30
- n.length > 1 && (e[n[0].trim()] = n[1].trim());
27
+ return t.replace(We, "").split(Be).forEach((n) => {
28
+ if (n) {
29
+ const i = n.split(Ue);
30
+ i.length > 1 && (e[i[0].trim()] = i[1].trim());
31
31
  }
32
32
  }), e;
33
33
  }
@@ -36,13 +36,13 @@ function le(t) {
36
36
  if (T(t))
37
37
  e = t;
38
38
  else if (k(t))
39
- for (let i = 0; i < t.length; i++) {
40
- const n = le(t[i]);
41
- n && (e += n + " ");
39
+ for (let n = 0; n < t.length; n++) {
40
+ const i = le(t[n]);
41
+ i && (e += i + " ");
42
42
  }
43
43
  else if (O(t))
44
- for (const i in t)
45
- t[i] && (e += i + " ");
44
+ for (const n in t)
45
+ t[n] && (e += n + " ");
46
46
  return e.trim();
47
47
  }
48
48
  /**
@@ -54,7 +54,7 @@ process.env.NODE_ENV;
54
54
  process.env.NODE_ENV;
55
55
  process.env.NODE_ENV;
56
56
  new Set(
57
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(we)
57
+ /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((t) => t !== "arguments" && t !== "caller").map((t) => Symbol[t]).filter(ve)
58
58
  );
59
59
  function xe(t) {
60
60
  return se(t) ? xe(t.__v_raw) : !!(t && t.__v_isReactive);
@@ -62,7 +62,7 @@ function xe(t) {
62
62
  function se(t) {
63
63
  return !!(t && t.__v_isReadonly);
64
64
  }
65
- function Q(t) {
65
+ function Z(t) {
66
66
  return !!(t && t.__v_isShallow);
67
67
  }
68
68
  function oe(t) {
@@ -80,22 +80,22 @@ function ce(t) {
80
80
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
81
81
  * @license MIT
82
82
  **/
83
- const V = [];
83
+ const P = [];
84
84
  function Ke(t) {
85
- V.push(t);
85
+ P.push(t);
86
86
  }
87
87
  function Ye() {
88
- V.pop();
88
+ P.pop();
89
89
  }
90
90
  let ee = !1;
91
91
  function _(t, ...e) {
92
92
  if (ee) return;
93
93
  ee = !0;
94
- const i = V.length ? V[V.length - 1].component : null, n = i && i.appContext.config.warnHandler, s = Je();
95
- if (n)
94
+ const n = P.length ? P[P.length - 1].component : null, i = n && n.appContext.config.warnHandler, s = Je();
95
+ if (i)
96
96
  de(
97
- n,
98
97
  i,
98
+ n,
99
99
  11,
100
100
  [
101
101
  // eslint-disable-next-line no-restricted-syntax
@@ -103,9 +103,9 @@ function _(t, ...e) {
103
103
  var r, a;
104
104
  return (a = (r = o.toString) == null ? void 0 : r.call(o)) != null ? a : JSON.stringify(o);
105
105
  }).join(""),
106
- i && i.proxy,
106
+ n && n.proxy,
107
107
  s.map(
108
- ({ vnode: o }) => `at <${De(i, o.type)}>`
108
+ ({ vnode: o }) => `at <${De(n, o.type)}>`
109
109
  ).join(`
110
110
  `),
111
111
  s
@@ -119,44 +119,44 @@ function _(t, ...e) {
119
119
  ee = !1;
120
120
  }
121
121
  function Je() {
122
- let t = V[V.length - 1];
122
+ let t = P[P.length - 1];
123
123
  if (!t)
124
124
  return [];
125
125
  const e = [];
126
126
  for (; t; ) {
127
- const i = e[0];
128
- i && i.vnode === t ? i.recurseCount++ : e.push({
127
+ const n = e[0];
128
+ n && n.vnode === t ? n.recurseCount++ : e.push({
129
129
  vnode: t,
130
130
  recurseCount: 0
131
131
  });
132
- const n = t.component && t.component.parent;
133
- t = n && n.vnode;
132
+ const i = t.component && t.component.parent;
133
+ t = i && i.vnode;
134
134
  }
135
135
  return e;
136
136
  }
137
137
  function Ge(t) {
138
138
  const e = [];
139
- return t.forEach((i, n) => {
140
- e.push(...n === 0 ? [] : [`
141
- `], ...Xe(i));
139
+ return t.forEach((n, i) => {
140
+ e.push(...i === 0 ? [] : [`
141
+ `], ...Xe(n));
142
142
  }), e;
143
143
  }
144
144
  function Xe({ vnode: t, recurseCount: e }) {
145
- const i = e > 0 ? `... (${e} recursive calls)` : "", n = t.component ? t.component.parent == null : !1, s = ` at <${De(
145
+ const n = e > 0 ? `... (${e} recursive calls)` : "", i = t.component ? t.component.parent == null : !1, s = ` at <${De(
146
146
  t.component,
147
147
  t.type,
148
- n
149
- )}`, o = ">" + i;
150
- return t.props ? [s, ...Ze(t.props), o] : [s + o];
148
+ i
149
+ )}`, o = ">" + n;
150
+ return t.props ? [s, ...Qe(t.props), o] : [s + o];
151
151
  }
152
- function Ze(t) {
153
- const e = [], i = Object.keys(t);
154
- return i.slice(0, 3).forEach((n) => {
155
- e.push(...Se(n, t[n]));
156
- }), i.length > 3 && e.push(" ..."), e;
152
+ function Qe(t) {
153
+ const e = [], n = Object.keys(t);
154
+ return n.slice(0, 3).forEach((i) => {
155
+ e.push(...Se(i, t[i]));
156
+ }), n.length > 3 && e.push(" ..."), e;
157
157
  }
158
- function Se(t, e, i) {
159
- return T(e) ? (e = JSON.stringify(e), i ? e : [`${t}=${e}`]) : typeof e == "number" || typeof e == "boolean" || e == null ? i ? e : [`${t}=${e}`] : ce(e) ? (e = Se(t, M(e.value), !0), i ? e : [`${t}=Ref<`, e, ">"]) : R(e) ? [`${t}=fn${e.name ? `<${e.name}>` : ""}`] : (e = M(e), i ? e : [`${t}=`, e]);
158
+ function Se(t, e, n) {
159
+ return T(e) ? (e = JSON.stringify(e), n ? e : [`${t}=${e}`]) : typeof e == "number" || typeof e == "boolean" || e == null ? n ? e : [`${t}=${e}`] : ce(e) ? (e = Se(t, M(e.value), !0), n ? e : [`${t}=Ref<`, e, ">"]) : R(e) ? [`${t}=fn${e.name ? `<${e.name}>` : ""}`] : (e = M(e), n ? e : [`${t}=`, e]);
160
160
  }
161
161
  const Ce = {
162
162
  sp: "serverPrefetch hook",
@@ -191,23 +191,23 @@ const Ce = {
191
191
  15: "component update",
192
192
  16: "app unmount cleanup function"
193
193
  };
194
- function de(t, e, i, n) {
194
+ function de(t, e, n, i) {
195
195
  try {
196
- return n ? t(...n) : t();
196
+ return i ? t(...i) : t();
197
197
  } catch (s) {
198
- Ee(s, e, i);
198
+ Ee(s, e, n);
199
199
  }
200
200
  }
201
- function Ee(t, e, i, n = !0) {
202
- const s = e ? e.vnode : null, { errorHandler: o, throwUnhandledErrorInProduction: r } = e && e.appContext.config || ne;
201
+ function Ee(t, e, n, i = !0) {
202
+ const s = e ? e.vnode : null, { errorHandler: o, throwUnhandledErrorInProduction: r } = e && e.appContext.config || ie;
203
203
  if (e) {
204
204
  let a = e.parent;
205
- const c = e.proxy, m = process.env.NODE_ENV !== "production" ? Ce[i] : `https://vuejs.org/error-reference/#runtime-${i}`;
205
+ const c = e.proxy, h = process.env.NODE_ENV !== "production" ? Ce[n] : `https://vuejs.org/error-reference/#runtime-${n}`;
206
206
  for (; a; ) {
207
207
  const d = a.ec;
208
208
  if (d) {
209
209
  for (let l = 0; l < d.length; l++)
210
- if (d[l](t, c, m) === !1)
210
+ if (d[l](t, c, h) === !1)
211
211
  return;
212
212
  }
213
213
  a = a.parent;
@@ -216,17 +216,17 @@ function Ee(t, e, i, n = !0) {
216
216
  de(o, null, 10, [
217
217
  t,
218
218
  c,
219
- m
219
+ h
220
220
  ]);
221
221
  return;
222
222
  }
223
223
  }
224
- Qe(t, i, s, n, r);
224
+ Ze(t, n, s, i, r);
225
225
  }
226
- function Qe(t, e, i, n = !0, s = !1) {
226
+ function Ze(t, e, n, i = !0, s = !1) {
227
227
  if (process.env.NODE_ENV !== "production") {
228
228
  const o = Ce[e];
229
- if (i && Ke(i), _(`Unhandled error${o ? ` during execution of ${o}` : ""}`), i && Ye(), n)
229
+ if (n && Ke(n), _(`Unhandled error${o ? ` during execution of ${o}` : ""}`), n && Ye(), i)
230
230
  throw t;
231
231
  console.error(t);
232
232
  } else {
@@ -238,89 +238,89 @@ function Qe(t, e, i, n = !0, s = !1) {
238
238
  const C = [];
239
239
  let I = -1;
240
240
  const D = [];
241
- let L = null, P = 0;
241
+ let L = null, V = 0;
242
242
  const et = /* @__PURE__ */ Promise.resolve();
243
243
  let re = null;
244
244
  const tt = 100;
245
- function it(t) {
246
- let e = I + 1, i = C.length;
247
- for (; e < i; ) {
248
- const n = e + i >>> 1, s = C[n], o = H(s);
249
- o < t || o === t && s.flags & 2 ? e = n + 1 : i = n;
245
+ function nt(t) {
246
+ let e = I + 1, n = C.length;
247
+ for (; e < n; ) {
248
+ const i = e + n >>> 1, s = C[i], o = H(s);
249
+ o < t || o === t && s.flags & 2 ? e = i + 1 : n = i;
250
250
  }
251
251
  return e;
252
252
  }
253
- function nt(t) {
253
+ function it(t) {
254
254
  if (!(t.flags & 1)) {
255
- const e = H(t), i = C[C.length - 1];
256
- !i || // fast path when the job id is larger than the tail
257
- !(t.flags & 2) && e >= H(i) ? C.push(t) : C.splice(it(e), 0, t), t.flags |= 1, ke();
255
+ const e = H(t), n = C[C.length - 1];
256
+ !n || // fast path when the job id is larger than the tail
257
+ !(t.flags & 2) && e >= H(n) ? C.push(t) : C.splice(nt(e), 0, t), t.flags |= 1, ke();
258
258
  }
259
259
  }
260
260
  function ke() {
261
261
  re || (re = et.then(_e));
262
262
  }
263
263
  function st(t) {
264
- k(t) ? D.push(...t) : L && t.id === -1 ? L.splice(P + 1, 0, t) : t.flags & 1 || (D.push(t), t.flags |= 1), ke();
264
+ k(t) ? D.push(...t) : L && t.id === -1 ? L.splice(V + 1, 0, t) : t.flags & 1 || (D.push(t), t.flags |= 1), ke();
265
265
  }
266
266
  function ot(t) {
267
267
  if (D.length) {
268
268
  const e = [...new Set(D)].sort(
269
- (i, n) => H(i) - H(n)
269
+ (n, i) => H(n) - H(i)
270
270
  );
271
271
  if (D.length = 0, L) {
272
272
  L.push(...e);
273
273
  return;
274
274
  }
275
- for (L = e, process.env.NODE_ENV !== "production" && (t = t || /* @__PURE__ */ new Map()), P = 0; P < L.length; P++) {
276
- const i = L[P];
277
- process.env.NODE_ENV !== "production" && Ie(t, i) || (i.flags & 4 && (i.flags &= -2), i.flags & 8 || i(), i.flags &= -2);
275
+ for (L = e, process.env.NODE_ENV !== "production" && (t = t || /* @__PURE__ */ new Map()), V = 0; V < L.length; V++) {
276
+ const n = L[V];
277
+ process.env.NODE_ENV !== "production" && Ie(t, n) || (n.flags & 4 && (n.flags &= -2), n.flags & 8 || n(), n.flags &= -2);
278
278
  }
279
- L = null, P = 0;
279
+ L = null, V = 0;
280
280
  }
281
281
  }
282
282
  const H = (t) => t.id == null ? t.flags & 2 ? -1 : 1 / 0 : t.id;
283
283
  function _e(t) {
284
284
  process.env.NODE_ENV !== "production" && (t = t || /* @__PURE__ */ new Map());
285
- const e = process.env.NODE_ENV !== "production" ? (i) => Ie(t, i) : ve;
285
+ const e = process.env.NODE_ENV !== "production" ? (n) => Ie(t, n) : we;
286
286
  try {
287
287
  for (I = 0; I < C.length; I++) {
288
- const i = C[I];
289
- if (i && !(i.flags & 8)) {
290
- if (process.env.NODE_ENV !== "production" && e(i))
288
+ const n = C[I];
289
+ if (n && !(n.flags & 8)) {
290
+ if (process.env.NODE_ENV !== "production" && e(n))
291
291
  continue;
292
- i.flags & 4 && (i.flags &= -2), de(
293
- i,
294
- i.i,
295
- i.i ? 15 : 14
296
- ), i.flags & 4 || (i.flags &= -2);
292
+ n.flags & 4 && (n.flags &= -2), de(
293
+ n,
294
+ n.i,
295
+ n.i ? 15 : 14
296
+ ), n.flags & 4 || (n.flags &= -2);
297
297
  }
298
298
  }
299
299
  } finally {
300
300
  for (; I < C.length; I++) {
301
- const i = C[I];
302
- i && (i.flags &= -2);
301
+ const n = C[I];
302
+ n && (n.flags &= -2);
303
303
  }
304
304
  I = -1, C.length = 0, ot(t), re = null, (C.length || D.length) && _e(t);
305
305
  }
306
306
  }
307
307
  function Ie(t, e) {
308
- const i = t.get(e) || 0;
309
- if (i > tt) {
310
- const n = e.i, s = n && Fe(n.type);
308
+ const n = t.get(e) || 0;
309
+ if (n > tt) {
310
+ const i = e.i, s = i && Fe(i.type);
311
311
  return Ee(
312
312
  `Maximum recursive updates exceeded${s ? ` in component <${s}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
313
313
  null,
314
314
  10
315
315
  ), !0;
316
316
  }
317
- return t.set(e, i + 1), !1;
317
+ return t.set(e, n + 1), !1;
318
318
  }
319
319
  const te = /* @__PURE__ */ new Map();
320
- process.env.NODE_ENV !== "production" && (Z().__VUE_HMR_RUNTIME__ = {
321
- createRecord: ie(rt),
322
- rerender: ie(at),
323
- reload: ie(lt)
320
+ process.env.NODE_ENV !== "production" && (Q().__VUE_HMR_RUNTIME__ = {
321
+ createRecord: ne(rt),
322
+ rerender: ne(at),
323
+ reload: ne(lt)
324
324
  });
325
325
  const J = /* @__PURE__ */ new Map();
326
326
  function rt(t, e) {
@@ -333,20 +333,20 @@ function G(t) {
333
333
  return $e(t) ? t.__vccOpts : t;
334
334
  }
335
335
  function at(t, e) {
336
- const i = J.get(t);
337
- i && (i.initialDef.render = e, [...i.instances].forEach((n) => {
338
- e && (n.render = e, G(n.type).render = e), n.renderCache = [], n.job.flags & 8 || n.update();
336
+ const n = J.get(t);
337
+ n && (n.initialDef.render = e, [...n.instances].forEach((i) => {
338
+ e && (i.render = e, G(i.type).render = e), i.renderCache = [], i.job.flags & 8 || i.update();
339
339
  }));
340
340
  }
341
341
  function lt(t, e) {
342
- const i = J.get(t);
343
- if (!i) return;
344
- e = G(e), me(i.initialDef, e);
345
- const n = [...i.instances];
346
- for (let s = 0; s < n.length; s++) {
347
- const o = n[s], r = G(o.type);
342
+ const n = J.get(t);
343
+ if (!n) return;
344
+ e = G(e), he(n.initialDef, e);
345
+ const i = [...n.instances];
346
+ for (let s = 0; s < i.length; s++) {
347
+ const o = i[s], r = G(o.type);
348
348
  let a = te.get(r);
349
- a || (r !== i.initialDef && me(r, e), te.set(r, a = /* @__PURE__ */ new Set())), a.add(o), o.appContext.propsCache.delete(o.type), o.appContext.emitsCache.delete(o.type), o.appContext.optionsCache.delete(o.type), o.ceReload ? (a.add(o), o.ceReload(e.styles), a.delete(o)) : o.parent ? nt(() => {
349
+ a || (r !== n.initialDef && he(r, e), te.set(r, a = /* @__PURE__ */ new Set())), a.add(o), o.appContext.propsCache.delete(o.type), o.appContext.emitsCache.delete(o.type), o.appContext.optionsCache.delete(o.type), o.ceReload ? (a.add(o), o.ceReload(e.styles), a.delete(o)) : o.parent ? it(() => {
350
350
  o.job.flags & 8 || (o.parent.update(), a.delete(o));
351
351
  }) : o.appContext.reload ? o.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
352
352
  "[HMR] Root or manually mounted instance modified. Full reload required."
@@ -356,17 +356,17 @@ function lt(t, e) {
356
356
  te.clear();
357
357
  });
358
358
  }
359
- function me(t, e) {
359
+ function he(t, e) {
360
360
  z(t, e);
361
- for (const i in t)
362
- i !== "__file" && !(i in e) && delete t[i];
361
+ for (const n in t)
362
+ n !== "__file" && !(n in e) && delete t[n];
363
363
  }
364
- function ie(t) {
365
- return (e, i) => {
364
+ function ne(t) {
365
+ return (e, n) => {
366
366
  try {
367
- return t(e, i);
368
- } catch (n) {
369
- console.error(n), console.warn(
367
+ return t(e, n);
368
+ } catch (i) {
369
+ console.error(i), console.warn(
370
370
  "[HMR] Something went wrong during Vue component hot-reload. Full reload required."
371
371
  );
372
372
  }
@@ -374,11 +374,11 @@ function ie(t) {
374
374
  }
375
375
  let F, j = [];
376
376
  function Ae(t, e) {
377
- var i, n;
377
+ var n, i;
378
378
  F = t, F ? (F.enabled = !0, j.forEach(({ event: s, args: o }) => F.emit(s, ...o)), j = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
379
379
  window.HTMLElement && // also exclude jsdom
380
380
  // eslint-disable-next-line no-restricted-syntax
381
- !((n = (i = window.navigator) == null ? void 0 : i.userAgent) != null && n.includes("jsdom")) ? ((e.__VUE_DEVTOOLS_HOOK_REPLAY__ = e.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((o) => {
381
+ !((i = (n = window.navigator) == null ? void 0 : n.userAgent) != null && i.includes("jsdom")) ? ((e.__VUE_DEVTOOLS_HOOK_REPLAY__ = e.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((o) => {
382
382
  Ae(o, e);
383
383
  }), setTimeout(() => {
384
384
  F || (e.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, j = []);
@@ -387,19 +387,19 @@ function Ae(t, e) {
387
387
  let N = null, ct = null;
388
388
  function dt(t, e) {
389
389
  if (process.env.NODE_ENV !== "production" && (!A || A.isMounted) && _("provide() can only be used inside setup()."), A) {
390
- let i = A.provides;
391
- const n = A.parent && A.parent.provides;
392
- n === i && (i = A.provides = Object.create(n)), i[t] = e;
390
+ let n = A.provides;
391
+ const i = A.parent && A.parent.provides;
392
+ i === n && (n = A.provides = Object.create(i)), n[t] = e;
393
393
  }
394
394
  }
395
- function ut(t, e, i = !1) {
396
- const n = Nt();
397
- if (n || bt) {
398
- let s = n ? n.parent == null || n.ce ? n.vnode.appContext && n.vnode.appContext.provides : n.parent.provides : void 0;
395
+ function ut(t, e, n = !1) {
396
+ const i = Nt();
397
+ if (i || bt) {
398
+ let s = i ? i.parent == null || i.ce ? i.vnode.appContext && i.vnode.appContext.provides : i.parent.provides : void 0;
399
399
  if (s && t in s)
400
400
  return s[t];
401
401
  if (arguments.length > 1)
402
- return i && R(e) ? e.call(n && n.proxy) : e;
402
+ return n && R(e) ? e.call(i && i.proxy) : e;
403
403
  process.env.NODE_ENV !== "production" && _(`injection "${String(t)}" not found.`);
404
404
  } else process.env.NODE_ENV !== "production" && _("inject() can only be used inside setup() or functional components.");
405
405
  }
@@ -408,37 +408,37 @@ function Ne(t, e) {
408
408
  t.shapeFlag & 6 && t.component ? (t.transition = e, Ne(t.component.subTree, e)) : t.shapeFlag & 128 ? (t.ssContent.transition = e.clone(t.ssContent), t.ssFallback.transition = e.clone(t.ssFallback)) : t.transition = e;
409
409
  }
410
410
  // @__NO_SIDE_EFFECTS__
411
- function ht(t, e) {
411
+ function mt(t, e) {
412
412
  return R(t) ? (
413
413
  // #8236: extend call and options.name access are considered side-effects
414
414
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
415
415
  z({ name: t.name }, e, { setup: t })
416
416
  ) : t;
417
417
  }
418
- Z().requestIdleCallback;
419
- Z().cancelIdleCallback;
420
- const mt = (t) => !!t.type.__asyncLoader, pt = /* @__PURE__ */ Symbol.for("v-ndc");
421
- function gt(t, e, i = {}, n, s) {
422
- if (N.ce || N.parent && mt(N.parent) && N.parent.ce) {
423
- const m = Object.keys(i).length > 0;
418
+ Q().requestIdleCallback;
419
+ Q().cancelIdleCallback;
420
+ const ht = (t) => !!t.type.__asyncLoader, pt = /* @__PURE__ */ Symbol.for("v-ndc");
421
+ function gt(t, e, n = {}, i, s) {
422
+ if (N.ce || N.parent && ht(N.parent) && N.parent.ce) {
423
+ const h = Object.keys(n).length > 0;
424
424
  return pe(), ge(
425
425
  q,
426
426
  null,
427
- [ue("slot", i, n)],
428
- m ? -2 : 64
427
+ [ue("slot", n, i)],
428
+ h ? -2 : 64
429
429
  );
430
430
  }
431
431
  let o = t[e];
432
432
  process.env.NODE_ENV !== "production" && o && o.length > 1 && (_(
433
433
  "SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template."
434
434
  ), o = () => []), o && o._c && (o._d = !1), pe();
435
- const r = o && Re(o(i)), a = i.key || // slot content array of a dynamic conditional slot may have a branch
435
+ const r = o && Re(o(n)), a = n.key || // slot content array of a dynamic conditional slot may have a branch
436
436
  // key attached in the `createSlots` helper, respect that
437
437
  r && r.key, c = ge(
438
438
  q,
439
439
  {
440
- key: (a && !we(a) ? a : `_${e}`) + // #7256 force differentiate fallback content from actual content
441
- (!r && n ? "_fb" : "")
440
+ key: (a && !ve(a) ? a : `_${e}`) + // #7256 force differentiate fallback content from actual content
441
+ (!r && i ? "_fb" : "")
442
442
  },
443
443
  r || [],
444
444
  r && t._ === 1 ? 64 : -2
@@ -453,7 +453,7 @@ process.env.NODE_ENV !== "production" && (yt.ownKeys = (t) => (_(
453
453
  "Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
454
454
  ), Reflect.ownKeys(t)));
455
455
  let bt = null;
456
- const vt = {}, Le = (t) => Object.getPrototypeOf(t) === vt, wt = (t) => t.__isSuspense, q = /* @__PURE__ */ Symbol.for("v-fgt"), xt = /* @__PURE__ */ Symbol.for("v-txt"), Te = /* @__PURE__ */ Symbol.for("v-cmt"), K = [];
456
+ const wt = {}, Le = (t) => Object.getPrototypeOf(t) === wt, vt = (t) => t.__isSuspense, q = /* @__PURE__ */ Symbol.for("v-fgt"), xt = /* @__PURE__ */ Symbol.for("v-txt"), Te = /* @__PURE__ */ Symbol.for("v-cmt"), K = [];
457
457
  let E = null;
458
458
  function pe(t = !1) {
459
459
  K.push(E = t ? null : []);
@@ -464,13 +464,13 @@ function St() {
464
464
  function Ct(t) {
465
465
  return t.dynamicChildren = E || qe, St(), E && E.push(t), t;
466
466
  }
467
- function ge(t, e, i, n, s) {
467
+ function ge(t, e, n, i, s) {
468
468
  return Ct(
469
469
  ue(
470
470
  t,
471
471
  e,
472
- i,
473
472
  n,
473
+ i,
474
474
  s,
475
475
  !0
476
476
  )
@@ -479,14 +479,14 @@ function ge(t, e, i, n, s) {
479
479
  function Oe(t) {
480
480
  return t ? t.__v_isVNode === !0 : !1;
481
481
  }
482
- const Et = (...t) => Ve(
482
+ const Et = (...t) => Pe(
483
483
  ...t
484
484
  ), Me = ({ key: t }) => t ?? null, Y = ({
485
485
  ref: t,
486
486
  ref_key: e,
487
- ref_for: i
488
- }) => (typeof t == "number" && (t = "" + t), t != null ? T(t) || ce(t) || R(t) ? { i: N, r: t, k: e, f: !!i } : t : null);
489
- function kt(t, e = null, i = null, n = 0, s = null, o = t === q ? 0 : 1, r = !1, a = !1) {
487
+ ref_for: n
488
+ }) => (typeof t == "number" && (t = "" + t), t != null ? T(t) || ce(t) || R(t) ? { i: N, r: t, k: e, f: !!n } : t : null);
489
+ function kt(t, e = null, n = null, i = 0, s = null, o = t === q ? 0 : 1, r = !1, a = !1) {
490
490
  const c = {
491
491
  __v_isVNode: !0,
492
492
  __v_skip: !0,
@@ -496,7 +496,7 @@ function kt(t, e = null, i = null, n = 0, s = null, o = t === q ? 0 : 1, r = !1,
496
496
  ref: e && Y(e),
497
497
  scopeId: ct,
498
498
  slotScopeIds: null,
499
- children: i,
499
+ children: n,
500
500
  component: null,
501
501
  suspense: null,
502
502
  ssContent: null,
@@ -510,13 +510,13 @@ function kt(t, e = null, i = null, n = 0, s = null, o = t === q ? 0 : 1, r = !1,
510
510
  targetAnchor: null,
511
511
  staticCount: 0,
512
512
  shapeFlag: o,
513
- patchFlag: n,
513
+ patchFlag: i,
514
514
  dynamicProps: s,
515
515
  dynamicChildren: null,
516
516
  appContext: null,
517
517
  ctx: N
518
518
  };
519
- return a ? (fe(c, i), o & 128 && t.normalize(c)) : i && (c.shapeFlag |= T(i) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && _("VNode created with invalid key (NaN). VNode type:", c.type), // avoid a block node from tracking itself
519
+ return a ? (fe(c, n), o & 128 && t.normalize(c)) : n && (c.shapeFlag |= T(n) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && _("VNode created with invalid key (NaN). VNode type:", c.type), // avoid a block node from tracking itself
520
520
  !r && // has current parent block
521
521
  E && // presence of a patch flag indicates this node needs patching on updates.
522
522
  // component nodes also should always be patched, because even if the
@@ -526,8 +526,8 @@ function kt(t, e = null, i = null, n = 0, s = null, o = t === q ? 0 : 1, r = !1,
526
526
  // vnode should not be considered dynamic due to handler caching.
527
527
  c.patchFlag !== 32 && E.push(c), c;
528
528
  }
529
- const ue = process.env.NODE_ENV !== "production" ? Et : Ve;
530
- function Ve(t, e = null, i = null, n = 0, s = null, o = !1) {
529
+ const ue = process.env.NODE_ENV !== "production" ? Et : Pe;
530
+ function Pe(t, e = null, n = null, i = 0, s = null, o = !1) {
531
531
  if ((!t || t === pt) && (process.env.NODE_ENV !== "production" && !t && _(`Invalid vnode type when creating vnode: ${t}.`), t = Te), Oe(t)) {
532
532
  const a = X(
533
533
  t,
@@ -535,14 +535,14 @@ function Ve(t, e = null, i = null, n = 0, s = null, o = !1) {
535
535
  !0
536
536
  /* mergeRef: true */
537
537
  );
538
- return i && fe(a, i), !o && E && (a.shapeFlag & 6 ? E[E.indexOf(t)] = a : E.push(a)), a.patchFlag = -2, a;
538
+ return n && fe(a, n), !o && E && (a.shapeFlag & 6 ? E[E.indexOf(t)] = a : E.push(a)), a.patchFlag = -2, a;
539
539
  }
540
540
  if ($e(t) && (t = t.__vccOpts), e) {
541
541
  e = _t(e);
542
542
  let { class: a, style: c } = e;
543
543
  a && !T(a) && (e.class = le(a)), O(c) && (oe(c) && !k(c) && (c = z({}, c)), e.style = ae(c));
544
544
  }
545
- const r = T(t) ? 1 : wt(t) ? 128 : ft(t) ? 64 : O(t) ? 4 : R(t) ? 2 : 0;
545
+ const r = T(t) ? 1 : vt(t) ? 128 : ft(t) ? 64 : O(t) ? 4 : R(t) ? 2 : 0;
546
546
  return process.env.NODE_ENV !== "production" && r & 4 && oe(t) && (t = M(t), _(
547
547
  "Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
548
548
  `
@@ -551,8 +551,8 @@ Component that was made reactive: `,
551
551
  )), kt(
552
552
  t,
553
553
  e,
554
- i,
555
554
  n,
555
+ i,
556
556
  s,
557
557
  r,
558
558
  o,
@@ -562,22 +562,22 @@ Component that was made reactive: `,
562
562
  function _t(t) {
563
563
  return t ? oe(t) || Le(t) ? z({}, t) : t : null;
564
564
  }
565
- function X(t, e, i = !1, n = !1) {
566
- const { props: s, ref: o, patchFlag: r, children: a, transition: c } = t, m = e ? At(s || {}, e) : s, d = {
565
+ function X(t, e, n = !1, i = !1) {
566
+ const { props: s, ref: o, patchFlag: r, children: a, transition: c } = t, h = e ? At(s || {}, e) : s, d = {
567
567
  __v_isVNode: !0,
568
568
  __v_skip: !0,
569
569
  type: t.type,
570
- props: m,
571
- key: m && Me(m),
570
+ props: h,
571
+ key: h && Me(h),
572
572
  ref: e && e.ref ? (
573
573
  // #2078 in the case of <component :is="vnode" ref="extra"/>
574
574
  // if the vnode itself already has a ref, cloneVNode will need to merge
575
575
  // the refs so the single vnode can be set on multiple refs
576
- i && o ? k(o) ? o.concat(Y(e)) : [o, Y(e)] : Y(e)
576
+ n && o ? k(o) ? o.concat(Y(e)) : [o, Y(e)] : Y(e)
577
577
  ) : o,
578
578
  scopeId: t.scopeId,
579
579
  slotScopeIds: t.slotScopeIds,
580
- children: process.env.NODE_ENV !== "production" && r === -1 && k(a) ? a.map(Pe) : a,
580
+ children: process.env.NODE_ENV !== "production" && r === -1 && k(a) ? a.map(Ve) : a,
581
581
  target: t.target,
582
582
  targetStart: t.targetStart,
583
583
  targetAnchor: t.targetAnchor,
@@ -607,66 +607,66 @@ function X(t, e, i = !1, n = !1) {
607
607
  ctx: t.ctx,
608
608
  ce: t.ce
609
609
  };
610
- return c && n && Ne(
610
+ return c && i && Ne(
611
611
  d,
612
612
  c.clone(d)
613
613
  ), d;
614
614
  }
615
- function Pe(t) {
615
+ function Ve(t) {
616
616
  const e = X(t);
617
- return k(t.children) && (e.children = t.children.map(Pe)), e;
617
+ return k(t.children) && (e.children = t.children.map(Ve)), e;
618
618
  }
619
619
  function It(t = " ", e = 0) {
620
620
  return ue(xt, null, t, e);
621
621
  }
622
622
  function fe(t, e) {
623
- let i = 0;
624
- const { shapeFlag: n } = t;
623
+ let n = 0;
624
+ const { shapeFlag: i } = t;
625
625
  if (e == null)
626
626
  e = null;
627
627
  else if (k(e))
628
- i = 16;
628
+ n = 16;
629
629
  else if (typeof e == "object")
630
- if (n & 65) {
630
+ if (i & 65) {
631
631
  const s = e.default;
632
632
  s && (s._c && (s._d = !1), fe(t, s()), s._c && (s._d = !0));
633
633
  return;
634
634
  } else
635
- i = 32, !e._ && !Le(e) && (e._ctx = N);
636
- else R(e) ? (e = { default: e, _ctx: N }, i = 32) : (e = String(e), n & 64 ? (i = 16, e = [It(e)]) : i = 8);
637
- t.children = e, t.shapeFlag |= i;
635
+ n = 32, !e._ && !Le(e) && (e._ctx = N);
636
+ else R(e) ? (e = { default: e, _ctx: N }, n = 32) : (e = String(e), i & 64 ? (n = 16, e = [It(e)]) : n = 8);
637
+ t.children = e, t.shapeFlag |= n;
638
638
  }
639
639
  function At(...t) {
640
640
  const e = {};
641
- for (let i = 0; i < t.length; i++) {
642
- const n = t[i];
643
- for (const s in n)
641
+ for (let n = 0; n < t.length; n++) {
642
+ const i = t[n];
643
+ for (const s in i)
644
644
  if (s === "class")
645
- e.class !== n.class && (e.class = le([e.class, n.class]));
645
+ e.class !== i.class && (e.class = le([e.class, i.class]));
646
646
  else if (s === "style")
647
- e.style = ae([e.style, n.style]);
647
+ e.style = ae([e.style, i.style]);
648
648
  else if (ze(s)) {
649
- const o = e[s], r = n[s];
649
+ const o = e[s], r = i[s];
650
650
  r && o !== r && !(k(o) && o.includes(r)) && (e[s] = o ? [].concat(o, r) : r);
651
- } else s !== "" && (e[s] = n[s]);
651
+ } else s !== "" && (e[s] = i[s]);
652
652
  }
653
653
  return e;
654
654
  }
655
655
  let A = null;
656
656
  const Nt = () => A || N;
657
657
  {
658
- const t = Z(), e = (i, n) => {
658
+ const t = Q(), e = (n, i) => {
659
659
  let s;
660
- return (s = t[i]) || (s = t[i] = []), s.push(n), (o) => {
660
+ return (s = t[n]) || (s = t[n] = []), s.push(i), (o) => {
661
661
  s.length > 1 ? s.forEach((r) => r(o)) : s[0](o);
662
662
  };
663
663
  };
664
664
  e(
665
665
  "__VUE_INSTANCE_SETTERS__",
666
- (i) => A = i
666
+ (n) => A = n
667
667
  ), e(
668
668
  "__VUE_SSR_SETTERS__",
669
- (i) => i
669
+ (n) => n
670
670
  );
671
671
  }
672
672
  process.env.NODE_ENV;
@@ -674,23 +674,23 @@ const Rt = /(?:^|[-_])\w/g, Lt = (t) => t.replace(Rt, (e) => e.toUpperCase()).re
674
674
  function Fe(t, e = !0) {
675
675
  return R(t) ? t.displayName || t.name : t.name || e && t.__name;
676
676
  }
677
- function De(t, e, i = !1) {
678
- let n = Fe(e);
679
- if (!n && e.__file) {
677
+ function De(t, e, n = !1) {
678
+ let i = Fe(e);
679
+ if (!i && e.__file) {
680
680
  const s = e.__file.match(/([^/\\]+)\.\w+$/);
681
- s && (n = s[1]);
681
+ s && (i = s[1]);
682
682
  }
683
- if (!n && t) {
683
+ if (!i && t) {
684
684
  const s = (o) => {
685
685
  for (const r in o)
686
686
  if (o[r] === e)
687
687
  return r;
688
688
  };
689
- n = s(t.components) || t.parent && s(
689
+ i = s(t.components) || t.parent && s(
690
690
  t.parent.type.components
691
691
  ) || s(t.appContext.components);
692
692
  }
693
- return n ? Lt(n) : i ? "App" : "Anonymous";
693
+ return i ? Lt(i) : n ? "App" : "Anonymous";
694
694
  }
695
695
  function $e(t) {
696
696
  return R(t) && "__vccOpts" in t;
@@ -698,7 +698,7 @@ function $e(t) {
698
698
  function Tt() {
699
699
  if (process.env.NODE_ENV === "production" || typeof window > "u")
700
700
  return;
701
- const t = { style: "color:#3ba776" }, e = { style: "color:#1677ff" }, i = { style: "color:#f5222d" }, n = { style: "color:#eb2f96" }, s = {
701
+ const t = { style: "color:#3ba776" }, e = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, i = { style: "color:#eb2f96" }, s = {
702
702
  __vue_custom_formatter: !0,
703
703
  header(l) {
704
704
  if (!O(l))
@@ -720,7 +720,7 @@ function Tt() {
720
720
  return [
721
721
  "div",
722
722
  {},
723
- ["span", t, Q(l) ? "ShallowReactive" : "Reactive"],
723
+ ["span", t, Z(l) ? "ShallowReactive" : "Reactive"],
724
724
  "<",
725
725
  a(l),
726
726
  `>${se(l) ? " (readonly)" : ""}`
@@ -729,7 +729,7 @@ function Tt() {
729
729
  return [
730
730
  "div",
731
731
  {},
732
- ["span", t, Q(l) ? "ShallowReadonly" : "Readonly"],
732
+ ["span", t, Z(l) ? "ShallowReadonly" : "Readonly"],
733
733
  "<",
734
734
  a(l),
735
735
  ">"
@@ -751,9 +751,9 @@ function Tt() {
751
751
  };
752
752
  function o(l) {
753
753
  const f = [];
754
- l.type.props && l.props && f.push(r("props", M(l.props))), l.setupState !== ne && f.push(r("setup", l.setupState)), l.data !== ne && f.push(r("data", M(l.data)));
755
- const h = c(l, "computed");
756
- h && f.push(r("computed", h));
754
+ l.type.props && l.props && f.push(r("props", M(l.props))), l.setupState !== ie && f.push(r("setup", l.setupState)), l.data !== ie && f.push(r("data", M(l.data)));
755
+ const m = c(l, "computed");
756
+ m && f.push(r("computed", m));
757
757
  const y = c(l, "inject");
758
758
  return y && f.push(r("injected", y)), f.push([
759
759
  "div",
@@ -761,7 +761,7 @@ function Tt() {
761
761
  [
762
762
  "span",
763
763
  {
764
- style: n.style + ";opacity:0.66"
764
+ style: i.style + ";opacity:0.66"
765
765
  },
766
766
  "$ (internal): "
767
767
  ],
@@ -784,34 +784,34 @@ function Tt() {
784
784
  {
785
785
  style: "padding-left:1.25em"
786
786
  },
787
- ...Object.keys(f).map((h) => [
787
+ ...Object.keys(f).map((m) => [
788
788
  "div",
789
789
  {},
790
- ["span", n, h + ": "],
791
- a(f[h], !1)
790
+ ["span", i, m + ": "],
791
+ a(f[m], !1)
792
792
  ])
793
793
  ]
794
794
  ] : ["span", {}];
795
795
  }
796
796
  function a(l, f = !0) {
797
- return typeof l == "number" ? ["span", e, l] : typeof l == "string" ? ["span", i, JSON.stringify(l)] : typeof l == "boolean" ? ["span", n, l] : O(l) ? ["object", { object: f ? M(l) : l }] : ["span", i, String(l)];
797
+ return typeof l == "number" ? ["span", e, l] : typeof l == "string" ? ["span", n, JSON.stringify(l)] : typeof l == "boolean" ? ["span", i, l] : O(l) ? ["object", { object: f ? M(l) : l }] : ["span", n, String(l)];
798
798
  }
799
799
  function c(l, f) {
800
- const h = l.type;
801
- if (R(h))
800
+ const m = l.type;
801
+ if (R(m))
802
802
  return;
803
803
  const y = {};
804
804
  for (const u in l.ctx)
805
- m(h, u, f) && (y[u] = l.ctx[u]);
805
+ h(m, u, f) && (y[u] = l.ctx[u]);
806
806
  return y;
807
807
  }
808
- function m(l, f, h) {
809
- const y = l[h];
810
- if (k(y) && y.includes(f) || O(y) && f in y || l.extends && m(l.extends, f, h) || l.mixins && l.mixins.some((u) => m(u, f, h)))
808
+ function h(l, f, m) {
809
+ const y = l[m];
810
+ if (k(y) && y.includes(f) || O(y) && f in y || l.extends && h(l.extends, f, m) || l.mixins && l.mixins.some((u) => h(u, f, m)))
811
811
  return !0;
812
812
  }
813
813
  function d(l) {
814
- return Q(l) ? "ShallowRef" : l.effect ? "ComputedRef" : "Ref";
814
+ return Z(l) ? "ShallowRef" : l.effect ? "ComputedRef" : "Ref";
815
815
  }
816
816
  window.devtoolsFormatters ? window.devtoolsFormatters.push(s) : window.devtoolsFormatters = [s];
817
817
  }
@@ -831,18 +831,18 @@ class ye {
831
831
  constructor(e) {
832
832
  this.endpoint = e || "https://foisit-ninja.netlify.app/.netlify/functions/intent";
833
833
  }
834
- async determineIntent(e, i, n) {
834
+ async determineIntent(e, n, i) {
835
835
  try {
836
836
  const s = {
837
837
  userInput: e,
838
- commands: i.map((a) => ({
838
+ commands: n.map((a) => ({
839
839
  id: a.id,
840
840
  command: a.command,
841
841
  description: a.description,
842
842
  parameters: a.parameters
843
843
  // Send param schemas to AI
844
844
  })),
845
- context: n
845
+ context: i
846
846
  }, o = await fetch(this.endpoint, {
847
847
  method: "POST",
848
848
  headers: {
@@ -867,19 +867,19 @@ class Mt {
867
867
  this.enableSmartIntent = e.enableSmartIntent ?? !0, this.enableSmartIntent && (this.openAIService = new ye(e.intentEndpoint));
868
868
  }
869
869
  /** Add a new command (string or object) */
870
- addCommand(e, i) {
871
- let n;
870
+ addCommand(e, n) {
871
+ let i;
872
872
  if (typeof e == "string") {
873
- if (!i)
873
+ if (!n)
874
874
  throw new Error("Action required when adding command by string.");
875
- n = {
875
+ i = {
876
876
  id: e.toLowerCase().replace(/\s+/g, "_"),
877
877
  command: e.toLowerCase(),
878
- action: i
878
+ action: n
879
879
  };
880
880
  } else
881
- n = { ...e }, n.id || (n.id = n.command.toLowerCase().replace(/\s+/g, "_"));
882
- this.commands.set(n.command.toLowerCase(), n), n.id && (n.id, n.command);
881
+ i = { ...e }, i.id || (i.id = i.command.toLowerCase().replace(/\s+/g, "_"));
882
+ this.commands.set(i.command.toLowerCase(), i), i.id && (i.id, i.command);
883
883
  }
884
884
  /** Remove an existing command */
885
885
  removeCommand(e) {
@@ -889,13 +889,13 @@ class Mt {
889
889
  async executeCommand(e) {
890
890
  if (typeof e == "object" && e !== null) {
891
891
  if (this.isStructured(e)) {
892
- const c = String(e.commandId), m = e.params ?? {}, d = this.getCommandById(c);
892
+ const c = String(e.commandId), h = e.params ?? {}, d = this.getCommandById(c);
893
893
  if (!d) return { message: "That command is not available.", type: "error" };
894
- const l = this.sanitizeParamsForCommand(d, m), h = (d.parameters ?? []).filter((y) => y.required).filter((y) => l[y.name] == null || l[y.name] === "");
895
- return h.length > 0 ? (this.context = { commandId: this.getCommandIdentifier(d), params: l }, {
894
+ const l = this.sanitizeParamsForCommand(d, h), m = (d.parameters ?? []).filter((y) => y.required).filter((y) => l[y.name] == null || l[y.name] === "");
895
+ return m.length > 0 ? (this.context = { commandId: this.getCommandIdentifier(d), params: l }, {
896
896
  message: `Please provide the required details for "${d.command}".`,
897
897
  type: "form",
898
- fields: h
898
+ fields: m
899
899
  }) : d.critical ? (this.pendingConfirmation = { commandId: this.getCommandIdentifier(d), params: l }, this.buildConfirmResponse(d)) : this.safeRunAction(d, l);
900
900
  }
901
901
  if (!this.context)
@@ -917,16 +917,16 @@ class Mt {
917
917
  const a = await this.safeRunAction(o, r);
918
918
  return this.context = null, this.normalizeResponse(a);
919
919
  }
920
- const i = e.trim().toLowerCase();
920
+ const n = e.trim().toLowerCase();
921
921
  if (this.pendingConfirmation) {
922
- const o = i;
922
+ const o = n;
923
923
  if (["yes", "y", "confirm", "ok", "okay"].includes(o)) {
924
924
  const { commandId: r, params: a } = this.pendingConfirmation;
925
925
  this.pendingConfirmation = null;
926
926
  const c = this.getCommandById(r);
927
927
  return c ? this.safeRunAction(c, a) : { message: "That action is no longer available.", type: "error" };
928
928
  }
929
- return ["no", "n", "cancel", "stop"].includes(o) ? (this.pendingConfirmation = null, { message: "Cancelled.", type: "success" }) : {
929
+ return ["no", "n", "cancel", "stop"].includes(o) ? (this.pendingConfirmation = null, { message: "Cancelled.", type: "success" }) : {
930
930
  message: "Please confirm: Yes or No.",
931
931
  type: "confirm",
932
932
  options: [
@@ -935,20 +935,20 @@ class Mt {
935
935
  ]
936
936
  };
937
937
  }
938
- const n = this.commands.get(i);
939
- if (n) {
940
- const o = n, r = (o.parameters ?? []).filter((a) => a.required);
938
+ const i = this.commands.get(n);
939
+ if (i) {
940
+ const o = i, r = (o.parameters ?? []).filter((a) => a.required);
941
941
  return r.length > 0 ? (this.context = { commandId: this.getCommandIdentifier(o), params: {} }, {
942
942
  message: `Please provide the required details for "${o.command}".`,
943
943
  type: "form",
944
944
  fields: r
945
945
  }) : o.critical ? (this.pendingConfirmation = { commandId: this.getCommandIdentifier(o), params: {} }, this.buildConfirmResponse(o)) : this.safeRunAction(o, {});
946
946
  }
947
- const s = await this.tryDeterministicMatch(i);
947
+ const s = await this.tryDeterministicMatch(n);
948
948
  if (s) return s;
949
949
  if (this.enableSmartIntent && this.openAIService) {
950
950
  const o = await this.getCommandsForAI(), r = await this.openAIService.determineIntent(
951
- i,
951
+ n,
952
952
  o,
953
953
  this.context
954
954
  );
@@ -958,64 +958,114 @@ class Mt {
958
958
  }
959
959
  async handleAIResult(e) {
960
960
  if (e.type === "match" && e.match) {
961
- const i = this.getCommandById(e.match);
962
- if (!i)
961
+ const n = this.getCommandById(e.match);
962
+ if (!n)
963
963
  return { message: "I'm not sure what you mean.", type: "error" };
964
- const n = e.params ?? {}, s = this.sanitizeParamsForCommand(i, n), r = (i.parameters ?? []).filter((c) => c.required).filter((c) => s[c.name] == null || s[c.name] === "");
965
- if (e.incomplete || r.length > 0) {
966
- this.context = { commandId: this.getCommandIdentifier(i), params: s };
967
- const c = r.some((m) => m.type === "select");
968
- if (r.length <= 2 && !c) {
969
- const m = r.map((d) => d.name).join(" and ");
964
+ const i = e.params ?? {}, s = this.sanitizeParamsForCommand(n, i), o = n.allowAiParamExtraction === !1 ? {} : s, a = (n.parameters ?? []).filter((h) => h.required).filter((h) => o[h.name] == null || o[h.name] === "");
965
+ if (e.incomplete || a.length > 0) {
966
+ if (this.context = { commandId: this.getCommandIdentifier(n), params: o }, !(n.collectRequiredViaForm !== !1) && this.shouldAskSingleQuestion(a)) {
967
+ const l = a.map((f) => f.name).join(" and ");
970
968
  return {
971
- message: e.message || `Please provide ${m}.`,
969
+ message: e.message || `Please provide ${l}.`,
972
970
  type: "question"
973
971
  };
974
972
  }
975
973
  return {
976
- message: e.message || `Please fill in the missing details for "${i.command}".`,
974
+ message: e.message || `Please fill in the missing details for "${n.command}".`,
977
975
  type: "form",
978
- fields: r
976
+ fields: a
979
977
  };
980
978
  }
981
- if (i.critical)
979
+ if (n.critical)
982
980
  return this.pendingConfirmation = {
983
- commandId: this.getCommandIdentifier(i),
984
- params: s
985
- }, this.buildConfirmResponse(i);
986
- const a = await i.action(s);
987
- return this.normalizeResponse(a);
981
+ commandId: this.getCommandIdentifier(n),
982
+ params: o
983
+ }, this.buildConfirmResponse(n);
984
+ const c = await n.action(o);
985
+ return this.normalizeResponse(c);
988
986
  }
989
987
  return e.type === "ambiguous" && e.options && e.options.length ? {
990
988
  message: e.message || "Did you mean one of these?",
991
989
  type: "ambiguous",
992
- options: e.options.map((i) => ({
993
- label: i.label,
994
- value: i.commandId ?? i.label,
995
- commandId: i.commandId
990
+ options: e.options.map((n) => ({
991
+ label: n.label,
992
+ value: n.commandId ?? n.label,
993
+ commandId: n.commandId
996
994
  }))
997
995
  } : this.listAllCommands();
998
996
  }
999
- sanitizeParamsForCommand(e, i) {
1000
- const n = { ...i ?? {} };
1001
- for (const s of e.parameters ?? [])
997
+ sanitizeParamsForCommand(e, n) {
998
+ const i = { ...n ?? {} };
999
+ for (const s of e.parameters ?? []) {
1000
+ const o = i[s.name];
1001
+ if (s.type === "string") {
1002
+ if (typeof o != "string") {
1003
+ delete i[s.name];
1004
+ continue;
1005
+ }
1006
+ const r = o.trim();
1007
+ if (!r) {
1008
+ delete i[s.name];
1009
+ continue;
1010
+ }
1011
+ i[s.name] = r;
1012
+ }
1013
+ if (s.type === "number") {
1014
+ const r = typeof o == "number" ? o : Number(o == null ? void 0 : o.toString().trim());
1015
+ if (Number.isNaN(r)) {
1016
+ delete i[s.name];
1017
+ continue;
1018
+ }
1019
+ if (typeof s.min == "number" && r < s.min) {
1020
+ delete i[s.name];
1021
+ continue;
1022
+ }
1023
+ if (typeof s.max == "number" && r > s.max) {
1024
+ delete i[s.name];
1025
+ continue;
1026
+ }
1027
+ i[s.name] = r;
1028
+ }
1002
1029
  if (s.type === "date") {
1003
- const o = n[s.name];
1004
- if (typeof o == "string") {
1005
- const r = o.trim();
1006
- this.isIsoDateString(r) || delete n[s.name];
1030
+ const r = i[s.name];
1031
+ if (typeof r == "string") {
1032
+ const a = r.trim();
1033
+ this.isIsoDateString(a) ? i[s.name] = a : delete i[s.name];
1034
+ } else
1035
+ delete i[s.name];
1036
+ }
1037
+ if (s.type === "select") {
1038
+ const r = typeof o == "string" ? o : o == null ? void 0 : o.toString();
1039
+ if (!r) {
1040
+ delete i[s.name];
1041
+ continue;
1007
1042
  }
1043
+ if (Array.isArray(s.options) && s.options.length > 0 && !s.options.some((c) => String(c.value) === String(r))) {
1044
+ delete i[s.name];
1045
+ continue;
1046
+ }
1047
+ i[s.name] = r;
1048
+ }
1049
+ if (s.type === "file") {
1050
+ const r = i[s.name], a = r && typeof r == "object" && typeof r.name == "string" && typeof r.size == "number", c = typeof r == "string" && /^data:[^;]+;base64,/.test(r);
1051
+ (s.delivery ?? "file") === "base64" ? !c && !a && delete i[s.name] : a || delete i[s.name];
1008
1052
  }
1009
- return n;
1053
+ }
1054
+ return i;
1010
1055
  }
1011
1056
  isIsoDateString(e) {
1012
1057
  if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
1013
- const i = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
1014
- return !Number.isNaN(i.getTime());
1058
+ const n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
1059
+ return !Number.isNaN(n.getTime());
1060
+ }
1061
+ shouldAskSingleQuestion(e) {
1062
+ if (e.length !== 1) return !1;
1063
+ const n = e[0].type;
1064
+ return n === "string" || n === "number" || n === "date";
1015
1065
  }
1016
1066
  buildConfirmResponse(e) {
1017
1067
  return {
1018
- message: `⚠️ Are you sure you want to run "${e.command}"?`,
1068
+ message: `Are you sure you want to run "${e.command}"?`,
1019
1069
  type: "confirm",
1020
1070
  options: [
1021
1071
  { label: "Yes", value: "yes" },
@@ -1024,21 +1074,21 @@ class Mt {
1024
1074
  };
1025
1075
  }
1026
1076
  async tryDeterministicMatch(e) {
1027
- const i = [];
1077
+ const n = [];
1028
1078
  for (const a of this.commands.values()) {
1029
1079
  let c = 0;
1030
- const m = a.command.toLowerCase();
1031
- e.includes(m) && (c += 5);
1080
+ const h = a.command.toLowerCase();
1081
+ e.includes(h) && (c += 5);
1032
1082
  const d = a.keywords ?? [];
1033
1083
  for (const l of d) {
1034
1084
  const f = l.toLowerCase().trim();
1035
1085
  f && (e === f ? c += 4 : e.includes(f) && (c += 3));
1036
1086
  }
1037
- c > 0 && i.push({ cmd: a, score: c });
1087
+ c > 0 && n.push({ cmd: a, score: c });
1038
1088
  }
1039
- if (i.length === 0) return null;
1040
- i.sort((a, c) => c.score - a.score);
1041
- const n = i[0].score, s = i.filter((a) => a.score === n).slice(0, 3);
1089
+ if (n.length === 0) return null;
1090
+ n.sort((a, c) => c.score - a.score);
1091
+ const i = n[0].score, s = n.filter((a) => a.score === i).slice(0, 3);
1042
1092
  if (s.length > 1)
1043
1093
  return {
1044
1094
  message: "I think you mean one of these. Which one should I run?",
@@ -1056,32 +1106,32 @@ class Mt {
1056
1106
  fields: r
1057
1107
  }) : o.critical ? (this.pendingConfirmation = { commandId: this.getCommandIdentifier(o), params: {} }, this.buildConfirmResponse(o)) : this.safeRunAction(o, {});
1058
1108
  }
1059
- async safeRunAction(e, i) {
1109
+ async safeRunAction(e, n) {
1060
1110
  try {
1061
- const n = await e.action(i ?? {});
1062
- return this.normalizeResponse(n);
1111
+ const i = await e.action(n ?? {});
1112
+ return this.normalizeResponse(i);
1063
1113
  } catch {
1064
1114
  return { message: "Something went wrong while running that command.", type: "error" };
1065
1115
  }
1066
1116
  }
1067
1117
  async getCommandsForAI() {
1068
- const e = Array.from(this.commands.values()).map((i) => ({
1069
- ...i,
1070
- parameters: i.parameters ? i.parameters.map((n) => ({ ...n })) : void 0
1118
+ const e = Array.from(this.commands.values()).map((n) => ({
1119
+ ...n,
1120
+ parameters: n.parameters ? n.parameters.map((i) => ({ ...i })) : void 0
1071
1121
  }));
1072
1122
  return await Promise.all(
1073
- e.map(async (i) => {
1074
- i.parameters && await Promise.all(
1075
- i.parameters.map(async (n) => {
1076
- if (n.type !== "select" || !n.getOptions || n.options && n.options.length) return;
1077
- const s = `${i.id ?? i.command}:${n.name}`, o = this.selectOptionsCache.get(s), r = Date.now();
1123
+ e.map(async (n) => {
1124
+ n.parameters && await Promise.all(
1125
+ n.parameters.map(async (i) => {
1126
+ if (i.type !== "select" || !i.getOptions || i.options && i.options.length) return;
1127
+ const s = `${n.id ?? n.command}:${i.name}`, o = this.selectOptionsCache.get(s), r = Date.now();
1078
1128
  if (o && r - o.ts < 6e4) {
1079
- n.options = o.options;
1129
+ i.options = o.options;
1080
1130
  return;
1081
1131
  }
1082
1132
  try {
1083
- const a = await n.getOptions();
1084
- this.selectOptionsCache.set(s, { options: a, ts: r }), n.options = a;
1133
+ const a = await i.getOptions();
1134
+ this.selectOptionsCache.set(s, { options: a, ts: r }), i.options = a;
1085
1135
  } catch {
1086
1136
  }
1087
1137
  })
@@ -1090,17 +1140,17 @@ class Mt {
1090
1140
  ), e;
1091
1141
  }
1092
1142
  getCommandById(e) {
1093
- for (const i of this.commands.values())
1094
- if (i.id === e) return i;
1143
+ for (const n of this.commands.values())
1144
+ if (n.id === e) return n;
1095
1145
  }
1096
1146
  listAllCommands() {
1097
1147
  return {
1098
1148
  message: "Here are the available commands:",
1099
1149
  type: "ambiguous",
1100
- options: Array.from(this.commands.values()).map((i) => ({
1101
- label: i.command,
1102
- value: i.id ?? i.command,
1103
- commandId: i.id ?? i.command
1150
+ options: Array.from(this.commands.values()).map((n) => ({
1151
+ label: n.command,
1152
+ value: n.id ?? n.command,
1153
+ commandId: n.id ?? n.command
1104
1154
  }))
1105
1155
  };
1106
1156
  }
@@ -1120,27 +1170,27 @@ class Mt {
1120
1170
  }
1121
1171
  class He {
1122
1172
  constructor() {
1123
- this.synth = window.speechSynthesis;
1173
+ this.synth = typeof window < "u" ? window.speechSynthesis : null;
1124
1174
  }
1125
- speak(e, i) {
1175
+ speak(e, n) {
1126
1176
  if (!this.synth) {
1127
- console.error("SpeechSynthesis API is not supported in this browser.");
1177
+ console.error("SpeechSynthesis API is not supported in this environment.");
1128
1178
  return;
1129
1179
  }
1130
- const n = new SpeechSynthesisUtterance(e);
1131
- i && (n.pitch = i.pitch || 1, n.rate = i.rate || 1, n.volume = i.volume || 1), n.onstart = () => {
1180
+ const i = new SpeechSynthesisUtterance(e);
1181
+ n && (i.pitch = n.pitch || 1, i.rate = n.rate || 1, i.volume = n.volume || 1), typeof window < "u" && (i.onstart = () => {
1132
1182
  window.dispatchEvent(new CustomEvent("foisit:tts-start"));
1133
- }, n.onend = () => {
1183
+ }, i.onend = () => {
1134
1184
  console.log("Speech finished."), window.dispatchEvent(new CustomEvent("foisit:tts-end"));
1135
- }, n.onerror = (s) => {
1185
+ }), i.onerror = (s) => {
1136
1186
  console.error("Error during speech synthesis:", s.error);
1137
- }, this.synth.speak(n);
1187
+ }, this.synth.speak(i);
1138
1188
  }
1139
1189
  stopSpeaking() {
1140
1190
  this.synth && this.synth.cancel();
1141
1191
  }
1142
1192
  }
1143
- class Vt {
1193
+ class Pt {
1144
1194
  constructor() {
1145
1195
  this.fallbackMessage = "Sorry, I didn’t understand that.";
1146
1196
  }
@@ -1155,11 +1205,12 @@ class Vt {
1155
1205
  }
1156
1206
  }
1157
1207
  const be = () => {
1208
+ if (typeof window > "u") return null;
1158
1209
  const t = window;
1159
1210
  return t.SpeechRecognition ?? t.webkitSpeechRecognition ?? null;
1160
1211
  };
1161
- class Pt {
1162
- constructor(e = "en-US", i = {}) {
1212
+ class Vt {
1213
+ constructor(e = "en-US", n = {}) {
1163
1214
  this.recognition = null, this.isListening = !1, this.engineActive = !1, this.intentionallyStopped = !1, this.restartAllowed = !0, this.lastStart = 0, this.backoffMs = 250, this.destroyed = !1, this.resultCallback = null, this.ttsSpeaking = !1, this.debugEnabled = !0, this.restartTimer = null, this.prewarmed = !1, this.hadResultThisSession = !1, this.onTTSStart = () => {
1164
1215
  var s;
1165
1216
  this.ttsSpeaking = !0;
@@ -1171,25 +1222,25 @@ class Pt {
1171
1222
  }, this.onTTSEnd = () => {
1172
1223
  this.ttsSpeaking = !1, this.isListening && this.restartAllowed ? this.safeRestart() : this.emitStatus(this.isListening ? "listening" : "idle");
1173
1224
  };
1174
- const n = be();
1175
- if (n) {
1176
- this.recognition = new n(), this.recognition.lang = e, this.recognition.interimResults = i.interimResults ?? !0, this.recognition.continuous = i.continuous ?? !0, this.recognition.onresult = (o) => this.handleResult(o, i), this.recognition.onend = () => this.handleEnd(), this.recognition.onstart = () => {
1225
+ const i = be();
1226
+ if (i) {
1227
+ this.recognition = new i(), this.recognition.lang = e, this.recognition.interimResults = n.interimResults ?? !0, this.recognition.continuous = n.continuous ?? !0, this.recognition.onresult = (o) => this.handleResult(o, n), this.recognition.onend = () => this.handleEnd(), this.recognition.onstart = () => {
1177
1228
  this.log("recognition onstart"), this.engineActive = !0, this.hadResultThisSession = !1, this.restartTimer && (clearTimeout(this.restartTimer), this.restartTimer = null), this.backoffMs = 250, this.isListening && !this.ttsSpeaking && this.emitStatus("listening");
1178
1229
  };
1179
1230
  const s = this.recognition;
1180
1231
  s.onaudiostart = () => this.log("onaudiostart"), s.onsoundstart = () => this.log("onsoundstart"), s.onspeechstart = () => this.log("onspeechstart"), s.onspeechend = () => this.log("onspeechend"), s.onsoundend = () => this.log("onsoundend"), s.onaudioend = () => this.log("onaudioend"), this.recognition.onerror = (o) => this.handleError(o);
1181
1232
  } else
1182
1233
  this.recognition = null, this.emitStatus("unsupported");
1183
- window.addEventListener("foisit:tts-start", this.onTTSStart), window.addEventListener("foisit:tts-end", this.onTTSEnd), this.visibilityHandler = () => {
1234
+ typeof window < "u" ? (window.addEventListener("foisit:tts-start", this.onTTSStart), window.addEventListener("foisit:tts-end", this.onTTSEnd), this.visibilityHandler = () => {
1184
1235
  var s;
1185
- if (document.hidden) {
1236
+ if (typeof document < "u" && document.hidden) {
1186
1237
  try {
1187
1238
  (s = this.recognition) == null || s.stop();
1188
1239
  } catch {
1189
1240
  }
1190
1241
  this.emitStatus(this.ttsSpeaking ? "speaking" : "idle");
1191
1242
  } else this.isListening && !this.ttsSpeaking && this.safeRestart();
1192
- }, document.addEventListener("visibilitychange", this.visibilityHandler);
1243
+ }, typeof document < "u" && document.addEventListener("visibilitychange", this.visibilityHandler)) : this.visibilityHandler = void 0;
1193
1244
  }
1194
1245
  // Debug logger helpers
1195
1246
  log(e) {
@@ -1237,15 +1288,15 @@ class Pt {
1237
1288
  this.destroyed = !0, this.stopListening(), this.resultCallback = null, window.removeEventListener("foisit:tts-start", this.onTTSStart), window.removeEventListener("foisit:tts-end", this.onTTSEnd), this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = void 0);
1238
1289
  }
1239
1290
  /** Handle recognized speech results */
1240
- handleResult(e, i) {
1291
+ handleResult(e, n) {
1241
1292
  var s, o;
1242
1293
  if (!this.resultCallback) return;
1243
- const n = i.confidenceThreshold ?? 0.6;
1294
+ const i = n.confidenceThreshold ?? 0.6;
1244
1295
  for (let r = e.resultIndex; r < e.results.length; r++) {
1245
- const a = e.results[r], c = a && a[0], m = ((o = (s = c == null ? void 0 : c.transcript) == null ? void 0 : s.trim) == null ? void 0 : o.call(s)) || "", d = (c == null ? void 0 : c.confidence) ?? 0;
1246
- if (m && !(!a.isFinal && i.interimResults === !1) && !(a.isFinal && d < n))
1296
+ const a = e.results[r], c = a && a[0], h = ((o = (s = c == null ? void 0 : c.transcript) == null ? void 0 : s.trim) == null ? void 0 : o.call(s)) || "", d = (c == null ? void 0 : c.confidence) ?? 0;
1297
+ if (h && !(!a.isFinal && n.interimResults === !1) && !(a.isFinal && d < i))
1247
1298
  try {
1248
- this.hadResultThisSession = !0, this.resultCallback(m, !!a.isFinal);
1299
+ this.hadResultThisSession = !0, this.resultCallback(h, !!a.isFinal);
1249
1300
  } catch {
1250
1301
  this.error("VoiceProcessor: result callback error");
1251
1302
  }
@@ -1261,9 +1312,9 @@ class Pt {
1261
1312
  }
1262
1313
  /** Handle errors during speech recognition */
1263
1314
  handleError(e) {
1264
- const i = e == null ? void 0 : e.error;
1265
- if (this.warn(`Error occurred: ${i ?? "unknown"}`), i && ["not-allowed", "service-not-allowed", "bad-grammar", "language-not-supported"].includes(i)) {
1266
- this.intentionallyStopped = !0, this.restartAllowed = !1, this.isListening = !1, this.emitStatus("error", { error: i });
1315
+ const n = e == null ? void 0 : e.error;
1316
+ if (this.warn(`Error occurred: ${n ?? "unknown"}`), n && ["not-allowed", "service-not-allowed", "bad-grammar", "language-not-supported"].includes(n)) {
1317
+ this.intentionallyStopped = !0, this.restartAllowed = !1, this.isListening = !1, this.emitStatus("error", { error: n });
1267
1318
  return;
1268
1319
  }
1269
1320
  this.scheduleRestart();
@@ -1308,17 +1359,17 @@ class Pt {
1308
1359
  const e = navigator.mediaDevices;
1309
1360
  if (!(e != null && e.getUserMedia)) return;
1310
1361
  this.log("prewarmAudio: requesting mic");
1311
- const i = await e.getUserMedia({ audio: !0 });
1312
- for (const n of i.getTracks()) n.stop();
1362
+ const n = await e.getUserMedia({ audio: !0 });
1363
+ for (const i of n.getTracks()) i.stop();
1313
1364
  this.prewarmed = !0, this.log("prewarmAudio: mic ready");
1314
1365
  } catch {
1315
1366
  this.warn("prewarmAudio: failed to get mic");
1316
1367
  }
1317
1368
  }
1318
- emitStatus(e, i) {
1369
+ emitStatus(e, n) {
1319
1370
  if (this.statusCallback)
1320
1371
  try {
1321
- this.statusCallback(e, i);
1372
+ this.statusCallback(e, n);
1322
1373
  } catch {
1323
1374
  this.error("VoiceProcessor: status callback error");
1324
1375
  }
@@ -1336,8 +1387,8 @@ class Ft {
1336
1387
  this.destroy(), this.dblClickListener = () => {
1337
1388
  e();
1338
1389
  }, document.addEventListener("dblclick", this.dblClickListener), this.touchEndListener = () => {
1339
- const i = (/* @__PURE__ */ new Date()).getTime(), n = i - this.lastTap;
1340
- n < 300 && n > 0 && e(), this.lastTap = i;
1390
+ const n = (/* @__PURE__ */ new Date()).getTime(), i = n - this.lastTap;
1391
+ i < 300 && i > 0 && e(), this.lastTap = n;
1341
1392
  }, document.addEventListener("touchend", this.touchEndListener);
1342
1393
  }
1343
1394
  destroy() {
@@ -1395,7 +1446,10 @@ function Ht() {
1395
1446
  const t = document.querySelector("#gradient-indicator");
1396
1447
  t && (t.remove(), console.log("Gradient indicator removed from the DOM"));
1397
1448
  }
1398
- class qt {
1449
+ function qt() {
1450
+ return typeof window < "u" && typeof document < "u";
1451
+ }
1452
+ class zt {
1399
1453
  constructor() {
1400
1454
  this.state = "idle", this.subscribers = [];
1401
1455
  }
@@ -1413,27 +1467,27 @@ class qt {
1413
1467
  this.subscribers.forEach((e) => e(this.state));
1414
1468
  }
1415
1469
  }
1416
- class zt {
1470
+ class Bt {
1417
1471
  constructor(e) {
1418
- this.container = null, this.chatWindow = null, this.messagesContainer = null, this.input = null, this.isOpen = !1, this.loadingEl = null, this.config = e, this.init();
1472
+ this.container = null, this.chatWindow = null, this.messagesContainer = null, this.input = null, this.isOpen = !1, this.loadingEl = null, this.active = qt(), this.config = e, this.active && this.init();
1419
1473
  }
1420
1474
  init() {
1421
- var i, n;
1475
+ var n, i;
1422
1476
  if (this.container) return;
1423
1477
  this.injectOverlayStyles();
1424
1478
  const e = document.getElementById("foisit-overlay-container");
1425
1479
  if (e && e instanceof HTMLElement) {
1426
- this.container = e, this.chatWindow = e.querySelector(".foisit-chat"), this.messagesContainer = e.querySelector(".foisit-messages"), this.input = e.querySelector("input.foisit-input"), ((i = this.config.floatingButton) == null ? void 0 : i.visible) !== !1 && !e.querySelector(".foisit-floating-btn") && this.renderFloatingButton(), this.chatWindow || this.renderChatWindow();
1480
+ this.container = e, this.chatWindow = e.querySelector(".foisit-chat"), this.messagesContainer = e.querySelector(".foisit-messages"), this.input = e.querySelector("input.foisit-input"), ((n = this.config.floatingButton) == null ? void 0 : n.visible) !== !1 && !e.querySelector(".foisit-floating-btn") && this.renderFloatingButton(), this.chatWindow || this.renderChatWindow();
1427
1481
  return;
1428
1482
  }
1429
- this.container = document.createElement("div"), this.container.id = "foisit-overlay-container", this.container.className = "foisit-overlay-container", document.body.appendChild(this.container), ((n = this.config.floatingButton) == null ? void 0 : n.visible) !== !1 && this.renderFloatingButton(), this.renderChatWindow();
1483
+ this.container = document.createElement("div"), this.container.id = "foisit-overlay-container", this.container.className = "foisit-overlay-container", document.body.appendChild(this.container), ((i = this.config.floatingButton) == null ? void 0 : i.visible) !== !1 && this.renderFloatingButton(), this.renderChatWindow();
1430
1484
  }
1431
1485
  renderFloatingButton() {
1432
- var s, o, r, a, c, m;
1486
+ var s, o, r, a, c, h;
1433
1487
  const e = document.createElement("button");
1434
1488
  e.innerHTML = ((s = this.config.floatingButton) == null ? void 0 : s.customHtml) || "🎙️";
1435
- const i = ((r = (o = this.config.floatingButton) == null ? void 0 : o.position) == null ? void 0 : r.bottom) || "20px", n = ((c = (a = this.config.floatingButton) == null ? void 0 : a.position) == null ? void 0 : c.right) || "20px";
1436
- e.className = "foisit-floating-btn", e.style.bottom = i, e.style.right = n, e.onclick = () => this.toggle(), e.onmouseenter = () => e.style.transform = "scale(1.05)", e.onmouseleave = () => e.style.transform = "scale(1)", (m = this.container) == null || m.appendChild(e);
1489
+ const n = ((r = (o = this.config.floatingButton) == null ? void 0 : o.position) == null ? void 0 : r.bottom) || "20px", i = ((c = (a = this.config.floatingButton) == null ? void 0 : a.position) == null ? void 0 : c.right) || "20px";
1490
+ e.className = "foisit-floating-btn", e.style.bottom = n, e.style.right = i, e.onclick = () => this.toggle(), e.onmouseenter = () => e.style.transform = "scale(1.05)", e.onmouseleave = () => e.style.transform = "scale(1)", (h = this.container) == null || h.appendChild(e);
1437
1491
  }
1438
1492
  renderChatWindow() {
1439
1493
  var o;
@@ -1441,10 +1495,10 @@ class zt {
1441
1495
  this.chatWindow = document.createElement("div"), this.chatWindow.className = "foisit-chat";
1442
1496
  const e = document.createElement("div");
1443
1497
  e.className = "foisit-header";
1444
- const i = document.createElement("span");
1445
- i.className = "foisit-title", i.textContent = "Foisit";
1446
- const n = document.createElement("button");
1447
- n.type = "button", n.className = "foisit-close", n.setAttribute("aria-label", "Close"), n.innerHTML = "&times;", n.addEventListener("click", () => this.toggle()), e.appendChild(i), e.appendChild(n), this.messagesContainer = document.createElement("div"), this.messagesContainer.className = "foisit-messages";
1498
+ const n = document.createElement("span");
1499
+ n.className = "foisit-title", n.textContent = "Foisit";
1500
+ const i = document.createElement("button");
1501
+ i.type = "button", i.className = "foisit-close", i.setAttribute("aria-label", "Close"), i.innerHTML = "&times;", i.addEventListener("click", () => this.toggle()), e.appendChild(n), e.appendChild(i), this.messagesContainer = document.createElement("div"), this.messagesContainer.className = "foisit-messages";
1448
1502
  const s = document.createElement("div");
1449
1503
  s.className = "foisit-input-area", this.input = document.createElement("input"), this.input.placeholder = this.config.inputPlaceholder || "Type a command...", this.input.className = "foisit-input", this.input.addEventListener("keydown", (r) => {
1450
1504
  var a;
@@ -1454,44 +1508,44 @@ class zt {
1454
1508
  }
1455
1509
  }), s.appendChild(this.input), this.chatWindow.appendChild(e), this.chatWindow.appendChild(this.messagesContainer), this.chatWindow.appendChild(s), (o = this.container) == null || o.appendChild(this.chatWindow);
1456
1510
  }
1457
- registerCallbacks(e, i) {
1458
- this.onSubmit = e, this.onClose = i;
1511
+ registerCallbacks(e, n) {
1512
+ this.active && (this.onSubmit = e, this.onClose = n);
1459
1513
  }
1460
- toggle(e, i) {
1461
- e && (this.onSubmit = e), i && (this.onClose = i), this.isOpen = !this.isOpen, this.chatWindow && (this.isOpen ? (this.chatWindow.style.display = "flex", requestAnimationFrame(() => {
1514
+ toggle(e, n) {
1515
+ this.active && (e && (this.onSubmit = e), n && (this.onClose = n), this.isOpen = !this.isOpen, this.chatWindow && (this.isOpen ? (this.chatWindow.style.display = "flex", requestAnimationFrame(() => {
1462
1516
  this.chatWindow && (this.chatWindow.style.opacity = "1", this.chatWindow.style.transform = "translateY(0) scale(1)");
1463
1517
  }), setTimeout(() => {
1464
- var n;
1465
- return (n = this.input) == null ? void 0 : n.focus();
1518
+ var i;
1519
+ return (i = this.input) == null ? void 0 : i.focus();
1466
1520
  }, 100)) : (this.chatWindow.style.opacity = "0", this.chatWindow.style.transform = "translateY(20px) scale(0.95)", setTimeout(() => {
1467
1521
  this.chatWindow && !this.isOpen && (this.chatWindow.style.display = "none");
1468
- }, 200), this.onClose && this.onClose()));
1522
+ }, 200), this.onClose && this.onClose())));
1469
1523
  }
1470
- addMessage(e, i) {
1524
+ addMessage(e, n) {
1471
1525
  if (!this.messagesContainer) return;
1472
- const n = document.createElement("div");
1473
- n.textContent = e, n.className = i === "user" ? "foisit-bubble user" : "foisit-bubble system", this.messagesContainer.appendChild(n), this.scrollToBottom();
1526
+ const i = document.createElement("div");
1527
+ i.textContent = e, i.className = n === "user" ? "foisit-bubble user" : "foisit-bubble system", this.messagesContainer.appendChild(i), this.scrollToBottom();
1474
1528
  }
1475
1529
  addOptions(e) {
1476
1530
  if (!this.messagesContainer) return;
1477
- const i = document.createElement("div");
1478
- i.className = "foisit-options-container", e.forEach((n) => {
1531
+ const n = document.createElement("div");
1532
+ n.className = "foisit-options-container", e.forEach((i) => {
1479
1533
  const s = document.createElement("button");
1480
- s.textContent = n.label, s.className = "foisit-option-chip", s.setAttribute("type", "button"), s.setAttribute("aria-label", n.label);
1534
+ s.textContent = i.label, s.className = "foisit-option-chip", s.setAttribute("type", "button"), s.setAttribute("aria-label", i.label);
1481
1535
  const o = () => {
1482
- if (n.commandId) {
1483
- this.onSubmit && this.onSubmit({ commandId: n.commandId });
1536
+ if (i.commandId) {
1537
+ this.onSubmit && this.onSubmit({ commandId: i.commandId });
1484
1538
  return;
1485
1539
  }
1486
- const r = n && typeof n.value == "string" && n.value.trim() ? n.value : n.label;
1540
+ const r = i && typeof i.value == "string" && i.value.trim() ? i.value : i.label;
1487
1541
  this.onSubmit && this.onSubmit(r);
1488
1542
  };
1489
1543
  s.onclick = o, s.onkeydown = (r) => {
1490
1544
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), o());
1491
- }, i.appendChild(s);
1492
- }), this.messagesContainer.appendChild(i), this.scrollToBottom();
1545
+ }, n.appendChild(s);
1546
+ }), this.messagesContainer.appendChild(n), this.scrollToBottom();
1493
1547
  }
1494
- addForm(e, i, n) {
1548
+ addForm(e, n, i) {
1495
1549
  if (!this.messagesContainer) return;
1496
1550
  this.addMessage(e, "system");
1497
1551
  const s = document.createElement("form");
@@ -1503,17 +1557,17 @@ class zt {
1503
1557
  const d = document.createElement("div");
1504
1558
  return d.className = "foisit-form-error", d.style.display = "none", d;
1505
1559
  };
1506
- (i ?? []).forEach((d) => {
1560
+ (n ?? []).forEach((d) => {
1507
1561
  const l = document.createElement("div");
1508
1562
  l.className = "foisit-form-group";
1509
1563
  const f = d.description || d.name;
1510
1564
  l.appendChild(r(f, d.required));
1511
- let h;
1565
+ let m;
1512
1566
  if (d.type === "select") {
1513
1567
  const u = document.createElement("select");
1514
1568
  u.className = "foisit-form-input";
1515
- const v = document.createElement("option");
1516
- v.value = "", v.textContent = "Select...", u.appendChild(v);
1569
+ const w = document.createElement("option");
1570
+ w.value = "", w.textContent = "Select...", u.appendChild(w);
1517
1571
  const x = (p) => {
1518
1572
  (p ?? []).forEach((S) => {
1519
1573
  const b = document.createElement("option");
@@ -1533,19 +1587,19 @@ class zt {
1533
1587
  b.value = "", b.textContent = "Error loading options", u.appendChild(b);
1534
1588
  });
1535
1589
  }
1536
- d.defaultValue != null && (u.value = String(d.defaultValue)), h = u;
1590
+ d.defaultValue != null && (u.value = String(d.defaultValue)), m = u;
1537
1591
  } else if (d.type === "file") {
1538
- const u = d, v = document.createElement("input");
1539
- v.className = "foisit-form-input", v.type = "file", u.accept && Array.isArray(u.accept) && (v.accept = u.accept.join(",")), u.multiple && (v.multiple = !0), u.capture && (u.capture === !0 ? v.setAttribute("capture", "") : v.setAttribute("capture", String(u.capture))), v.addEventListener("change", async () => {
1540
- const x = Array.from(v.files || []), p = y;
1592
+ const u = d, w = document.createElement("input");
1593
+ w.className = "foisit-form-input", w.type = "file", u.accept && Array.isArray(u.accept) && (w.accept = u.accept.join(",")), u.multiple && (w.multiple = !0), u.capture && (u.capture === !0 ? w.setAttribute("capture", "") : w.setAttribute("capture", String(u.capture))), w.addEventListener("change", async () => {
1594
+ const x = Array.from(w.files || []), p = y;
1541
1595
  if (p.style.display = "none", p.textContent = "", x.length === 0) return;
1542
1596
  const S = u.maxFiles ?? (u.multiple ? 10 : 1);
1543
1597
  if (x.length > S) {
1544
1598
  p.textContent = `Please select at most ${S} file(s).`, p.style.display = "block";
1545
1599
  return;
1546
1600
  }
1547
- const b = u.maxSizeBytes ?? 1 / 0, g = x.reduce((w, B) => w + B.size, 0);
1548
- if (x.some((w) => w.size > b)) {
1601
+ const b = u.maxSizeBytes ?? 1 / 0, g = x.reduce((v, B) => v + B.size, 0);
1602
+ if (x.some((v) => v.size > b)) {
1549
1603
  p.textContent = `One or more files exceed the maximum size of ${Math.round(b / 1024)} KB.`, p.style.display = "block";
1550
1604
  return;
1551
1605
  }
@@ -1555,54 +1609,54 @@ class zt {
1555
1609
  return;
1556
1610
  }
1557
1611
  if (u.accept && Array.isArray(u.accept)) {
1558
- const w = u.accept;
1559
- if (!x.every((W) => W.type ? w.some((U) => U.startsWith(".") ? W.name.toLowerCase().endsWith(U.toLowerCase()) : W.type === U || W.type.startsWith(U.split("/")[0] + "/")) : !0)) {
1612
+ const v = u.accept;
1613
+ if (!x.every((U) => U.type ? v.some((W) => W.startsWith(".") ? U.name.toLowerCase().endsWith(W.toLowerCase()) : U.type === W || U.type.startsWith(W.split("/")[0] + "/")) : !0)) {
1560
1614
  p.textContent = "One or more files have an unsupported type.", p.style.display = "block";
1561
1615
  return;
1562
1616
  }
1563
1617
  }
1564
- }), h = v;
1618
+ }), m = w;
1565
1619
  } else {
1566
1620
  const u = document.createElement("input");
1567
- u.className = "foisit-form-input", d.type === "string" && (u.placeholder = d.placeholder || "Type here..."), d.type === "number" ? (u.type = "number", typeof d.min == "number" && (u.min = String(d.min)), typeof d.max == "number" && (u.max = String(d.max)), typeof d.step == "number" && (u.step = String(d.step)), d.defaultValue != null && (u.value = String(d.defaultValue))) : d.type === "date" ? (u.type = "date", typeof d.min == "string" && (u.min = d.min), typeof d.max == "string" && (u.max = d.max), d.defaultValue != null && (u.value = String(d.defaultValue))) : (u.type = "text", d.defaultValue != null && (u.value = String(d.defaultValue))), h = u;
1621
+ u.className = "foisit-form-input", d.type === "string" && (u.placeholder = d.placeholder || "Type here..."), d.type === "number" ? (u.type = "number", typeof d.min == "number" && (u.min = String(d.min)), typeof d.max == "number" && (u.max = String(d.max)), typeof d.step == "number" && (u.step = String(d.step)), d.defaultValue != null && (u.value = String(d.defaultValue))) : d.type === "date" ? (u.type = "date", typeof d.min == "string" && (u.min = d.min), typeof d.max == "string" && (u.max = d.max), d.defaultValue != null && (u.value = String(d.defaultValue))) : (u.type = "text", d.defaultValue != null && (u.value = String(d.defaultValue))), m = u;
1568
1622
  }
1569
1623
  const y = a();
1570
- l.appendChild(h), l.appendChild(y), o.push({
1624
+ l.appendChild(m), l.appendChild(y), o.push({
1571
1625
  name: d.name,
1572
1626
  type: d.type,
1573
- el: h,
1627
+ el: m,
1574
1628
  required: d.required
1575
1629
  }), s.appendChild(l);
1576
1630
  });
1577
1631
  const c = document.createElement("div");
1578
1632
  c.className = "foisit-form-actions";
1579
- const m = document.createElement("button");
1580
- m.type = "submit", m.textContent = "Submit", m.className = "foisit-option-chip", m.style.fontWeight = "600", c.appendChild(m), s.appendChild(c), s.onsubmit = async (d) => {
1633
+ const h = document.createElement("button");
1634
+ h.type = "submit", h.textContent = "Submit", h.className = "foisit-option-chip", h.style.fontWeight = "600", c.appendChild(h), s.appendChild(c), s.onsubmit = async (d) => {
1581
1635
  d.preventDefault();
1582
1636
  const l = {};
1583
1637
  let f = !1;
1584
- s.querySelectorAll(".foisit-form-error").forEach((h) => {
1585
- h.style.display = "none", h.textContent = "";
1586
- }), s.querySelectorAll(".foisit-form-input").forEach((h) => {
1587
- h.classList.remove("foisit-error-border");
1638
+ s.querySelectorAll(".foisit-form-error").forEach((m) => {
1639
+ m.style.display = "none", m.textContent = "";
1640
+ }), s.querySelectorAll(".foisit-form-input").forEach((m) => {
1641
+ m.classList.remove("foisit-error-border");
1588
1642
  });
1589
- for (const h of o) {
1590
- if (h.type === "file") {
1591
- const x = h.el.parentElement, p = x == null ? void 0 : x.querySelector(".foisit-form-error"), S = h.el, b = Array.from(S.files || []);
1592
- if (h.required && b.length === 0) {
1643
+ for (const m of o) {
1644
+ if (m.type === "file") {
1645
+ const x = m.el.parentElement, p = x == null ? void 0 : x.querySelector(".foisit-form-error"), S = m.el, b = Array.from(S.files || []);
1646
+ if (m.required && b.length === 0) {
1593
1647
  f = !0, S.classList.add("foisit-error-border"), p && (p.textContent = "This file is required", p.style.display = "block");
1594
1648
  continue;
1595
1649
  }
1596
1650
  if (b.length === 0) continue;
1597
- const g = (i ?? []).find((w) => w.name === h.name), $ = (g == null ? void 0 : g.delivery) ?? "file";
1651
+ const g = (n ?? []).find((v) => v.name === m.name), $ = (g == null ? void 0 : g.delivery) ?? "file";
1598
1652
  if (g != null && g.maxWidth || g != null && g.maxHeight)
1599
1653
  try {
1600
- const w = await this.getImageDimensions(b[0]);
1601
- if (g.maxWidth && w.width > g.maxWidth) {
1654
+ const v = await this.getImageDimensions(b[0]);
1655
+ if (g.maxWidth && v.width > g.maxWidth) {
1602
1656
  f = !0, p && (p.textContent = `Image width must be ≤ ${g.maxWidth}px`, p.style.display = "block");
1603
1657
  continue;
1604
1658
  }
1605
- if (g.maxHeight && w.height > g.maxHeight) {
1659
+ if (g.maxHeight && v.height > g.maxHeight) {
1606
1660
  f = !0, p && (p.textContent = `Image height must be ≤ ${g.maxHeight}px`, p.style.display = "block");
1607
1661
  continue;
1608
1662
  }
@@ -1610,52 +1664,52 @@ class zt {
1610
1664
  }
1611
1665
  if (g != null && g.maxDurationSec)
1612
1666
  try {
1613
- const w = await this.getMediaDuration(b[0]);
1614
- if (w && w > g.maxDurationSec) {
1667
+ const v = await this.getMediaDuration(b[0]);
1668
+ if (v && v > g.maxDurationSec) {
1615
1669
  f = !0, p && (p.textContent = `Media duration must be ≤ ${g.maxDurationSec}s`, p.style.display = "block");
1616
1670
  continue;
1617
1671
  }
1618
1672
  } catch {
1619
1673
  }
1620
1674
  if ($ === "file")
1621
- l[h.name] = g != null && g.multiple ? b : b[0];
1675
+ l[m.name] = g != null && g.multiple ? b : b[0];
1622
1676
  else if ($ === "base64")
1623
1677
  try {
1624
- const w = await Promise.all(b.map((B) => this.readFileAsDataURL(B)));
1625
- l[h.name] = g != null && g.multiple ? w : w[0];
1678
+ const v = await Promise.all(b.map((B) => this.readFileAsDataURL(B)));
1679
+ l[m.name] = g != null && g.multiple ? v : v[0];
1626
1680
  } catch {
1627
1681
  f = !0, p && (p.textContent = "Failed to encode file(s) to base64.", p.style.display = "block");
1628
1682
  continue;
1629
1683
  }
1630
1684
  continue;
1631
1685
  }
1632
- const y = (h.el.value ?? "").toString().trim(), u = h.el.parentElement, v = u == null ? void 0 : u.querySelector(".foisit-form-error");
1633
- if (h.required && (y == null || y === "")) {
1634
- f = !0, h.el.classList.add("foisit-error-border"), v && (v.textContent = "This field is required", v.style.display = "block");
1686
+ const y = (m.el.value ?? "").toString().trim(), u = m.el.parentElement, w = u == null ? void 0 : u.querySelector(".foisit-form-error");
1687
+ if (m.required && (y == null || y === "")) {
1688
+ f = !0, m.el.classList.add("foisit-error-border"), w && (w.textContent = "This field is required", w.style.display = "block");
1635
1689
  continue;
1636
1690
  }
1637
1691
  if (y !== "")
1638
- if (h.type === "number") {
1692
+ if (m.type === "number") {
1639
1693
  const x = Number(y);
1640
- Number.isNaN(x) || (l[h.name] = x);
1694
+ Number.isNaN(x) || (l[m.name] = x);
1641
1695
  } else
1642
- l[h.name] = y;
1696
+ l[m.name] = y;
1643
1697
  }
1644
1698
  if (f) {
1645
1699
  s.classList.add("foisit-shake"), setTimeout(() => s.classList.remove("foisit-shake"), 400);
1646
1700
  return;
1647
1701
  }
1648
- m.disabled = !0, m.style.opacity = "0.6", o.forEach((h) => {
1649
- h.el.disabled = !0;
1650
- }), n(l);
1702
+ h.disabled = !0, h.style.opacity = "0.6", o.forEach((m) => {
1703
+ m.el.disabled = !0;
1704
+ }), i(l);
1651
1705
  }, this.messagesContainer.appendChild(s), this.scrollToBottom();
1652
1706
  }
1653
1707
  showLoading() {
1654
1708
  if (this.messagesContainer && !this.loadingEl) {
1655
1709
  this.loadingEl = document.createElement("div"), this.loadingEl.className = "foisit-loading-dots foisit-bubble system";
1656
1710
  for (let e = 0; e < 3; e++) {
1657
- const i = document.createElement("div");
1658
- i.className = "foisit-dot", i.style.animation = `foisitPulse 1.4s infinite ease-in-out ${e * 0.2}s`, this.loadingEl.appendChild(i);
1711
+ const n = document.createElement("div");
1712
+ n.className = "foisit-dot", n.style.animation = `foisitPulse 1.4s infinite ease-in-out ${e * 0.2}s`, this.loadingEl.appendChild(n);
1659
1713
  }
1660
1714
  this.messagesContainer.appendChild(this.loadingEl), this.scrollToBottom();
1661
1715
  }
@@ -1672,44 +1726,44 @@ class zt {
1672
1726
  (e = this.container) == null || e.remove(), this.container = null, this.chatWindow = null, this.messagesContainer = null, this.input = null, this.isOpen = !1;
1673
1727
  }
1674
1728
  readFileAsDataURL(e) {
1675
- return new Promise((i, n) => {
1729
+ return new Promise((n, i) => {
1676
1730
  const s = new FileReader();
1677
- s.onerror = () => n(new Error("Failed to read file")), s.onload = () => i(String(s.result)), s.readAsDataURL(e);
1731
+ s.onerror = () => i(new Error("Failed to read file")), s.onload = () => n(String(s.result)), s.readAsDataURL(e);
1678
1732
  });
1679
1733
  }
1680
1734
  getImageDimensions(e) {
1681
- return new Promise((i) => {
1735
+ return new Promise((n) => {
1682
1736
  try {
1683
- const n = URL.createObjectURL(e), s = new Image();
1737
+ const i = URL.createObjectURL(e), s = new Image();
1684
1738
  s.onload = () => {
1685
1739
  const o = { width: s.naturalWidth || s.width, height: s.naturalHeight || s.height };
1686
- URL.revokeObjectURL(n), i(o);
1740
+ URL.revokeObjectURL(i), n(o);
1687
1741
  }, s.onerror = () => {
1688
- URL.revokeObjectURL(n), i({ width: 0, height: 0 });
1689
- }, s.src = n;
1742
+ URL.revokeObjectURL(i), n({ width: 0, height: 0 });
1743
+ }, s.src = i;
1690
1744
  } catch {
1691
- i({ width: 0, height: 0 });
1745
+ n({ width: 0, height: 0 });
1692
1746
  }
1693
1747
  });
1694
1748
  }
1695
1749
  getMediaDuration(e) {
1696
- return new Promise((i) => {
1750
+ return new Promise((n) => {
1697
1751
  try {
1698
- const n = URL.createObjectURL(e), s = e.type.startsWith("audio") ? document.createElement("audio") : document.createElement("video");
1752
+ const i = URL.createObjectURL(e), s = e.type.startsWith("audio") ? document.createElement("audio") : document.createElement("video");
1699
1753
  let o = !1;
1700
1754
  const r = setTimeout(() => {
1701
- o || (o = !0, URL.revokeObjectURL(n), i(0));
1755
+ o || (o = !0, URL.revokeObjectURL(i), n(0));
1702
1756
  }, 5e3);
1703
1757
  s.preload = "metadata", s.onloadedmetadata = () => {
1704
1758
  if (o) return;
1705
1759
  o = !0, clearTimeout(r);
1706
1760
  const c = s.duration || 0;
1707
- URL.revokeObjectURL(n), i(c);
1761
+ URL.revokeObjectURL(i), n(c);
1708
1762
  }, s.onerror = () => {
1709
- o || (o = !0, clearTimeout(r), URL.revokeObjectURL(n), i(0));
1710
- }, s.src = n;
1763
+ o || (o = !0, clearTimeout(r), URL.revokeObjectURL(i), n(0));
1764
+ }, s.src = i;
1711
1765
  } catch {
1712
- i(0);
1766
+ n(0);
1713
1767
  }
1714
1768
  });
1715
1769
  }
@@ -2040,23 +2094,23 @@ class zt {
2040
2094
  `, document.head.appendChild(e);
2041
2095
  }
2042
2096
  }
2043
- class Bt {
2097
+ class Ut {
2044
2098
  constructor(e) {
2045
2099
  this.config = e, this.isActivated = !1, this.lastProcessedInput = "", this.processingLock = !1, this.defaultIntroMessage = "How can I help you?", this.commandHandler = new Mt({
2046
2100
  enableSmartIntent: this.config.enableSmartIntent !== !1,
2047
2101
  intentEndpoint: this.config.intentEndpoint
2048
- }), this.fallbackHandler = new Vt(), this.voiceProcessor = new Pt(), this.textToSpeech = new He(), this.stateManager = new qt(), this.gestureHandler = new Ft(), this.overlayManager = new zt({
2102
+ }), this.fallbackHandler = new Pt(), this.voiceProcessor = new Vt(), this.textToSpeech = new He(), this.stateManager = new zt(), this.gestureHandler = new Ft(), this.overlayManager = new Bt({
2049
2103
  floatingButton: this.config.floatingButton,
2050
2104
  inputPlaceholder: this.config.inputPlaceholder
2051
- }), this.config.commands.forEach((i) => this.commandHandler.addCommand(i)), this.config.fallbackResponse && this.fallbackHandler.setFallbackMessage(this.config.fallbackResponse), this.gestureHandler.setupDoubleTapListener(() => this.toggle()), this.overlayManager.registerCallbacks(
2052
- async (i) => {
2053
- if (typeof i == "string")
2054
- this.overlayManager.addMessage(i, "user");
2055
- else if (i && typeof i == "object") {
2056
- const n = this.extractUserLabel(i);
2057
- n && this.overlayManager.addMessage(n, "user");
2105
+ }), this.config.commands.forEach((n) => this.commandHandler.addCommand(n)), this.config.fallbackResponse && this.fallbackHandler.setFallbackMessage(this.config.fallbackResponse), this.gestureHandler.setupDoubleTapListener(() => this.toggle()), this.overlayManager.registerCallbacks(
2106
+ async (n) => {
2107
+ if (typeof n == "string")
2108
+ this.overlayManager.addMessage(n, "user");
2109
+ else if (n && typeof n == "object") {
2110
+ const i = this.extractUserLabel(n);
2111
+ i && this.overlayManager.addMessage(i, "user");
2058
2112
  }
2059
- await this.handleCommand(i);
2113
+ await this.handleCommand(n);
2060
2114
  },
2061
2115
  () => console.log("AssistantService: Overlay closed.")
2062
2116
  );
@@ -2079,30 +2133,30 @@ class Bt {
2079
2133
  }
2080
2134
  /** Process activation command */
2081
2135
  async processActivation(e) {
2082
- var n;
2083
- const i = (n = this.config.activationCommand) == null ? void 0 : n.toLowerCase();
2084
- i && (e === i ? (console.log("AssistantService: Activation matched."), this.isActivated = !0, this.textToSpeech.speak(
2136
+ var i;
2137
+ const n = (i = this.config.activationCommand) == null ? void 0 : i.toLowerCase();
2138
+ n && (e === n ? (console.log("AssistantService: Activation matched."), this.isActivated = !0, this.textToSpeech.speak(
2085
2139
  this.config.introMessage || this.defaultIntroMessage
2086
2140
  )) : console.log("AssistantService: Activation command not recognized."));
2087
2141
  }
2088
2142
  /** Handle recognized commands */
2089
2143
  async handleCommand(e) {
2090
2144
  this.overlayManager.showLoading();
2091
- let i;
2145
+ let n;
2092
2146
  try {
2093
- i = await this.commandHandler.executeCommand(e);
2147
+ n = await this.commandHandler.executeCommand(e);
2094
2148
  } finally {
2095
2149
  this.overlayManager.hideLoading();
2096
2150
  }
2097
- if (i.type === "form" && i.fields) {
2151
+ if (n.type === "form" && n.fields) {
2098
2152
  this.overlayManager.addForm(
2099
- i.message,
2100
- i.fields,
2101
- async (n) => {
2153
+ n.message,
2154
+ n.fields,
2155
+ async (i) => {
2102
2156
  this.overlayManager.showLoading();
2103
2157
  let s;
2104
2158
  try {
2105
- s = await this.commandHandler.executeCommand(n);
2159
+ s = await this.commandHandler.executeCommand(i);
2106
2160
  } finally {
2107
2161
  this.overlayManager.hideLoading();
2108
2162
  }
@@ -2111,12 +2165,16 @@ class Bt {
2111
2165
  );
2112
2166
  return;
2113
2167
  }
2114
- if (i.type === "error") {
2115
- const n = typeof e == "string" ? e : "";
2116
- n ? (this.fallbackHandler.handleFallback(n), this.overlayManager.addMessage(this.fallbackHandler.getFallbackMessage(), "system")) : i.message && this.overlayManager.addMessage(i.message, "system");
2168
+ if (n.type === "error") {
2169
+ const i = typeof e == "string" ? e : "";
2170
+ i ? (this.fallbackHandler.handleFallback(i), this.overlayManager.addMessage(this.fallbackHandler.getFallbackMessage(), "system")) : n.message && this.overlayManager.addMessage(n.message, "system");
2171
+ return;
2172
+ }
2173
+ if ((n.type === "ambiguous" || n.type === "confirm") && n.options) {
2174
+ n.message && this.overlayManager.addMessage(n.message, "system"), this.overlayManager.addOptions(n.options);
2117
2175
  return;
2118
2176
  }
2119
- i.message ? this.overlayManager.addMessage(i.message, "system") : (i.type === "ambiguous" || i.type === "confirm") && i.options && this.overlayManager.addOptions(i.options);
2177
+ n.message && this.overlayManager.addMessage(n.message, "system");
2120
2178
  }
2121
2179
  /**
2122
2180
  * Cleanup resources
@@ -2130,15 +2188,15 @@ class Bt {
2130
2188
  this.overlayManager.addForm(
2131
2189
  e.message,
2132
2190
  e.fields,
2133
- async (i) => {
2191
+ async (n) => {
2134
2192
  this.overlayManager.showLoading();
2135
- let n;
2193
+ let i;
2136
2194
  try {
2137
- n = await this.commandHandler.executeCommand(i);
2195
+ i = await this.commandHandler.executeCommand(n);
2138
2196
  } finally {
2139
2197
  this.overlayManager.hideLoading();
2140
2198
  }
2141
- this.processResponse(n);
2199
+ this.processResponse(i);
2142
2200
  }
2143
2201
  );
2144
2202
  return;
@@ -2150,8 +2208,8 @@ class Bt {
2150
2208
  e.message && this.overlayManager.addMessage(e.message, "system");
2151
2209
  }
2152
2210
  /** Add a command dynamically (supports string or rich object) */
2153
- addCommand(e, i) {
2154
- console.log(typeof e == "string" ? `AssistantService: Adding command "${e}".` : `AssistantService: Adding rich command "${e.command}".`), this.commandHandler.addCommand(e, i);
2211
+ addCommand(e, n) {
2212
+ console.log(typeof e == "string" ? `AssistantService: Adding command "${e}".` : `AssistantService: Adding rich command "${e.command}".`), this.commandHandler.addCommand(e, n);
2155
2213
  }
2156
2214
  /** Remove a command dynamically */
2157
2215
  removeCommand(e) {
@@ -2162,30 +2220,30 @@ class Bt {
2162
2220
  return this.commandHandler.getCommands();
2163
2221
  }
2164
2222
  /** Toggle the assistant overlay */
2165
- toggle(e, i) {
2223
+ toggle(e, n) {
2166
2224
  console.log("AssistantService: Toggling overlay..."), this.overlayManager.toggle(
2167
- async (n) => {
2168
- if (typeof n == "string")
2169
- this.overlayManager.addMessage(n, "user");
2170
- else if (n && typeof n == "object") {
2171
- const s = this.extractUserLabel(n);
2225
+ async (i) => {
2226
+ if (typeof i == "string")
2227
+ this.overlayManager.addMessage(i, "user");
2228
+ else if (i && typeof i == "object") {
2229
+ const s = this.extractUserLabel(i);
2172
2230
  s && this.overlayManager.addMessage(s, "user");
2173
2231
  }
2174
- e && e(n), await this.handleCommand(n);
2232
+ e && e(i), await this.handleCommand(i);
2175
2233
  },
2176
2234
  () => {
2177
- console.log("AssistantService: Overlay closed."), i && i();
2235
+ console.log("AssistantService: Overlay closed."), n && n();
2178
2236
  }
2179
2237
  );
2180
2238
  }
2181
2239
  extractUserLabel(e) {
2182
- const i = e.label;
2183
- if (typeof i == "string" && i.trim()) return i.trim();
2184
- const n = e.commandId;
2185
- return typeof n == "string" && n.trim() ? n.trim() : null;
2240
+ const n = e.label;
2241
+ if (typeof n == "string" && n.trim()) return n.trim();
2242
+ const i = e.commandId;
2243
+ return typeof i == "string" && i.trim() ? i.trim() : null;
2186
2244
  }
2187
2245
  }
2188
- const Wt = /* @__PURE__ */ ht({
2246
+ const Wt = /* @__PURE__ */ mt({
2189
2247
  name: "AssistantProvider",
2190
2248
  props: {
2191
2249
  config: {
@@ -2194,29 +2252,29 @@ const Wt = /* @__PURE__ */ ht({
2194
2252
  }
2195
2253
  },
2196
2254
  setup(t, { slots: e }) {
2197
- const i = new Bt(t.config);
2198
- return dt("assistantService", i), () => {
2199
- var n;
2200
- return (n = e.default) == null ? void 0 : n.call(e);
2255
+ const n = new Ut(t.config);
2256
+ return dt("assistantService", n), () => {
2257
+ var i;
2258
+ return (i = e.default) == null ? void 0 : i.call(e);
2201
2259
  };
2202
2260
  }
2203
- }), Ut = (t, e) => {
2204
- const i = t.__vccOpts || t;
2205
- for (const [n, s] of e)
2206
- i[n] = s;
2207
- return i;
2261
+ }), jt = (t, e) => {
2262
+ const n = t.__vccOpts || t;
2263
+ for (const [i, s] of e)
2264
+ n[i] = s;
2265
+ return n;
2208
2266
  };
2209
- function jt(t, e, i, n, s, o) {
2267
+ function Kt(t, e, n, i, s, o) {
2210
2268
  return gt(t.$slots, "default");
2211
2269
  }
2212
- const Kt = /* @__PURE__ */ Ut(Wt, [["render", jt]]), Yt = () => {
2270
+ const Yt = /* @__PURE__ */ jt(Wt, [["render", Kt]]), Jt = () => {
2213
2271
  const t = ut("assistantService");
2214
2272
  if (!t)
2215
2273
  throw new Error("useAssistant must be used within an AssistantProvider");
2216
2274
  return t;
2217
2275
  };
2218
2276
  export {
2219
- Kt as AssistantProvider,
2220
- Bt as AssistantService,
2221
- Yt as useAssistant
2277
+ Yt as AssistantProvider,
2278
+ Ut as AssistantService,
2279
+ Jt as useAssistant
2222
2280
  };