@pluno/product-agent-web 0.1.74 → 0.1.76

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,17 +1,17 @@
1
- import { PlunoProductAgent as Jo, getProductAgentOriginAccessErrorMessage as Qo } from "./product-agent-sdk.js";
2
- const ei = "#7c3aed", ut = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", gt = "#2c2a1e", Cn = [253, 250, 241], Sn = 3.5;
3
- function no(e) {
4
- const t = oo(e);
5
- if (En(Ze(t), Cn) >= Sn)
1
+ import { PlunoProductAgent as ti, getProductAgentOriginAccessErrorMessage as ni } from "./product-agent-sdk.js";
2
+ const oi = "#7c3aed", mt = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", ft = "#2c2a1e", Pn = [253, 250, 241], Tn = 3.5;
3
+ function lo(e) {
4
+ const t = po(e);
5
+ if (In(nt(t), Pn) >= Tn)
6
6
  return t;
7
- let o = Ze(t);
8
- const i = Ze(gt);
7
+ let o = nt(t);
8
+ const i = nt(ft);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (o = oi(o, i, 0.22), En(o, Cn) >= Sn)
11
- return jt(o);
12
- return jt(o);
10
+ if (o = ri(o, i, 0.22), In(o, Pn) >= Tn)
11
+ return Xt(o);
12
+ return Xt(o);
13
13
  }
14
- function ti() {
14
+ function ii() {
15
15
  let n = "M 280 120", o = !1, i = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
@@ -19,8 +19,8 @@ function ti() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function ni(e) {
23
- const t = oo(e), n = Vt(Ze(t));
22
+ function ai(e) {
23
+ const t = po(e), n = Zt(nt(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,90 +44,90 @@ function ni(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: oe(t, 0.28, -0.03),
48
- middle: oe(t, 0.08, 0.04),
49
- bottom: oe(t, -0.1, 0.02),
50
- edgeStart: oe(t, 0.08, 0.08),
51
- edgeMiddle: oe(t, -0.08, 0.08),
52
- edgeEnd: oe(t, -0.18, 0.05),
53
- glow: oe(t, 0.32, -0.12),
54
- highlight: oe(t, 0.38, -0.18),
55
- inner: oe(t, 0.24, -0.1),
56
- shadow: oe(t, -0.25, -0.08)
47
+ top: ie(t, 0.28, -0.03),
48
+ middle: ie(t, 0.08, 0.04),
49
+ bottom: ie(t, -0.1, 0.02),
50
+ edgeStart: ie(t, 0.08, 0.08),
51
+ edgeMiddle: ie(t, -0.08, 0.08),
52
+ edgeEnd: ie(t, -0.18, 0.05),
53
+ glow: ie(t, 0.32, -0.12),
54
+ highlight: ie(t, 0.38, -0.18),
55
+ inner: ie(t, 0.24, -0.1),
56
+ shadow: ie(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function oo(e) {
59
+ function po(e) {
60
60
  const t = e.trim();
61
- return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ei;
61
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : oi;
62
62
  }
63
- function Ze(e) {
63
+ function nt(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function jt([e, t, n]) {
70
+ function Xt([e, t, n]) {
71
71
  const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function Vt([e, t, n]) {
74
+ function Zt([e, t, n]) {
75
75
  const o = (i) => {
76
76
  const r = i / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function En(e, t) {
82
- const n = Vt(e), o = Vt(t), [i, r] = n > o ? [n, o] : [o, n];
81
+ function In(e, t) {
82
+ const n = Zt(e), o = Zt(t), [i, r] = n > o ? [n, o] : [o, n];
83
83
  return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function oi(e, t, n) {
86
- const o = Kt(n);
85
+ function ri(e, t, n) {
86
+ const o = Jt(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
90
90
  e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function oe(e, t, n) {
94
- const [o, i, r] = ii(Ze(e));
95
- return jt(ai(o, Kt(i + n), Kt(r + t)));
93
+ function ie(e, t, n) {
94
+ const [o, i, r] = li(nt(e));
95
+ return Xt(pi(o, Jt(i + n), Jt(r + t)));
96
96
  }
97
- function ii([e, t, n]) {
98
- const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), d = (l + p) / 2;
97
+ function li([e, t, n]) {
98
+ const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), s = (l + p) / 2;
99
99
  if (l === p)
100
- return [0, 0, d];
101
- const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
- return [(l === o ? (i - r) / c + (i < r ? 6 : 0) : l === i ? (r - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
100
+ return [0, 0, s];
101
+ const c = l - p, u = s > 0.5 ? c / (2 - l - p) : c / (l + p);
102
+ return [(l === o ? (i - r) / c + (i < r ? 6 : 0) : l === i ? (r - o) / c + 2 : (o - i) / c + 4) / 6, u, s];
103
103
  }
104
- function ai(e, t, n) {
104
+ function pi(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- zt(i, o, e + 1 / 3) * 255,
110
- zt(i, o, e) * 255,
111
- zt(i, o, e - 1 / 3) * 255
109
+ Bt(i, o, e + 1 / 3) * 255,
110
+ Bt(i, o, e) * 255,
111
+ Bt(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function zt(e, t, n) {
114
+ function Bt(e, t, n) {
115
115
  let o = n;
116
116
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
117
117
  }
118
- function Kt(e) {
118
+ function Jt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const io = "suggest_share_on_socials";
122
- function ri(e) {
121
+ const so = "suggest_share_on_socials";
122
+ function si(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const n = e[t];
125
- if (n.role !== "tool" || n.toolName !== io)
125
+ if (n.role !== "tool" || n.toolName !== so)
126
126
  continue;
127
- const o = kn(e, t, "assistant");
127
+ const o = An(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const i = kn(e, o.index, "user");
130
+ const i = An(e, o.index, "user");
131
131
  return i ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: i.content,
@@ -136,13 +136,13 @@ function ri(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function li(e) {
140
- const t = await pi(e);
139
+ async function di(e) {
140
+ const t = await ci(e);
141
141
  if (!navigator.clipboard || typeof ClipboardItem > "u")
142
142
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
143
143
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
144
144
  }
145
- function kn(e, t, n) {
145
+ function An(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
147
  const i = e[o];
148
148
  if (i.role === n && i.content.trim())
@@ -150,19 +150,19 @@ function kn(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function pi(e) {
153
+ async function ci(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const si = "https://app.pluno.ai", di = "/api/product-agent/embed/active-users", ci = 1800, ui = 15e3, gi = 250, hi = 1e3, mi = 3e4;
157
- function fi(e, t = {}) {
156
+ const ui = "https://app.pluno.ai", gi = "/api/product-agent/embed/active-users", hi = 1800, mi = 15e3, fi = 250, wi = 1e3, bi = 3e4;
157
+ function _i(e, t = {}) {
158
158
  let n = !1, o = null, i = null, r = null;
159
159
  const l = () => {
160
160
  r !== null && (window.clearInterval(r), r = null);
161
161
  }, p = (u) => {
162
162
  n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  c();
164
- }, _i(u)));
165
- }, d = (u) => {
164
+ }, vi(u)));
165
+ }, s = (u) => {
166
166
  if (l(), o === null) {
167
167
  o = u, e(u);
168
168
  return;
@@ -173,58 +173,58 @@ function fi(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const v = Math.min(1, (performance.now() - k) / ci);
177
- o = Math.round(m + (u - m) * xi(v)), e(o), v >= 1 && (o = u, e(u), l());
178
- }, gi);
176
+ const v = Math.min(1, (performance.now() - k) / hi);
177
+ o = Math.round(m + (u - m) * Ci(v)), e(o), v >= 1 && (o = u, e(u), l());
178
+ }, fi);
179
179
  }, c = async () => {
180
180
  try {
181
- const u = await wi(t);
181
+ const u = await xi(t);
182
182
  if (n)
183
183
  return;
184
- d(u.count), p(u.refreshAfterMs);
184
+ s(u.count), p(u.refreshAfterMs);
185
185
  } catch {
186
- p(ui);
186
+ p(mi);
187
187
  }
188
188
  };
189
189
  return c(), () => {
190
190
  n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function wi(e) {
193
+ async function xi(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(di, bi(e.backendUrl ?? si)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(gi, yi(e.backendUrl ?? ui)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const o = await n.json(), i = Ln(o.count), r = Ln(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), i = Nn(o.count), r = Nn(o.refreshAfterMs ?? o.refresh_after_ms);
203
203
  if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: i, refreshAfterMs: r };
206
206
  }
207
- function Ln(e) {
207
+ function Nn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function bi(e) {
210
+ function yi(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function _i(e) {
214
- return Math.min(mi, Math.max(hi, e));
213
+ function vi(e) {
214
+ return Math.min(bi, Math.max(wi, e));
215
215
  }
216
- function xi(e) {
216
+ function Ci(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const ao = 100, yi = 1e4, vi = 5e3, Ci = "product-agent:sdk-preview-socket-connect", Si = "product-agent:sdk-preview-socket-send", Ei = "product-agent:sdk-preview-socket-close", ki = "product-agent:sdk-preview-socket-open", Li = "product-agent:sdk-preview-socket-message", Ii = "product-agent:sdk-preview-socket-error", Pi = "product-agent:sdk-preview-socket-closed", In = "product-agent:sdk-preview-socket-id", Ti = "data-pluno-sdk-preview-channel", ro = "data-pluno-auto-mounted", ce = "__plunoProductAgentAutoMountOwner", Ai = 1e4, Ni = "Failed to load Pluno widget token", Pn = "Timed out loading Pluno widget token", Ri = "pluno.productAgent.widgetClientId.", Mt = /* @__PURE__ */ new Set(), Di = "product-agent:preview-diagnostic", lo = "pluno.productAgent.sharePromptsDisabled", zi = 3, Tn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Mi = 400, Oi = 5e3, Ui = 500, An = "Close the page's popup to chat", Bi = "No recent chats for this page yet.", ie = {
219
+ const co = 100, Si = 1e4, Ei = 5e3, ki = "product-agent:sdk-preview-socket-connect", Li = "product-agent:sdk-preview-socket-send", Pi = "product-agent:sdk-preview-socket-close", Ti = "product-agent:sdk-preview-socket-open", Ii = "product-agent:sdk-preview-socket-message", Ai = "product-agent:sdk-preview-socket-error", Ni = "product-agent:sdk-preview-socket-closed", Rn = "product-agent:sdk-preview-socket-id", Ri = "data-pluno-sdk-preview-channel", uo = "data-pluno-auto-mounted", ue = "__plunoProductAgentAutoMountOwner", Di = 1e4, Mi = "Failed to load Pluno widget token", Dn = "Timed out loading Pluno widget token", zi = "pluno.productAgent.widgetClientId.", Ft = /* @__PURE__ */ new Set(), Oi = "product-agent:preview-diagnostic", go = "pluno.productAgent.sharePromptsDisabled", Ui = 3, Mn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Bi = 400, Fi = 5e3, Hi = 500, zn = "Close the page's popup to chat", Wi = "No recent chats for this page yet.", ae = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
223
223
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
224
224
  scribbleStyle: !0,
225
225
  position: "bottom-right",
226
- movableLauncher: !1
227
- }, Fi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Nn = "pluno-pa-scribble-font", po = 190, so = 41, Rn = 22, Hi = 16, Wi = 24, Gi = 1, $i = 48, an = 420, qi = 520, ji = 0.24, rn = 680, Vi = 800, Ki = 0.76, T = 8, Le = 50, co = "http://www.w3.org/2000/svg", Yt = 26, Xt = 8, Yi = 36, Zt = 16, Xi = 4, Dn = [
226
+ movableLauncher: !0
227
+ }, Gi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', On = "pluno-pa-scribble-font", ho = 190, mo = 41, Un = 22, $i = 16, qi = 24, ji = 1, Vi = 48, sn = 420, Ki = 520, Yi = 0.24, dn = 680, Xi = 800, Zi = 0.76, I = 8, Ie = 50, fo = "http://www.w3.org/2000/svg", Qt = 26, en = 8, Ji = 36, tn = 16, Qi = 4, Bn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const ao = 100, yi = 1e4, vi = 5e3, Ci = "product-agent:sdk-preview-socket-conne
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], Zi = 11, Ji = 13, Jt = 4, uo = 10, go = 40, Qi = "movable-launcher-position-v2", ho = "pluno-pa-widget-styles", mo = "data-pluno-pa-widget-styles";
265
- let zn = 0;
266
- function ea(e) {
267
- return (t) => new ue(t, e);
264
+ ], ea = 11, ta = 13, nn = 4, wo = 10, bo = 40, na = "movable-launcher-position-v2", _o = "pluno-pa-widget-styles", xo = "data-pluno-pa-widget-styles";
265
+ let Fn = 0;
266
+ function oa(e) {
267
+ return (t) => new ge(t, e);
268
268
  }
269
- async function ta(e = {}) {
269
+ async function ia(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? ie.launcherLabel,
272
- accentColor: e.accentColor ?? ie.accentColor,
273
- colorScheme: e.colorScheme ?? ie.colorScheme,
274
- fontFamily: e.fontFamily ?? ie.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? ie.scribbleStyle,
276
- position: e.position ?? ie.position,
277
- movableLauncher: e.movableLauncher ?? ie.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? ae.launcherLabel,
272
+ accentColor: e.accentColor ?? ae.accentColor,
273
+ colorScheme: e.colorScheme ?? ae.colorScheme,
274
+ fontFamily: e.fontFamily ?? ae.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? ae.scribbleStyle,
276
+ position: e.position ?? ae.position,
277
+ movableLauncher: e.movableLauncher ?? ae.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -311,7 +311,7 @@ async function ta(e = {}) {
311
311
  onMorningReportTaskStart: e.onMorningReportTaskStart,
312
312
  taskNotifications: e.taskNotifications
313
313
  };
314
- ne(
314
+ te(
315
315
  "web-sdk.widget",
316
316
  "Mounting widget with merged options",
317
317
  {
@@ -328,40 +328,40 @@ async function ta(e = {}) {
328
328
  );
329
329
  const n = document.createElement("div");
330
330
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
331
- Ti,
331
+ Ri,
332
332
  t.sdkPreviewChannelId
333
333
  );
334
334
  const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
335
335
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
336
- let r = Mn(
336
+ let r = Hn(
337
337
  t.accentColor,
338
338
  t.scribbleStyle
339
339
  );
340
- Sa(
340
+ La(
341
341
  i,
342
342
  t.launcherLabel,
343
343
  r,
344
344
  t.movableLauncher,
345
345
  t.showLauncherMinimizeButton
346
346
  ), o.appendChild(i);
347
- const l = yr(t);
348
- let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null, c = l.panelSize, u = null;
349
- i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), ke(
347
+ const l = Sr(t);
348
+ let p = t.movableLauncher ? l.launcherPosition : null, s = p !== null, c = l.panelSize, u = null;
349
+ i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Te(
350
350
  i,
351
- Ut(
351
+ Wt(
352
352
  i,
353
353
  p,
354
354
  t.position
355
355
  )
356
- )), Jn(o, t.accentColor), On(i, r, {
356
+ )), oo(o, t.accentColor), Wn(i, r, {
357
357
  accentColor: t.accentColor,
358
358
  colorScheme: t.colorScheme,
359
359
  fontFamily: t.fontFamily,
360
360
  scribbleStyle: t.scribbleStyle
361
361
  });
362
- const m = await _r(), k = m.ownerDocument, v = i.querySelector(
362
+ const m = await vr(), k = m.ownerDocument, v = i.querySelector(
363
363
  ".pluno-pa-widget__launcher"
364
- ), R = i.querySelector(
364
+ ), D = i.querySelector(
365
365
  ".pluno-pa-widget__launcher-drag-handle"
366
366
  ), C = i.querySelector(
367
367
  ".pluno-pa-widget__launcher-input"
@@ -369,100 +369,101 @@ async function ta(e = {}) {
369
369
  ".pluno-pa-widget__launcher-minimize"
370
370
  ), y = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
371
371
  ".pluno-pa-widget__scribble-spirals--panel"
372
- ), A = Array.from(
372
+ ), S = Array.from(
373
373
  i.querySelectorAll(".pluno-pa-widget__resize-handle")
374
- ), L = i.querySelector(
374
+ ), A = i.querySelector(
375
375
  ".pluno-pa-widget__close"
376
- ), M = i.querySelector(
376
+ ), N = i.querySelector(
377
377
  ".pluno-pa-widget__composer"
378
- ), U = i.querySelector(
378
+ ), q = i.querySelector(
379
379
  ".pluno-pa-widget__attachment-error"
380
- ), Ie = i.querySelector(
380
+ ), xe = i.querySelector(
381
381
  ".pluno-pa-widget__billing-status"
382
- ), H = i.querySelector(
382
+ ), He = i.querySelector(
383
383
  ".pluno-pa-widget__attachments"
384
- ), xe = i.querySelector(
384
+ ), z = i.querySelector(
385
385
  ".pluno-pa-widget__attachment-input"
386
- ), G = i.querySelector(
386
+ ), We = i.querySelector(
387
387
  ".pluno-pa-widget__attach"
388
388
  ), w = i.querySelector(
389
389
  ".pluno-pa-widget__input"
390
- ), J = i.querySelector(
390
+ ), U = i.querySelector(
391
391
  ".pluno-pa-widget__send"
392
- ), Je = i.querySelector(
392
+ ), ye = i.querySelector(
393
393
  ".pluno-pa-widget__top-actions"
394
- ), pe = i.querySelector(
394
+ ), ve = i.querySelector(
395
395
  ".pluno-pa-widget__history"
396
- ), Qe = i.querySelector(
396
+ ), Ae = i.querySelector(
397
397
  ".pluno-pa-widget__history-panel"
398
398
  ), V = i.querySelector(
399
399
  ".pluno-pa-widget__history-list"
400
- ), ge = i.querySelector(
400
+ ), ot = i.querySelector(
401
401
  ".pluno-pa-widget__history-close"
402
- ), x = i.querySelector(
402
+ ), ne = i.querySelector(
403
403
  ".pluno-pa-widget__history-status"
404
- ), D = i.querySelector(
404
+ ), x = i.querySelector(
405
405
  ".pluno-pa-widget__timeline-jump"
406
- ), $ = i.querySelector(
406
+ ), M = i.querySelector(
407
407
  ".pluno-pa-widget__active-users-counter"
408
- ), P = i.querySelector(
408
+ ), T = i.querySelector(
409
409
  ".pluno-pa-widget__timeline"
410
- ), j = i.querySelector(
410
+ ), oe = i.querySelector(
411
411
  ".pluno-pa-widget__timeline-bottom-sentinel"
412
- ), S = i.querySelector(
412
+ ), W = i.querySelector(
413
413
  ".pluno-pa-widget__notify-suggestion"
414
- ), N = i.querySelector(
414
+ ), L = i.querySelector(
415
415
  ".pluno-pa-widget__notify-suggestion-enable"
416
- ), Ro = i.querySelector(
416
+ ), R = i.querySelector(
417
417
  ".pluno-pa-widget__notify-suggestion-later"
418
- ), Do = i.querySelector(
418
+ ), Uo = i.querySelector(
419
419
  ".pluno-pa-widget__notify-suggestion-never"
420
420
  );
421
- if (!v || !C || !y || !L || !M || !U || !Ie || !H || !xe || !G || !w || !J || !Je || !pe || !Qe || !V || !ge || !x || !D || !$ || !P || !j)
421
+ if (!v || !C || !y || !A || !N || !q || !xe || !He || !z || !We || !w || !U || !ye || !ve || !Ae || !V || !ot || !ne || !x || !M || !T || !oe)
422
422
  throw new Error("Failed to mount Pluno widget");
423
- if (t.movableLauncher && !R)
423
+ if (t.movableLauncher && !D)
424
424
  throw new Error("Failed to mount Pluno widget drag handle");
425
- $n(C), $n(w);
426
- let q = [], se = null;
427
- const Pe = () => {
428
- Ga(
429
- H,
430
- q,
425
+ Yn(C), Yn(w);
426
+ let j = [], se = null;
427
+ const Ne = () => {
428
+ ja(
429
+ He,
430
+ j,
431
431
  (a) => {
432
- q = q.filter(
433
- (s, _) => _ !== a
434
- ), Pe(), F(b.getState()), K();
432
+ j = j.filter(
433
+ (d, _) => _ !== a
434
+ ), Ne(), H(b.getState()), G();
435
435
  }
436
436
  );
437
- }, zo = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
438
- if (!t.tokenEndpoint)
439
- throw new Error("Pluno widget requires token or tokenEndpoint");
440
- return Ao(t.tokenEndpoint);
441
- }), Mo = window.fetch.bind(window), bt = xr(t.clientId);
437
+ }, gn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => zo(t.tokenEndpoint) : void 0);
438
+ if (!t.loginRequired && !t.signupRequired && !t.token && !gn && !t.webSocketFactory)
439
+ throw new Error("Pluno widget requires token or tokenEndpoint");
440
+ const Bo = window.fetch.bind(window), yt = Cr(t.clientId);
442
441
  let b;
443
442
  try {
444
443
  const a = {
445
444
  token: t.token,
446
- tokenProvider: zo,
445
+ tokenProvider: gn,
447
446
  backendUrl: t.backendUrl,
448
447
  metadata: () => ({
449
448
  ...t.metadata ?? {},
450
449
  ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
451
450
  }),
452
451
  initialStarterPrompts: t.initialStarterPrompts,
453
- clientId: bt.clientId,
452
+ clientId: yt.clientId,
454
453
  restorePersistedState: t.restorePersistedState,
455
454
  expectedPersistedSessionId: t.expectedPersistedSessionId,
456
455
  webSocketFactory: t.webSocketFactory,
457
456
  prepareAttachmentUpload: t.prepareAttachmentUpload,
458
- autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0,
457
+ // The launcher is useful before a customer token endpoint responds. The widget owns connection
458
+ // startup after mounting so credential/network latency never keeps the visible shell detached.
459
+ autoConnect: !1,
459
460
  disableNetworkCapture: !!t.sdkPreviewChannelId
460
461
  };
461
- b = await Jo.init(a);
462
+ b = await ti.init(a);
462
463
  } catch (a) {
463
- throw bt.release(), n.remove(), a;
464
+ throw yt.release(), n.remove(), a;
464
465
  }
465
- m.appendChild(n), ne(
466
+ m.appendChild(n), te(
466
467
  "web-sdk.widget",
467
468
  "Applied initial widget appearance",
468
469
  {
@@ -472,119 +473,119 @@ async function ta(e = {}) {
472
473
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
473
474
  }
474
475
  );
475
- const _t = new Set(l.openToolGroupKeys), Te = new Set(
476
+ const vt = new Set(l.openToolGroupKeys), Re = new Set(
476
477
  l.seenShareCandidateIds
477
- ), et = new Set(Te);
478
- let xt = l.sharePromptsDisabled || await vr(t), Q = null, Ae = !1, he = !1, ye = {
478
+ ), it = new Set(Re);
479
+ let Ct = l.sharePromptsDisabled || await Er(t), J = null, de = !1, at = !(t.loginRequired || t.signupRequired), he = !1, Ce = {
479
480
  enabled: !0
480
- }, ve = 0, sn = "", me = !1, de = !1, fe = [], yt = null, Be = null;
481
- const ee = (a, s) => {
482
- ye = { enabled: a, reason: s };
483
- }, te = () => {
484
- D.hidden = !0;
485
- }, Oo = () => {
486
- D.hidden = !1;
487
- }, Uo = (a = "jump") => {
488
- ee(!0, a), te(), Xe(P, () => ye.enabled), ve = P.scrollTop;
489
- }, Ce = () => {
490
- if (pe.hidden = t.loginRequired, Qe.hidden = !me, pe.setAttribute("aria-expanded", String(me)), V.classList.toggle(
481
+ }, Se = 0, hn = "", me = !1, ce = !1, fe = [], St = null, Ge = null;
482
+ const Q = (a, d) => {
483
+ Ce = { enabled: a, reason: d };
484
+ }, ee = () => {
485
+ x.hidden = !0;
486
+ }, Fo = () => {
487
+ x.hidden = !1;
488
+ }, Ho = (a = "jump") => {
489
+ Q(!0, a), ee(), tt(T, () => Ce.enabled), Se = T.scrollTop;
490
+ }, Ee = () => {
491
+ if (ve.hidden = t.loginRequired, Ae.hidden = !me, ve.setAttribute("aria-expanded", String(me)), V.classList.toggle(
491
492
  "pluno-pa-widget__history-list--center",
492
- de && fe.length === 0
493
- ), V.replaceChildren(), de && fe.length === 0) {
493
+ ce && fe.length === 0
494
+ ), V.replaceChildren(), ce && fe.length === 0) {
494
495
  const a = document.createElement("p");
495
496
  a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", V.appendChild(a);
496
497
  }
497
498
  for (const a of fe) {
498
- const s = document.createElement("button");
499
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = de;
499
+ const d = document.createElement("button");
500
+ d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ce;
500
501
  const _ = document.createElement("span");
501
- _.className = "pluno-pa-widget__history-item-title", _.textContent = ya(a);
502
- const I = document.createElement("time");
503
- I.className = "pluno-pa-widget__history-time", I.dateTime = a.lastActiveAt, I.textContent = Ca(
502
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = Sa(a);
503
+ const P = document.createElement("time");
504
+ P.className = "pluno-pa-widget__history-time", P.dateTime = a.lastActiveAt, P.textContent = ka(
504
505
  a.lastActiveAt,
505
506
  Date.now()
506
507
  );
507
- const z = document.createElement("small");
508
- z.className = "pluno-pa-widget__history-path", z.textContent = va(a), s.append(_, I, z), s.addEventListener("click", () => {
509
- me = !1, Be = null, Ce(), ee(!0, "newSession"), te(), b.loadSession(a.id), F(b.getState());
510
- }), V.appendChild(s);
508
+ const O = document.createElement("small");
509
+ O.className = "pluno-pa-widget__history-path", O.textContent = Ea(a), d.append(_, P, O), d.addEventListener("click", () => {
510
+ me = !1, Ge = null, Ee(), Q(!0, "newSession"), ee(), b.loadSession(a.id), H(b.getState());
511
+ }), V.appendChild(d);
511
512
  }
512
- if (de && fe.length > 0) {
513
+ if (ce && fe.length > 0) {
513
514
  const a = document.createElement("p");
514
515
  a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", V.appendChild(a);
515
516
  }
516
- x.textContent = Be ?? (!de && fe.length === 0 ? "No recent chats for this page yet." : ""), x.hidden = x.textContent.length === 0;
517
- }, dn = async (a) => {
518
- if (!de) {
519
- de = !0, Be = null, Ce();
517
+ ne.textContent = Ge ?? (!ce && fe.length === 0 ? "No recent chats for this page yet." : ""), ne.hidden = ne.textContent.length === 0;
518
+ }, mn = async (a) => {
519
+ if (!ce) {
520
+ ce = !0, Ge = null, Ee();
520
521
  try {
521
- const s = await b.listSessions({ cursor: a, limit: 20 });
522
- fe = a ? [...fe, ...s.sessions] : s.sessions, yt = s.nextCursor;
523
- } catch (s) {
524
- ne(
522
+ const d = await b.listSessions({ cursor: a, limit: 20 });
523
+ fe = a ? [...fe, ...d.sessions] : d.sessions, St = d.nextCursor;
524
+ } catch (d) {
525
+ te(
525
526
  "web-sdk.widget",
526
527
  "Failed to load session history",
527
528
  {
528
- message: s instanceof Error ? s.message : String(s)
529
+ message: d instanceof Error ? d.message : String(d)
529
530
  }
530
- ), Be = Bi;
531
+ ), Ge = Wi;
531
532
  } finally {
532
- de = !1, Ce();
533
+ ce = !1, Ee();
533
534
  }
534
535
  }
535
- }, Bo = () => {
536
- !yt || de || V.scrollHeight - V.scrollTop - V.clientHeight <= 24 && dn(yt);
537
- }, cn = () => {
538
- Ae || typeof document > "u" || (Jn(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
539
- }, un = new MutationObserver(cn);
540
- un.observe(k.documentElement, {
536
+ }, Wo = () => {
537
+ !St || ce || V.scrollHeight - V.scrollTop - V.clientHeight <= 24 && mn(St);
538
+ }, fn = () => {
539
+ de || typeof document > "u" || (oo(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
540
+ }, wn = new MutationObserver(fn);
541
+ wn.observe(k.documentElement, {
541
542
  childList: !0,
542
543
  subtree: !0
543
- }), cn();
544
- const Fe = (a = !0) => {
545
- const s = ht(i, a);
546
- return Qt(
544
+ }), fn();
545
+ const $e = (a = !0) => {
546
+ const d = wt(i, a);
547
+ return on(
547
548
  i,
548
- p ? fo(p, s) : sa(
549
+ p ? yo(p, d) : ua(
549
550
  i,
550
551
  t.position,
551
- s
552
+ d
552
553
  ),
553
- s
554
+ d
554
555
  );
555
- }, B = () => {
556
- const a = fa(o, C, w);
557
- Sr(t, {
556
+ }, F = () => {
557
+ const a = _a(o, C, w);
558
+ Lr(t, {
558
559
  isOpen: i.classList.contains("pluno-pa-widget--open"),
559
560
  composerValue: w.value,
560
561
  focusedInput: a,
561
562
  focusedInputAt: a ? Date.now() : null,
562
- openToolGroupKeys: [..._t],
563
- launcherPosition: d ? p : null,
563
+ openToolGroupKeys: [...vt],
564
+ launcherPosition: s ? p : null,
564
565
  panelSize: c,
565
- seenShareCandidateIds: [...Te].slice(
566
- -ao
566
+ seenShareCandidateIds: [...Re].slice(
567
+ -co
567
568
  ),
568
- sharePromptsDisabled: xt
569
+ sharePromptsDisabled: Ct
569
570
  });
570
- }, tt = (a) => {
571
+ }, rt = (a) => {
571
572
  t.onDisplayStateChange?.(a);
572
- }, He = (a, s = !0) => {
573
+ }, qe = (a, d = !0) => {
573
574
  if (a === "shown") {
574
- i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && We(!1), s && tt("shown");
575
+ i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && je(!1), d && rt("shown");
575
576
  return;
576
577
  }
577
- Q !== null && (window.clearTimeout(Q), Q = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, y.hidden = !0, L.hidden = !0, v.tabIndex = 0, w.value = "", ke(
578
+ J !== null && (window.clearTimeout(J), J = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, y.hidden = !0, A.hidden = !0, v.tabIndex = 0, w.value = "", Te(
578
579
  i,
579
- Ut(
580
+ Wt(
580
581
  i,
581
582
  p,
582
583
  t.position
583
584
  )
584
- ), Hn(i), B(), s && tt("minimized");
585
- }, Se = (a, s = {}) => {
586
- ma(a, {
587
- debugVersion: Qi,
585
+ ), jn(i), F(), d && rt("minimized");
586
+ }, ke = (a, d = {}) => {
587
+ ba(a, {
588
+ debugVersion: na,
588
589
  launcherPosition: p,
589
590
  rootClasses: i.className,
590
591
  rootStyle: {
@@ -593,35 +594,35 @@ async function ta(e = {}) {
593
594
  right: i.style.right,
594
595
  bottom: i.style.bottom
595
596
  },
596
- rootRect: Ft(i),
597
- launcherRect: Ft(v),
598
- panelRect: Ft(y),
597
+ rootRect: $t(i),
598
+ launcherRect: $t(v),
599
+ panelRect: $t(y),
599
600
  viewport: Z(),
600
601
  panelHidden: y.hidden,
601
- closeHidden: L.hidden,
602
- ...s
602
+ closeHidden: A.hidden,
603
+ ...d
603
604
  });
604
- }, We = (a = !0) => {
605
+ }, je = (a = !0) => {
605
606
  if (!p)
606
- return ke(i, null), Fe(a);
607
- const s = Fe(a);
608
- return ke(i, s), Se("Applied stored closed launcher position", {
609
- visibleLauncherPosition: s
610
- }), s;
611
- }, vt = (a, s) => {
612
- if (!a || !s) {
613
- Hn(i);
607
+ return Te(i, null), $e(a);
608
+ const d = $e(a);
609
+ return Te(i, d), ke("Applied stored closed launcher position", {
610
+ visibleLauncherPosition: d
611
+ }), d;
612
+ }, Et = (a, d) => {
613
+ if (!a || !d) {
614
+ jn(i);
614
615
  return;
615
616
  }
616
- ha(i, {
617
- x: a.x - s.x,
618
- y: a.y - s.y
617
+ wa(i, {
618
+ x: a.x - d.x,
619
+ y: a.y - d.y
619
620
  });
620
- }, gn = () => {
621
+ }, bn = () => {
621
622
  if (i.classList.contains("pluno-pa-widget--minimized")) {
622
- ke(
623
+ Te(
623
624
  i,
624
- Ut(
625
+ Wt(
625
626
  i,
626
627
  p,
627
628
  t.position
@@ -629,63 +630,63 @@ async function ta(e = {}) {
629
630
  );
630
631
  return;
631
632
  }
632
- const a = We();
633
+ const a = je();
633
634
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
634
- Ot(i, c);
635
- const s = Ue(c);
636
- Wt(
635
+ Ht(i, c);
636
+ const d = Fe(c);
637
+ jt(
637
638
  h,
638
- s.width
639
+ d.width
639
640
  );
640
- const _ = ct(
641
- u ?? Bt(
641
+ const _ = ht(
642
+ u ?? Gt(
642
643
  i,
643
644
  a,
644
645
  t.position,
645
646
  c
646
647
  ),
647
- s
648
+ d
648
649
  );
649
- u && (u = _), vt(_, a), Se(
650
+ u && (u = _), Et(_, a), ke(
650
651
  "Applied open panel position after viewport resize",
651
652
  { openPanelPosition: _ }
652
653
  );
653
- } else p && Se(
654
+ } else p && ke(
654
655
  "Applied visible launcher position after viewport resize",
655
656
  { visibleLauncherPosition: a }
656
657
  );
657
658
  };
658
- let hn = () => {
659
+ let _n = () => {
659
660
  };
660
- window.addEventListener("resize", gn), t.movableLauncher && R ? (We(), hn = ra({
661
+ window.addEventListener("resize", bn), t.movableLauncher && D ? (je(), _n = sa({
661
662
  root: i,
662
663
  launcher: v,
663
- launcherDragHandle: R,
664
- getPosition: () => Fe(),
664
+ launcherDragHandle: D,
665
+ getPosition: () => $e(),
665
666
  setPosition: (a) => {
666
- const s = a, _ = ht(i), I = Qt(
667
+ const d = a, _ = wt(i), P = on(
667
668
  i,
668
669
  a,
669
670
  _
670
671
  );
671
- p = ca(
672
- I,
672
+ p = ha(
673
+ P,
673
674
  _
674
- ), ke(i, I), Se("Dragging closed launcher", {
675
- requestedPosition: s
675
+ ), Te(i, P), ke("Dragging closed launcher", {
676
+ requestedPosition: d
676
677
  });
677
678
  },
678
679
  persist: () => {
679
- d = !0, B(), Se("Persisted closed launcher drag position");
680
+ s = !0, F(), ke("Persisted closed launcher drag position");
680
681
  }
681
- })) : ke(i, null), Ot(i, c);
682
- const Fo = () => {
683
- const a = Ue(c), s = Fe();
682
+ })) : Te(i, null), Ht(i, c);
683
+ const Go = () => {
684
+ const a = Fe(c), d = $e();
684
685
  return {
685
- position: ct(
686
- u ?? Bt(
686
+ position: ht(
687
+ u ?? Gt(
687
688
  i,
688
- s,
689
+ d,
689
690
  t.position,
690
691
  c
691
692
  ),
@@ -693,77 +694,77 @@ async function ta(e = {}) {
693
694
  ),
694
695
  size: a
695
696
  };
696
- }, Ho = (a) => {
697
- c = ft(a.size), Ot(i, c), Wt(
697
+ }, $o = (a) => {
698
+ c = _t(a.size), Ht(i, c), jt(
698
699
  h,
699
- Ue(c).width
700
- ), u = ct(
700
+ Fe(c).width
701
+ ), u = ht(
701
702
  a.position,
702
- Ue(c)
703
+ Fe(c)
703
704
  );
704
- const s = Fe();
705
- vt(u, s);
706
- }, Wo = A.length > 0 ? la({
705
+ const d = $e();
706
+ Et(u, d);
707
+ }, qo = S.length > 0 ? da({
707
708
  root: i,
708
- handles: A,
709
- getBounds: Fo,
710
- setBounds: Ho,
711
- persist: B
709
+ handles: S,
710
+ getBounds: Go,
711
+ setBounds: $o,
712
+ persist: F
712
713
  }) : () => {
713
714
  };
714
- let Ct = !1;
715
- const mn = async () => {
716
- if (!(!t.billingStatusLoader || Ct)) {
717
- Ct = !0;
715
+ let kt = !1;
716
+ const xn = async () => {
717
+ if (!(!t.billingStatusLoader || kt)) {
718
+ kt = !0;
718
719
  try {
719
720
  const a = await t.billingStatusLoader();
720
- jn(
721
+ Zn(
721
722
  t.billingStatus,
722
723
  a,
723
724
  b.getState().lastErrorCode
724
- ) && (t.billingStatus = a, $t(
725
- Ie,
725
+ ) && (t.billingStatus = a, Kt(
726
+ xe,
726
727
  t.billingStatus,
727
728
  b.getState().lastErrorCode
728
- ), K());
729
+ ), G());
729
730
  } finally {
730
- Ct = !1;
731
+ kt = !1;
731
732
  }
732
733
  }
733
- }, we = (a = "", s = !0) => {
734
- mn(), $e && ($e = !1, kt()), i.classList.contains("pluno-pa-widget--open") || (u = null), Q !== null && (window.clearTimeout(Q), Q = null), He("shown", !1), y.hidden = !1, L.hidden = !1, Wt(
734
+ }, we = (a = "", d = !0) => {
735
+ xn(), Ye && (Ye = !1, Tt()), i.classList.contains("pluno-pa-widget--open") || (u = null), J !== null && (window.clearTimeout(J), J = null), qe("shown", !1), y.hidden = !1, A.hidden = !1, jt(
735
736
  h,
736
- Ue(c).width
737
+ Fe(c).width
737
738
  ), i.classList.remove("pluno-pa-widget--closing");
738
- const _ = We(), I = Bt(
739
+ const _ = je(), P = Gt(
739
740
  i,
740
741
  _,
741
742
  t.position,
742
743
  c
743
744
  );
744
- if (vt(I, _), Se("Opening launcher at clamped open panel position", {
745
- openPanelPosition: I,
745
+ if (Et(P, _), ke("Opening launcher at clamped open panel position", {
746
+ openPanelPosition: P,
746
747
  visibleLauncherPosition: _
747
- }), ee(!0, "open"), te(), !s) {
748
- i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (w.value = a, Ye(w)), Xe(P, () => ye.enabled), ve = P.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), B(), tt("shown"), t.onPanelOpenChange?.(!0);
748
+ }), Q(!0, "open"), ee(), !d) {
749
+ i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (w.value = a, et(w)), tt(T, () => Ce.enabled), Se = T.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0);
749
750
  return;
750
751
  }
751
752
  window.requestAnimationFrame(() => {
752
- i.classList.add("pluno-pa-widget--open"), a && (w.value = a, Ye(w)), Xe(P, () => ye.enabled), ve = P.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), B(), tt("shown"), t.onPanelOpenChange?.(!0), Q = window.setTimeout(() => {
753
- v.hidden = !0, Xe(P, () => ye.enabled), ve = P.scrollTop;
753
+ i.classList.add("pluno-pa-widget--open"), a && (w.value = a, et(w)), tt(T, () => Ce.enabled), Se = T.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0), J = window.setTimeout(() => {
754
+ v.hidden = !0, tt(T, () => Ce.enabled), Se = T.scrollTop;
754
755
  }, 220);
755
756
  });
756
- }, St = () => {
757
- Q !== null && (window.clearTimeout(Q), Q = null), v.hidden = !1, p && (We(!1), Se("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), B(), t.onPanelOpenChange?.(!1), Q = window.setTimeout(() => {
758
- y.hidden = !0, L.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
757
+ }, Lt = () => {
758
+ J !== null && (window.clearTimeout(J), J = null), v.hidden = !1, p && (je(!1), ke("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), J = window.setTimeout(() => {
759
+ y.hidden = !0, A.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
759
760
  }, 220);
760
761
  };
761
762
  v.addEventListener("submit", (a) => {
762
763
  a.preventDefault(), we(C.value), C.value = "";
763
- }), R?.addEventListener("click", (a) => {
764
+ }), D?.addEventListener("click", (a) => {
764
765
  a.preventDefault(), a.stopPropagation();
765
766
  }), v.addEventListener("click", (a) => {
766
- a.target === C && !R || (we(C.value), C.value = "");
767
+ a.target === C && !D || (we(C.value), C.value = "");
767
768
  }), C.addEventListener("focus", () => {
768
769
  we(C.value), C.value = "";
769
770
  }), C.addEventListener("input", () => {
@@ -772,21 +773,21 @@ async function ta(e = {}) {
772
773
  const a = C.value;
773
774
  we(a), C.value = "";
774
775
  });
775
- let Et = null, nt = null, Ee = null;
776
- const fn = (a) => a === C || a === w, Go = (a) => {
776
+ let Pt = null, lt = null, Le = null;
777
+ const yn = (a) => a === C || a === w, jo = (a) => {
777
778
  if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
778
779
  return null;
779
- let s = a;
780
- for (; s; ) {
781
- const _ = s.closest(Tn);
780
+ let d = a;
781
+ for (; d; ) {
782
+ const _ = d.closest(Mn);
782
783
  if (_)
783
784
  return _;
784
- const I = s.getRootNode();
785
- s = I instanceof ShadowRoot ? I.host : null;
785
+ const P = d.getRootNode();
786
+ d = P instanceof ShadowRoot ? P.host : null;
786
787
  }
787
788
  return null;
788
- }, $o = (a) => {
789
- if (!a.isConnected || !a.matches(Tn))
789
+ }, Vo = (a) => {
790
+ if (!a.isConnected || !a.matches(Mn))
790
791
  return !1;
791
792
  if (!(a instanceof HTMLElement))
792
793
  return !0;
@@ -794,68 +795,85 @@ async function ta(e = {}) {
794
795
  return !1;
795
796
  if (typeof a.checkVisibility == "function")
796
797
  return a.checkVisibility();
797
- const s = window.getComputedStyle(a);
798
- return s.display !== "none" && s.visibility !== "hidden";
799
- }, wn = (a) => {
800
- Ge !== a && (Ge = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), it(), a !== null ? Ee = window.setInterval(() => {
801
- const s = Ge;
802
- (!s || !$o(s)) && wn(null);
803
- }, Ui) : Ee !== null && (window.clearInterval(Ee), Ee = null, nt = null));
804
- }, qo = () => {
805
- Ee !== null && (window.clearInterval(Ee), Ee = null);
798
+ const d = window.getComputedStyle(a);
799
+ return d.display !== "none" && d.visibility !== "hidden";
800
+ }, vn = (a) => {
801
+ Ke !== a && (Ke = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Pe(), a !== null ? Le = window.setInterval(() => {
802
+ const d = Ke;
803
+ (!d || !Vo(d)) && vn(null);
804
+ }, Hi) : Le !== null && (window.clearInterval(Le), Le = null, lt = null));
805
+ }, Ko = () => {
806
+ Le !== null && (window.clearInterval(Le), Le = null);
806
807
  };
807
808
  i.addEventListener("focusin", (a) => {
808
- fn(a.target) && (Et = Date.now(), B());
809
+ yn(a.target) && (Pt = Date.now(), F());
809
810
  }), i.addEventListener("focusout", (a) => {
810
- if (!fn(a.target) || Ge !== null)
811
+ if (!yn(a.target) || Ke !== null)
811
812
  return;
812
- const s = Et;
813
- if (Et = null, s === null || Date.now() - s > Mi)
813
+ const d = Pt;
814
+ if (Pt = null, d === null || Date.now() - d > Bi)
814
815
  return;
815
- const _ = Go(a.relatedTarget);
816
+ const _ = jo(a.relatedTarget);
816
817
  if (!_)
817
818
  return;
818
- const I = Date.now();
819
- if (nt !== null && I - nt <= Oi) {
820
- wn(_);
819
+ const P = Date.now();
820
+ if (lt !== null && P - lt <= Fi) {
821
+ vn(_);
821
822
  return;
822
823
  }
823
- nt = I;
824
+ lt = P;
824
825
  }), v.addEventListener("keydown", (a) => {
825
826
  !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), we());
826
827
  }), g?.addEventListener("pointerdown", (a) => {
827
828
  a.stopPropagation();
828
829
  }), g?.addEventListener("click", (a) => {
829
- a.preventDefault(), a.stopPropagation(), He("minimized");
830
- }), L.addEventListener("click", St), P.addEventListener("scroll", () => {
831
- P.scrollTop < ve - 1 && ee(!1, "userScroll"), ve = P.scrollTop;
832
- }), D.addEventListener("click", () => {
833
- Uo();
830
+ a.preventDefault(), a.stopPropagation(), qe("minimized");
831
+ }), A.addEventListener("click", Lt), T.addEventListener("scroll", () => {
832
+ T.scrollTop < Se - 1 && Q(!1, "userScroll"), Se = T.scrollTop;
833
+ }), x.addEventListener("click", () => {
834
+ Ho();
834
835
  });
835
- const bn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
836
+ const Cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
836
837
  ([a]) => {
837
- a?.isIntersecting && (ee(!0, "bottom"), te());
838
+ a?.isIntersecting && (Q(!0, "bottom"), ee());
838
839
  },
839
- { root: P, threshold: 0 }
840
+ { root: T, threshold: 0 }
840
841
  );
841
- bn?.observe(j);
842
- const ot = () => t.loginRequired || t.signupRequired;
843
- let Ge = null, $e = !1;
844
- const it = () => {
845
- const a = ot(), s = Ge !== null;
846
- C.readOnly = a || s, w.readOnly = s, C.placeholder = s ? An : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : $e ? "New update" : t.launcherLabel, w.placeholder = s ? An : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ie.launcherLabel, M.hidden = a;
847
- }, K = () => {
848
- J.disabled = re(t.billingStatus) || !b.getState().isThinking && w.value.trim().length === 0 && q.length === 0, G.disabled = ot() || re(t.billingStatus);
842
+ Cn?.observe(oe);
843
+ const Ve = () => t.loginRequired || t.signupRequired;
844
+ let Ke = null, Ye = !1;
845
+ const K = () => at || b.getState().status !== "connected", Pe = () => {
846
+ const a = Ve(), d = Ke !== null, _ = !a && K();
847
+ C.readOnly = a || d || _, w.readOnly = d || _, C.placeholder = d ? zn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ye ? "New update" : t.launcherLabel, w.placeholder = d ? zn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ae.launcherLabel, N.hidden = a;
848
+ }, G = () => {
849
+ U.disabled = K() || le(t.billingStatus) || !b.getState().isThinking && w.value.trim().length === 0 && j.length === 0, We.disabled = Ve() || K() || le(t.billingStatus);
849
850
  };
850
- it();
851
- const kt = () => {
851
+ Pe();
852
+ const Tt = () => {
852
853
  const a = b.getState().isThinking;
853
854
  i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
854
855
  "pluno-pa-widget--unread",
855
- !a && $e
856
- ), it();
856
+ !a && Ye
857
+ ), Pe();
858
+ };
859
+ Tt();
860
+ const It = () => {
861
+ Ve() || de || (at = !0, Pe(), G(), b.connect().then(
862
+ () => {
863
+ de || (at = !1, Pe(), G());
864
+ },
865
+ (a) => {
866
+ de || (at = !1, Pe(), G(), te(
867
+ "web-sdk.widget",
868
+ "Failed to connect Product Agent widget",
869
+ {
870
+ message: a instanceof Error ? a.message : String(a)
871
+ }
872
+ ));
873
+ }
874
+ ));
857
875
  };
858
- kt(), M.addEventListener("submit", (a) => {
876
+ N.addEventListener("submit", (a) => {
859
877
  if (a.preventDefault(), t.loginRequired) {
860
878
  t.onLoginClick?.();
861
879
  return;
@@ -864,65 +882,65 @@ async function ta(e = {}) {
864
882
  t.onSignupClick?.();
865
883
  return;
866
884
  }
867
- re(t.billingStatus) || (he = !0, ee(!0, "send"), te(), q = Ht(
885
+ K() || le(t.billingStatus) || (he = !0, Q(!0, "send"), ee(), j = qt(
868
886
  b,
869
887
  w,
870
- q
871
- ), Pe(), K());
888
+ j
889
+ ), Ne(), G());
872
890
  });
873
- let qe = 0;
874
- const jo = () => {
875
- qe = 0, i.classList.remove("pluno-pa-widget--drag-over");
876
- }, Lt = (a) => {
877
- se !== null && window.clearTimeout(se), U.textContent = a, U.hidden = !1, se = window.setTimeout(() => {
878
- U.textContent = "", U.hidden = !0, se = null;
891
+ let Xe = 0;
892
+ const Yo = () => {
893
+ Xe = 0, i.classList.remove("pluno-pa-widget--drag-over");
894
+ }, At = (a) => {
895
+ se !== null && window.clearTimeout(se), q.textContent = a, q.hidden = !1, se = window.setTimeout(() => {
896
+ q.textContent = "", q.hidden = !0, se = null;
879
897
  }, 3e3);
880
- }, Vo = () => {
881
- se !== null && (window.clearTimeout(se), se = null), U.textContent = "", U.hidden = !0;
882
- }, It = async (a) => {
898
+ }, Xo = () => {
899
+ se !== null && (window.clearTimeout(se), se = null), q.textContent = "", q.hidden = !0;
900
+ }, Nt = async (a) => {
883
901
  if (a.length === 0)
884
902
  return;
885
- const s = ja(b, a);
886
- q = [...q, ...s], Pe(), Vo(), K(), F(b.getState()), i.classList.contains("pluno-pa-widget--open") || we();
903
+ const d = Ya(b, a);
904
+ j = [...j, ...d], Ne(), Xo(), G(), H(b.getState()), i.classList.contains("pluno-pa-widget--open") || we();
887
905
  };
888
- G.addEventListener("click", () => {
889
- t.loginRequired || re(t.billingStatus) || xe.click();
890
- }), xe.addEventListener("change", () => {
891
- const a = Array.from(xe.files ?? []);
892
- xe.value = "", It(a).catch((s) => {
893
- Lt(
894
- s instanceof Error ? s.message : "Failed to attach file"
895
- ), ne("web-sdk.widget", "Attachment failed", {
896
- message: s instanceof Error ? s.message : String(s)
906
+ We.addEventListener("click", () => {
907
+ t.loginRequired || K() || le(t.billingStatus) || z.click();
908
+ }), z.addEventListener("change", () => {
909
+ const a = Array.from(z.files ?? []);
910
+ z.value = "", Nt(a).catch((d) => {
911
+ At(
912
+ d instanceof Error ? d.message : "Failed to attach file"
913
+ ), te("web-sdk.widget", "Attachment failed", {
914
+ message: d instanceof Error ? d.message : String(d)
897
915
  });
898
916
  });
899
917
  }), i.addEventListener("dragenter", (a) => {
900
- !pt(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), qe += 1, i.classList.add("pluno-pa-widget--drag-over"));
918
+ !ct(a.dataTransfer) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), Xe += 1, i.classList.add("pluno-pa-widget--drag-over"));
901
919
  }), i.addEventListener("dragover", (a) => {
902
- const s = a.dataTransfer;
903
- !pt(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
920
+ const d = a.dataTransfer;
921
+ !ct(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
904
922
  }), i.addEventListener("dragleave", (a) => {
905
- pt(a.dataTransfer) && (a.stopPropagation(), qe = Math.max(0, qe - 1), qe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
923
+ ct(a.dataTransfer) && (a.stopPropagation(), Xe = Math.max(0, Xe - 1), Xe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
906
924
  }), i.addEventListener("drop", (a) => {
907
- const s = a.dataTransfer;
908
- !pt(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), jo(), It(s.files).catch((_) => {
909
- Lt(
925
+ const d = a.dataTransfer;
926
+ !ct(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), Yo(), Nt(d.files).catch((_) => {
927
+ At(
910
928
  _ instanceof Error ? _.message : "Failed to attach file"
911
- ), ne("web-sdk.widget", "Attachment failed", {
929
+ ), te("web-sdk.widget", "Attachment failed", {
912
930
  message: _ instanceof Error ? _.message : String(_)
913
931
  });
914
932
  }));
915
933
  }), i.addEventListener("paste", (a) => {
916
934
  a.stopPropagation();
917
- const s = a.clipboardData, _ = Array.from(s?.files ?? []);
918
- _.length === 0 || t.loginRequired || (a.preventDefault(), It(_).catch((I) => {
919
- Lt(
920
- I instanceof Error ? I.message : "Failed to attach file"
921
- ), ne("web-sdk.widget", "Attachment failed", {
922
- message: I instanceof Error ? I.message : String(I)
935
+ const d = a.clipboardData, _ = Array.from(d?.files ?? []);
936
+ _.length === 0 || t.loginRequired || K() || (a.preventDefault(), Nt(_).catch((P) => {
937
+ At(
938
+ P instanceof Error ? P.message : "Failed to attach file"
939
+ ), te("web-sdk.widget", "Attachment failed", {
940
+ message: P instanceof Error ? P.message : String(P)
923
941
  });
924
942
  }));
925
- }), J.addEventListener("click", () => {
943
+ }), U.addEventListener("click", () => {
926
944
  if (t.loginRequired) {
927
945
  t.onLoginClick?.();
928
946
  return;
@@ -931,91 +949,91 @@ async function ta(e = {}) {
931
949
  b.stop();
932
950
  return;
933
951
  }
934
- he = !0, ee(!0, "send"), te(), q = Ht(
952
+ K() || (he = !0, Q(!0, "send"), ee(), j = qt(
935
953
  b,
936
954
  w,
937
- q
938
- ), Pe(), K(), F(b.getState());
939
- }), pe.addEventListener("click", () => {
940
- me = !me, Be = null, Ce(), me && fe.length === 0 && dn(null);
941
- }), ge.addEventListener("click", () => {
942
- me = !1, Ce();
943
- }), V.addEventListener("scroll", Bo), w.addEventListener("input", () => {
944
- Ye(w), B(), K(), Xo();
955
+ j
956
+ ), Ne(), G(), H(b.getState()));
957
+ }), ve.addEventListener("click", () => {
958
+ me = !me, Ge = null, Ee(), me && fe.length === 0 && mn(null);
959
+ }), ot.addEventListener("click", () => {
960
+ me = !1, Ee();
961
+ }), V.addEventListener("scroll", Wo), w.addEventListener("input", () => {
962
+ et(w), F(), G(), Qo();
945
963
  }), w.addEventListener("keydown", (a) => {
946
964
  if (!(a.key !== "Enter" || a.shiftKey)) {
947
965
  if (a.preventDefault(), t.loginRequired) {
948
966
  t.onLoginClick?.();
949
967
  return;
950
968
  }
951
- he = !0, ee(!0, "send"), te(), q = Ht(
969
+ K() || (he = !0, Q(!0, "send"), ee(), j = qt(
952
970
  b,
953
971
  w,
954
- q
955
- ), Pe(), K(), F(b.getState());
972
+ j
973
+ ), Ne(), G(), H(b.getState()));
956
974
  }
957
975
  }), i.addEventListener("click", (a) => {
958
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && B();
959
- }), l.composerValue && (w.value = l.composerValue, Ye(w)), t.initialDisplayState === "minimized" ? He("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && we(w.value, !1), wa(l, i, C, w);
960
- const at = () => r;
961
- let Pt = b.getState().appearance !== null, rt = null, je = null, Ne = null, _n = b.getState().isThinking, Re = null;
962
- const Ve = t.taskNotifications;
963
- let De = null, ze = !1;
964
- const xn = () => {
965
- De !== null && (window.clearTimeout(De), De = null);
966
- }, lt = () => {
967
- S && (S.hidden = !0);
968
- }, yn = () => b.getState().assistantDraft.trim().length > 0, Ko = async () => {
969
- if (!Ve || !S || ze || Ae || !b.getState().isThinking || yn())
976
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
977
+ }), l.composerValue && (w.value = l.composerValue, et(w)), t.initialDisplayState === "minimized" ? qe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && we(w.value, !1), xa(l, i, C, w);
978
+ const pt = () => r;
979
+ let Rt = b.getState().appearance !== null, st = null, Ze = null, De = null, Sn = b.getState().isThinking, Me = null;
980
+ const Je = t.taskNotifications;
981
+ let ze = null, Oe = !1;
982
+ const En = () => {
983
+ ze !== null && (window.clearTimeout(ze), ze = null);
984
+ }, dt = () => {
985
+ W && (W.hidden = !0);
986
+ }, kn = () => b.getState().assistantDraft.trim().length > 0, Zo = async () => {
987
+ if (!Je || !W || Oe || de || !b.getState().isThinking || kn())
970
988
  return;
971
989
  let a;
972
990
  try {
973
- a = await Ve.getState();
991
+ a = await Je.getState();
974
992
  } catch {
975
993
  return;
976
994
  }
977
- a.enabled || a.neverSuggest || !b.getState().isThinking || yn() || ze || Ae || (S.hidden = !1);
995
+ a.enabled || a.neverSuggest || !b.getState().isThinking || kn() || Oe || de || (W.hidden = !1);
978
996
  };
979
- N?.addEventListener("click", () => {
980
- ze = !0, lt(), Ve?.enable().catch(() => {
997
+ L?.addEventListener("click", () => {
998
+ Oe = !0, dt(), Je?.enable().catch(() => {
981
999
  });
982
- }), Ro?.addEventListener("click", () => {
983
- ze = !0, lt();
984
- }), Do?.addEventListener("click", () => {
985
- ze = !0, lt(), Ve?.dismissForever().catch(() => {
1000
+ }), R?.addEventListener("click", () => {
1001
+ Oe = !0, dt();
1002
+ }), Uo?.addEventListener("click", () => {
1003
+ Oe = !0, dt(), Je?.dismissForever().catch(() => {
986
1004
  });
987
1005
  });
988
- let Me = null, vn = () => {
1006
+ let Ue = null, Ln = () => {
989
1007
  };
990
- const Yo = !!t.socialPostDraftHandler, Tt = /* @__PURE__ */ new Map(), At = () => w.value.trim().length > 0 || q.length > 0, Xo = () => {
991
- const a = Me !== null && qt(b.getState(), At());
992
- $.hidden = !a, a && Me !== null && bo($, Me);
1008
+ const Jo = !!t.socialPostDraftHandler, Dt = /* @__PURE__ */ new Map(), Mt = () => w.value.trim().length > 0 || j.length > 0, Qo = () => {
1009
+ const a = Ue !== null && Yt(b.getState(), Mt());
1010
+ M.hidden = !a, a && Ue !== null && Co(M, Ue);
993
1011
  };
994
- let Oe = null;
995
- const Nt = (a = {}) => {
996
- he = !0, ee(!0, "newSession"), te(), me = !1, Ce(), b.startNewSession(a), _t.clear(), w.value = "", q = [], Pe(), Ye(w), B(), K(), w.focus(), F(b.getState());
997
- }, Rt = (a) => {
1012
+ let Be = null;
1013
+ const zt = (a = {}) => {
1014
+ he = !0, Q(!0, "newSession"), ee(), me = !1, Ee(), b.startNewSession(a), vt.clear(), w.value = "", j = [], Ne(), et(w), F(), G(), w.focus(), H(b.getState());
1015
+ }, Ot = (a) => {
998
1016
  if (!a) {
999
- Oe?.remove(), Oe = null;
1017
+ Be?.remove(), Be = null;
1000
1018
  return;
1001
1019
  }
1002
- Oe || (Oe = wt(
1020
+ Be || (Be = xt(
1003
1021
  "pluno-pa-widget__new-chat",
1004
1022
  "New chat",
1005
- za(),
1023
+ Ua(),
1006
1024
  !1
1007
- ), Oe.addEventListener("click", () => Nt()), Je.insertBefore(Oe, pe));
1008
- }, F = (a) => {
1009
- if (Ce(), pn(a.lastErrorCode) ? Re = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !re(t.billingStatus) && (Re = null), $t(
1010
- Ie,
1025
+ ), Be.addEventListener("click", () => zt()), ye.insertBefore(Be, ve));
1026
+ }, H = (a) => {
1027
+ if (Ee(), un(a.lastErrorCode) ? Me = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && (Me = null), Kt(
1028
+ xe,
1011
1029
  t.billingStatus,
1012
- Re
1030
+ Me
1013
1031
  ), t.loginRequired) {
1014
- Tt.clear(), Xn(
1015
- P,
1016
- J,
1017
- Rt,
1018
- at,
1032
+ Dt.clear(), to(
1033
+ T,
1034
+ U,
1035
+ Ot,
1036
+ pt,
1019
1037
  "Log in to use Pluno on this page.",
1020
1038
  t.loginButtonLabel,
1021
1039
  t.loginUrl,
@@ -1024,11 +1042,11 @@ async function ta(e = {}) {
1024
1042
  return;
1025
1043
  }
1026
1044
  if (t.signupRequired) {
1027
- Tt.clear(), Xn(
1028
- P,
1029
- J,
1030
- Rt,
1031
- at,
1045
+ Dt.clear(), to(
1046
+ T,
1047
+ U,
1048
+ Ot,
1049
+ pt,
1032
1050
  "Complete signup to unlock your free trial credits.",
1033
1051
  t.signupButtonLabel,
1034
1052
  t.signupUrl,
@@ -1036,75 +1054,78 @@ async function ta(e = {}) {
1036
1054
  );
1037
1055
  return;
1038
1056
  }
1039
- const s = _a(a), _ = s !== sn;
1040
- sn = s;
1041
- const I = he || ye.enabled;
1042
- he = !1, Qa(
1043
- P,
1044
- j,
1045
- J,
1046
- Rt,
1047
- $,
1057
+ const d = va(a), _ = d !== hn;
1058
+ hn = d;
1059
+ const P = he || Ce.enabled;
1060
+ he = !1, nr(
1061
+ T,
1062
+ oe,
1063
+ U,
1064
+ Ot,
1065
+ M,
1048
1066
  a,
1049
- Me,
1050
- Me !== null && qt(a, At()),
1051
- I,
1052
- () => ye.enabled,
1053
- _t,
1054
- Tt,
1055
- B,
1056
- at,
1057
- (z) => {
1058
- const Ke = t.morningReport !== null;
1059
- t.morningReport = null, Ke && (t.onMorningReportTaskStart?.(), Nt()), he = !0, ee(!0, "send"), te(), b.sendMessage(z);
1067
+ Ue,
1068
+ Ue !== null && Yt(a, Mt()),
1069
+ P,
1070
+ () => Ce.enabled,
1071
+ vt,
1072
+ Dt,
1073
+ F,
1074
+ pt,
1075
+ (O) => {
1076
+ if (K())
1077
+ return;
1078
+ const Qe = t.morningReport !== null;
1079
+ t.morningReport = null, Qe && (t.onMorningReportTaskStart?.(), zt()), he = !0, Q(!0, "send"), ee(), b.sendMessage(O);
1060
1080
  },
1061
1081
  () => {
1062
- he = !0, ee(!0, "send"), te(), b.retryLastMessage();
1082
+ he = !0, Q(!0, "send"), ee(), b.retryLastMessage();
1063
1083
  },
1064
1084
  t.morningReport,
1065
1085
  () => {
1066
- t.morningReport = null, t.onMorningReportSnooze?.(), St(), F(b.getState());
1086
+ t.morningReport = null, t.onMorningReportSnooze?.(), Lt(), H(b.getState());
1067
1087
  },
1068
- Yo && !xt ? {
1069
- dismissedCandidateIds: et,
1070
- draftingCandidateId: rt,
1071
- error: je,
1072
- characterIconOptions: at(),
1073
- onSeen: (z) => {
1074
- Te.add(z.id), B();
1088
+ It,
1089
+ Jo && !Ct ? {
1090
+ dismissedCandidateIds: it,
1091
+ draftingCandidateId: st,
1092
+ error: Ze,
1093
+ characterIconOptions: pt(),
1094
+ onSeen: (O) => {
1095
+ Re.add(O.id), F();
1075
1096
  },
1076
- onDraft: (z) => {
1077
- Zo(z);
1097
+ onDraft: (O) => {
1098
+ ei(O);
1078
1099
  },
1079
- onDismiss: (z) => {
1080
- Te.add(z.id), et.add(z.id), B(), je = null, F(b.getState());
1100
+ onDismiss: (O) => {
1101
+ Re.add(O.id), it.add(O.id), F(), Ze = null, H(b.getState());
1081
1102
  },
1082
- onDisable: (z) => {
1083
- xt = !0, Te.add(z.id), et.add(z.id), B(), Cr(t, !0), je = null, F(b.getState());
1103
+ onDisable: (O) => {
1104
+ Ct = !0, Re.add(O.id), it.add(O.id), F(), kr(t, !0), Ze = null, H(b.getState());
1084
1105
  }
1085
1106
  } : void 0
1086
- ), I ? (ve = P.scrollTop, te()) : _ && xa(a) && Oo();
1107
+ ), P ? (Se = T.scrollTop, ee()) : _ && Ca(a) && Fo();
1087
1108
  };
1088
- return vn = fi(
1109
+ return Ln = _i(
1089
1110
  (a) => {
1090
- Me = a, !Ae && qt(b.getState(), At()) && F(b.getState());
1111
+ Ue = a, !de && Yt(b.getState(), Mt()) && H(b.getState());
1091
1112
  },
1092
1113
  {
1093
1114
  backendUrl: t.backendUrl,
1094
- fetcher: Mo,
1115
+ fetcher: Bo,
1095
1116
  loader: t.activeUsersLoader
1096
1117
  }
1097
1118
  ), b.on("state", (a) => {
1098
- const s = _n && !a.isThinking;
1099
- _n = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Ve && !ze && De === null && S?.hidden !== !1 && (De = window.setTimeout(() => {
1100
- De = null, Ko();
1101
- }, yi)), (!a.isThinking || a.assistantDraft.trim()) && (xn(), lt()), s && !i.classList.contains("pluno-pa-widget--open") && ($e = !0), kt(), a.appearance ? (Pt = !0, ne(
1119
+ const d = Sn && !a.isThinking;
1120
+ Sn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Je && !Oe && ze === null && W?.hidden !== !1 && (ze = window.setTimeout(() => {
1121
+ ze = null, Zo();
1122
+ }, Si)), (!a.isThinking || a.assistantDraft.trim()) && (En(), dt()), d && !i.classList.contains("pluno-pa-widget--open") && (Ye = !0), Tt(), a.appearance ? (Rt = !0, te(
1102
1123
  "web-sdk.widget",
1103
1124
  "Agent state supplied appearance",
1104
1125
  {
1105
1126
  appearance: a.appearance
1106
1127
  }
1107
- ), Dt(a.appearance, "agent.state.appearance")) : Pt && (Pt = !1, ne(
1128
+ ), Ut(a.appearance, "agent.state.appearance")) : Rt && (Rt = !1, te(
1108
1129
  "web-sdk.widget",
1109
1130
  "Agent state cleared appearance; reverting to configured widget options",
1110
1131
  {
@@ -1112,107 +1133,99 @@ async function ta(e = {}) {
1112
1133
  fallbackColorScheme: t.colorScheme,
1113
1134
  fallbackFontFamily: t.fontFamily
1114
1135
  }
1115
- ), Dt({}, "agent.state.appearance-cleared")), F(a), K(), s && mn();
1116
- }), F(b.getState()), K(), {
1136
+ ), Ut({}, "agent.state.appearance-cleared")), H(a), G(), d && xn();
1137
+ }), H(b.getState()), G(), It(), {
1117
1138
  agent: b,
1118
- startNewChat: Nt,
1139
+ startNewChat: zt,
1119
1140
  host: n,
1120
1141
  updateAppearance: (a) => {
1121
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Dt(a, "widgetHandle.updateAppearance");
1142
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Ut(a, "widgetHandle.updateAppearance");
1122
1143
  },
1123
1144
  updateBillingStatus: (a) => {
1124
- const s = a ?? null;
1125
- jn(
1145
+ const d = a ?? null;
1146
+ Zn(
1126
1147
  t.billingStatus,
1127
- s,
1128
- Re
1129
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !re(t.billingStatus) && (Re = null), $t(
1148
+ d,
1149
+ Me
1150
+ ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && (Me = null), Kt(
1130
1151
  i.querySelector(".pluno-pa-widget__billing-status"),
1131
1152
  t.billingStatus,
1132
- Re
1133
- ), K());
1153
+ Me
1154
+ ), G());
1134
1155
  },
1135
1156
  updateAuthGate: (a) => {
1136
- const s = ot();
1137
- t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), it(), F(b.getState()), K(), s && !ot() && b.connect().catch((_) => {
1138
- ne(
1139
- "web-sdk.widget",
1140
- "Failed to connect after auth gate cleared",
1141
- {
1142
- message: _ instanceof Error ? _.message : String(_)
1143
- }
1144
- );
1145
- });
1157
+ const d = Ve();
1158
+ t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Pe(), H(b.getState()), G(), d && !Ve() && It();
1146
1159
  },
1147
1160
  openPanel: () => {
1148
1161
  we(w.value, !1);
1149
1162
  },
1150
- closePanel: St,
1163
+ closePanel: Lt,
1151
1164
  updateDisplayState: (a) => {
1152
1165
  if (a === "shown") {
1153
- He("shown", !1);
1166
+ qe("shown", !1);
1154
1167
  return;
1155
1168
  }
1156
- He("minimized", !1);
1169
+ qe("minimized", !1);
1157
1170
  },
1158
1171
  updateMorningReport: (a) => {
1159
- t.morningReport = a ?? null, F(b.getState());
1172
+ t.morningReport = a ?? null, H(b.getState());
1160
1173
  },
1161
1174
  destroy: () => {
1162
- Ae || (B(), Ae = !0, un.disconnect(), bn?.disconnect(), qo(), window.removeEventListener("resize", gn), hn(), Wo(), se !== null && window.clearTimeout(se), xn(), vn(), Ne?.remove(), b.destroy(), bt.release(), n.remove());
1175
+ de || (F(), de = !0, wn.disconnect(), Cn?.disconnect(), Ko(), window.removeEventListener("resize", bn), _n(), qo(), se !== null && window.clearTimeout(se), En(), Ln(), De?.remove(), b.destroy(), yt.release(), n.remove());
1163
1176
  }
1164
1177
  };
1165
- async function Zo(a) {
1166
- if (!rt) {
1167
- rt = a.id, je = null, F(b.getState());
1178
+ async function ei(a) {
1179
+ if (!st) {
1180
+ st = a.id, Ze = null, H(b.getState());
1168
1181
  try {
1169
1182
  if (!t.socialPostDraftHandler)
1170
1183
  throw new Error("Social post drafting is not available here.");
1171
- const s = await t.socialPostDraftHandler(a);
1172
- if (!s.linkedinPost || !s.xPost)
1184
+ const d = await t.socialPostDraftHandler(a);
1185
+ if (!d.linkedinPost || !d.xPost)
1173
1186
  throw new Error("Pluno did not return a complete social post draft.");
1174
- Te.add(a.id), et.add(a.id), B(), Ne?.remove(), Ne = lr(s, {
1187
+ Re.add(a.id), it.add(a.id), F(), De?.remove(), De = dr(d, {
1175
1188
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1176
1189
  onClose: () => {
1177
- Ne?.remove(), Ne = null;
1190
+ De?.remove(), De = null;
1178
1191
  }
1179
- }), i.appendChild(Ne);
1180
- } catch (s) {
1181
- je = s instanceof Error ? s.message : "Could not draft social post.";
1192
+ }), i.appendChild(De);
1193
+ } catch (d) {
1194
+ Ze = d instanceof Error ? d.message : "Could not draft social post.";
1182
1195
  } finally {
1183
- rt = null, F(b.getState());
1196
+ st = null, H(b.getState());
1184
1197
  }
1185
1198
  }
1186
1199
  }
1187
- function Dt(a, s) {
1188
- const _ = a.accentColor ?? t.accentColor, I = a.colorScheme ?? t.colorScheme, z = a.fontFamily ?? t.fontFamily, Ke = a.scribbleStyle ?? t.scribbleStyle;
1189
- r = Mn(
1200
+ function Ut(a, d) {
1201
+ const _ = a.accentColor ?? t.accentColor, P = a.colorScheme ?? t.colorScheme, O = a.fontFamily ?? t.fontFamily, Qe = a.scribbleStyle ?? t.scribbleStyle;
1202
+ r = Hn(
1190
1203
  _,
1191
- Ke
1192
- ), On(i, r, {
1204
+ Qe
1205
+ ), Wn(i, r, {
1193
1206
  accentColor: _,
1194
- colorScheme: I,
1195
- fontFamily: z,
1196
- scribbleStyle: Ke
1197
- }), ne("web-sdk.widget", "Updated widget appearance", {
1198
- source: s,
1207
+ colorScheme: P,
1208
+ fontFamily: O,
1209
+ scribbleStyle: Qe
1210
+ }), te("web-sdk.widget", "Updated widget appearance", {
1211
+ source: d,
1199
1212
  inputAppearance: a,
1200
1213
  appliedAccentColor: _,
1201
- appliedColorScheme: I,
1202
- appliedFontFamily: z,
1203
- appliedScribbleStyle: Ke,
1214
+ appliedColorScheme: P,
1215
+ appliedFontFamily: O,
1216
+ appliedScribbleStyle: Qe,
1204
1217
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1205
1218
  });
1206
1219
  }
1207
1220
  }
1208
- function Mn(e, t) {
1221
+ function Hn(e, t) {
1209
1222
  return { accentColor: e, scribbleStyle: t };
1210
1223
  }
1211
- function na(e) {
1212
- const t = oa(e);
1213
- return t === null ? "#fafafa" : ia(t) > 0.5 ? "#18181b" : "#fafaf9";
1224
+ function aa(e) {
1225
+ const t = ra(e);
1226
+ return t === null ? "#fafafa" : la(t) > 0.5 ? "#18181b" : "#fafaf9";
1214
1227
  }
1215
- function oa(e) {
1228
+ function ra(e) {
1216
1229
  const t = e.trim();
1217
1230
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1218
1231
  Number.parseInt(t.slice(1, 3), 16),
@@ -1224,14 +1237,14 @@ function oa(e) {
1224
1237
  Number.parseInt(t[3] + t[3], 16)
1225
1238
  ] : null;
1226
1239
  }
1227
- function ia([e, t, n]) {
1240
+ function la([e, t, n]) {
1228
1241
  const o = (i) => {
1229
1242
  const r = i / 255;
1230
1243
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1231
1244
  };
1232
1245
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1233
1246
  }
1234
- function On(e, t, n) {
1247
+ function Wn(e, t, n) {
1235
1248
  e.classList.toggle(
1236
1249
  "pluno-pa-widget--dark",
1237
1250
  n.colorScheme === "dark"
@@ -1239,11 +1252,11 @@ function On(e, t, n) {
1239
1252
  "pluno-pa-widget--light",
1240
1253
  n.colorScheme !== "dark"
1241
1254
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1242
- const o = n.scribbleStyle ? no(n.accentColor) : n.accentColor;
1255
+ const o = n.scribbleStyle ? lo(n.accentColor) : n.accentColor;
1243
1256
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1244
1257
  "--pluno-pa-accent-contrast",
1245
- na(o)
1246
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Fi : n.fontFamily, n.scribbleStyle && aa(e.ownerDocument);
1258
+ aa(o)
1259
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Gi : n.fontFamily, n.scribbleStyle && pa(e.ownerDocument);
1247
1260
  const i = Array.from(
1248
1261
  e.querySelectorAll(".pluno-pa-widget__character")
1249
1262
  );
@@ -1255,11 +1268,11 @@ function On(e, t, n) {
1255
1268
  )
1256
1269
  );
1257
1270
  }
1258
- function aa(e) {
1259
- if (e.getElementById(Nn))
1271
+ function pa(e) {
1272
+ if (e.getElementById(On))
1260
1273
  return;
1261
1274
  const t = e.createElement("style");
1262
- t.id = Nn, t.textContent = `@font-face {
1275
+ t.id = On, t.textContent = `@font-face {
1263
1276
  font-family: "Architects Daughter";
1264
1277
  font-style: normal;
1265
1278
  font-weight: 400;
@@ -1267,7 +1280,7 @@ function aa(e) {
1267
1280
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1268
1281
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1269
1282
  }
1270
- function ra({
1283
+ function sa({
1271
1284
  root: e,
1272
1285
  launcher: t,
1273
1286
  launcherDragHandle: n,
@@ -1275,104 +1288,104 @@ function ra({
1275
1288
  setPosition: i,
1276
1289
  persist: r
1277
1290
  }) {
1278
- let l = null, p = null, d = null, c = !1, u = null;
1291
+ let l = null, p = null, s = null, c = !1, u = null;
1279
1292
  const m = () => {
1280
- l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1293
+ l = null, p = null, s = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1281
1294
  }, k = (h) => {
1282
- e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1295
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, s = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1283
1296
  }, v = (h) => {
1284
- if (l !== h.pointerId || !p || !d)
1297
+ if (l !== h.pointerId || !p || !s)
1285
1298
  return;
1286
1299
  h.preventDefault();
1287
- const A = h.clientX - p.x, L = h.clientY - p.y;
1288
- !c && Math.hypot(A, L) < Jt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + A, y: d.y + L }));
1289
- }, R = (h) => {
1300
+ const S = h.clientX - p.x, A = h.clientY - p.y;
1301
+ !c && Math.hypot(S, A) < nn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + S, y: s.y + A }));
1302
+ }, D = (h) => {
1290
1303
  l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1291
1304
  }, C = (h) => {
1292
1305
  l === h.pointerId && (h.preventDefault(), m());
1293
1306
  }, g = (h) => {
1294
1307
  if (!u)
1295
1308
  return;
1296
- const A = Math.hypot(
1309
+ const S = Math.hypot(
1297
1310
  h.clientX - u.x,
1298
1311
  h.clientY - u.y
1299
- ) <= Jt;
1300
- u = null, A && (h.preventDefault(), h.stopPropagation());
1312
+ ) <= nn;
1313
+ u = null, S && (h.preventDefault(), h.stopPropagation());
1301
1314
  }, y = (h) => {
1302
1315
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1303
1316
  return;
1304
- const A = h.shiftKey ? go : uo, L = o();
1305
- let M = null;
1306
- h.key === "ArrowUp" ? M = { x: L.x, y: L.y - A } : h.key === "ArrowDown" ? M = { x: L.x, y: L.y + A } : h.key === "ArrowLeft" ? M = { x: L.x - A, y: L.y } : h.key === "ArrowRight" && (M = { x: L.x + A, y: L.y }), M && (h.preventDefault(), h.stopPropagation(), i(M), r());
1317
+ const S = h.shiftKey ? bo : wo, A = o();
1318
+ let N = null;
1319
+ h.key === "ArrowUp" ? N = { x: A.x, y: A.y - S } : h.key === "ArrowDown" ? N = { x: A.x, y: A.y + S } : h.key === "ArrowLeft" ? N = { x: A.x - S, y: A.y } : h.key === "ArrowRight" && (N = { x: A.x + S, y: A.y }), N && (h.preventDefault(), h.stopPropagation(), i(N), r());
1307
1320
  };
1308
- return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", R), t.addEventListener("pointercancel", C), t.addEventListener("click", g, !0), n.addEventListener("keydown", y), () => {
1309
- t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", R), t.removeEventListener("pointercancel", C), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", y);
1321
+ return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", D), t.addEventListener("pointercancel", C), t.addEventListener("click", g, !0), n.addEventListener("keydown", y), () => {
1322
+ t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", D), t.removeEventListener("pointercancel", C), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", y);
1310
1323
  };
1311
1324
  }
1312
- function la({
1325
+ function da({
1313
1326
  root: e,
1314
1327
  handles: t,
1315
1328
  getBounds: n,
1316
1329
  setBounds: o,
1317
1330
  persist: i
1318
1331
  }) {
1319
- let r = null, l = null, p = null, d = null, c = !1;
1332
+ let r = null, l = null, p = null, s = null, c = !1;
1320
1333
  const u = () => {
1321
- r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1334
+ r = null, l = null, p = null, s = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1322
1335
  }, m = (g) => {
1323
1336
  const y = g.currentTarget, h = y.dataset.resizeDirection;
1324
- !e.classList.contains("pluno-pa-widget--open") || !Un(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, y.setPointerCapture?.(g.pointerId));
1337
+ !e.classList.contains("pluno-pa-widget--open") || !Gn(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, s = n(), c = !1, y.setPointerCapture?.(g.pointerId));
1325
1338
  }, k = (g) => {
1326
- if (r !== g.pointerId || !l || !p || !d)
1339
+ if (r !== g.pointerId || !l || !p || !s)
1327
1340
  return;
1328
1341
  g.preventDefault(), g.stopPropagation();
1329
1342
  const y = g.clientX - p.x, h = g.clientY - p.y;
1330
- !c && Math.hypot(y, h) < Jt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1331
- Bn(d, l, y, h)
1343
+ !c && Math.hypot(y, h) < nn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1344
+ $n(s, l, y, h)
1332
1345
  ));
1333
1346
  }, v = (g) => {
1334
1347
  r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1335
- }, R = (g) => {
1348
+ }, D = (g) => {
1336
1349
  r === g.pointerId && (g.preventDefault(), u());
1337
1350
  }, C = (g) => {
1338
- const h = g.currentTarget.dataset.resizeDirection, A = g.shiftKey ? go : uo, L = n();
1339
- let M = 0, U = 0;
1340
- Un(h) && (g.key === "ArrowLeft" ? M = -A : g.key === "ArrowRight" ? M = A : g.key === "ArrowUp" ? U = -A : g.key === "ArrowDown" && (U = A), !(M === 0 && U === 0) && (g.preventDefault(), g.stopPropagation(), o(Bn(L, h, M, U)), i()));
1351
+ const h = g.currentTarget.dataset.resizeDirection, S = g.shiftKey ? bo : wo, A = n();
1352
+ let N = 0, q = 0;
1353
+ Gn(h) && (g.key === "ArrowLeft" ? N = -S : g.key === "ArrowRight" ? N = S : g.key === "ArrowUp" ? q = -S : g.key === "ArrowDown" && (q = S), !(N === 0 && q === 0) && (g.preventDefault(), g.stopPropagation(), o($n(A, h, N, q)), i()));
1341
1354
  };
1342
1355
  for (const g of t)
1343
- g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", R), g.addEventListener("keydown", C);
1356
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", D), g.addEventListener("keydown", C);
1344
1357
  return () => {
1345
1358
  for (const g of t)
1346
- g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", R), g.removeEventListener("keydown", C);
1359
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", D), g.removeEventListener("keydown", C);
1347
1360
  };
1348
1361
  }
1349
- function Un(e) {
1362
+ function Gn(e) {
1350
1363
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1351
1364
  }
1352
- function Bn(e, t, n, o) {
1353
- const i = Z(), r = Fn({
1365
+ function $n(e, t, n, o) {
1366
+ const i = Z(), r = qn({
1354
1367
  leading: e.position.x,
1355
1368
  length: e.size.width,
1356
1369
  delta: n,
1357
1370
  resizeLeading: t.endsWith("left") || t === "left",
1358
1371
  resizeTrailing: t.endsWith("right") || t === "right",
1359
- minLeading: T,
1360
- maxTrailing: i.width - T,
1372
+ minLeading: I,
1373
+ maxTrailing: i.width - I,
1361
1374
  minLength: Math.min(
1362
- an,
1363
- i.width - T * 2
1375
+ sn,
1376
+ i.width - I * 2
1364
1377
  )
1365
- }), l = Fn({
1378
+ }), l = qn({
1366
1379
  leading: e.position.y,
1367
1380
  length: e.size.height,
1368
1381
  delta: o,
1369
1382
  resizeLeading: t.startsWith("top") || t === "top",
1370
1383
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1371
- minLeading: Le,
1372
- maxTrailing: i.height - T,
1384
+ minLeading: Ie,
1385
+ maxTrailing: i.height - I,
1373
1386
  minLength: Math.min(
1374
- rn,
1375
- i.height - Le - T
1387
+ dn,
1388
+ i.height - Ie - I
1376
1389
  )
1377
1390
  });
1378
1391
  return {
@@ -1380,7 +1393,7 @@ function Bn(e, t, n, o) {
1380
1393
  size: { width: r.length, height: l.length }
1381
1394
  };
1382
1395
  }
1383
- function Fn({
1396
+ function qn({
1384
1397
  leading: e,
1385
1398
  length: t,
1386
1399
  delta: n,
@@ -1390,22 +1403,22 @@ function Fn({
1390
1403
  maxTrailing: l,
1391
1404
  minLength: p
1392
1405
  }) {
1393
- const d = e + t;
1406
+ const s = e + t;
1394
1407
  if (o) {
1395
1408
  const c = e + n;
1396
1409
  if (c >= r) {
1397
- const m = X(c, r, d - p);
1398
- return { leading: m, length: d - m };
1410
+ const m = X(c, r, s - p);
1411
+ return { leading: m, length: s - m };
1399
1412
  }
1400
1413
  const u = X(
1401
- d + r - c,
1402
- d,
1414
+ s + r - c,
1415
+ s,
1403
1416
  l
1404
1417
  );
1405
1418
  return { leading: r, length: u - r };
1406
1419
  }
1407
1420
  if (i) {
1408
- const c = d + n;
1421
+ const c = s + n;
1409
1422
  if (c <= l) {
1410
1423
  const m = X(
1411
1424
  c,
@@ -1423,79 +1436,79 @@ function Fn({
1423
1436
  }
1424
1437
  return { leading: e, length: t };
1425
1438
  }
1426
- function ht(e, t = !0) {
1439
+ function wt(e, t = !0) {
1427
1440
  const n = Z();
1428
1441
  if (e.classList.contains("pluno-pa-widget--minimized"))
1429
1442
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1430
- width: Hi,
1431
- height: Wi
1432
- } : { width: Rn, height: Rn };
1443
+ width: $i,
1444
+ height: qi
1445
+ } : { width: Un, height: Un };
1433
1446
  const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1434
1447
  return {
1435
- width: t && i && o.width > 0 ? o.width : Math.min(po, n.width - 36),
1436
- height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? $i : so
1448
+ width: t && i && o.width > 0 ? o.width : Math.min(ho, n.width - 36),
1449
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vi : mo
1437
1450
  };
1438
1451
  }
1439
- function pa() {
1452
+ function ca() {
1440
1453
  const e = Z();
1441
1454
  return {
1442
1455
  width: Math.min(
1443
1456
  X(
1444
- e.width * ji,
1445
- an,
1446
- qi
1457
+ e.width * Yi,
1458
+ sn,
1459
+ Ki
1447
1460
  ),
1448
- e.width - T * 2
1461
+ e.width - I * 2
1449
1462
  ),
1450
1463
  height: Math.min(
1451
1464
  X(
1452
- e.height * Ki,
1453
- rn,
1454
- Vi
1465
+ e.height * Zi,
1466
+ dn,
1467
+ Xi
1455
1468
  ),
1456
- e.height - Le - T
1469
+ e.height - Ie - I
1457
1470
  )
1458
1471
  };
1459
1472
  }
1460
- function Ue(e = null) {
1461
- return e ? ft(e) : pa();
1473
+ function Fe(e = null) {
1474
+ return e ? _t(e) : ca();
1462
1475
  }
1463
- function ft(e) {
1476
+ function _t(e) {
1464
1477
  const t = Z();
1465
1478
  return {
1466
1479
  width: X(
1467
1480
  e.width,
1468
1481
  Math.min(
1469
- an,
1470
- t.width - T * 2
1482
+ sn,
1483
+ t.width - I * 2
1471
1484
  ),
1472
1485
  Math.max(
1473
- T,
1474
- t.width - T * 2
1486
+ I,
1487
+ t.width - I * 2
1475
1488
  )
1476
1489
  ),
1477
1490
  height: X(
1478
1491
  e.height,
1479
1492
  Math.min(
1480
- rn,
1481
- t.height - Le - T
1493
+ dn,
1494
+ t.height - Ie - I
1482
1495
  ),
1483
1496
  Math.max(
1484
- T,
1485
- t.height - Le - T
1497
+ I,
1498
+ t.height - Ie - I
1486
1499
  )
1487
1500
  )
1488
1501
  };
1489
1502
  }
1490
- function Ot(e, t) {
1503
+ function Ht(e, t) {
1491
1504
  if (!t) {
1492
1505
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1493
1506
  return;
1494
1507
  }
1495
- const n = ft(t);
1508
+ const n = _t(t);
1496
1509
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1497
1510
  }
1498
- function sa(e, t, n) {
1511
+ function ua(e, t, n) {
1499
1512
  const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1500
1513
  if (Number.isFinite(o) && Number.isFinite(i))
1501
1514
  return { x: o, y: i };
@@ -1508,30 +1521,30 @@ function sa(e, t, n) {
1508
1521
  y: l.height - 24 - n.height
1509
1522
  };
1510
1523
  }
1511
- function Ut(e, t, n) {
1512
- const o = ht(e, !1);
1513
- return t ? Qt(
1524
+ function Wt(e, t, n) {
1525
+ const o = wt(e, !1);
1526
+ return t ? on(
1514
1527
  e,
1515
- fo(t, o),
1528
+ yo(t, o),
1516
1529
  o
1517
- ) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
1530
+ ) : ga(n === "bottom-left" ? "bottom-left" : "bottom-right", o, ji);
1518
1531
  }
1519
- function da(e, t, n) {
1532
+ function ga(e, t, n) {
1520
1533
  const o = Z();
1521
1534
  return {
1522
1535
  x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1523
1536
  y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1524
1537
  };
1525
1538
  }
1526
- function Qt(e, t, n) {
1527
- const o = Z(), i = T + ga(e);
1539
+ function on(e, t, n) {
1540
+ const o = Z(), i = I + fa(e);
1528
1541
  return {
1529
1542
  x: X(
1530
1543
  t.x,
1531
- T,
1544
+ I,
1532
1545
  Math.max(
1533
- T,
1534
- o.width - n.width - T
1546
+ I,
1547
+ o.width - n.width - I
1535
1548
  )
1536
1549
  ),
1537
1550
  y: X(
@@ -1539,81 +1552,81 @@ function Qt(e, t, n) {
1539
1552
  i,
1540
1553
  Math.max(
1541
1554
  i,
1542
- o.height - n.height - T
1555
+ o.height - n.height - I
1543
1556
  )
1544
1557
  )
1545
1558
  };
1546
1559
  }
1547
- function fo(e, t) {
1560
+ function yo(e, t) {
1548
1561
  const n = Z();
1549
1562
  return {
1550
1563
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1551
1564
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1552
1565
  };
1553
1566
  }
1554
- function ca(e, t) {
1555
- const n = ua(e, t), o = Z();
1567
+ function ha(e, t) {
1568
+ const n = ma(e, t), o = Z();
1556
1569
  return {
1557
1570
  anchor: n,
1558
1571
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1559
1572
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1560
1573
  };
1561
1574
  }
1562
- function ua(e, t) {
1575
+ function ma(e, t) {
1563
1576
  const n = Z(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1564
1577
  return `${r}-${l}`;
1565
1578
  }
1566
- function ga(e) {
1567
- return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
1579
+ function fa(e) {
1580
+ return e.classList.contains("pluno-pa-widget--scribble") ? ta : ea;
1568
1581
  }
1569
- function Bt(e, t, n, o = null) {
1570
- const i = ht(e), r = Ue(o), l = {
1582
+ function Gt(e, t, n, o = null) {
1583
+ const i = wt(e), r = Fe(o), l = {
1571
1584
  x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1572
1585
  y: t.y + i.height - r.height
1573
1586
  };
1574
- return ct(l, r);
1587
+ return ht(l, r);
1575
1588
  }
1576
- function ct(e, t) {
1589
+ function ht(e, t) {
1577
1590
  const n = Z();
1578
1591
  return {
1579
1592
  x: X(
1580
1593
  e.x,
1581
- T,
1594
+ I,
1582
1595
  Math.max(
1583
- T,
1584
- n.width - t.width - T
1596
+ I,
1597
+ n.width - t.width - I
1585
1598
  )
1586
1599
  ),
1587
1600
  y: X(
1588
1601
  e.y,
1589
- Le,
1602
+ Ie,
1590
1603
  Math.max(
1591
- Le,
1592
- n.height - t.height - T
1604
+ Ie,
1605
+ n.height - t.height - I
1593
1606
  )
1594
1607
  )
1595
1608
  };
1596
1609
  }
1597
- function ke(e, t) {
1610
+ function Te(e, t) {
1598
1611
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1599
1612
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1600
1613
  return;
1601
1614
  }
1602
1615
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1603
1616
  }
1604
- function ha(e, t) {
1617
+ function wa(e, t) {
1605
1618
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1606
1619
  }
1607
- function Hn(e) {
1620
+ function jn(e) {
1608
1621
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1609
1622
  }
1610
1623
  function Z() {
1611
1624
  return {
1612
- width: window.innerWidth || document.documentElement.clientWidth || po + T * 2,
1613
- height: window.innerHeight || document.documentElement.clientHeight || so + T * 2
1625
+ width: window.innerWidth || document.documentElement.clientWidth || ho + I * 2,
1626
+ height: window.innerHeight || document.documentElement.clientHeight || mo + I * 2
1614
1627
  };
1615
1628
  }
1616
- function Ft(e) {
1629
+ function $t(e) {
1617
1630
  const t = e.getBoundingClientRect();
1618
1631
  return {
1619
1632
  x: Math.round(t.x),
@@ -1625,7 +1638,7 @@ function Ft(e) {
1625
1638
  function X(e, t, n) {
1626
1639
  return Math.min(Math.max(e, t), n);
1627
1640
  }
1628
- function ne(e, t, n) {
1641
+ function te(e, t, n) {
1629
1642
  if (typeof window > "u")
1630
1643
  return;
1631
1644
  const o = window, i = {
@@ -1635,44 +1648,44 @@ function ne(e, t, n) {
1635
1648
  details: n
1636
1649
  }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1637
1650
  r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1638
- new CustomEvent(Di, { detail: i })
1651
+ new CustomEvent(Oi, { detail: i })
1639
1652
  );
1640
1653
  }
1641
- function ma(e, t) {
1642
- ne("web-sdk.widget.position", e, t);
1654
+ function ba(e, t) {
1655
+ te("web-sdk.widget.position", e, t);
1643
1656
  }
1644
- function Ht(e, t, n) {
1657
+ function qt(e, t, n) {
1645
1658
  const o = t.value.trim();
1646
1659
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1647
- attachments: n.length > 0 ? n.map(ba) : void 0
1660
+ attachments: n.length > 0 ? n.map(ya) : void 0
1648
1661
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1649
1662
  }
1650
- function fa(e, t, n) {
1663
+ function _a(e, t, n) {
1651
1664
  const o = e.activeElement;
1652
1665
  return o === n ? "composer" : o === t ? "launcher" : null;
1653
1666
  }
1654
- function wa(e, t, n, o) {
1655
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > vi)
1667
+ function xa(e, t, n, o) {
1668
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Ei)
1656
1669
  return;
1657
1670
  const i = e.focusedInput === "composer" ? o : n;
1658
1671
  i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1659
1672
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1660
1673
  });
1661
1674
  }
1662
- function ba(e) {
1675
+ function ya(e) {
1663
1676
  return e;
1664
1677
  }
1665
- function Ye(e) {
1678
+ function et(e) {
1666
1679
  e.style.height = "0px";
1667
1680
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1668
1681
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1669
1682
  }
1670
- function Xe(e, t = () => !0) {
1683
+ function tt(e, t = () => !0) {
1671
1684
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1672
1685
  t() && (e.scrollTop = e.scrollHeight);
1673
1686
  });
1674
1687
  }
1675
- function _a(e) {
1688
+ function va(e) {
1676
1689
  const t = e.messages[e.messages.length - 1];
1677
1690
  return [
1678
1691
  e.messages.length,
@@ -1683,13 +1696,13 @@ function _a(e) {
1683
1696
  e.lastError ?? ""
1684
1697
  ].join(":");
1685
1698
  }
1686
- function xa(e) {
1699
+ function Ca(e) {
1687
1700
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1688
1701
  }
1689
- function ya(e) {
1702
+ function Sa(e) {
1690
1703
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1691
1704
  }
1692
- function va(e) {
1705
+ function Ea(e) {
1693
1706
  const t = e.currentPage;
1694
1707
  if (typeof t?.url == "string" && t.url.trim())
1695
1708
  try {
@@ -1700,7 +1713,7 @@ function va(e) {
1700
1713
  }
1701
1714
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1702
1715
  }
1703
- function Ca(e, t) {
1716
+ function ka(e, t) {
1704
1717
  const n = new Date(e).getTime();
1705
1718
  if (!Number.isFinite(n))
1706
1719
  return "now";
@@ -1716,31 +1729,31 @@ function Ca(e, t) {
1716
1729
  }
1717
1730
  return "now";
1718
1731
  }
1719
- function Sa(e, t, n, o, i) {
1720
- e.appendChild(Ra()), e.appendChild(
1721
- Ea(
1732
+ function La(e, t, n, o, i) {
1733
+ e.appendChild(za()), e.appendChild(
1734
+ Pa(
1722
1735
  t,
1723
1736
  n,
1724
1737
  o,
1725
1738
  i
1726
1739
  )
1727
1740
  ), e.appendChild(
1728
- wt(
1741
+ xt(
1729
1742
  "pluno-pa-widget__close",
1730
1743
  "Close",
1731
- Da(16),
1744
+ Oa(16),
1732
1745
  !0
1733
1746
  )
1734
- ), e.appendChild(ka(n));
1747
+ ), e.appendChild(Ta(n));
1735
1748
  }
1736
- function Ea(e, t, n, o) {
1749
+ function Pa(e, t, n, o) {
1737
1750
  const i = document.createElement("form");
1738
1751
  if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1739
- const d = document.createElement("button");
1740
- d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
1752
+ const s = document.createElement("button");
1753
+ s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", i.appendChild(s);
1741
1754
  }
1742
1755
  i.appendChild(
1743
- xo(
1756
+ Eo(
1744
1757
  "pluno-pa-widget__scribble-spirals--launcher",
1745
1758
  10
1746
1759
  )
@@ -1754,22 +1767,22 @@ function Ea(e, t, n, o) {
1754
1767
  r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1755
1768
  const l = document.createElement("input");
1756
1769
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1757
- const p = mt("Working...");
1770
+ const p = bt("Working...");
1758
1771
  if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1759
- const d = document.createElement("button");
1760
- d.type = "button", d.className = "pluno-pa-widget__launcher-minimize", d.textContent = "-", d.setAttribute("aria-label", "Minimize Pluno on this site"), d.title = "Minimize Pluno on this site", i.appendChild(d);
1772
+ const s = document.createElement("button");
1773
+ s.type = "button", s.className = "pluno-pa-widget__launcher-minimize", s.textContent = "-", s.setAttribute("aria-label", "Minimize Pluno on this site"), s.title = "Minimize Pluno on this site", i.appendChild(s);
1761
1774
  }
1762
1775
  return i;
1763
1776
  }
1764
- function ka(e) {
1777
+ function Ta(e) {
1765
1778
  const t = document.createElement("section");
1766
1779
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1767
- xo("pluno-pa-widget__scribble-spirals--panel", 16)
1780
+ Eo("pluno-pa-widget__scribble-spirals--panel", 16)
1768
1781
  );
1769
1782
  const n = document.createElement("div");
1770
1783
  n.className = "pluno-pa-widget__timeline-wrap";
1771
1784
  const o = document.createElement("main");
1772
- o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
1785
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Ra(e));
1773
1786
  const i = document.createElement("div");
1774
1787
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1775
1788
  const r = document.createElement("div");
@@ -1778,13 +1791,13 @@ function ka(e) {
1778
1791
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1779
1792
  const p = document.createElement("div");
1780
1793
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1781
- wt(
1794
+ xt(
1782
1795
  "pluno-pa-widget__history",
1783
- en(),
1784
- Ma(),
1796
+ an(),
1797
+ Ba(),
1785
1798
  !0
1786
1799
  )
1787
- ), n.appendChild(p), n.appendChild(Pa()), t.appendChild(n), t.appendChild(La()), t.appendChild(Ia()), t.appendChild(be("left", "Resize Pluno from left")), t.appendChild(
1800
+ ), n.appendChild(p), n.appendChild(Na()), t.appendChild(n), t.appendChild(Ia()), t.appendChild(Aa()), t.appendChild(be("left", "Resize Pluno from left")), t.appendChild(
1788
1801
  be("right", "Resize Pluno from right")
1789
1802
  ), t.appendChild(be("top", "Resize Pluno from top")), t.appendChild(
1790
1803
  be("bottom", "Resize Pluno from bottom")
@@ -1805,7 +1818,7 @@ function be(e, t) {
1805
1818
  `pluno-pa-widget__resize-handle--${e}`
1806
1819
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1807
1820
  }
1808
- function La() {
1821
+ function Ia() {
1809
1822
  const e = document.createElement("div");
1810
1823
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1811
1824
  const t = document.createElement("span");
@@ -1819,7 +1832,7 @@ function La() {
1819
1832
  const r = document.createElement("button");
1820
1833
  return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
1821
1834
  }
1822
- function Ia() {
1835
+ function Aa() {
1823
1836
  const e = document.createElement("form");
1824
1837
  e.className = "pluno-pa-widget__composer";
1825
1838
  const t = document.createElement("div");
@@ -1833,11 +1846,11 @@ function Ia() {
1833
1846
  const r = document.createElement("input");
1834
1847
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1835
1848
  const l = document.createElement("button");
1836
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ua()), l.appendChild(Ba()), i.appendChild(l);
1849
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ha()), l.appendChild(Wa()), i.appendChild(l);
1837
1850
  const p = document.createElement("textarea");
1838
1851
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1839
- const d = document.createElement("button");
1840
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(vo()), i.appendChild(d), e.appendChild(i);
1852
+ const s = document.createElement("button");
1853
+ s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(Lo()), i.appendChild(s), e.appendChild(i);
1841
1854
  const c = document.createElement("div");
1842
1855
  c.className = "pluno-pa-widget__composer-meta";
1843
1856
  const u = document.createElement("a");
@@ -1845,20 +1858,20 @@ function Ia() {
1845
1858
  const m = document.createElement("span");
1846
1859
  return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1847
1860
  }
1848
- function en() {
1861
+ function an() {
1849
1862
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1850
1863
  }
1851
- function Pa() {
1864
+ function Na() {
1852
1865
  const e = document.createElement("section");
1853
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", en());
1866
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", an());
1854
1867
  const t = document.createElement("div");
1855
1868
  t.className = "pluno-pa-widget__history-header";
1856
1869
  const n = document.createElement("strong");
1857
- n.textContent = en();
1858
- const o = wt(
1870
+ n.textContent = an();
1871
+ const o = xt(
1859
1872
  "pluno-pa-widget__history-close",
1860
1873
  "Close recent chats",
1861
- Oa(),
1874
+ Fa(),
1862
1875
  !1
1863
1876
  );
1864
1877
  t.append(n, o);
@@ -1867,20 +1880,20 @@ function Pa() {
1867
1880
  const r = document.createElement("p");
1868
1881
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1869
1882
  }
1870
- function Ta(e) {
1883
+ function Ra(e) {
1871
1884
  const t = document.createElement("div");
1872
1885
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1873
1886
  _e(
1874
1887
  "pluno-pa-widget__character--empty",
1875
1888
  e
1876
1889
  )
1877
- ), t.appendChild(wo()), t;
1890
+ ), t.appendChild(vo()), t;
1878
1891
  }
1879
- function wo() {
1892
+ function vo() {
1880
1893
  const e = document.createElement("div");
1881
1894
  return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
1882
1895
  }
1883
- function bo(e, t) {
1896
+ function Co(e, t) {
1884
1897
  e.replaceChildren(), e.setAttribute(
1885
1898
  "aria-label",
1886
1899
  `${t.toLocaleString("en-US")} users currently active`
@@ -1893,16 +1906,16 @@ function bo(e, t) {
1893
1906
  );
1894
1907
  }
1895
1908
  function _e(e, t) {
1896
- const n = `pluno-pa-character-${zn}`;
1897
- zn += 1;
1898
- const o = t.scribbleStyle ? Na(t.accentColor, n) : Aa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1909
+ const n = `pluno-pa-character-${Fn}`;
1910
+ Fn += 1;
1911
+ const o = t.scribbleStyle ? Ma(t.accentColor, n) : Da(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1899
1912
  return o.setAttribute(
1900
1913
  "class",
1901
1914
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1902
1915
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1903
1916
  }
1904
- function Aa(e, t) {
1905
- const n = ni(e), o = {
1917
+ function Da(e, t) {
1918
+ const n = ai(e), o = {
1906
1919
  boltFill: `${t}-boltFill`,
1907
1920
  boltEdge: `${t}-boltEdge`,
1908
1921
  boltGlow: `${t}-boltGlow`,
@@ -1913,7 +1926,7 @@ function Aa(e, t) {
1913
1926
  eyeShadow: `${t}-eyeShadow`,
1914
1927
  pupilGloss: `${t}-pupilGloss`,
1915
1928
  boltClip: `${t}-boltClip`
1916
- }, i = _o(), r = f(i, "defs"), l = f(r, "linearGradient", {
1929
+ }, i = So(), r = f(i, "defs"), l = f(r, "linearGradient", {
1917
1930
  id: o.boltFill,
1918
1931
  x1: "420",
1919
1932
  y1: "180",
@@ -1921,7 +1934,7 @@ function Aa(e, t) {
1921
1934
  y2: "1040",
1922
1935
  gradientUnits: "userSpaceOnUse"
1923
1936
  });
1924
- O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1937
+ B(l, "0", n.top), B(l, "0.36", n.middle), B(l, "0.72", n.bottom), B(l, "1", n.bottom);
1925
1938
  const p = f(r, "linearGradient", {
1926
1939
  id: o.boltEdge,
1927
1940
  x1: "470",
@@ -1930,28 +1943,28 @@ function Aa(e, t) {
1930
1943
  y2: "980",
1931
1944
  gradientUnits: "userSpaceOnUse"
1932
1945
  });
1933
- O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1934
- const d = f(r, "radialGradient", {
1946
+ B(p, "0", n.edgeStart), B(p, "0.32", n.edgeMiddle), B(p, "0.78", n.edgeEnd), B(p, "1", n.edgeEnd);
1947
+ const s = f(r, "radialGradient", {
1935
1948
  id: o.boltGlow,
1936
1949
  cx: "50%",
1937
1950
  cy: "22%",
1938
1951
  r: "82%"
1939
1952
  });
1940
- O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1953
+ B(s, "0", n.glow, "0.72"), B(s, "0.5", n.middle, "0.44"), B(s, "1", n.bottom, "0");
1941
1954
  const c = f(r, "radialGradient", {
1942
1955
  id: o.eyeWhite,
1943
1956
  cx: "35%",
1944
1957
  cy: "25%",
1945
1958
  r: "70%"
1946
1959
  });
1947
- O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1960
+ B(c, "0", "#ffffff"), B(c, "0.72", "#ffffff"), B(c, "1", "#e5e5e5");
1948
1961
  const u = f(r, "radialGradient", {
1949
1962
  id: o.pupil,
1950
1963
  cx: "42%",
1951
1964
  cy: "38%",
1952
1965
  r: "65%"
1953
1966
  });
1954
- O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1967
+ B(u, "0", "#2a1f10"), B(u, "0.52", "#080604"), B(u, "1", "#000000");
1955
1968
  const m = f(r, "filter", {
1956
1969
  id: o.softDropShadow,
1957
1970
  x: "-18%",
@@ -2015,7 +2028,7 @@ function Aa(e, t) {
2015
2028
  "flood-color": n.shadow,
2016
2029
  "flood-opacity": "0.3"
2017
2030
  });
2018
- const R = f(r, "filter", {
2031
+ const D = f(r, "filter", {
2019
2032
  id: o.pupilGloss,
2020
2033
  x: "-15%",
2021
2034
  y: "-15%",
@@ -2023,7 +2036,7 @@ function Aa(e, t) {
2023
2036
  height: "130%",
2024
2037
  "color-interpolation-filters": "sRGB"
2025
2038
  });
2026
- f(R, "feDropShadow", {
2039
+ f(D, "feDropShadow", {
2027
2040
  dx: "0",
2028
2041
  dy: "3",
2029
2042
  stdDeviation: "3",
@@ -2031,12 +2044,12 @@ function Aa(e, t) {
2031
2044
  "flood-opacity": "0.22"
2032
2045
  });
2033
2046
  const C = f(r, "clipPath", { id: o.boltClip });
2034
- f(C, "path", { d: ut });
2047
+ f(C, "path", { d: mt });
2035
2048
  const g = f(i, "g", {
2036
2049
  filter: Y(o.softDropShadow)
2037
2050
  });
2038
2051
  f(g, "path", {
2039
- d: ut,
2052
+ d: mt,
2040
2053
  fill: Y(o.boltEdge)
2041
2054
  });
2042
2055
  const y = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
@@ -2075,9 +2088,9 @@ function Aa(e, t) {
2075
2088
  "stroke-linecap": "round",
2076
2089
  opacity: "0.48"
2077
2090
  });
2078
- const A = f(i, "g", { filter: Y(o.eyeShadow) });
2079
- return Wn(
2080
- A,
2091
+ const S = f(i, "g", { filter: Y(o.eyeShadow) });
2092
+ return Vn(
2093
+ S,
2081
2094
  "rotate(-2 528 463)",
2082
2095
  "528",
2083
2096
  "463",
@@ -2086,8 +2099,8 @@ function Aa(e, t) {
2086
2099
  "557",
2087
2100
  "447",
2088
2101
  o
2089
- ), Wn(
2090
- A,
2102
+ ), Vn(
2103
+ S,
2091
2104
  "rotate(2 717 462)",
2092
2105
  "717",
2093
2106
  "462",
@@ -2098,12 +2111,12 @@ function Aa(e, t) {
2098
2111
  o
2099
2112
  ), i;
2100
2113
  }
2101
- function Na(e, t) {
2102
- const n = no(e), o = {
2114
+ function Ma(e, t) {
2115
+ const n = lo(e), o = {
2103
2116
  clip: `${t}-scribbleBoltClip`,
2104
2117
  wobble: `${t}-scribbleBoltWobble`
2105
- }, i = _o(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2106
- f(l, "path", { d: ut });
2118
+ }, i = So(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2119
+ f(l, "path", { d: mt });
2107
2120
  const p = f(r, "filter", {
2108
2121
  id: o.wobble,
2109
2122
  x: "-10%",
@@ -2125,11 +2138,11 @@ function Na(e, t) {
2125
2138
  xChannelSelector: "R",
2126
2139
  yChannelSelector: "G"
2127
2140
  });
2128
- const d = f(i, "g", { filter: Y(o.wobble) }), c = f(d, "g", {
2141
+ const s = f(i, "g", { filter: Y(o.wobble) }), c = f(s, "g", {
2129
2142
  "clip-path": Y(o.clip)
2130
2143
  });
2131
2144
  return f(c, "path", {
2132
- d: ti(),
2145
+ d: ii(),
2133
2146
  fill: "none",
2134
2147
  stroke: n,
2135
2148
  "stroke-width": "56",
@@ -2137,14 +2150,14 @@ function Na(e, t) {
2137
2150
  "stroke-linejoin": "round",
2138
2151
  opacity: "0.9",
2139
2152
  transform: "rotate(-14 627 600)"
2140
- }), f(d, "path", {
2141
- d: ut,
2153
+ }), f(s, "path", {
2154
+ d: mt,
2142
2155
  fill: "none",
2143
- stroke: gt,
2156
+ stroke: ft,
2144
2157
  "stroke-width": "18",
2145
2158
  "stroke-linejoin": "round"
2146
- }), Gn(
2147
- d,
2159
+ }), Kn(
2160
+ s,
2148
2161
  "rotate(-2 528 463)",
2149
2162
  "528",
2150
2163
  "463",
@@ -2152,8 +2165,8 @@ function Na(e, t) {
2152
2165
  "473",
2153
2166
  "557",
2154
2167
  "447"
2155
- ), Gn(
2156
- d,
2168
+ ), Kn(
2169
+ s,
2157
2170
  "rotate(2 717 462)",
2158
2171
  "717",
2159
2172
  "462",
@@ -2163,27 +2176,27 @@ function Na(e, t) {
2163
2176
  "447"
2164
2177
  ), i;
2165
2178
  }
2166
- function _o() {
2179
+ function So() {
2167
2180
  return E("svg", {
2168
- xmlns: co,
2181
+ xmlns: fo,
2169
2182
  viewBox: "0 0 1254 1254"
2170
2183
  });
2171
2184
  }
2172
- function Wn(e, t, n, o, i, r, l, p, d) {
2185
+ function Vn(e, t, n, o, i, r, l, p, s) {
2173
2186
  const c = f(e, "g", { transform: t });
2174
2187
  f(c, "ellipse", {
2175
2188
  cx: n,
2176
2189
  cy: o,
2177
2190
  rx: "73",
2178
2191
  ry: "80",
2179
- fill: Y(d.eyeWhite)
2192
+ fill: Y(s.eyeWhite)
2180
2193
  }), f(c, "ellipse", {
2181
2194
  cx: i,
2182
2195
  cy: r,
2183
2196
  rx: "49",
2184
2197
  ry: "57",
2185
- fill: Y(d.pupil),
2186
- filter: Y(d.pupilGloss)
2198
+ fill: Y(s.pupil),
2199
+ filter: Y(s.pupilGloss)
2187
2200
  }), f(c, "circle", {
2188
2201
  cx: l,
2189
2202
  cy: p,
@@ -2191,23 +2204,23 @@ function Wn(e, t, n, o, i, r, l, p, d) {
2191
2204
  fill: "#ffffff"
2192
2205
  });
2193
2206
  }
2194
- function Gn(e, t, n, o, i, r, l, p) {
2195
- const d = f(e, "g", { transform: t });
2196
- f(d, "ellipse", {
2207
+ function Kn(e, t, n, o, i, r, l, p) {
2208
+ const s = f(e, "g", { transform: t });
2209
+ f(s, "ellipse", {
2197
2210
  cx: n,
2198
2211
  cy: o,
2199
2212
  rx: "73",
2200
2213
  ry: "80",
2201
2214
  fill: "#ffffff",
2202
- stroke: gt,
2215
+ stroke: ft,
2203
2216
  "stroke-width": "13"
2204
- }), f(d, "ellipse", {
2217
+ }), f(s, "ellipse", {
2205
2218
  cx: i,
2206
2219
  cy: r,
2207
2220
  rx: "45",
2208
2221
  ry: "53",
2209
- fill: gt
2210
- }), f(d, "circle", {
2222
+ fill: ft
2223
+ }), f(s, "circle", {
2211
2224
  cx: l,
2212
2225
  cy: p,
2213
2226
  r: "16",
@@ -2218,18 +2231,18 @@ function f(e, t, n = {}) {
2218
2231
  const o = E(t, n);
2219
2232
  return e.appendChild(o), o;
2220
2233
  }
2221
- function O(e, t, n, o) {
2234
+ function B(e, t, n, o) {
2222
2235
  const i = { offset: t, "stop-color": n };
2223
2236
  o !== void 0 && (i["stop-opacity"] = o), f(e, "stop", i);
2224
2237
  }
2225
2238
  function Y(e) {
2226
2239
  return `url(#${e})`;
2227
2240
  }
2228
- function wt(e, t, n, o) {
2241
+ function xt(e, t, n, o) {
2229
2242
  const i = document.createElement("button");
2230
2243
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2231
2244
  }
2232
- function Ra() {
2245
+ function za() {
2233
2246
  const e = E("svg", {
2234
2247
  class: "pluno-pa-widget__scribble-defs",
2235
2248
  "aria-hidden": "true",
@@ -2237,46 +2250,46 @@ function Ra() {
2237
2250
  width: "0",
2238
2251
  height: "0"
2239
2252
  }), t = E("defs");
2240
- return t.appendChild(Gt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2241
- Gt("pluno-pa-scribble-wobble-2", "5", "15")
2253
+ return t.appendChild(Vt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2254
+ Vt("pluno-pa-scribble-wobble-2", "5", "15")
2242
2255
  ), t.appendChild(
2243
- Gt("pluno-pa-scribble-wobble-3", "9", "19")
2256
+ Vt("pluno-pa-scribble-wobble-3", "9", "19")
2244
2257
  ), e.appendChild(t), e;
2245
2258
  }
2246
- function xo(e, t) {
2259
+ function Eo(e, t) {
2247
2260
  const n = E("svg", {
2248
2261
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2249
2262
  preserveAspectRatio: "xMidYMid meet",
2250
2263
  "aria-hidden": "true",
2251
2264
  focusable: "false"
2252
2265
  });
2253
- return yo(n, t), n;
2266
+ return ko(n, t), n;
2254
2267
  }
2255
- function Wt(e, t) {
2268
+ function jt(e, t) {
2256
2269
  if (!e)
2257
2270
  return;
2258
2271
  const n = Math.max(
2259
2272
  0,
2260
- t - Zt * 2
2273
+ t - tn * 2
2261
2274
  ), o = Math.max(
2262
- Xi,
2275
+ Qi,
2263
2276
  Math.floor(
2264
- (n - Xt * 2) / Yt
2277
+ (n - en * 2) / Qt
2265
2278
  )
2266
2279
  );
2267
- yo(e, o);
2280
+ ko(e, o);
2268
2281
  }
2269
- function yo(e, t) {
2282
+ function ko(e, t) {
2270
2283
  if (e.dataset.spiralCount === `${t}`)
2271
2284
  return;
2272
- const n = t * Yt + Xt * 2;
2285
+ const n = t * Qt + en * 2;
2273
2286
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2274
2287
  "viewBox",
2275
- `0 0 ${n} ${Yi}`
2288
+ `0 0 ${n} ${Ji}`
2276
2289
  ), e.replaceChildren();
2277
2290
  for (let o = 0; o < t; o += 1) {
2278
- const i = Dn[o % Dn.length], r = E("g", {
2279
- transform: `translate(${Xt + o * Yt} 0)`
2291
+ const i = Bn[o % Bn.length], r = E("g", {
2292
+ transform: `translate(${en + o * Qt} 0)`
2280
2293
  });
2281
2294
  r.appendChild(
2282
2295
  E("ellipse", {
@@ -2300,7 +2313,7 @@ function yo(e, t) {
2300
2313
  ), e.appendChild(r);
2301
2314
  }
2302
2315
  }
2303
- function Gt(e, t, n) {
2316
+ function Vt(e, t, n) {
2304
2317
  const o = E("filter", {
2305
2318
  id: e,
2306
2319
  x: "-8%",
@@ -2343,8 +2356,8 @@ function Gt(e, t, n) {
2343
2356
  })
2344
2357
  ), o;
2345
2358
  }
2346
- function Da(e) {
2347
- const t = le(
2359
+ function Oa(e) {
2360
+ const t = pe(
2348
2361
  "0 0 24 24",
2349
2362
  e,
2350
2363
  e,
@@ -2354,8 +2367,8 @@ function Da(e) {
2354
2367
  );
2355
2368
  return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2356
2369
  }
2357
- function za() {
2358
- const e = le(
2370
+ function Ua() {
2371
+ const e = pe(
2359
2372
  "0 0 24 24",
2360
2373
  17,
2361
2374
  17,
@@ -2373,8 +2386,8 @@ function za() {
2373
2386
  })
2374
2387
  ), e;
2375
2388
  }
2376
- function Ma() {
2377
- const e = le(
2389
+ function Ba() {
2390
+ const e = pe(
2378
2391
  "0 0 24 24",
2379
2392
  17,
2380
2393
  17,
@@ -2384,8 +2397,8 @@ function Ma() {
2384
2397
  );
2385
2398
  return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
2386
2399
  }
2387
- function Oa() {
2388
- const e = le(
2400
+ function Fa() {
2401
+ const e = pe(
2389
2402
  "0 0 24 24",
2390
2403
  15,
2391
2404
  15,
@@ -2395,8 +2408,8 @@ function Oa() {
2395
2408
  );
2396
2409
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2397
2410
  }
2398
- function vo() {
2399
- const e = le(
2411
+ function Lo() {
2412
+ const e = pe(
2400
2413
  "0 0 24 24",
2401
2414
  14,
2402
2415
  14,
@@ -2408,8 +2421,8 @@ function vo() {
2408
2421
  E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2409
2422
  ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2410
2423
  }
2411
- function Ua() {
2412
- const e = le(
2424
+ function Ha() {
2425
+ const e = pe(
2413
2426
  "0 0 24 24",
2414
2427
  16,
2415
2428
  16,
@@ -2426,8 +2439,8 @@ function Ua() {
2426
2439
  })
2427
2440
  ), e;
2428
2441
  }
2429
- function Ba() {
2430
- const e = le("0 0 24 24", 19, 19, "none", "currentColor");
2442
+ function Wa() {
2443
+ const e = pe("0 0 24 24", 19, 19, "none", "currentColor");
2431
2444
  return e.setAttribute(
2432
2445
  "class",
2433
2446
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
@@ -2441,8 +2454,8 @@ function Ba() {
2441
2454
  })
2442
2455
  ), e;
2443
2456
  }
2444
- function Fa() {
2445
- const e = le("0 0 24 24", 18, 18, "currentColor");
2457
+ function Ga() {
2458
+ const e = pe("0 0 24 24", 18, 18, "currentColor");
2446
2459
  return e.appendChild(
2447
2460
  E("rect", {
2448
2461
  x: "6",
@@ -2453,8 +2466,8 @@ function Fa() {
2453
2466
  })
2454
2467
  ), e;
2455
2468
  }
2456
- function Ha() {
2457
- const e = le(
2469
+ function $a() {
2470
+ const e = pe(
2458
2471
  "0 0 24 24",
2459
2472
  12,
2460
2473
  12,
@@ -2464,8 +2477,8 @@ function Ha() {
2464
2477
  );
2465
2478
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2466
2479
  }
2467
- function Wa() {
2468
- const e = le(
2480
+ function qa() {
2481
+ const e = pe(
2469
2482
  "0 0 24 24",
2470
2483
  13,
2471
2484
  13,
@@ -2488,7 +2501,7 @@ function Wa() {
2488
2501
  })
2489
2502
  ), e;
2490
2503
  }
2491
- function le(e, t, n, o, i, r) {
2504
+ function pe(e, t, n, o, i, r) {
2492
2505
  const l = {
2493
2506
  viewBox: e,
2494
2507
  width: String(t),
@@ -2499,162 +2512,162 @@ function le(e, t, n, o, i, r) {
2499
2512
  return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2500
2513
  }
2501
2514
  function E(e, t = {}) {
2502
- const n = document.createElementNS(co, e);
2515
+ const n = document.createElementNS(fo, e);
2503
2516
  for (const [o, i] of Object.entries(t))
2504
2517
  n.setAttribute(o, i);
2505
2518
  return n;
2506
2519
  }
2507
- function $n(e) {
2520
+ function Yn(e) {
2508
2521
  for (const t of ["keydown", "keypress", "keyup"])
2509
2522
  e.addEventListener(t, (n) => {
2510
2523
  n.stopPropagation();
2511
2524
  });
2512
2525
  }
2513
- function Ga(e, t, n) {
2526
+ function ja(e, t, n) {
2514
2527
  e.replaceChildren(), e.hidden = t.length === 0;
2515
2528
  for (const [o, i] of t.entries()) {
2516
2529
  const r = document.createElement("div");
2517
- r.className = "pluno-pa-widget__attachment", r.appendChild($a(i));
2530
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Va(i));
2518
2531
  const l = document.createElement("span");
2519
2532
  l.textContent = i.name, r.appendChild(l);
2520
2533
  const p = document.createElement("button");
2521
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ha()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2534
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild($a()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2522
2535
  }
2523
2536
  }
2524
- function $a(e) {
2525
- const t = ln(e), n = Co(e);
2537
+ function Va(e) {
2538
+ const t = cn(e), n = Po(e);
2526
2539
  if (t === "image" && n) {
2527
2540
  const o = document.createElement("img");
2528
- return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ae(e))), o;
2541
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(re(e))), o;
2529
2542
  }
2530
2543
  if (t === "video" && n) {
2531
2544
  const o = document.createElement("video");
2532
- return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ae(e))), o.addEventListener("stalled", () => o.replaceWith(ae(e))), o;
2545
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(re(e))), o.addEventListener("stalled", () => o.replaceWith(re(e))), o;
2533
2546
  }
2534
- return ae(e);
2547
+ return re(e);
2535
2548
  }
2536
- function qa(e) {
2537
- const t = ln(e), n = Co(e);
2549
+ function Ka(e) {
2550
+ const t = cn(e), n = Po(e);
2538
2551
  if (t === "image" && n) {
2539
2552
  const o = document.createElement("img");
2540
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(ae(e, "message"))), o;
2553
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(re(e, "message"))), o;
2541
2554
  }
2542
2555
  if (t === "pdf" && n) {
2543
2556
  const o = document.createElement("object");
2544
- return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ae(e, "message"))), o.appendChild(ae(e, "message")), o;
2557
+ return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(re(e, "message"))), o.appendChild(re(e, "message")), o;
2545
2558
  }
2546
2559
  if (t === "video" && n) {
2547
2560
  const o = document.createElement("video");
2548
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ae(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ae(e, "message"))), o;
2561
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(re(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(re(e, "message"))), o;
2549
2562
  }
2550
- return ae(e, "message");
2563
+ return re(e, "message");
2551
2564
  }
2552
- function ae(e, t = "composer") {
2565
+ function re(e, t = "composer") {
2553
2566
  if (t === "composer") {
2554
2567
  const r = document.createElement("span");
2555
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = qn(e), r;
2568
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = Xn(e), r;
2556
2569
  }
2557
2570
  const n = document.createElement("div");
2558
2571
  n.className = "pluno-pa-widget__message-attachment-file";
2559
2572
  const o = document.createElement("span");
2560
- o.textContent = qn(e);
2573
+ o.textContent = Xn(e);
2561
2574
  const i = document.createElement("strong");
2562
2575
  return i.textContent = e.name, n.append(o, i), n;
2563
2576
  }
2564
- function ln(e) {
2577
+ function cn(e) {
2565
2578
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2566
2579
  }
2567
- function Co(e) {
2580
+ function Po(e) {
2568
2581
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2569
2582
  }
2570
- function qn(e) {
2571
- const t = ln(e);
2583
+ function Xn(e) {
2584
+ const t = cn(e);
2572
2585
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2573
2586
  }
2574
- function ja(e, t) {
2587
+ function Ya(e, t) {
2575
2588
  return t ? Array.from(t).map((o) => ({
2576
2589
  ...e.createLocalAttachment(o),
2577
- previewUrl: Va(o)
2590
+ previewUrl: Xa(o)
2578
2591
  })) : [];
2579
2592
  }
2580
- function Va(e) {
2593
+ function Xa(e) {
2581
2594
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2582
2595
  }
2583
- function pt(e) {
2596
+ function ct(e) {
2584
2597
  return !!(e && Array.from(e.types).includes("Files"));
2585
2598
  }
2586
- function $t(e, t, n = null) {
2587
- if (!e || !tn(t, n)) {
2599
+ function Kt(e, t, n = null) {
2600
+ if (!e || !rn(t, n)) {
2588
2601
  e && (e.hidden = !0, e.replaceChildren());
2589
2602
  return;
2590
2603
  }
2591
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", re(t) || pn(n) ? e.appendChild(
2592
- Ka(t, n)
2593
- ) : So(t) && e.appendChild(Ya(t));
2604
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", le(t) || un(n) ? e.appendChild(
2605
+ Za(t, n)
2606
+ ) : To(t) && e.appendChild(Ja(t));
2594
2607
  }
2595
- function Ka(e, t) {
2608
+ function Za(e, t) {
2596
2609
  const n = document.createElement("div");
2597
2610
  n.className = "pluno-pa-widget__billing-action-card";
2598
2611
  const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2599
2612
  i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2600
2613
  const r = document.createElement("span");
2601
2614
  return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
2602
- Eo(
2615
+ Io(
2603
2616
  e,
2604
2617
  "Upgrade plan",
2605
2618
  "pluno-pa-widget__billing-action-card-actions"
2606
2619
  )
2607
2620
  ), n;
2608
2621
  }
2609
- function Ya(e) {
2622
+ function Ja(e) {
2610
2623
  const t = document.createElement("div");
2611
2624
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2612
2625
  const n = document.createElement("strong");
2613
2626
  n.textContent = "Credits running low", t.appendChild(n);
2614
2627
  const o = document.createElement("span");
2615
- return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2616
- Eo(
2628
+ return o.textContent = er(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2629
+ Io(
2617
2630
  e,
2618
2631
  "Upgrade",
2619
2632
  "pluno-pa-widget__billing-action-card-actions"
2620
2633
  )
2621
2634
  ), t;
2622
2635
  }
2623
- function tn(e, t) {
2624
- return e !== null && (re(e) || So(e) || pn(t));
2636
+ function rn(e, t) {
2637
+ return e !== null && (le(e) || To(e) || un(t));
2625
2638
  }
2626
- function jn(e, t, n) {
2627
- return tn(t, n) || Xa(t) ? !0 : !tn(e, n);
2639
+ function Zn(e, t, n) {
2640
+ return rn(t, n) || Qa(t) ? !0 : !rn(e, n);
2628
2641
  }
2629
- function Xa(e) {
2630
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || re(e));
2642
+ function Qa(e) {
2643
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || le(e));
2631
2644
  }
2632
- function re(e) {
2645
+ function le(e) {
2633
2646
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2634
2647
  }
2635
- function pn(e) {
2648
+ function un(e) {
2636
2649
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2637
2650
  }
2638
- function So(e) {
2639
- return !re(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2651
+ function To(e) {
2652
+ return !le(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2640
2653
  }
2641
- function Za(e) {
2642
- return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
2654
+ function er(e) {
2655
+ return e.creditsRemaining === null ? null : `${tr(e.creditsRemaining)} credits left`;
2643
2656
  }
2644
- function Ja(e) {
2657
+ function tr(e) {
2645
2658
  return new Intl.NumberFormat("en-US", {
2646
2659
  maximumFractionDigits: 0
2647
2660
  }).format(Math.ceil(e));
2648
2661
  }
2649
- function Eo(e, t, n) {
2662
+ function Io(e, t, n) {
2650
2663
  const o = document.createElement("div");
2651
2664
  return o.className = n, o.appendChild(
2652
- Vn(t, e.pricingUrl)
2665
+ Jn(t, e.pricingUrl)
2653
2666
  ), o.appendChild(
2654
- Vn("Earn credits", e.earnCreditsUrl)
2667
+ Jn("Earn credits", e.earnCreditsUrl)
2655
2668
  ), o;
2656
2669
  }
2657
- function Vn(e, t) {
2670
+ function Jn(e, t) {
2658
2671
  const n = document.createElement("button");
2659
2672
  if (n.type = "button", e === "Earn credits") {
2660
2673
  const o = document.createElement("span");
@@ -2665,137 +2678,140 @@ function Vn(e, t) {
2665
2678
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2666
2679
  }), n;
2667
2680
  }
2668
- function qt(e, t) {
2681
+ function Yt(e, t) {
2669
2682
  return e.messages.filter(
2670
- (o) => !ko(o)
2683
+ (o) => !Ao(o)
2671
2684
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2672
2685
  }
2673
- function Qa(e, t, n, o, i, r, l, p, d, c, u, m, k, v, R, C, g, y, h) {
2674
- const A = or(r), L = A.filter(
2675
- (x) => !ko(x)
2676
- ), M = e.scrollTop, U = [], Ie = /* @__PURE__ */ new Set(), H = (x) => {
2677
- U.push(x);
2686
+ function nr(e, t, n, o, i, r, l, p, s, c, u, m, k, v, D, C, g, y, h, S) {
2687
+ const A = rr(r), N = A.filter(
2688
+ (x) => !Ao(x)
2689
+ ), q = e.scrollTop, xe = [], He = /* @__PURE__ */ new Set(), z = (x) => {
2690
+ xe.push(x);
2678
2691
  };
2679
- Io(n, r.isThinking), i.hidden = !p, p && l !== null && bo(i, l);
2680
- const xe = L.length > 0 || !!r.assistantDraft || r.isThinking;
2681
- if (o(xe), g || L.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2692
+ Ro(n, r.isThinking), i.hidden = !p, p && l !== null && Co(i, l);
2693
+ const We = N.length > 0 || !!r.assistantDraft || r.isThinking;
2694
+ if (o(We), g || N.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2682
2695
  const x = document.createElement("div");
2683
2696
  x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (g ? " pluno-pa-widget__empty-state--morning-report" : "");
2684
- const D = document.createElement("div");
2685
- D.className = "pluno-pa-widget__empty-hero";
2686
- const $ = _e(
2697
+ const M = document.createElement("div");
2698
+ M.className = "pluno-pa-widget__empty-hero";
2699
+ const T = _e(
2687
2700
  "pluno-pa-widget__character--empty",
2688
2701
  v()
2689
2702
  );
2690
- if (D.appendChild($), x.appendChild(D), g) {
2691
- const S = document.createElement("h2");
2692
- S.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", S.textContent = g.opening, x.appendChild(S);
2703
+ if (M.appendChild(T), x.appendChild(M), g) {
2704
+ const L = document.createElement("h2");
2705
+ L.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", L.textContent = g.opening, x.appendChild(L);
2693
2706
  } else
2694
- x.appendChild(wo());
2695
- const P = g?.prompts ?? r.starterPrompts, j = document.createElement("div");
2696
- if (j.className = P.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", P.length === 0 && !r.starterPromptsLoading && j.setAttribute("aria-hidden", "true"), P.length > 0)
2697
- for (const S of P) {
2698
- const N = document.createElement("button");
2699
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt", N.textContent = `"${S}"`, N.addEventListener("click", () => {
2700
- R(S);
2701
- }), j.appendChild(N);
2707
+ x.appendChild(vo());
2708
+ const oe = g?.prompts ?? r.starterPrompts, W = document.createElement("div");
2709
+ if (W.className = oe.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", oe.length === 0 && !r.starterPromptsLoading && W.setAttribute("aria-hidden", "true"), oe.length > 0)
2710
+ for (const L of oe) {
2711
+ const R = document.createElement("button");
2712
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt", R.textContent = `"${L}"`, R.addEventListener("click", () => {
2713
+ D(L);
2714
+ }), W.appendChild(R);
2702
2715
  }
2703
2716
  else if (r.starterPromptsLoading) {
2704
- const S = document.createElement("button");
2705
- S.type = "button", S.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", S.disabled = !0, S.tabIndex = -1, S.textContent = "Generating example tasks...", j.appendChild(S);
2717
+ const L = document.createElement("button");
2718
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", L.disabled = !0, L.tabIndex = -1, L.textContent = "Generating example tasks...", W.appendChild(L);
2706
2719
  } else
2707
- for (let S = 0; S < zi; S += 1) {
2708
- const N = document.createElement("button");
2709
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", N.disabled = !0, N.tabIndex = -1, N.textContent = "", j.appendChild(N);
2720
+ for (let L = 0; L < Ui; L += 1) {
2721
+ const R = document.createElement("button");
2722
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", R.disabled = !0, R.tabIndex = -1, R.textContent = "", W.appendChild(R);
2710
2723
  }
2711
- if (x.appendChild(j), g) {
2712
- const S = document.createElement("button");
2713
- S.type = "button", S.className = "pluno-pa-widget__morning-report-snooze", S.textContent = "Snooze morning report", S.addEventListener("click", y), x.appendChild(S);
2724
+ if (x.appendChild(W), g) {
2725
+ const L = document.createElement("button");
2726
+ L.type = "button", L.className = "pluno-pa-widget__morning-report-snooze", L.textContent = "Snooze morning report", L.addEventListener("click", y), x.appendChild(L);
2714
2727
  }
2715
- m.clear(), H(x), H(t), Kn(e, U);
2728
+ m.clear(), z(x), z(t), Qn(e, xe);
2716
2729
  return;
2717
2730
  }
2718
- let G = null, w = null, J = [];
2719
- const Je = L.some(nn), pe = () => {
2720
- if (J.length === 0)
2731
+ let w = null, U = null, ye = [];
2732
+ const ve = N.some(ln), Ae = () => {
2733
+ if (ye.length === 0)
2721
2734
  return !1;
2722
- const x = gr(
2723
- J,
2735
+ const x = fr(
2736
+ ye,
2724
2737
  u,
2725
2738
  k,
2726
2739
  v()
2727
2740
  );
2728
- return H(x), G = null, w = x, J = [], !0;
2741
+ return z(x), w = null, U = x, ye = [], !0;
2729
2742
  };
2730
- for (let x = 0; x < L.length; x += 1) {
2731
- const D = L[x];
2732
- if (D.role === "tool") {
2733
- J.push(D);
2743
+ for (let x = 0; x < N.length; x += 1) {
2744
+ const M = N[x];
2745
+ if (M.role === "tool") {
2746
+ ye.push(M);
2734
2747
  continue;
2735
2748
  }
2736
- if (nn(D)) {
2737
- if (pe()) {
2738
- const N = mt();
2739
- H(N), G = null, w = N;
2749
+ if (ln(M)) {
2750
+ if (Ae()) {
2751
+ const R = bt();
2752
+ z(R), w = null, U = R;
2740
2753
  } else {
2741
- const N = Zn(v());
2742
- H(N), G = null, w = N;
2754
+ const R = no(v());
2755
+ z(R), w = null, U = R;
2743
2756
  }
2744
2757
  continue;
2745
2758
  }
2746
- if (D.role === "system")
2759
+ if (M.role === "system")
2747
2760
  continue;
2748
- const $ = pe(), P = ur(D.content);
2749
- if (D.role === "assistant" && !$) {
2750
- const S = Lo(v());
2751
- H(S), G = null, w = S;
2761
+ const T = Ae(), oe = mr(M.content);
2762
+ if (M.role === "assistant" && !T) {
2763
+ const L = No(v());
2764
+ z(L), w = null, U = L;
2752
2765
  }
2753
- const j = er(D, P, m, Ie);
2754
- H(j), G = j, w = null;
2766
+ const W = or(M, oe, m, He);
2767
+ z(W), w = W, U = null;
2755
2768
  }
2756
- const Qe = pe(), V = L[L.length - 1]?.id === "assistant-draft";
2757
- if (r.isThinking && !V && !Je)
2758
- if (Qe) {
2759
- const x = mt();
2760
- H(x), G = null, w = x;
2769
+ const V = Ae(), ot = N[N.length - 1]?.id === "assistant-draft";
2770
+ if (r.isThinking && !ot && !ve)
2771
+ if (V) {
2772
+ const x = bt();
2773
+ z(x), w = null, U = x;
2761
2774
  } else {
2762
- const x = Zn(v());
2763
- H(x), G = null, w = x;
2775
+ const x = no(v());
2776
+ z(x), w = null, U = x;
2764
2777
  }
2765
2778
  if (r.lastError) {
2766
2779
  const x = document.createElement("div");
2767
2780
  x.className = "pluno-pa-widget__error";
2768
- const D = document.createElement("span");
2769
- if (D.textContent = r.lastError, x.appendChild(D), r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active") {
2770
- const $ = document.createElement("button");
2771
- $.type = "button", $.className = "pluno-pa-widget__error-retry", $.textContent = "Try again", $.addEventListener("click", C), x.appendChild($);
2772
- }
2773
- H(x), G = x, w = null;
2781
+ const M = document.createElement("span");
2782
+ if (M.textContent = r.lastError, x.appendChild(M), r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
2783
+ const T = document.createElement("button");
2784
+ T.type = "button", T.className = "pluno-pa-widget__error-retry", T.textContent = "Try again", T.addEventListener(
2785
+ "click",
2786
+ r.lastErrorCode === "connection_failed" ? h : C
2787
+ ), x.appendChild(T);
2788
+ }
2789
+ z(x), w = x, U = null;
2774
2790
  }
2775
- const ge = h && !r.isThinking ? ri(A) : null;
2776
- if (h && ge && !h.dismissedCandidateIds.has(ge.id)) {
2777
- const x = rr(ge, {
2778
- isDrafting: h.draftingCandidateId === ge.id,
2779
- error: h.error,
2780
- characterIconOptions: h.characterIconOptions,
2781
- onDraft: h.onDraft,
2782
- onDismiss: h.onDismiss,
2783
- onDisable: h.onDisable
2791
+ const ne = S && !r.isThinking ? si(A) : null;
2792
+ if (S && ne && !S.dismissedCandidateIds.has(ne.id)) {
2793
+ const x = sr(ne, {
2794
+ isDrafting: S.draftingCandidateId === ne.id,
2795
+ error: S.error,
2796
+ characterIconOptions: S.characterIconOptions,
2797
+ onDraft: S.onDraft,
2798
+ onDismiss: S.onDismiss,
2799
+ onDisable: S.onDisable
2784
2800
  });
2785
- H(x), h.onSeen(ge), G = null, w = x;
2801
+ z(x), S.onSeen(ne), w = null, U = x;
2786
2802
  }
2787
- G?.classList.add("pluno-pa-widget__message--bottom-reserve"), w?.classList.add("pluno-pa-widget__bottom-reserve-compact"), H(t), nr(m, Ie), Kn(e, U), d ? Xe(e, c) : e.scrollTop = M;
2803
+ w?.classList.add("pluno-pa-widget__message--bottom-reserve"), U?.classList.add("pluno-pa-widget__bottom-reserve-compact"), z(t), ar(m, He), Qn(e, xe), s ? tt(e, c) : e.scrollTop = q;
2788
2804
  }
2789
- function er(e, t, n, o) {
2790
- const i = tr(e, t), r = i ? n.get(i) : void 0;
2805
+ function or(e, t, n, o) {
2806
+ const i = ir(e, t), r = i ? n.get(i) : void 0;
2791
2807
  if (i && r)
2792
2808
  return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
2793
2809
  const l = document.createElement("div");
2794
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? mr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ir(e.attachments));
2810
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? br(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(lr(e.attachments));
2795
2811
  const p = document.createElement("div");
2796
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(ar(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2812
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(pr(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2797
2813
  }
2798
- function tr(e, t) {
2814
+ function ir(e, t) {
2799
2815
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2800
2816
  id: e.id,
2801
2817
  content: t,
@@ -2813,11 +2829,11 @@ function tr(e, t) {
2813
2829
  })
2814
2830
  });
2815
2831
  }
2816
- function nr(e, t) {
2832
+ function ar(e, t) {
2817
2833
  for (const n of e.keys())
2818
2834
  t.has(n) || e.delete(n);
2819
2835
  }
2820
- function Kn(e, t) {
2836
+ function Qn(e, t) {
2821
2837
  let n = e.firstChild;
2822
2838
  for (const o of t) {
2823
2839
  if (o === n) {
@@ -2831,7 +2847,7 @@ function Kn(e, t) {
2831
2847
  n = n.nextSibling, e.removeChild(o);
2832
2848
  }
2833
2849
  }
2834
- function or(e) {
2850
+ function rr(e) {
2835
2851
  if (!e.assistantDraft)
2836
2852
  return [...e.messages];
2837
2853
  const t = {
@@ -2851,7 +2867,7 @@ function or(e) {
2851
2867
  if (n === -1)
2852
2868
  return [...e.messages, t];
2853
2869
  const o = e.messages.findIndex(
2854
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Yn(r, t) && nn(r)
2870
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && eo(r, t) && ln(r)
2855
2871
  );
2856
2872
  if (o !== -1)
2857
2873
  return [
@@ -2860,7 +2876,7 @@ function or(e) {
2860
2876
  ...e.messages.slice(o + 1)
2861
2877
  ];
2862
2878
  let i = n + 1;
2863
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Yn(e.messages[i], t); )
2879
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && eo(e.messages[i], t); )
2864
2880
  i += 1;
2865
2881
  return [
2866
2882
  ...e.messages.slice(0, i),
@@ -2868,45 +2884,45 @@ function or(e) {
2868
2884
  ...e.messages.slice(i)
2869
2885
  ];
2870
2886
  }
2871
- function nn(e) {
2887
+ function ln(e) {
2872
2888
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2873
2889
  }
2874
- function Yn(e, t) {
2890
+ function eo(e, t) {
2875
2891
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2876
2892
  }
2877
- function Xn(e, t, n, o, i, r, l, p) {
2878
- e.replaceChildren(), Io(t, !1), t.disabled = !0, n(!1);
2879
- const d = document.createElement("div");
2880
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2893
+ function to(e, t, n, o, i, r, l, p) {
2894
+ e.replaceChildren(), Ro(t, !1), t.disabled = !0, n(!1);
2895
+ const s = document.createElement("div");
2896
+ s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2881
2897
  const c = _e(
2882
2898
  "pluno-pa-widget__character--empty",
2883
2899
  o()
2884
2900
  );
2885
- d.appendChild(c);
2901
+ s.appendChild(c);
2886
2902
  const u = document.createElement("div");
2887
- if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2903
+ if (u.className = "pluno-pa-widget__empty", u.textContent = i, s.appendChild(u), l) {
2888
2904
  const m = document.createElement("a");
2889
- m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, d.appendChild(m);
2905
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, s.appendChild(m);
2890
2906
  } else {
2891
2907
  const m = document.createElement("button");
2892
- m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), d.appendChild(m);
2908
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), s.appendChild(m);
2893
2909
  }
2894
- e.appendChild(d);
2910
+ e.appendChild(s);
2895
2911
  }
2896
- function ir(e) {
2912
+ function lr(e) {
2897
2913
  const t = document.createElement("div");
2898
2914
  t.className = "pluno-pa-widget__message-attachments";
2899
2915
  for (const n of e)
2900
- t.appendChild(qa(n));
2916
+ t.appendChild(Ka(n));
2901
2917
  return t;
2902
2918
  }
2903
- function ar(e) {
2919
+ function pr(e) {
2904
2920
  const t = document.createElement("button");
2905
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Wa()), t.addEventListener("click", (n) => {
2921
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(qa()), t.addEventListener("click", (n) => {
2906
2922
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2907
2923
  }), t;
2908
2924
  }
2909
- function rr(e, t) {
2925
+ function sr(e, t) {
2910
2926
  const n = document.createElement("article");
2911
2927
  n.className = "pluno-pa-widget__share-prompt";
2912
2928
  const o = document.createElement("div");
@@ -2928,18 +2944,18 @@ function rr(e, t) {
2928
2944
  o.appendChild(i);
2929
2945
  const p = document.createElement("div");
2930
2946
  p.className = "pluno-pa-widget__share-prompt-actions";
2931
- const d = document.createElement("div");
2932
- d.className = "pluno-pa-widget__share-prompt-primary-actions";
2947
+ const s = document.createElement("div");
2948
+ s.className = "pluno-pa-widget__share-prompt-primary-actions";
2933
2949
  const c = document.createElement("button");
2934
2950
  if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2935
2951
  t.onDraft(e);
2936
- }), t.isDrafting ? (c.appendChild(on()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2937
- p.appendChild(d);
2952
+ }), t.isDrafting ? (c.appendChild(pn()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", s.appendChild(c), t.isDrafting)
2953
+ p.appendChild(s);
2938
2954
  else {
2939
2955
  const u = document.createElement("button");
2940
2956
  u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
2941
2957
  t.onDismiss(e);
2942
- }), d.appendChild(u), p.appendChild(d);
2958
+ }), s.appendChild(u), p.appendChild(s);
2943
2959
  const m = document.createElement("button");
2944
2960
  m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
2945
2961
  t.onDisable(e);
@@ -2947,7 +2963,7 @@ function rr(e, t) {
2947
2963
  }
2948
2964
  return o.appendChild(p), n.appendChild(o), n;
2949
2965
  }
2950
- function lr(e, t) {
2966
+ function dr(e, t) {
2951
2967
  const n = document.createElement("div");
2952
2968
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2953
2969
  g.target === n && t.onClose();
@@ -2960,40 +2976,40 @@ function lr(e, t) {
2960
2976
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2961
2977
  const p = document.createElement("p");
2962
2978
  p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
2963
- const d = document.createElement("div");
2964
- d.className = "pluno-pa-widget__share-dialog-step";
2979
+ const s = document.createElement("div");
2980
+ s.className = "pluno-pa-widget__share-dialog-step";
2965
2981
  const c = document.createElement("div");
2966
2982
  c.className = "pluno-pa-widget__share-dialog-step-header";
2967
2983
  const u = document.createElement("strong");
2968
2984
  u.textContent = "1) Copy Screenshot", c.appendChild(u);
2969
- const m = pr(
2985
+ const m = cr(
2970
2986
  "Copy Screenshot",
2971
2987
  async () => {
2972
2988
  try {
2973
- return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2989
+ return await di(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2974
2990
  } catch {
2975
2991
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2976
2992
  }
2977
2993
  }
2978
2994
  );
2979
- if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
2995
+ if (c.appendChild(m), s.appendChild(c), e.screenshotDataUrl) {
2980
2996
  const g = document.createElement("div");
2981
2997
  g.className = "pluno-pa-widget__share-dialog-screenshot";
2982
2998
  const y = document.createElement("img");
2983
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", g.appendChild(y), d.appendChild(g);
2999
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", g.appendChild(y), s.appendChild(g);
2984
3000
  }
2985
- o.appendChild(d), o.appendChild(p);
3001
+ o.appendChild(s), o.appendChild(p);
2986
3002
  const k = document.createElement("div");
2987
3003
  k.className = "pluno-pa-widget__share-dialog-step";
2988
3004
  const v = document.createElement("strong");
2989
3005
  v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", k.appendChild(v);
2990
- const R = document.createElement("p");
2991
- R.className = "pluno-pa-widget__share-dialog-hint", R.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(R);
3006
+ const D = document.createElement("p");
3007
+ D.className = "pluno-pa-widget__share-dialog-hint", D.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(D);
2992
3008
  const C = document.createElement("footer");
2993
3009
  C.className = "pluno-pa-widget__share-dialog-platforms";
2994
- for (const g of sr(e)) {
3010
+ for (const g of ur(e)) {
2995
3011
  const y = document.createElement("a");
2996
- y.href = g.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = g.label, y.setAttribute("aria-label", `Open ${g.label}`), y.appendChild(dr(g.id)), C.appendChild(y);
3012
+ y.href = g.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = g.label, y.setAttribute("aria-label", `Open ${g.label}`), y.appendChild(gr(g.id)), C.appendChild(y);
2997
3013
  }
2998
3014
  if (k.appendChild(C), o.appendChild(k), t.socialPostRewardsUrl) {
2999
3015
  const g = document.createElement("div");
@@ -3001,17 +3017,17 @@ function lr(e, t) {
3001
3017
  const y = document.createElement("strong");
3002
3018
  y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(y);
3003
3019
  const h = document.createElement("a");
3004
- h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(cr()), g.appendChild(h), o.appendChild(g);
3020
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(hr()), g.appendChild(h), o.appendChild(g);
3005
3021
  }
3006
3022
  return n.appendChild(o), n;
3007
3023
  }
3008
- function pr(e, t) {
3024
+ function cr(e, t) {
3009
3025
  const n = document.createElement("button");
3010
3026
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
3011
3027
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
3012
3028
  }), n;
3013
3029
  }
3014
- function sr(e) {
3030
+ function ur(e) {
3015
3031
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
3016
3032
  return [
3017
3033
  {
@@ -3031,47 +3047,47 @@ function sr(e) {
3031
3047
  }
3032
3048
  ];
3033
3049
  }
3034
- function dr(e) {
3050
+ function gr(e) {
3035
3051
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3036
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (W(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), W(
3052
+ return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? ($(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), $(
3037
3053
  t,
3038
3054
  "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"
3039
- ), W(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), W(
3055
+ ), $(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), $(
3040
3056
  t,
3041
3057
  "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"
3042
- ), W(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (W(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), W(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), W(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (W(
3058
+ ), $(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? ($(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), $(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), $(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : ($(
3043
3059
  t,
3044
3060
  "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"
3045
- ), W(
3061
+ ), $(
3046
3062
  t,
3047
3063
  "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1",
3048
3064
  "0.48"
3049
- ), W(
3065
+ ), $(
3050
3066
  t,
3051
3067
  "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"
3052
- ), W(
3068
+ ), $(
3053
3069
  t,
3054
3070
  "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"
3055
3071
  ), t);
3056
3072
  }
3057
- function W(e, t, n) {
3073
+ function $(e, t, n) {
3058
3074
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3059
3075
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
3060
3076
  }
3061
- function cr() {
3077
+ function hr() {
3062
3078
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3063
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), W(e, "M14 5h5v5"), W(e, "M19 5l-8 8"), W(
3079
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), $(e, "M14 5h5v5"), $(e, "M19 5l-8 8"), $(
3064
3080
  e,
3065
3081
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3066
3082
  ), e;
3067
3083
  }
3068
- function ko(e) {
3069
- return e.role === "tool" && e.toolName === io;
3084
+ function Ao(e) {
3085
+ return e.role === "tool" && e.toolName === so;
3070
3086
  }
3071
- function ur(e) {
3087
+ function mr(e) {
3072
3088
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3073
3089
  }
3074
- function gr(e, t, n, o) {
3090
+ function fr(e, t, n, o) {
3075
3091
  const i = document.createElement("article");
3076
3092
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
3077
3093
  e[e.length - 1].createdAt
@@ -3081,19 +3097,19 @@ function gr(e, t, n, o) {
3081
3097
  o
3082
3098
  )
3083
3099
  );
3084
- const r = document.createElement("details"), l = hr(e);
3100
+ const r = document.createElement("details"), l = wr(e);
3085
3101
  r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3086
3102
  i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
3087
3103
  });
3088
3104
  const p = document.createElement("summary");
3089
- p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(on());
3105
+ p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(pn());
3090
3106
  const c = document.createElement("span");
3091
3107
  if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), r.appendChild(p), e.length > 0) {
3092
3108
  const u = document.createElement("div");
3093
3109
  u.className = "pluno-pa-widget__tool-lines";
3094
3110
  for (const m of e) {
3095
3111
  const k = document.createElement("div");
3096
- k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(on());
3112
+ k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(pn());
3097
3113
  const v = document.createElement("span");
3098
3114
  v.textContent = m.content || "Run tool", k.appendChild(v), u.appendChild(k);
3099
3115
  }
@@ -3101,7 +3117,7 @@ function gr(e, t, n, o) {
3101
3117
  }
3102
3118
  return i.appendChild(r), i;
3103
3119
  }
3104
- function Lo(e) {
3120
+ function No(e) {
3105
3121
  const t = document.createElement("article");
3106
3122
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3107
3123
  _e(
@@ -3110,11 +3126,11 @@ function Lo(e) {
3110
3126
  )
3111
3127
  ), t;
3112
3128
  }
3113
- function Zn(e) {
3114
- const t = Lo(e);
3115
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(mt()), t;
3129
+ function no(e) {
3130
+ const t = No(e);
3131
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(bt()), t;
3116
3132
  }
3117
- function mt(e = "Thinking...") {
3133
+ function bt(e = "Thinking...") {
3118
3134
  const t = document.createElement("div");
3119
3135
  t.className = "pluno-pa-widget__status";
3120
3136
  const n = document.createElement("span");
@@ -3122,17 +3138,17 @@ function mt(e = "Thinking...") {
3122
3138
  const o = document.createElement("span");
3123
3139
  return o.textContent = e, t.appendChild(o), t;
3124
3140
  }
3125
- function hr(e) {
3141
+ function wr(e) {
3126
3142
  return `tools:${e[0]?.id ?? ""}`;
3127
3143
  }
3128
- function on() {
3144
+ function pn() {
3129
3145
  const e = document.createElement("span");
3130
3146
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3131
3147
  }
3132
- function Io(e, t) {
3133
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Fa() : vo());
3148
+ function Ro(e, t) {
3149
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ga() : Lo());
3134
3150
  }
3135
- function mr(e, t) {
3151
+ function br(e, t) {
3136
3152
  const n = t.replace(/\r\n/g, `
3137
3153
  `).split(`
3138
3154
  `);
@@ -3156,14 +3172,14 @@ function mr(e, t) {
3156
3172
  const l = i.match(/^(#{1,3})\s+(.+)$/);
3157
3173
  if (l) {
3158
3174
  const c = document.createElement(`h${l[1].length + 2}`);
3159
- st(c, l[2]), e.appendChild(c), o += 1;
3175
+ ut(c, l[2]), e.appendChild(c), o += 1;
3160
3176
  continue;
3161
3177
  }
3162
3178
  if (/^\s*[-*+]\s+/.test(i)) {
3163
3179
  const c = document.createElement("ul");
3164
3180
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3165
3181
  const u = document.createElement("li");
3166
- st(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3182
+ ut(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3167
3183
  }
3168
3184
  e.appendChild(c);
3169
3185
  continue;
@@ -3172,7 +3188,7 @@ function mr(e, t) {
3172
3188
  const c = document.createElement("ol");
3173
3189
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3174
3190
  const u = document.createElement("li");
3175
- st(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3191
+ ut(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3176
3192
  }
3177
3193
  e.appendChild(c);
3178
3194
  continue;
@@ -3180,13 +3196,13 @@ function mr(e, t) {
3180
3196
  const p = [i];
3181
3197
  for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
3182
3198
  p.push(n[o]), o += 1;
3183
- const d = document.createElement("p");
3199
+ const s = document.createElement("p");
3184
3200
  p.forEach((c, u) => {
3185
- u > 0 && d.appendChild(document.createElement("br")), st(d, c);
3186
- }), e.appendChild(d);
3201
+ u > 0 && s.appendChild(document.createElement("br")), ut(s, c);
3202
+ }), e.appendChild(s);
3187
3203
  }
3188
3204
  }
3189
- function st(e, t) {
3205
+ function ut(e, t) {
3190
3206
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3191
3207
  let o = 0;
3192
3208
  for (const i of t.matchAll(n)) {
@@ -3206,9 +3222,9 @@ function st(e, t) {
3206
3222
  p.textContent = l.slice(1, -1), e.appendChild(p);
3207
3223
  } else {
3208
3224
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3209
- if (p && fr(p[2])) {
3210
- const d = document.createElement("a");
3211
- d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3225
+ if (p && _r(p[2])) {
3226
+ const s = document.createElement("a");
3227
+ s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
3212
3228
  } else
3213
3229
  e.appendChild(document.createTextNode(l));
3214
3230
  }
@@ -3216,7 +3232,7 @@ function st(e, t) {
3216
3232
  }
3217
3233
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
3218
3234
  }
3219
- function fr(e) {
3235
+ function _r(e) {
3220
3236
  if (e.startsWith("/") || e.startsWith("#"))
3221
3237
  return !0;
3222
3238
  try {
@@ -3226,8 +3242,8 @@ function fr(e) {
3226
3242
  return !1;
3227
3243
  }
3228
3244
  }
3229
- function Jn(e, t) {
3230
- if (wr(e))
3245
+ function oo(e, t) {
3246
+ if (xr(e))
3231
3247
  return;
3232
3248
  const n = `
3233
3249
  :host {
@@ -3280,7 +3296,7 @@ function Jn(e, t) {
3280
3296
  --pluno-pa-accent-contrast: #fafafa;
3281
3297
  position: fixed;
3282
3298
  z-index: 2147483645;
3283
- font-family: ${ie.fontFamily};
3299
+ font-family: ${ae.fontFamily};
3284
3300
  font-size: 14px;
3285
3301
  color: var(--pluno-pa-text);
3286
3302
  width: var(--pluno-pa-launcher-width);
@@ -4359,7 +4375,7 @@ function Jn(e, t) {
4359
4375
  place-items: center;
4360
4376
  padding: 18px;
4361
4377
  background: rgba(24, 24, 27, 0.28);
4362
- font-family: var(--pluno-pa-font, ${ie.fontFamily});
4378
+ font-family: var(--pluno-pa-font, ${ae.fontFamily});
4363
4379
  color: var(--pluno-pa-text);
4364
4380
  }
4365
4381
  .pluno-pa-widget__share-dialog {
@@ -5182,8 +5198,8 @@ function Jn(e, t) {
5182
5198
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5183
5199
  position: absolute;
5184
5200
  top: -16px;
5185
- left: ${Zt}px;
5186
- width: calc(100% - ${Zt * 2}px);
5201
+ left: ${tn}px;
5202
+ width: calc(100% - ${tn * 2}px);
5187
5203
  height: 36px;
5188
5204
  z-index: 3;
5189
5205
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5535,28 +5551,28 @@ function Jn(e, t) {
5535
5551
  filter: url(#pluno-pa-scribble-wobble-2);
5536
5552
  }
5537
5553
  `;
5538
- if (br(e, n))
5554
+ if (yr(e, n))
5539
5555
  return;
5540
5556
  const o = e.ownerDocument.createElement("style");
5541
- o.id = ho, o.textContent = n, e.appendChild(o), Po(e);
5557
+ o.id = _o, o.textContent = n, e.appendChild(o), Do(e);
5542
5558
  }
5543
- function wr(e) {
5544
- return e.getElementById(ho) !== null || e.host instanceof HTMLElement && e.host.getAttribute(mo) === "true";
5559
+ function xr(e) {
5560
+ return e.getElementById(_o) !== null || e.host instanceof HTMLElement && e.host.getAttribute(xo) === "true";
5545
5561
  }
5546
- function Po(e) {
5547
- e.host instanceof HTMLElement && e.host.setAttribute(mo, "true");
5562
+ function Do(e) {
5563
+ e.host instanceof HTMLElement && e.host.setAttribute(xo, "true");
5548
5564
  }
5549
- function br(e, t) {
5565
+ function yr(e, t) {
5550
5566
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5551
5567
  return !1;
5552
5568
  try {
5553
5569
  const n = new CSSStyleSheet();
5554
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Po(e), !0;
5570
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Do(e), !0;
5555
5571
  } catch {
5556
5572
  return !1;
5557
5573
  }
5558
5574
  }
5559
- async function _r() {
5575
+ async function vr() {
5560
5576
  return document.body ? document.body : await new Promise((e) => {
5561
5577
  const t = new MutationObserver(() => {
5562
5578
  document.body && (t.disconnect(), e(document.body));
@@ -5564,18 +5580,18 @@ async function _r() {
5564
5580
  t.observe(document.documentElement, { childList: !0 });
5565
5581
  });
5566
5582
  }
5567
- function To(e) {
5583
+ function Mo(e) {
5568
5584
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5569
5585
  }
5570
- function xr(e) {
5586
+ function Cr(e) {
5571
5587
  if (e)
5572
5588
  return { clientId: e, release: () => {
5573
5589
  } };
5574
5590
  let t = 0;
5575
- for (; Mt.has(t); )
5591
+ for (; Ft.has(t); )
5576
5592
  t += 1;
5577
- Mt.add(t);
5578
- const n = `${Ri}${t}`;
5593
+ Ft.add(t);
5594
+ const n = `${zi}${t}`;
5579
5595
  let o = crypto.randomUUID();
5580
5596
  try {
5581
5597
  o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
@@ -5585,15 +5601,15 @@ function xr(e) {
5585
5601
  return {
5586
5602
  clientId: o,
5587
5603
  release: () => {
5588
- i || (i = !0, Mt.delete(t));
5604
+ i || (i = !0, Ft.delete(t));
5589
5605
  }
5590
5606
  };
5591
5607
  }
5592
- function yr(e) {
5608
+ function Sr(e) {
5593
5609
  try {
5594
- const t = window.localStorage.getItem(To(e));
5610
+ const t = window.localStorage.getItem(Mo(e));
5595
5611
  if (!t)
5596
- return Qn();
5612
+ return io();
5597
5613
  const n = JSON.parse(t);
5598
5614
  return {
5599
5615
  isOpen: n.isOpen === !0,
@@ -5603,25 +5619,25 @@ function yr(e) {
5603
5619
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5604
5620
  (o) => typeof o == "string"
5605
5621
  ) : [],
5606
- launcherPosition: Er(n.launcherPosition) ? n.launcherPosition : null,
5607
- panelSize: kr(n.panelSize) ? ft(n.panelSize) : null,
5608
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ao) : [],
5622
+ launcherPosition: Pr(n.launcherPosition) ? n.launcherPosition : null,
5623
+ panelSize: Tr(n.panelSize) ? _t(n.panelSize) : null,
5624
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-co) : [],
5609
5625
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5610
5626
  };
5611
5627
  } catch {
5612
- return Qn();
5628
+ return io();
5613
5629
  }
5614
5630
  }
5615
- async function vr(e) {
5631
+ async function Er(e) {
5616
5632
  if (e.loadSharePromptsDisabled)
5617
5633
  return e.loadSharePromptsDisabled();
5618
5634
  try {
5619
- return window.localStorage.getItem(lo) === "true";
5635
+ return window.localStorage.getItem(go) === "true";
5620
5636
  } catch {
5621
5637
  return !1;
5622
5638
  }
5623
5639
  }
5624
- function Cr(e, t) {
5640
+ function kr(e, t) {
5625
5641
  if (e.persistSharePromptsDisabled) {
5626
5642
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5627
5643
  () => {
@@ -5630,12 +5646,12 @@ function Cr(e, t) {
5630
5646
  return;
5631
5647
  }
5632
5648
  try {
5633
- t && window.localStorage.setItem(lo, "true");
5649
+ t && window.localStorage.setItem(go, "true");
5634
5650
  } catch {
5635
5651
  return;
5636
5652
  }
5637
5653
  }
5638
- function Qn() {
5654
+ function io() {
5639
5655
  return {
5640
5656
  isOpen: !1,
5641
5657
  composerValue: "",
@@ -5648,29 +5664,29 @@ function Qn() {
5648
5664
  sharePromptsDisabled: !1
5649
5665
  };
5650
5666
  }
5651
- function Sr(e, t) {
5667
+ function Lr(e, t) {
5652
5668
  try {
5653
5669
  window.localStorage.setItem(
5654
- To(e),
5670
+ Mo(e),
5655
5671
  JSON.stringify(t)
5656
5672
  );
5657
5673
  } catch {
5658
5674
  return;
5659
5675
  }
5660
5676
  }
5661
- function Er(e) {
5677
+ function Pr(e) {
5662
5678
  if (!e || typeof e != "object")
5663
5679
  return !1;
5664
5680
  const t = e;
5665
5681
  return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
5666
5682
  }
5667
- function kr(e) {
5683
+ function Tr(e) {
5668
5684
  if (!e || typeof e != "object")
5669
5685
  return !1;
5670
5686
  const t = e;
5671
5687
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5672
5688
  }
5673
- async function Ao(e, t) {
5689
+ async function zo(e, t) {
5674
5690
  const n = await fetch(e, {
5675
5691
  method: "POST",
5676
5692
  credentials: "include",
@@ -5682,7 +5698,7 @@ async function Ao(e, t) {
5682
5698
  ...t ? { signal: t } : {}
5683
5699
  });
5684
5700
  if (!n.ok) {
5685
- const i = await n.text(), r = Qo(i);
5701
+ const i = await n.text(), r = ni(i);
5686
5702
  throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
5687
5703
  }
5688
5704
  const o = await n.json();
@@ -5690,57 +5706,77 @@ async function Ao(e, t) {
5690
5706
  throw new Error("Pluno token endpoint did not return a token");
5691
5707
  return o.token;
5692
5708
  }
5693
- function Lr(e) {
5694
- return async () => {
5695
- const t = new AbortController();
5696
- let n = !1;
5697
- const o = new Promise((i, r) => {
5698
- const l = window.setTimeout(() => {
5699
- n = !0, t.abort(), r(new Error(Pn));
5700
- }, Ai);
5701
- t.signal.addEventListener(
5709
+ function Ir(e) {
5710
+ let t = !1, n = !1;
5711
+ const o = async () => {
5712
+ const i = new AbortController();
5713
+ let r = !1;
5714
+ const l = new Promise((p, s) => {
5715
+ const c = window.setTimeout(() => {
5716
+ r = !0, i.abort(), s(new Error(Dn));
5717
+ }, Di);
5718
+ i.signal.addEventListener(
5702
5719
  "abort",
5703
- () => window.clearTimeout(l),
5720
+ () => window.clearTimeout(c),
5704
5721
  { once: !0 }
5705
5722
  );
5706
5723
  });
5707
5724
  try {
5708
- const i = await Promise.race([
5709
- Ao(e, t.signal),
5710
- o
5725
+ const p = await Promise.race([
5726
+ zo(e, i.signal),
5727
+ l
5711
5728
  ]);
5712
- return t.abort(), i;
5713
- } catch (i) {
5714
- throw t.abort(), n ? new Error(Pn) : i instanceof Error && i.message.startsWith("Pluno widget blocked on ") ? i : new Error(Ni);
5729
+ return i.abort(), p;
5730
+ } catch (p) {
5731
+ throw i.abort(), r ? new Error(Dn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Mi);
5732
+ }
5733
+ };
5734
+ return {
5735
+ loadToken: async () => {
5736
+ t = !0;
5737
+ try {
5738
+ try {
5739
+ return await o();
5740
+ } catch (i) {
5741
+ if (!n)
5742
+ throw i;
5743
+ return n = !1, await o();
5744
+ }
5745
+ } finally {
5746
+ t = !1, n = !1;
5747
+ }
5748
+ },
5749
+ retryPendingFailureOnce: () => {
5750
+ t && (n = !0);
5715
5751
  }
5716
5752
  };
5717
5753
  }
5718
- const eo = /* @__PURE__ */ new WeakSet();
5719
- function Ir(e) {
5754
+ const ao = /* @__PURE__ */ new WeakSet();
5755
+ function Ar(e) {
5720
5756
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5721
5757
  }
5722
- function to(e) {
5758
+ function ro(e) {
5723
5759
  const t = e.pathname.split("/");
5724
5760
  return t[t.length - 1] ?? "";
5725
5761
  }
5726
- function Pr(e, t) {
5762
+ function Nr(e, t) {
5727
5763
  const n = new URL(e.src, document.baseURI);
5728
- return n.href === t.href || n.pathname === t.pathname ? !0 : to(n) === to(t);
5764
+ return n.href === t.href || n.pathname === t.pathname ? !0 : ro(n) === ro(t);
5729
5765
  }
5730
- class ue extends EventTarget {
5766
+ class ge extends EventTarget {
5731
5767
  constructor(t, n) {
5732
- super(), this.channelId = n, this.url = t, this.addPreviewListener(ki, () => {
5733
- this.readyState = ue.OPEN, this.dispatchEvent(new Event("open"));
5734
- }), this.addPreviewListener(Li, (o) => {
5768
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Ti, () => {
5769
+ this.readyState = ge.OPEN, this.dispatchEvent(new Event("open"));
5770
+ }), this.addPreviewListener(Ii, (o) => {
5735
5771
  const i = o;
5736
5772
  this.dispatchEvent(
5737
5773
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5738
5774
  );
5739
- }), this.addPreviewListener(Ii, () => {
5740
- this.readyState = ue.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5741
- }), this.addPreviewListener(Pi, (o) => {
5775
+ }), this.addPreviewListener(Ai, () => {
5776
+ this.readyState = ge.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5777
+ }), this.addPreviewListener(Ni, (o) => {
5742
5778
  const i = o;
5743
- this.readyState = ue.CLOSED, this.dispatchEvent(
5779
+ this.readyState = ge.CLOSED, this.dispatchEvent(
5744
5780
  new CloseEvent("close", {
5745
5781
  code: i.detail?.code ?? 1e3,
5746
5782
  reason: i.detail?.reason ?? "",
@@ -5749,8 +5785,8 @@ class ue extends EventTarget {
5749
5785
  ), this.cleanup();
5750
5786
  }), window.dispatchEvent(
5751
5787
  new CustomEvent(
5752
- dt(
5753
- Ci,
5788
+ gt(
5789
+ ki,
5754
5790
  this.channelId
5755
5791
  ),
5756
5792
  {
@@ -5769,18 +5805,18 @@ class ue extends EventTarget {
5769
5805
  extensions = "";
5770
5806
  binaryType = "blob";
5771
5807
  bufferedAmount = 0;
5772
- readyState = ue.CONNECTING;
5773
- socketId = Tr();
5808
+ readyState = ge.CONNECTING;
5809
+ socketId = Rr();
5774
5810
  listeners = /* @__PURE__ */ new Map();
5775
5811
  send(t) {
5776
- if (this.readyState !== ue.OPEN)
5812
+ if (this.readyState !== ge.OPEN)
5777
5813
  throw new DOMException(
5778
5814
  "Pluno preview websocket is not open",
5779
5815
  "InvalidStateError"
5780
5816
  );
5781
5817
  window.dispatchEvent(
5782
5818
  new CustomEvent(
5783
- dt(Si, this.channelId),
5819
+ gt(Li, this.channelId),
5784
5820
  {
5785
5821
  detail: {
5786
5822
  socketId: this.socketId,
@@ -5791,9 +5827,9 @@ class ue extends EventTarget {
5791
5827
  );
5792
5828
  }
5793
5829
  close(t, n) {
5794
- this.readyState !== ue.CLOSED && (this.readyState = ue.CLOSING, window.dispatchEvent(
5830
+ this.readyState !== ge.CLOSED && (this.readyState = ge.CLOSING, window.dispatchEvent(
5795
5831
  new CustomEvent(
5796
- dt(Ei, this.channelId),
5832
+ gt(Pi, this.channelId),
5797
5833
  {
5798
5834
  detail: { socketId: this.socketId, code: t, reason: n }
5799
5835
  }
@@ -5801,7 +5837,7 @@ class ue extends EventTarget {
5801
5837
  ), this.cleanup());
5802
5838
  }
5803
5839
  addPreviewListener(t, n) {
5804
- const o = dt(
5840
+ const o = gt(
5805
5841
  t,
5806
5842
  this.channelId
5807
5843
  ), i = (r) => {
@@ -5815,19 +5851,19 @@ class ue extends EventTarget {
5815
5851
  this.listeners.clear();
5816
5852
  }
5817
5853
  }
5818
- function Tr() {
5854
+ function Rr() {
5819
5855
  const e = window.sessionStorage.getItem(
5820
- In
5856
+ Rn
5821
5857
  );
5822
5858
  if (e)
5823
5859
  return e;
5824
5860
  const t = crypto.randomUUID();
5825
- return window.sessionStorage.setItem(In, t), t;
5861
+ return window.sessionStorage.setItem(Rn, t), t;
5826
5862
  }
5827
- function dt(e, t) {
5863
+ function gt(e, t) {
5828
5864
  return `${e}:${t}`;
5829
5865
  }
5830
- function Ar(e) {
5866
+ function Dr(e) {
5831
5867
  const t = document.currentScript;
5832
5868
  if (t instanceof HTMLScriptElement)
5833
5869
  return [t];
@@ -5835,64 +5871,65 @@ function Ar(e) {
5835
5871
  return Array.from(
5836
5872
  document.querySelectorAll("script[type='module'][src]")
5837
5873
  ).filter(
5838
- (i) => i instanceof HTMLScriptElement && Ir(i) && Pr(i, o)
5874
+ (i) => i instanceof HTMLScriptElement && Ar(i) && Nr(i, o)
5839
5875
  );
5840
5876
  }
5841
- function Nr(e) {
5842
- for (const t of Ar(e))
5843
- eo.has(t) || t.dataset.plunoAutoMount === "false" || (eo.add(t), No(t).catch((n) => {
5877
+ function Mr(e) {
5878
+ for (const t of Dr(e))
5879
+ ao.has(t) || t.dataset.plunoAutoMount === "false" || (ao.add(t), Oo(t).catch((n) => {
5844
5880
  console.error("Failed to mount Pluno widget", n);
5845
5881
  }));
5846
5882
  }
5847
- function No(e) {
5848
- const t = window, n = t[ce];
5883
+ function Oo(e) {
5884
+ const t = window, n = t[ue];
5849
5885
  if (n) {
5850
5886
  if (n.host === null)
5851
5887
  return n.mountPromise.catch(() => {
5852
- const p = t[ce];
5853
- return p ? p.mountPromise : No(e);
5888
+ const s = t[ue];
5889
+ return s ? s.mountPromise : Oo(e);
5854
5890
  });
5855
- if (Rr(n.host))
5856
- return n.mountPromise;
5857
- n.destroy?.(), delete t[ce];
5891
+ if (zr(n.host))
5892
+ return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
5893
+ n.destroy?.(), delete t[ue];
5858
5894
  }
5859
- const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint;
5860
- let r;
5861
- const l = ta({
5895
+ const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Ir(i) : null;
5896
+ let l;
5897
+ const p = ia({
5862
5898
  token: e.dataset.plunoToken,
5863
- tokenProvider: !e.dataset.plunoToken && !o && i ? Lr(i) : void 0,
5899
+ tokenProvider: r?.loadToken,
5864
5900
  tokenEndpoint: i,
5865
5901
  backendUrl: e.dataset.plunoBackendUrl,
5866
- webSocketFactory: o ? ea(o) : void 0,
5902
+ webSocketFactory: o ? oa(o) : void 0,
5867
5903
  launcherLabel: e.dataset.plunoLauncherLabel,
5868
5904
  accentColor: e.dataset.plunoAccentColor,
5869
5905
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5870
5906
  fontFamily: e.dataset.plunoFontFamily,
5871
5907
  scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
5872
5908
  position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5873
- }).then((p) => {
5874
- if (t[ce] !== r) {
5875
- p.destroy();
5909
+ }).then((s) => {
5910
+ if (t[ue] !== l) {
5911
+ s.destroy();
5876
5912
  return;
5877
5913
  }
5878
- const d = p.host;
5879
- d.setAttribute(ro, "true"), r.host = d, r.destroy = () => {
5880
- t[ce] === r && delete t[ce], r.host = null, r.destroy = null, p.destroy();
5914
+ const c = s.host;
5915
+ c.setAttribute(uo, "true"), l.host = c, l.destroy = () => {
5916
+ t[ue] === l && delete t[ue], l.host = null, l.destroy = null, s.destroy();
5881
5917
  };
5882
- }).catch((p) => {
5883
- throw t[ce] === r && delete t[ce], p;
5918
+ }).catch((s) => {
5919
+ throw t[ue] === l && delete t[ue], s;
5884
5920
  });
5885
- return r = {
5886
- mountPromise: l,
5921
+ return l = {
5922
+ mountPromise: p,
5887
5923
  host: null,
5888
- destroy: null
5889
- }, t[ce] = r, l;
5924
+ destroy: null,
5925
+ retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
5926
+ }, t[ue] = l, p;
5890
5927
  }
5891
- function Rr(e) {
5892
- return e.isConnected && e.getAttribute(ro) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
5928
+ function zr(e) {
5929
+ return e.isConnected && e.getAttribute(uo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
5893
5930
  }
5894
- Nr(import.meta.url);
5931
+ Mr(import.meta.url);
5895
5932
  export {
5896
- ea as createProductAgentPreviewBridgeWebSocketFactory,
5897
- ta as mountPlunoProductAgentWidget
5933
+ oa as createProductAgentPreviewBridgeWebSocketFactory,
5934
+ ia as mountPlunoProductAgentWidget
5898
5935
  };