@pluno/product-agent-web 0.1.36 → 0.1.37

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 sn } from "./product-agent-sdk.js";
2
- const dn = "#7c3aed";
3
- function cn(e) {
4
- const t = fn(e);
1
+ import { PlunoProductAgent as dn } from "./product-agent-sdk.js";
2
+ const cn = "#7c3aed";
3
+ function un(e) {
4
+ const t = mn(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,23 +75,20 @@ function cn(e) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function un(e) {
79
- return `data:image/svg+xml,${encodeURIComponent(cn(e))}`;
80
- }
81
- const le = "#2c2a1e", rt = [253, 250, 241], lt = 3.5;
82
- function Nt(e) {
83
- const t = It(e);
84
- if (pt(me(t), rt) >= lt)
78
+ const pe = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
79
+ function It(e) {
80
+ const t = Dt(e);
81
+ if (st(fe(t), lt) >= pt)
85
82
  return t;
86
- let o = me(t);
87
- const a = me(le);
83
+ let o = fe(t);
84
+ const a = fe(pe);
88
85
  for (let i = 0; i < 6; i += 1)
89
- if (o = bn(o, a, 0.22), pt(o, rt) >= lt)
90
- return Fe(o);
91
- return Fe(o);
86
+ if (o = fn(o, a, 0.22), st(o, lt) >= pt)
87
+ return Ue(o);
88
+ return Ue(o);
92
89
  }
93
90
  function gn(e) {
94
- const t = Nt(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";
91
+ const t = It(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
95
92
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
96
93
  <defs>
97
94
  <clipPath id="scribbleBoltClip">
@@ -104,35 +101,32 @@ function gn(e) {
104
101
  </defs>
105
102
  <g filter="url(#scribbleBoltWobble)">
106
103
  <g clip-path="url(#scribbleBoltClip)">
107
- <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="${hn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
108
105
  </g>
109
- <path d="${n}" fill="none" stroke="${le}" stroke-width="18" stroke-linejoin="round"/>
106
+ <path d="${n}" fill="none" stroke="${pe}" stroke-width="18" stroke-linejoin="round"/>
110
107
  <g transform="rotate(-2 528 463)">
111
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
112
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${le}"/>
108
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
109
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${pe}"/>
113
110
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
114
111
  </g>
115
112
  <g transform="rotate(2 717 462)">
116
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
117
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${le}"/>
113
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
114
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${pe}"/>
118
115
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
116
  </g>
120
117
  </g>
121
118
  </svg>`;
122
119
  }
123
- function hn(e) {
124
- return `data:image/svg+xml,${encodeURIComponent(gn(e))}`;
125
- }
126
- function mn() {
120
+ function hn() {
127
121
  let n = "M 280 120", o = !1, a = 0;
128
122
  for (let i = 150; i <= 1170; i += 62) {
129
- const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
130
- n += ` L ${p} ${i}`, o = !o, a += 1;
123
+ const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
124
+ n += ` L ${s} ${i}`, o = !o, a += 1;
131
125
  }
132
126
  return n;
133
127
  }
134
- function fn(e) {
135
- const t = It(e), n = Ue(me(t));
128
+ function mn(e) {
129
+ const t = Dt(e), n = ze(fe(t));
136
130
  return n > 0.86 ? {
137
131
  top: "#ffffff",
138
132
  middle: "#f6f6f6",
@@ -168,34 +162,34 @@ function fn(e) {
168
162
  shadow: z(t, -0.25, -0.08)
169
163
  };
170
164
  }
171
- function It(e) {
165
+ function Dt(e) {
172
166
  const t = e.trim();
173
- 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()}` : dn;
167
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : cn;
174
168
  }
175
- function me(e) {
169
+ function fe(e) {
176
170
  return [
177
171
  Number.parseInt(e.slice(1, 3), 16),
178
172
  Number.parseInt(e.slice(3, 5), 16),
179
173
  Number.parseInt(e.slice(5, 7), 16)
180
174
  ];
181
175
  }
182
- function Fe([e, t, n]) {
176
+ function Ue([e, t, n]) {
183
177
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
184
178
  return `#${o(e)}${o(t)}${o(n)}`;
185
179
  }
186
- function Ue([e, t, n]) {
180
+ function ze([e, t, n]) {
187
181
  const o = (a) => {
188
182
  const i = a / 255;
189
183
  return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
190
184
  };
191
185
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
192
186
  }
193
- function pt(e, t) {
194
- const n = Ue(e), o = Ue(t), [a, i] = n > o ? [n, o] : [o, n];
187
+ function st(e, t) {
188
+ const n = ze(e), o = ze(t), [a, i] = n > o ? [n, o] : [o, n];
195
189
  return (a + 0.05) / (i + 0.05);
196
190
  }
197
- function bn(e, t, n) {
198
- const o = ze(n);
191
+ function fn(e, t, n) {
192
+ const o = Ge(n);
199
193
  return [
200
194
  e[0] + (t[0] - e[0]) * o,
201
195
  e[1] + (t[1] - e[1]) * o,
@@ -203,43 +197,43 @@ function bn(e, t, n) {
203
197
  ];
204
198
  }
205
199
  function z(e, t, n) {
206
- const [o, a, i] = wn(me(e));
207
- return Fe(_n(o, ze(a + n), ze(i + t)));
200
+ const [o, a, i] = bn(fe(e));
201
+ return Ue(wn(o, Ge(a + n), Ge(i + t)));
208
202
  }
209
- function wn([e, t, n]) {
210
- const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
211
- if (l === p)
212
- return [0, 0, c];
213
- const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
214
- return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
203
+ function bn([e, t, n]) {
204
+ const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
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];
215
209
  }
216
- function _n(e, t, n) {
210
+ function wn(e, t, n) {
217
211
  if (t === 0)
218
212
  return [n * 255, n * 255, n * 255];
219
213
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
220
214
  return [
221
- De(a, o, e + 1 / 3) * 255,
222
- De(a, o, e) * 255,
223
- De(a, o, e - 1 / 3) * 255
215
+ Re(a, o, e + 1 / 3) * 255,
216
+ Re(a, o, e) * 255,
217
+ Re(a, o, e - 1 / 3) * 255
224
218
  ];
225
219
  }
226
- function De(e, t, n) {
220
+ function Re(e, t, n) {
227
221
  let o = n;
228
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;
229
223
  }
230
- function ze(e) {
224
+ function Ge(e) {
231
225
  return Math.max(0, Math.min(1, e));
232
226
  }
233
- const Dt = "suggest_share_on_socials";
234
- function xn(e) {
227
+ const Rt = "suggest_share_on_socials";
228
+ function _n(e) {
235
229
  for (let t = e.length - 1; t >= 0; t -= 1) {
236
230
  const n = e[t];
237
- if (n.role !== "tool" || n.toolName !== Dt)
231
+ if (n.role !== "tool" || n.toolName !== Rt)
238
232
  continue;
239
- const o = st(e, t, "assistant");
233
+ const o = dt(e, t, "assistant");
240
234
  if (!o)
241
235
  return null;
242
- const a = st(e, o.index, "user");
236
+ const a = dt(e, o.index, "user");
243
237
  return a ? {
244
238
  id: `share:${n.callId ?? n.id}`,
245
239
  userPrompt: a.content,
@@ -248,13 +242,13 @@ function xn(e) {
248
242
  }
249
243
  return null;
250
244
  }
251
- async function vn(e) {
252
- const t = await yn(e);
245
+ async function xn(e) {
246
+ const t = await vn(e);
253
247
  if (!navigator.clipboard || typeof ClipboardItem > "u")
254
248
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
255
249
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
256
250
  }
257
- function st(e, t, n) {
251
+ function dt(e, t, n) {
258
252
  for (let o = t - 1; o >= 0; o -= 1) {
259
253
  const a = e[o];
260
254
  if (a.role === n && a.content.trim())
@@ -262,73 +256,73 @@ function st(e, t, n) {
262
256
  }
263
257
  return null;
264
258
  }
265
- async function yn(e) {
259
+ async function vn(e) {
266
260
  return await (await fetch(e)).blob();
267
261
  }
268
- const Cn = "https://app.pluno.ai", En = "/api/product-agent/embed/active-users", kn = 1800, Sn = 15e3, Ln = 250, Pn = 1e3, An = 3e4;
269
- function Tn(e, t = {}) {
262
+ const yn = "https://app.pluno.ai", Cn = "/api/product-agent/embed/active-users", En = 1800, Sn = 15e3, kn = 250, Ln = 1e3, Pn = 3e4;
263
+ function An(e, t = {}) {
270
264
  let n = !1, o = null, a = null, i = null;
271
265
  const l = () => {
272
266
  i !== null && (window.clearInterval(i), i = null);
273
- }, p = (s) => {
267
+ }, s = (p) => {
274
268
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
275
269
  d();
276
- }, Dn(s)));
277
- }, c = (s) => {
270
+ }, In(p)));
271
+ }, u = (p) => {
278
272
  if (l(), o === null) {
279
- o = s, e(s);
273
+ o = p, e(p);
280
274
  return;
281
275
  }
282
- const f = o, C = performance.now();
276
+ const w = o, x = performance.now();
283
277
  i = window.setInterval(() => {
284
278
  if (n) {
285
279
  l();
286
280
  return;
287
281
  }
288
- const S = Math.min(1, (performance.now() - C) / kn);
289
- o = Math.round(f + (s - f) * Mn(S)), e(o), S >= 1 && (o = s, e(s), l());
290
- }, Ln);
282
+ const L = Math.min(1, (performance.now() - x) / En);
283
+ o = Math.round(w + (p - w) * Dn(L)), e(o), L >= 1 && (o = p, e(p), l());
284
+ }, kn);
291
285
  }, d = async () => {
292
286
  try {
293
- const s = await Nn(t);
287
+ const p = await Tn(t);
294
288
  if (n)
295
289
  return;
296
- c(s.count), p(s.refreshAfterMs);
290
+ u(p.count), s(p.refreshAfterMs);
297
291
  } catch {
298
- p(Sn);
292
+ s(Sn);
299
293
  }
300
294
  };
301
295
  return d(), () => {
302
296
  n = !0, a !== null && window.clearTimeout(a), l();
303
297
  };
304
298
  }
305
- async function Nn(e) {
299
+ async function Tn(e) {
306
300
  if (e.loader)
307
301
  return e.loader();
308
- const n = await (e.fetcher ?? fetch)(new URL(En, In(e.backendUrl ?? Cn)).toString(), {
302
+ const n = await (e.fetcher ?? fetch)(new URL(Cn, Nn(e.backendUrl ?? yn)).toString(), {
309
303
  cache: "no-store",
310
304
  credentials: "omit"
311
305
  });
312
306
  if (!n.ok)
313
307
  throw new Error("Failed to load active users");
314
- const o = await n.json(), a = dt(o.count), i = dt(o.refreshAfterMs ?? o.refresh_after_ms);
308
+ const o = await n.json(), a = ct(o.count), i = ct(o.refreshAfterMs ?? o.refresh_after_ms);
315
309
  if (a === null || i === null)
316
310
  throw new Error("Invalid active users response");
317
311
  return { count: a, refreshAfterMs: i };
318
312
  }
319
- function dt(e) {
313
+ function ct(e) {
320
314
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
321
315
  }
322
- function In(e) {
316
+ function Nn(e) {
323
317
  return e.endsWith("/") ? e : `${e}/`;
324
318
  }
325
- function Dn(e) {
326
- return Math.min(An, Math.max(Pn, e));
319
+ function In(e) {
320
+ return Math.min(Pn, Math.max(Ln, e));
327
321
  }
328
- function Mn(e) {
322
+ function Dn(e) {
329
323
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
330
324
  }
331
- const Mt = 100, Rn = "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", ct = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Ot = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Ot).join(","), jn = 3, j = {
325
+ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-agent:sdk-preview-socket-send", On = "product-agent:sdk-preview-socket-close", Bn = "product-agent:sdk-preview-socket-open", Fn = "product-agent:sdk-preview-socket-message", Un = "product-agent:sdk-preview-socket-error", zn = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, $n = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), Hn = 3, j = {
332
326
  launcherLabel: "Ask for anything...",
333
327
  accentColor: "#7c3aed",
334
328
  colorScheme: "light",
@@ -336,11 +330,48 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", On = "product-a
336
330
  scribbleStyle: !1,
337
331
  position: "bottom-right",
338
332
  movableLauncher: !1
339
- }, ut = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Bt = 190, Ft = 41, qn = 48, Kn = 420, Yn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, $e = 50, eo = "http://www.w3.org/2000/svg", to = 11, no = 13, ht = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
340
- function ro(e) {
333
+ }, jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ft = 190, Ut = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, $e = 50, Qn = "http://www.w3.org/2000/svg", ht = [
334
+ {
335
+ ellipseCx: "17.5",
336
+ ellipseCy: "24.5",
337
+ ellipseRx: "2.4",
338
+ ellipseRy: "3",
339
+ strokeWidth: "1.6",
340
+ path: "M18.5 27 C20.5 12, 7.5 2.5, 6 18.5",
341
+ pathStrokeWidth: "2.5"
342
+ },
343
+ {
344
+ ellipseCx: "17.9",
345
+ ellipseCy: "24.1",
346
+ ellipseRx: "2.5",
347
+ ellipseRy: "2.8",
348
+ strokeWidth: "1.5",
349
+ path: "M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4",
350
+ pathStrokeWidth: "2.35"
351
+ },
352
+ {
353
+ ellipseCx: "17.1",
354
+ ellipseCy: "24.9",
355
+ ellipseRx: "2.2",
356
+ ellipseRy: "3.1",
357
+ strokeWidth: "1.7",
358
+ path: "M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2",
359
+ pathStrokeWidth: "2.6"
360
+ },
361
+ {
362
+ ellipseCx: "17.6",
363
+ ellipseCy: "24.4",
364
+ ellipseRx: "2.4",
365
+ ellipseRy: "2.9",
366
+ strokeWidth: "1.6",
367
+ path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
368
+ pathStrokeWidth: "2.45"
369
+ }
370
+ ], eo = 11, to = 13, mt = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", zt = "pluno-pa-widget-styles", Gt = "data-pluno-pa-widget-styles";
371
+ function io(e) {
341
372
  return (t) => new V(t, e);
342
373
  }
343
- async function lo(e = {}) {
374
+ async function ro(e = {}) {
344
375
  const t = {
345
376
  launcherLabel: e.launcherLabel ?? j.launcherLabel,
346
377
  accentColor: e.accentColor ?? j.accentColor,
@@ -385,10 +416,10 @@ async function lo(e = {}) {
385
416
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
386
417
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
387
418
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
388
- let i = mt(t.accentColor, t.scribbleStyle);
389
- yo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
- const l = await ga(), p = l.ownerDocument;
391
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Lt(o, t.accentColor), ft(a, i, {
419
+ let i = ft(t.accentColor, t.scribbleStyle);
420
+ vo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
421
+ const l = await ua(), s = l.ownerDocument;
422
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), bt(a, i, {
392
423
  accentColor: t.accentColor,
393
424
  colorScheme: t.colorScheme,
394
425
  fontFamily: t.fontFamily,
@@ -399,16 +430,16 @@ async function lo(e = {}) {
399
430
  fontFamily: t.fontFamily,
400
431
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
401
432
  });
402
- const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), C = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), R = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), de = a.querySelector(".pluno-pa-widget__active-users-counter"), E = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
403
- if (!c || !s || !f || !C || !S || !x || !R || !v || !y || !h || !g || !_ || !N || !Z || !de || !E || !b)
433
+ const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), L = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
434
+ if (!u || !p || !w || !x || !L || !C || !M || !v || !y || !h || !g || !_ || !N || !Z || !ce || !S || !f)
404
435
  throw new Error("Failed to mount Pluno widget");
405
436
  if (t.movableLauncher && !d)
406
437
  throw new Error("Failed to mount Pluno widget drag handle");
407
- _t(s), _t(g);
408
- let m = [], k = null;
409
- const P = () => {
410
- Oo(v, m, (r) => {
411
- m = m.filter((u, T) => T !== r), P(), O(w.getState()), U();
438
+ xt(p), xt(g);
439
+ let m = [], T = null;
440
+ const k = () => {
441
+ Mo(v, m, (r) => {
442
+ m = m.filter((c, A) => A !== r), k(), O(b.getState()), U();
412
443
  });
413
444
  }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
414
445
  if (!t.tokenEndpoint)
@@ -421,19 +452,19 @@ async function lo(e = {}) {
421
452
  });
422
453
  if (!r.ok)
423
454
  throw new Error("Failed to load Pluno token");
424
- const u = await r.json();
425
- if (!u.token)
455
+ const c = await r.json();
456
+ if (!c.token)
426
457
  throw new Error("Pluno token endpoint did not return a token");
427
- return u.token;
428
- }), A = window.fetch.bind(window);
429
- let w;
430
- w = await sn.init({
458
+ return c.token;
459
+ }), P = window.fetch.bind(window);
460
+ let b;
461
+ b = await dn.init({
431
462
  token: t.token,
432
463
  tokenProvider: I,
433
464
  backendUrl: t.backendUrl,
434
465
  metadata: () => ({
435
466
  ...t.metadata ?? {},
436
- ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
467
+ ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
437
468
  }),
438
469
  initialStarterPrompts: t.initialStarterPrompts,
439
470
  clientId: t.clientId,
@@ -442,42 +473,42 @@ async function lo(e = {}) {
442
473
  webSocketFactory: t.webSocketFactory,
443
474
  autoConnect: t.loginRequired ? !1 : void 0
444
475
  });
445
- const J = ha(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
446
- let ke = J.sharePromptsDisabled || await ma(t), G = t.movableLauncher ? J.launcherPosition : null, qe = G !== null, q = null, Se = !1, Q = !1, ee = {
476
+ const J = ga(t), Se = new Set(J.openToolGroupKeys), ie = new Set(J.seenShareCandidateIds), be = new Set(ie);
477
+ let ke = J.sharePromptsDisabled || await ha(t), $ = t.movableLauncher ? J.launcherPosition : null, Ke = $ !== null, q = null, Le = !1, Q = !1, ee = {
447
478
  enabled: !0
448
- }, te = 0, Ke = "";
449
- const H = (r, u) => {
450
- ee = { enabled: r, reason: u };
451
- }, W = () => {
479
+ }, te = 0, Ye = "";
480
+ const W = (r, c) => {
481
+ ee = { enabled: r, reason: c };
482
+ }, H = () => {
452
483
  Z.hidden = !0;
453
- }, en = () => {
484
+ }, tn = () => {
454
485
  Z.hidden = !1;
455
- }, tn = (r = "jump") => {
456
- H(!0, r), W(), he(E, () => ee.enabled), te = E.scrollTop;
457
- }, nn = () => {
458
- Se || typeof document > "u" || (Lt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
459
- }, Ye = new MutationObserver(nn);
460
- Ye.observe(p.documentElement, { childList: !0, subtree: !0 });
461
- const Le = (r = !0) => {
462
- const u = Ge(a, r);
463
- return bt(
486
+ }, nn = (r = "jump") => {
487
+ W(!0, r), H(), me(S, () => ee.enabled), te = S.scrollTop;
488
+ }, on = () => {
489
+ Le || typeof document > "u" || (Pt(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
490
+ }, Xe = new MutationObserver(on);
491
+ Xe.observe(s.documentElement, { childList: !0, subtree: !0 });
492
+ const Pe = (r = !0) => {
493
+ const c = We(a, r);
494
+ return wt(
464
495
  a,
465
- G ?? ho(a, t.position, u),
466
- u
496
+ $ ?? go(a, t.position, c),
497
+ c
467
498
  );
468
499
  }, F = () => {
469
- ba(t, {
500
+ fa(t, {
470
501
  isOpen: a.classList.contains("pluno-pa-widget--open"),
471
502
  composerValue: g.value,
472
- openToolGroupKeys: [...Ee],
473
- launcherPosition: qe ? G : null,
474
- seenShareCandidateIds: [...ae].slice(-Mt),
503
+ openToolGroupKeys: [...Se],
504
+ launcherPosition: Ke ? $ : null,
505
+ seenShareCandidateIds: [...ie].slice(-Mt),
475
506
  sharePromptsDisabled: ke
476
507
  });
477
- }, ne = (r, u = {}) => {
478
- _o(r, {
479
- debugVersion: io,
480
- launcherPosition: G,
508
+ }, ne = (r, c = {}) => {
509
+ wo(r, {
510
+ debugVersion: ao,
511
+ launcherPosition: $,
481
512
  rootClasses: a.className,
482
513
  rootStyle: {
483
514
  left: a.style.left,
@@ -486,150 +517,150 @@ async function lo(e = {}) {
486
517
  bottom: a.style.bottom
487
518
  },
488
519
  rootRect: Me(a),
489
- launcherRect: Me(c),
490
- panelRect: Me(f),
491
- viewport: se(),
492
- panelHidden: f.hidden,
493
- closeHidden: C.hidden,
494
- ...u
520
+ launcherRect: Me(u),
521
+ panelRect: Me(w),
522
+ viewport: de(),
523
+ panelHidden: w.hidden,
524
+ closeHidden: x.hidden,
525
+ ...c
495
526
  });
496
- }, be = (r = !0) => {
497
- if (!G)
498
- return _e(a, null), Le(r);
499
- const u = Le(r);
500
- return _e(a, u), ne("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
501
- }, Xe = (r, u) => {
502
- if (!r || !u) {
503
- wo(a);
527
+ }, we = (r = !0) => {
528
+ if (!$)
529
+ return xe(a, null), Pe(r);
530
+ const c = Pe(r);
531
+ return xe(a, c), ne("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
532
+ }, Ze = (r, c) => {
533
+ if (!r || !c) {
534
+ bo(a);
504
535
  return;
505
536
  }
506
- bo(a, {
507
- x: r.x - u.x,
508
- y: r.y - u.y
537
+ fo(a, {
538
+ x: r.x - c.x,
539
+ y: r.y - c.y
509
540
  });
510
- }, Ze = () => {
511
- const r = be();
541
+ }, Je = () => {
542
+ const r = we();
512
543
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
513
- const u = wt(a, r, t.position);
514
- Xe(u, r), ne("Applied open panel position after viewport resize", { openPanelPosition: u });
515
- } else G && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
544
+ const c = _t(a, r, t.position);
545
+ Ze(c, r), ne("Applied open panel position after viewport resize", { openPanelPosition: c });
546
+ } else $ && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
516
547
  };
517
- let Je = () => {
548
+ let Qe = () => {
518
549
  };
519
- window.addEventListener("resize", Ze), t.movableLauncher && d ? (be(), Je = go({
550
+ window.addEventListener("resize", Je), t.movableLauncher && d ? (we(), Qe = uo({
520
551
  root: a,
521
- launcher: c,
552
+ launcher: u,
522
553
  launcherDragHandle: d,
523
- getPosition: () => Le(),
554
+ getPosition: () => Pe(),
524
555
  setPosition: (r) => {
525
- const u = r;
526
- G = bt(a, r, Ge(a)), _e(a, G), ne("Dragging closed launcher", { requestedPosition: u });
556
+ const c = r;
557
+ $ = wt(a, r, We(a)), xe(a, $), ne("Dragging closed launcher", { requestedPosition: c });
527
558
  },
528
559
  persist: () => {
529
- qe = !0, F(), ne("Persisted closed launcher drag position");
560
+ Ke = !0, F(), ne("Persisted closed launcher drag position");
530
561
  }
531
- })) : _e(a, null);
532
- let Pe = !1;
533
- const Qe = async () => {
534
- if (!(!t.billingStatusLoader || Pe)) {
535
- Pe = !0;
562
+ })) : xe(a, null);
563
+ let Ae = !1;
564
+ const et = async () => {
565
+ if (!(!t.billingStatusLoader || Ae)) {
566
+ Ae = !0;
536
567
  try {
537
568
  const r = await t.billingStatusLoader();
538
- vt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, Be(R, t.billingStatus, w.getState().lastErrorCode), U());
569
+ yt(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Fe(M, t.billingStatus, b.getState().lastErrorCode), U());
539
570
  } finally {
540
- Pe = !1;
571
+ Ae = !1;
541
572
  }
542
573
  }
543
- }, oe = (r = "", u = !0) => {
544
- Qe(), q !== null && (window.clearTimeout(q), q = null), f.hidden = !1, C.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
545
- const T = be(), K = wt(a, T, t.position);
546
- if (Xe(K, T), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: T }), H(!0, "open"), W(), !u) {
547
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
574
+ }, oe = (r = "", c = !0) => {
575
+ et(), q !== null && (window.clearTimeout(q), q = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
576
+ const A = we(), K = _t(a, A, t.position);
577
+ if (Ze(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), W(!0, "open"), H(), !c) {
578
+ a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
548
579
  return;
549
580
  }
550
581
  window.requestAnimationFrame(() => {
551
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
552
- c.hidden = !0, he(E, () => ee.enabled), te = E.scrollTop;
582
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
583
+ u.hidden = !0, me(S, () => ee.enabled), te = S.scrollTop;
553
584
  }, 220);
554
585
  });
555
- }, on = () => {
556
- q !== null && (window.clearTimeout(q), q = null), c.hidden = !1, G && (be(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
557
- f.hidden = !0, C.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
586
+ }, an = () => {
587
+ q !== null && (window.clearTimeout(q), q = null), u.hidden = !1, $ && (we(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
588
+ w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
558
589
  }, 220);
559
590
  };
560
- c.addEventListener("submit", (r) => {
561
- r.preventDefault(), oe(s.value), s.value = "";
591
+ u.addEventListener("submit", (r) => {
592
+ r.preventDefault(), oe(p.value), p.value = "";
562
593
  }), d?.addEventListener("click", (r) => {
563
594
  r.preventDefault(), r.stopPropagation();
564
- }), c.addEventListener("click", (r) => {
565
- r.target === s && !d || (oe(s.value), s.value = "");
566
- }), s.addEventListener("focus", () => {
567
- oe(s.value), s.value = "";
568
- }), s.addEventListener("input", () => {
569
- if (!s.value)
595
+ }), u.addEventListener("click", (r) => {
596
+ r.target === p && !d || (oe(p.value), p.value = "");
597
+ }), p.addEventListener("focus", () => {
598
+ oe(p.value), p.value = "";
599
+ }), p.addEventListener("input", () => {
600
+ if (!p.value)
570
601
  return;
571
- const r = s.value;
572
- oe(r), s.value = "";
573
- }), C.addEventListener("click", on), E.addEventListener("scroll", () => {
574
- E.scrollTop < te - 1 && H(!1, "userScroll"), te = E.scrollTop;
602
+ const r = p.value;
603
+ oe(r), p.value = "";
604
+ }), x.addEventListener("click", an), S.addEventListener("scroll", () => {
605
+ S.scrollTop < te - 1 && W(!1, "userScroll"), te = S.scrollTop;
575
606
  }), Z.addEventListener("click", () => {
576
- tn();
607
+ nn();
577
608
  });
578
- const et = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
609
+ const tt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
579
610
  ([r]) => {
580
- r?.isIntersecting && (H(!0, "bottom"), W());
611
+ r?.isIntersecting && (W(!0, "bottom"), H());
581
612
  },
582
- { root: E, threshold: 0 }
613
+ { root: S, threshold: 0 }
583
614
  );
584
- et?.observe(b);
615
+ tt?.observe(f);
585
616
  const U = () => {
586
- _.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || $(t.billingStatus);
617
+ _.disabled = G(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(t.billingStatus);
587
618
  };
588
- t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, S.hidden = !0), S.addEventListener("submit", (r) => {
619
+ t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, L.hidden = !0), L.addEventListener("submit", (r) => {
589
620
  if (r.preventDefault(), t.loginRequired) {
590
621
  t.onLoginClick?.();
591
622
  return;
592
623
  }
593
- $(t.billingStatus) || (Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U());
624
+ G(t.billingStatus) || (Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U());
594
625
  });
595
- let ce = 0;
596
- const an = () => {
597
- ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
598
- }, tt = (r) => {
599
- k !== null && window.clearTimeout(k), x.textContent = r, x.hidden = !1, k = window.setTimeout(() => {
600
- x.textContent = "", x.hidden = !0, k = null;
626
+ let ue = 0;
627
+ const rn = () => {
628
+ ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
629
+ }, nt = (r) => {
630
+ T !== null && window.clearTimeout(T), C.textContent = r, C.hidden = !1, T = window.setTimeout(() => {
631
+ C.textContent = "", C.hidden = !0, T = null;
601
632
  }, 3e3);
602
- }, rn = () => {
603
- k !== null && (window.clearTimeout(k), k = null), x.textContent = "", x.hidden = !0;
604
- }, nt = async (r) => {
633
+ }, ln = () => {
634
+ T !== null && (window.clearTimeout(T), T = null), C.textContent = "", C.hidden = !0;
635
+ }, ot = async (r) => {
605
636
  if (r.length === 0)
606
637
  return;
607
- const u = await zo(r);
608
- if (m.length + u.length > Ce)
609
- throw new Error(`Attach up to ${Ce} files per message.`);
610
- m = [...m, ...u], P(), rn(), U(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
638
+ const c = await Uo(r);
639
+ if (m.length + c.length > Ee)
640
+ throw new Error(`Attach up to ${Ee} files per message.`);
641
+ m = [...m, ...c], k(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
611
642
  };
612
643
  h.addEventListener("click", () => {
613
- t.loginRequired || $(t.billingStatus) || y.click();
644
+ t.loginRequired || G(t.billingStatus) || y.click();
614
645
  }), y.addEventListener("change", () => {
615
646
  const r = Array.from(y.files ?? []);
616
- y.value = "", nt(r).catch((u) => {
617
- tt(u instanceof Error ? u.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
618
- message: u instanceof Error ? u.message : String(u)
647
+ y.value = "", ot(r).catch((c) => {
648
+ nt(c instanceof Error ? c.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
649
+ message: c instanceof Error ? c.message : String(c)
619
650
  });
620
651
  });
621
652
  }), a.addEventListener("dragenter", (r) => {
622
- !xe(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
653
+ !ve(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ue += 1, a.classList.add("pluno-pa-widget--drag-over"));
623
654
  }), a.addEventListener("dragover", (r) => {
624
- const u = r.dataTransfer;
625
- !xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
655
+ const c = r.dataTransfer;
656
+ !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
626
657
  }), a.addEventListener("dragleave", (r) => {
627
- xe(r.dataTransfer) && (r.stopPropagation(), ce = Math.max(0, ce - 1), ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
658
+ ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
628
659
  }), a.addEventListener("drop", (r) => {
629
- const u = r.dataTransfer;
630
- !xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), an(), nt(u.files).catch((T) => {
631
- tt(T instanceof Error ? T.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
632
- message: T instanceof Error ? T.message : String(T)
660
+ const c = r.dataTransfer;
661
+ !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((A) => {
662
+ nt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
663
+ message: A instanceof Error ? A.message : String(A)
633
664
  });
634
665
  }));
635
666
  }), _.addEventListener("click", () => {
@@ -637,152 +668,152 @@ async function lo(e = {}) {
637
668
  t.onLoginClick?.();
638
669
  return;
639
670
  }
640
- if (w.getState().isThinking) {
641
- w.stop();
671
+ if (b.getState().isThinking) {
672
+ b.stop();
642
673
  return;
643
674
  }
644
- Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
675
+ Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
645
676
  }), N.addEventListener("click", () => {
646
- Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), F(), U(), g.focus(), O(w.getState());
677
+ Q = !0, W(!0, "newSession"), H(), b.startNewSession(), Se.clear(), g.value = "", m = [], k(), he(g), F(), U(), g.focus(), O(b.getState());
647
678
  }), g.addEventListener("input", () => {
648
- ge(g), F(), U(), O(w.getState());
679
+ he(g), F(), U(), O(b.getState());
649
680
  }), g.addEventListener("keydown", (r) => {
650
681
  if (!(r.key !== "Enter" || r.shiftKey)) {
651
682
  if (r.preventDefault(), t.loginRequired) {
652
683
  t.onLoginClick?.();
653
684
  return;
654
685
  }
655
- Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
686
+ Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
656
687
  }
657
688
  }), a.addEventListener("click", (r) => {
658
689
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
659
- }), J.composerValue && (g.value = J.composerValue, ge(g)), J.isOpen && oe(g.value, !1);
660
- const ot = () => i;
661
- let Ae = w.getState().appearance !== null, we = null, ue = null, ie = null, at = w.getState().isThinking, re = null, Te = null, it = () => {
690
+ }), J.composerValue && (g.value = J.composerValue, he(g)), J.isOpen && oe(g.value, !1);
691
+ const at = () => i;
692
+ let Te = b.getState().appearance !== null, _e = null, ge = null, re = null, it = b.getState().isThinking, le = null, Ne = null, rt = () => {
662
693
  };
663
- const ln = !!t.socialPostDraftHandler, O = (r) => {
664
- if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(R, t.billingStatus, re), t.loginRequired) {
665
- Qo(E, _, N, ot, t.loginButtonLabel, t.onLoginClick);
694
+ const pn = !!t.socialPostDraftHandler, O = (r) => {
695
+ if (qe(r.lastErrorCode) ? le = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(M, t.billingStatus, le), t.loginRequired) {
696
+ Jo(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
666
697
  return;
667
698
  }
668
- const u = xo(r), T = u !== Ke;
669
- Ke = u;
699
+ const c = _o(r), A = c !== Ye;
700
+ Ye = c;
670
701
  const K = Q || ee.enabled;
671
- Q = !1, Jo(
672
- E,
673
- b,
702
+ Q = !1, Zo(
703
+ S,
704
+ f,
674
705
  _,
675
706
  N,
676
- de,
707
+ ce,
677
708
  r,
678
- Te,
679
- Te !== null && Ct(r, g.value.trim().length > 0 || m.length > 0),
709
+ Ne,
710
+ Ne !== null && Et(r, g.value.trim().length > 0 || m.length > 0),
680
711
  K,
681
712
  () => ee.enabled,
682
- Ee,
713
+ Se,
683
714
  F,
684
- ot,
685
- (M) => {
686
- Q = !0, H(!0, "send"), W(), w.sendMessage(M);
715
+ at,
716
+ (R) => {
717
+ Q = !0, W(!0, "send"), H(), b.sendMessage(R);
687
718
  },
688
- ln && !ke ? {
689
- dismissedCandidateIds: fe,
690
- draftingCandidateId: we,
691
- error: ue,
692
- onSeen: (M) => {
693
- ae.add(M.id), F();
719
+ pn && !ke ? {
720
+ dismissedCandidateIds: be,
721
+ draftingCandidateId: _e,
722
+ error: ge,
723
+ onSeen: (R) => {
724
+ ie.add(R.id), F();
694
725
  },
695
- onDraft: (M) => {
696
- pn(M);
726
+ onDraft: (R) => {
727
+ sn(R);
697
728
  },
698
- onDismiss: (M) => {
699
- ae.add(M.id), fe.add(M.id), F(), ue = null, O(w.getState());
729
+ onDismiss: (R) => {
730
+ ie.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
700
731
  },
701
- onDisable: (M) => {
702
- ke = !0, ae.add(M.id), fe.add(M.id), F(), fa(t, !0), ue = null, O(w.getState());
732
+ onDisable: (R) => {
733
+ ke = !0, ie.add(R.id), be.add(R.id), F(), ma(t, !0), ge = null, O(b.getState());
703
734
  }
704
735
  } : void 0
705
- ), K ? (te = E.scrollTop, W()) : T && vo(r) && en();
736
+ ), K ? (te = S.scrollTop, H()) : A && xo(r) && tn();
706
737
  };
707
- return it = Tn((r) => {
708
- Te = r, !Se && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && O(w.getState());
709
- }, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), w.on("state", (r) => {
710
- const u = at && !r.isThinking;
711
- at = r.isThinking, r.appearance ? (Ae = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
738
+ return rt = An((r) => {
739
+ Ne = r, !Le && Et(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
740
+ }, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), b.on("state", (r) => {
741
+ const c = it && !r.isThinking;
742
+ it = r.isThinking, r.appearance ? (Te = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
712
743
  appearance: r.appearance
713
- }), Ne(r.appearance, "agent.state.appearance")) : Ae && (Ae = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
744
+ }), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
714
745
  fallbackAccentColor: t.accentColor,
715
746
  fallbackColorScheme: t.colorScheme,
716
747
  fallbackFontFamily: t.fontFamily
717
- }), Ne({}, "agent.state.appearance-cleared")), O(r), U(), u && Qe();
718
- }), O(w.getState()), U(), {
719
- agent: w,
748
+ }), Ie({}, "agent.state.appearance-cleared")), O(r), U(), c && et();
749
+ }), O(b.getState()), U(), {
750
+ agent: b,
720
751
  updateAppearance: (r) => {
721
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ne(r, "widgetHandle.updateAppearance");
752
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ie(r, "widgetHandle.updateAppearance");
722
753
  },
723
754
  updateBillingStatus: (r) => {
724
- const u = r ?? null;
725
- vt(t.billingStatus, u, re) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(
755
+ const c = r ?? null;
756
+ yt(t.billingStatus, c, le) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(
726
757
  a.querySelector(".pluno-pa-widget__billing-status"),
727
758
  t.billingStatus,
728
- re
759
+ le
729
760
  ), U());
730
761
  },
731
762
  openPanel: () => {
732
763
  oe(g.value, !1);
733
764
  },
734
765
  destroy: () => {
735
- Se = !0, Ye.disconnect(), et?.disconnect(), window.removeEventListener("resize", Ze), Je(), k !== null && window.clearTimeout(k), it(), ie?.remove(), w.destroy(), n.remove();
766
+ Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), re?.remove(), b.destroy(), n.remove();
736
767
  }
737
768
  };
738
- async function pn(r) {
739
- if (!we) {
740
- we = r.id, ue = null, O(w.getState());
769
+ async function sn(r) {
770
+ if (!_e) {
771
+ _e = r.id, ge = null, O(b.getState());
741
772
  try {
742
773
  if (!t.socialPostDraftHandler)
743
774
  throw new Error("Social post drafting is not available here.");
744
- const u = await t.socialPostDraftHandler(r);
745
- if (!u.linkedinPost || !u.xPost)
775
+ const c = await t.socialPostDraftHandler(r);
776
+ if (!c.linkedinPost || !c.xPost)
746
777
  throw new Error("Pluno did not return a complete social post draft.");
747
- ae.add(r.id), fe.add(r.id), F(), ie?.remove(), ie = na(u, {
778
+ ie.add(r.id), be.add(r.id), F(), re?.remove(), re = ta(c, {
748
779
  socialPostRewardsUrl: t.socialPostRewardsUrl,
749
780
  onClose: () => {
750
- ie?.remove(), ie = null;
781
+ re?.remove(), re = null;
751
782
  }
752
- }), a.appendChild(ie);
753
- } catch (u) {
754
- ue = u instanceof Error ? u.message : "Could not draft social post.";
783
+ }), a.appendChild(re);
784
+ } catch (c) {
785
+ ge = c instanceof Error ? c.message : "Could not draft social post.";
755
786
  } finally {
756
- we = null, O(w.getState());
787
+ _e = null, O(b.getState());
757
788
  }
758
789
  }
759
790
  }
760
- function Ne(r, u) {
761
- const T = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
762
- i = mt(T, Ie), ft(a, i, {
763
- accentColor: T,
791
+ function Ie(r, c) {
792
+ const A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
793
+ i = ft(A, De), bt(a, i, {
794
+ accentColor: A,
764
795
  colorScheme: K,
765
- fontFamily: M,
766
- scribbleStyle: Ie
796
+ fontFamily: R,
797
+ scribbleStyle: De
767
798
  }), Y("web-sdk.widget", "Updated widget appearance", {
768
- source: u,
799
+ source: c,
769
800
  inputAppearance: r,
770
- appliedAccentColor: T,
801
+ appliedAccentColor: A,
771
802
  appliedColorScheme: K,
772
- appliedFontFamily: M,
773
- appliedScribbleStyle: Ie,
803
+ appliedFontFamily: R,
804
+ appliedScribbleStyle: De,
774
805
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
775
806
  });
776
807
  }
777
808
  }
778
- function mt(e, t) {
779
- return t ? hn(e) : un(e);
809
+ function ft(e, t) {
810
+ return t ? gn(e) : un(e);
780
811
  }
781
- function po(e) {
782
- const t = so(e);
783
- return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
812
+ function lo(e) {
813
+ const t = po(e);
814
+ return t === null ? "#fafafa" : so(t) > 0.5 ? "#18181b" : "#fafaf9";
784
815
  }
785
- function so(e) {
816
+ function po(e) {
786
817
  const t = e.trim();
787
818
  return /^#[0-9a-f]{6}$/i.test(t) ? [
788
819
  Number.parseInt(t.slice(1, 3), 16),
@@ -794,22 +825,22 @@ function so(e) {
794
825
  Number.parseInt(t[3] + t[3], 16)
795
826
  ] : null;
796
827
  }
797
- function co([e, t, n]) {
828
+ function so([e, t, n]) {
798
829
  const o = (a) => {
799
830
  const i = a / 255;
800
831
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
801
832
  };
802
833
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
803
834
  }
804
- function ft(e, t, n) {
835
+ function bt(e, t, n) {
805
836
  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);
806
- const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
807
- 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);
837
+ const o = n.scribbleStyle ? It(n.accentColor) : n.accentColor;
838
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", lo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && co(e.ownerDocument);
808
839
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
809
840
  for (const i of a)
810
- i.src = t;
841
+ i.replaceWith(ae(Array.from(i.classList).join(" "), t));
811
842
  }
812
- function uo(e) {
843
+ function co(e) {
813
844
  if (e.getElementById(gt))
814
845
  return;
815
846
  const t = e.createElement("style");
@@ -821,7 +852,7 @@ function uo(e) {
821
852
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
822
853
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
823
854
  }
824
- function go({
855
+ function uo({
825
856
  root: e,
826
857
  launcher: t,
827
858
  launcherDragHandle: n,
@@ -829,115 +860,115 @@ function go({
829
860
  setPosition: a,
830
861
  persist: i
831
862
  }) {
832
- let l = null, p = null, c = null, d = !1, s = null;
833
- const f = () => {
834
- l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
835
- }, C = (h) => {
836
- e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), d = !1, t.setPointerCapture?.(h.pointerId));
837
- }, S = (h) => {
838
- if (l !== h.pointerId || !p || !c)
863
+ let l = null, s = null, u = null, d = !1, p = null;
864
+ const w = () => {
865
+ l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
866
+ }, x = (h) => {
867
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, u = o(), d = !1, t.setPointerCapture?.(h.pointerId));
868
+ }, L = (h) => {
869
+ if (l !== h.pointerId || !s || !u)
839
870
  return;
840
871
  h.preventDefault();
841
- const g = h.clientX - p.x, _ = h.clientY - p.y;
842
- !d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
843
- }, x = (h) => {
844
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
845
- }, R = (h) => {
846
- l === h.pointerId && (h.preventDefault(), f());
872
+ const g = h.clientX - s.x, _ = h.clientY - s.y;
873
+ !d && Math.hypot(g, _) < mt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: u.x + g, y: u.y + _ }));
874
+ }, C = (h) => {
875
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (p = { x: h.clientX, y: h.clientY }, i()), w());
876
+ }, M = (h) => {
877
+ l === h.pointerId && (h.preventDefault(), w());
847
878
  }, v = (h) => {
848
- if (!s)
879
+ if (!p)
849
880
  return;
850
- const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= ht;
851
- s = null, g && (h.preventDefault(), h.stopPropagation());
881
+ const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= mt;
882
+ p = null, g && (h.preventDefault(), h.stopPropagation());
852
883
  }, y = (h) => {
853
884
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
854
885
  return;
855
- const g = h.shiftKey ? ao : oo, _ = o();
886
+ const g = h.shiftKey ? oo : no, _ = o();
856
887
  let N = null;
857
888
  h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
858
889
  };
859
- return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", S), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
860
- t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
890
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", L), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
891
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", L), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
861
892
  };
862
893
  }
863
- function Ge(e, t = !0) {
864
- const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
894
+ function We(e, t = !0) {
895
+ const n = de(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
865
896
  return {
866
- width: t && a && o.width > 0 ? o.width : Math.min(Bt, n.width - 36),
867
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : Ft
897
+ width: t && a && o.width > 0 ? o.width : Math.min(Ft, n.width - 36),
898
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ut
868
899
  };
869
900
  }
870
901
  function $t() {
871
- const e = se();
902
+ const e = de();
872
903
  return {
873
904
  width: Math.min(
874
- pe(e.width * Xn, Kn, Yn),
905
+ se(e.width * Yn, qn, Kn),
875
906
  e.width - B * 2
876
907
  ),
877
908
  height: Math.min(
878
- pe(e.height * Qn, Zn, Jn),
909
+ se(e.height * Jn, Xn, Zn),
879
910
  e.height - $e - B
880
911
  )
881
912
  };
882
913
  }
883
- function ho(e, t, n) {
914
+ function go(e, t, n) {
884
915
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
885
916
  if (Number.isFinite(o) && Number.isFinite(a))
886
917
  return { x: o, y: a };
887
918
  const i = e.getBoundingClientRect();
888
919
  if (i.width > 0 || i.height > 0)
889
920
  return { x: i.left, y: i.top };
890
- const l = se();
921
+ const l = de();
891
922
  return {
892
923
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
893
924
  y: l.height - 24 - n.height
894
925
  };
895
926
  }
896
- function bt(e, t, n) {
897
- const o = se(), a = B + mo(e);
927
+ function wt(e, t, n) {
928
+ const o = de(), a = B + ho(e);
898
929
  return {
899
- x: pe(t.x, B, Math.max(B, o.width - n.width - B)),
900
- y: pe(t.y, a, Math.max(a, o.height - n.height - B))
930
+ x: se(t.x, B, Math.max(B, o.width - n.width - B)),
931
+ y: se(t.y, a, Math.max(a, o.height - n.height - B))
901
932
  };
902
933
  }
903
- function mo(e) {
904
- return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
934
+ function ho(e) {
935
+ return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
905
936
  }
906
- function wt(e, t, n) {
907
- const o = Ge(e), a = $t(), i = {
937
+ function _t(e, t, n) {
938
+ const o = We(e), a = $t(), i = {
908
939
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
909
940
  y: t.y + o.height - a.height
910
941
  };
911
- return fo(i);
942
+ return mo(i);
912
943
  }
913
- function fo(e) {
914
- const t = se(), n = $t();
944
+ function mo(e) {
945
+ const t = de(), n = $t();
915
946
  return {
916
- x: pe(e.x, B, Math.max(B, t.width - n.width - B)),
917
- y: pe(
947
+ x: se(e.x, B, Math.max(B, t.width - n.width - B)),
948
+ y: se(
918
949
  e.y,
919
950
  $e,
920
951
  Math.max($e, t.height - n.height - B)
921
952
  )
922
953
  };
923
954
  }
924
- function _e(e, t) {
955
+ function xe(e, t) {
925
956
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
926
957
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
927
958
  return;
928
959
  }
929
960
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
930
961
  }
931
- function bo(e, t) {
962
+ function fo(e, t) {
932
963
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
933
964
  }
934
- function wo(e) {
965
+ function bo(e) {
935
966
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
936
967
  }
937
- function se() {
968
+ function de() {
938
969
  return {
939
- width: window.innerWidth || document.documentElement.clientWidth || Bt + B * 2,
940
- height: window.innerHeight || document.documentElement.clientHeight || Ft + B * 2
970
+ width: window.innerWidth || document.documentElement.clientWidth || Ft + B * 2,
971
+ height: window.innerHeight || document.documentElement.clientHeight || Ut + B * 2
941
972
  };
942
973
  }
943
974
  function Me(e) {
@@ -949,7 +980,7 @@ function Me(e) {
949
980
  height: Math.round(t.height)
950
981
  };
951
982
  }
952
- function pe(e, t, n) {
983
+ function se(e, t, n) {
953
984
  return Math.min(Math.max(e, t), n);
954
985
  }
955
986
  function Y(e, t, n) {
@@ -963,24 +994,24 @@ function Y(e, t, n) {
963
994
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
964
995
  i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Gn, { detail: a }));
965
996
  }
966
- function _o(e, t) {
997
+ function wo(e, t) {
967
998
  Y("web-sdk.widget.position", e, t);
968
999
  }
969
- function Re(e, t, n) {
1000
+ function Oe(e, t, n) {
970
1001
  const o = t.value.trim();
971
1002
  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 })), []);
972
1003
  }
973
- function ge(e) {
1004
+ function he(e) {
974
1005
  e.style.height = "0px";
975
1006
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
976
1007
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
977
1008
  }
978
- function he(e, t = () => !0) {
1009
+ function me(e, t = () => !0) {
979
1010
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
980
1011
  t() && (e.scrollTop = e.scrollHeight);
981
1012
  });
982
1013
  }
983
- function xo(e) {
1014
+ function _o(e) {
984
1015
  const t = e.messages[e.messages.length - 1];
985
1016
  return [
986
1017
  e.messages.length,
@@ -991,25 +1022,25 @@ function xo(e) {
991
1022
  e.lastError ?? ""
992
1023
  ].join(":");
993
1024
  }
994
- function vo(e) {
1025
+ function xo(e) {
995
1026
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
996
1027
  }
997
- function yo(e, t, n, o) {
998
- e.appendChild(Po()), e.appendChild(Co(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", Ao(16), !0)), e.appendChild(Eo(n));
1028
+ function vo(e, t, n, o) {
1029
+ e.appendChild(Lo()), e.appendChild(yo(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", Po(16), !0)), e.appendChild(Co(n));
999
1030
  }
1000
- function Co(e, t, n) {
1031
+ function yo(e, t, n) {
1001
1032
  const o = document.createElement("form");
1002
1033
  if (o.className = "pluno-pa-widget__launcher", n) {
1003
1034
  const i = document.createElement("button");
1004
1035
  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);
1005
1036
  }
1006
- o.appendChild(Ht("pluno-pa-widget__character--launcher", t));
1037
+ o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ae("pluno-pa-widget__character--launcher", t));
1007
1038
  const a = document.createElement("input");
1008
1039
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1009
1040
  }
1010
- function Eo(e) {
1041
+ function Co(e) {
1011
1042
  const t = document.createElement("section");
1012
- t.className = "pluno-pa-widget__panel", t.hidden = !0;
1043
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(jt("pluno-pa-widget__scribble-spirals--panel", 16));
1013
1044
  const n = document.createElement("div");
1014
1045
  n.className = "pluno-pa-widget__timeline-wrap";
1015
1046
  const o = document.createElement("main");
@@ -1019,9 +1050,9 @@ function Eo(e) {
1019
1050
  const i = document.createElement("div");
1020
1051
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1021
1052
  const l = document.createElement("button");
1022
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Wt("pluno-pa-widget__new-chat", "New chat", To(), !0)), t.appendChild(n), t.appendChild(ko()), t;
1053
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ht("pluno-pa-widget__new-chat", "New chat", Ao(), !0)), t.appendChild(n), t.appendChild(Eo()), t;
1023
1054
  }
1024
- function ko() {
1055
+ function Eo() {
1025
1056
  const e = document.createElement("form");
1026
1057
  e.className = "pluno-pa-widget__composer";
1027
1058
  const t = document.createElement("div");
@@ -1035,53 +1066,89 @@ function ko() {
1035
1066
  const i = document.createElement("input");
1036
1067
  i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1037
1068
  const l = document.createElement("button");
1038
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(No()), l.appendChild(Io()), a.appendChild(l);
1039
- const p = document.createElement("textarea");
1040
- p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1041
- const c = document.createElement("button");
1042
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(jt()), a.appendChild(c), e.appendChild(a);
1069
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(To()), l.appendChild(No()), a.appendChild(l);
1070
+ const s = document.createElement("textarea");
1071
+ s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1072
+ const u = document.createElement("button");
1073
+ u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(Vt()), a.appendChild(u), e.appendChild(a);
1043
1074
  const d = document.createElement("div");
1044
1075
  d.className = "pluno-pa-widget__composer-meta";
1045
- const s = document.createElement("a");
1046
- s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", d.appendChild(s);
1047
- const f = document.createElement("span");
1048
- return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
1076
+ const p = document.createElement("a");
1077
+ 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);
1078
+ const w = document.createElement("span");
1079
+ return w.className = "pluno-pa-widget__ai-disclaimer", w.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(w), e.appendChild(d), e;
1049
1080
  }
1050
1081
  function So(e) {
1051
1082
  const t = document.createElement("div");
1052
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
1083
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(ae("pluno-pa-widget__character--empty", e)), t.appendChild(Wt()), t;
1053
1084
  }
1054
- function Gt() {
1085
+ function Wt() {
1055
1086
  const e = document.createElement("div");
1056
1087
  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;
1057
1088
  }
1058
- function Lo(e, t) {
1089
+ function ko(e, t) {
1059
1090
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1060
1091
  const n = document.createElement("span");
1061
1092
  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`));
1062
1093
  }
1063
- function Ht(e, t) {
1064
- const n = document.createElement("img");
1065
- return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1094
+ function ae(e, t) {
1095
+ const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0), a = e.split(/\s+/).filter(Boolean);
1096
+ return o.setAttribute(
1097
+ "class",
1098
+ a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1099
+ ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1066
1100
  }
1067
- function Wt(e, t, n, o) {
1101
+ function Ht(e, t, n, o) {
1068
1102
  const a = document.createElement("button");
1069
1103
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1070
1104
  }
1071
- function Po() {
1072
- const e = L("svg", {
1105
+ function Lo() {
1106
+ const e = E("svg", {
1073
1107
  class: "pluno-pa-widget__scribble-defs",
1074
1108
  "aria-hidden": "true",
1075
1109
  focusable: "false",
1076
1110
  width: "0",
1077
1111
  height: "0"
1078
- }), t = L("defs");
1079
- return t.appendChild(Oe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Oe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Oe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1112
+ }), t = E("defs");
1113
+ return t.appendChild(Be("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Be("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Be("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1114
+ }
1115
+ function jt(e, t) {
1116
+ const n = E("svg", {
1117
+ class: `pluno-pa-widget__scribble-spirals ${e}`,
1118
+ viewBox: `0 0 ${t * 26} 36`,
1119
+ preserveAspectRatio: "none",
1120
+ "aria-hidden": "true",
1121
+ focusable: "false"
1122
+ });
1123
+ for (let o = 0; o < t; o += 1) {
1124
+ const a = ht[o % ht.length], i = E("g", { transform: `translate(${o * 26} 0)` });
1125
+ i.appendChild(
1126
+ E("ellipse", {
1127
+ cx: a.ellipseCx,
1128
+ cy: a.ellipseCy,
1129
+ rx: a.ellipseRx,
1130
+ ry: a.ellipseRy,
1131
+ fill: "none",
1132
+ stroke: "#2c2a1e",
1133
+ "stroke-width": a.strokeWidth,
1134
+ opacity: "0.8"
1135
+ })
1136
+ ), i.appendChild(
1137
+ E("path", {
1138
+ d: a.path,
1139
+ fill: "none",
1140
+ stroke: "#2c2a1e",
1141
+ "stroke-width": a.pathStrokeWidth,
1142
+ "stroke-linecap": "round"
1143
+ })
1144
+ ), n.appendChild(i);
1145
+ }
1146
+ return n;
1080
1147
  }
1081
- function Oe(e, t, n) {
1082
- const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1148
+ function Be(e, t, n) {
1149
+ const o = E("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1083
1150
  return o.appendChild(
1084
- L("feTurbulence", {
1151
+ E("feTurbulence", {
1085
1152
  type: "fractalNoise",
1086
1153
  baseFrequency: "0.012 0.028",
1087
1154
  numOctaves: "3",
@@ -1089,7 +1156,7 @@ function Oe(e, t, n) {
1089
1156
  result: "stroke-noise"
1090
1157
  })
1091
1158
  ), o.appendChild(
1092
- L("feDisplacementMap", {
1159
+ E("feDisplacementMap", {
1093
1160
  in: "SourceGraphic",
1094
1161
  in2: "stroke-noise",
1095
1162
  scale: "3.5",
@@ -1098,7 +1165,7 @@ function Oe(e, t, n) {
1098
1165
  result: "warped"
1099
1166
  })
1100
1167
  ), o.appendChild(
1101
- L("feTurbulence", {
1168
+ E("feTurbulence", {
1102
1169
  type: "fractalNoise",
1103
1170
  baseFrequency: "0.7",
1104
1171
  numOctaves: "1",
@@ -1106,7 +1173,7 @@ function Oe(e, t, n) {
1106
1173
  result: "ink-noise"
1107
1174
  })
1108
1175
  ), o.appendChild(
1109
- L("feDisplacementMap", {
1176
+ E("feDisplacementMap", {
1110
1177
  in: "warped",
1111
1178
  in2: "ink-noise",
1112
1179
  scale: "0.9",
@@ -1115,30 +1182,30 @@ function Oe(e, t, n) {
1115
1182
  })
1116
1183
  ), o;
1117
1184
  }
1118
- function Ao(e) {
1185
+ function Po(e) {
1119
1186
  const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
1120
- return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
1187
+ return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
1121
1188
  }
1122
- function To() {
1189
+ function Ao() {
1123
1190
  const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1124
- return e.appendChild(L("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(L("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1191
+ 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;
1125
1192
  }
1126
- function jt() {
1193
+ function Vt() {
1127
1194
  const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1128
- return e.appendChild(L("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(L("polyline", { points: "5 12 12 5 19 12" })), e;
1195
+ 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;
1129
1196
  }
1130
- function No() {
1197
+ function To() {
1131
1198
  const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1132
1199
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1133
- L("path", {
1200
+ E("path", {
1134
1201
  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"
1135
1202
  })
1136
1203
  ), e;
1137
1204
  }
1138
- function Io() {
1205
+ function No() {
1139
1206
  const e = X("0 0 24 24", 19, 19, "none", "currentColor");
1140
1207
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1141
- L("path", {
1208
+ E("path", {
1142
1209
  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",
1143
1210
  stroke: "currentColor",
1144
1211
  "stroke-width": "2",
@@ -1147,17 +1214,17 @@ function Io() {
1147
1214
  })
1148
1215
  ), e;
1149
1216
  }
1150
- function Do() {
1217
+ function Io() {
1151
1218
  const e = X("0 0 24 24", 18, 18, "currentColor");
1152
- return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1219
+ return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1153
1220
  }
1154
- function Mo() {
1221
+ function Do() {
1155
1222
  const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1156
- return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
1223
+ return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
1157
1224
  }
1158
1225
  function Ro() {
1159
1226
  const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1160
- return e.appendChild(L("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(L("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1227
+ 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;
1161
1228
  }
1162
1229
  function X(e, t, n, o, a, i) {
1163
1230
  const l = {
@@ -1167,41 +1234,41 @@ function X(e, t, n, o, a, i) {
1167
1234
  fill: o,
1168
1235
  "aria-hidden": "true"
1169
1236
  };
1170
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
1237
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), E("svg", l);
1171
1238
  }
1172
- function L(e, t = {}) {
1173
- const n = document.createElementNS(eo, e);
1239
+ function E(e, t = {}) {
1240
+ const n = document.createElementNS(Qn, e);
1174
1241
  for (const [o, a] of Object.entries(t))
1175
1242
  n.setAttribute(o, a);
1176
1243
  return n;
1177
1244
  }
1178
- function _t(e) {
1245
+ function xt(e) {
1179
1246
  for (const t of ["keydown", "keypress", "keyup"])
1180
1247
  e.addEventListener(t, (n) => {
1181
1248
  n.stopPropagation();
1182
1249
  });
1183
1250
  }
1184
- function Oo(e, t, n) {
1251
+ function Mo(e, t, n) {
1185
1252
  e.replaceChildren(), e.hidden = t.length === 0;
1186
1253
  for (const [o, a] of t.entries()) {
1187
1254
  const i = document.createElement("div");
1188
- i.className = "pluno-pa-widget__attachment", i.appendChild(Bo(a));
1255
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Oo(a));
1189
1256
  const l = document.createElement("span");
1190
1257
  l.textContent = a.name, i.appendChild(l);
1191
- const p = document.createElement("button");
1192
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Mo()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1258
+ const s = document.createElement("button");
1259
+ s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Do()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1193
1260
  }
1194
1261
  }
1195
- function Bo(e) {
1196
- if (Vt(e)) {
1262
+ function Oo(e) {
1263
+ if (qt(e)) {
1197
1264
  const n = document.createElement("img");
1198
1265
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1199
1266
  }
1200
1267
  const t = document.createElement("span");
1201
1268
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1202
1269
  }
1203
- function Fo(e) {
1204
- if (Vt(e)) {
1270
+ function Bo(e) {
1271
+ if (qt(e)) {
1205
1272
  const a = document.createElement("img");
1206
1273
  return a.src = e.dataUrl, a.alt = e.name, a;
1207
1274
  }
@@ -1212,41 +1279,41 @@ function Fo(e) {
1212
1279
  const o = document.createElement("strong");
1213
1280
  return o.textContent = e.name, t.append(n, o), t;
1214
1281
  }
1215
- function Vt(e) {
1282
+ function qt(e) {
1216
1283
  return e.mimeType.startsWith("image/");
1217
1284
  }
1218
- function Uo(e) {
1285
+ function Fo(e) {
1219
1286
  return e === "application/pdf" ? "document.pdf" : "image";
1220
1287
  }
1221
- async function zo(e) {
1288
+ async function Uo(e) {
1222
1289
  if (!e)
1223
1290
  return [];
1224
1291
  const t = Array.from(e);
1225
- if (t.length > Ce)
1226
- throw new Error(`Attach up to ${Ce} files per message.`);
1292
+ if (t.length > Ee)
1293
+ throw new Error(`Attach up to ${Ee} files per message.`);
1227
1294
  return Promise.all(
1228
1295
  t.map(async (n) => {
1229
- const o = $o(n);
1296
+ const o = zo(n);
1230
1297
  if (!o)
1231
1298
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1232
- if (n.size > Hn)
1299
+ if (n.size > $n)
1233
1300
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1234
1301
  if (o === "image/gif") {
1235
- const a = new Uint8Array(await Xo(n));
1236
- if (Ho(a))
1302
+ const a = new Uint8Array(await Yo(n));
1303
+ if ($o(a))
1237
1304
  throw new Error("Pluno supports non-animated GIF images.");
1238
1305
  }
1239
1306
  return {
1240
- name: n.name || Uo(o),
1307
+ name: n.name || Fo(o),
1241
1308
  mimeType: o,
1242
1309
  sizeBytes: n.size,
1243
- dataUrl: Go(await Zo(n), o)
1310
+ dataUrl: Go(await Xo(n), o)
1244
1311
  };
1245
1312
  })
1246
1313
  );
1247
1314
  }
1248
- function $o(e) {
1249
- if (Ot.has(e.type))
1315
+ function zo(e) {
1316
+ if (Bt.has(e.type))
1250
1317
  return e.type;
1251
1318
  const t = e.name.toLowerCase();
1252
1319
  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;
@@ -1255,7 +1322,7 @@ function Go(e, t) {
1255
1322
  const n = `data:${t};base64,`;
1256
1323
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1257
1324
  }
1258
- function Ho(e) {
1325
+ function $o(e) {
1259
1326
  if (e.length < 14 || !Wo(e))
1260
1327
  return !1;
1261
1328
  const t = e[10];
@@ -1267,7 +1334,7 @@ function Ho(e) {
1267
1334
  if (n += 1, a === 59)
1268
1335
  return !1;
1269
1336
  if (a === 33) {
1270
- n += 1, n = xt(e, n);
1337
+ n += 1, n = vt(e, n);
1271
1338
  continue;
1272
1339
  }
1273
1340
  if (a !== 44)
@@ -1279,14 +1346,14 @@ function Ho(e) {
1279
1346
  const i = e[n + 8];
1280
1347
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1281
1348
  return !1;
1282
- n += 1, n = xt(e, n);
1349
+ n += 1, n = vt(e, n);
1283
1350
  }
1284
1351
  return !1;
1285
1352
  }
1286
1353
  function Wo(e) {
1287
1354
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1288
1355
  }
1289
- function xt(e, t) {
1356
+ function vt(e, t) {
1290
1357
  for (; t < e.length; ) {
1291
1358
  const n = e[t];
1292
1359
  if (t += 1, n === 0)
@@ -1295,63 +1362,63 @@ function xt(e, t) {
1295
1362
  }
1296
1363
  return t;
1297
1364
  }
1298
- function xe(e) {
1365
+ function ve(e) {
1299
1366
  return !!(e && Array.from(e.types).includes("Files"));
1300
1367
  }
1301
- function Be(e, t, n = null) {
1368
+ function Fe(e, t, n = null) {
1302
1369
  if (!e || !He(t, n)) {
1303
1370
  e && (e.hidden = !0, e.replaceChildren());
1304
1371
  return;
1305
1372
  }
1306
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Ve(n) ? e.appendChild(jo(t, n)) : qt(t) && e.appendChild(Vo(t));
1373
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || qe(n) ? e.appendChild(Ho(t, n)) : Kt(t) && e.appendChild(jo(t));
1307
1374
  }
1308
- function jo(e, t) {
1375
+ function Ho(e, t) {
1309
1376
  const n = document.createElement("div");
1310
1377
  n.className = "pluno-pa-widget__billing-action-card";
1311
1378
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1312
1379
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1313
1380
  const i = document.createElement("span");
1314
- return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1381
+ return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Yt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1315
1382
  }
1316
- function Vo(e) {
1383
+ function jo(e) {
1317
1384
  const t = document.createElement("div");
1318
1385
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1319
1386
  const n = document.createElement("strong");
1320
1387
  n.textContent = "Credits running low", t.appendChild(n);
1321
1388
  const o = document.createElement("span");
1322
- return o.textContent = Ko(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1389
+ return o.textContent = qo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Yt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1323
1390
  }
1324
1391
  function He(e, t) {
1325
- return e !== null && ($(e) || qt(e) || Ve(t));
1392
+ return e !== null && (G(e) || Kt(e) || qe(t));
1326
1393
  }
1327
- function vt(e, t, n) {
1328
- return He(t, n) || qo(t) ? !0 : !He(e, n);
1394
+ function yt(e, t, n) {
1395
+ return He(t, n) || Vo(t) ? !0 : !He(e, n);
1329
1396
  }
1330
- function qo(e) {
1331
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
1397
+ function Vo(e) {
1398
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
1332
1399
  }
1333
- function $(e) {
1400
+ function G(e) {
1334
1401
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1335
1402
  }
1336
- function Ve(e) {
1403
+ function qe(e) {
1337
1404
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1338
1405
  }
1339
- function qt(e) {
1340
- return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1406
+ function Kt(e) {
1407
+ return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1341
1408
  }
1342
- function Ko(e) {
1343
- return e.creditsRemaining === null ? null : `${Yo(e.creditsRemaining)} credits left`;
1409
+ function qo(e) {
1410
+ return e.creditsRemaining === null ? null : `${Ko(e.creditsRemaining)} credits left`;
1344
1411
  }
1345
- function Yo(e) {
1412
+ function Ko(e) {
1346
1413
  return new Intl.NumberFormat("en-US", {
1347
1414
  maximumFractionDigits: 0
1348
1415
  }).format(Math.ceil(e));
1349
1416
  }
1350
- function Kt(e, t, n) {
1417
+ function Yt(e, t, n) {
1351
1418
  const o = document.createElement("div");
1352
- return o.className = n, o.appendChild(yt(t, e.pricingUrl)), o.appendChild(yt("Earn credits", e.earnCreditsUrl)), o;
1419
+ return o.className = n, o.appendChild(Ct(t, e.pricingUrl)), o.appendChild(Ct("Earn credits", e.earnCreditsUrl)), o;
1353
1420
  }
1354
- function yt(e, t) {
1421
+ function Ct(e, t) {
1355
1422
  const n = document.createElement("button");
1356
1423
  if (n.type = "button", e === "Earn credits") {
1357
1424
  const o = document.createElement("span");
@@ -1362,7 +1429,7 @@ function yt(e, t) {
1362
1429
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1363
1430
  }), n;
1364
1431
  }
1365
- function Xo(e) {
1432
+ function Yo(e) {
1366
1433
  return new Promise((t, n) => {
1367
1434
  const o = new FileReader();
1368
1435
  o.addEventListener("load", () => {
@@ -1376,7 +1443,7 @@ function Xo(e) {
1376
1443
  }), o.readAsArrayBuffer(e);
1377
1444
  });
1378
1445
  }
1379
- function Zo(e) {
1446
+ function Xo(e) {
1380
1447
  return new Promise((t, n) => {
1381
1448
  const o = new FileReader();
1382
1449
  o.addEventListener("load", () => {
@@ -1390,122 +1457,122 @@ function Zo(e) {
1390
1457
  }), o.readAsDataURL(e);
1391
1458
  });
1392
1459
  }
1393
- function Ct(e, t) {
1394
- return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1460
+ function Et(e, t) {
1461
+ return e.messages.filter((o) => !Xt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1395
1462
  }
1396
- function Jo(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
1397
- const R = [...i.messages], v = R.filter((b) => !Yt(b)), y = e.scrollTop;
1398
- e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Lo(a, l);
1463
+ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1464
+ const M = [...i.messages], v = M.filter((f) => !Xt(f)), y = e.scrollTop;
1465
+ e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && ko(a, l);
1399
1466
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1400
1467
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1401
- const b = document.createElement("div");
1402
- b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1468
+ const f = document.createElement("div");
1469
+ f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1403
1470
  const m = document.createElement("div");
1404
1471
  m.className = "pluno-pa-widget__empty-hero";
1405
- const k = document.createElement("img");
1406
- k.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", k.src = C(), k.alt = "", k.setAttribute("aria-hidden", "true"), m.appendChild(k), b.appendChild(m), b.appendChild(Gt());
1407
- const P = document.createElement("div");
1408
- if (P.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 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1472
+ const T = ae("pluno-pa-widget__character--empty", x());
1473
+ m.appendChild(T), f.appendChild(m), f.appendChild(Wt());
1474
+ const k = document.createElement("div");
1475
+ if (k.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1409
1476
  for (const I of i.starterPrompts) {
1410
- const A = document.createElement("button");
1411
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
1412
- S(I);
1413
- }), P.appendChild(A);
1477
+ const P = document.createElement("button");
1478
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
1479
+ L(I);
1480
+ }), k.appendChild(P);
1414
1481
  }
1415
1482
  else
1416
- for (let I = 0; I < jn; I += 1) {
1417
- const A = document.createElement("button");
1418
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = "&nbsp;", P.appendChild(A);
1483
+ for (let I = 0; I < Hn; I += 1) {
1484
+ const P = document.createElement("button");
1485
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = "&nbsp;", k.appendChild(P);
1419
1486
  }
1420
- b.appendChild(P), e.appendChild(b), e.appendChild(t);
1487
+ f.appendChild(k), e.appendChild(f), e.appendChild(t);
1421
1488
  return;
1422
1489
  }
1423
1490
  let g = null, _ = null, N = [];
1424
1491
  const Z = () => {
1425
1492
  if (N.length === 0)
1426
1493
  return !1;
1427
- const b = la(N, s, f, C());
1428
- return e.appendChild(b), g = null, _ = b, N = [], !0;
1494
+ const f = ra(N, p, w, x());
1495
+ return e.appendChild(f), g = null, _ = f, N = [], !0;
1429
1496
  };
1430
- for (let b = 0; b < v.length; b += 1) {
1431
- const m = v[b];
1497
+ for (let f = 0; f < v.length; f += 1) {
1498
+ const m = v[f];
1432
1499
  if (m.role === "tool") {
1433
1500
  N.push(m);
1434
1501
  continue;
1435
1502
  }
1436
1503
  if (m.role === "system")
1437
1504
  continue;
1438
- const k = Z(), P = kt(m.content);
1439
- if (m.role === "assistant" && !k) {
1440
- const w = We(C());
1441
- e.appendChild(w), g = null, _ = w;
1505
+ const T = Z(), k = kt(m.content);
1506
+ if (m.role === "assistant" && !T) {
1507
+ const b = je(x());
1508
+ e.appendChild(b), g = null, _ = b;
1442
1509
  }
1443
1510
  const I = document.createElement("div");
1444
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? St(I, P) : I.textContent = P, m.role === "user" && m.attachments?.length && I.appendChild(ea(m.attachments));
1445
- const A = document.createElement("div");
1446
- A.className = "pluno-pa-widget__message-actions", A.appendChild(Et(P)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
1511
+ I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, k) : I.textContent = k, m.role === "user" && m.attachments?.length && I.appendChild(Qo(m.attachments));
1512
+ const P = document.createElement("div");
1513
+ P.className = "pluno-pa-widget__message-actions", P.appendChild(St(k)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
1447
1514
  }
1448
- const de = Z();
1515
+ const ce = Z();
1449
1516
  if (i.assistantDraft) {
1450
- if (!de) {
1451
- const P = We(C());
1452
- e.appendChild(P), g = null, _ = P;
1453
- }
1454
- const b = kt(i.assistantDraft), m = document.createElement("div");
1455
- m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", St(m, b);
1456
- const k = document.createElement("div");
1457
- k.className = "pluno-pa-widget__message-actions", k.appendChild(Et(b)), m.appendChild(k), e.appendChild(m), g = m, _ = null;
1517
+ if (!ce) {
1518
+ const k = je(x());
1519
+ e.appendChild(k), g = null, _ = k;
1520
+ }
1521
+ const f = kt(i.assistantDraft), m = document.createElement("div");
1522
+ m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Lt(m, f);
1523
+ const T = document.createElement("div");
1524
+ T.className = "pluno-pa-widget__message-actions", T.appendChild(St(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
1458
1525
  }
1459
1526
  if (i.isThinking && !i.assistantDraft)
1460
- if (de) {
1461
- const b = Xt();
1462
- e.appendChild(b), g = null, _ = b;
1527
+ if (ce) {
1528
+ const f = Zt();
1529
+ e.appendChild(f), g = null, _ = f;
1463
1530
  } else {
1464
- const b = pa(C());
1465
- e.appendChild(b), g = null, _ = b;
1531
+ const f = la(x());
1532
+ e.appendChild(f), g = null, _ = f;
1466
1533
  }
1467
1534
  if (i.lastError) {
1468
- const b = document.createElement("div");
1469
- b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
1535
+ const f = document.createElement("div");
1536
+ f.className = "pluno-pa-widget__error", f.textContent = i.lastError, e.appendChild(f), g = f, _ = null;
1470
1537
  }
1471
- const E = x && !i.isThinking ? xn(R) : null;
1472
- if (x && E && !x.dismissedCandidateIds.has(E.id)) {
1473
- const b = ta(E, {
1474
- isDrafting: x.draftingCandidateId === E.id,
1475
- error: x.error,
1476
- onDraft: x.onDraft,
1477
- onDismiss: x.onDismiss,
1478
- onDisable: x.onDisable
1538
+ const S = C && !i.isThinking ? _n(M) : null;
1539
+ if (C && S && !C.dismissedCandidateIds.has(S.id)) {
1540
+ const f = ea(S, {
1541
+ isDrafting: C.draftingCandidateId === S.id,
1542
+ error: C.error,
1543
+ onDraft: C.onDraft,
1544
+ onDismiss: C.onDismiss,
1545
+ onDisable: C.onDisable
1479
1546
  });
1480
- e.appendChild(b), x.onSeen(E), g = null, _ = b;
1547
+ e.appendChild(f), C.onSeen(S), g = null, _ = f;
1481
1548
  }
1482
- g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? he(e, d) : e.scrollTop = y;
1549
+ 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;
1483
1550
  }
1484
- function Qo(e, t, n, o, a, i) {
1485
- e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
1551
+ function Jo(e, t, n, o, a, i) {
1552
+ e.replaceChildren(), Jt(t, !1), t.disabled = !0, n.hidden = !0;
1486
1553
  const l = document.createElement("div");
1487
1554
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1488
- const p = document.createElement("img");
1489
- p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = o(), p.alt = "", p.setAttribute("aria-hidden", "true"), l.appendChild(p);
1490
- const c = document.createElement("div");
1491
- c.className = "pluno-pa-widget__empty", c.textContent = "Log in to use Pluno on this page.", l.appendChild(c);
1555
+ const s = ae("pluno-pa-widget__character--empty", o());
1556
+ l.appendChild(s);
1557
+ const u = document.createElement("div");
1558
+ u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1492
1559
  const d = document.createElement("button");
1493
1560
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1494
1561
  }
1495
- function ea(e) {
1562
+ function Qo(e) {
1496
1563
  const t = document.createElement("div");
1497
1564
  t.className = "pluno-pa-widget__message-attachments";
1498
1565
  for (const n of e)
1499
- t.appendChild(Fo(n));
1566
+ t.appendChild(Bo(n));
1500
1567
  return t;
1501
1568
  }
1502
- function Et(e) {
1569
+ function St(e) {
1503
1570
  const t = document.createElement("button");
1504
1571
  return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
1505
1572
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1506
1573
  }), t;
1507
1574
  }
1508
- function ta(e, t) {
1575
+ function ea(e, t) {
1509
1576
  const n = document.createElement("article");
1510
1577
  n.className = "pluno-pa-widget__share-prompt";
1511
1578
  const o = document.createElement("div");
@@ -1516,32 +1583,32 @@ function ta(e, t) {
1516
1583
  i.textContent = "Share this win?", a.appendChild(i);
1517
1584
  const l = document.createElement("span");
1518
1585
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
1519
- const s = document.createElement("span");
1520
- s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
1586
+ const p = document.createElement("span");
1587
+ p.className = "pluno-pa-widget__share-prompt-error", p.textContent = t.error, a.appendChild(p);
1521
1588
  }
1522
1589
  o.appendChild(a);
1523
- const p = document.createElement("div");
1524
- p.className = "pluno-pa-widget__share-prompt-actions";
1525
- const c = document.createElement("div");
1526
- c.className = "pluno-pa-widget__share-prompt-primary-actions";
1590
+ const s = document.createElement("div");
1591
+ s.className = "pluno-pa-widget__share-prompt-actions";
1592
+ const u = document.createElement("div");
1593
+ u.className = "pluno-pa-widget__share-prompt-primary-actions";
1527
1594
  const d = document.createElement("button");
1528
1595
  if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1529
1596
  t.onDraft(e);
1530
- }), t.isDrafting ? (d.appendChild(je()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1531
- p.appendChild(c);
1597
+ }), t.isDrafting ? (d.appendChild(Ve()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
1598
+ s.appendChild(u);
1532
1599
  else {
1533
- const s = document.createElement("button");
1534
- s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
1600
+ const p = document.createElement("button");
1601
+ 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", () => {
1535
1602
  t.onDismiss(e);
1536
- }), c.appendChild(s), p.appendChild(c);
1537
- const f = document.createElement("button");
1538
- f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
1603
+ }), u.appendChild(p), s.appendChild(u);
1604
+ const w = document.createElement("button");
1605
+ w.type = "button", w.className = "pluno-pa-widget__share-prompt-disable", w.textContent = "Don't ask again", w.addEventListener("click", () => {
1539
1606
  t.onDisable(e);
1540
- }), p.appendChild(f);
1607
+ }), s.appendChild(w);
1541
1608
  }
1542
- return o.appendChild(p), n.appendChild(o), n;
1609
+ return o.appendChild(s), n.appendChild(o), n;
1543
1610
  }
1544
- function na(e, t) {
1611
+ function ta(e, t) {
1545
1612
  const n = document.createElement("div");
1546
1613
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1547
1614
  v.target === n && t.onClose();
@@ -1552,57 +1619,57 @@ function na(e, t) {
1552
1619
  i.textContent = "Share this win", a.appendChild(i);
1553
1620
  const l = document.createElement("button");
1554
1621
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
1555
- const p = document.createElement("p");
1556
- p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
1557
- const c = document.createElement("div");
1558
- c.className = "pluno-pa-widget__share-dialog-step";
1622
+ const s = document.createElement("p");
1623
+ s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
1624
+ const u = document.createElement("div");
1625
+ u.className = "pluno-pa-widget__share-dialog-step";
1559
1626
  const d = document.createElement("div");
1560
1627
  d.className = "pluno-pa-widget__share-dialog-step-header";
1561
- const s = document.createElement("strong");
1562
- s.textContent = "1) Copy Screenshot", d.appendChild(s);
1563
- const f = oa("Copy Screenshot", async () => {
1628
+ const p = document.createElement("strong");
1629
+ p.textContent = "1) Copy Screenshot", d.appendChild(p);
1630
+ const w = na("Copy Screenshot", async () => {
1564
1631
  try {
1565
- return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1632
+ return await xn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1566
1633
  } catch {
1567
- return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1634
+ return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1568
1635
  }
1569
1636
  });
1570
- if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
1637
+ if (d.appendChild(w), u.appendChild(d), e.screenshotDataUrl) {
1571
1638
  const v = document.createElement("div");
1572
1639
  v.className = "pluno-pa-widget__share-dialog-screenshot";
1573
1640
  const y = document.createElement("img");
1574
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
1641
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), u.appendChild(v);
1575
1642
  }
1576
- o.appendChild(c), o.appendChild(p);
1577
- const C = document.createElement("div");
1578
- C.className = "pluno-pa-widget__share-dialog-step";
1579
- const S = document.createElement("strong");
1580
- S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", C.appendChild(S);
1581
- const x = document.createElement("p");
1582
- x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
1583
- const R = document.createElement("footer");
1584
- R.className = "pluno-pa-widget__share-dialog-platforms";
1585
- for (const v of aa(e)) {
1643
+ o.appendChild(u), o.appendChild(s);
1644
+ const x = document.createElement("div");
1645
+ x.className = "pluno-pa-widget__share-dialog-step";
1646
+ const L = document.createElement("strong");
1647
+ L.className = "pluno-pa-widget__share-dialog-step-title", L.textContent = "2) Share on", x.appendChild(L);
1648
+ const C = document.createElement("p");
1649
+ C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
1650
+ const M = document.createElement("footer");
1651
+ M.className = "pluno-pa-widget__share-dialog-platforms";
1652
+ for (const v of oa(e)) {
1586
1653
  const y = document.createElement("a");
1587
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ia(v.id)), R.appendChild(y);
1654
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(aa(v.id)), M.appendChild(y);
1588
1655
  }
1589
- if (C.appendChild(R), o.appendChild(C), t.socialPostRewardsUrl) {
1656
+ if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
1590
1657
  const v = document.createElement("div");
1591
1658
  v.className = "pluno-pa-widget__share-dialog-step";
1592
1659
  const y = document.createElement("strong");
1593
1660
  y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1594
1661
  const h = document.createElement("a");
1595
- 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(ra()), v.appendChild(h), o.appendChild(v);
1662
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(ia()), v.appendChild(h), o.appendChild(v);
1596
1663
  }
1597
1664
  return n.appendChild(o), n;
1598
1665
  }
1599
- function oa(e, t) {
1666
+ function na(e, t) {
1600
1667
  const n = document.createElement("button");
1601
1668
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1602
1669
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1603
1670
  }), n;
1604
1671
  }
1605
- function aa(e) {
1672
+ function oa(e) {
1606
1673
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1607
1674
  return [
1608
1675
  {
@@ -1622,7 +1689,7 @@ function aa(e) {
1622
1689
  }
1623
1690
  ];
1624
1691
  }
1625
- function ia(e) {
1692
+ function aa(e) {
1626
1693
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1627
1694
  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);
1628
1695
  }
@@ -1630,52 +1697,48 @@ function D(e, t, n) {
1630
1697
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1631
1698
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1632
1699
  }
1633
- function ra() {
1700
+ function ia() {
1634
1701
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1635
1702
  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;
1636
1703
  }
1637
- function Yt(e) {
1638
- return e.role === "tool" && e.toolName === Dt;
1704
+ function Xt(e) {
1705
+ return e.role === "tool" && e.toolName === Rt;
1639
1706
  }
1640
1707
  function kt(e) {
1641
1708
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1642
1709
  }
1643
- function la(e, t, n, o) {
1710
+ function ra(e, t, n, o) {
1644
1711
  const a = document.createElement("article");
1645
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
1646
- const i = document.createElement("img");
1647
- i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1648
- const l = document.createElement("details"), p = sa(e);
1649
- l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
1650
- a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
1712
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ae("pluno-pa-widget__character--tool-group", o));
1713
+ const i = document.createElement("details"), l = pa(e);
1714
+ i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1715
+ a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1651
1716
  });
1652
- const c = document.createElement("summary");
1653
- c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(je());
1654
- const s = document.createElement("span");
1655
- if (s.className = "pluno-pa-widget__tool-summary-title", s.textContent = e[e.length - 1].content || "Run tool", c.appendChild(s), l.appendChild(c), e.length > 0) {
1656
- const f = document.createElement("div");
1657
- f.className = "pluno-pa-widget__tool-lines";
1658
- for (const C of e) {
1659
- const S = document.createElement("div");
1660
- S.className = "pluno-pa-widget__tool-line", C.loading && S.appendChild(je());
1661
- const x = document.createElement("span");
1662
- x.textContent = C.content || "Run tool", S.appendChild(x), f.appendChild(S);
1663
- }
1664
- l.appendChild(f);
1717
+ const s = document.createElement("summary");
1718
+ s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ve());
1719
+ const d = document.createElement("span");
1720
+ if (d.className = "pluno-pa-widget__tool-summary-title", d.textContent = e[e.length - 1].content || "Run tool", s.appendChild(d), i.appendChild(s), e.length > 0) {
1721
+ const p = document.createElement("div");
1722
+ p.className = "pluno-pa-widget__tool-lines";
1723
+ for (const w of e) {
1724
+ const x = document.createElement("div");
1725
+ x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ve());
1726
+ const L = document.createElement("span");
1727
+ L.textContent = w.content || "Run tool", x.appendChild(L), p.appendChild(x);
1728
+ }
1729
+ i.appendChild(p);
1665
1730
  }
1666
- return a.appendChild(l), a;
1731
+ return a.appendChild(i), a;
1667
1732
  }
1668
- function We(e) {
1733
+ function je(e) {
1669
1734
  const t = document.createElement("article");
1670
- t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1671
- const n = document.createElement("img");
1672
- return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), t.appendChild(n), t;
1735
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ae("pluno-pa-widget__character--tool-group", e)), t;
1673
1736
  }
1674
- function pa(e) {
1675
- const t = We(e);
1676
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
1737
+ function la(e) {
1738
+ const t = je(e);
1739
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Zt()), t;
1677
1740
  }
1678
- function Xt() {
1741
+ function Zt() {
1679
1742
  const e = document.createElement("div");
1680
1743
  e.className = "pluno-pa-widget__status";
1681
1744
  const t = document.createElement("span");
@@ -1683,17 +1746,17 @@ function Xt() {
1683
1746
  const n = document.createElement("span");
1684
1747
  return n.textContent = "Thinking...", e.appendChild(n), e;
1685
1748
  }
1686
- function sa(e) {
1749
+ function pa(e) {
1687
1750
  return `tools:${e[0]?.id ?? ""}`;
1688
1751
  }
1689
- function je() {
1752
+ function Ve() {
1690
1753
  const e = document.createElement("span");
1691
1754
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1692
1755
  }
1693
- function Zt(e, t) {
1694
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Do() : jt());
1756
+ function Jt(e, t) {
1757
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Io() : Vt());
1695
1758
  }
1696
- function St(e, t) {
1759
+ function Lt(e, t) {
1697
1760
  const n = t.replace(/\r\n/g, `
1698
1761
  `).split(`
1699
1762
  `);
@@ -1709,22 +1772,22 @@ function St(e, t) {
1709
1772
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1710
1773
  d.push(n[o]), o += 1;
1711
1774
  o += o < n.length ? 1 : 0;
1712
- const s = document.createElement("pre"), f = document.createElement("code");
1713
- f.textContent = d.join(`
1714
- `), s.appendChild(f), e.appendChild(s);
1775
+ const p = document.createElement("pre"), w = document.createElement("code");
1776
+ w.textContent = d.join(`
1777
+ `), p.appendChild(w), e.appendChild(p);
1715
1778
  continue;
1716
1779
  }
1717
1780
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1718
1781
  if (l) {
1719
1782
  const d = document.createElement(`h${l[1].length + 2}`);
1720
- ve(d, l[2]), e.appendChild(d), o += 1;
1783
+ ye(d, l[2]), e.appendChild(d), o += 1;
1721
1784
  continue;
1722
1785
  }
1723
1786
  if (/^\s*[-*+]\s+/.test(a)) {
1724
1787
  const d = document.createElement("ul");
1725
1788
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1726
- const s = document.createElement("li");
1727
- ve(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1789
+ const p = document.createElement("li");
1790
+ ye(p, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(p), o += 1;
1728
1791
  }
1729
1792
  e.appendChild(d);
1730
1793
  continue;
@@ -1732,22 +1795,22 @@ function St(e, t) {
1732
1795
  if (/^\s*\d+\.\s+/.test(a)) {
1733
1796
  const d = document.createElement("ol");
1734
1797
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1735
- const s = document.createElement("li");
1736
- ve(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1798
+ const p = document.createElement("li");
1799
+ ye(p, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(p), o += 1;
1737
1800
  }
1738
1801
  e.appendChild(d);
1739
1802
  continue;
1740
1803
  }
1741
- const p = [a];
1804
+ const s = [a];
1742
1805
  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]); )
1743
- p.push(n[o]), o += 1;
1744
- const c = document.createElement("p");
1745
- p.forEach((d, s) => {
1746
- s > 0 && c.appendChild(document.createElement("br")), ve(c, d);
1747
- }), e.appendChild(c);
1806
+ s.push(n[o]), o += 1;
1807
+ const u = document.createElement("p");
1808
+ s.forEach((d, p) => {
1809
+ p > 0 && u.appendChild(document.createElement("br")), ye(u, d);
1810
+ }), e.appendChild(u);
1748
1811
  }
1749
1812
  }
1750
- function ve(e, t) {
1813
+ function ye(e, t) {
1751
1814
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1752
1815
  let o = 0;
1753
1816
  for (const a of t.matchAll(n)) {
@@ -1755,19 +1818,19 @@ function ve(e, t) {
1755
1818
  i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
1756
1819
  const l = a[0];
1757
1820
  if (l.startsWith("`")) {
1758
- const p = document.createElement("code");
1759
- p.textContent = l.slice(1, -1), e.appendChild(p);
1821
+ const s = document.createElement("code");
1822
+ s.textContent = l.slice(1, -1), e.appendChild(s);
1760
1823
  } else if (l.startsWith("**")) {
1761
- const p = document.createElement("strong");
1762
- p.textContent = l.slice(2, -2), e.appendChild(p);
1824
+ const s = document.createElement("strong");
1825
+ s.textContent = l.slice(2, -2), e.appendChild(s);
1763
1826
  } else if (l.startsWith("*")) {
1764
- const p = document.createElement("em");
1765
- p.textContent = l.slice(1, -1), e.appendChild(p);
1827
+ const s = document.createElement("em");
1828
+ s.textContent = l.slice(1, -1), e.appendChild(s);
1766
1829
  } else {
1767
- const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1768
- if (p && da(p[2])) {
1769
- const c = document.createElement("a");
1770
- c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
1830
+ const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1831
+ if (s && sa(s[2])) {
1832
+ const u = document.createElement("a");
1833
+ u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
1771
1834
  } else
1772
1835
  e.appendChild(document.createTextNode(l));
1773
1836
  }
@@ -1775,7 +1838,7 @@ function ve(e, t) {
1775
1838
  }
1776
1839
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1777
1840
  }
1778
- function da(e) {
1841
+ function sa(e) {
1779
1842
  if (e.startsWith("/") || e.startsWith("#"))
1780
1843
  return !0;
1781
1844
  try {
@@ -1785,8 +1848,8 @@ function da(e) {
1785
1848
  return !1;
1786
1849
  }
1787
1850
  }
1788
- function Lt(e, t) {
1789
- if (ca(e))
1851
+ function Pt(e, t) {
1852
+ if (da(e))
1790
1853
  return;
1791
1854
  const n = `
1792
1855
  :host {
@@ -1957,6 +2020,9 @@ function Lt(e, t) {
1957
2020
  transform: translateY(-50%);
1958
2021
  pointer-events: none;
1959
2022
  }
2023
+ .pluno-pa-widget__scribble-spirals {
2024
+ display: none;
2025
+ }
1960
2026
  .pluno-pa-widget__launcher-input {
1961
2027
  width: 100%;
1962
2028
  height: 22px;
@@ -3303,18 +3369,22 @@ function Lt(e, t) {
3303
3369
  pointer-events: none;
3304
3370
  }
3305
3371
  .pluno-pa-widget--scribble .pluno-pa-widget__panel::after {
3306
- content: "";
3372
+ content: none;
3373
+ }
3374
+ .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals {
3375
+ display: block;
3376
+ position: absolute;
3377
+ pointer-events: none;
3378
+ color: #2c2a1e;
3379
+ }
3380
+ .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
3307
3381
  position: absolute;
3308
3382
  top: -16px;
3309
3383
  left: 16px;
3310
3384
  right: 16px;
3311
3385
  height: 36px;
3312
3386
  z-index: 3;
3313
- background-image: url('${ut}');
3314
- background-repeat: repeat-x;
3315
- background-size: 104px 36px;
3316
3387
  filter: url(#pluno-pa-scribble-wobble-2);
3317
- pointer-events: none;
3318
3388
  }
3319
3389
  .pluno-pa-widget--scribble .pluno-pa-widget__timeline {
3320
3390
  padding-top: 34px;
@@ -3572,18 +3642,16 @@ function Lt(e, t) {
3572
3642
  background-size: 22px 22px;
3573
3643
  }
3574
3644
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher::after {
3575
- content: "";
3645
+ content: none;
3646
+ }
3647
+ .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--launcher {
3576
3648
  position: absolute;
3577
3649
  top: -11px;
3578
3650
  left: 12px;
3579
3651
  right: 12px;
3580
3652
  height: 22px;
3581
3653
  z-index: 1;
3582
- background-image: url('${ut}');
3583
- background-repeat: repeat-x;
3584
- background-size: 62px 21.5px;
3585
3654
  filter: url(#pluno-pa-scribble-wobble-2);
3586
- pointer-events: none;
3587
3655
  }
3588
3656
  .pluno-pa-widget--scribble .pluno-pa-widget__send svg,
3589
3657
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
@@ -3592,28 +3660,28 @@ function Lt(e, t) {
3592
3660
  filter: url(#pluno-pa-scribble-wobble-2);
3593
3661
  }
3594
3662
  `;
3595
- if (ua(e, n))
3663
+ if (ca(e, n))
3596
3664
  return;
3597
3665
  const o = e.ownerDocument.createElement("style");
3598
- o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
3666
+ o.id = zt, o.textContent = n, e.appendChild(o), Qt(e);
3599
3667
  }
3600
- function ca(e) {
3601
- return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
3668
+ function da(e) {
3669
+ return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gt) === "true";
3602
3670
  }
3603
- function Jt(e) {
3604
- e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
3671
+ function Qt(e) {
3672
+ e.host instanceof HTMLElement && e.host.setAttribute(Gt, "true");
3605
3673
  }
3606
- function ua(e, t) {
3674
+ function ca(e, t) {
3607
3675
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3608
3676
  return !1;
3609
3677
  try {
3610
3678
  const n = new CSSStyleSheet();
3611
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jt(e), !0;
3679
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Qt(e), !0;
3612
3680
  } catch {
3613
3681
  return !1;
3614
3682
  }
3615
3683
  }
3616
- async function ga() {
3684
+ async function ua() {
3617
3685
  return document.body ? document.body : await new Promise((e) => {
3618
3686
  const t = new MutationObserver(() => {
3619
3687
  document.body && (t.disconnect(), e(document.body));
@@ -3621,49 +3689,49 @@ async function ga() {
3621
3689
  t.observe(document.documentElement, { childList: !0 });
3622
3690
  });
3623
3691
  }
3624
- function Qt(e) {
3692
+ function en(e) {
3625
3693
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3626
3694
  }
3627
- function ha(e) {
3695
+ function ga(e) {
3628
3696
  try {
3629
- const t = window.localStorage.getItem(Qt(e));
3697
+ const t = window.localStorage.getItem(en(e));
3630
3698
  if (!t)
3631
- return Pt();
3699
+ return At();
3632
3700
  const n = JSON.parse(t);
3633
3701
  return {
3634
3702
  isOpen: n.isOpen === !0,
3635
3703
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3636
3704
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3637
- launcherPosition: wa(n.launcherPosition) ? n.launcherPosition : null,
3705
+ launcherPosition: ba(n.launcherPosition) ? n.launcherPosition : null,
3638
3706
  seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3639
3707
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3640
3708
  };
3641
3709
  } catch {
3642
- return Pt();
3710
+ return At();
3643
3711
  }
3644
3712
  }
3645
- async function ma(e) {
3713
+ async function ha(e) {
3646
3714
  if (e.loadSharePromptsDisabled)
3647
3715
  return e.loadSharePromptsDisabled();
3648
3716
  try {
3649
- return window.localStorage.getItem(Rt) === "true";
3717
+ return window.localStorage.getItem(Ot) === "true";
3650
3718
  } catch {
3651
3719
  return !1;
3652
3720
  }
3653
3721
  }
3654
- function fa(e, t) {
3722
+ function ma(e, t) {
3655
3723
  if (e.persistSharePromptsDisabled) {
3656
3724
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3657
3725
  });
3658
3726
  return;
3659
3727
  }
3660
3728
  try {
3661
- t && window.localStorage.setItem(Rt, "true");
3729
+ t && window.localStorage.setItem(Ot, "true");
3662
3730
  } catch {
3663
3731
  return;
3664
3732
  }
3665
3733
  }
3666
- function Pt() {
3734
+ function At() {
3667
3735
  return {
3668
3736
  isOpen: !1,
3669
3737
  composerValue: "",
@@ -3673,41 +3741,41 @@ function Pt() {
3673
3741
  sharePromptsDisabled: !1
3674
3742
  };
3675
3743
  }
3676
- function ba(e, t) {
3744
+ function fa(e, t) {
3677
3745
  try {
3678
- window.localStorage.setItem(Qt(e), JSON.stringify(t));
3746
+ window.localStorage.setItem(en(e), JSON.stringify(t));
3679
3747
  } catch {
3680
3748
  return;
3681
3749
  }
3682
3750
  }
3683
- function wa(e) {
3751
+ function ba(e) {
3684
3752
  if (!e || typeof e != "object")
3685
3753
  return !1;
3686
3754
  const t = e;
3687
3755
  return Number.isFinite(t.x) && Number.isFinite(t.y);
3688
3756
  }
3689
- const At = /* @__PURE__ */ new WeakSet();
3690
- function _a(e) {
3757
+ const Tt = /* @__PURE__ */ new WeakSet();
3758
+ function wa(e) {
3691
3759
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3692
3760
  }
3693
- function Tt(e) {
3761
+ function Nt(e) {
3694
3762
  const t = e.pathname.split("/");
3695
3763
  return t[t.length - 1] ?? "";
3696
3764
  }
3697
- function xa(e, t) {
3765
+ function _a(e, t) {
3698
3766
  const n = new URL(e.src, document.baseURI);
3699
- return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
3767
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Nt(n) === Nt(t);
3700
3768
  }
3701
3769
  class V extends EventTarget {
3702
3770
  constructor(t, n) {
3703
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
3771
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Bn, () => {
3704
3772
  this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3705
- }), this.addPreviewListener(Un, (o) => {
3773
+ }), this.addPreviewListener(Fn, (o) => {
3706
3774
  const a = o;
3707
3775
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3708
- }), this.addPreviewListener(zn, () => {
3776
+ }), this.addPreviewListener(Un, () => {
3709
3777
  this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3710
- }), this.addPreviewListener($n, (o) => {
3778
+ }), this.addPreviewListener(zn, (o) => {
3711
3779
  const a = o;
3712
3780
  this.readyState = V.CLOSED, this.dispatchEvent(
3713
3781
  new CloseEvent("close", {
@@ -3717,7 +3785,7 @@ class V extends EventTarget {
3717
3785
  })
3718
3786
  ), this.cleanup();
3719
3787
  }), window.dispatchEvent(
3720
- new CustomEvent(ye(Rn, this.channelId), {
3788
+ new CustomEvent(Ce(Rn, this.channelId), {
3721
3789
  detail: { socketId: this.socketId, url: t }
3722
3790
  })
3723
3791
  );
@@ -3733,26 +3801,26 @@ class V extends EventTarget {
3733
3801
  binaryType = "blob";
3734
3802
  bufferedAmount = 0;
3735
3803
  readyState = V.CONNECTING;
3736
- socketId = va();
3804
+ socketId = xa();
3737
3805
  listeners = /* @__PURE__ */ new Map();
3738
3806
  send(t) {
3739
3807
  if (this.readyState !== V.OPEN)
3740
3808
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3741
3809
  window.dispatchEvent(
3742
- new CustomEvent(ye(On, this.channelId), {
3810
+ new CustomEvent(Ce(Mn, this.channelId), {
3743
3811
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3744
3812
  })
3745
3813
  );
3746
3814
  }
3747
3815
  close(t, n) {
3748
3816
  this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3749
- new CustomEvent(ye(Bn, this.channelId), {
3817
+ new CustomEvent(Ce(On, this.channelId), {
3750
3818
  detail: { socketId: this.socketId, code: t, reason: n }
3751
3819
  })
3752
3820
  ), this.cleanup());
3753
3821
  }
3754
3822
  addPreviewListener(t, n) {
3755
- const o = ye(t, this.channelId), a = (i) => {
3823
+ const o = Ce(t, this.channelId), a = (i) => {
3756
3824
  i.detail?.socketId === this.socketId && n(i);
3757
3825
  };
3758
3826
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3763,36 +3831,36 @@ class V extends EventTarget {
3763
3831
  this.listeners.clear();
3764
3832
  }
3765
3833
  }
3766
- function va() {
3767
- const e = window.sessionStorage.getItem(ct);
3834
+ function xa() {
3835
+ const e = window.sessionStorage.getItem(ut);
3768
3836
  if (e)
3769
3837
  return e;
3770
3838
  const t = crypto.randomUUID();
3771
- return window.sessionStorage.setItem(ct, t), t;
3839
+ return window.sessionStorage.setItem(ut, t), t;
3772
3840
  }
3773
- function ye(e, t) {
3841
+ function Ce(e, t) {
3774
3842
  return `${e}:${t}`;
3775
3843
  }
3776
- function ya(e) {
3844
+ function va(e) {
3777
3845
  const t = document.currentScript;
3778
3846
  if (t instanceof HTMLScriptElement)
3779
3847
  return [t];
3780
3848
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3781
3849
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3782
- (a) => a instanceof HTMLScriptElement && _a(a) && xa(a, o)
3850
+ (a) => a instanceof HTMLScriptElement && wa(a) && _a(a, o)
3783
3851
  );
3784
3852
  }
3785
- function Ca(e) {
3786
- for (const t of ya(e)) {
3787
- if (At.has(t) || t.dataset.plunoAutoMount === "false")
3853
+ function ya(e) {
3854
+ for (const t of va(e)) {
3855
+ if (Tt.has(t) || t.dataset.plunoAutoMount === "false")
3788
3856
  continue;
3789
- At.add(t);
3857
+ Tt.add(t);
3790
3858
  const n = t.dataset.plunoPreviewChannel;
3791
- lo({
3859
+ ro({
3792
3860
  token: t.dataset.plunoToken,
3793
3861
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3794
3862
  backendUrl: t.dataset.plunoBackendUrl,
3795
- webSocketFactory: n ? ro(n) : void 0,
3863
+ webSocketFactory: n ? io(n) : void 0,
3796
3864
  launcherLabel: t.dataset.plunoLauncherLabel,
3797
3865
  accentColor: t.dataset.plunoAccentColor,
3798
3866
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3804,8 +3872,8 @@ function Ca(e) {
3804
3872
  });
3805
3873
  }
3806
3874
  }
3807
- Ca(import.meta.url);
3875
+ ya(import.meta.url);
3808
3876
  export {
3809
- ro as createProductAgentPreviewBridgeWebSocketFactory,
3810
- lo as mountPlunoProductAgentWidget
3877
+ io as createProductAgentPreviewBridgeWebSocketFactory,
3878
+ ro as mountPlunoProductAgentWidget
3811
3879
  };