@pluno/product-agent-web 0.1.38 → 0.1.40

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 hn } from "./product-agent-sdk.js";
2
+ const mn = "#7c3aed";
3
+ function fn(e) {
4
+ const t = _n(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 se = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
79
- function It(e) {
80
- const t = Dt(e);
81
- if (st(fe(t), lt) >= pt)
78
+ const se = "#2c2a1e", st = [253, 250, 241], dt = 3.5;
79
+ function Bt(e) {
80
+ const t = Ot(e);
81
+ if (ct(fe(t), st) >= dt)
82
82
  return t;
83
83
  let o = fe(t);
84
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 = xn(o, a, 0.22), ct(o, st) >= dt)
87
+ return $e(o);
88
+ return $e(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 bn(e) {
91
+ const t = Bt(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,7 +101,7 @@ 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="${wn()}" 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
106
  <path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
107
107
  <g transform="rotate(-2 528 463)">
@@ -117,7 +117,7 @@ function gn(e) {
117
117
  </g>
118
118
  </svg>`;
119
119
  }
120
- function hn() {
120
+ function wn() {
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 _n(e) {
129
+ const t = Ot(e), n = Ge(fe(t));
130
130
  return n > 0.86 ? {
131
131
  top: "#ffffff",
132
132
  middle: "#f6f6f6",
@@ -162,9 +162,9 @@ function mn(e) {
162
162
  shadow: $(t, -0.25, -0.08)
163
163
  };
164
164
  }
165
- function Dt(e) {
165
+ function Ot(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()}` : mn;
168
168
  }
169
169
  function fe(e) {
170
170
  return [
@@ -173,23 +173,23 @@ function fe(e) {
173
173
  Number.parseInt(e.slice(5, 7), 16)
174
174
  ];
175
175
  }
176
- function Ue([e, t, n]) {
176
+ function $e([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 Ge([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;
184
184
  };
185
185
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
186
186
  }
187
- function st(e, t) {
188
- const n = ze(e), o = ze(t), [a, i] = n > o ? [n, o] : [o, n];
187
+ function ct(e, t) {
188
+ const n = Ge(e), o = Ge(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 = $e(n);
191
+ function xn(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,
@@ -197,43 +197,43 @@ function fn(e, t, n) {
197
197
  ];
198
198
  }
199
199
  function $(e, t, n) {
200
- const [o, a, i] = bn(fe(e));
201
- return Ue(wn(o, $e(a + n), $e(i + t)));
200
+ const [o, a, i] = vn(fe(e));
201
+ return $e(yn(o, We(a + n), We(i + t)));
202
202
  }
203
- function bn([e, t, n]) {
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;
203
+ function vn([e, t, n]) {
204
+ const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), c = (l + s) / 2;
205
205
  if (l === s)
206
- return [0, 0, u];
207
- const d = l - s, p = u > 0.5 ? d / (2 - l - s) : d / (l + s);
208
- return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, p, u];
206
+ return [0, 0, c];
207
+ const u = l - s, p = c > 0.5 ? u / (2 - l - s) : u / (l + s);
208
+ return [(l === o ? (a - i) / u + (a < i ? 6 : 0) : l === a ? (i - o) / u + 2 : (o - a) / u + 4) / 6, p, c];
209
209
  }
210
- function wn(e, t, n) {
210
+ function yn(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
+ Be(a, o, e + 1 / 3) * 255,
216
+ Be(a, o, e) * 255,
217
+ Be(a, o, e - 1 / 3) * 255
218
218
  ];
219
219
  }
220
- function Re(e, t, n) {
220
+ function Be(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 $e(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 Ut = "suggest_share_on_socials";
228
+ function Cn(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 !== Ut)
232
232
  continue;
233
- const o = dt(e, t, "assistant");
233
+ const o = ut(e, t, "assistant");
234
234
  if (!o)
235
235
  return null;
236
- const a = dt(e, o.index, "user");
236
+ const a = ut(e, o.index, "user");
237
237
  return a ? {
238
238
  id: `share:${n.callId ?? n.id}`,
239
239
  userPrompt: a.content,
@@ -242,13 +242,13 @@ 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 En(e) {
246
+ const t = await Sn(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 })]);
250
250
  }
251
- function dt(e, t, n) {
251
+ function ut(e, t, n) {
252
252
  for (let o = t - 1; o >= 0; o -= 1) {
253
253
  const a = e[o];
254
254
  if (a.role === n && a.content.trim())
@@ -256,73 +256,73 @@ function dt(e, t, n) {
256
256
  }
257
257
  return null;
258
258
  }
259
- async function vn(e) {
259
+ async function Sn(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 kn = "https://app.pluno.ai", Ln = "/api/product-agent/embed/active-users", An = 1800, Pn = 15e3, Tn = 250, Nn = 1e3, In = 3e4;
263
+ function Dn(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
- d();
270
- }, In(p)));
271
- }, u = (p) => {
269
+ u();
270
+ }, Bn(p)));
271
+ }, c = (p) => {
272
272
  if (l(), o === null) {
273
273
  o = p, e(p);
274
274
  return;
275
275
  }
276
- const w = o, x = performance.now();
276
+ const m = o, x = performance.now();
277
277
  i = window.setInterval(() => {
278
278
  if (n) {
279
279
  l();
280
280
  return;
281
281
  }
282
- const P = Math.min(1, (performance.now() - x) / En);
283
- o = Math.round(w + (p - w) * Dn(P)), e(o), P >= 1 && (o = p, e(p), l());
284
- }, kn);
285
- }, d = async () => {
282
+ const A = Math.min(1, (performance.now() - x) / An);
283
+ o = Math.round(m + (p - m) * On(A)), e(o), A >= 1 && (o = p, e(p), l());
284
+ }, Tn);
285
+ }, u = async () => {
286
286
  try {
287
- const p = await Tn(t);
287
+ const p = await Rn(t);
288
288
  if (n)
289
289
  return;
290
- u(p.count), s(p.refreshAfterMs);
290
+ c(p.count), s(p.refreshAfterMs);
291
291
  } catch {
292
- s(Sn);
292
+ s(Pn);
293
293
  }
294
294
  };
295
- return d(), () => {
295
+ return u(), () => {
296
296
  n = !0, a !== null && window.clearTimeout(a), l();
297
297
  };
298
298
  }
299
- async function Tn(e) {
299
+ async function Rn(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(Ln, Mn(e.backendUrl ?? kn)).toString(), {
303
303
  cache: "no-store",
304
304
  credentials: "omit"
305
305
  });
306
306
  if (!n.ok)
307
307
  throw new Error("Failed to load active users");
308
- const o = await n.json(), a = ct(o.count), i = ct(o.refreshAfterMs ?? o.refresh_after_ms);
308
+ const o = await n.json(), a = gt(o.count), i = gt(o.refreshAfterMs ?? o.refresh_after_ms);
309
309
  if (a === null || i === null)
310
310
  throw new Error("Invalid active users response");
311
311
  return { count: a, refreshAfterMs: i };
312
312
  }
313
- function ct(e) {
313
+ function gt(e) {
314
314
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
315
315
  }
316
- function Nn(e) {
316
+ function Mn(e) {
317
317
  return e.endsWith("/") ? e : `${e}/`;
318
318
  }
319
- function In(e) {
320
- return Math.min(Pn, Math.max(Ln, e));
319
+ function Bn(e) {
320
+ return Math.min(In, Math.max(Nn, e));
321
321
  }
322
- function Dn(e) {
322
+ function On(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", $n = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, Wn = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Gn = Array.from(Bt).join(","), Hn = 3, V = {
325
+ const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-agent:sdk-preview-socket-send", zn = "product-agent:sdk-preview-socket-close", $n = "product-agent:sdk-preview-socket-open", Gn = "product-agent:sdk-preview-socket-message", Wn = "product-agent:sdk-preview-socket-error", Hn = "product-agent:sdk-preview-socket-closed", ht = "product-agent:sdk-preview-socket-id", qn = "product-agent:preview-diagnostic", zt = "pluno.productAgent.sharePromptsDisabled", ke = 10, jn = 10 * 1024 * 1024, $t = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Vn = Array.from($t).join(","), Yn = 3, G = {
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, Yn = 520, Kn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, We = 50, Qn = "http://www.w3.org/2000/svg", ht = [
333
+ }, Kn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', mt = "pluno-pa-scribble-font", Gt = 190, Wt = 41, Xn = 48, Zn = 420, Jn = 520, Qn = 0.24, eo = 680, to = 800, no = 0.76, O = 8, He = 50, oo = "http://www.w3.org/2000/svg", ft = [
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", $t = "data-pluno-pa-widget-styles";
371
- function io(e) {
372
- return (t) => new q(t, e);
370
+ ], ao = 11, io = 13, bt = 4, ro = 10, lo = 40, po = "movable-launcher-position-v2", Ht = "pluno-pa-widget-styles", qt = "data-pluno-pa-widget-styles";
371
+ let wt = 0;
372
+ function so(e) {
373
+ return (t) => new Y(t, e);
373
374
  }
374
- async function ro(e = {}) {
375
+ async function co(e = {}) {
375
376
  const t = {
376
- launcherLabel: e.launcherLabel ?? V.launcherLabel,
377
- accentColor: e.accentColor ?? V.accentColor,
378
- colorScheme: e.colorScheme ?? V.colorScheme,
379
- fontFamily: e.fontFamily ?? V.fontFamily,
380
- scribbleStyle: e.scribbleStyle ?? V.scribbleStyle,
381
- position: e.position ?? V.position,
382
- movableLauncher: e.movableLauncher ?? V.movableLauncher,
377
+ launcherLabel: e.launcherLabel ?? G.launcherLabel,
378
+ accentColor: e.accentColor ?? G.accentColor,
379
+ colorScheme: e.colorScheme ?? G.colorScheme,
380
+ fontFamily: e.fontFamily ?? G.fontFamily,
381
+ scribbleStyle: e.scribbleStyle ?? G.scribbleStyle,
382
+ position: e.position ?? G.position,
383
+ movableLauncher: e.movableLauncher ?? G.movableLauncher,
383
384
  token: e.token,
384
385
  tokenProvider: e.tokenProvider,
385
386
  tokenEndpoint: e.tokenEndpoint,
@@ -392,7 +393,12 @@ async function ro(e = {}) {
392
393
  webSocketFactory: e.webSocketFactory,
393
394
  loginRequired: e.loginRequired === !0,
394
395
  loginButtonLabel: e.loginButtonLabel ?? "Log in to Pluno",
396
+ loginUrl: e.loginUrl,
395
397
  onLoginClick: e.onLoginClick,
398
+ signupRequired: e.signupRequired === !0,
399
+ signupButtonLabel: e.signupButtonLabel ?? "Complete signup",
400
+ signupUrl: e.signupUrl,
401
+ onSignupClick: e.onSignupClick,
396
402
  socialPostDraftHandler: e.socialPostDraftHandler,
397
403
  billingStatus: e.billingStatus ?? null,
398
404
  billingStatusLoader: e.billingStatusLoader,
@@ -401,7 +407,7 @@ async function ro(e = {}) {
401
407
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
402
408
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
403
409
  };
404
- X("web-sdk.widget", "Mounting widget with merged options", {
410
+ V("web-sdk.widget", "Mounting widget with merged options", {
405
411
  accentColor: t.accentColor,
406
412
  colorScheme: t.colorScheme,
407
413
  fontFamily: t.fontFamily,
@@ -416,32 +422,32 @@ async function ro(e = {}) {
416
422
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
417
423
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
418
424
  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
- Eo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
421
- const l = await ma(), s = l.ownerDocument;
422
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), bt(a, i, {
425
+ let i = _t(t.accentColor, t.scribbleStyle);
426
+ Ao(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
427
+ const l = await _a(), s = l.ownerDocument;
428
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), It(o, t.accentColor), xt(a, i, {
423
429
  accentColor: t.accentColor,
424
430
  colorScheme: t.colorScheme,
425
431
  fontFamily: t.fontFamily,
426
432
  scribbleStyle: t.scribbleStyle
427
- }), X("web-sdk.widget", "Applied initial widget appearance", {
433
+ }), V("web-sdk.widget", "Applied initial widget appearance", {
428
434
  accentColor: t.accentColor,
429
435
  colorScheme: t.colorScheme,
430
436
  fontFamily: t.fontFamily,
431
437
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
432
438
  });
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"), P = 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"), J = 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 || !P || !C || !M || !v || !y || !h || !g || !_ || !N || !J || !ce || !S || !f)
439
+ const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), m = 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"), B = 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"), T = a.querySelector(".pluno-pa-widget__new-chat"), Q = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), k = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
440
+ if (!c || !p || !m || !x || !A || !C || !B || !v || !y || !h || !g || !_ || !T || !Q || !ce || !k || !b)
435
441
  throw new Error("Failed to mount Pluno widget");
436
- if (t.movableLauncher && !d)
442
+ if (t.movableLauncher && !u)
437
443
  throw new Error("Failed to mount Pluno widget drag handle");
438
- xt(p), xt(g);
439
- let m = [], T = null;
444
+ Ct(p), Ct(g);
445
+ let f = [], N = null;
440
446
  const L = () => {
441
- Fo(v, m, (r) => {
442
- m = m.filter((c, k) => k !== r), L(), O(b.getState()), U();
447
+ Wo(v, f, (r) => {
448
+ f = f.filter((d, E) => E !== r), L(), R(w.getState()), F();
443
449
  });
444
- }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
450
+ }, I = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
445
451
  if (!t.tokenEndpoint)
446
452
  throw new Error("Pluno widget requires token or tokenEndpoint");
447
453
  const r = await fetch(t.tokenEndpoint, {
@@ -452,63 +458,63 @@ async function ro(e = {}) {
452
458
  });
453
459
  if (!r.ok)
454
460
  throw new Error("Failed to load Pluno token");
455
- const c = await r.json();
456
- if (!c.token)
461
+ const d = await r.json();
462
+ if (!d.token)
457
463
  throw new Error("Pluno token endpoint did not return a token");
458
- return c.token;
459
- }), A = window.fetch.bind(window);
460
- let b;
461
- b = await dn.init({
464
+ return d.token;
465
+ }), P = window.fetch.bind(window);
466
+ let w;
467
+ w = await hn.init({
462
468
  token: t.token,
463
469
  tokenProvider: I,
464
470
  backendUrl: t.backendUrl,
465
471
  metadata: () => ({
466
472
  ...t.metadata ?? {},
467
- ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
473
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
468
474
  }),
469
475
  initialStarterPrompts: t.initialStarterPrompts,
470
476
  clientId: t.clientId,
471
477
  restorePersistedState: t.restorePersistedState,
472
478
  expectedPersistedSessionId: t.expectedPersistedSessionId,
473
479
  webSocketFactory: t.webSocketFactory,
474
- autoConnect: t.loginRequired ? !1 : void 0
480
+ autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
475
481
  });
476
- const Q = fa(t), Se = new Set(Q.openToolGroupKeys), re = new Set(Q.seenShareCandidateIds), be = new Set(re);
477
- let ke = Q.sharePromptsDisabled || await ba(t), G = t.movableLauncher ? Q.launcherPosition : null, Ye = G !== null, K = null, Le = !1, ee = !1, te = {
482
+ const ee = xa(t), Le = new Set(ee.openToolGroupKeys), re = new Set(ee.seenShareCandidateIds), be = new Set(re);
483
+ let Ae = ee.sharePromptsDisabled || await va(t), H = t.movableLauncher ? ee.launcherPosition : null, Xe = H !== null, X = null, Pe = !1, te = !1, ne = {
478
484
  enabled: !0
479
- }, ne = 0, Ke = "";
480
- const H = (r, c) => {
481
- te = { enabled: r, reason: c };
485
+ }, oe = 0, Ze = "";
486
+ const q = (r, d) => {
487
+ ne = { enabled: r, reason: d };
482
488
  }, j = () => {
483
- J.hidden = !0;
484
- }, tn = () => {
485
- J.hidden = !1;
486
- }, nn = (r = "jump") => {
487
- H(!0, r), j(), me(S, () => te.enabled), ne = S.scrollTop;
488
- }, on = () => {
489
- 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 = Ge(a, r);
494
- return wt(
489
+ Q.hidden = !0;
490
+ }, rn = () => {
491
+ Q.hidden = !1;
492
+ }, ln = (r = "jump") => {
493
+ q(!0, r), j(), me(k, () => ne.enabled), oe = k.scrollTop;
494
+ }, pn = () => {
495
+ Pe || typeof document > "u" || (It(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
496
+ }, Je = new MutationObserver(pn);
497
+ Je.observe(s.documentElement, { childList: !0, subtree: !0 });
498
+ const Te = (r = !0) => {
499
+ const d = qe(a, r);
500
+ return vt(
495
501
  a,
496
- G ? ho(G, c) : go(a, t.position, c),
497
- c
502
+ H ? wo(H, d) : bo(a, t.position, d),
503
+ d
498
504
  );
499
- }, F = () => {
500
- _a(t, {
505
+ }, U = () => {
506
+ Ca(t, {
501
507
  isOpen: a.classList.contains("pluno-pa-widget--open"),
502
508
  composerValue: g.value,
503
- openToolGroupKeys: [...Se],
504
- launcherPosition: Ye ? G : null,
505
- seenShareCandidateIds: [...re].slice(-Mt),
506
- sharePromptsDisabled: ke
509
+ openToolGroupKeys: [...Le],
510
+ launcherPosition: Xe ? H : null,
511
+ seenShareCandidateIds: [...re].slice(-Ft),
512
+ sharePromptsDisabled: Ae
507
513
  });
508
- }, oe = (r, c = {}) => {
509
- vo(r, {
510
- debugVersion: ao,
511
- launcherPosition: G,
514
+ }, ae = (r, d = {}) => {
515
+ So(r, {
516
+ debugVersion: po,
517
+ launcherPosition: H,
512
518
  rootClasses: a.className,
513
519
  rootStyle: {
514
520
  left: a.style.left,
@@ -516,151 +522,158 @@ async function ro(e = {}) {
516
522
  right: a.style.right,
517
523
  bottom: a.style.bottom
518
524
  },
519
- rootRect: Me(a),
520
- launcherRect: Me(u),
521
- panelRect: Me(w),
522
- viewport: Y(),
523
- panelHidden: w.hidden,
525
+ rootRect: Oe(a),
526
+ launcherRect: Oe(c),
527
+ panelRect: Oe(m),
528
+ viewport: K(),
529
+ panelHidden: m.hidden,
524
530
  closeHidden: x.hidden,
525
- ...c
531
+ ...d
526
532
  });
527
533
  }, we = (r = !0) => {
528
- if (!G)
529
- return xe(a, null), Pe(r);
530
- const c = Pe(r);
531
- return xe(a, c), oe("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
532
- }, Ze = (r, c) => {
533
- if (!r || !c) {
534
- xo(a);
534
+ if (!H)
535
+ return ye(a, null), Te(r);
536
+ const d = Te(r);
537
+ return ye(a, d), ae("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
538
+ }, Qe = (r, d) => {
539
+ if (!r || !d) {
540
+ Eo(a);
535
541
  return;
536
542
  }
537
- _o(a, {
538
- x: r.x - c.x,
539
- y: r.y - c.y
543
+ Co(a, {
544
+ x: r.x - d.x,
545
+ y: r.y - d.y
540
546
  });
541
- }, Je = () => {
547
+ }, et = () => {
542
548
  const r = we();
543
549
  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), oe("Applied open panel position after viewport resize", { openPanelPosition: c });
546
- } else G && oe("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
550
+ const d = yt(a, r, t.position);
551
+ Qe(d, r), ae("Applied open panel position after viewport resize", { openPanelPosition: d });
552
+ } else H && ae("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
547
553
  };
548
- let Qe = () => {
554
+ let tt = () => {
549
555
  };
550
- window.addEventListener("resize", Je), t.movableLauncher && d ? (we(), Qe = uo({
556
+ window.addEventListener("resize", et), t.movableLauncher && u ? (we(), tt = fo({
551
557
  root: a,
552
- launcher: u,
553
- launcherDragHandle: d,
554
- getPosition: () => Pe(),
558
+ launcher: c,
559
+ launcherDragHandle: u,
560
+ getPosition: () => Te(),
555
561
  setPosition: (r) => {
556
- const c = r, k = Ge(a), z = wt(a, r, k);
557
- G = mo(z, k), xe(a, z), oe("Dragging closed launcher", { requestedPosition: c });
562
+ const d = r, E = qe(a), z = vt(a, r, E);
563
+ H = _o(z, E), ye(a, z), ae("Dragging closed launcher", { requestedPosition: d });
558
564
  },
559
565
  persist: () => {
560
- Ye = !0, F(), oe("Persisted closed launcher drag position");
566
+ Xe = !0, U(), ae("Persisted closed launcher drag position");
561
567
  }
562
- })) : xe(a, null);
563
- let Ae = !1;
564
- const et = async () => {
565
- if (!(!t.billingStatusLoader || Ae)) {
566
- Ae = !0;
568
+ })) : ye(a, null);
569
+ let Ne = !1;
570
+ const nt = async () => {
571
+ if (!(!t.billingStatusLoader || Ne)) {
572
+ Ne = !0;
567
573
  try {
568
574
  const r = await t.billingStatusLoader();
569
- yt(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Fe(M, t.billingStatus, b.getState().lastErrorCode), U());
575
+ St(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, ze(B, t.billingStatus, w.getState().lastErrorCode), F());
570
576
  } finally {
571
- Ae = !1;
577
+ Ne = !1;
572
578
  }
573
579
  }
574
- }, ae = (r = "", c = !0) => {
575
- et(), K !== null && (window.clearTimeout(K), K = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
576
- const k = we(), z = _t(a, k, t.position);
577
- if (Ze(z, k), oe("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: k }), H(!0, "open"), j(), !c) {
578
- a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => te.enabled), ne = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
580
+ }, ie = (r = "", d = !0) => {
581
+ nt(), X !== null && (window.clearTimeout(X), X = null), m.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
582
+ const E = we(), z = yt(a, E, t.position);
583
+ if (Qe(z, E), ae("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: E }), q(!0, "open"), j(), !d) {
584
+ a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, he(g)), me(k, () => ne.enabled), oe = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), U();
579
585
  return;
580
586
  }
581
587
  window.requestAnimationFrame(() => {
582
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => te.enabled), ne = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), K = window.setTimeout(() => {
583
- u.hidden = !0, me(S, () => te.enabled), ne = S.scrollTop;
588
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(k, () => ne.enabled), oe = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), U(), X = window.setTimeout(() => {
589
+ c.hidden = !0, me(k, () => ne.enabled), oe = k.scrollTop;
584
590
  }, 220);
585
591
  });
586
- }, an = () => {
587
- K !== null && (window.clearTimeout(K), K = null), u.hidden = !1, G && (we(!1), oe("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), K = window.setTimeout(() => {
588
- w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
592
+ }, sn = () => {
593
+ X !== null && (window.clearTimeout(X), X = null), c.hidden = !1, H && (we(!1), ae("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), U(), X = window.setTimeout(() => {
594
+ m.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
589
595
  }, 220);
590
596
  };
591
- u.addEventListener("submit", (r) => {
592
- r.preventDefault(), ae(p.value), p.value = "";
593
- }), d?.addEventListener("click", (r) => {
597
+ c.addEventListener("submit", (r) => {
598
+ r.preventDefault(), ie(p.value), p.value = "";
599
+ }), u?.addEventListener("click", (r) => {
594
600
  r.preventDefault(), r.stopPropagation();
595
- }), u.addEventListener("click", (r) => {
596
- r.target === p && !d || (ae(p.value), p.value = "");
601
+ }), c.addEventListener("click", (r) => {
602
+ r.target === p && !u || (ie(p.value), p.value = "");
597
603
  }), p.addEventListener("focus", () => {
598
- ae(p.value), p.value = "";
604
+ ie(p.value), p.value = "";
599
605
  }), p.addEventListener("input", () => {
600
606
  if (!p.value)
601
607
  return;
602
608
  const r = p.value;
603
- ae(r), p.value = "";
604
- }), x.addEventListener("click", an), S.addEventListener("scroll", () => {
605
- S.scrollTop < ne - 1 && H(!1, "userScroll"), ne = S.scrollTop;
606
- }), J.addEventListener("click", () => {
607
- nn();
609
+ ie(r), p.value = "";
610
+ }), x.addEventListener("click", sn), k.addEventListener("scroll", () => {
611
+ k.scrollTop < oe - 1 && q(!1, "userScroll"), oe = k.scrollTop;
612
+ }), Q.addEventListener("click", () => {
613
+ ln();
608
614
  });
609
- const tt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
615
+ const ot = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
610
616
  ([r]) => {
611
- r?.isIntersecting && (H(!0, "bottom"), j());
617
+ r?.isIntersecting && (q(!0, "bottom"), j());
612
618
  },
613
- { root: S, threshold: 0 }
619
+ { root: k, threshold: 0 }
614
620
  );
615
- tt?.observe(f);
616
- const U = () => {
617
- _.disabled = W(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || W(t.billingStatus);
621
+ ot?.observe(b);
622
+ const _e = () => t.loginRequired || t.signupRequired, at = () => {
623
+ const r = _e();
624
+ p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : G.launcherLabel, A.hidden = r;
625
+ }, F = () => {
626
+ _.disabled = W(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && f.length === 0, h.disabled = _e() || W(t.billingStatus);
618
627
  };
619
- t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, P.hidden = !0), P.addEventListener("submit", (r) => {
628
+ at(), A.addEventListener("submit", (r) => {
620
629
  if (r.preventDefault(), t.loginRequired) {
621
630
  t.onLoginClick?.();
622
631
  return;
623
632
  }
624
- W(t.billingStatus) || (ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U());
633
+ if (t.signupRequired) {
634
+ t.onSignupClick?.();
635
+ return;
636
+ }
637
+ W(t.billingStatus) || (te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F());
625
638
  });
626
639
  let ue = 0;
627
- const rn = () => {
640
+ const dn = () => {
628
641
  ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
629
- }, nt = (r) => {
630
- T !== null && window.clearTimeout(T), C.textContent = r, C.hidden = !1, T = window.setTimeout(() => {
631
- C.textContent = "", C.hidden = !0, T = null;
642
+ }, it = (r) => {
643
+ N !== null && window.clearTimeout(N), C.textContent = r, C.hidden = !1, N = window.setTimeout(() => {
644
+ C.textContent = "", C.hidden = !0, N = null;
632
645
  }, 3e3);
633
- }, ln = () => {
634
- T !== null && (window.clearTimeout(T), T = null), C.textContent = "", C.hidden = !0;
635
- }, ot = async (r) => {
646
+ }, cn = () => {
647
+ N !== null && (window.clearTimeout(N), N = null), C.textContent = "", C.hidden = !0;
648
+ }, rt = async (r) => {
636
649
  if (r.length === 0)
637
650
  return;
638
- const c = await Wo(r);
639
- if (m.length + c.length > Ee)
640
- throw new Error(`Attach up to ${Ee} files per message.`);
641
- m = [...m, ...c], L(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || ae();
651
+ const d = await Vo(r);
652
+ if (f.length + d.length > ke)
653
+ throw new Error(`Attach up to ${ke} files per message.`);
654
+ f = [...f, ...d], L(), cn(), F(), R(w.getState()), a.classList.contains("pluno-pa-widget--open") || ie();
642
655
  };
643
656
  h.addEventListener("click", () => {
644
657
  t.loginRequired || W(t.billingStatus) || y.click();
645
658
  }), y.addEventListener("change", () => {
646
659
  const r = Array.from(y.files ?? []);
647
- y.value = "", ot(r).catch((c) => {
648
- nt(c instanceof Error ? c.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
649
- message: c instanceof Error ? c.message : String(c)
660
+ y.value = "", rt(r).catch((d) => {
661
+ it(d instanceof Error ? d.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
662
+ message: d instanceof Error ? d.message : String(d)
650
663
  });
651
664
  });
652
665
  }), a.addEventListener("dragenter", (r) => {
653
- !ve(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ue += 1, a.classList.add("pluno-pa-widget--drag-over"));
666
+ !Ce(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ue += 1, a.classList.add("pluno-pa-widget--drag-over"));
654
667
  }), a.addEventListener("dragover", (r) => {
655
- const c = r.dataTransfer;
656
- !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
668
+ const d = r.dataTransfer;
669
+ !Ce(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
657
670
  }), a.addEventListener("dragleave", (r) => {
658
- ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
671
+ Ce(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
659
672
  }), a.addEventListener("drop", (r) => {
660
- const c = r.dataTransfer;
661
- !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((k) => {
662
- nt(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
663
- message: k instanceof Error ? k.message : String(k)
673
+ const d = r.dataTransfer;
674
+ !Ce(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), dn(), rt(d.files).catch((E) => {
675
+ it(E instanceof Error ? E.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
676
+ message: E instanceof Error ? E.message : String(E)
664
677
  });
665
678
  }));
666
679
  }), _.addEventListener("click", () => {
@@ -668,152 +681,183 @@ async function ro(e = {}) {
668
681
  t.onLoginClick?.();
669
682
  return;
670
683
  }
671
- if (b.getState().isThinking) {
672
- b.stop();
684
+ if (w.getState().isThinking) {
685
+ w.stop();
673
686
  return;
674
687
  }
675
- ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U(), O(b.getState());
676
- }), N.addEventListener("click", () => {
677
- ee = !0, H(!0, "newSession"), j(), b.startNewSession(), Se.clear(), g.value = "", m = [], L(), he(g), F(), U(), g.focus(), O(b.getState());
688
+ te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F(), R(w.getState());
689
+ }), T.addEventListener("click", () => {
690
+ te = !0, q(!0, "newSession"), j(), w.startNewSession(), Le.clear(), g.value = "", f = [], L(), he(g), U(), F(), g.focus(), R(w.getState());
678
691
  }), g.addEventListener("input", () => {
679
- he(g), F(), U(), O(b.getState());
692
+ he(g), U(), F(), R(w.getState());
680
693
  }), g.addEventListener("keydown", (r) => {
681
694
  if (!(r.key !== "Enter" || r.shiftKey)) {
682
695
  if (r.preventDefault(), t.loginRequired) {
683
696
  t.onLoginClick?.();
684
697
  return;
685
698
  }
686
- ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U(), O(b.getState());
699
+ te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F(), R(w.getState());
687
700
  }
688
701
  }), a.addEventListener("click", (r) => {
689
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
690
- }), Q.composerValue && (g.value = Q.composerValue, he(g)), Q.isOpen && ae(g.value, !1);
691
- const at = () => i;
692
- let Te = b.getState().appearance !== null, _e = null, ge = null, le = null, it = b.getState().isThinking, pe = null, Ne = null, rt = () => {
702
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && U();
703
+ }), ee.composerValue && (g.value = ee.composerValue, he(g)), ee.isOpen && ie(g.value, !1);
704
+ const xe = () => i;
705
+ let Ie = w.getState().appearance !== null, ve = null, ge = null, le = null, lt = w.getState().isThinking, pe = null, De = null, pt = () => {
693
706
  };
694
- const pn = !!t.socialPostDraftHandler, O = (r) => {
695
- if (qe(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Fe(M, t.billingStatus, pe), t.loginRequired) {
696
- ta(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
707
+ const un = !!t.socialPostDraftHandler, R = (r) => {
708
+ if (Ke(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), ze(B, t.billingStatus, pe), t.loginRequired) {
709
+ At(
710
+ k,
711
+ _,
712
+ T,
713
+ xe,
714
+ "Log in to use Pluno on this page.",
715
+ t.loginButtonLabel,
716
+ t.loginUrl,
717
+ t.onLoginClick
718
+ );
719
+ return;
720
+ }
721
+ if (t.signupRequired) {
722
+ At(
723
+ k,
724
+ _,
725
+ T,
726
+ xe,
727
+ "Complete signup to unlock your free trial credits.",
728
+ t.signupButtonLabel,
729
+ t.signupUrl,
730
+ t.onSignupClick
731
+ );
697
732
  return;
698
733
  }
699
- const c = yo(r), k = c !== Ke;
700
- Ke = c;
701
- const z = ee || te.enabled;
702
- ee = !1, ea(
703
- S,
704
- f,
734
+ const d = ko(r), E = d !== Ze;
735
+ Ze = d;
736
+ const z = te || ne.enabled;
737
+ te = !1, ia(
738
+ k,
739
+ b,
705
740
  _,
706
- N,
741
+ T,
707
742
  ce,
708
743
  r,
709
- Ne,
710
- Ne !== null && Et(r, g.value.trim().length > 0 || m.length > 0),
744
+ De,
745
+ De !== null && Lt(r, g.value.trim().length > 0 || f.length > 0),
711
746
  z,
712
- () => te.enabled,
713
- Se,
714
- F,
715
- at,
716
- (R) => {
717
- ee = !0, H(!0, "send"), j(), b.sendMessage(R);
747
+ () => ne.enabled,
748
+ Le,
749
+ U,
750
+ xe,
751
+ (M) => {
752
+ te = !0, q(!0, "send"), j(), w.sendMessage(M);
718
753
  },
719
- pn && !ke ? {
754
+ un && !Ae ? {
720
755
  dismissedCandidateIds: be,
721
- draftingCandidateId: _e,
756
+ draftingCandidateId: ve,
722
757
  error: ge,
723
- onSeen: (R) => {
724
- re.add(R.id), F();
758
+ characterIconSvg: xe(),
759
+ onSeen: (M) => {
760
+ re.add(M.id), U();
725
761
  },
726
- onDraft: (R) => {
727
- sn(R);
762
+ onDraft: (M) => {
763
+ gn(M);
728
764
  },
729
- onDismiss: (R) => {
730
- re.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
765
+ onDismiss: (M) => {
766
+ re.add(M.id), be.add(M.id), U(), ge = null, R(w.getState());
731
767
  },
732
- onDisable: (R) => {
733
- ke = !0, re.add(R.id), be.add(R.id), F(), wa(t, !0), ge = null, O(b.getState());
768
+ onDisable: (M) => {
769
+ Ae = !0, re.add(M.id), be.add(M.id), U(), ya(t, !0), ge = null, R(w.getState());
734
770
  }
735
771
  } : void 0
736
- ), z ? (ne = S.scrollTop, j()) : k && Co(r) && tn();
772
+ ), z ? (oe = k.scrollTop, j()) : E && Lo(r) && rn();
737
773
  };
738
- return rt = An((r) => {
739
- Ne = r, !Le && Et(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
740
- }, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), b.on("state", (r) => {
741
- const c = it && !r.isThinking;
742
- it = r.isThinking, r.appearance ? (Te = !0, X("web-sdk.widget", "Agent state supplied appearance", {
774
+ return pt = Dn((r) => {
775
+ De = r, !Pe && Lt(w.getState(), g.value.trim().length > 0 || f.length > 0) && R(w.getState());
776
+ }, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), w.on("state", (r) => {
777
+ const d = lt && !r.isThinking;
778
+ lt = r.isThinking, r.appearance ? (Ie = !0, V("web-sdk.widget", "Agent state supplied appearance", {
743
779
  appearance: r.appearance
744
- }), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
780
+ }), Re(r.appearance, "agent.state.appearance")) : Ie && (Ie = !1, V("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
745
781
  fallbackAccentColor: t.accentColor,
746
782
  fallbackColorScheme: t.colorScheme,
747
783
  fallbackFontFamily: t.fontFamily
748
- }), Ie({}, "agent.state.appearance-cleared")), O(r), U(), c && et();
749
- }), O(b.getState()), U(), {
750
- agent: b,
784
+ }), Re({}, "agent.state.appearance-cleared")), R(r), F(), d && nt();
785
+ }), R(w.getState()), F(), {
786
+ agent: w,
751
787
  updateAppearance: (r) => {
752
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ie(r, "widgetHandle.updateAppearance");
788
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Re(r, "widgetHandle.updateAppearance");
753
789
  },
754
790
  updateBillingStatus: (r) => {
755
- const c = r ?? null;
756
- yt(t.billingStatus, c, pe) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Fe(
791
+ const d = r ?? null;
792
+ St(t.billingStatus, d, pe) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), ze(
757
793
  a.querySelector(".pluno-pa-widget__billing-status"),
758
794
  t.billingStatus,
759
795
  pe
760
- ), U());
796
+ ), F());
797
+ },
798
+ updateAuthGate: (r) => {
799
+ const d = _e();
800
+ t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), at(), R(w.getState()), F(), d && !_e() && w.connect().catch((E) => {
801
+ V("web-sdk.widget", "Failed to connect after auth gate cleared", {
802
+ message: E instanceof Error ? E.message : String(E)
803
+ });
804
+ });
761
805
  },
762
806
  openPanel: () => {
763
- ae(g.value, !1);
807
+ ie(g.value, !1);
764
808
  },
765
809
  destroy: () => {
766
- Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), le?.remove(), b.destroy(), n.remove();
810
+ Pe = !0, Je.disconnect(), ot?.disconnect(), window.removeEventListener("resize", et), tt(), N !== null && window.clearTimeout(N), pt(), le?.remove(), w.destroy(), n.remove();
767
811
  }
768
812
  };
769
- async function sn(r) {
770
- if (!_e) {
771
- _e = r.id, ge = null, O(b.getState());
813
+ async function gn(r) {
814
+ if (!ve) {
815
+ ve = r.id, ge = null, R(w.getState());
772
816
  try {
773
817
  if (!t.socialPostDraftHandler)
774
818
  throw new Error("Social post drafting is not available here.");
775
- const c = await t.socialPostDraftHandler(r);
776
- if (!c.linkedinPost || !c.xPost)
819
+ const d = await t.socialPostDraftHandler(r);
820
+ if (!d.linkedinPost || !d.xPost)
777
821
  throw new Error("Pluno did not return a complete social post draft.");
778
- re.add(r.id), be.add(r.id), F(), le?.remove(), le = aa(c, {
822
+ re.add(r.id), be.add(r.id), U(), le?.remove(), le = pa(d, {
779
823
  socialPostRewardsUrl: t.socialPostRewardsUrl,
780
824
  onClose: () => {
781
825
  le?.remove(), le = null;
782
826
  }
783
827
  }), a.appendChild(le);
784
- } catch (c) {
785
- ge = c instanceof Error ? c.message : "Could not draft social post.";
828
+ } catch (d) {
829
+ ge = d instanceof Error ? d.message : "Could not draft social post.";
786
830
  } finally {
787
- _e = null, O(b.getState());
831
+ ve = null, R(w.getState());
788
832
  }
789
833
  }
790
834
  }
791
- function Ie(r, c) {
792
- const k = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
793
- i = ft(k, De), bt(a, i, {
794
- accentColor: k,
835
+ function Re(r, d) {
836
+ const E = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Me = r.scribbleStyle ?? t.scribbleStyle;
837
+ i = _t(E, Me), xt(a, i, {
838
+ accentColor: E,
795
839
  colorScheme: z,
796
- fontFamily: R,
797
- scribbleStyle: De
798
- }), X("web-sdk.widget", "Updated widget appearance", {
799
- source: c,
840
+ fontFamily: M,
841
+ scribbleStyle: Me
842
+ }), V("web-sdk.widget", "Updated widget appearance", {
843
+ source: d,
800
844
  inputAppearance: r,
801
- appliedAccentColor: k,
845
+ appliedAccentColor: E,
802
846
  appliedColorScheme: z,
803
- appliedFontFamily: R,
804
- appliedScribbleStyle: De,
847
+ appliedFontFamily: M,
848
+ appliedScribbleStyle: Me,
805
849
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
806
850
  });
807
851
  }
808
852
  }
809
- function ft(e, t) {
810
- return t ? gn(e) : un(e);
853
+ function _t(e, t) {
854
+ return t ? bn(e) : fn(e);
811
855
  }
812
- function lo(e) {
813
- const t = po(e);
814
- return t === null ? "#fafafa" : so(t) > 0.5 ? "#18181b" : "#fafaf9";
856
+ function uo(e) {
857
+ const t = go(e);
858
+ return t === null ? "#fafafa" : ho(t) > 0.5 ? "#18181b" : "#fafaf9";
815
859
  }
816
- function po(e) {
860
+ function go(e) {
817
861
  const t = e.trim();
818
862
  return /^#[0-9a-f]{6}$/i.test(t) ? [
819
863
  Number.parseInt(t.slice(1, 3), 16),
@@ -825,26 +869,26 @@ function po(e) {
825
869
  Number.parseInt(t[3] + t[3], 16)
826
870
  ] : null;
827
871
  }
828
- function so([e, t, n]) {
872
+ function ho([e, t, n]) {
829
873
  const o = (a) => {
830
874
  const i = a / 255;
831
875
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
832
876
  };
833
877
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
834
878
  }
835
- function bt(e, t, n) {
879
+ function xt(e, t, n) {
836
880
  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);
881
+ const o = n.scribbleStyle ? Bt(n.accentColor) : n.accentColor;
882
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", uo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Kn : n.fontFamily, n.scribbleStyle && mo(e.ownerDocument);
839
883
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
840
884
  for (const i of a)
841
- i.replaceWith(ie(Array.from(i.classList).join(" "), t));
885
+ i.replaceWith(Z(Array.from(i.classList).join(" "), t));
842
886
  }
843
- function co(e) {
844
- if (e.getElementById(gt))
887
+ function mo(e) {
888
+ if (e.getElementById(mt))
845
889
  return;
846
890
  const t = e.createElement("style");
847
- t.id = gt, t.textContent = `@font-face {
891
+ t.id = mt, t.textContent = `@font-face {
848
892
  font-family: "Architects Daughter";
849
893
  font-style: normal;
850
894
  font-weight: 400;
@@ -852,7 +896,7 @@ function co(e) {
852
896
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
853
897
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
854
898
  }
855
- function uo({
899
+ function fo({
856
900
  root: e,
857
901
  launcher: t,
858
902
  launcherDragHandle: n,
@@ -860,137 +904,137 @@ function uo({
860
904
  setPosition: a,
861
905
  persist: i
862
906
  }) {
863
- let l = null, s = null, u = null, d = !1, p = null;
864
- const w = () => {
865
- l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
907
+ let l = null, s = null, c = null, u = !1, p = null;
908
+ const m = () => {
909
+ l = null, s = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
866
910
  }, x = (h) => {
867
- 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
- }, P = (h) => {
869
- if (l !== h.pointerId || !s || !u)
911
+ 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 }, c = o(), u = !1, t.setPointerCapture?.(h.pointerId));
912
+ }, A = (h) => {
913
+ if (l !== h.pointerId || !s || !c)
870
914
  return;
871
915
  h.preventDefault();
872
916
  const g = h.clientX - s.x, _ = h.clientY - s.y;
873
- !d && Math.hypot(g, _) < mt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: u.x + g, y: u.y + _ }));
917
+ !u && Math.hypot(g, _) < bt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
874
918
  }, C = (h) => {
875
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (p = { x: h.clientX, y: h.clientY }, i()), w());
876
- }, M = (h) => {
877
- l === h.pointerId && (h.preventDefault(), w());
919
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (p = { x: h.clientX, y: h.clientY }, i()), m());
920
+ }, B = (h) => {
921
+ l === h.pointerId && (h.preventDefault(), m());
878
922
  }, v = (h) => {
879
923
  if (!p)
880
924
  return;
881
- const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= mt;
925
+ const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= bt;
882
926
  p = null, g && (h.preventDefault(), h.stopPropagation());
883
927
  }, y = (h) => {
884
928
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
885
929
  return;
886
- const g = h.shiftKey ? oo : no, _ = o();
887
- let N = null;
888
- 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());
930
+ const g = h.shiftKey ? lo : ro, _ = o();
931
+ let T = null;
932
+ h.key === "ArrowUp" ? T = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? T = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? T = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (T = { x: _.x + g, y: _.y }), T && (h.preventDefault(), h.stopPropagation(), a(T), i());
889
933
  };
890
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), 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", P), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
934
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", B), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
935
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", B), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
892
936
  };
893
937
  }
894
- function Ge(e, t = !0) {
895
- const n = Y(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
938
+ function qe(e, t = !0) {
939
+ const n = K(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
896
940
  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
941
+ width: t && a && o.width > 0 ? o.width : Math.min(Gt, n.width - 36),
942
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Xn : Wt
899
943
  };
900
944
  }
901
- function Wt() {
902
- const e = Y();
945
+ function jt() {
946
+ const e = K();
903
947
  return {
904
948
  width: Math.min(
905
- de(e.width * Kn, qn, Yn),
906
- e.width - B * 2
949
+ de(e.width * Qn, Zn, Jn),
950
+ e.width - O * 2
907
951
  ),
908
952
  height: Math.min(
909
- de(e.height * Jn, Xn, Zn),
910
- e.height - We - B
953
+ de(e.height * no, eo, to),
954
+ e.height - He - O
911
955
  )
912
956
  };
913
957
  }
914
- function go(e, t, n) {
958
+ function bo(e, t, n) {
915
959
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
916
960
  if (Number.isFinite(o) && Number.isFinite(a))
917
961
  return { x: o, y: a };
918
962
  const i = e.getBoundingClientRect();
919
963
  if (i.width > 0 || i.height > 0)
920
964
  return { x: i.left, y: i.top };
921
- const l = Y();
965
+ const l = K();
922
966
  return {
923
967
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
924
968
  y: l.height - 24 - n.height
925
969
  };
926
970
  }
927
- function wt(e, t, n) {
928
- const o = Y(), a = B + bo(e);
971
+ function vt(e, t, n) {
972
+ const o = K(), a = O + vo(e);
929
973
  return {
930
- x: de(t.x, B, Math.max(B, o.width - n.width - B)),
931
- y: de(t.y, a, Math.max(a, o.height - n.height - B))
974
+ x: de(t.x, O, Math.max(O, o.width - n.width - O)),
975
+ y: de(t.y, a, Math.max(a, o.height - n.height - O))
932
976
  };
933
977
  }
934
- function ho(e, t) {
935
- const n = Y();
978
+ function wo(e, t) {
979
+ const n = K();
936
980
  return {
937
981
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
938
982
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
939
983
  };
940
984
  }
941
- function mo(e, t) {
942
- const n = fo(e, t), o = Y();
985
+ function _o(e, t) {
986
+ const n = xo(e, t), o = K();
943
987
  return {
944
988
  anchor: n,
945
989
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
946
990
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
947
991
  };
948
992
  }
949
- function fo(e, t) {
950
- 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";
993
+ function xo(e, t) {
994
+ const n = K(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
951
995
  return `${i}-${l}`;
952
996
  }
953
- function bo(e) {
954
- return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
997
+ function vo(e) {
998
+ return e.classList.contains("pluno-pa-widget--scribble") ? io : ao;
955
999
  }
956
- function _t(e, t, n) {
957
- const o = Ge(e), a = Wt(), i = {
1000
+ function yt(e, t, n) {
1001
+ const o = qe(e), a = jt(), i = {
958
1002
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
959
1003
  y: t.y + o.height - a.height
960
1004
  };
961
- return wo(i);
1005
+ return yo(i);
962
1006
  }
963
- function wo(e) {
964
- const t = Y(), n = Wt();
1007
+ function yo(e) {
1008
+ const t = K(), n = jt();
965
1009
  return {
966
- x: de(e.x, B, Math.max(B, t.width - n.width - B)),
1010
+ x: de(e.x, O, Math.max(O, t.width - n.width - O)),
967
1011
  y: de(
968
1012
  e.y,
969
- We,
970
- Math.max(We, t.height - n.height - B)
1013
+ He,
1014
+ Math.max(He, t.height - n.height - O)
971
1015
  )
972
1016
  };
973
1017
  }
974
- function xe(e, t) {
1018
+ function ye(e, t) {
975
1019
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
976
1020
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
977
1021
  return;
978
1022
  }
979
1023
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
980
1024
  }
981
- function _o(e, t) {
1025
+ function Co(e, t) {
982
1026
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
983
1027
  }
984
- function xo(e) {
1028
+ function Eo(e) {
985
1029
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
986
1030
  }
987
- function Y() {
1031
+ function K() {
988
1032
  return {
989
- width: window.innerWidth || document.documentElement.clientWidth || Ft + B * 2,
990
- height: window.innerHeight || document.documentElement.clientHeight || Ut + B * 2
1033
+ width: window.innerWidth || document.documentElement.clientWidth || Gt + O * 2,
1034
+ height: window.innerHeight || document.documentElement.clientHeight || Wt + O * 2
991
1035
  };
992
1036
  }
993
- function Me(e) {
1037
+ function Oe(e) {
994
1038
  const t = e.getBoundingClientRect();
995
1039
  return {
996
1040
  x: Math.round(t.x),
@@ -1002,7 +1046,7 @@ function Me(e) {
1002
1046
  function de(e, t, n) {
1003
1047
  return Math.min(Math.max(e, t), n);
1004
1048
  }
1005
- function X(e, t, n) {
1049
+ function V(e, t, n) {
1006
1050
  if (typeof window > "u")
1007
1051
  return;
1008
1052
  const o = window, a = {
@@ -1011,12 +1055,12 @@ function X(e, t, n) {
1011
1055
  message: t,
1012
1056
  details: n
1013
1057
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
1014
- 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($n, { detail: a }));
1058
+ 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(qn, { detail: a }));
1015
1059
  }
1016
- function vo(e, t) {
1017
- X("web-sdk.widget.position", e, t);
1060
+ function So(e, t) {
1061
+ V("web-sdk.widget.position", e, t);
1018
1062
  }
1019
- function Oe(e, t, n) {
1063
+ function Ue(e, t, n) {
1020
1064
  const o = t.value.trim();
1021
1065
  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 })), []);
1022
1066
  }
@@ -1030,7 +1074,7 @@ function me(e, t = () => !0) {
1030
1074
  t() && (e.scrollTop = e.scrollHeight);
1031
1075
  });
1032
1076
  }
1033
- function yo(e) {
1077
+ function ko(e) {
1034
1078
  const t = e.messages[e.messages.length - 1];
1035
1079
  return [
1036
1080
  e.messages.length,
@@ -1041,37 +1085,37 @@ function yo(e) {
1041
1085
  e.lastError ?? ""
1042
1086
  ].join(":");
1043
1087
  }
1044
- function Co(e) {
1088
+ function Lo(e) {
1045
1089
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1046
1090
  }
1047
- function Eo(e, t, n, o) {
1048
- e.appendChild(To()), e.appendChild(So(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", No(16), !0)), e.appendChild(ko(n));
1091
+ function Ao(e, t, n, o) {
1092
+ e.appendChild(Mo()), e.appendChild(Po(t, n, o)), e.appendChild(Yt("pluno-pa-widget__close", "Close", Bo(16), !0)), e.appendChild(To(n));
1049
1093
  }
1050
- function So(e, t, n) {
1094
+ function Po(e, t, n) {
1051
1095
  const o = document.createElement("form");
1052
1096
  if (o.className = "pluno-pa-widget__launcher", n) {
1053
1097
  const i = document.createElement("button");
1054
1098
  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);
1055
1099
  }
1056
- o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ie("pluno-pa-widget__character--launcher", t));
1100
+ o.appendChild(Kt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(Z("pluno-pa-widget__character--launcher", t));
1057
1101
  const a = document.createElement("input");
1058
1102
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1059
1103
  }
1060
- function ko(e) {
1104
+ function To(e) {
1061
1105
  const t = document.createElement("section");
1062
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(jt("pluno-pa-widget__scribble-spirals--panel", 16));
1106
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(Kt("pluno-pa-widget__scribble-spirals--panel", 16));
1063
1107
  const n = document.createElement("div");
1064
1108
  n.className = "pluno-pa-widget__timeline-wrap";
1065
1109
  const o = document.createElement("main");
1066
- o.className = "pluno-pa-widget__timeline", o.appendChild(Po(e));
1110
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Io(e));
1067
1111
  const a = document.createElement("div");
1068
1112
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1069
1113
  const i = document.createElement("div");
1070
1114
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1071
1115
  const l = document.createElement("button");
1072
- 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", Io(), !0)), t.appendChild(n), t.appendChild(Lo()), t;
1116
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Yt("pluno-pa-widget__new-chat", "New chat", Oo(), !0)), t.appendChild(n), t.appendChild(No()), t;
1073
1117
  }
1074
- function Lo() {
1118
+ function No() {
1075
1119
  const e = document.createElement("form");
1076
1120
  e.className = "pluno-pa-widget__composer";
1077
1121
  const t = document.createElement("div");
@@ -1083,56 +1127,75 @@ function Lo() {
1083
1127
  const a = document.createElement("div");
1084
1128
  a.className = "pluno-pa-widget__composer-inner";
1085
1129
  const i = document.createElement("input");
1086
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Gn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1130
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Vn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1087
1131
  const l = document.createElement("button");
1088
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Do()), l.appendChild(Ro()), a.appendChild(l);
1132
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Uo()), l.appendChild(Fo()), a.appendChild(l);
1089
1133
  const s = document.createElement("textarea");
1090
1134
  s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1091
- const u = document.createElement("button");
1092
- u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(Vt()), a.appendChild(u), e.appendChild(a);
1093
- const d = document.createElement("div");
1094
- d.className = "pluno-pa-widget__composer-meta";
1135
+ const c = document.createElement("button");
1136
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(Xt()), a.appendChild(c), e.appendChild(a);
1137
+ const u = document.createElement("div");
1138
+ u.className = "pluno-pa-widget__composer-meta";
1095
1139
  const p = document.createElement("a");
1096
- p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", d.appendChild(p);
1097
- const w = document.createElement("span");
1098
- return w.className = "pluno-pa-widget__ai-disclaimer", w.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(w), e.appendChild(d), e;
1140
+ p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", u.appendChild(p);
1141
+ const m = document.createElement("span");
1142
+ return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(m), e.appendChild(u), e;
1099
1143
  }
1100
- function Po(e) {
1144
+ function Io(e) {
1101
1145
  const t = document.createElement("div");
1102
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(ie("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
1146
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(Z("pluno-pa-widget__character--empty", e)), t.appendChild(Vt()), t;
1103
1147
  }
1104
- function Gt() {
1148
+ function Vt() {
1105
1149
  const e = document.createElement("div");
1106
1150
  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;
1107
1151
  }
1108
- function Ao(e, t) {
1152
+ function Do(e, t) {
1109
1153
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1110
1154
  const n = document.createElement("span");
1111
1155
  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`));
1112
1156
  }
1113
- function ie(e, t) {
1114
- const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0), a = e.split(/\s+/).filter(Boolean);
1157
+ function Z(e, t) {
1158
+ const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0);
1159
+ Ro(o, `pluno-pa-character-${wt}`), wt += 1;
1160
+ const a = e.split(/\s+/).filter(Boolean);
1115
1161
  return o.setAttribute(
1116
1162
  "class",
1117
1163
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1118
1164
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1119
1165
  }
1120
- function Ht(e, t, n, o) {
1166
+ function Ro(e, t) {
1167
+ const n = /* @__PURE__ */ new Map();
1168
+ for (const a of Array.from(e.querySelectorAll("[id]"))) {
1169
+ const i = a.id, l = `${t}-${i}`;
1170
+ n.set(i, l), a.id = l;
1171
+ }
1172
+ if (n.size === 0)
1173
+ return;
1174
+ const o = [e, ...Array.from(e.querySelectorAll("*"))];
1175
+ for (const a of o)
1176
+ for (const i of Array.from(a.attributes)) {
1177
+ let l = i.value;
1178
+ for (const [s, c] of n)
1179
+ l = l.split(`url(#${s})`).join(`url(#${c})`), l === `#${s}` && (l = `#${c}`);
1180
+ l !== i.value && a.setAttribute(i.name, l);
1181
+ }
1182
+ }
1183
+ function Yt(e, t, n, o) {
1121
1184
  const a = document.createElement("button");
1122
1185
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1123
1186
  }
1124
- function To() {
1125
- const e = E("svg", {
1187
+ function Mo() {
1188
+ const e = S("svg", {
1126
1189
  class: "pluno-pa-widget__scribble-defs",
1127
1190
  "aria-hidden": "true",
1128
1191
  focusable: "false",
1129
1192
  width: "0",
1130
1193
  height: "0"
1131
- }), t = E("defs");
1132
- 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;
1194
+ }), t = S("defs");
1195
+ 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;
1133
1196
  }
1134
- function jt(e, t) {
1135
- const n = E("svg", {
1197
+ function Kt(e, t) {
1198
+ const n = S("svg", {
1136
1199
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1137
1200
  viewBox: `0 0 ${t * 26} 36`,
1138
1201
  preserveAspectRatio: "none",
@@ -1140,9 +1203,9 @@ function jt(e, t) {
1140
1203
  focusable: "false"
1141
1204
  });
1142
1205
  for (let o = 0; o < t; o += 1) {
1143
- const a = ht[o % ht.length], i = E("g", { transform: `translate(${o * 26} 0)` });
1206
+ const a = ft[o % ft.length], i = S("g", { transform: `translate(${o * 26} 0)` });
1144
1207
  i.appendChild(
1145
- E("ellipse", {
1208
+ S("ellipse", {
1146
1209
  cx: a.ellipseCx,
1147
1210
  cy: a.ellipseCy,
1148
1211
  rx: a.ellipseRx,
@@ -1153,7 +1216,7 @@ function jt(e, t) {
1153
1216
  opacity: "0.8"
1154
1217
  })
1155
1218
  ), i.appendChild(
1156
- E("path", {
1219
+ S("path", {
1157
1220
  d: a.path,
1158
1221
  fill: "none",
1159
1222
  stroke: "#2c2a1e",
@@ -1164,10 +1227,10 @@ function jt(e, t) {
1164
1227
  }
1165
1228
  return n;
1166
1229
  }
1167
- function Be(e, t, n) {
1168
- const o = E("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1230
+ function Fe(e, t, n) {
1231
+ const o = S("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1169
1232
  return o.appendChild(
1170
- E("feTurbulence", {
1233
+ S("feTurbulence", {
1171
1234
  type: "fractalNoise",
1172
1235
  baseFrequency: "0.012 0.028",
1173
1236
  numOctaves: "3",
@@ -1175,7 +1238,7 @@ function Be(e, t, n) {
1175
1238
  result: "stroke-noise"
1176
1239
  })
1177
1240
  ), o.appendChild(
1178
- E("feDisplacementMap", {
1241
+ S("feDisplacementMap", {
1179
1242
  in: "SourceGraphic",
1180
1243
  in2: "stroke-noise",
1181
1244
  scale: "3.5",
@@ -1184,7 +1247,7 @@ function Be(e, t, n) {
1184
1247
  result: "warped"
1185
1248
  })
1186
1249
  ), o.appendChild(
1187
- E("feTurbulence", {
1250
+ S("feTurbulence", {
1188
1251
  type: "fractalNoise",
1189
1252
  baseFrequency: "0.7",
1190
1253
  numOctaves: "1",
@@ -1192,7 +1255,7 @@ function Be(e, t, n) {
1192
1255
  result: "ink-noise"
1193
1256
  })
1194
1257
  ), o.appendChild(
1195
- E("feDisplacementMap", {
1258
+ S("feDisplacementMap", {
1196
1259
  in: "warped",
1197
1260
  in2: "ink-noise",
1198
1261
  scale: "0.9",
@@ -1201,30 +1264,30 @@ function Be(e, t, n) {
1201
1264
  })
1202
1265
  ), o;
1203
1266
  }
1204
- function No(e) {
1205
- const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1206
- return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
1267
+ function Bo(e) {
1268
+ const t = J("0 0 24 24", e, e, "none", "currentColor", "2.25");
1269
+ return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
1207
1270
  }
1208
- function Io() {
1209
- const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1210
- 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;
1271
+ function Oo() {
1272
+ const e = J("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1273
+ return e.appendChild(S("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(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1211
1274
  }
1212
- function Vt() {
1213
- const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1214
- 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;
1275
+ function Xt() {
1276
+ const e = J("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1277
+ return e.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
1215
1278
  }
1216
- function Do() {
1217
- const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1279
+ function Uo() {
1280
+ const e = J("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1218
1281
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1219
- E("path", {
1282
+ S("path", {
1220
1283
  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"
1221
1284
  })
1222
1285
  ), e;
1223
1286
  }
1224
- function Ro() {
1225
- const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1287
+ function Fo() {
1288
+ const e = J("0 0 24 24", 19, 19, "none", "currentColor");
1226
1289
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1227
- E("path", {
1290
+ S("path", {
1228
1291
  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",
1229
1292
  stroke: "currentColor",
1230
1293
  "stroke-width": "2",
@@ -1233,19 +1296,19 @@ function Ro() {
1233
1296
  })
1234
1297
  ), e;
1235
1298
  }
1236
- function Mo() {
1237
- const e = Z("0 0 24 24", 18, 18, "currentColor");
1238
- return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1299
+ function zo() {
1300
+ const e = J("0 0 24 24", 18, 18, "currentColor");
1301
+ return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1239
1302
  }
1240
- function Oo() {
1241
- const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1242
- return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
1303
+ function $o() {
1304
+ const e = J("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1305
+ return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
1243
1306
  }
1244
- function Bo() {
1245
- const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1246
- 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;
1307
+ function Go() {
1308
+ const e = J("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1309
+ return e.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1247
1310
  }
1248
- function Z(e, t, n, o, a, i) {
1311
+ function J(e, t, n, o, a, i) {
1249
1312
  const l = {
1250
1313
  viewBox: e,
1251
1314
  width: String(t),
@@ -1253,41 +1316,41 @@ function Z(e, t, n, o, a, i) {
1253
1316
  fill: o,
1254
1317
  "aria-hidden": "true"
1255
1318
  };
1256
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), E("svg", l);
1319
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
1257
1320
  }
1258
- function E(e, t = {}) {
1259
- const n = document.createElementNS(Qn, e);
1321
+ function S(e, t = {}) {
1322
+ const n = document.createElementNS(oo, e);
1260
1323
  for (const [o, a] of Object.entries(t))
1261
1324
  n.setAttribute(o, a);
1262
1325
  return n;
1263
1326
  }
1264
- function xt(e) {
1327
+ function Ct(e) {
1265
1328
  for (const t of ["keydown", "keypress", "keyup"])
1266
1329
  e.addEventListener(t, (n) => {
1267
1330
  n.stopPropagation();
1268
1331
  });
1269
1332
  }
1270
- function Fo(e, t, n) {
1333
+ function Wo(e, t, n) {
1271
1334
  e.replaceChildren(), e.hidden = t.length === 0;
1272
1335
  for (const [o, a] of t.entries()) {
1273
1336
  const i = document.createElement("div");
1274
- i.className = "pluno-pa-widget__attachment", i.appendChild(Uo(a));
1337
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Ho(a));
1275
1338
  const l = document.createElement("span");
1276
1339
  l.textContent = a.name, i.appendChild(l);
1277
1340
  const s = document.createElement("button");
1278
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Oo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1341
+ s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild($o()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1279
1342
  }
1280
1343
  }
1281
- function Uo(e) {
1282
- if (qt(e)) {
1344
+ function Ho(e) {
1345
+ if (Zt(e)) {
1283
1346
  const n = document.createElement("img");
1284
1347
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1285
1348
  }
1286
1349
  const t = document.createElement("span");
1287
1350
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1288
1351
  }
1289
- function zo(e) {
1290
- if (qt(e)) {
1352
+ function qo(e) {
1353
+ if (Zt(e)) {
1291
1354
  const a = document.createElement("img");
1292
1355
  return a.src = e.dataUrl, a.alt = e.name, a;
1293
1356
  }
@@ -1298,51 +1361,51 @@ function zo(e) {
1298
1361
  const o = document.createElement("strong");
1299
1362
  return o.textContent = e.name, t.append(n, o), t;
1300
1363
  }
1301
- function qt(e) {
1364
+ function Zt(e) {
1302
1365
  return e.mimeType.startsWith("image/");
1303
1366
  }
1304
- function $o(e) {
1367
+ function jo(e) {
1305
1368
  return e === "application/pdf" ? "document.pdf" : "image";
1306
1369
  }
1307
- async function Wo(e) {
1370
+ async function Vo(e) {
1308
1371
  if (!e)
1309
1372
  return [];
1310
1373
  const t = Array.from(e);
1311
- if (t.length > Ee)
1312
- throw new Error(`Attach up to ${Ee} files per message.`);
1374
+ if (t.length > ke)
1375
+ throw new Error(`Attach up to ${ke} files per message.`);
1313
1376
  return Promise.all(
1314
1377
  t.map(async (n) => {
1315
- const o = Go(n);
1378
+ const o = Yo(n);
1316
1379
  if (!o)
1317
1380
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1318
- if (n.size > Wn)
1381
+ if (n.size > jn)
1319
1382
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1320
1383
  if (o === "image/gif") {
1321
- const a = new Uint8Array(await Jo(n));
1322
- if (jo(a))
1384
+ const a = new Uint8Array(await oa(n));
1385
+ if (Xo(a))
1323
1386
  throw new Error("Pluno supports non-animated GIF images.");
1324
1387
  }
1325
1388
  return {
1326
- name: n.name || $o(o),
1389
+ name: n.name || jo(o),
1327
1390
  mimeType: o,
1328
1391
  sizeBytes: n.size,
1329
- dataUrl: Ho(await Qo(n), o)
1392
+ dataUrl: Ko(await aa(n), o)
1330
1393
  };
1331
1394
  })
1332
1395
  );
1333
1396
  }
1334
- function Go(e) {
1335
- if (Bt.has(e.type))
1397
+ function Yo(e) {
1398
+ if ($t.has(e.type))
1336
1399
  return e.type;
1337
1400
  const t = e.name.toLowerCase();
1338
1401
  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;
1339
1402
  }
1340
- function Ho(e, t) {
1403
+ function Ko(e, t) {
1341
1404
  const n = `data:${t};base64,`;
1342
1405
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1343
1406
  }
1344
- function jo(e) {
1345
- if (e.length < 14 || !Vo(e))
1407
+ function Xo(e) {
1408
+ if (e.length < 14 || !Zo(e))
1346
1409
  return !1;
1347
1410
  const t = e[10];
1348
1411
  let n = 13;
@@ -1353,7 +1416,7 @@ function jo(e) {
1353
1416
  if (n += 1, a === 59)
1354
1417
  return !1;
1355
1418
  if (a === 33) {
1356
- n += 1, n = vt(e, n);
1419
+ n += 1, n = Et(e, n);
1357
1420
  continue;
1358
1421
  }
1359
1422
  if (a !== 44)
@@ -1365,14 +1428,14 @@ function jo(e) {
1365
1428
  const i = e[n + 8];
1366
1429
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1367
1430
  return !1;
1368
- n += 1, n = vt(e, n);
1431
+ n += 1, n = Et(e, n);
1369
1432
  }
1370
1433
  return !1;
1371
1434
  }
1372
- function Vo(e) {
1435
+ function Zo(e) {
1373
1436
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1374
1437
  }
1375
- function vt(e, t) {
1438
+ function Et(e, t) {
1376
1439
  for (; t < e.length; ) {
1377
1440
  const n = e[t];
1378
1441
  if (t += 1, n === 0)
@@ -1381,63 +1444,63 @@ function vt(e, t) {
1381
1444
  }
1382
1445
  return t;
1383
1446
  }
1384
- function ve(e) {
1447
+ function Ce(e) {
1385
1448
  return !!(e && Array.from(e.types).includes("Files"));
1386
1449
  }
1387
- function Fe(e, t, n = null) {
1388
- if (!e || !He(t, n)) {
1450
+ function ze(e, t, n = null) {
1451
+ if (!e || !je(t, n)) {
1389
1452
  e && (e.hidden = !0, e.replaceChildren());
1390
1453
  return;
1391
1454
  }
1392
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || qe(n) ? e.appendChild(qo(t, n)) : Yt(t) && e.appendChild(Yo(t));
1455
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || Ke(n) ? e.appendChild(Jo(t, n)) : Jt(t) && e.appendChild(Qo(t));
1393
1456
  }
1394
- function qo(e, t) {
1457
+ function Jo(e, t) {
1395
1458
  const n = document.createElement("div");
1396
1459
  n.className = "pluno-pa-widget__billing-action-card";
1397
1460
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1398
1461
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1399
1462
  const i = document.createElement("span");
1400
- 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(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1463
+ 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(Qt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1401
1464
  }
1402
- function Yo(e) {
1465
+ function Qo(e) {
1403
1466
  const t = document.createElement("div");
1404
1467
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1405
1468
  const n = document.createElement("strong");
1406
1469
  n.textContent = "Credits running low", t.appendChild(n);
1407
1470
  const o = document.createElement("span");
1408
- return o.textContent = Xo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1471
+ return o.textContent = ta(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Qt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1409
1472
  }
1410
- function He(e, t) {
1411
- return e !== null && (W(e) || Yt(e) || qe(t));
1473
+ function je(e, t) {
1474
+ return e !== null && (W(e) || Jt(e) || Ke(t));
1412
1475
  }
1413
- function yt(e, t, n) {
1414
- return He(t, n) || Ko(t) ? !0 : !He(e, n);
1476
+ function St(e, t, n) {
1477
+ return je(t, n) || ea(t) ? !0 : !je(e, n);
1415
1478
  }
1416
- function Ko(e) {
1479
+ function ea(e) {
1417
1480
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || W(e));
1418
1481
  }
1419
1482
  function W(e) {
1420
1483
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1421
1484
  }
1422
- function qe(e) {
1485
+ function Ke(e) {
1423
1486
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1424
1487
  }
1425
- function Yt(e) {
1488
+ function Jt(e) {
1426
1489
  return !W(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1427
1490
  }
1428
- function Xo(e) {
1429
- return e.creditsRemaining === null ? null : `${Zo(e.creditsRemaining)} credits left`;
1491
+ function ta(e) {
1492
+ return e.creditsRemaining === null ? null : `${na(e.creditsRemaining)} credits left`;
1430
1493
  }
1431
- function Zo(e) {
1494
+ function na(e) {
1432
1495
  return new Intl.NumberFormat("en-US", {
1433
1496
  maximumFractionDigits: 0
1434
1497
  }).format(Math.ceil(e));
1435
1498
  }
1436
- function Kt(e, t, n) {
1499
+ function Qt(e, t, n) {
1437
1500
  const o = document.createElement("div");
1438
- return o.className = n, o.appendChild(Ct(t, e.pricingUrl)), o.appendChild(Ct("Earn credits", e.earnCreditsUrl)), o;
1501
+ return o.className = n, o.appendChild(kt(t, e.pricingUrl)), o.appendChild(kt("Earn credits", e.earnCreditsUrl)), o;
1439
1502
  }
1440
- function Ct(e, t) {
1503
+ function kt(e, t) {
1441
1504
  const n = document.createElement("button");
1442
1505
  if (n.type = "button", e === "Earn credits") {
1443
1506
  const o = document.createElement("span");
@@ -1448,7 +1511,7 @@ function Ct(e, t) {
1448
1511
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1449
1512
  }), n;
1450
1513
  }
1451
- function Jo(e) {
1514
+ function oa(e) {
1452
1515
  return new Promise((t, n) => {
1453
1516
  const o = new FileReader();
1454
1517
  o.addEventListener("load", () => {
@@ -1462,7 +1525,7 @@ function Jo(e) {
1462
1525
  }), o.readAsArrayBuffer(e);
1463
1526
  });
1464
1527
  }
1465
- function Qo(e) {
1528
+ function aa(e) {
1466
1529
  return new Promise((t, n) => {
1467
1530
  const o = new FileReader();
1468
1531
  o.addEventListener("load", () => {
@@ -1476,126 +1539,132 @@ function Qo(e) {
1476
1539
  }), o.readAsDataURL(e);
1477
1540
  });
1478
1541
  }
1479
- function Et(e, t) {
1480
- return e.messages.filter((o) => !Xt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1542
+ function Lt(e, t) {
1543
+ return e.messages.filter((o) => !en(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1481
1544
  }
1482
- function ea(e, t, n, o, a, i, l, s, u, d, p, w, x, P, C) {
1483
- const M = [...i.messages], v = M.filter((f) => !Xt(f)), y = e.scrollTop;
1484
- e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && Ao(a, l);
1545
+ function ia(e, t, n, o, a, i, l, s, c, u, p, m, x, A, C) {
1546
+ const B = [...i.messages], v = B.filter((b) => !en(b)), y = e.scrollTop;
1547
+ e.replaceChildren(), nn(n, i.isThinking), a.hidden = !s, s && l !== null && Do(a, l);
1485
1548
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1486
1549
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1550
+ const b = document.createElement("div");
1551
+ b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1487
1552
  const f = document.createElement("div");
1488
- f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1489
- const m = document.createElement("div");
1490
- m.className = "pluno-pa-widget__empty-hero";
1491
- const T = ie("pluno-pa-widget__character--empty", x());
1492
- m.appendChild(T), f.appendChild(m), f.appendChild(Gt());
1553
+ f.className = "pluno-pa-widget__empty-hero";
1554
+ const N = Z("pluno-pa-widget__character--empty", x());
1555
+ f.appendChild(N), b.appendChild(f), b.appendChild(Vt());
1493
1556
  const L = document.createElement("div");
1494
1557
  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)
1495
1558
  for (const I of i.starterPrompts) {
1496
- const A = document.createElement("button");
1497
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
1498
- P(I);
1499
- }), L.appendChild(A);
1559
+ const P = document.createElement("button");
1560
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
1561
+ A(I);
1562
+ }), L.appendChild(P);
1500
1563
  }
1501
1564
  else
1502
- for (let I = 0; I < Hn; I += 1) {
1503
- const A = document.createElement("button");
1504
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = "&nbsp;", L.appendChild(A);
1565
+ for (let I = 0; I < Yn; I += 1) {
1566
+ const P = document.createElement("button");
1567
+ 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);
1505
1568
  }
1506
- f.appendChild(L), e.appendChild(f), e.appendChild(t);
1569
+ b.appendChild(L), e.appendChild(b), e.appendChild(t);
1507
1570
  return;
1508
1571
  }
1509
- let g = null, _ = null, N = [];
1510
- const J = () => {
1511
- if (N.length === 0)
1572
+ let g = null, _ = null, T = [];
1573
+ const Q = () => {
1574
+ if (T.length === 0)
1512
1575
  return !1;
1513
- const f = sa(N, p, w, x());
1514
- return e.appendChild(f), g = null, _ = f, N = [], !0;
1576
+ const b = ga(T, p, m, x());
1577
+ return e.appendChild(b), g = null, _ = b, T = [], !0;
1515
1578
  };
1516
- for (let f = 0; f < v.length; f += 1) {
1517
- const m = v[f];
1518
- if (m.role === "tool") {
1519
- N.push(m);
1579
+ for (let b = 0; b < v.length; b += 1) {
1580
+ const f = v[b];
1581
+ if (f.role === "tool") {
1582
+ T.push(f);
1520
1583
  continue;
1521
1584
  }
1522
- if (m.role === "system")
1585
+ if (f.role === "system")
1523
1586
  continue;
1524
- const T = J(), L = kt(m.content);
1525
- if (m.role === "assistant" && !T) {
1526
- const b = je(x());
1527
- e.appendChild(b), g = null, _ = b;
1587
+ const N = Q(), L = Tt(f.content);
1588
+ if (f.role === "assistant" && !N) {
1589
+ const w = Ve(x());
1590
+ e.appendChild(w), g = null, _ = w;
1528
1591
  }
1529
1592
  const I = document.createElement("div");
1530
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, L) : I.textContent = L, m.role === "user" && m.attachments?.length && I.appendChild(na(m.attachments));
1531
- const A = document.createElement("div");
1532
- A.className = "pluno-pa-widget__message-actions", A.appendChild(St(L)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
1593
+ I.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Nt(I, L) : I.textContent = L, f.role === "user" && f.attachments?.length && I.appendChild(ra(f.attachments));
1594
+ const P = document.createElement("div");
1595
+ P.className = "pluno-pa-widget__message-actions", P.appendChild(Pt(L)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
1533
1596
  }
1534
- const ce = J();
1597
+ const ce = Q();
1535
1598
  if (i.assistantDraft) {
1536
1599
  if (!ce) {
1537
- const L = je(x());
1600
+ const L = Ve(x());
1538
1601
  e.appendChild(L), g = null, _ = L;
1539
1602
  }
1540
- const f = kt(i.assistantDraft), m = document.createElement("div");
1541
- m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Lt(m, f);
1542
- const T = document.createElement("div");
1543
- T.className = "pluno-pa-widget__message-actions", T.appendChild(St(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
1603
+ const b = Tt(i.assistantDraft), f = document.createElement("div");
1604
+ f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Nt(f, b);
1605
+ const N = document.createElement("div");
1606
+ N.className = "pluno-pa-widget__message-actions", N.appendChild(Pt(b)), f.appendChild(N), e.appendChild(f), g = f, _ = null;
1544
1607
  }
1545
1608
  if (i.isThinking && !i.assistantDraft)
1546
1609
  if (ce) {
1547
- const f = Zt();
1548
- e.appendChild(f), g = null, _ = f;
1610
+ const b = tn();
1611
+ e.appendChild(b), g = null, _ = b;
1549
1612
  } else {
1550
- const f = da(x());
1551
- e.appendChild(f), g = null, _ = f;
1613
+ const b = ha(x());
1614
+ e.appendChild(b), g = null, _ = b;
1552
1615
  }
1553
1616
  if (i.lastError) {
1554
- const f = document.createElement("div");
1555
- f.className = "pluno-pa-widget__error", f.textContent = i.lastError, e.appendChild(f), g = f, _ = null;
1617
+ const b = document.createElement("div");
1618
+ b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
1556
1619
  }
1557
- const S = C && !i.isThinking ? _n(M) : null;
1558
- if (C && S && !C.dismissedCandidateIds.has(S.id)) {
1559
- const f = oa(S, {
1560
- isDrafting: C.draftingCandidateId === S.id,
1620
+ const k = C && !i.isThinking ? Cn(B) : null;
1621
+ if (C && k && !C.dismissedCandidateIds.has(k.id)) {
1622
+ const b = la(k, {
1623
+ isDrafting: C.draftingCandidateId === k.id,
1561
1624
  error: C.error,
1625
+ characterIconSvg: C.characterIconSvg,
1562
1626
  onDraft: C.onDraft,
1563
1627
  onDismiss: C.onDismiss,
1564
1628
  onDisable: C.onDisable
1565
1629
  });
1566
- e.appendChild(f), C.onSeen(S), g = null, _ = f;
1630
+ e.appendChild(b), C.onSeen(k), g = null, _ = b;
1567
1631
  }
1568
- 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;
1569
- }
1570
- function ta(e, t, n, o, a, i) {
1571
- e.replaceChildren(), Jt(t, !1), t.disabled = !0, n.hidden = !0;
1572
- const l = document.createElement("div");
1573
- l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1574
- const s = ie("pluno-pa-widget__character--empty", o());
1575
- l.appendChild(s);
1576
- const u = document.createElement("div");
1577
- u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1578
- const d = document.createElement("button");
1579
- d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1632
+ g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? me(e, u) : e.scrollTop = y;
1633
+ }
1634
+ function At(e, t, n, o, a, i, l, s) {
1635
+ e.replaceChildren(), nn(t, !1), t.disabled = !0, n.hidden = !0;
1636
+ const c = document.createElement("div");
1637
+ c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1638
+ const u = Z("pluno-pa-widget__character--empty", o());
1639
+ c.appendChild(u);
1640
+ const p = document.createElement("div");
1641
+ if (p.className = "pluno-pa-widget__empty", p.textContent = a, c.appendChild(p), l) {
1642
+ const m = document.createElement("a");
1643
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = i, c.appendChild(m);
1644
+ } else {
1645
+ const m = document.createElement("button");
1646
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = i, m.addEventListener("click", () => s?.()), c.appendChild(m);
1647
+ }
1648
+ e.appendChild(c);
1580
1649
  }
1581
- function na(e) {
1650
+ function ra(e) {
1582
1651
  const t = document.createElement("div");
1583
1652
  t.className = "pluno-pa-widget__message-attachments";
1584
1653
  for (const n of e)
1585
- t.appendChild(zo(n));
1654
+ t.appendChild(qo(n));
1586
1655
  return t;
1587
1656
  }
1588
- function St(e) {
1657
+ function Pt(e) {
1589
1658
  const t = document.createElement("button");
1590
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Bo()), t.addEventListener("click", (n) => {
1659
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Go()), t.addEventListener("click", (n) => {
1591
1660
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1592
1661
  }), t;
1593
1662
  }
1594
- function oa(e, t) {
1663
+ function la(e, t) {
1595
1664
  const n = document.createElement("article");
1596
1665
  n.className = "pluno-pa-widget__share-prompt";
1597
1666
  const o = document.createElement("div");
1598
- o.className = "pluno-pa-widget__share-prompt-body";
1667
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(Z("pluno-pa-widget__share-prompt-icon", t.characterIconSvg));
1599
1668
  const a = document.createElement("div");
1600
1669
  a.className = "pluno-pa-widget__share-prompt-copy";
1601
1670
  const i = document.createElement("strong");
@@ -1608,26 +1677,26 @@ function oa(e, t) {
1608
1677
  o.appendChild(a);
1609
1678
  const s = document.createElement("div");
1610
1679
  s.className = "pluno-pa-widget__share-prompt-actions";
1611
- const u = document.createElement("div");
1612
- u.className = "pluno-pa-widget__share-prompt-primary-actions";
1613
- const d = document.createElement("button");
1614
- if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1680
+ const c = document.createElement("div");
1681
+ c.className = "pluno-pa-widget__share-prompt-primary-actions";
1682
+ const u = document.createElement("button");
1683
+ if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
1615
1684
  t.onDraft(e);
1616
- }), t.isDrafting ? (d.appendChild(Ve()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
1617
- s.appendChild(u);
1685
+ }), t.isDrafting ? (u.appendChild(Ye()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1686
+ s.appendChild(c);
1618
1687
  else {
1619
1688
  const p = document.createElement("button");
1620
1689
  p.type = "button", p.className = "pluno-pa-widget__share-prompt-dismiss", p.setAttribute("aria-label", "Dismiss share prompt"), p.title = "Dismiss", p.textContent = "Dismiss", p.addEventListener("click", () => {
1621
1690
  t.onDismiss(e);
1622
- }), u.appendChild(p), s.appendChild(u);
1623
- const w = document.createElement("button");
1624
- w.type = "button", w.className = "pluno-pa-widget__share-prompt-disable", w.textContent = "Don't ask again", w.addEventListener("click", () => {
1691
+ }), c.appendChild(p), s.appendChild(c);
1692
+ const m = document.createElement("button");
1693
+ m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
1625
1694
  t.onDisable(e);
1626
- }), s.appendChild(w);
1695
+ }), s.appendChild(m);
1627
1696
  }
1628
1697
  return o.appendChild(s), n.appendChild(o), n;
1629
1698
  }
1630
- function aa(e, t) {
1699
+ function pa(e, t) {
1631
1700
  const n = document.createElement("div");
1632
1701
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1633
1702
  v.target === n && t.onClose();
@@ -1640,55 +1709,55 @@ function aa(e, t) {
1640
1709
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
1641
1710
  const s = document.createElement("p");
1642
1711
  s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
1712
+ const c = document.createElement("div");
1713
+ c.className = "pluno-pa-widget__share-dialog-step";
1643
1714
  const u = document.createElement("div");
1644
- u.className = "pluno-pa-widget__share-dialog-step";
1645
- const d = document.createElement("div");
1646
- d.className = "pluno-pa-widget__share-dialog-step-header";
1715
+ u.className = "pluno-pa-widget__share-dialog-step-header";
1647
1716
  const p = document.createElement("strong");
1648
- p.textContent = "1) Copy Screenshot", d.appendChild(p);
1649
- const w = ia("Copy Screenshot", async () => {
1717
+ p.textContent = "1) Copy Screenshot", u.appendChild(p);
1718
+ const m = sa("Copy Screenshot", async () => {
1650
1719
  try {
1651
- return await xn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1720
+ return await En(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1652
1721
  } catch {
1653
1722
  return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1654
1723
  }
1655
1724
  });
1656
- if (d.appendChild(w), u.appendChild(d), e.screenshotDataUrl) {
1725
+ if (u.appendChild(m), c.appendChild(u), e.screenshotDataUrl) {
1657
1726
  const v = document.createElement("div");
1658
1727
  v.className = "pluno-pa-widget__share-dialog-screenshot";
1659
1728
  const y = document.createElement("img");
1660
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), u.appendChild(v);
1729
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
1661
1730
  }
1662
- o.appendChild(u), o.appendChild(s);
1731
+ o.appendChild(c), o.appendChild(s);
1663
1732
  const x = document.createElement("div");
1664
1733
  x.className = "pluno-pa-widget__share-dialog-step";
1665
- const P = document.createElement("strong");
1666
- P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
1734
+ const A = document.createElement("strong");
1735
+ A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
1667
1736
  const C = document.createElement("p");
1668
1737
  C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
1669
- const M = document.createElement("footer");
1670
- M.className = "pluno-pa-widget__share-dialog-platforms";
1671
- for (const v of ra(e)) {
1738
+ const B = document.createElement("footer");
1739
+ B.className = "pluno-pa-widget__share-dialog-platforms";
1740
+ for (const v of da(e)) {
1672
1741
  const y = document.createElement("a");
1673
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(la(v.id)), M.appendChild(y);
1742
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ca(v.id)), B.appendChild(y);
1674
1743
  }
1675
- if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
1744
+ if (x.appendChild(B), o.appendChild(x), t.socialPostRewardsUrl) {
1676
1745
  const v = document.createElement("div");
1677
1746
  v.className = "pluno-pa-widget__share-dialog-step";
1678
1747
  const y = document.createElement("strong");
1679
1748
  y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1680
1749
  const h = document.createElement("a");
1681
- 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(pa()), v.appendChild(h), o.appendChild(v);
1750
+ 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(ua()), v.appendChild(h), o.appendChild(v);
1682
1751
  }
1683
1752
  return n.appendChild(o), n;
1684
1753
  }
1685
- function ia(e, t) {
1754
+ function sa(e, t) {
1686
1755
  const n = document.createElement("button");
1687
1756
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1688
1757
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1689
1758
  }), n;
1690
1759
  }
1691
- function ra(e) {
1760
+ function da(e) {
1692
1761
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1693
1762
  return [
1694
1763
  {
@@ -1708,7 +1777,7 @@ function ra(e) {
1708
1777
  }
1709
1778
  ];
1710
1779
  }
1711
- function la(e) {
1780
+ function ca(e) {
1712
1781
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1713
1782
  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);
1714
1783
  }
@@ -1716,48 +1785,48 @@ function D(e, t, n) {
1716
1785
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1717
1786
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1718
1787
  }
1719
- function pa() {
1788
+ function ua() {
1720
1789
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1721
1790
  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;
1722
1791
  }
1723
- function Xt(e) {
1724
- return e.role === "tool" && e.toolName === Rt;
1792
+ function en(e) {
1793
+ return e.role === "tool" && e.toolName === Ut;
1725
1794
  }
1726
- function kt(e) {
1795
+ function Tt(e) {
1727
1796
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1728
1797
  }
1729
- function sa(e, t, n, o) {
1798
+ function ga(e, t, n, o) {
1730
1799
  const a = document.createElement("article");
1731
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ie("pluno-pa-widget__character--tool-group", o));
1732
- const i = document.createElement("details"), l = ca(e);
1800
+ 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));
1801
+ const i = document.createElement("details"), l = ma(e);
1733
1802
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1734
1803
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1735
1804
  });
1736
1805
  const s = document.createElement("summary");
1737
- s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ve());
1738
- const d = document.createElement("span");
1739
- 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) {
1806
+ s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ye());
1807
+ const u = document.createElement("span");
1808
+ if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", s.appendChild(u), i.appendChild(s), e.length > 0) {
1740
1809
  const p = document.createElement("div");
1741
1810
  p.className = "pluno-pa-widget__tool-lines";
1742
- for (const w of e) {
1811
+ for (const m of e) {
1743
1812
  const x = document.createElement("div");
1744
- x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ve());
1745
- const P = document.createElement("span");
1746
- P.textContent = w.content || "Run tool", x.appendChild(P), p.appendChild(x);
1813
+ x.className = "pluno-pa-widget__tool-line", m.loading && x.appendChild(Ye());
1814
+ const A = document.createElement("span");
1815
+ A.textContent = m.content || "Run tool", x.appendChild(A), p.appendChild(x);
1747
1816
  }
1748
1817
  i.appendChild(p);
1749
1818
  }
1750
1819
  return a.appendChild(i), a;
1751
1820
  }
1752
- function je(e) {
1821
+ function Ve(e) {
1753
1822
  const t = document.createElement("article");
1754
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ie("pluno-pa-widget__character--tool-group", e)), t;
1823
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(Z("pluno-pa-widget__character--tool-group", e)), t;
1755
1824
  }
1756
- function da(e) {
1757
- const t = je(e);
1758
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Zt()), t;
1825
+ function ha(e) {
1826
+ const t = Ve(e);
1827
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(tn()), t;
1759
1828
  }
1760
- function Zt() {
1829
+ function tn() {
1761
1830
  const e = document.createElement("div");
1762
1831
  e.className = "pluno-pa-widget__status";
1763
1832
  const t = document.createElement("span");
@@ -1765,17 +1834,17 @@ function Zt() {
1765
1834
  const n = document.createElement("span");
1766
1835
  return n.textContent = "Thinking...", e.appendChild(n), e;
1767
1836
  }
1768
- function ca(e) {
1837
+ function ma(e) {
1769
1838
  return `tools:${e[0]?.id ?? ""}`;
1770
1839
  }
1771
- function Ve() {
1840
+ function Ye() {
1772
1841
  const e = document.createElement("span");
1773
1842
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1774
1843
  }
1775
- function Jt(e, t) {
1776
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Mo() : Vt());
1844
+ function nn(e, t) {
1845
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? zo() : Xt());
1777
1846
  }
1778
- function Lt(e, t) {
1847
+ function Nt(e, t) {
1779
1848
  const n = t.replace(/\r\n/g, `
1780
1849
  `).split(`
1781
1850
  `);
@@ -1787,49 +1856,49 @@ function Lt(e, t) {
1787
1856
  continue;
1788
1857
  }
1789
1858
  if (a.match(/^```(\w+)?\s*$/)) {
1790
- const d = [];
1859
+ const u = [];
1791
1860
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1792
- d.push(n[o]), o += 1;
1861
+ u.push(n[o]), o += 1;
1793
1862
  o += o < n.length ? 1 : 0;
1794
- const p = document.createElement("pre"), w = document.createElement("code");
1795
- w.textContent = d.join(`
1796
- `), p.appendChild(w), e.appendChild(p);
1863
+ const p = document.createElement("pre"), m = document.createElement("code");
1864
+ m.textContent = u.join(`
1865
+ `), p.appendChild(m), e.appendChild(p);
1797
1866
  continue;
1798
1867
  }
1799
1868
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1800
1869
  if (l) {
1801
- const d = document.createElement(`h${l[1].length + 2}`);
1802
- ye(d, l[2]), e.appendChild(d), o += 1;
1870
+ const u = document.createElement(`h${l[1].length + 2}`);
1871
+ Ee(u, l[2]), e.appendChild(u), o += 1;
1803
1872
  continue;
1804
1873
  }
1805
1874
  if (/^\s*[-*+]\s+/.test(a)) {
1806
- const d = document.createElement("ul");
1875
+ const u = document.createElement("ul");
1807
1876
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1808
1877
  const p = document.createElement("li");
1809
- ye(p, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(p), o += 1;
1878
+ Ee(p, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(p), o += 1;
1810
1879
  }
1811
- e.appendChild(d);
1880
+ e.appendChild(u);
1812
1881
  continue;
1813
1882
  }
1814
1883
  if (/^\s*\d+\.\s+/.test(a)) {
1815
- const d = document.createElement("ol");
1884
+ const u = document.createElement("ol");
1816
1885
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1817
1886
  const p = document.createElement("li");
1818
- ye(p, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(p), o += 1;
1887
+ Ee(p, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(p), o += 1;
1819
1888
  }
1820
- e.appendChild(d);
1889
+ e.appendChild(u);
1821
1890
  continue;
1822
1891
  }
1823
1892
  const s = [a];
1824
1893
  for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
1825
1894
  s.push(n[o]), o += 1;
1826
- const u = document.createElement("p");
1827
- s.forEach((d, p) => {
1828
- p > 0 && u.appendChild(document.createElement("br")), ye(u, d);
1829
- }), e.appendChild(u);
1895
+ const c = document.createElement("p");
1896
+ s.forEach((u, p) => {
1897
+ p > 0 && c.appendChild(document.createElement("br")), Ee(c, u);
1898
+ }), e.appendChild(c);
1830
1899
  }
1831
1900
  }
1832
- function ye(e, t) {
1901
+ function Ee(e, t) {
1833
1902
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1834
1903
  let o = 0;
1835
1904
  for (const a of t.matchAll(n)) {
@@ -1847,9 +1916,9 @@ function ye(e, t) {
1847
1916
  s.textContent = l.slice(1, -1), e.appendChild(s);
1848
1917
  } else {
1849
1918
  const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1850
- if (s && ua(s[2])) {
1851
- const u = document.createElement("a");
1852
- u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
1919
+ if (s && fa(s[2])) {
1920
+ const c = document.createElement("a");
1921
+ c.href = s[2], c.target = "_top", c.rel = "noreferrer", c.textContent = s[1], e.appendChild(c);
1853
1922
  } else
1854
1923
  e.appendChild(document.createTextNode(l));
1855
1924
  }
@@ -1857,7 +1926,7 @@ function ye(e, t) {
1857
1926
  }
1858
1927
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1859
1928
  }
1860
- function ua(e) {
1929
+ function fa(e) {
1861
1930
  if (e.startsWith("/") || e.startsWith("#"))
1862
1931
  return !0;
1863
1932
  try {
@@ -1867,8 +1936,8 @@ function ua(e) {
1867
1936
  return !1;
1868
1937
  }
1869
1938
  }
1870
- function Pt(e, t) {
1871
- if (ga(e))
1939
+ function It(e, t) {
1940
+ if (ba(e))
1872
1941
  return;
1873
1942
  const n = `
1874
1943
  :host {
@@ -1921,7 +1990,7 @@ function Pt(e, t) {
1921
1990
  --pluno-pa-accent-contrast: #fafafa;
1922
1991
  position: fixed;
1923
1992
  z-index: 2147483645;
1924
- font-family: ${V.fontFamily};
1993
+ font-family: ${G.fontFamily};
1925
1994
  font-size: 14px;
1926
1995
  color: var(--pluno-pa-text);
1927
1996
  width: var(--pluno-pa-launcher-width);
@@ -2567,19 +2636,26 @@ function Pt(e, t) {
2567
2636
  align-self: stretch;
2568
2637
  display: block;
2569
2638
  color: var(--pluno-pa-muted);
2570
- font-size: 12px;
2639
+ font-size: 15px;
2571
2640
  line-height: 1.35;
2572
2641
  margin-top: -4px;
2573
2642
  }
2574
2643
  .pluno-pa-widget__share-prompt-body {
2575
2644
  min-width: 0;
2576
2645
  display: grid;
2646
+ grid-template-columns: 44px minmax(0, 1fr);
2577
2647
  gap: 8px;
2578
2648
  border: 1px solid var(--pluno-pa-divider);
2579
2649
  border-radius: 8px;
2580
2650
  background: color-mix(in srgb, var(--pluno-pa-surface) 78%, transparent);
2581
2651
  padding: 8px;
2582
2652
  }
2653
+ .pluno-pa-widget__share-prompt-icon {
2654
+ width: 44px;
2655
+ height: 44px;
2656
+ align-self: start;
2657
+ margin-top: 1px;
2658
+ }
2583
2659
  .pluno-pa-widget__share-prompt-copy {
2584
2660
  min-width: 0;
2585
2661
  display: grid;
@@ -2587,19 +2663,20 @@ function Pt(e, t) {
2587
2663
  }
2588
2664
  .pluno-pa-widget__share-prompt-copy strong {
2589
2665
  color: var(--pluno-pa-text);
2590
- font-size: 12px;
2666
+ font-size: 15px;
2591
2667
  line-height: 1.25;
2592
2668
  font-weight: 650;
2593
2669
  }
2594
2670
  .pluno-pa-widget__share-prompt-copy span {
2595
2671
  color: var(--pluno-pa-muted);
2596
- font-size: 11px;
2672
+ font-size: 14px;
2597
2673
  line-height: 1.35;
2598
2674
  }
2599
2675
  .pluno-pa-widget__share-prompt-copy .pluno-pa-widget__share-prompt-error {
2600
2676
  color: #ef4444;
2601
2677
  }
2602
2678
  .pluno-pa-widget__share-prompt-actions {
2679
+ grid-column: 2;
2603
2680
  display: flex;
2604
2681
  align-items: center;
2605
2682
  justify-content: space-between;
@@ -2665,7 +2742,7 @@ function Pt(e, t) {
2665
2742
  place-items: center;
2666
2743
  padding: 18px;
2667
2744
  background: rgba(24, 24, 27, 0.28);
2668
- font-family: var(--pluno-pa-font, ${V.fontFamily});
2745
+ font-family: var(--pluno-pa-font, ${G.fontFamily});
2669
2746
  color: var(--pluno-pa-text);
2670
2747
  }
2671
2748
  .pluno-pa-widget__share-dialog {
@@ -3285,6 +3362,9 @@ function Pt(e, t) {
3285
3362
  visibility: hidden;
3286
3363
  }
3287
3364
  .pluno-pa-widget__login {
3365
+ display: inline-flex;
3366
+ align-items: center;
3367
+ justify-content: center;
3288
3368
  border: 0;
3289
3369
  border-radius: 8px;
3290
3370
  background: #09090b;
@@ -3292,6 +3372,7 @@ function Pt(e, t) {
3292
3372
  min-height: 38px;
3293
3373
  padding: 0 14px;
3294
3374
  font: 650 13px/1 var(--pluno-pa-font);
3375
+ text-decoration: none;
3295
3376
  cursor: pointer;
3296
3377
  box-shadow: 0 8px 18px rgba(9, 9, 11, 0.16);
3297
3378
  }
@@ -3679,28 +3760,28 @@ function Pt(e, t) {
3679
3760
  filter: url(#pluno-pa-scribble-wobble-2);
3680
3761
  }
3681
3762
  `;
3682
- if (ha(e, n))
3763
+ if (wa(e, n))
3683
3764
  return;
3684
3765
  const o = e.ownerDocument.createElement("style");
3685
- o.id = zt, o.textContent = n, e.appendChild(o), Qt(e);
3766
+ o.id = Ht, o.textContent = n, e.appendChild(o), on(e);
3686
3767
  }
3687
- function ga(e) {
3688
- return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute($t) === "true";
3768
+ function ba(e) {
3769
+ return e.getElementById(Ht) !== null || e.host instanceof HTMLElement && e.host.getAttribute(qt) === "true";
3689
3770
  }
3690
- function Qt(e) {
3691
- e.host instanceof HTMLElement && e.host.setAttribute($t, "true");
3771
+ function on(e) {
3772
+ e.host instanceof HTMLElement && e.host.setAttribute(qt, "true");
3692
3773
  }
3693
- function ha(e, t) {
3774
+ function wa(e, t) {
3694
3775
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3695
3776
  return !1;
3696
3777
  try {
3697
3778
  const n = new CSSStyleSheet();
3698
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Qt(e), !0;
3779
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], on(e), !0;
3699
3780
  } catch {
3700
3781
  return !1;
3701
3782
  }
3702
3783
  }
3703
- async function ma() {
3784
+ async function _a() {
3704
3785
  return document.body ? document.body : await new Promise((e) => {
3705
3786
  const t = new MutationObserver(() => {
3706
3787
  document.body && (t.disconnect(), e(document.body));
@@ -3708,49 +3789,49 @@ async function ma() {
3708
3789
  t.observe(document.documentElement, { childList: !0 });
3709
3790
  });
3710
3791
  }
3711
- function en(e) {
3792
+ function an(e) {
3712
3793
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3713
3794
  }
3714
- function fa(e) {
3795
+ function xa(e) {
3715
3796
  try {
3716
- const t = window.localStorage.getItem(en(e));
3797
+ const t = window.localStorage.getItem(an(e));
3717
3798
  if (!t)
3718
- return At();
3799
+ return Dt();
3719
3800
  const n = JSON.parse(t);
3720
3801
  return {
3721
3802
  isOpen: n.isOpen === !0,
3722
3803
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3723
3804
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3724
- launcherPosition: xa(n.launcherPosition) ? n.launcherPosition : null,
3725
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3805
+ launcherPosition: Ea(n.launcherPosition) ? n.launcherPosition : null,
3806
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Ft) : [],
3726
3807
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3727
3808
  };
3728
3809
  } catch {
3729
- return At();
3810
+ return Dt();
3730
3811
  }
3731
3812
  }
3732
- async function ba(e) {
3813
+ async function va(e) {
3733
3814
  if (e.loadSharePromptsDisabled)
3734
3815
  return e.loadSharePromptsDisabled();
3735
3816
  try {
3736
- return window.localStorage.getItem(Ot) === "true";
3817
+ return window.localStorage.getItem(zt) === "true";
3737
3818
  } catch {
3738
3819
  return !1;
3739
3820
  }
3740
3821
  }
3741
- function wa(e, t) {
3822
+ function ya(e, t) {
3742
3823
  if (e.persistSharePromptsDisabled) {
3743
3824
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3744
3825
  });
3745
3826
  return;
3746
3827
  }
3747
3828
  try {
3748
- t && window.localStorage.setItem(Ot, "true");
3829
+ t && window.localStorage.setItem(zt, "true");
3749
3830
  } catch {
3750
3831
  return;
3751
3832
  }
3752
3833
  }
3753
- function At() {
3834
+ function Dt() {
3754
3835
  return {
3755
3836
  isOpen: !1,
3756
3837
  composerValue: "",
@@ -3760,43 +3841,43 @@ function At() {
3760
3841
  sharePromptsDisabled: !1
3761
3842
  };
3762
3843
  }
3763
- function _a(e, t) {
3844
+ function Ca(e, t) {
3764
3845
  try {
3765
- window.localStorage.setItem(en(e), JSON.stringify(t));
3846
+ window.localStorage.setItem(an(e), JSON.stringify(t));
3766
3847
  } catch {
3767
3848
  return;
3768
3849
  }
3769
3850
  }
3770
- function xa(e) {
3851
+ function Ea(e) {
3771
3852
  if (!e || typeof e != "object")
3772
3853
  return !1;
3773
3854
  const t = e;
3774
3855
  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");
3775
3856
  }
3776
- const Tt = /* @__PURE__ */ new WeakSet();
3777
- function va(e) {
3857
+ const Rt = /* @__PURE__ */ new WeakSet();
3858
+ function Sa(e) {
3778
3859
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3779
3860
  }
3780
- function Nt(e) {
3861
+ function Mt(e) {
3781
3862
  const t = e.pathname.split("/");
3782
3863
  return t[t.length - 1] ?? "";
3783
3864
  }
3784
- function ya(e, t) {
3865
+ function ka(e, t) {
3785
3866
  const n = new URL(e.src, document.baseURI);
3786
- return n.href === t.href || n.pathname === t.pathname ? !0 : Nt(n) === Nt(t);
3867
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Mt(n) === Mt(t);
3787
3868
  }
3788
- class q extends EventTarget {
3869
+ class Y extends EventTarget {
3789
3870
  constructor(t, n) {
3790
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Bn, () => {
3791
- this.readyState = q.OPEN, this.dispatchEvent(new Event("open"));
3792
- }), this.addPreviewListener(Fn, (o) => {
3871
+ super(), this.channelId = n, this.url = t, this.addPreviewListener($n, () => {
3872
+ this.readyState = Y.OPEN, this.dispatchEvent(new Event("open"));
3873
+ }), this.addPreviewListener(Gn, (o) => {
3793
3874
  const a = o;
3794
3875
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3795
- }), this.addPreviewListener(Un, () => {
3796
- this.readyState = q.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3797
- }), this.addPreviewListener(zn, (o) => {
3876
+ }), this.addPreviewListener(Wn, () => {
3877
+ this.readyState = Y.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3878
+ }), this.addPreviewListener(Hn, (o) => {
3798
3879
  const a = o;
3799
- this.readyState = q.CLOSED, this.dispatchEvent(
3880
+ this.readyState = Y.CLOSED, this.dispatchEvent(
3800
3881
  new CloseEvent("close", {
3801
3882
  code: a.detail?.code ?? 1e3,
3802
3883
  reason: a.detail?.reason ?? "",
@@ -3804,7 +3885,7 @@ class q extends EventTarget {
3804
3885
  })
3805
3886
  ), this.cleanup();
3806
3887
  }), window.dispatchEvent(
3807
- new CustomEvent(Ce(Rn, this.channelId), {
3888
+ new CustomEvent(Se(Un, this.channelId), {
3808
3889
  detail: { socketId: this.socketId, url: t }
3809
3890
  })
3810
3891
  );
@@ -3819,27 +3900,27 @@ class q extends EventTarget {
3819
3900
  extensions = "";
3820
3901
  binaryType = "blob";
3821
3902
  bufferedAmount = 0;
3822
- readyState = q.CONNECTING;
3823
- socketId = Ca();
3903
+ readyState = Y.CONNECTING;
3904
+ socketId = La();
3824
3905
  listeners = /* @__PURE__ */ new Map();
3825
3906
  send(t) {
3826
- if (this.readyState !== q.OPEN)
3907
+ if (this.readyState !== Y.OPEN)
3827
3908
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3828
3909
  window.dispatchEvent(
3829
- new CustomEvent(Ce(Mn, this.channelId), {
3910
+ new CustomEvent(Se(Fn, this.channelId), {
3830
3911
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3831
3912
  })
3832
3913
  );
3833
3914
  }
3834
3915
  close(t, n) {
3835
- this.readyState !== q.CLOSED && (this.readyState = q.CLOSING, window.dispatchEvent(
3836
- new CustomEvent(Ce(On, this.channelId), {
3916
+ this.readyState !== Y.CLOSED && (this.readyState = Y.CLOSING, window.dispatchEvent(
3917
+ new CustomEvent(Se(zn, this.channelId), {
3837
3918
  detail: { socketId: this.socketId, code: t, reason: n }
3838
3919
  })
3839
3920
  ), this.cleanup());
3840
3921
  }
3841
3922
  addPreviewListener(t, n) {
3842
- const o = Ce(t, this.channelId), a = (i) => {
3923
+ const o = Se(t, this.channelId), a = (i) => {
3843
3924
  i.detail?.socketId === this.socketId && n(i);
3844
3925
  };
3845
3926
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3850,36 +3931,36 @@ class q extends EventTarget {
3850
3931
  this.listeners.clear();
3851
3932
  }
3852
3933
  }
3853
- function Ca() {
3854
- const e = window.sessionStorage.getItem(ut);
3934
+ function La() {
3935
+ const e = window.sessionStorage.getItem(ht);
3855
3936
  if (e)
3856
3937
  return e;
3857
3938
  const t = crypto.randomUUID();
3858
- return window.sessionStorage.setItem(ut, t), t;
3939
+ return window.sessionStorage.setItem(ht, t), t;
3859
3940
  }
3860
- function Ce(e, t) {
3941
+ function Se(e, t) {
3861
3942
  return `${e}:${t}`;
3862
3943
  }
3863
- function Ea(e) {
3944
+ function Aa(e) {
3864
3945
  const t = document.currentScript;
3865
3946
  if (t instanceof HTMLScriptElement)
3866
3947
  return [t];
3867
3948
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3868
3949
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3869
- (a) => a instanceof HTMLScriptElement && va(a) && ya(a, o)
3950
+ (a) => a instanceof HTMLScriptElement && Sa(a) && ka(a, o)
3870
3951
  );
3871
3952
  }
3872
- function Sa(e) {
3873
- for (const t of Ea(e)) {
3874
- if (Tt.has(t) || t.dataset.plunoAutoMount === "false")
3953
+ function Pa(e) {
3954
+ for (const t of Aa(e)) {
3955
+ if (Rt.has(t) || t.dataset.plunoAutoMount === "false")
3875
3956
  continue;
3876
- Tt.add(t);
3957
+ Rt.add(t);
3877
3958
  const n = t.dataset.plunoPreviewChannel;
3878
- ro({
3959
+ co({
3879
3960
  token: t.dataset.plunoToken,
3880
3961
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3881
3962
  backendUrl: t.dataset.plunoBackendUrl,
3882
- webSocketFactory: n ? io(n) : void 0,
3963
+ webSocketFactory: n ? so(n) : void 0,
3883
3964
  launcherLabel: t.dataset.plunoLauncherLabel,
3884
3965
  accentColor: t.dataset.plunoAccentColor,
3885
3966
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3891,8 +3972,8 @@ function Sa(e) {
3891
3972
  });
3892
3973
  }
3893
3974
  }
3894
- Sa(import.meta.url);
3975
+ Pa(import.meta.url);
3895
3976
  export {
3896
- io as createProductAgentPreviewBridgeWebSocketFactory,
3897
- ro as mountPlunoProductAgentWidget
3977
+ so as createProductAgentPreviewBridgeWebSocketFactory,
3978
+ co as mountPlunoProductAgentWidget
3898
3979
  };