@pluno/product-agent-web 0.1.159 → 0.1.161

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.
@@ -193,9 +193,9 @@ function nl(t, e, n, i) {
193
193
  return !s.isActivity || !s.isTransient ? !0 : e !== null && s.respondsToUserMessageId !== void 0 ? s.respondsToUserMessageId !== e : n === null || s.runId !== n;
194
194
  });
195
195
  }
196
- const Di = "pluno.productAgent.transportId", il = "pluno.productAgent.transportIdentity", Ui = "pluno.productAgent.transportIdentity.event", ol = 50, sl = globalThis.setTimeout.bind(globalThis);
196
+ const Di = "pluno.productAgent.transportId", il = "pluno.productAgent.transportIdentity", Ni = "pluno.productAgent.transportIdentity.event", ol = 50, sl = globalThis.setTimeout.bind(globalThis);
197
197
  let en = null;
198
- const Gn = /* @__PURE__ */ new Set(), Ni = /* @__PURE__ */ new Map();
198
+ const Gn = /* @__PURE__ */ new Set(), Ui = /* @__PURE__ */ new Map();
199
199
  async function rl(t = mr()) {
200
200
  const e = t.randomUUID(), n = t.storage.getItem(Di);
201
201
  let i = n ?? t.randomUUID(), o = !1, s = !1;
@@ -268,13 +268,13 @@ function pl() {
268
268
  return {
269
269
  getItem: (t) => {
270
270
  try {
271
- return window.sessionStorage?.getItem(t) ?? Ni.get(t) ?? null;
271
+ return window.sessionStorage?.getItem(t) ?? Ui.get(t) ?? null;
272
272
  } catch {
273
- return Ni.get(t) ?? null;
273
+ return Ui.get(t) ?? null;
274
274
  }
275
275
  },
276
276
  setItem: (t, e) => {
277
- Ni.set(t, e);
277
+ Ui.set(t, e);
278
278
  try {
279
279
  window.sessionStorage?.setItem(t, e);
280
280
  } catch {
@@ -298,7 +298,7 @@ function cl() {
298
298
  }
299
299
  function dl() {
300
300
  const t = /* @__PURE__ */ new Set(), e = (n) => {
301
- if (n.key !== Ui || !n.newValue)
301
+ if (n.key !== Ni || !n.newValue)
302
302
  return;
303
303
  const i = JSON.parse(n.newValue);
304
304
  for (const o of t)
@@ -307,9 +307,9 @@ function dl() {
307
307
  return window.addEventListener("storage", e), {
308
308
  postMessage: (n) => {
309
309
  window.localStorage.setItem(
310
- Ui,
310
+ Ni,
311
311
  JSON.stringify({ ...n, eventId: crypto.randomUUID() })
312
- ), window.localStorage.removeItem(Ui);
312
+ ), window.localStorage.removeItem(Ni);
313
313
  },
314
314
  subscribe: (n) => (t.add(n), () => t.delete(n)),
315
315
  close: () => {
@@ -445,7 +445,7 @@ function Oi(t, e, n) {
445
445
  };
446
446
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: o }));
447
447
  }
448
- const xl = "https://app.pluno.ai", vl = "gpt-5.6-terra", Sl = 2e4, Il = 1e4, Tl = 1e4, El = 1e4, Cl = 1e4, kl = 1e3, bs = 3e4, ys = 0.2, _s = 6e4, Al = 15e3, tn = 8, Ml = "Pluno could not finish this message. Try it again.", Rl = "Browser connection was interrupted.", xs = 15e3, Pl = "Pluno could not send this message. Try it again.", vs = 2e3, Ll = 1e3, Dl = 100, Ss = 8e3, Is = 3, Ul = [300, 1e3], br = 50 * 1024 * 1024, Nl = /* @__PURE__ */ new Set([
448
+ const xl = "https://app.pluno.ai", vl = "gpt-5.6-terra", Sl = 2e4, Il = 1e4, Tl = 1e4, El = 1e4, Cl = 1e4, kl = 1e3, bs = 3e4, ys = 0.2, _s = 6e4, Al = 15e3, tn = 8, Ml = "Pluno could not finish this message. Try it again.", Rl = "Browser connection was interrupted.", xs = 15e3, Pl = "Pluno could not send this message. Try it again.", vs = 2e3, Ll = 1e3, Dl = 100, Ss = 8e3, Is = 3, Nl = [300, 1e3], br = 50 * 1024 * 1024, Ul = /* @__PURE__ */ new Set([
449
449
  ".jpeg:image/jpeg",
450
450
  ".jpg:image/jpeg",
451
451
  ".pdf:application/pdf",
@@ -591,11 +591,12 @@ class ko {
591
591
  backendUrl: lp(e.backendUrl ?? xl),
592
592
  clientId: e.clientId ?? Cp(),
593
593
  model: e.model ?? vl,
594
+ productVariant: e.productVariant ?? "customer_embedded",
594
595
  entrySurface: pp(e.entrySurface)
595
596
  }, n);
596
597
  try {
597
598
  $a().catch((o) => {
598
- J("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
599
+ X("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
599
600
  message: o instanceof Error ? o.message : String(o)
600
601
  });
601
602
  }), e.disableNetworkCapture || i.enableNetworkCapture(), i.startPageLifecycleRecovery(), i.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await i.connect();
@@ -631,9 +632,9 @@ class ko {
631
632
  throw new Error("Pluno requires a token or tokenProvider");
632
633
  const n = dp(this.options.backendUrl), i = this.options.webSocketFactory?.(n) ?? new WebSocket(n);
633
634
  this.socket = i, this.socketConnectTimer = window.setTimeout(() => {
634
- this.socket === i && i.readyState === WebSocket.CONNECTING && (J("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(i));
635
+ this.socket === i && i.readyState === WebSocket.CONNECTING && (X("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(i));
635
636
  }, El), i.addEventListener("open", () => {
636
- this.socket !== i || (this.clearSocketConnectTimer(), J("web-sdk.agent", "Pluno socket opened", {
637
+ this.socket !== i || (this.clearSocketConnectTimer(), X("web-sdk.agent", "Pluno socket opened", {
637
638
  queuedClientEventCount: this.queuedClientEvents.length,
638
639
  isThinking: this.state.isThinking
639
640
  }), !(this.token ? this.sendNow({
@@ -643,7 +644,7 @@ class ko {
643
644
  transportId: this.transportIdentity.transportId,
644
645
  pageUrl: location.href
645
646
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
646
- this.socket === i && (J("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(i));
647
+ this.socket === i && (X("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(i));
647
648
  }, Cl));
648
649
  }), i.addEventListener("message", (o) => {
649
650
  this.socket === i && this.handleServerEvent(_p(o.data));
@@ -655,7 +656,7 @@ class ko {
655
656
  (r) => r.type === "chat.user_message" && r.clientMessageId === s.clientMessageId
656
657
  ) && (this.queuedClientEvents.push(s), Lt(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), i.readyState !== WebSocket.CLOSED && i.readyState !== WebSocket.CLOSING && i.close();
657
658
  }), i.addEventListener("close", (o) => {
658
- this.socket === i && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (this.rememberBrowserConnectionInterruptionForActiveRun(), J("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
659
+ this.socket === i && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (this.rememberBrowserConnectionInterruptionForActiveRun(), X("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
659
660
  code: typeof o?.code == "number" ? o.code : null,
660
661
  reason: typeof o?.reason == "string" ? o.reason : "",
661
662
  wasClean: typeof o?.wasClean == "boolean" ? o.wasClean : null,
@@ -663,7 +664,7 @@ class ko {
663
664
  isThinking: this.state.isThinking
664
665
  }), this.setReconnectingState(), this.scheduleReconnect()));
665
666
  }), i.addEventListener("error", () => {
666
- this.socket !== i || this.state.status === "closed" || (J("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
667
+ this.socket !== i || this.state.status === "closed" || (X("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
667
668
  queuedClientEventCount: this.queuedClientEvents.length,
668
669
  isThinking: this.state.isThinking
669
670
  }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.rememberBrowserConnectionInterruptionForActiveRun(), this.setReconnectingState(), this.scheduleReconnect(), i.readyState !== WebSocket.CLOSED && i.readyState !== WebSocket.CLOSING && i.close());
@@ -702,7 +703,7 @@ class ko {
702
703
  }
703
704
  async sendMessage(e, n = {}) {
704
705
  const i = e.trim(), o = n.attachments ?? [];
705
- if (!this.options.persistAttachmentUpload && (o.forEach(Nr), o.reduce(
706
+ if (this.options.productVariant === "customer_embedded" && (o.forEach(Ur), o.reduce(
706
707
  (b, I) => b + I.sizeBytes,
707
708
  0
708
709
  ) > br))
@@ -793,7 +794,7 @@ class ko {
793
794
  return e ? (this.retryAttemptsByClientMessageId[n] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = n, this.browserConnectionInterruptedClientMessageIds.delete(n), this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: n, automatic: !1 }), !0) : !1;
794
795
  }
795
796
  createLocalAttachment(e) {
796
- this.options.persistAttachmentUpload || Ur(e);
797
+ this.options.productVariant === "customer_embedded" && Nr(e);
797
798
  const n = on(), i = {
798
799
  id: n,
799
800
  name: e.name || "attachment",
@@ -813,7 +814,7 @@ class ko {
813
814
  createdAt: o,
814
815
  lastUsedAt: o
815
816
  }).catch((s) => {
816
- J("web-sdk.attachments", "Failed to store Product Agent attachment", {
817
+ X("web-sdk.attachments", "Failed to store Product Agent attachment", {
817
818
  attachmentId: n,
818
819
  name: i.name,
819
820
  message: s instanceof Error ? s.message : String(s)
@@ -875,7 +876,7 @@ class ko {
875
876
  storageKey: l.storageKey,
876
877
  lastUsedAt: Date.now()
877
878
  }).catch((p) => {
878
- J("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
879
+ X("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
879
880
  attachmentId: n.id,
880
881
  name: l.name,
881
882
  message: p instanceof Error ? p.message : String(p)
@@ -1035,13 +1036,36 @@ class ko {
1035
1036
  try {
1036
1037
  return n.send(JSON.stringify(e)), Oi("client_event", e.type, ws(e)), !0;
1037
1038
  } catch (i) {
1038
- return J("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
1039
+ return X("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
1039
1040
  message: i instanceof Error ? i.message : String(i),
1040
1041
  queuedClientEventCount: this.queuedClientEvents.length,
1041
1042
  isThinking: this.state.isThinking
1042
1043
  }), this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect()), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close(), !1;
1043
1044
  }
1044
1045
  }
1046
+ reportHealthSignal(e, n = {}) {
1047
+ if (!(!this.socket || this.socket.readyState !== WebSocket.OPEN))
1048
+ try {
1049
+ this.socket.send(JSON.stringify({
1050
+ type: "runtime.health",
1051
+ signal: {
1052
+ id: crypto.randomUUID(),
1053
+ name: e,
1054
+ occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
1055
+ source: "web_sdk",
1056
+ entrySurface: this.options.entrySurface,
1057
+ ...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
1058
+ ...this.activeResponseRunId ? { runId: this.activeResponseRunId } : {},
1059
+ ...n
1060
+ }
1061
+ }));
1062
+ } catch (i) {
1063
+ X("web-sdk.agent", "Pluno health signal send failed", {
1064
+ name: e,
1065
+ message: i instanceof Error ? i.message : String(i)
1066
+ });
1067
+ }
1068
+ }
1045
1069
  requestTransientStarterPrompts() {
1046
1070
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
1047
1071
  return;
@@ -1116,7 +1140,7 @@ class ko {
1116
1140
  if (Gl(e) && this.markThinkingProgress(), e.type === "auth.ok") {
1117
1141
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingWarmupEvent(), this.startHeartbeat();
1118
1142
  const n = Sp(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
1119
- J("web-sdk.agent", "Received auth.ok appearance", {
1143
+ X("web-sdk.agent", "Received auth.ok appearance", {
1120
1144
  hasAppearance: i,
1121
1145
  rawAppearance: e.appearance,
1122
1146
  normalizedAppearance: n
@@ -1144,7 +1168,7 @@ class ko {
1144
1168
  if (e.type === "conversation.state") {
1145
1169
  const n = Array.isArray(e.items) ? e.items : [], i = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, o = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, s = e.isRetrying === !0;
1146
1170
  i && o && (this.pendingClientMessageId = o);
1147
- const r = Np(
1171
+ const r = Up(
1148
1172
  e.assistantDraft
1149
1173
  ), l = r !== void 0;
1150
1174
  this.rememberUserMessageClientMessageIds(n);
@@ -1157,14 +1181,14 @@ class ko {
1157
1181
  );
1158
1182
  }
1159
1183
  const d = n.filter((I) => {
1160
- const P = Nt(I);
1184
+ const P = Ut(I);
1161
1185
  return Ms(P) ? !1 : !P || !p || !ro(P) ? !0 : lo(n, P) !== p;
1162
1186
  }), g = jp(
1163
1187
  this.state.messages,
1164
1188
  Ap(d, this.options.backendUrl)
1165
1189
  ), c = As(g), h = !l && n.some(
1166
1190
  (I) => Rs(
1167
- Nt(I),
1191
+ Ut(I),
1168
1192
  this.state.assistantDraft,
1169
1193
  this.state.assistantDraftItemId,
1170
1194
  this.state.assistantDraftRespondsToUserMessageId,
@@ -1246,7 +1270,7 @@ class ko {
1246
1270
  }
1247
1271
  if (e.type === "session.item") {
1248
1272
  this.rememberUserMessageClientMessageIds([e.item]);
1249
- const n = Nt(e.item);
1273
+ const n = Ut(e.item);
1250
1274
  if (ro(n)) {
1251
1275
  typeof n?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(n.runId);
1252
1276
  const o = se(e.item, "sessionId") ?? this.state.sessionId, s = n ? pt(n) : null, r = s ? this.clientMessageIdsByUserMessageItemId.get(s) : null, l = typeof n?.clientMessageId == "string" ? n.clientMessageId : r ?? (s ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
@@ -1489,7 +1513,11 @@ class ko {
1489
1513
  return;
1490
1514
  const i = this.retryAttemptsByClientMessageId[n] ?? 0;
1491
1515
  if (i >= tn) {
1492
- this.retryableClientMessageId = n, this.setState({
1516
+ this.reportHealthSignal("run_recovery_exhausted", {
1517
+ clientMessageId: n,
1518
+ retryAttempts: i,
1519
+ reason: "retry_budget_exhausted"
1520
+ }), this.retryableClientMessageId = n, this.setState({
1493
1521
  messages: Fn(
1494
1522
  this.state.messages,
1495
1523
  n,
@@ -1513,7 +1541,7 @@ class ko {
1513
1541
  }
1514
1542
  rememberUserMessageClientMessageIds(e) {
1515
1543
  for (const n of e) {
1516
- const i = se(n, "id"), o = Nt(n);
1544
+ const i = se(n, "id"), o = Ut(n);
1517
1545
  i && o?.type === "message" && o.role === "user" && o.optimistic !== !0 && !i.startsWith("optimistic-user-message:") && typeof o.clientMessageId == "string" && (this.clientMessageIdsByUserMessageItemId.set(i, o.clientMessageId), o.clientMessageId === this.pendingClientMessageId && this.promotePendingDelivery(
1518
1546
  o.clientMessageId,
1519
1547
  se(n, "sessionId") ?? this.state.sessionId,
@@ -1609,7 +1637,7 @@ class ko {
1609
1637
  this.failPendingDelivery(e);
1610
1638
  return;
1611
1639
  }
1612
- this.retryAttemptsByClientMessageId[e] = n + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
1640
+ n === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = n + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
1613
1641
  this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
1614
1642
  }, nn(n, vs));
1615
1643
  }
@@ -1647,10 +1675,10 @@ class ko {
1647
1675
  }, xs);
1648
1676
  }
1649
1677
  recoverMissedRunAck(e) {
1650
- !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (J("web-sdk.agent", "Pluno run ack missed; resyncing session", {
1678
+ !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (X("web-sdk.agent", "Pluno run ack missed; resyncing session", {
1651
1679
  sessionId: this.state.sessionId,
1652
1680
  clientMessageId: e
1653
- }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
1681
+ }), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
1654
1682
  }
1655
1683
  scheduleRunAckResyncRetry(e) {
1656
1684
  this.clearRunAckResyncRetryTimer();
@@ -1660,7 +1688,7 @@ class ko {
1660
1688
  status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
1661
1689
  isThinking: !0,
1662
1690
  lastError: null
1663
- }), J("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
1691
+ }), X("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
1664
1692
  sessionId: this.state.sessionId,
1665
1693
  clientMessageId: e
1666
1694
  }), this.state.sessionId ? this.send({
@@ -1682,8 +1710,10 @@ class ko {
1682
1710
  return;
1683
1711
  const e = this.activeClientMessageId;
1684
1712
  if (!e) {
1685
- J("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
1713
+ X("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
1686
1714
  sessionId: this.state.sessionId
1715
+ }), this.reportHealthSignal("run_recovery_exhausted", {
1716
+ reason: "missing_client_message_id"
1687
1717
  }), this.setState({
1688
1718
  isThinking: !1,
1689
1719
  lastError: this.getRunRecoveryExhaustedErrorMessage(null),
@@ -1693,9 +1723,13 @@ class ko {
1693
1723
  }
1694
1724
  const n = this.thinkingWatchdogResyncAttemptsByClientMessageId[e] ?? 0, i = this.retryAttemptsByClientMessageId[e] ?? 0;
1695
1725
  if (i >= tn) {
1696
- J("web-sdk.agent", "Pluno run recovery retry exhausted", {
1726
+ X("web-sdk.agent", "Pluno run recovery retry exhausted", {
1697
1727
  sessionId: this.state.sessionId,
1698
1728
  clientMessageId: e
1729
+ }), this.reportHealthSignal("run_recovery_exhausted", {
1730
+ clientMessageId: e,
1731
+ retryAttempts: i,
1732
+ reason: "retry_budget_exhausted"
1699
1733
  }), this.retryableClientMessageId = e, this.setState({
1700
1734
  messages: Fn(
1701
1735
  this.state.messages,
@@ -1709,7 +1743,7 @@ class ko {
1709
1743
  return;
1710
1744
  }
1711
1745
  if (n < 1) {
1712
- this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = n + 1, J("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
1746
+ this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = n + 1, X("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
1713
1747
  sessionId: this.state.sessionId,
1714
1748
  clientMessageId: e,
1715
1749
  resyncAttempts: n + 1
@@ -1720,7 +1754,7 @@ class ko {
1720
1754
  status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
1721
1755
  isThinking: !0,
1722
1756
  lastError: null
1723
- }), J("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
1757
+ }), X("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
1724
1758
  sessionId: this.state.sessionId,
1725
1759
  clientMessageId: e,
1726
1760
  retryAttempts: i + 1
@@ -1742,7 +1776,7 @@ class ko {
1742
1776
  }) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
1743
1777
  }
1744
1778
  async executeToolCall(e) {
1745
- const n = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, o = typeof e.toolName == "string" ? e.toolName : null, s = Ut(
1779
+ const n = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, o = typeof e.toolName == "string" ? e.toolName : null, s = Nt(
1746
1780
  typeof e.summary == "string" ? e.summary : "Running browser tool"
1747
1781
  ), r = e.rawInput;
1748
1782
  if (!n || !i || !o)
@@ -1868,7 +1902,7 @@ class ko {
1868
1902
  const e = Wl(this.reconnectAttempts);
1869
1903
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
1870
1904
  this.reconnectTimer = null, this.connect().catch((n) => {
1871
- J("web-sdk.agent", "Pluno reconnect failed; retrying", {
1905
+ X("web-sdk.agent", "Pluno reconnect failed; retrying", {
1872
1906
  message: n instanceof Error ? n.message : String(n),
1873
1907
  queuedClientEventCount: this.queuedClientEvents.length,
1874
1908
  isThinking: this.state.isThinking
@@ -1880,7 +1914,7 @@ class ko {
1880
1914
  this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
1881
1915
  const e = this.socket;
1882
1916
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
1883
- this.socket === e && (J("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
1917
+ this.socket === e && (X("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
1884
1918
  }, Il));
1885
1919
  }, Sl);
1886
1920
  }
@@ -2104,7 +2138,7 @@ function jl() {
2104
2138
  };
2105
2139
  return window.__plunoProductAgentNetworkCapture = c, c;
2106
2140
  }
2107
- function J(t, e, n) {
2141
+ function X(t, e, n) {
2108
2142
  if (typeof window > "u")
2109
2143
  return;
2110
2144
  const i = window, o = {
@@ -2543,11 +2577,11 @@ function mp(t, e) {
2543
2577
  return `${I.tagName.toLowerCase()}|${w(I)}|${P}`;
2544
2578
  }, m = (I, P, O) => {
2545
2579
  const L = (B, Q) => {
2546
- const U = B.tagName.toLowerCase(), ge = window.getComputedStyle(B), K = g.has(B);
2547
- if (_ >= 1e3 && !K || O.has(B) || s.has(U) || B.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ge.display === "none" || ge.visibility === "hidden")
2580
+ const N = B.tagName.toLowerCase(), ge = window.getComputedStyle(B), K = g.has(B);
2581
+ if (_ >= 1e3 && !K || O.has(B) || s.has(N) || B.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ge.display === "none" || ge.visibility === "hidden")
2548
2582
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
2549
2583
  _ += 1;
2550
- const Qe = w(B), Pe = Ir(B), q = l.has(Qe) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(U) || U === "a" && B.hasAttribute("href"), Le = Array.from(B.children).filter((T) => T instanceof HTMLElement), x = /* @__PURE__ */ new Map();
2584
+ const Qe = w(B), Pe = Ir(B), q = l.has(Qe) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(N) || N === "a" && B.hasAttribute("href"), Le = Array.from(B.children).filter((T) => T instanceof HTMLElement), x = /* @__PURE__ */ new Map();
2551
2585
  for (const T of Le) {
2552
2586
  const A = f(T);
2553
2587
  x.set(A, (x.get(A) ?? 0) + 1);
@@ -2559,8 +2593,8 @@ function mp(t, e) {
2559
2593
  }
2560
2594
  const ce = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Set(), ee = [], De = [];
2561
2595
  for (const T of Le) {
2562
- const A = f(T), W = x.get(A) ?? 0, Ne = ce.get(A) ?? 0;
2563
- if (ce.set(A, Ne + 1), W > 8 && Ne >= 6 && !g.has(T)) {
2596
+ const A = f(T), W = x.get(A) ?? 0, Ue = ce.get(A) ?? 0;
2597
+ if (ce.set(A, Ue + 1), W > 8 && Ue >= 6 && !g.has(T)) {
2564
2598
  et.has(A) || (ee.push([`… ${H.get(A) ?? 0} similar siblings omitted`]), et.add(A));
2565
2599
  continue;
2566
2600
  }
@@ -2571,11 +2605,11 @@ function mp(t, e) {
2571
2605
  if (B.shadowRoot)
2572
2606
  for (const T of Array.from(B.shadowRoot.children))
2573
2607
  T instanceof HTMLElement && ne.push(L(T, Q + 1));
2574
- const re = [...De, ...ne], Ue = Pe.length > 0 || q || re.some((T) => T.hasUsefulContent), z = zt(
2608
+ const re = [...De, ...ne], Ne = Pe.length > 0 || q || re.some((T) => T.hasUsefulContent), z = zt(
2575
2609
  [Pe, ...re.map((T) => T.textPreview)].filter(Boolean).join(" ")
2576
- ).slice(0, 180), ve = B.hasAttribute("contenteditable") && (Pe.length > 0 || !B.querySelector("[contenteditable]")), C = d.some((T) => B.hasAttribute(T)) || !!Qe || ve, k = (B.getClientRects().length > 0 || ge.display === "contents") && (n.has(U) || C || K) && (Ue || K) && (!o.has(U) || Ue || C || K), ae = k ? 1 : 0, F = [];
2610
+ ).slice(0, 180), ve = B.hasAttribute("contenteditable") && (Pe.length > 0 || !B.querySelector("[contenteditable]")), C = d.some((T) => B.hasAttribute(T)) || !!Qe || ve, k = (B.getClientRects().length > 0 || ge.display === "contents") && (n.has(N) || C || K) && (Ne || K) && (!o.has(N) || Ne || C || K), ae = k ? 1 : 0, F = [];
2577
2611
  if (k) {
2578
- const T = re.some((W) => W.containsTextElement), A = i.has(U) && !T ? z : Pe;
2612
+ const T = re.some((W) => W.containsTextElement), A = i.has(N) && !T ? z : Pe;
2579
2613
  F.push(Sr(B, p, r, A.slice(0, 180)));
2580
2614
  }
2581
2615
  for (const T of ee)
@@ -2584,18 +2618,18 @@ function mp(t, e) {
2584
2618
  if (V.length > 0) {
2585
2619
  const T = V.slice(0, 20);
2586
2620
  V.length > T.length && T.push("… shadow DOM omitted");
2587
- const A = U.includes("tooltip") || U.includes("popper") || U.includes("loader");
2621
+ const A = N.includes("tooltip") || N.includes("popper") || N.includes("loader");
2588
2622
  if (Q < 2 && !A) {
2589
- const W = k ? "#shadow-root" : `${U} #shadow-root`;
2623
+ const W = k ? "#shadow-root" : `${N} #shadow-root`;
2590
2624
  F.push(...qn([W, ...qn(T, 1)], ae));
2591
2625
  } else
2592
2626
  F.push(...qn(T, ae));
2593
2627
  }
2594
2628
  return {
2595
2629
  lines: F,
2596
- hasUsefulContent: Ue,
2630
+ hasUsefulContent: Ne,
2597
2631
  textPreview: z,
2598
- containsTextElement: i.has(U) || re.some((T) => T.containsTextElement)
2632
+ containsTextElement: i.has(N) || re.some((T) => T.containsTextElement)
2599
2633
  };
2600
2634
  };
2601
2635
  return [`--- ${P} ---`, ...L(I, 0).lines].join(`
@@ -2976,26 +3010,26 @@ function Dp(t) {
2976
3010
  }
2977
3011
  return "🔎 Searching the web";
2978
3012
  }
2979
- return Up(t);
3013
+ return Np(t);
2980
3014
  }
2981
- function Up(t) {
3015
+ function Np(t) {
2982
3016
  if (typeof t.summary == "string" && t.summary.trim().length > 0)
2983
- return Ut(t.summary);
3017
+ return Nt(t.summary);
2984
3018
  if (typeof t.arguments == "string")
2985
3019
  try {
2986
3020
  const e = JSON.parse(t.arguments);
2987
3021
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
2988
- return Ut(e.summary);
3022
+ return Nt(e.summary);
2989
3023
  } catch {
2990
- return typeof t.name == "string" && t.name.trim().length > 0 ? Ut(t.name) : "🛠️ Run tool";
3024
+ return typeof t.name == "string" && t.name.trim().length > 0 ? Nt(t.name) : "🛠️ Run tool";
2991
3025
  }
2992
- return typeof t.name == "string" && t.name.trim().length > 0 ? Ut(t.name) : "🛠️ Run tool";
3026
+ return typeof t.name == "string" && t.name.trim().length > 0 ? Nt(t.name) : "🛠️ Run tool";
2993
3027
  }
2994
- function Ut(t) {
3028
+ function Nt(t) {
2995
3029
  const e = t.trim() || "Run tool", n = e.codePointAt(0) ?? 0;
2996
3030
  return n >= 126976 && n <= 129791 || n >= 9728 && n <= 10175 || n >= 127462 && n <= 127487 ? e : `🛠️ ${e}`;
2997
3031
  }
2998
- function Np(t) {
3032
+ function Up(t) {
2999
3033
  if (t == null)
3000
3034
  return t;
3001
3035
  if (typeof t != "object")
@@ -3095,7 +3129,7 @@ function Hp(t) {
3095
3129
  return !e || !n ? null : {
3096
3130
  id: `transient-activity:${e}`,
3097
3131
  role: "tool",
3098
- content: Ut(
3132
+ content: Nt(
3099
3133
  typeof t.summary == "string" ? t.summary : "Running browser tool"
3100
3134
  ),
3101
3135
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -3250,13 +3284,13 @@ function Xp(t) {
3250
3284
  const e = gn(t);
3251
3285
  if (e === null)
3252
3286
  return null;
3253
- const i = Nt(t[e])?.page;
3287
+ const i = Ut(t[e])?.page;
3254
3288
  if (!i || typeof i != "object")
3255
3289
  return null;
3256
3290
  const o = i.url;
3257
3291
  return typeof o == "string" ? o : null;
3258
3292
  }
3259
- function Nt(t) {
3293
+ function Ut(t) {
3260
3294
  if (!t || typeof t != "object")
3261
3295
  return null;
3262
3296
  const e = t.data;
@@ -3320,7 +3354,7 @@ function lo(t, e) {
3320
3354
  const n = pt(e);
3321
3355
  if (!n)
3322
3356
  return null;
3323
- const i = t.find((s) => se(s, "id") === n), o = Nt(i);
3357
+ const i = t.find((s) => se(s, "id") === n), o = Ut(i);
3324
3358
  return o?.type === "message" && o.role === "user" && typeof o.clientMessageId == "string" ? o.clientMessageId : null;
3325
3359
  }
3326
3360
  function Qp(t, e) {
@@ -3641,16 +3675,16 @@ function Dr(t, e) {
3641
3675
  function co(t) {
3642
3676
  return t.type || vc(t.name) || "application/octet-stream";
3643
3677
  }
3644
- function Ur(t) {
3645
- Nr({
3678
+ function Nr(t) {
3679
+ Ur({
3646
3680
  name: t.name,
3647
3681
  mimeType: co(t),
3648
3682
  sizeBytes: t.size
3649
3683
  });
3650
3684
  }
3651
- function Nr(t) {
3685
+ function Ur(t) {
3652
3686
  const e = xc(t.name), n = t.mimeType.trim().toLowerCase();
3653
- if (!Nl.has(`${e}:${n}`))
3687
+ if (!Ul.has(`${e}:${n}`))
3654
3688
  throw new Error("This attachment type is not supported by the embedded model provider");
3655
3689
  if (t.sizeBytes <= 0 || t.sizeBytes >= br)
3656
3690
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
@@ -3785,11 +3819,11 @@ function Ds(t) {
3785
3819
  function Mc(t) {
3786
3820
  return Me({
3787
3821
  ...t,
3788
- requestBody: Us(t.requestBody),
3789
- responseBody: Us(t.responseBody)
3822
+ requestBody: Ns(t.requestBody),
3823
+ responseBody: Ns(t.responseBody)
3790
3824
  });
3791
3825
  }
3792
- function Us(t) {
3826
+ function Ns(t) {
3793
3827
  if (typeof t != "string")
3794
3828
  return t;
3795
3829
  const e = t.trim();
@@ -3867,7 +3901,7 @@ async function Wn(t, e) {
3867
3901
  try {
3868
3902
  return await t();
3869
3903
  } catch (o) {
3870
- if (n = o, i >= Is - 1 || !Uc(o))
3904
+ if (n = o, i >= Is - 1 || !Nc(o))
3871
3905
  throw o;
3872
3906
  await Dc(i);
3873
3907
  }
@@ -3875,13 +3909,13 @@ async function Wn(t, e) {
3875
3909
  }
3876
3910
  function Dc(t) {
3877
3911
  return new Promise((e) => {
3878
- window.setTimeout(e, Ul[t] ?? 0);
3912
+ window.setTimeout(e, Nl[t] ?? 0);
3879
3913
  });
3880
3914
  }
3881
- function Uc(t) {
3882
- return t instanceof Vn ? Nc(t.status) : t instanceof TypeError;
3883
- }
3884
3915
  function Nc(t) {
3916
+ return t instanceof Vn ? Uc(t.status) : t instanceof TypeError;
3917
+ }
3918
+ function Uc(t) {
3885
3919
  return t === 408 || t === 409 || t === 429 || t >= 500;
3886
3920
  }
3887
3921
  function Oc(t) {
@@ -3934,15 +3968,15 @@ function Gc(t) {
3934
3968
  const e = t.match(Hc)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
3935
3969
  return `${$r(n)}${e}`;
3936
3970
  }
3937
- const Kc = "#7c3aed", ei = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", ti = "#2c2a1e", Ns = [253, 250, 241], Os = 3.5;
3971
+ const Kc = "#7c3aed", ei = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", ti = "#2c2a1e", Us = [253, 250, 241], Os = 3.5;
3938
3972
  function jr(t) {
3939
3973
  const e = Gr(t);
3940
- if (zs(pn(e), Ns) >= Os)
3974
+ if (zs(pn(e), Us) >= Os)
3941
3975
  return e;
3942
3976
  let i = pn(e);
3943
3977
  const o = pn(ti);
3944
3978
  for (let s = 0; s < 6; s += 1)
3945
- if (i = Xc(i, o, 0.22), zs(i, Ns) >= Os)
3979
+ if (i = Xc(i, o, 0.22), zs(i, Us) >= Os)
3946
3980
  return uo(i);
3947
3981
  return uo(i);
3948
3982
  }
@@ -4214,7 +4248,7 @@ function wd(t, e = Date.now(), n) {
4214
4248
  }
4215
4249
  const bd = 6e4, Vr = 100, yd = 1e4, _d = 5e3;
4216
4250
  let xd = 0;
4217
- const vd = "product-agent:sdk-preview-socket-connect", Sd = "product-agent:sdk-preview-socket-send", Id = "product-agent:sdk-preview-socket-close", Td = "product-agent:sdk-preview-socket-open", Ed = "product-agent:sdk-preview-socket-message", Cd = "product-agent:sdk-preview-socket-error", kd = "product-agent:sdk-preview-socket-closed", Ws = "product-agent:sdk-preview-socket-id", Ad = "data-pluno-sdk-preview-channel", Yr = "data-pluno-auto-mounted", Ke = "__plunoProductAgentAutoMountOwner", Md = 1e4, Rd = "Failed to load Pluno widget token", Hs = "Timed out loading Pluno widget token", Pd = "pluno.productAgent.widgetClientId.", ji = /* @__PURE__ */ new Set(), Ld = "product-agent:preview-diagnostic", Xr = "pluno.productAgent.sharePromptsDisabled", Dd = 3, $s = 'dialog[open], [aria-modal="true"], [role="dialog"]', js = 1500, Ud = 5e3, Nd = 500, Od = "No recent chats for this page yet.", Ve = {
4251
+ const vd = "product-agent:sdk-preview-socket-connect", Sd = "product-agent:sdk-preview-socket-send", Id = "product-agent:sdk-preview-socket-close", Td = "product-agent:sdk-preview-socket-open", Ed = "product-agent:sdk-preview-socket-message", Cd = "product-agent:sdk-preview-socket-error", kd = "product-agent:sdk-preview-socket-closed", Ws = "product-agent:sdk-preview-socket-id", Ad = "data-pluno-sdk-preview-channel", Yr = "data-pluno-auto-mounted", Ke = "__plunoProductAgentAutoMountOwner", Md = 1e4, Rd = "Failed to load Pluno widget token", Hs = "Timed out loading Pluno widget token", Pd = "pluno.productAgent.widgetClientId.", ji = /* @__PURE__ */ new Set(), Ld = "product-agent:preview-diagnostic", Xr = "pluno.productAgent.sharePromptsDisabled", Dd = 3, $s = 'dialog[open], [aria-modal="true"], [role="dialog"]', js = 1500, Nd = 5e3, Ud = 500, Od = "No recent chats for this page yet.", Ve = {
4218
4252
  launcherLabel: "Ask for anything...",
4219
4253
  accentColor: "#7c3aed",
4220
4254
  colorScheme: "light",
@@ -4259,7 +4293,7 @@ const vd = "product-agent:sdk-preview-socket-connect", Sd = "product-agent:sdk-p
4259
4293
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
4260
4294
  pathStrokeWidth: "2.45"
4261
4295
  }
4262
- ], Yd = 11, Xd = 13, ni = 4, Uo = 10, No = 40, Jd = "movable-launcher-position-v2", ea = "pluno-pa-widget-styles", ta = "data-pluno-pa-widget-styles";
4296
+ ], Yd = 11, Xd = 13, ni = 4, No = 10, Uo = 40, Jd = "movable-launcher-position-v2", ea = "pluno-pa-widget-styles", ta = "data-pluno-pa-widget-styles";
4263
4297
  let Vs = 0;
4264
4298
  function Zd(t) {
4265
4299
  return (e) => new Ye(e, t);
@@ -4281,6 +4315,7 @@ async function Qd(t = {}) {
4281
4315
  tokenEndpoint: t.tokenEndpoint,
4282
4316
  backendUrl: t.backendUrl,
4283
4317
  metadata: t.metadata,
4318
+ productVariant: t.productVariant ?? "customer_embedded",
4284
4319
  entrySurface: t.entrySurface,
4285
4320
  initialStarterPrompts: t.initialStarterPrompts,
4286
4321
  clientId: t.clientId,
@@ -4361,7 +4396,7 @@ async function Qd(t = {}) {
4361
4396
  e.movableLauncher,
4362
4397
  e.showLauncherMinimizeButton
4363
4398
  ), s.appendChild(r);
4364
- const p = Og(e), d = e.layout === "floating" ? e.initialDisplayState ?? Ug(e) : "shown";
4399
+ const p = Og(e), d = e.layout === "floating" ? e.initialDisplayState ?? Ng(e) : "shown";
4365
4400
  dr(e, d);
4366
4401
  let g = e.movableLauncher ? p.launcherPosition : null, c = g !== null, h = p.panelSize, _ = null;
4367
4402
  r.style.setProperty(
@@ -4396,7 +4431,7 @@ async function Qd(t = {}) {
4396
4431
  ".pluno-pa-widget__scribble-spirals--panel"
4397
4432
  ), Q = Array.from(
4398
4433
  r.querySelectorAll(".pluno-pa-widget__resize-handle")
4399
- ), U = r.querySelector(
4434
+ ), N = r.querySelector(
4400
4435
  ".pluno-pa-widget__close"
4401
4436
  ), ge = r.querySelector(
4402
4437
  ".pluno-pa-widget__composer"
@@ -4428,7 +4463,7 @@ async function Qd(t = {}) {
4428
4463
  ".pluno-pa-widget__history-status"
4429
4464
  ), re = r.querySelector(
4430
4465
  ".pluno-pa-widget__timeline-jump"
4431
- ), Ue = r.querySelector(
4466
+ ), Ne = r.querySelector(
4432
4467
  ".pluno-pa-widget__active-users-counter"
4433
4468
  ), z = r.querySelector(
4434
4469
  ".pluno-pa-widget__timeline"
@@ -4450,7 +4485,7 @@ async function Qd(t = {}) {
4450
4485
  ".pluno-pa-widget__tab-groups-suggestion-dismiss"
4451
4486
  ), W = r.querySelector(
4452
4487
  ".pluno-pa-widget__proactive-suggestion"
4453
- ), Ne = r.querySelector(
4488
+ ), Ue = r.querySelector(
4454
4489
  ".pluno-pa-widget__proactive-suggestion-query"
4455
4490
  ), Se = r.querySelector(
4456
4491
  ".pluno-pa-widget__proactive-suggestion-run"
@@ -4471,7 +4506,7 @@ async function Qd(t = {}) {
4471
4506
  ), fn = r.querySelector(
4472
4507
  ".pluno-pa-widget__proactive-suggestion-feedback-status"
4473
4508
  );
4474
- if (!m || !b || !O || !U || !ge || !K || !Qe || !Pe || !q || !Le || !x || !H || !pe || !ce || !et || !ee || !De || !ne || !re || !Ue || !z || !ve)
4509
+ if (!m || !b || !O || !N || !ge || !K || !Qe || !Pe || !q || !Le || !x || !H || !pe || !ce || !et || !ee || !De || !ne || !re || !Ne || !z || !ve)
4475
4510
  throw new Error("Failed to mount Pluno widget");
4476
4511
  if (e.movableLauncher && !v)
4477
4512
  throw new Error("Failed to mount Pluno widget drag handle");
@@ -4479,10 +4514,10 @@ async function Qd(t = {}) {
4479
4514
  throw new Error("Failed to mount Pluno widget panel drag handle");
4480
4515
  let Fe = null, ie = "idle";
4481
4516
  const tt = () => {
4482
- if (!W || !Ne || !Fo || !Wo || !he || !qt || !fn)
4517
+ if (!W || !Ue || !Fo || !Wo || !he || !qt || !fn)
4483
4518
  return;
4484
4519
  const a = e.proactiveSuggestion ?? Fe;
4485
- W.hidden = a === null || E.getState().isThinking, Ne.textContent = a?.suggestedQuery ?? "", Fo.hidden = e.proactiveSuggestion === null, Wo.hidden = Fe === null;
4520
+ W.hidden = a === null || E.getState().isThinking, Ue.textContent = a?.suggestedQuery ?? "", Fo.hidden = e.proactiveSuggestion === null, Wo.hidden = Fe === null;
4486
4521
  const u = ie === "success";
4487
4522
  he.hidden = u, qt.hidden = u, qt.disabled = ie === "submitting" || he.value.trim().length === 0, qt.textContent = ie === "submitting" ? "Sending…" : "Send feedback", fn.textContent = ie === "success" ? "Thanks — this helps improve your suggestions." : ie === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", fn.classList.toggle(
4488
4523
  "pluno-pa-widget__proactive-suggestion-feedback-status--success",
@@ -4504,7 +4539,7 @@ async function Qd(t = {}) {
4504
4539
  }
4505
4540
  );
4506
4541
  };
4507
- Le.hidden = !e.attachmentsEnabled, q.disabled = !e.attachmentsEnabled, q.accept = e.persistAttachmentUpload ? "" : Ol, ir(b), ir(x);
4542
+ Le.hidden = !e.attachmentsEnabled, q.disabled = !e.attachmentsEnabled, q.accept = e.productVariant === "personal" ? "" : Ol, ir(b), ir(x);
4508
4543
  let oe = [], wn = !1, We = null;
4509
4544
  const di = (a) => a === x ? "widget_composer" : a === b ? "widget_launcher" : a && s.contains(a) ? "widget_control" : a === f.body ? "body" : a === f.documentElement ? "document" : a ? "host_page" : "none", He = (a, u, y = {}) => {
4510
4545
  const S = Hn(f), R = y.skipIfAlreadyFocused === !0 && S === a;
@@ -4548,13 +4583,14 @@ async function Qd(t = {}) {
4548
4583
  }, Ho = e.loginRequired || e.signupRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async () => ma(e.tokenEndpoint) : void 0);
4549
4584
  if (!e.loginRequired && !e.signupRequired && !e.token && !Ho && !e.webSocketFactory)
4550
4585
  throw new Error("Pluno widget requires token or tokenEndpoint");
4551
- const xa = window.fetch.bind(window), ui = Ng(e.clientId);
4586
+ const xa = window.fetch.bind(window), ui = Ug(e.clientId);
4552
4587
  let E;
4553
4588
  try {
4554
4589
  const a = {
4555
4590
  token: e.token,
4556
4591
  tokenProvider: Ho,
4557
4592
  backendUrl: e.backendUrl,
4593
+ productVariant: e.productVariant,
4558
4594
  metadata: () => ({
4559
4595
  ...typeof e.metadata == "function" ? e.metadata() : e.metadata ?? {},
4560
4596
  ...!E.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
@@ -4591,7 +4627,7 @@ async function Qd(t = {}) {
4591
4627
  const gi = new Set(p.openToolGroupKeys), gt = new Set(
4592
4628
  p.seenShareCandidateIds
4593
4629
  ), Wt = new Set(gt);
4594
- let hi = p.sharePromptsDisabled || await zg(e), Ie = null, it = null, X = !1, bn = !(e.loginRequired || e.signupRequired), ot = !1, ht = {
4630
+ let hi = p.sharePromptsDisabled || await zg(e), Ie = null, it = null, J = !1, bn = !(e.loginRequired || e.signupRequired), ot = !1, ht = {
4595
4631
  enabled: !0
4596
4632
  }, ft = 0, fi = null, mt = null, wt = null, yn = null, $o = "", de = !1, fe = !1, Oe = [], Ht = null, bt = null, _n = !1, yt = 0, me = null, jo = location.origin, Go = E.getState().sessionId, Ko = E.getState().user?.id ?? null, mi = E.getState().status;
4597
4633
  const Te = (a, u) => {
@@ -4639,11 +4675,11 @@ async function Qd(t = {}) {
4639
4675
  fe = !0, bt = null, Ce();
4640
4676
  try {
4641
4677
  const y = await E.listSessions({ cursor: a, limit: 20 });
4642
- if (u !== yt || X)
4678
+ if (u !== yt || J)
4643
4679
  return;
4644
4680
  Oe = a ? [...Oe, ...y.sessions] : y.sessions, Ht = y.nextCursor, a || (_n = !0);
4645
4681
  } catch (y) {
4646
- if (u !== yt || X)
4682
+ if (u !== yt || J)
4647
4683
  return;
4648
4684
  ue(
4649
4685
  "web-sdk.widget",
@@ -4653,7 +4689,7 @@ async function Qd(t = {}) {
4653
4689
  }
4654
4690
  ), bt = Od;
4655
4691
  } finally {
4656
- if (u !== yt || X)
4692
+ if (u !== yt || J)
4657
4693
  return;
4658
4694
  fe = !1, Ce();
4659
4695
  }
@@ -4662,12 +4698,12 @@ async function Qd(t = {}) {
4662
4698
  me !== null && (window.clearTimeout(me), me = null), yt += 1, fe = !1, Oe = [], Ht = null, bt = null, _n = !1, Ce(), !(e.layout === "page" || e.loginRequired || e.signupRequired) && Vo(null, yt);
4663
4699
  }, vn = () => {
4664
4700
  me === null && (me = window.setTimeout(() => {
4665
- me = null, !(X || !r.classList.contains("pluno-pa-widget--open")) && Yo();
4701
+ me = null, !(J || !r.classList.contains("pluno-pa-widget--open")) && Yo();
4666
4702
  }, 0));
4667
4703
  }, Ia = () => {
4668
4704
  !Ht || fe || ee.scrollHeight - ee.scrollTop - ee.clientHeight <= 24 && Vo(Ht);
4669
4705
  }, Xo = () => {
4670
- X || typeof document > "u" || (cr(s, e.accentColor), o.isConnected || (e.mountTarget?.isConnected ? e.mountTarget.appendChild(o) : e.mountTarget || f.body?.appendChild(o)));
4706
+ J || typeof document > "u" || (cr(s, e.accentColor), o.isConnected || (e.mountTarget?.isConnected ? e.mountTarget.appendChild(o) : e.mountTarget || f.body?.appendChild(o)));
4671
4707
  }, Jo = new MutationObserver(Xo);
4672
4708
  Jo.observe(f.documentElement, {
4673
4709
  childList: !0,
@@ -4710,7 +4746,7 @@ async function Qd(t = {}) {
4710
4746
  r.classList.remove("pluno-pa-widget--minimized"), m.removeAttribute("tabindex"), m.removeAttribute("role"), m.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && Gt(!1), u && Sn("shown");
4711
4747
  return;
4712
4748
  }
4713
- Ie !== null && (window.clearTimeout(Ie), Ie = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), m.hidden = !1, m.setAttribute("role", "button"), m.setAttribute("aria-label", "Open Pluno"), O.hidden = !0, U.hidden = !0, m.tabIndex = 0, x.value = "", at(
4749
+ Ie !== null && (window.clearTimeout(Ie), Ie = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), m.hidden = !1, m.setAttribute("role", "button"), m.setAttribute("aria-label", "Open Pluno"), O.hidden = !0, N.hidden = !0, m.tabIndex = 0, x.value = "", at(
4714
4750
  r,
4715
4751
  Ki(
4716
4752
  r,
@@ -4734,7 +4770,7 @@ async function Qd(t = {}) {
4734
4770
  panelRect: Xi(O),
4735
4771
  viewport: _e(),
4736
4772
  panelHidden: O.hidden,
4737
- closeHidden: U.hidden,
4773
+ closeHidden: N.hidden,
4738
4774
  ...u
4739
4775
  });
4740
4776
  }, Gt = (a = !0) => {
@@ -4886,7 +4922,7 @@ async function Qd(t = {}) {
4886
4922
  bi = !0;
4887
4923
  try {
4888
4924
  const a = await e.billingStatusLoader();
4889
- if (X)
4925
+ if (J)
4890
4926
  return;
4891
4927
  sr(
4892
4928
  e.billingStatus,
@@ -4910,7 +4946,7 @@ async function Qd(t = {}) {
4910
4946
  a === "composer_input" && yi?.scope === y && u - yi.requestedAt < bd || (a === "composer_input" && (yi = { scope: y, requestedAt: u }), E.warmup(a));
4911
4947
  }, $e = (a = "", u = !0, y = !0, S = !0) => {
4912
4948
  const R = r.classList.contains("pluno-pa-widget--open");
4913
- !R && S && ns("panel_open"), ts(), Xt && (Xt = !1, Ii()), r.classList.contains("pluno-pa-widget--open") || (_ = null), Ie !== null && (window.clearTimeout(Ie), Ie = null), jt("shown", !1), O.hidden = !1, U.hidden = !1, Ji(
4949
+ !R && S && ns("panel_open"), ts(), Xt && (Xt = !1, Ii()), r.classList.contains("pluno-pa-widget--open") || (_ = null), Ie !== null && (window.clearTimeout(Ie), Ie = null), jt("shown", !1), O.hidden = !1, N.hidden = !1, Ji(
4914
4950
  B,
4915
4951
  wi()
4916
4952
  ), r.classList.remove("pluno-pa-widget--closing");
@@ -4937,7 +4973,7 @@ async function Qd(t = {}) {
4937
4973
  });
4938
4974
  }, _i = () => {
4939
4975
  Ie !== null && (window.clearTimeout(Ie), Ie = null), m.hidden = !1, g && (Gt(!1), _t("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), Y(), e.onPanelOpenChange?.(!1), Ie = window.setTimeout(() => {
4940
- O.hidden = !0, U.hidden = !0, _ = null, r.classList.remove("pluno-pa-widget--closing");
4976
+ O.hidden = !0, N.hidden = !0, _ = null, r.classList.remove("pluno-pa-widget--closing");
4941
4977
  }, 220);
4942
4978
  };
4943
4979
  m.addEventListener("submit", (a) => {
@@ -5016,7 +5052,7 @@ async function Qd(t = {}) {
5016
5052
  return;
5017
5053
  }
5018
5054
  Si(y, null);
5019
- }, Nd)) : (xt !== null && (window.clearInterval(xt), xt = null), ze !== null && (window.clearTimeout(ze), ze = null), Tn = null);
5055
+ }, Ud)) : (xt !== null && (window.clearInterval(xt), xt = null), ze !== null && (window.clearTimeout(ze), ze = null), Tn = null);
5020
5056
  }, Ra = () => {
5021
5057
  xt !== null && (window.clearInterval(xt), xt = null), ze !== null && (window.clearTimeout(ze), ze = null), te !== null && (window.clearTimeout(te), te = null);
5022
5058
  }, ss = (a) => {
@@ -5072,7 +5108,7 @@ async function Qd(t = {}) {
5072
5108
  if (S)
5073
5109
  return Vt(D, y), !0;
5074
5110
  const Pt = Date.now();
5075
- return Tn !== null && Pt - Tn <= Ud ? (Vt(D, y), !0) : (Tn = Pt, !0);
5111
+ return Tn !== null && Pt - Tn <= Nd ? (Vt(D, y), !0) : (Tn = Pt, !0);
5076
5112
  };
5077
5113
  R(a.relatedTarget) || window.setTimeout(() => {
5078
5114
  je === null && y.isConnected && R(vi());
@@ -5083,7 +5119,7 @@ async function Qd(t = {}) {
5083
5119
  a.stopPropagation();
5084
5120
  }), P?.addEventListener("click", (a) => {
5085
5121
  a.preventDefault(), a.stopPropagation(), jt("minimized");
5086
- }), U.addEventListener("click", _i), z.addEventListener("wheel", (a) => {
5122
+ }), N.addEventListener("click", _i), z.addEventListener("wheel", (a) => {
5087
5123
  xn(a.deltaY < 0 ? "up" : null);
5088
5124
  }), z.addEventListener("pointerdown", (a) => {
5089
5125
  wt = a.target === z ? a.clientY : null;
@@ -5131,12 +5167,12 @@ async function Qd(t = {}) {
5131
5167
  };
5132
5168
  Ii();
5133
5169
  const Ti = () => {
5134
- Yt() || X || (bn = !0, Tt(), le(), E.connect().then(
5170
+ Yt() || J || (bn = !0, Tt(), le(), E.connect().then(
5135
5171
  () => {
5136
- X || (bn = !1, Tt(), le());
5172
+ J || (bn = !1, Tt(), le());
5137
5173
  },
5138
5174
  (a) => {
5139
- X || (bn = !1, Tt(), le(), ue(
5175
+ J || (bn = !1, Tt(), le(), ue(
5140
5176
  "web-sdk.widget",
5141
5177
  "Failed to connect Product Agent widget",
5142
5178
  {
@@ -5196,7 +5232,7 @@ async function Qd(t = {}) {
5196
5232
  const u = Yu(
5197
5233
  E,
5198
5234
  a,
5199
- !e.persistAttachmentUpload
5235
+ e.productVariant === "customer_embedded"
5200
5236
  );
5201
5237
  if (oe = [...oe, ...u], Ft(), La(), le(), G(E.getState()), !r.classList.contains("pluno-pa-widget--open")) {
5202
5238
  $e();
@@ -5317,8 +5353,8 @@ async function Qd(t = {}) {
5317
5353
  }, Pn = () => {
5318
5354
  const a = E.getState();
5319
5355
  return a.assistantDraft.trim().length > 0 && a.assistantDraftPhase !== "commentary";
5320
- }, Ua = async () => {
5321
- if (!Qt || !C || kt || X || !E.getState().isThinking || Pn())
5356
+ }, Na = async () => {
5357
+ if (!Qt || !C || kt || J || !E.getState().isThinking || Pn())
5322
5358
  return;
5323
5359
  let a;
5324
5360
  try {
@@ -5326,7 +5362,7 @@ async function Qd(t = {}) {
5326
5362
  } catch {
5327
5363
  return;
5328
5364
  }
5329
- a.enabled || a.neverSuggest || !E.getState().isThinking || Pn() || kt || X || (C.hidden = !1);
5365
+ a.enabled || a.neverSuggest || !E.getState().isThinking || Pn() || kt || J || (C.hidden = !1);
5330
5366
  };
5331
5367
  k?.addEventListener("click", () => {
5332
5368
  kt = !0, Rn(), Qt?.enable().catch(() => {
@@ -5340,10 +5376,10 @@ async function Qd(t = {}) {
5340
5376
  const Ln = e.tabGroups;
5341
5377
  let At = !1;
5342
5378
  const Dn = async () => {
5343
- if (!Ln || !V || At || X)
5379
+ if (!Ln || !V || At || J)
5344
5380
  return;
5345
5381
  const a = await Ln.getState().catch(() => null);
5346
- !a || At || X || (V.hidden = !a.permissionNeeded);
5382
+ !a || At || J || (V.hidden = !a.permissionNeeded);
5347
5383
  };
5348
5384
  T?.addEventListener("click", () => {
5349
5385
  At = !0, V && (V.hidden = !0), Ln?.enable().catch(() => {
@@ -5358,12 +5394,12 @@ async function Qd(t = {}) {
5358
5394
  }), Dn();
5359
5395
  let Mt = null, ls = () => {
5360
5396
  };
5361
- const Na = !!(e.sdkPreviewChannelId && e.referralLinkLoader), Un = /* @__PURE__ */ new Map(), Mi = /* @__PURE__ */ new Map(), Ri = () => x.value.trim().length > 0 || oe.length > 0, Oa = () => {
5397
+ const Ua = !!(e.sdkPreviewChannelId && e.referralLinkLoader), Nn = /* @__PURE__ */ new Map(), Mi = /* @__PURE__ */ new Map(), Ri = () => x.value.trim().length > 0 || oe.length > 0, Oa = () => {
5362
5398
  const a = Mt !== null && Qi(E.getState(), Ri());
5363
- Ue.hidden = !a, a && Mt !== null && ia(Ue, Mt);
5399
+ Ne.hidden = !a, a && Mt !== null && ia(Ne, Mt);
5364
5400
  };
5365
5401
  let Rt = null;
5366
- const Ge = /* @__PURE__ */ new Map(), Nn = /* @__PURE__ */ new Set(), za = async (a) => {
5402
+ const Ge = /* @__PURE__ */ new Map(), Un = /* @__PURE__ */ new Set(), za = async (a) => {
5367
5403
  if (e.integrationAuthHandler) {
5368
5404
  Ge.set(a.authRequestId, { status: "connecting" }), G(E.getState());
5369
5405
  try {
@@ -5377,7 +5413,7 @@ async function Qd(t = {}) {
5377
5413
  G(E.getState());
5378
5414
  }
5379
5415
  }, On = (a = {}) => {
5380
- ot = !0, Te(!0, "newSession"), Ee(), de = !1, Ce(), E.startNewSession(a), gi.clear(), Ge.clear(), Nn.clear(), x.value = "", oe = [], Ft(), sn(x), Y(), le(), He(x, "new_chat"), G(E.getState());
5416
+ ot = !0, Te(!0, "newSession"), Ee(), de = !1, Ce(), E.startNewSession(a), gi.clear(), Ge.clear(), Un.clear(), x.value = "", oe = [], Ft(), sn(x), Y(), le(), He(x, "new_chat"), G(E.getState());
5381
5417
  };
5382
5418
  Se?.addEventListener("click", () => {
5383
5419
  const a = e.proactiveSuggestion;
@@ -5427,7 +5463,7 @@ async function Qd(t = {}) {
5427
5463
  ), Rt.addEventListener("click", () => On()), pe.insertBefore(Rt, ce));
5428
5464
  }, G = (a) => {
5429
5465
  if (it !== null && (window.clearTimeout(it), it = null), Ce(), tt(), Bo(a.lastErrorCode) ? Et = a.lastErrorCode : e.billingStatus?.creditsUsed !== null && !Re(e.billingStatus) && (Et = null), mn(Et), e.loginRequired) {
5430
- Un.clear(), Mi.clear(), lr(
5466
+ Nn.clear(), Mi.clear(), lr(
5431
5467
  z,
5432
5468
  H,
5433
5469
  Pi,
@@ -5440,7 +5476,7 @@ async function Qd(t = {}) {
5440
5476
  return;
5441
5477
  }
5442
5478
  if (e.signupRequired) {
5443
- Un.clear(), Mi.clear(), lr(
5479
+ Nn.clear(), Mi.clear(), lr(
5444
5480
  z,
5445
5481
  H,
5446
5482
  Pi,
@@ -5460,14 +5496,14 @@ async function Qd(t = {}) {
5460
5496
  ve,
5461
5497
  H,
5462
5498
  Pi,
5463
- Ue,
5499
+ Ne,
5464
5500
  a,
5465
5501
  Mt,
5466
5502
  Mt !== null && Qi(a, Ri()),
5467
5503
  S,
5468
5504
  () => ht.enabled,
5469
5505
  gi,
5470
- Un,
5506
+ Nn,
5471
5507
  Mi,
5472
5508
  Y,
5473
5509
  An,
@@ -5490,7 +5526,7 @@ async function Qd(t = {}) {
5490
5526
  za(D);
5491
5527
  }
5492
5528
  } : void 0,
5493
- Na && !hi ? {
5529
+ Ua && !hi ? {
5494
5530
  dismissedCandidateIds: Wt,
5495
5531
  actionCandidate: Mn,
5496
5532
  error: Zt,
@@ -5516,12 +5552,12 @@ async function Qd(t = {}) {
5516
5552
  const R = a.isThinking ? null : a.messages.map((D) => D.scheduledCheckInAt).filter((D) => !!D).filter((D) => Jn(D) !== null).sort((D, Pt) => Date.parse(D) - Date.parse(Pt))[0] ?? null, j = R ? fl(R) : null;
5517
5553
  j !== null && (it = window.setTimeout(
5518
5554
  () => {
5519
- it = null, X || G(E.getState());
5555
+ it = null, J || G(E.getState());
5520
5556
  },
5521
5557
  Math.min(j, 2147483647)
5522
5558
  )), S ? (ft = z.scrollTop, Ee()) : y && _u(a) && va();
5523
5559
  }, cs = () => {
5524
- f.getSelection()?.isCollapsed !== !1 && pg(Un) && G(E.getState());
5560
+ f.getSelection()?.isCollapsed !== !1 && pg(Nn) && G(E.getState());
5525
5561
  };
5526
5562
  f.addEventListener(
5527
5563
  "selectionchange",
@@ -5535,8 +5571,8 @@ async function Qd(t = {}) {
5535
5571
  );
5536
5572
  await Promise.all(
5537
5573
  u.map(async (y) => {
5538
- if (!(Ge.has(y.authRequestId) || Nn.has(y.authRequestId))) {
5539
- Nn.add(y.authRequestId), Ge.set(y.authRequestId, {
5574
+ if (!(Ge.has(y.authRequestId) || Un.has(y.authRequestId))) {
5575
+ Un.add(y.authRequestId), Ge.set(y.authRequestId, {
5540
5576
  status: "checking"
5541
5577
  }), G(E.getState());
5542
5578
  try {
@@ -5548,16 +5584,16 @@ async function Qd(t = {}) {
5548
5584
  error: S instanceof Error ? S.message : `Could not load ${y.appName} connection status.`
5549
5585
  });
5550
5586
  } finally {
5551
- Nn.delete(y.authRequestId);
5587
+ Un.delete(y.authRequestId);
5552
5588
  }
5553
- X || G(E.getState());
5589
+ J || G(E.getState());
5554
5590
  }
5555
5591
  })
5556
5592
  );
5557
5593
  };
5558
5594
  return ls = ld(
5559
5595
  (a) => {
5560
- Mt = a, !X && Qi(E.getState(), Ri()) && G(E.getState());
5596
+ Mt = a, !J && Qi(E.getState(), Ri()) && G(E.getState());
5561
5597
  },
5562
5598
  {
5563
5599
  backendUrl: e.backendUrl,
@@ -5568,7 +5604,7 @@ async function Qd(t = {}) {
5568
5604
  Dn();
5569
5605
  const u = Ai && !a.isThinking, y = jo !== location.origin || Go !== a.sessionId || Ko !== (a.user?.id ?? null), S = Ai !== a.isThinking, R = mi !== "connected" && a.status === "connected", j = mi === "connected" && a.status !== "connected";
5570
5606
  jo = location.origin, Go = a.sessionId, Ko = a.user?.id ?? null, mi = a.status, Ai = a.isThinking, j && (me !== null && (window.clearTimeout(me), me = null), yt += 1, fe = !1, Oe = [], Ht = null, bt = null, _n = !1, Ce()), r.classList.contains("pluno-pa-widget--open") && a.status === "connected" && (y || S || R) && vn(), a.isThinking && !Pn() && Qt && !kt && Ct === null && C?.hidden !== !1 && (Ct = window.setTimeout(() => {
5571
- Ct = null, Ua();
5607
+ Ct = null, Na();
5572
5608
  }, yd)), (!a.isThinking || Pn()) && (as(), Rn()), u && !r.classList.contains("pluno-pa-widget--open") && (Xt = !0), Ii(), a.appearance ? (ki = !0, ue(
5573
5609
  "web-sdk.widget",
5574
5610
  "Agent state supplied appearance",
@@ -5622,7 +5658,7 @@ async function Qd(t = {}) {
5622
5658
  a && (Fe = null, ie = "idle", he && (he.value = "")), e.proactiveSuggestion = a ?? null, tt();
5623
5659
  },
5624
5660
  destroy: () => {
5625
- X || (Y(), X = !0, Jo.disconnect(), f.removeEventListener(
5661
+ J || (Y(), J = !0, Jo.disconnect(), f.removeEventListener(
5626
5662
  "selectionchange",
5627
5663
  cs
5628
5664
  ), rs?.disconnect(), Ra(), f.defaultView?.removeEventListener(
@@ -5792,7 +5828,7 @@ function ou({
5792
5828
  }, v = (b) => {
5793
5829
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
5794
5830
  return;
5795
- const I = b.shiftKey ? No : Uo, P = i();
5831
+ const I = b.shiftKey ? Uo : No, P = i();
5796
5832
  let O = null;
5797
5833
  b.key === "ArrowUp" ? O = { x: P.x, y: P.y - I } : b.key === "ArrowDown" ? O = { x: P.x, y: P.y + I } : b.key === "ArrowLeft" ? O = { x: P.x - I, y: P.y } : b.key === "ArrowRight" && (O = { x: P.x + I, y: P.y }), O && (b.preventDefault(), b.stopPropagation(), o(O), s());
5798
5834
  };
@@ -5823,7 +5859,7 @@ function su({
5823
5859
  }, _ = (f) => {
5824
5860
  s === f.pointerId && (f.preventDefault(), d());
5825
5861
  }, w = (f) => {
5826
- const m = f.shiftKey ? No : Uo, v = n();
5862
+ const m = f.shiftKey ? Uo : No, v = n();
5827
5863
  let b = null;
5828
5864
  f.key === "ArrowUp" ? b = { x: v.x, y: v.y - m } : f.key === "ArrowDown" ? b = { x: v.x, y: v.y + m } : f.key === "ArrowLeft" ? b = { x: v.x - m, y: v.y } : f.key === "ArrowRight" && (b = { x: v.x + m, y: v.y }), b && (f.preventDefault(), f.stopPropagation(), i(b), o());
5829
5865
  };
@@ -5857,7 +5893,7 @@ function ru({
5857
5893
  }, w = (m) => {
5858
5894
  s === m.pointerId && (m.preventDefault(), g());
5859
5895
  }, f = (m) => {
5860
- const b = m.currentTarget.dataset.resizeDirection, I = m.shiftKey ? No : Uo, P = n();
5896
+ const b = m.currentTarget.dataset.resizeDirection, I = m.shiftKey ? Uo : No, P = n();
5861
5897
  let O = 0, L = 0;
5862
5898
  Js(b) && (m.key === "ArrowLeft" ? O = -I : m.key === "ArrowRight" ? O = I : m.key === "ArrowUp" ? L = -I : m.key === "ArrowDown" && (L = I), !(O === 0 && L === 0) && (m.preventDefault(), m.stopPropagation(), i(Zs(P, b, O, L)), o()));
5863
5899
  };
@@ -6256,7 +6292,7 @@ function Su(t, e) {
6256
6292
  return "now";
6257
6293
  }
6258
6294
  function Iu(t, e, n, i, o) {
6259
- t.appendChild(Uu()), t.appendChild(
6295
+ t.appendChild(Nu()), t.appendChild(
6260
6296
  Tu(
6261
6297
  e,
6262
6298
  n,
@@ -6267,7 +6303,7 @@ function Iu(t, e, n, i, o) {
6267
6303
  pi(
6268
6304
  "pluno-pa-widget__close",
6269
6305
  "Close",
6270
- Nu(16),
6306
+ Uu(16),
6271
6307
  !0
6272
6308
  )
6273
6309
  ), t.appendChild(Eu(n, i));
@@ -6747,7 +6783,7 @@ function Du(t, e) {
6747
6783
  ), o;
6748
6784
  }
6749
6785
  function oa() {
6750
- return N("svg", {
6786
+ return U("svg", {
6751
6787
  xmlns: Qr,
6752
6788
  viewBox: "0 0 1254 1254"
6753
6789
  });
@@ -6798,7 +6834,7 @@ function nr(t, e, n, i, o, s, r, l) {
6798
6834
  });
6799
6835
  }
6800
6836
  function M(t, e, n = {}) {
6801
- const i = N(e, n);
6837
+ const i = U(e, n);
6802
6838
  return t.appendChild(i), i;
6803
6839
  }
6804
6840
  function Z(t, e, n, i) {
@@ -6812,14 +6848,14 @@ function pi(t, e, n, i) {
6812
6848
  const o = document.createElement("button");
6813
6849
  return o.type = "button", o.className = t, o.setAttribute("aria-label", e), o.title = e, o.hidden = i, o.appendChild(n), o;
6814
6850
  }
6815
- function Uu() {
6816
- const t = N("svg", {
6851
+ function Nu() {
6852
+ const t = U("svg", {
6817
6853
  class: "pluno-pa-widget__scribble-defs",
6818
6854
  "aria-hidden": "true",
6819
6855
  focusable: "false",
6820
6856
  width: "0",
6821
6857
  height: "0"
6822
- }), e = N("defs");
6858
+ }), e = U("defs");
6823
6859
  return e.appendChild(Zi("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
6824
6860
  Zi("pluno-pa-scribble-wobble-2", "5", "15")
6825
6861
  ), e.appendChild(
@@ -6827,7 +6863,7 @@ function Uu() {
6827
6863
  ), t.appendChild(e), t;
6828
6864
  }
6829
6865
  function sa(t, e) {
6830
- const n = N("svg", {
6866
+ const n = U("svg", {
6831
6867
  class: `pluno-pa-widget__scribble-spirals ${t}`,
6832
6868
  preserveAspectRatio: "xMidYMid meet",
6833
6869
  "aria-hidden": "true",
@@ -6858,11 +6894,11 @@ function ra(t, e) {
6858
6894
  `0 0 ${n} ${Kd}`
6859
6895
  ), t.replaceChildren();
6860
6896
  for (let i = 0; i < e; i += 1) {
6861
- const o = Ks[i % Ks.length], s = N("g", {
6897
+ const o = Ks[i % Ks.length], s = U("g", {
6862
6898
  transform: `translate(${mo + i * fo} 0)`
6863
6899
  });
6864
6900
  s.appendChild(
6865
- N("ellipse", {
6901
+ U("ellipse", {
6866
6902
  cx: o.ellipseCx,
6867
6903
  cy: o.ellipseCy,
6868
6904
  rx: o.ellipseRx,
@@ -6873,7 +6909,7 @@ function ra(t, e) {
6873
6909
  opacity: "0.8"
6874
6910
  })
6875
6911
  ), s.appendChild(
6876
- N("path", {
6912
+ U("path", {
6877
6913
  d: o.path,
6878
6914
  fill: "none",
6879
6915
  stroke: "#2c2a1e",
@@ -6884,7 +6920,7 @@ function ra(t, e) {
6884
6920
  }
6885
6921
  }
6886
6922
  function Zi(t, e, n) {
6887
- const i = N("filter", {
6923
+ const i = U("filter", {
6888
6924
  id: t,
6889
6925
  x: "-8%",
6890
6926
  y: "-8%",
@@ -6892,7 +6928,7 @@ function Zi(t, e, n) {
6892
6928
  height: "116%"
6893
6929
  });
6894
6930
  return i.appendChild(
6895
- N("feTurbulence", {
6931
+ U("feTurbulence", {
6896
6932
  type: "fractalNoise",
6897
6933
  baseFrequency: "0.012 0.028",
6898
6934
  numOctaves: "3",
@@ -6900,7 +6936,7 @@ function Zi(t, e, n) {
6900
6936
  result: "stroke-noise"
6901
6937
  })
6902
6938
  ), i.appendChild(
6903
- N("feDisplacementMap", {
6939
+ U("feDisplacementMap", {
6904
6940
  in: "SourceGraphic",
6905
6941
  in2: "stroke-noise",
6906
6942
  scale: "3.5",
@@ -6909,7 +6945,7 @@ function Zi(t, e, n) {
6909
6945
  result: "warped"
6910
6946
  })
6911
6947
  ), i.appendChild(
6912
- N("feTurbulence", {
6948
+ U("feTurbulence", {
6913
6949
  type: "fractalNoise",
6914
6950
  baseFrequency: "0.7",
6915
6951
  numOctaves: "1",
@@ -6917,7 +6953,7 @@ function Zi(t, e, n) {
6917
6953
  result: "ink-noise"
6918
6954
  })
6919
6955
  ), i.appendChild(
6920
- N("feDisplacementMap", {
6956
+ U("feDisplacementMap", {
6921
6957
  in: "warped",
6922
6958
  in2: "ink-noise",
6923
6959
  scale: "0.9",
@@ -6926,7 +6962,7 @@ function Zi(t, e, n) {
6926
6962
  })
6927
6963
  ), i;
6928
6964
  }
6929
- function Nu(t) {
6965
+ function Uu(t) {
6930
6966
  const e = xe(
6931
6967
  "0 0 24 24",
6932
6968
  t,
@@ -6935,7 +6971,7 @@ function Nu(t) {
6935
6971
  "currentColor",
6936
6972
  "2.25"
6937
6973
  );
6938
- return e.appendChild(N("path", { d: "m6 9 6 6 6-6" })), e;
6974
+ return e.appendChild(U("path", { d: "m6 9 6 6 6-6" })), e;
6939
6975
  }
6940
6976
  function Ou() {
6941
6977
  const t = xe(
@@ -6947,11 +6983,11 @@ function Ou() {
6947
6983
  "2.25"
6948
6984
  );
6949
6985
  return t.appendChild(
6950
- N("path", {
6986
+ U("path", {
6951
6987
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
6952
6988
  })
6953
6989
  ), t.appendChild(
6954
- N("path", {
6990
+ U("path", {
6955
6991
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
6956
6992
  })
6957
6993
  ), t;
@@ -6966,10 +7002,10 @@ function zu() {
6966
7002
  "2.25"
6967
7003
  );
6968
7004
  return t.appendChild(
6969
- N("path", {
7005
+ U("path", {
6970
7006
  d: "M17 3a2.85 2.85 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5Z"
6971
7007
  })
6972
- ), t.appendChild(N("path", { d: "m15 5 4 4" })), t;
7008
+ ), t.appendChild(U("path", { d: "m15 5 4 4" })), t;
6973
7009
  }
6974
7010
  function Bu() {
6975
7011
  const t = xe(
@@ -6980,7 +7016,7 @@ function Bu() {
6980
7016
  "currentColor",
6981
7017
  "2.25"
6982
7018
  );
6983
- return t.appendChild(N("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), t.appendChild(N("path", { d: "M3 4v5h5" })), t.appendChild(N("path", { d: "M12 7v5l3 2" })), t;
7019
+ return t.appendChild(U("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), t.appendChild(U("path", { d: "M3 4v5h5" })), t.appendChild(U("path", { d: "M12 7v5l3 2" })), t;
6984
7020
  }
6985
7021
  function qu(t) {
6986
7022
  const e = xe(
@@ -6996,7 +7032,7 @@ function qu(t) {
6996
7032
  ...ul,
6997
7033
  ...gl(t)
6998
7034
  ])
6999
- e.appendChild(N("path", { d: n }));
7035
+ e.appendChild(U("path", { d: n }));
7000
7036
  return e;
7001
7037
  }
7002
7038
  function Oo() {
@@ -7008,7 +7044,7 @@ function Oo() {
7008
7044
  "currentColor",
7009
7045
  "2.4"
7010
7046
  );
7011
- return t.appendChild(N("path", { d: "M18 6 6 18" })), t.appendChild(N("path", { d: "m6 6 12 12" })), t;
7047
+ return t.appendChild(U("path", { d: "M18 6 6 18" })), t.appendChild(U("path", { d: "m6 6 12 12" })), t;
7012
7048
  }
7013
7049
  function aa() {
7014
7050
  const t = xe(
@@ -7020,8 +7056,8 @@ function aa() {
7020
7056
  "2.75"
7021
7057
  );
7022
7058
  return t.appendChild(
7023
- N("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
7024
- ), t.appendChild(N("polyline", { points: "5 12 12 5 19 12" })), t;
7059
+ U("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
7060
+ ), t.appendChild(U("polyline", { points: "5 12 12 5 19 12" })), t;
7025
7061
  }
7026
7062
  function Fu() {
7027
7063
  const t = xe(
@@ -7036,7 +7072,7 @@ function Fu() {
7036
7072
  "class",
7037
7073
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
7038
7074
  ), t.appendChild(
7039
- N("path", {
7075
+ U("path", {
7040
7076
  d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
7041
7077
  })
7042
7078
  ), t;
@@ -7047,7 +7083,7 @@ function Wu() {
7047
7083
  "class",
7048
7084
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
7049
7085
  ), t.appendChild(
7050
- N("path", {
7086
+ U("path", {
7051
7087
  d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
7052
7088
  stroke: "currentColor",
7053
7089
  "stroke-width": "2",
@@ -7059,7 +7095,7 @@ function Wu() {
7059
7095
  function Hu() {
7060
7096
  const t = xe("0 0 24 24", 18, 18, "currentColor");
7061
7097
  return t.appendChild(
7062
- N("rect", {
7098
+ U("rect", {
7063
7099
  x: "6",
7064
7100
  y: "6",
7065
7101
  width: "12",
@@ -7077,7 +7113,7 @@ function $u() {
7077
7113
  "currentColor",
7078
7114
  "2.4"
7079
7115
  );
7080
- return t.appendChild(N("path", { d: "M18 6 6 18" })), t.appendChild(N("path", { d: "m6 6 12 12" })), t;
7116
+ return t.appendChild(U("path", { d: "M18 6 6 18" })), t.appendChild(U("path", { d: "m6 6 12 12" })), t;
7081
7117
  }
7082
7118
  function ju() {
7083
7119
  const t = xe(
@@ -7089,7 +7125,7 @@ function ju() {
7089
7125
  "2.25"
7090
7126
  );
7091
7127
  return t.appendChild(
7092
- N("rect", {
7128
+ U("rect", {
7093
7129
  width: "14",
7094
7130
  height: "14",
7095
7131
  x: "8",
@@ -7098,7 +7134,7 @@ function ju() {
7098
7134
  ry: "2"
7099
7135
  })
7100
7136
  ), t.appendChild(
7101
- N("path", {
7137
+ U("path", {
7102
7138
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
7103
7139
  })
7104
7140
  ), t;
@@ -7111,9 +7147,9 @@ function xe(t, e, n, i, o, s) {
7111
7147
  fill: i,
7112
7148
  "aria-hidden": "true"
7113
7149
  };
7114
- return o && (r.stroke = o, r["stroke-linecap"] = "round", r["stroke-linejoin"] = "round"), s && (r["stroke-width"] = s), N("svg", r);
7150
+ return o && (r.stroke = o, r["stroke-linecap"] = "round", r["stroke-linejoin"] = "round"), s && (r["stroke-width"] = s), U("svg", r);
7115
7151
  }
7116
- function N(t, e = {}) {
7152
+ function U(t, e = {}) {
7117
7153
  const n = document.createElementNS(Qr, t);
7118
7154
  for (const [i, o] of Object.entries(e))
7119
7155
  n.setAttribute(i, o);
@@ -7223,7 +7259,7 @@ function Yu(t, e, n) {
7223
7259
  if (!e)
7224
7260
  return [];
7225
7261
  const i = Array.from(e);
7226
- return n && i.forEach(Ur), i.map((o) => ({
7262
+ return n && i.forEach(Nr), i.map((o) => ({
7227
7263
  ...t.createLocalAttachment(o),
7228
7264
  previewUrl: Xu(o)
7229
7265
  }));
@@ -7338,7 +7374,7 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7338
7374
  const B = ug(s), Q = s.isThinking ? null : B.flatMap((C) => {
7339
7375
  const k = C.scheduledCheckInAt ? Jn(C.scheduledCheckInAt) : null;
7340
7376
  return k && C.scheduledCheckInAt ? [{ message: C, dueAt: C.scheduledCheckInAt, label: k }] : [];
7341
- }).sort((C, k) => Date.parse(C.dueAt) - Date.parse(k.dueAt))[0] ?? null, U = gg(
7377
+ }).sort((C, k) => Date.parse(C.dueAt) - Date.parse(k.dueAt))[0] ?? null, N = gg(
7342
7378
  B.filter(
7343
7379
  (C) => !ca(C) && !C.scheduledCheckInAt
7344
7380
  )
@@ -7346,8 +7382,8 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7346
7382
  K.push(C);
7347
7383
  };
7348
7384
  ga(n, s.isThinking), n.disabled = s.pendingMessageStatus !== null, o.hidden = !l, l && r !== null && ia(o, r);
7349
- const Le = U.length > 0 || !!s.assistantDraft || s.pendingMessageStatus !== null || s.isThinking;
7350
- if (i(Le), v || U.length === 0 && !s.assistantDraft && !s.lastError && !s.pendingMessageStatus && !s.isThinking) {
7385
+ const Le = N.length > 0 || !!s.assistantDraft || s.pendingMessageStatus !== null || s.isThinking;
7386
+ if (i(Le), v || N.length === 0 && !s.assistantDraft && !s.lastError && !s.pendingMessageStatus && !s.isThinking) {
7351
7387
  const C = document.createElement("div");
7352
7388
  C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (v ? " pluno-pa-widget__empty-state--morning-report" : "");
7353
7389
  const k = document.createElement("div");
@@ -7385,15 +7421,15 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7385
7421
  return;
7386
7422
  }
7387
7423
  let x = null, H = null, pe = [], ce = [];
7388
- const et = U.some(vo), ee = U.some(
7389
- (C) => C.role === "tool" && ar(C, U)
7424
+ const et = N.some(vo), ee = N.some(
7425
+ (C) => C.role === "tool" && ar(C, N)
7390
7426
  );
7391
7427
  let De = !1;
7392
7428
  const ne = () => {
7393
7429
  if (pe.length === 0)
7394
7430
  return De = !1, !1;
7395
7431
  const C = pe.some(
7396
- (ae) => ar(ae, U)
7432
+ (ae) => ar(ae, N)
7397
7433
  ), k = vg(
7398
7434
  pe,
7399
7435
  C,
@@ -7409,8 +7445,8 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7409
7445
  q(C), x = null, H = C;
7410
7446
  ce = [];
7411
7447
  };
7412
- for (let C = 0; C < U.length; C += 1) {
7413
- const k = U[C];
7448
+ for (let C = 0; C < N.length; C += 1) {
7449
+ const k = N[C];
7414
7450
  if (k.role === "tool" && k.integrationAuthRequest && O) {
7415
7451
  const A = og(
7416
7452
  k.integrationAuthRequest,
@@ -7455,19 +7491,19 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7455
7491
  ne();
7456
7492
  const A = dn(w());
7457
7493
  A.classList.add("pluno-pa-widget__terminal-marker"), q(A);
7458
- const W = document.createElement("div"), Ne = k.dataType === "run_error";
7459
- if (W.className = Ne ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", W.textContent = oi(
7494
+ const W = document.createElement("div"), Ue = k.dataType === "run_error";
7495
+ if (W.className = Ue ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", W.textContent = oi(
7460
7496
  k.content
7461
- ), Ne && k.securitySettingsUrl) {
7497
+ ), Ue && k.securitySettingsUrl) {
7462
7498
  const Se = document.createElement("a");
7463
7499
  Se.className = "pluno-pa-widget__error-retry", Se.href = k.securitySettingsUrl, Se.target = "_blank", Se.rel = "noreferrer", Se.textContent = "Security settings", W.appendChild(Se);
7464
7500
  }
7465
- q(W), x = Ne ? W : null, H = Ne ? null : W, re();
7501
+ q(W), x = Ue ? W : null, H = Ue ? null : W, re();
7466
7502
  }
7467
7503
  continue;
7468
7504
  }
7469
7505
  k.role === "user" && re();
7470
- const ae = ne(), F = oi(k.content), V = k.role === "assistant" && U.some(
7506
+ const ae = ne(), F = oi(k.content), V = k.role === "assistant" && N.some(
7471
7507
  (A) => A.role === "tool" && ut(A, k)
7472
7508
  );
7473
7509
  if (k.role === "assistant" && !ae && !V) {
@@ -7490,7 +7526,7 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7490
7526
  }
7491
7527
  k.role === "assistant" && re();
7492
7528
  }
7493
- const Ue = ne(), z = U[U.length - 1]?.role === "assistant";
7529
+ const Ne = ne(), z = N[N.length - 1]?.role === "assistant";
7494
7530
  if (s.pendingMessageStatus && !s.isThinking) {
7495
7531
  const C = Ot(
7496
7532
  s.pendingMessageStatus === "reconnecting" ? "Reconnecting..." : "Sending..."
@@ -7498,7 +7534,7 @@ function ig(t, e, n, i, o, s, r, l, p, d, g, c, h, _, w, f, m, v, b, I, P, O, L)
7498
7534
  q(C), x = null, H = C;
7499
7535
  }
7500
7536
  if (s.isThinking && !s.assistantDraft && !ee && !z && !et)
7501
- if (Ue) {
7537
+ if (Ne) {
7502
7538
  if (!De) {
7503
7539
  const C = Ot(s.isRetrying ? "Retrying..." : "Thinking...");
7504
7540
  q(C), x = null, H = C;
@@ -7930,8 +7966,8 @@ function vg(t, e, n, i, o, s, r) {
7930
7966
  O.className = "pluno-pa-widget__tool-active-content";
7931
7967
  const L = Ot(), B = document.createElement("details"), Q = document.createElement("summary");
7932
7968
  Q.className = "pluno-pa-widget__tool-summary";
7933
- const U = document.createElement("span");
7934
- U.className = "pluno-pa-widget__tool-summary-title", Q.appendChild(U), B.appendChild(Q);
7969
+ const N = document.createElement("span");
7970
+ N.className = "pluno-pa-widget__tool-summary-title", Q.appendChild(N), B.appendChild(Q);
7935
7971
  const ge = document.createElement("div");
7936
7972
  ge.className = "pluno-pa-widget__tool-lines", B.addEventListener("toggle", () => {
7937
7973
  const K = b.dataset.responseGroupKey ?? p;
@@ -7944,7 +7980,7 @@ function vg(t, e, n, i, o, s, r) {
7944
7980
  thinkingStatus: L,
7945
7981
  details: B,
7946
7982
  summary: Q,
7947
- summaryTitle: U,
7983
+ summaryTitle: N,
7948
7984
  lines: ge,
7949
7985
  lineNodes: /* @__PURE__ */ new Map()
7950
7986
  }, i.set(p, d);
@@ -11088,7 +11124,7 @@ function qo(t) {
11088
11124
  function fa(t) {
11089
11125
  return `${qo(t)}.displayState`;
11090
11126
  }
11091
- function Ug(t) {
11127
+ function Ng(t) {
11092
11128
  try {
11093
11129
  return window.sessionStorage.getItem(
11094
11130
  fa(t)
@@ -11110,7 +11146,7 @@ function dr(t, e) {
11110
11146
  return;
11111
11147
  }
11112
11148
  }
11113
- function Ng(t) {
11149
+ function Ug(t) {
11114
11150
  if (t)
11115
11151
  return { clientId: t, release: () => {
11116
11152
  } };