@pluno/product-agent-web 0.1.142 → 0.1.143

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.
@@ -430,6 +430,7 @@ class Me {
430
430
  type: "runtime.warmup",
431
431
  reason: t,
432
432
  entrySurface: this.options.entrySurface,
433
+ sessionId: this.state.sessionId ?? void 0,
433
434
  page: b()
434
435
  };
435
436
  this.sendNow(s) || (this.pendingWarmupEvent = s);
@@ -848,7 +849,7 @@ class Me {
848
849
  if (!c && jn(this.state.messages, s))
849
850
  return;
850
851
  this.lastUserMessagePageUrl = $n(s);
851
- const f = I ? null : Ot(s);
852
+ const f = I ? null : vt(s);
852
853
  if (this.latestRecoverableClientMessageId = f, m && this.clearRetryTimers(), this.setState({
853
854
  sessionId: E(t.session, "id") ?? this.state.sessionId,
854
855
  messages: a,
@@ -911,7 +912,7 @@ class Me {
911
912
  const s = q(t.item);
912
913
  if (Nt(s)) {
913
914
  typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
914
- const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ? O(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
915
+ const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ? v(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
915
916
  if (r && a) {
916
917
  this.retryAfterInterruptedRun(r, a);
917
918
  return;
@@ -1013,7 +1014,7 @@ class Me {
1013
1014
  if (s)
1014
1015
  this.nonTranscriptToolCallIds.add(s);
1015
1016
  else {
1016
- const n = On(t);
1017
+ const n = vn(t);
1017
1018
  if (n) {
1018
1019
  const r = xn(
1019
1020
  this.state.messages,
@@ -1366,7 +1367,7 @@ class Me {
1366
1367
  if (this.pageLifecycleCleanup)
1367
1368
  return;
1368
1369
  const t = () => {
1369
- Oe(this.options.clientId, this.activeBrowserToolCalls.values());
1370
+ ve(this.options.clientId, this.activeBrowserToolCalls.values());
1370
1371
  };
1371
1372
  window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
1372
1373
  window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
@@ -1387,7 +1388,7 @@ class Me {
1387
1388
  return t.ok === !1 ? Tn(t) : null;
1388
1389
  }
1389
1390
  enableNetworkCapture() {
1390
- this.networkCaptureCleanup || (this.networkCaptureCleanup = Os((t) => {
1391
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = vs((t) => {
1391
1392
  Sr(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1392
1393
  }));
1393
1394
  }
@@ -1460,13 +1461,13 @@ class Me {
1460
1461
  }
1461
1462
  }
1462
1463
  const bt = /* @__PURE__ */ new WeakMap();
1463
- function Os(e) {
1464
- const t = window.__plunoProductAgentNetworkCapture ?? vs();
1464
+ function vs(e) {
1465
+ const t = window.__plunoProductAgentNetworkCapture ?? Os();
1465
1466
  return t.subscribers.add(e), () => {
1466
1467
  t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
1467
1468
  };
1468
1469
  }
1469
- function vs() {
1470
+ function Os() {
1470
1471
  const e = /* @__PURE__ */ new Set(), t = (I) => {
1471
1472
  e.forEach((m) => {
1472
1473
  try {
@@ -1484,7 +1485,7 @@ function vs() {
1484
1485
  }
1485
1486
  try {
1486
1487
  const y = m instanceof Request ? m : null, k = mr(m, y), T = qe(d?.headers ?? y?.headers);
1487
- if (!v(k, T, d?.body)) {
1488
+ if (!O(k, T, d?.body)) {
1488
1489
  const H = {
1489
1490
  requestId: kt("fetch"),
1490
1491
  url: P(k, Rt),
@@ -1525,15 +1526,15 @@ function vs() {
1525
1526
  requestHeaders: {},
1526
1527
  startedAtMs: Date.now(),
1527
1528
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1528
- excluded: v(T)
1529
+ excluded: O(T)
1529
1530
  }), k;
1530
1531
  }, c = function(m, d) {
1531
1532
  const f = r.call(this, m, d), h = bt.get(this);
1532
- return h && Object.keys(h.requestHeaders).length < Ft && (h.requestHeaders[m] = Gt(m, d), h.excluded = h.excluded || v(h.url, h.requestHeaders)), f;
1533
+ return h && Object.keys(h.requestHeaders).length < Ft && (h.requestHeaders[m] = Gt(m, d), h.excluded = h.excluded || O(h.url, h.requestHeaders)), f;
1533
1534
  }, l = function(m) {
1534
1535
  try {
1535
1536
  const d = bt.get(this);
1536
- d && (d.excluded = d.excluded || v(d.url, d.requestHeaders, m), d.requestBody = we(m), d.excluded || this.addEventListener(
1537
+ d && (d.excluded = d.excluded || O(d.url, d.requestHeaders, m), d.requestBody = we(m), d.excluded || this.addEventListener(
1537
1538
  "loadend",
1538
1539
  () => {
1539
1540
  queueMicrotask(() => {
@@ -1585,7 +1586,7 @@ function vs() {
1585
1586
  u = new PerformanceObserver((I) => {
1586
1587
  for (const m of I.getEntries()) {
1587
1588
  const d = m;
1588
- if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || v(d.name))
1589
+ if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || O(d.name))
1589
1590
  continue;
1590
1591
  const f = performance.timeOrigin + d.startTime;
1591
1592
  t({
@@ -2334,7 +2335,7 @@ function Sn(e) {
2334
2335
  } : null;
2335
2336
  }
2336
2337
  function An(e, t) {
2337
- return Array.isArray(e) ? vt(
2338
+ return Array.isArray(e) ? Ot(
2338
2339
  e.map((s) => Ue(s, t)).filter((s) => s !== null)
2339
2340
  ) : [];
2340
2341
  }
@@ -2378,9 +2379,9 @@ function Ue(e, t) {
2378
2379
  t
2379
2380
  ),
2380
2381
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2381
- respondsToUserMessageId: O(r) ?? void 0,
2382
+ respondsToUserMessageId: v(r) ?? void 0,
2382
2383
  ...C(r) ? { runId: C(r) } : {},
2383
- attachments: ve(r.attachments, t)
2384
+ attachments: Oe(r.attachments, t)
2384
2385
  };
2385
2386
  return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
2386
2387
  value: r.id,
@@ -2397,7 +2398,7 @@ function Ue(e, t) {
2397
2398
  role: "tool",
2398
2399
  content: `Connect ${i.appName} to continue`,
2399
2400
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2400
- respondsToUserMessageId: O(r) ?? void 0,
2401
+ respondsToUserMessageId: v(r) ?? void 0,
2401
2402
  ...C(r) ? { runId: C(r) } : {},
2402
2403
  dataType: "function_call_output",
2403
2404
  toolName: "authenticate_pipedream_app",
@@ -2410,7 +2411,7 @@ function Ue(e, t) {
2410
2411
  role: "tool",
2411
2412
  content: r.type === "mcp_call" ? Rn(r) : kn(r),
2412
2413
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2413
- respondsToUserMessageId: O(r) ?? void 0,
2414
+ respondsToUserMessageId: v(r) ?? void 0,
2414
2415
  ...C(r) ? { runId: C(r) } : {},
2415
2416
  dataType: String(r.type),
2416
2417
  toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
@@ -2421,7 +2422,7 @@ function Ue(e, t) {
2421
2422
  role: "system",
2422
2423
  content: Mn(r),
2423
2424
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2424
- respondsToUserMessageId: O(r) ?? void 0,
2425
+ respondsToUserMessageId: v(r) ?? void 0,
2425
2426
  ...C(r) ? { runId: C(r) } : {},
2426
2427
  dataType: String(r.type),
2427
2428
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
@@ -2513,7 +2514,7 @@ function Pn(e) {
2513
2514
  }).filter(Boolean).join("") : "";
2514
2515
  }
2515
2516
  function Ut(e, t) {
2516
- const s = De(e, t), n = vn(
2517
+ const s = De(e, t), n = On(
2517
2518
  Un(
2518
2519
  Fn(e, t),
2519
2520
  s
@@ -2521,11 +2522,11 @@ function Ut(e, t) {
2521
2522
  s
2522
2523
  ), r = n.findIndex((o) => o.id === s.id);
2523
2524
  if (r === -1)
2524
- return vt(
2525
+ return Ot(
2525
2526
  [...n, s]
2526
2527
  );
2527
2528
  const i = [...n];
2528
- return i[r] = s, vt(i);
2529
+ return i[r] = s, Ot(i);
2529
2530
  }
2530
2531
  function Un(e, t) {
2531
2532
  const s = t.assistantDraftItemId;
@@ -2558,7 +2559,7 @@ function Nn(e, t, s) {
2558
2559
  const r = e.map((i) => i.callId !== t || i.loading === s ? i : (n = !0, { ...i, loading: s }));
2559
2560
  return n ? r : e;
2560
2561
  }
2561
- function On(e) {
2562
+ function vn(e) {
2562
2563
  if (e.hiddenFromTranscript === !0)
2563
2564
  return null;
2564
2565
  const t = typeof e.callId == "string" ? e.callId : null, s = typeof e.toolName == "string" ? e.toolName : null;
@@ -2577,7 +2578,7 @@ function On(e) {
2577
2578
  loading: !0
2578
2579
  };
2579
2580
  }
2580
- function vn(e, t) {
2581
+ function On(e, t) {
2581
2582
  if (t.id.startsWith("transient-activity:"))
2582
2583
  return e;
2583
2584
  const s = t.toolName === "tab_lifecycle";
@@ -2765,7 +2766,7 @@ function jn(e, t) {
2765
2766
  (o) => o.respondsToUserMessageId === r && xt(o)
2766
2767
  ) : e.slice(i + 1).some(xt);
2767
2768
  }
2768
- function Ot(e) {
2769
+ function vt(e) {
2769
2770
  const t = at(e);
2770
2771
  if (t === null)
2771
2772
  return null;
@@ -2793,16 +2794,16 @@ function zn(e) {
2793
2794
  if (i.type === "message" && i.role === "assistant")
2794
2795
  return null;
2795
2796
  if (i.type === "run_error")
2796
- return i.retryable !== !0 ? null : ge(e, i) ?? Ot(e);
2797
+ return i.retryable !== !0 ? null : ge(e, i) ?? vt(e);
2797
2798
  if (i.type === "run_status")
2798
- return i.status === "interrupted" && i.retryable === !0 ? ge(e, i) ?? Ot(e) : null;
2799
+ return i.status === "interrupted" && i.retryable === !0 ? ge(e, i) ?? vt(e) : null;
2799
2800
  }
2800
2801
  return null;
2801
2802
  }
2802
2803
  function ge(e, t) {
2803
2804
  if (typeof t.clientMessageId == "string")
2804
2805
  return t.clientMessageId;
2805
- const s = O(t);
2806
+ const s = v(t);
2806
2807
  if (!s)
2807
2808
  return null;
2808
2809
  const n = e.find((i) => E(i, "id") === s), r = q(n);
@@ -2825,7 +2826,7 @@ function me(e, t, s, n, r) {
2825
2826
  if (!t || !Xn(e))
2826
2827
  return !1;
2827
2828
  const i = e;
2828
- return !(Nt(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? O(i) !== n : r !== null && C(i) !== r));
2829
+ return !(Nt(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? v(i) !== n : r !== null && C(i) !== r));
2829
2830
  }
2830
2831
  function Xn(e) {
2831
2832
  if (!e || typeof e != "object")
@@ -2842,7 +2843,7 @@ function Kn(e) {
2842
2843
  const t = e;
2843
2844
  return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
2844
2845
  }
2845
- function vt(e) {
2846
+ function Ot(e) {
2846
2847
  return e.filter((t, s) => ct(t) ? !sr(e, s) && !tr(e, s) && !er(e, s) : Jn(t) ? t.retryable === !0 && Qn(e, s) ? !1 : !Zn(e, s) : !0);
2847
2848
  }
2848
2849
  function Jn(e) {
@@ -2973,7 +2974,7 @@ function j(e, t) {
2973
2974
  return;
2974
2975
  }
2975
2976
  }
2976
- function Oe(e, t) {
2977
+ function ve(e, t) {
2977
2978
  try {
2978
2979
  const s = `${ot}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
2979
2980
  ...o,
@@ -2996,7 +2997,7 @@ function or(e, t) {
2996
2997
  } catch {
2997
2998
  return;
2998
2999
  }
2999
- Oe(e, t);
3000
+ ve(e, t);
3000
3001
  }
3001
3002
  function ar(e) {
3002
3003
  try {
@@ -3065,7 +3066,7 @@ function Ie(e) {
3065
3066
  const t = e;
3066
3067
  return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
3067
3068
  }
3068
- function ve(e, t) {
3069
+ function Oe(e, t) {
3069
3070
  if (!Array.isArray(e))
3070
3071
  return;
3071
3072
  const s = e.filter((r) => {
@@ -3102,7 +3103,7 @@ function pr(e) {
3102
3103
  ...typeof t.runId == "string" ? { runId: t.runId } : {},
3103
3104
  dataType: typeof t.dataType == "string" ? t.dataType : void 0,
3104
3105
  securitySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : void 0,
3105
- attachments: ve(t.attachments)?.map(zt),
3106
+ attachments: Oe(t.attachments)?.map(zt),
3106
3107
  loading: typeof t.loading == "boolean" ? t.loading : void 0
3107
3108
  };
3108
3109
  }
@@ -3121,7 +3122,7 @@ function zt(e) {
3121
3122
  } = e;
3122
3123
  return r;
3123
3124
  }
3124
- function O(e) {
3125
+ function v(e) {
3125
3126
  const t = e.respondsToUserMessageId;
3126
3127
  return typeof t == "string" && t ? t : null;
3127
3128
  }
@@ -3229,7 +3230,7 @@ function Be(e) {
3229
3230
  const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
3230
3231
  return s !== null && Number.isInteger(n) && n >= 0 && n <= Ht && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
3231
3232
  }
3232
- function v(e, t = {}, s) {
3233
+ function O(e, t = {}, s) {
3233
3234
  if (Ar(s))
3234
3235
  return !0;
3235
3236
  const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
@@ -3246,7 +3247,7 @@ function v(e, t = {}, s) {
3246
3247
  }
3247
3248
  }
3248
3249
  function Sr(e, t) {
3249
- if (v(e))
3250
+ if (O(e))
3250
3251
  return !0;
3251
3252
  try {
3252
3253
  const s = new URL(e, location.href), n = new URL(t);
@@ -3343,16 +3344,16 @@ function ze(e) {
3343
3344
  Pr.test(s) && t.searchParams.set(s, U);
3344
3345
  return t.username && (t.username = U), t.password && (t.password = U), t.toString();
3345
3346
  } catch {
3346
- return Or(e);
3347
+ return vr(e);
3347
3348
  }
3348
3349
  }
3349
3350
  function it(e) {
3350
- return e.replace(Ur, _r).replace(Dr, vr).replace(He, `Bearer ${U}`).replace(Fe, `Basic ${U}`).replace(We, U).replace($e, (t, s) => `${s}: ${ut}`);
3351
+ return e.replace(Ur, _r).replace(Dr, Or).replace(He, `Bearer ${U}`).replace(Fe, `Basic ${U}`).replace(We, U).replace($e, (t, s) => `${s}: ${ut}`);
3351
3352
  }
3352
- function Or(e) {
3353
+ function vr(e) {
3353
3354
  return e.replace(He, `Bearer ${U}`).replace(Fe, `Basic ${U}`).replace(We, U).replace($e, (t, s) => `${s}: ${ut}`);
3354
3355
  }
3355
- function vr(e) {
3356
+ function Or(e) {
3356
3357
  const t = e.match(xr)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
3357
3358
  return `${ze(s)}${t}`;
3358
3359
  }
@@ -492,6 +492,7 @@ class Jo {
492
492
  type: "runtime.warmup",
493
493
  reason: e,
494
494
  entrySurface: this.options.entrySurface,
495
+ sessionId: this.state.sessionId ?? void 0,
495
496
  page: ve()
496
497
  };
497
498
  this.sendNow(n) || (this.pendingWarmupEvent = n);
@@ -547,7 +548,7 @@ class Jo {
547
548
  }), h;
548
549
  }
549
550
  this.retryableClientMessageId = null;
550
- const _ = !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== s.url, w = {
551
+ const _ = !n.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== s.url, b = {
551
552
  type: "chat.user_message",
552
553
  sessionId: this.state.sessionId ?? void 0,
553
554
  clientMessageId: l,
@@ -561,7 +562,7 @@ class Jo {
561
562
  model: this.options.model,
562
563
  metadata: Hi(this.options.metadata)
563
564
  };
564
- return n.initiatedBy || (this.lastUserMessagePageUrl = s.url), this.activeClientMessageId = l, this.activeUserMessageEvent = w, this.markThinkingProgress(), this.send(w), l;
565
+ return n.initiatedBy || (this.lastUserMessagePageUrl = s.url), this.activeClientMessageId = l, this.activeUserMessageEvent = b, this.markThinkingProgress(), this.send(b), l;
565
566
  }
566
567
  retryLastMessage() {
567
568
  const e = this.state.sessionId, n = this.retryableClientMessageId;
@@ -910,8 +911,8 @@ class Jo {
910
911
  if (!p && tp(this.state.messages, n))
911
912
  return;
912
913
  this.lastUserMessagePageUrl = ep(n);
913
- const w = f ? null : No(n);
914
- if (this.latestRecoverableClientMessageId = w, m && this.clearRetryTimers(), this.setState({
914
+ const b = f ? null : No(n);
915
+ if (this.latestRecoverableClientMessageId = b, m && this.clearRetryTimers(), this.setState({
915
916
  sessionId: ce(e.session, "id") ?? this.state.sessionId,
916
917
  messages: l,
917
918
  ...i ? {
@@ -938,11 +939,11 @@ class Jo {
938
939
  lastErrorCode: null,
939
940
  lastErrorSecuritySettingsUrl: null
940
941
  } : {}
941
- } : w ? {
942
+ } : b ? {
942
943
  isThinking: !0,
943
944
  lastError: null
944
945
  } : {}
945
- }), f ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : (c || w) && (w && (this.activeClientMessageId = w), this.markThinkingProgress()), r) {
946
+ }), f ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : (c || b) && (b && (this.activeClientMessageId = b), this.markThinkingProgress()), r) {
946
947
  const h = ce(e.session, "id") ?? this.state.sessionId;
947
948
  h && this.retryAfterInterruptedRun(h, r);
948
949
  }
@@ -1537,7 +1538,7 @@ function Xs() {
1537
1538
  }
1538
1539
  });
1539
1540
  }, n = window.fetch, o = XMLHttpRequest.prototype.open, i = XMLHttpRequest.prototype.setRequestHeader, r = XMLHttpRequest.prototype.send, s = function(m, _) {
1540
- const w = Date.now();
1541
+ const b = Date.now();
1541
1542
  let h;
1542
1543
  try {
1543
1544
  h = n.call(this, m, _);
@@ -1554,15 +1555,15 @@ function Xs() {
1554
1555
  requestHeaders: k,
1555
1556
  requestBody: tr(_?.body),
1556
1557
  resourceType: "fetch",
1557
- startedAt: new Date(w).toISOString()
1558
+ startedAt: new Date(b).toISOString()
1558
1559
  };
1559
1560
  h.then(
1560
1561
  (z) => {
1561
- kp(z, M, w, e).catch(() => {
1562
+ kp(z, M, b, e).catch(() => {
1562
1563
  e({
1563
1564
  ...M,
1564
1565
  responseStatus: z.status,
1565
- durationMs: Date.now() - w
1566
+ durationMs: Date.now() - b
1566
1567
  });
1567
1568
  });
1568
1569
  },
@@ -1570,7 +1571,7 @@ function Xs() {
1570
1571
  e({
1571
1572
  ...M,
1572
1573
  errorText: Ge(z instanceof Error ? z.message : String(z)),
1573
- durationMs: Date.now() - w
1574
+ durationMs: Date.now() - b
1574
1575
  });
1575
1576
  }
1576
1577
  );
@@ -1578,8 +1579,8 @@ function Xs() {
1578
1579
  } catch {
1579
1580
  }
1580
1581
  return h;
1581
- }, l = function(m, _, w, h, S) {
1582
- const y = o.call(this, m, _, w ?? !0, h ?? void 0, S ?? void 0), k = typeof _ == "string" ? _ : _.toString();
1582
+ }, l = function(m, _, b, h, S) {
1583
+ const y = o.call(this, m, _, b ?? !0, h ?? void 0, S ?? void 0), k = typeof _ == "string" ? _ : _.toString();
1583
1584
  return go.set(this, {
1584
1585
  requestId: fo("xhr"),
1585
1586
  method: String(m ?? "GET").toUpperCase(),
@@ -1590,8 +1591,8 @@ function Xs() {
1590
1591
  excluded: St(k)
1591
1592
  }), y;
1592
1593
  }, p = function(m, _) {
1593
- const w = i.call(this, m, _), h = go.get(this);
1594
- return h && Object.keys(h.requestHeaders).length < Yo && (h.requestHeaders[m] = ni(m, _), h.excluded = h.excluded || St(h.url, h.requestHeaders)), w;
1594
+ const b = i.call(this, m, _), h = go.get(this);
1595
+ return h && Object.keys(h.requestHeaders).length < Yo && (h.requestHeaders[m] = ni(m, _), h.excluded = h.excluded || St(h.url, h.requestHeaders)), b;
1595
1596
  }, d = function(m) {
1596
1597
  try {
1597
1598
  const _ = go.get(this);
@@ -1600,7 +1601,7 @@ function Xs() {
1600
1601
  () => {
1601
1602
  queueMicrotask(() => {
1602
1603
  try {
1603
- const w = Np(this.getAllResponseHeaders());
1604
+ const b = Np(this.getAllResponseHeaders());
1604
1605
  e({
1605
1606
  requestId: _.requestId,
1606
1607
  url: _.url,
@@ -1609,8 +1610,8 @@ function Xs() {
1609
1610
  requestBody: _.requestBody,
1610
1611
  resourceType: "xhr",
1611
1612
  responseStatus: this.status,
1612
- responseHeaders: w,
1613
- responseBody: Rp(this, w),
1613
+ responseHeaders: b,
1614
+ responseBody: Rp(this, b),
1614
1615
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
1615
1616
  startedAt: _.startedAt,
1616
1617
  durationMs: Date.now() - _.startedAtMs
@@ -1649,14 +1650,14 @@ function Xs() {
1649
1650
  const _ = m;
1650
1651
  if (_.initiatorType === "fetch" || _.initiatorType === "xmlhttprequest" || St(_.name))
1651
1652
  continue;
1652
- const w = performance.timeOrigin + _.startTime;
1653
+ const b = performance.timeOrigin + _.startTime;
1653
1654
  e({
1654
1655
  requestId: fo("resource"),
1655
1656
  url: Ge(_.name, uo),
1656
1657
  method: "GET",
1657
1658
  resourceType: "resource",
1658
1659
  responseStatus: _.responseStatus,
1659
- startedAt: new Date(w).toISOString(),
1660
+ startedAt: new Date(b).toISOString(),
1660
1661
  durationMs: _.duration
1661
1662
  });
1662
1663
  }
@@ -1986,19 +1987,19 @@ function _l() {
1986
1987
  function Zo() {
1987
1988
  if (!document.body)
1988
1989
  return "";
1989
- const t = [], e = [], n = (w, h) => {
1990
+ const t = [], e = [], n = (b, h) => {
1990
1991
  const S = Et(h);
1991
- !S || e.includes(S) || (t.push([w, S]), e.push(S));
1992
+ !S || e.includes(S) || (t.push([b, S]), e.push(S));
1992
1993
  };
1993
1994
  n("Selected text", window.getSelection()?.toString() ?? "");
1994
1995
  const o = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(o)).filter(
1995
- (w) => Hr(w) && !w.parentElement?.closest(o)
1996
+ (b) => Hr(b) && !b.parentElement?.closest(o)
1996
1997
  );
1997
- for (const w of i.slice(0, 3))
1998
- n("Active overlay", ho(jt(w), e));
1998
+ for (const b of i.slice(0, 3))
1999
+ n("Active overlay", ho(jt(b), e));
1999
2000
  const r = yl(), s = r ? ho(jt(r), e) : "";
2000
2001
  n("Main page content", s), n("Additional visible page text", ho(jt(document.body), e));
2001
- const l = t.map(([w, h]) => `${w}:
2002
+ const l = t.map(([b, h]) => `${b}:
2002
2003
  ${h}`).join(`
2003
2004
 
2004
2005
  `).trim().slice(0, 12e3), p = xl(i, r).trim(), d = `Simplified DOM outline:
@@ -2118,7 +2119,7 @@ function xl(t, e) {
2118
2119
  const _ = (k) => {
2119
2120
  const N = k.getAttribute("role");
2120
2121
  return N && !s.has(N) ? N : "";
2121
- }, w = (k) => {
2122
+ }, b = (k) => {
2122
2123
  const N = k.getAttribute("data-testid") || k.getAttribute("data-test") || k.getAttribute("data-qa") || k.getAttribute("data-cy") || "";
2123
2124
  return `${k.tagName.toLowerCase()}|${_(k)}|${N}`;
2124
2125
  }, h = (k, N, M) => {
@@ -2129,17 +2130,17 @@ function xl(t, e) {
2129
2130
  m += 1;
2130
2131
  const Ue = _(L), x = jr(L), q = l.has(Ue) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(V) || V === "a" && L.hasAttribute("href"), oe = Array.from(L.children).filter((A) => A instanceof HTMLElement), ee = /* @__PURE__ */ new Map();
2131
2132
  for (const A of oe) {
2132
- const H = w(A);
2133
+ const H = b(A);
2133
2134
  ee.set(H, (ee.get(H) ?? 0) + 1);
2134
2135
  }
2135
2136
  const De = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
2136
2137
  for (const A of oe) {
2137
- const H = w(A), Ce = te.get(H) ?? 0;
2138
+ const H = b(A), Ce = te.get(H) ?? 0;
2138
2139
  te.set(H, Ce + 1), (ee.get(H) ?? 0) > 8 && Ce >= 6 && !u.has(A) && De.set(H, (De.get(H) ?? 0) + 1);
2139
2140
  }
2140
2141
  const Ie = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Set(), le = [], Oe = [];
2141
2142
  for (const A of oe) {
2142
- const H = w(A), Ce = ee.get(H) ?? 0, gt = Ie.get(H) ?? 0;
2143
+ const H = b(A), Ce = ee.get(H) ?? 0, gt = Ie.get(H) ?? 0;
2143
2144
  if (Ie.set(H, gt + 1), Ce > 8 && gt >= 6 && !u.has(A)) {
2144
2145
  ie.has(H) || (le.push([`… ${De.get(H) ?? 0} similar siblings omitted`]), ie.add(H));
2145
2146
  continue;
@@ -3868,7 +3869,7 @@ async function ed(t = {}) {
3868
3869
  });
3869
3870
  const f = e.mountTarget ?? await Pu(), m = f.ownerDocument, _ = i.querySelector(
3870
3871
  ".pluno-pa-widget__launcher"
3871
- ), w = i.querySelector(
3872
+ ), b = i.querySelector(
3872
3873
  ".pluno-pa-widget__launcher-drag-handle"
3873
3874
  ), h = i.querySelector(
3874
3875
  ".pluno-pa-widget__launcher-input"
@@ -3943,7 +3944,7 @@ async function ed(t = {}) {
3943
3944
  );
3944
3945
  if (!_ || !h || !y || !z || !L || !se || !V || !Ne || !O || !Ue || !x || !q || !oe || !ee || !De || !te || !Ie || !ie || !le || !Oe || !F || !re)
3945
3946
  throw new Error("Failed to mount Pluno widget");
3946
- if (e.movableLauncher && !w)
3947
+ if (e.movableLauncher && !b)
3947
3948
  throw new Error("Failed to mount Pluno widget drag handle");
3948
3949
  if (e.movableLauncher && !k)
3949
3950
  throw new Error("Failed to mount Pluno widget panel drag handle");
@@ -3973,7 +3974,7 @@ async function ed(t = {}) {
3973
3974
  ne,
3974
3975
  (a) => {
3975
3976
  ne = ne.filter(
3976
- (g, b) => b !== a
3977
+ (g, w) => w !== a
3977
3978
  ), It(), $(v.getState()), ae(), Ve();
3978
3979
  }
3979
3980
  );
@@ -4045,15 +4046,15 @@ async function ed(t = {}) {
4045
4046
  for (const a of ke) {
4046
4047
  const g = document.createElement("button");
4047
4048
  g.type = "button", g.className = "pluno-pa-widget__history-item", g.disabled = de;
4048
- const b = document.createElement("span");
4049
- b.className = "pluno-pa-widget__history-item-title", b.textContent = Sd(a);
4049
+ const w = document.createElement("span");
4050
+ w.className = "pluno-pa-widget__history-item-title", w.textContent = Sd(a);
4050
4051
  const C = document.createElement("time");
4051
4052
  C.className = "pluno-pa-widget__history-time", C.dateTime = a.lastActiveAt, C.textContent = Td(
4052
4053
  a.lastActiveAt,
4053
4054
  Date.now()
4054
4055
  );
4055
4056
  const E = document.createElement("small");
4056
- E.className = "pluno-pa-widget__history-path", E.textContent = vd(a), g.append(b, C, E), g.addEventListener("click", () => {
4057
+ E.className = "pluno-pa-widget__history-path", E.textContent = vd(a), g.append(w, C, E), g.addEventListener("click", () => {
4057
4058
  pe = !1, rt = null, Se(), ye(!0, "newSession"), xe(), v.loadSession(a.id), $(v.getState()), Ve();
4058
4059
  }), te.appendChild(g);
4059
4060
  }
@@ -4066,18 +4067,18 @@ async function ed(t = {}) {
4066
4067
  if (!de) {
4067
4068
  de = !0, rt = null, Se();
4068
4069
  try {
4069
- const b = await v.listSessions({ cursor: a, limit: 20 });
4070
+ const w = await v.listSessions({ cursor: a, limit: 20 });
4070
4071
  if (g !== at || Y)
4071
4072
  return;
4072
- ke = a ? [...ke, ...b.sessions] : b.sessions, kt = b.nextCursor, a || (Zt = !0);
4073
- } catch (b) {
4073
+ ke = a ? [...ke, ...w.sessions] : w.sessions, kt = w.nextCursor, a || (Zt = !0);
4074
+ } catch (w) {
4074
4075
  if (g !== at || Y)
4075
4076
  return;
4076
4077
  he(
4077
4078
  "web-sdk.widget",
4078
4079
  "Failed to load session history",
4079
4080
  {
4080
- message: b instanceof Error ? b.message : String(b)
4081
+ message: w instanceof Error ? w.message : String(w)
4081
4082
  }
4082
4083
  ), rt = zc;
4083
4084
  } finally {
@@ -4204,7 +4205,7 @@ async function ed(t = {}) {
4204
4205
  N,
4205
4206
  Gn()
4206
4207
  );
4207
- const b = Ht(
4208
+ const w = Ht(
4208
4209
  c ? Cn(c, g) : xo(
4209
4210
  i,
4210
4211
  a,
@@ -4213,9 +4214,9 @@ async function ed(t = {}) {
4213
4214
  ),
4214
4215
  g
4215
4216
  );
4216
- tn(b, a), st(
4217
+ tn(w, a), st(
4217
4218
  "Applied open panel position after viewport resize",
4218
- { openPanelPosition: b }
4219
+ { openPanelPosition: w }
4219
4220
  );
4220
4221
  } else p && st(
4221
4222
  "Applied visible launcher position after viewport resize",
@@ -4224,20 +4225,20 @@ async function ed(t = {}) {
4224
4225
  };
4225
4226
  let xi = () => {
4226
4227
  };
4227
- window.addEventListener("resize", yi), e.movableLauncher && w ? (Pt(), xi = rd({
4228
+ window.addEventListener("resize", yi), e.movableLauncher && b ? (Pt(), xi = rd({
4228
4229
  root: i,
4229
4230
  launcher: _,
4230
- launcherDragHandle: w,
4231
+ launcherDragHandle: b,
4231
4232
  getPosition: () => At(),
4232
4233
  setPosition: (a) => {
4233
- const g = a, b = Kt(i), C = In(
4234
+ const g = a, w = Kt(i), C = In(
4234
4235
  i,
4235
4236
  a,
4236
- b
4237
+ w
4237
4238
  );
4238
4239
  p = yo(
4239
4240
  C,
4240
- b
4241
+ w
4241
4242
  ), c = null, Je(i, C), st("Dragging closed launcher", {
4242
4243
  requestedPosition: g
4243
4244
  });
@@ -4273,16 +4274,16 @@ async function ed(t = {}) {
4273
4274
  g,
4274
4275
  pt(u)
4275
4276
  );
4276
- const b = At();
4277
- tn(g, b);
4277
+ const w = At();
4278
+ tn(g, w);
4278
4279
  }, Fa = (a) => {
4279
- const g = pt(u), b = Ht(
4280
+ const g = pt(u), w = Ht(
4280
4281
  a,
4281
4282
  g
4282
4283
  ), C = Kt(i), E = In(
4283
4284
  i,
4284
4285
  gd(
4285
- b,
4286
+ w,
4286
4287
  g,
4287
4288
  C,
4288
4289
  e.position
@@ -4292,7 +4293,7 @@ async function ed(t = {}) {
4292
4293
  p = yo(
4293
4294
  E,
4294
4295
  C
4295
- ), d = !0, c = null, Je(i, E), tn(b, E);
4296
+ ), d = !0, c = null, Je(i, E), tn(w, E);
4296
4297
  }, qa = e.movableLauncher && k ? ad({
4297
4298
  root: i,
4298
4299
  handle: k,
@@ -4334,9 +4335,9 @@ async function ed(t = {}) {
4334
4335
  };
4335
4336
  let Vn = null;
4336
4337
  const Ti = (a) => {
4337
- const g = Date.now();
4338
- a === "composer_input" && Vn !== null && g - Vn < yc || (a === "composer_input" && (Vn = g), v.warmup(a));
4339
- }, Be = (a = "", g = !0, b = !0, C = !0) => {
4338
+ const g = Date.now(), w = v.getState().sessionId ?? "draft";
4339
+ a === "composer_input" && Vn?.scope === w && g - Vn.requestedAt < yc || (a === "composer_input" && (Vn = { scope: w, requestedAt: g }), v.warmup(a));
4340
+ }, Be = (a = "", g = !0, w = !0, C = !0) => {
4340
4341
  const E = i.classList.contains("pluno-pa-widget--open");
4341
4342
  !E && C && Ti("panel_open"), vi(), Ut && (Ut = !1, Qn()), i.classList.contains("pluno-pa-widget--open") || (c = null), _e !== null && (window.clearTimeout(_e), _e = null), Rt("shown", !1), y.hidden = !1, z.hidden = !1, vo(
4342
4343
  N,
@@ -4352,11 +4353,11 @@ async function ed(t = {}) {
4352
4353
  openPanelPosition: Re,
4353
4354
  visibleLauncherPosition: Q
4354
4355
  }), ye(!0, "open"), xe(), !g) {
4355
- i.classList.add("pluno-pa-widget--open"), E || Qt(), _.hidden = !0, a && (x.value = a, Wt(x)), $t(F, () => ot.enabled), it = F.scrollTop, b && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), K(), en("shown"), e.onPanelOpenChange?.(!0);
4356
+ i.classList.add("pluno-pa-widget--open"), E || Qt(), _.hidden = !0, a && (x.value = a, Wt(x)), $t(F, () => ot.enabled), it = F.scrollTop, w && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), K(), en("shown"), e.onPanelOpenChange?.(!0);
4356
4357
  return;
4357
4358
  }
4358
4359
  window.requestAnimationFrame(() => {
4359
- i.classList.add("pluno-pa-widget--open"), E || Qt(), a && (x.value = a, Wt(x)), $t(F, () => ot.enabled), it = F.scrollTop, b && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), K(), en("shown"), e.onPanelOpenChange?.(!0), _e = window.setTimeout(() => {
4360
+ i.classList.add("pluno-pa-widget--open"), E || Qt(), a && (x.value = a, Wt(x)), $t(F, () => ot.enabled), it = F.scrollTop, w && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), K(), en("shown"), e.onPanelOpenChange?.(!0), _e = window.setTimeout(() => {
4360
4361
  _.hidden = !0, $t(F, () => ot.enabled), it = F.scrollTop;
4361
4362
  }, 220);
4362
4363
  });
@@ -4367,10 +4368,10 @@ async function ed(t = {}) {
4367
4368
  };
4368
4369
  _.addEventListener("submit", (a) => {
4369
4370
  a.preventDefault(), Be(h.value), h.value = "";
4370
- }), w?.addEventListener("click", (a) => {
4371
+ }), b?.addEventListener("click", (a) => {
4371
4372
  a.preventDefault(), a.stopPropagation();
4372
4373
  }), _.addEventListener("click", (a) => {
4373
- a.target === h && !w || (Be(h.value), h.value = "");
4374
+ a.target === h && !b || (Be(h.value), h.value = "");
4374
4375
  });
4375
4376
  const Ei = () => {
4376
4377
  Be(h.value), h.value = "";
@@ -4395,9 +4396,9 @@ async function ed(t = {}) {
4395
4396
  return null;
4396
4397
  let g = a;
4397
4398
  for (; g; ) {
4398
- const b = g.closest(dr);
4399
- if (b)
4400
- return b;
4399
+ const w = g.closest(dr);
4400
+ if (w)
4401
+ return w;
4401
4402
  const C = Ha(g);
4402
4403
  if (C) {
4403
4404
  g = C;
@@ -4433,12 +4434,12 @@ async function ed(t = {}) {
4433
4434
  return;
4434
4435
  }
4435
4436
  Fe = a, a !== null ? (Zn(a, g), lt = window.setInterval(() => {
4436
- const b = Fe;
4437
- if (!b || !$a(b)) {
4437
+ const w = Fe;
4438
+ if (!w || !$a(w)) {
4438
4439
  Lt(null);
4439
4440
  return;
4440
4441
  }
4441
- Zn(b, null);
4442
+ Zn(w, null);
4442
4443
  }, Oc)) : (lt !== null && (window.clearInterval(lt), lt = null), Ae !== null && (window.clearTimeout(Ae), Ae = null), nn = null);
4443
4444
  }, ja = () => {
4444
4445
  lt !== null && (window.clearInterval(lt), lt = null), Ae !== null && (window.clearTimeout(Ae), Ae = null), Z !== null && (window.clearTimeout(Z), Z = null);
@@ -4446,11 +4447,11 @@ async function ed(t = {}) {
4446
4447
  const g = Ii(a);
4447
4448
  if (!g)
4448
4449
  return;
4449
- const b = Date.now();
4450
- Ye = b, Mt = b, Z !== null && window.clearTimeout(Z);
4450
+ const w = Date.now();
4451
+ Ye = w, Mt = w, Z !== null && window.clearTimeout(Z);
4451
4452
  const C = Fe ?? Yn(Jn());
4452
4453
  C && (Lt(C, g), a.stopImmediatePropagation()), Z = window.setTimeout(() => {
4453
- if (Z = null, Ye !== b)
4454
+ if (Z = null, Ye !== w)
4454
4455
  return;
4455
4456
  const E = Jn();
4456
4457
  if (E === g) {
@@ -4486,19 +4487,19 @@ async function ed(t = {}) {
4486
4487
  const g = Mt;
4487
4488
  if (Mt = null, g === null || Date.now() - g > ur)
4488
4489
  return;
4489
- const b = a.target, C = Ye !== null && Date.now() - Ye <= ur;
4490
+ const w = a.target, C = Ye !== null && Date.now() - Ye <= ur;
4490
4491
  Ye = null, Z !== null && (window.clearTimeout(Z), Z = null);
4491
4492
  const E = (Q) => {
4492
4493
  const Re = Yn(Q);
4493
4494
  if (!Re)
4494
4495
  return !1;
4495
4496
  if (C)
4496
- return Lt(Re, b), !0;
4497
+ return Lt(Re, w), !0;
4497
4498
  const Ni = Date.now();
4498
- return nn !== null && Ni - nn <= Dc ? (Lt(Re, b), !0) : (nn = Ni, !0);
4499
+ return nn !== null && Ni - nn <= Dc ? (Lt(Re, w), !0) : (nn = Ni, !0);
4499
4500
  };
4500
4501
  E(a.relatedTarget) || window.setTimeout(() => {
4501
- Fe === null && b.isConnected && E(Jn());
4502
+ Fe === null && w.isConnected && E(Jn());
4502
4503
  }, 0);
4503
4504
  }), _.addEventListener("keydown", (a) => {
4504
4505
  !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), Be());
@@ -4556,22 +4557,22 @@ async function ed(t = {}) {
4556
4557
  se.textContent = "", se.hidden = !0, ze = null;
4557
4558
  }, 3e3);
4558
4559
  }, to = () => {
4559
- const a = x.value, g = a.trim(), b = [...ne];
4560
- if (Yt || !g && b.length === 0)
4560
+ const a = x.value, g = a.trim(), w = [...ne];
4561
+ if (Yt || !g && w.length === 0)
4561
4562
  return;
4562
4563
  Yt = !0;
4563
- const C = new Set(b);
4564
+ const C = new Set(w);
4564
4565
  ne = ne.filter(
4565
4566
  (E) => !C.has(E)
4566
4567
  ), x.value === a && (x.value = "", x.style.height = "22px", x.style.overflowY = "hidden", x.dispatchEvent(new Event("input", { bubbles: !0 }))), It(), ae(), md(
4567
4568
  v,
4568
4569
  g,
4569
- b,
4570
+ w,
4570
4571
  Pi
4571
4572
  ).catch((E) => {
4572
4573
  const Q = new Set(ne.map((Re) => Re.id));
4573
4574
  ne = [
4574
- ...b.filter((Re) => !Q.has(Re.id)),
4575
+ ...w.filter((Re) => !Q.has(Re.id)),
4575
4576
  ...ne
4576
4577
  ], x.value || (x.value = a, x.dispatchEvent(new Event("input", { bubbles: !0 }))), It(), an(
4577
4578
  E instanceof Error ? E.message : "Failed to upload attachment"
@@ -4628,17 +4629,17 @@ async function ed(t = {}) {
4628
4629
  xn(a.dataTransfer) && (a.stopPropagation(), Dt = Math.max(0, Dt - 1), Dt === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
4629
4630
  }), i.addEventListener("drop", (a) => {
4630
4631
  const g = a.dataTransfer;
4631
- !e.attachmentsEnabled || !xn(g) || e.loginRequired || ge() || (a.preventDefault(), a.stopPropagation(), Ga(), no(g.files).catch((b) => {
4632
+ !e.attachmentsEnabled || !xn(g) || e.loginRequired || ge() || (a.preventDefault(), a.stopPropagation(), Ga(), no(g.files).catch((w) => {
4632
4633
  an(
4633
- b instanceof Error ? b.message : "Failed to attach file"
4634
+ w instanceof Error ? w.message : "Failed to attach file"
4634
4635
  ), he("web-sdk.widget", "Attachment failed", {
4635
- message: b instanceof Error ? b.message : String(b)
4636
+ message: w instanceof Error ? w.message : String(w)
4636
4637
  });
4637
4638
  }));
4638
4639
  }), i.addEventListener("paste", (a) => {
4639
4640
  a.stopPropagation();
4640
- const g = a.clipboardData, b = Array.from(g?.files ?? []);
4641
- !e.attachmentsEnabled || b.length === 0 || e.loginRequired || ge() || (a.preventDefault(), no(b).catch((C) => {
4641
+ const g = a.clipboardData, w = Array.from(g?.files ?? []);
4642
+ !e.attachmentsEnabled || w.length === 0 || e.loginRequired || ge() || (a.preventDefault(), no(w).catch((C) => {
4642
4643
  an(
4643
4644
  C instanceof Error ? C.message : "Failed to attach file"
4644
4645
  ), he("web-sdk.widget", "Attachment failed", {
@@ -4816,7 +4817,7 @@ async function ed(t = {}) {
4816
4817
  );
4817
4818
  return;
4818
4819
  }
4819
- const g = yd(a), b = g !== ui;
4820
+ const g = yd(a), w = g !== ui;
4820
4821
  ui = g;
4821
4822
  const C = Xe || ot.enabled;
4822
4823
  Xe = !1, nu(
@@ -4875,7 +4876,7 @@ async function ed(t = {}) {
4875
4876
  $n = !0, nt.add(E.id), Ct.add(E.id), K(), Du(e, !0), Ot = null, $(v.getState());
4876
4877
  }
4877
4878
  } : void 0
4878
- ), C ? (it = F.scrollTop, xe()) : b && xd(a) && Da();
4879
+ ), C ? (it = F.scrollTop, xe()) : w && xd(a) && Da();
4879
4880
  }, Mi = () => {
4880
4881
  m.getSelection()?.isCollapsed !== !1 && lu(gn) && $(v.getState());
4881
4882
  };
@@ -4886,25 +4887,25 @@ async function ed(t = {}) {
4886
4887
  const Li = async (a) => {
4887
4888
  if (!e.integrationAuthStatusLoader)
4888
4889
  return;
4889
- const g = a.messages.map((b) => b.integrationAuthRequest).filter(
4890
- (b) => !!b
4890
+ const g = a.messages.map((w) => w.integrationAuthRequest).filter(
4891
+ (w) => !!w
4891
4892
  );
4892
4893
  await Promise.all(
4893
- g.map(async (b) => {
4894
- if (!(qe.has(b.authRequestId) || hn.has(b.authRequestId))) {
4895
- hn.add(b.authRequestId), qe.set(b.authRequestId, {
4894
+ g.map(async (w) => {
4895
+ if (!(qe.has(w.authRequestId) || hn.has(w.authRequestId))) {
4896
+ hn.add(w.authRequestId), qe.set(w.authRequestId, {
4896
4897
  status: "checking"
4897
4898
  }), $(v.getState());
4898
4899
  try {
4899
- const C = await e.integrationAuthStatusLoader(b);
4900
- qe.set(b.authRequestId, { status: C });
4900
+ const C = await e.integrationAuthStatusLoader(w);
4901
+ qe.set(w.authRequestId, { status: C });
4901
4902
  } catch (C) {
4902
- qe.set(b.authRequestId, {
4903
+ qe.set(w.authRequestId, {
4903
4904
  status: "error",
4904
- error: C instanceof Error ? C.message : `Could not load ${b.appName} connection status.`
4905
+ error: C instanceof Error ? C.message : `Could not load ${w.appName} connection status.`
4905
4906
  });
4906
4907
  } finally {
4907
- hn.delete(b.authRequestId);
4908
+ hn.delete(w.authRequestId);
4908
4909
  }
4909
4910
  Y || $(v.getState());
4910
4911
  }
@@ -4922,8 +4923,8 @@ async function ed(t = {}) {
4922
4923
  }
4923
4924
  ), v.on("state", (a) => {
4924
4925
  un();
4925
- const g = io && !a.isThinking, b = gi !== location.origin || hi !== a.sessionId || fi !== (a.user?.id ?? null), C = io !== a.isThinking, E = jn !== "connected" && a.status === "connected", Q = jn === "connected" && a.status !== "connected";
4926
- gi = location.origin, hi = a.sessionId, fi = a.user?.id ?? null, jn = a.status, io = a.isThinking, Q && (ue !== null && (window.clearTimeout(ue), ue = null), at += 1, de = !1, ke = [], kt = null, rt = null, Zt = !1, Se()), i.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (b || C || E) && Qt(), a.isThinking && !cn() && zt && !bt && wt === null && T?.hidden !== !1 && (wt = window.setTimeout(() => {
4926
+ const g = io && !a.isThinking, w = gi !== location.origin || hi !== a.sessionId || fi !== (a.user?.id ?? null), C = io !== a.isThinking, E = jn !== "connected" && a.status === "connected", Q = jn === "connected" && a.status !== "connected";
4927
+ gi = location.origin, hi = a.sessionId, fi = a.user?.id ?? null, jn = a.status, io = a.isThinking, Q && (ue !== null && (window.clearTimeout(ue), ue = null), at += 1, de = !1, ke = [], kt = null, rt = null, Zt = !1, Se()), i.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (w || C || E) && Qt(), a.isThinking && !cn() && zt && !bt && wt === null && T?.hidden !== !1 && (wt = window.setTimeout(() => {
4927
4928
  wt = null, Xa();
4928
4929
  }, xc)), (!a.isThinking || cn()) && (Ai(), pn()), g && !i.classList.contains("pluno-pa-widget--open") && (Ut = !0), Qn(), a.appearance ? (oo = !0, he(
4929
4930
  "web-sdk.widget",
@@ -4960,8 +4961,8 @@ async function ed(t = {}) {
4960
4961
  e.loginRequired = a.loginRequired === !0, e.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (e.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (e.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (e.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (e.signupUrl = a.signupUrl), ft(), $(v.getState()), ae(), i.classList.contains("pluno-pa-widget--open") && Qt(), g && !Nt() && eo();
4961
4962
  },
4962
4963
  openPanel: (a) => {
4963
- const g = typeof a == "string" ? a : x.value, b = typeof a == "object" ? a.focusComposer !== !1 : !0;
4964
- Be(g, !1, b);
4964
+ const g = typeof a == "string" ? a : x.value, w = typeof a == "object" ? a.focusComposer !== !1 : !0;
4965
+ Be(g, !1, w);
4965
4966
  },
4966
4967
  closePanel: Xn,
4967
4968
  updateDisplayState: (a) => {
@@ -5020,29 +5021,29 @@ async function ed(t = {}) {
5020
5021
  return;
5021
5022
  } catch {
5022
5023
  }
5023
- const g = document.activeElement instanceof HTMLElement ? document.activeElement : null, b = document.createElement("textarea");
5024
- b.value = a, b.readOnly = !0, b.setAttribute("aria-hidden", "true"), b.style.position = "fixed", b.style.left = "-9999px", b.style.opacity = "0", document.body.appendChild(b);
5024
+ const g = document.activeElement instanceof HTMLElement ? document.activeElement : null, w = document.createElement("textarea");
5025
+ w.value = a, w.readOnly = !0, w.setAttribute("aria-hidden", "true"), w.style.position = "fixed", w.style.left = "-9999px", w.style.opacity = "0", document.body.appendChild(w);
5025
5026
  try {
5026
- if (b.select(), b.setSelectionRange(0, a.length), !document.execCommand("copy"))
5027
+ if (w.select(), w.setSelectionRange(0, a.length), !document.execCommand("copy"))
5027
5028
  throw new Error("Could not copy referral link.");
5028
5029
  } finally {
5029
- b.remove(), g?.isConnected && g.focus({ preventScroll: !0 });
5030
+ w.remove(), g?.isConnected && g.focus({ preventScroll: !0 });
5030
5031
  }
5031
5032
  }
5032
5033
  function so(a, g) {
5033
- const b = a.accentColor ?? e.accentColor, C = a.colorScheme ?? e.colorScheme, E = a.fontFamily ?? e.fontFamily, Q = a.scribbleStyle ?? e.scribbleStyle;
5034
+ const w = a.accentColor ?? e.accentColor, C = a.colorScheme ?? e.colorScheme, E = a.fontFamily ?? e.fontFamily, Q = a.scribbleStyle ?? e.scribbleStyle;
5034
5035
  r = mr(
5035
- b,
5036
+ w,
5036
5037
  Q
5037
5038
  ), wr(i, r, {
5038
- accentColor: b,
5039
+ accentColor: w,
5039
5040
  colorScheme: C,
5040
5041
  fontFamily: E,
5041
5042
  scribbleStyle: Q
5042
5043
  }), he("web-sdk.widget", "Updated widget appearance", {
5043
5044
  source: g,
5044
5045
  inputAppearance: a,
5045
- appliedAccentColor: b,
5046
+ appliedAccentColor: w,
5046
5047
  appliedColorScheme: C,
5047
5048
  appliedFontFamily: E,
5048
5049
  appliedScribbleStyle: Q,
@@ -5133,7 +5134,7 @@ function rd({
5133
5134
  !d && Math.hypot(k, N) < Mn || (d = !0, t.classList.add("pluno-pa-widget--dragging"), i({ x: p.x + k, y: p.y + N }));
5134
5135
  }, _ = (y) => {
5135
5136
  s === y.pointerId && (y.preventDefault(), y.stopPropagation(), d && (u = { x: y.clientX, y: y.clientY }, r()), c());
5136
- }, w = (y) => {
5137
+ }, b = (y) => {
5137
5138
  s === y.pointerId && (y.preventDefault(), c());
5138
5139
  }, h = (y) => {
5139
5140
  if (!u)
@@ -5150,8 +5151,8 @@ function rd({
5150
5151
  let M = null;
5151
5152
  y.key === "ArrowUp" ? M = { x: N.x, y: N.y - k } : y.key === "ArrowDown" ? M = { x: N.x, y: N.y + k } : y.key === "ArrowLeft" ? M = { x: N.x - k, y: N.y } : y.key === "ArrowRight" && (M = { x: N.x + k, y: N.y }), M && (y.preventDefault(), y.stopPropagation(), i(M), r());
5152
5153
  };
5153
- return e.addEventListener("pointerdown", f), e.addEventListener("pointermove", m), e.addEventListener("pointerup", _), e.addEventListener("pointercancel", w), e.addEventListener("click", h, !0), n.addEventListener("keydown", S), () => {
5154
- e.removeEventListener("pointerdown", f), e.removeEventListener("pointermove", m), e.removeEventListener("pointerup", _), e.removeEventListener("pointercancel", w), e.removeEventListener("click", h, !0), n.removeEventListener("keydown", S);
5154
+ return e.addEventListener("pointerdown", f), e.addEventListener("pointermove", m), e.addEventListener("pointerup", _), e.addEventListener("pointercancel", b), e.addEventListener("click", h, !0), n.addEventListener("keydown", S), () => {
5155
+ e.removeEventListener("pointerdown", f), e.removeEventListener("pointermove", m), e.removeEventListener("pointerup", _), e.removeEventListener("pointercancel", b), e.removeEventListener("click", h, !0), n.removeEventListener("keydown", S);
5155
5156
  };
5156
5157
  }
5157
5158
  function ad({
@@ -5164,22 +5165,22 @@ function ad({
5164
5165
  let r = null, s = null, l = null, p = !1;
5165
5166
  const d = () => {
5166
5167
  r = null, s = null, l = null, p = !1, t.classList.remove("pluno-pa-widget--panel-dragging");
5167
- }, u = (w) => {
5168
- t.classList.contains("pluno-pa-widget--open") && (w.preventDefault(), w.stopPropagation(), r = w.pointerId, s = { x: w.clientX, y: w.clientY }, l = n(), p = !1, e.setPointerCapture?.(w.pointerId));
5169
- }, c = (w) => {
5170
- if (r !== w.pointerId || !s || !l)
5168
+ }, u = (b) => {
5169
+ t.classList.contains("pluno-pa-widget--open") && (b.preventDefault(), b.stopPropagation(), r = b.pointerId, s = { x: b.clientX, y: b.clientY }, l = n(), p = !1, e.setPointerCapture?.(b.pointerId));
5170
+ }, c = (b) => {
5171
+ if (r !== b.pointerId || !s || !l)
5171
5172
  return;
5172
- w.preventDefault(), w.stopPropagation();
5173
- const h = w.clientX - s.x, S = w.clientY - s.y;
5173
+ b.preventDefault(), b.stopPropagation();
5174
+ const h = b.clientX - s.x, S = b.clientY - s.y;
5174
5175
  !p && Math.hypot(h, S) < Mn || (p = !0, t.classList.add("pluno-pa-widget--panel-dragging"), o({ x: l.x + h, y: l.y + S }));
5175
- }, f = (w) => {
5176
- r === w.pointerId && (w.preventDefault(), w.stopPropagation(), p && i(), d());
5177
- }, m = (w) => {
5178
- r === w.pointerId && (w.preventDefault(), d());
5179
- }, _ = (w) => {
5180
- const h = w.shiftKey ? ai : ri, S = n();
5176
+ }, f = (b) => {
5177
+ r === b.pointerId && (b.preventDefault(), b.stopPropagation(), p && i(), d());
5178
+ }, m = (b) => {
5179
+ r === b.pointerId && (b.preventDefault(), d());
5180
+ }, _ = (b) => {
5181
+ const h = b.shiftKey ? ai : ri, S = n();
5181
5182
  let y = null;
5182
- w.key === "ArrowUp" ? y = { x: S.x, y: S.y - h } : w.key === "ArrowDown" ? y = { x: S.x, y: S.y + h } : w.key === "ArrowLeft" ? y = { x: S.x - h, y: S.y } : w.key === "ArrowRight" && (y = { x: S.x + h, y: S.y }), y && (w.preventDefault(), w.stopPropagation(), o(y), i());
5183
+ b.key === "ArrowUp" ? y = { x: S.x, y: S.y - h } : b.key === "ArrowDown" ? y = { x: S.x, y: S.y + h } : b.key === "ArrowLeft" ? y = { x: S.x - h, y: S.y } : b.key === "ArrowRight" && (y = { x: S.x + h, y: S.y }), y && (b.preventDefault(), b.stopPropagation(), o(y), i());
5183
5184
  };
5184
5185
  return e.addEventListener("pointerdown", u), e.addEventListener("pointermove", c), e.addEventListener("pointerup", f), e.addEventListener("pointercancel", m), e.addEventListener("keydown", _), () => {
5185
5186
  e.removeEventListener("pointerdown", u), e.removeEventListener("pointermove", c), e.removeEventListener("pointerup", f), e.removeEventListener("pointercancel", m), e.removeEventListener("keydown", _);
@@ -5210,16 +5211,16 @@ function sd({
5210
5211
  r === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && i(), u());
5211
5212
  }, _ = (h) => {
5212
5213
  r === h.pointerId && (h.preventDefault(), u());
5213
- }, w = (h) => {
5214
+ }, b = (h) => {
5214
5215
  const y = h.currentTarget.dataset.resizeDirection, k = h.shiftKey ? ai : ri, N = n();
5215
5216
  let M = 0, z = 0;
5216
5217
  br(y) && (h.key === "ArrowLeft" ? M = -k : h.key === "ArrowRight" ? M = k : h.key === "ArrowUp" ? z = -k : h.key === "ArrowDown" && (z = k), !(M === 0 && z === 0) && (h.preventDefault(), h.stopPropagation(), o(_r(N, y, M, z)), i()));
5217
5218
  };
5218
5219
  for (const h of e)
5219
- h.addEventListener("pointerdown", c), h.addEventListener("pointermove", f), h.addEventListener("pointerup", m), h.addEventListener("pointercancel", _), h.addEventListener("keydown", w);
5220
+ h.addEventListener("pointerdown", c), h.addEventListener("pointermove", f), h.addEventListener("pointerup", m), h.addEventListener("pointercancel", _), h.addEventListener("keydown", b);
5220
5221
  return () => {
5221
5222
  for (const h of e)
5222
- h.removeEventListener("pointerdown", c), h.removeEventListener("pointermove", f), h.removeEventListener("pointerup", m), h.removeEventListener("pointercancel", _), h.removeEventListener("keydown", w);
5223
+ h.removeEventListener("pointerdown", c), h.removeEventListener("pointermove", f), h.removeEventListener("pointerup", m), h.removeEventListener("pointercancel", _), h.removeEventListener("keydown", b);
5223
5224
  };
5224
5225
  }
5225
5226
  function br(t) {
@@ -5942,8 +5943,8 @@ function Nd(t, e) {
5942
5943
  "flood-color": "#000000",
5943
5944
  "flood-opacity": "0.22"
5944
5945
  });
5945
- const w = I(r, "clipPath", { id: o.boltClip });
5946
- I(w, "path", { d: Rn });
5946
+ const b = I(r, "clipPath", { id: o.boltClip });
5947
+ I(b, "path", { d: Rn });
5947
5948
  const h = I(i, "g", {
5948
5949
  filter: fe(o.softDropShadow)
5949
5950
  });
@@ -6628,7 +6629,7 @@ function Eo(t, e) {
6628
6629
  (o) => !ka(o)
6629
6630
  ).length === 0 && !t.assistantDraft && !t.lastError && !t.isThinking && !e;
6630
6631
  }
6631
- function nu(t, e, n, o, i, r, s, l, p, d, u, c, f, m, _, w, h, S, y, k, N, M) {
6632
+ function nu(t, e, n, o, i, r, s, l, p, d, u, c, f, m, _, b, h, S, y, k, N, M) {
6632
6633
  const z = cu(r), L = du(
6633
6634
  z.filter((T) => !ka(T))
6634
6635
  ), se = t.scrollTop, V = [], Ne = /* @__PURE__ */ new Set(), O = (T) => {
@@ -6788,7 +6789,7 @@ function nu(t, e, n, o, i, r, s, l, p, d, u, c, f, m, _, w, h, S, y, k, N, M) {
6788
6789
  const W = document.createElement("button");
6789
6790
  W.type = "button", W.className = "pluno-pa-widget__error-retry", W.textContent = "Try again", W.addEventListener(
6790
6791
  "click",
6791
- r.lastErrorCode === "connection_failed" ? y : w
6792
+ r.lastErrorCode === "connection_failed" ? y : b
6792
6793
  ), T.appendChild(W);
6793
6794
  }
6794
6795
  O(T), x = T, q = null;
@@ -7003,8 +7004,8 @@ function du(t) {
7003
7004
  ) ? { ...f, steered: !0 } : f;
7004
7005
  if (m.role !== "tool" || m.integrationAuthRequest)
7005
7006
  continue;
7006
- const _ = Rr(m), w = p.get(_) ?? [];
7007
- w.push(m), p.set(_, w);
7007
+ const _ = Rr(m), b = p.get(_) ?? [];
7008
+ b.push(m), p.set(_, b);
7008
7009
  }
7009
7010
  const d = /* @__PURE__ */ new Set(), u = [];
7010
7011
  for (const c of s) {
@@ -7167,7 +7168,7 @@ function Nn(t) {
7167
7168
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
7168
7169
  }
7169
7170
  function yu(t, e, n, o, i) {
7170
- const r = t.length > 0 && t.every((w) => w.steered === !0);
7171
+ const r = t.length > 0 && t.every((b) => b.steered === !0);
7171
7172
  e = e && !r;
7172
7173
  const s = document.createElement("article");
7173
7174
  s.className = "pluno-pa-widget__tool-group", s.classList.toggle("pluno-pa-widget__tool-group--active", e), s.title = new Date(
@@ -7180,8 +7181,8 @@ function yu(t, e, n, o, i) {
7180
7181
  );
7181
7182
  const l = xu(t, e);
7182
7183
  if (e) {
7183
- const w = document.createElement("div");
7184
- return w.className = "pluno-pa-widget__tool-active-content", w.appendChild(Vt()), w.appendChild(l), s.appendChild(w), s;
7184
+ const b = document.createElement("div");
7185
+ return b.className = "pluno-pa-widget__tool-active-content", b.appendChild(Vt()), b.appendChild(l), s.appendChild(b), s;
7185
7186
  }
7186
7187
  const p = document.createElement("details"), d = vu(t);
7187
7188
  p.open = n.has(d), s.classList.toggle("pluno-pa-widget__tool-group--open", p.open), p.addEventListener("toggle", () => {
@@ -7293,8 +7294,8 @@ function Iu(t, e) {
7293
7294
  break;
7294
7295
  const f = document.createElement("tr");
7295
7296
  n.forEach((m, _) => {
7296
- const w = document.createElement("td"), h = i[_];
7297
- h && w.classList.add(`pluno-pa-widget__table-cell--${h}`), Qe(w, c[_] ?? ""), f.appendChild(w);
7297
+ const b = document.createElement("td"), h = i[_];
7298
+ h && b.classList.add(`pluno-pa-widget__table-cell--${h}`), Qe(b, c[_] ?? ""), f.appendChild(b);
7298
7299
  }), d.appendChild(f), u += 1;
7299
7300
  }
7300
7301
  return s.appendChild(d), r.appendChild(s), { element: r, nextIndex: u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "description": "Browser SDK and default widget for embedding Pluno Product Agent into customer web apps.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",