@pluno/product-agent-web 0.1.29 → 0.1.30

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 jt } from "./product-agent-sdk.js";
2
- const Kt = "#7c3aed";
3
- function Yt(e) {
4
- const t = en(e);
1
+ import { PlunoProductAgent as rn } from "./product-agent-sdk.js";
2
+ const ln = "#7c3aed";
3
+ function pn(e) {
4
+ const t = gn(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,23 @@ function Yt(e) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function Xt(e) {
79
- return `data:image/svg+xml,${encodeURIComponent(Yt(e))}`;
78
+ function sn(e) {
79
+ return `data:image/svg+xml,${encodeURIComponent(pn(e))}`;
80
80
  }
81
- const X = "#2c2a1e", qe = [253, 250, 241], je = 3.5;
82
- function bt(e) {
83
- const t = wt(e);
84
- if (Ke(ae(t), qe) >= je)
81
+ const re = "#2c2a1e", nt = [253, 250, 241], ot = 3.5;
82
+ function Lt(e) {
83
+ const t = Pt(e);
84
+ if (at(he(t), nt) >= ot)
85
85
  return t;
86
- let o = ae(t);
87
- const a = ae(X);
86
+ let o = he(t);
87
+ const a = he(re);
88
88
  for (let i = 0; i < 6; i += 1)
89
- if (o = tn(o, a, 0.22), Ke(o, qe) >= je)
90
- return Le(o);
91
- return Le(o);
89
+ if (o = hn(o, a, 0.22), at(o, nt) >= ot)
90
+ return Oe(o);
91
+ return Oe(o);
92
92
  }
93
- function Zt(e) {
94
- const t = bt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
93
+ function dn(e) {
94
+ const t = Lt(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
95
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
96
96
  <defs>
97
97
  <clipPath id="scribbleBoltClip">
@@ -104,26 +104,26 @@ function Zt(e) {
104
104
  </defs>
105
105
  <g filter="url(#scribbleBoltWobble)">
106
106
  <g clip-path="url(#scribbleBoltClip)">
107
- <path d="${Qt()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
107
+ <path d="${un()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
108
108
  </g>
109
- <path d="${n}" fill="none" stroke="${X}" stroke-width="18" stroke-linejoin="round"/>
109
+ <path d="${n}" fill="none" stroke="${re}" stroke-width="18" stroke-linejoin="round"/>
110
110
  <g transform="rotate(-2 528 463)">
111
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${X}" stroke-width="13"/>
112
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${X}"/>
111
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${re}" stroke-width="13"/>
112
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${re}"/>
113
113
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
114
114
  </g>
115
115
  <g transform="rotate(2 717 462)">
116
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${X}" stroke-width="13"/>
117
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${X}"/>
116
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${re}" stroke-width="13"/>
117
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${re}"/>
118
118
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
119
  </g>
120
120
  </g>
121
121
  </svg>`;
122
122
  }
123
- function Jt(e) {
124
- return `data:image/svg+xml,${encodeURIComponent(Zt(e))}`;
123
+ function cn(e) {
124
+ return `data:image/svg+xml,${encodeURIComponent(dn(e))}`;
125
125
  }
126
- function Qt() {
126
+ function un() {
127
127
  let n = "M 280 120", o = !1, a = 0;
128
128
  for (let i = 150; i <= 1170; i += 62) {
129
129
  const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
@@ -131,8 +131,8 @@ function Qt() {
131
131
  }
132
132
  return n;
133
133
  }
134
- function en(e) {
135
- const t = wt(e), n = Pe(ae(t));
134
+ function gn(e) {
135
+ const t = Pt(e), n = Be(he(t));
136
136
  return n > 0.86 ? {
137
137
  top: "#ffffff",
138
138
  middle: "#f6f6f6",
@@ -156,90 +156,90 @@ function en(e) {
156
156
  inner: "#4b4b4b",
157
157
  shadow: "#000000"
158
158
  } : {
159
- top: B(t, 0.28, -0.03),
160
- middle: B(t, 0.08, 0.04),
161
- bottom: B(t, -0.1, 0.02),
162
- edgeStart: B(t, 0.08, 0.08),
163
- edgeMiddle: B(t, -0.08, 0.08),
164
- edgeEnd: B(t, -0.18, 0.05),
165
- glow: B(t, 0.32, -0.12),
166
- highlight: B(t, 0.38, -0.18),
167
- inner: B(t, 0.24, -0.1),
168
- shadow: B(t, -0.25, -0.08)
159
+ top: z(t, 0.28, -0.03),
160
+ middle: z(t, 0.08, 0.04),
161
+ bottom: z(t, -0.1, 0.02),
162
+ edgeStart: z(t, 0.08, 0.08),
163
+ edgeMiddle: z(t, -0.08, 0.08),
164
+ edgeEnd: z(t, -0.18, 0.05),
165
+ glow: z(t, 0.32, -0.12),
166
+ highlight: z(t, 0.38, -0.18),
167
+ inner: z(t, 0.24, -0.1),
168
+ shadow: z(t, -0.25, -0.08)
169
169
  };
170
170
  }
171
- function wt(e) {
171
+ function Pt(e) {
172
172
  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()}` : Kt;
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()}` : ln;
174
174
  }
175
- function ae(e) {
175
+ function he(e) {
176
176
  return [
177
177
  Number.parseInt(e.slice(1, 3), 16),
178
178
  Number.parseInt(e.slice(3, 5), 16),
179
179
  Number.parseInt(e.slice(5, 7), 16)
180
180
  ];
181
181
  }
182
- function Le([e, t, n]) {
182
+ function Oe([e, t, n]) {
183
183
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
184
184
  return `#${o(e)}${o(t)}${o(n)}`;
185
185
  }
186
- function Pe([e, t, n]) {
186
+ function Be([e, t, n]) {
187
187
  const o = (a) => {
188
188
  const i = a / 255;
189
189
  return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
190
190
  };
191
191
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
192
192
  }
193
- function Ke(e, t) {
194
- const n = Pe(e), o = Pe(t), [a, i] = n > o ? [n, o] : [o, n];
193
+ function at(e, t) {
194
+ const n = Be(e), o = Be(t), [a, i] = n > o ? [n, o] : [o, n];
195
195
  return (a + 0.05) / (i + 0.05);
196
196
  }
197
- function tn(e, t, n) {
198
- const o = Ae(n);
197
+ function hn(e, t, n) {
198
+ const o = Fe(n);
199
199
  return [
200
200
  e[0] + (t[0] - e[0]) * o,
201
201
  e[1] + (t[1] - e[1]) * o,
202
202
  e[2] + (t[2] - e[2]) * o
203
203
  ];
204
204
  }
205
- function B(e, t, n) {
206
- const [o, a, i] = nn(ae(e));
207
- return Le(on(o, Ae(a + n), Ae(i + t)));
205
+ function z(e, t, n) {
206
+ const [o, a, i] = mn(he(e));
207
+ return Oe(fn(o, Fe(a + n), Fe(i + t)));
208
208
  }
209
- function nn([e, t, n]) {
209
+ function mn([e, t, n]) {
210
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
211
  if (l === p)
212
212
  return [0, 0, c];
213
213
  const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
214
214
  return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
215
215
  }
216
- function on(e, t, n) {
216
+ function fn(e, t, n) {
217
217
  if (t === 0)
218
218
  return [n * 255, n * 255, n * 255];
219
219
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
220
220
  return [
221
- ye(a, o, e + 1 / 3) * 255,
222
- ye(a, o, e) * 255,
223
- ye(a, o, e - 1 / 3) * 255
221
+ Ne(a, o, e + 1 / 3) * 255,
222
+ Ne(a, o, e) * 255,
223
+ Ne(a, o, e - 1 / 3) * 255
224
224
  ];
225
225
  }
226
- function ye(e, t, n) {
226
+ function Ne(e, t, n) {
227
227
  let o = n;
228
228
  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
229
  }
230
- function Ae(e) {
230
+ function Fe(e) {
231
231
  return Math.max(0, Math.min(1, e));
232
232
  }
233
- const _t = "suggest_share_on_socials";
234
- function an(e) {
233
+ const At = "suggest_share_on_socials";
234
+ function bn(e) {
235
235
  for (let t = e.length - 1; t >= 0; t -= 1) {
236
236
  const n = e[t];
237
- if (n.role !== "tool" || n.toolName !== _t)
237
+ if (n.role !== "tool" || n.toolName !== At)
238
238
  continue;
239
- const o = Ye(e, t, "assistant");
239
+ const o = it(e, t, "assistant");
240
240
  if (!o)
241
241
  return null;
242
- const a = Ye(e, o.index, "user");
242
+ const a = it(e, o.index, "user");
243
243
  return a ? {
244
244
  id: `share:${n.callId ?? n.id}`,
245
245
  userPrompt: a.content,
@@ -248,13 +248,13 @@ function an(e) {
248
248
  }
249
249
  return null;
250
250
  }
251
- async function rn(e) {
252
- const t = await ln(e);
251
+ async function wn(e) {
252
+ const t = await _n(e);
253
253
  if (!navigator.clipboard || typeof ClipboardItem > "u")
254
254
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
255
255
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
256
256
  }
257
- function Ye(e, t, n) {
257
+ function it(e, t, n) {
258
258
  for (let o = t - 1; o >= 0; o -= 1) {
259
259
  const a = e[o];
260
260
  if (a.role === n && a.content.trim())
@@ -262,73 +262,73 @@ function Ye(e, t, n) {
262
262
  }
263
263
  return null;
264
264
  }
265
- async function ln(e) {
265
+ async function _n(e) {
266
266
  return await (await fetch(e)).blob();
267
267
  }
268
- const pn = "https://app.pluno.ai", sn = "/api/product-agent/embed/active-users", dn = 1800, cn = 15e3, un = 250, gn = 1e3, hn = 3e4;
269
- function mn(e, t = {}) {
268
+ const xn = "https://app.pluno.ai", vn = "/api/product-agent/embed/active-users", yn = 1800, Cn = 15e3, En = 250, Sn = 1e3, kn = 3e4;
269
+ function Ln(e, t = {}) {
270
270
  let n = !1, o = null, a = null, i = null;
271
271
  const l = () => {
272
272
  i !== null && (window.clearInterval(i), i = null);
273
273
  }, p = (s) => {
274
274
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
275
275
  d();
276
- }, wn(s)));
276
+ }, Tn(s)));
277
277
  }, c = (s) => {
278
278
  if (l(), o === null) {
279
279
  o = s, e(s);
280
280
  return;
281
281
  }
282
- const f = o, v = performance.now();
282
+ const b = o, y = performance.now();
283
283
  i = window.setInterval(() => {
284
284
  if (n) {
285
285
  l();
286
286
  return;
287
287
  }
288
- const x = Math.min(1, (performance.now() - v) / dn);
289
- o = Math.round(f + (s - f) * _n(x)), e(o), x >= 1 && (o = s, e(s), l());
290
- }, un);
288
+ const S = Math.min(1, (performance.now() - y) / yn);
289
+ o = Math.round(b + (s - b) * Nn(S)), e(o), S >= 1 && (o = s, e(s), l());
290
+ }, En);
291
291
  }, d = async () => {
292
292
  try {
293
- const s = await fn(t);
293
+ const s = await Pn(t);
294
294
  if (n)
295
295
  return;
296
296
  c(s.count), p(s.refreshAfterMs);
297
297
  } catch {
298
- p(cn);
298
+ p(Cn);
299
299
  }
300
300
  };
301
301
  return d(), () => {
302
302
  n = !0, a !== null && window.clearTimeout(a), l();
303
303
  };
304
304
  }
305
- async function fn(e) {
305
+ async function Pn(e) {
306
306
  if (e.loader)
307
307
  return e.loader();
308
- const n = await (e.fetcher ?? fetch)(new URL(sn, bn(e.backendUrl ?? pn)).toString(), {
308
+ const n = await (e.fetcher ?? fetch)(new URL(vn, An(e.backendUrl ?? xn)).toString(), {
309
309
  cache: "no-store",
310
310
  credentials: "omit"
311
311
  });
312
312
  if (!n.ok)
313
313
  throw new Error("Failed to load active users");
314
- const o = await n.json(), a = Xe(o.count), i = Xe(o.refreshAfterMs ?? o.refresh_after_ms);
314
+ const o = await n.json(), a = rt(o.count), i = rt(o.refreshAfterMs ?? o.refresh_after_ms);
315
315
  if (a === null || i === null)
316
316
  throw new Error("Invalid active users response");
317
317
  return { count: a, refreshAfterMs: i };
318
318
  }
319
- function Xe(e) {
319
+ function rt(e) {
320
320
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
321
321
  }
322
- function bn(e) {
322
+ function An(e) {
323
323
  return e.endsWith("/") ? e : `${e}/`;
324
324
  }
325
- function wn(e) {
326
- return Math.min(hn, Math.max(gn, e));
325
+ function Tn(e) {
326
+ return Math.min(kn, Math.max(Sn, e));
327
327
  }
328
- function _n(e) {
328
+ function Nn(e) {
329
329
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
330
330
  }
331
- const xt = 100, xn = "product-agent:sdk-preview-socket-connect", vn = "product-agent:sdk-preview-socket-send", yn = "product-agent:sdk-preview-socket-close", Cn = "product-agent:sdk-preview-socket-open", En = "product-agent:sdk-preview-socket-message", Sn = "product-agent:sdk-preview-socket-error", kn = "product-agent:sdk-preview-socket-closed", Ze = "product-agent:sdk-preview-socket-id", Ln = "product-agent:preview-diagnostic", vt = "pluno.productAgent.sharePromptsDisabled", ue = 10, Pn = 10 * 1024 * 1024, An = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), U = {
331
+ const Tt = 100, Dn = "product-agent:sdk-preview-socket-connect", In = "product-agent:sdk-preview-socket-send", Mn = "product-agent:sdk-preview-socket-close", Rn = "product-agent:sdk-preview-socket-open", On = "product-agent:sdk-preview-socket-message", Bn = "product-agent:sdk-preview-socket-error", Fn = "product-agent:sdk-preview-socket-closed", lt = "product-agent:sdk-preview-socket-id", Un = "product-agent:preview-diagnostic", Nt = "pluno.productAgent.sharePromptsDisabled", ye = 10, zn = 10 * 1024 * 1024, Gn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), W = {
332
332
  launcherLabel: "Ask for anything...",
333
333
  accentColor: "#7c3aed",
334
334
  colorScheme: "light",
@@ -336,19 +336,19 @@ const xt = 100, xn = "product-agent:sdk-preview-socket-connect", vn = "product-a
336
336
  scribbleStyle: !1,
337
337
  position: "bottom-right",
338
338
  movableLauncher: !1
339
- }, Je = '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>', Nn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Qe = "pluno-pa-scribble-font", yt = 190, Ct = 41, Tn = 48, Dn = 420, In = 520, Mn = 0.24, Rn = 680, On = 800, Bn = 0.76, D = 8, Ne = 50, Fn = "http://www.w3.org/2000/svg", Un = 11, zn = 13, et = 4, Gn = 10, $n = 40, Hn = "movable-launcher-position-v2", Et = "pluno-pa-widget-styles", St = "data-pluno-pa-widget-styles";
340
- function Wn(e) {
341
- return (t) => new z(t, e);
339
+ }, pt = '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>', $n = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', st = "pluno-pa-scribble-font", Dt = 190, It = 41, Hn = 48, Wn = 420, Vn = 520, jn = 0.24, qn = 680, Kn = 800, Yn = 0.76, B = 8, Ue = 50, Xn = "http://www.w3.org/2000/svg", Zn = 11, Jn = 13, dt = 4, Qn = 10, eo = 40, to = "movable-launcher-position-v2", Mt = "pluno-pa-widget-styles", Rt = "data-pluno-pa-widget-styles";
340
+ function no(e) {
341
+ return (t) => new V(t, e);
342
342
  }
343
- async function Vn(e = {}) {
343
+ async function oo(e = {}) {
344
344
  const t = {
345
- launcherLabel: e.launcherLabel ?? U.launcherLabel,
346
- accentColor: e.accentColor ?? U.accentColor,
347
- colorScheme: e.colorScheme ?? U.colorScheme,
348
- fontFamily: e.fontFamily ?? U.fontFamily,
349
- scribbleStyle: e.scribbleStyle ?? U.scribbleStyle,
350
- position: e.position ?? U.position,
351
- movableLauncher: e.movableLauncher ?? U.movableLauncher,
345
+ launcherLabel: e.launcherLabel ?? W.launcherLabel,
346
+ accentColor: e.accentColor ?? W.accentColor,
347
+ colorScheme: e.colorScheme ?? W.colorScheme,
348
+ fontFamily: e.fontFamily ?? W.fontFamily,
349
+ scribbleStyle: e.scribbleStyle ?? W.scribbleStyle,
350
+ position: e.position ?? W.position,
351
+ movableLauncher: e.movableLauncher ?? W.movableLauncher,
352
352
  token: e.token,
353
353
  tokenProvider: e.tokenProvider,
354
354
  tokenEndpoint: e.tokenEndpoint,
@@ -370,7 +370,7 @@ async function Vn(e = {}) {
370
370
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
371
371
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
372
372
  };
373
- V("web-sdk.widget", "Mounting widget with merged options", {
373
+ Q("web-sdk.widget", "Mounting widget with merged options", {
374
374
  accentColor: t.accentColor,
375
375
  colorScheme: t.colorScheme,
376
376
  fontFamily: t.fontFamily,
@@ -385,32 +385,32 @@ async function Vn(e = {}) {
385
385
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
386
386
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
387
387
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
388
- let i = tt(t.accentColor, t.scribbleStyle);
389
- eo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
- const l = await Wo(), p = l.ownerDocument;
391
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), gt(o, t.accentColor), nt(a, i, {
388
+ let i = ct(t.accentColor, t.scribbleStyle);
389
+ mo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
+ const l = await aa(), p = l.ownerDocument;
391
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ct(o, t.accentColor), ut(a, i, {
392
392
  accentColor: t.accentColor,
393
393
  colorScheme: t.colorScheme,
394
394
  fontFamily: t.fontFamily,
395
395
  scribbleStyle: t.scribbleStyle
396
- }), V("web-sdk.widget", "Applied initial widget appearance", {
396
+ }), Q("web-sdk.widget", "Applied initial widget appearance", {
397
397
  accentColor: t.accentColor,
398
398
  colorScheme: t.colorScheme,
399
399
  fontFamily: t.fontFamily,
400
400
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
401
401
  });
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"), v = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), S = a.querySelector(".pluno-pa-widget__attachment-error"), y = a.querySelector(".pluno-pa-widget__billing-status"), _ = a.querySelector(".pluno-pa-widget__attachments"), g = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), P = a.querySelector(".pluno-pa-widget__new-chat"), E = a.querySelector(".pluno-pa-widget__active-users-counter"), m = a.querySelector(".pluno-pa-widget__timeline");
403
- if (!c || !s || !f || !v || !x || !S || !y || !_ || !g || !h || !P || !E || !m)
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"), b = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), w = a.querySelector(".pluno-pa-widget__attachment-error"), I = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), u = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), C = a.querySelector(".pluno-pa-widget__new-chat"), _ = a.querySelector(".pluno-pa-widget__timeline-jump"), N = a.querySelector(".pluno-pa-widget__active-users-counter"), k = a.querySelector(".pluno-pa-widget__timeline"), ee = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
403
+ if (!c || !s || !b || !y || !S || !w || !I || !v || !u || !h || !C || !_ || !N || !k || !ee)
404
404
  throw new Error("Failed to mount Pluno widget");
405
405
  if (t.movableLauncher && !d)
406
406
  throw new Error("Failed to mount Pluno widget drag handle");
407
- it(s), it(g);
408
- let b = [], C = null;
409
- const k = () => {
410
- go(_, b, (r) => {
411
- b = b.filter((u, A) => A !== r), k(), T(w.getState()), O();
407
+ mt(s), mt(u);
408
+ let E = [], m = null;
409
+ const x = () => {
410
+ Lo(v, E, (r) => {
411
+ E = E.filter((g, L) => L !== r), x(), O(f.getState()), U();
412
412
  });
413
- }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
413
+ }, M = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
414
414
  if (!t.tokenEndpoint)
415
415
  throw new Error("Pluno widget requires token or tokenEndpoint");
416
416
  const r = await fetch(t.tokenEndpoint, {
@@ -421,19 +421,19 @@ async function Vn(e = {}) {
421
421
  });
422
422
  if (!r.ok)
423
423
  throw new Error("Failed to load Pluno token");
424
- const u = await r.json();
425
- if (!u.token)
424
+ const g = await r.json();
425
+ if (!g.token)
426
426
  throw new Error("Pluno token endpoint did not return a token");
427
- return u.token;
427
+ return g.token;
428
428
  }), R = window.fetch.bind(window);
429
- let w;
430
- w = await jt.init({
429
+ let f;
430
+ f = await rn.init({
431
431
  token: t.token,
432
- tokenProvider: I,
432
+ tokenProvider: M,
433
433
  backendUrl: t.backendUrl,
434
434
  metadata: () => ({
435
435
  ...t.metadata ?? {},
436
- ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
436
+ ...!f.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
437
437
  }),
438
438
  initialStarterPrompts: t.initialStarterPrompts,
439
439
  clientId: t.clientId,
@@ -442,32 +442,42 @@ async function Vn(e = {}) {
442
442
  webSocketFactory: t.webSocketFactory,
443
443
  autoConnect: t.loginRequired ? !1 : void 0
444
444
  });
445
- const H = Vo(t), ge = new Set(H.openToolGroupKeys), q = new Set(H.seenShareCandidateIds), ie = new Set(q);
446
- let he = H.sharePromptsDisabled || await qo(t), F = t.movableLauncher ? H.launcherPosition : null, Oe = F !== null, G = null, me = !1;
447
- const Ut = () => {
448
- me || typeof document > "u" || (gt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
449
- }, Be = new MutationObserver(Ut);
450
- Be.observe(p.documentElement, { childList: !0, subtree: !0 });
451
- const fe = (r = !0) => {
452
- const u = Te(a, r);
453
- return ot(
445
+ const A = ia(t), te = new Set(A.openToolGroupKeys), ne = new Set(A.seenShareCandidateIds), me = new Set(ne);
446
+ let Ce = A.sharePromptsDisabled || await ra(t), G = t.movableLauncher ? A.launcherPosition : null, Ve = G !== null, j = null, Ee = !1, Y = !1, X = {
447
+ enabled: !0
448
+ }, Z = 0, je = "";
449
+ const $ = (r, g) => {
450
+ X = { enabled: r, reason: g };
451
+ }, H = () => {
452
+ _.hidden = !0;
453
+ }, Yt = () => {
454
+ _.hidden = !1;
455
+ }, Xt = (r = "jump") => {
456
+ $(!0, r), H(), ge(k, () => X.enabled), Z = k.scrollTop;
457
+ }, Zt = () => {
458
+ Ee || typeof document > "u" || (Ct(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
459
+ }, qe = new MutationObserver(Zt);
460
+ qe.observe(p.documentElement, { childList: !0, subtree: !0 });
461
+ const Se = (r = !0) => {
462
+ const g = ze(a, r);
463
+ return gt(
454
464
  a,
455
- F ?? Kn(a, t.position, u),
456
- u
465
+ G ?? ro(a, t.position, g),
466
+ g
457
467
  );
458
- }, M = () => {
459
- Ko(t, {
468
+ }, F = () => {
469
+ pa(t, {
460
470
  isOpen: a.classList.contains("pluno-pa-widget--open"),
461
- composerValue: g.value,
462
- openToolGroupKeys: [...ge],
463
- launcherPosition: Oe ? F : null,
464
- seenShareCandidateIds: [...q].slice(-xt),
465
- sharePromptsDisabled: he
471
+ composerValue: u.value,
472
+ openToolGroupKeys: [...te],
473
+ launcherPosition: Ve ? G : null,
474
+ seenShareCandidateIds: [...ne].slice(-Tt),
475
+ sharePromptsDisabled: Ce
466
476
  });
467
- }, W = (r, u = {}) => {
468
- Qn(r, {
469
- debugVersion: Hn,
470
- launcherPosition: F,
477
+ }, J = (r, g = {}) => {
478
+ uo(r, {
479
+ debugVersion: to,
480
+ launcherPosition: G,
471
481
  rootClasses: a.className,
472
482
  rootStyle: {
473
483
  left: a.style.left,
@@ -475,131 +485,142 @@ async function Vn(e = {}) {
475
485
  right: a.style.right,
476
486
  bottom: a.style.bottom
477
487
  },
478
- rootRect: Ce(a),
479
- launcherRect: Ce(c),
480
- panelRect: Ce(f),
481
- viewport: J(),
482
- panelHidden: f.hidden,
483
- closeHidden: v.hidden,
484
- ...u
488
+ rootRect: De(a),
489
+ launcherRect: De(c),
490
+ panelRect: De(b),
491
+ viewport: pe(),
492
+ panelHidden: b.hidden,
493
+ closeHidden: y.hidden,
494
+ ...g
485
495
  });
486
- }, re = (r = !0) => {
487
- if (!F)
488
- return pe(a, null), fe(r);
489
- const u = fe(r);
490
- return pe(a, u), W("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
491
- }, Fe = (r, u) => {
492
- if (!r || !u) {
493
- Jn(a);
496
+ }, fe = (r = !0) => {
497
+ if (!G)
498
+ return we(a, null), Se(r);
499
+ const g = Se(r);
500
+ return we(a, g), J("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
501
+ }, Ke = (r, g) => {
502
+ if (!r || !g) {
503
+ co(a);
494
504
  return;
495
505
  }
496
- Zn(a, {
497
- x: r.x - u.x,
498
- y: r.y - u.y
506
+ so(a, {
507
+ x: r.x - g.x,
508
+ y: r.y - g.y
499
509
  });
500
- }, Ue = () => {
501
- const r = re();
510
+ }, Ye = () => {
511
+ const r = fe();
502
512
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
503
- const u = at(a, r, t.position);
504
- Fe(u, r), W("Applied open panel position after viewport resize", { openPanelPosition: u });
505
- } else F && W("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
513
+ const g = ht(a, r, t.position);
514
+ Ke(g, r), J("Applied open panel position after viewport resize", { openPanelPosition: g });
515
+ } else G && J("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
506
516
  };
507
- let ze = () => {
517
+ let Xe = () => {
508
518
  };
509
- window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze = jn({
519
+ window.addEventListener("resize", Ye), t.movableLauncher && d ? (fe(), Xe = io({
510
520
  root: a,
511
521
  launcher: c,
512
522
  launcherDragHandle: d,
513
- getPosition: () => fe(),
523
+ getPosition: () => Se(),
514
524
  setPosition: (r) => {
515
- const u = r;
516
- F = ot(a, r, Te(a)), pe(a, F), W("Dragging closed launcher", { requestedPosition: u });
525
+ const g = r;
526
+ G = gt(a, r, ze(a)), we(a, G), J("Dragging closed launcher", { requestedPosition: g });
517
527
  },
518
528
  persist: () => {
519
- Oe = !0, M(), W("Persisted closed launcher drag position");
529
+ Ve = !0, F(), J("Persisted closed launcher drag position");
520
530
  }
521
- })) : pe(a, null);
522
- let be = !1;
523
- const Ge = async () => {
524
- if (!(!t.billingStatusLoader || be)) {
525
- be = !0;
531
+ })) : we(a, null);
532
+ let ke = !1;
533
+ const Ze = async () => {
534
+ if (!(!t.billingStatusLoader || ke)) {
535
+ ke = !0;
526
536
  try {
527
537
  const r = await t.billingStatusLoader();
528
- lt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, ke(y, t.billingStatus, w.getState().lastErrorCode), O());
538
+ bt(t.billingStatus, r, f.getState().lastErrorCode) && (t.billingStatus = r, Re(I, t.billingStatus, f.getState().lastErrorCode), U());
529
539
  } finally {
530
- be = !1;
540
+ ke = !1;
531
541
  }
532
542
  }
533
- }, j = (r = "", u = !0) => {
534
- Ge(), G !== null && (window.clearTimeout(G), G = null), f.hidden = !1, v.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
535
- const A = re(), ne = at(a, A, t.position);
536
- if (Fe(ne, A), W("Opening launcher at clamped open panel position", { openPanelPosition: ne, visibleLauncherPosition: A }), !u) {
537
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, oe(g)), m.scrollTop = m.scrollHeight, g.focus(), g.setSelectionRange(g.value.length, g.value.length), M();
543
+ }, oe = (r = "", g = !0) => {
544
+ Ze(), j !== null && (window.clearTimeout(j), j = null), b.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
545
+ const L = fe(), q = ht(a, L, t.position);
546
+ if (Ke(q, L), J("Opening launcher at clamped open panel position", { openPanelPosition: q, visibleLauncherPosition: L }), $(!0, "open"), H(), !g) {
547
+ a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F();
538
548
  return;
539
549
  }
540
550
  window.requestAnimationFrame(() => {
541
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, oe(g)), m.scrollTop = m.scrollHeight, g.focus(), g.setSelectionRange(g.value.length, g.value.length), M(), G = window.setTimeout(() => {
542
- c.hidden = !0, m.scrollTop = m.scrollHeight;
551
+ a.classList.add("pluno-pa-widget--open"), r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F(), j = window.setTimeout(() => {
552
+ c.hidden = !0, ge(k, () => X.enabled), Z = k.scrollTop;
543
553
  }, 220);
544
554
  });
545
- }, zt = () => {
546
- G !== null && (window.clearTimeout(G), G = null), c.hidden = !1, F && (re(!1), W("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), M(), G = window.setTimeout(() => {
547
- f.hidden = !0, v.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
555
+ }, Jt = () => {
556
+ j !== null && (window.clearTimeout(j), j = null), c.hidden = !1, G && (fe(!1), J("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), j = window.setTimeout(() => {
557
+ b.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
548
558
  }, 220);
549
559
  };
550
560
  c.addEventListener("submit", (r) => {
551
- r.preventDefault(), j(s.value), s.value = "";
561
+ r.preventDefault(), oe(s.value), s.value = "";
552
562
  }), d?.addEventListener("click", (r) => {
553
563
  r.preventDefault(), r.stopPropagation();
554
564
  }), c.addEventListener("click", (r) => {
555
- r.target === s && !d || (j(s.value), s.value = "");
565
+ r.target === s && !d || (oe(s.value), s.value = "");
556
566
  }), s.addEventListener("focus", () => {
557
- j(s.value), s.value = "";
567
+ oe(s.value), s.value = "";
558
568
  }), s.addEventListener("input", () => {
559
569
  if (!s.value)
560
570
  return;
561
571
  const r = s.value;
562
- j(r), s.value = "";
563
- }), v.addEventListener("click", zt);
564
- const O = () => {
565
- h.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && b.length === 0;
572
+ oe(r), s.value = "";
573
+ }), y.addEventListener("click", Jt), k.addEventListener("scroll", () => {
574
+ k.scrollTop < Z - 1 && $(!1, "userScroll"), Z = k.scrollTop;
575
+ }), _.addEventListener("click", () => {
576
+ Xt();
577
+ });
578
+ const Je = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
579
+ ([r]) => {
580
+ r?.isIntersecting && ($(!0, "bottom"), H());
581
+ },
582
+ { root: k, threshold: 0 }
583
+ );
584
+ Je?.observe(ee);
585
+ const U = () => {
586
+ h.disabled = K(t.billingStatus) || !f.getState().isThinking && u.value.trim().length === 0 && E.length === 0;
566
587
  };
567
- t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (r) => {
588
+ t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, u.placeholder = t.loginButtonLabel, S.hidden = !0), S.addEventListener("submit", (r) => {
568
589
  if (r.preventDefault(), t.loginRequired) {
569
590
  t.onLoginClick?.();
570
591
  return;
571
592
  }
572
- $(t.billingStatus) || (b = Ee(w, g, b), k(), O());
593
+ K(t.billingStatus) || (Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U());
573
594
  });
574
- let ee = 0;
575
- const Gt = () => {
576
- ee = 0, a.classList.remove("pluno-pa-widget--drag-over");
577
- }, $t = (r) => {
578
- C !== null && window.clearTimeout(C), S.textContent = r, S.hidden = !1, C = window.setTimeout(() => {
579
- S.textContent = "", S.hidden = !0, C = null;
595
+ let de = 0;
596
+ const Qt = () => {
597
+ de = 0, a.classList.remove("pluno-pa-widget--drag-over");
598
+ }, en = (r) => {
599
+ m !== null && window.clearTimeout(m), w.textContent = r, w.hidden = !1, m = window.setTimeout(() => {
600
+ w.textContent = "", w.hidden = !0, m = null;
580
601
  }, 3e3);
581
- }, Ht = () => {
582
- C !== null && (window.clearTimeout(C), C = null), S.textContent = "", S.hidden = !0;
583
- }, Wt = async (r) => {
602
+ }, tn = () => {
603
+ m !== null && (window.clearTimeout(m), m = null), w.textContent = "", w.hidden = !0;
604
+ }, nn = async (r) => {
584
605
  if (r.length === 0)
585
606
  return;
586
- const u = await bo(r);
587
- if (b.length + u.length > ue)
588
- throw new Error(`Attach up to ${ue} files per message.`);
589
- b = [...b, ...u], k(), Ht(), O(), T(w.getState());
607
+ const g = await No(r);
608
+ if (E.length + g.length > ye)
609
+ throw new Error(`Attach up to ${ye} files per message.`);
610
+ E = [...E, ...g], x(), tn(), U(), O(f.getState());
590
611
  };
591
612
  a.addEventListener("dragenter", (r) => {
592
- !se(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ee += 1, a.classList.add("pluno-pa-widget--drag-over"));
613
+ !_e(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), de += 1, a.classList.add("pluno-pa-widget--drag-over"));
593
614
  }), a.addEventListener("dragover", (r) => {
594
- const u = r.dataTransfer;
595
- !se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
615
+ const g = r.dataTransfer;
616
+ !_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), g.dropEffect = "copy");
596
617
  }), a.addEventListener("dragleave", (r) => {
597
- se(r.dataTransfer) && (r.stopPropagation(), ee = Math.max(0, ee - 1), ee === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
618
+ _e(r.dataTransfer) && (r.stopPropagation(), de = Math.max(0, de - 1), de === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
598
619
  }), a.addEventListener("drop", (r) => {
599
- const u = r.dataTransfer;
600
- !se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Gt(), Wt(u.files).catch((A) => {
601
- $t(A instanceof Error ? A.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
602
- message: A instanceof Error ? A.message : String(A)
620
+ const g = r.dataTransfer;
621
+ !_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Qt(), nn(g.files).catch((L) => {
622
+ en(L instanceof Error ? L.message : "Failed to attach file"), Q("web-sdk.widget", "Attachment failed", {
623
+ message: L instanceof Error ? L.message : String(L)
603
624
  });
604
625
  }));
605
626
  }), h.addEventListener("click", () => {
@@ -607,154 +628,160 @@ async function Vn(e = {}) {
607
628
  t.onLoginClick?.();
608
629
  return;
609
630
  }
610
- if (w.getState().isThinking) {
611
- w.stop();
631
+ if (f.getState().isThinking) {
632
+ f.stop();
612
633
  return;
613
634
  }
614
- b = Ee(w, g, b), k(), O(), T(w.getState());
615
- }), P.addEventListener("click", () => {
616
- w.startNewSession(), ge.clear(), g.value = "", b = [], k(), oe(g), M(), O(), g.focus(), T(w.getState());
617
- }), g.addEventListener("input", () => {
618
- oe(g), M(), O(), T(w.getState());
619
- }), g.addEventListener("keydown", (r) => {
635
+ Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
636
+ }), C.addEventListener("click", () => {
637
+ Y = !0, $(!0, "newSession"), H(), f.startNewSession(), te.clear(), u.value = "", E = [], x(), ue(u), F(), U(), u.focus(), O(f.getState());
638
+ }), u.addEventListener("input", () => {
639
+ ue(u), F(), U(), O(f.getState());
640
+ }), u.addEventListener("keydown", (r) => {
620
641
  if (!(r.key !== "Enter" || r.shiftKey)) {
621
642
  if (r.preventDefault(), t.loginRequired) {
622
643
  t.onLoginClick?.();
623
644
  return;
624
645
  }
625
- b = Ee(w, g, b), k(), O(), T(w.getState());
646
+ Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
626
647
  }
627
648
  }), a.addEventListener("click", (r) => {
628
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && M();
629
- }), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen && j(g.value, !1);
630
- const $e = () => i;
631
- let we = w.getState().appearance !== null, le = null, te = null, K = null, He = w.getState().isThinking, Y = null, _e = null, We = () => {
649
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
650
+ }), A.composerValue && (u.value = A.composerValue, ue(u)), A.isOpen && oe(u.value, !1);
651
+ const Qe = () => i;
652
+ let Le = f.getState().appearance !== null, be = null, ce = null, ae = null, et = f.getState().isThinking, ie = null, Pe = null, tt = () => {
632
653
  };
633
- const Vt = !!t.socialPostDraftHandler, T = (r) => {
634
- if (Re(r.lastErrorCode) ? Y = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (Y = null), ke(y, t.billingStatus, Y), t.loginRequired) {
635
- No(m, h, P, $e, t.loginButtonLabel, t.onLoginClick);
654
+ const on = !!t.socialPostDraftHandler, O = (r) => {
655
+ if (We(r.lastErrorCode) ? ie = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(I, t.billingStatus, ie), t.loginRequired) {
656
+ Wo(k, h, C, Qe, t.loginButtonLabel, t.onLoginClick);
636
657
  return;
637
658
  }
638
- Ao(
639
- m,
659
+ const g = go(r), L = g !== je;
660
+ je = g;
661
+ const q = Y || X.enabled;
662
+ Y = !1, Ho(
663
+ k,
664
+ ee,
640
665
  h,
641
- P,
642
- E,
666
+ C,
667
+ N,
643
668
  r,
644
- _e,
645
- _e !== null && st(r, g.value.trim().length > 0 || b.length > 0),
646
- ge,
647
- M,
648
- $e,
649
- (u) => {
650
- w.sendMessage(u);
669
+ Pe,
670
+ Pe !== null && _t(r, u.value.trim().length > 0 || E.length > 0),
671
+ q,
672
+ () => X.enabled,
673
+ te,
674
+ F,
675
+ Qe,
676
+ (D) => {
677
+ Y = !0, $(!0, "send"), H(), f.sendMessage(D);
651
678
  },
652
- Vt && !he ? {
653
- dismissedCandidateIds: ie,
654
- draftingCandidateId: le,
655
- error: te,
656
- onSeen: (u) => {
657
- q.add(u.id), M();
679
+ on && !Ce ? {
680
+ dismissedCandidateIds: me,
681
+ draftingCandidateId: be,
682
+ error: ce,
683
+ onSeen: (D) => {
684
+ ne.add(D.id), F();
658
685
  },
659
- onDraft: (u) => {
660
- qt(u);
686
+ onDraft: (D) => {
687
+ an(D);
661
688
  },
662
- onDismiss: (u) => {
663
- q.add(u.id), ie.add(u.id), M(), te = null, T(w.getState());
689
+ onDismiss: (D) => {
690
+ ne.add(D.id), me.add(D.id), F(), ce = null, O(f.getState());
664
691
  },
665
- onDisable: (u) => {
666
- he = !0, q.add(u.id), ie.add(u.id), M(), jo(t, !0), te = null, T(w.getState());
692
+ onDisable: (D) => {
693
+ Ce = !0, ne.add(D.id), me.add(D.id), F(), la(t, !0), ce = null, O(f.getState());
667
694
  }
668
695
  } : void 0
669
- );
696
+ ), q ? (Z = k.scrollTop, H()) : L && ho(r) && Yt();
670
697
  };
671
- return We = mn((r) => {
672
- _e = r, !me && st(w.getState(), g.value.trim().length > 0 || b.length > 0) && T(w.getState());
673
- }, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }), w.on("state", (r) => {
674
- const u = He && !r.isThinking;
675
- He = r.isThinking, r.appearance ? (we = !0, V("web-sdk.widget", "Agent state supplied appearance", {
698
+ return tt = Ln((r) => {
699
+ Pe = r, !Ee && _t(f.getState(), u.value.trim().length > 0 || E.length > 0) && O(f.getState());
700
+ }, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }), f.on("state", (r) => {
701
+ const g = et && !r.isThinking;
702
+ et = r.isThinking, r.appearance ? (Le = !0, Q("web-sdk.widget", "Agent state supplied appearance", {
676
703
  appearance: r.appearance
677
- }), xe(r.appearance, "agent.state.appearance")) : we && (we = !1, V("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
704
+ }), Ae(r.appearance, "agent.state.appearance")) : Le && (Le = !1, Q("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
678
705
  fallbackAccentColor: t.accentColor,
679
706
  fallbackColorScheme: t.colorScheme,
680
707
  fallbackFontFamily: t.fontFamily
681
- }), xe({}, "agent.state.appearance-cleared")), T(r), O(), u && Ge();
682
- }), T(w.getState()), O(), {
683
- agent: w,
708
+ }), Ae({}, "agent.state.appearance-cleared")), O(r), U(), g && Ze();
709
+ }), O(f.getState()), U(), {
710
+ agent: f,
684
711
  updateAppearance: (r) => {
685
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), xe(r, "widgetHandle.updateAppearance");
712
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ae(r, "widgetHandle.updateAppearance");
686
713
  },
687
714
  updateBillingStatus: (r) => {
688
- const u = r ?? null;
689
- lt(t.billingStatus, u, Y) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (Y = null), ke(
715
+ const g = r ?? null;
716
+ bt(t.billingStatus, g, ie) && (t.billingStatus = g, t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(
690
717
  a.querySelector(".pluno-pa-widget__billing-status"),
691
718
  t.billingStatus,
692
- Y
693
- ), O());
719
+ ie
720
+ ), U());
694
721
  },
695
722
  openPanel: () => {
696
- j(g.value, !1);
723
+ oe(u.value, !1);
697
724
  },
698
725
  destroy: () => {
699
- me = !0, Be.disconnect(), window.removeEventListener("resize", Ue), ze(), C !== null && window.clearTimeout(C), We(), K?.remove(), w.destroy(), n.remove();
726
+ Ee = !0, qe.disconnect(), Je?.disconnect(), window.removeEventListener("resize", Ye), Xe(), m !== null && window.clearTimeout(m), tt(), ae?.remove(), f.destroy(), n.remove();
700
727
  }
701
728
  };
702
- async function qt(r) {
703
- if (!le) {
704
- le = r.id, te = null, T(w.getState());
729
+ async function an(r) {
730
+ if (!be) {
731
+ be = r.id, ce = null, O(f.getState());
705
732
  try {
706
733
  if (!t.socialPostDraftHandler)
707
734
  throw new Error("Social post drafting is not available here.");
708
- const u = await t.socialPostDraftHandler(r);
709
- if (!u.linkedinPost || !u.xPost)
735
+ const g = await t.socialPostDraftHandler(r);
736
+ if (!g.linkedinPost || !g.xPost)
710
737
  throw new Error("Pluno did not return a complete social post draft.");
711
- q.add(r.id), ie.add(r.id), M(), K?.remove(), K = Io(u, {
738
+ ne.add(r.id), me.add(r.id), F(), ae?.remove(), ae = qo(g, {
712
739
  socialPostRewardsUrl: t.socialPostRewardsUrl,
713
740
  onClose: () => {
714
- K?.remove(), K = null;
741
+ ae?.remove(), ae = null;
715
742
  }
716
- }), a.appendChild(K);
717
- } catch (u) {
718
- te = u instanceof Error ? u.message : "Could not draft social post.";
743
+ }), a.appendChild(ae);
744
+ } catch (g) {
745
+ ce = g instanceof Error ? g.message : "Could not draft social post.";
719
746
  } finally {
720
- le = null, T(w.getState());
747
+ be = null, O(f.getState());
721
748
  }
722
749
  }
723
750
  }
724
- function xe(r, u) {
725
- const A = r.accentColor ?? t.accentColor, ne = r.colorScheme ?? t.colorScheme, Ve = r.fontFamily ?? t.fontFamily, ve = r.scribbleStyle ?? t.scribbleStyle;
726
- i = tt(A, ve), nt(a, i, {
727
- accentColor: A,
728
- colorScheme: ne,
729
- fontFamily: Ve,
730
- scribbleStyle: ve
731
- }), V("web-sdk.widget", "Updated widget appearance", {
732
- source: u,
751
+ function Ae(r, g) {
752
+ const L = r.accentColor ?? t.accentColor, q = r.colorScheme ?? t.colorScheme, D = r.fontFamily ?? t.fontFamily, Te = r.scribbleStyle ?? t.scribbleStyle;
753
+ i = ct(L, Te), ut(a, i, {
754
+ accentColor: L,
755
+ colorScheme: q,
756
+ fontFamily: D,
757
+ scribbleStyle: Te
758
+ }), Q("web-sdk.widget", "Updated widget appearance", {
759
+ source: g,
733
760
  inputAppearance: r,
734
- appliedAccentColor: A,
735
- appliedColorScheme: ne,
736
- appliedFontFamily: Ve,
737
- appliedScribbleStyle: ve,
761
+ appliedAccentColor: L,
762
+ appliedColorScheme: q,
763
+ appliedFontFamily: D,
764
+ appliedScribbleStyle: Te,
738
765
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
739
766
  });
740
767
  }
741
768
  }
742
- function tt(e, t) {
743
- return t ? Jt(e) : Xt(e);
769
+ function ct(e, t) {
770
+ return t ? cn(e) : sn(e);
744
771
  }
745
- function nt(e, t, n) {
772
+ function ut(e, t, n) {
746
773
  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);
747
- const o = n.scribbleStyle ? bt(n.accentColor) : n.accentColor;
748
- e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle && qn(e.ownerDocument);
774
+ const o = n.scribbleStyle ? Lt(n.accentColor) : n.accentColor;
775
+ e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? $n : n.fontFamily, n.scribbleStyle && ao(e.ownerDocument);
749
776
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
750
777
  for (const i of a)
751
778
  i.src = t;
752
779
  }
753
- function qn(e) {
754
- if (e.getElementById(Qe))
780
+ function ao(e) {
781
+ if (e.getElementById(st))
755
782
  return;
756
783
  const t = e.createElement("style");
757
- t.id = Qe, t.textContent = `@font-face {
784
+ t.id = st, t.textContent = `@font-face {
758
785
  font-family: "Architects Daughter";
759
786
  font-style: normal;
760
787
  font-weight: 400;
@@ -762,7 +789,7 @@ function qn(e) {
762
789
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
763
790
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
764
791
  }
765
- function jn({
792
+ function io({
766
793
  root: e,
767
794
  launcher: t,
768
795
  launcherDragHandle: n,
@@ -771,117 +798,117 @@ function jn({
771
798
  persist: i
772
799
  }) {
773
800
  let l = null, p = null, c = null, d = !1, s = null;
774
- const f = () => {
801
+ const b = () => {
775
802
  l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
776
- }, v = (h) => {
803
+ }, y = (h) => {
777
804
  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));
778
- }, x = (h) => {
805
+ }, S = (h) => {
779
806
  if (l !== h.pointerId || !p || !c)
780
807
  return;
781
808
  h.preventDefault();
782
- const P = h.clientX - p.x, E = h.clientY - p.y;
783
- !d && Math.hypot(P, E) < et || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + P, y: c.y + E }));
784
- }, S = (h) => {
785
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
786
- }, y = (h) => {
787
- l === h.pointerId && (h.preventDefault(), f());
788
- }, _ = (h) => {
809
+ const C = h.clientX - p.x, _ = h.clientY - p.y;
810
+ !d && Math.hypot(C, _) < dt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + C, y: c.y + _ }));
811
+ }, w = (h) => {
812
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), b());
813
+ }, I = (h) => {
814
+ l === h.pointerId && (h.preventDefault(), b());
815
+ }, v = (h) => {
789
816
  if (!s)
790
817
  return;
791
- const P = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= et;
792
- s = null, P && (h.preventDefault(), h.stopPropagation());
793
- }, g = (h) => {
818
+ const C = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= dt;
819
+ s = null, C && (h.preventDefault(), h.stopPropagation());
820
+ }, u = (h) => {
794
821
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
795
822
  return;
796
- const P = h.shiftKey ? $n : Gn, E = o();
797
- let m = null;
798
- h.key === "ArrowUp" ? m = { x: E.x, y: E.y - P } : h.key === "ArrowDown" ? m = { x: E.x, y: E.y + P } : h.key === "ArrowLeft" ? m = { x: E.x - P, y: E.y } : h.key === "ArrowRight" && (m = { x: E.x + P, y: E.y }), m && (h.preventDefault(), h.stopPropagation(), a(m), i());
823
+ const C = h.shiftKey ? eo : Qn, _ = o();
824
+ let N = null;
825
+ h.key === "ArrowUp" ? N = { x: _.x, y: _.y - C } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + C } : h.key === "ArrowLeft" ? N = { x: _.x - C, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + C, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
799
826
  };
800
- return t.addEventListener("pointerdown", v), t.addEventListener("pointermove", x), t.addEventListener("pointerup", S), t.addEventListener("pointercancel", y), t.addEventListener("click", _, !0), n.addEventListener("keydown", g), () => {
801
- t.removeEventListener("pointerdown", v), t.removeEventListener("pointermove", x), t.removeEventListener("pointerup", S), t.removeEventListener("pointercancel", y), t.removeEventListener("click", _, !0), n.removeEventListener("keydown", g);
827
+ return t.addEventListener("pointerdown", y), t.addEventListener("pointermove", S), t.addEventListener("pointerup", w), t.addEventListener("pointercancel", I), t.addEventListener("click", v, !0), n.addEventListener("keydown", u), () => {
828
+ t.removeEventListener("pointerdown", y), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", w), t.removeEventListener("pointercancel", I), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", u);
802
829
  };
803
830
  }
804
- function Te(e, t = !0) {
805
- const n = J(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
831
+ function ze(e, t = !0) {
832
+ const n = pe(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
806
833
  return {
807
- width: t && a && o.width > 0 ? o.width : Math.min(yt, n.width - 36),
808
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Tn : Ct
834
+ width: t && a && o.width > 0 ? o.width : Math.min(Dt, n.width - 36),
835
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Hn : It
809
836
  };
810
837
  }
811
- function kt() {
812
- const e = J();
838
+ function Ot() {
839
+ const e = pe();
813
840
  return {
814
841
  width: Math.min(
815
- Z(e.width * Mn, Dn, In),
816
- e.width - D * 2
842
+ le(e.width * jn, Wn, Vn),
843
+ e.width - B * 2
817
844
  ),
818
845
  height: Math.min(
819
- Z(e.height * Bn, Rn, On),
820
- e.height - Ne - D
846
+ le(e.height * Yn, qn, Kn),
847
+ e.height - Ue - B
821
848
  )
822
849
  };
823
850
  }
824
- function Kn(e, t, n) {
851
+ function ro(e, t, n) {
825
852
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
826
853
  if (Number.isFinite(o) && Number.isFinite(a))
827
854
  return { x: o, y: a };
828
855
  const i = e.getBoundingClientRect();
829
856
  if (i.width > 0 || i.height > 0)
830
857
  return { x: i.left, y: i.top };
831
- const l = J();
858
+ const l = pe();
832
859
  return {
833
860
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
834
861
  y: l.height - 24 - n.height
835
862
  };
836
863
  }
837
- function ot(e, t, n) {
838
- const o = J(), a = D + Yn(e);
864
+ function gt(e, t, n) {
865
+ const o = pe(), a = B + lo(e);
839
866
  return {
840
- x: Z(t.x, D, Math.max(D, o.width - n.width - D)),
841
- y: Z(t.y, a, Math.max(a, o.height - n.height - D))
867
+ x: le(t.x, B, Math.max(B, o.width - n.width - B)),
868
+ y: le(t.y, a, Math.max(a, o.height - n.height - B))
842
869
  };
843
870
  }
844
- function Yn(e) {
845
- return e.classList.contains("pluno-pa-widget--scribble") ? zn : Un;
871
+ function lo(e) {
872
+ return e.classList.contains("pluno-pa-widget--scribble") ? Jn : Zn;
846
873
  }
847
- function at(e, t, n) {
848
- const o = Te(e), a = kt(), i = {
874
+ function ht(e, t, n) {
875
+ const o = ze(e), a = Ot(), i = {
849
876
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
850
877
  y: t.y + o.height - a.height
851
878
  };
852
- return Xn(i);
879
+ return po(i);
853
880
  }
854
- function Xn(e) {
855
- const t = J(), n = kt();
881
+ function po(e) {
882
+ const t = pe(), n = Ot();
856
883
  return {
857
- x: Z(e.x, D, Math.max(D, t.width - n.width - D)),
858
- y: Z(
884
+ x: le(e.x, B, Math.max(B, t.width - n.width - B)),
885
+ y: le(
859
886
  e.y,
860
- Ne,
861
- Math.max(Ne, t.height - n.height - D)
887
+ Ue,
888
+ Math.max(Ue, t.height - n.height - B)
862
889
  )
863
890
  };
864
891
  }
865
- function pe(e, t) {
892
+ function we(e, t) {
866
893
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
867
894
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
868
895
  return;
869
896
  }
870
897
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
871
898
  }
872
- function Zn(e, t) {
899
+ function so(e, t) {
873
900
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
874
901
  }
875
- function Jn(e) {
902
+ function co(e) {
876
903
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
877
904
  }
878
- function J() {
905
+ function pe() {
879
906
  return {
880
- width: window.innerWidth || document.documentElement.clientWidth || yt + D * 2,
881
- height: window.innerHeight || document.documentElement.clientHeight || Ct + D * 2
907
+ width: window.innerWidth || document.documentElement.clientWidth || Dt + B * 2,
908
+ height: window.innerHeight || document.documentElement.clientHeight || It + B * 2
882
909
  };
883
910
  }
884
- function Ce(e) {
911
+ function De(e) {
885
912
  const t = e.getBoundingClientRect();
886
913
  return {
887
914
  x: Math.round(t.x),
@@ -890,10 +917,10 @@ function Ce(e) {
890
917
  height: Math.round(t.height)
891
918
  };
892
919
  }
893
- function Z(e, t, n) {
920
+ function le(e, t, n) {
894
921
  return Math.min(Math.max(e, t), n);
895
922
  }
896
- function V(e, t, n) {
923
+ function Q(e, t, n) {
897
924
  if (typeof window > "u")
898
925
  return;
899
926
  const o = window, a = {
@@ -902,44 +929,67 @@ function V(e, t, n) {
902
929
  message: t,
903
930
  details: n
904
931
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
905
- 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(Ln, { detail: a }));
932
+ 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(Un, { detail: a }));
906
933
  }
907
- function Qn(e, t) {
908
- V("web-sdk.widget.position", e, t);
934
+ function uo(e, t) {
935
+ Q("web-sdk.widget.position", e, t);
909
936
  }
910
- function Ee(e, t, n) {
937
+ function Ie(e, t, n) {
911
938
  const o = t.value.trim();
912
939
  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 })), []);
913
940
  }
914
- function oe(e) {
941
+ function ue(e) {
915
942
  e.style.height = "0px";
916
943
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
917
944
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
918
945
  }
919
- function eo(e, t, n, o) {
920
- e.appendChild(ro()), e.appendChild(to(t, n, o)), e.appendChild(At("pluno-pa-widget__close", "Close", lo(16), !0)), e.appendChild(no(n));
946
+ function ge(e, t = () => !0) {
947
+ e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
948
+ t() && (e.scrollTop = e.scrollHeight);
949
+ });
950
+ }
951
+ function go(e) {
952
+ const t = e.messages[e.messages.length - 1];
953
+ return [
954
+ e.messages.length,
955
+ t?.id ?? "",
956
+ t?.content.length ?? 0,
957
+ e.assistantDraft.length,
958
+ e.isThinking ? "thinking" : "idle",
959
+ e.lastError ?? ""
960
+ ].join(":");
961
+ }
962
+ function ho(e) {
963
+ return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
964
+ }
965
+ function mo(e, t, n, o) {
966
+ e.appendChild(vo()), e.appendChild(fo(t, n, o)), e.appendChild(Ut("pluno-pa-widget__close", "Close", yo(16), !0)), e.appendChild(bo(n));
921
967
  }
922
- function to(e, t, n) {
968
+ function fo(e, t, n) {
923
969
  const o = document.createElement("form");
924
970
  if (o.className = "pluno-pa-widget__launcher", n) {
925
971
  const i = document.createElement("button");
926
972
  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);
927
973
  }
928
- o.appendChild(Pt("pluno-pa-widget__character--launcher", t));
974
+ o.appendChild(Ft("pluno-pa-widget__character--launcher", t));
929
975
  const a = document.createElement("input");
930
976
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
931
977
  }
932
- function no(e) {
978
+ function bo(e) {
933
979
  const t = document.createElement("section");
934
980
  t.className = "pluno-pa-widget__panel", t.hidden = !0;
935
981
  const n = document.createElement("div");
936
982
  n.className = "pluno-pa-widget__timeline-wrap";
937
983
  const o = document.createElement("main");
938
- o.className = "pluno-pa-widget__timeline", o.appendChild(ao(e)), n.appendChild(o);
984
+ o.className = "pluno-pa-widget__timeline", o.appendChild(_o(e));
939
985
  const a = document.createElement("div");
940
- return a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a), n.appendChild(At("pluno-pa-widget__new-chat", "New chat", po(), !0)), t.appendChild(n), t.appendChild(oo()), t;
986
+ a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
987
+ const i = document.createElement("div");
988
+ i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
989
+ const l = document.createElement("button");
990
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ut("pluno-pa-widget__new-chat", "New chat", Co(), !0)), t.appendChild(n), t.appendChild(wo()), t;
941
991
  }
942
- function oo() {
992
+ function wo() {
943
993
  const e = document.createElement("form");
944
994
  e.className = "pluno-pa-widget__composer";
945
995
  const t = document.createElement("div");
@@ -953,7 +1003,7 @@ function oo() {
953
1003
  const i = document.createElement("textarea");
954
1004
  i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
955
1005
  const l = document.createElement("button");
956
- l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(Nt()), a.appendChild(l), e.appendChild(a);
1006
+ l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(zt()), a.appendChild(l), e.appendChild(a);
957
1007
  const p = document.createElement("div");
958
1008
  p.className = "pluno-pa-widget__composer-meta";
959
1009
  const c = document.createElement("a");
@@ -961,41 +1011,41 @@ function oo() {
961
1011
  const d = document.createElement("span");
962
1012
  return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(d), e.appendChild(p), e;
963
1013
  }
964
- function ao(e) {
1014
+ function _o(e) {
965
1015
  const t = document.createElement("div");
966
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(Pt("pluno-pa-widget__character--empty", e)), t.appendChild(Lt()), t;
1016
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ft("pluno-pa-widget__character--empty", e)), t.appendChild(Bt()), t;
967
1017
  }
968
- function Lt() {
1018
+ function Bt() {
969
1019
  const e = document.createElement("div");
970
1020
  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;
971
1021
  }
972
- function io(e, t) {
1022
+ function xo(e, t) {
973
1023
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
974
1024
  const n = document.createElement("span");
975
1025
  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`));
976
1026
  }
977
- function Pt(e, t) {
1027
+ function Ft(e, t) {
978
1028
  const n = document.createElement("img");
979
1029
  return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
980
1030
  }
981
- function At(e, t, n, o) {
1031
+ function Ut(e, t, n, o) {
982
1032
  const a = document.createElement("button");
983
1033
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
984
1034
  }
985
- function ro() {
986
- const e = L("svg", {
1035
+ function vo() {
1036
+ const e = P("svg", {
987
1037
  class: "pluno-pa-widget__scribble-defs",
988
1038
  "aria-hidden": "true",
989
1039
  focusable: "false",
990
1040
  width: "0",
991
1041
  height: "0"
992
- }), t = L("defs");
993
- return t.appendChild(Se("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Se("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Se("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1042
+ }), t = P("defs");
1043
+ return t.appendChild(Me("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Me("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Me("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
994
1044
  }
995
- function Se(e, t, n) {
996
- const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1045
+ function Me(e, t, n) {
1046
+ const o = P("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
997
1047
  return o.appendChild(
998
- L("feTurbulence", {
1048
+ P("feTurbulence", {
999
1049
  type: "fractalNoise",
1000
1050
  baseFrequency: "0.012 0.028",
1001
1051
  numOctaves: "3",
@@ -1003,7 +1053,7 @@ function Se(e, t, n) {
1003
1053
  result: "stroke-noise"
1004
1054
  })
1005
1055
  ), o.appendChild(
1006
- L("feDisplacementMap", {
1056
+ P("feDisplacementMap", {
1007
1057
  in: "SourceGraphic",
1008
1058
  in2: "stroke-noise",
1009
1059
  scale: "3.5",
@@ -1012,7 +1062,7 @@ function Se(e, t, n) {
1012
1062
  result: "warped"
1013
1063
  })
1014
1064
  ), o.appendChild(
1015
- L("feTurbulence", {
1065
+ P("feTurbulence", {
1016
1066
  type: "fractalNoise",
1017
1067
  baseFrequency: "0.7",
1018
1068
  numOctaves: "1",
@@ -1020,7 +1070,7 @@ function Se(e, t, n) {
1020
1070
  result: "ink-noise"
1021
1071
  })
1022
1072
  ), o.appendChild(
1023
- L("feDisplacementMap", {
1073
+ P("feDisplacementMap", {
1024
1074
  in: "warped",
1025
1075
  in2: "ink-noise",
1026
1076
  scale: "0.9",
@@ -1029,31 +1079,31 @@ function Se(e, t, n) {
1029
1079
  })
1030
1080
  ), o;
1031
1081
  }
1032
- function lo(e) {
1033
- const t = Q("0 0 24 24", e, e, "none", "currentColor", "2.25");
1034
- return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
1082
+ function yo(e) {
1083
+ const t = se("0 0 24 24", e, e, "none", "currentColor", "2.25");
1084
+ return t.appendChild(P("path", { d: "m6 9 6 6 6-6" })), t;
1035
1085
  }
1036
- function po() {
1037
- const e = Q("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1038
- 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;
1086
+ function Co() {
1087
+ const e = se("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1088
+ return e.appendChild(P("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(P("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1039
1089
  }
1040
- function Nt() {
1041
- const e = Q("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1042
- 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;
1090
+ function zt() {
1091
+ const e = se("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1092
+ return e.appendChild(P("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(P("polyline", { points: "5 12 12 5 19 12" })), e;
1043
1093
  }
1044
- function so() {
1045
- const e = Q("0 0 24 24", 18, 18, "currentColor");
1046
- return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1094
+ function Eo() {
1095
+ const e = se("0 0 24 24", 18, 18, "currentColor");
1096
+ return e.appendChild(P("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1047
1097
  }
1048
- function co() {
1049
- const e = Q("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1050
- return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
1098
+ function So() {
1099
+ const e = se("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1100
+ return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
1051
1101
  }
1052
- function uo() {
1053
- const e = Q("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1054
- 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;
1102
+ function ko() {
1103
+ const e = se("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1104
+ return e.appendChild(P("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(P("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1055
1105
  }
1056
- function Q(e, t, n, o, a, i) {
1106
+ function se(e, t, n, o, a, i) {
1057
1107
  const l = {
1058
1108
  viewBox: e,
1059
1109
  width: String(t),
@@ -1061,41 +1111,41 @@ function Q(e, t, n, o, a, i) {
1061
1111
  fill: o,
1062
1112
  "aria-hidden": "true"
1063
1113
  };
1064
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
1114
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), P("svg", l);
1065
1115
  }
1066
- function L(e, t = {}) {
1067
- const n = document.createElementNS(Fn, e);
1116
+ function P(e, t = {}) {
1117
+ const n = document.createElementNS(Xn, e);
1068
1118
  for (const [o, a] of Object.entries(t))
1069
1119
  n.setAttribute(o, a);
1070
1120
  return n;
1071
1121
  }
1072
- function it(e) {
1122
+ function mt(e) {
1073
1123
  for (const t of ["keydown", "keypress", "keyup"])
1074
1124
  e.addEventListener(t, (n) => {
1075
1125
  n.stopPropagation();
1076
1126
  });
1077
1127
  }
1078
- function go(e, t, n) {
1128
+ function Lo(e, t, n) {
1079
1129
  e.replaceChildren(), e.hidden = t.length === 0;
1080
1130
  for (const [o, a] of t.entries()) {
1081
1131
  const i = document.createElement("div");
1082
- i.className = "pluno-pa-widget__attachment", i.appendChild(ho(a));
1132
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Po(a));
1083
1133
  const l = document.createElement("span");
1084
1134
  l.textContent = a.name, i.appendChild(l);
1085
1135
  const p = document.createElement("button");
1086
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(co()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1136
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(So()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1087
1137
  }
1088
1138
  }
1089
- function ho(e) {
1090
- if (Tt(e)) {
1139
+ function Po(e) {
1140
+ if (Gt(e)) {
1091
1141
  const n = document.createElement("img");
1092
1142
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1093
1143
  }
1094
1144
  const t = document.createElement("span");
1095
1145
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1096
1146
  }
1097
- function mo(e) {
1098
- if (Tt(e)) {
1147
+ function Ao(e) {
1148
+ if (Gt(e)) {
1099
1149
  const a = document.createElement("img");
1100
1150
  return a.src = e.dataUrl, a.alt = e.name, a;
1101
1151
  }
@@ -1106,51 +1156,51 @@ function mo(e) {
1106
1156
  const o = document.createElement("strong");
1107
1157
  return o.textContent = e.name, t.append(n, o), t;
1108
1158
  }
1109
- function Tt(e) {
1159
+ function Gt(e) {
1110
1160
  return e.mimeType.startsWith("image/");
1111
1161
  }
1112
- function fo(e) {
1162
+ function To(e) {
1113
1163
  return e === "application/pdf" ? "document.pdf" : "image";
1114
1164
  }
1115
- async function bo(e) {
1165
+ async function No(e) {
1116
1166
  if (!e)
1117
1167
  return [];
1118
1168
  const t = Array.from(e);
1119
- if (t.length > ue)
1120
- throw new Error(`Attach up to ${ue} files per message.`);
1169
+ if (t.length > ye)
1170
+ throw new Error(`Attach up to ${ye} files per message.`);
1121
1171
  return Promise.all(
1122
1172
  t.map(async (n) => {
1123
- const o = wo(n);
1173
+ const o = Do(n);
1124
1174
  if (!o)
1125
1175
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1126
- if (n.size > Pn)
1176
+ if (n.size > zn)
1127
1177
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1128
1178
  if (o === "image/gif") {
1129
- const a = new Uint8Array(await Lo(n));
1130
- if (xo(a))
1179
+ const a = new Uint8Array(await Go(n));
1180
+ if (Mo(a))
1131
1181
  throw new Error("Pluno supports non-animated GIF images.");
1132
1182
  }
1133
1183
  return {
1134
- name: n.name || fo(o),
1184
+ name: n.name || To(o),
1135
1185
  mimeType: o,
1136
1186
  sizeBytes: n.size,
1137
- dataUrl: _o(await Po(n), o)
1187
+ dataUrl: Io(await $o(n), o)
1138
1188
  };
1139
1189
  })
1140
1190
  );
1141
1191
  }
1142
- function wo(e) {
1143
- if (An.has(e.type))
1192
+ function Do(e) {
1193
+ if (Gn.has(e.type))
1144
1194
  return e.type;
1145
1195
  const t = e.name.toLowerCase();
1146
1196
  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;
1147
1197
  }
1148
- function _o(e, t) {
1198
+ function Io(e, t) {
1149
1199
  const n = `data:${t};base64,`;
1150
1200
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1151
1201
  }
1152
- function xo(e) {
1153
- if (e.length < 14 || !vo(e))
1202
+ function Mo(e) {
1203
+ if (e.length < 14 || !Ro(e))
1154
1204
  return !1;
1155
1205
  const t = e[10];
1156
1206
  let n = 13;
@@ -1161,7 +1211,7 @@ function xo(e) {
1161
1211
  if (n += 1, a === 59)
1162
1212
  return !1;
1163
1213
  if (a === 33) {
1164
- n += 1, n = rt(e, n);
1214
+ n += 1, n = ft(e, n);
1165
1215
  continue;
1166
1216
  }
1167
1217
  if (a !== 44)
@@ -1173,14 +1223,14 @@ function xo(e) {
1173
1223
  const i = e[n + 8];
1174
1224
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1175
1225
  return !1;
1176
- n += 1, n = rt(e, n);
1226
+ n += 1, n = ft(e, n);
1177
1227
  }
1178
1228
  return !1;
1179
1229
  }
1180
- function vo(e) {
1230
+ function Ro(e) {
1181
1231
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1182
1232
  }
1183
- function rt(e, t) {
1233
+ function ft(e, t) {
1184
1234
  for (; t < e.length; ) {
1185
1235
  const n = e[t];
1186
1236
  if (t += 1, n === 0)
@@ -1189,69 +1239,69 @@ function rt(e, t) {
1189
1239
  }
1190
1240
  return t;
1191
1241
  }
1192
- function se(e) {
1242
+ function _e(e) {
1193
1243
  return !!(e && Array.from(e.types).includes("Files"));
1194
1244
  }
1195
- function ke(e, t, n = null) {
1196
- if (!e || !De(t, n)) {
1245
+ function Re(e, t, n = null) {
1246
+ if (!e || !Ge(t, n)) {
1197
1247
  e && (e.hidden = !0, e.replaceChildren());
1198
1248
  return;
1199
1249
  }
1200
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Re(n) ? e.appendChild(yo(t, n)) : Dt(t) && e.appendChild(Co(t));
1250
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", K(t) || We(n) ? e.appendChild(Oo(t, n)) : $t(t) && e.appendChild(Bo(t));
1201
1251
  }
1202
- function yo(e, t) {
1252
+ function Oo(e, t) {
1203
1253
  const n = document.createElement("div");
1204
1254
  n.className = "pluno-pa-widget__billing-action-card";
1205
1255
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1206
1256
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1207
1257
  const i = document.createElement("span");
1208
- 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(It(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1258
+ 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(Ht(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1209
1259
  }
1210
- function Co(e) {
1260
+ function Bo(e) {
1211
1261
  const t = document.createElement("div");
1212
1262
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1213
1263
  const n = document.createElement("strong");
1214
1264
  n.textContent = "Credits running low", t.appendChild(n);
1215
1265
  const o = document.createElement("span");
1216
- return o.textContent = So(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(It(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1266
+ return o.textContent = Uo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Ht(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1217
1267
  }
1218
- function De(e, t) {
1219
- return e !== null && ($(e) || Dt(e) || Re(t));
1268
+ function Ge(e, t) {
1269
+ return e !== null && (K(e) || $t(e) || We(t));
1220
1270
  }
1221
- function lt(e, t, n) {
1222
- return De(t, n) || Eo(t) ? !0 : !De(e, n);
1271
+ function bt(e, t, n) {
1272
+ return Ge(t, n) || Fo(t) ? !0 : !Ge(e, n);
1223
1273
  }
1224
- function Eo(e) {
1225
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
1274
+ function Fo(e) {
1275
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || K(e));
1226
1276
  }
1227
- function $(e) {
1277
+ function K(e) {
1228
1278
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1229
1279
  }
1230
- function Re(e) {
1280
+ function We(e) {
1231
1281
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1232
1282
  }
1233
- function Dt(e) {
1234
- return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1283
+ function $t(e) {
1284
+ return !K(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1235
1285
  }
1236
- function So(e) {
1237
- return e.creditsRemaining === null ? null : `${ko(e.creditsRemaining)} credits left`;
1286
+ function Uo(e) {
1287
+ return e.creditsRemaining === null ? null : `${zo(e.creditsRemaining)} credits left`;
1238
1288
  }
1239
- function ko(e) {
1289
+ function zo(e) {
1240
1290
  return new Intl.NumberFormat("en-US", {
1241
1291
  maximumFractionDigits: 0
1242
1292
  }).format(Math.ceil(e));
1243
1293
  }
1244
- function It(e, t, n) {
1294
+ function Ht(e, t, n) {
1245
1295
  const o = document.createElement("div");
1246
- return o.className = n, o.appendChild(pt(t, e.pricingUrl)), o.appendChild(pt("Earn credits", e.earnCreditsUrl)), o;
1296
+ return o.className = n, o.appendChild(wt(t, e.pricingUrl)), o.appendChild(wt("Earn credits", e.earnCreditsUrl)), o;
1247
1297
  }
1248
- function pt(e, t) {
1298
+ function wt(e, t) {
1249
1299
  const n = document.createElement("button");
1250
1300
  return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
1251
1301
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1252
1302
  }), n;
1253
1303
  }
1254
- function Lo(e) {
1304
+ function Go(e) {
1255
1305
  return new Promise((t, n) => {
1256
1306
  const o = new FileReader();
1257
1307
  o.addEventListener("load", () => {
@@ -1265,7 +1315,7 @@ function Lo(e) {
1265
1315
  }), o.readAsArrayBuffer(e);
1266
1316
  });
1267
1317
  }
1268
- function Po(e) {
1318
+ function $o(e) {
1269
1319
  return new Promise((t, n) => {
1270
1320
  const o = new FileReader();
1271
1321
  o.addEventListener("load", () => {
@@ -1279,94 +1329,94 @@ function Po(e) {
1279
1329
  }), o.readAsDataURL(e);
1280
1330
  });
1281
1331
  }
1282
- function st(e, t) {
1283
- return e.messages.filter((o) => !Mt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1332
+ function _t(e, t) {
1333
+ return e.messages.filter((o) => !Wt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1284
1334
  }
1285
- function Ao(e, t, n, o, a, i, l, p, c, d, s, f) {
1286
- const v = [...a.messages], x = v.filter((m) => !Mt(m));
1287
- e.replaceChildren(), Ot(t, a.isThinking), o.hidden = !l, l && i !== null && io(o, i);
1288
- const S = x.length > 0 || !!a.assistantDraft || a.isThinking;
1289
- if (n.hidden = !S, x.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
1335
+ function Ho(e, t, n, o, a, i, l, p, c, d, s, b, y, S, w) {
1336
+ const I = [...i.messages], v = I.filter((m) => !Wt(m)), u = e.scrollTop;
1337
+ e.replaceChildren(), jt(n, i.isThinking), a.hidden = !p, p && l !== null && xo(a, l);
1338
+ const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1339
+ if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1290
1340
  const m = document.createElement("div");
1291
1341
  m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1292
- const b = document.createElement("div");
1293
- b.className = "pluno-pa-widget__empty-hero";
1294
- const C = document.createElement("img");
1295
- C.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", C.src = d(), C.alt = "", C.setAttribute("aria-hidden", "true"), b.appendChild(C), m.appendChild(b), m.appendChild(Lt());
1296
- const k = document.createElement("div");
1297
- k.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true");
1298
- for (const I of a.starterPrompts) {
1299
- const R = document.createElement("button");
1300
- R.type = "button", R.className = "pluno-pa-widget__starter-prompt", R.textContent = `"${I}"`, R.addEventListener("click", () => {
1301
- s(I);
1302
- }), k.appendChild(R);
1303
- }
1304
- m.appendChild(k), e.appendChild(m);
1342
+ const x = document.createElement("div");
1343
+ x.className = "pluno-pa-widget__empty-hero";
1344
+ const M = document.createElement("img");
1345
+ M.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", M.src = y(), M.alt = "", M.setAttribute("aria-hidden", "true"), x.appendChild(M), m.appendChild(x), m.appendChild(Bt());
1346
+ const R = document.createElement("div");
1347
+ R.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 && R.setAttribute("aria-hidden", "true");
1348
+ for (const f of i.starterPrompts) {
1349
+ const A = document.createElement("button");
1350
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
1351
+ S(f);
1352
+ }), R.appendChild(A);
1353
+ }
1354
+ m.appendChild(R), e.appendChild(m), e.appendChild(t);
1305
1355
  return;
1306
1356
  }
1307
- let y = null, _ = null, g = [];
1308
- const h = () => {
1309
- if (g.length === 0)
1357
+ let C = null, _ = null, N = [];
1358
+ const k = () => {
1359
+ if (N.length === 0)
1310
1360
  return !1;
1311
- const m = Fo(g, p, c, d());
1312
- return e.appendChild(m), y = null, _ = m, g = [], !0;
1361
+ const m = Jo(N, s, b, y());
1362
+ return e.appendChild(m), C = null, _ = m, N = [], !0;
1313
1363
  };
1314
- for (let m = 0; m < x.length; m += 1) {
1315
- const b = x[m];
1316
- if (b.role === "tool") {
1317
- g.push(b);
1364
+ for (let m = 0; m < v.length; m += 1) {
1365
+ const x = v[m];
1366
+ if (x.role === "tool") {
1367
+ N.push(x);
1318
1368
  continue;
1319
1369
  }
1320
- if (b.role === "system")
1370
+ if (x.role === "system")
1321
1371
  continue;
1322
- const C = h(), k = ct(b.content);
1323
- if (b.role === "assistant" && !C) {
1324
- const w = Ie(d());
1325
- e.appendChild(w), y = null, _ = w;
1372
+ const M = k(), R = vt(x.content);
1373
+ if (x.role === "assistant" && !M) {
1374
+ const te = $e(y());
1375
+ e.appendChild(te), C = null, _ = te;
1326
1376
  }
1327
- const I = document.createElement("div");
1328
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${b.role}`, b.role === "assistant" ? ut(I, k) : I.textContent = k, b.role === "user" && b.attachments?.length && I.appendChild(To(b.attachments));
1329
- const R = document.createElement("div");
1330
- R.className = "pluno-pa-widget__message-actions", R.appendChild(dt(k)), I.appendChild(R), e.appendChild(I), y = I, _ = null;
1377
+ const f = document.createElement("div");
1378
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${x.role}`, x.role === "assistant" ? yt(f, R) : f.textContent = R, x.role === "user" && x.attachments?.length && f.appendChild(Vo(x.attachments));
1379
+ const A = document.createElement("div");
1380
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(xt(R)), f.appendChild(A), e.appendChild(f), C = f, _ = null;
1331
1381
  }
1332
- const P = h();
1333
- if (a.assistantDraft) {
1334
- if (!P) {
1335
- const k = Ie(d());
1336
- e.appendChild(k), y = null, _ = k;
1337
- }
1338
- const m = ct(a.assistantDraft), b = document.createElement("div");
1339
- b.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ut(b, m);
1340
- const C = document.createElement("div");
1341
- C.className = "pluno-pa-widget__message-actions", C.appendChild(dt(m)), b.appendChild(C), e.appendChild(b), y = b, _ = null;
1382
+ const ee = k();
1383
+ if (i.assistantDraft) {
1384
+ if (!ee) {
1385
+ const R = $e(y());
1386
+ e.appendChild(R), C = null, _ = R;
1387
+ }
1388
+ const m = vt(i.assistantDraft), x = document.createElement("div");
1389
+ x.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", yt(x, m);
1390
+ const M = document.createElement("div");
1391
+ M.className = "pluno-pa-widget__message-actions", M.appendChild(xt(m)), x.appendChild(M), e.appendChild(x), C = x, _ = null;
1342
1392
  }
1343
- if (a.isThinking && !a.assistantDraft)
1344
- if (P) {
1345
- const m = Rt();
1346
- e.appendChild(m), y = null, _ = m;
1393
+ if (i.isThinking && !i.assistantDraft)
1394
+ if (ee) {
1395
+ const m = Vt();
1396
+ e.appendChild(m), C = null, _ = m;
1347
1397
  } else {
1348
- const m = Uo(d());
1349
- e.appendChild(m), y = null, _ = m;
1398
+ const m = Qo(y());
1399
+ e.appendChild(m), C = null, _ = m;
1350
1400
  }
1351
- if (a.lastError) {
1401
+ if (i.lastError) {
1352
1402
  const m = document.createElement("div");
1353
- m.className = "pluno-pa-widget__error", m.textContent = a.lastError, e.appendChild(m), y = m, _ = null;
1403
+ m.className = "pluno-pa-widget__error", m.textContent = i.lastError, e.appendChild(m), C = m, _ = null;
1354
1404
  }
1355
- const E = f && !a.isThinking ? an(v) : null;
1356
- if (f && E && !f.dismissedCandidateIds.has(E.id)) {
1357
- const m = Do(E, {
1358
- isDrafting: f.draftingCandidateId === E.id,
1359
- error: f.error,
1360
- onDraft: f.onDraft,
1361
- onDismiss: f.onDismiss,
1362
- onDisable: f.onDisable
1405
+ const E = w && !i.isThinking ? bn(I) : null;
1406
+ if (w && E && !w.dismissedCandidateIds.has(E.id)) {
1407
+ const m = jo(E, {
1408
+ isDrafting: w.draftingCandidateId === E.id,
1409
+ error: w.error,
1410
+ onDraft: w.onDraft,
1411
+ onDismiss: w.onDismiss,
1412
+ onDisable: w.onDisable
1363
1413
  });
1364
- e.appendChild(m), f.onSeen(E), y = null, _ = m;
1414
+ e.appendChild(m), w.onSeen(E), C = null, _ = m;
1365
1415
  }
1366
- y?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.scrollTop = e.scrollHeight;
1416
+ C?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? ge(e, d) : e.scrollTop = u;
1367
1417
  }
1368
- function No(e, t, n, o, a, i) {
1369
- e.replaceChildren(), Ot(t, !1), t.disabled = !0, n.hidden = !0;
1418
+ function Wo(e, t, n, o, a, i) {
1419
+ e.replaceChildren(), jt(t, !1), t.disabled = !0, n.hidden = !0;
1370
1420
  const l = document.createElement("div");
1371
1421
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1372
1422
  const p = document.createElement("img");
@@ -1376,20 +1426,20 @@ function No(e, t, n, o, a, i) {
1376
1426
  const d = document.createElement("button");
1377
1427
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1378
1428
  }
1379
- function To(e) {
1429
+ function Vo(e) {
1380
1430
  const t = document.createElement("div");
1381
1431
  t.className = "pluno-pa-widget__message-attachments";
1382
1432
  for (const n of e)
1383
- t.appendChild(mo(n));
1433
+ t.appendChild(Ao(n));
1384
1434
  return t;
1385
1435
  }
1386
- function dt(e) {
1436
+ function xt(e) {
1387
1437
  const t = document.createElement("button");
1388
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(uo()), t.addEventListener("click", (n) => {
1438
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ko()), t.addEventListener("click", (n) => {
1389
1439
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1390
1440
  }), t;
1391
1441
  }
1392
- function Do(e, t) {
1442
+ function jo(e, t) {
1393
1443
  const n = document.createElement("article");
1394
1444
  n.className = "pluno-pa-widget__share-prompt";
1395
1445
  const o = document.createElement("div");
@@ -1411,24 +1461,24 @@ function Do(e, t) {
1411
1461
  const d = document.createElement("button");
1412
1462
  if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1413
1463
  t.onDraft(e);
1414
- }), t.isDrafting ? (d.appendChild(Me()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1464
+ }), t.isDrafting ? (d.appendChild(He()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1415
1465
  p.appendChild(c);
1416
1466
  else {
1417
1467
  const s = document.createElement("button");
1418
1468
  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", () => {
1419
1469
  t.onDismiss(e);
1420
1470
  }), c.appendChild(s), p.appendChild(c);
1421
- const f = document.createElement("button");
1422
- f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
1471
+ const b = document.createElement("button");
1472
+ b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1423
1473
  t.onDisable(e);
1424
- }), p.appendChild(f);
1474
+ }), p.appendChild(b);
1425
1475
  }
1426
1476
  return o.appendChild(p), n.appendChild(o), n;
1427
1477
  }
1428
- function Io(e, t) {
1478
+ function qo(e, t) {
1429
1479
  const n = document.createElement("div");
1430
- n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (_) => {
1431
- _.target === n && t.onClose();
1480
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1481
+ v.target === n && t.onClose();
1432
1482
  });
1433
1483
  const o = document.createElement("section");
1434
1484
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
@@ -1444,49 +1494,49 @@ function Io(e, t) {
1444
1494
  d.className = "pluno-pa-widget__share-dialog-step-header";
1445
1495
  const s = document.createElement("strong");
1446
1496
  s.textContent = "1) Copy Screenshot", d.appendChild(s);
1447
- const f = Mo("Copy Screenshot", async () => {
1497
+ const b = Ko("Copy Screenshot", async () => {
1448
1498
  try {
1449
- return await rn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1499
+ return await wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1450
1500
  } catch {
1451
1501
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1452
1502
  }
1453
1503
  });
1454
- if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
1455
- const _ = document.createElement("div");
1456
- _.className = "pluno-pa-widget__share-dialog-screenshot";
1457
- const g = document.createElement("img");
1458
- g.src = e.screenshotDataUrl, g.alt = "Product page with Pluno open", _.appendChild(g), c.appendChild(_);
1504
+ if (d.appendChild(b), c.appendChild(d), e.screenshotDataUrl) {
1505
+ const v = document.createElement("div");
1506
+ v.className = "pluno-pa-widget__share-dialog-screenshot";
1507
+ const u = document.createElement("img");
1508
+ u.src = e.screenshotDataUrl, u.alt = "Product page with Pluno open", v.appendChild(u), c.appendChild(v);
1459
1509
  }
1460
1510
  o.appendChild(c), o.appendChild(p);
1461
- const v = document.createElement("div");
1462
- v.className = "pluno-pa-widget__share-dialog-step";
1463
- const x = document.createElement("strong");
1464
- x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", v.appendChild(x);
1465
- const S = document.createElement("p");
1466
- S.className = "pluno-pa-widget__share-dialog-hint", S.textContent = "Post draft opens prefilled on supported platforms.", v.appendChild(S);
1467
- const y = document.createElement("footer");
1468
- y.className = "pluno-pa-widget__share-dialog-platforms";
1469
- for (const _ of Ro(e)) {
1470
- const g = document.createElement("a");
1471
- g.href = _.href, g.target = "_blank", g.rel = "noopener noreferrer", g.title = _.label, g.setAttribute("aria-label", `Open ${_.label}`), g.appendChild(Oo(_.id)), y.appendChild(g);
1511
+ const y = document.createElement("div");
1512
+ y.className = "pluno-pa-widget__share-dialog-step";
1513
+ const S = document.createElement("strong");
1514
+ S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", y.appendChild(S);
1515
+ const w = document.createElement("p");
1516
+ w.className = "pluno-pa-widget__share-dialog-hint", w.textContent = "Post draft opens prefilled on supported platforms.", y.appendChild(w);
1517
+ const I = document.createElement("footer");
1518
+ I.className = "pluno-pa-widget__share-dialog-platforms";
1519
+ for (const v of Yo(e)) {
1520
+ const u = document.createElement("a");
1521
+ u.href = v.href, u.target = "_blank", u.rel = "noopener noreferrer", u.title = v.label, u.setAttribute("aria-label", `Open ${v.label}`), u.appendChild(Xo(v.id)), I.appendChild(u);
1472
1522
  }
1473
- if (v.appendChild(y), o.appendChild(v), t.socialPostRewardsUrl) {
1474
- const _ = document.createElement("div");
1475
- _.className = "pluno-pa-widget__share-dialog-step";
1476
- const g = document.createElement("strong");
1477
- g.className = "pluno-pa-widget__share-dialog-step-title", g.textContent = "3) Submit post to get 2000 free credits!", _.appendChild(g);
1523
+ if (y.appendChild(I), o.appendChild(y), t.socialPostRewardsUrl) {
1524
+ const v = document.createElement("div");
1525
+ v.className = "pluno-pa-widget__share-dialog-step";
1526
+ const u = document.createElement("strong");
1527
+ u.className = "pluno-pa-widget__share-dialog-step-title", u.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(u);
1478
1528
  const h = document.createElement("a");
1479
- 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(Bo()), _.appendChild(h), o.appendChild(_);
1529
+ 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(Zo()), v.appendChild(h), o.appendChild(v);
1480
1530
  }
1481
1531
  return n.appendChild(o), n;
1482
1532
  }
1483
- function Mo(e, t) {
1533
+ function Ko(e, t) {
1484
1534
  const n = document.createElement("button");
1485
1535
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1486
1536
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1487
1537
  }), n;
1488
1538
  }
1489
- function Ro(e) {
1539
+ function Yo(e) {
1490
1540
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1491
1541
  return [
1492
1542
  {
@@ -1506,60 +1556,60 @@ function Ro(e) {
1506
1556
  }
1507
1557
  ];
1508
1558
  }
1509
- function Oo(e) {
1559
+ function Xo(e) {
1510
1560
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1511
- 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" ? (N(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), N(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"), N(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), N(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"), N(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (N(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), N(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), N(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (N(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"), N(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"), N(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"), N(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);
1561
+ 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" ? (T(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), T(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"), T(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), T(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"), T(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (T(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), T(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), T(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (T(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"), T(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"), T(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"), T(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);
1512
1562
  }
1513
- function N(e, t, n) {
1563
+ function T(e, t, n) {
1514
1564
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1515
1565
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1516
1566
  }
1517
- function Bo() {
1567
+ function Zo() {
1518
1568
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1519
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), N(e, "M14 5h5v5"), N(e, "M19 5l-8 8"), N(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1569
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), T(e, "M14 5h5v5"), T(e, "M19 5l-8 8"), T(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1520
1570
  }
1521
- function Mt(e) {
1522
- return e.role === "tool" && e.toolName === _t;
1571
+ function Wt(e) {
1572
+ return e.role === "tool" && e.toolName === At;
1523
1573
  }
1524
- function ct(e) {
1574
+ function vt(e) {
1525
1575
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1526
1576
  }
1527
- function Fo(e, t, n, o) {
1577
+ function Jo(e, t, n, o) {
1528
1578
  const a = document.createElement("article");
1529
1579
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
1530
1580
  const i = document.createElement("img");
1531
1581
  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);
1532
- const l = document.createElement("details"), p = zo(e);
1582
+ const l = document.createElement("details"), p = ea(e);
1533
1583
  l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
1534
1584
  a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
1535
1585
  });
1536
1586
  const c = document.createElement("summary");
1537
- c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(Me());
1587
+ c.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && c.appendChild(He());
1538
1588
  const s = document.createElement("span");
1539
1589
  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) {
1540
- const f = document.createElement("div");
1541
- f.className = "pluno-pa-widget__tool-lines";
1542
- for (const v of e) {
1543
- const x = document.createElement("div");
1544
- x.className = "pluno-pa-widget__tool-line", v.loading && x.appendChild(Me());
1545
- const S = document.createElement("span");
1546
- S.textContent = v.content || "Run tool", x.appendChild(S), f.appendChild(x);
1547
- }
1548
- l.appendChild(f);
1590
+ const b = document.createElement("div");
1591
+ b.className = "pluno-pa-widget__tool-lines";
1592
+ for (const y of e) {
1593
+ const S = document.createElement("div");
1594
+ S.className = "pluno-pa-widget__tool-line", y.loading && S.appendChild(He());
1595
+ const w = document.createElement("span");
1596
+ w.textContent = y.content || "Run tool", S.appendChild(w), b.appendChild(S);
1597
+ }
1598
+ l.appendChild(b);
1549
1599
  }
1550
1600
  return a.appendChild(l), a;
1551
1601
  }
1552
- function Ie(e) {
1602
+ function $e(e) {
1553
1603
  const t = document.createElement("article");
1554
1604
  t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1555
1605
  const n = document.createElement("img");
1556
1606
  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;
1557
1607
  }
1558
- function Uo(e) {
1559
- const t = Ie(e);
1560
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Rt()), t;
1608
+ function Qo(e) {
1609
+ const t = $e(e);
1610
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Vt()), t;
1561
1611
  }
1562
- function Rt() {
1612
+ function Vt() {
1563
1613
  const e = document.createElement("div");
1564
1614
  e.className = "pluno-pa-widget__status";
1565
1615
  const t = document.createElement("span");
@@ -1567,17 +1617,17 @@ function Rt() {
1567
1617
  const n = document.createElement("span");
1568
1618
  return n.textContent = "Thinking...", e.appendChild(n), e;
1569
1619
  }
1570
- function zo(e) {
1620
+ function ea(e) {
1571
1621
  return `tools:${e[0]?.id ?? ""}`;
1572
1622
  }
1573
- function Me() {
1623
+ function He() {
1574
1624
  const e = document.createElement("span");
1575
1625
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1576
1626
  }
1577
- function Ot(e, t) {
1578
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? so() : Nt());
1627
+ function jt(e, t) {
1628
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Eo() : zt());
1579
1629
  }
1580
- function ut(e, t) {
1630
+ function yt(e, t) {
1581
1631
  const n = t.replace(/\r\n/g, `
1582
1632
  `).split(`
1583
1633
  `);
@@ -1593,22 +1643,22 @@ function ut(e, t) {
1593
1643
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1594
1644
  d.push(n[o]), o += 1;
1595
1645
  o += o < n.length ? 1 : 0;
1596
- const s = document.createElement("pre"), f = document.createElement("code");
1597
- f.textContent = d.join(`
1598
- `), s.appendChild(f), e.appendChild(s);
1646
+ const s = document.createElement("pre"), b = document.createElement("code");
1647
+ b.textContent = d.join(`
1648
+ `), s.appendChild(b), e.appendChild(s);
1599
1649
  continue;
1600
1650
  }
1601
1651
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1602
1652
  if (l) {
1603
1653
  const d = document.createElement(`h${l[1].length + 2}`);
1604
- de(d, l[2]), e.appendChild(d), o += 1;
1654
+ xe(d, l[2]), e.appendChild(d), o += 1;
1605
1655
  continue;
1606
1656
  }
1607
1657
  if (/^\s*[-*+]\s+/.test(a)) {
1608
1658
  const d = document.createElement("ul");
1609
1659
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1610
1660
  const s = document.createElement("li");
1611
- de(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1661
+ xe(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1612
1662
  }
1613
1663
  e.appendChild(d);
1614
1664
  continue;
@@ -1617,7 +1667,7 @@ function ut(e, t) {
1617
1667
  const d = document.createElement("ol");
1618
1668
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1619
1669
  const s = document.createElement("li");
1620
- de(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1670
+ xe(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1621
1671
  }
1622
1672
  e.appendChild(d);
1623
1673
  continue;
@@ -1627,11 +1677,11 @@ function ut(e, t) {
1627
1677
  p.push(n[o]), o += 1;
1628
1678
  const c = document.createElement("p");
1629
1679
  p.forEach((d, s) => {
1630
- s > 0 && c.appendChild(document.createElement("br")), de(c, d);
1680
+ s > 0 && c.appendChild(document.createElement("br")), xe(c, d);
1631
1681
  }), e.appendChild(c);
1632
1682
  }
1633
1683
  }
1634
- function de(e, t) {
1684
+ function xe(e, t) {
1635
1685
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1636
1686
  let o = 0;
1637
1687
  for (const a of t.matchAll(n)) {
@@ -1649,7 +1699,7 @@ function de(e, t) {
1649
1699
  p.textContent = l.slice(1, -1), e.appendChild(p);
1650
1700
  } else {
1651
1701
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1652
- if (p && Go(p[2])) {
1702
+ if (p && ta(p[2])) {
1653
1703
  const c = document.createElement("a");
1654
1704
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
1655
1705
  } else
@@ -1659,7 +1709,7 @@ function de(e, t) {
1659
1709
  }
1660
1710
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1661
1711
  }
1662
- function Go(e) {
1712
+ function ta(e) {
1663
1713
  if (e.startsWith("/") || e.startsWith("#"))
1664
1714
  return !0;
1665
1715
  try {
@@ -1669,8 +1719,8 @@ function Go(e) {
1669
1719
  return !1;
1670
1720
  }
1671
1721
  }
1672
- function gt(e, t) {
1673
- if ($o(e))
1722
+ function Ct(e, t) {
1723
+ if (na(e))
1674
1724
  return;
1675
1725
  const n = `
1676
1726
  :host {
@@ -1723,7 +1773,7 @@ function gt(e, t) {
1723
1773
  --pluno-pa-accent-contrast: #fafafa;
1724
1774
  position: fixed;
1725
1775
  z-index: 2147483645;
1726
- font-family: ${U.fontFamily};
1776
+ font-family: ${W.fontFamily};
1727
1777
  font-size: 14px;
1728
1778
  color: var(--pluno-pa-text);
1729
1779
  width: var(--pluno-pa-launcher-width);
@@ -1978,6 +2028,41 @@ function gt(e, t) {
1978
2028
  scrollbar-color: var(--pluno-pa-divider) transparent;
1979
2029
  scrollbar-width: thin;
1980
2030
  }
2031
+ .pluno-pa-widget__timeline-bottom-sentinel {
2032
+ flex: 0 0 1px;
2033
+ height: 1px;
2034
+ pointer-events: none;
2035
+ }
2036
+ .pluno-pa-widget__timeline-jump {
2037
+ position: absolute;
2038
+ left: 50%;
2039
+ bottom: 16px;
2040
+ z-index: 3;
2041
+ transform: translateX(-50%);
2042
+ border: 1px solid color-mix(in srgb, var(--pluno-pa-accent) 34%, var(--pluno-pa-divider));
2043
+ border-radius: 999px;
2044
+ background: color-mix(in srgb, var(--pluno-pa-bg) 94%, transparent);
2045
+ color: var(--pluno-pa-text);
2046
+ box-shadow: 0 8px 18px rgba(24, 24, 27, 0.12);
2047
+ cursor: pointer;
2048
+ font: inherit;
2049
+ font-size: 12px;
2050
+ font-weight: 600;
2051
+ line-height: 1;
2052
+ padding: 8px 12px;
2053
+ transition:
2054
+ background 120ms ease,
2055
+ transform 120ms ease,
2056
+ box-shadow 120ms ease;
2057
+ }
2058
+ .pluno-pa-widget__timeline-jump:hover {
2059
+ background: var(--pluno-pa-surface);
2060
+ box-shadow: 0 10px 22px rgba(24, 24, 27, 0.14);
2061
+ transform: translateX(-50%) translateY(-1px);
2062
+ }
2063
+ .pluno-pa-widget__timeline-jump:active {
2064
+ transform: translateX(-50%) scale(0.98);
2065
+ }
1981
2066
  .pluno-pa-widget__new-chat {
1982
2067
  position: absolute;
1983
2068
  right: 14px;
@@ -2429,7 +2514,7 @@ function gt(e, t) {
2429
2514
  place-items: center;
2430
2515
  padding: 18px;
2431
2516
  background: rgba(24, 24, 27, 0.28);
2432
- font-family: var(--pluno-pa-font, ${U.fontFamily});
2517
+ font-family: var(--pluno-pa-font, ${W.fontFamily});
2433
2518
  color: var(--pluno-pa-text);
2434
2519
  }
2435
2520
  .pluno-pa-widget__share-dialog {
@@ -3098,7 +3183,7 @@ function gt(e, t) {
3098
3183
  right: 16px;
3099
3184
  height: 36px;
3100
3185
  z-index: 3;
3101
- background-image: url('${Je}');
3186
+ background-image: url('${pt}');
3102
3187
  background-repeat: repeat-x;
3103
3188
  background-size: 104px 36px;
3104
3189
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3351,7 +3436,7 @@ function gt(e, t) {
3351
3436
  right: 12px;
3352
3437
  height: 22px;
3353
3438
  z-index: 1;
3354
- background-image: url('${Je}');
3439
+ background-image: url('${pt}');
3355
3440
  background-repeat: repeat-x;
3356
3441
  background-size: 62px 21.5px;
3357
3442
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3364,28 +3449,28 @@ function gt(e, t) {
3364
3449
  filter: url(#pluno-pa-scribble-wobble-2);
3365
3450
  }
3366
3451
  `;
3367
- if (Ho(e, n))
3452
+ if (oa(e, n))
3368
3453
  return;
3369
3454
  const o = e.ownerDocument.createElement("style");
3370
- o.id = Et, o.textContent = n, e.appendChild(o), Bt(e);
3455
+ o.id = Mt, o.textContent = n, e.appendChild(o), qt(e);
3371
3456
  }
3372
- function $o(e) {
3373
- return e.getElementById(Et) !== null || e.host instanceof HTMLElement && e.host.getAttribute(St) === "true";
3457
+ function na(e) {
3458
+ return e.getElementById(Mt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Rt) === "true";
3374
3459
  }
3375
- function Bt(e) {
3376
- e.host instanceof HTMLElement && e.host.setAttribute(St, "true");
3460
+ function qt(e) {
3461
+ e.host instanceof HTMLElement && e.host.setAttribute(Rt, "true");
3377
3462
  }
3378
- function Ho(e, t) {
3463
+ function oa(e, t) {
3379
3464
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3380
3465
  return !1;
3381
3466
  try {
3382
3467
  const n = new CSSStyleSheet();
3383
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Bt(e), !0;
3468
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], qt(e), !0;
3384
3469
  } catch {
3385
3470
  return !1;
3386
3471
  }
3387
3472
  }
3388
- async function Wo() {
3473
+ async function aa() {
3389
3474
  return document.body ? document.body : await new Promise((e) => {
3390
3475
  const t = new MutationObserver(() => {
3391
3476
  document.body && (t.disconnect(), e(document.body));
@@ -3393,49 +3478,49 @@ async function Wo() {
3393
3478
  t.observe(document.documentElement, { childList: !0 });
3394
3479
  });
3395
3480
  }
3396
- function Ft(e) {
3481
+ function Kt(e) {
3397
3482
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3398
3483
  }
3399
- function Vo(e) {
3484
+ function ia(e) {
3400
3485
  try {
3401
- const t = window.localStorage.getItem(Ft(e));
3486
+ const t = window.localStorage.getItem(Kt(e));
3402
3487
  if (!t)
3403
- return ht();
3488
+ return Et();
3404
3489
  const n = JSON.parse(t);
3405
3490
  return {
3406
3491
  isOpen: n.isOpen === !0,
3407
3492
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3408
3493
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3409
- launcherPosition: Yo(n.launcherPosition) ? n.launcherPosition : null,
3410
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-xt) : [],
3494
+ launcherPosition: sa(n.launcherPosition) ? n.launcherPosition : null,
3495
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Tt) : [],
3411
3496
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3412
3497
  };
3413
3498
  } catch {
3414
- return ht();
3499
+ return Et();
3415
3500
  }
3416
3501
  }
3417
- async function qo(e) {
3502
+ async function ra(e) {
3418
3503
  if (e.loadSharePromptsDisabled)
3419
3504
  return e.loadSharePromptsDisabled();
3420
3505
  try {
3421
- return window.localStorage.getItem(vt) === "true";
3506
+ return window.localStorage.getItem(Nt) === "true";
3422
3507
  } catch {
3423
3508
  return !1;
3424
3509
  }
3425
3510
  }
3426
- function jo(e, t) {
3511
+ function la(e, t) {
3427
3512
  if (e.persistSharePromptsDisabled) {
3428
3513
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3429
3514
  });
3430
3515
  return;
3431
3516
  }
3432
3517
  try {
3433
- t && window.localStorage.setItem(vt, "true");
3518
+ t && window.localStorage.setItem(Nt, "true");
3434
3519
  } catch {
3435
3520
  return;
3436
3521
  }
3437
3522
  }
3438
- function ht() {
3523
+ function Et() {
3439
3524
  return {
3440
3525
  isOpen: !1,
3441
3526
  composerValue: "",
@@ -3445,43 +3530,43 @@ function ht() {
3445
3530
  sharePromptsDisabled: !1
3446
3531
  };
3447
3532
  }
3448
- function Ko(e, t) {
3533
+ function pa(e, t) {
3449
3534
  try {
3450
- window.localStorage.setItem(Ft(e), JSON.stringify(t));
3535
+ window.localStorage.setItem(Kt(e), JSON.stringify(t));
3451
3536
  } catch {
3452
3537
  return;
3453
3538
  }
3454
3539
  }
3455
- function Yo(e) {
3540
+ function sa(e) {
3456
3541
  if (!e || typeof e != "object")
3457
3542
  return !1;
3458
3543
  const t = e;
3459
3544
  return Number.isFinite(t.x) && Number.isFinite(t.y);
3460
3545
  }
3461
- const mt = /* @__PURE__ */ new WeakSet();
3462
- function Xo(e) {
3546
+ const St = /* @__PURE__ */ new WeakSet();
3547
+ function da(e) {
3463
3548
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3464
3549
  }
3465
- function ft(e) {
3550
+ function kt(e) {
3466
3551
  const t = e.pathname.split("/");
3467
3552
  return t[t.length - 1] ?? "";
3468
3553
  }
3469
- function Zo(e, t) {
3554
+ function ca(e, t) {
3470
3555
  const n = new URL(e.src, document.baseURI);
3471
- return n.href === t.href || n.pathname === t.pathname ? !0 : ft(n) === ft(t);
3556
+ return n.href === t.href || n.pathname === t.pathname ? !0 : kt(n) === kt(t);
3472
3557
  }
3473
- class z extends EventTarget {
3558
+ class V extends EventTarget {
3474
3559
  constructor(t, n) {
3475
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Cn, () => {
3476
- this.readyState = z.OPEN, this.dispatchEvent(new Event("open"));
3477
- }), this.addPreviewListener(En, (o) => {
3560
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Rn, () => {
3561
+ this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3562
+ }), this.addPreviewListener(On, (o) => {
3478
3563
  const a = o;
3479
3564
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3480
- }), this.addPreviewListener(Sn, () => {
3481
- this.readyState = z.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3482
- }), this.addPreviewListener(kn, (o) => {
3565
+ }), this.addPreviewListener(Bn, () => {
3566
+ this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3567
+ }), this.addPreviewListener(Fn, (o) => {
3483
3568
  const a = o;
3484
- this.readyState = z.CLOSED, this.dispatchEvent(
3569
+ this.readyState = V.CLOSED, this.dispatchEvent(
3485
3570
  new CloseEvent("close", {
3486
3571
  code: a.detail?.code ?? 1e3,
3487
3572
  reason: a.detail?.reason ?? "",
@@ -3489,7 +3574,7 @@ class z extends EventTarget {
3489
3574
  })
3490
3575
  ), this.cleanup();
3491
3576
  }), window.dispatchEvent(
3492
- new CustomEvent(ce(xn, this.channelId), {
3577
+ new CustomEvent(ve(Dn, this.channelId), {
3493
3578
  detail: { socketId: this.socketId, url: t }
3494
3579
  })
3495
3580
  );
@@ -3504,27 +3589,27 @@ class z extends EventTarget {
3504
3589
  extensions = "";
3505
3590
  binaryType = "blob";
3506
3591
  bufferedAmount = 0;
3507
- readyState = z.CONNECTING;
3508
- socketId = Jo();
3592
+ readyState = V.CONNECTING;
3593
+ socketId = ua();
3509
3594
  listeners = /* @__PURE__ */ new Map();
3510
3595
  send(t) {
3511
- if (this.readyState !== z.OPEN)
3596
+ if (this.readyState !== V.OPEN)
3512
3597
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3513
3598
  window.dispatchEvent(
3514
- new CustomEvent(ce(vn, this.channelId), {
3599
+ new CustomEvent(ve(In, this.channelId), {
3515
3600
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3516
3601
  })
3517
3602
  );
3518
3603
  }
3519
3604
  close(t, n) {
3520
- this.readyState !== z.CLOSED && (this.readyState = z.CLOSING, window.dispatchEvent(
3521
- new CustomEvent(ce(yn, this.channelId), {
3605
+ this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3606
+ new CustomEvent(ve(Mn, this.channelId), {
3522
3607
  detail: { socketId: this.socketId, code: t, reason: n }
3523
3608
  })
3524
3609
  ), this.cleanup());
3525
3610
  }
3526
3611
  addPreviewListener(t, n) {
3527
- const o = ce(t, this.channelId), a = (i) => {
3612
+ const o = ve(t, this.channelId), a = (i) => {
3528
3613
  i.detail?.socketId === this.socketId && n(i);
3529
3614
  };
3530
3615
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3535,36 +3620,36 @@ class z extends EventTarget {
3535
3620
  this.listeners.clear();
3536
3621
  }
3537
3622
  }
3538
- function Jo() {
3539
- const e = window.sessionStorage.getItem(Ze);
3623
+ function ua() {
3624
+ const e = window.sessionStorage.getItem(lt);
3540
3625
  if (e)
3541
3626
  return e;
3542
3627
  const t = crypto.randomUUID();
3543
- return window.sessionStorage.setItem(Ze, t), t;
3628
+ return window.sessionStorage.setItem(lt, t), t;
3544
3629
  }
3545
- function ce(e, t) {
3630
+ function ve(e, t) {
3546
3631
  return `${e}:${t}`;
3547
3632
  }
3548
- function Qo(e) {
3633
+ function ga(e) {
3549
3634
  const t = document.currentScript;
3550
3635
  if (t instanceof HTMLScriptElement)
3551
3636
  return [t];
3552
3637
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3553
3638
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3554
- (a) => a instanceof HTMLScriptElement && Xo(a) && Zo(a, o)
3639
+ (a) => a instanceof HTMLScriptElement && da(a) && ca(a, o)
3555
3640
  );
3556
3641
  }
3557
- function ea(e) {
3558
- for (const t of Qo(e)) {
3559
- if (mt.has(t) || t.dataset.plunoAutoMount === "false")
3642
+ function ha(e) {
3643
+ for (const t of ga(e)) {
3644
+ if (St.has(t) || t.dataset.plunoAutoMount === "false")
3560
3645
  continue;
3561
- mt.add(t);
3646
+ St.add(t);
3562
3647
  const n = t.dataset.plunoPreviewChannel;
3563
- Vn({
3648
+ oo({
3564
3649
  token: t.dataset.plunoToken,
3565
3650
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3566
3651
  backendUrl: t.dataset.plunoBackendUrl,
3567
- webSocketFactory: n ? Wn(n) : void 0,
3652
+ webSocketFactory: n ? no(n) : void 0,
3568
3653
  launcherLabel: t.dataset.plunoLauncherLabel,
3569
3654
  accentColor: t.dataset.plunoAccentColor,
3570
3655
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3576,8 +3661,8 @@ function ea(e) {
3576
3661
  });
3577
3662
  }
3578
3663
  }
3579
- ea(import.meta.url);
3664
+ ha(import.meta.url);
3580
3665
  export {
3581
- Wn as createProductAgentPreviewBridgeWebSocketFactory,
3582
- Vn as mountPlunoProductAgentWidget
3666
+ no as createProductAgentPreviewBridgeWebSocketFactory,
3667
+ oo as mountPlunoProductAgentWidget
3583
3668
  };