@pluno/product-agent-web 0.1.50 → 0.1.53

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 zn } from "./product-agent-sdk.js";
2
- const Gn = "#7c3aed", Ue = "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", Fe = "#2c2a1e", Lt = [253, 250, 241], At = 3.5;
3
- function on(e) {
4
- const t = an(e);
5
- if (Pt(Le(t), Lt) >= At)
1
+ import { PlunoProductAgent as Vn } from "./product-agent-sdk.js";
2
+ const Yn = "#7c3aed", He = "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", Ge = "#2c2a1e", Nt = [253, 250, 241], Dt = 3.5;
3
+ function dn(e) {
4
+ const t = cn(e);
5
+ if (Rt(Te(t), Nt) >= Dt)
6
6
  return t;
7
- let o = Le(t);
8
- const a = Le(Fe);
9
- for (let i = 0; i < 6; i += 1)
10
- if (o = $n(o, a, 0.22), Pt(o, Lt) >= At)
11
- return ot(o);
12
- return ot(o);
13
- }
14
- function Hn() {
15
- let n = "M 280 120", o = !1, a = 0;
16
- for (let i = 150; i <= 1170; i += 62) {
17
- const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
- n += ` L ${p} ${i}`, o = !o, a += 1;
7
+ let o = Te(t);
8
+ const i = Te(Ge);
9
+ for (let a = 0; a < 6; a += 1)
10
+ if (o = Zn(o, i, 0.22), Rt(o, Nt) >= Dt)
11
+ return st(o);
12
+ return st(o);
13
+ }
14
+ function Kn() {
15
+ let n = "M 280 120", o = !1, i = 0;
16
+ for (let a = 150; a <= 1170; a += 62) {
17
+ const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${a}`, o = !o, i += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function Wn(e) {
23
- const t = an(e), n = at(Le(t));
22
+ function Xn(e) {
23
+ const t = cn(e), n = dt(Te(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,187 +44,187 @@ function Wn(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
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)
47
+ top: K(t, 0.28, -0.03),
48
+ middle: K(t, 0.08, 0.04),
49
+ bottom: K(t, -0.1, 0.02),
50
+ edgeStart: K(t, 0.08, 0.08),
51
+ edgeMiddle: K(t, -0.08, 0.08),
52
+ edgeEnd: K(t, -0.18, 0.05),
53
+ glow: K(t, 0.32, -0.12),
54
+ highlight: K(t, 0.38, -0.18),
55
+ inner: K(t, 0.24, -0.1),
56
+ shadow: K(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function an(e) {
59
+ function cn(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()}` : Gn;
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()}` : Yn;
62
62
  }
63
- function Le(e) {
63
+ function Te(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 ot([e, t, n]) {
71
- const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
70
+ function st([e, t, n]) {
71
+ const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function at([e, t, n]) {
75
- const o = (a) => {
76
- const i = a / 255;
77
- return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
74
+ function dt([e, t, n]) {
75
+ const o = (i) => {
76
+ const a = i / 255;
77
+ return a <= 0.04045 ? a / 12.92 : ((a + 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 Pt(e, t) {
82
- const n = at(e), o = at(t), [a, i] = n > o ? [n, o] : [o, n];
83
- return (a + 0.05) / (i + 0.05);
81
+ function Rt(e, t) {
82
+ const n = dt(e), o = dt(t), [i, a] = n > o ? [n, o] : [o, n];
83
+ return (i + 0.05) / (a + 0.05);
84
84
  }
85
- function $n(e, t, n) {
86
- const o = it(n);
85
+ function Zn(e, t, n) {
86
+ const o = ct(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 V(e, t, n) {
94
- const [o, a, i] = qn(Le(e));
95
- return ot(jn(o, it(a + n), it(i + t)));
93
+ function K(e, t, n) {
94
+ const [o, i, a] = Jn(Te(e));
95
+ return st(Qn(o, ct(i + n), ct(a + t)));
96
96
  }
97
- function qn([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;
97
+ function Jn([e, t, n]) {
98
+ const o = e / 255, i = t / 255, a = n / 255, l = Math.max(o, i, a), p = Math.min(o, i, a), c = (l + p) / 2;
99
99
  if (l === p)
100
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];
101
+ const u = l - p, d = c > 0.5 ? u / (2 - l - p) : u / (l + p);
102
+ return [(l === o ? (i - a) / u + (i < a ? 6 : 0) : l === i ? (a - o) / u + 2 : (o - i) / u + 4) / 6, d, c];
103
103
  }
104
- function jn(e, t, n) {
104
+ function Qn(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
- const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
107
+ const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- Je(a, o, e + 1 / 3) * 255,
110
- Je(a, o, e) * 255,
111
- Je(a, o, e - 1 / 3) * 255
109
+ ot(i, o, e + 1 / 3) * 255,
110
+ ot(i, o, e) * 255,
111
+ ot(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function Je(e, t, n) {
114
+ function ot(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 it(e) {
118
+ function ct(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const rn = "suggest_share_on_socials";
122
- function Vn(e) {
121
+ const un = "suggest_share_on_socials";
122
+ function eo(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 !== rn)
125
+ if (n.role !== "tool" || n.toolName !== un)
126
126
  continue;
127
- const o = Tt(e, t, "assistant");
127
+ const o = Mt(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const a = Tt(e, o.index, "user");
131
- return a ? {
130
+ const i = Mt(e, o.index, "user");
131
+ return i ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
- userPrompt: a.content,
133
+ userPrompt: i.content,
134
134
  assistantAnswer: o.content
135
135
  } : null;
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Yn(e) {
140
- const t = await Kn(e);
139
+ async function to(e) {
140
+ const t = await no(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 Tt(e, t, n) {
145
+ function Mt(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
- const a = e[o];
148
- if (a.role === n && a.content.trim())
149
- return { index: o, content: a.content.trim() };
147
+ const i = e[o];
148
+ if (i.role === n && i.content.trim())
149
+ return { index: o, content: i.content.trim() };
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Kn(e) {
153
+ async function no(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const Xn = "https://app.pluno.ai", Zn = "/api/product-agent/embed/active-users", Jn = 1800, Qn = 15e3, eo = 250, to = 1e3, no = 3e4;
157
- function oo(e, t = {}) {
158
- let n = !1, o = null, a = null, i = null;
156
+ const oo = "https://app.pluno.ai", io = "/api/product-agent/embed/active-users", ao = 1800, ro = 15e3, lo = 250, po = 1e3, so = 3e4;
157
+ function co(e, t = {}) {
158
+ let n = !1, o = null, i = null, a = null;
159
159
  const l = () => {
160
- i !== null && (window.clearInterval(i), i = null);
161
- }, p = (s) => {
162
- n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
160
+ a !== null && (window.clearInterval(a), a = null);
161
+ }, p = (d) => {
162
+ n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  u();
164
- }, ro(s)));
165
- }, c = (s) => {
164
+ }, ho(d)));
165
+ }, c = (d) => {
166
166
  if (l(), o === null) {
167
- o = s, e(s);
167
+ o = d, e(d);
168
168
  return;
169
169
  }
170
- const b = o, w = performance.now();
171
- i = window.setInterval(() => {
170
+ const h = o, x = performance.now();
171
+ a = window.setInterval(() => {
172
172
  if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const P = Math.min(1, (performance.now() - w) / Jn);
177
- o = Math.round(b + (s - b) * lo(P)), e(o), P >= 1 && (o = s, e(s), l());
178
- }, eo);
176
+ const y = Math.min(1, (performance.now() - x) / ao);
177
+ o = Math.round(h + (d - h) * mo(y)), e(o), y >= 1 && (o = d, e(d), l());
178
+ }, lo);
179
179
  }, u = async () => {
180
180
  try {
181
- const s = await ao(t);
181
+ const d = await uo(t);
182
182
  if (n)
183
183
  return;
184
- c(s.count), p(s.refreshAfterMs);
184
+ c(d.count), p(d.refreshAfterMs);
185
185
  } catch {
186
- p(Qn);
186
+ p(ro);
187
187
  }
188
188
  };
189
189
  return u(), () => {
190
- n = !0, a !== null && window.clearTimeout(a), l();
190
+ n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function ao(e) {
193
+ async function uo(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(Zn, io(e.backendUrl ?? Xn)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(io, go(e.backendUrl ?? oo)).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 = It(o.count), i = It(o.refreshAfterMs ?? o.refresh_after_ms);
203
- if (a === null || i === null)
202
+ const o = await n.json(), i = zt(o.count), a = zt(o.refreshAfterMs ?? o.refresh_after_ms);
203
+ if (i === null || a === null)
204
204
  throw new Error("Invalid active users response");
205
- return { count: a, refreshAfterMs: i };
205
+ return { count: i, refreshAfterMs: a };
206
206
  }
207
- function It(e) {
207
+ function zt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function io(e) {
210
+ function go(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function ro(e) {
214
- return Math.min(no, Math.max(to, e));
213
+ function ho(e) {
214
+ return Math.min(so, Math.max(po, e));
215
215
  }
216
- function lo(e) {
216
+ function mo(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-agent:sdk-preview-socket-send", co = "product-agent:sdk-preview-socket-close", uo = "product-agent:sdk-preview-socket-open", go = "product-agent:sdk-preview-socket-message", ho = "product-agent:sdk-preview-socket-error", mo = "product-agent:sdk-preview-socket-closed", Nt = "product-agent:sdk-preview-socket-id", bo = "data-pluno-sdk-preview-channel", fo = "product-agent:preview-diagnostic", pn = "pluno.productAgent.sharePromptsDisabled", ze = 10, wo = 10 * 1024 * 1024, sn = /* @__PURE__ */ new Set([
219
+ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-agent:sdk-preview-socket-send", wo = "product-agent:sdk-preview-socket-close", _o = "product-agent:sdk-preview-socket-open", xo = "product-agent:sdk-preview-socket-message", yo = "product-agent:sdk-preview-socket-error", vo = "product-agent:sdk-preview-socket-closed", Bt = "product-agent:sdk-preview-socket-id", Co = "data-pluno-sdk-preview-channel", Eo = "product-agent:preview-diagnostic", hn = "pluno.productAgent.sharePromptsDisabled", We = 10, So = 10 * 1024 * 1024, mn = /* @__PURE__ */ new Set([
220
220
  "image/png",
221
221
  "image/jpeg",
222
222
  "image/webp",
223
223
  "image/gif",
224
224
  "application/pdf"
225
- ]), _o = Array.from(
226
- sn
227
- ).join(","), xo = 3, yo = "No recent chats for this page yet.", K = {
225
+ ]), ko = Array.from(
226
+ mn
227
+ ).join(","), Lo = 3, Po = "No recent chats for this page yet.", Z = {
228
228
  launcherLabel: "Ask for anything...",
229
229
  accentColor: "#7c3aed",
230
230
  colorScheme: "light",
@@ -232,7 +232,7 @@ const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-a
232
232
  scribbleStyle: !1,
233
233
  position: "bottom-right",
234
234
  movableLauncher: !1
235
- }, vo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Dt = "pluno-pa-scribble-font", dn = 190, cn = 41, Co = 48, Eo = 420, So = 520, ko = 0.24, Lo = 680, Ao = 800, Po = 0.76, F = 8, rt = 50, un = "http://www.w3.org/2000/svg", Rt = 26, Mt = 8, To = 36, Bt = [
235
+ }, Ao = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Ot = "pluno-pa-scribble-font", bn = 190, fn = 41, Ut = 22, Io = 16, To = 24, No = 1, Do = 48, Ro = 420, Mo = 520, zo = 0.24, Bo = 680, Oo = 800, Uo = 0.76, W = 8, ut = 50, wn = "http://www.w3.org/2000/svg", Ft = 26, Ht = 8, Fo = 36, Gt = [
236
236
  {
237
237
  ellipseCx: "17.5",
238
238
  ellipseCy: "24.5",
@@ -269,20 +269,20 @@ const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-a
269
269
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
270
270
  pathStrokeWidth: "2.45"
271
271
  }
272
- ], Io = 11, No = 13, Ot = 4, Do = 10, Ro = 40, Mo = "movable-launcher-position-v2", gn = "pluno-pa-widget-styles", hn = "data-pluno-pa-widget-styles";
273
- let Ut = 0;
274
- function Bo(e) {
275
- return (t) => new ee(t, e);
272
+ ], Ho = 11, Go = 13, Wt = 4, Wo = 10, $o = 40, qo = "movable-launcher-position-v2", _n = "pluno-pa-widget-styles", xn = "data-pluno-pa-widget-styles";
273
+ let $t = 0;
274
+ function jo(e) {
275
+ return (t) => new oe(t, e);
276
276
  }
277
- async function Oo(e = {}) {
277
+ async function Vo(e = {}) {
278
278
  const t = {
279
- launcherLabel: e.launcherLabel ?? K.launcherLabel,
280
- accentColor: e.accentColor ?? K.accentColor,
281
- colorScheme: e.colorScheme ?? K.colorScheme,
282
- fontFamily: e.fontFamily ?? K.fontFamily,
283
- scribbleStyle: e.scribbleStyle ?? K.scribbleStyle,
284
- position: e.position ?? K.position,
285
- movableLauncher: e.movableLauncher ?? K.movableLauncher,
279
+ launcherLabel: e.launcherLabel ?? Z.launcherLabel,
280
+ accentColor: e.accentColor ?? Z.accentColor,
281
+ colorScheme: e.colorScheme ?? Z.colorScheme,
282
+ fontFamily: e.fontFamily ?? Z.fontFamily,
283
+ scribbleStyle: e.scribbleStyle ?? Z.scribbleStyle,
284
+ position: e.position ?? Z.position,
285
+ movableLauncher: e.movableLauncher ?? Z.movableLauncher,
286
286
  token: e.token,
287
287
  tokenProvider: e.tokenProvider,
288
288
  tokenEndpoint: e.tokenEndpoint,
@@ -308,9 +308,13 @@ async function Oo(e = {}) {
308
308
  socialPostRewardsUrl: e.socialPostRewardsUrl,
309
309
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
310
310
  persistSharePromptsDisabled: e.persistSharePromptsDisabled,
311
- sdkPreviewChannelId: e.sdkPreviewChannelId
311
+ sdkPreviewChannelId: e.sdkPreviewChannelId,
312
+ initialDisplayState: e.initialDisplayState,
313
+ onDisplayStateChange: e.onDisplayStateChange,
314
+ onPanelOpenChange: e.onPanelOpenChange,
315
+ showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0
312
316
  };
313
- Y(
317
+ X(
314
318
  "web-sdk.widget",
315
319
  "Mounting widget with merged options",
316
320
  {
@@ -327,99 +331,112 @@ async function Oo(e = {}) {
327
331
  );
328
332
  const n = document.createElement("div");
329
333
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
330
- bo,
334
+ Co,
331
335
  t.sdkPreviewChannelId
332
336
  );
333
- const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
334
- a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
335
- let i = Ft(
337
+ const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
338
+ i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
339
+ let a = qt(
336
340
  t.accentColor,
337
341
  t.scribbleStyle
338
342
  );
339
- oa(
340
- a,
343
+ ui(
344
+ i,
341
345
  t.launcherLabel,
346
+ a,
347
+ t.movableLauncher,
348
+ t.showLauncherMinimizeButton
349
+ ), o.appendChild(i);
350
+ const l = ca(t);
351
+ let p = t.movableLauncher ? l.launcherPosition : null, c = p !== null;
352
+ i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), me(
342
353
  i,
343
- t.movableLauncher
344
- ), o.appendChild(a);
345
- const l = await ti(), p = l.ownerDocument;
346
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Qt(o, t.accentColor), zt(a, i, {
354
+ it(
355
+ i,
356
+ p,
357
+ t.position
358
+ )
359
+ )), rn(o, t.accentColor), jt(i, a, {
347
360
  accentColor: t.accentColor,
348
361
  colorScheme: t.colorScheme,
349
362
  fontFamily: t.fontFamily,
350
363
  scribbleStyle: t.scribbleStyle
351
- }), Y(
364
+ });
365
+ const u = await da(), d = u.ownerDocument;
366
+ u.appendChild(n), X(
352
367
  "web-sdk.widget",
353
368
  "Applied initial widget appearance",
354
369
  {
355
370
  accentColor: t.accentColor,
356
371
  colorScheme: t.colorScheme,
357
372
  fontFamily: t.fontFamily,
358
- cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
373
+ cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
359
374
  }
360
375
  );
361
- const c = a.querySelector(
376
+ const h = i.querySelector(
362
377
  ".pluno-pa-widget__launcher"
363
- ), u = a.querySelector(
378
+ ), x = i.querySelector(
364
379
  ".pluno-pa-widget__launcher-drag-handle"
365
- ), s = a.querySelector(
380
+ ), y = i.querySelector(
366
381
  ".pluno-pa-widget__launcher-input"
367
- ), b = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(
382
+ ), A = i.querySelector(
383
+ ".pluno-pa-widget__launcher-minimize"
384
+ ), T = i.querySelector(".pluno-pa-widget__panel"), f = i.querySelector(
368
385
  ".pluno-pa-widget__close"
369
- ), P = a.querySelector(
386
+ ), E = i.querySelector(
370
387
  ".pluno-pa-widget__composer"
371
- ), L = a.querySelector(
388
+ ), g = i.querySelector(
372
389
  ".pluno-pa-widget__attachment-error"
373
- ), R = a.querySelector(
390
+ ), S = i.querySelector(
374
391
  ".pluno-pa-widget__billing-status"
375
- ), y = a.querySelector(
392
+ ), k = i.querySelector(
376
393
  ".pluno-pa-widget__attachments"
377
- ), C = a.querySelector(
394
+ ), R = i.querySelector(
378
395
  ".pluno-pa-widget__attachment-input"
379
- ), h = a.querySelector(
396
+ ), Ce = i.querySelector(
380
397
  ".pluno-pa-widget__attach"
381
- ), g = a.querySelector(
398
+ ), b = i.querySelector(
382
399
  ".pluno-pa-widget__input"
383
- ), E = a.querySelector(
400
+ ), ie = i.querySelector(
384
401
  ".pluno-pa-widget__send"
385
- ), O = a.querySelector(
402
+ ), ae = i.querySelector(
386
403
  ".pluno-pa-widget__top-actions"
387
- ), le = a.querySelector(
404
+ ), _ = i.querySelector(
388
405
  ".pluno-pa-widget__history"
389
- ), me = a.querySelector(
406
+ ), N = i.querySelector(
390
407
  ".pluno-pa-widget__history-panel"
391
- ), z = a.querySelector(
408
+ ), F = i.querySelector(
392
409
  ".pluno-pa-widget__history-list"
393
- ), ne = a.querySelector(
410
+ ), H = i.querySelector(
394
411
  ".pluno-pa-widget__history-close"
395
- ), _ = a.querySelector(
412
+ ), L = i.querySelector(
396
413
  ".pluno-pa-widget__history-status"
397
- ), T = a.querySelector(
414
+ ), I = i.querySelector(
398
415
  ".pluno-pa-widget__timeline-jump"
399
- ), be = a.querySelector(
416
+ ), be = i.querySelector(
400
417
  ".pluno-pa-widget__active-users-counter"
401
- ), k = a.querySelector(
418
+ ), P = i.querySelector(
402
419
  ".pluno-pa-widget__timeline"
403
- ), A = a.querySelector(
420
+ ), je = i.querySelector(
404
421
  ".pluno-pa-widget__timeline-bottom-sentinel"
405
422
  );
406
- if (!c || !s || !b || !w || !P || !L || !R || !y || !C || !h || !g || !E || !O || !le || !me || !z || !ne || !_ || !T || !be || !k || !A)
423
+ if (!h || !y || !T || !f || !E || !g || !S || !k || !R || !Ce || !b || !ie || !ae || !_ || !N || !F || !H || !L || !I || !be || !P || !je)
407
424
  throw new Error("Failed to mount Pluno widget");
408
- if (t.movableLauncher && !u)
425
+ if (t.movableLauncher && !x)
409
426
  throw new Error("Failed to mount Pluno widget drag handle");
410
- qt(s), qt(g);
411
- let x = [], U = null;
412
- const G = () => {
413
- va(
414
- y,
415
- x,
427
+ Zt(y), Zt(b);
428
+ let z = [], te = null;
429
+ const fe = () => {
430
+ Ti(
431
+ k,
432
+ z,
416
433
  (r) => {
417
- x = x.filter(
418
- (d, S) => S !== r
419
- ), G(), M(f.getState()), W();
434
+ z = z.filter(
435
+ (s, C) => C !== r
436
+ ), fe(), O(w.getState()), $();
420
437
  }
421
438
  );
422
- }, An = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
439
+ }, Mn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
423
440
  if (!t.tokenEndpoint)
424
441
  throw new Error("Pluno widget requires token or tokenEndpoint");
425
442
  const r = await fetch(t.tokenEndpoint, {
@@ -433,19 +450,19 @@ async function Oo(e = {}) {
433
450
  });
434
451
  if (!r.ok)
435
452
  throw new Error("Failed to load Pluno token");
436
- const d = await r.json();
437
- if (!d.token)
453
+ const s = await r.json();
454
+ if (!s.token)
438
455
  throw new Error("Pluno token endpoint did not return a token");
439
- return d.token;
440
- }), Pn = window.fetch.bind(window);
441
- let f;
442
- f = await zn.init({
456
+ return s.token;
457
+ }), zn = window.fetch.bind(window);
458
+ let w;
459
+ w = await Vn.init({
443
460
  token: t.token,
444
- tokenProvider: An,
461
+ tokenProvider: Mn,
445
462
  backendUrl: t.backendUrl,
446
463
  metadata: () => ({
447
464
  ...t.metadata ?? {},
448
- ...!f.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
465
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
449
466
  }),
450
467
  initialStarterPrompts: t.initialStarterPrompts,
451
468
  clientId: t.clientId,
@@ -454,248 +471,280 @@ async function Oo(e = {}) {
454
471
  webSocketFactory: t.webSocketFactory,
455
472
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
456
473
  });
457
- const pe = ni(t), He = new Set(pe.openToolGroupKeys), fe = new Set(
458
- pe.seenShareCandidateIds
459
- ), Ae = new Set(fe);
460
- let We = pe.sharePromptsDisabled || await oi(t), J = t.movableLauncher ? pe.launcherPosition : null, gt = J !== null, oe = null, Pe = !1, se = !1, de = {
474
+ const Ve = new Set(l.openToolGroupKeys), we = new Set(
475
+ l.seenShareCandidateIds
476
+ ), Ne = new Set(we);
477
+ let Ye = l.sharePromptsDisabled || await ua(t), j = null, De = !1, de = !1, ce = {
461
478
  enabled: !0
462
- }, ce = 0, ht = "", ae = !1, Q = !1, ie = [], $e = null, ve = null;
463
- const q = (r, d) => {
464
- de = { enabled: r, reason: d };
465
- }, j = () => {
466
- T.hidden = !0;
467
- }, Tn = () => {
468
- T.hidden = !1;
469
- }, In = (r = "jump") => {
470
- q(!0, r), j(), ke(k, () => de.enabled), ce = k.scrollTop;
471
- }, ue = () => {
472
- if (le.hidden = t.loginRequired, me.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), z.classList.toggle(
479
+ }, ue = 0, _t = "", re = !1, ne = !1, le = [], Ke = null, Ee = null;
480
+ const V = (r, s) => {
481
+ ce = { enabled: r, reason: s };
482
+ }, Y = () => {
483
+ I.hidden = !0;
484
+ }, Bn = () => {
485
+ I.hidden = !1;
486
+ }, On = (r = "jump") => {
487
+ V(!0, r), Y(), Ie(P, () => ce.enabled), ue = P.scrollTop;
488
+ }, ge = () => {
489
+ if (_.hidden = t.loginRequired, N.hidden = !re, _.setAttribute("aria-expanded", String(re)), F.classList.toggle(
473
490
  "pluno-pa-widget__history-list--center",
474
- Q && ie.length === 0
475
- ), z.replaceChildren(), Q && ie.length === 0) {
491
+ ne && le.length === 0
492
+ ), F.replaceChildren(), ne && le.length === 0) {
476
493
  const r = document.createElement("p");
477
- r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", z.appendChild(r);
478
- }
479
- for (const r of ie) {
480
- const d = document.createElement("button");
481
- d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = Q;
482
- const S = document.createElement("span");
483
- S.className = "pluno-pa-widget__history-item-title", S.textContent = ea(r);
484
- const D = document.createElement("time");
485
- D.className = "pluno-pa-widget__history-time", D.dateTime = r.lastActiveAt, D.textContent = na(
494
+ r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", F.appendChild(r);
495
+ }
496
+ for (const r of le) {
497
+ const s = document.createElement("button");
498
+ s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ne;
499
+ const C = document.createElement("span");
500
+ C.className = "pluno-pa-widget__history-item-title", C.textContent = si(r);
501
+ const B = document.createElement("time");
502
+ B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = ci(
486
503
  r.lastActiveAt,
487
504
  Date.now()
488
505
  );
489
- const I = document.createElement("small");
490
- I.className = "pluno-pa-widget__history-path", I.textContent = ta(r), d.append(S, D, I), d.addEventListener("click", () => {
491
- ae = !1, ve = null, ue(), q(!0, "newSession"), j(), f.loadSession(r.id), M(f.getState());
492
- }), z.appendChild(d);
506
+ const D = document.createElement("small");
507
+ D.className = "pluno-pa-widget__history-path", D.textContent = di(r), s.append(C, B, D), s.addEventListener("click", () => {
508
+ re = !1, Ee = null, ge(), V(!0, "newSession"), Y(), w.loadSession(r.id), O(w.getState());
509
+ }), F.appendChild(s);
493
510
  }
494
- if (Q && ie.length > 0) {
511
+ if (ne && le.length > 0) {
495
512
  const r = document.createElement("p");
496
- r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", z.appendChild(r);
513
+ r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", F.appendChild(r);
497
514
  }
498
- _.textContent = ve ?? (!Q && ie.length === 0 ? "No recent chats for this page yet." : ""), _.hidden = _.textContent.length === 0;
499
- }, mt = async (r) => {
500
- if (!Q) {
501
- Q = !0, ve = null, ue();
515
+ L.textContent = Ee ?? (!ne && le.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
516
+ }, xt = async (r) => {
517
+ if (!ne) {
518
+ ne = !0, Ee = null, ge();
502
519
  try {
503
- const d = await f.listSessions({ cursor: r, limit: 20 });
504
- ie = r ? [...ie, ...d.sessions] : d.sessions, $e = d.nextCursor;
505
- } catch (d) {
506
- Y(
520
+ const s = await w.listSessions({ cursor: r, limit: 20 });
521
+ le = r ? [...le, ...s.sessions] : s.sessions, Ke = s.nextCursor;
522
+ } catch (s) {
523
+ X(
507
524
  "web-sdk.widget",
508
525
  "Failed to load session history",
509
526
  {
510
- message: d instanceof Error ? d.message : String(d)
527
+ message: s instanceof Error ? s.message : String(s)
511
528
  }
512
- ), ve = yo;
529
+ ), Ee = Po;
513
530
  } finally {
514
- Q = !1, ue();
531
+ ne = !1, ge();
515
532
  }
516
533
  }
517
- }, Nn = () => {
518
- !$e || Q || z.scrollHeight - z.scrollTop - z.clientHeight <= 24 && mt($e);
519
- }, Dn = () => {
520
- Pe || typeof document > "u" || (Qt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
521
- }, bt = new MutationObserver(Dn);
522
- bt.observe(p.documentElement, {
534
+ }, Un = () => {
535
+ !Ke || ne || F.scrollHeight - F.scrollTop - F.clientHeight <= 24 && xt(Ke);
536
+ }, Fn = () => {
537
+ De || typeof document > "u" || (rn(o, t.accentColor), n.isConnected || d.body?.appendChild(n));
538
+ }, yt = new MutationObserver(Fn);
539
+ yt.observe(d.documentElement, {
523
540
  childList: !0,
524
541
  subtree: !0
525
542
  });
526
- const qe = (r = !0) => {
527
- const d = lt(a, r);
528
- return Gt(
529
- a,
530
- J ? $o(J, d) : Wo(
531
- a,
543
+ const Xe = (r = !0) => {
544
+ const s = $e(i, r);
545
+ return gt(
546
+ i,
547
+ p ? vn(p, s) : Qo(
548
+ i,
532
549
  t.position,
533
- d
550
+ s
534
551
  ),
535
- d
552
+ s
536
553
  );
537
- }, H = () => {
538
- ii(t, {
539
- isOpen: a.classList.contains("pluno-pa-widget--open"),
540
- composerValue: g.value,
541
- openToolGroupKeys: [...He],
542
- launcherPosition: gt ? J : null,
543
- seenShareCandidateIds: [...fe].slice(
544
- -ln
554
+ }, G = () => {
555
+ ha(t, {
556
+ isOpen: i.classList.contains("pluno-pa-widget--open"),
557
+ composerValue: b.value,
558
+ openToolGroupKeys: [...Ve],
559
+ launcherPosition: c ? p : null,
560
+ seenShareCandidateIds: [...we].slice(
561
+ -gn
545
562
  ),
546
- sharePromptsDisabled: We
563
+ sharePromptsDisabled: Ye
547
564
  });
548
- }, ge = (r, d = {}) => {
549
- Zo(r, {
550
- debugVersion: Mo,
551
- launcherPosition: J,
552
- rootClasses: a.className,
565
+ }, Re = (r) => {
566
+ t.onDisplayStateChange?.(r);
567
+ }, Se = (r, s = !0) => {
568
+ if (r === "shown") {
569
+ i.classList.remove("pluno-pa-widget--minimized"), h.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && ke(!1), s && Re("shown");
570
+ return;
571
+ }
572
+ j !== null && (window.clearTimeout(j), j = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), h.hidden = !1, T.hidden = !0, f.hidden = !0, h.tabIndex = 0, b.value = "", me(
573
+ i,
574
+ it(
575
+ i,
576
+ p,
577
+ t.position
578
+ )
579
+ ), Yt(i), G(), s && Re("minimized");
580
+ }, he = (r, s = {}) => {
581
+ ri(r, {
582
+ debugVersion: qo,
583
+ launcherPosition: p,
584
+ rootClasses: i.className,
553
585
  rootStyle: {
554
- left: a.style.left,
555
- top: a.style.top,
556
- right: a.style.right,
557
- bottom: a.style.bottom
586
+ left: i.style.left,
587
+ top: i.style.top,
588
+ right: i.style.right,
589
+ bottom: i.style.bottom
558
590
  },
559
- rootRect: Qe(a),
560
- launcherRect: Qe(c),
561
- panelRect: Qe(b),
562
- viewport: te(),
563
- panelHidden: b.hidden,
564
- closeHidden: w.hidden,
565
- ...d
591
+ rootRect: at(i),
592
+ launcherRect: at(h),
593
+ panelRect: at(T),
594
+ viewport: Q(),
595
+ panelHidden: T.hidden,
596
+ closeHidden: f.hidden,
597
+ ...s
566
598
  });
567
- }, Te = (r = !0) => {
568
- if (!J)
569
- return Re(a, null), qe(r);
570
- const d = qe(r);
571
- return Re(a, d), ge("Applied stored closed launcher position", {
572
- visibleLauncherPosition: d
573
- }), d;
574
- }, ft = (r, d) => {
575
- if (!r || !d) {
576
- Xo(a);
599
+ }, ke = (r = !0) => {
600
+ if (!p)
601
+ return me(i, null), Xe(r);
602
+ const s = Xe(r);
603
+ return me(i, s), he("Applied stored closed launcher position", {
604
+ visibleLauncherPosition: s
605
+ }), s;
606
+ }, vt = (r, s) => {
607
+ if (!r || !s) {
608
+ Yt(i);
577
609
  return;
578
610
  }
579
- Ko(a, {
580
- x: r.x - d.x,
581
- y: r.y - d.y
611
+ ai(i, {
612
+ x: r.x - s.x,
613
+ y: r.y - s.y
582
614
  });
583
- }, wt = () => {
584
- const r = Te();
585
- if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
586
- const d = Ht(
587
- a,
615
+ }, Ct = () => {
616
+ if (i.classList.contains("pluno-pa-widget--minimized")) {
617
+ me(
618
+ i,
619
+ it(
620
+ i,
621
+ p,
622
+ t.position
623
+ )
624
+ );
625
+ return;
626
+ }
627
+ const r = ke();
628
+ if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
629
+ const s = Vt(
630
+ i,
588
631
  r,
589
632
  t.position
590
633
  );
591
- ft(d, r), ge(
634
+ vt(s, r), he(
592
635
  "Applied open panel position after viewport resize",
593
- { openPanelPosition: d }
636
+ { openPanelPosition: s }
594
637
  );
595
- } else J && ge(
638
+ } else p && he(
596
639
  "Applied visible launcher position after viewport resize",
597
640
  { visibleLauncherPosition: r }
598
641
  );
599
642
  };
600
- let _t = () => {
643
+ let Et = () => {
601
644
  };
602
- window.addEventListener("resize", wt), t.movableLauncher && u ? (Te(), _t = Ho({
603
- root: a,
604
- launcher: c,
605
- launcherDragHandle: u,
606
- getPosition: () => qe(),
645
+ window.addEventListener("resize", Ct), t.movableLauncher && x ? (ke(), Et = Jo({
646
+ root: i,
647
+ launcher: h,
648
+ launcherDragHandle: x,
649
+ getPosition: () => Xe(),
607
650
  setPosition: (r) => {
608
- const d = r, S = lt(a), D = Gt(
609
- a,
651
+ const s = r, C = $e(i), B = gt(
652
+ i,
610
653
  r,
611
- S
654
+ C
612
655
  );
613
- J = qo(
614
- D,
615
- S
616
- ), Re(a, D), ge("Dragging closed launcher", {
617
- requestedPosition: d
656
+ p = ti(
657
+ B,
658
+ C
659
+ ), me(i, B), he("Dragging closed launcher", {
660
+ requestedPosition: s
618
661
  });
619
662
  },
620
663
  persist: () => {
621
- gt = !0, H(), ge("Persisted closed launcher drag position");
664
+ c = !0, G(), he("Persisted closed launcher drag position");
622
665
  }
623
- })) : Re(a, null);
624
- let je = !1;
625
- const xt = async () => {
626
- if (!(!t.billingStatusLoader || je)) {
627
- je = !0;
666
+ })) : me(i, null);
667
+ let Ze = !1;
668
+ const St = async () => {
669
+ if (!(!t.billingStatusLoader || Ze)) {
670
+ Ze = !0;
628
671
  try {
629
672
  const r = await t.billingStatusLoader();
630
- Vt(
673
+ Qt(
631
674
  t.billingStatus,
632
675
  r,
633
- f.getState().lastErrorCode
634
- ) && (t.billingStatus = r, nt(
635
- R,
676
+ w.getState().lastErrorCode
677
+ ) && (t.billingStatus = r, pt(
678
+ S,
636
679
  t.billingStatus,
637
- f.getState().lastErrorCode
638
- ), W());
680
+ w.getState().lastErrorCode
681
+ ), $());
639
682
  } finally {
640
- je = !1;
683
+ Ze = !1;
641
684
  }
642
685
  }
643
- }, he = (r = "", d = !0) => {
644
- xt(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
645
- const S = Te(), D = Ht(
646
- a,
647
- S,
686
+ }, pe = (r = "", s = !0) => {
687
+ St(), j !== null && (window.clearTimeout(j), j = null), Se("shown", !1), T.hidden = !1, f.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
688
+ const C = ke(), B = Vt(
689
+ i,
690
+ C,
648
691
  t.position
649
692
  );
650
- if (ft(D, S), ge("Opening launcher at clamped open panel position", {
651
- openPanelPosition: D,
652
- visibleLauncherPosition: S
653
- }), q(!0, "open"), j(), !d) {
654
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Se(g)), ke(k, () => de.enabled), ce = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
693
+ if (vt(B, C), he("Opening launcher at clamped open panel position", {
694
+ openPanelPosition: B,
695
+ visibleLauncherPosition: C
696
+ }), V(!0, "open"), Y(), !s) {
697
+ i.classList.add("pluno-pa-widget--open"), h.hidden = !0, r && (b.value = r, Ae(b)), Ie(P, () => ce.enabled), ue = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), G(), Re("shown"), t.onPanelOpenChange?.(!0);
655
698
  return;
656
699
  }
657
700
  window.requestAnimationFrame(() => {
658
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Se(g)), ke(k, () => de.enabled), ce = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
659
- c.hidden = !0, ke(k, () => de.enabled), ce = k.scrollTop;
701
+ i.classList.add("pluno-pa-widget--open"), r && (b.value = r, Ae(b)), Ie(P, () => ce.enabled), ue = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), G(), Re("shown"), t.onPanelOpenChange?.(!0), j = window.setTimeout(() => {
702
+ h.hidden = !0, Ie(P, () => ce.enabled), ue = P.scrollTop;
660
703
  }, 220);
661
704
  });
662
- }, Rn = () => {
663
- oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, J && (Te(!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(() => {
664
- b.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
705
+ }, Hn = () => {
706
+ j !== null && (window.clearTimeout(j), j = null), h.hidden = !1, p && (ke(!1), he("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), G(), t.onPanelOpenChange?.(!1), j = window.setTimeout(() => {
707
+ T.hidden = !0, f.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
665
708
  }, 220);
666
709
  };
667
- c.addEventListener("submit", (r) => {
668
- r.preventDefault(), he(s.value), s.value = "";
669
- }), u?.addEventListener("click", (r) => {
710
+ h.addEventListener("submit", (r) => {
711
+ r.preventDefault(), pe(y.value), y.value = "";
712
+ }), x?.addEventListener("click", (r) => {
670
713
  r.preventDefault(), r.stopPropagation();
671
- }), c.addEventListener("click", (r) => {
672
- r.target === s && !u || (he(s.value), s.value = "");
673
- }), s.addEventListener("focus", () => {
674
- he(s.value), s.value = "";
675
- }), s.addEventListener("input", () => {
676
- if (!s.value)
714
+ }), h.addEventListener("click", (r) => {
715
+ r.target === y && !x || (pe(y.value), y.value = "");
716
+ }), y.addEventListener("focus", () => {
717
+ pe(y.value), y.value = "";
718
+ }), y.addEventListener("input", () => {
719
+ if (!y.value)
677
720
  return;
678
- const r = s.value;
679
- he(r), s.value = "";
680
- }), w.addEventListener("click", Rn), k.addEventListener("scroll", () => {
681
- k.scrollTop < ce - 1 && q(!1, "userScroll"), ce = k.scrollTop;
682
- }), T.addEventListener("click", () => {
683
- In();
721
+ const r = y.value;
722
+ pe(r), y.value = "";
723
+ }), h.addEventListener("keydown", (r) => {
724
+ !i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), pe());
725
+ }), A?.addEventListener("pointerdown", (r) => {
726
+ r.stopPropagation();
727
+ }), A?.addEventListener("click", (r) => {
728
+ r.preventDefault(), r.stopPropagation(), Se("minimized");
729
+ }), f.addEventListener("click", Hn), P.addEventListener("scroll", () => {
730
+ P.scrollTop < ue - 1 && V(!1, "userScroll"), ue = P.scrollTop;
731
+ }), I.addEventListener("click", () => {
732
+ On();
684
733
  });
685
- const yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
734
+ const kt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
686
735
  ([r]) => {
687
- r?.isIntersecting && (q(!0, "bottom"), j());
736
+ r?.isIntersecting && (V(!0, "bottom"), Y());
688
737
  },
689
- { root: k, threshold: 0 }
738
+ { root: P, threshold: 0 }
690
739
  );
691
- yt?.observe(A);
692
- const Ie = () => t.loginRequired || t.signupRequired, vt = () => {
693
- const r = Ie();
694
- 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;
695
- }, W = () => {
696
- E.disabled = X(t.billingStatus) || !f.getState().isThinking && g.value.trim().length === 0 && x.length === 0, h.disabled = Ie() || X(t.billingStatus);
740
+ kt?.observe(je);
741
+ const Me = () => t.loginRequired || t.signupRequired, Lt = () => {
742
+ const r = Me();
743
+ y.readOnly = r, y.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, b.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Z.launcherLabel, E.hidden = r;
744
+ }, $ = () => {
745
+ ie.disabled = J(t.billingStatus) || !w.getState().isThinking && b.value.trim().length === 0 && z.length === 0, Ce.disabled = Me() || J(t.billingStatus);
697
746
  };
698
- vt(), P.addEventListener("submit", (r) => {
747
+ Lt(), E.addEventListener("submit", (r) => {
699
748
  if (r.preventDefault(), t.loginRequired) {
700
749
  t.onLoginClick?.();
701
750
  return;
@@ -704,122 +753,122 @@ async function Oo(e = {}) {
704
753
  t.onSignupClick?.();
705
754
  return;
706
755
  }
707
- X(t.billingStatus) || (se = !0, q(!0, "send"), j(), x = et(
708
- f,
709
- g,
710
- x
711
- ), G(), W());
756
+ J(t.billingStatus) || (de = !0, V(!0, "send"), Y(), z = rt(
757
+ w,
758
+ b,
759
+ z
760
+ ), fe(), $());
712
761
  });
713
- let Ce = 0;
714
- const Mn = () => {
715
- Ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
716
- }, Ct = (r) => {
717
- U !== null && window.clearTimeout(U), L.textContent = r, L.hidden = !1, U = window.setTimeout(() => {
718
- L.textContent = "", L.hidden = !0, U = null;
762
+ let Le = 0;
763
+ const Gn = () => {
764
+ Le = 0, i.classList.remove("pluno-pa-widget--drag-over");
765
+ }, Pt = (r) => {
766
+ te !== null && window.clearTimeout(te), g.textContent = r, g.hidden = !1, te = window.setTimeout(() => {
767
+ g.textContent = "", g.hidden = !0, te = null;
719
768
  }, 3e3);
720
- }, Bn = () => {
721
- U !== null && (window.clearTimeout(U), U = null), L.textContent = "", L.hidden = !0;
722
- }, Et = async (r) => {
769
+ }, Wn = () => {
770
+ te !== null && (window.clearTimeout(te), te = null), g.textContent = "", g.hidden = !0;
771
+ }, At = async (r) => {
723
772
  if (r.length === 0)
724
773
  return;
725
- const d = await ka(r);
726
- if (x.length + d.length > ze)
774
+ const s = await Mi(r);
775
+ if (z.length + s.length > We)
727
776
  throw new Error(
728
- `Attach up to ${ze} files per message.`
777
+ `Attach up to ${We} files per message.`
729
778
  );
730
- x = [...x, ...d], G(), Bn(), W(), M(f.getState()), a.classList.contains("pluno-pa-widget--open") || he();
779
+ z = [...z, ...s], fe(), Wn(), $(), O(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
731
780
  };
732
- h.addEventListener("click", () => {
733
- t.loginRequired || X(t.billingStatus) || C.click();
734
- }), C.addEventListener("change", () => {
735
- const r = Array.from(C.files ?? []);
736
- C.value = "", Et(r).catch((d) => {
737
- Ct(
738
- d instanceof Error ? d.message : "Failed to attach file"
739
- ), Y("web-sdk.widget", "Attachment failed", {
740
- message: d instanceof Error ? d.message : String(d)
781
+ Ce.addEventListener("click", () => {
782
+ t.loginRequired || J(t.billingStatus) || R.click();
783
+ }), R.addEventListener("change", () => {
784
+ const r = Array.from(R.files ?? []);
785
+ R.value = "", At(r).catch((s) => {
786
+ Pt(
787
+ s instanceof Error ? s.message : "Failed to attach file"
788
+ ), X("web-sdk.widget", "Attachment failed", {
789
+ message: s instanceof Error ? s.message : String(s)
741
790
  });
742
791
  });
743
- }), a.addEventListener("dragenter", (r) => {
744
- !Me(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
745
- }), a.addEventListener("dragover", (r) => {
746
- const d = r.dataTransfer;
747
- !Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
748
- }), a.addEventListener("dragleave", (r) => {
749
- Me(r.dataTransfer) && (r.stopPropagation(), Ce = Math.max(0, Ce - 1), Ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
750
- }), a.addEventListener("drop", (r) => {
751
- const d = r.dataTransfer;
752
- !Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Mn(), Et(d.files).catch((S) => {
753
- Ct(
754
- S instanceof Error ? S.message : "Failed to attach file"
755
- ), Y("web-sdk.widget", "Attachment failed", {
756
- message: S instanceof Error ? S.message : String(S)
792
+ }), i.addEventListener("dragenter", (r) => {
793
+ !Oe(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Le += 1, i.classList.add("pluno-pa-widget--drag-over"));
794
+ }), i.addEventListener("dragover", (r) => {
795
+ const s = r.dataTransfer;
796
+ !Oe(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
797
+ }), i.addEventListener("dragleave", (r) => {
798
+ Oe(r.dataTransfer) && (r.stopPropagation(), Le = Math.max(0, Le - 1), Le === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
799
+ }), i.addEventListener("drop", (r) => {
800
+ const s = r.dataTransfer;
801
+ !Oe(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Gn(), At(s.files).catch((C) => {
802
+ Pt(
803
+ C instanceof Error ? C.message : "Failed to attach file"
804
+ ), X("web-sdk.widget", "Attachment failed", {
805
+ message: C instanceof Error ? C.message : String(C)
757
806
  });
758
807
  }));
759
- }), E.addEventListener("click", () => {
808
+ }), ie.addEventListener("click", () => {
760
809
  if (t.loginRequired) {
761
810
  t.onLoginClick?.();
762
811
  return;
763
812
  }
764
- if (f.getState().isThinking) {
765
- f.stop();
813
+ if (w.getState().isThinking) {
814
+ w.stop();
766
815
  return;
767
816
  }
768
- se = !0, q(!0, "send"), j(), x = et(
769
- f,
770
- g,
771
- x
772
- ), G(), W(), M(f.getState());
773
- }), le.addEventListener("click", () => {
774
- ae = !ae, ve = null, ue(), ae && ie.length === 0 && mt(null);
775
- }), ne.addEventListener("click", () => {
776
- ae = !1, ue();
777
- }), z.addEventListener("scroll", Nn), g.addEventListener("input", () => {
778
- Se(g), H(), W(), M(f.getState());
779
- }), g.addEventListener("keydown", (r) => {
817
+ de = !0, V(!0, "send"), Y(), z = rt(
818
+ w,
819
+ b,
820
+ z
821
+ ), fe(), $(), O(w.getState());
822
+ }), _.addEventListener("click", () => {
823
+ re = !re, Ee = null, ge(), re && le.length === 0 && xt(null);
824
+ }), H.addEventListener("click", () => {
825
+ re = !1, ge();
826
+ }), F.addEventListener("scroll", Un), b.addEventListener("input", () => {
827
+ Ae(b), G(), $(), O(w.getState());
828
+ }), b.addEventListener("keydown", (r) => {
780
829
  if (!(r.key !== "Enter" || r.shiftKey)) {
781
830
  if (r.preventDefault(), t.loginRequired) {
782
831
  t.onLoginClick?.();
783
832
  return;
784
833
  }
785
- se = !0, q(!0, "send"), j(), x = et(
786
- f,
787
- g,
788
- x
789
- ), G(), W(), M(f.getState());
790
- }
791
- }), a.addEventListener("click", (r) => {
792
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
793
- }), pe.composerValue && (g.value = pe.composerValue, Se(g)), pe.isOpen && he(g.value, !1);
794
- const Ne = () => i;
795
- let Ve = f.getState().appearance !== null, De = null, Ee = null, we = null, St = f.getState().isThinking, _e = null, Ye = null, kt = () => {
834
+ de = !0, V(!0, "send"), Y(), z = rt(
835
+ w,
836
+ b,
837
+ z
838
+ ), fe(), $(), O(w.getState());
839
+ }
840
+ }), i.addEventListener("click", (r) => {
841
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && G();
842
+ }), l.composerValue && (b.value = l.composerValue, Ae(b)), t.initialDisplayState === "minimized" ? Se("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
843
+ const ze = () => a;
844
+ let Je = w.getState().appearance !== null, Be = null, Pe = null, _e = null, It = w.getState().isThinking, xe = null, Qe = null, Tt = () => {
796
845
  };
797
- const On = !!t.socialPostDraftHandler;
798
- let xe = null;
799
- const Un = () => {
800
- se = !0, q(!0, "newSession"), j(), ae = !1, ue(), f.startNewSession(), He.clear(), g.value = "", x = [], G(), Se(g), H(), W(), g.focus(), M(f.getState());
801
- }, Ke = (r) => {
846
+ const $n = !!t.socialPostDraftHandler;
847
+ let ye = null;
848
+ const qn = () => {
849
+ de = !0, V(!0, "newSession"), Y(), re = !1, ge(), w.startNewSession(), Ve.clear(), b.value = "", z = [], fe(), Ae(b), G(), $(), b.focus(), O(w.getState());
850
+ }, et = (r) => {
802
851
  if (!r) {
803
- xe?.remove(), xe = null;
852
+ ye?.remove(), ye = null;
804
853
  return;
805
854
  }
806
- xe || (xe = Ge(
855
+ ye || (ye = qe(
807
856
  "pluno-pa-widget__new-chat",
808
857
  "New chat",
809
- ha(),
858
+ Ci(),
810
859
  !1
811
- ), xe.addEventListener("click", Un), O.insertBefore(xe, le));
812
- }, M = (r) => {
813
- if (ue(), ut(r.lastErrorCode) ? _e = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (_e = null), nt(
814
- R,
860
+ ), ye.addEventListener("click", qn), ae.insertBefore(ye, _));
861
+ }, O = (r) => {
862
+ if (ge(), wt(r.lastErrorCode) ? xe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !J(t.billingStatus) && (xe = null), pt(
863
+ S,
815
864
  t.billingStatus,
816
- _e
865
+ xe
817
866
  ), t.loginRequired) {
818
- Zt(
819
- k,
820
- E,
821
- Ke,
822
- Ne,
867
+ on(
868
+ P,
869
+ ie,
870
+ et,
871
+ ze,
823
872
  "Log in to use Pluno on this page.",
824
873
  t.loginButtonLabel,
825
874
  t.loginUrl,
@@ -828,11 +877,11 @@ async function Oo(e = {}) {
828
877
  return;
829
878
  }
830
879
  if (t.signupRequired) {
831
- Zt(
832
- k,
833
- E,
834
- Ke,
835
- Ne,
880
+ on(
881
+ P,
882
+ ie,
883
+ et,
884
+ ze,
836
885
  "Complete signup to unlock your free trial credits.",
837
886
  t.signupButtonLabel,
838
887
  t.signupUrl,
@@ -840,70 +889,70 @@ async function Oo(e = {}) {
840
889
  );
841
890
  return;
842
891
  }
843
- const d = Jo(r), S = d !== ht;
844
- ht = d;
845
- const D = se || de.enabled;
846
- se = !1, Ua(
847
- k,
848
- A,
849
- E,
850
- Ke,
892
+ const s = li(r), C = s !== _t;
893
+ _t = s;
894
+ const B = de || ce.enabled;
895
+ de = !1, Vi(
896
+ P,
897
+ je,
898
+ ie,
899
+ et,
851
900
  be,
852
901
  r,
853
- Ye,
854
- Ye !== null && Kt(
902
+ Qe,
903
+ Qe !== null && tn(
855
904
  r,
856
- g.value.trim().length > 0 || x.length > 0
905
+ b.value.trim().length > 0 || z.length > 0
857
906
  ),
858
- D,
859
- () => de.enabled,
860
- He,
861
- H,
862
- Ne,
863
- (I) => {
864
- se = !0, q(!0, "send"), j(), f.sendMessage(I);
907
+ B,
908
+ () => ce.enabled,
909
+ Ve,
910
+ G,
911
+ ze,
912
+ (D) => {
913
+ de = !0, V(!0, "send"), Y(), w.sendMessage(D);
865
914
  },
866
- On && !We ? {
867
- dismissedCandidateIds: Ae,
868
- draftingCandidateId: De,
869
- error: Ee,
870
- characterIconOptions: Ne(),
871
- onSeen: (I) => {
872
- fe.add(I.id), H();
915
+ $n && !Ye ? {
916
+ dismissedCandidateIds: Ne,
917
+ draftingCandidateId: Be,
918
+ error: Pe,
919
+ characterIconOptions: ze(),
920
+ onSeen: (D) => {
921
+ we.add(D.id), G();
873
922
  },
874
- onDraft: (I) => {
875
- Fn(I);
923
+ onDraft: (D) => {
924
+ jn(D);
876
925
  },
877
- onDismiss: (I) => {
878
- fe.add(I.id), Ae.add(I.id), H(), Ee = null, M(f.getState());
926
+ onDismiss: (D) => {
927
+ we.add(D.id), Ne.add(D.id), G(), Pe = null, O(w.getState());
879
928
  },
880
- onDisable: (I) => {
881
- We = !0, fe.add(I.id), Ae.add(I.id), H(), ai(t, !0), Ee = null, M(f.getState());
929
+ onDisable: (D) => {
930
+ Ye = !0, we.add(D.id), Ne.add(D.id), G(), ga(t, !0), Pe = null, O(w.getState());
882
931
  }
883
932
  } : void 0
884
- ), D ? (ce = k.scrollTop, j()) : S && Qo(r) && Tn();
933
+ ), B ? (ue = P.scrollTop, Y()) : C && pi(r) && Bn();
885
934
  };
886
- return kt = oo(
935
+ return Tt = co(
887
936
  (r) => {
888
- Ye = r, !Pe && Kt(
889
- f.getState(),
890
- g.value.trim().length > 0 || x.length > 0
891
- ) && M(f.getState());
937
+ Qe = r, !De && tn(
938
+ w.getState(),
939
+ b.value.trim().length > 0 || z.length > 0
940
+ ) && O(w.getState());
892
941
  },
893
942
  {
894
943
  backendUrl: t.backendUrl,
895
- fetcher: Pn,
944
+ fetcher: zn,
896
945
  loader: t.activeUsersLoader
897
946
  }
898
- ), f.on("state", (r) => {
899
- const d = St && !r.isThinking;
900
- St = r.isThinking, r.appearance ? (Ve = !0, Y(
947
+ ), w.on("state", (r) => {
948
+ const s = It && !r.isThinking;
949
+ It = r.isThinking, r.appearance ? (Je = !0, X(
901
950
  "web-sdk.widget",
902
951
  "Agent state supplied appearance",
903
952
  {
904
953
  appearance: r.appearance
905
954
  }
906
- ), Xe(r.appearance, "agent.state.appearance")) : Ve && (Ve = !1, Y(
955
+ ), tt(r.appearance, "agent.state.appearance")) : Je && (Je = !1, X(
907
956
  "web-sdk.widget",
908
957
  "Agent state cleared appearance; reverting to configured widget options",
909
958
  {
@@ -911,94 +960,101 @@ async function Oo(e = {}) {
911
960
  fallbackColorScheme: t.colorScheme,
912
961
  fallbackFontFamily: t.fontFamily
913
962
  }
914
- ), Xe({}, "agent.state.appearance-cleared")), M(r), W(), d && xt();
915
- }), M(f.getState()), W(), {
916
- agent: f,
963
+ ), tt({}, "agent.state.appearance-cleared")), O(r), $(), s && St();
964
+ }), O(w.getState()), $(), {
965
+ agent: w,
917
966
  updateAppearance: (r) => {
918
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Xe(r, "widgetHandle.updateAppearance");
967
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), tt(r, "widgetHandle.updateAppearance");
919
968
  },
920
969
  updateBillingStatus: (r) => {
921
- const d = r ?? null;
922
- Vt(
970
+ const s = r ?? null;
971
+ Qt(
923
972
  t.billingStatus,
924
- d,
925
- _e
926
- ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (_e = null), nt(
927
- a.querySelector(".pluno-pa-widget__billing-status"),
973
+ s,
974
+ xe
975
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !J(t.billingStatus) && (xe = null), pt(
976
+ i.querySelector(".pluno-pa-widget__billing-status"),
928
977
  t.billingStatus,
929
- _e
930
- ), W());
978
+ xe
979
+ ), $());
931
980
  },
932
981
  updateAuthGate: (r) => {
933
- const d = Ie();
934
- 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), vt(), M(f.getState()), W(), d && !Ie() && f.connect().catch((S) => {
935
- Y(
982
+ const s = Me();
983
+ 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), Lt(), O(w.getState()), $(), s && !Me() && w.connect().catch((C) => {
984
+ X(
936
985
  "web-sdk.widget",
937
986
  "Failed to connect after auth gate cleared",
938
987
  {
939
- message: S instanceof Error ? S.message : String(S)
988
+ message: C instanceof Error ? C.message : String(C)
940
989
  }
941
990
  );
942
991
  });
943
992
  },
944
993
  openPanel: () => {
945
- he(g.value, !1);
994
+ pe(b.value, !1);
995
+ },
996
+ updateDisplayState: (r) => {
997
+ if (r === "shown") {
998
+ Se("shown", !1);
999
+ return;
1000
+ }
1001
+ Se("minimized", !1);
946
1002
  },
947
1003
  destroy: () => {
948
- Pe || (Pe = !0, bt.disconnect(), yt?.disconnect(), window.removeEventListener("resize", wt), _t(), U !== null && window.clearTimeout(U), kt(), we?.remove(), f.destroy(), n.remove());
1004
+ De || (De = !0, yt.disconnect(), kt?.disconnect(), window.removeEventListener("resize", Ct), Et(), te !== null && window.clearTimeout(te), Tt(), _e?.remove(), w.destroy(), n.remove());
949
1005
  }
950
1006
  };
951
- async function Fn(r) {
952
- if (!De) {
953
- De = r.id, Ee = null, M(f.getState());
1007
+ async function jn(r) {
1008
+ if (!Be) {
1009
+ Be = r.id, Pe = null, O(w.getState());
954
1010
  try {
955
1011
  if (!t.socialPostDraftHandler)
956
1012
  throw new Error("Social post drafting is not available here.");
957
- const d = await t.socialPostDraftHandler(r);
958
- if (!d.linkedinPost || !d.xPost)
1013
+ const s = await t.socialPostDraftHandler(r);
1014
+ if (!s.linkedinPost || !s.xPost)
959
1015
  throw new Error("Pluno did not return a complete social post draft.");
960
- fe.add(r.id), Ae.add(r.id), H(), we?.remove(), we = Wa(d, {
1016
+ we.add(r.id), Ne.add(r.id), G(), _e?.remove(), _e = Ji(s, {
961
1017
  socialPostRewardsUrl: t.socialPostRewardsUrl,
962
1018
  onClose: () => {
963
- we?.remove(), we = null;
1019
+ _e?.remove(), _e = null;
964
1020
  }
965
- }), a.appendChild(we);
966
- } catch (d) {
967
- Ee = d instanceof Error ? d.message : "Could not draft social post.";
1021
+ }), i.appendChild(_e);
1022
+ } catch (s) {
1023
+ Pe = s instanceof Error ? s.message : "Could not draft social post.";
968
1024
  } finally {
969
- De = null, M(f.getState());
1025
+ Be = null, O(w.getState());
970
1026
  }
971
1027
  }
972
1028
  }
973
- function Xe(r, d) {
974
- const S = r.accentColor ?? t.accentColor, D = r.colorScheme ?? t.colorScheme, I = r.fontFamily ?? t.fontFamily, Ze = r.scribbleStyle ?? t.scribbleStyle;
975
- i = Ft(
976
- S,
977
- Ze
978
- ), zt(a, i, {
979
- accentColor: S,
980
- colorScheme: D,
981
- fontFamily: I,
982
- scribbleStyle: Ze
983
- }), Y("web-sdk.widget", "Updated widget appearance", {
984
- source: d,
1029
+ function tt(r, s) {
1030
+ const C = r.accentColor ?? t.accentColor, B = r.colorScheme ?? t.colorScheme, D = r.fontFamily ?? t.fontFamily, nt = r.scribbleStyle ?? t.scribbleStyle;
1031
+ a = qt(
1032
+ C,
1033
+ nt
1034
+ ), jt(i, a, {
1035
+ accentColor: C,
1036
+ colorScheme: B,
1037
+ fontFamily: D,
1038
+ scribbleStyle: nt
1039
+ }), X("web-sdk.widget", "Updated widget appearance", {
1040
+ source: s,
985
1041
  inputAppearance: r,
986
- appliedAccentColor: S,
987
- appliedColorScheme: D,
988
- appliedFontFamily: I,
989
- appliedScribbleStyle: Ze,
990
- cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
1042
+ appliedAccentColor: C,
1043
+ appliedColorScheme: B,
1044
+ appliedFontFamily: D,
1045
+ appliedScribbleStyle: nt,
1046
+ cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
991
1047
  });
992
1048
  }
993
1049
  }
994
- function Ft(e, t) {
1050
+ function qt(e, t) {
995
1051
  return { accentColor: e, scribbleStyle: t };
996
1052
  }
997
- function Uo(e) {
998
- const t = Fo(e);
999
- return t === null ? "#fafafa" : zo(t) > 0.5 ? "#18181b" : "#fafaf9";
1053
+ function Yo(e) {
1054
+ const t = Ko(e);
1055
+ return t === null ? "#fafafa" : Xo(t) > 0.5 ? "#18181b" : "#fafaf9";
1000
1056
  }
1001
- function Fo(e) {
1057
+ function Ko(e) {
1002
1058
  const t = e.trim();
1003
1059
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1004
1060
  Number.parseInt(t.slice(1, 3), 16),
@@ -1010,14 +1066,14 @@ function Fo(e) {
1010
1066
  Number.parseInt(t[3] + t[3], 16)
1011
1067
  ] : null;
1012
1068
  }
1013
- function zo([e, t, n]) {
1014
- const o = (a) => {
1015
- const i = a / 255;
1016
- return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
1069
+ function Xo([e, t, n]) {
1070
+ const o = (i) => {
1071
+ const a = i / 255;
1072
+ return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
1017
1073
  };
1018
1074
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1019
1075
  }
1020
- function zt(e, t, n) {
1076
+ function jt(e, t, n) {
1021
1077
  e.classList.toggle(
1022
1078
  "pluno-pa-widget--dark",
1023
1079
  n.colorScheme === "dark"
@@ -1025,27 +1081,27 @@ function zt(e, t, n) {
1025
1081
  "pluno-pa-widget--light",
1026
1082
  n.colorScheme !== "dark"
1027
1083
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1028
- const o = n.scribbleStyle ? on(n.accentColor) : n.accentColor;
1084
+ const o = n.scribbleStyle ? dn(n.accentColor) : n.accentColor;
1029
1085
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1030
1086
  "--pluno-pa-accent-contrast",
1031
- Uo(o)
1032
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? vo : n.fontFamily, n.scribbleStyle && Go(e.ownerDocument);
1033
- const a = Array.from(
1087
+ Yo(o)
1088
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ao : n.fontFamily, n.scribbleStyle && Zo(e.ownerDocument);
1089
+ const i = Array.from(
1034
1090
  e.querySelectorAll(".pluno-pa-widget__character")
1035
1091
  );
1036
- for (const i of a)
1037
- i.replaceWith(
1038
- re(
1039
- Array.from(i.classList).join(" "),
1092
+ for (const a of i)
1093
+ a.replaceWith(
1094
+ se(
1095
+ Array.from(a.classList).join(" "),
1040
1096
  t
1041
1097
  )
1042
1098
  );
1043
1099
  }
1044
- function Go(e) {
1045
- if (e.getElementById(Dt))
1100
+ function Zo(e) {
1101
+ if (e.getElementById(Ot))
1046
1102
  return;
1047
1103
  const t = e.createElement("style");
1048
- t.id = Dt, t.textContent = `@font-face {
1104
+ t.id = Ot, t.textContent = `@font-face {
1049
1105
  font-family: "Architects Daughter";
1050
1106
  font-style: normal;
1051
1107
  font-weight: 400;
@@ -1053,180 +1109,201 @@ function Go(e) {
1053
1109
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1054
1110
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1055
1111
  }
1056
- function Ho({
1112
+ function Jo({
1057
1113
  root: e,
1058
1114
  launcher: t,
1059
1115
  launcherDragHandle: n,
1060
1116
  getPosition: o,
1061
- setPosition: a,
1062
- persist: i
1117
+ setPosition: i,
1118
+ persist: a
1063
1119
  }) {
1064
- let l = null, p = null, c = null, u = !1, s = null;
1065
- const b = () => {
1120
+ let l = null, p = null, c = null, u = !1, d = null;
1121
+ const h = () => {
1066
1122
  l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
1067
- }, w = (h) => {
1068
- 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));
1069
- }, P = (h) => {
1070
- if (l !== h.pointerId || !p || !c)
1123
+ }, x = (g) => {
1124
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (g.preventDefault(), g.stopPropagation(), l = g.pointerId, p = { x: g.clientX, y: g.clientY }, c = o(), u = !1, t.setPointerCapture?.(g.pointerId));
1125
+ }, y = (g) => {
1126
+ if (l !== g.pointerId || !p || !c)
1071
1127
  return;
1072
- h.preventDefault();
1073
- const g = h.clientX - p.x, E = h.clientY - p.y;
1074
- !u && Math.hypot(g, E) < Ot || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
1075
- }, L = (h) => {
1076
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
1077
- }, R = (h) => {
1078
- l === h.pointerId && (h.preventDefault(), b());
1079
- }, y = (h) => {
1080
- if (!s)
1128
+ g.preventDefault();
1129
+ const S = g.clientX - p.x, k = g.clientY - p.y;
1130
+ !u && Math.hypot(S, k) < Wt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + S, y: c.y + k }));
1131
+ }, A = (g) => {
1132
+ l === g.pointerId && (g.preventDefault(), g.stopPropagation(), u && (d = { x: g.clientX, y: g.clientY }, a()), h());
1133
+ }, T = (g) => {
1134
+ l === g.pointerId && (g.preventDefault(), h());
1135
+ }, f = (g) => {
1136
+ if (!d)
1081
1137
  return;
1082
- const g = Math.hypot(
1083
- h.clientX - s.x,
1084
- h.clientY - s.y
1085
- ) <= Ot;
1086
- s = null, g && (h.preventDefault(), h.stopPropagation());
1087
- }, C = (h) => {
1138
+ const S = Math.hypot(
1139
+ g.clientX - d.x,
1140
+ g.clientY - d.y
1141
+ ) <= Wt;
1142
+ d = null, S && (g.preventDefault(), g.stopPropagation());
1143
+ }, E = (g) => {
1088
1144
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1089
1145
  return;
1090
- const g = h.shiftKey ? Ro : Do, E = o();
1091
- let O = null;
1092
- h.key === "ArrowUp" ? O = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? O = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? O = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (O = { x: E.x + g, y: E.y }), O && (h.preventDefault(), h.stopPropagation(), a(O), i());
1146
+ const S = g.shiftKey ? $o : Wo, k = o();
1147
+ let R = null;
1148
+ g.key === "ArrowUp" ? R = { x: k.x, y: k.y - S } : g.key === "ArrowDown" ? R = { x: k.x, y: k.y + S } : g.key === "ArrowLeft" ? R = { x: k.x - S, y: k.y } : g.key === "ArrowRight" && (R = { x: k.x + S, y: k.y }), R && (g.preventDefault(), g.stopPropagation(), i(R), a());
1093
1149
  };
1094
- return t.addEventListener("pointerdown", w), t.addEventListener("pointermove", P), t.addEventListener("pointerup", L), t.addEventListener("pointercancel", R), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
1095
- t.removeEventListener("pointerdown", w), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", L), t.removeEventListener("pointercancel", R), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
1150
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", y), t.addEventListener("pointerup", A), t.addEventListener("pointercancel", T), t.addEventListener("click", f, !0), n.addEventListener("keydown", E), () => {
1151
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", y), t.removeEventListener("pointerup", A), t.removeEventListener("pointercancel", T), t.removeEventListener("click", f, !0), n.removeEventListener("keydown", E);
1096
1152
  };
1097
1153
  }
1098
- function lt(e, t = !0) {
1099
- const n = te(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1154
+ function $e(e, t = !0) {
1155
+ const n = Q();
1156
+ if (e.classList.contains("pluno-pa-widget--minimized"))
1157
+ return e.classList.contains("pluno-pa-widget--scribble") ? {
1158
+ width: Io,
1159
+ height: To
1160
+ } : { width: Ut, height: Ut };
1161
+ const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1100
1162
  return {
1101
- width: t && a && o.width > 0 ? o.width : Math.min(dn, n.width - 36),
1102
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Co : cn
1163
+ width: t && i && o.width > 0 ? o.width : Math.min(bn, n.width - 36),
1164
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Do : fn
1103
1165
  };
1104
1166
  }
1105
- function mn() {
1106
- const e = te();
1167
+ function yn() {
1168
+ const e = Q();
1107
1169
  return {
1108
1170
  width: Math.min(
1109
- ye(
1110
- e.width * ko,
1111
- Eo,
1112
- So
1171
+ ve(
1172
+ e.width * zo,
1173
+ Ro,
1174
+ Mo
1113
1175
  ),
1114
- e.width - F * 2
1176
+ e.width - W * 2
1115
1177
  ),
1116
1178
  height: Math.min(
1117
- ye(
1118
- e.height * Po,
1119
- Lo,
1120
- Ao
1179
+ ve(
1180
+ e.height * Uo,
1181
+ Bo,
1182
+ Oo
1121
1183
  ),
1122
- e.height - rt - F
1184
+ e.height - ut - W
1123
1185
  )
1124
1186
  };
1125
1187
  }
1126
- function Wo(e, t, n) {
1127
- const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
1128
- if (Number.isFinite(o) && Number.isFinite(a))
1129
- return { x: o, y: a };
1130
- const i = e.getBoundingClientRect();
1131
- if (i.width > 0 || i.height > 0)
1132
- return { x: i.left, y: i.top };
1133
- const l = te();
1188
+ function Qo(e, t, n) {
1189
+ const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1190
+ if (Number.isFinite(o) && Number.isFinite(i))
1191
+ return { x: o, y: i };
1192
+ const a = e.getBoundingClientRect();
1193
+ if (a.width > 0 || a.height > 0)
1194
+ return { x: a.left, y: a.top };
1195
+ const l = Q();
1134
1196
  return {
1135
1197
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1136
1198
  y: l.height - 24 - n.height
1137
1199
  };
1138
1200
  }
1139
- function Gt(e, t, n) {
1140
- const o = te(), a = F + Vo(e);
1201
+ function it(e, t, n) {
1202
+ const o = $e(e, !1);
1203
+ return t ? gt(
1204
+ e,
1205
+ vn(t, o),
1206
+ o
1207
+ ) : ei(n === "bottom-left" ? "bottom-left" : "bottom-right", o, No);
1208
+ }
1209
+ function ei(e, t, n) {
1210
+ const o = Q();
1141
1211
  return {
1142
- x: ye(
1212
+ x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1213
+ y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1214
+ };
1215
+ }
1216
+ function gt(e, t, n) {
1217
+ const o = Q(), i = W + oi(e);
1218
+ return {
1219
+ x: ve(
1143
1220
  t.x,
1144
- F,
1221
+ W,
1145
1222
  Math.max(
1146
- F,
1147
- o.width - n.width - F
1223
+ W,
1224
+ o.width - n.width - W
1148
1225
  )
1149
1226
  ),
1150
- y: ye(
1227
+ y: ve(
1151
1228
  t.y,
1152
- a,
1229
+ i,
1153
1230
  Math.max(
1154
- a,
1155
- o.height - n.height - F
1231
+ i,
1232
+ o.height - n.height - W
1156
1233
  )
1157
1234
  )
1158
1235
  };
1159
1236
  }
1160
- function $o(e, t) {
1161
- const n = te();
1237
+ function vn(e, t) {
1238
+ const n = Q();
1162
1239
  return {
1163
1240
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1164
1241
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1165
1242
  };
1166
1243
  }
1167
- function qo(e, t) {
1168
- const n = jo(e, t), o = te();
1244
+ function ti(e, t) {
1245
+ const n = ni(e, t), o = Q();
1169
1246
  return {
1170
1247
  anchor: n,
1171
1248
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1172
1249
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1173
1250
  };
1174
1251
  }
1175
- function jo(e, t) {
1176
- const n = te(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1177
- return `${i}-${l}`;
1252
+ function ni(e, t) {
1253
+ const n = Q(), o = e.x + t.width / 2, a = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1254
+ return `${a}-${l}`;
1178
1255
  }
1179
- function Vo(e) {
1180
- return e.classList.contains("pluno-pa-widget--scribble") ? No : Io;
1256
+ function oi(e) {
1257
+ return e.classList.contains("pluno-pa-widget--scribble") ? Go : Ho;
1181
1258
  }
1182
- function Ht(e, t, n) {
1183
- const o = lt(e), a = mn(), i = {
1184
- x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
1185
- y: t.y + o.height - a.height
1259
+ function Vt(e, t, n) {
1260
+ const o = $e(e), i = yn(), a = {
1261
+ x: n === "bottom-left" ? t.x : t.x + o.width - i.width,
1262
+ y: t.y + o.height - i.height
1186
1263
  };
1187
- return Yo(i);
1264
+ return ii(a);
1188
1265
  }
1189
- function Yo(e) {
1190
- const t = te(), n = mn();
1266
+ function ii(e) {
1267
+ const t = Q(), n = yn();
1191
1268
  return {
1192
- x: ye(
1269
+ x: ve(
1193
1270
  e.x,
1194
- F,
1271
+ W,
1195
1272
  Math.max(
1196
- F,
1197
- t.width - n.width - F
1273
+ W,
1274
+ t.width - n.width - W
1198
1275
  )
1199
1276
  ),
1200
- y: ye(
1277
+ y: ve(
1201
1278
  e.y,
1202
- rt,
1279
+ ut,
1203
1280
  Math.max(
1204
- rt,
1205
- t.height - n.height - F
1281
+ ut,
1282
+ t.height - n.height - W
1206
1283
  )
1207
1284
  )
1208
1285
  };
1209
1286
  }
1210
- function Re(e, t) {
1287
+ function me(e, t) {
1211
1288
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1212
1289
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1213
1290
  return;
1214
1291
  }
1215
1292
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1216
1293
  }
1217
- function Ko(e, t) {
1294
+ function ai(e, t) {
1218
1295
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1219
1296
  }
1220
- function Xo(e) {
1297
+ function Yt(e) {
1221
1298
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1222
1299
  }
1223
- function te() {
1300
+ function Q() {
1224
1301
  return {
1225
- width: window.innerWidth || document.documentElement.clientWidth || dn + F * 2,
1226
- height: window.innerHeight || document.documentElement.clientHeight || cn + F * 2
1302
+ width: window.innerWidth || document.documentElement.clientWidth || bn + W * 2,
1303
+ height: window.innerHeight || document.documentElement.clientHeight || fn + W * 2
1227
1304
  };
1228
1305
  }
1229
- function Qe(e) {
1306
+ function at(e) {
1230
1307
  const t = e.getBoundingClientRect();
1231
1308
  return {
1232
1309
  x: Math.round(t.x),
@@ -1235,42 +1312,42 @@ function Qe(e) {
1235
1312
  height: Math.round(t.height)
1236
1313
  };
1237
1314
  }
1238
- function ye(e, t, n) {
1315
+ function ve(e, t, n) {
1239
1316
  return Math.min(Math.max(e, t), n);
1240
1317
  }
1241
- function Y(e, t, n) {
1318
+ function X(e, t, n) {
1242
1319
  if (typeof window > "u")
1243
1320
  return;
1244
- const o = window, a = {
1321
+ const o = window, i = {
1245
1322
  at: (/* @__PURE__ */ new Date()).toISOString(),
1246
1323
  source: e,
1247
1324
  message: t,
1248
1325
  details: n
1249
- }, i = o.__plunoProductAgentDiagnostics__ ?? [];
1250
- i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(
1251
- new CustomEvent(fo, { detail: a })
1326
+ }, a = o.__plunoProductAgentDiagnostics__ ?? [];
1327
+ a.push(i), a.length > 120 && a.splice(0, a.length - 120), o.__plunoProductAgentDiagnostics__ = a, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
1328
+ new CustomEvent(Eo, { detail: i })
1252
1329
  );
1253
1330
  }
1254
- function Zo(e, t) {
1255
- Y("web-sdk.widget.position", e, t);
1331
+ function ri(e, t) {
1332
+ X("web-sdk.widget.position", e, t);
1256
1333
  }
1257
- function et(e, t, n) {
1334
+ function rt(e, t, n) {
1258
1335
  const o = t.value.trim();
1259
1336
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1260
1337
  attachments: n.length > 0 ? n : void 0
1261
1338
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1262
1339
  }
1263
- function Se(e) {
1340
+ function Ae(e) {
1264
1341
  e.style.height = "0px";
1265
1342
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1266
1343
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1267
1344
  }
1268
- function ke(e, t = () => !0) {
1345
+ function Ie(e, t = () => !0) {
1269
1346
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1270
1347
  t() && (e.scrollTop = e.scrollHeight);
1271
1348
  });
1272
1349
  }
1273
- function Jo(e) {
1350
+ function li(e) {
1274
1351
  const t = e.messages[e.messages.length - 1];
1275
1352
  return [
1276
1353
  e.messages.length,
@@ -1281,13 +1358,13 @@ function Jo(e) {
1281
1358
  e.lastError ?? ""
1282
1359
  ].join(":");
1283
1360
  }
1284
- function Qo(e) {
1361
+ function pi(e) {
1285
1362
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1286
1363
  }
1287
- function ea(e) {
1364
+ function si(e) {
1288
1365
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1289
1366
  }
1290
- function ta(e) {
1367
+ function di(e) {
1291
1368
  const t = e.currentPage;
1292
1369
  if (typeof t?.url == "string" && t.url.trim())
1293
1370
  try {
@@ -1298,80 +1375,89 @@ function ta(e) {
1298
1375
  }
1299
1376
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1300
1377
  }
1301
- function na(e, t) {
1378
+ function ci(e, t) {
1302
1379
  const n = new Date(e).getTime();
1303
1380
  if (!Number.isFinite(n))
1304
1381
  return "now";
1305
- const o = Math.max(0, t - n), a = [
1382
+ const o = Math.max(0, t - n), i = [
1306
1383
  ["day", 864e5],
1307
1384
  ["hour", 36e5],
1308
1385
  ["min", 6e4]
1309
1386
  ];
1310
- for (const [i, l] of a)
1387
+ for (const [a, l] of i)
1311
1388
  if (o >= l) {
1312
1389
  const p = Math.max(1, Math.floor(o / l));
1313
- return i === "min" ? `${p} min` : `${p} ${i}${p === 1 ? "" : "s"}`;
1390
+ return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
1314
1391
  }
1315
1392
  return "now";
1316
1393
  }
1317
- function oa(e, t, n, o) {
1318
- e.appendChild(ua()), e.appendChild(
1319
- aa(t, n, o)
1394
+ function ui(e, t, n, o, i) {
1395
+ e.appendChild(yi()), e.appendChild(
1396
+ gi(
1397
+ t,
1398
+ n,
1399
+ o,
1400
+ i
1401
+ )
1320
1402
  ), e.appendChild(
1321
- Ge(
1403
+ qe(
1322
1404
  "pluno-pa-widget__close",
1323
1405
  "Close",
1324
- ga(16),
1406
+ vi(16),
1325
1407
  !0
1326
1408
  )
1327
- ), e.appendChild(ia(n));
1409
+ ), e.appendChild(hi(n));
1328
1410
  }
1329
- function aa(e, t, n) {
1330
- const o = document.createElement("form");
1331
- if (o.className = "pluno-pa-widget__launcher", n) {
1332
- const i = document.createElement("button");
1333
- 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);
1411
+ function gi(e, t, n, o) {
1412
+ const i = document.createElement("form");
1413
+ if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1414
+ const l = document.createElement("button");
1415
+ l.type = "button", l.className = "pluno-pa-widget__launcher-drag-handle", l.setAttribute("aria-label", "Move Pluno launcher"), l.title = "Move Pluno launcher", i.appendChild(l);
1334
1416
  }
1335
- o.appendChild(
1336
- wn(
1417
+ i.appendChild(
1418
+ Sn(
1337
1419
  "pluno-pa-widget__scribble-spirals--launcher",
1338
1420
  10
1339
1421
  )
1340
- ), o.appendChild(
1341
- re(
1422
+ ), i.appendChild(
1423
+ se(
1342
1424
  "pluno-pa-widget__character--launcher",
1343
1425
  t
1344
1426
  )
1345
1427
  );
1346
1428
  const a = document.createElement("input");
1347
- return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1429
+ if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a), o) {
1430
+ const l = document.createElement("button");
1431
+ l.type = "button", l.className = "pluno-pa-widget__launcher-minimize", l.textContent = "-", l.setAttribute("aria-label", "Minimize Pluno on this site"), l.title = "Minimize Pluno on this site", i.appendChild(l);
1432
+ }
1433
+ return i;
1348
1434
  }
1349
- function ia(e) {
1435
+ function hi(e) {
1350
1436
  const t = document.createElement("section");
1351
1437
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1352
- wn("pluno-pa-widget__scribble-spirals--panel", 16)
1438
+ Sn("pluno-pa-widget__scribble-spirals--panel", 16)
1353
1439
  );
1354
1440
  const n = document.createElement("div");
1355
1441
  n.className = "pluno-pa-widget__timeline-wrap";
1356
1442
  const o = document.createElement("main");
1357
- o.className = "pluno-pa-widget__timeline", o.appendChild(pa(e));
1358
- const a = document.createElement("div");
1359
- a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1443
+ o.className = "pluno-pa-widget__timeline", o.appendChild(fi(e));
1360
1444
  const i = document.createElement("div");
1361
- i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1445
+ i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1446
+ const a = document.createElement("div");
1447
+ a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a);
1362
1448
  const l = document.createElement("button");
1363
1449
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1364
1450
  const p = document.createElement("div");
1365
1451
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1366
- Ge(
1452
+ qe(
1367
1453
  "pluno-pa-widget__history",
1368
1454
  "Recent chats",
1369
- ma(),
1455
+ Ei(),
1370
1456
  !0
1371
1457
  )
1372
- ), n.appendChild(p), n.appendChild(la()), t.appendChild(n), t.appendChild(ra()), t;
1458
+ ), n.appendChild(p), n.appendChild(bi()), t.appendChild(n), t.appendChild(mi()), t;
1373
1459
  }
1374
- function ra() {
1460
+ function mi() {
1375
1461
  const e = document.createElement("form");
1376
1462
  e.className = "pluno-pa-widget__composer";
1377
1463
  const t = document.createElement("div");
@@ -1380,56 +1466,56 @@ function ra() {
1380
1466
  n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, e.appendChild(n);
1381
1467
  const o = document.createElement("div");
1382
1468
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1383
- const a = document.createElement("div");
1384
- a.className = "pluno-pa-widget__composer-inner";
1385
- const i = document.createElement("input");
1386
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = _o, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1469
+ const i = document.createElement("div");
1470
+ i.className = "pluno-pa-widget__composer-inner";
1471
+ const a = document.createElement("input");
1472
+ a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.accept = ko, a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
1387
1473
  const l = document.createElement("button");
1388
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(fa()), l.appendChild(wa()), a.appendChild(l);
1474
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ki()), l.appendChild(Li()), i.appendChild(l);
1389
1475
  const p = document.createElement("textarea");
1390
- p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1476
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1391
1477
  const c = document.createElement("button");
1392
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(_n()), a.appendChild(c), e.appendChild(a);
1478
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(kn()), i.appendChild(c), e.appendChild(i);
1393
1479
  const u = document.createElement("div");
1394
1480
  u.className = "pluno-pa-widget__composer-meta";
1395
- const s = document.createElement("a");
1396
- 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);
1397
- const b = document.createElement("span");
1398
- return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1481
+ const d = document.createElement("a");
1482
+ d.className = "pluno-pa-widget__powered-by", d.href = "https://pluno.ai", d.target = "_blank", d.rel = "noopener noreferrer", d.textContent = "Powered by Pluno.ai.", u.appendChild(d);
1483
+ const h = document.createElement("span");
1484
+ return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(h), e.appendChild(u), e;
1399
1485
  }
1400
- function la() {
1486
+ function bi() {
1401
1487
  const e = document.createElement("section");
1402
1488
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1403
1489
  const t = document.createElement("div");
1404
1490
  t.className = "pluno-pa-widget__history-header";
1405
1491
  const n = document.createElement("strong");
1406
1492
  n.textContent = "Recent chats";
1407
- const o = Ge(
1493
+ const o = qe(
1408
1494
  "pluno-pa-widget__history-close",
1409
1495
  "Close recent chats",
1410
- ba(),
1496
+ Si(),
1411
1497
  !1
1412
1498
  );
1413
1499
  t.append(n, o);
1414
- const a = document.createElement("div");
1415
- a.className = "pluno-pa-widget__history-list";
1416
- const i = document.createElement("p");
1417
- return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1500
+ const i = document.createElement("div");
1501
+ i.className = "pluno-pa-widget__history-list";
1502
+ const a = document.createElement("p");
1503
+ return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
1418
1504
  }
1419
- function pa(e) {
1505
+ function fi(e) {
1420
1506
  const t = document.createElement("div");
1421
1507
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1422
- re(
1508
+ se(
1423
1509
  "pluno-pa-widget__character--empty",
1424
1510
  e
1425
1511
  )
1426
- ), t.appendChild(bn()), t;
1512
+ ), t.appendChild(Cn()), t;
1427
1513
  }
1428
- function bn() {
1514
+ function Cn() {
1429
1515
  const e = document.createElement("div");
1430
1516
  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;
1431
1517
  }
1432
- function sa(e, t) {
1518
+ function wi(e, t) {
1433
1519
  e.replaceChildren(), e.setAttribute(
1434
1520
  "aria-label",
1435
1521
  `${t.toLocaleString("en-US")} users currently active`
@@ -1441,17 +1527,17 @@ function sa(e, t) {
1441
1527
  )
1442
1528
  );
1443
1529
  }
1444
- function re(e, t) {
1445
- const n = `pluno-pa-character-${Ut}`;
1446
- Ut += 1;
1447
- const o = t.scribbleStyle ? ca(t.accentColor, n) : da(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1530
+ function se(e, t) {
1531
+ const n = `pluno-pa-character-${$t}`;
1532
+ $t += 1;
1533
+ const o = t.scribbleStyle ? xi(t.accentColor, n) : _i(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1448
1534
  return o.setAttribute(
1449
1535
  "class",
1450
- a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1536
+ i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1451
1537
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1452
1538
  }
1453
- function da(e, t) {
1454
- const n = Wn(e), o = {
1539
+ function _i(e, t) {
1540
+ const n = Xn(e), o = {
1455
1541
  boltFill: `${t}-boltFill`,
1456
1542
  boltEdge: `${t}-boltEdge`,
1457
1543
  boltGlow: `${t}-boltGlow`,
@@ -1462,7 +1548,7 @@ function da(e, t) {
1462
1548
  eyeShadow: `${t}-eyeShadow`,
1463
1549
  pupilGloss: `${t}-pupilGloss`,
1464
1550
  boltClip: `${t}-boltClip`
1465
- }, a = fn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1551
+ }, i = En(), a = m(i, "defs"), l = m(a, "linearGradient", {
1466
1552
  id: o.boltFill,
1467
1553
  x1: "420",
1468
1554
  y1: "180",
@@ -1470,8 +1556,8 @@ function da(e, t) {
1470
1556
  y2: "1040",
1471
1557
  gradientUnits: "userSpaceOnUse"
1472
1558
  });
1473
- N(l, "0", n.top), N(l, "0.36", n.middle), N(l, "0.72", n.bottom), N(l, "1", n.bottom);
1474
- const p = m(i, "linearGradient", {
1559
+ M(l, "0", n.top), M(l, "0.36", n.middle), M(l, "0.72", n.bottom), M(l, "1", n.bottom);
1560
+ const p = m(a, "linearGradient", {
1475
1561
  id: o.boltEdge,
1476
1562
  x1: "470",
1477
1563
  y1: "145",
@@ -1479,29 +1565,29 @@ function da(e, t) {
1479
1565
  y2: "980",
1480
1566
  gradientUnits: "userSpaceOnUse"
1481
1567
  });
1482
- N(p, "0", n.edgeStart), N(p, "0.32", n.edgeMiddle), N(p, "0.78", n.edgeEnd), N(p, "1", n.edgeEnd);
1483
- const c = m(i, "radialGradient", {
1568
+ M(p, "0", n.edgeStart), M(p, "0.32", n.edgeMiddle), M(p, "0.78", n.edgeEnd), M(p, "1", n.edgeEnd);
1569
+ const c = m(a, "radialGradient", {
1484
1570
  id: o.boltGlow,
1485
1571
  cx: "50%",
1486
1572
  cy: "22%",
1487
1573
  r: "82%"
1488
1574
  });
1489
- N(c, "0", n.glow, "0.72"), N(c, "0.5", n.middle, "0.44"), N(c, "1", n.bottom, "0");
1490
- const u = m(i, "radialGradient", {
1575
+ M(c, "0", n.glow, "0.72"), M(c, "0.5", n.middle, "0.44"), M(c, "1", n.bottom, "0");
1576
+ const u = m(a, "radialGradient", {
1491
1577
  id: o.eyeWhite,
1492
1578
  cx: "35%",
1493
1579
  cy: "25%",
1494
1580
  r: "70%"
1495
1581
  });
1496
- N(u, "0", "#ffffff"), N(u, "0.72", "#ffffff"), N(u, "1", "#e5e5e5");
1497
- const s = m(i, "radialGradient", {
1582
+ M(u, "0", "#ffffff"), M(u, "0.72", "#ffffff"), M(u, "1", "#e5e5e5");
1583
+ const d = m(a, "radialGradient", {
1498
1584
  id: o.pupil,
1499
1585
  cx: "42%",
1500
1586
  cy: "38%",
1501
1587
  r: "65%"
1502
1588
  });
1503
- N(s, "0", "#2a1f10"), N(s, "0.52", "#080604"), N(s, "1", "#000000");
1504
- const b = m(i, "filter", {
1589
+ M(d, "0", "#2a1f10"), M(d, "0.52", "#080604"), M(d, "1", "#000000");
1590
+ const h = m(a, "filter", {
1505
1591
  id: o.softDropShadow,
1506
1592
  x: "-18%",
1507
1593
  y: "-12%",
@@ -1509,14 +1595,14 @@ function da(e, t) {
1509
1595
  height: "136%",
1510
1596
  "color-interpolation-filters": "sRGB"
1511
1597
  });
1512
- m(b, "feDropShadow", {
1598
+ m(h, "feDropShadow", {
1513
1599
  dx: "0",
1514
1600
  dy: "12",
1515
1601
  stdDeviation: "18",
1516
1602
  "flood-color": n.shadow,
1517
1603
  "flood-opacity": "0.24"
1518
1604
  });
1519
- const w = m(i, "filter", {
1605
+ const x = m(a, "filter", {
1520
1606
  id: o.innerDepth,
1521
1607
  x: "-8%",
1522
1608
  y: "-8%",
@@ -1524,32 +1610,32 @@ function da(e, t) {
1524
1610
  height: "116%",
1525
1611
  "color-interpolation-filters": "sRGB"
1526
1612
  });
1527
- m(w, "feGaussianBlur", {
1613
+ m(x, "feGaussianBlur", {
1528
1614
  in: "SourceAlpha",
1529
1615
  stdDeviation: "8",
1530
1616
  result: "blur"
1531
- }), m(w, "feOffset", {
1617
+ }), m(x, "feOffset", {
1532
1618
  dx: "-7",
1533
1619
  dy: "-9",
1534
1620
  result: "topLeft"
1535
- }), m(w, "feComposite", {
1621
+ }), m(x, "feComposite", {
1536
1622
  in: "topLeft",
1537
1623
  in2: "SourceAlpha",
1538
1624
  operator: "arithmetic",
1539
1625
  k2: "-1",
1540
1626
  k3: "1",
1541
1627
  result: "innerShadow"
1542
- }), m(w, "feColorMatrix", {
1628
+ }), m(x, "feColorMatrix", {
1543
1629
  in: "innerShadow",
1544
1630
  type: "matrix",
1545
1631
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1546
1632
  result: "innerLight"
1547
- }), m(w, "feBlend", {
1633
+ }), m(x, "feBlend", {
1548
1634
  in: "SourceGraphic",
1549
1635
  in2: "innerLight",
1550
1636
  mode: "screen"
1551
1637
  });
1552
- const P = m(i, "filter", {
1638
+ const y = m(a, "filter", {
1553
1639
  id: o.eyeShadow,
1554
1640
  x: "-24%",
1555
1641
  y: "-20%",
@@ -1557,14 +1643,14 @@ function da(e, t) {
1557
1643
  height: "148%",
1558
1644
  "color-interpolation-filters": "sRGB"
1559
1645
  });
1560
- m(P, "feDropShadow", {
1646
+ m(y, "feDropShadow", {
1561
1647
  dx: "0",
1562
1648
  dy: "8",
1563
1649
  stdDeviation: "5",
1564
1650
  "flood-color": n.shadow,
1565
1651
  "flood-opacity": "0.3"
1566
1652
  });
1567
- const L = m(i, "filter", {
1653
+ const A = m(a, "filter", {
1568
1654
  id: o.pupilGloss,
1569
1655
  x: "-15%",
1570
1656
  y: "-15%",
@@ -1572,51 +1658,51 @@ function da(e, t) {
1572
1658
  height: "130%",
1573
1659
  "color-interpolation-filters": "sRGB"
1574
1660
  });
1575
- m(L, "feDropShadow", {
1661
+ m(A, "feDropShadow", {
1576
1662
  dx: "0",
1577
1663
  dy: "3",
1578
1664
  stdDeviation: "3",
1579
1665
  "flood-color": "#000000",
1580
1666
  "flood-opacity": "0.22"
1581
1667
  });
1582
- const R = m(i, "clipPath", { id: o.boltClip });
1583
- m(R, "path", { d: Ue });
1584
- const y = m(a, "g", {
1585
- filter: $(o.softDropShadow)
1668
+ const T = m(a, "clipPath", { id: o.boltClip });
1669
+ m(T, "path", { d: He });
1670
+ const f = m(i, "g", {
1671
+ filter: q(o.softDropShadow)
1586
1672
  });
1587
- m(y, "path", {
1588
- d: Ue,
1589
- fill: $(o.boltEdge)
1673
+ m(f, "path", {
1674
+ d: He,
1675
+ fill: q(o.boltEdge)
1590
1676
  });
1591
- 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";
1592
- m(y, "path", {
1593
- d: C,
1594
- fill: $(o.boltFill),
1595
- filter: $(o.innerDepth)
1596
- }), m(y, "path", {
1597
- d: C,
1598
- fill: $(o.boltGlow),
1677
+ const E = "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";
1678
+ m(f, "path", {
1679
+ d: E,
1680
+ fill: q(o.boltFill),
1681
+ filter: q(o.innerDepth)
1682
+ }), m(f, "path", {
1683
+ d: E,
1684
+ fill: q(o.boltGlow),
1599
1685
  opacity: "0.74"
1600
1686
  });
1601
- const h = m(y, "g", {
1602
- "clip-path": $(o.boltClip),
1687
+ const g = m(f, "g", {
1688
+ "clip-path": q(o.boltClip),
1603
1689
  opacity: "0.42"
1604
1690
  });
1605
- m(h, "path", {
1691
+ m(g, "path", {
1606
1692
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
1607
1693
  fill: "none",
1608
1694
  stroke: n.highlight,
1609
1695
  "stroke-width": "22",
1610
1696
  "stroke-linecap": "round",
1611
1697
  opacity: "0.65"
1612
- }), m(h, "path", {
1698
+ }), m(g, "path", {
1613
1699
  d: "M556 685 L501 994",
1614
1700
  fill: "none",
1615
1701
  stroke: n.highlight,
1616
1702
  "stroke-width": "20",
1617
1703
  "stroke-linecap": "round",
1618
1704
  opacity: "0.55"
1619
- }), m(h, "path", {
1705
+ }), m(g, "path", {
1620
1706
  d: "M858 160 C882 166 893 181 883 204",
1621
1707
  fill: "none",
1622
1708
  stroke: n.inner,
@@ -1624,9 +1710,9 @@ function da(e, t) {
1624
1710
  "stroke-linecap": "round",
1625
1711
  opacity: "0.48"
1626
1712
  });
1627
- const g = m(a, "g", { filter: $(o.eyeShadow) });
1628
- return Wt(
1629
- g,
1713
+ const S = m(i, "g", { filter: q(o.eyeShadow) });
1714
+ return Kt(
1715
+ S,
1630
1716
  "rotate(-2 528 463)",
1631
1717
  "528",
1632
1718
  "463",
@@ -1635,8 +1721,8 @@ function da(e, t) {
1635
1721
  "557",
1636
1722
  "447",
1637
1723
  o
1638
- ), Wt(
1639
- g,
1724
+ ), Kt(
1725
+ S,
1640
1726
  "rotate(2 717 462)",
1641
1727
  "717",
1642
1728
  "462",
@@ -1645,15 +1731,15 @@ function da(e, t) {
1645
1731
  "728",
1646
1732
  "447",
1647
1733
  o
1648
- ), a;
1734
+ ), i;
1649
1735
  }
1650
- function ca(e, t) {
1651
- const n = on(e), o = {
1736
+ function xi(e, t) {
1737
+ const n = dn(e), o = {
1652
1738
  clip: `${t}-scribbleBoltClip`,
1653
1739
  wobble: `${t}-scribbleBoltWobble`
1654
- }, a = fn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1655
- m(l, "path", { d: Ue });
1656
- const p = m(i, "filter", {
1740
+ }, i = En(), a = m(i, "defs"), l = m(a, "clipPath", { id: o.clip });
1741
+ m(l, "path", { d: He });
1742
+ const p = m(a, "filter", {
1657
1743
  id: o.wobble,
1658
1744
  x: "-10%",
1659
1745
  y: "-10%",
@@ -1674,11 +1760,11 @@ function ca(e, t) {
1674
1760
  xChannelSelector: "R",
1675
1761
  yChannelSelector: "G"
1676
1762
  });
1677
- const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", {
1678
- "clip-path": $(o.clip)
1763
+ const c = m(i, "g", { filter: q(o.wobble) }), u = m(c, "g", {
1764
+ "clip-path": q(o.clip)
1679
1765
  });
1680
1766
  return m(u, "path", {
1681
- d: Hn(),
1767
+ d: Kn(),
1682
1768
  fill: "none",
1683
1769
  stroke: n,
1684
1770
  "stroke-width": "56",
@@ -1687,12 +1773,12 @@ function ca(e, t) {
1687
1773
  opacity: "0.9",
1688
1774
  transform: "rotate(-14 627 600)"
1689
1775
  }), m(c, "path", {
1690
- d: Ue,
1776
+ d: He,
1691
1777
  fill: "none",
1692
- stroke: Fe,
1778
+ stroke: Ge,
1693
1779
  "stroke-width": "18",
1694
1780
  "stroke-linejoin": "round"
1695
- }), $t(
1781
+ }), Xt(
1696
1782
  c,
1697
1783
  "rotate(-2 528 463)",
1698
1784
  "528",
@@ -1701,7 +1787,7 @@ function ca(e, t) {
1701
1787
  "473",
1702
1788
  "557",
1703
1789
  "447"
1704
- ), $t(
1790
+ ), Xt(
1705
1791
  c,
1706
1792
  "rotate(2 717 462)",
1707
1793
  "717",
@@ -1710,29 +1796,29 @@ function ca(e, t) {
1710
1796
  "473",
1711
1797
  "728",
1712
1798
  "447"
1713
- ), a;
1799
+ ), i;
1714
1800
  }
1715
- function fn() {
1801
+ function En() {
1716
1802
  return v("svg", {
1717
- xmlns: un,
1803
+ xmlns: wn,
1718
1804
  viewBox: "0 0 1254 1254"
1719
1805
  });
1720
1806
  }
1721
- function Wt(e, t, n, o, a, i, l, p, c) {
1807
+ function Kt(e, t, n, o, i, a, l, p, c) {
1722
1808
  const u = m(e, "g", { transform: t });
1723
1809
  m(u, "ellipse", {
1724
1810
  cx: n,
1725
1811
  cy: o,
1726
1812
  rx: "73",
1727
1813
  ry: "80",
1728
- fill: $(c.eyeWhite)
1814
+ fill: q(c.eyeWhite)
1729
1815
  }), m(u, "ellipse", {
1730
- cx: a,
1731
- cy: i,
1816
+ cx: i,
1817
+ cy: a,
1732
1818
  rx: "49",
1733
1819
  ry: "57",
1734
- fill: $(c.pupil),
1735
- filter: $(c.pupilGloss)
1820
+ fill: q(c.pupil),
1821
+ filter: q(c.pupilGloss)
1736
1822
  }), m(u, "circle", {
1737
1823
  cx: l,
1738
1824
  cy: p,
@@ -1740,7 +1826,7 @@ function Wt(e, t, n, o, a, i, l, p, c) {
1740
1826
  fill: "#ffffff"
1741
1827
  });
1742
1828
  }
1743
- function $t(e, t, n, o, a, i, l, p) {
1829
+ function Xt(e, t, n, o, i, a, l, p) {
1744
1830
  const c = m(e, "g", { transform: t });
1745
1831
  m(c, "ellipse", {
1746
1832
  cx: n,
@@ -1748,14 +1834,14 @@ function $t(e, t, n, o, a, i, l, p) {
1748
1834
  rx: "73",
1749
1835
  ry: "80",
1750
1836
  fill: "#ffffff",
1751
- stroke: Fe,
1837
+ stroke: Ge,
1752
1838
  "stroke-width": "13"
1753
1839
  }), m(c, "ellipse", {
1754
- cx: a,
1755
- cy: i,
1840
+ cx: i,
1841
+ cy: a,
1756
1842
  rx: "45",
1757
1843
  ry: "53",
1758
- fill: Fe
1844
+ fill: Ge
1759
1845
  }), m(c, "circle", {
1760
1846
  cx: l,
1761
1847
  cy: p,
@@ -1767,18 +1853,18 @@ function m(e, t, n = {}) {
1767
1853
  const o = v(t, n);
1768
1854
  return e.appendChild(o), o;
1769
1855
  }
1770
- function N(e, t, n, o) {
1771
- const a = { offset: t, "stop-color": n };
1772
- o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
1856
+ function M(e, t, n, o) {
1857
+ const i = { offset: t, "stop-color": n };
1858
+ o !== void 0 && (i["stop-opacity"] = o), m(e, "stop", i);
1773
1859
  }
1774
- function $(e) {
1860
+ function q(e) {
1775
1861
  return `url(#${e})`;
1776
1862
  }
1777
- function Ge(e, t, n, o) {
1778
- const a = document.createElement("button");
1779
- return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1863
+ function qe(e, t, n, o) {
1864
+ const i = document.createElement("button");
1865
+ return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
1780
1866
  }
1781
- function ua() {
1867
+ function yi() {
1782
1868
  const e = v("svg", {
1783
1869
  class: "pluno-pa-widget__scribble-defs",
1784
1870
  "aria-hidden": "true",
@@ -1786,48 +1872,48 @@ function ua() {
1786
1872
  width: "0",
1787
1873
  height: "0"
1788
1874
  }), t = v("defs");
1789
- return t.appendChild(tt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
1790
- tt("pluno-pa-scribble-wobble-2", "5", "15")
1875
+ return t.appendChild(lt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
1876
+ lt("pluno-pa-scribble-wobble-2", "5", "15")
1791
1877
  ), t.appendChild(
1792
- tt("pluno-pa-scribble-wobble-3", "9", "19")
1878
+ lt("pluno-pa-scribble-wobble-3", "9", "19")
1793
1879
  ), e.appendChild(t), e;
1794
1880
  }
1795
- function wn(e, t) {
1796
- const n = t * Rt + Mt * 2, o = v("svg", {
1881
+ function Sn(e, t) {
1882
+ const n = t * Ft + Ht * 2, o = v("svg", {
1797
1883
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1798
- viewBox: `0 0 ${n} ${To}`,
1884
+ viewBox: `0 0 ${n} ${Fo}`,
1799
1885
  preserveAspectRatio: "xMidYMid meet",
1800
1886
  "aria-hidden": "true",
1801
1887
  focusable: "false"
1802
1888
  });
1803
- for (let a = 0; a < t; a += 1) {
1804
- const i = Bt[a % Bt.length], l = v("g", {
1805
- transform: `translate(${Mt + a * Rt} 0)`
1889
+ for (let i = 0; i < t; i += 1) {
1890
+ const a = Gt[i % Gt.length], l = v("g", {
1891
+ transform: `translate(${Ht + i * Ft} 0)`
1806
1892
  });
1807
1893
  l.appendChild(
1808
1894
  v("ellipse", {
1809
- cx: i.ellipseCx,
1810
- cy: i.ellipseCy,
1811
- rx: i.ellipseRx,
1812
- ry: i.ellipseRy,
1895
+ cx: a.ellipseCx,
1896
+ cy: a.ellipseCy,
1897
+ rx: a.ellipseRx,
1898
+ ry: a.ellipseRy,
1813
1899
  fill: "none",
1814
1900
  stroke: "#2c2a1e",
1815
- "stroke-width": i.strokeWidth,
1901
+ "stroke-width": a.strokeWidth,
1816
1902
  opacity: "0.8"
1817
1903
  })
1818
1904
  ), l.appendChild(
1819
1905
  v("path", {
1820
- d: i.path,
1906
+ d: a.path,
1821
1907
  fill: "none",
1822
1908
  stroke: "#2c2a1e",
1823
- "stroke-width": i.pathStrokeWidth,
1909
+ "stroke-width": a.pathStrokeWidth,
1824
1910
  "stroke-linecap": "round"
1825
1911
  })
1826
1912
  ), o.appendChild(l);
1827
1913
  }
1828
1914
  return o;
1829
1915
  }
1830
- function tt(e, t, n) {
1916
+ function lt(e, t, n) {
1831
1917
  const o = v("filter", {
1832
1918
  id: e,
1833
1919
  x: "-8%",
@@ -1870,8 +1956,8 @@ function tt(e, t, n) {
1870
1956
  })
1871
1957
  ), o;
1872
1958
  }
1873
- function ga(e) {
1874
- const t = Z(
1959
+ function vi(e) {
1960
+ const t = ee(
1875
1961
  "0 0 24 24",
1876
1962
  e,
1877
1963
  e,
@@ -1881,8 +1967,8 @@ function ga(e) {
1881
1967
  );
1882
1968
  return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1883
1969
  }
1884
- function ha() {
1885
- const e = Z(
1970
+ function Ci() {
1971
+ const e = ee(
1886
1972
  "0 0 24 24",
1887
1973
  17,
1888
1974
  17,
@@ -1900,8 +1986,8 @@ function ha() {
1900
1986
  })
1901
1987
  ), e;
1902
1988
  }
1903
- function ma() {
1904
- const e = Z(
1989
+ function Ei() {
1990
+ const e = ee(
1905
1991
  "0 0 24 24",
1906
1992
  17,
1907
1993
  17,
@@ -1911,8 +1997,8 @@ function ma() {
1911
1997
  );
1912
1998
  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;
1913
1999
  }
1914
- function ba() {
1915
- const e = Z(
2000
+ function Si() {
2001
+ const e = ee(
1916
2002
  "0 0 24 24",
1917
2003
  15,
1918
2004
  15,
@@ -1922,8 +2008,8 @@ function ba() {
1922
2008
  );
1923
2009
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1924
2010
  }
1925
- function _n() {
1926
- const e = Z(
2011
+ function kn() {
2012
+ const e = ee(
1927
2013
  "0 0 24 24",
1928
2014
  14,
1929
2015
  14,
@@ -1935,8 +2021,8 @@ function _n() {
1935
2021
  v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
1936
2022
  ), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1937
2023
  }
1938
- function fa() {
1939
- const e = Z(
2024
+ function ki() {
2025
+ const e = ee(
1940
2026
  "0 0 24 24",
1941
2027
  16,
1942
2028
  16,
@@ -1953,8 +2039,8 @@ function fa() {
1953
2039
  })
1954
2040
  ), e;
1955
2041
  }
1956
- function wa() {
1957
- const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
2042
+ function Li() {
2043
+ const e = ee("0 0 24 24", 19, 19, "none", "currentColor");
1958
2044
  return e.setAttribute(
1959
2045
  "class",
1960
2046
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
@@ -1968,8 +2054,8 @@ function wa() {
1968
2054
  })
1969
2055
  ), e;
1970
2056
  }
1971
- function _a() {
1972
- const e = Z("0 0 24 24", 18, 18, "currentColor");
2057
+ function Pi() {
2058
+ const e = ee("0 0 24 24", 18, 18, "currentColor");
1973
2059
  return e.appendChild(
1974
2060
  v("rect", {
1975
2061
  x: "6",
@@ -1980,8 +2066,8 @@ function _a() {
1980
2066
  })
1981
2067
  ), e;
1982
2068
  }
1983
- function xa() {
1984
- const e = Z(
2069
+ function Ai() {
2070
+ const e = ee(
1985
2071
  "0 0 24 24",
1986
2072
  12,
1987
2073
  12,
@@ -1991,8 +2077,8 @@ function xa() {
1991
2077
  );
1992
2078
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1993
2079
  }
1994
- function ya() {
1995
- const e = Z(
2080
+ function Ii() {
2081
+ const e = ee(
1996
2082
  "0 0 24 24",
1997
2083
  13,
1998
2084
  13,
@@ -2015,7 +2101,7 @@ function ya() {
2015
2101
  })
2016
2102
  ), e;
2017
2103
  }
2018
- function Z(e, t, n, o, a, i) {
2104
+ function ee(e, t, n, o, i, a) {
2019
2105
  const l = {
2020
2106
  viewBox: e,
2021
2107
  width: String(t),
@@ -2023,43 +2109,43 @@ function Z(e, t, n, o, a, i) {
2023
2109
  fill: o,
2024
2110
  "aria-hidden": "true"
2025
2111
  };
2026
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
2112
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), v("svg", l);
2027
2113
  }
2028
2114
  function v(e, t = {}) {
2029
- const n = document.createElementNS(un, e);
2030
- for (const [o, a] of Object.entries(t))
2031
- n.setAttribute(o, a);
2115
+ const n = document.createElementNS(wn, e);
2116
+ for (const [o, i] of Object.entries(t))
2117
+ n.setAttribute(o, i);
2032
2118
  return n;
2033
2119
  }
2034
- function qt(e) {
2120
+ function Zt(e) {
2035
2121
  for (const t of ["keydown", "keypress", "keyup"])
2036
2122
  e.addEventListener(t, (n) => {
2037
2123
  n.stopPropagation();
2038
2124
  });
2039
2125
  }
2040
- function va(e, t, n) {
2126
+ function Ti(e, t, n) {
2041
2127
  e.replaceChildren(), e.hidden = t.length === 0;
2042
- for (const [o, a] of t.entries()) {
2043
- const i = document.createElement("div");
2044
- i.className = "pluno-pa-widget__attachment", i.appendChild(Ca(a));
2128
+ for (const [o, i] of t.entries()) {
2129
+ const a = document.createElement("div");
2130
+ a.className = "pluno-pa-widget__attachment", a.appendChild(Ni(i));
2045
2131
  const l = document.createElement("span");
2046
- l.textContent = a.name, i.appendChild(l);
2132
+ l.textContent = i.name, a.appendChild(l);
2047
2133
  const p = document.createElement("button");
2048
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(xa()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
2134
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ai()), p.addEventListener("click", () => n(o)), a.appendChild(p), e.appendChild(a);
2049
2135
  }
2050
2136
  }
2051
- function Ca(e) {
2052
- if (xn(e)) {
2137
+ function Ni(e) {
2138
+ if (Ln(e)) {
2053
2139
  const n = document.createElement("img");
2054
2140
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
2055
2141
  }
2056
2142
  const t = document.createElement("span");
2057
2143
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
2058
2144
  }
2059
- function Ea(e) {
2060
- if (xn(e)) {
2061
- const a = document.createElement("img");
2062
- return a.src = e.dataUrl, a.alt = e.name, a;
2145
+ function Di(e) {
2146
+ if (Ln(e)) {
2147
+ const i = document.createElement("img");
2148
+ return i.src = e.dataUrl, i.alt = e.name, i;
2063
2149
  }
2064
2150
  const t = document.createElement("div");
2065
2151
  t.className = "pluno-pa-widget__message-attachment-file";
@@ -2068,88 +2154,88 @@ function Ea(e) {
2068
2154
  const o = document.createElement("strong");
2069
2155
  return o.textContent = e.name, t.append(n, o), t;
2070
2156
  }
2071
- function xn(e) {
2157
+ function Ln(e) {
2072
2158
  return e.mimeType.startsWith("image/");
2073
2159
  }
2074
- function Sa(e) {
2160
+ function Ri(e) {
2075
2161
  return e === "application/pdf" ? "document.pdf" : "image";
2076
2162
  }
2077
- async function ka(e) {
2163
+ async function Mi(e) {
2078
2164
  if (!e)
2079
2165
  return [];
2080
2166
  const t = Array.from(e);
2081
- if (t.length > ze)
2167
+ if (t.length > We)
2082
2168
  throw new Error(
2083
- `Attach up to ${ze} files per message.`
2169
+ `Attach up to ${We} files per message.`
2084
2170
  );
2085
2171
  return Promise.all(
2086
2172
  t.map(async (n) => {
2087
- const o = La(n);
2173
+ const o = zi(n);
2088
2174
  if (!o)
2089
2175
  throw new Error(
2090
2176
  "Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files."
2091
2177
  );
2092
- if (n.size > wo)
2178
+ if (n.size > So)
2093
2179
  throw new Error("Each Pluno attachment can be up to 10 MB.");
2094
2180
  if (o === "image/gif") {
2095
- const a = new Uint8Array(await Ba(n));
2096
- if (Pa(a))
2181
+ const i = new Uint8Array(await qi(n));
2182
+ if (Oi(i))
2097
2183
  throw new Error("Pluno supports non-animated GIF images.");
2098
2184
  }
2099
2185
  return {
2100
- name: n.name || Sa(o),
2186
+ name: n.name || Ri(o),
2101
2187
  mimeType: o,
2102
2188
  sizeBytes: n.size,
2103
- dataUrl: Aa(
2104
- await Oa(n),
2189
+ dataUrl: Bi(
2190
+ await ji(n),
2105
2191
  o
2106
2192
  )
2107
2193
  };
2108
2194
  })
2109
2195
  );
2110
2196
  }
2111
- function La(e) {
2112
- if (sn.has(e.type))
2197
+ function zi(e) {
2198
+ if (mn.has(e.type))
2113
2199
  return e.type;
2114
2200
  const t = e.name.toLowerCase();
2115
2201
  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;
2116
2202
  }
2117
- function Aa(e, t) {
2203
+ function Bi(e, t) {
2118
2204
  const n = `data:${t};base64,`;
2119
2205
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
2120
2206
  }
2121
- function Pa(e) {
2122
- if (e.length < 14 || !Ta(e))
2207
+ function Oi(e) {
2208
+ if (e.length < 14 || !Ui(e))
2123
2209
  return !1;
2124
2210
  const t = e[10];
2125
2211
  let n = 13;
2126
2212
  t & 128 && (n += 3 * 2 ** ((t & 7) + 1));
2127
2213
  let o = 0;
2128
2214
  for (; n < e.length; ) {
2129
- const a = e[n];
2130
- if (n += 1, a === 59)
2215
+ const i = e[n];
2216
+ if (n += 1, i === 59)
2131
2217
  return !1;
2132
- if (a === 33) {
2133
- n += 1, n = jt(e, n);
2218
+ if (i === 33) {
2219
+ n += 1, n = Jt(e, n);
2134
2220
  continue;
2135
2221
  }
2136
- if (a !== 44)
2222
+ if (i !== 44)
2137
2223
  return !1;
2138
2224
  if (o += 1, o > 1)
2139
2225
  return !0;
2140
2226
  if (n + 9 >= e.length)
2141
2227
  return !1;
2142
- const i = e[n + 8];
2143
- if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
2228
+ const a = e[n + 8];
2229
+ if (n += 9, a & 128 && (n += 3 * 2 ** ((a & 7) + 1)), n >= e.length)
2144
2230
  return !1;
2145
- n += 1, n = jt(e, n);
2231
+ n += 1, n = Jt(e, n);
2146
2232
  }
2147
2233
  return !1;
2148
2234
  }
2149
- function Ta(e) {
2235
+ function Ui(e) {
2150
2236
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
2151
2237
  }
2152
- function jt(e, t) {
2238
+ function Jt(e, t) {
2153
2239
  for (; t < e.length; ) {
2154
2240
  const n = e[t];
2155
2241
  if (t += 1, n === 0)
@@ -2158,81 +2244,81 @@ function jt(e, t) {
2158
2244
  }
2159
2245
  return t;
2160
2246
  }
2161
- function Me(e) {
2247
+ function Oe(e) {
2162
2248
  return !!(e && Array.from(e.types).includes("Files"));
2163
2249
  }
2164
- function nt(e, t, n = null) {
2165
- if (!e || !pt(t, n)) {
2250
+ function pt(e, t, n = null) {
2251
+ if (!e || !ht(t, n)) {
2166
2252
  e && (e.hidden = !0, e.replaceChildren());
2167
2253
  return;
2168
2254
  }
2169
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || ut(n) ? e.appendChild(
2170
- Ia(t, n)
2171
- ) : yn(t) && e.appendChild(Na(t));
2255
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", J(t) || wt(n) ? e.appendChild(
2256
+ Fi(t, n)
2257
+ ) : Pn(t) && e.appendChild(Hi(t));
2172
2258
  }
2173
- function Ia(e, t) {
2259
+ function Fi(e, t) {
2174
2260
  const n = document.createElement("div");
2175
2261
  n.className = "pluno-pa-widget__billing-action-card";
2176
- const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
2177
- a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
2178
- const i = document.createElement("span");
2179
- 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(
2180
- vn(
2262
+ const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2263
+ i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2264
+ const a = document.createElement("span");
2265
+ return a.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(a), n.appendChild(
2266
+ An(
2181
2267
  e,
2182
2268
  "Upgrade plan",
2183
2269
  "pluno-pa-widget__billing-action-card-actions"
2184
2270
  )
2185
2271
  ), n;
2186
2272
  }
2187
- function Na(e) {
2273
+ function Hi(e) {
2188
2274
  const t = document.createElement("div");
2189
2275
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2190
2276
  const n = document.createElement("strong");
2191
2277
  n.textContent = "Credits running low", t.appendChild(n);
2192
2278
  const o = document.createElement("span");
2193
- return o.textContent = Ra(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2194
- vn(
2279
+ return o.textContent = Wi(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2280
+ An(
2195
2281
  e,
2196
2282
  "Upgrade",
2197
2283
  "pluno-pa-widget__billing-action-card-actions"
2198
2284
  )
2199
2285
  ), t;
2200
2286
  }
2201
- function pt(e, t) {
2202
- return e !== null && (X(e) || yn(e) || ut(t));
2287
+ function ht(e, t) {
2288
+ return e !== null && (J(e) || Pn(e) || wt(t));
2203
2289
  }
2204
- function Vt(e, t, n) {
2205
- return pt(t, n) || Da(t) ? !0 : !pt(e, n);
2290
+ function Qt(e, t, n) {
2291
+ return ht(t, n) || Gi(t) ? !0 : !ht(e, n);
2206
2292
  }
2207
- function Da(e) {
2208
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
2293
+ function Gi(e) {
2294
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || J(e));
2209
2295
  }
2210
- function X(e) {
2296
+ function J(e) {
2211
2297
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2212
2298
  }
2213
- function ut(e) {
2299
+ function wt(e) {
2214
2300
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2215
2301
  }
2216
- function yn(e) {
2217
- return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2302
+ function Pn(e) {
2303
+ return !J(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2218
2304
  }
2219
- function Ra(e) {
2220
- return e.creditsRemaining === null ? null : `${Ma(e.creditsRemaining)} credits left`;
2305
+ function Wi(e) {
2306
+ return e.creditsRemaining === null ? null : `${$i(e.creditsRemaining)} credits left`;
2221
2307
  }
2222
- function Ma(e) {
2308
+ function $i(e) {
2223
2309
  return new Intl.NumberFormat("en-US", {
2224
2310
  maximumFractionDigits: 0
2225
2311
  }).format(Math.ceil(e));
2226
2312
  }
2227
- function vn(e, t, n) {
2313
+ function An(e, t, n) {
2228
2314
  const o = document.createElement("div");
2229
2315
  return o.className = n, o.appendChild(
2230
- Yt(t, e.pricingUrl)
2316
+ en(t, e.pricingUrl)
2231
2317
  ), o.appendChild(
2232
- Yt("Earn credits", e.earnCreditsUrl)
2318
+ en("Earn credits", e.earnCreditsUrl)
2233
2319
  ), o;
2234
2320
  }
2235
- function Yt(e, t) {
2321
+ function en(e, t) {
2236
2322
  const n = document.createElement("button");
2237
2323
  if (n.type = "button", e === "Earn credits") {
2238
2324
  const o = document.createElement("span");
@@ -2243,7 +2329,7 @@ function Yt(e, t) {
2243
2329
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2244
2330
  }), n;
2245
2331
  }
2246
- function Ba(e) {
2332
+ function qi(e) {
2247
2333
  return new Promise((t, n) => {
2248
2334
  const o = new FileReader();
2249
2335
  o.addEventListener("load", () => {
@@ -2257,7 +2343,7 @@ function Ba(e) {
2257
2343
  }), o.readAsArrayBuffer(e);
2258
2344
  });
2259
2345
  }
2260
- function Oa(e) {
2346
+ function ji(e) {
2261
2347
  return new Promise((t, n) => {
2262
2348
  const o = new FileReader();
2263
2349
  o.addEventListener("load", () => {
@@ -2271,118 +2357,118 @@ function Oa(e) {
2271
2357
  }), o.readAsDataURL(e);
2272
2358
  });
2273
2359
  }
2274
- function Kt(e, t) {
2360
+ function tn(e, t) {
2275
2361
  return e.messages.filter(
2276
- (o) => !Cn(o)
2362
+ (o) => !In(o)
2277
2363
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2278
2364
  }
2279
- function Ua(e, t, n, o, a, i, l, p, c, u, s, b, w, P, L) {
2280
- const R = Fa(i), y = R.filter(
2281
- (_) => !Cn(_)
2282
- ), C = e.scrollTop;
2283
- e.replaceChildren(), Sn(n, i.isThinking), a.hidden = !p, p && l !== null && sa(a, l);
2284
- const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
2285
- if (o(h), y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
2365
+ function Vi(e, t, n, o, i, a, l, p, c, u, d, h, x, y, A) {
2366
+ const T = Yi(a), f = T.filter(
2367
+ (_) => !In(_)
2368
+ ), E = e.scrollTop;
2369
+ e.replaceChildren(), Nn(n, a.isThinking), i.hidden = !p, p && l !== null && wi(i, l);
2370
+ const g = f.length > 0 || !!a.assistantDraft || a.isThinking;
2371
+ if (o(g), f.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
2286
2372
  const _ = document.createElement("div");
2287
2373
  _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2288
- const T = document.createElement("div");
2289
- T.className = "pluno-pa-widget__empty-hero";
2290
- const be = re(
2374
+ const N = document.createElement("div");
2375
+ N.className = "pluno-pa-widget__empty-hero";
2376
+ const F = se(
2291
2377
  "pluno-pa-widget__character--empty",
2292
- w()
2378
+ x()
2293
2379
  );
2294
- T.appendChild(be), _.appendChild(T), _.appendChild(bn());
2295
- const k = document.createElement("div");
2296
- if (k.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && !i.starterPromptsLoading && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
2297
- for (const A of i.starterPrompts) {
2298
- const x = document.createElement("button");
2299
- x.type = "button", x.className = "pluno-pa-widget__starter-prompt", x.textContent = `"${A}"`, x.addEventListener("click", () => {
2300
- P(A);
2301
- }), k.appendChild(x);
2380
+ N.appendChild(F), _.appendChild(N), _.appendChild(Cn());
2381
+ const H = document.createElement("div");
2382
+ if (H.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
2383
+ for (const L of a.starterPrompts) {
2384
+ const I = document.createElement("button");
2385
+ I.type = "button", I.className = "pluno-pa-widget__starter-prompt", I.textContent = `"${L}"`, I.addEventListener("click", () => {
2386
+ y(L);
2387
+ }), H.appendChild(I);
2302
2388
  }
2303
- else if (i.starterPromptsLoading) {
2304
- const A = document.createElement("button");
2305
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", k.appendChild(A);
2389
+ else if (a.starterPromptsLoading) {
2390
+ const L = document.createElement("button");
2391
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", L.disabled = !0, L.tabIndex = -1, L.textContent = "Generating example tasks...", H.appendChild(L);
2306
2392
  } else
2307
- for (let A = 0; A < xo; A += 1) {
2308
- const x = document.createElement("button");
2309
- x.type = "button", x.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", x.disabled = !0, x.tabIndex = -1, x.textContent = "", k.appendChild(x);
2393
+ for (let L = 0; L < Lo; L += 1) {
2394
+ const I = document.createElement("button");
2395
+ I.type = "button", I.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", I.disabled = !0, I.tabIndex = -1, I.textContent = "", H.appendChild(I);
2310
2396
  }
2311
- _.appendChild(k), e.appendChild(_), e.appendChild(t);
2397
+ _.appendChild(H), e.appendChild(_), e.appendChild(t);
2312
2398
  return;
2313
2399
  }
2314
- let g = null, E = null, O = [];
2315
- const le = y.some(st), me = () => {
2316
- if (O.length === 0)
2400
+ let S = null, k = null, R = [];
2401
+ const Ce = f.some(mt), b = () => {
2402
+ if (R.length === 0)
2317
2403
  return !1;
2318
- const _ = Ka(
2319
- O,
2320
- s,
2321
- b,
2322
- w()
2404
+ const _ = ia(
2405
+ R,
2406
+ d,
2407
+ h,
2408
+ x()
2323
2409
  );
2324
- return e.appendChild(_), g = null, E = _, O = [], !0;
2410
+ return e.appendChild(_), S = null, k = _, R = [], !0;
2325
2411
  };
2326
- for (let _ = 0; _ < y.length; _ += 1) {
2327
- const T = y[_];
2328
- if (T.role === "tool") {
2329
- O.push(T);
2412
+ for (let _ = 0; _ < f.length; _ += 1) {
2413
+ const N = f[_];
2414
+ if (N.role === "tool") {
2415
+ R.push(N);
2330
2416
  continue;
2331
2417
  }
2332
- if (st(T)) {
2333
- if (me()) {
2334
- const G = dt();
2335
- e.appendChild(G), g = null, E = G;
2418
+ if (mt(N)) {
2419
+ if (b()) {
2420
+ const P = bt();
2421
+ e.appendChild(P), S = null, k = P;
2336
2422
  } else {
2337
- const G = Jt(w());
2338
- e.appendChild(G), g = null, E = G;
2423
+ const P = an(x());
2424
+ e.appendChild(P), S = null, k = P;
2339
2425
  }
2340
2426
  continue;
2341
2427
  }
2342
- if (T.role === "system")
2428
+ if (N.role === "system")
2343
2429
  continue;
2344
- const be = me(), k = Ya(T.content);
2345
- if (T.role === "assistant" && !be) {
2346
- const U = En(w());
2347
- e.appendChild(U), g = null, E = U;
2348
- }
2349
- const A = document.createElement("div");
2350
- A.className = `pluno-pa-widget__message pluno-pa-widget__message--${T.role}`, T.role === "assistant" ? Za(A, k) : A.textContent = k, T.role === "user" && T.attachments?.length && A.appendChild(za(T.attachments));
2351
- const x = document.createElement("div");
2352
- x.className = "pluno-pa-widget__message-actions", x.appendChild(Ga(k)), A.appendChild(x), e.appendChild(A), g = A, E = null;
2430
+ const F = b(), H = oa(N.content);
2431
+ if (N.role === "assistant" && !F) {
2432
+ const be = Tn(x());
2433
+ e.appendChild(be), S = null, k = be;
2434
+ }
2435
+ const L = document.createElement("div");
2436
+ L.className = `pluno-pa-widget__message pluno-pa-widget__message--${N.role}`, N.role === "assistant" ? ra(L, H) : L.textContent = H, N.role === "user" && N.attachments?.length && L.appendChild(Ki(N.attachments));
2437
+ const I = document.createElement("div");
2438
+ I.className = "pluno-pa-widget__message-actions", I.appendChild(Xi(H)), L.appendChild(I), e.appendChild(L), S = L, k = null;
2353
2439
  }
2354
- const z = me();
2355
- if (i.isThinking && !i.assistantDraft && !le)
2356
- if (z) {
2357
- const _ = dt();
2358
- e.appendChild(_), g = null, E = _;
2440
+ const ie = b();
2441
+ if (a.isThinking && !a.assistantDraft && !Ce)
2442
+ if (ie) {
2443
+ const _ = bt();
2444
+ e.appendChild(_), S = null, k = _;
2359
2445
  } else {
2360
- const _ = Jt(w());
2361
- e.appendChild(_), g = null, E = _;
2446
+ const _ = an(x());
2447
+ e.appendChild(_), S = null, k = _;
2362
2448
  }
2363
- if (i.lastError) {
2449
+ if (a.lastError) {
2364
2450
  const _ = document.createElement("div");
2365
- _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
2451
+ _.className = "pluno-pa-widget__error", _.textContent = a.lastError, e.appendChild(_), S = _, k = null;
2366
2452
  }
2367
- const ne = L && !i.isThinking ? Vn(R) : null;
2368
- if (L && ne && !L.dismissedCandidateIds.has(ne.id)) {
2369
- const _ = Ha(ne, {
2370
- isDrafting: L.draftingCandidateId === ne.id,
2371
- error: L.error,
2372
- characterIconOptions: L.characterIconOptions,
2373
- onDraft: L.onDraft,
2374
- onDismiss: L.onDismiss,
2375
- onDisable: L.onDisable
2453
+ const ae = A && !a.isThinking ? eo(T) : null;
2454
+ if (A && ae && !A.dismissedCandidateIds.has(ae.id)) {
2455
+ const _ = Zi(ae, {
2456
+ isDrafting: A.draftingCandidateId === ae.id,
2457
+ error: A.error,
2458
+ characterIconOptions: A.characterIconOptions,
2459
+ onDraft: A.onDraft,
2460
+ onDismiss: A.onDismiss,
2461
+ onDisable: A.onDisable
2376
2462
  });
2377
- e.appendChild(_), L.onSeen(ne), g = null, E = _;
2463
+ e.appendChild(_), A.onSeen(ae), S = null, k = _;
2378
2464
  }
2379
- g?.classList.add(
2465
+ S?.classList.add(
2380
2466
  "pluno-pa-widget__message--bottom-reserve"
2381
- ), E?.classList.add(
2467
+ ), k?.classList.add(
2382
2468
  "pluno-pa-widget__bottom-reserve-compact"
2383
- ), e.appendChild(t), c ? ke(e, u) : e.scrollTop = C;
2469
+ ), e.appendChild(t), c ? Ie(e, u) : e.scrollTop = E;
2384
2470
  }
2385
- function Fa(e) {
2471
+ function Yi(e) {
2386
2472
  if (!e.assistantDraft)
2387
2473
  return [...e.messages];
2388
2474
  const t = {
@@ -2397,12 +2483,12 @@ function Fa(e) {
2397
2483
  if (!t.respondsToUserMessageId)
2398
2484
  return [...e.messages, t];
2399
2485
  const n = e.messages.findIndex(
2400
- (i) => i.role === "user" && i.id === t.respondsToUserMessageId
2486
+ (a) => a.role === "user" && a.id === t.respondsToUserMessageId
2401
2487
  );
2402
2488
  if (n === -1)
2403
2489
  return [...e.messages, t];
2404
2490
  const o = e.messages.findIndex(
2405
- (i, l) => l > n && i.role !== "user" && i.respondsToUserMessageId === t.respondsToUserMessageId && Xt(i, t) && st(i)
2491
+ (a, l) => l > n && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && nn(a, t) && mt(a)
2406
2492
  );
2407
2493
  if (o !== -1)
2408
2494
  return [
@@ -2410,73 +2496,73 @@ function Fa(e) {
2410
2496
  t,
2411
2497
  ...e.messages.slice(o + 1)
2412
2498
  ];
2413
- let a = n + 1;
2414
- for (; a < e.messages.length && e.messages[a].role !== "user" && e.messages[a].respondsToUserMessageId === t.respondsToUserMessageId && Xt(e.messages[a], t); )
2415
- a += 1;
2499
+ let i = n + 1;
2500
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && nn(e.messages[i], t); )
2501
+ i += 1;
2416
2502
  return [
2417
- ...e.messages.slice(0, a),
2503
+ ...e.messages.slice(0, i),
2418
2504
  t,
2419
- ...e.messages.slice(a)
2505
+ ...e.messages.slice(i)
2420
2506
  ];
2421
2507
  }
2422
- function st(e) {
2508
+ function mt(e) {
2423
2509
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2424
2510
  }
2425
- function Xt(e, t) {
2511
+ function nn(e, t) {
2426
2512
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2427
2513
  }
2428
- function Zt(e, t, n, o, a, i, l, p) {
2429
- e.replaceChildren(), Sn(t, !1), t.disabled = !0, n(!1);
2514
+ function on(e, t, n, o, i, a, l, p) {
2515
+ e.replaceChildren(), Nn(t, !1), t.disabled = !0, n(!1);
2430
2516
  const c = document.createElement("div");
2431
2517
  c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2432
- const u = re(
2518
+ const u = se(
2433
2519
  "pluno-pa-widget__character--empty",
2434
2520
  o()
2435
2521
  );
2436
2522
  c.appendChild(u);
2437
- const s = document.createElement("div");
2438
- if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
2439
- const b = document.createElement("a");
2440
- b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, c.appendChild(b);
2523
+ const d = document.createElement("div");
2524
+ if (d.className = "pluno-pa-widget__empty", d.textContent = i, c.appendChild(d), l) {
2525
+ const h = document.createElement("a");
2526
+ h.className = "pluno-pa-widget__login", h.href = l, h.target = "_blank", h.rel = "noopener noreferrer", h.textContent = a, c.appendChild(h);
2441
2527
  } else {
2442
- const b = document.createElement("button");
2443
- b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => p?.()), c.appendChild(b);
2528
+ const h = document.createElement("button");
2529
+ h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = a, h.addEventListener("click", () => p?.()), c.appendChild(h);
2444
2530
  }
2445
2531
  e.appendChild(c);
2446
2532
  }
2447
- function za(e) {
2533
+ function Ki(e) {
2448
2534
  const t = document.createElement("div");
2449
2535
  t.className = "pluno-pa-widget__message-attachments";
2450
2536
  for (const n of e)
2451
- t.appendChild(Ea(n));
2537
+ t.appendChild(Di(n));
2452
2538
  return t;
2453
2539
  }
2454
- function Ga(e) {
2540
+ function Xi(e) {
2455
2541
  const t = document.createElement("button");
2456
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ya()), t.addEventListener("click", (n) => {
2542
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ii()), t.addEventListener("click", (n) => {
2457
2543
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2458
2544
  }), t;
2459
2545
  }
2460
- function Ha(e, t) {
2546
+ function Zi(e, t) {
2461
2547
  const n = document.createElement("article");
2462
2548
  n.className = "pluno-pa-widget__share-prompt";
2463
2549
  const o = document.createElement("div");
2464
2550
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2465
- re(
2551
+ se(
2466
2552
  "pluno-pa-widget__share-prompt-icon",
2467
2553
  t.characterIconOptions
2468
2554
  )
2469
2555
  );
2470
- const a = document.createElement("div");
2471
- a.className = "pluno-pa-widget__share-prompt-copy";
2472
- const i = document.createElement("strong");
2473
- i.textContent = "Share this win?", a.appendChild(i);
2556
+ const i = document.createElement("div");
2557
+ i.className = "pluno-pa-widget__share-prompt-copy";
2558
+ const a = document.createElement("strong");
2559
+ a.textContent = "Share this win?", i.appendChild(a);
2474
2560
  const l = document.createElement("span");
2475
- if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
2476
- const s = document.createElement("span");
2477
- s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
2561
+ if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2562
+ const d = document.createElement("span");
2563
+ d.className = "pluno-pa-widget__share-prompt-error", d.textContent = t.error, i.appendChild(d);
2478
2564
  }
2479
- o.appendChild(a);
2565
+ o.appendChild(i);
2480
2566
  const p = document.createElement("div");
2481
2567
  p.className = "pluno-pa-widget__share-prompt-actions";
2482
2568
  const c = document.createElement("div");
@@ -2484,85 +2570,85 @@ function Ha(e, t) {
2484
2570
  const u = document.createElement("button");
2485
2571
  if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
2486
2572
  t.onDraft(e);
2487
- }), t.isDrafting ? (u.appendChild(ct()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
2573
+ }), t.isDrafting ? (u.appendChild(ft()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
2488
2574
  p.appendChild(c);
2489
2575
  else {
2490
- const s = document.createElement("button");
2491
- 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", () => {
2576
+ const d = document.createElement("button");
2577
+ d.type = "button", d.className = "pluno-pa-widget__share-prompt-dismiss", d.setAttribute("aria-label", "Dismiss share prompt"), d.title = "Dismiss", d.textContent = "Dismiss", d.addEventListener("click", () => {
2492
2578
  t.onDismiss(e);
2493
- }), c.appendChild(s), p.appendChild(c);
2494
- const b = document.createElement("button");
2495
- b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
2579
+ }), c.appendChild(d), p.appendChild(c);
2580
+ const h = document.createElement("button");
2581
+ h.type = "button", h.className = "pluno-pa-widget__share-prompt-disable", h.textContent = "Don't ask again", h.addEventListener("click", () => {
2496
2582
  t.onDisable(e);
2497
- }), p.appendChild(b);
2583
+ }), p.appendChild(h);
2498
2584
  }
2499
2585
  return o.appendChild(p), n.appendChild(o), n;
2500
2586
  }
2501
- function Wa(e, t) {
2587
+ function Ji(e, t) {
2502
2588
  const n = document.createElement("div");
2503
- n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
2504
- y.target === n && t.onClose();
2589
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (f) => {
2590
+ f.target === n && t.onClose();
2505
2591
  });
2506
2592
  const o = document.createElement("section");
2507
2593
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
2508
- const a = document.createElement("header"), i = document.createElement("strong");
2509
- i.textContent = "Share this win", a.appendChild(i);
2594
+ const i = document.createElement("header"), a = document.createElement("strong");
2595
+ a.textContent = "Share this win", i.appendChild(a);
2510
2596
  const l = document.createElement("button");
2511
- l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
2597
+ l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2512
2598
  const p = document.createElement("p");
2513
2599
  p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
2514
2600
  const c = document.createElement("div");
2515
2601
  c.className = "pluno-pa-widget__share-dialog-step";
2516
2602
  const u = document.createElement("div");
2517
2603
  u.className = "pluno-pa-widget__share-dialog-step-header";
2518
- const s = document.createElement("strong");
2519
- s.textContent = "1) Copy Screenshot", u.appendChild(s);
2520
- const b = $a(
2604
+ const d = document.createElement("strong");
2605
+ d.textContent = "1) Copy Screenshot", u.appendChild(d);
2606
+ const h = Qi(
2521
2607
  "Copy Screenshot",
2522
2608
  async () => {
2523
2609
  try {
2524
- return await Yn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2610
+ return await to(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2525
2611
  } catch {
2526
2612
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2527
2613
  }
2528
2614
  }
2529
2615
  );
2530
- if (u.appendChild(b), c.appendChild(u), e.screenshotDataUrl) {
2531
- const y = document.createElement("div");
2532
- y.className = "pluno-pa-widget__share-dialog-screenshot";
2533
- const C = document.createElement("img");
2534
- C.src = e.screenshotDataUrl, C.alt = "Product page with Pluno open", y.appendChild(C), c.appendChild(y);
2616
+ if (u.appendChild(h), c.appendChild(u), e.screenshotDataUrl) {
2617
+ const f = document.createElement("div");
2618
+ f.className = "pluno-pa-widget__share-dialog-screenshot";
2619
+ const E = document.createElement("img");
2620
+ E.src = e.screenshotDataUrl, E.alt = "Product page with Pluno open", f.appendChild(E), c.appendChild(f);
2535
2621
  }
2536
2622
  o.appendChild(c), o.appendChild(p);
2537
- const w = document.createElement("div");
2538
- w.className = "pluno-pa-widget__share-dialog-step";
2539
- const P = document.createElement("strong");
2540
- P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", w.appendChild(P);
2541
- const L = document.createElement("p");
2542
- L.className = "pluno-pa-widget__share-dialog-hint", L.textContent = "Post draft opens prefilled on supported platforms.", w.appendChild(L);
2543
- const R = document.createElement("footer");
2544
- R.className = "pluno-pa-widget__share-dialog-platforms";
2545
- for (const y of qa(e)) {
2546
- const C = document.createElement("a");
2547
- C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(ja(y.id)), R.appendChild(C);
2623
+ const x = document.createElement("div");
2624
+ x.className = "pluno-pa-widget__share-dialog-step";
2625
+ const y = document.createElement("strong");
2626
+ y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "2) Share on", x.appendChild(y);
2627
+ const A = document.createElement("p");
2628
+ A.className = "pluno-pa-widget__share-dialog-hint", A.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(A);
2629
+ const T = document.createElement("footer");
2630
+ T.className = "pluno-pa-widget__share-dialog-platforms";
2631
+ for (const f of ea(e)) {
2632
+ const E = document.createElement("a");
2633
+ E.href = f.href, E.target = "_blank", E.rel = "noopener noreferrer", E.title = f.label, E.setAttribute("aria-label", `Open ${f.label}`), E.appendChild(ta(f.id)), T.appendChild(E);
2548
2634
  }
2549
- if (w.appendChild(R), o.appendChild(w), t.socialPostRewardsUrl) {
2550
- const y = document.createElement("div");
2551
- y.className = "pluno-pa-widget__share-dialog-step";
2552
- const C = document.createElement("strong");
2553
- C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
2554
- const h = document.createElement("a");
2555
- 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(Va()), y.appendChild(h), o.appendChild(y);
2635
+ if (x.appendChild(T), o.appendChild(x), t.socialPostRewardsUrl) {
2636
+ const f = document.createElement("div");
2637
+ f.className = "pluno-pa-widget__share-dialog-step";
2638
+ const E = document.createElement("strong");
2639
+ E.className = "pluno-pa-widget__share-dialog-step-title", E.textContent = "3) Submit post to get 2000 free credits!", f.appendChild(E);
2640
+ const g = document.createElement("a");
2641
+ g.className = "pluno-pa-widget__share-dialog-reward-link", g.href = t.socialPostRewardsUrl, g.target = "_blank", g.rel = "noopener noreferrer", g.appendChild(document.createTextNode("Submit post URL")), g.appendChild(na()), f.appendChild(g), o.appendChild(f);
2556
2642
  }
2557
2643
  return n.appendChild(o), n;
2558
2644
  }
2559
- function $a(e, t) {
2645
+ function Qi(e, t) {
2560
2646
  const n = document.createElement("button");
2561
2647
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
2562
2648
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
2563
2649
  }), n;
2564
2650
  }
2565
- function qa(e) {
2651
+ function ea(e) {
2566
2652
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
2567
2653
  return [
2568
2654
  {
@@ -2582,90 +2668,90 @@ function qa(e) {
2582
2668
  }
2583
2669
  ];
2584
2670
  }
2585
- function ja(e) {
2671
+ function ta(e) {
2586
2672
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2587
- 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(
2673
+ 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" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(
2588
2674
  t,
2589
2675
  "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"
2590
- ), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
2676
+ ), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
2591
2677
  t,
2592
2678
  "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"
2593
- ), 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(
2679
+ ), U(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (U(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), U(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), U(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (U(
2594
2680
  t,
2595
2681
  "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"
2596
- ), B(
2682
+ ), U(
2597
2683
  t,
2598
2684
  "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",
2599
2685
  "0.48"
2600
- ), B(
2686
+ ), U(
2601
2687
  t,
2602
2688
  "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"
2603
- ), B(
2689
+ ), U(
2604
2690
  t,
2605
2691
  "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"
2606
2692
  ), t);
2607
2693
  }
2608
- function B(e, t, n) {
2694
+ function U(e, t, n) {
2609
2695
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
2610
2696
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2611
2697
  }
2612
- function Va() {
2698
+ function na() {
2613
2699
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2614
- 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(
2700
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(
2615
2701
  e,
2616
2702
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2617
2703
  ), e;
2618
2704
  }
2619
- function Cn(e) {
2620
- return e.role === "tool" && e.toolName === rn;
2705
+ function In(e) {
2706
+ return e.role === "tool" && e.toolName === un;
2621
2707
  }
2622
- function Ya(e) {
2708
+ function oa(e) {
2623
2709
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2624
2710
  }
2625
- function Ka(e, t, n, o) {
2626
- const a = document.createElement("article");
2627
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(
2711
+ function ia(e, t, n, o) {
2712
+ const i = document.createElement("article");
2713
+ i.className = "pluno-pa-widget__tool-group", i.title = new Date(
2628
2714
  e[e.length - 1].createdAt
2629
- ).toLocaleString(), a.appendChild(
2630
- re(
2715
+ ).toLocaleString(), i.appendChild(
2716
+ se(
2631
2717
  "pluno-pa-widget__character--tool-group",
2632
2718
  o
2633
2719
  )
2634
2720
  );
2635
- const i = document.createElement("details"), l = Xa(e);
2636
- i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
2637
- a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
2721
+ const a = document.createElement("details"), l = aa(e);
2722
+ a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
2723
+ i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), n();
2638
2724
  });
2639
2725
  const p = document.createElement("summary");
2640
- p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(ct());
2726
+ p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(ft());
2641
2727
  const u = document.createElement("span");
2642
- 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) {
2643
- const s = document.createElement("div");
2644
- s.className = "pluno-pa-widget__tool-lines";
2645
- for (const b of e) {
2646
- const w = document.createElement("div");
2647
- w.className = "pluno-pa-widget__tool-line", b.loading && w.appendChild(ct());
2648
- const P = document.createElement("span");
2649
- P.textContent = b.content || "Run tool", w.appendChild(P), s.appendChild(w);
2650
- }
2651
- i.appendChild(s);
2728
+ if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), a.appendChild(p), e.length > 0) {
2729
+ const d = document.createElement("div");
2730
+ d.className = "pluno-pa-widget__tool-lines";
2731
+ for (const h of e) {
2732
+ const x = document.createElement("div");
2733
+ x.className = "pluno-pa-widget__tool-line", h.loading && x.appendChild(ft());
2734
+ const y = document.createElement("span");
2735
+ y.textContent = h.content || "Run tool", x.appendChild(y), d.appendChild(x);
2736
+ }
2737
+ a.appendChild(d);
2652
2738
  }
2653
- return a.appendChild(i), a;
2739
+ return i.appendChild(a), i;
2654
2740
  }
2655
- function En(e) {
2741
+ function Tn(e) {
2656
2742
  const t = document.createElement("article");
2657
2743
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2658
- re(
2744
+ se(
2659
2745
  "pluno-pa-widget__character--tool-group",
2660
2746
  e
2661
2747
  )
2662
2748
  ), t;
2663
2749
  }
2664
- function Jt(e) {
2665
- const t = En(e);
2666
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(dt()), t;
2750
+ function an(e) {
2751
+ const t = Tn(e);
2752
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(bt()), t;
2667
2753
  }
2668
- function dt() {
2754
+ function bt() {
2669
2755
  const e = document.createElement("div");
2670
2756
  e.className = "pluno-pa-widget__status";
2671
2757
  const t = document.createElement("span");
@@ -2673,79 +2759,79 @@ function dt() {
2673
2759
  const n = document.createElement("span");
2674
2760
  return n.textContent = "Thinking...", e.appendChild(n), e;
2675
2761
  }
2676
- function Xa(e) {
2762
+ function aa(e) {
2677
2763
  return `tools:${e[0]?.id ?? ""}`;
2678
2764
  }
2679
- function ct() {
2765
+ function ft() {
2680
2766
  const e = document.createElement("span");
2681
2767
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2682
2768
  }
2683
- function Sn(e, t) {
2684
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? _a() : _n());
2769
+ function Nn(e, t) {
2770
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Pi() : kn());
2685
2771
  }
2686
- function Za(e, t) {
2772
+ function ra(e, t) {
2687
2773
  const n = t.replace(/\r\n/g, `
2688
2774
  `).split(`
2689
2775
  `);
2690
2776
  let o = 0;
2691
2777
  for (; o < n.length; ) {
2692
- const a = n[o];
2693
- if (!a.trim()) {
2778
+ const i = n[o];
2779
+ if (!i.trim()) {
2694
2780
  o += 1;
2695
2781
  continue;
2696
2782
  }
2697
- if (a.match(/^```(\w+)?\s*$/)) {
2783
+ if (i.match(/^```(\w+)?\s*$/)) {
2698
2784
  const u = [];
2699
2785
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
2700
2786
  u.push(n[o]), o += 1;
2701
2787
  o += o < n.length ? 1 : 0;
2702
- const s = document.createElement("pre"), b = document.createElement("code");
2703
- b.textContent = u.join(`
2704
- `), s.appendChild(b), e.appendChild(s);
2788
+ const d = document.createElement("pre"), h = document.createElement("code");
2789
+ h.textContent = u.join(`
2790
+ `), d.appendChild(h), e.appendChild(d);
2705
2791
  continue;
2706
2792
  }
2707
- const l = a.match(/^(#{1,3})\s+(.+)$/);
2793
+ const l = i.match(/^(#{1,3})\s+(.+)$/);
2708
2794
  if (l) {
2709
2795
  const u = document.createElement(`h${l[1].length + 2}`);
2710
- Be(u, l[2]), e.appendChild(u), o += 1;
2796
+ Ue(u, l[2]), e.appendChild(u), o += 1;
2711
2797
  continue;
2712
2798
  }
2713
- if (/^\s*[-*+]\s+/.test(a)) {
2799
+ if (/^\s*[-*+]\s+/.test(i)) {
2714
2800
  const u = document.createElement("ul");
2715
2801
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
2716
- const s = document.createElement("li");
2717
- Be(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2802
+ const d = document.createElement("li");
2803
+ Ue(d, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(d), o += 1;
2718
2804
  }
2719
2805
  e.appendChild(u);
2720
2806
  continue;
2721
2807
  }
2722
- if (/^\s*\d+\.\s+/.test(a)) {
2808
+ if (/^\s*\d+\.\s+/.test(i)) {
2723
2809
  const u = document.createElement("ol");
2724
2810
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
2725
- const s = document.createElement("li");
2726
- Be(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2811
+ const d = document.createElement("li");
2812
+ Ue(d, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(d), o += 1;
2727
2813
  }
2728
2814
  e.appendChild(u);
2729
2815
  continue;
2730
2816
  }
2731
- const p = [a];
2817
+ const p = [i];
2732
2818
  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]); )
2733
2819
  p.push(n[o]), o += 1;
2734
2820
  const c = document.createElement("p");
2735
- p.forEach((u, s) => {
2736
- s > 0 && c.appendChild(document.createElement("br")), Be(c, u);
2821
+ p.forEach((u, d) => {
2822
+ d > 0 && c.appendChild(document.createElement("br")), Ue(c, u);
2737
2823
  }), e.appendChild(c);
2738
2824
  }
2739
2825
  }
2740
- function Be(e, t) {
2826
+ function Ue(e, t) {
2741
2827
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2742
2828
  let o = 0;
2743
- for (const a of t.matchAll(n)) {
2744
- const i = a.index ?? 0;
2745
- i > o && e.appendChild(
2746
- document.createTextNode(t.slice(o, i))
2829
+ for (const i of t.matchAll(n)) {
2830
+ const a = i.index ?? 0;
2831
+ a > o && e.appendChild(
2832
+ document.createTextNode(t.slice(o, a))
2747
2833
  );
2748
- const l = a[0];
2834
+ const l = i[0];
2749
2835
  if (l.startsWith("`")) {
2750
2836
  const p = document.createElement("code");
2751
2837
  p.textContent = l.slice(1, -1), e.appendChild(p);
@@ -2757,17 +2843,17 @@ function Be(e, t) {
2757
2843
  p.textContent = l.slice(1, -1), e.appendChild(p);
2758
2844
  } else {
2759
2845
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2760
- if (p && Ja(p[2])) {
2846
+ if (p && la(p[2])) {
2761
2847
  const c = document.createElement("a");
2762
2848
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2763
2849
  } else
2764
2850
  e.appendChild(document.createTextNode(l));
2765
2851
  }
2766
- o = i + l.length;
2852
+ o = a + l.length;
2767
2853
  }
2768
2854
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2769
2855
  }
2770
- function Ja(e) {
2856
+ function la(e) {
2771
2857
  if (e.startsWith("/") || e.startsWith("#"))
2772
2858
  return !0;
2773
2859
  try {
@@ -2777,8 +2863,8 @@ function Ja(e) {
2777
2863
  return !1;
2778
2864
  }
2779
2865
  }
2780
- function Qt(e, t) {
2781
- if (Qa(e))
2866
+ function rn(e, t) {
2867
+ if (pa(e))
2782
2868
  return;
2783
2869
  const n = `
2784
2870
  :host {
@@ -2831,7 +2917,7 @@ function Qt(e, t) {
2831
2917
  --pluno-pa-accent-contrast: #fafafa;
2832
2918
  position: fixed;
2833
2919
  z-index: 2147483645;
2834
- font-family: ${K.fontFamily};
2920
+ font-family: ${Z.fontFamily};
2835
2921
  font-size: 14px;
2836
2922
  color: var(--pluno-pa-text);
2837
2923
  width: var(--pluno-pa-launcher-width);
@@ -2894,7 +2980,7 @@ function Qt(e, t) {
2894
2980
  right: 0;
2895
2981
  bottom: 0;
2896
2982
  width: var(--pluno-pa-launcher-width);
2897
- height: 41px;
2983
+ height: var(--pluno-pa-launcher-height);
2898
2984
  border: 0;
2899
2985
  border-radius: 21px;
2900
2986
  background: var(--pluno-pa-surface);
@@ -2954,19 +3040,94 @@ function Qt(e, t) {
2954
3040
  }
2955
3041
  .pluno-pa-widget__launcher-input {
2956
3042
  width: 100%;
3043
+ min-width: 0;
2957
3044
  height: 22px;
2958
3045
  border: 0;
2959
3046
  outline: none;
2960
3047
  background: transparent;
2961
3048
  color: var(--pluno-pa-text);
2962
- padding: 0 12px 0 48px;
3049
+ padding: 0 4px 0 46px;
2963
3050
  font: inherit;
2964
3051
  font-size: 15px;
2965
3052
  line-height: 22px;
3053
+ text-overflow: ellipsis;
2966
3054
  }
2967
3055
  .pluno-pa-widget__launcher-input::placeholder {
2968
3056
  color: var(--pluno-pa-faint);
2969
3057
  }
3058
+ .pluno-pa-widget__launcher-minimize {
3059
+ position: absolute;
3060
+ top: -6px;
3061
+ right: -6px;
3062
+ z-index: 4;
3063
+ display: inline-flex;
3064
+ align-items: center;
3065
+ justify-content: center;
3066
+ width: 18px;
3067
+ height: 18px;
3068
+ border: 1px solid var(--pluno-pa-divider);
3069
+ border-radius: 999px;
3070
+ background: color-mix(in srgb, var(--pluno-pa-bg) 94%, transparent);
3071
+ color: var(--pluno-pa-muted);
3072
+ box-shadow: 0 6px 14px rgba(24, 24, 27, 0.12);
3073
+ cursor: pointer;
3074
+ font: inherit;
3075
+ font-size: 15px;
3076
+ font-weight: 700;
3077
+ line-height: 1;
3078
+ padding: 0 0 2px;
3079
+ opacity: 0;
3080
+ pointer-events: none;
3081
+ transform: translateY(3px) scale(0.92);
3082
+ transition:
3083
+ opacity 120ms ease,
3084
+ background 120ms ease,
3085
+ color 120ms ease,
3086
+ transform 120ms ease;
3087
+ }
3088
+ .pluno-pa-widget__launcher:hover .pluno-pa-widget__launcher-minimize,
3089
+ .pluno-pa-widget__launcher:focus-within .pluno-pa-widget__launcher-minimize,
3090
+ .pluno-pa-widget__launcher-minimize:focus-visible {
3091
+ opacity: 1;
3092
+ pointer-events: auto;
3093
+ transform: translateY(0) scale(1);
3094
+ }
3095
+ .pluno-pa-widget__launcher-minimize:hover,
3096
+ .pluno-pa-widget__launcher-minimize:focus-visible {
3097
+ background: var(--pluno-pa-surface);
3098
+ color: var(--pluno-pa-text);
3099
+ outline: none;
3100
+ }
3101
+ .pluno-pa-widget--minimized {
3102
+ --pluno-pa-launcher-width: 22px;
3103
+ --pluno-pa-launcher-height: 22px;
3104
+ pointer-events: none;
3105
+ }
3106
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher {
3107
+ border: 0;
3108
+ border-radius: 999px;
3109
+ background: transparent;
3110
+ box-shadow: none;
3111
+ cursor: pointer;
3112
+ width: var(--pluno-pa-launcher-width);
3113
+ min-width: 0;
3114
+ height: var(--pluno-pa-launcher-height);
3115
+ min-height: 0;
3116
+ padding: 0;
3117
+ overflow: visible;
3118
+ pointer-events: auto;
3119
+ }
3120
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
3121
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
3122
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher-minimize,
3123
+ .pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals--launcher {
3124
+ display: none;
3125
+ }
3126
+ .pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
3127
+ left: 1px;
3128
+ width: 20px;
3129
+ height: 20px;
3130
+ }
2970
3131
  .pluno-pa-widget--bottom-left .pluno-pa-widget__launcher {
2971
3132
  left: 0;
2972
3133
  right: auto;
@@ -2982,6 +3143,10 @@ function Qt(e, t) {
2982
3143
  0 12px 32px rgba(24, 24, 27, 0.16),
2983
3144
  inset 0 0 0 1px var(--pluno-pa-launcher-hairline);
2984
3145
  }
3146
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher:hover,
3147
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher:focus-within {
3148
+ box-shadow: none;
3149
+ }
2985
3150
  .pluno-pa-widget--open .pluno-pa-widget__launcher {
2986
3151
  opacity: 0;
2987
3152
  pointer-events: none;
@@ -3051,6 +3216,7 @@ function Qt(e, t) {
3051
3216
  }
3052
3217
  @media (prefers-reduced-motion: reduce) {
3053
3218
  .pluno-pa-widget__launcher,
3219
+ .pluno-pa-widget__launcher-minimize,
3054
3220
  .pluno-pa-widget__panel,
3055
3221
  .pluno-pa-widget__close,
3056
3222
  .pluno-pa-widget {
@@ -3718,7 +3884,7 @@ function Qt(e, t) {
3718
3884
  place-items: center;
3719
3885
  padding: 18px;
3720
3886
  background: rgba(24, 24, 27, 0.28);
3721
- font-family: var(--pluno-pa-font, ${K.fontFamily});
3887
+ font-family: var(--pluno-pa-font, ${Z.fontFamily});
3722
3888
  color: var(--pluno-pa-text);
3723
3889
  }
3724
3890
  .pluno-pa-widget__share-dialog {
@@ -4545,6 +4711,26 @@ function Qt(e, t) {
4545
4711
  .pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
4546
4712
  border-radius: var(--pluno-pa-scribble-wobble);
4547
4713
  }
4714
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized {
4715
+ --pluno-pa-launcher-width: 16px;
4716
+ --pluno-pa-launcher-height: 24px;
4717
+ }
4718
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
4719
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
4720
+ content: none;
4721
+ }
4722
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
4723
+ left: -3px;
4724
+ width: 22px;
4725
+ height: 22px;
4726
+ margin-top: 0;
4727
+ }
4728
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
4729
+ color: var(--pluno-pa-text);
4730
+ font-size: 18px;
4731
+ top: -8px;
4732
+ right: -8px;
4733
+ }
4548
4734
  .pluno-pa-widget--scribble .pluno-pa-widget__history-close,
4549
4735
  .pluno-pa-widget--scribble .pluno-pa-widget__history-item {
4550
4736
  position: relative;
@@ -4560,6 +4746,7 @@ function Qt(e, t) {
4560
4746
  .pluno-pa-widget--scribble .pluno-pa-widget__message--user,
4561
4747
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
4562
4748
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
4749
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize,
4563
4750
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
4564
4751
  .pluno-pa-widget--scribble .pluno-pa-widget__history,
4565
4752
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
@@ -4580,6 +4767,7 @@ function Qt(e, t) {
4580
4767
  .pluno-pa-widget--scribble .pluno-pa-widget__message--user::before,
4581
4768
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
4582
4769
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
4770
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize::before,
4583
4771
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
4584
4772
  .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
4585
4773
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
@@ -4617,6 +4805,7 @@ function Qt(e, t) {
4617
4805
  }
4618
4806
  .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
4619
4807
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
4808
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize::before,
4620
4809
  .pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
4621
4810
  .pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
4622
4811
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
@@ -4643,6 +4832,7 @@ function Qt(e, t) {
4643
4832
  border-color: var(--pluno-pa-accent);
4644
4833
  }
4645
4834
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
4835
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize,
4646
4836
  .pluno-pa-widget--scribble .pluno-pa-widget__history,
4647
4837
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
4648
4838
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
@@ -4652,6 +4842,7 @@ function Qt(e, t) {
4652
4842
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
4653
4843
  }
4654
4844
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
4845
+ .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize::after,
4655
4846
  .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
4656
4847
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
4657
4848
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
@@ -4669,6 +4860,21 @@ function Qt(e, t) {
4669
4860
  opacity: 0.6;
4670
4861
  transform: rotate(5deg);
4671
4862
  }
4863
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
4864
+ border: 0;
4865
+ width: var(--pluno-pa-launcher-width);
4866
+ min-width: 0;
4867
+ height: var(--pluno-pa-launcher-height);
4868
+ min-height: 0;
4869
+ padding: 0;
4870
+ }
4871
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
4872
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
4873
+ content: none;
4874
+ }
4875
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals {
4876
+ display: none;
4877
+ }
4672
4878
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
4673
4879
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
4674
4880
  background: transparent;
@@ -4718,14 +4924,16 @@ function Qt(e, t) {
4718
4924
  height: 48px;
4719
4925
  }
4720
4926
  .pluno-pa-widget--scribble .pluno-pa-widget__character--launcher {
4721
- left: 5px;
4927
+ left: 4px;
4722
4928
  width: 44px;
4723
4929
  height: 44px;
4724
4930
  margin-top: 3px;
4725
4931
  }
4726
4932
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-input {
4933
+ height: 26px;
4934
+ line-height: 26px;
4727
4935
  margin-top: 2px;
4728
- padding-left: 54px;
4936
+ padding-left: 46px;
4729
4937
  }
4730
4938
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-drag-handle {
4731
4939
  top: -13px;
@@ -4761,28 +4969,28 @@ function Qt(e, t) {
4761
4969
  filter: url(#pluno-pa-scribble-wobble-2);
4762
4970
  }
4763
4971
  `;
4764
- if (ei(e, n))
4972
+ if (sa(e, n))
4765
4973
  return;
4766
4974
  const o = e.ownerDocument.createElement("style");
4767
- o.id = gn, o.textContent = n, e.appendChild(o), kn(e);
4975
+ o.id = _n, o.textContent = n, e.appendChild(o), Dn(e);
4768
4976
  }
4769
- function Qa(e) {
4770
- return e.getElementById(gn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(hn) === "true";
4977
+ function pa(e) {
4978
+ return e.getElementById(_n) !== null || e.host instanceof HTMLElement && e.host.getAttribute(xn) === "true";
4771
4979
  }
4772
- function kn(e) {
4773
- e.host instanceof HTMLElement && e.host.setAttribute(hn, "true");
4980
+ function Dn(e) {
4981
+ e.host instanceof HTMLElement && e.host.setAttribute(xn, "true");
4774
4982
  }
4775
- function ei(e, t) {
4983
+ function sa(e, t) {
4776
4984
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
4777
4985
  return !1;
4778
4986
  try {
4779
4987
  const n = new CSSStyleSheet();
4780
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], kn(e), !0;
4988
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Dn(e), !0;
4781
4989
  } catch {
4782
4990
  return !1;
4783
4991
  }
4784
4992
  }
4785
- async function ti() {
4993
+ async function da() {
4786
4994
  return document.body ? document.body : await new Promise((e) => {
4787
4995
  const t = new MutationObserver(() => {
4788
4996
  document.body && (t.disconnect(), e(document.body));
@@ -4790,14 +4998,14 @@ async function ti() {
4790
4998
  t.observe(document.documentElement, { childList: !0 });
4791
4999
  });
4792
5000
  }
4793
- function Ln(e) {
5001
+ function Rn(e) {
4794
5002
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
4795
5003
  }
4796
- function ni(e) {
5004
+ function ca(e) {
4797
5005
  try {
4798
- const t = window.localStorage.getItem(Ln(e));
5006
+ const t = window.localStorage.getItem(Rn(e));
4799
5007
  if (!t)
4800
- return en();
5008
+ return ln();
4801
5009
  const n = JSON.parse(t);
4802
5010
  return {
4803
5011
  isOpen: n.isOpen === !0,
@@ -4805,24 +5013,24 @@ function ni(e) {
4805
5013
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
4806
5014
  (o) => typeof o == "string"
4807
5015
  ) : [],
4808
- launcherPosition: ri(n.launcherPosition) ? n.launcherPosition : null,
4809
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ln) : [],
5016
+ launcherPosition: ma(n.launcherPosition) ? n.launcherPosition : null,
5017
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-gn) : [],
4810
5018
  sharePromptsDisabled: n.sharePromptsDisabled === !0
4811
5019
  };
4812
5020
  } catch {
4813
- return en();
5021
+ return ln();
4814
5022
  }
4815
5023
  }
4816
- async function oi(e) {
5024
+ async function ua(e) {
4817
5025
  if (e.loadSharePromptsDisabled)
4818
5026
  return e.loadSharePromptsDisabled();
4819
5027
  try {
4820
- return window.localStorage.getItem(pn) === "true";
5028
+ return window.localStorage.getItem(hn) === "true";
4821
5029
  } catch {
4822
5030
  return !1;
4823
5031
  }
4824
5032
  }
4825
- function ai(e, t) {
5033
+ function ga(e, t) {
4826
5034
  if (e.persistSharePromptsDisabled) {
4827
5035
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
4828
5036
  () => {
@@ -4831,12 +5039,12 @@ function ai(e, t) {
4831
5039
  return;
4832
5040
  }
4833
5041
  try {
4834
- t && window.localStorage.setItem(pn, "true");
5042
+ t && window.localStorage.setItem(hn, "true");
4835
5043
  } catch {
4836
5044
  return;
4837
5045
  }
4838
5046
  }
4839
- function en() {
5047
+ function ln() {
4840
5048
  return {
4841
5049
  isOpen: !1,
4842
5050
  composerValue: "",
@@ -4846,58 +5054,58 @@ function en() {
4846
5054
  sharePromptsDisabled: !1
4847
5055
  };
4848
5056
  }
4849
- function ii(e, t) {
5057
+ function ha(e, t) {
4850
5058
  try {
4851
5059
  window.localStorage.setItem(
4852
- Ln(e),
5060
+ Rn(e),
4853
5061
  JSON.stringify(t)
4854
5062
  );
4855
5063
  } catch {
4856
5064
  return;
4857
5065
  }
4858
5066
  }
4859
- function ri(e) {
5067
+ function ma(e) {
4860
5068
  if (!e || typeof e != "object")
4861
5069
  return !1;
4862
5070
  const t = e;
4863
5071
  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");
4864
5072
  }
4865
- const tn = /* @__PURE__ */ new WeakSet();
4866
- function li(e) {
5073
+ const pn = /* @__PURE__ */ new WeakSet();
5074
+ function ba(e) {
4867
5075
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
4868
5076
  }
4869
- function nn(e) {
5077
+ function sn(e) {
4870
5078
  const t = e.pathname.split("/");
4871
5079
  return t[t.length - 1] ?? "";
4872
5080
  }
4873
- function pi(e, t) {
5081
+ function fa(e, t) {
4874
5082
  const n = new URL(e.src, document.baseURI);
4875
- return n.href === t.href || n.pathname === t.pathname ? !0 : nn(n) === nn(t);
5083
+ return n.href === t.href || n.pathname === t.pathname ? !0 : sn(n) === sn(t);
4876
5084
  }
4877
- class ee extends EventTarget {
5085
+ class oe extends EventTarget {
4878
5086
  constructor(t, n) {
4879
- super(), this.channelId = n, this.url = t, this.addPreviewListener(uo, () => {
4880
- this.readyState = ee.OPEN, this.dispatchEvent(new Event("open"));
4881
- }), this.addPreviewListener(go, (o) => {
4882
- const a = o;
5087
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(_o, () => {
5088
+ this.readyState = oe.OPEN, this.dispatchEvent(new Event("open"));
5089
+ }), this.addPreviewListener(xo, (o) => {
5090
+ const i = o;
4883
5091
  this.dispatchEvent(
4884
- new MessageEvent("message", { data: a.detail?.data ?? "" })
5092
+ new MessageEvent("message", { data: i.detail?.data ?? "" })
4885
5093
  );
4886
- }), this.addPreviewListener(ho, () => {
4887
- this.readyState = ee.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4888
- }), this.addPreviewListener(mo, (o) => {
4889
- const a = o;
4890
- this.readyState = ee.CLOSED, this.dispatchEvent(
5094
+ }), this.addPreviewListener(yo, () => {
5095
+ this.readyState = oe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5096
+ }), this.addPreviewListener(vo, (o) => {
5097
+ const i = o;
5098
+ this.readyState = oe.CLOSED, this.dispatchEvent(
4891
5099
  new CloseEvent("close", {
4892
- code: a.detail?.code ?? 1e3,
4893
- reason: a.detail?.reason ?? "",
4894
- wasClean: a.detail?.wasClean ?? !0
5100
+ code: i.detail?.code ?? 1e3,
5101
+ reason: i.detail?.reason ?? "",
5102
+ wasClean: i.detail?.wasClean ?? !0
4895
5103
  })
4896
5104
  ), this.cleanup();
4897
5105
  }), window.dispatchEvent(
4898
5106
  new CustomEvent(
4899
- Oe(
4900
- po,
5107
+ Fe(
5108
+ bo,
4901
5109
  this.channelId
4902
5110
  ),
4903
5111
  {
@@ -4916,18 +5124,18 @@ class ee extends EventTarget {
4916
5124
  extensions = "";
4917
5125
  binaryType = "blob";
4918
5126
  bufferedAmount = 0;
4919
- readyState = ee.CONNECTING;
4920
- socketId = si();
5127
+ readyState = oe.CONNECTING;
5128
+ socketId = wa();
4921
5129
  listeners = /* @__PURE__ */ new Map();
4922
5130
  send(t) {
4923
- if (this.readyState !== ee.OPEN)
5131
+ if (this.readyState !== oe.OPEN)
4924
5132
  throw new DOMException(
4925
5133
  "Pluno preview websocket is not open",
4926
5134
  "InvalidStateError"
4927
5135
  );
4928
5136
  window.dispatchEvent(
4929
5137
  new CustomEvent(
4930
- Oe(so, this.channelId),
5138
+ Fe(fo, this.channelId),
4931
5139
  {
4932
5140
  detail: {
4933
5141
  socketId: this.socketId,
@@ -4938,9 +5146,9 @@ class ee extends EventTarget {
4938
5146
  );
4939
5147
  }
4940
5148
  close(t, n) {
4941
- this.readyState !== ee.CLOSED && (this.readyState = ee.CLOSING, window.dispatchEvent(
5149
+ this.readyState !== oe.CLOSED && (this.readyState = oe.CLOSING, window.dispatchEvent(
4942
5150
  new CustomEvent(
4943
- Oe(co, this.channelId),
5151
+ Fe(wo, this.channelId),
4944
5152
  {
4945
5153
  detail: { socketId: this.socketId, code: t, reason: n }
4946
5154
  }
@@ -4948,13 +5156,13 @@ class ee extends EventTarget {
4948
5156
  ), this.cleanup());
4949
5157
  }
4950
5158
  addPreviewListener(t, n) {
4951
- const o = Oe(
5159
+ const o = Fe(
4952
5160
  t,
4953
5161
  this.channelId
4954
- ), a = (i) => {
4955
- i.detail?.socketId === this.socketId && n(i);
5162
+ ), i = (a) => {
5163
+ a.detail?.socketId === this.socketId && n(a);
4956
5164
  };
4957
- this.listeners.set(o, a), window.addEventListener(o, a);
5165
+ this.listeners.set(o, i), window.addEventListener(o, i);
4958
5166
  }
4959
5167
  cleanup() {
4960
5168
  for (const [t, n] of this.listeners.entries())
@@ -4962,19 +5170,19 @@ class ee extends EventTarget {
4962
5170
  this.listeners.clear();
4963
5171
  }
4964
5172
  }
4965
- function si() {
5173
+ function wa() {
4966
5174
  const e = window.sessionStorage.getItem(
4967
- Nt
5175
+ Bt
4968
5176
  );
4969
5177
  if (e)
4970
5178
  return e;
4971
5179
  const t = crypto.randomUUID();
4972
- return window.sessionStorage.setItem(Nt, t), t;
5180
+ return window.sessionStorage.setItem(Bt, t), t;
4973
5181
  }
4974
- function Oe(e, t) {
5182
+ function Fe(e, t) {
4975
5183
  return `${e}:${t}`;
4976
5184
  }
4977
- function di(e) {
5185
+ function _a(e) {
4978
5186
  const t = document.currentScript;
4979
5187
  if (t instanceof HTMLScriptElement)
4980
5188
  return [t];
@@ -4982,20 +5190,20 @@ function di(e) {
4982
5190
  return Array.from(
4983
5191
  document.querySelectorAll("script[type='module'][src]")
4984
5192
  ).filter(
4985
- (a) => a instanceof HTMLScriptElement && li(a) && pi(a, o)
5193
+ (i) => i instanceof HTMLScriptElement && ba(i) && fa(i, o)
4986
5194
  );
4987
5195
  }
4988
- function ci(e) {
4989
- for (const t of di(e)) {
4990
- if (tn.has(t) || t.dataset.plunoAutoMount === "false")
5196
+ function xa(e) {
5197
+ for (const t of _a(e)) {
5198
+ if (pn.has(t) || t.dataset.plunoAutoMount === "false")
4991
5199
  continue;
4992
- tn.add(t);
5200
+ pn.add(t);
4993
5201
  const n = t.dataset.plunoPreviewChannel;
4994
- Oo({
5202
+ Vo({
4995
5203
  token: t.dataset.plunoToken,
4996
5204
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4997
5205
  backendUrl: t.dataset.plunoBackendUrl,
4998
- webSocketFactory: n ? Bo(n) : void 0,
5206
+ webSocketFactory: n ? jo(n) : void 0,
4999
5207
  launcherLabel: t.dataset.plunoLauncherLabel,
5000
5208
  accentColor: t.dataset.plunoAccentColor,
5001
5209
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -5007,8 +5215,8 @@ function ci(e) {
5007
5215
  });
5008
5216
  }
5009
5217
  }
5010
- ci(import.meta.url);
5218
+ xa(import.meta.url);
5011
5219
  export {
5012
- Bo as createProductAgentPreviewBridgeWebSocketFactory,
5013
- Oo as mountPlunoProductAgentWidget
5220
+ jo as createProductAgentPreviewBridgeWebSocketFactory,
5221
+ Vo as mountPlunoProductAgentWidget
5014
5222
  };