@pluno/product-agent-web 0.1.54 → 0.1.56

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,26 +1,26 @@
1
- import { PlunoProductAgent as Jn } from "./product-agent-sdk.js";
2
- const Qn = "#7c3aed", $e = "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", qe = "#2c2a1e", zt = [253, 250, 241], Bt = 3.5;
3
- function hn(e) {
4
- const t = mn(e);
5
- if (Ut(Re(t), zt) >= Bt)
1
+ import { PlunoProductAgent as so } from "./product-agent-sdk.js";
2
+ const co = "#7c3aed", Ve = "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", Ke = "#2c2a1e", Wt = [253, 250, 241], Gt = 3.5;
3
+ function yn(e) {
4
+ const t = Cn(e);
5
+ if ($t(Me(t), Wt) >= Gt)
6
6
  return t;
7
- let n = Re(t);
8
- const i = Re(qe);
9
- for (let a = 0; a < 6; a += 1)
10
- if (n = no(n, i, 0.22), Ut(n, zt) >= Bt)
11
- return ut(n);
12
- return ut(n);
13
- }
14
- function eo() {
7
+ let n = Me(t);
8
+ const i = Me(Ke);
9
+ for (let r = 0; r < 6; r += 1)
10
+ if (n = ho(n, i, 0.22), $t(n, Wt) >= Gt)
11
+ return ft(n);
12
+ return ft(n);
13
+ }
14
+ function uo() {
15
15
  let o = "M 280 120", n = !1, i = 0;
16
- for (let a = 150; a <= 1170; a += 62) {
16
+ for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
18
- o += ` L ${p} ${a}`, n = !n, i += 1;
18
+ o += ` L ${p} ${r}`, n = !n, i += 1;
19
19
  }
20
20
  return o;
21
21
  }
22
- function to(e) {
23
- const t = mn(e), o = gt(Re(t));
22
+ function go(e) {
23
+ const t = Cn(e), o = wt(Me(t));
24
24
  return o > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,90 +44,90 @@ function to(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: Y(t, 0.28, -0.03),
48
- middle: Y(t, 0.08, 0.04),
49
- bottom: Y(t, -0.1, 0.02),
50
- edgeStart: Y(t, 0.08, 0.08),
51
- edgeMiddle: Y(t, -0.08, 0.08),
52
- edgeEnd: Y(t, -0.18, 0.05),
53
- glow: Y(t, 0.32, -0.12),
54
- highlight: Y(t, 0.38, -0.18),
55
- inner: Y(t, 0.24, -0.1),
56
- shadow: Y(t, -0.25, -0.08)
47
+ top: Z(t, 0.28, -0.03),
48
+ middle: Z(t, 0.08, 0.04),
49
+ bottom: Z(t, -0.1, 0.02),
50
+ edgeStart: Z(t, 0.08, 0.08),
51
+ edgeMiddle: Z(t, -0.08, 0.08),
52
+ edgeEnd: Z(t, -0.18, 0.05),
53
+ glow: Z(t, 0.32, -0.12),
54
+ highlight: Z(t, 0.38, -0.18),
55
+ inner: Z(t, 0.24, -0.1),
56
+ shadow: Z(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function mn(e) {
59
+ function Cn(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()}` : Qn;
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()}` : co;
62
62
  }
63
- function Re(e) {
63
+ function Me(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function ut([e, t, o]) {
70
+ function ft([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 gt([e, t, o]) {
74
+ function wt([e, t, o]) {
75
75
  const n = (i) => {
76
- const a = i / 255;
77
- return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
76
+ const r = i / 255;
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 Ut(e, t) {
82
- const o = gt(e), n = gt(t), [i, a] = o > n ? [o, n] : [n, o];
83
- return (i + 0.05) / (a + 0.05);
81
+ function $t(e, t) {
82
+ const o = wt(e), n = wt(t), [i, r] = o > n ? [o, n] : [n, o];
83
+ return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function no(e, t, o) {
86
- const n = ht(o);
85
+ function ho(e, t, o) {
86
+ const n = _t(o);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * n,
89
89
  e[1] + (t[1] - e[1]) * n,
90
90
  e[2] + (t[2] - e[2]) * n
91
91
  ];
92
92
  }
93
- function Y(e, t, o) {
94
- const [n, i, a] = oo(Re(e));
95
- return ut(io(n, ht(i + o), ht(a + t)));
93
+ function Z(e, t, o) {
94
+ const [n, i, r] = mo(Me(e));
95
+ return ft(bo(n, _t(i + o), _t(r + t)));
96
96
  }
97
- function oo([e, t, o]) {
98
- const n = e / 255, i = t / 255, a = o / 255, l = Math.max(n, i, a), p = Math.min(n, i, a), c = (l + p) / 2;
97
+ function mo([e, t, o]) {
98
+ const n = e / 255, i = t / 255, r = o / 255, l = Math.max(n, i, r), p = Math.min(n, i, r), c = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, c];
101
101
  const u = l - p, d = c > 0.5 ? u / (2 - l - p) : u / (l + p);
102
- return [(l === n ? (i - a) / u + (i < a ? 6 : 0) : l === i ? (a - n) / u + 2 : (n - i) / u + 4) / 6, d, c];
102
+ return [(l === n ? (i - r) / u + (i < r ? 6 : 0) : l === i ? (r - n) / u + 2 : (n - i) / u + 4) / 6, d, c];
103
103
  }
104
- function io(e, t, o) {
104
+ function bo(e, t, o) {
105
105
  if (t === 0)
106
106
  return [o * 255, o * 255, o * 255];
107
107
  const n = o < 0.5 ? o * (1 + t) : o + t - o * t, i = 2 * o - n;
108
108
  return [
109
- at(i, n, e + 1 / 3) * 255,
110
- at(i, n, e) * 255,
111
- at(i, n, e - 1 / 3) * 255
109
+ dt(i, n, e + 1 / 3) * 255,
110
+ dt(i, n, e) * 255,
111
+ dt(i, n, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function at(e, t, o) {
114
+ function dt(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 ht(e) {
118
+ function _t(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const bn = "suggest_share_on_socials";
122
- function ao(e) {
121
+ const Sn = "suggest_share_on_socials";
122
+ function fo(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 !== bn)
125
+ if (o.role !== "tool" || o.toolName !== Sn)
126
126
  continue;
127
- const n = Ot(e, t, "assistant");
127
+ const n = qt(e, t, "assistant");
128
128
  if (!n)
129
129
  return null;
130
- const i = Ot(e, n.index, "user");
130
+ const i = qt(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 ao(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function ro(e) {
140
- const t = await lo(e);
139
+ async function wo(e) {
140
+ const t = await _o(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 Ot(e, t, o) {
145
+ function qt(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,73 +150,73 @@ function Ot(e, t, o) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function lo(e) {
153
+ async function _o(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const po = "https://app.pluno.ai", so = "/api/product-agent/embed/active-users", co = 1800, uo = 15e3, go = 250, ho = 1e3, mo = 3e4;
157
- function bo(e, t = {}) {
158
- let o = !1, n = null, i = null, a = null;
156
+ const xo = "https://app.pluno.ai", vo = "/api/product-agent/embed/active-users", yo = 1800, Co = 15e3, So = 250, Eo = 1e3, ko = 3e4;
157
+ function Lo(e, t = {}) {
158
+ let o = !1, n = null, i = null, r = null;
159
159
  const l = () => {
160
- a !== null && (window.clearInterval(a), a = null);
160
+ r !== null && (window.clearInterval(r), r = null);
161
161
  }, p = (d) => {
162
162
  o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  u();
164
- }, _o(d)));
164
+ }, Po(d)));
165
165
  }, c = (d) => {
166
166
  if (l(), n === null) {
167
167
  n = d, e(d);
168
168
  return;
169
169
  }
170
- const g = n, S = performance.now();
171
- a = window.setInterval(() => {
170
+ const g = n, E = performance.now();
171
+ r = window.setInterval(() => {
172
172
  if (o) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const f = Math.min(1, (performance.now() - S) / co);
177
- n = Math.round(g + (d - g) * xo(f)), e(n), f >= 1 && (n = d, e(d), l());
178
- }, go);
176
+ const f = Math.min(1, (performance.now() - E) / yo);
177
+ n = Math.round(g + (d - g) * To(f)), e(n), f >= 1 && (n = d, e(d), l());
178
+ }, So);
179
179
  }, u = async () => {
180
180
  try {
181
- const d = await fo(t);
181
+ const d = await Io(t);
182
182
  if (o)
183
183
  return;
184
184
  c(d.count), p(d.refreshAfterMs);
185
185
  } catch {
186
- p(uo);
186
+ p(Co);
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 fo(e) {
193
+ async function Io(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const o = await (e.fetcher ?? fetch)(new URL(so, wo(e.backendUrl ?? po)).toString(), {
196
+ const o = await (e.fetcher ?? fetch)(new URL(vo, Ao(e.backendUrl ?? xo)).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 = Ft(n.count), a = Ft(n.refreshAfterMs ?? n.refresh_after_ms);
203
- if (i === null || a === null)
202
+ const n = await o.json(), i = jt(n.count), r = jt(n.refreshAfterMs ?? n.refresh_after_ms);
203
+ if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
- return { count: i, refreshAfterMs: a };
205
+ return { count: i, refreshAfterMs: r };
206
206
  }
207
- function Ft(e) {
207
+ function jt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function wo(e) {
210
+ function Ao(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function _o(e) {
214
- return Math.min(mo, Math.max(ho, e));
213
+ function Po(e) {
214
+ return Math.min(ko, Math.max(Eo, e));
215
215
  }
216
- function xo(e) {
216
+ function To(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const fn = 100, vo = "product-agent:sdk-preview-socket-connect", yo = "product-agent:sdk-preview-socket-send", Co = "product-agent:sdk-preview-socket-close", So = "product-agent:sdk-preview-socket-open", Eo = "product-agent:sdk-preview-socket-message", ko = "product-agent:sdk-preview-socket-error", Lo = "product-agent:sdk-preview-socket-closed", Ht = "product-agent:sdk-preview-socket-id", Po = "data-pluno-sdk-preview-channel", Io = "product-agent:preview-diagnostic", wn = "pluno.productAgent.sharePromptsDisabled", Ao = 3, No = "No recent chats for this page yet.", Z = {
219
+ const En = 100, No = "product-agent:sdk-preview-socket-connect", Do = "product-agent:sdk-preview-socket-send", Ro = "product-agent:sdk-preview-socket-close", Mo = "product-agent:sdk-preview-socket-open", Oo = "product-agent:sdk-preview-socket-message", zo = "product-agent:sdk-preview-socket-error", Bo = "product-agent:sdk-preview-socket-closed", Vt = "product-agent:sdk-preview-socket-id", Uo = "data-pluno-sdk-preview-channel", Ho = "product-agent:preview-diagnostic", kn = "pluno.productAgent.sharePromptsDisabled", Fo = 3, Kt = 'dialog[open], [aria-modal="true"], [role="dialog"]', Wo = 400, Go = 5e3, $o = 500, Yt = "Close the page's popup to chat", qo = "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 fn = 100, vo = "product-agent:sdk-preview-socket-connect", yo = "product-a
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, To = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Wt = "pluno-pa-scribble-font", _n = 190, xn = 41, Gt = 22, Do = 16, Ro = 24, Mo = 1, zo = 48, Bo = 420, Uo = 520, Oo = 0.24, Fo = 680, Ho = 800, Wo = 0.76, W = 8, mt = 50, vn = "http://www.w3.org/2000/svg", $t = 26, qt = 8, Go = 36, jt = [
227
+ }, jo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Xt = "pluno-pa-scribble-font", Ln = 190, In = 41, Zt = 22, Vo = 16, Ko = 24, Yo = 1, Xo = 48, Zo = 420, Jo = 520, Qo = 0.24, ei = 680, ti = 800, ni = 0.76, F = 8, xt = 50, An = "http://www.w3.org/2000/svg", Jt = 26, Qt = 8, oi = 36, en = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const fn = 100, vo = "product-agent:sdk-preview-socket-connect", yo = "product-a
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], $o = 11, qo = 13, Vt = 4, jo = 10, Vo = 40, Ko = "movable-launcher-position-v2", yn = "pluno-pa-widget-styles", Cn = "data-pluno-pa-widget-styles";
265
- let Kt = 0;
266
- function Yo(e) {
267
- return (t) => new oe(t, e);
264
+ ], ii = 11, ai = 13, tn = 4, ri = 10, li = 40, pi = "movable-launcher-position-v2", Pn = "pluno-pa-widget-styles", Tn = "data-pluno-pa-widget-styles";
265
+ let nn = 0;
266
+ function si(e) {
267
+ return (t) => new ae(t, e);
268
268
  }
269
- async function Xo(e = {}) {
269
+ async function di(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? Z.launcherLabel,
272
- accentColor: e.accentColor ?? Z.accentColor,
273
- colorScheme: e.colorScheme ?? Z.colorScheme,
274
- fontFamily: e.fontFamily ?? Z.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? Z.scribbleStyle,
276
- position: e.position ?? Z.position,
277
- movableLauncher: e.movableLauncher ?? Z.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? Q.launcherLabel,
272
+ accentColor: e.accentColor ?? Q.accentColor,
273
+ colorScheme: e.colorScheme ?? Q.colorScheme,
274
+ fontFamily: e.fontFamily ?? Q.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? Q.scribbleStyle,
276
+ position: e.position ?? Q.position,
277
+ movableLauncher: e.movableLauncher ?? Q.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -307,7 +307,7 @@ async function Xo(e = {}) {
307
307
  onPanelOpenChange: e.onPanelOpenChange,
308
308
  showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0
309
309
  };
310
- X(
310
+ J(
311
311
  "web-sdk.widget",
312
312
  "Mounting widget with merged options",
313
313
  {
@@ -324,39 +324,39 @@ async function Xo(e = {}) {
324
324
  );
325
325
  const o = document.createElement("div");
326
326
  o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
327
- Po,
327
+ Uo,
328
328
  t.sdkPreviewChannelId
329
329
  );
330
330
  const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
331
331
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
332
- let a = Yt(
332
+ let r = on(
333
333
  t.accentColor,
334
334
  t.scribbleStyle
335
335
  );
336
- bi(
336
+ Pi(
337
337
  i,
338
338
  t.launcherLabel,
339
- a,
339
+ r,
340
340
  t.movableLauncher,
341
341
  t.showLauncherMinimizeButton
342
342
  ), n.appendChild(i);
343
- const l = ca(t);
343
+ const l = Ea(t);
344
344
  let p = t.movableLauncher ? l.launcherPosition : null, c = p !== null;
345
- 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"), fe(
345
+ 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"), we(
346
346
  i,
347
- rt(
347
+ ct(
348
348
  i,
349
349
  p,
350
350
  t.position
351
351
  )
352
- )), dn(n, t.accentColor), Xt(i, a, {
352
+ )), wn(n, t.accentColor), an(i, r, {
353
353
  accentColor: t.accentColor,
354
354
  colorScheme: t.colorScheme,
355
355
  fontFamily: t.fontFamily,
356
356
  scribbleStyle: t.scribbleStyle
357
357
  });
358
- const u = await da(), d = u.ownerDocument;
359
- u.appendChild(o), X(
358
+ const u = await Sa(), d = u.ownerDocument;
359
+ u.appendChild(o), J(
360
360
  "web-sdk.widget",
361
361
  "Applied initial widget appearance",
362
362
  {
@@ -368,71 +368,71 @@ async function Xo(e = {}) {
368
368
  );
369
369
  const g = i.querySelector(
370
370
  ".pluno-pa-widget__launcher"
371
- ), S = i.querySelector(
371
+ ), E = i.querySelector(
372
372
  ".pluno-pa-widget__launcher-drag-handle"
373
373
  ), f = i.querySelector(
374
374
  ".pluno-pa-widget__launcher-input"
375
- ), F = i.querySelector(
375
+ ), U = i.querySelector(
376
376
  ".pluno-pa-widget__launcher-minimize"
377
- ), k = i.querySelector(".pluno-pa-widget__panel"), x = i.querySelector(
377
+ ), k = i.querySelector(".pluno-pa-widget__panel"), v = i.querySelector(
378
378
  ".pluno-pa-widget__close"
379
- ), v = i.querySelector(
379
+ ), y = i.querySelector(
380
380
  ".pluno-pa-widget__composer"
381
381
  ), h = i.querySelector(
382
382
  ".pluno-pa-widget__attachment-error"
383
- ), I = i.querySelector(
384
- ".pluno-pa-widget__billing-status"
385
383
  ), T = i.querySelector(
384
+ ".pluno-pa-widget__billing-status"
385
+ ), D = i.querySelector(
386
386
  ".pluno-pa-widget__attachments"
387
- ), P = i.querySelector(
387
+ ), I = i.querySelector(
388
388
  ".pluno-pa-widget__attachment-input"
389
389
  ), ke = i.querySelector(
390
390
  ".pluno-pa-widget__attach"
391
391
  ), b = i.querySelector(
392
392
  ".pluno-pa-widget__input"
393
- ), D = i.querySelector(
393
+ ), R = i.querySelector(
394
394
  ".pluno-pa-widget__send"
395
395
  ), de = i.querySelector(
396
396
  ".pluno-pa-widget__top-actions"
397
397
  ), ce = i.querySelector(
398
398
  ".pluno-pa-widget__history"
399
- ), we = i.querySelector(
399
+ ), _e = i.querySelector(
400
400
  ".pluno-pa-widget__history-panel"
401
- ), G = i.querySelector(
401
+ ), W = i.querySelector(
402
402
  ".pluno-pa-widget__history-list"
403
- ), ie = i.querySelector(
403
+ ), Oe = i.querySelector(
404
404
  ".pluno-pa-widget__history-close"
405
- ), _ = i.querySelector(
405
+ ), K = i.querySelector(
406
406
  ".pluno-pa-widget__history-status"
407
- ), M = i.querySelector(
407
+ ), _ = i.querySelector(
408
408
  ".pluno-pa-widget__timeline-jump"
409
- ), ae = i.querySelector(
409
+ ), O = i.querySelector(
410
410
  ".pluno-pa-widget__active-users-counter"
411
- ), L = i.querySelector(
411
+ ), P = i.querySelector(
412
412
  ".pluno-pa-widget__timeline"
413
- ), A = i.querySelector(
413
+ ), G = i.querySelector(
414
414
  ".pluno-pa-widget__timeline-bottom-sentinel"
415
415
  );
416
- if (!g || !f || !k || !x || !v || !h || !I || !T || !P || !ke || !b || !D || !de || !ce || !we || !G || !ie || !_ || !M || !ae || !L || !A)
416
+ if (!g || !f || !k || !v || !y || !h || !T || !D || !I || !ke || !b || !R || !de || !ce || !_e || !W || !Oe || !K || !_ || !O || !P || !G)
417
417
  throw new Error("Failed to mount Pluno widget");
418
- if (t.movableLauncher && !S)
418
+ if (t.movableLauncher && !E)
419
419
  throw new Error("Failed to mount Pluno widget drag handle");
420
- tn(f), tn(b);
421
- let y = [], B = null;
422
- const _e = () => {
423
- Ri(
424
- T,
425
- y,
426
- (r) => {
427
- y = y.filter(
428
- (s, E) => E !== r
429
- ), _e(), O(w.getState()), $();
420
+ dn(f), dn(b);
421
+ let S = [], L = null;
422
+ const $ = () => {
423
+ Ki(
424
+ D,
425
+ S,
426
+ (a) => {
427
+ S = S.filter(
428
+ (s, x) => x !== a
429
+ ), $(), B(w.getState()), q();
430
430
  }
431
431
  );
432
- }, On = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
432
+ }, Vn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
433
433
  if (!t.tokenEndpoint)
434
434
  throw new Error("Pluno widget requires token or tokenEndpoint");
435
- const r = await fetch(t.tokenEndpoint, {
435
+ const a = await fetch(t.tokenEndpoint, {
436
436
  method: "POST",
437
437
  credentials: "include",
438
438
  headers: { "content-type": "application/json" },
@@ -441,17 +441,17 @@ async function Xo(e = {}) {
441
441
  url: location.href
442
442
  })
443
443
  });
444
- if (!r.ok)
444
+ if (!a.ok)
445
445
  throw new Error("Failed to load Pluno token");
446
- const s = await r.json();
446
+ const s = await a.json();
447
447
  if (!s.token)
448
448
  throw new Error("Pluno token endpoint did not return a token");
449
449
  return s.token;
450
- }), Fn = window.fetch.bind(window);
450
+ }), Kn = window.fetch.bind(window);
451
451
  let w;
452
- w = await Jn.init({
452
+ w = await so.init({
453
453
  token: t.token,
454
- tokenProvider: On,
454
+ tokenProvider: Vn,
455
455
  backendUrl: t.backendUrl,
456
456
  metadata: () => ({
457
457
  ...t.metadata ?? {},
@@ -465,80 +465,80 @@ async function Xo(e = {}) {
465
465
  prepareAttachmentUpload: t.prepareAttachmentUpload,
466
466
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
467
467
  });
468
- const Ke = new Set(l.openToolGroupKeys), xe = new Set(
468
+ const Ze = new Set(l.openToolGroupKeys), xe = new Set(
469
469
  l.seenShareCandidateIds
470
- ), Me = new Set(xe);
471
- let Ye = l.sharePromptsDisabled || await ua(t), j = null, ze = !1, ue = !1, ge = {
470
+ ), ze = new Set(xe);
471
+ let Je = l.sharePromptsDisabled || await ka(t), V = null, Be = !1, ue = !1, ge = {
472
472
  enabled: !0
473
- }, he = 0, Ct = "", re = !1, ne = !1, le = [], Xe = null, Le = null;
474
- const V = (r, s) => {
475
- ge = { enabled: r, reason: s };
476
- }, K = () => {
477
- M.hidden = !0;
478
- }, Hn = () => {
479
- M.hidden = !1;
480
- }, Wn = (r = "jump") => {
481
- V(!0, r), K(), De(L, () => ge.enabled), he = L.scrollTop;
473
+ }, he = 0, It = "", re = !1, ie = !1, le = [], Qe = null, Le = null;
474
+ const Y = (a, s) => {
475
+ ge = { enabled: a, reason: s };
476
+ }, X = () => {
477
+ _.hidden = !0;
478
+ }, Yn = () => {
479
+ _.hidden = !1;
480
+ }, Xn = (a = "jump") => {
481
+ Y(!0, a), X(), Re(P, () => ge.enabled), he = P.scrollTop;
482
482
  }, me = () => {
483
- if (ce.hidden = t.loginRequired, we.hidden = !re, ce.setAttribute("aria-expanded", String(re)), G.classList.toggle(
483
+ if (ce.hidden = t.loginRequired, _e.hidden = !re, ce.setAttribute("aria-expanded", String(re)), W.classList.toggle(
484
484
  "pluno-pa-widget__history-list--center",
485
- ne && le.length === 0
486
- ), G.replaceChildren(), ne && le.length === 0) {
487
- const r = document.createElement("p");
488
- r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", G.appendChild(r);
485
+ ie && le.length === 0
486
+ ), W.replaceChildren(), ie && le.length === 0) {
487
+ const a = document.createElement("p");
488
+ a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", W.appendChild(a);
489
489
  }
490
- for (const r of le) {
490
+ for (const a of le) {
491
491
  const s = document.createElement("button");
492
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ne;
493
- const E = document.createElement("span");
494
- E.className = "pluno-pa-widget__history-item-title", E.textContent = gi(r);
495
- const z = document.createElement("time");
496
- z.className = "pluno-pa-widget__history-time", z.dateTime = r.lastActiveAt, z.textContent = mi(
497
- r.lastActiveAt,
492
+ s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ie;
493
+ const x = document.createElement("span");
494
+ x.className = "pluno-pa-widget__history-item-title", x.textContent = Li(a);
495
+ const A = document.createElement("time");
496
+ A.className = "pluno-pa-widget__history-time", A.dateTime = a.lastActiveAt, A.textContent = Ai(
497
+ a.lastActiveAt,
498
498
  Date.now()
499
499
  );
500
500
  const N = document.createElement("small");
501
- N.className = "pluno-pa-widget__history-path", N.textContent = hi(r), s.append(E, z, N), s.addEventListener("click", () => {
502
- re = !1, Le = null, me(), V(!0, "newSession"), K(), w.loadSession(r.id), O(w.getState());
503
- }), G.appendChild(s);
504
- }
505
- if (ne && le.length > 0) {
506
- const r = document.createElement("p");
507
- r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", G.appendChild(r);
508
- }
509
- _.textContent = Le ?? (!ne && le.length === 0 ? "No recent chats for this page yet." : ""), _.hidden = _.textContent.length === 0;
510
- }, St = async (r) => {
511
- if (!ne) {
512
- ne = !0, Le = null, me();
501
+ N.className = "pluno-pa-widget__history-path", N.textContent = Ii(a), s.append(x, A, N), s.addEventListener("click", () => {
502
+ re = !1, Le = null, me(), Y(!0, "newSession"), X(), w.loadSession(a.id), B(w.getState());
503
+ }), W.appendChild(s);
504
+ }
505
+ if (ie && le.length > 0) {
506
+ const a = document.createElement("p");
507
+ a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", W.appendChild(a);
508
+ }
509
+ K.textContent = Le ?? (!ie && le.length === 0 ? "No recent chats for this page yet." : ""), K.hidden = K.textContent.length === 0;
510
+ }, At = async (a) => {
511
+ if (!ie) {
512
+ ie = !0, Le = null, me();
513
513
  try {
514
- const s = await w.listSessions({ cursor: r, limit: 20 });
515
- le = r ? [...le, ...s.sessions] : s.sessions, Xe = s.nextCursor;
514
+ const s = await w.listSessions({ cursor: a, limit: 20 });
515
+ le = a ? [...le, ...s.sessions] : s.sessions, Qe = s.nextCursor;
516
516
  } catch (s) {
517
- X(
517
+ J(
518
518
  "web-sdk.widget",
519
519
  "Failed to load session history",
520
520
  {
521
521
  message: s instanceof Error ? s.message : String(s)
522
522
  }
523
- ), Le = No;
523
+ ), Le = qo;
524
524
  } finally {
525
- ne = !1, me();
525
+ ie = !1, me();
526
526
  }
527
527
  }
528
- }, Gn = () => {
529
- !Xe || ne || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && St(Xe);
530
- }, $n = () => {
531
- ze || typeof document > "u" || (dn(n, t.accentColor), o.isConnected || d.body?.appendChild(o));
532
- }, Et = new MutationObserver($n);
533
- Et.observe(d.documentElement, {
528
+ }, Zn = () => {
529
+ !Qe || ie || W.scrollHeight - W.scrollTop - W.clientHeight <= 24 && At(Qe);
530
+ }, Jn = () => {
531
+ Be || typeof document > "u" || (wn(n, t.accentColor), o.isConnected || d.body?.appendChild(o));
532
+ }, Pt = new MutationObserver(Jn);
533
+ Pt.observe(d.documentElement, {
534
534
  childList: !0,
535
535
  subtree: !0
536
536
  });
537
- const Ze = (r = !0) => {
538
- const s = je(i, r);
539
- return bt(
537
+ const et = (a = !0) => {
538
+ const s = Ye(i, a);
539
+ return vt(
540
540
  i,
541
- p ? En(p, s) : ni(
541
+ p ? Dn(p, s) : bi(
542
542
  i,
543
543
  t.position,
544
544
  s
@@ -546,34 +546,34 @@ async function Xo(e = {}) {
546
546
  s
547
547
  );
548
548
  }, H = () => {
549
- ha(t, {
549
+ Ia(t, {
550
550
  isOpen: i.classList.contains("pluno-pa-widget--open"),
551
551
  composerValue: b.value,
552
- openToolGroupKeys: [...Ke],
552
+ openToolGroupKeys: [...Ze],
553
553
  launcherPosition: c ? p : null,
554
554
  seenShareCandidateIds: [...xe].slice(
555
- -fn
555
+ -En
556
556
  ),
557
- sharePromptsDisabled: Ye
557
+ sharePromptsDisabled: Je
558
558
  });
559
- }, Be = (r) => {
560
- t.onDisplayStateChange?.(r);
561
- }, Pe = (r, s = !0) => {
562
- if (r === "shown") {
563
- i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ie(!1), s && Be("shown");
559
+ }, Ue = (a) => {
560
+ t.onDisplayStateChange?.(a);
561
+ }, Ie = (a, s = !0) => {
562
+ if (a === "shown") {
563
+ i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ae(!1), s && Ue("shown");
564
564
  return;
565
565
  }
566
- j !== null && (window.clearTimeout(j), j = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, x.hidden = !0, g.tabIndex = 0, b.value = "", fe(
566
+ V !== null && (window.clearTimeout(V), V = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, v.hidden = !0, g.tabIndex = 0, b.value = "", we(
567
567
  i,
568
- rt(
568
+ ct(
569
569
  i,
570
570
  p,
571
571
  t.position
572
572
  )
573
- ), Jt(i), H(), s && Be("minimized");
574
- }, be = (r, s = {}) => {
575
- si(r, {
576
- debugVersion: Ko,
573
+ ), ln(i), H(), s && Ue("minimized");
574
+ }, be = (a, s = {}) => {
575
+ Ci(a, {
576
+ debugVersion: pi,
577
577
  launcherPosition: p,
578
578
  rootClasses: i.className,
579
579
  rootStyle: {
@@ -582,35 +582,35 @@ async function Xo(e = {}) {
582
582
  right: i.style.right,
583
583
  bottom: i.style.bottom
584
584
  },
585
- rootRect: lt(i),
586
- launcherRect: lt(g),
587
- panelRect: lt(k),
588
- viewport: ee(),
585
+ rootRect: ut(i),
586
+ launcherRect: ut(g),
587
+ panelRect: ut(k),
588
+ viewport: ne(),
589
589
  panelHidden: k.hidden,
590
- closeHidden: x.hidden,
590
+ closeHidden: v.hidden,
591
591
  ...s
592
592
  });
593
- }, Ie = (r = !0) => {
593
+ }, Ae = (a = !0) => {
594
594
  if (!p)
595
- return fe(i, null), Ze(r);
596
- const s = Ze(r);
597
- return fe(i, s), be("Applied stored closed launcher position", {
595
+ return we(i, null), et(a);
596
+ const s = et(a);
597
+ return we(i, s), be("Applied stored closed launcher position", {
598
598
  visibleLauncherPosition: s
599
599
  }), s;
600
- }, kt = (r, s) => {
601
- if (!r || !s) {
602
- Jt(i);
600
+ }, Tt = (a, s) => {
601
+ if (!a || !s) {
602
+ ln(i);
603
603
  return;
604
604
  }
605
- pi(i, {
606
- x: r.x - s.x,
607
- y: r.y - s.y
605
+ yi(i, {
606
+ x: a.x - s.x,
607
+ y: a.y - s.y
608
608
  });
609
- }, Lt = () => {
609
+ }, Nt = () => {
610
610
  if (i.classList.contains("pluno-pa-widget--minimized")) {
611
- fe(
611
+ we(
612
612
  i,
613
- rt(
613
+ ct(
614
614
  i,
615
615
  p,
616
616
  t.position
@@ -618,128 +618,180 @@ async function Xo(e = {}) {
618
618
  );
619
619
  return;
620
620
  }
621
- const r = Ie();
621
+ const a = Ae();
622
622
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
623
- const s = Zt(
623
+ const s = rn(
624
624
  i,
625
- r,
625
+ a,
626
626
  t.position
627
627
  );
628
- kt(s, r), be(
628
+ Tt(s, a), be(
629
629
  "Applied open panel position after viewport resize",
630
630
  { openPanelPosition: s }
631
631
  );
632
632
  } else p && be(
633
633
  "Applied visible launcher position after viewport resize",
634
- { visibleLauncherPosition: r }
634
+ { visibleLauncherPosition: a }
635
635
  );
636
636
  };
637
- let Pt = () => {
637
+ let Dt = () => {
638
638
  };
639
- window.addEventListener("resize", Lt), t.movableLauncher && S ? (Ie(), Pt = ti({
639
+ window.addEventListener("resize", Nt), t.movableLauncher && E ? (Ae(), Dt = mi({
640
640
  root: i,
641
641
  launcher: g,
642
- launcherDragHandle: S,
643
- getPosition: () => Ze(),
644
- setPosition: (r) => {
645
- const s = r, E = je(i), z = bt(
642
+ launcherDragHandle: E,
643
+ getPosition: () => et(),
644
+ setPosition: (a) => {
645
+ const s = a, x = Ye(i), A = vt(
646
646
  i,
647
- r,
648
- E
647
+ a,
648
+ x
649
649
  );
650
- p = ii(
651
- z,
652
- E
653
- ), fe(i, z), be("Dragging closed launcher", {
650
+ p = wi(
651
+ A,
652
+ x
653
+ ), we(i, A), be("Dragging closed launcher", {
654
654
  requestedPosition: s
655
655
  });
656
656
  },
657
657
  persist: () => {
658
658
  c = !0, H(), be("Persisted closed launcher drag position");
659
659
  }
660
- })) : fe(i, null);
661
- let Je = !1;
662
- const It = async () => {
663
- if (!(!t.billingStatusLoader || Je)) {
664
- Je = !0;
660
+ })) : we(i, null);
661
+ let tt = !1;
662
+ const Rt = async () => {
663
+ if (!(!t.billingStatusLoader || tt)) {
664
+ tt = !0;
665
665
  try {
666
- const r = await t.billingStatusLoader();
667
- on(
666
+ const a = await t.billingStatusLoader();
667
+ un(
668
668
  t.billingStatus,
669
- r,
669
+ a,
670
670
  w.getState().lastErrorCode
671
- ) && (t.billingStatus = r, dt(
672
- I,
671
+ ) && (t.billingStatus = a, mt(
672
+ T,
673
673
  t.billingStatus,
674
674
  w.getState().lastErrorCode
675
- ), $());
675
+ ), q());
676
676
  } finally {
677
- Je = !1;
677
+ tt = !1;
678
678
  }
679
679
  }
680
- }, pe = (r = "", s = !0) => {
681
- It(), j !== null && (window.clearTimeout(j), j = null), Pe("shown", !1), k.hidden = !1, x.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
682
- const E = Ie(), z = Zt(
680
+ }, pe = (a = "", s = !0) => {
681
+ Rt(), V !== null && (window.clearTimeout(V), V = null), Ie("shown", !1), k.hidden = !1, v.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
682
+ const x = Ae(), A = rn(
683
683
  i,
684
- E,
684
+ x,
685
685
  t.position
686
686
  );
687
- if (kt(z, E), be("Opening launcher at clamped open panel position", {
688
- openPanelPosition: z,
689
- visibleLauncherPosition: E
690
- }), V(!0, "open"), K(), !s) {
691
- i.classList.add("pluno-pa-widget--open"), g.hidden = !0, r && (b.value = r, Te(b)), De(L, () => ge.enabled), he = L.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Be("shown"), t.onPanelOpenChange?.(!0);
687
+ if (Tt(A, x), be("Opening launcher at clamped open panel position", {
688
+ openPanelPosition: A,
689
+ visibleLauncherPosition: x
690
+ }), Y(!0, "open"), X(), !s) {
691
+ i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (b.value = a, De(b)), Re(P, () => ge.enabled), he = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Ue("shown"), t.onPanelOpenChange?.(!0);
692
692
  return;
693
693
  }
694
694
  window.requestAnimationFrame(() => {
695
- i.classList.add("pluno-pa-widget--open"), r && (b.value = r, Te(b)), De(L, () => ge.enabled), he = L.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Be("shown"), t.onPanelOpenChange?.(!0), j = window.setTimeout(() => {
696
- g.hidden = !0, De(L, () => ge.enabled), he = L.scrollTop;
695
+ i.classList.add("pluno-pa-widget--open"), a && (b.value = a, De(b)), Re(P, () => ge.enabled), he = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), H(), Ue("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
696
+ g.hidden = !0, Re(P, () => ge.enabled), he = P.scrollTop;
697
697
  }, 220);
698
698
  });
699
- }, qn = () => {
700
- j !== null && (window.clearTimeout(j), j = null), g.hidden = !1, p && (Ie(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), H(), t.onPanelOpenChange?.(!1), j = window.setTimeout(() => {
701
- k.hidden = !0, x.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
699
+ }, Qn = () => {
700
+ V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Ae(!1), be("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(() => {
701
+ k.hidden = !0, v.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
702
702
  }, 220);
703
703
  };
704
- g.addEventListener("submit", (r) => {
705
- r.preventDefault(), pe(f.value), f.value = "";
706
- }), S?.addEventListener("click", (r) => {
707
- r.preventDefault(), r.stopPropagation();
708
- }), g.addEventListener("click", (r) => {
709
- r.target === f && !S || (pe(f.value), f.value = "");
704
+ g.addEventListener("submit", (a) => {
705
+ a.preventDefault(), pe(f.value), f.value = "";
706
+ }), E?.addEventListener("click", (a) => {
707
+ a.preventDefault(), a.stopPropagation();
708
+ }), g.addEventListener("click", (a) => {
709
+ a.target === f && !E || (pe(f.value), f.value = "");
710
710
  }), f.addEventListener("focus", () => {
711
711
  pe(f.value), f.value = "";
712
712
  }), f.addEventListener("input", () => {
713
713
  if (!f.value)
714
714
  return;
715
- const r = f.value;
716
- pe(r), f.value = "";
717
- }), g.addEventListener("keydown", (r) => {
718
- !i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), pe());
719
- }), F?.addEventListener("pointerdown", (r) => {
720
- r.stopPropagation();
721
- }), F?.addEventListener("click", (r) => {
722
- r.preventDefault(), r.stopPropagation(), Pe("minimized");
723
- }), x.addEventListener("click", qn), L.addEventListener("scroll", () => {
724
- L.scrollTop < he - 1 && V(!1, "userScroll"), he = L.scrollTop;
725
- }), M.addEventListener("click", () => {
726
- Wn();
715
+ const a = f.value;
716
+ pe(a), f.value = "";
717
+ });
718
+ let nt = null, He = null, fe = null;
719
+ const Mt = (a) => a === f || a === b, eo = (a) => {
720
+ if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
721
+ return null;
722
+ let s = a;
723
+ for (; s; ) {
724
+ const x = s.closest(Kt);
725
+ if (x)
726
+ return x;
727
+ const A = s.getRootNode();
728
+ s = A instanceof ShadowRoot ? A.host : null;
729
+ }
730
+ return null;
731
+ }, to = (a) => {
732
+ if (!a.isConnected || !a.matches(Kt))
733
+ return !1;
734
+ if (!(a instanceof HTMLElement))
735
+ return !0;
736
+ if (a.hidden)
737
+ return !1;
738
+ if (typeof a.checkVisibility == "function")
739
+ return a.checkVisibility();
740
+ const s = window.getComputedStyle(a);
741
+ return s.display !== "none" && s.visibility !== "hidden";
742
+ }, Ot = (a) => {
743
+ Pe !== a && (Pe = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), ot(), a !== null ? fe = window.setInterval(() => {
744
+ const s = Pe;
745
+ (!s || !to(s)) && Ot(null);
746
+ }, $o) : fe !== null && (window.clearInterval(fe), fe = null, He = null));
747
+ }, no = () => {
748
+ fe !== null && (window.clearInterval(fe), fe = null);
749
+ };
750
+ i.addEventListener("focusin", (a) => {
751
+ Mt(a.target) && (nt = Date.now());
752
+ }), i.addEventListener("focusout", (a) => {
753
+ if (!Mt(a.target) || Pe !== null)
754
+ return;
755
+ const s = nt;
756
+ if (nt = null, s === null || Date.now() - s > Wo)
757
+ return;
758
+ const x = eo(a.relatedTarget);
759
+ if (!x)
760
+ return;
761
+ const A = Date.now();
762
+ if (He !== null && A - He <= Go) {
763
+ Ot(x);
764
+ return;
765
+ }
766
+ He = A;
767
+ }), g.addEventListener("keydown", (a) => {
768
+ !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), pe());
769
+ }), U?.addEventListener("pointerdown", (a) => {
770
+ a.stopPropagation();
771
+ }), U?.addEventListener("click", (a) => {
772
+ a.preventDefault(), a.stopPropagation(), Ie("minimized");
773
+ }), v.addEventListener("click", Qn), P.addEventListener("scroll", () => {
774
+ P.scrollTop < he - 1 && Y(!1, "userScroll"), he = P.scrollTop;
775
+ }), _.addEventListener("click", () => {
776
+ Xn();
727
777
  });
728
- const At = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
729
- ([r]) => {
730
- r?.isIntersecting && (V(!0, "bottom"), K());
778
+ const zt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
779
+ ([a]) => {
780
+ a?.isIntersecting && (Y(!0, "bottom"), X());
731
781
  },
732
- { root: L, threshold: 0 }
782
+ { root: P, threshold: 0 }
733
783
  );
734
- At?.observe(A);
735
- const Ue = () => t.loginRequired || t.signupRequired, Nt = () => {
736
- const r = Ue();
737
- f.readOnly = r, f.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, b.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Z.launcherLabel, v.hidden = r;
738
- }, $ = () => {
739
- D.disabled = Q(t.billingStatus) || !w.getState().isThinking && b.value.trim().length === 0 && y.length === 0, ke.disabled = Ue() || Q(t.billingStatus);
784
+ zt?.observe(G);
785
+ const Fe = () => t.loginRequired || t.signupRequired;
786
+ let Pe = null;
787
+ const ot = () => {
788
+ const a = Fe(), s = Pe !== null;
789
+ f.readOnly = a || s, b.readOnly = s, f.placeholder = s ? Yt : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, b.placeholder = s ? Yt : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, y.hidden = a;
790
+ }, q = () => {
791
+ R.disabled = te(t.billingStatus) || !w.getState().isThinking && b.value.trim().length === 0 && S.length === 0, ke.disabled = Fe() || te(t.billingStatus);
740
792
  };
741
- Nt(), v.addEventListener("submit", (r) => {
742
- if (r.preventDefault(), t.loginRequired) {
793
+ ot(), y.addEventListener("submit", (a) => {
794
+ if (a.preventDefault(), t.loginRequired) {
743
795
  t.onLoginClick?.();
744
796
  return;
745
797
  }
@@ -747,55 +799,55 @@ async function Xo(e = {}) {
747
799
  t.onSignupClick?.();
748
800
  return;
749
801
  }
750
- Q(t.billingStatus) || (ue = !0, V(!0, "send"), K(), y = pt(
802
+ te(t.billingStatus) || (ue = !0, Y(!0, "send"), X(), S = gt(
751
803
  w,
752
804
  b,
753
- y
754
- ), _e(), $());
805
+ S
806
+ ), $(), q());
755
807
  });
756
- let Ae = 0;
757
- const jn = () => {
758
- Ae = 0, i.classList.remove("pluno-pa-widget--drag-over");
759
- }, Tt = (r) => {
760
- B !== null && window.clearTimeout(B), h.textContent = r, h.hidden = !1, B = window.setTimeout(() => {
761
- h.textContent = "", h.hidden = !0, B = null;
808
+ let Te = 0;
809
+ const oo = () => {
810
+ Te = 0, i.classList.remove("pluno-pa-widget--drag-over");
811
+ }, Bt = (a) => {
812
+ L !== null && window.clearTimeout(L), h.textContent = a, h.hidden = !1, L = window.setTimeout(() => {
813
+ h.textContent = "", h.hidden = !0, L = null;
762
814
  }, 3e3);
763
- }, Vn = () => {
764
- B !== null && (window.clearTimeout(B), B = null), h.textContent = "", h.hidden = !0;
765
- }, Dt = async (r) => {
766
- if (r.length === 0)
815
+ }, io = () => {
816
+ L !== null && (window.clearTimeout(L), L = null), h.textContent = "", h.hidden = !0;
817
+ }, Ut = async (a) => {
818
+ if (a.length === 0)
767
819
  return;
768
- const s = Bi(w, r);
769
- y = [...y, ...s], _e(), Vn(), $(), O(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
820
+ const s = Zi(w, a);
821
+ S = [...S, ...s], $(), io(), q(), B(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
770
822
  };
771
823
  ke.addEventListener("click", () => {
772
- t.loginRequired || Q(t.billingStatus) || P.click();
773
- }), P.addEventListener("change", () => {
774
- const r = Array.from(P.files ?? []);
775
- P.value = "", Dt(r).catch((s) => {
776
- Tt(
824
+ t.loginRequired || te(t.billingStatus) || I.click();
825
+ }), I.addEventListener("change", () => {
826
+ const a = Array.from(I.files ?? []);
827
+ I.value = "", Ut(a).catch((s) => {
828
+ Bt(
777
829
  s instanceof Error ? s.message : "Failed to attach file"
778
- ), X("web-sdk.widget", "Attachment failed", {
830
+ ), J("web-sdk.widget", "Attachment failed", {
779
831
  message: s instanceof Error ? s.message : String(s)
780
832
  });
781
833
  });
782
- }), i.addEventListener("dragenter", (r) => {
783
- !He(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Ae += 1, i.classList.add("pluno-pa-widget--drag-over"));
784
- }), i.addEventListener("dragover", (r) => {
785
- const s = r.dataTransfer;
786
- !He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
787
- }), i.addEventListener("dragleave", (r) => {
788
- He(r.dataTransfer) && (r.stopPropagation(), Ae = Math.max(0, Ae - 1), Ae === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
789
- }), i.addEventListener("drop", (r) => {
790
- const s = r.dataTransfer;
791
- !He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jn(), Dt(s.files).catch((E) => {
792
- Tt(
793
- E instanceof Error ? E.message : "Failed to attach file"
794
- ), X("web-sdk.widget", "Attachment failed", {
795
- message: E instanceof Error ? E.message : String(E)
834
+ }), i.addEventListener("dragenter", (a) => {
835
+ !$e(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Te += 1, i.classList.add("pluno-pa-widget--drag-over"));
836
+ }), i.addEventListener("dragover", (a) => {
837
+ const s = a.dataTransfer;
838
+ !$e(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
839
+ }), i.addEventListener("dragleave", (a) => {
840
+ $e(a.dataTransfer) && (a.stopPropagation(), Te = Math.max(0, Te - 1), Te === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
841
+ }), i.addEventListener("drop", (a) => {
842
+ const s = a.dataTransfer;
843
+ !$e(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), oo(), Ut(s.files).catch((x) => {
844
+ Bt(
845
+ x instanceof Error ? x.message : "Failed to attach file"
846
+ ), J("web-sdk.widget", "Attachment failed", {
847
+ message: x instanceof Error ? x.message : String(x)
796
848
  });
797
849
  }));
798
- }), D.addEventListener("click", () => {
850
+ }), R.addEventListener("click", () => {
799
851
  if (t.loginRequired) {
800
852
  t.onLoginClick?.();
801
853
  return;
@@ -804,64 +856,64 @@ async function Xo(e = {}) {
804
856
  w.stop();
805
857
  return;
806
858
  }
807
- ue = !0, V(!0, "send"), K(), y = pt(
859
+ ue = !0, Y(!0, "send"), X(), S = gt(
808
860
  w,
809
861
  b,
810
- y
811
- ), _e(), $(), O(w.getState());
862
+ S
863
+ ), $(), q(), B(w.getState());
812
864
  }), ce.addEventListener("click", () => {
813
- re = !re, Le = null, me(), re && le.length === 0 && St(null);
814
- }), ie.addEventListener("click", () => {
865
+ re = !re, Le = null, me(), re && le.length === 0 && At(null);
866
+ }), Oe.addEventListener("click", () => {
815
867
  re = !1, me();
816
- }), G.addEventListener("scroll", Gn), b.addEventListener("input", () => {
817
- Te(b), H(), $(), Yn();
818
- }), b.addEventListener("keydown", (r) => {
819
- if (!(r.key !== "Enter" || r.shiftKey)) {
820
- if (r.preventDefault(), t.loginRequired) {
868
+ }), W.addEventListener("scroll", Zn), b.addEventListener("input", () => {
869
+ De(b), H(), q(), ro();
870
+ }), b.addEventListener("keydown", (a) => {
871
+ if (!(a.key !== "Enter" || a.shiftKey)) {
872
+ if (a.preventDefault(), t.loginRequired) {
821
873
  t.onLoginClick?.();
822
874
  return;
823
875
  }
824
- ue = !0, V(!0, "send"), K(), y = pt(
876
+ ue = !0, Y(!0, "send"), X(), S = gt(
825
877
  w,
826
878
  b,
827
- y
828
- ), _e(), $(), O(w.getState());
829
- }
830
- }), i.addEventListener("click", (r) => {
831
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
832
- }), l.composerValue && (b.value = l.composerValue, Te(b)), t.initialDisplayState === "minimized" ? Pe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
833
- const Oe = () => a;
834
- let Qe = w.getState().appearance !== null, Fe = null, Ne = null, ve = null, Rt = w.getState().isThinking, ye = null, Ce = null, Mt = () => {
879
+ S
880
+ ), $(), q(), B(w.getState());
881
+ }
882
+ }), i.addEventListener("click", (a) => {
883
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && H();
884
+ }), l.composerValue && (b.value = l.composerValue, De(b)), t.initialDisplayState === "minimized" ? Ie("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
885
+ const We = () => r;
886
+ let it = w.getState().appearance !== null, Ge = null, Ne = null, ve = null, Ht = w.getState().isThinking, ye = null, Ce = null, Ft = () => {
835
887
  };
836
- const Kn = !!t.socialPostDraftHandler, et = /* @__PURE__ */ new Map(), tt = () => b.value.trim().length > 0 || y.length > 0, Yn = () => {
837
- const r = Ce !== null && ct(w.getState(), tt());
838
- ae.hidden = !r, r && Ce !== null && Ln(ae, Ce);
888
+ const ao = !!t.socialPostDraftHandler, at = /* @__PURE__ */ new Map(), rt = () => b.value.trim().length > 0 || S.length > 0, ro = () => {
889
+ const a = Ce !== null && bt(w.getState(), rt());
890
+ O.hidden = !a, a && Ce !== null && Mn(O, Ce);
839
891
  };
840
892
  let Se = null;
841
- const Xn = () => {
842
- ue = !0, V(!0, "newSession"), K(), re = !1, me(), w.startNewSession(), Ke.clear(), b.value = "", y = [], _e(), Te(b), H(), $(), b.focus(), O(w.getState());
843
- }, nt = (r) => {
844
- if (!r) {
893
+ const lo = () => {
894
+ ue = !0, Y(!0, "newSession"), X(), re = !1, me(), w.startNewSession(), Ze.clear(), b.value = "", S = [], $(), De(b), H(), q(), b.focus(), B(w.getState());
895
+ }, lt = (a) => {
896
+ if (!a) {
845
897
  Se?.remove(), Se = null;
846
898
  return;
847
899
  }
848
- Se || (Se = Ve(
900
+ Se || (Se = Xe(
849
901
  "pluno-pa-widget__new-chat",
850
902
  "New chat",
851
- ki(),
903
+ Hi(),
852
904
  !1
853
- ), Se.addEventListener("click", Xn), de.insertBefore(Se, ce));
854
- }, O = (r) => {
855
- if (me(), yt(r.lastErrorCode) ? ye = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !Q(t.billingStatus) && (ye = null), dt(
856
- I,
905
+ ), Se.addEventListener("click", lo), de.insertBefore(Se, ce));
906
+ }, B = (a) => {
907
+ if (me(), Lt(a.lastErrorCode) ? ye = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ye = null), mt(
908
+ T,
857
909
  t.billingStatus,
858
910
  ye
859
911
  ), t.loginRequired) {
860
- et.clear(), pn(
861
- L,
862
- D,
863
- nt,
864
- Oe,
912
+ at.clear(), bn(
913
+ P,
914
+ R,
915
+ lt,
916
+ We,
865
917
  "Log in to use Pluno on this page.",
866
918
  t.loginButtonLabel,
867
919
  t.loginUrl,
@@ -870,11 +922,11 @@ async function Xo(e = {}) {
870
922
  return;
871
923
  }
872
924
  if (t.signupRequired) {
873
- et.clear(), pn(
874
- L,
875
- D,
876
- nt,
877
- Oe,
925
+ at.clear(), bn(
926
+ P,
927
+ R,
928
+ lt,
929
+ We,
878
930
  "Complete signup to unlock your free trial credits.",
879
931
  t.signupButtonLabel,
880
932
  t.signupUrl,
@@ -882,65 +934,65 @@ async function Xo(e = {}) {
882
934
  );
883
935
  return;
884
936
  }
885
- const s = ci(r), E = s !== Ct;
886
- Ct = s;
887
- const z = ue || ge.enabled;
888
- ue = !1, $i(
889
- L,
890
- A,
891
- D,
892
- nt,
893
- ae,
894
- r,
937
+ const s = Ei(a), x = s !== It;
938
+ It = s;
939
+ const A = ue || ge.enabled;
940
+ ue = !1, ia(
941
+ P,
942
+ G,
943
+ R,
944
+ lt,
945
+ O,
946
+ a,
895
947
  Ce,
896
- Ce !== null && ct(r, tt()),
897
- z,
948
+ Ce !== null && bt(a, rt()),
949
+ A,
898
950
  () => ge.enabled,
899
- Ke,
900
- et,
951
+ Ze,
952
+ at,
901
953
  H,
902
- Oe,
954
+ We,
903
955
  (N) => {
904
- ue = !0, V(!0, "send"), K(), w.sendMessage(N);
956
+ ue = !0, Y(!0, "send"), X(), w.sendMessage(N);
905
957
  },
906
- Kn && !Ye ? {
907
- dismissedCandidateIds: Me,
908
- draftingCandidateId: Fe,
958
+ ao && !Je ? {
959
+ dismissedCandidateIds: ze,
960
+ draftingCandidateId: Ge,
909
961
  error: Ne,
910
- characterIconOptions: Oe(),
962
+ characterIconOptions: We(),
911
963
  onSeen: (N) => {
912
964
  xe.add(N.id), H();
913
965
  },
914
966
  onDraft: (N) => {
915
- Zn(N);
967
+ po(N);
916
968
  },
917
969
  onDismiss: (N) => {
918
- xe.add(N.id), Me.add(N.id), H(), Ne = null, O(w.getState());
970
+ xe.add(N.id), ze.add(N.id), H(), Ne = null, B(w.getState());
919
971
  },
920
972
  onDisable: (N) => {
921
- Ye = !0, xe.add(N.id), Me.add(N.id), H(), ga(t, !0), Ne = null, O(w.getState());
973
+ Je = !0, xe.add(N.id), ze.add(N.id), H(), La(t, !0), Ne = null, B(w.getState());
922
974
  }
923
975
  } : void 0
924
- ), z ? (he = L.scrollTop, K()) : E && ui(r) && Hn();
976
+ ), A ? (he = P.scrollTop, X()) : x && ki(a) && Yn();
925
977
  };
926
- return Mt = bo(
927
- (r) => {
928
- Ce = r, !ze && ct(w.getState(), tt()) && O(w.getState());
978
+ return Ft = Lo(
979
+ (a) => {
980
+ Ce = a, !Be && bt(w.getState(), rt()) && B(w.getState());
929
981
  },
930
982
  {
931
983
  backendUrl: t.backendUrl,
932
- fetcher: Fn,
984
+ fetcher: Kn,
933
985
  loader: t.activeUsersLoader
934
986
  }
935
- ), w.on("state", (r) => {
936
- const s = Rt && !r.isThinking;
937
- Rt = r.isThinking, r.appearance ? (Qe = !0, X(
987
+ ), w.on("state", (a) => {
988
+ const s = Ht && !a.isThinking;
989
+ Ht = a.isThinking, a.appearance ? (it = !0, J(
938
990
  "web-sdk.widget",
939
991
  "Agent state supplied appearance",
940
992
  {
941
- appearance: r.appearance
993
+ appearance: a.appearance
942
994
  }
943
- ), ot(r.appearance, "agent.state.appearance")) : Qe && (Qe = !1, X(
995
+ ), pt(a.appearance, "agent.state.appearance")) : it && (it = !1, J(
944
996
  "web-sdk.widget",
945
997
  "Agent state cleared appearance; reverting to configured widget options",
946
998
  {
@@ -948,32 +1000,32 @@ async function Xo(e = {}) {
948
1000
  fallbackColorScheme: t.colorScheme,
949
1001
  fallbackFontFamily: t.fontFamily
950
1002
  }
951
- ), ot({}, "agent.state.appearance-cleared")), O(r), $(), s && It();
952
- }), O(w.getState()), $(), {
1003
+ ), pt({}, "agent.state.appearance-cleared")), B(a), q(), s && Rt();
1004
+ }), B(w.getState()), q(), {
953
1005
  agent: w,
954
- updateAppearance: (r) => {
955
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), ot(r, "widgetHandle.updateAppearance");
1006
+ updateAppearance: (a) => {
1007
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), pt(a, "widgetHandle.updateAppearance");
956
1008
  },
957
- updateBillingStatus: (r) => {
958
- const s = r ?? null;
959
- on(
1009
+ updateBillingStatus: (a) => {
1010
+ const s = a ?? null;
1011
+ un(
960
1012
  t.billingStatus,
961
1013
  s,
962
1014
  ye
963
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !Q(t.billingStatus) && (ye = null), dt(
1015
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ye = null), mt(
964
1016
  i.querySelector(".pluno-pa-widget__billing-status"),
965
1017
  t.billingStatus,
966
1018
  ye
967
- ), $());
1019
+ ), q());
968
1020
  },
969
- updateAuthGate: (r) => {
970
- const s = Ue();
971
- t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), Nt(), O(w.getState()), $(), s && !Ue() && w.connect().catch((E) => {
972
- X(
1021
+ updateAuthGate: (a) => {
1022
+ const s = Fe();
1023
+ 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), ot(), B(w.getState()), q(), s && !Fe() && w.connect().catch((x) => {
1024
+ J(
973
1025
  "web-sdk.widget",
974
1026
  "Failed to connect after auth gate cleared",
975
1027
  {
976
- message: E instanceof Error ? E.message : String(E)
1028
+ message: x instanceof Error ? x.message : String(x)
977
1029
  }
978
1030
  );
979
1031
  });
@@ -981,27 +1033,27 @@ async function Xo(e = {}) {
981
1033
  openPanel: () => {
982
1034
  pe(b.value, !1);
983
1035
  },
984
- updateDisplayState: (r) => {
985
- if (r === "shown") {
986
- Pe("shown", !1);
1036
+ updateDisplayState: (a) => {
1037
+ if (a === "shown") {
1038
+ Ie("shown", !1);
987
1039
  return;
988
1040
  }
989
- Pe("minimized", !1);
1041
+ Ie("minimized", !1);
990
1042
  },
991
1043
  destroy: () => {
992
- ze || (ze = !0, Et.disconnect(), At?.disconnect(), window.removeEventListener("resize", Lt), Pt(), B !== null && window.clearTimeout(B), Mt(), ve?.remove(), w.destroy(), o.remove());
1044
+ Be || (Be = !0, Pt.disconnect(), zt?.disconnect(), no(), window.removeEventListener("resize", Nt), Dt(), L !== null && window.clearTimeout(L), Ft(), ve?.remove(), w.destroy(), o.remove());
993
1045
  }
994
1046
  };
995
- async function Zn(r) {
996
- if (!Fe) {
997
- Fe = r.id, Ne = null, O(w.getState());
1047
+ async function po(a) {
1048
+ if (!Ge) {
1049
+ Ge = a.id, Ne = null, B(w.getState());
998
1050
  try {
999
1051
  if (!t.socialPostDraftHandler)
1000
1052
  throw new Error("Social post drafting is not available here.");
1001
- const s = await t.socialPostDraftHandler(r);
1053
+ const s = await t.socialPostDraftHandler(a);
1002
1054
  if (!s.linkedinPost || !s.xPost)
1003
1055
  throw new Error("Pluno did not return a complete social post draft.");
1004
- xe.add(r.id), Me.add(r.id), H(), ve?.remove(), ve = Ji(s, {
1056
+ xe.add(a.id), ze.add(a.id), H(), ve?.remove(), ve = ua(s, {
1005
1057
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1006
1058
  onClose: () => {
1007
1059
  ve?.remove(), ve = null;
@@ -1010,39 +1062,39 @@ async function Xo(e = {}) {
1010
1062
  } catch (s) {
1011
1063
  Ne = s instanceof Error ? s.message : "Could not draft social post.";
1012
1064
  } finally {
1013
- Fe = null, O(w.getState());
1065
+ Ge = null, B(w.getState());
1014
1066
  }
1015
1067
  }
1016
1068
  }
1017
- function ot(r, s) {
1018
- const E = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, it = r.scribbleStyle ?? t.scribbleStyle;
1019
- a = Yt(
1020
- E,
1021
- it
1022
- ), Xt(i, a, {
1023
- accentColor: E,
1024
- colorScheme: z,
1069
+ function pt(a, s) {
1070
+ const x = a.accentColor ?? t.accentColor, A = a.colorScheme ?? t.colorScheme, N = a.fontFamily ?? t.fontFamily, st = a.scribbleStyle ?? t.scribbleStyle;
1071
+ r = on(
1072
+ x,
1073
+ st
1074
+ ), an(i, r, {
1075
+ accentColor: x,
1076
+ colorScheme: A,
1025
1077
  fontFamily: N,
1026
- scribbleStyle: it
1027
- }), X("web-sdk.widget", "Updated widget appearance", {
1078
+ scribbleStyle: st
1079
+ }), J("web-sdk.widget", "Updated widget appearance", {
1028
1080
  source: s,
1029
- inputAppearance: r,
1030
- appliedAccentColor: E,
1031
- appliedColorScheme: z,
1081
+ inputAppearance: a,
1082
+ appliedAccentColor: x,
1083
+ appliedColorScheme: A,
1032
1084
  appliedFontFamily: N,
1033
- appliedScribbleStyle: it,
1085
+ appliedScribbleStyle: st,
1034
1086
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1035
1087
  });
1036
1088
  }
1037
1089
  }
1038
- function Yt(e, t) {
1090
+ function on(e, t) {
1039
1091
  return { accentColor: e, scribbleStyle: t };
1040
1092
  }
1041
- function Zo(e) {
1042
- const t = Jo(e);
1043
- return t === null ? "#fafafa" : Qo(t) > 0.5 ? "#18181b" : "#fafaf9";
1093
+ function ci(e) {
1094
+ const t = ui(e);
1095
+ return t === null ? "#fafafa" : gi(t) > 0.5 ? "#18181b" : "#fafaf9";
1044
1096
  }
1045
- function Jo(e) {
1097
+ function ui(e) {
1046
1098
  const t = e.trim();
1047
1099
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1048
1100
  Number.parseInt(t.slice(1, 3), 16),
@@ -1054,14 +1106,14 @@ function Jo(e) {
1054
1106
  Number.parseInt(t[3] + t[3], 16)
1055
1107
  ] : null;
1056
1108
  }
1057
- function Qo([e, t, o]) {
1109
+ function gi([e, t, o]) {
1058
1110
  const n = (i) => {
1059
- const a = i / 255;
1060
- return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
1111
+ const r = i / 255;
1112
+ return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1061
1113
  };
1062
1114
  return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
1063
1115
  }
1064
- function Xt(e, t, o) {
1116
+ function an(e, t, o) {
1065
1117
  e.classList.toggle(
1066
1118
  "pluno-pa-widget--dark",
1067
1119
  o.colorScheme === "dark"
@@ -1069,27 +1121,27 @@ function Xt(e, t, o) {
1069
1121
  "pluno-pa-widget--light",
1070
1122
  o.colorScheme !== "dark"
1071
1123
  ), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
1072
- const n = o.scribbleStyle ? hn(o.accentColor) : o.accentColor;
1124
+ const n = o.scribbleStyle ? yn(o.accentColor) : o.accentColor;
1073
1125
  e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
1074
1126
  "--pluno-pa-accent-contrast",
1075
- Zo(n)
1076
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? To : o.fontFamily, o.scribbleStyle && ei(e.ownerDocument);
1127
+ ci(n)
1128
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? jo : o.fontFamily, o.scribbleStyle && hi(e.ownerDocument);
1077
1129
  const i = Array.from(
1078
1130
  e.querySelectorAll(".pluno-pa-widget__character")
1079
1131
  );
1080
- for (const a of i)
1081
- a.replaceWith(
1132
+ for (const r of i)
1133
+ r.replaceWith(
1082
1134
  se(
1083
- Array.from(a.classList).join(" "),
1135
+ Array.from(r.classList).join(" "),
1084
1136
  t
1085
1137
  )
1086
1138
  );
1087
1139
  }
1088
- function ei(e) {
1089
- if (e.getElementById(Wt))
1140
+ function hi(e) {
1141
+ if (e.getElementById(Xt))
1090
1142
  return;
1091
1143
  const t = e.createElement("style");
1092
- t.id = Wt, t.textContent = `@font-face {
1144
+ t.id = Xt, t.textContent = `@font-face {
1093
1145
  font-family: "Architects Daughter";
1094
1146
  font-style: normal;
1095
1147
  font-weight: 400;
@@ -1097,119 +1149,119 @@ function ei(e) {
1097
1149
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1098
1150
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1099
1151
  }
1100
- function ti({
1152
+ function mi({
1101
1153
  root: e,
1102
1154
  launcher: t,
1103
1155
  launcherDragHandle: o,
1104
1156
  getPosition: n,
1105
1157
  setPosition: i,
1106
- persist: a
1158
+ persist: r
1107
1159
  }) {
1108
1160
  let l = null, p = null, c = null, u = !1, d = null;
1109
1161
  const g = () => {
1110
1162
  l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
1111
- }, S = (h) => {
1163
+ }, E = (h) => {
1112
1164
  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 }, c = n(), u = !1, t.setPointerCapture?.(h.pointerId));
1113
1165
  }, f = (h) => {
1114
1166
  if (l !== h.pointerId || !p || !c)
1115
1167
  return;
1116
1168
  h.preventDefault();
1117
- const I = h.clientX - p.x, T = h.clientY - p.y;
1118
- !u && Math.hypot(I, T) < Vt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + I, y: c.y + T }));
1119
- }, F = (h) => {
1120
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (d = { x: h.clientX, y: h.clientY }, a()), g());
1169
+ const T = h.clientX - p.x, D = h.clientY - p.y;
1170
+ !u && Math.hypot(T, D) < tn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + T, y: c.y + D }));
1171
+ }, U = (h) => {
1172
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (d = { x: h.clientX, y: h.clientY }, r()), g());
1121
1173
  }, k = (h) => {
1122
1174
  l === h.pointerId && (h.preventDefault(), g());
1123
- }, x = (h) => {
1175
+ }, v = (h) => {
1124
1176
  if (!d)
1125
1177
  return;
1126
- const I = Math.hypot(
1178
+ const T = Math.hypot(
1127
1179
  h.clientX - d.x,
1128
1180
  h.clientY - d.y
1129
- ) <= Vt;
1130
- d = null, I && (h.preventDefault(), h.stopPropagation());
1131
- }, v = (h) => {
1181
+ ) <= tn;
1182
+ d = null, T && (h.preventDefault(), h.stopPropagation());
1183
+ }, y = (h) => {
1132
1184
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1133
1185
  return;
1134
- const I = h.shiftKey ? Vo : jo, T = n();
1135
- let P = null;
1136
- h.key === "ArrowUp" ? P = { x: T.x, y: T.y - I } : h.key === "ArrowDown" ? P = { x: T.x, y: T.y + I } : h.key === "ArrowLeft" ? P = { x: T.x - I, y: T.y } : h.key === "ArrowRight" && (P = { x: T.x + I, y: T.y }), P && (h.preventDefault(), h.stopPropagation(), i(P), a());
1186
+ const T = h.shiftKey ? li : ri, D = n();
1187
+ let I = null;
1188
+ h.key === "ArrowUp" ? I = { x: D.x, y: D.y - T } : h.key === "ArrowDown" ? I = { x: D.x, y: D.y + T } : h.key === "ArrowLeft" ? I = { x: D.x - T, y: D.y } : h.key === "ArrowRight" && (I = { x: D.x + T, y: D.y }), I && (h.preventDefault(), h.stopPropagation(), i(I), r());
1137
1189
  };
1138
- return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", f), t.addEventListener("pointerup", F), t.addEventListener("pointercancel", k), t.addEventListener("click", x, !0), o.addEventListener("keydown", v), () => {
1139
- t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", f), t.removeEventListener("pointerup", F), t.removeEventListener("pointercancel", k), t.removeEventListener("click", x, !0), o.removeEventListener("keydown", v);
1190
+ return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", f), t.addEventListener("pointerup", U), t.addEventListener("pointercancel", k), t.addEventListener("click", v, !0), o.addEventListener("keydown", y), () => {
1191
+ t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", f), t.removeEventListener("pointerup", U), t.removeEventListener("pointercancel", k), t.removeEventListener("click", v, !0), o.removeEventListener("keydown", y);
1140
1192
  };
1141
1193
  }
1142
- function je(e, t = !0) {
1143
- const o = ee();
1194
+ function Ye(e, t = !0) {
1195
+ const o = ne();
1144
1196
  if (e.classList.contains("pluno-pa-widget--minimized"))
1145
1197
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1146
- width: Do,
1147
- height: Ro
1148
- } : { width: Gt, height: Gt };
1198
+ width: Vo,
1199
+ height: Ko
1200
+ } : { width: Zt, height: Zt };
1149
1201
  const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1150
1202
  return {
1151
- width: t && i && n.width > 0 ? n.width : Math.min(_n, o.width - 36),
1152
- height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? zo : xn
1203
+ width: t && i && n.width > 0 ? n.width : Math.min(Ln, o.width - 36),
1204
+ height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? Xo : In
1153
1205
  };
1154
1206
  }
1155
- function Sn() {
1156
- const e = ee();
1207
+ function Nn() {
1208
+ const e = ne();
1157
1209
  return {
1158
1210
  width: Math.min(
1159
1211
  Ee(
1160
- e.width * Oo,
1161
- Bo,
1162
- Uo
1212
+ e.width * Qo,
1213
+ Zo,
1214
+ Jo
1163
1215
  ),
1164
- e.width - W * 2
1216
+ e.width - F * 2
1165
1217
  ),
1166
1218
  height: Math.min(
1167
1219
  Ee(
1168
- e.height * Wo,
1169
- Fo,
1170
- Ho
1220
+ e.height * ni,
1221
+ ei,
1222
+ ti
1171
1223
  ),
1172
- e.height - mt - W
1224
+ e.height - xt - F
1173
1225
  )
1174
1226
  };
1175
1227
  }
1176
- function ni(e, t, o) {
1228
+ function bi(e, t, o) {
1177
1229
  const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1178
1230
  if (Number.isFinite(n) && Number.isFinite(i))
1179
1231
  return { x: n, y: i };
1180
- const a = e.getBoundingClientRect();
1181
- if (a.width > 0 || a.height > 0)
1182
- return { x: a.left, y: a.top };
1183
- const l = ee();
1232
+ const r = e.getBoundingClientRect();
1233
+ if (r.width > 0 || r.height > 0)
1234
+ return { x: r.left, y: r.top };
1235
+ const l = ne();
1184
1236
  return {
1185
1237
  x: t === "bottom-left" ? 26 : l.width - 26 - o.width,
1186
1238
  y: l.height - 24 - o.height
1187
1239
  };
1188
1240
  }
1189
- function rt(e, t, o) {
1190
- const n = je(e, !1);
1191
- return t ? bt(
1241
+ function ct(e, t, o) {
1242
+ const n = Ye(e, !1);
1243
+ return t ? vt(
1192
1244
  e,
1193
- En(t, n),
1245
+ Dn(t, n),
1194
1246
  n
1195
- ) : oi(o === "bottom-left" ? "bottom-left" : "bottom-right", n, Mo);
1247
+ ) : fi(o === "bottom-left" ? "bottom-left" : "bottom-right", n, Yo);
1196
1248
  }
1197
- function oi(e, t, o) {
1198
- const n = ee();
1249
+ function fi(e, t, o) {
1250
+ const n = ne();
1199
1251
  return {
1200
1252
  x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
1201
1253
  y: e.startsWith("bottom") ? Math.max(0, n.height - t.height - o) : o
1202
1254
  };
1203
1255
  }
1204
- function bt(e, t, o) {
1205
- const n = ee(), i = W + ri(e);
1256
+ function vt(e, t, o) {
1257
+ const n = ne(), i = F + xi(e);
1206
1258
  return {
1207
1259
  x: Ee(
1208
1260
  t.x,
1209
- W,
1261
+ F,
1210
1262
  Math.max(
1211
- W,
1212
- n.width - o.width - W
1263
+ F,
1264
+ n.width - o.width - F
1213
1265
  )
1214
1266
  ),
1215
1267
  y: Ee(
@@ -1217,81 +1269,81 @@ function bt(e, t, o) {
1217
1269
  i,
1218
1270
  Math.max(
1219
1271
  i,
1220
- n.height - o.height - W
1272
+ n.height - o.height - F
1221
1273
  )
1222
1274
  )
1223
1275
  };
1224
1276
  }
1225
- function En(e, t) {
1226
- const o = ee();
1277
+ function Dn(e, t) {
1278
+ const o = ne();
1227
1279
  return {
1228
1280
  x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
1229
1281
  y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
1230
1282
  };
1231
1283
  }
1232
- function ii(e, t) {
1233
- const o = ai(e, t), n = ee();
1284
+ function wi(e, t) {
1285
+ const o = _i(e, t), n = ne();
1234
1286
  return {
1235
1287
  anchor: o,
1236
1288
  x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
1237
1289
  y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
1238
1290
  };
1239
1291
  }
1240
- function ai(e, t) {
1241
- const o = ee(), n = e.x + t.width / 2, a = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
1242
- return `${a}-${l}`;
1292
+ function _i(e, t) {
1293
+ 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";
1294
+ return `${r}-${l}`;
1243
1295
  }
1244
- function ri(e) {
1245
- return e.classList.contains("pluno-pa-widget--scribble") ? qo : $o;
1296
+ function xi(e) {
1297
+ return e.classList.contains("pluno-pa-widget--scribble") ? ai : ii;
1246
1298
  }
1247
- function Zt(e, t, o) {
1248
- const n = je(e), i = Sn(), a = {
1299
+ function rn(e, t, o) {
1300
+ const n = Ye(e), i = Nn(), r = {
1249
1301
  x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
1250
1302
  y: t.y + n.height - i.height
1251
1303
  };
1252
- return li(a);
1304
+ return vi(r);
1253
1305
  }
1254
- function li(e) {
1255
- const t = ee(), o = Sn();
1306
+ function vi(e) {
1307
+ const t = ne(), o = Nn();
1256
1308
  return {
1257
1309
  x: Ee(
1258
1310
  e.x,
1259
- W,
1311
+ F,
1260
1312
  Math.max(
1261
- W,
1262
- t.width - o.width - W
1313
+ F,
1314
+ t.width - o.width - F
1263
1315
  )
1264
1316
  ),
1265
1317
  y: Ee(
1266
1318
  e.y,
1267
- mt,
1319
+ xt,
1268
1320
  Math.max(
1269
- mt,
1270
- t.height - o.height - W
1321
+ xt,
1322
+ t.height - o.height - F
1271
1323
  )
1272
1324
  )
1273
1325
  };
1274
1326
  }
1275
- function fe(e, t) {
1327
+ function we(e, t) {
1276
1328
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1277
1329
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1278
1330
  return;
1279
1331
  }
1280
1332
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1281
1333
  }
1282
- function pi(e, t) {
1334
+ function yi(e, t) {
1283
1335
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1284
1336
  }
1285
- function Jt(e) {
1337
+ function ln(e) {
1286
1338
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1287
1339
  }
1288
- function ee() {
1340
+ function ne() {
1289
1341
  return {
1290
- width: window.innerWidth || document.documentElement.clientWidth || _n + W * 2,
1291
- height: window.innerHeight || document.documentElement.clientHeight || xn + W * 2
1342
+ width: window.innerWidth || document.documentElement.clientWidth || Ln + F * 2,
1343
+ height: window.innerHeight || document.documentElement.clientHeight || In + F * 2
1292
1344
  };
1293
1345
  }
1294
- function lt(e) {
1346
+ function ut(e) {
1295
1347
  const t = e.getBoundingClientRect();
1296
1348
  return {
1297
1349
  x: Math.round(t.x),
@@ -1303,7 +1355,7 @@ function lt(e) {
1303
1355
  function Ee(e, t, o) {
1304
1356
  return Math.min(Math.max(e, t), o);
1305
1357
  }
1306
- function X(e, t, o) {
1358
+ function J(e, t, o) {
1307
1359
  if (typeof window > "u")
1308
1360
  return;
1309
1361
  const n = window, i = {
@@ -1311,34 +1363,34 @@ function X(e, t, o) {
1311
1363
  source: e,
1312
1364
  message: t,
1313
1365
  details: o
1314
- }, a = n.__plunoProductAgentDiagnostics__ ?? [];
1315
- a.push(i), a.length > 120 && a.splice(0, a.length - 120), n.__plunoProductAgentDiagnostics__ = a, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
1316
- new CustomEvent(Io, { detail: i })
1366
+ }, r = n.__plunoProductAgentDiagnostics__ ?? [];
1367
+ r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1368
+ new CustomEvent(Ho, { detail: i })
1317
1369
  );
1318
1370
  }
1319
- function si(e, t) {
1320
- X("web-sdk.widget.position", e, t);
1371
+ function Ci(e, t) {
1372
+ J("web-sdk.widget.position", e, t);
1321
1373
  }
1322
- function pt(e, t, o) {
1374
+ function gt(e, t, o) {
1323
1375
  const n = t.value.trim();
1324
1376
  return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
1325
- attachments: o.length > 0 ? o.map(di) : void 0
1377
+ attachments: o.length > 0 ? o.map(Si) : void 0
1326
1378
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1327
1379
  }
1328
- function di(e) {
1380
+ function Si(e) {
1329
1381
  return e;
1330
1382
  }
1331
- function Te(e) {
1383
+ function De(e) {
1332
1384
  e.style.height = "0px";
1333
1385
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1334
1386
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1335
1387
  }
1336
- function De(e, t = () => !0) {
1388
+ function Re(e, t = () => !0) {
1337
1389
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1338
1390
  t() && (e.scrollTop = e.scrollHeight);
1339
1391
  });
1340
1392
  }
1341
- function ci(e) {
1393
+ function Ei(e) {
1342
1394
  const t = e.messages[e.messages.length - 1];
1343
1395
  return [
1344
1396
  e.messages.length,
@@ -1349,13 +1401,13 @@ function ci(e) {
1349
1401
  e.lastError ?? ""
1350
1402
  ].join(":");
1351
1403
  }
1352
- function ui(e) {
1404
+ function ki(e) {
1353
1405
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1354
1406
  }
1355
- function gi(e) {
1407
+ function Li(e) {
1356
1408
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1357
1409
  }
1358
- function hi(e) {
1410
+ function Ii(e) {
1359
1411
  const t = e.currentPage;
1360
1412
  if (typeof t?.url == "string" && t.url.trim())
1361
1413
  try {
@@ -1366,7 +1418,7 @@ function hi(e) {
1366
1418
  }
1367
1419
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1368
1420
  }
1369
- function mi(e, t) {
1421
+ function Ai(e, t) {
1370
1422
  const o = new Date(e).getTime();
1371
1423
  if (!Number.isFinite(o))
1372
1424
  return "now";
@@ -1375,38 +1427,38 @@ function mi(e, t) {
1375
1427
  ["hour", 36e5],
1376
1428
  ["min", 6e4]
1377
1429
  ];
1378
- for (const [a, l] of i)
1430
+ for (const [r, l] of i)
1379
1431
  if (n >= l) {
1380
1432
  const p = Math.max(1, Math.floor(n / l));
1381
- return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
1433
+ return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1382
1434
  }
1383
1435
  return "now";
1384
1436
  }
1385
- function bi(e, t, o, n, i) {
1386
- e.appendChild(Si()), e.appendChild(
1387
- fi(
1437
+ function Pi(e, t, o, n, i) {
1438
+ e.appendChild(Bi()), e.appendChild(
1439
+ Ti(
1388
1440
  t,
1389
1441
  o,
1390
1442
  n,
1391
1443
  i
1392
1444
  )
1393
1445
  ), e.appendChild(
1394
- Ve(
1446
+ Xe(
1395
1447
  "pluno-pa-widget__close",
1396
1448
  "Close",
1397
- Ei(16),
1449
+ Ui(16),
1398
1450
  !0
1399
1451
  )
1400
- ), e.appendChild(wi(o));
1452
+ ), e.appendChild(Ni(o));
1401
1453
  }
1402
- function fi(e, t, o, n) {
1454
+ function Ti(e, t, o, n) {
1403
1455
  const i = document.createElement("form");
1404
1456
  if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
1405
1457
  const l = document.createElement("button");
1406
1458
  l.type = "button", l.className = "pluno-pa-widget__launcher-drag-handle", l.setAttribute("aria-label", "Move Pluno launcher"), l.title = "Move Pluno launcher", i.appendChild(l);
1407
1459
  }
1408
1460
  i.appendChild(
1409
- In(
1461
+ zn(
1410
1462
  "pluno-pa-widget__scribble-spirals--launcher",
1411
1463
  10
1412
1464
  )
@@ -1416,39 +1468,39 @@ function fi(e, t, o, n) {
1416
1468
  t
1417
1469
  )
1418
1470
  );
1419
- const a = document.createElement("input");
1420
- if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a), n) {
1471
+ const r = document.createElement("input");
1472
+ if (r.className = "pluno-pa-widget__launcher-input", r.type = "text", r.placeholder = e, r.setAttribute("aria-label", e), i.appendChild(r), n) {
1421
1473
  const l = document.createElement("button");
1422
1474
  l.type = "button", l.className = "pluno-pa-widget__launcher-minimize", l.textContent = "-", l.setAttribute("aria-label", "Minimize Pluno on this site"), l.title = "Minimize Pluno on this site", i.appendChild(l);
1423
1475
  }
1424
1476
  return i;
1425
1477
  }
1426
- function wi(e) {
1478
+ function Ni(e) {
1427
1479
  const t = document.createElement("section");
1428
1480
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1429
- In("pluno-pa-widget__scribble-spirals--panel", 16)
1481
+ zn("pluno-pa-widget__scribble-spirals--panel", 16)
1430
1482
  );
1431
1483
  const o = document.createElement("div");
1432
1484
  o.className = "pluno-pa-widget__timeline-wrap";
1433
1485
  const n = document.createElement("main");
1434
- n.className = "pluno-pa-widget__timeline", n.appendChild(vi(e));
1486
+ n.className = "pluno-pa-widget__timeline", n.appendChild(Mi(e));
1435
1487
  const i = document.createElement("div");
1436
1488
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
1437
- const a = document.createElement("div");
1438
- a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, o.appendChild(a);
1489
+ const r = document.createElement("div");
1490
+ r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, o.appendChild(r);
1439
1491
  const l = document.createElement("button");
1440
1492
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
1441
1493
  const p = document.createElement("div");
1442
1494
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1443
- Ve(
1495
+ Xe(
1444
1496
  "pluno-pa-widget__history",
1445
1497
  "Recent chats",
1446
- Li(),
1498
+ Fi(),
1447
1499
  !0
1448
1500
  )
1449
- ), o.appendChild(p), o.appendChild(xi()), t.appendChild(o), t.appendChild(_i()), t;
1501
+ ), o.appendChild(p), o.appendChild(Ri()), t.appendChild(o), t.appendChild(Di()), t;
1450
1502
  }
1451
- function _i() {
1503
+ function Di() {
1452
1504
  const e = document.createElement("form");
1453
1505
  e.className = "pluno-pa-widget__composer";
1454
1506
  const t = document.createElement("div");
@@ -1459,14 +1511,14 @@ function _i() {
1459
1511
  n.className = "pluno-pa-widget__attachments", n.hidden = !0, e.appendChild(n);
1460
1512
  const i = document.createElement("div");
1461
1513
  i.className = "pluno-pa-widget__composer-inner";
1462
- const a = document.createElement("input");
1463
- a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
1514
+ const r = document.createElement("input");
1515
+ r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1464
1516
  const l = document.createElement("button");
1465
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ii()), l.appendChild(Ai()), i.appendChild(l);
1517
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Gi()), l.appendChild($i()), i.appendChild(l);
1466
1518
  const p = document.createElement("textarea");
1467
1519
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1468
1520
  const c = document.createElement("button");
1469
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(An()), i.appendChild(c), e.appendChild(i);
1521
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(Bn()), i.appendChild(c), e.appendChild(i);
1470
1522
  const u = document.createElement("div");
1471
1523
  u.className = "pluno-pa-widget__composer-meta";
1472
1524
  const d = document.createElement("a");
@@ -1474,39 +1526,39 @@ function _i() {
1474
1526
  const g = document.createElement("span");
1475
1527
  return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(g), e.appendChild(u), e;
1476
1528
  }
1477
- function xi() {
1529
+ function Ri() {
1478
1530
  const e = document.createElement("section");
1479
1531
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1480
1532
  const t = document.createElement("div");
1481
1533
  t.className = "pluno-pa-widget__history-header";
1482
1534
  const o = document.createElement("strong");
1483
1535
  o.textContent = "Recent chats";
1484
- const n = Ve(
1536
+ const n = Xe(
1485
1537
  "pluno-pa-widget__history-close",
1486
1538
  "Close recent chats",
1487
- Pi(),
1539
+ Wi(),
1488
1540
  !1
1489
1541
  );
1490
1542
  t.append(o, n);
1491
1543
  const i = document.createElement("div");
1492
1544
  i.className = "pluno-pa-widget__history-list";
1493
- const a = document.createElement("p");
1494
- return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
1545
+ const r = document.createElement("p");
1546
+ return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1495
1547
  }
1496
- function vi(e) {
1548
+ function Mi(e) {
1497
1549
  const t = document.createElement("div");
1498
1550
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1499
1551
  se(
1500
1552
  "pluno-pa-widget__character--empty",
1501
1553
  e
1502
1554
  )
1503
- ), t.appendChild(kn()), t;
1555
+ ), t.appendChild(Rn()), t;
1504
1556
  }
1505
- function kn() {
1557
+ function Rn() {
1506
1558
  const e = document.createElement("div");
1507
1559
  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;
1508
1560
  }
1509
- function Ln(e, t) {
1561
+ function Mn(e, t) {
1510
1562
  e.replaceChildren(), e.setAttribute(
1511
1563
  "aria-label",
1512
1564
  `${t.toLocaleString("en-US")} users currently active`
@@ -1519,16 +1571,16 @@ function Ln(e, t) {
1519
1571
  );
1520
1572
  }
1521
1573
  function se(e, t) {
1522
- const o = `pluno-pa-character-${Kt}`;
1523
- Kt += 1;
1524
- const n = t.scribbleStyle ? Ci(t.accentColor, o) : yi(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1574
+ const o = `pluno-pa-character-${nn}`;
1575
+ nn += 1;
1576
+ const n = t.scribbleStyle ? zi(t.accentColor, o) : Oi(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1525
1577
  return n.setAttribute(
1526
1578
  "class",
1527
1579
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1528
1580
  ), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
1529
1581
  }
1530
- function yi(e, t) {
1531
- const o = to(e), n = {
1582
+ function Oi(e, t) {
1583
+ const o = go(e), n = {
1532
1584
  boltFill: `${t}-boltFill`,
1533
1585
  boltEdge: `${t}-boltEdge`,
1534
1586
  boltGlow: `${t}-boltGlow`,
@@ -1539,7 +1591,7 @@ function yi(e, t) {
1539
1591
  eyeShadow: `${t}-eyeShadow`,
1540
1592
  pupilGloss: `${t}-pupilGloss`,
1541
1593
  boltClip: `${t}-boltClip`
1542
- }, i = Pn(), a = m(i, "defs"), l = m(a, "linearGradient", {
1594
+ }, i = On(), r = m(i, "defs"), l = m(r, "linearGradient", {
1543
1595
  id: n.boltFill,
1544
1596
  x1: "420",
1545
1597
  y1: "180",
@@ -1547,8 +1599,8 @@ function yi(e, t) {
1547
1599
  y2: "1040",
1548
1600
  gradientUnits: "userSpaceOnUse"
1549
1601
  });
1550
- R(l, "0", o.top), R(l, "0.36", o.middle), R(l, "0.72", o.bottom), R(l, "1", o.bottom);
1551
- const p = m(a, "linearGradient", {
1602
+ M(l, "0", o.top), M(l, "0.36", o.middle), M(l, "0.72", o.bottom), M(l, "1", o.bottom);
1603
+ const p = m(r, "linearGradient", {
1552
1604
  id: n.boltEdge,
1553
1605
  x1: "470",
1554
1606
  y1: "145",
@@ -1556,29 +1608,29 @@ function yi(e, t) {
1556
1608
  y2: "980",
1557
1609
  gradientUnits: "userSpaceOnUse"
1558
1610
  });
1559
- R(p, "0", o.edgeStart), R(p, "0.32", o.edgeMiddle), R(p, "0.78", o.edgeEnd), R(p, "1", o.edgeEnd);
1560
- const c = m(a, "radialGradient", {
1611
+ M(p, "0", o.edgeStart), M(p, "0.32", o.edgeMiddle), M(p, "0.78", o.edgeEnd), M(p, "1", o.edgeEnd);
1612
+ const c = m(r, "radialGradient", {
1561
1613
  id: n.boltGlow,
1562
1614
  cx: "50%",
1563
1615
  cy: "22%",
1564
1616
  r: "82%"
1565
1617
  });
1566
- R(c, "0", o.glow, "0.72"), R(c, "0.5", o.middle, "0.44"), R(c, "1", o.bottom, "0");
1567
- const u = m(a, "radialGradient", {
1618
+ M(c, "0", o.glow, "0.72"), M(c, "0.5", o.middle, "0.44"), M(c, "1", o.bottom, "0");
1619
+ const u = m(r, "radialGradient", {
1568
1620
  id: n.eyeWhite,
1569
1621
  cx: "35%",
1570
1622
  cy: "25%",
1571
1623
  r: "70%"
1572
1624
  });
1573
- R(u, "0", "#ffffff"), R(u, "0.72", "#ffffff"), R(u, "1", "#e5e5e5");
1574
- const d = m(a, "radialGradient", {
1625
+ M(u, "0", "#ffffff"), M(u, "0.72", "#ffffff"), M(u, "1", "#e5e5e5");
1626
+ const d = m(r, "radialGradient", {
1575
1627
  id: n.pupil,
1576
1628
  cx: "42%",
1577
1629
  cy: "38%",
1578
1630
  r: "65%"
1579
1631
  });
1580
- R(d, "0", "#2a1f10"), R(d, "0.52", "#080604"), R(d, "1", "#000000");
1581
- const g = m(a, "filter", {
1632
+ M(d, "0", "#2a1f10"), M(d, "0.52", "#080604"), M(d, "1", "#000000");
1633
+ const g = m(r, "filter", {
1582
1634
  id: n.softDropShadow,
1583
1635
  x: "-18%",
1584
1636
  y: "-12%",
@@ -1593,7 +1645,7 @@ function yi(e, t) {
1593
1645
  "flood-color": o.shadow,
1594
1646
  "flood-opacity": "0.24"
1595
1647
  });
1596
- const S = m(a, "filter", {
1648
+ const E = m(r, "filter", {
1597
1649
  id: n.innerDepth,
1598
1650
  x: "-8%",
1599
1651
  y: "-8%",
@@ -1601,32 +1653,32 @@ function yi(e, t) {
1601
1653
  height: "116%",
1602
1654
  "color-interpolation-filters": "sRGB"
1603
1655
  });
1604
- m(S, "feGaussianBlur", {
1656
+ m(E, "feGaussianBlur", {
1605
1657
  in: "SourceAlpha",
1606
1658
  stdDeviation: "8",
1607
1659
  result: "blur"
1608
- }), m(S, "feOffset", {
1660
+ }), m(E, "feOffset", {
1609
1661
  dx: "-7",
1610
1662
  dy: "-9",
1611
1663
  result: "topLeft"
1612
- }), m(S, "feComposite", {
1664
+ }), m(E, "feComposite", {
1613
1665
  in: "topLeft",
1614
1666
  in2: "SourceAlpha",
1615
1667
  operator: "arithmetic",
1616
1668
  k2: "-1",
1617
1669
  k3: "1",
1618
1670
  result: "innerShadow"
1619
- }), m(S, "feColorMatrix", {
1671
+ }), m(E, "feColorMatrix", {
1620
1672
  in: "innerShadow",
1621
1673
  type: "matrix",
1622
1674
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1623
1675
  result: "innerLight"
1624
- }), m(S, "feBlend", {
1676
+ }), m(E, "feBlend", {
1625
1677
  in: "SourceGraphic",
1626
1678
  in2: "innerLight",
1627
1679
  mode: "screen"
1628
1680
  });
1629
- const f = m(a, "filter", {
1681
+ const f = m(r, "filter", {
1630
1682
  id: n.eyeShadow,
1631
1683
  x: "-24%",
1632
1684
  y: "-20%",
@@ -1641,7 +1693,7 @@ function yi(e, t) {
1641
1693
  "flood-color": o.shadow,
1642
1694
  "flood-opacity": "0.3"
1643
1695
  });
1644
- const F = m(a, "filter", {
1696
+ const U = m(r, "filter", {
1645
1697
  id: n.pupilGloss,
1646
1698
  x: "-15%",
1647
1699
  y: "-15%",
@@ -1649,34 +1701,34 @@ function yi(e, t) {
1649
1701
  height: "130%",
1650
1702
  "color-interpolation-filters": "sRGB"
1651
1703
  });
1652
- m(F, "feDropShadow", {
1704
+ m(U, "feDropShadow", {
1653
1705
  dx: "0",
1654
1706
  dy: "3",
1655
1707
  stdDeviation: "3",
1656
1708
  "flood-color": "#000000",
1657
1709
  "flood-opacity": "0.22"
1658
1710
  });
1659
- const k = m(a, "clipPath", { id: n.boltClip });
1660
- m(k, "path", { d: $e });
1661
- const x = m(i, "g", {
1662
- filter: q(n.softDropShadow)
1711
+ const k = m(r, "clipPath", { id: n.boltClip });
1712
+ m(k, "path", { d: Ve });
1713
+ const v = m(i, "g", {
1714
+ filter: j(n.softDropShadow)
1663
1715
  });
1664
- m(x, "path", {
1665
- d: $e,
1666
- fill: q(n.boltEdge)
1716
+ m(v, "path", {
1717
+ d: Ve,
1718
+ fill: j(n.boltEdge)
1667
1719
  });
1668
- const v = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1669
- m(x, "path", {
1670
- d: v,
1671
- fill: q(n.boltFill),
1672
- filter: q(n.innerDepth)
1673
- }), m(x, "path", {
1674
- d: v,
1675
- fill: q(n.boltGlow),
1720
+ const y = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1721
+ m(v, "path", {
1722
+ d: y,
1723
+ fill: j(n.boltFill),
1724
+ filter: j(n.innerDepth)
1725
+ }), m(v, "path", {
1726
+ d: y,
1727
+ fill: j(n.boltGlow),
1676
1728
  opacity: "0.74"
1677
1729
  });
1678
- const h = m(x, "g", {
1679
- "clip-path": q(n.boltClip),
1730
+ const h = m(v, "g", {
1731
+ "clip-path": j(n.boltClip),
1680
1732
  opacity: "0.42"
1681
1733
  });
1682
1734
  m(h, "path", {
@@ -1701,9 +1753,9 @@ function yi(e, t) {
1701
1753
  "stroke-linecap": "round",
1702
1754
  opacity: "0.48"
1703
1755
  });
1704
- const I = m(i, "g", { filter: q(n.eyeShadow) });
1705
- return Qt(
1706
- I,
1756
+ const T = m(i, "g", { filter: j(n.eyeShadow) });
1757
+ return pn(
1758
+ T,
1707
1759
  "rotate(-2 528 463)",
1708
1760
  "528",
1709
1761
  "463",
@@ -1712,8 +1764,8 @@ function yi(e, t) {
1712
1764
  "557",
1713
1765
  "447",
1714
1766
  n
1715
- ), Qt(
1716
- I,
1767
+ ), pn(
1768
+ T,
1717
1769
  "rotate(2 717 462)",
1718
1770
  "717",
1719
1771
  "462",
@@ -1724,13 +1776,13 @@ function yi(e, t) {
1724
1776
  n
1725
1777
  ), i;
1726
1778
  }
1727
- function Ci(e, t) {
1728
- const o = hn(e), n = {
1779
+ function zi(e, t) {
1780
+ const o = yn(e), n = {
1729
1781
  clip: `${t}-scribbleBoltClip`,
1730
1782
  wobble: `${t}-scribbleBoltWobble`
1731
- }, i = Pn(), a = m(i, "defs"), l = m(a, "clipPath", { id: n.clip });
1732
- m(l, "path", { d: $e });
1733
- const p = m(a, "filter", {
1783
+ }, i = On(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
1784
+ m(l, "path", { d: Ve });
1785
+ const p = m(r, "filter", {
1734
1786
  id: n.wobble,
1735
1787
  x: "-10%",
1736
1788
  y: "-10%",
@@ -1751,11 +1803,11 @@ function Ci(e, t) {
1751
1803
  xChannelSelector: "R",
1752
1804
  yChannelSelector: "G"
1753
1805
  });
1754
- const c = m(i, "g", { filter: q(n.wobble) }), u = m(c, "g", {
1755
- "clip-path": q(n.clip)
1806
+ const c = m(i, "g", { filter: j(n.wobble) }), u = m(c, "g", {
1807
+ "clip-path": j(n.clip)
1756
1808
  });
1757
1809
  return m(u, "path", {
1758
- d: eo(),
1810
+ d: uo(),
1759
1811
  fill: "none",
1760
1812
  stroke: o,
1761
1813
  "stroke-width": "56",
@@ -1764,12 +1816,12 @@ function Ci(e, t) {
1764
1816
  opacity: "0.9",
1765
1817
  transform: "rotate(-14 627 600)"
1766
1818
  }), m(c, "path", {
1767
- d: $e,
1819
+ d: Ve,
1768
1820
  fill: "none",
1769
- stroke: qe,
1821
+ stroke: Ke,
1770
1822
  "stroke-width": "18",
1771
1823
  "stroke-linejoin": "round"
1772
- }), en(
1824
+ }), sn(
1773
1825
  c,
1774
1826
  "rotate(-2 528 463)",
1775
1827
  "528",
@@ -1778,7 +1830,7 @@ function Ci(e, t) {
1778
1830
  "473",
1779
1831
  "557",
1780
1832
  "447"
1781
- ), en(
1833
+ ), sn(
1782
1834
  c,
1783
1835
  "rotate(2 717 462)",
1784
1836
  "717",
@@ -1789,27 +1841,27 @@ function Ci(e, t) {
1789
1841
  "447"
1790
1842
  ), i;
1791
1843
  }
1792
- function Pn() {
1844
+ function On() {
1793
1845
  return C("svg", {
1794
- xmlns: vn,
1846
+ xmlns: An,
1795
1847
  viewBox: "0 0 1254 1254"
1796
1848
  });
1797
1849
  }
1798
- function Qt(e, t, o, n, i, a, l, p, c) {
1850
+ function pn(e, t, o, n, i, r, l, p, c) {
1799
1851
  const u = m(e, "g", { transform: t });
1800
1852
  m(u, "ellipse", {
1801
1853
  cx: o,
1802
1854
  cy: n,
1803
1855
  rx: "73",
1804
1856
  ry: "80",
1805
- fill: q(c.eyeWhite)
1857
+ fill: j(c.eyeWhite)
1806
1858
  }), m(u, "ellipse", {
1807
1859
  cx: i,
1808
- cy: a,
1860
+ cy: r,
1809
1861
  rx: "49",
1810
1862
  ry: "57",
1811
- fill: q(c.pupil),
1812
- filter: q(c.pupilGloss)
1863
+ fill: j(c.pupil),
1864
+ filter: j(c.pupilGloss)
1813
1865
  }), m(u, "circle", {
1814
1866
  cx: l,
1815
1867
  cy: p,
@@ -1817,7 +1869,7 @@ function Qt(e, t, o, n, i, a, l, p, c) {
1817
1869
  fill: "#ffffff"
1818
1870
  });
1819
1871
  }
1820
- function en(e, t, o, n, i, a, l, p) {
1872
+ function sn(e, t, o, n, i, r, l, p) {
1821
1873
  const c = m(e, "g", { transform: t });
1822
1874
  m(c, "ellipse", {
1823
1875
  cx: o,
@@ -1825,14 +1877,14 @@ function en(e, t, o, n, i, a, l, p) {
1825
1877
  rx: "73",
1826
1878
  ry: "80",
1827
1879
  fill: "#ffffff",
1828
- stroke: qe,
1880
+ stroke: Ke,
1829
1881
  "stroke-width": "13"
1830
1882
  }), m(c, "ellipse", {
1831
1883
  cx: i,
1832
- cy: a,
1884
+ cy: r,
1833
1885
  rx: "45",
1834
1886
  ry: "53",
1835
- fill: qe
1887
+ fill: Ke
1836
1888
  }), m(c, "circle", {
1837
1889
  cx: l,
1838
1890
  cy: p,
@@ -1844,18 +1896,18 @@ function m(e, t, o = {}) {
1844
1896
  const n = C(t, o);
1845
1897
  return e.appendChild(n), n;
1846
1898
  }
1847
- function R(e, t, o, n) {
1899
+ function M(e, t, o, n) {
1848
1900
  const i = { offset: t, "stop-color": o };
1849
1901
  n !== void 0 && (i["stop-opacity"] = n), m(e, "stop", i);
1850
1902
  }
1851
- function q(e) {
1903
+ function j(e) {
1852
1904
  return `url(#${e})`;
1853
1905
  }
1854
- function Ve(e, t, o, n) {
1906
+ function Xe(e, t, o, n) {
1855
1907
  const i = document.createElement("button");
1856
1908
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
1857
1909
  }
1858
- function Si() {
1910
+ function Bi() {
1859
1911
  const e = C("svg", {
1860
1912
  class: "pluno-pa-widget__scribble-defs",
1861
1913
  "aria-hidden": "true",
@@ -1863,48 +1915,48 @@ function Si() {
1863
1915
  width: "0",
1864
1916
  height: "0"
1865
1917
  }), t = C("defs");
1866
- return t.appendChild(st("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
1867
- st("pluno-pa-scribble-wobble-2", "5", "15")
1918
+ return t.appendChild(ht("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
1919
+ ht("pluno-pa-scribble-wobble-2", "5", "15")
1868
1920
  ), t.appendChild(
1869
- st("pluno-pa-scribble-wobble-3", "9", "19")
1921
+ ht("pluno-pa-scribble-wobble-3", "9", "19")
1870
1922
  ), e.appendChild(t), e;
1871
1923
  }
1872
- function In(e, t) {
1873
- const o = t * $t + qt * 2, n = C("svg", {
1924
+ function zn(e, t) {
1925
+ const o = t * Jt + Qt * 2, n = C("svg", {
1874
1926
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1875
- viewBox: `0 0 ${o} ${Go}`,
1927
+ viewBox: `0 0 ${o} ${oi}`,
1876
1928
  preserveAspectRatio: "xMidYMid meet",
1877
1929
  "aria-hidden": "true",
1878
1930
  focusable: "false"
1879
1931
  });
1880
1932
  for (let i = 0; i < t; i += 1) {
1881
- const a = jt[i % jt.length], l = C("g", {
1882
- transform: `translate(${qt + i * $t} 0)`
1933
+ const r = en[i % en.length], l = C("g", {
1934
+ transform: `translate(${Qt + i * Jt} 0)`
1883
1935
  });
1884
1936
  l.appendChild(
1885
1937
  C("ellipse", {
1886
- cx: a.ellipseCx,
1887
- cy: a.ellipseCy,
1888
- rx: a.ellipseRx,
1889
- ry: a.ellipseRy,
1938
+ cx: r.ellipseCx,
1939
+ cy: r.ellipseCy,
1940
+ rx: r.ellipseRx,
1941
+ ry: r.ellipseRy,
1890
1942
  fill: "none",
1891
1943
  stroke: "#2c2a1e",
1892
- "stroke-width": a.strokeWidth,
1944
+ "stroke-width": r.strokeWidth,
1893
1945
  opacity: "0.8"
1894
1946
  })
1895
1947
  ), l.appendChild(
1896
1948
  C("path", {
1897
- d: a.path,
1949
+ d: r.path,
1898
1950
  fill: "none",
1899
1951
  stroke: "#2c2a1e",
1900
- "stroke-width": a.pathStrokeWidth,
1952
+ "stroke-width": r.pathStrokeWidth,
1901
1953
  "stroke-linecap": "round"
1902
1954
  })
1903
1955
  ), n.appendChild(l);
1904
1956
  }
1905
1957
  return n;
1906
1958
  }
1907
- function st(e, t, o) {
1959
+ function ht(e, t, o) {
1908
1960
  const n = C("filter", {
1909
1961
  id: e,
1910
1962
  x: "-8%",
@@ -1947,8 +1999,8 @@ function st(e, t, o) {
1947
1999
  })
1948
2000
  ), n;
1949
2001
  }
1950
- function Ei(e) {
1951
- const t = te(
2002
+ function Ui(e) {
2003
+ const t = oe(
1952
2004
  "0 0 24 24",
1953
2005
  e,
1954
2006
  e,
@@ -1958,8 +2010,8 @@ function Ei(e) {
1958
2010
  );
1959
2011
  return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
1960
2012
  }
1961
- function ki() {
1962
- const e = te(
2013
+ function Hi() {
2014
+ const e = oe(
1963
2015
  "0 0 24 24",
1964
2016
  17,
1965
2017
  17,
@@ -1977,8 +2029,8 @@ function ki() {
1977
2029
  })
1978
2030
  ), e;
1979
2031
  }
1980
- function Li() {
1981
- const e = te(
2032
+ function Fi() {
2033
+ const e = oe(
1982
2034
  "0 0 24 24",
1983
2035
  17,
1984
2036
  17,
@@ -1988,8 +2040,8 @@ function Li() {
1988
2040
  );
1989
2041
  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;
1990
2042
  }
1991
- function Pi() {
1992
- const e = te(
2043
+ function Wi() {
2044
+ const e = oe(
1993
2045
  "0 0 24 24",
1994
2046
  15,
1995
2047
  15,
@@ -1999,8 +2051,8 @@ function Pi() {
1999
2051
  );
2000
2052
  return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2001
2053
  }
2002
- function An() {
2003
- const e = te(
2054
+ function Bn() {
2055
+ const e = oe(
2004
2056
  "0 0 24 24",
2005
2057
  14,
2006
2058
  14,
@@ -2012,8 +2064,8 @@ function An() {
2012
2064
  C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2013
2065
  ), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
2014
2066
  }
2015
- function Ii() {
2016
- const e = te(
2067
+ function Gi() {
2068
+ const e = oe(
2017
2069
  "0 0 24 24",
2018
2070
  16,
2019
2071
  16,
@@ -2030,8 +2082,8 @@ function Ii() {
2030
2082
  })
2031
2083
  ), e;
2032
2084
  }
2033
- function Ai() {
2034
- const e = te("0 0 24 24", 19, 19, "none", "currentColor");
2085
+ function $i() {
2086
+ const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
2035
2087
  return e.setAttribute(
2036
2088
  "class",
2037
2089
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
@@ -2045,8 +2097,8 @@ function Ai() {
2045
2097
  })
2046
2098
  ), e;
2047
2099
  }
2048
- function Ni() {
2049
- const e = te("0 0 24 24", 18, 18, "currentColor");
2100
+ function qi() {
2101
+ const e = oe("0 0 24 24", 18, 18, "currentColor");
2050
2102
  return e.appendChild(
2051
2103
  C("rect", {
2052
2104
  x: "6",
@@ -2057,8 +2109,8 @@ function Ni() {
2057
2109
  })
2058
2110
  ), e;
2059
2111
  }
2060
- function Ti() {
2061
- const e = te(
2112
+ function ji() {
2113
+ const e = oe(
2062
2114
  "0 0 24 24",
2063
2115
  12,
2064
2116
  12,
@@ -2068,8 +2120,8 @@ function Ti() {
2068
2120
  );
2069
2121
  return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2070
2122
  }
2071
- function Di() {
2072
- const e = te(
2123
+ function Vi() {
2124
+ const e = oe(
2073
2125
  "0 0 24 24",
2074
2126
  13,
2075
2127
  13,
@@ -2092,7 +2144,7 @@ function Di() {
2092
2144
  })
2093
2145
  ), e;
2094
2146
  }
2095
- function te(e, t, o, n, i, a) {
2147
+ function oe(e, t, o, n, i, r) {
2096
2148
  const l = {
2097
2149
  viewBox: e,
2098
2150
  width: String(t),
@@ -2100,165 +2152,165 @@ function te(e, t, o, n, i, a) {
2100
2152
  fill: n,
2101
2153
  "aria-hidden": "true"
2102
2154
  };
2103
- return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), C("svg", l);
2155
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), C("svg", l);
2104
2156
  }
2105
2157
  function C(e, t = {}) {
2106
- const o = document.createElementNS(vn, e);
2158
+ const o = document.createElementNS(An, e);
2107
2159
  for (const [n, i] of Object.entries(t))
2108
2160
  o.setAttribute(n, i);
2109
2161
  return o;
2110
2162
  }
2111
- function tn(e) {
2163
+ function dn(e) {
2112
2164
  for (const t of ["keydown", "keypress", "keyup"])
2113
2165
  e.addEventListener(t, (o) => {
2114
2166
  o.stopPropagation();
2115
2167
  });
2116
2168
  }
2117
- function Ri(e, t, o) {
2169
+ function Ki(e, t, o) {
2118
2170
  e.replaceChildren(), e.hidden = t.length === 0;
2119
2171
  for (const [n, i] of t.entries()) {
2120
- const a = document.createElement("div");
2121
- a.className = "pluno-pa-widget__attachment", a.appendChild(Mi(i));
2172
+ const r = document.createElement("div");
2173
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Yi(i));
2122
2174
  const l = document.createElement("span");
2123
- l.textContent = i.name, a.appendChild(l);
2175
+ l.textContent = i.name, r.appendChild(l);
2124
2176
  const p = document.createElement("button");
2125
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ti()), p.addEventListener("click", () => o(n)), a.appendChild(p), e.appendChild(a);
2177
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(ji()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
2126
2178
  }
2127
2179
  }
2128
- function Mi(e) {
2129
- const t = vt(e), o = Nn(e);
2180
+ function Yi(e) {
2181
+ const t = kt(e), o = Un(e);
2130
2182
  if (t === "image" && o) {
2131
2183
  const n = document.createElement("img");
2132
- return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(J(e))), n;
2184
+ return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
2133
2185
  }
2134
2186
  if (t === "video" && o) {
2135
2187
  const n = document.createElement("video");
2136
- return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(J(e))), n.addEventListener("stalled", () => n.replaceWith(J(e))), n;
2188
+ return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n.addEventListener("stalled", () => n.replaceWith(ee(e))), n;
2137
2189
  }
2138
- return J(e);
2190
+ return ee(e);
2139
2191
  }
2140
- function zi(e) {
2141
- const t = vt(e), o = Nn(e);
2192
+ function Xi(e) {
2193
+ const t = kt(e), o = Un(e);
2142
2194
  if (t === "image" && o) {
2143
2195
  const n = document.createElement("img");
2144
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n;
2196
+ 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;
2145
2197
  }
2146
2198
  if (t === "pdf" && o) {
2147
2199
  const n = document.createElement("object");
2148
- return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n.appendChild(J(e, "message")), n;
2200
+ return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.appendChild(ee(e, "message")), n;
2149
2201
  }
2150
2202
  if (t === "video" && o) {
2151
2203
  const n = document.createElement("video");
2152
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(J(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(J(e, "message"))), n;
2204
+ return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(ee(e, "message"))), n;
2153
2205
  }
2154
- return J(e, "message");
2206
+ return ee(e, "message");
2155
2207
  }
2156
- function J(e, t = "composer") {
2208
+ function ee(e, t = "composer") {
2157
2209
  if (t === "composer") {
2158
- const a = document.createElement("span");
2159
- return a.className = "pluno-pa-widget__attachment-file", a.textContent = nn(e), a;
2210
+ const r = document.createElement("span");
2211
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = cn(e), r;
2160
2212
  }
2161
2213
  const o = document.createElement("div");
2162
2214
  o.className = "pluno-pa-widget__message-attachment-file";
2163
2215
  const n = document.createElement("span");
2164
- n.textContent = nn(e);
2216
+ n.textContent = cn(e);
2165
2217
  const i = document.createElement("strong");
2166
2218
  return i.textContent = e.name, o.append(n, i), o;
2167
2219
  }
2168
- function vt(e) {
2220
+ function kt(e) {
2169
2221
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2170
2222
  }
2171
- function Nn(e) {
2223
+ function Un(e) {
2172
2224
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2173
2225
  }
2174
- function nn(e) {
2175
- const t = vt(e);
2226
+ function cn(e) {
2227
+ const t = kt(e);
2176
2228
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2177
2229
  }
2178
- function Bi(e, t) {
2230
+ function Zi(e, t) {
2179
2231
  return t ? Array.from(t).map((n) => ({
2180
2232
  ...e.createLocalAttachment(n),
2181
- previewUrl: Ui(n)
2233
+ previewUrl: Ji(n)
2182
2234
  })) : [];
2183
2235
  }
2184
- function Ui(e) {
2236
+ function Ji(e) {
2185
2237
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2186
2238
  }
2187
- function He(e) {
2239
+ function $e(e) {
2188
2240
  return !!(e && Array.from(e.types).includes("Files"));
2189
2241
  }
2190
- function dt(e, t, o = null) {
2191
- if (!e || !ft(t, o)) {
2242
+ function mt(e, t, o = null) {
2243
+ if (!e || !yt(t, o)) {
2192
2244
  e && (e.hidden = !0, e.replaceChildren());
2193
2245
  return;
2194
2246
  }
2195
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", Q(t) || yt(o) ? e.appendChild(
2196
- Oi(t, o)
2197
- ) : Tn(t) && e.appendChild(Fi(t));
2247
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Lt(o) ? e.appendChild(
2248
+ Qi(t, o)
2249
+ ) : Hn(t) && e.appendChild(ea(t));
2198
2250
  }
2199
- function Oi(e, t) {
2251
+ function Qi(e, t) {
2200
2252
  const o = document.createElement("div");
2201
2253
  o.className = "pluno-pa-widget__billing-action-card";
2202
2254
  const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2203
2255
  i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
2204
- const a = document.createElement("span");
2205
- return a.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(a), o.appendChild(
2206
- Dn(
2256
+ const r = document.createElement("span");
2257
+ 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(
2258
+ Fn(
2207
2259
  e,
2208
2260
  "Upgrade plan",
2209
2261
  "pluno-pa-widget__billing-action-card-actions"
2210
2262
  )
2211
2263
  ), o;
2212
2264
  }
2213
- function Fi(e) {
2265
+ function ea(e) {
2214
2266
  const t = document.createElement("div");
2215
2267
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2216
2268
  const o = document.createElement("strong");
2217
2269
  o.textContent = "Credits running low", t.appendChild(o);
2218
2270
  const n = document.createElement("span");
2219
- return n.textContent = Wi(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2220
- Dn(
2271
+ return n.textContent = na(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2272
+ Fn(
2221
2273
  e,
2222
2274
  "Upgrade",
2223
2275
  "pluno-pa-widget__billing-action-card-actions"
2224
2276
  )
2225
2277
  ), t;
2226
2278
  }
2227
- function ft(e, t) {
2228
- return e !== null && (Q(e) || Tn(e) || yt(t));
2279
+ function yt(e, t) {
2280
+ return e !== null && (te(e) || Hn(e) || Lt(t));
2229
2281
  }
2230
- function on(e, t, o) {
2231
- return ft(t, o) || Hi(t) ? !0 : !ft(e, o);
2282
+ function un(e, t, o) {
2283
+ return yt(t, o) || ta(t) ? !0 : !yt(e, o);
2232
2284
  }
2233
- function Hi(e) {
2234
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || Q(e));
2285
+ function ta(e) {
2286
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
2235
2287
  }
2236
- function Q(e) {
2288
+ function te(e) {
2237
2289
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2238
2290
  }
2239
- function yt(e) {
2291
+ function Lt(e) {
2240
2292
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2241
2293
  }
2242
- function Tn(e) {
2243
- return !Q(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2294
+ function Hn(e) {
2295
+ return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2244
2296
  }
2245
- function Wi(e) {
2246
- return e.creditsRemaining === null ? null : `${Gi(e.creditsRemaining)} credits left`;
2297
+ function na(e) {
2298
+ return e.creditsRemaining === null ? null : `${oa(e.creditsRemaining)} credits left`;
2247
2299
  }
2248
- function Gi(e) {
2300
+ function oa(e) {
2249
2301
  return new Intl.NumberFormat("en-US", {
2250
2302
  maximumFractionDigits: 0
2251
2303
  }).format(Math.ceil(e));
2252
2304
  }
2253
- function Dn(e, t, o) {
2305
+ function Fn(e, t, o) {
2254
2306
  const n = document.createElement("div");
2255
2307
  return n.className = o, n.appendChild(
2256
- an(t, e.pricingUrl)
2308
+ gn(t, e.pricingUrl)
2257
2309
  ), n.appendChild(
2258
- an("Earn credits", e.earnCreditsUrl)
2310
+ gn("Earn credits", e.earnCreditsUrl)
2259
2311
  ), n;
2260
2312
  }
2261
- function an(e, t) {
2313
+ function gn(e, t) {
2262
2314
  const o = document.createElement("button");
2263
2315
  if (o.type = "button", e === "Earn credits") {
2264
2316
  const n = document.createElement("span");
@@ -2269,123 +2321,123 @@ function an(e, t) {
2269
2321
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2270
2322
  }), o;
2271
2323
  }
2272
- function ct(e, t) {
2324
+ function bt(e, t) {
2273
2325
  return e.messages.filter(
2274
- (n) => !Rn(n)
2326
+ (n) => !Wn(n)
2275
2327
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2276
2328
  }
2277
- function $i(e, t, o, n, i, a, l, p, c, u, d, g, S, f, F, k) {
2278
- const x = Ki(a), v = x.filter(
2279
- (_) => !Rn(_)
2280
- ), h = e.scrollTop, I = [], T = /* @__PURE__ */ new Set(), P = (_) => {
2281
- I.push(_);
2329
+ function ia(e, t, o, n, i, r, l, p, c, u, d, g, E, f, U, k) {
2330
+ const v = pa(r), y = v.filter(
2331
+ (_) => !Wn(_)
2332
+ ), h = e.scrollTop, T = [], D = /* @__PURE__ */ new Set(), I = (_) => {
2333
+ T.push(_);
2282
2334
  };
2283
- zn(o, a.isThinking), i.hidden = !p, p && l !== null && Ln(i, l);
2284
- const ke = v.length > 0 || !!a.assistantDraft || a.isThinking;
2285
- if (n(ke), v.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
2335
+ $n(o, r.isThinking), i.hidden = !p, p && l !== null && Mn(i, l);
2336
+ const ke = y.length > 0 || !!r.assistantDraft || r.isThinking;
2337
+ if (n(ke), y.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2286
2338
  const _ = document.createElement("div");
2287
2339
  _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2288
- const M = document.createElement("div");
2289
- M.className = "pluno-pa-widget__empty-hero";
2290
- const ae = se(
2340
+ const O = document.createElement("div");
2341
+ O.className = "pluno-pa-widget__empty-hero";
2342
+ const P = se(
2291
2343
  "pluno-pa-widget__character--empty",
2292
2344
  f()
2293
2345
  );
2294
- M.appendChild(ae), _.appendChild(M), _.appendChild(kn());
2295
- const L = document.createElement("div");
2296
- if (L.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && L.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
2297
- for (const A of a.starterPrompts) {
2298
- const y = document.createElement("button");
2299
- y.type = "button", y.className = "pluno-pa-widget__starter-prompt", y.textContent = `"${A}"`, y.addEventListener("click", () => {
2300
- F(A);
2301
- }), L.appendChild(y);
2346
+ O.appendChild(P), _.appendChild(O), _.appendChild(Rn());
2347
+ const G = document.createElement("div");
2348
+ if (G.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 && G.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2349
+ for (const S of r.starterPrompts) {
2350
+ const L = document.createElement("button");
2351
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt", L.textContent = `"${S}"`, L.addEventListener("click", () => {
2352
+ U(S);
2353
+ }), G.appendChild(L);
2302
2354
  }
2303
- else if (a.starterPromptsLoading) {
2304
- const A = document.createElement("button");
2305
- 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...", L.appendChild(A);
2355
+ else if (r.starterPromptsLoading) {
2356
+ const S = document.createElement("button");
2357
+ S.type = "button", S.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", S.disabled = !0, S.tabIndex = -1, S.textContent = "Generating example tasks...", G.appendChild(S);
2306
2358
  } else
2307
- for (let A = 0; A < Ao; A += 1) {
2308
- const y = document.createElement("button");
2309
- y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", y.disabled = !0, y.tabIndex = -1, y.textContent = "", L.appendChild(y);
2359
+ for (let S = 0; S < Fo; S += 1) {
2360
+ const L = document.createElement("button");
2361
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", L.disabled = !0, L.tabIndex = -1, L.textContent = "", G.appendChild(L);
2310
2362
  }
2311
- _.appendChild(L), g.clear(), P(_), P(t), rn(e, I);
2363
+ _.appendChild(G), g.clear(), I(_), I(t), hn(e, T);
2312
2364
  return;
2313
2365
  }
2314
- let b = null, D = null, de = [];
2315
- const ce = v.some(wt), we = () => {
2366
+ let b = null, R = null, de = [];
2367
+ const ce = y.some(Ct), _e = () => {
2316
2368
  if (de.length === 0)
2317
2369
  return !1;
2318
- const _ = ia(
2370
+ const _ = wa(
2319
2371
  de,
2320
2372
  d,
2321
- S,
2373
+ E,
2322
2374
  f()
2323
2375
  );
2324
- return P(_), b = null, D = _, de = [], !0;
2376
+ return I(_), b = null, R = _, de = [], !0;
2325
2377
  };
2326
- for (let _ = 0; _ < v.length; _ += 1) {
2327
- const M = v[_];
2328
- if (M.role === "tool") {
2329
- de.push(M);
2378
+ for (let _ = 0; _ < y.length; _ += 1) {
2379
+ const O = y[_];
2380
+ if (O.role === "tool") {
2381
+ de.push(O);
2330
2382
  continue;
2331
2383
  }
2332
- if (wt(M)) {
2333
- if (we()) {
2334
- const B = _t();
2335
- P(B), b = null, D = B;
2384
+ if (Ct(O)) {
2385
+ if (_e()) {
2386
+ const $ = St();
2387
+ I($), b = null, R = $;
2336
2388
  } else {
2337
- const B = sn(f());
2338
- P(B), b = null, D = B;
2389
+ const $ = fn(f());
2390
+ I($), b = null, R = $;
2339
2391
  }
2340
2392
  continue;
2341
2393
  }
2342
- if (M.role === "system")
2394
+ if (O.role === "system")
2343
2395
  continue;
2344
- const ae = we(), L = oa(M.content);
2345
- if (M.role === "assistant" && !ae) {
2346
- const y = Mn(f());
2347
- P(y), b = null, D = y;
2396
+ const P = _e(), G = fa(O.content);
2397
+ if (O.role === "assistant" && !P) {
2398
+ const L = Gn(f());
2399
+ I(L), b = null, R = L;
2348
2400
  }
2349
- const A = qi(M, L, g, T);
2350
- P(A), b = A, D = null;
2401
+ const S = aa(O, G, g, D);
2402
+ I(S), b = S, R = null;
2351
2403
  }
2352
- const G = we();
2353
- if (a.isThinking && !a.assistantDraft && !ce)
2354
- if (G) {
2355
- const _ = _t();
2356
- P(_), b = null, D = _;
2404
+ const W = _e(), Oe = y[y.length - 1]?.id === "assistant-draft";
2405
+ if (r.isThinking && !Oe && !ce)
2406
+ if (W) {
2407
+ const _ = St();
2408
+ I(_), b = null, R = _;
2357
2409
  } else {
2358
- const _ = sn(f());
2359
- P(_), b = null, D = _;
2410
+ const _ = fn(f());
2411
+ I(_), b = null, R = _;
2360
2412
  }
2361
- if (a.lastError) {
2413
+ if (r.lastError) {
2362
2414
  const _ = document.createElement("div");
2363
- _.className = "pluno-pa-widget__error", _.textContent = a.lastError, P(_), b = _, D = null;
2415
+ _.className = "pluno-pa-widget__error", _.textContent = r.lastError, I(_), b = _, R = null;
2364
2416
  }
2365
- const ie = k && !a.isThinking ? ao(x) : null;
2366
- if (k && ie && !k.dismissedCandidateIds.has(ie.id)) {
2367
- const _ = Zi(ie, {
2368
- isDrafting: k.draftingCandidateId === ie.id,
2417
+ const K = k && !r.isThinking ? fo(v) : null;
2418
+ if (k && K && !k.dismissedCandidateIds.has(K.id)) {
2419
+ const _ = ca(K, {
2420
+ isDrafting: k.draftingCandidateId === K.id,
2369
2421
  error: k.error,
2370
2422
  characterIconOptions: k.characterIconOptions,
2371
2423
  onDraft: k.onDraft,
2372
2424
  onDismiss: k.onDismiss,
2373
2425
  onDisable: k.onDisable
2374
2426
  });
2375
- P(_), k.onSeen(ie), b = null, D = _;
2427
+ I(_), k.onSeen(K), b = null, R = _;
2376
2428
  }
2377
- b?.classList.add("pluno-pa-widget__message--bottom-reserve"), D?.classList.add("pluno-pa-widget__bottom-reserve-compact"), P(t), Vi(g, T), rn(e, I), c ? De(e, u) : e.scrollTop = h;
2429
+ b?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), I(t), la(g, D), hn(e, T), c ? Re(e, u) : e.scrollTop = h;
2378
2430
  }
2379
- function qi(e, t, o, n) {
2380
- const i = ji(e, t), a = i ? o.get(i) : void 0;
2381
- if (i && a)
2382
- return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), a;
2431
+ function aa(e, t, o, n) {
2432
+ const i = ra(e, t), r = i ? o.get(i) : void 0;
2433
+ if (i && r)
2434
+ return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), r;
2383
2435
  const l = document.createElement("div");
2384
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? ra(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Yi(e.attachments));
2436
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? xa(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(sa(e.attachments));
2385
2437
  const p = document.createElement("div");
2386
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Xi(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2438
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(da(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2387
2439
  }
2388
- function ji(e, t) {
2440
+ function ra(e, t) {
2389
2441
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2390
2442
  id: e.id,
2391
2443
  content: t,
@@ -2403,11 +2455,11 @@ function ji(e, t) {
2403
2455
  })
2404
2456
  });
2405
2457
  }
2406
- function Vi(e, t) {
2458
+ function la(e, t) {
2407
2459
  for (const o of e.keys())
2408
2460
  t.has(o) || e.delete(o);
2409
2461
  }
2410
- function rn(e, t) {
2462
+ function hn(e, t) {
2411
2463
  let o = e.firstChild;
2412
2464
  for (const n of t) {
2413
2465
  if (n === o) {
@@ -2421,7 +2473,7 @@ function rn(e, t) {
2421
2473
  o = o.nextSibling, e.removeChild(n);
2422
2474
  }
2423
2475
  }
2424
- function Ki(e) {
2476
+ function pa(e) {
2425
2477
  if (!e.assistantDraft)
2426
2478
  return [...e.messages];
2427
2479
  const t = {
@@ -2436,12 +2488,12 @@ function Ki(e) {
2436
2488
  if (!t.respondsToUserMessageId)
2437
2489
  return [...e.messages, t];
2438
2490
  const o = e.messages.findIndex(
2439
- (a) => a.role === "user" && a.id === t.respondsToUserMessageId
2491
+ (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2440
2492
  );
2441
2493
  if (o === -1)
2442
2494
  return [...e.messages, t];
2443
2495
  const n = e.messages.findIndex(
2444
- (a, l) => l > o && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && ln(a, t) && wt(a)
2496
+ (r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && mn(r, t) && Ct(r)
2445
2497
  );
2446
2498
  if (n !== -1)
2447
2499
  return [
@@ -2450,7 +2502,7 @@ function Ki(e) {
2450
2502
  ...e.messages.slice(n + 1)
2451
2503
  ];
2452
2504
  let i = o + 1;
2453
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ln(e.messages[i], t); )
2505
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && mn(e.messages[i], t); )
2454
2506
  i += 1;
2455
2507
  return [
2456
2508
  ...e.messages.slice(0, i),
@@ -2458,14 +2510,14 @@ function Ki(e) {
2458
2510
  ...e.messages.slice(i)
2459
2511
  ];
2460
2512
  }
2461
- function wt(e) {
2513
+ function Ct(e) {
2462
2514
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2463
2515
  }
2464
- function ln(e, t) {
2516
+ function mn(e, t) {
2465
2517
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2466
2518
  }
2467
- function pn(e, t, o, n, i, a, l, p) {
2468
- e.replaceChildren(), zn(t, !1), t.disabled = !0, o(!1);
2519
+ function bn(e, t, o, n, i, r, l, p) {
2520
+ e.replaceChildren(), $n(t, !1), t.disabled = !0, o(!1);
2469
2521
  const c = document.createElement("div");
2470
2522
  c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2471
2523
  const u = se(
@@ -2476,27 +2528,27 @@ function pn(e, t, o, n, i, a, l, p) {
2476
2528
  const d = document.createElement("div");
2477
2529
  if (d.className = "pluno-pa-widget__empty", d.textContent = i, c.appendChild(d), l) {
2478
2530
  const g = document.createElement("a");
2479
- g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = a, c.appendChild(g);
2531
+ g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = r, c.appendChild(g);
2480
2532
  } else {
2481
2533
  const g = document.createElement("button");
2482
- g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => p?.()), c.appendChild(g);
2534
+ g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = r, g.addEventListener("click", () => p?.()), c.appendChild(g);
2483
2535
  }
2484
2536
  e.appendChild(c);
2485
2537
  }
2486
- function Yi(e) {
2538
+ function sa(e) {
2487
2539
  const t = document.createElement("div");
2488
2540
  t.className = "pluno-pa-widget__message-attachments";
2489
2541
  for (const o of e)
2490
- t.appendChild(zi(o));
2542
+ t.appendChild(Xi(o));
2491
2543
  return t;
2492
2544
  }
2493
- function Xi(e) {
2545
+ function da(e) {
2494
2546
  const t = document.createElement("button");
2495
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Di()), t.addEventListener("click", (o) => {
2547
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Vi()), t.addEventListener("click", (o) => {
2496
2548
  o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
2497
2549
  }), t;
2498
2550
  }
2499
- function Zi(e, t) {
2551
+ function ca(e, t) {
2500
2552
  const o = document.createElement("article");
2501
2553
  o.className = "pluno-pa-widget__share-prompt";
2502
2554
  const n = document.createElement("div");
@@ -2508,8 +2560,8 @@ function Zi(e, t) {
2508
2560
  );
2509
2561
  const i = document.createElement("div");
2510
2562
  i.className = "pluno-pa-widget__share-prompt-copy";
2511
- const a = document.createElement("strong");
2512
- a.textContent = "Share this win?", i.appendChild(a);
2563
+ const r = document.createElement("strong");
2564
+ r.textContent = "Share this win?", i.appendChild(r);
2513
2565
  const l = document.createElement("span");
2514
2566
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2515
2567
  const d = document.createElement("span");
@@ -2523,7 +2575,7 @@ function Zi(e, t) {
2523
2575
  const u = document.createElement("button");
2524
2576
  if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
2525
2577
  t.onDraft(e);
2526
- }), t.isDrafting ? (u.appendChild(xt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
2578
+ }), t.isDrafting ? (u.appendChild(Et()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
2527
2579
  p.appendChild(c);
2528
2580
  else {
2529
2581
  const d = document.createElement("button");
@@ -2537,15 +2589,15 @@ function Zi(e, t) {
2537
2589
  }
2538
2590
  return n.appendChild(p), o.appendChild(n), o;
2539
2591
  }
2540
- function Ji(e, t) {
2592
+ function ua(e, t) {
2541
2593
  const o = document.createElement("div");
2542
- o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (x) => {
2543
- x.target === o && t.onClose();
2594
+ o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (v) => {
2595
+ v.target === o && t.onClose();
2544
2596
  });
2545
2597
  const n = document.createElement("section");
2546
2598
  n.className = "pluno-pa-widget__share-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Draft a social post");
2547
- const i = document.createElement("header"), a = document.createElement("strong");
2548
- a.textContent = "Share this win", i.appendChild(a);
2599
+ const i = document.createElement("header"), r = document.createElement("strong");
2600
+ r.textContent = "Share this win", i.appendChild(r);
2549
2601
  const l = document.createElement("button");
2550
2602
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), n.appendChild(i);
2551
2603
  const p = document.createElement("p");
@@ -2556,52 +2608,52 @@ function Ji(e, t) {
2556
2608
  u.className = "pluno-pa-widget__share-dialog-step-header";
2557
2609
  const d = document.createElement("strong");
2558
2610
  d.textContent = "1) Copy Screenshot", u.appendChild(d);
2559
- const g = Qi(
2611
+ const g = ga(
2560
2612
  "Copy Screenshot",
2561
2613
  async () => {
2562
2614
  try {
2563
- return await ro(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2615
+ return await wo(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2564
2616
  } catch {
2565
2617
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2566
2618
  }
2567
2619
  }
2568
2620
  );
2569
2621
  if (u.appendChild(g), c.appendChild(u), e.screenshotDataUrl) {
2570
- const x = document.createElement("div");
2571
- x.className = "pluno-pa-widget__share-dialog-screenshot";
2572
- const v = document.createElement("img");
2573
- v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", x.appendChild(v), c.appendChild(x);
2622
+ const v = document.createElement("div");
2623
+ v.className = "pluno-pa-widget__share-dialog-screenshot";
2624
+ const y = document.createElement("img");
2625
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
2574
2626
  }
2575
2627
  n.appendChild(c), n.appendChild(p);
2576
- const S = document.createElement("div");
2577
- S.className = "pluno-pa-widget__share-dialog-step";
2628
+ const E = document.createElement("div");
2629
+ E.className = "pluno-pa-widget__share-dialog-step";
2578
2630
  const f = document.createElement("strong");
2579
- f.className = "pluno-pa-widget__share-dialog-step-title", f.textContent = "2) Share on", S.appendChild(f);
2580
- const F = document.createElement("p");
2581
- F.className = "pluno-pa-widget__share-dialog-hint", F.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(F);
2631
+ f.className = "pluno-pa-widget__share-dialog-step-title", f.textContent = "2) Share on", E.appendChild(f);
2632
+ const U = document.createElement("p");
2633
+ U.className = "pluno-pa-widget__share-dialog-hint", U.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(U);
2582
2634
  const k = document.createElement("footer");
2583
2635
  k.className = "pluno-pa-widget__share-dialog-platforms";
2584
- for (const x of ea(e)) {
2585
- const v = document.createElement("a");
2586
- v.href = x.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = x.label, v.setAttribute("aria-label", `Open ${x.label}`), v.appendChild(ta(x.id)), k.appendChild(v);
2636
+ for (const v of ha(e)) {
2637
+ const y = document.createElement("a");
2638
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ma(v.id)), k.appendChild(y);
2587
2639
  }
2588
- if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
2589
- const x = document.createElement("div");
2590
- x.className = "pluno-pa-widget__share-dialog-step";
2591
- const v = document.createElement("strong");
2592
- v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", x.appendChild(v);
2640
+ if (E.appendChild(k), n.appendChild(E), t.socialPostRewardsUrl) {
2641
+ const v = document.createElement("div");
2642
+ v.className = "pluno-pa-widget__share-dialog-step";
2643
+ const y = document.createElement("strong");
2644
+ y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
2593
2645
  const h = document.createElement("a");
2594
- 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(na()), x.appendChild(h), n.appendChild(x);
2646
+ 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(ba()), v.appendChild(h), n.appendChild(v);
2595
2647
  }
2596
2648
  return o.appendChild(n), o;
2597
2649
  }
2598
- function Qi(e, t) {
2650
+ function ga(e, t) {
2599
2651
  const o = document.createElement("button");
2600
2652
  return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
2601
2653
  n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
2602
2654
  }), o;
2603
2655
  }
2604
- function ea(e) {
2656
+ function ha(e) {
2605
2657
  const t = e.linkedinPost.trim(), o = e.xPost.trim();
2606
2658
  return [
2607
2659
  {
@@ -2621,47 +2673,47 @@ function ea(e) {
2621
2673
  }
2622
2674
  ];
2623
2675
  }
2624
- function ta(e) {
2676
+ function ma(e) {
2625
2677
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2626
- 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(
2678
+ 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" ? (z(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), z(
2627
2679
  t,
2628
2680
  "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"
2629
- ), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
2681
+ ), z(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), z(
2630
2682
  t,
2631
2683
  "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"
2632
- ), 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(
2684
+ ), z(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (z(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), z(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), z(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (z(
2633
2685
  t,
2634
2686
  "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"
2635
- ), U(
2687
+ ), z(
2636
2688
  t,
2637
2689
  "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",
2638
2690
  "0.48"
2639
- ), U(
2691
+ ), z(
2640
2692
  t,
2641
2693
  "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"
2642
- ), U(
2694
+ ), z(
2643
2695
  t,
2644
2696
  "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"
2645
2697
  ), t);
2646
2698
  }
2647
- function U(e, t, o) {
2699
+ function z(e, t, o) {
2648
2700
  const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
2649
2701
  n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
2650
2702
  }
2651
- function na() {
2703
+ function ba() {
2652
2704
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2653
- 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(
2705
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), z(e, "M14 5h5v5"), z(e, "M19 5l-8 8"), z(
2654
2706
  e,
2655
2707
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2656
2708
  ), e;
2657
2709
  }
2658
- function Rn(e) {
2659
- return e.role === "tool" && e.toolName === bn;
2710
+ function Wn(e) {
2711
+ return e.role === "tool" && e.toolName === Sn;
2660
2712
  }
2661
- function oa(e) {
2713
+ function fa(e) {
2662
2714
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2663
2715
  }
2664
- function ia(e, t, o, n) {
2716
+ function wa(e, t, o, n) {
2665
2717
  const i = document.createElement("article");
2666
2718
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
2667
2719
  e[e.length - 1].createdAt
@@ -2671,27 +2723,27 @@ function ia(e, t, o, n) {
2671
2723
  n
2672
2724
  )
2673
2725
  );
2674
- const a = document.createElement("details"), l = aa(e);
2675
- a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
2676
- i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), o();
2726
+ const r = document.createElement("details"), l = _a(e);
2727
+ r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
2728
+ i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), o();
2677
2729
  });
2678
2730
  const p = document.createElement("summary");
2679
- p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(xt());
2731
+ p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(Et());
2680
2732
  const u = document.createElement("span");
2681
- if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), a.appendChild(p), e.length > 0) {
2733
+ if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), r.appendChild(p), e.length > 0) {
2682
2734
  const d = document.createElement("div");
2683
2735
  d.className = "pluno-pa-widget__tool-lines";
2684
2736
  for (const g of e) {
2685
- const S = document.createElement("div");
2686
- S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(xt());
2737
+ const E = document.createElement("div");
2738
+ E.className = "pluno-pa-widget__tool-line", g.loading && E.appendChild(Et());
2687
2739
  const f = document.createElement("span");
2688
- f.textContent = g.content || "Run tool", S.appendChild(f), d.appendChild(S);
2740
+ f.textContent = g.content || "Run tool", E.appendChild(f), d.appendChild(E);
2689
2741
  }
2690
- a.appendChild(d);
2742
+ r.appendChild(d);
2691
2743
  }
2692
- return i.appendChild(a), i;
2744
+ return i.appendChild(r), i;
2693
2745
  }
2694
- function Mn(e) {
2746
+ function Gn(e) {
2695
2747
  const t = document.createElement("article");
2696
2748
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2697
2749
  se(
@@ -2700,11 +2752,11 @@ function Mn(e) {
2700
2752
  )
2701
2753
  ), t;
2702
2754
  }
2703
- function sn(e) {
2704
- const t = Mn(e);
2705
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
2755
+ function fn(e) {
2756
+ const t = Gn(e);
2757
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(St()), t;
2706
2758
  }
2707
- function _t() {
2759
+ function St() {
2708
2760
  const e = document.createElement("div");
2709
2761
  e.className = "pluno-pa-widget__status";
2710
2762
  const t = document.createElement("span");
@@ -2712,17 +2764,17 @@ function _t() {
2712
2764
  const o = document.createElement("span");
2713
2765
  return o.textContent = "Thinking...", e.appendChild(o), e;
2714
2766
  }
2715
- function aa(e) {
2767
+ function _a(e) {
2716
2768
  return `tools:${e[0]?.id ?? ""}`;
2717
2769
  }
2718
- function xt() {
2770
+ function Et() {
2719
2771
  const e = document.createElement("span");
2720
2772
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2721
2773
  }
2722
- function zn(e, t) {
2723
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ni() : An());
2774
+ function $n(e, t) {
2775
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? qi() : Bn());
2724
2776
  }
2725
- function ra(e, t) {
2777
+ function xa(e, t) {
2726
2778
  const o = t.replace(/\r\n/g, `
2727
2779
  `).split(`
2728
2780
  `);
@@ -2746,14 +2798,14 @@ function ra(e, t) {
2746
2798
  const l = i.match(/^(#{1,3})\s+(.+)$/);
2747
2799
  if (l) {
2748
2800
  const u = document.createElement(`h${l[1].length + 2}`);
2749
- We(u, l[2]), e.appendChild(u), n += 1;
2801
+ qe(u, l[2]), e.appendChild(u), n += 1;
2750
2802
  continue;
2751
2803
  }
2752
2804
  if (/^\s*[-*+]\s+/.test(i)) {
2753
2805
  const u = document.createElement("ul");
2754
2806
  for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
2755
2807
  const d = document.createElement("li");
2756
- We(d, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(d), n += 1;
2808
+ qe(d, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(d), n += 1;
2757
2809
  }
2758
2810
  e.appendChild(u);
2759
2811
  continue;
@@ -2762,7 +2814,7 @@ function ra(e, t) {
2762
2814
  const u = document.createElement("ol");
2763
2815
  for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
2764
2816
  const d = document.createElement("li");
2765
- We(d, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(d), n += 1;
2817
+ qe(d, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(d), n += 1;
2766
2818
  }
2767
2819
  e.appendChild(u);
2768
2820
  continue;
@@ -2772,17 +2824,17 @@ function ra(e, t) {
2772
2824
  p.push(o[n]), n += 1;
2773
2825
  const c = document.createElement("p");
2774
2826
  p.forEach((u, d) => {
2775
- d > 0 && c.appendChild(document.createElement("br")), We(c, u);
2827
+ d > 0 && c.appendChild(document.createElement("br")), qe(c, u);
2776
2828
  }), e.appendChild(c);
2777
2829
  }
2778
2830
  }
2779
- function We(e, t) {
2831
+ function qe(e, t) {
2780
2832
  const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2781
2833
  let n = 0;
2782
2834
  for (const i of t.matchAll(o)) {
2783
- const a = i.index ?? 0;
2784
- a > n && e.appendChild(
2785
- document.createTextNode(t.slice(n, a))
2835
+ const r = i.index ?? 0;
2836
+ r > n && e.appendChild(
2837
+ document.createTextNode(t.slice(n, r))
2786
2838
  );
2787
2839
  const l = i[0];
2788
2840
  if (l.startsWith("`")) {
@@ -2796,17 +2848,17 @@ function We(e, t) {
2796
2848
  p.textContent = l.slice(1, -1), e.appendChild(p);
2797
2849
  } else {
2798
2850
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2799
- if (p && la(p[2])) {
2851
+ if (p && va(p[2])) {
2800
2852
  const c = document.createElement("a");
2801
2853
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2802
2854
  } else
2803
2855
  e.appendChild(document.createTextNode(l));
2804
2856
  }
2805
- n = a + l.length;
2857
+ n = r + l.length;
2806
2858
  }
2807
2859
  n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
2808
2860
  }
2809
- function la(e) {
2861
+ function va(e) {
2810
2862
  if (e.startsWith("/") || e.startsWith("#"))
2811
2863
  return !0;
2812
2864
  try {
@@ -2816,8 +2868,8 @@ function la(e) {
2816
2868
  return !1;
2817
2869
  }
2818
2870
  }
2819
- function dn(e, t) {
2820
- if (pa(e))
2871
+ function wn(e, t) {
2872
+ if (ya(e))
2821
2873
  return;
2822
2874
  const o = `
2823
2875
  :host {
@@ -2870,7 +2922,7 @@ function dn(e, t) {
2870
2922
  --pluno-pa-accent-contrast: #fafafa;
2871
2923
  position: fixed;
2872
2924
  z-index: 2147483645;
2873
- font-family: ${Z.fontFamily};
2925
+ font-family: ${Q.fontFamily};
2874
2926
  font-size: 14px;
2875
2927
  color: var(--pluno-pa-text);
2876
2928
  width: var(--pluno-pa-launcher-width);
@@ -3008,6 +3060,10 @@ function dn(e, t) {
3008
3060
  .pluno-pa-widget__launcher-input::placeholder {
3009
3061
  color: var(--pluno-pa-faint);
3010
3062
  }
3063
+ .pluno-pa-widget--host-modal-conflict .pluno-pa-widget__launcher-input,
3064
+ .pluno-pa-widget--host-modal-conflict .pluno-pa-widget__input {
3065
+ cursor: not-allowed;
3066
+ }
3011
3067
  .pluno-pa-widget__launcher-minimize {
3012
3068
  position: absolute;
3013
3069
  top: -6px;
@@ -3839,7 +3895,7 @@ function dn(e, t) {
3839
3895
  place-items: center;
3840
3896
  padding: 18px;
3841
3897
  background: rgba(24, 24, 27, 0.28);
3842
- font-family: var(--pluno-pa-font, ${Z.fontFamily});
3898
+ font-family: var(--pluno-pa-font, ${Q.fontFamily});
3843
3899
  color: var(--pluno-pa-text);
3844
3900
  }
3845
3901
  .pluno-pa-widget__share-dialog {
@@ -4925,28 +4981,28 @@ function dn(e, t) {
4925
4981
  filter: url(#pluno-pa-scribble-wobble-2);
4926
4982
  }
4927
4983
  `;
4928
- if (sa(e, o))
4984
+ if (Ca(e, o))
4929
4985
  return;
4930
4986
  const n = e.ownerDocument.createElement("style");
4931
- n.id = yn, n.textContent = o, e.appendChild(n), Bn(e);
4987
+ n.id = Pn, n.textContent = o, e.appendChild(n), qn(e);
4932
4988
  }
4933
- function pa(e) {
4934
- return e.getElementById(yn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Cn) === "true";
4989
+ function ya(e) {
4990
+ return e.getElementById(Pn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Tn) === "true";
4935
4991
  }
4936
- function Bn(e) {
4937
- e.host instanceof HTMLElement && e.host.setAttribute(Cn, "true");
4992
+ function qn(e) {
4993
+ e.host instanceof HTMLElement && e.host.setAttribute(Tn, "true");
4938
4994
  }
4939
- function sa(e, t) {
4995
+ function Ca(e, t) {
4940
4996
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
4941
4997
  return !1;
4942
4998
  try {
4943
4999
  const o = new CSSStyleSheet();
4944
- return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], Bn(e), !0;
5000
+ return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], qn(e), !0;
4945
5001
  } catch {
4946
5002
  return !1;
4947
5003
  }
4948
5004
  }
4949
- async function da() {
5005
+ async function Sa() {
4950
5006
  return document.body ? document.body : await new Promise((e) => {
4951
5007
  const t = new MutationObserver(() => {
4952
5008
  document.body && (t.disconnect(), e(document.body));
@@ -4954,14 +5010,14 @@ async function da() {
4954
5010
  t.observe(document.documentElement, { childList: !0 });
4955
5011
  });
4956
5012
  }
4957
- function Un(e) {
5013
+ function jn(e) {
4958
5014
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
4959
5015
  }
4960
- function ca(e) {
5016
+ function Ea(e) {
4961
5017
  try {
4962
- const t = window.localStorage.getItem(Un(e));
5018
+ const t = window.localStorage.getItem(jn(e));
4963
5019
  if (!t)
4964
- return cn();
5020
+ return _n();
4965
5021
  const o = JSON.parse(t);
4966
5022
  return {
4967
5023
  isOpen: o.isOpen === !0,
@@ -4969,24 +5025,24 @@ function ca(e) {
4969
5025
  openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
4970
5026
  (n) => typeof n == "string"
4971
5027
  ) : [],
4972
- launcherPosition: ma(o.launcherPosition) ? o.launcherPosition : null,
4973
- seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-fn) : [],
5028
+ launcherPosition: Aa(o.launcherPosition) ? o.launcherPosition : null,
5029
+ seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-En) : [],
4974
5030
  sharePromptsDisabled: o.sharePromptsDisabled === !0
4975
5031
  };
4976
5032
  } catch {
4977
- return cn();
5033
+ return _n();
4978
5034
  }
4979
5035
  }
4980
- async function ua(e) {
5036
+ async function ka(e) {
4981
5037
  if (e.loadSharePromptsDisabled)
4982
5038
  return e.loadSharePromptsDisabled();
4983
5039
  try {
4984
- return window.localStorage.getItem(wn) === "true";
5040
+ return window.localStorage.getItem(kn) === "true";
4985
5041
  } catch {
4986
5042
  return !1;
4987
5043
  }
4988
5044
  }
4989
- function ga(e, t) {
5045
+ function La(e, t) {
4990
5046
  if (e.persistSharePromptsDisabled) {
4991
5047
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
4992
5048
  () => {
@@ -4995,12 +5051,12 @@ function ga(e, t) {
4995
5051
  return;
4996
5052
  }
4997
5053
  try {
4998
- t && window.localStorage.setItem(wn, "true");
5054
+ t && window.localStorage.setItem(kn, "true");
4999
5055
  } catch {
5000
5056
  return;
5001
5057
  }
5002
5058
  }
5003
- function cn() {
5059
+ function _n() {
5004
5060
  return {
5005
5061
  isOpen: !1,
5006
5062
  composerValue: "",
@@ -5010,48 +5066,48 @@ function cn() {
5010
5066
  sharePromptsDisabled: !1
5011
5067
  };
5012
5068
  }
5013
- function ha(e, t) {
5069
+ function Ia(e, t) {
5014
5070
  try {
5015
5071
  window.localStorage.setItem(
5016
- Un(e),
5072
+ jn(e),
5017
5073
  JSON.stringify(t)
5018
5074
  );
5019
5075
  } catch {
5020
5076
  return;
5021
5077
  }
5022
5078
  }
5023
- function ma(e) {
5079
+ function Aa(e) {
5024
5080
  if (!e || typeof e != "object")
5025
5081
  return !1;
5026
5082
  const t = e;
5027
5083
  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");
5028
5084
  }
5029
- const un = /* @__PURE__ */ new WeakSet();
5030
- function ba(e) {
5085
+ const xn = /* @__PURE__ */ new WeakSet();
5086
+ function Pa(e) {
5031
5087
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5032
5088
  }
5033
- function gn(e) {
5089
+ function vn(e) {
5034
5090
  const t = e.pathname.split("/");
5035
5091
  return t[t.length - 1] ?? "";
5036
5092
  }
5037
- function fa(e, t) {
5093
+ function Ta(e, t) {
5038
5094
  const o = new URL(e.src, document.baseURI);
5039
- return o.href === t.href || o.pathname === t.pathname ? !0 : gn(o) === gn(t);
5095
+ return o.href === t.href || o.pathname === t.pathname ? !0 : vn(o) === vn(t);
5040
5096
  }
5041
- class oe extends EventTarget {
5097
+ class ae extends EventTarget {
5042
5098
  constructor(t, o) {
5043
- super(), this.channelId = o, this.url = t, this.addPreviewListener(So, () => {
5044
- this.readyState = oe.OPEN, this.dispatchEvent(new Event("open"));
5045
- }), this.addPreviewListener(Eo, (n) => {
5099
+ super(), this.channelId = o, this.url = t, this.addPreviewListener(Mo, () => {
5100
+ this.readyState = ae.OPEN, this.dispatchEvent(new Event("open"));
5101
+ }), this.addPreviewListener(Oo, (n) => {
5046
5102
  const i = n;
5047
5103
  this.dispatchEvent(
5048
5104
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5049
5105
  );
5050
- }), this.addPreviewListener(ko, () => {
5051
- this.readyState = oe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5052
- }), this.addPreviewListener(Lo, (n) => {
5106
+ }), this.addPreviewListener(zo, () => {
5107
+ this.readyState = ae.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5108
+ }), this.addPreviewListener(Bo, (n) => {
5053
5109
  const i = n;
5054
- this.readyState = oe.CLOSED, this.dispatchEvent(
5110
+ this.readyState = ae.CLOSED, this.dispatchEvent(
5055
5111
  new CloseEvent("close", {
5056
5112
  code: i.detail?.code ?? 1e3,
5057
5113
  reason: i.detail?.reason ?? "",
@@ -5060,8 +5116,8 @@ class oe extends EventTarget {
5060
5116
  ), this.cleanup();
5061
5117
  }), window.dispatchEvent(
5062
5118
  new CustomEvent(
5063
- Ge(
5064
- vo,
5119
+ je(
5120
+ No,
5065
5121
  this.channelId
5066
5122
  ),
5067
5123
  {
@@ -5080,18 +5136,18 @@ class oe extends EventTarget {
5080
5136
  extensions = "";
5081
5137
  binaryType = "blob";
5082
5138
  bufferedAmount = 0;
5083
- readyState = oe.CONNECTING;
5084
- socketId = wa();
5139
+ readyState = ae.CONNECTING;
5140
+ socketId = Na();
5085
5141
  listeners = /* @__PURE__ */ new Map();
5086
5142
  send(t) {
5087
- if (this.readyState !== oe.OPEN)
5143
+ if (this.readyState !== ae.OPEN)
5088
5144
  throw new DOMException(
5089
5145
  "Pluno preview websocket is not open",
5090
5146
  "InvalidStateError"
5091
5147
  );
5092
5148
  window.dispatchEvent(
5093
5149
  new CustomEvent(
5094
- Ge(yo, this.channelId),
5150
+ je(Do, this.channelId),
5095
5151
  {
5096
5152
  detail: {
5097
5153
  socketId: this.socketId,
@@ -5102,9 +5158,9 @@ class oe extends EventTarget {
5102
5158
  );
5103
5159
  }
5104
5160
  close(t, o) {
5105
- this.readyState !== oe.CLOSED && (this.readyState = oe.CLOSING, window.dispatchEvent(
5161
+ this.readyState !== ae.CLOSED && (this.readyState = ae.CLOSING, window.dispatchEvent(
5106
5162
  new CustomEvent(
5107
- Ge(Co, this.channelId),
5163
+ je(Ro, this.channelId),
5108
5164
  {
5109
5165
  detail: { socketId: this.socketId, code: t, reason: o }
5110
5166
  }
@@ -5112,11 +5168,11 @@ class oe extends EventTarget {
5112
5168
  ), this.cleanup());
5113
5169
  }
5114
5170
  addPreviewListener(t, o) {
5115
- const n = Ge(
5171
+ const n = je(
5116
5172
  t,
5117
5173
  this.channelId
5118
- ), i = (a) => {
5119
- a.detail?.socketId === this.socketId && o(a);
5174
+ ), i = (r) => {
5175
+ r.detail?.socketId === this.socketId && o(r);
5120
5176
  };
5121
5177
  this.listeners.set(n, i), window.addEventListener(n, i);
5122
5178
  }
@@ -5126,19 +5182,19 @@ class oe extends EventTarget {
5126
5182
  this.listeners.clear();
5127
5183
  }
5128
5184
  }
5129
- function wa() {
5185
+ function Na() {
5130
5186
  const e = window.sessionStorage.getItem(
5131
- Ht
5187
+ Vt
5132
5188
  );
5133
5189
  if (e)
5134
5190
  return e;
5135
5191
  const t = crypto.randomUUID();
5136
- return window.sessionStorage.setItem(Ht, t), t;
5192
+ return window.sessionStorage.setItem(Vt, t), t;
5137
5193
  }
5138
- function Ge(e, t) {
5194
+ function je(e, t) {
5139
5195
  return `${e}:${t}`;
5140
5196
  }
5141
- function _a(e) {
5197
+ function Da(e) {
5142
5198
  const t = document.currentScript;
5143
5199
  if (t instanceof HTMLScriptElement)
5144
5200
  return [t];
@@ -5146,20 +5202,20 @@ function _a(e) {
5146
5202
  return Array.from(
5147
5203
  document.querySelectorAll("script[type='module'][src]")
5148
5204
  ).filter(
5149
- (i) => i instanceof HTMLScriptElement && ba(i) && fa(i, n)
5205
+ (i) => i instanceof HTMLScriptElement && Pa(i) && Ta(i, n)
5150
5206
  );
5151
5207
  }
5152
- function xa(e) {
5153
- for (const t of _a(e)) {
5154
- if (un.has(t) || t.dataset.plunoAutoMount === "false")
5208
+ function Ra(e) {
5209
+ for (const t of Da(e)) {
5210
+ if (xn.has(t) || t.dataset.plunoAutoMount === "false")
5155
5211
  continue;
5156
- un.add(t);
5212
+ xn.add(t);
5157
5213
  const o = t.dataset.plunoPreviewChannel;
5158
- Xo({
5214
+ di({
5159
5215
  token: t.dataset.plunoToken,
5160
5216
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
5161
5217
  backendUrl: t.dataset.plunoBackendUrl,
5162
- webSocketFactory: o ? Yo(o) : void 0,
5218
+ webSocketFactory: o ? si(o) : void 0,
5163
5219
  launcherLabel: t.dataset.plunoLauncherLabel,
5164
5220
  accentColor: t.dataset.plunoAccentColor,
5165
5221
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -5171,8 +5227,8 @@ function xa(e) {
5171
5227
  });
5172
5228
  }
5173
5229
  }
5174
- xa(import.meta.url);
5230
+ Ra(import.meta.url);
5175
5231
  export {
5176
- Yo as createProductAgentPreviewBridgeWebSocketFactory,
5177
- Xo as mountPlunoProductAgentWidget
5232
+ si as createProductAgentPreviewBridgeWebSocketFactory,
5233
+ di as mountPlunoProductAgentWidget
5178
5234
  };