@pluno/product-agent-web 0.1.251 → 0.1.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- const he = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
1
+ const ge = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
2
2
  function Zl(t) {
3
3
  if (!t || typeof t != "object") return !1;
4
- const e = t, n = (s) => Number.isSafeInteger(s) && s >= 0, i = (s) => s && typeof s == "object" && Object.keys(s).every((o) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(o)) && n(s.sequence) && n(s.at) && he(s.type) !== null && typeof s.changed == "boolean" && [s.generation, s.itemCount, s.removedCount].every((o) => o === null || n(o)) && [s.sessionId, s.scopeId, s.requestId, s.effectId, s.clientScopeId, s.reason, s.effectKind, s.eventType].every((o) => o === null || he(o) !== null) && (s.projectionReady === null || typeof s.projectionReady == "boolean");
5
- return Object.keys(e).every((s) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(s)) && he(e.ownerId) !== null && n(e.revision) && n(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
4
+ const e = t, n = (s) => Number.isSafeInteger(s) && s >= 0, i = (s) => s && typeof s == "object" && Object.keys(s).every((o) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(o)) && n(s.sequence) && n(s.at) && ge(s.type) !== null && typeof s.changed == "boolean" && [s.generation, s.itemCount, s.removedCount].every((o) => o === null || n(o)) && [s.sessionId, s.scopeId, s.requestId, s.effectId, s.clientScopeId, s.reason, s.effectKind, s.eventType].every((o) => o === null || ge(o) !== null) && (s.projectionReady === null || typeof s.projectionReady == "boolean");
5
+ return Object.keys(e).every((s) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(s)) && ge(e.ownerId) !== null && n(e.revision) && n(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
6
6
  }
7
7
  function ap(t, e, n) {
8
8
  const i = t;
@@ -11,17 +11,17 @@ function ap(t, e, n) {
11
11
  return {
12
12
  sequence: e,
13
13
  at: Date.now(),
14
- type: he(i.type) ?? "unknown",
14
+ type: ge(i.type) ?? "unknown",
15
15
  changed: n,
16
16
  generation: Number.isSafeInteger(i.generation) ? i.generation : null,
17
- sessionId: he(i.sessionId ?? i.event?.conversation_id ?? s?.conversation_id),
18
- clientScopeId: he(i.clientScopeId),
17
+ sessionId: ge(i.sessionId ?? i.event?.conversation_id ?? s?.conversation_id),
18
+ clientScopeId: ge(i.clientScopeId),
19
19
  reason: ["user", "tool", "user_requested", "new_chat", "session_switch"].includes(i.reason ?? "") ? i.reason : null,
20
- effectId: he(i.effectId),
21
- scopeId: he(i.conversationScopeId),
22
- requestId: he(i.requestId),
23
- effectKind: he(i.effectKind),
24
- eventType: he(i.event?.type),
20
+ effectId: ge(i.effectId),
21
+ scopeId: ge(i.conversationScopeId),
22
+ requestId: ge(i.requestId),
23
+ effectKind: ge(i.effectKind),
24
+ eventType: ge(i.event?.type),
25
25
  itemCount: Array.isArray(s?.items) ? s.items.length : null,
26
26
  removedCount: Array.isArray(s?.removed_items) ? s.removed_items.length : null,
27
27
  projectionReady: typeof s?.projection_ready == "boolean" ? s.projection_ready : null
@@ -92,15 +92,15 @@ function up(t, e, n = {}) {
92
92
  return { ...s, context: {
93
93
  capturedAt: Date.now(),
94
94
  selectionKey: cp(e.selectionKey),
95
- userId: he(e.user?.id),
95
+ userId: ge(e.user?.id),
96
96
  loading: e.isLoadingSession === !0,
97
97
  draft: e.isDraftSession === !0,
98
98
  thinking: e.isThinking === !0,
99
99
  connected: e.status === "connected",
100
100
  hasError: !!e.lastError,
101
- phase: he(e.activity?.phase ?? e.taskStatus),
102
- queryStatus: he(o?.queryStatus),
103
- queryRequestId: he(o?.queryRequestId),
101
+ phase: ge(e.activity?.phase ?? e.taskStatus),
102
+ queryStatus: ge(o?.queryStatus),
103
+ queryRequestId: ge(o?.queryRequestId),
104
104
  queryUpdatedAt: o?.queryUpdatedAt ?? null,
105
105
  renderSource: n.renderSource ?? "local",
106
106
  selectionFencePending: n.selectionFencePending ?? !1,
@@ -111,7 +111,7 @@ function up(t, e, n = {}) {
111
111
  function pp(t) {
112
112
  if (!t || typeof t != "object") return !1;
113
113
  const e = t, n = (i) => Number.isSafeInteger(i) && i >= 0;
114
- return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && n(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || n(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || he(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 || Zl(e.owner));
114
+ return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && n(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || n(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || ge(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 || Zl(e.owner));
115
115
  }
116
116
  function hp(t) {
117
117
  if (!t || typeof t != "object" || Object.keys(t).some((i) => i !== "before" && i !== "current")) return !1;
@@ -438,16 +438,16 @@ function ea(t) {
438
438
  e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
439
439
  return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
440
440
  }
441
- const Bs = "0.1.251", od = {
441
+ const Bs = "0.1.253", od = {
442
442
  version: Bs
443
443
  };
444
444
  function Tp(t, e, n, i, s = {}) {
445
445
  const o = !i && e === "conversation_error" && n !== void 0 && t.conversationDiagnostics?.errorMessageFingerprint === ea(Dn(n)) ? t.conversationDiagnostics : void 0;
446
446
  return {
447
- sessionId: he(t.sessionId),
448
- requestId: he(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
449
- ...he(o?.failedClientMessageId) ? { clientMessageId: o.failedClientMessageId } : {},
450
- code: o ? he(t.lastErrorCode) : null,
447
+ sessionId: ge(t.sessionId),
448
+ requestId: ge(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
449
+ ...ge(o?.failedClientMessageId) ? { clientMessageId: o.failedClientMessageId } : {},
450
+ code: o ? ge(t.lastErrorCode) : null,
451
451
  ...zs(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
452
452
  builds: { sdk: od.version, ...s }
453
453
  };
@@ -474,7 +474,7 @@ function On(t) {
474
474
  "release",
475
475
  "upstreamRequestId",
476
476
  "upstreamTraceId"
477
- ].includes(i)) && he(e.requestId) !== null && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(e.method) && ["/api/product-agent/conversations/:sessionId/snapshot", "/api/product-agent/:namespace/commands", "/api/product-agent/:namespace/:operation"].includes(e.route) && (e.status === null || n(e.status) && e.status >= 100 && e.status <= 599) && (e.abortTrigger === null || ["deadline", "transport_disposed", "owner_disposed", "authority_retired", "observation_released", "request_replaced", "caller_cancelled", "unexpected_abort"].includes(e.abortTrigger)) && ["http_deadline", "http_transport", "conversation_query", "browser", "http_response"].includes(e.owner) && (e.category === void 0 || /^[a-z0-9_]{1,80}$/.test(e.category)) && [e.responseHeadersMs, e.responseBodyMs].every((i) => i == null || n(i)) && n(e.elapsedMs) && n(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((i) => i === null || he(i) !== null) && (e.authorityGeneration === null || n(e.authorityGeneration)) && typeof e.release == "string" && /^[a-zA-Z0-9._-]{1,80}$/.test(e.release) && [e.upstreamRequestId, e.upstreamTraceId].every((i) => i === null || typeof i == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(i));
477
+ ].includes(i)) && ge(e.requestId) !== null && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(e.method) && ["/api/product-agent/conversations/:sessionId/snapshot", "/api/product-agent/:namespace/commands", "/api/product-agent/:namespace/:operation"].includes(e.route) && (e.status === null || n(e.status) && e.status >= 100 && e.status <= 599) && (e.abortTrigger === null || ["deadline", "transport_disposed", "owner_disposed", "authority_retired", "observation_released", "request_replaced", "caller_cancelled", "unexpected_abort"].includes(e.abortTrigger)) && ["http_deadline", "http_transport", "conversation_query", "browser", "http_response"].includes(e.owner) && (e.category === void 0 || /^[a-z0-9_]{1,80}$/.test(e.category)) && [e.responseHeadersMs, e.responseBodyMs].every((i) => i == null || n(i)) && n(e.elapsedMs) && n(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((i) => i === null || ge(i) !== null) && (e.authorityGeneration === null || n(e.authorityGeneration)) && typeof e.release == "string" && /^[a-zA-Z0-9._-]{1,80}$/.test(e.release) && [e.upstreamRequestId, e.upstreamTraceId].every((i) => i === null || typeof i == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(i));
478
478
  }
479
479
  function Pp(t) {
480
480
  const e = {}, n = (i, s) => {
@@ -837,8 +837,8 @@ function zp(t, e, n, i) {
837
837
  if (n.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
838
838
  const { type: r, authorityId: c, generation: l, prepareContext: p, ...d } = e, h = t.submissions[e.userMessageId];
839
839
  if (h) {
840
- const { contextPreparation: _, requestedModel: v, sessionId: E, delivery: L, cancelled: K, cancellationReason: U, error: ge, executionVersion: G, ...q } = h;
841
- if (as(q) !== as(d)) throw new Error("User-message identity cannot be reused with different input.");
840
+ const { contextPreparation: _, requestedModel: v, sessionId: E, delivery: L, cancelled: K, cancellationReason: U, error: he, executionVersion: G, ...oe } = h;
841
+ if (as(oe) !== as(d)) throw new Error("User-message identity cannot be reused with different input.");
842
842
  return { state: t, effects: o };
843
843
  }
844
844
  const g = n.selections[e.conversationScopeId], m = Object.values(t.submissions).find((_) => _.conversationScopeId === e.conversationScopeId && !_.cancelled && _.sessionId !== null), f = i.scopes[e.clientScopeId], w = {
@@ -1776,15 +1776,15 @@ class jp {
1776
1776
  }
1777
1777
  }
1778
1778
  function Vn(t, e, n) {
1779
- const i = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => S.conversationScopeId === n), s = e.selections[n]?.sessionId ?? i.find((S) => !S.cancelled && S.sessionId !== null)?.sessionId ?? null, o = s ? t.sessions[s] : void 0, a = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => s ? S.sessionId === s || S.sessionId === null && S.conversationScopeId === n : S.conversationScopeId === n), r = Object.values(o?.items ?? {}).sort((S, V) => {
1780
- const te = jt(S.created_at), ce = jt(V.created_at);
1781
- return te < ce ? -1 : te > ce ? 1 : S.id < V.id ? -1 : S.id > V.id ? 1 : 0;
1779
+ const i = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => S.conversationScopeId === n), s = e.selections[n]?.sessionId ?? i.find((S) => !S.cancelled && S.sessionId !== null)?.sessionId ?? null, o = s ? t.sessions[s] : void 0, a = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => s ? S.sessionId === s || S.sessionId === null && S.conversationScopeId === n : S.conversationScopeId === n), r = Object.values(o?.items ?? {}).sort((S, F) => {
1780
+ const ee = jt(S.created_at), ce = jt(F.created_at);
1781
+ return ee < ce ? -1 : ee > ce ? 1 : S.id < F.id ? -1 : S.id > F.id ? 1 : 0;
1782
1782
  }), c = a.filter((S) => (!S.cancelled || S.conversationScopeId === n && (S.sessionId === null || S.sessionId === s || s === null && S === a[a.length - 1])) && !o?.items[S.userMessageId] && !o?.removedItems[S.userMessageId]), l = {};
1783
1783
  for (const S of r) {
1784
- const V = As(S);
1785
- if (V === null) continue;
1786
- const te = o?.streams[S.id];
1787
- l[S.id] = te ? te.state === "open" ? "open" : V < te.revision ? "awaiting_content" : te.state : "open";
1784
+ const F = As(S);
1785
+ if (F === null) continue;
1786
+ const ee = o?.streams[S.id];
1787
+ l[S.id] = ee ? ee.state === "open" ? "open" : F < ee.revision ? "awaiting_content" : ee.state : "open";
1788
1788
  }
1789
1789
  const p = [];
1790
1790
  for (const S of r)
@@ -1792,15 +1792,15 @@ function Vn(t, e, n) {
1792
1792
  p.push({ id: S.id, userMessageId: S.id, activityIds: [], outcomeIds: [], collapsed: !1 });
1793
1793
  else {
1794
1794
  p.length || p.push({ id: `leading:${S.id}`, userMessageId: null, activityIds: [], outcomeIds: [], collapsed: !1 });
1795
- const V = p.length - 1, te = p[V], ce = S.type === "commentary" || S.type === "tool_summary" ? "activityIds" : "outcomeIds";
1796
- p[V] = { ...te, [ce]: [...te[ce], S.id] };
1795
+ const F = p.length - 1, ee = p[F], ce = S.type === "commentary" || S.type === "tool_summary" ? "activityIds" : "outcomeIds";
1796
+ p[F] = { ...ee, [ce]: [...ee[ce], S.id] };
1797
1797
  }
1798
1798
  for (const S of c) {
1799
- const V = p.findIndex((te) => {
1800
- const ce = a.find((Se) => Se.userMessageId === te.userMessageId), ne = o?.items[te.userMessageId ?? te.activityIds[0] ?? te.outcomeIds[0]];
1801
- return (ce?.submittedAt ?? (ne ? Date.parse(ne.created_at) : 1 / 0)) > S.submittedAt;
1799
+ const F = p.findIndex((ee) => {
1800
+ const ce = a.find((Se) => Se.userMessageId === ee.userMessageId), te = o?.items[ee.userMessageId ?? ee.activityIds[0] ?? ee.outcomeIds[0]];
1801
+ return (ce?.submittedAt ?? (te ? Date.parse(te.created_at) : 1 / 0)) > S.submittedAt;
1802
1802
  });
1803
- p.splice(V < 0 ? p.length : V, 0, {
1803
+ p.splice(F < 0 ? p.length : F, 0, {
1804
1804
  id: S.userMessageId,
1805
1805
  userMessageId: S.userMessageId,
1806
1806
  activityIds: [],
@@ -1810,17 +1810,17 @@ function Vn(t, e, n) {
1810
1810
  }
1811
1811
  const d = o?.execution, h = a.filter((S) => !S.cancelled && S.delivery !== "failed"), g = h.filter((S) => S.delivery !== "accepted" && S.executionVersion === null), m = h.filter((S) => S.delivery === "accepted" && S.executionVersion === null), f = h[h.length - 1], w = g.length > 0, b = f !== void 0 && m.includes(f);
1812
1812
  let _ = w ? "submitting" : b ? "awaiting_execution" : d?.phase ?? "idle";
1813
- const v = Object.entries(t.stops).filter(([S]) => S === n || s !== null && e.selections[S]?.sessionId === s).map(([, S]) => S).find((S) => (!a.length || S.userMessageIds.includes(a[a.length - 1].userMessageId) || !w && !b && Kt(d).some((V) => S.userMessageIds.includes(V))) && (!d || d.version <= S.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((V) => V.cancelled && V.executionVersion === null && S.userMessageIds.includes(V.userMessageId)))), E = d && ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((S) => S.delivery === "accepted" && S.executionVersion === null && v?.userMessageIds.includes(S.userMessageId));
1813
+ const v = Object.entries(t.stops).filter(([S]) => S === n || s !== null && e.selections[S]?.sessionId === s).map(([, S]) => S).find((S) => (!a.length || S.userMessageIds.includes(a[a.length - 1].userMessageId) || !w && !b && Kt(d).some((F) => S.userMessageIds.includes(F))) && (!d || d.version <= S.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((F) => F.cancelled && F.executionVersion === null && S.userMessageIds.includes(F.userMessageId)))), E = d && ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((S) => S.delivery === "accepted" && S.executionVersion === null && v?.userMessageIds.includes(S.userMessageId));
1814
1814
  v && E && !w && (!d || !["thinking", "steering", "queued", "stopping"].includes(d.phase) || Kt(d).every((S) => v.userMessageIds.includes(S))) && (_ = "stopping"), v && !E && !w && a.some((S) => S.cancelled && S.executionVersion === null && v.userMessageIds.includes(S.userMessageId)) && (_ = a.some((S) => v.userMessageIds.includes(S.userMessageId) && ["sending", "uncertain"].includes(S.delivery)) ? "stopping" : "stopped");
1815
- const L = ["thinking", "steering", "queued"].includes(_), K = t.stops[n] ?? v, U = K?.userMessageIds.filter((S) => !["completed", "failed"].includes(o?.executionByUserMessage[S]?.phase ?? "")) ?? [], ge = U.some((S) => {
1816
- const V = a.find((ce) => ce.userMessageId === S);
1817
- return !Object.values(t.operations).some((ce) => ce.command.type === "run.stop" && ce.command.payload.expectedUserMessageId === S && ce.phase === "done") && (V?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(V.delivery) || !!(d && Kt(d).includes(S) && ["thinking", "steering", "queued", "stopping"].includes(d.phase)));
1818
- }), G = d?.user_message_ids ?? [], q = w || b ? f?.userMessageId ?? null : G[G.length - 1] ?? null, D = p.find((S) => S.userMessageId === q), F = L ? [...D?.activityIds ?? []].reverse().find((S) => l[S] === "open") ?? null : null, J = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1815
+ const L = ["thinking", "steering", "queued"].includes(_), K = t.stops[n] ?? v, U = K?.userMessageIds.filter((S) => !["completed", "failed"].includes(o?.executionByUserMessage[S]?.phase ?? "")) ?? [], he = U.some((S) => {
1816
+ const F = a.find((ce) => ce.userMessageId === S);
1817
+ return !Object.values(t.operations).some((ce) => ce.command.type === "run.stop" && ce.command.payload.expectedUserMessageId === S && ce.phase === "done") && (F?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(F.delivery) || !!(d && Kt(d).includes(S) && ["thinking", "steering", "queued", "stopping"].includes(d.phase)));
1818
+ }), G = d?.user_message_ids ?? [], oe = w || b ? f?.userMessageId ?? null : G[G.length - 1] ?? null, R = p.find((S) => S.userMessageId === oe), V = L ? [...R?.activityIds ?? []].reverse().find((S) => l[S] === "open") ?? null : null, O = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1819
1819
  (!o?.execution || o.execution.phase === "idle" && o.execution.user_message_ids.length === 0) && Object.values(t.operations).some((S) => S.conversationScopeId === n && S.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(S.command.type) && !S.command.payload.sessionId && S.result?.sessionId === s);
1820
1820
  return qt({
1821
1821
  historyRefreshFailure: o?.historyRefreshFailure ?? null,
1822
1822
  selectionKey: n ? JSON.stringify([t.authorityId, t.generation, n]) : void 0,
1823
- isDraftSession: J,
1823
+ isDraftSession: O,
1824
1824
  proactiveQuestion: t.proactiveQuestions[n] ?? null,
1825
1825
  sessionId: s,
1826
1826
  items: r,
@@ -1832,9 +1832,9 @@ function Vn(t, e, n) {
1832
1832
  removedItems: o?.removedItems ?? {},
1833
1833
  streamStates: l,
1834
1834
  preparation: o?.preparation ?? null,
1835
- stop: K ? { ...K, userMessageIds: U, pending: ge } : null,
1836
- segments: p.map((S, V) => ({ ...S, collapsed: L ? S.userMessageId !== q : V < p.length - 1 || S.activityIds.length > 0 })),
1837
- activity: { phase: _, activeItemId: F, userMessageId: q, executionKey: JSON.stringify([...Kt(d)].sort()) },
1835
+ stop: K ? { ...K, userMessageIds: U, pending: he } : null,
1836
+ segments: p.map((S, F) => ({ ...S, collapsed: L ? S.userMessageId !== oe : F < p.length - 1 || S.activityIds.length > 0 })),
1837
+ activity: { phase: _, activeItemId: V, userMessageId: oe, executionKey: JSON.stringify([...Kt(d)].sort()) },
1838
1838
  // Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
1839
1839
  // the same submitted text in the optimistic transcript and composer during delivery.
1840
1840
  receipts: i.filter((S) => !S.cancelled && e.clients[S.clientScopeId] === n).map((S) => ({ viewId: S.viewId, userMessageId: S.userMessageId, acceptedRendererRevision: S.rendererRevision }))
@@ -3379,10 +3379,10 @@ const Kh = [
3379
3379
  "removeListener"
3380
3380
  // used by the Node.js EventEmitter
3381
3381
  ];
3382
- var ie;
3382
+ var ne;
3383
3383
  (function(t) {
3384
3384
  t[t.CONNECT = 0] = "CONNECT", t[t.DISCONNECT = 1] = "DISCONNECT", t[t.EVENT = 2] = "EVENT", t[t.ACK = 3] = "ACK", t[t.CONNECT_ERROR = 4] = "CONNECT_ERROR", t[t.BINARY_EVENT = 5] = "BINARY_EVENT", t[t.BINARY_ACK = 6] = "BINARY_ACK";
3385
- })(ie || (ie = {}));
3385
+ })(ne || (ne = {}));
3386
3386
  class Hh {
3387
3387
  /**
3388
3388
  * Encoder constructor
@@ -3399,8 +3399,8 @@ class Hh {
3399
3399
  * @param {Object} obj - packet object
3400
3400
  */
3401
3401
  encode(e) {
3402
- return (e.type === ie.EVENT || e.type === ie.ACK) && _s(e) ? this.encodeAsBinary({
3403
- type: e.type === ie.EVENT ? ie.BINARY_EVENT : ie.BINARY_ACK,
3402
+ return (e.type === ne.EVENT || e.type === ne.ACK) && _s(e) ? this.encodeAsBinary({
3403
+ type: e.type === ne.EVENT ? ne.BINARY_EVENT : ne.BINARY_ACK,
3404
3404
  nsp: e.nsp,
3405
3405
  data: e.data,
3406
3406
  id: e.id
@@ -3411,7 +3411,7 @@ class Hh {
3411
3411
  */
3412
3412
  encodeAsString(e) {
3413
3413
  let n = "" + e.type;
3414
- return (e.type === ie.BINARY_EVENT || e.type === ie.BINARY_ACK) && (n += e.attachments + "-"), e.nsp && e.nsp !== "/" && (n += e.nsp + ","), e.id != null && (n += e.id), e.data != null && (n += JSON.stringify(e.data, this.replacer)), n;
3414
+ return (e.type === ne.BINARY_EVENT || e.type === ne.BINARY_ACK) && (n += e.attachments + "-"), e.nsp && e.nsp !== "/" && (n += e.nsp + ","), e.id != null && (n += e.id), e.data != null && (n += JSON.stringify(e.data, this.replacer)), n;
3415
3415
  }
3416
3416
  /**
3417
3417
  * Encode packet as 'buffer sequence' by removing blobs, and
@@ -3444,8 +3444,8 @@ class ra extends Ee {
3444
3444
  if (this.reconstructor)
3445
3445
  throw new Error("got plaintext data when reconstructing a packet");
3446
3446
  n = this.decodeString(e);
3447
- const i = n.type === ie.BINARY_EVENT;
3448
- i || n.type === ie.BINARY_ACK ? (n.type = i ? ie.EVENT : ie.ACK, this.reconstructor = new Wh(n)) : super.emitReserved("decoded", n);
3447
+ const i = n.type === ne.BINARY_EVENT;
3448
+ i || n.type === ne.BINARY_ACK ? (n.type = i ? ne.EVENT : ne.ACK, this.reconstructor = new Wh(n)) : super.emitReserved("decoded", n);
3449
3449
  } else if (oa(e) || e.base64)
3450
3450
  if (this.reconstructor)
3451
3451
  n = this.reconstructor.takeBinaryData(e), n && (this.reconstructor = null, super.emitReserved("decoded", n));
@@ -3465,9 +3465,9 @@ class ra extends Ee {
3465
3465
  const i = {
3466
3466
  type: Number(e.charAt(0))
3467
3467
  };
3468
- if (ie[i.type] === void 0)
3468
+ if (ne[i.type] === void 0)
3469
3469
  throw new Error("unknown packet type " + i.type);
3470
- if (i.type === ie.BINARY_EVENT || i.type === ie.BINARY_ACK) {
3470
+ if (i.type === ne.BINARY_EVENT || i.type === ne.BINARY_ACK) {
3471
3471
  const o = n + 1;
3472
3472
  for (; e.charAt(++n) !== "-" && n != e.length; )
3473
3473
  ;
@@ -3520,17 +3520,17 @@ class ra extends Ee {
3520
3520
  }
3521
3521
  static isPayloadValid(e, n) {
3522
3522
  switch (e) {
3523
- case ie.CONNECT:
3523
+ case ne.CONNECT:
3524
3524
  return Uc(n);
3525
- case ie.DISCONNECT:
3525
+ case ne.DISCONNECT:
3526
3526
  return n === void 0;
3527
- case ie.CONNECT_ERROR:
3527
+ case ne.CONNECT_ERROR:
3528
3528
  return typeof n == "string" || Uc(n);
3529
- case ie.EVENT:
3530
- case ie.BINARY_EVENT:
3529
+ case ne.EVENT:
3530
+ case ne.BINARY_EVENT:
3531
3531
  return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && Kh.indexOf(n[0]) === -1);
3532
- case ie.ACK:
3533
- case ie.BINARY_ACK:
3532
+ case ne.ACK:
3533
+ case ne.BINARY_ACK:
3534
3534
  return Array.isArray(n);
3535
3535
  }
3536
3536
  }
@@ -3578,7 +3578,7 @@ const Gh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3578
3578
  Decoder: ra,
3579
3579
  Encoder: Hh,
3580
3580
  get PacketType() {
3581
- return ie;
3581
+ return ne;
3582
3582
  }
3583
3583
  }, Symbol.toStringTag, { value: "Module" }));
3584
3584
  function It(t, e, n) {
@@ -3716,7 +3716,7 @@ class Ed extends Ee {
3716
3716
  if (n.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
3717
3717
  return this._addToQueue(n), this;
3718
3718
  const a = {
3719
- type: ie.EVENT,
3719
+ type: ne.EVENT,
3720
3720
  data: n
3721
3721
  };
3722
3722
  if (a.options = {}, a.options.compress = this.flags.compress !== !1, typeof n[n.length - 1] == "function") {
@@ -3824,7 +3824,7 @@ class Ed extends Ee {
3824
3824
  */
3825
3825
  _sendConnectPacket(e) {
3826
3826
  this.packet({
3827
- type: ie.CONNECT,
3827
+ type: ne.CONNECT,
3828
3828
  data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
3829
3829
  });
3830
3830
  }
@@ -3870,21 +3870,21 @@ class Ed extends Ee {
3870
3870
  onpacket(e) {
3871
3871
  if (e.nsp === this.nsp)
3872
3872
  switch (e.type) {
3873
- case ie.CONNECT:
3873
+ case ne.CONNECT:
3874
3874
  e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
3875
3875
  break;
3876
- case ie.EVENT:
3877
- case ie.BINARY_EVENT:
3876
+ case ne.EVENT:
3877
+ case ne.BINARY_EVENT:
3878
3878
  this.onevent(e);
3879
3879
  break;
3880
- case ie.ACK:
3881
- case ie.BINARY_ACK:
3880
+ case ne.ACK:
3881
+ case ne.BINARY_ACK:
3882
3882
  this.onack(e);
3883
3883
  break;
3884
- case ie.DISCONNECT:
3884
+ case ne.DISCONNECT:
3885
3885
  this.ondisconnect();
3886
3886
  break;
3887
- case ie.CONNECT_ERROR:
3887
+ case ne.CONNECT_ERROR:
3888
3888
  this.destroy();
3889
3889
  const i = new Error(e.data.message);
3890
3890
  i.data = e.data.data, this.emitReserved("connect_error", i);
@@ -3919,7 +3919,7 @@ class Ed extends Ee {
3919
3919
  let i = !1;
3920
3920
  return function(...s) {
3921
3921
  i || (i = !0, n.packet({
3922
- type: ie.ACK,
3922
+ type: ne.ACK,
3923
3923
  id: e,
3924
3924
  data: s
3925
3925
  }));
@@ -3988,7 +3988,7 @@ class Ed extends Ee {
3988
3988
  * @return self
3989
3989
  */
3990
3990
  disconnect() {
3991
- return this.connected && this.packet({ type: ie.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
3991
+ return this.connected && this.packet({ type: ne.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
3992
3992
  }
3993
3993
  /**
3994
3994
  * Alias for {@link disconnect()}.
@@ -4473,7 +4473,7 @@ const Yh = 45e3, Xh = /* @__PURE__ */ new Set([
4473
4473
  "tool.started",
4474
4474
  "tool.result"
4475
4475
  ]);
4476
- class R extends Error {
4476
+ class T extends Error {
4477
4477
  constructor(e, n, i = !1, s, o = !1) {
4478
4478
  super(e), this.code = n, this.outcomeUnknown = i, this.detail = s, this.backendRefusal = o, this.code = n === "401" ? "unauthorized" : n;
4479
4479
  }
@@ -4484,7 +4484,7 @@ class R extends Error {
4484
4484
  }
4485
4485
  function zc(t, e) {
4486
4486
  const n = t.result && typeof t.result == "object" ? t.result : void 0, i = typeof n?.message == "string" && n.message.trim() ? n.message : `${e} (${t.code ?? "request_rejected"})`;
4487
- return new R(i, t.code ?? "request_rejected", !1, t.result, !0);
4487
+ return new T(i, t.code ?? "request_rejected", !1, t.result, !0);
4488
4488
  }
4489
4489
  class Qh {
4490
4490
  constructor(e) {
@@ -4506,7 +4506,7 @@ class Qh {
4506
4506
  }) : this.invalidate(!1, n), this.restoreBackoff();
4507
4507
  }), this.socket.io.on("reconnect", () => this.restoreBackoff()), this.socket.on("connection.ready", (n) => {
4508
4508
  if (n.protocol !== 1 || n.role !== this.options.auth.role || n.display_projection_ready !== !1) {
4509
- this.options.onError(new R("Unsupported Product Agent transport negotiation", "protocol_error")), this.disconnect();
4509
+ this.options.onError(new T("Unsupported Product Agent transport negotiation", "protocol_error")), this.disconnect();
4510
4510
  return;
4511
4511
  }
4512
4512
  this.admitted = n, this.activate();
@@ -4518,7 +4518,7 @@ class Qh {
4518
4518
  )), this.socket.on("connect_error", (n) => {
4519
4519
  const i = n.data?.code;
4520
4520
  if (i === "unauthorized" && n.data?.reason === "token_expired" && n.data.retryable === !0) {
4521
- this.options.onError(new R(n.message, i, !1, n.data)), this.disconnect();
4521
+ this.options.onError(new T(n.message, i, !1, n.data)), this.disconnect();
4522
4522
  return;
4523
4523
  }
4524
4524
  if (!i || n.data?.retryable === !0) {
@@ -4530,7 +4530,7 @@ class Qh {
4530
4530
  }
4531
4531
  return;
4532
4532
  }
4533
- (i === "unauthorized" || i === "update_required") && (this.rejectedToken = this.options.auth.token), this.options.onError(new R(n.message, i ?? "connection_error", !1, n.data)), this.rejectedToken === this.options.auth.token && this.disconnect();
4533
+ (i === "unauthorized" || i === "update_required") && (this.rejectedToken = this.options.auth.token), this.options.onError(new T(n.message, i ?? "connection_error", !1, n.data)), this.rejectedToken === this.options.auth.token && this.disconnect();
4534
4534
  }), this.socket.on("conversation.event", (n) => {
4535
4535
  this.ready && n.protocol === 1 && n.session_id && this.bindings.get(n.session_id)?.owners.size && this.options.onEvent("conversation.event", n.event);
4536
4536
  }), this.socket.on("conversation.metadata.updated", (n) => {
@@ -4557,7 +4557,7 @@ class Qh {
4557
4557
  const s = this.generation, o = await this.options.onToolCall(n);
4558
4558
  i({ received: o && !!this.ready && s === this.generation });
4559
4559
  }), this.socket.on("executor.replaced", () => {
4560
- this.retired = !0, this.options.onError(new R("Browser executor was replaced", "executor_replaced")), this.disconnect();
4560
+ this.retired = !0, this.options.onError(new T("Browser executor was replaced", "executor_replaced")), this.disconnect();
4561
4561
  });
4562
4562
  }
4563
4563
  options;
@@ -4591,11 +4591,11 @@ class Qh {
4591
4591
  return this.ready && this.socket.id ? `pa-sio:${this.socket.id}` : null;
4592
4592
  }
4593
4593
  async restoreExecutor(e) {
4594
- if (this.connectionId !== e) throw new R("Browser connection changed.", "executor_not_ready");
4594
+ if (this.connectionId !== e) throw new T("Browser connection changed.", "executor_not_ready");
4595
4595
  if (this.executorRecovery) return this.executorRecovery;
4596
4596
  const n = this.request("executor.register", {}, this.generation).then(() => {
4597
4597
  }, (i) => {
4598
- throw i instanceof R && (i.outcomeUnknown || i.code === "disconnected") ? new R("Reconnecting the browser before continuing.", "executor_not_ready") : i;
4598
+ throw i instanceof T && (i.outcomeUnknown || i.code === "disconnected") ? new T("Reconnecting the browser before continuing.", "executor_not_ready") : i;
4599
4599
  });
4600
4600
  this.executorRecovery = n;
4601
4601
  try {
@@ -4632,7 +4632,7 @@ class Qh {
4632
4632
  beginAttempt() {
4633
4633
  this.clearReadinessTimers(), this.active = !0, this.attempt = { connectionAttemptId: crypto.randomUUID(), reconnectAttempt: this.attemptCount++, startedAt: Date.now() }, this.socket.auth = { ...this.options.auth, connection_attempt_id: this.attempt.connectionAttemptId }, this.options.onAttempt?.(this.attempt);
4634
4634
  const e = this.generation, n = (i) => {
4635
- e !== this.generation || !this.active || (this.options.onError(new R("Product Agent readiness timed out", i, !1, {
4635
+ e !== this.generation || !this.active || (this.options.onError(new T("Product Agent readiness timed out", i, !1, {
4636
4636
  retryable: !0,
4637
4637
  ...this.attempt,
4638
4638
  readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
@@ -4646,20 +4646,20 @@ class Qh {
4646
4646
  async retain(e, n) {
4647
4647
  let i = this.bindings.get(e);
4648
4648
  if (!i) {
4649
- if (this.bindings.size >= 64) throw new R("Too many conversation subscriptions", "subscription_limit");
4649
+ if (this.bindings.size >= 64) throw new T("Too many conversation subscriptions", "subscription_limit");
4650
4650
  i = { id: crypto.randomUUID(), owners: /* @__PURE__ */ new Set(), joinedGeneration: -1 }, this.bindings.set(e, i);
4651
4651
  }
4652
4652
  if (i.owners.add(n), !this.ready) return;
4653
4653
  const s = this.generation;
4654
4654
  await this.synchronize().catch((o) => {
4655
- throw s !== this.generation || (i.owners.delete(n), o instanceof R && o.outcomeUnknown && this.ready && (i.joinedGeneration = this.generation), this.synchronize().catch((a) => this.options.onError(a))), o;
4655
+ throw s !== this.generation || (i.owners.delete(n), o instanceof T && o.outcomeUnknown && this.ready && (i.joinedGeneration = this.generation), this.synchronize().catch((a) => this.options.onError(a))), o;
4656
4656
  });
4657
4657
  }
4658
4658
  async release(e, n) {
4659
4659
  this.bindings.get(e)?.owners.delete(n), this.ready && await this.synchronize();
4660
4660
  }
4661
4661
  async rpc(e, n) {
4662
- if (!Xh.has(e)) throw new R("Operation requires its HTTP adapter", "unsupported_rpc");
4662
+ if (!Xh.has(e)) throw new T("Operation requires its HTTP adapter", "unsupported_rpc");
4663
4663
  const i = this.generation, s = JSON.stringify(n);
4664
4664
  return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(s) }, i)) : this.enqueue(async () => {
4665
4665
  if (this.assertReady(i), e === "tool.result") {
@@ -4679,8 +4679,8 @@ class Qh {
4679
4679
  this.ready = n, await this.synchronize(!0), e === this.generation && this.ready && (this.options.bootstrapRequired || this.markReady(), this.options.onReady(n));
4680
4680
  } catch (s) {
4681
4681
  if (e === this.generation) {
4682
- const o = s instanceof R ? s : new R(String(s), "activation_error");
4683
- this.activationFailed(new R(
4682
+ const o = s instanceof T ? s : new T(String(s), "activation_error");
4683
+ this.activationFailed(new T(
4684
4684
  o.message,
4685
4685
  o.code,
4686
4686
  o.outcomeUnknown,
@@ -4707,7 +4707,7 @@ class Qh {
4707
4707
  subscription_id: s.id,
4708
4708
  ...this.options.displaySchema === "canonical" ? { display_schema: "canonical" } : {}
4709
4709
  }, n).then(() => !0).catch((a) => {
4710
- if (a instanceof R && !a.outcomeUnknown && a.detail?.retryable !== !0 && this.bindings.get(i) === s && (this.bindings.delete(i), e))
4710
+ if (a instanceof T && !a.outcomeUnknown && a.detail?.retryable !== !0 && this.bindings.get(i) === s && (this.bindings.delete(i), e))
4711
4711
  return this.options.onError(a), !1;
4712
4712
  throw a;
4713
4713
  })) continue;
@@ -4719,7 +4719,7 @@ class Qh {
4719
4719
  }
4720
4720
  enqueue(e) {
4721
4721
  if (this.queuedOperations >= 128) {
4722
- const i = new R("Product Agent transport queue is full", "backpressure");
4722
+ const i = new T("Product Agent transport queue is full", "backpressure");
4723
4723
  return this.recoverUncertainDelivery(i, this.generation), Promise.reject(i);
4724
4724
  }
4725
4725
  this.queuedOperations++;
@@ -4730,7 +4730,7 @@ class Qh {
4730
4730
  }), n;
4731
4731
  }
4732
4732
  assertReady(e) {
4733
- if (!this.ready || !this.socket.connected || e !== this.generation) throw new R("Transport is not ready", "disconnected");
4733
+ if (!this.ready || !this.socket.connected || e !== this.generation) throw new T("Transport is not ready", "disconnected");
4734
4734
  }
4735
4735
  async uploadResult(e, n, i) {
4736
4736
  const s = crypto.randomUUID();
@@ -4755,43 +4755,43 @@ class Qh {
4755
4755
  body: JSON.stringify({ request_id: s, type: "tool.result", payload: e })
4756
4756
  });
4757
4757
  if (d.status >= 500)
4758
- throw new R("Result upload outcome is unknown", "delivery_unknown", !0);
4759
- if (!d.ok) throw new R(`Result upload rejected (${d.status})`, String(d.status), !1, void 0, !0);
4758
+ throw new T("Result upload outcome is unknown", "delivery_unknown", !0);
4759
+ if (!d.ok) throw new T(`Result upload rejected (${d.status})`, String(d.status), !1, void 0, !0);
4760
4760
  const h = await d.json();
4761
4761
  if (n !== this.generation || o.signal.aborted)
4762
- throw new R("Result upload outcome is unknown", "delivery_unknown", !0);
4762
+ throw new T("Result upload outcome is unknown", "delivery_unknown", !0);
4763
4763
  if (h?.request_id !== s || typeof h.ok != "boolean")
4764
- throw new R("Invalid result acknowledgement identity", "invalid_ack", !0);
4764
+ throw new T("Invalid result acknowledgement identity", "invalid_ack", !0);
4765
4765
  if (!h.ok) throw zc(h, "Product Agent result rejected");
4766
4766
  return h.result;
4767
4767
  } catch (l) {
4768
- const p = l instanceof R ? l : new R("Result upload outcome is unknown", "delivery_unknown", !0);
4768
+ const p = l instanceof T ? l : new T("Result upload outcome is unknown", "delivery_unknown", !0);
4769
4769
  throw this.recoverUncertainDelivery(p, n), p;
4770
4770
  } finally {
4771
4771
  clearTimeout(c), this.uploadingResult = !1, this.pending.delete(a);
4772
4772
  }
4773
4773
  }
4774
4774
  request(e, n, i) {
4775
- if (!this.socket.connected || i !== this.generation) return Promise.reject(new R("Transport disconnected", "disconnected"));
4775
+ if (!this.socket.connected || i !== this.generation) return Promise.reject(new T("Transport disconnected", "disconnected"));
4776
4776
  const s = crypto.randomUUID();
4777
4777
  return new Promise((o, a) => {
4778
4778
  const r = (c) => {
4779
4779
  this.pending.delete(r), a(c);
4780
4780
  };
4781
4781
  this.pending.add(r), this.socket.timeout(this.options.requestTimeoutMs ?? 15e3).emit(e, { ...n, request_id: s }, (c, l) => {
4782
- this.pending.delete(r) && (c || i !== this.generation ? a(new R("Delivery outcome is unknown; reconcile without repeating execution", "delivery_unknown", !0)) : l?.request_id !== s || typeof l.ok != "boolean" ? a(new R("Invalid acknowledgement identity", "invalid_ack", !0)) : l.ok ? o(l.result) : a(zc(l, "Product Agent request rejected")));
4782
+ this.pending.delete(r) && (c || i !== this.generation ? a(new T("Delivery outcome is unknown; reconcile without repeating execution", "delivery_unknown", !0)) : l?.request_id !== s || typeof l.ok != "boolean" ? a(new T("Invalid acknowledgement identity", "invalid_ack", !0)) : l.ok ? o(l.result) : a(zc(l, "Product Agent request rejected")));
4783
4783
  });
4784
4784
  }).catch((o) => {
4785
4785
  throw this.recoverUncertainDelivery(o, i), o;
4786
4786
  });
4787
4787
  }
4788
4788
  recoverUncertainDelivery(e, n) {
4789
- e instanceof R && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && n === this.generation && this.active && this.recover(e.code === "backpressure" ? "local_backpressure" : "local_delivery_uncertain");
4789
+ e instanceof T && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && n === this.generation && this.active && this.recover(e.code === "backpressure" ? "local_backpressure" : "local_delivery_uncertain");
4790
4790
  }
4791
4791
  invalidate(e = !1, n = "local_invalidation") {
4792
4792
  if (this.clearReadinessTimers(), !!this.active) {
4793
4793
  this.active = !1, this.generation++, this.ready = null, this.admitted = null, this.activating = !1;
4794
- for (const i of [...this.pending]) i(new R("Connection lost before acknowledgement", "delivery_unknown", !0));
4794
+ for (const i of [...this.pending]) i(new T("Connection lost before acknowledgement", "delivery_unknown", !0));
4795
4795
  this.options.onDisconnect(e, n);
4796
4796
  }
4797
4797
  }
@@ -4819,7 +4819,7 @@ class Cd {
4819
4819
  async request(e, n = {}, i, s, o, a = {}) {
4820
4820
  if (a.skipAuthentication) return this.requestOnce(e, n, i, s, o, a.signal, a.diagnostic);
4821
4821
  const r = this.options.authority?.(), c = (d = !0) => {
4822
- if (r !== this.options.authority?.()) throw new R("Conversation authority was retired.", "authority_retired", !0);
4822
+ if (r !== this.options.authority?.()) throw new T("Conversation authority was retired.", "authority_retired", !0);
4823
4823
  d && (this.requests.signal.throwIfAborted(), a.signal?.throwIfAborted());
4824
4824
  }, l = a.readOnly ?? (s ?? (i === void 0 ? "GET" : "POST")) === "GET";
4825
4825
  let p = 0;
@@ -4834,7 +4834,7 @@ class Cd {
4834
4834
  try {
4835
4835
  let f = i;
4836
4836
  if (o === "conversations" && e === "/commands" && this.auth.role !== "session_surface" && this.options.executorConnection) {
4837
- if (m = this.options.executorConnection(), !m) throw new R("Reconnecting the browser before continuing.", "executor_not_ready");
4837
+ if (m = this.options.executorConnection(), !m) throw new T("Reconnecting the browser before continuing.", "executor_not_ready");
4838
4838
  const _ = i;
4839
4839
  f = { ..._, context: { ..._.context, connection_id: m } };
4840
4840
  }
@@ -4842,90 +4842,92 @@ class Cd {
4842
4842
  return c(), b;
4843
4843
  } catch (f) {
4844
4844
  if (c(!1), this.requests.signal.aborted || a.signal?.aborted) throw f;
4845
- if (f instanceof R && f.code === "executor_not_ready" && m && d === 0 && this.options.restoreExecutor) {
4845
+ if (f instanceof T && f.code === "executor_not_ready" && m && d === 0 && this.options.restoreExecutor) {
4846
4846
  await this.options.restoreExecutor(m), d++, c();
4847
4847
  continue;
4848
4848
  }
4849
- if (!(f instanceof R) || !["unauthorized", "403"].includes(f.code) || !this.options.recoverAuthentication || !l || (await this.options.recoverAuthentication(g, f, l && d === 0), c(), !l || d !== 0)) throw f;
4849
+ if (!(f instanceof T) || !["unauthorized", "403"].includes(f.code) || !this.options.recoverAuthentication || !l || (await this.options.recoverAuthentication(g, f, l && d === 0), c(), !l || d !== 0)) throw f;
4850
4850
  d++;
4851
4851
  }
4852
4852
  }
4853
4853
  }
4854
4854
  async requestOnce(e, n, i, s, o, a, r, c = 1) {
4855
4855
  const l = this.auth.client_kind === "embed", p = new URL(`/api/product-agent/${o ?? (l ? "embed" : "runtime")}${e}`, this.options.backendUrl), d = o === "conversations" ? {} : l ? { client_id: this.auth.client_id, transport_id: this.auth.transport_id } : { community_id: this.auth.community_id, automation_run_id: this.auth.automation_run_id };
4856
- for (const [q, D] of Object.entries({ ...d, ...n }))
4857
- D != null && p.searchParams.set(q, String(D));
4856
+ for (const [R, V] of Object.entries({ ...d, ...n }))
4857
+ V != null && p.searchParams.set(R, String(V));
4858
4858
  this.requests.signal.throwIfAborted(), a?.throwIfAborted();
4859
- const h = new AbortController(), g = { trigger: null }, m = (q) => {
4860
- h.signal.aborted || (g.trigger = q, h.abort());
4859
+ const h = new AbortController(), g = { trigger: null }, m = (R) => {
4860
+ h.signal.aborted || (g.trigger = R, h.abort());
4861
4861
  }, f = () => m("transport_disposed"), w = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
4862
4862
  this.requests.signal.addEventListener("abort", f, { once: !0 }), a?.addEventListener("abort", w, { once: !0 });
4863
4863
  const b = o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && s === "POST", _ = /^\/conversations(?:\/[^/]+)?$/.test(e) && (s ?? (i === void 0 ? "GET" : "POST")) === "GET", v = setTimeout(() => m("deadline"), _ ? 6e4 : b ? 3e4 : 15e3), E = Zh(), L = Date.now();
4864
- let K = null, U = null, ge = null, G = null;
4864
+ let K = null, U = !1, he = null, G = null, oe = null;
4865
4865
  try {
4866
- const q = await Promise.resolve(fetch(p, {
4866
+ const R = await Promise.resolve(fetch(p, {
4867
4867
  method: s ?? (i === void 0 ? "GET" : "POST"),
4868
4868
  cache: "no-store",
4869
4869
  signal: h.signal,
4870
4870
  headers: { "x-product-agent-auth-request-id": E, authorization: l || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...b ? { "x-request-id": E } : {} },
4871
4871
  ...i === void 0 ? {} : { body: JSON.stringify(i) }
4872
- })).catch((D) => {
4873
- throw b && D instanceof TypeError ? new R("The connection was interrupted. Please try again.", "connection_interrupted", !0) : D;
4872
+ })).catch((V) => {
4873
+ throw U = !0, V;
4874
4874
  });
4875
- if (K = Date.now(), U = q.status, ge = Bc(q.headers.get("x-request-id")), G = Bc(q.headers.get("x-cloud-trace-context")), !q.ok) {
4876
- const D = q.status === 401 ? "unauthorized" : q.status === 426 ? "update_required" : String(q.status), F = (await q.json().catch(() => null))?.detail;
4877
- if (o === "conversations" && e.endsWith("/snapshot") && q.status === 409 && F === "Display projection is not enabled")
4878
- throw new R("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
4879
- if (o === "conversations" && e === "/commands" && (q.status === 409 && F?.code === "executor_not_ready" && F.retryable === !0 || q.status === 403 && F === "Register the executor before commands"))
4880
- throw new R("Reconnecting the browser before continuing.", "executor_not_ready");
4881
- if (q.status !== 401 && F && typeof F == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(F.code) || !Ti(void 0, F.code).allowed) && typeof F.message == "string")
4882
- throw new R(F.message, F.code, !1, {
4883
- ...typeof F.blockedOrigin == "string" ? { blockedOrigin: F.blockedOrigin } : {},
4884
- ...typeof F.securitySettingsUrl == "string" ? { securitySettingsUrl: F.securitySettingsUrl } : {}
4875
+ if (K = Date.now(), he = R.status, G = Bc(R.headers.get("x-request-id")), oe = Bc(R.headers.get("x-cloud-trace-context")), !R.ok) {
4876
+ const V = R.status === 401 ? "unauthorized" : R.status === 426 ? "update_required" : String(R.status), O = (await R.json().catch(() => null))?.detail;
4877
+ if (l && R.status === 403 && (o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) || (!o || o === "embed") && /^\/conversations\/[^/]+$/.test(e)) && ["Conversation unavailable", "Integration mismatch", "Embedded origin mismatch"].includes(O))
4878
+ throw new T("Conversation unavailable", "conversation_access_denied");
4879
+ if (o === "conversations" && e.endsWith("/snapshot") && R.status === 409 && O === "Display projection is not enabled")
4880
+ throw new T("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
4881
+ if (o === "conversations" && e === "/commands" && (R.status === 409 && O?.code === "executor_not_ready" && O.retryable === !0 || R.status === 403 && O === "Register the executor before commands"))
4882
+ throw new T("Reconnecting the browser before continuing.", "executor_not_ready");
4883
+ if (R.status !== 401 && O && typeof O == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(O.code) || !Ti(void 0, O.code).allowed) && typeof O.message == "string")
4884
+ throw new T(O.message, O.code, !1, {
4885
+ ...typeof O.blockedOrigin == "string" ? { blockedOrigin: O.blockedOrigin } : {},
4886
+ ...typeof O.securitySettingsUrl == "string" ? { securitySettingsUrl: O.securitySettingsUrl } : {}
4885
4887
  }, o === "conversations" && e === "/commands");
4886
- const J = F === "Token expired" ? "token_expired" : F === "Invalid token" ? "invalid_token" : F?.reason, S = q.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(J) ? { requestId: E, authTransport: "http", authEndpoint: `${o ?? (l ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: J, retryable: J === "token_expired" && (F === "Token expired" || F.retryable === !0) } : void 0;
4887
- throw new R(q.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : q.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${q.status})`, D, !1, S);
4888
+ const S = O === "Token expired" ? "token_expired" : O === "Invalid token" ? "invalid_token" : O?.reason, F = R.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(S) ? { requestId: E, authTransport: "http", authEndpoint: `${o ?? (l ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: S, retryable: S === "token_expired" && (O === "Token expired" || O.retryable === !0) } : void 0;
4889
+ throw new T(R.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : R.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${R.status})`, V, !1, F);
4888
4890
  }
4889
- return await q.json();
4890
- } catch (q) {
4891
- const D = g.trigger ?? ((q instanceof Error || q instanceof DOMException) && q.name === "AbortError" ? "unexpected_abort" : null), F = {
4891
+ return await R.json();
4892
+ } catch (R) {
4893
+ const V = g.trigger ?? ((R instanceof Error || R instanceof DOMException) && R.name === "AbortError" ? "unexpected_abort" : null), O = {
4892
4894
  requestId: E,
4893
4895
  method: s ?? (i === void 0 ? "GET" : "POST"),
4894
4896
  route: b ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4895
- status: U,
4896
- abortTrigger: D,
4897
- category: D === "deadline" ? "request_timed_out" : D === "unexpected_abort" ? "connection_interrupted" : D ? "request_cancelled" : q instanceof R ? q.code : "invalid_response",
4897
+ status: he,
4898
+ abortTrigger: V,
4899
+ category: V === "deadline" ? "request_timed_out" : V === "unexpected_abort" ? "connection_interrupted" : V ? "request_cancelled" : R instanceof T ? R.code : U ? "connection_interrupted" : "invalid_response",
4898
4900
  responseHeadersMs: K === null ? null : Math.max(0, K - L),
4899
4901
  responseBodyMs: K === null ? null : Math.max(0, Date.now() - K),
4900
- owner: D === "deadline" ? "http_deadline" : D === "transport_disposed" ? "http_transport" : D && D !== "unexpected_abort" ? "conversation_query" : U === null ? "browser" : "http_response",
4902
+ owner: V === "deadline" ? "http_deadline" : V === "transport_disposed" ? "http_transport" : V && V !== "unexpected_abort" ? "conversation_query" : he === null ? "browser" : "http_response",
4901
4903
  elapsedMs: Math.max(0, Date.now() - L),
4902
4904
  attempt: c,
4903
- queryRequestId: he(r?.queryRequestId),
4904
- ownerId: he(r?.ownerId),
4905
+ queryRequestId: ge(r?.queryRequestId),
4906
+ ownerId: ge(r?.ownerId),
4905
4907
  authorityGeneration: r?.authorityGeneration ?? null,
4906
- sessionId: he(r?.sessionId),
4908
+ sessionId: ge(r?.sessionId),
4907
4909
  release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${od.version}`,
4908
- upstreamRequestId: ge,
4909
- upstreamTraceId: G
4910
+ upstreamRequestId: G,
4911
+ upstreamTraceId: oe
4910
4912
  };
4911
- On(F) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(F) : console.warn("Product Agent HTTP request failed", F)).catch(() => {
4913
+ On(O) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(O) : console.warn("Product Agent HTTP request failed", O)).catch(() => {
4912
4914
  });
4913
- const J = On(F) ? { httpRequest: F } : void 0;
4914
- if (D !== null) {
4915
- const S = D !== "deadline" && D !== "unexpected_abort";
4916
- throw new R(
4917
- S ? "The request was cancelled." : D === "deadline" ? "The request timed out. Please try again." : "The connection was interrupted. Please try again.",
4918
- S ? "request_cancelled" : D === "deadline" ? "request_timed_out" : "connection_interrupted",
4915
+ const S = On(O) ? { httpRequest: O } : void 0;
4916
+ if (V !== null) {
4917
+ const F = V !== "deadline" && V !== "unexpected_abort";
4918
+ throw new T(
4919
+ F ? "The request was cancelled." : V === "deadline" ? "The request timed out. Please try again." : "The connection was interrupted. Please try again.",
4920
+ F ? "request_cancelled" : V === "deadline" ? "request_timed_out" : "connection_interrupted",
4919
4921
  !0,
4920
- J
4922
+ S
4921
4923
  );
4922
4924
  }
4923
- throw q instanceof R && J ? new R(q.message, q.code, q.outcomeUnknown, { ...q.detail, ...J }, q.backendRefusal) : b && J ? new R(
4924
- "The conversation response could not be read. Please try again.",
4925
+ throw R instanceof T && S ? new T(R.message, R.code, R.outcomeUnknown, { ...R.detail, ...S }, R.backendRefusal) : S ? new T(
4926
+ U ? "The connection was interrupted. Please try again." : b ? "The conversation response could not be read. Please try again." : "The response could not be read. Please try again.",
4925
4927
  "connection_interrupted",
4926
4928
  !0,
4927
- J
4928
- ) : q;
4929
+ S
4930
+ ) : R;
4929
4931
  } finally {
4930
4932
  clearTimeout(v), this.requests.signal.removeEventListener("abort", f), a?.removeEventListener("abort", w);
4931
4933
  }
@@ -5401,7 +5403,7 @@ class Ae extends EventTarget {
5401
5403
  stage: s,
5402
5404
  httpStatus: /^[45][0-9]{2}$/.test(n.code) ? Number(n.code) : void 0,
5403
5405
  failureKind: n.outcomeUnknown || i.retryable === !0 ? "temporary" : "permanent"
5404
- }), this.fail(new R(n.message, n.code, n.outcomeUnknown, { ...i, stage: s }, n.backendRefusal));
5406
+ }), this.fail(new T(n.message, n.code, n.outcomeUnknown, { ...i, stage: s }, n.backendRefusal));
5405
5407
  }
5406
5408
  }
5407
5409
  }), queueMicrotask(() => {
@@ -5529,17 +5531,17 @@ class Ae extends EventTarget {
5529
5531
  this.queueDiagnostic("auth_timeout", {
5530
5532
  readinessPhase: "bootstrap",
5531
5533
  failureKind: "temporary",
5532
- httpStatus: a instanceof R && /^[45][0-9]{2}$/.test(a.code) ? Number(a.code) : void 0
5534
+ httpStatus: a instanceof T && /^[45][0-9]{2}$/.test(a.code) ? Number(a.code) : void 0
5533
5535
  }), this.transport.recover();
5534
5536
  return;
5535
5537
  }
5536
5538
  if (n.type === "auth.session") {
5537
- const r = a instanceof R ? a : new R("Chat setup failed", "request_failed");
5539
+ const r = a instanceof T ? a : new T("Chat setup failed", "request_failed");
5538
5540
  this.queueDiagnostic("auth_rejected", {
5539
5541
  stage: "bootstrap",
5540
5542
  failureKind: "permanent",
5541
5543
  httpStatus: /^[45][0-9]{2}$/.test(r.code) ? Number(r.code) : void 0
5542
- }), this.fail(new R(
5544
+ }), this.fail(new T(
5543
5545
  r.message,
5544
5546
  r.code,
5545
5547
  r.outcomeUnknown,
@@ -5556,7 +5558,7 @@ class Ae extends EventTarget {
5556
5558
  try {
5557
5559
  return await this.transport.rpc(e.type, Object.fromEntries(Object.entries(e).filter(([n]) => n !== "type"))), !0;
5558
5560
  } catch (n) {
5559
- return n instanceof R && n.code === "backpressure" && !n.backendRefusal || this.fail(n, e), n instanceof R && n.backendRefusal;
5561
+ return n instanceof T && n.code === "backpressure" && !n.backendRefusal || this.fail(n, e), n instanceof T && n.backendRefusal;
5560
5562
  }
5561
5563
  }
5562
5564
  receive(e) {
@@ -5575,13 +5577,13 @@ class Ae extends EventTarget {
5575
5577
  }
5576
5578
  buffer(e, n) {
5577
5579
  if (e.length >= 128) {
5578
- this.fail(new R("Product Agent delivery buffer is full", "backpressure")), this.close();
5580
+ this.fail(new T("Product Agent delivery buffer is full", "backpressure")), this.close();
5579
5581
  return;
5580
5582
  }
5581
5583
  e.push(n);
5582
5584
  }
5583
5585
  fail(e, n, i = !1) {
5584
- const s = e instanceof R ? e : new R(String(e), "request_failed");
5586
+ const s = e instanceof T ? e : new T(String(e), "request_failed");
5585
5587
  if (s.code === "disconnected" || s.outcomeUnknown) return;
5586
5588
  const o = s.detail && typeof s.detail == "object" ? s.detail : {};
5587
5589
  this.options.auth.client_kind === "extension" && s.code === "update_required" && o.version_status && this.receive(o.version_status), this.receive({
@@ -5601,7 +5603,7 @@ class Ae extends EventTarget {
5601
5603
  return this.httpTransport.request(e, n, i, s);
5602
5604
  }
5603
5605
  isRetryableRead(e) {
5604
- return e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof R && ["request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.code);
5606
+ return e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof T && ["request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.code);
5605
5607
  }
5606
5608
  async loadUserSuggestions(e, n = 0) {
5607
5609
  const i = this.promptRevision, s = this.options.pageUrl();
@@ -5612,7 +5614,7 @@ class Ae extends EventTarget {
5612
5614
  } catch (o) {
5613
5615
  if (e.aborted) return;
5614
5616
  if (!this.isRetryableRead(o)) {
5615
- i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof R && ["unauthorized", "update_required"].includes(o.code) ? this.fail(o) : console.error("Product Agent optional suggestions could not be loaded", o);
5617
+ i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof T && ["unauthorized", "update_required"].includes(o.code) ? this.fail(o) : console.error("Product Agent optional suggestions could not be loaded", o);
5616
5618
  return;
5617
5619
  }
5618
5620
  this.suggestionTimer = setTimeout(() => {
@@ -6509,7 +6511,7 @@ class Cg {
6509
6511
  })
6510
6512
  },
6511
6513
  errorAdapter: (s) => {
6512
- const o = Xr(s), a = s !== null && typeof s == "object" && "details" in s ? s.details : void 0, r = a && typeof a == "object" && "httpRequest" in a ? a.httpRequest : void 0;
6514
+ const o = Xr(s), a = s !== null && typeof s == "object" ? "details" in s ? s.details : "detail" in s ? s.detail : void 0 : void 0, r = a && typeof a == "object" && "httpRequest" in a ? a.httpRequest : void 0;
6513
6515
  return { ...o, ...On(r) ? { details: { ...o.details, httpRequest: r } } : {} };
6514
6516
  }
6515
6517
  });
@@ -7380,7 +7382,7 @@ function er(t) {
7380
7382
  if (t instanceof Ze)
7381
7383
  return t.retryable;
7382
7384
  if (t && typeof t == "object") {
7383
- const e = t instanceof R ? t.code : "", n = /^[45][0-9]{2}$/.test(e) ? Number(e) : t.status;
7385
+ const e = t instanceof T ? t.code : "", n = /^[45][0-9]{2}$/.test(e) ? Number(e) : t.status;
7384
7386
  if (typeof n == "number")
7385
7387
  return n === 408 || n === 425 || n === 429 || n >= 500;
7386
7388
  }
@@ -7413,7 +7415,7 @@ class pa {
7413
7415
  pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
7414
7416
  recoverAuthentication: (s, o, a) => this.recoverHttpAuthentication(s, o, a),
7415
7417
  executorConnection: () => this.socket instanceof Ae ? this.socket.connectionId : null,
7416
- restoreExecutor: (s) => this.socket instanceof Ae ? this.socket.restoreExecutor(s) : Promise.reject(new R("Browser is reconnecting.", "executor_not_ready")),
7418
+ restoreExecutor: (s) => this.socket instanceof Ae ? this.socket.restoreExecutor(s) : Promise.reject(new T("Browser is reconnecting.", "executor_not_ready")),
7417
7419
  auth: {
7418
7420
  protocol: 1,
7419
7421
  token: e.token ?? "",
@@ -7714,6 +7716,10 @@ class pa {
7714
7716
  },
7715
7717
  onCommand: (d) => $n("client_event", d.type, Yo({ ...d.payload, type: d.type })),
7716
7718
  onError: (d, h) => {
7719
+ if (this.options.productVariant === "customer_embedded" && h.operation === "conversation.snapshot" && d instanceof T && d.code === "conversation_access_denied") {
7720
+ h.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
7721
+ return;
7722
+ }
7717
7723
  qe("web-sdk.conversation", "Conversation operation failed", { ...h, ...An(d) }), this.handleDirectoryTransportError(d);
7718
7724
  }
7719
7725
  }),
@@ -7816,7 +7822,7 @@ class pa {
7816
7822
  }
7817
7823
  }
7818
7824
  handleDirectoryTransportError(e) {
7819
- if (!(e instanceof R) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && Ti(void 0, e.code).allowed) return;
7825
+ if (!(e instanceof T) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && Ti(void 0, e.code).allowed) return;
7820
7826
  const n = e.detail && typeof e.detail == "object" ? e.detail : {};
7821
7827
  this.handleServerEvent({
7822
7828
  ...n,
@@ -8033,7 +8039,7 @@ class pa {
8033
8039
  } catch (s) {
8034
8040
  if (n !== this.connectionAttemptId || this.state.status === "closed")
8035
8041
  return;
8036
- if (s instanceof R && (s.code === "unauthorized" || s.code === "update_required")) {
8042
+ if (s instanceof T && (s.code === "unauthorized" || s.code === "update_required")) {
8037
8043
  this.handleDirectoryTransportError(s);
8038
8044
  return;
8039
8045
  }
@@ -8051,7 +8057,7 @@ class pa {
8051
8057
  );
8052
8058
  return;
8053
8059
  }
8054
- throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(s, "token_provider")), this.stopAuthentication(new R(o.message, "connection_failed", !1), !0), this.emit("error", o), o) : (this.setState({
8060
+ throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(s, "token_provider")), this.stopAuthentication(new T(o.message, "connection_failed", !1), !0), this.emit("error", o), o) : (this.setState({
8055
8061
  status: "error",
8056
8062
  lastError: o.message,
8057
8063
  lastErrorCode: "connection_failed"
@@ -8744,7 +8750,7 @@ class pa {
8744
8750
  }
8745
8751
  reportHealthSignal(e, n = {}) {
8746
8752
  const i = this.getState();
8747
- if (n.httpRequest && (!On(n.httpRequest) || n.httpRequest.sessionId !== i.sessionId) || n.historyRefreshFailure && (n.historyRefreshFailure.consecutiveFailures < 3 || n.historyRefreshFailure.sessionId !== i.sessionId) || n.renderedError && n.renderedError.sessionId !== i.sessionId || n.uiInvariant && n.uiInvariant.current.sessionId !== i.sessionId) return;
8753
+ if (n.httpRequest && (!On(n.httpRequest) || n.httpRequest.sessionId !== null && n.httpRequest.sessionId !== i.sessionId) || n.historyRefreshFailure && (n.historyRefreshFailure.consecutiveFailures < 3 || n.historyRefreshFailure.sessionId !== i.sessionId) || n.renderedError && n.renderedError.sessionId !== i.sessionId || n.uiInvariant && n.uiInvariant.current.sessionId !== i.sessionId) return;
8748
8754
  const s = n.historyRefreshFailure?.episodeId ?? (n.renderedError ? `${n.errorFingerprint}:${n.renderedError.itemId}` : void 0) ?? n.errorFingerprint ?? n.clientMessageId ?? (n.previousPhase && n.nextPhase ? `${n.previousPhase}:${n.nextPhase}:${n.reason ?? "unknown"}` : null);
8749
8755
  if (s) {
8750
8756
  const m = `${e}:${s}:${e === "invalid_state_transition" ? n.reason ?? "unknown" : ""}`;
@@ -9123,7 +9129,7 @@ class pa {
9123
9129
  this.credentialRecovery || this.refreshCredentials(
9124
9130
  n,
9125
9131
  !0,
9126
- new R("", "unauthorized", !1, {
9132
+ new T("", "unauthorized", !1, {
9127
9133
  reason: e.reason,
9128
9134
  authTransport: e.authTransport,
9129
9135
  requestId: e.requestId,
@@ -9140,7 +9146,7 @@ class pa {
9140
9146
  return;
9141
9147
  }
9142
9148
  if (this.options.productVariant === "customer_embedded" && /^4[0-9]{2}$/.test(String(e.code)) && !["401", "408", "425", "429"].includes(String(e.code)) && e.retryable !== !0 && (e.stage === "executor_registration" || e.stage === "socket_admission" || e.stage === "bootstrap")) {
9143
- this.stopAuthentication(new R(
9149
+ this.stopAuthentication(new T(
9144
9150
  e.code === "403" ? "Chat access is not configured for this page. Contact your app administrator, then try again." : "Chat setup could not be completed. Contact your app administrator, then try again.",
9145
9151
  "connection_failed",
9146
9152
  !1,
@@ -9149,7 +9155,7 @@ class pa {
9149
9155
  return;
9150
9156
  }
9151
9157
  if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "update_required" || e.code === "executor_replaced")) {
9152
- this.stopAuthentication(new R(String(e.message), String(e.code), !1, { reason: e.reason, authTransport: "socket" }));
9158
+ this.stopAuthentication(new T(String(e.message), String(e.code), !1, { reason: e.reason, authTransport: "socket" }));
9153
9159
  return;
9154
9160
  }
9155
9161
  ["unauthorized", "update_required", "executor_replaced", "connection_failed"].includes(String(e.code)) && this.setState({ status: "error", lastError: String(e.message), lastErrorCode: String(e.code) });
@@ -9307,7 +9313,7 @@ class pa {
9307
9313
  stage: this.lastRecoveryStage,
9308
9314
  recoveryOutcome: "exhausted",
9309
9315
  failureKind: "temporary"
9310
- }), this.stopAuthentication(new R(
9316
+ }), this.stopAuthentication(new T(
9311
9317
  "Chat could not reconnect. Your conversation and draft are saved here. Try again.",
9312
9318
  "connection_failed",
9313
9319
  !1
@@ -9318,7 +9324,7 @@ class pa {
9318
9324
  this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
9319
9325
  }
9320
9326
  connectionFailureDiagnostic(e, n) {
9321
- const i = e instanceof Ze ? e.status : e instanceof R && e.code === "unauthorized" ? 401 : e instanceof R && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, s = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof R && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && er(e) && s !== 401 && s !== 403;
9327
+ const i = e instanceof Ze ? e.status : e instanceof T && e.code === "unauthorized" ? 401 : e instanceof T && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, s = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof T && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && er(e) && s !== 401 && s !== 403;
9322
9328
  return {
9323
9329
  stage: n,
9324
9330
  ...s !== void 0 ? { httpStatus: s } : {},
@@ -9387,7 +9393,7 @@ class pa {
9387
9393
  ...this.authenticationDiagnostic(e),
9388
9394
  failureKind: "permanent",
9389
9395
  recoveryOutcome: "refused"
9390
- }), e.code === "unauthorized" && (e = new R("Your chat session could not be refreshed. Reload the page to reconnect.", e.code, !1, e.detail)), this.authenticationFailure = e, this.credentialRecovery = null, this.clearEmbeddedRecoveryBudget(), this.rejectedTransportToken = ["unauthorized", "update_required"].includes(e.code) ? this.token : null, this.refreshingDefaultCredentials = !1, this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.clearSocketPhaseTimers(), this.stopHeartbeat();
9396
+ }), e.code === "unauthorized" && (e = new T("Your chat session could not be refreshed. Reload the page to reconnect.", e.code, !1, e.detail)), this.authenticationFailure = e, this.credentialRecovery = null, this.clearEmbeddedRecoveryBudget(), this.rejectedTransportToken = ["unauthorized", "update_required"].includes(e.code) ? this.token : null, this.refreshingDefaultCredentials = !1, this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.clearSocketPhaseTimers(), this.stopHeartbeat();
9391
9397
  const i = this.socket;
9392
9398
  this.socket = null, this.setState({ status: "error", lastError: e.message, lastErrorCode: e.code }), i?.close(), this.directoryObservation?.reconcile(), this.conversationObservation?.wake();
9393
9399
  }
@@ -9411,7 +9417,7 @@ class pa {
9411
9417
  refreshCredentials(e, n = !1, i) {
9412
9418
  if (this.credentialRecovery) return this.credentialRecovery;
9413
9419
  this.credentialRecoveryFailure = null;
9414
- const s = this.token, o = this.authenticationDiagnostic(i ?? new R(
9420
+ const s = this.token, o = this.authenticationDiagnostic(i ?? new T(
9415
9421
  "",
9416
9422
  "unauthorized",
9417
9423
  !1,
@@ -9423,14 +9429,14 @@ class pa {
9423
9429
  const r = (async () => {
9424
9430
  const c = await this.acquireToken("connect", { forceRefresh: !0 });
9425
9431
  if (this.socket !== e || this.state.status === "closed" || this.clientRuntime.isDisposed)
9426
- throw new R("Conversation authority was retired.", "authority_retired", !0);
9432
+ throw new T("Conversation authority was retired.", "authority_retired", !0);
9427
9433
  if (!c) throw new Ze("Pluno token provider did not return a token", !1);
9428
- if (n && c === s) throw new R("Credential did not change.", "unauthorized", !1);
9434
+ if (n && c === s) throw new T("Credential did not change.", "unauthorized", !1);
9429
9435
  this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", o);
9430
9436
  })().catch((c) => {
9431
9437
  if (this.socket !== e || this.state.status === "closed") throw c;
9432
- if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Si(c), c instanceof R && ["unauthorized", "403", "update_required"].includes(c.code) || !er(c)) {
9433
- const l = c instanceof R ? c : new R(c instanceof Ze ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
9438
+ if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Si(c), c instanceof T && ["unauthorized", "403", "update_required"].includes(c.code) || !er(c)) {
9439
+ const l = c instanceof T ? c : new T(c instanceof Ze ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
9434
9440
  throw this.stopAuthentication(l), l;
9435
9441
  }
9436
9442
  throw this.options.productVariant === "customer_embedded" && this.setState({ status: "reconnecting", lastError: sl, lastErrorCode: "connection_failed" }), this.scheduleReconnect(), c;
@@ -10062,59 +10068,59 @@ function pm(t, e) {
10062
10068
  const E = v.getAttribute("data-testid") || v.getAttribute("data-test") || v.getAttribute("data-qa") || v.getAttribute("data-cy") || "";
10063
10069
  return `${v.tagName.toLowerCase()}|${m(v)}|${E}`;
10064
10070
  }, w = (v, E, L) => {
10065
- const K = (U, ge) => {
10066
- const G = U.tagName.toLowerCase(), q = window.getComputedStyle(U), D = p.has(U);
10067
- if (g >= 1e3 && !D || L.has(U) || o.has(G) || U.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || q.display === "none" || q.visibility === "hidden")
10071
+ const K = (U, he) => {
10072
+ const G = U.tagName.toLowerCase(), oe = window.getComputedStyle(U), R = p.has(U);
10073
+ if (g >= 1e3 && !R || L.has(U) || o.has(G) || U.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || oe.display === "none" || oe.visibility === "hidden")
10068
10074
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
10069
10075
  g += 1;
10070
- const F = m(U), J = Fd(U), S = r.has(F) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(G) || G === "a" && U.hasAttribute("href"), V = Array.from(U.children).filter((W) => W instanceof HTMLElement), te = /* @__PURE__ */ new Map();
10071
- for (const W of V) {
10072
- const M = f(W);
10073
- te.set(M, (te.get(M) ?? 0) + 1);
10076
+ const V = m(U), O = Fd(U), S = r.has(V) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(G) || G === "a" && U.hasAttribute("href"), F = Array.from(U.children).filter((W) => W instanceof HTMLElement), ee = /* @__PURE__ */ new Map();
10077
+ for (const W of F) {
10078
+ const q = f(W);
10079
+ ee.set(q, (ee.get(q) ?? 0) + 1);
10074
10080
  }
10075
- const ce = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
10076
- for (const W of V) {
10077
- const M = f(W), le = ne.get(M) ?? 0;
10078
- ne.set(M, le + 1), (te.get(M) ?? 0) > 8 && le >= 6 && !p.has(W) && ce.set(M, (ce.get(M) ?? 0) + 1);
10081
+ const ce = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
10082
+ for (const W of F) {
10083
+ const q = f(W), le = te.get(q) ?? 0;
10084
+ te.set(q, le + 1), (ee.get(q) ?? 0) > 8 && le >= 6 && !p.has(W) && ce.set(q, (ce.get(q) ?? 0) + 1);
10079
10085
  }
10080
- const Se = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Set(), fe = [], Oe = [];
10081
- for (const W of V) {
10082
- const M = f(W), le = te.get(M) ?? 0, me = Se.get(M) ?? 0;
10083
- if (Se.set(M, me + 1), le > 8 && me >= 6 && !p.has(W)) {
10084
- T.has(M) || (fe.push([`… ${ce.get(M) ?? 0} similar siblings omitted`]), T.add(M));
10086
+ const Se = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Set(), fe = [], Oe = [];
10087
+ for (const W of F) {
10088
+ const q = f(W), le = ee.get(q) ?? 0, me = Se.get(q) ?? 0;
10089
+ if (Se.set(q, me + 1), le > 8 && me >= 6 && !p.has(W)) {
10090
+ P.has(q) || (fe.push([`… ${ce.get(q) ?? 0} similar siblings omitted`]), P.add(q));
10085
10091
  continue;
10086
10092
  }
10087
- const ke = K(W, ge);
10093
+ const ke = K(W, he);
10088
10094
  Oe.push(ke), fe.push(ke.lines);
10089
10095
  }
10090
10096
  const et = [];
10091
10097
  if (U.shadowRoot)
10092
10098
  for (const W of Array.from(U.shadowRoot.children))
10093
- W instanceof HTMLElement && et.push(K(W, ge + 1));
10094
- const Ce = [...Oe, ...et], $e = J.length > 0 || S || Ce.some((W) => W.hasUsefulContent), Y = Yn(
10095
- [J, ...Ce.map((W) => W.textPreview)].filter(Boolean).join(" ")
10096
- ).slice(0, 180), tt = U.hasAttribute("contenteditable") && (J.length > 0 || !U.querySelector("[contenteditable]")), z = l.some((W) => U.hasAttribute(W)) || !!F || tt, X = (U.getClientRects().length > 0 || q.display === "contents") && (n.has(G) || z || D) && ($e || D) && (!s.has(G) || $e || z || D), H = X ? 1 : 0, se = [];
10097
- if (X) {
10098
- const W = Ce.some((le) => le.containsTextElement), M = i.has(G) && !W ? Y : J;
10099
- se.push($d(U, c, a, M.slice(0, 180)));
10099
+ W instanceof HTMLElement && et.push(K(W, he + 1));
10100
+ const Ce = [...Oe, ...et], $e = O.length > 0 || S || Ce.some((W) => W.hasUsefulContent), J = Yn(
10101
+ [O, ...Ce.map((W) => W.textPreview)].filter(Boolean).join(" ")
10102
+ ).slice(0, 180), tt = U.hasAttribute("contenteditable") && (O.length > 0 || !U.querySelector("[contenteditable]")), z = l.some((W) => U.hasAttribute(W)) || !!V || tt, Y = (U.getClientRects().length > 0 || oe.display === "contents") && (n.has(G) || z || R) && ($e || R) && (!s.has(G) || $e || z || R), H = Y ? 1 : 0, ie = [];
10103
+ if (Y) {
10104
+ const W = Ce.some((le) => le.containsTextElement), q = i.has(G) && !W ? J : O;
10105
+ ie.push($d(U, c, a, q.slice(0, 180)));
10100
10106
  }
10101
10107
  for (const W of fe)
10102
- se.push(...us(W, H));
10108
+ ie.push(...us(W, H));
10103
10109
  const ve = et.flatMap((W) => W.lines);
10104
10110
  if (ve.length > 0) {
10105
10111
  const W = ve.slice(0, 20);
10106
10112
  ve.length > W.length && W.push("… shadow DOM omitted");
10107
- const M = G.includes("tooltip") || G.includes("popper") || G.includes("loader");
10108
- if (ge < 2 && !M) {
10109
- const le = X ? "#shadow-root" : `${G} #shadow-root`;
10110
- se.push(...us([le, ...us(W, 1)], H));
10113
+ const q = G.includes("tooltip") || G.includes("popper") || G.includes("loader");
10114
+ if (he < 2 && !q) {
10115
+ const le = Y ? "#shadow-root" : `${G} #shadow-root`;
10116
+ ie.push(...us([le, ...us(W, 1)], H));
10111
10117
  } else
10112
- se.push(...us(W, H));
10118
+ ie.push(...us(W, H));
10113
10119
  }
10114
10120
  return {
10115
- lines: se,
10121
+ lines: ie,
10116
10122
  hasUsefulContent: $e,
10117
- textPreview: Y,
10123
+ textPreview: J,
10118
10124
  containsTextElement: i.has(G) || Ce.some((W) => W.containsTextElement)
10119
10125
  };
10120
10126
  };
@@ -11271,64 +11277,64 @@ function Ty(t, e, n, i) {
11271
11277
  const b = e.ownerDocument.defaultView;
11272
11278
  let _, v = /* @__PURE__ */ new Map(), E = d.sessionId;
11273
11279
  const L = /* @__PURE__ */ new Set(), K = /* @__PURE__ */ new Map();
11274
- let U = null, ge = null, G = null, q = 0, D = null, F = null, J = null;
11280
+ let U = null, he = null, G = null, oe = 0, R = null, V = null, O = null;
11275
11281
  const S = () => JSON.stringify([
11276
11282
  d.sessionId,
11277
11283
  d.assistantDraftRespondsToUserMessageId,
11278
11284
  Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.messageKey,
11279
11285
  Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.entryKey
11280
- ]), V = (z) => {
11281
- const X = b.getComputedStyle(z);
11282
- return z.getClientRects().length > 0 && X.visibility !== "hidden" && X.opacity !== "0" && X.pointerEvents !== "none" && !z.matches(":disabled") && z.getAttribute("aria-disabled") !== "true" && !z.closest("[inert]");
11286
+ ]), F = (z) => {
11287
+ const Y = b.getComputedStyle(z);
11288
+ return z.getClientRects().length > 0 && Y.visibility !== "hidden" && Y.opacity !== "0" && Y.pointerEvents !== "none" && !z.matches(":disabled") && z.getAttribute("aria-disabled") !== "true" && !z.closest("[inert]");
11283
11289
  };
11284
- function te() {
11285
- ge !== null && b.clearTimeout(ge), ge = null, G = null;
11290
+ function ee() {
11291
+ he !== null && b.clearTimeout(he), he = null, G = null;
11286
11292
  }
11287
11293
  function ce(z = !1) {
11288
- te(), F = null, J !== null && b.clearTimeout(J), J = null, _ = void 0, v.clear(), K.clear(), U !== null && b.clearTimeout(U), U = null, z && L.clear();
11294
+ ee(), V = null, O !== null && b.clearTimeout(O), O = null, _ = void 0, v.clear(), K.clear(), U !== null && b.clearTimeout(U), U = null, z && L.clear();
11289
11295
  }
11290
- function ne() {
11291
- const z = e.querySelector(".pluno-pa-widget__panel") ?? e, X = b.getComputedStyle(z);
11292
- if (d.isLoadingSession || e.ownerDocument.hidden || !z.getClientRects().length || X.visibility === "hidden" || X.display === "none" || X.opacity === "0") {
11296
+ function te() {
11297
+ const z = e.querySelector(".pluno-pa-widget__panel") ?? e, Y = b.getComputedStyle(z);
11298
+ if (d.isLoadingSession || e.ownerDocument.hidden || !z.getClientRects().length || Y.visibility === "hidden" || Y.display === "none" || Y.opacity === "0") {
11293
11299
  ce();
11294
11300
  return;
11295
11301
  }
11296
- const H = (P, Z) => Array.from(e.querySelectorAll(P)).flatMap((de) => de.getAttribute(Z) ? [de.getAttribute(Z)] : []), se = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]", ve = [];
11297
- for (const P of Array.from(e.querySelectorAll(`${se}, [data-message-role="user"]`))) {
11298
- const Z = b.getComputedStyle(P);
11299
- !P.getClientRects().length || Z.visibility === "hidden" || Z.opacity === "0" || P.parentElement?.closest(se) || ve.push(P.dataset.messageRole === "user" ? "user" : "thinking");
11302
+ const H = (M, Q) => Array.from(e.querySelectorAll(M)).flatMap((de) => de.getAttribute(Q) ? [de.getAttribute(Q)] : []), ie = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]", ve = [];
11303
+ for (const M of Array.from(e.querySelectorAll(`${ie}, [data-message-role="user"]`))) {
11304
+ const Q = b.getComputedStyle(M);
11305
+ !M.getClientRects().length || Q.visibility === "hidden" || Q.opacity === "0" || M.parentElement?.closest(ie) || ve.push(M.dataset.messageRole === "user" ? "user" : "thinking");
11300
11306
  }
11301
11307
  let W = 0;
11302
11308
  if (ve.includes("thinking")) {
11303
- const P = Array.from(e.querySelectorAll('[data-message-role="user"]')), Z = P[P.length - 1], de = Z?.dataset.messageKey ?? Z?.dataset.entryKey ?? null;
11304
- de !== D && L.delete("thinking-without-progress"), D = de;
11309
+ const M = Array.from(e.querySelectorAll('[data-message-role="user"]')), Q = M[M.length - 1], de = Q?.dataset.messageKey ?? Q?.dataset.entryKey ?? null;
11310
+ de !== R && L.delete("thinking-without-progress"), R = de;
11305
11311
  let C = 2166136261;
11306
11312
  for (const N of Array.from(e.querySelectorAll(
11307
11313
  "[data-message-key], [data-entry-key][data-message-role], [data-tool-call-key], [data-event-type]"
11308
11314
  ))) {
11309
11315
  if (!N.getClientRects().length) continue;
11310
11316
  const ye = N.hasAttribute("data-loading-text") || !!N.querySelector("[data-loading-text]"), Le = `${N.dataset.messageKey ?? N.dataset.entryKey ?? N.dataset.toolCallKey ?? ""}:${ye}:${N.textContent ?? ""}`;
11311
- for (let Q = 0; Q < Le.length; Q += 1)
11312
- C = Math.imul(C ^ Le.charCodeAt(Q), 16777619) >>> 0;
11317
+ for (let X = 0; X < Le.length; X += 1)
11318
+ C = Math.imul(C ^ Le.charCodeAt(X), 16777619) >>> 0;
11313
11319
  }
11314
11320
  const k = b.performance.now();
11315
- C !== G && (G = C, q = k), W = k - q, ge !== null && b.clearTimeout(ge), ge = W < 3e5 ? b.setTimeout(ne, 3e5 - W) : null;
11321
+ C !== G && (G = C, oe = k), W = k - oe, he !== null && b.clearTimeout(he), he = W < 3e5 ? b.setTimeout(te, 3e5 - W) : null;
11316
11322
  } else
11317
- te(), L.delete("thinking-without-progress");
11318
- const M = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((P) => P.getClientRects().length > 0 && b.getComputedStyle(P).visibility !== "hidden" && b.getComputedStyle(P).opacity !== "0"), le = d.isThinking || d.turnPhase != null || d.pendingMessageStatus != null || M;
11319
- (!le || F && F.responseKey !== S()) && (F = null);
11323
+ ee(), L.delete("thinking-without-progress");
11324
+ const q = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((M) => M.getClientRects().length > 0 && b.getComputedStyle(M).visibility !== "hidden" && b.getComputedStyle(M).opacity !== "0"), le = d.isThinking || d.turnPhase != null || d.pendingMessageStatus != null || q;
11325
+ (!le || V && V.responseKey !== S()) && (V = null);
11320
11326
  const me = {
11321
11327
  executionKey: d.activity?.executionKey,
11322
11328
  inProgress: le,
11323
- hasComposerText: Array.from(e.querySelectorAll(".pluno-pa-widget__input, .composer textarea")).some((P) => !!P.value.trim()),
11329
+ hasComposerText: Array.from(e.querySelectorAll(".pluno-pa-widget__input, .composer textarea")).some((M) => !!M.value.trim()),
11324
11330
  hasComposerAttachment: !!e.querySelector(".pluno-pa-widget__attachments .pluno-pa-widget__attachment, .composer-attachments .composer-attachment"),
11325
11331
  enabledStopControlCount: Array.from(e.querySelectorAll(
11326
11332
  'button[aria-label="Stop"], button[aria-label="Stop generating"]'
11327
- )).filter(V).length,
11328
- stopPendingMs: F ? b.performance.now() - F.at : 0,
11333
+ )).filter(F).length,
11334
+ stopPendingMs: V ? b.performance.now() - V.at : 0,
11329
11335
  thinkingSequence: ve,
11330
11336
  thinkingIdleMs: W,
11331
- messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((P) => P.dataset.messageKey ?? P.dataset.entryKey ?? []),
11337
+ messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((M) => M.dataset.messageKey ?? M.dataset.entryKey ?? []),
11332
11338
  canonicalItemKeys: H("[data-canonical-item-key]", "data-canonical-item-key"),
11333
11339
  toolCallKeys: H("[data-tool-call-key]", "data-tool-call-key"),
11334
11340
  attachmentKeys: H("[data-attachment-key]", "data-attachment-key"),
@@ -11338,33 +11344,33 @@ function Ty(t, e, n, i) {
11338
11344
  visibleSessionIds: H("[data-session-id]", "data-session-id"),
11339
11345
  welcome: !!e.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
11340
11346
  runtimeItemCount: d.messages.filter(
11341
- (P) => (P.role === "user" || P.role === "assistant") && P.phase !== "commentary" && !P.scheduledCheckInAt && !P.id.startsWith("local-") && !P.id.startsWith("optimistic-user-message:")
11347
+ (M) => (M.role === "user" || M.role === "assistant") && M.phase !== "commentary" && !M.scheduledCheckInAt && !M.id.startsWith("local-") && !M.id.startsWith("optimistic-user-message:")
11342
11348
  ).length
11343
11349
  }, ke = _ ? {
11344
11350
  ..._,
11345
- terminalResponseKeys: _.terminalResponseKeys.filter((P) => {
11346
- const Z = v.get(P), de = Z ? d.removedItems?.[Z] : void 0;
11347
- return !de || me.canonicalItemKeys.includes(Z) || !me.canonicalItemKeys.includes(de);
11351
+ terminalResponseKeys: _.terminalResponseKeys.filter((M) => {
11352
+ const Q = v.get(M), de = Q ? d.removedItems?.[Q] : void 0;
11353
+ return !de || me.canonicalItemKeys.includes(Q) || !me.canonicalItemKeys.includes(de);
11348
11354
  })
11349
- } : void 0, Fe = gf(me, ke), ht = new Set(Fe.map((P) => P.code));
11350
- for (const P of K.keys()) ht.has(P) || K.delete(P);
11355
+ } : void 0, Fe = gf(me, ke), ht = new Set(Fe.map((M) => M.code));
11356
+ for (const M of K.keys()) ht.has(M) || K.delete(M);
11351
11357
  const je = b.performance.now();
11352
- for (const { code: P } of Fe) {
11353
- if (L.has(P)) continue;
11354
- const Z = K.get(P) ?? je;
11355
- je - Z >= 250 ? (L.add(P), K.delete(P), i.reportInvalidStateTransition?.(`ui_invariant:${P}`, void 0, dp(me, _))) : K.set(P, Z);
11358
+ for (const { code: M } of Fe) {
11359
+ if (L.has(M)) continue;
11360
+ const Q = K.get(M) ?? je;
11361
+ je - Q >= 250 ? (L.add(M), K.delete(M), i.reportInvalidStateTransition?.(`ui_invariant:${M}`, void 0, dp(me, _))) : K.set(M, Q);
11356
11362
  }
11357
- Fe.length === 0 && (_ = me, v = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((P) => [P.dataset.terminalResponseKey, P.dataset.canonicalItemKey]))), U !== null && b.clearTimeout(U), U = K.size ? b.setTimeout(() => {
11358
- U = null, ne();
11363
+ Fe.length === 0 && (_ = me, v = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((M) => [M.dataset.terminalResponseKey, M.dataset.canonicalItemKey]))), U !== null && b.clearTimeout(U), U = K.size ? b.setTimeout(() => {
11364
+ U = null, te();
11359
11365
  }, Math.max(1, 250 - (je - Math.min(...K.values())))) : null;
11360
11366
  }
11361
- function Se(z, X = null) {
11362
- const H = z !== "runtime", se = H ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, ve = se?.length ?? d.messages.length, W = [];
11363
- for (let P = Math.max(0, ve - Il); P < ve; P += 1) {
11364
- const Z = se ? se[P].dataset.messageKey ?? se[P].dataset.entryKey : d.messages[P].id;
11365
- Z && W.push(Z.slice(0, ar));
11367
+ function Se(z, Y = null) {
11368
+ const H = z !== "runtime", ie = H ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, ve = ie?.length ?? d.messages.length, W = [];
11369
+ for (let M = Math.max(0, ve - Il); M < ve; M += 1) {
11370
+ const Q = ie ? ie[M].dataset.messageKey ?? ie[M].dataset.entryKey : d.messages[M].id;
11371
+ Q && W.push(Q.slice(0, ar));
11366
11372
  }
11367
- const M = {
11373
+ const q = {
11368
11374
  session_id: d.sessionId?.slice(0, ar) ?? null,
11369
11375
  run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, ar) ?? null,
11370
11376
  item_keys: W,
@@ -11376,45 +11382,45 @@ function Ty(t, e, n, i) {
11376
11382
  error: !!d.lastError,
11377
11383
  connected: d.status === "connected",
11378
11384
  visible: e.getClientRects().length > 0,
11379
- output_length: H ? Array.from(se ?? []).reduce((P, Z) => P + (Z.textContent?.length ?? 0), 0) : d.messages.reduce((P, Z) => P + Z.content.length, d.assistantDraft.length),
11385
+ output_length: H ? Array.from(ie ?? []).reduce((M, Q) => M + (Q.textContent?.length ?? 0), 0) : d.messages.reduce((M, Q) => M + Q.content.length, d.assistantDraft.length),
11380
11386
  active_count: H ? e.querySelectorAll(".pluno-pa-widget__tool-group--active, .tool-group--active").length : Number(d.isThinking),
11381
11387
  terminal_count: H ? e.querySelectorAll("[data-terminal-response-key]").length : 0
11382
11388
  };
11383
11389
  if (z === "paint" && i.reportResponseVisibility) {
11384
- const P = e.querySelector(".pluno-pa-widget__panel") ?? e, Z = (B) => {
11385
- const ee = b.getComputedStyle(B);
11386
- return B.getClientRects().length > 0 && ee.visibility !== "hidden" && ee.display !== "none" && ee.opacity !== "0";
11387
- }, de = Z(P) && Z(e), C = !e.ownerDocument.hidden, k = new Set(Array.from(e.querySelectorAll("[data-canonical-item-key]")).filter(Z).map((B) => B.dataset.canonicalItemKey)), N = de && C && !d.isLoadingSession ? [...d.messages].reverse().find((B) => (B.role === "assistant" || B.dataType === "commentary_history" || B.dataType === "tool_summary") && k.has(B.id)) : void 0, ye = de && C && !d.isLoadingSession && !!d.assistantDraft.trim() && Array.from(e.querySelectorAll("[data-message-key], [data-entry-key]")).some((B) => Z(B) && (B.dataset.messageKey === `assistant:${d.assistantDraftItemId}` || B.dataset.entryKey === d.assistantDraftItemId)), Le = {
11390
+ const M = e.querySelector(".pluno-pa-widget__panel") ?? e, Q = (B) => {
11391
+ const Z = b.getComputedStyle(B);
11392
+ return B.getClientRects().length > 0 && Z.visibility !== "hidden" && Z.display !== "none" && Z.opacity !== "0";
11393
+ }, de = Q(M) && Q(e), C = !e.ownerDocument.hidden, k = new Set(Array.from(e.querySelectorAll("[data-canonical-item-key]")).filter(Q).map((B) => B.dataset.canonicalItemKey)), N = de && C && !d.isLoadingSession ? [...d.messages].reverse().find((B) => (B.role === "assistant" || B.dataType === "commentary_history" || B.dataType === "tool_summary") && k.has(B.id)) : void 0, ye = de && C && !d.isLoadingSession && !!d.assistantDraft.trim() && Array.from(e.querySelectorAll("[data-message-key], [data-entry-key]")).some((B) => Q(B) && (B.dataset.messageKey === `assistant:${d.assistantDraftItemId}` || B.dataset.entryKey === d.assistantDraftItemId)), Le = {
11388
11394
  sessionId: d.sessionId,
11389
11395
  responseItemId: ye ? d.assistantDraftItemId : N?.id ?? null,
11390
11396
  respondsToUserMessageId: ye ? d.assistantDraftRespondsToUserMessageId : N?.respondsToUserMessageId ?? null,
11391
11397
  panelVisible: de,
11392
11398
  documentVisible: C,
11393
11399
  loading: d.isLoadingSession
11394
- }, Q = JSON.stringify(Le);
11395
- Q !== w && (w = Q, i.reportResponseVisibility({ ...Le, observedAt: (/* @__PURE__ */ new Date()).toISOString() }));
11400
+ }, X = JSON.stringify(Le);
11401
+ X !== w && (w = X, i.reportResponseVisibility({ ...Le, observedAt: (/* @__PURE__ */ new Date()).toISOString() }));
11396
11402
  }
11397
- const le = [...d.messages].reverse().find((P) => P.role === "user" && (!d.activeResponseUserMessageId || P.id === d.activeResponseUserMessageId)), me = d.activity?.phase === "submitting" || d.turnPhase === "sending" || d.pendingMessageStatus === "sending", ke = d.activity?.phase === "stopping";
11403
+ const le = [...d.messages].reverse().find((M) => M.role === "user" && (!d.activeResponseUserMessageId || M.id === d.activeResponseUserMessageId)), me = d.activity?.phase === "submitting" || d.turnPhase === "sending" || d.pendingMessageStatus === "sending", ke = d.activity?.phase === "stopping";
11398
11404
  if (le && i.reportOperationTiming) {
11399
- const P = ke || d.activity?.phase === "stopped" ? "stop" : "send", Z = `${P}:${le.id}`;
11400
- (me || ke) && !s.has(Z) && (s.set(Z, { timer: Rt((k) => i.reportOperationTiming?.(k), {
11401
- operation: P,
11405
+ const M = ke || d.activity?.phase === "stopped" ? "stop" : "send", Q = `${M}:${le.id}`;
11406
+ (me || ke) && !s.has(Q) && (s.set(Q, { timer: Rt((k) => i.reportOperationTiming?.(k), {
11407
+ operation: M,
11402
11408
  layer: "renderer",
11403
11409
  entrySurface: n,
11404
11410
  requestId: crypto.randomUUID(),
11405
11411
  clientMessageId: le.id,
11406
11412
  sessionId: d.sessionId
11407
11413
  }), seen: /* @__PURE__ */ new Set() }), s.size > 20 && s.delete(s.keys().next().value));
11408
- const de = s.get(Z), C = (k) => {
11414
+ const de = s.get(Q), C = (k) => {
11409
11415
  !de || de.seen.has(k) || (de.seen.add(k), de.timer.mark(k));
11410
11416
  };
11411
- if (z === "runtime" && C(ke ? "runtime_stopping" : d.activity?.phase === "stopped" ? "runtime_stopped" : me ? "runtime_reading" : "runtime_progress"), z === "paint" && !e.ownerDocument.hidden && M.visible && !M.loading && Array.from(e.querySelectorAll('[data-message-role="user"]')).some((N) => (N.dataset.canonicalItemKey === le.id || N.dataset.entryKey === le.id || N.dataset.messageKey === `user:${le.id}`) && N.getClientRects().length > 0)) {
11417
+ if (z === "runtime" && C(ke ? "runtime_stopping" : d.activity?.phase === "stopped" ? "runtime_stopped" : me ? "runtime_reading" : "runtime_progress"), z === "paint" && !e.ownerDocument.hidden && q.visible && !q.loading && Array.from(e.querySelectorAll('[data-message-role="user"]')).some((N) => (N.dataset.canonicalItemKey === le.id || N.dataset.entryKey === le.id || N.dataset.messageKey === `user:${le.id}`) && N.getClientRects().length > 0)) {
11412
11418
  C("message_painted");
11413
11419
  const N = e.textContent ?? "";
11414
11420
  ke && N.includes("Stopping") ? C("stopping_painted") : d.activity?.phase === "stopped" && N.includes("Stopped") ? C("stopped_painted") : me && N.includes("Reading your message") ? C("reading_painted") : !me && !ke && d.activity?.phase !== "stopped" && !N.includes("Reading your message") && C("progress_painted");
11415
11421
  }
11416
11422
  }
11417
- const Fe = JSON.stringify(M);
11423
+ const Fe = JSON.stringify(q);
11418
11424
  if (z === "runtime" && Fe === m || z === "paint" && Fe === f) return;
11419
11425
  z === "runtime" && (m = Fe), z === "paint" && (f = Fe);
11420
11426
  const ht = {
@@ -11422,20 +11428,20 @@ function Ty(t, e, n, i) {
11422
11428
  occurred_at: (/* @__PURE__ */ new Date()).toISOString(),
11423
11429
  monotonic_ms: Math.round(b.performance.now()),
11424
11430
  kind: z,
11425
- action: X,
11426
- ...M
11431
+ action: Y,
11432
+ ...q
11427
11433
  }, je = new TextEncoder().encode(JSON.stringify(ht)).length;
11428
11434
  for (o.push(ht), a.push(je), r += je; o.length > Ay || r > Ry; )
11429
11435
  o.shift(), r -= a.shift(), c += 1;
11430
11436
  }
11431
- function T() {
11437
+ function P() {
11432
11438
  g === null && (g = b.requestAnimationFrame(() => {
11433
- g = null, Se("paint"), ne();
11439
+ g = null, Se("paint"), te();
11434
11440
  }));
11435
11441
  }
11436
11442
  const fe = i.on("state", (z) => {
11437
- z.user?.id !== h || z.sessionId !== E ? (ce(!0), E = z.sessionId) : z.isLoadingSession && ce(), z.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, l = 0, p = crypto.randomUUID(), m = "", f = "", w = "", h = z.user?.id), d = z, e.dataset.executionKey = d.activity?.executionKey ?? "", Se("runtime"), T();
11438
- }), Oe = new MutationObserver(T);
11443
+ z.user?.id !== h || z.sessionId !== E ? (ce(!0), E = z.sessionId) : z.isLoadingSession && ce(), z.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, l = 0, p = crypto.randomUUID(), m = "", f = "", w = "", h = z.user?.id), d = z, e.dataset.executionKey = d.activity?.executionKey ?? "", Se("runtime"), P();
11444
+ }), Oe = new MutationObserver(P);
11439
11445
  Oe.observe(e, {
11440
11446
  subtree: !0,
11441
11447
  childList: !0,
@@ -11444,14 +11450,14 @@ function Ty(t, e, n, i) {
11444
11450
  attributeFilter: ["disabled", "aria-disabled", "aria-label", "inert", "class", "style", "hidden", "data-loading-text", "data-message-key", "data-entry-key", "data-terminal-response-key", "data-active-response-key", "data-canonical-item-key", "data-tool-call-key", "data-attachment-key", "data-session-id", "data-response-group-key"]
11445
11451
  });
11446
11452
  const et = (z) => {
11447
- const X = z.target?.closest?.("button"), H = X?.getAttribute("aria-label") ?? X?.getAttribute("title"), se = H === "New chat" ? "new_chat" : H === "Send" || H === "Send message" ? "send" : H === "Stop" || H === "Stop generating" ? "stop" : H === "Retry" || H === "Retry message" ? "retry" : null;
11448
- Se("click", se), se === "stop" && X && V(X) && (F = { at: b.performance.now(), responseKey: S() }, J !== null && b.clearTimeout(J), J = b.setTimeout(ne, 1e3)), se === "new_chat" && ce(!0);
11453
+ const Y = z.target?.closest?.("button"), H = Y?.getAttribute("aria-label") ?? Y?.getAttribute("title"), ie = H === "New chat" ? "new_chat" : H === "Send" || H === "Send message" ? "send" : H === "Stop" || H === "Stop generating" ? "stop" : H === "Retry" || H === "Retry message" ? "retry" : null;
11454
+ Se("click", ie), ie === "stop" && Y && F(Y) && (V = { at: b.performance.now(), responseKey: S() }, O !== null && b.clearTimeout(O), O = b.setTimeout(te, 1e3)), ie === "new_chat" && ce(!0);
11449
11455
  }, Ce = () => Se("submit"), $e = () => Se("focus");
11450
- e.addEventListener("click", et, !0), e.addEventListener("submit", Ce, !0), e.addEventListener("focusin", $e, !0), e.addEventListener("input", T, !0);
11451
- const Y = () => {
11452
- Se("paint"), T();
11456
+ e.addEventListener("click", et, !0), e.addEventListener("submit", Ce, !0), e.addEventListener("focusin", $e, !0), e.addEventListener("input", P, !0);
11457
+ const J = () => {
11458
+ Se("paint"), P();
11453
11459
  };
11454
- e.ownerDocument.addEventListener("visibilitychange", Y);
11460
+ e.ownerDocument.addEventListener("visibilitychange", J);
11455
11461
  const tt = {
11456
11462
  snapshot: () => ({
11457
11463
  schema_version: 1,
@@ -11462,10 +11468,10 @@ function Ty(t, e, n, i) {
11462
11468
  records: o.map((z) => ({ ...z, item_keys: [...z.item_keys] }))
11463
11469
  }),
11464
11470
  dispose: () => {
11465
- fe(), Oe.disconnect(), ce(!0), g !== null && b.cancelAnimationFrame(g), e.removeEventListener("click", et, !0), e.removeEventListener("submit", Ce, !0), e.removeEventListener("focusin", $e, !0), e.removeEventListener("input", T, !0), e.ownerDocument.removeEventListener("visibilitychange", Y), t.__plunoUiFlightRecorder === tt && delete t.__plunoUiFlightRecorder;
11471
+ fe(), Oe.disconnect(), ce(!0), g !== null && b.cancelAnimationFrame(g), e.removeEventListener("click", et, !0), e.removeEventListener("submit", Ce, !0), e.removeEventListener("focusin", $e, !0), e.removeEventListener("input", P, !0), e.ownerDocument.removeEventListener("visibilitychange", J), t.__plunoUiFlightRecorder === tt && delete t.__plunoUiFlightRecorder;
11466
11472
  }
11467
11473
  };
11468
- return t.__plunoUiFlightRecorder = tt, Se("runtime"), T(), tt;
11474
+ return t.__plunoUiFlightRecorder = tt, Se("runtime"), P(), tt;
11469
11475
  }
11470
11476
  const Py = 6e4, My = [100, 500, 1500, 4e3];
11471
11477
  let qy = 0;
@@ -11655,27 +11661,27 @@ async function lw(t = {}) {
11655
11661
  ".pluno-pa-widget__status--launcher"
11656
11662
  ), K = r.querySelector(
11657
11663
  ".pluno-pa-widget__launcher-minimize"
11658
- ), U = r.querySelector(".pluno-pa-widget__panel"), ge = r.querySelector(
11664
+ ), U = r.querySelector(".pluno-pa-widget__panel"), he = r.querySelector(
11659
11665
  ".pluno-pa-widget__panel-drag-handle"
11660
11666
  ), G = r.querySelector(
11661
11667
  ".pluno-pa-widget__scribble-spirals--panel"
11662
- ), q = Array.from(
11668
+ ), oe = Array.from(
11663
11669
  r.querySelectorAll(".pluno-pa-widget__resize-handle")
11664
- ), D = r.querySelector(
11670
+ ), R = r.querySelector(
11665
11671
  ".pluno-pa-widget__close"
11666
- ), F = r.querySelector(
11672
+ ), V = r.querySelector(
11667
11673
  ".pluno-pa-widget__composer"
11668
- ), J = r.querySelector(
11674
+ ), O = r.querySelector(
11669
11675
  ".pluno-pa-widget__attachment-error"
11670
11676
  ), S = r.querySelector(
11671
11677
  ".pluno-pa-widget__billing-status"
11672
- ), V = r.querySelector(".pluno-pa-widget__access-notice"), te = r.querySelector(".pluno-pa-widget__connection-notice"), ce = r.querySelector(
11678
+ ), F = r.querySelector(".pluno-pa-widget__access-notice"), ee = r.querySelector(".pluno-pa-widget__connection-notice"), ce = r.querySelector(
11673
11679
  ".pluno-pa-widget__attachments"
11674
- ), ne = r.querySelector(
11680
+ ), te = r.querySelector(
11675
11681
  ".pluno-pa-widget__attachment-input"
11676
11682
  ), Se = r.querySelector(
11677
11683
  ".pluno-pa-widget__attach"
11678
- ), T = r.querySelector(
11684
+ ), P = r.querySelector(
11679
11685
  ".pluno-pa-widget__input"
11680
11686
  ), fe = r.querySelector(
11681
11687
  ".pluno-pa-widget__model-picker"
@@ -11687,21 +11693,21 @@ async function lw(t = {}) {
11687
11693
  ".pluno-pa-widget__send"
11688
11694
  ), $e = r.querySelector(
11689
11695
  ".pluno-pa-widget__top-actions"
11690
- ), Y = r.querySelector(
11696
+ ), J = r.querySelector(
11691
11697
  ".pluno-pa-widget__history"
11692
11698
  ), tt = r.querySelector(
11693
11699
  ".pluno-pa-widget__history-panel"
11694
11700
  ), z = r.querySelector(
11695
11701
  ".pluno-pa-widget__history-list"
11696
- ), X = r.querySelector(
11702
+ ), Y = r.querySelector(
11697
11703
  ".pluno-pa-widget__history-close"
11698
11704
  ), H = r.querySelector(
11699
11705
  ".pluno-pa-widget__history-status"
11700
- ), se = r.querySelector(".pluno-pa-widget__history-retry"), ve = r.querySelector(
11706
+ ), ie = r.querySelector(".pluno-pa-widget__history-retry"), ve = r.querySelector(
11701
11707
  ".pluno-pa-widget__timeline-jump"
11702
11708
  ), W = r.querySelector(
11703
11709
  ".pluno-pa-widget__active-users-counter"
11704
- ), M = r.querySelector(
11710
+ ), q = r.querySelector(
11705
11711
  ".pluno-pa-widget__timeline"
11706
11712
  ), le = r.querySelector(
11707
11713
  ".pluno-pa-widget__timeline-bottom-sentinel"
@@ -11715,9 +11721,9 @@ async function lw(t = {}) {
11715
11721
  ".pluno-pa-widget__notify-suggestion-later"
11716
11722
  ), je = r.querySelector(
11717
11723
  ".pluno-pa-widget__notify-suggestion-never"
11718
- ), P = r.querySelector(
11724
+ ), M = r.querySelector(
11719
11725
  ".pluno-pa-widget__tab-groups-suggestion"
11720
- ), Z = P?.querySelector(
11726
+ ), Q = M?.querySelector(
11721
11727
  ".pluno-pa-widget__notify-suggestion-label"
11722
11728
  ), de = r.querySelector(
11723
11729
  ".pluno-pa-widget__tab-groups-suggestion-enable"
@@ -11731,11 +11737,11 @@ async function lw(t = {}) {
11731
11737
  ".pluno-pa-widget__proactive-suggestion-run"
11732
11738
  ), Le = r.querySelector(
11733
11739
  ".pluno-pa-widget__proactive-suggestion-edit"
11734
- ), Q = r.querySelector(
11740
+ ), X = r.querySelector(
11735
11741
  ".pluno-pa-widget__proactive-suggestion-dismiss"
11736
11742
  ), B = r.querySelector(
11737
11743
  ".pluno-pa-widget__proactive-suggestion-close"
11738
- ), ee = r.querySelector(
11744
+ ), Z = r.querySelector(
11739
11745
  ".pluno-pa-widget__proactive-suggestion-never-show"
11740
11746
  ), ae = r.querySelector(
11741
11747
  ".pluno-pa-widget__proactive-suggestion-actions"
@@ -11748,11 +11754,11 @@ async function lw(t = {}) {
11748
11754
  ), zi = r.querySelector(
11749
11755
  ".pluno-pa-widget__proactive-suggestion-feedback-status"
11750
11756
  );
11751
- if (!_ || !E || !U || !D || !F || !J || !S || !ce || !ne || !Se || !T || !fe || !Oe || !Ce || !$e || !Y || !tt || !z || !X || !H || !se || !ve || !W || !M || !le)
11757
+ if (!_ || !E || !U || !R || !V || !O || !S || !ce || !te || !Se || !P || !fe || !Oe || !Ce || !$e || !J || !tt || !z || !Y || !H || !ie || !ve || !W || !q || !le)
11752
11758
  throw new Error("Failed to mount Pluno widget");
11753
11759
  if (e.movableLauncher && !v)
11754
11760
  throw new Error("Failed to mount Pluno widget drag handle");
11755
- if (e.movableLauncher && !ge)
11761
+ if (e.movableLauncher && !he)
11756
11762
  throw new Error("Failed to mount Pluno widget panel drag handle");
11757
11763
  let Xs = !1, Vt = null, gn = !1, Nn = null, He = "idle";
11758
11764
  const Bi = () => {
@@ -11772,10 +11778,10 @@ async function lw(t = {}) {
11772
11778
  return;
11773
11779
  const u = e.proactiveSuggestion ?? Vt, y = u !== null && !A.getState().isThinking, I = U.querySelector(
11774
11780
  ".pluno-pa-widget__proactive-suggestion-slot"
11775
- ), x = !U.hidden && !r.classList.contains("pluno-pa-widget--closing"), O = y && x && I !== null;
11776
- O ? k.parentElement !== I && I.appendChild(k) : k.parentElement !== r && r.insertBefore(k, D), k.hidden = !y, r.classList.toggle("pluno-pa-widget--proactive-suggestion", y), r.classList.toggle(
11781
+ ), x = !U.hidden && !r.classList.contains("pluno-pa-widget--closing"), D = y && x && I !== null;
11782
+ D ? k.parentElement !== I && I.appendChild(k) : k.parentElement !== r && r.insertBefore(k, R), k.hidden = !y, r.classList.toggle("pluno-pa-widget--proactive-suggestion", y), r.classList.toggle(
11777
11783
  "pluno-pa-widget--proactive-suggestion-in-panel",
11778
- O
11784
+ D
11779
11785
  ), N.textContent = u?.question ?? "", ae.hidden = e.proactiveSuggestion === null || gn, hn.hidden = Vt === null;
11780
11786
  const re = He === "success";
11781
11787
  we.hidden = re, Qn.hidden = re, Qn.disabled = He === "submitting" || we.value.trim().length === 0, Qn.textContent = He === "submitting" ? "Sending…" : "Send feedback", zi.textContent = He === "success" ? "Thanks — this helps improve your suggestions." : He === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", zi.classList.toggle(
@@ -11801,7 +11807,7 @@ async function lw(t = {}) {
11801
11807
  }
11802
11808
  );
11803
11809
  };
11804
- Se.hidden = !e.attachmentsEnabled, ne.disabled = !e.attachmentsEnabled, ne.accept = e.productVariant === "personal" ? "" : Df, $l(E), $l(T);
11810
+ Se.hidden = !e.attachmentsEnabled, te.disabled = !e.attachmentsEnabled, te.accept = e.productVariant === "personal" ? "" : Df, $l(E), $l(P);
11805
11811
  let nt = [];
11806
11812
  const Zn = /* @__PURE__ */ new Map(), Ea = () => {
11807
11813
  for (const u of Zn.values()) URL.revokeObjectURL?.(u);
@@ -11810,9 +11816,9 @@ async function lw(t = {}) {
11810
11816
  let ft = 0, Gt = 0, Ca = 0;
11811
11817
  const St = /* @__PURE__ */ new Map();
11812
11818
  let Jt = null, Dt = null;
11813
- const eo = (u) => u === T ? "widget_composer" : u === E ? "widget_launcher" : u && a.contains(u) ? "widget_control" : u === b.body ? "body" : u === b.documentElement ? "document" : u ? "host_page" : "none", fn = (u, y, I = {}) => {
11814
- const x = ps(b), O = I.skipIfAlreadyFocused === !0 && x === u;
11815
- O || (I.preventScroll ? u.focus({ preventScroll: !0 }) : u.focus());
11819
+ const eo = (u) => u === P ? "widget_composer" : u === E ? "widget_launcher" : u && a.contains(u) ? "widget_control" : u === b.body ? "body" : u === b.documentElement ? "document" : u ? "host_page" : "none", fn = (u, y, I = {}) => {
11820
+ const x = ps(b), D = I.skipIfAlreadyFocused === !0 && x === u;
11821
+ D || (I.preventScroll ? u.focus({ preventScroll: !0 }) : u.focus());
11816
11822
  const re = ps(b);
11817
11823
  return Xe(
11818
11824
  "web-sdk.widget.focus",
@@ -11825,7 +11831,7 @@ async function lw(t = {}) {
11825
11831
  previousFocus: eo(x),
11826
11832
  requestedFocus: eo(u),
11827
11833
  resultingFocus: eo(re),
11828
- focusSkipped: O,
11834
+ focusSkipped: D,
11829
11835
  focusSucceeded: re === u,
11830
11836
  hostConnected: o.isConnected,
11831
11837
  panelOpen: r.classList.contains("pluno-pa-widget--open"),
@@ -11834,8 +11840,8 @@ async function lw(t = {}) {
11834
11840
  hasSession: !!A.getState().sessionId,
11835
11841
  isThinking: A.getState().isThinking
11836
11842
  }
11837
- ), !O && re === u;
11838
- }, Yt = (u) => !T.isConnected || T.disabled || T.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Fn(e.billingStatus) ? !1 : fn(T, u, {
11843
+ ), !D && re === u;
11844
+ }, Yt = (u) => !P.isConnected || P.disabled || P.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Fn(e.billingStatus) ? !1 : fn(P, u, {
11839
11845
  preventScroll: !0,
11840
11846
  skipIfAlreadyFocused: !0
11841
11847
  }), ei = () => {
@@ -11954,7 +11960,7 @@ async function lw(t = {}) {
11954
11960
  let mt = null, Xt = null, Pe = !1, Qt = !1, Ot = {
11955
11961
  enabled: !0
11956
11962
  }, Zt = 0, io = null, mn = null, yn = null, Fi = null, oi = !1, be = null, Ma = "local";
11957
- const qa = (u) => ti !== null && ti !== u.sessionId || ii !== null && ii !== (u.user?.id ?? null) || ni !== void 0 && ni !== u.selectionKey, Da = (u) => up(M, u, {
11963
+ const qa = (u) => ti !== null && ti !== u.sessionId || ii !== null && ii !== (u.user?.id ?? null) || ni !== void 0 && ni !== u.selectionKey, Da = (u) => up(q, u, {
11958
11964
  renderSource: Ma,
11959
11965
  guardCreatedAt: be?.createdAt ?? null,
11960
11966
  selectionFencePending: qa(u)
@@ -11973,20 +11979,20 @@ async function lw(t = {}) {
11973
11979
  }, Lu = () => {
11974
11980
  Cp(oi, Hi), ve.hidden = !1;
11975
11981
  }, Ua = () => {
11976
- be?.observedConversation && M.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)") && (be.observedWelcome ??= Da(A.getState())), be?.observedWelcome && !be.pendingSubmission && (Hi("submitted_turn_returned_to_welcome_without_new_chat", be.clientMessageId, {
11982
+ be?.observedConversation && q.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)") && (be.observedWelcome ??= Da(A.getState())), be?.observedWelcome && !be.pendingSubmission && (Hi("submitted_turn_returned_to_welcome_without_new_chat", be.clientMessageId, {
11977
11983
  before: be.observedConversation,
11978
11984
  current: be.observedWelcome
11979
11985
  }), be = null);
11980
11986
  }, Nu = (u = "jump") => {
11981
- st(!0, u), yt(), Kn(M, () => Ot.enabled), Zt = M.scrollTop;
11987
+ st(!0, u), yt(), Kn(q, () => Ot.enabled), Zt = q.scrollTop;
11982
11988
  }, Wi = (u) => {
11983
- io = u, u === "up" && M.scrollTop < Zt - 1 && (oi = !0, st(!1, "userScroll")), mn !== null && window.clearTimeout(mn), mn = window.setTimeout(() => {
11989
+ io = u, u === "up" && q.scrollTop < Zt - 1 && (oi = !0, st(!1, "userScroll")), mn !== null && window.clearTimeout(mn), mn = window.setTimeout(() => {
11984
11990
  io = null, mn = null;
11985
11991
  }, 500);
11986
11992
  };
11987
11993
  Lt = () => {
11988
11994
  const u = fp(We.data), y = We.status === "loading" || We.status === "refreshing" || We.status === "loading_more";
11989
- if (Y.hidden = e.layout === "page" || e.loginRequired || e.signupRequired, (e.loginRequired || e.signupRequired) && (Ke = !1), tt.hidden = !Ke, Y.setAttribute("aria-expanded", String(Ke)), !Ke) {
11995
+ if (J.hidden = e.layout === "page" || e.loginRequired || e.signupRequired, (e.loginRequired || e.signupRequired) && (Ke = !1), tt.hidden = !Ke, J.setAttribute("aria-expanded", String(Ke)), !Ke) {
11990
11996
  oo = "";
11991
11997
  return;
11992
11998
  }
@@ -12005,27 +12011,27 @@ async function lw(t = {}) {
12005
12011
  x.className = "pluno-pa-widget__history-loading", x.textContent = "Loading...", z.appendChild(x);
12006
12012
  }
12007
12013
  for (const x of u) {
12008
- const O = document.createElement("button");
12009
- O.type = "button", O.className = "pluno-pa-widget__history-item";
12014
+ const D = document.createElement("button");
12015
+ D.type = "button", D.className = "pluno-pa-widget__history-item";
12010
12016
  const re = x.id === A.getState().sessionId;
12011
- O.disabled = re, re && O.setAttribute("aria-current", "page");
12017
+ D.disabled = re, re && D.setAttribute("aria-current", "page");
12012
12018
  const Re = document.createElement("span");
12013
- Re.className = "pluno-pa-widget__history-item-title", Re.textContent = Ll(x), O.setAttribute("aria-label", Ll(x));
12019
+ Re.className = "pluno-pa-widget__history-item-title", Re.textContent = Ll(x), D.setAttribute("aria-label", Ll(x));
12014
12020
  const Ie = document.createElement("time");
12015
12021
  Ie.className = "pluno-pa-widget__history-time", Ie.dateTime = x.lastActiveAt, Ie.textContent = Nl(
12016
12022
  x.lastActiveAt,
12017
12023
  Date.now()
12018
12024
  );
12019
12025
  const _t = document.createElement("small");
12020
- _t.className = "pluno-pa-widget__history-path", _t.textContent = Rw(x), O.append(Re, Ie, _t), O.addEventListener("click", () => {
12026
+ _t.className = "pluno-pa-widget__history-path", _t.textContent = Rw(x), D.append(Re, Ie, _t), D.addEventListener("click", () => {
12021
12027
  Ke = !1, Lt(), be = null, oi = !1, ji.clear(), st(!0, "newSession"), yt(), A.loadSession(x.id), di = null, _e(A.getState()), Yt("history_session_selected");
12022
- }), z.appendChild(O);
12028
+ }), z.appendChild(D);
12023
12029
  }
12024
12030
  if (y && u.length > 0) {
12025
12031
  const x = document.createElement("p");
12026
12032
  x.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", x.textContent = "Loading...", z.appendChild(x);
12027
12033
  }
12028
- H.textContent = (We.status === "error" ? Wy : null) ?? (!y && u.length === 0 ? "No recent chats for this page yet." : ""), H.hidden = H.textContent.length === 0, H.classList.toggle("pluno-pa-widget__history-error", We.status === "error"), se.hidden = We.status !== "error", se.disabled = y;
12034
+ H.textContent = (We.status === "error" ? Wy : null) ?? (!y && u.length === 0 ? "No recent chats for this page yet." : ""), H.hidden = H.textContent.length === 0, H.classList.toggle("pluno-pa-widget__history-error", We.status === "error"), ie.hidden = We.status !== "error", ie.disabled = y;
12029
12035
  }
12030
12036
  };
12031
12037
  const ro = (u = !1) => {
@@ -12035,9 +12041,9 @@ async function lw(t = {}) {
12035
12041
  Xs = !1;
12036
12042
  });
12037
12043
  };
12038
- se.addEventListener("click", () => {
12039
- se.disabled = !0, Promise.resolve(ro(!0)).finally(() => {
12040
- se.disabled = !1;
12044
+ ie.addEventListener("click", () => {
12045
+ ie.disabled = !0, Promise.resolve(ro(!0)).finally(() => {
12046
+ ie.disabled = !1;
12041
12047
  });
12042
12048
  });
12043
12049
  const ao = () => {
@@ -12068,7 +12074,7 @@ async function lw(t = {}) {
12068
12074
  }, Ve = () => {
12069
12075
  Fb(e, {
12070
12076
  isOpen: r.classList.contains("pluno-pa-widget--open"),
12071
- composerValue: T.value,
12077
+ composerValue: P.value,
12072
12078
  openToolGroupKeys: [...no],
12073
12079
  launcherPosition: h ? d : null,
12074
12080
  panelSize: g
@@ -12081,7 +12087,7 @@ async function lw(t = {}) {
12081
12087
  r.classList.remove("pluno-pa-widget--minimized"), _.removeAttribute("tabindex"), _.removeAttribute("role"), _.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && ci(!1), y && Vi("shown", I);
12082
12088
  return;
12083
12089
  }
12084
- mt !== null && (window.clearTimeout(mt), mt = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), _.hidden = !1, _.setAttribute("role", "button"), _.setAttribute("aria-label", "Open Pluno"), U.hidden = !0, D.hidden = !0, _.tabIndex = 0, T.value = "", gt(), an(
12090
+ mt !== null && (window.clearTimeout(mt), mt = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), _.hidden = !1, _.setAttribute("role", "button"), _.setAttribute("aria-label", "Open Pluno"), U.hidden = !0, R.hidden = !0, _.tabIndex = 0, P.value = "", gt(), an(
12085
12091
  r,
12086
12092
  dr(
12087
12093
  r,
@@ -12105,7 +12111,7 @@ async function lw(t = {}) {
12105
12111
  panelRect: hr(U),
12106
12112
  viewport: Je(),
12107
12113
  panelHidden: U.hidden,
12108
- closeHidden: D.hidden,
12114
+ closeHidden: R.hidden,
12109
12115
  ...y
12110
12116
  });
12111
12117
  }, ci = (u = !0) => {
@@ -12225,7 +12231,7 @@ async function lw(t = {}) {
12225
12231
  const y = Tn(g), I = Ri(
12226
12232
  u,
12227
12233
  y
12228
- ), x = Di(r), O = Es(
12234
+ ), x = Di(r), D = Es(
12229
12235
  r,
12230
12236
  Sw(
12231
12237
  I,
@@ -12236,19 +12242,19 @@ async function lw(t = {}) {
12236
12242
  x
12237
12243
  );
12238
12244
  d = ur(
12239
- O,
12245
+ D,
12240
12246
  x
12241
- ), h = !0, m = null, an(r, O), Gi(I, O);
12242
- }, $u = e.movableLauncher && ge ? fw({
12247
+ ), h = !0, m = null, an(r, D), Gi(I, D);
12248
+ }, $u = e.movableLauncher && he ? fw({
12243
12249
  root: r,
12244
- handle: ge,
12250
+ handle: he,
12245
12251
  getPosition: () => ja().position,
12246
12252
  setPosition: Bu,
12247
12253
  persist: Ve
12248
12254
  }) : () => {
12249
- }, Fu = q.length > 0 ? mw({
12255
+ }, Fu = oe.length > 0 ? mw({
12250
12256
  root: r,
12251
- handles: q,
12257
+ handles: oe,
12252
12258
  getBounds: ja,
12253
12259
  setBounds: zu,
12254
12260
  persist: Ve
@@ -12260,7 +12266,7 @@ async function lw(t = {}) {
12260
12266
  const _n = document.createElement("button");
12261
12267
  _n.type = "button", _n.className = "pluno-pa-widget__error-retry";
12262
12268
  const Ka = pn(), Ha = document.createTextNode("Try again");
12263
- _n.append(Ka, Ha), li.append("Pluno could not load your account. Try again.", _n), te.after(bn);
12269
+ _n.append(Ka, Ha), li.append("Pluno could not load your account. Try again.", _n), ee.after(bn);
12264
12270
  let lo = !1, vn = !1;
12265
12271
  const uo = () => {
12266
12272
  bn.hidden = !lo || !!e.billingStatus || e.productVariant !== "personal" || Nt(), bn.hidden ? li.remove() : li.parentElement !== bn && bn.append(li), _n.disabled = vn, _n.setAttribute("aria-busy", String(vn)), Ka.hidden = !vn, Ha.data = vn ? "Trying" : "Try again";
@@ -12295,9 +12301,9 @@ async function lw(t = {}) {
12295
12301
  An(x)
12296
12302
  );
12297
12303
  }));
12298
- }, wt = (u = "", y = !0, I = !0, x = !0, O = "external_request") => {
12304
+ }, wt = (u = "", y = !0, I = !0, x = !0, D = "external_request") => {
12299
12305
  const re = r.classList.contains("pluno-pa-widget--open") || !U.hidden && !r.classList.contains("pluno-pa-widget--closing");
12300
- !re && x && Wa("panel_open"), po(), hi && (hi = !1, vo()), r.classList.contains("pluno-pa-widget--open") || (m = null), mt !== null && (window.clearTimeout(mt), mt = null), ai("shown", !1), U.hidden = !1, D.hidden = !1, gr(
12306
+ !re && x && Wa("panel_open"), po(), hi && (hi = !1, vo()), r.classList.contains("pluno-pa-widget--open") || (m = null), mt !== null && (window.clearTimeout(mt), mt = null), ai("shown", !1), U.hidden = !1, R.hidden = !1, gr(
12301
12307
  G,
12302
12308
  co()
12303
12309
  ), r.classList.remove("pluno-pa-widget--closing"), gt();
@@ -12310,22 +12316,22 @@ async function lw(t = {}) {
12310
12316
  if (Gi(Ie, Re), wn("Opening launcher at clamped open panel position", {
12311
12317
  openPanelPosition: Ie,
12312
12318
  visibleLauncherPosition: Re
12313
- }), st(!0, "open"), yt(), !re && e.layout === "floating" && A.recordWidgetLifecycle("opened", O), !y) {
12314
- r.classList.add("pluno-pa-widget--open"), re || ao(), _.hidden = !0, u && (T.value = u, ki(T)), Kn(M, () => Ot.enabled), Zt = M.scrollTop, I && (fn(T, "panel_open_immediate"), T.setSelectionRange(T.value.length, T.value.length)), Ve(), Vi("shown", O), e.onPanelOpenChange?.(!0, O);
12319
+ }), st(!0, "open"), yt(), !re && e.layout === "floating" && A.recordWidgetLifecycle("opened", D), !y) {
12320
+ r.classList.add("pluno-pa-widget--open"), re || ao(), _.hidden = !0, u && (P.value = u, ki(P)), Kn(q, () => Ot.enabled), Zt = q.scrollTop, I && (fn(P, "panel_open_immediate"), P.setSelectionRange(P.value.length, P.value.length)), Ve(), Vi("shown", D), e.onPanelOpenChange?.(!0, D);
12315
12321
  return;
12316
12322
  }
12317
12323
  const _t = Date.now();
12318
12324
  window.requestAnimationFrame(() => {
12319
- r.classList.add("pluno-pa-widget--open"), re || ao(), u && (T.value = u, ki(T)), Kn(M, () => Ot.enabled), Zt = M.scrollTop, I && (fn(T, "panel_open_animation", {
12325
+ r.classList.add("pluno-pa-widget--open"), re || ao(), u && (P.value = u, ki(P)), Kn(q, () => Ot.enabled), Zt = q.scrollTop, I && (fn(P, "panel_open_animation", {
12320
12326
  scheduledAt: _t
12321
- }), T.setSelectionRange(T.value.length, T.value.length)), Ve(), Vi("shown", O), e.onPanelOpenChange?.(!0, O), mt = window.setTimeout(() => {
12322
- _.hidden = !0, Kn(M, () => Ot.enabled), Zt = M.scrollTop;
12327
+ }), P.setSelectionRange(P.value.length, P.value.length)), Ve(), Vi("shown", D), e.onPanelOpenChange?.(!0, D), mt = window.setTimeout(() => {
12328
+ _.hidden = !0, Kn(q, () => Ot.enabled), Zt = q.scrollTop;
12323
12329
  }, 220);
12324
12330
  });
12325
12331
  }, ho = (u = "external_request") => {
12326
12332
  const y = r.classList.contains("pluno-pa-widget--open") || !U.hidden && !r.classList.contains("pluno-pa-widget--closing");
12327
12333
  mt !== null && (window.clearTimeout(mt), mt = null), _.hidden = !1, d && (ci(!1), wn("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), gt(), Ve(), y && e.layout === "floating" && A.recordWidgetLifecycle("closed", u), e.onPanelOpenChange?.(!1, u), mt = window.setTimeout(() => {
12328
- U.hidden = !0, D.hidden = !0, m = null, r.classList.remove("pluno-pa-widget--closing");
12334
+ U.hidden = !0, R.hidden = !0, m = null, r.classList.remove("pluno-pa-widget--closing");
12329
12335
  }, 220);
12330
12336
  };
12331
12337
  _.addEventListener("submit", (u) => {
@@ -12345,7 +12351,7 @@ async function lw(t = {}) {
12345
12351
  wt(u, !0, !0, !0, "launcher_input"), E.value = "";
12346
12352
  });
12347
12353
  let ui = null, en = null, Ji = null, In = null, kt = null, Ne = null;
12348
- const Yi = (u) => u === E || u === T, Ga = (u) => u.composedPath().find(Yi) ?? null, ju = (u) => {
12354
+ const Yi = (u) => u === E || u === P, Ga = (u) => u.composedPath().find(Yi) ?? null, ju = (u) => {
12349
12355
  let y = u;
12350
12356
  for (; y; ) {
12351
12357
  if (y.assignedSlot)
@@ -12366,8 +12372,8 @@ async function lw(t = {}) {
12366
12372
  y = x;
12367
12373
  continue;
12368
12374
  }
12369
- const O = y.getRootNode();
12370
- y = O instanceof ShadowRoot ? O.host : null;
12375
+ const D = y.getRootNode();
12376
+ y = D instanceof ShadowRoot ? D.host : null;
12371
12377
  }
12372
12378
  return null;
12373
12379
  }, fo = () => ps(b), Ku = (u) => {
@@ -12417,12 +12423,12 @@ async function lw(t = {}) {
12417
12423
  x && (pi(x, y), u.stopImmediatePropagation()), Ne = window.setTimeout(() => {
12418
12424
  if (Ne = null, en !== I)
12419
12425
  return;
12420
- const O = fo();
12421
- if (O === y) {
12426
+ const D = fo();
12427
+ if (D === y) {
12422
12428
  en = null;
12423
12429
  return;
12424
12430
  }
12425
- const re = go(O);
12431
+ const re = go(D);
12426
12432
  re && pi(re, y);
12427
12433
  }, 0);
12428
12434
  }, Xi = (u) => {
@@ -12453,7 +12459,7 @@ async function lw(t = {}) {
12453
12459
  return;
12454
12460
  const I = u.target, x = en !== null && Date.now() - en <= kl;
12455
12461
  en = null, Ne !== null && (window.clearTimeout(Ne), Ne = null);
12456
- const O = (re) => {
12462
+ const D = (re) => {
12457
12463
  const Re = go(re);
12458
12464
  if (!Re)
12459
12465
  return !1;
@@ -12462,8 +12468,8 @@ async function lw(t = {}) {
12462
12468
  const Ie = Date.now();
12463
12469
  return Ji !== null && Ie - Ji <= Ky ? (pi(Re, I), !0) : (Ji = Ie, !0);
12464
12470
  };
12465
- O(u.relatedTarget) || window.setTimeout(() => {
12466
- Ut === null && I.isConnected && O(fo());
12471
+ D(u.relatedTarget) || window.setTimeout(() => {
12472
+ Ut === null && I.isConnected && D(fo());
12467
12473
  }, 0);
12468
12474
  }), _.addEventListener("keydown", (u) => {
12469
12475
  !r.classList.contains("pluno-pa-widget--minimized") || u.key !== "Enter" && u.key !== " " || (u.preventDefault(), wt("", !0, !0, !0, "minimized_launcher"));
@@ -12471,38 +12477,38 @@ async function lw(t = {}) {
12471
12477
  u.stopPropagation();
12472
12478
  }), K?.addEventListener("click", (u) => {
12473
12479
  u.preventDefault(), u.stopPropagation(), ai("minimized", !0, "minimize_button");
12474
- }), D.addEventListener("click", () => ho("close_button")), M.addEventListener("wheel", (u) => {
12480
+ }), R.addEventListener("click", () => ho("close_button")), q.addEventListener("wheel", (u) => {
12475
12481
  Wi(u.deltaY < 0 ? "up" : null);
12476
- }), M.addEventListener("pointerdown", (u) => {
12477
- yn = u.target === M ? u.clientY : null;
12478
- }), M.addEventListener("pointermove", (u) => {
12482
+ }), q.addEventListener("pointerdown", (u) => {
12483
+ yn = u.target === q ? u.clientY : null;
12484
+ }), q.addEventListener("pointermove", (u) => {
12479
12485
  yn !== null && u.clientY < yn - 1 && Wi("up"), yn !== null && (yn = u.clientY);
12480
- }), M.addEventListener("pointerup", () => {
12486
+ }), q.addEventListener("pointerup", () => {
12481
12487
  yn = null;
12482
- }), M.addEventListener("pointercancel", () => {
12488
+ }), q.addEventListener("pointercancel", () => {
12483
12489
  yn = null;
12484
- }), M.addEventListener("touchstart", (u) => {
12490
+ }), q.addEventListener("touchstart", (u) => {
12485
12491
  Fi = u.touches[0]?.clientY ?? null;
12486
- }), M.addEventListener("touchmove", (u) => {
12492
+ }), q.addEventListener("touchmove", (u) => {
12487
12493
  const y = u.touches[0]?.clientY ?? null;
12488
12494
  y !== null && Fi !== null && Wi(y > Fi ? "up" : null), Fi = y;
12489
- }), M.addEventListener("keydown", (u) => {
12495
+ }), q.addEventListener("keydown", (u) => {
12490
12496
  (u.key === "ArrowUp" || u.key === "PageUp" || u.key === "Home") && Wi("up");
12491
- }), M.addEventListener("scroll", () => {
12492
- M.scrollTop < Zt - 1 && io === "up" && (oi = !0, st(!1, "userScroll")), Zt = M.scrollTop;
12497
+ }), q.addEventListener("scroll", () => {
12498
+ q.scrollTop < Zt - 1 && io === "up" && (oi = !0, st(!1, "userScroll")), Zt = q.scrollTop;
12493
12499
  }), ve.addEventListener("click", () => {
12494
12500
  Nu();
12495
12501
  });
12496
12502
  const Ya = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
12497
12503
  ([u]) => {
12498
- !u?.isIntersecting || M.scrollHeight - M.scrollTop - M.clientHeight > 1 || (st(!0, "bottom"), yt());
12504
+ !u?.isIntersecting || q.scrollHeight - q.scrollTop - q.clientHeight > 1 || (st(!0, "bottom"), yt());
12499
12505
  },
12500
- { root: M, threshold: 0 }
12506
+ { root: q, threshold: 0 }
12501
12507
  );
12502
12508
  Ya?.observe(le);
12503
12509
  const Xa = r.querySelector(".pluno-pa-widget__permission-overlay"), Qa = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
12504
12510
  const u = Xa.offsetHeight;
12505
- M.style.paddingBottom = `${u > 0 ? u + 24 : 12}px`, Ot.enabled && Kn(M, () => Ot.enabled);
12511
+ q.style.paddingBottom = `${u > 0 ? u + 24 : 12}px`, Ot.enabled && Kn(q, () => Ot.enabled);
12506
12512
  });
12507
12513
  Qa?.observe(Xa);
12508
12514
  const Nt = () => e.loginRequired || e.signupRequired;
@@ -12519,7 +12525,7 @@ async function lw(t = {}) {
12519
12525
  return Qi() ? !1 : u !== "connected" && !(yo && u === "reconnecting");
12520
12526
  }, zn = () => {
12521
12527
  const u = Nt(), y = A.getState(), I = !y.isThinking && !y.pendingMessageStatus && !!y.lastError;
12522
- E.readOnly = !1, T.readOnly = !1, E.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : I ? "Needs attention" : hi ? "New update" : e.launcherLabel, T.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : $t.launcherLabel, F.hidden = u;
12528
+ E.readOnly = !1, P.readOnly = !1, E.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : I ? "Needs attention" : hi ? "New update" : e.launcherLabel, P.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : $t.launcherLabel, V.hidden = u;
12523
12529
  }, _o = () => [...St.values()].some((u) => u.revision === Gt && u.generation === ft), Za = () => {
12524
12530
  const u = A.getState(), y = e.billingStatus;
12525
12531
  return {
@@ -12538,7 +12544,7 @@ async function lw(t = {}) {
12538
12544
  return yp({
12539
12545
  hasRunningAssistantTurn: y || u.isThinking || u.turnPhase !== null || u.pendingMessageStatus !== null,
12540
12546
  // Retained text already submitted by this revision must not hide Stop behind a disabled Send.
12541
- hasDraftMessage: !y && T.value.trim().length > 0,
12547
+ hasDraftMessage: !y && P.value.trim().length > 0,
12542
12548
  hasPreSubmittedAttachment: nt.length > 0,
12543
12549
  canSubmitMessage: tn()
12544
12550
  });
@@ -12550,8 +12556,8 @@ async function lw(t = {}) {
12550
12556
  };
12551
12557
  zn();
12552
12558
  const vo = () => {
12553
- const u = A.getState(), y = u.isThinking, I = u.turnPhase !== null, x = u.turnPhase === "sending", O = L?.lastElementChild;
12554
- O && (O.textContent = "Working..."), r.classList.toggle("pluno-pa-widget--thinking", y), r.classList.toggle("pluno-pa-widget--sending", x), r.classList.toggle(
12559
+ const u = A.getState(), y = u.isThinking, I = u.turnPhase !== null, x = u.turnPhase === "sending", D = L?.lastElementChild;
12560
+ D && (D.textContent = "Working..."), r.classList.toggle("pluno-pa-widget--thinking", y), r.classList.toggle("pluno-pa-widget--sending", x), r.classList.toggle(
12555
12561
  "pluno-pa-widget--unread",
12556
12562
  !I && (hi || !!u.lastError)
12557
12563
  ), zn();
@@ -12574,14 +12580,14 @@ async function lw(t = {}) {
12574
12580
  }
12575
12581
  );
12576
12582
  }, Zi = (u) => {
12577
- Dt !== null && window.clearTimeout(Dt), J.textContent = u, J.hidden = !1, Dt = window.setTimeout(() => {
12578
- J.textContent = "", J.hidden = !0, Dt = null;
12583
+ Dt !== null && window.clearTimeout(Dt), O.textContent = u, O.hidden = !1, Dt = window.setTimeout(() => {
12584
+ O.textContent = "", O.hidden = !0, Dt = null;
12579
12585
  }, 3e3);
12580
12586
  }, So = (u, y) => {
12581
12587
  const I = St.get(u);
12582
12588
  if (!I || y !== void 0 && I.submittedAt !== y || (St.delete(u), I.generation !== ft || I.revision !== Gt)) return;
12583
12589
  const x = new Set(I.attachments);
12584
- nt = nt.filter((O) => !x.has(O)), T.value = "", T.dispatchEvent(new Event("input", { bubbles: !0 })), ei(), Me();
12590
+ nt = nt.filter((D) => !x.has(D)), P.value = "", P.dispatchEvent(new Event("input", { bubbles: !0 })), ei(), Me();
12585
12591
  }, tc = (u) => {
12586
12592
  const y = ft, I = gn ? Nn : null;
12587
12593
  Ew(
@@ -12597,8 +12603,8 @@ async function lw(t = {}) {
12597
12603
  }).catch((x) => {
12598
12604
  if (y !== ft) return;
12599
12605
  be?.clientMessageId === u.clientMessageId && (be = null), St.delete(u.clientMessageId), ei();
12600
- const O = x instanceof Error ? x.message : "Failed to upload attachment";
12601
- A.getState().lastError !== O && Zi(O);
12606
+ const D = x instanceof Error ? x.message : "Failed to upload attachment";
12607
+ A.getState().lastError !== D && Zi(D);
12602
12608
  }).finally(() => {
12603
12609
  y === ft && Me();
12604
12610
  });
@@ -12608,12 +12614,12 @@ async function lw(t = {}) {
12608
12614
  const u = Jt;
12609
12615
  Jt = null, tc(u);
12610
12616
  }, xo = () => {
12611
- const u = T.value, y = u.trim(), I = [...nt];
12617
+ const u = P.value, y = u.trim(), I = [...nt];
12612
12618
  if (Jt !== null || _o() || e.productVariant === "personal" && !tn() || !y && I.length === 0)
12613
12619
  return;
12614
- for (const O of I)
12615
- O.id && O.previewUrl && Zn.set(O.id, O.previewUrl);
12616
- if ([...St.values()].some((O) => O.revision === Gt && O.generation === ft)) return;
12620
+ for (const D of I)
12621
+ D.id && D.previewUrl && Zn.set(D.id, D.previewUrl);
12622
+ if ([...St.values()].some((D) => D.revision === Gt && D.generation === ft)) return;
12617
12623
  const x = {
12618
12624
  inputValue: u,
12619
12625
  value: y,
@@ -12633,7 +12639,7 @@ async function lw(t = {}) {
12633
12639
  }
12634
12640
  tc(x);
12635
12641
  };
12636
- F.addEventListener("submit", (u) => {
12642
+ V.addEventListener("submit", (u) => {
12637
12643
  if (u.preventDefault(), e.loginRequired) {
12638
12644
  e.onLoginClick?.();
12639
12645
  return;
@@ -12648,7 +12654,7 @@ async function lw(t = {}) {
12648
12654
  const nn = () => {
12649
12655
  gi = 0, r.classList.remove("pluno-pa-widget--drag-over");
12650
12656
  }, Wu = () => {
12651
- Dt !== null && (window.clearTimeout(Dt), Dt = null), J.textContent = "", J.hidden = !0;
12657
+ Dt !== null && (window.clearTimeout(Dt), Dt = null), O.textContent = "", O.hidden = !0;
12652
12658
  }, ko = async (u) => {
12653
12659
  if (!e.attachmentsEnabled || u.length === 0 || e.productVariant === "personal" && Sn())
12654
12660
  return;
@@ -12663,13 +12669,13 @@ async function lw(t = {}) {
12663
12669
  }
12664
12670
  Yt("attachment_added");
12665
12671
  }, Vu = async (u) => {
12666
- await ko(u), !(u.length === 0 || Ut !== null) && fn(T, "attachment_picker_completed");
12672
+ await ko(u), !(u.length === 0 || Ut !== null) && fn(P, "attachment_picker_completed");
12667
12673
  };
12668
12674
  Se.addEventListener("click", () => {
12669
- e.loginRequired || Sn() || e.productVariant !== "personal" && Fn(e.billingStatus) || ne.click();
12670
- }), ne.addEventListener("change", () => {
12671
- const u = Array.from(ne.files ?? []);
12672
- ne.value = "", Vu(u).catch((y) => {
12675
+ e.loginRequired || Sn() || e.productVariant !== "personal" && Fn(e.billingStatus) || te.click();
12676
+ }), te.addEventListener("change", () => {
12677
+ const u = Array.from(te.files ?? []);
12678
+ te.value = "", Vu(u).catch((y) => {
12673
12679
  Zi(
12674
12680
  y instanceof Error ? y.message : "Failed to attach file"
12675
12681
  ), Xe("web-sdk.widget", "Attachment failed", {
@@ -12722,15 +12728,15 @@ async function lw(t = {}) {
12722
12728
  St.clear(), Jt = null, be = null, A.stop(), Me();
12723
12729
  return;
12724
12730
  }
12725
- const y = T.value.trim().length > 0 || nt.length > 0;
12731
+ const y = P.value.trim().length > 0 || nt.length > 0;
12726
12732
  Qt = !0, st(!0, "send"), yt(), xo(), _e(A.getState()), Me(), y && Yt("send_button_submit");
12727
- }), Y.addEventListener("click", () => {
12733
+ }), J.addEventListener("click", () => {
12728
12734
  Ke = !Ke, Lt(), Ke && (We.data === null || We.status === "error") && We.status !== "loading" && ro(), Ke || Yt("history_closed");
12729
- }), X.addEventListener("click", () => {
12735
+ }), Y.addEventListener("click", () => {
12730
12736
  Ke = !1, Lt(), Yt("history_closed");
12731
- }), z.addEventListener("scroll", Uu), T.addEventListener("input", () => {
12732
- Gt++, T.value.trim() && Wa("composer_input"), ki(T), Ve(), Me(), uc();
12733
- }), T.addEventListener("keydown", (u) => {
12737
+ }), z.addEventListener("scroll", Uu), P.addEventListener("input", () => {
12738
+ Gt++, P.value.trim() && Wa("composer_input"), ki(P), Ve(), Me(), uc();
12739
+ }), P.addEventListener("keydown", (u) => {
12734
12740
  if (!(u.key !== "Enter" || u.shiftKey || u.isComposing || u.keyCode === 229)) {
12735
12741
  if (u.preventDefault(), e.loginRequired) {
12736
12742
  e.onLoginClick?.();
@@ -12740,9 +12746,9 @@ async function lw(t = {}) {
12740
12746
  }
12741
12747
  }), r.addEventListener("click", (u) => {
12742
12748
  const y = u.target instanceof Element ? u.target : null;
12743
- y?.closest("a[href]") && Ve(), Ke && vy(y, tt, Y) && (Ke = !1, Lt());
12744
- const x = window.getSelection(), O = !!(x && !x.isCollapsed && x.anchorNode && r.contains(x.anchorNode));
12745
- by(u.target, u.detail, O) && Yt("passive_surface_click");
12749
+ y?.closest("a[href]") && Ve(), Ke && vy(y, tt, J) && (Ke = !1, Lt());
12750
+ const x = window.getSelection(), D = !!(x && !x.isCollapsed && x.anchorNode && r.contains(x.anchorNode));
12751
+ by(u.target, u.detail, D) && Yt("passive_surface_click");
12746
12752
  });
12747
12753
  let sc = !1;
12748
12754
  const oc = (u) => {
@@ -12751,16 +12757,16 @@ async function lw(t = {}) {
12751
12757
  if (!sc || U.hidden || r.classList.contains("pluno-pa-widget--closing"))
12752
12758
  return;
12753
12759
  const y = a.activeElement ?? b.activeElement, I = Sy(u, y);
12754
- if (!I || T.disabled || T.readOnly)
12760
+ if (!I || P.disabled || P.readOnly)
12755
12761
  return;
12756
12762
  u.preventDefault();
12757
12763
  const x = xy(
12758
- T.value,
12759
- T.selectionStart,
12760
- T.selectionEnd,
12764
+ P.value,
12765
+ P.selectionStart,
12766
+ P.selectionEnd,
12761
12767
  I
12762
12768
  );
12763
- T.value = x.value, T.dispatchEvent(new Event("input", { bubbles: !0 })), Iy(T), T.setSelectionRange(x.caret, x.caret);
12769
+ P.value = x.value, P.dispatchEvent(new Event("input", { bubbles: !0 })), Iy(P), P.setSelectionRange(x.caret, x.caret);
12764
12770
  };
12765
12771
  b.addEventListener(
12766
12772
  "pointerdown",
@@ -12794,7 +12800,7 @@ async function lw(t = {}) {
12794
12800
  return;
12795
12801
  }
12796
12802
  u.key !== "Escape" || !Ke || (Ke = !1, Lt(), Yt("history_escape"));
12797
- }), l.composerValue && (T.value = l.composerValue, ki(T)), e.layout === "page" ? wt(T.value, !1, !0, !1, "external_request") : p === "minimized" ? ai("minimized", !1) : e.initialDisplayState === void 0 && l.isOpen && wt(T.value, !1, !1, !1, "restored_state");
12803
+ }), l.composerValue && (P.value = l.composerValue, ki(P)), e.layout === "page" ? wt(P.value, !1, !0, !1, "external_request") : p === "minimized" ? ai("minimized", !1) : e.initialDisplayState === void 0 && l.isOpen && wt(P.value, !1, !1, !1, "restored_state");
12798
12804
  const fi = () => c;
12799
12805
  let Eo = A.getState().appearance !== null, es = null, mi = null, Et = A.getInteractions();
12800
12806
  const ue = (u) => Et.find(
@@ -12803,7 +12809,7 @@ async function lw(t = {}) {
12803
12809
  const u = ue("task_notifications");
12804
12810
  u && (ke && (ke.textContent = u.presentation.body), Fe && (Fe.textContent = u.presentation.actionLabels.enable ?? "Notify me"), ht && (ht.textContent = u.presentation.actionLabels.later ?? "Later"), je && (je.textContent = u.presentation.actionLabels.never ?? "Never"));
12805
12811
  const y = ue("tab_group_permission");
12806
- y && (Z && (Z.textContent = y.presentation.body), de && (de.textContent = y.presentation.actionLabels.enable ?? "Enable grouping"), C && (C.textContent = y.presentation.actionLabels.later ?? "Not now"));
12812
+ y && (Q && (Q.textContent = y.presentation.body), de && (de.textContent = y.presentation.actionLabels.enable ?? "Enable grouping"), C && (C.textContent = y.presentation.actionLabels.later ?? "Not now"));
12807
12813
  };
12808
12814
  cc();
12809
12815
  const Ue = (u, y, I) => u ? A.actOnInteraction(
@@ -12830,19 +12836,19 @@ async function lw(t = {}) {
12830
12836
  });
12831
12837
  });
12832
12838
  const lc = async () => {
12833
- P && (P.hidden = ue("tab_group_permission") === void 0);
12839
+ M && (M.hidden = ue("tab_group_permission") === void 0);
12834
12840
  };
12835
12841
  de?.addEventListener("click", () => {
12836
12842
  const u = ue("tab_group_permission");
12837
- P && (P.hidden = !0), Ue(u, "enable").catch(() => {
12843
+ M && (M.hidden = !0), Ue(u, "enable").catch(() => {
12838
12844
  });
12839
12845
  }), C?.addEventListener("click", () => {
12840
12846
  const u = ue("tab_group_permission");
12841
- P && (P.hidden = !0), Ue(u, "later").catch(() => {
12847
+ M && (M.hidden = !0), Ue(u, "later").catch(() => {
12842
12848
  });
12843
12849
  }), lc();
12844
12850
  let xn = null;
12845
- const ts = /* @__PURE__ */ new Map(), Ro = /* @__PURE__ */ new Map(), To = /* @__PURE__ */ new Map(), Gu = () => T.value.trim().length > 0 || nt.length > 0, dc = (u) => {
12851
+ const ts = /* @__PURE__ */ new Map(), Ro = /* @__PURE__ */ new Map(), To = /* @__PURE__ */ new Map(), Gu = () => P.value.trim().length > 0 || nt.length > 0, dc = (u) => {
12846
12852
  if (e.entrySurface === "extension_widget") {
12847
12853
  const y = e.billingStatus?.auth, I = y ? !!y.user : !!(u.user && !e.loginRequired), x = y ? !!y.workspace : !e.signupRequired;
12848
12854
  return I && x && xn !== null && xn > 0;
@@ -12880,15 +12886,15 @@ async function lw(t = {}) {
12880
12886
  }, yi = (u = {}) => {
12881
12887
  ft++, St.clear(), Ea(), Jt = null, be = null, oi = !1, ji.clear(), Qt = !0, st(!0, "newSession"), yt(), Ke = !1, Lt();
12882
12888
  const y = Promise.resolve(A.startNewSession(u));
12883
- return di = null, no.clear(), is.clear(), T.value = "", nt = [], ei(), ki(T), Ve(), Me(), fn(T, "new_chat"), _e(A.getState()), y;
12889
+ return di = null, no.clear(), is.clear(), P.value = "", nt = [], ei(), ki(P), Ve(), Me(), fn(P, "new_chat"), _e(A.getState()), y;
12884
12890
  }, pc = (u) => {
12885
12891
  window.requestAnimationFrame(() => {
12886
- Pe || U.hidden || b.visibilityState === "hidden" || Array.from(M.querySelectorAll("[data-message-key]")).some(
12892
+ Pe || U.hidden || b.visibilityState === "hidden" || Array.from(q.querySelectorAll("[data-message-key]")).some(
12887
12893
  (y) => u.has(y.dataset.messageKey)
12888
12894
  ) && Hi("proactive_suggestion_previous_chat_visible");
12889
12895
  });
12890
12896
  }, hc = () => new Set(
12891
- Array.from(M.querySelectorAll("[data-message-key]"), (u) => u.dataset.messageKey)
12897
+ Array.from(q.querySelectorAll("[data-message-key]"), (u) => u.dataset.messageKey)
12892
12898
  );
12893
12899
  ye?.addEventListener("click", async () => {
12894
12900
  const u = e.proactiveSuggestion;
@@ -12911,7 +12917,7 @@ async function lw(t = {}) {
12911
12917
  }
12912
12918
  gt();
12913
12919
  };
12914
- Q?.addEventListener("click", gc), B?.addEventListener("click", gc), Le?.addEventListener("click", async () => {
12920
+ X?.addEventListener("click", gc), B?.addEventListener("click", gc), Le?.addEventListener("click", async () => {
12915
12921
  const u = e.proactiveSuggestion;
12916
12922
  if (!u)
12917
12923
  return;
@@ -12921,9 +12927,9 @@ async function lw(t = {}) {
12921
12927
  const I = ue("proactive_suggestion");
12922
12928
  I && Ue(I, "edit").catch(() => {
12923
12929
  }), wt("Yes, but ", !0, !0, !0, "proactive_suggestion"), pc(y), window.requestAnimationFrame(() => {
12924
- T.dispatchEvent(new Event("input", { bubbles: !0 })), T.setSelectionRange(T.value.length, T.value.length);
12930
+ P.dispatchEvent(new Event("input", { bubbles: !0 })), P.setSelectionRange(P.value.length, P.value.length);
12925
12931
  });
12926
- }), ee?.addEventListener("click", () => {
12932
+ }), Z?.addEventListener("click", () => {
12927
12933
  const u = e.proactiveSuggestion;
12928
12934
  if (!u)
12929
12935
  return;
@@ -12959,7 +12965,7 @@ async function lw(t = {}) {
12959
12965
  "New chat",
12960
12966
  Fw(),
12961
12967
  !1
12962
- ), Bn.addEventListener("click", () => yi()), $e.insertBefore(Bn, Y));
12968
+ ), Bn.addEventListener("click", () => yi()), $e.insertBefore(Bn, J));
12963
12969
  }, zt = document.createElement("div");
12964
12970
  zt.className = "pluno-pa-widget__error";
12965
12971
  const Po = document.createTextNode("");
@@ -12991,7 +12997,7 @@ async function lw(t = {}) {
12991
12997
  });
12992
12998
  let kn = !1, wi = null, os = 0, Mo = 0;
12993
12999
  const _e = (u, y = {}) => {
12994
- qa(u) && (be = null), Ma = y.renderSource ?? "local", uo(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"), V.classList.remove("pluno-pa-widget__access-notice--login-only"), u = { ...u, messages: u.messages.map(($) => {
13000
+ qa(u) && (be = null), Ma = y.renderSource ?? "local", uo(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"), F.classList.remove("pluno-pa-widget__access-notice--login-only"), u = { ...u, messages: u.messages.map(($) => {
12995
13001
  if (!$.attachments?.some((Ge) => Ge.id && !Ge.fileUrl && Zn.has(Ge.id))) return $;
12996
13002
  const Ct = $.attachments.map((Ge) => {
12997
13003
  const bi = Ge.id ? Zn.get(Ge.id) : void 0;
@@ -13001,7 +13007,7 @@ async function lw(t = {}) {
13001
13007
  ...Object.getOwnPropertyDescriptors($),
13002
13008
  attachments: { value: Ct, enumerable: !0, configurable: !0 }
13003
13009
  });
13004
- }) }, Un(), Xt !== null && (window.clearTimeout(Xt), Xt = null), Lt(), gt(), Zs(), V.hidden = !e.loginRequired && !e.signupRequired, V.hidden && V.replaceChildren();
13010
+ }) }, Un(), Xt !== null && (window.clearTimeout(Xt), Xt = null), Lt(), gt(), Zs(), F.hidden = !e.loginRequired && !e.signupRequired, F.hidden && F.replaceChildren();
13005
13011
  const I = JSON.stringify([
13006
13012
  !!(e.loginRequired || e.signupRequired),
13007
13013
  u.lastError,
@@ -13010,16 +13016,16 @@ async function lw(t = {}) {
13010
13016
  on
13011
13017
  ]);
13012
13018
  if (yc !== I) {
13013
- yc = I, te.hidden = !!(e.loginRequired || e.signupRequired) || !u.lastError || Pi(u.lastErrorCode) !== "bottom_notice";
13014
- const $ = te.hidden ? "" : u.lastError ?? "";
13015
- Po.data !== $ && (Po.data = $), te.hidden ? zt.remove() : zt.parentElement !== te && te.appendChild(zt), u.lastErrorSecuritySettingsUrl ? (sn.href = u.lastErrorSecuritySettingsUrl, sn.parentElement !== zt && zt.insertBefore(sn, bt.parentElement ? bt : null)) : sn.remove(), u.lastErrorCode === "connection_failed" || u.lastErrorCode === "auth_reconnecting" ? (bt.disabled = on, bt.setAttribute("aria-busy", String(on)), fc.hidden = !on, mc.data = on ? "Trying" : "Try again", bt.parentElement !== zt && zt.appendChild(bt)) : bt.remove();
13019
+ yc = I, ee.hidden = !!(e.loginRequired || e.signupRequired) || !u.lastError || Pi(u.lastErrorCode) !== "bottom_notice";
13020
+ const $ = ee.hidden ? "" : u.lastError ?? "";
13021
+ Po.data !== $ && (Po.data = $), ee.hidden ? zt.remove() : zt.parentElement !== ee && ee.appendChild(zt), u.lastErrorSecuritySettingsUrl ? (sn.href = u.lastErrorSecuritySettingsUrl, sn.parentElement !== zt && zt.insertBefore(sn, bt.parentElement ? bt : null)) : sn.remove(), u.lastErrorCode === "connection_failed" || u.lastErrorCode === "auth_reconnecting" ? (bt.disabled = on, bt.setAttribute("aria-busy", String(on)), fc.hidden = !on, mc.data = on ? "Trying" : "Try again", bt.parentElement !== zt && zt.appendChild(bt)) : bt.remove();
13016
13022
  }
13017
13023
  if (e.loginRequired) {
13018
- Ki = "", ts.clear(), Ro.clear(), To.clear(), M.replaceChildren();
13024
+ Ki = "", ts.clear(), Ro.clear(), To.clear(), q.replaceChildren();
13019
13025
  const $ = e.billingStatus?.auth, Ct = e.extensionRuntime?.retryAuth;
13020
13026
  if ($?.status === "error" && ($.errorCode === "browser_session_unavailable" || $.errorCode === "backend_auth_pending") && Ct) {
13021
13027
  mr(
13022
- V,
13028
+ F,
13023
13029
  Ce,
13024
13030
  ss,
13025
13031
  fi,
@@ -13030,7 +13036,7 @@ async function lw(t = {}) {
13030
13036
  !1,
13031
13037
  void 0
13032
13038
  );
13033
- const Ge = V.querySelector(".pluno-pa-widget__login");
13039
+ const Ge = F.querySelector(".pluno-pa-widget__login");
13034
13040
  Ge.disabled = kn, Ge.setAttribute("aria-busy", String(kn)), kn && Ge.prepend(pn()), Ge.addEventListener("click", () => {
13035
13041
  const bi = ++os, rp = Mo;
13036
13042
  kn = !0, wi = null, _e(A.getState()), Ct().catch((Ic) => {
@@ -13041,8 +13047,8 @@ async function lw(t = {}) {
13041
13047
  });
13042
13048
  return;
13043
13049
  }
13044
- V.classList.add("pluno-pa-widget__access-notice--login-only"), mr(
13045
- V,
13050
+ F.classList.add("pluno-pa-widget__access-notice--login-only"), mr(
13051
+ F,
13046
13052
  Ce,
13047
13053
  ss,
13048
13054
  fi,
@@ -13055,8 +13061,8 @@ async function lw(t = {}) {
13055
13061
  return;
13056
13062
  }
13057
13063
  if (e.signupRequired) {
13058
- Ki = "", ts.clear(), Ro.clear(), To.clear(), M.replaceChildren(), mr(
13059
- V,
13064
+ Ki = "", ts.clear(), Ro.clear(), To.clear(), q.replaceChildren(), mr(
13065
+ F,
13060
13066
  Ce,
13061
13067
  ss,
13062
13068
  fi,
@@ -13074,11 +13080,11 @@ async function lw(t = {}) {
13074
13080
  u.status,
13075
13081
  u.user,
13076
13082
  Qi()
13077
- ]), O = x !== Ki;
13083
+ ]), D = x !== Ki;
13078
13084
  Ki = x;
13079
13085
  const re = Qt || Ot.enabled;
13080
- Qt = !1, (O || y.skipUnchangedTimeline !== !0) && lb(
13081
- M,
13086
+ Qt = !1, (D || y.skipUnchangedTimeline !== !0) && lb(
13087
+ q,
13082
13088
  le,
13083
13089
  Ce,
13084
13090
  ss,
@@ -13157,7 +13163,7 @@ async function lw(t = {}) {
13157
13163
  }
13158
13164
  } : void 0
13159
13165
  );
13160
- const Re = !!M.querySelector(
13166
+ const Re = !!q.querySelector(
13161
13167
  ".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)"
13162
13168
  );
13163
13169
  be && !be.observedWelcome && !Re && Ol(u) && (be.observedConversation = Da(u)), Ua(), Me(), gt();
@@ -13167,7 +13173,7 @@ async function lw(t = {}) {
13167
13173
  Xt = null, Pe || _e(A.getState());
13168
13174
  },
13169
13175
  Math.min(vc, 2147483647)
13170
- )), re ? (Zt = M.scrollTop, yt()) : O && Ol(u) && Lu();
13176
+ )), re ? (Zt = q.scrollTop, yt()) : D && Ol(u) && Lu();
13171
13177
  }, wc = () => {
13172
13178
  b.getSelection()?.isCollapsed !== !1 && mb(ts) && _e(A.getState());
13173
13179
  };
@@ -13210,8 +13216,8 @@ async function lw(t = {}) {
13210
13216
  bc(u), u.status === "connected" && (yo = !0, Jt && queueMicrotask(() => {
13211
13217
  nc();
13212
13218
  })), lc();
13213
- const I = Co && !u.isThinking, x = Oa !== location.origin || La !== u.sessionId || Na !== (u.user?.id ?? null), O = Co !== u.isThinking, re = so !== "connected" && u.status === "connected", Re = so === "connected" && u.status !== "connected";
13214
- Oa = location.origin, La = u.sessionId, Na = u.user?.id ?? null, so = u.status, Co = u.isThinking, Re && it !== null && (window.clearTimeout(it), it = null), r.classList.contains("pluno-pa-widget--open") && u.status === "connected" && (x || O || re) && ao(), me && (me.hidden = ue("task_notifications") === void 0), P && (P.hidden = ue("tab_group_permission") === void 0), I && !r.classList.contains("pluno-pa-widget--open") && (hi = !0), vo(), u.appearance ? (Eo = !0, Xe(
13219
+ const I = Co && !u.isThinking, x = Oa !== location.origin || La !== u.sessionId || Na !== (u.user?.id ?? null), D = Co !== u.isThinking, re = so !== "connected" && u.status === "connected", Re = so === "connected" && u.status !== "connected";
13220
+ Oa = location.origin, La = u.sessionId, Na = u.user?.id ?? null, so = u.status, Co = u.isThinking, Re && it !== null && (window.clearTimeout(it), it = null), r.classList.contains("pluno-pa-widget--open") && u.status === "connected" && (x || D || re) && ao(), me && (me.hidden = ue("task_notifications") === void 0), M && (M.hidden = ue("tab_group_permission") === void 0), I && !r.classList.contains("pluno-pa-widget--open") && (hi = !0), vo(), u.appearance ? (Eo = !0, Xe(
13215
13221
  "web-sdk.widget",
13216
13222
  "Agent state supplied appearance",
13217
13223
  {
@@ -13229,9 +13235,9 @@ async function lw(t = {}) {
13229
13235
  });
13230
13236
  const _c = A.getState();
13231
13237
  bc(_c), _e(_c), Me(), Io();
13232
- const tp = Ap(r, (u, y, I, x, O) => {
13238
+ const tp = Ap(r, (u, y, I, x, D) => {
13233
13239
  const re = lp(A.getState(), x);
13234
- A.reportDisplayedError?.(u, y, I, re ?? void 0, O);
13240
+ A.reportDisplayedError?.(u, y, I, re ?? void 0, D);
13235
13241
  }), np = Ty(
13236
13242
  o,
13237
13243
  r,
@@ -13246,7 +13252,7 @@ async function lw(t = {}) {
13246
13252
  u.scribbleStyle !== void 0 && (e.scribbleStyle = u.scribbleStyle), Lo(u, "widgetHandle.updateAppearance");
13247
13253
  },
13248
13254
  openPanel: (u) => {
13249
- const y = typeof u == "string" ? u : T.value, I = typeof u == "object" ? u.focusComposer !== !1 : !0, x = typeof u == "object" ? u.trigger ?? "external_request" : "external_request";
13255
+ const y = typeof u == "string" ? u : P.value, I = typeof u == "object" ? u.focusComposer !== !1 : !0, x = typeof u == "object" ? u.trigger ?? "external_request" : "external_request";
13250
13256
  wt(y, !1, I, !0, x);
13251
13257
  },
13252
13258
  closePanel: ho,
@@ -13331,21 +13337,21 @@ async function lw(t = {}) {
13331
13337
  }
13332
13338
  }
13333
13339
  function Lo(u, y) {
13334
- const I = u.accentColor ?? e.accentColor, x = u.colorScheme ?? e.colorScheme, O = u.fontFamily ?? e.fontFamily, re = u.scribbleStyle ?? e.scribbleStyle, Re = JSON.stringify([I, x, O, re]);
13340
+ const I = u.accentColor ?? e.accentColor, x = u.colorScheme ?? e.colorScheme, D = u.fontFamily ?? e.fontFamily, re = u.scribbleStyle ?? e.scribbleStyle, Re = JSON.stringify([I, x, D, re]);
13335
13341
  Re !== f && (f = Re, c = Rl(
13336
13342
  I,
13337
13343
  re
13338
13344
  ), Tl(r, c, {
13339
13345
  accentColor: I,
13340
13346
  colorScheme: x,
13341
- fontFamily: O,
13347
+ fontFamily: D,
13342
13348
  scribbleStyle: re
13343
13349
  }), Xe("web-sdk.widget", "Updated widget appearance", {
13344
13350
  source: y,
13345
13351
  inputAppearance: u,
13346
13352
  appliedAccentColor: I,
13347
13353
  appliedColorScheme: x,
13348
- appliedFontFamily: O,
13354
+ appliedFontFamily: D,
13349
13355
  appliedScribbleStyle: re,
13350
13356
  cssAccent: r.style.getPropertyValue("--pluno-pa-accent")
13351
13357
  }));
@@ -14477,7 +14483,7 @@ function Bw(t, e) {
14477
14483
  ), s;
14478
14484
  }
14479
14485
  function wu() {
14480
- return oe("svg", {
14486
+ return se("svg", {
14481
14487
  xmlns: pu,
14482
14488
  viewBox: "0 0 1254 1254"
14483
14489
  });
@@ -14528,7 +14534,7 @@ function Bl(t, e, n, i, s, o, a, r) {
14528
14534
  });
14529
14535
  }
14530
14536
  function j(t, e, n = {}) {
14531
- const i = oe(e, n);
14537
+ const i = se(e, n);
14532
14538
  return t.appendChild(i), i;
14533
14539
  }
14534
14540
  function De(t, e, n, i) {
@@ -14543,13 +14549,13 @@ function Js(t, e, n, i) {
14543
14549
  return s.type = "button", s.className = t, s.setAttribute("aria-label", e), s.title = e, s.hidden = i, s.appendChild(n), s;
14544
14550
  }
14545
14551
  function $w() {
14546
- const t = oe("svg", {
14552
+ const t = se("svg", {
14547
14553
  class: "pluno-pa-widget__scribble-defs",
14548
14554
  "aria-hidden": "true",
14549
14555
  focusable: "false",
14550
14556
  width: "0",
14551
14557
  height: "0"
14552
- }), e = oe("defs");
14558
+ }), e = se("defs");
14553
14559
  return e.appendChild(fr("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
14554
14560
  fr("pluno-pa-scribble-wobble-2", "5", "15")
14555
14561
  ), e.appendChild(
@@ -14557,7 +14563,7 @@ function $w() {
14557
14563
  ), t.appendChild(e), t;
14558
14564
  }
14559
14565
  function bu(t, e) {
14560
- const n = oe("svg", {
14566
+ const n = se("svg", {
14561
14567
  class: `pluno-pa-widget__scribble-spirals ${t}`,
14562
14568
  preserveAspectRatio: "xMidYMid meet",
14563
14569
  "aria-hidden": "true",
@@ -14588,11 +14594,11 @@ function _u(t, e) {
14588
14594
  `0 0 ${n} ${nw}`
14589
14595
  ), t.replaceChildren();
14590
14596
  for (let i = 0; i < e; i += 1) {
14591
- const s = Cl[i % Cl.length], o = oe("g", {
14597
+ const s = Cl[i % Cl.length], o = se("g", {
14592
14598
  transform: `translate(${Hr + i * Kr} 0)`
14593
14599
  });
14594
14600
  o.appendChild(
14595
- oe("ellipse", {
14601
+ se("ellipse", {
14596
14602
  cx: s.ellipseCx,
14597
14603
  cy: s.ellipseCy,
14598
14604
  rx: s.ellipseRx,
@@ -14603,7 +14609,7 @@ function _u(t, e) {
14603
14609
  opacity: "0.8"
14604
14610
  })
14605
14611
  ), o.appendChild(
14606
- oe("path", {
14612
+ se("path", {
14607
14613
  d: s.path,
14608
14614
  fill: "none",
14609
14615
  stroke: "#2c2a1e",
@@ -14614,7 +14620,7 @@ function _u(t, e) {
14614
14620
  }
14615
14621
  }
14616
14622
  function fr(t, e, n) {
14617
- const i = oe("filter", {
14623
+ const i = se("filter", {
14618
14624
  id: t,
14619
14625
  x: "-8%",
14620
14626
  y: "-8%",
@@ -14622,7 +14628,7 @@ function fr(t, e, n) {
14622
14628
  height: "116%"
14623
14629
  });
14624
14630
  return i.appendChild(
14625
- oe("feTurbulence", {
14631
+ se("feTurbulence", {
14626
14632
  type: "fractalNoise",
14627
14633
  baseFrequency: "0.012 0.028",
14628
14634
  numOctaves: "3",
@@ -14630,7 +14636,7 @@ function fr(t, e, n) {
14630
14636
  result: "stroke-noise"
14631
14637
  })
14632
14638
  ), i.appendChild(
14633
- oe("feDisplacementMap", {
14639
+ se("feDisplacementMap", {
14634
14640
  in: "SourceGraphic",
14635
14641
  in2: "stroke-noise",
14636
14642
  scale: "3.5",
@@ -14639,7 +14645,7 @@ function fr(t, e, n) {
14639
14645
  result: "warped"
14640
14646
  })
14641
14647
  ), i.appendChild(
14642
- oe("feTurbulence", {
14648
+ se("feTurbulence", {
14643
14649
  type: "fractalNoise",
14644
14650
  baseFrequency: "0.7",
14645
14651
  numOctaves: "1",
@@ -14647,7 +14653,7 @@ function fr(t, e, n) {
14647
14653
  result: "ink-noise"
14648
14654
  })
14649
14655
  ), i.appendChild(
14650
- oe("feDisplacementMap", {
14656
+ se("feDisplacementMap", {
14651
14657
  in: "warped",
14652
14658
  in2: "ink-noise",
14653
14659
  scale: "0.9",
@@ -14665,7 +14671,7 @@ function Gr(t) {
14665
14671
  "currentColor",
14666
14672
  "2.25"
14667
14673
  );
14668
- return e.appendChild(oe("path", { d: "m6 9 6 6 6-6" })), e;
14674
+ return e.appendChild(se("path", { d: "m6 9 6 6 6-6" })), e;
14669
14675
  }
14670
14676
  function Fw() {
14671
14677
  const t = pt(
@@ -14677,11 +14683,11 @@ function Fw() {
14677
14683
  "2.25"
14678
14684
  );
14679
14685
  return t.appendChild(
14680
- oe("path", {
14686
+ se("path", {
14681
14687
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
14682
14688
  })
14683
14689
  ), t.appendChild(
14684
- oe("path", {
14690
+ se("path", {
14685
14691
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
14686
14692
  })
14687
14693
  ), t;
@@ -14696,10 +14702,10 @@ function jw() {
14696
14702
  "2.25"
14697
14703
  );
14698
14704
  return t.appendChild(
14699
- oe("path", {
14705
+ se("path", {
14700
14706
  d: "M17 3a2.85 2.85 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5Z"
14701
14707
  })
14702
- ), t.appendChild(oe("path", { d: "m15 5 4 4" })), t;
14708
+ ), t.appendChild(se("path", { d: "m15 5 4 4" })), t;
14703
14709
  }
14704
14710
  function Kw() {
14705
14711
  const t = pt(
@@ -14710,7 +14716,7 @@ function Kw() {
14710
14716
  "currentColor",
14711
14717
  "2.25"
14712
14718
  );
14713
- return t.appendChild(oe("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), t.appendChild(oe("path", { d: "M3 4v5h5" })), t.appendChild(oe("path", { d: "M12 7v5l3 2" })), t;
14719
+ return t.appendChild(se("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), t.appendChild(se("path", { d: "M3 4v5h5" })), t.appendChild(se("path", { d: "M12 7v5l3 2" })), t;
14714
14720
  }
14715
14721
  function Hw(t) {
14716
14722
  const e = pt(
@@ -14726,7 +14732,7 @@ function Hw(t) {
14726
14732
  ...Jg,
14727
14733
  ...Yg(t)
14728
14734
  ])
14729
- e.appendChild(oe("path", { d: n }));
14735
+ e.appendChild(se("path", { d: n }));
14730
14736
  return e;
14731
14737
  }
14732
14738
  function _a() {
@@ -14738,7 +14744,7 @@ function _a() {
14738
14744
  "currentColor",
14739
14745
  "2.4"
14740
14746
  );
14741
- return t.appendChild(oe("path", { d: "M18 6 6 18" })), t.appendChild(oe("path", { d: "m6 6 12 12" })), t;
14747
+ return t.appendChild(se("path", { d: "M18 6 6 18" })), t.appendChild(se("path", { d: "m6 6 12 12" })), t;
14742
14748
  }
14743
14749
  function vu() {
14744
14750
  const t = pt(
@@ -14750,8 +14756,8 @@ function vu() {
14750
14756
  "2.75"
14751
14757
  );
14752
14758
  return t.appendChild(
14753
- oe("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
14754
- ), t.appendChild(oe("polyline", { points: "5 12 12 5 19 12" })), t;
14759
+ se("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
14760
+ ), t.appendChild(se("polyline", { points: "5 12 12 5 19 12" })), t;
14755
14761
  }
14756
14762
  function Ww() {
14757
14763
  const t = pt(
@@ -14766,7 +14772,7 @@ function Ww() {
14766
14772
  "class",
14767
14773
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
14768
14774
  ), t.appendChild(
14769
- oe("path", {
14775
+ se("path", {
14770
14776
  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"
14771
14777
  })
14772
14778
  ), t;
@@ -14777,7 +14783,7 @@ function Vw() {
14777
14783
  "class",
14778
14784
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
14779
14785
  ), t.appendChild(
14780
- oe("path", {
14786
+ se("path", {
14781
14787
  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",
14782
14788
  stroke: "currentColor",
14783
14789
  "stroke-width": "2",
@@ -14789,7 +14795,7 @@ function Vw() {
14789
14795
  function Gw() {
14790
14796
  const t = pt("0 0 24 24", 18, 18, "currentColor");
14791
14797
  return t.appendChild(
14792
- oe("rect", {
14798
+ se("rect", {
14793
14799
  x: "6",
14794
14800
  y: "6",
14795
14801
  width: "12",
@@ -14807,7 +14813,7 @@ function Jw() {
14807
14813
  "currentColor",
14808
14814
  "2.4"
14809
14815
  );
14810
- return t.appendChild(oe("path", { d: "M18 6 6 18" })), t.appendChild(oe("path", { d: "m6 6 12 12" })), t;
14816
+ return t.appendChild(se("path", { d: "M18 6 6 18" })), t.appendChild(se("path", { d: "m6 6 12 12" })), t;
14811
14817
  }
14812
14818
  function Yw() {
14813
14819
  const t = pt(
@@ -14819,7 +14825,7 @@ function Yw() {
14819
14825
  "2.25"
14820
14826
  );
14821
14827
  return t.appendChild(
14822
- oe("rect", {
14828
+ se("rect", {
14823
14829
  width: "14",
14824
14830
  height: "14",
14825
14831
  x: "8",
@@ -14828,7 +14834,7 @@ function Yw() {
14828
14834
  ry: "2"
14829
14835
  })
14830
14836
  ), t.appendChild(
14831
- oe("path", {
14837
+ se("path", {
14832
14838
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
14833
14839
  })
14834
14840
  ), t;
@@ -14841,9 +14847,9 @@ function pt(t, e, n, i, s, o) {
14841
14847
  fill: i,
14842
14848
  "aria-hidden": "true"
14843
14849
  };
14844
- return s && (a.stroke = s, a["stroke-linecap"] = "round", a["stroke-linejoin"] = "round"), o && (a["stroke-width"] = o), oe("svg", a);
14850
+ return s && (a.stroke = s, a["stroke-linecap"] = "round", a["stroke-linejoin"] = "round"), o && (a["stroke-width"] = o), se("svg", a);
14845
14851
  }
14846
- function oe(t, e = {}) {
14852
+ function se(t, e = {}) {
14847
14853
  const n = document.createElementNS(pu, t);
14848
14854
  for (const [i, s] of Object.entries(e))
14849
14855
  n.setAttribute(i, s);
@@ -15127,8 +15133,8 @@ function jl(t, e) {
15127
15133
  const i = n[1], s = e ? "Finding example tasks..." : " ";
15128
15134
  i.textContent !== s && (i.textContent = s), i.classList.toggle("pluno-pa-widget__starter-placeholder--loading", e), i.parentElement.setAttribute("aria-hidden", String(!e));
15129
15135
  }
15130
- function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K, U, ge, G, q, D) {
15131
- const F = (C) => {
15136
+ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K, U, he, G, oe, R) {
15137
+ const V = (C) => {
15132
15138
  const k = G.states.get(C.authRequestId) ?? { status: G.initialStatus }, N = `integration-retry:${C.authRequestId}`, ye = `integration-connect:${C.authRequestId}`, Le = K?.has(N) ? "retry" : K?.has(ye) ? "connect" : null;
15133
15139
  return db(
15134
15140
  C,
@@ -15137,11 +15143,11 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15137
15143
  G.presentations.get(C.authRequestId),
15138
15144
  Le
15139
15145
  );
15140
- }, J = bp(o), S = _b(o), V = Array.isArray(o.activeScheduledFollowUps) ? o.activeScheduledFollowUps : null, te = /* @__PURE__ */ new Map();
15141
- if (V !== null)
15142
- for (const C of V) {
15146
+ }, O = bp(o), S = _b(o), F = Array.isArray(o.activeScheduledFollowUps) ? o.activeScheduledFollowUps : null, ee = /* @__PURE__ */ new Map();
15147
+ if (F !== null)
15148
+ for (const C of F) {
15143
15149
  const k = Jn(C.dueAt);
15144
- k && te.set(C.taskId, { dueAt: C.dueAt, label: k });
15150
+ k && ee.set(C.taskId, { dueAt: C.dueAt, label: k });
15145
15151
  }
15146
15152
  else
15147
15153
  for (const C of S) {
@@ -15149,62 +15155,62 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15149
15155
  if (!k || !C.scheduledCheckInAt)
15150
15156
  continue;
15151
15157
  const N = C.scheduledCheckInId ?? C.id;
15152
- te.set(N, {
15158
+ ee.set(N, {
15153
15159
  dueAt: C.scheduledCheckInAt,
15154
15160
  label: k
15155
15161
  });
15156
15162
  }
15157
- const ce = [...te.values()].sort((C, k) => Date.parse(C.dueAt) - Date.parse(k.dueAt)), ne = vb(
15163
+ const ce = [...ee.values()].sort((C, k) => Date.parse(C.dueAt) - Date.parse(k.dueAt)), te = vb(
15158
15164
  S.filter(
15159
15165
  (C) => !Cu(C) && !C.scheduledCheckInAt
15160
15166
  ),
15161
15167
  o.segments
15162
15168
  ), Se = new Map((o.segments ?? []).flatMap((C) => C.activityIds.map((k) => [k, C])));
15163
15169
  t.dataset.selectedSessionId = o.sessionId ?? "", t.dataset.loadingSession = String(o.isLoadingSession);
15164
- const T = o.activeResponseUserMessageId;
15165
- if (J.showProgress && o.turnPhase && !o.assistantDraft && T) {
15166
- const C = ne.findIndex(
15167
- (N) => N.role === "user" && N.id === T
15168
- ), k = ne.some(
15169
- (N) => N.role !== "user" && N.respondsToUserMessageId === T
15170
+ const P = o.activeResponseUserMessageId;
15171
+ if (O.showProgress && o.turnPhase && !o.assistantDraft && P) {
15172
+ const C = te.findIndex(
15173
+ (N) => N.role === "user" && N.id === P
15174
+ ), k = te.some(
15175
+ (N) => N.role !== "user" && N.respondsToUserMessageId === P
15170
15176
  );
15171
- C !== -1 && !k && ne.splice(C + 1, 0, {
15172
- id: `turn-status:${T}`,
15177
+ C !== -1 && !k && te.splice(C + 1, 0, {
15178
+ id: `turn-status:${P}`,
15173
15179
  role: "system",
15174
15180
  content: "",
15175
- createdAt: ne[C].createdAt,
15176
- respondsToUserMessageId: T,
15181
+ createdAt: te[C].createdAt,
15182
+ respondsToUserMessageId: P,
15177
15183
  dataType: "run_status",
15178
15184
  loading: !0
15179
15185
  });
15180
15186
  }
15181
- const fe = t.scrollTop, Oe = [], et = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(), Y = (C) => {
15187
+ const fe = t.scrollTop, Oe = [], et = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(), J = (C) => {
15182
15188
  C === e && Oe.push(t.querySelector('slot[name="conversation-notices"]') ?? fu("conversation-notices")), C.dataset.sessionId = o.sessionId ?? "", Oe.push(C);
15183
15189
  };
15184
15190
  Sa(n, o.isThinking), n.disabled = !1, s.hidden = !r, r && a !== null && yu(s, a);
15185
- const tt = !!(G?.requests.length || q || D?.candidate), z = tt || ne.length > 0 || ce.length > 0 || !!o.assistantDraft || o.pendingMessageStatus !== null || o.isThinking;
15191
+ const tt = !!(G?.requests.length || oe || R?.candidate), z = tt || te.length > 0 || ce.length > 0 || !!o.assistantDraft || o.pendingMessageStatus !== null || o.isThinking;
15186
15192
  if (i(z || !!o.historyPreparation), o.historyPreparation && z) {
15187
15193
  const C = document.createElement("div");
15188
- C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status"), C.append(pn(), document.createTextNode("Preparing this conversation…")), Y(C);
15194
+ C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status"), C.append(pn(), document.createTextNode("Preparing this conversation…")), J(C);
15189
15195
  }
15190
15196
  if (o.isLoadingSession && !z) {
15191
15197
  const C = document.createElement("div");
15192
15198
  C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status");
15193
15199
  const k = document.createElement("span");
15194
- k.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", C.append(pn(), k), d.clear(), h.clear(), g.clear(), Y(C), Y(e), Tt(t, Oe);
15200
+ k.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", C.append(pn(), k), d.clear(), h.clear(), g.clear(), J(C), J(e), Tt(t, Oe);
15195
15201
  return;
15196
15202
  }
15197
15203
  if (!z && o.sessionId && !o.isDraftSession) {
15198
15204
  if (!o.lastError) {
15199
15205
  const C = document.createElement("div");
15200
- C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--conversation", C.textContent = wp, Y(C);
15206
+ C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--conversation", C.textContent = wp, J(C);
15201
15207
  }
15202
15208
  if (!o.lastError || Pi(o.lastErrorCode) === "bottom_notice") {
15203
- Y(e), Tt(t, Oe);
15209
+ J(e), Tt(t, Oe);
15204
15210
  return;
15205
15211
  }
15206
15212
  }
15207
- if (ne.length === 0 && !tt && ce.length === 0 && !o.assistantDraft && (!o.lastError || Pi(o.lastErrorCode) === "bottom_notice") && !o.pendingMessageStatus && !o.isThinking) {
15213
+ if (te.length === 0 && !tt && ce.length === 0 && !o.assistantDraft && (!o.lastError || Pi(o.lastErrorCode) === "bottom_notice") && !o.pendingMessageStatus && !o.isThinking) {
15208
15214
  const C = JSON.stringify([
15209
15215
  o.sessionId,
15210
15216
  o.user?.id,
@@ -15213,7 +15219,7 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15213
15219
  f()
15214
15220
  ]), k = d.get("welcome");
15215
15221
  if (k?.renderSignature === C) {
15216
- jl(k.node, o.starterPromptsLoading), Y(k.node), Y(e), Tt(t, Oe);
15222
+ jl(k.node, o.starterPromptsLoading), J(k.node), J(e), Tt(t, Oe);
15217
15223
  return;
15218
15224
  }
15219
15225
  const N = document.createElement("div");
@@ -15225,121 +15231,121 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15225
15231
  f()
15226
15232
  );
15227
15233
  if (ye.appendChild(Le), N.appendChild(ye), _) {
15228
- const ee = document.createElement("h2");
15229
- ee.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", ee.textContent = _.opening, N.appendChild(ee);
15234
+ const Z = document.createElement("h2");
15235
+ Z.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", Z.textContent = _.opening, N.appendChild(Z);
15230
15236
  } else
15231
15237
  N.appendChild(mu());
15232
- const Q = _?.prompts ?? o.starterPrompts, B = document.createElement("div");
15233
- if (B.className = Q.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Q.length === 0 && !o.starterPromptsLoading && B.setAttribute("aria-hidden", "true"), Q.length > 0)
15234
- for (const ee of Q) {
15238
+ const X = _?.prompts ?? o.starterPrompts, B = document.createElement("div");
15239
+ if (B.className = X.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", X.length === 0 && !o.starterPromptsLoading && B.setAttribute("aria-hidden", "true"), X.length > 0)
15240
+ for (const Z of X) {
15235
15241
  const ae = document.createElement("button");
15236
- ae.type = "button", ae.className = "pluno-pa-widget__starter-prompt", ae.textContent = ee, ae.addEventListener("click", () => {
15237
- w(ee);
15242
+ ae.type = "button", ae.className = "pluno-pa-widget__starter-prompt", ae.textContent = Z, ae.addEventListener("click", () => {
15243
+ w(Z);
15238
15244
  }), B.appendChild(ae);
15239
15245
  }
15240
15246
  else
15241
- for (let ee = 0; ee < jy; ee += 1) {
15247
+ for (let Z = 0; Z < jy; Z += 1) {
15242
15248
  const ae = document.createElement("div");
15243
- ae.className = "pluno-pa-widget__starter-placeholder", ee === 1 && ae.setAttribute("role", "status"), ae.textContent = " ", B.appendChild(ae);
15249
+ ae.className = "pluno-pa-widget__starter-placeholder", Z === 1 && ae.setAttribute("role", "status"), ae.textContent = " ", B.appendChild(ae);
15244
15250
  }
15245
15251
  if (N.appendChild(B), jl(N, o.starterPromptsLoading), _) {
15246
- const ee = document.createElement("button");
15247
- ee.type = "button", ee.className = "pluno-pa-widget__morning-report-snooze", ee.textContent = "Snooze morning report", ee.addEventListener("click", v), N.appendChild(ee);
15252
+ const Z = document.createElement("button");
15253
+ Z.type = "button", Z.className = "pluno-pa-widget__morning-report-snooze", Z.textContent = "Snooze morning report", Z.addEventListener("click", v), N.appendChild(Z);
15248
15254
  }
15249
- d.clear(), h.clear(), g.clear(), Y(N), d.set("welcome", { node: N, renderSignature: C }), Y(e), Tt(t, Oe);
15255
+ d.clear(), h.clear(), g.clear(), J(N), d.set("welcome", { node: N, renderSignature: C }), J(e), Tt(t, Oe);
15250
15256
  return;
15251
15257
  }
15252
- let X = null, H = null, se = [], ve = [];
15253
- const W = ne.some(Yr), M = ne.some(
15258
+ let Y = null, H = null, ie = [], ve = [];
15259
+ const W = te.some(Yr), q = te.some(
15254
15260
  (C) => C.role === "tool" && C.id === o.activity?.activeItemId
15255
15261
  ), le = o.turnPhase ? Ey(o.turnPhase) : "Thinking...";
15256
15262
  let me = !1;
15257
15263
  const ke = () => {
15258
- if (se.length === 0)
15264
+ if (ie.length === 0)
15259
15265
  return me = !1, !1;
15260
- const C = J.showProgress && se.some(
15266
+ const C = O.showProgress && ie.some(
15261
15267
  (N) => N.id === o.activity?.activeItemId
15262
15268
  ), k = Ab(
15263
- se,
15269
+ ie,
15264
15270
  C,
15265
15271
  p,
15266
15272
  h,
15267
15273
  Ce,
15268
15274
  m,
15269
15275
  f(),
15270
- Se.get(se[0].id)?.collapsed ?? !0
15276
+ Se.get(ie[0].id)?.collapsed ?? !0
15271
15277
  );
15272
- return Y(k), X = null, H = k, se = [], me = C, !0;
15278
+ return J(k), Y = null, H = k, ie = [], me = C, !0;
15273
15279
  }, Fe = /* @__PURE__ */ new Set();
15274
15280
  let ht = !1;
15275
15281
  const je = () => {
15276
15282
  for (const C of ve)
15277
- Y(C), X = null, H = C;
15283
+ J(C), Y = null, H = C;
15278
15284
  ve = [];
15279
15285
  };
15280
- for (let C = 0; C < ne.length; C += 1) {
15281
- const k = ne[C];
15286
+ for (let C = 0; C < te.length; C += 1) {
15287
+ const k = te[C];
15282
15288
  if (k.role === "tool" && k.integrationAuthRequest && G) {
15283
15289
  Fe.add(k.integrationAuthRequest.authRequestId);
15284
- const B = F(k.integrationAuthRequest);
15290
+ const B = V(k.integrationAuthRequest);
15285
15291
  ve.push(B);
15286
15292
  continue;
15287
15293
  }
15288
- if (k.role === "tool" && k.personalChannelConnectionRequest && q) {
15294
+ if (k.role === "tool" && k.personalChannelConnectionRequest && oe) {
15289
15295
  ht = !0, ve.push(
15290
15296
  Kl(
15291
15297
  k.personalChannelConnectionRequest,
15292
- q.onConnect,
15293
- q.presentation
15298
+ oe.onConnect,
15299
+ oe.presentation
15294
15300
  )
15295
15301
  );
15296
15302
  continue;
15297
15303
  }
15298
15304
  if (k.role === "tool") {
15299
- se.length > 0 && Se.get(se[0].id)?.id !== Se.get(k.id)?.id && ke(), se.push(k);
15305
+ ie.length > 0 && Se.get(ie[0].id)?.id !== Se.get(k.id)?.id && ke(), ie.push(k);
15300
15306
  continue;
15301
15307
  }
15302
15308
  if (k.role === "system" && k.dataType === "run_status" && k.steered === !0) {
15303
15309
  if (!ke()) {
15304
- const ee = Pb(f());
15305
- Y(ee), X = null, H = ee;
15310
+ const Z = Pb(f());
15311
+ J(Z), Y = null, H = Z;
15306
15312
  }
15307
15313
  continue;
15308
15314
  }
15309
15315
  if (Yr(k)) {
15310
- if (!J.showProgress)
15316
+ if (!O.showProgress)
15311
15317
  continue;
15312
- const B = ke(), ee = Eu(k);
15318
+ const B = ke(), Z = Eu(k);
15313
15319
  if (B) {
15314
15320
  if (!me) {
15315
15321
  const ae = Vl(
15316
15322
  g,
15317
15323
  $e,
15318
- ee,
15324
+ Z,
15319
15325
  le
15320
15326
  );
15321
- Y(ae), X = null, H = ae;
15327
+ J(ae), Y = null, H = ae;
15322
15328
  }
15323
15329
  } else {
15324
15330
  const ae = Wl(
15325
15331
  g,
15326
15332
  $e,
15327
- ee,
15333
+ Z,
15328
15334
  f(),
15329
15335
  le
15330
15336
  );
15331
- Y(ae), X = null, H = ae;
15337
+ J(ae), Y = null, H = ae;
15332
15338
  }
15333
15339
  continue;
15334
15340
  }
15335
15341
  if (k.role === "system") {
15336
15342
  if (k.dataType === "run_error" || k.dataType === "run_status") {
15337
- const B = ke(), ee = ne.some(
15343
+ const B = ke(), Z = te.some(
15338
15344
  (we) => we.role === "tool" && Ns(we, k)
15339
15345
  );
15340
- if (!B && !ee) {
15346
+ if (!B && !Z) {
15341
15347
  const we = Oi(f());
15342
- we.classList.add("pluno-pa-widget__terminal-marker"), Y(we);
15348
+ we.classList.add("pluno-pa-widget__terminal-marker"), J(we);
15343
15349
  }
15344
15350
  const ae = document.createElement("div"), hn = k.dataType === "run_error";
15345
15351
  if (ae.className = hn ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", ae.dataset.messageKey = Ia(k), ae.dataset.canonicalItemKey = k.id, ae.dataset.messageRole = "system", k.provisional || (ae.dataset.terminalResponseKey = k.id), k.runId && (ae.dataset.runId = k.runId), ae.textContent = Us(
@@ -15348,35 +15354,35 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15348
15354
  const we = document.createElement("a");
15349
15355
  we.className = "pluno-pa-widget__error-retry", we.href = k.securitySettingsUrl, we.target = "_blank", we.rel = "noreferrer", we.textContent = "Security settings", ae.appendChild(we);
15350
15356
  }
15351
- Y(ae), X = hn ? ae : null, H = hn ? null : ae, je();
15357
+ J(ae), Y = hn ? ae : null, H = hn ? null : ae, je();
15352
15358
  }
15353
15359
  continue;
15354
15360
  }
15355
15361
  k.role === "user" && je();
15356
- const N = ke(), ye = Us(k.content), Le = k.role === "assistant" && ne.some(
15362
+ const N = ke(), ye = Us(k.content), Le = k.role === "assistant" && te.some(
15357
15363
  (B) => B.role === "tool" && Ns(B, k)
15358
15364
  );
15359
15365
  if (k.role === "assistant" && !N && !Le) {
15360
15366
  const B = Oi(f());
15361
- Y(B), X = null, H = B;
15367
+ J(B), Y = null, H = B;
15362
15368
  }
15363
- const Q = ub(
15369
+ const X = ub(
15364
15370
  k,
15365
15371
  ye,
15366
15372
  d,
15367
15373
  et,
15368
- ge
15374
+ he
15369
15375
  );
15370
- if (Q.querySelector("[data-submission-retry]")?.remove(), k.role === "user" && k.retryable) {
15376
+ if (X.querySelector("[data-submission-retry]")?.remove(), k.role === "user" && k.retryable) {
15371
15377
  const B = document.createElement("button");
15372
- B.type = "button", B.className = "pluno-pa-widget__error-retry", B.dataset.submissionRetry = k.id, B.textContent = "Retry this message", B.addEventListener("click", () => b(k.id)), Q.appendChild(B);
15378
+ B.type = "button", B.className = "pluno-pa-widget__error-retry", B.dataset.submissionRetry = k.id, B.textContent = "Retry this message", B.addEventListener("click", () => b(k.id)), X.appendChild(B);
15373
15379
  }
15374
- Y(Q), X = Q, H = null, k.role === "assistant" && je();
15380
+ J(X), Y = X, H = null, k.role === "assistant" && je();
15375
15381
  }
15376
- const P = ke(), Z = ne[ne.length - 1]?.role === "assistant";
15377
- if (J.showProgress && o.turnPhase && !o.assistantDraft && !M && !Z && !W) {
15382
+ const M = ke(), Q = te[te.length - 1]?.role === "assistant";
15383
+ if (O.showProgress && o.turnPhase && !o.assistantDraft && !q && !Q && !W) {
15378
15384
  const C = o.activeResponseUserMessageId ? `response:${o.activeResponseUserMessageId}` : `session:${o.sessionId ?? "pending"}`;
15379
- if (P) {
15385
+ if (M) {
15380
15386
  if (!me) {
15381
15387
  const k = Vl(
15382
15388
  g,
@@ -15384,7 +15390,7 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15384
15390
  C,
15385
15391
  le
15386
15392
  );
15387
- Y(k), X = null, H = k;
15393
+ J(k), Y = null, H = k;
15388
15394
  }
15389
15395
  } else {
15390
15396
  const k = Wl(
@@ -15394,54 +15400,54 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15394
15400
  f(),
15395
15401
  le
15396
15402
  );
15397
- Y(k), X = null, H = k;
15403
+ J(k), Y = null, H = k;
15398
15404
  }
15399
15405
  }
15400
15406
  if (o.lastError && Pi(o.lastErrorCode) === "conversation") {
15401
- const N = ne.slice(ne.map((Q) => Q.role).lastIndexOf("user") + 1).some((Q) => Q.role === "assistant" || Q.role === "tool") ? document.createElement("article") : Oi(f());
15407
+ const N = te.slice(te.map((X) => X.role).lastIndexOf("user") + 1).some((X) => X.role === "assistant" || X.role === "tool") ? document.createElement("article") : Oi(f());
15402
15408
  N.classList.add("pluno-pa-widget__terminal-marker");
15403
15409
  const ye = document.createElement("div");
15404
15410
  ye.className = "pluno-pa-widget__error", o.historyRefreshFailure && (ye.dataset.historyRefreshFailure = JSON.stringify(o.historyRefreshFailure));
15405
15411
  const Le = document.createElement("span");
15406
15412
  if (Le.textContent = o.lastError, ye.appendChild(Le), o.lastErrorSecuritySettingsUrl) {
15407
- const Q = document.createElement("a");
15408
- Q.className = "pluno-pa-widget__error-retry", Q.href = o.lastErrorSecuritySettingsUrl, Q.target = "_blank", Q.rel = "noreferrer", Q.textContent = "Security settings", ye.appendChild(Q);
15413
+ const X = document.createElement("a");
15414
+ X.className = "pluno-pa-widget__error-retry", X.href = o.lastErrorSecuritySettingsUrl, X.target = "_blank", X.rel = "noreferrer", X.textContent = "Security settings", ye.appendChild(X);
15409
15415
  }
15410
- for (const Q of J.actions) {
15416
+ for (const X of O.actions) {
15411
15417
  const B = document.createElement("button");
15412
15418
  B.type = "button", B.className = "pluno-pa-widget__error-retry";
15413
- const ee = K?.has(Q) === !0 || Q === "retry_history" && o.conversationDiagnostics?.queryRequestId != null || Q === "retry_message" && o.isRetrying;
15414
- B.disabled = ee, B.setAttribute("aria-busy", String(ee)), B.textContent = Q === "new_chat" ? ee ? "Starting new chat" : "Start new chat" : ee ? "Trying" : "Try again", ee && B.prepend(pn()), B.addEventListener("click", () => U(Q, Q === "retry_history" ? E : Q === "retry_message" ? b : L)), ye.appendChild(B);
15419
+ const Z = K?.has(X) === !0 || X === "retry_history" && o.conversationDiagnostics?.queryRequestId != null || X === "retry_message" && o.isRetrying;
15420
+ B.disabled = Z, B.setAttribute("aria-busy", String(Z)), B.textContent = X === "new_chat" ? Z ? "Starting new chat" : "Start new chat" : Z ? "Trying" : "Try again", Z && B.prepend(pn()), B.addEventListener("click", () => U(X, X === "retry_history" ? E : X === "retry_message" ? b : L)), ye.appendChild(B);
15415
15421
  }
15416
- N.appendChild(ye), Y(N), X = null, H = N;
15422
+ N.appendChild(ye), J(N), Y = null, H = N;
15417
15423
  }
15418
15424
  for (const C of G?.requests ?? []) {
15419
15425
  if (Fe.has(C.authRequestId)) continue;
15420
- const k = F(C);
15421
- Y(k), X = null, H = k;
15426
+ const k = V(C);
15427
+ J(k), Y = null, H = k;
15422
15428
  }
15423
- if (q && !ht) {
15429
+ if (oe && !ht) {
15424
15430
  const C = Kl(
15425
- q.request,
15426
- q.onConnect,
15427
- q.presentation
15431
+ oe.request,
15432
+ oe.onConnect,
15433
+ oe.presentation
15428
15434
  );
15429
- Y(C), X = null, H = C;
15435
+ J(C), Y = null, H = C;
15430
15436
  }
15431
- const de = D ? D.actionCandidate ?? D.candidate ?? (o.isThinking ? null : Dd(S)) : null;
15432
- if (D && de && !D.dismissedCandidateIds.has(de.id)) {
15437
+ const de = R ? R.actionCandidate ?? R.candidate ?? (o.isThinking ? null : Dd(S)) : null;
15438
+ if (R && de && !R.dismissedCandidateIds.has(de.id)) {
15433
15439
  const C = kb(de, {
15434
- isActing: D.actionCandidate?.id === de.id,
15435
- error: D.error,
15436
- characterIconOptions: D.characterIconOptions,
15437
- socialPostRewardsUrl: D.socialPostRewardsUrl,
15438
- presentation: D.presentation,
15439
- onReferralCopy: D.onReferralCopy,
15440
- onSocialShare: D.onSocialShare,
15441
- onDismiss: D.onDismiss,
15442
- onDisable: D.onDisable
15440
+ isActing: R.actionCandidate?.id === de.id,
15441
+ error: R.error,
15442
+ characterIconOptions: R.characterIconOptions,
15443
+ socialPostRewardsUrl: R.socialPostRewardsUrl,
15444
+ presentation: R.presentation,
15445
+ onReferralCopy: R.onReferralCopy,
15446
+ onSocialShare: R.onSocialShare,
15447
+ onDismiss: R.onDismiss,
15448
+ onDisable: R.onDisable
15443
15449
  });
15444
- Y(C), D.onSeen(de), X = null, H = C;
15450
+ J(C), R.onSeen(de), Y = null, H = C;
15445
15451
  }
15446
15452
  je();
15447
15453
  for (const C of ce) {
@@ -15449,13 +15455,13 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
15449
15455
  k.className = "pluno-pa-widget__next-check-in", k.append(
15450
15456
  Hw(C.dueAt),
15451
15457
  document.createTextNode(C.label)
15452
- ), Y(k), X = null, H = k;
15458
+ ), J(k), Y = null, H = k;
15453
15459
  }
15454
- X?.classList.add(
15460
+ Y?.classList.add(
15455
15461
  "pluno-pa-widget__message--bottom-reserve"
15456
15462
  ), H?.classList.add(
15457
15463
  "pluno-pa-widget__bottom-reserve-compact"
15458
- ), Y(e), yb(
15464
+ ), J(e), yb(
15459
15465
  d,
15460
15466
  et
15461
15467
  ), wb(
@@ -15832,26 +15838,26 @@ function Ab(t, e, n, i, s, o, a, r = !0) {
15832
15838
  a
15833
15839
  ), K = JSON.stringify(a), U = document.createElement("div");
15834
15840
  U.className = "pluno-pa-widget__tool-active-content";
15835
- const ge = Ys(), G = document.createElement("details"), q = document.createElement("summary");
15836
- q.className = "pluno-pa-widget__tool-summary";
15837
- const D = document.createElement("div");
15838
- D.className = "pluno-pa-widget__tool-summary-title", q.appendChild(D), q.addEventListener("click", () => {
15839
- const J = E.dataset.responseGroupKey ?? l;
15840
- G.open ? (n.delete(J), n.add(`closed:${J}`)) : (n.add(J), n.delete(`closed:${J}`)), o(), D.textContent = G.open ? E.dataset.collapsedActivityTitle ?? "Activities" : "Activities";
15841
- }), G.appendChild(q);
15842
- const F = document.createElement("div");
15843
- F.className = "pluno-pa-widget__tool-lines", G.addEventListener("toggle", () => {
15844
- E.dataset.responseGroupKey, E.classList.toggle("pluno-pa-widget__tool-group--open", G.open), D.textContent = G.open ? "Activities" : E.dataset.collapsedActivityTitle ?? "Activities";
15841
+ const he = Ys(), G = document.createElement("details"), oe = document.createElement("summary");
15842
+ oe.className = "pluno-pa-widget__tool-summary";
15843
+ const R = document.createElement("div");
15844
+ R.className = "pluno-pa-widget__tool-summary-title", oe.appendChild(R), oe.addEventListener("click", () => {
15845
+ const O = E.dataset.responseGroupKey ?? l;
15846
+ G.open ? (n.delete(O), n.add(`closed:${O}`)) : (n.add(O), n.delete(`closed:${O}`)), o(), R.textContent = G.open ? E.dataset.collapsedActivityTitle ?? "Activities" : "Activities";
15847
+ }), G.appendChild(oe);
15848
+ const V = document.createElement("div");
15849
+ V.className = "pluno-pa-widget__tool-lines", G.addEventListener("toggle", () => {
15850
+ E.dataset.responseGroupKey, E.classList.toggle("pluno-pa-widget__tool-group--open", G.open), R.textContent = G.open ? "Activities" : E.dataset.collapsedActivityTitle ?? "Activities";
15845
15851
  }), p = {
15846
15852
  node: E,
15847
15853
  character: L,
15848
15854
  characterSignature: K,
15849
15855
  activeContent: U,
15850
- thinkingStatus: ge,
15856
+ thinkingStatus: he,
15851
15857
  details: G,
15852
- summary: q,
15853
- summaryTitle: D,
15854
- lines: F,
15858
+ summary: oe,
15859
+ summaryTitle: R,
15860
+ lines: V,
15855
15861
  lineNodes: /* @__PURE__ */ new Map()
15856
15862
  }, i.set(l, p);
15857
15863
  }