@pluno/product-agent-web 0.1.44 → 0.1.46

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 Mn } from "./product-agent-sdk.js";
2
- const Bn = "#7c3aed", Be = "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", Oe = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
3
- function Qt(e) {
4
- const t = en(e);
5
- if (kt(ke(t), Et) >= St)
1
+ import { PlunoProductAgent as Un } from "./product-agent-sdk.js";
2
+ const Fn = "#7c3aed", Ue = "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", Fe = "#2c2a1e", kt = [253, 250, 241], Lt = 3.5;
3
+ function tn(e) {
4
+ const t = nn(e);
5
+ if (Pt(Le(t), kt) >= Lt)
6
6
  return t;
7
- let o = ke(t);
8
- const a = ke(Oe);
7
+ let o = Le(t);
8
+ const a = Le(Fe);
9
9
  for (let i = 0; i < 6; i += 1)
10
- if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
11
- return tt(o);
12
- return tt(o);
10
+ if (o = Hn(o, a, 0.22), Pt(o, kt) >= Lt)
11
+ return ot(o);
12
+ return ot(o);
13
13
  }
14
- function On() {
14
+ function zn() {
15
15
  let n = "M 280 120", o = !1, a = 0;
16
16
  for (let i = 150; i <= 1170; i += 62) {
17
17
  const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
@@ -19,8 +19,8 @@ function On() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function Un(e) {
23
- const t = en(e), n = nt(ke(t));
22
+ function Gn(e) {
23
+ const t = nn(e), n = at(Le(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,34 +56,34 @@ function Un(e) {
56
56
  shadow: V(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function en(e) {
59
+ function nn(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()}` : Bn;
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()}` : Fn;
62
62
  }
63
- function ke(e) {
63
+ function Le(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 tt([e, t, n]) {
70
+ function ot([e, t, n]) {
71
71
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function nt([e, t, n]) {
74
+ function at([e, t, n]) {
75
75
  const o = (a) => {
76
76
  const i = a / 255;
77
77
  return i <= 0.04045 ? i / 12.92 : ((i + 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 kt(e, t) {
82
- const n = nt(e), o = nt(t), [a, i] = n > o ? [n, o] : [o, n];
81
+ function Pt(e, t) {
82
+ const n = at(e), o = at(t), [a, i] = n > o ? [n, o] : [o, n];
83
83
  return (a + 0.05) / (i + 0.05);
84
84
  }
85
- function Fn(e, t, n) {
86
- const o = ot(n);
85
+ function Hn(e, t, n) {
86
+ const o = it(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 Fn(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function V(e, t, n) {
94
- const [o, a, i] = zn(ke(e));
95
- return tt(Gn(o, ot(a + n), ot(i + t)));
94
+ const [o, a, i] = Wn(Le(e));
95
+ return ot($n(o, it(a + n), it(i + t)));
96
96
  }
97
- function zn([e, t, n]) {
97
+ function Wn([e, t, n]) {
98
98
  const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, c];
101
101
  const u = l - p, s = c > 0.5 ? u / (2 - l - p) : u / (l + p);
102
102
  return [(l === o ? (a - i) / u + (a < i ? 6 : 0) : l === a ? (i - o) / u + 2 : (o - a) / u + 4) / 6, s, c];
103
103
  }
104
- function Gn(e, t, n) {
104
+ function $n(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, a = 2 * n - o;
108
108
  return [
109
- Xe(a, o, e + 1 / 3) * 255,
110
- Xe(a, o, e) * 255,
111
- Xe(a, o, e - 1 / 3) * 255
109
+ Je(a, o, e + 1 / 3) * 255,
110
+ Je(a, o, e) * 255,
111
+ Je(a, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function Xe(e, t, n) {
114
+ function Je(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 ot(e) {
118
+ function it(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const tn = "suggest_share_on_socials";
122
- function Hn(e) {
121
+ const on = "suggest_share_on_socials";
122
+ function qn(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 !== tn)
125
+ if (n.role !== "tool" || n.toolName !== on)
126
126
  continue;
127
- const o = Lt(e, t, "assistant");
127
+ const o = At(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const a = Lt(e, o.index, "user");
130
+ const a = At(e, o.index, "user");
131
131
  return a ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: a.content,
@@ -136,13 +136,13 @@ function Hn(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Wn(e) {
140
- const t = await $n(e);
139
+ async function jn(e) {
140
+ const t = await Vn(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 Lt(e, t, n) {
145
+ function At(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
147
  const a = e[o];
148
148
  if (a.role === n && a.content.trim())
@@ -150,18 +150,18 @@ function Lt(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function $n(e) {
153
+ async function Vn(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const qn = "https://app.pluno.ai", jn = "/api/product-agent/embed/active-users", Vn = 1800, Yn = 15e3, Kn = 250, Xn = 1e3, Zn = 3e4;
157
- function Jn(e, t = {}) {
156
+ const Yn = "https://app.pluno.ai", Kn = "/api/product-agent/embed/active-users", Xn = 1800, Zn = 15e3, Jn = 250, Qn = 1e3, eo = 3e4;
157
+ function to(e, t = {}) {
158
158
  let n = !1, o = null, a = null, i = null;
159
159
  const l = () => {
160
160
  i !== null && (window.clearInterval(i), i = null);
161
161
  }, p = (s) => {
162
162
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
163
163
  u();
164
- }, to(s)));
164
+ }, ao(s)));
165
165
  }, c = (s) => {
166
166
  if (l(), o === null) {
167
167
  o = s, e(s);
@@ -173,50 +173,50 @@ function Jn(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const P = Math.min(1, (performance.now() - x) / Vn);
177
- o = Math.round(b + (s - b) * no(P)), e(o), P >= 1 && (o = s, e(s), l());
178
- }, Kn);
176
+ const P = Math.min(1, (performance.now() - x) / Xn);
177
+ o = Math.round(b + (s - b) * io(P)), e(o), P >= 1 && (o = s, e(s), l());
178
+ }, Jn);
179
179
  }, u = async () => {
180
180
  try {
181
- const s = await Qn(t);
181
+ const s = await no(t);
182
182
  if (n)
183
183
  return;
184
184
  c(s.count), p(s.refreshAfterMs);
185
185
  } catch {
186
- p(Yn);
186
+ p(Zn);
187
187
  }
188
188
  };
189
189
  return u(), () => {
190
190
  n = !0, a !== null && window.clearTimeout(a), l();
191
191
  };
192
192
  }
193
- async function Qn(e) {
193
+ async function no(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(jn, eo(e.backendUrl ?? qn)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(Kn, oo(e.backendUrl ?? Yn)).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(), a = Pt(o.count), i = Pt(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), a = Tt(o.count), i = Tt(o.refreshAfterMs ?? o.refresh_after_ms);
203
203
  if (a === null || i === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: a, refreshAfterMs: i };
206
206
  }
207
- function Pt(e) {
207
+ function Tt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function eo(e) {
210
+ function oo(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function to(e) {
214
- return Math.min(Zn, Math.max(Xn, e));
213
+ function ao(e) {
214
+ return Math.min(eo, Math.max(Qn, e));
215
215
  }
216
- function no(e) {
216
+ function io(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Ue = 10, uo = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), go = Array.from(an).join(","), ho = 3, mo = "No recent chats for this page yet.", K = {
219
+ const an = 100, ro = "product-agent:sdk-preview-socket-connect", lo = "product-agent:sdk-preview-socket-send", po = "product-agent:sdk-preview-socket-close", so = "product-agent:sdk-preview-socket-open", co = "product-agent:sdk-preview-socket-message", uo = "product-agent:sdk-preview-socket-error", go = "product-agent:sdk-preview-socket-closed", Nt = "product-agent:sdk-preview-socket-id", ho = "data-pluno-sdk-preview-channel", mo = "product-agent:preview-diagnostic", rn = "pluno.productAgent.sharePromptsDisabled", ze = 10, bo = 10 * 1024 * 1024, ln = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), fo = Array.from(ln).join(","), wo = 3, _o = "No recent chats for this page yet.", K = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-a
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, bo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, fo = 48, wo = 420, _o = 520, xo = 0.24, yo = 680, vo = 800, Co = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
227
+ }, xo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', It = "pluno-pa-scribble-font", pn = 190, sn = 41, yo = 48, vo = 420, Co = 520, Eo = 0.24, So = 680, ko = 800, Lo = 0.76, z = 8, rt = 50, dn = "http://www.w3.org/2000/svg", Dt = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,12 +261,12 @@ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-a
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], Eo = 11, So = 13, It = 4, ko = 10, Lo = 40, Po = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
265
- let Dt = 0;
266
- function Ao(e) {
264
+ ], Po = 11, Ao = 13, Rt = 4, To = 10, No = 40, Io = "movable-launcher-position-v2", cn = "pluno-pa-widget-styles", un = "data-pluno-pa-widget-styles";
265
+ let Mt = 0;
266
+ function Do(e) {
267
267
  return (t) => new te(t, e);
268
268
  }
269
- async function To(e = {}) {
269
+ async function Ro(e = {}) {
270
270
  const t = {
271
271
  launcherLabel: e.launcherLabel ?? K.launcherLabel,
272
272
  accentColor: e.accentColor ?? K.accentColor,
@@ -299,7 +299,8 @@ async function To(e = {}) {
299
299
  activeUsersLoader: e.activeUsersLoader,
300
300
  socialPostRewardsUrl: e.socialPostRewardsUrl,
301
301
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
302
- persistSharePromptsDisabled: e.persistSharePromptsDisabled
302
+ persistSharePromptsDisabled: e.persistSharePromptsDisabled,
303
+ sdkPreviewChannelId: e.sdkPreviewChannelId
303
304
  };
304
305
  Y("web-sdk.widget", "Mounting widget with merged options", {
305
306
  accentColor: t.accentColor,
@@ -313,13 +314,13 @@ async function To(e = {}) {
313
314
  initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
314
315
  });
315
316
  const n = document.createElement("div");
316
- n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
317
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(ho, t.sdkPreviewChannelId);
317
318
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
318
319
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
319
- let i = Rt(t.accentColor, t.scribbleStyle);
320
- Xo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
321
- const l = await qa(), p = l.ownerDocument;
322
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Kt(o, t.accentColor), Mt(a, i, {
320
+ let i = Bt(t.accentColor, t.scribbleStyle);
321
+ ea(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
322
+ const l = await Ka(), p = l.ownerDocument;
323
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Zt(o, t.accentColor), Ot(a, i, {
323
324
  accentColor: t.accentColor,
324
325
  colorScheme: t.colorScheme,
325
326
  fontFamily: t.fontFamily,
@@ -330,18 +331,18 @@ async function To(e = {}) {
330
331
  fontFamily: t.fontFamily,
331
332
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
332
333
  });
333
- const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), P = a.querySelector(".pluno-pa-widget__composer"), k = a.querySelector(".pluno-pa-widget__attachment-error"), O = a.querySelector(".pluno-pa-widget__billing-status"), y = a.querySelector(".pluno-pa-widget__attachments"), C = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), E = a.querySelector(".pluno-pa-widget__send"), I = a.querySelector(".pluno-pa-widget__new-chat"), le = a.querySelector(".pluno-pa-widget__history"), xe = a.querySelector(".pluno-pa-widget__history-panel"), R = a.querySelector(".pluno-pa-widget__history-list"), _ = a.querySelector(".pluno-pa-widget__history-close"), L = a.querySelector(".pluno-pa-widget__history-status"), G = a.querySelector(".pluno-pa-widget__timeline-jump"), M = a.querySelector(".pluno-pa-widget__active-users-counter"), f = a.querySelector(".pluno-pa-widget__timeline"), A = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
334
- if (!c || !s || !b || !x || !P || !k || !O || !y || !C || !h || !g || !E || !I || !le || !xe || !R || !_ || !L || !G || !M || !f || !A)
334
+ const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), P = a.querySelector(".pluno-pa-widget__composer"), k = a.querySelector(".pluno-pa-widget__attachment-error"), B = a.querySelector(".pluno-pa-widget__billing-status"), y = a.querySelector(".pluno-pa-widget__attachments"), C = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), E = a.querySelector(".pluno-pa-widget__send"), F = a.querySelector(".pluno-pa-widget__top-actions"), le = a.querySelector(".pluno-pa-widget__history"), ye = a.querySelector(".pluno-pa-widget__history-panel"), D = a.querySelector(".pluno-pa-widget__history-list"), _ = a.querySelector(".pluno-pa-widget__history-close"), L = a.querySelector(".pluno-pa-widget__history-status"), G = a.querySelector(".pluno-pa-widget__timeline-jump"), R = a.querySelector(".pluno-pa-widget__active-users-counter"), f = a.querySelector(".pluno-pa-widget__timeline"), A = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
335
+ if (!c || !s || !b || !x || !P || !k || !B || !y || !C || !h || !g || !E || !F || !le || !ye || !D || !_ || !L || !G || !R || !f || !A)
335
336
  throw new Error("Failed to mount Pluno widget");
336
337
  if (t.movableLauncher && !u)
337
338
  throw new Error("Failed to mount Pluno widget drag handle");
338
- zt(s), zt(g);
339
+ Ht(s), Ht(g);
339
340
  let T = [], J = null;
340
341
  const me = () => {
341
- ma(y, T, (r) => {
342
- T = T.filter((d, S) => S !== r), me(), U(w.getState()), W();
342
+ _a(y, T, (r) => {
343
+ T = T.filter((d, S) => S !== r), me(), O(w.getState()), W();
343
344
  });
344
- }, En = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
345
+ }, kn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
345
346
  if (!t.tokenEndpoint)
346
347
  throw new Error("Pluno widget requires token or tokenEndpoint");
347
348
  const r = await fetch(t.tokenEndpoint, {
@@ -356,11 +357,11 @@ async function To(e = {}) {
356
357
  if (!d.token)
357
358
  throw new Error("Pluno token endpoint did not return a token");
358
359
  return d.token;
359
- }), Sn = window.fetch.bind(window);
360
+ }), Ln = window.fetch.bind(window);
360
361
  let w;
361
- w = await Mn.init({
362
+ w = await Un.init({
362
363
  token: t.token,
363
- tokenProvider: En,
364
+ tokenProvider: kn,
364
365
  backendUrl: t.backendUrl,
365
366
  metadata: () => ({
366
367
  ...t.metadata ?? {},
@@ -373,82 +374,82 @@ async function To(e = {}) {
373
374
  webSocketFactory: t.webSocketFactory,
374
375
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
375
376
  });
376
- const pe = ja(t), ze = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
377
- let Ge = pe.sharePromptsDisabled || await Va(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, He = !1, se = !1, de = {
377
+ const pe = Xa(t), He = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Pe = new Set(be);
378
+ let We = pe.sharePromptsDisabled || await Za(t), Q = t.movableLauncher ? pe.launcherPosition : null, ut = Q !== null, oe = null, Ae = !1, se = !1, de = {
378
379
  enabled: !0
379
- }, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
380
+ }, ce = 0, gt = "", ae = !1, ee = !1, ie = [], $e = null, ve = null;
380
381
  const q = (r, d) => {
381
382
  de = { enabled: r, reason: d };
382
383
  }, j = () => {
383
384
  G.hidden = !0;
384
- }, kn = () => {
385
+ }, Pn = () => {
385
386
  G.hidden = !1;
386
- }, Ln = (r = "jump") => {
387
- q(!0, r), j(), Se(f, () => de.enabled), ce = f.scrollTop;
387
+ }, An = (r = "jump") => {
388
+ q(!0, r), j(), ke(f, () => de.enabled), ce = f.scrollTop;
388
389
  }, ue = () => {
389
- if (le.hidden = t.loginRequired, xe.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), R.classList.toggle(
390
+ if (le.hidden = t.loginRequired, ye.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), D.classList.toggle(
390
391
  "pluno-pa-widget__history-list--center",
391
392
  ee && ie.length === 0
392
- ), R.replaceChildren(), ee && ie.length === 0) {
393
+ ), D.replaceChildren(), ee && ie.length === 0) {
393
394
  const r = document.createElement("p");
394
- r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", R.appendChild(r);
395
+ r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", D.appendChild(r);
395
396
  }
396
397
  for (const r of ie) {
397
398
  const d = document.createElement("button");
398
399
  d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
399
400
  const S = document.createElement("span");
400
- S.className = "pluno-pa-widget__history-item-title", S.textContent = Vo(r);
401
- const B = document.createElement("time");
402
- B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Ko(r.lastActiveAt, Date.now());
401
+ S.className = "pluno-pa-widget__history-item-title", S.textContent = Zo(r);
402
+ const M = document.createElement("time");
403
+ M.className = "pluno-pa-widget__history-time", M.dateTime = r.lastActiveAt, M.textContent = Qo(r.lastActiveAt, Date.now());
403
404
  const N = document.createElement("small");
404
- N.className = "pluno-pa-widget__history-path", N.textContent = Yo(r), d.append(S, B, N), d.addEventListener("click", () => {
405
- ae = !1, ye = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), U(w.getState());
406
- }), R.appendChild(d);
405
+ N.className = "pluno-pa-widget__history-path", N.textContent = Jo(r), d.append(S, M, N), d.addEventListener("click", () => {
406
+ ae = !1, ve = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), O(w.getState());
407
+ }), D.appendChild(d);
407
408
  }
408
409
  if (ee && ie.length > 0) {
409
410
  const r = document.createElement("p");
410
- r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", R.appendChild(r);
411
+ r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", D.appendChild(r);
411
412
  }
412
- L.textContent = ye ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
413
- }, ut = async (r) => {
413
+ L.textContent = ve ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
414
+ }, ht = async (r) => {
414
415
  if (!ee) {
415
- ee = !0, ye = null, ue();
416
+ ee = !0, ve = null, ue();
416
417
  try {
417
418
  const d = await w.listSessions({ cursor: r, limit: 20 });
418
- ie = r ? [...ie, ...d.sessions] : d.sessions, We = d.nextCursor;
419
+ ie = r ? [...ie, ...d.sessions] : d.sessions, $e = d.nextCursor;
419
420
  } catch (d) {
420
421
  Y("web-sdk.widget", "Failed to load session history", {
421
422
  message: d instanceof Error ? d.message : String(d)
422
- }), ye = mo;
423
+ }), ve = _o;
423
424
  } finally {
424
425
  ee = !1, ue();
425
426
  }
426
427
  }
427
- }, Pn = () => {
428
- !We || ee || R.scrollHeight - R.scrollTop - R.clientHeight <= 24 && ut(We);
429
- }, An = () => {
430
- He || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
431
- }, gt = new MutationObserver(An);
432
- gt.observe(p.documentElement, { childList: !0, subtree: !0 });
433
- const $e = (r = !0) => {
434
- const d = it(a, r);
435
- return Bt(
428
+ }, Tn = () => {
429
+ !$e || ee || D.scrollHeight - D.scrollTop - D.clientHeight <= 24 && ht($e);
430
+ }, Nn = () => {
431
+ Ae || typeof document > "u" || (Zt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
432
+ }, mt = new MutationObserver(Nn);
433
+ mt.observe(p.documentElement, { childList: !0, subtree: !0 });
434
+ const qe = (r = !0) => {
435
+ const d = lt(a, r);
436
+ return Ut(
436
437
  a,
437
- Q ? Oo(Q, d) : Bo(a, t.position, d),
438
+ Q ? Go(Q, d) : zo(a, t.position, d),
438
439
  d
439
440
  );
440
441
  }, H = () => {
441
- Ka(t, {
442
+ Qa(t, {
442
443
  isOpen: a.classList.contains("pluno-pa-widget--open"),
443
444
  composerValue: g.value,
444
- openToolGroupKeys: [...ze],
445
- launcherPosition: dt ? Q : null,
446
- seenShareCandidateIds: [...be].slice(-nn),
447
- sharePromptsDisabled: Ge
445
+ openToolGroupKeys: [...He],
446
+ launcherPosition: ut ? Q : null,
447
+ seenShareCandidateIds: [...be].slice(-an),
448
+ sharePromptsDisabled: We
448
449
  });
449
450
  }, ge = (r, d = {}) => {
450
- $o(r, {
451
- debugVersion: Po,
451
+ Yo(r, {
452
+ debugVersion: Io,
452
453
  launcherPosition: Q,
453
454
  rootClasses: a.className,
454
455
  rootStyle: {
@@ -457,75 +458,75 @@ async function To(e = {}) {
457
458
  right: a.style.right,
458
459
  bottom: a.style.bottom
459
460
  },
460
- rootRect: Ze(a),
461
- launcherRect: Ze(c),
462
- panelRect: Ze(b),
461
+ rootRect: Qe(a),
462
+ launcherRect: Qe(c),
463
+ panelRect: Qe(b),
463
464
  viewport: ne(),
464
465
  panelHidden: b.hidden,
465
466
  closeHidden: x.hidden,
466
467
  ...d
467
468
  });
468
- }, Pe = (r = !0) => {
469
+ }, Te = (r = !0) => {
469
470
  if (!Q)
470
- return Ie(a, null), $e(r);
471
- const d = $e(r);
472
- return Ie(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
473
- }, ht = (r, d) => {
471
+ return Re(a, null), qe(r);
472
+ const d = qe(r);
473
+ return Re(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
474
+ }, bt = (r, d) => {
474
475
  if (!r || !d) {
475
- Wo(a);
476
+ Vo(a);
476
477
  return;
477
478
  }
478
- Ho(a, {
479
+ jo(a, {
479
480
  x: r.x - d.x,
480
481
  y: r.y - d.y
481
482
  });
482
- }, mt = () => {
483
- const r = Pe();
483
+ }, ft = () => {
484
+ const r = Te();
484
485
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
485
- const d = Ot(a, r, t.position);
486
- ht(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
486
+ const d = Ft(a, r, t.position);
487
+ bt(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
487
488
  } else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
488
489
  };
489
- let bt = () => {
490
+ let wt = () => {
490
491
  };
491
- window.addEventListener("resize", mt), t.movableLauncher && u ? (Pe(), bt = Mo({
492
+ window.addEventListener("resize", ft), t.movableLauncher && u ? (Te(), wt = Fo({
492
493
  root: a,
493
494
  launcher: c,
494
495
  launcherDragHandle: u,
495
- getPosition: () => $e(),
496
+ getPosition: () => qe(),
496
497
  setPosition: (r) => {
497
- const d = r, S = it(a), B = Bt(a, r, S);
498
- Q = Uo(B, S), Ie(a, B), ge("Dragging closed launcher", { requestedPosition: d });
498
+ const d = r, S = lt(a), M = Ut(a, r, S);
499
+ Q = Ho(M, S), Re(a, M), ge("Dragging closed launcher", { requestedPosition: d });
499
500
  },
500
501
  persist: () => {
501
- dt = !0, H(), ge("Persisted closed launcher drag position");
502
+ ut = !0, H(), ge("Persisted closed launcher drag position");
502
503
  }
503
- })) : Ie(a, null);
504
- let qe = !1;
505
- const ft = async () => {
506
- if (!(!t.billingStatusLoader || qe)) {
507
- qe = !0;
504
+ })) : Re(a, null);
505
+ let je = !1;
506
+ const _t = async () => {
507
+ if (!(!t.billingStatusLoader || je)) {
508
+ je = !0;
508
509
  try {
509
510
  const r = await t.billingStatusLoader();
510
- Ht(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, et(O, t.billingStatus, w.getState().lastErrorCode), W());
511
+ $t(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, nt(B, t.billingStatus, w.getState().lastErrorCode), W());
511
512
  } finally {
512
- qe = !1;
513
+ je = !1;
513
514
  }
514
515
  }
515
516
  }, he = (r = "", d = !0) => {
516
- ft(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
517
- const S = Pe(), B = Ot(a, S, t.position);
518
- if (ht(B, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: B, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
519
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
517
+ _t(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
518
+ const S = Te(), M = Ft(a, S, t.position);
519
+ if (bt(M, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: M, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
520
+ a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Se(g)), ke(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
520
521
  return;
521
522
  }
522
523
  window.requestAnimationFrame(() => {
523
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
524
- c.hidden = !0, Se(f, () => de.enabled), ce = f.scrollTop;
524
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Se(g)), ke(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
525
+ c.hidden = !0, ke(f, () => de.enabled), ce = f.scrollTop;
525
526
  }, 220);
526
527
  });
527
- }, Tn = () => {
528
- oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Pe(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
528
+ }, In = () => {
529
+ oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Te(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
529
530
  b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
530
531
  }, 220);
531
532
  };
@@ -542,25 +543,25 @@ async function To(e = {}) {
542
543
  return;
543
544
  const r = s.value;
544
545
  he(r), s.value = "";
545
- }), x.addEventListener("click", Tn), f.addEventListener("scroll", () => {
546
+ }), x.addEventListener("click", In), f.addEventListener("scroll", () => {
546
547
  f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
547
548
  }), G.addEventListener("click", () => {
548
- Ln();
549
+ An();
549
550
  });
550
- const wt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
551
+ const xt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
551
552
  ([r]) => {
552
553
  r?.isIntersecting && (q(!0, "bottom"), j());
553
554
  },
554
555
  { root: f, threshold: 0 }
555
556
  );
556
- wt?.observe(A);
557
- const Ae = () => t.loginRequired || t.signupRequired, _t = () => {
558
- const r = Ae();
557
+ xt?.observe(A);
558
+ const Ne = () => t.loginRequired || t.signupRequired, yt = () => {
559
+ const r = Ne();
559
560
  s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
560
561
  }, W = () => {
561
- E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Ae() || X(t.billingStatus);
562
+ E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Ne() || X(t.billingStatus);
562
563
  };
563
- _t(), P.addEventListener("submit", (r) => {
564
+ yt(), P.addEventListener("submit", (r) => {
564
565
  if (r.preventDefault(), t.loginRequired) {
565
566
  t.onLoginClick?.();
566
567
  return;
@@ -569,45 +570,45 @@ async function To(e = {}) {
569
570
  t.onSignupClick?.();
570
571
  return;
571
572
  }
572
- X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W());
573
+ X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W());
573
574
  });
574
- let ve = 0;
575
- const Nn = () => {
576
- ve = 0, a.classList.remove("pluno-pa-widget--drag-over");
577
- }, xt = (r) => {
575
+ let Ce = 0;
576
+ const Dn = () => {
577
+ Ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
578
+ }, vt = (r) => {
578
579
  J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
579
580
  k.textContent = "", k.hidden = !0, J = null;
580
581
  }, 3e3);
581
- }, In = () => {
582
+ }, Rn = () => {
582
583
  J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
583
- }, yt = async (r) => {
584
+ }, Ct = async (r) => {
584
585
  if (r.length === 0)
585
586
  return;
586
- const d = await _a(r);
587
- if (T.length + d.length > Ue)
588
- throw new Error(`Attach up to ${Ue} files per message.`);
589
- T = [...T, ...d], me(), In(), W(), U(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
587
+ const d = await Ca(r);
588
+ if (T.length + d.length > ze)
589
+ throw new Error(`Attach up to ${ze} files per message.`);
590
+ T = [...T, ...d], me(), Rn(), W(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
590
591
  };
591
592
  h.addEventListener("click", () => {
592
593
  t.loginRequired || X(t.billingStatus) || C.click();
593
594
  }), C.addEventListener("change", () => {
594
595
  const r = Array.from(C.files ?? []);
595
- C.value = "", yt(r).catch((d) => {
596
- xt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
596
+ C.value = "", Ct(r).catch((d) => {
597
+ vt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
597
598
  message: d instanceof Error ? d.message : String(d)
598
599
  });
599
600
  });
600
601
  }), a.addEventListener("dragenter", (r) => {
601
- !De(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
602
+ !Me(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
602
603
  }), a.addEventListener("dragover", (r) => {
603
604
  const d = r.dataTransfer;
604
- !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
605
+ !Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
605
606
  }), a.addEventListener("dragleave", (r) => {
606
- De(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
607
+ Me(r.dataTransfer) && (r.stopPropagation(), Ce = Math.max(0, Ce - 1), Ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
607
608
  }), a.addEventListener("drop", (r) => {
608
609
  const d = r.dataTransfer;
609
- !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
610
- xt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
610
+ !Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Dn(), Ct(d.files).catch((S) => {
611
+ vt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
611
612
  message: S instanceof Error ? S.message : String(S)
612
613
  });
613
614
  }));
@@ -620,36 +621,44 @@ async function To(e = {}) {
620
621
  w.stop();
621
622
  return;
622
623
  }
623
- se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
624
- }), I.addEventListener("click", () => {
625
- se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), ze.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
624
+ se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
626
625
  }), le.addEventListener("click", () => {
627
- ae = !ae, ye = null, ue(), ae && ie.length === 0 && ut(null);
626
+ ae = !ae, ve = null, ue(), ae && ie.length === 0 && ht(null);
628
627
  }), _.addEventListener("click", () => {
629
628
  ae = !1, ue();
630
- }), R.addEventListener("scroll", Pn), g.addEventListener("input", () => {
631
- Ee(g), H(), W(), U(w.getState());
629
+ }), D.addEventListener("scroll", Tn), g.addEventListener("input", () => {
630
+ Se(g), H(), W(), O(w.getState());
632
631
  }), g.addEventListener("keydown", (r) => {
633
632
  if (!(r.key !== "Enter" || r.shiftKey)) {
634
633
  if (r.preventDefault(), t.loginRequired) {
635
634
  t.onLoginClick?.();
636
635
  return;
637
636
  }
638
- se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
637
+ se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
639
638
  }
640
639
  }), a.addEventListener("click", (r) => {
641
640
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
642
- }), pe.composerValue && (g.value = pe.composerValue, Ee(g)), pe.isOpen && he(g.value, !1);
643
- const Te = () => i;
644
- let je = w.getState().appearance !== null, Ne = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
641
+ }), pe.composerValue && (g.value = pe.composerValue, Se(g)), pe.isOpen && he(g.value, !1);
642
+ const Ie = () => i;
643
+ let Ve = w.getState().appearance !== null, De = null, Ee = null, fe = null, Et = w.getState().isThinking, we = null, Ye = null, St = () => {
645
644
  };
646
- const Dn = !!t.socialPostDraftHandler, U = (r) => {
647
- if (ue(), st(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(O, t.billingStatus, we), t.loginRequired) {
648
- qt(
645
+ const Mn = !!t.socialPostDraftHandler;
646
+ let _e = null;
647
+ const Bn = () => {
648
+ se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), He.clear(), g.value = "", T = [], me(), Se(g), H(), W(), g.focus(), O(w.getState());
649
+ }, Ke = (r) => {
650
+ if (!r) {
651
+ _e?.remove(), _e = null;
652
+ return;
653
+ }
654
+ _e || (_e = Ge("pluno-pa-widget__new-chat", "New chat", ca(), !1), _e.addEventListener("click", Bn), F.appendChild(_e));
655
+ }, O = (r) => {
656
+ if (ue(), ct(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(B, t.billingStatus, we), t.loginRequired) {
657
+ Vt(
649
658
  f,
650
659
  E,
651
- I,
652
- Te,
660
+ Ke,
661
+ Ie,
653
662
  "Log in to use Pluno on this page.",
654
663
  t.loginButtonLabel,
655
664
  t.loginUrl,
@@ -658,11 +667,11 @@ async function To(e = {}) {
658
667
  return;
659
668
  }
660
669
  if (t.signupRequired) {
661
- qt(
670
+ Vt(
662
671
  f,
663
672
  E,
664
- I,
665
- Te,
673
+ Ke,
674
+ Ie,
666
675
  "Complete signup to unlock your free trial credits.",
667
676
  t.signupButtonLabel,
668
677
  t.signupUrl,
@@ -670,73 +679,73 @@ async function To(e = {}) {
670
679
  );
671
680
  return;
672
681
  }
673
- const d = qo(r), S = d !== ct;
674
- ct = d;
675
- const B = se || de.enabled;
676
- se = !1, Na(
682
+ const d = Ko(r), S = d !== gt;
683
+ gt = d;
684
+ const M = se || de.enabled;
685
+ se = !1, Ma(
677
686
  f,
678
687
  A,
679
688
  E,
680
- I,
681
- M,
689
+ Ke,
690
+ R,
682
691
  r,
683
- Ve,
684
- Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
685
- B,
692
+ Ye,
693
+ Ye !== null && jt(r, g.value.trim().length > 0 || T.length > 0),
694
+ M,
686
695
  () => de.enabled,
687
- ze,
696
+ He,
688
697
  H,
689
- Te,
698
+ Ie,
690
699
  (N) => {
691
700
  se = !0, q(!0, "send"), j(), w.sendMessage(N);
692
701
  },
693
- Dn && !Ge ? {
694
- dismissedCandidateIds: Le,
695
- draftingCandidateId: Ne,
696
- error: Ce,
697
- characterIconOptions: Te(),
702
+ Mn && !We ? {
703
+ dismissedCandidateIds: Pe,
704
+ draftingCandidateId: De,
705
+ error: Ee,
706
+ characterIconOptions: Ie(),
698
707
  onSeen: (N) => {
699
708
  be.add(N.id), H();
700
709
  },
701
710
  onDraft: (N) => {
702
- Rn(N);
711
+ On(N);
703
712
  },
704
713
  onDismiss: (N) => {
705
- be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
714
+ be.add(N.id), Pe.add(N.id), H(), Ee = null, O(w.getState());
706
715
  },
707
716
  onDisable: (N) => {
708
- Ge = !0, be.add(N.id), Le.add(N.id), H(), Ya(t, !0), Ce = null, U(w.getState());
717
+ We = !0, be.add(N.id), Pe.add(N.id), H(), Ja(t, !0), Ee = null, O(w.getState());
709
718
  }
710
719
  } : void 0
711
- ), B ? (ce = f.scrollTop, j()) : S && jo(r) && kn();
720
+ ), M ? (ce = f.scrollTop, j()) : S && Xo(r) && Pn();
712
721
  };
713
- return Ct = Jn((r) => {
714
- Ve = r, !He && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
715
- }, { backendUrl: t.backendUrl, fetcher: Sn, loader: t.activeUsersLoader }), w.on("state", (r) => {
716
- const d = vt && !r.isThinking;
717
- vt = r.isThinking, r.appearance ? (je = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
722
+ return St = to((r) => {
723
+ Ye = r, !Ae && jt(w.getState(), g.value.trim().length > 0 || T.length > 0) && O(w.getState());
724
+ }, { backendUrl: t.backendUrl, fetcher: Ln, loader: t.activeUsersLoader }), w.on("state", (r) => {
725
+ const d = Et && !r.isThinking;
726
+ Et = r.isThinking, r.appearance ? (Ve = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
718
727
  appearance: r.appearance
719
- }), Ye(r.appearance, "agent.state.appearance")) : je && (je = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
728
+ }), Xe(r.appearance, "agent.state.appearance")) : Ve && (Ve = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
720
729
  fallbackAccentColor: t.accentColor,
721
730
  fallbackColorScheme: t.colorScheme,
722
731
  fallbackFontFamily: t.fontFamily
723
- }), Ye({}, "agent.state.appearance-cleared")), U(r), W(), d && ft();
724
- }), U(w.getState()), W(), {
732
+ }), Xe({}, "agent.state.appearance-cleared")), O(r), W(), d && _t();
733
+ }), O(w.getState()), W(), {
725
734
  agent: w,
726
735
  updateAppearance: (r) => {
727
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ye(r, "widgetHandle.updateAppearance");
736
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Xe(r, "widgetHandle.updateAppearance");
728
737
  },
729
738
  updateBillingStatus: (r) => {
730
739
  const d = r ?? null;
731
- Ht(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(
740
+ $t(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(
732
741
  a.querySelector(".pluno-pa-widget__billing-status"),
733
742
  t.billingStatus,
734
743
  we
735
744
  ), W());
736
745
  },
737
746
  updateAuthGate: (r) => {
738
- const d = Ae();
739
- t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), _t(), U(w.getState()), W(), d && !Ae() && w.connect().catch((S) => {
747
+ const d = Ne();
748
+ t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), yt(), O(w.getState()), W(), d && !Ne() && w.connect().catch((S) => {
740
749
  Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
741
750
  message: S instanceof Error ? S.message : String(S)
742
751
  });
@@ -746,57 +755,57 @@ async function To(e = {}) {
746
755
  he(g.value, !1);
747
756
  },
748
757
  destroy: () => {
749
- He = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove();
758
+ Ae || (Ae = !0, mt.disconnect(), xt?.disconnect(), window.removeEventListener("resize", ft), wt(), J !== null && window.clearTimeout(J), St(), fe?.remove(), w.destroy(), n.remove());
750
759
  }
751
760
  };
752
- async function Rn(r) {
753
- if (!Ne) {
754
- Ne = r.id, Ce = null, U(w.getState());
761
+ async function On(r) {
762
+ if (!De) {
763
+ De = r.id, Ee = null, O(w.getState());
755
764
  try {
756
765
  if (!t.socialPostDraftHandler)
757
766
  throw new Error("Social post drafting is not available here.");
758
767
  const d = await t.socialPostDraftHandler(r);
759
768
  if (!d.linkedinPost || !d.xPost)
760
769
  throw new Error("Pluno did not return a complete social post draft.");
761
- be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ra(d, {
770
+ be.add(r.id), Pe.add(r.id), H(), fe?.remove(), fe = Ua(d, {
762
771
  socialPostRewardsUrl: t.socialPostRewardsUrl,
763
772
  onClose: () => {
764
773
  fe?.remove(), fe = null;
765
774
  }
766
775
  }), a.appendChild(fe);
767
776
  } catch (d) {
768
- Ce = d instanceof Error ? d.message : "Could not draft social post.";
777
+ Ee = d instanceof Error ? d.message : "Could not draft social post.";
769
778
  } finally {
770
- Ne = null, U(w.getState());
779
+ De = null, O(w.getState());
771
780
  }
772
781
  }
773
782
  }
774
- function Ye(r, d) {
775
- const S = r.accentColor ?? t.accentColor, B = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ke = r.scribbleStyle ?? t.scribbleStyle;
776
- i = Rt(S, Ke), Mt(a, i, {
783
+ function Xe(r, d) {
784
+ const S = r.accentColor ?? t.accentColor, M = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ze = r.scribbleStyle ?? t.scribbleStyle;
785
+ i = Bt(S, Ze), Ot(a, i, {
777
786
  accentColor: S,
778
- colorScheme: B,
787
+ colorScheme: M,
779
788
  fontFamily: N,
780
- scribbleStyle: Ke
789
+ scribbleStyle: Ze
781
790
  }), Y("web-sdk.widget", "Updated widget appearance", {
782
791
  source: d,
783
792
  inputAppearance: r,
784
793
  appliedAccentColor: S,
785
- appliedColorScheme: B,
794
+ appliedColorScheme: M,
786
795
  appliedFontFamily: N,
787
- appliedScribbleStyle: Ke,
796
+ appliedScribbleStyle: Ze,
788
797
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
789
798
  });
790
799
  }
791
800
  }
792
- function Rt(e, t) {
801
+ function Bt(e, t) {
793
802
  return { accentColor: e, scribbleStyle: t };
794
803
  }
795
- function No(e) {
796
- const t = Io(e);
797
- return t === null ? "#fafafa" : Do(t) > 0.5 ? "#18181b" : "#fafaf9";
804
+ function Mo(e) {
805
+ const t = Bo(e);
806
+ return t === null ? "#fafafa" : Oo(t) > 0.5 ? "#18181b" : "#fafaf9";
798
807
  }
799
- function Io(e) {
808
+ function Bo(e) {
800
809
  const t = e.trim();
801
810
  return /^#[0-9a-f]{6}$/i.test(t) ? [
802
811
  Number.parseInt(t.slice(1, 3), 16),
@@ -808,26 +817,26 @@ function Io(e) {
808
817
  Number.parseInt(t[3] + t[3], 16)
809
818
  ] : null;
810
819
  }
811
- function Do([e, t, n]) {
820
+ function Oo([e, t, n]) {
812
821
  const o = (a) => {
813
822
  const i = a / 255;
814
823
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
815
824
  };
816
825
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
817
826
  }
818
- function Mt(e, t, n) {
827
+ function Ot(e, t, n) {
819
828
  e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
820
- const o = n.scribbleStyle ? Qt(n.accentColor) : n.accentColor;
821
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", No(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? bo : n.fontFamily, n.scribbleStyle && Ro(e.ownerDocument);
829
+ const o = n.scribbleStyle ? tn(n.accentColor) : n.accentColor;
830
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", Mo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? xo : n.fontFamily, n.scribbleStyle && Uo(e.ownerDocument);
822
831
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
823
832
  for (const i of a)
824
833
  i.replaceWith(re(Array.from(i.classList).join(" "), t));
825
834
  }
826
- function Ro(e) {
827
- if (e.getElementById(Tt))
835
+ function Uo(e) {
836
+ if (e.getElementById(It))
828
837
  return;
829
838
  const t = e.createElement("style");
830
- t.id = Tt, t.textContent = `@font-face {
839
+ t.id = It, t.textContent = `@font-face {
831
840
  font-family: "Architects Daughter";
832
841
  font-style: normal;
833
842
  font-weight: 400;
@@ -835,7 +844,7 @@ function Ro(e) {
835
844
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
836
845
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
837
846
  }
838
- function Mo({
847
+ function Fo({
839
848
  root: e,
840
849
  launcher: t,
841
850
  launcherDragHandle: n,
@@ -853,48 +862,48 @@ function Mo({
853
862
  return;
854
863
  h.preventDefault();
855
864
  const g = h.clientX - p.x, E = h.clientY - p.y;
856
- !u && Math.hypot(g, E) < It || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
865
+ !u && Math.hypot(g, E) < Rt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
857
866
  }, k = (h) => {
858
867
  l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
859
- }, O = (h) => {
868
+ }, B = (h) => {
860
869
  l === h.pointerId && (h.preventDefault(), b());
861
870
  }, y = (h) => {
862
871
  if (!s)
863
872
  return;
864
- const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= It;
873
+ const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= Rt;
865
874
  s = null, g && (h.preventDefault(), h.stopPropagation());
866
875
  }, C = (h) => {
867
876
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
868
877
  return;
869
- const g = h.shiftKey ? Lo : ko, E = o();
870
- let I = null;
871
- h.key === "ArrowUp" ? I = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? I = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? I = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (I = { x: E.x + g, y: E.y }), I && (h.preventDefault(), h.stopPropagation(), a(I), i());
878
+ const g = h.shiftKey ? No : To, E = o();
879
+ let F = null;
880
+ h.key === "ArrowUp" ? F = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? F = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? F = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (F = { x: E.x + g, y: E.y }), F && (h.preventDefault(), h.stopPropagation(), a(F), i());
872
881
  };
873
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel", O), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
874
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel", O), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
882
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel", B), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
883
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel", B), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
875
884
  };
876
885
  }
877
- function it(e, t = !0) {
886
+ function lt(e, t = !0) {
878
887
  const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
879
888
  return {
880
- width: t && a && o.width > 0 ? o.width : Math.min(rn, n.width - 36),
881
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? fo : ln
889
+ width: t && a && o.width > 0 ? o.width : Math.min(pn, n.width - 36),
890
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? yo : sn
882
891
  };
883
892
  }
884
- function cn() {
893
+ function gn() {
885
894
  const e = ne();
886
895
  return {
887
896
  width: Math.min(
888
- _e(e.width * xo, wo, _o),
897
+ xe(e.width * Eo, vo, Co),
889
898
  e.width - z * 2
890
899
  ),
891
900
  height: Math.min(
892
- _e(e.height * Co, yo, vo),
893
- e.height - at - z
901
+ xe(e.height * Lo, So, ko),
902
+ e.height - rt - z
894
903
  )
895
904
  };
896
905
  }
897
- function Bo(e, t, n) {
906
+ function zo(e, t, n) {
898
907
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
899
908
  if (Number.isFinite(o) && Number.isFinite(a))
900
909
  return { x: o, y: a };
@@ -907,73 +916,73 @@ function Bo(e, t, n) {
907
916
  y: l.height - 24 - n.height
908
917
  };
909
918
  }
910
- function Bt(e, t, n) {
911
- const o = ne(), a = z + zo(e);
919
+ function Ut(e, t, n) {
920
+ const o = ne(), a = z + $o(e);
912
921
  return {
913
- x: _e(t.x, z, Math.max(z, o.width - n.width - z)),
914
- y: _e(t.y, a, Math.max(a, o.height - n.height - z))
922
+ x: xe(t.x, z, Math.max(z, o.width - n.width - z)),
923
+ y: xe(t.y, a, Math.max(a, o.height - n.height - z))
915
924
  };
916
925
  }
917
- function Oo(e, t) {
926
+ function Go(e, t) {
918
927
  const n = ne();
919
928
  return {
920
929
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
921
930
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
922
931
  };
923
932
  }
924
- function Uo(e, t) {
925
- const n = Fo(e, t), o = ne();
933
+ function Ho(e, t) {
934
+ const n = Wo(e, t), o = ne();
926
935
  return {
927
936
  anchor: n,
928
937
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
929
938
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
930
939
  };
931
940
  }
932
- function Fo(e, t) {
941
+ function Wo(e, t) {
933
942
  const n = ne(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
934
943
  return `${i}-${l}`;
935
944
  }
936
- function zo(e) {
937
- return e.classList.contains("pluno-pa-widget--scribble") ? So : Eo;
945
+ function $o(e) {
946
+ return e.classList.contains("pluno-pa-widget--scribble") ? Ao : Po;
938
947
  }
939
- function Ot(e, t, n) {
940
- const o = it(e), a = cn(), i = {
948
+ function Ft(e, t, n) {
949
+ const o = lt(e), a = gn(), i = {
941
950
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
942
951
  y: t.y + o.height - a.height
943
952
  };
944
- return Go(i);
953
+ return qo(i);
945
954
  }
946
- function Go(e) {
947
- const t = ne(), n = cn();
955
+ function qo(e) {
956
+ const t = ne(), n = gn();
948
957
  return {
949
- x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
950
- y: _e(
958
+ x: xe(e.x, z, Math.max(z, t.width - n.width - z)),
959
+ y: xe(
951
960
  e.y,
952
- at,
953
- Math.max(at, t.height - n.height - z)
961
+ rt,
962
+ Math.max(rt, t.height - n.height - z)
954
963
  )
955
964
  };
956
965
  }
957
- function Ie(e, t) {
966
+ function Re(e, t) {
958
967
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
959
968
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
960
969
  return;
961
970
  }
962
971
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
963
972
  }
964
- function Ho(e, t) {
973
+ function jo(e, t) {
965
974
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
966
975
  }
967
- function Wo(e) {
976
+ function Vo(e) {
968
977
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
969
978
  }
970
979
  function ne() {
971
980
  return {
972
- width: window.innerWidth || document.documentElement.clientWidth || rn + z * 2,
973
- height: window.innerHeight || document.documentElement.clientHeight || ln + z * 2
981
+ width: window.innerWidth || document.documentElement.clientWidth || pn + z * 2,
982
+ height: window.innerHeight || document.documentElement.clientHeight || sn + z * 2
974
983
  };
975
984
  }
976
- function Ze(e) {
985
+ function Qe(e) {
977
986
  const t = e.getBoundingClientRect();
978
987
  return {
979
988
  x: Math.round(t.x),
@@ -982,7 +991,7 @@ function Ze(e) {
982
991
  height: Math.round(t.height)
983
992
  };
984
993
  }
985
- function _e(e, t, n) {
994
+ function xe(e, t, n) {
986
995
  return Math.min(Math.max(e, t), n);
987
996
  }
988
997
  function Y(e, t, n) {
@@ -994,26 +1003,26 @@ function Y(e, t, n) {
994
1003
  message: t,
995
1004
  details: n
996
1005
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
997
- i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(co, { detail: a }));
1006
+ i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(mo, { detail: a }));
998
1007
  }
999
- function $o(e, t) {
1008
+ function Yo(e, t) {
1000
1009
  Y("web-sdk.widget.position", e, t);
1001
1010
  }
1002
- function Je(e, t, n) {
1011
+ function et(e, t, n) {
1003
1012
  const o = t.value.trim();
1004
1013
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1005
1014
  }
1006
- function Ee(e) {
1015
+ function Se(e) {
1007
1016
  e.style.height = "0px";
1008
1017
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1009
1018
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1010
1019
  }
1011
- function Se(e, t = () => !0) {
1020
+ function ke(e, t = () => !0) {
1012
1021
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1013
1022
  t() && (e.scrollTop = e.scrollHeight);
1014
1023
  });
1015
1024
  }
1016
- function qo(e) {
1025
+ function Ko(e) {
1017
1026
  const t = e.messages[e.messages.length - 1];
1018
1027
  return [
1019
1028
  e.messages.length,
@@ -1024,13 +1033,13 @@ function qo(e) {
1024
1033
  e.lastError ?? ""
1025
1034
  ].join(":");
1026
1035
  }
1027
- function jo(e) {
1036
+ function Xo(e) {
1028
1037
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1029
1038
  }
1030
- function Vo(e) {
1039
+ function Zo(e) {
1031
1040
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1032
1041
  }
1033
- function Yo(e) {
1042
+ function Jo(e) {
1034
1043
  const t = e.currentPage;
1035
1044
  if (typeof t?.url == "string" && t.url.trim())
1036
1045
  try {
@@ -1041,7 +1050,7 @@ function Yo(e) {
1041
1050
  }
1042
1051
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1043
1052
  }
1044
- function Ko(e, t) {
1053
+ function Qo(e, t) {
1045
1054
  const n = new Date(e).getTime();
1046
1055
  if (!Number.isFinite(n))
1047
1056
  return "now";
@@ -1057,34 +1066,36 @@ function Ko(e, t) {
1057
1066
  }
1058
1067
  return "now";
1059
1068
  }
1060
- function Xo(e, t, n, o) {
1061
- e.appendChild(ia()), e.appendChild(Zo(t, n, o)), e.appendChild(Fe("pluno-pa-widget__close", "Close", ra(16), !0)), e.appendChild(Jo(n));
1069
+ function ea(e, t, n, o) {
1070
+ e.appendChild(sa()), e.appendChild(ta(t, n, o)), e.appendChild(Ge("pluno-pa-widget__close", "Close", da(16), !0)), e.appendChild(na(n));
1062
1071
  }
1063
- function Zo(e, t, n) {
1072
+ function ta(e, t, n) {
1064
1073
  const o = document.createElement("form");
1065
1074
  if (o.className = "pluno-pa-widget__launcher", n) {
1066
1075
  const i = document.createElement("button");
1067
1076
  i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
1068
1077
  }
1069
- o.appendChild(hn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
1078
+ o.appendChild(bn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
1070
1079
  const a = document.createElement("input");
1071
1080
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1072
1081
  }
1073
- function Jo(e) {
1082
+ function na(e) {
1074
1083
  const t = document.createElement("section");
1075
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(hn("pluno-pa-widget__scribble-spirals--panel", 16));
1084
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(bn("pluno-pa-widget__scribble-spirals--panel", 16));
1076
1085
  const n = document.createElement("div");
1077
1086
  n.className = "pluno-pa-widget__timeline-wrap";
1078
1087
  const o = document.createElement("main");
1079
- o.className = "pluno-pa-widget__timeline", o.appendChild(ta(e));
1088
+ o.className = "pluno-pa-widget__timeline", o.appendChild(ia(e));
1080
1089
  const a = document.createElement("div");
1081
1090
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1082
1091
  const i = document.createElement("div");
1083
1092
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1084
1093
  const l = document.createElement("button");
1085
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Fe("pluno-pa-widget__history", "Recent chats", pa(), !0)), n.appendChild(Fe("pluno-pa-widget__new-chat", "New chat", la(), !0)), n.appendChild(ea()), t.appendChild(n), t.appendChild(Qo()), t;
1094
+ l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1095
+ const p = document.createElement("div");
1096
+ return p.className = "pluno-pa-widget__top-actions", p.appendChild(Ge("pluno-pa-widget__history", "Recent chats", ua(), !0)), n.appendChild(p), n.appendChild(aa()), t.appendChild(n), t.appendChild(oa()), t;
1086
1097
  }
1087
- function Qo() {
1098
+ function oa() {
1088
1099
  const e = document.createElement("form");
1089
1100
  e.className = "pluno-pa-widget__composer";
1090
1101
  const t = document.createElement("div");
@@ -1096,13 +1107,13 @@ function Qo() {
1096
1107
  const a = document.createElement("div");
1097
1108
  a.className = "pluno-pa-widget__composer-inner";
1098
1109
  const i = document.createElement("input");
1099
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = go, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1110
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = fo, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1100
1111
  const l = document.createElement("button");
1101
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(da()), l.appendChild(ca()), a.appendChild(l);
1112
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ha()), l.appendChild(ma()), a.appendChild(l);
1102
1113
  const p = document.createElement("textarea");
1103
1114
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1104
1115
  const c = document.createElement("button");
1105
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(mn()), a.appendChild(c), e.appendChild(a);
1116
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(fn()), a.appendChild(c), e.appendChild(a);
1106
1117
  const u = document.createElement("div");
1107
1118
  u.className = "pluno-pa-widget__composer-meta";
1108
1119
  const s = document.createElement("a");
@@ -1110,44 +1121,44 @@ function Qo() {
1110
1121
  const b = document.createElement("span");
1111
1122
  return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1112
1123
  }
1113
- function ea() {
1124
+ function aa() {
1114
1125
  const e = document.createElement("section");
1115
1126
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1116
1127
  const t = document.createElement("div");
1117
1128
  t.className = "pluno-pa-widget__history-header";
1118
1129
  const n = document.createElement("strong");
1119
1130
  n.textContent = "Recent chats";
1120
- const o = Fe("pluno-pa-widget__history-close", "Close recent chats", sa(), !1);
1131
+ const o = Ge("pluno-pa-widget__history-close", "Close recent chats", ga(), !1);
1121
1132
  t.append(n, o);
1122
1133
  const a = document.createElement("div");
1123
1134
  a.className = "pluno-pa-widget__history-list";
1124
1135
  const i = document.createElement("p");
1125
1136
  return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1126
1137
  }
1127
- function ta(e) {
1138
+ function ia(e) {
1128
1139
  const t = document.createElement("div");
1129
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
1140
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(hn()), t;
1130
1141
  }
1131
- function un() {
1142
+ function hn() {
1132
1143
  const e = document.createElement("div");
1133
1144
  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;
1134
1145
  }
1135
- function na(e, t) {
1146
+ function ra(e, t) {
1136
1147
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1137
1148
  const n = document.createElement("span");
1138
1149
  n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
1139
1150
  }
1140
1151
  function re(e, t) {
1141
- const n = `pluno-pa-character-${Dt}`;
1142
- Dt += 1;
1143
- const o = t.scribbleStyle ? aa(t.accentColor, n) : oa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1152
+ const n = `pluno-pa-character-${Mt}`;
1153
+ Mt += 1;
1154
+ const o = t.scribbleStyle ? pa(t.accentColor, n) : la(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1144
1155
  return o.setAttribute(
1145
1156
  "class",
1146
1157
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1147
1158
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1148
1159
  }
1149
- function oa(e, t) {
1150
- const n = Un(e), o = {
1160
+ function la(e, t) {
1161
+ const n = Gn(e), o = {
1151
1162
  boltFill: `${t}-boltFill`,
1152
1163
  boltEdge: `${t}-boltEdge`,
1153
1164
  boltGlow: `${t}-boltGlow`,
@@ -1158,7 +1169,7 @@ function oa(e, t) {
1158
1169
  eyeShadow: `${t}-eyeShadow`,
1159
1170
  pupilGloss: `${t}-pupilGloss`,
1160
1171
  boltClip: `${t}-boltClip`
1161
- }, a = gn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1172
+ }, a = mn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1162
1173
  id: o.boltFill,
1163
1174
  x1: "420",
1164
1175
  y1: "180",
@@ -1166,7 +1177,7 @@ function oa(e, t) {
1166
1177
  y2: "1040",
1167
1178
  gradientUnits: "userSpaceOnUse"
1168
1179
  });
1169
- D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
1180
+ I(l, "0", n.top), I(l, "0.36", n.middle), I(l, "0.72", n.bottom), I(l, "1", n.bottom);
1170
1181
  const p = m(i, "linearGradient", {
1171
1182
  id: o.boltEdge,
1172
1183
  x1: "470",
@@ -1175,28 +1186,28 @@ function oa(e, t) {
1175
1186
  y2: "980",
1176
1187
  gradientUnits: "userSpaceOnUse"
1177
1188
  });
1178
- D(p, "0", n.edgeStart), D(p, "0.32", n.edgeMiddle), D(p, "0.78", n.edgeEnd), D(p, "1", n.edgeEnd);
1189
+ I(p, "0", n.edgeStart), I(p, "0.32", n.edgeMiddle), I(p, "0.78", n.edgeEnd), I(p, "1", n.edgeEnd);
1179
1190
  const c = m(i, "radialGradient", {
1180
1191
  id: o.boltGlow,
1181
1192
  cx: "50%",
1182
1193
  cy: "22%",
1183
1194
  r: "82%"
1184
1195
  });
1185
- D(c, "0", n.glow, "0.72"), D(c, "0.5", n.middle, "0.44"), D(c, "1", n.bottom, "0");
1196
+ I(c, "0", n.glow, "0.72"), I(c, "0.5", n.middle, "0.44"), I(c, "1", n.bottom, "0");
1186
1197
  const u = m(i, "radialGradient", {
1187
1198
  id: o.eyeWhite,
1188
1199
  cx: "35%",
1189
1200
  cy: "25%",
1190
1201
  r: "70%"
1191
1202
  });
1192
- D(u, "0", "#ffffff"), D(u, "0.72", "#ffffff"), D(u, "1", "#e5e5e5");
1203
+ I(u, "0", "#ffffff"), I(u, "0.72", "#ffffff"), I(u, "1", "#e5e5e5");
1193
1204
  const s = m(i, "radialGradient", {
1194
1205
  id: o.pupil,
1195
1206
  cx: "42%",
1196
1207
  cy: "38%",
1197
1208
  r: "65%"
1198
1209
  });
1199
- D(s, "0", "#2a1f10"), D(s, "0.52", "#080604"), D(s, "1", "#000000");
1210
+ I(s, "0", "#2a1f10"), I(s, "0.52", "#080604"), I(s, "1", "#000000");
1200
1211
  const b = m(i, "filter", {
1201
1212
  id: o.softDropShadow,
1202
1213
  x: "-18%",
@@ -1263,10 +1274,10 @@ function oa(e, t) {
1263
1274
  "flood-color": "#000000",
1264
1275
  "flood-opacity": "0.22"
1265
1276
  });
1266
- const O = m(i, "clipPath", { id: o.boltClip });
1267
- m(O, "path", { d: Be });
1277
+ const B = m(i, "clipPath", { id: o.boltClip });
1278
+ m(B, "path", { d: Ue });
1268
1279
  const y = m(a, "g", { filter: $(o.softDropShadow) });
1269
- m(y, "path", { d: Be, fill: $(o.boltEdge) });
1280
+ m(y, "path", { d: Ue, fill: $(o.boltEdge) });
1270
1281
  const C = "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";
1271
1282
  m(y, "path", {
1272
1283
  d: C,
@@ -1304,14 +1315,14 @@ function oa(e, t) {
1304
1315
  opacity: "0.48"
1305
1316
  });
1306
1317
  const g = m(a, "g", { filter: $(o.eyeShadow) });
1307
- return Ut(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Ut(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1318
+ return zt(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), zt(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1308
1319
  }
1309
- function aa(e, t) {
1310
- const n = Qt(e), o = {
1320
+ function pa(e, t) {
1321
+ const n = tn(e), o = {
1311
1322
  clip: `${t}-scribbleBoltClip`,
1312
1323
  wobble: `${t}-scribbleBoltWobble`
1313
- }, a = gn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1314
- m(l, "path", { d: Be });
1324
+ }, a = mn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1325
+ m(l, "path", { d: Ue });
1315
1326
  const p = m(i, "filter", {
1316
1327
  id: o.wobble,
1317
1328
  x: "-10%",
@@ -1335,7 +1346,7 @@ function aa(e, t) {
1335
1346
  });
1336
1347
  const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
1337
1348
  return m(u, "path", {
1338
- d: On(),
1349
+ d: zn(),
1339
1350
  fill: "none",
1340
1351
  stroke: n,
1341
1352
  "stroke-width": "56",
@@ -1344,20 +1355,20 @@ function aa(e, t) {
1344
1355
  opacity: "0.9",
1345
1356
  transform: "rotate(-14 627 600)"
1346
1357
  }), m(c, "path", {
1347
- d: Be,
1358
+ d: Ue,
1348
1359
  fill: "none",
1349
- stroke: Oe,
1360
+ stroke: Fe,
1350
1361
  "stroke-width": "18",
1351
1362
  "stroke-linejoin": "round"
1352
- }), Ft(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Ft(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
1363
+ }), Gt(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Gt(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
1353
1364
  }
1354
- function gn() {
1365
+ function mn() {
1355
1366
  return v("svg", {
1356
- xmlns: pn,
1367
+ xmlns: dn,
1357
1368
  viewBox: "0 0 1254 1254"
1358
1369
  });
1359
1370
  }
1360
- function Ut(e, t, n, o, a, i, l, p, c) {
1371
+ function zt(e, t, n, o, a, i, l, p, c) {
1361
1372
  const u = m(e, "g", { transform: t });
1362
1373
  m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
1363
1374
  cx: a,
@@ -1368,7 +1379,7 @@ function Ut(e, t, n, o, a, i, l, p, c) {
1368
1379
  filter: $(c.pupilGloss)
1369
1380
  }), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
1370
1381
  }
1371
- function Ft(e, t, n, o, a, i, l, p) {
1382
+ function Gt(e, t, n, o, a, i, l, p) {
1372
1383
  const c = m(e, "g", { transform: t });
1373
1384
  m(c, "ellipse", {
1374
1385
  cx: n,
@@ -1376,26 +1387,26 @@ function Ft(e, t, n, o, a, i, l, p) {
1376
1387
  rx: "73",
1377
1388
  ry: "80",
1378
1389
  fill: "#ffffff",
1379
- stroke: Oe,
1390
+ stroke: Fe,
1380
1391
  "stroke-width": "13"
1381
- }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Oe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1392
+ }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Fe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1382
1393
  }
1383
1394
  function m(e, t, n = {}) {
1384
1395
  const o = v(t, n);
1385
1396
  return e.appendChild(o), o;
1386
1397
  }
1387
- function D(e, t, n, o) {
1398
+ function I(e, t, n, o) {
1388
1399
  const a = { offset: t, "stop-color": n };
1389
1400
  o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
1390
1401
  }
1391
1402
  function $(e) {
1392
1403
  return `url(#${e})`;
1393
1404
  }
1394
- function Fe(e, t, n, o) {
1405
+ function Ge(e, t, n, o) {
1395
1406
  const a = document.createElement("button");
1396
1407
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1397
1408
  }
1398
- function ia() {
1409
+ function sa() {
1399
1410
  const e = v("svg", {
1400
1411
  class: "pluno-pa-widget__scribble-defs",
1401
1412
  "aria-hidden": "true",
@@ -1403,9 +1414,9 @@ function ia() {
1403
1414
  width: "0",
1404
1415
  height: "0"
1405
1416
  }), t = v("defs");
1406
- return t.appendChild(Qe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Qe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Qe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1417
+ return t.appendChild(tt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(tt("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(tt("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1407
1418
  }
1408
- function hn(e, t) {
1419
+ function bn(e, t) {
1409
1420
  const n = v("svg", {
1410
1421
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1411
1422
  viewBox: `0 0 ${t * 26} 36`,
@@ -1414,7 +1425,7 @@ function hn(e, t) {
1414
1425
  focusable: "false"
1415
1426
  });
1416
1427
  for (let o = 0; o < t; o += 1) {
1417
- const a = Nt[o % Nt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1428
+ const a = Dt[o % Dt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1418
1429
  i.appendChild(
1419
1430
  v("ellipse", {
1420
1431
  cx: a.ellipseCx,
@@ -1438,7 +1449,7 @@ function hn(e, t) {
1438
1449
  }
1439
1450
  return n;
1440
1451
  }
1441
- function Qe(e, t, n) {
1452
+ function tt(e, t, n) {
1442
1453
  const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1443
1454
  return o.appendChild(
1444
1455
  v("feTurbulence", {
@@ -1475,27 +1486,27 @@ function Qe(e, t, n) {
1475
1486
  })
1476
1487
  ), o;
1477
1488
  }
1478
- function ra(e) {
1489
+ function da(e) {
1479
1490
  const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1480
1491
  return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1481
1492
  }
1482
- function la() {
1493
+ function ca() {
1483
1494
  const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1484
1495
  return e.appendChild(v("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(v("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1485
1496
  }
1486
- function pa() {
1497
+ function ua() {
1487
1498
  const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1488
1499
  return e.appendChild(v("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(v("path", { d: "M3 4v5h5" })), e.appendChild(v("path", { d: "M12 7v5l3 2" })), e;
1489
1500
  }
1490
- function sa() {
1501
+ function ga() {
1491
1502
  const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
1492
1503
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1493
1504
  }
1494
- function mn() {
1505
+ function fn() {
1495
1506
  const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1496
1507
  return e.appendChild(v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1497
1508
  }
1498
- function da() {
1509
+ function ha() {
1499
1510
  const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1500
1511
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1501
1512
  v("path", {
@@ -1503,7 +1514,7 @@ function da() {
1503
1514
  })
1504
1515
  ), e;
1505
1516
  }
1506
- function ca() {
1517
+ function ma() {
1507
1518
  const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1508
1519
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1509
1520
  v("path", {
@@ -1515,15 +1526,15 @@ function ca() {
1515
1526
  })
1516
1527
  ), e;
1517
1528
  }
1518
- function ua() {
1529
+ function ba() {
1519
1530
  const e = Z("0 0 24 24", 18, 18, "currentColor");
1520
1531
  return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1521
1532
  }
1522
- function ga() {
1533
+ function fa() {
1523
1534
  const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1524
1535
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1525
1536
  }
1526
- function ha() {
1537
+ function wa() {
1527
1538
  const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1528
1539
  return e.appendChild(v("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(v("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1529
1540
  }
@@ -1538,38 +1549,38 @@ function Z(e, t, n, o, a, i) {
1538
1549
  return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
1539
1550
  }
1540
1551
  function v(e, t = {}) {
1541
- const n = document.createElementNS(pn, e);
1552
+ const n = document.createElementNS(dn, e);
1542
1553
  for (const [o, a] of Object.entries(t))
1543
1554
  n.setAttribute(o, a);
1544
1555
  return n;
1545
1556
  }
1546
- function zt(e) {
1557
+ function Ht(e) {
1547
1558
  for (const t of ["keydown", "keypress", "keyup"])
1548
1559
  e.addEventListener(t, (n) => {
1549
1560
  n.stopPropagation();
1550
1561
  });
1551
1562
  }
1552
- function ma(e, t, n) {
1563
+ function _a(e, t, n) {
1553
1564
  e.replaceChildren(), e.hidden = t.length === 0;
1554
1565
  for (const [o, a] of t.entries()) {
1555
1566
  const i = document.createElement("div");
1556
- i.className = "pluno-pa-widget__attachment", i.appendChild(ba(a));
1567
+ i.className = "pluno-pa-widget__attachment", i.appendChild(xa(a));
1557
1568
  const l = document.createElement("span");
1558
1569
  l.textContent = a.name, i.appendChild(l);
1559
1570
  const p = document.createElement("button");
1560
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ga()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1571
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(fa()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1561
1572
  }
1562
1573
  }
1563
- function ba(e) {
1564
- if (bn(e)) {
1574
+ function xa(e) {
1575
+ if (wn(e)) {
1565
1576
  const n = document.createElement("img");
1566
1577
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1567
1578
  }
1568
1579
  const t = document.createElement("span");
1569
1580
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1570
1581
  }
1571
- function fa(e) {
1572
- if (bn(e)) {
1582
+ function ya(e) {
1583
+ if (wn(e)) {
1573
1584
  const a = document.createElement("img");
1574
1585
  return a.src = e.dataUrl, a.alt = e.name, a;
1575
1586
  }
@@ -1580,51 +1591,51 @@ function fa(e) {
1580
1591
  const o = document.createElement("strong");
1581
1592
  return o.textContent = e.name, t.append(n, o), t;
1582
1593
  }
1583
- function bn(e) {
1594
+ function wn(e) {
1584
1595
  return e.mimeType.startsWith("image/");
1585
1596
  }
1586
- function wa(e) {
1597
+ function va(e) {
1587
1598
  return e === "application/pdf" ? "document.pdf" : "image";
1588
1599
  }
1589
- async function _a(e) {
1600
+ async function Ca(e) {
1590
1601
  if (!e)
1591
1602
  return [];
1592
1603
  const t = Array.from(e);
1593
- if (t.length > Ue)
1594
- throw new Error(`Attach up to ${Ue} files per message.`);
1604
+ if (t.length > ze)
1605
+ throw new Error(`Attach up to ${ze} files per message.`);
1595
1606
  return Promise.all(
1596
1607
  t.map(async (n) => {
1597
- const o = xa(n);
1608
+ const o = Ea(n);
1598
1609
  if (!o)
1599
1610
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1600
- if (n.size > uo)
1611
+ if (n.size > bo)
1601
1612
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1602
1613
  if (o === "image/gif") {
1603
- const a = new Uint8Array(await Aa(n));
1604
- if (va(a))
1614
+ const a = new Uint8Array(await Da(n));
1615
+ if (ka(a))
1605
1616
  throw new Error("Pluno supports non-animated GIF images.");
1606
1617
  }
1607
1618
  return {
1608
- name: n.name || wa(o),
1619
+ name: n.name || va(o),
1609
1620
  mimeType: o,
1610
1621
  sizeBytes: n.size,
1611
- dataUrl: ya(await Ta(n), o)
1622
+ dataUrl: Sa(await Ra(n), o)
1612
1623
  };
1613
1624
  })
1614
1625
  );
1615
1626
  }
1616
- function xa(e) {
1617
- if (an.has(e.type))
1627
+ function Ea(e) {
1628
+ if (ln.has(e.type))
1618
1629
  return e.type;
1619
1630
  const t = e.name.toLowerCase();
1620
1631
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
1621
1632
  }
1622
- function ya(e, t) {
1633
+ function Sa(e, t) {
1623
1634
  const n = `data:${t};base64,`;
1624
1635
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1625
1636
  }
1626
- function va(e) {
1627
- if (e.length < 14 || !Ca(e))
1637
+ function ka(e) {
1638
+ if (e.length < 14 || !La(e))
1628
1639
  return !1;
1629
1640
  const t = e[10];
1630
1641
  let n = 13;
@@ -1635,7 +1646,7 @@ function va(e) {
1635
1646
  if (n += 1, a === 59)
1636
1647
  return !1;
1637
1648
  if (a === 33) {
1638
- n += 1, n = Gt(e, n);
1649
+ n += 1, n = Wt(e, n);
1639
1650
  continue;
1640
1651
  }
1641
1652
  if (a !== 44)
@@ -1647,14 +1658,14 @@ function va(e) {
1647
1658
  const i = e[n + 8];
1648
1659
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1649
1660
  return !1;
1650
- n += 1, n = Gt(e, n);
1661
+ n += 1, n = Wt(e, n);
1651
1662
  }
1652
1663
  return !1;
1653
1664
  }
1654
- function Ca(e) {
1665
+ function La(e) {
1655
1666
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1656
1667
  }
1657
- function Gt(e, t) {
1668
+ function Wt(e, t) {
1658
1669
  for (; t < e.length; ) {
1659
1670
  const n = e[t];
1660
1671
  if (t += 1, n === 0)
@@ -1663,63 +1674,63 @@ function Gt(e, t) {
1663
1674
  }
1664
1675
  return t;
1665
1676
  }
1666
- function De(e) {
1677
+ function Me(e) {
1667
1678
  return !!(e && Array.from(e.types).includes("Files"));
1668
1679
  }
1669
- function et(e, t, n = null) {
1670
- if (!e || !rt(t, n)) {
1680
+ function nt(e, t, n = null) {
1681
+ if (!e || !pt(t, n)) {
1671
1682
  e && (e.hidden = !0, e.replaceChildren());
1672
1683
  return;
1673
1684
  }
1674
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Ea(t, n)) : fn(t) && e.appendChild(Sa(t));
1685
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || ct(n) ? e.appendChild(Pa(t, n)) : _n(t) && e.appendChild(Aa(t));
1675
1686
  }
1676
- function Ea(e, t) {
1687
+ function Pa(e, t) {
1677
1688
  const n = document.createElement("div");
1678
1689
  n.className = "pluno-pa-widget__billing-action-card";
1679
1690
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1680
1691
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1681
1692
  const i = document.createElement("span");
1682
- return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(wn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1693
+ return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(xn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1683
1694
  }
1684
- function Sa(e) {
1695
+ function Aa(e) {
1685
1696
  const t = document.createElement("div");
1686
1697
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1687
1698
  const n = document.createElement("strong");
1688
1699
  n.textContent = "Credits running low", t.appendChild(n);
1689
1700
  const o = document.createElement("span");
1690
- return o.textContent = La(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1701
+ return o.textContent = Na(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(xn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1691
1702
  }
1692
- function rt(e, t) {
1693
- return e !== null && (X(e) || fn(e) || st(t));
1703
+ function pt(e, t) {
1704
+ return e !== null && (X(e) || _n(e) || ct(t));
1694
1705
  }
1695
- function Ht(e, t, n) {
1696
- return rt(t, n) || ka(t) ? !0 : !rt(e, n);
1706
+ function $t(e, t, n) {
1707
+ return pt(t, n) || Ta(t) ? !0 : !pt(e, n);
1697
1708
  }
1698
- function ka(e) {
1709
+ function Ta(e) {
1699
1710
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1700
1711
  }
1701
1712
  function X(e) {
1702
1713
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1703
1714
  }
1704
- function st(e) {
1715
+ function ct(e) {
1705
1716
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1706
1717
  }
1707
- function fn(e) {
1718
+ function _n(e) {
1708
1719
  return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1709
1720
  }
1710
- function La(e) {
1711
- return e.creditsRemaining === null ? null : `${Pa(e.creditsRemaining)} credits left`;
1721
+ function Na(e) {
1722
+ return e.creditsRemaining === null ? null : `${Ia(e.creditsRemaining)} credits left`;
1712
1723
  }
1713
- function Pa(e) {
1724
+ function Ia(e) {
1714
1725
  return new Intl.NumberFormat("en-US", {
1715
1726
  maximumFractionDigits: 0
1716
1727
  }).format(Math.ceil(e));
1717
1728
  }
1718
- function wn(e, t, n) {
1729
+ function xn(e, t, n) {
1719
1730
  const o = document.createElement("div");
1720
- return o.className = n, o.appendChild(Wt(t, e.pricingUrl)), o.appendChild(Wt("Earn credits", e.earnCreditsUrl)), o;
1731
+ return o.className = n, o.appendChild(qt(t, e.pricingUrl)), o.appendChild(qt("Earn credits", e.earnCreditsUrl)), o;
1721
1732
  }
1722
- function Wt(e, t) {
1733
+ function qt(e, t) {
1723
1734
  const n = document.createElement("button");
1724
1735
  if (n.type = "button", e === "Earn credits") {
1725
1736
  const o = document.createElement("span");
@@ -1730,7 +1741,7 @@ function Wt(e, t) {
1730
1741
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1731
1742
  }), n;
1732
1743
  }
1733
- function Aa(e) {
1744
+ function Da(e) {
1734
1745
  return new Promise((t, n) => {
1735
1746
  const o = new FileReader();
1736
1747
  o.addEventListener("load", () => {
@@ -1744,7 +1755,7 @@ function Aa(e) {
1744
1755
  }), o.readAsArrayBuffer(e);
1745
1756
  });
1746
1757
  }
1747
- function Ta(e) {
1758
+ function Ra(e) {
1748
1759
  return new Promise((t, n) => {
1749
1760
  const o = new FileReader();
1750
1761
  o.addEventListener("load", () => {
@@ -1758,103 +1769,103 @@ function Ta(e) {
1758
1769
  }), o.readAsDataURL(e);
1759
1770
  });
1760
1771
  }
1761
- function $t(e, t) {
1762
- return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1772
+ function jt(e, t) {
1773
+ return e.messages.filter((o) => !yn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1763
1774
  }
1764
- function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1765
- const O = [...i.messages], y = O.filter((_) => !_n(_)), C = e.scrollTop;
1766
- e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && na(a, l);
1775
+ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1776
+ const B = [...i.messages], y = B.filter((_) => !yn(_)), C = e.scrollTop;
1777
+ e.replaceChildren(), Cn(n, i.isThinking), a.hidden = !p, p && l !== null && ra(a, l);
1767
1778
  const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
1768
- if (o.hidden = !h, y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1779
+ if (o(h), y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1769
1780
  const _ = document.createElement("div");
1770
1781
  _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1771
1782
  const L = document.createElement("div");
1772
1783
  L.className = "pluno-pa-widget__empty-hero";
1773
1784
  const G = re("pluno-pa-widget__character--empty", x());
1774
- L.appendChild(G), _.appendChild(L), _.appendChild(un());
1775
- const M = document.createElement("div");
1776
- if (M.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && !i.starterPromptsLoading && M.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1785
+ L.appendChild(G), _.appendChild(L), _.appendChild(hn());
1786
+ const R = document.createElement("div");
1787
+ if (R.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && !i.starterPromptsLoading && R.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1777
1788
  for (const f of i.starterPrompts) {
1778
1789
  const A = document.createElement("button");
1779
1790
  A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
1780
1791
  P(f);
1781
- }), M.appendChild(A);
1792
+ }), R.appendChild(A);
1782
1793
  }
1783
1794
  else if (i.starterPromptsLoading) {
1784
1795
  const f = document.createElement("button");
1785
- f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", M.appendChild(f);
1796
+ f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", R.appendChild(f);
1786
1797
  } else
1787
- for (let f = 0; f < ho; f += 1) {
1798
+ for (let f = 0; f < wo; f += 1) {
1788
1799
  const A = document.createElement("button");
1789
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", M.appendChild(A);
1800
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", R.appendChild(A);
1790
1801
  }
1791
- _.appendChild(M), e.appendChild(_), e.appendChild(t);
1802
+ _.appendChild(R), e.appendChild(_), e.appendChild(t);
1792
1803
  return;
1793
1804
  }
1794
- let g = null, E = null, I = [];
1805
+ let g = null, E = null, F = [];
1795
1806
  const le = () => {
1796
- if (I.length === 0)
1807
+ if (F.length === 0)
1797
1808
  return !1;
1798
- const _ = Fa(I, s, b, x());
1799
- return e.appendChild(_), g = null, E = _, I = [], !0;
1809
+ const _ = Wa(F, s, b, x());
1810
+ return e.appendChild(_), g = null, E = _, F = [], !0;
1800
1811
  };
1801
1812
  for (let _ = 0; _ < y.length; _ += 1) {
1802
1813
  const L = y[_];
1803
1814
  if (L.role === "tool") {
1804
- I.push(L);
1815
+ F.push(L);
1805
1816
  continue;
1806
1817
  }
1807
1818
  if (L.role === "system")
1808
1819
  continue;
1809
- const G = le(), M = Vt(L.content);
1820
+ const G = le(), R = Kt(L.content);
1810
1821
  if (L.role === "assistant" && !G) {
1811
- const T = lt(x());
1822
+ const T = st(x());
1812
1823
  e.appendChild(T), g = null, E = T;
1813
1824
  }
1814
1825
  const f = document.createElement("div");
1815
- f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Ia(L.attachments));
1826
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Xt(f, R) : f.textContent = R, L.role === "user" && L.attachments?.length && f.appendChild(Ba(L.attachments));
1816
1827
  const A = document.createElement("div");
1817
- A.className = "pluno-pa-widget__message-actions", A.appendChild(jt(M)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1828
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(Yt(R)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1818
1829
  }
1819
- const xe = le();
1830
+ const ye = le();
1820
1831
  if (i.assistantDraft) {
1821
- if (!xe) {
1822
- const M = lt(x());
1823
- e.appendChild(M), g = null, E = M;
1832
+ if (!ye) {
1833
+ const R = st(x());
1834
+ e.appendChild(R), g = null, E = R;
1824
1835
  }
1825
- const _ = Vt(i.assistantDraft), L = document.createElement("div");
1826
- L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Yt(L, _);
1836
+ const _ = Kt(i.assistantDraft), L = document.createElement("div");
1837
+ L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Xt(L, _);
1827
1838
  const G = document.createElement("div");
1828
- G.className = "pluno-pa-widget__message-actions", G.appendChild(jt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
1839
+ G.className = "pluno-pa-widget__message-actions", G.appendChild(Yt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
1829
1840
  }
1830
1841
  if (i.isThinking && !i.assistantDraft)
1831
- if (xe) {
1832
- const _ = xn();
1842
+ if (ye) {
1843
+ const _ = vn();
1833
1844
  e.appendChild(_), g = null, E = _;
1834
1845
  } else {
1835
- const _ = za(x());
1846
+ const _ = $a(x());
1836
1847
  e.appendChild(_), g = null, E = _;
1837
1848
  }
1838
1849
  if (i.lastError) {
1839
1850
  const _ = document.createElement("div");
1840
1851
  _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
1841
1852
  }
1842
- const R = k && !i.isThinking ? Hn(O) : null;
1843
- if (k && R && !k.dismissedCandidateIds.has(R.id)) {
1844
- const _ = Da(R, {
1845
- isDrafting: k.draftingCandidateId === R.id,
1853
+ const D = k && !i.isThinking ? qn(B) : null;
1854
+ if (k && D && !k.dismissedCandidateIds.has(D.id)) {
1855
+ const _ = Oa(D, {
1856
+ isDrafting: k.draftingCandidateId === D.id,
1846
1857
  error: k.error,
1847
1858
  characterIconOptions: k.characterIconOptions,
1848
1859
  onDraft: k.onDraft,
1849
1860
  onDismiss: k.onDismiss,
1850
1861
  onDisable: k.onDisable
1851
1862
  });
1852
- e.appendChild(_), k.onSeen(R), g = null, E = _;
1863
+ e.appendChild(_), k.onSeen(D), g = null, E = _;
1853
1864
  }
1854
- g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? Se(e, u) : e.scrollTop = C;
1865
+ g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? ke(e, u) : e.scrollTop = C;
1855
1866
  }
1856
- function qt(e, t, n, o, a, i, l, p) {
1857
- e.replaceChildren(), yn(t, !1), t.disabled = !0, n.hidden = !0;
1867
+ function Vt(e, t, n, o, a, i, l, p) {
1868
+ e.replaceChildren(), Cn(t, !1), t.disabled = !0, n(!1);
1858
1869
  const c = document.createElement("div");
1859
1870
  c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1860
1871
  const u = re("pluno-pa-widget__character--empty", o());
@@ -1869,20 +1880,20 @@ function qt(e, t, n, o, a, i, l, p) {
1869
1880
  }
1870
1881
  e.appendChild(c);
1871
1882
  }
1872
- function Ia(e) {
1883
+ function Ba(e) {
1873
1884
  const t = document.createElement("div");
1874
1885
  t.className = "pluno-pa-widget__message-attachments";
1875
1886
  for (const n of e)
1876
- t.appendChild(fa(n));
1887
+ t.appendChild(ya(n));
1877
1888
  return t;
1878
1889
  }
1879
- function jt(e) {
1890
+ function Yt(e) {
1880
1891
  const t = document.createElement("button");
1881
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ha()), t.addEventListener("click", (n) => {
1892
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(wa()), t.addEventListener("click", (n) => {
1882
1893
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1883
1894
  }), t;
1884
1895
  }
1885
- function Da(e, t) {
1896
+ function Oa(e, t) {
1886
1897
  const n = document.createElement("article");
1887
1898
  n.className = "pluno-pa-widget__share-prompt";
1888
1899
  const o = document.createElement("div");
@@ -1904,7 +1915,7 @@ function Da(e, t) {
1904
1915
  const u = document.createElement("button");
1905
1916
  if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
1906
1917
  t.onDraft(e);
1907
- }), t.isDrafting ? (u.appendChild(pt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1918
+ }), t.isDrafting ? (u.appendChild(dt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1908
1919
  p.appendChild(c);
1909
1920
  else {
1910
1921
  const s = document.createElement("button");
@@ -1918,7 +1929,7 @@ function Da(e, t) {
1918
1929
  }
1919
1930
  return o.appendChild(p), n.appendChild(o), n;
1920
1931
  }
1921
- function Ra(e, t) {
1932
+ function Ua(e, t) {
1922
1933
  const n = document.createElement("div");
1923
1934
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1924
1935
  y.target === n && t.onClose();
@@ -1937,9 +1948,9 @@ function Ra(e, t) {
1937
1948
  u.className = "pluno-pa-widget__share-dialog-step-header";
1938
1949
  const s = document.createElement("strong");
1939
1950
  s.textContent = "1) Copy Screenshot", u.appendChild(s);
1940
- const b = Ma("Copy Screenshot", async () => {
1951
+ const b = Fa("Copy Screenshot", async () => {
1941
1952
  try {
1942
- return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1953
+ return await jn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1943
1954
  } catch {
1944
1955
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1945
1956
  }
@@ -1957,29 +1968,29 @@ function Ra(e, t) {
1957
1968
  P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
1958
1969
  const k = document.createElement("p");
1959
1970
  k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
1960
- const O = document.createElement("footer");
1961
- O.className = "pluno-pa-widget__share-dialog-platforms";
1962
- for (const y of Ba(e)) {
1971
+ const B = document.createElement("footer");
1972
+ B.className = "pluno-pa-widget__share-dialog-platforms";
1973
+ for (const y of za(e)) {
1963
1974
  const C = document.createElement("a");
1964
- C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Oa(y.id)), O.appendChild(C);
1975
+ C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Ga(y.id)), B.appendChild(C);
1965
1976
  }
1966
- if (x.appendChild(O), o.appendChild(x), t.socialPostRewardsUrl) {
1977
+ if (x.appendChild(B), o.appendChild(x), t.socialPostRewardsUrl) {
1967
1978
  const y = document.createElement("div");
1968
1979
  y.className = "pluno-pa-widget__share-dialog-step";
1969
1980
  const C = document.createElement("strong");
1970
1981
  C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
1971
1982
  const h = document.createElement("a");
1972
- h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Ua()), y.appendChild(h), o.appendChild(y);
1983
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Ha()), y.appendChild(h), o.appendChild(y);
1973
1984
  }
1974
1985
  return n.appendChild(o), n;
1975
1986
  }
1976
- function Ma(e, t) {
1987
+ function Fa(e, t) {
1977
1988
  const n = document.createElement("button");
1978
1989
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1979
1990
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1980
1991
  }), n;
1981
1992
  }
1982
- function Ba(e) {
1993
+ function za(e) {
1983
1994
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1984
1995
  return [
1985
1996
  {
@@ -1999,40 +2010,40 @@ function Ba(e) {
1999
2010
  }
2000
2011
  ];
2001
2012
  }
2002
- function Oa(e) {
2013
+ function Ga(e) {
2003
2014
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2004
- 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" ? (F(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), F(t, "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"), F(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), F(t, "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"), F(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (F(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), F(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), F(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (F(t, "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"), F(t, "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", "0.48"), F(t, "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"), F(t, "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"), t);
2015
+ 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" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(t, "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"), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(t, "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"), U(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (U(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), U(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), U(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (U(t, "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"), U(t, "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", "0.48"), U(t, "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"), U(t, "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"), t);
2005
2016
  }
2006
- function F(e, t, n) {
2017
+ function U(e, t, n) {
2007
2018
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
2008
2019
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2009
2020
  }
2010
- function Ua() {
2021
+ function Ha() {
2011
2022
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2012
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), F(e, "M14 5h5v5"), F(e, "M19 5l-8 8"), F(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
2023
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
2013
2024
  }
2014
- function _n(e) {
2015
- return e.role === "tool" && e.toolName === tn;
2025
+ function yn(e) {
2026
+ return e.role === "tool" && e.toolName === on;
2016
2027
  }
2017
- function Vt(e) {
2028
+ function Kt(e) {
2018
2029
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2019
2030
  }
2020
- function Fa(e, t, n, o) {
2031
+ function Wa(e, t, n, o) {
2021
2032
  const a = document.createElement("article");
2022
2033
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(re("pluno-pa-widget__character--tool-group", o));
2023
- const i = document.createElement("details"), l = Ga(e);
2034
+ const i = document.createElement("details"), l = qa(e);
2024
2035
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
2025
2036
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
2026
2037
  });
2027
2038
  const p = document.createElement("summary");
2028
- p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(pt());
2039
+ p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(dt());
2029
2040
  const u = document.createElement("span");
2030
2041
  if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), i.appendChild(p), e.length > 0) {
2031
2042
  const s = document.createElement("div");
2032
2043
  s.className = "pluno-pa-widget__tool-lines";
2033
2044
  for (const b of e) {
2034
2045
  const x = document.createElement("div");
2035
- x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(pt());
2046
+ x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(dt());
2036
2047
  const P = document.createElement("span");
2037
2048
  P.textContent = b.content || "Run tool", x.appendChild(P), s.appendChild(x);
2038
2049
  }
@@ -2040,15 +2051,15 @@ function Fa(e, t, n, o) {
2040
2051
  }
2041
2052
  return a.appendChild(i), a;
2042
2053
  }
2043
- function lt(e) {
2054
+ function st(e) {
2044
2055
  const t = document.createElement("article");
2045
2056
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
2046
2057
  }
2047
- function za(e) {
2048
- const t = lt(e);
2049
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
2058
+ function $a(e) {
2059
+ const t = st(e);
2060
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(vn()), t;
2050
2061
  }
2051
- function xn() {
2062
+ function vn() {
2052
2063
  const e = document.createElement("div");
2053
2064
  e.className = "pluno-pa-widget__status";
2054
2065
  const t = document.createElement("span");
@@ -2056,17 +2067,17 @@ function xn() {
2056
2067
  const n = document.createElement("span");
2057
2068
  return n.textContent = "Thinking...", e.appendChild(n), e;
2058
2069
  }
2059
- function Ga(e) {
2070
+ function qa(e) {
2060
2071
  return `tools:${e[0]?.id ?? ""}`;
2061
2072
  }
2062
- function pt() {
2073
+ function dt() {
2063
2074
  const e = document.createElement("span");
2064
2075
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2065
2076
  }
2066
- function yn(e, t) {
2067
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ua() : mn());
2077
+ function Cn(e, t) {
2078
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ba() : fn());
2068
2079
  }
2069
- function Yt(e, t) {
2080
+ function Xt(e, t) {
2070
2081
  const n = t.replace(/\r\n/g, `
2071
2082
  `).split(`
2072
2083
  `);
@@ -2090,14 +2101,14 @@ function Yt(e, t) {
2090
2101
  const l = a.match(/^(#{1,3})\s+(.+)$/);
2091
2102
  if (l) {
2092
2103
  const u = document.createElement(`h${l[1].length + 2}`);
2093
- Re(u, l[2]), e.appendChild(u), o += 1;
2104
+ Be(u, l[2]), e.appendChild(u), o += 1;
2094
2105
  continue;
2095
2106
  }
2096
2107
  if (/^\s*[-*+]\s+/.test(a)) {
2097
2108
  const u = document.createElement("ul");
2098
2109
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
2099
2110
  const s = document.createElement("li");
2100
- Re(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2111
+ Be(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2101
2112
  }
2102
2113
  e.appendChild(u);
2103
2114
  continue;
@@ -2106,7 +2117,7 @@ function Yt(e, t) {
2106
2117
  const u = document.createElement("ol");
2107
2118
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
2108
2119
  const s = document.createElement("li");
2109
- Re(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2120
+ Be(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2110
2121
  }
2111
2122
  e.appendChild(u);
2112
2123
  continue;
@@ -2116,11 +2127,11 @@ function Yt(e, t) {
2116
2127
  p.push(n[o]), o += 1;
2117
2128
  const c = document.createElement("p");
2118
2129
  p.forEach((u, s) => {
2119
- s > 0 && c.appendChild(document.createElement("br")), Re(c, u);
2130
+ s > 0 && c.appendChild(document.createElement("br")), Be(c, u);
2120
2131
  }), e.appendChild(c);
2121
2132
  }
2122
2133
  }
2123
- function Re(e, t) {
2134
+ function Be(e, t) {
2124
2135
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2125
2136
  let o = 0;
2126
2137
  for (const a of t.matchAll(n)) {
@@ -2138,7 +2149,7 @@ function Re(e, t) {
2138
2149
  p.textContent = l.slice(1, -1), e.appendChild(p);
2139
2150
  } else {
2140
2151
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2141
- if (p && Ha(p[2])) {
2152
+ if (p && ja(p[2])) {
2142
2153
  const c = document.createElement("a");
2143
2154
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2144
2155
  } else
@@ -2148,7 +2159,7 @@ function Re(e, t) {
2148
2159
  }
2149
2160
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2150
2161
  }
2151
- function Ha(e) {
2162
+ function ja(e) {
2152
2163
  if (e.startsWith("/") || e.startsWith("#"))
2153
2164
  return !0;
2154
2165
  try {
@@ -2158,8 +2169,8 @@ function Ha(e) {
2158
2169
  return !1;
2159
2170
  }
2160
2171
  }
2161
- function Kt(e, t) {
2162
- if (Wa(e))
2172
+ function Zt(e, t) {
2173
+ if (Va(e))
2163
2174
  return;
2164
2175
  const n = `
2165
2176
  :host {
@@ -2505,34 +2516,40 @@ function Kt(e, t) {
2505
2516
  .pluno-pa-widget__timeline-jump:active {
2506
2517
  transform: translateX(-50%) scale(0.98);
2507
2518
  }
2519
+ .pluno-pa-widget__top-actions {
2520
+ position: absolute;
2521
+ top: 14px;
2522
+ right: 14px;
2523
+ z-index: 4;
2524
+ display: flex;
2525
+ align-items: center;
2526
+ justify-content: flex-end;
2527
+ gap: 6px;
2528
+ pointer-events: none;
2529
+ }
2508
2530
  .pluno-pa-widget__history,
2509
2531
  .pluno-pa-widget__new-chat {
2510
- position: absolute;
2511
- bottom: 14px;
2512
- z-index: 2;
2513
- width: 36px;
2514
- height: 36px;
2532
+ position: relative;
2533
+ box-sizing: border-box;
2534
+ flex: 0 0 30px;
2535
+ width: 30px;
2536
+ height: 30px;
2515
2537
  display: inline-flex;
2516
2538
  align-items: center;
2517
2539
  justify-content: center;
2518
2540
  border: 1px solid var(--pluno-pa-divider);
2519
- border-radius: 999px;
2541
+ border-radius: 6px;
2520
2542
  background: color-mix(in srgb, var(--pluno-pa-bg) 92%, transparent);
2521
2543
  color: var(--pluno-pa-text);
2522
2544
  box-shadow: 0 6px 14px rgba(24, 24, 27, 0.08);
2523
2545
  cursor: pointer;
2524
2546
  padding: 0;
2547
+ pointer-events: auto;
2525
2548
  transition:
2526
2549
  background 120ms ease,
2527
2550
  transform 120ms ease,
2528
2551
  box-shadow 120ms ease;
2529
2552
  }
2530
- .pluno-pa-widget__history {
2531
- right: 58px;
2532
- }
2533
- .pluno-pa-widget__new-chat {
2534
- right: 14px;
2535
- }
2536
2553
  .pluno-pa-widget__history:hover:not(:disabled),
2537
2554
  .pluno-pa-widget__new-chat:hover:not(:disabled) {
2538
2555
  background: var(--pluno-pa-surface);
@@ -2545,14 +2562,14 @@ function Kt(e, t) {
2545
2562
  .pluno-pa-widget__history-panel {
2546
2563
  position: absolute;
2547
2564
  right: 18px;
2548
- bottom: 116px;
2565
+ top: 52px;
2549
2566
  z-index: 4;
2550
2567
  display: grid;
2551
2568
  grid-template-rows: auto minmax(0, 1fr) auto;
2552
2569
  gap: 7px;
2553
2570
  box-sizing: border-box;
2554
2571
  width: min(260px, calc(100% - 36px));
2555
- max-height: min(270px, calc(100% - 170px));
2572
+ max-height: min(270px, calc(100% - 66px));
2556
2573
  border: 1px solid var(--pluno-pa-divider);
2557
2574
  border-radius: 8px;
2558
2575
  background: color-mix(in srgb, var(--pluno-pa-bg) 96%, transparent);
@@ -3835,7 +3852,7 @@ function Kt(e, t) {
3835
3852
  position: absolute;
3836
3853
  top: -16px;
3837
3854
  left: 16px;
3838
- right: 16px;
3855
+ width: min(416px, calc(100% - 104px));
3839
3856
  height: 36px;
3840
3857
  z-index: 3;
3841
3858
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -4139,28 +4156,28 @@ function Kt(e, t) {
4139
4156
  filter: url(#pluno-pa-scribble-wobble-2);
4140
4157
  }
4141
4158
  `;
4142
- if ($a(e, n))
4159
+ if (Ya(e, n))
4143
4160
  return;
4144
4161
  const o = e.ownerDocument.createElement("style");
4145
- o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
4162
+ o.id = cn, o.textContent = n, e.appendChild(o), En(e);
4146
4163
  }
4147
- function Wa(e) {
4148
- return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
4164
+ function Va(e) {
4165
+ return e.getElementById(cn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(un) === "true";
4149
4166
  }
4150
- function vn(e) {
4151
- e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
4167
+ function En(e) {
4168
+ e.host instanceof HTMLElement && e.host.setAttribute(un, "true");
4152
4169
  }
4153
- function $a(e, t) {
4170
+ function Ya(e, t) {
4154
4171
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
4155
4172
  return !1;
4156
4173
  try {
4157
4174
  const n = new CSSStyleSheet();
4158
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], vn(e), !0;
4175
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], En(e), !0;
4159
4176
  } catch {
4160
4177
  return !1;
4161
4178
  }
4162
4179
  }
4163
- async function qa() {
4180
+ async function Ka() {
4164
4181
  return document.body ? document.body : await new Promise((e) => {
4165
4182
  const t = new MutationObserver(() => {
4166
4183
  document.body && (t.disconnect(), e(document.body));
@@ -4168,49 +4185,49 @@ async function qa() {
4168
4185
  t.observe(document.documentElement, { childList: !0 });
4169
4186
  });
4170
4187
  }
4171
- function Cn(e) {
4188
+ function Sn(e) {
4172
4189
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
4173
4190
  }
4174
- function ja(e) {
4191
+ function Xa(e) {
4175
4192
  try {
4176
- const t = window.localStorage.getItem(Cn(e));
4193
+ const t = window.localStorage.getItem(Sn(e));
4177
4194
  if (!t)
4178
- return Xt();
4195
+ return Jt();
4179
4196
  const n = JSON.parse(t);
4180
4197
  return {
4181
4198
  isOpen: n.isOpen === !0,
4182
4199
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
4183
4200
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
4184
- launcherPosition: Xa(n.launcherPosition) ? n.launcherPosition : null,
4185
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
4201
+ launcherPosition: ei(n.launcherPosition) ? n.launcherPosition : null,
4202
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-an) : [],
4186
4203
  sharePromptsDisabled: n.sharePromptsDisabled === !0
4187
4204
  };
4188
4205
  } catch {
4189
- return Xt();
4206
+ return Jt();
4190
4207
  }
4191
4208
  }
4192
- async function Va(e) {
4209
+ async function Za(e) {
4193
4210
  if (e.loadSharePromptsDisabled)
4194
4211
  return e.loadSharePromptsDisabled();
4195
4212
  try {
4196
- return window.localStorage.getItem(on) === "true";
4213
+ return window.localStorage.getItem(rn) === "true";
4197
4214
  } catch {
4198
4215
  return !1;
4199
4216
  }
4200
4217
  }
4201
- function Ya(e, t) {
4218
+ function Ja(e, t) {
4202
4219
  if (e.persistSharePromptsDisabled) {
4203
4220
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
4204
4221
  });
4205
4222
  return;
4206
4223
  }
4207
4224
  try {
4208
- t && window.localStorage.setItem(on, "true");
4225
+ t && window.localStorage.setItem(rn, "true");
4209
4226
  } catch {
4210
4227
  return;
4211
4228
  }
4212
4229
  }
4213
- function Xt() {
4230
+ function Jt() {
4214
4231
  return {
4215
4232
  isOpen: !1,
4216
4233
  composerValue: "",
@@ -4220,41 +4237,41 @@ function Xt() {
4220
4237
  sharePromptsDisabled: !1
4221
4238
  };
4222
4239
  }
4223
- function Ka(e, t) {
4240
+ function Qa(e, t) {
4224
4241
  try {
4225
- window.localStorage.setItem(Cn(e), JSON.stringify(t));
4242
+ window.localStorage.setItem(Sn(e), JSON.stringify(t));
4226
4243
  } catch {
4227
4244
  return;
4228
4245
  }
4229
4246
  }
4230
- function Xa(e) {
4247
+ function ei(e) {
4231
4248
  if (!e || typeof e != "object")
4232
4249
  return !1;
4233
4250
  const t = e;
4234
4251
  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");
4235
4252
  }
4236
- const Zt = /* @__PURE__ */ new WeakSet();
4237
- function Za(e) {
4253
+ const Qt = /* @__PURE__ */ new WeakSet();
4254
+ function ti(e) {
4238
4255
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
4239
4256
  }
4240
- function Jt(e) {
4257
+ function en(e) {
4241
4258
  const t = e.pathname.split("/");
4242
4259
  return t[t.length - 1] ?? "";
4243
4260
  }
4244
- function Ja(e, t) {
4261
+ function ni(e, t) {
4245
4262
  const n = new URL(e.src, document.baseURI);
4246
- return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
4263
+ return n.href === t.href || n.pathname === t.pathname ? !0 : en(n) === en(t);
4247
4264
  }
4248
4265
  class te extends EventTarget {
4249
4266
  constructor(t, n) {
4250
- super(), this.channelId = n, this.url = t, this.addPreviewListener(ro, () => {
4267
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(so, () => {
4251
4268
  this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
4252
- }), this.addPreviewListener(lo, (o) => {
4269
+ }), this.addPreviewListener(co, (o) => {
4253
4270
  const a = o;
4254
4271
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
4255
- }), this.addPreviewListener(po, () => {
4272
+ }), this.addPreviewListener(uo, () => {
4256
4273
  this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4257
- }), this.addPreviewListener(so, (o) => {
4274
+ }), this.addPreviewListener(go, (o) => {
4258
4275
  const a = o;
4259
4276
  this.readyState = te.CLOSED, this.dispatchEvent(
4260
4277
  new CloseEvent("close", {
@@ -4264,7 +4281,7 @@ class te extends EventTarget {
4264
4281
  })
4265
4282
  ), this.cleanup();
4266
4283
  }), window.dispatchEvent(
4267
- new CustomEvent(Me(oo, this.channelId), {
4284
+ new CustomEvent(Oe(ro, this.channelId), {
4268
4285
  detail: { socketId: this.socketId, url: t }
4269
4286
  })
4270
4287
  );
@@ -4280,26 +4297,26 @@ class te extends EventTarget {
4280
4297
  binaryType = "blob";
4281
4298
  bufferedAmount = 0;
4282
4299
  readyState = te.CONNECTING;
4283
- socketId = Qa();
4300
+ socketId = oi();
4284
4301
  listeners = /* @__PURE__ */ new Map();
4285
4302
  send(t) {
4286
4303
  if (this.readyState !== te.OPEN)
4287
4304
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
4288
4305
  window.dispatchEvent(
4289
- new CustomEvent(Me(ao, this.channelId), {
4306
+ new CustomEvent(Oe(lo, this.channelId), {
4290
4307
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
4291
4308
  })
4292
4309
  );
4293
4310
  }
4294
4311
  close(t, n) {
4295
4312
  this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4296
- new CustomEvent(Me(io, this.channelId), {
4313
+ new CustomEvent(Oe(po, this.channelId), {
4297
4314
  detail: { socketId: this.socketId, code: t, reason: n }
4298
4315
  })
4299
4316
  ), this.cleanup());
4300
4317
  }
4301
4318
  addPreviewListener(t, n) {
4302
- const o = Me(t, this.channelId), a = (i) => {
4319
+ const o = Oe(t, this.channelId), a = (i) => {
4303
4320
  i.detail?.socketId === this.socketId && n(i);
4304
4321
  };
4305
4322
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -4310,36 +4327,36 @@ class te extends EventTarget {
4310
4327
  this.listeners.clear();
4311
4328
  }
4312
4329
  }
4313
- function Qa() {
4314
- const e = window.sessionStorage.getItem(At);
4330
+ function oi() {
4331
+ const e = window.sessionStorage.getItem(Nt);
4315
4332
  if (e)
4316
4333
  return e;
4317
4334
  const t = crypto.randomUUID();
4318
- return window.sessionStorage.setItem(At, t), t;
4335
+ return window.sessionStorage.setItem(Nt, t), t;
4319
4336
  }
4320
- function Me(e, t) {
4337
+ function Oe(e, t) {
4321
4338
  return `${e}:${t}`;
4322
4339
  }
4323
- function ei(e) {
4340
+ function ai(e) {
4324
4341
  const t = document.currentScript;
4325
4342
  if (t instanceof HTMLScriptElement)
4326
4343
  return [t];
4327
4344
  const n = new URL(e, document.baseURI).href, o = new URL(n);
4328
4345
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
4329
- (a) => a instanceof HTMLScriptElement && Za(a) && Ja(a, o)
4346
+ (a) => a instanceof HTMLScriptElement && ti(a) && ni(a, o)
4330
4347
  );
4331
4348
  }
4332
- function ti(e) {
4333
- for (const t of ei(e)) {
4334
- if (Zt.has(t) || t.dataset.plunoAutoMount === "false")
4349
+ function ii(e) {
4350
+ for (const t of ai(e)) {
4351
+ if (Qt.has(t) || t.dataset.plunoAutoMount === "false")
4335
4352
  continue;
4336
- Zt.add(t);
4353
+ Qt.add(t);
4337
4354
  const n = t.dataset.plunoPreviewChannel;
4338
- To({
4355
+ Ro({
4339
4356
  token: t.dataset.plunoToken,
4340
4357
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4341
4358
  backendUrl: t.dataset.plunoBackendUrl,
4342
- webSocketFactory: n ? Ao(n) : void 0,
4359
+ webSocketFactory: n ? Do(n) : void 0,
4343
4360
  launcherLabel: t.dataset.plunoLauncherLabel,
4344
4361
  accentColor: t.dataset.plunoAccentColor,
4345
4362
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -4351,8 +4368,8 @@ function ti(e) {
4351
4368
  });
4352
4369
  }
4353
4370
  }
4354
- ti(import.meta.url);
4371
+ ii(import.meta.url);
4355
4372
  export {
4356
- Ao as createProductAgentPreviewBridgeWebSocketFactory,
4357
- To as mountPlunoProductAgentWidget
4373
+ Do as createProductAgentPreviewBridgeWebSocketFactory,
4374
+ Ro as mountPlunoProductAgentWidget
4358
4375
  };