@pluno/product-agent-web 0.1.41 → 0.1.45

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,26 +1,26 @@
1
- import { PlunoProductAgent as yn } from "./product-agent-sdk.js";
2
- const Cn = "#7c3aed", Ae = "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", Pe = "#2c2a1e", gt = [253, 250, 241], ht = 3.5;
3
- function Wt(e) {
4
- const t = Ht(e);
5
- if (mt(we(t), gt) >= ht)
1
+ import { PlunoProductAgent as Mn } from "./product-agent-sdk.js";
2
+ const Bn = "#7c3aed", Oe = "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", Ue = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
3
+ function Qt(e) {
4
+ const t = en(e);
5
+ if (kt(ke(t), Et) >= St)
6
6
  return t;
7
- let o = we(t);
8
- const a = we(Pe);
7
+ let o = ke(t);
8
+ const a = ke(Ue);
9
9
  for (let i = 0; i < 6; i += 1)
10
- if (o = kn(o, a, 0.22), mt(o, gt) >= ht)
11
- return qe(o);
12
- return qe(o);
10
+ if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
11
+ return tt(o);
12
+ return tt(o);
13
13
  }
14
- function En() {
14
+ function On() {
15
15
  let n = "M 280 120", o = !1, a = 0;
16
16
  for (let i = 150; i <= 1170; i += 62) {
17
- const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
18
- n += ` L ${s} ${i}`, o = !o, a += 1;
17
+ const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${i}`, o = !o, a += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function Sn(e) {
23
- const t = Ht(e), n = je(we(t));
22
+ function Un(e) {
23
+ const t = en(e), n = nt(ke(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,90 +44,90 @@ function Sn(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: $(t, 0.28, -0.03),
48
- middle: $(t, 0.08, 0.04),
49
- bottom: $(t, -0.1, 0.02),
50
- edgeStart: $(t, 0.08, 0.08),
51
- edgeMiddle: $(t, -0.08, 0.08),
52
- edgeEnd: $(t, -0.18, 0.05),
53
- glow: $(t, 0.32, -0.12),
54
- highlight: $(t, 0.38, -0.18),
55
- inner: $(t, 0.24, -0.1),
56
- shadow: $(t, -0.25, -0.08)
47
+ top: V(t, 0.28, -0.03),
48
+ middle: V(t, 0.08, 0.04),
49
+ bottom: V(t, -0.1, 0.02),
50
+ edgeStart: V(t, 0.08, 0.08),
51
+ edgeMiddle: V(t, -0.08, 0.08),
52
+ edgeEnd: V(t, -0.18, 0.05),
53
+ glow: V(t, 0.32, -0.12),
54
+ highlight: V(t, 0.38, -0.18),
55
+ inner: V(t, 0.24, -0.1),
56
+ shadow: V(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Ht(e) {
59
+ function en(e) {
60
60
  const t = e.trim();
61
- 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;
61
+ 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()}` : Bn;
62
62
  }
63
- function we(e) {
63
+ function ke(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function qe([e, t, n]) {
70
+ function tt([e, t, n]) {
71
71
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function je([e, t, n]) {
74
+ function nt([e, t, n]) {
75
75
  const o = (a) => {
76
76
  const i = a / 255;
77
77
  return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function mt(e, t) {
82
- const n = je(e), o = je(t), [a, i] = n > o ? [n, o] : [o, n];
81
+ function kt(e, t) {
82
+ const n = nt(e), o = nt(t), [a, i] = n > o ? [n, o] : [o, n];
83
83
  return (a + 0.05) / (i + 0.05);
84
84
  }
85
- function kn(e, t, n) {
86
- const o = Ve(n);
85
+ function Fn(e, t, n) {
86
+ const o = ot(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
90
90
  e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function $(e, t, n) {
94
- const [o, a, i] = Ln(we(e));
95
- return qe(An(o, Ve(a + n), Ve(i + t)));
93
+ function V(e, t, n) {
94
+ const [o, a, i] = zn(ke(e));
95
+ return tt(Gn(o, ot(a + n), ot(i + t)));
96
96
  }
97
- function Ln([e, t, n]) {
98
- const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), d = (l + s) / 2;
99
- if (l === s)
100
- return [0, 0, d];
101
- const c = l - s, p = d > 0.5 ? c / (2 - l - s) : c / (l + s);
102
- return [(l === o ? (a - i) / c + (a < i ? 6 : 0) : l === a ? (i - o) / c + 2 : (o - a) / c + 4) / 6, p, d];
97
+ function zn([e, t, n]) {
98
+ 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;
99
+ if (l === p)
100
+ return [0, 0, c];
101
+ const u = l - p, s = c > 0.5 ? u / (2 - l - p) : u / (l + p);
102
+ return [(l === o ? (a - i) / u + (a < i ? 6 : 0) : l === a ? (i - o) / u + 2 : (o - a) / u + 4) / 6, s, c];
103
103
  }
104
- function An(e, t, n) {
104
+ function Gn(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
108
108
  return [
109
- ze(a, o, e + 1 / 3) * 255,
110
- ze(a, o, e) * 255,
111
- ze(a, o, e - 1 / 3) * 255
109
+ Xe(a, o, e + 1 / 3) * 255,
110
+ Xe(a, o, e) * 255,
111
+ Xe(a, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function ze(e, t, n) {
114
+ function Xe(e, t, n) {
115
115
  let o = n;
116
116
  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;
117
117
  }
118
- function Ve(e) {
118
+ function ot(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const $t = "suggest_share_on_socials";
122
- function Pn(e) {
121
+ const tn = "suggest_share_on_socials";
122
+ function Hn(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const n = e[t];
125
- if (n.role !== "tool" || n.toolName !== $t)
125
+ if (n.role !== "tool" || n.toolName !== tn)
126
126
  continue;
127
- const o = bt(e, t, "assistant");
127
+ const o = Lt(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const a = bt(e, o.index, "user");
130
+ const a = Lt(e, o.index, "user");
131
131
  return a ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: a.content,
@@ -136,13 +136,13 @@ function Pn(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Tn(e) {
140
- const t = await Nn(e);
139
+ async function Wn(e) {
140
+ const t = await $n(e);
141
141
  if (!navigator.clipboard || typeof ClipboardItem > "u")
142
142
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
143
143
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
144
144
  }
145
- function bt(e, t, n) {
145
+ function Lt(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
147
  const a = e[o];
148
148
  if (a.role === n && a.content.trim())
@@ -150,21 +150,21 @@ function bt(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Nn(e) {
153
+ async function $n(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const In = "https://app.pluno.ai", Dn = "/api/product-agent/embed/active-users", Rn = 1800, Mn = 15e3, Bn = 250, On = 1e3, Un = 3e4;
157
- function Fn(e, t = {}) {
156
+ const qn = "https://app.pluno.ai", jn = "/api/product-agent/embed/active-users", Vn = 1800, Yn = 15e3, Kn = 250, Xn = 1e3, Zn = 3e4;
157
+ function Jn(e, t = {}) {
158
158
  let n = !1, o = null, a = null, i = null;
159
159
  const l = () => {
160
160
  i !== null && (window.clearInterval(i), i = null);
161
- }, s = (p) => {
161
+ }, p = (s) => {
162
162
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
163
- c();
164
- }, Wn(p)));
165
- }, d = (p) => {
163
+ u();
164
+ }, to(s)));
165
+ }, c = (s) => {
166
166
  if (l(), o === null) {
167
- o = p, e(p);
167
+ o = s, e(s);
168
168
  return;
169
169
  }
170
170
  const b = o, x = performance.now();
@@ -173,50 +173,50 @@ function Fn(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const A = Math.min(1, (performance.now() - x) / Rn);
177
- o = Math.round(b + (p - b) * Hn(A)), e(o), A >= 1 && (o = p, e(p), l());
178
- }, Bn);
179
- }, c = async () => {
176
+ const P = Math.min(1, (performance.now() - x) / Vn);
177
+ o = Math.round(b + (s - b) * no(P)), e(o), P >= 1 && (o = s, e(s), l());
178
+ }, Kn);
179
+ }, u = async () => {
180
180
  try {
181
- const p = await zn(t);
181
+ const s = await Qn(t);
182
182
  if (n)
183
183
  return;
184
- d(p.count), s(p.refreshAfterMs);
184
+ c(s.count), p(s.refreshAfterMs);
185
185
  } catch {
186
- s(Mn);
186
+ p(Yn);
187
187
  }
188
188
  };
189
- return c(), () => {
189
+ return u(), () => {
190
190
  n = !0, a !== null && window.clearTimeout(a), l();
191
191
  };
192
192
  }
193
- async function zn(e) {
193
+ async function Qn(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(Dn, Gn(e.backendUrl ?? In)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(jn, eo(e.backendUrl ?? qn)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const o = await n.json(), a = ft(o.count), i = ft(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), a = Pt(o.count), i = Pt(o.refreshAfterMs ?? o.refresh_after_ms);
203
203
  if (a === null || i === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: a, refreshAfterMs: i };
206
206
  }
207
- function ft(e) {
207
+ function Pt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Gn(e) {
210
+ function eo(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function Wn(e) {
214
- return Math.min(Un, Math.max(On, e));
213
+ function to(e) {
214
+ return Math.min(Zn, Math.max(Xn, e));
215
215
  }
216
- function Hn(e) {
216
+ function no(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-agent:sdk-preview-socket-send", jn = "product-agent:sdk-preview-socket-close", Vn = "product-agent:sdk-preview-socket-open", Yn = "product-agent:sdk-preview-socket-message", Kn = "product-agent:sdk-preview-socket-error", Xn = "product-agent:sdk-preview-socket-closed", wt = "product-agent:sdk-preview-socket-id", Zn = "product-agent:preview-diagnostic", jt = "pluno.productAgent.sharePromptsDisabled", Te = 10, Jn = 10 * 1024 * 1024, Vt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Qn = Array.from(Vt).join(","), eo = 3, q = {
219
+ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "data-pluno-sdk-preview-channel", uo = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Fe = 10, go = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), ho = Array.from(an).join(","), mo = 3, bo = "No recent chats for this page yet.", K = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, to = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', _t = "pluno-pa-scribble-font", Yt = 190, Kt = 41, no = 48, oo = 420, ao = 520, io = 0.24, ro = 680, lo = 800, po = 0.76, F = 8, Ye = 50, Xt = "http://www.w3.org/2000/svg", xt = [
227
+ }, fo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, wo = 48, _o = 420, xo = 520, yo = 0.24, vo = 680, Co = 800, Eo = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], so = 11, co = 13, vt = 4, uo = 10, go = 40, ho = "movable-launcher-position-v2", Zt = "pluno-pa-widget-styles", Jt = "data-pluno-pa-widget-styles";
265
- let yt = 0;
266
- function mo(e) {
267
- return (t) => new Z(t, e);
264
+ ], So = 11, ko = 13, It = 4, Lo = 10, Po = 40, Ao = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
265
+ let Dt = 0;
266
+ function To(e) {
267
+ return (t) => new te(t, e);
268
268
  }
269
- async function bo(e = {}) {
269
+ async function No(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? q.launcherLabel,
272
- accentColor: e.accentColor ?? q.accentColor,
273
- colorScheme: e.colorScheme ?? q.colorScheme,
274
- fontFamily: e.fontFamily ?? q.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? q.scribbleStyle,
276
- position: e.position ?? q.position,
277
- movableLauncher: e.movableLauncher ?? q.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? K.launcherLabel,
272
+ accentColor: e.accentColor ?? K.accentColor,
273
+ colorScheme: e.colorScheme ?? K.colorScheme,
274
+ fontFamily: e.fontFamily ?? K.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? K.scribbleStyle,
276
+ position: e.position ?? K.position,
277
+ movableLauncher: e.movableLauncher ?? K.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -299,9 +299,10 @@ async function bo(e = {}) {
299
299
  activeUsersLoader: e.activeUsersLoader,
300
300
  socialPostRewardsUrl: e.socialPostRewardsUrl,
301
301
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
302
- persistSharePromptsDisabled: e.persistSharePromptsDisabled
302
+ persistSharePromptsDisabled: e.persistSharePromptsDisabled,
303
+ sdkPreviewChannelId: e.sdkPreviewChannelId
303
304
  };
304
- X("web-sdk.widget", "Mounting widget with merged options", {
305
+ Y("web-sdk.widget", "Mounting widget with merged options", {
305
306
  accentColor: t.accentColor,
306
307
  colorScheme: t.colorScheme,
307
308
  fontFamily: t.fontFamily,
@@ -313,35 +314,35 @@ async function bo(e = {}) {
313
314
  initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
314
315
  });
315
316
  const n = document.createElement("div");
316
- n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
317
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(co, t.sdkPreviewChannelId);
317
318
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
318
319
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
319
- let i = Ct(t.accentColor, t.scribbleStyle);
320
- Do(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
321
- const l = await Sa(), s = l.ownerDocument;
322
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ut(o, t.accentColor), Et(a, i, {
320
+ let i = Rt(t.accentColor, t.scribbleStyle);
321
+ Zo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
322
+ const l = await ja(), p = l.ownerDocument;
323
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Kt(o, t.accentColor), Mt(a, i, {
323
324
  accentColor: t.accentColor,
324
325
  colorScheme: t.colorScheme,
325
326
  fontFamily: t.fontFamily,
326
327
  scribbleStyle: t.scribbleStyle
327
- }), X("web-sdk.widget", "Applied initial widget appearance", {
328
+ }), Y("web-sdk.widget", "Applied initial widget appearance", {
328
329
  accentColor: t.accentColor,
329
330
  colorScheme: t.colorScheme,
330
331
  fontFamily: t.fontFamily,
331
332
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
332
333
  });
333
- const d = a.querySelector(".pluno-pa-widget__launcher"), c = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), E = 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"), C = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), ne = a.querySelector(".pluno-pa-widget__timeline-jump"), ge = a.querySelector(".pluno-pa-widget__active-users-counter"), L = a.querySelector(".pluno-pa-widget__timeline"), w = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
334
- if (!d || !p || !b || !x || !A || !E || !R || !v || !y || !h || !g || !C || !N || !ne || !ge || !L || !w)
334
+ const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), P = a.querySelector(".pluno-pa-widget__composer"), k = a.querySelector(".pluno-pa-widget__attachment-error"), O = a.querySelector(".pluno-pa-widget__billing-status"), y = a.querySelector(".pluno-pa-widget__attachments"), C = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), E = a.querySelector(".pluno-pa-widget__send"), I = a.querySelector(".pluno-pa-widget__new-chat"), le = a.querySelector(".pluno-pa-widget__history"), xe = a.querySelector(".pluno-pa-widget__history-panel"), R = a.querySelector(".pluno-pa-widget__history-list"), _ = a.querySelector(".pluno-pa-widget__history-close"), L = a.querySelector(".pluno-pa-widget__history-status"), G = a.querySelector(".pluno-pa-widget__timeline-jump"), M = a.querySelector(".pluno-pa-widget__active-users-counter"), f = a.querySelector(".pluno-pa-widget__timeline"), A = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
335
+ if (!c || !s || !b || !x || !P || !k || !O || !y || !C || !h || !g || !E || !I || !le || !xe || !R || !_ || !L || !G || !M || !f || !A)
335
336
  throw new Error("Failed to mount Pluno widget");
336
- if (t.movableLauncher && !c)
337
+ if (t.movableLauncher && !u)
337
338
  throw new Error("Failed to mount Pluno widget drag handle");
338
- Pt(p), Pt(g);
339
- let f = [], I = null;
340
- const P = () => {
341
- Ko(v, f, (r) => {
342
- f = f.filter((u, k) => k !== r), P(), O(_.getState()), G();
339
+ zt(s), zt(g);
340
+ let T = [], J = null;
341
+ const me = () => {
342
+ ba(y, T, (r) => {
343
+ T = T.filter((d, S) => S !== r), me(), U(w.getState()), W();
343
344
  });
344
- }, M = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
345
+ }, En = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
345
346
  if (!t.tokenEndpoint)
346
347
  throw new Error("Pluno widget requires token or tokenEndpoint");
347
348
  const r = await fetch(t.tokenEndpoint, {
@@ -352,19 +353,19 @@ async function bo(e = {}) {
352
353
  });
353
354
  if (!r.ok)
354
355
  throw new Error("Failed to load Pluno token");
355
- const u = await r.json();
356
- if (!u.token)
356
+ const d = await r.json();
357
+ if (!d.token)
357
358
  throw new Error("Pluno token endpoint did not return a token");
358
- return u.token;
359
- }), T = window.fetch.bind(window);
360
- let _;
361
- _ = await yn.init({
359
+ return d.token;
360
+ }), Sn = window.fetch.bind(window);
361
+ let w;
362
+ w = await Mn.init({
362
363
  token: t.token,
363
- tokenProvider: M,
364
+ tokenProvider: En,
364
365
  backendUrl: t.backendUrl,
365
366
  metadata: () => ({
366
367
  ...t.metadata ?? {},
367
- ...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
368
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
368
369
  }),
369
370
  initialStarterPrompts: t.initialStarterPrompts,
370
371
  clientId: t.clientId,
@@ -373,42 +374,83 @@ async function bo(e = {}) {
373
374
  webSocketFactory: t.webSocketFactory,
374
375
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
375
376
  });
376
- const oe = ka(t), Ne = new Set(oe.openToolGroupKeys), se = new Set(oe.seenShareCandidateIds), _e = new Set(se);
377
- let Ie = oe.sharePromptsDisabled || await La(t), V = t.movableLauncher ? oe.launcherPosition : null, et = V !== null, Q = null, De = !1, ae = !1, ie = {
377
+ const pe = Va(t), Ge = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
378
+ let He = pe.sharePromptsDisabled || await Ya(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, Pe = !1, se = !1, de = {
378
379
  enabled: !0
379
- }, re = 0, tt = "";
380
- const Y = (r, u) => {
381
- ie = { enabled: r, reason: u };
382
- }, K = () => {
383
- ne.hidden = !0;
384
- }, hn = () => {
385
- ne.hidden = !1;
386
- }, mn = (r = "jump") => {
387
- Y(!0, r), K(), fe(L, () => ie.enabled), re = L.scrollTop;
388
- }, bn = () => {
389
- De || typeof document > "u" || (Ut(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
390
- }, nt = new MutationObserver(bn);
391
- nt.observe(s.documentElement, { childList: !0, subtree: !0 });
392
- const Re = (r = !0) => {
393
- const u = Ke(a, r);
394
- return St(
380
+ }, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
381
+ const q = (r, d) => {
382
+ de = { enabled: r, reason: d };
383
+ }, j = () => {
384
+ G.hidden = !0;
385
+ }, kn = () => {
386
+ G.hidden = !1;
387
+ }, Ln = (r = "jump") => {
388
+ q(!0, r), j(), Se(f, () => de.enabled), ce = f.scrollTop;
389
+ }, ue = () => {
390
+ if (le.hidden = t.loginRequired, xe.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), R.classList.toggle(
391
+ "pluno-pa-widget__history-list--center",
392
+ ee && ie.length === 0
393
+ ), R.replaceChildren(), ee && ie.length === 0) {
394
+ const r = document.createElement("p");
395
+ r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", R.appendChild(r);
396
+ }
397
+ for (const r of ie) {
398
+ const d = document.createElement("button");
399
+ d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
400
+ const S = document.createElement("span");
401
+ S.className = "pluno-pa-widget__history-item-title", S.textContent = Yo(r);
402
+ const B = document.createElement("time");
403
+ B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Xo(r.lastActiveAt, Date.now());
404
+ const N = document.createElement("small");
405
+ N.className = "pluno-pa-widget__history-path", N.textContent = Ko(r), d.append(S, B, N), d.addEventListener("click", () => {
406
+ ae = !1, ye = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), U(w.getState());
407
+ }), R.appendChild(d);
408
+ }
409
+ if (ee && ie.length > 0) {
410
+ const r = document.createElement("p");
411
+ r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", R.appendChild(r);
412
+ }
413
+ L.textContent = ye ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
414
+ }, ut = async (r) => {
415
+ if (!ee) {
416
+ ee = !0, ye = null, ue();
417
+ try {
418
+ const d = await w.listSessions({ cursor: r, limit: 20 });
419
+ ie = r ? [...ie, ...d.sessions] : d.sessions, We = d.nextCursor;
420
+ } catch (d) {
421
+ Y("web-sdk.widget", "Failed to load session history", {
422
+ message: d instanceof Error ? d.message : String(d)
423
+ }), ye = bo;
424
+ } finally {
425
+ ee = !1, ue();
426
+ }
427
+ }
428
+ }, Pn = () => {
429
+ !We || ee || R.scrollHeight - R.scrollTop - R.clientHeight <= 24 && ut(We);
430
+ }, An = () => {
431
+ Pe || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
432
+ }, gt = new MutationObserver(An);
433
+ gt.observe(p.documentElement, { childList: !0, subtree: !0 });
434
+ const $e = (r = !0) => {
435
+ const d = it(a, r);
436
+ return Bt(
395
437
  a,
396
- V ? Co(V, u) : yo(a, t.position, u),
397
- u
438
+ Q ? Uo(Q, d) : Oo(a, t.position, d),
439
+ d
398
440
  );
399
- }, z = () => {
400
- Pa(t, {
441
+ }, H = () => {
442
+ Xa(t, {
401
443
  isOpen: a.classList.contains("pluno-pa-widget--open"),
402
444
  composerValue: g.value,
403
- openToolGroupKeys: [...Ne],
404
- launcherPosition: et ? V : null,
405
- seenShareCandidateIds: [...se].slice(-qt),
406
- sharePromptsDisabled: Ie
445
+ openToolGroupKeys: [...Ge],
446
+ launcherPosition: dt ? Q : null,
447
+ seenShareCandidateIds: [...be].slice(-nn),
448
+ sharePromptsDisabled: He
407
449
  });
408
- }, le = (r, u = {}) => {
409
- To(r, {
410
- debugVersion: ho,
411
- launcherPosition: V,
450
+ }, ge = (r, d = {}) => {
451
+ qo(r, {
452
+ debugVersion: Ao,
453
+ launcherPosition: Q,
412
454
  rootClasses: a.className,
413
455
  rootStyle: {
414
456
  left: a.style.left,
@@ -416,110 +458,110 @@ async function bo(e = {}) {
416
458
  right: a.style.right,
417
459
  bottom: a.style.bottom
418
460
  },
419
- rootRect: Ge(a),
420
- launcherRect: Ge(d),
421
- panelRect: Ge(b),
422
- viewport: J(),
461
+ rootRect: Ze(a),
462
+ launcherRect: Ze(c),
463
+ panelRect: Ze(b),
464
+ viewport: ne(),
423
465
  panelHidden: b.hidden,
424
466
  closeHidden: x.hidden,
425
- ...u
467
+ ...d
426
468
  });
427
- }, xe = (r = !0) => {
428
- if (!V)
429
- return Ee(a, null), Re(r);
430
- const u = Re(r);
431
- return Ee(a, u), le("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
432
- }, ot = (r, u) => {
433
- if (!r || !u) {
434
- Po(a);
469
+ }, Ae = (r = !0) => {
470
+ if (!Q)
471
+ return De(a, null), $e(r);
472
+ const d = $e(r);
473
+ return De(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
474
+ }, ht = (r, d) => {
475
+ if (!r || !d) {
476
+ $o(a);
435
477
  return;
436
478
  }
437
- Ao(a, {
438
- x: r.x - u.x,
439
- y: r.y - u.y
479
+ Wo(a, {
480
+ x: r.x - d.x,
481
+ y: r.y - d.y
440
482
  });
441
- }, at = () => {
442
- const r = xe();
483
+ }, mt = () => {
484
+ const r = Ae();
443
485
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
444
- const u = kt(a, r, t.position);
445
- ot(u, r), le("Applied open panel position after viewport resize", { openPanelPosition: u });
446
- } else V && le("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
486
+ const d = Ot(a, r, t.position);
487
+ ht(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
488
+ } else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
447
489
  };
448
- let it = () => {
490
+ let bt = () => {
449
491
  };
450
- window.addEventListener("resize", at), t.movableLauncher && c ? (xe(), it = vo({
492
+ window.addEventListener("resize", mt), t.movableLauncher && u ? (Ae(), bt = Bo({
451
493
  root: a,
452
- launcher: d,
453
- launcherDragHandle: c,
454
- getPosition: () => Re(),
494
+ launcher: c,
495
+ launcherDragHandle: u,
496
+ getPosition: () => $e(),
455
497
  setPosition: (r) => {
456
- const u = r, k = Ke(a), H = St(a, r, k);
457
- V = Eo(H, k), Ee(a, H), le("Dragging closed launcher", { requestedPosition: u });
498
+ const d = r, S = it(a), B = Bt(a, r, S);
499
+ Q = Fo(B, S), De(a, B), ge("Dragging closed launcher", { requestedPosition: d });
458
500
  },
459
501
  persist: () => {
460
- et = !0, z(), le("Persisted closed launcher drag position");
502
+ dt = !0, H(), ge("Persisted closed launcher drag position");
461
503
  }
462
- })) : Ee(a, null);
463
- let Me = !1;
464
- const rt = async () => {
465
- if (!(!t.billingStatusLoader || Me)) {
466
- Me = !0;
504
+ })) : De(a, null);
505
+ let qe = !1;
506
+ const ft = async () => {
507
+ if (!(!t.billingStatusLoader || qe)) {
508
+ qe = !0;
467
509
  try {
468
510
  const r = await t.billingStatusLoader();
469
- Nt(t.billingStatus, r, _.getState().lastErrorCode) && (t.billingStatus = r, $e(R, t.billingStatus, _.getState().lastErrorCode), G());
511
+ Ht(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, et(O, t.billingStatus, w.getState().lastErrorCode), W());
470
512
  } finally {
471
- Me = !1;
513
+ qe = !1;
472
514
  }
473
515
  }
474
- }, pe = (r = "", u = !0) => {
475
- rt(), Q !== null && (window.clearTimeout(Q), Q = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
476
- const k = xe(), H = kt(a, k, t.position);
477
- if (ot(H, k), le("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: k }), Y(!0, "open"), K(), !u) {
478
- a.classList.add("pluno-pa-widget--open"), d.hidden = !0, r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z();
516
+ }, he = (r = "", d = !0) => {
517
+ ft(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
518
+ const S = Ae(), B = Ot(a, S, t.position);
519
+ if (ht(B, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: B, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
520
+ a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
479
521
  return;
480
522
  }
481
523
  window.requestAnimationFrame(() => {
482
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z(), Q = window.setTimeout(() => {
483
- d.hidden = !0, fe(L, () => ie.enabled), re = L.scrollTop;
524
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
525
+ c.hidden = !0, Se(f, () => de.enabled), ce = f.scrollTop;
484
526
  }, 220);
485
527
  });
486
- }, fn = () => {
487
- Q !== null && (window.clearTimeout(Q), Q = null), d.hidden = !1, V && (xe(!1), le("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), z(), Q = window.setTimeout(() => {
528
+ }, Tn = () => {
529
+ oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Ae(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
488
530
  b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
489
531
  }, 220);
490
532
  };
491
- d.addEventListener("submit", (r) => {
492
- r.preventDefault(), pe(p.value), p.value = "";
493
- }), c?.addEventListener("click", (r) => {
533
+ c.addEventListener("submit", (r) => {
534
+ r.preventDefault(), he(s.value), s.value = "";
535
+ }), u?.addEventListener("click", (r) => {
494
536
  r.preventDefault(), r.stopPropagation();
495
- }), d.addEventListener("click", (r) => {
496
- r.target === p && !c || (pe(p.value), p.value = "");
497
- }), p.addEventListener("focus", () => {
498
- pe(p.value), p.value = "";
499
- }), p.addEventListener("input", () => {
500
- if (!p.value)
537
+ }), c.addEventListener("click", (r) => {
538
+ r.target === s && !u || (he(s.value), s.value = "");
539
+ }), s.addEventListener("focus", () => {
540
+ he(s.value), s.value = "";
541
+ }), s.addEventListener("input", () => {
542
+ if (!s.value)
501
543
  return;
502
- const r = p.value;
503
- pe(r), p.value = "";
504
- }), x.addEventListener("click", fn), L.addEventListener("scroll", () => {
505
- L.scrollTop < re - 1 && Y(!1, "userScroll"), re = L.scrollTop;
506
- }), ne.addEventListener("click", () => {
507
- mn();
544
+ const r = s.value;
545
+ he(r), s.value = "";
546
+ }), x.addEventListener("click", Tn), f.addEventListener("scroll", () => {
547
+ f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
548
+ }), G.addEventListener("click", () => {
549
+ Ln();
508
550
  });
509
- const lt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
551
+ const wt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
510
552
  ([r]) => {
511
- r?.isIntersecting && (Y(!0, "bottom"), K());
553
+ r?.isIntersecting && (q(!0, "bottom"), j());
512
554
  },
513
- { root: L, threshold: 0 }
555
+ { root: f, threshold: 0 }
514
556
  );
515
- lt?.observe(w);
516
- const ve = () => t.loginRequired || t.signupRequired, pt = () => {
517
- const r = ve();
518
- p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : q.launcherLabel, A.hidden = r;
519
- }, G = () => {
520
- C.disabled = j(t.billingStatus) || !_.getState().isThinking && g.value.trim().length === 0 && f.length === 0, h.disabled = ve() || j(t.billingStatus);
557
+ wt?.observe(A);
558
+ const Te = () => t.loginRequired || t.signupRequired, _t = () => {
559
+ const r = Te();
560
+ s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
561
+ }, W = () => {
562
+ E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Te() || X(t.billingStatus);
521
563
  };
522
- pt(), A.addEventListener("submit", (r) => {
564
+ _t(), P.addEventListener("submit", (r) => {
523
565
  if (r.preventDefault(), t.loginRequired) {
524
566
  t.onLoginClick?.();
525
567
  return;
@@ -528,83 +570,87 @@ async function bo(e = {}) {
528
570
  t.onSignupClick?.();
529
571
  return;
530
572
  }
531
- j(t.billingStatus) || (ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G());
573
+ X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W());
532
574
  });
533
- let he = 0;
534
- const wn = () => {
535
- he = 0, a.classList.remove("pluno-pa-widget--drag-over");
536
- }, st = (r) => {
537
- I !== null && window.clearTimeout(I), E.textContent = r, E.hidden = !1, I = window.setTimeout(() => {
538
- E.textContent = "", E.hidden = !0, I = null;
575
+ let ve = 0;
576
+ const Nn = () => {
577
+ ve = 0, a.classList.remove("pluno-pa-widget--drag-over");
578
+ }, xt = (r) => {
579
+ J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
580
+ k.textContent = "", k.hidden = !0, J = null;
539
581
  }, 3e3);
540
- }, _n = () => {
541
- I !== null && (window.clearTimeout(I), I = null), E.textContent = "", E.hidden = !0;
542
- }, dt = async (r) => {
582
+ }, In = () => {
583
+ J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
584
+ }, yt = async (r) => {
543
585
  if (r.length === 0)
544
586
  return;
545
- const u = await Qo(r);
546
- if (f.length + u.length > Te)
547
- throw new Error(`Attach up to ${Te} files per message.`);
548
- f = [...f, ...u], P(), _n(), G(), O(_.getState()), a.classList.contains("pluno-pa-widget--open") || pe();
587
+ const d = await xa(r);
588
+ if (T.length + d.length > Fe)
589
+ throw new Error(`Attach up to ${Fe} files per message.`);
590
+ T = [...T, ...d], me(), In(), W(), U(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
549
591
  };
550
592
  h.addEventListener("click", () => {
551
- t.loginRequired || j(t.billingStatus) || y.click();
552
- }), y.addEventListener("change", () => {
553
- const r = Array.from(y.files ?? []);
554
- y.value = "", dt(r).catch((u) => {
555
- st(u instanceof Error ? u.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
556
- message: u instanceof Error ? u.message : String(u)
593
+ t.loginRequired || X(t.billingStatus) || C.click();
594
+ }), C.addEventListener("change", () => {
595
+ const r = Array.from(C.files ?? []);
596
+ C.value = "", yt(r).catch((d) => {
597
+ xt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
598
+ message: d instanceof Error ? d.message : String(d)
557
599
  });
558
600
  });
559
601
  }), a.addEventListener("dragenter", (r) => {
560
- !Se(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), he += 1, a.classList.add("pluno-pa-widget--drag-over"));
602
+ !Re(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
561
603
  }), a.addEventListener("dragover", (r) => {
562
- const u = r.dataTransfer;
563
- !Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
604
+ const d = r.dataTransfer;
605
+ !Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
564
606
  }), a.addEventListener("dragleave", (r) => {
565
- Se(r.dataTransfer) && (r.stopPropagation(), he = Math.max(0, he - 1), he === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
607
+ Re(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
566
608
  }), a.addEventListener("drop", (r) => {
567
- const u = r.dataTransfer;
568
- !Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), wn(), dt(u.files).catch((k) => {
569
- st(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
570
- message: k instanceof Error ? k.message : String(k)
609
+ const d = r.dataTransfer;
610
+ !Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
611
+ xt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
612
+ message: S instanceof Error ? S.message : String(S)
571
613
  });
572
614
  }));
573
- }), C.addEventListener("click", () => {
615
+ }), E.addEventListener("click", () => {
574
616
  if (t.loginRequired) {
575
617
  t.onLoginClick?.();
576
618
  return;
577
619
  }
578
- if (_.getState().isThinking) {
579
- _.stop();
620
+ if (w.getState().isThinking) {
621
+ w.stop();
580
622
  return;
581
623
  }
582
- ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
583
- }), N.addEventListener("click", () => {
584
- ae = !0, Y(!0, "newSession"), K(), _.startNewSession(), Ne.clear(), g.value = "", f = [], P(), be(g), z(), G(), g.focus(), O(_.getState());
585
- }), g.addEventListener("input", () => {
586
- be(g), z(), G(), O(_.getState());
624
+ se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
625
+ }), I.addEventListener("click", () => {
626
+ se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), Ge.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
627
+ }), le.addEventListener("click", () => {
628
+ ae = !ae, ye = null, ue(), ae && ie.length === 0 && ut(null);
629
+ }), _.addEventListener("click", () => {
630
+ ae = !1, ue();
631
+ }), R.addEventListener("scroll", Pn), g.addEventListener("input", () => {
632
+ Ee(g), H(), W(), U(w.getState());
587
633
  }), g.addEventListener("keydown", (r) => {
588
634
  if (!(r.key !== "Enter" || r.shiftKey)) {
589
635
  if (r.preventDefault(), t.loginRequired) {
590
636
  t.onLoginClick?.();
591
637
  return;
592
638
  }
593
- ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
639
+ se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
594
640
  }
595
641
  }), a.addEventListener("click", (r) => {
596
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && z();
597
- }), oe.composerValue && (g.value = oe.composerValue, be(g)), oe.isOpen && pe(g.value, !1);
598
- const ye = () => i;
599
- let Be = _.getState().appearance !== null, Ce = null, me = null, de = null, ct = _.getState().isThinking, ce = null, Oe = null, ut = () => {
642
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
643
+ }), pe.composerValue && (g.value = pe.composerValue, Ee(g)), pe.isOpen && he(g.value, !1);
644
+ const Ne = () => i;
645
+ let je = w.getState().appearance !== null, Ie = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
600
646
  };
601
- const xn = !!t.socialPostDraftHandler, O = (r) => {
602
- if (Qe(r.lastErrorCode) ? ce = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(R, t.billingStatus, ce), t.loginRequired) {
603
- Rt(
604
- L,
605
- C,
606
- N,
607
- ye,
647
+ const Dn = !!t.socialPostDraftHandler, U = (r) => {
648
+ if (ue(), st(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(O, t.billingStatus, we), t.loginRequired) {
649
+ qt(
650
+ f,
651
+ E,
652
+ I,
653
+ Ne,
608
654
  "Log in to use Pluno on this page.",
609
655
  t.loginButtonLabel,
610
656
  t.loginUrl,
@@ -613,11 +659,11 @@ async function bo(e = {}) {
613
659
  return;
614
660
  }
615
661
  if (t.signupRequired) {
616
- Rt(
617
- L,
618
- C,
619
- N,
620
- ye,
662
+ qt(
663
+ f,
664
+ E,
665
+ I,
666
+ Ne,
621
667
  "Complete signup to unlock your free trial credits.",
622
668
  t.signupButtonLabel,
623
669
  t.signupUrl,
@@ -625,133 +671,133 @@ async function bo(e = {}) {
625
671
  );
626
672
  return;
627
673
  }
628
- const u = No(r), k = u !== tt;
629
- tt = u;
630
- const H = ae || ie.enabled;
631
- ae = !1, ca(
632
- L,
633
- w,
634
- C,
635
- N,
636
- ge,
674
+ const d = jo(r), S = d !== ct;
675
+ ct = d;
676
+ const B = se || de.enabled;
677
+ se = !1, Ia(
678
+ f,
679
+ A,
680
+ E,
681
+ I,
682
+ M,
637
683
  r,
638
- Oe,
639
- Oe !== null && Dt(r, g.value.trim().length > 0 || f.length > 0),
684
+ Ve,
685
+ Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
686
+ B,
687
+ () => de.enabled,
688
+ Ge,
640
689
  H,
641
- () => ie.enabled,
642
690
  Ne,
643
- z,
644
- ye,
645
- (U) => {
646
- ae = !0, Y(!0, "send"), K(), _.sendMessage(U);
691
+ (N) => {
692
+ se = !0, q(!0, "send"), j(), w.sendMessage(N);
647
693
  },
648
- xn && !Ie ? {
649
- dismissedCandidateIds: _e,
650
- draftingCandidateId: Ce,
651
- error: me,
652
- characterIconOptions: ye(),
653
- onSeen: (U) => {
654
- se.add(U.id), z();
694
+ Dn && !He ? {
695
+ dismissedCandidateIds: Le,
696
+ draftingCandidateId: Ie,
697
+ error: Ce,
698
+ characterIconOptions: Ne(),
699
+ onSeen: (N) => {
700
+ be.add(N.id), H();
655
701
  },
656
- onDraft: (U) => {
657
- vn(U);
702
+ onDraft: (N) => {
703
+ Rn(N);
658
704
  },
659
- onDismiss: (U) => {
660
- se.add(U.id), _e.add(U.id), z(), me = null, O(_.getState());
705
+ onDismiss: (N) => {
706
+ be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
661
707
  },
662
- onDisable: (U) => {
663
- Ie = !0, se.add(U.id), _e.add(U.id), z(), Aa(t, !0), me = null, O(_.getState());
708
+ onDisable: (N) => {
709
+ He = !0, be.add(N.id), Le.add(N.id), H(), Ka(t, !0), Ce = null, U(w.getState());
664
710
  }
665
711
  } : void 0
666
- ), H ? (re = L.scrollTop, K()) : k && Io(r) && hn();
712
+ ), B ? (ce = f.scrollTop, j()) : S && Vo(r) && kn();
667
713
  };
668
- return ut = Fn((r) => {
669
- Oe = r, !De && Dt(_.getState(), g.value.trim().length > 0 || f.length > 0) && O(_.getState());
670
- }, { backendUrl: t.backendUrl, fetcher: T, loader: t.activeUsersLoader }), _.on("state", (r) => {
671
- const u = ct && !r.isThinking;
672
- ct = r.isThinking, r.appearance ? (Be = !0, X("web-sdk.widget", "Agent state supplied appearance", {
714
+ return Ct = Jn((r) => {
715
+ Ve = r, !Pe && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
716
+ }, { backendUrl: t.backendUrl, fetcher: Sn, loader: t.activeUsersLoader }), w.on("state", (r) => {
717
+ const d = vt && !r.isThinking;
718
+ vt = r.isThinking, r.appearance ? (je = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
673
719
  appearance: r.appearance
674
- }), Ue(r.appearance, "agent.state.appearance")) : Be && (Be = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
720
+ }), Ye(r.appearance, "agent.state.appearance")) : je && (je = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
675
721
  fallbackAccentColor: t.accentColor,
676
722
  fallbackColorScheme: t.colorScheme,
677
723
  fallbackFontFamily: t.fontFamily
678
- }), Ue({}, "agent.state.appearance-cleared")), O(r), G(), u && rt();
679
- }), O(_.getState()), G(), {
680
- agent: _,
724
+ }), Ye({}, "agent.state.appearance-cleared")), U(r), W(), d && ft();
725
+ }), U(w.getState()), W(), {
726
+ agent: w,
681
727
  updateAppearance: (r) => {
682
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ue(r, "widgetHandle.updateAppearance");
728
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ye(r, "widgetHandle.updateAppearance");
683
729
  },
684
730
  updateBillingStatus: (r) => {
685
- const u = r ?? null;
686
- Nt(t.billingStatus, u, ce) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(
731
+ const d = r ?? null;
732
+ Ht(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(
687
733
  a.querySelector(".pluno-pa-widget__billing-status"),
688
734
  t.billingStatus,
689
- ce
690
- ), G());
735
+ we
736
+ ), W());
691
737
  },
692
738
  updateAuthGate: (r) => {
693
- const u = ve();
694
- t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), pt(), O(_.getState()), G(), u && !ve() && _.connect().catch((k) => {
695
- X("web-sdk.widget", "Failed to connect after auth gate cleared", {
696
- message: k instanceof Error ? k.message : String(k)
739
+ const d = Te();
740
+ t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), _t(), U(w.getState()), W(), d && !Te() && w.connect().catch((S) => {
741
+ Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
742
+ message: S instanceof Error ? S.message : String(S)
697
743
  });
698
744
  });
699
745
  },
700
746
  openPanel: () => {
701
- pe(g.value, !1);
747
+ he(g.value, !1);
702
748
  },
703
749
  destroy: () => {
704
- De = !0, nt.disconnect(), lt?.disconnect(), window.removeEventListener("resize", at), it(), I !== null && window.clearTimeout(I), ut(), de?.remove(), _.destroy(), n.remove();
750
+ Pe || (Pe = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove());
705
751
  }
706
752
  };
707
- async function vn(r) {
708
- if (!Ce) {
709
- Ce = r.id, me = null, O(_.getState());
753
+ async function Rn(r) {
754
+ if (!Ie) {
755
+ Ie = r.id, Ce = null, U(w.getState());
710
756
  try {
711
757
  if (!t.socialPostDraftHandler)
712
758
  throw new Error("Social post drafting is not available here.");
713
- const u = await t.socialPostDraftHandler(r);
714
- if (!u.linkedinPost || !u.xPost)
759
+ const d = await t.socialPostDraftHandler(r);
760
+ if (!d.linkedinPost || !d.xPost)
715
761
  throw new Error("Pluno did not return a complete social post draft.");
716
- se.add(r.id), _e.add(r.id), z(), de?.remove(), de = ha(u, {
762
+ be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ma(d, {
717
763
  socialPostRewardsUrl: t.socialPostRewardsUrl,
718
764
  onClose: () => {
719
- de?.remove(), de = null;
765
+ fe?.remove(), fe = null;
720
766
  }
721
- }), a.appendChild(de);
722
- } catch (u) {
723
- me = u instanceof Error ? u.message : "Could not draft social post.";
767
+ }), a.appendChild(fe);
768
+ } catch (d) {
769
+ Ce = d instanceof Error ? d.message : "Could not draft social post.";
724
770
  } finally {
725
- Ce = null, O(_.getState());
771
+ Ie = null, U(w.getState());
726
772
  }
727
773
  }
728
774
  }
729
- function Ue(r, u) {
730
- const k = r.accentColor ?? t.accentColor, H = r.colorScheme ?? t.colorScheme, U = r.fontFamily ?? t.fontFamily, Fe = r.scribbleStyle ?? t.scribbleStyle;
731
- i = Ct(k, Fe), Et(a, i, {
732
- accentColor: k,
733
- colorScheme: H,
734
- fontFamily: U,
735
- scribbleStyle: Fe
736
- }), X("web-sdk.widget", "Updated widget appearance", {
737
- source: u,
775
+ function Ye(r, d) {
776
+ const S = r.accentColor ?? t.accentColor, B = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ke = r.scribbleStyle ?? t.scribbleStyle;
777
+ i = Rt(S, Ke), Mt(a, i, {
778
+ accentColor: S,
779
+ colorScheme: B,
780
+ fontFamily: N,
781
+ scribbleStyle: Ke
782
+ }), Y("web-sdk.widget", "Updated widget appearance", {
783
+ source: d,
738
784
  inputAppearance: r,
739
- appliedAccentColor: k,
740
- appliedColorScheme: H,
741
- appliedFontFamily: U,
742
- appliedScribbleStyle: Fe,
785
+ appliedAccentColor: S,
786
+ appliedColorScheme: B,
787
+ appliedFontFamily: N,
788
+ appliedScribbleStyle: Ke,
743
789
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
744
790
  });
745
791
  }
746
792
  }
747
- function Ct(e, t) {
793
+ function Rt(e, t) {
748
794
  return { accentColor: e, scribbleStyle: t };
749
795
  }
750
- function fo(e) {
751
- const t = wo(e);
752
- return t === null ? "#fafafa" : _o(t) > 0.5 ? "#18181b" : "#fafaf9";
796
+ function Io(e) {
797
+ const t = Do(e);
798
+ return t === null ? "#fafafa" : Ro(t) > 0.5 ? "#18181b" : "#fafaf9";
753
799
  }
754
- function wo(e) {
800
+ function Do(e) {
755
801
  const t = e.trim();
756
802
  return /^#[0-9a-f]{6}$/i.test(t) ? [
757
803
  Number.parseInt(t.slice(1, 3), 16),
@@ -763,26 +809,26 @@ function wo(e) {
763
809
  Number.parseInt(t[3] + t[3], 16)
764
810
  ] : null;
765
811
  }
766
- function _o([e, t, n]) {
812
+ function Ro([e, t, n]) {
767
813
  const o = (a) => {
768
814
  const i = a / 255;
769
815
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
770
816
  };
771
817
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
772
818
  }
773
- function Et(e, t, n) {
819
+ function Mt(e, t, n) {
774
820
  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);
775
- const o = n.scribbleStyle ? Wt(n.accentColor) : n.accentColor;
776
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", fo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? to : n.fontFamily, n.scribbleStyle && xo(e.ownerDocument);
821
+ const o = n.scribbleStyle ? Qt(n.accentColor) : n.accentColor;
822
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", Io(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? fo : n.fontFamily, n.scribbleStyle && Mo(e.ownerDocument);
777
823
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
778
824
  for (const i of a)
779
- i.replaceWith(ee(Array.from(i.classList).join(" "), t));
825
+ i.replaceWith(re(Array.from(i.classList).join(" "), t));
780
826
  }
781
- function xo(e) {
782
- if (e.getElementById(_t))
827
+ function Mo(e) {
828
+ if (e.getElementById(Tt))
783
829
  return;
784
830
  const t = e.createElement("style");
785
- t.id = _t, t.textContent = `@font-face {
831
+ t.id = Tt, t.textContent = `@font-face {
786
832
  font-family: "Architects Daughter";
787
833
  font-style: normal;
788
834
  font-weight: 400;
@@ -790,7 +836,7 @@ function xo(e) {
790
836
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
791
837
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
792
838
  }
793
- function vo({
839
+ function Bo({
794
840
  root: e,
795
841
  launcher: t,
796
842
  launcherDragHandle: n,
@@ -798,137 +844,137 @@ function vo({
798
844
  setPosition: a,
799
845
  persist: i
800
846
  }) {
801
- let l = null, s = null, d = null, c = !1, p = null;
847
+ let l = null, p = null, c = null, u = !1, s = null;
802
848
  const b = () => {
803
- l = null, s = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
849
+ l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
804
850
  }, x = (h) => {
805
- 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 }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
806
- }, A = (h) => {
807
- if (l !== h.pointerId || !s || !d)
851
+ 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(), u = !1, t.setPointerCapture?.(h.pointerId));
852
+ }, P = (h) => {
853
+ if (l !== h.pointerId || !p || !c)
808
854
  return;
809
855
  h.preventDefault();
810
- const g = h.clientX - s.x, C = h.clientY - s.y;
811
- !c && Math.hypot(g, C) < vt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: d.x + g, y: d.y + C }));
812
- }, E = (h) => {
813
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (p = { x: h.clientX, y: h.clientY }, i()), b());
814
- }, R = (h) => {
856
+ const g = h.clientX - p.x, E = h.clientY - p.y;
857
+ !u && Math.hypot(g, E) < It || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
858
+ }, k = (h) => {
859
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
860
+ }, O = (h) => {
815
861
  l === h.pointerId && (h.preventDefault(), b());
816
- }, v = (h) => {
817
- if (!p)
818
- return;
819
- const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= vt;
820
- p = null, g && (h.preventDefault(), h.stopPropagation());
821
862
  }, y = (h) => {
863
+ if (!s)
864
+ return;
865
+ const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= It;
866
+ s = null, g && (h.preventDefault(), h.stopPropagation());
867
+ }, C = (h) => {
822
868
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
823
869
  return;
824
- const g = h.shiftKey ? go : uo, C = o();
825
- let N = null;
826
- h.key === "ArrowUp" ? N = { x: C.x, y: C.y - g } : h.key === "ArrowDown" ? N = { x: C.x, y: C.y + g } : h.key === "ArrowLeft" ? N = { x: C.x - g, y: C.y } : h.key === "ArrowRight" && (N = { x: C.x + g, y: C.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
870
+ const g = h.shiftKey ? Po : Lo, E = o();
871
+ let I = null;
872
+ h.key === "ArrowUp" ? I = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? I = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? I = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (I = { x: E.x + g, y: E.y }), I && (h.preventDefault(), h.stopPropagation(), a(I), i());
827
873
  };
828
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", E), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
829
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", E), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
874
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel", O), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
875
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel", O), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
830
876
  };
831
877
  }
832
- function Ke(e, t = !0) {
833
- const n = J(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
878
+ function it(e, t = !0) {
879
+ const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
834
880
  return {
835
- width: t && a && o.width > 0 ? o.width : Math.min(Yt, n.width - 36),
836
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? no : Kt
881
+ width: t && a && o.width > 0 ? o.width : Math.min(rn, n.width - 36),
882
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? wo : ln
837
883
  };
838
884
  }
839
- function Qt() {
840
- const e = J();
885
+ function cn() {
886
+ const e = ne();
841
887
  return {
842
888
  width: Math.min(
843
- ue(e.width * io, oo, ao),
844
- e.width - F * 2
889
+ _e(e.width * yo, _o, xo),
890
+ e.width - z * 2
845
891
  ),
846
892
  height: Math.min(
847
- ue(e.height * po, ro, lo),
848
- e.height - Ye - F
893
+ _e(e.height * Eo, vo, Co),
894
+ e.height - at - z
849
895
  )
850
896
  };
851
897
  }
852
- function yo(e, t, n) {
898
+ function Oo(e, t, n) {
853
899
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
854
900
  if (Number.isFinite(o) && Number.isFinite(a))
855
901
  return { x: o, y: a };
856
902
  const i = e.getBoundingClientRect();
857
903
  if (i.width > 0 || i.height > 0)
858
904
  return { x: i.left, y: i.top };
859
- const l = J();
905
+ const l = ne();
860
906
  return {
861
907
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
862
908
  y: l.height - 24 - n.height
863
909
  };
864
910
  }
865
- function St(e, t, n) {
866
- const o = J(), a = F + ko(e);
911
+ function Bt(e, t, n) {
912
+ const o = ne(), a = z + Go(e);
867
913
  return {
868
- x: ue(t.x, F, Math.max(F, o.width - n.width - F)),
869
- y: ue(t.y, a, Math.max(a, o.height - n.height - F))
914
+ x: _e(t.x, z, Math.max(z, o.width - n.width - z)),
915
+ y: _e(t.y, a, Math.max(a, o.height - n.height - z))
870
916
  };
871
917
  }
872
- function Co(e, t) {
873
- const n = J();
918
+ function Uo(e, t) {
919
+ const n = ne();
874
920
  return {
875
921
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
876
922
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
877
923
  };
878
924
  }
879
- function Eo(e, t) {
880
- const n = So(e, t), o = J();
925
+ function Fo(e, t) {
926
+ const n = zo(e, t), o = ne();
881
927
  return {
882
928
  anchor: n,
883
929
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
884
930
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
885
931
  };
886
932
  }
887
- function So(e, t) {
888
- const n = J(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
933
+ function zo(e, t) {
934
+ const n = ne(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
889
935
  return `${i}-${l}`;
890
936
  }
891
- function ko(e) {
892
- return e.classList.contains("pluno-pa-widget--scribble") ? co : so;
937
+ function Go(e) {
938
+ return e.classList.contains("pluno-pa-widget--scribble") ? ko : So;
893
939
  }
894
- function kt(e, t, n) {
895
- const o = Ke(e), a = Qt(), i = {
940
+ function Ot(e, t, n) {
941
+ const o = it(e), a = cn(), i = {
896
942
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
897
943
  y: t.y + o.height - a.height
898
944
  };
899
- return Lo(i);
945
+ return Ho(i);
900
946
  }
901
- function Lo(e) {
902
- const t = J(), n = Qt();
947
+ function Ho(e) {
948
+ const t = ne(), n = cn();
903
949
  return {
904
- x: ue(e.x, F, Math.max(F, t.width - n.width - F)),
905
- y: ue(
950
+ x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
951
+ y: _e(
906
952
  e.y,
907
- Ye,
908
- Math.max(Ye, t.height - n.height - F)
953
+ at,
954
+ Math.max(at, t.height - n.height - z)
909
955
  )
910
956
  };
911
957
  }
912
- function Ee(e, t) {
958
+ function De(e, t) {
913
959
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
914
960
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
915
961
  return;
916
962
  }
917
963
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
918
964
  }
919
- function Ao(e, t) {
965
+ function Wo(e, t) {
920
966
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
921
967
  }
922
- function Po(e) {
968
+ function $o(e) {
923
969
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
924
970
  }
925
- function J() {
971
+ function ne() {
926
972
  return {
927
- width: window.innerWidth || document.documentElement.clientWidth || Yt + F * 2,
928
- height: window.innerHeight || document.documentElement.clientHeight || Kt + F * 2
973
+ width: window.innerWidth || document.documentElement.clientWidth || rn + z * 2,
974
+ height: window.innerHeight || document.documentElement.clientHeight || ln + z * 2
929
975
  };
930
976
  }
931
- function Ge(e) {
977
+ function Ze(e) {
932
978
  const t = e.getBoundingClientRect();
933
979
  return {
934
980
  x: Math.round(t.x),
@@ -937,10 +983,10 @@ function Ge(e) {
937
983
  height: Math.round(t.height)
938
984
  };
939
985
  }
940
- function ue(e, t, n) {
986
+ function _e(e, t, n) {
941
987
  return Math.min(Math.max(e, t), n);
942
988
  }
943
- function X(e, t, n) {
989
+ function Y(e, t, n) {
944
990
  if (typeof window > "u")
945
991
  return;
946
992
  const o = window, a = {
@@ -949,26 +995,26 @@ function X(e, t, n) {
949
995
  message: t,
950
996
  details: n
951
997
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
952
- 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(Zn, { detail: a }));
998
+ 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(uo, { detail: a }));
953
999
  }
954
- function To(e, t) {
955
- X("web-sdk.widget.position", e, t);
1000
+ function qo(e, t) {
1001
+ Y("web-sdk.widget.position", e, t);
956
1002
  }
957
- function We(e, t, n) {
1003
+ function Je(e, t, n) {
958
1004
  const o = t.value.trim();
959
1005
  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 })), []);
960
1006
  }
961
- function be(e) {
1007
+ function Ee(e) {
962
1008
  e.style.height = "0px";
963
1009
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
964
1010
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
965
1011
  }
966
- function fe(e, t = () => !0) {
1012
+ function Se(e, t = () => !0) {
967
1013
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
968
1014
  t() && (e.scrollTop = e.scrollHeight);
969
1015
  });
970
1016
  }
971
- function No(e) {
1017
+ function jo(e) {
972
1018
  const t = e.messages[e.messages.length - 1];
973
1019
  return [
974
1020
  e.messages.length,
@@ -979,37 +1025,67 @@ function No(e) {
979
1025
  e.lastError ?? ""
980
1026
  ].join(":");
981
1027
  }
982
- function Io(e) {
1028
+ function Vo(e) {
983
1029
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
984
1030
  }
985
- function Do(e, t, n, o) {
986
- e.appendChild(Go()), e.appendChild(Ro(t, n, o)), e.appendChild(nn("pluno-pa-widget__close", "Close", Wo(16), !0)), e.appendChild(Mo(n));
1031
+ function Yo(e) {
1032
+ return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1033
+ }
1034
+ function Ko(e) {
1035
+ const t = e.currentPage;
1036
+ if (typeof t?.url == "string" && t.url.trim())
1037
+ try {
1038
+ const n = new URL(t.url);
1039
+ return `${n.pathname || "/"}${n.search}`;
1040
+ } catch {
1041
+ return t.url;
1042
+ }
1043
+ return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1044
+ }
1045
+ function Xo(e, t) {
1046
+ const n = new Date(e).getTime();
1047
+ if (!Number.isFinite(n))
1048
+ return "now";
1049
+ const o = Math.max(0, t - n), a = [
1050
+ ["day", 864e5],
1051
+ ["hour", 36e5],
1052
+ ["min", 6e4]
1053
+ ];
1054
+ for (const [i, l] of a)
1055
+ if (o >= l) {
1056
+ const p = Math.max(1, Math.floor(o / l));
1057
+ return i === "min" ? `${p} min` : `${p} ${i}${p === 1 ? "" : "s"}`;
1058
+ }
1059
+ return "now";
987
1060
  }
988
- function Ro(e, t, n) {
1061
+ function Zo(e, t, n, o) {
1062
+ e.appendChild(ra()), e.appendChild(Jo(t, n, o)), e.appendChild(ze("pluno-pa-widget__close", "Close", la(16), !0)), e.appendChild(Qo(n));
1063
+ }
1064
+ function Jo(e, t, n) {
989
1065
  const o = document.createElement("form");
990
1066
  if (o.className = "pluno-pa-widget__launcher", n) {
991
1067
  const i = document.createElement("button");
992
1068
  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);
993
1069
  }
994
- o.appendChild(on("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ee("pluno-pa-widget__character--launcher", t));
1070
+ o.appendChild(hn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
995
1071
  const a = document.createElement("input");
996
1072
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
997
1073
  }
998
- function Mo(e) {
1074
+ function Qo(e) {
999
1075
  const t = document.createElement("section");
1000
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(on("pluno-pa-widget__scribble-spirals--panel", 16));
1076
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(hn("pluno-pa-widget__scribble-spirals--panel", 16));
1001
1077
  const n = document.createElement("div");
1002
1078
  n.className = "pluno-pa-widget__timeline-wrap";
1003
1079
  const o = document.createElement("main");
1004
- o.className = "pluno-pa-widget__timeline", o.appendChild(Oo(e));
1080
+ o.className = "pluno-pa-widget__timeline", o.appendChild(na(e));
1005
1081
  const a = document.createElement("div");
1006
1082
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1007
1083
  const i = document.createElement("div");
1008
1084
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1009
1085
  const l = document.createElement("button");
1010
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(nn("pluno-pa-widget__new-chat", "New chat", Ho(), !0)), t.appendChild(n), t.appendChild(Bo()), t;
1086
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(ze("pluno-pa-widget__history", "Recent chats", sa(), !0)), n.appendChild(ze("pluno-pa-widget__new-chat", "New chat", pa(), !0)), n.appendChild(ta()), t.appendChild(n), t.appendChild(ea()), t;
1011
1087
  }
1012
- function Bo() {
1088
+ function ea() {
1013
1089
  const e = document.createElement("form");
1014
1090
  e.className = "pluno-pa-widget__composer";
1015
1091
  const t = document.createElement("div");
@@ -1021,44 +1097,58 @@ function Bo() {
1021
1097
  const a = document.createElement("div");
1022
1098
  a.className = "pluno-pa-widget__composer-inner";
1023
1099
  const i = document.createElement("input");
1024
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Qn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1100
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = ho, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1025
1101
  const l = document.createElement("button");
1026
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild($o()), l.appendChild(qo()), a.appendChild(l);
1027
- const s = document.createElement("textarea");
1028
- s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1029
- const d = document.createElement("button");
1030
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(an()), a.appendChild(d), e.appendChild(a);
1031
- const c = document.createElement("div");
1032
- c.className = "pluno-pa-widget__composer-meta";
1033
- const p = document.createElement("a");
1034
- 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.", c.appendChild(p);
1102
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ca()), l.appendChild(ua()), a.appendChild(l);
1103
+ const p = document.createElement("textarea");
1104
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1105
+ const c = document.createElement("button");
1106
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(mn()), a.appendChild(c), e.appendChild(a);
1107
+ const u = document.createElement("div");
1108
+ u.className = "pluno-pa-widget__composer-meta";
1109
+ const s = document.createElement("a");
1110
+ 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.", u.appendChild(s);
1035
1111
  const b = document.createElement("span");
1036
- return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(b), e.appendChild(c), e;
1112
+ return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1113
+ }
1114
+ function ta() {
1115
+ const e = document.createElement("section");
1116
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1117
+ const t = document.createElement("div");
1118
+ t.className = "pluno-pa-widget__history-header";
1119
+ const n = document.createElement("strong");
1120
+ n.textContent = "Recent chats";
1121
+ const o = ze("pluno-pa-widget__history-close", "Close recent chats", da(), !1);
1122
+ t.append(n, o);
1123
+ const a = document.createElement("div");
1124
+ a.className = "pluno-pa-widget__history-list";
1125
+ const i = document.createElement("p");
1126
+ return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1037
1127
  }
1038
- function Oo(e) {
1128
+ function na(e) {
1039
1129
  const t = document.createElement("div");
1040
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(ee("pluno-pa-widget__character--empty", e)), t.appendChild(en()), t;
1130
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
1041
1131
  }
1042
- function en() {
1132
+ function un() {
1043
1133
  const e = document.createElement("div");
1044
1134
  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;
1045
1135
  }
1046
- function Uo(e, t) {
1136
+ function oa(e, t) {
1047
1137
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1048
1138
  const n = document.createElement("span");
1049
1139
  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`));
1050
1140
  }
1051
- function ee(e, t) {
1052
- const n = `pluno-pa-character-${yt}`;
1053
- yt += 1;
1054
- const o = t.scribbleStyle ? zo(t.accentColor, n) : Fo(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1141
+ function re(e, t) {
1142
+ const n = `pluno-pa-character-${Dt}`;
1143
+ Dt += 1;
1144
+ const o = t.scribbleStyle ? ia(t.accentColor, n) : aa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1055
1145
  return o.setAttribute(
1056
1146
  "class",
1057
1147
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1058
1148
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1059
1149
  }
1060
- function Fo(e, t) {
1061
- const n = Sn(e), o = {
1150
+ function aa(e, t) {
1151
+ const n = Un(e), o = {
1062
1152
  boltFill: `${t}-boltFill`,
1063
1153
  boltEdge: `${t}-boltEdge`,
1064
1154
  boltGlow: `${t}-boltGlow`,
@@ -1069,7 +1159,7 @@ function Fo(e, t) {
1069
1159
  eyeShadow: `${t}-eyeShadow`,
1070
1160
  pupilGloss: `${t}-pupilGloss`,
1071
1161
  boltClip: `${t}-boltClip`
1072
- }, a = tn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1162
+ }, a = gn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1073
1163
  id: o.boltFill,
1074
1164
  x1: "420",
1075
1165
  y1: "180",
@@ -1078,7 +1168,7 @@ function Fo(e, t) {
1078
1168
  gradientUnits: "userSpaceOnUse"
1079
1169
  });
1080
1170
  D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
1081
- const s = m(i, "linearGradient", {
1171
+ const p = m(i, "linearGradient", {
1082
1172
  id: o.boltEdge,
1083
1173
  x1: "470",
1084
1174
  y1: "145",
@@ -1086,28 +1176,28 @@ function Fo(e, t) {
1086
1176
  y2: "980",
1087
1177
  gradientUnits: "userSpaceOnUse"
1088
1178
  });
1089
- D(s, "0", n.edgeStart), D(s, "0.32", n.edgeMiddle), D(s, "0.78", n.edgeEnd), D(s, "1", n.edgeEnd);
1090
- const d = m(i, "radialGradient", {
1179
+ D(p, "0", n.edgeStart), D(p, "0.32", n.edgeMiddle), D(p, "0.78", n.edgeEnd), D(p, "1", n.edgeEnd);
1180
+ const c = m(i, "radialGradient", {
1091
1181
  id: o.boltGlow,
1092
1182
  cx: "50%",
1093
1183
  cy: "22%",
1094
1184
  r: "82%"
1095
1185
  });
1096
- D(d, "0", n.glow, "0.72"), D(d, "0.5", n.middle, "0.44"), D(d, "1", n.bottom, "0");
1097
- const c = m(i, "radialGradient", {
1186
+ D(c, "0", n.glow, "0.72"), D(c, "0.5", n.middle, "0.44"), D(c, "1", n.bottom, "0");
1187
+ const u = m(i, "radialGradient", {
1098
1188
  id: o.eyeWhite,
1099
1189
  cx: "35%",
1100
1190
  cy: "25%",
1101
1191
  r: "70%"
1102
1192
  });
1103
- D(c, "0", "#ffffff"), D(c, "0.72", "#ffffff"), D(c, "1", "#e5e5e5");
1104
- const p = m(i, "radialGradient", {
1193
+ D(u, "0", "#ffffff"), D(u, "0.72", "#ffffff"), D(u, "1", "#e5e5e5");
1194
+ const s = m(i, "radialGradient", {
1105
1195
  id: o.pupil,
1106
1196
  cx: "42%",
1107
1197
  cy: "38%",
1108
1198
  r: "65%"
1109
1199
  });
1110
- D(p, "0", "#2a1f10"), D(p, "0.52", "#080604"), D(p, "1", "#000000");
1200
+ D(s, "0", "#2a1f10"), D(s, "0.52", "#080604"), D(s, "1", "#000000");
1111
1201
  const b = m(i, "filter", {
1112
1202
  id: o.softDropShadow,
1113
1203
  x: "-18%",
@@ -1144,7 +1234,7 @@ function Fo(e, t) {
1144
1234
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1145
1235
  result: "innerLight"
1146
1236
  }), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
1147
- const A = m(i, "filter", {
1237
+ const P = m(i, "filter", {
1148
1238
  id: o.eyeShadow,
1149
1239
  x: "-24%",
1150
1240
  y: "-20%",
@@ -1152,14 +1242,14 @@ function Fo(e, t) {
1152
1242
  height: "148%",
1153
1243
  "color-interpolation-filters": "sRGB"
1154
1244
  });
1155
- m(A, "feDropShadow", {
1245
+ m(P, "feDropShadow", {
1156
1246
  dx: "0",
1157
1247
  dy: "8",
1158
1248
  stdDeviation: "5",
1159
1249
  "flood-color": n.shadow,
1160
1250
  "flood-opacity": "0.3"
1161
1251
  });
1162
- const E = m(i, "filter", {
1252
+ const k = m(i, "filter", {
1163
1253
  id: o.pupilGloss,
1164
1254
  x: "-15%",
1165
1255
  y: "-15%",
@@ -1167,29 +1257,29 @@ function Fo(e, t) {
1167
1257
  height: "130%",
1168
1258
  "color-interpolation-filters": "sRGB"
1169
1259
  });
1170
- m(E, "feDropShadow", {
1260
+ m(k, "feDropShadow", {
1171
1261
  dx: "0",
1172
1262
  dy: "3",
1173
1263
  stdDeviation: "3",
1174
1264
  "flood-color": "#000000",
1175
1265
  "flood-opacity": "0.22"
1176
1266
  });
1177
- const R = m(i, "clipPath", { id: o.boltClip });
1178
- m(R, "path", { d: Ae });
1179
- const v = m(a, "g", { filter: W(o.softDropShadow) });
1180
- m(v, "path", { d: Ae, fill: W(o.boltEdge) });
1181
- const y = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1182
- m(v, "path", {
1183
- d: y,
1184
- fill: W(o.boltFill),
1185
- filter: W(o.innerDepth)
1186
- }), m(v, "path", {
1187
- d: y,
1188
- fill: W(o.boltGlow),
1267
+ const O = m(i, "clipPath", { id: o.boltClip });
1268
+ m(O, "path", { d: Oe });
1269
+ const y = m(a, "g", { filter: $(o.softDropShadow) });
1270
+ m(y, "path", { d: Oe, fill: $(o.boltEdge) });
1271
+ const C = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1272
+ m(y, "path", {
1273
+ d: C,
1274
+ fill: $(o.boltFill),
1275
+ filter: $(o.innerDepth)
1276
+ }), m(y, "path", {
1277
+ d: C,
1278
+ fill: $(o.boltGlow),
1189
1279
  opacity: "0.74"
1190
1280
  });
1191
- const h = m(v, "g", {
1192
- "clip-path": W(o.boltClip),
1281
+ const h = m(y, "g", {
1282
+ "clip-path": $(o.boltClip),
1193
1283
  opacity: "0.42"
1194
1284
  });
1195
1285
  m(h, "path", {
@@ -1214,16 +1304,16 @@ function Fo(e, t) {
1214
1304
  "stroke-linecap": "round",
1215
1305
  opacity: "0.48"
1216
1306
  });
1217
- const g = m(a, "g", { filter: W(o.eyeShadow) });
1218
- return Lt(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Lt(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1307
+ const g = m(a, "g", { filter: $(o.eyeShadow) });
1308
+ return Ut(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Ut(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1219
1309
  }
1220
- function zo(e, t) {
1221
- const n = Wt(e), o = {
1310
+ function ia(e, t) {
1311
+ const n = Qt(e), o = {
1222
1312
  clip: `${t}-scribbleBoltClip`,
1223
1313
  wobble: `${t}-scribbleBoltWobble`
1224
- }, a = tn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1225
- m(l, "path", { d: Ae });
1226
- const s = m(i, "filter", {
1314
+ }, a = gn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1315
+ m(l, "path", { d: Oe });
1316
+ const p = m(i, "filter", {
1227
1317
  id: o.wobble,
1228
1318
  x: "-10%",
1229
1319
  y: "-10%",
@@ -1231,22 +1321,22 @@ function zo(e, t) {
1231
1321
  height: "120%",
1232
1322
  "color-interpolation-filters": "sRGB"
1233
1323
  });
1234
- m(s, "feTurbulence", {
1324
+ m(p, "feTurbulence", {
1235
1325
  type: "fractalNoise",
1236
1326
  baseFrequency: "0.011",
1237
1327
  numOctaves: "3",
1238
1328
  seed: "7",
1239
1329
  result: "noise"
1240
- }), m(s, "feDisplacementMap", {
1330
+ }), m(p, "feDisplacementMap", {
1241
1331
  in: "SourceGraphic",
1242
1332
  in2: "noise",
1243
1333
  scale: "16",
1244
1334
  xChannelSelector: "R",
1245
1335
  yChannelSelector: "G"
1246
1336
  });
1247
- const d = m(a, "g", { filter: W(o.wobble) }), c = m(d, "g", { "clip-path": W(o.clip) });
1248
- return m(c, "path", {
1249
- d: En(),
1337
+ const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
1338
+ return m(u, "path", {
1339
+ d: On(),
1250
1340
  fill: "none",
1251
1341
  stroke: n,
1252
1342
  "stroke-width": "56",
@@ -1254,70 +1344,70 @@ function zo(e, t) {
1254
1344
  "stroke-linejoin": "round",
1255
1345
  opacity: "0.9",
1256
1346
  transform: "rotate(-14 627 600)"
1257
- }), m(d, "path", {
1258
- d: Ae,
1347
+ }), m(c, "path", {
1348
+ d: Oe,
1259
1349
  fill: "none",
1260
- stroke: Pe,
1350
+ stroke: Ue,
1261
1351
  "stroke-width": "18",
1262
1352
  "stroke-linejoin": "round"
1263
- }), At(d, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), At(d, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
1353
+ }), Ft(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Ft(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
1264
1354
  }
1265
- function tn() {
1266
- return S("svg", {
1267
- xmlns: Xt,
1355
+ function gn() {
1356
+ return v("svg", {
1357
+ xmlns: pn,
1268
1358
  viewBox: "0 0 1254 1254"
1269
1359
  });
1270
1360
  }
1271
- function Lt(e, t, n, o, a, i, l, s, d) {
1272
- const c = m(e, "g", { transform: t });
1273
- m(c, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: W(d.eyeWhite) }), m(c, "ellipse", {
1361
+ function Ut(e, t, n, o, a, i, l, p, c) {
1362
+ const u = m(e, "g", { transform: t });
1363
+ m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
1274
1364
  cx: a,
1275
1365
  cy: i,
1276
1366
  rx: "49",
1277
1367
  ry: "57",
1278
- fill: W(d.pupil),
1279
- filter: W(d.pupilGloss)
1280
- }), m(c, "circle", { cx: l, cy: s, r: "18", fill: "#ffffff" });
1368
+ fill: $(c.pupil),
1369
+ filter: $(c.pupilGloss)
1370
+ }), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
1281
1371
  }
1282
- function At(e, t, n, o, a, i, l, s) {
1283
- const d = m(e, "g", { transform: t });
1284
- m(d, "ellipse", {
1372
+ function Ft(e, t, n, o, a, i, l, p) {
1373
+ const c = m(e, "g", { transform: t });
1374
+ m(c, "ellipse", {
1285
1375
  cx: n,
1286
1376
  cy: o,
1287
1377
  rx: "73",
1288
1378
  ry: "80",
1289
1379
  fill: "#ffffff",
1290
- stroke: Pe,
1380
+ stroke: Ue,
1291
1381
  "stroke-width": "13"
1292
- }), m(d, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Pe }), m(d, "circle", { cx: l, cy: s, r: "16", fill: "#ffffff" });
1382
+ }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Ue }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1293
1383
  }
1294
1384
  function m(e, t, n = {}) {
1295
- const o = S(t, n);
1385
+ const o = v(t, n);
1296
1386
  return e.appendChild(o), o;
1297
1387
  }
1298
1388
  function D(e, t, n, o) {
1299
1389
  const a = { offset: t, "stop-color": n };
1300
1390
  o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
1301
1391
  }
1302
- function W(e) {
1392
+ function $(e) {
1303
1393
  return `url(#${e})`;
1304
1394
  }
1305
- function nn(e, t, n, o) {
1395
+ function ze(e, t, n, o) {
1306
1396
  const a = document.createElement("button");
1307
1397
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1308
1398
  }
1309
- function Go() {
1310
- const e = S("svg", {
1399
+ function ra() {
1400
+ const e = v("svg", {
1311
1401
  class: "pluno-pa-widget__scribble-defs",
1312
1402
  "aria-hidden": "true",
1313
1403
  focusable: "false",
1314
1404
  width: "0",
1315
1405
  height: "0"
1316
- }), t = S("defs");
1317
- return t.appendChild(He("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(He("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(He("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1406
+ }), t = v("defs");
1407
+ return t.appendChild(Qe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Qe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Qe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1318
1408
  }
1319
- function on(e, t) {
1320
- const n = S("svg", {
1409
+ function hn(e, t) {
1410
+ const n = v("svg", {
1321
1411
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1322
1412
  viewBox: `0 0 ${t * 26} 36`,
1323
1413
  preserveAspectRatio: "none",
@@ -1325,9 +1415,9 @@ function on(e, t) {
1325
1415
  focusable: "false"
1326
1416
  });
1327
1417
  for (let o = 0; o < t; o += 1) {
1328
- const a = xt[o % xt.length], i = S("g", { transform: `translate(${o * 26} 0)` });
1418
+ const a = Nt[o % Nt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1329
1419
  i.appendChild(
1330
- S("ellipse", {
1420
+ v("ellipse", {
1331
1421
  cx: a.ellipseCx,
1332
1422
  cy: a.ellipseCy,
1333
1423
  rx: a.ellipseRx,
@@ -1338,7 +1428,7 @@ function on(e, t) {
1338
1428
  opacity: "0.8"
1339
1429
  })
1340
1430
  ), i.appendChild(
1341
- S("path", {
1431
+ v("path", {
1342
1432
  d: a.path,
1343
1433
  fill: "none",
1344
1434
  stroke: "#2c2a1e",
@@ -1349,10 +1439,10 @@ function on(e, t) {
1349
1439
  }
1350
1440
  return n;
1351
1441
  }
1352
- function He(e, t, n) {
1353
- const o = S("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1442
+ function Qe(e, t, n) {
1443
+ const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1354
1444
  return o.appendChild(
1355
- S("feTurbulence", {
1445
+ v("feTurbulence", {
1356
1446
  type: "fractalNoise",
1357
1447
  baseFrequency: "0.012 0.028",
1358
1448
  numOctaves: "3",
@@ -1360,7 +1450,7 @@ function He(e, t, n) {
1360
1450
  result: "stroke-noise"
1361
1451
  })
1362
1452
  ), o.appendChild(
1363
- S("feDisplacementMap", {
1453
+ v("feDisplacementMap", {
1364
1454
  in: "SourceGraphic",
1365
1455
  in2: "stroke-noise",
1366
1456
  scale: "3.5",
@@ -1369,7 +1459,7 @@ function He(e, t, n) {
1369
1459
  result: "warped"
1370
1460
  })
1371
1461
  ), o.appendChild(
1372
- S("feTurbulence", {
1462
+ v("feTurbulence", {
1373
1463
  type: "fractalNoise",
1374
1464
  baseFrequency: "0.7",
1375
1465
  numOctaves: "1",
@@ -1377,7 +1467,7 @@ function He(e, t, n) {
1377
1467
  result: "ink-noise"
1378
1468
  })
1379
1469
  ), o.appendChild(
1380
- S("feDisplacementMap", {
1470
+ v("feDisplacementMap", {
1381
1471
  in: "warped",
1382
1472
  in2: "ink-noise",
1383
1473
  scale: "0.9",
@@ -1386,30 +1476,38 @@ function He(e, t, n) {
1386
1476
  })
1387
1477
  ), o;
1388
1478
  }
1389
- function Wo(e) {
1390
- const t = te("0 0 24 24", e, e, "none", "currentColor", "2.25");
1391
- return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
1479
+ function la(e) {
1480
+ const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1481
+ return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1482
+ }
1483
+ function pa() {
1484
+ const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1485
+ return e.appendChild(v("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(v("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1486
+ }
1487
+ function sa() {
1488
+ const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1489
+ return e.appendChild(v("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(v("path", { d: "M3 4v5h5" })), e.appendChild(v("path", { d: "M12 7v5l3 2" })), e;
1392
1490
  }
1393
- function Ho() {
1394
- const e = te("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1395
- return e.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1491
+ function da() {
1492
+ const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
1493
+ return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1396
1494
  }
1397
- function an() {
1398
- const e = te("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1399
- return e.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
1495
+ function mn() {
1496
+ const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1497
+ return e.appendChild(v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1400
1498
  }
1401
- function $o() {
1402
- const e = te("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1499
+ function ca() {
1500
+ const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1403
1501
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1404
- S("path", {
1502
+ v("path", {
1405
1503
  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"
1406
1504
  })
1407
1505
  ), e;
1408
1506
  }
1409
- function qo() {
1410
- const e = te("0 0 24 24", 19, 19, "none", "currentColor");
1507
+ function ua() {
1508
+ const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1411
1509
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1412
- S("path", {
1510
+ v("path", {
1413
1511
  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",
1414
1512
  stroke: "currentColor",
1415
1513
  "stroke-width": "2",
@@ -1418,19 +1516,19 @@ function qo() {
1418
1516
  })
1419
1517
  ), e;
1420
1518
  }
1421
- function jo() {
1422
- const e = te("0 0 24 24", 18, 18, "currentColor");
1423
- return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1519
+ function ga() {
1520
+ const e = Z("0 0 24 24", 18, 18, "currentColor");
1521
+ return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1424
1522
  }
1425
- function Vo() {
1426
- const e = te("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1427
- return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
1523
+ function ha() {
1524
+ const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1525
+ return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1428
1526
  }
1429
- function Yo() {
1430
- const e = te("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1431
- return e.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1527
+ function ma() {
1528
+ const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1529
+ return e.appendChild(v("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(v("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1432
1530
  }
1433
- function te(e, t, n, o, a, i) {
1531
+ function Z(e, t, n, o, a, i) {
1434
1532
  const l = {
1435
1533
  viewBox: e,
1436
1534
  width: String(t),
@@ -1438,41 +1536,41 @@ function te(e, t, n, o, a, i) {
1438
1536
  fill: o,
1439
1537
  "aria-hidden": "true"
1440
1538
  };
1441
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
1539
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
1442
1540
  }
1443
- function S(e, t = {}) {
1444
- const n = document.createElementNS(Xt, e);
1541
+ function v(e, t = {}) {
1542
+ const n = document.createElementNS(pn, e);
1445
1543
  for (const [o, a] of Object.entries(t))
1446
1544
  n.setAttribute(o, a);
1447
1545
  return n;
1448
1546
  }
1449
- function Pt(e) {
1547
+ function zt(e) {
1450
1548
  for (const t of ["keydown", "keypress", "keyup"])
1451
1549
  e.addEventListener(t, (n) => {
1452
1550
  n.stopPropagation();
1453
1551
  });
1454
1552
  }
1455
- function Ko(e, t, n) {
1553
+ function ba(e, t, n) {
1456
1554
  e.replaceChildren(), e.hidden = t.length === 0;
1457
1555
  for (const [o, a] of t.entries()) {
1458
1556
  const i = document.createElement("div");
1459
- i.className = "pluno-pa-widget__attachment", i.appendChild(Xo(a));
1557
+ i.className = "pluno-pa-widget__attachment", i.appendChild(fa(a));
1460
1558
  const l = document.createElement("span");
1461
1559
  l.textContent = a.name, i.appendChild(l);
1462
- const s = document.createElement("button");
1463
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Vo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1560
+ const p = document.createElement("button");
1561
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ha()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1464
1562
  }
1465
1563
  }
1466
- function Xo(e) {
1467
- if (rn(e)) {
1564
+ function fa(e) {
1565
+ if (bn(e)) {
1468
1566
  const n = document.createElement("img");
1469
1567
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1470
1568
  }
1471
1569
  const t = document.createElement("span");
1472
1570
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1473
1571
  }
1474
- function Zo(e) {
1475
- if (rn(e)) {
1572
+ function wa(e) {
1573
+ if (bn(e)) {
1476
1574
  const a = document.createElement("img");
1477
1575
  return a.src = e.dataUrl, a.alt = e.name, a;
1478
1576
  }
@@ -1483,51 +1581,51 @@ function Zo(e) {
1483
1581
  const o = document.createElement("strong");
1484
1582
  return o.textContent = e.name, t.append(n, o), t;
1485
1583
  }
1486
- function rn(e) {
1584
+ function bn(e) {
1487
1585
  return e.mimeType.startsWith("image/");
1488
1586
  }
1489
- function Jo(e) {
1587
+ function _a(e) {
1490
1588
  return e === "application/pdf" ? "document.pdf" : "image";
1491
1589
  }
1492
- async function Qo(e) {
1590
+ async function xa(e) {
1493
1591
  if (!e)
1494
1592
  return [];
1495
1593
  const t = Array.from(e);
1496
- if (t.length > Te)
1497
- throw new Error(`Attach up to ${Te} files per message.`);
1594
+ if (t.length > Fe)
1595
+ throw new Error(`Attach up to ${Fe} files per message.`);
1498
1596
  return Promise.all(
1499
1597
  t.map(async (n) => {
1500
- const o = ea(n);
1598
+ const o = ya(n);
1501
1599
  if (!o)
1502
1600
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1503
- if (n.size > Jn)
1601
+ if (n.size > go)
1504
1602
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1505
1603
  if (o === "image/gif") {
1506
- const a = new Uint8Array(await sa(n));
1507
- if (na(a))
1604
+ const a = new Uint8Array(await Ta(n));
1605
+ if (Ca(a))
1508
1606
  throw new Error("Pluno supports non-animated GIF images.");
1509
1607
  }
1510
1608
  return {
1511
- name: n.name || Jo(o),
1609
+ name: n.name || _a(o),
1512
1610
  mimeType: o,
1513
1611
  sizeBytes: n.size,
1514
- dataUrl: ta(await da(n), o)
1612
+ dataUrl: va(await Na(n), o)
1515
1613
  };
1516
1614
  })
1517
1615
  );
1518
1616
  }
1519
- function ea(e) {
1520
- if (Vt.has(e.type))
1617
+ function ya(e) {
1618
+ if (an.has(e.type))
1521
1619
  return e.type;
1522
1620
  const t = e.name.toLowerCase();
1523
1621
  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;
1524
1622
  }
1525
- function ta(e, t) {
1623
+ function va(e, t) {
1526
1624
  const n = `data:${t};base64,`;
1527
1625
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1528
1626
  }
1529
- function na(e) {
1530
- if (e.length < 14 || !oa(e))
1627
+ function Ca(e) {
1628
+ if (e.length < 14 || !Ea(e))
1531
1629
  return !1;
1532
1630
  const t = e[10];
1533
1631
  let n = 13;
@@ -1538,7 +1636,7 @@ function na(e) {
1538
1636
  if (n += 1, a === 59)
1539
1637
  return !1;
1540
1638
  if (a === 33) {
1541
- n += 1, n = Tt(e, n);
1639
+ n += 1, n = Gt(e, n);
1542
1640
  continue;
1543
1641
  }
1544
1642
  if (a !== 44)
@@ -1550,14 +1648,14 @@ function na(e) {
1550
1648
  const i = e[n + 8];
1551
1649
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1552
1650
  return !1;
1553
- n += 1, n = Tt(e, n);
1651
+ n += 1, n = Gt(e, n);
1554
1652
  }
1555
1653
  return !1;
1556
1654
  }
1557
- function oa(e) {
1655
+ function Ea(e) {
1558
1656
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1559
1657
  }
1560
- function Tt(e, t) {
1658
+ function Gt(e, t) {
1561
1659
  for (; t < e.length; ) {
1562
1660
  const n = e[t];
1563
1661
  if (t += 1, n === 0)
@@ -1566,63 +1664,63 @@ function Tt(e, t) {
1566
1664
  }
1567
1665
  return t;
1568
1666
  }
1569
- function Se(e) {
1667
+ function Re(e) {
1570
1668
  return !!(e && Array.from(e.types).includes("Files"));
1571
1669
  }
1572
- function $e(e, t, n = null) {
1573
- if (!e || !Xe(t, n)) {
1670
+ function et(e, t, n = null) {
1671
+ if (!e || !rt(t, n)) {
1574
1672
  e && (e.hidden = !0, e.replaceChildren());
1575
1673
  return;
1576
1674
  }
1577
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", j(t) || Qe(n) ? e.appendChild(aa(t, n)) : ln(t) && e.appendChild(ia(t));
1675
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Sa(t, n)) : fn(t) && e.appendChild(ka(t));
1578
1676
  }
1579
- function aa(e, t) {
1677
+ function Sa(e, t) {
1580
1678
  const n = document.createElement("div");
1581
1679
  n.className = "pluno-pa-widget__billing-action-card";
1582
1680
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1583
1681
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1584
1682
  const i = document.createElement("span");
1585
- 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(pn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1683
+ 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(wn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1586
1684
  }
1587
- function ia(e) {
1685
+ function ka(e) {
1588
1686
  const t = document.createElement("div");
1589
1687
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1590
1688
  const n = document.createElement("strong");
1591
1689
  n.textContent = "Credits running low", t.appendChild(n);
1592
1690
  const o = document.createElement("span");
1593
- return o.textContent = la(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(pn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1691
+ return o.textContent = Pa(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1594
1692
  }
1595
- function Xe(e, t) {
1596
- return e !== null && (j(e) || ln(e) || Qe(t));
1693
+ function rt(e, t) {
1694
+ return e !== null && (X(e) || fn(e) || st(t));
1597
1695
  }
1598
- function Nt(e, t, n) {
1599
- return Xe(t, n) || ra(t) ? !0 : !Xe(e, n);
1696
+ function Ht(e, t, n) {
1697
+ return rt(t, n) || La(t) ? !0 : !rt(e, n);
1600
1698
  }
1601
- function ra(e) {
1602
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || j(e));
1699
+ function La(e) {
1700
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1603
1701
  }
1604
- function j(e) {
1702
+ function X(e) {
1605
1703
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1606
1704
  }
1607
- function Qe(e) {
1705
+ function st(e) {
1608
1706
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1609
1707
  }
1610
- function ln(e) {
1611
- return !j(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1708
+ function fn(e) {
1709
+ return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1612
1710
  }
1613
- function la(e) {
1614
- return e.creditsRemaining === null ? null : `${pa(e.creditsRemaining)} credits left`;
1711
+ function Pa(e) {
1712
+ return e.creditsRemaining === null ? null : `${Aa(e.creditsRemaining)} credits left`;
1615
1713
  }
1616
- function pa(e) {
1714
+ function Aa(e) {
1617
1715
  return new Intl.NumberFormat("en-US", {
1618
1716
  maximumFractionDigits: 0
1619
1717
  }).format(Math.ceil(e));
1620
1718
  }
1621
- function pn(e, t, n) {
1719
+ function wn(e, t, n) {
1622
1720
  const o = document.createElement("div");
1623
- return o.className = n, o.appendChild(It(t, e.pricingUrl)), o.appendChild(It("Earn credits", e.earnCreditsUrl)), o;
1721
+ return o.className = n, o.appendChild(Wt(t, e.pricingUrl)), o.appendChild(Wt("Earn credits", e.earnCreditsUrl)), o;
1624
1722
  }
1625
- function It(e, t) {
1723
+ function Wt(e, t) {
1626
1724
  const n = document.createElement("button");
1627
1725
  if (n.type = "button", e === "Earn credits") {
1628
1726
  const o = document.createElement("span");
@@ -1633,7 +1731,7 @@ function It(e, t) {
1633
1731
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1634
1732
  }), n;
1635
1733
  }
1636
- function sa(e) {
1734
+ function Ta(e) {
1637
1735
  return new Promise((t, n) => {
1638
1736
  const o = new FileReader();
1639
1737
  o.addEventListener("load", () => {
@@ -1647,7 +1745,7 @@ function sa(e) {
1647
1745
  }), o.readAsArrayBuffer(e);
1648
1746
  });
1649
1747
  }
1650
- function da(e) {
1748
+ function Na(e) {
1651
1749
  return new Promise((t, n) => {
1652
1750
  const o = new FileReader();
1653
1751
  o.addEventListener("load", () => {
@@ -1661,167 +1759,170 @@ function da(e) {
1661
1759
  }), o.readAsDataURL(e);
1662
1760
  });
1663
1761
  }
1664
- function Dt(e, t) {
1665
- return e.messages.filter((o) => !sn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1666
- }
1667
- function ca(e, t, n, o, a, i, l, s, d, c, p, b, x, A, E) {
1668
- const R = [...i.messages], v = R.filter((w) => !sn(w)), y = e.scrollTop;
1669
- e.replaceChildren(), cn(n, i.isThinking), a.hidden = !s, s && l !== null && Uo(a, l);
1670
- const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1671
- if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1672
- const w = document.createElement("div");
1673
- w.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1674
- const f = document.createElement("div");
1675
- f.className = "pluno-pa-widget__empty-hero";
1676
- const I = ee("pluno-pa-widget__character--empty", x());
1677
- f.appendChild(I), w.appendChild(f), w.appendChild(en());
1678
- const P = document.createElement("div");
1679
- 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)
1680
- for (const M of i.starterPrompts) {
1681
- const T = document.createElement("button");
1682
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${M}"`, T.addEventListener("click", () => {
1683
- A(M);
1684
- }), P.appendChild(T);
1762
+ function $t(e, t) {
1763
+ return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1764
+ }
1765
+ function Ia(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1766
+ const O = [...i.messages], y = O.filter((_) => !_n(_)), C = e.scrollTop;
1767
+ e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && oa(a, l);
1768
+ const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
1769
+ if (o.hidden = !h, y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1770
+ const _ = document.createElement("div");
1771
+ _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1772
+ const L = document.createElement("div");
1773
+ L.className = "pluno-pa-widget__empty-hero";
1774
+ const G = re("pluno-pa-widget__character--empty", x());
1775
+ L.appendChild(G), _.appendChild(L), _.appendChild(un());
1776
+ const M = document.createElement("div");
1777
+ if (M.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 && !i.starterPromptsLoading && M.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1778
+ for (const f of i.starterPrompts) {
1779
+ const A = document.createElement("button");
1780
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
1781
+ P(f);
1782
+ }), M.appendChild(A);
1685
1783
  }
1686
- else
1687
- for (let M = 0; M < eo; M += 1) {
1688
- const T = document.createElement("button");
1689
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.innerHTML = "&nbsp;", P.appendChild(T);
1784
+ else if (i.starterPromptsLoading) {
1785
+ const f = document.createElement("button");
1786
+ f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", M.appendChild(f);
1787
+ } else
1788
+ for (let f = 0; f < mo; f += 1) {
1789
+ const A = document.createElement("button");
1790
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", M.appendChild(A);
1690
1791
  }
1691
- w.appendChild(P), e.appendChild(w), e.appendChild(t);
1792
+ _.appendChild(M), e.appendChild(_), e.appendChild(t);
1692
1793
  return;
1693
1794
  }
1694
- let g = null, C = null, N = [];
1695
- const ne = () => {
1696
- if (N.length === 0)
1795
+ let g = null, E = null, I = [];
1796
+ const le = () => {
1797
+ if (I.length === 0)
1697
1798
  return !1;
1698
- const w = _a(N, p, b, x());
1699
- return e.appendChild(w), g = null, C = w, N = [], !0;
1799
+ const _ = za(I, s, b, x());
1800
+ return e.appendChild(_), g = null, E = _, I = [], !0;
1700
1801
  };
1701
- for (let w = 0; w < v.length; w += 1) {
1702
- const f = v[w];
1703
- if (f.role === "tool") {
1704
- N.push(f);
1802
+ for (let _ = 0; _ < y.length; _ += 1) {
1803
+ const L = y[_];
1804
+ if (L.role === "tool") {
1805
+ I.push(L);
1705
1806
  continue;
1706
1807
  }
1707
- if (f.role === "system")
1808
+ if (L.role === "system")
1708
1809
  continue;
1709
- const I = ne(), P = Bt(f.content);
1710
- if (f.role === "assistant" && !I) {
1711
- const _ = Ze(x());
1712
- e.appendChild(_), g = null, C = _;
1810
+ const G = le(), M = Vt(L.content);
1811
+ if (L.role === "assistant" && !G) {
1812
+ const T = lt(x());
1813
+ e.appendChild(T), g = null, E = T;
1713
1814
  }
1714
- const M = document.createElement("div");
1715
- M.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ot(M, P) : M.textContent = P, f.role === "user" && f.attachments?.length && M.appendChild(ua(f.attachments));
1716
- const T = document.createElement("div");
1717
- T.className = "pluno-pa-widget__message-actions", T.appendChild(Mt(P)), M.appendChild(T), e.appendChild(M), g = M, C = null;
1815
+ const f = document.createElement("div");
1816
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Da(L.attachments));
1817
+ const A = document.createElement("div");
1818
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(jt(M)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1718
1819
  }
1719
- const ge = ne();
1820
+ const xe = le();
1720
1821
  if (i.assistantDraft) {
1721
- if (!ge) {
1722
- const P = Ze(x());
1723
- e.appendChild(P), g = null, C = P;
1724
- }
1725
- const w = Bt(i.assistantDraft), f = document.createElement("div");
1726
- f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ot(f, w);
1727
- const I = document.createElement("div");
1728
- I.className = "pluno-pa-widget__message-actions", I.appendChild(Mt(w)), f.appendChild(I), e.appendChild(f), g = f, C = null;
1822
+ if (!xe) {
1823
+ const M = lt(x());
1824
+ e.appendChild(M), g = null, E = M;
1825
+ }
1826
+ const _ = Vt(i.assistantDraft), L = document.createElement("div");
1827
+ L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Yt(L, _);
1828
+ const G = document.createElement("div");
1829
+ G.className = "pluno-pa-widget__message-actions", G.appendChild(jt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
1729
1830
  }
1730
1831
  if (i.isThinking && !i.assistantDraft)
1731
- if (ge) {
1732
- const w = dn();
1733
- e.appendChild(w), g = null, C = w;
1832
+ if (xe) {
1833
+ const _ = xn();
1834
+ e.appendChild(_), g = null, E = _;
1734
1835
  } else {
1735
- const w = xa(x());
1736
- e.appendChild(w), g = null, C = w;
1836
+ const _ = Ga(x());
1837
+ e.appendChild(_), g = null, E = _;
1737
1838
  }
1738
1839
  if (i.lastError) {
1739
- const w = document.createElement("div");
1740
- w.className = "pluno-pa-widget__error", w.textContent = i.lastError, e.appendChild(w), g = w, C = null;
1840
+ const _ = document.createElement("div");
1841
+ _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
1741
1842
  }
1742
- const L = E && !i.isThinking ? Pn(R) : null;
1743
- if (E && L && !E.dismissedCandidateIds.has(L.id)) {
1744
- const w = ga(L, {
1745
- isDrafting: E.draftingCandidateId === L.id,
1746
- error: E.error,
1747
- characterIconOptions: E.characterIconOptions,
1748
- onDraft: E.onDraft,
1749
- onDismiss: E.onDismiss,
1750
- onDisable: E.onDisable
1843
+ const R = k && !i.isThinking ? Hn(O) : null;
1844
+ if (k && R && !k.dismissedCandidateIds.has(R.id)) {
1845
+ const _ = Ra(R, {
1846
+ isDrafting: k.draftingCandidateId === R.id,
1847
+ error: k.error,
1848
+ characterIconOptions: k.characterIconOptions,
1849
+ onDraft: k.onDraft,
1850
+ onDismiss: k.onDismiss,
1851
+ onDisable: k.onDisable
1751
1852
  });
1752
- e.appendChild(w), E.onSeen(L), g = null, C = w;
1853
+ e.appendChild(_), k.onSeen(R), g = null, E = _;
1753
1854
  }
1754
- g?.classList.add("pluno-pa-widget__message--bottom-reserve"), C?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), d ? fe(e, c) : e.scrollTop = y;
1755
- }
1756
- function Rt(e, t, n, o, a, i, l, s) {
1757
- e.replaceChildren(), cn(t, !1), t.disabled = !0, n.hidden = !0;
1758
- const d = document.createElement("div");
1759
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1760
- const c = ee("pluno-pa-widget__character--empty", o());
1761
- d.appendChild(c);
1762
- const p = document.createElement("div");
1763
- if (p.className = "pluno-pa-widget__empty", p.textContent = a, d.appendChild(p), l) {
1855
+ g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? Se(e, u) : e.scrollTop = C;
1856
+ }
1857
+ function qt(e, t, n, o, a, i, l, p) {
1858
+ e.replaceChildren(), yn(t, !1), t.disabled = !0, n.hidden = !0;
1859
+ const c = document.createElement("div");
1860
+ c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1861
+ const u = re("pluno-pa-widget__character--empty", o());
1862
+ c.appendChild(u);
1863
+ const s = document.createElement("div");
1864
+ if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
1764
1865
  const b = document.createElement("a");
1765
- b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, d.appendChild(b);
1866
+ b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, c.appendChild(b);
1766
1867
  } else {
1767
1868
  const b = document.createElement("button");
1768
- b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => s?.()), d.appendChild(b);
1869
+ b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => p?.()), c.appendChild(b);
1769
1870
  }
1770
- e.appendChild(d);
1871
+ e.appendChild(c);
1771
1872
  }
1772
- function ua(e) {
1873
+ function Da(e) {
1773
1874
  const t = document.createElement("div");
1774
1875
  t.className = "pluno-pa-widget__message-attachments";
1775
1876
  for (const n of e)
1776
- t.appendChild(Zo(n));
1877
+ t.appendChild(wa(n));
1777
1878
  return t;
1778
1879
  }
1779
- function Mt(e) {
1880
+ function jt(e) {
1780
1881
  const t = document.createElement("button");
1781
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Yo()), t.addEventListener("click", (n) => {
1882
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ma()), t.addEventListener("click", (n) => {
1782
1883
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1783
1884
  }), t;
1784
1885
  }
1785
- function ga(e, t) {
1886
+ function Ra(e, t) {
1786
1887
  const n = document.createElement("article");
1787
1888
  n.className = "pluno-pa-widget__share-prompt";
1788
1889
  const o = document.createElement("div");
1789
- o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(ee("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
1890
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(re("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
1790
1891
  const a = document.createElement("div");
1791
1892
  a.className = "pluno-pa-widget__share-prompt-copy";
1792
1893
  const i = document.createElement("strong");
1793
1894
  i.textContent = "Share this win?", a.appendChild(i);
1794
1895
  const l = document.createElement("span");
1795
1896
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
1796
- const p = document.createElement("span");
1797
- p.className = "pluno-pa-widget__share-prompt-error", p.textContent = t.error, a.appendChild(p);
1897
+ const s = document.createElement("span");
1898
+ s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
1798
1899
  }
1799
1900
  o.appendChild(a);
1800
- const s = document.createElement("div");
1801
- s.className = "pluno-pa-widget__share-prompt-actions";
1802
- const d = document.createElement("div");
1803
- d.className = "pluno-pa-widget__share-prompt-primary-actions";
1804
- const c = document.createElement("button");
1805
- if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
1901
+ const p = document.createElement("div");
1902
+ p.className = "pluno-pa-widget__share-prompt-actions";
1903
+ const c = document.createElement("div");
1904
+ c.className = "pluno-pa-widget__share-prompt-primary-actions";
1905
+ const u = document.createElement("button");
1906
+ if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
1806
1907
  t.onDraft(e);
1807
- }), t.isDrafting ? (c.appendChild(Je()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
1808
- s.appendChild(d);
1908
+ }), t.isDrafting ? (u.appendChild(pt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1909
+ p.appendChild(c);
1809
1910
  else {
1810
- const p = document.createElement("button");
1811
- 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", () => {
1911
+ const s = document.createElement("button");
1912
+ 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", () => {
1812
1913
  t.onDismiss(e);
1813
- }), d.appendChild(p), s.appendChild(d);
1914
+ }), c.appendChild(s), p.appendChild(c);
1814
1915
  const b = document.createElement("button");
1815
1916
  b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1816
1917
  t.onDisable(e);
1817
- }), s.appendChild(b);
1918
+ }), p.appendChild(b);
1818
1919
  }
1819
- return o.appendChild(s), n.appendChild(o), n;
1920
+ return o.appendChild(p), n.appendChild(o), n;
1820
1921
  }
1821
- function ha(e, t) {
1922
+ function Ma(e, t) {
1822
1923
  const n = document.createElement("div");
1823
- n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1824
- v.target === n && t.onClose();
1924
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1925
+ y.target === n && t.onClose();
1825
1926
  });
1826
1927
  const o = document.createElement("section");
1827
1928
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
@@ -1829,57 +1930,57 @@ function ha(e, t) {
1829
1930
  i.textContent = "Share this win", a.appendChild(i);
1830
1931
  const l = document.createElement("button");
1831
1932
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
1832
- const s = document.createElement("p");
1833
- s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
1834
- const d = document.createElement("div");
1835
- d.className = "pluno-pa-widget__share-dialog-step";
1933
+ const p = document.createElement("p");
1934
+ p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
1836
1935
  const c = document.createElement("div");
1837
- c.className = "pluno-pa-widget__share-dialog-step-header";
1838
- const p = document.createElement("strong");
1839
- p.textContent = "1) Copy Screenshot", c.appendChild(p);
1840
- const b = ma("Copy Screenshot", async () => {
1936
+ c.className = "pluno-pa-widget__share-dialog-step";
1937
+ const u = document.createElement("div");
1938
+ u.className = "pluno-pa-widget__share-dialog-step-header";
1939
+ const s = document.createElement("strong");
1940
+ s.textContent = "1) Copy Screenshot", u.appendChild(s);
1941
+ const b = Ba("Copy Screenshot", async () => {
1841
1942
  try {
1842
- return await Tn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1943
+ return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1843
1944
  } catch {
1844
- return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1945
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1845
1946
  }
1846
1947
  });
1847
- if (c.appendChild(b), d.appendChild(c), e.screenshotDataUrl) {
1848
- const v = document.createElement("div");
1849
- v.className = "pluno-pa-widget__share-dialog-screenshot";
1850
- const y = document.createElement("img");
1851
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), d.appendChild(v);
1948
+ if (u.appendChild(b), c.appendChild(u), e.screenshotDataUrl) {
1949
+ const y = document.createElement("div");
1950
+ y.className = "pluno-pa-widget__share-dialog-screenshot";
1951
+ const C = document.createElement("img");
1952
+ C.src = e.screenshotDataUrl, C.alt = "Product page with Pluno open", y.appendChild(C), c.appendChild(y);
1852
1953
  }
1853
- o.appendChild(d), o.appendChild(s);
1954
+ o.appendChild(c), o.appendChild(p);
1854
1955
  const x = document.createElement("div");
1855
1956
  x.className = "pluno-pa-widget__share-dialog-step";
1856
- const A = document.createElement("strong");
1857
- A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
1858
- const E = document.createElement("p");
1859
- E.className = "pluno-pa-widget__share-dialog-hint", E.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(E);
1860
- const R = document.createElement("footer");
1861
- R.className = "pluno-pa-widget__share-dialog-platforms";
1862
- for (const v of ba(e)) {
1863
- const y = document.createElement("a");
1864
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(fa(v.id)), R.appendChild(y);
1957
+ const P = document.createElement("strong");
1958
+ P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
1959
+ const k = document.createElement("p");
1960
+ k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
1961
+ const O = document.createElement("footer");
1962
+ O.className = "pluno-pa-widget__share-dialog-platforms";
1963
+ for (const y of Oa(e)) {
1964
+ const C = document.createElement("a");
1965
+ C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Ua(y.id)), O.appendChild(C);
1865
1966
  }
1866
- if (x.appendChild(R), o.appendChild(x), t.socialPostRewardsUrl) {
1867
- const v = document.createElement("div");
1868
- v.className = "pluno-pa-widget__share-dialog-step";
1869
- const y = document.createElement("strong");
1870
- y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1967
+ if (x.appendChild(O), o.appendChild(x), t.socialPostRewardsUrl) {
1968
+ const y = document.createElement("div");
1969
+ y.className = "pluno-pa-widget__share-dialog-step";
1970
+ const C = document.createElement("strong");
1971
+ C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
1871
1972
  const h = document.createElement("a");
1872
- 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(wa()), v.appendChild(h), o.appendChild(v);
1973
+ 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(Fa()), y.appendChild(h), o.appendChild(y);
1873
1974
  }
1874
1975
  return n.appendChild(o), n;
1875
1976
  }
1876
- function ma(e, t) {
1977
+ function Ba(e, t) {
1877
1978
  const n = document.createElement("button");
1878
1979
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1879
1980
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1880
1981
  }), n;
1881
1982
  }
1882
- function ba(e) {
1983
+ function Oa(e) {
1883
1984
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1884
1985
  return [
1885
1986
  {
@@ -1899,56 +2000,56 @@ function ba(e) {
1899
2000
  }
1900
2001
  ];
1901
2002
  }
1902
- function fa(e) {
2003
+ function Ua(e) {
1903
2004
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1904
- 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" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(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"), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(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"), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(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"), B(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"), B(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"), B(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);
2005
+ 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" ? (F(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), F(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"), F(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), F(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"), F(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (F(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), F(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), F(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (F(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"), F(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"), F(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"), F(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);
1905
2006
  }
1906
- function B(e, t, n) {
2007
+ function F(e, t, n) {
1907
2008
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1908
2009
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1909
2010
  }
1910
- function wa() {
2011
+ function Fa() {
1911
2012
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1912
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
2013
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), F(e, "M14 5h5v5"), F(e, "M19 5l-8 8"), F(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1913
2014
  }
1914
- function sn(e) {
1915
- return e.role === "tool" && e.toolName === $t;
2015
+ function _n(e) {
2016
+ return e.role === "tool" && e.toolName === tn;
1916
2017
  }
1917
- function Bt(e) {
2018
+ function Vt(e) {
1918
2019
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1919
2020
  }
1920
- function _a(e, t, n, o) {
2021
+ function za(e, t, n, o) {
1921
2022
  const a = document.createElement("article");
1922
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ee("pluno-pa-widget__character--tool-group", o));
1923
- const i = document.createElement("details"), l = va(e);
2023
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(re("pluno-pa-widget__character--tool-group", o));
2024
+ const i = document.createElement("details"), l = Ha(e);
1924
2025
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1925
2026
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1926
2027
  });
1927
- const s = document.createElement("summary");
1928
- s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Je());
1929
- const c = document.createElement("span");
1930
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", s.appendChild(c), i.appendChild(s), e.length > 0) {
1931
- const p = document.createElement("div");
1932
- p.className = "pluno-pa-widget__tool-lines";
2028
+ const p = document.createElement("summary");
2029
+ p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(pt());
2030
+ const u = document.createElement("span");
2031
+ if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), i.appendChild(p), e.length > 0) {
2032
+ const s = document.createElement("div");
2033
+ s.className = "pluno-pa-widget__tool-lines";
1933
2034
  for (const b of e) {
1934
2035
  const x = document.createElement("div");
1935
- x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(Je());
1936
- const A = document.createElement("span");
1937
- A.textContent = b.content || "Run tool", x.appendChild(A), p.appendChild(x);
2036
+ x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(pt());
2037
+ const P = document.createElement("span");
2038
+ P.textContent = b.content || "Run tool", x.appendChild(P), s.appendChild(x);
1938
2039
  }
1939
- i.appendChild(p);
2040
+ i.appendChild(s);
1940
2041
  }
1941
2042
  return a.appendChild(i), a;
1942
2043
  }
1943
- function Ze(e) {
2044
+ function lt(e) {
1944
2045
  const t = document.createElement("article");
1945
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ee("pluno-pa-widget__character--tool-group", e)), t;
2046
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
1946
2047
  }
1947
- function xa(e) {
1948
- const t = Ze(e);
1949
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(dn()), t;
2048
+ function Ga(e) {
2049
+ const t = lt(e);
2050
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
1950
2051
  }
1951
- function dn() {
2052
+ function xn() {
1952
2053
  const e = document.createElement("div");
1953
2054
  e.className = "pluno-pa-widget__status";
1954
2055
  const t = document.createElement("span");
@@ -1956,17 +2057,17 @@ function dn() {
1956
2057
  const n = document.createElement("span");
1957
2058
  return n.textContent = "Thinking...", e.appendChild(n), e;
1958
2059
  }
1959
- function va(e) {
2060
+ function Ha(e) {
1960
2061
  return `tools:${e[0]?.id ?? ""}`;
1961
2062
  }
1962
- function Je() {
2063
+ function pt() {
1963
2064
  const e = document.createElement("span");
1964
2065
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1965
2066
  }
1966
- function cn(e, t) {
1967
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? jo() : an());
2067
+ function yn(e, t) {
2068
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ga() : mn());
1968
2069
  }
1969
- function Ot(e, t) {
2070
+ function Yt(e, t) {
1970
2071
  const n = t.replace(/\r\n/g, `
1971
2072
  `).split(`
1972
2073
  `);
@@ -1978,49 +2079,49 @@ function Ot(e, t) {
1978
2079
  continue;
1979
2080
  }
1980
2081
  if (a.match(/^```(\w+)?\s*$/)) {
1981
- const c = [];
2082
+ const u = [];
1982
2083
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1983
- c.push(n[o]), o += 1;
2084
+ u.push(n[o]), o += 1;
1984
2085
  o += o < n.length ? 1 : 0;
1985
- const p = document.createElement("pre"), b = document.createElement("code");
1986
- b.textContent = c.join(`
1987
- `), p.appendChild(b), e.appendChild(p);
2086
+ const s = document.createElement("pre"), b = document.createElement("code");
2087
+ b.textContent = u.join(`
2088
+ `), s.appendChild(b), e.appendChild(s);
1988
2089
  continue;
1989
2090
  }
1990
2091
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1991
2092
  if (l) {
1992
- const c = document.createElement(`h${l[1].length + 2}`);
1993
- ke(c, l[2]), e.appendChild(c), o += 1;
2093
+ const u = document.createElement(`h${l[1].length + 2}`);
2094
+ Me(u, l[2]), e.appendChild(u), o += 1;
1994
2095
  continue;
1995
2096
  }
1996
2097
  if (/^\s*[-*+]\s+/.test(a)) {
1997
- const c = document.createElement("ul");
2098
+ const u = document.createElement("ul");
1998
2099
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1999
- const p = document.createElement("li");
2000
- ke(p, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(p), o += 1;
2100
+ const s = document.createElement("li");
2101
+ Me(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2001
2102
  }
2002
- e.appendChild(c);
2103
+ e.appendChild(u);
2003
2104
  continue;
2004
2105
  }
2005
2106
  if (/^\s*\d+\.\s+/.test(a)) {
2006
- const c = document.createElement("ol");
2107
+ const u = document.createElement("ol");
2007
2108
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
2008
- const p = document.createElement("li");
2009
- ke(p, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(p), o += 1;
2109
+ const s = document.createElement("li");
2110
+ Me(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2010
2111
  }
2011
- e.appendChild(c);
2112
+ e.appendChild(u);
2012
2113
  continue;
2013
2114
  }
2014
- const s = [a];
2115
+ const p = [a];
2015
2116
  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]); )
2016
- s.push(n[o]), o += 1;
2017
- const d = document.createElement("p");
2018
- s.forEach((c, p) => {
2019
- p > 0 && d.appendChild(document.createElement("br")), ke(d, c);
2020
- }), e.appendChild(d);
2117
+ p.push(n[o]), o += 1;
2118
+ const c = document.createElement("p");
2119
+ p.forEach((u, s) => {
2120
+ s > 0 && c.appendChild(document.createElement("br")), Me(c, u);
2121
+ }), e.appendChild(c);
2021
2122
  }
2022
2123
  }
2023
- function ke(e, t) {
2124
+ function Me(e, t) {
2024
2125
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2025
2126
  let o = 0;
2026
2127
  for (const a of t.matchAll(n)) {
@@ -2028,19 +2129,19 @@ function ke(e, t) {
2028
2129
  i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
2029
2130
  const l = a[0];
2030
2131
  if (l.startsWith("`")) {
2031
- const s = document.createElement("code");
2032
- s.textContent = l.slice(1, -1), e.appendChild(s);
2132
+ const p = document.createElement("code");
2133
+ p.textContent = l.slice(1, -1), e.appendChild(p);
2033
2134
  } else if (l.startsWith("**")) {
2034
- const s = document.createElement("strong");
2035
- s.textContent = l.slice(2, -2), e.appendChild(s);
2135
+ const p = document.createElement("strong");
2136
+ p.textContent = l.slice(2, -2), e.appendChild(p);
2036
2137
  } else if (l.startsWith("*")) {
2037
- const s = document.createElement("em");
2038
- s.textContent = l.slice(1, -1), e.appendChild(s);
2138
+ const p = document.createElement("em");
2139
+ p.textContent = l.slice(1, -1), e.appendChild(p);
2039
2140
  } else {
2040
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2041
- if (s && ya(s[2])) {
2042
- const d = document.createElement("a");
2043
- d.href = s[2], d.target = "_top", d.rel = "noreferrer", d.textContent = s[1], e.appendChild(d);
2141
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2142
+ if (p && Wa(p[2])) {
2143
+ const c = document.createElement("a");
2144
+ c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2044
2145
  } else
2045
2146
  e.appendChild(document.createTextNode(l));
2046
2147
  }
@@ -2048,7 +2149,7 @@ function ke(e, t) {
2048
2149
  }
2049
2150
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2050
2151
  }
2051
- function ya(e) {
2152
+ function Wa(e) {
2052
2153
  if (e.startsWith("/") || e.startsWith("#"))
2053
2154
  return !0;
2054
2155
  try {
@@ -2058,8 +2159,8 @@ function ya(e) {
2058
2159
  return !1;
2059
2160
  }
2060
2161
  }
2061
- function Ut(e, t) {
2062
- if (Ca(e))
2162
+ function Kt(e, t) {
2163
+ if ($a(e))
2063
2164
  return;
2064
2165
  const n = `
2065
2166
  :host {
@@ -2112,7 +2213,7 @@ function Ut(e, t) {
2112
2213
  --pluno-pa-accent-contrast: #fafafa;
2113
2214
  position: fixed;
2114
2215
  z-index: 2147483645;
2115
- font-family: ${q.fontFamily};
2216
+ font-family: ${K.fontFamily};
2116
2217
  font-size: 14px;
2117
2218
  color: var(--pluno-pa-text);
2118
2219
  width: var(--pluno-pa-launcher-width);
@@ -2405,9 +2506,9 @@ function Ut(e, t) {
2405
2506
  .pluno-pa-widget__timeline-jump:active {
2406
2507
  transform: translateX(-50%) scale(0.98);
2407
2508
  }
2509
+ .pluno-pa-widget__history,
2408
2510
  .pluno-pa-widget__new-chat {
2409
2511
  position: absolute;
2410
- right: 14px;
2411
2512
  bottom: 14px;
2412
2513
  z-index: 2;
2413
2514
  width: 36px;
@@ -2427,13 +2528,142 @@ function Ut(e, t) {
2427
2528
  transform 120ms ease,
2428
2529
  box-shadow 120ms ease;
2429
2530
  }
2531
+ .pluno-pa-widget__history {
2532
+ right: 58px;
2533
+ }
2534
+ .pluno-pa-widget__new-chat {
2535
+ right: 14px;
2536
+ }
2537
+ .pluno-pa-widget__history:hover:not(:disabled),
2430
2538
  .pluno-pa-widget__new-chat:hover:not(:disabled) {
2431
2539
  background: var(--pluno-pa-surface);
2432
2540
  box-shadow: 0 8px 18px rgba(24, 24, 27, 0.1);
2433
2541
  }
2542
+ .pluno-pa-widget__history:active:not(:disabled),
2434
2543
  .pluno-pa-widget__new-chat:active:not(:disabled) {
2435
2544
  transform: scale(0.96);
2436
2545
  }
2546
+ .pluno-pa-widget__history-panel {
2547
+ position: absolute;
2548
+ right: 18px;
2549
+ bottom: 116px;
2550
+ z-index: 4;
2551
+ display: grid;
2552
+ grid-template-rows: auto minmax(0, 1fr) auto;
2553
+ gap: 7px;
2554
+ box-sizing: border-box;
2555
+ width: min(260px, calc(100% - 36px));
2556
+ max-height: min(270px, calc(100% - 170px));
2557
+ border: 1px solid var(--pluno-pa-divider);
2558
+ border-radius: 8px;
2559
+ background: color-mix(in srgb, var(--pluno-pa-bg) 96%, transparent);
2560
+ color: var(--pluno-pa-text);
2561
+ box-shadow: 0 16px 36px rgba(24, 24, 27, 0.18);
2562
+ padding: 8px;
2563
+ }
2564
+ .pluno-pa-widget__history-header {
2565
+ display: flex;
2566
+ align-items: center;
2567
+ justify-content: space-between;
2568
+ gap: 8px;
2569
+ }
2570
+ .pluno-pa-widget__history-header strong {
2571
+ min-width: 0;
2572
+ overflow: hidden;
2573
+ text-overflow: ellipsis;
2574
+ white-space: nowrap;
2575
+ font-size: 12px;
2576
+ line-height: 1.2;
2577
+ }
2578
+ .pluno-pa-widget__history-close {
2579
+ border: 1px solid var(--pluno-pa-divider);
2580
+ border-radius: 6px;
2581
+ background: var(--pluno-pa-surface);
2582
+ color: var(--pluno-pa-text);
2583
+ font: inherit;
2584
+ font-size: 12px;
2585
+ cursor: pointer;
2586
+ }
2587
+ .pluno-pa-widget__history-close {
2588
+ display: inline-flex;
2589
+ width: 24px;
2590
+ height: 24px;
2591
+ align-items: center;
2592
+ justify-content: center;
2593
+ padding: 0;
2594
+ }
2595
+ .pluno-pa-widget__history-list {
2596
+ display: grid;
2597
+ gap: 5px;
2598
+ align-content: start;
2599
+ min-height: 0;
2600
+ overflow: auto;
2601
+ }
2602
+ .pluno-pa-widget__history-list--center {
2603
+ align-content: center;
2604
+ justify-items: center;
2605
+ }
2606
+ .pluno-pa-widget__history-loading {
2607
+ justify-self: center;
2608
+ margin: 0;
2609
+ }
2610
+ .pluno-pa-widget__history-loading--inline {
2611
+ padding: 4px 0;
2612
+ }
2613
+ .pluno-pa-widget__history-item {
2614
+ display: grid;
2615
+ grid-template-columns: minmax(0, 1fr) auto;
2616
+ gap: 3px;
2617
+ width: 100%;
2618
+ border: 1px solid var(--pluno-pa-divider);
2619
+ border-radius: 6px;
2620
+ padding: 5px 7px;
2621
+ background: var(--pluno-pa-surface);
2622
+ color: var(--pluno-pa-text);
2623
+ font: inherit;
2624
+ text-align: left;
2625
+ cursor: pointer;
2626
+ }
2627
+ .pluno-pa-widget__history-item:hover:not(:disabled),
2628
+ .pluno-pa-widget__history-item:focus-visible,
2629
+ .pluno-pa-widget__history-close:hover,
2630
+ .pluno-pa-widget__history-close:focus-visible {
2631
+ border-color: color-mix(in srgb, var(--pluno-pa-accent) 42%, var(--pluno-pa-divider));
2632
+ background: color-mix(in srgb, var(--pluno-pa-accent) 8%, var(--pluno-pa-surface));
2633
+ }
2634
+ .pluno-pa-widget__history-item span,
2635
+ .pluno-pa-widget__history-item time,
2636
+ .pluno-pa-widget__history-item small {
2637
+ min-width: 0;
2638
+ overflow: hidden;
2639
+ text-overflow: ellipsis;
2640
+ white-space: nowrap;
2641
+ }
2642
+ .pluno-pa-widget__history-item-title {
2643
+ font-size: 11px;
2644
+ font-weight: 650;
2645
+ line-height: 1.2;
2646
+ }
2647
+ .pluno-pa-widget__history-time {
2648
+ color: var(--pluno-pa-faint);
2649
+ font-size: 9px;
2650
+ line-height: 1.2;
2651
+ justify-self: end;
2652
+ }
2653
+ .pluno-pa-widget__history-path {
2654
+ grid-column: 1 / -1;
2655
+ }
2656
+ .pluno-pa-widget__history-item small,
2657
+ .pluno-pa-widget__history-loading,
2658
+ .pluno-pa-widget__history-status {
2659
+ color: var(--pluno-pa-muted);
2660
+ font-size: 10px;
2661
+ line-height: 1.25;
2662
+ }
2663
+ .pluno-pa-widget__history-status {
2664
+ margin: 0;
2665
+ overflow-wrap: anywhere;
2666
+ }
2437
2667
  .pluno-pa-widget__timeline::-webkit-scrollbar,
2438
2668
  .pluno-pa-widget__message--assistant pre::-webkit-scrollbar,
2439
2669
  .pluno-pa-widget__input::-webkit-scrollbar {
@@ -2864,7 +3094,7 @@ function Ut(e, t) {
2864
3094
  place-items: center;
2865
3095
  padding: 18px;
2866
3096
  background: rgba(24, 24, 27, 0.28);
2867
- font-family: var(--pluno-pa-font, ${q.fontFamily});
3097
+ font-family: var(--pluno-pa-font, ${K.fontFamily});
2868
3098
  color: var(--pluno-pa-text);
2869
3099
  }
2870
3100
  .pluno-pa-widget__share-dialog {
@@ -3483,6 +3713,9 @@ function Ut(e, t) {
3483
3713
  .pluno-pa-widget__starter-prompt--placeholder {
3484
3714
  visibility: hidden;
3485
3715
  }
3716
+ .pluno-pa-widget__starter-prompt--loading {
3717
+ visibility: visible;
3718
+ }
3486
3719
  .pluno-pa-widget__login {
3487
3720
  display: inline-flex;
3488
3721
  align-items: center;
@@ -3686,6 +3919,15 @@ function Ut(e, t) {
3686
3919
  }
3687
3920
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
3688
3921
  position: relative;
3922
+ border-radius: var(--pluno-pa-scribble-wobble);
3923
+ }
3924
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
3925
+ border-radius: var(--pluno-pa-scribble-wobble);
3926
+ }
3927
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close,
3928
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item {
3929
+ position: relative;
3930
+ border-radius: var(--pluno-pa-scribble-wobble);
3689
3931
  }
3690
3932
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
3691
3933
  position: relative;
@@ -3698,7 +3940,11 @@ function Ut(e, t) {
3698
3940
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
3699
3941
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
3700
3942
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
3943
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3701
3944
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
3945
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close,
3946
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel,
3947
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item,
3702
3948
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3703
3949
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
3704
3950
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
@@ -3714,7 +3960,11 @@ function Ut(e, t) {
3714
3960
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
3715
3961
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
3716
3962
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
3963
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3717
3964
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
3965
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
3966
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
3967
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item::before,
3718
3968
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3719
3969
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3720
3970
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
@@ -3744,7 +3994,10 @@ function Ut(e, t) {
3744
3994
  .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
3745
3995
  background: var(--pluno-pa-surface);
3746
3996
  }
3997
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3747
3998
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
3999
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
4000
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
3748
4001
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3749
4002
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3750
4003
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
@@ -3769,6 +4022,7 @@ function Ut(e, t) {
3769
4022
  border-color: var(--pluno-pa-accent);
3770
4023
  }
3771
4024
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
4025
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3772
4026
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
3773
4027
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3774
4028
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
@@ -3777,6 +4031,7 @@ function Ut(e, t) {
3777
4031
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
3778
4032
  }
3779
4033
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
4034
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3780
4035
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
3781
4036
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
3782
4037
  .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
@@ -3806,6 +4061,7 @@ function Ut(e, t) {
3806
4061
  transform: rotate(-8deg);
3807
4062
  filter: url(#pluno-pa-scribble-wobble-2);
3808
4063
  }
4064
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3809
4065
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
3810
4066
  transform: rotate(-10deg);
3811
4067
  filter: url(#pluno-pa-scribble-wobble);
@@ -3822,6 +4078,7 @@ function Ut(e, t) {
3822
4078
  transform: rotate(-7deg);
3823
4079
  filter: url(#pluno-pa-scribble-wobble);
3824
4080
  }
4081
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3825
4082
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before {
3826
4083
  transform: rotate(6deg);
3827
4084
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3876,34 +4133,35 @@ function Ut(e, t) {
3876
4133
  filter: url(#pluno-pa-scribble-wobble-2);
3877
4134
  }
3878
4135
  .pluno-pa-widget--scribble .pluno-pa-widget__send svg,
4136
+ .pluno-pa-widget--scribble .pluno-pa-widget__history svg,
3879
4137
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
3880
4138
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy svg,
3881
4139
  .pluno-pa-widget--scribble .pluno-pa-widget__close svg {
3882
4140
  filter: url(#pluno-pa-scribble-wobble-2);
3883
4141
  }
3884
4142
  `;
3885
- if (Ea(e, n))
4143
+ if (qa(e, n))
3886
4144
  return;
3887
4145
  const o = e.ownerDocument.createElement("style");
3888
- o.id = Zt, o.textContent = n, e.appendChild(o), un(e);
4146
+ o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
3889
4147
  }
3890
- function Ca(e) {
3891
- return e.getElementById(Zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Jt) === "true";
4148
+ function $a(e) {
4149
+ return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
3892
4150
  }
3893
- function un(e) {
3894
- e.host instanceof HTMLElement && e.host.setAttribute(Jt, "true");
4151
+ function vn(e) {
4152
+ e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
3895
4153
  }
3896
- function Ea(e, t) {
4154
+ function qa(e, t) {
3897
4155
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3898
4156
  return !1;
3899
4157
  try {
3900
4158
  const n = new CSSStyleSheet();
3901
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], un(e), !0;
4159
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], vn(e), !0;
3902
4160
  } catch {
3903
4161
  return !1;
3904
4162
  }
3905
4163
  }
3906
- async function Sa() {
4164
+ async function ja() {
3907
4165
  return document.body ? document.body : await new Promise((e) => {
3908
4166
  const t = new MutationObserver(() => {
3909
4167
  document.body && (t.disconnect(), e(document.body));
@@ -3911,49 +4169,49 @@ async function Sa() {
3911
4169
  t.observe(document.documentElement, { childList: !0 });
3912
4170
  });
3913
4171
  }
3914
- function gn(e) {
4172
+ function Cn(e) {
3915
4173
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3916
4174
  }
3917
- function ka(e) {
4175
+ function Va(e) {
3918
4176
  try {
3919
- const t = window.localStorage.getItem(gn(e));
4177
+ const t = window.localStorage.getItem(Cn(e));
3920
4178
  if (!t)
3921
- return Ft();
4179
+ return Xt();
3922
4180
  const n = JSON.parse(t);
3923
4181
  return {
3924
4182
  isOpen: n.isOpen === !0,
3925
4183
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3926
4184
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3927
- launcherPosition: Ta(n.launcherPosition) ? n.launcherPosition : null,
3928
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-qt) : [],
4185
+ launcherPosition: Za(n.launcherPosition) ? n.launcherPosition : null,
4186
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
3929
4187
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3930
4188
  };
3931
4189
  } catch {
3932
- return Ft();
4190
+ return Xt();
3933
4191
  }
3934
4192
  }
3935
- async function La(e) {
4193
+ async function Ya(e) {
3936
4194
  if (e.loadSharePromptsDisabled)
3937
4195
  return e.loadSharePromptsDisabled();
3938
4196
  try {
3939
- return window.localStorage.getItem(jt) === "true";
4197
+ return window.localStorage.getItem(on) === "true";
3940
4198
  } catch {
3941
4199
  return !1;
3942
4200
  }
3943
4201
  }
3944
- function Aa(e, t) {
4202
+ function Ka(e, t) {
3945
4203
  if (e.persistSharePromptsDisabled) {
3946
4204
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3947
4205
  });
3948
4206
  return;
3949
4207
  }
3950
4208
  try {
3951
- t && window.localStorage.setItem(jt, "true");
4209
+ t && window.localStorage.setItem(on, "true");
3952
4210
  } catch {
3953
4211
  return;
3954
4212
  }
3955
4213
  }
3956
- function Ft() {
4214
+ function Xt() {
3957
4215
  return {
3958
4216
  isOpen: !1,
3959
4217
  composerValue: "",
@@ -3963,43 +4221,43 @@ function Ft() {
3963
4221
  sharePromptsDisabled: !1
3964
4222
  };
3965
4223
  }
3966
- function Pa(e, t) {
4224
+ function Xa(e, t) {
3967
4225
  try {
3968
- window.localStorage.setItem(gn(e), JSON.stringify(t));
4226
+ window.localStorage.setItem(Cn(e), JSON.stringify(t));
3969
4227
  } catch {
3970
4228
  return;
3971
4229
  }
3972
4230
  }
3973
- function Ta(e) {
4231
+ function Za(e) {
3974
4232
  if (!e || typeof e != "object")
3975
4233
  return !1;
3976
4234
  const t = e;
3977
4235
  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");
3978
4236
  }
3979
- const zt = /* @__PURE__ */ new WeakSet();
3980
- function Na(e) {
4237
+ const Zt = /* @__PURE__ */ new WeakSet();
4238
+ function Ja(e) {
3981
4239
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3982
4240
  }
3983
- function Gt(e) {
4241
+ function Jt(e) {
3984
4242
  const t = e.pathname.split("/");
3985
4243
  return t[t.length - 1] ?? "";
3986
4244
  }
3987
- function Ia(e, t) {
4245
+ function Qa(e, t) {
3988
4246
  const n = new URL(e.src, document.baseURI);
3989
- return n.href === t.href || n.pathname === t.pathname ? !0 : Gt(n) === Gt(t);
4247
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
3990
4248
  }
3991
- class Z extends EventTarget {
4249
+ class te extends EventTarget {
3992
4250
  constructor(t, n) {
3993
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Vn, () => {
3994
- this.readyState = Z.OPEN, this.dispatchEvent(new Event("open"));
3995
- }), this.addPreviewListener(Yn, (o) => {
4251
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(ro, () => {
4252
+ this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
4253
+ }), this.addPreviewListener(lo, (o) => {
3996
4254
  const a = o;
3997
4255
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3998
- }), this.addPreviewListener(Kn, () => {
3999
- this.readyState = Z.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4000
- }), this.addPreviewListener(Xn, (o) => {
4256
+ }), this.addPreviewListener(po, () => {
4257
+ this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4258
+ }), this.addPreviewListener(so, (o) => {
4001
4259
  const a = o;
4002
- this.readyState = Z.CLOSED, this.dispatchEvent(
4260
+ this.readyState = te.CLOSED, this.dispatchEvent(
4003
4261
  new CloseEvent("close", {
4004
4262
  code: a.detail?.code ?? 1e3,
4005
4263
  reason: a.detail?.reason ?? "",
@@ -4007,7 +4265,7 @@ class Z extends EventTarget {
4007
4265
  })
4008
4266
  ), this.cleanup();
4009
4267
  }), window.dispatchEvent(
4010
- new CustomEvent(Le($n, this.channelId), {
4268
+ new CustomEvent(Be(oo, this.channelId), {
4011
4269
  detail: { socketId: this.socketId, url: t }
4012
4270
  })
4013
4271
  );
@@ -4022,27 +4280,27 @@ class Z extends EventTarget {
4022
4280
  extensions = "";
4023
4281
  binaryType = "blob";
4024
4282
  bufferedAmount = 0;
4025
- readyState = Z.CONNECTING;
4026
- socketId = Da();
4283
+ readyState = te.CONNECTING;
4284
+ socketId = ei();
4027
4285
  listeners = /* @__PURE__ */ new Map();
4028
4286
  send(t) {
4029
- if (this.readyState !== Z.OPEN)
4287
+ if (this.readyState !== te.OPEN)
4030
4288
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
4031
4289
  window.dispatchEvent(
4032
- new CustomEvent(Le(qn, this.channelId), {
4290
+ new CustomEvent(Be(ao, this.channelId), {
4033
4291
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
4034
4292
  })
4035
4293
  );
4036
4294
  }
4037
4295
  close(t, n) {
4038
- this.readyState !== Z.CLOSED && (this.readyState = Z.CLOSING, window.dispatchEvent(
4039
- new CustomEvent(Le(jn, this.channelId), {
4296
+ this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4297
+ new CustomEvent(Be(io, this.channelId), {
4040
4298
  detail: { socketId: this.socketId, code: t, reason: n }
4041
4299
  })
4042
4300
  ), this.cleanup());
4043
4301
  }
4044
4302
  addPreviewListener(t, n) {
4045
- const o = Le(t, this.channelId), a = (i) => {
4303
+ const o = Be(t, this.channelId), a = (i) => {
4046
4304
  i.detail?.socketId === this.socketId && n(i);
4047
4305
  };
4048
4306
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -4053,36 +4311,36 @@ class Z extends EventTarget {
4053
4311
  this.listeners.clear();
4054
4312
  }
4055
4313
  }
4056
- function Da() {
4057
- const e = window.sessionStorage.getItem(wt);
4314
+ function ei() {
4315
+ const e = window.sessionStorage.getItem(At);
4058
4316
  if (e)
4059
4317
  return e;
4060
4318
  const t = crypto.randomUUID();
4061
- return window.sessionStorage.setItem(wt, t), t;
4319
+ return window.sessionStorage.setItem(At, t), t;
4062
4320
  }
4063
- function Le(e, t) {
4321
+ function Be(e, t) {
4064
4322
  return `${e}:${t}`;
4065
4323
  }
4066
- function Ra(e) {
4324
+ function ti(e) {
4067
4325
  const t = document.currentScript;
4068
4326
  if (t instanceof HTMLScriptElement)
4069
4327
  return [t];
4070
4328
  const n = new URL(e, document.baseURI).href, o = new URL(n);
4071
4329
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
4072
- (a) => a instanceof HTMLScriptElement && Na(a) && Ia(a, o)
4330
+ (a) => a instanceof HTMLScriptElement && Ja(a) && Qa(a, o)
4073
4331
  );
4074
4332
  }
4075
- function Ma(e) {
4076
- for (const t of Ra(e)) {
4077
- if (zt.has(t) || t.dataset.plunoAutoMount === "false")
4333
+ function ni(e) {
4334
+ for (const t of ti(e)) {
4335
+ if (Zt.has(t) || t.dataset.plunoAutoMount === "false")
4078
4336
  continue;
4079
- zt.add(t);
4337
+ Zt.add(t);
4080
4338
  const n = t.dataset.plunoPreviewChannel;
4081
- bo({
4339
+ No({
4082
4340
  token: t.dataset.plunoToken,
4083
4341
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4084
4342
  backendUrl: t.dataset.plunoBackendUrl,
4085
- webSocketFactory: n ? mo(n) : void 0,
4343
+ webSocketFactory: n ? To(n) : void 0,
4086
4344
  launcherLabel: t.dataset.plunoLauncherLabel,
4087
4345
  accentColor: t.dataset.plunoAccentColor,
4088
4346
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -4094,8 +4352,8 @@ function Ma(e) {
4094
4352
  });
4095
4353
  }
4096
4354
  }
4097
- Ma(import.meta.url);
4355
+ ni(import.meta.url);
4098
4356
  export {
4099
- mo as createProductAgentPreviewBridgeWebSocketFactory,
4100
- bo as mountPlunoProductAgentWidget
4357
+ To as createProductAgentPreviewBridgeWebSocketFactory,
4358
+ No as mountPlunoProductAgentWidget
4101
4359
  };