@pluno/product-agent-web 0.1.67 → 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 = 1, Ti = 48, Jt = 420, Di = 520, zi = 0.24, Qt = 680, Ri = 800, Mi = 0.76, I = 8, Ce = 50, to = "http://www.w3.org/2000/svg", Gt = 26, $t = 8, Oi = 36, qt = 16, Bi = 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
- ], Ui = 11, Fi = 13, jt = 4, no = 10, oo = 40, Hi = "movable-launcher-position-v2", io = "pluno-pa-widget-styles", ao = "data-pluno-pa-widget-styles";
265
- let Ln = 0;
266
- function Wi(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 Gi(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 Gi(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
- ua(
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 = pr(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 lr(), 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
- ), R = i.querySelector(
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,143 +380,143 @@ async function Gi(e = {}) {
391
380
  ".pluno-pa-widget__attachments"
392
381
  ), Q = i.querySelector(
393
382
  ".pluno-pa-widget__attachment-input"
394
- ), Re = 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"
412
- ), z = i.querySelector(
401
+ ), R = i.querySelector(
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 || !Re || !x || !de || !Ye || !X || !C || !T || !Se || !q || !z || !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
- if (t.movableLauncher && !R)
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
- Na(
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 sr(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
- z.hidden = !0;
493
- }, Lo = () => {
494
- z.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(
481
+ R.hidden = !0;
482
+ }, zo = () => {
483
+ R.hidden = !1;
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 = sa(a);
510
- const S = document.createElement("time");
511
- S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = ca(
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 = da(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,68 +524,64 @@ async function Gi(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) : Zi(
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 = ia(
565
- o,
566
- _,
567
- x
568
- );
569
- cr(t, {
552
+ }, U = () => {
553
+ const r = fa(o, b, x);
554
+ Sr(t, {
570
555
  isOpen: i.classList.contains("pluno-pa-widget--open"),
571
556
  composerValue: x.value,
572
- focusedInput: a,
573
- focusedInputAt: a ? Date.now() : null,
574
- openToolGroupKeys: [...mt],
557
+ focusedInput: r,
558
+ focusedInputAt: r ? Date.now() : null,
559
+ openToolGroupKeys: [...wt],
575
560
  launcherPosition: d ? p : null,
576
561
  panelSize: c,
577
- seenShareCandidateIds: [...ke].slice(
578
- -Zn
562
+ seenShareCandidateIds: [...Le].slice(
563
+ -no
579
564
  ),
580
- sharePromptsDisabled: ft
565
+ sharePromptsDisabled: bt
581
566
  });
582
- }, Ze = (a) => {
583
- t.onDisplayStateChange?.(a);
584
- }, Ue = (a, s = !0) => {
585
- if (a === "shown") {
586
- 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");
587
572
  return;
588
573
  }
589
- 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(
590
575
  i,
591
- Tt(
576
+ zt(
592
577
  i,
593
578
  p,
594
579
  t.position
595
580
  )
596
- ), Dn(i), B(), s && Ze("minimized");
597
- }, xe = (a, s = {}) => {
598
- oa(a, {
599
- debugVersion: Hi,
581
+ ), Un(i), U(), s && Je("minimized");
582
+ }, ye = (r, s = {}) => {
583
+ ma(r, {
584
+ debugVersion: Qi,
600
585
  launcherPosition: p,
601
586
  rootClasses: i.className,
602
587
  rootStyle: {
@@ -605,35 +590,35 @@ async function Gi(e = {}) {
605
590
  right: i.style.right,
606
591
  bottom: i.style.bottom
607
592
  },
608
- rootRect: zt(i),
609
- launcherRect: zt(v),
610
- panelRect: zt(b),
593
+ rootRect: Ot(i),
594
+ launcherRect: Ot(v),
595
+ panelRect: Ot(w),
611
596
  viewport: Y(),
612
- panelHidden: b.hidden,
613
- closeHidden: A.hidden,
597
+ panelHidden: w.hidden,
598
+ closeHidden: T.hidden,
614
599
  ...s
615
600
  });
616
- }, Fe = (a = !0) => {
601
+ }, He = (r = !0) => {
617
602
  if (!p)
618
- return ve(i, null), Be(a);
619
- const s = Be(a);
620
- 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", {
621
606
  visibleLauncherPosition: s
622
607
  }), s;
623
- }, bt = (a, s) => {
624
- if (!a || !s) {
625
- Dn(i);
608
+ }, xt = (r, s) => {
609
+ if (!r || !s) {
610
+ Un(i);
626
611
  return;
627
612
  }
628
- na(i, {
629
- x: a.x - s.x,
630
- y: a.y - s.y
613
+ ha(i, {
614
+ x: r.x - s.x,
615
+ y: r.y - s.y
631
616
  });
632
- }, rn = () => {
617
+ }, dn = () => {
633
618
  if (i.classList.contains("pluno-pa-widget--minimized")) {
634
- ve(
619
+ Ce(
635
620
  i,
636
- Tt(
621
+ zt(
637
622
  i,
638
623
  p,
639
624
  t.position
@@ -641,234 +626,234 @@ async function Gi(e = {}) {
641
626
  );
642
627
  return;
643
628
  }
644
- const a = Fe();
629
+ const r = He();
645
630
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
646
- Nt(i, c);
631
+ Rt(i, c);
647
632
  const s = ze(c);
648
- Mt(h, s.width);
649
- const w = lt(
650
- u ?? Dt(
633
+ Bt(
634
+ h,
635
+ s.width
636
+ );
637
+ const _ = pt(
638
+ u ?? Mt(
651
639
  i,
652
- a,
640
+ r,
653
641
  t.position,
654
642
  c
655
643
  ),
656
644
  s
657
645
  );
658
- u && (u = w), bt(w, a), xe(
646
+ u && (u = _), xt(_, r), ye(
659
647
  "Applied open panel position after viewport resize",
660
- { openPanelPosition: w }
648
+ { openPanelPosition: _ }
661
649
  );
662
- } else p && xe(
650
+ } else p && ye(
663
651
  "Applied visible launcher position after viewport resize",
664
- { visibleLauncherPosition: a }
652
+ { visibleLauncherPosition: r }
665
653
  );
666
654
  };
667
- let ln = () => {
655
+ let cn = () => {
668
656
  };
669
- window.addEventListener("resize", rn), t.movableLauncher && R ? (Fe(), ln = Ki({
657
+ window.addEventListener("resize", dn), t.movableLauncher && z ? (He(), cn = ra({
670
658
  root: i,
671
659
  launcher: v,
672
- launcherDragHandle: R,
660
+ launcherDragHandle: z,
673
661
  getPosition: () => Be(),
674
- setPosition: (a) => {
675
- const s = a, w = dt(i), S = Vt(
662
+ setPosition: (r) => {
663
+ const s = r, _ = ct(i), L = Xt(
676
664
  i,
677
- a,
678
- w
665
+ r,
666
+ _
679
667
  );
680
- p = Qi(
681
- S,
682
- w
683
- ), ve(i, S), xe("Dragging closed launcher", {
668
+ p = ca(
669
+ L,
670
+ _
671
+ ), Ce(i, L), ye("Dragging closed launcher", {
684
672
  requestedPosition: s
685
673
  });
686
674
  },
687
675
  persist: () => {
688
- d = !0, B(), xe("Persisted closed launcher drag position");
676
+ d = !0, U(), ye("Persisted closed launcher drag position");
689
677
  }
690
- })) : ve(i, null), Nt(i, c);
691
- const No = () => {
692
- const a = ze(c), s = Be();
678
+ })) : Ce(i, null), Rt(i, c);
679
+ const Uo = () => {
680
+ const r = ze(c), s = Be();
693
681
  return {
694
- position: lt(
695
- u ?? Dt(
682
+ position: pt(
683
+ u ?? Mt(
696
684
  i,
697
685
  s,
698
686
  t.position,
699
687
  c
700
688
  ),
701
- a
689
+ r
702
690
  ),
703
- size: a
691
+ size: r
704
692
  };
705
- }, To = (a) => {
706
- c = ut(a.size), Nt(i, c), Mt(
693
+ }, Bo = (r) => {
694
+ c = gt(r.size), Rt(i, c), Bt(
707
695
  h,
708
696
  ze(c).width
709
- ), u = lt(
710
- a.position,
697
+ ), u = pt(
698
+ r.position,
711
699
  ze(c)
712
700
  );
713
701
  const s = Be();
714
- bt(u, s);
715
- }, Do = P.length > 0 ? Yi({
702
+ xt(u, s);
703
+ }, Fo = P.length > 0 ? la({
716
704
  root: i,
717
705
  handles: P,
718
- getBounds: No,
719
- setBounds: To,
720
- persist: B
706
+ getBounds: Uo,
707
+ setBounds: Bo,
708
+ persist: U
721
709
  }) : () => {
722
710
  };
723
- let _t = !1;
724
- const pn = async () => {
725
- if (!(!t.billingStatusLoader || _t)) {
726
- _t = !0;
711
+ let yt = !1;
712
+ const un = async () => {
713
+ if (!(!t.billingStatusLoader || yt)) {
714
+ yt = !0;
727
715
  try {
728
- const a = await t.billingStatusLoader();
729
- Bn(
716
+ const r = await t.billingStatusLoader();
717
+ Gn(
730
718
  t.billingStatus,
731
- a,
719
+ r,
732
720
  y.getState().lastErrorCode
733
- ) && (t.billingStatus = a, Bt(
721
+ ) && (t.billingStatus = r, Ht(
734
722
  H,
735
723
  t.billingStatus,
736
724
  y.getState().lastErrorCode
737
725
  ), j());
738
726
  } finally {
739
- _t = !1;
727
+ yt = !1;
740
728
  }
741
729
  }
742
- }, ge = (a = "", s = !0) => {
743
- 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(
744
732
  h,
745
733
  ze(c).width
746
734
  ), i.classList.remove("pluno-pa-widget--closing");
747
- const w = Fe(), S = Dt(
735
+ const _ = He(), L = Mt(
748
736
  i,
749
- w,
737
+ _,
750
738
  t.position,
751
739
  c
752
740
  );
753
- if (bt(S, w), xe("Opening launcher at clamped open panel position", {
754
- openPanelPosition: S,
755
- visibleLauncherPosition: w
741
+ if (xt(L, _), ye("Opening launcher at clamped open panel position", {
742
+ openPanelPosition: L,
743
+ visibleLauncherPosition: _
756
744
  }), ee(!0, "open"), te(), !s) {
757
- 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);
758
746
  return;
759
747
  }
760
748
  window.requestAnimationFrame(() => {
761
- 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(() => {
762
- 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;
763
751
  }, 220);
764
752
  });
765
- }, zo = () => {
766
- 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(() => {
767
- 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");
768
756
  }, 220);
769
757
  };
770
- v.addEventListener("submit", (a) => {
771
- a.preventDefault(), ge(_.value), _.value = "";
772
- }), R?.addEventListener("click", (a) => {
773
- a.preventDefault(), a.stopPropagation();
774
- }), v.addEventListener("click", (a) => {
775
- a.target === _ && !R || (ge(_.value), _.value = "");
776
- }), _.addEventListener("focus", () => {
777
- ge(_.value), _.value = "";
778
- }), _.addEventListener("input", () => {
779
- 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)
780
768
  return;
781
- const a = _.value;
782
- ge(a), _.value = "";
769
+ const r = b.value;
770
+ he(r), b.value = "";
783
771
  });
784
- let xt = null, Je = null, ye = null;
785
- const sn = (a) => a === _ || a === x, Ro = (a) => {
786
- 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())
787
775
  return null;
788
- let s = a;
776
+ let s = r;
789
777
  for (; s; ) {
790
- const w = s.closest(vn);
791
- if (w)
792
- return w;
793
- const S = s.getRootNode();
794
- 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;
795
783
  }
796
784
  return null;
797
- }, Mo = (a) => {
798
- if (!a.isConnected || !a.matches(vn))
785
+ }, Go = (r) => {
786
+ if (!r.isConnected || !r.matches(Ln))
799
787
  return !1;
800
- if (!(a instanceof HTMLElement))
788
+ if (!(r instanceof HTMLElement))
801
789
  return !0;
802
- if (a.hidden)
790
+ if (r.hidden)
803
791
  return !1;
804
- if (typeof a.checkVisibility == "function")
805
- return a.checkVisibility();
806
- const s = window.getComputedStyle(a);
792
+ if (typeof r.checkVisibility == "function")
793
+ return r.checkVisibility();
794
+ const s = window.getComputedStyle(r);
807
795
  return s.display !== "none" && s.visibility !== "hidden";
808
- }, dn = (a) => {
809
- He !== a && (He = a, i.classList.toggle(
810
- "pluno-pa-widget--host-modal-conflict",
811
- a !== null
812
- ), et(), a !== null ? ye = window.setInterval(() => {
813
- const s = He;
814
- (!s || !Mo(s)) && dn(null);
815
- }, Pi) : ye !== null && (window.clearInterval(ye), ye = null, Je = null));
816
- }, Oo = () => {
817
- 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);
818
803
  };
819
- i.addEventListener("focusin", (a) => {
820
- sn(a.target) && (xt = Date.now(), B());
821
- }), i.addEventListener("focusout", (a) => {
822
- 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)
823
808
  return;
824
- const s = xt;
825
- if (xt = null, s === null || Date.now() - s > ki)
809
+ const s = vt;
810
+ if (vt = null, s === null || Date.now() - s > Mi)
826
811
  return;
827
- const w = Ro(a.relatedTarget);
828
- if (!w)
812
+ const _ = Wo(r.relatedTarget);
813
+ if (!_)
829
814
  return;
830
- const S = Date.now();
831
- if (Je !== null && S - Je <= Li) {
832
- dn(w);
815
+ const L = Date.now();
816
+ if (Qe !== null && L - Qe <= Oi) {
817
+ hn(_);
833
818
  return;
834
819
  }
835
- Je = S;
836
- }), v.addEventListener("keydown", (a) => {
837
- !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), ge());
838
- }), g?.addEventListener("pointerdown", (a) => {
839
- a.stopPropagation();
840
- }), g?.addEventListener("click", (a) => {
841
- a.preventDefault(), a.stopPropagation(), Ue("minimized");
842
- }), A.addEventListener("click", zo), N.addEventListener("scroll", () => {
843
- N.scrollTop < be - 1 && ee(!1, "userScroll"), be = N.scrollTop;
844
- }), z.addEventListener("click", () => {
845
- Po();
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;
829
+ }), R.addEventListener("click", () => {
830
+ Mo();
846
831
  });
847
- const cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
848
- ([a]) => {
849
- a?.isIntersecting && (ee(!0, "bottom"), te());
832
+ const mn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
833
+ ([r]) => {
834
+ r?.isIntersecting && (ee(!0, "bottom"), te());
850
835
  },
851
- { root: N, threshold: 0 }
836
+ { root: A, threshold: 0 }
852
837
  );
853
- cn?.observe(ht);
854
- const Qe = () => t.loginRequired || t.signupRequired;
855
- let He = null, We = !1;
856
- const et = () => {
857
- const a = Qe(), s = He !== null;
858
- _.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;
859
844
  }, j = () => {
860
- de.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, Re.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);
861
846
  };
862
- et();
863
- const yt = () => {
864
- const a = y.getState().isThinking;
865
- 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(
866
851
  "pluno-pa-widget--unread",
867
- !a && We
868
- ), et();
852
+ !r && Ge
853
+ ), tt();
869
854
  };
870
- yt(), L.addEventListener("submit", (a) => {
871
- if (a.preventDefault(), t.loginRequired) {
855
+ Ct(), k.addEventListener("submit", (r) => {
856
+ if (r.preventDefault(), t.loginRequired) {
872
857
  t.onLoginClick?.();
873
858
  return;
874
859
  }
@@ -876,64 +861,64 @@ async function Gi(e = {}) {
876
861
  t.onSignupClick?.();
877
862
  return;
878
863
  }
879
- ae(t.billingStatus) || (fe = !0, ee(!0, "send"), te(), W = Rt(
864
+ ae(t.billingStatus) || (we = !0, ee(!0, "send"), te(), W = Ut(
880
865
  y,
881
866
  x,
882
867
  W
883
- ), Ee(), j());
868
+ ), ke(), j());
884
869
  });
885
- let Ge = 0;
886
- const Bo = () => {
887
- Ge = 0, i.classList.remove("pluno-pa-widget--drag-over");
888
- }, vt = (a) => {
889
- 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(() => {
890
875
  F.textContent = "", F.hidden = !0, le = null;
891
876
  }, 3e3);
892
- }, Uo = () => {
877
+ }, jo = () => {
893
878
  le !== null && (window.clearTimeout(le), le = null), F.textContent = "", F.hidden = !0;
894
- }, Ct = async (a) => {
895
- if (a.length === 0)
879
+ }, Et = async (r) => {
880
+ if (r.length === 0)
896
881
  return;
897
- const s = za(y, a);
898
- 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();
899
884
  };
900
- Re.addEventListener("click", () => {
885
+ Me.addEventListener("click", () => {
901
886
  t.loginRequired || ae(t.billingStatus) || Q.click();
902
887
  }), Q.addEventListener("change", () => {
903
- const a = Array.from(Q.files ?? []);
904
- Q.value = "", Ct(a).catch((s) => {
905
- vt(
888
+ const r = Array.from(Q.files ?? []);
889
+ Q.value = "", Et(r).catch((s) => {
890
+ St(
906
891
  s instanceof Error ? s.message : "Failed to attach file"
907
892
  ), J("web-sdk.widget", "Attachment failed", {
908
893
  message: s instanceof Error ? s.message : String(s)
909
894
  });
910
895
  });
911
- }), i.addEventListener("dragenter", (a) => {
912
- !it(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ge += 1, i.classList.add("pluno-pa-widget--drag-over"));
913
- }), i.addEventListener("dragover", (a) => {
914
- const s = a.dataTransfer;
915
- !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
916
- }), i.addEventListener("dragleave", (a) => {
917
- it(a.dataTransfer) && (a.stopPropagation(), Ge = Math.max(0, Ge - 1), Ge === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
918
- }), i.addEventListener("drop", (a) => {
919
- const s = a.dataTransfer;
920
- !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Bo(), Ct(s.files).catch((w) => {
921
- vt(
922
- 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"
923
908
  ), J("web-sdk.widget", "Attachment failed", {
924
- message: w instanceof Error ? w.message : String(w)
909
+ message: _ instanceof Error ? _.message : String(_)
925
910
  });
926
911
  }));
927
- }), i.addEventListener("paste", (a) => {
928
- const s = a.clipboardData, w = Array.from(s?.files ?? []);
929
- w.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ct(w).catch((S) => {
930
- vt(
931
- 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"
932
917
  ), J("web-sdk.widget", "Attachment failed", {
933
- message: S instanceof Error ? S.message : String(S)
918
+ message: L instanceof Error ? L.message : String(L)
934
919
  });
935
920
  }));
936
- }), de.addEventListener("click", () => {
921
+ }), ce.addEventListener("click", () => {
937
922
  if (t.loginRequired) {
938
923
  t.onLoginClick?.();
939
924
  return;
@@ -942,91 +927,91 @@ async function Gi(e = {}) {
942
927
  y.stop();
943
928
  return;
944
929
  }
945
- fe = !0, ee(!0, "send"), te(), W = Rt(
930
+ we = !0, ee(!0, "send"), te(), W = Ut(
946
931
  y,
947
932
  x,
948
933
  W
949
- ), Ee(), j(), G(y.getState());
934
+ ), ke(), j(), G(y.getState());
950
935
  }), X.addEventListener("click", () => {
951
- ce = !ce, Oe = null, _e(), ce && ue.length === 0 && on(null);
952
- }), Se.addEventListener("click", () => {
953
- ce = !1, _e();
954
- }), T.addEventListener("scroll", Io), x.addEventListener("input", () => {
955
- je(x), B(), j(), Wo();
956
- }), x.addEventListener("keydown", (a) => {
957
- if (!(a.key !== "Enter" || a.shiftKey)) {
958
- 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) {
959
944
  t.onLoginClick?.();
960
945
  return;
961
946
  }
962
- fe = !0, ee(!0, "send"), te(), W = Rt(
947
+ we = !0, ee(!0, "send"), te(), W = Ut(
963
948
  y,
964
949
  x,
965
950
  W
966
- ), Ee(), j(), G(y.getState());
967
- }
968
- }), i.addEventListener("click", (a) => {
969
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && B();
970
- }), l.composerValue && (x.value = l.composerValue, je(x)), t.initialDisplayState === "minimized" ? Ue("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && ge(x.value, !1), aa(l, i, _, x);
971
- const tt = () => r;
972
- let St = y.getState().appearance !== null, nt = null, $e = null, Pe = null, un = y.getState().isThinking, Ie = null;
973
- 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;
974
959
  let Ae = null, Ne = !1;
975
- const gn = () => {
960
+ const wn = () => {
976
961
  Ae !== null && (window.clearTimeout(Ae), Ae = null);
977
- }, ot = () => {
978
- Me && (Me.hidden = !0);
979
- }, hn = () => y.getState().assistantDraft.trim().length > 0, Fo = async () => {
980
- 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())
981
966
  return;
982
- let a;
967
+ let r;
983
968
  try {
984
- a = await qe.getState();
969
+ r = await je.getState();
985
970
  } catch {
986
971
  return;
987
972
  }
988
- 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);
989
974
  };
990
- vo?.addEventListener("click", () => {
991
- Ne = !0, ot(), qe?.enable().catch(() => {
975
+ To?.addEventListener("click", () => {
976
+ Ne = !0, it(), je?.enable().catch(() => {
992
977
  });
993
- }), Co?.addEventListener("click", () => {
994
- Ne = !0, ot();
995
- }), So?.addEventListener("click", () => {
996
- 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(() => {
997
982
  });
998
983
  });
999
- let Te = null, mn = () => {
984
+ let De = null, _n = () => {
1000
985
  };
1001
- const Ho = !!t.socialPostDraftHandler, Et = /* @__PURE__ */ new Map(), kt = () => x.value.trim().length > 0 || W.length > 0, Wo = () => {
1002
- const a = Te !== null && Ut(y.getState(), kt());
1003
- 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);
1004
989
  };
1005
- let De = null;
1006
- const Go = () => {
1007
- 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());
1008
- }, Lt = (a) => {
1009
- if (!a) {
1010
- 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;
1011
996
  return;
1012
997
  }
1013
- De || (De = gt(
998
+ Re || (Re = ht(
1014
999
  "pluno-pa-widget__new-chat",
1015
1000
  "New chat",
1016
- Ca(),
1001
+ za(),
1017
1002
  !1
1018
- ), De.addEventListener("click", Go), Ye.insertBefore(De, X));
1019
- }, G = (a) => {
1020
- 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(
1021
1006
  H,
1022
1007
  t.billingStatus,
1023
- Ie
1008
+ Te
1024
1009
  ), t.loginRequired) {
1025
- Et.clear(), Wn(
1026
- N,
1027
- de,
1028
- Lt,
1029
- tt,
1010
+ Lt.clear(), Vn(
1011
+ A,
1012
+ ce,
1013
+ It,
1014
+ nt,
1030
1015
  "Log in to use Pluno on this page.",
1031
1016
  t.loginButtonLabel,
1032
1017
  t.loginUrl,
@@ -1035,11 +1020,11 @@ async function Gi(e = {}) {
1035
1020
  return;
1036
1021
  }
1037
1022
  if (t.signupRequired) {
1038
- Et.clear(), Wn(
1039
- N,
1040
- de,
1041
- Lt,
1042
- tt,
1023
+ Lt.clear(), Vn(
1024
+ A,
1025
+ ce,
1026
+ It,
1027
+ nt,
1043
1028
  "Complete signup to unlock your free trial credits.",
1044
1029
  t.signupButtonLabel,
1045
1030
  t.signupUrl,
@@ -1047,67 +1032,67 @@ async function Gi(e = {}) {
1047
1032
  );
1048
1033
  return;
1049
1034
  }
1050
- const s = la(a), w = s !== nn;
1051
- nn = s;
1052
- const S = fe || we.enabled;
1053
- fe = !1, Ha(
1054
- N,
1055
- ht,
1056
- de,
1057
- Lt,
1058
- D,
1059
- a,
1060
- Te,
1061
- Te !== null && Ut(a, kt()),
1062
- S,
1063
- () => we.enabled,
1035
+ const s = _a(r), _ = s !== rn;
1036
+ rn = s;
1037
+ const L = we || be.enabled;
1038
+ we = !1, Qa(
1039
+ A,
1064
1040
  mt,
1065
- Et,
1066
- B,
1067
- 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,
1068
1053
  (M) => {
1069
- fe = !0, ee(!0, "send"), te(), y.sendMessage(M);
1054
+ we = !0, ee(!0, "send"), te(), y.sendMessage(M);
1070
1055
  },
1071
- Ho && !ft ? {
1072
- dismissedCandidateIds: Xe,
1073
- draftingCandidateId: nt,
1074
- error: $e,
1075
- characterIconOptions: tt(),
1056
+ Ko && !bt ? {
1057
+ dismissedCandidateIds: Ze,
1058
+ draftingCandidateId: ot,
1059
+ error: qe,
1060
+ characterIconOptions: nt(),
1076
1061
  onSeen: (M) => {
1077
- ke.add(M.id), B();
1062
+ Le.add(M.id), U();
1078
1063
  },
1079
1064
  onDraft: (M) => {
1080
- $o(M);
1065
+ Zo(M);
1081
1066
  },
1082
1067
  onDismiss: (M) => {
1083
- 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());
1084
1069
  },
1085
1070
  onDisable: (M) => {
1086
- ft = !0, ke.add(M.id), Xe.add(M.id), B(), dr(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());
1087
1072
  }
1088
1073
  } : void 0
1089
- ), S ? (be = N.scrollTop, te()) : w && pa(a) && Lo();
1074
+ ), L ? (_e = A.scrollTop, te()) : _ && xa(r) && zo();
1090
1075
  };
1091
- return mn = si(
1092
- (a) => {
1093
- 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());
1094
1079
  },
1095
1080
  {
1096
1081
  backendUrl: t.backendUrl,
1097
- fetcher: ko,
1082
+ fetcher: Ro,
1098
1083
  loader: t.activeUsersLoader
1099
1084
  }
1100
- ), y.on("state", (a) => {
1101
- const s = un && !a.isThinking;
1102
- un = a.isThinking, a.isThinking && !a.assistantDraft.trim() && qe && !Ne && Ae === null && Me?.hidden !== !1 && (Ae = window.setTimeout(() => {
1103
- Ae = null, Fo();
1104
- }, 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(
1105
1090
  "web-sdk.widget",
1106
1091
  "Agent state supplied appearance",
1107
1092
  {
1108
- appearance: a.appearance
1093
+ appearance: r.appearance
1109
1094
  }
1110
- ), Pt(a.appearance, "agent.state.appearance")) : St && (St = !1, J(
1095
+ ), Tt(r.appearance, "agent.state.appearance")) : kt && (kt = !1, J(
1111
1096
  "web-sdk.widget",
1112
1097
  "Agent state cleared appearance; reverting to configured widget options",
1113
1098
  {
@@ -1115,101 +1100,102 @@ async function Gi(e = {}) {
1115
1100
  fallbackColorScheme: t.colorScheme,
1116
1101
  fallbackFontFamily: t.fontFamily
1117
1102
  }
1118
- ), Pt({}, "agent.state.appearance-cleared")), G(a), j(), s && pn();
1103
+ ), Tt({}, "agent.state.appearance-cleared")), G(r), j(), s && un();
1119
1104
  }), G(y.getState()), j(), {
1120
1105
  agent: y,
1121
- updateAppearance: (a) => {
1122
- 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");
1123
1109
  },
1124
- updateBillingStatus: (a) => {
1125
- const s = a ?? null;
1126
- Bn(
1110
+ updateBillingStatus: (r) => {
1111
+ const s = r ?? null;
1112
+ Gn(
1127
1113
  t.billingStatus,
1128
1114
  s,
1129
- Ie
1130
- ) && (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(
1131
1117
  i.querySelector(".pluno-pa-widget__billing-status"),
1132
1118
  t.billingStatus,
1133
- Ie
1119
+ Te
1134
1120
  ), j());
1135
1121
  },
1136
- updateAuthGate: (a) => {
1137
- const s = Qe();
1138
- 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((_) => {
1139
1125
  J(
1140
1126
  "web-sdk.widget",
1141
1127
  "Failed to connect after auth gate cleared",
1142
1128
  {
1143
- message: w instanceof Error ? w.message : String(w)
1129
+ message: _ instanceof Error ? _.message : String(_)
1144
1130
  }
1145
1131
  );
1146
1132
  });
1147
1133
  },
1148
1134
  openPanel: () => {
1149
- ge(x.value, !1);
1135
+ he(x.value, !1);
1150
1136
  },
1151
- updateDisplayState: (a) => {
1152
- if (a === "shown") {
1153
- Ue("shown", !1);
1137
+ updateDisplayState: (r) => {
1138
+ if (r === "shown") {
1139
+ Fe("shown", !1);
1154
1140
  return;
1155
1141
  }
1156
- Ue("minimized", !1);
1142
+ Fe("minimized", !1);
1157
1143
  },
1158
1144
  destroy: () => {
1159
- 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());
1160
1146
  }
1161
1147
  };
1162
- async function $o(a) {
1163
- if (!nt) {
1164
- 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());
1165
1151
  try {
1166
1152
  if (!t.socialPostDraftHandler)
1167
1153
  throw new Error("Social post drafting is not available here.");
1168
- const s = await t.socialPostDraftHandler(a);
1154
+ const s = await t.socialPostDraftHandler(r);
1169
1155
  if (!s.linkedinPost || !s.xPost)
1170
1156
  throw new Error("Pluno did not return a complete social post draft.");
1171
- ke.add(a.id), Xe.add(a.id), B(), Pe?.remove(), Pe = Ya(s, {
1157
+ Le.add(r.id), Ze.add(r.id), U(), Ie?.remove(), Ie = lr(s, {
1172
1158
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1173
1159
  onClose: () => {
1174
- Pe?.remove(), Pe = null;
1160
+ Ie?.remove(), Ie = null;
1175
1161
  }
1176
- }), i.appendChild(Pe);
1162
+ }), i.appendChild(Ie);
1177
1163
  } catch (s) {
1178
- $e = s instanceof Error ? s.message : "Could not draft social post.";
1164
+ qe = s instanceof Error ? s.message : "Could not draft social post.";
1179
1165
  } finally {
1180
- nt = null, G(y.getState());
1166
+ ot = null, G(y.getState());
1181
1167
  }
1182
1168
  }
1183
1169
  }
1184
- function Pt(a, s) {
1185
- const w = a.accentColor ?? t.accentColor, S = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, It = a.scribbleStyle ?? t.scribbleStyle;
1186
- r = Pn(
1187
- w,
1188
- It
1189
- ), In(i, r, {
1190
- accentColor: w,
1191
- 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,
1192
1178
  fontFamily: M,
1193
- scribbleStyle: It
1179
+ scribbleStyle: At
1194
1180
  }), J("web-sdk.widget", "Updated widget appearance", {
1195
1181
  source: s,
1196
- inputAppearance: a,
1197
- appliedAccentColor: w,
1198
- appliedColorScheme: S,
1182
+ inputAppearance: r,
1183
+ appliedAccentColor: _,
1184
+ appliedColorScheme: L,
1199
1185
  appliedFontFamily: M,
1200
- appliedScribbleStyle: It,
1186
+ appliedScribbleStyle: At,
1201
1187
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1202
1188
  });
1203
1189
  }
1204
1190
  }
1205
- function Pn(e, t) {
1191
+ function Dn(e, t) {
1206
1192
  return { accentColor: e, scribbleStyle: t };
1207
1193
  }
1208
- function $i(e) {
1209
- const t = qi(e);
1210
- return t === null ? "#fafafa" : ji(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";
1211
1197
  }
1212
- function qi(e) {
1198
+ function oa(e) {
1213
1199
  const t = e.trim();
1214
1200
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1215
1201
  Number.parseInt(t.slice(1, 3), 16),
@@ -1221,14 +1207,14 @@ function qi(e) {
1221
1207
  Number.parseInt(t[3] + t[3], 16)
1222
1208
  ] : null;
1223
1209
  }
1224
- function ji([e, t, n]) {
1210
+ function ia([e, t, n]) {
1225
1211
  const o = (i) => {
1226
- const r = i / 255;
1227
- 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;
1228
1214
  };
1229
1215
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1230
1216
  }
1231
- function In(e, t, n) {
1217
+ function Rn(e, t, n) {
1232
1218
  e.classList.toggle(
1233
1219
  "pluno-pa-widget--dark",
1234
1220
  n.colorScheme === "dark"
@@ -1236,27 +1222,27 @@ function In(e, t, n) {
1236
1222
  "pluno-pa-widget--light",
1237
1223
  n.colorScheme !== "dark"
1238
1224
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1239
- const o = n.scribbleStyle ? Kn(n.accentColor) : n.accentColor;
1225
+ const o = n.scribbleStyle ? Qn(n.accentColor) : n.accentColor;
1240
1226
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1241
1227
  "--pluno-pa-accent-contrast",
1242
- $i(o)
1243
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ai : n.fontFamily, n.scribbleStyle && Vi(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);
1244
1230
  const i = Array.from(
1245
1231
  e.querySelectorAll(".pluno-pa-widget__character")
1246
1232
  );
1247
- for (const r of i)
1248
- r.replaceWith(
1249
- me(
1250
- Array.from(r.classList).join(" "),
1233
+ for (const a of i)
1234
+ a.replaceWith(
1235
+ fe(
1236
+ Array.from(a.classList).join(" "),
1251
1237
  t
1252
1238
  )
1253
1239
  );
1254
1240
  }
1255
- function Vi(e) {
1256
- if (e.getElementById(Sn))
1241
+ function aa(e) {
1242
+ if (e.getElementById(In))
1257
1243
  return;
1258
1244
  const t = e.createElement("style");
1259
- t.id = Sn, t.textContent = `@font-face {
1245
+ t.id = In, t.textContent = `@font-face {
1260
1246
  font-family: "Architects Daughter";
1261
1247
  font-style: normal;
1262
1248
  font-weight: 400;
@@ -1264,28 +1250,28 @@ function Vi(e) {
1264
1250
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1265
1251
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1266
1252
  }
1267
- function Ki({
1253
+ function ra({
1268
1254
  root: e,
1269
1255
  launcher: t,
1270
1256
  launcherDragHandle: n,
1271
1257
  getPosition: o,
1272
1258
  setPosition: i,
1273
- persist: r
1259
+ persist: a
1274
1260
  }) {
1275
1261
  let l = null, p = null, d = null, c = !1, u = null;
1276
1262
  const m = () => {
1277
1263
  l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1278
- }, k = (h) => {
1264
+ }, E = (h) => {
1279
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));
1280
1266
  }, v = (h) => {
1281
1267
  if (l !== h.pointerId || !p || !d)
1282
1268
  return;
1283
1269
  h.preventDefault();
1284
- const P = h.clientX - p.x, A = h.clientY - p.y;
1285
- !c && Math.hypot(P, A) < jt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + A }));
1286
- }, R = (h) => {
1287
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1288
- }, _ = (h) => {
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 }));
1272
+ }, z = (h) => {
1273
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, a()), m());
1274
+ }, b = (h) => {
1289
1275
  l === h.pointerId && (h.preventDefault(), m());
1290
1276
  }, g = (h) => {
1291
1277
  if (!u)
@@ -1293,61 +1279,61 @@ function Ki({
1293
1279
  const P = Math.hypot(
1294
1280
  h.clientX - u.x,
1295
1281
  h.clientY - u.y
1296
- ) <= jt;
1282
+ ) <= Yt;
1297
1283
  u = null, P && (h.preventDefault(), h.stopPropagation());
1298
- }, b = (h) => {
1284
+ }, w = (h) => {
1299
1285
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1300
1286
  return;
1301
- const P = h.shiftKey ? oo : no, A = o();
1302
- let L = null;
1303
- 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());
1304
1290
  };
1305
- return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", R), t.addEventListener("pointercancel", _), t.addEventListener("click", g, !0), n.addEventListener("keydown", b), () => {
1306
- t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", R), 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);
1307
1293
  };
1308
1294
  }
1309
- function Yi({
1295
+ function la({
1310
1296
  root: e,
1311
1297
  handles: t,
1312
1298
  getBounds: n,
1313
1299
  setBounds: o,
1314
1300
  persist: i
1315
1301
  }) {
1316
- let r = null, l = null, p = null, d = null, c = !1;
1302
+ let a = null, l = null, p = null, d = null, c = !1;
1317
1303
  const u = () => {
1318
- 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");
1319
1305
  }, m = (g) => {
1320
- const b = g.currentTarget, h = b.dataset.resizeDirection;
1321
- !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));
1322
- }, k = (g) => {
1323
- 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)
1324
1310
  return;
1325
1311
  g.preventDefault(), g.stopPropagation();
1326
- const b = g.clientX - p.x, h = g.clientY - p.y;
1327
- !c && Math.hypot(b, h) < jt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1328
- 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)
1329
1315
  ));
1330
1316
  }, v = (g) => {
1331
- r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1332
- }, R = (g) => {
1333
- r === g.pointerId && (g.preventDefault(), u());
1334
- }, _ = (g) => {
1335
- const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? oo : no, A = n();
1336
- let L = 0, F = 0;
1337
- 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()));
1317
+ a === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1318
+ }, z = (g) => {
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()));
1338
1324
  };
1339
1325
  for (const g of t)
1340
- g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", R), g.addEventListener("keydown", _);
1326
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", E), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", b);
1341
1327
  return () => {
1342
1328
  for (const g of t)
1343
- g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", R), g.removeEventListener("keydown", _);
1329
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", E), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", b);
1344
1330
  };
1345
1331
  }
1346
- function An(e) {
1332
+ function zn(e) {
1347
1333
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1348
1334
  }
1349
- function Nn(e, t, n, o) {
1350
- const i = Y(), r = Tn({
1335
+ function Mn(e, t, n, o) {
1336
+ const i = Y(), a = On({
1351
1337
  leading: e.position.x,
1352
1338
  length: e.size.width,
1353
1339
  delta: n,
@@ -1356,54 +1342,50 @@ function Nn(e, t, n, o) {
1356
1342
  minLeading: I,
1357
1343
  maxTrailing: i.width - I,
1358
1344
  minLength: Math.min(
1359
- Jt,
1345
+ tn,
1360
1346
  i.width - I * 2
1361
1347
  )
1362
- }), l = Tn({
1348
+ }), l = On({
1363
1349
  leading: e.position.y,
1364
1350
  length: e.size.height,
1365
1351
  delta: o,
1366
1352
  resizeLeading: t.startsWith("top") || t === "top",
1367
1353
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1368
- minLeading: Ce,
1354
+ minLeading: Se,
1369
1355
  maxTrailing: i.height - I,
1370
1356
  minLength: Math.min(
1371
- Qt,
1372
- i.height - Ce - I
1357
+ nn,
1358
+ i.height - Se - I
1373
1359
  )
1374
1360
  });
1375
1361
  return {
1376
- position: { x: r.leading, y: l.leading },
1377
- size: { width: r.length, height: l.length }
1362
+ position: { x: a.leading, y: l.leading },
1363
+ size: { width: a.length, height: l.length }
1378
1364
  };
1379
1365
  }
1380
- function Tn({
1366
+ function On({
1381
1367
  leading: e,
1382
1368
  length: t,
1383
1369
  delta: n,
1384
1370
  resizeLeading: o,
1385
1371
  resizeTrailing: i,
1386
- minLeading: r,
1372
+ minLeading: a,
1387
1373
  maxTrailing: l,
1388
1374
  minLength: p
1389
1375
  }) {
1390
1376
  const d = e + t;
1391
1377
  if (o) {
1392
1378
  const c = e + n;
1393
- if (c >= r) {
1394
- const m = K(
1395
- c,
1396
- r,
1397
- d - p
1398
- );
1379
+ if (c >= a) {
1380
+ const m = K(c, a, d - p);
1399
1381
  return { leading: m, length: d - m };
1400
1382
  }
1401
1383
  const u = K(
1402
- d + r - c,
1384
+ d + a - c,
1403
1385
  d,
1404
1386
  l
1405
1387
  );
1406
- return { leading: r, length: u - r };
1388
+ return { leading: a, length: u - a };
1407
1389
  }
1408
1390
  if (i) {
1409
1391
  const c = d + n;
@@ -1417,54 +1399,57 @@ function Tn({
1417
1399
  }
1418
1400
  const u = K(
1419
1401
  e - (c - l),
1420
- r,
1402
+ a,
1421
1403
  e
1422
1404
  );
1423
1405
  return { leading: u, length: l - u };
1424
1406
  }
1425
1407
  return { leading: e, length: t };
1426
1408
  }
1427
- function dt(e, t = !0) {
1409
+ function ct(e, t = !0) {
1428
1410
  const n = Y();
1429
1411
  if (e.classList.contains("pluno-pa-widget--minimized"))
1430
- return { width: En, height: En };
1412
+ return e.classList.contains("pluno-pa-widget--scribble") ? {
1413
+ width: Hi,
1414
+ height: Wi
1415
+ } : { width: Tn, height: Tn };
1431
1416
  const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1432
1417
  return {
1433
- width: t && i && o.width > 0 ? o.width : Math.min(Qn, n.width - 36),
1434
- height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Ti : 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
1435
1420
  };
1436
1421
  }
1437
- function Xi() {
1422
+ function pa() {
1438
1423
  const e = Y();
1439
1424
  return {
1440
1425
  width: Math.min(
1441
1426
  K(
1442
- e.width * zi,
1443
- Jt,
1444
- Di
1427
+ e.width * ji,
1428
+ tn,
1429
+ qi
1445
1430
  ),
1446
1431
  e.width - I * 2
1447
1432
  ),
1448
1433
  height: Math.min(
1449
1434
  K(
1450
- e.height * Mi,
1451
- Qt,
1452
- Ri
1435
+ e.height * Ki,
1436
+ nn,
1437
+ Vi
1453
1438
  ),
1454
- e.height - Ce - I
1439
+ e.height - Se - I
1455
1440
  )
1456
1441
  };
1457
1442
  }
1458
1443
  function ze(e = null) {
1459
- return e ? ut(e) : Xi();
1444
+ return e ? gt(e) : pa();
1460
1445
  }
1461
- function ut(e) {
1446
+ function gt(e) {
1462
1447
  const t = Y();
1463
1448
  return {
1464
1449
  width: K(
1465
1450
  e.width,
1466
1451
  Math.min(
1467
- Jt,
1452
+ tn,
1468
1453
  t.width - I * 2
1469
1454
  ),
1470
1455
  Math.max(
@@ -1475,54 +1460,54 @@ function ut(e) {
1475
1460
  height: K(
1476
1461
  e.height,
1477
1462
  Math.min(
1478
- Qt,
1479
- t.height - Ce - I
1463
+ nn,
1464
+ t.height - Se - I
1480
1465
  ),
1481
1466
  Math.max(
1482
1467
  I,
1483
- t.height - Ce - I
1468
+ t.height - Se - I
1484
1469
  )
1485
1470
  )
1486
1471
  };
1487
1472
  }
1488
- function Nt(e, t) {
1473
+ function Rt(e, t) {
1489
1474
  if (!t) {
1490
1475
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1491
1476
  return;
1492
1477
  }
1493
- const n = ut(t);
1478
+ const n = gt(t);
1494
1479
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1495
1480
  }
1496
- function Zi(e, t, n) {
1481
+ function sa(e, t, n) {
1497
1482
  const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1498
1483
  if (Number.isFinite(o) && Number.isFinite(i))
1499
1484
  return { x: o, y: i };
1500
- const r = e.getBoundingClientRect();
1501
- if (r.width > 0 || r.height > 0)
1502
- 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 };
1503
1488
  const l = Y();
1504
1489
  return {
1505
1490
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1506
1491
  y: l.height - 24 - n.height
1507
1492
  };
1508
1493
  }
1509
- function Tt(e, t, n) {
1510
- const o = dt(e, !1);
1511
- return t ? Vt(
1494
+ function zt(e, t, n) {
1495
+ const o = ct(e, !1);
1496
+ return t ? Xt(
1512
1497
  e,
1513
- ro(t, o),
1498
+ go(t, o),
1514
1499
  o
1515
- ) : Ji(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Ni);
1500
+ ) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
1516
1501
  }
1517
- function Ji(e, t, n) {
1502
+ function da(e, t, n) {
1518
1503
  const o = Y();
1519
1504
  return {
1520
1505
  x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1521
1506
  y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1522
1507
  };
1523
1508
  }
1524
- function Vt(e, t, n) {
1525
- const o = Y(), i = I + ta(e);
1509
+ function Xt(e, t, n) {
1510
+ const o = Y(), i = I + ga(e);
1526
1511
  return {
1527
1512
  x: K(
1528
1513
  t.x,
@@ -1542,36 +1527,36 @@ function Vt(e, t, n) {
1542
1527
  )
1543
1528
  };
1544
1529
  }
1545
- function ro(e, t) {
1530
+ function go(e, t) {
1546
1531
  const n = Y();
1547
1532
  return {
1548
1533
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1549
1534
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1550
1535
  };
1551
1536
  }
1552
- function Qi(e, t) {
1553
- const n = ea(e, t), o = Y();
1537
+ function ca(e, t) {
1538
+ const n = ua(e, t), o = Y();
1554
1539
  return {
1555
1540
  anchor: n,
1556
1541
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1557
1542
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1558
1543
  };
1559
1544
  }
1560
- function ea(e, t) {
1561
- 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";
1562
- 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}`;
1563
1548
  }
1564
- function ta(e) {
1565
- return e.classList.contains("pluno-pa-widget--scribble") ? Fi : Ui;
1549
+ function ga(e) {
1550
+ return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
1566
1551
  }
1567
- function Dt(e, t, n, o = null) {
1568
- const i = dt(e), r = ze(o), l = {
1569
- x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1570
- 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
1571
1556
  };
1572
- return lt(l, r);
1557
+ return pt(l, a);
1573
1558
  }
1574
- function lt(e, t) {
1559
+ function pt(e, t) {
1575
1560
  const n = Y();
1576
1561
  return {
1577
1562
  x: K(
@@ -1584,34 +1569,34 @@ function lt(e, t) {
1584
1569
  ),
1585
1570
  y: K(
1586
1571
  e.y,
1587
- Ce,
1572
+ Se,
1588
1573
  Math.max(
1589
- Ce,
1574
+ Se,
1590
1575
  n.height - t.height - I
1591
1576
  )
1592
1577
  )
1593
1578
  };
1594
1579
  }
1595
- function ve(e, t) {
1580
+ function Ce(e, t) {
1596
1581
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1597
1582
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1598
1583
  return;
1599
1584
  }
1600
1585
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1601
1586
  }
1602
- function na(e, t) {
1587
+ function ha(e, t) {
1603
1588
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1604
1589
  }
1605
- function Dn(e) {
1590
+ function Un(e) {
1606
1591
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1607
1592
  }
1608
1593
  function Y() {
1609
1594
  return {
1610
- width: window.innerWidth || document.documentElement.clientWidth || Qn + I * 2,
1611
- 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
1612
1597
  };
1613
1598
  }
1614
- function zt(e) {
1599
+ function Ot(e) {
1615
1600
  const t = e.getBoundingClientRect();
1616
1601
  return {
1617
1602
  x: Math.round(t.x),
@@ -1631,46 +1616,46 @@ function J(e, t, n) {
1631
1616
  source: e,
1632
1617
  message: t,
1633
1618
  details: n
1634
- }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1635
- r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1636
- 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 })
1637
1622
  );
1638
1623
  }
1639
- function oa(e, t) {
1624
+ function ma(e, t) {
1640
1625
  J("web-sdk.widget.position", e, t);
1641
1626
  }
1642
- function Rt(e, t, n) {
1627
+ function Ut(e, t, n) {
1643
1628
  const o = t.value.trim();
1644
1629
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1645
- attachments: n.length > 0 ? n.map(ra) : void 0
1630
+ attachments: n.length > 0 ? n.map(ba) : void 0
1646
1631
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1647
1632
  }
1648
- function ia(e, t, n) {
1633
+ function fa(e, t, n) {
1649
1634
  const o = e.activeElement;
1650
1635
  return o === n ? "composer" : o === t ? "launcher" : null;
1651
1636
  }
1652
- function aa(e, t, n, o) {
1653
- 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)
1654
1639
  return;
1655
1640
  const i = e.focusedInput === "composer" ? o : n;
1656
1641
  i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1657
1642
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1658
1643
  });
1659
1644
  }
1660
- function ra(e) {
1645
+ function ba(e) {
1661
1646
  return e;
1662
1647
  }
1663
- function je(e) {
1648
+ function Ve(e) {
1664
1649
  e.style.height = "0px";
1665
1650
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1666
1651
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1667
1652
  }
1668
- function Ve(e, t = () => !0) {
1653
+ function Ke(e, t = () => !0) {
1669
1654
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1670
1655
  t() && (e.scrollTop = e.scrollHeight);
1671
1656
  });
1672
1657
  }
1673
- function la(e) {
1658
+ function _a(e) {
1674
1659
  const t = e.messages[e.messages.length - 1];
1675
1660
  return [
1676
1661
  e.messages.length,
@@ -1681,13 +1666,13 @@ function la(e) {
1681
1666
  e.lastError ?? ""
1682
1667
  ].join(":");
1683
1668
  }
1684
- function pa(e) {
1669
+ function xa(e) {
1685
1670
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1686
1671
  }
1687
- function sa(e) {
1672
+ function ya(e) {
1688
1673
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1689
1674
  }
1690
- function da(e) {
1675
+ function va(e) {
1691
1676
  const t = e.currentPage;
1692
1677
  if (typeof t?.url == "string" && t.url.trim())
1693
1678
  try {
@@ -1698,7 +1683,7 @@ function da(e) {
1698
1683
  }
1699
1684
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1700
1685
  }
1701
- function ca(e, t) {
1686
+ function Ca(e, t) {
1702
1687
  const n = new Date(e).getTime();
1703
1688
  if (!Number.isFinite(n))
1704
1689
  return "now";
@@ -1707,103 +1692,103 @@ function ca(e, t) {
1707
1692
  ["hour", 36e5],
1708
1693
  ["min", 6e4]
1709
1694
  ];
1710
- for (const [r, l] of i)
1695
+ for (const [a, l] of i)
1711
1696
  if (o >= l) {
1712
1697
  const p = Math.max(1, Math.floor(o / l));
1713
- return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1698
+ return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
1714
1699
  }
1715
1700
  return "now";
1716
1701
  }
1717
- function ua(e, t, n, o, i) {
1718
- e.appendChild(ya()), e.appendChild(
1719
- ga(
1702
+ function Sa(e, t, n, o, i) {
1703
+ e.appendChild(Da()), e.appendChild(
1704
+ Ea(
1720
1705
  t,
1721
1706
  n,
1722
1707
  o,
1723
1708
  i
1724
1709
  )
1725
1710
  ), e.appendChild(
1726
- gt(
1711
+ ht(
1727
1712
  "pluno-pa-widget__close",
1728
1713
  "Close",
1729
- va(16),
1714
+ Ra(16),
1730
1715
  !0
1731
1716
  )
1732
- ), e.appendChild(ha(n));
1717
+ ), e.appendChild(ka(n));
1733
1718
  }
1734
- function ga(e, t, n, o) {
1719
+ function Ea(e, t, n, o) {
1735
1720
  const i = document.createElement("form");
1736
1721
  if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1737
1722
  const d = document.createElement("button");
1738
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);
1739
1724
  }
1740
1725
  i.appendChild(
1741
- co(
1726
+ wo(
1742
1727
  "pluno-pa-widget__scribble-spirals--launcher",
1743
1728
  10
1744
1729
  )
1745
1730
  ), i.appendChild(
1746
- me(
1731
+ fe(
1747
1732
  "pluno-pa-widget__character--launcher",
1748
1733
  t
1749
1734
  )
1750
1735
  );
1751
- const r = document.createElement("span");
1752
- 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);
1753
1738
  const l = document.createElement("input");
1754
1739
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1755
- const p = ct("Working...");
1740
+ const p = ut("Working...");
1756
1741
  if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1757
1742
  const d = document.createElement("button");
1758
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);
1759
1744
  }
1760
1745
  return i;
1761
1746
  }
1762
- function ha(e) {
1747
+ function ka(e) {
1763
1748
  const t = document.createElement("section");
1764
1749
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1765
- co("pluno-pa-widget__scribble-spirals--panel", 16)
1750
+ wo("pluno-pa-widget__scribble-spirals--panel", 16)
1766
1751
  );
1767
1752
  const n = document.createElement("div");
1768
1753
  n.className = "pluno-pa-widget__timeline-wrap";
1769
1754
  const o = document.createElement("main");
1770
- o.className = "pluno-pa-widget__timeline", o.appendChild(ba(e));
1755
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
1771
1756
  const i = document.createElement("div");
1772
1757
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1773
- const r = document.createElement("div");
1774
- 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);
1775
1760
  const l = document.createElement("button");
1776
1761
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1777
1762
  const p = document.createElement("div");
1778
1763
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1779
- gt(
1764
+ ht(
1780
1765
  "pluno-pa-widget__history",
1781
- Kt(),
1782
- Sa(),
1766
+ Zt(),
1767
+ Ma(),
1783
1768
  !0
1784
1769
  )
1785
- ), n.appendChild(p), n.appendChild(wa()), t.appendChild(n), t.appendChild(ma()), t.appendChild(fa()), t.appendChild(he("left", "Resize Pluno from left")), t.appendChild(
1786
- he("right", "Resize Pluno from right")
1787
- ), t.appendChild(he("top", "Resize Pluno from top")), t.appendChild(
1788
- 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")
1789
1774
  ), t.appendChild(
1790
- he("top-left", "Resize Pluno from top left")
1775
+ me("top-left", "Resize Pluno from top left")
1791
1776
  ), t.appendChild(
1792
- he("top-right", "Resize Pluno from top right")
1777
+ me("top-right", "Resize Pluno from top right")
1793
1778
  ), t.appendChild(
1794
- he("bottom-left", "Resize Pluno from bottom left")
1779
+ me("bottom-left", "Resize Pluno from bottom left")
1795
1780
  ), t.appendChild(
1796
- he("bottom-right", "Resize Pluno from bottom right")
1781
+ me("bottom-right", "Resize Pluno from bottom right")
1797
1782
  ), t;
1798
1783
  }
1799
- function he(e, t) {
1784
+ function me(e, t) {
1800
1785
  const n = document.createElement("button");
1801
1786
  return n.type = "button", n.className = [
1802
1787
  "pluno-pa-widget__resize-handle",
1803
1788
  `pluno-pa-widget__resize-handle--${e}`
1804
1789
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1805
1790
  }
1806
- function ma() {
1791
+ function La() {
1807
1792
  const e = document.createElement("div");
1808
1793
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1809
1794
  const t = document.createElement("span");
@@ -1814,10 +1799,10 @@ function ma() {
1814
1799
  o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
1815
1800
  const i = document.createElement("button");
1816
1801
  i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
1817
- const r = document.createElement("button");
1818
- 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;
1819
1804
  }
1820
- function fa() {
1805
+ function Pa() {
1821
1806
  const e = document.createElement("form");
1822
1807
  e.className = "pluno-pa-widget__composer";
1823
1808
  const t = document.createElement("div");
@@ -1828,14 +1813,14 @@ function fa() {
1828
1813
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1829
1814
  const i = document.createElement("div");
1830
1815
  i.className = "pluno-pa-widget__composer-inner";
1831
- const r = document.createElement("input");
1832
- 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);
1833
1818
  const l = document.createElement("button");
1834
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ka()), l.appendChild(La()), 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);
1835
1820
  const p = document.createElement("textarea");
1836
1821
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1837
1822
  const d = document.createElement("button");
1838
- 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);
1839
1824
  const c = document.createElement("div");
1840
1825
  c.className = "pluno-pa-widget__composer-meta";
1841
1826
  const u = document.createElement("a");
@@ -1843,42 +1828,42 @@ function fa() {
1843
1828
  const m = document.createElement("span");
1844
1829
  return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1845
1830
  }
1846
- function Kt() {
1831
+ function Zt() {
1847
1832
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1848
1833
  }
1849
- function wa() {
1834
+ function Ia() {
1850
1835
  const e = document.createElement("section");
1851
- 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());
1852
1837
  const t = document.createElement("div");
1853
1838
  t.className = "pluno-pa-widget__history-header";
1854
1839
  const n = document.createElement("strong");
1855
- n.textContent = Kt();
1856
- const o = gt(
1840
+ n.textContent = Zt();
1841
+ const o = ht(
1857
1842
  "pluno-pa-widget__history-close",
1858
1843
  "Close recent chats",
1859
- Ea(),
1844
+ Oa(),
1860
1845
  !1
1861
1846
  );
1862
1847
  t.append(n, o);
1863
1848
  const i = document.createElement("div");
1864
1849
  i.className = "pluno-pa-widget__history-list";
1865
- const r = document.createElement("p");
1866
- 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;
1867
1852
  }
1868
- function ba(e) {
1853
+ function Ta(e) {
1869
1854
  const t = document.createElement("div");
1870
1855
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1871
- me(
1856
+ fe(
1872
1857
  "pluno-pa-widget__character--empty",
1873
1858
  e
1874
1859
  )
1875
- ), t.appendChild(lo()), t;
1860
+ ), t.appendChild(ho()), t;
1876
1861
  }
1877
- function lo() {
1862
+ function ho() {
1878
1863
  const e = document.createElement("div");
1879
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;
1880
1865
  }
1881
- function po(e, t) {
1866
+ function mo(e, t) {
1882
1867
  e.replaceChildren(), e.setAttribute(
1883
1868
  "aria-label",
1884
1869
  `${t.toLocaleString("en-US")} users currently active`
@@ -1890,17 +1875,17 @@ function po(e, t) {
1890
1875
  )
1891
1876
  );
1892
1877
  }
1893
- function me(e, t) {
1894
- const n = `pluno-pa-character-${Ln}`;
1895
- Ln += 1;
1896
- const o = t.scribbleStyle ? xa(t.accentColor, n) : _a(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);
1897
1882
  return o.setAttribute(
1898
1883
  "class",
1899
1884
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1900
1885
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1901
1886
  }
1902
- function _a(e, t) {
1903
- const n = Yo(e), o = {
1887
+ function Aa(e, t) {
1888
+ const n = ni(e), o = {
1904
1889
  boltFill: `${t}-boltFill`,
1905
1890
  boltEdge: `${t}-boltEdge`,
1906
1891
  boltGlow: `${t}-boltGlow`,
@@ -1911,7 +1896,7 @@ function _a(e, t) {
1911
1896
  eyeShadow: `${t}-eyeShadow`,
1912
1897
  pupilGloss: `${t}-pupilGloss`,
1913
1898
  boltClip: `${t}-boltClip`
1914
- }, i = so(), r = f(i, "defs"), l = f(r, "linearGradient", {
1899
+ }, i = fo(), a = f(i, "defs"), l = f(a, "linearGradient", {
1915
1900
  id: o.boltFill,
1916
1901
  x1: "420",
1917
1902
  y1: "180",
@@ -1920,7 +1905,7 @@ function _a(e, t) {
1920
1905
  gradientUnits: "userSpaceOnUse"
1921
1906
  });
1922
1907
  O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1923
- const p = f(r, "linearGradient", {
1908
+ const p = f(a, "linearGradient", {
1924
1909
  id: o.boltEdge,
1925
1910
  x1: "470",
1926
1911
  y1: "145",
@@ -1929,28 +1914,28 @@ function _a(e, t) {
1929
1914
  gradientUnits: "userSpaceOnUse"
1930
1915
  });
1931
1916
  O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1932
- const d = f(r, "radialGradient", {
1917
+ const d = f(a, "radialGradient", {
1933
1918
  id: o.boltGlow,
1934
1919
  cx: "50%",
1935
1920
  cy: "22%",
1936
1921
  r: "82%"
1937
1922
  });
1938
1923
  O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1939
- const c = f(r, "radialGradient", {
1924
+ const c = f(a, "radialGradient", {
1940
1925
  id: o.eyeWhite,
1941
1926
  cx: "35%",
1942
1927
  cy: "25%",
1943
1928
  r: "70%"
1944
1929
  });
1945
1930
  O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1946
- const u = f(r, "radialGradient", {
1931
+ const u = f(a, "radialGradient", {
1947
1932
  id: o.pupil,
1948
1933
  cx: "42%",
1949
1934
  cy: "38%",
1950
1935
  r: "65%"
1951
1936
  });
1952
1937
  O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1953
- const m = f(r, "filter", {
1938
+ const m = f(a, "filter", {
1954
1939
  id: o.softDropShadow,
1955
1940
  x: "-18%",
1956
1941
  y: "-12%",
@@ -1965,7 +1950,7 @@ function _a(e, t) {
1965
1950
  "flood-color": n.shadow,
1966
1951
  "flood-opacity": "0.24"
1967
1952
  });
1968
- const k = f(r, "filter", {
1953
+ const E = f(a, "filter", {
1969
1954
  id: o.innerDepth,
1970
1955
  x: "-8%",
1971
1956
  y: "-8%",
@@ -1973,32 +1958,32 @@ function _a(e, t) {
1973
1958
  height: "116%",
1974
1959
  "color-interpolation-filters": "sRGB"
1975
1960
  });
1976
- f(k, "feGaussianBlur", {
1961
+ f(E, "feGaussianBlur", {
1977
1962
  in: "SourceAlpha",
1978
1963
  stdDeviation: "8",
1979
1964
  result: "blur"
1980
- }), f(k, "feOffset", {
1965
+ }), f(E, "feOffset", {
1981
1966
  dx: "-7",
1982
1967
  dy: "-9",
1983
1968
  result: "topLeft"
1984
- }), f(k, "feComposite", {
1969
+ }), f(E, "feComposite", {
1985
1970
  in: "topLeft",
1986
1971
  in2: "SourceAlpha",
1987
1972
  operator: "arithmetic",
1988
1973
  k2: "-1",
1989
1974
  k3: "1",
1990
1975
  result: "innerShadow"
1991
- }), f(k, "feColorMatrix", {
1976
+ }), f(E, "feColorMatrix", {
1992
1977
  in: "innerShadow",
1993
1978
  type: "matrix",
1994
1979
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1995
1980
  result: "innerLight"
1996
- }), f(k, "feBlend", {
1981
+ }), f(E, "feBlend", {
1997
1982
  in: "SourceGraphic",
1998
1983
  in2: "innerLight",
1999
1984
  mode: "screen"
2000
1985
  });
2001
- const v = f(r, "filter", {
1986
+ const v = f(a, "filter", {
2002
1987
  id: o.eyeShadow,
2003
1988
  x: "-24%",
2004
1989
  y: "-20%",
@@ -2013,7 +1998,7 @@ function _a(e, t) {
2013
1998
  "flood-color": n.shadow,
2014
1999
  "flood-opacity": "0.3"
2015
2000
  });
2016
- const R = f(r, "filter", {
2001
+ const z = f(a, "filter", {
2017
2002
  id: o.pupilGloss,
2018
2003
  x: "-15%",
2019
2004
  y: "-15%",
@@ -2021,29 +2006,29 @@ function _a(e, t) {
2021
2006
  height: "130%",
2022
2007
  "color-interpolation-filters": "sRGB"
2023
2008
  });
2024
- f(R, "feDropShadow", {
2009
+ f(z, "feDropShadow", {
2025
2010
  dx: "0",
2026
2011
  dy: "3",
2027
2012
  stdDeviation: "3",
2028
2013
  "flood-color": "#000000",
2029
2014
  "flood-opacity": "0.22"
2030
2015
  });
2031
- const _ = f(r, "clipPath", { id: o.boltClip });
2032
- f(_, "path", { d: pt });
2016
+ const b = f(a, "clipPath", { id: o.boltClip });
2017
+ f(b, "path", { d: st });
2033
2018
  const g = f(i, "g", {
2034
2019
  filter: V(o.softDropShadow)
2035
2020
  });
2036
2021
  f(g, "path", {
2037
- d: pt,
2022
+ d: st,
2038
2023
  fill: V(o.boltEdge)
2039
2024
  });
2040
- 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";
2041
2026
  f(g, "path", {
2042
- d: b,
2027
+ d: w,
2043
2028
  fill: V(o.boltFill),
2044
2029
  filter: V(o.innerDepth)
2045
2030
  }), f(g, "path", {
2046
- d: b,
2031
+ d: w,
2047
2032
  fill: V(o.boltGlow),
2048
2033
  opacity: "0.74"
2049
2034
  });
@@ -2074,7 +2059,7 @@ function _a(e, t) {
2074
2059
  opacity: "0.48"
2075
2060
  });
2076
2061
  const P = f(i, "g", { filter: V(o.eyeShadow) });
2077
- return zn(
2062
+ return Bn(
2078
2063
  P,
2079
2064
  "rotate(-2 528 463)",
2080
2065
  "528",
@@ -2084,7 +2069,7 @@ function _a(e, t) {
2084
2069
  "557",
2085
2070
  "447",
2086
2071
  o
2087
- ), zn(
2072
+ ), Bn(
2088
2073
  P,
2089
2074
  "rotate(2 717 462)",
2090
2075
  "717",
@@ -2096,13 +2081,13 @@ function _a(e, t) {
2096
2081
  o
2097
2082
  ), i;
2098
2083
  }
2099
- function xa(e, t) {
2100
- const n = Kn(e), o = {
2084
+ function Na(e, t) {
2085
+ const n = Qn(e), o = {
2101
2086
  clip: `${t}-scribbleBoltClip`,
2102
2087
  wobble: `${t}-scribbleBoltWobble`
2103
- }, i = so(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2104
- f(l, "path", { d: pt });
2105
- 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", {
2106
2091
  id: o.wobble,
2107
2092
  x: "-10%",
2108
2093
  y: "-10%",
@@ -2127,7 +2112,7 @@ function xa(e, t) {
2127
2112
  "clip-path": V(o.clip)
2128
2113
  });
2129
2114
  return f(c, "path", {
2130
- d: Ko(),
2115
+ d: ti(),
2131
2116
  fill: "none",
2132
2117
  stroke: n,
2133
2118
  "stroke-width": "56",
@@ -2136,12 +2121,12 @@ function xa(e, t) {
2136
2121
  opacity: "0.9",
2137
2122
  transform: "rotate(-14 627 600)"
2138
2123
  }), f(d, "path", {
2139
- d: pt,
2124
+ d: st,
2140
2125
  fill: "none",
2141
- stroke: st,
2126
+ stroke: dt,
2142
2127
  "stroke-width": "18",
2143
2128
  "stroke-linejoin": "round"
2144
- }), Rn(
2129
+ }), Fn(
2145
2130
  d,
2146
2131
  "rotate(-2 528 463)",
2147
2132
  "528",
@@ -2150,7 +2135,7 @@ function xa(e, t) {
2150
2135
  "473",
2151
2136
  "557",
2152
2137
  "447"
2153
- ), Rn(
2138
+ ), Fn(
2154
2139
  d,
2155
2140
  "rotate(2 717 462)",
2156
2141
  "717",
@@ -2161,13 +2146,13 @@ function xa(e, t) {
2161
2146
  "447"
2162
2147
  ), i;
2163
2148
  }
2164
- function so() {
2165
- return E("svg", {
2166
- xmlns: to,
2149
+ function fo() {
2150
+ return S("svg", {
2151
+ xmlns: lo,
2167
2152
  viewBox: "0 0 1254 1254"
2168
2153
  });
2169
2154
  }
2170
- function zn(e, t, n, o, i, r, l, p, d) {
2155
+ function Bn(e, t, n, o, i, a, l, p, d) {
2171
2156
  const c = f(e, "g", { transform: t });
2172
2157
  f(c, "ellipse", {
2173
2158
  cx: n,
@@ -2177,7 +2162,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
2177
2162
  fill: V(d.eyeWhite)
2178
2163
  }), f(c, "ellipse", {
2179
2164
  cx: i,
2180
- cy: r,
2165
+ cy: a,
2181
2166
  rx: "49",
2182
2167
  ry: "57",
2183
2168
  fill: V(d.pupil),
@@ -2189,7 +2174,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
2189
2174
  fill: "#ffffff"
2190
2175
  });
2191
2176
  }
2192
- function Rn(e, t, n, o, i, r, l, p) {
2177
+ function Fn(e, t, n, o, i, a, l, p) {
2193
2178
  const d = f(e, "g", { transform: t });
2194
2179
  f(d, "ellipse", {
2195
2180
  cx: n,
@@ -2197,14 +2182,14 @@ function Rn(e, t, n, o, i, r, l, p) {
2197
2182
  rx: "73",
2198
2183
  ry: "80",
2199
2184
  fill: "#ffffff",
2200
- stroke: st,
2185
+ stroke: dt,
2201
2186
  "stroke-width": "13"
2202
2187
  }), f(d, "ellipse", {
2203
2188
  cx: i,
2204
- cy: r,
2189
+ cy: a,
2205
2190
  rx: "45",
2206
2191
  ry: "53",
2207
- fill: st
2192
+ fill: dt
2208
2193
  }), f(d, "circle", {
2209
2194
  cx: l,
2210
2195
  cy: p,
@@ -2213,7 +2198,7 @@ function Rn(e, t, n, o, i, r, l, p) {
2213
2198
  });
2214
2199
  }
2215
2200
  function f(e, t, n = {}) {
2216
- const o = E(t, n);
2201
+ const o = S(t, n);
2217
2202
  return e.appendChild(o), o;
2218
2203
  }
2219
2204
  function O(e, t, n, o) {
@@ -2223,61 +2208,61 @@ function O(e, t, n, o) {
2223
2208
  function V(e) {
2224
2209
  return `url(#${e})`;
2225
2210
  }
2226
- function gt(e, t, n, o) {
2211
+ function ht(e, t, n, o) {
2227
2212
  const i = document.createElement("button");
2228
2213
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2229
2214
  }
2230
- function ya() {
2231
- const e = E("svg", {
2215
+ function Da() {
2216
+ const e = S("svg", {
2232
2217
  class: "pluno-pa-widget__scribble-defs",
2233
2218
  "aria-hidden": "true",
2234
2219
  focusable: "false",
2235
2220
  width: "0",
2236
2221
  height: "0"
2237
- }), t = E("defs");
2238
- return t.appendChild(Ot("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2239
- 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")
2240
2225
  ), t.appendChild(
2241
- Ot("pluno-pa-scribble-wobble-3", "9", "19")
2226
+ Ft("pluno-pa-scribble-wobble-3", "9", "19")
2242
2227
  ), e.appendChild(t), e;
2243
2228
  }
2244
- function co(e, t) {
2245
- const n = E("svg", {
2229
+ function wo(e, t) {
2230
+ const n = S("svg", {
2246
2231
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2247
2232
  preserveAspectRatio: "xMidYMid meet",
2248
2233
  "aria-hidden": "true",
2249
2234
  focusable: "false"
2250
2235
  });
2251
- return uo(n, t), n;
2236
+ return bo(n, t), n;
2252
2237
  }
2253
- function Mt(e, t) {
2238
+ function Bt(e, t) {
2254
2239
  if (!e)
2255
2240
  return;
2256
2241
  const n = Math.max(
2257
2242
  0,
2258
- t - qt * 2
2243
+ t - Kt * 2
2259
2244
  ), o = Math.max(
2260
- Bi,
2245
+ Xi,
2261
2246
  Math.floor(
2262
- (n - $t * 2) / Gt
2247
+ (n - Vt * 2) / jt
2263
2248
  )
2264
2249
  );
2265
- uo(e, o);
2250
+ bo(e, o);
2266
2251
  }
2267
- function uo(e, t) {
2252
+ function bo(e, t) {
2268
2253
  if (e.dataset.spiralCount === `${t}`)
2269
2254
  return;
2270
- const n = t * Gt + $t * 2;
2255
+ const n = t * jt + Vt * 2;
2271
2256
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2272
2257
  "viewBox",
2273
- `0 0 ${n} ${Oi}`
2258
+ `0 0 ${n} ${Yi}`
2274
2259
  ), e.replaceChildren();
2275
2260
  for (let o = 0; o < t; o += 1) {
2276
- const i = kn[o % kn.length], r = E("g", {
2277
- transform: `translate(${$t + o * Gt} 0)`
2261
+ const i = An[o % An.length], a = S("g", {
2262
+ transform: `translate(${Vt + o * jt} 0)`
2278
2263
  });
2279
- r.appendChild(
2280
- E("ellipse", {
2264
+ a.appendChild(
2265
+ S("ellipse", {
2281
2266
  cx: i.ellipseCx,
2282
2267
  cy: i.ellipseCy,
2283
2268
  rx: i.ellipseRx,
@@ -2287,19 +2272,19 @@ function uo(e, t) {
2287
2272
  "stroke-width": i.strokeWidth,
2288
2273
  opacity: "0.8"
2289
2274
  })
2290
- ), r.appendChild(
2291
- E("path", {
2275
+ ), a.appendChild(
2276
+ S("path", {
2292
2277
  d: i.path,
2293
2278
  fill: "none",
2294
2279
  stroke: "#2c2a1e",
2295
2280
  "stroke-width": i.pathStrokeWidth,
2296
2281
  "stroke-linecap": "round"
2297
2282
  })
2298
- ), e.appendChild(r);
2283
+ ), e.appendChild(a);
2299
2284
  }
2300
2285
  }
2301
- function Ot(e, t, n) {
2302
- const o = E("filter", {
2286
+ function Ft(e, t, n) {
2287
+ const o = S("filter", {
2303
2288
  id: e,
2304
2289
  x: "-8%",
2305
2290
  y: "-8%",
@@ -2307,7 +2292,7 @@ function Ot(e, t, n) {
2307
2292
  height: "116%"
2308
2293
  });
2309
2294
  return o.appendChild(
2310
- E("feTurbulence", {
2295
+ S("feTurbulence", {
2311
2296
  type: "fractalNoise",
2312
2297
  baseFrequency: "0.012 0.028",
2313
2298
  numOctaves: "3",
@@ -2315,7 +2300,7 @@ function Ot(e, t, n) {
2315
2300
  result: "stroke-noise"
2316
2301
  })
2317
2302
  ), o.appendChild(
2318
- E("feDisplacementMap", {
2303
+ S("feDisplacementMap", {
2319
2304
  in: "SourceGraphic",
2320
2305
  in2: "stroke-noise",
2321
2306
  scale: "3.5",
@@ -2324,7 +2309,7 @@ function Ot(e, t, n) {
2324
2309
  result: "warped"
2325
2310
  })
2326
2311
  ), o.appendChild(
2327
- E("feTurbulence", {
2312
+ S("feTurbulence", {
2328
2313
  type: "fractalNoise",
2329
2314
  baseFrequency: "0.7",
2330
2315
  numOctaves: "1",
@@ -2332,7 +2317,7 @@ function Ot(e, t, n) {
2332
2317
  result: "ink-noise"
2333
2318
  })
2334
2319
  ), o.appendChild(
2335
- E("feDisplacementMap", {
2320
+ S("feDisplacementMap", {
2336
2321
  in: "warped",
2337
2322
  in2: "ink-noise",
2338
2323
  scale: "0.9",
@@ -2341,7 +2326,7 @@ function Ot(e, t, n) {
2341
2326
  })
2342
2327
  ), o;
2343
2328
  }
2344
- function va(e) {
2329
+ function Ra(e) {
2345
2330
  const t = re(
2346
2331
  "0 0 24 24",
2347
2332
  e,
@@ -2350,9 +2335,9 @@ function va(e) {
2350
2335
  "currentColor",
2351
2336
  "2.25"
2352
2337
  );
2353
- 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;
2354
2339
  }
2355
- function Ca() {
2340
+ function za() {
2356
2341
  const e = re(
2357
2342
  "0 0 24 24",
2358
2343
  17,
@@ -2362,16 +2347,16 @@ function Ca() {
2362
2347
  "2.25"
2363
2348
  );
2364
2349
  return e.appendChild(
2365
- E("path", {
2350
+ S("path", {
2366
2351
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2367
2352
  })
2368
2353
  ), e.appendChild(
2369
- E("path", {
2354
+ S("path", {
2370
2355
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2371
2356
  })
2372
2357
  ), e;
2373
2358
  }
2374
- function Sa() {
2359
+ function Ma() {
2375
2360
  const e = re(
2376
2361
  "0 0 24 24",
2377
2362
  17,
@@ -2380,9 +2365,9 @@ function Sa() {
2380
2365
  "currentColor",
2381
2366
  "2.25"
2382
2367
  );
2383
- 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;
2384
2369
  }
2385
- function Ea() {
2370
+ function Oa() {
2386
2371
  const e = re(
2387
2372
  "0 0 24 24",
2388
2373
  15,
@@ -2391,9 +2376,9 @@ function Ea() {
2391
2376
  "currentColor",
2392
2377
  "2.4"
2393
2378
  );
2394
- 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;
2395
2380
  }
2396
- function go() {
2381
+ function _o() {
2397
2382
  const e = re(
2398
2383
  "0 0 24 24",
2399
2384
  14,
@@ -2403,10 +2388,10 @@ function go() {
2403
2388
  "2.75"
2404
2389
  );
2405
2390
  return e.appendChild(
2406
- E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2407
- ), 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;
2408
2393
  }
2409
- function ka() {
2394
+ function Ua() {
2410
2395
  const e = re(
2411
2396
  "0 0 24 24",
2412
2397
  16,
@@ -2419,18 +2404,18 @@ function ka() {
2419
2404
  "class",
2420
2405
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2421
2406
  ), e.appendChild(
2422
- E("path", {
2407
+ S("path", {
2423
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"
2424
2409
  })
2425
2410
  ), e;
2426
2411
  }
2427
- function La() {
2412
+ function Ba() {
2428
2413
  const e = re("0 0 24 24", 19, 19, "none", "currentColor");
2429
2414
  return e.setAttribute(
2430
2415
  "class",
2431
2416
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2432
2417
  ), e.appendChild(
2433
- E("path", {
2418
+ S("path", {
2434
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",
2435
2420
  stroke: "currentColor",
2436
2421
  "stroke-width": "2",
@@ -2439,10 +2424,10 @@ function La() {
2439
2424
  })
2440
2425
  ), e;
2441
2426
  }
2442
- function Pa() {
2427
+ function Fa() {
2443
2428
  const e = re("0 0 24 24", 18, 18, "currentColor");
2444
2429
  return e.appendChild(
2445
- E("rect", {
2430
+ S("rect", {
2446
2431
  x: "6",
2447
2432
  y: "6",
2448
2433
  width: "12",
@@ -2451,7 +2436,7 @@ function Pa() {
2451
2436
  })
2452
2437
  ), e;
2453
2438
  }
2454
- function Ia() {
2439
+ function Ha() {
2455
2440
  const e = re(
2456
2441
  "0 0 24 24",
2457
2442
  12,
@@ -2460,9 +2445,9 @@ function Ia() {
2460
2445
  "currentColor",
2461
2446
  "2.4"
2462
2447
  );
2463
- 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;
2464
2449
  }
2465
- function Aa() {
2450
+ function Wa() {
2466
2451
  const e = re(
2467
2452
  "0 0 24 24",
2468
2453
  13,
@@ -2472,7 +2457,7 @@ function Aa() {
2472
2457
  "2.25"
2473
2458
  );
2474
2459
  return e.appendChild(
2475
- E("rect", {
2460
+ S("rect", {
2476
2461
  width: "14",
2477
2462
  height: "14",
2478
2463
  x: "8",
@@ -2481,12 +2466,12 @@ function Aa() {
2481
2466
  ry: "2"
2482
2467
  })
2483
2468
  ), e.appendChild(
2484
- E("path", {
2469
+ S("path", {
2485
2470
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2486
2471
  })
2487
2472
  ), e;
2488
2473
  }
2489
- function re(e, t, n, o, i, r) {
2474
+ function re(e, t, n, o, i, a) {
2490
2475
  const l = {
2491
2476
  viewBox: e,
2492
2477
  width: String(t),
@@ -2494,188 +2479,165 @@ function re(e, t, n, o, i, r) {
2494
2479
  fill: o,
2495
2480
  "aria-hidden": "true"
2496
2481
  };
2497
- 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);
2498
2483
  }
2499
- function E(e, t = {}) {
2500
- const n = document.createElementNS(to, e);
2484
+ function S(e, t = {}) {
2485
+ const n = document.createElementNS(lo, e);
2501
2486
  for (const [o, i] of Object.entries(t))
2502
2487
  n.setAttribute(o, i);
2503
2488
  return n;
2504
2489
  }
2505
- function Mn(e) {
2490
+ function Hn(e) {
2506
2491
  for (const t of ["keydown", "keypress", "keyup"])
2507
2492
  e.addEventListener(t, (n) => {
2508
2493
  n.stopPropagation();
2509
2494
  });
2510
2495
  }
2511
- function Na(e, t, n) {
2496
+ function Ga(e, t, n) {
2512
2497
  e.replaceChildren(), e.hidden = t.length === 0;
2513
2498
  for (const [o, i] of t.entries()) {
2514
- const r = document.createElement("div");
2515
- r.className = "pluno-pa-widget__attachment", r.appendChild(Ta(i));
2499
+ const a = document.createElement("div");
2500
+ a.className = "pluno-pa-widget__attachment", a.appendChild($a(i));
2516
2501
  const l = document.createElement("span");
2517
- l.textContent = i.name, r.appendChild(l);
2502
+ l.textContent = i.name, a.appendChild(l);
2518
2503
  const p = document.createElement("button");
2519
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ia()), 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);
2520
2505
  }
2521
2506
  }
2522
- function Ta(e) {
2523
- const t = en(e), n = ho(e);
2507
+ function $a(e) {
2508
+ const t = on(e), n = xo(e);
2524
2509
  if (t === "image" && n) {
2525
2510
  const o = document.createElement("img");
2526
- return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener(
2527
- "error",
2528
- () => o.replaceWith(ie(e))
2529
- ), o;
2511
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
2530
2512
  }
2531
2513
  if (t === "video" && n) {
2532
2514
  const o = document.createElement("video");
2533
- return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener(
2534
- "error",
2535
- () => o.replaceWith(ie(e))
2536
- ), o.addEventListener(
2537
- "stalled",
2538
- () => o.replaceWith(ie(e))
2539
- ), o;
2515
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o.addEventListener("stalled", () => o.replaceWith(ie(e))), o;
2540
2516
  }
2541
2517
  return ie(e);
2542
2518
  }
2543
- function Da(e) {
2544
- const t = en(e), n = ho(e);
2519
+ function qa(e) {
2520
+ const t = on(e), n = xo(e);
2545
2521
  if (t === "image" && n) {
2546
2522
  const o = document.createElement("img");
2547
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener(
2548
- "error",
2549
- () => o.replaceWith(ie(e, "message"))
2550
- ), o;
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;
2551
2524
  }
2552
2525
  if (t === "pdf" && n) {
2553
2526
  const o = document.createElement("object");
2554
- return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener(
2555
- "error",
2556
- () => o.replaceWith(
2557
- ie(e, "message")
2558
- )
2559
- ), o.appendChild(ie(e, "message")), o;
2527
+ return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.appendChild(ie(e, "message")), o;
2560
2528
  }
2561
2529
  if (t === "video" && n) {
2562
2530
  const o = document.createElement("video");
2563
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener(
2564
- "error",
2565
- () => o.replaceWith(ie(e, "message"))
2566
- ), o.addEventListener(
2567
- "stalled",
2568
- () => o.replaceWith(ie(e, "message"))
2569
- ), o;
2531
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ie(e, "message"))), o;
2570
2532
  }
2571
2533
  return ie(e, "message");
2572
2534
  }
2573
2535
  function ie(e, t = "composer") {
2574
2536
  if (t === "composer") {
2575
- const r = document.createElement("span");
2576
- 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;
2577
2539
  }
2578
2540
  const n = document.createElement("div");
2579
2541
  n.className = "pluno-pa-widget__message-attachment-file";
2580
2542
  const o = document.createElement("span");
2581
- o.textContent = On(e);
2543
+ o.textContent = Wn(e);
2582
2544
  const i = document.createElement("strong");
2583
2545
  return i.textContent = e.name, n.append(o, i), n;
2584
2546
  }
2585
- function en(e) {
2547
+ function on(e) {
2586
2548
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2587
2549
  }
2588
- function ho(e) {
2550
+ function xo(e) {
2589
2551
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2590
2552
  }
2591
- function On(e) {
2592
- const t = en(e);
2553
+ function Wn(e) {
2554
+ const t = on(e);
2593
2555
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2594
2556
  }
2595
- function za(e, t) {
2557
+ function ja(e, t) {
2596
2558
  return t ? Array.from(t).map((o) => ({
2597
2559
  ...e.createLocalAttachment(o),
2598
- previewUrl: Ra(o)
2560
+ previewUrl: Va(o)
2599
2561
  })) : [];
2600
2562
  }
2601
- function Ra(e) {
2563
+ function Va(e) {
2602
2564
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2603
2565
  }
2604
- function it(e) {
2566
+ function at(e) {
2605
2567
  return !!(e && Array.from(e.types).includes("Files"));
2606
2568
  }
2607
- function Bt(e, t, n = null) {
2608
- if (!e || !Yt(t, n)) {
2569
+ function Ht(e, t, n = null) {
2570
+ if (!e || !Jt(t, n)) {
2609
2571
  e && (e.hidden = !0, e.replaceChildren());
2610
2572
  return;
2611
2573
  }
2612
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || tn(n) ? e.appendChild(
2613
- Ma(t, n)
2614
- ) : mo(t) && e.appendChild(Oa(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));
2615
2577
  }
2616
- function Ma(e, t) {
2578
+ function Ka(e, t) {
2617
2579
  const n = document.createElement("div");
2618
2580
  n.className = "pluno-pa-widget__billing-action-card";
2619
2581
  const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2620
2582
  i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2621
- const r = document.createElement("span");
2622
- 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(
2623
- 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(
2624
2586
  e,
2625
2587
  "Upgrade plan",
2626
2588
  "pluno-pa-widget__billing-action-card-actions"
2627
2589
  )
2628
2590
  ), n;
2629
2591
  }
2630
- function Oa(e) {
2592
+ function Ya(e) {
2631
2593
  const t = document.createElement("div");
2632
2594
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2633
2595
  const n = document.createElement("strong");
2634
2596
  n.textContent = "Credits running low", t.appendChild(n);
2635
2597
  const o = document.createElement("span");
2636
- return o.textContent = Ua(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2637
- fo(
2598
+ return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2599
+ vo(
2638
2600
  e,
2639
2601
  "Upgrade",
2640
2602
  "pluno-pa-widget__billing-action-card-actions"
2641
2603
  )
2642
2604
  ), t;
2643
2605
  }
2644
- function Yt(e, t) {
2645
- return e !== null && (ae(e) || mo(e) || tn(t));
2606
+ function Jt(e, t) {
2607
+ return e !== null && (ae(e) || yo(e) || an(t));
2646
2608
  }
2647
- function Bn(e, t, n) {
2648
- return Yt(t, n) || Ba(t) ? !0 : !Yt(e, n);
2609
+ function Gn(e, t, n) {
2610
+ return Jt(t, n) || Xa(t) ? !0 : !Jt(e, n);
2649
2611
  }
2650
- function Ba(e) {
2612
+ function Xa(e) {
2651
2613
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
2652
2614
  }
2653
2615
  function ae(e) {
2654
2616
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2655
2617
  }
2656
- function tn(e) {
2618
+ function an(e) {
2657
2619
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2658
2620
  }
2659
- function mo(e) {
2621
+ function yo(e) {
2660
2622
  return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2661
2623
  }
2662
- function Ua(e) {
2663
- return e.creditsRemaining === null ? null : `${Fa(e.creditsRemaining)} credits left`;
2624
+ function Za(e) {
2625
+ return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
2664
2626
  }
2665
- function Fa(e) {
2627
+ function Ja(e) {
2666
2628
  return new Intl.NumberFormat("en-US", {
2667
2629
  maximumFractionDigits: 0
2668
2630
  }).format(Math.ceil(e));
2669
2631
  }
2670
- function fo(e, t, n) {
2632
+ function vo(e, t, n) {
2671
2633
  const o = document.createElement("div");
2672
2634
  return o.className = n, o.appendChild(
2673
- Un(t, e.pricingUrl)
2635
+ $n(t, e.pricingUrl)
2674
2636
  ), o.appendChild(
2675
- Un("Earn credits", e.earnCreditsUrl)
2637
+ $n("Earn credits", e.earnCreditsUrl)
2676
2638
  ), o;
2677
2639
  }
2678
- function Un(e, t) {
2640
+ function $n(e, t) {
2679
2641
  const n = document.createElement("button");
2680
2642
  if (n.type = "button", e === "Earn credits") {
2681
2643
  const o = document.createElement("span");
@@ -2686,137 +2648,123 @@ function Un(e, t) {
2686
2648
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2687
2649
  }), n;
2688
2650
  }
2689
- function Ut(e, t) {
2651
+ function Wt(e, t) {
2690
2652
  return e.messages.filter(
2691
- (o) => !wo(o)
2653
+ (o) => !Co(o)
2692
2654
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2693
2655
  }
2694
- function Ha(e, t, n, o, i, r, l, p, d, c, u, m, k, v, R, _) {
2695
- const g = qa(r), b = g.filter(
2696
- (C) => !wo(C)
2697
- ), 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) => {
2698
2660
  P.push(C);
2699
2661
  };
2700
- _o(n, r.isThinking), i.hidden = !p, p && l !== null && po(i, l);
2701
- const F = b.length > 0 || !!r.assistantDraft || r.isThinking;
2702
- 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) {
2703
2665
  const C = document.createElement("div");
2704
2666
  C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2705
- const T = document.createElement("div");
2706
- T.className = "pluno-pa-widget__empty-hero";
2707
- const Se = me(
2667
+ const N = document.createElement("div");
2668
+ N.className = "pluno-pa-widget__empty-hero";
2669
+ const Ee = fe(
2708
2670
  "pluno-pa-widget__character--empty",
2709
2671
  v()
2710
2672
  );
2711
- T.appendChild(Se), C.appendChild(T), C.appendChild(lo());
2673
+ N.appendChild(Ee), C.appendChild(N), C.appendChild(ho());
2712
2674
  const q = document.createElement("div");
2713
- 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)
2714
- for (const z 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) {
2715
2677
  const D = document.createElement("button");
2716
- D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${z}"`, D.addEventListener("click", () => {
2717
- R(z);
2678
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
2679
+ z(R);
2718
2680
  }), q.appendChild(D);
2719
2681
  }
2720
- else if (r.starterPromptsLoading) {
2721
- const z = document.createElement("button");
2722
- z.type = "button", z.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", z.disabled = !0, z.tabIndex = -1, z.textContent = "Generating example tasks...", q.appendChild(z);
2682
+ else if (a.starterPromptsLoading) {
2683
+ const R = document.createElement("button");
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);
2723
2685
  } else
2724
- for (let z = 0; z < Ei; z += 1) {
2686
+ for (let R = 0; R < zi; R += 1) {
2725
2687
  const D = document.createElement("button");
2726
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);
2727
2689
  }
2728
- 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);
2729
2691
  return;
2730
2692
  }
2731
2693
  let H = null, $ = null, Q = [];
2732
- const Re = b.some(Xt), x = () => {
2694
+ const Me = w.some(Qt), x = () => {
2733
2695
  if (Q.length === 0)
2734
2696
  return !1;
2735
- const C = tr(
2697
+ const C = gr(
2736
2698
  Q,
2737
2699
  u,
2738
- k,
2700
+ E,
2739
2701
  v()
2740
2702
  );
2741
- return L(C), H = null, $ = C, Q = [], !0;
2703
+ return k(C), H = null, $ = C, Q = [], !0;
2742
2704
  };
2743
- for (let C = 0; C < b.length; C += 1) {
2744
- const T = b[C];
2745
- if (T.role === "tool") {
2746
- 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);
2747
2709
  continue;
2748
2710
  }
2749
- if (Xt(T)) {
2711
+ if (Qt(N)) {
2750
2712
  if (x()) {
2751
- const N = ct();
2752
- L(N), H = null, $ = N;
2713
+ const A = ut();
2714
+ k(A), H = null, $ = A;
2753
2715
  } else {
2754
- const N = Gn(v());
2755
- L(N), H = null, $ = N;
2716
+ const A = Kn(v());
2717
+ k(A), H = null, $ = A;
2756
2718
  }
2757
2719
  continue;
2758
2720
  }
2759
- if (T.role === "system")
2721
+ if (N.role === "system")
2760
2722
  continue;
2761
- const Se = x(), q = er(T.content);
2762
- if (T.role === "assistant" && !Se) {
2763
- const D = bo(v());
2764
- L(D), H = null, $ = D;
2765
- }
2766
- const z = Wa(
2767
- T,
2768
- q,
2769
- m,
2770
- A
2771
- );
2772
- L(z), H = z, $ = null;
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;
2727
+ }
2728
+ const R = er(N, q, m, T);
2729
+ k(R), H = R, $ = null;
2773
2730
  }
2774
- const de = x(), Ye = b[b.length - 1]?.id === "assistant-draft";
2775
- if (r.isThinking && !Ye && !Re)
2776
- if (de) {
2777
- const C = ct();
2778
- 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;
2779
2736
  } else {
2780
- const C = Gn(v());
2781
- L(C), H = null, $ = C;
2737
+ const C = Kn(v());
2738
+ k(C), H = null, $ = C;
2782
2739
  }
2783
- if (r.lastError) {
2740
+ if (a.lastError) {
2784
2741
  const C = document.createElement("div");
2785
- 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;
2786
2743
  }
2787
- const X = _ && !r.isThinking ? Qo(g) : null;
2788
- if (_ && X && !_.dismissedCandidateIds.has(X.id)) {
2789
- const C = Ka(X, {
2790
- isDrafting: _.draftingCandidateId === X.id,
2791
- error: _.error,
2792
- characterIconOptions: _.characterIconOptions,
2793
- onDraft: _.onDraft,
2794
- onDismiss: _.onDismiss,
2795
- 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
2796
2753
  });
2797
- L(C), _.onSeen(X), H = null, $ = C;
2754
+ k(C), b.onSeen(X), H = null, $ = C;
2798
2755
  }
2799
- H?.classList.add(
2800
- "pluno-pa-widget__message--bottom-reserve"
2801
- ), $?.classList.add(
2802
- "pluno-pa-widget__bottom-reserve-compact"
2803
- ), L(t), $a(
2804
- m,
2805
- A
2806
- ), Fn(e, P), d ? Ve(e, c) : e.scrollTop = h;
2807
- }
2808
- function Wa(e, t, n, o) {
2809
- const i = Ga(e, t), r = i ? n.get(i) : void 0;
2810
- if (i && r)
2811
- return r.classList.remove(
2812
- "pluno-pa-widget__message--bottom-reserve"
2813
- ), o.add(i), r;
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;
2757
+ }
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;
2814
2762
  const l = document.createElement("div");
2815
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? or(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ja(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));
2816
2764
  const p = document.createElement("div");
2817
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Va(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;
2818
2766
  }
2819
- function Ga(e, t) {
2767
+ function tr(e, t) {
2820
2768
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2821
2769
  id: e.id,
2822
2770
  content: t,
@@ -2834,11 +2782,11 @@ function Ga(e, t) {
2834
2782
  })
2835
2783
  });
2836
2784
  }
2837
- function $a(e, t) {
2785
+ function nr(e, t) {
2838
2786
  for (const n of e.keys())
2839
2787
  t.has(n) || e.delete(n);
2840
2788
  }
2841
- function Fn(e, t) {
2789
+ function qn(e, t) {
2842
2790
  let n = e.firstChild;
2843
2791
  for (const o of t) {
2844
2792
  if (o === n) {
@@ -2852,7 +2800,7 @@ function Fn(e, t) {
2852
2800
  n = n.nextSibling, e.removeChild(o);
2853
2801
  }
2854
2802
  }
2855
- function qa(e) {
2803
+ function or(e) {
2856
2804
  if (!e.assistantDraft)
2857
2805
  return [...e.messages];
2858
2806
  const t = {
@@ -2867,12 +2815,12 @@ function qa(e) {
2867
2815
  if (!t.respondsToUserMessageId)
2868
2816
  return [...e.messages, t];
2869
2817
  const n = e.messages.findIndex(
2870
- (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2818
+ (a) => a.role === "user" && a.id === t.respondsToUserMessageId
2871
2819
  );
2872
2820
  if (n === -1)
2873
2821
  return [...e.messages, t];
2874
2822
  const o = e.messages.findIndex(
2875
- (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)
2876
2824
  );
2877
2825
  if (o !== -1)
2878
2826
  return [
@@ -2881,7 +2829,7 @@ function qa(e) {
2881
2829
  ...e.messages.slice(o + 1)
2882
2830
  ];
2883
2831
  let i = n + 1;
2884
- 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); )
2885
2833
  i += 1;
2886
2834
  return [
2887
2835
  ...e.messages.slice(0, i),
@@ -2889,17 +2837,17 @@ function qa(e) {
2889
2837
  ...e.messages.slice(i)
2890
2838
  ];
2891
2839
  }
2892
- function Xt(e) {
2840
+ function Qt(e) {
2893
2841
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2894
2842
  }
2895
- function Hn(e, t) {
2843
+ function jn(e, t) {
2896
2844
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2897
2845
  }
2898
- function Wn(e, t, n, o, i, r, l, p) {
2899
- 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);
2900
2848
  const d = document.createElement("div");
2901
2849
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2902
- const c = me(
2850
+ const c = fe(
2903
2851
  "pluno-pa-widget__character--empty",
2904
2852
  o()
2905
2853
  );
@@ -2907,40 +2855,40 @@ function Wn(e, t, n, o, i, r, l, p) {
2907
2855
  const u = document.createElement("div");
2908
2856
  if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2909
2857
  const m = document.createElement("a");
2910
- 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);
2911
2859
  } else {
2912
2860
  const m = document.createElement("button");
2913
- 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);
2914
2862
  }
2915
2863
  e.appendChild(d);
2916
2864
  }
2917
- function ja(e) {
2865
+ function ir(e) {
2918
2866
  const t = document.createElement("div");
2919
2867
  t.className = "pluno-pa-widget__message-attachments";
2920
2868
  for (const n of e)
2921
- t.appendChild(Da(n));
2869
+ t.appendChild(qa(n));
2922
2870
  return t;
2923
2871
  }
2924
- function Va(e) {
2872
+ function ar(e) {
2925
2873
  const t = document.createElement("button");
2926
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Aa()), 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) => {
2927
2875
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2928
2876
  }), t;
2929
2877
  }
2930
- function Ka(e, t) {
2878
+ function rr(e, t) {
2931
2879
  const n = document.createElement("article");
2932
2880
  n.className = "pluno-pa-widget__share-prompt";
2933
2881
  const o = document.createElement("div");
2934
2882
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2935
- me(
2883
+ fe(
2936
2884
  "pluno-pa-widget__share-prompt-icon",
2937
2885
  t.characterIconOptions
2938
2886
  )
2939
2887
  );
2940
2888
  const i = document.createElement("div");
2941
2889
  i.className = "pluno-pa-widget__share-prompt-copy";
2942
- const r = document.createElement("strong");
2943
- r.textContent = "Share this win?", i.appendChild(r);
2890
+ const a = document.createElement("strong");
2891
+ a.textContent = "Share this win?", i.appendChild(a);
2944
2892
  const l = document.createElement("span");
2945
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) {
2946
2894
  const u = document.createElement("span");
@@ -2954,7 +2902,7 @@ function Ka(e, t) {
2954
2902
  const c = document.createElement("button");
2955
2903
  if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2956
2904
  t.onDraft(e);
2957
- }), 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)
2958
2906
  p.appendChild(d);
2959
2907
  else {
2960
2908
  const u = document.createElement("button");
@@ -2968,15 +2916,15 @@ function Ka(e, t) {
2968
2916
  }
2969
2917
  return o.appendChild(p), n.appendChild(o), n;
2970
2918
  }
2971
- function Ya(e, t) {
2919
+ function lr(e, t) {
2972
2920
  const n = document.createElement("div");
2973
2921
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2974
2922
  g.target === n && t.onClose();
2975
2923
  });
2976
2924
  const o = document.createElement("section");
2977
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");
2978
- const i = document.createElement("header"), r = document.createElement("strong");
2979
- 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);
2980
2928
  const l = document.createElement("button");
2981
2929
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2982
2930
  const p = document.createElement("p");
@@ -2987,11 +2935,11 @@ function Ya(e, t) {
2987
2935
  c.className = "pluno-pa-widget__share-dialog-step-header";
2988
2936
  const u = document.createElement("strong");
2989
2937
  u.textContent = "1) Copy Screenshot", c.appendChild(u);
2990
- const m = Xa(
2938
+ const m = pr(
2991
2939
  "Copy Screenshot",
2992
2940
  async () => {
2993
2941
  try {
2994
- return await ei(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2942
+ return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2995
2943
  } catch {
2996
2944
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2997
2945
  }
@@ -3000,39 +2948,39 @@ function Ya(e, t) {
3000
2948
  if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
3001
2949
  const g = document.createElement("div");
3002
2950
  g.className = "pluno-pa-widget__share-dialog-screenshot";
3003
- const b = document.createElement("img");
3004
- 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);
3005
2953
  }
3006
2954
  o.appendChild(d), o.appendChild(p);
3007
- const k = document.createElement("div");
3008
- k.className = "pluno-pa-widget__share-dialog-step";
2955
+ const E = document.createElement("div");
2956
+ E.className = "pluno-pa-widget__share-dialog-step";
3009
2957
  const v = document.createElement("strong");
3010
- v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", k.appendChild(v);
3011
- const R = document.createElement("p");
3012
- R.className = "pluno-pa-widget__share-dialog-hint", R.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(R);
3013
- const _ = document.createElement("footer");
3014
- _.className = "pluno-pa-widget__share-dialog-platforms";
3015
- for (const g of Za(e)) {
3016
- const b = document.createElement("a");
3017
- b.href = g.href, b.target = "_blank", b.rel = "noopener noreferrer", b.title = g.label, b.setAttribute("aria-label", `Open ${g.label}`), b.appendChild(Ja(g.id)), _.appendChild(b);
2958
+ v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", E.appendChild(v);
2959
+ const z = document.createElement("p");
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);
3018
2966
  }
3019
- if (k.appendChild(_), o.appendChild(k), t.socialPostRewardsUrl) {
2967
+ if (E.appendChild(b), o.appendChild(E), t.socialPostRewardsUrl) {
3020
2968
  const g = document.createElement("div");
3021
2969
  g.className = "pluno-pa-widget__share-dialog-step";
3022
- const b = document.createElement("strong");
3023
- 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);
3024
2972
  const h = document.createElement("a");
3025
- 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(Qa()), 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);
3026
2974
  }
3027
2975
  return n.appendChild(o), n;
3028
2976
  }
3029
- function Xa(e, t) {
2977
+ function pr(e, t) {
3030
2978
  const n = document.createElement("button");
3031
2979
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
3032
2980
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
3033
2981
  }), n;
3034
2982
  }
3035
- function Za(e) {
2983
+ function sr(e) {
3036
2984
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
3037
2985
  return [
3038
2986
  {
@@ -3052,90 +3000,90 @@ function Za(e) {
3052
3000
  }
3053
3001
  ];
3054
3002
  }
3055
- function Ja(e) {
3003
+ function dr(e) {
3056
3004
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3057
- 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(
3058
3006
  t,
3059
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"
3060
- ), 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(
3061
3009
  t,
3062
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"
3063
- ), 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(
3064
3012
  t,
3065
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"
3066
- ), U(
3014
+ ), B(
3067
3015
  t,
3068
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",
3069
3017
  "0.48"
3070
- ), U(
3018
+ ), B(
3071
3019
  t,
3072
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"
3073
- ), U(
3021
+ ), B(
3074
3022
  t,
3075
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"
3076
3024
  ), t);
3077
3025
  }
3078
- function U(e, t, n) {
3026
+ function B(e, t, n) {
3079
3027
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3080
3028
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
3081
3029
  }
3082
- function Qa() {
3030
+ function cr() {
3083
3031
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3084
- 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(
3085
3033
  e,
3086
3034
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3087
3035
  ), e;
3088
3036
  }
3089
- function wo(e) {
3090
- return e.role === "tool" && e.toolName === Xn;
3037
+ function Co(e) {
3038
+ return e.role === "tool" && e.toolName === to;
3091
3039
  }
3092
- function er(e) {
3040
+ function ur(e) {
3093
3041
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3094
3042
  }
3095
- function tr(e, t, n, o) {
3043
+ function gr(e, t, n, o) {
3096
3044
  const i = document.createElement("article");
3097
3045
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
3098
3046
  e[e.length - 1].createdAt
3099
3047
  ).toLocaleString(), i.appendChild(
3100
- me(
3048
+ fe(
3101
3049
  "pluno-pa-widget__character--tool-group",
3102
3050
  o
3103
3051
  )
3104
3052
  );
3105
- const r = document.createElement("details"), l = nr(e);
3106
- r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3107
- 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();
3108
3056
  });
3109
3057
  const p = document.createElement("summary");
3110
- 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());
3111
3059
  const c = document.createElement("span");
3112
- 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) {
3113
3061
  const u = document.createElement("div");
3114
3062
  u.className = "pluno-pa-widget__tool-lines";
3115
3063
  for (const m of e) {
3116
- const k = document.createElement("div");
3117
- 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());
3118
3066
  const v = document.createElement("span");
3119
- 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);
3120
3068
  }
3121
- r.appendChild(u);
3069
+ a.appendChild(u);
3122
3070
  }
3123
- return i.appendChild(r), i;
3071
+ return i.appendChild(a), i;
3124
3072
  }
3125
- function bo(e) {
3073
+ function So(e) {
3126
3074
  const t = document.createElement("article");
3127
3075
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3128
- me(
3076
+ fe(
3129
3077
  "pluno-pa-widget__character--tool-group",
3130
3078
  e
3131
3079
  )
3132
3080
  ), t;
3133
3081
  }
3134
- function Gn(e) {
3135
- const t = bo(e);
3136
- 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;
3137
3085
  }
3138
- function ct(e = "Thinking...") {
3086
+ function ut(e = "Thinking...") {
3139
3087
  const t = document.createElement("div");
3140
3088
  t.className = "pluno-pa-widget__status";
3141
3089
  const n = document.createElement("span");
@@ -3143,17 +3091,17 @@ function ct(e = "Thinking...") {
3143
3091
  const o = document.createElement("span");
3144
3092
  return o.textContent = e, t.appendChild(o), t;
3145
3093
  }
3146
- function nr(e) {
3094
+ function hr(e) {
3147
3095
  return `tools:${e[0]?.id ?? ""}`;
3148
3096
  }
3149
- function Zt() {
3097
+ function en() {
3150
3098
  const e = document.createElement("span");
3151
3099
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3152
3100
  }
3153
- function _o(e, t) {
3154
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Pa() : 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());
3155
3103
  }
3156
- function or(e, t) {
3104
+ function mr(e, t) {
3157
3105
  const n = t.replace(/\r\n/g, `
3158
3106
  `).split(`
3159
3107
  `);
@@ -3177,14 +3125,14 @@ function or(e, t) {
3177
3125
  const l = i.match(/^(#{1,3})\s+(.+)$/);
3178
3126
  if (l) {
3179
3127
  const c = document.createElement(`h${l[1].length + 2}`);
3180
- at(c, l[2]), e.appendChild(c), o += 1;
3128
+ rt(c, l[2]), e.appendChild(c), o += 1;
3181
3129
  continue;
3182
3130
  }
3183
3131
  if (/^\s*[-*+]\s+/.test(i)) {
3184
3132
  const c = document.createElement("ul");
3185
3133
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3186
3134
  const u = document.createElement("li");
3187
- 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;
3188
3136
  }
3189
3137
  e.appendChild(c);
3190
3138
  continue;
@@ -3193,7 +3141,7 @@ function or(e, t) {
3193
3141
  const c = document.createElement("ol");
3194
3142
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3195
3143
  const u = document.createElement("li");
3196
- 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;
3197
3145
  }
3198
3146
  e.appendChild(c);
3199
3147
  continue;
@@ -3203,17 +3151,17 @@ function or(e, t) {
3203
3151
  p.push(n[o]), o += 1;
3204
3152
  const d = document.createElement("p");
3205
3153
  p.forEach((c, u) => {
3206
- u > 0 && d.appendChild(document.createElement("br")), at(d, c);
3154
+ u > 0 && d.appendChild(document.createElement("br")), rt(d, c);
3207
3155
  }), e.appendChild(d);
3208
3156
  }
3209
3157
  }
3210
- function at(e, t) {
3158
+ function rt(e, t) {
3211
3159
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3212
3160
  let o = 0;
3213
3161
  for (const i of t.matchAll(n)) {
3214
- const r = i.index ?? 0;
3215
- r > o && e.appendChild(
3216
- document.createTextNode(t.slice(o, r))
3162
+ const a = i.index ?? 0;
3163
+ a > o && e.appendChild(
3164
+ document.createTextNode(t.slice(o, a))
3217
3165
  );
3218
3166
  const l = i[0];
3219
3167
  if (l.startsWith("`")) {
@@ -3227,17 +3175,17 @@ function at(e, t) {
3227
3175
  p.textContent = l.slice(1, -1), e.appendChild(p);
3228
3176
  } else {
3229
3177
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3230
- if (p && ir(p[2])) {
3178
+ if (p && fr(p[2])) {
3231
3179
  const d = document.createElement("a");
3232
3180
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3233
3181
  } else
3234
3182
  e.appendChild(document.createTextNode(l));
3235
3183
  }
3236
- o = r + l.length;
3184
+ o = a + l.length;
3237
3185
  }
3238
3186
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
3239
3187
  }
3240
- function ir(e) {
3188
+ function fr(e) {
3241
3189
  if (e.startsWith("/") || e.startsWith("#"))
3242
3190
  return !0;
3243
3191
  try {
@@ -3247,8 +3195,8 @@ function ir(e) {
3247
3195
  return !1;
3248
3196
  }
3249
3197
  }
3250
- function $n(e, t) {
3251
- if (ar(e))
3198
+ function Yn(e, t) {
3199
+ if (wr(e))
3252
3200
  return;
3253
3201
  const n = `
3254
3202
  :host {
@@ -3291,9 +3239,6 @@ function $n(e, t) {
3291
3239
  --pluno-pa-faint: #8e8e95;
3292
3240
  --pluno-pa-divider: rgba(24, 24, 27, 0.08);
3293
3241
  --pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
3294
- --pluno-pa-minimized-launcher-paper: #fffdf6;
3295
- --pluno-pa-minimized-launcher-ink: #2c2a1e;
3296
- --pluno-pa-scribble-grid-line: rgba(96, 138, 188, 0.22);
3297
3242
  --pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
3298
3243
  --pluno-pa-launcher-height: 41px;
3299
3244
  --pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
@@ -3517,15 +3462,12 @@ function $n(e, t) {
3517
3462
  .pluno-pa-widget--thinking:not(.pluno-pa-widget--open):not(.pluno-pa-widget--minimized):not(.pluno-pa-widget--host-modal-conflict) .pluno-pa-widget__launcher-input {
3518
3463
  display: none;
3519
3464
  }
3520
- .pluno-pa-widget.pluno-pa-widget--minimized {
3465
+ .pluno-pa-widget--minimized {
3521
3466
  --pluno-pa-launcher-width: 22px;
3522
3467
  --pluno-pa-launcher-height: 22px;
3523
3468
  pointer-events: none;
3524
3469
  }
3525
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
3526
- /* The scribble circle gives the bolt a recognizable silhouette on host
3527
- pages whose background colors are outside the widget's control. */
3528
- isolation: isolate;
3470
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher {
3529
3471
  border: 0;
3530
3472
  border-radius: 999px;
3531
3473
  background: transparent;
@@ -3539,31 +3481,16 @@ function $n(e, t) {
3539
3481
  overflow: visible;
3540
3482
  pointer-events: auto;
3541
3483
  }
3542
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before {
3543
- content: "";
3544
- position: absolute;
3545
- inset: 0;
3546
- z-index: -1;
3547
- border: 1.5px solid var(--pluno-pa-minimized-launcher-ink);
3548
- border-radius: inherit;
3549
- background-color: var(--pluno-pa-minimized-launcher-paper);
3550
- background-image:
3551
- linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
3552
- linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
3553
- background-size: 12px 12px;
3554
- pointer-events: none;
3555
- }
3556
3484
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
3557
3485
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
3558
3486
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-minimize,
3559
3487
  .pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals--launcher {
3560
3488
  display: none;
3561
3489
  }
3562
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
3563
- left: 3px;
3564
- width: 16px;
3565
- height: 16px;
3566
- margin-top: 0;
3490
+ .pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
3491
+ left: 1px;
3492
+ width: 20px;
3493
+ height: 20px;
3567
3494
  }
3568
3495
  .pluno-pa-widget--bottom-left .pluno-pa-widget__launcher {
3569
3496
  left: 0;
@@ -5189,8 +5116,8 @@ function $n(e, t) {
5189
5116
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5190
5117
  position: absolute;
5191
5118
  top: -16px;
5192
- left: ${qt}px;
5193
- width: calc(100% - ${qt * 2}px);
5119
+ left: ${Kt}px;
5120
+ width: calc(100% - ${Kt * 2}px);
5194
5121
  height: 36px;
5195
5122
  z-index: 3;
5196
5123
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5280,6 +5207,20 @@ function $n(e, t) {
5280
5207
  .pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
5281
5208
  border-radius: var(--pluno-pa-scribble-wobble);
5282
5209
  }
5210
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized {
5211
+ --pluno-pa-launcher-width: 16px;
5212
+ --pluno-pa-launcher-height: 24px;
5213
+ }
5214
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
5215
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
5216
+ content: none;
5217
+ }
5218
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
5219
+ left: -3px;
5220
+ width: 22px;
5221
+ height: 22px;
5222
+ margin-top: 0;
5223
+ }
5283
5224
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
5284
5225
  color: var(--pluno-pa-text);
5285
5226
  font-size: 18px;
@@ -5415,6 +5356,21 @@ function $n(e, t) {
5415
5356
  opacity: 0.6;
5416
5357
  transform: rotate(5deg);
5417
5358
  }
5359
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
5360
+ border: 0;
5361
+ width: var(--pluno-pa-launcher-width);
5362
+ min-width: 0;
5363
+ height: var(--pluno-pa-launcher-height);
5364
+ min-height: 0;
5365
+ padding: 0;
5366
+ }
5367
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
5368
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
5369
+ content: none;
5370
+ }
5371
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals {
5372
+ display: none;
5373
+ }
5418
5374
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
5419
5375
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
5420
5376
  background: transparent;
@@ -5509,28 +5465,28 @@ function $n(e, t) {
5509
5465
  filter: url(#pluno-pa-scribble-wobble-2);
5510
5466
  }
5511
5467
  `;
5512
- if (rr(e, n))
5468
+ if (br(e, n))
5513
5469
  return;
5514
5470
  const o = e.ownerDocument.createElement("style");
5515
- o.id = io, o.textContent = n, e.appendChild(o), xo(e);
5471
+ o.id = co, o.textContent = n, e.appendChild(o), ko(e);
5516
5472
  }
5517
- function ar(e) {
5518
- 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";
5519
5475
  }
5520
- function xo(e) {
5521
- e.host instanceof HTMLElement && e.host.setAttribute(ao, "true");
5476
+ function ko(e) {
5477
+ e.host instanceof HTMLElement && e.host.setAttribute(uo, "true");
5522
5478
  }
5523
- function rr(e, t) {
5479
+ function br(e, t) {
5524
5480
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5525
5481
  return !1;
5526
5482
  try {
5527
5483
  const n = new CSSStyleSheet();
5528
- 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;
5529
5485
  } catch {
5530
5486
  return !1;
5531
5487
  }
5532
5488
  }
5533
- async function lr() {
5489
+ async function _r() {
5534
5490
  return document.body ? document.body : await new Promise((e) => {
5535
5491
  const t = new MutationObserver(() => {
5536
5492
  document.body && (t.disconnect(), e(document.body));
@@ -5538,14 +5494,36 @@ async function lr() {
5538
5494
  t.observe(document.documentElement, { childList: !0 });
5539
5495
  });
5540
5496
  }
5541
- function yo(e) {
5497
+ function Lo(e) {
5542
5498
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5543
5499
  }
5544
- function pr(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();
5545
5510
  try {
5546
- 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));
5547
5525
  if (!t)
5548
- return qn();
5526
+ return Xn();
5549
5527
  const n = JSON.parse(t);
5550
5528
  return {
5551
5529
  isOpen: n.isOpen === !0,
@@ -5555,25 +5533,25 @@ function pr(e) {
5555
5533
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5556
5534
  (o) => typeof o == "string"
5557
5535
  ) : [],
5558
- launcherPosition: ur(n.launcherPosition) ? n.launcherPosition : null,
5559
- panelSize: gr(n.panelSize) ? ut(n.panelSize) : null,
5560
- 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) : [],
5561
5539
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5562
5540
  };
5563
5541
  } catch {
5564
- return qn();
5542
+ return Xn();
5565
5543
  }
5566
5544
  }
5567
- async function sr(e) {
5545
+ async function vr(e) {
5568
5546
  if (e.loadSharePromptsDisabled)
5569
5547
  return e.loadSharePromptsDisabled();
5570
5548
  try {
5571
- return window.localStorage.getItem(Jn) === "true";
5549
+ return window.localStorage.getItem(io) === "true";
5572
5550
  } catch {
5573
5551
  return !1;
5574
5552
  }
5575
5553
  }
5576
- function dr(e, t) {
5554
+ function Cr(e, t) {
5577
5555
  if (e.persistSharePromptsDisabled) {
5578
5556
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5579
5557
  () => {
@@ -5582,12 +5560,12 @@ function dr(e, t) {
5582
5560
  return;
5583
5561
  }
5584
5562
  try {
5585
- t && window.localStorage.setItem(Jn, "true");
5563
+ t && window.localStorage.setItem(io, "true");
5586
5564
  } catch {
5587
5565
  return;
5588
5566
  }
5589
5567
  }
5590
- function qn() {
5568
+ function Xn() {
5591
5569
  return {
5592
5570
  isOpen: !1,
5593
5571
  composerValue: "",
@@ -5600,54 +5578,99 @@ function qn() {
5600
5578
  sharePromptsDisabled: !1
5601
5579
  };
5602
5580
  }
5603
- function cr(e, t) {
5581
+ function Sr(e, t) {
5604
5582
  try {
5605
5583
  window.localStorage.setItem(
5606
- yo(e),
5584
+ Lo(e),
5607
5585
  JSON.stringify(t)
5608
5586
  );
5609
5587
  } catch {
5610
5588
  return;
5611
5589
  }
5612
5590
  }
5613
- function ur(e) {
5591
+ function Er(e) {
5614
5592
  if (!e || typeof e != "object")
5615
5593
  return !1;
5616
5594
  const t = e;
5617
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");
5618
5596
  }
5619
- function gr(e) {
5597
+ function kr(e) {
5620
5598
  if (!e || typeof e != "object")
5621
5599
  return !1;
5622
5600
  const t = e;
5623
5601
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5624
5602
  }
5625
- const jn = /* @__PURE__ */ new WeakSet();
5626
- function hr(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) {
5627
5650
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5628
5651
  }
5629
- function Vn(e) {
5652
+ function Jn(e) {
5630
5653
  const t = e.pathname.split("/");
5631
5654
  return t[t.length - 1] ?? "";
5632
5655
  }
5633
- function mr(e, t) {
5656
+ function Ir(e, t) {
5634
5657
  const n = new URL(e.src, document.baseURI);
5635
- 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);
5636
5659
  }
5637
- class se extends EventTarget {
5660
+ class de extends EventTarget {
5638
5661
  constructor(t, n) {
5639
- super(), this.channelId = n, this.url = t, this.addPreviewListener(_i, () => {
5640
- this.readyState = se.OPEN, this.dispatchEvent(new Event("open"));
5641
- }), 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) => {
5642
5665
  const i = o;
5643
5666
  this.dispatchEvent(
5644
5667
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5645
5668
  );
5646
- }), this.addPreviewListener(yi, () => {
5647
- this.readyState = se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5648
- }), 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) => {
5649
5672
  const i = o;
5650
- this.readyState = se.CLOSED, this.dispatchEvent(
5673
+ this.readyState = de.CLOSED, this.dispatchEvent(
5651
5674
  new CloseEvent("close", {
5652
5675
  code: i.detail?.code ?? 1e3,
5653
5676
  reason: i.detail?.reason ?? "",
@@ -5656,8 +5679,8 @@ class se extends EventTarget {
5656
5679
  ), this.cleanup();
5657
5680
  }), window.dispatchEvent(
5658
5681
  new CustomEvent(
5659
- rt(
5660
- fi,
5682
+ lt(
5683
+ Ci,
5661
5684
  this.channelId
5662
5685
  ),
5663
5686
  {
@@ -5676,18 +5699,18 @@ class se extends EventTarget {
5676
5699
  extensions = "";
5677
5700
  binaryType = "blob";
5678
5701
  bufferedAmount = 0;
5679
- readyState = se.CONNECTING;
5680
- socketId = fr();
5702
+ readyState = de.CONNECTING;
5703
+ socketId = Tr();
5681
5704
  listeners = /* @__PURE__ */ new Map();
5682
5705
  send(t) {
5683
- if (this.readyState !== se.OPEN)
5706
+ if (this.readyState !== de.OPEN)
5684
5707
  throw new DOMException(
5685
5708
  "Pluno preview websocket is not open",
5686
5709
  "InvalidStateError"
5687
5710
  );
5688
5711
  window.dispatchEvent(
5689
5712
  new CustomEvent(
5690
- rt(wi, this.channelId),
5713
+ lt(Si, this.channelId),
5691
5714
  {
5692
5715
  detail: {
5693
5716
  socketId: this.socketId,
@@ -5698,9 +5721,9 @@ class se extends EventTarget {
5698
5721
  );
5699
5722
  }
5700
5723
  close(t, n) {
5701
- this.readyState !== se.CLOSED && (this.readyState = se.CLOSING, window.dispatchEvent(
5724
+ this.readyState !== de.CLOSED && (this.readyState = de.CLOSING, window.dispatchEvent(
5702
5725
  new CustomEvent(
5703
- rt(bi, this.channelId),
5726
+ lt(Ei, this.channelId),
5704
5727
  {
5705
5728
  detail: { socketId: this.socketId, code: t, reason: n }
5706
5729
  }
@@ -5708,11 +5731,11 @@ class se extends EventTarget {
5708
5731
  ), this.cleanup());
5709
5732
  }
5710
5733
  addPreviewListener(t, n) {
5711
- const o = rt(
5734
+ const o = lt(
5712
5735
  t,
5713
5736
  this.channelId
5714
- ), i = (r) => {
5715
- r.detail?.socketId === this.socketId && n(r);
5737
+ ), i = (a) => {
5738
+ a.detail?.socketId === this.socketId && n(a);
5716
5739
  };
5717
5740
  this.listeners.set(o, i), window.addEventListener(o, i);
5718
5741
  }
@@ -5722,19 +5745,19 @@ class se extends EventTarget {
5722
5745
  this.listeners.clear();
5723
5746
  }
5724
5747
  }
5725
- function fr() {
5748
+ function Tr() {
5726
5749
  const e = window.sessionStorage.getItem(
5727
- yn
5750
+ En
5728
5751
  );
5729
5752
  if (e)
5730
5753
  return e;
5731
5754
  const t = crypto.randomUUID();
5732
- return window.sessionStorage.setItem(yn, t), t;
5755
+ return window.sessionStorage.setItem(En, t), t;
5733
5756
  }
5734
- function rt(e, t) {
5757
+ function lt(e, t) {
5735
5758
  return `${e}:${t}`;
5736
5759
  }
5737
- function wr(e) {
5760
+ function Ar(e) {
5738
5761
  const t = document.currentScript;
5739
5762
  if (t instanceof HTMLScriptElement)
5740
5763
  return [t];
@@ -5742,33 +5765,64 @@ function wr(e) {
5742
5765
  return Array.from(
5743
5766
  document.querySelectorAll("script[type='module'][src]")
5744
5767
  ).filter(
5745
- (i) => i instanceof HTMLScriptElement && hr(i) && mr(i, o)
5768
+ (i) => i instanceof HTMLScriptElement && Pr(i) && Ir(i, o)
5746
5769
  );
5747
5770
  }
5748
- function br(e) {
5749
- for (const t of wr(e)) {
5750
- if (jn.has(t) || t.dataset.plunoAutoMount === "false")
5751
- continue;
5752
- jn.add(t);
5753
- const n = t.dataset.plunoPreviewChannel;
5754
- Gi({
5755
- token: t.dataset.plunoToken,
5756
- tokenEndpoint: t.dataset.plunoTokenEndpoint,
5757
- backendUrl: t.dataset.plunoBackendUrl,
5758
- webSocketFactory: n ? Wi(n) : void 0,
5759
- launcherLabel: t.dataset.plunoLauncherLabel,
5760
- accentColor: t.dataset.plunoAccentColor,
5761
- colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5762
- fontFamily: t.dataset.plunoFontFamily,
5763
- scribbleStyle: t.dataset.plunoScribbleStyle === "true",
5764
- position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5765
- }).catch((o) => {
5766
- console.error("Failed to mount Pluno widget", o);
5767
- });
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];
5768
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");
5769
5823
  }
5770
- br(import.meta.url);
5824
+ Nr(import.meta.url);
5771
5825
  export {
5772
- Wi as createProductAgentPreviewBridgeWebSocketFactory,
5773
- Gi as mountPlunoProductAgentWidget
5826
+ ea as createProductAgentPreviewBridgeWebSocketFactory,
5827
+ ta as mountPlunoProductAgentWidget
5774
5828
  };