@pluno/product-agent-web 0.1.36 → 0.1.38

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