@vanira/sdk 0.0.83 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var vr = Object.defineProperty;
2
- var yr = (n, e, t) => e in n ? vr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var _ = (n, e, t) => yr(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { forwardRef as gr, useRef as oe, useEffect as be, useCallback as Re, useImperativeHandle as br } from "react";
5
- const wr = "https://api.vanira.io", m = {
1
+ var Cr = Object.defineProperty;
2
+ var kr = (n, e, t) => e in n ? Cr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var _ = (n, e, t) => kr(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { forwardRef as Er, useRef as oe, useEffect as be, useCallback as Fe, useImperativeHandle as Tr } from "react";
5
+ const Ar = "https://api.vanira.io", m = {
6
6
  Form: "vanira_form",
7
7
  Calendar: "vanira_calendar",
8
8
  Navigate: "vanira_navigate",
@@ -30,11 +30,11 @@ const wr = "https://api.vanira.io", m = {
30
30
  PointAt: "vanira_point_at",
31
31
  OutlineTargets: "vanira_outline_targets",
32
32
  ClearGuide: "vanira_clear_guide"
33
- }, _r = Object.values(m), xr = new Set(_r), Sr = /* @__PURE__ */ new Set([
33
+ }, Ir = Object.values(m), Lr = new Set(Ir), Pr = /* @__PURE__ */ new Set([
34
34
  m.Camera,
35
35
  m.LiveVision,
36
36
  m.LiveScreen
37
- ]), Cr = /* @__PURE__ */ new Set([
37
+ ]), Mr = /* @__PURE__ */ new Set([
38
38
  m.Navigate,
39
39
  m.HighlightElement,
40
40
  m.ClickElement,
@@ -57,38 +57,38 @@ const wr = "https://api.vanira.io", m = {
57
57
  m.PointAt,
58
58
  m.OutlineTargets,
59
59
  m.ClearGuide
60
- ]), kr = /* @__PURE__ */ new Set([
60
+ ]), Nr = /* @__PURE__ */ new Set([
61
61
  m.TypeText,
62
62
  m.EraseText,
63
63
  m.Draw,
64
64
  m.EraseDraw
65
65
  ]);
66
66
  function W(n) {
67
- return !!n && xr.has(n);
67
+ return !!n && Lr.has(n);
68
68
  }
69
- function Er(n) {
70
- return W(n) && Cr.has(n);
69
+ function Dr(n) {
70
+ return W(n) && Mr.has(n);
71
71
  }
72
- function pt(n) {
73
- return W(n) && kr.has(n);
72
+ function vt(n) {
73
+ return W(n) && Nr.has(n);
74
74
  }
75
- function Ye(n) {
76
- return W(n) && Sr.has(n);
75
+ function Je(n) {
76
+ return W(n) && Pr.has(n);
77
77
  }
78
- const Tr = /* @__PURE__ */ new Set([
78
+ const Br = /* @__PURE__ */ new Set([
79
79
  m.Form,
80
80
  m.Calendar
81
81
  ]);
82
- function Ge(n) {
83
- return W(n) && Tr.has(n);
82
+ function Qe(n) {
83
+ return W(n) && Br.has(n);
84
84
  }
85
- function ft(n, e, t) {
85
+ function yt(n, e, t) {
86
86
  return t != null && t.action_name ? String(t.action_name) : n === m.Calendar ? "calendar_slot_selected" : `user_submitted_${e || "collect_user_data"}`;
87
87
  }
88
- function mt(n) {
89
- return W(n) && !Ye(n) && !Ge(n);
88
+ function gt(n) {
89
+ return W(n) && !Je(n) && !Qe(n);
90
90
  }
91
- const zt = /* @__PURE__ */ new Set([
91
+ const Yt = /* @__PURE__ */ new Set([
92
92
  m.ScreenInk,
93
93
  m.ScreenCursor,
94
94
  m.ScreenClick,
@@ -96,18 +96,18 @@ const zt = /* @__PURE__ */ new Set([
96
96
  m.PointAt,
97
97
  m.OutlineTargets,
98
98
  m.ClearGuide
99
- ]), Ar = /* @__PURE__ */ new Set([
100
- ...zt,
99
+ ]), $r = /* @__PURE__ */ new Set([
100
+ ...Yt,
101
101
  m.PageScan,
102
102
  m.TabScreenshot
103
103
  ]);
104
- function Ir(n) {
105
- return W(n) && zt.has(n);
104
+ function Rr(n) {
105
+ return W(n) && Yt.has(n);
106
106
  }
107
- function Lr(n) {
108
- return W(n) && Ar.has(n);
107
+ function Ur(n) {
108
+ return W(n) && $r.has(n);
109
109
  }
110
- function Vt(n) {
110
+ function Gt(n) {
111
111
  if (typeof n == "string")
112
112
  try {
113
113
  return JSON.parse(n);
@@ -116,7 +116,7 @@ function Vt(n) {
116
116
  }
117
117
  return n && typeof n == "object" ? n : {};
118
118
  }
119
- const vt = {
119
+ const bt = {
120
120
  type_on_whiteboard: m.TypeText,
121
121
  write_on_whiteboard: m.TypeText,
122
122
  write_on_white_board: m.TypeText,
@@ -146,42 +146,42 @@ const vt = {
146
146
  outline_elements: m.OutlineTargets,
147
147
  clear_guide: m.ClearGuide
148
148
  };
149
- function yt(n, e) {
149
+ function wt(n, e) {
150
150
  const t = n.text_to_type ?? (e == null ? void 0 : e.text_to_type) ?? n.text ?? (e == null ? void 0 : e.text) ?? n.value ?? (e == null ? void 0 : e.value);
151
151
  return typeof t == "string" && t.trim().length > 0;
152
152
  }
153
- function Pr(n, e) {
153
+ function Fr(n, e) {
154
154
  const t = n.fields ?? (e == null ? void 0 : e.fields);
155
155
  return Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.split(",").map((r) => r.trim()).filter(Boolean).length > 0 : !1;
156
156
  }
157
- function Mr(n, e) {
157
+ function Or(n, e) {
158
158
  const t = n == null ? void 0 : n.preset_id;
159
159
  if (typeof t == "string" && W(t))
160
160
  return t;
161
- const s = Vt(e).preset_id;
161
+ const s = Gt(e).preset_id;
162
162
  if (typeof s == "string" && W(s))
163
163
  return s;
164
164
  }
165
- function at(n, e, t) {
166
- const r = Vt(e);
167
- let s = Mr(n, r);
168
- if (s === m.Form && yt(r, n) && !Pr(r, n))
165
+ function dt(n, e, t) {
166
+ const r = Gt(e);
167
+ let s = Or(n, r);
168
+ if (s === m.Form && wt(r, n) && !Fr(r, n))
169
169
  return m.TypeText;
170
170
  if (s) return s;
171
171
  const i = String(t ?? "").trim().toLowerCase();
172
- if (i && vt[i])
173
- return vt[i];
174
- if (yt(r, n))
172
+ if (i && bt[i])
173
+ return bt[i];
174
+ if (wt(r, n))
175
175
  return m.TypeText;
176
176
  }
177
- const Te = "vanira_latest_call_id", Je = "vanira_prospect_id";
178
- function Ae(n) {
177
+ const Ie = "vanira_latest_call_id", Ke = "vanira_prospect_id";
178
+ function Le(n) {
179
179
  return `vanira_latest_call_id_${n}`;
180
180
  }
181
- function Ie(n) {
181
+ function Pe(n) {
182
182
  return `vanira_prospect_id_${n}`;
183
183
  }
184
- function qt(n) {
184
+ function Jt(n) {
185
185
  return `vanira_call_meta_${n}`;
186
186
  }
187
187
  function J(n, e) {
@@ -192,9 +192,9 @@ function J(n, e) {
192
192
  return null;
193
193
  }
194
194
  }
195
- function Qe(n) {
195
+ function Ze(n) {
196
196
  if (typeof window > "u" || !n) return null;
197
- const e = [], t = J(window.localStorage, qt(n));
197
+ const e = [], t = J(window.localStorage, Jt(n));
198
198
  if (t)
199
199
  try {
200
200
  const a = JSON.parse(t);
@@ -211,18 +211,18 @@ function Qe(n) {
211
211
  prospectId: l || void 0,
212
212
  updatedAt: c
213
213
  });
214
- }, s = J(window.localStorage, Ie(n)), i = J(window.sessionStorage, Ie(n)), o = J(window.localStorage, Je);
214
+ }, s = J(window.localStorage, Pe(n)), i = J(window.sessionStorage, Pe(n)), o = J(window.localStorage, Ke);
215
215
  return r(
216
- J(window.localStorage, Ae(n)),
216
+ J(window.localStorage, Le(n)),
217
217
  s || o,
218
218
  2
219
219
  ), r(
220
- J(window.sessionStorage, Ae(n)),
220
+ J(window.sessionStorage, Le(n)),
221
221
  i || o,
222
222
  1
223
- ), r(J(window.localStorage, Te), o, 0), r(J(window.sessionStorage, Te), o, 0), e.length ? (e.sort((a, l) => l.updatedAt - a.updatedAt), e[0]) : null;
223
+ ), r(J(window.localStorage, Ie), o, 0), r(J(window.sessionStorage, Ie), o, 0), e.length ? (e.sort((a, l) => l.updatedAt - a.updatedAt), e[0]) : null;
224
224
  }
225
- function Nr(n, e, t) {
225
+ function Vr(n, e, t) {
226
226
  var s, i, o, a, l, c, u, d, p;
227
227
  if (typeof window > "u" || !n || !e) return;
228
228
  const r = {
@@ -231,50 +231,50 @@ function Nr(n, e, t) {
231
231
  updatedAt: Date.now()
232
232
  };
233
233
  try {
234
- (s = window.localStorage) == null || s.setItem(qt(n), JSON.stringify(r)), (i = window.localStorage) == null || i.setItem(Ae(n), e), (o = window.sessionStorage) == null || o.setItem(Ae(n), e), t && ((a = window.localStorage) == null || a.setItem(Ie(n), t), (l = window.sessionStorage) == null || l.setItem(Ie(n), t)), (c = window.localStorage) == null || c.setItem(Te, e), (u = window.sessionStorage) == null || u.setItem(Te, e), t && ((d = window.localStorage) == null || d.setItem(Je, t), (p = window.sessionStorage) == null || p.setItem(Je, t));
234
+ (s = window.localStorage) == null || s.setItem(Jt(n), JSON.stringify(r)), (i = window.localStorage) == null || i.setItem(Le(n), e), (o = window.sessionStorage) == null || o.setItem(Le(n), e), t && ((a = window.localStorage) == null || a.setItem(Pe(n), t), (l = window.sessionStorage) == null || l.setItem(Pe(n), t)), (c = window.localStorage) == null || c.setItem(Ie, e), (u = window.sessionStorage) == null || u.setItem(Ie, e), t && ((d = window.localStorage) == null || d.setItem(Ke, t), (p = window.sessionStorage) == null || p.setItem(Ke, t));
235
235
  } catch {
236
236
  }
237
237
  }
238
- function Ds(n) {
238
+ function zs(n) {
239
239
  var e;
240
- return !!((e = Qe(n)) != null && e.callId);
240
+ return !!((e = Ze(n)) != null && e.callId);
241
241
  }
242
- const Dr = /* @__PURE__ */ new Set([
242
+ const zr = /* @__PURE__ */ new Set([
243
243
  "client_tool_call",
244
244
  "clearAudio",
245
245
  "client_tool_cancel"
246
246
  ]);
247
- function Ht(n) {
247
+ function Qt(n) {
248
248
  if (!n || typeof n != "object") return !1;
249
249
  const e = n.event;
250
- return typeof e == "string" && Dr.has(e);
250
+ return typeof e == "string" && zr.has(e);
251
251
  }
252
- const Ue = 16 * 1024, Br = 256 * 1024;
253
- function Oe(n, e) {
252
+ const Oe = 16 * 1024, qr = 256 * 1024;
253
+ function Ve(n, e) {
254
254
  return (n == null ? void 0 : n.readyState) === "open" && (e == null ? void 0 : e.readyState) === "open";
255
255
  }
256
- function $r(n, e) {
256
+ function Hr(n, e) {
257
257
  return {
258
258
  control: (n == null ? void 0 : n.readyState) ?? "missing",
259
259
  mediaBytes: (e == null ? void 0 : e.readyState) ?? "missing"
260
260
  };
261
261
  }
262
- async function Rr(n, e, t = 8e3) {
263
- if (Oe(n, e))
262
+ async function jr(n, e, t = 8e3) {
263
+ if (Ve(n, e))
264
264
  return !0;
265
265
  const r = Date.now() + t;
266
266
  for (; Date.now() < r; ) {
267
- if (Oe(n, e))
267
+ if (Ve(n, e))
268
268
  return !0;
269
269
  await new Promise((s) => setTimeout(s, 50));
270
270
  }
271
- return Oe(n, e);
271
+ return Ve(n, e);
272
272
  }
273
- async function gt(n) {
274
- for (; n.bufferedAmount > Br; )
273
+ async function _t(n) {
274
+ for (; n.bufferedAmount > qr; )
275
275
  await new Promise((e) => setTimeout(e, 10));
276
276
  }
277
- async function Ur(n) {
277
+ async function Wr(n) {
278
278
  const {
279
279
  bytes: e,
280
280
  filename: t,
@@ -286,7 +286,7 @@ async function Ur(n) {
286
286
  sendControlEvent: l,
287
287
  uploadId: c = crypto.randomUUID(),
288
288
  uploadKind: u = "media"
289
- } = n, d = e.byteLength, p = d === 0 ? 0 : Math.ceil(d / Ue);
289
+ } = n, d = e.byteLength, p = d === 0 ? 0 : Math.ceil(d / Oe);
290
290
  l("client_media_upload_start", {
291
291
  data: {
292
292
  upload_id: c,
@@ -301,12 +301,12 @@ async function Ur(n) {
301
301
  }
302
302
  });
303
303
  const h = new Uint8Array(e);
304
- for (let f = 0; f < d; f += Ue) {
305
- await gt(a);
306
- const y = Math.min(f + Ue, d);
304
+ for (let f = 0; f < d; f += Oe) {
305
+ await _t(a);
306
+ const y = Math.min(f + Oe, d);
307
307
  a.send(h.subarray(f, y));
308
308
  }
309
- return await gt(a), l("client_media_upload_complete", {
309
+ return await _t(a), l("client_media_upload_complete", {
310
310
  data: {
311
311
  upload_id: c,
312
312
  call_id: o,
@@ -317,12 +317,12 @@ async function Ur(n) {
317
317
  }
318
318
  }), { media_id: c, url: "", content_type: r };
319
319
  }
320
- async function Or(n) {
320
+ async function Yr(n) {
321
321
  return typeof n.arrayBuffer == "function" ? n.arrayBuffer() : new Response(n).arrayBuffer();
322
322
  }
323
323
  let X = null;
324
- const Fr = 4e3;
325
- function jt(n) {
324
+ const Gr = 4e3;
325
+ function Kt(n) {
326
326
  if (typeof window > "u") return n || "/";
327
327
  const e = (n || "/").trim();
328
328
  if (!e) return "/";
@@ -333,19 +333,19 @@ function jt(n) {
333
333
  return e.startsWith("/") ? e : `/${e}`;
334
334
  }
335
335
  }
336
- function zr(n, e) {
336
+ function Jr(n, e) {
337
337
  X = {
338
- targetRoute: jt(n),
338
+ targetRoute: Kt(n),
339
339
  presetId: e == null ? void 0 : e.presetId,
340
340
  toolName: e == null ? void 0 : e.toolName,
341
- expiresAt: Date.now() + Fr
341
+ expiresAt: Date.now() + Gr
342
342
  };
343
343
  }
344
- function Vr(n) {
344
+ function Qr(n) {
345
345
  if (!X) return null;
346
346
  if (Date.now() > X.expiresAt)
347
347
  return X = null, null;
348
- const e = jt(n), t = X.targetRoute;
348
+ const e = Kt(n), t = X.targetRoute;
349
349
  if (!(e === t || e.startsWith(t.split("#")[0]) || t.startsWith(e.split("#")[0]))) return null;
350
350
  const s = X;
351
351
  return X = null, s;
@@ -353,7 +353,7 @@ function Vr(n) {
353
353
  function we() {
354
354
  return typeof window > "u" ? "/" : `${window.location.pathname}${window.location.search}${window.location.hash}` || "/";
355
355
  }
356
- class qr {
356
+ class Kr {
357
357
  constructor(e) {
358
358
  _(this, "active", !1);
359
359
  _(this, "initialSent", !1);
@@ -434,7 +434,7 @@ class qr {
434
434
  this.scheduleInitialContextSend();
435
435
  return;
436
436
  }
437
- !this.isReady() || Vr(e) || this.sendRouteContext("route_changed", r, t, "user");
437
+ !this.isReady() || Qr(e) || this.sendRouteContext("route_changed", r, t, "user");
438
438
  }
439
439
  sendRouteContext(e, t, r, s = "user") {
440
440
  const i = we();
@@ -500,17 +500,17 @@ const Y = class Y {
500
500
  throw new Error(
501
501
  "apiKey or token is required — or pass serverUrl and callId from a prior POST /calls/create"
502
502
  );
503
- this.agentId = e.agentId, this.sessionBehavior = e.sessionBehavior, this.serverUrl = (e.serverUrl || "").replace(/\/$/, ""), this.apiKey = e.apiKey, this.token = e.token, this.backendUrl = (e.backendUrl || wr).replace(/\/$/, ""), s.length && (this.iceServers = s), r && (this.callSessionLoaded = !0);
503
+ this.agentId = e.agentId, this.sessionBehavior = e.sessionBehavior, this.serverUrl = (e.serverUrl || "").replace(/\/$/, ""), this.apiKey = e.apiKey, this.token = e.token, this.backendUrl = (e.backendUrl || Ar).replace(/\/$/, ""), s.length && (this.iceServers = s), r && (this.callSessionLoaded = !0);
504
504
  const i = typeof window < "u";
505
505
  this.prospectId = e.prospectId;
506
506
  const o = e.sessionBehavior === "continue";
507
507
  if (o && i && !e.callId) {
508
- const l = Qe(this.agentId);
508
+ const l = Ze(this.agentId);
509
509
  l && (e.callId || (this.callId = l.callId), !this.prospectId && l.prospectId && (this.prospectId = l.prospectId));
510
510
  }
511
511
  if (!this.prospectId && i)
512
512
  try {
513
- const l = Qe(this.agentId);
513
+ const l = Ze(this.agentId);
514
514
  this.prospectId = (l == null ? void 0 : l.prospectId) || window.sessionStorage && window.sessionStorage.getItem("vanira_prospect_id") || window.localStorage && window.localStorage.getItem("vanira_prospect_id") || void 0;
515
515
  } catch {
516
516
  }
@@ -547,7 +547,7 @@ const Y = class Y {
547
547
  client_fields: c.client_fields || {}
548
548
  };
549
549
  u.name && u.tool_call_id && this.emit("tool_call", u);
550
- }, this.runtime = e.runtime, typeof window < "u" && e.trackRouteContext !== !1 && (this.routeTracker = new qr({
550
+ }, this.runtime = e.runtime, typeof window < "u" && e.trackRouteContext !== !1 && (this.routeTracker = new Kr({
551
551
  sendContext: (l) => this.sendContextUpdate(l),
552
552
  isReady: () => {
553
553
  var l;
@@ -640,7 +640,7 @@ const Y = class Y {
640
640
  const p = new TextDecoder().decode(d.data);
641
641
  try {
642
642
  const h = JSON.parse(p);
643
- Ht(h) && this.handleControlEvent(h);
643
+ Qt(h) && this.handleControlEvent(h);
644
644
  } catch {
645
645
  }
646
646
  } catch {
@@ -744,7 +744,7 @@ const Y = class Y {
744
744
  };
745
745
  }
746
746
  applyCreateCallSession(e) {
747
- if (this.callId = e.callId, this.prospectId = e.prospectId || this.prospectId, this.serverUrl = e.serverUrl, this.iceServers = e.iceServers, this.callSessionLoaded = !0, Nr(this.agentId, this.callId || "", this.prospectId), this.onSessionStarted && this.prospectId && this.callId && !this.sessionStartedEmitted)
747
+ if (this.callId = e.callId, this.prospectId = e.prospectId || this.prospectId, this.serverUrl = e.serverUrl, this.iceServers = e.iceServers, this.callSessionLoaded = !0, Vr(this.agentId, this.callId || "", this.prospectId), this.onSessionStarted && this.prospectId && this.callId && !this.sessionStartedEmitted)
748
748
  try {
749
749
  this.onSessionStarted({ prospectId: this.prospectId, callId: this.callId, serverUrl: this.serverUrl }), this.sessionStartedEmitted = !0;
750
750
  } catch {
@@ -910,7 +910,7 @@ const Y = class Y {
910
910
  event: "client_tool_ack",
911
911
  data: { tool_call_id: s }
912
912
  }));
913
- const i = (r == null ? void 0 : r.arguments) || (r == null ? void 0 : r.args) || {}, o = (r == null ? void 0 : r.client_fields) || {}, a = (r == null ? void 0 : r.name) || (r == null ? void 0 : r.tool_name) || "", l = at(o, i, a);
913
+ const i = (r == null ? void 0 : r.arguments) || (r == null ? void 0 : r.args) || {}, o = (r == null ? void 0 : r.client_fields) || {}, a = (r == null ? void 0 : r.name) || (r == null ? void 0 : r.tool_name) || "", l = dt(o, i, a);
914
914
  if (a === "end_call") {
915
915
  s && this.sendToolResult(s, {
916
916
  status: "client_ack_end_call",
@@ -1039,7 +1039,7 @@ const Y = class Y {
1039
1039
  * @param message Optional user text message about the file
1040
1040
  */
1041
1041
  async uploadMedia(e, t = "general", r = "") {
1042
- return await Rr(this.dataChannel, this.mediaBytesChannel) ? this._uploadMediaViaDataChannel(e, t, r) : ($r(this.dataChannel, this.mediaBytesChannel), this._uploadMediaViaHTTP(e, t, r));
1042
+ return await jr(this.dataChannel, this.mediaBytesChannel) ? this._uploadMediaViaDataChannel(e, t, r) : (Hr(this.dataChannel, this.mediaBytesChannel), this._uploadMediaViaHTTP(e, t, r));
1043
1043
  }
1044
1044
  /**
1045
1045
  * Upload a live vision / screen frame — HTTP only for now, never sends client_media_update.
@@ -1058,8 +1058,8 @@ const Y = class Y {
1058
1058
  async _uploadBytesViaDataChannel(e, t, r, s, i) {
1059
1059
  if (!this.callId || !this.mediaBytesChannel)
1060
1060
  throw new Error("Upload failed: call not ready for WebRTC media upload.");
1061
- const o = i || (e instanceof File ? e.name : s === "frame" ? "frame.jpg" : "upload.bin"), a = e.type || (s === "frame" ? "image/jpeg" : "application/octet-stream"), l = await Or(e);
1062
- return Ur({
1061
+ const o = i || (e instanceof File ? e.name : s === "frame" ? "frame.jpg" : "upload.bin"), a = e.type || (s === "frame" ? "image/jpeg" : "application/octet-stream"), l = await Yr(e);
1062
+ return Wr({
1063
1063
  bytes: l,
1064
1064
  filename: o,
1065
1065
  contentType: a,
@@ -1169,32 +1169,32 @@ const Y = class Y {
1169
1169
  };
1170
1170
  /** Dedupes concurrent POST /calls/create (e.g. React StrictMode double-mount). */
1171
1171
  _(Y, "inflightCreates", /* @__PURE__ */ new Map());
1172
- let Ke = Y;
1173
- const Hr = "vnr-clip-overlay";
1174
- function jr(n) {
1172
+ let Xe = Y;
1173
+ const Zr = "vnr-clip-overlay";
1174
+ function Xr(n) {
1175
1175
  var e;
1176
- return ((e = n.classList) == null ? void 0 : e.contains(Hr)) ?? !1;
1176
+ return ((e = n.classList) == null ? void 0 : e.contains(Zr)) ?? !1;
1177
1177
  }
1178
- function Wr(n) {
1178
+ function en(n) {
1179
1179
  var t;
1180
1180
  return ((t = n.tagName) == null ? void 0 : t.toLowerCase()) === "vanira-convai" ? !0 : typeof n.closest == "function" && !!n.closest("vanira-convai");
1181
1181
  }
1182
- function Wt(n) {
1182
+ function Zt(n) {
1183
1183
  var e;
1184
- return jr(n) || Wr(n) || (e = n.classList) != null && e.contains("vnr-screen-overlay-root") ? !0 : typeof n.closest == "function" && !!n.closest(".vnr-screen-overlay-root");
1184
+ return Xr(n) || en(n) || (e = n.classList) != null && e.contains("vnr-screen-overlay-root") ? !0 : typeof n.closest == "function" && !!n.closest(".vnr-screen-overlay-root");
1185
1185
  }
1186
- async function Yt() {
1186
+ async function Xt() {
1187
1187
  const n = document.documentElement.clientWidth, e = document.documentElement.clientHeight;
1188
- return Jt({ left: 0, top: 0, width: n, height: e });
1188
+ return tr({ left: 0, top: 0, width: n, height: e });
1189
1189
  }
1190
- function Gt(n, e) {
1190
+ function er(n, e) {
1191
1191
  if (n.width <= e) return n;
1192
1192
  const t = e / n.width, r = document.createElement("canvas");
1193
1193
  r.width = e, r.height = Math.round(n.height * t);
1194
1194
  const s = r.getContext("2d");
1195
1195
  return s ? (s.drawImage(n, 0, 0, r.width, r.height), r) : n;
1196
1196
  }
1197
- async function Jt(n) {
1197
+ async function tr(n) {
1198
1198
  const { default: e } = await import("../chunks/html2canvas.js"), t = window.devicePixelRatio || 1, r = window.scrollX + n.left, s = window.scrollY + n.top;
1199
1199
  return e(document.body, {
1200
1200
  x: r,
@@ -1209,11 +1209,11 @@ async function Jt(n) {
1209
1209
  // allowTaint:true taints the canvas on third-party pages — toBlob() then throws SecurityError.
1210
1210
  allowTaint: !1,
1211
1211
  scale: t,
1212
- ignoreElements: (i) => Wt(i),
1212
+ ignoreElements: (i) => Zt(i),
1213
1213
  logging: !1
1214
1214
  });
1215
1215
  }
1216
- async function lt(n, e = 0.88) {
1216
+ async function ut(n, e = 0.88) {
1217
1217
  try {
1218
1218
  const t = await new Promise(
1219
1219
  (r) => n.toBlob((s) => r(s), "image/jpeg", e)
@@ -1227,22 +1227,22 @@ async function lt(n, e = 0.88) {
1227
1227
  ) : t;
1228
1228
  }
1229
1229
  }
1230
- const Yr = "vanira:clip-region-active";
1231
- function Ze(n) {
1232
- typeof window > "u" || window.dispatchEvent(new CustomEvent(Yr, { detail: { active: n } }));
1230
+ const tn = "vanira:clip-region-active";
1231
+ function et(n) {
1232
+ typeof window > "u" || window.dispatchEvent(new CustomEvent(tn, { detail: { active: n } }));
1233
1233
  }
1234
- const xe = "vnr-clip-overlay", bt = "2147483647", Gr = "rgba(0, 0, 0, 0.28)";
1235
- function Jr(n = {}) {
1234
+ const Ce = "vnr-clip-overlay", xt = "2147483647", rn = "rgba(0, 0, 0, 0.28)";
1235
+ function nn(n = {}) {
1236
1236
  const e = n.minSizePx ?? 24, t = n.hint ?? "Drag to select an area — release to clip.";
1237
1237
  return new Promise((r) => {
1238
1238
  let s = !1, i = !1, o = 0, a = 0, l = !1, c = { left: 0, top: 0, width: 0, height: 0 }, u = !1, d = null;
1239
1239
  const p = (A) => {
1240
- s || (s = !0, O(), r(A));
1240
+ s || (s = !0, F(), r(A));
1241
1241
  }, h = document.createElement("div");
1242
- h.className = xe, h.style.cssText = [
1242
+ h.className = Ce, h.style.cssText = [
1243
1243
  "position:fixed",
1244
1244
  "inset:0",
1245
- `z-index:${bt}`,
1245
+ `z-index:${xt}`,
1246
1246
  "cursor:crosshair",
1247
1247
  "user-select:none",
1248
1248
  "touch-action:none",
@@ -1273,12 +1273,12 @@ function Jr(n = {}) {
1273
1273
  "white-space:nowrap"
1274
1274
  ].join(";");
1275
1275
  const v = document.createElement("div");
1276
- v.className = xe, v.style.cssText = [
1276
+ v.className = Ce, v.style.cssText = [
1277
1277
  "position:fixed",
1278
1278
  "top:16px",
1279
1279
  "left:50%",
1280
1280
  "transform:translateX(-50%)",
1281
- `z-index:${bt}`,
1281
+ `z-index:${xt}`,
1282
1282
  "display:flex",
1283
1283
  "align-items:center",
1284
1284
  "gap:10px",
@@ -1311,7 +1311,7 @@ function Jr(n = {}) {
1311
1311
  f.style.display = "none", y.style.display = "none";
1312
1312
  return;
1313
1313
  }
1314
- f.style.display = "block", f.style.left = `${c.left}px`, f.style.top = `${c.top}px`, f.style.width = `${c.width}px`, f.style.height = `${c.height}px`, f.style.boxShadow = `0 0 0 9999px ${Gr}`, y.style.display = "block", y.textContent = `${Math.round(c.width)} × ${Math.round(c.height)}`, y.style.left = `${c.left}px`, y.style.top = `${Math.max(8, c.top - 26)}px`;
1314
+ f.style.display = "block", f.style.left = `${c.left}px`, f.style.top = `${c.top}px`, f.style.width = `${c.width}px`, f.style.height = `${c.height}px`, f.style.boxShadow = `0 0 0 9999px ${rn}`, y.style.display = "block", y.textContent = `${Math.round(c.width)} × ${Math.round(c.height)}`, y.style.left = `${c.left}px`, y.style.top = `${Math.max(8, c.top - 26)}px`;
1315
1315
  }, k = (A) => {
1316
1316
  const T = A instanceof Error ? A.message : "Capture failed";
1317
1317
  g.textContent = T.length > 120 ? `${T.slice(0, 117)}…` : T, g.style.color = "#fca5a5", window.setTimeout(() => {
@@ -1321,7 +1321,7 @@ function Jr(n = {}) {
1321
1321
  if (!(i || s)) {
1322
1322
  i = !0, b.disabled = !0, g.textContent = "Clipping…", g.style.color = "#e2e8f0", h.style.visibility = "hidden", v.style.visibility = "hidden";
1323
1323
  try {
1324
- const T = await Jt(A), M = await lt(T), R = document.documentElement.clientWidth, U = document.documentElement.clientHeight;
1324
+ const T = await tr(A), M = await ut(T), R = document.documentElement.clientWidth, U = document.documentElement.clientHeight;
1325
1325
  p({
1326
1326
  blob: M,
1327
1327
  region: {
@@ -1354,21 +1354,21 @@ function Jr(n = {}) {
1354
1354
  x();
1355
1355
  }
1356
1356
  }, $ = (A) => {
1357
- i || A.target.closest(`.${xe}`) !== v && (l = !0, u = !0, o = A.clientX, a = A.clientY, c = { left: o, top: a, width: 0, height: 0 }, d = A.pointerId, h.setPointerCapture(A.pointerId), C());
1357
+ i || A.target.closest(`.${Ce}`) !== v && (l = !0, u = !0, o = A.clientX, a = A.clientY, c = { left: o, top: a, width: 0, height: 0 }, d = A.pointerId, h.setPointerCapture(A.pointerId), C());
1358
1358
  }, D = (A) => {
1359
1359
  if (!l || i) return;
1360
1360
  const T = Math.min(o, A.clientX), M = Math.min(a, A.clientY), R = Math.max(o, A.clientX), U = Math.max(a, A.clientY);
1361
1361
  c = { left: T, top: M, width: R - T, height: U - M }, C();
1362
- }, O = () => {
1363
- Ze(!1), document.removeEventListener("keydown", S), window.removeEventListener("pointerup", F, !0), window.removeEventListener("pointercancel", F, !0), h.removeEventListener("pointerdown", $), h.removeEventListener("pointermove", D), h.removeEventListener("pointerup", L), h.removeEventListener("pointercancel", L), I(), h.remove(), v.remove();
1364
- }, F = (A) => L(A);
1365
- b.addEventListener("click", () => p(null)), Ze(!0), h.appendChild(f), h.appendChild(y), document.body.appendChild(h), document.body.appendChild(v), document.addEventListener("keydown", S), window.addEventListener("pointerup", F, !0), window.addEventListener("pointercancel", F, !0), h.addEventListener("pointerdown", $), h.addEventListener("pointermove", D), h.addEventListener("pointerup", L), h.addEventListener("pointercancel", L);
1362
+ }, F = () => {
1363
+ et(!1), document.removeEventListener("keydown", S), window.removeEventListener("pointerup", O, !0), window.removeEventListener("pointercancel", O, !0), h.removeEventListener("pointerdown", $), h.removeEventListener("pointermove", D), h.removeEventListener("pointerup", L), h.removeEventListener("pointercancel", L), I(), h.remove(), v.remove();
1364
+ }, O = (A) => L(A);
1365
+ b.addEventListener("click", () => p(null)), et(!0), h.appendChild(f), h.appendChild(y), document.body.appendChild(h), document.body.appendChild(v), document.addEventListener("keydown", S), window.addEventListener("pointerup", O, !0), window.addEventListener("pointercancel", O, !0), h.addEventListener("pointerdown", $), h.addEventListener("pointermove", D), h.addEventListener("pointerup", L), h.addEventListener("pointercancel", L);
1366
1366
  });
1367
1367
  }
1368
- function Fe() {
1369
- document.querySelectorAll(`.${xe}`).forEach((n) => n.remove()), Ze(!1);
1368
+ function ze() {
1369
+ document.querySelectorAll(`.${Ce}`).forEach((n) => n.remove()), et(!1);
1370
1370
  }
1371
- const Qr = [
1371
+ const sn = [
1372
1372
  "a[href]",
1373
1373
  "button:not([disabled])",
1374
1374
  'input:not([type="hidden"]):not([disabled])',
@@ -1391,8 +1391,8 @@ const Qr = [
1391
1391
  "[data-testid]",
1392
1392
  "[aria-label]",
1393
1393
  "[onclick]"
1394
- ].join(", "), Kr = '[id]:not([id=""]), svg[id], polygon[id]', Zr = "svg[id], polygon[id], svg[data-vanira-static-diagram], svg[data-vanira-static-diagram] polygon", Qt = /* @__PURE__ */ new Set(["root", "app", "__next"]);
1395
- function wt(n, e, t) {
1394
+ ].join(", "), on = '[id]:not([id=""]), svg[id], polygon[id]', an = "svg[id], polygon[id], svg[data-vanira-static-diagram], svg[data-vanira-static-diagram] polygon", rr = /* @__PURE__ */ new Set(["root", "app", "__next"]);
1395
+ function St(n, e, t) {
1396
1396
  const r = n.getScreenCTM(), s = n.ownerSVGElement;
1397
1397
  if (!r || !s) return [];
1398
1398
  const i = [];
@@ -1404,19 +1404,19 @@ function wt(n, e, t) {
1404
1404
  }
1405
1405
  return i;
1406
1406
  }
1407
- function Kt(n, e, t) {
1407
+ function nr(n, e, t) {
1408
1408
  if (n instanceof SVGPolygonElement) {
1409
- const r = wt(n, e, t);
1409
+ const r = St(n, e, t);
1410
1410
  return r.length >= 2 ? r : void 0;
1411
1411
  }
1412
1412
  if (n instanceof SVGSVGElement) {
1413
1413
  const r = n.querySelector("polygon");
1414
1414
  if (!r) return;
1415
- const s = wt(r, e, t);
1415
+ const s = St(r, e, t);
1416
1416
  return s.length >= 2 ? s : void 0;
1417
1417
  }
1418
1418
  }
1419
- function Xr(n, e = 40) {
1419
+ function ln(n, e = 40) {
1420
1420
  return n.elements.slice(0, e).map((t) => {
1421
1421
  var s;
1422
1422
  let r = `${t.css_selector} (${t.tag}) "${t.label.slice(0, 48)}" center=(${t.center_x.toFixed(3)},${t.center_y.toFixed(3)}) bbox=(${t.x.toFixed(3)},${t.y.toFixed(3)},${t.width.toFixed(3)},${t.height.toFixed(3)})`;
@@ -1428,10 +1428,10 @@ function Xr(n, e = 40) {
1428
1428
  }).join(`
1429
1429
  `);
1430
1430
  }
1431
- function _t(n, e = "#f97316") {
1431
+ function Ct(n, e = "#f97316") {
1432
1432
  const t = document.querySelector(n);
1433
1433
  if (!t) return null;
1434
- const r = document.documentElement.clientWidth, s = document.documentElement.clientHeight, i = Kt(t, r, s);
1434
+ const r = document.documentElement.clientWidth, s = document.documentElement.clientHeight, i = nr(t, r, s);
1435
1435
  if (i != null && i.length)
1436
1436
  return {
1437
1437
  points: i.map((a) => [a.x, a.y]),
@@ -1450,12 +1450,12 @@ function _t(n, e = "#f97316") {
1450
1450
  color: e
1451
1451
  };
1452
1452
  }
1453
- function xt(n) {
1453
+ function kt(n) {
1454
1454
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(n) : n.replace(/([^\w-])/g, "\\$1");
1455
1455
  }
1456
- function en(n) {
1456
+ function cn(n) {
1457
1457
  if (n.id) {
1458
- const s = `#${xt(n.id)}`;
1458
+ const s = `#${kt(n.id)}`;
1459
1459
  try {
1460
1460
  if (document.querySelectorAll(s).length === 1) return s;
1461
1461
  } catch {
@@ -1474,7 +1474,7 @@ function en(n) {
1474
1474
  for (; r && r !== document.body && r !== document.documentElement; ) {
1475
1475
  let s = r.tagName.toLowerCase();
1476
1476
  if (r.classList.length > 0) {
1477
- const o = [...r.classList].filter((a) => !a.startsWith("vnr-")).slice(0, 2).map((a) => `.${xt(a)}`).join("");
1477
+ const o = [...r.classList].filter((a) => !a.startsWith("vnr-")).slice(0, 2).map((a) => `.${kt(a)}`).join("");
1478
1478
  s += o;
1479
1479
  }
1480
1480
  const i = r.parentElement;
@@ -1492,7 +1492,7 @@ function en(n) {
1492
1492
  }
1493
1493
  return t.join(" > ") || n.tagName.toLowerCase();
1494
1494
  }
1495
- function Zt(n, e, t) {
1495
+ function sr(n, e, t) {
1496
1496
  const r = n.getBoundingClientRect();
1497
1497
  if (r.width < 2 || r.height < 2 || r.bottom <= 0 || r.right <= 0 || r.top >= t || r.left >= e) return !1;
1498
1498
  if (n instanceof SVGElement || n instanceof HTMLElement) {
@@ -1503,23 +1503,23 @@ function Zt(n, e, t) {
1503
1503
  return !1;
1504
1504
  return n.getAttribute("aria-hidden") !== "true";
1505
1505
  }
1506
- function tn(n, e, t) {
1506
+ function dn(n, e, t) {
1507
1507
  var a;
1508
1508
  const r = ((a = n.id) == null ? void 0 : a.toLowerCase()) ?? "";
1509
- if (Qt.has(r) || n === document.body || n === document.documentElement) return !0;
1509
+ if (rr.has(r) || n === document.body || n === document.documentElement) return !0;
1510
1510
  const s = n.tagName.toLowerCase();
1511
1511
  if (s !== "div" && s !== "main") return !1;
1512
1512
  const i = n.getBoundingClientRect();
1513
1513
  return i.width * i.height / Math.max(1, e * t) > 0.9;
1514
1514
  }
1515
- function Xt(n) {
1516
- return Wt(n) ? !0 : typeof n.closest != "function" ? !1 : !!n.closest("script, style, noscript, template, head");
1515
+ function ir(n) {
1516
+ return Zt(n) ? !0 : typeof n.closest != "function" ? !1 : !!n.closest("script, style, noscript, template, head");
1517
1517
  }
1518
- function rn(n, e) {
1518
+ function un(n, e) {
1519
1519
  const t = n.tagName.toLowerCase();
1520
1520
  return t === "svg" || t === "polygon" ? "diagram" : t === "button" || e === "button" ? "button" : t === "a" || e === "link" ? "link" : t === "input" || t === "select" || t === "textarea" ? "input" : /^h[1-6]$/.test(t) ? "heading" : t === "img" ? "image" : t === "label" ? "label" : e ? "interactive" : "text";
1521
1521
  }
1522
- function nn(n) {
1522
+ function hn(n) {
1523
1523
  const e = n.getAttribute("aria-label") || n.getAttribute("title") || "";
1524
1524
  if (e.trim()) return e.trim().replace(/\s+/g, " ").slice(0, 240);
1525
1525
  if (n instanceof SVGPolygonElement && n.id)
@@ -1534,7 +1534,7 @@ function nn(n) {
1534
1534
  }
1535
1535
  return n instanceof HTMLImageElement && n.alt.trim() ? n.alt.trim().slice(0, 240) : (n.innerText || n.textContent || "").replace(/\s+/g, " ").trim().slice(0, 240);
1536
1536
  }
1537
- function sn(n) {
1537
+ function pn(n) {
1538
1538
  var e, t;
1539
1539
  if (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) {
1540
1540
  const r = (e = n.value) == null ? void 0 : e.trim();
@@ -1545,7 +1545,7 @@ function sn(n) {
1545
1545
  return r ? r.slice(0, 240) : void 0;
1546
1546
  }
1547
1547
  }
1548
- function on(n, e, t) {
1548
+ function fn(n, e, t) {
1549
1549
  const r = Math.round(n.left), s = Math.round(n.top), i = Math.round(n.width), o = Math.round(n.height), a = r + i / 2, l = s + o / 2;
1550
1550
  return {
1551
1551
  x: n.left / e,
@@ -1564,7 +1564,7 @@ function on(n, e, t) {
1564
1564
  }
1565
1565
  };
1566
1566
  }
1567
- function St(n) {
1567
+ function Et(n) {
1568
1568
  var t;
1569
1569
  let e = n.label ? 2 : 0;
1570
1570
  switch (n.kind) {
@@ -1589,19 +1589,19 @@ function St(n) {
1589
1589
  default:
1590
1590
  e += 3;
1591
1591
  }
1592
- return n.kind !== "text" && (e += Math.min(4, n.px.width * n.px.height / 12e3)), (t = n.stroke_points) != null && t.length && (e += 18), n.id && Qt.has(n.id.toLowerCase()) && (e -= 50), e;
1592
+ return n.kind !== "text" && (e += Math.min(4, n.px.width * n.px.height / 12e3)), (t = n.stroke_points) != null && t.length && (e += 18), n.id && rr.has(n.id.toLowerCase()) && (e -= 50), e;
1593
1593
  }
1594
- function Le(n, e, t, r, s) {
1595
- if (Xt(n) || tn(n, r, s) || !Zt(n, r, s)) return;
1596
- const i = nn(n), o = sn(n), a = Kt(n, r, s), l = n.id || void 0;
1594
+ function Me(n, e, t, r, s) {
1595
+ if (ir(n) || dn(n, r, s) || !sr(n, r, s)) return;
1596
+ const i = hn(n), o = pn(n), a = nr(n, r, s), l = n.id || void 0;
1597
1597
  if (!i && !o && !l && !a && n.tagName.toLowerCase() !== "input") return;
1598
- const c = (n.getAttribute("role") || "").trim() || void 0, u = en(n);
1598
+ const c = (n.getAttribute("role") || "").trim() || void 0, u = cn(n);
1599
1599
  if (t.has(u)) return;
1600
1600
  t.add(u);
1601
- const d = on(n.getBoundingClientRect(), r, s);
1601
+ const d = fn(n.getBoundingClientRect(), r, s);
1602
1602
  e.push({
1603
1603
  tag: n.tagName.toLowerCase(),
1604
- kind: rn(n, c ?? ""),
1604
+ kind: un(n, c ?? ""),
1605
1605
  role: c,
1606
1606
  label: i || o || l || u,
1607
1607
  value: o,
@@ -1611,22 +1611,22 @@ function Le(n, e, t, r, s) {
1611
1611
  ...d
1612
1612
  });
1613
1613
  }
1614
- function an(n, e, t, r) {
1615
- for (const s of document.querySelectorAll(Zr))
1616
- Le(s, n, e, t, r);
1614
+ function mn(n, e, t, r) {
1615
+ for (const s of document.querySelectorAll(an))
1616
+ Me(s, n, e, t, r);
1617
1617
  for (const s of document.querySelectorAll("svg"))
1618
- if (!(Xt(s) || !Zt(s, t, r)))
1618
+ if (!(ir(s) || !sr(s, t, r)))
1619
1619
  for (const i of s.querySelectorAll("polygon"))
1620
- Le(i, n, e, t, r);
1620
+ Me(i, n, e, t, r);
1621
1621
  }
1622
- function er(n) {
1622
+ function or(n) {
1623
1623
  const e = Math.max(1, Math.min(200, (n == null ? void 0 : n.maxElements) ?? 80)), t = document.documentElement.clientWidth, r = document.documentElement.clientHeight, s = /* @__PURE__ */ new Set(), i = [];
1624
- an(i, s, t, r);
1625
- for (const a of document.querySelectorAll(Qr))
1626
- Le(a, i, s, t, r);
1627
- for (const a of document.querySelectorAll(Kr))
1628
- Le(a, i, s, t, r);
1629
- i.sort((a, l) => St(l) - St(a));
1624
+ mn(i, s, t, r);
1625
+ for (const a of document.querySelectorAll(sn))
1626
+ Me(a, i, s, t, r);
1627
+ for (const a of document.querySelectorAll(on))
1628
+ Me(a, i, s, t, r);
1629
+ i.sort((a, l) => Et(l) - Et(a));
1630
1630
  const o = i.slice(0, e).map((a, l) => ({
1631
1631
  ...a,
1632
1632
  element_id: `e${l + 1}`
@@ -1640,7 +1640,7 @@ function er(n) {
1640
1640
  elements: o
1641
1641
  };
1642
1642
  }
1643
- function ln(n) {
1643
+ function vn(n) {
1644
1644
  if (n instanceof SVGPathElement && typeof n.getTotalLength == "function") {
1645
1645
  const e = n.getTotalLength();
1646
1646
  if (e > 0) return e;
@@ -1663,30 +1663,30 @@ function ln(n) {
1663
1663
  }
1664
1664
  return 100;
1665
1665
  }
1666
- function Ct(n) {
1666
+ function Tt(n) {
1667
1667
  n.style.strokeDasharray = "", n.style.strokeDashoffset = "", n.style.transition = "", n.removeAttribute("stroke-dasharray"), n.removeAttribute("stroke-dashoffset");
1668
1668
  }
1669
- function Xe(n, e) {
1669
+ function tt(n, e) {
1670
1670
  if (e <= 0)
1671
- return Ct(n), Promise.resolve();
1671
+ return Tt(n), Promise.resolve();
1672
1672
  n instanceof SVGLineElement && (n.style.vectorEffect = "none");
1673
- const t = Math.max(1, ln(n));
1673
+ const t = Math.max(1, vn(n));
1674
1674
  return n.setAttribute("stroke-dasharray", String(t)), n.setAttribute("stroke-dashoffset", String(t)), n.getBoundingClientRect(), new Promise((r) => {
1675
1675
  requestAnimationFrame(() => {
1676
1676
  n.style.transition = `stroke-dashoffset ${e}ms ease-out`, n.setAttribute("stroke-dashoffset", "0"), setTimeout(() => {
1677
- Ct(n), r();
1677
+ Tt(n), r();
1678
1678
  }, e + 30);
1679
1679
  });
1680
1680
  });
1681
1681
  }
1682
- function ct(n) {
1682
+ function ht(n) {
1683
1683
  return new Promise((e) => setTimeout(e, n));
1684
1684
  }
1685
- const ae = 4, ze = 750, kt = 90, cn = "2147483647";
1686
- let Et = !1;
1687
- function dn() {
1688
- if (Et || typeof document > "u") return;
1689
- Et = !0;
1685
+ const ae = 4, qe = 750, At = 90, yn = "2147483647";
1686
+ let It = !1;
1687
+ function gn() {
1688
+ if (It || typeof document > "u") return;
1689
+ It = !0;
1690
1690
  const n = document.createElement("style");
1691
1691
  n.id = "vnr-screen-overlay-styles", n.textContent = `
1692
1692
  @keyframes vnr-screen-ripple {
@@ -1700,7 +1700,7 @@ function dn() {
1700
1700
  .vnr-screen-overlay-root {
1701
1701
  position: fixed;
1702
1702
  inset: 0;
1703
- z-index: ${cn};
1703
+ z-index: ${yn};
1704
1704
  pointer-events: none;
1705
1705
  overflow: hidden;
1706
1706
  }
@@ -1777,7 +1777,7 @@ function N(n, e) {
1777
1777
  function P(n, e = "") {
1778
1778
  return typeof n == "string" ? n : e;
1779
1779
  }
1780
- function V(n) {
1780
+ function z(n) {
1781
1781
  if (n === !0 || n === 1) return !0;
1782
1782
  if (typeof n == "string") {
1783
1783
  const e = n.trim().toLowerCase();
@@ -1785,7 +1785,7 @@ function V(n) {
1785
1785
  }
1786
1786
  return !1;
1787
1787
  }
1788
- function Tt(n) {
1788
+ function Lt(n) {
1789
1789
  if (n === !1 || n === 0) return !0;
1790
1790
  if (typeof n == "string") {
1791
1791
  const e = n.trim().toLowerCase();
@@ -1800,22 +1800,22 @@ function te(n, e) {
1800
1800
  const t = window.innerWidth, r = window.innerHeight;
1801
1801
  return { px: j(n, t), py: j(e, r) };
1802
1802
  }
1803
- function et(n) {
1803
+ function rt(n) {
1804
1804
  const e = document.querySelector(n);
1805
1805
  if (!e) return null;
1806
1806
  const t = e.getBoundingClientRect();
1807
1807
  return { px: t.left + t.width / 2, py: t.top + t.height / 2 };
1808
1808
  }
1809
- function un(n) {
1809
+ function bn(n) {
1810
1810
  const e = P(n.css_selector || n.selector);
1811
1811
  if (e) {
1812
- const s = et(e);
1812
+ const s = rt(e);
1813
1813
  if (s) return s;
1814
1814
  }
1815
1815
  const t = n.x ?? n.client_x, r = n.y ?? n.client_y;
1816
1816
  return t == null || r == null ? null : te(N(t, NaN), N(r, NaN));
1817
1817
  }
1818
- function At(n) {
1818
+ function Pt(n) {
1819
1819
  if (Array.isArray(n)) return n;
1820
1820
  if (typeof n == "string") {
1821
1821
  const e = n.trim();
@@ -1834,7 +1834,7 @@ function At(n) {
1834
1834
  }
1835
1835
  return [];
1836
1836
  }
1837
- function hn(n) {
1837
+ function wn(n) {
1838
1838
  if (Array.isArray(n)) return n;
1839
1839
  if (typeof n == "string") {
1840
1840
  const e = n.trim();
@@ -1848,11 +1848,11 @@ function hn(n) {
1848
1848
  }
1849
1849
  return [];
1850
1850
  }
1851
- function tt(n, e) {
1851
+ function nt(n, e) {
1852
1852
  const t = P(n, e).trim().toLowerCase();
1853
1853
  return !t || t === "#000" || t === "#000000" || t === "black" ? "#ece6d9" : P(n, e);
1854
1854
  }
1855
- function tr(n, e) {
1855
+ function ar(n, e) {
1856
1856
  if (!n || typeof n != "object") return null;
1857
1857
  const t = n, r = P(
1858
1858
  t.text ?? t.label ?? t.annotation ?? (typeof t.annotations == "string" ? t.annotations : "")
@@ -1860,7 +1860,7 @@ function tr(n, e) {
1860
1860
  if (!r) return null;
1861
1861
  let s = t.x ?? t.client_x, i = t.y ?? t.client_y;
1862
1862
  if ((s == null || i == null) && Array.isArray(t.points) && t.points.length > 0) {
1863
- const l = dt(t.points[0]);
1863
+ const l = pt(t.points[0]);
1864
1864
  if (l) {
1865
1865
  const c = window.innerWidth, u = window.innerHeight;
1866
1866
  s = l.px / c, i = l.py / u;
@@ -1872,38 +1872,38 @@ function tr(n, e) {
1872
1872
  x: o,
1873
1873
  y: a,
1874
1874
  text: r,
1875
- color: tt(t.color, e),
1875
+ color: nt(t.color, e),
1876
1876
  font_size: t.font_size != null ? N(t.font_size, 18) : void 0
1877
1877
  };
1878
1878
  }
1879
- function pn(n, e) {
1879
+ function _n(n, e) {
1880
1880
  if (!n || typeof n != "object") return null;
1881
1881
  const t = n;
1882
- return t.text != null || t.label != null || t.annotation != null || typeof t.annotations == "string" ? tr(n, e) : null;
1882
+ return t.text != null || t.label != null || t.annotation != null || typeof t.annotations == "string" ? ar(n, e) : null;
1883
1883
  }
1884
- function fn(n) {
1884
+ function xn(n) {
1885
1885
  return Array.isArray(n) && n.length > 0 && Array.isArray(n[0]) ? { points: n, close: !0 } : n;
1886
1886
  }
1887
- function mn(n) {
1887
+ function Sn(n) {
1888
1888
  return j(n, Math.min(window.innerWidth, window.innerHeight));
1889
1889
  }
1890
- function vn(n) {
1890
+ function Cn(n) {
1891
1891
  if (n.length < 2) return null;
1892
1892
  const e = window.innerWidth, t = window.innerHeight, r = n.map((c) => c.px), s = n.map((c) => c.py), i = (Math.min(...r) + Math.max(...r)) / 2, o = (Math.min(...s) + Math.max(...s)) / 2, a = Math.max(...n.map((c) => Math.hypot(c.px - i, c.py - o))), l = Math.min(e, t);
1893
1893
  return { cx: i / e, cy: o / t, r: a / l };
1894
1894
  }
1895
- function yn(n, e, t, r) {
1895
+ function kn(n, e, t, r) {
1896
1896
  const s = P(n.kind || n.shape).toLowerCase(), i = s === "circle" || s === "ellipse" || n.r != null || n.radius != null || n.rx != null || n.ry != null;
1897
1897
  let o = n.cx ?? n.center_x ?? n.x, a = n.cy ?? n.center_y ?? n.y, l = n.r ?? n.radius;
1898
1898
  const c = n.rx, u = n.ry;
1899
1899
  if (Array.isArray(r) && r.length >= 3) {
1900
1900
  const f = [];
1901
1901
  for (const v of r) {
1902
- const g = dt(v);
1902
+ const g = pt(v);
1903
1903
  g && f.push(g);
1904
1904
  }
1905
- const y = vn(f);
1906
- y && (i || V(n.close) && f.length >= 8) && (o = o ?? y.cx, a = a ?? y.cy, l = l ?? y.r);
1905
+ const y = Cn(f);
1906
+ y && (i || z(n.close) && f.length >= 8) && (o = o ?? y.cx, a = a ?? y.cy, l = l ?? y.r);
1907
1907
  }
1908
1908
  if (o == null || a == null) return null;
1909
1909
  const d = Number(o), p = Number(a);
@@ -1917,12 +1917,12 @@ function yn(n, e, t, r) {
1917
1917
  };
1918
1918
  return c != null || u != null ? (h.rx = Number(c ?? u), h.ry = Number(u ?? c), h) : l != null && Number.isFinite(Number(l)) ? (h.r = Number(l), h) : null;
1919
1919
  }
1920
- function It(n, e, t) {
1920
+ function Mt(n, e, t) {
1921
1921
  if (!n || typeof n != "object") return null;
1922
1922
  const r = n, s = P(r.path_d || r.path || r.d), i = P(r.color, e), o = r.stroke_width != null ? N(r.stroke_width, t) : t;
1923
1923
  if (s)
1924
- return { path_d: s, close: V(r.close), color: i, stroke_width: o, css_selector: P(r.css_selector) || void 0 };
1925
- const a = P(r.css_selector || r.selector), l = r.points, c = yn(r, e, t, l);
1924
+ return { path_d: s, close: z(r.close), color: i, stroke_width: o, css_selector: P(r.css_selector) || void 0 };
1925
+ const a = P(r.css_selector || r.selector), l = r.points, c = kn(r, e, t, l);
1926
1926
  if (c) return c;
1927
1927
  if (a && !Array.isArray(l))
1928
1928
  return { css_selector: a, color: i, stroke_width: o };
@@ -1932,7 +1932,7 @@ function It(n, e, t) {
1932
1932
  d != null && p != null && h != null && f != null && (u = [[d, p], [h, f]]);
1933
1933
  }
1934
1934
  if (Array.isArray(u) && u.length >= 2) {
1935
- const d = P(r.kind), p = V(r.close) || d === "triangle" || d === "polygon";
1935
+ const d = P(r.kind), p = z(r.close) || d === "triangle" || d === "polygon";
1936
1936
  return {
1937
1937
  points: u,
1938
1938
  close: p,
@@ -1943,7 +1943,7 @@ function It(n, e, t) {
1943
1943
  }
1944
1944
  return a ? { css_selector: a, color: i, stroke_width: o } : null;
1945
1945
  }
1946
- function dt(n) {
1946
+ function pt(n) {
1947
1947
  if (Array.isArray(n) && n.length >= 2) {
1948
1948
  const e = Number(n[0]), t = Number(n[1]);
1949
1949
  return !Number.isFinite(e) || !Number.isFinite(t) ? null : te(e, t);
@@ -1954,12 +1954,12 @@ function dt(n) {
1954
1954
  }
1955
1955
  return null;
1956
1956
  }
1957
- function gn(n) {
1957
+ function En(n) {
1958
1958
  const e = n.points;
1959
1959
  if (!Array.isArray(e)) return [];
1960
1960
  const t = [];
1961
1961
  for (const r of e) {
1962
- const s = dt(r);
1962
+ const s = pt(r);
1963
1963
  s && t.push(s);
1964
1964
  }
1965
1965
  return t;
@@ -1978,17 +1978,17 @@ function ce(n, e) {
1978
1978
  for (const [t, r] of Object.entries(e))
1979
1979
  n.setAttribute(t, r);
1980
1980
  }
1981
- function bn(n, e) {
1981
+ function Tn(n, e) {
1982
1982
  if (n.length === 0) return "";
1983
1983
  const t = n.map((r, s) => `${s === 0 ? "M" : "L"} ${r.px} ${r.py}`).join(" ");
1984
1984
  return e && n.length >= 3 ? `${t} Z` : t;
1985
1985
  }
1986
- function wn(n) {
1986
+ function An(n) {
1987
1987
  return `<svg class="vnr-screen-cursor" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
1988
1988
  <path d="M4 4L4 19L9 14L13 20L15 19L11 13L17 13L4 4Z" fill="${n}" stroke="#fff" stroke-width="1.2"/>
1989
1989
  </svg>`;
1990
1990
  }
1991
- class _n {
1991
+ class In {
1992
1992
  constructor() {
1993
1993
  _(this, "root", null);
1994
1994
  _(this, "inkSvg", null);
@@ -2010,7 +2010,7 @@ class _n {
2010
2010
  }
2011
2011
  ensureRoot() {
2012
2012
  var e;
2013
- return dn(), (e = this.root) != null && e.isConnected ? this.root : (this.root = document.createElement("div"), this.root.className = "vnr-screen-overlay-root", this.root.setAttribute("aria-hidden", "true"), document.body.appendChild(this.root), this.root);
2013
+ return gn(), (e = this.root) != null && e.isConnected ? this.root : (this.root = document.createElement("div"), this.root.className = "vnr-screen-overlay-root", this.root.setAttribute("aria-hidden", "true"), document.body.appendChild(this.root), this.root);
2014
2014
  }
2015
2015
  clear() {
2016
2016
  this.disableUserDrawing(), this.cursorTimer && (clearTimeout(this.cursorTimer), this.cursorTimer = null), this.root && (this.root.remove(), this.root = null), this.inkSvg = null, this.cursorEl = null, this.labelsLayer = null;
@@ -2027,7 +2027,7 @@ class _n {
2027
2027
  for (const o of e) {
2028
2028
  const a = te(o.x, o.y), l = document.createElement("div");
2029
2029
  l.className = "vnr-screen-ink-label", l.textContent = o.text;
2030
- const c = tt(o.color, t), u = o.font_size ?? 20;
2030
+ const c = nt(o.color, t), u = o.font_size ?? 20;
2031
2031
  l.style.cssText = `left:${a.px}px;top:${a.py}px;color:${c};font-size:${u}px;`, s.appendChild(l);
2032
2032
  }
2033
2033
  return e.length;
@@ -2047,7 +2047,7 @@ class _n {
2047
2047
  return { px: e * 0.82, py: t * 0.86 };
2048
2048
  }
2049
2049
  placeCursorWrap(e, t, r, s) {
2050
- if (e.style.cssText = `position:absolute;left:${t.px}px;top:${t.py}px;`, e.innerHTML = wn(r), s) {
2050
+ if (e.style.cssText = `position:absolute;left:${t.px}px;top:${t.py}px;`, e.innerHTML = An(r), s) {
2051
2051
  const i = document.createElement("div");
2052
2052
  i.className = "vnr-screen-cursor-label", i.style.background = r, i.textContent = s, e.appendChild(i);
2053
2053
  }
@@ -2119,7 +2119,7 @@ class _n {
2119
2119
  }
2120
2120
  if (e.r == null) return null;
2121
2121
  const c = document.createElementNS(l, "circle");
2122
- return c.setAttribute("cx", String(o)), c.setAttribute("cy", String(a)), c.setAttribute("r", String(mn(Number(e.r)))), ce(c, le(t, r)), c;
2122
+ return c.setAttribute("cx", String(o)), c.setAttribute("cy", String(a)), c.setAttribute("r", String(Sn(Number(e.r)))), ce(c, le(t, r)), c;
2123
2123
  }
2124
2124
  createFreeformElement(e, t, r) {
2125
2125
  const s = P(e.color, t), i = e.stroke_width != null ? N(e.stroke_width, r) : r;
@@ -2130,7 +2130,7 @@ class _n {
2130
2130
  return a.setAttribute("d", l), ce(a, le(s, i)), a;
2131
2131
  let c = e;
2132
2132
  if (e.css_selector) {
2133
- const d = _t(e.css_selector, s);
2133
+ const d = Ct(e.css_selector, s);
2134
2134
  d && (c = {
2135
2135
  ...e,
2136
2136
  points: d.points,
@@ -2138,15 +2138,15 @@ class _n {
2138
2138
  color: d.color
2139
2139
  });
2140
2140
  }
2141
- const u = gn(c);
2142
- return u.length < 2 ? null : (a.setAttribute("d", bn(u, V(c.close))), ce(a, le(s, i)), a);
2141
+ const u = En(c);
2142
+ return u.length < 2 ? null : (a.setAttribute("d", Tn(u, z(c.close))), ce(a, le(s, i)), a);
2143
2143
  }
2144
2144
  async addStrokes(e, t = "#f97316", r = {}) {
2145
- const s = this.ensureInkSvg(), i = r.animate !== !1, o = r.duration_ms ?? ze, a = r.gap_ms ?? kt, l = r.stroke_width ?? ae;
2145
+ const s = this.ensureInkSvg(), i = r.animate !== !1, o = r.duration_ms ?? qe, a = r.gap_ms ?? At, l = r.stroke_width ?? ae;
2146
2146
  let c = 0;
2147
2147
  for (const u of e) {
2148
2148
  const d = this.createFreeformElement(u, t, l);
2149
- d && (s.appendChild(d), c += 1, i && await Xe(d, o), i && a > 0 && await ct(a));
2149
+ d && (s.appendChild(d), c += 1, i && await tt(d, o), i && a > 0 && await ht(a));
2150
2150
  }
2151
2151
  return c;
2152
2152
  }
@@ -2192,13 +2192,13 @@ class _n {
2192
2192
  (r = e.currentTarget) == null || r.releasePointerCapture(e.pointerId);
2193
2193
  } catch {
2194
2194
  }
2195
- await Xe(t, ze);
2195
+ await tt(t, qe);
2196
2196
  }
2197
2197
  showCursor(e, t = "#f97316") {
2198
- const r = e, s = un(r);
2198
+ const r = e, s = bn(r);
2199
2199
  if (!s) return null;
2200
2200
  const i = P(e.color, t), o = P(e.label) || void 0;
2201
- if (V(e.fly) || V(r.fly))
2201
+ if (z(e.fly) || z(r.fly))
2202
2202
  return this.flyCursorTo(s, {
2203
2203
  color: i,
2204
2204
  label: o,
@@ -2216,7 +2216,7 @@ class _n {
2216
2216
  i.className = "vnr-screen-click-ripple", i.style.cssText = `left:${e}px;top:${t}px;color:${r};`, s.appendChild(i), setTimeout(() => i.remove(), 700);
2217
2217
  }
2218
2218
  async applyInkFromArgs(e, t) {
2219
- const r = P(e.color || t.color, "#f97316"), s = tt(e.label_color ?? t.label_color, "#ece6d9"), i = V(e.clear) || V(e.clear_before) || V(t.clear_before), o = !Tt(e.animate) && !Tt(t.animate), a = N(e.duration_ms ?? t.duration_ms, ze), l = N(e.gap_ms ?? t.gap_ms, kt), c = N(e.stroke_width ?? t.stroke_width, ae), u = V(e.interactive) || V(e.user_draw) || V(t.interactive), d = e.interactive_region ?? t.interactive_region;
2219
+ const r = P(e.color || t.color, "#f97316"), s = nt(e.label_color ?? t.label_color, "#ece6d9"), i = z(e.clear) || z(e.clear_before) || z(t.clear_before), o = !Lt(e.animate) && !Lt(t.animate), a = N(e.duration_ms ?? t.duration_ms, qe), l = N(e.gap_ms ?? t.gap_ms, At), c = N(e.stroke_width ?? t.stroke_width, ae), u = z(e.interactive) || z(e.user_draw) || z(t.interactive), d = e.interactive_region ?? t.interactive_region;
2220
2220
  let p;
2221
2221
  if (d && typeof d == "object") {
2222
2222
  const b = d;
@@ -2228,31 +2228,31 @@ class _n {
2228
2228
  };
2229
2229
  }
2230
2230
  const h = [];
2231
- for (const b of hn(e.labels ?? t.labels)) {
2232
- const S = tr(b, s);
2231
+ for (const b of wn(e.labels ?? t.labels)) {
2232
+ const S = ar(b, s);
2233
2233
  S && h.push(S);
2234
2234
  }
2235
- let f = At(e.strokes ?? t.strokes);
2236
- f.length === 0 && (f = At(e.annotations ?? t.annotations));
2235
+ let f = Pt(e.strokes ?? t.strokes);
2236
+ f.length === 0 && (f = Pt(e.annotations ?? t.annotations));
2237
2237
  const y = [];
2238
2238
  for (const b of f) {
2239
- const S = fn(b), w = pn(S, s);
2239
+ const S = xn(b), w = _n(S, s);
2240
2240
  if (w) {
2241
2241
  h.push(w);
2242
2242
  continue;
2243
2243
  }
2244
- const x = It(S, r, c);
2244
+ const x = Mt(S, r, c);
2245
2245
  x && y.push(x);
2246
2246
  }
2247
2247
  if (y.length === 0) {
2248
2248
  const b = P(e.css_selector ?? e.selector ?? t.css_selector ?? t.selector);
2249
2249
  if (b) {
2250
- const S = _t(b, r);
2250
+ const S = Ct(b, r);
2251
2251
  S && y.push({ css_selector: b, ...S, stroke_width: c });
2252
2252
  }
2253
2253
  }
2254
2254
  if (y.length === 0) {
2255
- const b = It(
2255
+ const b = Mt(
2256
2256
  {
2257
2257
  kind: e.kind ?? e.shape ?? t.kind,
2258
2258
  cx: e.cx ?? e.center_x ?? t.cx,
@@ -2294,19 +2294,19 @@ class _n {
2294
2294
  }
2295
2295
  let ne = null;
2296
2296
  function pe() {
2297
- return ne || (ne = new _n()), ne;
2297
+ return ne || (ne = new In()), ne;
2298
2298
  }
2299
- function Pe() {
2299
+ function Ne() {
2300
2300
  ne == null || ne.clear();
2301
2301
  }
2302
- function xn(n, e) {
2302
+ function Ln(n, e) {
2303
2303
  const t = document.elementsFromPoint(n, e);
2304
2304
  for (const r of t)
2305
2305
  if (r instanceof HTMLElement && !r.closest(".vnr-screen-overlay-root"))
2306
2306
  return r;
2307
2307
  return null;
2308
2308
  }
2309
- function Sn(n) {
2309
+ function Pn(n) {
2310
2310
  try {
2311
2311
  n.focus({ preventScroll: !0 });
2312
2312
  } catch {
@@ -2325,19 +2325,19 @@ function Sn(n) {
2325
2325
  };
2326
2326
  n.dispatchEvent(new MouseEvent("mousedown", s)), n.dispatchEvent(new MouseEvent("mouseup", s)), n.dispatchEvent(new MouseEvent("click", s));
2327
2327
  }
2328
- const rt = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map();
2328
+ const st = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map();
2329
2329
  function de(n, e = "") {
2330
2330
  return typeof n == "string" ? n : e;
2331
2331
  }
2332
- function Cn(n) {
2333
- rt.clear(), nt.clear();
2332
+ function Mn(n) {
2333
+ st.clear(), it.clear();
2334
2334
  for (const e of n.elements)
2335
- e.element_id && rt.set(e.element_id, e), nt.set(e.css_selector, e);
2335
+ e.element_id && st.set(e.element_id, e), it.set(e.css_selector, e);
2336
2336
  }
2337
- function kn(n) {
2338
- return rt.get(n.trim());
2337
+ function Nn(n) {
2338
+ return st.get(n.trim());
2339
2339
  }
2340
- function En(n, e = 48) {
2340
+ function Dn(n, e = 48) {
2341
2341
  return n.elements.slice(0, e).map((t) => {
2342
2342
  var o;
2343
2343
  const r = t.element_id ?? "?", s = t.label.slice(0, 56).replace(/\s+/g, " ");
@@ -2350,7 +2350,7 @@ function En(n, e = 48) {
2350
2350
  }).join(`
2351
2351
  `);
2352
2352
  }
2353
- function Tn(n) {
2353
+ function Bn(n) {
2354
2354
  if (n.length === 0) return null;
2355
2355
  let e = 0, t = 0;
2356
2356
  for (const i of n)
@@ -2358,15 +2358,15 @@ function Tn(n) {
2358
2358
  const r = e / n.length, s = t / n.length;
2359
2359
  return te(r, s);
2360
2360
  }
2361
- function Se(n, e = {}) {
2361
+ function ke(n, e = {}) {
2362
2362
  var o;
2363
2363
  const t = de(
2364
2364
  n.element_id ?? n.target ?? n.element ?? e.element_id ?? e.target
2365
2365
  ).trim();
2366
2366
  if (t) {
2367
- const a = kn(t);
2367
+ const a = Nn(t);
2368
2368
  if (a) {
2369
- const l = (o = a.stroke_points) != null && o.length ? Tn(a.stroke_points) : null, c = l ? null : et(a.css_selector), u = l ?? c ?? te(a.center_x, a.center_y);
2369
+ const l = (o = a.stroke_points) != null && o.length ? Bn(a.stroke_points) : null, c = l ? null : rt(a.css_selector), u = l ?? c ?? te(a.center_x, a.center_y);
2370
2370
  return {
2371
2371
  element_id: a.element_id,
2372
2372
  css_selector: a.css_selector,
@@ -2380,9 +2380,9 @@ function Se(n, e = {}) {
2380
2380
  n.css_selector ?? n.selector ?? e.css_selector ?? e.selector
2381
2381
  ).trim();
2382
2382
  if (r) {
2383
- const a = et(r);
2383
+ const a = rt(r);
2384
2384
  if (a) {
2385
- const l = nt.get(r);
2385
+ const l = it.get(r);
2386
2386
  return {
2387
2387
  css_selector: r,
2388
2388
  point: a,
@@ -2403,21 +2403,21 @@ function Se(n, e = {}) {
2403
2403
  }
2404
2404
  return null;
2405
2405
  }
2406
- function An(n, e = {}) {
2406
+ function $n(n, e = {}) {
2407
2407
  const t = n.targets ?? n.element_ids ?? n.elements ?? e.targets ?? e.element_ids;
2408
2408
  if (Array.isArray(t)) {
2409
2409
  const s = [];
2410
2410
  for (const i of t)
2411
2411
  if (typeof i == "string") {
2412
- const o = Se({ element_id: i }, e);
2412
+ const o = ke({ element_id: i }, e);
2413
2413
  o && s.push(o);
2414
2414
  } else if (i && typeof i == "object") {
2415
- const o = Se(i, e);
2415
+ const o = ke(i, e);
2416
2416
  o && s.push(o);
2417
2417
  }
2418
2418
  if (s.length > 0) return s;
2419
2419
  }
2420
- const r = Se(n, e);
2420
+ const r = ke(n, e);
2421
2421
  return r ? [r] : [];
2422
2422
  }
2423
2423
  function me(n, e = "") {
@@ -2430,7 +2430,7 @@ function se(n, e = !0) {
2430
2430
  const t = String(n).trim().toLowerCase();
2431
2431
  return t === "true" || t === "1" || t === "yes" ? !0 : t === "false" || t === "0" || t === "no" ? !1 : e;
2432
2432
  }
2433
- function In(n, e, t, r) {
2433
+ function Rn(n, e, t, r) {
2434
2434
  const s = n.args ?? {}, i = n.clientFields ?? {}, o = me(s.prompt ?? s.message ?? i.default_prompt).trim(), a = Number(s.max_elements ?? i.max_elements ?? 64), l = se(s.include_image ?? i.include_image, !1), c = Number(s.max_width ?? i.max_width ?? 1280), u = me(s.reason ?? i.reason, "page_scan");
2435
2435
  if (typeof document > "u") {
2436
2436
  t("Page scan is only available in browser environments");
@@ -2438,11 +2438,11 @@ function In(n, e, t, r) {
2438
2438
  }
2439
2439
  (async () => {
2440
2440
  try {
2441
- const d = er({
2441
+ const d = or({
2442
2442
  maxElements: Number.isFinite(a) ? a : 64
2443
2443
  });
2444
- Cn(d);
2445
- const p = En(d), f = `${o ? `Page scanned. Context: ${o}` : "Visible page scanned — use element ids below for point_at and outline_targets."}
2444
+ Mn(d);
2445
+ const p = Dn(d), f = `${o ? `Page scanned. Context: ${o}` : "Visible page scanned — use element ids below for point_at and outline_targets."}
2446
2446
 
2447
2447
  DOM-FIRST GUIDE (better than screenshot-only tutors):
2448
2448
  - Call point_at with element_id (e.g. e3) from this scan — cursor flies to the live element.
@@ -2466,9 +2466,9 @@ ${p}`;
2466
2466
  guide: 'Next: point_at { element_id: "eN", label: "..." } or outline_targets { targets: ["e1","e5"] }'
2467
2467
  }), l && (r != null && r.uploadMediaForToolResult) && (async () => {
2468
2468
  try {
2469
- let y = await Yt();
2470
- Number.isFinite(c) && c > 0 && (y = Gt(y, c));
2471
- const v = await lt(y), g = new File([v], `page-scan-${Date.now()}.jpg`, { type: "image/jpeg" });
2469
+ let y = await Xt();
2470
+ Number.isFinite(c) && c > 0 && (y = er(y, c));
2471
+ const v = await ut(y), g = new File([v], `page-scan-${Date.now()}.jpg`, { type: "image/jpeg" });
2472
2472
  await r.uploadMediaForToolResult(g, u);
2473
2473
  } catch {
2474
2474
  }
@@ -2479,8 +2479,8 @@ ${p}`;
2479
2479
  }
2480
2480
  })();
2481
2481
  }
2482
- function Ln(n, e, t) {
2483
- const r = n.args ?? {}, s = n.clientFields ?? {}, i = me(r.color ?? s.color, "#f97316"), o = se(r.fly ?? s.fly, !0), a = se(r.outline ?? s.outline, !0), l = Number(r.fly_duration_ms ?? s.fly_duration_ms ?? 680), c = Number(r.duration_ms ?? s.duration_ms ?? 0), u = se(r.clear_before ?? s.clear_before, !1), d = Se(r, s);
2482
+ function Un(n, e, t) {
2483
+ const r = n.args ?? {}, s = n.clientFields ?? {}, i = me(r.color ?? s.color, "#f97316"), o = se(r.fly ?? s.fly, !0), a = se(r.outline ?? s.outline, !0), l = Number(r.fly_duration_ms ?? s.fly_duration_ms ?? 680), c = Number(r.duration_ms ?? s.duration_ms ?? 0), u = se(r.clear_before ?? s.clear_before, !1), d = ke(r, s);
2484
2484
  if (!d) {
2485
2485
  t("No valid target — provide element_id from page_scan, css_selector, or x/y");
2486
2486
  return;
@@ -2512,8 +2512,8 @@ function Ln(n, e, t) {
2512
2512
  label: p
2513
2513
  })))();
2514
2514
  }
2515
- function Pn(n, e, t) {
2516
- const r = n.args ?? {}, s = n.clientFields ?? {}, i = me(r.color ?? s.color, "#f97316"), o = se(r.animate ?? s.animate, !0), a = Number(r.duration_ms ?? s.duration_ms ?? 600), l = se(r.clear_before ?? s.clear_before, !1), c = An(r, s);
2515
+ function Fn(n, e, t) {
2516
+ const r = n.args ?? {}, s = n.clientFields ?? {}, i = me(r.color ?? s.color, "#f97316"), o = se(r.animate ?? s.animate, !0), a = Number(r.duration_ms ?? s.duration_ms ?? 600), l = se(r.clear_before ?? s.clear_before, !1), c = $n(r, s);
2517
2517
  if (c.length === 0) {
2518
2518
  t('No valid targets — provide targets: ["e1","e3"] or element_id / css_selector');
2519
2519
  return;
@@ -2541,24 +2541,24 @@ function Pn(n, e, t) {
2541
2541
  });
2542
2542
  })();
2543
2543
  }
2544
- function Mn(n, e) {
2545
- Pe(), e({
2544
+ function On(n, e) {
2545
+ Ne(), e({
2546
2546
  status: "success",
2547
2547
  preset_id: m.ClearGuide,
2548
2548
  message: "Guide overlay cleared (cursor, ink, outlines)"
2549
2549
  });
2550
2550
  }
2551
- const Nn = "vanira:board-active";
2552
- function Ve(n, e = !1) {
2553
- typeof window > "u" || window.dispatchEvent(new CustomEvent(Nn, {
2551
+ const Vn = "vanira:board-active";
2552
+ function He(n, e = !1) {
2553
+ typeof window > "u" || window.dispatchEvent(new CustomEvent(Vn, {
2554
2554
  detail: { active: n, reduced: e }
2555
2555
  }));
2556
2556
  }
2557
- const Lt = "vanira:agent-playback-ended", Dn = "You might have missed the whiteboard — call type_on_whiteboard or draw_on_board so the student can see what you explained. if you are on other task or waiting for user to show something then fine";
2558
- function Bn(n) {
2557
+ const Nt = "vanira:agent-playback-ended", zn = "You might have missed the whiteboard — call type_on_whiteboard or draw_on_board so the student can see what you explained. if you are on other task or waiting for user to show something then fine";
2558
+ function qn(n) {
2559
2559
  return !!(n.has_notes_on_board || n.has_diagram_geometry);
2560
2560
  }
2561
- class $n {
2561
+ class Hn {
2562
2562
  constructor(e, t) {
2563
2563
  _(this, "active", !1);
2564
2564
  _(this, "sendContext", null);
@@ -2572,20 +2572,20 @@ class $n {
2572
2572
  this.sendContext = e;
2573
2573
  return;
2574
2574
  }
2575
- this.active = !0, this.sendContext = e, window.addEventListener(Lt, this.onAgentTurnEnd);
2575
+ this.active = !0, this.sendContext = e, window.addEventListener(Nt, this.onAgentTurnEnd);
2576
2576
  }
2577
2577
  stop() {
2578
- this.active && (this.active = !1, this.sendContext = null, window.removeEventListener(Lt, this.onAgentTurnEnd));
2578
+ this.active && (this.active = !1, this.sendContext = null, window.removeEventListener(Nt, this.onAgentTurnEnd));
2579
2579
  }
2580
2580
  checkAfterAgentTurn() {
2581
2581
  if (!this.active || !this.sendContext || this.isBoardBusy()) return;
2582
2582
  const e = this.getSnapshot();
2583
- if (Bn(e)) return;
2583
+ if (qn(e)) return;
2584
2584
  const t = {
2585
2585
  board_turn_check: {
2586
2586
  has_whiteboard: !1,
2587
2587
  ...e,
2588
- message: Dn
2588
+ message: zn
2589
2589
  }
2590
2590
  };
2591
2591
  try {
@@ -2594,7 +2594,7 @@ class $n {
2594
2594
  }
2595
2595
  }
2596
2596
  }
2597
- function Rn() {
2597
+ function jn() {
2598
2598
  var n;
2599
2599
  if (typeof window > "u") return !1;
2600
2600
  try {
@@ -2607,11 +2607,11 @@ function Rn() {
2607
2607
  }
2608
2608
  return !1;
2609
2609
  }
2610
- let qe = null;
2611
- function rr() {
2612
- return qe === null && (qe = Rn()), qe;
2610
+ let je = null;
2611
+ function lr() {
2612
+ return je === null && (je = jn()), je;
2613
2613
  }
2614
- function nr(n, e, t) {
2614
+ function cr(n, e, t) {
2615
2615
  if (!(typeof window > "u"))
2616
2616
  try {
2617
2617
  const r = window.__VANIRA_DEBUG_LOG__ ?? [];
@@ -2621,13 +2621,13 @@ function nr(n, e, t) {
2621
2621
  }
2622
2622
  }
2623
2623
  function H(n, e, t) {
2624
- rr() && nr(n, e, t);
2624
+ lr() && cr(n, e, t);
2625
2625
  }
2626
- function Un(n, e, t) {
2627
- rr() && nr(n, `WARN ${e}`, t);
2626
+ function dr(n, e, t) {
2627
+ lr() && cr(n, `WARN ${e}`, t);
2628
2628
  }
2629
- const Q = 800, K = 500, On = "#4A9EFF", ue = 2e3, Pt = 80;
2630
- function sr(n) {
2629
+ const Q = 800, K = 500, Wn = "#4A9EFF", ue = 2e3, Dt = 80;
2630
+ function ur(n) {
2631
2631
  if (!document.getElementById("vnr-board-line-styles")) {
2632
2632
  const t = document.createElement("style");
2633
2633
  t.id = "vnr-board-line-styles", t.textContent = `
@@ -2656,17 +2656,17 @@ function sr(n) {
2656
2656
  }
2657
2657
  function Z(n) {
2658
2658
  let e = n.querySelector(".vnr-whiteboard-draw-layer");
2659
- return e || (e = document.createElementNS("http://www.w3.org/2000/svg", "svg"), e.setAttribute("class", "vnr-whiteboard-draw-layer"), e.setAttribute("viewBox", `0 0 ${Q} ${K}`), e.setAttribute("preserveAspectRatio", "xMidYMid meet"), e.style.position = "absolute", e.style.inset = "0", e.style.width = "100%", e.style.height = "100%", e.style.pointerEvents = "none", e.style.zIndex = "0", sr(e), n.insertBefore(e, n.firstChild), e);
2659
+ return e || (e = document.createElementNS("http://www.w3.org/2000/svg", "svg"), e.setAttribute("class", "vnr-whiteboard-draw-layer"), e.setAttribute("viewBox", `0 0 ${Q} ${K}`), e.setAttribute("preserveAspectRatio", "xMidYMid meet"), e.style.position = "absolute", e.style.inset = "0", e.style.width = "100%", e.style.height = "100%", e.style.pointerEvents = "none", e.style.zIndex = "0", ur(e), n.insertBefore(e, n.firstChild), e);
2660
2660
  }
2661
- function Ce(n) {
2661
+ function Ee(n) {
2662
2662
  [...n.childNodes].forEach((e) => {
2663
2663
  e instanceof SVGDefsElement || e.remove();
2664
2664
  });
2665
2665
  }
2666
- function ir(n) {
2667
- sr(n);
2666
+ function hr(n) {
2667
+ ur(n);
2668
2668
  }
2669
- const Me = 6, Fn = "#ffffff";
2669
+ const De = 6, Yn = "#ffffff";
2670
2670
  function B(n, e) {
2671
2671
  if (typeof n == "number" && Number.isFinite(n)) return n;
2672
2672
  if (typeof n == "string" && n.trim() !== "") {
@@ -2686,7 +2686,7 @@ function ie(n) {
2686
2686
  }
2687
2687
  return !1;
2688
2688
  }
2689
- function Mt(n) {
2689
+ function Bt(n) {
2690
2690
  if (n === !1 || n === 0) return !0;
2691
2691
  if (typeof n == "string") {
2692
2692
  const e = n.trim().toLowerCase();
@@ -2694,7 +2694,7 @@ function Mt(n) {
2694
2694
  }
2695
2695
  return !1;
2696
2696
  }
2697
- function Nt(n) {
2697
+ function $t(n) {
2698
2698
  if (n === !0 || n === 1) return !0;
2699
2699
  if (n === !1 || n === 0 || n === null || n === void 0 || n === "") return !1;
2700
2700
  const e = String(n).trim().toLowerCase();
@@ -2703,13 +2703,13 @@ function Nt(n) {
2703
2703
  function ee(n, e) {
2704
2704
  return n >= 0 && n <= 1 ? n * e : n;
2705
2705
  }
2706
- function st(n, e) {
2706
+ function ot(n, e) {
2707
2707
  return {
2708
2708
  bx: ee(n, Q),
2709
2709
  by: ee(e, K)
2710
2710
  };
2711
2711
  }
2712
- function Dt(n) {
2712
+ function Rt(n) {
2713
2713
  if (Array.isArray(n)) return n;
2714
2714
  if (typeof n == "string") {
2715
2715
  const e = n.trim();
@@ -2728,7 +2728,7 @@ function Dt(n) {
2728
2728
  }
2729
2729
  return [];
2730
2730
  }
2731
- function zn(n) {
2731
+ function Gn(n) {
2732
2732
  if (Array.isArray(n)) return n;
2733
2733
  if (typeof n == "string") {
2734
2734
  const e = n.trim();
@@ -2742,11 +2742,11 @@ function zn(n) {
2742
2742
  }
2743
2743
  return [];
2744
2744
  }
2745
- function or(n, e) {
2745
+ function pr(n, e) {
2746
2746
  const t = q(n, e).trim().toLowerCase();
2747
2747
  return !t || t === "#000" || t === "#000000" || t === "black" ? e : q(n, e);
2748
2748
  }
2749
- function ar(n, e) {
2749
+ function fr(n, e) {
2750
2750
  if (!n || typeof n != "object") return null;
2751
2751
  const t = n, r = q(
2752
2752
  t.text ?? t.label ?? t.label_text ?? t.annotation ?? (typeof t.annotations == "string" ? t.annotations : "")
@@ -2759,40 +2759,40 @@ function ar(n, e) {
2759
2759
  x: o,
2760
2760
  y: a,
2761
2761
  text: r,
2762
- color: or(t.color ?? t.label_color, e),
2762
+ color: pr(t.color ?? t.label_color, e),
2763
2763
  font_size: t.font_size != null ? B(t.font_size, 28) : void 0
2764
2764
  };
2765
2765
  }
2766
- function Vn(n, e) {
2766
+ function Jn(n, e) {
2767
2767
  if (!n || typeof n != "object") return null;
2768
2768
  const t = n;
2769
- return t.text != null || t.label != null || t.label_text != null || t.annotation != null || typeof t.annotations == "string" ? ar(n, e) : null;
2769
+ return t.text != null || t.label != null || t.label_text != null || t.annotation != null || typeof t.annotations == "string" ? fr(n, e) : null;
2770
2770
  }
2771
- function qn(n) {
2771
+ function Qn(n) {
2772
2772
  return Array.isArray(n) && n.length > 0 && Array.isArray(n[0]) ? { points: n, close: !0 } : n;
2773
2773
  }
2774
- function lr(n) {
2774
+ function mr(n) {
2775
2775
  if (Array.isArray(n) && n.length >= 2) {
2776
2776
  const e = Number(n[0]), t = Number(n[1]);
2777
- return !Number.isFinite(e) || !Number.isFinite(t) ? null : st(e, t);
2777
+ return !Number.isFinite(e) || !Number.isFinite(t) ? null : ot(e, t);
2778
2778
  }
2779
2779
  if (n && typeof n == "object" && "x" in n && "y" in n) {
2780
2780
  const e = Number(n.x), t = Number(n.y);
2781
- return !Number.isFinite(e) || !Number.isFinite(t) ? null : st(e, t);
2781
+ return !Number.isFinite(e) || !Number.isFinite(t) ? null : ot(e, t);
2782
2782
  }
2783
2783
  return null;
2784
2784
  }
2785
- function Hn(n) {
2785
+ function Kn(n) {
2786
2786
  return ee(n, Math.min(Q, K));
2787
2787
  }
2788
- function jn(n, e, t, r) {
2788
+ function Zn(n, e, t, r) {
2789
2789
  const s = q(n.kind || n.shape).toLowerCase(), i = s === "circle" || s === "ellipse" || n.r != null || n.radius != null || n.rx != null || n.ry != null;
2790
2790
  let o = n.cx ?? n.center_x ?? n.x, a = n.cy ?? n.center_y ?? n.y, l = n.r ?? n.radius;
2791
2791
  const c = n.rx, u = n.ry;
2792
2792
  if (Array.isArray(r) && r.length >= 3) {
2793
2793
  const f = [];
2794
2794
  for (const y of r) {
2795
- const v = lr(y);
2795
+ const v = mr(y);
2796
2796
  v && f.push(v);
2797
2797
  }
2798
2798
  if (f.length >= 8 && i) {
@@ -2812,12 +2812,12 @@ function jn(n, e, t, r) {
2812
2812
  };
2813
2813
  return c != null || u != null ? (h.rx = Number(c ?? u), h.ry = Number(u ?? c), h) : l != null && Number.isFinite(Number(l)) ? (h.r = Number(l), h) : null;
2814
2814
  }
2815
- function it(n, e, t) {
2815
+ function at(n, e, t) {
2816
2816
  if (!n || typeof n != "object") return null;
2817
2817
  const r = n, s = q(r.path_d || r.path || r.d), i = q(r.color, e), o = r.stroke_width != null ? B(r.stroke_width, t) : t;
2818
2818
  if (s)
2819
2819
  return { path_d: s, close: ie(r.close), color: i, stroke_width: o };
2820
- const a = r.points, l = jn(r, e, t, a);
2820
+ const a = r.points, l = Zn(r, e, t, a);
2821
2821
  if (l) return l;
2822
2822
  let c = a;
2823
2823
  if (!Array.isArray(c)) {
@@ -2835,25 +2835,25 @@ function it(n, e, t) {
2835
2835
  }
2836
2836
  return null;
2837
2837
  }
2838
- function He(n, e, t, r, s) {
2838
+ function We(n, e, t, r, s) {
2839
2839
  const i = B(n[e]) ?? (r ? B(n[r]) : void 0), o = B(n[t]) ?? (s ? B(n[s]) : void 0);
2840
2840
  return i === void 0 || o === void 0 ? null : [i, o];
2841
2841
  }
2842
- function Wn(n, e, t) {
2842
+ function Xn(n, e, t) {
2843
2843
  const r = [], s = [], i = q(n.label_text ?? n.text).trim(), o = B(n.label_x ?? n.x), a = B(n.label_y ?? n.y);
2844
2844
  i && o != null && a != null && s.push({ x: o, y: a, text: i, color: t });
2845
- const l = He(n, "p1_x", "p1_y", "x1", "y1"), c = He(n, "p2_x", "p2_y", "x2", "y2"), u = He(n, "p3_x", "p3_y", "x3", "y3");
2845
+ const l = We(n, "p1_x", "p1_y", "x1", "y1"), c = We(n, "p2_x", "p2_y", "x2", "y2"), u = We(n, "p3_x", "p3_y", "x3", "y3");
2846
2846
  if (l && c && u)
2847
2847
  return r.push({ points: [l, c, u], close: !0, color: e }), { strokes: r, labels: s };
2848
2848
  if (l && c)
2849
2849
  return r.push({ points: [l, c], close: !1, color: e }), { strokes: r, labels: s };
2850
- const d = it(
2850
+ const d = at(
2851
2851
  {
2852
2852
  ...n,
2853
2853
  color: n.color ?? e
2854
2854
  },
2855
2855
  e,
2856
- B(n.stroke_width, Me) ?? Me
2856
+ B(n.stroke_width, De) ?? De
2857
2857
  );
2858
2858
  if (d)
2859
2859
  return r.push(d), { strokes: r, labels: s };
@@ -2864,31 +2864,31 @@ function Wn(n, e, t) {
2864
2864
  color: e
2865
2865
  }), { strokes: r, labels: s };
2866
2866
  }
2867
- function Yn(n, e = {}) {
2868
- const t = { ...e, ...n }, r = q(t.color ?? e.color, Fn), s = or(t.label_color ?? e.label_color, On), i = B(t.stroke_width ?? e.stroke_width, Me) ?? Me, o = Nt(t.clear_old_diagrams_on_board) || Nt(t.clear_drawings) || ie(t.clear) || ie(t.clear_before) || ie(e.clear_before), a = Mt(t.animate) || Mt(e.animate);
2869
- let l = Math.max(0, B(t.shape_duration_ms ?? t.duration_ms ?? e.duration_ms, ue) ?? ue), c = Math.max(0, B(t.shape_gap_ms ?? t.gap_ms ?? e.gap_ms, Pt) ?? Pt), u = !a;
2867
+ function es(n, e = {}) {
2868
+ const t = { ...e, ...n }, r = q(t.color ?? e.color, Yn), s = pr(t.label_color ?? e.label_color, Wn), i = B(t.stroke_width ?? e.stroke_width, De) ?? De, o = $t(t.clear_old_diagrams_on_board) || $t(t.clear_drawings) || ie(t.clear) || ie(t.clear_before) || ie(e.clear_before), a = Bt(t.animate) || Bt(e.animate);
2869
+ let l = Math.max(0, B(t.shape_duration_ms ?? t.duration_ms ?? e.duration_ms, ue) ?? ue), c = Math.max(0, B(t.shape_gap_ms ?? t.gap_ms ?? e.gap_ms, Dt) ?? Dt), u = !a;
2870
2870
  u && l > 0 && l < ue && (l = ue), l >= ue && (u = !0);
2871
2871
  const d = [];
2872
- for (const y of zn(t.labels ?? e.labels)) {
2873
- const v = ar(y, s);
2872
+ for (const y of Gn(t.labels ?? e.labels)) {
2873
+ const v = fr(y, s);
2874
2874
  v && d.push(v);
2875
2875
  }
2876
- let p = Dt(t.strokes ?? e.strokes);
2877
- p.length === 0 && (p = Dt(t.annotations ?? e.annotations));
2876
+ let p = Rt(t.strokes ?? e.strokes);
2877
+ p.length === 0 && (p = Rt(t.annotations ?? e.annotations));
2878
2878
  const h = [];
2879
2879
  for (const y of p) {
2880
- const v = qn(y), g = Vn(v, s);
2880
+ const v = Qn(y), g = Jn(v, s);
2881
2881
  if (g) {
2882
2882
  d.push(g);
2883
2883
  continue;
2884
2884
  }
2885
- const b = it(v, r, i);
2885
+ const b = at(v, r, i);
2886
2886
  b && h.push(b);
2887
2887
  }
2888
2888
  if (h.length === 0) {
2889
2889
  const y = t.points ?? e.points;
2890
2890
  if (y != null) {
2891
- const v = it(
2891
+ const v = at(
2892
2892
  {
2893
2893
  points: y,
2894
2894
  close: t.close ?? t.close_path ?? !0,
@@ -2900,7 +2900,7 @@ function Yn(n, e = {}) {
2900
2900
  v && h.push(v);
2901
2901
  }
2902
2902
  }
2903
- const f = Wn(t, r, s);
2903
+ const f = Xn(t, r, s);
2904
2904
  for (const y of f.labels)
2905
2905
  d.some((v) => v.text === y.text && v.x === y.x && v.y === y.y) || d.push(y);
2906
2906
  return h.length === 0 && h.push(...f.strokes), {
@@ -2915,22 +2915,22 @@ function Yn(n, e = {}) {
2915
2915
  labelColor: s
2916
2916
  };
2917
2917
  }
2918
- function Gn(n) {
2918
+ function ts(n) {
2919
2919
  const e = n.points;
2920
2920
  if (!Array.isArray(e)) return [];
2921
2921
  const t = [];
2922
2922
  for (const r of e) {
2923
- const s = lr(r);
2923
+ const s = mr(r);
2924
2924
  s && t.push(s);
2925
2925
  }
2926
2926
  return t;
2927
2927
  }
2928
- function Jn(n, e) {
2928
+ function rs(n, e) {
2929
2929
  if (n.length === 0) return "";
2930
2930
  const t = n.map((r, s) => `${s === 0 ? "M" : "L"} ${r.bx} ${r.by}`).join(" ");
2931
2931
  return e && n.length >= 3 ? `${t} Z` : t;
2932
2932
  }
2933
- function Ne(n, e) {
2933
+ function Be(n, e) {
2934
2934
  return {
2935
2935
  class: "vnr-board-stroke",
2936
2936
  fill: "none",
@@ -2940,61 +2940,61 @@ function Ne(n, e) {
2940
2940
  "stroke-linejoin": "round"
2941
2941
  };
2942
2942
  }
2943
- function De(n, e) {
2943
+ function $e(n, e) {
2944
2944
  for (const [t, r] of Object.entries(e))
2945
2945
  n.setAttribute(t, r);
2946
2946
  }
2947
- function Qn(n, e, t) {
2947
+ function ns(n, e, t) {
2948
2948
  if (n.cx == null || n.cy == null) return null;
2949
2949
  const r = ee(n.cx, Q), s = ee(n.cy, K), i = "http://www.w3.org/2000/svg";
2950
2950
  if (n.kind === "ellipse" || n.rx != null || n.ry != null) {
2951
2951
  const a = n.rx ?? n.r, l = n.ry ?? n.r;
2952
2952
  if (a == null || l == null) return null;
2953
2953
  const c = document.createElementNS(i, "ellipse");
2954
- return c.setAttribute("cx", String(r)), c.setAttribute("cy", String(s)), c.setAttribute("rx", String(ee(Number(a), Q))), c.setAttribute("ry", String(ee(Number(l), K))), De(c, Ne(e, t)), c;
2954
+ return c.setAttribute("cx", String(r)), c.setAttribute("cy", String(s)), c.setAttribute("rx", String(ee(Number(a), Q))), c.setAttribute("ry", String(ee(Number(l), K))), $e(c, Be(e, t)), c;
2955
2955
  }
2956
2956
  if (n.r == null) return null;
2957
2957
  const o = document.createElementNS(i, "circle");
2958
- return o.setAttribute("cx", String(r)), o.setAttribute("cy", String(s)), o.setAttribute("r", String(Hn(Number(n.r)))), De(o, Ne(e, t)), o;
2958
+ return o.setAttribute("cx", String(r)), o.setAttribute("cy", String(s)), o.setAttribute("r", String(Kn(Number(n.r)))), $e(o, Be(e, t)), o;
2959
2959
  }
2960
- function cr(n, e, t) {
2960
+ function vr(n, e, t) {
2961
2961
  const r = q(n.color, e), s = n.stroke_width != null ? B(n.stroke_width, t) ?? t : t;
2962
2962
  if (n.kind === "circle" || n.kind === "ellipse" || n.r != null || n.rx != null || n.ry != null)
2963
- return Qn(n, r, s);
2963
+ return ns(n, r, s);
2964
2964
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path"), a = q(n.path_d);
2965
2965
  if (a)
2966
- return o.setAttribute("d", a), De(o, Ne(r, s)), o;
2967
- const l = Gn(n);
2968
- return l.length < 2 ? null : (o.setAttribute("d", Jn(l, ie(n.close))), De(o, Ne(r, s)), o);
2966
+ return o.setAttribute("d", a), $e(o, Be(r, s)), o;
2967
+ const l = ts(n);
2968
+ return l.length < 2 ? null : (o.setAttribute("d", rs(l, ie(n.close))), $e(o, Be(r, s)), o);
2969
2969
  }
2970
- function dr(n, e) {
2971
- const t = "http://www.w3.org/2000/svg", r = st(n.x, n.y), s = document.createElementNS(t, "text");
2970
+ function yr(n, e) {
2971
+ const t = "http://www.w3.org/2000/svg", r = ot(n.x, n.y), s = document.createElementNS(t, "text");
2972
2972
  return s.setAttribute("class", "vnr-board-label"), s.setAttribute("x", String(r.bx)), s.setAttribute("y", String(r.by)), s.setAttribute("fill", n.color || e), s.setAttribute("font-size", String(n.font_size ?? 28)), s.setAttribute("font-family", "'Architects Daughter', 'Caveat', cursive, sans-serif"), s.setAttribute("text-anchor", "middle"), s.setAttribute("dominant-baseline", "hanging"), s.textContent = n.text, s;
2973
2973
  }
2974
- function Kn(n, e) {
2975
- return e <= 0 ? (n.style.opacity = "1", Promise.resolve()) : (n.style.opacity = "0", n.getBoundingClientRect(), n.style.transition = `opacity ${Math.min(e, 400)}ms ease-out`, n.style.opacity = "1", ct(Math.min(e, 400)));
2974
+ function ss(n, e) {
2975
+ return e <= 0 ? (n.style.opacity = "1", Promise.resolve()) : (n.style.opacity = "0", n.getBoundingClientRect(), n.style.transition = `opacity ${Math.min(e, 400)}ms ease-out`, n.style.opacity = "1", ht(Math.min(e, 400)));
2976
2976
  }
2977
- function Bt(n, e, t) {
2978
- ir(n), Ce(n);
2977
+ function Ut(n, e, t) {
2978
+ hr(n), Ee(n);
2979
2979
  for (const r of e.strokes) {
2980
- const s = cr(r, t.strokeColor, t.strokeWidth);
2980
+ const s = vr(r, t.strokeColor, t.strokeWidth);
2981
2981
  s && n.appendChild(s);
2982
2982
  }
2983
2983
  for (const r of e.labels)
2984
- n.appendChild(dr(r, t.labelColor));
2984
+ n.appendChild(yr(r, t.labelColor));
2985
2985
  }
2986
- async function Zn(n, e, t, r) {
2987
- ir(n);
2986
+ async function is(n, e, t, r) {
2987
+ hr(n);
2988
2988
  let s = 0, i = 0;
2989
2989
  for (const o of e) {
2990
2990
  if (r.isAborted()) break;
2991
- const a = cr(o, r.strokeColor, r.strokeWidth);
2992
- a && (n.appendChild(a), s += 1, r.animate && r.durationMs > 0 && (await Xe(a, r.durationMs), r.gapMs > 0 && await ct(r.gapMs)));
2991
+ const a = vr(o, r.strokeColor, r.strokeWidth);
2992
+ a && (n.appendChild(a), s += 1, r.animate && r.durationMs > 0 && (await tt(a, r.durationMs), r.gapMs > 0 && await ht(r.gapMs)));
2993
2993
  }
2994
2994
  for (const o of t) {
2995
2995
  if (r.isAborted()) break;
2996
- const a = dr(o, r.labelColor);
2997
- n.appendChild(a), i += 1, r.animate && r.durationMs > 0 && await Kn(a, r.durationMs);
2996
+ const a = yr(o, r.labelColor);
2997
+ n.appendChild(a), i += 1, r.animate && r.durationMs > 0 && await ss(a, r.durationMs);
2998
2998
  }
2999
2999
  return { strokesDrawn: s, labelsDrawn: i };
3000
3000
  }
@@ -3004,7 +3004,7 @@ function _e() {
3004
3004
  function fe(n) {
3005
3005
  return n.toLowerCase().replace(/[^a-z0-9]/g, "_");
3006
3006
  }
3007
- function Xn(n) {
3007
+ function os(n) {
3008
3008
  const e = n == null ? void 0 : n.toLowerCase().trim();
3009
3009
  if (e) {
3010
3010
  if (e === "tel")
@@ -3025,11 +3025,11 @@ function Xn(n) {
3025
3025
  return e;
3026
3026
  }
3027
3027
  }
3028
- function ur(n, e, t = []) {
3029
- const r = Xn(e);
3028
+ function gr(n, e, t = []) {
3029
+ const r = os(e);
3030
3030
  return r || (t.length > 0 ? "select" : n.includes("email") ? "email" : n.includes("phone") ? "phone" : n.includes("date") && !n.includes("update") ? "date" : "text");
3031
3031
  }
3032
- function es(n) {
3032
+ function as(n) {
3033
3033
  return n ? Array.isArray(n) ? n.map((e) => {
3034
3034
  if (typeof e == "string")
3035
3035
  return e;
@@ -3043,48 +3043,48 @@ function es(n) {
3043
3043
  return String(e);
3044
3044
  }) : typeof n == "string" ? n.split(",").map((e) => e.trim()).filter(Boolean) : [] : [];
3045
3045
  }
3046
- function ts(n) {
3046
+ function ls(n) {
3047
3047
  const e = n.value ?? n.default ?? n.defaultValue ?? n.prefill;
3048
3048
  if (!(e == null || e === ""))
3049
3049
  return String(e);
3050
3050
  }
3051
- function je(n) {
3051
+ function Ye(n) {
3052
3052
  const e = String(
3053
3053
  n.label ?? n.name ?? n.title ?? n.field ?? n.id ?? n.key ?? ""
3054
3054
  ).trim();
3055
3055
  if (!e)
3056
3056
  return null;
3057
- const t = String(n.id ?? n.key ?? fe(e)), r = es(n.options ?? n.choices ?? n.values), s = ur(t, String(n.type ?? ""), r);
3057
+ const t = String(n.id ?? n.key ?? fe(e)), r = as(n.options ?? n.choices ?? n.values), s = gr(t, String(n.type ?? ""), r);
3058
3058
  return {
3059
3059
  id: t,
3060
3060
  label: e,
3061
3061
  type: s,
3062
3062
  required: n.required !== !1,
3063
3063
  placeholder: n.placeholder ? String(n.placeholder) : void 0,
3064
- value: ts(n),
3064
+ value: ls(n),
3065
3065
  options: r
3066
3066
  };
3067
3067
  }
3068
- function $t(n) {
3068
+ function Ft(n) {
3069
3069
  const e = n.trim(), t = fe(e);
3070
3070
  return {
3071
3071
  id: t,
3072
3072
  label: e,
3073
- type: ur(t),
3073
+ type: gr(t),
3074
3074
  required: !0,
3075
3075
  placeholder: `Enter your ${e.toLowerCase()}`,
3076
3076
  options: []
3077
3077
  };
3078
3078
  }
3079
- function ke(n) {
3079
+ function Te(n) {
3080
3080
  const e = n.trim();
3081
3081
  return e ? e.startsWith("[") || e.startsWith("{") || e.startsWith('"') ? !0 : e.includes('"type"') || e.includes('"options"') || e.includes('"label"') : !1;
3082
3082
  }
3083
- function rs(n) {
3083
+ function cs(n) {
3084
3084
  let e = n.trim();
3085
3085
  for (let t = 0; t < 3 && typeof e == "string"; t++) {
3086
3086
  const r = e.trim();
3087
- if (!ke(r))
3087
+ if (!Te(r))
3088
3088
  break;
3089
3089
  try {
3090
3090
  e = JSON.parse(r);
@@ -3094,8 +3094,8 @@ function rs(n) {
3094
3094
  }
3095
3095
  return e;
3096
3096
  }
3097
- function Ee(n) {
3098
- const e = rs(n);
3097
+ function Ae(n) {
3098
+ const e = cs(n);
3099
3099
  if (Array.isArray(e) || e && typeof e == "object")
3100
3100
  return e;
3101
3101
  if (typeof e == "string") {
@@ -3109,13 +3109,13 @@ function Ee(n) {
3109
3109
  }
3110
3110
  return null;
3111
3111
  }
3112
- function ns(n) {
3112
+ function ds(n) {
3113
3113
  return n.length < 2 ? !1 : n.every(
3114
3114
  (e) => typeof e == "string" && (e.includes('"') || e.includes("{") || e.includes("["))
3115
3115
  );
3116
3116
  }
3117
- function ss(n) {
3118
- return Ee(n.map((e) => e.trim()).join(","));
3117
+ function us(n) {
3118
+ return Ae(n.map((e) => e.trim()).join(","));
3119
3119
  }
3120
3120
  function he(n) {
3121
3121
  if (n == null)
@@ -3124,23 +3124,23 @@ function he(n) {
3124
3124
  const e = n.trim();
3125
3125
  if (!e)
3126
3126
  return [];
3127
- if (ke(e)) {
3128
- const t = Ee(e);
3127
+ if (Te(e)) {
3128
+ const t = Ae(e);
3129
3129
  return t !== null ? he(t) : [];
3130
3130
  }
3131
- return e.split(",").map((t) => t.trim()).filter(Boolean).map($t);
3131
+ return e.split(",").map((t) => t.trim()).filter(Boolean).map(Ft);
3132
3132
  }
3133
3133
  if (Array.isArray(n)) {
3134
3134
  if (n.length === 1 && typeof n[0] == "string") {
3135
3135
  const t = n[0].trim();
3136
- if (ke(t)) {
3137
- const r = Ee(t);
3136
+ if (Te(t)) {
3137
+ const r = Ae(t);
3138
3138
  if (r !== null)
3139
3139
  return he(r);
3140
3140
  }
3141
3141
  }
3142
- if (ns(n)) {
3143
- const t = ss(n);
3142
+ if (ds(n)) {
3143
+ const t = us(n);
3144
3144
  if (t !== null)
3145
3145
  return he(t);
3146
3146
  }
@@ -3150,7 +3150,7 @@ function he(n) {
3150
3150
  const r = t.trim();
3151
3151
  if (r.startsWith("{"))
3152
3152
  try {
3153
- const s = je(
3153
+ const s = Ye(
3154
3154
  JSON.parse(r)
3155
3155
  );
3156
3156
  if (s) {
@@ -3159,38 +3159,38 @@ function he(n) {
3159
3159
  }
3160
3160
  } catch {
3161
3161
  }
3162
- if (ke(r)) {
3163
- const s = Ee(r);
3162
+ if (Te(r)) {
3163
+ const s = Ae(r);
3164
3164
  if (s !== null) {
3165
3165
  e.push(...he(s));
3166
3166
  continue;
3167
3167
  }
3168
3168
  }
3169
- e.push($t(t));
3169
+ e.push(Ft(t));
3170
3170
  continue;
3171
3171
  }
3172
3172
  if (t && typeof t == "object") {
3173
- const r = je(t);
3173
+ const r = Ye(t);
3174
3174
  r && e.push(r);
3175
3175
  }
3176
3176
  }
3177
3177
  return e;
3178
3178
  }
3179
3179
  if (typeof n == "object") {
3180
- const e = je(n);
3180
+ const e = Ye(n);
3181
3181
  return e ? [e] : [];
3182
3182
  }
3183
3183
  return [];
3184
3184
  }
3185
- const is = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, os = /^\+?[0-9\s\-().]{7,20}$/, as = /^\d{4}-\d{2}-\d{2}$/;
3186
- function hr(n, e) {
3185
+ const hs = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, ps = /^\+?[0-9\s\-().]{7,20}$/, fs = /^\d{4}-\d{2}-\d{2}$/;
3186
+ function br(n, e) {
3187
3187
  const t = n[e.id];
3188
3188
  return e.type === "checkbox" ? t === !0 || t === "true" ? "true" : "false" : String(t ?? "").trim();
3189
3189
  }
3190
- function ls(n, e) {
3190
+ function ms(n, e) {
3191
3191
  const t = {};
3192
3192
  for (const r of n) {
3193
- const s = hr(e, r);
3193
+ const s = br(e, r);
3194
3194
  if (r.type === "checkbox") {
3195
3195
  r.required && s !== "true" && (t[r.id] = `${r.label} is required`);
3196
3196
  continue;
@@ -3201,34 +3201,34 @@ function ls(n, e) {
3201
3201
  }
3202
3202
  if (!s)
3203
3203
  continue;
3204
- const i = cs(r.type, s, r.label);
3204
+ const i = vs(r.type, s, r.label);
3205
3205
  i && (t[r.id] = i), (r.type === "select" || r.type === "radio") && r.options.length > 0 && (r.options.map(
3206
3206
  (a) => typeof a == "string" ? a : a.value
3207
3207
  ).includes(s) || (t[r.id] = `Select a valid ${r.label}`));
3208
3208
  }
3209
3209
  return t;
3210
3210
  }
3211
- function cs(n, e, t) {
3211
+ function vs(n, e, t) {
3212
3212
  switch (n) {
3213
3213
  case "email":
3214
- return is.test(e) ? null : `Enter a valid ${t}`;
3214
+ return hs.test(e) ? null : `Enter a valid ${t}`;
3215
3215
  case "phone":
3216
- return os.test(e) ? null : `Enter a valid phone number for ${t}`;
3216
+ return ps.test(e) ? null : `Enter a valid phone number for ${t}`;
3217
3217
  case "number":
3218
3218
  return Number.isFinite(Number(e)) ? null : `${t} must be a number`;
3219
3219
  case "date":
3220
- return as.test(e) ? Number.isNaN(Date.parse(e)) ? `Enter a valid ${t}` : null : `${t} must be YYYY-MM-DD`;
3220
+ return fs.test(e) ? Number.isNaN(Date.parse(e)) ? `Enter a valid ${t}` : null : `${t} must be YYYY-MM-DD`;
3221
3221
  default:
3222
3222
  return null;
3223
3223
  }
3224
3224
  }
3225
- function ds(n, e) {
3225
+ function ys(n, e) {
3226
3226
  const t = {};
3227
3227
  for (const r of n)
3228
- t[r.id] = hr(e, r);
3228
+ t[r.id] = br(e, r);
3229
3229
  return t;
3230
3230
  }
3231
- function pr(n) {
3231
+ function wr(n) {
3232
3232
  if (n == null)
3233
3233
  return {};
3234
3234
  if (typeof n == "string") {
@@ -3236,18 +3236,18 @@ function pr(n) {
3236
3236
  if (!e)
3237
3237
  return {};
3238
3238
  try {
3239
- return pr(JSON.parse(e));
3239
+ return wr(JSON.parse(e));
3240
3240
  } catch {
3241
3241
  return {};
3242
3242
  }
3243
3243
  }
3244
3244
  return typeof n == "object" && !Array.isArray(n) ? n : {};
3245
3245
  }
3246
- function us(n, e) {
3246
+ function gs(n, e) {
3247
3247
  const t = n.prefill ?? n.values ?? n.initial_values ?? n.defaults ?? e.prefill ?? e.values ?? e.initial_values ?? e.defaults;
3248
- return pr(t);
3248
+ return wr(t);
3249
3249
  }
3250
- function ot(n, e) {
3250
+ function lt(n, e) {
3251
3251
  if (n.type === "checkbox") {
3252
3252
  if (typeof e == "boolean")
3253
3253
  return e;
@@ -3256,34 +3256,34 @@ function ot(n, e) {
3256
3256
  }
3257
3257
  return String(e ?? "").trim();
3258
3258
  }
3259
- function hs(n, e) {
3259
+ function bs(n, e) {
3260
3260
  const t = [n.id, n.label, n.label.toLowerCase()];
3261
3261
  for (const s of t) {
3262
3262
  if (!(s in e))
3263
3263
  continue;
3264
3264
  const i = e[s];
3265
3265
  if (!(i == null || i === ""))
3266
- return ot(n, i);
3266
+ return lt(n, i);
3267
3267
  }
3268
3268
  const r = fe(n.label);
3269
3269
  for (const [s, i] of Object.entries(e))
3270
3270
  if (!(i == null || i === "") && (s === r || fe(s) === r || fe(s) === n.id))
3271
- return ot(n, i);
3271
+ return lt(n, i);
3272
3272
  }
3273
- function ps(n, e = {}) {
3273
+ function ws(n, e = {}) {
3274
3274
  const t = {};
3275
3275
  for (const r of n) {
3276
3276
  if (r.value !== void 0) {
3277
- t[r.id] = ot(r, r.value);
3277
+ t[r.id] = lt(r, r.value);
3278
3278
  continue;
3279
3279
  }
3280
- const s = hs(r, e);
3280
+ const s = bs(r, e);
3281
3281
  t[r.id] = s !== void 0 ? s : r.type === "checkbox" ? !1 : "";
3282
3282
  }
3283
3283
  return t;
3284
3284
  }
3285
- const Rt = "vanira:board_abort";
3286
- function We(n) {
3285
+ const Ot = "vanira:board_abort";
3286
+ function Ge(n) {
3287
3287
  if (!n) return "";
3288
3288
  if (typeof n == "string") {
3289
3289
  if (n.includes("T") || !isNaN(Date.parse(n)))
@@ -3306,7 +3306,7 @@ function We(n) {
3306
3306
  }
3307
3307
  return String(n);
3308
3308
  }
3309
- function fs(n, e, t, r) {
3309
+ function _s(n, e, t, r) {
3310
3310
  let s = Date.UTC(n, e, t, 0, 0, 0, 0), i = Date.UTC(n, e, t, 23, 59, 59, 999);
3311
3311
  if (r)
3312
3312
  try {
@@ -3331,7 +3331,7 @@ function fs(n, e, t, r) {
3331
3331
  end: new Date(i)
3332
3332
  };
3333
3333
  }
3334
- function ms(n, e) {
3334
+ function xs(n, e) {
3335
3335
  if (!e) {
3336
3336
  const t = -n.getTimezoneOffset(), r = t >= 0 ? "+" : "-", s = (o) => String(o).padStart(2, "0"), i = (o) => String(o).padStart(3, "0");
3337
3337
  return n.getFullYear() + "-" + s(n.getMonth() + 1) + "-" + s(n.getDate()) + "T" + s(n.getHours()) + ":" + s(n.getMinutes()) + ":" + s(n.getSeconds()) + "." + i(n.getMilliseconds()) + r + s(Math.floor(Math.abs(t) / 60)) + ":" + s(Math.abs(t) % 60);
@@ -3358,7 +3358,7 @@ function ms(n, e) {
3358
3358
  return n.toISOString();
3359
3359
  }
3360
3360
  }
3361
- const vs = `
3361
+ const Ss = `
3362
3362
  .vnr-overlay {
3363
3363
  position: fixed; inset: 0; z-index: 2147483647;
3364
3364
  background: rgba(0,0,0,0.45);
@@ -3548,26 +3548,117 @@ const vs = `
3548
3548
  color: #fecaca;
3549
3549
  }
3550
3550
  .vnr-whiteboard-action-btn.is-close:hover { background: rgba(239,68,68,0.2); }
3551
- `, ys = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>', gs = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>', bs = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', ws = "vanira:board-size", _s = {
3551
+ `, Cs = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>', ks = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>', Es = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', Ts = "vanira:board-size", As = {
3552
3552
  small: { maxWidth: "min(440px, 94vw)", height: "min(340px, 58vh)" },
3553
3553
  medium: { maxWidth: "min(680px, 96vw)", height: "min(520px, 78vh)" },
3554
3554
  large: { maxWidth: "min(920px, 98vw)", height: "min(680px, 88vh)" }
3555
3555
  };
3556
- function xs() {
3556
+ function Is() {
3557
3557
  try {
3558
- const n = localStorage.getItem(ws);
3558
+ const n = localStorage.getItem(Ts);
3559
3559
  if (n === "small" || n === "medium" || n === "large") return n;
3560
3560
  } catch {
3561
3561
  }
3562
3562
  return "medium";
3563
3563
  }
3564
- function Ut(n, e) {
3564
+ function Vt(n, e) {
3565
3565
  return e === 1 ? n : n.replace(/(\d+(?:\.\d+)?)(px|vw|vh)/g, (t, r, s) => {
3566
3566
  const i = Number(r) * e;
3567
3567
  return `${s === "px" ? Math.round(i) : i}${s}`;
3568
3568
  });
3569
3569
  }
3570
- class Ss {
3570
+ function zt(n) {
3571
+ n.style.cssText = [
3572
+ "position:fixed",
3573
+ "left:-2000px",
3574
+ "top:0",
3575
+ "width:640px",
3576
+ "height:480px",
3577
+ "opacity:0.01",
3578
+ "pointer-events:none",
3579
+ "z-index:-1"
3580
+ ].join(";");
3581
+ }
3582
+ async function xe(n, e = 8e3) {
3583
+ return await n.play().catch(() => {
3584
+ }), n.videoWidth > 0 && n.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && await qt(n, 1500) ? !0 : new Promise((t) => {
3585
+ let r = !1;
3586
+ const s = async (a) => {
3587
+ if (!r) {
3588
+ if (r = !0, n.removeEventListener("loadeddata", i), n.removeEventListener("playing", i), clearTimeout(o), !a) {
3589
+ t(!1);
3590
+ return;
3591
+ }
3592
+ t(await qt(n, 1500));
3593
+ }
3594
+ }, i = () => {
3595
+ n.videoWidth > 0 && s(!0);
3596
+ };
3597
+ n.addEventListener("loadeddata", i), n.addEventListener("playing", i);
3598
+ const o = setTimeout(() => void s(n.videoWidth > 0), e);
3599
+ i();
3600
+ });
3601
+ }
3602
+ function qt(n, e) {
3603
+ const t = n.requestVideoFrameCallback;
3604
+ return typeof t != "function" ? Promise.resolve(n.videoWidth > 0) : new Promise((r) => {
3605
+ const s = setTimeout(() => r(!1), e);
3606
+ t.call(n, () => {
3607
+ clearTimeout(s), r(n.videoWidth > 0);
3608
+ });
3609
+ });
3610
+ }
3611
+ function Se(n, e) {
3612
+ if (e) {
3613
+ const t = e.querySelector("video");
3614
+ if (t && t.videoWidth > 0) return t;
3615
+ }
3616
+ return n;
3617
+ }
3618
+ function _r(n, e, t) {
3619
+ const r = Math.min(e, 48), s = Math.min(t, 48);
3620
+ if (r <= 0 || s <= 0) return !0;
3621
+ const { data: i } = n.getImageData(0, 0, r, s);
3622
+ let o = 0;
3623
+ const a = i.length / 4;
3624
+ for (let l = 0; l < i.length; l += 4)
3625
+ o += i[l] * 0.299 + i[l + 1] * 0.587 + i[l + 2] * 0.114;
3626
+ return o / a < 14;
3627
+ }
3628
+ async function Ls(n, e, t = 0.75) {
3629
+ if (!n || n.videoWidth === 0) return null;
3630
+ const r = n.videoWidth, s = n.videoHeight, i = Math.min(1, e / r), o = document.createElement("canvas");
3631
+ o.width = Math.round(r * i), o.height = Math.round(s * i);
3632
+ const a = o.getContext("2d", { willReadFrequently: !0 });
3633
+ return !a || (a.drawImage(n, 0, 0, o.width, o.height), _r(a, o.width, o.height)) ? null : await new Promise((l) => {
3634
+ o.toBlob((c) => l(c), "image/jpeg", t);
3635
+ });
3636
+ }
3637
+ async function ct(n, e, t, r = 0.75) {
3638
+ const s = await Ls(n, t, r);
3639
+ if (s) return s;
3640
+ const i = e == null ? void 0 : e.getVideoTracks()[0];
3641
+ if (!i || i.readyState !== "live" || typeof ImageCapture > "u")
3642
+ return null;
3643
+ try {
3644
+ const a = await new ImageCapture(i).grabFrame(), l = Math.min(1, t / a.width), c = Math.round(a.width * l), u = Math.round(a.height * l), d = document.createElement("canvas");
3645
+ d.width = c, d.height = u;
3646
+ const p = d.getContext("2d", { willReadFrequently: !0 });
3647
+ return p ? (p.drawImage(a, 0, 0, c, u), a.close(), _r(p, c, u) ? null : await new Promise((h) => {
3648
+ d.toBlob((f) => h(f), "image/jpeg", r);
3649
+ })) : (a.close(), null);
3650
+ } catch (o) {
3651
+ return dr("[LiveCapture]", `ImageCapture failed: ${o instanceof Error ? o.message : String(o)}`), null;
3652
+ }
3653
+ }
3654
+ async function Ht(n, e, t, r = 20, s = 250) {
3655
+ for (let i = 0; i < r; i++) {
3656
+ if (await ct(n, e, t, 0.6)) return !0;
3657
+ await new Promise((a) => setTimeout(a, s));
3658
+ }
3659
+ return !1;
3660
+ }
3661
+ class Ps {
3571
3662
  constructor(e) {
3572
3663
  _(this, "overlay", null);
3573
3664
  _(this, "styleInjected", !1);
@@ -3623,13 +3714,13 @@ class Ss {
3623
3714
  _(this, "activeModalPreset", null);
3624
3715
  /** WebRTC / VaniraAI client for silent board context updates */
3625
3716
  _(this, "boardClient", null);
3626
- _(this, "boardTurnMonitor", new $n(
3717
+ _(this, "boardTurnMonitor", new Hn(
3627
3718
  () => this.buildBoardVerification(),
3628
3719
  () => this.boardQueueActive !== null || this.boardQueue.length > 0 || this.boardDrawInProgress || this.activeBoardProgress !== null
3629
3720
  ));
3630
3721
  /** Progress for the active board animation (for interrupt % / LLM message) */
3631
3722
  _(this, "activeBoardProgress", null);
3632
- _(this, "boardSizePreset", xs());
3723
+ _(this, "boardSizePreset", Is());
3633
3724
  _(this, "boardViewMode", "expanded");
3634
3725
  _(this, "boardDragPosition", null);
3635
3726
  _(this, "boardDragWiredModal", null);
@@ -3642,7 +3733,7 @@ class Ss {
3642
3733
  * Used on call end / dismiss (does not send client_tool_result).
3643
3734
  */
3644
3735
  resetBoardSession() {
3645
- this.boardTurnMonitor.stop(), this.boardDragPosition = null, this.boardDragWiredModal = null, this.activePresetGeneration++, Ve(!1), this.clearBoardAnimTimer(), this.boardQueue = [], this.boardQueueActive = null, this.settledBoardToolCallIds.clear(), this.activeBoardProgress = null, this.boardClient = null, this.chalkboardContent = "", this.boardChapterTitle = "", this.boardDrawInProgress = !1, this.boardInk = _e(), this.closeBoardUi();
3736
+ this.boardTurnMonitor.stop(), this.boardDragPosition = null, this.boardDragWiredModal = null, this.activePresetGeneration++, He(!1), this.clearBoardAnimTimer(), this.boardQueue = [], this.boardQueueActive = null, this.settledBoardToolCallIds.clear(), this.activeBoardProgress = null, this.boardClient = null, this.chalkboardContent = "", this.boardChapterTitle = "", this.boardDrawInProgress = !1, this.boardInk = _e(), this.closeBoardUi();
3646
3737
  }
3647
3738
  /** Current whiteboard text (partial or complete) */
3648
3739
  getChalkboardContent() {
@@ -3702,7 +3793,7 @@ class Ss {
3702
3793
  };
3703
3794
  }
3704
3795
  syncDiagramLayer(e) {
3705
- Bt(e, this.boardInk, {
3796
+ Ut(e, this.boardInk, {
3706
3797
  strokeColor: "#ffffff",
3707
3798
  labelColor: "#4A9EFF",
3708
3799
  strokeWidth: 6
@@ -3765,7 +3856,7 @@ class Ss {
3765
3856
  reason: t || (e === "interrupted" ? "Server interrupted" : "User dismissed"),
3766
3857
  ...r ? { preset_id: r } : {}
3767
3858
  };
3768
- if (!r || !pt(r))
3859
+ if (!r || !vt(r))
3769
3860
  return s;
3770
3861
  const i = this.chalkboardContent, o = this.getBoardProgressSnapshot();
3771
3862
  return {
@@ -3825,7 +3916,7 @@ class Ss {
3825
3916
  o = {};
3826
3917
  }
3827
3918
  else a && typeof a == "object" && (o = a);
3828
- const l = i.client_fields || {}, c = at(
3919
+ const l = i.client_fields || {}, c = dt(
3829
3920
  l,
3830
3921
  a,
3831
3922
  i.name || i.tool_name
@@ -3840,7 +3931,7 @@ class Ss {
3840
3931
  };
3841
3932
  this.injectStyles();
3842
3933
  const p = !!document.querySelector(".vnr-whiteboard-modal");
3843
- switch (pt(c) ? p || this.dismissNonBoardUi() : Ir(c) || Lr(c) || this.dismiss(), c) {
3934
+ switch (vt(c) ? p || this.dismissNonBoardUi() : Rr(c) || Ur(c) || this.dismiss(), c) {
3844
3935
  case m.Calendar:
3845
3936
  return this.renderCalendar(d, t, r), !0;
3846
3937
  case m.Form:
@@ -3922,19 +4013,19 @@ class Ss {
3922
4013
  case m.ScreenClick:
3923
4014
  return this.renderScreenClick(d, t, r), !0;
3924
4015
  case m.ClearScreenOverlay:
3925
- return Pe(), t({
4016
+ return Ne(), t({
3926
4017
  status: "success",
3927
4018
  preset_id: m.ClearScreenOverlay,
3928
4019
  message: "Screen overlay cleared"
3929
4020
  }), !0;
3930
4021
  case m.PageScan:
3931
- return In(d, t, r, s), !0;
4022
+ return Rn(d, t, r, s), !0;
3932
4023
  case m.PointAt:
3933
- return Ln(d, t, r), !0;
4024
+ return Un(d, t, r), !0;
3934
4025
  case m.OutlineTargets:
3935
- return Pn(d, t, r), !0;
4026
+ return Fn(d, t, r), !0;
3936
4027
  case m.ClearGuide:
3937
- return Mn(d, t), !0;
4028
+ return On(d, t), !0;
3938
4029
  default:
3939
4030
  return !1;
3940
4031
  }
@@ -3959,11 +4050,11 @@ class Ss {
3959
4050
  }
3960
4051
  /** Force-dismiss the active preset (call on disconnect) */
3961
4052
  dismiss() {
3962
- this.activeNavigate && !this.activeNavigate.settled && this.cancelNavigate("Session ended", "interrupted"), this.activeModalPreset = null, this.resetBoardSession(), this.stopCaptureCamera(), this.handleCloseLiveCamera(null), this.handleCloseLiveScreen(null), Fe(), this.overlay && (this.overlay.remove(), this.overlay = null);
4053
+ this.activeNavigate && !this.activeNavigate.settled && this.cancelNavigate("Session ended", "interrupted"), this.activeModalPreset = null, this.resetBoardSession(), this.stopCaptureCamera(), this.handleCloseLiveCamera(null), this.handleCloseLiveScreen(null), ze(), this.overlay && (this.overlay.remove(), this.overlay = null);
3963
4054
  }
3964
4055
  /** End-of-session teardown — modals + screen ink. */
3965
4056
  teardownSession() {
3966
- this.dismiss(), Pe();
4057
+ this.dismiss(), Ne();
3967
4058
  }
3968
4059
  enqueueBoardCommand(e, t) {
3969
4060
  var s;
@@ -3989,7 +4080,7 @@ class Ss {
3989
4080
  e.presetId === m.TypeText ? this.renderTypeText(e.ctx, r, s) : e.presetId === m.Draw ? this.renderDrawShapes(e.ctx, r, s) : e.presetId === m.EraseDraw ? this.renderEraseDrawingBoard(e.ctx, r, s) : this.renderEraseText(e.ctx, r, s);
3990
4081
  }
3991
4082
  closeBoardUi() {
3992
- this.boardTurnMonitor.stop(), this.boardViewMode = "expanded", Ve(!1), this.dismissWhiteboard(), this.overlay && (!document.body.contains(this.overlay) || !this.overlay.childElementCount) && (this.overlay.remove(), this.overlay = null);
4083
+ this.boardTurnMonitor.stop(), this.boardViewMode = "expanded", He(!1), this.dismissWhiteboard(), this.overlay && (!document.body.contains(this.overlay) || !this.overlay.childElementCount) && (this.overlay.remove(), this.overlay = null);
3993
4084
  }
3994
4085
  getBoardOverlay() {
3995
4086
  const e = document.querySelector(".vnr-whiteboard-modal");
@@ -3999,7 +4090,7 @@ class Ss {
3999
4090
  const r = e ?? this.getBoardOverlay(), s = t ?? document.querySelector(".vnr-whiteboard-modal");
4000
4091
  if (!r || !s) return;
4001
4092
  const i = this.boardViewMode === "reduced";
4002
- r.classList.remove("vnr-whiteboard-overlay-hidden"), r.classList.add("vnr-whiteboard-overlay"), r.classList.toggle("vnr-whiteboard-overlay-reduced", i), r.classList.toggle("vnr-whiteboard-overlay-expanded", !i), this.syncBoardResizeButton(s.querySelector(".vnr-whiteboard-resize-btn")), Ve(!0, i), this.syncBoardDragLayout(s), this.ensureBoardTurnMonitor();
4093
+ r.classList.remove("vnr-whiteboard-overlay-hidden"), r.classList.add("vnr-whiteboard-overlay"), r.classList.toggle("vnr-whiteboard-overlay-reduced", i), r.classList.toggle("vnr-whiteboard-overlay-expanded", !i), this.syncBoardResizeButton(s.querySelector(".vnr-whiteboard-resize-btn")), He(!0, i), this.syncBoardDragLayout(s), this.ensureBoardTurnMonitor();
4003
4094
  }
4004
4095
  clearBoardDragStyles(e) {
4005
4096
  e.style.removeProperty("position"), e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom"), e.style.removeProperty("margin"), e.style.removeProperty("transform");
@@ -4058,7 +4149,7 @@ class Ss {
4058
4149
  }
4059
4150
  /** Close camera/form overlays without tearing down an active chalkboard session */
4060
4151
  dismissNonBoardUi() {
4061
- this.stopCaptureCamera(), this.handleCloseLiveCamera(null), this.handleCloseLiveScreen(null), Fe(), this.overlay && !this.overlay.querySelector(".vnr-whiteboard-modal") && (this.overlay.remove(), this.overlay = null);
4152
+ this.stopCaptureCamera(), this.handleCloseLiveCamera(null), this.handleCloseLiveScreen(null), ze(), this.overlay && !this.overlay.querySelector(".vnr-whiteboard-modal") && (this.overlay.remove(), this.overlay = null);
4062
4153
  }
4063
4154
  settleBoardCancel(e, t, r = "cancelled") {
4064
4155
  if (e.settled) return;
@@ -4175,20 +4266,26 @@ class Ss {
4175
4266
  const s = e.scope ?? "until_call_end", i = Math.min(Number(e.target_fps ?? 1), Number(e.max_fps ?? 3)), o = Number(e.max_width ?? 640), a = e.reason ?? "camera_capture", l = Number(e.duration_sec ?? 0), c = e.facing_mode ?? "environment", u = e.show_preview !== !1 && e.show_preview !== "false", d = `lv_${crypto.randomUUID()}`;
4176
4267
  this.lvSessionId = d, this.lvFrameSeq = 0;
4177
4268
  const p = document.createElement("video");
4178
- p.autoplay = !0, p.playsInline = !0, p.muted = !0, p.style.display = "none", document.body.appendChild(p), this.lvVideo = p;
4269
+ p.autoplay = !0, p.playsInline = !0, p.muted = !0, zt(p), document.body.appendChild(p), this.lvVideo = p;
4179
4270
  const h = document.createElement("canvas");
4180
4271
  h.style.display = "none", document.body.appendChild(h), this.lvCanvas = h, u && (this.lvPip = this.createLivePip(c, () => this.handleCloseLiveCamera(t))), (() => {
4181
4272
  navigator.mediaDevices.getUserMedia({ video: { facingMode: c, width: { ideal: o * 2 } } }).then(async (y) => {
4182
- var g;
4273
+ var b;
4183
4274
  if (!this.lvSessionId) {
4184
- y.getTracks().forEach((b) => b.stop());
4275
+ y.getTracks().forEach((S) => S.stop());
4185
4276
  return;
4186
4277
  }
4187
- if ((g = this.lvPermissionBanner) == null || g.remove(), this.lvPermissionBanner = null, this.lvStream = y, p.srcObject = y, this.lvPip) {
4188
- const b = this.lvPip.querySelector("video");
4189
- b && (b.srcObject = y);
4278
+ if ((b = this.lvPermissionBanner) == null || b.remove(), this.lvPermissionBanner = null, this.lvStream = y, p.srcObject = y, this.lvPip) {
4279
+ const S = this.lvPip.querySelector("video");
4280
+ S && (S.srcObject = y, await xe(S));
4190
4281
  }
4191
- await this.sendClientEvent(t, "client_live_camera_started", {
4282
+ await xe(p);
4283
+ const v = Se(p, this.lvPip) ?? p;
4284
+ await Ht(
4285
+ v,
4286
+ y,
4287
+ o
4288
+ ), await this.sendClientEvent(t, "client_live_camera_started", {
4192
4289
  data: {
4193
4290
  session_id: d,
4194
4291
  scope: s,
@@ -4197,10 +4294,10 @@ class Ss {
4197
4294
  target_fps: i
4198
4295
  }
4199
4296
  });
4200
- const v = Math.round(1e3 / i);
4297
+ const g = Math.round(1e3 / i);
4201
4298
  this.lvCaptureInterval = setInterval(() => {
4202
4299
  this.captureAndSendFrame(t, d, o, a);
4203
- }, v), s === "timed" && l > 0 && (this.lvAutoStopTimeout = setTimeout(() => {
4300
+ }, g), s === "timed" && l > 0 && (this.lvAutoStopTimeout = setTimeout(() => {
4204
4301
  this.handleCloseLiveCamera(t);
4205
4302
  }, l * 1e3));
4206
4303
  }).catch((y) => {
@@ -4288,39 +4385,42 @@ class Ss {
4288
4385
  const s = e.scope ?? "until_call_end", i = Math.min(Number(e.target_fps ?? 1), Number(e.max_fps ?? 3)), o = Number(e.max_width ?? 1280), a = e.reason ?? "screen_capture", l = Number(e.duration_sec ?? 0), c = e.prefer_current_tab === !0 || e.prefer_current_tab === "true", u = e.show_preview !== !1 && e.show_preview !== "false", d = `ls_${crypto.randomUUID()}`;
4289
4386
  this.lsSessionId = d, this.lsFrameSeq = 0;
4290
4387
  const p = document.createElement("video");
4291
- p.autoplay = !0, p.playsInline = !0, p.muted = !0, p.style.display = "none", document.body.appendChild(p), this.lsVideo = p;
4388
+ p.autoplay = !0, p.playsInline = !0, p.muted = !0, zt(p), document.body.appendChild(p), this.lsVideo = p;
4292
4389
  const h = document.createElement("canvas");
4293
4390
  h.style.display = "none", document.body.appendChild(h), this.lsCanvas = h, u && (this.lsPip = this.createLiveScreenPip(() => this.handleCloseLiveScreen(t))), (() => {
4294
4391
  const v = c ? { displaySurface: "browser" } : !0;
4295
4392
  navigator.mediaDevices.getDisplayMedia({ video: v, audio: !1 }).then(async (g) => {
4296
- var x, C;
4393
+ var C, k;
4297
4394
  if (!this.lsSessionId) {
4298
- g.getTracks().forEach((k) => k.stop());
4395
+ g.getTracks().forEach((E) => E.stop());
4299
4396
  return;
4300
4397
  }
4301
- (x = this.lsPermissionBanner) == null || x.remove(), this.lsPermissionBanner = null, this.lsStream = g, p.srcObject = g;
4398
+ (C = this.lsPermissionBanner) == null || C.remove(), this.lsPermissionBanner = null, this.lsStream = g, p.srcObject = g;
4302
4399
  const b = g.getVideoTracks()[0];
4303
4400
  if (b && (b.onended = () => {
4304
4401
  this.handleCloseLiveScreen(t);
4305
4402
  }), this.lsPip) {
4306
- const k = this.lsPip.querySelector("video");
4307
- k && (k.srcObject = g);
4403
+ const E = this.lsPip.querySelector("video");
4404
+ E && (E.srcObject = g, await xe(E));
4308
4405
  }
4309
- const S = ((C = b == null ? void 0 : b.getSettings) == null ? void 0 : C.call(b).displaySurface) ?? "unknown";
4406
+ await xe(p);
4407
+ const S = Se(p, this.lsPip) ?? p;
4408
+ await Ht(S, g, o, 12, 200);
4409
+ const w = ((k = b == null ? void 0 : b.getSettings) == null ? void 0 : k.call(b).displaySurface) ?? "unknown";
4310
4410
  await this.sendClientEvent(t, "client_live_screen_started", {
4311
4411
  data: {
4312
4412
  session_id: d,
4313
4413
  scope: s,
4314
4414
  ...s === "timed" && l > 0 ? { duration_sec: l } : {},
4315
- display_surface: S,
4415
+ display_surface: w,
4316
4416
  reason: a,
4317
4417
  target_fps: i
4318
4418
  }
4319
4419
  });
4320
- const w = Math.round(1e3 / i);
4420
+ const x = Math.round(1e3 / i);
4321
4421
  this.lsCaptureInterval = setInterval(() => {
4322
4422
  this.captureAndSendScreenFrame(t, d, o, a);
4323
- }, w), s === "timed" && l > 0 && (this.lsAutoStopTimeout = setTimeout(() => {
4423
+ }, x), s === "timed" && l > 0 && (this.lsAutoStopTimeout = setTimeout(() => {
4324
4424
  this.handleCloseLiveScreen(t);
4325
4425
  }, l * 1e3));
4326
4426
  }).catch((g) => {
@@ -4369,41 +4469,38 @@ class Ss {
4369
4469
  }
4370
4470
  async captureAndSendScreenFrame(e, t, r, s) {
4371
4471
  if (!e || !this.lsVideo || !this.lsCanvas || !this.lsSessionId) return;
4372
- const i = this.lsVideo;
4373
- if (i.readyState < 2) return;
4374
- const o = this.lsCanvas, a = i.videoWidth || r, l = i.videoHeight || r, c = Math.min(1, r / a);
4375
- o.width = Math.round(a * c), o.height = Math.round(l * c);
4376
- const u = o.getContext("2d");
4377
- if (!u) return;
4378
- u.drawImage(i, 0, 0, o.width, o.height);
4379
- let d;
4472
+ const i = Se(this.lsVideo, this.lsPip);
4473
+ if (!i || i.readyState < 2 || i.videoWidth === 0) return;
4474
+ let o;
4380
4475
  try {
4381
- d = await new Promise(
4382
- (p, h) => o.toBlob((f) => f ? p(f) : h(new Error("toBlob failed")), "image/jpeg", 0.75)
4383
- );
4476
+ o = await ct(i, this.lsStream, r, 0.75);
4384
4477
  } catch {
4385
4478
  return;
4386
4479
  }
4480
+ if (!o)
4481
+ return;
4482
+ const a = this.lsCanvas, l = i.videoWidth || r, c = i.videoHeight || r, u = Math.min(1, r / l);
4483
+ a.width = Math.round(l * u), a.height = Math.round(c * u);
4387
4484
  try {
4388
- const { media_id: p, url: h, content_type: f } = await this.uploadLiveStreamFrame(
4485
+ const { media_id: d, url: p, content_type: h } = await this.uploadLiveStreamFrame(
4389
4486
  e,
4390
- d,
4487
+ o,
4391
4488
  t,
4392
4489
  s
4393
4490
  );
4394
- if (!this.lsSessionId || this.lsSessionId !== t || !p || !h)
4491
+ if (!this.lsSessionId || this.lsSessionId !== t || !d || !p)
4395
4492
  return;
4396
- const y = ++this.lsFrameSeq;
4493
+ const f = ++this.lsFrameSeq;
4397
4494
  await this.sendClientEvent(e, "client_media_frame", {
4398
4495
  data: {
4399
4496
  session_id: t,
4400
4497
  source: "screen",
4401
- frame_seq: y,
4402
- media_id: p,
4403
- media_url: h,
4404
- content_type: f,
4498
+ frame_seq: f,
4499
+ media_id: d,
4500
+ media_url: p,
4501
+ content_type: h,
4405
4502
  reason: s,
4406
- viewport: { width: o.width, height: o.height }
4503
+ viewport: { width: a.width, height: a.height }
4407
4504
  }
4408
4505
  });
4409
4506
  } catch {
@@ -4444,38 +4541,35 @@ class Ss {
4444
4541
  }
4445
4542
  async captureAndSendFrame(e, t, r, s) {
4446
4543
  if (!e || !this.lvVideo || !this.lvCanvas || !this.lvSessionId) return;
4447
- const i = this.lvVideo;
4448
- if (i.readyState < 2) return;
4449
- const o = this.lvCanvas, a = i.videoWidth || r, l = i.videoHeight || r, c = Math.min(1, r / a);
4450
- o.width = Math.round(a * c), o.height = Math.round(l * c);
4451
- const u = o.getContext("2d");
4452
- if (!u) return;
4453
- u.drawImage(i, 0, 0, o.width, o.height);
4454
- let d;
4544
+ const i = Se(this.lvVideo, this.lvPip);
4545
+ if (!i || i.readyState < 2 || i.videoWidth === 0) return;
4546
+ let o;
4455
4547
  try {
4456
- d = await new Promise(
4457
- (p, h) => o.toBlob((f) => f ? p(f) : h(new Error("toBlob failed")), "image/jpeg", 0.75)
4458
- );
4548
+ o = await ct(i, this.lvStream, r, 0.75);
4459
4549
  } catch {
4460
4550
  return;
4461
4551
  }
4552
+ if (!o)
4553
+ return;
4554
+ const a = this.lvCanvas, l = i.videoWidth || r, c = i.videoHeight || r, u = Math.min(1, r / l);
4555
+ a.width = Math.round(l * u), a.height = Math.round(c * u);
4462
4556
  try {
4463
- const { media_id: p, url: h, content_type: f } = await this.uploadLiveStreamFrame(
4557
+ const { media_id: d, url: p, content_type: h } = await this.uploadLiveStreamFrame(
4464
4558
  e,
4465
- d,
4559
+ o,
4466
4560
  t,
4467
4561
  s
4468
4562
  );
4469
- if (!this.lvSessionId || this.lvSessionId !== t || !p || !h)
4563
+ if (!this.lvSessionId || this.lvSessionId !== t || !d || !p)
4470
4564
  return;
4471
- const y = ++this.lvFrameSeq;
4565
+ const f = ++this.lvFrameSeq;
4472
4566
  await this.sendClientEvent(e, "client_media_frame", {
4473
4567
  data: {
4474
4568
  session_id: t,
4475
- frame_seq: y,
4476
- media_id: p,
4477
- media_url: h,
4478
- content_type: f,
4569
+ frame_seq: f,
4570
+ media_id: d,
4571
+ media_url: p,
4572
+ content_type: h,
4479
4573
  reason: s
4480
4574
  }
4481
4575
  });
@@ -4521,7 +4615,7 @@ class Ss {
4521
4615
  injectStyles() {
4522
4616
  if (this.styleInjected || document.getElementById("vnr-preset-styles")) return;
4523
4617
  const e = document.createElement("style");
4524
- e.id = "vnr-preset-styles", e.textContent = vs, document.head.appendChild(e), this.styleInjected = !0;
4618
+ e.id = "vnr-preset-styles", e.textContent = Ss, document.head.appendChild(e), this.styleInjected = !0;
4525
4619
  }
4526
4620
  createOverlay() {
4527
4621
  const e = document.createElement("div");
@@ -4574,13 +4668,13 @@ class Ss {
4574
4668
  this.dismiss(), i("User cancelled");
4575
4669
  }), f.addEventListener("click", () => {
4576
4670
  if (!this.calSelectedTs || !this.calSelectedTime) return;
4577
- const v = new Date(this.calSelectedTs), g = We(this.calSelectedTime), b = v.getFullYear(), S = String(v.getMonth() + 1).padStart(2, "0"), w = String(v.getDate()).padStart(2, "0"), x = `${b}-${S}-${w}`, C = e.clientFields.timezone || "";
4671
+ const v = new Date(this.calSelectedTs), g = Ge(this.calSelectedTime), b = v.getFullYear(), S = String(v.getMonth() + 1).padStart(2, "0"), w = String(v.getDate()).padStart(2, "0"), x = `${b}-${S}-${w}`, C = e.clientFields.timezone || "";
4578
4672
  let k = typeof this.calSelectedTime == "object" ? { ...this.calSelectedTime } : void 0;
4579
4673
  if (k) {
4580
4674
  for (const E of ["start", "startTime", "end", "endTime"])
4581
4675
  if (k[E] && typeof k[E] == "string" && (k[E].includes("T") || !isNaN(Date.parse(k[E]))))
4582
4676
  try {
4583
- k[E] = ms(new Date(k[E]), C);
4677
+ k[E] = xs(new Date(k[E]), C);
4584
4678
  } catch {
4585
4679
  }
4586
4680
  }
@@ -4638,7 +4732,7 @@ class Ss {
4638
4732
  this.renderSlots(t, ["09:00 AM", "10:30 AM", "01:00 PM", "02:30 PM", "04:00 PM"], r);
4639
4733
  return;
4640
4734
  }
4641
- const i = new Date(this.calSelectedTs), o = i.getFullYear(), a = String(i.getMonth() + 1).padStart(2, "0"), l = String(i.getDate()).padStart(2, "0"), c = `${o}-${a}-${l}`, u = e.clientFields.timezone || "", d = fs(o, i.getMonth(), i.getDate(), u), p = d.start, h = d.end, f = (w) => {
4735
+ const i = new Date(this.calSelectedTs), o = i.getFullYear(), a = String(i.getMonth() + 1).padStart(2, "0"), l = String(i.getDate()).padStart(2, "0"), c = `${o}-${a}-${l}`, u = e.clientFields.timezone || "", d = _s(o, i.getMonth(), i.getDate(), u), p = d.start, h = d.end, f = (w) => {
4642
4736
  if (typeof w != "string") return w;
4643
4737
  let x = w.replace(/\{\{date\}\}/g, c).replace(/\{\{timezone\}\}/g, u).replace(/\{\{start_of_day\}\}/g, p.toISOString()).replace(/\{\{end_of_day\}\}/g, h.toISOString());
4644
4738
  return Object.entries(e.clientFields).forEach(([C, k]) => {
@@ -4688,7 +4782,7 @@ class Ss {
4688
4782
  });
4689
4783
  }
4690
4784
  renderSlots(e, t, r) {
4691
- const s = this.calSelectedTs ? new Date(this.calSelectedTs).toLocaleDateString("en-US", { weekday: "long", month: "short", day: "numeric" }) : "Available Times", i = t.some((a) => We(a).length > 8) ? 2 : 3;
4785
+ const s = this.calSelectedTs ? new Date(this.calSelectedTs).toLocaleDateString("en-US", { weekday: "long", month: "short", day: "numeric" }) : "Available Times", i = t.some((a) => Ge(a).length > 8) ? 2 : 3;
4692
4786
  if (e.style.display = "block", e.innerHTML = `
4693
4787
  <div class="vnr-divider"></div>
4694
4788
  <div class="vnr-section-label">${s}</div>
@@ -4697,7 +4791,7 @@ class Ss {
4697
4791
  const o = e.querySelector(".vnr-slots-grid");
4698
4792
  t.forEach((a) => {
4699
4793
  const l = document.createElement("button");
4700
- l.className = "vnr-slot-btn", this.calSelectedTime !== null && (typeof a == "object" && typeof this.calSelectedTime == "object" ? JSON.stringify(a) === JSON.stringify(this.calSelectedTime) : a === this.calSelectedTime) && l.classList.add("vnr-slot-sel"), l.textContent = We(a), l.addEventListener("click", () => {
4794
+ l.className = "vnr-slot-btn", this.calSelectedTime !== null && (typeof a == "object" && typeof this.calSelectedTime == "object" ? JSON.stringify(a) === JSON.stringify(this.calSelectedTime) : a === this.calSelectedTime) && l.classList.add("vnr-slot-sel"), l.textContent = Ge(a), l.addEventListener("click", () => {
4701
4795
  this.calSelectedTime = a, r.disabled = !1, o.querySelectorAll(".vnr-slot-btn").forEach((u) => u.classList.remove("vnr-slot-sel")), l.classList.add("vnr-slot-sel");
4702
4796
  }), o.appendChild(l);
4703
4797
  });
@@ -4798,9 +4892,9 @@ class Ss {
4798
4892
  this.clearActiveModalPreset(), t({ status: "success", preset_id: m.Form, ...v });
4799
4893
  }, i = (v) => {
4800
4894
  this.clearActiveModalPreset(), r(v, { status: "cancelled" });
4801
- }, o = e.args.title || e.clientFields.title || "Please fill out this form", a = e.args.reason || "Please provide the following information.", l = he(e.args.fields ?? e.clientFields.fields), c = ps(
4895
+ }, o = e.args.title || e.clientFields.title || "Please fill out this form", a = e.args.reason || "Please provide the following information.", l = he(e.args.fields ?? e.clientFields.fields), c = ws(
4802
4896
  l,
4803
- us(e.args, e.clientFields)
4897
+ gs(e.args, e.clientFields)
4804
4898
  ), u = this.createOverlay(), d = this.createModal(u, o, a);
4805
4899
  d.querySelector(".vnr-close-btn").addEventListener("click", () => {
4806
4900
  this.dismiss(), i("User closed");
@@ -4834,7 +4928,7 @@ class Ss {
4834
4928
  h.textContent = "No form fields configured.", h.style.display = "block";
4835
4929
  return;
4836
4930
  }
4837
- const v = this.collectFormFieldValues(d, l), g = ls(l, v);
4931
+ const v = this.collectFormFieldValues(d, l), g = ms(l, v);
4838
4932
  if (Object.keys(g).length > 0) {
4839
4933
  this.showFormFieldErrors(d, g), h.textContent = "Please fix the highlighted fields.", h.style.display = "block";
4840
4934
  const S = Object.keys(g)[0], w = d.querySelector(`[data-field-id="${S}"]`), x = w == null ? void 0 : w.querySelector("input, textarea, select");
@@ -4842,7 +4936,7 @@ class Ss {
4842
4936
  return;
4843
4937
  }
4844
4938
  h.style.display = "none", this.showFormFieldErrors(d, {}), y.disabled = !0, y.innerHTML = '<div class="vnr-spinner"></div>';
4845
- const b = ds(l, v);
4939
+ const b = ys(l, v);
4846
4940
  setTimeout(() => {
4847
4941
  this.dismiss(), s(b);
4848
4942
  }, 300);
@@ -4915,7 +5009,7 @@ class Ss {
4915
5009
  }), v.querySelector("#vnr-cam-cancel").addEventListener("click", () => {
4916
5010
  D(), this.captureActive = !1, this.dismiss(), o("User cancelled");
4917
5011
  });
4918
- const O = () => {
5012
+ const F = () => {
4919
5013
  this.captureActive && (S.style.display = "flex", S.innerHTML = `
4920
5014
  <div class="vnr-spinner" style="width:32px;height:32px;border-width:3px;border-color:rgba(255,255,255,.15);border-top-color:#fff"></div>
4921
5015
  <p style="margin:0;font-size:13px;color:#94a3b8">Opening camera…</p>
@@ -4932,48 +5026,48 @@ class Ss {
4932
5026
  const T = document.createElement("div");
4933
5027
  T.className = "vnr-live-badge", T.innerHTML = '<span class="vnr-live-dot"></span>LIVE', v.querySelector("#vnr-cam-wrap").appendChild(T);
4934
5028
  }
4935
- C.checked = p, F();
5029
+ C.checked = p, O();
4936
5030
  }
4937
5031
  }).catch(() => {
4938
5032
  this.captureActive && (this.notifyCameraPermissionDenied(s, e.toolCallId), this.fillCameraPermissionPrompt(S, {
4939
- onRetry: O,
5033
+ onRetry: F,
4940
5034
  onDismiss: () => {
4941
5035
  D(), this.captureActive = !1, this.dismiss(), o("Camera permission denied", "cancelled");
4942
5036
  }
4943
5037
  }));
4944
5038
  }));
4945
5039
  };
4946
- O();
4947
- function F() {
5040
+ F();
5041
+ function O() {
4948
5042
  f && (clearInterval(f), f = null, a.captureLivenessInterval = null), C.checked ? (k.style.display = "block", L.style.display = "block", x.disabled = !0, A()) : (k.style.display = "none", L.style.display = "none", x.disabled = !1);
4949
5043
  }
4950
- C.addEventListener("change", F);
5044
+ C.addEventListener("change", O);
4951
5045
  function A() {
4952
5046
  let T = null;
4953
5047
  const M = [];
4954
- let R = 1, U = 0, G = 0, ve = 0, ut = !1;
4955
- const Be = document.createElement("canvas"), ht = Be.getContext("2d");
4956
- Be.width = 80, Be.height = 60, E.style.width = "0%", E.style.backgroundColor = "#6366f1", I.style.color = "#6366f1", I.innerText = "0%", L.style.borderColor = "rgba(255,255,255,0.45)", L.style.boxShadow = "0 0 0 9999px rgba(15,23,42,0.6)", $.innerText = "Align your face in center", $.style.color = "#fff", f = setInterval(() => {
5048
+ let R = 1, U = 0, G = 0, ve = 0, ft = !1;
5049
+ const Re = document.createElement("canvas"), mt = Re.getContext("2d");
5050
+ Re.width = 80, Re.height = 60, E.style.width = "0%", E.style.backgroundColor = "#6366f1", I.style.color = "#6366f1", I.innerText = "0%", L.style.borderColor = "rgba(255,255,255,0.45)", L.style.boxShadow = "0 0 0 9999px rgba(15,23,42,0.6)", $.innerText = "Align your face in center", $.style.color = "#fff", f = setInterval(() => {
4957
5051
  if (!h || g.paused || g.ended) return;
4958
- ht.drawImage(g, 0, 0, 80, 60);
4959
- const re = ht.getImageData(0, 0, 80, 60).data;
5052
+ mt.drawImage(g, 0, 0, 80, 60);
5053
+ const re = mt.getImageData(0, 0, 80, 60).data;
4960
5054
  if (T) {
4961
5055
  let ye = 0;
4962
- for (let z = 0; z < re.length; z += 4)
4963
- ye += Math.abs(re[z] - T[z]), ye += Math.abs(re[z + 1] - T[z + 1]), ye += Math.abs(re[z + 2] - T[z + 2]);
5056
+ for (let V = 0; V < re.length; V += 4)
5057
+ ye += Math.abs(re[V] - T[V]), ye += Math.abs(re[V + 1] - T[V + 1]), ye += Math.abs(re[V + 2] - T[V + 2]);
4964
5058
  const ge = ye / (re.length / 4 * 3);
4965
5059
  if (G === 0) {
4966
5060
  ve++, M.push(ge);
4967
- const z = Math.min(100, Math.round(ve / 15 * 100));
4968
- E.style.width = `${z * 0.3}%`, I.innerText = `${Math.round(z * 0.3)}%`, $.innerText = "Hold still to calibrate…", $.style.color = "#a5b4fc", ve >= 15 && (R = M.reduce((fr, mr) => fr + mr, 0) / M.length, R < 0.2 && (R = 0.2), G = 1, ve = 0, E.style.width = "30%", I.innerText = "30%");
5061
+ const V = Math.min(100, Math.round(ve / 15 * 100));
5062
+ E.style.width = `${V * 0.3}%`, I.innerText = `${Math.round(V * 0.3)}%`, $.innerText = "Hold still to calibrate…", $.style.color = "#a5b4fc", ve >= 15 && (R = M.reduce((xr, Sr) => xr + Sr, 0) / M.length, R < 0.2 && (R = 0.2), G = 1, ve = 0, E.style.width = "30%", I.innerText = "30%");
4969
5063
  } else if (G === 1) {
4970
5064
  $.innerText = "Now blink or turn head slightly", $.style.color = "#ffd2d2";
4971
- const z = Math.max(3, R * 3.5);
4972
- if (ge > z && ge < 30) {
4973
- U += 15, U > 70 && (U = 70, ut = !0);
4974
- const $e = 30 + U;
4975
- E.style.width = `${$e}%`, I.innerText = `${$e}%`;
4976
- } else ut && ge <= z * 1.5 && (G = 2, E.style.width = "100%", E.style.backgroundColor = "#10b981", I.innerText = "100%", I.style.color = "#10b981", $.innerText = "✓ Liveness Verified! Click Capture & Send.", $.style.color = "#10b981", L.style.borderColor = "#10b981", L.style.boxShadow = "0 0 0 9999px rgba(16,185,129,0.2)", x.disabled = !1, f && (clearInterval(f), f = null, a.captureLivenessInterval = null));
5065
+ const V = Math.max(3, R * 3.5);
5066
+ if (ge > V && ge < 30) {
5067
+ U += 15, U > 70 && (U = 70, ft = !0);
5068
+ const Ue = 30 + U;
5069
+ E.style.width = `${Ue}%`, I.innerText = `${Ue}%`;
5070
+ } else ft && ge <= V * 1.5 && (G = 2, E.style.width = "100%", E.style.backgroundColor = "#10b981", I.innerText = "100%", I.style.color = "#10b981", $.innerText = "✓ Liveness Verified! Click Capture & Send.", $.style.color = "#10b981", L.style.borderColor = "#10b981", L.style.boxShadow = "0 0 0 9999px rgba(16,185,129,0.2)", x.disabled = !1, f && (clearInterval(f), f = null, a.captureLivenessInterval = null));
4977
5071
  }
4978
5072
  }
4979
5073
  T = re;
@@ -5007,13 +5101,13 @@ class Ss {
5007
5101
  const i = e.args ?? {}, o = String(i.reason ?? e.clientFields.reason ?? "page_clip"), a = String(i.prompt ?? i.message ?? e.clientFields.default_prompt ?? "").trim(), l = String(
5008
5102
  e.clientFields.hint ?? (a ? `Select the area to answer: "${a}"` : "Drag to select an area — release to clip.")
5009
5103
  ), c = Number(e.clientFields.min_region_px ?? 24), u = (d) => {
5010
- Fe(), r(d, { status: "cancelled" });
5104
+ ze(), r(d, { status: "cancelled" });
5011
5105
  };
5012
5106
  if (typeof document > "u") {
5013
5107
  u("Page clip is only available in browser environments");
5014
5108
  return;
5015
5109
  }
5016
- Jr({ hint: l, minSizePx: c }).then(async (d) => {
5110
+ nn({ hint: l, minSizePx: c }).then(async (d) => {
5017
5111
  if (!d) {
5018
5112
  u("User cancelled region selection");
5019
5113
  return;
@@ -5082,9 +5176,9 @@ class Ss {
5082
5176
  }
5083
5177
  (async () => {
5084
5178
  try {
5085
- const u = er({
5179
+ const u = or({
5086
5180
  maxElements: Number.isFinite(c) ? c : 80
5087
- }), d = Xr(u), h = `${a ? `Tab snapshot captured. Context: ${a}` : "Tab snapshot of the visible page captured."}
5181
+ }), d = ln(u), h = `${a ? `Tab snapshot captured. Context: ${a}` : "Tab snapshot of the visible page captured."}
5088
5182
 
5089
5183
  COORDINATES ARE NORMALIZED VIEWPORT (0–1), NOT JPEG PIXELS. viewport=${u.viewport.width}x${u.viewport.height}
5090
5184
 
@@ -5106,9 +5200,9 @@ ${d}`, f = {
5106
5200
  ...f
5107
5201
  }), (async () => {
5108
5202
  try {
5109
- let y = await Yt();
5110
- Number.isFinite(l) && l > 0 && (y = Gt(y, l));
5111
- const v = await lt(y), g = new File([v], `tab-${Date.now()}.jpg`, { type: "image/jpeg" }), b = s == null ? void 0 : s.uploadMediaForToolResult;
5203
+ let y = await Xt();
5204
+ Number.isFinite(l) && l > 0 && (y = er(y, l));
5205
+ const v = await ut(y), g = new File([v], `tab-${Date.now()}.jpg`, { type: "image/jpeg" }), b = s == null ? void 0 : s.uploadMediaForToolResult;
5112
5206
  b && typeof b == "function" && await b.call(s, g, o);
5113
5207
  } catch {
5114
5208
  }
@@ -5261,7 +5355,7 @@ ${d}`, f = {
5261
5355
  });
5262
5356
  }
5263
5357
  dispatchAgentNavigate(e, t) {
5264
- zr(e, { presetId: t.presetId, toolName: t.toolName });
5358
+ Jr(e, { presetId: t.presetId, toolName: t.toolName });
5265
5359
  const r = {
5266
5360
  url: e,
5267
5361
  path: e,
@@ -5423,8 +5517,8 @@ ${d}`, f = {
5423
5517
  l && h.showCursor({ x: d, y: p, color: o, duration_ms: 800 }), a && h.showClickRipple(d, p, o);
5424
5518
  let f = "", y = "";
5425
5519
  if (c) {
5426
- const v = xn(d, p);
5427
- v && (Sn(v), f = v.tagName.toLowerCase(), y = v.id || "");
5520
+ const v = Ln(d, p);
5521
+ v && (Pn(v), f = v.tagName.toLowerCase(), y = v.id || "");
5428
5522
  }
5429
5523
  t({
5430
5524
  status: "success",
@@ -5669,13 +5763,13 @@ ${d}`, f = {
5669
5763
  e.dispatchEvent(new MouseEvent("mousedown", i)), e.dispatchEvent(new MouseEvent("mouseup", i)), e.dispatchEvent(new MouseEvent("click", i));
5670
5764
  }
5671
5765
  applyBoardSizeToModal(e) {
5672
- const t = _s[this.boardSizePreset], r = this.boardViewMode === "reduced" ? 0.5 : 1, s = Ut(t.maxWidth, r), i = Ut(t.height, r);
5766
+ const t = As[this.boardSizePreset], r = this.boardViewMode === "reduced" ? 0.5 : 1, s = Vt(t.maxWidth, r), i = Vt(t.height, r);
5673
5767
  e.style.setProperty("width", s, "important"), e.style.setProperty("max-width", s, "important"), e.style.setProperty("height", i, "important"), e.style.setProperty("max-height", i, "important"), e.classList.toggle("is-reduced", r < 1), this.boardViewMode === "reduced" && this.syncBoardDragLayout(e);
5674
5768
  }
5675
5769
  syncBoardResizeButton(e) {
5676
5770
  if (!e) return;
5677
5771
  const t = this.boardViewMode === "reduced";
5678
- e.innerHTML = t ? gs : ys, e.setAttribute("aria-label", t ? "Restore board size" : "Shrink board to half size"), e.title = t ? "Restore board size" : "Shrink board to half size";
5772
+ e.innerHTML = t ? ks : Cs, e.setAttribute("aria-label", t ? "Restore board size" : "Shrink board to half size"), e.title = t ? "Restore board size" : "Shrink board to half size";
5679
5773
  }
5680
5774
  toggleBoardReduced(e) {
5681
5775
  const t = this.boardViewMode === "reduced";
@@ -5700,7 +5794,7 @@ ${d}`, f = {
5700
5794
  const s = document.createElement("button");
5701
5795
  s.type = "button", s.className = "vnr-whiteboard-action-btn vnr-whiteboard-resize-btn", s.onclick = () => this.toggleBoardReduced(e);
5702
5796
  const i = document.createElement("button");
5703
- i.type = "button", i.className = "vnr-whiteboard-action-btn is-close vnr-whiteboard-close-btn", i.innerHTML = bs, i.setAttribute("aria-label", "Close board"), i.title = "Close board", i.onclick = () => {
5797
+ i.type = "button", i.className = "vnr-whiteboard-action-btn is-close vnr-whiteboard-close-btn", i.innerHTML = Es, i.setAttribute("aria-label", "Close board"), i.title = "Close board", i.onclick = () => {
5704
5798
  if (this.activePresetGeneration++, t)
5705
5799
  try {
5706
5800
  t();
@@ -5816,7 +5910,7 @@ ${d}`, f = {
5816
5910
  const s = this.boardInk.strokes.length, i = this.boardInk.labels.length, o = s > 0 || i > 0, a = document.querySelector(".vnr-whiteboard-textarea");
5817
5911
  if (a) {
5818
5912
  const l = this.getBoardDrawZone(a), c = Z(l);
5819
- Ce(c);
5913
+ Ee(c);
5820
5914
  const u = a.closest(".vnr-whiteboard-canvas-wrap");
5821
5915
  u && this.syncBoardLayout(u);
5822
5916
  } else if (o) {
@@ -5824,7 +5918,7 @@ ${d}`, f = {
5824
5918
  const l = document.querySelector(".vnr-whiteboard-textarea");
5825
5919
  if (l) {
5826
5920
  const c = this.getBoardDrawZone(l);
5827
- Ce(Z(c));
5921
+ Ee(Z(c));
5828
5922
  const u = l.closest(".vnr-whiteboard-canvas-wrap");
5829
5923
  u && this.syncBoardLayout(u);
5830
5924
  }
@@ -5848,7 +5942,7 @@ ${d}`, f = {
5848
5942
  renderDrawShapes(e, t, r) {
5849
5943
  const s = { ...e.clientFields || {}, ...e.args || {} };
5850
5944
  this.syncChalkboardNotes();
5851
- const i = Yn(s, e.clientFields || {}), o = this.activePresetGeneration;
5945
+ const i = es(s, e.clientFields || {}), o = this.activePresetGeneration;
5852
5946
  if (H("Board:Draw", "draw_on_board invoked", {
5853
5947
  toolCallId: e.toolCallId,
5854
5948
  strokes: i.strokes.length,
@@ -5857,7 +5951,7 @@ ${d}`, f = {
5857
5951
  animate: i.animate,
5858
5952
  shape_duration_ms: i.durationMs
5859
5953
  }), !i.clearBefore && i.strokes.length === 0 && i.labels.length === 0) {
5860
- Un("Board:Draw", "No strokes or labels", s), t({
5954
+ dr("Board:Draw", "No strokes or labels", s), t({
5861
5955
  status: "error",
5862
5956
  preset_id: m.Draw,
5863
5957
  message: "Provide strokes[] or labels[] (same as vanira_screen_ink), or flat points/path_d/label_text+coords. Use clear_old_diagrams_on_board:true to wipe the diagram.",
@@ -5873,7 +5967,7 @@ ${d}`, f = {
5873
5967
  this.syncChalkboardNotes();
5874
5968
  const l = this.getBoardDrawZone(a), c = Z(l);
5875
5969
  if (i.clearBefore) {
5876
- Ce(c), this.boardInk = _e();
5970
+ Ee(c), this.boardInk = _e();
5877
5971
  const p = a.closest(".vnr-whiteboard-canvas-wrap");
5878
5972
  p && this.syncBoardLayout(p), H("Board:Draw", "Cleared old diagrams on board (notes kept)");
5879
5973
  }
@@ -5920,11 +6014,11 @@ ${d}`, f = {
5920
6014
  this.boardInk.strokes.push(...i.strokes), this.boardInk.labels.push(...i.labels), this.syncDiagramLayer(c), u(i.strokes.length, i.labels.length);
5921
6015
  return;
5922
6016
  }
5923
- (this.boardInk.strokes.length > 0 || this.boardInk.labels.length > 0) && Bt(c, this.boardInk, {
6017
+ (this.boardInk.strokes.length > 0 || this.boardInk.labels.length > 0) && Ut(c, this.boardInk, {
5924
6018
  strokeColor: i.strokeColor,
5925
6019
  labelColor: i.labelColor,
5926
6020
  strokeWidth: i.strokeWidth
5927
- }), Zn(c, i.strokes, i.labels, {
6021
+ }), is(c, i.strokes, i.labels, {
5928
6022
  strokeColor: i.strokeColor,
5929
6023
  labelColor: i.labelColor,
5930
6024
  strokeWidth: i.strokeWidth,
@@ -5998,10 +6092,10 @@ ${E}` : E, $ = this.activePresetGeneration, D = d <= 0;
5998
6092
  unitsDone: 0
5999
6093
  }, D) {
6000
6094
  this.chalkboardContent = I + L, k.value = this.chalkboardContent, k.scrollTop = k.scrollHeight;
6001
- const O = k.closest(".vnr-whiteboard-canvas-wrap");
6002
- if (O) {
6003
- const F = O.querySelector(".vnr-whiteboard-draw-zone");
6004
- this.syncBoardChapterTitle(F), this.syncBoardLayout(O);
6095
+ const F = k.closest(".vnr-whiteboard-canvas-wrap");
6096
+ if (F) {
6097
+ const O = F.querySelector(".vnr-whiteboard-draw-zone");
6098
+ this.syncBoardChapterTitle(O), this.syncBoardLayout(F);
6005
6099
  }
6006
6100
  this.syncBoardProgressUnits(L.length), H("Board:Type", "Chalkboard typed (instant)", {
6007
6101
  chars: this.chalkboardContent.length,
@@ -6017,13 +6111,13 @@ ${E}` : E, $ = this.activePresetGeneration, D = d <= 0;
6017
6111
  ...this.buildBoardVerification()
6018
6112
  });
6019
6113
  } else {
6020
- let O = I, F = 0;
6114
+ let F = I, O = 0;
6021
6115
  const A = () => {
6022
6116
  if ($ !== this.activePresetGeneration) {
6023
- this.chalkboardContent = O, k.value = O;
6117
+ this.chalkboardContent = F, k.value = F;
6024
6118
  return;
6025
6119
  }
6026
- document.body.contains(k) && (F < L.length ? (O += L[F], this.chalkboardContent = O, k.value = O, k.scrollTop = k.scrollHeight, F++, this.syncBoardProgressUnits(F), this.scheduleBoardAnim(A, d)) : (this.syncBoardProgressUnits(L.length), h({
6120
+ document.body.contains(k) && (O < L.length ? (F += L[O], this.chalkboardContent = F, k.value = F, k.scrollTop = k.scrollHeight, O++, this.syncBoardProgressUnits(O), this.scheduleBoardAnim(A, d)) : (this.syncBoardProgressUnits(L.length), h({
6027
6121
  status: "success",
6028
6122
  preset_id: m.TypeText,
6029
6123
  typing_mode: "append",
@@ -6166,17 +6260,17 @@ ${E}` : E, $ = this.activePresetGeneration, D = d <= 0;
6166
6260
  return s;
6167
6261
  }
6168
6262
  }
6169
- function Ot(n) {
6263
+ function jt(n) {
6170
6264
  const e = (n == null ? void 0 : n.data) || n;
6171
6265
  return String((e == null ? void 0 : e.tool_call_id) || (e == null ? void 0 : e.call_id) || "");
6172
6266
  }
6173
- const Bs = gr(function({
6267
+ const qs = Er(function({
6174
6268
  client: e,
6175
6269
  toolCall: t = null,
6176
6270
  onCustomTool: r
6177
6271
  }, s) {
6178
6272
  const i = oe(null), o = oe(/* @__PURE__ */ new Set()), a = oe(/* @__PURE__ */ new Set()), l = oe([]), c = oe(!1);
6179
- be(() => (i.current = new Ss(null), () => {
6273
+ be(() => (i.current = new Ps(null), () => {
6180
6274
  var h;
6181
6275
  (h = i.current) == null || h.resetBoardSession();
6182
6276
  }), []), be(() => {
@@ -6188,25 +6282,25 @@ const Bs = gr(function({
6188
6282
  y.toolCallId
6189
6283
  );
6190
6284
  };
6191
- return window.addEventListener(Rt, h), () => window.removeEventListener(Rt, h);
6285
+ return window.addEventListener(Ot, h), () => window.removeEventListener(Ot, h);
6192
6286
  }, []);
6193
- const u = Re(() => {
6287
+ const u = Fe(() => {
6194
6288
  if (c.current || !i.current || !e) return;
6195
6289
  const h = l.current.shift();
6196
6290
  if (!h) return;
6197
6291
  c.current = !0;
6198
- const f = h.data || h, y = f.arguments || f.args, v = f.client_fields || {}, g = at(
6292
+ const f = h.data || h, y = f.arguments || f.args, v = f.client_fields || {}, g = dt(
6199
6293
  v,
6200
6294
  y,
6201
6295
  f.name || f.tool_name
6202
- ), b = Ot(h), S = () => {
6296
+ ), b = jt(h), S = () => {
6203
6297
  c.current = !1, l.current.length > 0 && u();
6204
6298
  };
6205
6299
  if (!g || !W(g)) {
6206
6300
  r && r(h), S();
6207
6301
  return;
6208
6302
  }
6209
- !Er(g) && e.sendContextUpdate && b && (e.sendToolResult(b, {
6303
+ !Dr(g) && e.sendContextUpdate && b && (e.sendToolResult(b, {
6210
6304
  status: "popup_shown",
6211
6305
  message: `The UI preset ${g} is now visible. I am waiting for the user to complete it. STAY SILENT.`
6212
6306
  }), e.sendContextUpdate({
@@ -6222,21 +6316,21 @@ const Bs = gr(function({
6222
6316
  return;
6223
6317
  }
6224
6318
  const C = typeof x == "string" ? { response: x } : x;
6225
- if (Ye(g)) {
6319
+ if (Je(g)) {
6226
6320
  S();
6227
6321
  return;
6228
6322
  }
6229
- if (mt(g)) {
6323
+ if (gt(g)) {
6230
6324
  (C == null ? void 0 : C.status) !== "cancelled" && !o.current.has(b) && (o.current.add(b), e.sendToolResult(b, C)), S();
6231
6325
  return;
6232
6326
  }
6233
- if (Ge(g)) {
6327
+ if (Qe(g)) {
6234
6328
  if ((C == null ? void 0 : C.status) === "cancelled") {
6235
6329
  S();
6236
6330
  return;
6237
6331
  }
6238
6332
  (k = e.triggerActionInterrupt) == null || k.call(e);
6239
- const I = ft(
6333
+ const I = yt(
6240
6334
  g,
6241
6335
  f.name || f.tool_name || "",
6242
6336
  v
@@ -6245,7 +6339,7 @@ const Bs = gr(function({
6245
6339
  return;
6246
6340
  }
6247
6341
  e.triggerActionInterrupt && e.triggerActionInterrupt(), e.sendActionTrigger ? e.sendActionTrigger(
6248
- ft(
6342
+ yt(
6249
6343
  g,
6250
6344
  f.name || f.tool_name || "",
6251
6345
  v
@@ -6259,7 +6353,7 @@ const Bs = gr(function({
6259
6353
  S();
6260
6354
  return;
6261
6355
  }
6262
- if (mt(g)) {
6356
+ if (gt(g)) {
6263
6357
  const I = (C == null ? void 0 : C.status) ?? "cancelled", L = String(
6264
6358
  v.target_url || (typeof y == "object" && y ? y.target_url : "") || ""
6265
6359
  );
@@ -6282,7 +6376,7 @@ const Bs = gr(function({
6282
6376
  )), S();
6283
6377
  return;
6284
6378
  }
6285
- if (Ye(g))
6379
+ if (Je(g))
6286
6380
  try {
6287
6381
  e.sendToolResult(b, {
6288
6382
  status: "cancelled",
@@ -6291,7 +6385,7 @@ const Bs = gr(function({
6291
6385
  });
6292
6386
  } catch {
6293
6387
  }
6294
- else if (Ge(g))
6388
+ else if (Qe(g))
6295
6389
  if (typeof e.sendToolError == "function")
6296
6390
  e.sendToolError(b, x || "User cancelled the action");
6297
6391
  else
@@ -6308,24 +6402,24 @@ const Bs = gr(function({
6308
6402
  },
6309
6403
  e
6310
6404
  ) || (r && r(h), S());
6311
- }, [e, r]), d = Re((h) => {
6312
- const f = Ot(h);
6405
+ }, [e, r]), d = Fe((h) => {
6406
+ const f = jt(h);
6313
6407
  if (f) {
6314
6408
  if (a.current.has(f)) return;
6315
6409
  a.current.add(f);
6316
6410
  }
6317
6411
  l.current.push(h), u();
6318
- }, [u]), p = Re(() => {
6412
+ }, [u]), p = Fe(() => {
6319
6413
  var h, f;
6320
- l.current = [], c.current = !1, a.current.clear(), o.current.clear(), (h = i.current) != null && h.hasActiveBoardSession() || ((f = i.current) == null || f.dismiss(), Pe());
6414
+ l.current = [], c.current = !1, a.current.clear(), o.current.clear(), (h = i.current) != null && h.hasActiveBoardSession() || ((f = i.current) == null || f.dismiss(), Ne());
6321
6415
  }, []);
6322
- return br(s, () => ({ enqueueToolCall: d, clearQueue: p }), [d, p]), be(() => {
6416
+ return Tr(s, () => ({ enqueueToolCall: d, clearQueue: p }), [d, p]), be(() => {
6323
6417
  t && d(t);
6324
6418
  }, [t, d]), be(() => {
6325
6419
  e || p();
6326
6420
  }, [e, p]), null;
6327
6421
  });
6328
- class Cs {
6422
+ class Ms {
6329
6423
  constructor(e) {
6330
6424
  _(this, "el");
6331
6425
  this.el = new Audio(), this.el.srcObject = e, this.el.play().catch(
@@ -6342,12 +6436,12 @@ class Cs {
6342
6436
  this.el.onended = e;
6343
6437
  }
6344
6438
  }
6345
- class ks {
6439
+ class Ns {
6346
6440
  createRemotePlayer(e) {
6347
- return new Cs(e);
6441
+ return new Ms(e);
6348
6442
  }
6349
6443
  }
6350
- class Es {
6444
+ class Ds {
6351
6445
  async getUserAudio(e) {
6352
6446
  return navigator.mediaDevices.getUserMedia({ audio: e });
6353
6447
  }
@@ -6355,7 +6449,7 @@ class Es {
6355
6449
  e.getTracks().forEach((t) => t.stop());
6356
6450
  }
6357
6451
  }
6358
- class Ts {
6452
+ class Bs {
6359
6453
  create(e) {
6360
6454
  return new RTCPeerConnection({
6361
6455
  iceServers: e.iceServers,
@@ -6363,7 +6457,7 @@ class Ts {
6363
6457
  });
6364
6458
  }
6365
6459
  }
6366
- class As {
6460
+ class $s {
6367
6461
  bind(e, t) {
6368
6462
  return e.onopen = () => t.onOpen(), e.onerror = (r) => t.onError(r), e.onmessage = (r) => {
6369
6463
  if (typeof r.data == "string") {
@@ -6373,7 +6467,7 @@ class As {
6373
6467
  if (r.data instanceof ArrayBuffer) {
6374
6468
  try {
6375
6469
  const s = new TextDecoder().decode(r.data), i = JSON.parse(s);
6376
- Ht(i) && t.onMessage({ text: s });
6470
+ Qt(i) && t.onMessage({ text: s });
6377
6471
  } catch {
6378
6472
  }
6379
6473
  return;
@@ -6395,43 +6489,43 @@ class As {
6395
6489
  };
6396
6490
  }
6397
6491
  }
6398
- var Ft;
6399
- const Is = {
6492
+ var Wt;
6493
+ const Rs = {
6400
6494
  supportsAudioEndedEvent: !0,
6401
- supportsScreenShare: typeof navigator < "u" && typeof ((Ft = navigator.mediaDevices) == null ? void 0 : Ft.getDisplayMedia) == "function",
6495
+ supportsScreenShare: typeof navigator < "u" && typeof ((Wt = navigator.mediaDevices) == null ? void 0 : Wt.getDisplayMedia) == "function",
6402
6496
  supportsDom: typeof document < "u",
6403
6497
  supportsHtmlAudio: typeof Audio < "u",
6404
6498
  supportsCustomElements: typeof customElements < "u",
6405
6499
  supportsLocalStorage: typeof localStorage < "u",
6406
6500
  supportsBroadcastChannel: typeof BroadcastChannel < "u"
6407
- }, Ls = {
6501
+ }, Us = {
6408
6502
  name: "browser",
6409
6503
  callType: "web",
6410
6504
  runtimeName: "browser",
6411
6505
  callIdPrefix: "web_",
6412
- capabilities: Is,
6413
- audio: new ks(),
6414
- media: new Es(),
6415
- peer: new Ts(),
6416
- dataChannel: new As()
6506
+ capabilities: Rs,
6507
+ audio: new Ns(),
6508
+ media: new Ds(),
6509
+ peer: new Bs(),
6510
+ dataChannel: new $s()
6417
6511
  };
6418
- function $s(n) {
6419
- return new Ke({
6512
+ function Hs(n) {
6513
+ return new Xe({
6420
6514
  ...n,
6421
- runtime: Ls
6515
+ runtime: Us
6422
6516
  });
6423
6517
  }
6424
6518
  export {
6425
- Bs as PresetRenderer,
6426
- qr as RouteContextTracker,
6427
- Ke as VaniraClient,
6428
- Is as browserCapabilities,
6429
- Ls as browserRuntime,
6430
- $s as createBrowserClient,
6519
+ qs as PresetRenderer,
6520
+ Kr as RouteContextTracker,
6521
+ Xe as VaniraClient,
6522
+ Rs as browserCapabilities,
6523
+ Us as browserRuntime,
6524
+ Hs as createBrowserClient,
6431
6525
  we as getCurrentPageRoute,
6432
- Ds as hasContinueSession,
6433
- Qe as loadContinueSession,
6434
- zr as markAgentNavigation,
6435
- jt as normalizePageRoute,
6436
- Nr as saveCallSession
6526
+ zs as hasContinueSession,
6527
+ Ze as loadContinueSession,
6528
+ Jr as markAgentNavigation,
6529
+ Kt as normalizePageRoute,
6530
+ Vr as saveCallSession
6437
6531
  };