@pluno/product-agent-web 0.1.61 → 0.1.63

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 Co } from "./product-agent-sdk.js";
2
- const So = "#7c3aed", nt = "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", ot = "#2c2a1e", Qt = [253, 250, 241], en = 3.5;
3
- function Dn(e) {
4
- const t = Rn(e);
5
- if (tn(Ge(t), Qt) >= en)
1
+ import { PlunoProductAgent as So } from "./product-agent-sdk.js";
2
+ const Eo = "#7c3aed", nt = "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", ot = "#2c2a1e", en = [253, 250, 241], tn = 3.5;
3
+ function Rn(e) {
4
+ const t = Mn(e);
5
+ if (nn(Ge(t), en) >= tn)
6
6
  return t;
7
7
  let n = Ge(t);
8
8
  const i = Ge(ot);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (n = Lo(n, i, 0.22), tn(n, Qt) >= en)
11
- return Nt(n);
12
- return Nt(n);
10
+ if (n = Io(n, i, 0.22), nn(n, en) >= tn)
11
+ return At(n);
12
+ return At(n);
13
13
  }
14
- function Eo() {
14
+ function ko() {
15
15
  let o = "M 280 120", n = !1, i = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
@@ -19,8 +19,8 @@ function Eo() {
19
19
  }
20
20
  return o;
21
21
  }
22
- function ko(e) {
23
- const t = Rn(e), o = Tt(Ge(t));
22
+ function Lo(e) {
23
+ const t = Mn(e), o = Nt(Ge(t));
24
24
  return o > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,9 +56,9 @@ function ko(e) {
56
56
  shadow: J(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Rn(e) {
59
+ function Mn(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((o) => o + o).join("").toLowerCase()}` : So;
61
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : Eo;
62
62
  }
63
63
  function Ge(e) {
64
64
  return [
@@ -67,23 +67,23 @@ function Ge(e) {
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function Nt([e, t, o]) {
70
+ function At([e, t, o]) {
71
71
  const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
72
  return `#${n(e)}${n(t)}${n(o)}`;
73
73
  }
74
- function Tt([e, t, o]) {
74
+ function Nt([e, t, o]) {
75
75
  const n = (i) => {
76
76
  const r = i / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
80
80
  }
81
- function tn(e, t) {
82
- const o = Tt(e), n = Tt(t), [i, r] = o > n ? [o, n] : [n, o];
81
+ function nn(e, t) {
82
+ const o = Nt(e), n = Nt(t), [i, r] = o > n ? [o, n] : [n, o];
83
83
  return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function Lo(e, t, o) {
86
- const n = At(o);
85
+ function Io(e, t, o) {
86
+ const n = Tt(o);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * n,
89
89
  e[1] + (t[1] - e[1]) * n,
@@ -91,10 +91,10 @@ function Lo(e, t, o) {
91
91
  ];
92
92
  }
93
93
  function J(e, t, o) {
94
- const [n, i, r] = Io(Ge(e));
95
- return Nt(No(n, At(i + o), At(r + t)));
94
+ const [n, i, r] = Ao(Ge(e));
95
+ return At(No(n, Tt(i + o), Tt(r + t)));
96
96
  }
97
- function Io([e, t, o]) {
97
+ function Ao([e, t, o]) {
98
98
  const n = e / 255, i = t / 255, r = o / 255, l = Math.max(n, i, r), p = Math.min(n, i, r), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
@@ -115,19 +115,19 @@ function vt(e, t, o) {
115
115
  let n = o;
116
116
  return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
117
117
  }
118
- function At(e) {
118
+ function Tt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const Mn = "suggest_share_on_socials";
121
+ const zn = "suggest_share_on_socials";
122
122
  function To(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const o = e[t];
125
- if (o.role !== "tool" || o.toolName !== Mn)
125
+ if (o.role !== "tool" || o.toolName !== zn)
126
126
  continue;
127
- const n = nn(e, t, "assistant");
127
+ const n = on(e, t, "assistant");
128
128
  if (!n)
129
129
  return null;
130
- const i = nn(e, n.index, "user");
130
+ const i = on(e, n.index, "user");
131
131
  return i ? {
132
132
  id: `share:${o.callId ?? o.id}`,
133
133
  userPrompt: i.content,
@@ -136,13 +136,13 @@ function To(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Ao(e) {
140
- const t = await Po(e);
139
+ async function Po(e) {
140
+ const t = await Do(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 nn(e, t, o) {
145
+ function on(e, t, o) {
146
146
  for (let n = t - 1; n >= 0; n -= 1) {
147
147
  const i = e[n];
148
148
  if (i.role === o && i.content.trim())
@@ -150,18 +150,18 @@ function nn(e, t, o) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Po(e) {
153
+ async function Do(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const Do = "https://app.pluno.ai", Ro = "/api/product-agent/embed/active-users", Mo = 1800, zo = 15e3, Oo = 250, Uo = 1e3, Bo = 3e4;
157
- function Fo(e, t = {}) {
156
+ const Ro = "https://app.pluno.ai", Mo = "/api/product-agent/embed/active-users", zo = 1800, Oo = 15e3, Uo = 250, Bo = 1e3, Fo = 3e4;
157
+ function Ho(e, t = {}) {
158
158
  let o = !1, n = null, i = null, r = null;
159
159
  const l = () => {
160
160
  r !== null && (window.clearInterval(r), r = null);
161
161
  }, p = (c) => {
162
162
  o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  u();
164
- }, Go(c)));
164
+ }, $o(c)));
165
165
  }, d = (c) => {
166
166
  if (l(), n === null) {
167
167
  n = c, e(c);
@@ -173,50 +173,50 @@ function Fo(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const w = Math.min(1, (performance.now() - S) / Mo);
177
- n = Math.round(g + (c - g) * $o(w)), e(n), w >= 1 && (n = c, e(c), l());
178
- }, Oo);
176
+ const b = Math.min(1, (performance.now() - S) / zo);
177
+ n = Math.round(g + (c - g) * qo(b)), e(n), b >= 1 && (n = c, e(c), l());
178
+ }, Uo);
179
179
  }, u = async () => {
180
180
  try {
181
- const c = await Ho(t);
181
+ const c = await Wo(t);
182
182
  if (o)
183
183
  return;
184
184
  d(c.count), p(c.refreshAfterMs);
185
185
  } catch {
186
- p(zo);
186
+ p(Oo);
187
187
  }
188
188
  };
189
189
  return u(), () => {
190
190
  o = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function Ho(e) {
193
+ async function Wo(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const o = await (e.fetcher ?? fetch)(new URL(Ro, Wo(e.backendUrl ?? Do)).toString(), {
196
+ const o = await (e.fetcher ?? fetch)(new URL(Mo, Go(e.backendUrl ?? Ro)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!o.ok)
201
201
  throw new Error("Failed to load active users");
202
- const n = await o.json(), i = on(n.count), r = on(n.refreshAfterMs ?? n.refresh_after_ms);
202
+ const n = await o.json(), i = an(n.count), r = an(n.refreshAfterMs ?? n.refresh_after_ms);
203
203
  if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: i, refreshAfterMs: r };
206
206
  }
207
- function on(e) {
207
+ function an(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Wo(e) {
211
- return e.endsWith("/") ? e : `${e}/`;
212
- }
213
210
  function Go(e) {
214
- return Math.min(Bo, Math.max(Uo, e));
211
+ return e.endsWith("/") ? e : `${e}/`;
215
212
  }
216
213
  function $o(e) {
214
+ return Math.min(Fo, Math.max(Bo, e));
215
+ }
216
+ function qo(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const zn = 100, qo = 1e4, jo = "product-agent:sdk-preview-socket-connect", Vo = "product-agent:sdk-preview-socket-send", Ko = "product-agent:sdk-preview-socket-close", Yo = "product-agent:sdk-preview-socket-open", Xo = "product-agent:sdk-preview-socket-message", Zo = "product-agent:sdk-preview-socket-error", Jo = "product-agent:sdk-preview-socket-closed", an = "product-agent:sdk-preview-socket-id", Qo = "data-pluno-sdk-preview-channel", ei = "product-agent:preview-diagnostic", On = "pluno.productAgent.sharePromptsDisabled", ti = 3, rn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ni = 400, oi = 5e3, ii = 500, ln = "Close the page's popup to chat", ai = "No recent chats for this page yet.", Q = {
219
+ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-connect", Yo = "product-agent:sdk-preview-socket-send", Xo = "product-agent:sdk-preview-socket-close", Zo = "product-agent:sdk-preview-socket-open", Jo = "product-agent:sdk-preview-socket-message", Qo = "product-agent:sdk-preview-socket-error", ei = "product-agent:sdk-preview-socket-closed", rn = "product-agent:sdk-preview-socket-id", ti = "data-pluno-sdk-preview-channel", ni = "product-agent:preview-diagnostic", Un = "pluno.productAgent.sharePromptsDisabled", oi = 3, ln = 'dialog[open], [aria-modal="true"], [role="dialog"]', ii = 400, ai = 5e3, ri = 500, pn = "Close the page's popup to chat", li = "No recent chats for this page yet.", Q = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const zn = 100, qo = 1e4, jo = "product-agent:sdk-preview-socket-connect", Vo =
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, ri = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', pn = "pluno-pa-scribble-font", Un = 190, Bn = 41, sn = 22, li = 16, pi = 24, si = 1, di = 48, ci = 420, ui = 520, gi = 0.24, hi = 680, mi = 800, fi = 0.76, W = 8, Pt = 50, Fn = "http://www.w3.org/2000/svg", dn = 26, cn = 8, bi = 36, un = [
227
+ }, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680, bi = 800, wi = 0.76, W = 8, Pt = 50, Hn = "http://www.w3.org/2000/svg", cn = 26, un = 8, _i = 36, gn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,12 +261,12 @@ const zn = 100, qo = 1e4, jo = "product-agent:sdk-preview-socket-connect", Vo =
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
- ], wi = 11, _i = 13, gn = 4, xi = 10, yi = 40, vi = "movable-launcher-position-v2", Hn = "pluno-pa-widget-styles", Wn = "data-pluno-pa-widget-styles";
265
- let hn = 0;
266
- function Ci(e) {
264
+ ], xi = 11, yi = 13, hn = 4, vi = 10, Ci = 40, Si = "movable-launcher-position-v2", Wn = "pluno-pa-widget-styles", Gn = "data-pluno-pa-widget-styles";
265
+ let mn = 0;
266
+ function Ei(e) {
267
267
  return (t) => new re(t, e);
268
268
  }
269
- async function Si(e = {}) {
269
+ async function ki(e = {}) {
270
270
  const t = {
271
271
  launcherLabel: e.launcherLabel ?? Q.launcherLabel,
272
272
  accentColor: e.accentColor ?? Q.accentColor,
@@ -325,23 +325,23 @@ async function Si(e = {}) {
325
325
  );
326
326
  const o = document.createElement("div");
327
327
  o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
328
- Qo,
328
+ ti,
329
329
  t.sdkPreviewChannelId
330
330
  );
331
331
  const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
332
332
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
333
- let r = mn(
333
+ let r = fn(
334
334
  t.accentColor,
335
335
  t.scribbleStyle
336
336
  );
337
- $i(
337
+ Ki(
338
338
  i,
339
339
  t.launcherLabel,
340
340
  r,
341
341
  t.movableLauncher,
342
342
  t.showLauncherMinimizeButton
343
343
  ), n.appendChild(i);
344
- const l = Fa(t);
344
+ const l = $a(t);
345
345
  let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null;
346
346
  i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), xe(
347
347
  i,
@@ -350,13 +350,13 @@ async function Si(e = {}) {
350
350
  p,
351
351
  t.position
352
352
  )
353
- )), Nn(n, t.accentColor), fn(i, r, {
353
+ )), Nn(n, t.accentColor), bn(i, r, {
354
354
  accentColor: t.accentColor,
355
355
  colorScheme: t.colorScheme,
356
356
  fontFamily: t.fontFamily,
357
357
  scribbleStyle: t.scribbleStyle
358
358
  });
359
- const u = await Ba(), c = u.ownerDocument;
359
+ const u = await Ga(), c = u.ownerDocument;
360
360
  u.appendChild(o), K(
361
361
  "web-sdk.widget",
362
362
  "Applied initial widget appearance",
@@ -371,9 +371,9 @@ async function Si(e = {}) {
371
371
  ".pluno-pa-widget__launcher"
372
372
  ), S = i.querySelector(
373
373
  ".pluno-pa-widget__launcher-drag-handle"
374
- ), w = i.querySelector(
374
+ ), b = i.querySelector(
375
375
  ".pluno-pa-widget__launcher-input"
376
- ), F = i.querySelector(
376
+ ), H = i.querySelector(
377
377
  ".pluno-pa-widget__launcher-minimize"
378
378
  ), k = i.querySelector(".pluno-pa-widget__panel"), y = i.querySelector(
379
379
  ".pluno-pa-widget__close"
@@ -381,7 +381,7 @@ async function Si(e = {}) {
381
381
  ".pluno-pa-widget__composer"
382
382
  ), h = i.querySelector(
383
383
  ".pluno-pa-widget__attachment-error"
384
- ), T = i.querySelector(
384
+ ), N = i.querySelector(
385
385
  ".pluno-pa-widget__billing-status"
386
386
  ), D = i.querySelector(
387
387
  ".pluno-pa-widget__attachments"
@@ -413,32 +413,32 @@ async function Si(e = {}) {
413
413
  ".pluno-pa-widget__timeline"
414
414
  ), $ = i.querySelector(
415
415
  ".pluno-pa-widget__timeline-bottom-sentinel"
416
- ), N = i.querySelector(
417
- ".pluno-pa-widget__notify-suggestion"
418
416
  ), A = i.querySelector(
417
+ ".pluno-pa-widget__notify-suggestion"
418
+ ), T = i.querySelector(
419
419
  ".pluno-pa-widget__notify-suggestion-enable"
420
420
  ), ge = i.querySelector(
421
421
  ".pluno-pa-widget__notify-suggestion-later"
422
- ), io = i.querySelector(
422
+ ), ao = i.querySelector(
423
423
  ".pluno-pa-widget__notify-suggestion-never"
424
424
  );
425
- if (!g || !w || !k || !y || !v || !h || !T || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
425
+ if (!g || !b || !k || !y || !v || !h || !N || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
426
426
  throw new Error("Failed to mount Pluno widget");
427
427
  if (t.movableLauncher && !S)
428
428
  throw new Error("Failed to mount Pluno widget drag handle");
429
- yn(w), yn(f);
430
- let U = [], ie = null;
429
+ vn(b), vn(f);
430
+ let B = [], ie = null;
431
431
  const ve = () => {
432
- sa(
432
+ ga(
433
433
  D,
434
- U,
434
+ B,
435
435
  (a) => {
436
- U = U.filter(
436
+ B = B.filter(
437
437
  (s, _) => _ !== a
438
- ), ve(), B(b.getState()), q();
438
+ ), ve(), F(w.getState()), q();
439
439
  }
440
440
  );
441
- }, ao = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
441
+ }, ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
442
442
  if (!t.tokenEndpoint)
443
443
  throw new Error("Pluno widget requires token or tokenEndpoint");
444
444
  const a = await fetch(t.tokenEndpoint, {
@@ -456,15 +456,15 @@ async function Si(e = {}) {
456
456
  if (!s.token)
457
457
  throw new Error("Pluno token endpoint did not return a token");
458
458
  return s.token;
459
- }), ro = window.fetch.bind(window);
460
- let b;
461
- b = await Co.init({
459
+ }), lo = window.fetch.bind(window);
460
+ let w;
461
+ w = await So.init({
462
462
  token: t.token,
463
- tokenProvider: ao,
463
+ tokenProvider: ro,
464
464
  backendUrl: t.backendUrl,
465
465
  metadata: () => ({
466
466
  ...t.metadata ?? {},
467
- ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
467
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
468
468
  }),
469
469
  initialStarterPrompts: t.initialStarterPrompts,
470
470
  clientId: t.clientId,
@@ -477,16 +477,16 @@ async function Si(e = {}) {
477
477
  const lt = new Set(l.openToolGroupKeys), Ce = new Set(
478
478
  l.seenShareCandidateIds
479
479
  ), qe = new Set(Ce);
480
- let pt = l.sharePromptsDisabled || await Ha(t), V = null, Se = !1, he = !1, me = {
480
+ let pt = l.sharePromptsDisabled || await qa(t), V = null, Se = !1, he = !1, me = {
481
481
  enabled: !0
482
482
  }, fe = 0, Ft = "", le = !1, ae = !1, pe = [], st = null, De = null;
483
483
  const X = (a, s) => {
484
484
  me = { enabled: a, reason: s };
485
485
  }, Z = () => {
486
486
  x.hidden = !0;
487
- }, lo = () => {
487
+ }, po = () => {
488
488
  x.hidden = !1;
489
- }, po = (a = "jump") => {
489
+ }, so = (a = "jump") => {
490
490
  X(!0, a), Z(), We(I, () => me.enabled), fe = I.scrollTop;
491
491
  }, be = () => {
492
492
  if (ue.hidden = t.loginRequired, ye.hidden = !le, ue.setAttribute("aria-expanded", String(le)), G.classList.toggle(
@@ -500,15 +500,15 @@ async function Si(e = {}) {
500
500
  const s = document.createElement("button");
501
501
  s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ae;
502
502
  const _ = document.createElement("span");
503
- _.className = "pluno-pa-widget__history-item-title", _.textContent = Hi(a);
503
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = qi(a);
504
504
  const E = document.createElement("time");
505
- E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent = Gi(
505
+ E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent = Vi(
506
506
  a.lastActiveAt,
507
507
  Date.now()
508
508
  );
509
509
  const P = document.createElement("small");
510
- P.className = "pluno-pa-widget__history-path", P.textContent = Wi(a), s.append(_, E, P), s.addEventListener("click", () => {
511
- le = !1, De = null, be(), X(!0, "newSession"), Z(), b.loadSession(a.id), B(b.getState());
510
+ P.className = "pluno-pa-widget__history-path", P.textContent = ji(a), s.append(_, E, P), s.addEventListener("click", () => {
511
+ le = !1, De = null, be(), X(!0, "newSession"), Z(), w.loadSession(a.id), F(w.getState());
512
512
  }), G.appendChild(s);
513
513
  }
514
514
  if (ae && pe.length > 0) {
@@ -520,7 +520,7 @@ async function Si(e = {}) {
520
520
  if (!ae) {
521
521
  ae = !0, De = null, be();
522
522
  try {
523
- const s = await b.listSessions({ cursor: a, limit: 20 });
523
+ const s = await w.listSessions({ cursor: a, limit: 20 });
524
524
  pe = a ? [...pe, ...s.sessions] : s.sessions, st = s.nextCursor;
525
525
  } catch (s) {
526
526
  K(
@@ -529,16 +529,16 @@ async function Si(e = {}) {
529
529
  {
530
530
  message: s instanceof Error ? s.message : String(s)
531
531
  }
532
- ), De = ai;
532
+ ), De = li;
533
533
  } finally {
534
534
  ae = !1, be();
535
535
  }
536
536
  }
537
- }, so = () => {
538
- !st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
539
537
  }, co = () => {
538
+ !st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
539
+ }, uo = () => {
540
540
  Se || typeof document > "u" || (Nn(n, t.accentColor), o.isConnected || c.body?.appendChild(o));
541
- }, Wt = new MutationObserver(co);
541
+ }, Wt = new MutationObserver(uo);
542
542
  Wt.observe(c.documentElement, {
543
543
  childList: !0,
544
544
  subtree: !0
@@ -547,21 +547,24 @@ async function Si(e = {}) {
547
547
  const s = it(i, a);
548
548
  return Dt(
549
549
  i,
550
- p ? $n(p, s) : Ti(
550
+ p ? qn(p, s) : Pi(
551
551
  i,
552
552
  t.position,
553
553
  s
554
554
  ),
555
555
  s
556
556
  );
557
- }, H = () => {
558
- Ga(t, {
557
+ }, O = () => {
558
+ const a = Fi(n, b, f);
559
+ Va(t, {
559
560
  isOpen: i.classList.contains("pluno-pa-widget--open"),
560
561
  composerValue: f.value,
562
+ focusedInput: a,
563
+ focusedInputAt: a ? Date.now() : null,
561
564
  openToolGroupKeys: [...lt],
562
565
  launcherPosition: d ? p : null,
563
566
  seenShareCandidateIds: [...Ce].slice(
564
- -zn
567
+ -On
565
568
  ),
566
569
  sharePromptsDisabled: pt
567
570
  });
@@ -579,10 +582,10 @@ async function Si(e = {}) {
579
582
  p,
580
583
  t.position
581
584
  )
582
- ), wn(i), H(), s && je("minimized");
585
+ ), _n(i), O(), s && je("minimized");
583
586
  }, we = (a, s = {}) => {
584
- Oi(a, {
585
- debugVersion: vi,
587
+ Bi(a, {
588
+ debugVersion: Si,
586
589
  launcherPosition: p,
587
590
  rootClasses: i.className,
588
591
  rootStyle: {
@@ -608,10 +611,10 @@ async function Si(e = {}) {
608
611
  }), s;
609
612
  }, Gt = (a, s) => {
610
613
  if (!a || !s) {
611
- wn(i);
614
+ _n(i);
612
615
  return;
613
616
  }
614
- zi(i, {
617
+ Ui(i, {
615
618
  x: a.x - s.x,
616
619
  y: a.y - s.y
617
620
  });
@@ -629,7 +632,7 @@ async function Si(e = {}) {
629
632
  }
630
633
  const a = Me();
631
634
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
632
- const s = bn(
635
+ const s = wn(
633
636
  i,
634
637
  a,
635
638
  t.position
@@ -645,7 +648,7 @@ async function Si(e = {}) {
645
648
  };
646
649
  let qt = () => {
647
650
  };
648
- window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt = Ni({
651
+ window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt = Ti({
649
652
  root: i,
650
653
  launcher: g,
651
654
  launcherDragHandle: S,
@@ -656,7 +659,7 @@ async function Si(e = {}) {
656
659
  a,
657
660
  _
658
661
  );
659
- p = Pi(
662
+ p = Ri(
660
663
  E,
661
664
  _
662
665
  ), xe(i, E), we("Dragging closed launcher", {
@@ -664,7 +667,7 @@ async function Si(e = {}) {
664
667
  });
665
668
  },
666
669
  persist: () => {
667
- d = !0, H(), we("Persisted closed launcher drag position");
670
+ d = !0, O(), we("Persisted closed launcher drag position");
668
671
  }
669
672
  })) : xe(i, null);
670
673
  let ct = !1;
@@ -673,14 +676,14 @@ async function Si(e = {}) {
673
676
  ct = !0;
674
677
  try {
675
678
  const a = await t.billingStatusLoader();
676
- Cn(
679
+ Sn(
677
680
  t.billingStatus,
678
681
  a,
679
- b.getState().lastErrorCode
682
+ w.getState().lastErrorCode
680
683
  ) && (t.billingStatus = a, Lt(
681
- T,
684
+ N,
682
685
  t.billingStatus,
683
- b.getState().lastErrorCode
686
+ w.getState().lastErrorCode
684
687
  ), q());
685
688
  } finally {
686
689
  ct = !1;
@@ -688,7 +691,7 @@ async function Si(e = {}) {
688
691
  }
689
692
  }, se = (a = "", s = !0) => {
690
693
  jt(), Oe && (Oe = !1, gt()), V !== null && (window.clearTimeout(V), V = null), Re("shown", !1), k.hidden = !1, y.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
691
- const _ = Me(), E = bn(
694
+ const _ = Me(), E = wn(
692
695
  i,
693
696
  _,
694
697
  t.position
@@ -697,48 +700,48 @@ async function Si(e = {}) {
697
700
  openPanelPosition: E,
698
701
  visibleLauncherPosition: _
699
702
  }), X(!0, "open"), Z(), !s) {
700
- i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), H(), je("shown"), t.onPanelOpenChange?.(!0);
703
+ i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0);
701
704
  return;
702
705
  }
703
706
  window.requestAnimationFrame(() => {
704
- i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), H(), je("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
707
+ i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
705
708
  g.hidden = !0, We(I, () => me.enabled), fe = I.scrollTop;
706
709
  }, 220);
707
710
  });
708
- }, uo = () => {
709
- V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), we("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), H(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
711
+ }, go = () => {
712
+ V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), we("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), O(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
710
713
  k.hidden = !0, y.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
711
714
  }, 220);
712
715
  };
713
716
  g.addEventListener("submit", (a) => {
714
- a.preventDefault(), se(w.value), w.value = "";
717
+ a.preventDefault(), se(b.value), b.value = "";
715
718
  }), S?.addEventListener("click", (a) => {
716
719
  a.preventDefault(), a.stopPropagation();
717
720
  }), g.addEventListener("click", (a) => {
718
- a.target === w && !S || (se(w.value), w.value = "");
719
- }), w.addEventListener("focus", () => {
720
- se(w.value), w.value = "";
721
- }), w.addEventListener("input", () => {
722
- if (!w.value)
721
+ a.target === b && !S || (se(b.value), b.value = "");
722
+ }), b.addEventListener("focus", () => {
723
+ se(b.value), b.value = "";
724
+ }), b.addEventListener("input", () => {
725
+ if (!b.value)
723
726
  return;
724
- const a = w.value;
725
- se(a), w.value = "";
727
+ const a = b.value;
728
+ se(a), b.value = "";
726
729
  });
727
730
  let ut = null, Ve = null, _e = null;
728
- const Vt = (a) => a === w || a === f, go = (a) => {
731
+ const Vt = (a) => a === b || a === f, ho = (a) => {
729
732
  if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
730
733
  return null;
731
734
  let s = a;
732
735
  for (; s; ) {
733
- const _ = s.closest(rn);
736
+ const _ = s.closest(ln);
734
737
  if (_)
735
738
  return _;
736
739
  const E = s.getRootNode();
737
740
  s = E instanceof ShadowRoot ? E.host : null;
738
741
  }
739
742
  return null;
740
- }, ho = (a) => {
741
- if (!a.isConnected || !a.matches(rn))
743
+ }, mo = (a) => {
744
+ if (!a.isConnected || !a.matches(ln))
742
745
  return !1;
743
746
  if (!(a instanceof HTMLElement))
744
747
  return !0;
@@ -751,38 +754,38 @@ async function Si(e = {}) {
751
754
  }, Kt = (a) => {
752
755
  ze !== a && (ze = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ye(), a !== null ? _e = window.setInterval(() => {
753
756
  const s = ze;
754
- (!s || !ho(s)) && Kt(null);
755
- }, ii) : _e !== null && (window.clearInterval(_e), _e = null, Ve = null));
756
- }, mo = () => {
757
+ (!s || !mo(s)) && Kt(null);
758
+ }, ri) : _e !== null && (window.clearInterval(_e), _e = null, Ve = null));
759
+ }, fo = () => {
757
760
  _e !== null && (window.clearInterval(_e), _e = null);
758
761
  };
759
762
  i.addEventListener("focusin", (a) => {
760
- Vt(a.target) && (ut = Date.now());
763
+ Vt(a.target) && (ut = Date.now(), O());
761
764
  }), i.addEventListener("focusout", (a) => {
762
765
  if (!Vt(a.target) || ze !== null)
763
766
  return;
764
767
  const s = ut;
765
- if (ut = null, s === null || Date.now() - s > ni)
768
+ if (ut = null, s === null || Date.now() - s > ii)
766
769
  return;
767
- const _ = go(a.relatedTarget);
770
+ const _ = ho(a.relatedTarget);
768
771
  if (!_)
769
772
  return;
770
773
  const E = Date.now();
771
- if (Ve !== null && E - Ve <= oi) {
774
+ if (Ve !== null && E - Ve <= ai) {
772
775
  Kt(_);
773
776
  return;
774
777
  }
775
778
  Ve = E;
776
779
  }), g.addEventListener("keydown", (a) => {
777
780
  !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), se());
778
- }), F?.addEventListener("pointerdown", (a) => {
781
+ }), H?.addEventListener("pointerdown", (a) => {
779
782
  a.stopPropagation();
780
- }), F?.addEventListener("click", (a) => {
783
+ }), H?.addEventListener("click", (a) => {
781
784
  a.preventDefault(), a.stopPropagation(), Re("minimized");
782
- }), y.addEventListener("click", uo), I.addEventListener("scroll", () => {
785
+ }), y.addEventListener("click", go), I.addEventListener("scroll", () => {
783
786
  I.scrollTop < fe - 1 && X(!1, "userScroll"), fe = I.scrollTop;
784
787
  }), x.addEventListener("click", () => {
785
- po();
788
+ so();
786
789
  });
787
790
  const Yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
788
791
  ([a]) => {
@@ -795,13 +798,13 @@ async function Si(e = {}) {
795
798
  let ze = null, Oe = !1;
796
799
  const Ye = () => {
797
800
  const a = Ke(), s = ze !== null;
798
- w.readOnly = a || s, f.readOnly = s, w.placeholder = s ? ln : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? ln : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
801
+ b.readOnly = a || s, f.readOnly = s, b.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
799
802
  }, q = () => {
800
- R.disabled = te(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && U.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
803
+ R.disabled = te(t.billingStatus) || !w.getState().isThinking && f.value.trim().length === 0 && B.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
801
804
  };
802
805
  Ye();
803
806
  const gt = () => {
804
- const a = b.getState().isThinking;
807
+ const a = w.getState().isThinking;
805
808
  i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
806
809
  "pluno-pa-widget--unread",
807
810
  !a && Oe
@@ -816,26 +819,26 @@ async function Si(e = {}) {
816
819
  t.onSignupClick?.();
817
820
  return;
818
821
  }
819
- te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), U = Et(
820
- b,
822
+ te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), B = Et(
823
+ w,
821
824
  f,
822
- U
825
+ B
823
826
  ), ve(), q());
824
827
  });
825
828
  let Ue = 0;
826
- const fo = () => {
829
+ const bo = () => {
827
830
  Ue = 0, i.classList.remove("pluno-pa-widget--drag-over");
828
831
  }, ht = (a) => {
829
832
  ie !== null && window.clearTimeout(ie), h.textContent = a, h.hidden = !1, ie = window.setTimeout(() => {
830
833
  h.textContent = "", h.hidden = !0, ie = null;
831
834
  }, 3e3);
832
- }, bo = () => {
835
+ }, wo = () => {
833
836
  ie !== null && (window.clearTimeout(ie), ie = null), h.textContent = "", h.hidden = !0;
834
837
  }, mt = async (a) => {
835
838
  if (a.length === 0)
836
839
  return;
837
- const s = ua(b, a);
838
- U = [...U, ...s], ve(), bo(), q(), B(b.getState()), i.classList.contains("pluno-pa-widget--open") || se();
840
+ const s = fa(w, a);
841
+ B = [...B, ...s], ve(), wo(), q(), F(w.getState()), i.classList.contains("pluno-pa-widget--open") || se();
839
842
  };
840
843
  Pe.addEventListener("click", () => {
841
844
  t.loginRequired || te(t.billingStatus) || L.click();
@@ -857,7 +860,7 @@ async function Si(e = {}) {
857
860
  Qe(a.dataTransfer) && (a.stopPropagation(), Ue = Math.max(0, Ue - 1), Ue === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
858
861
  }), i.addEventListener("drop", (a) => {
859
862
  const s = a.dataTransfer;
860
- !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), fo(), mt(s.files).catch((_) => {
863
+ !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), bo(), mt(s.files).catch((_) => {
861
864
  ht(
862
865
  _ instanceof Error ? _.message : "Failed to attach file"
863
866
  ), K("web-sdk.widget", "Attachment failed", {
@@ -878,46 +881,46 @@ async function Si(e = {}) {
878
881
  t.onLoginClick?.();
879
882
  return;
880
883
  }
881
- if (b.getState().isThinking) {
882
- b.stop();
884
+ if (w.getState().isThinking) {
885
+ w.stop();
883
886
  return;
884
887
  }
885
- he = !0, X(!0, "send"), Z(), U = Et(
886
- b,
888
+ he = !0, X(!0, "send"), Z(), B = Et(
889
+ w,
887
890
  f,
888
- U
889
- ), ve(), q(), B(b.getState());
891
+ B
892
+ ), ve(), q(), F(w.getState());
890
893
  }), ue.addEventListener("click", () => {
891
894
  le = !le, De = null, be(), le && pe.length === 0 && Ht(null);
892
895
  }), $e.addEventListener("click", () => {
893
896
  le = !1, be();
894
- }), G.addEventListener("scroll", so), f.addEventListener("input", () => {
895
- He(f), H(), q(), xo();
897
+ }), G.addEventListener("scroll", co), f.addEventListener("input", () => {
898
+ He(f), O(), q(), yo();
896
899
  }), f.addEventListener("keydown", (a) => {
897
900
  if (!(a.key !== "Enter" || a.shiftKey)) {
898
901
  if (a.preventDefault(), t.loginRequired) {
899
902
  t.onLoginClick?.();
900
903
  return;
901
904
  }
902
- he = !0, X(!0, "send"), Z(), U = Et(
903
- b,
905
+ he = !0, X(!0, "send"), Z(), B = Et(
906
+ w,
904
907
  f,
905
- U
906
- ), ve(), q(), B(b.getState());
908
+ B
909
+ ), ve(), q(), F(w.getState());
907
910
  }
908
911
  }), i.addEventListener("click", (a) => {
909
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && H();
910
- }), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1);
912
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && O();
913
+ }), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i, b, f);
911
914
  const Xe = () => r;
912
- let ft = b.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = b.getState().isThinking, ke = null;
915
+ let ft = w.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = w.getState().isThinking, ke = null;
913
916
  const Fe = t.taskNotifications;
914
917
  let Le = null, Ie = !1;
915
918
  const Zt = () => {
916
919
  Le !== null && (window.clearTimeout(Le), Le = null);
917
920
  }, Je = () => {
918
- N && (N.hidden = !0);
919
- }, wo = async () => {
920
- if (!Fe || !N || Ie || Se || !b.getState().isThinking)
921
+ A && (A.hidden = !0);
922
+ }, Jt = () => w.getState().assistantDraft.trim().length > 0, _o = async () => {
923
+ if (!Fe || !A || Ie || Se || !w.getState().isThinking || Jt())
921
924
  return;
922
925
  let a;
923
926
  try {
@@ -925,44 +928,44 @@ async function Si(e = {}) {
925
928
  } catch {
926
929
  return;
927
930
  }
928
- a.enabled || a.neverSuggest || !b.getState().isThinking || Ie || Se || (N.hidden = !1);
931
+ a.enabled || a.neverSuggest || !w.getState().isThinking || Jt() || Ie || Se || (A.hidden = !1);
929
932
  };
930
- A?.addEventListener("click", () => {
933
+ T?.addEventListener("click", () => {
931
934
  Ie = !0, Je(), Fe?.enable().catch(() => {
932
935
  });
933
936
  }), ge?.addEventListener("click", () => {
934
937
  Ie = !0, Je();
935
- }), io?.addEventListener("click", () => {
938
+ }), ao?.addEventListener("click", () => {
936
939
  Ie = !0, Je(), Fe?.dismissForever().catch(() => {
937
940
  });
938
941
  });
939
- let Ne = null, Jt = () => {
942
+ let Ae = null, Qt = () => {
940
943
  };
941
- const _o = !!t.socialPostDraftHandler, bt = /* @__PURE__ */ new Map(), wt = () => f.value.trim().length > 0 || U.length > 0, xo = () => {
942
- const a = Ne !== null && It(b.getState(), wt());
943
- z.hidden = !a, a && Ne !== null && jn(z, Ne);
944
+ const xo = !!t.socialPostDraftHandler, bt = /* @__PURE__ */ new Map(), wt = () => f.value.trim().length > 0 || B.length > 0, yo = () => {
945
+ const a = Ae !== null && It(w.getState(), wt());
946
+ z.hidden = !a, a && Ae !== null && Vn(z, Ae);
944
947
  };
945
- let Te = null;
946
- const yo = () => {
947
- he = !0, X(!0, "newSession"), Z(), le = !1, be(), b.startNewSession(), lt.clear(), f.value = "", U = [], ve(), He(f), H(), q(), f.focus(), B(b.getState());
948
+ let Ne = null;
949
+ const vo = () => {
950
+ he = !0, X(!0, "newSession"), Z(), le = !1, be(), w.startNewSession(), lt.clear(), f.value = "", B = [], ve(), He(f), O(), q(), f.focus(), F(w.getState());
948
951
  }, _t = (a) => {
949
952
  if (!a) {
950
- Te?.remove(), Te = null;
953
+ Ne?.remove(), Ne = null;
951
954
  return;
952
955
  }
953
- Te || (Te = rt(
956
+ Ne || (Ne = rt(
954
957
  "pluno-pa-widget__new-chat",
955
958
  "New chat",
956
- ta(),
959
+ aa(),
957
960
  !1
958
- ), Te.addEventListener("click", yo), ce.insertBefore(Te, ue));
959
- }, B = (a) => {
961
+ ), Ne.addEventListener("click", vo), ce.insertBefore(Ne, ue));
962
+ }, F = (a) => {
960
963
  if (be(), Bt(a.lastErrorCode) ? ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
961
- T,
964
+ N,
962
965
  t.billingStatus,
963
966
  ke
964
967
  ), t.loginRequired) {
965
- bt.clear(), Ln(
968
+ bt.clear(), In(
966
969
  I,
967
970
  R,
968
971
  _t,
@@ -975,7 +978,7 @@ async function Si(e = {}) {
975
978
  return;
976
979
  }
977
980
  if (t.signupRequired) {
978
- bt.clear(), Ln(
981
+ bt.clear(), In(
979
982
  I,
980
983
  R,
981
984
  _t,
@@ -987,61 +990,61 @@ async function Si(e = {}) {
987
990
  );
988
991
  return;
989
992
  }
990
- const s = Bi(a), _ = s !== Ft;
993
+ const s = Gi(a), _ = s !== Ft;
991
994
  Ft = s;
992
995
  const E = he || me.enabled;
993
- he = !1, _a(
996
+ he = !1, Ca(
994
997
  I,
995
998
  $,
996
999
  R,
997
1000
  _t,
998
1001
  z,
999
1002
  a,
1000
- Ne,
1001
- Ne !== null && It(a, wt()),
1003
+ Ae,
1004
+ Ae !== null && It(a, wt()),
1002
1005
  E,
1003
1006
  () => me.enabled,
1004
1007
  lt,
1005
1008
  bt,
1006
- H,
1009
+ O,
1007
1010
  Xe,
1008
1011
  (P) => {
1009
- he = !0, X(!0, "send"), Z(), b.sendMessage(P);
1012
+ he = !0, X(!0, "send"), Z(), w.sendMessage(P);
1010
1013
  },
1011
- _o && !pt ? {
1014
+ xo && !pt ? {
1012
1015
  dismissedCandidateIds: qe,
1013
1016
  draftingCandidateId: Ze,
1014
1017
  error: Be,
1015
1018
  characterIconOptions: Xe(),
1016
1019
  onSeen: (P) => {
1017
- Ce.add(P.id), H();
1020
+ Ce.add(P.id), O();
1018
1021
  },
1019
1022
  onDraft: (P) => {
1020
- vo(P);
1023
+ Co(P);
1021
1024
  },
1022
1025
  onDismiss: (P) => {
1023
- Ce.add(P.id), qe.add(P.id), H(), Be = null, B(b.getState());
1026
+ Ce.add(P.id), qe.add(P.id), O(), Be = null, F(w.getState());
1024
1027
  },
1025
1028
  onDisable: (P) => {
1026
- pt = !0, Ce.add(P.id), qe.add(P.id), H(), Wa(t, !0), Be = null, B(b.getState());
1029
+ pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(w.getState());
1027
1030
  }
1028
1031
  } : void 0
1029
- ), E ? (fe = I.scrollTop, Z()) : _ && Fi(a) && lo();
1032
+ ), E ? (fe = I.scrollTop, Z()) : _ && $i(a) && po();
1030
1033
  };
1031
- return Jt = Fo(
1034
+ return Qt = Ho(
1032
1035
  (a) => {
1033
- Ne = a, !Se && It(b.getState(), wt()) && B(b.getState());
1036
+ Ae = a, !Se && It(w.getState(), wt()) && F(w.getState());
1034
1037
  },
1035
1038
  {
1036
1039
  backendUrl: t.backendUrl,
1037
- fetcher: ro,
1040
+ fetcher: lo,
1038
1041
  loader: t.activeUsersLoader
1039
1042
  }
1040
- ), b.on("state", (a) => {
1043
+ ), w.on("state", (a) => {
1041
1044
  const s = Xt && !a.isThinking;
1042
- Xt = a.isThinking, a.isThinking && Fe && !Ie && Le === null && N?.hidden !== !1 && (Le = window.setTimeout(() => {
1043
- Le = null, wo();
1044
- }, qo)), a.isThinking || (Zt(), Je()), s && !i.classList.contains("pluno-pa-widget--open") && (Oe = !0), gt(), a.appearance ? (ft = !0, K(
1045
+ Xt = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Fe && !Ie && Le === null && A?.hidden !== !1 && (Le = window.setTimeout(() => {
1046
+ Le = null, _o();
1047
+ }, jo)), (!a.isThinking || a.assistantDraft.trim()) && (Zt(), Je()), s && !i.classList.contains("pluno-pa-widget--open") && (Oe = !0), gt(), a.appearance ? (ft = !0, K(
1045
1048
  "web-sdk.widget",
1046
1049
  "Agent state supplied appearance",
1047
1050
  {
@@ -1055,15 +1058,15 @@ async function Si(e = {}) {
1055
1058
  fallbackColorScheme: t.colorScheme,
1056
1059
  fallbackFontFamily: t.fontFamily
1057
1060
  }
1058
- ), xt({}, "agent.state.appearance-cleared")), B(a), q(), s && jt();
1059
- }), B(b.getState()), q(), {
1060
- agent: b,
1061
+ ), xt({}, "agent.state.appearance-cleared")), F(a), q(), s && jt();
1062
+ }), F(w.getState()), q(), {
1063
+ agent: w,
1061
1064
  updateAppearance: (a) => {
1062
1065
  a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), xt(a, "widgetHandle.updateAppearance");
1063
1066
  },
1064
1067
  updateBillingStatus: (a) => {
1065
1068
  const s = a ?? null;
1066
- Cn(
1069
+ Sn(
1067
1070
  t.billingStatus,
1068
1071
  s,
1069
1072
  ke
@@ -1075,7 +1078,7 @@ async function Si(e = {}) {
1075
1078
  },
1076
1079
  updateAuthGate: (a) => {
1077
1080
  const s = Ke();
1078
- t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), B(b.getState()), q(), s && !Ke() && b.connect().catch((_) => {
1081
+ t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(w.getState()), q(), s && !Ke() && w.connect().catch((_) => {
1079
1082
  K(
1080
1083
  "web-sdk.widget",
1081
1084
  "Failed to connect after auth gate cleared",
@@ -1096,19 +1099,19 @@ async function Si(e = {}) {
1096
1099
  Re("minimized", !1);
1097
1100
  },
1098
1101
  destroy: () => {
1099
- Se || (Se = !0, Wt.disconnect(), Yt?.disconnect(), mo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Jt(), Ee?.remove(), b.destroy(), o.remove());
1102
+ Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(), w.destroy(), o.remove());
1100
1103
  }
1101
1104
  };
1102
- async function vo(a) {
1105
+ async function Co(a) {
1103
1106
  if (!Ze) {
1104
- Ze = a.id, Be = null, B(b.getState());
1107
+ Ze = a.id, Be = null, F(w.getState());
1105
1108
  try {
1106
1109
  if (!t.socialPostDraftHandler)
1107
1110
  throw new Error("Social post drafting is not available here.");
1108
1111
  const s = await t.socialPostDraftHandler(a);
1109
1112
  if (!s.linkedinPost || !s.xPost)
1110
1113
  throw new Error("Pluno did not return a complete social post draft.");
1111
- Ce.add(a.id), qe.add(a.id), H(), Ee?.remove(), Ee = La(s, {
1114
+ Ce.add(a.id), qe.add(a.id), O(), Ee?.remove(), Ee = Ta(s, {
1112
1115
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1113
1116
  onClose: () => {
1114
1117
  Ee?.remove(), Ee = null;
@@ -1117,16 +1120,16 @@ async function Si(e = {}) {
1117
1120
  } catch (s) {
1118
1121
  Be = s instanceof Error ? s.message : "Could not draft social post.";
1119
1122
  } finally {
1120
- Ze = null, B(b.getState());
1123
+ Ze = null, F(w.getState());
1121
1124
  }
1122
1125
  }
1123
1126
  }
1124
1127
  function xt(a, s) {
1125
1128
  const _ = a.accentColor ?? t.accentColor, E = a.colorScheme ?? t.colorScheme, P = a.fontFamily ?? t.fontFamily, yt = a.scribbleStyle ?? t.scribbleStyle;
1126
- r = mn(
1129
+ r = fn(
1127
1130
  _,
1128
1131
  yt
1129
- ), fn(i, r, {
1132
+ ), bn(i, r, {
1130
1133
  accentColor: _,
1131
1134
  colorScheme: E,
1132
1135
  fontFamily: P,
@@ -1142,14 +1145,14 @@ async function Si(e = {}) {
1142
1145
  });
1143
1146
  }
1144
1147
  }
1145
- function mn(e, t) {
1148
+ function fn(e, t) {
1146
1149
  return { accentColor: e, scribbleStyle: t };
1147
1150
  }
1148
- function Ei(e) {
1149
- const t = ki(e);
1150
- return t === null ? "#fafafa" : Li(t) > 0.5 ? "#18181b" : "#fafaf9";
1151
+ function Li(e) {
1152
+ const t = Ii(e);
1153
+ return t === null ? "#fafafa" : Ai(t) > 0.5 ? "#18181b" : "#fafaf9";
1151
1154
  }
1152
- function ki(e) {
1155
+ function Ii(e) {
1153
1156
  const t = e.trim();
1154
1157
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1155
1158
  Number.parseInt(t.slice(1, 3), 16),
@@ -1161,14 +1164,14 @@ function ki(e) {
1161
1164
  Number.parseInt(t[3] + t[3], 16)
1162
1165
  ] : null;
1163
1166
  }
1164
- function Li([e, t, o]) {
1167
+ function Ai([e, t, o]) {
1165
1168
  const n = (i) => {
1166
1169
  const r = i / 255;
1167
1170
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1168
1171
  };
1169
1172
  return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
1170
1173
  }
1171
- function fn(e, t, o) {
1174
+ function bn(e, t, o) {
1172
1175
  e.classList.toggle(
1173
1176
  "pluno-pa-widget--dark",
1174
1177
  o.colorScheme === "dark"
@@ -1176,11 +1179,11 @@ function fn(e, t, o) {
1176
1179
  "pluno-pa-widget--light",
1177
1180
  o.colorScheme !== "dark"
1178
1181
  ), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
1179
- const n = o.scribbleStyle ? Dn(o.accentColor) : o.accentColor;
1182
+ const n = o.scribbleStyle ? Rn(o.accentColor) : o.accentColor;
1180
1183
  e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
1181
1184
  "--pluno-pa-accent-contrast",
1182
- Ei(n)
1183
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? ri : o.fontFamily, o.scribbleStyle && Ii(e.ownerDocument);
1185
+ Li(n)
1186
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? pi : o.fontFamily, o.scribbleStyle && Ni(e.ownerDocument);
1184
1187
  const i = Array.from(
1185
1188
  e.querySelectorAll(".pluno-pa-widget__character")
1186
1189
  );
@@ -1192,11 +1195,11 @@ function fn(e, t, o) {
1192
1195
  )
1193
1196
  );
1194
1197
  }
1195
- function Ii(e) {
1196
- if (e.getElementById(pn))
1198
+ function Ni(e) {
1199
+ if (e.getElementById(sn))
1197
1200
  return;
1198
1201
  const t = e.createElement("style");
1199
- t.id = pn, t.textContent = `@font-face {
1202
+ t.id = sn, t.textContent = `@font-face {
1200
1203
  font-family: "Architects Daughter";
1201
1204
  font-style: normal;
1202
1205
  font-weight: 400;
@@ -1204,7 +1207,7 @@ function Ii(e) {
1204
1207
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1205
1208
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1206
1209
  }
1207
- function Ni({
1210
+ function Ti({
1208
1211
  root: e,
1209
1212
  launcher: t,
1210
1213
  launcherDragHandle: o,
@@ -1217,70 +1220,70 @@ function Ni({
1217
1220
  l = null, p = null, d = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
1218
1221
  }, S = (h) => {
1219
1222
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = n(), u = !1, t.setPointerCapture?.(h.pointerId));
1220
- }, w = (h) => {
1223
+ }, b = (h) => {
1221
1224
  if (l !== h.pointerId || !p || !d)
1222
1225
  return;
1223
1226
  h.preventDefault();
1224
- const T = h.clientX - p.x, D = h.clientY - p.y;
1225
- !u && Math.hypot(T, D) < gn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + T, y: d.y + D }));
1226
- }, F = (h) => {
1227
+ const N = h.clientX - p.x, D = h.clientY - p.y;
1228
+ !u && Math.hypot(N, D) < hn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + N, y: d.y + D }));
1229
+ }, H = (h) => {
1227
1230
  l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (c = { x: h.clientX, y: h.clientY }, r()), g());
1228
1231
  }, k = (h) => {
1229
1232
  l === h.pointerId && (h.preventDefault(), g());
1230
1233
  }, y = (h) => {
1231
1234
  if (!c)
1232
1235
  return;
1233
- const T = Math.hypot(
1236
+ const N = Math.hypot(
1234
1237
  h.clientX - c.x,
1235
1238
  h.clientY - c.y
1236
- ) <= gn;
1237
- c = null, T && (h.preventDefault(), h.stopPropagation());
1239
+ ) <= hn;
1240
+ c = null, N && (h.preventDefault(), h.stopPropagation());
1238
1241
  }, v = (h) => {
1239
1242
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1240
1243
  return;
1241
- const T = h.shiftKey ? yi : xi, D = n();
1244
+ const N = h.shiftKey ? Ci : vi, D = n();
1242
1245
  let L = null;
1243
- h.key === "ArrowUp" ? L = { x: D.x, y: D.y - T } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + T } : h.key === "ArrowLeft" ? L = { x: D.x - T, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + T, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1246
+ h.key === "ArrowUp" ? L = { x: D.x, y: D.y - N } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + N } : h.key === "ArrowLeft" ? L = { x: D.x - N, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + N, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1244
1247
  };
1245
- return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", w), t.addEventListener("pointerup", F), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
1246
- t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", w), t.removeEventListener("pointerup", F), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
1248
+ return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", b), t.addEventListener("pointerup", H), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
1249
+ t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", b), t.removeEventListener("pointerup", H), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
1247
1250
  };
1248
1251
  }
1249
1252
  function it(e, t = !0) {
1250
1253
  const o = ne();
1251
1254
  if (e.classList.contains("pluno-pa-widget--minimized"))
1252
1255
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1253
- width: li,
1254
- height: pi
1255
- } : { width: sn, height: sn };
1256
+ width: si,
1257
+ height: di
1258
+ } : { width: dn, height: dn };
1256
1259
  const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1257
1260
  return {
1258
- width: t && i && n.width > 0 ? n.width : Math.min(Un, o.width - 36),
1259
- height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? di : Bn
1261
+ width: t && i && n.width > 0 ? n.width : Math.min(Bn, o.width - 36),
1262
+ height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? ui : Fn
1260
1263
  };
1261
1264
  }
1262
- function Gn() {
1265
+ function $n() {
1263
1266
  const e = ne();
1264
1267
  return {
1265
1268
  width: Math.min(
1266
- Ae(
1267
- e.width * gi,
1268
- ci,
1269
- ui
1269
+ Te(
1270
+ e.width * mi,
1271
+ gi,
1272
+ hi
1270
1273
  ),
1271
1274
  e.width - W * 2
1272
1275
  ),
1273
1276
  height: Math.min(
1274
- Ae(
1275
- e.height * fi,
1276
- hi,
1277
- mi
1277
+ Te(
1278
+ e.height * wi,
1279
+ fi,
1280
+ bi
1278
1281
  ),
1279
1282
  e.height - Pt - W
1280
1283
  )
1281
1284
  };
1282
1285
  }
1283
- function Ti(e, t, o) {
1286
+ function Pi(e, t, o) {
1284
1287
  const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1285
1288
  if (Number.isFinite(n) && Number.isFinite(i))
1286
1289
  return { x: n, y: i };
@@ -1297,11 +1300,11 @@ function Ct(e, t, o) {
1297
1300
  const n = it(e, !1);
1298
1301
  return t ? Dt(
1299
1302
  e,
1300
- $n(t, n),
1303
+ qn(t, n),
1301
1304
  n
1302
- ) : Ai(o === "bottom-left" ? "bottom-left" : "bottom-right", n, si);
1305
+ ) : Di(o === "bottom-left" ? "bottom-left" : "bottom-right", n, ci);
1303
1306
  }
1304
- function Ai(e, t, o) {
1307
+ function Di(e, t, o) {
1305
1308
  const n = ne();
1306
1309
  return {
1307
1310
  x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
@@ -1309,9 +1312,9 @@ function Ai(e, t, o) {
1309
1312
  };
1310
1313
  }
1311
1314
  function Dt(e, t, o) {
1312
- const n = ne(), i = W + Ri(e);
1315
+ const n = ne(), i = W + zi(e);
1313
1316
  return {
1314
- x: Ae(
1317
+ x: Te(
1315
1318
  t.x,
1316
1319
  W,
1317
1320
  Math.max(
@@ -1319,7 +1322,7 @@ function Dt(e, t, o) {
1319
1322
  n.width - o.width - W
1320
1323
  )
1321
1324
  ),
1322
- y: Ae(
1325
+ y: Te(
1323
1326
  t.y,
1324
1327
  i,
1325
1328
  Math.max(
@@ -1329,39 +1332,39 @@ function Dt(e, t, o) {
1329
1332
  )
1330
1333
  };
1331
1334
  }
1332
- function $n(e, t) {
1335
+ function qn(e, t) {
1333
1336
  const o = ne();
1334
1337
  return {
1335
1338
  x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
1336
1339
  y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
1337
1340
  };
1338
1341
  }
1339
- function Pi(e, t) {
1340
- const o = Di(e, t), n = ne();
1342
+ function Ri(e, t) {
1343
+ const o = Mi(e, t), n = ne();
1341
1344
  return {
1342
1345
  anchor: o,
1343
1346
  x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
1344
1347
  y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
1345
1348
  };
1346
1349
  }
1347
- function Di(e, t) {
1350
+ function Mi(e, t) {
1348
1351
  const o = ne(), n = e.x + t.width / 2, r = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
1349
1352
  return `${r}-${l}`;
1350
1353
  }
1351
- function Ri(e) {
1352
- return e.classList.contains("pluno-pa-widget--scribble") ? _i : wi;
1354
+ function zi(e) {
1355
+ return e.classList.contains("pluno-pa-widget--scribble") ? yi : xi;
1353
1356
  }
1354
- function bn(e, t, o) {
1355
- const n = it(e), i = Gn(), r = {
1357
+ function wn(e, t, o) {
1358
+ const n = it(e), i = $n(), r = {
1356
1359
  x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
1357
1360
  y: t.y + n.height - i.height
1358
1361
  };
1359
- return Mi(r);
1362
+ return Oi(r);
1360
1363
  }
1361
- function Mi(e) {
1362
- const t = ne(), o = Gn();
1364
+ function Oi(e) {
1365
+ const t = ne(), o = $n();
1363
1366
  return {
1364
- x: Ae(
1367
+ x: Te(
1365
1368
  e.x,
1366
1369
  W,
1367
1370
  Math.max(
@@ -1369,7 +1372,7 @@ function Mi(e) {
1369
1372
  t.width - o.width - W
1370
1373
  )
1371
1374
  ),
1372
- y: Ae(
1375
+ y: Te(
1373
1376
  e.y,
1374
1377
  Pt,
1375
1378
  Math.max(
@@ -1386,16 +1389,16 @@ function xe(e, t) {
1386
1389
  }
1387
1390
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1388
1391
  }
1389
- function zi(e, t) {
1392
+ function Ui(e, t) {
1390
1393
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1391
1394
  }
1392
- function wn(e) {
1395
+ function _n(e) {
1393
1396
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1394
1397
  }
1395
1398
  function ne() {
1396
1399
  return {
1397
- width: window.innerWidth || document.documentElement.clientWidth || Un + W * 2,
1398
- height: window.innerHeight || document.documentElement.clientHeight || Bn + W * 2
1400
+ width: window.innerWidth || document.documentElement.clientWidth || Bn + W * 2,
1401
+ height: window.innerHeight || document.documentElement.clientHeight || Fn + W * 2
1399
1402
  };
1400
1403
  }
1401
1404
  function St(e) {
@@ -1407,7 +1410,7 @@ function St(e) {
1407
1410
  height: Math.round(t.height)
1408
1411
  };
1409
1412
  }
1410
- function Ae(e, t, o) {
1413
+ function Te(e, t, o) {
1411
1414
  return Math.min(Math.max(e, t), o);
1412
1415
  }
1413
1416
  function K(e, t, o) {
@@ -1420,19 +1423,31 @@ function K(e, t, o) {
1420
1423
  details: o
1421
1424
  }, r = n.__plunoProductAgentDiagnostics__ ?? [];
1422
1425
  r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1423
- new CustomEvent(ei, { detail: i })
1426
+ new CustomEvent(ni, { detail: i })
1424
1427
  );
1425
1428
  }
1426
- function Oi(e, t) {
1429
+ function Bi(e, t) {
1427
1430
  K("web-sdk.widget.position", e, t);
1428
1431
  }
1429
1432
  function Et(e, t, o) {
1430
1433
  const n = t.value.trim();
1431
1434
  return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
1432
- attachments: o.length > 0 ? o.map(Ui) : void 0
1435
+ attachments: o.length > 0 ? o.map(Wi) : void 0
1433
1436
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1434
1437
  }
1435
- function Ui(e) {
1438
+ function Fi(e, t, o) {
1439
+ const n = e.activeElement;
1440
+ return n === o ? "composer" : n === t ? "launcher" : null;
1441
+ }
1442
+ function Hi(e, t, o, n) {
1443
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Vo)
1444
+ return;
1445
+ const i = e.focusedInput === "composer" ? n : o;
1446
+ i === n && !t.classList.contains("pluno-pa-widget--open") || i === o && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1447
+ !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1448
+ });
1449
+ }
1450
+ function Wi(e) {
1436
1451
  return e;
1437
1452
  }
1438
1453
  function He(e) {
@@ -1445,7 +1460,7 @@ function We(e, t = () => !0) {
1445
1460
  t() && (e.scrollTop = e.scrollHeight);
1446
1461
  });
1447
1462
  }
1448
- function Bi(e) {
1463
+ function Gi(e) {
1449
1464
  const t = e.messages[e.messages.length - 1];
1450
1465
  return [
1451
1466
  e.messages.length,
@@ -1456,13 +1471,13 @@ function Bi(e) {
1456
1471
  e.lastError ?? ""
1457
1472
  ].join(":");
1458
1473
  }
1459
- function Fi(e) {
1474
+ function $i(e) {
1460
1475
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1461
1476
  }
1462
- function Hi(e) {
1477
+ function qi(e) {
1463
1478
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1464
1479
  }
1465
- function Wi(e) {
1480
+ function ji(e) {
1466
1481
  const t = e.currentPage;
1467
1482
  if (typeof t?.url == "string" && t.url.trim())
1468
1483
  try {
@@ -1473,7 +1488,7 @@ function Wi(e) {
1473
1488
  }
1474
1489
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1475
1490
  }
1476
- function Gi(e, t) {
1491
+ function Vi(e, t) {
1477
1492
  const o = new Date(e).getTime();
1478
1493
  if (!Number.isFinite(o))
1479
1494
  return "now";
@@ -1489,9 +1504,9 @@ function Gi(e, t) {
1489
1504
  }
1490
1505
  return "now";
1491
1506
  }
1492
- function $i(e, t, o, n, i) {
1493
- e.appendChild(Qi()), e.appendChild(
1494
- qi(
1507
+ function Ki(e, t, o, n, i) {
1508
+ e.appendChild(oa()), e.appendChild(
1509
+ Yi(
1495
1510
  t,
1496
1511
  o,
1497
1512
  n,
@@ -1501,19 +1516,19 @@ function $i(e, t, o, n, i) {
1501
1516
  rt(
1502
1517
  "pluno-pa-widget__close",
1503
1518
  "Close",
1504
- ea(16),
1519
+ ia(16),
1505
1520
  !0
1506
1521
  )
1507
- ), e.appendChild(ji(o));
1522
+ ), e.appendChild(Xi(o));
1508
1523
  }
1509
- function qi(e, t, o, n) {
1524
+ function Yi(e, t, o, n) {
1510
1525
  const i = document.createElement("form");
1511
1526
  if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
1512
1527
  const d = document.createElement("button");
1513
1528
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
1514
1529
  }
1515
1530
  i.appendChild(
1516
- Kn(
1531
+ Yn(
1517
1532
  "pluno-pa-widget__scribble-spirals--launcher",
1518
1533
  10
1519
1534
  )
@@ -1534,15 +1549,15 @@ function qi(e, t, o, n) {
1534
1549
  }
1535
1550
  return i;
1536
1551
  }
1537
- function ji(e) {
1552
+ function Xi(e) {
1538
1553
  const t = document.createElement("section");
1539
1554
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1540
- Kn("pluno-pa-widget__scribble-spirals--panel", 16)
1555
+ Yn("pluno-pa-widget__scribble-spirals--panel", 16)
1541
1556
  );
1542
1557
  const o = document.createElement("div");
1543
1558
  o.className = "pluno-pa-widget__timeline-wrap";
1544
1559
  const n = document.createElement("main");
1545
- n.className = "pluno-pa-widget__timeline", n.appendChild(Xi(e));
1560
+ n.className = "pluno-pa-widget__timeline", n.appendChild(ea(e));
1546
1561
  const i = document.createElement("div");
1547
1562
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
1548
1563
  const r = document.createElement("div");
@@ -1554,12 +1569,12 @@ function ji(e) {
1554
1569
  rt(
1555
1570
  "pluno-pa-widget__history",
1556
1571
  Rt(),
1557
- na(),
1572
+ ra(),
1558
1573
  !0
1559
1574
  )
1560
- ), o.appendChild(p), o.appendChild(Yi()), t.appendChild(o), t.appendChild(Vi()), t.appendChild(Ki()), t;
1575
+ ), o.appendChild(p), o.appendChild(Qi()), t.appendChild(o), t.appendChild(Zi()), t.appendChild(Ji()), t;
1561
1576
  }
1562
- function Vi() {
1577
+ function Zi() {
1563
1578
  const e = document.createElement("div");
1564
1579
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1565
1580
  const t = document.createElement("span");
@@ -1573,7 +1588,7 @@ function Vi() {
1573
1588
  const r = document.createElement("button");
1574
1589
  return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", o.append(n, i, r), e.append(t, o), e;
1575
1590
  }
1576
- function Ki() {
1591
+ function Ji() {
1577
1592
  const e = document.createElement("form");
1578
1593
  e.className = "pluno-pa-widget__composer";
1579
1594
  const t = document.createElement("div");
@@ -1587,11 +1602,11 @@ function Ki() {
1587
1602
  const r = document.createElement("input");
1588
1603
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1589
1604
  const l = document.createElement("button");
1590
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ia()), l.appendChild(aa()), i.appendChild(l);
1605
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(pa()), l.appendChild(sa()), i.appendChild(l);
1591
1606
  const p = document.createElement("textarea");
1592
1607
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1593
1608
  const d = document.createElement("button");
1594
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(Yn()), i.appendChild(d), e.appendChild(i);
1609
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(Xn()), i.appendChild(d), e.appendChild(i);
1595
1610
  const u = document.createElement("div");
1596
1611
  u.className = "pluno-pa-widget__composer-meta";
1597
1612
  const c = document.createElement("a");
@@ -1602,7 +1617,7 @@ function Ki() {
1602
1617
  function Rt() {
1603
1618
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1604
1619
  }
1605
- function Yi() {
1620
+ function Qi() {
1606
1621
  const e = document.createElement("section");
1607
1622
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Rt());
1608
1623
  const t = document.createElement("div");
@@ -1612,7 +1627,7 @@ function Yi() {
1612
1627
  const n = rt(
1613
1628
  "pluno-pa-widget__history-close",
1614
1629
  "Close recent chats",
1615
- oa(),
1630
+ la(),
1616
1631
  !1
1617
1632
  );
1618
1633
  t.append(o, n);
@@ -1621,20 +1636,20 @@ function Yi() {
1621
1636
  const r = document.createElement("p");
1622
1637
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1623
1638
  }
1624
- function Xi(e) {
1639
+ function ea(e) {
1625
1640
  const t = document.createElement("div");
1626
1641
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1627
1642
  de(
1628
1643
  "pluno-pa-widget__character--empty",
1629
1644
  e
1630
1645
  )
1631
- ), t.appendChild(qn()), t;
1646
+ ), t.appendChild(jn()), t;
1632
1647
  }
1633
- function qn() {
1648
+ function jn() {
1634
1649
  const e = document.createElement("div");
1635
1650
  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;
1636
1651
  }
1637
- function jn(e, t) {
1652
+ function Vn(e, t) {
1638
1653
  e.replaceChildren(), e.setAttribute(
1639
1654
  "aria-label",
1640
1655
  `${t.toLocaleString("en-US")} users currently active`
@@ -1647,16 +1662,16 @@ function jn(e, t) {
1647
1662
  );
1648
1663
  }
1649
1664
  function de(e, t) {
1650
- const o = `pluno-pa-character-${hn}`;
1651
- hn += 1;
1652
- const n = t.scribbleStyle ? Ji(t.accentColor, o) : Zi(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1665
+ const o = `pluno-pa-character-${mn}`;
1666
+ mn += 1;
1667
+ const n = t.scribbleStyle ? na(t.accentColor, o) : ta(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1653
1668
  return n.setAttribute(
1654
1669
  "class",
1655
1670
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1656
1671
  ), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
1657
1672
  }
1658
- function Zi(e, t) {
1659
- const o = ko(e), n = {
1673
+ function ta(e, t) {
1674
+ const o = Lo(e), n = {
1660
1675
  boltFill: `${t}-boltFill`,
1661
1676
  boltEdge: `${t}-boltEdge`,
1662
1677
  boltGlow: `${t}-boltGlow`,
@@ -1667,7 +1682,7 @@ function Zi(e, t) {
1667
1682
  eyeShadow: `${t}-eyeShadow`,
1668
1683
  pupilGloss: `${t}-pupilGloss`,
1669
1684
  boltClip: `${t}-boltClip`
1670
- }, i = Vn(), r = m(i, "defs"), l = m(r, "linearGradient", {
1685
+ }, i = Kn(), r = m(i, "defs"), l = m(r, "linearGradient", {
1671
1686
  id: n.boltFill,
1672
1687
  x1: "420",
1673
1688
  y1: "180",
@@ -1754,7 +1769,7 @@ function Zi(e, t) {
1754
1769
  in2: "innerLight",
1755
1770
  mode: "screen"
1756
1771
  });
1757
- const w = m(r, "filter", {
1772
+ const b = m(r, "filter", {
1758
1773
  id: n.eyeShadow,
1759
1774
  x: "-24%",
1760
1775
  y: "-20%",
@@ -1762,14 +1777,14 @@ function Zi(e, t) {
1762
1777
  height: "148%",
1763
1778
  "color-interpolation-filters": "sRGB"
1764
1779
  });
1765
- m(w, "feDropShadow", {
1780
+ m(b, "feDropShadow", {
1766
1781
  dx: "0",
1767
1782
  dy: "8",
1768
1783
  stdDeviation: "5",
1769
1784
  "flood-color": o.shadow,
1770
1785
  "flood-opacity": "0.3"
1771
1786
  });
1772
- const F = m(r, "filter", {
1787
+ const H = m(r, "filter", {
1773
1788
  id: n.pupilGloss,
1774
1789
  x: "-15%",
1775
1790
  y: "-15%",
@@ -1777,7 +1792,7 @@ function Zi(e, t) {
1777
1792
  height: "130%",
1778
1793
  "color-interpolation-filters": "sRGB"
1779
1794
  });
1780
- m(F, "feDropShadow", {
1795
+ m(H, "feDropShadow", {
1781
1796
  dx: "0",
1782
1797
  dy: "3",
1783
1798
  stdDeviation: "3",
@@ -1829,9 +1844,9 @@ function Zi(e, t) {
1829
1844
  "stroke-linecap": "round",
1830
1845
  opacity: "0.48"
1831
1846
  });
1832
- const T = m(i, "g", { filter: j(n.eyeShadow) });
1833
- return _n(
1834
- T,
1847
+ const N = m(i, "g", { filter: j(n.eyeShadow) });
1848
+ return xn(
1849
+ N,
1835
1850
  "rotate(-2 528 463)",
1836
1851
  "528",
1837
1852
  "463",
@@ -1840,8 +1855,8 @@ function Zi(e, t) {
1840
1855
  "557",
1841
1856
  "447",
1842
1857
  n
1843
- ), _n(
1844
- T,
1858
+ ), xn(
1859
+ N,
1845
1860
  "rotate(2 717 462)",
1846
1861
  "717",
1847
1862
  "462",
@@ -1852,11 +1867,11 @@ function Zi(e, t) {
1852
1867
  n
1853
1868
  ), i;
1854
1869
  }
1855
- function Ji(e, t) {
1856
- const o = Dn(e), n = {
1870
+ function na(e, t) {
1871
+ const o = Rn(e), n = {
1857
1872
  clip: `${t}-scribbleBoltClip`,
1858
1873
  wobble: `${t}-scribbleBoltWobble`
1859
- }, i = Vn(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
1874
+ }, i = Kn(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
1860
1875
  m(l, "path", { d: nt });
1861
1876
  const p = m(r, "filter", {
1862
1877
  id: n.wobble,
@@ -1883,7 +1898,7 @@ function Ji(e, t) {
1883
1898
  "clip-path": j(n.clip)
1884
1899
  });
1885
1900
  return m(u, "path", {
1886
- d: Eo(),
1901
+ d: ko(),
1887
1902
  fill: "none",
1888
1903
  stroke: o,
1889
1904
  "stroke-width": "56",
@@ -1897,7 +1912,7 @@ function Ji(e, t) {
1897
1912
  stroke: ot,
1898
1913
  "stroke-width": "18",
1899
1914
  "stroke-linejoin": "round"
1900
- }), xn(
1915
+ }), yn(
1901
1916
  d,
1902
1917
  "rotate(-2 528 463)",
1903
1918
  "528",
@@ -1906,7 +1921,7 @@ function Ji(e, t) {
1906
1921
  "473",
1907
1922
  "557",
1908
1923
  "447"
1909
- ), xn(
1924
+ ), yn(
1910
1925
  d,
1911
1926
  "rotate(2 717 462)",
1912
1927
  "717",
@@ -1917,13 +1932,13 @@ function Ji(e, t) {
1917
1932
  "447"
1918
1933
  ), i;
1919
1934
  }
1920
- function Vn() {
1935
+ function Kn() {
1921
1936
  return C("svg", {
1922
- xmlns: Fn,
1937
+ xmlns: Hn,
1923
1938
  viewBox: "0 0 1254 1254"
1924
1939
  });
1925
1940
  }
1926
- function _n(e, t, o, n, i, r, l, p, d) {
1941
+ function xn(e, t, o, n, i, r, l, p, d) {
1927
1942
  const u = m(e, "g", { transform: t });
1928
1943
  m(u, "ellipse", {
1929
1944
  cx: o,
@@ -1945,7 +1960,7 @@ function _n(e, t, o, n, i, r, l, p, d) {
1945
1960
  fill: "#ffffff"
1946
1961
  });
1947
1962
  }
1948
- function xn(e, t, o, n, i, r, l, p) {
1963
+ function yn(e, t, o, n, i, r, l, p) {
1949
1964
  const d = m(e, "g", { transform: t });
1950
1965
  m(d, "ellipse", {
1951
1966
  cx: o,
@@ -1983,7 +1998,7 @@ function rt(e, t, o, n) {
1983
1998
  const i = document.createElement("button");
1984
1999
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
1985
2000
  }
1986
- function Qi() {
2001
+ function oa() {
1987
2002
  const e = C("svg", {
1988
2003
  class: "pluno-pa-widget__scribble-defs",
1989
2004
  "aria-hidden": "true",
@@ -1997,17 +2012,17 @@ function Qi() {
1997
2012
  kt("pluno-pa-scribble-wobble-3", "9", "19")
1998
2013
  ), e.appendChild(t), e;
1999
2014
  }
2000
- function Kn(e, t) {
2001
- const o = t * dn + cn * 2, n = C("svg", {
2015
+ function Yn(e, t) {
2016
+ const o = t * cn + un * 2, n = C("svg", {
2002
2017
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2003
- viewBox: `0 0 ${o} ${bi}`,
2018
+ viewBox: `0 0 ${o} ${_i}`,
2004
2019
  preserveAspectRatio: "xMidYMid meet",
2005
2020
  "aria-hidden": "true",
2006
2021
  focusable: "false"
2007
2022
  });
2008
2023
  for (let i = 0; i < t; i += 1) {
2009
- const r = un[i % un.length], l = C("g", {
2010
- transform: `translate(${cn + i * dn} 0)`
2024
+ const r = gn[i % gn.length], l = C("g", {
2025
+ transform: `translate(${un + i * cn} 0)`
2011
2026
  });
2012
2027
  l.appendChild(
2013
2028
  C("ellipse", {
@@ -2075,7 +2090,7 @@ function kt(e, t, o) {
2075
2090
  })
2076
2091
  ), n;
2077
2092
  }
2078
- function ea(e) {
2093
+ function ia(e) {
2079
2094
  const t = oe(
2080
2095
  "0 0 24 24",
2081
2096
  e,
@@ -2086,7 +2101,7 @@ function ea(e) {
2086
2101
  );
2087
2102
  return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
2088
2103
  }
2089
- function ta() {
2104
+ function aa() {
2090
2105
  const e = oe(
2091
2106
  "0 0 24 24",
2092
2107
  17,
@@ -2105,7 +2120,7 @@ function ta() {
2105
2120
  })
2106
2121
  ), e;
2107
2122
  }
2108
- function na() {
2123
+ function ra() {
2109
2124
  const e = oe(
2110
2125
  "0 0 24 24",
2111
2126
  17,
@@ -2116,7 +2131,7 @@ function na() {
2116
2131
  );
2117
2132
  return e.appendChild(C("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(C("path", { d: "M3 4v5h5" })), e.appendChild(C("path", { d: "M12 7v5l3 2" })), e;
2118
2133
  }
2119
- function oa() {
2134
+ function la() {
2120
2135
  const e = oe(
2121
2136
  "0 0 24 24",
2122
2137
  15,
@@ -2127,7 +2142,7 @@ function oa() {
2127
2142
  );
2128
2143
  return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2129
2144
  }
2130
- function Yn() {
2145
+ function Xn() {
2131
2146
  const e = oe(
2132
2147
  "0 0 24 24",
2133
2148
  14,
@@ -2140,7 +2155,7 @@ function Yn() {
2140
2155
  C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2141
2156
  ), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
2142
2157
  }
2143
- function ia() {
2158
+ function pa() {
2144
2159
  const e = oe(
2145
2160
  "0 0 24 24",
2146
2161
  16,
@@ -2158,7 +2173,7 @@ function ia() {
2158
2173
  })
2159
2174
  ), e;
2160
2175
  }
2161
- function aa() {
2176
+ function sa() {
2162
2177
  const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
2163
2178
  return e.setAttribute(
2164
2179
  "class",
@@ -2173,7 +2188,7 @@ function aa() {
2173
2188
  })
2174
2189
  ), e;
2175
2190
  }
2176
- function ra() {
2191
+ function da() {
2177
2192
  const e = oe("0 0 24 24", 18, 18, "currentColor");
2178
2193
  return e.appendChild(
2179
2194
  C("rect", {
@@ -2185,7 +2200,7 @@ function ra() {
2185
2200
  })
2186
2201
  ), e;
2187
2202
  }
2188
- function la() {
2203
+ function ca() {
2189
2204
  const e = oe(
2190
2205
  "0 0 24 24",
2191
2206
  12,
@@ -2196,7 +2211,7 @@ function la() {
2196
2211
  );
2197
2212
  return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2198
2213
  }
2199
- function pa() {
2214
+ function ua() {
2200
2215
  const e = oe(
2201
2216
  "0 0 24 24",
2202
2217
  13,
@@ -2231,30 +2246,30 @@ function oe(e, t, o, n, i, r) {
2231
2246
  return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), C("svg", l);
2232
2247
  }
2233
2248
  function C(e, t = {}) {
2234
- const o = document.createElementNS(Fn, e);
2249
+ const o = document.createElementNS(Hn, e);
2235
2250
  for (const [n, i] of Object.entries(t))
2236
2251
  o.setAttribute(n, i);
2237
2252
  return o;
2238
2253
  }
2239
- function yn(e) {
2254
+ function vn(e) {
2240
2255
  for (const t of ["keydown", "keypress", "keyup"])
2241
2256
  e.addEventListener(t, (o) => {
2242
2257
  o.stopPropagation();
2243
2258
  });
2244
2259
  }
2245
- function sa(e, t, o) {
2260
+ function ga(e, t, o) {
2246
2261
  e.replaceChildren(), e.hidden = t.length === 0;
2247
2262
  for (const [n, i] of t.entries()) {
2248
2263
  const r = document.createElement("div");
2249
- r.className = "pluno-pa-widget__attachment", r.appendChild(da(i));
2264
+ r.className = "pluno-pa-widget__attachment", r.appendChild(ha(i));
2250
2265
  const l = document.createElement("span");
2251
2266
  l.textContent = i.name, r.appendChild(l);
2252
2267
  const p = document.createElement("button");
2253
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(la()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
2268
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(ca()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
2254
2269
  }
2255
2270
  }
2256
- function da(e) {
2257
- const t = Ut(e), o = Xn(e);
2271
+ function ha(e) {
2272
+ const t = Ut(e), o = Zn(e);
2258
2273
  if (t === "image" && o) {
2259
2274
  const n = document.createElement("img");
2260
2275
  return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
@@ -2265,8 +2280,8 @@ function da(e) {
2265
2280
  }
2266
2281
  return ee(e);
2267
2282
  }
2268
- function ca(e) {
2269
- const t = Ut(e), o = Xn(e);
2283
+ function ma(e) {
2284
+ const t = Ut(e), o = Zn(e);
2270
2285
  if (t === "image" && o) {
2271
2286
  const n = document.createElement("img");
2272
2287
  return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n;
@@ -2284,32 +2299,32 @@ function ca(e) {
2284
2299
  function ee(e, t = "composer") {
2285
2300
  if (t === "composer") {
2286
2301
  const r = document.createElement("span");
2287
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = vn(e), r;
2302
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = Cn(e), r;
2288
2303
  }
2289
2304
  const o = document.createElement("div");
2290
2305
  o.className = "pluno-pa-widget__message-attachment-file";
2291
2306
  const n = document.createElement("span");
2292
- n.textContent = vn(e);
2307
+ n.textContent = Cn(e);
2293
2308
  const i = document.createElement("strong");
2294
2309
  return i.textContent = e.name, o.append(n, i), o;
2295
2310
  }
2296
2311
  function Ut(e) {
2297
2312
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2298
2313
  }
2299
- function Xn(e) {
2314
+ function Zn(e) {
2300
2315
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2301
2316
  }
2302
- function vn(e) {
2317
+ function Cn(e) {
2303
2318
  const t = Ut(e);
2304
2319
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2305
2320
  }
2306
- function ua(e, t) {
2321
+ function fa(e, t) {
2307
2322
  return t ? Array.from(t).map((n) => ({
2308
2323
  ...e.createLocalAttachment(n),
2309
- previewUrl: ga(n)
2324
+ previewUrl: ba(n)
2310
2325
  })) : [];
2311
2326
  }
2312
- function ga(e) {
2327
+ function ba(e) {
2313
2328
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2314
2329
  }
2315
2330
  function Qe(e) {
@@ -2321,31 +2336,31 @@ function Lt(e, t, o = null) {
2321
2336
  return;
2322
2337
  }
2323
2338
  e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Bt(o) ? e.appendChild(
2324
- ha(t, o)
2325
- ) : Zn(t) && e.appendChild(ma(t));
2339
+ wa(t, o)
2340
+ ) : Jn(t) && e.appendChild(_a(t));
2326
2341
  }
2327
- function ha(e, t) {
2342
+ function wa(e, t) {
2328
2343
  const o = document.createElement("div");
2329
2344
  o.className = "pluno-pa-widget__billing-action-card";
2330
2345
  const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2331
2346
  i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
2332
2347
  const r = document.createElement("span");
2333
2348
  return r.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(r), o.appendChild(
2334
- Jn(
2349
+ Qn(
2335
2350
  e,
2336
2351
  "Upgrade plan",
2337
2352
  "pluno-pa-widget__billing-action-card-actions"
2338
2353
  )
2339
2354
  ), o;
2340
2355
  }
2341
- function ma(e) {
2356
+ function _a(e) {
2342
2357
  const t = document.createElement("div");
2343
2358
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2344
2359
  const o = document.createElement("strong");
2345
2360
  o.textContent = "Credits running low", t.appendChild(o);
2346
2361
  const n = document.createElement("span");
2347
- return n.textContent = ba(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2348
- Jn(
2362
+ return n.textContent = ya(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2363
+ Qn(
2349
2364
  e,
2350
2365
  "Upgrade",
2351
2366
  "pluno-pa-widget__billing-action-card-actions"
@@ -2353,12 +2368,12 @@ function ma(e) {
2353
2368
  ), t;
2354
2369
  }
2355
2370
  function Mt(e, t) {
2356
- return e !== null && (te(e) || Zn(e) || Bt(t));
2371
+ return e !== null && (te(e) || Jn(e) || Bt(t));
2357
2372
  }
2358
- function Cn(e, t, o) {
2359
- return Mt(t, o) || fa(t) ? !0 : !Mt(e, o);
2373
+ function Sn(e, t, o) {
2374
+ return Mt(t, o) || xa(t) ? !0 : !Mt(e, o);
2360
2375
  }
2361
- function fa(e) {
2376
+ function xa(e) {
2362
2377
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
2363
2378
  }
2364
2379
  function te(e) {
@@ -2367,26 +2382,26 @@ function te(e) {
2367
2382
  function Bt(e) {
2368
2383
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2369
2384
  }
2370
- function Zn(e) {
2385
+ function Jn(e) {
2371
2386
  return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2372
2387
  }
2373
- function ba(e) {
2374
- return e.creditsRemaining === null ? null : `${wa(e.creditsRemaining)} credits left`;
2388
+ function ya(e) {
2389
+ return e.creditsRemaining === null ? null : `${va(e.creditsRemaining)} credits left`;
2375
2390
  }
2376
- function wa(e) {
2391
+ function va(e) {
2377
2392
  return new Intl.NumberFormat("en-US", {
2378
2393
  maximumFractionDigits: 0
2379
2394
  }).format(Math.ceil(e));
2380
2395
  }
2381
- function Jn(e, t, o) {
2396
+ function Qn(e, t, o) {
2382
2397
  const n = document.createElement("div");
2383
2398
  return n.className = o, n.appendChild(
2384
- Sn(t, e.pricingUrl)
2399
+ En(t, e.pricingUrl)
2385
2400
  ), n.appendChild(
2386
- Sn("Earn credits", e.earnCreditsUrl)
2401
+ En("Earn credits", e.earnCreditsUrl)
2387
2402
  ), n;
2388
2403
  }
2389
- function Sn(e, t) {
2404
+ function En(e, t) {
2390
2405
  const o = document.createElement("button");
2391
2406
  if (o.type = "button", e === "Earn credits") {
2392
2407
  const n = document.createElement("span");
@@ -2399,16 +2414,16 @@ function Sn(e, t) {
2399
2414
  }
2400
2415
  function It(e, t) {
2401
2416
  return e.messages.filter(
2402
- (n) => !Qn(n)
2417
+ (n) => !eo(n)
2403
2418
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2404
2419
  }
2405
- function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2406
- const y = Ca(r), v = y.filter(
2407
- (x) => !Qn(x)
2408
- ), h = e.scrollTop, T = [], D = /* @__PURE__ */ new Set(), L = (x) => {
2409
- T.push(x);
2420
+ function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
2421
+ const y = La(r), v = y.filter(
2422
+ (x) => !eo(x)
2423
+ ), h = e.scrollTop, N = [], D = /* @__PURE__ */ new Set(), L = (x) => {
2424
+ N.push(x);
2410
2425
  };
2411
- to(o, r.isThinking), i.hidden = !p, p && l !== null && jn(i, l);
2426
+ no(o, r.isThinking), i.hidden = !p, p && l !== null && Vn(i, l);
2412
2427
  const Pe = v.length > 0 || !!r.assistantDraft || r.isThinking;
2413
2428
  if (n(Pe), v.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2414
2429
  const x = document.createElement("div");
@@ -2417,37 +2432,37 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2417
2432
  z.className = "pluno-pa-widget__empty-hero";
2418
2433
  const I = de(
2419
2434
  "pluno-pa-widget__character--empty",
2420
- w()
2435
+ b()
2421
2436
  );
2422
- z.appendChild(I), x.appendChild(z), x.appendChild(qn());
2437
+ z.appendChild(I), x.appendChild(z), x.appendChild(jn());
2423
2438
  const $ = document.createElement("div");
2424
2439
  if ($.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2425
- for (const N of r.starterPrompts) {
2426
- const A = document.createElement("button");
2427
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${N}"`, A.addEventListener("click", () => {
2428
- F(N);
2429
- }), $.appendChild(A);
2440
+ for (const A of r.starterPrompts) {
2441
+ const T = document.createElement("button");
2442
+ T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${A}"`, T.addEventListener("click", () => {
2443
+ H(A);
2444
+ }), $.appendChild(T);
2430
2445
  }
2431
2446
  else if (r.starterPromptsLoading) {
2432
- const N = document.createElement("button");
2433
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", N.disabled = !0, N.tabIndex = -1, N.textContent = "Generating example tasks...", $.appendChild(N);
2447
+ const A = document.createElement("button");
2448
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", $.appendChild(A);
2434
2449
  } else
2435
- for (let N = 0; N < ti; N += 1) {
2436
- const A = document.createElement("button");
2437
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", $.appendChild(A);
2450
+ for (let A = 0; A < oi; A += 1) {
2451
+ const T = document.createElement("button");
2452
+ T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.textContent = "", $.appendChild(T);
2438
2453
  }
2439
- x.appendChild($), g.clear(), L(x), L(t), En(e, T);
2454
+ x.appendChild($), g.clear(), L(x), L(t), kn(e, N);
2440
2455
  return;
2441
2456
  }
2442
2457
  let f = null, R = null, ce = [];
2443
2458
  const ue = v.some(zt), ye = () => {
2444
2459
  if (ce.length === 0)
2445
2460
  return !1;
2446
- const x = Da(
2461
+ const x = Oa(
2447
2462
  ce,
2448
2463
  c,
2449
2464
  S,
2450
- w()
2465
+ b()
2451
2466
  );
2452
2467
  return L(x), f = null, R = x, ce = [], !0;
2453
2468
  };
@@ -2462,20 +2477,20 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2462
2477
  const ge = at();
2463
2478
  L(ge), f = null, R = ge;
2464
2479
  } else {
2465
- const ge = In(w());
2480
+ const ge = An(b());
2466
2481
  L(ge), f = null, R = ge;
2467
2482
  }
2468
2483
  continue;
2469
2484
  }
2470
2485
  if (z.role === "system")
2471
2486
  continue;
2472
- const I = ye(), $ = Pa(z.content);
2487
+ const I = ye(), $ = za(z.content);
2473
2488
  if (z.role === "assistant" && !I) {
2474
- const A = eo(w());
2475
- L(A), f = null, R = A;
2489
+ const T = to(b());
2490
+ L(T), f = null, R = T;
2476
2491
  }
2477
- const N = xa(z, $, g, D);
2478
- L(N), f = N, R = null;
2492
+ const A = Sa(z, $, g, D);
2493
+ L(A), f = A, R = null;
2479
2494
  }
2480
2495
  const G = ye(), $e = v[v.length - 1]?.id === "assistant-draft";
2481
2496
  if (r.isThinking && !$e && !ue)
@@ -2483,7 +2498,7 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2483
2498
  const x = at();
2484
2499
  L(x), f = null, R = x;
2485
2500
  } else {
2486
- const x = In(w());
2501
+ const x = An(b());
2487
2502
  L(x), f = null, R = x;
2488
2503
  }
2489
2504
  if (r.lastError) {
@@ -2492,7 +2507,7 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2492
2507
  }
2493
2508
  const Y = k && !r.isThinking ? To(y) : null;
2494
2509
  if (k && Y && !k.dismissedCandidateIds.has(Y.id)) {
2495
- const x = ka(Y, {
2510
+ const x = Na(Y, {
2496
2511
  isDrafting: k.draftingCandidateId === Y.id,
2497
2512
  error: k.error,
2498
2513
  characterIconOptions: k.characterIconOptions,
@@ -2502,18 +2517,18 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
2502
2517
  });
2503
2518
  L(x), k.onSeen(Y), f = null, R = x;
2504
2519
  }
2505
- f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), va(g, D), En(e, T), d ? We(e, u) : e.scrollTop = h;
2520
+ f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), ka(g, D), kn(e, N), d ? We(e, u) : e.scrollTop = h;
2506
2521
  }
2507
- function xa(e, t, o, n) {
2508
- const i = ya(e, t), r = i ? o.get(i) : void 0;
2522
+ function Sa(e, t, o, n) {
2523
+ const i = Ea(e, t), r = i ? o.get(i) : void 0;
2509
2524
  if (i && r)
2510
2525
  return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), r;
2511
2526
  const l = document.createElement("div");
2512
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Ma(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Sa(e.attachments));
2527
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Ba(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Ia(e.attachments));
2513
2528
  const p = document.createElement("div");
2514
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Ea(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2529
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(Aa(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2515
2530
  }
2516
- function ya(e, t) {
2531
+ function Ea(e, t) {
2517
2532
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2518
2533
  id: e.id,
2519
2534
  content: t,
@@ -2531,11 +2546,11 @@ function ya(e, t) {
2531
2546
  })
2532
2547
  });
2533
2548
  }
2534
- function va(e, t) {
2549
+ function ka(e, t) {
2535
2550
  for (const o of e.keys())
2536
2551
  t.has(o) || e.delete(o);
2537
2552
  }
2538
- function En(e, t) {
2553
+ function kn(e, t) {
2539
2554
  let o = e.firstChild;
2540
2555
  for (const n of t) {
2541
2556
  if (n === o) {
@@ -2549,7 +2564,7 @@ function En(e, t) {
2549
2564
  o = o.nextSibling, e.removeChild(n);
2550
2565
  }
2551
2566
  }
2552
- function Ca(e) {
2567
+ function La(e) {
2553
2568
  if (!e.assistantDraft)
2554
2569
  return [...e.messages];
2555
2570
  const t = {
@@ -2569,7 +2584,7 @@ function Ca(e) {
2569
2584
  if (o === -1)
2570
2585
  return [...e.messages, t];
2571
2586
  const n = e.messages.findIndex(
2572
- (r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && kn(r, t) && zt(r)
2587
+ (r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Ln(r, t) && zt(r)
2573
2588
  );
2574
2589
  if (n !== -1)
2575
2590
  return [
@@ -2578,7 +2593,7 @@ function Ca(e) {
2578
2593
  ...e.messages.slice(n + 1)
2579
2594
  ];
2580
2595
  let i = o + 1;
2581
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && kn(e.messages[i], t); )
2596
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Ln(e.messages[i], t); )
2582
2597
  i += 1;
2583
2598
  return [
2584
2599
  ...e.messages.slice(0, i),
@@ -2589,11 +2604,11 @@ function Ca(e) {
2589
2604
  function zt(e) {
2590
2605
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2591
2606
  }
2592
- function kn(e, t) {
2607
+ function Ln(e, t) {
2593
2608
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2594
2609
  }
2595
- function Ln(e, t, o, n, i, r, l, p) {
2596
- e.replaceChildren(), to(t, !1), t.disabled = !0, o(!1);
2610
+ function In(e, t, o, n, i, r, l, p) {
2611
+ e.replaceChildren(), no(t, !1), t.disabled = !0, o(!1);
2597
2612
  const d = document.createElement("div");
2598
2613
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2599
2614
  const u = de(
@@ -2611,20 +2626,20 @@ function Ln(e, t, o, n, i, r, l, p) {
2611
2626
  }
2612
2627
  e.appendChild(d);
2613
2628
  }
2614
- function Sa(e) {
2629
+ function Ia(e) {
2615
2630
  const t = document.createElement("div");
2616
2631
  t.className = "pluno-pa-widget__message-attachments";
2617
2632
  for (const o of e)
2618
- t.appendChild(ca(o));
2633
+ t.appendChild(ma(o));
2619
2634
  return t;
2620
2635
  }
2621
- function Ea(e) {
2636
+ function Aa(e) {
2622
2637
  const t = document.createElement("button");
2623
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(pa()), t.addEventListener("click", (o) => {
2638
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ua()), t.addEventListener("click", (o) => {
2624
2639
  o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
2625
2640
  }), t;
2626
2641
  }
2627
- function ka(e, t) {
2642
+ function Na(e, t) {
2628
2643
  const o = document.createElement("article");
2629
2644
  o.className = "pluno-pa-widget__share-prompt";
2630
2645
  const n = document.createElement("div");
@@ -2665,7 +2680,7 @@ function ka(e, t) {
2665
2680
  }
2666
2681
  return n.appendChild(p), o.appendChild(n), o;
2667
2682
  }
2668
- function La(e, t) {
2683
+ function Ta(e, t) {
2669
2684
  const o = document.createElement("div");
2670
2685
  o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (y) => {
2671
2686
  y.target === o && t.onClose();
@@ -2684,11 +2699,11 @@ function La(e, t) {
2684
2699
  u.className = "pluno-pa-widget__share-dialog-step-header";
2685
2700
  const c = document.createElement("strong");
2686
2701
  c.textContent = "1) Copy Screenshot", u.appendChild(c);
2687
- const g = Ia(
2702
+ const g = Pa(
2688
2703
  "Copy Screenshot",
2689
2704
  async () => {
2690
2705
  try {
2691
- return await Ao(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2706
+ return await Po(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2692
2707
  } catch {
2693
2708
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2694
2709
  }
@@ -2703,15 +2718,15 @@ function La(e, t) {
2703
2718
  n.appendChild(d), n.appendChild(p);
2704
2719
  const S = document.createElement("div");
2705
2720
  S.className = "pluno-pa-widget__share-dialog-step";
2706
- const w = document.createElement("strong");
2707
- w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "2) Share on", S.appendChild(w);
2708
- const F = document.createElement("p");
2709
- F.className = "pluno-pa-widget__share-dialog-hint", F.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(F);
2721
+ const b = document.createElement("strong");
2722
+ b.className = "pluno-pa-widget__share-dialog-step-title", b.textContent = "2) Share on", S.appendChild(b);
2723
+ const H = document.createElement("p");
2724
+ H.className = "pluno-pa-widget__share-dialog-hint", H.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(H);
2710
2725
  const k = document.createElement("footer");
2711
2726
  k.className = "pluno-pa-widget__share-dialog-platforms";
2712
- for (const y of Na(e)) {
2727
+ for (const y of Da(e)) {
2713
2728
  const v = document.createElement("a");
2714
- v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(Ta(y.id)), k.appendChild(v);
2729
+ v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(Ra(y.id)), k.appendChild(v);
2715
2730
  }
2716
2731
  if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
2717
2732
  const y = document.createElement("div");
@@ -2719,17 +2734,17 @@ function La(e, t) {
2719
2734
  const v = document.createElement("strong");
2720
2735
  v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(v);
2721
2736
  const h = document.createElement("a");
2722
- 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(Aa()), y.appendChild(h), n.appendChild(y);
2737
+ 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(Ma()), y.appendChild(h), n.appendChild(y);
2723
2738
  }
2724
2739
  return o.appendChild(n), o;
2725
2740
  }
2726
- function Ia(e, t) {
2741
+ function Pa(e, t) {
2727
2742
  const o = document.createElement("button");
2728
2743
  return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
2729
2744
  n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
2730
2745
  }), o;
2731
2746
  }
2732
- function Na(e) {
2747
+ function Da(e) {
2733
2748
  const t = e.linkedinPost.trim(), o = e.xPost.trim();
2734
2749
  return [
2735
2750
  {
@@ -2749,47 +2764,47 @@ function Na(e) {
2749
2764
  }
2750
2765
  ];
2751
2766
  }
2752
- function Ta(e) {
2767
+ function Ra(e) {
2753
2768
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2754
- 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" ? (O(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), O(
2769
+ 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(
2755
2770
  t,
2756
2771
  "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"
2757
- ), O(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), O(
2772
+ ), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
2758
2773
  t,
2759
2774
  "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"
2760
- ), O(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (O(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), O(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), O(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (O(
2775
+ ), 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(
2761
2776
  t,
2762
2777
  "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"
2763
- ), O(
2778
+ ), U(
2764
2779
  t,
2765
2780
  "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",
2766
2781
  "0.48"
2767
- ), O(
2782
+ ), U(
2768
2783
  t,
2769
2784
  "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"
2770
- ), O(
2785
+ ), U(
2771
2786
  t,
2772
2787
  "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"
2773
2788
  ), t);
2774
2789
  }
2775
- function O(e, t, o) {
2790
+ function U(e, t, o) {
2776
2791
  const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
2777
2792
  n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
2778
2793
  }
2779
- function Aa() {
2794
+ function Ma() {
2780
2795
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2781
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), O(e, "M14 5h5v5"), O(e, "M19 5l-8 8"), O(
2796
+ 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(
2782
2797
  e,
2783
2798
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2784
2799
  ), e;
2785
2800
  }
2786
- function Qn(e) {
2787
- return e.role === "tool" && e.toolName === Mn;
2801
+ function eo(e) {
2802
+ return e.role === "tool" && e.toolName === zn;
2788
2803
  }
2789
- function Pa(e) {
2804
+ function za(e) {
2790
2805
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2791
2806
  }
2792
- function Da(e, t, o, n) {
2807
+ function Oa(e, t, o, n) {
2793
2808
  const i = document.createElement("article");
2794
2809
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
2795
2810
  e[e.length - 1].createdAt
@@ -2799,7 +2814,7 @@ function Da(e, t, o, n) {
2799
2814
  n
2800
2815
  )
2801
2816
  );
2802
- const r = document.createElement("details"), l = Ra(e);
2817
+ const r = document.createElement("details"), l = Ua(e);
2803
2818
  r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
2804
2819
  i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), o();
2805
2820
  });
@@ -2812,14 +2827,14 @@ function Da(e, t, o, n) {
2812
2827
  for (const g of e) {
2813
2828
  const S = document.createElement("div");
2814
2829
  S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(Ot());
2815
- const w = document.createElement("span");
2816
- w.textContent = g.content || "Run tool", S.appendChild(w), c.appendChild(S);
2830
+ const b = document.createElement("span");
2831
+ b.textContent = g.content || "Run tool", S.appendChild(b), c.appendChild(S);
2817
2832
  }
2818
2833
  r.appendChild(c);
2819
2834
  }
2820
2835
  return i.appendChild(r), i;
2821
2836
  }
2822
- function eo(e) {
2837
+ function to(e) {
2823
2838
  const t = document.createElement("article");
2824
2839
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2825
2840
  de(
@@ -2828,8 +2843,8 @@ function eo(e) {
2828
2843
  )
2829
2844
  ), t;
2830
2845
  }
2831
- function In(e) {
2832
- const t = eo(e);
2846
+ function An(e) {
2847
+ const t = to(e);
2833
2848
  return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(at()), t;
2834
2849
  }
2835
2850
  function at(e = "Thinking...") {
@@ -2840,17 +2855,17 @@ function at(e = "Thinking...") {
2840
2855
  const n = document.createElement("span");
2841
2856
  return n.textContent = e, t.appendChild(n), t;
2842
2857
  }
2843
- function Ra(e) {
2858
+ function Ua(e) {
2844
2859
  return `tools:${e[0]?.id ?? ""}`;
2845
2860
  }
2846
2861
  function Ot() {
2847
2862
  const e = document.createElement("span");
2848
2863
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2849
2864
  }
2850
- function to(e, t) {
2851
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ra() : Yn());
2865
+ function no(e, t) {
2866
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? da() : Xn());
2852
2867
  }
2853
- function Ma(e, t) {
2868
+ function Ba(e, t) {
2854
2869
  const o = t.replace(/\r\n/g, `
2855
2870
  `).split(`
2856
2871
  `);
@@ -2924,7 +2939,7 @@ function et(e, t) {
2924
2939
  p.textContent = l.slice(1, -1), e.appendChild(p);
2925
2940
  } else {
2926
2941
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2927
- if (p && za(p[2])) {
2942
+ if (p && Fa(p[2])) {
2928
2943
  const d = document.createElement("a");
2929
2944
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
2930
2945
  } else
@@ -2934,7 +2949,7 @@ function et(e, t) {
2934
2949
  }
2935
2950
  n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
2936
2951
  }
2937
- function za(e) {
2952
+ function Fa(e) {
2938
2953
  if (e.startsWith("/") || e.startsWith("#"))
2939
2954
  return !0;
2940
2955
  try {
@@ -2945,7 +2960,7 @@ function za(e) {
2945
2960
  }
2946
2961
  }
2947
2962
  function Nn(e, t) {
2948
- if (Oa(e))
2963
+ if (Ha(e))
2949
2964
  return;
2950
2965
  const o = `
2951
2966
  :host {
@@ -3590,6 +3605,7 @@ function Nn(e, t) {
3590
3605
  background: transparent;
3591
3606
  }
3592
3607
  .pluno-pa-widget__message {
3608
+ flex: 0 0 auto;
3593
3609
  position: relative;
3594
3610
  min-width: 0;
3595
3611
  color: var(--pluno-pa-text);
@@ -3806,6 +3822,7 @@ function Nn(e, t) {
3806
3822
  border-bottom-color: var(--pluno-pa-accent);
3807
3823
  }
3808
3824
  .pluno-pa-widget__tool-group {
3825
+ flex: 0 0 auto;
3809
3826
  display: flex;
3810
3827
  align-items: flex-start;
3811
3828
  gap: 8px;
@@ -3889,6 +3906,7 @@ function Nn(e, t) {
3889
3906
  to { transform: rotate(360deg); }
3890
3907
  }
3891
3908
  .pluno-pa-widget__share-prompt {
3909
+ flex: 0 0 auto;
3892
3910
  align-self: stretch;
3893
3911
  display: block;
3894
3912
  color: var(--pluno-pa-muted);
@@ -4231,18 +4249,25 @@ function Nn(e, t) {
4231
4249
  font-size: 12px;
4232
4250
  line-height: 1.4;
4233
4251
  }
4252
+ .pluno-pa-widget__notify-suggestion-label {
4253
+ min-width: 0;
4254
+ }
4234
4255
  .pluno-pa-widget__notify-suggestion-actions {
4256
+ flex: 0 0 auto;
4235
4257
  display: inline-flex;
4236
4258
  align-items: center;
4237
4259
  gap: 10px;
4260
+ white-space: nowrap;
4238
4261
  }
4239
4262
  .pluno-pa-widget__notify-suggestion-actions button {
4240
4263
  border: none;
4241
4264
  background: none;
4242
4265
  padding: 0;
4266
+ font: inherit;
4243
4267
  font-size: 12px;
4244
4268
  cursor: pointer;
4245
4269
  color: var(--pluno-pa-muted);
4270
+ white-space: nowrap;
4246
4271
  }
4247
4272
  .pluno-pa-widget__notify-suggestion-enable {
4248
4273
  color: var(--pluno-pa-accent) !important;
@@ -4536,6 +4561,7 @@ function Nn(e, t) {
4536
4561
  padding: 24px 0;
4537
4562
  }
4538
4563
  .pluno-pa-widget__empty-state {
4564
+ flex: 0 0 auto;
4539
4565
  margin: auto;
4540
4566
  display: grid;
4541
4567
  gap: 12px;
@@ -4673,6 +4699,7 @@ function Nn(e, t) {
4673
4699
  background: #18181b;
4674
4700
  }
4675
4701
  .pluno-pa-widget__status {
4702
+ flex: 0 0 auto;
4676
4703
  display: inline-flex;
4677
4704
  align-items: center;
4678
4705
  gap: 8px;
@@ -4696,6 +4723,7 @@ function Nn(e, t) {
4696
4723
  50% { opacity: 1; transform: scale(1); }
4697
4724
  }
4698
4725
  .pluno-pa-widget__error {
4726
+ flex: 0 0 auto;
4699
4727
  margin: 0 14px 8px;
4700
4728
  padding: 6px 10px;
4701
4729
  border-radius: 8px;
@@ -4795,6 +4823,10 @@ function Nn(e, t) {
4795
4823
  .pluno-pa-widget--scribble .pluno-pa-widget__message {
4796
4824
  font-size: 17px;
4797
4825
  }
4826
+ .pluno-pa-widget--scribble .pluno-pa-widget__notify-suggestion,
4827
+ .pluno-pa-widget--scribble .pluno-pa-widget__notify-suggestion-actions button {
4828
+ font-size: 17px;
4829
+ }
4798
4830
  .pluno-pa-widget--scribble .pluno-pa-widget__input {
4799
4831
  font-size: 17px;
4800
4832
  line-height: 26px;
@@ -5118,28 +5150,28 @@ function Nn(e, t) {
5118
5150
  filter: url(#pluno-pa-scribble-wobble-2);
5119
5151
  }
5120
5152
  `;
5121
- if (Ua(e, o))
5153
+ if (Wa(e, o))
5122
5154
  return;
5123
5155
  const n = e.ownerDocument.createElement("style");
5124
- n.id = Hn, n.textContent = o, e.appendChild(n), no(e);
5156
+ n.id = Wn, n.textContent = o, e.appendChild(n), oo(e);
5125
5157
  }
5126
- function Oa(e) {
5127
- return e.getElementById(Hn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Wn) === "true";
5158
+ function Ha(e) {
5159
+ return e.getElementById(Wn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gn) === "true";
5128
5160
  }
5129
- function no(e) {
5130
- e.host instanceof HTMLElement && e.host.setAttribute(Wn, "true");
5161
+ function oo(e) {
5162
+ e.host instanceof HTMLElement && e.host.setAttribute(Gn, "true");
5131
5163
  }
5132
- function Ua(e, t) {
5164
+ function Wa(e, t) {
5133
5165
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5134
5166
  return !1;
5135
5167
  try {
5136
5168
  const o = new CSSStyleSheet();
5137
- return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], no(e), !0;
5169
+ return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], oo(e), !0;
5138
5170
  } catch {
5139
5171
  return !1;
5140
5172
  }
5141
5173
  }
5142
- async function Ba() {
5174
+ async function Ga() {
5143
5175
  return document.body ? document.body : await new Promise((e) => {
5144
5176
  const t = new MutationObserver(() => {
5145
5177
  document.body && (t.disconnect(), e(document.body));
@@ -5147,39 +5179,41 @@ async function Ba() {
5147
5179
  t.observe(document.documentElement, { childList: !0 });
5148
5180
  });
5149
5181
  }
5150
- function oo(e) {
5182
+ function io(e) {
5151
5183
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5152
5184
  }
5153
- function Fa(e) {
5185
+ function $a(e) {
5154
5186
  try {
5155
- const t = window.localStorage.getItem(oo(e));
5187
+ const t = window.localStorage.getItem(io(e));
5156
5188
  if (!t)
5157
5189
  return Tn();
5158
5190
  const o = JSON.parse(t);
5159
5191
  return {
5160
5192
  isOpen: o.isOpen === !0,
5161
5193
  composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
5194
+ focusedInput: o.focusedInput === "composer" || o.focusedInput === "launcher" ? o.focusedInput : null,
5195
+ focusedInputAt: typeof o.focusedInputAt == "number" ? o.focusedInputAt : null,
5162
5196
  openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
5163
5197
  (n) => typeof n == "string"
5164
5198
  ) : [],
5165
- launcherPosition: $a(o.launcherPosition) ? o.launcherPosition : null,
5166
- seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-zn) : [],
5199
+ launcherPosition: Ka(o.launcherPosition) ? o.launcherPosition : null,
5200
+ seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-On) : [],
5167
5201
  sharePromptsDisabled: o.sharePromptsDisabled === !0
5168
5202
  };
5169
5203
  } catch {
5170
5204
  return Tn();
5171
5205
  }
5172
5206
  }
5173
- async function Ha(e) {
5207
+ async function qa(e) {
5174
5208
  if (e.loadSharePromptsDisabled)
5175
5209
  return e.loadSharePromptsDisabled();
5176
5210
  try {
5177
- return window.localStorage.getItem(On) === "true";
5211
+ return window.localStorage.getItem(Un) === "true";
5178
5212
  } catch {
5179
5213
  return !1;
5180
5214
  }
5181
5215
  }
5182
- function Wa(e, t) {
5216
+ function ja(e, t) {
5183
5217
  if (e.persistSharePromptsDisabled) {
5184
5218
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5185
5219
  () => {
@@ -5188,7 +5222,7 @@ function Wa(e, t) {
5188
5222
  return;
5189
5223
  }
5190
5224
  try {
5191
- t && window.localStorage.setItem(On, "true");
5225
+ t && window.localStorage.setItem(Un, "true");
5192
5226
  } catch {
5193
5227
  return;
5194
5228
  }
@@ -5197,52 +5231,54 @@ function Tn() {
5197
5231
  return {
5198
5232
  isOpen: !1,
5199
5233
  composerValue: "",
5234
+ focusedInput: null,
5235
+ focusedInputAt: null,
5200
5236
  openToolGroupKeys: [],
5201
5237
  launcherPosition: null,
5202
5238
  seenShareCandidateIds: [],
5203
5239
  sharePromptsDisabled: !1
5204
5240
  };
5205
5241
  }
5206
- function Ga(e, t) {
5242
+ function Va(e, t) {
5207
5243
  try {
5208
5244
  window.localStorage.setItem(
5209
- oo(e),
5245
+ io(e),
5210
5246
  JSON.stringify(t)
5211
5247
  );
5212
5248
  } catch {
5213
5249
  return;
5214
5250
  }
5215
5251
  }
5216
- function $a(e) {
5252
+ function Ka(e) {
5217
5253
  if (!e || typeof e != "object")
5218
5254
  return !1;
5219
5255
  const t = e;
5220
5256
  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");
5221
5257
  }
5222
- const An = /* @__PURE__ */ new WeakSet();
5223
- function qa(e) {
5258
+ const Pn = /* @__PURE__ */ new WeakSet();
5259
+ function Ya(e) {
5224
5260
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5225
5261
  }
5226
- function Pn(e) {
5262
+ function Dn(e) {
5227
5263
  const t = e.pathname.split("/");
5228
5264
  return t[t.length - 1] ?? "";
5229
5265
  }
5230
- function ja(e, t) {
5266
+ function Xa(e, t) {
5231
5267
  const o = new URL(e.src, document.baseURI);
5232
- return o.href === t.href || o.pathname === t.pathname ? !0 : Pn(o) === Pn(t);
5268
+ return o.href === t.href || o.pathname === t.pathname ? !0 : Dn(o) === Dn(t);
5233
5269
  }
5234
5270
  class re extends EventTarget {
5235
5271
  constructor(t, o) {
5236
- super(), this.channelId = o, this.url = t, this.addPreviewListener(Yo, () => {
5272
+ super(), this.channelId = o, this.url = t, this.addPreviewListener(Zo, () => {
5237
5273
  this.readyState = re.OPEN, this.dispatchEvent(new Event("open"));
5238
- }), this.addPreviewListener(Xo, (n) => {
5274
+ }), this.addPreviewListener(Jo, (n) => {
5239
5275
  const i = n;
5240
5276
  this.dispatchEvent(
5241
5277
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5242
5278
  );
5243
- }), this.addPreviewListener(Zo, () => {
5279
+ }), this.addPreviewListener(Qo, () => {
5244
5280
  this.readyState = re.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5245
- }), this.addPreviewListener(Jo, (n) => {
5281
+ }), this.addPreviewListener(ei, (n) => {
5246
5282
  const i = n;
5247
5283
  this.readyState = re.CLOSED, this.dispatchEvent(
5248
5284
  new CloseEvent("close", {
@@ -5254,7 +5290,7 @@ class re extends EventTarget {
5254
5290
  }), window.dispatchEvent(
5255
5291
  new CustomEvent(
5256
5292
  tt(
5257
- jo,
5293
+ Ko,
5258
5294
  this.channelId
5259
5295
  ),
5260
5296
  {
@@ -5274,7 +5310,7 @@ class re extends EventTarget {
5274
5310
  binaryType = "blob";
5275
5311
  bufferedAmount = 0;
5276
5312
  readyState = re.CONNECTING;
5277
- socketId = Va();
5313
+ socketId = Za();
5278
5314
  listeners = /* @__PURE__ */ new Map();
5279
5315
  send(t) {
5280
5316
  if (this.readyState !== re.OPEN)
@@ -5284,7 +5320,7 @@ class re extends EventTarget {
5284
5320
  );
5285
5321
  window.dispatchEvent(
5286
5322
  new CustomEvent(
5287
- tt(Vo, this.channelId),
5323
+ tt(Yo, this.channelId),
5288
5324
  {
5289
5325
  detail: {
5290
5326
  socketId: this.socketId,
@@ -5297,7 +5333,7 @@ class re extends EventTarget {
5297
5333
  close(t, o) {
5298
5334
  this.readyState !== re.CLOSED && (this.readyState = re.CLOSING, window.dispatchEvent(
5299
5335
  new CustomEvent(
5300
- tt(Ko, this.channelId),
5336
+ tt(Xo, this.channelId),
5301
5337
  {
5302
5338
  detail: { socketId: this.socketId, code: t, reason: o }
5303
5339
  }
@@ -5319,19 +5355,19 @@ class re extends EventTarget {
5319
5355
  this.listeners.clear();
5320
5356
  }
5321
5357
  }
5322
- function Va() {
5358
+ function Za() {
5323
5359
  const e = window.sessionStorage.getItem(
5324
- an
5360
+ rn
5325
5361
  );
5326
5362
  if (e)
5327
5363
  return e;
5328
5364
  const t = crypto.randomUUID();
5329
- return window.sessionStorage.setItem(an, t), t;
5365
+ return window.sessionStorage.setItem(rn, t), t;
5330
5366
  }
5331
5367
  function tt(e, t) {
5332
5368
  return `${e}:${t}`;
5333
5369
  }
5334
- function Ka(e) {
5370
+ function Ja(e) {
5335
5371
  const t = document.currentScript;
5336
5372
  if (t instanceof HTMLScriptElement)
5337
5373
  return [t];
@@ -5339,20 +5375,20 @@ function Ka(e) {
5339
5375
  return Array.from(
5340
5376
  document.querySelectorAll("script[type='module'][src]")
5341
5377
  ).filter(
5342
- (i) => i instanceof HTMLScriptElement && qa(i) && ja(i, n)
5378
+ (i) => i instanceof HTMLScriptElement && Ya(i) && Xa(i, n)
5343
5379
  );
5344
5380
  }
5345
- function Ya(e) {
5346
- for (const t of Ka(e)) {
5347
- if (An.has(t) || t.dataset.plunoAutoMount === "false")
5381
+ function Qa(e) {
5382
+ for (const t of Ja(e)) {
5383
+ if (Pn.has(t) || t.dataset.plunoAutoMount === "false")
5348
5384
  continue;
5349
- An.add(t);
5385
+ Pn.add(t);
5350
5386
  const o = t.dataset.plunoPreviewChannel;
5351
- Si({
5387
+ ki({
5352
5388
  token: t.dataset.plunoToken,
5353
5389
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
5354
5390
  backendUrl: t.dataset.plunoBackendUrl,
5355
- webSocketFactory: o ? Ci(o) : void 0,
5391
+ webSocketFactory: o ? Ei(o) : void 0,
5356
5392
  launcherLabel: t.dataset.plunoLauncherLabel,
5357
5393
  accentColor: t.dataset.plunoAccentColor,
5358
5394
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -5364,8 +5400,8 @@ function Ya(e) {
5364
5400
  });
5365
5401
  }
5366
5402
  }
5367
- Ya(import.meta.url);
5403
+ Qa(import.meta.url);
5368
5404
  export {
5369
- Ci as createProductAgentPreviewBridgeWebSocketFactory,
5370
- Si as mountPlunoProductAgentWidget
5405
+ Ei as createProductAgentPreviewBridgeWebSocketFactory,
5406
+ ki as mountPlunoProductAgentWidget
5371
5407
  };