@pluno/product-agent-web 0.1.64 → 0.1.66

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,27 +1,27 @@
1
- import { PlunoProductAgent as So } from "./product-agent-sdk.js";
2
- const Eo = "#7c3aed", nt = "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", ot = "#2c2a1e", en = [253, 250, 241], tn = 3.5;
3
- function Rn(e) {
4
- const t = Mn(e);
5
- if (nn(Ge(t), en) >= tn)
1
+ import { PlunoProductAgent as qo, getProductAgentOriginAccessErrorMessage as jo } from "./product-agent-sdk.js";
2
+ const Vo = "#7c3aed", pt = "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", st = "#2c2a1e", fn = [253, 250, 241], wn = 3.5;
3
+ function Kn(e) {
4
+ const t = Yn(e);
5
+ if (bn(Ke(t), fn) >= wn)
6
6
  return t;
7
- let n = Ge(t);
8
- const i = Ge(ot);
7
+ let o = Ke(t);
8
+ const i = Ke(st);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (n = Io(n, i, 0.22), nn(n, en) >= tn)
11
- return At(n);
12
- return At(n);
10
+ if (o = Xo(o, i, 0.22), bn(o, fn) >= wn)
11
+ return Ft(o);
12
+ return Ft(o);
13
13
  }
14
- function ko() {
15
- let o = "M 280 120", n = !1, i = 0;
14
+ function Ko() {
15
+ let n = "M 280 120", o = !1, i = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
- const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
18
- o += ` L ${p} ${r}`, n = !n, i += 1;
17
+ const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${r}`, o = !o, i += 1;
19
19
  }
20
- return o;
20
+ return n;
21
21
  }
22
- function Lo(e) {
23
- const t = Mn(e), o = Nt(Ge(t));
24
- return o > 0.86 ? {
22
+ function Yo(e) {
23
+ const t = Yn(e), n = Ht(Ke(t));
24
+ return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
27
27
  bottom: "#e7e7e7",
@@ -32,7 +32,7 @@ function Lo(e) {
32
32
  highlight: "#ffffff",
33
33
  inner: "#f4f4f4",
34
34
  shadow: "#9d9d9d"
35
- } : o < 0.05 ? {
35
+ } : n < 0.05 ? {
36
36
  top: "#3d3d3d",
37
37
  middle: "#171717",
38
38
  bottom: "#030303",
@@ -44,179 +44,179 @@ function Lo(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: J(t, 0.28, -0.03),
48
- middle: J(t, 0.08, 0.04),
49
- bottom: J(t, -0.1, 0.02),
50
- edgeStart: J(t, 0.08, 0.08),
51
- edgeMiddle: J(t, -0.08, 0.08),
52
- edgeEnd: J(t, -0.18, 0.05),
53
- glow: J(t, 0.32, -0.12),
54
- highlight: J(t, 0.38, -0.18),
55
- inner: J(t, 0.24, -0.1),
56
- shadow: J(t, -0.25, -0.08)
47
+ top: ne(t, 0.28, -0.03),
48
+ middle: ne(t, 0.08, 0.04),
49
+ bottom: ne(t, -0.1, 0.02),
50
+ edgeStart: ne(t, 0.08, 0.08),
51
+ edgeMiddle: ne(t, -0.08, 0.08),
52
+ edgeEnd: ne(t, -0.18, 0.05),
53
+ glow: ne(t, 0.32, -0.12),
54
+ highlight: ne(t, 0.38, -0.18),
55
+ inner: ne(t, 0.24, -0.1),
56
+ shadow: ne(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Mn(e) {
59
+ function Yn(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((o) => o + o).join("").toLowerCase()}` : Eo;
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()}` : Vo;
62
62
  }
63
- function Ge(e) {
63
+ function Ke(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function At([e, t, o]) {
71
- const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
- return `#${n(e)}${n(t)}${n(o)}`;
70
+ function Ft([e, t, n]) {
71
+ const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
+ return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function Nt([e, t, o]) {
75
- const n = (i) => {
74
+ function Ht([e, t, n]) {
75
+ const o = (i) => {
76
76
  const r = i / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
- return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
79
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function nn(e, t) {
82
- const o = Nt(e), n = Nt(t), [i, r] = o > n ? [o, n] : [n, o];
81
+ function bn(e, t) {
82
+ const n = Ht(e), o = Ht(t), [i, r] = n > o ? [n, o] : [o, n];
83
83
  return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function Io(e, t, o) {
86
- const n = Tt(o);
85
+ function Xo(e, t, n) {
86
+ const o = Wt(n);
87
87
  return [
88
- e[0] + (t[0] - e[0]) * n,
89
- e[1] + (t[1] - e[1]) * n,
90
- e[2] + (t[2] - e[2]) * n
88
+ e[0] + (t[0] - e[0]) * o,
89
+ e[1] + (t[1] - e[1]) * o,
90
+ e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function J(e, t, o) {
94
- const [n, i, r] = Ao(Ge(e));
95
- return At(No(n, Tt(i + o), Tt(r + t)));
93
+ function ne(e, t, n) {
94
+ const [o, i, r] = Zo(Ke(e));
95
+ return Ft(Jo(o, Wt(i + n), Wt(r + t)));
96
96
  }
97
- function Ao([e, t, o]) {
98
- const n = e / 255, i = t / 255, r = o / 255, l = Math.max(n, i, r), p = Math.min(n, i, r), d = (l + p) / 2;
97
+ function Zo([e, t, n]) {
98
+ const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
101
- const u = l - p, c = d > 0.5 ? u / (2 - l - p) : u / (l + p);
102
- return [(l === n ? (i - r) / u + (i < r ? 6 : 0) : l === i ? (r - n) / u + 2 : (n - i) / u + 4) / 6, c, d];
101
+ const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
+ return [(l === o ? (i - r) / c + (i < r ? 6 : 0) : l === i ? (r - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
103
103
  }
104
- function No(e, t, o) {
104
+ function Jo(e, t, n) {
105
105
  if (t === 0)
106
- return [o * 255, o * 255, o * 255];
107
- const n = o < 0.5 ? o * (1 + t) : o + t - o * t, i = 2 * o - n;
106
+ return [n * 255, n * 255, n * 255];
107
+ const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- vt(i, n, e + 1 / 3) * 255,
110
- vt(i, n, e) * 255,
111
- vt(i, n, e - 1 / 3) * 255
109
+ At(i, o, e + 1 / 3) * 255,
110
+ At(i, o, e) * 255,
111
+ At(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function vt(e, t, o) {
115
- let n = o;
116
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
114
+ function At(e, t, n) {
115
+ let o = n;
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 Tt(e) {
118
+ function Wt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const zn = "suggest_share_on_socials";
122
- function To(e) {
121
+ const Xn = "suggest_share_on_socials";
122
+ function Qo(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
- const o = e[t];
125
- if (o.role !== "tool" || o.toolName !== zn)
124
+ const n = e[t];
125
+ if (n.role !== "tool" || n.toolName !== Xn)
126
126
  continue;
127
- const n = on(e, t, "assistant");
128
- if (!n)
127
+ const o = _n(e, t, "assistant");
128
+ if (!o)
129
129
  return null;
130
- const i = on(e, n.index, "user");
130
+ const i = _n(e, o.index, "user");
131
131
  return i ? {
132
- id: `share:${o.callId ?? o.id}`,
132
+ id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: i.content,
134
- assistantAnswer: n.content
134
+ assistantAnswer: o.content
135
135
  } : null;
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Po(e) {
140
- const t = await Do(e);
139
+ async function ei(e) {
140
+ const t = await ti(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 on(e, t, o) {
146
- for (let n = t - 1; n >= 0; n -= 1) {
147
- const i = e[n];
148
- if (i.role === o && i.content.trim())
149
- return { index: n, content: i.content.trim() };
145
+ function _n(e, t, n) {
146
+ for (let o = t - 1; o >= 0; o -= 1) {
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 Do(e) {
153
+ async function ti(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const Ro = "https://app.pluno.ai", Mo = "/api/product-agent/embed/active-users", zo = 1800, Oo = 15e3, Uo = 250, Bo = 1e3, Fo = 3e4;
157
- function Ho(e, t = {}) {
158
- let o = !1, n = null, i = null, r = null;
156
+ const ni = "https://app.pluno.ai", oi = "/api/product-agent/embed/active-users", ii = 1800, ai = 15e3, ri = 250, li = 1e3, pi = 3e4;
157
+ function si(e, t = {}) {
158
+ let n = !1, o = null, i = null, r = null;
159
159
  const l = () => {
160
160
  r !== null && (window.clearInterval(r), r = null);
161
- }, p = (c) => {
162
- o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
- u();
164
- }, $o(c)));
165
- }, d = (c) => {
166
- if (l(), n === null) {
167
- n = c, e(c);
161
+ }, p = (u) => {
162
+ n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
+ c();
164
+ }, ui(u)));
165
+ }, d = (u) => {
166
+ if (l(), o === null) {
167
+ o = u, e(u);
168
168
  return;
169
169
  }
170
- const g = n, S = performance.now();
170
+ const m = o, k = performance.now();
171
171
  r = window.setInterval(() => {
172
- if (o) {
172
+ if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const w = Math.min(1, (performance.now() - S) / zo);
177
- n = Math.round(g + (c - g) * qo(w)), e(n), w >= 1 && (n = c, e(c), l());
178
- }, Uo);
179
- }, u = async () => {
176
+ const v = Math.min(1, (performance.now() - k) / ii);
177
+ o = Math.round(m + (u - m) * gi(v)), e(o), v >= 1 && (o = u, e(u), l());
178
+ }, ri);
179
+ }, c = async () => {
180
180
  try {
181
- const c = await Wo(t);
182
- if (o)
181
+ const u = await di(t);
182
+ if (n)
183
183
  return;
184
- d(c.count), p(c.refreshAfterMs);
184
+ d(u.count), p(u.refreshAfterMs);
185
185
  } catch {
186
- p(Oo);
186
+ p(ai);
187
187
  }
188
188
  };
189
- return u(), () => {
190
- o = !0, i !== null && window.clearTimeout(i), l();
189
+ return c(), () => {
190
+ n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function Wo(e) {
193
+ async function di(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const o = await (e.fetcher ?? fetch)(new URL(Mo, Go(e.backendUrl ?? Ro)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(oi, ci(e.backendUrl ?? ni)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
- if (!o.ok)
200
+ if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const n = await o.json(), i = an(n.count), r = an(n.refreshAfterMs ?? n.refresh_after_ms);
202
+ const o = await n.json(), i = xn(o.count), r = xn(o.refreshAfterMs ?? o.refresh_after_ms);
203
203
  if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: i, refreshAfterMs: r };
206
206
  }
207
- function an(e) {
207
+ function xn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Go(e) {
210
+ function ci(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function $o(e) {
214
- return Math.min(Fo, Math.max(Bo, e));
213
+ function ui(e) {
214
+ return Math.min(pi, Math.max(li, e));
215
215
  }
216
- function qo(e) {
216
+ function gi(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-connect", Yo = "product-agent:sdk-preview-socket-send", Xo = "product-agent:sdk-preview-socket-close", Zo = "product-agent:sdk-preview-socket-open", Jo = "product-agent:sdk-preview-socket-message", Qo = "product-agent:sdk-preview-socket-error", ei = "product-agent:sdk-preview-socket-closed", rn = "product-agent:sdk-preview-socket-id", ti = "data-pluno-sdk-preview-channel", ni = "product-agent:preview-diagnostic", Un = "pluno.productAgent.sharePromptsDisabled", oi = 3, ln = 'dialog[open], [aria-modal="true"], [role="dialog"]', ii = 400, ai = 5e3, ri = 500, pn = "Close the page's popup to chat", li = "No recent chats for this page yet.", Q = {
219
+ const Zn = 100, hi = 1e4, mi = 5e3, fi = "product-agent:sdk-preview-socket-connect", wi = "product-agent:sdk-preview-socket-send", bi = "product-agent:sdk-preview-socket-close", _i = "product-agent:sdk-preview-socket-open", xi = "product-agent:sdk-preview-socket-message", yi = "product-agent:sdk-preview-socket-error", vi = "product-agent:sdk-preview-socket-closed", yn = "product-agent:sdk-preview-socket-id", Ci = "data-pluno-sdk-preview-channel", Si = "product-agent:preview-diagnostic", Jn = "pluno.productAgent.sharePromptsDisabled", Ei = 3, vn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ki = 400, Li = 5e3, Pi = 500, Cn = "Close the page's popup to chat", Ii = "No recent chats for this page yet.", oe = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-conne
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680, wi = 800, bi = 0.76, W = 8, Pt = 50, Hn = "http://www.w3.org/2000/svg", cn = 26, un = 8, _i = 36, gn = [
227
+ }, Ai = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Sn = "pluno-pa-scribble-font", Qn = 190, eo = 41, En = 22, Ni = 16, Ti = 24, Di = 1, Ri = 48, Jt = 420, zi = 520, Mi = 0.24, Qt = 680, Oi = 800, Bi = 0.76, I = 8, Ce = 50, to = "http://www.w3.org/2000/svg", Gt = 26, $t = 8, Ui = 36, qt = 16, Fi = 4, kn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-conne
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], xi = 11, yi = 13, hn = 4, vi = 10, Ci = 40, Si = "movable-launcher-position-v2", Wn = "pluno-pa-widget-styles", Gn = "data-pluno-pa-widget-styles";
265
- let mn = 0;
266
- function Ei(e) {
267
- return (t) => new re(t, e);
264
+ ], Hi = 11, Wi = 13, jt = 4, no = 10, oo = 40, Gi = "movable-launcher-position-v2", io = "pluno-pa-widget-styles", ao = "data-pluno-pa-widget-styles";
265
+ let Ln = 0;
266
+ function $i(e) {
267
+ return (t) => new se(t, e);
268
268
  }
269
- async function ki(e = {}) {
269
+ async function qi(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? Q.launcherLabel,
272
- accentColor: e.accentColor ?? Q.accentColor,
273
- colorScheme: e.colorScheme ?? Q.colorScheme,
274
- fontFamily: e.fontFamily ?? Q.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? Q.scribbleStyle,
276
- position: e.position ?? Q.position,
277
- movableLauncher: e.movableLauncher ?? Q.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? oe.launcherLabel,
272
+ accentColor: e.accentColor ?? oe.accentColor,
273
+ colorScheme: e.colorScheme ?? oe.colorScheme,
274
+ fontFamily: e.fontFamily ?? oe.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? oe.scribbleStyle,
276
+ position: e.position ?? oe.position,
277
+ movableLauncher: e.movableLauncher ?? oe.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -308,7 +308,7 @@ async function ki(e = {}) {
308
308
  showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0,
309
309
  taskNotifications: e.taskNotifications
310
310
  };
311
- K(
311
+ J(
312
312
  "web-sdk.widget",
313
313
  "Mounting widget with merged options",
314
314
  {
@@ -323,41 +323,41 @@ async function ki(e = {}) {
323
323
  initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
324
324
  }
325
325
  );
326
- const o = document.createElement("div");
327
- o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
328
- ti,
326
+ const n = document.createElement("div");
327
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
328
+ Ci,
329
329
  t.sdkPreviewChannelId
330
330
  );
331
- const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
331
+ const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
332
332
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
333
- let r = fn(
333
+ let r = Pn(
334
334
  t.accentColor,
335
335
  t.scribbleStyle
336
336
  );
337
- Ki(
337
+ ha(
338
338
  i,
339
339
  t.launcherLabel,
340
340
  r,
341
341
  t.movableLauncher,
342
342
  t.showLauncherMinimizeButton
343
- ), n.appendChild(i);
344
- const l = $a(t);
345
- let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null;
346
- 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"), xe(
343
+ ), o.appendChild(i);
344
+ const l = dr(t);
345
+ let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null, c = l.panelSize, u = null;
346
+ 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"), ve(
347
347
  i,
348
- Ct(
348
+ Tt(
349
349
  i,
350
350
  p,
351
351
  t.position
352
352
  )
353
- )), Nn(n, t.accentColor), wn(i, r, {
353
+ )), $n(o, t.accentColor), In(i, r, {
354
354
  accentColor: t.accentColor,
355
355
  colorScheme: t.colorScheme,
356
356
  fontFamily: t.fontFamily,
357
357
  scribbleStyle: t.scribbleStyle
358
358
  });
359
- const u = await Ga(), c = u.ownerDocument;
360
- u.appendChild(o), K(
359
+ const m = await sr(), k = m.ownerDocument;
360
+ m.appendChild(n), J(
361
361
  "web-sdk.widget",
362
362
  "Applied initial widget appearance",
363
363
  {
@@ -367,78 +367,82 @@ async function ki(e = {}) {
367
367
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
368
368
  }
369
369
  );
370
- const g = i.querySelector(
370
+ const v = i.querySelector(
371
371
  ".pluno-pa-widget__launcher"
372
- ), S = i.querySelector(
372
+ ), z = i.querySelector(
373
373
  ".pluno-pa-widget__launcher-drag-handle"
374
- ), w = i.querySelector(
374
+ ), _ = i.querySelector(
375
375
  ".pluno-pa-widget__launcher-input"
376
- ), H = i.querySelector(
376
+ ), g = i.querySelector(
377
377
  ".pluno-pa-widget__launcher-minimize"
378
- ), k = i.querySelector(".pluno-pa-widget__panel"), y = i.querySelector(
378
+ ), b = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
379
+ ".pluno-pa-widget__scribble-spirals--panel"
380
+ ), P = Array.from(
381
+ i.querySelectorAll(".pluno-pa-widget__resize-handle")
382
+ ), A = i.querySelector(
379
383
  ".pluno-pa-widget__close"
380
- ), v = i.querySelector(
384
+ ), L = i.querySelector(
381
385
  ".pluno-pa-widget__composer"
382
- ), h = i.querySelector(
386
+ ), F = i.querySelector(
383
387
  ".pluno-pa-widget__attachment-error"
384
- ), N = i.querySelector(
388
+ ), H = i.querySelector(
385
389
  ".pluno-pa-widget__billing-status"
386
- ), D = i.querySelector(
390
+ ), $ = i.querySelector(
387
391
  ".pluno-pa-widget__attachments"
388
- ), L = i.querySelector(
392
+ ), Q = i.querySelector(
389
393
  ".pluno-pa-widget__attachment-input"
390
- ), Pe = i.querySelector(
394
+ ), ze = i.querySelector(
391
395
  ".pluno-pa-widget__attach"
392
- ), f = i.querySelector(
396
+ ), x = i.querySelector(
393
397
  ".pluno-pa-widget__input"
394
- ), R = i.querySelector(
398
+ ), de = i.querySelector(
395
399
  ".pluno-pa-widget__send"
396
- ), ce = i.querySelector(
400
+ ), Ye = i.querySelector(
397
401
  ".pluno-pa-widget__top-actions"
398
- ), ue = i.querySelector(
402
+ ), X = i.querySelector(
399
403
  ".pluno-pa-widget__history"
400
- ), ye = i.querySelector(
404
+ ), C = i.querySelector(
401
405
  ".pluno-pa-widget__history-panel"
402
- ), G = i.querySelector(
406
+ ), T = i.querySelector(
403
407
  ".pluno-pa-widget__history-list"
404
- ), $e = i.querySelector(
408
+ ), Se = i.querySelector(
405
409
  ".pluno-pa-widget__history-close"
406
- ), Y = i.querySelector(
410
+ ), q = i.querySelector(
407
411
  ".pluno-pa-widget__history-status"
408
- ), x = i.querySelector(
412
+ ), R = i.querySelector(
409
413
  ".pluno-pa-widget__timeline-jump"
410
- ), z = i.querySelector(
414
+ ), D = i.querySelector(
411
415
  ".pluno-pa-widget__active-users-counter"
412
- ), I = i.querySelector(
416
+ ), N = i.querySelector(
413
417
  ".pluno-pa-widget__timeline"
414
- ), $ = i.querySelector(
418
+ ), ht = i.querySelector(
415
419
  ".pluno-pa-widget__timeline-bottom-sentinel"
416
- ), A = i.querySelector(
420
+ ), Me = i.querySelector(
417
421
  ".pluno-pa-widget__notify-suggestion"
418
- ), T = i.querySelector(
422
+ ), vo = i.querySelector(
419
423
  ".pluno-pa-widget__notify-suggestion-enable"
420
- ), ge = i.querySelector(
424
+ ), Co = i.querySelector(
421
425
  ".pluno-pa-widget__notify-suggestion-later"
422
- ), ao = i.querySelector(
426
+ ), So = i.querySelector(
423
427
  ".pluno-pa-widget__notify-suggestion-never"
424
428
  );
425
- if (!g || !w || !k || !y || !v || !h || !N || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
429
+ if (!v || !_ || !b || !A || !L || !F || !H || !$ || !Q || !ze || !x || !de || !Ye || !X || !C || !T || !Se || !q || !R || !D || !N || !ht)
426
430
  throw new Error("Failed to mount Pluno widget");
427
- if (t.movableLauncher && !S)
431
+ if (t.movableLauncher && !z)
428
432
  throw new Error("Failed to mount Pluno widget drag handle");
429
- vn(w), vn(f);
430
- let B = [], ie = null;
431
- const ve = () => {
432
- ga(
433
- D,
434
- B,
433
+ Mn(_), Mn(x);
434
+ let W = [], le = null;
435
+ const Ee = () => {
436
+ Da(
437
+ $,
438
+ W,
435
439
  (a) => {
436
- B = B.filter(
437
- (s, _) => _ !== a
438
- ), ve(), F(b.getState()), q();
440
+ W = W.filter(
441
+ (s, w) => w !== a
442
+ ), Ee(), G(y.getState()), j();
439
443
  }
440
444
  );
441
- }, ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
445
+ }, Eo = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
442
446
  if (!t.tokenEndpoint)
443
447
  throw new Error("Pluno widget requires token or tokenEndpoint");
444
448
  const a = await fetch(t.tokenEndpoint, {
@@ -450,21 +454,23 @@ async function ki(e = {}) {
450
454
  url: location.href
451
455
  })
452
456
  });
453
- if (!a.ok)
454
- throw new Error("Failed to load Pluno token");
457
+ if (!a.ok) {
458
+ const w = await a.text(), S = jo(w);
459
+ throw S ? (console.error(S), new Error(S)) : new Error(`Failed to load Pluno token (${a.status})`);
460
+ }
455
461
  const s = await a.json();
456
462
  if (!s.token)
457
463
  throw new Error("Pluno token endpoint did not return a token");
458
464
  return s.token;
459
- }), lo = window.fetch.bind(window);
460
- let b;
461
- b = await So.init({
465
+ }), ko = window.fetch.bind(window);
466
+ let y;
467
+ y = await qo.init({
462
468
  token: t.token,
463
- tokenProvider: ro,
469
+ tokenProvider: Eo,
464
470
  backendUrl: t.backendUrl,
465
471
  metadata: () => ({
466
472
  ...t.metadata ?? {},
467
- ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
473
+ ...!y.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
468
474
  }),
469
475
  initialStarterPrompts: t.initialStarterPrompts,
470
476
  clientId: t.clientId,
@@ -474,118 +480,119 @@ async function ki(e = {}) {
474
480
  prepareAttachmentUpload: t.prepareAttachmentUpload,
475
481
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
476
482
  });
477
- const lt = new Set(l.openToolGroupKeys), Ce = new Set(
483
+ const mt = new Set(l.openToolGroupKeys), ke = new Set(
478
484
  l.seenShareCandidateIds
479
- ), qe = new Set(Ce);
480
- let pt = l.sharePromptsDisabled || await qa(t), V = null, Se = !1, he = !1, me = {
485
+ ), Xe = new Set(ke);
486
+ let ft = l.sharePromptsDisabled || await cr(t), Z = null, Le = !1, fe = !1, we = {
481
487
  enabled: !0
482
- }, fe = 0, Ft = "", le = !1, ae = !1, pe = [], st = null, De = null;
483
- const X = (a, s) => {
484
- me = { enabled: a, reason: s };
485
- }, Z = () => {
486
- x.hidden = !0;
487
- }, po = () => {
488
- x.hidden = !1;
489
- }, so = (a = "jump") => {
490
- X(!0, a), Z(), We(I, () => me.enabled), fe = I.scrollTop;
491
- }, we = () => {
492
- if (ue.hidden = t.loginRequired, ye.hidden = !le, ue.setAttribute("aria-expanded", String(le)), G.classList.toggle(
488
+ }, be = 0, nn = "", ce = !1, pe = !1, ue = [], wt = null, Oe = null;
489
+ const ee = (a, s) => {
490
+ we = { enabled: a, reason: s };
491
+ }, te = () => {
492
+ R.hidden = !0;
493
+ }, Lo = () => {
494
+ R.hidden = !1;
495
+ }, Po = (a = "jump") => {
496
+ ee(!0, a), te(), Ve(N, () => we.enabled), be = N.scrollTop;
497
+ }, _e = () => {
498
+ if (X.hidden = t.loginRequired, C.hidden = !ce, X.setAttribute("aria-expanded", String(ce)), T.classList.toggle(
493
499
  "pluno-pa-widget__history-list--center",
494
- ae && pe.length === 0
495
- ), G.replaceChildren(), ae && pe.length === 0) {
500
+ pe && ue.length === 0
501
+ ), T.replaceChildren(), pe && ue.length === 0) {
496
502
  const a = document.createElement("p");
497
- a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", G.appendChild(a);
503
+ a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", T.appendChild(a);
498
504
  }
499
- for (const a of pe) {
505
+ for (const a of ue) {
500
506
  const s = document.createElement("button");
501
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ae;
502
- const _ = document.createElement("span");
503
- _.className = "pluno-pa-widget__history-item-title", _.textContent = qi(a);
504
- const E = document.createElement("time");
505
- E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent = Vi(
507
+ s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = pe;
508
+ const w = document.createElement("span");
509
+ w.className = "pluno-pa-widget__history-item-title", w.textContent = ca(a);
510
+ const S = document.createElement("time");
511
+ S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = ga(
506
512
  a.lastActiveAt,
507
513
  Date.now()
508
514
  );
509
- const P = document.createElement("small");
510
- P.className = "pluno-pa-widget__history-path", P.textContent = ji(a), s.append(_, E, P), s.addEventListener("click", () => {
511
- le = !1, De = null, we(), X(!0, "newSession"), Z(), b.loadSession(a.id), F(b.getState());
512
- }), G.appendChild(s);
515
+ const M = document.createElement("small");
516
+ M.className = "pluno-pa-widget__history-path", M.textContent = ua(a), s.append(w, S, M), s.addEventListener("click", () => {
517
+ ce = !1, Oe = null, _e(), ee(!0, "newSession"), te(), y.loadSession(a.id), G(y.getState());
518
+ }), T.appendChild(s);
513
519
  }
514
- if (ae && pe.length > 0) {
520
+ if (pe && ue.length > 0) {
515
521
  const a = document.createElement("p");
516
- a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", G.appendChild(a);
522
+ a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", T.appendChild(a);
517
523
  }
518
- Y.textContent = De ?? (!ae && pe.length === 0 ? "No recent chats for this page yet." : ""), Y.hidden = Y.textContent.length === 0;
519
- }, Ht = async (a) => {
520
- if (!ae) {
521
- ae = !0, De = null, we();
524
+ q.textContent = Oe ?? (!pe && ue.length === 0 ? "No recent chats for this page yet." : ""), q.hidden = q.textContent.length === 0;
525
+ }, on = async (a) => {
526
+ if (!pe) {
527
+ pe = !0, Oe = null, _e();
522
528
  try {
523
- const s = await b.listSessions({ cursor: a, limit: 20 });
524
- pe = a ? [...pe, ...s.sessions] : s.sessions, st = s.nextCursor;
529
+ const s = await y.listSessions({ cursor: a, limit: 20 });
530
+ ue = a ? [...ue, ...s.sessions] : s.sessions, wt = s.nextCursor;
525
531
  } catch (s) {
526
- K(
532
+ J(
527
533
  "web-sdk.widget",
528
534
  "Failed to load session history",
529
535
  {
530
536
  message: s instanceof Error ? s.message : String(s)
531
537
  }
532
- ), De = li;
538
+ ), Oe = Ii;
533
539
  } finally {
534
- ae = !1, we();
540
+ pe = !1, _e();
535
541
  }
536
542
  }
537
- }, co = () => {
538
- !st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
539
- }, uo = () => {
540
- Se || typeof document > "u" || (Nn(n, t.accentColor), o.isConnected || c.body?.appendChild(o));
541
- }, Wt = new MutationObserver(uo);
542
- Wt.observe(c.documentElement, {
543
+ }, Io = () => {
544
+ !wt || pe || T.scrollHeight - T.scrollTop - T.clientHeight <= 24 && on(wt);
545
+ }, Ao = () => {
546
+ Le || typeof document > "u" || ($n(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
547
+ }, an = new MutationObserver(Ao);
548
+ an.observe(k.documentElement, {
543
549
  childList: !0,
544
550
  subtree: !0
545
551
  });
546
- const dt = (a = !0) => {
547
- const s = it(i, a);
548
- return Dt(
552
+ const Be = (a = !0) => {
553
+ const s = dt(i, a);
554
+ return Vt(
549
555
  i,
550
- p ? qn(p, s) : Pi(
556
+ p ? ro(p, s) : Qi(
551
557
  i,
552
558
  t.position,
553
559
  s
554
560
  ),
555
561
  s
556
562
  );
557
- }, O = () => {
558
- const a = Fi(n, w, f);
559
- Va(t, {
563
+ }, B = () => {
564
+ const a = ra(o, _, x);
565
+ gr(t, {
560
566
  isOpen: i.classList.contains("pluno-pa-widget--open"),
561
- composerValue: f.value,
567
+ composerValue: x.value,
562
568
  focusedInput: a,
563
569
  focusedInputAt: a ? Date.now() : null,
564
- openToolGroupKeys: [...lt],
570
+ openToolGroupKeys: [...mt],
565
571
  launcherPosition: d ? p : null,
566
- seenShareCandidateIds: [...Ce].slice(
567
- -On
572
+ panelSize: c,
573
+ seenShareCandidateIds: [...ke].slice(
574
+ -Zn
568
575
  ),
569
- sharePromptsDisabled: pt
576
+ sharePromptsDisabled: ft
570
577
  });
571
- }, je = (a) => {
578
+ }, Ze = (a) => {
572
579
  t.onDisplayStateChange?.(a);
573
- }, Re = (a, s = !0) => {
580
+ }, Ue = (a, s = !0) => {
574
581
  if (a === "shown") {
575
- i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Me(!1), s && je("shown");
582
+ i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Fe(!1), s && Ze("shown");
576
583
  return;
577
584
  }
578
- V !== null && (window.clearTimeout(V), V = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, y.hidden = !0, g.tabIndex = 0, f.value = "", xe(
585
+ Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, b.hidden = !0, A.hidden = !0, v.tabIndex = 0, x.value = "", ve(
579
586
  i,
580
- Ct(
587
+ Tt(
581
588
  i,
582
589
  p,
583
590
  t.position
584
591
  )
585
- ), _n(i), O(), s && je("minimized");
586
- }, be = (a, s = {}) => {
587
- Bi(a, {
588
- debugVersion: Si,
592
+ ), Dn(i), B(), s && Ze("minimized");
593
+ }, xe = (a, s = {}) => {
594
+ aa(a, {
595
+ debugVersion: Gi,
589
596
  launcherPosition: p,
590
597
  rootClasses: i.className,
591
598
  rootStyle: {
@@ -594,35 +601,35 @@ async function ki(e = {}) {
594
601
  right: i.style.right,
595
602
  bottom: i.style.bottom
596
603
  },
597
- rootRect: St(i),
598
- launcherRect: St(g),
599
- panelRect: St(k),
600
- viewport: ne(),
601
- panelHidden: k.hidden,
602
- closeHidden: y.hidden,
604
+ rootRect: Rt(i),
605
+ launcherRect: Rt(v),
606
+ panelRect: Rt(b),
607
+ viewport: Y(),
608
+ panelHidden: b.hidden,
609
+ closeHidden: A.hidden,
603
610
  ...s
604
611
  });
605
- }, Me = (a = !0) => {
612
+ }, Fe = (a = !0) => {
606
613
  if (!p)
607
- return xe(i, null), dt(a);
608
- const s = dt(a);
609
- return xe(i, s), be("Applied stored closed launcher position", {
614
+ return ve(i, null), Be(a);
615
+ const s = Be(a);
616
+ return ve(i, s), xe("Applied stored closed launcher position", {
610
617
  visibleLauncherPosition: s
611
618
  }), s;
612
- }, Gt = (a, s) => {
619
+ }, bt = (a, s) => {
613
620
  if (!a || !s) {
614
- _n(i);
621
+ Dn(i);
615
622
  return;
616
623
  }
617
- Ui(i, {
624
+ ia(i, {
618
625
  x: a.x - s.x,
619
626
  y: a.y - s.y
620
627
  });
621
- }, $t = () => {
628
+ }, rn = () => {
622
629
  if (i.classList.contains("pluno-pa-widget--minimized")) {
623
- xe(
630
+ ve(
624
631
  i,
625
- Ct(
632
+ Tt(
626
633
  i,
627
634
  p,
628
635
  t.position
@@ -630,118 +637,164 @@ async function ki(e = {}) {
630
637
  );
631
638
  return;
632
639
  }
633
- const a = Me();
640
+ const a = Fe();
634
641
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
635
- const s = bn(
636
- i,
637
- a,
638
- t.position
642
+ Nt(i, c);
643
+ const s = Re(c);
644
+ Mt(
645
+ h,
646
+ s.width
647
+ );
648
+ const w = lt(
649
+ u ?? Dt(
650
+ i,
651
+ a,
652
+ t.position,
653
+ c
654
+ ),
655
+ s
639
656
  );
640
- Gt(s, a), be(
657
+ u && (u = w), bt(w, a), xe(
641
658
  "Applied open panel position after viewport resize",
642
- { openPanelPosition: s }
659
+ { openPanelPosition: w }
643
660
  );
644
- } else p && be(
661
+ } else p && xe(
645
662
  "Applied visible launcher position after viewport resize",
646
663
  { visibleLauncherPosition: a }
647
664
  );
648
665
  };
649
- let qt = () => {
666
+ let ln = () => {
650
667
  };
651
- window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt = Ti({
668
+ window.addEventListener("resize", rn), t.movableLauncher && z ? (Fe(), ln = Xi({
652
669
  root: i,
653
- launcher: g,
654
- launcherDragHandle: S,
655
- getPosition: () => dt(),
670
+ launcher: v,
671
+ launcherDragHandle: z,
672
+ getPosition: () => Be(),
656
673
  setPosition: (a) => {
657
- const s = a, _ = it(i), E = Dt(
674
+ const s = a, w = dt(i), S = Vt(
658
675
  i,
659
676
  a,
660
- _
677
+ w
661
678
  );
662
- p = Ri(
663
- E,
664
- _
665
- ), xe(i, E), be("Dragging closed launcher", {
679
+ p = ta(
680
+ S,
681
+ w
682
+ ), ve(i, S), xe("Dragging closed launcher", {
666
683
  requestedPosition: s
667
684
  });
668
685
  },
669
686
  persist: () => {
670
- d = !0, O(), be("Persisted closed launcher drag position");
687
+ d = !0, B(), xe("Persisted closed launcher drag position");
671
688
  }
672
- })) : xe(i, null);
673
- let ct = !1;
674
- const jt = async () => {
675
- if (!(!t.billingStatusLoader || ct)) {
676
- ct = !0;
689
+ })) : ve(i, null), Nt(i, c);
690
+ const No = () => {
691
+ const a = Re(c), s = Be();
692
+ return {
693
+ position: lt(
694
+ u ?? Dt(
695
+ i,
696
+ s,
697
+ t.position,
698
+ c
699
+ ),
700
+ a
701
+ ),
702
+ size: a
703
+ };
704
+ }, To = (a) => {
705
+ c = ut(a.size), Nt(i, c), Mt(
706
+ h,
707
+ Re(c).width
708
+ ), u = lt(
709
+ a.position,
710
+ Re(c)
711
+ );
712
+ const s = Be();
713
+ bt(u, s);
714
+ }, Do = P.length > 0 ? Zi({
715
+ root: i,
716
+ handles: P,
717
+ getBounds: No,
718
+ setBounds: To,
719
+ persist: B
720
+ }) : () => {
721
+ };
722
+ let _t = !1;
723
+ const pn = async () => {
724
+ if (!(!t.billingStatusLoader || _t)) {
725
+ _t = !0;
677
726
  try {
678
727
  const a = await t.billingStatusLoader();
679
- Sn(
728
+ Bn(
680
729
  t.billingStatus,
681
730
  a,
682
- b.getState().lastErrorCode
683
- ) && (t.billingStatus = a, Lt(
684
- N,
731
+ y.getState().lastErrorCode
732
+ ) && (t.billingStatus = a, Bt(
733
+ H,
685
734
  t.billingStatus,
686
- b.getState().lastErrorCode
687
- ), q());
735
+ y.getState().lastErrorCode
736
+ ), j());
688
737
  } finally {
689
- ct = !1;
738
+ _t = !1;
690
739
  }
691
740
  }
692
- }, se = (a = "", s = !0) => {
693
- jt(), Oe && (Oe = !1, gt()), V !== null && (window.clearTimeout(V), V = null), Re("shown", !1), k.hidden = !1, y.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
694
- const _ = Me(), E = bn(
741
+ }, ge = (a = "", s = !0) => {
742
+ pn(), We && (We = !1, yt()), i.classList.contains("pluno-pa-widget--open") || (u = null), Z !== null && (window.clearTimeout(Z), Z = null), Ue("shown", !1), b.hidden = !1, A.hidden = !1, Mt(
743
+ h,
744
+ Re(c).width
745
+ ), i.classList.remove("pluno-pa-widget--closing");
746
+ const w = Fe(), S = Dt(
695
747
  i,
696
- _,
697
- t.position
748
+ w,
749
+ t.position,
750
+ c
698
751
  );
699
- if (Gt(E, _), be("Opening launcher at clamped open panel position", {
700
- openPanelPosition: E,
701
- visibleLauncherPosition: _
702
- }), X(!0, "open"), Z(), !s) {
703
- i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0);
752
+ if (bt(S, w), xe("Opening launcher at clamped open panel position", {
753
+ openPanelPosition: S,
754
+ visibleLauncherPosition: w
755
+ }), ee(!0, "open"), te(), !s) {
756
+ i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0);
704
757
  return;
705
758
  }
706
759
  window.requestAnimationFrame(() => {
707
- i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
708
- g.hidden = !0, We(I, () => me.enabled), fe = I.scrollTop;
760
+ i.classList.add("pluno-pa-widget--open"), a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0), Z = window.setTimeout(() => {
761
+ v.hidden = !0, Ve(N, () => we.enabled), be = N.scrollTop;
709
762
  }, 220);
710
763
  });
711
- }, go = () => {
712
- V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), O(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
713
- k.hidden = !0, y.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
764
+ }, Ro = () => {
765
+ Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (Fe(!1), xe("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), B(), t.onPanelOpenChange?.(!1), Z = window.setTimeout(() => {
766
+ b.hidden = !0, A.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
714
767
  }, 220);
715
768
  };
716
- g.addEventListener("submit", (a) => {
717
- a.preventDefault(), se(w.value), w.value = "";
718
- }), S?.addEventListener("click", (a) => {
769
+ v.addEventListener("submit", (a) => {
770
+ a.preventDefault(), ge(_.value), _.value = "";
771
+ }), z?.addEventListener("click", (a) => {
719
772
  a.preventDefault(), a.stopPropagation();
720
- }), g.addEventListener("click", (a) => {
721
- a.target === w && !S || (se(w.value), w.value = "");
722
- }), w.addEventListener("focus", () => {
723
- se(w.value), w.value = "";
724
- }), w.addEventListener("input", () => {
725
- if (!w.value)
773
+ }), v.addEventListener("click", (a) => {
774
+ a.target === _ && !z || (ge(_.value), _.value = "");
775
+ }), _.addEventListener("focus", () => {
776
+ ge(_.value), _.value = "";
777
+ }), _.addEventListener("input", () => {
778
+ if (!_.value)
726
779
  return;
727
- const a = w.value;
728
- se(a), w.value = "";
780
+ const a = _.value;
781
+ ge(a), _.value = "";
729
782
  });
730
- let ut = null, Ve = null, _e = null;
731
- const Vt = (a) => a === w || a === f, ho = (a) => {
783
+ let xt = null, Je = null, ye = null;
784
+ const sn = (a) => a === _ || a === x, zo = (a) => {
732
785
  if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
733
786
  return null;
734
787
  let s = a;
735
788
  for (; s; ) {
736
- const _ = s.closest(ln);
737
- if (_)
738
- return _;
739
- const E = s.getRootNode();
740
- s = E instanceof ShadowRoot ? E.host : null;
789
+ const w = s.closest(vn);
790
+ if (w)
791
+ return w;
792
+ const S = s.getRootNode();
793
+ s = S instanceof ShadowRoot ? S.host : null;
741
794
  }
742
795
  return null;
743
- }, mo = (a) => {
744
- if (!a.isConnected || !a.matches(ln))
796
+ }, Mo = (a) => {
797
+ if (!a.isConnected || !a.matches(vn))
745
798
  return !1;
746
799
  if (!(a instanceof HTMLElement))
747
800
  return !0;
@@ -751,66 +804,66 @@ async function ki(e = {}) {
751
804
  return a.checkVisibility();
752
805
  const s = window.getComputedStyle(a);
753
806
  return s.display !== "none" && s.visibility !== "hidden";
754
- }, Kt = (a) => {
755
- ze !== a && (ze = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ye(), a !== null ? _e = window.setInterval(() => {
756
- const s = ze;
757
- (!s || !mo(s)) && Kt(null);
758
- }, ri) : _e !== null && (window.clearInterval(_e), _e = null, Ve = null));
759
- }, fo = () => {
760
- _e !== null && (window.clearInterval(_e), _e = null);
807
+ }, dn = (a) => {
808
+ He !== a && (He = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), et(), a !== null ? ye = window.setInterval(() => {
809
+ const s = He;
810
+ (!s || !Mo(s)) && dn(null);
811
+ }, Pi) : ye !== null && (window.clearInterval(ye), ye = null, Je = null));
812
+ }, Oo = () => {
813
+ ye !== null && (window.clearInterval(ye), ye = null);
761
814
  };
762
815
  i.addEventListener("focusin", (a) => {
763
- Vt(a.target) && (ut = Date.now(), O());
816
+ sn(a.target) && (xt = Date.now(), B());
764
817
  }), i.addEventListener("focusout", (a) => {
765
- if (!Vt(a.target) || ze !== null)
818
+ if (!sn(a.target) || He !== null)
766
819
  return;
767
- const s = ut;
768
- if (ut = null, s === null || Date.now() - s > ii)
820
+ const s = xt;
821
+ if (xt = null, s === null || Date.now() - s > ki)
769
822
  return;
770
- const _ = ho(a.relatedTarget);
771
- if (!_)
823
+ const w = zo(a.relatedTarget);
824
+ if (!w)
772
825
  return;
773
- const E = Date.now();
774
- if (Ve !== null && E - Ve <= ai) {
775
- Kt(_);
826
+ const S = Date.now();
827
+ if (Je !== null && S - Je <= Li) {
828
+ dn(w);
776
829
  return;
777
830
  }
778
- Ve = E;
779
- }), g.addEventListener("keydown", (a) => {
780
- !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), se());
781
- }), H?.addEventListener("pointerdown", (a) => {
831
+ Je = S;
832
+ }), v.addEventListener("keydown", (a) => {
833
+ !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), ge());
834
+ }), g?.addEventListener("pointerdown", (a) => {
782
835
  a.stopPropagation();
783
- }), H?.addEventListener("click", (a) => {
784
- a.preventDefault(), a.stopPropagation(), Re("minimized");
785
- }), y.addEventListener("click", go), I.addEventListener("scroll", () => {
786
- I.scrollTop < fe - 1 && X(!1, "userScroll"), fe = I.scrollTop;
787
- }), x.addEventListener("click", () => {
788
- so();
836
+ }), g?.addEventListener("click", (a) => {
837
+ a.preventDefault(), a.stopPropagation(), Ue("minimized");
838
+ }), A.addEventListener("click", Ro), N.addEventListener("scroll", () => {
839
+ N.scrollTop < be - 1 && ee(!1, "userScroll"), be = N.scrollTop;
840
+ }), R.addEventListener("click", () => {
841
+ Po();
789
842
  });
790
- const Yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
843
+ const cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
791
844
  ([a]) => {
792
- a?.isIntersecting && (X(!0, "bottom"), Z());
845
+ a?.isIntersecting && (ee(!0, "bottom"), te());
793
846
  },
794
- { root: I, threshold: 0 }
847
+ { root: N, threshold: 0 }
795
848
  );
796
- Yt?.observe($);
797
- const Ke = () => t.loginRequired || t.signupRequired;
798
- let ze = null, Oe = !1;
799
- const Ye = () => {
800
- const a = Ke(), s = ze !== null;
801
- w.readOnly = a || s, f.readOnly = s, w.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
802
- }, q = () => {
803
- R.disabled = te(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && B.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
849
+ cn?.observe(ht);
850
+ const Qe = () => t.loginRequired || t.signupRequired;
851
+ let He = null, We = !1;
852
+ const et = () => {
853
+ const a = Qe(), s = He !== null;
854
+ _.readOnly = a || s, x.readOnly = s, _.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : We ? "New update" : t.launcherLabel, x.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : oe.launcherLabel, L.hidden = a;
855
+ }, j = () => {
856
+ de.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, ze.disabled = Qe() || ae(t.billingStatus);
804
857
  };
805
- Ye();
806
- const gt = () => {
807
- const a = b.getState().isThinking;
858
+ et();
859
+ const yt = () => {
860
+ const a = y.getState().isThinking;
808
861
  i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
809
862
  "pluno-pa-widget--unread",
810
- !a && Oe
811
- ), Ye();
863
+ !a && We
864
+ ), et();
812
865
  };
813
- gt(), v.addEventListener("submit", (a) => {
866
+ yt(), L.addEventListener("submit", (a) => {
814
867
  if (a.preventDefault(), t.loginRequired) {
815
868
  t.onLoginClick?.();
816
869
  return;
@@ -819,157 +872,157 @@ async function ki(e = {}) {
819
872
  t.onSignupClick?.();
820
873
  return;
821
874
  }
822
- te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), B = Et(
823
- b,
824
- f,
825
- B
826
- ), ve(), q());
875
+ ae(t.billingStatus) || (fe = !0, ee(!0, "send"), te(), W = zt(
876
+ y,
877
+ x,
878
+ W
879
+ ), Ee(), j());
827
880
  });
828
- let Ue = 0;
829
- const wo = () => {
830
- Ue = 0, i.classList.remove("pluno-pa-widget--drag-over");
831
- }, ht = (a) => {
832
- ie !== null && window.clearTimeout(ie), h.textContent = a, h.hidden = !1, ie = window.setTimeout(() => {
833
- h.textContent = "", h.hidden = !0, ie = null;
881
+ let Ge = 0;
882
+ const Bo = () => {
883
+ Ge = 0, i.classList.remove("pluno-pa-widget--drag-over");
884
+ }, vt = (a) => {
885
+ le !== null && window.clearTimeout(le), F.textContent = a, F.hidden = !1, le = window.setTimeout(() => {
886
+ F.textContent = "", F.hidden = !0, le = null;
834
887
  }, 3e3);
835
- }, bo = () => {
836
- ie !== null && (window.clearTimeout(ie), ie = null), h.textContent = "", h.hidden = !0;
837
- }, mt = async (a) => {
888
+ }, Uo = () => {
889
+ le !== null && (window.clearTimeout(le), le = null), F.textContent = "", F.hidden = !0;
890
+ }, Ct = async (a) => {
838
891
  if (a.length === 0)
839
892
  return;
840
- const s = fa(b, a);
841
- B = [...B, ...s], ve(), bo(), q(), F(b.getState()), i.classList.contains("pluno-pa-widget--open") || se();
893
+ const s = Ma(y, a);
894
+ W = [...W, ...s], Ee(), Uo(), j(), G(y.getState()), i.classList.contains("pluno-pa-widget--open") || ge();
842
895
  };
843
- Pe.addEventListener("click", () => {
844
- t.loginRequired || te(t.billingStatus) || L.click();
845
- }), L.addEventListener("change", () => {
846
- const a = Array.from(L.files ?? []);
847
- L.value = "", mt(a).catch((s) => {
848
- ht(
896
+ ze.addEventListener("click", () => {
897
+ t.loginRequired || ae(t.billingStatus) || Q.click();
898
+ }), Q.addEventListener("change", () => {
899
+ const a = Array.from(Q.files ?? []);
900
+ Q.value = "", Ct(a).catch((s) => {
901
+ vt(
849
902
  s instanceof Error ? s.message : "Failed to attach file"
850
- ), K("web-sdk.widget", "Attachment failed", {
903
+ ), J("web-sdk.widget", "Attachment failed", {
851
904
  message: s instanceof Error ? s.message : String(s)
852
905
  });
853
906
  });
854
907
  }), i.addEventListener("dragenter", (a) => {
855
- !Qe(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ue += 1, i.classList.add("pluno-pa-widget--drag-over"));
908
+ !it(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ge += 1, i.classList.add("pluno-pa-widget--drag-over"));
856
909
  }), i.addEventListener("dragover", (a) => {
857
910
  const s = a.dataTransfer;
858
- !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
911
+ !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
859
912
  }), i.addEventListener("dragleave", (a) => {
860
- Qe(a.dataTransfer) && (a.stopPropagation(), Ue = Math.max(0, Ue - 1), Ue === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
913
+ it(a.dataTransfer) && (a.stopPropagation(), Ge = Math.max(0, Ge - 1), Ge === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
861
914
  }), i.addEventListener("drop", (a) => {
862
915
  const s = a.dataTransfer;
863
- !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), wo(), mt(s.files).catch((_) => {
864
- ht(
865
- _ instanceof Error ? _.message : "Failed to attach file"
866
- ), K("web-sdk.widget", "Attachment failed", {
867
- message: _ instanceof Error ? _.message : String(_)
916
+ !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Bo(), Ct(s.files).catch((w) => {
917
+ vt(
918
+ w instanceof Error ? w.message : "Failed to attach file"
919
+ ), J("web-sdk.widget", "Attachment failed", {
920
+ message: w instanceof Error ? w.message : String(w)
868
921
  });
869
922
  }));
870
923
  }), i.addEventListener("paste", (a) => {
871
- const s = a.clipboardData, _ = Array.from(s?.files ?? []);
872
- _.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), mt(_).catch((E) => {
873
- ht(
874
- E instanceof Error ? E.message : "Failed to attach file"
875
- ), K("web-sdk.widget", "Attachment failed", {
876
- message: E instanceof Error ? E.message : String(E)
924
+ const s = a.clipboardData, w = Array.from(s?.files ?? []);
925
+ w.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ct(w).catch((S) => {
926
+ vt(
927
+ S instanceof Error ? S.message : "Failed to attach file"
928
+ ), J("web-sdk.widget", "Attachment failed", {
929
+ message: S instanceof Error ? S.message : String(S)
877
930
  });
878
931
  }));
879
- }), R.addEventListener("click", () => {
932
+ }), de.addEventListener("click", () => {
880
933
  if (t.loginRequired) {
881
934
  t.onLoginClick?.();
882
935
  return;
883
936
  }
884
- if (b.getState().isThinking) {
885
- b.stop();
937
+ if (y.getState().isThinking) {
938
+ y.stop();
886
939
  return;
887
940
  }
888
- he = !0, X(!0, "send"), Z(), B = Et(
889
- b,
890
- f,
891
- B
892
- ), ve(), q(), F(b.getState());
893
- }), ue.addEventListener("click", () => {
894
- le = !le, De = null, we(), le && pe.length === 0 && Ht(null);
895
- }), $e.addEventListener("click", () => {
896
- le = !1, we();
897
- }), G.addEventListener("scroll", co), f.addEventListener("input", () => {
898
- He(f), O(), q(), yo();
899
- }), f.addEventListener("keydown", (a) => {
941
+ fe = !0, ee(!0, "send"), te(), W = zt(
942
+ y,
943
+ x,
944
+ W
945
+ ), Ee(), j(), G(y.getState());
946
+ }), X.addEventListener("click", () => {
947
+ ce = !ce, Oe = null, _e(), ce && ue.length === 0 && on(null);
948
+ }), Se.addEventListener("click", () => {
949
+ ce = !1, _e();
950
+ }), T.addEventListener("scroll", Io), x.addEventListener("input", () => {
951
+ je(x), B(), j(), Wo();
952
+ }), x.addEventListener("keydown", (a) => {
900
953
  if (!(a.key !== "Enter" || a.shiftKey)) {
901
954
  if (a.preventDefault(), t.loginRequired) {
902
955
  t.onLoginClick?.();
903
956
  return;
904
957
  }
905
- he = !0, X(!0, "send"), Z(), B = Et(
906
- b,
907
- f,
908
- B
909
- ), ve(), q(), F(b.getState());
958
+ fe = !0, ee(!0, "send"), te(), W = zt(
959
+ y,
960
+ x,
961
+ W
962
+ ), Ee(), j(), G(y.getState());
910
963
  }
911
964
  }), i.addEventListener("click", (a) => {
912
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && O();
913
- }), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i, w, f);
914
- const Xe = () => r;
915
- let ft = b.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = b.getState().isThinking, ke = null;
916
- const Fe = t.taskNotifications;
917
- let Le = null, Ie = !1;
918
- const Zt = () => {
919
- Le !== null && (window.clearTimeout(Le), Le = null);
920
- }, Je = () => {
921
- A && (A.hidden = !0);
922
- }, Jt = () => b.getState().assistantDraft.trim().length > 0, _o = async () => {
923
- if (!Fe || !A || Ie || Se || !b.getState().isThinking || Jt())
965
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && B();
966
+ }), l.composerValue && (x.value = l.composerValue, je(x)), t.initialDisplayState === "minimized" ? Ue("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && ge(x.value, !1), la(l, i, _, x);
967
+ const tt = () => r;
968
+ let St = y.getState().appearance !== null, nt = null, $e = null, Pe = null, un = y.getState().isThinking, Ie = null;
969
+ const qe = t.taskNotifications;
970
+ let Ae = null, Ne = !1;
971
+ const gn = () => {
972
+ Ae !== null && (window.clearTimeout(Ae), Ae = null);
973
+ }, ot = () => {
974
+ Me && (Me.hidden = !0);
975
+ }, hn = () => y.getState().assistantDraft.trim().length > 0, Fo = async () => {
976
+ if (!qe || !Me || Ne || Le || !y.getState().isThinking || hn())
924
977
  return;
925
978
  let a;
926
979
  try {
927
- a = await Fe.getState();
980
+ a = await qe.getState();
928
981
  } catch {
929
982
  return;
930
983
  }
931
- a.enabled || a.neverSuggest || !b.getState().isThinking || Jt() || Ie || Se || (A.hidden = !1);
984
+ a.enabled || a.neverSuggest || !y.getState().isThinking || hn() || Ne || Le || (Me.hidden = !1);
932
985
  };
933
- T?.addEventListener("click", () => {
934
- Ie = !0, Je(), Fe?.enable().catch(() => {
986
+ vo?.addEventListener("click", () => {
987
+ Ne = !0, ot(), qe?.enable().catch(() => {
935
988
  });
936
- }), ge?.addEventListener("click", () => {
937
- Ie = !0, Je();
938
- }), ao?.addEventListener("click", () => {
939
- Ie = !0, Je(), Fe?.dismissForever().catch(() => {
989
+ }), Co?.addEventListener("click", () => {
990
+ Ne = !0, ot();
991
+ }), So?.addEventListener("click", () => {
992
+ Ne = !0, ot(), qe?.dismissForever().catch(() => {
940
993
  });
941
994
  });
942
- let Ae = null, Qt = () => {
995
+ let Te = null, mn = () => {
943
996
  };
944
- const xo = !!t.socialPostDraftHandler, wt = /* @__PURE__ */ new Map(), bt = () => f.value.trim().length > 0 || B.length > 0, yo = () => {
945
- const a = Ae !== null && It(b.getState(), bt());
946
- z.hidden = !a, a && Ae !== null && Vn(z, Ae);
997
+ const Ho = !!t.socialPostDraftHandler, Et = /* @__PURE__ */ new Map(), kt = () => x.value.trim().length > 0 || W.length > 0, Wo = () => {
998
+ const a = Te !== null && Ut(y.getState(), kt());
999
+ D.hidden = !a, a && Te !== null && po(D, Te);
947
1000
  };
948
- let Ne = null;
949
- const vo = () => {
950
- he = !0, X(!0, "newSession"), Z(), le = !1, we(), b.startNewSession(), lt.clear(), f.value = "", B = [], ve(), He(f), O(), q(), f.focus(), F(b.getState());
951
- }, _t = (a) => {
1001
+ let De = null;
1002
+ const Go = () => {
1003
+ fe = !0, ee(!0, "newSession"), te(), ce = !1, _e(), y.startNewSession(), mt.clear(), x.value = "", W = [], Ee(), je(x), B(), j(), x.focus(), G(y.getState());
1004
+ }, Lt = (a) => {
952
1005
  if (!a) {
953
- Ne?.remove(), Ne = null;
1006
+ De?.remove(), De = null;
954
1007
  return;
955
1008
  }
956
- Ne || (Ne = rt(
1009
+ De || (De = gt(
957
1010
  "pluno-pa-widget__new-chat",
958
1011
  "New chat",
959
- aa(),
1012
+ Ea(),
960
1013
  !1
961
- ), Ne.addEventListener("click", vo), ce.insertBefore(Ne, ue));
962
- }, F = (a) => {
963
- if (we(), Bt(a.lastErrorCode) ? ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
964
- N,
1014
+ ), De.addEventListener("click", Go), Ye.insertBefore(De, X));
1015
+ }, G = (a) => {
1016
+ if (_e(), tn(a.lastErrorCode) ? Ie = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1017
+ H,
965
1018
  t.billingStatus,
966
- ke
1019
+ Ie
967
1020
  ), t.loginRequired) {
968
- wt.clear(), In(
969
- I,
970
- R,
971
- _t,
972
- Xe,
1021
+ Et.clear(), Wn(
1022
+ N,
1023
+ de,
1024
+ Lt,
1025
+ tt,
973
1026
  "Log in to use Pluno on this page.",
974
1027
  t.loginButtonLabel,
975
1028
  t.loginUrl,
@@ -978,11 +1031,11 @@ async function ki(e = {}) {
978
1031
  return;
979
1032
  }
980
1033
  if (t.signupRequired) {
981
- wt.clear(), In(
982
- I,
983
- R,
984
- _t,
985
- Xe,
1034
+ Et.clear(), Wn(
1035
+ N,
1036
+ de,
1037
+ Lt,
1038
+ tt,
986
1039
  "Complete signup to unlock your free trial credits.",
987
1040
  t.signupButtonLabel,
988
1041
  t.signupUrl,
@@ -990,67 +1043,67 @@ async function ki(e = {}) {
990
1043
  );
991
1044
  return;
992
1045
  }
993
- const s = Gi(a), _ = s !== Ft;
994
- Ft = s;
995
- const E = he || me.enabled;
996
- he = !1, Ca(
997
- I,
998
- $,
999
- R,
1000
- _t,
1001
- z,
1046
+ const s = sa(a), w = s !== nn;
1047
+ nn = s;
1048
+ const S = fe || we.enabled;
1049
+ fe = !1, Ga(
1050
+ N,
1051
+ ht,
1052
+ de,
1053
+ Lt,
1054
+ D,
1002
1055
  a,
1003
- Ae,
1004
- Ae !== null && It(a, bt()),
1005
- E,
1006
- () => me.enabled,
1007
- lt,
1008
- wt,
1009
- O,
1010
- Xe,
1011
- (P) => {
1012
- he = !0, X(!0, "send"), Z(), b.sendMessage(P);
1056
+ Te,
1057
+ Te !== null && Ut(a, kt()),
1058
+ S,
1059
+ () => we.enabled,
1060
+ mt,
1061
+ Et,
1062
+ B,
1063
+ tt,
1064
+ (M) => {
1065
+ fe = !0, ee(!0, "send"), te(), y.sendMessage(M);
1013
1066
  },
1014
- xo && !pt ? {
1015
- dismissedCandidateIds: qe,
1016
- draftingCandidateId: Ze,
1017
- error: Be,
1018
- characterIconOptions: Xe(),
1019
- onSeen: (P) => {
1020
- Ce.add(P.id), O();
1067
+ Ho && !ft ? {
1068
+ dismissedCandidateIds: Xe,
1069
+ draftingCandidateId: nt,
1070
+ error: $e,
1071
+ characterIconOptions: tt(),
1072
+ onSeen: (M) => {
1073
+ ke.add(M.id), B();
1021
1074
  },
1022
- onDraft: (P) => {
1023
- Co(P);
1075
+ onDraft: (M) => {
1076
+ $o(M);
1024
1077
  },
1025
- onDismiss: (P) => {
1026
- Ce.add(P.id), qe.add(P.id), O(), Be = null, F(b.getState());
1078
+ onDismiss: (M) => {
1079
+ ke.add(M.id), Xe.add(M.id), B(), $e = null, G(y.getState());
1027
1080
  },
1028
- onDisable: (P) => {
1029
- pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(b.getState());
1081
+ onDisable: (M) => {
1082
+ ft = !0, ke.add(M.id), Xe.add(M.id), B(), ur(t, !0), $e = null, G(y.getState());
1030
1083
  }
1031
1084
  } : void 0
1032
- ), E ? (fe = I.scrollTop, Z()) : _ && $i(a) && po();
1085
+ ), S ? (be = N.scrollTop, te()) : w && da(a) && Lo();
1033
1086
  };
1034
- return Qt = Ho(
1087
+ return mn = si(
1035
1088
  (a) => {
1036
- Ae = a, !Se && It(b.getState(), bt()) && F(b.getState());
1089
+ Te = a, !Le && Ut(y.getState(), kt()) && G(y.getState());
1037
1090
  },
1038
1091
  {
1039
1092
  backendUrl: t.backendUrl,
1040
- fetcher: lo,
1093
+ fetcher: ko,
1041
1094
  loader: t.activeUsersLoader
1042
1095
  }
1043
- ), b.on("state", (a) => {
1044
- const s = Xt && !a.isThinking;
1045
- Xt = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Fe && !Ie && Le === null && A?.hidden !== !1 && (Le = window.setTimeout(() => {
1046
- Le = null, _o();
1047
- }, jo)), (!a.isThinking || a.assistantDraft.trim()) && (Zt(), Je()), s && !i.classList.contains("pluno-pa-widget--open") && (Oe = !0), gt(), a.appearance ? (ft = !0, K(
1096
+ ), y.on("state", (a) => {
1097
+ const s = un && !a.isThinking;
1098
+ un = a.isThinking, a.isThinking && !a.assistantDraft.trim() && qe && !Ne && Ae === null && Me?.hidden !== !1 && (Ae = window.setTimeout(() => {
1099
+ Ae = null, Fo();
1100
+ }, hi)), (!a.isThinking || a.assistantDraft.trim()) && (gn(), ot()), s && !i.classList.contains("pluno-pa-widget--open") && (We = !0), yt(), a.appearance ? (St = !0, J(
1048
1101
  "web-sdk.widget",
1049
1102
  "Agent state supplied appearance",
1050
1103
  {
1051
1104
  appearance: a.appearance
1052
1105
  }
1053
- ), xt(a.appearance, "agent.state.appearance")) : ft && (ft = !1, K(
1106
+ ), Pt(a.appearance, "agent.state.appearance")) : St && (St = !1, J(
1054
1107
  "web-sdk.widget",
1055
1108
  "Agent state cleared appearance; reverting to configured widget options",
1056
1109
  {
@@ -1058,101 +1111,101 @@ async function ki(e = {}) {
1058
1111
  fallbackColorScheme: t.colorScheme,
1059
1112
  fallbackFontFamily: t.fontFamily
1060
1113
  }
1061
- ), xt({}, "agent.state.appearance-cleared")), F(a), q(), s && jt();
1062
- }), F(b.getState()), q(), {
1063
- agent: b,
1114
+ ), Pt({}, "agent.state.appearance-cleared")), G(a), j(), s && pn();
1115
+ }), G(y.getState()), j(), {
1116
+ agent: y,
1064
1117
  updateAppearance: (a) => {
1065
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), xt(a, "widgetHandle.updateAppearance");
1118
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Pt(a, "widgetHandle.updateAppearance");
1066
1119
  },
1067
1120
  updateBillingStatus: (a) => {
1068
1121
  const s = a ?? null;
1069
- Sn(
1122
+ Bn(
1070
1123
  t.billingStatus,
1071
1124
  s,
1072
- ke
1073
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
1125
+ Ie
1126
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1074
1127
  i.querySelector(".pluno-pa-widget__billing-status"),
1075
1128
  t.billingStatus,
1076
- ke
1077
- ), q());
1129
+ Ie
1130
+ ), j());
1078
1131
  },
1079
1132
  updateAuthGate: (a) => {
1080
- const s = Ke();
1081
- t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(b.getState()), q(), s && !Ke() && b.connect().catch((_) => {
1082
- K(
1133
+ const s = Qe();
1134
+ t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), et(), G(y.getState()), j(), s && !Qe() && y.connect().catch((w) => {
1135
+ J(
1083
1136
  "web-sdk.widget",
1084
1137
  "Failed to connect after auth gate cleared",
1085
1138
  {
1086
- message: _ instanceof Error ? _.message : String(_)
1139
+ message: w instanceof Error ? w.message : String(w)
1087
1140
  }
1088
1141
  );
1089
1142
  });
1090
1143
  },
1091
1144
  openPanel: () => {
1092
- se(f.value, !1);
1145
+ ge(x.value, !1);
1093
1146
  },
1094
1147
  updateDisplayState: (a) => {
1095
1148
  if (a === "shown") {
1096
- Re("shown", !1);
1149
+ Ue("shown", !1);
1097
1150
  return;
1098
1151
  }
1099
- Re("minimized", !1);
1152
+ Ue("minimized", !1);
1100
1153
  },
1101
1154
  destroy: () => {
1102
- Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(), b.destroy(), o.remove());
1155
+ Le || (B(), Le = !0, an.disconnect(), cn?.disconnect(), Oo(), window.removeEventListener("resize", rn), ln(), Do(), le !== null && window.clearTimeout(le), gn(), mn(), Pe?.remove(), y.destroy(), n.remove());
1103
1156
  }
1104
1157
  };
1105
- async function Co(a) {
1106
- if (!Ze) {
1107
- Ze = a.id, Be = null, F(b.getState());
1158
+ async function $o(a) {
1159
+ if (!nt) {
1160
+ nt = a.id, $e = null, G(y.getState());
1108
1161
  try {
1109
1162
  if (!t.socialPostDraftHandler)
1110
1163
  throw new Error("Social post drafting is not available here.");
1111
1164
  const s = await t.socialPostDraftHandler(a);
1112
1165
  if (!s.linkedinPost || !s.xPost)
1113
1166
  throw new Error("Pluno did not return a complete social post draft.");
1114
- Ce.add(a.id), qe.add(a.id), O(), Ee?.remove(), Ee = Ta(s, {
1167
+ ke.add(a.id), Xe.add(a.id), B(), Pe?.remove(), Pe = Za(s, {
1115
1168
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1116
1169
  onClose: () => {
1117
- Ee?.remove(), Ee = null;
1170
+ Pe?.remove(), Pe = null;
1118
1171
  }
1119
- }), i.appendChild(Ee);
1172
+ }), i.appendChild(Pe);
1120
1173
  } catch (s) {
1121
- Be = s instanceof Error ? s.message : "Could not draft social post.";
1174
+ $e = s instanceof Error ? s.message : "Could not draft social post.";
1122
1175
  } finally {
1123
- Ze = null, F(b.getState());
1176
+ nt = null, G(y.getState());
1124
1177
  }
1125
1178
  }
1126
1179
  }
1127
- function xt(a, s) {
1128
- const _ = a.accentColor ?? t.accentColor, E = a.colorScheme ?? t.colorScheme, P = a.fontFamily ?? t.fontFamily, yt = a.scribbleStyle ?? t.scribbleStyle;
1129
- r = fn(
1130
- _,
1131
- yt
1132
- ), wn(i, r, {
1133
- accentColor: _,
1134
- colorScheme: E,
1135
- fontFamily: P,
1136
- scribbleStyle: yt
1137
- }), K("web-sdk.widget", "Updated widget appearance", {
1180
+ function Pt(a, s) {
1181
+ const w = a.accentColor ?? t.accentColor, S = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, It = a.scribbleStyle ?? t.scribbleStyle;
1182
+ r = Pn(
1183
+ w,
1184
+ It
1185
+ ), In(i, r, {
1186
+ accentColor: w,
1187
+ colorScheme: S,
1188
+ fontFamily: M,
1189
+ scribbleStyle: It
1190
+ }), J("web-sdk.widget", "Updated widget appearance", {
1138
1191
  source: s,
1139
1192
  inputAppearance: a,
1140
- appliedAccentColor: _,
1141
- appliedColorScheme: E,
1142
- appliedFontFamily: P,
1143
- appliedScribbleStyle: yt,
1193
+ appliedAccentColor: w,
1194
+ appliedColorScheme: S,
1195
+ appliedFontFamily: M,
1196
+ appliedScribbleStyle: It,
1144
1197
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1145
1198
  });
1146
1199
  }
1147
1200
  }
1148
- function fn(e, t) {
1201
+ function Pn(e, t) {
1149
1202
  return { accentColor: e, scribbleStyle: t };
1150
1203
  }
1151
- function Li(e) {
1152
- const t = Ii(e);
1153
- return t === null ? "#fafafa" : Ai(t) > 0.5 ? "#18181b" : "#fafaf9";
1204
+ function ji(e) {
1205
+ const t = Vi(e);
1206
+ return t === null ? "#fafafa" : Ki(t) > 0.5 ? "#18181b" : "#fafaf9";
1154
1207
  }
1155
- function Ii(e) {
1208
+ function Vi(e) {
1156
1209
  const t = e.trim();
1157
1210
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1158
1211
  Number.parseInt(t.slice(1, 3), 16),
@@ -1164,42 +1217,42 @@ function Ii(e) {
1164
1217
  Number.parseInt(t[3] + t[3], 16)
1165
1218
  ] : null;
1166
1219
  }
1167
- function Ai([e, t, o]) {
1168
- const n = (i) => {
1220
+ function Ki([e, t, n]) {
1221
+ const o = (i) => {
1169
1222
  const r = i / 255;
1170
1223
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1171
1224
  };
1172
- return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
1225
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1173
1226
  }
1174
- function wn(e, t, o) {
1227
+ function In(e, t, n) {
1175
1228
  e.classList.toggle(
1176
1229
  "pluno-pa-widget--dark",
1177
- o.colorScheme === "dark"
1230
+ n.colorScheme === "dark"
1178
1231
  ), e.classList.toggle(
1179
1232
  "pluno-pa-widget--light",
1180
- o.colorScheme !== "dark"
1181
- ), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
1182
- const n = o.scribbleStyle ? Rn(o.accentColor) : o.accentColor;
1183
- e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
1233
+ n.colorScheme !== "dark"
1234
+ ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1235
+ const o = n.scribbleStyle ? Kn(n.accentColor) : n.accentColor;
1236
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1184
1237
  "--pluno-pa-accent-contrast",
1185
- Li(n)
1186
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? pi : o.fontFamily, o.scribbleStyle && Ni(e.ownerDocument);
1238
+ ji(o)
1239
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ai : n.fontFamily, n.scribbleStyle && Yi(e.ownerDocument);
1187
1240
  const i = Array.from(
1188
1241
  e.querySelectorAll(".pluno-pa-widget__character")
1189
1242
  );
1190
1243
  for (const r of i)
1191
1244
  r.replaceWith(
1192
- de(
1245
+ me(
1193
1246
  Array.from(r.classList).join(" "),
1194
1247
  t
1195
1248
  )
1196
1249
  );
1197
1250
  }
1198
- function Ni(e) {
1199
- if (e.getElementById(sn))
1251
+ function Yi(e) {
1252
+ if (e.getElementById(Sn))
1200
1253
  return;
1201
1254
  const t = e.createElement("style");
1202
- t.id = sn, t.textContent = `@font-face {
1255
+ t.id = Sn, t.textContent = `@font-face {
1203
1256
  font-family: "Architects Daughter";
1204
1257
  font-style: normal;
1205
1258
  font-weight: 400;
@@ -1207,201 +1260,353 @@ function Ni(e) {
1207
1260
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1208
1261
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1209
1262
  }
1210
- function Ti({
1263
+ function Xi({
1211
1264
  root: e,
1212
1265
  launcher: t,
1213
- launcherDragHandle: o,
1214
- getPosition: n,
1266
+ launcherDragHandle: n,
1267
+ getPosition: o,
1215
1268
  setPosition: i,
1216
1269
  persist: r
1217
1270
  }) {
1218
- let l = null, p = null, d = null, u = !1, c = null;
1219
- const g = () => {
1220
- l = null, p = null, d = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
1221
- }, S = (h) => {
1222
- 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 }, d = n(), u = !1, t.setPointerCapture?.(h.pointerId));
1223
- }, w = (h) => {
1271
+ let l = null, p = null, d = null, c = !1, u = null;
1272
+ const m = () => {
1273
+ l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1274
+ }, k = (h) => {
1275
+ 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 }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1276
+ }, v = (h) => {
1224
1277
  if (l !== h.pointerId || !p || !d)
1225
1278
  return;
1226
1279
  h.preventDefault();
1227
- const N = h.clientX - p.x, D = h.clientY - p.y;
1228
- !u && Math.hypot(N, D) < hn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + N, y: d.y + D }));
1229
- }, H = (h) => {
1230
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (c = { x: h.clientX, y: h.clientY }, r()), g());
1231
- }, k = (h) => {
1232
- l === h.pointerId && (h.preventDefault(), g());
1233
- }, y = (h) => {
1234
- if (!c)
1280
+ const P = h.clientX - p.x, A = h.clientY - p.y;
1281
+ !c && Math.hypot(P, A) < jt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + A }));
1282
+ }, z = (h) => {
1283
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1284
+ }, _ = (h) => {
1285
+ l === h.pointerId && (h.preventDefault(), m());
1286
+ }, g = (h) => {
1287
+ if (!u)
1235
1288
  return;
1236
- const N = Math.hypot(
1237
- h.clientX - c.x,
1238
- h.clientY - c.y
1239
- ) <= hn;
1240
- c = null, N && (h.preventDefault(), h.stopPropagation());
1241
- }, v = (h) => {
1289
+ const P = Math.hypot(
1290
+ h.clientX - u.x,
1291
+ h.clientY - u.y
1292
+ ) <= jt;
1293
+ u = null, P && (h.preventDefault(), h.stopPropagation());
1294
+ }, b = (h) => {
1242
1295
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1243
1296
  return;
1244
- const N = h.shiftKey ? Ci : vi, D = n();
1297
+ const P = h.shiftKey ? oo : no, A = o();
1245
1298
  let L = null;
1246
- h.key === "ArrowUp" ? L = { x: D.x, y: D.y - N } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + N } : h.key === "ArrowLeft" ? L = { x: D.x - N, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + N, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1299
+ h.key === "ArrowUp" ? L = { x: A.x, y: A.y - P } : h.key === "ArrowDown" ? L = { x: A.x, y: A.y + P } : h.key === "ArrowLeft" ? L = { x: A.x - P, y: A.y } : h.key === "ArrowRight" && (L = { x: A.x + P, y: A.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1300
+ };
1301
+ return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", z), t.addEventListener("pointercancel", _), t.addEventListener("click", g, !0), n.addEventListener("keydown", b), () => {
1302
+ t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", z), t.removeEventListener("pointercancel", _), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", b);
1303
+ };
1304
+ }
1305
+ function Zi({
1306
+ root: e,
1307
+ handles: t,
1308
+ getBounds: n,
1309
+ setBounds: o,
1310
+ persist: i
1311
+ }) {
1312
+ let r = null, l = null, p = null, d = null, c = !1;
1313
+ const u = () => {
1314
+ r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1315
+ }, m = (g) => {
1316
+ const b = g.currentTarget, h = b.dataset.resizeDirection;
1317
+ !e.classList.contains("pluno-pa-widget--open") || !An(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, b.setPointerCapture?.(g.pointerId));
1318
+ }, k = (g) => {
1319
+ if (r !== g.pointerId || !l || !p || !d)
1320
+ return;
1321
+ g.preventDefault(), g.stopPropagation();
1322
+ const b = g.clientX - p.x, h = g.clientY - p.y;
1323
+ !c && Math.hypot(b, h) < jt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1324
+ Nn(d, l, b, h)
1325
+ ));
1326
+ }, v = (g) => {
1327
+ r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1328
+ }, z = (g) => {
1329
+ r === g.pointerId && (g.preventDefault(), u());
1330
+ }, _ = (g) => {
1331
+ const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? oo : no, A = n();
1332
+ let L = 0, F = 0;
1333
+ An(h) && (g.key === "ArrowLeft" ? L = -P : g.key === "ArrowRight" ? L = P : g.key === "ArrowUp" ? F = -P : g.key === "ArrowDown" && (F = P), !(L === 0 && F === 0) && (g.preventDefault(), g.stopPropagation(), o(Nn(A, h, L, F)), i()));
1247
1334
  };
1248
- return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", w), t.addEventListener("pointerup", H), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
1249
- t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", w), t.removeEventListener("pointerup", H), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
1335
+ for (const g of t)
1336
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", _);
1337
+ return () => {
1338
+ for (const g of t)
1339
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", _);
1250
1340
  };
1251
1341
  }
1252
- function it(e, t = !0) {
1253
- const o = ne();
1342
+ function An(e) {
1343
+ return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1344
+ }
1345
+ function Nn(e, t, n, o) {
1346
+ const i = Y(), r = Tn({
1347
+ leading: e.position.x,
1348
+ length: e.size.width,
1349
+ delta: n,
1350
+ resizeLeading: t.endsWith("left") || t === "left",
1351
+ resizeTrailing: t.endsWith("right") || t === "right",
1352
+ minLeading: I,
1353
+ maxTrailing: i.width - I,
1354
+ minLength: Math.min(
1355
+ Jt,
1356
+ i.width - I * 2
1357
+ )
1358
+ }), l = Tn({
1359
+ leading: e.position.y,
1360
+ length: e.size.height,
1361
+ delta: o,
1362
+ resizeLeading: t.startsWith("top") || t === "top",
1363
+ resizeTrailing: t.startsWith("bottom") || t === "bottom",
1364
+ minLeading: Ce,
1365
+ maxTrailing: i.height - I,
1366
+ minLength: Math.min(
1367
+ Qt,
1368
+ i.height - Ce - I
1369
+ )
1370
+ });
1371
+ return {
1372
+ position: { x: r.leading, y: l.leading },
1373
+ size: { width: r.length, height: l.length }
1374
+ };
1375
+ }
1376
+ function Tn({
1377
+ leading: e,
1378
+ length: t,
1379
+ delta: n,
1380
+ resizeLeading: o,
1381
+ resizeTrailing: i,
1382
+ minLeading: r,
1383
+ maxTrailing: l,
1384
+ minLength: p
1385
+ }) {
1386
+ const d = e + t;
1387
+ if (o) {
1388
+ const c = e + n;
1389
+ if (c >= r) {
1390
+ const m = K(c, r, d - p);
1391
+ return { leading: m, length: d - m };
1392
+ }
1393
+ const u = K(
1394
+ d + r - c,
1395
+ d,
1396
+ l
1397
+ );
1398
+ return { leading: r, length: u - r };
1399
+ }
1400
+ if (i) {
1401
+ const c = d + n;
1402
+ if (c <= l) {
1403
+ const m = K(
1404
+ c,
1405
+ e + p,
1406
+ l
1407
+ );
1408
+ return { leading: e, length: m - e };
1409
+ }
1410
+ const u = K(
1411
+ e - (c - l),
1412
+ r,
1413
+ e
1414
+ );
1415
+ return { leading: u, length: l - u };
1416
+ }
1417
+ return { leading: e, length: t };
1418
+ }
1419
+ function dt(e, t = !0) {
1420
+ const n = Y();
1254
1421
  if (e.classList.contains("pluno-pa-widget--minimized"))
1255
1422
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1256
- width: si,
1257
- height: di
1258
- } : { width: dn, height: dn };
1259
- const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1423
+ width: Ni,
1424
+ height: Ti
1425
+ } : { width: En, height: En };
1426
+ const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1260
1427
  return {
1261
- width: t && i && n.width > 0 ? n.width : Math.min(Bn, o.width - 36),
1262
- height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? ui : Fn
1428
+ width: t && i && o.width > 0 ? o.width : Math.min(Qn, n.width - 36),
1429
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Ri : eo
1263
1430
  };
1264
1431
  }
1265
- function $n() {
1266
- const e = ne();
1432
+ function Ji() {
1433
+ const e = Y();
1267
1434
  return {
1268
1435
  width: Math.min(
1269
- Te(
1270
- e.width * mi,
1271
- gi,
1272
- hi
1436
+ K(
1437
+ e.width * Mi,
1438
+ Jt,
1439
+ zi
1273
1440
  ),
1274
- e.width - W * 2
1441
+ e.width - I * 2
1275
1442
  ),
1276
1443
  height: Math.min(
1277
- Te(
1278
- e.height * bi,
1279
- fi,
1280
- wi
1444
+ K(
1445
+ e.height * Bi,
1446
+ Qt,
1447
+ Oi
1448
+ ),
1449
+ e.height - Ce - I
1450
+ )
1451
+ };
1452
+ }
1453
+ function Re(e = null) {
1454
+ return e ? ut(e) : Ji();
1455
+ }
1456
+ function ut(e) {
1457
+ const t = Y();
1458
+ return {
1459
+ width: K(
1460
+ e.width,
1461
+ Math.min(
1462
+ Jt,
1463
+ t.width - I * 2
1281
1464
  ),
1282
- e.height - Pt - W
1465
+ Math.max(
1466
+ I,
1467
+ t.width - I * 2
1468
+ )
1469
+ ),
1470
+ height: K(
1471
+ e.height,
1472
+ Math.min(
1473
+ Qt,
1474
+ t.height - Ce - I
1475
+ ),
1476
+ Math.max(
1477
+ I,
1478
+ t.height - Ce - I
1479
+ )
1283
1480
  )
1284
1481
  };
1285
1482
  }
1286
- function Pi(e, t, o) {
1287
- const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1288
- if (Number.isFinite(n) && Number.isFinite(i))
1289
- return { x: n, y: i };
1483
+ function Nt(e, t) {
1484
+ if (!t) {
1485
+ e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1486
+ return;
1487
+ }
1488
+ const n = ut(t);
1489
+ e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1490
+ }
1491
+ function Qi(e, t, n) {
1492
+ const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1493
+ if (Number.isFinite(o) && Number.isFinite(i))
1494
+ return { x: o, y: i };
1290
1495
  const r = e.getBoundingClientRect();
1291
1496
  if (r.width > 0 || r.height > 0)
1292
1497
  return { x: r.left, y: r.top };
1293
- const l = ne();
1498
+ const l = Y();
1294
1499
  return {
1295
- x: t === "bottom-left" ? 26 : l.width - 26 - o.width,
1296
- y: l.height - 24 - o.height
1500
+ x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1501
+ y: l.height - 24 - n.height
1297
1502
  };
1298
1503
  }
1299
- function Ct(e, t, o) {
1300
- const n = it(e, !1);
1301
- return t ? Dt(
1504
+ function Tt(e, t, n) {
1505
+ const o = dt(e, !1);
1506
+ return t ? Vt(
1302
1507
  e,
1303
- qn(t, n),
1304
- n
1305
- ) : Di(o === "bottom-left" ? "bottom-left" : "bottom-right", n, ci);
1508
+ ro(t, o),
1509
+ o
1510
+ ) : ea(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Di);
1306
1511
  }
1307
- function Di(e, t, o) {
1308
- const n = ne();
1512
+ function ea(e, t, n) {
1513
+ const o = Y();
1309
1514
  return {
1310
- x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
1311
- y: e.startsWith("bottom") ? Math.max(0, n.height - t.height - o) : o
1515
+ x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1516
+ y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1312
1517
  };
1313
1518
  }
1314
- function Dt(e, t, o) {
1315
- const n = ne(), i = W + zi(e);
1519
+ function Vt(e, t, n) {
1520
+ const o = Y(), i = I + oa(e);
1316
1521
  return {
1317
- x: Te(
1522
+ x: K(
1318
1523
  t.x,
1319
- W,
1524
+ I,
1320
1525
  Math.max(
1321
- W,
1322
- n.width - o.width - W
1526
+ I,
1527
+ o.width - n.width - I
1323
1528
  )
1324
1529
  ),
1325
- y: Te(
1530
+ y: K(
1326
1531
  t.y,
1327
1532
  i,
1328
1533
  Math.max(
1329
1534
  i,
1330
- n.height - o.height - W
1535
+ o.height - n.height - I
1331
1536
  )
1332
1537
  )
1333
1538
  };
1334
1539
  }
1335
- function qn(e, t) {
1336
- const o = ne();
1540
+ function ro(e, t) {
1541
+ const n = Y();
1337
1542
  return {
1338
- x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
1339
- y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
1543
+ x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1544
+ y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1340
1545
  };
1341
1546
  }
1342
- function Ri(e, t) {
1343
- const o = Mi(e, t), n = ne();
1547
+ function ta(e, t) {
1548
+ const n = na(e, t), o = Y();
1344
1549
  return {
1345
- anchor: o,
1346
- x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
1347
- y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
1550
+ anchor: n,
1551
+ x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1552
+ y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1348
1553
  };
1349
1554
  }
1350
- function Mi(e, t) {
1351
- const o = ne(), n = e.x + t.width / 2, r = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
1555
+ function na(e, t) {
1556
+ const n = Y(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1352
1557
  return `${r}-${l}`;
1353
1558
  }
1354
- function zi(e) {
1355
- return e.classList.contains("pluno-pa-widget--scribble") ? yi : xi;
1559
+ function oa(e) {
1560
+ return e.classList.contains("pluno-pa-widget--scribble") ? Wi : Hi;
1356
1561
  }
1357
- function bn(e, t, o) {
1358
- const n = it(e), i = $n(), r = {
1359
- x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
1360
- y: t.y + n.height - i.height
1562
+ function Dt(e, t, n, o = null) {
1563
+ const i = dt(e), r = Re(o), l = {
1564
+ x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1565
+ y: t.y + i.height - r.height
1361
1566
  };
1362
- return Oi(r);
1567
+ return lt(l, r);
1363
1568
  }
1364
- function Oi(e) {
1365
- const t = ne(), o = $n();
1569
+ function lt(e, t) {
1570
+ const n = Y();
1366
1571
  return {
1367
- x: Te(
1572
+ x: K(
1368
1573
  e.x,
1369
- W,
1574
+ I,
1370
1575
  Math.max(
1371
- W,
1372
- t.width - o.width - W
1576
+ I,
1577
+ n.width - t.width - I
1373
1578
  )
1374
1579
  ),
1375
- y: Te(
1580
+ y: K(
1376
1581
  e.y,
1377
- Pt,
1582
+ Ce,
1378
1583
  Math.max(
1379
- Pt,
1380
- t.height - o.height - W
1584
+ Ce,
1585
+ n.height - t.height - I
1381
1586
  )
1382
1587
  )
1383
1588
  };
1384
1589
  }
1385
- function xe(e, t) {
1590
+ function ve(e, t) {
1386
1591
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1387
1592
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1388
1593
  return;
1389
1594
  }
1390
1595
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1391
1596
  }
1392
- function Ui(e, t) {
1597
+ function ia(e, t) {
1393
1598
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1394
1599
  }
1395
- function _n(e) {
1600
+ function Dn(e) {
1396
1601
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1397
1602
  }
1398
- function ne() {
1603
+ function Y() {
1399
1604
  return {
1400
- width: window.innerWidth || document.documentElement.clientWidth || Bn + W * 2,
1401
- height: window.innerHeight || document.documentElement.clientHeight || Fn + W * 2
1605
+ width: window.innerWidth || document.documentElement.clientWidth || Qn + I * 2,
1606
+ height: window.innerHeight || document.documentElement.clientHeight || eo + I * 2
1402
1607
  };
1403
1608
  }
1404
- function St(e) {
1609
+ function Rt(e) {
1405
1610
  const t = e.getBoundingClientRect();
1406
1611
  return {
1407
1612
  x: Math.round(t.x),
@@ -1410,57 +1615,57 @@ function St(e) {
1410
1615
  height: Math.round(t.height)
1411
1616
  };
1412
1617
  }
1413
- function Te(e, t, o) {
1414
- return Math.min(Math.max(e, t), o);
1618
+ function K(e, t, n) {
1619
+ return Math.min(Math.max(e, t), n);
1415
1620
  }
1416
- function K(e, t, o) {
1621
+ function J(e, t, n) {
1417
1622
  if (typeof window > "u")
1418
1623
  return;
1419
- const n = window, i = {
1624
+ const o = window, i = {
1420
1625
  at: (/* @__PURE__ */ new Date()).toISOString(),
1421
1626
  source: e,
1422
1627
  message: t,
1423
- details: o
1424
- }, r = n.__plunoProductAgentDiagnostics__ ?? [];
1425
- r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1426
- new CustomEvent(ni, { detail: i })
1628
+ details: n
1629
+ }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1630
+ r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1631
+ new CustomEvent(Si, { detail: i })
1427
1632
  );
1428
1633
  }
1429
- function Bi(e, t) {
1430
- K("web-sdk.widget.position", e, t);
1634
+ function aa(e, t) {
1635
+ J("web-sdk.widget.position", e, t);
1431
1636
  }
1432
- function Et(e, t, o) {
1433
- const n = t.value.trim();
1434
- return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
1435
- attachments: o.length > 0 ? o.map(Wi) : void 0
1637
+ function zt(e, t, n) {
1638
+ const o = t.value.trim();
1639
+ return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1640
+ attachments: n.length > 0 ? n.map(pa) : void 0
1436
1641
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1437
1642
  }
1438
- function Fi(e, t, o) {
1439
- const n = e.activeElement;
1440
- return n === o ? "composer" : n === t ? "launcher" : null;
1643
+ function ra(e, t, n) {
1644
+ const o = e.activeElement;
1645
+ return o === n ? "composer" : o === t ? "launcher" : null;
1441
1646
  }
1442
- function Hi(e, t, o, n) {
1443
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Vo)
1647
+ function la(e, t, n, o) {
1648
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > mi)
1444
1649
  return;
1445
- const i = e.focusedInput === "composer" ? n : o;
1446
- i === n && !t.classList.contains("pluno-pa-widget--open") || i === o && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1650
+ const i = e.focusedInput === "composer" ? o : n;
1651
+ i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1447
1652
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1448
1653
  });
1449
1654
  }
1450
- function Wi(e) {
1655
+ function pa(e) {
1451
1656
  return e;
1452
1657
  }
1453
- function He(e) {
1658
+ function je(e) {
1454
1659
  e.style.height = "0px";
1455
1660
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1456
1661
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1457
1662
  }
1458
- function We(e, t = () => !0) {
1663
+ function Ve(e, t = () => !0) {
1459
1664
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1460
1665
  t() && (e.scrollTop = e.scrollHeight);
1461
1666
  });
1462
1667
  }
1463
- function Gi(e) {
1668
+ function sa(e) {
1464
1669
  const t = e.messages[e.messages.length - 1];
1465
1670
  return [
1466
1671
  e.messages.length,
@@ -1471,69 +1676,69 @@ function Gi(e) {
1471
1676
  e.lastError ?? ""
1472
1677
  ].join(":");
1473
1678
  }
1474
- function $i(e) {
1679
+ function da(e) {
1475
1680
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1476
1681
  }
1477
- function qi(e) {
1682
+ function ca(e) {
1478
1683
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1479
1684
  }
1480
- function ji(e) {
1685
+ function ua(e) {
1481
1686
  const t = e.currentPage;
1482
1687
  if (typeof t?.url == "string" && t.url.trim())
1483
1688
  try {
1484
- const o = new URL(t.url);
1485
- return `${o.pathname || "/"}${o.search}`;
1689
+ const n = new URL(t.url);
1690
+ return `${n.pathname || "/"}${n.search}`;
1486
1691
  } catch {
1487
1692
  return t.url;
1488
1693
  }
1489
1694
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1490
1695
  }
1491
- function Vi(e, t) {
1492
- const o = new Date(e).getTime();
1493
- if (!Number.isFinite(o))
1696
+ function ga(e, t) {
1697
+ const n = new Date(e).getTime();
1698
+ if (!Number.isFinite(n))
1494
1699
  return "now";
1495
- const n = Math.max(0, t - o), i = [
1700
+ const o = Math.max(0, t - n), i = [
1496
1701
  ["day", 864e5],
1497
1702
  ["hour", 36e5],
1498
1703
  ["min", 6e4]
1499
1704
  ];
1500
1705
  for (const [r, l] of i)
1501
- if (n >= l) {
1502
- const p = Math.max(1, Math.floor(n / l));
1706
+ if (o >= l) {
1707
+ const p = Math.max(1, Math.floor(o / l));
1503
1708
  return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1504
1709
  }
1505
1710
  return "now";
1506
1711
  }
1507
- function Ki(e, t, o, n, i) {
1508
- e.appendChild(oa()), e.appendChild(
1509
- Yi(
1712
+ function ha(e, t, n, o, i) {
1713
+ e.appendChild(Ca()), e.appendChild(
1714
+ ma(
1510
1715
  t,
1511
- o,
1512
1716
  n,
1717
+ o,
1513
1718
  i
1514
1719
  )
1515
1720
  ), e.appendChild(
1516
- rt(
1721
+ gt(
1517
1722
  "pluno-pa-widget__close",
1518
1723
  "Close",
1519
- ia(16),
1724
+ Sa(16),
1520
1725
  !0
1521
1726
  )
1522
- ), e.appendChild(Xi(o));
1727
+ ), e.appendChild(fa(n));
1523
1728
  }
1524
- function Yi(e, t, o, n) {
1729
+ function ma(e, t, n, o) {
1525
1730
  const i = document.createElement("form");
1526
- if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
1731
+ if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1527
1732
  const d = document.createElement("button");
1528
1733
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
1529
1734
  }
1530
1735
  i.appendChild(
1531
- Yn(
1736
+ co(
1532
1737
  "pluno-pa-widget__scribble-spirals--launcher",
1533
1738
  10
1534
1739
  )
1535
1740
  ), i.appendChild(
1536
- de(
1741
+ me(
1537
1742
  "pluno-pa-widget__character--launcher",
1538
1743
  t
1539
1744
  )
@@ -1542,136 +1747,155 @@ function Yi(e, t, o, n) {
1542
1747
  r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1543
1748
  const l = document.createElement("input");
1544
1749
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1545
- const p = at("Working...");
1546
- if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), n) {
1750
+ const p = ct("Working...");
1751
+ if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1547
1752
  const d = document.createElement("button");
1548
1753
  d.type = "button", d.className = "pluno-pa-widget__launcher-minimize", d.textContent = "-", d.setAttribute("aria-label", "Minimize Pluno on this site"), d.title = "Minimize Pluno on this site", i.appendChild(d);
1549
1754
  }
1550
1755
  return i;
1551
1756
  }
1552
- function Xi(e) {
1757
+ function fa(e) {
1553
1758
  const t = document.createElement("section");
1554
1759
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1555
- Yn("pluno-pa-widget__scribble-spirals--panel", 16)
1760
+ co("pluno-pa-widget__scribble-spirals--panel", 16)
1556
1761
  );
1557
- const o = document.createElement("div");
1558
- o.className = "pluno-pa-widget__timeline-wrap";
1559
- const n = document.createElement("main");
1560
- n.className = "pluno-pa-widget__timeline", n.appendChild(ea(e));
1762
+ const n = document.createElement("div");
1763
+ n.className = "pluno-pa-widget__timeline-wrap";
1764
+ const o = document.createElement("main");
1765
+ o.className = "pluno-pa-widget__timeline", o.appendChild(xa(e));
1561
1766
  const i = document.createElement("div");
1562
- i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
1767
+ i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1563
1768
  const r = document.createElement("div");
1564
- r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, o.appendChild(r);
1769
+ r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, n.appendChild(r);
1565
1770
  const l = document.createElement("button");
1566
- l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
1771
+ l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1567
1772
  const p = document.createElement("div");
1568
1773
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1569
- rt(
1774
+ gt(
1570
1775
  "pluno-pa-widget__history",
1571
- Rt(),
1572
- ra(),
1776
+ Kt(),
1777
+ ka(),
1573
1778
  !0
1574
1779
  )
1575
- ), o.appendChild(p), o.appendChild(Qi()), t.appendChild(o), t.appendChild(Zi()), t.appendChild(Ji()), t;
1780
+ ), n.appendChild(p), n.appendChild(_a()), t.appendChild(n), t.appendChild(wa()), t.appendChild(ba()), t.appendChild(he("left", "Resize Pluno from left")), t.appendChild(
1781
+ he("right", "Resize Pluno from right")
1782
+ ), t.appendChild(he("top", "Resize Pluno from top")), t.appendChild(
1783
+ he("bottom", "Resize Pluno from bottom")
1784
+ ), t.appendChild(
1785
+ he("top-left", "Resize Pluno from top left")
1786
+ ), t.appendChild(
1787
+ he("top-right", "Resize Pluno from top right")
1788
+ ), t.appendChild(
1789
+ he("bottom-left", "Resize Pluno from bottom left")
1790
+ ), t.appendChild(
1791
+ he("bottom-right", "Resize Pluno from bottom right")
1792
+ ), t;
1576
1793
  }
1577
- function Zi() {
1794
+ function he(e, t) {
1795
+ const n = document.createElement("button");
1796
+ return n.type = "button", n.className = [
1797
+ "pluno-pa-widget__resize-handle",
1798
+ `pluno-pa-widget__resize-handle--${e}`
1799
+ ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1800
+ }
1801
+ function wa() {
1578
1802
  const e = document.createElement("div");
1579
1803
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1580
1804
  const t = document.createElement("span");
1581
1805
  t.className = "pluno-pa-widget__notify-suggestion-label", t.textContent = "This may take a moment. Get notified when it's done?";
1582
- const o = document.createElement("div");
1583
- o.className = "pluno-pa-widget__notify-suggestion-actions";
1584
- const n = document.createElement("button");
1585
- n.type = "button", n.className = "pluno-pa-widget__notify-suggestion-enable", n.textContent = "Notify me";
1806
+ const n = document.createElement("div");
1807
+ n.className = "pluno-pa-widget__notify-suggestion-actions";
1808
+ const o = document.createElement("button");
1809
+ o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
1586
1810
  const i = document.createElement("button");
1587
1811
  i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
1588
1812
  const r = document.createElement("button");
1589
- return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", o.append(n, i, r), e.append(t, o), e;
1813
+ return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
1590
1814
  }
1591
- function Ji() {
1815
+ function ba() {
1592
1816
  const e = document.createElement("form");
1593
1817
  e.className = "pluno-pa-widget__composer";
1594
1818
  const t = document.createElement("div");
1595
1819
  t.className = "pluno-pa-widget__billing-status", t.hidden = !0, e.appendChild(t);
1596
- const o = document.createElement("div");
1597
- o.className = "pluno-pa-widget__attachment-error", o.hidden = !0, e.appendChild(o);
1598
1820
  const n = document.createElement("div");
1599
- n.className = "pluno-pa-widget__attachments", n.hidden = !0, e.appendChild(n);
1821
+ n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, e.appendChild(n);
1822
+ const o = document.createElement("div");
1823
+ o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1600
1824
  const i = document.createElement("div");
1601
1825
  i.className = "pluno-pa-widget__composer-inner";
1602
1826
  const r = document.createElement("input");
1603
1827
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1604
1828
  const l = document.createElement("button");
1605
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(pa()), l.appendChild(sa()), i.appendChild(l);
1829
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Pa()), l.appendChild(Ia()), i.appendChild(l);
1606
1830
  const p = document.createElement("textarea");
1607
1831
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1608
1832
  const d = document.createElement("button");
1609
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(Xn()), i.appendChild(d), e.appendChild(i);
1610
- const u = document.createElement("div");
1611
- u.className = "pluno-pa-widget__composer-meta";
1612
- const c = document.createElement("a");
1613
- c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.", u.appendChild(c);
1614
- const g = document.createElement("span");
1615
- return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(g), e.appendChild(u), e;
1833
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(go()), i.appendChild(d), e.appendChild(i);
1834
+ const c = document.createElement("div");
1835
+ c.className = "pluno-pa-widget__composer-meta";
1836
+ const u = document.createElement("a");
1837
+ u.className = "pluno-pa-widget__powered-by", u.href = "https://pluno.ai", u.target = "_blank", u.rel = "noopener noreferrer", u.textContent = "Powered by Pluno.ai.", c.appendChild(u);
1838
+ const m = document.createElement("span");
1839
+ return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1616
1840
  }
1617
- function Rt() {
1841
+ function Kt() {
1618
1842
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1619
1843
  }
1620
- function Qi() {
1844
+ function _a() {
1621
1845
  const e = document.createElement("section");
1622
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Rt());
1846
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Kt());
1623
1847
  const t = document.createElement("div");
1624
1848
  t.className = "pluno-pa-widget__history-header";
1625
- const o = document.createElement("strong");
1626
- o.textContent = Rt();
1627
- const n = rt(
1849
+ const n = document.createElement("strong");
1850
+ n.textContent = Kt();
1851
+ const o = gt(
1628
1852
  "pluno-pa-widget__history-close",
1629
1853
  "Close recent chats",
1630
- la(),
1854
+ La(),
1631
1855
  !1
1632
1856
  );
1633
- t.append(o, n);
1857
+ t.append(n, o);
1634
1858
  const i = document.createElement("div");
1635
1859
  i.className = "pluno-pa-widget__history-list";
1636
1860
  const r = document.createElement("p");
1637
1861
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1638
1862
  }
1639
- function ea(e) {
1863
+ function xa(e) {
1640
1864
  const t = document.createElement("div");
1641
1865
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1642
- de(
1866
+ me(
1643
1867
  "pluno-pa-widget__character--empty",
1644
1868
  e
1645
1869
  )
1646
- ), t.appendChild(jn()), t;
1870
+ ), t.appendChild(lo()), t;
1647
1871
  }
1648
- function jn() {
1872
+ function lo() {
1649
1873
  const e = document.createElement("div");
1650
1874
  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;
1651
1875
  }
1652
- function Vn(e, t) {
1876
+ function po(e, t) {
1653
1877
  e.replaceChildren(), e.setAttribute(
1654
1878
  "aria-label",
1655
1879
  `${t.toLocaleString("en-US")} users currently active`
1656
1880
  );
1657
- const o = document.createElement("span");
1658
- o.className = "pluno-pa-widget__active-users-counter-dot", o.setAttribute("aria-hidden", "true"), e.appendChild(o), e.appendChild(
1881
+ const n = document.createElement("span");
1882
+ n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(
1659
1883
  document.createTextNode(
1660
1884
  `${t.toLocaleString("en-US")} users currently active`
1661
1885
  )
1662
1886
  );
1663
1887
  }
1664
- function de(e, t) {
1665
- const o = `pluno-pa-character-${mn}`;
1666
- mn += 1;
1667
- const n = t.scribbleStyle ? na(t.accentColor, o) : ta(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1668
- return n.setAttribute(
1888
+ function me(e, t) {
1889
+ const n = `pluno-pa-character-${Ln}`;
1890
+ Ln += 1;
1891
+ const o = t.scribbleStyle ? va(t.accentColor, n) : ya(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1892
+ return o.setAttribute(
1669
1893
  "class",
1670
1894
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1671
- ), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
1895
+ ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1672
1896
  }
1673
- function ta(e, t) {
1674
- const o = Lo(e), n = {
1897
+ function ya(e, t) {
1898
+ const n = Yo(e), o = {
1675
1899
  boltFill: `${t}-boltFill`,
1676
1900
  boltEdge: `${t}-boltEdge`,
1677
1901
  boltGlow: `${t}-boltGlow`,
@@ -1682,171 +1906,171 @@ function ta(e, t) {
1682
1906
  eyeShadow: `${t}-eyeShadow`,
1683
1907
  pupilGloss: `${t}-pupilGloss`,
1684
1908
  boltClip: `${t}-boltClip`
1685
- }, i = Kn(), r = m(i, "defs"), l = m(r, "linearGradient", {
1686
- id: n.boltFill,
1909
+ }, i = so(), r = f(i, "defs"), l = f(r, "linearGradient", {
1910
+ id: o.boltFill,
1687
1911
  x1: "420",
1688
1912
  y1: "180",
1689
1913
  x2: "790",
1690
1914
  y2: "1040",
1691
1915
  gradientUnits: "userSpaceOnUse"
1692
1916
  });
1693
- M(l, "0", o.top), M(l, "0.36", o.middle), M(l, "0.72", o.bottom), M(l, "1", o.bottom);
1694
- const p = m(r, "linearGradient", {
1695
- id: n.boltEdge,
1917
+ O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1918
+ const p = f(r, "linearGradient", {
1919
+ id: o.boltEdge,
1696
1920
  x1: "470",
1697
1921
  y1: "145",
1698
1922
  x2: "900",
1699
1923
  y2: "980",
1700
1924
  gradientUnits: "userSpaceOnUse"
1701
1925
  });
1702
- M(p, "0", o.edgeStart), M(p, "0.32", o.edgeMiddle), M(p, "0.78", o.edgeEnd), M(p, "1", o.edgeEnd);
1703
- const d = m(r, "radialGradient", {
1704
- id: n.boltGlow,
1926
+ O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1927
+ const d = f(r, "radialGradient", {
1928
+ id: o.boltGlow,
1705
1929
  cx: "50%",
1706
1930
  cy: "22%",
1707
1931
  r: "82%"
1708
1932
  });
1709
- M(d, "0", o.glow, "0.72"), M(d, "0.5", o.middle, "0.44"), M(d, "1", o.bottom, "0");
1710
- const u = m(r, "radialGradient", {
1711
- id: n.eyeWhite,
1933
+ O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1934
+ const c = f(r, "radialGradient", {
1935
+ id: o.eyeWhite,
1712
1936
  cx: "35%",
1713
1937
  cy: "25%",
1714
1938
  r: "70%"
1715
1939
  });
1716
- M(u, "0", "#ffffff"), M(u, "0.72", "#ffffff"), M(u, "1", "#e5e5e5");
1717
- const c = m(r, "radialGradient", {
1718
- id: n.pupil,
1940
+ O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1941
+ const u = f(r, "radialGradient", {
1942
+ id: o.pupil,
1719
1943
  cx: "42%",
1720
1944
  cy: "38%",
1721
1945
  r: "65%"
1722
1946
  });
1723
- M(c, "0", "#2a1f10"), M(c, "0.52", "#080604"), M(c, "1", "#000000");
1724
- const g = m(r, "filter", {
1725
- id: n.softDropShadow,
1947
+ O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1948
+ const m = f(r, "filter", {
1949
+ id: o.softDropShadow,
1726
1950
  x: "-18%",
1727
1951
  y: "-12%",
1728
1952
  width: "136%",
1729
1953
  height: "136%",
1730
1954
  "color-interpolation-filters": "sRGB"
1731
1955
  });
1732
- m(g, "feDropShadow", {
1956
+ f(m, "feDropShadow", {
1733
1957
  dx: "0",
1734
1958
  dy: "12",
1735
1959
  stdDeviation: "18",
1736
- "flood-color": o.shadow,
1960
+ "flood-color": n.shadow,
1737
1961
  "flood-opacity": "0.24"
1738
1962
  });
1739
- const S = m(r, "filter", {
1740
- id: n.innerDepth,
1963
+ const k = f(r, "filter", {
1964
+ id: o.innerDepth,
1741
1965
  x: "-8%",
1742
1966
  y: "-8%",
1743
1967
  width: "116%",
1744
1968
  height: "116%",
1745
1969
  "color-interpolation-filters": "sRGB"
1746
1970
  });
1747
- m(S, "feGaussianBlur", {
1971
+ f(k, "feGaussianBlur", {
1748
1972
  in: "SourceAlpha",
1749
1973
  stdDeviation: "8",
1750
1974
  result: "blur"
1751
- }), m(S, "feOffset", {
1975
+ }), f(k, "feOffset", {
1752
1976
  dx: "-7",
1753
1977
  dy: "-9",
1754
1978
  result: "topLeft"
1755
- }), m(S, "feComposite", {
1979
+ }), f(k, "feComposite", {
1756
1980
  in: "topLeft",
1757
1981
  in2: "SourceAlpha",
1758
1982
  operator: "arithmetic",
1759
1983
  k2: "-1",
1760
1984
  k3: "1",
1761
1985
  result: "innerShadow"
1762
- }), m(S, "feColorMatrix", {
1986
+ }), f(k, "feColorMatrix", {
1763
1987
  in: "innerShadow",
1764
1988
  type: "matrix",
1765
1989
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1766
1990
  result: "innerLight"
1767
- }), m(S, "feBlend", {
1991
+ }), f(k, "feBlend", {
1768
1992
  in: "SourceGraphic",
1769
1993
  in2: "innerLight",
1770
1994
  mode: "screen"
1771
1995
  });
1772
- const w = m(r, "filter", {
1773
- id: n.eyeShadow,
1996
+ const v = f(r, "filter", {
1997
+ id: o.eyeShadow,
1774
1998
  x: "-24%",
1775
1999
  y: "-20%",
1776
2000
  width: "148%",
1777
2001
  height: "148%",
1778
2002
  "color-interpolation-filters": "sRGB"
1779
2003
  });
1780
- m(w, "feDropShadow", {
2004
+ f(v, "feDropShadow", {
1781
2005
  dx: "0",
1782
2006
  dy: "8",
1783
2007
  stdDeviation: "5",
1784
- "flood-color": o.shadow,
2008
+ "flood-color": n.shadow,
1785
2009
  "flood-opacity": "0.3"
1786
2010
  });
1787
- const H = m(r, "filter", {
1788
- id: n.pupilGloss,
2011
+ const z = f(r, "filter", {
2012
+ id: o.pupilGloss,
1789
2013
  x: "-15%",
1790
2014
  y: "-15%",
1791
2015
  width: "130%",
1792
2016
  height: "130%",
1793
2017
  "color-interpolation-filters": "sRGB"
1794
2018
  });
1795
- m(H, "feDropShadow", {
2019
+ f(z, "feDropShadow", {
1796
2020
  dx: "0",
1797
2021
  dy: "3",
1798
2022
  stdDeviation: "3",
1799
2023
  "flood-color": "#000000",
1800
2024
  "flood-opacity": "0.22"
1801
2025
  });
1802
- const k = m(r, "clipPath", { id: n.boltClip });
1803
- m(k, "path", { d: nt });
1804
- const y = m(i, "g", {
1805
- filter: j(n.softDropShadow)
2026
+ const _ = f(r, "clipPath", { id: o.boltClip });
2027
+ f(_, "path", { d: pt });
2028
+ const g = f(i, "g", {
2029
+ filter: V(o.softDropShadow)
1806
2030
  });
1807
- m(y, "path", {
1808
- d: nt,
1809
- fill: j(n.boltEdge)
2031
+ f(g, "path", {
2032
+ d: pt,
2033
+ fill: V(o.boltEdge)
1810
2034
  });
1811
- const v = "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";
1812
- m(y, "path", {
1813
- d: v,
1814
- fill: j(n.boltFill),
1815
- filter: j(n.innerDepth)
1816
- }), m(y, "path", {
1817
- d: v,
1818
- fill: j(n.boltGlow),
2035
+ const b = "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";
2036
+ f(g, "path", {
2037
+ d: b,
2038
+ fill: V(o.boltFill),
2039
+ filter: V(o.innerDepth)
2040
+ }), f(g, "path", {
2041
+ d: b,
2042
+ fill: V(o.boltGlow),
1819
2043
  opacity: "0.74"
1820
2044
  });
1821
- const h = m(y, "g", {
1822
- "clip-path": j(n.boltClip),
2045
+ const h = f(g, "g", {
2046
+ "clip-path": V(o.boltClip),
1823
2047
  opacity: "0.42"
1824
2048
  });
1825
- m(h, "path", {
2049
+ f(h, "path", {
1826
2050
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
1827
2051
  fill: "none",
1828
- stroke: o.highlight,
2052
+ stroke: n.highlight,
1829
2053
  "stroke-width": "22",
1830
2054
  "stroke-linecap": "round",
1831
2055
  opacity: "0.65"
1832
- }), m(h, "path", {
2056
+ }), f(h, "path", {
1833
2057
  d: "M556 685 L501 994",
1834
2058
  fill: "none",
1835
- stroke: o.highlight,
2059
+ stroke: n.highlight,
1836
2060
  "stroke-width": "20",
1837
2061
  "stroke-linecap": "round",
1838
2062
  opacity: "0.55"
1839
- }), m(h, "path", {
2063
+ }), f(h, "path", {
1840
2064
  d: "M858 160 C882 166 893 181 883 204",
1841
2065
  fill: "none",
1842
- stroke: o.inner,
2066
+ stroke: n.inner,
1843
2067
  "stroke-width": "18",
1844
2068
  "stroke-linecap": "round",
1845
2069
  opacity: "0.48"
1846
2070
  });
1847
- const N = m(i, "g", { filter: j(n.eyeShadow) });
1848
- return xn(
1849
- N,
2071
+ const P = f(i, "g", { filter: V(o.eyeShadow) });
2072
+ return Rn(
2073
+ P,
1850
2074
  "rotate(-2 528 463)",
1851
2075
  "528",
1852
2076
  "463",
@@ -1854,9 +2078,9 @@ function ta(e, t) {
1854
2078
  "473",
1855
2079
  "557",
1856
2080
  "447",
1857
- n
1858
- ), xn(
1859
- N,
2081
+ o
2082
+ ), Rn(
2083
+ P,
1860
2084
  "rotate(2 717 462)",
1861
2085
  "717",
1862
2086
  "462",
@@ -1864,55 +2088,55 @@ function ta(e, t) {
1864
2088
  "473",
1865
2089
  "728",
1866
2090
  "447",
1867
- n
2091
+ o
1868
2092
  ), i;
1869
2093
  }
1870
- function na(e, t) {
1871
- const o = Rn(e), n = {
2094
+ function va(e, t) {
2095
+ const n = Kn(e), o = {
1872
2096
  clip: `${t}-scribbleBoltClip`,
1873
2097
  wobble: `${t}-scribbleBoltWobble`
1874
- }, i = Kn(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
1875
- m(l, "path", { d: nt });
1876
- const p = m(r, "filter", {
1877
- id: n.wobble,
2098
+ }, i = so(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2099
+ f(l, "path", { d: pt });
2100
+ const p = f(r, "filter", {
2101
+ id: o.wobble,
1878
2102
  x: "-10%",
1879
2103
  y: "-10%",
1880
2104
  width: "120%",
1881
2105
  height: "120%",
1882
2106
  "color-interpolation-filters": "sRGB"
1883
2107
  });
1884
- m(p, "feTurbulence", {
2108
+ f(p, "feTurbulence", {
1885
2109
  type: "fractalNoise",
1886
2110
  baseFrequency: "0.011",
1887
2111
  numOctaves: "3",
1888
2112
  seed: "7",
1889
2113
  result: "noise"
1890
- }), m(p, "feDisplacementMap", {
2114
+ }), f(p, "feDisplacementMap", {
1891
2115
  in: "SourceGraphic",
1892
2116
  in2: "noise",
1893
2117
  scale: "16",
1894
2118
  xChannelSelector: "R",
1895
2119
  yChannelSelector: "G"
1896
2120
  });
1897
- const d = m(i, "g", { filter: j(n.wobble) }), u = m(d, "g", {
1898
- "clip-path": j(n.clip)
2121
+ const d = f(i, "g", { filter: V(o.wobble) }), c = f(d, "g", {
2122
+ "clip-path": V(o.clip)
1899
2123
  });
1900
- return m(u, "path", {
1901
- d: ko(),
2124
+ return f(c, "path", {
2125
+ d: Ko(),
1902
2126
  fill: "none",
1903
- stroke: o,
2127
+ stroke: n,
1904
2128
  "stroke-width": "56",
1905
2129
  "stroke-linecap": "round",
1906
2130
  "stroke-linejoin": "round",
1907
2131
  opacity: "0.9",
1908
2132
  transform: "rotate(-14 627 600)"
1909
- }), m(d, "path", {
1910
- d: nt,
2133
+ }), f(d, "path", {
2134
+ d: pt,
1911
2135
  fill: "none",
1912
- stroke: ot,
2136
+ stroke: st,
1913
2137
  "stroke-width": "18",
1914
2138
  "stroke-linejoin": "round"
1915
- }), yn(
2139
+ }), zn(
1916
2140
  d,
1917
2141
  "rotate(-2 528 463)",
1918
2142
  "528",
@@ -1921,7 +2145,7 @@ function na(e, t) {
1921
2145
  "473",
1922
2146
  "557",
1923
2147
  "447"
1924
- ), yn(
2148
+ ), zn(
1925
2149
  d,
1926
2150
  "rotate(2 717 462)",
1927
2151
  "717",
@@ -1932,139 +2156,161 @@ function na(e, t) {
1932
2156
  "447"
1933
2157
  ), i;
1934
2158
  }
1935
- function Kn() {
1936
- return C("svg", {
1937
- xmlns: Hn,
2159
+ function so() {
2160
+ return E("svg", {
2161
+ xmlns: to,
1938
2162
  viewBox: "0 0 1254 1254"
1939
2163
  });
1940
2164
  }
1941
- function xn(e, t, o, n, i, r, l, p, d) {
1942
- const u = m(e, "g", { transform: t });
1943
- m(u, "ellipse", {
1944
- cx: o,
1945
- cy: n,
2165
+ function Rn(e, t, n, o, i, r, l, p, d) {
2166
+ const c = f(e, "g", { transform: t });
2167
+ f(c, "ellipse", {
2168
+ cx: n,
2169
+ cy: o,
1946
2170
  rx: "73",
1947
2171
  ry: "80",
1948
- fill: j(d.eyeWhite)
1949
- }), m(u, "ellipse", {
2172
+ fill: V(d.eyeWhite)
2173
+ }), f(c, "ellipse", {
1950
2174
  cx: i,
1951
2175
  cy: r,
1952
2176
  rx: "49",
1953
2177
  ry: "57",
1954
- fill: j(d.pupil),
1955
- filter: j(d.pupilGloss)
1956
- }), m(u, "circle", {
2178
+ fill: V(d.pupil),
2179
+ filter: V(d.pupilGloss)
2180
+ }), f(c, "circle", {
1957
2181
  cx: l,
1958
2182
  cy: p,
1959
2183
  r: "18",
1960
2184
  fill: "#ffffff"
1961
2185
  });
1962
2186
  }
1963
- function yn(e, t, o, n, i, r, l, p) {
1964
- const d = m(e, "g", { transform: t });
1965
- m(d, "ellipse", {
1966
- cx: o,
1967
- cy: n,
2187
+ function zn(e, t, n, o, i, r, l, p) {
2188
+ const d = f(e, "g", { transform: t });
2189
+ f(d, "ellipse", {
2190
+ cx: n,
2191
+ cy: o,
1968
2192
  rx: "73",
1969
2193
  ry: "80",
1970
2194
  fill: "#ffffff",
1971
- stroke: ot,
2195
+ stroke: st,
1972
2196
  "stroke-width": "13"
1973
- }), m(d, "ellipse", {
2197
+ }), f(d, "ellipse", {
1974
2198
  cx: i,
1975
2199
  cy: r,
1976
2200
  rx: "45",
1977
2201
  ry: "53",
1978
- fill: ot
1979
- }), m(d, "circle", {
2202
+ fill: st
2203
+ }), f(d, "circle", {
1980
2204
  cx: l,
1981
2205
  cy: p,
1982
2206
  r: "16",
1983
2207
  fill: "#ffffff"
1984
2208
  });
1985
2209
  }
1986
- function m(e, t, o = {}) {
1987
- const n = C(t, o);
1988
- return e.appendChild(n), n;
2210
+ function f(e, t, n = {}) {
2211
+ const o = E(t, n);
2212
+ return e.appendChild(o), o;
1989
2213
  }
1990
- function M(e, t, o, n) {
1991
- const i = { offset: t, "stop-color": o };
1992
- n !== void 0 && (i["stop-opacity"] = n), m(e, "stop", i);
2214
+ function O(e, t, n, o) {
2215
+ const i = { offset: t, "stop-color": n };
2216
+ o !== void 0 && (i["stop-opacity"] = o), f(e, "stop", i);
1993
2217
  }
1994
- function j(e) {
2218
+ function V(e) {
1995
2219
  return `url(#${e})`;
1996
2220
  }
1997
- function rt(e, t, o, n) {
2221
+ function gt(e, t, n, o) {
1998
2222
  const i = document.createElement("button");
1999
- return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
2223
+ return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2000
2224
  }
2001
- function oa() {
2002
- const e = C("svg", {
2225
+ function Ca() {
2226
+ const e = E("svg", {
2003
2227
  class: "pluno-pa-widget__scribble-defs",
2004
2228
  "aria-hidden": "true",
2005
2229
  focusable: "false",
2006
2230
  width: "0",
2007
2231
  height: "0"
2008
- }), t = C("defs");
2009
- return t.appendChild(kt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2010
- kt("pluno-pa-scribble-wobble-2", "5", "15")
2232
+ }), t = E("defs");
2233
+ return t.appendChild(Ot("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2234
+ Ot("pluno-pa-scribble-wobble-2", "5", "15")
2011
2235
  ), t.appendChild(
2012
- kt("pluno-pa-scribble-wobble-3", "9", "19")
2236
+ Ot("pluno-pa-scribble-wobble-3", "9", "19")
2013
2237
  ), e.appendChild(t), e;
2014
2238
  }
2015
- function Yn(e, t) {
2016
- const o = t * cn + un * 2, n = C("svg", {
2239
+ function co(e, t) {
2240
+ const n = E("svg", {
2017
2241
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2018
- viewBox: `0 0 ${o} ${_i}`,
2019
2242
  preserveAspectRatio: "xMidYMid meet",
2020
2243
  "aria-hidden": "true",
2021
2244
  focusable: "false"
2022
2245
  });
2023
- for (let i = 0; i < t; i += 1) {
2024
- const r = gn[i % gn.length], l = C("g", {
2025
- transform: `translate(${un + i * cn} 0)`
2246
+ return uo(n, t), n;
2247
+ }
2248
+ function Mt(e, t) {
2249
+ if (!e)
2250
+ return;
2251
+ const n = Math.max(
2252
+ 0,
2253
+ t - qt * 2
2254
+ ), o = Math.max(
2255
+ Fi,
2256
+ Math.floor(
2257
+ (n - $t * 2) / Gt
2258
+ )
2259
+ );
2260
+ uo(e, o);
2261
+ }
2262
+ function uo(e, t) {
2263
+ if (e.dataset.spiralCount === `${t}`)
2264
+ return;
2265
+ const n = t * Gt + $t * 2;
2266
+ e.dataset.spiralCount = `${t}`, e.setAttribute(
2267
+ "viewBox",
2268
+ `0 0 ${n} ${Ui}`
2269
+ ), e.replaceChildren();
2270
+ for (let o = 0; o < t; o += 1) {
2271
+ const i = kn[o % kn.length], r = E("g", {
2272
+ transform: `translate(${$t + o * Gt} 0)`
2026
2273
  });
2027
- l.appendChild(
2028
- C("ellipse", {
2029
- cx: r.ellipseCx,
2030
- cy: r.ellipseCy,
2031
- rx: r.ellipseRx,
2032
- ry: r.ellipseRy,
2274
+ r.appendChild(
2275
+ E("ellipse", {
2276
+ cx: i.ellipseCx,
2277
+ cy: i.ellipseCy,
2278
+ rx: i.ellipseRx,
2279
+ ry: i.ellipseRy,
2033
2280
  fill: "none",
2034
2281
  stroke: "#2c2a1e",
2035
- "stroke-width": r.strokeWidth,
2282
+ "stroke-width": i.strokeWidth,
2036
2283
  opacity: "0.8"
2037
2284
  })
2038
- ), l.appendChild(
2039
- C("path", {
2040
- d: r.path,
2285
+ ), r.appendChild(
2286
+ E("path", {
2287
+ d: i.path,
2041
2288
  fill: "none",
2042
2289
  stroke: "#2c2a1e",
2043
- "stroke-width": r.pathStrokeWidth,
2290
+ "stroke-width": i.pathStrokeWidth,
2044
2291
  "stroke-linecap": "round"
2045
2292
  })
2046
- ), n.appendChild(l);
2293
+ ), e.appendChild(r);
2047
2294
  }
2048
- return n;
2049
2295
  }
2050
- function kt(e, t, o) {
2051
- const n = C("filter", {
2296
+ function Ot(e, t, n) {
2297
+ const o = E("filter", {
2052
2298
  id: e,
2053
2299
  x: "-8%",
2054
2300
  y: "-8%",
2055
2301
  width: "116%",
2056
2302
  height: "116%"
2057
2303
  });
2058
- return n.appendChild(
2059
- C("feTurbulence", {
2304
+ return o.appendChild(
2305
+ E("feTurbulence", {
2060
2306
  type: "fractalNoise",
2061
2307
  baseFrequency: "0.012 0.028",
2062
2308
  numOctaves: "3",
2063
2309
  seed: t,
2064
2310
  result: "stroke-noise"
2065
2311
  })
2066
- ), n.appendChild(
2067
- C("feDisplacementMap", {
2312
+ ), o.appendChild(
2313
+ E("feDisplacementMap", {
2068
2314
  in: "SourceGraphic",
2069
2315
  in2: "stroke-noise",
2070
2316
  scale: "3.5",
@@ -2072,26 +2318,26 @@ function kt(e, t, o) {
2072
2318
  yChannelSelector: "G",
2073
2319
  result: "warped"
2074
2320
  })
2075
- ), n.appendChild(
2076
- C("feTurbulence", {
2321
+ ), o.appendChild(
2322
+ E("feTurbulence", {
2077
2323
  type: "fractalNoise",
2078
2324
  baseFrequency: "0.7",
2079
2325
  numOctaves: "1",
2080
- seed: o,
2326
+ seed: n,
2081
2327
  result: "ink-noise"
2082
2328
  })
2083
- ), n.appendChild(
2084
- C("feDisplacementMap", {
2329
+ ), o.appendChild(
2330
+ E("feDisplacementMap", {
2085
2331
  in: "warped",
2086
2332
  in2: "ink-noise",
2087
2333
  scale: "0.9",
2088
2334
  xChannelSelector: "R",
2089
2335
  yChannelSelector: "G"
2090
2336
  })
2091
- ), n;
2337
+ ), o;
2092
2338
  }
2093
- function ia(e) {
2094
- const t = oe(
2339
+ function Sa(e) {
2340
+ const t = re(
2095
2341
  "0 0 24 24",
2096
2342
  e,
2097
2343
  e,
@@ -2099,10 +2345,10 @@ function ia(e) {
2099
2345
  "currentColor",
2100
2346
  "2.25"
2101
2347
  );
2102
- return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
2348
+ return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2103
2349
  }
2104
- function aa() {
2105
- const e = oe(
2350
+ function Ea() {
2351
+ const e = re(
2106
2352
  "0 0 24 24",
2107
2353
  17,
2108
2354
  17,
@@ -2111,17 +2357,17 @@ function aa() {
2111
2357
  "2.25"
2112
2358
  );
2113
2359
  return e.appendChild(
2114
- C("path", {
2360
+ E("path", {
2115
2361
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2116
2362
  })
2117
2363
  ), e.appendChild(
2118
- C("path", {
2364
+ E("path", {
2119
2365
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2120
2366
  })
2121
2367
  ), e;
2122
2368
  }
2123
- function ra() {
2124
- const e = oe(
2369
+ function ka() {
2370
+ const e = re(
2125
2371
  "0 0 24 24",
2126
2372
  17,
2127
2373
  17,
@@ -2129,10 +2375,10 @@ function ra() {
2129
2375
  "currentColor",
2130
2376
  "2.25"
2131
2377
  );
2132
- return e.appendChild(C("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(C("path", { d: "M3 4v5h5" })), e.appendChild(C("path", { d: "M12 7v5l3 2" })), e;
2378
+ return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
2133
2379
  }
2134
- function la() {
2135
- const e = oe(
2380
+ function La() {
2381
+ const e = re(
2136
2382
  "0 0 24 24",
2137
2383
  15,
2138
2384
  15,
@@ -2140,10 +2386,10 @@ function la() {
2140
2386
  "currentColor",
2141
2387
  "2.4"
2142
2388
  );
2143
- return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2389
+ return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2144
2390
  }
2145
- function Xn() {
2146
- const e = oe(
2391
+ function go() {
2392
+ const e = re(
2147
2393
  "0 0 24 24",
2148
2394
  14,
2149
2395
  14,
@@ -2152,11 +2398,11 @@ function Xn() {
2152
2398
  "2.75"
2153
2399
  );
2154
2400
  return e.appendChild(
2155
- C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2156
- ), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
2401
+ E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2402
+ ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2157
2403
  }
2158
- function pa() {
2159
- const e = oe(
2404
+ function Pa() {
2405
+ const e = re(
2160
2406
  "0 0 24 24",
2161
2407
  16,
2162
2408
  16,
@@ -2168,18 +2414,18 @@ function pa() {
2168
2414
  "class",
2169
2415
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2170
2416
  ), e.appendChild(
2171
- C("path", {
2417
+ E("path", {
2172
2418
  d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
2173
2419
  })
2174
2420
  ), e;
2175
2421
  }
2176
- function sa() {
2177
- const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
2422
+ function Ia() {
2423
+ const e = re("0 0 24 24", 19, 19, "none", "currentColor");
2178
2424
  return e.setAttribute(
2179
2425
  "class",
2180
2426
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2181
2427
  ), e.appendChild(
2182
- C("path", {
2428
+ E("path", {
2183
2429
  d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
2184
2430
  stroke: "currentColor",
2185
2431
  "stroke-width": "2",
@@ -2188,10 +2434,10 @@ function sa() {
2188
2434
  })
2189
2435
  ), e;
2190
2436
  }
2191
- function da() {
2192
- const e = oe("0 0 24 24", 18, 18, "currentColor");
2437
+ function Aa() {
2438
+ const e = re("0 0 24 24", 18, 18, "currentColor");
2193
2439
  return e.appendChild(
2194
- C("rect", {
2440
+ E("rect", {
2195
2441
  x: "6",
2196
2442
  y: "6",
2197
2443
  width: "12",
@@ -2200,8 +2446,8 @@ function da() {
2200
2446
  })
2201
2447
  ), e;
2202
2448
  }
2203
- function ca() {
2204
- const e = oe(
2449
+ function Na() {
2450
+ const e = re(
2205
2451
  "0 0 24 24",
2206
2452
  12,
2207
2453
  12,
@@ -2209,10 +2455,10 @@ function ca() {
2209
2455
  "currentColor",
2210
2456
  "2.4"
2211
2457
  );
2212
- return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2458
+ return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2213
2459
  }
2214
- function ua() {
2215
- const e = oe(
2460
+ function Ta() {
2461
+ const e = re(
2216
2462
  "0 0 24 24",
2217
2463
  13,
2218
2464
  13,
@@ -2221,7 +2467,7 @@ function ua() {
2221
2467
  "2.25"
2222
2468
  );
2223
2469
  return e.appendChild(
2224
- C("rect", {
2470
+ E("rect", {
2225
2471
  width: "14",
2226
2472
  height: "14",
2227
2473
  x: "8",
@@ -2230,341 +2476,341 @@ function ua() {
2230
2476
  ry: "2"
2231
2477
  })
2232
2478
  ), e.appendChild(
2233
- C("path", {
2479
+ E("path", {
2234
2480
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2235
2481
  })
2236
2482
  ), e;
2237
2483
  }
2238
- function oe(e, t, o, n, i, r) {
2484
+ function re(e, t, n, o, i, r) {
2239
2485
  const l = {
2240
2486
  viewBox: e,
2241
2487
  width: String(t),
2242
- height: String(o),
2243
- fill: n,
2488
+ height: String(n),
2489
+ fill: o,
2244
2490
  "aria-hidden": "true"
2245
2491
  };
2246
- return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), C("svg", l);
2492
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2247
2493
  }
2248
- function C(e, t = {}) {
2249
- const o = document.createElementNS(Hn, e);
2250
- for (const [n, i] of Object.entries(t))
2251
- o.setAttribute(n, i);
2252
- return o;
2494
+ function E(e, t = {}) {
2495
+ const n = document.createElementNS(to, e);
2496
+ for (const [o, i] of Object.entries(t))
2497
+ n.setAttribute(o, i);
2498
+ return n;
2253
2499
  }
2254
- function vn(e) {
2500
+ function Mn(e) {
2255
2501
  for (const t of ["keydown", "keypress", "keyup"])
2256
- e.addEventListener(t, (o) => {
2257
- o.stopPropagation();
2502
+ e.addEventListener(t, (n) => {
2503
+ n.stopPropagation();
2258
2504
  });
2259
2505
  }
2260
- function ga(e, t, o) {
2506
+ function Da(e, t, n) {
2261
2507
  e.replaceChildren(), e.hidden = t.length === 0;
2262
- for (const [n, i] of t.entries()) {
2508
+ for (const [o, i] of t.entries()) {
2263
2509
  const r = document.createElement("div");
2264
- r.className = "pluno-pa-widget__attachment", r.appendChild(ha(i));
2510
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Ra(i));
2265
2511
  const l = document.createElement("span");
2266
2512
  l.textContent = i.name, r.appendChild(l);
2267
2513
  const p = document.createElement("button");
2268
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(ca()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
2514
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Na()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2269
2515
  }
2270
2516
  }
2271
- function ha(e) {
2272
- const t = Ut(e), o = Zn(e);
2273
- if (t === "image" && o) {
2274
- const n = document.createElement("img");
2275
- return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
2517
+ function Ra(e) {
2518
+ const t = en(e), n = ho(e);
2519
+ if (t === "image" && n) {
2520
+ const o = document.createElement("img");
2521
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
2276
2522
  }
2277
- if (t === "video" && o) {
2278
- const n = document.createElement("video");
2279
- return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n.addEventListener("stalled", () => n.replaceWith(ee(e))), n;
2523
+ if (t === "video" && n) {
2524
+ const o = document.createElement("video");
2525
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o.addEventListener("stalled", () => o.replaceWith(ie(e))), o;
2280
2526
  }
2281
- return ee(e);
2527
+ return ie(e);
2282
2528
  }
2283
- function ma(e) {
2284
- const t = Ut(e), o = Zn(e);
2285
- if (t === "image" && o) {
2286
- const n = document.createElement("img");
2287
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n;
2529
+ function za(e) {
2530
+ const t = en(e), n = ho(e);
2531
+ if (t === "image" && n) {
2532
+ const o = document.createElement("img");
2533
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o;
2288
2534
  }
2289
- if (t === "pdf" && o) {
2290
- const n = document.createElement("object");
2291
- return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.appendChild(ee(e, "message")), n;
2535
+ if (t === "pdf" && n) {
2536
+ const o = document.createElement("object");
2537
+ return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.appendChild(ie(e, "message")), o;
2292
2538
  }
2293
- if (t === "video" && o) {
2294
- const n = document.createElement("video");
2295
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(ee(e, "message"))), n;
2539
+ if (t === "video" && n) {
2540
+ const o = document.createElement("video");
2541
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ie(e, "message"))), o;
2296
2542
  }
2297
- return ee(e, "message");
2543
+ return ie(e, "message");
2298
2544
  }
2299
- function ee(e, t = "composer") {
2545
+ function ie(e, t = "composer") {
2300
2546
  if (t === "composer") {
2301
2547
  const r = document.createElement("span");
2302
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = Cn(e), r;
2548
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = On(e), r;
2303
2549
  }
2304
- const o = document.createElement("div");
2305
- o.className = "pluno-pa-widget__message-attachment-file";
2306
- const n = document.createElement("span");
2307
- n.textContent = Cn(e);
2550
+ const n = document.createElement("div");
2551
+ n.className = "pluno-pa-widget__message-attachment-file";
2552
+ const o = document.createElement("span");
2553
+ o.textContent = On(e);
2308
2554
  const i = document.createElement("strong");
2309
- return i.textContent = e.name, o.append(n, i), o;
2555
+ return i.textContent = e.name, n.append(o, i), n;
2310
2556
  }
2311
- function Ut(e) {
2557
+ function en(e) {
2312
2558
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2313
2559
  }
2314
- function Zn(e) {
2560
+ function ho(e) {
2315
2561
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2316
2562
  }
2317
- function Cn(e) {
2318
- const t = Ut(e);
2563
+ function On(e) {
2564
+ const t = en(e);
2319
2565
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2320
2566
  }
2321
- function fa(e, t) {
2322
- return t ? Array.from(t).map((n) => ({
2323
- ...e.createLocalAttachment(n),
2324
- previewUrl: wa(n)
2567
+ function Ma(e, t) {
2568
+ return t ? Array.from(t).map((o) => ({
2569
+ ...e.createLocalAttachment(o),
2570
+ previewUrl: Oa(o)
2325
2571
  })) : [];
2326
2572
  }
2327
- function wa(e) {
2573
+ function Oa(e) {
2328
2574
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2329
2575
  }
2330
- function Qe(e) {
2576
+ function it(e) {
2331
2577
  return !!(e && Array.from(e.types).includes("Files"));
2332
2578
  }
2333
- function Lt(e, t, o = null) {
2334
- if (!e || !Mt(t, o)) {
2579
+ function Bt(e, t, n = null) {
2580
+ if (!e || !Yt(t, n)) {
2335
2581
  e && (e.hidden = !0, e.replaceChildren());
2336
2582
  return;
2337
2583
  }
2338
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Bt(o) ? e.appendChild(
2339
- ba(t, o)
2340
- ) : Jn(t) && e.appendChild(_a(t));
2584
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || tn(n) ? e.appendChild(
2585
+ Ba(t, n)
2586
+ ) : mo(t) && e.appendChild(Ua(t));
2341
2587
  }
2342
- function ba(e, t) {
2343
- const o = document.createElement("div");
2344
- o.className = "pluno-pa-widget__billing-action-card";
2345
- const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2346
- i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
2588
+ function Ba(e, t) {
2589
+ const n = document.createElement("div");
2590
+ n.className = "pluno-pa-widget__billing-action-card";
2591
+ const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2592
+ i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2347
2593
  const r = document.createElement("span");
2348
- return r.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(r), o.appendChild(
2349
- Qn(
2594
+ return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
2595
+ fo(
2350
2596
  e,
2351
2597
  "Upgrade plan",
2352
2598
  "pluno-pa-widget__billing-action-card-actions"
2353
2599
  )
2354
- ), o;
2600
+ ), n;
2355
2601
  }
2356
- function _a(e) {
2602
+ function Ua(e) {
2357
2603
  const t = document.createElement("div");
2358
2604
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2359
- const o = document.createElement("strong");
2360
- o.textContent = "Credits running low", t.appendChild(o);
2361
- const n = document.createElement("span");
2362
- return n.textContent = ya(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2363
- Qn(
2605
+ const n = document.createElement("strong");
2606
+ n.textContent = "Credits running low", t.appendChild(n);
2607
+ const o = document.createElement("span");
2608
+ return o.textContent = Ha(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2609
+ fo(
2364
2610
  e,
2365
2611
  "Upgrade",
2366
2612
  "pluno-pa-widget__billing-action-card-actions"
2367
2613
  )
2368
2614
  ), t;
2369
2615
  }
2370
- function Mt(e, t) {
2371
- return e !== null && (te(e) || Jn(e) || Bt(t));
2616
+ function Yt(e, t) {
2617
+ return e !== null && (ae(e) || mo(e) || tn(t));
2372
2618
  }
2373
- function Sn(e, t, o) {
2374
- return Mt(t, o) || xa(t) ? !0 : !Mt(e, o);
2619
+ function Bn(e, t, n) {
2620
+ return Yt(t, n) || Fa(t) ? !0 : !Yt(e, n);
2375
2621
  }
2376
- function xa(e) {
2377
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
2622
+ function Fa(e) {
2623
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
2378
2624
  }
2379
- function te(e) {
2625
+ function ae(e) {
2380
2626
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2381
2627
  }
2382
- function Bt(e) {
2628
+ function tn(e) {
2383
2629
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2384
2630
  }
2385
- function Jn(e) {
2386
- return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2631
+ function mo(e) {
2632
+ return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2387
2633
  }
2388
- function ya(e) {
2389
- return e.creditsRemaining === null ? null : `${va(e.creditsRemaining)} credits left`;
2634
+ function Ha(e) {
2635
+ return e.creditsRemaining === null ? null : `${Wa(e.creditsRemaining)} credits left`;
2390
2636
  }
2391
- function va(e) {
2637
+ function Wa(e) {
2392
2638
  return new Intl.NumberFormat("en-US", {
2393
2639
  maximumFractionDigits: 0
2394
2640
  }).format(Math.ceil(e));
2395
2641
  }
2396
- function Qn(e, t, o) {
2397
- const n = document.createElement("div");
2398
- return n.className = o, n.appendChild(
2399
- En(t, e.pricingUrl)
2400
- ), n.appendChild(
2401
- En("Earn credits", e.earnCreditsUrl)
2402
- ), n;
2642
+ function fo(e, t, n) {
2643
+ const o = document.createElement("div");
2644
+ return o.className = n, o.appendChild(
2645
+ Un(t, e.pricingUrl)
2646
+ ), o.appendChild(
2647
+ Un("Earn credits", e.earnCreditsUrl)
2648
+ ), o;
2403
2649
  }
2404
- function En(e, t) {
2405
- const o = document.createElement("button");
2406
- if (o.type = "button", e === "Earn credits") {
2407
- const n = document.createElement("span");
2408
- n.className = "pluno-pa-widget__billing-action-card-earn-credits-label", n.textContent = e, o.appendChild(n);
2650
+ function Un(e, t) {
2651
+ const n = document.createElement("button");
2652
+ if (n.type = "button", e === "Earn credits") {
2653
+ const o = document.createElement("span");
2654
+ o.className = "pluno-pa-widget__billing-action-card-earn-credits-label", o.textContent = e, n.appendChild(o);
2409
2655
  } else
2410
- o.textContent = e;
2411
- return o.disabled = t.trim().length === 0, o.addEventListener("click", () => {
2656
+ n.textContent = e;
2657
+ return n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
2412
2658
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2413
- }), o;
2659
+ }), n;
2414
2660
  }
2415
- function It(e, t) {
2661
+ function Ut(e, t) {
2416
2662
  return e.messages.filter(
2417
- (n) => !eo(n)
2663
+ (o) => !wo(o)
2418
2664
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2419
2665
  }
2420
- function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, w, H, k) {
2421
- const y = La(r), v = y.filter(
2422
- (x) => !eo(x)
2423
- ), h = e.scrollTop, N = [], D = /* @__PURE__ */ new Set(), L = (x) => {
2424
- N.push(x);
2666
+ function Ga(e, t, n, o, i, r, l, p, d, c, u, m, k, v, z, _) {
2667
+ const g = Va(r), b = g.filter(
2668
+ (C) => !wo(C)
2669
+ ), h = e.scrollTop, P = [], A = /* @__PURE__ */ new Set(), L = (C) => {
2670
+ P.push(C);
2425
2671
  };
2426
- no(o, r.isThinking), i.hidden = !p, p && l !== null && Vn(i, l);
2427
- const Pe = v.length > 0 || !!r.assistantDraft || r.isThinking;
2428
- if (n(Pe), v.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2429
- const x = document.createElement("div");
2430
- x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2431
- const z = document.createElement("div");
2432
- z.className = "pluno-pa-widget__empty-hero";
2433
- const I = de(
2672
+ _o(n, r.isThinking), i.hidden = !p, p && l !== null && po(i, l);
2673
+ const F = b.length > 0 || !!r.assistantDraft || r.isThinking;
2674
+ if (o(F), b.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2675
+ const C = document.createElement("div");
2676
+ C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2677
+ const T = document.createElement("div");
2678
+ T.className = "pluno-pa-widget__empty-hero";
2679
+ const Se = me(
2434
2680
  "pluno-pa-widget__character--empty",
2435
- w()
2681
+ v()
2436
2682
  );
2437
- z.appendChild(I), x.appendChild(z), x.appendChild(jn());
2438
- const $ = document.createElement("div");
2439
- if ($.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2440
- for (const A of r.starterPrompts) {
2441
- const T = document.createElement("button");
2442
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${A}"`, T.addEventListener("click", () => {
2443
- H(A);
2444
- }), $.appendChild(T);
2683
+ T.appendChild(Se), C.appendChild(T), C.appendChild(lo());
2684
+ const q = document.createElement("div");
2685
+ if (q.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2686
+ for (const R of r.starterPrompts) {
2687
+ const D = document.createElement("button");
2688
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
2689
+ z(R);
2690
+ }), q.appendChild(D);
2445
2691
  }
2446
2692
  else if (r.starterPromptsLoading) {
2447
- const A = document.createElement("button");
2448
- 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...", $.appendChild(A);
2693
+ const R = document.createElement("button");
2694
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", R.disabled = !0, R.tabIndex = -1, R.textContent = "Generating example tasks...", q.appendChild(R);
2449
2695
  } else
2450
- for (let A = 0; A < oi; A += 1) {
2451
- const T = document.createElement("button");
2452
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.textContent = "", $.appendChild(T);
2696
+ for (let R = 0; R < Ei; R += 1) {
2697
+ const D = document.createElement("button");
2698
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", D.disabled = !0, D.tabIndex = -1, D.textContent = "", q.appendChild(D);
2453
2699
  }
2454
- x.appendChild($), g.clear(), L(x), L(t), kn(e, N);
2700
+ C.appendChild(q), m.clear(), L(C), L(t), Fn(e, P);
2455
2701
  return;
2456
2702
  }
2457
- let f = null, R = null, ce = [];
2458
- const ue = v.some(zt), ye = () => {
2459
- if (ce.length === 0)
2703
+ let H = null, $ = null, Q = [];
2704
+ const ze = b.some(Xt), x = () => {
2705
+ if (Q.length === 0)
2460
2706
  return !1;
2461
- const x = Oa(
2462
- ce,
2463
- c,
2464
- S,
2465
- w()
2707
+ const C = or(
2708
+ Q,
2709
+ u,
2710
+ k,
2711
+ v()
2466
2712
  );
2467
- return L(x), f = null, R = x, ce = [], !0;
2713
+ return L(C), H = null, $ = C, Q = [], !0;
2468
2714
  };
2469
- for (let x = 0; x < v.length; x += 1) {
2470
- const z = v[x];
2471
- if (z.role === "tool") {
2472
- ce.push(z);
2715
+ for (let C = 0; C < b.length; C += 1) {
2716
+ const T = b[C];
2717
+ if (T.role === "tool") {
2718
+ Q.push(T);
2473
2719
  continue;
2474
2720
  }
2475
- if (zt(z)) {
2476
- if (ye()) {
2477
- const ge = at();
2478
- L(ge), f = null, R = ge;
2721
+ if (Xt(T)) {
2722
+ if (x()) {
2723
+ const N = ct();
2724
+ L(N), H = null, $ = N;
2479
2725
  } else {
2480
- const ge = An(w());
2481
- L(ge), f = null, R = ge;
2726
+ const N = Gn(v());
2727
+ L(N), H = null, $ = N;
2482
2728
  }
2483
2729
  continue;
2484
2730
  }
2485
- if (z.role === "system")
2731
+ if (T.role === "system")
2486
2732
  continue;
2487
- const I = ye(), $ = za(z.content);
2488
- if (z.role === "assistant" && !I) {
2489
- const T = to(w());
2490
- L(T), f = null, R = T;
2733
+ const Se = x(), q = nr(T.content);
2734
+ if (T.role === "assistant" && !Se) {
2735
+ const D = bo(v());
2736
+ L(D), H = null, $ = D;
2491
2737
  }
2492
- const A = Sa(z, $, g, D);
2493
- L(A), f = A, R = null;
2738
+ const R = $a(T, q, m, A);
2739
+ L(R), H = R, $ = null;
2494
2740
  }
2495
- const G = ye(), $e = v[v.length - 1]?.id === "assistant-draft";
2496
- if (r.isThinking && !$e && !ue)
2497
- if (G) {
2498
- const x = at();
2499
- L(x), f = null, R = x;
2741
+ const de = x(), Ye = b[b.length - 1]?.id === "assistant-draft";
2742
+ if (r.isThinking && !Ye && !ze)
2743
+ if (de) {
2744
+ const C = ct();
2745
+ L(C), H = null, $ = C;
2500
2746
  } else {
2501
- const x = An(w());
2502
- L(x), f = null, R = x;
2747
+ const C = Gn(v());
2748
+ L(C), H = null, $ = C;
2503
2749
  }
2504
2750
  if (r.lastError) {
2505
- const x = document.createElement("div");
2506
- x.className = "pluno-pa-widget__error", x.textContent = r.lastError, L(x), f = x, R = null;
2751
+ const C = document.createElement("div");
2752
+ C.className = "pluno-pa-widget__error", C.textContent = r.lastError, L(C), H = C, $ = null;
2507
2753
  }
2508
- const Y = k && !r.isThinking ? To(y) : null;
2509
- if (k && Y && !k.dismissedCandidateIds.has(Y.id)) {
2510
- const x = Na(Y, {
2511
- isDrafting: k.draftingCandidateId === Y.id,
2512
- error: k.error,
2513
- characterIconOptions: k.characterIconOptions,
2514
- onDraft: k.onDraft,
2515
- onDismiss: k.onDismiss,
2516
- onDisable: k.onDisable
2754
+ const X = _ && !r.isThinking ? Qo(g) : null;
2755
+ if (_ && X && !_.dismissedCandidateIds.has(X.id)) {
2756
+ const C = Xa(X, {
2757
+ isDrafting: _.draftingCandidateId === X.id,
2758
+ error: _.error,
2759
+ characterIconOptions: _.characterIconOptions,
2760
+ onDraft: _.onDraft,
2761
+ onDismiss: _.onDismiss,
2762
+ onDisable: _.onDisable
2517
2763
  });
2518
- L(x), k.onSeen(Y), f = null, R = x;
2764
+ L(C), _.onSeen(X), H = null, $ = C;
2519
2765
  }
2520
- f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), ka(g, D), kn(e, N), d ? We(e, u) : e.scrollTop = h;
2766
+ H?.classList.add("pluno-pa-widget__message--bottom-reserve"), $?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), ja(m, A), Fn(e, P), d ? Ve(e, c) : e.scrollTop = h;
2521
2767
  }
2522
- function Sa(e, t, o, n) {
2523
- const i = Ea(e, t), r = i ? o.get(i) : void 0;
2768
+ function $a(e, t, n, o) {
2769
+ const i = qa(e, t), r = i ? n.get(i) : void 0;
2524
2770
  if (i && r)
2525
- return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), r;
2771
+ return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
2526
2772
  const l = document.createElement("div");
2527
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Ba(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Ia(e.attachments));
2773
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? ar(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Ka(e.attachments));
2528
2774
  const p = document.createElement("div");
2529
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Aa(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2775
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(Ya(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2530
2776
  }
2531
- function Ea(e, t) {
2777
+ function qa(e, t) {
2532
2778
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2533
2779
  id: e.id,
2534
2780
  content: t,
2535
- attachments: e.attachments.map((o) => {
2536
- const { previewUrl: n } = o;
2781
+ attachments: e.attachments.map((n) => {
2782
+ const { previewUrl: o } = n;
2537
2783
  return {
2538
- id: o.id ?? null,
2539
- name: o.name,
2540
- mimeType: o.mimeType,
2541
- sizeBytes: o.sizeBytes,
2542
- previewUrl: n ?? null,
2543
- fileUrl: o.fileUrl ?? null,
2544
- gcsPath: o.gcsPath ?? null
2784
+ id: n.id ?? null,
2785
+ name: n.name,
2786
+ mimeType: n.mimeType,
2787
+ sizeBytes: n.sizeBytes,
2788
+ previewUrl: o ?? null,
2789
+ fileUrl: n.fileUrl ?? null,
2790
+ gcsPath: n.gcsPath ?? null
2545
2791
  };
2546
2792
  })
2547
2793
  });
2548
2794
  }
2549
- function ka(e, t) {
2550
- for (const o of e.keys())
2551
- t.has(o) || e.delete(o);
2552
- }
2553
- function kn(e, t) {
2554
- let o = e.firstChild;
2555
- for (const n of t) {
2556
- if (n === o) {
2557
- o = o.nextSibling;
2795
+ function ja(e, t) {
2796
+ for (const n of e.keys())
2797
+ t.has(n) || e.delete(n);
2798
+ }
2799
+ function Fn(e, t) {
2800
+ let n = e.firstChild;
2801
+ for (const o of t) {
2802
+ if (o === n) {
2803
+ n = n.nextSibling;
2558
2804
  continue;
2559
2805
  }
2560
- e.insertBefore(n, o);
2806
+ e.insertBefore(o, n);
2561
2807
  }
2562
- for (; o; ) {
2563
- const n = o;
2564
- o = o.nextSibling, e.removeChild(n);
2808
+ for (; n; ) {
2809
+ const o = n;
2810
+ n = n.nextSibling, e.removeChild(o);
2565
2811
  }
2566
2812
  }
2567
- function La(e) {
2813
+ function Va(e) {
2568
2814
  if (!e.assistantDraft)
2569
2815
  return [...e.messages];
2570
2816
  const t = {
@@ -2578,22 +2824,22 @@ function La(e) {
2578
2824
  };
2579
2825
  if (!t.respondsToUserMessageId)
2580
2826
  return [...e.messages, t];
2581
- const o = e.messages.findIndex(
2827
+ const n = e.messages.findIndex(
2582
2828
  (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2583
2829
  );
2584
- if (o === -1)
2830
+ if (n === -1)
2585
2831
  return [...e.messages, t];
2586
- const n = e.messages.findIndex(
2587
- (r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Ln(r, t) && zt(r)
2832
+ const o = e.messages.findIndex(
2833
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Hn(r, t) && Xt(r)
2588
2834
  );
2589
- if (n !== -1)
2835
+ if (o !== -1)
2590
2836
  return [
2591
- ...e.messages.slice(0, n),
2837
+ ...e.messages.slice(0, o),
2592
2838
  t,
2593
- ...e.messages.slice(n + 1)
2839
+ ...e.messages.slice(o + 1)
2594
2840
  ];
2595
- let i = o + 1;
2596
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Ln(e.messages[i], t); )
2841
+ let i = n + 1;
2842
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Hn(e.messages[i], t); )
2597
2843
  i += 1;
2598
2844
  return [
2599
2845
  ...e.messages.slice(0, i),
@@ -2601,50 +2847,50 @@ function La(e) {
2601
2847
  ...e.messages.slice(i)
2602
2848
  ];
2603
2849
  }
2604
- function zt(e) {
2850
+ function Xt(e) {
2605
2851
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2606
2852
  }
2607
- function Ln(e, t) {
2853
+ function Hn(e, t) {
2608
2854
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2609
2855
  }
2610
- function In(e, t, o, n, i, r, l, p) {
2611
- e.replaceChildren(), no(t, !1), t.disabled = !0, o(!1);
2856
+ function Wn(e, t, n, o, i, r, l, p) {
2857
+ e.replaceChildren(), _o(t, !1), t.disabled = !0, n(!1);
2612
2858
  const d = document.createElement("div");
2613
2859
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2614
- const u = de(
2860
+ const c = me(
2615
2861
  "pluno-pa-widget__character--empty",
2616
- n()
2862
+ o()
2617
2863
  );
2618
- d.appendChild(u);
2619
- const c = document.createElement("div");
2620
- if (c.className = "pluno-pa-widget__empty", c.textContent = i, d.appendChild(c), l) {
2621
- const g = document.createElement("a");
2622
- g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = r, d.appendChild(g);
2864
+ d.appendChild(c);
2865
+ const u = document.createElement("div");
2866
+ if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2867
+ const m = document.createElement("a");
2868
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, d.appendChild(m);
2623
2869
  } else {
2624
- const g = document.createElement("button");
2625
- g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = r, g.addEventListener("click", () => p?.()), d.appendChild(g);
2870
+ const m = document.createElement("button");
2871
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), d.appendChild(m);
2626
2872
  }
2627
2873
  e.appendChild(d);
2628
2874
  }
2629
- function Ia(e) {
2875
+ function Ka(e) {
2630
2876
  const t = document.createElement("div");
2631
2877
  t.className = "pluno-pa-widget__message-attachments";
2632
- for (const o of e)
2633
- t.appendChild(ma(o));
2878
+ for (const n of e)
2879
+ t.appendChild(za(n));
2634
2880
  return t;
2635
2881
  }
2636
- function Aa(e) {
2882
+ function Ya(e) {
2637
2883
  const t = document.createElement("button");
2638
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ua()), t.addEventListener("click", (o) => {
2639
- o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
2884
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ta()), t.addEventListener("click", (n) => {
2885
+ n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2640
2886
  }), t;
2641
2887
  }
2642
- function Na(e, t) {
2643
- const o = document.createElement("article");
2644
- o.className = "pluno-pa-widget__share-prompt";
2645
- const n = document.createElement("div");
2646
- n.className = "pluno-pa-widget__share-prompt-body", n.appendChild(
2647
- de(
2888
+ function Xa(e, t) {
2889
+ const n = document.createElement("article");
2890
+ n.className = "pluno-pa-widget__share-prompt";
2891
+ const o = document.createElement("div");
2892
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2893
+ me(
2648
2894
  "pluno-pa-widget__share-prompt-icon",
2649
2895
  t.characterIconOptions
2650
2896
  )
@@ -2655,97 +2901,97 @@ function Na(e, t) {
2655
2901
  r.textContent = "Share this win?", i.appendChild(r);
2656
2902
  const l = document.createElement("span");
2657
2903
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2658
- const c = document.createElement("span");
2659
- c.className = "pluno-pa-widget__share-prompt-error", c.textContent = t.error, i.appendChild(c);
2904
+ const u = document.createElement("span");
2905
+ u.className = "pluno-pa-widget__share-prompt-error", u.textContent = t.error, i.appendChild(u);
2660
2906
  }
2661
- n.appendChild(i);
2907
+ o.appendChild(i);
2662
2908
  const p = document.createElement("div");
2663
2909
  p.className = "pluno-pa-widget__share-prompt-actions";
2664
2910
  const d = document.createElement("div");
2665
2911
  d.className = "pluno-pa-widget__share-prompt-primary-actions";
2666
- const u = document.createElement("button");
2667
- if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
2912
+ const c = document.createElement("button");
2913
+ if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2668
2914
  t.onDraft(e);
2669
- }), t.isDrafting ? (u.appendChild(Ot()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", d.appendChild(u), t.isDrafting)
2915
+ }), t.isDrafting ? (c.appendChild(Zt()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2670
2916
  p.appendChild(d);
2671
2917
  else {
2672
- const c = document.createElement("button");
2673
- c.type = "button", c.className = "pluno-pa-widget__share-prompt-dismiss", c.setAttribute("aria-label", "Dismiss share prompt"), c.title = "Dismiss", c.textContent = "Dismiss", c.addEventListener("click", () => {
2918
+ const u = document.createElement("button");
2919
+ u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
2674
2920
  t.onDismiss(e);
2675
- }), d.appendChild(c), p.appendChild(d);
2676
- const g = document.createElement("button");
2677
- g.type = "button", g.className = "pluno-pa-widget__share-prompt-disable", g.textContent = "Don't ask again", g.addEventListener("click", () => {
2921
+ }), d.appendChild(u), p.appendChild(d);
2922
+ const m = document.createElement("button");
2923
+ m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
2678
2924
  t.onDisable(e);
2679
- }), p.appendChild(g);
2925
+ }), p.appendChild(m);
2680
2926
  }
2681
- return n.appendChild(p), o.appendChild(n), o;
2927
+ return o.appendChild(p), n.appendChild(o), n;
2682
2928
  }
2683
- function Ta(e, t) {
2684
- const o = document.createElement("div");
2685
- o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (y) => {
2686
- y.target === o && t.onClose();
2929
+ function Za(e, t) {
2930
+ const n = document.createElement("div");
2931
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2932
+ g.target === n && t.onClose();
2687
2933
  });
2688
- const n = document.createElement("section");
2689
- n.className = "pluno-pa-widget__share-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Draft a social post");
2934
+ const o = document.createElement("section");
2935
+ o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
2690
2936
  const i = document.createElement("header"), r = document.createElement("strong");
2691
2937
  r.textContent = "Share this win", i.appendChild(r);
2692
2938
  const l = document.createElement("button");
2693
- l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), n.appendChild(i);
2939
+ l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2694
2940
  const p = document.createElement("p");
2695
2941
  p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
2696
2942
  const d = document.createElement("div");
2697
2943
  d.className = "pluno-pa-widget__share-dialog-step";
2698
- const u = document.createElement("div");
2699
- u.className = "pluno-pa-widget__share-dialog-step-header";
2700
- const c = document.createElement("strong");
2701
- c.textContent = "1) Copy Screenshot", u.appendChild(c);
2702
- const g = Pa(
2944
+ const c = document.createElement("div");
2945
+ c.className = "pluno-pa-widget__share-dialog-step-header";
2946
+ const u = document.createElement("strong");
2947
+ u.textContent = "1) Copy Screenshot", c.appendChild(u);
2948
+ const m = Ja(
2703
2949
  "Copy Screenshot",
2704
2950
  async () => {
2705
2951
  try {
2706
- return await Po(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2952
+ return await ei(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2707
2953
  } catch {
2708
2954
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2709
2955
  }
2710
2956
  }
2711
2957
  );
2712
- if (u.appendChild(g), d.appendChild(u), e.screenshotDataUrl) {
2713
- const y = document.createElement("div");
2714
- y.className = "pluno-pa-widget__share-dialog-screenshot";
2715
- const v = document.createElement("img");
2716
- v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", y.appendChild(v), d.appendChild(y);
2958
+ if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
2959
+ const g = document.createElement("div");
2960
+ g.className = "pluno-pa-widget__share-dialog-screenshot";
2961
+ const b = document.createElement("img");
2962
+ b.src = e.screenshotDataUrl, b.alt = "Product page with Pluno open", g.appendChild(b), d.appendChild(g);
2717
2963
  }
2718
- n.appendChild(d), n.appendChild(p);
2719
- const S = document.createElement("div");
2720
- S.className = "pluno-pa-widget__share-dialog-step";
2721
- const w = document.createElement("strong");
2722
- w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "2) Share on", S.appendChild(w);
2723
- const H = document.createElement("p");
2724
- H.className = "pluno-pa-widget__share-dialog-hint", H.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(H);
2725
- const k = document.createElement("footer");
2726
- k.className = "pluno-pa-widget__share-dialog-platforms";
2727
- for (const y of Da(e)) {
2728
- const v = document.createElement("a");
2729
- v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(Ra(y.id)), k.appendChild(v);
2964
+ o.appendChild(d), o.appendChild(p);
2965
+ const k = document.createElement("div");
2966
+ k.className = "pluno-pa-widget__share-dialog-step";
2967
+ const v = document.createElement("strong");
2968
+ v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", k.appendChild(v);
2969
+ const z = document.createElement("p");
2970
+ z.className = "pluno-pa-widget__share-dialog-hint", z.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(z);
2971
+ const _ = document.createElement("footer");
2972
+ _.className = "pluno-pa-widget__share-dialog-platforms";
2973
+ for (const g of Qa(e)) {
2974
+ const b = document.createElement("a");
2975
+ b.href = g.href, b.target = "_blank", b.rel = "noopener noreferrer", b.title = g.label, b.setAttribute("aria-label", `Open ${g.label}`), b.appendChild(er(g.id)), _.appendChild(b);
2730
2976
  }
2731
- if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
2732
- const y = document.createElement("div");
2733
- y.className = "pluno-pa-widget__share-dialog-step";
2734
- const v = document.createElement("strong");
2735
- v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(v);
2977
+ if (k.appendChild(_), o.appendChild(k), t.socialPostRewardsUrl) {
2978
+ const g = document.createElement("div");
2979
+ g.className = "pluno-pa-widget__share-dialog-step";
2980
+ const b = document.createElement("strong");
2981
+ b.className = "pluno-pa-widget__share-dialog-step-title", b.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(b);
2736
2982
  const h = document.createElement("a");
2737
- 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(Ma()), y.appendChild(h), n.appendChild(y);
2983
+ 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(tr()), g.appendChild(h), o.appendChild(g);
2738
2984
  }
2739
- return o.appendChild(n), o;
2985
+ return n.appendChild(o), n;
2740
2986
  }
2741
- function Pa(e, t) {
2742
- const o = document.createElement("button");
2743
- return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
2744
- n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
2745
- }), o;
2987
+ function Ja(e, t) {
2988
+ const n = document.createElement("button");
2989
+ return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
2990
+ o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
2991
+ }), n;
2746
2992
  }
2747
- function Da(e) {
2748
- const t = e.linkedinPost.trim(), o = e.xPost.trim();
2993
+ function Qa(e) {
2994
+ const t = e.linkedinPost.trim(), n = e.xPost.trim();
2749
2995
  return [
2750
2996
  {
2751
2997
  id: "linkedin",
@@ -2755,7 +3001,7 @@ function Da(e) {
2755
3001
  {
2756
3002
  id: "x",
2757
3003
  label: "X",
2758
- href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(o)}`
3004
+ href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(n)}`
2759
3005
  },
2760
3006
  {
2761
3007
  id: "instagram",
@@ -2764,7 +3010,7 @@ function Da(e) {
2764
3010
  }
2765
3011
  ];
2766
3012
  }
2767
- function Ra(e) {
3013
+ function er(e) {
2768
3014
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2769
3015
  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(
2770
3016
  t,
@@ -2787,145 +3033,145 @@ function Ra(e) {
2787
3033
  "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"
2788
3034
  ), t);
2789
3035
  }
2790
- function U(e, t, o) {
2791
- const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
2792
- n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
3036
+ function U(e, t, n) {
3037
+ const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3038
+ o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2793
3039
  }
2794
- function Ma() {
3040
+ function tr() {
2795
3041
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2796
3042
  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(
2797
3043
  e,
2798
3044
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2799
3045
  ), e;
2800
3046
  }
2801
- function eo(e) {
2802
- return e.role === "tool" && e.toolName === zn;
3047
+ function wo(e) {
3048
+ return e.role === "tool" && e.toolName === Xn;
2803
3049
  }
2804
- function za(e) {
3050
+ function nr(e) {
2805
3051
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2806
3052
  }
2807
- function Oa(e, t, o, n) {
3053
+ function or(e, t, n, o) {
2808
3054
  const i = document.createElement("article");
2809
3055
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
2810
3056
  e[e.length - 1].createdAt
2811
3057
  ).toLocaleString(), i.appendChild(
2812
- de(
3058
+ me(
2813
3059
  "pluno-pa-widget__character--tool-group",
2814
- n
3060
+ o
2815
3061
  )
2816
3062
  );
2817
- const r = document.createElement("details"), l = Ua(e);
3063
+ const r = document.createElement("details"), l = ir(e);
2818
3064
  r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
2819
- i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), o();
3065
+ i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
2820
3066
  });
2821
3067
  const p = document.createElement("summary");
2822
- p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(Ot());
2823
- const u = document.createElement("span");
2824
- if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), r.appendChild(p), e.length > 0) {
2825
- const c = document.createElement("div");
2826
- c.className = "pluno-pa-widget__tool-lines";
2827
- for (const g of e) {
2828
- const S = document.createElement("div");
2829
- S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(Ot());
2830
- const w = document.createElement("span");
2831
- w.textContent = g.content || "Run tool", S.appendChild(w), c.appendChild(S);
2832
- }
2833
- r.appendChild(c);
3068
+ p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(Zt());
3069
+ const c = document.createElement("span");
3070
+ if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), r.appendChild(p), e.length > 0) {
3071
+ const u = document.createElement("div");
3072
+ u.className = "pluno-pa-widget__tool-lines";
3073
+ for (const m of e) {
3074
+ const k = document.createElement("div");
3075
+ k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(Zt());
3076
+ const v = document.createElement("span");
3077
+ v.textContent = m.content || "Run tool", k.appendChild(v), u.appendChild(k);
3078
+ }
3079
+ r.appendChild(u);
2834
3080
  }
2835
3081
  return i.appendChild(r), i;
2836
3082
  }
2837
- function to(e) {
3083
+ function bo(e) {
2838
3084
  const t = document.createElement("article");
2839
3085
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2840
- de(
3086
+ me(
2841
3087
  "pluno-pa-widget__character--tool-group",
2842
3088
  e
2843
3089
  )
2844
3090
  ), t;
2845
3091
  }
2846
- function An(e) {
2847
- const t = to(e);
2848
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(at()), t;
3092
+ function Gn(e) {
3093
+ const t = bo(e);
3094
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ct()), t;
2849
3095
  }
2850
- function at(e = "Thinking...") {
3096
+ function ct(e = "Thinking...") {
2851
3097
  const t = document.createElement("div");
2852
3098
  t.className = "pluno-pa-widget__status";
2853
- const o = document.createElement("span");
2854
- o.className = "pluno-pa-widget__thinking-dot", o.setAttribute("aria-hidden", "true"), t.appendChild(o);
2855
3099
  const n = document.createElement("span");
2856
- return n.textContent = e, t.appendChild(n), t;
3100
+ n.className = "pluno-pa-widget__thinking-dot", n.setAttribute("aria-hidden", "true"), t.appendChild(n);
3101
+ const o = document.createElement("span");
3102
+ return o.textContent = e, t.appendChild(o), t;
2857
3103
  }
2858
- function Ua(e) {
3104
+ function ir(e) {
2859
3105
  return `tools:${e[0]?.id ?? ""}`;
2860
3106
  }
2861
- function Ot() {
3107
+ function Zt() {
2862
3108
  const e = document.createElement("span");
2863
3109
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2864
3110
  }
2865
- function no(e, t) {
2866
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? da() : Xn());
3111
+ function _o(e, t) {
3112
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Aa() : go());
2867
3113
  }
2868
- function Ba(e, t) {
2869
- const o = t.replace(/\r\n/g, `
3114
+ function ar(e, t) {
3115
+ const n = t.replace(/\r\n/g, `
2870
3116
  `).split(`
2871
3117
  `);
2872
- let n = 0;
2873
- for (; n < o.length; ) {
2874
- const i = o[n];
3118
+ let o = 0;
3119
+ for (; o < n.length; ) {
3120
+ const i = n[o];
2875
3121
  if (!i.trim()) {
2876
- n += 1;
3122
+ o += 1;
2877
3123
  continue;
2878
3124
  }
2879
3125
  if (i.match(/^```(\w+)?\s*$/)) {
2880
- const u = [];
2881
- for (n += 1; n < o.length && !/^```\s*$/.test(o[n]); )
2882
- u.push(o[n]), n += 1;
2883
- n += n < o.length ? 1 : 0;
2884
- const c = document.createElement("pre"), g = document.createElement("code");
2885
- g.textContent = u.join(`
2886
- `), c.appendChild(g), e.appendChild(c);
3126
+ const c = [];
3127
+ for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
3128
+ c.push(n[o]), o += 1;
3129
+ o += o < n.length ? 1 : 0;
3130
+ const u = document.createElement("pre"), m = document.createElement("code");
3131
+ m.textContent = c.join(`
3132
+ `), u.appendChild(m), e.appendChild(u);
2887
3133
  continue;
2888
3134
  }
2889
3135
  const l = i.match(/^(#{1,3})\s+(.+)$/);
2890
3136
  if (l) {
2891
- const u = document.createElement(`h${l[1].length + 2}`);
2892
- et(u, l[2]), e.appendChild(u), n += 1;
3137
+ const c = document.createElement(`h${l[1].length + 2}`);
3138
+ at(c, l[2]), e.appendChild(c), o += 1;
2893
3139
  continue;
2894
3140
  }
2895
3141
  if (/^\s*[-*+]\s+/.test(i)) {
2896
- const u = document.createElement("ul");
2897
- for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
2898
- const c = document.createElement("li");
2899
- et(c, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(c), n += 1;
3142
+ const c = document.createElement("ul");
3143
+ for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3144
+ const u = document.createElement("li");
3145
+ at(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
2900
3146
  }
2901
- e.appendChild(u);
3147
+ e.appendChild(c);
2902
3148
  continue;
2903
3149
  }
2904
3150
  if (/^\s*\d+\.\s+/.test(i)) {
2905
- const u = document.createElement("ol");
2906
- for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
2907
- const c = document.createElement("li");
2908
- et(c, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(c), n += 1;
3151
+ const c = document.createElement("ol");
3152
+ for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3153
+ const u = document.createElement("li");
3154
+ at(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
2909
3155
  }
2910
- e.appendChild(u);
3156
+ e.appendChild(c);
2911
3157
  continue;
2912
3158
  }
2913
3159
  const p = [i];
2914
- for (n += 1; n < o.length && o[n].trim() && !/^```/.test(o[n]) && !/^(#{1,3})\s+/.test(o[n]) && !/^\s*[-*+]\s+/.test(o[n]) && !/^\s*\d+\.\s+/.test(o[n]); )
2915
- p.push(o[n]), n += 1;
3160
+ 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]); )
3161
+ p.push(n[o]), o += 1;
2916
3162
  const d = document.createElement("p");
2917
- p.forEach((u, c) => {
2918
- c > 0 && d.appendChild(document.createElement("br")), et(d, u);
3163
+ p.forEach((c, u) => {
3164
+ u > 0 && d.appendChild(document.createElement("br")), at(d, c);
2919
3165
  }), e.appendChild(d);
2920
3166
  }
2921
3167
  }
2922
- function et(e, t) {
2923
- const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2924
- let n = 0;
2925
- for (const i of t.matchAll(o)) {
3168
+ function at(e, t) {
3169
+ const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3170
+ let o = 0;
3171
+ for (const i of t.matchAll(n)) {
2926
3172
  const r = i.index ?? 0;
2927
- r > n && e.appendChild(
2928
- document.createTextNode(t.slice(n, r))
3173
+ r > o && e.appendChild(
3174
+ document.createTextNode(t.slice(o, r))
2929
3175
  );
2930
3176
  const l = i[0];
2931
3177
  if (l.startsWith("`")) {
@@ -2939,17 +3185,17 @@ function et(e, t) {
2939
3185
  p.textContent = l.slice(1, -1), e.appendChild(p);
2940
3186
  } else {
2941
3187
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2942
- if (p && Fa(p[2])) {
3188
+ if (p && rr(p[2])) {
2943
3189
  const d = document.createElement("a");
2944
3190
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
2945
3191
  } else
2946
3192
  e.appendChild(document.createTextNode(l));
2947
3193
  }
2948
- n = r + l.length;
3194
+ o = r + l.length;
2949
3195
  }
2950
- n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
3196
+ o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2951
3197
  }
2952
- function Fa(e) {
3198
+ function rr(e) {
2953
3199
  if (e.startsWith("/") || e.startsWith("#"))
2954
3200
  return !0;
2955
3201
  try {
@@ -2959,10 +3205,10 @@ function Fa(e) {
2959
3205
  return !1;
2960
3206
  }
2961
3207
  }
2962
- function Nn(e, t) {
2963
- if (Ha(e))
3208
+ function $n(e, t) {
3209
+ if (lr(e))
2964
3210
  return;
2965
- const o = `
3211
+ const n = `
2966
3212
  :host {
2967
3213
  all: initial;
2968
3214
  color-scheme: light;
@@ -3013,7 +3259,7 @@ function Nn(e, t) {
3013
3259
  --pluno-pa-accent-contrast: #fafafa;
3014
3260
  position: fixed;
3015
3261
  z-index: 2147483645;
3016
- font-family: ${Q.fontFamily};
3262
+ font-family: ${oe.fontFamily};
3017
3263
  font-size: 14px;
3018
3264
  color: var(--pluno-pa-text);
3019
3265
  width: var(--pluno-pa-launcher-width);
@@ -3307,6 +3553,82 @@ function Nn(e, t) {
3307
3553
  opacity: 1;
3308
3554
  transform: translateY(0) scale(1);
3309
3555
  }
3556
+ .pluno-pa-widget__resize-handle {
3557
+ position: absolute;
3558
+ z-index: 3;
3559
+ border: 0;
3560
+ background: transparent;
3561
+ padding: 0;
3562
+ opacity: 0;
3563
+ touch-action: none;
3564
+ }
3565
+ .pluno-pa-widget__resize-handle:focus-visible {
3566
+ opacity: 1;
3567
+ outline: 2px solid var(--pluno-pa-accent);
3568
+ outline-offset: 2px;
3569
+ }
3570
+ .pluno-pa-widget__resize-handle--left,
3571
+ .pluno-pa-widget__resize-handle--right {
3572
+ top: 14px;
3573
+ bottom: 14px;
3574
+ width: 12px;
3575
+ cursor: ew-resize;
3576
+ }
3577
+ .pluno-pa-widget__resize-handle--left {
3578
+ left: -6px;
3579
+ }
3580
+ .pluno-pa-widget__resize-handle--right {
3581
+ right: -6px;
3582
+ }
3583
+ .pluno-pa-widget__resize-handle--top,
3584
+ .pluno-pa-widget__resize-handle--bottom {
3585
+ left: 14px;
3586
+ right: 14px;
3587
+ height: 12px;
3588
+ cursor: ns-resize;
3589
+ }
3590
+ .pluno-pa-widget__resize-handle--top {
3591
+ top: -6px;
3592
+ }
3593
+ .pluno-pa-widget__resize-handle--bottom {
3594
+ bottom: -6px;
3595
+ }
3596
+ .pluno-pa-widget__resize-handle--top-left,
3597
+ .pluno-pa-widget__resize-handle--top-right,
3598
+ .pluno-pa-widget__resize-handle--bottom-left,
3599
+ .pluno-pa-widget__resize-handle--bottom-right {
3600
+ width: 18px;
3601
+ height: 18px;
3602
+ }
3603
+ .pluno-pa-widget__resize-handle--top-left {
3604
+ top: -7px;
3605
+ left: -7px;
3606
+ cursor: nwse-resize;
3607
+ }
3608
+ .pluno-pa-widget__resize-handle--top-right {
3609
+ top: -7px;
3610
+ right: -7px;
3611
+ cursor: nesw-resize;
3612
+ }
3613
+ .pluno-pa-widget__resize-handle--bottom-left {
3614
+ bottom: -7px;
3615
+ left: -7px;
3616
+ cursor: nesw-resize;
3617
+ }
3618
+ .pluno-pa-widget__resize-handle--bottom-right {
3619
+ bottom: -7px;
3620
+ right: -7px;
3621
+ cursor: nwse-resize;
3622
+ }
3623
+ .pluno-pa-widget--resizing,
3624
+ .pluno-pa-widget--resizing .pluno-pa-widget__panel,
3625
+ .pluno-pa-widget--resizing .pluno-pa-widget__timeline,
3626
+ .pluno-pa-widget--resizing .pluno-pa-widget__input {
3627
+ user-select: none;
3628
+ }
3629
+ .pluno-pa-widget--resizing .pluno-pa-widget__panel {
3630
+ transition: none;
3631
+ }
3310
3632
  .pluno-pa-widget__close {
3311
3633
  position: absolute;
3312
3634
  left: calc(var(--pluno-pa-panel-offset-x) + var(--pluno-pa-panel-width) - 32px);
@@ -4016,7 +4338,7 @@ function Nn(e, t) {
4016
4338
  place-items: center;
4017
4339
  padding: 18px;
4018
4340
  background: rgba(24, 24, 27, 0.28);
4019
- font-family: var(--pluno-pa-font, ${Q.fontFamily});
4341
+ font-family: var(--pluno-pa-font, ${oe.fontFamily});
4020
4342
  color: var(--pluno-pa-text);
4021
4343
  }
4022
4344
  .pluno-pa-widget__share-dialog {
@@ -4804,8 +5126,8 @@ function Nn(e, t) {
4804
5126
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
4805
5127
  position: absolute;
4806
5128
  top: -16px;
4807
- left: 16px;
4808
- width: min(416px, calc(100% - 30px));
5129
+ left: ${qt}px;
5130
+ width: calc(100% - ${qt * 2}px);
4809
5131
  height: 36px;
4810
5132
  z-index: 3;
4811
5133
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5153,28 +5475,28 @@ function Nn(e, t) {
5153
5475
  filter: url(#pluno-pa-scribble-wobble-2);
5154
5476
  }
5155
5477
  `;
5156
- if (Wa(e, o))
5478
+ if (pr(e, n))
5157
5479
  return;
5158
- const n = e.ownerDocument.createElement("style");
5159
- n.id = Wn, n.textContent = o, e.appendChild(n), oo(e);
5480
+ const o = e.ownerDocument.createElement("style");
5481
+ o.id = io, o.textContent = n, e.appendChild(o), xo(e);
5160
5482
  }
5161
- function Ha(e) {
5162
- return e.getElementById(Wn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gn) === "true";
5483
+ function lr(e) {
5484
+ return e.getElementById(io) !== null || e.host instanceof HTMLElement && e.host.getAttribute(ao) === "true";
5163
5485
  }
5164
- function oo(e) {
5165
- e.host instanceof HTMLElement && e.host.setAttribute(Gn, "true");
5486
+ function xo(e) {
5487
+ e.host instanceof HTMLElement && e.host.setAttribute(ao, "true");
5166
5488
  }
5167
- function Wa(e, t) {
5489
+ function pr(e, t) {
5168
5490
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5169
5491
  return !1;
5170
5492
  try {
5171
- const o = new CSSStyleSheet();
5172
- return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], oo(e), !0;
5493
+ const n = new CSSStyleSheet();
5494
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], xo(e), !0;
5173
5495
  } catch {
5174
5496
  return !1;
5175
5497
  }
5176
5498
  }
5177
- async function Ga() {
5499
+ async function sr() {
5178
5500
  return document.body ? document.body : await new Promise((e) => {
5179
5501
  const t = new MutationObserver(() => {
5180
5502
  document.body && (t.disconnect(), e(document.body));
@@ -5182,41 +5504,42 @@ async function Ga() {
5182
5504
  t.observe(document.documentElement, { childList: !0 });
5183
5505
  });
5184
5506
  }
5185
- function io(e) {
5507
+ function yo(e) {
5186
5508
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5187
5509
  }
5188
- function $a(e) {
5510
+ function dr(e) {
5189
5511
  try {
5190
- const t = window.localStorage.getItem(io(e));
5512
+ const t = window.localStorage.getItem(yo(e));
5191
5513
  if (!t)
5192
- return Tn();
5193
- const o = JSON.parse(t);
5514
+ return qn();
5515
+ const n = JSON.parse(t);
5194
5516
  return {
5195
- isOpen: o.isOpen === !0,
5196
- composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
5197
- focusedInput: o.focusedInput === "composer" || o.focusedInput === "launcher" ? o.focusedInput : null,
5198
- focusedInputAt: typeof o.focusedInputAt == "number" ? o.focusedInputAt : null,
5199
- openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
5200
- (n) => typeof n == "string"
5517
+ isOpen: n.isOpen === !0,
5518
+ composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
5519
+ focusedInput: n.focusedInput === "composer" || n.focusedInput === "launcher" ? n.focusedInput : null,
5520
+ focusedInputAt: typeof n.focusedInputAt == "number" ? n.focusedInputAt : null,
5521
+ openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5522
+ (o) => typeof o == "string"
5201
5523
  ) : [],
5202
- launcherPosition: Ka(o.launcherPosition) ? o.launcherPosition : null,
5203
- seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-On) : [],
5204
- sharePromptsDisabled: o.sharePromptsDisabled === !0
5524
+ launcherPosition: hr(n.launcherPosition) ? n.launcherPosition : null,
5525
+ panelSize: mr(n.panelSize) ? ut(n.panelSize) : null,
5526
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Zn) : [],
5527
+ sharePromptsDisabled: n.sharePromptsDisabled === !0
5205
5528
  };
5206
5529
  } catch {
5207
- return Tn();
5530
+ return qn();
5208
5531
  }
5209
5532
  }
5210
- async function qa(e) {
5533
+ async function cr(e) {
5211
5534
  if (e.loadSharePromptsDisabled)
5212
5535
  return e.loadSharePromptsDisabled();
5213
5536
  try {
5214
- return window.localStorage.getItem(Un) === "true";
5537
+ return window.localStorage.getItem(Jn) === "true";
5215
5538
  } catch {
5216
5539
  return !1;
5217
5540
  }
5218
5541
  }
5219
- function ja(e, t) {
5542
+ function ur(e, t) {
5220
5543
  if (e.persistSharePromptsDisabled) {
5221
5544
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5222
5545
  () => {
@@ -5225,12 +5548,12 @@ function ja(e, t) {
5225
5548
  return;
5226
5549
  }
5227
5550
  try {
5228
- t && window.localStorage.setItem(Un, "true");
5551
+ t && window.localStorage.setItem(Jn, "true");
5229
5552
  } catch {
5230
5553
  return;
5231
5554
  }
5232
5555
  }
5233
- function Tn() {
5556
+ function qn() {
5234
5557
  return {
5235
5558
  isOpen: !1,
5236
5559
  composerValue: "",
@@ -5238,52 +5561,59 @@ function Tn() {
5238
5561
  focusedInputAt: null,
5239
5562
  openToolGroupKeys: [],
5240
5563
  launcherPosition: null,
5564
+ panelSize: null,
5241
5565
  seenShareCandidateIds: [],
5242
5566
  sharePromptsDisabled: !1
5243
5567
  };
5244
5568
  }
5245
- function Va(e, t) {
5569
+ function gr(e, t) {
5246
5570
  try {
5247
5571
  window.localStorage.setItem(
5248
- io(e),
5572
+ yo(e),
5249
5573
  JSON.stringify(t)
5250
5574
  );
5251
5575
  } catch {
5252
5576
  return;
5253
5577
  }
5254
5578
  }
5255
- function Ka(e) {
5579
+ function hr(e) {
5256
5580
  if (!e || typeof e != "object")
5257
5581
  return !1;
5258
5582
  const t = e;
5259
5583
  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");
5260
5584
  }
5261
- const Pn = /* @__PURE__ */ new WeakSet();
5262
- function Ya(e) {
5585
+ function mr(e) {
5586
+ if (!e || typeof e != "object")
5587
+ return !1;
5588
+ const t = e;
5589
+ return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5590
+ }
5591
+ const jn = /* @__PURE__ */ new WeakSet();
5592
+ function fr(e) {
5263
5593
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5264
5594
  }
5265
- function Dn(e) {
5595
+ function Vn(e) {
5266
5596
  const t = e.pathname.split("/");
5267
5597
  return t[t.length - 1] ?? "";
5268
5598
  }
5269
- function Xa(e, t) {
5270
- const o = new URL(e.src, document.baseURI);
5271
- return o.href === t.href || o.pathname === t.pathname ? !0 : Dn(o) === Dn(t);
5272
- }
5273
- class re extends EventTarget {
5274
- constructor(t, o) {
5275
- super(), this.channelId = o, this.url = t, this.addPreviewListener(Zo, () => {
5276
- this.readyState = re.OPEN, this.dispatchEvent(new Event("open"));
5277
- }), this.addPreviewListener(Jo, (n) => {
5278
- const i = n;
5599
+ function wr(e, t) {
5600
+ const n = new URL(e.src, document.baseURI);
5601
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Vn(n) === Vn(t);
5602
+ }
5603
+ class se extends EventTarget {
5604
+ constructor(t, n) {
5605
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(_i, () => {
5606
+ this.readyState = se.OPEN, this.dispatchEvent(new Event("open"));
5607
+ }), this.addPreviewListener(xi, (o) => {
5608
+ const i = o;
5279
5609
  this.dispatchEvent(
5280
5610
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5281
5611
  );
5282
- }), this.addPreviewListener(Qo, () => {
5283
- this.readyState = re.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5284
- }), this.addPreviewListener(ei, (n) => {
5285
- const i = n;
5286
- this.readyState = re.CLOSED, this.dispatchEvent(
5612
+ }), this.addPreviewListener(yi, () => {
5613
+ this.readyState = se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5614
+ }), this.addPreviewListener(vi, (o) => {
5615
+ const i = o;
5616
+ this.readyState = se.CLOSED, this.dispatchEvent(
5287
5617
  new CloseEvent("close", {
5288
5618
  code: i.detail?.code ?? 1e3,
5289
5619
  reason: i.detail?.reason ?? "",
@@ -5292,8 +5622,8 @@ class re extends EventTarget {
5292
5622
  ), this.cleanup();
5293
5623
  }), window.dispatchEvent(
5294
5624
  new CustomEvent(
5295
- tt(
5296
- Ko,
5625
+ rt(
5626
+ fi,
5297
5627
  this.channelId
5298
5628
  ),
5299
5629
  {
@@ -5312,18 +5642,18 @@ class re extends EventTarget {
5312
5642
  extensions = "";
5313
5643
  binaryType = "blob";
5314
5644
  bufferedAmount = 0;
5315
- readyState = re.CONNECTING;
5316
- socketId = Za();
5645
+ readyState = se.CONNECTING;
5646
+ socketId = br();
5317
5647
  listeners = /* @__PURE__ */ new Map();
5318
5648
  send(t) {
5319
- if (this.readyState !== re.OPEN)
5649
+ if (this.readyState !== se.OPEN)
5320
5650
  throw new DOMException(
5321
5651
  "Pluno preview websocket is not open",
5322
5652
  "InvalidStateError"
5323
5653
  );
5324
5654
  window.dispatchEvent(
5325
5655
  new CustomEvent(
5326
- tt(Yo, this.channelId),
5656
+ rt(wi, this.channelId),
5327
5657
  {
5328
5658
  detail: {
5329
5659
  socketId: this.socketId,
@@ -5333,78 +5663,78 @@ class re extends EventTarget {
5333
5663
  )
5334
5664
  );
5335
5665
  }
5336
- close(t, o) {
5337
- this.readyState !== re.CLOSED && (this.readyState = re.CLOSING, window.dispatchEvent(
5666
+ close(t, n) {
5667
+ this.readyState !== se.CLOSED && (this.readyState = se.CLOSING, window.dispatchEvent(
5338
5668
  new CustomEvent(
5339
- tt(Xo, this.channelId),
5669
+ rt(bi, this.channelId),
5340
5670
  {
5341
- detail: { socketId: this.socketId, code: t, reason: o }
5671
+ detail: { socketId: this.socketId, code: t, reason: n }
5342
5672
  }
5343
5673
  )
5344
5674
  ), this.cleanup());
5345
5675
  }
5346
- addPreviewListener(t, o) {
5347
- const n = tt(
5676
+ addPreviewListener(t, n) {
5677
+ const o = rt(
5348
5678
  t,
5349
5679
  this.channelId
5350
5680
  ), i = (r) => {
5351
- r.detail?.socketId === this.socketId && o(r);
5681
+ r.detail?.socketId === this.socketId && n(r);
5352
5682
  };
5353
- this.listeners.set(n, i), window.addEventListener(n, i);
5683
+ this.listeners.set(o, i), window.addEventListener(o, i);
5354
5684
  }
5355
5685
  cleanup() {
5356
- for (const [t, o] of this.listeners.entries())
5357
- window.removeEventListener(t, o);
5686
+ for (const [t, n] of this.listeners.entries())
5687
+ window.removeEventListener(t, n);
5358
5688
  this.listeners.clear();
5359
5689
  }
5360
5690
  }
5361
- function Za() {
5691
+ function br() {
5362
5692
  const e = window.sessionStorage.getItem(
5363
- rn
5693
+ yn
5364
5694
  );
5365
5695
  if (e)
5366
5696
  return e;
5367
5697
  const t = crypto.randomUUID();
5368
- return window.sessionStorage.setItem(rn, t), t;
5698
+ return window.sessionStorage.setItem(yn, t), t;
5369
5699
  }
5370
- function tt(e, t) {
5700
+ function rt(e, t) {
5371
5701
  return `${e}:${t}`;
5372
5702
  }
5373
- function Ja(e) {
5703
+ function _r(e) {
5374
5704
  const t = document.currentScript;
5375
5705
  if (t instanceof HTMLScriptElement)
5376
5706
  return [t];
5377
- const o = new URL(e, document.baseURI).href, n = new URL(o);
5707
+ const n = new URL(e, document.baseURI).href, o = new URL(n);
5378
5708
  return Array.from(
5379
5709
  document.querySelectorAll("script[type='module'][src]")
5380
5710
  ).filter(
5381
- (i) => i instanceof HTMLScriptElement && Ya(i) && Xa(i, n)
5711
+ (i) => i instanceof HTMLScriptElement && fr(i) && wr(i, o)
5382
5712
  );
5383
5713
  }
5384
- function Qa(e) {
5385
- for (const t of Ja(e)) {
5386
- if (Pn.has(t) || t.dataset.plunoAutoMount === "false")
5714
+ function xr(e) {
5715
+ for (const t of _r(e)) {
5716
+ if (jn.has(t) || t.dataset.plunoAutoMount === "false")
5387
5717
  continue;
5388
- Pn.add(t);
5389
- const o = t.dataset.plunoPreviewChannel;
5390
- ki({
5718
+ jn.add(t);
5719
+ const n = t.dataset.plunoPreviewChannel;
5720
+ qi({
5391
5721
  token: t.dataset.plunoToken,
5392
5722
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
5393
5723
  backendUrl: t.dataset.plunoBackendUrl,
5394
- webSocketFactory: o ? Ei(o) : void 0,
5724
+ webSocketFactory: n ? $i(n) : void 0,
5395
5725
  launcherLabel: t.dataset.plunoLauncherLabel,
5396
5726
  accentColor: t.dataset.plunoAccentColor,
5397
5727
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5398
5728
  fontFamily: t.dataset.plunoFontFamily,
5399
5729
  scribbleStyle: t.dataset.plunoScribbleStyle === "true",
5400
5730
  position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5401
- }).catch((n) => {
5402
- console.error("Failed to mount Pluno widget", n);
5731
+ }).catch((o) => {
5732
+ console.error("Failed to mount Pluno widget", o);
5403
5733
  });
5404
5734
  }
5405
5735
  }
5406
- Qa(import.meta.url);
5736
+ xr(import.meta.url);
5407
5737
  export {
5408
- Ei as createProductAgentPreviewBridgeWebSocketFactory,
5409
- ki as mountPlunoProductAgentWidget
5738
+ $i as createProductAgentPreviewBridgeWebSocketFactory,
5739
+ qi as mountPlunoProductAgentWidget
5410
5740
  };