@pluno/product-agent-web 0.1.37 → 0.1.39

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,7 +1,7 @@
1
- import { PlunoProductAgent as dn } from "./product-agent-sdk.js";
2
- const cn = "#7c3aed";
3
- function un(e) {
4
- const t = mn(e);
1
+ import { PlunoProductAgent as cn } from "./product-agent-sdk.js";
2
+ const un = "#7c3aed";
3
+ function gn(e) {
4
+ const t = fn(e);
5
5
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
6
6
  <defs>
7
7
  <linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
@@ -75,20 +75,20 @@ function un(e) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- const pe = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
79
- function It(e) {
80
- const t = Dt(e);
78
+ const se = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
79
+ function Dt(e) {
80
+ const t = Rt(e);
81
81
  if (st(fe(t), lt) >= pt)
82
82
  return t;
83
83
  let o = fe(t);
84
- const a = fe(pe);
84
+ const a = fe(se);
85
85
  for (let i = 0; i < 6; i += 1)
86
- if (o = fn(o, a, 0.22), st(o, lt) >= pt)
87
- return Ue(o);
88
- return Ue(o);
86
+ if (o = bn(o, a, 0.22), st(o, lt) >= pt)
87
+ return ze(o);
88
+ return ze(o);
89
89
  }
90
- function gn(e) {
91
- const t = It(e), n = "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";
90
+ function hn(e) {
91
+ const t = Dt(e), n = "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";
92
92
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
93
93
  <defs>
94
94
  <clipPath id="scribbleBoltClip">
@@ -101,23 +101,23 @@ function gn(e) {
101
101
  </defs>
102
102
  <g filter="url(#scribbleBoltWobble)">
103
103
  <g clip-path="url(#scribbleBoltClip)">
104
- <path d="${hn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
104
+ <path d="${mn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
105
105
  </g>
106
- <path d="${n}" fill="none" stroke="${pe}" stroke-width="18" stroke-linejoin="round"/>
106
+ <path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
107
107
  <g transform="rotate(-2 528 463)">
108
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
109
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${pe}"/>
108
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
109
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${se}"/>
110
110
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
111
111
  </g>
112
112
  <g transform="rotate(2 717 462)">
113
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
114
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${pe}"/>
113
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
114
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${se}"/>
115
115
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
116
116
  </g>
117
117
  </g>
118
118
  </svg>`;
119
119
  }
120
- function hn() {
120
+ function mn() {
121
121
  let n = "M 280 120", o = !1, a = 0;
122
122
  for (let i = 150; i <= 1170; i += 62) {
123
123
  const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
@@ -125,8 +125,8 @@ function hn() {
125
125
  }
126
126
  return n;
127
127
  }
128
- function mn(e) {
129
- const t = Dt(e), n = ze(fe(t));
128
+ function fn(e) {
129
+ const t = Rt(e), n = $e(fe(t));
130
130
  return n > 0.86 ? {
131
131
  top: "#ffffff",
132
132
  middle: "#f6f6f6",
@@ -150,21 +150,21 @@ function mn(e) {
150
150
  inner: "#4b4b4b",
151
151
  shadow: "#000000"
152
152
  } : {
153
- top: z(t, 0.28, -0.03),
154
- middle: z(t, 0.08, 0.04),
155
- bottom: z(t, -0.1, 0.02),
156
- edgeStart: z(t, 0.08, 0.08),
157
- edgeMiddle: z(t, -0.08, 0.08),
158
- edgeEnd: z(t, -0.18, 0.05),
159
- glow: z(t, 0.32, -0.12),
160
- highlight: z(t, 0.38, -0.18),
161
- inner: z(t, 0.24, -0.1),
162
- shadow: z(t, -0.25, -0.08)
153
+ top: $(t, 0.28, -0.03),
154
+ middle: $(t, 0.08, 0.04),
155
+ bottom: $(t, -0.1, 0.02),
156
+ edgeStart: $(t, 0.08, 0.08),
157
+ edgeMiddle: $(t, -0.08, 0.08),
158
+ edgeEnd: $(t, -0.18, 0.05),
159
+ glow: $(t, 0.32, -0.12),
160
+ highlight: $(t, 0.38, -0.18),
161
+ inner: $(t, 0.24, -0.1),
162
+ shadow: $(t, -0.25, -0.08)
163
163
  };
164
164
  }
165
- function Dt(e) {
165
+ function Rt(e) {
166
166
  const t = e.trim();
167
- 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()}` : cn;
167
+ 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()}` : un;
168
168
  }
169
169
  function fe(e) {
170
170
  return [
@@ -173,11 +173,11 @@ function fe(e) {
173
173
  Number.parseInt(e.slice(5, 7), 16)
174
174
  ];
175
175
  }
176
- function Ue([e, t, n]) {
176
+ function ze([e, t, n]) {
177
177
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
178
178
  return `#${o(e)}${o(t)}${o(n)}`;
179
179
  }
180
- function ze([e, t, n]) {
180
+ function $e([e, t, n]) {
181
181
  const o = (a) => {
182
182
  const i = a / 255;
183
183
  return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
@@ -185,50 +185,50 @@ function ze([e, t, n]) {
185
185
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
186
186
  }
187
187
  function st(e, t) {
188
- const n = ze(e), o = ze(t), [a, i] = n > o ? [n, o] : [o, n];
188
+ const n = $e(e), o = $e(t), [a, i] = n > o ? [n, o] : [o, n];
189
189
  return (a + 0.05) / (i + 0.05);
190
190
  }
191
- function fn(e, t, n) {
192
- const o = Ge(n);
191
+ function bn(e, t, n) {
192
+ const o = We(n);
193
193
  return [
194
194
  e[0] + (t[0] - e[0]) * o,
195
195
  e[1] + (t[1] - e[1]) * o,
196
196
  e[2] + (t[2] - e[2]) * o
197
197
  ];
198
198
  }
199
- function z(e, t, n) {
200
- const [o, a, i] = bn(fe(e));
201
- return Ue(wn(o, Ge(a + n), Ge(i + t)));
199
+ function $(e, t, n) {
200
+ const [o, a, i] = wn(fe(e));
201
+ return ze(_n(o, We(a + n), We(i + t)));
202
202
  }
203
- function bn([e, t, n]) {
203
+ function wn([e, t, n]) {
204
204
  const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
205
205
  if (l === s)
206
206
  return [0, 0, u];
207
207
  const d = l - s, p = u > 0.5 ? d / (2 - l - s) : d / (l + s);
208
208
  return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, p, u];
209
209
  }
210
- function wn(e, t, n) {
210
+ function _n(e, t, n) {
211
211
  if (t === 0)
212
212
  return [n * 255, n * 255, n * 255];
213
213
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
214
214
  return [
215
- Re(a, o, e + 1 / 3) * 255,
216
- Re(a, o, e) * 255,
217
- Re(a, o, e - 1 / 3) * 255
215
+ Me(a, o, e + 1 / 3) * 255,
216
+ Me(a, o, e) * 255,
217
+ Me(a, o, e - 1 / 3) * 255
218
218
  ];
219
219
  }
220
- function Re(e, t, n) {
220
+ function Me(e, t, n) {
221
221
  let o = n;
222
222
  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;
223
223
  }
224
- function Ge(e) {
224
+ function We(e) {
225
225
  return Math.max(0, Math.min(1, e));
226
226
  }
227
- const Rt = "suggest_share_on_socials";
228
- function _n(e) {
227
+ const Mt = "suggest_share_on_socials";
228
+ function xn(e) {
229
229
  for (let t = e.length - 1; t >= 0; t -= 1) {
230
230
  const n = e[t];
231
- if (n.role !== "tool" || n.toolName !== Rt)
231
+ if (n.role !== "tool" || n.toolName !== Mt)
232
232
  continue;
233
233
  const o = dt(e, t, "assistant");
234
234
  if (!o)
@@ -242,8 +242,8 @@ function _n(e) {
242
242
  }
243
243
  return null;
244
244
  }
245
- async function xn(e) {
246
- const t = await vn(e);
245
+ async function vn(e) {
246
+ const t = await yn(e);
247
247
  if (!navigator.clipboard || typeof ClipboardItem > "u")
248
248
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
249
249
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
@@ -256,18 +256,18 @@ function dt(e, t, n) {
256
256
  }
257
257
  return null;
258
258
  }
259
- async function vn(e) {
259
+ async function yn(e) {
260
260
  return await (await fetch(e)).blob();
261
261
  }
262
- const yn = "https://app.pluno.ai", Cn = "/api/product-agent/embed/active-users", En = 1800, Sn = 15e3, kn = 250, Ln = 1e3, Pn = 3e4;
263
- function An(e, t = {}) {
262
+ const Cn = "https://app.pluno.ai", En = "/api/product-agent/embed/active-users", Sn = 1800, kn = 15e3, Ln = 250, An = 1e3, Pn = 3e4;
263
+ function Tn(e, t = {}) {
264
264
  let n = !1, o = null, a = null, i = null;
265
265
  const l = () => {
266
266
  i !== null && (window.clearInterval(i), i = null);
267
267
  }, s = (p) => {
268
268
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
269
269
  d();
270
- }, In(p)));
270
+ }, Dn(p)));
271
271
  }, u = (p) => {
272
272
  if (l(), o === null) {
273
273
  o = p, e(p);
@@ -279,27 +279,27 @@ function An(e, t = {}) {
279
279
  l();
280
280
  return;
281
281
  }
282
- const L = Math.min(1, (performance.now() - x) / En);
283
- o = Math.round(w + (p - w) * Dn(L)), e(o), L >= 1 && (o = p, e(p), l());
284
- }, kn);
282
+ const A = Math.min(1, (performance.now() - x) / Sn);
283
+ o = Math.round(w + (p - w) * Rn(A)), e(o), A >= 1 && (o = p, e(p), l());
284
+ }, Ln);
285
285
  }, d = async () => {
286
286
  try {
287
- const p = await Tn(t);
287
+ const p = await Nn(t);
288
288
  if (n)
289
289
  return;
290
290
  u(p.count), s(p.refreshAfterMs);
291
291
  } catch {
292
- s(Sn);
292
+ s(kn);
293
293
  }
294
294
  };
295
295
  return d(), () => {
296
296
  n = !0, a !== null && window.clearTimeout(a), l();
297
297
  };
298
298
  }
299
- async function Tn(e) {
299
+ async function Nn(e) {
300
300
  if (e.loader)
301
301
  return e.loader();
302
- const n = await (e.fetcher ?? fetch)(new URL(Cn, Nn(e.backendUrl ?? yn)).toString(), {
302
+ const n = await (e.fetcher ?? fetch)(new URL(En, In(e.backendUrl ?? Cn)).toString(), {
303
303
  cache: "no-store",
304
304
  credentials: "omit"
305
305
  });
@@ -313,16 +313,16 @@ async function Tn(e) {
313
313
  function ct(e) {
314
314
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
315
315
  }
316
- function Nn(e) {
317
- return e.endsWith("/") ? e : `${e}/`;
318
- }
319
316
  function In(e) {
320
- return Math.min(Pn, Math.max(Ln, e));
317
+ return e.endsWith("/") ? e : `${e}/`;
321
318
  }
322
319
  function Dn(e) {
320
+ return Math.min(Pn, Math.max(An, e));
321
+ }
322
+ function Rn(e) {
323
323
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
324
324
  }
325
- const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-agent:sdk-preview-socket-send", On = "product-agent:sdk-preview-socket-close", Bn = "product-agent:sdk-preview-socket-open", Fn = "product-agent:sdk-preview-socket-message", Un = "product-agent:sdk-preview-socket-error", zn = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, $n = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), Hn = 3, j = {
325
+ const Ot = 100, Mn = "product-agent:sdk-preview-socket-connect", On = "product-agent:sdk-preview-socket-send", Bn = "product-agent:sdk-preview-socket-close", Fn = "product-agent:sdk-preview-socket-open", Un = "product-agent:sdk-preview-socket-message", zn = "product-agent:sdk-preview-socket-error", $n = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Wn = "product-agent:preview-diagnostic", Bt = "pluno.productAgent.sharePromptsDisabled", Ee = 10, Gn = 10 * 1024 * 1024, Ft = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Hn = Array.from(Ft).join(","), jn = 3, V = {
326
326
  launcherLabel: "Ask for anything...",
327
327
  accentColor: "#7c3aed",
328
328
  colorScheme: "light",
@@ -330,7 +330,7 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
330
330
  scribbleStyle: !1,
331
331
  position: "bottom-right",
332
332
  movableLauncher: !1
333
- }, jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ft = 190, Ut = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, $e = 50, Qn = "http://www.w3.org/2000/svg", ht = [
333
+ }, Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ut = 190, zt = 41, qn = 48, Yn = 420, Kn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, Ge = 50, eo = "http://www.w3.org/2000/svg", ht = [
334
334
  {
335
335
  ellipseCx: "17.5",
336
336
  ellipseCy: "24.5",
@@ -367,19 +367,20 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
367
367
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
368
368
  pathStrokeWidth: "2.45"
369
369
  }
370
- ], eo = 11, to = 13, mt = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", zt = "pluno-pa-widget-styles", Gt = "data-pluno-pa-widget-styles";
371
- function io(e) {
372
- return (t) => new V(t, e);
370
+ ], to = 11, no = 13, mt = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", $t = "pluno-pa-widget-styles", Wt = "data-pluno-pa-widget-styles";
371
+ let ft = 0;
372
+ function ro(e) {
373
+ return (t) => new q(t, e);
373
374
  }
374
- async function ro(e = {}) {
375
+ async function lo(e = {}) {
375
376
  const t = {
376
- launcherLabel: e.launcherLabel ?? j.launcherLabel,
377
- accentColor: e.accentColor ?? j.accentColor,
378
- colorScheme: e.colorScheme ?? j.colorScheme,
379
- fontFamily: e.fontFamily ?? j.fontFamily,
380
- scribbleStyle: e.scribbleStyle ?? j.scribbleStyle,
381
- position: e.position ?? j.position,
382
- movableLauncher: e.movableLauncher ?? j.movableLauncher,
377
+ launcherLabel: e.launcherLabel ?? V.launcherLabel,
378
+ accentColor: e.accentColor ?? V.accentColor,
379
+ colorScheme: e.colorScheme ?? V.colorScheme,
380
+ fontFamily: e.fontFamily ?? V.fontFamily,
381
+ scribbleStyle: e.scribbleStyle ?? V.scribbleStyle,
382
+ position: e.position ?? V.position,
383
+ movableLauncher: e.movableLauncher ?? V.movableLauncher,
383
384
  token: e.token,
384
385
  tokenProvider: e.tokenProvider,
385
386
  tokenEndpoint: e.tokenEndpoint,
@@ -401,7 +402,7 @@ async function ro(e = {}) {
401
402
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
402
403
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
403
404
  };
404
- Y("web-sdk.widget", "Mounting widget with merged options", {
405
+ X("web-sdk.widget", "Mounting widget with merged options", {
405
406
  accentColor: t.accentColor,
406
407
  colorScheme: t.colorScheme,
407
408
  fontFamily: t.fontFamily,
@@ -416,30 +417,30 @@ async function ro(e = {}) {
416
417
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
417
418
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
418
419
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
419
- let i = ft(t.accentColor, t.scribbleStyle);
420
- vo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
421
- const l = await ua(), s = l.ownerDocument;
422
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), bt(a, i, {
420
+ let i = bt(t.accentColor, t.scribbleStyle);
421
+ So(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
422
+ const l = await ba(), s = l.ownerDocument;
423
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), wt(a, i, {
423
424
  accentColor: t.accentColor,
424
425
  colorScheme: t.colorScheme,
425
426
  fontFamily: t.fontFamily,
426
427
  scribbleStyle: t.scribbleStyle
427
- }), Y("web-sdk.widget", "Applied initial widget appearance", {
428
+ }), X("web-sdk.widget", "Applied initial widget appearance", {
428
429
  accentColor: t.accentColor,
429
430
  colorScheme: t.colorScheme,
430
431
  fontFamily: t.fontFamily,
431
432
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
432
433
  });
433
- const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), L = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
434
- if (!u || !p || !w || !x || !L || !C || !M || !v || !y || !h || !g || !_ || !N || !Z || !ce || !S || !f)
434
+ const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Q = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
435
+ if (!u || !p || !w || !x || !A || !C || !M || !v || !y || !h || !g || !_ || !N || !Q || !ce || !S || !f)
435
436
  throw new Error("Failed to mount Pluno widget");
436
437
  if (t.movableLauncher && !d)
437
438
  throw new Error("Failed to mount Pluno widget drag handle");
438
- xt(p), xt(g);
439
+ vt(p), vt(g);
439
440
  let m = [], T = null;
440
- const k = () => {
441
- Mo(v, m, (r) => {
442
- m = m.filter((c, A) => A !== r), k(), O(b.getState()), U();
441
+ const L = () => {
442
+ zo(v, m, (r) => {
443
+ m = m.filter((c, k) => k !== r), L(), O(b.getState()), U();
443
444
  });
444
445
  }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
445
446
  if (!t.tokenEndpoint)
@@ -458,7 +459,7 @@ async function ro(e = {}) {
458
459
  return c.token;
459
460
  }), P = window.fetch.bind(window);
460
461
  let b;
461
- b = await dn.init({
462
+ b = await cn.init({
462
463
  token: t.token,
463
464
  tokenProvider: I,
464
465
  backendUrl: t.backendUrl,
@@ -473,42 +474,42 @@ async function ro(e = {}) {
473
474
  webSocketFactory: t.webSocketFactory,
474
475
  autoConnect: t.loginRequired ? !1 : void 0
475
476
  });
476
- const J = ga(t), Se = new Set(J.openToolGroupKeys), ie = new Set(J.seenShareCandidateIds), be = new Set(ie);
477
- let ke = J.sharePromptsDisabled || await ha(t), $ = t.movableLauncher ? J.launcherPosition : null, Ke = $ !== null, q = null, Le = !1, Q = !1, ee = {
477
+ const ee = wa(t), Se = new Set(ee.openToolGroupKeys), re = new Set(ee.seenShareCandidateIds), be = new Set(re);
478
+ let ke = ee.sharePromptsDisabled || await _a(t), G = t.movableLauncher ? ee.launcherPosition : null, Ke = G !== null, K = null, Le = !1, te = !1, ne = {
478
479
  enabled: !0
479
- }, te = 0, Ye = "";
480
- const W = (r, c) => {
481
- ee = { enabled: r, reason: c };
482
- }, H = () => {
483
- Z.hidden = !0;
484
- }, tn = () => {
485
- Z.hidden = !1;
486
- }, nn = (r = "jump") => {
487
- W(!0, r), H(), me(S, () => ee.enabled), te = S.scrollTop;
488
- }, on = () => {
480
+ }, oe = 0, Xe = "";
481
+ const H = (r, c) => {
482
+ ne = { enabled: r, reason: c };
483
+ }, j = () => {
484
+ Q.hidden = !0;
485
+ }, nn = () => {
486
+ Q.hidden = !1;
487
+ }, on = (r = "jump") => {
488
+ H(!0, r), j(), me(S, () => ne.enabled), oe = S.scrollTop;
489
+ }, an = () => {
489
490
  Le || typeof document > "u" || (Pt(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
490
- }, Xe = new MutationObserver(on);
491
- Xe.observe(s.documentElement, { childList: !0, subtree: !0 });
492
- const Pe = (r = !0) => {
493
- const c = We(a, r);
494
- return wt(
491
+ }, Ze = new MutationObserver(an);
492
+ Ze.observe(s.documentElement, { childList: !0, subtree: !0 });
493
+ const Ae = (r = !0) => {
494
+ const c = He(a, r);
495
+ return _t(
495
496
  a,
496
- $ ?? go(a, t.position, c),
497
+ G ? mo(G, c) : ho(a, t.position, c),
497
498
  c
498
499
  );
499
500
  }, F = () => {
500
- fa(t, {
501
+ va(t, {
501
502
  isOpen: a.classList.contains("pluno-pa-widget--open"),
502
503
  composerValue: g.value,
503
504
  openToolGroupKeys: [...Se],
504
- launcherPosition: Ke ? $ : null,
505
- seenShareCandidateIds: [...ie].slice(-Mt),
505
+ launcherPosition: Ke ? G : null,
506
+ seenShareCandidateIds: [...re].slice(-Ot),
506
507
  sharePromptsDisabled: ke
507
508
  });
508
- }, ne = (r, c = {}) => {
509
- wo(r, {
510
- debugVersion: ao,
511
- launcherPosition: $,
509
+ }, ae = (r, c = {}) => {
510
+ yo(r, {
511
+ debugVersion: io,
512
+ launcherPosition: G,
512
513
  rootClasses: a.className,
513
514
  rootStyle: {
514
515
  left: a.style.left,
@@ -516,136 +517,136 @@ async function ro(e = {}) {
516
517
  right: a.style.right,
517
518
  bottom: a.style.bottom
518
519
  },
519
- rootRect: Me(a),
520
- launcherRect: Me(u),
521
- panelRect: Me(w),
522
- viewport: de(),
520
+ rootRect: Oe(a),
521
+ launcherRect: Oe(u),
522
+ panelRect: Oe(w),
523
+ viewport: Y(),
523
524
  panelHidden: w.hidden,
524
525
  closeHidden: x.hidden,
525
526
  ...c
526
527
  });
527
528
  }, we = (r = !0) => {
528
- if (!$)
529
- return xe(a, null), Pe(r);
530
- const c = Pe(r);
531
- return xe(a, c), ne("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
532
- }, Ze = (r, c) => {
529
+ if (!G)
530
+ return xe(a, null), Ae(r);
531
+ const c = Ae(r);
532
+ return xe(a, c), ae("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
533
+ }, Je = (r, c) => {
533
534
  if (!r || !c) {
534
- bo(a);
535
+ vo(a);
535
536
  return;
536
537
  }
537
- fo(a, {
538
+ xo(a, {
538
539
  x: r.x - c.x,
539
540
  y: r.y - c.y
540
541
  });
541
- }, Je = () => {
542
+ }, Qe = () => {
542
543
  const r = we();
543
544
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
544
- const c = _t(a, r, t.position);
545
- Ze(c, r), ne("Applied open panel position after viewport resize", { openPanelPosition: c });
546
- } else $ && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
545
+ const c = xt(a, r, t.position);
546
+ Je(c, r), ae("Applied open panel position after viewport resize", { openPanelPosition: c });
547
+ } else G && ae("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
547
548
  };
548
- let Qe = () => {
549
+ let et = () => {
549
550
  };
550
- window.addEventListener("resize", Je), t.movableLauncher && d ? (we(), Qe = uo({
551
+ window.addEventListener("resize", Qe), t.movableLauncher && d ? (we(), et = go({
551
552
  root: a,
552
553
  launcher: u,
553
554
  launcherDragHandle: d,
554
- getPosition: () => Pe(),
555
+ getPosition: () => Ae(),
555
556
  setPosition: (r) => {
556
- const c = r;
557
- $ = wt(a, r, We(a)), xe(a, $), ne("Dragging closed launcher", { requestedPosition: c });
557
+ const c = r, k = He(a), z = _t(a, r, k);
558
+ G = fo(z, k), xe(a, z), ae("Dragging closed launcher", { requestedPosition: c });
558
559
  },
559
560
  persist: () => {
560
- Ke = !0, F(), ne("Persisted closed launcher drag position");
561
+ Ke = !0, F(), ae("Persisted closed launcher drag position");
561
562
  }
562
563
  })) : xe(a, null);
563
- let Ae = !1;
564
- const et = async () => {
565
- if (!(!t.billingStatusLoader || Ae)) {
566
- Ae = !0;
564
+ let Pe = !1;
565
+ const tt = async () => {
566
+ if (!(!t.billingStatusLoader || Pe)) {
567
+ Pe = !0;
567
568
  try {
568
569
  const r = await t.billingStatusLoader();
569
- yt(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Fe(M, t.billingStatus, b.getState().lastErrorCode), U());
570
+ Ct(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Ue(M, t.billingStatus, b.getState().lastErrorCode), U());
570
571
  } finally {
571
- Ae = !1;
572
+ Pe = !1;
572
573
  }
573
574
  }
574
- }, oe = (r = "", c = !0) => {
575
- et(), q !== null && (window.clearTimeout(q), q = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
576
- const A = we(), K = _t(a, A, t.position);
577
- if (Ze(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), W(!0, "open"), H(), !c) {
578
- a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
575
+ }, ie = (r = "", c = !0) => {
576
+ tt(), K !== null && (window.clearTimeout(K), K = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
577
+ const k = we(), z = xt(a, k, t.position);
578
+ if (Je(z, k), ae("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: k }), H(!0, "open"), j(), !c) {
579
+ a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ne.enabled), oe = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
579
580
  return;
580
581
  }
581
582
  window.requestAnimationFrame(() => {
582
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
583
- u.hidden = !0, me(S, () => ee.enabled), te = S.scrollTop;
583
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ne.enabled), oe = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), K = window.setTimeout(() => {
584
+ u.hidden = !0, me(S, () => ne.enabled), oe = S.scrollTop;
584
585
  }, 220);
585
586
  });
586
- }, an = () => {
587
- q !== null && (window.clearTimeout(q), q = null), u.hidden = !1, $ && (we(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
587
+ }, rn = () => {
588
+ K !== null && (window.clearTimeout(K), K = null), u.hidden = !1, G && (we(!1), ae("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), K = window.setTimeout(() => {
588
589
  w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
589
590
  }, 220);
590
591
  };
591
592
  u.addEventListener("submit", (r) => {
592
- r.preventDefault(), oe(p.value), p.value = "";
593
+ r.preventDefault(), ie(p.value), p.value = "";
593
594
  }), d?.addEventListener("click", (r) => {
594
595
  r.preventDefault(), r.stopPropagation();
595
596
  }), u.addEventListener("click", (r) => {
596
- r.target === p && !d || (oe(p.value), p.value = "");
597
+ r.target === p && !d || (ie(p.value), p.value = "");
597
598
  }), p.addEventListener("focus", () => {
598
- oe(p.value), p.value = "";
599
+ ie(p.value), p.value = "";
599
600
  }), p.addEventListener("input", () => {
600
601
  if (!p.value)
601
602
  return;
602
603
  const r = p.value;
603
- oe(r), p.value = "";
604
- }), x.addEventListener("click", an), S.addEventListener("scroll", () => {
605
- S.scrollTop < te - 1 && W(!1, "userScroll"), te = S.scrollTop;
606
- }), Z.addEventListener("click", () => {
607
- nn();
604
+ ie(r), p.value = "";
605
+ }), x.addEventListener("click", rn), S.addEventListener("scroll", () => {
606
+ S.scrollTop < oe - 1 && H(!1, "userScroll"), oe = S.scrollTop;
607
+ }), Q.addEventListener("click", () => {
608
+ on();
608
609
  });
609
- const tt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
610
+ const nt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
610
611
  ([r]) => {
611
- r?.isIntersecting && (W(!0, "bottom"), H());
612
+ r?.isIntersecting && (H(!0, "bottom"), j());
612
613
  },
613
614
  { root: S, threshold: 0 }
614
615
  );
615
- tt?.observe(f);
616
+ nt?.observe(f);
616
617
  const U = () => {
617
- _.disabled = G(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(t.billingStatus);
618
+ _.disabled = W(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || W(t.billingStatus);
618
619
  };
619
- t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, L.hidden = !0), L.addEventListener("submit", (r) => {
620
+ t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, A.hidden = !0), A.addEventListener("submit", (r) => {
620
621
  if (r.preventDefault(), t.loginRequired) {
621
622
  t.onLoginClick?.();
622
623
  return;
623
624
  }
624
- G(t.billingStatus) || (Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U());
625
+ W(t.billingStatus) || (te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U());
625
626
  });
626
627
  let ue = 0;
627
- const rn = () => {
628
+ const ln = () => {
628
629
  ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
629
- }, nt = (r) => {
630
+ }, ot = (r) => {
630
631
  T !== null && window.clearTimeout(T), C.textContent = r, C.hidden = !1, T = window.setTimeout(() => {
631
632
  C.textContent = "", C.hidden = !0, T = null;
632
633
  }, 3e3);
633
- }, ln = () => {
634
+ }, pn = () => {
634
635
  T !== null && (window.clearTimeout(T), T = null), C.textContent = "", C.hidden = !0;
635
- }, ot = async (r) => {
636
+ }, at = async (r) => {
636
637
  if (r.length === 0)
637
638
  return;
638
- const c = await Uo(r);
639
+ const c = await Ho(r);
639
640
  if (m.length + c.length > Ee)
640
641
  throw new Error(`Attach up to ${Ee} files per message.`);
641
- m = [...m, ...c], k(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
642
+ m = [...m, ...c], L(), pn(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || ie();
642
643
  };
643
644
  h.addEventListener("click", () => {
644
- t.loginRequired || G(t.billingStatus) || y.click();
645
+ t.loginRequired || W(t.billingStatus) || y.click();
645
646
  }), y.addEventListener("change", () => {
646
647
  const r = Array.from(y.files ?? []);
647
- y.value = "", ot(r).catch((c) => {
648
- nt(c instanceof Error ? c.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
648
+ y.value = "", at(r).catch((c) => {
649
+ ot(c instanceof Error ? c.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
649
650
  message: c instanceof Error ? c.message : String(c)
650
651
  });
651
652
  });
@@ -658,9 +659,9 @@ async function ro(e = {}) {
658
659
  ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
659
660
  }), a.addEventListener("drop", (r) => {
660
661
  const c = r.dataTransfer;
661
- !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((A) => {
662
- nt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
663
- message: A instanceof Error ? A.message : String(A)
662
+ !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ln(), at(c.files).catch((k) => {
663
+ ot(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
664
+ message: k instanceof Error ? k.message : String(k)
664
665
  });
665
666
  }));
666
667
  }), _.addEventListener("click", () => {
@@ -672,9 +673,9 @@ async function ro(e = {}) {
672
673
  b.stop();
673
674
  return;
674
675
  }
675
- Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
676
+ te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U(), O(b.getState());
676
677
  }), N.addEventListener("click", () => {
677
- Q = !0, W(!0, "newSession"), H(), b.startNewSession(), Se.clear(), g.value = "", m = [], k(), he(g), F(), U(), g.focus(), O(b.getState());
678
+ te = !0, H(!0, "newSession"), j(), b.startNewSession(), Se.clear(), g.value = "", m = [], L(), he(g), F(), U(), g.focus(), O(b.getState());
678
679
  }), g.addEventListener("input", () => {
679
680
  he(g), F(), U(), O(b.getState());
680
681
  }), g.addEventListener("keydown", (r) => {
@@ -683,90 +684,91 @@ async function ro(e = {}) {
683
684
  t.onLoginClick?.();
684
685
  return;
685
686
  }
686
- Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
687
+ te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U(), O(b.getState());
687
688
  }
688
689
  }), a.addEventListener("click", (r) => {
689
690
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
690
- }), J.composerValue && (g.value = J.composerValue, he(g)), J.isOpen && oe(g.value, !1);
691
- const at = () => i;
692
- let Te = b.getState().appearance !== null, _e = null, ge = null, re = null, it = b.getState().isThinking, le = null, Ne = null, rt = () => {
691
+ }), ee.composerValue && (g.value = ee.composerValue, he(g)), ee.isOpen && ie(g.value, !1);
692
+ const Te = () => i;
693
+ let Ne = b.getState().appearance !== null, _e = null, ge = null, le = null, it = b.getState().isThinking, pe = null, Ie = null, rt = () => {
693
694
  };
694
- const pn = !!t.socialPostDraftHandler, O = (r) => {
695
- if (qe(r.lastErrorCode) ? le = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(M, t.billingStatus, le), t.loginRequired) {
696
- Jo(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
695
+ const sn = !!t.socialPostDraftHandler, O = (r) => {
696
+ if (Ye(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Ue(M, t.billingStatus, pe), t.loginRequired) {
697
+ oa(S, _, N, Te, t.loginButtonLabel, t.onLoginClick);
697
698
  return;
698
699
  }
699
- const c = _o(r), A = c !== Ye;
700
- Ye = c;
701
- const K = Q || ee.enabled;
702
- Q = !1, Zo(
700
+ const c = Co(r), k = c !== Xe;
701
+ Xe = c;
702
+ const z = te || ne.enabled;
703
+ te = !1, na(
703
704
  S,
704
705
  f,
705
706
  _,
706
707
  N,
707
708
  ce,
708
709
  r,
709
- Ne,
710
- Ne !== null && Et(r, g.value.trim().length > 0 || m.length > 0),
711
- K,
712
- () => ee.enabled,
710
+ Ie,
711
+ Ie !== null && St(r, g.value.trim().length > 0 || m.length > 0),
712
+ z,
713
+ () => ne.enabled,
713
714
  Se,
714
715
  F,
715
- at,
716
+ Te,
716
717
  (R) => {
717
- Q = !0, W(!0, "send"), H(), b.sendMessage(R);
718
+ te = !0, H(!0, "send"), j(), b.sendMessage(R);
718
719
  },
719
- pn && !ke ? {
720
+ sn && !ke ? {
720
721
  dismissedCandidateIds: be,
721
722
  draftingCandidateId: _e,
722
723
  error: ge,
724
+ characterIconSvg: Te(),
723
725
  onSeen: (R) => {
724
- ie.add(R.id), F();
726
+ re.add(R.id), F();
725
727
  },
726
728
  onDraft: (R) => {
727
- sn(R);
729
+ dn(R);
728
730
  },
729
731
  onDismiss: (R) => {
730
- ie.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
732
+ re.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
731
733
  },
732
734
  onDisable: (R) => {
733
- ke = !0, ie.add(R.id), be.add(R.id), F(), ma(t, !0), ge = null, O(b.getState());
735
+ ke = !0, re.add(R.id), be.add(R.id), F(), xa(t, !0), ge = null, O(b.getState());
734
736
  }
735
737
  } : void 0
736
- ), K ? (te = S.scrollTop, H()) : A && xo(r) && tn();
738
+ ), z ? (oe = S.scrollTop, j()) : k && Eo(r) && nn();
737
739
  };
738
- return rt = An((r) => {
739
- Ne = r, !Le && Et(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
740
+ return rt = Tn((r) => {
741
+ Ie = r, !Le && St(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
740
742
  }, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), b.on("state", (r) => {
741
743
  const c = it && !r.isThinking;
742
- it = r.isThinking, r.appearance ? (Te = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
744
+ it = r.isThinking, r.appearance ? (Ne = !0, X("web-sdk.widget", "Agent state supplied appearance", {
743
745
  appearance: r.appearance
744
- }), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
746
+ }), De(r.appearance, "agent.state.appearance")) : Ne && (Ne = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
745
747
  fallbackAccentColor: t.accentColor,
746
748
  fallbackColorScheme: t.colorScheme,
747
749
  fallbackFontFamily: t.fontFamily
748
- }), Ie({}, "agent.state.appearance-cleared")), O(r), U(), c && et();
750
+ }), De({}, "agent.state.appearance-cleared")), O(r), U(), c && tt();
749
751
  }), O(b.getState()), U(), {
750
752
  agent: b,
751
753
  updateAppearance: (r) => {
752
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ie(r, "widgetHandle.updateAppearance");
754
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), De(r, "widgetHandle.updateAppearance");
753
755
  },
754
756
  updateBillingStatus: (r) => {
755
757
  const c = r ?? null;
756
- yt(t.billingStatus, c, le) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(
758
+ Ct(t.billingStatus, c, pe) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Ue(
757
759
  a.querySelector(".pluno-pa-widget__billing-status"),
758
760
  t.billingStatus,
759
- le
761
+ pe
760
762
  ), U());
761
763
  },
762
764
  openPanel: () => {
763
- oe(g.value, !1);
765
+ ie(g.value, !1);
764
766
  },
765
767
  destroy: () => {
766
- Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), re?.remove(), b.destroy(), n.remove();
768
+ Le = !0, Ze.disconnect(), nt?.disconnect(), window.removeEventListener("resize", Qe), et(), T !== null && window.clearTimeout(T), rt(), le?.remove(), b.destroy(), n.remove();
767
769
  }
768
770
  };
769
- async function sn(r) {
771
+ async function dn(r) {
770
772
  if (!_e) {
771
773
  _e = r.id, ge = null, O(b.getState());
772
774
  try {
@@ -775,12 +777,12 @@ async function ro(e = {}) {
775
777
  const c = await t.socialPostDraftHandler(r);
776
778
  if (!c.linkedinPost || !c.xPost)
777
779
  throw new Error("Pluno did not return a complete social post draft.");
778
- ie.add(r.id), be.add(r.id), F(), re?.remove(), re = ta(c, {
780
+ re.add(r.id), be.add(r.id), F(), le?.remove(), le = ra(c, {
779
781
  socialPostRewardsUrl: t.socialPostRewardsUrl,
780
782
  onClose: () => {
781
- re?.remove(), re = null;
783
+ le?.remove(), le = null;
782
784
  }
783
- }), a.appendChild(re);
785
+ }), a.appendChild(le);
784
786
  } catch (c) {
785
787
  ge = c instanceof Error ? c.message : "Could not draft social post.";
786
788
  } finally {
@@ -788,32 +790,32 @@ async function ro(e = {}) {
788
790
  }
789
791
  }
790
792
  }
791
- function Ie(r, c) {
792
- const A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
793
- i = ft(A, De), bt(a, i, {
794
- accentColor: A,
795
- colorScheme: K,
793
+ function De(r, c) {
794
+ const k = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, Re = r.scribbleStyle ?? t.scribbleStyle;
795
+ i = bt(k, Re), wt(a, i, {
796
+ accentColor: k,
797
+ colorScheme: z,
796
798
  fontFamily: R,
797
- scribbleStyle: De
798
- }), Y("web-sdk.widget", "Updated widget appearance", {
799
+ scribbleStyle: Re
800
+ }), X("web-sdk.widget", "Updated widget appearance", {
799
801
  source: c,
800
802
  inputAppearance: r,
801
- appliedAccentColor: A,
802
- appliedColorScheme: K,
803
+ appliedAccentColor: k,
804
+ appliedColorScheme: z,
803
805
  appliedFontFamily: R,
804
- appliedScribbleStyle: De,
806
+ appliedScribbleStyle: Re,
805
807
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
806
808
  });
807
809
  }
808
810
  }
809
- function ft(e, t) {
810
- return t ? gn(e) : un(e);
811
- }
812
- function lo(e) {
813
- const t = po(e);
814
- return t === null ? "#fafafa" : so(t) > 0.5 ? "#18181b" : "#fafaf9";
811
+ function bt(e, t) {
812
+ return t ? hn(e) : gn(e);
815
813
  }
816
814
  function po(e) {
815
+ const t = so(e);
816
+ return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
817
+ }
818
+ function so(e) {
817
819
  const t = e.trim();
818
820
  return /^#[0-9a-f]{6}$/i.test(t) ? [
819
821
  Number.parseInt(t.slice(1, 3), 16),
@@ -825,22 +827,22 @@ function po(e) {
825
827
  Number.parseInt(t[3] + t[3], 16)
826
828
  ] : null;
827
829
  }
828
- function so([e, t, n]) {
830
+ function co([e, t, n]) {
829
831
  const o = (a) => {
830
832
  const i = a / 255;
831
833
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
832
834
  };
833
835
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
834
836
  }
835
- function bt(e, t, n) {
837
+ function wt(e, t, n) {
836
838
  e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
837
- const o = n.scribbleStyle ? It(n.accentColor) : n.accentColor;
838
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", lo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && co(e.ownerDocument);
839
+ const o = n.scribbleStyle ? Dt(n.accentColor) : n.accentColor;
840
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", po(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Vn : n.fontFamily, n.scribbleStyle && uo(e.ownerDocument);
839
841
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
840
842
  for (const i of a)
841
- i.replaceWith(ae(Array.from(i.classList).join(" "), t));
843
+ i.replaceWith(Z(Array.from(i.classList).join(" "), t));
842
844
  }
843
- function co(e) {
845
+ function uo(e) {
844
846
  if (e.getElementById(gt))
845
847
  return;
846
848
  const t = e.createElement("style");
@@ -852,7 +854,7 @@ function co(e) {
852
854
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
853
855
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
854
856
  }
855
- function uo({
857
+ function go({
856
858
  root: e,
857
859
  launcher: t,
858
860
  launcherDragHandle: n,
@@ -865,7 +867,7 @@ function uo({
865
867
  l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
866
868
  }, x = (h) => {
867
869
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, u = o(), d = !1, t.setPointerCapture?.(h.pointerId));
868
- }, L = (h) => {
870
+ }, A = (h) => {
869
871
  if (l !== h.pointerId || !s || !u)
870
872
  return;
871
873
  h.preventDefault();
@@ -883,72 +885,91 @@ function uo({
883
885
  }, y = (h) => {
884
886
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
885
887
  return;
886
- const g = h.shiftKey ? oo : no, _ = o();
888
+ const g = h.shiftKey ? ao : oo, _ = o();
887
889
  let N = null;
888
890
  h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
889
891
  };
890
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", L), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
891
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", L), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
892
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
893
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
892
894
  };
893
895
  }
894
- function We(e, t = !0) {
895
- const n = de(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
896
+ function He(e, t = !0) {
897
+ const n = Y(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
896
898
  return {
897
- width: t && a && o.width > 0 ? o.width : Math.min(Ft, n.width - 36),
898
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ut
899
+ width: t && a && o.width > 0 ? o.width : Math.min(Ut, n.width - 36),
900
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : zt
899
901
  };
900
902
  }
901
- function $t() {
902
- const e = de();
903
+ function Gt() {
904
+ const e = Y();
903
905
  return {
904
906
  width: Math.min(
905
- se(e.width * Yn, qn, Kn),
907
+ de(e.width * Xn, Yn, Kn),
906
908
  e.width - B * 2
907
909
  ),
908
910
  height: Math.min(
909
- se(e.height * Jn, Xn, Zn),
910
- e.height - $e - B
911
+ de(e.height * Qn, Zn, Jn),
912
+ e.height - Ge - B
911
913
  )
912
914
  };
913
915
  }
914
- function go(e, t, n) {
916
+ function ho(e, t, n) {
915
917
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
916
918
  if (Number.isFinite(o) && Number.isFinite(a))
917
919
  return { x: o, y: a };
918
920
  const i = e.getBoundingClientRect();
919
921
  if (i.width > 0 || i.height > 0)
920
922
  return { x: i.left, y: i.top };
921
- const l = de();
923
+ const l = Y();
922
924
  return {
923
925
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
924
926
  y: l.height - 24 - n.height
925
927
  };
926
928
  }
927
- function wt(e, t, n) {
928
- const o = de(), a = B + ho(e);
929
+ function _t(e, t, n) {
930
+ const o = Y(), a = B + wo(e);
929
931
  return {
930
- x: se(t.x, B, Math.max(B, o.width - n.width - B)),
931
- y: se(t.y, a, Math.max(a, o.height - n.height - B))
932
+ x: de(t.x, B, Math.max(B, o.width - n.width - B)),
933
+ y: de(t.y, a, Math.max(a, o.height - n.height - B))
932
934
  };
933
935
  }
934
- function ho(e) {
935
- return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
936
+ function mo(e, t) {
937
+ const n = Y();
938
+ return {
939
+ x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
940
+ y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
941
+ };
936
942
  }
937
- function _t(e, t, n) {
938
- const o = We(e), a = $t(), i = {
943
+ function fo(e, t) {
944
+ const n = bo(e, t), o = Y();
945
+ return {
946
+ anchor: n,
947
+ x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
948
+ y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
949
+ };
950
+ }
951
+ function bo(e, t) {
952
+ const n = Y(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
953
+ return `${i}-${l}`;
954
+ }
955
+ function wo(e) {
956
+ return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
957
+ }
958
+ function xt(e, t, n) {
959
+ const o = He(e), a = Gt(), i = {
939
960
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
940
961
  y: t.y + o.height - a.height
941
962
  };
942
- return mo(i);
963
+ return _o(i);
943
964
  }
944
- function mo(e) {
945
- const t = de(), n = $t();
965
+ function _o(e) {
966
+ const t = Y(), n = Gt();
946
967
  return {
947
- x: se(e.x, B, Math.max(B, t.width - n.width - B)),
948
- y: se(
968
+ x: de(e.x, B, Math.max(B, t.width - n.width - B)),
969
+ y: de(
949
970
  e.y,
950
- $e,
951
- Math.max($e, t.height - n.height - B)
971
+ Ge,
972
+ Math.max(Ge, t.height - n.height - B)
952
973
  )
953
974
  };
954
975
  }
@@ -959,19 +980,19 @@ function xe(e, t) {
959
980
  }
960
981
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
961
982
  }
962
- function fo(e, t) {
983
+ function xo(e, t) {
963
984
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
964
985
  }
965
- function bo(e) {
986
+ function vo(e) {
966
987
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
967
988
  }
968
- function de() {
989
+ function Y() {
969
990
  return {
970
- width: window.innerWidth || document.documentElement.clientWidth || Ft + B * 2,
971
- height: window.innerHeight || document.documentElement.clientHeight || Ut + B * 2
991
+ width: window.innerWidth || document.documentElement.clientWidth || Ut + B * 2,
992
+ height: window.innerHeight || document.documentElement.clientHeight || zt + B * 2
972
993
  };
973
994
  }
974
- function Me(e) {
995
+ function Oe(e) {
975
996
  const t = e.getBoundingClientRect();
976
997
  return {
977
998
  x: Math.round(t.x),
@@ -980,10 +1001,10 @@ function Me(e) {
980
1001
  height: Math.round(t.height)
981
1002
  };
982
1003
  }
983
- function se(e, t, n) {
1004
+ function de(e, t, n) {
984
1005
  return Math.min(Math.max(e, t), n);
985
1006
  }
986
- function Y(e, t, n) {
1007
+ function X(e, t, n) {
987
1008
  if (typeof window > "u")
988
1009
  return;
989
1010
  const o = window, a = {
@@ -992,12 +1013,12 @@ function Y(e, t, n) {
992
1013
  message: t,
993
1014
  details: n
994
1015
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
995
- i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Gn, { detail: a }));
1016
+ i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Wn, { detail: a }));
996
1017
  }
997
- function wo(e, t) {
998
- Y("web-sdk.widget.position", e, t);
1018
+ function yo(e, t) {
1019
+ X("web-sdk.widget.position", e, t);
999
1020
  }
1000
- function Oe(e, t, n) {
1021
+ function Be(e, t, n) {
1001
1022
  const o = t.value.trim();
1002
1023
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1003
1024
  }
@@ -1011,7 +1032,7 @@ function me(e, t = () => !0) {
1011
1032
  t() && (e.scrollTop = e.scrollHeight);
1012
1033
  });
1013
1034
  }
1014
- function _o(e) {
1035
+ function Co(e) {
1015
1036
  const t = e.messages[e.messages.length - 1];
1016
1037
  return [
1017
1038
  e.messages.length,
@@ -1022,37 +1043,37 @@ function _o(e) {
1022
1043
  e.lastError ?? ""
1023
1044
  ].join(":");
1024
1045
  }
1025
- function xo(e) {
1046
+ function Eo(e) {
1026
1047
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1027
1048
  }
1028
- function vo(e, t, n, o) {
1029
- e.appendChild(Lo()), e.appendChild(yo(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", Po(16), !0)), e.appendChild(Co(n));
1049
+ function So(e, t, n, o) {
1050
+ e.appendChild(Io()), e.appendChild(ko(t, n, o)), e.appendChild(jt("pluno-pa-widget__close", "Close", Do(16), !0)), e.appendChild(Lo(n));
1030
1051
  }
1031
- function yo(e, t, n) {
1052
+ function ko(e, t, n) {
1032
1053
  const o = document.createElement("form");
1033
1054
  if (o.className = "pluno-pa-widget__launcher", n) {
1034
1055
  const i = document.createElement("button");
1035
1056
  i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
1036
1057
  }
1037
- o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ae("pluno-pa-widget__character--launcher", t));
1058
+ o.appendChild(Vt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(Z("pluno-pa-widget__character--launcher", t));
1038
1059
  const a = document.createElement("input");
1039
1060
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1040
1061
  }
1041
- function Co(e) {
1062
+ function Lo(e) {
1042
1063
  const t = document.createElement("section");
1043
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(jt("pluno-pa-widget__scribble-spirals--panel", 16));
1064
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(Vt("pluno-pa-widget__scribble-spirals--panel", 16));
1044
1065
  const n = document.createElement("div");
1045
1066
  n.className = "pluno-pa-widget__timeline-wrap";
1046
1067
  const o = document.createElement("main");
1047
- o.className = "pluno-pa-widget__timeline", o.appendChild(So(e));
1068
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Po(e));
1048
1069
  const a = document.createElement("div");
1049
1070
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1050
1071
  const i = document.createElement("div");
1051
1072
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1052
1073
  const l = document.createElement("button");
1053
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ht("pluno-pa-widget__new-chat", "New chat", Ao(), !0)), t.appendChild(n), t.appendChild(Eo()), t;
1074
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(jt("pluno-pa-widget__new-chat", "New chat", Ro(), !0)), t.appendChild(n), t.appendChild(Ao()), t;
1054
1075
  }
1055
- function Eo() {
1076
+ function Ao() {
1056
1077
  const e = document.createElement("form");
1057
1078
  e.className = "pluno-pa-widget__composer";
1058
1079
  const t = document.createElement("div");
@@ -1064,13 +1085,13 @@ function Eo() {
1064
1085
  const a = document.createElement("div");
1065
1086
  a.className = "pluno-pa-widget__composer-inner";
1066
1087
  const i = document.createElement("input");
1067
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1088
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Hn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1068
1089
  const l = document.createElement("button");
1069
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(To()), l.appendChild(No()), a.appendChild(l);
1090
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Mo()), l.appendChild(Oo()), a.appendChild(l);
1070
1091
  const s = document.createElement("textarea");
1071
1092
  s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1072
1093
  const u = document.createElement("button");
1073
- u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(Vt()), a.appendChild(u), e.appendChild(a);
1094
+ u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(qt()), a.appendChild(u), e.appendChild(a);
1074
1095
  const d = document.createElement("div");
1075
1096
  d.className = "pluno-pa-widget__composer-meta";
1076
1097
  const p = document.createElement("a");
@@ -1078,31 +1099,50 @@ function Eo() {
1078
1099
  const w = document.createElement("span");
1079
1100
  return w.className = "pluno-pa-widget__ai-disclaimer", w.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(w), e.appendChild(d), e;
1080
1101
  }
1081
- function So(e) {
1102
+ function Po(e) {
1082
1103
  const t = document.createElement("div");
1083
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(ae("pluno-pa-widget__character--empty", e)), t.appendChild(Wt()), t;
1104
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(Z("pluno-pa-widget__character--empty", e)), t.appendChild(Ht()), t;
1084
1105
  }
1085
- function Wt() {
1106
+ function Ht() {
1086
1107
  const e = document.createElement("div");
1087
1108
  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;
1088
1109
  }
1089
- function ko(e, t) {
1110
+ function To(e, t) {
1090
1111
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1091
1112
  const n = document.createElement("span");
1092
1113
  n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
1093
1114
  }
1094
- function ae(e, t) {
1095
- const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0), a = e.split(/\s+/).filter(Boolean);
1115
+ function Z(e, t) {
1116
+ const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0);
1117
+ No(o, `pluno-pa-character-${ft}`), ft += 1;
1118
+ const a = e.split(/\s+/).filter(Boolean);
1096
1119
  return o.setAttribute(
1097
1120
  "class",
1098
1121
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1099
1122
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1100
1123
  }
1101
- function Ht(e, t, n, o) {
1124
+ function No(e, t) {
1125
+ const n = /* @__PURE__ */ new Map();
1126
+ for (const a of Array.from(e.querySelectorAll("[id]"))) {
1127
+ const i = a.id, l = `${t}-${i}`;
1128
+ n.set(i, l), a.id = l;
1129
+ }
1130
+ if (n.size === 0)
1131
+ return;
1132
+ const o = [e, ...Array.from(e.querySelectorAll("*"))];
1133
+ for (const a of o)
1134
+ for (const i of Array.from(a.attributes)) {
1135
+ let l = i.value;
1136
+ for (const [s, u] of n)
1137
+ l = l.split(`url(#${s})`).join(`url(#${u})`), l === `#${s}` && (l = `#${u}`);
1138
+ l !== i.value && a.setAttribute(i.name, l);
1139
+ }
1140
+ }
1141
+ function jt(e, t, n, o) {
1102
1142
  const a = document.createElement("button");
1103
1143
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1104
1144
  }
1105
- function Lo() {
1145
+ function Io() {
1106
1146
  const e = E("svg", {
1107
1147
  class: "pluno-pa-widget__scribble-defs",
1108
1148
  "aria-hidden": "true",
@@ -1110,9 +1150,9 @@ function Lo() {
1110
1150
  width: "0",
1111
1151
  height: "0"
1112
1152
  }), t = E("defs");
1113
- return t.appendChild(Be("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Be("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Be("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1153
+ return t.appendChild(Fe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Fe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Fe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1114
1154
  }
1115
- function jt(e, t) {
1155
+ function Vt(e, t) {
1116
1156
  const n = E("svg", {
1117
1157
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1118
1158
  viewBox: `0 0 ${t * 26} 36`,
@@ -1145,7 +1185,7 @@ function jt(e, t) {
1145
1185
  }
1146
1186
  return n;
1147
1187
  }
1148
- function Be(e, t, n) {
1188
+ function Fe(e, t, n) {
1149
1189
  const o = E("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1150
1190
  return o.appendChild(
1151
1191
  E("feTurbulence", {
@@ -1182,28 +1222,28 @@ function Be(e, t, n) {
1182
1222
  })
1183
1223
  ), o;
1184
1224
  }
1185
- function Po(e) {
1186
- const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
1225
+ function Do(e) {
1226
+ const t = J("0 0 24 24", e, e, "none", "currentColor", "2.25");
1187
1227
  return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
1188
1228
  }
1189
- function Ao() {
1190
- const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1229
+ function Ro() {
1230
+ const e = J("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1191
1231
  return e.appendChild(E("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(E("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1192
1232
  }
1193
- function Vt() {
1194
- const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1233
+ function qt() {
1234
+ const e = J("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1195
1235
  return e.appendChild(E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
1196
1236
  }
1197
- function To() {
1198
- const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1237
+ function Mo() {
1238
+ const e = J("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1199
1239
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1200
1240
  E("path", {
1201
1241
  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"
1202
1242
  })
1203
1243
  ), e;
1204
1244
  }
1205
- function No() {
1206
- const e = X("0 0 24 24", 19, 19, "none", "currentColor");
1245
+ function Oo() {
1246
+ const e = J("0 0 24 24", 19, 19, "none", "currentColor");
1207
1247
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1208
1248
  E("path", {
1209
1249
  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",
@@ -1214,19 +1254,19 @@ function No() {
1214
1254
  })
1215
1255
  ), e;
1216
1256
  }
1217
- function Io() {
1218
- const e = X("0 0 24 24", 18, 18, "currentColor");
1257
+ function Bo() {
1258
+ const e = J("0 0 24 24", 18, 18, "currentColor");
1219
1259
  return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1220
1260
  }
1221
- function Do() {
1222
- const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1261
+ function Fo() {
1262
+ const e = J("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1223
1263
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
1224
1264
  }
1225
- function Ro() {
1226
- const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1265
+ function Uo() {
1266
+ const e = J("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1227
1267
  return e.appendChild(E("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(E("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1228
1268
  }
1229
- function X(e, t, n, o, a, i) {
1269
+ function J(e, t, n, o, a, i) {
1230
1270
  const l = {
1231
1271
  viewBox: e,
1232
1272
  width: String(t),
@@ -1237,38 +1277,38 @@ function X(e, t, n, o, a, i) {
1237
1277
  return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), E("svg", l);
1238
1278
  }
1239
1279
  function E(e, t = {}) {
1240
- const n = document.createElementNS(Qn, e);
1280
+ const n = document.createElementNS(eo, e);
1241
1281
  for (const [o, a] of Object.entries(t))
1242
1282
  n.setAttribute(o, a);
1243
1283
  return n;
1244
1284
  }
1245
- function xt(e) {
1285
+ function vt(e) {
1246
1286
  for (const t of ["keydown", "keypress", "keyup"])
1247
1287
  e.addEventListener(t, (n) => {
1248
1288
  n.stopPropagation();
1249
1289
  });
1250
1290
  }
1251
- function Mo(e, t, n) {
1291
+ function zo(e, t, n) {
1252
1292
  e.replaceChildren(), e.hidden = t.length === 0;
1253
1293
  for (const [o, a] of t.entries()) {
1254
1294
  const i = document.createElement("div");
1255
- i.className = "pluno-pa-widget__attachment", i.appendChild(Oo(a));
1295
+ i.className = "pluno-pa-widget__attachment", i.appendChild($o(a));
1256
1296
  const l = document.createElement("span");
1257
1297
  l.textContent = a.name, i.appendChild(l);
1258
1298
  const s = document.createElement("button");
1259
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Do()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1299
+ s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Fo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1260
1300
  }
1261
1301
  }
1262
- function Oo(e) {
1263
- if (qt(e)) {
1302
+ function $o(e) {
1303
+ if (Yt(e)) {
1264
1304
  const n = document.createElement("img");
1265
1305
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1266
1306
  }
1267
1307
  const t = document.createElement("span");
1268
1308
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1269
1309
  }
1270
- function Bo(e) {
1271
- if (qt(e)) {
1310
+ function Wo(e) {
1311
+ if (Yt(e)) {
1272
1312
  const a = document.createElement("img");
1273
1313
  return a.src = e.dataUrl, a.alt = e.name, a;
1274
1314
  }
@@ -1279,13 +1319,13 @@ function Bo(e) {
1279
1319
  const o = document.createElement("strong");
1280
1320
  return o.textContent = e.name, t.append(n, o), t;
1281
1321
  }
1282
- function qt(e) {
1322
+ function Yt(e) {
1283
1323
  return e.mimeType.startsWith("image/");
1284
1324
  }
1285
- function Fo(e) {
1325
+ function Go(e) {
1286
1326
  return e === "application/pdf" ? "document.pdf" : "image";
1287
1327
  }
1288
- async function Uo(e) {
1328
+ async function Ho(e) {
1289
1329
  if (!e)
1290
1330
  return [];
1291
1331
  const t = Array.from(e);
@@ -1293,37 +1333,37 @@ async function Uo(e) {
1293
1333
  throw new Error(`Attach up to ${Ee} files per message.`);
1294
1334
  return Promise.all(
1295
1335
  t.map(async (n) => {
1296
- const o = zo(n);
1336
+ const o = jo(n);
1297
1337
  if (!o)
1298
1338
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1299
- if (n.size > $n)
1339
+ if (n.size > Gn)
1300
1340
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1301
1341
  if (o === "image/gif") {
1302
- const a = new Uint8Array(await Yo(n));
1303
- if ($o(a))
1342
+ const a = new Uint8Array(await ea(n));
1343
+ if (qo(a))
1304
1344
  throw new Error("Pluno supports non-animated GIF images.");
1305
1345
  }
1306
1346
  return {
1307
- name: n.name || Fo(o),
1347
+ name: n.name || Go(o),
1308
1348
  mimeType: o,
1309
1349
  sizeBytes: n.size,
1310
- dataUrl: Go(await Xo(n), o)
1350
+ dataUrl: Vo(await ta(n), o)
1311
1351
  };
1312
1352
  })
1313
1353
  );
1314
1354
  }
1315
- function zo(e) {
1316
- if (Bt.has(e.type))
1355
+ function jo(e) {
1356
+ if (Ft.has(e.type))
1317
1357
  return e.type;
1318
1358
  const t = e.name.toLowerCase();
1319
1359
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
1320
1360
  }
1321
- function Go(e, t) {
1361
+ function Vo(e, t) {
1322
1362
  const n = `data:${t};base64,`;
1323
1363
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1324
1364
  }
1325
- function $o(e) {
1326
- if (e.length < 14 || !Wo(e))
1365
+ function qo(e) {
1366
+ if (e.length < 14 || !Yo(e))
1327
1367
  return !1;
1328
1368
  const t = e[10];
1329
1369
  let n = 13;
@@ -1334,7 +1374,7 @@ function $o(e) {
1334
1374
  if (n += 1, a === 59)
1335
1375
  return !1;
1336
1376
  if (a === 33) {
1337
- n += 1, n = vt(e, n);
1377
+ n += 1, n = yt(e, n);
1338
1378
  continue;
1339
1379
  }
1340
1380
  if (a !== 44)
@@ -1346,14 +1386,14 @@ function $o(e) {
1346
1386
  const i = e[n + 8];
1347
1387
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1348
1388
  return !1;
1349
- n += 1, n = vt(e, n);
1389
+ n += 1, n = yt(e, n);
1350
1390
  }
1351
1391
  return !1;
1352
1392
  }
1353
- function Wo(e) {
1393
+ function Yo(e) {
1354
1394
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1355
1395
  }
1356
- function vt(e, t) {
1396
+ function yt(e, t) {
1357
1397
  for (; t < e.length; ) {
1358
1398
  const n = e[t];
1359
1399
  if (t += 1, n === 0)
@@ -1365,60 +1405,60 @@ function vt(e, t) {
1365
1405
  function ve(e) {
1366
1406
  return !!(e && Array.from(e.types).includes("Files"));
1367
1407
  }
1368
- function Fe(e, t, n = null) {
1369
- if (!e || !He(t, n)) {
1408
+ function Ue(e, t, n = null) {
1409
+ if (!e || !je(t, n)) {
1370
1410
  e && (e.hidden = !0, e.replaceChildren());
1371
1411
  return;
1372
1412
  }
1373
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || qe(n) ? e.appendChild(Ho(t, n)) : Kt(t) && e.appendChild(jo(t));
1413
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || Ye(n) ? e.appendChild(Ko(t, n)) : Kt(t) && e.appendChild(Xo(t));
1374
1414
  }
1375
- function Ho(e, t) {
1415
+ function Ko(e, t) {
1376
1416
  const n = document.createElement("div");
1377
1417
  n.className = "pluno-pa-widget__billing-action-card";
1378
1418
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1379
1419
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1380
1420
  const i = document.createElement("span");
1381
- return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Yt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1421
+ return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Xt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1382
1422
  }
1383
- function jo(e) {
1423
+ function Xo(e) {
1384
1424
  const t = document.createElement("div");
1385
1425
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1386
1426
  const n = document.createElement("strong");
1387
1427
  n.textContent = "Credits running low", t.appendChild(n);
1388
1428
  const o = document.createElement("span");
1389
- return o.textContent = qo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Yt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1429
+ return o.textContent = Jo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Xt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1390
1430
  }
1391
- function He(e, t) {
1392
- return e !== null && (G(e) || Kt(e) || qe(t));
1431
+ function je(e, t) {
1432
+ return e !== null && (W(e) || Kt(e) || Ye(t));
1393
1433
  }
1394
- function yt(e, t, n) {
1395
- return He(t, n) || Vo(t) ? !0 : !He(e, n);
1434
+ function Ct(e, t, n) {
1435
+ return je(t, n) || Zo(t) ? !0 : !je(e, n);
1396
1436
  }
1397
- function Vo(e) {
1398
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
1437
+ function Zo(e) {
1438
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || W(e));
1399
1439
  }
1400
- function G(e) {
1440
+ function W(e) {
1401
1441
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1402
1442
  }
1403
- function qe(e) {
1443
+ function Ye(e) {
1404
1444
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1405
1445
  }
1406
1446
  function Kt(e) {
1407
- return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1447
+ return !W(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1408
1448
  }
1409
- function qo(e) {
1410
- return e.creditsRemaining === null ? null : `${Ko(e.creditsRemaining)} credits left`;
1449
+ function Jo(e) {
1450
+ return e.creditsRemaining === null ? null : `${Qo(e.creditsRemaining)} credits left`;
1411
1451
  }
1412
- function Ko(e) {
1452
+ function Qo(e) {
1413
1453
  return new Intl.NumberFormat("en-US", {
1414
1454
  maximumFractionDigits: 0
1415
1455
  }).format(Math.ceil(e));
1416
1456
  }
1417
- function Yt(e, t, n) {
1457
+ function Xt(e, t, n) {
1418
1458
  const o = document.createElement("div");
1419
- return o.className = n, o.appendChild(Ct(t, e.pricingUrl)), o.appendChild(Ct("Earn credits", e.earnCreditsUrl)), o;
1459
+ return o.className = n, o.appendChild(Et(t, e.pricingUrl)), o.appendChild(Et("Earn credits", e.earnCreditsUrl)), o;
1420
1460
  }
1421
- function Ct(e, t) {
1461
+ function Et(e, t) {
1422
1462
  const n = document.createElement("button");
1423
1463
  if (n.type = "button", e === "Earn credits") {
1424
1464
  const o = document.createElement("span");
@@ -1429,7 +1469,7 @@ function Ct(e, t) {
1429
1469
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1430
1470
  }), n;
1431
1471
  }
1432
- function Yo(e) {
1472
+ function ea(e) {
1433
1473
  return new Promise((t, n) => {
1434
1474
  const o = new FileReader();
1435
1475
  o.addEventListener("load", () => {
@@ -1443,7 +1483,7 @@ function Yo(e) {
1443
1483
  }), o.readAsArrayBuffer(e);
1444
1484
  });
1445
1485
  }
1446
- function Xo(e) {
1486
+ function ta(e) {
1447
1487
  return new Promise((t, n) => {
1448
1488
  const o = new FileReader();
1449
1489
  o.addEventListener("load", () => {
@@ -1457,41 +1497,41 @@ function Xo(e) {
1457
1497
  }), o.readAsDataURL(e);
1458
1498
  });
1459
1499
  }
1460
- function Et(e, t) {
1461
- return e.messages.filter((o) => !Xt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1500
+ function St(e, t) {
1501
+ return e.messages.filter((o) => !Zt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1462
1502
  }
1463
- function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1464
- const M = [...i.messages], v = M.filter((f) => !Xt(f)), y = e.scrollTop;
1465
- e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && ko(a, l);
1503
+ function na(e, t, n, o, a, i, l, s, u, d, p, w, x, A, C) {
1504
+ const M = [...i.messages], v = M.filter((f) => !Zt(f)), y = e.scrollTop;
1505
+ e.replaceChildren(), Qt(n, i.isThinking), a.hidden = !s, s && l !== null && To(a, l);
1466
1506
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1467
1507
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1468
1508
  const f = document.createElement("div");
1469
1509
  f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1470
1510
  const m = document.createElement("div");
1471
1511
  m.className = "pluno-pa-widget__empty-hero";
1472
- const T = ae("pluno-pa-widget__character--empty", x());
1473
- m.appendChild(T), f.appendChild(m), f.appendChild(Wt());
1474
- const k = document.createElement("div");
1475
- if (k.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1512
+ const T = Z("pluno-pa-widget__character--empty", x());
1513
+ m.appendChild(T), f.appendChild(m), f.appendChild(Ht());
1514
+ const L = document.createElement("div");
1515
+ if (L.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && L.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1476
1516
  for (const I of i.starterPrompts) {
1477
1517
  const P = document.createElement("button");
1478
1518
  P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
1479
- L(I);
1480
- }), k.appendChild(P);
1519
+ A(I);
1520
+ }), L.appendChild(P);
1481
1521
  }
1482
1522
  else
1483
- for (let I = 0; I < Hn; I += 1) {
1523
+ for (let I = 0; I < jn; I += 1) {
1484
1524
  const P = document.createElement("button");
1485
- P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = "&nbsp;", k.appendChild(P);
1525
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = "&nbsp;", L.appendChild(P);
1486
1526
  }
1487
- f.appendChild(k), e.appendChild(f), e.appendChild(t);
1527
+ f.appendChild(L), e.appendChild(f), e.appendChild(t);
1488
1528
  return;
1489
1529
  }
1490
1530
  let g = null, _ = null, N = [];
1491
- const Z = () => {
1531
+ const Q = () => {
1492
1532
  if (N.length === 0)
1493
1533
  return !1;
1494
- const f = ra(N, p, w, x());
1534
+ const f = ca(N, p, w, x());
1495
1535
  return e.appendChild(f), g = null, _ = f, N = [], !0;
1496
1536
  };
1497
1537
  for (let f = 0; f < v.length; f += 1) {
@@ -1502,44 +1542,45 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1502
1542
  }
1503
1543
  if (m.role === "system")
1504
1544
  continue;
1505
- const T = Z(), k = kt(m.content);
1545
+ const T = Q(), L = Lt(m.content);
1506
1546
  if (m.role === "assistant" && !T) {
1507
- const b = je(x());
1547
+ const b = Ve(x());
1508
1548
  e.appendChild(b), g = null, _ = b;
1509
1549
  }
1510
1550
  const I = document.createElement("div");
1511
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, k) : I.textContent = k, m.role === "user" && m.attachments?.length && I.appendChild(Qo(m.attachments));
1551
+ I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? At(I, L) : I.textContent = L, m.role === "user" && m.attachments?.length && I.appendChild(aa(m.attachments));
1512
1552
  const P = document.createElement("div");
1513
- P.className = "pluno-pa-widget__message-actions", P.appendChild(St(k)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
1553
+ P.className = "pluno-pa-widget__message-actions", P.appendChild(kt(L)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
1514
1554
  }
1515
- const ce = Z();
1555
+ const ce = Q();
1516
1556
  if (i.assistantDraft) {
1517
1557
  if (!ce) {
1518
- const k = je(x());
1519
- e.appendChild(k), g = null, _ = k;
1558
+ const L = Ve(x());
1559
+ e.appendChild(L), g = null, _ = L;
1520
1560
  }
1521
- const f = kt(i.assistantDraft), m = document.createElement("div");
1522
- m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Lt(m, f);
1561
+ const f = Lt(i.assistantDraft), m = document.createElement("div");
1562
+ m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", At(m, f);
1523
1563
  const T = document.createElement("div");
1524
- T.className = "pluno-pa-widget__message-actions", T.appendChild(St(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
1564
+ T.className = "pluno-pa-widget__message-actions", T.appendChild(kt(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
1525
1565
  }
1526
1566
  if (i.isThinking && !i.assistantDraft)
1527
1567
  if (ce) {
1528
- const f = Zt();
1568
+ const f = Jt();
1529
1569
  e.appendChild(f), g = null, _ = f;
1530
1570
  } else {
1531
- const f = la(x());
1571
+ const f = ua(x());
1532
1572
  e.appendChild(f), g = null, _ = f;
1533
1573
  }
1534
1574
  if (i.lastError) {
1535
1575
  const f = document.createElement("div");
1536
1576
  f.className = "pluno-pa-widget__error", f.textContent = i.lastError, e.appendChild(f), g = f, _ = null;
1537
1577
  }
1538
- const S = C && !i.isThinking ? _n(M) : null;
1578
+ const S = C && !i.isThinking ? xn(M) : null;
1539
1579
  if (C && S && !C.dismissedCandidateIds.has(S.id)) {
1540
- const f = ea(S, {
1580
+ const f = ia(S, {
1541
1581
  isDrafting: C.draftingCandidateId === S.id,
1542
1582
  error: C.error,
1583
+ characterIconSvg: C.characterIconSvg,
1543
1584
  onDraft: C.onDraft,
1544
1585
  onDismiss: C.onDismiss,
1545
1586
  onDisable: C.onDisable
@@ -1548,35 +1589,35 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1548
1589
  }
1549
1590
  g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), u ? me(e, d) : e.scrollTop = y;
1550
1591
  }
1551
- function Jo(e, t, n, o, a, i) {
1552
- e.replaceChildren(), Jt(t, !1), t.disabled = !0, n.hidden = !0;
1592
+ function oa(e, t, n, o, a, i) {
1593
+ e.replaceChildren(), Qt(t, !1), t.disabled = !0, n.hidden = !0;
1553
1594
  const l = document.createElement("div");
1554
1595
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1555
- const s = ae("pluno-pa-widget__character--empty", o());
1596
+ const s = Z("pluno-pa-widget__character--empty", o());
1556
1597
  l.appendChild(s);
1557
1598
  const u = document.createElement("div");
1558
1599
  u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1559
1600
  const d = document.createElement("button");
1560
1601
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1561
1602
  }
1562
- function Qo(e) {
1603
+ function aa(e) {
1563
1604
  const t = document.createElement("div");
1564
1605
  t.className = "pluno-pa-widget__message-attachments";
1565
1606
  for (const n of e)
1566
- t.appendChild(Bo(n));
1607
+ t.appendChild(Wo(n));
1567
1608
  return t;
1568
1609
  }
1569
- function St(e) {
1610
+ function kt(e) {
1570
1611
  const t = document.createElement("button");
1571
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
1612
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Uo()), t.addEventListener("click", (n) => {
1572
1613
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1573
1614
  }), t;
1574
1615
  }
1575
- function ea(e, t) {
1616
+ function ia(e, t) {
1576
1617
  const n = document.createElement("article");
1577
1618
  n.className = "pluno-pa-widget__share-prompt";
1578
1619
  const o = document.createElement("div");
1579
- o.className = "pluno-pa-widget__share-prompt-body";
1620
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(Z("pluno-pa-widget__share-prompt-icon", t.characterIconSvg));
1580
1621
  const a = document.createElement("div");
1581
1622
  a.className = "pluno-pa-widget__share-prompt-copy";
1582
1623
  const i = document.createElement("strong");
@@ -1594,7 +1635,7 @@ function ea(e, t) {
1594
1635
  const d = document.createElement("button");
1595
1636
  if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1596
1637
  t.onDraft(e);
1597
- }), t.isDrafting ? (d.appendChild(Ve()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
1638
+ }), t.isDrafting ? (d.appendChild(qe()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
1598
1639
  s.appendChild(u);
1599
1640
  else {
1600
1641
  const p = document.createElement("button");
@@ -1608,7 +1649,7 @@ function ea(e, t) {
1608
1649
  }
1609
1650
  return o.appendChild(s), n.appendChild(o), n;
1610
1651
  }
1611
- function ta(e, t) {
1652
+ function ra(e, t) {
1612
1653
  const n = document.createElement("div");
1613
1654
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1614
1655
  v.target === n && t.onClose();
@@ -1627,9 +1668,9 @@ function ta(e, t) {
1627
1668
  d.className = "pluno-pa-widget__share-dialog-step-header";
1628
1669
  const p = document.createElement("strong");
1629
1670
  p.textContent = "1) Copy Screenshot", d.appendChild(p);
1630
- const w = na("Copy Screenshot", async () => {
1671
+ const w = la("Copy Screenshot", async () => {
1631
1672
  try {
1632
- return await xn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1673
+ return await vn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1633
1674
  } catch {
1634
1675
  return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1635
1676
  }
@@ -1643,15 +1684,15 @@ function ta(e, t) {
1643
1684
  o.appendChild(u), o.appendChild(s);
1644
1685
  const x = document.createElement("div");
1645
1686
  x.className = "pluno-pa-widget__share-dialog-step";
1646
- const L = document.createElement("strong");
1647
- L.className = "pluno-pa-widget__share-dialog-step-title", L.textContent = "2) Share on", x.appendChild(L);
1687
+ const A = document.createElement("strong");
1688
+ A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
1648
1689
  const C = document.createElement("p");
1649
1690
  C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
1650
1691
  const M = document.createElement("footer");
1651
1692
  M.className = "pluno-pa-widget__share-dialog-platforms";
1652
- for (const v of oa(e)) {
1693
+ for (const v of pa(e)) {
1653
1694
  const y = document.createElement("a");
1654
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(aa(v.id)), M.appendChild(y);
1695
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(sa(v.id)), M.appendChild(y);
1655
1696
  }
1656
1697
  if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
1657
1698
  const v = document.createElement("div");
@@ -1659,17 +1700,17 @@ function ta(e, t) {
1659
1700
  const y = document.createElement("strong");
1660
1701
  y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1661
1702
  const h = document.createElement("a");
1662
- 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(ia()), v.appendChild(h), o.appendChild(v);
1703
+ 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(da()), v.appendChild(h), o.appendChild(v);
1663
1704
  }
1664
1705
  return n.appendChild(o), n;
1665
1706
  }
1666
- function na(e, t) {
1707
+ function la(e, t) {
1667
1708
  const n = document.createElement("button");
1668
1709
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1669
1710
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1670
1711
  }), n;
1671
1712
  }
1672
- function oa(e) {
1713
+ function pa(e) {
1673
1714
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1674
1715
  return [
1675
1716
  {
@@ -1689,7 +1730,7 @@ function oa(e) {
1689
1730
  }
1690
1731
  ];
1691
1732
  }
1692
- function aa(e) {
1733
+ function sa(e) {
1693
1734
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1694
1735
  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" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), D(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), D(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), D(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
1695
1736
  }
@@ -1697,48 +1738,48 @@ function D(e, t, n) {
1697
1738
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1698
1739
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1699
1740
  }
1700
- function ia() {
1741
+ function da() {
1701
1742
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1702
1743
  return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1703
1744
  }
1704
- function Xt(e) {
1705
- return e.role === "tool" && e.toolName === Rt;
1745
+ function Zt(e) {
1746
+ return e.role === "tool" && e.toolName === Mt;
1706
1747
  }
1707
- function kt(e) {
1748
+ function Lt(e) {
1708
1749
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1709
1750
  }
1710
- function ra(e, t, n, o) {
1751
+ function ca(e, t, n, o) {
1711
1752
  const a = document.createElement("article");
1712
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ae("pluno-pa-widget__character--tool-group", o));
1713
- const i = document.createElement("details"), l = pa(e);
1753
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(Z("pluno-pa-widget__character--tool-group", o));
1754
+ const i = document.createElement("details"), l = ga(e);
1714
1755
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1715
1756
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1716
1757
  });
1717
1758
  const s = document.createElement("summary");
1718
- s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ve());
1759
+ s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(qe());
1719
1760
  const d = document.createElement("span");
1720
1761
  if (d.className = "pluno-pa-widget__tool-summary-title", d.textContent = e[e.length - 1].content || "Run tool", s.appendChild(d), i.appendChild(s), e.length > 0) {
1721
1762
  const p = document.createElement("div");
1722
1763
  p.className = "pluno-pa-widget__tool-lines";
1723
1764
  for (const w of e) {
1724
1765
  const x = document.createElement("div");
1725
- x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ve());
1726
- const L = document.createElement("span");
1727
- L.textContent = w.content || "Run tool", x.appendChild(L), p.appendChild(x);
1766
+ x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(qe());
1767
+ const A = document.createElement("span");
1768
+ A.textContent = w.content || "Run tool", x.appendChild(A), p.appendChild(x);
1728
1769
  }
1729
1770
  i.appendChild(p);
1730
1771
  }
1731
1772
  return a.appendChild(i), a;
1732
1773
  }
1733
- function je(e) {
1774
+ function Ve(e) {
1734
1775
  const t = document.createElement("article");
1735
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ae("pluno-pa-widget__character--tool-group", e)), t;
1776
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(Z("pluno-pa-widget__character--tool-group", e)), t;
1736
1777
  }
1737
- function la(e) {
1738
- const t = je(e);
1739
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Zt()), t;
1778
+ function ua(e) {
1779
+ const t = Ve(e);
1780
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Jt()), t;
1740
1781
  }
1741
- function Zt() {
1782
+ function Jt() {
1742
1783
  const e = document.createElement("div");
1743
1784
  e.className = "pluno-pa-widget__status";
1744
1785
  const t = document.createElement("span");
@@ -1746,17 +1787,17 @@ function Zt() {
1746
1787
  const n = document.createElement("span");
1747
1788
  return n.textContent = "Thinking...", e.appendChild(n), e;
1748
1789
  }
1749
- function pa(e) {
1790
+ function ga(e) {
1750
1791
  return `tools:${e[0]?.id ?? ""}`;
1751
1792
  }
1752
- function Ve() {
1793
+ function qe() {
1753
1794
  const e = document.createElement("span");
1754
1795
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1755
1796
  }
1756
- function Jt(e, t) {
1757
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Io() : Vt());
1797
+ function Qt(e, t) {
1798
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Bo() : qt());
1758
1799
  }
1759
- function Lt(e, t) {
1800
+ function At(e, t) {
1760
1801
  const n = t.replace(/\r\n/g, `
1761
1802
  `).split(`
1762
1803
  `);
@@ -1828,7 +1869,7 @@ function ye(e, t) {
1828
1869
  s.textContent = l.slice(1, -1), e.appendChild(s);
1829
1870
  } else {
1830
1871
  const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1831
- if (s && sa(s[2])) {
1872
+ if (s && ha(s[2])) {
1832
1873
  const u = document.createElement("a");
1833
1874
  u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
1834
1875
  } else
@@ -1838,7 +1879,7 @@ function ye(e, t) {
1838
1879
  }
1839
1880
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1840
1881
  }
1841
- function sa(e) {
1882
+ function ha(e) {
1842
1883
  if (e.startsWith("/") || e.startsWith("#"))
1843
1884
  return !0;
1844
1885
  try {
@@ -1849,7 +1890,7 @@ function sa(e) {
1849
1890
  }
1850
1891
  }
1851
1892
  function Pt(e, t) {
1852
- if (da(e))
1893
+ if (ma(e))
1853
1894
  return;
1854
1895
  const n = `
1855
1896
  :host {
@@ -1902,7 +1943,7 @@ function Pt(e, t) {
1902
1943
  --pluno-pa-accent-contrast: #fafafa;
1903
1944
  position: fixed;
1904
1945
  z-index: 2147483645;
1905
- font-family: ${j.fontFamily};
1946
+ font-family: ${V.fontFamily};
1906
1947
  font-size: 14px;
1907
1948
  color: var(--pluno-pa-text);
1908
1949
  width: var(--pluno-pa-launcher-width);
@@ -2548,19 +2589,26 @@ function Pt(e, t) {
2548
2589
  align-self: stretch;
2549
2590
  display: block;
2550
2591
  color: var(--pluno-pa-muted);
2551
- font-size: 12px;
2592
+ font-size: 15px;
2552
2593
  line-height: 1.35;
2553
2594
  margin-top: -4px;
2554
2595
  }
2555
2596
  .pluno-pa-widget__share-prompt-body {
2556
2597
  min-width: 0;
2557
2598
  display: grid;
2599
+ grid-template-columns: 44px minmax(0, 1fr);
2558
2600
  gap: 8px;
2559
2601
  border: 1px solid var(--pluno-pa-divider);
2560
2602
  border-radius: 8px;
2561
2603
  background: color-mix(in srgb, var(--pluno-pa-surface) 78%, transparent);
2562
2604
  padding: 8px;
2563
2605
  }
2606
+ .pluno-pa-widget__share-prompt-icon {
2607
+ width: 44px;
2608
+ height: 44px;
2609
+ align-self: start;
2610
+ margin-top: 1px;
2611
+ }
2564
2612
  .pluno-pa-widget__share-prompt-copy {
2565
2613
  min-width: 0;
2566
2614
  display: grid;
@@ -2568,19 +2616,20 @@ function Pt(e, t) {
2568
2616
  }
2569
2617
  .pluno-pa-widget__share-prompt-copy strong {
2570
2618
  color: var(--pluno-pa-text);
2571
- font-size: 12px;
2619
+ font-size: 15px;
2572
2620
  line-height: 1.25;
2573
2621
  font-weight: 650;
2574
2622
  }
2575
2623
  .pluno-pa-widget__share-prompt-copy span {
2576
2624
  color: var(--pluno-pa-muted);
2577
- font-size: 11px;
2625
+ font-size: 14px;
2578
2626
  line-height: 1.35;
2579
2627
  }
2580
2628
  .pluno-pa-widget__share-prompt-copy .pluno-pa-widget__share-prompt-error {
2581
2629
  color: #ef4444;
2582
2630
  }
2583
2631
  .pluno-pa-widget__share-prompt-actions {
2632
+ grid-column: 2;
2584
2633
  display: flex;
2585
2634
  align-items: center;
2586
2635
  justify-content: space-between;
@@ -2646,7 +2695,7 @@ function Pt(e, t) {
2646
2695
  place-items: center;
2647
2696
  padding: 18px;
2648
2697
  background: rgba(24, 24, 27, 0.28);
2649
- font-family: var(--pluno-pa-font, ${j.fontFamily});
2698
+ font-family: var(--pluno-pa-font, ${V.fontFamily});
2650
2699
  color: var(--pluno-pa-text);
2651
2700
  }
2652
2701
  .pluno-pa-widget__share-dialog {
@@ -3660,28 +3709,28 @@ function Pt(e, t) {
3660
3709
  filter: url(#pluno-pa-scribble-wobble-2);
3661
3710
  }
3662
3711
  `;
3663
- if (ca(e, n))
3712
+ if (fa(e, n))
3664
3713
  return;
3665
3714
  const o = e.ownerDocument.createElement("style");
3666
- o.id = zt, o.textContent = n, e.appendChild(o), Qt(e);
3715
+ o.id = $t, o.textContent = n, e.appendChild(o), en(e);
3667
3716
  }
3668
- function da(e) {
3669
- return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gt) === "true";
3717
+ function ma(e) {
3718
+ return e.getElementById($t) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Wt) === "true";
3670
3719
  }
3671
- function Qt(e) {
3672
- e.host instanceof HTMLElement && e.host.setAttribute(Gt, "true");
3720
+ function en(e) {
3721
+ e.host instanceof HTMLElement && e.host.setAttribute(Wt, "true");
3673
3722
  }
3674
- function ca(e, t) {
3723
+ function fa(e, t) {
3675
3724
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3676
3725
  return !1;
3677
3726
  try {
3678
3727
  const n = new CSSStyleSheet();
3679
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Qt(e), !0;
3728
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], en(e), !0;
3680
3729
  } catch {
3681
3730
  return !1;
3682
3731
  }
3683
3732
  }
3684
- async function ua() {
3733
+ async function ba() {
3685
3734
  return document.body ? document.body : await new Promise((e) => {
3686
3735
  const t = new MutationObserver(() => {
3687
3736
  document.body && (t.disconnect(), e(document.body));
@@ -3689,49 +3738,49 @@ async function ua() {
3689
3738
  t.observe(document.documentElement, { childList: !0 });
3690
3739
  });
3691
3740
  }
3692
- function en(e) {
3741
+ function tn(e) {
3693
3742
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3694
3743
  }
3695
- function ga(e) {
3744
+ function wa(e) {
3696
3745
  try {
3697
- const t = window.localStorage.getItem(en(e));
3746
+ const t = window.localStorage.getItem(tn(e));
3698
3747
  if (!t)
3699
- return At();
3748
+ return Tt();
3700
3749
  const n = JSON.parse(t);
3701
3750
  return {
3702
3751
  isOpen: n.isOpen === !0,
3703
3752
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3704
3753
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3705
- launcherPosition: ba(n.launcherPosition) ? n.launcherPosition : null,
3706
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3754
+ launcherPosition: ya(n.launcherPosition) ? n.launcherPosition : null,
3755
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Ot) : [],
3707
3756
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3708
3757
  };
3709
3758
  } catch {
3710
- return At();
3759
+ return Tt();
3711
3760
  }
3712
3761
  }
3713
- async function ha(e) {
3762
+ async function _a(e) {
3714
3763
  if (e.loadSharePromptsDisabled)
3715
3764
  return e.loadSharePromptsDisabled();
3716
3765
  try {
3717
- return window.localStorage.getItem(Ot) === "true";
3766
+ return window.localStorage.getItem(Bt) === "true";
3718
3767
  } catch {
3719
3768
  return !1;
3720
3769
  }
3721
3770
  }
3722
- function ma(e, t) {
3771
+ function xa(e, t) {
3723
3772
  if (e.persistSharePromptsDisabled) {
3724
3773
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3725
3774
  });
3726
3775
  return;
3727
3776
  }
3728
3777
  try {
3729
- t && window.localStorage.setItem(Ot, "true");
3778
+ t && window.localStorage.setItem(Bt, "true");
3730
3779
  } catch {
3731
3780
  return;
3732
3781
  }
3733
3782
  }
3734
- function At() {
3783
+ function Tt() {
3735
3784
  return {
3736
3785
  isOpen: !1,
3737
3786
  composerValue: "",
@@ -3741,43 +3790,43 @@ function At() {
3741
3790
  sharePromptsDisabled: !1
3742
3791
  };
3743
3792
  }
3744
- function fa(e, t) {
3793
+ function va(e, t) {
3745
3794
  try {
3746
- window.localStorage.setItem(en(e), JSON.stringify(t));
3795
+ window.localStorage.setItem(tn(e), JSON.stringify(t));
3747
3796
  } catch {
3748
3797
  return;
3749
3798
  }
3750
3799
  }
3751
- function ba(e) {
3800
+ function ya(e) {
3752
3801
  if (!e || typeof e != "object")
3753
3802
  return !1;
3754
3803
  const t = e;
3755
- return Number.isFinite(t.x) && Number.isFinite(t.y);
3804
+ 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");
3756
3805
  }
3757
- const Tt = /* @__PURE__ */ new WeakSet();
3758
- function wa(e) {
3806
+ const Nt = /* @__PURE__ */ new WeakSet();
3807
+ function Ca(e) {
3759
3808
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3760
3809
  }
3761
- function Nt(e) {
3810
+ function It(e) {
3762
3811
  const t = e.pathname.split("/");
3763
3812
  return t[t.length - 1] ?? "";
3764
3813
  }
3765
- function _a(e, t) {
3814
+ function Ea(e, t) {
3766
3815
  const n = new URL(e.src, document.baseURI);
3767
- return n.href === t.href || n.pathname === t.pathname ? !0 : Nt(n) === Nt(t);
3816
+ return n.href === t.href || n.pathname === t.pathname ? !0 : It(n) === It(t);
3768
3817
  }
3769
- class V extends EventTarget {
3818
+ class q extends EventTarget {
3770
3819
  constructor(t, n) {
3771
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Bn, () => {
3772
- this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3773
- }), this.addPreviewListener(Fn, (o) => {
3820
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
3821
+ this.readyState = q.OPEN, this.dispatchEvent(new Event("open"));
3822
+ }), this.addPreviewListener(Un, (o) => {
3774
3823
  const a = o;
3775
3824
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3776
- }), this.addPreviewListener(Un, () => {
3777
- this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3778
- }), this.addPreviewListener(zn, (o) => {
3825
+ }), this.addPreviewListener(zn, () => {
3826
+ this.readyState = q.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3827
+ }), this.addPreviewListener($n, (o) => {
3779
3828
  const a = o;
3780
- this.readyState = V.CLOSED, this.dispatchEvent(
3829
+ this.readyState = q.CLOSED, this.dispatchEvent(
3781
3830
  new CloseEvent("close", {
3782
3831
  code: a.detail?.code ?? 1e3,
3783
3832
  reason: a.detail?.reason ?? "",
@@ -3785,7 +3834,7 @@ class V extends EventTarget {
3785
3834
  })
3786
3835
  ), this.cleanup();
3787
3836
  }), window.dispatchEvent(
3788
- new CustomEvent(Ce(Rn, this.channelId), {
3837
+ new CustomEvent(Ce(Mn, this.channelId), {
3789
3838
  detail: { socketId: this.socketId, url: t }
3790
3839
  })
3791
3840
  );
@@ -3800,21 +3849,21 @@ class V extends EventTarget {
3800
3849
  extensions = "";
3801
3850
  binaryType = "blob";
3802
3851
  bufferedAmount = 0;
3803
- readyState = V.CONNECTING;
3804
- socketId = xa();
3852
+ readyState = q.CONNECTING;
3853
+ socketId = Sa();
3805
3854
  listeners = /* @__PURE__ */ new Map();
3806
3855
  send(t) {
3807
- if (this.readyState !== V.OPEN)
3856
+ if (this.readyState !== q.OPEN)
3808
3857
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3809
3858
  window.dispatchEvent(
3810
- new CustomEvent(Ce(Mn, this.channelId), {
3859
+ new CustomEvent(Ce(On, this.channelId), {
3811
3860
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3812
3861
  })
3813
3862
  );
3814
3863
  }
3815
3864
  close(t, n) {
3816
- this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3817
- new CustomEvent(Ce(On, this.channelId), {
3865
+ this.readyState !== q.CLOSED && (this.readyState = q.CLOSING, window.dispatchEvent(
3866
+ new CustomEvent(Ce(Bn, this.channelId), {
3818
3867
  detail: { socketId: this.socketId, code: t, reason: n }
3819
3868
  })
3820
3869
  ), this.cleanup());
@@ -3831,7 +3880,7 @@ class V extends EventTarget {
3831
3880
  this.listeners.clear();
3832
3881
  }
3833
3882
  }
3834
- function xa() {
3883
+ function Sa() {
3835
3884
  const e = window.sessionStorage.getItem(ut);
3836
3885
  if (e)
3837
3886
  return e;
@@ -3841,26 +3890,26 @@ function xa() {
3841
3890
  function Ce(e, t) {
3842
3891
  return `${e}:${t}`;
3843
3892
  }
3844
- function va(e) {
3893
+ function ka(e) {
3845
3894
  const t = document.currentScript;
3846
3895
  if (t instanceof HTMLScriptElement)
3847
3896
  return [t];
3848
3897
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3849
3898
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3850
- (a) => a instanceof HTMLScriptElement && wa(a) && _a(a, o)
3899
+ (a) => a instanceof HTMLScriptElement && Ca(a) && Ea(a, o)
3851
3900
  );
3852
3901
  }
3853
- function ya(e) {
3854
- for (const t of va(e)) {
3855
- if (Tt.has(t) || t.dataset.plunoAutoMount === "false")
3902
+ function La(e) {
3903
+ for (const t of ka(e)) {
3904
+ if (Nt.has(t) || t.dataset.plunoAutoMount === "false")
3856
3905
  continue;
3857
- Tt.add(t);
3906
+ Nt.add(t);
3858
3907
  const n = t.dataset.plunoPreviewChannel;
3859
- ro({
3908
+ lo({
3860
3909
  token: t.dataset.plunoToken,
3861
3910
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3862
3911
  backendUrl: t.dataset.plunoBackendUrl,
3863
- webSocketFactory: n ? io(n) : void 0,
3912
+ webSocketFactory: n ? ro(n) : void 0,
3864
3913
  launcherLabel: t.dataset.plunoLauncherLabel,
3865
3914
  accentColor: t.dataset.plunoAccentColor,
3866
3915
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3872,8 +3921,8 @@ function ya(e) {
3872
3921
  });
3873
3922
  }
3874
3923
  }
3875
- ya(import.meta.url);
3924
+ La(import.meta.url);
3876
3925
  export {
3877
- io as createProductAgentPreviewBridgeWebSocketFactory,
3878
- ro as mountPlunoProductAgentWidget
3926
+ ro as createProductAgentPreviewBridgeWebSocketFactory,
3927
+ lo as mountPlunoProductAgentWidget
3879
3928
  };