@pluno/product-agent-web 0.1.93 → 0.1.94

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 si, getProductAgentOriginAccessErrorMessage as di } from "./product-agent-sdk.js";
2
- const ci = "#7c3aed", ft = "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", wt = "#2c2a1e", Nn = [253, 250, 241], Rn = 3.5;
3
- function fo(e) {
4
- const t = wo(e);
5
- if (Dn(nt(t), Nn) >= Rn)
1
+ import { PlunoProductAgent as mi, getProductAgentOriginAccessErrorMessage as fi } from "./product-agent-sdk.js";
2
+ const wi = "#7c3aed", xt = "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", yt = "#2c2a1e", Mn = [253, 250, 241], On = 3.5;
3
+ function xo(e) {
4
+ const t = yo(e);
5
+ if (Un(it(t), Mn) >= On)
6
6
  return t;
7
- let o = nt(t);
8
- const i = nt(wt);
7
+ let o = it(t);
8
+ const i = it(yt);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (o = hi(o, i, 0.22), Dn(o, Nn) >= Rn)
11
- return Qt(o);
12
- return Qt(o);
10
+ if (o = xi(o, i, 0.22), Un(o, Mn) >= On)
11
+ return on(o);
12
+ return on(o);
13
13
  }
14
- function ui() {
14
+ function bi() {
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 ui() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function gi(e) {
23
- const t = wo(e), n = en(nt(t));
22
+ function _i(e) {
23
+ const t = yo(e), n = an(it(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,34 +56,34 @@ function gi(e) {
56
56
  shadow: le(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function wo(e) {
59
+ function yo(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()}` : ci;
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()}` : wi;
62
62
  }
63
- function nt(e) {
63
+ function it(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 Qt([e, t, n]) {
70
+ function on([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 en([e, t, n]) {
74
+ function an([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 Dn(e, t) {
82
- const n = en(e), o = en(t), [i, r] = n > o ? [n, o] : [o, n];
81
+ function Un(e, t) {
82
+ const n = an(e), o = an(t), [i, r] = n > o ? [n, o] : [o, n];
83
83
  return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function hi(e, t, n) {
86
- const o = tn(n);
85
+ function xi(e, t, n) {
86
+ const o = rn(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
@@ -91,43 +91,43 @@ function hi(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function le(e, t, n) {
94
- const [o, i, r] = mi(nt(e));
95
- return Qt(fi(o, tn(i + n), tn(r + t)));
94
+ const [o, i, r] = yi(it(e));
95
+ return on(vi(o, rn(i + n), rn(r + t)));
96
96
  }
97
- function mi([e, t, n]) {
97
+ function yi([e, t, n]) {
98
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
100
  return [0, 0, s];
101
101
  const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
102
102
  return [(l === o ? (i - r) / g + (i < r ? 6 : 0) : l === i ? (r - o) / g + 2 : (o - i) / g + 4) / 6, c, s];
103
103
  }
104
- function fi(e, t, n) {
104
+ function vi(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
- Ht(i, o, e + 1 / 3) * 255,
110
- Ht(i, o, e) * 255,
111
- Ht(i, o, e - 1 / 3) * 255
109
+ jt(i, o, e + 1 / 3) * 255,
110
+ jt(i, o, e) * 255,
111
+ jt(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function Ht(e, t, n) {
114
+ function jt(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 tn(e) {
118
+ function rn(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const bo = "suggest_share_on_socials";
122
- function wi(e) {
121
+ const vo = "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 !== bo)
125
+ if (n.role !== "tool" || n.toolName !== vo)
126
126
  continue;
127
- const o = zn(e, t, "assistant");
127
+ const o = Bn(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const i = zn(e, o.index, "user");
130
+ const i = Bn(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 wi(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function bi(e) {
140
- const t = await _i(e);
139
+ async function Ci(e) {
140
+ const t = await Ei(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 zn(e, t, n) {
145
+ function Bn(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,74 +150,74 @@ function zn(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function _i(e) {
153
+ async function Ei(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const xi = "https://app.pluno.ai", yi = "/api/product-agent/embed/active-users", vi = 1800, Ci = 15e3, Si = 250, Ei = 1e3, ki = 3e4;
157
- function Li(e, t = {}) {
156
+ const ki = "https://app.pluno.ai", Li = "/api/product-agent/embed/active-users", Ti = 1800, Pi = 15e3, Ii = 250, Ai = 1e3, Ni = 3e4;
157
+ function Ri(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 = (c) => {
162
162
  n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  g();
164
- }, Ii(c)));
164
+ }, Mi(c)));
165
165
  }, s = (c) => {
166
166
  if (l(), o === null) {
167
167
  o = c, e(c);
168
168
  return;
169
169
  }
170
- const h = o, C = performance.now();
170
+ const h = o, S = performance.now();
171
171
  r = window.setInterval(() => {
172
172
  if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const P = Math.min(1, (performance.now() - C) / vi);
177
- o = Math.round(h + (c - h) * Ai(P)), e(o), P >= 1 && (o = c, e(c), l());
178
- }, Si);
176
+ const P = Math.min(1, (performance.now() - S) / Ti);
177
+ o = Math.round(h + (c - h) * Oi(P)), e(o), P >= 1 && (o = c, e(c), l());
178
+ }, Ii);
179
179
  }, g = async () => {
180
180
  try {
181
- const c = await Ti(t);
181
+ const c = await Di(t);
182
182
  if (n)
183
183
  return;
184
184
  s(c.count), p(c.refreshAfterMs);
185
185
  } catch {
186
- p(Ci);
186
+ p(Pi);
187
187
  }
188
188
  };
189
189
  return g(), () => {
190
190
  n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function Ti(e) {
193
+ async function Di(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(yi, Pi(e.backendUrl ?? xi)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(Li, zi(e.backendUrl ?? ki)).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 = Mn(o.count), r = Mn(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), i = Fn(o.count), r = Fn(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 Mn(e) {
207
+ function Fn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Pi(e) {
210
+ function zi(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function Ii(e) {
214
- return Math.min(ki, Math.max(Ei, e));
213
+ function Mi(e) {
214
+ return Math.min(Ni, Math.max(Ai, e));
215
215
  }
216
- function Ai(e) {
216
+ function Oi(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const Ni = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
220
- function Ri(e) {
219
+ const Ui = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
220
+ function Bi(e) {
221
221
  let t = "", n = "", o = null;
222
222
  for (const i of e.split(new RegExp("(?<=\\n)"))) {
223
223
  if (o) {
@@ -228,7 +228,7 @@ function Ri(e) {
228
228
  }
229
229
  const r = i.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
230
230
  if (r) {
231
- t += On(n) + i, n = "", o = {
231
+ t += Wn(n) + i, n = "", o = {
232
232
  marker: r[1][0],
233
233
  length: r[1].length
234
234
  };
@@ -236,31 +236,31 @@ function Ri(e) {
236
236
  }
237
237
  n += i;
238
238
  }
239
- return t + On(n);
239
+ return t + Wn(n);
240
240
  }
241
- function On(e) {
241
+ function Wn(e) {
242
242
  let t = "", n = 0;
243
- for (const o of e.matchAll(Ni)) {
243
+ for (const o of e.matchAll(Ui)) {
244
244
  const i = o.index ?? 0;
245
- t += Un(
245
+ t += Hn(
246
246
  e.slice(n, i)
247
247
  ), t += o[0], n = i + o[0].length;
248
248
  }
249
- return t + Un(e.slice(n));
249
+ return t + Hn(e.slice(n));
250
250
  }
251
- function Un(e) {
251
+ function Hn(e) {
252
252
  return e.replace(
253
253
  /\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
254
- (t, n, o, i, r) => r[i - 1] === "!" || Di(r, i) || zi(r, i, n) ? t : `[${n}](${o})`
254
+ (t, n, o, i, r) => r[i - 1] === "!" || Fi(r, i) || Wi(r, i, n) ? t : `[${n}](${o})`
255
255
  );
256
256
  }
257
- function Di(e, t) {
257
+ function Fi(e, t) {
258
258
  let n = 0;
259
259
  for (let o = t - 1; e[o] === "\\"; o -= 1)
260
260
  n += 1;
261
261
  return n % 2 === 1;
262
262
  }
263
- function zi(e, t, n) {
263
+ function Wi(e, t, n) {
264
264
  if (n !== "x" && n !== "X")
265
265
  return !1;
266
266
  const o = e.lastIndexOf(`
@@ -269,7 +269,7 @@ function zi(e, t, n) {
269
269
  e.slice(o, t)
270
270
  );
271
271
  }
272
- const _o = 100, Mi = 1e4, Oi = 5e3, Ui = "product-agent:sdk-preview-socket-connect", Bi = "product-agent:sdk-preview-socket-send", Fi = "product-agent:sdk-preview-socket-close", Wi = "product-agent:sdk-preview-socket-open", Hi = "product-agent:sdk-preview-socket-message", $i = "product-agent:sdk-preview-socket-error", Gi = "product-agent:sdk-preview-socket-closed", Bn = "product-agent:sdk-preview-socket-id", qi = "data-pluno-sdk-preview-channel", xo = "data-pluno-auto-mounted", me = "__plunoProductAgentAutoMountOwner", ji = 1e4, Vi = "Failed to load Pluno widget token", Fn = "Timed out loading Pluno widget token", Ki = "pluno.productAgent.widgetClientId.", $t = /* @__PURE__ */ new Set(), Yi = "product-agent:preview-diagnostic", yo = "pluno.productAgent.sharePromptsDisabled", Xi = 3, Wn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Zi = 400, Ji = 5e3, Qi = 500, Hn = "Close the page's popup to chat", ea = "No recent chats for this page yet.", pe = {
272
+ const So = 100, Hi = 1e4, Gi = 5e3, $i = "product-agent:sdk-preview-socket-connect", qi = "product-agent:sdk-preview-socket-send", ji = "product-agent:sdk-preview-socket-close", Vi = "product-agent:sdk-preview-socket-open", Ki = "product-agent:sdk-preview-socket-message", Yi = "product-agent:sdk-preview-socket-error", Xi = "product-agent:sdk-preview-socket-closed", Gn = "product-agent:sdk-preview-socket-id", Zi = "data-pluno-sdk-preview-channel", Co = "data-pluno-auto-mounted", me = "__plunoProductAgentAutoMountOwner", Ji = 1e4, Qi = "Failed to load Pluno widget token", $n = "Timed out loading Pluno widget token", ea = "pluno.productAgent.widgetClientId.", Vt = /* @__PURE__ */ new Set(), ta = "product-agent:preview-diagnostic", Eo = "pluno.productAgent.sharePromptsDisabled", na = 3, qn = 'dialog[open], [aria-modal="true"], [role="dialog"]', oa = 400, ia = 5e3, aa = 500, jn = "Close the page's popup to chat", ra = "No recent chats for this page yet.", pe = {
273
273
  launcherLabel: "Ask for anything...",
274
274
  accentColor: "#7c3aed",
275
275
  colorScheme: "light",
@@ -277,7 +277,7 @@ const _o = 100, Mi = 1e4, Oi = 5e3, Ui = "product-agent:sdk-preview-socket-conne
277
277
  scribbleStyle: !0,
278
278
  position: "bottom-right",
279
279
  movableLauncher: !0
280
- }, ta = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', $n = "pluno-pa-scribble-font", vo = 190, Co = 41, Gn = 22, na = 1, oa = 48, un = 420, ia = 520, aa = 0.24, gn = 680, ra = 800, la = 0.76, N = 8, Ne = 50, So = "http://www.w3.org/2000/svg", nn = 26, on = 8, pa = 36, an = 16, sa = 4, qn = [
280
+ }, la = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Vn = "pluno-pa-scribble-font", ko = 190, Lo = 41, Kn = 22, pa = 1, sa = 48, fn = 420, da = 520, ca = 0.24, wn = 680, ua = 800, ga = 0.76, N = 8, Ne = 50, To = "http://www.w3.org/2000/svg", ln = 26, pn = 8, ha = 36, sn = 16, ma = 4, Yn = [
281
281
  {
282
282
  ellipseCx: "17.5",
283
283
  ellipseCy: "24.5",
@@ -314,12 +314,12 @@ const _o = 100, Mi = 1e4, Oi = 5e3, Ui = "product-agent:sdk-preview-socket-conne
314
314
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
315
315
  pathStrokeWidth: "2.45"
316
316
  }
317
- ], da = 11, ca = 13, rn = 4, Eo = 10, ko = 40, ua = "movable-launcher-position-v2", Lo = "pluno-pa-widget-styles", To = "data-pluno-pa-widget-styles";
318
- let jn = 0;
319
- function ga(e) {
317
+ ], fa = 11, wa = 13, dn = 4, Po = 10, Io = 40, ba = "movable-launcher-position-v2", Ao = "pluno-pa-widget-styles", No = "data-pluno-pa-widget-styles";
318
+ let Xn = 0;
319
+ function _a(e) {
320
320
  return (t) => new fe(t, e);
321
321
  }
322
- async function ha(e = {}) {
322
+ async function xa(e = {}) {
323
323
  const t = {
324
324
  layout: e.layout ?? "floating",
325
325
  mountTarget: e.mountTarget,
@@ -368,9 +368,10 @@ async function ha(e = {}) {
368
368
  morningReport: e.morningReport ?? null,
369
369
  onMorningReportSnooze: e.onMorningReportSnooze,
370
370
  onMorningReportTaskStart: e.onMorningReportTaskStart,
371
- taskNotifications: e.taskNotifications
371
+ taskNotifications: e.taskNotifications,
372
+ tabGroups: e.tabGroups
372
373
  };
373
- K(
374
+ Y(
374
375
  "web-sdk.widget",
375
376
  "Mounting widget with merged options",
376
377
  {
@@ -387,39 +388,39 @@ async function ha(e = {}) {
387
388
  );
388
389
  const n = document.createElement("div");
389
390
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), n.setAttribute("data-pluno-product-agent-layout", t.layout), t.sdkPreviewChannelId && n.setAttribute(
390
- qi,
391
+ Zi,
391
392
  t.sdkPreviewChannelId
392
393
  );
393
394
  const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
394
395
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.classList.add(`pluno-pa-widget--layout-${t.layout}`), i.setAttribute("data-pluno-product-agent-ui-root", "widget");
395
- let r = Vn(
396
+ let r = Zn(
396
397
  t.accentColor,
397
398
  t.scribbleStyle
398
399
  );
399
- Oa(
400
+ Ga(
400
401
  i,
401
402
  t.launcherLabel,
402
403
  r,
403
404
  t.movableLauncher,
404
405
  t.showLauncherMinimizeButton
405
406
  ), o.appendChild(i);
406
- const l = Dr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Nr(t) : "shown";
407
- uo(t, p);
407
+ const l = Wr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Br(t) : "shown";
408
+ fo(t, p);
408
409
  let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
409
410
  i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Ae(
410
411
  i,
411
- qt(
412
+ Yt(
412
413
  i,
413
414
  s,
414
415
  t.position
415
416
  )
416
- )), co(o, t.accentColor), Kn(i, r, {
417
+ )), mo(o, t.accentColor), Jn(i, r, {
417
418
  accentColor: t.accentColor,
418
419
  colorScheme: t.colorScheme,
419
420
  fontFamily: t.fontFamily,
420
421
  scribbleStyle: t.scribbleStyle
421
422
  });
422
- const C = t.mountTarget ?? await Ar(), P = C.ownerDocument, I = i.querySelector(
423
+ const S = t.mountTarget ?? await Ur(), P = S.ownerDocument, I = i.querySelector(
423
424
  ".pluno-pa-widget__launcher"
424
425
  ), D = i.querySelector(
425
426
  ".pluno-pa-widget__launcher-drag-handle"
@@ -427,15 +428,15 @@ async function ha(e = {}) {
427
428
  ".pluno-pa-widget__launcher-input"
428
429
  ), v = i.querySelector(
429
430
  ".pluno-pa-widget__launcher-minimize"
430
- ), m = i.querySelector(".pluno-pa-widget__panel"), S = i.querySelector(
431
+ ), m = i.querySelector(".pluno-pa-widget__panel"), C = i.querySelector(
431
432
  ".pluno-pa-widget__scribble-spirals--panel"
432
433
  ), z = Array.from(
433
434
  i.querySelectorAll(".pluno-pa-widget__resize-handle")
434
435
  ), L = i.querySelector(
435
436
  ".pluno-pa-widget__close"
436
- ), oe = i.querySelector(
437
+ ), ie = i.querySelector(
437
438
  ".pluno-pa-widget__composer"
438
- ), J = i.querySelector(
439
+ ), Q = i.querySelector(
439
440
  ".pluno-pa-widget__attachment-error"
440
441
  ), Re = i.querySelector(
441
442
  ".pluno-pa-widget__billing-status"
@@ -447,19 +448,19 @@ async function ha(e = {}) {
447
448
  ".pluno-pa-widget__attach"
448
449
  ), f = i.querySelector(
449
450
  ".pluno-pa-widget__input"
450
- ), Q = i.querySelector(
451
+ ), ee = i.querySelector(
451
452
  ".pluno-pa-widget__send"
452
453
  ), De = i.querySelector(
453
454
  ".pluno-pa-widget__top-actions"
454
- ), Ce = i.querySelector(
455
- ".pluno-pa-widget__history"
456
455
  ), Se = i.querySelector(
456
+ ".pluno-pa-widget__history"
457
+ ), Ce = i.querySelector(
457
458
  ".pluno-pa-widget__history-panel"
458
459
  ), j = i.querySelector(
459
460
  ".pluno-pa-widget__history-list"
460
- ), ot = i.querySelector(
461
+ ), at = i.querySelector(
461
462
  ".pluno-pa-widget__history-close"
462
- ), ie = i.querySelector(
463
+ ), ae = i.querySelector(
463
464
  ".pluno-pa-widget__history-status"
464
465
  ), x = i.querySelector(
465
466
  ".pluno-pa-widget__timeline-jump"
@@ -467,7 +468,7 @@ async function ha(e = {}) {
467
468
  ".pluno-pa-widget__active-users-counter"
468
469
  ), T = i.querySelector(
469
470
  ".pluno-pa-widget__timeline"
470
- ), ae = i.querySelector(
471
+ ), re = i.querySelector(
471
472
  ".pluno-pa-widget__timeline-bottom-sentinel"
472
473
  ), H = i.querySelector(
473
474
  ".pluno-pa-widget__notify-suggestion"
@@ -475,41 +476,47 @@ async function ha(e = {}) {
475
476
  ".pluno-pa-widget__notify-suggestion-enable"
476
477
  ), A = i.querySelector(
477
478
  ".pluno-pa-widget__notify-suggestion-later"
478
- ), jo = i.querySelector(
479
+ ), Xo = i.querySelector(
479
480
  ".pluno-pa-widget__notify-suggestion-never"
481
+ ), ze = i.querySelector(
482
+ ".pluno-pa-widget__tab-groups-suggestion"
483
+ ), Zo = i.querySelector(
484
+ ".pluno-pa-widget__tab-groups-suggestion-enable"
485
+ ), Jo = i.querySelector(
486
+ ".pluno-pa-widget__tab-groups-suggestion-dismiss"
480
487
  );
481
- if (!I || !u || !m || !L || !oe || !J || !Re || !U || !we || !B || !f || !Q || !De || !Ce || !Se || !j || !ot || !ie || !x || !R || !T || !ae)
488
+ if (!I || !u || !m || !L || !ie || !Q || !Re || !U || !we || !B || !f || !ee || !De || !Se || !Ce || !j || !at || !ae || !x || !R || !T || !re)
482
489
  throw new Error("Failed to mount Pluno widget");
483
490
  if (t.movableLauncher && !D)
484
491
  throw new Error("Failed to mount Pluno widget drag handle");
485
- B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled, to(u), to(f);
492
+ B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled, ao(u), ao(f);
486
493
  let q = [], ue = null;
487
- const ze = () => {
488
- nr(
494
+ const Me = () => {
495
+ sr(
489
496
  U,
490
497
  q,
491
498
  (a) => {
492
499
  q = q.filter(
493
500
  (d, _) => _ !== a
494
- ), ze(), W(b.getState()), $();
501
+ ), Me(), W(b.getState()), G();
495
502
  }
496
503
  );
497
- }, wn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Go(t.tokenEndpoint) : void 0);
498
- if (!t.loginRequired && !t.signupRequired && !t.token && !wn && !t.webSocketFactory)
504
+ }, yn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Ko(t.tokenEndpoint) : void 0);
505
+ if (!t.loginRequired && !t.signupRequired && !t.token && !yn && !t.webSocketFactory)
499
506
  throw new Error("Pluno widget requires token or tokenEndpoint");
500
- const Vo = window.fetch.bind(window), vt = Rr(t.clientId);
507
+ const Qo = window.fetch.bind(window), kt = Fr(t.clientId);
501
508
  let b;
502
509
  try {
503
510
  const a = {
504
511
  token: t.token,
505
- tokenProvider: wn,
512
+ tokenProvider: yn,
506
513
  backendUrl: t.backendUrl,
507
514
  metadata: () => ({
508
515
  ...t.metadata ?? {},
509
516
  ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
510
517
  }),
511
518
  initialStarterPrompts: t.initialStarterPrompts,
512
- clientId: vt.clientId,
519
+ clientId: kt.clientId,
513
520
  restorePersistedState: t.restorePersistedState,
514
521
  expectedPersistedSessionId: t.expectedPersistedSessionId,
515
522
  keepRunsActiveOnSessionNavigation: t.keepRunsActiveOnSessionNavigation,
@@ -520,11 +527,11 @@ async function ha(e = {}) {
520
527
  autoConnect: !1,
521
528
  disableNetworkCapture: !!t.sdkPreviewChannelId
522
529
  };
523
- b = await si.init(a);
530
+ b = await mi.init(a);
524
531
  } catch (a) {
525
- throw vt.release(), n.remove(), a;
532
+ throw kt.release(), n.remove(), a;
526
533
  }
527
- C.appendChild(n), K(
534
+ S.appendChild(n), Y(
528
535
  "web-sdk.widget",
529
536
  "Applied initial widget appearance",
530
537
  {
@@ -534,22 +541,22 @@ async function ha(e = {}) {
534
541
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
535
542
  }
536
543
  );
537
- const Ct = new Set(l.openToolGroupKeys), Me = new Set(
544
+ const Lt = new Set(l.openToolGroupKeys), Oe = new Set(
538
545
  l.seenShareCandidateIds
539
- ), it = new Set(Me);
540
- let St = l.sharePromptsDisabled || await zr(t), ee = null, re = !1, at = !(t.loginRequired || t.signupRequired), be = !1, Ee = {
546
+ ), rt = new Set(Oe);
547
+ let Tt = l.sharePromptsDisabled || await Hr(t), te = null, V = !1, lt = !(t.loginRequired || t.signupRequired), be = !1, Ee = {
541
548
  enabled: !0
542
- }, ke = 0, bn = "", _e = !1, ge = !1, xe = [], Et = null, $e = null;
543
- const te = (a, d) => {
549
+ }, ke = 0, vn = "", _e = !1, ge = !1, xe = [], Pt = null, qe = null;
550
+ const ne = (a, d) => {
544
551
  Ee = { enabled: a, reason: d };
545
- }, ne = () => {
552
+ }, oe = () => {
546
553
  x.hidden = !0;
547
- }, Ko = () => {
554
+ }, ei = () => {
548
555
  x.hidden = !1;
549
- }, Yo = (a = "jump") => {
550
- te(!0, a), ne(), tt(T, () => Ee.enabled), ke = T.scrollTop;
556
+ }, ti = (a = "jump") => {
557
+ ne(!0, a), oe(), ot(T, () => Ee.enabled), ke = T.scrollTop;
551
558
  }, Le = () => {
552
- if (Ce.hidden = t.layout === "page" || t.loginRequired, Se.hidden = !_e, Ce.setAttribute("aria-expanded", String(_e)), j.classList.toggle(
559
+ if (Se.hidden = t.layout === "page" || t.loginRequired, Ce.hidden = !_e, Se.setAttribute("aria-expanded", String(_e)), j.classList.toggle(
553
560
  "pluno-pa-widget__history-list--center",
554
561
  ge && xe.length === 0
555
562
  ), j.replaceChildren(), ge && xe.length === 0) {
@@ -560,54 +567,54 @@ async function ha(e = {}) {
560
567
  const d = document.createElement("button");
561
568
  d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ge;
562
569
  const _ = document.createElement("span");
563
- _.className = "pluno-pa-widget__history-item-title", _.textContent = Da(a);
570
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = Fa(a);
564
571
  const k = document.createElement("time");
565
- k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent = Ma(
572
+ k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent = Ha(
566
573
  a.lastActiveAt,
567
574
  Date.now()
568
575
  );
569
576
  const M = document.createElement("small");
570
- M.className = "pluno-pa-widget__history-path", M.textContent = za(a), d.append(_, k, M), d.addEventListener("click", () => {
571
- _e = !1, $e = null, Le(), te(!0, "newSession"), ne(), b.loadSession(a.id), W(b.getState());
577
+ M.className = "pluno-pa-widget__history-path", M.textContent = Wa(a), d.append(_, k, M), d.addEventListener("click", () => {
578
+ _e = !1, qe = null, Le(), ne(!0, "newSession"), oe(), b.loadSession(a.id), W(b.getState());
572
579
  }), j.appendChild(d);
573
580
  }
574
581
  if (ge && xe.length > 0) {
575
582
  const a = document.createElement("p");
576
583
  a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", j.appendChild(a);
577
584
  }
578
- ie.textContent = $e ?? (!ge && xe.length === 0 ? "No recent chats for this page yet." : ""), ie.hidden = ie.textContent.length === 0;
579
- }, _n = async (a) => {
585
+ ae.textContent = qe ?? (!ge && xe.length === 0 ? "No recent chats for this page yet." : ""), ae.hidden = ae.textContent.length === 0;
586
+ }, Sn = async (a) => {
580
587
  if (!ge) {
581
- ge = !0, $e = null, Le();
588
+ ge = !0, qe = null, Le();
582
589
  try {
583
590
  const d = await b.listSessions({ cursor: a, limit: 20 });
584
- xe = a ? [...xe, ...d.sessions] : d.sessions, Et = d.nextCursor;
591
+ xe = a ? [...xe, ...d.sessions] : d.sessions, Pt = d.nextCursor;
585
592
  } catch (d) {
586
- K(
593
+ Y(
587
594
  "web-sdk.widget",
588
595
  "Failed to load session history",
589
596
  {
590
597
  message: d instanceof Error ? d.message : String(d)
591
598
  }
592
- ), $e = ea;
599
+ ), qe = ra;
593
600
  } finally {
594
601
  ge = !1, Le();
595
602
  }
596
603
  }
597
- }, Xo = () => {
598
- !Et || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 && _n(Et);
599
- }, xn = () => {
600
- re || typeof document > "u" || (co(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
601
- }, yn = new MutationObserver(xn);
602
- yn.observe(P.documentElement, {
604
+ }, ni = () => {
605
+ !Pt || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 && Sn(Pt);
606
+ }, Cn = () => {
607
+ V || typeof document > "u" || (mo(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
608
+ }, En = new MutationObserver(Cn);
609
+ En.observe(P.documentElement, {
603
610
  childList: !0,
604
611
  subtree: !0
605
- }), xn();
606
- const Ge = (a = !0) => {
607
- const d = bt(i, a);
608
- return ln(
612
+ }), Cn();
613
+ const je = (a = !0) => {
614
+ const d = vt(i, a);
615
+ return cn(
609
616
  i,
610
- s ? Po(s, d) : va(
617
+ s ? Ro(s, d) : Ta(
611
618
  i,
612
619
  t.position,
613
620
  d
@@ -615,38 +622,38 @@ async function ha(e = {}) {
615
622
  d
616
623
  );
617
624
  }, F = () => {
618
- const a = Pa(o, u, f);
619
- Or(t, {
625
+ const a = za(o, u, f);
626
+ $r(t, {
620
627
  isOpen: i.classList.contains("pluno-pa-widget--open"),
621
628
  composerValue: f.value,
622
629
  focusedInput: a,
623
630
  focusedInputAt: a ? Date.now() : null,
624
- openToolGroupKeys: [...Ct],
631
+ openToolGroupKeys: [...Lt],
625
632
  launcherPosition: g ? s : null,
626
633
  panelSize: c,
627
- seenShareCandidateIds: [...Me].slice(
628
- -_o
634
+ seenShareCandidateIds: [...Oe].slice(
635
+ -So
629
636
  ),
630
- sharePromptsDisabled: St
637
+ sharePromptsDisabled: Tt
631
638
  });
632
- }, rt = (a) => {
639
+ }, pt = (a) => {
633
640
  t.onDisplayStateChange?.(a);
634
- }, qe = (a, d = !0) => {
635
- if (uo(t, a), a === "shown") {
636
- i.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && je(!1), d && rt("shown");
641
+ }, Ve = (a, d = !0) => {
642
+ if (fo(t, a), a === "shown") {
643
+ i.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ke(!1), d && pt("shown");
637
644
  return;
638
645
  }
639
- ee !== null && (window.clearTimeout(ee), ee = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, m.hidden = !0, L.hidden = !0, I.tabIndex = 0, f.value = "", Ae(
646
+ te !== null && (window.clearTimeout(te), te = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, m.hidden = !0, L.hidden = !0, I.tabIndex = 0, f.value = "", Ae(
640
647
  i,
641
- qt(
648
+ Yt(
642
649
  i,
643
650
  s,
644
651
  t.position
645
652
  )
646
- ), Jn(i), F(), d && rt("minimized");
653
+ ), no(i), F(), d && pt("minimized");
647
654
  }, Te = (a, d = {}) => {
648
- Ta(a, {
649
- debugVersion: ua,
655
+ Da(a, {
656
+ debugVersion: ba,
650
657
  launcherPosition: s,
651
658
  rootClasses: i.className,
652
659
  rootStyle: {
@@ -655,38 +662,38 @@ async function ha(e = {}) {
655
662
  right: i.style.right,
656
663
  bottom: i.style.bottom
657
664
  },
658
- rootRect: Vt(i),
659
- launcherRect: Vt(I),
660
- panelRect: Vt(m),
661
- viewport: Z(),
665
+ rootRect: Zt(i),
666
+ launcherRect: Zt(I),
667
+ panelRect: Zt(m),
668
+ viewport: J(),
662
669
  panelHidden: m.hidden,
663
670
  closeHidden: L.hidden,
664
671
  ...d
665
672
  });
666
- }, je = (a = !0) => {
673
+ }, Ke = (a = !0) => {
667
674
  if (!s)
668
- return Ae(i, null), Ge(a);
669
- const d = Ge(a);
675
+ return Ae(i, null), je(a);
676
+ const d = je(a);
670
677
  return Ae(i, d), Te("Applied stored closed launcher position", {
671
678
  visibleLauncherPosition: d
672
679
  }), d;
673
- }, kt = (a, d) => {
680
+ }, It = (a, d) => {
674
681
  if (!a || !d) {
675
- Jn(i);
682
+ no(i);
676
683
  return;
677
684
  }
678
- La(i, {
685
+ Ra(i, {
679
686
  x: a.x - d.x,
680
687
  y: a.y - d.y
681
688
  });
682
- }, Lt = () => {
683
- const a = et(c).width;
689
+ }, At = () => {
690
+ const a = nt(c).width;
684
691
  return t.layout === "page" && m.getBoundingClientRect().width || a;
685
- }, vn = () => {
692
+ }, kn = () => {
686
693
  if (i.classList.contains("pluno-pa-widget--minimized")) {
687
694
  Ae(
688
695
  i,
689
- qt(
696
+ Yt(
690
697
  i,
691
698
  s,
692
699
  t.position
@@ -694,16 +701,16 @@ async function ha(e = {}) {
694
701
  );
695
702
  return;
696
703
  }
697
- const a = je();
704
+ const a = Ke();
698
705
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
699
- Gt(i, c);
700
- const d = et(c);
701
- Yt(
702
- S,
703
- Lt()
706
+ Kt(i, c);
707
+ const d = nt(c);
708
+ Qt(
709
+ C,
710
+ At()
704
711
  );
705
- const _ = mt(
706
- h ?? jt(
712
+ const _ = _t(
713
+ h ?? Xt(
707
714
  i,
708
715
  a,
709
716
  t.position,
@@ -711,7 +718,7 @@ async function ha(e = {}) {
711
718
  ),
712
719
  d
713
720
  );
714
- h && (h = _), kt(_, a), Te(
721
+ h && (h = _), It(_, a), Te(
715
722
  "Applied open panel position after viewport resize",
716
723
  { openPanelPosition: _ }
717
724
  );
@@ -720,20 +727,20 @@ async function ha(e = {}) {
720
727
  { visibleLauncherPosition: a }
721
728
  );
722
729
  };
723
- let Cn = () => {
730
+ let Ln = () => {
724
731
  };
725
- window.addEventListener("resize", vn), t.movableLauncher && D ? (je(), Cn = _a({
732
+ window.addEventListener("resize", kn), t.movableLauncher && D ? (Ke(), Ln = Ea({
726
733
  root: i,
727
734
  launcher: I,
728
735
  launcherDragHandle: D,
729
- getPosition: () => Ge(),
736
+ getPosition: () => je(),
730
737
  setPosition: (a) => {
731
- const d = a, _ = bt(i), k = ln(
738
+ const d = a, _ = vt(i), k = cn(
732
739
  i,
733
740
  a,
734
741
  _
735
742
  );
736
- s = Sa(
743
+ s = Ia(
737
744
  k,
738
745
  _
739
746
  ), Ae(i, k), Te("Dragging closed launcher", {
@@ -743,12 +750,12 @@ async function ha(e = {}) {
743
750
  persist: () => {
744
751
  g = !0, F(), Te("Persisted closed launcher drag position");
745
752
  }
746
- })) : Ae(i, null), Gt(i, c);
747
- const Zo = () => {
748
- const a = et(c), d = Ge();
753
+ })) : Ae(i, null), Kt(i, c);
754
+ const oi = () => {
755
+ const a = nt(c), d = je();
749
756
  return {
750
- position: mt(
751
- h ?? jt(
757
+ position: _t(
758
+ h ?? Xt(
752
759
  i,
753
760
  d,
754
761
  t.position,
@@ -758,76 +765,76 @@ async function ha(e = {}) {
758
765
  ),
759
766
  size: a
760
767
  };
761
- }, Jo = (a) => {
762
- c = xt(a.size), Gt(i, c), Yt(
763
- S,
764
- Lt()
765
- ), h = mt(
768
+ }, ii = (a) => {
769
+ c = Ct(a.size), Kt(i, c), Qt(
770
+ C,
771
+ At()
772
+ ), h = _t(
766
773
  a.position,
767
- et(c)
774
+ nt(c)
768
775
  );
769
- const d = Ge();
770
- kt(h, d);
771
- }, Qo = z.length > 0 ? xa({
776
+ const d = je();
777
+ It(h, d);
778
+ }, ai = z.length > 0 ? ka({
772
779
  root: i,
773
780
  handles: z,
774
- getBounds: Zo,
775
- setBounds: Jo,
781
+ getBounds: oi,
782
+ setBounds: ii,
776
783
  persist: F
777
784
  }) : () => {
778
785
  };
779
- let Tt = !1;
780
- const Sn = async () => {
781
- if (!(!t.billingStatusLoader || Tt)) {
782
- Tt = !0;
786
+ let Nt = !1;
787
+ const Tn = async () => {
788
+ if (!(!t.billingStatusLoader || Nt)) {
789
+ Nt = !0;
783
790
  try {
784
791
  const a = await t.billingStatusLoader();
785
- if (re)
792
+ if (V)
786
793
  return;
787
- oo(
794
+ lo(
788
795
  t.billingStatus,
789
796
  a,
790
797
  b.getState().lastErrorCode
791
- ) && (t.billingStatus = a, Zt(
798
+ ) && (t.billingStatus = a, tn(
792
799
  Re,
793
800
  t.billingStatus,
794
801
  b.getState().lastErrorCode
795
- ), $());
802
+ ), G());
796
803
  } catch (a) {
797
- K(
804
+ Y(
798
805
  "web-sdk.widget",
799
806
  "Failed to refresh billing status",
800
807
  { message: a instanceof Error ? a.message : String(a) }
801
808
  );
802
809
  } finally {
803
- Tt = !1;
810
+ Nt = !1;
804
811
  }
805
812
  }
806
813
  }, he = (a = "", d = !0) => {
807
- Sn(), Ye && (Ye = !1, At()), i.classList.contains("pluno-pa-widget--open") || (h = null), ee !== null && (window.clearTimeout(ee), ee = null), qe("shown", !1), m.hidden = !1, L.hidden = !1, Yt(
808
- S,
809
- Lt()
814
+ Tn(), Ze && (Ze = !1, zt()), i.classList.contains("pluno-pa-widget--open") || (h = null), te !== null && (window.clearTimeout(te), te = null), Ve("shown", !1), m.hidden = !1, L.hidden = !1, Qt(
815
+ C,
816
+ At()
810
817
  ), i.classList.remove("pluno-pa-widget--closing");
811
- const _ = je(), k = jt(
818
+ const _ = Ke(), k = Xt(
812
819
  i,
813
820
  _,
814
821
  t.position,
815
822
  c
816
823
  );
817
- if (kt(k, _), Te("Opening launcher at clamped open panel position", {
824
+ if (It(k, _), Te("Opening launcher at clamped open panel position", {
818
825
  openPanelPosition: k,
819
826
  visibleLauncherPosition: _
820
- }), te(!0, "open"), ne(), !d) {
821
- i.classList.add("pluno-pa-widget--open"), I.hidden = !0, a && (f.value = a, Qe(f)), tt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0);
827
+ }), ne(!0, "open"), oe(), !d) {
828
+ i.classList.add("pluno-pa-widget--open"), I.hidden = !0, a && (f.value = a, tt(f)), ot(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), pt("shown"), t.onPanelOpenChange?.(!0);
822
829
  return;
823
830
  }
824
831
  window.requestAnimationFrame(() => {
825
- i.classList.add("pluno-pa-widget--open"), a && (f.value = a, Qe(f)), tt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0), ee = window.setTimeout(() => {
826
- I.hidden = !0, tt(T, () => Ee.enabled), ke = T.scrollTop;
832
+ i.classList.add("pluno-pa-widget--open"), a && (f.value = a, tt(f)), ot(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), pt("shown"), t.onPanelOpenChange?.(!0), te = window.setTimeout(() => {
833
+ I.hidden = !0, ot(T, () => Ee.enabled), ke = T.scrollTop;
827
834
  }, 220);
828
835
  });
829
- }, Pt = () => {
830
- ee !== null && (window.clearTimeout(ee), ee = null), I.hidden = !1, s && (je(!1), Te("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), ee = window.setTimeout(() => {
836
+ }, Rt = () => {
837
+ te !== null && (window.clearTimeout(te), te = null), I.hidden = !1, s && (Ke(!1), Te("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), te = window.setTimeout(() => {
831
838
  m.hidden = !0, L.hidden = !0, h = null, i.classList.remove("pluno-pa-widget--closing");
832
839
  }, 220);
833
840
  };
@@ -845,21 +852,21 @@ async function ha(e = {}) {
845
852
  const a = u.value;
846
853
  he(a), u.value = "";
847
854
  });
848
- let It = null, lt = null, Pe = null;
849
- const En = (a) => a === u || a === f, ei = (a) => {
855
+ let Dt = null, st = null, Pe = null;
856
+ const Pn = (a) => a === u || a === f, ri = (a) => {
850
857
  if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
851
858
  return null;
852
859
  let d = a;
853
860
  for (; d; ) {
854
- const _ = d.closest(Wn);
861
+ const _ = d.closest(qn);
855
862
  if (_)
856
863
  return _;
857
864
  const k = d.getRootNode();
858
865
  d = k instanceof ShadowRoot ? k.host : null;
859
866
  }
860
867
  return null;
861
- }, ti = (a) => {
862
- if (!a.isConnected || !a.matches(Wn))
868
+ }, li = (a) => {
869
+ if (!a.isConnected || !a.matches(qn))
863
870
  return !1;
864
871
  if (!(a instanceof HTMLElement))
865
872
  return !0;
@@ -869,73 +876,73 @@ async function ha(e = {}) {
869
876
  return a.checkVisibility();
870
877
  const d = window.getComputedStyle(a);
871
878
  return d.display !== "none" && d.visibility !== "hidden";
872
- }, kn = (a) => {
873
- Ke !== a && (Ke = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ie(), a !== null ? Pe = window.setInterval(() => {
874
- const d = Ke;
875
- (!d || !ti(d)) && kn(null);
876
- }, Qi) : Pe !== null && (window.clearInterval(Pe), Pe = null, lt = null));
877
- }, ni = () => {
879
+ }, In = (a) => {
880
+ Xe !== a && (Xe = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ie(), a !== null ? Pe = window.setInterval(() => {
881
+ const d = Xe;
882
+ (!d || !li(d)) && In(null);
883
+ }, aa) : Pe !== null && (window.clearInterval(Pe), Pe = null, st = null));
884
+ }, pi = () => {
878
885
  Pe !== null && (window.clearInterval(Pe), Pe = null);
879
886
  };
880
887
  i.addEventListener("focusin", (a) => {
881
- En(a.target) && (It = Date.now(), F());
888
+ Pn(a.target) && (Dt = Date.now(), F());
882
889
  }), i.addEventListener("focusout", (a) => {
883
- if (!En(a.target) || Ke !== null)
890
+ if (!Pn(a.target) || Xe !== null)
884
891
  return;
885
- const d = It;
886
- if (It = null, d === null || Date.now() - d > Zi)
892
+ const d = Dt;
893
+ if (Dt = null, d === null || Date.now() - d > oa)
887
894
  return;
888
- const _ = ei(a.relatedTarget);
895
+ const _ = ri(a.relatedTarget);
889
896
  if (!_)
890
897
  return;
891
898
  const k = Date.now();
892
- if (lt !== null && k - lt <= Ji) {
893
- kn(_);
899
+ if (st !== null && k - st <= ia) {
900
+ In(_);
894
901
  return;
895
902
  }
896
- lt = k;
903
+ st = k;
897
904
  }), I.addEventListener("keydown", (a) => {
898
905
  !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), he());
899
906
  }), v?.addEventListener("pointerdown", (a) => {
900
907
  a.stopPropagation();
901
908
  }), v?.addEventListener("click", (a) => {
902
- a.preventDefault(), a.stopPropagation(), qe("minimized");
903
- }), L.addEventListener("click", Pt), T.addEventListener("scroll", () => {
904
- T.scrollTop < ke - 1 && te(!1, "userScroll"), ke = T.scrollTop;
909
+ a.preventDefault(), a.stopPropagation(), Ve("minimized");
910
+ }), L.addEventListener("click", Rt), T.addEventListener("scroll", () => {
911
+ T.scrollTop < ke - 1 && ne(!1, "userScroll"), ke = T.scrollTop;
905
912
  }), x.addEventListener("click", () => {
906
- Yo();
913
+ ti();
907
914
  });
908
- const Ln = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
915
+ const An = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
909
916
  ([a]) => {
910
- a?.isIntersecting && (te(!0, "bottom"), ne());
917
+ a?.isIntersecting && (ne(!0, "bottom"), oe());
911
918
  },
912
919
  { root: T, threshold: 0 }
913
920
  );
914
- Ln?.observe(ae);
915
- const Ve = () => t.loginRequired || t.signupRequired;
916
- let Ke = null, Ye = !1;
917
- const V = () => at || b.getState().status !== "connected", Ie = () => {
918
- const a = Ve(), d = Ke !== null, _ = !a && V();
919
- u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ? Hn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ye ? "New update" : t.launcherLabel, f.placeholder = d ? Hn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, oe.hidden = a;
920
- }, $ = () => {
921
- Q.disabled = V() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled = Ve() || V() || de(t.billingStatus);
921
+ An?.observe(re);
922
+ const Ye = () => t.loginRequired || t.signupRequired;
923
+ let Xe = null, Ze = !1;
924
+ const K = () => lt || b.getState().status !== "connected", Ie = () => {
925
+ const a = Ye(), d = Xe !== null, _ = !a && K();
926
+ u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ? jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ze ? "New update" : t.launcherLabel, f.placeholder = d ? jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, ie.hidden = a;
927
+ }, G = () => {
928
+ ee.disabled = K() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled = Ye() || K() || de(t.billingStatus);
922
929
  };
923
930
  Ie();
924
- const At = () => {
931
+ const zt = () => {
925
932
  const a = b.getState().isThinking;
926
933
  i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
927
934
  "pluno-pa-widget--unread",
928
- !a && Ye
935
+ !a && Ze
929
936
  ), Ie();
930
937
  };
931
- At();
932
- const Nt = () => {
933
- Ve() || re || (at = !0, Ie(), $(), b.connect().then(
938
+ zt();
939
+ const Mt = () => {
940
+ Ye() || V || (lt = !0, Ie(), G(), b.connect().then(
934
941
  () => {
935
- re || (at = !1, Ie(), $());
942
+ V || (lt = !1, Ie(), G());
936
943
  },
937
944
  (a) => {
938
- re || (at = !1, Ie(), $(), K(
945
+ V || (lt = !1, Ie(), G(), Y(
939
946
  "web-sdk.widget",
940
947
  "Failed to connect Product Agent widget",
941
948
  {
@@ -945,7 +952,7 @@ async function ha(e = {}) {
945
952
  }
946
953
  ));
947
954
  };
948
- oe.addEventListener("submit", (a) => {
955
+ ie.addEventListener("submit", (a) => {
949
956
  if (a.preventDefault(), t.loginRequired) {
950
957
  t.onLoginClick?.();
951
958
  return;
@@ -954,66 +961,66 @@ async function ha(e = {}) {
954
961
  t.onSignupClick?.();
955
962
  return;
956
963
  }
957
- V() || de(t.billingStatus) || (be = !0, te(!0, "send"), ne(), q = Kt(
964
+ K() || de(t.billingStatus) || (be = !0, ne(!0, "send"), oe(), q = Jt(
958
965
  b,
959
966
  f,
960
967
  q,
961
- ct
962
- ), ze(), $());
968
+ mt
969
+ ), Me(), G());
963
970
  });
964
- let Xe = 0;
965
- const oi = () => {
966
- Xe = 0, i.classList.remove("pluno-pa-widget--drag-over");
967
- }, Rt = (a) => {
968
- ue !== null && window.clearTimeout(ue), J.textContent = a, J.hidden = !1, ue = window.setTimeout(() => {
969
- J.textContent = "", J.hidden = !0, ue = null;
971
+ let Je = 0;
972
+ const si = () => {
973
+ Je = 0, i.classList.remove("pluno-pa-widget--drag-over");
974
+ }, Ot = (a) => {
975
+ ue !== null && window.clearTimeout(ue), Q.textContent = a, Q.hidden = !1, ue = window.setTimeout(() => {
976
+ Q.textContent = "", Q.hidden = !0, ue = null;
970
977
  }, 3e3);
971
- }, ii = () => {
972
- ue !== null && (window.clearTimeout(ue), ue = null), J.textContent = "", J.hidden = !0;
973
- }, Dt = async (a) => {
978
+ }, di = () => {
979
+ ue !== null && (window.clearTimeout(ue), ue = null), Q.textContent = "", Q.hidden = !0;
980
+ }, Ut = async (a) => {
974
981
  if (!t.attachmentsEnabled || a.length === 0)
975
982
  return;
976
- const d = ar(b, a);
977
- q = [...q, ...d], ze(), ii(), $(), W(b.getState()), i.classList.contains("pluno-pa-widget--open") || he();
983
+ const d = ur(b, a);
984
+ q = [...q, ...d], Me(), di(), G(), W(b.getState()), i.classList.contains("pluno-pa-widget--open") || he();
978
985
  };
979
986
  B.addEventListener("click", () => {
980
- t.loginRequired || V() || de(t.billingStatus) || we.click();
987
+ t.loginRequired || K() || de(t.billingStatus) || we.click();
981
988
  }), we.addEventListener("change", () => {
982
989
  const a = Array.from(we.files ?? []);
983
- we.value = "", Dt(a).catch((d) => {
984
- Rt(
990
+ we.value = "", Ut(a).catch((d) => {
991
+ Ot(
985
992
  d instanceof Error ? d.message : "Failed to attach file"
986
- ), K("web-sdk.widget", "Attachment failed", {
993
+ ), Y("web-sdk.widget", "Attachment failed", {
987
994
  message: d instanceof Error ? d.message : String(d)
988
995
  });
989
996
  });
990
997
  }), i.addEventListener("dragenter", (a) => {
991
- !t.attachmentsEnabled || !ut(a.dataTransfer) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), Xe += 1, i.classList.add("pluno-pa-widget--drag-over"));
998
+ !t.attachmentsEnabled || !ft(a.dataTransfer) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), Je += 1, i.classList.add("pluno-pa-widget--drag-over"));
992
999
  }), i.addEventListener("dragover", (a) => {
993
1000
  const d = a.dataTransfer;
994
- !t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
1001
+ !t.attachmentsEnabled || !ft(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
995
1002
  }), i.addEventListener("dragleave", (a) => {
996
- ut(a.dataTransfer) && (a.stopPropagation(), Xe = Math.max(0, Xe - 1), Xe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
1003
+ ft(a.dataTransfer) && (a.stopPropagation(), Je = Math.max(0, Je - 1), Je === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
997
1004
  }), i.addEventListener("drop", (a) => {
998
1005
  const d = a.dataTransfer;
999
- !t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), oi(), Dt(d.files).catch((_) => {
1000
- Rt(
1006
+ !t.attachmentsEnabled || !ft(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), si(), Ut(d.files).catch((_) => {
1007
+ Ot(
1001
1008
  _ instanceof Error ? _.message : "Failed to attach file"
1002
- ), K("web-sdk.widget", "Attachment failed", {
1009
+ ), Y("web-sdk.widget", "Attachment failed", {
1003
1010
  message: _ instanceof Error ? _.message : String(_)
1004
1011
  });
1005
1012
  }));
1006
1013
  }), i.addEventListener("paste", (a) => {
1007
1014
  a.stopPropagation();
1008
1015
  const d = a.clipboardData, _ = Array.from(d?.files ?? []);
1009
- !t.attachmentsEnabled || _.length === 0 || t.loginRequired || V() || (a.preventDefault(), Dt(_).catch((k) => {
1010
- Rt(
1016
+ !t.attachmentsEnabled || _.length === 0 || t.loginRequired || K() || (a.preventDefault(), Ut(_).catch((k) => {
1017
+ Ot(
1011
1018
  k instanceof Error ? k.message : "Failed to attach file"
1012
- ), K("web-sdk.widget", "Attachment failed", {
1019
+ ), Y("web-sdk.widget", "Attachment failed", {
1013
1020
  message: k instanceof Error ? k.message : String(k)
1014
1021
  });
1015
1022
  }));
1016
- }), Q.addEventListener("click", () => {
1023
+ }), ee.addEventListener("click", () => {
1017
1024
  if (t.loginRequired) {
1018
1025
  t.onLoginClick?.();
1019
1026
  return;
@@ -1022,95 +1029,114 @@ async function ha(e = {}) {
1022
1029
  b.stop();
1023
1030
  return;
1024
1031
  }
1025
- V() || (be = !0, te(!0, "send"), ne(), q = Kt(
1032
+ K() || (be = !0, ne(!0, "send"), oe(), q = Jt(
1026
1033
  b,
1027
1034
  f,
1028
1035
  q,
1029
- ct
1030
- ), ze(), $(), W(b.getState()));
1031
- }), Ce.addEventListener("click", () => {
1032
- _e = !_e, $e = null, Le(), _e && xe.length === 0 && _n(null);
1033
- }), ot.addEventListener("click", () => {
1036
+ mt
1037
+ ), Me(), G(), W(b.getState()));
1038
+ }), Se.addEventListener("click", () => {
1039
+ _e = !_e, qe = null, Le(), _e && xe.length === 0 && Sn(null);
1040
+ }), at.addEventListener("click", () => {
1034
1041
  _e = !1, Le();
1035
- }), j.addEventListener("scroll", Xo), f.addEventListener("input", () => {
1036
- Qe(f), F(), $(), li();
1042
+ }), j.addEventListener("scroll", ni), f.addEventListener("input", () => {
1043
+ tt(f), F(), G(), gi();
1037
1044
  }), f.addEventListener("keydown", (a) => {
1038
1045
  if (!(a.key !== "Enter" || a.shiftKey)) {
1039
1046
  if (a.preventDefault(), t.loginRequired) {
1040
1047
  t.onLoginClick?.();
1041
1048
  return;
1042
1049
  }
1043
- V() || (be = !0, te(!0, "send"), ne(), q = Kt(
1050
+ K() || (be = !0, ne(!0, "send"), oe(), q = Jt(
1044
1051
  b,
1045
1052
  f,
1046
1053
  q,
1047
- ct
1048
- ), ze(), $(), W(b.getState()));
1054
+ mt
1055
+ ), Me(), G(), W(b.getState()));
1049
1056
  }
1050
1057
  }), i.addEventListener("click", (a) => {
1051
1058
  (a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
1052
- }), l.composerValue && (f.value = l.composerValue, Qe(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ? qe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(f.value, !1), Ia(l, i, u, f);
1053
- const pt = () => r;
1054
- let zt = b.getState().appearance !== null, st = null, Ze = null, Oe = null, Tn = b.getState().isThinking, Ue = null;
1055
- const Je = t.taskNotifications;
1056
- let Be = null, Fe = !1;
1057
- const Pn = () => {
1058
- Be !== null && (window.clearTimeout(Be), Be = null);
1059
- }, dt = () => {
1059
+ }), l.composerValue && (f.value = l.composerValue, tt(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ? Ve("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(f.value, !1), Ma(l, i, u, f);
1060
+ const dt = () => r;
1061
+ let Bt = b.getState().appearance !== null, ct = null, Qe = null, Ue = null, Nn = b.getState().isThinking, Be = null;
1062
+ const et = t.taskNotifications;
1063
+ let Fe = null, We = !1;
1064
+ const Rn = () => {
1065
+ Fe !== null && (window.clearTimeout(Fe), Fe = null);
1066
+ }, ut = () => {
1060
1067
  H && (H.hidden = !0);
1061
- }, In = () => b.getState().assistantDraft.trim().length > 0, ai = async () => {
1062
- if (!Je || !H || Fe || re || !b.getState().isThinking || In())
1068
+ }, Dn = () => b.getState().assistantDraft.trim().length > 0, ci = async () => {
1069
+ if (!et || !H || We || V || !b.getState().isThinking || Dn())
1063
1070
  return;
1064
1071
  let a;
1065
1072
  try {
1066
- a = await Je.getState();
1073
+ a = await et.getState();
1067
1074
  } catch {
1068
1075
  return;
1069
1076
  }
1070
- a.enabled || a.neverSuggest || !b.getState().isThinking || In() || Fe || re || (H.hidden = !1);
1077
+ a.enabled || a.neverSuggest || !b.getState().isThinking || Dn() || We || V || (H.hidden = !1);
1071
1078
  };
1072
1079
  y?.addEventListener("click", () => {
1073
- Fe = !0, dt(), Je?.enable().catch(() => {
1080
+ We = !0, ut(), et?.enable().catch(() => {
1074
1081
  });
1075
1082
  }), A?.addEventListener("click", () => {
1076
- Fe = !0, dt();
1077
- }), jo?.addEventListener("click", () => {
1078
- Fe = !0, dt(), Je?.dismissForever().catch(() => {
1083
+ We = !0, ut();
1084
+ }), Xo?.addEventListener("click", () => {
1085
+ We = !0, ut(), et?.dismissForever().catch(() => {
1079
1086
  });
1080
1087
  });
1081
- let We = null, An = () => {
1088
+ const gt = t.tabGroups;
1089
+ let He = !1;
1090
+ const ht = async () => {
1091
+ if (!gt || !ze || He || V)
1092
+ return;
1093
+ const a = await gt.getState().catch(() => null);
1094
+ !a || He || V || (ze.hidden = !a.permissionNeeded);
1095
+ };
1096
+ Zo?.addEventListener("click", () => {
1097
+ He = !0, ze && (ze.hidden = !0), gt?.enable().catch(() => {
1098
+ }).finally(() => {
1099
+ He = !1, ht();
1100
+ });
1101
+ }), Jo?.addEventListener("click", () => {
1102
+ He = !0, ze && (ze.hidden = !0), gt?.dismiss().catch(() => {
1103
+ }).finally(() => {
1104
+ He = !1, ht();
1105
+ });
1106
+ }), ht();
1107
+ let Ge = null, zn = () => {
1082
1108
  };
1083
- const ri = !!t.socialPostDraftHandler, Mt = /* @__PURE__ */ new Map(), Ot = () => f.value.trim().length > 0 || q.length > 0, li = () => {
1084
- const a = We !== null && Jt(b.getState(), Ot());
1085
- R.hidden = !a, a && We !== null && Ao(R, We);
1109
+ const ui = !!t.socialPostDraftHandler, Ft = /* @__PURE__ */ new Map(), Wt = () => f.value.trim().length > 0 || q.length > 0, gi = () => {
1110
+ const a = Ge !== null && nn(b.getState(), Wt());
1111
+ R.hidden = !a, a && Ge !== null && zo(R, Ge);
1086
1112
  };
1087
- let He = null;
1088
- const Ut = (a = {}) => {
1089
- be = !0, te(!0, "newSession"), ne(), _e = !1, Le(), b.startNewSession(a), Ct.clear(), f.value = "", q = [], ze(), Qe(f), F(), $(), f.focus(), W(b.getState());
1090
- }, ct = () => {
1091
- t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Ut());
1092
- }, Bt = (a) => {
1113
+ let $e = null;
1114
+ const Ht = (a = {}) => {
1115
+ be = !0, ne(!0, "newSession"), oe(), _e = !1, Le(), b.startNewSession(a), Lt.clear(), f.value = "", q = [], Me(), tt(f), F(), G(), f.focus(), W(b.getState());
1116
+ }, mt = () => {
1117
+ t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Ht());
1118
+ }, Gt = (a) => {
1093
1119
  if (!a || t.layout === "page") {
1094
- He?.remove(), He = null;
1120
+ $e?.remove(), $e = null;
1095
1121
  return;
1096
1122
  }
1097
- He || (He = yt(
1123
+ $e || ($e = Et(
1098
1124
  "pluno-pa-widget__new-chat",
1099
1125
  "New chat",
1100
- Ka(),
1126
+ tr(),
1101
1127
  !1
1102
- ), He.addEventListener("click", () => Ut()), De.insertBefore(He, Ce));
1128
+ ), $e.addEventListener("click", () => Ht()), De.insertBefore($e, Se));
1103
1129
  }, W = (a) => {
1104
- if (Le(), mn(a.lastErrorCode) ? Ue = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Zt(
1130
+ if (Le(), _n(a.lastErrorCode) ? Be = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Be = null), tn(
1105
1131
  Re,
1106
1132
  t.billingStatus,
1107
- Ue
1133
+ Be
1108
1134
  ), t.loginRequired) {
1109
- Mt.clear(), lo(
1135
+ Ft.clear(), uo(
1110
1136
  T,
1111
- Q,
1112
- Bt,
1113
- pt,
1137
+ ee,
1138
+ Gt,
1139
+ dt,
1114
1140
  "Log in to use Pluno on this page.",
1115
1141
  t.loginButtonLabel,
1116
1142
  t.loginUrl,
@@ -1119,11 +1145,11 @@ async function ha(e = {}) {
1119
1145
  return;
1120
1146
  }
1121
1147
  if (t.signupRequired) {
1122
- Mt.clear(), lo(
1148
+ Ft.clear(), uo(
1123
1149
  T,
1124
- Q,
1125
- Bt,
1126
- pt,
1150
+ ee,
1151
+ Gt,
1152
+ dt,
1127
1153
  "Complete signup to unlock your free trial credits.",
1128
1154
  t.signupButtonLabel,
1129
1155
  t.signupUrl,
@@ -1131,75 +1157,76 @@ async function ha(e = {}) {
1131
1157
  );
1132
1158
  return;
1133
1159
  }
1134
- const d = Na(a), _ = d !== bn;
1135
- bn = d;
1160
+ const d = Ua(a), _ = d !== vn;
1161
+ vn = d;
1136
1162
  const k = be || Ee.enabled;
1137
- be = !1, ur(
1163
+ be = !1, _r(
1138
1164
  T,
1139
- ae,
1140
- Q,
1141
- Bt,
1165
+ re,
1166
+ ee,
1167
+ Gt,
1142
1168
  R,
1143
1169
  a,
1144
- We,
1145
- We !== null && Jt(a, Ot()),
1170
+ Ge,
1171
+ Ge !== null && nn(a, Wt()),
1146
1172
  k,
1147
1173
  () => Ee.enabled,
1148
- Ct,
1149
- Mt,
1174
+ Lt,
1175
+ Ft,
1150
1176
  F,
1151
- pt,
1177
+ dt,
1152
1178
  (M) => {
1153
- V() || (ct(), be = !0, te(!0, "send"), ne(), b.sendMessage(M));
1179
+ K() || (mt(), be = !0, ne(!0, "send"), oe(), b.sendMessage(M));
1154
1180
  },
1155
1181
  () => {
1156
- be = !0, te(!0, "send"), ne(), b.retryLastMessage();
1182
+ be = !0, ne(!0, "send"), oe(), b.retryLastMessage();
1157
1183
  },
1158
1184
  t.morningReport,
1159
1185
  () => {
1160
- t.morningReport = null, t.onMorningReportSnooze?.(), Pt(), W(b.getState());
1186
+ t.morningReport = null, t.onMorningReportSnooze?.(), Rt(), W(b.getState());
1161
1187
  },
1162
- Nt,
1163
- ri && !St ? {
1164
- dismissedCandidateIds: it,
1165
- draftingCandidateId: st,
1166
- error: Ze,
1167
- characterIconOptions: pt(),
1188
+ Mt,
1189
+ ui && !Tt ? {
1190
+ dismissedCandidateIds: rt,
1191
+ draftingCandidateId: ct,
1192
+ error: Qe,
1193
+ characterIconOptions: dt(),
1168
1194
  onSeen: (M) => {
1169
- Me.add(M.id), F();
1195
+ Oe.add(M.id), F();
1170
1196
  },
1171
1197
  onDraft: (M) => {
1172
- pi(M);
1198
+ hi(M);
1173
1199
  },
1174
1200
  onDismiss: (M) => {
1175
- Me.add(M.id), it.add(M.id), F(), Ze = null, W(b.getState());
1201
+ Oe.add(M.id), rt.add(M.id), F(), Qe = null, W(b.getState());
1176
1202
  },
1177
1203
  onDisable: (M) => {
1178
- St = !0, Me.add(M.id), it.add(M.id), F(), Mr(t, !0), Ze = null, W(b.getState());
1204
+ Tt = !0, Oe.add(M.id), rt.add(M.id), F(), Gr(t, !0), Qe = null, W(b.getState());
1179
1205
  }
1180
1206
  } : void 0
1181
- ), k ? (ke = T.scrollTop, ne()) : _ && Ra(a) && Ko();
1207
+ ), k ? (ke = T.scrollTop, oe()) : _ && Ba(a) && ei();
1182
1208
  };
1183
- return An = Li(
1209
+ return zn = Ri(
1184
1210
  (a) => {
1185
- We = a, !re && Jt(b.getState(), Ot()) && W(b.getState());
1211
+ Ge = a, !V && nn(b.getState(), Wt()) && W(b.getState());
1186
1212
  },
1187
1213
  {
1188
1214
  backendUrl: t.backendUrl,
1189
- fetcher: Vo,
1215
+ fetcher: Qo,
1190
1216
  loader: t.activeUsersLoader
1191
1217
  }
1192
1218
  ), b.on("state", (a) => {
1193
- const d = Tn && !a.isThinking;
1194
- Tn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Je && !Fe && Be === null && H?.hidden !== !1 && (Be = window.setTimeout(() => {
1195
- Be = null, ai();
1196
- }, Mi)), (!a.isThinking || a.assistantDraft.trim()) && (Pn(), dt()), d && !i.classList.contains("pluno-pa-widget--open") && (Ye = !0), At(), a.appearance ? (zt = !0, K(
1219
+ ht();
1220
+ const d = Nn && !a.isThinking;
1221
+ Nn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && et && !We && Fe === null && H?.hidden !== !1 && (Fe = window.setTimeout(() => {
1222
+ Fe = null, ci();
1223
+ }, Hi)), (!a.isThinking || a.assistantDraft.trim()) && (Rn(), ut()), d && !i.classList.contains("pluno-pa-widget--open") && (Ze = !0), zt(), a.appearance ? (Bt = !0, Y(
1197
1224
  "web-sdk.widget",
1198
1225
  "Agent state supplied appearance",
1199
1226
  {
1200
1227
  appearance: a.appearance
1201
1228
  }
1202
- ), Ft(a.appearance, "agent.state.appearance")) : zt && (zt = !1, K(
1229
+ ), $t(a.appearance, "agent.state.appearance")) : Bt && (Bt = !1, Y(
1203
1230
  "web-sdk.widget",
1204
1231
  "Agent state cleared appearance; reverting to configured widget options",
1205
1232
  {
@@ -1207,99 +1234,99 @@ async function ha(e = {}) {
1207
1234
  fallbackColorScheme: t.colorScheme,
1208
1235
  fallbackFontFamily: t.fontFamily
1209
1236
  }
1210
- ), Ft({}, "agent.state.appearance-cleared")), W(a), $(), d && Sn();
1211
- }), W(b.getState()), $(), Nt(), {
1237
+ ), $t({}, "agent.state.appearance-cleared")), W(a), G(), d && Tn();
1238
+ }), W(b.getState()), G(), Mt(), {
1212
1239
  agent: b,
1213
- startNewChat: Ut,
1240
+ startNewChat: Ht,
1214
1241
  host: n,
1215
1242
  updateAppearance: (a) => {
1216
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Ft(a, "widgetHandle.updateAppearance");
1243
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), $t(a, "widgetHandle.updateAppearance");
1217
1244
  },
1218
1245
  updateBillingStatus: (a) => {
1219
1246
  const d = a ?? null;
1220
- oo(
1247
+ lo(
1221
1248
  t.billingStatus,
1222
1249
  d,
1223
- Ue
1224
- ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Zt(
1250
+ Be
1251
+ ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Be = null), tn(
1225
1252
  i.querySelector(".pluno-pa-widget__billing-status"),
1226
1253
  t.billingStatus,
1227
- Ue
1228
- ), $());
1254
+ Be
1255
+ ), G());
1229
1256
  },
1230
1257
  updateAuthGate: (a) => {
1231
- const d = Ve();
1232
- 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), Ie(), W(b.getState()), $(), d && !Ve() && Nt();
1258
+ const d = Ye();
1259
+ 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), Ie(), W(b.getState()), G(), d && !Ye() && Mt();
1233
1260
  },
1234
1261
  openPanel: () => {
1235
1262
  he(f.value, !1);
1236
1263
  },
1237
- closePanel: Pt,
1264
+ closePanel: Rt,
1238
1265
  updateDisplayState: (a) => {
1239
1266
  if (a === "shown") {
1240
- qe("shown", !1);
1267
+ Ve("shown", !1);
1241
1268
  return;
1242
1269
  }
1243
- qe("minimized", !1);
1270
+ Ve("minimized", !1);
1244
1271
  },
1245
1272
  updateMorningReport: (a) => {
1246
1273
  t.morningReport = a ?? null, W(b.getState());
1247
1274
  },
1248
1275
  destroy: () => {
1249
- re || (F(), re = !0, yn.disconnect(), Ln?.disconnect(), ni(), window.removeEventListener("resize", vn), Cn(), Qo(), ue !== null && window.clearTimeout(ue), Pn(), An(), Oe?.remove(), b.destroy(), vt.release(), n.remove());
1276
+ V || (F(), V = !0, En.disconnect(), An?.disconnect(), pi(), window.removeEventListener("resize", kn), Ln(), ai(), ue !== null && window.clearTimeout(ue), Rn(), zn(), Ue?.remove(), b.destroy(), kt.release(), n.remove());
1250
1277
  }
1251
1278
  };
1252
- async function pi(a) {
1253
- if (!st) {
1254
- st = a.id, Ze = null, W(b.getState());
1279
+ async function hi(a) {
1280
+ if (!ct) {
1281
+ ct = a.id, Qe = null, W(b.getState());
1255
1282
  try {
1256
1283
  if (!t.socialPostDraftHandler)
1257
1284
  throw new Error("Social post drafting is not available here.");
1258
1285
  const d = await t.socialPostDraftHandler(a);
1259
1286
  if (!d.linkedinPost || !d.xPost)
1260
1287
  throw new Error("Pluno did not return a complete social post draft.");
1261
- Me.add(a.id), it.add(a.id), F(), Oe?.remove(), Oe = xr(d, {
1288
+ Oe.add(a.id), rt.add(a.id), F(), Ue?.remove(), Ue = Lr(d, {
1262
1289
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1263
1290
  onClose: () => {
1264
- Oe?.remove(), Oe = null;
1291
+ Ue?.remove(), Ue = null;
1265
1292
  }
1266
- }), i.appendChild(Oe);
1293
+ }), i.appendChild(Ue);
1267
1294
  } catch (d) {
1268
- Ze = d instanceof Error ? d.message : "Could not draft social post.";
1295
+ Qe = d instanceof Error ? d.message : "Could not draft social post.";
1269
1296
  } finally {
1270
- st = null, W(b.getState());
1297
+ ct = null, W(b.getState());
1271
1298
  }
1272
1299
  }
1273
1300
  }
1274
- function Ft(a, d) {
1275
- const _ = a.accentColor ?? t.accentColor, k = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, Wt = a.scribbleStyle ?? t.scribbleStyle;
1276
- r = Vn(
1301
+ function $t(a, d) {
1302
+ const _ = a.accentColor ?? t.accentColor, k = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, qt = a.scribbleStyle ?? t.scribbleStyle;
1303
+ r = Zn(
1277
1304
  _,
1278
- Wt
1279
- ), Kn(i, r, {
1305
+ qt
1306
+ ), Jn(i, r, {
1280
1307
  accentColor: _,
1281
1308
  colorScheme: k,
1282
1309
  fontFamily: M,
1283
- scribbleStyle: Wt
1284
- }), K("web-sdk.widget", "Updated widget appearance", {
1310
+ scribbleStyle: qt
1311
+ }), Y("web-sdk.widget", "Updated widget appearance", {
1285
1312
  source: d,
1286
1313
  inputAppearance: a,
1287
1314
  appliedAccentColor: _,
1288
1315
  appliedColorScheme: k,
1289
1316
  appliedFontFamily: M,
1290
- appliedScribbleStyle: Wt,
1317
+ appliedScribbleStyle: qt,
1291
1318
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1292
1319
  });
1293
1320
  }
1294
1321
  }
1295
- function Vn(e, t) {
1322
+ function Zn(e, t) {
1296
1323
  return { accentColor: e, scribbleStyle: t };
1297
1324
  }
1298
- function ma(e) {
1299
- const t = fa(e);
1300
- return t === null ? "#fafafa" : wa(t) > 0.5 ? "#18181b" : "#fafaf9";
1325
+ function ya(e) {
1326
+ const t = va(e);
1327
+ return t === null ? "#fafafa" : Sa(t) > 0.5 ? "#18181b" : "#fafaf9";
1301
1328
  }
1302
- function fa(e) {
1329
+ function va(e) {
1303
1330
  const t = e.trim();
1304
1331
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1305
1332
  Number.parseInt(t.slice(1, 3), 16),
@@ -1311,14 +1338,14 @@ function fa(e) {
1311
1338
  Number.parseInt(t[3] + t[3], 16)
1312
1339
  ] : null;
1313
1340
  }
1314
- function wa([e, t, n]) {
1341
+ function Sa([e, t, n]) {
1315
1342
  const o = (i) => {
1316
1343
  const r = i / 255;
1317
1344
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1318
1345
  };
1319
1346
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1320
1347
  }
1321
- function Kn(e, t, n) {
1348
+ function Jn(e, t, n) {
1322
1349
  e.classList.toggle(
1323
1350
  "pluno-pa-widget--dark",
1324
1351
  n.colorScheme === "dark"
@@ -1326,11 +1353,11 @@ function Kn(e, t, n) {
1326
1353
  "pluno-pa-widget--light",
1327
1354
  n.colorScheme !== "dark"
1328
1355
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1329
- const o = n.scribbleStyle ? fo(n.accentColor) : n.accentColor;
1356
+ const o = n.scribbleStyle ? xo(n.accentColor) : n.accentColor;
1330
1357
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1331
1358
  "--pluno-pa-accent-contrast",
1332
- ma(o)
1333
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ta : n.fontFamily, n.scribbleStyle && ba(e.ownerDocument);
1359
+ ya(o)
1360
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? la : n.fontFamily, n.scribbleStyle && Ca(e.ownerDocument);
1334
1361
  const i = Array.from(
1335
1362
  e.querySelectorAll(".pluno-pa-widget__character")
1336
1363
  );
@@ -1342,11 +1369,11 @@ function Kn(e, t, n) {
1342
1369
  )
1343
1370
  );
1344
1371
  }
1345
- function ba(e) {
1346
- if (e.getElementById($n))
1372
+ function Ca(e) {
1373
+ if (e.getElementById(Vn))
1347
1374
  return;
1348
1375
  const t = e.createElement("style");
1349
- t.id = $n, t.textContent = `@font-face {
1376
+ t.id = Vn, t.textContent = `@font-face {
1350
1377
  font-family: "Architects Daughter";
1351
1378
  font-style: normal;
1352
1379
  font-weight: 400;
@@ -1354,7 +1381,7 @@ function ba(e) {
1354
1381
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1355
1382
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1356
1383
  }
1357
- function _a({
1384
+ function Ea({
1358
1385
  root: e,
1359
1386
  launcher: t,
1360
1387
  launcherDragHandle: n,
@@ -1365,14 +1392,14 @@ function _a({
1365
1392
  let l = null, p = null, s = null, g = !1, c = null;
1366
1393
  const h = () => {
1367
1394
  l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
1368
- }, C = (m) => {
1395
+ }, S = (m) => {
1369
1396
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, p = { x: m.clientX, y: m.clientY }, s = o(), g = !1, t.setPointerCapture?.(m.pointerId));
1370
1397
  }, P = (m) => {
1371
1398
  if (l !== m.pointerId || !p || !s)
1372
1399
  return;
1373
1400
  m.preventDefault();
1374
- const S = m.clientX - p.x, z = m.clientY - p.y;
1375
- !g && Math.hypot(S, z) < rn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + S, y: s.y + z }));
1401
+ const C = m.clientX - p.x, z = m.clientY - p.y;
1402
+ !g && Math.hypot(C, z) < dn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + C, y: s.y + z }));
1376
1403
  }, I = (m) => {
1377
1404
  l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
1378
1405
  }, D = (m) => {
@@ -1380,23 +1407,23 @@ function _a({
1380
1407
  }, u = (m) => {
1381
1408
  if (!c)
1382
1409
  return;
1383
- const S = Math.hypot(
1410
+ const C = Math.hypot(
1384
1411
  m.clientX - c.x,
1385
1412
  m.clientY - c.y
1386
- ) <= rn;
1387
- c = null, S && (m.preventDefault(), m.stopPropagation());
1413
+ ) <= dn;
1414
+ c = null, C && (m.preventDefault(), m.stopPropagation());
1388
1415
  }, v = (m) => {
1389
1416
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1390
1417
  return;
1391
- const S = m.shiftKey ? ko : Eo, z = o();
1418
+ const C = m.shiftKey ? Io : Po, z = o();
1392
1419
  let L = null;
1393
- m.key === "ArrowUp" ? L = { x: z.x, y: z.y - S } : m.key === "ArrowDown" ? L = { x: z.x, y: z.y + S } : m.key === "ArrowLeft" ? L = { x: z.x - S, y: z.y } : m.key === "ArrowRight" && (L = { x: z.x + S, y: z.y }), L && (m.preventDefault(), m.stopPropagation(), i(L), r());
1420
+ m.key === "ArrowUp" ? L = { x: z.x, y: z.y - C } : m.key === "ArrowDown" ? L = { x: z.x, y: z.y + C } : m.key === "ArrowLeft" ? L = { x: z.x - C, y: z.y } : m.key === "ArrowRight" && (L = { x: z.x + C, y: z.y }), L && (m.preventDefault(), m.stopPropagation(), i(L), r());
1394
1421
  };
1395
- return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", P), t.addEventListener("pointerup", I), t.addEventListener("pointercancel", D), t.addEventListener("click", u, !0), n.addEventListener("keydown", v), () => {
1396
- t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", I), t.removeEventListener("pointercancel", D), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", v);
1422
+ return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", P), t.addEventListener("pointerup", I), t.addEventListener("pointercancel", D), t.addEventListener("click", u, !0), n.addEventListener("keydown", v), () => {
1423
+ t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", I), t.removeEventListener("pointercancel", D), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", v);
1397
1424
  };
1398
1425
  }
1399
- function xa({
1426
+ function ka({
1400
1427
  root: e,
1401
1428
  handles: t,
1402
1429
  getBounds: n,
@@ -1408,36 +1435,36 @@ function xa({
1408
1435
  r = null, l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
1409
1436
  }, h = (u) => {
1410
1437
  const v = u.currentTarget, m = v.dataset.resizeDirection;
1411
- !e.classList.contains("pluno-pa-widget--open") || !Yn(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, v.setPointerCapture?.(u.pointerId));
1412
- }, C = (u) => {
1438
+ !e.classList.contains("pluno-pa-widget--open") || !Qn(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, v.setPointerCapture?.(u.pointerId));
1439
+ }, S = (u) => {
1413
1440
  if (r !== u.pointerId || !l || !p || !s)
1414
1441
  return;
1415
1442
  u.preventDefault(), u.stopPropagation();
1416
1443
  const v = u.clientX - p.x, m = u.clientY - p.y;
1417
- !g && Math.hypot(v, m) < rn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1418
- Xn(s, l, v, m)
1444
+ !g && Math.hypot(v, m) < dn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1445
+ eo(s, l, v, m)
1419
1446
  ));
1420
1447
  }, P = (u) => {
1421
1448
  r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && i(), c());
1422
1449
  }, I = (u) => {
1423
1450
  r === u.pointerId && (u.preventDefault(), c());
1424
1451
  }, D = (u) => {
1425
- const m = u.currentTarget.dataset.resizeDirection, S = u.shiftKey ? ko : Eo, z = n();
1426
- let L = 0, oe = 0;
1427
- Yn(m) && (u.key === "ArrowLeft" ? L = -S : u.key === "ArrowRight" ? L = S : u.key === "ArrowUp" ? oe = -S : u.key === "ArrowDown" && (oe = S), !(L === 0 && oe === 0) && (u.preventDefault(), u.stopPropagation(), o(Xn(z, m, L, oe)), i()));
1452
+ const m = u.currentTarget.dataset.resizeDirection, C = u.shiftKey ? Io : Po, z = n();
1453
+ let L = 0, ie = 0;
1454
+ Qn(m) && (u.key === "ArrowLeft" ? L = -C : u.key === "ArrowRight" ? L = C : u.key === "ArrowUp" ? ie = -C : u.key === "ArrowDown" && (ie = C), !(L === 0 && ie === 0) && (u.preventDefault(), u.stopPropagation(), o(eo(z, m, L, ie)), i()));
1428
1455
  };
1429
1456
  for (const u of t)
1430
- u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", I), u.addEventListener("keydown", D);
1457
+ u.addEventListener("pointerdown", h), u.addEventListener("pointermove", S), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", I), u.addEventListener("keydown", D);
1431
1458
  return () => {
1432
1459
  for (const u of t)
1433
- u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", I), u.removeEventListener("keydown", D);
1460
+ u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", S), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", I), u.removeEventListener("keydown", D);
1434
1461
  };
1435
1462
  }
1436
- function Yn(e) {
1463
+ function Qn(e) {
1437
1464
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1438
1465
  }
1439
- function Xn(e, t, n, o) {
1440
- const i = Z(), r = Zn({
1466
+ function eo(e, t, n, o) {
1467
+ const i = J(), r = to({
1441
1468
  leading: e.position.x,
1442
1469
  length: e.size.width,
1443
1470
  delta: n,
@@ -1446,10 +1473,10 @@ function Xn(e, t, n, o) {
1446
1473
  minLeading: N,
1447
1474
  maxTrailing: i.width - N,
1448
1475
  minLength: Math.min(
1449
- un,
1476
+ fn,
1450
1477
  i.width - N * 2
1451
1478
  )
1452
- }), l = Zn({
1479
+ }), l = to({
1453
1480
  leading: e.position.y,
1454
1481
  length: e.size.height,
1455
1482
  delta: o,
@@ -1458,7 +1485,7 @@ function Xn(e, t, n, o) {
1458
1485
  minLeading: Ne,
1459
1486
  maxTrailing: i.height - N,
1460
1487
  minLength: Math.min(
1461
- gn,
1488
+ wn,
1462
1489
  i.height - Ne - N
1463
1490
  )
1464
1491
  });
@@ -1467,7 +1494,7 @@ function Xn(e, t, n, o) {
1467
1494
  size: { width: r.length, height: l.length }
1468
1495
  };
1469
1496
  }
1470
- function Zn({
1497
+ function to({
1471
1498
  leading: e,
1472
1499
  length: t,
1473
1500
  delta: n,
@@ -1481,10 +1508,10 @@ function Zn({
1481
1508
  if (o) {
1482
1509
  const g = e + n;
1483
1510
  if (g >= r) {
1484
- const h = X(g, r, s - p);
1511
+ const h = Z(g, r, s - p);
1485
1512
  return { leading: h, length: s - h };
1486
1513
  }
1487
- const c = X(
1514
+ const c = Z(
1488
1515
  s + r - g,
1489
1516
  s,
1490
1517
  l
@@ -1494,14 +1521,14 @@ function Zn({
1494
1521
  if (i) {
1495
1522
  const g = s + n;
1496
1523
  if (g <= l) {
1497
- const h = X(
1524
+ const h = Z(
1498
1525
  g,
1499
1526
  e + p,
1500
1527
  l
1501
1528
  );
1502
1529
  return { leading: e, length: h - e };
1503
1530
  }
1504
- const c = X(
1531
+ const c = Z(
1505
1532
  e - (g - l),
1506
1533
  r,
1507
1534
  e
@@ -1510,47 +1537,47 @@ function Zn({
1510
1537
  }
1511
1538
  return { leading: e, length: t };
1512
1539
  }
1513
- function bt(e, t = !0) {
1514
- const n = Z();
1540
+ function vt(e, t = !0) {
1541
+ const n = J();
1515
1542
  if (e.classList.contains("pluno-pa-widget--minimized"))
1516
- return { width: Gn, height: Gn };
1543
+ return { width: Kn, height: Kn };
1517
1544
  const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1518
1545
  return {
1519
- width: t && i && o.width > 0 ? o.width : Math.min(vo, n.width - 36),
1520
- height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? oa : Co
1546
+ width: t && i && o.width > 0 ? o.width : Math.min(ko, n.width - 36),
1547
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? sa : Lo
1521
1548
  };
1522
1549
  }
1523
- function ya() {
1524
- const e = Z();
1550
+ function La() {
1551
+ const e = J();
1525
1552
  return {
1526
1553
  width: Math.min(
1527
- X(
1528
- e.width * aa,
1529
- un,
1530
- ia
1554
+ Z(
1555
+ e.width * ca,
1556
+ fn,
1557
+ da
1531
1558
  ),
1532
1559
  e.width - N * 2
1533
1560
  ),
1534
1561
  height: Math.min(
1535
- X(
1536
- e.height * la,
1537
- gn,
1538
- ra
1562
+ Z(
1563
+ e.height * ga,
1564
+ wn,
1565
+ ua
1539
1566
  ),
1540
1567
  e.height - Ne - N
1541
1568
  )
1542
1569
  };
1543
1570
  }
1544
- function et(e = null) {
1545
- return e ? xt(e) : ya();
1571
+ function nt(e = null) {
1572
+ return e ? Ct(e) : La();
1546
1573
  }
1547
- function xt(e) {
1548
- const t = Z();
1574
+ function Ct(e) {
1575
+ const t = J();
1549
1576
  return {
1550
- width: X(
1577
+ width: Z(
1551
1578
  e.width,
1552
1579
  Math.min(
1553
- un,
1580
+ fn,
1554
1581
  t.width - N * 2
1555
1582
  ),
1556
1583
  Math.max(
@@ -1558,10 +1585,10 @@ function xt(e) {
1558
1585
  t.width - N * 2
1559
1586
  )
1560
1587
  ),
1561
- height: X(
1588
+ height: Z(
1562
1589
  e.height,
1563
1590
  Math.min(
1564
- gn,
1591
+ wn,
1565
1592
  t.height - Ne - N
1566
1593
  ),
1567
1594
  Math.max(
@@ -1571,46 +1598,46 @@ function xt(e) {
1571
1598
  )
1572
1599
  };
1573
1600
  }
1574
- function Gt(e, t) {
1601
+ function Kt(e, t) {
1575
1602
  if (!t) {
1576
1603
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1577
1604
  return;
1578
1605
  }
1579
- const n = xt(t);
1606
+ const n = Ct(t);
1580
1607
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1581
1608
  }
1582
- function va(e, t, n) {
1609
+ function Ta(e, t, n) {
1583
1610
  const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1584
1611
  if (Number.isFinite(o) && Number.isFinite(i))
1585
1612
  return { x: o, y: i };
1586
1613
  const r = e.getBoundingClientRect();
1587
1614
  if (r.width > 0 || r.height > 0)
1588
1615
  return { x: r.left, y: r.top };
1589
- const l = Z();
1616
+ const l = J();
1590
1617
  return {
1591
1618
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1592
1619
  y: l.height - 24 - n.height
1593
1620
  };
1594
1621
  }
1595
- function qt(e, t, n) {
1596
- const o = bt(e, !1);
1597
- return t ? ln(
1622
+ function Yt(e, t, n) {
1623
+ const o = vt(e, !1);
1624
+ return t ? cn(
1598
1625
  e,
1599
- Po(t, o),
1626
+ Ro(t, o),
1600
1627
  o
1601
- ) : Ca(n === "bottom-left" ? "bottom-left" : "bottom-right", o, na);
1628
+ ) : Pa(n === "bottom-left" ? "bottom-left" : "bottom-right", o, pa);
1602
1629
  }
1603
- function Ca(e, t, n) {
1604
- const o = Z();
1630
+ function Pa(e, t, n) {
1631
+ const o = J();
1605
1632
  return {
1606
1633
  x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1607
1634
  y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1608
1635
  };
1609
1636
  }
1610
- function ln(e, t, n) {
1611
- const o = Z(), i = N + ka(e);
1637
+ function cn(e, t, n) {
1638
+ const o = J(), i = N + Na(e);
1612
1639
  return {
1613
- x: X(
1640
+ x: Z(
1614
1641
  t.x,
1615
1642
  N,
1616
1643
  Math.max(
@@ -1618,7 +1645,7 @@ function ln(e, t, n) {
1618
1645
  o.width - n.width - N
1619
1646
  )
1620
1647
  ),
1621
- y: X(
1648
+ y: Z(
1622
1649
  t.y,
1623
1650
  i,
1624
1651
  Math.max(
@@ -1628,39 +1655,39 @@ function ln(e, t, n) {
1628
1655
  )
1629
1656
  };
1630
1657
  }
1631
- function Po(e, t) {
1632
- const n = Z();
1658
+ function Ro(e, t) {
1659
+ const n = J();
1633
1660
  return {
1634
1661
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1635
1662
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1636
1663
  };
1637
1664
  }
1638
- function Sa(e, t) {
1639
- const n = Ea(e, t), o = Z();
1665
+ function Ia(e, t) {
1666
+ const n = Aa(e, t), o = J();
1640
1667
  return {
1641
1668
  anchor: n,
1642
1669
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1643
1670
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1644
1671
  };
1645
1672
  }
1646
- function Ea(e, t) {
1647
- 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";
1673
+ function Aa(e, t) {
1674
+ const n = J(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1648
1675
  return `${r}-${l}`;
1649
1676
  }
1650
- function ka(e) {
1651
- return e.classList.contains("pluno-pa-widget--scribble") ? ca : da;
1677
+ function Na(e) {
1678
+ return e.classList.contains("pluno-pa-widget--scribble") ? wa : fa;
1652
1679
  }
1653
- function jt(e, t, n, o = null) {
1654
- const i = bt(e), r = et(o), l = {
1680
+ function Xt(e, t, n, o = null) {
1681
+ const i = vt(e), r = nt(o), l = {
1655
1682
  x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1656
1683
  y: t.y + i.height - r.height
1657
1684
  };
1658
- return mt(l, r);
1685
+ return _t(l, r);
1659
1686
  }
1660
- function mt(e, t) {
1661
- const n = Z();
1687
+ function _t(e, t) {
1688
+ const n = J();
1662
1689
  return {
1663
- x: X(
1690
+ x: Z(
1664
1691
  e.x,
1665
1692
  N,
1666
1693
  Math.max(
@@ -1668,7 +1695,7 @@ function mt(e, t) {
1668
1695
  n.width - t.width - N
1669
1696
  )
1670
1697
  ),
1671
- y: X(
1698
+ y: Z(
1672
1699
  e.y,
1673
1700
  Ne,
1674
1701
  Math.max(
@@ -1685,19 +1712,19 @@ function Ae(e, t) {
1685
1712
  }
1686
1713
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1687
1714
  }
1688
- function La(e, t) {
1715
+ function Ra(e, t) {
1689
1716
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1690
1717
  }
1691
- function Jn(e) {
1718
+ function no(e) {
1692
1719
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1693
1720
  }
1694
- function Z() {
1721
+ function J() {
1695
1722
  return {
1696
- width: window.innerWidth || document.documentElement.clientWidth || vo + N * 2,
1697
- height: window.innerHeight || document.documentElement.clientHeight || Co + N * 2
1723
+ width: window.innerWidth || document.documentElement.clientWidth || ko + N * 2,
1724
+ height: window.innerHeight || document.documentElement.clientHeight || Lo + N * 2
1698
1725
  };
1699
1726
  }
1700
- function Vt(e) {
1727
+ function Zt(e) {
1701
1728
  const t = e.getBoundingClientRect();
1702
1729
  return {
1703
1730
  x: Math.round(t.x),
@@ -1706,10 +1733,10 @@ function Vt(e) {
1706
1733
  height: Math.round(t.height)
1707
1734
  };
1708
1735
  }
1709
- function X(e, t, n) {
1736
+ function Z(e, t, n) {
1710
1737
  return Math.min(Math.max(e, t), n);
1711
1738
  }
1712
- function K(e, t, n) {
1739
+ function Y(e, t, n) {
1713
1740
  if (typeof window > "u")
1714
1741
  return;
1715
1742
  const o = window, i = {
@@ -1719,44 +1746,44 @@ function K(e, t, n) {
1719
1746
  details: n
1720
1747
  }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1721
1748
  r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1722
- new CustomEvent(Yi, { detail: i })
1749
+ new CustomEvent(ta, { detail: i })
1723
1750
  );
1724
1751
  }
1725
- function Ta(e, t) {
1726
- K("web-sdk.widget.position", e, t);
1752
+ function Da(e, t) {
1753
+ Y("web-sdk.widget.position", e, t);
1727
1754
  }
1728
- function Kt(e, t, n, o) {
1755
+ function Jt(e, t, n, o) {
1729
1756
  const i = t.value.trim();
1730
1757
  return !i && n.length === 0 ? n : (o(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(i, {
1731
- attachments: n.length > 0 ? n.map(Aa) : void 0
1758
+ attachments: n.length > 0 ? n.map(Oa) : void 0
1732
1759
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1733
1760
  }
1734
- function Pa(e, t, n) {
1761
+ function za(e, t, n) {
1735
1762
  const o = e.activeElement;
1736
1763
  return o === n ? "composer" : o === t ? "launcher" : null;
1737
1764
  }
1738
- function Ia(e, t, n, o) {
1739
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Oi)
1765
+ function Ma(e, t, n, o) {
1766
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Gi)
1740
1767
  return;
1741
1768
  const i = e.focusedInput === "composer" ? o : n;
1742
1769
  i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1743
1770
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1744
1771
  });
1745
1772
  }
1746
- function Aa(e) {
1773
+ function Oa(e) {
1747
1774
  return e;
1748
1775
  }
1749
- function Qe(e) {
1776
+ function tt(e) {
1750
1777
  e.style.height = "0px";
1751
1778
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1752
1779
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1753
1780
  }
1754
- function tt(e, t = () => !0) {
1781
+ function ot(e, t = () => !0) {
1755
1782
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1756
1783
  t() && (e.scrollTop = e.scrollHeight);
1757
1784
  });
1758
1785
  }
1759
- function Na(e) {
1786
+ function Ua(e) {
1760
1787
  const t = e.messages[e.messages.length - 1];
1761
1788
  return [
1762
1789
  e.messages.length,
@@ -1767,13 +1794,13 @@ function Na(e) {
1767
1794
  e.lastError ?? ""
1768
1795
  ].join(":");
1769
1796
  }
1770
- function Ra(e) {
1797
+ function Ba(e) {
1771
1798
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1772
1799
  }
1773
- function Da(e) {
1800
+ function Fa(e) {
1774
1801
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1775
1802
  }
1776
- function za(e) {
1803
+ function Wa(e) {
1777
1804
  const t = e.currentPage;
1778
1805
  if (typeof t?.url == "string" && t.url.trim())
1779
1806
  try {
@@ -1784,7 +1811,7 @@ function za(e) {
1784
1811
  }
1785
1812
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1786
1813
  }
1787
- function Ma(e, t) {
1814
+ function Ha(e, t) {
1788
1815
  const n = new Date(e).getTime();
1789
1816
  if (!Number.isFinite(n))
1790
1817
  return "now";
@@ -1800,31 +1827,31 @@ function Ma(e, t) {
1800
1827
  }
1801
1828
  return "now";
1802
1829
  }
1803
- function Oa(e, t, n, o, i) {
1804
- e.appendChild(ja()), e.appendChild(
1805
- Ua(
1830
+ function Ga(e, t, n, o, i) {
1831
+ e.appendChild(Qa()), e.appendChild(
1832
+ $a(
1806
1833
  t,
1807
1834
  n,
1808
1835
  o,
1809
1836
  i
1810
1837
  )
1811
1838
  ), e.appendChild(
1812
- yt(
1839
+ Et(
1813
1840
  "pluno-pa-widget__close",
1814
1841
  "Close",
1815
- Va(16),
1842
+ er(16),
1816
1843
  !0
1817
1844
  )
1818
- ), e.appendChild(Ba(n));
1845
+ ), e.appendChild(qa(n));
1819
1846
  }
1820
- function Ua(e, t, n, o) {
1847
+ function $a(e, t, n, o) {
1821
1848
  const i = document.createElement("form");
1822
1849
  if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1823
1850
  const s = document.createElement("button");
1824
1851
  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);
1825
1852
  }
1826
1853
  i.appendChild(
1827
- Ro(
1854
+ Oo(
1828
1855
  "pluno-pa-widget__scribble-spirals--launcher",
1829
1856
  10
1830
1857
  )
@@ -1838,22 +1865,22 @@ function Ua(e, t, n, o) {
1838
1865
  r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1839
1866
  const l = document.createElement("input");
1840
1867
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1841
- const p = _t("Working...");
1868
+ const p = St("Working...");
1842
1869
  if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1843
1870
  const s = document.createElement("button");
1844
1871
  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);
1845
1872
  }
1846
1873
  return i;
1847
1874
  }
1848
- function Ba(e) {
1875
+ function qa(e) {
1849
1876
  const t = document.createElement("section");
1850
1877
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1851
- Ro("pluno-pa-widget__scribble-spirals--panel", 16)
1878
+ Oo("pluno-pa-widget__scribble-spirals--panel", 16)
1852
1879
  );
1853
1880
  const n = document.createElement("div");
1854
1881
  n.className = "pluno-pa-widget__timeline-wrap";
1855
1882
  const o = document.createElement("main");
1856
- o.className = "pluno-pa-widget__timeline", o.appendChild($a(e));
1883
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Xa(e));
1857
1884
  const i = document.createElement("div");
1858
1885
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1859
1886
  const r = document.createElement("div");
@@ -1862,13 +1889,13 @@ function Ba(e) {
1862
1889
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1863
1890
  const p = document.createElement("div");
1864
1891
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1865
- yt(
1892
+ Et(
1866
1893
  "pluno-pa-widget__history",
1867
- pn(),
1868
- Ya(),
1894
+ un(),
1895
+ nr(),
1869
1896
  !0
1870
1897
  )
1871
- ), n.appendChild(p), n.appendChild(Ha()), t.appendChild(n), t.appendChild(Fa()), t.appendChild(Wa()), t.appendChild(ye("left", "Resize Pluno from left")), t.appendChild(
1898
+ ), n.appendChild(p), n.appendChild(Ya()), t.appendChild(n), t.appendChild(ja()), t.appendChild(Va()), t.appendChild(Ka()), t.appendChild(ye("left", "Resize Pluno from left")), t.appendChild(
1872
1899
  ye("right", "Resize Pluno from right")
1873
1900
  ), t.appendChild(ye("top", "Resize Pluno from top")), t.appendChild(
1874
1901
  ye("bottom", "Resize Pluno from bottom")
@@ -1889,7 +1916,7 @@ function ye(e, t) {
1889
1916
  `pluno-pa-widget__resize-handle--${e}`
1890
1917
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1891
1918
  }
1892
- function Fa() {
1919
+ function ja() {
1893
1920
  const e = document.createElement("div");
1894
1921
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1895
1922
  const t = document.createElement("span");
@@ -1903,7 +1930,19 @@ function Fa() {
1903
1930
  const r = document.createElement("button");
1904
1931
  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;
1905
1932
  }
1906
- function Wa() {
1933
+ function Va() {
1934
+ const e = document.createElement("div");
1935
+ e.className = "pluno-pa-widget__notify-suggestion pluno-pa-widget__tab-groups-suggestion", e.hidden = !0;
1936
+ const t = document.createElement("span");
1937
+ t.className = "pluno-pa-widget__notify-suggestion-label", t.textContent = "Let Pluno group the tabs used by this task?";
1938
+ const n = document.createElement("div");
1939
+ n.className = "pluno-pa-widget__notify-suggestion-actions";
1940
+ const o = document.createElement("button");
1941
+ o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable pluno-pa-widget__tab-groups-suggestion-enable", o.textContent = "Enable grouping";
1942
+ const i = document.createElement("button");
1943
+ return i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later pluno-pa-widget__tab-groups-suggestion-dismiss", i.textContent = "Not now", n.append(o, i), e.append(t, n), e;
1944
+ }
1945
+ function Ka() {
1907
1946
  const e = document.createElement("form");
1908
1947
  e.className = "pluno-pa-widget__composer";
1909
1948
  const t = document.createElement("div");
@@ -1917,11 +1956,11 @@ function Wa() {
1917
1956
  const r = document.createElement("input");
1918
1957
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1919
1958
  const l = document.createElement("button");
1920
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Za()), l.appendChild(Ja()), i.appendChild(l);
1959
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ir()), l.appendChild(ar()), i.appendChild(l);
1921
1960
  const p = document.createElement("textarea");
1922
1961
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1923
1962
  const s = document.createElement("button");
1924
- s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(zo()), i.appendChild(s), e.appendChild(i);
1963
+ s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(Bo()), i.appendChild(s), e.appendChild(i);
1925
1964
  const g = document.createElement("div");
1926
1965
  g.className = "pluno-pa-widget__composer-meta";
1927
1966
  const c = document.createElement("a");
@@ -1929,20 +1968,20 @@ function Wa() {
1929
1968
  const h = document.createElement("span");
1930
1969
  return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", g.appendChild(h), e.appendChild(g), e;
1931
1970
  }
1932
- function pn() {
1971
+ function un() {
1933
1972
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1934
1973
  }
1935
- function Ha() {
1974
+ function Ya() {
1936
1975
  const e = document.createElement("section");
1937
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", pn());
1976
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", un());
1938
1977
  const t = document.createElement("div");
1939
1978
  t.className = "pluno-pa-widget__history-header";
1940
1979
  const n = document.createElement("strong");
1941
- n.textContent = pn();
1942
- const o = yt(
1980
+ n.textContent = un();
1981
+ const o = Et(
1943
1982
  "pluno-pa-widget__history-close",
1944
1983
  "Close recent chats",
1945
- Xa(),
1984
+ or(),
1946
1985
  !1
1947
1986
  );
1948
1987
  t.append(n, o);
@@ -1951,20 +1990,20 @@ function Ha() {
1951
1990
  const r = document.createElement("p");
1952
1991
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1953
1992
  }
1954
- function $a(e) {
1993
+ function Xa(e) {
1955
1994
  const t = document.createElement("div");
1956
1995
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1957
1996
  ve(
1958
1997
  "pluno-pa-widget__character--empty",
1959
1998
  e
1960
1999
  )
1961
- ), t.appendChild(Io()), t;
2000
+ ), t.appendChild(Do()), t;
1962
2001
  }
1963
- function Io() {
2002
+ function Do() {
1964
2003
  const e = document.createElement("div");
1965
2004
  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;
1966
2005
  }
1967
- function Ao(e, t) {
2006
+ function zo(e, t) {
1968
2007
  e.replaceChildren(), e.setAttribute(
1969
2008
  "aria-label",
1970
2009
  `${t.toLocaleString("en-US")} users currently active`
@@ -1977,16 +2016,16 @@ function Ao(e, t) {
1977
2016
  );
1978
2017
  }
1979
2018
  function ve(e, t) {
1980
- const n = `pluno-pa-character-${jn}`;
1981
- jn += 1;
1982
- const o = t.scribbleStyle ? qa(t.accentColor, n) : Ga(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
2019
+ const n = `pluno-pa-character-${Xn}`;
2020
+ Xn += 1;
2021
+ const o = t.scribbleStyle ? Ja(t.accentColor, n) : Za(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1983
2022
  return o.setAttribute(
1984
2023
  "class",
1985
2024
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1986
2025
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1987
2026
  }
1988
- function Ga(e, t) {
1989
- const n = gi(e), o = {
2027
+ function Za(e, t) {
2028
+ const n = _i(e), o = {
1990
2029
  boltFill: `${t}-boltFill`,
1991
2030
  boltEdge: `${t}-boltEdge`,
1992
2031
  boltGlow: `${t}-boltGlow`,
@@ -1997,7 +2036,7 @@ function Ga(e, t) {
1997
2036
  eyeShadow: `${t}-eyeShadow`,
1998
2037
  pupilGloss: `${t}-pupilGloss`,
1999
2038
  boltClip: `${t}-boltClip`
2000
- }, i = No(), r = w(i, "defs"), l = w(r, "linearGradient", {
2039
+ }, i = Mo(), r = w(i, "defs"), l = w(r, "linearGradient", {
2001
2040
  id: o.boltFill,
2002
2041
  x1: "420",
2003
2042
  y1: "180",
@@ -2051,7 +2090,7 @@ function Ga(e, t) {
2051
2090
  "flood-color": n.shadow,
2052
2091
  "flood-opacity": "0.24"
2053
2092
  });
2054
- const C = w(r, "filter", {
2093
+ const S = w(r, "filter", {
2055
2094
  id: o.innerDepth,
2056
2095
  x: "-8%",
2057
2096
  y: "-8%",
@@ -2059,27 +2098,27 @@ function Ga(e, t) {
2059
2098
  height: "116%",
2060
2099
  "color-interpolation-filters": "sRGB"
2061
2100
  });
2062
- w(C, "feGaussianBlur", {
2101
+ w(S, "feGaussianBlur", {
2063
2102
  in: "SourceAlpha",
2064
2103
  stdDeviation: "8",
2065
2104
  result: "blur"
2066
- }), w(C, "feOffset", {
2105
+ }), w(S, "feOffset", {
2067
2106
  dx: "-7",
2068
2107
  dy: "-9",
2069
2108
  result: "topLeft"
2070
- }), w(C, "feComposite", {
2109
+ }), w(S, "feComposite", {
2071
2110
  in: "topLeft",
2072
2111
  in2: "SourceAlpha",
2073
2112
  operator: "arithmetic",
2074
2113
  k2: "-1",
2075
2114
  k3: "1",
2076
2115
  result: "innerShadow"
2077
- }), w(C, "feColorMatrix", {
2116
+ }), w(S, "feColorMatrix", {
2078
2117
  in: "innerShadow",
2079
2118
  type: "matrix",
2080
2119
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
2081
2120
  result: "innerLight"
2082
- }), w(C, "feBlend", {
2121
+ }), w(S, "feBlend", {
2083
2122
  in: "SourceGraphic",
2084
2123
  in2: "innerLight",
2085
2124
  mode: "screen"
@@ -2115,26 +2154,26 @@ function Ga(e, t) {
2115
2154
  "flood-opacity": "0.22"
2116
2155
  });
2117
2156
  const D = w(r, "clipPath", { id: o.boltClip });
2118
- w(D, "path", { d: ft });
2157
+ w(D, "path", { d: xt });
2119
2158
  const u = w(i, "g", {
2120
- filter: Y(o.softDropShadow)
2159
+ filter: X(o.softDropShadow)
2121
2160
  });
2122
2161
  w(u, "path", {
2123
- d: ft,
2124
- fill: Y(o.boltEdge)
2162
+ d: xt,
2163
+ fill: X(o.boltEdge)
2125
2164
  });
2126
2165
  const v = "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";
2127
2166
  w(u, "path", {
2128
2167
  d: v,
2129
- fill: Y(o.boltFill),
2130
- filter: Y(o.innerDepth)
2168
+ fill: X(o.boltFill),
2169
+ filter: X(o.innerDepth)
2131
2170
  }), w(u, "path", {
2132
2171
  d: v,
2133
- fill: Y(o.boltGlow),
2172
+ fill: X(o.boltGlow),
2134
2173
  opacity: "0.74"
2135
2174
  });
2136
2175
  const m = w(u, "g", {
2137
- "clip-path": Y(o.boltClip),
2176
+ "clip-path": X(o.boltClip),
2138
2177
  opacity: "0.42"
2139
2178
  });
2140
2179
  w(m, "path", {
@@ -2159,9 +2198,9 @@ function Ga(e, t) {
2159
2198
  "stroke-linecap": "round",
2160
2199
  opacity: "0.48"
2161
2200
  });
2162
- const S = w(i, "g", { filter: Y(o.eyeShadow) });
2163
- return Qn(
2164
- S,
2201
+ const C = w(i, "g", { filter: X(o.eyeShadow) });
2202
+ return oo(
2203
+ C,
2165
2204
  "rotate(-2 528 463)",
2166
2205
  "528",
2167
2206
  "463",
@@ -2170,8 +2209,8 @@ function Ga(e, t) {
2170
2209
  "557",
2171
2210
  "447",
2172
2211
  o
2173
- ), Qn(
2174
- S,
2212
+ ), oo(
2213
+ C,
2175
2214
  "rotate(2 717 462)",
2176
2215
  "717",
2177
2216
  "462",
@@ -2182,12 +2221,12 @@ function Ga(e, t) {
2182
2221
  o
2183
2222
  ), i;
2184
2223
  }
2185
- function qa(e, t) {
2186
- const n = fo(e), o = {
2224
+ function Ja(e, t) {
2225
+ const n = xo(e), o = {
2187
2226
  clip: `${t}-scribbleBoltClip`,
2188
2227
  wobble: `${t}-scribbleBoltWobble`
2189
- }, i = No(), r = w(i, "defs"), l = w(r, "clipPath", { id: o.clip });
2190
- w(l, "path", { d: ft });
2228
+ }, i = Mo(), r = w(i, "defs"), l = w(r, "clipPath", { id: o.clip });
2229
+ w(l, "path", { d: xt });
2191
2230
  const p = w(r, "filter", {
2192
2231
  id: o.wobble,
2193
2232
  x: "-10%",
@@ -2209,11 +2248,11 @@ function qa(e, t) {
2209
2248
  xChannelSelector: "R",
2210
2249
  yChannelSelector: "G"
2211
2250
  });
2212
- const s = w(i, "g", { filter: Y(o.wobble) }), g = w(s, "g", {
2213
- "clip-path": Y(o.clip)
2251
+ const s = w(i, "g", { filter: X(o.wobble) }), g = w(s, "g", {
2252
+ "clip-path": X(o.clip)
2214
2253
  });
2215
2254
  return w(g, "path", {
2216
- d: ui(),
2255
+ d: bi(),
2217
2256
  fill: "none",
2218
2257
  stroke: n,
2219
2258
  "stroke-width": "56",
@@ -2222,12 +2261,12 @@ function qa(e, t) {
2222
2261
  opacity: "0.9",
2223
2262
  transform: "rotate(-14 627 600)"
2224
2263
  }), w(s, "path", {
2225
- d: ft,
2264
+ d: xt,
2226
2265
  fill: "none",
2227
- stroke: wt,
2266
+ stroke: yt,
2228
2267
  "stroke-width": "18",
2229
2268
  "stroke-linejoin": "round"
2230
- }), eo(
2269
+ }), io(
2231
2270
  s,
2232
2271
  "rotate(-2 528 463)",
2233
2272
  "528",
@@ -2236,7 +2275,7 @@ function qa(e, t) {
2236
2275
  "473",
2237
2276
  "557",
2238
2277
  "447"
2239
- ), eo(
2278
+ ), io(
2240
2279
  s,
2241
2280
  "rotate(2 717 462)",
2242
2281
  "717",
@@ -2247,27 +2286,27 @@ function qa(e, t) {
2247
2286
  "447"
2248
2287
  ), i;
2249
2288
  }
2250
- function No() {
2289
+ function Mo() {
2251
2290
  return E("svg", {
2252
- xmlns: So,
2291
+ xmlns: To,
2253
2292
  viewBox: "0 0 1254 1254"
2254
2293
  });
2255
2294
  }
2256
- function Qn(e, t, n, o, i, r, l, p, s) {
2295
+ function oo(e, t, n, o, i, r, l, p, s) {
2257
2296
  const g = w(e, "g", { transform: t });
2258
2297
  w(g, "ellipse", {
2259
2298
  cx: n,
2260
2299
  cy: o,
2261
2300
  rx: "73",
2262
2301
  ry: "80",
2263
- fill: Y(s.eyeWhite)
2302
+ fill: X(s.eyeWhite)
2264
2303
  }), w(g, "ellipse", {
2265
2304
  cx: i,
2266
2305
  cy: r,
2267
2306
  rx: "49",
2268
2307
  ry: "57",
2269
- fill: Y(s.pupil),
2270
- filter: Y(s.pupilGloss)
2308
+ fill: X(s.pupil),
2309
+ filter: X(s.pupilGloss)
2271
2310
  }), w(g, "circle", {
2272
2311
  cx: l,
2273
2312
  cy: p,
@@ -2275,7 +2314,7 @@ function Qn(e, t, n, o, i, r, l, p, s) {
2275
2314
  fill: "#ffffff"
2276
2315
  });
2277
2316
  }
2278
- function eo(e, t, n, o, i, r, l, p) {
2317
+ function io(e, t, n, o, i, r, l, p) {
2279
2318
  const s = w(e, "g", { transform: t });
2280
2319
  w(s, "ellipse", {
2281
2320
  cx: n,
@@ -2283,14 +2322,14 @@ function eo(e, t, n, o, i, r, l, p) {
2283
2322
  rx: "73",
2284
2323
  ry: "80",
2285
2324
  fill: "#ffffff",
2286
- stroke: wt,
2325
+ stroke: yt,
2287
2326
  "stroke-width": "13"
2288
2327
  }), w(s, "ellipse", {
2289
2328
  cx: i,
2290
2329
  cy: r,
2291
2330
  rx: "45",
2292
2331
  ry: "53",
2293
- fill: wt
2332
+ fill: yt
2294
2333
  }), w(s, "circle", {
2295
2334
  cx: l,
2296
2335
  cy: p,
@@ -2306,14 +2345,14 @@ function O(e, t, n, o) {
2306
2345
  const i = { offset: t, "stop-color": n };
2307
2346
  o !== void 0 && (i["stop-opacity"] = o), w(e, "stop", i);
2308
2347
  }
2309
- function Y(e) {
2348
+ function X(e) {
2310
2349
  return `url(#${e})`;
2311
2350
  }
2312
- function yt(e, t, n, o) {
2351
+ function Et(e, t, n, o) {
2313
2352
  const i = document.createElement("button");
2314
2353
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2315
2354
  }
2316
- function ja() {
2355
+ function Qa() {
2317
2356
  const e = E("svg", {
2318
2357
  class: "pluno-pa-widget__scribble-defs",
2319
2358
  "aria-hidden": "true",
@@ -2321,46 +2360,46 @@ function ja() {
2321
2360
  width: "0",
2322
2361
  height: "0"
2323
2362
  }), t = E("defs");
2324
- return t.appendChild(Xt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2325
- Xt("pluno-pa-scribble-wobble-2", "5", "15")
2363
+ return t.appendChild(en("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2364
+ en("pluno-pa-scribble-wobble-2", "5", "15")
2326
2365
  ), t.appendChild(
2327
- Xt("pluno-pa-scribble-wobble-3", "9", "19")
2366
+ en("pluno-pa-scribble-wobble-3", "9", "19")
2328
2367
  ), e.appendChild(t), e;
2329
2368
  }
2330
- function Ro(e, t) {
2369
+ function Oo(e, t) {
2331
2370
  const n = E("svg", {
2332
2371
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2333
2372
  preserveAspectRatio: "xMidYMid meet",
2334
2373
  "aria-hidden": "true",
2335
2374
  focusable: "false"
2336
2375
  });
2337
- return Do(n, t), n;
2376
+ return Uo(n, t), n;
2338
2377
  }
2339
- function Yt(e, t) {
2378
+ function Qt(e, t) {
2340
2379
  if (!e)
2341
2380
  return;
2342
2381
  const n = Math.max(
2343
2382
  0,
2344
- t - an * 2
2383
+ t - sn * 2
2345
2384
  ), o = Math.max(
2346
- sa,
2385
+ ma,
2347
2386
  Math.floor(
2348
- (n - on * 2) / nn
2387
+ (n - pn * 2) / ln
2349
2388
  )
2350
2389
  );
2351
- Do(e, o);
2390
+ Uo(e, o);
2352
2391
  }
2353
- function Do(e, t) {
2392
+ function Uo(e, t) {
2354
2393
  if (e.dataset.spiralCount === `${t}`)
2355
2394
  return;
2356
- const n = t * nn + on * 2;
2395
+ const n = t * ln + pn * 2;
2357
2396
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2358
2397
  "viewBox",
2359
- `0 0 ${n} ${pa}`
2398
+ `0 0 ${n} ${ha}`
2360
2399
  ), e.replaceChildren();
2361
2400
  for (let o = 0; o < t; o += 1) {
2362
- const i = qn[o % qn.length], r = E("g", {
2363
- transform: `translate(${on + o * nn} 0)`
2401
+ const i = Yn[o % Yn.length], r = E("g", {
2402
+ transform: `translate(${pn + o * ln} 0)`
2364
2403
  });
2365
2404
  r.appendChild(
2366
2405
  E("ellipse", {
@@ -2384,7 +2423,7 @@ function Do(e, t) {
2384
2423
  ), e.appendChild(r);
2385
2424
  }
2386
2425
  }
2387
- function Xt(e, t, n) {
2426
+ function en(e, t, n) {
2388
2427
  const o = E("filter", {
2389
2428
  id: e,
2390
2429
  x: "-8%",
@@ -2427,7 +2466,7 @@ function Xt(e, t, n) {
2427
2466
  })
2428
2467
  ), o;
2429
2468
  }
2430
- function Va(e) {
2469
+ function er(e) {
2431
2470
  const t = ce(
2432
2471
  "0 0 24 24",
2433
2472
  e,
@@ -2438,7 +2477,7 @@ function Va(e) {
2438
2477
  );
2439
2478
  return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2440
2479
  }
2441
- function Ka() {
2480
+ function tr() {
2442
2481
  const e = ce(
2443
2482
  "0 0 24 24",
2444
2483
  17,
@@ -2457,7 +2496,7 @@ function Ka() {
2457
2496
  })
2458
2497
  ), e;
2459
2498
  }
2460
- function Ya() {
2499
+ function nr() {
2461
2500
  const e = ce(
2462
2501
  "0 0 24 24",
2463
2502
  17,
@@ -2468,7 +2507,7 @@ function Ya() {
2468
2507
  );
2469
2508
  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;
2470
2509
  }
2471
- function Xa() {
2510
+ function or() {
2472
2511
  const e = ce(
2473
2512
  "0 0 24 24",
2474
2513
  15,
@@ -2479,7 +2518,7 @@ function Xa() {
2479
2518
  );
2480
2519
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2481
2520
  }
2482
- function zo() {
2521
+ function Bo() {
2483
2522
  const e = ce(
2484
2523
  "0 0 24 24",
2485
2524
  14,
@@ -2492,7 +2531,7 @@ function zo() {
2492
2531
  E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2493
2532
  ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2494
2533
  }
2495
- function Za() {
2534
+ function ir() {
2496
2535
  const e = ce(
2497
2536
  "0 0 24 24",
2498
2537
  16,
@@ -2510,7 +2549,7 @@ function Za() {
2510
2549
  })
2511
2550
  ), e;
2512
2551
  }
2513
- function Ja() {
2552
+ function ar() {
2514
2553
  const e = ce("0 0 24 24", 19, 19, "none", "currentColor");
2515
2554
  return e.setAttribute(
2516
2555
  "class",
@@ -2525,7 +2564,7 @@ function Ja() {
2525
2564
  })
2526
2565
  ), e;
2527
2566
  }
2528
- function Qa() {
2567
+ function rr() {
2529
2568
  const e = ce("0 0 24 24", 18, 18, "currentColor");
2530
2569
  return e.appendChild(
2531
2570
  E("rect", {
@@ -2537,7 +2576,7 @@ function Qa() {
2537
2576
  })
2538
2577
  ), e;
2539
2578
  }
2540
- function er() {
2579
+ function lr() {
2541
2580
  const e = ce(
2542
2581
  "0 0 24 24",
2543
2582
  12,
@@ -2548,7 +2587,7 @@ function er() {
2548
2587
  );
2549
2588
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2550
2589
  }
2551
- function tr() {
2590
+ function pr() {
2552
2591
  const e = ce(
2553
2592
  "0 0 24 24",
2554
2593
  13,
@@ -2583,30 +2622,30 @@ function ce(e, t, n, o, i, r) {
2583
2622
  return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2584
2623
  }
2585
2624
  function E(e, t = {}) {
2586
- const n = document.createElementNS(So, e);
2625
+ const n = document.createElementNS(To, e);
2587
2626
  for (const [o, i] of Object.entries(t))
2588
2627
  n.setAttribute(o, i);
2589
2628
  return n;
2590
2629
  }
2591
- function to(e) {
2630
+ function ao(e) {
2592
2631
  for (const t of ["keydown", "keypress", "keyup"])
2593
2632
  e.addEventListener(t, (n) => {
2594
2633
  n.stopPropagation();
2595
2634
  });
2596
2635
  }
2597
- function nr(e, t, n) {
2636
+ function sr(e, t, n) {
2598
2637
  e.replaceChildren(), e.hidden = t.length === 0;
2599
2638
  for (const [o, i] of t.entries()) {
2600
2639
  const r = document.createElement("div");
2601
- r.className = "pluno-pa-widget__attachment", r.appendChild(or(i));
2640
+ r.className = "pluno-pa-widget__attachment", r.appendChild(dr(i));
2602
2641
  const l = document.createElement("span");
2603
2642
  l.textContent = i.name, r.appendChild(l);
2604
2643
  const p = document.createElement("button");
2605
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(er()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2644
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(lr()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2606
2645
  }
2607
2646
  }
2608
- function or(e) {
2609
- const t = hn(e), n = Mo(e);
2647
+ function dr(e) {
2648
+ const t = bn(e), n = Fo(e);
2610
2649
  if (t === "image" && n) {
2611
2650
  const o = document.createElement("img");
2612
2651
  return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(se(e))), o;
@@ -2617,8 +2656,8 @@ function or(e) {
2617
2656
  }
2618
2657
  return se(e);
2619
2658
  }
2620
- function ir(e) {
2621
- const t = hn(e), n = Mo(e);
2659
+ function cr(e) {
2660
+ const t = bn(e), n = Fo(e);
2622
2661
  if (t === "image" && n) {
2623
2662
  const o = document.createElement("img");
2624
2663
  return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(se(e, "message"))), o;
@@ -2636,109 +2675,109 @@ function ir(e) {
2636
2675
  function se(e, t = "composer") {
2637
2676
  if (t === "composer") {
2638
2677
  const r = document.createElement("span");
2639
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = no(e), r;
2678
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = ro(e), r;
2640
2679
  }
2641
2680
  const n = document.createElement("div");
2642
2681
  n.className = "pluno-pa-widget__message-attachment-file";
2643
2682
  const o = document.createElement("span");
2644
- o.textContent = no(e);
2683
+ o.textContent = ro(e);
2645
2684
  const i = document.createElement("strong");
2646
2685
  return i.textContent = e.name, n.append(o, i), n;
2647
2686
  }
2648
- function hn(e) {
2687
+ function bn(e) {
2649
2688
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2650
2689
  }
2651
- function Mo(e) {
2690
+ function Fo(e) {
2652
2691
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2653
2692
  }
2654
- function no(e) {
2655
- const t = hn(e);
2693
+ function ro(e) {
2694
+ const t = bn(e);
2656
2695
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2657
2696
  }
2658
- function ar(e, t) {
2697
+ function ur(e, t) {
2659
2698
  return t ? Array.from(t).map((o) => ({
2660
2699
  ...e.createLocalAttachment(o),
2661
- previewUrl: rr(o)
2700
+ previewUrl: gr(o)
2662
2701
  })) : [];
2663
2702
  }
2664
- function rr(e) {
2703
+ function gr(e) {
2665
2704
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2666
2705
  }
2667
- function ut(e) {
2706
+ function ft(e) {
2668
2707
  return !!(e && Array.from(e.types).includes("Files"));
2669
2708
  }
2670
- function Zt(e, t, n = null) {
2671
- if (!e || !sn(t, n)) {
2709
+ function tn(e, t, n = null) {
2710
+ if (!e || !gn(t, n)) {
2672
2711
  e && (e.hidden = !0, e.replaceChildren());
2673
2712
  return;
2674
2713
  }
2675
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) || mn(n) ? e.appendChild(
2676
- lr(t, n)
2677
- ) : Oo(t) && e.appendChild(pr(t));
2714
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) || _n(n) ? e.appendChild(
2715
+ hr(t, n)
2716
+ ) : Wo(t) && e.appendChild(mr(t));
2678
2717
  }
2679
- function lr(e, t) {
2718
+ function hr(e, t) {
2680
2719
  const n = document.createElement("div");
2681
2720
  n.className = "pluno-pa-widget__billing-action-card";
2682
2721
  const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2683
2722
  i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2684
2723
  const r = document.createElement("span");
2685
2724
  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(
2686
- Uo(
2725
+ Ho(
2687
2726
  e,
2688
2727
  "Upgrade plan",
2689
2728
  "pluno-pa-widget__billing-action-card-actions"
2690
2729
  )
2691
2730
  ), n;
2692
2731
  }
2693
- function pr(e) {
2732
+ function mr(e) {
2694
2733
  const t = document.createElement("div");
2695
2734
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2696
2735
  const n = document.createElement("strong");
2697
2736
  n.textContent = "Credits running low", t.appendChild(n);
2698
2737
  const o = document.createElement("span");
2699
- return o.textContent = dr(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2700
- Uo(
2738
+ return o.textContent = wr(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2739
+ Ho(
2701
2740
  e,
2702
2741
  "Upgrade",
2703
2742
  "pluno-pa-widget__billing-action-card-actions"
2704
2743
  )
2705
2744
  ), t;
2706
2745
  }
2707
- function sn(e, t) {
2708
- return e !== null && (de(e) || Oo(e) || mn(t));
2746
+ function gn(e, t) {
2747
+ return e !== null && (de(e) || Wo(e) || _n(t));
2709
2748
  }
2710
- function oo(e, t, n) {
2711
- return sn(t, n) || sr(t) ? !0 : !sn(e, n);
2749
+ function lo(e, t, n) {
2750
+ return gn(t, n) || fr(t) ? !0 : !gn(e, n);
2712
2751
  }
2713
- function sr(e) {
2752
+ function fr(e) {
2714
2753
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || de(e));
2715
2754
  }
2716
2755
  function de(e) {
2717
2756
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2718
2757
  }
2719
- function mn(e) {
2758
+ function _n(e) {
2720
2759
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2721
2760
  }
2722
- function Oo(e) {
2761
+ function Wo(e) {
2723
2762
  return !de(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2724
2763
  }
2725
- function dr(e) {
2726
- return e.creditsRemaining === null ? null : `${cr(e.creditsRemaining)} credits left`;
2764
+ function wr(e) {
2765
+ return e.creditsRemaining === null ? null : `${br(e.creditsRemaining)} credits left`;
2727
2766
  }
2728
- function cr(e) {
2767
+ function br(e) {
2729
2768
  return new Intl.NumberFormat("en-US", {
2730
2769
  maximumFractionDigits: 0
2731
2770
  }).format(Math.ceil(e));
2732
2771
  }
2733
- function Uo(e, t, n) {
2772
+ function Ho(e, t, n) {
2734
2773
  const o = document.createElement("div");
2735
2774
  return o.className = n, o.appendChild(
2736
- io(t, e.pricingUrl)
2775
+ po(t, e.pricingUrl)
2737
2776
  ), o.appendChild(
2738
- io("Earn credits", e.earnCreditsUrl)
2777
+ po("Earn credits", e.earnCreditsUrl)
2739
2778
  ), o;
2740
2779
  }
2741
- function io(e, t) {
2780
+ function po(e, t) {
2742
2781
  const n = document.createElement("button");
2743
2782
  if (n.type = "button", e === "Earn credits") {
2744
2783
  const o = document.createElement("span");
@@ -2749,18 +2788,18 @@ function io(e, t) {
2749
2788
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2750
2789
  }), n;
2751
2790
  }
2752
- function Jt(e, t) {
2791
+ function nn(e, t) {
2753
2792
  return e.messages.filter(
2754
- (o) => !Bo(o)
2793
+ (o) => !Go(o)
2755
2794
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2756
2795
  }
2757
- function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
2758
- const z = fr(r), L = z.filter(
2759
- (x) => !Bo(x)
2760
- ), oe = e.scrollTop, J = [], Re = /* @__PURE__ */ new Set(), U = (x) => {
2761
- J.push(x);
2796
+ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
2797
+ const z = Sr(r), L = z.filter(
2798
+ (x) => !Go(x)
2799
+ ), ie = e.scrollTop, Q = [], Re = /* @__PURE__ */ new Set(), U = (x) => {
2800
+ Q.push(x);
2762
2801
  };
2763
- Wo(n, r.isThinking), i.hidden = !p, p && l !== null && Ao(i, l);
2802
+ qo(n, r.isThinking), i.hidden = !p, p && l !== null && zo(i, l);
2764
2803
  const we = L.length > 0 || !!r.assistantDraft || r.isThinking;
2765
2804
  if (o(we), u || L.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2766
2805
  const x = document.createElement("div");
@@ -2775,10 +2814,10 @@ function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
2775
2814
  const y = document.createElement("h2");
2776
2815
  y.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", y.textContent = u.opening, x.appendChild(y);
2777
2816
  } else
2778
- x.appendChild(Io());
2779
- const ae = u?.prompts ?? r.starterPrompts, H = document.createElement("div");
2780
- if (H.className = ae.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", ae.length === 0 && !r.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), ae.length > 0)
2781
- for (const y of ae) {
2817
+ x.appendChild(Do());
2818
+ const re = u?.prompts ?? r.starterPrompts, H = document.createElement("div");
2819
+ if (H.className = re.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", re.length === 0 && !r.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), re.length > 0)
2820
+ for (const y of re) {
2782
2821
  const A = document.createElement("button");
2783
2822
  A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${y}"`, A.addEventListener("click", () => {
2784
2823
  I(y);
@@ -2788,7 +2827,7 @@ function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
2788
2827
  const y = document.createElement("button");
2789
2828
  y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", y.disabled = !0, y.tabIndex = -1, y.textContent = "Generating example tasks...", H.appendChild(y);
2790
2829
  } else
2791
- for (let y = 0; y < Xi; y += 1) {
2830
+ for (let y = 0; y < na; y += 1) {
2792
2831
  const A = document.createElement("button");
2793
2832
  A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", H.appendChild(A);
2794
2833
  }
@@ -2796,62 +2835,62 @@ function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
2796
2835
  const y = document.createElement("button");
2797
2836
  y.type = "button", y.className = "pluno-pa-widget__morning-report-snooze", y.textContent = "Snooze morning report", y.addEventListener("click", v), x.appendChild(y);
2798
2837
  }
2799
- h.clear(), U(x), U(t), ao(e, J);
2838
+ h.clear(), U(x), U(t), so(e, Q);
2800
2839
  return;
2801
2840
  }
2802
- let B = null, f = null, Q = [];
2803
- const De = L.length - 1, Ce = De >= 0 && dn(L[De]), Se = () => {
2804
- if (Q.length === 0)
2841
+ let B = null, f = null, ee = [];
2842
+ const De = L.length - 1, Se = De >= 0 && hn(L[De]), Ce = () => {
2843
+ if (ee.length === 0)
2805
2844
  return !1;
2806
- const x = Er(
2807
- Q,
2845
+ const x = Nr(
2846
+ ee,
2808
2847
  c,
2809
- C,
2848
+ S,
2810
2849
  P()
2811
2850
  );
2812
- return U(x), B = null, f = x, Q = [], !0;
2851
+ return U(x), B = null, f = x, ee = [], !0;
2813
2852
  };
2814
2853
  for (let x = 0; x < L.length; x += 1) {
2815
2854
  const R = L[x];
2816
2855
  if (R.role === "tool") {
2817
- Q.push(R);
2856
+ ee.push(R);
2818
2857
  continue;
2819
2858
  }
2820
- if (dn(R)) {
2859
+ if (hn(R)) {
2821
2860
  if (x !== De)
2822
2861
  continue;
2823
- if (Se()) {
2824
- const A = _t();
2862
+ if (Ce()) {
2863
+ const A = St();
2825
2864
  U(A), B = null, f = A;
2826
2865
  } else {
2827
- const A = so(P());
2866
+ const A = ho(P());
2828
2867
  U(A), B = null, f = A;
2829
2868
  }
2830
2869
  continue;
2831
2870
  }
2832
2871
  if (R.role === "system") {
2833
2872
  if (R.dataType === "run_error" || R.dataType === "run_status") {
2834
- Se();
2873
+ Ce();
2835
2874
  const y = document.createElement("div"), A = R.dataType === "run_error";
2836
- y.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = po(R.content), U(y), B = A ? y : null, f = A ? null : y;
2875
+ y.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = go(R.content), U(y), B = A ? y : null, f = A ? null : y;
2837
2876
  }
2838
2877
  continue;
2839
2878
  }
2840
- const T = Se(), ae = po(R.content);
2879
+ const T = Ce(), re = go(R.content);
2841
2880
  if (R.role === "assistant" && !T) {
2842
- const y = Fo(P());
2881
+ const y = $o(P());
2843
2882
  U(y), B = null, f = y;
2844
2883
  }
2845
- const H = gr(R, ae, h, Re);
2884
+ const H = xr(R, re, h, Re);
2846
2885
  U(H), B = H, f = null;
2847
2886
  }
2848
- const j = Se(), ot = L[L.length - 1]?.id === "assistant-draft";
2849
- if (r.isThinking && !ot && !Ce)
2887
+ const j = Ce(), at = L[L.length - 1]?.id === "assistant-draft";
2888
+ if (r.isThinking && !at && !Se)
2850
2889
  if (j) {
2851
- const x = _t();
2890
+ const x = St();
2852
2891
  U(x), B = null, f = x;
2853
2892
  } else {
2854
- const x = so(P());
2893
+ const x = ho(P());
2855
2894
  U(x), B = null, f = x;
2856
2895
  }
2857
2896
  if (r.lastError) {
@@ -2867,30 +2906,30 @@ function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
2867
2906
  }
2868
2907
  U(x), B = x, f = null;
2869
2908
  }
2870
- const ie = S && !r.isThinking ? wi(z) : null;
2871
- if (S && ie && !S.dismissedCandidateIds.has(ie.id)) {
2872
- const x = _r(ie, {
2873
- isDrafting: S.draftingCandidateId === ie.id,
2874
- error: S.error,
2875
- characterIconOptions: S.characterIconOptions,
2876
- onDraft: S.onDraft,
2877
- onDismiss: S.onDismiss,
2878
- onDisable: S.onDisable
2909
+ const ae = C && !r.isThinking ? Si(z) : null;
2910
+ if (C && ae && !C.dismissedCandidateIds.has(ae.id)) {
2911
+ const x = kr(ae, {
2912
+ isDrafting: C.draftingCandidateId === ae.id,
2913
+ error: C.error,
2914
+ characterIconOptions: C.characterIconOptions,
2915
+ onDraft: C.onDraft,
2916
+ onDismiss: C.onDismiss,
2917
+ onDisable: C.onDisable
2879
2918
  });
2880
- U(x), S.onSeen(ie), B = null, f = x;
2919
+ U(x), C.onSeen(ae), B = null, f = x;
2881
2920
  }
2882
- B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), mr(h, Re), ao(e, J), s ? tt(e, g) : e.scrollTop = oe;
2921
+ B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), vr(h, Re), so(e, Q), s ? ot(e, g) : e.scrollTop = ie;
2883
2922
  }
2884
- function gr(e, t, n, o) {
2885
- const i = hr(e, t), r = i ? n.get(i) : void 0;
2923
+ function xr(e, t, n, o) {
2924
+ const i = yr(e, t), r = i ? n.get(i) : void 0;
2886
2925
  if (i && r)
2887
2926
  return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
2888
2927
  const l = document.createElement("div");
2889
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Lr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(wr(e.attachments));
2928
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Dr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Cr(e.attachments));
2890
2929
  const p = document.createElement("div");
2891
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(br(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2930
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(Er(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2892
2931
  }
2893
- function hr(e, t) {
2932
+ function yr(e, t) {
2894
2933
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2895
2934
  id: e.id,
2896
2935
  content: t,
@@ -2908,11 +2947,11 @@ function hr(e, t) {
2908
2947
  })
2909
2948
  });
2910
2949
  }
2911
- function mr(e, t) {
2950
+ function vr(e, t) {
2912
2951
  for (const n of e.keys())
2913
2952
  t.has(n) || e.delete(n);
2914
2953
  }
2915
- function ao(e, t) {
2954
+ function so(e, t) {
2916
2955
  let n = e.firstChild;
2917
2956
  for (const o of t) {
2918
2957
  if (o === n) {
@@ -2926,7 +2965,7 @@ function ao(e, t) {
2926
2965
  n = n.nextSibling, e.removeChild(o);
2927
2966
  }
2928
2967
  }
2929
- function fr(e) {
2968
+ function Sr(e) {
2930
2969
  if (!e.assistantDraft)
2931
2970
  return [...e.messages];
2932
2971
  const t = {
@@ -2946,7 +2985,7 @@ function fr(e) {
2946
2985
  if (n === -1)
2947
2986
  return [...e.messages, t];
2948
2987
  const o = e.messages.findIndex(
2949
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && ro(r, t) && dn(r)
2988
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && co(r, t) && hn(r)
2950
2989
  );
2951
2990
  if (o !== -1)
2952
2991
  return [
@@ -2955,7 +2994,7 @@ function fr(e) {
2955
2994
  ...e.messages.slice(o + 1)
2956
2995
  ];
2957
2996
  let i = n + 1;
2958
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ro(e.messages[i], t); )
2997
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && co(e.messages[i], t); )
2959
2998
  i += 1;
2960
2999
  return [
2961
3000
  ...e.messages.slice(0, i),
@@ -2963,14 +3002,14 @@ function fr(e) {
2963
3002
  ...e.messages.slice(i)
2964
3003
  ];
2965
3004
  }
2966
- function dn(e) {
3005
+ function hn(e) {
2967
3006
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2968
3007
  }
2969
- function ro(e, t) {
3008
+ function co(e, t) {
2970
3009
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2971
3010
  }
2972
- function lo(e, t, n, o, i, r, l, p) {
2973
- e.replaceChildren(), Wo(t, !1), t.disabled = !0, n(!1);
3011
+ function uo(e, t, n, o, i, r, l, p) {
3012
+ e.replaceChildren(), qo(t, !1), t.disabled = !0, n(!1);
2974
3013
  const s = document.createElement("div");
2975
3014
  s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2976
3015
  const g = ve(
@@ -2988,20 +3027,20 @@ function lo(e, t, n, o, i, r, l, p) {
2988
3027
  }
2989
3028
  e.appendChild(s);
2990
3029
  }
2991
- function wr(e) {
3030
+ function Cr(e) {
2992
3031
  const t = document.createElement("div");
2993
3032
  t.className = "pluno-pa-widget__message-attachments";
2994
3033
  for (const n of e)
2995
- t.appendChild(ir(n));
3034
+ t.appendChild(cr(n));
2996
3035
  return t;
2997
3036
  }
2998
- function br(e) {
3037
+ function Er(e) {
2999
3038
  const t = document.createElement("button");
3000
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(tr()), t.addEventListener("click", (n) => {
3039
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(pr()), t.addEventListener("click", (n) => {
3001
3040
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
3002
3041
  }), t;
3003
3042
  }
3004
- function _r(e, t) {
3043
+ function kr(e, t) {
3005
3044
  const n = document.createElement("article");
3006
3045
  n.className = "pluno-pa-widget__share-prompt";
3007
3046
  const o = document.createElement("div");
@@ -3028,7 +3067,7 @@ function _r(e, t) {
3028
3067
  const g = document.createElement("button");
3029
3068
  if (g.type = "button", g.disabled = t.isDrafting, g.addEventListener("click", () => {
3030
3069
  t.onDraft(e);
3031
- }), t.isDrafting ? (g.appendChild(cn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
3070
+ }), t.isDrafting ? (g.appendChild(mn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
3032
3071
  p.appendChild(s);
3033
3072
  else {
3034
3073
  const c = document.createElement("button");
@@ -3042,7 +3081,7 @@ function _r(e, t) {
3042
3081
  }
3043
3082
  return o.appendChild(p), n.appendChild(o), n;
3044
3083
  }
3045
- function xr(e, t) {
3084
+ function Lr(e, t) {
3046
3085
  const n = document.createElement("div");
3047
3086
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (u) => {
3048
3087
  u.target === n && t.onClose();
@@ -3061,11 +3100,11 @@ function xr(e, t) {
3061
3100
  g.className = "pluno-pa-widget__share-dialog-step-header";
3062
3101
  const c = document.createElement("strong");
3063
3102
  c.textContent = "1) Copy Screenshot", g.appendChild(c);
3064
- const h = yr(
3103
+ const h = Tr(
3065
3104
  "Copy Screenshot",
3066
3105
  async () => {
3067
3106
  try {
3068
- return await bi(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
3107
+ return await Ci(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
3069
3108
  } catch {
3070
3109
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
3071
3110
  }
@@ -3078,35 +3117,35 @@ function xr(e, t) {
3078
3117
  v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", u.appendChild(v), s.appendChild(u);
3079
3118
  }
3080
3119
  o.appendChild(s), o.appendChild(p);
3081
- const C = document.createElement("div");
3082
- C.className = "pluno-pa-widget__share-dialog-step";
3120
+ const S = document.createElement("div");
3121
+ S.className = "pluno-pa-widget__share-dialog-step";
3083
3122
  const P = document.createElement("strong");
3084
- P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", C.appendChild(P);
3123
+ P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", S.appendChild(P);
3085
3124
  const I = document.createElement("p");
3086
- I.className = "pluno-pa-widget__share-dialog-hint", I.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(I);
3125
+ I.className = "pluno-pa-widget__share-dialog-hint", I.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(I);
3087
3126
  const D = document.createElement("footer");
3088
3127
  D.className = "pluno-pa-widget__share-dialog-platforms";
3089
- for (const u of vr(e)) {
3128
+ for (const u of Pr(e)) {
3090
3129
  const v = document.createElement("a");
3091
- v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(Cr(u.id)), D.appendChild(v);
3130
+ v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(Ir(u.id)), D.appendChild(v);
3092
3131
  }
3093
- if (C.appendChild(D), o.appendChild(C), t.socialPostRewardsUrl) {
3132
+ if (S.appendChild(D), o.appendChild(S), t.socialPostRewardsUrl) {
3094
3133
  const u = document.createElement("div");
3095
3134
  u.className = "pluno-pa-widget__share-dialog-step";
3096
3135
  const v = document.createElement("strong");
3097
3136
  v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(v);
3098
3137
  const m = document.createElement("a");
3099
- m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Sr()), u.appendChild(m), o.appendChild(u);
3138
+ m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Ar()), u.appendChild(m), o.appendChild(u);
3100
3139
  }
3101
3140
  return n.appendChild(o), n;
3102
3141
  }
3103
- function yr(e, t) {
3142
+ function Tr(e, t) {
3104
3143
  const n = document.createElement("button");
3105
3144
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
3106
3145
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
3107
3146
  }), n;
3108
3147
  }
3109
- function vr(e) {
3148
+ function Pr(e) {
3110
3149
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
3111
3150
  return [
3112
3151
  {
@@ -3126,47 +3165,47 @@ function vr(e) {
3126
3165
  }
3127
3166
  ];
3128
3167
  }
3129
- function Cr(e) {
3168
+ function Ir(e) {
3130
3169
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3131
- 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" ? (G(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), G(
3170
+ 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"), $(
3132
3171
  t,
3133
3172
  "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"
3134
- ), G(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), G(
3173
+ ), $(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), $(
3135
3174
  t,
3136
3175
  "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"
3137
- ), G(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (G(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), G(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), G(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (G(
3176
+ ), $(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) : ($(
3138
3177
  t,
3139
3178
  "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"
3140
- ), G(
3179
+ ), $(
3141
3180
  t,
3142
3181
  "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",
3143
3182
  "0.48"
3144
- ), G(
3183
+ ), $(
3145
3184
  t,
3146
3185
  "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"
3147
- ), G(
3186
+ ), $(
3148
3187
  t,
3149
3188
  "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"
3150
3189
  ), t);
3151
3190
  }
3152
- function G(e, t, n) {
3191
+ function $(e, t, n) {
3153
3192
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3154
3193
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
3155
3194
  }
3156
- function Sr() {
3195
+ function Ar() {
3157
3196
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3158
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), G(e, "M14 5h5v5"), G(e, "M19 5l-8 8"), G(
3197
+ 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"), $(
3159
3198
  e,
3160
3199
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3161
3200
  ), e;
3162
3201
  }
3163
- function Bo(e) {
3164
- return e.role === "tool" && e.toolName === bo;
3202
+ function Go(e) {
3203
+ return e.role === "tool" && e.toolName === vo;
3165
3204
  }
3166
- function po(e) {
3205
+ function go(e) {
3167
3206
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3168
3207
  }
3169
- function Er(e, t, n, o) {
3208
+ function Nr(e, t, n, o) {
3170
3209
  const i = document.createElement("article");
3171
3210
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
3172
3211
  e[e.length - 1].createdAt
@@ -3176,27 +3215,27 @@ function Er(e, t, n, o) {
3176
3215
  o
3177
3216
  )
3178
3217
  );
3179
- const r = document.createElement("details"), l = kr(e);
3218
+ const r = document.createElement("details"), l = Rr(e);
3180
3219
  r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3181
3220
  i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
3182
3221
  });
3183
3222
  const p = document.createElement("summary");
3184
- p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(cn());
3223
+ p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(mn());
3185
3224
  const g = document.createElement("span");
3186
3225
  if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", p.appendChild(g), r.appendChild(p), e.length > 0) {
3187
3226
  const c = document.createElement("div");
3188
3227
  c.className = "pluno-pa-widget__tool-lines";
3189
3228
  for (const h of e) {
3190
- const C = document.createElement("div");
3191
- C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(cn());
3229
+ const S = document.createElement("div");
3230
+ S.className = "pluno-pa-widget__tool-line", h.loading && S.appendChild(mn());
3192
3231
  const P = document.createElement("span");
3193
- P.textContent = h.content || "Run tool", C.appendChild(P), c.appendChild(C);
3232
+ P.textContent = h.content || "Run tool", S.appendChild(P), c.appendChild(S);
3194
3233
  }
3195
3234
  r.appendChild(c);
3196
3235
  }
3197
3236
  return i.appendChild(r), i;
3198
3237
  }
3199
- function Fo(e) {
3238
+ function $o(e) {
3200
3239
  const t = document.createElement("article");
3201
3240
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3202
3241
  ve(
@@ -3205,11 +3244,11 @@ function Fo(e) {
3205
3244
  )
3206
3245
  ), t;
3207
3246
  }
3208
- function so(e) {
3209
- const t = Fo(e);
3210
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
3247
+ function ho(e) {
3248
+ const t = $o(e);
3249
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(St()), t;
3211
3250
  }
3212
- function _t(e = "Thinking...") {
3251
+ function St(e = "Thinking...") {
3213
3252
  const t = document.createElement("div");
3214
3253
  t.className = "pluno-pa-widget__status";
3215
3254
  const n = document.createElement("span");
@@ -3217,18 +3256,18 @@ function _t(e = "Thinking...") {
3217
3256
  const o = document.createElement("span");
3218
3257
  return o.textContent = e, t.appendChild(o), t;
3219
3258
  }
3220
- function kr(e) {
3259
+ function Rr(e) {
3221
3260
  return `tools:${e[0]?.id ?? ""}`;
3222
3261
  }
3223
- function cn() {
3262
+ function mn() {
3224
3263
  const e = document.createElement("span");
3225
3264
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3226
3265
  }
3227
- function Wo(e, t) {
3228
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Qa() : zo());
3266
+ function qo(e, t) {
3267
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? rr() : Bo());
3229
3268
  }
3230
- function Lr(e, t) {
3231
- const n = Ri(t).replace(/\r\n/g, `
3269
+ function Dr(e, t) {
3270
+ const n = Bi(t).replace(/\r\n/g, `
3232
3271
  `).split(`
3233
3272
  `);
3234
3273
  let o = 0;
@@ -3243,22 +3282,22 @@ function Lr(e, t) {
3243
3282
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
3244
3283
  c.push(n[o]), o += 1;
3245
3284
  o += o < n.length ? 1 : 0;
3246
- const h = document.createElement("pre"), C = document.createElement("code");
3247
- C.textContent = c.join(`
3248
- `), h.appendChild(C), e.appendChild(h);
3285
+ const h = document.createElement("pre"), S = document.createElement("code");
3286
+ S.textContent = c.join(`
3287
+ `), h.appendChild(S), e.appendChild(h);
3249
3288
  continue;
3250
3289
  }
3251
3290
  const l = i.match(/^(#{1,3})\s+(.+)$/);
3252
3291
  if (l) {
3253
3292
  const c = document.createElement(`h${l[1].length + 2}`);
3254
- gt(c, l[2]), e.appendChild(c), o += 1;
3293
+ wt(c, l[2]), e.appendChild(c), o += 1;
3255
3294
  continue;
3256
3295
  }
3257
3296
  if (/^\s*[-*+]\s+/.test(i)) {
3258
3297
  const c = document.createElement("ul");
3259
3298
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3260
3299
  const h = document.createElement("li");
3261
- gt(h, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(h), o += 1;
3300
+ wt(h, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(h), o += 1;
3262
3301
  }
3263
3302
  e.appendChild(c);
3264
3303
  continue;
@@ -3268,7 +3307,7 @@ function Lr(e, t) {
3268
3307
  const c = document.createElement("ol");
3269
3308
  for (c.start = Number(p[1]); o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3270
3309
  const h = document.createElement("li");
3271
- gt(h, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(h), o += 1;
3310
+ wt(h, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(h), o += 1;
3272
3311
  }
3273
3312
  e.appendChild(c);
3274
3313
  continue;
@@ -3278,11 +3317,11 @@ function Lr(e, t) {
3278
3317
  s.push(n[o]), o += 1;
3279
3318
  const g = document.createElement("p");
3280
3319
  s.forEach((c, h) => {
3281
- h > 0 && g.appendChild(document.createElement("br")), gt(g, c);
3320
+ h > 0 && g.appendChild(document.createElement("br")), wt(g, c);
3282
3321
  }), e.appendChild(g);
3283
3322
  }
3284
3323
  }
3285
- function gt(e, t) {
3324
+ function wt(e, t) {
3286
3325
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3287
3326
  let o = 0;
3288
3327
  for (const i of t.matchAll(n)) {
@@ -3302,7 +3341,7 @@ function gt(e, t) {
3302
3341
  p.textContent = l.slice(1, -1), e.appendChild(p);
3303
3342
  } else {
3304
3343
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3305
- if (p && Tr(p[2])) {
3344
+ if (p && zr(p[2])) {
3306
3345
  const s = document.createElement("a");
3307
3346
  s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
3308
3347
  } else
@@ -3312,7 +3351,7 @@ function gt(e, t) {
3312
3351
  }
3313
3352
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
3314
3353
  }
3315
- function Tr(e) {
3354
+ function zr(e) {
3316
3355
  if (e.startsWith("/") || e.startsWith("#"))
3317
3356
  return !0;
3318
3357
  try {
@@ -3322,8 +3361,8 @@ function Tr(e) {
3322
3361
  return !1;
3323
3362
  }
3324
3363
  }
3325
- function co(e, t) {
3326
- if (Pr(e))
3364
+ function mo(e, t) {
3365
+ if (Mr(e))
3327
3366
  return;
3328
3367
  const n = `
3329
3368
  :host {
@@ -5312,8 +5351,8 @@ function co(e, t) {
5312
5351
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5313
5352
  position: absolute;
5314
5353
  top: -16px;
5315
- left: ${an}px;
5316
- width: calc(100% - ${an * 2}px);
5354
+ left: ${sn}px;
5355
+ width: calc(100% - ${sn * 2}px);
5317
5356
  height: 36px;
5318
5357
  z-index: 3;
5319
5358
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5663,28 +5702,28 @@ function co(e, t) {
5663
5702
  filter: url(#pluno-pa-scribble-wobble-2);
5664
5703
  }
5665
5704
  `;
5666
- if (Ir(e, n))
5705
+ if (Or(e, n))
5667
5706
  return;
5668
5707
  const o = e.ownerDocument.createElement("style");
5669
- o.id = Lo, o.textContent = n, e.appendChild(o), Ho(e);
5708
+ o.id = Ao, o.textContent = n, e.appendChild(o), jo(e);
5670
5709
  }
5671
- function Pr(e) {
5672
- return e.getElementById(Lo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(To) === "true";
5710
+ function Mr(e) {
5711
+ return e.getElementById(Ao) !== null || e.host instanceof HTMLElement && e.host.getAttribute(No) === "true";
5673
5712
  }
5674
- function Ho(e) {
5675
- e.host instanceof HTMLElement && e.host.setAttribute(To, "true");
5713
+ function jo(e) {
5714
+ e.host instanceof HTMLElement && e.host.setAttribute(No, "true");
5676
5715
  }
5677
- function Ir(e, t) {
5716
+ function Or(e, t) {
5678
5717
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5679
5718
  return !1;
5680
5719
  try {
5681
5720
  const n = new CSSStyleSheet();
5682
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Ho(e), !0;
5721
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], jo(e), !0;
5683
5722
  } catch {
5684
5723
  return !1;
5685
5724
  }
5686
5725
  }
5687
- async function Ar() {
5726
+ async function Ur() {
5688
5727
  return document.body ? document.body : await new Promise((e) => {
5689
5728
  const t = new MutationObserver(() => {
5690
5729
  document.body && (t.disconnect(), e(document.body));
@@ -5692,25 +5731,25 @@ async function Ar() {
5692
5731
  t.observe(document.documentElement, { childList: !0 });
5693
5732
  });
5694
5733
  }
5695
- function fn(e) {
5734
+ function xn(e) {
5696
5735
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5697
5736
  }
5698
- function $o(e) {
5699
- return `${fn(e)}.displayState`;
5737
+ function Vo(e) {
5738
+ return `${xn(e)}.displayState`;
5700
5739
  }
5701
- function Nr(e) {
5740
+ function Br(e) {
5702
5741
  try {
5703
5742
  return window.sessionStorage.getItem(
5704
- $o(e)
5743
+ Vo(e)
5705
5744
  ) === "minimized" ? "minimized" : "shown";
5706
5745
  } catch {
5707
5746
  return "shown";
5708
5747
  }
5709
5748
  }
5710
- function uo(e, t) {
5749
+ function fo(e, t) {
5711
5750
  if (e.layout === "floating")
5712
5751
  try {
5713
- const n = $o(e);
5752
+ const n = Vo(e);
5714
5753
  if (t === "minimized") {
5715
5754
  window.sessionStorage.setItem(n, t);
5716
5755
  return;
@@ -5720,15 +5759,15 @@ function uo(e, t) {
5720
5759
  return;
5721
5760
  }
5722
5761
  }
5723
- function Rr(e) {
5762
+ function Fr(e) {
5724
5763
  if (e)
5725
5764
  return { clientId: e, release: () => {
5726
5765
  } };
5727
5766
  let t = 0;
5728
- for (; $t.has(t); )
5767
+ for (; Vt.has(t); )
5729
5768
  t += 1;
5730
- $t.add(t);
5731
- const n = `${Ki}${t}`;
5769
+ Vt.add(t);
5770
+ const n = `${ea}${t}`;
5732
5771
  let o = crypto.randomUUID();
5733
5772
  try {
5734
5773
  o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
@@ -5738,15 +5777,15 @@ function Rr(e) {
5738
5777
  return {
5739
5778
  clientId: o,
5740
5779
  release: () => {
5741
- i || (i = !0, $t.delete(t));
5780
+ i || (i = !0, Vt.delete(t));
5742
5781
  }
5743
5782
  };
5744
5783
  }
5745
- function Dr(e) {
5784
+ function Wr(e) {
5746
5785
  try {
5747
- const t = window.localStorage.getItem(fn(e));
5786
+ const t = window.localStorage.getItem(xn(e));
5748
5787
  if (!t)
5749
- return go();
5788
+ return wo();
5750
5789
  const n = JSON.parse(t);
5751
5790
  return {
5752
5791
  isOpen: n.isOpen === !0,
@@ -5756,25 +5795,25 @@ function Dr(e) {
5756
5795
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5757
5796
  (o) => typeof o == "string"
5758
5797
  ) : [],
5759
- launcherPosition: Ur(n.launcherPosition) ? n.launcherPosition : null,
5760
- panelSize: Br(n.panelSize) ? xt(n.panelSize) : null,
5761
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-_o) : [],
5798
+ launcherPosition: qr(n.launcherPosition) ? n.launcherPosition : null,
5799
+ panelSize: jr(n.panelSize) ? Ct(n.panelSize) : null,
5800
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-So) : [],
5762
5801
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5763
5802
  };
5764
5803
  } catch {
5765
- return go();
5804
+ return wo();
5766
5805
  }
5767
5806
  }
5768
- async function zr(e) {
5807
+ async function Hr(e) {
5769
5808
  if (e.loadSharePromptsDisabled)
5770
5809
  return e.loadSharePromptsDisabled();
5771
5810
  try {
5772
- return window.localStorage.getItem(yo) === "true";
5811
+ return window.localStorage.getItem(Eo) === "true";
5773
5812
  } catch {
5774
5813
  return !1;
5775
5814
  }
5776
5815
  }
5777
- function Mr(e, t) {
5816
+ function Gr(e, t) {
5778
5817
  if (e.persistSharePromptsDisabled) {
5779
5818
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5780
5819
  () => {
@@ -5783,12 +5822,12 @@ function Mr(e, t) {
5783
5822
  return;
5784
5823
  }
5785
5824
  try {
5786
- t && window.localStorage.setItem(yo, "true");
5825
+ t && window.localStorage.setItem(Eo, "true");
5787
5826
  } catch {
5788
5827
  return;
5789
5828
  }
5790
5829
  }
5791
- function go() {
5830
+ function wo() {
5792
5831
  return {
5793
5832
  isOpen: !1,
5794
5833
  composerValue: "",
@@ -5801,29 +5840,29 @@ function go() {
5801
5840
  sharePromptsDisabled: !1
5802
5841
  };
5803
5842
  }
5804
- function Or(e, t) {
5843
+ function $r(e, t) {
5805
5844
  try {
5806
5845
  window.localStorage.setItem(
5807
- fn(e),
5846
+ xn(e),
5808
5847
  JSON.stringify(t)
5809
5848
  );
5810
5849
  } catch {
5811
5850
  return;
5812
5851
  }
5813
5852
  }
5814
- function Ur(e) {
5853
+ function qr(e) {
5815
5854
  if (!e || typeof e != "object")
5816
5855
  return !1;
5817
5856
  const t = e;
5818
5857
  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");
5819
5858
  }
5820
- function Br(e) {
5859
+ function jr(e) {
5821
5860
  if (!e || typeof e != "object")
5822
5861
  return !1;
5823
5862
  const t = e;
5824
5863
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5825
5864
  }
5826
- async function Go(e, t) {
5865
+ async function Ko(e, t) {
5827
5866
  const n = await fetch(e, {
5828
5867
  method: "POST",
5829
5868
  credentials: "include",
@@ -5835,7 +5874,7 @@ async function Go(e, t) {
5835
5874
  ...t ? { signal: t } : {}
5836
5875
  });
5837
5876
  if (!n.ok) {
5838
- const i = await n.text(), r = di(i);
5877
+ const i = await n.text(), r = fi(i);
5839
5878
  throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
5840
5879
  }
5841
5880
  const o = await n.json();
@@ -5843,15 +5882,15 @@ async function Go(e, t) {
5843
5882
  throw new Error("Pluno token endpoint did not return a token");
5844
5883
  return o.token;
5845
5884
  }
5846
- function Fr(e) {
5885
+ function Vr(e) {
5847
5886
  let t = !1, n = !1;
5848
5887
  const o = async () => {
5849
5888
  const i = new AbortController();
5850
5889
  let r = !1;
5851
5890
  const l = new Promise((p, s) => {
5852
5891
  const g = window.setTimeout(() => {
5853
- r = !0, i.abort(), s(new Error(Fn));
5854
- }, ji);
5892
+ r = !0, i.abort(), s(new Error($n));
5893
+ }, Ji);
5855
5894
  i.signal.addEventListener(
5856
5895
  "abort",
5857
5896
  () => window.clearTimeout(g),
@@ -5860,12 +5899,12 @@ function Fr(e) {
5860
5899
  });
5861
5900
  try {
5862
5901
  const p = await Promise.race([
5863
- Go(e, i.signal),
5902
+ Ko(e, i.signal),
5864
5903
  l
5865
5904
  ]);
5866
5905
  return i.abort(), p;
5867
5906
  } catch (p) {
5868
- throw i.abort(), r ? new Error(Fn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Vi);
5907
+ throw i.abort(), r ? new Error($n) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Qi);
5869
5908
  }
5870
5909
  };
5871
5910
  return {
@@ -5888,30 +5927,30 @@ function Fr(e) {
5888
5927
  }
5889
5928
  };
5890
5929
  }
5891
- const ho = /* @__PURE__ */ new WeakSet();
5892
- function Wr(e) {
5930
+ const bo = /* @__PURE__ */ new WeakSet();
5931
+ function Kr(e) {
5893
5932
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5894
5933
  }
5895
- function mo(e) {
5934
+ function _o(e) {
5896
5935
  const t = e.pathname.split("/");
5897
5936
  return t[t.length - 1] ?? "";
5898
5937
  }
5899
- function Hr(e, t) {
5938
+ function Yr(e, t) {
5900
5939
  const n = new URL(e.src, document.baseURI);
5901
- return n.href === t.href || n.pathname === t.pathname ? !0 : mo(n) === mo(t);
5940
+ return n.href === t.href || n.pathname === t.pathname ? !0 : _o(n) === _o(t);
5902
5941
  }
5903
5942
  class fe extends EventTarget {
5904
5943
  constructor(t, n) {
5905
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Wi, () => {
5944
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Vi, () => {
5906
5945
  this.readyState = fe.OPEN, this.dispatchEvent(new Event("open"));
5907
- }), this.addPreviewListener(Hi, (o) => {
5946
+ }), this.addPreviewListener(Ki, (o) => {
5908
5947
  const i = o;
5909
5948
  this.dispatchEvent(
5910
5949
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5911
5950
  );
5912
- }), this.addPreviewListener($i, () => {
5951
+ }), this.addPreviewListener(Yi, () => {
5913
5952
  this.readyState = fe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5914
- }), this.addPreviewListener(Gi, (o) => {
5953
+ }), this.addPreviewListener(Xi, (o) => {
5915
5954
  const i = o;
5916
5955
  this.readyState = fe.CLOSED, this.dispatchEvent(
5917
5956
  new CloseEvent("close", {
@@ -5922,8 +5961,8 @@ class fe extends EventTarget {
5922
5961
  ), this.cleanup();
5923
5962
  }), window.dispatchEvent(
5924
5963
  new CustomEvent(
5925
- ht(
5926
- Ui,
5964
+ bt(
5965
+ $i,
5927
5966
  this.channelId
5928
5967
  ),
5929
5968
  {
@@ -5943,7 +5982,7 @@ class fe extends EventTarget {
5943
5982
  binaryType = "blob";
5944
5983
  bufferedAmount = 0;
5945
5984
  readyState = fe.CONNECTING;
5946
- socketId = $r();
5985
+ socketId = Xr();
5947
5986
  listeners = /* @__PURE__ */ new Map();
5948
5987
  send(t) {
5949
5988
  if (this.readyState !== fe.OPEN)
@@ -5953,7 +5992,7 @@ class fe extends EventTarget {
5953
5992
  );
5954
5993
  window.dispatchEvent(
5955
5994
  new CustomEvent(
5956
- ht(Bi, this.channelId),
5995
+ bt(qi, this.channelId),
5957
5996
  {
5958
5997
  detail: {
5959
5998
  socketId: this.socketId,
@@ -5966,7 +6005,7 @@ class fe extends EventTarget {
5966
6005
  close(t, n) {
5967
6006
  this.readyState !== fe.CLOSED && (this.readyState = fe.CLOSING, window.dispatchEvent(
5968
6007
  new CustomEvent(
5969
- ht(Fi, this.channelId),
6008
+ bt(ji, this.channelId),
5970
6009
  {
5971
6010
  detail: { socketId: this.socketId, code: t, reason: n }
5972
6011
  }
@@ -5974,7 +6013,7 @@ class fe extends EventTarget {
5974
6013
  ), this.cleanup());
5975
6014
  }
5976
6015
  addPreviewListener(t, n) {
5977
- const o = ht(
6016
+ const o = bt(
5978
6017
  t,
5979
6018
  this.channelId
5980
6019
  ), i = (r) => {
@@ -5988,19 +6027,19 @@ class fe extends EventTarget {
5988
6027
  this.listeners.clear();
5989
6028
  }
5990
6029
  }
5991
- function $r() {
6030
+ function Xr() {
5992
6031
  const e = window.sessionStorage.getItem(
5993
- Bn
6032
+ Gn
5994
6033
  );
5995
6034
  if (e)
5996
6035
  return e;
5997
6036
  const t = crypto.randomUUID();
5998
- return window.sessionStorage.setItem(Bn, t), t;
6037
+ return window.sessionStorage.setItem(Gn, t), t;
5999
6038
  }
6000
- function ht(e, t) {
6039
+ function bt(e, t) {
6001
6040
  return `${e}:${t}`;
6002
6041
  }
6003
- function Gr(e) {
6042
+ function Zr(e) {
6004
6043
  const t = document.currentScript;
6005
6044
  if (t instanceof HTMLScriptElement)
6006
6045
  return [t];
@@ -6008,35 +6047,35 @@ function Gr(e) {
6008
6047
  return Array.from(
6009
6048
  document.querySelectorAll("script[type='module'][src]")
6010
6049
  ).filter(
6011
- (i) => i instanceof HTMLScriptElement && Wr(i) && Hr(i, o)
6050
+ (i) => i instanceof HTMLScriptElement && Kr(i) && Yr(i, o)
6012
6051
  );
6013
6052
  }
6014
- function qr(e) {
6015
- for (const t of Gr(e))
6016
- ho.has(t) || t.dataset.plunoAutoMount === "false" || (ho.add(t), qo(t).catch((n) => {
6053
+ function Jr(e) {
6054
+ for (const t of Zr(e))
6055
+ bo.has(t) || t.dataset.plunoAutoMount === "false" || (bo.add(t), Yo(t).catch((n) => {
6017
6056
  console.error("Failed to mount Pluno widget", n);
6018
6057
  }));
6019
6058
  }
6020
- function qo(e) {
6059
+ function Yo(e) {
6021
6060
  const t = window, n = t[me];
6022
6061
  if (n) {
6023
6062
  if (n.host === null)
6024
6063
  return n.mountPromise.catch(() => {
6025
6064
  const s = t[me];
6026
- return s ? s.mountPromise : qo(e);
6065
+ return s ? s.mountPromise : Yo(e);
6027
6066
  });
6028
- if (jr(n.host))
6067
+ if (Qr(n.host))
6029
6068
  return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
6030
6069
  n.destroy?.(), delete t[me];
6031
6070
  }
6032
- const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Fr(i) : null;
6071
+ const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Vr(i) : null;
6033
6072
  let l;
6034
- const p = ha({
6073
+ const p = xa({
6035
6074
  token: e.dataset.plunoToken,
6036
6075
  tokenProvider: r?.loadToken,
6037
6076
  tokenEndpoint: i,
6038
6077
  backendUrl: e.dataset.plunoBackendUrl,
6039
- webSocketFactory: o ? ga(o) : void 0,
6078
+ webSocketFactory: o ? _a(o) : void 0,
6040
6079
  launcherLabel: e.dataset.plunoLauncherLabel,
6041
6080
  accentColor: e.dataset.plunoAccentColor,
6042
6081
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -6049,7 +6088,7 @@ function qo(e) {
6049
6088
  return;
6050
6089
  }
6051
6090
  const g = s.host;
6052
- g.setAttribute(xo, "true"), l.host = g, l.destroy = () => {
6091
+ g.setAttribute(Co, "true"), l.host = g, l.destroy = () => {
6053
6092
  t[me] === l && delete t[me], l.host = null, l.destroy = null, s.destroy();
6054
6093
  };
6055
6094
  }).catch((s) => {
@@ -6062,11 +6101,11 @@ function qo(e) {
6062
6101
  retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
6063
6102
  }, t[me] = l, p;
6064
6103
  }
6065
- function jr(e) {
6066
- return e.isConnected && e.getAttribute(xo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6104
+ function Qr(e) {
6105
+ return e.isConnected && e.getAttribute(Co) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6067
6106
  }
6068
- qr(import.meta.url);
6107
+ Jr(import.meta.url);
6069
6108
  export {
6070
- ga as createProductAgentPreviewBridgeWebSocketFactory,
6071
- ha as mountPlunoProductAgentWidget
6109
+ _a as createProductAgentPreviewBridgeWebSocketFactory,
6110
+ xa as mountPlunoProductAgentWidget
6072
6111
  };