@pluno/product-agent-web 0.1.66 → 0.1.68

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