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