@pluno/product-agent-web 0.1.72 → 0.1.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,26 @@
1
- import { PlunoProductAgent as Jo, getProductAgentOriginAccessErrorMessage as Qo } from "./product-agent-sdk.js";
2
- const ei = "#7c3aed", dt = "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", ct = "#2c2a1e", yn = [253, 250, 241], vn = 3.5;
3
- function eo(e) {
4
- const t = to(e);
5
- if (Cn(Xe(t), yn) >= vn)
1
+ import { PlunoProductAgent as ti, getProductAgentOriginAccessErrorMessage as ni } from "./product-agent-sdk.js";
2
+ const oi = "#7c3aed", mt = "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", ft = "#2c2a1e", Pn = [253, 250, 241], Tn = 3.5;
3
+ function lo(e) {
4
+ const t = po(e);
5
+ if (In(ot(t), Pn) >= Tn)
6
6
  return t;
7
- let o = Xe(t);
8
- const i = Xe(ct);
9
- for (let a = 0; a < 6; a += 1)
10
- if (o = oi(o, i, 0.22), Cn(o, yn) >= vn)
11
- return Gt(o);
12
- return Gt(o);
13
- }
14
- function ti() {
7
+ let o = ot(t);
8
+ const i = ot(ft);
9
+ for (let r = 0; r < 6; r += 1)
10
+ if (o = ri(o, i, 0.22), In(o, Pn) >= Tn)
11
+ return Xt(o);
12
+ return Xt(o);
13
+ }
14
+ function ii() {
15
15
  let n = "M 280 120", o = !1, i = 0;
16
- for (let a = 150; a <= 1170; a += 62) {
16
+ for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
- n += ` L ${p} ${a}`, o = !o, i += 1;
18
+ n += ` L ${p} ${r}`, o = !o, i += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function ni(e) {
23
- const t = to(e), n = $t(Xe(t));
22
+ function ai(e) {
23
+ const t = po(e), n = Zt(ot(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,90 +44,90 @@ function ni(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: te(t, 0.28, -0.03),
48
- middle: te(t, 0.08, 0.04),
49
- bottom: te(t, -0.1, 0.02),
50
- edgeStart: te(t, 0.08, 0.08),
51
- edgeMiddle: te(t, -0.08, 0.08),
52
- edgeEnd: te(t, -0.18, 0.05),
53
- glow: te(t, 0.32, -0.12),
54
- highlight: te(t, 0.38, -0.18),
55
- inner: te(t, 0.24, -0.1),
56
- shadow: te(t, -0.25, -0.08)
47
+ top: ie(t, 0.28, -0.03),
48
+ middle: ie(t, 0.08, 0.04),
49
+ bottom: ie(t, -0.1, 0.02),
50
+ edgeStart: ie(t, 0.08, 0.08),
51
+ edgeMiddle: ie(t, -0.08, 0.08),
52
+ edgeEnd: ie(t, -0.18, 0.05),
53
+ glow: ie(t, 0.32, -0.12),
54
+ highlight: ie(t, 0.38, -0.18),
55
+ inner: ie(t, 0.24, -0.1),
56
+ shadow: ie(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function to(e) {
59
+ function po(e) {
60
60
  const t = e.trim();
61
- return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ei;
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()}` : oi;
62
62
  }
63
- function Xe(e) {
63
+ function ot(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 Gt([e, t, n]) {
70
+ function Xt([e, t, n]) {
71
71
  const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function $t([e, t, n]) {
74
+ function Zt([e, t, n]) {
75
75
  const o = (i) => {
76
- const a = i / 255;
77
- return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
76
+ const r = i / 255;
77
+ return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function Cn(e, t) {
82
- const n = $t(e), o = $t(t), [i, a] = n > o ? [n, o] : [o, n];
83
- return (i + 0.05) / (a + 0.05);
81
+ function In(e, t) {
82
+ const n = Zt(e), o = Zt(t), [i, r] = n > o ? [n, o] : [o, n];
83
+ return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function oi(e, t, n) {
86
- const o = qt(n);
85
+ function ri(e, t, n) {
86
+ const o = Jt(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
90
90
  e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function te(e, t, n) {
94
- const [o, i, a] = ii(Xe(e));
95
- return Gt(ai(o, qt(i + n), qt(a + t)));
93
+ function ie(e, t, n) {
94
+ const [o, i, r] = li(ot(e));
95
+ return Xt(pi(o, Jt(i + n), Jt(r + t)));
96
96
  }
97
- function ii([e, t, n]) {
98
- const o = e / 255, i = t / 255, a = n / 255, l = Math.max(o, i, a), p = Math.min(o, i, a), d = (l + p) / 2;
97
+ function li([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), s = (l + p) / 2;
99
99
  if (l === p)
100
- return [0, 0, d];
101
- const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
- return [(l === o ? (i - a) / c + (i < a ? 6 : 0) : l === i ? (a - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
100
+ return [0, 0, s];
101
+ const c = l - p, u = s > 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, s];
103
103
  }
104
- function ai(e, t, n) {
104
+ function pi(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- Nt(i, o, e + 1 / 3) * 255,
110
- Nt(i, o, e) * 255,
111
- Nt(i, o, e - 1 / 3) * 255
109
+ Bt(i, o, e + 1 / 3) * 255,
110
+ Bt(i, o, e) * 255,
111
+ Bt(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function Nt(e, t, n) {
114
+ function Bt(e, t, n) {
115
115
  let o = n;
116
116
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
117
117
  }
118
- function qt(e) {
118
+ function Jt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const no = "suggest_share_on_socials";
122
- function ri(e) {
121
+ const so = "suggest_share_on_socials";
122
+ function si(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const n = e[t];
125
- if (n.role !== "tool" || n.toolName !== no)
125
+ if (n.role !== "tool" || n.toolName !== so)
126
126
  continue;
127
- const o = Sn(e, t, "assistant");
127
+ const o = An(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const i = Sn(e, o.index, "user");
130
+ const i = An(e, o.index, "user");
131
131
  return i ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: i.content,
@@ -136,13 +136,13 @@ function ri(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function li(e) {
140
- const t = await pi(e);
139
+ async function di(e) {
140
+ const t = await ci(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 Sn(e, t, n) {
145
+ function An(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
147
  const i = e[o];
148
148
  if (i.role === n && i.content.trim())
@@ -150,81 +150,81 @@ function Sn(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function pi(e) {
153
+ async function ci(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const si = "https://app.pluno.ai", di = "/api/product-agent/embed/active-users", ci = 1800, ui = 15e3, gi = 250, hi = 1e3, mi = 3e4;
157
- function fi(e, t = {}) {
158
- let n = !1, o = null, i = null, a = null;
156
+ const ui = "https://app.pluno.ai", gi = "/api/product-agent/embed/active-users", hi = 1800, mi = 15e3, fi = 250, wi = 1e3, bi = 3e4;
157
+ function _i(e, t = {}) {
158
+ let n = !1, o = null, i = null, r = null;
159
159
  const l = () => {
160
- a !== null && (window.clearInterval(a), a = null);
160
+ r !== null && (window.clearInterval(r), r = null);
161
161
  }, p = (u) => {
162
162
  n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  c();
164
- }, _i(u)));
165
- }, d = (u) => {
164
+ }, vi(u)));
165
+ }, s = (u) => {
166
166
  if (l(), o === null) {
167
167
  o = u, e(u);
168
168
  return;
169
169
  }
170
170
  const m = o, k = performance.now();
171
- a = window.setInterval(() => {
171
+ r = window.setInterval(() => {
172
172
  if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const v = Math.min(1, (performance.now() - k) / ci);
177
- o = Math.round(m + (u - m) * xi(v)), e(o), v >= 1 && (o = u, e(u), l());
178
- }, gi);
176
+ const v = Math.min(1, (performance.now() - k) / hi);
177
+ o = Math.round(m + (u - m) * Ci(v)), e(o), v >= 1 && (o = u, e(u), l());
178
+ }, fi);
179
179
  }, c = async () => {
180
180
  try {
181
- const u = await wi(t);
181
+ const u = await xi(t);
182
182
  if (n)
183
183
  return;
184
- d(u.count), p(u.refreshAfterMs);
184
+ s(u.count), p(u.refreshAfterMs);
185
185
  } catch {
186
- p(ui);
186
+ p(mi);
187
187
  }
188
188
  };
189
189
  return c(), () => {
190
190
  n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function wi(e) {
193
+ async function xi(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(di, bi(e.backendUrl ?? si)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(gi, yi(e.backendUrl ?? ui)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const o = await n.json(), i = En(o.count), a = En(o.refreshAfterMs ?? o.refresh_after_ms);
203
- if (i === null || a === null)
202
+ const o = await n.json(), i = Nn(o.count), r = Nn(o.refreshAfterMs ?? o.refresh_after_ms);
203
+ if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
- return { count: i, refreshAfterMs: a };
205
+ return { count: i, refreshAfterMs: r };
206
206
  }
207
- function En(e) {
207
+ function Nn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function bi(e) {
210
+ function yi(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function _i(e) {
214
- return Math.min(mi, Math.max(hi, e));
213
+ function vi(e) {
214
+ return Math.min(bi, Math.max(wi, e));
215
215
  }
216
- function xi(e) {
216
+ function Ci(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const oo = 100, yi = 1e4, vi = 5e3, Ci = "product-agent:sdk-preview-socket-connect", Si = "product-agent:sdk-preview-socket-send", Ei = "product-agent:sdk-preview-socket-close", ki = "product-agent:sdk-preview-socket-open", Li = "product-agent:sdk-preview-socket-message", Pi = "product-agent:sdk-preview-socket-error", Ii = "product-agent:sdk-preview-socket-closed", kn = "product-agent:sdk-preview-socket-id", Ti = "data-pluno-sdk-preview-channel", io = "data-pluno-auto-mounted", se = "__plunoProductAgentAutoMountOwner", Ai = 1e4, Ni = "Failed to load Pluno widget token", Ln = "Timed out loading Pluno widget token", Di = "pluno.productAgent.widgetClientId.", Dt = /* @__PURE__ */ new Set(), Ri = "product-agent:preview-diagnostic", ao = "pluno.productAgent.sharePromptsDisabled", Mi = 3, Pn = 'dialog[open], [aria-modal="true"], [role="dialog"]', zi = 400, Oi = 5e3, Ui = 500, In = "Close the page's popup to chat", Bi = "No recent chats for this page yet.", ne = {
219
+ const co = 100, Si = 1e4, Ei = 5e3, ki = "product-agent:sdk-preview-socket-connect", Li = "product-agent:sdk-preview-socket-send", Pi = "product-agent:sdk-preview-socket-close", Ti = "product-agent:sdk-preview-socket-open", Ii = "product-agent:sdk-preview-socket-message", Ai = "product-agent:sdk-preview-socket-error", Ni = "product-agent:sdk-preview-socket-closed", Rn = "product-agent:sdk-preview-socket-id", Ri = "data-pluno-sdk-preview-channel", uo = "data-pluno-auto-mounted", ue = "__plunoProductAgentAutoMountOwner", Di = 1e4, Mi = "Failed to load Pluno widget token", Dn = "Timed out loading Pluno widget token", zi = "pluno.productAgent.widgetClientId.", Ft = /* @__PURE__ */ new Set(), Oi = "product-agent:preview-diagnostic", go = "pluno.productAgent.sharePromptsDisabled", Ui = 3, Mn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Bi = 400, Fi = 5e3, Hi = 500, zn = "Close the page's popup to chat", Wi = "No recent chats for this page yet.", ae = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
223
223
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
224
224
  scribbleStyle: !0,
225
225
  position: "bottom-right",
226
- movableLauncher: !1
227
- }, Fi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tn = "pluno-pa-scribble-font", ro = 190, lo = 41, An = 22, Hi = 16, Wi = 24, Gi = 1, $i = 48, tn = 420, qi = 520, ji = 0.24, nn = 680, Vi = 800, Ki = 0.76, T = 8, ke = 50, po = "http://www.w3.org/2000/svg", jt = 26, Vt = 8, Yi = 36, Kt = 16, Xi = 4, Nn = [
226
+ movableLauncher: !0
227
+ }, Gi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', On = "pluno-pa-scribble-font", ho = 190, mo = 41, Un = 22, $i = 16, qi = 24, ji = 1, Vi = 48, sn = 420, Ki = 520, Yi = 0.24, dn = 680, Xi = 800, Zi = 0.76, I = 8, Ie = 50, fo = "http://www.w3.org/2000/svg", Qt = 26, en = 8, Ji = 36, tn = 16, Qi = 4, Bn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const oo = 100, yi = 1e4, vi = 5e3, Ci = "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
- ], Zi = 11, Ji = 13, Yt = 4, so = 10, co = 40, Qi = "movable-launcher-position-v2", uo = "pluno-pa-widget-styles", go = "data-pluno-pa-widget-styles";
265
- let Dn = 0;
266
- function ea(e) {
267
- return (t) => new de(t, e);
264
+ ], ea = 11, ta = 13, nn = 4, wo = 10, bo = 40, na = "movable-launcher-position-v2", _o = "pluno-pa-widget-styles", xo = "data-pluno-pa-widget-styles";
265
+ let Fn = 0;
266
+ function oa(e) {
267
+ return (t) => new ge(t, e);
268
268
  }
269
- async function ta(e = {}) {
269
+ async function ia(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? ne.launcherLabel,
272
- accentColor: e.accentColor ?? ne.accentColor,
273
- colorScheme: e.colorScheme ?? ne.colorScheme,
274
- fontFamily: e.fontFamily ?? ne.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? ne.scribbleStyle,
276
- position: e.position ?? ne.position,
277
- movableLauncher: e.movableLauncher ?? ne.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? ae.launcherLabel,
272
+ accentColor: e.accentColor ?? ae.accentColor,
273
+ colorScheme: e.colorScheme ?? ae.colorScheme,
274
+ fontFamily: e.fontFamily ?? ae.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? ae.scribbleStyle,
276
+ position: e.position ?? ae.position,
277
+ movableLauncher: e.movableLauncher ?? ae.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -306,9 +306,12 @@ async function ta(e = {}) {
306
306
  onDisplayStateChange: e.onDisplayStateChange,
307
307
  onPanelOpenChange: e.onPanelOpenChange,
308
308
  showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0,
309
+ morningReport: e.morningReport ?? null,
310
+ onMorningReportSnooze: e.onMorningReportSnooze,
311
+ onMorningReportTaskStart: e.onMorningReportTaskStart,
309
312
  taskNotifications: e.taskNotifications
310
313
  };
311
- Q(
314
+ te(
312
315
  "web-sdk.widget",
313
316
  "Mounting widget with merged options",
314
317
  {
@@ -325,141 +328,142 @@ async function ta(e = {}) {
325
328
  );
326
329
  const n = document.createElement("div");
327
330
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
328
- Ti,
331
+ Ri,
329
332
  t.sdkPreviewChannelId
330
333
  );
331
334
  const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
332
335
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
333
- let a = Rn(
336
+ let r = Hn(
334
337
  t.accentColor,
335
338
  t.scribbleStyle
336
339
  );
337
- Sa(
340
+ La(
338
341
  i,
339
342
  t.launcherLabel,
340
- a,
343
+ r,
341
344
  t.movableLauncher,
342
345
  t.showLauncherMinimizeButton
343
346
  ), o.appendChild(i);
344
- const l = yr(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"), Ee(
347
+ const l = Sr(t);
348
+ let p = t.movableLauncher ? l.launcherPosition : null, s = p !== null, c = l.panelSize, u = null;
349
+ 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"), Te(
347
350
  i,
348
- Mt(
351
+ Wt(
349
352
  i,
350
353
  p,
351
354
  t.position
352
355
  )
353
- )), Xn(o, t.accentColor), Mn(i, a, {
356
+ )), oo(o, t.accentColor), Wn(i, r, {
354
357
  accentColor: t.accentColor,
355
358
  colorScheme: t.colorScheme,
356
359
  fontFamily: t.fontFamily,
357
360
  scribbleStyle: t.scribbleStyle
358
361
  });
359
- const m = await _r(), k = m.ownerDocument, v = i.querySelector(
362
+ const m = await vr(), k = m.ownerDocument, v = i.querySelector(
360
363
  ".pluno-pa-widget__launcher"
361
364
  ), D = i.querySelector(
362
365
  ".pluno-pa-widget__launcher-drag-handle"
363
- ), S = i.querySelector(
366
+ ), C = i.querySelector(
364
367
  ".pluno-pa-widget__launcher-input"
365
368
  ), g = i.querySelector(
366
369
  ".pluno-pa-widget__launcher-minimize"
367
- ), x = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
370
+ ), y = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
368
371
  ".pluno-pa-widget__scribble-spirals--panel"
369
- ), A = Array.from(
372
+ ), S = Array.from(
370
373
  i.querySelectorAll(".pluno-pa-widget__resize-handle")
371
- ), I = i.querySelector(
374
+ ), A = i.querySelector(
372
375
  ".pluno-pa-widget__close"
373
- ), R = i.querySelector(
376
+ ), N = i.querySelector(
374
377
  ".pluno-pa-widget__composer"
375
- ), P = i.querySelector(
378
+ ), q = i.querySelector(
376
379
  ".pluno-pa-widget__attachment-error"
377
- ), Oe = i.querySelector(
380
+ ), xe = i.querySelector(
378
381
  ".pluno-pa-widget__billing-status"
379
- ), $ = i.querySelector(
382
+ ), We = i.querySelector(
380
383
  ".pluno-pa-widget__attachments"
381
- ), U = i.querySelector(
384
+ ), z = i.querySelector(
382
385
  ".pluno-pa-widget__attachment-input"
383
- ), ce = i.querySelector(
386
+ ), Ge = i.querySelector(
384
387
  ".pluno-pa-widget__attach"
385
- ), y = i.querySelector(
388
+ ), w = i.querySelector(
386
389
  ".pluno-pa-widget__input"
387
- ), ee = i.querySelector(
390
+ ), U = i.querySelector(
388
391
  ".pluno-pa-widget__send"
389
- ), Ze = i.querySelector(
392
+ ), ye = i.querySelector(
390
393
  ".pluno-pa-widget__top-actions"
391
- ), _e = i.querySelector(
394
+ ), ve = i.querySelector(
392
395
  ".pluno-pa-widget__history"
393
- ), ue = i.querySelector(
396
+ ), Ae = i.querySelector(
394
397
  ".pluno-pa-widget__history-panel"
395
- ), w = i.querySelector(
398
+ ), V = i.querySelector(
396
399
  ".pluno-pa-widget__history-list"
397
- ), z = i.querySelector(
400
+ ), it = i.querySelector(
398
401
  ".pluno-pa-widget__history-close"
399
- ), H = i.querySelector(
402
+ ), ne = i.querySelector(
400
403
  ".pluno-pa-widget__history-status"
401
- ), q = i.querySelector(
404
+ ), x = i.querySelector(
402
405
  ".pluno-pa-widget__timeline-jump"
403
- ), N = i.querySelector(
406
+ ), M = i.querySelector(
404
407
  ".pluno-pa-widget__active-users-counter"
405
- ), C = i.querySelector(
408
+ ), T = i.querySelector(
406
409
  ".pluno-pa-widget__timeline"
407
- ), re = i.querySelector(
410
+ ), oe = i.querySelector(
408
411
  ".pluno-pa-widget__timeline-bottom-sentinel"
409
- ), Ue = i.querySelector(
412
+ ), W = i.querySelector(
410
413
  ".pluno-pa-widget__notify-suggestion"
411
- ), Ao = i.querySelector(
414
+ ), L = i.querySelector(
412
415
  ".pluno-pa-widget__notify-suggestion-enable"
413
- ), No = i.querySelector(
416
+ ), R = i.querySelector(
414
417
  ".pluno-pa-widget__notify-suggestion-later"
415
- ), Do = i.querySelector(
418
+ ), Uo = i.querySelector(
416
419
  ".pluno-pa-widget__notify-suggestion-never"
417
420
  );
418
- if (!v || !S || !x || !I || !R || !P || !Oe || !$ || !U || !ce || !y || !ee || !Ze || !_e || !ue || !w || !z || !H || !q || !N || !C || !re)
421
+ if (!v || !C || !y || !A || !N || !q || !xe || !We || !z || !Ge || !w || !U || !ye || !ve || !Ae || !V || !it || !ne || !x || !M || !T || !oe)
419
422
  throw new Error("Failed to mount Pluno widget");
420
423
  if (t.movableLauncher && !D)
421
424
  throw new Error("Failed to mount Pluno widget drag handle");
422
- Wn(S), Wn(y);
423
- let W = [], le = null;
424
- const Le = () => {
425
- Ga(
426
- $,
427
- W,
428
- (r) => {
429
- W = W.filter(
430
- (s, b) => b !== r
431
- ), Le(), G(_.getState()), j();
425
+ Yn(C), Yn(w);
426
+ let j = [], se = null;
427
+ const Ne = () => {
428
+ ja(
429
+ We,
430
+ j,
431
+ (a) => {
432
+ j = j.filter(
433
+ (d, _) => _ !== a
434
+ ), Ne(), H(b.getState()), G();
432
435
  }
433
436
  );
434
- }, Ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
435
- if (!t.tokenEndpoint)
436
- throw new Error("Pluno widget requires token or tokenEndpoint");
437
- return Io(t.tokenEndpoint);
438
- }), Mo = window.fetch.bind(window), ft = xr(t.clientId);
439
- let _;
437
+ }, gn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => zo(t.tokenEndpoint) : void 0);
438
+ if (!t.loginRequired && !t.signupRequired && !t.token && !gn && !t.webSocketFactory)
439
+ throw new Error("Pluno widget requires token or tokenEndpoint");
440
+ const Bo = window.fetch.bind(window), yt = Cr(t.clientId);
441
+ let b;
440
442
  try {
441
- const r = {
443
+ const a = {
442
444
  token: t.token,
443
- tokenProvider: Ro,
445
+ tokenProvider: gn,
444
446
  backendUrl: t.backendUrl,
445
447
  metadata: () => ({
446
448
  ...t.metadata ?? {},
447
- ...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
449
+ ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
448
450
  }),
449
451
  initialStarterPrompts: t.initialStarterPrompts,
450
- clientId: ft.clientId,
452
+ clientId: yt.clientId,
451
453
  restorePersistedState: t.restorePersistedState,
452
454
  expectedPersistedSessionId: t.expectedPersistedSessionId,
453
455
  webSocketFactory: t.webSocketFactory,
454
456
  prepareAttachmentUpload: t.prepareAttachmentUpload,
455
- autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0,
457
+ // The launcher is useful before a customer token endpoint responds. The widget owns connection
458
+ // startup after mounting so credential/network latency never keeps the visible shell detached.
459
+ autoConnect: !1,
456
460
  disableNetworkCapture: !!t.sdkPreviewChannelId
457
461
  };
458
- _ = await Jo.init(r);
459
- } catch (r) {
460
- throw ft.release(), n.remove(), r;
462
+ b = await ti.init(a);
463
+ } catch (a) {
464
+ throw yt.release(), n.remove(), a;
461
465
  }
462
- m.appendChild(n), Q(
466
+ m.appendChild(n), te(
463
467
  "web-sdk.widget",
464
468
  "Applied initial widget appearance",
465
469
  {
@@ -469,119 +473,119 @@ async function ta(e = {}) {
469
473
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
470
474
  }
471
475
  );
472
- const wt = new Set(l.openToolGroupKeys), Pe = new Set(
476
+ const vt = new Set(l.openToolGroupKeys), Re = new Set(
473
477
  l.seenShareCandidateIds
474
- ), Je = new Set(Pe);
475
- let bt = l.sharePromptsDisabled || await vr(t), X = null, Ie = !1, ge = !1, xe = {
478
+ ), at = new Set(Re);
479
+ let Ct = l.sharePromptsDisabled || await Er(t), J = null, de = !1, De = !(t.loginRequired || t.signupRequired), he = !1, Ce = {
476
480
  enabled: !0
477
- }, ye = 0, rn = "", he = !1, pe = !1, me = [], _t = null, Be = null;
478
- const Z = (r, s) => {
479
- xe = { enabled: r, reason: s };
480
- }, J = () => {
481
- q.hidden = !0;
482
- }, zo = () => {
483
- q.hidden = !1;
484
- }, Oo = (r = "jump") => {
485
- Z(!0, r), J(), Ye(C, () => xe.enabled), ye = C.scrollTop;
486
- }, ve = () => {
487
- if (_e.hidden = t.loginRequired, ue.hidden = !he, _e.setAttribute("aria-expanded", String(he)), w.classList.toggle(
481
+ }, Se = 0, hn = "", me = !1, ce = !1, fe = [], St = null, $e = null;
482
+ const Q = (a, d) => {
483
+ Ce = { enabled: a, reason: d };
484
+ }, ee = () => {
485
+ x.hidden = !0;
486
+ }, Fo = () => {
487
+ x.hidden = !1;
488
+ }, Ho = (a = "jump") => {
489
+ Q(!0, a), ee(), nt(T, () => Ce.enabled), Se = T.scrollTop;
490
+ }, Ee = () => {
491
+ if (ve.hidden = t.loginRequired, Ae.hidden = !me, ve.setAttribute("aria-expanded", String(me)), V.classList.toggle(
488
492
  "pluno-pa-widget__history-list--center",
489
- pe && me.length === 0
490
- ), w.replaceChildren(), pe && me.length === 0) {
491
- const r = document.createElement("p");
492
- r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", w.appendChild(r);
493
- }
494
- for (const r of me) {
495
- const s = document.createElement("button");
496
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = pe;
497
- const b = document.createElement("span");
498
- b.className = "pluno-pa-widget__history-item-title", b.textContent = ya(r);
499
- const L = document.createElement("time");
500
- L.className = "pluno-pa-widget__history-time", L.dateTime = r.lastActiveAt, L.textContent = Ca(
501
- r.lastActiveAt,
493
+ ce && fe.length === 0
494
+ ), V.replaceChildren(), ce && fe.length === 0) {
495
+ const a = document.createElement("p");
496
+ a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", V.appendChild(a);
497
+ }
498
+ for (const a of fe) {
499
+ const d = document.createElement("button");
500
+ d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ce;
501
+ const _ = document.createElement("span");
502
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = Sa(a);
503
+ const P = document.createElement("time");
504
+ P.className = "pluno-pa-widget__history-time", P.dateTime = a.lastActiveAt, P.textContent = ka(
505
+ a.lastActiveAt,
502
506
  Date.now()
503
507
  );
504
- const M = document.createElement("small");
505
- M.className = "pluno-pa-widget__history-path", M.textContent = va(r), s.append(b, L, M), s.addEventListener("click", () => {
506
- he = !1, Be = null, ve(), Z(!0, "newSession"), J(), _.loadSession(r.id), G(_.getState());
507
- }), w.appendChild(s);
508
- }
509
- if (pe && me.length > 0) {
510
- const r = document.createElement("p");
511
- r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", w.appendChild(r);
512
- }
513
- H.textContent = Be ?? (!pe && me.length === 0 ? "No recent chats for this page yet." : ""), H.hidden = H.textContent.length === 0;
514
- }, ln = async (r) => {
515
- if (!pe) {
516
- pe = !0, Be = null, ve();
508
+ const O = document.createElement("small");
509
+ O.className = "pluno-pa-widget__history-path", O.textContent = Ea(a), d.append(_, P, O), d.addEventListener("click", () => {
510
+ me = !1, $e = null, Ee(), Q(!0, "newSession"), ee(), b.loadSession(a.id), H(b.getState());
511
+ }), V.appendChild(d);
512
+ }
513
+ if (ce && fe.length > 0) {
514
+ const a = document.createElement("p");
515
+ a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", V.appendChild(a);
516
+ }
517
+ ne.textContent = $e ?? (!ce && fe.length === 0 ? "No recent chats for this page yet." : ""), ne.hidden = ne.textContent.length === 0;
518
+ }, mn = async (a) => {
519
+ if (!ce) {
520
+ ce = !0, $e = null, Ee();
517
521
  try {
518
- const s = await _.listSessions({ cursor: r, limit: 20 });
519
- me = r ? [...me, ...s.sessions] : s.sessions, _t = s.nextCursor;
520
- } catch (s) {
521
- Q(
522
+ const d = await b.listSessions({ cursor: a, limit: 20 });
523
+ fe = a ? [...fe, ...d.sessions] : d.sessions, St = d.nextCursor;
524
+ } catch (d) {
525
+ te(
522
526
  "web-sdk.widget",
523
527
  "Failed to load session history",
524
528
  {
525
- message: s instanceof Error ? s.message : String(s)
529
+ message: d instanceof Error ? d.message : String(d)
526
530
  }
527
- ), Be = Bi;
531
+ ), $e = Wi;
528
532
  } finally {
529
- pe = !1, ve();
533
+ ce = !1, Ee();
530
534
  }
531
535
  }
532
- }, Uo = () => {
533
- !_t || pe || w.scrollHeight - w.scrollTop - w.clientHeight <= 24 && ln(_t);
534
- }, pn = () => {
535
- Ie || typeof document > "u" || (Xn(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
536
- }, sn = new MutationObserver(pn);
537
- sn.observe(k.documentElement, {
536
+ }, Wo = () => {
537
+ !St || ce || V.scrollHeight - V.scrollTop - V.clientHeight <= 24 && mn(St);
538
+ }, fn = () => {
539
+ de || typeof document > "u" || (oo(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
540
+ }, wn = new MutationObserver(fn);
541
+ wn.observe(k.documentElement, {
538
542
  childList: !0,
539
543
  subtree: !0
540
- }), pn();
541
- const Fe = (r = !0) => {
542
- const s = ut(i, r);
543
- return Xt(
544
+ }), fn();
545
+ const qe = (a = !0) => {
546
+ const d = wt(i, a);
547
+ return on(
544
548
  i,
545
- p ? ho(p, s) : sa(
549
+ p ? yo(p, d) : ua(
546
550
  i,
547
551
  t.position,
548
- s
552
+ d
549
553
  ),
550
- s
554
+ d
551
555
  );
552
- }, B = () => {
553
- const r = fa(o, S, y);
554
- Sr(t, {
556
+ }, F = () => {
557
+ const a = _a(o, C, w);
558
+ Lr(t, {
555
559
  isOpen: i.classList.contains("pluno-pa-widget--open"),
556
- composerValue: y.value,
557
- focusedInput: r,
558
- focusedInputAt: r ? Date.now() : null,
559
- openToolGroupKeys: [...wt],
560
- launcherPosition: d ? p : null,
560
+ composerValue: w.value,
561
+ focusedInput: a,
562
+ focusedInputAt: a ? Date.now() : null,
563
+ openToolGroupKeys: [...vt],
564
+ launcherPosition: s ? p : null,
561
565
  panelSize: c,
562
- seenShareCandidateIds: [...Pe].slice(
563
- -oo
566
+ seenShareCandidateIds: [...Re].slice(
567
+ -co
564
568
  ),
565
- sharePromptsDisabled: bt
569
+ sharePromptsDisabled: Ct
566
570
  });
567
- }, Qe = (r) => {
568
- t.onDisplayStateChange?.(r);
569
- }, He = (r, s = !0) => {
570
- if (r === "shown") {
571
- i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && We(!1), s && Qe("shown");
571
+ }, rt = (a) => {
572
+ t.onDisplayStateChange?.(a);
573
+ }, je = (a, d = !0) => {
574
+ if (a === "shown") {
575
+ i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ve(!1), d && rt("shown");
572
576
  return;
573
577
  }
574
- X !== null && (window.clearTimeout(X), X = 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, x.hidden = !0, I.hidden = !0, v.tabIndex = 0, y.value = "", Ee(
578
+ J !== null && (window.clearTimeout(J), J = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, y.hidden = !0, A.hidden = !0, v.tabIndex = 0, w.value = "", Te(
575
579
  i,
576
- Mt(
580
+ Wt(
577
581
  i,
578
582
  p,
579
583
  t.position
580
584
  )
581
- ), Bn(i), B(), s && Qe("minimized");
582
- }, Ce = (r, s = {}) => {
583
- ma(r, {
584
- debugVersion: Qi,
585
+ ), jn(i), F(), d && rt("minimized");
586
+ }, ke = (a, d = {}) => {
587
+ ba(a, {
588
+ debugVersion: na,
585
589
  launcherPosition: p,
586
590
  rootClasses: i.className,
587
591
  rootStyle: {
@@ -590,35 +594,35 @@ async function ta(e = {}) {
590
594
  right: i.style.right,
591
595
  bottom: i.style.bottom
592
596
  },
593
- rootRect: Ot(i),
594
- launcherRect: Ot(v),
595
- panelRect: Ot(x),
596
- viewport: Y(),
597
- panelHidden: x.hidden,
598
- closeHidden: I.hidden,
599
- ...s
597
+ rootRect: $t(i),
598
+ launcherRect: $t(v),
599
+ panelRect: $t(y),
600
+ viewport: Z(),
601
+ panelHidden: y.hidden,
602
+ closeHidden: A.hidden,
603
+ ...d
600
604
  });
601
- }, We = (r = !0) => {
605
+ }, Ve = (a = !0) => {
602
606
  if (!p)
603
- return Ee(i, null), Fe(r);
604
- const s = Fe(r);
605
- return Ee(i, s), Ce("Applied stored closed launcher position", {
606
- visibleLauncherPosition: s
607
- }), s;
608
- }, xt = (r, s) => {
609
- if (!r || !s) {
610
- Bn(i);
607
+ return Te(i, null), qe(a);
608
+ const d = qe(a);
609
+ return Te(i, d), ke("Applied stored closed launcher position", {
610
+ visibleLauncherPosition: d
611
+ }), d;
612
+ }, Et = (a, d) => {
613
+ if (!a || !d) {
614
+ jn(i);
611
615
  return;
612
616
  }
613
- ha(i, {
614
- x: r.x - s.x,
615
- y: r.y - s.y
617
+ wa(i, {
618
+ x: a.x - d.x,
619
+ y: a.y - d.y
616
620
  });
617
- }, dn = () => {
621
+ }, bn = () => {
618
622
  if (i.classList.contains("pluno-pa-widget--minimized")) {
619
- Ee(
623
+ Te(
620
624
  i,
621
- Mt(
625
+ Wt(
622
626
  i,
623
627
  p,
624
628
  t.position
@@ -626,234 +630,251 @@ async function ta(e = {}) {
626
630
  );
627
631
  return;
628
632
  }
629
- const r = We();
633
+ const a = Ve();
630
634
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
631
- Rt(i, c);
632
- const s = ze(c);
633
- Bt(
635
+ Ht(i, c);
636
+ const d = He(c);
637
+ jt(
634
638
  h,
635
- s.width
639
+ d.width
636
640
  );
637
- const b = st(
638
- u ?? zt(
641
+ const _ = ht(
642
+ u ?? Gt(
639
643
  i,
640
- r,
644
+ a,
641
645
  t.position,
642
646
  c
643
647
  ),
644
- s
648
+ d
645
649
  );
646
- u && (u = b), xt(b, r), Ce(
650
+ u && (u = _), Et(_, a), ke(
647
651
  "Applied open panel position after viewport resize",
648
- { openPanelPosition: b }
652
+ { openPanelPosition: _ }
649
653
  );
650
- } else p && Ce(
654
+ } else p && ke(
651
655
  "Applied visible launcher position after viewport resize",
652
- { visibleLauncherPosition: r }
656
+ { visibleLauncherPosition: a }
653
657
  );
654
658
  };
655
- let cn = () => {
659
+ let _n = () => {
656
660
  };
657
- window.addEventListener("resize", dn), t.movableLauncher && D ? (We(), cn = ra({
661
+ window.addEventListener("resize", bn), t.movableLauncher && D ? (Ve(), _n = sa({
658
662
  root: i,
659
663
  launcher: v,
660
664
  launcherDragHandle: D,
661
- getPosition: () => Fe(),
662
- setPosition: (r) => {
663
- const s = r, b = ut(i), L = Xt(
665
+ getPosition: () => qe(),
666
+ setPosition: (a) => {
667
+ const d = a, _ = wt(i), P = on(
664
668
  i,
665
- r,
666
- b
669
+ a,
670
+ _
667
671
  );
668
- p = ca(
669
- L,
670
- b
671
- ), Ee(i, L), Ce("Dragging closed launcher", {
672
- requestedPosition: s
672
+ p = ha(
673
+ P,
674
+ _
675
+ ), Te(i, P), ke("Dragging closed launcher", {
676
+ requestedPosition: d
673
677
  });
674
678
  },
675
679
  persist: () => {
676
- d = !0, B(), Ce("Persisted closed launcher drag position");
680
+ s = !0, F(), ke("Persisted closed launcher drag position");
677
681
  }
678
- })) : Ee(i, null), Rt(i, c);
679
- const Bo = () => {
680
- const r = ze(c), s = Fe();
682
+ })) : Te(i, null), Ht(i, c);
683
+ const Go = () => {
684
+ const a = He(c), d = qe();
681
685
  return {
682
- position: st(
683
- u ?? zt(
686
+ position: ht(
687
+ u ?? Gt(
684
688
  i,
685
- s,
689
+ d,
686
690
  t.position,
687
691
  c
688
692
  ),
689
- r
693
+ a
690
694
  ),
691
- size: r
695
+ size: a
692
696
  };
693
- }, Fo = (r) => {
694
- c = ht(r.size), Rt(i, c), Bt(
697
+ }, $o = (a) => {
698
+ c = _t(a.size), Ht(i, c), jt(
695
699
  h,
696
- ze(c).width
697
- ), u = st(
698
- r.position,
699
- ze(c)
700
+ He(c).width
701
+ ), u = ht(
702
+ a.position,
703
+ He(c)
700
704
  );
701
- const s = Fe();
702
- xt(u, s);
703
- }, Ho = A.length > 0 ? la({
705
+ const d = qe();
706
+ Et(u, d);
707
+ }, qo = S.length > 0 ? da({
704
708
  root: i,
705
- handles: A,
706
- getBounds: Bo,
707
- setBounds: Fo,
708
- persist: B
709
+ handles: S,
710
+ getBounds: Go,
711
+ setBounds: $o,
712
+ persist: F
709
713
  }) : () => {
710
714
  };
711
- let yt = !1;
712
- const un = async () => {
713
- if (!(!t.billingStatusLoader || yt)) {
714
- yt = !0;
715
+ let kt = !1;
716
+ const xn = async () => {
717
+ if (!(!t.billingStatusLoader || kt)) {
718
+ kt = !0;
715
719
  try {
716
- const r = await t.billingStatusLoader();
717
- $n(
720
+ const a = await t.billingStatusLoader();
721
+ Zn(
718
722
  t.billingStatus,
719
- r,
720
- _.getState().lastErrorCode
721
- ) && (t.billingStatus = r, Ht(
722
- Oe,
723
+ a,
724
+ b.getState().lastErrorCode
725
+ ) && (t.billingStatus = a, Kt(
726
+ xe,
723
727
  t.billingStatus,
724
- _.getState().lastErrorCode
725
- ), j());
728
+ b.getState().lastErrorCode
729
+ ), G());
726
730
  } finally {
727
- yt = !1;
731
+ kt = !1;
728
732
  }
729
733
  }
730
- }, fe = (r = "", s = !0) => {
731
- un(), $e && ($e = !1, Ct()), i.classList.contains("pluno-pa-widget--open") || (u = null), X !== null && (window.clearTimeout(X), X = null), He("shown", !1), x.hidden = !1, I.hidden = !1, Bt(
734
+ }, we = (a = "", d = !0) => {
735
+ xn(), Xe && (Xe = !1, Tt()), i.classList.contains("pluno-pa-widget--open") || (u = null), J !== null && (window.clearTimeout(J), J = null), je("shown", !1), y.hidden = !1, A.hidden = !1, jt(
732
736
  h,
733
- ze(c).width
737
+ He(c).width
734
738
  ), i.classList.remove("pluno-pa-widget--closing");
735
- const b = We(), L = zt(
739
+ const _ = Ve(), P = Gt(
736
740
  i,
737
- b,
741
+ _,
738
742
  t.position,
739
743
  c
740
744
  );
741
- if (xt(L, b), Ce("Opening launcher at clamped open panel position", {
742
- openPanelPosition: L,
743
- visibleLauncherPosition: b
744
- }), Z(!0, "open"), J(), !s) {
745
- i.classList.add("pluno-pa-widget--open"), v.hidden = !0, r && (y.value = r, Ke(y)), Ye(C, () => xe.enabled), ye = C.scrollTop, y.focus(), y.setSelectionRange(y.value.length, y.value.length), B(), Qe("shown"), t.onPanelOpenChange?.(!0);
745
+ if (Et(P, _), ke("Opening launcher at clamped open panel position", {
746
+ openPanelPosition: P,
747
+ visibleLauncherPosition: _
748
+ }), Q(!0, "open"), ee(), !d) {
749
+ i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (w.value = a, tt(w)), nt(T, () => Ce.enabled), Se = T.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0);
746
750
  return;
747
751
  }
748
752
  window.requestAnimationFrame(() => {
749
- i.classList.add("pluno-pa-widget--open"), r && (y.value = r, Ke(y)), Ye(C, () => xe.enabled), ye = C.scrollTop, y.focus(), y.setSelectionRange(y.value.length, y.value.length), B(), Qe("shown"), t.onPanelOpenChange?.(!0), X = window.setTimeout(() => {
750
- v.hidden = !0, Ye(C, () => xe.enabled), ye = C.scrollTop;
753
+ i.classList.add("pluno-pa-widget--open"), a && (w.value = a, tt(w)), nt(T, () => Ce.enabled), Se = T.scrollTop, w.focus(), w.setSelectionRange(w.value.length, w.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0), J = window.setTimeout(() => {
754
+ v.hidden = !0, nt(T, () => Ce.enabled), Se = T.scrollTop;
751
755
  }, 220);
752
756
  });
753
- }, Wo = () => {
754
- X !== null && (window.clearTimeout(X), X = null), v.hidden = !1, p && (We(!1), Ce("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), B(), t.onPanelOpenChange?.(!1), X = window.setTimeout(() => {
755
- x.hidden = !0, I.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
757
+ }, Lt = () => {
758
+ J !== null && (window.clearTimeout(J), J = null), v.hidden = !1, p && (Ve(!1), ke("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), J = window.setTimeout(() => {
759
+ y.hidden = !0, A.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
756
760
  }, 220);
757
761
  };
758
- v.addEventListener("submit", (r) => {
759
- r.preventDefault(), fe(S.value), S.value = "";
760
- }), D?.addEventListener("click", (r) => {
761
- r.preventDefault(), r.stopPropagation();
762
- }), v.addEventListener("click", (r) => {
763
- r.target === S && !D || (fe(S.value), S.value = "");
764
- }), S.addEventListener("focus", () => {
765
- fe(S.value), S.value = "";
766
- }), S.addEventListener("input", () => {
767
- if (!S.value)
762
+ v.addEventListener("submit", (a) => {
763
+ a.preventDefault(), we(C.value), C.value = "";
764
+ }), D?.addEventListener("click", (a) => {
765
+ a.preventDefault(), a.stopPropagation();
766
+ }), v.addEventListener("click", (a) => {
767
+ a.target === C && !D || (we(C.value), C.value = "");
768
+ }), C.addEventListener("focus", () => {
769
+ we(C.value), C.value = "";
770
+ }), C.addEventListener("input", () => {
771
+ if (!C.value)
768
772
  return;
769
- const r = S.value;
770
- fe(r), S.value = "";
773
+ const a = C.value;
774
+ we(a), C.value = "";
771
775
  });
772
- let vt = null, et = null, Se = null;
773
- const gn = (r) => r === S || r === y, Go = (r) => {
774
- if (!(r instanceof Element) || r.getRootNode() === i.getRootNode())
776
+ let Pt = null, lt = null, Le = null;
777
+ const yn = (a) => a === C || a === w, jo = (a) => {
778
+ if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
775
779
  return null;
776
- let s = r;
777
- for (; s; ) {
778
- const b = s.closest(Pn);
779
- if (b)
780
- return b;
781
- const L = s.getRootNode();
782
- s = L instanceof ShadowRoot ? L.host : null;
780
+ let d = a;
781
+ for (; d; ) {
782
+ const _ = d.closest(Mn);
783
+ if (_)
784
+ return _;
785
+ const P = d.getRootNode();
786
+ d = P instanceof ShadowRoot ? P.host : null;
783
787
  }
784
788
  return null;
785
- }, $o = (r) => {
786
- if (!r.isConnected || !r.matches(Pn))
789
+ }, Vo = (a) => {
790
+ if (!a.isConnected || !a.matches(Mn))
787
791
  return !1;
788
- if (!(r instanceof HTMLElement))
792
+ if (!(a instanceof HTMLElement))
789
793
  return !0;
790
- if (r.hidden)
794
+ if (a.hidden)
791
795
  return !1;
792
- if (typeof r.checkVisibility == "function")
793
- return r.checkVisibility();
794
- const s = window.getComputedStyle(r);
795
- return s.display !== "none" && s.visibility !== "hidden";
796
- }, hn = (r) => {
797
- Ge !== r && (Ge = r, i.classList.toggle("pluno-pa-widget--host-modal-conflict", r !== null), nt(), r !== null ? Se = window.setInterval(() => {
798
- const s = Ge;
799
- (!s || !$o(s)) && hn(null);
800
- }, Ui) : Se !== null && (window.clearInterval(Se), Se = null, et = null));
801
- }, qo = () => {
802
- Se !== null && (window.clearInterval(Se), Se = null);
796
+ if (typeof a.checkVisibility == "function")
797
+ return a.checkVisibility();
798
+ const d = window.getComputedStyle(a);
799
+ return d.display !== "none" && d.visibility !== "hidden";
800
+ }, vn = (a) => {
801
+ Ye !== a && (Ye = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Pe(), a !== null ? Le = window.setInterval(() => {
802
+ const d = Ye;
803
+ (!d || !Vo(d)) && vn(null);
804
+ }, Hi) : Le !== null && (window.clearInterval(Le), Le = null, lt = null));
805
+ }, Ko = () => {
806
+ Le !== null && (window.clearInterval(Le), Le = null);
803
807
  };
804
- i.addEventListener("focusin", (r) => {
805
- gn(r.target) && (vt = Date.now(), B());
806
- }), i.addEventListener("focusout", (r) => {
807
- if (!gn(r.target) || Ge !== null)
808
+ i.addEventListener("focusin", (a) => {
809
+ yn(a.target) && (Pt = Date.now(), F());
810
+ }), i.addEventListener("focusout", (a) => {
811
+ if (!yn(a.target) || Ye !== null)
808
812
  return;
809
- const s = vt;
810
- if (vt = null, s === null || Date.now() - s > zi)
813
+ const d = Pt;
814
+ if (Pt = null, d === null || Date.now() - d > Bi)
811
815
  return;
812
- const b = Go(r.relatedTarget);
813
- if (!b)
816
+ const _ = jo(a.relatedTarget);
817
+ if (!_)
814
818
  return;
815
- const L = Date.now();
816
- if (et !== null && L - et <= Oi) {
817
- hn(b);
819
+ const P = Date.now();
820
+ if (lt !== null && P - lt <= Fi) {
821
+ vn(_);
818
822
  return;
819
823
  }
820
- et = L;
821
- }), v.addEventListener("keydown", (r) => {
822
- !i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), fe());
823
- }), g?.addEventListener("pointerdown", (r) => {
824
- r.stopPropagation();
825
- }), g?.addEventListener("click", (r) => {
826
- r.preventDefault(), r.stopPropagation(), He("minimized");
827
- }), I.addEventListener("click", Wo), C.addEventListener("scroll", () => {
828
- C.scrollTop < ye - 1 && Z(!1, "userScroll"), ye = C.scrollTop;
829
- }), q.addEventListener("click", () => {
830
- Oo();
824
+ lt = P;
825
+ }), v.addEventListener("keydown", (a) => {
826
+ !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), we());
827
+ }), g?.addEventListener("pointerdown", (a) => {
828
+ a.stopPropagation();
829
+ }), g?.addEventListener("click", (a) => {
830
+ a.preventDefault(), a.stopPropagation(), je("minimized");
831
+ }), A.addEventListener("click", Lt), T.addEventListener("scroll", () => {
832
+ T.scrollTop < Se - 1 && Q(!1, "userScroll"), Se = T.scrollTop;
833
+ }), x.addEventListener("click", () => {
834
+ Ho();
831
835
  });
832
- const mn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
833
- ([r]) => {
834
- r?.isIntersecting && (Z(!0, "bottom"), J());
836
+ const Cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
837
+ ([a]) => {
838
+ a?.isIntersecting && (Q(!0, "bottom"), ee());
835
839
  },
836
- { root: C, threshold: 0 }
840
+ { root: T, threshold: 0 }
837
841
  );
838
- mn?.observe(re);
839
- const tt = () => t.loginRequired || t.signupRequired;
840
- let Ge = null, $e = !1;
841
- const nt = () => {
842
- const r = tt(), s = Ge !== null;
843
- S.readOnly = r || s, y.readOnly = s, S.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : $e ? "New update" : t.launcherLabel, y.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ne.launcherLabel, R.hidden = r;
844
- }, j = () => {
845
- ee.disabled = ie(t.billingStatus) || !_.getState().isThinking && y.value.trim().length === 0 && W.length === 0, ce.disabled = tt() || ie(t.billingStatus);
842
+ Cn?.observe(oe);
843
+ const Ke = () => t.loginRequired || t.signupRequired;
844
+ let Ye = null, Xe = !1;
845
+ const K = () => De || b.getState().status !== "connected", Pe = () => {
846
+ const a = Ke(), d = Ye !== null, _ = !a && K();
847
+ C.readOnly = a || d || _, w.readOnly = d || _, C.placeholder = d ? zn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : _ ? De ? "Connecting..." : "Connection unavailable" : Xe ? "New update" : t.launcherLabel, w.placeholder = d ? zn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : _ ? De ? "Connecting..." : "Connection unavailable" : ae.launcherLabel, N.hidden = a;
848
+ }, G = () => {
849
+ U.disabled = K() || le(t.billingStatus) || !b.getState().isThinking && w.value.trim().length === 0 && j.length === 0, Ge.disabled = Ke() || K() || le(t.billingStatus);
846
850
  };
847
- nt();
848
- const Ct = () => {
849
- const r = _.getState().isThinking;
850
- i.classList.toggle("pluno-pa-widget--thinking", r), i.classList.toggle(
851
+ Pe();
852
+ const Tt = () => {
853
+ const a = b.getState().isThinking;
854
+ i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
851
855
  "pluno-pa-widget--unread",
852
- !r && $e
853
- ), nt();
856
+ !a && Xe
857
+ ), Pe();
858
+ };
859
+ Tt();
860
+ const It = () => {
861
+ Ke() || de || (De = !0, Pe(), G(), b.connect().then(
862
+ () => {
863
+ de || (De = !1, Pe(), G());
864
+ },
865
+ (a) => {
866
+ de || (De = !1, Pe(), G(), te(
867
+ "web-sdk.widget",
868
+ "Failed to connect Product Agent widget",
869
+ {
870
+ message: a instanceof Error ? a.message : String(a)
871
+ }
872
+ ));
873
+ }
874
+ ));
854
875
  };
855
- Ct(), R.addEventListener("submit", (r) => {
856
- if (r.preventDefault(), t.loginRequired) {
876
+ N.addEventListener("submit", (a) => {
877
+ if (a.preventDefault(), t.loginRequired) {
857
878
  t.onLoginClick?.();
858
879
  return;
859
880
  }
@@ -861,158 +882,158 @@ async function ta(e = {}) {
861
882
  t.onSignupClick?.();
862
883
  return;
863
884
  }
864
- ie(t.billingStatus) || (ge = !0, Z(!0, "send"), J(), W = Ut(
865
- _,
866
- y,
867
- W
868
- ), Le(), j());
885
+ K() || le(t.billingStatus) || (he = !0, Q(!0, "send"), ee(), j = qt(
886
+ b,
887
+ w,
888
+ j
889
+ ), Ne(), G());
869
890
  });
870
- let qe = 0;
871
- const jo = () => {
872
- qe = 0, i.classList.remove("pluno-pa-widget--drag-over");
873
- }, St = (r) => {
874
- le !== null && window.clearTimeout(le), P.textContent = r, P.hidden = !1, le = window.setTimeout(() => {
875
- P.textContent = "", P.hidden = !0, le = null;
891
+ let Ze = 0;
892
+ const Yo = () => {
893
+ Ze = 0, i.classList.remove("pluno-pa-widget--drag-over");
894
+ }, At = (a) => {
895
+ se !== null && window.clearTimeout(se), q.textContent = a, q.hidden = !1, se = window.setTimeout(() => {
896
+ q.textContent = "", q.hidden = !0, se = null;
876
897
  }, 3e3);
877
- }, Vo = () => {
878
- le !== null && (window.clearTimeout(le), le = null), P.textContent = "", P.hidden = !0;
879
- }, Et = async (r) => {
880
- if (r.length === 0)
898
+ }, Xo = () => {
899
+ se !== null && (window.clearTimeout(se), se = null), q.textContent = "", q.hidden = !0;
900
+ }, Nt = async (a) => {
901
+ if (a.length === 0)
881
902
  return;
882
- const s = ja(_, r);
883
- W = [...W, ...s], Le(), Vo(), j(), G(_.getState()), i.classList.contains("pluno-pa-widget--open") || fe();
903
+ const d = Ya(b, a);
904
+ j = [...j, ...d], Ne(), Xo(), G(), H(b.getState()), i.classList.contains("pluno-pa-widget--open") || we();
884
905
  };
885
- ce.addEventListener("click", () => {
886
- t.loginRequired || ie(t.billingStatus) || U.click();
887
- }), U.addEventListener("change", () => {
888
- const r = Array.from(U.files ?? []);
889
- U.value = "", Et(r).catch((s) => {
890
- St(
891
- s instanceof Error ? s.message : "Failed to attach file"
892
- ), Q("web-sdk.widget", "Attachment failed", {
893
- message: s instanceof Error ? s.message : String(s)
906
+ Ge.addEventListener("click", () => {
907
+ t.loginRequired || K() || le(t.billingStatus) || z.click();
908
+ }), z.addEventListener("change", () => {
909
+ const a = Array.from(z.files ?? []);
910
+ z.value = "", Nt(a).catch((d) => {
911
+ At(
912
+ d instanceof Error ? d.message : "Failed to attach file"
913
+ ), te("web-sdk.widget", "Attachment failed", {
914
+ message: d instanceof Error ? d.message : String(d)
894
915
  });
895
916
  });
896
- }), i.addEventListener("dragenter", (r) => {
897
- !rt(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), qe += 1, i.classList.add("pluno-pa-widget--drag-over"));
898
- }), i.addEventListener("dragover", (r) => {
899
- const s = r.dataTransfer;
900
- !rt(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
901
- }), i.addEventListener("dragleave", (r) => {
902
- rt(r.dataTransfer) && (r.stopPropagation(), qe = Math.max(0, qe - 1), qe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
903
- }), i.addEventListener("drop", (r) => {
904
- const s = r.dataTransfer;
905
- !rt(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jo(), Et(s.files).catch((b) => {
906
- St(
907
- b instanceof Error ? b.message : "Failed to attach file"
908
- ), Q("web-sdk.widget", "Attachment failed", {
909
- message: b instanceof Error ? b.message : String(b)
917
+ }), i.addEventListener("dragenter", (a) => {
918
+ !ct(a.dataTransfer) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), Ze += 1, i.classList.add("pluno-pa-widget--drag-over"));
919
+ }), i.addEventListener("dragover", (a) => {
920
+ const d = a.dataTransfer;
921
+ !ct(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
922
+ }), i.addEventListener("dragleave", (a) => {
923
+ ct(a.dataTransfer) && (a.stopPropagation(), Ze = Math.max(0, Ze - 1), Ze === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
924
+ }), i.addEventListener("drop", (a) => {
925
+ const d = a.dataTransfer;
926
+ !ct(d) || t.loginRequired || K() || (a.preventDefault(), a.stopPropagation(), Yo(), Nt(d.files).catch((_) => {
927
+ At(
928
+ _ instanceof Error ? _.message : "Failed to attach file"
929
+ ), te("web-sdk.widget", "Attachment failed", {
930
+ message: _ instanceof Error ? _.message : String(_)
910
931
  });
911
932
  }));
912
- }), i.addEventListener("paste", (r) => {
913
- r.stopPropagation();
914
- const s = r.clipboardData, b = Array.from(s?.files ?? []);
915
- b.length === 0 || t.loginRequired || (r.preventDefault(), Et(b).catch((L) => {
916
- St(
917
- L instanceof Error ? L.message : "Failed to attach file"
918
- ), Q("web-sdk.widget", "Attachment failed", {
919
- message: L instanceof Error ? L.message : String(L)
933
+ }), i.addEventListener("paste", (a) => {
934
+ a.stopPropagation();
935
+ const d = a.clipboardData, _ = Array.from(d?.files ?? []);
936
+ _.length === 0 || t.loginRequired || K() || (a.preventDefault(), Nt(_).catch((P) => {
937
+ At(
938
+ P instanceof Error ? P.message : "Failed to attach file"
939
+ ), te("web-sdk.widget", "Attachment failed", {
940
+ message: P instanceof Error ? P.message : String(P)
920
941
  });
921
942
  }));
922
- }), ee.addEventListener("click", () => {
943
+ }), U.addEventListener("click", () => {
923
944
  if (t.loginRequired) {
924
945
  t.onLoginClick?.();
925
946
  return;
926
947
  }
927
- if (_.getState().isThinking) {
928
- _.stop();
948
+ if (b.getState().isThinking) {
949
+ b.stop();
929
950
  return;
930
951
  }
931
- ge = !0, Z(!0, "send"), J(), W = Ut(
932
- _,
933
- y,
934
- W
935
- ), Le(), j(), G(_.getState());
936
- }), _e.addEventListener("click", () => {
937
- he = !he, Be = null, ve(), he && me.length === 0 && ln(null);
938
- }), z.addEventListener("click", () => {
939
- he = !1, ve();
940
- }), w.addEventListener("scroll", Uo), y.addEventListener("input", () => {
941
- Ke(y), B(), j(), Xo();
942
- }), y.addEventListener("keydown", (r) => {
943
- if (!(r.key !== "Enter" || r.shiftKey)) {
944
- if (r.preventDefault(), t.loginRequired) {
952
+ K() || (he = !0, Q(!0, "send"), ee(), j = qt(
953
+ b,
954
+ w,
955
+ j
956
+ ), Ne(), G(), H(b.getState()));
957
+ }), ve.addEventListener("click", () => {
958
+ me = !me, $e = null, Ee(), me && fe.length === 0 && mn(null);
959
+ }), it.addEventListener("click", () => {
960
+ me = !1, Ee();
961
+ }), V.addEventListener("scroll", Wo), w.addEventListener("input", () => {
962
+ tt(w), F(), G(), Qo();
963
+ }), w.addEventListener("keydown", (a) => {
964
+ if (!(a.key !== "Enter" || a.shiftKey)) {
965
+ if (a.preventDefault(), t.loginRequired) {
945
966
  t.onLoginClick?.();
946
967
  return;
947
968
  }
948
- ge = !0, Z(!0, "send"), J(), W = Ut(
949
- _,
950
- y,
951
- W
952
- ), Le(), j(), G(_.getState());
953
- }
954
- }), i.addEventListener("click", (r) => {
955
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && B();
956
- }), l.composerValue && (y.value = l.composerValue, Ke(y)), t.initialDisplayState === "minimized" ? He("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && fe(y.value, !1), wa(l, i, S, y);
957
- const ot = () => a;
958
- let kt = _.getState().appearance !== null, it = null, je = null, Te = null, fn = _.getState().isThinking, Ae = null;
959
- const Ve = t.taskNotifications;
960
- let Ne = null, De = !1;
961
- const wn = () => {
962
- Ne !== null && (window.clearTimeout(Ne), Ne = null);
963
- }, at = () => {
964
- Ue && (Ue.hidden = !0);
965
- }, bn = () => _.getState().assistantDraft.trim().length > 0, Ko = async () => {
966
- if (!Ve || !Ue || De || Ie || !_.getState().isThinking || bn())
969
+ K() || (he = !0, Q(!0, "send"), ee(), j = qt(
970
+ b,
971
+ w,
972
+ j
973
+ ), Ne(), G(), H(b.getState()));
974
+ }
975
+ }), i.addEventListener("click", (a) => {
976
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
977
+ }), l.composerValue && (w.value = l.composerValue, tt(w)), t.initialDisplayState === "minimized" ? je("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && we(w.value, !1), xa(l, i, C, w);
978
+ const pt = () => r;
979
+ let Rt = b.getState().appearance !== null, st = null, Je = null, Me = null, Sn = b.getState().isThinking, ze = null;
980
+ const Qe = t.taskNotifications;
981
+ let Oe = null, Ue = !1;
982
+ const En = () => {
983
+ Oe !== null && (window.clearTimeout(Oe), Oe = null);
984
+ }, dt = () => {
985
+ W && (W.hidden = !0);
986
+ }, kn = () => b.getState().assistantDraft.trim().length > 0, Zo = async () => {
987
+ if (!Qe || !W || Ue || de || !b.getState().isThinking || kn())
967
988
  return;
968
- let r;
989
+ let a;
969
990
  try {
970
- r = await Ve.getState();
991
+ a = await Qe.getState();
971
992
  } catch {
972
993
  return;
973
994
  }
974
- r.enabled || r.neverSuggest || !_.getState().isThinking || bn() || De || Ie || (Ue.hidden = !1);
995
+ a.enabled || a.neverSuggest || !b.getState().isThinking || kn() || Ue || de || (W.hidden = !1);
975
996
  };
976
- Ao?.addEventListener("click", () => {
977
- De = !0, at(), Ve?.enable().catch(() => {
997
+ L?.addEventListener("click", () => {
998
+ Ue = !0, dt(), Qe?.enable().catch(() => {
978
999
  });
979
- }), No?.addEventListener("click", () => {
980
- De = !0, at();
981
- }), Do?.addEventListener("click", () => {
982
- De = !0, at(), Ve?.dismissForever().catch(() => {
1000
+ }), R?.addEventListener("click", () => {
1001
+ Ue = !0, dt();
1002
+ }), Uo?.addEventListener("click", () => {
1003
+ Ue = !0, dt(), Qe?.dismissForever().catch(() => {
983
1004
  });
984
1005
  });
985
- let Re = null, _n = () => {
1006
+ let Be = null, Ln = () => {
986
1007
  };
987
- const Yo = !!t.socialPostDraftHandler, Lt = /* @__PURE__ */ new Map(), Pt = () => y.value.trim().length > 0 || W.length > 0, Xo = () => {
988
- const r = Re !== null && Wt(_.getState(), Pt());
989
- N.hidden = !r, r && Re !== null && fo(N, Re);
1008
+ const Jo = !!t.socialPostDraftHandler, Dt = /* @__PURE__ */ new Map(), Mt = () => w.value.trim().length > 0 || j.length > 0, Qo = () => {
1009
+ const a = Be !== null && Yt(b.getState(), Mt());
1010
+ M.hidden = !a, a && Be !== null && Co(M, Be);
990
1011
  };
991
- let Me = null;
992
- const xn = (r = {}) => {
993
- ge = !0, Z(!0, "newSession"), J(), he = !1, ve(), _.startNewSession(r), wt.clear(), y.value = "", W = [], Le(), Ke(y), B(), j(), y.focus(), G(_.getState());
994
- }, It = (r) => {
995
- if (!r) {
996
- Me?.remove(), Me = null;
1012
+ let Fe = null;
1013
+ const zt = (a = {}) => {
1014
+ he = !0, Q(!0, "newSession"), ee(), me = !1, Ee(), b.startNewSession(a), vt.clear(), w.value = "", j = [], Ne(), tt(w), F(), G(), w.focus(), H(b.getState());
1015
+ }, Ot = (a) => {
1016
+ if (!a) {
1017
+ Fe?.remove(), Fe = null;
997
1018
  return;
998
1019
  }
999
- Me || (Me = mt(
1020
+ Fe || (Fe = xt(
1000
1021
  "pluno-pa-widget__new-chat",
1001
1022
  "New chat",
1002
- Ma(),
1023
+ Ua(),
1003
1024
  !1
1004
- ), Me.addEventListener("click", () => xn()), Ze.insertBefore(Me, _e));
1005
- }, G = (r) => {
1006
- if (ve(), an(r.lastErrorCode) ? Ae = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ie(t.billingStatus) && (Ae = null), Ht(
1007
- Oe,
1025
+ ), Fe.addEventListener("click", () => zt()), ye.insertBefore(Fe, ve));
1026
+ }, H = (a) => {
1027
+ if (Ee(), un(a.lastErrorCode) ? ze = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && (ze = null), Kt(
1028
+ xe,
1008
1029
  t.billingStatus,
1009
- Ae
1030
+ ze
1010
1031
  ), t.loginRequired) {
1011
- Lt.clear(), Kn(
1012
- C,
1013
- ee,
1014
- It,
1015
- ot,
1032
+ Dt.clear(), to(
1033
+ T,
1034
+ U,
1035
+ Ot,
1036
+ pt,
1016
1037
  "Log in to use Pluno on this page.",
1017
1038
  t.loginButtonLabel,
1018
1039
  t.loginUrl,
@@ -1021,11 +1042,11 @@ async function ta(e = {}) {
1021
1042
  return;
1022
1043
  }
1023
1044
  if (t.signupRequired) {
1024
- Lt.clear(), Kn(
1025
- C,
1026
- ee,
1027
- It,
1028
- ot,
1045
+ Dt.clear(), to(
1046
+ T,
1047
+ U,
1048
+ Ot,
1049
+ pt,
1029
1050
  "Complete signup to unlock your free trial credits.",
1030
1051
  t.signupButtonLabel,
1031
1052
  t.signupUrl,
@@ -1033,70 +1054,78 @@ async function ta(e = {}) {
1033
1054
  );
1034
1055
  return;
1035
1056
  }
1036
- const s = _a(r), b = s !== rn;
1037
- rn = s;
1038
- const L = ge || xe.enabled;
1039
- ge = !1, Qa(
1040
- C,
1041
- re,
1042
- ee,
1043
- It,
1044
- N,
1045
- r,
1046
- Re,
1047
- Re !== null && Wt(r, Pt()),
1048
- L,
1049
- () => xe.enabled,
1050
- wt,
1051
- Lt,
1052
- B,
1053
- ot,
1054
- (M) => {
1055
- ge = !0, Z(!0, "send"), J(), _.sendMessage(M);
1057
+ const d = va(a), _ = d !== hn;
1058
+ hn = d;
1059
+ const P = he || Ce.enabled;
1060
+ he = !1, nr(
1061
+ T,
1062
+ oe,
1063
+ U,
1064
+ Ot,
1065
+ M,
1066
+ a,
1067
+ Be,
1068
+ Be !== null && Yt(a, Mt()),
1069
+ P,
1070
+ () => Ce.enabled,
1071
+ vt,
1072
+ Dt,
1073
+ F,
1074
+ pt,
1075
+ (O) => {
1076
+ if (K())
1077
+ return;
1078
+ const et = t.morningReport !== null;
1079
+ t.morningReport = null, et && (t.onMorningReportTaskStart?.(), zt()), he = !0, Q(!0, "send"), ee(), b.sendMessage(O);
1080
+ },
1081
+ () => {
1082
+ he = !0, Q(!0, "send"), ee(), b.retryLastMessage();
1056
1083
  },
1084
+ t.morningReport,
1057
1085
  () => {
1058
- ge = !0, Z(!0, "send"), J(), _.retryLastMessage();
1086
+ t.morningReport = null, t.onMorningReportSnooze?.(), Lt(), H(b.getState());
1059
1087
  },
1060
- Yo && !bt ? {
1061
- dismissedCandidateIds: Je,
1062
- draftingCandidateId: it,
1063
- error: je,
1064
- characterIconOptions: ot(),
1065
- onSeen: (M) => {
1066
- Pe.add(M.id), B();
1088
+ It,
1089
+ Jo && !Ct ? {
1090
+ dismissedCandidateIds: at,
1091
+ draftingCandidateId: st,
1092
+ error: Je,
1093
+ characterIconOptions: pt(),
1094
+ onSeen: (O) => {
1095
+ Re.add(O.id), F();
1067
1096
  },
1068
- onDraft: (M) => {
1069
- Zo(M);
1097
+ onDraft: (O) => {
1098
+ ei(O);
1070
1099
  },
1071
- onDismiss: (M) => {
1072
- Pe.add(M.id), Je.add(M.id), B(), je = null, G(_.getState());
1100
+ onDismiss: (O) => {
1101
+ Re.add(O.id), at.add(O.id), F(), Je = null, H(b.getState());
1073
1102
  },
1074
- onDisable: (M) => {
1075
- bt = !0, Pe.add(M.id), Je.add(M.id), B(), Cr(t, !0), je = null, G(_.getState());
1103
+ onDisable: (O) => {
1104
+ Ct = !0, Re.add(O.id), at.add(O.id), F(), kr(t, !0), Je = null, H(b.getState());
1076
1105
  }
1077
1106
  } : void 0
1078
- ), L ? (ye = C.scrollTop, J()) : b && xa(r) && zo();
1107
+ ), P ? (Se = T.scrollTop, ee()) : _ && Ca(a) && Fo();
1079
1108
  };
1080
- return _n = fi(
1081
- (r) => {
1082
- Re = r, !Ie && Wt(_.getState(), Pt()) && G(_.getState());
1109
+ return Ln = _i(
1110
+ (a) => {
1111
+ Be = a, !de && Yt(b.getState(), Mt()) && H(b.getState());
1083
1112
  },
1084
1113
  {
1085
1114
  backendUrl: t.backendUrl,
1086
- fetcher: Mo,
1115
+ fetcher: Bo,
1087
1116
  loader: t.activeUsersLoader
1088
1117
  }
1089
- ), _.on("state", (r) => {
1090
- const s = fn && !r.isThinking;
1091
- fn = r.isThinking, r.isThinking && !r.assistantDraft.trim() && Ve && !De && Ne === null && Ue?.hidden !== !1 && (Ne = window.setTimeout(() => {
1092
- Ne = null, Ko();
1093
- }, yi)), (!r.isThinking || r.assistantDraft.trim()) && (wn(), at()), s && !i.classList.contains("pluno-pa-widget--open") && ($e = !0), Ct(), r.appearance ? (kt = !0, Q(
1118
+ ), b.on("state", (a) => {
1119
+ const d = Sn && !a.isThinking;
1120
+ Sn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Qe && !Ue && Oe === null && W?.hidden !== !1 && (Oe = window.setTimeout(() => {
1121
+ Oe = null, Zo();
1122
+ }, Si)), (!a.isThinking || a.assistantDraft.trim()) && (En(), dt()), d && !i.classList.contains("pluno-pa-widget--open") && (Xe = !0), Tt(), a.appearance ? (Rt = !0, te(
1094
1123
  "web-sdk.widget",
1095
1124
  "Agent state supplied appearance",
1096
1125
  {
1097
- appearance: r.appearance
1126
+ appearance: a.appearance
1098
1127
  }
1099
- ), Tt(r.appearance, "agent.state.appearance")) : kt && (kt = !1, Q(
1128
+ ), Ut(a.appearance, "agent.state.appearance")) : Rt && (Rt = !1, te(
1100
1129
  "web-sdk.widget",
1101
1130
  "Agent state cleared appearance; reverting to configured widget options",
1102
1131
  {
@@ -1104,103 +1133,99 @@ async function ta(e = {}) {
1104
1133
  fallbackColorScheme: t.colorScheme,
1105
1134
  fallbackFontFamily: t.fontFamily
1106
1135
  }
1107
- ), Tt({}, "agent.state.appearance-cleared")), G(r), j(), s && un();
1108
- }), G(_.getState()), j(), {
1109
- agent: _,
1110
- startNewChat: xn,
1136
+ ), Ut({}, "agent.state.appearance-cleared")), H(a), G(), d && xn();
1137
+ }), H(b.getState()), G(), It(), {
1138
+ agent: b,
1139
+ startNewChat: zt,
1111
1140
  host: n,
1112
- updateAppearance: (r) => {
1113
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Tt(r, "widgetHandle.updateAppearance");
1141
+ updateAppearance: (a) => {
1142
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Ut(a, "widgetHandle.updateAppearance");
1114
1143
  },
1115
- updateBillingStatus: (r) => {
1116
- const s = r ?? null;
1117
- $n(
1144
+ updateBillingStatus: (a) => {
1145
+ const d = a ?? null;
1146
+ Zn(
1118
1147
  t.billingStatus,
1119
- s,
1120
- Ae
1121
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ie(t.billingStatus) && (Ae = null), Ht(
1148
+ d,
1149
+ ze
1150
+ ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && (ze = null), Kt(
1122
1151
  i.querySelector(".pluno-pa-widget__billing-status"),
1123
1152
  t.billingStatus,
1124
- Ae
1125
- ), j());
1153
+ ze
1154
+ ), G());
1126
1155
  },
1127
- updateAuthGate: (r) => {
1128
- const s = tt();
1129
- t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), nt(), G(_.getState()), j(), s && !tt() && _.connect().catch((b) => {
1130
- Q(
1131
- "web-sdk.widget",
1132
- "Failed to connect after auth gate cleared",
1133
- {
1134
- message: b instanceof Error ? b.message : String(b)
1135
- }
1136
- );
1137
- });
1156
+ updateAuthGate: (a) => {
1157
+ const d = Ke();
1158
+ 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), Pe(), H(b.getState()), G(), d && !Ke() && It();
1138
1159
  },
1139
1160
  openPanel: () => {
1140
- fe(y.value, !1);
1161
+ we(w.value, !1);
1141
1162
  },
1142
- updateDisplayState: (r) => {
1143
- if (r === "shown") {
1144
- He("shown", !1);
1163
+ closePanel: Lt,
1164
+ updateDisplayState: (a) => {
1165
+ if (a === "shown") {
1166
+ je("shown", !1);
1145
1167
  return;
1146
1168
  }
1147
- He("minimized", !1);
1169
+ je("minimized", !1);
1170
+ },
1171
+ updateMorningReport: (a) => {
1172
+ t.morningReport = a ?? null, H(b.getState());
1148
1173
  },
1149
1174
  destroy: () => {
1150
- Ie || (B(), Ie = !0, sn.disconnect(), mn?.disconnect(), qo(), window.removeEventListener("resize", dn), cn(), Ho(), le !== null && window.clearTimeout(le), wn(), _n(), Te?.remove(), _.destroy(), ft.release(), n.remove());
1175
+ de || (F(), de = !0, wn.disconnect(), Cn?.disconnect(), Ko(), window.removeEventListener("resize", bn), _n(), qo(), se !== null && window.clearTimeout(se), En(), Ln(), Me?.remove(), b.destroy(), yt.release(), n.remove());
1151
1176
  }
1152
1177
  };
1153
- async function Zo(r) {
1154
- if (!it) {
1155
- it = r.id, je = null, G(_.getState());
1178
+ async function ei(a) {
1179
+ if (!st) {
1180
+ st = a.id, Je = null, H(b.getState());
1156
1181
  try {
1157
1182
  if (!t.socialPostDraftHandler)
1158
1183
  throw new Error("Social post drafting is not available here.");
1159
- const s = await t.socialPostDraftHandler(r);
1160
- if (!s.linkedinPost || !s.xPost)
1184
+ const d = await t.socialPostDraftHandler(a);
1185
+ if (!d.linkedinPost || !d.xPost)
1161
1186
  throw new Error("Pluno did not return a complete social post draft.");
1162
- Pe.add(r.id), Je.add(r.id), B(), Te?.remove(), Te = lr(s, {
1187
+ Re.add(a.id), at.add(a.id), F(), Me?.remove(), Me = dr(d, {
1163
1188
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1164
1189
  onClose: () => {
1165
- Te?.remove(), Te = null;
1190
+ Me?.remove(), Me = null;
1166
1191
  }
1167
- }), i.appendChild(Te);
1168
- } catch (s) {
1169
- je = s instanceof Error ? s.message : "Could not draft social post.";
1192
+ }), i.appendChild(Me);
1193
+ } catch (d) {
1194
+ Je = d instanceof Error ? d.message : "Could not draft social post.";
1170
1195
  } finally {
1171
- it = null, G(_.getState());
1196
+ st = null, H(b.getState());
1172
1197
  }
1173
1198
  }
1174
1199
  }
1175
- function Tt(r, s) {
1176
- const b = r.accentColor ?? t.accentColor, L = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, At = r.scribbleStyle ?? t.scribbleStyle;
1177
- a = Rn(
1178
- b,
1179
- At
1180
- ), Mn(i, a, {
1181
- accentColor: b,
1182
- colorScheme: L,
1183
- fontFamily: M,
1184
- scribbleStyle: At
1185
- }), Q("web-sdk.widget", "Updated widget appearance", {
1186
- source: s,
1187
- inputAppearance: r,
1188
- appliedAccentColor: b,
1189
- appliedColorScheme: L,
1190
- appliedFontFamily: M,
1191
- appliedScribbleStyle: At,
1200
+ function Ut(a, d) {
1201
+ const _ = a.accentColor ?? t.accentColor, P = a.colorScheme ?? t.colorScheme, O = a.fontFamily ?? t.fontFamily, et = a.scribbleStyle ?? t.scribbleStyle;
1202
+ r = Hn(
1203
+ _,
1204
+ et
1205
+ ), Wn(i, r, {
1206
+ accentColor: _,
1207
+ colorScheme: P,
1208
+ fontFamily: O,
1209
+ scribbleStyle: et
1210
+ }), te("web-sdk.widget", "Updated widget appearance", {
1211
+ source: d,
1212
+ inputAppearance: a,
1213
+ appliedAccentColor: _,
1214
+ appliedColorScheme: P,
1215
+ appliedFontFamily: O,
1216
+ appliedScribbleStyle: et,
1192
1217
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1193
1218
  });
1194
1219
  }
1195
1220
  }
1196
- function Rn(e, t) {
1221
+ function Hn(e, t) {
1197
1222
  return { accentColor: e, scribbleStyle: t };
1198
1223
  }
1199
- function na(e) {
1200
- const t = oa(e);
1201
- return t === null ? "#fafafa" : ia(t) > 0.5 ? "#18181b" : "#fafaf9";
1224
+ function aa(e) {
1225
+ const t = ra(e);
1226
+ return t === null ? "#fafafa" : la(t) > 0.5 ? "#18181b" : "#fafaf9";
1202
1227
  }
1203
- function oa(e) {
1228
+ function ra(e) {
1204
1229
  const t = e.trim();
1205
1230
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1206
1231
  Number.parseInt(t.slice(1, 3), 16),
@@ -1212,14 +1237,14 @@ function oa(e) {
1212
1237
  Number.parseInt(t[3] + t[3], 16)
1213
1238
  ] : null;
1214
1239
  }
1215
- function ia([e, t, n]) {
1240
+ function la([e, t, n]) {
1216
1241
  const o = (i) => {
1217
- const a = i / 255;
1218
- return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
1242
+ const r = i / 255;
1243
+ return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1219
1244
  };
1220
1245
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1221
1246
  }
1222
- function Mn(e, t, n) {
1247
+ function Wn(e, t, n) {
1223
1248
  e.classList.toggle(
1224
1249
  "pluno-pa-widget--dark",
1225
1250
  n.colorScheme === "dark"
@@ -1227,27 +1252,27 @@ function Mn(e, t, n) {
1227
1252
  "pluno-pa-widget--light",
1228
1253
  n.colorScheme !== "dark"
1229
1254
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1230
- const o = n.scribbleStyle ? eo(n.accentColor) : n.accentColor;
1255
+ const o = n.scribbleStyle ? lo(n.accentColor) : n.accentColor;
1231
1256
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1232
1257
  "--pluno-pa-accent-contrast",
1233
- na(o)
1234
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Fi : n.fontFamily, n.scribbleStyle && aa(e.ownerDocument);
1258
+ aa(o)
1259
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Gi : n.fontFamily, n.scribbleStyle && pa(e.ownerDocument);
1235
1260
  const i = Array.from(
1236
1261
  e.querySelectorAll(".pluno-pa-widget__character")
1237
1262
  );
1238
- for (const a of i)
1239
- a.replaceWith(
1240
- be(
1241
- Array.from(a.classList).join(" "),
1263
+ for (const r of i)
1264
+ r.replaceWith(
1265
+ _e(
1266
+ Array.from(r.classList).join(" "),
1242
1267
  t
1243
1268
  )
1244
1269
  );
1245
1270
  }
1246
- function aa(e) {
1247
- if (e.getElementById(Tn))
1271
+ function pa(e) {
1272
+ if (e.getElementById(On))
1248
1273
  return;
1249
1274
  const t = e.createElement("style");
1250
- t.id = Tn, t.textContent = `@font-face {
1275
+ t.id = On, t.textContent = `@font-face {
1251
1276
  font-family: "Architects Daughter";
1252
1277
  font-style: normal;
1253
1278
  font-weight: 400;
@@ -1255,353 +1280,353 @@ function aa(e) {
1255
1280
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1256
1281
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1257
1282
  }
1258
- function ra({
1283
+ function sa({
1259
1284
  root: e,
1260
1285
  launcher: t,
1261
1286
  launcherDragHandle: n,
1262
1287
  getPosition: o,
1263
1288
  setPosition: i,
1264
- persist: a
1289
+ persist: r
1265
1290
  }) {
1266
- let l = null, p = null, d = null, c = !1, u = null;
1291
+ let l = null, p = null, s = null, c = !1, u = null;
1267
1292
  const m = () => {
1268
- l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1293
+ l = null, p = null, s = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1269
1294
  }, k = (h) => {
1270
- 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));
1295
+ 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 }, s = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1271
1296
  }, v = (h) => {
1272
- if (l !== h.pointerId || !p || !d)
1297
+ if (l !== h.pointerId || !p || !s)
1273
1298
  return;
1274
1299
  h.preventDefault();
1275
- const A = h.clientX - p.x, I = h.clientY - p.y;
1276
- !c && Math.hypot(A, I) < Yt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + A, y: d.y + I }));
1300
+ const S = h.clientX - p.x, A = h.clientY - p.y;
1301
+ !c && Math.hypot(S, A) < nn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + S, y: s.y + A }));
1277
1302
  }, D = (h) => {
1278
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, a()), m());
1279
- }, S = (h) => {
1303
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1304
+ }, C = (h) => {
1280
1305
  l === h.pointerId && (h.preventDefault(), m());
1281
1306
  }, g = (h) => {
1282
1307
  if (!u)
1283
1308
  return;
1284
- const A = Math.hypot(
1309
+ const S = Math.hypot(
1285
1310
  h.clientX - u.x,
1286
1311
  h.clientY - u.y
1287
- ) <= Yt;
1288
- u = null, A && (h.preventDefault(), h.stopPropagation());
1289
- }, x = (h) => {
1312
+ ) <= nn;
1313
+ u = null, S && (h.preventDefault(), h.stopPropagation());
1314
+ }, y = (h) => {
1290
1315
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1291
1316
  return;
1292
- const A = h.shiftKey ? co : so, I = o();
1293
- let R = null;
1294
- h.key === "ArrowUp" ? R = { x: I.x, y: I.y - A } : h.key === "ArrowDown" ? R = { x: I.x, y: I.y + A } : h.key === "ArrowLeft" ? R = { x: I.x - A, y: I.y } : h.key === "ArrowRight" && (R = { x: I.x + A, y: I.y }), R && (h.preventDefault(), h.stopPropagation(), i(R), a());
1317
+ const S = h.shiftKey ? bo : wo, A = o();
1318
+ let N = null;
1319
+ h.key === "ArrowUp" ? N = { x: A.x, y: A.y - S } : h.key === "ArrowDown" ? N = { x: A.x, y: A.y + S } : h.key === "ArrowLeft" ? N = { x: A.x - S, y: A.y } : h.key === "ArrowRight" && (N = { x: A.x + S, y: A.y }), N && (h.preventDefault(), h.stopPropagation(), i(N), r());
1295
1320
  };
1296
- return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", D), t.addEventListener("pointercancel", S), t.addEventListener("click", g, !0), n.addEventListener("keydown", x), () => {
1297
- t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", D), t.removeEventListener("pointercancel", S), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", x);
1321
+ return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", D), t.addEventListener("pointercancel", C), t.addEventListener("click", g, !0), n.addEventListener("keydown", y), () => {
1322
+ t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", D), t.removeEventListener("pointercancel", C), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", y);
1298
1323
  };
1299
1324
  }
1300
- function la({
1325
+ function da({
1301
1326
  root: e,
1302
1327
  handles: t,
1303
1328
  getBounds: n,
1304
1329
  setBounds: o,
1305
1330
  persist: i
1306
1331
  }) {
1307
- let a = null, l = null, p = null, d = null, c = !1;
1332
+ let r = null, l = null, p = null, s = null, c = !1;
1308
1333
  const u = () => {
1309
- a = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1334
+ r = null, l = null, p = null, s = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1310
1335
  }, m = (g) => {
1311
- const x = g.currentTarget, h = x.dataset.resizeDirection;
1312
- !e.classList.contains("pluno-pa-widget--open") || !zn(h) || (g.preventDefault(), g.stopPropagation(), a = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, x.setPointerCapture?.(g.pointerId));
1336
+ const y = g.currentTarget, h = y.dataset.resizeDirection;
1337
+ !e.classList.contains("pluno-pa-widget--open") || !Gn(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, s = n(), c = !1, y.setPointerCapture?.(g.pointerId));
1313
1338
  }, k = (g) => {
1314
- if (a !== g.pointerId || !l || !p || !d)
1339
+ if (r !== g.pointerId || !l || !p || !s)
1315
1340
  return;
1316
1341
  g.preventDefault(), g.stopPropagation();
1317
- const x = g.clientX - p.x, h = g.clientY - p.y;
1318
- !c && Math.hypot(x, h) < Yt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1319
- On(d, l, x, h)
1342
+ const y = g.clientX - p.x, h = g.clientY - p.y;
1343
+ !c && Math.hypot(y, h) < nn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1344
+ $n(s, l, y, h)
1320
1345
  ));
1321
1346
  }, v = (g) => {
1322
- a === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1347
+ r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1323
1348
  }, D = (g) => {
1324
- a === g.pointerId && (g.preventDefault(), u());
1325
- }, S = (g) => {
1326
- const h = g.currentTarget.dataset.resizeDirection, A = g.shiftKey ? co : so, I = n();
1327
- let R = 0, P = 0;
1328
- zn(h) && (g.key === "ArrowLeft" ? R = -A : g.key === "ArrowRight" ? R = A : g.key === "ArrowUp" ? P = -A : g.key === "ArrowDown" && (P = A), !(R === 0 && P === 0) && (g.preventDefault(), g.stopPropagation(), o(On(I, h, R, P)), i()));
1349
+ r === g.pointerId && (g.preventDefault(), u());
1350
+ }, C = (g) => {
1351
+ const h = g.currentTarget.dataset.resizeDirection, S = g.shiftKey ? bo : wo, A = n();
1352
+ let N = 0, q = 0;
1353
+ Gn(h) && (g.key === "ArrowLeft" ? N = -S : g.key === "ArrowRight" ? N = S : g.key === "ArrowUp" ? q = -S : g.key === "ArrowDown" && (q = S), !(N === 0 && q === 0) && (g.preventDefault(), g.stopPropagation(), o($n(A, h, N, q)), i()));
1329
1354
  };
1330
1355
  for (const g of t)
1331
- g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", D), g.addEventListener("keydown", S);
1356
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", D), g.addEventListener("keydown", C);
1332
1357
  return () => {
1333
1358
  for (const g of t)
1334
- g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", D), g.removeEventListener("keydown", S);
1359
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", D), g.removeEventListener("keydown", C);
1335
1360
  };
1336
1361
  }
1337
- function zn(e) {
1362
+ function Gn(e) {
1338
1363
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1339
1364
  }
1340
- function On(e, t, n, o) {
1341
- const i = Y(), a = Un({
1365
+ function $n(e, t, n, o) {
1366
+ const i = Z(), r = qn({
1342
1367
  leading: e.position.x,
1343
1368
  length: e.size.width,
1344
1369
  delta: n,
1345
1370
  resizeLeading: t.endsWith("left") || t === "left",
1346
1371
  resizeTrailing: t.endsWith("right") || t === "right",
1347
- minLeading: T,
1348
- maxTrailing: i.width - T,
1372
+ minLeading: I,
1373
+ maxTrailing: i.width - I,
1349
1374
  minLength: Math.min(
1350
- tn,
1351
- i.width - T * 2
1375
+ sn,
1376
+ i.width - I * 2
1352
1377
  )
1353
- }), l = Un({
1378
+ }), l = qn({
1354
1379
  leading: e.position.y,
1355
1380
  length: e.size.height,
1356
1381
  delta: o,
1357
1382
  resizeLeading: t.startsWith("top") || t === "top",
1358
1383
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1359
- minLeading: ke,
1360
- maxTrailing: i.height - T,
1384
+ minLeading: Ie,
1385
+ maxTrailing: i.height - I,
1361
1386
  minLength: Math.min(
1362
- nn,
1363
- i.height - ke - T
1387
+ dn,
1388
+ i.height - Ie - I
1364
1389
  )
1365
1390
  });
1366
1391
  return {
1367
- position: { x: a.leading, y: l.leading },
1368
- size: { width: a.length, height: l.length }
1392
+ position: { x: r.leading, y: l.leading },
1393
+ size: { width: r.length, height: l.length }
1369
1394
  };
1370
1395
  }
1371
- function Un({
1396
+ function qn({
1372
1397
  leading: e,
1373
1398
  length: t,
1374
1399
  delta: n,
1375
1400
  resizeLeading: o,
1376
1401
  resizeTrailing: i,
1377
- minLeading: a,
1402
+ minLeading: r,
1378
1403
  maxTrailing: l,
1379
1404
  minLength: p
1380
1405
  }) {
1381
- const d = e + t;
1406
+ const s = e + t;
1382
1407
  if (o) {
1383
1408
  const c = e + n;
1384
- if (c >= a) {
1385
- const m = K(c, a, d - p);
1386
- return { leading: m, length: d - m };
1409
+ if (c >= r) {
1410
+ const m = X(c, r, s - p);
1411
+ return { leading: m, length: s - m };
1387
1412
  }
1388
- const u = K(
1389
- d + a - c,
1390
- d,
1413
+ const u = X(
1414
+ s + r - c,
1415
+ s,
1391
1416
  l
1392
1417
  );
1393
- return { leading: a, length: u - a };
1418
+ return { leading: r, length: u - r };
1394
1419
  }
1395
1420
  if (i) {
1396
- const c = d + n;
1421
+ const c = s + n;
1397
1422
  if (c <= l) {
1398
- const m = K(
1423
+ const m = X(
1399
1424
  c,
1400
1425
  e + p,
1401
1426
  l
1402
1427
  );
1403
1428
  return { leading: e, length: m - e };
1404
1429
  }
1405
- const u = K(
1430
+ const u = X(
1406
1431
  e - (c - l),
1407
- a,
1432
+ r,
1408
1433
  e
1409
1434
  );
1410
1435
  return { leading: u, length: l - u };
1411
1436
  }
1412
1437
  return { leading: e, length: t };
1413
1438
  }
1414
- function ut(e, t = !0) {
1415
- const n = Y();
1439
+ function wt(e, t = !0) {
1440
+ const n = Z();
1416
1441
  if (e.classList.contains("pluno-pa-widget--minimized"))
1417
1442
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1418
- width: Hi,
1419
- height: Wi
1420
- } : { width: An, height: An };
1443
+ width: $i,
1444
+ height: qi
1445
+ } : { width: Un, height: Un };
1421
1446
  const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1422
1447
  return {
1423
- width: t && i && o.width > 0 ? o.width : Math.min(ro, n.width - 36),
1424
- height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? $i : lo
1448
+ width: t && i && o.width > 0 ? o.width : Math.min(ho, n.width - 36),
1449
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vi : mo
1425
1450
  };
1426
1451
  }
1427
- function pa() {
1428
- const e = Y();
1452
+ function ca() {
1453
+ const e = Z();
1429
1454
  return {
1430
1455
  width: Math.min(
1431
- K(
1432
- e.width * ji,
1433
- tn,
1434
- qi
1456
+ X(
1457
+ e.width * Yi,
1458
+ sn,
1459
+ Ki
1435
1460
  ),
1436
- e.width - T * 2
1461
+ e.width - I * 2
1437
1462
  ),
1438
1463
  height: Math.min(
1439
- K(
1440
- e.height * Ki,
1441
- nn,
1442
- Vi
1464
+ X(
1465
+ e.height * Zi,
1466
+ dn,
1467
+ Xi
1443
1468
  ),
1444
- e.height - ke - T
1469
+ e.height - Ie - I
1445
1470
  )
1446
1471
  };
1447
1472
  }
1448
- function ze(e = null) {
1449
- return e ? ht(e) : pa();
1473
+ function He(e = null) {
1474
+ return e ? _t(e) : ca();
1450
1475
  }
1451
- function ht(e) {
1452
- const t = Y();
1476
+ function _t(e) {
1477
+ const t = Z();
1453
1478
  return {
1454
- width: K(
1479
+ width: X(
1455
1480
  e.width,
1456
1481
  Math.min(
1457
- tn,
1458
- t.width - T * 2
1482
+ sn,
1483
+ t.width - I * 2
1459
1484
  ),
1460
1485
  Math.max(
1461
- T,
1462
- t.width - T * 2
1486
+ I,
1487
+ t.width - I * 2
1463
1488
  )
1464
1489
  ),
1465
- height: K(
1490
+ height: X(
1466
1491
  e.height,
1467
1492
  Math.min(
1468
- nn,
1469
- t.height - ke - T
1493
+ dn,
1494
+ t.height - Ie - I
1470
1495
  ),
1471
1496
  Math.max(
1472
- T,
1473
- t.height - ke - T
1497
+ I,
1498
+ t.height - Ie - I
1474
1499
  )
1475
1500
  )
1476
1501
  };
1477
1502
  }
1478
- function Rt(e, t) {
1503
+ function Ht(e, t) {
1479
1504
  if (!t) {
1480
1505
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1481
1506
  return;
1482
1507
  }
1483
- const n = ht(t);
1508
+ const n = _t(t);
1484
1509
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1485
1510
  }
1486
- function sa(e, t, n) {
1511
+ function ua(e, t, n) {
1487
1512
  const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1488
1513
  if (Number.isFinite(o) && Number.isFinite(i))
1489
1514
  return { x: o, y: i };
1490
- const a = e.getBoundingClientRect();
1491
- if (a.width > 0 || a.height > 0)
1492
- return { x: a.left, y: a.top };
1493
- const l = Y();
1515
+ const r = e.getBoundingClientRect();
1516
+ if (r.width > 0 || r.height > 0)
1517
+ return { x: r.left, y: r.top };
1518
+ const l = Z();
1494
1519
  return {
1495
1520
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1496
1521
  y: l.height - 24 - n.height
1497
1522
  };
1498
1523
  }
1499
- function Mt(e, t, n) {
1500
- const o = ut(e, !1);
1501
- return t ? Xt(
1524
+ function Wt(e, t, n) {
1525
+ const o = wt(e, !1);
1526
+ return t ? on(
1502
1527
  e,
1503
- ho(t, o),
1528
+ yo(t, o),
1504
1529
  o
1505
- ) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
1530
+ ) : ga(n === "bottom-left" ? "bottom-left" : "bottom-right", o, ji);
1506
1531
  }
1507
- function da(e, t, n) {
1508
- const o = Y();
1532
+ function ga(e, t, n) {
1533
+ const o = Z();
1509
1534
  return {
1510
1535
  x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1511
1536
  y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1512
1537
  };
1513
1538
  }
1514
- function Xt(e, t, n) {
1515
- const o = Y(), i = T + ga(e);
1539
+ function on(e, t, n) {
1540
+ const o = Z(), i = I + fa(e);
1516
1541
  return {
1517
- x: K(
1542
+ x: X(
1518
1543
  t.x,
1519
- T,
1544
+ I,
1520
1545
  Math.max(
1521
- T,
1522
- o.width - n.width - T
1546
+ I,
1547
+ o.width - n.width - I
1523
1548
  )
1524
1549
  ),
1525
- y: K(
1550
+ y: X(
1526
1551
  t.y,
1527
1552
  i,
1528
1553
  Math.max(
1529
1554
  i,
1530
- o.height - n.height - T
1555
+ o.height - n.height - I
1531
1556
  )
1532
1557
  )
1533
1558
  };
1534
1559
  }
1535
- function ho(e, t) {
1536
- const n = Y();
1560
+ function yo(e, t) {
1561
+ const n = Z();
1537
1562
  return {
1538
1563
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1539
1564
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1540
1565
  };
1541
1566
  }
1542
- function ca(e, t) {
1543
- const n = ua(e, t), o = Y();
1567
+ function ha(e, t) {
1568
+ const n = ma(e, t), o = Z();
1544
1569
  return {
1545
1570
  anchor: n,
1546
1571
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1547
1572
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1548
1573
  };
1549
1574
  }
1550
- function ua(e, t) {
1551
- const n = Y(), o = e.x + t.width / 2, a = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1552
- return `${a}-${l}`;
1575
+ function ma(e, t) {
1576
+ const n = Z(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1577
+ return `${r}-${l}`;
1553
1578
  }
1554
- function ga(e) {
1555
- return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
1579
+ function fa(e) {
1580
+ return e.classList.contains("pluno-pa-widget--scribble") ? ta : ea;
1556
1581
  }
1557
- function zt(e, t, n, o = null) {
1558
- const i = ut(e), a = ze(o), l = {
1559
- x: n === "bottom-left" ? t.x : t.x + i.width - a.width,
1560
- y: t.y + i.height - a.height
1582
+ function Gt(e, t, n, o = null) {
1583
+ const i = wt(e), r = He(o), l = {
1584
+ x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1585
+ y: t.y + i.height - r.height
1561
1586
  };
1562
- return st(l, a);
1587
+ return ht(l, r);
1563
1588
  }
1564
- function st(e, t) {
1565
- const n = Y();
1589
+ function ht(e, t) {
1590
+ const n = Z();
1566
1591
  return {
1567
- x: K(
1592
+ x: X(
1568
1593
  e.x,
1569
- T,
1594
+ I,
1570
1595
  Math.max(
1571
- T,
1572
- n.width - t.width - T
1596
+ I,
1597
+ n.width - t.width - I
1573
1598
  )
1574
1599
  ),
1575
- y: K(
1600
+ y: X(
1576
1601
  e.y,
1577
- ke,
1602
+ Ie,
1578
1603
  Math.max(
1579
- ke,
1580
- n.height - t.height - T
1604
+ Ie,
1605
+ n.height - t.height - I
1581
1606
  )
1582
1607
  )
1583
1608
  };
1584
1609
  }
1585
- function Ee(e, t) {
1610
+ function Te(e, t) {
1586
1611
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1587
1612
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1588
1613
  return;
1589
1614
  }
1590
1615
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1591
1616
  }
1592
- function ha(e, t) {
1617
+ function wa(e, t) {
1593
1618
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1594
1619
  }
1595
- function Bn(e) {
1620
+ function jn(e) {
1596
1621
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1597
1622
  }
1598
- function Y() {
1623
+ function Z() {
1599
1624
  return {
1600
- width: window.innerWidth || document.documentElement.clientWidth || ro + T * 2,
1601
- height: window.innerHeight || document.documentElement.clientHeight || lo + T * 2
1625
+ width: window.innerWidth || document.documentElement.clientWidth || ho + I * 2,
1626
+ height: window.innerHeight || document.documentElement.clientHeight || mo + I * 2
1602
1627
  };
1603
1628
  }
1604
- function Ot(e) {
1629
+ function $t(e) {
1605
1630
  const t = e.getBoundingClientRect();
1606
1631
  return {
1607
1632
  x: Math.round(t.x),
@@ -1610,10 +1635,10 @@ function Ot(e) {
1610
1635
  height: Math.round(t.height)
1611
1636
  };
1612
1637
  }
1613
- function K(e, t, n) {
1638
+ function X(e, t, n) {
1614
1639
  return Math.min(Math.max(e, t), n);
1615
1640
  }
1616
- function Q(e, t, n) {
1641
+ function te(e, t, n) {
1617
1642
  if (typeof window > "u")
1618
1643
  return;
1619
1644
  const o = window, i = {
@@ -1621,46 +1646,46 @@ function Q(e, t, n) {
1621
1646
  source: e,
1622
1647
  message: t,
1623
1648
  details: n
1624
- }, a = o.__plunoProductAgentDiagnostics__ ?? [];
1625
- a.push(i), a.length > 120 && a.splice(0, a.length - 120), o.__plunoProductAgentDiagnostics__ = a, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
1626
- new CustomEvent(Ri, { detail: i })
1649
+ }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1650
+ r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1651
+ new CustomEvent(Oi, { detail: i })
1627
1652
  );
1628
1653
  }
1629
- function ma(e, t) {
1630
- Q("web-sdk.widget.position", e, t);
1654
+ function ba(e, t) {
1655
+ te("web-sdk.widget.position", e, t);
1631
1656
  }
1632
- function Ut(e, t, n) {
1657
+ function qt(e, t, n) {
1633
1658
  const o = t.value.trim();
1634
1659
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1635
- attachments: n.length > 0 ? n.map(ba) : void 0
1660
+ attachments: n.length > 0 ? n.map(ya) : void 0
1636
1661
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1637
1662
  }
1638
- function fa(e, t, n) {
1663
+ function _a(e, t, n) {
1639
1664
  const o = e.activeElement;
1640
1665
  return o === n ? "composer" : o === t ? "launcher" : null;
1641
1666
  }
1642
- function wa(e, t, n, o) {
1643
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > vi)
1667
+ function xa(e, t, n, o) {
1668
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Ei)
1644
1669
  return;
1645
1670
  const i = e.focusedInput === "composer" ? o : n;
1646
1671
  i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1647
1672
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1648
1673
  });
1649
1674
  }
1650
- function ba(e) {
1675
+ function ya(e) {
1651
1676
  return e;
1652
1677
  }
1653
- function Ke(e) {
1678
+ function tt(e) {
1654
1679
  e.style.height = "0px";
1655
1680
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1656
1681
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1657
1682
  }
1658
- function Ye(e, t = () => !0) {
1683
+ function nt(e, t = () => !0) {
1659
1684
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1660
1685
  t() && (e.scrollTop = e.scrollHeight);
1661
1686
  });
1662
1687
  }
1663
- function _a(e) {
1688
+ function va(e) {
1664
1689
  const t = e.messages[e.messages.length - 1];
1665
1690
  return [
1666
1691
  e.messages.length,
@@ -1671,13 +1696,13 @@ function _a(e) {
1671
1696
  e.lastError ?? ""
1672
1697
  ].join(":");
1673
1698
  }
1674
- function xa(e) {
1699
+ function Ca(e) {
1675
1700
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1676
1701
  }
1677
- function ya(e) {
1702
+ function Sa(e) {
1678
1703
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1679
1704
  }
1680
- function va(e) {
1705
+ function Ea(e) {
1681
1706
  const t = e.currentPage;
1682
1707
  if (typeof t?.url == "string" && t.url.trim())
1683
1708
  try {
@@ -1688,7 +1713,7 @@ function va(e) {
1688
1713
  }
1689
1714
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1690
1715
  }
1691
- function Ca(e, t) {
1716
+ function ka(e, t) {
1692
1717
  const n = new Date(e).getTime();
1693
1718
  if (!Number.isFinite(n))
1694
1719
  return "now";
@@ -1697,103 +1722,103 @@ function Ca(e, t) {
1697
1722
  ["hour", 36e5],
1698
1723
  ["min", 6e4]
1699
1724
  ];
1700
- for (const [a, l] of i)
1725
+ for (const [r, l] of i)
1701
1726
  if (o >= l) {
1702
1727
  const p = Math.max(1, Math.floor(o / l));
1703
- return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
1728
+ return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1704
1729
  }
1705
1730
  return "now";
1706
1731
  }
1707
- function Sa(e, t, n, o, i) {
1708
- e.appendChild(Da()), e.appendChild(
1709
- Ea(
1732
+ function La(e, t, n, o, i) {
1733
+ e.appendChild(za()), e.appendChild(
1734
+ Pa(
1710
1735
  t,
1711
1736
  n,
1712
1737
  o,
1713
1738
  i
1714
1739
  )
1715
1740
  ), e.appendChild(
1716
- mt(
1741
+ xt(
1717
1742
  "pluno-pa-widget__close",
1718
1743
  "Close",
1719
- Ra(16),
1744
+ Oa(16),
1720
1745
  !0
1721
1746
  )
1722
- ), e.appendChild(ka(n));
1747
+ ), e.appendChild(Ta(n));
1723
1748
  }
1724
- function Ea(e, t, n, o) {
1749
+ function Pa(e, t, n, o) {
1725
1750
  const i = document.createElement("form");
1726
1751
  if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1727
- const d = document.createElement("button");
1728
- 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);
1752
+ const s = document.createElement("button");
1753
+ s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", i.appendChild(s);
1729
1754
  }
1730
1755
  i.appendChild(
1731
- bo(
1756
+ Eo(
1732
1757
  "pluno-pa-widget__scribble-spirals--launcher",
1733
1758
  10
1734
1759
  )
1735
1760
  ), i.appendChild(
1736
- be(
1761
+ _e(
1737
1762
  "pluno-pa-widget__character--launcher",
1738
1763
  t
1739
1764
  )
1740
1765
  );
1741
- const a = document.createElement("span");
1742
- a.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(a);
1766
+ const r = document.createElement("span");
1767
+ r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1743
1768
  const l = document.createElement("input");
1744
1769
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1745
- const p = gt("Working...");
1770
+ const p = bt("Working...");
1746
1771
  if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1747
- const d = document.createElement("button");
1748
- 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);
1772
+ const s = document.createElement("button");
1773
+ s.type = "button", s.className = "pluno-pa-widget__launcher-minimize", s.textContent = "-", s.setAttribute("aria-label", "Minimize Pluno on this site"), s.title = "Minimize Pluno on this site", i.appendChild(s);
1749
1774
  }
1750
1775
  return i;
1751
1776
  }
1752
- function ka(e) {
1777
+ function Ta(e) {
1753
1778
  const t = document.createElement("section");
1754
1779
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1755
- bo("pluno-pa-widget__scribble-spirals--panel", 16)
1780
+ Eo("pluno-pa-widget__scribble-spirals--panel", 16)
1756
1781
  );
1757
1782
  const n = document.createElement("div");
1758
1783
  n.className = "pluno-pa-widget__timeline-wrap";
1759
1784
  const o = document.createElement("main");
1760
- o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
1785
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Ra(e));
1761
1786
  const i = document.createElement("div");
1762
1787
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1763
- const a = document.createElement("div");
1764
- a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a);
1788
+ const r = document.createElement("div");
1789
+ r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, n.appendChild(r);
1765
1790
  const l = document.createElement("button");
1766
1791
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1767
1792
  const p = document.createElement("div");
1768
1793
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1769
- mt(
1794
+ xt(
1770
1795
  "pluno-pa-widget__history",
1771
- Zt(),
1772
- za(),
1796
+ an(),
1797
+ Ba(),
1773
1798
  !0
1774
1799
  )
1775
- ), n.appendChild(p), n.appendChild(Ia()), t.appendChild(n), t.appendChild(La()), t.appendChild(Pa()), t.appendChild(we("left", "Resize Pluno from left")), t.appendChild(
1776
- we("right", "Resize Pluno from right")
1777
- ), t.appendChild(we("top", "Resize Pluno from top")), t.appendChild(
1778
- we("bottom", "Resize Pluno from bottom")
1800
+ ), n.appendChild(p), n.appendChild(Na()), t.appendChild(n), t.appendChild(Ia()), t.appendChild(Aa()), t.appendChild(be("left", "Resize Pluno from left")), t.appendChild(
1801
+ be("right", "Resize Pluno from right")
1802
+ ), t.appendChild(be("top", "Resize Pluno from top")), t.appendChild(
1803
+ be("bottom", "Resize Pluno from bottom")
1779
1804
  ), t.appendChild(
1780
- we("top-left", "Resize Pluno from top left")
1805
+ be("top-left", "Resize Pluno from top left")
1781
1806
  ), t.appendChild(
1782
- we("top-right", "Resize Pluno from top right")
1807
+ be("top-right", "Resize Pluno from top right")
1783
1808
  ), t.appendChild(
1784
- we("bottom-left", "Resize Pluno from bottom left")
1809
+ be("bottom-left", "Resize Pluno from bottom left")
1785
1810
  ), t.appendChild(
1786
- we("bottom-right", "Resize Pluno from bottom right")
1811
+ be("bottom-right", "Resize Pluno from bottom right")
1787
1812
  ), t;
1788
1813
  }
1789
- function we(e, t) {
1814
+ function be(e, t) {
1790
1815
  const n = document.createElement("button");
1791
1816
  return n.type = "button", n.className = [
1792
1817
  "pluno-pa-widget__resize-handle",
1793
1818
  `pluno-pa-widget__resize-handle--${e}`
1794
1819
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1795
1820
  }
1796
- function La() {
1821
+ function Ia() {
1797
1822
  const e = document.createElement("div");
1798
1823
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1799
1824
  const t = document.createElement("span");
@@ -1804,10 +1829,10 @@ function La() {
1804
1829
  o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
1805
1830
  const i = document.createElement("button");
1806
1831
  i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
1807
- const a = document.createElement("button");
1808
- return a.type = "button", a.className = "pluno-pa-widget__notify-suggestion-never", a.textContent = "Never", n.append(o, i, a), e.append(t, n), e;
1832
+ const r = document.createElement("button");
1833
+ 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;
1809
1834
  }
1810
- function Pa() {
1835
+ function Aa() {
1811
1836
  const e = document.createElement("form");
1812
1837
  e.className = "pluno-pa-widget__composer";
1813
1838
  const t = document.createElement("div");
@@ -1818,14 +1843,14 @@ function Pa() {
1818
1843
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1819
1844
  const i = document.createElement("div");
1820
1845
  i.className = "pluno-pa-widget__composer-inner";
1821
- const a = document.createElement("input");
1822
- a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
1846
+ const r = document.createElement("input");
1847
+ r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1823
1848
  const l = document.createElement("button");
1824
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ua()), l.appendChild(Ba()), i.appendChild(l);
1849
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ha()), l.appendChild(Wa()), i.appendChild(l);
1825
1850
  const p = document.createElement("textarea");
1826
1851
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1827
- const d = document.createElement("button");
1828
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(xo()), i.appendChild(d), e.appendChild(i);
1852
+ const s = document.createElement("button");
1853
+ s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(Lo()), i.appendChild(s), e.appendChild(i);
1829
1854
  const c = document.createElement("div");
1830
1855
  c.className = "pluno-pa-widget__composer-meta";
1831
1856
  const u = document.createElement("a");
@@ -1833,42 +1858,42 @@ function Pa() {
1833
1858
  const m = document.createElement("span");
1834
1859
  return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1835
1860
  }
1836
- function Zt() {
1861
+ function an() {
1837
1862
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1838
1863
  }
1839
- function Ia() {
1864
+ function Na() {
1840
1865
  const e = document.createElement("section");
1841
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Zt());
1866
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", an());
1842
1867
  const t = document.createElement("div");
1843
1868
  t.className = "pluno-pa-widget__history-header";
1844
1869
  const n = document.createElement("strong");
1845
- n.textContent = Zt();
1846
- const o = mt(
1870
+ n.textContent = an();
1871
+ const o = xt(
1847
1872
  "pluno-pa-widget__history-close",
1848
1873
  "Close recent chats",
1849
- Oa(),
1874
+ Fa(),
1850
1875
  !1
1851
1876
  );
1852
1877
  t.append(n, o);
1853
1878
  const i = document.createElement("div");
1854
1879
  i.className = "pluno-pa-widget__history-list";
1855
- const a = document.createElement("p");
1856
- return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
1880
+ const r = document.createElement("p");
1881
+ return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1857
1882
  }
1858
- function Ta(e) {
1883
+ function Ra(e) {
1859
1884
  const t = document.createElement("div");
1860
1885
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1861
- be(
1886
+ _e(
1862
1887
  "pluno-pa-widget__character--empty",
1863
1888
  e
1864
1889
  )
1865
- ), t.appendChild(mo()), t;
1890
+ ), t.appendChild(vo()), t;
1866
1891
  }
1867
- function mo() {
1892
+ function vo() {
1868
1893
  const e = document.createElement("div");
1869
1894
  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;
1870
1895
  }
1871
- function fo(e, t) {
1896
+ function Co(e, t) {
1872
1897
  e.replaceChildren(), e.setAttribute(
1873
1898
  "aria-label",
1874
1899
  `${t.toLocaleString("en-US")} users currently active`
@@ -1880,17 +1905,17 @@ function fo(e, t) {
1880
1905
  )
1881
1906
  );
1882
1907
  }
1883
- function be(e, t) {
1884
- const n = `pluno-pa-character-${Dn}`;
1885
- Dn += 1;
1886
- const o = t.scribbleStyle ? Na(t.accentColor, n) : Aa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1908
+ function _e(e, t) {
1909
+ const n = `pluno-pa-character-${Fn}`;
1910
+ Fn += 1;
1911
+ const o = t.scribbleStyle ? Ma(t.accentColor, n) : Da(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1887
1912
  return o.setAttribute(
1888
1913
  "class",
1889
1914
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1890
1915
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1891
1916
  }
1892
- function Aa(e, t) {
1893
- const n = ni(e), o = {
1917
+ function Da(e, t) {
1918
+ const n = ai(e), o = {
1894
1919
  boltFill: `${t}-boltFill`,
1895
1920
  boltEdge: `${t}-boltEdge`,
1896
1921
  boltGlow: `${t}-boltGlow`,
@@ -1901,7 +1926,7 @@ function Aa(e, t) {
1901
1926
  eyeShadow: `${t}-eyeShadow`,
1902
1927
  pupilGloss: `${t}-pupilGloss`,
1903
1928
  boltClip: `${t}-boltClip`
1904
- }, i = wo(), a = f(i, "defs"), l = f(a, "linearGradient", {
1929
+ }, i = So(), r = f(i, "defs"), l = f(r, "linearGradient", {
1905
1930
  id: o.boltFill,
1906
1931
  x1: "420",
1907
1932
  y1: "180",
@@ -1909,8 +1934,8 @@ function Aa(e, t) {
1909
1934
  y2: "1040",
1910
1935
  gradientUnits: "userSpaceOnUse"
1911
1936
  });
1912
- O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1913
- const p = f(a, "linearGradient", {
1937
+ B(l, "0", n.top), B(l, "0.36", n.middle), B(l, "0.72", n.bottom), B(l, "1", n.bottom);
1938
+ const p = f(r, "linearGradient", {
1914
1939
  id: o.boltEdge,
1915
1940
  x1: "470",
1916
1941
  y1: "145",
@@ -1918,29 +1943,29 @@ function Aa(e, t) {
1918
1943
  y2: "980",
1919
1944
  gradientUnits: "userSpaceOnUse"
1920
1945
  });
1921
- O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1922
- const d = f(a, "radialGradient", {
1946
+ B(p, "0", n.edgeStart), B(p, "0.32", n.edgeMiddle), B(p, "0.78", n.edgeEnd), B(p, "1", n.edgeEnd);
1947
+ const s = f(r, "radialGradient", {
1923
1948
  id: o.boltGlow,
1924
1949
  cx: "50%",
1925
1950
  cy: "22%",
1926
1951
  r: "82%"
1927
1952
  });
1928
- O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1929
- const c = f(a, "radialGradient", {
1953
+ B(s, "0", n.glow, "0.72"), B(s, "0.5", n.middle, "0.44"), B(s, "1", n.bottom, "0");
1954
+ const c = f(r, "radialGradient", {
1930
1955
  id: o.eyeWhite,
1931
1956
  cx: "35%",
1932
1957
  cy: "25%",
1933
1958
  r: "70%"
1934
1959
  });
1935
- O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1936
- const u = f(a, "radialGradient", {
1960
+ B(c, "0", "#ffffff"), B(c, "0.72", "#ffffff"), B(c, "1", "#e5e5e5");
1961
+ const u = f(r, "radialGradient", {
1937
1962
  id: o.pupil,
1938
1963
  cx: "42%",
1939
1964
  cy: "38%",
1940
1965
  r: "65%"
1941
1966
  });
1942
- O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1943
- const m = f(a, "filter", {
1967
+ B(u, "0", "#2a1f10"), B(u, "0.52", "#080604"), B(u, "1", "#000000");
1968
+ const m = f(r, "filter", {
1944
1969
  id: o.softDropShadow,
1945
1970
  x: "-18%",
1946
1971
  y: "-12%",
@@ -1955,7 +1980,7 @@ function Aa(e, t) {
1955
1980
  "flood-color": n.shadow,
1956
1981
  "flood-opacity": "0.24"
1957
1982
  });
1958
- const k = f(a, "filter", {
1983
+ const k = f(r, "filter", {
1959
1984
  id: o.innerDepth,
1960
1985
  x: "-8%",
1961
1986
  y: "-8%",
@@ -1988,7 +2013,7 @@ function Aa(e, t) {
1988
2013
  in2: "innerLight",
1989
2014
  mode: "screen"
1990
2015
  });
1991
- const v = f(a, "filter", {
2016
+ const v = f(r, "filter", {
1992
2017
  id: o.eyeShadow,
1993
2018
  x: "-24%",
1994
2019
  y: "-20%",
@@ -2003,7 +2028,7 @@ function Aa(e, t) {
2003
2028
  "flood-color": n.shadow,
2004
2029
  "flood-opacity": "0.3"
2005
2030
  });
2006
- const D = f(a, "filter", {
2031
+ const D = f(r, "filter", {
2007
2032
  id: o.pupilGloss,
2008
2033
  x: "-15%",
2009
2034
  y: "-15%",
@@ -2018,27 +2043,27 @@ function Aa(e, t) {
2018
2043
  "flood-color": "#000000",
2019
2044
  "flood-opacity": "0.22"
2020
2045
  });
2021
- const S = f(a, "clipPath", { id: o.boltClip });
2022
- f(S, "path", { d: dt });
2046
+ const C = f(r, "clipPath", { id: o.boltClip });
2047
+ f(C, "path", { d: mt });
2023
2048
  const g = f(i, "g", {
2024
- filter: V(o.softDropShadow)
2049
+ filter: Y(o.softDropShadow)
2025
2050
  });
2026
2051
  f(g, "path", {
2027
- d: dt,
2028
- fill: V(o.boltEdge)
2052
+ d: mt,
2053
+ fill: Y(o.boltEdge)
2029
2054
  });
2030
- const x = "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";
2055
+ const y = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
2031
2056
  f(g, "path", {
2032
- d: x,
2033
- fill: V(o.boltFill),
2034
- filter: V(o.innerDepth)
2057
+ d: y,
2058
+ fill: Y(o.boltFill),
2059
+ filter: Y(o.innerDepth)
2035
2060
  }), f(g, "path", {
2036
- d: x,
2037
- fill: V(o.boltGlow),
2061
+ d: y,
2062
+ fill: Y(o.boltGlow),
2038
2063
  opacity: "0.74"
2039
2064
  });
2040
2065
  const h = f(g, "g", {
2041
- "clip-path": V(o.boltClip),
2066
+ "clip-path": Y(o.boltClip),
2042
2067
  opacity: "0.42"
2043
2068
  });
2044
2069
  f(h, "path", {
@@ -2063,9 +2088,9 @@ function Aa(e, t) {
2063
2088
  "stroke-linecap": "round",
2064
2089
  opacity: "0.48"
2065
2090
  });
2066
- const A = f(i, "g", { filter: V(o.eyeShadow) });
2067
- return Fn(
2068
- A,
2091
+ const S = f(i, "g", { filter: Y(o.eyeShadow) });
2092
+ return Vn(
2093
+ S,
2069
2094
  "rotate(-2 528 463)",
2070
2095
  "528",
2071
2096
  "463",
@@ -2074,8 +2099,8 @@ function Aa(e, t) {
2074
2099
  "557",
2075
2100
  "447",
2076
2101
  o
2077
- ), Fn(
2078
- A,
2102
+ ), Vn(
2103
+ S,
2079
2104
  "rotate(2 717 462)",
2080
2105
  "717",
2081
2106
  "462",
@@ -2086,13 +2111,13 @@ function Aa(e, t) {
2086
2111
  o
2087
2112
  ), i;
2088
2113
  }
2089
- function Na(e, t) {
2090
- const n = eo(e), o = {
2114
+ function Ma(e, t) {
2115
+ const n = lo(e), o = {
2091
2116
  clip: `${t}-scribbleBoltClip`,
2092
2117
  wobble: `${t}-scribbleBoltWobble`
2093
- }, i = wo(), a = f(i, "defs"), l = f(a, "clipPath", { id: o.clip });
2094
- f(l, "path", { d: dt });
2095
- const p = f(a, "filter", {
2118
+ }, i = So(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2119
+ f(l, "path", { d: mt });
2120
+ const p = f(r, "filter", {
2096
2121
  id: o.wobble,
2097
2122
  x: "-10%",
2098
2123
  y: "-10%",
@@ -2113,11 +2138,11 @@ function Na(e, t) {
2113
2138
  xChannelSelector: "R",
2114
2139
  yChannelSelector: "G"
2115
2140
  });
2116
- const d = f(i, "g", { filter: V(o.wobble) }), c = f(d, "g", {
2117
- "clip-path": V(o.clip)
2141
+ const s = f(i, "g", { filter: Y(o.wobble) }), c = f(s, "g", {
2142
+ "clip-path": Y(o.clip)
2118
2143
  });
2119
2144
  return f(c, "path", {
2120
- d: ti(),
2145
+ d: ii(),
2121
2146
  fill: "none",
2122
2147
  stroke: n,
2123
2148
  "stroke-width": "56",
@@ -2125,14 +2150,14 @@ function Na(e, t) {
2125
2150
  "stroke-linejoin": "round",
2126
2151
  opacity: "0.9",
2127
2152
  transform: "rotate(-14 627 600)"
2128
- }), f(d, "path", {
2129
- d: dt,
2153
+ }), f(s, "path", {
2154
+ d: mt,
2130
2155
  fill: "none",
2131
- stroke: ct,
2156
+ stroke: ft,
2132
2157
  "stroke-width": "18",
2133
2158
  "stroke-linejoin": "round"
2134
- }), Hn(
2135
- d,
2159
+ }), Kn(
2160
+ s,
2136
2161
  "rotate(-2 528 463)",
2137
2162
  "528",
2138
2163
  "463",
@@ -2140,8 +2165,8 @@ function Na(e, t) {
2140
2165
  "473",
2141
2166
  "557",
2142
2167
  "447"
2143
- ), Hn(
2144
- d,
2168
+ ), Kn(
2169
+ s,
2145
2170
  "rotate(2 717 462)",
2146
2171
  "717",
2147
2172
  "462",
@@ -2151,27 +2176,27 @@ function Na(e, t) {
2151
2176
  "447"
2152
2177
  ), i;
2153
2178
  }
2154
- function wo() {
2179
+ function So() {
2155
2180
  return E("svg", {
2156
- xmlns: po,
2181
+ xmlns: fo,
2157
2182
  viewBox: "0 0 1254 1254"
2158
2183
  });
2159
2184
  }
2160
- function Fn(e, t, n, o, i, a, l, p, d) {
2185
+ function Vn(e, t, n, o, i, r, l, p, s) {
2161
2186
  const c = f(e, "g", { transform: t });
2162
2187
  f(c, "ellipse", {
2163
2188
  cx: n,
2164
2189
  cy: o,
2165
2190
  rx: "73",
2166
2191
  ry: "80",
2167
- fill: V(d.eyeWhite)
2192
+ fill: Y(s.eyeWhite)
2168
2193
  }), f(c, "ellipse", {
2169
2194
  cx: i,
2170
- cy: a,
2195
+ cy: r,
2171
2196
  rx: "49",
2172
2197
  ry: "57",
2173
- fill: V(d.pupil),
2174
- filter: V(d.pupilGloss)
2198
+ fill: Y(s.pupil),
2199
+ filter: Y(s.pupilGloss)
2175
2200
  }), f(c, "circle", {
2176
2201
  cx: l,
2177
2202
  cy: p,
@@ -2179,23 +2204,23 @@ function Fn(e, t, n, o, i, a, l, p, d) {
2179
2204
  fill: "#ffffff"
2180
2205
  });
2181
2206
  }
2182
- function Hn(e, t, n, o, i, a, l, p) {
2183
- const d = f(e, "g", { transform: t });
2184
- f(d, "ellipse", {
2207
+ function Kn(e, t, n, o, i, r, l, p) {
2208
+ const s = f(e, "g", { transform: t });
2209
+ f(s, "ellipse", {
2185
2210
  cx: n,
2186
2211
  cy: o,
2187
2212
  rx: "73",
2188
2213
  ry: "80",
2189
2214
  fill: "#ffffff",
2190
- stroke: ct,
2215
+ stroke: ft,
2191
2216
  "stroke-width": "13"
2192
- }), f(d, "ellipse", {
2217
+ }), f(s, "ellipse", {
2193
2218
  cx: i,
2194
- cy: a,
2219
+ cy: r,
2195
2220
  rx: "45",
2196
2221
  ry: "53",
2197
- fill: ct
2198
- }), f(d, "circle", {
2222
+ fill: ft
2223
+ }), f(s, "circle", {
2199
2224
  cx: l,
2200
2225
  cy: p,
2201
2226
  r: "16",
@@ -2206,18 +2231,18 @@ function f(e, t, n = {}) {
2206
2231
  const o = E(t, n);
2207
2232
  return e.appendChild(o), o;
2208
2233
  }
2209
- function O(e, t, n, o) {
2234
+ function B(e, t, n, o) {
2210
2235
  const i = { offset: t, "stop-color": n };
2211
2236
  o !== void 0 && (i["stop-opacity"] = o), f(e, "stop", i);
2212
2237
  }
2213
- function V(e) {
2238
+ function Y(e) {
2214
2239
  return `url(#${e})`;
2215
2240
  }
2216
- function mt(e, t, n, o) {
2241
+ function xt(e, t, n, o) {
2217
2242
  const i = document.createElement("button");
2218
2243
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2219
2244
  }
2220
- function Da() {
2245
+ function za() {
2221
2246
  const e = E("svg", {
2222
2247
  class: "pluno-pa-widget__scribble-defs",
2223
2248
  "aria-hidden": "true",
@@ -2225,48 +2250,48 @@ function Da() {
2225
2250
  width: "0",
2226
2251
  height: "0"
2227
2252
  }), t = E("defs");
2228
- return t.appendChild(Ft("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2229
- Ft("pluno-pa-scribble-wobble-2", "5", "15")
2253
+ return t.appendChild(Vt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2254
+ Vt("pluno-pa-scribble-wobble-2", "5", "15")
2230
2255
  ), t.appendChild(
2231
- Ft("pluno-pa-scribble-wobble-3", "9", "19")
2256
+ Vt("pluno-pa-scribble-wobble-3", "9", "19")
2232
2257
  ), e.appendChild(t), e;
2233
2258
  }
2234
- function bo(e, t) {
2259
+ function Eo(e, t) {
2235
2260
  const n = E("svg", {
2236
2261
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2237
2262
  preserveAspectRatio: "xMidYMid meet",
2238
2263
  "aria-hidden": "true",
2239
2264
  focusable: "false"
2240
2265
  });
2241
- return _o(n, t), n;
2266
+ return ko(n, t), n;
2242
2267
  }
2243
- function Bt(e, t) {
2268
+ function jt(e, t) {
2244
2269
  if (!e)
2245
2270
  return;
2246
2271
  const n = Math.max(
2247
2272
  0,
2248
- t - Kt * 2
2273
+ t - tn * 2
2249
2274
  ), o = Math.max(
2250
- Xi,
2275
+ Qi,
2251
2276
  Math.floor(
2252
- (n - Vt * 2) / jt
2277
+ (n - en * 2) / Qt
2253
2278
  )
2254
2279
  );
2255
- _o(e, o);
2280
+ ko(e, o);
2256
2281
  }
2257
- function _o(e, t) {
2282
+ function ko(e, t) {
2258
2283
  if (e.dataset.spiralCount === `${t}`)
2259
2284
  return;
2260
- const n = t * jt + Vt * 2;
2285
+ const n = t * Qt + en * 2;
2261
2286
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2262
2287
  "viewBox",
2263
- `0 0 ${n} ${Yi}`
2288
+ `0 0 ${n} ${Ji}`
2264
2289
  ), e.replaceChildren();
2265
2290
  for (let o = 0; o < t; o += 1) {
2266
- const i = Nn[o % Nn.length], a = E("g", {
2267
- transform: `translate(${Vt + o * jt} 0)`
2291
+ const i = Bn[o % Bn.length], r = E("g", {
2292
+ transform: `translate(${en + o * Qt} 0)`
2268
2293
  });
2269
- a.appendChild(
2294
+ r.appendChild(
2270
2295
  E("ellipse", {
2271
2296
  cx: i.ellipseCx,
2272
2297
  cy: i.ellipseCy,
@@ -2277,7 +2302,7 @@ function _o(e, t) {
2277
2302
  "stroke-width": i.strokeWidth,
2278
2303
  opacity: "0.8"
2279
2304
  })
2280
- ), a.appendChild(
2305
+ ), r.appendChild(
2281
2306
  E("path", {
2282
2307
  d: i.path,
2283
2308
  fill: "none",
@@ -2285,10 +2310,10 @@ function _o(e, t) {
2285
2310
  "stroke-width": i.pathStrokeWidth,
2286
2311
  "stroke-linecap": "round"
2287
2312
  })
2288
- ), e.appendChild(a);
2313
+ ), e.appendChild(r);
2289
2314
  }
2290
2315
  }
2291
- function Ft(e, t, n) {
2316
+ function Vt(e, t, n) {
2292
2317
  const o = E("filter", {
2293
2318
  id: e,
2294
2319
  x: "-8%",
@@ -2331,8 +2356,8 @@ function Ft(e, t, n) {
2331
2356
  })
2332
2357
  ), o;
2333
2358
  }
2334
- function Ra(e) {
2335
- const t = ae(
2359
+ function Oa(e) {
2360
+ const t = pe(
2336
2361
  "0 0 24 24",
2337
2362
  e,
2338
2363
  e,
@@ -2342,8 +2367,8 @@ function Ra(e) {
2342
2367
  );
2343
2368
  return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2344
2369
  }
2345
- function Ma() {
2346
- const e = ae(
2370
+ function Ua() {
2371
+ const e = pe(
2347
2372
  "0 0 24 24",
2348
2373
  17,
2349
2374
  17,
@@ -2361,8 +2386,8 @@ function Ma() {
2361
2386
  })
2362
2387
  ), e;
2363
2388
  }
2364
- function za() {
2365
- const e = ae(
2389
+ function Ba() {
2390
+ const e = pe(
2366
2391
  "0 0 24 24",
2367
2392
  17,
2368
2393
  17,
@@ -2372,8 +2397,8 @@ function za() {
2372
2397
  );
2373
2398
  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;
2374
2399
  }
2375
- function Oa() {
2376
- const e = ae(
2400
+ function Fa() {
2401
+ const e = pe(
2377
2402
  "0 0 24 24",
2378
2403
  15,
2379
2404
  15,
@@ -2383,8 +2408,8 @@ function Oa() {
2383
2408
  );
2384
2409
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2385
2410
  }
2386
- function xo() {
2387
- const e = ae(
2411
+ function Lo() {
2412
+ const e = pe(
2388
2413
  "0 0 24 24",
2389
2414
  14,
2390
2415
  14,
@@ -2396,8 +2421,8 @@ function xo() {
2396
2421
  E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2397
2422
  ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2398
2423
  }
2399
- function Ua() {
2400
- const e = ae(
2424
+ function Ha() {
2425
+ const e = pe(
2401
2426
  "0 0 24 24",
2402
2427
  16,
2403
2428
  16,
@@ -2414,8 +2439,8 @@ function Ua() {
2414
2439
  })
2415
2440
  ), e;
2416
2441
  }
2417
- function Ba() {
2418
- const e = ae("0 0 24 24", 19, 19, "none", "currentColor");
2442
+ function Wa() {
2443
+ const e = pe("0 0 24 24", 19, 19, "none", "currentColor");
2419
2444
  return e.setAttribute(
2420
2445
  "class",
2421
2446
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
@@ -2429,8 +2454,8 @@ function Ba() {
2429
2454
  })
2430
2455
  ), e;
2431
2456
  }
2432
- function Fa() {
2433
- const e = ae("0 0 24 24", 18, 18, "currentColor");
2457
+ function Ga() {
2458
+ const e = pe("0 0 24 24", 18, 18, "currentColor");
2434
2459
  return e.appendChild(
2435
2460
  E("rect", {
2436
2461
  x: "6",
@@ -2441,8 +2466,8 @@ function Fa() {
2441
2466
  })
2442
2467
  ), e;
2443
2468
  }
2444
- function Ha() {
2445
- const e = ae(
2469
+ function $a() {
2470
+ const e = pe(
2446
2471
  "0 0 24 24",
2447
2472
  12,
2448
2473
  12,
@@ -2452,8 +2477,8 @@ function Ha() {
2452
2477
  );
2453
2478
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2454
2479
  }
2455
- function Wa() {
2456
- const e = ae(
2480
+ function qa() {
2481
+ const e = pe(
2457
2482
  "0 0 24 24",
2458
2483
  13,
2459
2484
  13,
@@ -2476,7 +2501,7 @@ function Wa() {
2476
2501
  })
2477
2502
  ), e;
2478
2503
  }
2479
- function ae(e, t, n, o, i, a) {
2504
+ function pe(e, t, n, o, i, r) {
2480
2505
  const l = {
2481
2506
  viewBox: e,
2482
2507
  width: String(t),
@@ -2484,165 +2509,165 @@ function ae(e, t, n, o, i, a) {
2484
2509
  fill: o,
2485
2510
  "aria-hidden": "true"
2486
2511
  };
2487
- return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), E("svg", l);
2512
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2488
2513
  }
2489
2514
  function E(e, t = {}) {
2490
- const n = document.createElementNS(po, e);
2515
+ const n = document.createElementNS(fo, e);
2491
2516
  for (const [o, i] of Object.entries(t))
2492
2517
  n.setAttribute(o, i);
2493
2518
  return n;
2494
2519
  }
2495
- function Wn(e) {
2520
+ function Yn(e) {
2496
2521
  for (const t of ["keydown", "keypress", "keyup"])
2497
2522
  e.addEventListener(t, (n) => {
2498
2523
  n.stopPropagation();
2499
2524
  });
2500
2525
  }
2501
- function Ga(e, t, n) {
2526
+ function ja(e, t, n) {
2502
2527
  e.replaceChildren(), e.hidden = t.length === 0;
2503
2528
  for (const [o, i] of t.entries()) {
2504
- const a = document.createElement("div");
2505
- a.className = "pluno-pa-widget__attachment", a.appendChild($a(i));
2529
+ const r = document.createElement("div");
2530
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Va(i));
2506
2531
  const l = document.createElement("span");
2507
- l.textContent = i.name, a.appendChild(l);
2532
+ l.textContent = i.name, r.appendChild(l);
2508
2533
  const p = document.createElement("button");
2509
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ha()), p.addEventListener("click", () => n(o)), a.appendChild(p), e.appendChild(a);
2534
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild($a()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2510
2535
  }
2511
2536
  }
2512
- function $a(e) {
2513
- const t = on(e), n = yo(e);
2537
+ function Va(e) {
2538
+ const t = cn(e), n = Po(e);
2514
2539
  if (t === "image" && n) {
2515
2540
  const o = document.createElement("img");
2516
- return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(oe(e))), o;
2541
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(re(e))), o;
2517
2542
  }
2518
2543
  if (t === "video" && n) {
2519
2544
  const o = document.createElement("video");
2520
- return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(oe(e))), o.addEventListener("stalled", () => o.replaceWith(oe(e))), o;
2545
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(re(e))), o.addEventListener("stalled", () => o.replaceWith(re(e))), o;
2521
2546
  }
2522
- return oe(e);
2547
+ return re(e);
2523
2548
  }
2524
- function qa(e) {
2525
- const t = on(e), n = yo(e);
2549
+ function Ka(e) {
2550
+ const t = cn(e), n = Po(e);
2526
2551
  if (t === "image" && n) {
2527
2552
  const o = document.createElement("img");
2528
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(oe(e, "message"))), o;
2553
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(re(e, "message"))), o;
2529
2554
  }
2530
2555
  if (t === "pdf" && n) {
2531
2556
  const o = document.createElement("object");
2532
- 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(oe(e, "message"))), o.appendChild(oe(e, "message")), o;
2557
+ 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(re(e, "message"))), o.appendChild(re(e, "message")), o;
2533
2558
  }
2534
2559
  if (t === "video" && n) {
2535
2560
  const o = document.createElement("video");
2536
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(oe(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(oe(e, "message"))), o;
2561
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(re(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(re(e, "message"))), o;
2537
2562
  }
2538
- return oe(e, "message");
2563
+ return re(e, "message");
2539
2564
  }
2540
- function oe(e, t = "composer") {
2565
+ function re(e, t = "composer") {
2541
2566
  if (t === "composer") {
2542
- const a = document.createElement("span");
2543
- return a.className = "pluno-pa-widget__attachment-file", a.textContent = Gn(e), a;
2567
+ const r = document.createElement("span");
2568
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = Xn(e), r;
2544
2569
  }
2545
2570
  const n = document.createElement("div");
2546
2571
  n.className = "pluno-pa-widget__message-attachment-file";
2547
2572
  const o = document.createElement("span");
2548
- o.textContent = Gn(e);
2573
+ o.textContent = Xn(e);
2549
2574
  const i = document.createElement("strong");
2550
2575
  return i.textContent = e.name, n.append(o, i), n;
2551
2576
  }
2552
- function on(e) {
2577
+ function cn(e) {
2553
2578
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2554
2579
  }
2555
- function yo(e) {
2580
+ function Po(e) {
2556
2581
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2557
2582
  }
2558
- function Gn(e) {
2559
- const t = on(e);
2583
+ function Xn(e) {
2584
+ const t = cn(e);
2560
2585
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2561
2586
  }
2562
- function ja(e, t) {
2587
+ function Ya(e, t) {
2563
2588
  return t ? Array.from(t).map((o) => ({
2564
2589
  ...e.createLocalAttachment(o),
2565
- previewUrl: Va(o)
2590
+ previewUrl: Xa(o)
2566
2591
  })) : [];
2567
2592
  }
2568
- function Va(e) {
2593
+ function Xa(e) {
2569
2594
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2570
2595
  }
2571
- function rt(e) {
2596
+ function ct(e) {
2572
2597
  return !!(e && Array.from(e.types).includes("Files"));
2573
2598
  }
2574
- function Ht(e, t, n = null) {
2575
- if (!e || !Jt(t, n)) {
2599
+ function Kt(e, t, n = null) {
2600
+ if (!e || !rn(t, n)) {
2576
2601
  e && (e.hidden = !0, e.replaceChildren());
2577
2602
  return;
2578
2603
  }
2579
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ie(t) || an(n) ? e.appendChild(
2580
- Ka(t, n)
2581
- ) : vo(t) && e.appendChild(Ya(t));
2604
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", le(t) || un(n) ? e.appendChild(
2605
+ Za(t, n)
2606
+ ) : To(t) && e.appendChild(Ja(t));
2582
2607
  }
2583
- function Ka(e, t) {
2608
+ function Za(e, t) {
2584
2609
  const n = document.createElement("div");
2585
2610
  n.className = "pluno-pa-widget__billing-action-card";
2586
2611
  const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2587
2612
  i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2588
- const a = document.createElement("span");
2589
- return a.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(a), n.appendChild(
2590
- Co(
2613
+ const r = document.createElement("span");
2614
+ 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(
2615
+ Io(
2591
2616
  e,
2592
2617
  "Upgrade plan",
2593
2618
  "pluno-pa-widget__billing-action-card-actions"
2594
2619
  )
2595
2620
  ), n;
2596
2621
  }
2597
- function Ya(e) {
2622
+ function Ja(e) {
2598
2623
  const t = document.createElement("div");
2599
2624
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2600
2625
  const n = document.createElement("strong");
2601
2626
  n.textContent = "Credits running low", t.appendChild(n);
2602
2627
  const o = document.createElement("span");
2603
- return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2604
- Co(
2628
+ return o.textContent = er(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2629
+ Io(
2605
2630
  e,
2606
2631
  "Upgrade",
2607
2632
  "pluno-pa-widget__billing-action-card-actions"
2608
2633
  )
2609
2634
  ), t;
2610
2635
  }
2611
- function Jt(e, t) {
2612
- return e !== null && (ie(e) || vo(e) || an(t));
2636
+ function rn(e, t) {
2637
+ return e !== null && (le(e) || To(e) || un(t));
2613
2638
  }
2614
- function $n(e, t, n) {
2615
- return Jt(t, n) || Xa(t) ? !0 : !Jt(e, n);
2639
+ function Zn(e, t, n) {
2640
+ return rn(t, n) || Qa(t) ? !0 : !rn(e, n);
2616
2641
  }
2617
- function Xa(e) {
2618
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ie(e));
2642
+ function Qa(e) {
2643
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || le(e));
2619
2644
  }
2620
- function ie(e) {
2645
+ function le(e) {
2621
2646
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2622
2647
  }
2623
- function an(e) {
2648
+ function un(e) {
2624
2649
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2625
2650
  }
2626
- function vo(e) {
2627
- return !ie(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2651
+ function To(e) {
2652
+ return !le(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2628
2653
  }
2629
- function Za(e) {
2630
- return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
2654
+ function er(e) {
2655
+ return e.creditsRemaining === null ? null : `${tr(e.creditsRemaining)} credits left`;
2631
2656
  }
2632
- function Ja(e) {
2657
+ function tr(e) {
2633
2658
  return new Intl.NumberFormat("en-US", {
2634
2659
  maximumFractionDigits: 0
2635
2660
  }).format(Math.ceil(e));
2636
2661
  }
2637
- function Co(e, t, n) {
2662
+ function Io(e, t, n) {
2638
2663
  const o = document.createElement("div");
2639
2664
  return o.className = n, o.appendChild(
2640
- qn(t, e.pricingUrl)
2665
+ Jn(t, e.pricingUrl)
2641
2666
  ), o.appendChild(
2642
- qn("Earn credits", e.earnCreditsUrl)
2667
+ Jn("Earn credits", e.earnCreditsUrl)
2643
2668
  ), o;
2644
2669
  }
2645
- function qn(e, t) {
2670
+ function Jn(e, t) {
2646
2671
  const n = document.createElement("button");
2647
2672
  if (n.type = "button", e === "Earn credits") {
2648
2673
  const o = document.createElement("span");
@@ -2653,129 +2678,140 @@ function qn(e, t) {
2653
2678
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2654
2679
  }), n;
2655
2680
  }
2656
- function Wt(e, t) {
2681
+ function Yt(e, t) {
2657
2682
  return e.messages.filter(
2658
- (o) => !So(o)
2683
+ (o) => !Ao(o)
2659
2684
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2660
2685
  }
2661
- function Qa(e, t, n, o, i, a, l, p, d, c, u, m, k, v, D, S, g) {
2662
- const x = or(a), h = x.filter(
2663
- (w) => !So(w)
2664
- ), A = e.scrollTop, I = [], R = /* @__PURE__ */ new Set(), P = (w) => {
2665
- I.push(w);
2686
+ function nr(e, t, n, o, i, r, l, p, s, c, u, m, k, v, D, C, g, y, h, S) {
2687
+ const A = rr(r), N = A.filter(
2688
+ (x) => !Ao(x)
2689
+ ), q = e.scrollTop, xe = [], We = /* @__PURE__ */ new Set(), z = (x) => {
2690
+ xe.push(x);
2666
2691
  };
2667
- ko(n, a.isThinking), i.hidden = !p, p && l !== null && fo(i, l);
2668
- const Oe = h.length > 0 || !!a.assistantDraft || a.isThinking;
2669
- if (o(Oe), h.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
2670
- const w = document.createElement("div");
2671
- w.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2672
- const z = document.createElement("div");
2673
- z.className = "pluno-pa-widget__empty-hero";
2674
- const H = be(
2692
+ Ro(n, r.isThinking), i.hidden = !p, p && l !== null && Co(i, l);
2693
+ const Ge = N.length > 0 || !!r.assistantDraft || r.isThinking;
2694
+ if (o(Ge), g || N.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2695
+ const x = document.createElement("div");
2696
+ x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (g ? " pluno-pa-widget__empty-state--morning-report" : "");
2697
+ const M = document.createElement("div");
2698
+ M.className = "pluno-pa-widget__empty-hero";
2699
+ const T = _e(
2675
2700
  "pluno-pa-widget__character--empty",
2676
2701
  v()
2677
2702
  );
2678
- z.appendChild(H), w.appendChild(z), w.appendChild(mo());
2679
- const q = document.createElement("div");
2680
- if (q.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
2681
- for (const N of a.starterPrompts) {
2682
- const C = document.createElement("button");
2683
- C.type = "button", C.className = "pluno-pa-widget__starter-prompt", C.textContent = `"${N}"`, C.addEventListener("click", () => {
2684
- D(N);
2685
- }), q.appendChild(C);
2703
+ if (M.appendChild(T), x.appendChild(M), g) {
2704
+ const L = document.createElement("h2");
2705
+ L.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", L.textContent = g.opening, x.appendChild(L);
2706
+ } else
2707
+ x.appendChild(vo());
2708
+ const oe = g?.prompts ?? r.starterPrompts, W = document.createElement("div");
2709
+ if (W.className = oe.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", oe.length === 0 && !r.starterPromptsLoading && W.setAttribute("aria-hidden", "true"), oe.length > 0)
2710
+ for (const L of oe) {
2711
+ const R = document.createElement("button");
2712
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt", R.textContent = `"${L}"`, R.addEventListener("click", () => {
2713
+ D(L);
2714
+ }), W.appendChild(R);
2686
2715
  }
2687
- else if (a.starterPromptsLoading) {
2688
- const N = document.createElement("button");
2689
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", N.disabled = !0, N.tabIndex = -1, N.textContent = "Generating example tasks...", q.appendChild(N);
2716
+ else if (r.starterPromptsLoading) {
2717
+ const L = document.createElement("button");
2718
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", L.disabled = !0, L.tabIndex = -1, L.textContent = "Generating example tasks...", W.appendChild(L);
2690
2719
  } else
2691
- for (let N = 0; N < Mi; N += 1) {
2692
- const C = document.createElement("button");
2693
- C.type = "button", C.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", C.disabled = !0, C.tabIndex = -1, C.textContent = "", q.appendChild(C);
2720
+ for (let L = 0; L < Ui; L += 1) {
2721
+ const R = document.createElement("button");
2722
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", R.disabled = !0, R.tabIndex = -1, R.textContent = "", W.appendChild(R);
2694
2723
  }
2695
- w.appendChild(q), m.clear(), P(w), P(t), jn(e, I);
2724
+ if (x.appendChild(W), g) {
2725
+ const L = document.createElement("button");
2726
+ L.type = "button", L.className = "pluno-pa-widget__morning-report-snooze", L.textContent = "Snooze morning report", L.addEventListener("click", y), x.appendChild(L);
2727
+ }
2728
+ m.clear(), z(x), z(t), Qn(e, xe);
2696
2729
  return;
2697
2730
  }
2698
- let $ = null, U = null, ce = [];
2699
- const y = h.some(Qt), ee = () => {
2700
- if (ce.length === 0)
2731
+ let w = null, U = null, ye = [];
2732
+ const ve = N.some(ln), Ae = () => {
2733
+ if (ye.length === 0)
2701
2734
  return !1;
2702
- const w = gr(
2703
- ce,
2735
+ const x = fr(
2736
+ ye,
2704
2737
  u,
2705
2738
  k,
2706
2739
  v()
2707
2740
  );
2708
- return P(w), $ = null, U = w, ce = [], !0;
2741
+ return z(x), w = null, U = x, ye = [], !0;
2709
2742
  };
2710
- for (let w = 0; w < h.length; w += 1) {
2711
- const z = h[w];
2712
- if (z.role === "tool") {
2713
- ce.push(z);
2743
+ for (let x = 0; x < N.length; x += 1) {
2744
+ const M = N[x];
2745
+ if (M.role === "tool") {
2746
+ ye.push(M);
2714
2747
  continue;
2715
2748
  }
2716
- if (Qt(z)) {
2717
- if (ee()) {
2718
- const re = gt();
2719
- P(re), $ = null, U = re;
2749
+ if (ln(M)) {
2750
+ if (Ae()) {
2751
+ const R = bt();
2752
+ z(R), w = null, U = R;
2720
2753
  } else {
2721
- const re = Yn(v());
2722
- P(re), $ = null, U = re;
2754
+ const R = no(v());
2755
+ z(R), w = null, U = R;
2723
2756
  }
2724
2757
  continue;
2725
2758
  }
2726
- if (z.role === "system")
2759
+ if (M.role === "system")
2727
2760
  continue;
2728
- const H = ee(), q = ur(z.content);
2729
- if (z.role === "assistant" && !H) {
2730
- const C = Eo(v());
2731
- P(C), $ = null, U = C;
2761
+ const T = Ae(), oe = mr(M.content);
2762
+ if (M.role === "assistant" && !T) {
2763
+ const L = No(v());
2764
+ z(L), w = null, U = L;
2732
2765
  }
2733
- const N = er(z, q, m, R);
2734
- P(N), $ = N, U = null;
2766
+ const W = or(M, oe, m, We);
2767
+ z(W), w = W, U = null;
2735
2768
  }
2736
- const Ze = ee(), _e = h[h.length - 1]?.id === "assistant-draft";
2737
- if (a.isThinking && !_e && !y)
2738
- if (Ze) {
2739
- const w = gt();
2740
- P(w), $ = null, U = w;
2769
+ const V = Ae(), it = N[N.length - 1]?.id === "assistant-draft";
2770
+ if (r.isThinking && !it && !ve)
2771
+ if (V) {
2772
+ const x = bt();
2773
+ z(x), w = null, U = x;
2741
2774
  } else {
2742
- const w = Yn(v());
2743
- P(w), $ = null, U = w;
2744
- }
2745
- if (a.lastError) {
2746
- const w = document.createElement("div");
2747
- w.className = "pluno-pa-widget__error";
2748
- const z = document.createElement("span");
2749
- if (z.textContent = a.lastError, w.appendChild(z), a.lastErrorCode === "run_recovery_exhausted" || a.lastErrorCode === "transient_model_error" || a.lastErrorCode === "run_still_active") {
2750
- const H = document.createElement("button");
2751
- H.type = "button", H.className = "pluno-pa-widget__error-retry", H.textContent = "Try again", H.addEventListener("click", S), w.appendChild(H);
2752
- }
2753
- P(w), $ = w, U = null;
2775
+ const x = no(v());
2776
+ z(x), w = null, U = x;
2777
+ }
2778
+ if (r.lastError) {
2779
+ const x = document.createElement("div");
2780
+ x.className = "pluno-pa-widget__error";
2781
+ const M = document.createElement("span");
2782
+ if (M.textContent = r.lastError, x.appendChild(M), r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
2783
+ const T = document.createElement("button");
2784
+ T.type = "button", T.className = "pluno-pa-widget__error-retry", T.textContent = "Try again", T.addEventListener(
2785
+ "click",
2786
+ r.lastErrorCode === "connection_failed" ? h : C
2787
+ ), x.appendChild(T);
2788
+ }
2789
+ z(x), w = x, U = null;
2754
2790
  }
2755
- const ue = g && !a.isThinking ? ri(x) : null;
2756
- if (g && ue && !g.dismissedCandidateIds.has(ue.id)) {
2757
- const w = rr(ue, {
2758
- isDrafting: g.draftingCandidateId === ue.id,
2759
- error: g.error,
2760
- characterIconOptions: g.characterIconOptions,
2761
- onDraft: g.onDraft,
2762
- onDismiss: g.onDismiss,
2763
- onDisable: g.onDisable
2791
+ const ne = S && !r.isThinking ? si(A) : null;
2792
+ if (S && ne && !S.dismissedCandidateIds.has(ne.id)) {
2793
+ const x = sr(ne, {
2794
+ isDrafting: S.draftingCandidateId === ne.id,
2795
+ error: S.error,
2796
+ characterIconOptions: S.characterIconOptions,
2797
+ onDraft: S.onDraft,
2798
+ onDismiss: S.onDismiss,
2799
+ onDisable: S.onDisable
2764
2800
  });
2765
- P(w), g.onSeen(ue), $ = null, U = w;
2801
+ z(x), S.onSeen(ne), w = null, U = x;
2766
2802
  }
2767
- $?.classList.add("pluno-pa-widget__message--bottom-reserve"), U?.classList.add("pluno-pa-widget__bottom-reserve-compact"), P(t), nr(m, R), jn(e, I), d ? Ye(e, c) : e.scrollTop = A;
2803
+ w?.classList.add("pluno-pa-widget__message--bottom-reserve"), U?.classList.add("pluno-pa-widget__bottom-reserve-compact"), z(t), ar(m, We), Qn(e, xe), s ? nt(e, c) : e.scrollTop = q;
2768
2804
  }
2769
- function er(e, t, n, o) {
2770
- const i = tr(e, t), a = i ? n.get(i) : void 0;
2771
- if (i && a)
2772
- return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), a;
2805
+ function or(e, t, n, o) {
2806
+ const i = ir(e, t), r = i ? n.get(i) : void 0;
2807
+ if (i && r)
2808
+ return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
2773
2809
  const l = document.createElement("div");
2774
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? mr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ir(e.attachments));
2810
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? br(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(lr(e.attachments));
2775
2811
  const p = document.createElement("div");
2776
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(ar(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2812
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(pr(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2777
2813
  }
2778
- function tr(e, t) {
2814
+ function ir(e, t) {
2779
2815
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2780
2816
  id: e.id,
2781
2817
  content: t,
@@ -2793,11 +2829,11 @@ function tr(e, t) {
2793
2829
  })
2794
2830
  });
2795
2831
  }
2796
- function nr(e, t) {
2832
+ function ar(e, t) {
2797
2833
  for (const n of e.keys())
2798
2834
  t.has(n) || e.delete(n);
2799
2835
  }
2800
- function jn(e, t) {
2836
+ function Qn(e, t) {
2801
2837
  let n = e.firstChild;
2802
2838
  for (const o of t) {
2803
2839
  if (o === n) {
@@ -2811,7 +2847,7 @@ function jn(e, t) {
2811
2847
  n = n.nextSibling, e.removeChild(o);
2812
2848
  }
2813
2849
  }
2814
- function or(e) {
2850
+ function rr(e) {
2815
2851
  if (!e.assistantDraft)
2816
2852
  return [...e.messages];
2817
2853
  const t = {
@@ -2826,12 +2862,12 @@ function or(e) {
2826
2862
  if (!t.respondsToUserMessageId)
2827
2863
  return [...e.messages, t];
2828
2864
  const n = e.messages.findIndex(
2829
- (a) => a.role === "user" && a.id === t.respondsToUserMessageId
2865
+ (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2830
2866
  );
2831
2867
  if (n === -1)
2832
2868
  return [...e.messages, t];
2833
2869
  const o = e.messages.findIndex(
2834
- (a, l) => l > n && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && Vn(a, t) && Qt(a)
2870
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && eo(r, t) && ln(r)
2835
2871
  );
2836
2872
  if (o !== -1)
2837
2873
  return [
@@ -2840,7 +2876,7 @@ function or(e) {
2840
2876
  ...e.messages.slice(o + 1)
2841
2877
  ];
2842
2878
  let i = n + 1;
2843
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Vn(e.messages[i], t); )
2879
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && eo(e.messages[i], t); )
2844
2880
  i += 1;
2845
2881
  return [
2846
2882
  ...e.messages.slice(0, i),
@@ -2848,58 +2884,58 @@ function or(e) {
2848
2884
  ...e.messages.slice(i)
2849
2885
  ];
2850
2886
  }
2851
- function Qt(e) {
2887
+ function ln(e) {
2852
2888
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2853
2889
  }
2854
- function Vn(e, t) {
2890
+ function eo(e, t) {
2855
2891
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2856
2892
  }
2857
- function Kn(e, t, n, o, i, a, l, p) {
2858
- e.replaceChildren(), ko(t, !1), t.disabled = !0, n(!1);
2859
- const d = document.createElement("div");
2860
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2861
- const c = be(
2893
+ function to(e, t, n, o, i, r, l, p) {
2894
+ e.replaceChildren(), Ro(t, !1), t.disabled = !0, n(!1);
2895
+ const s = document.createElement("div");
2896
+ s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2897
+ const c = _e(
2862
2898
  "pluno-pa-widget__character--empty",
2863
2899
  o()
2864
2900
  );
2865
- d.appendChild(c);
2901
+ s.appendChild(c);
2866
2902
  const u = document.createElement("div");
2867
- if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2903
+ if (u.className = "pluno-pa-widget__empty", u.textContent = i, s.appendChild(u), l) {
2868
2904
  const m = document.createElement("a");
2869
- m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = a, d.appendChild(m);
2905
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, s.appendChild(m);
2870
2906
  } else {
2871
2907
  const m = document.createElement("button");
2872
- m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = a, m.addEventListener("click", () => p?.()), d.appendChild(m);
2908
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), s.appendChild(m);
2873
2909
  }
2874
- e.appendChild(d);
2910
+ e.appendChild(s);
2875
2911
  }
2876
- function ir(e) {
2912
+ function lr(e) {
2877
2913
  const t = document.createElement("div");
2878
2914
  t.className = "pluno-pa-widget__message-attachments";
2879
2915
  for (const n of e)
2880
- t.appendChild(qa(n));
2916
+ t.appendChild(Ka(n));
2881
2917
  return t;
2882
2918
  }
2883
- function ar(e) {
2919
+ function pr(e) {
2884
2920
  const t = document.createElement("button");
2885
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Wa()), t.addEventListener("click", (n) => {
2921
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(qa()), t.addEventListener("click", (n) => {
2886
2922
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2887
2923
  }), t;
2888
2924
  }
2889
- function rr(e, t) {
2925
+ function sr(e, t) {
2890
2926
  const n = document.createElement("article");
2891
2927
  n.className = "pluno-pa-widget__share-prompt";
2892
2928
  const o = document.createElement("div");
2893
2929
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2894
- be(
2930
+ _e(
2895
2931
  "pluno-pa-widget__share-prompt-icon",
2896
2932
  t.characterIconOptions
2897
2933
  )
2898
2934
  );
2899
2935
  const i = document.createElement("div");
2900
2936
  i.className = "pluno-pa-widget__share-prompt-copy";
2901
- const a = document.createElement("strong");
2902
- a.textContent = "Share this win?", i.appendChild(a);
2937
+ const r = document.createElement("strong");
2938
+ r.textContent = "Share this win?", i.appendChild(r);
2903
2939
  const l = document.createElement("span");
2904
2940
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2905
2941
  const u = document.createElement("span");
@@ -2908,18 +2944,18 @@ function rr(e, t) {
2908
2944
  o.appendChild(i);
2909
2945
  const p = document.createElement("div");
2910
2946
  p.className = "pluno-pa-widget__share-prompt-actions";
2911
- const d = document.createElement("div");
2912
- d.className = "pluno-pa-widget__share-prompt-primary-actions";
2947
+ const s = document.createElement("div");
2948
+ s.className = "pluno-pa-widget__share-prompt-primary-actions";
2913
2949
  const c = document.createElement("button");
2914
2950
  if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2915
2951
  t.onDraft(e);
2916
- }), t.isDrafting ? (c.appendChild(en()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2917
- p.appendChild(d);
2952
+ }), t.isDrafting ? (c.appendChild(pn()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", s.appendChild(c), t.isDrafting)
2953
+ p.appendChild(s);
2918
2954
  else {
2919
2955
  const u = document.createElement("button");
2920
2956
  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", () => {
2921
2957
  t.onDismiss(e);
2922
- }), d.appendChild(u), p.appendChild(d);
2958
+ }), s.appendChild(u), p.appendChild(s);
2923
2959
  const m = document.createElement("button");
2924
2960
  m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
2925
2961
  t.onDisable(e);
@@ -2927,71 +2963,71 @@ function rr(e, t) {
2927
2963
  }
2928
2964
  return o.appendChild(p), n.appendChild(o), n;
2929
2965
  }
2930
- function lr(e, t) {
2966
+ function dr(e, t) {
2931
2967
  const n = document.createElement("div");
2932
2968
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2933
2969
  g.target === n && t.onClose();
2934
2970
  });
2935
2971
  const o = document.createElement("section");
2936
2972
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
2937
- const i = document.createElement("header"), a = document.createElement("strong");
2938
- a.textContent = "Share this win", i.appendChild(a);
2973
+ const i = document.createElement("header"), r = document.createElement("strong");
2974
+ r.textContent = "Share this win", i.appendChild(r);
2939
2975
  const l = document.createElement("button");
2940
2976
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2941
2977
  const p = document.createElement("p");
2942
2978
  p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
2943
- const d = document.createElement("div");
2944
- d.className = "pluno-pa-widget__share-dialog-step";
2979
+ const s = document.createElement("div");
2980
+ s.className = "pluno-pa-widget__share-dialog-step";
2945
2981
  const c = document.createElement("div");
2946
2982
  c.className = "pluno-pa-widget__share-dialog-step-header";
2947
2983
  const u = document.createElement("strong");
2948
2984
  u.textContent = "1) Copy Screenshot", c.appendChild(u);
2949
- const m = pr(
2985
+ const m = cr(
2950
2986
  "Copy Screenshot",
2951
2987
  async () => {
2952
2988
  try {
2953
- return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2989
+ return await di(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2954
2990
  } catch {
2955
2991
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2956
2992
  }
2957
2993
  }
2958
2994
  );
2959
- if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
2995
+ if (c.appendChild(m), s.appendChild(c), e.screenshotDataUrl) {
2960
2996
  const g = document.createElement("div");
2961
2997
  g.className = "pluno-pa-widget__share-dialog-screenshot";
2962
- const x = document.createElement("img");
2963
- x.src = e.screenshotDataUrl, x.alt = "Product page with Pluno open", g.appendChild(x), d.appendChild(g);
2998
+ const y = document.createElement("img");
2999
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", g.appendChild(y), s.appendChild(g);
2964
3000
  }
2965
- o.appendChild(d), o.appendChild(p);
3001
+ o.appendChild(s), o.appendChild(p);
2966
3002
  const k = document.createElement("div");
2967
3003
  k.className = "pluno-pa-widget__share-dialog-step";
2968
3004
  const v = document.createElement("strong");
2969
3005
  v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", k.appendChild(v);
2970
3006
  const D = document.createElement("p");
2971
3007
  D.className = "pluno-pa-widget__share-dialog-hint", D.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(D);
2972
- const S = document.createElement("footer");
2973
- S.className = "pluno-pa-widget__share-dialog-platforms";
2974
- for (const g of sr(e)) {
2975
- const x = document.createElement("a");
2976
- x.href = g.href, x.target = "_blank", x.rel = "noopener noreferrer", x.title = g.label, x.setAttribute("aria-label", `Open ${g.label}`), x.appendChild(dr(g.id)), S.appendChild(x);
3008
+ const C = document.createElement("footer");
3009
+ C.className = "pluno-pa-widget__share-dialog-platforms";
3010
+ for (const g of ur(e)) {
3011
+ const y = document.createElement("a");
3012
+ y.href = g.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = g.label, y.setAttribute("aria-label", `Open ${g.label}`), y.appendChild(gr(g.id)), C.appendChild(y);
2977
3013
  }
2978
- if (k.appendChild(S), o.appendChild(k), t.socialPostRewardsUrl) {
3014
+ if (k.appendChild(C), o.appendChild(k), t.socialPostRewardsUrl) {
2979
3015
  const g = document.createElement("div");
2980
3016
  g.className = "pluno-pa-widget__share-dialog-step";
2981
- const x = document.createElement("strong");
2982
- x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(x);
3017
+ const y = document.createElement("strong");
3018
+ y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(y);
2983
3019
  const h = document.createElement("a");
2984
- 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(cr()), g.appendChild(h), o.appendChild(g);
3020
+ 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(hr()), g.appendChild(h), o.appendChild(g);
2985
3021
  }
2986
3022
  return n.appendChild(o), n;
2987
3023
  }
2988
- function pr(e, t) {
3024
+ function cr(e, t) {
2989
3025
  const n = document.createElement("button");
2990
3026
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
2991
3027
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
2992
3028
  }), n;
2993
3029
  }
2994
- function sr(e) {
3030
+ function ur(e) {
2995
3031
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
2996
3032
  return [
2997
3033
  {
@@ -3011,90 +3047,90 @@ function sr(e) {
3011
3047
  }
3012
3048
  ];
3013
3049
  }
3014
- function dr(e) {
3050
+ function gr(e) {
3015
3051
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3016
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (F(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), F(
3052
+ return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? ($(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), $(
3017
3053
  t,
3018
3054
  "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"
3019
- ), F(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), F(
3055
+ ), $(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), $(
3020
3056
  t,
3021
3057
  "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"
3022
- ), F(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (F(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), F(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), F(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (F(
3058
+ ), $(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? ($(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), $(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), $(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : ($(
3023
3059
  t,
3024
3060
  "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"
3025
- ), F(
3061
+ ), $(
3026
3062
  t,
3027
3063
  "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1",
3028
3064
  "0.48"
3029
- ), F(
3065
+ ), $(
3030
3066
  t,
3031
3067
  "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"
3032
- ), F(
3068
+ ), $(
3033
3069
  t,
3034
3070
  "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"
3035
3071
  ), t);
3036
3072
  }
3037
- function F(e, t, n) {
3073
+ function $(e, t, n) {
3038
3074
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3039
3075
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
3040
3076
  }
3041
- function cr() {
3077
+ function hr() {
3042
3078
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3043
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), F(e, "M14 5h5v5"), F(e, "M19 5l-8 8"), F(
3079
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), $(e, "M14 5h5v5"), $(e, "M19 5l-8 8"), $(
3044
3080
  e,
3045
3081
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3046
3082
  ), e;
3047
3083
  }
3048
- function So(e) {
3049
- return e.role === "tool" && e.toolName === no;
3084
+ function Ao(e) {
3085
+ return e.role === "tool" && e.toolName === so;
3050
3086
  }
3051
- function ur(e) {
3087
+ function mr(e) {
3052
3088
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3053
3089
  }
3054
- function gr(e, t, n, o) {
3090
+ function fr(e, t, n, o) {
3055
3091
  const i = document.createElement("article");
3056
3092
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
3057
3093
  e[e.length - 1].createdAt
3058
3094
  ).toLocaleString(), i.appendChild(
3059
- be(
3095
+ _e(
3060
3096
  "pluno-pa-widget__character--tool-group",
3061
3097
  o
3062
3098
  )
3063
3099
  );
3064
- const a = document.createElement("details"), l = hr(e);
3065
- a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
3066
- i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), n();
3100
+ const r = document.createElement("details"), l = wr(e);
3101
+ r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3102
+ i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
3067
3103
  });
3068
3104
  const p = document.createElement("summary");
3069
- p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(en());
3105
+ p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(pn());
3070
3106
  const c = document.createElement("span");
3071
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), a.appendChild(p), e.length > 0) {
3107
+ 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) {
3072
3108
  const u = document.createElement("div");
3073
3109
  u.className = "pluno-pa-widget__tool-lines";
3074
3110
  for (const m of e) {
3075
3111
  const k = document.createElement("div");
3076
- k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(en());
3112
+ k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(pn());
3077
3113
  const v = document.createElement("span");
3078
3114
  v.textContent = m.content || "Run tool", k.appendChild(v), u.appendChild(k);
3079
3115
  }
3080
- a.appendChild(u);
3116
+ r.appendChild(u);
3081
3117
  }
3082
- return i.appendChild(a), i;
3118
+ return i.appendChild(r), i;
3083
3119
  }
3084
- function Eo(e) {
3120
+ function No(e) {
3085
3121
  const t = document.createElement("article");
3086
3122
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3087
- be(
3123
+ _e(
3088
3124
  "pluno-pa-widget__character--tool-group",
3089
3125
  e
3090
3126
  )
3091
3127
  ), t;
3092
3128
  }
3093
- function Yn(e) {
3094
- const t = Eo(e);
3095
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(gt()), t;
3129
+ function no(e) {
3130
+ const t = No(e);
3131
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(bt()), t;
3096
3132
  }
3097
- function gt(e = "Thinking...") {
3133
+ function bt(e = "Thinking...") {
3098
3134
  const t = document.createElement("div");
3099
3135
  t.className = "pluno-pa-widget__status";
3100
3136
  const n = document.createElement("span");
@@ -3102,17 +3138,17 @@ function gt(e = "Thinking...") {
3102
3138
  const o = document.createElement("span");
3103
3139
  return o.textContent = e, t.appendChild(o), t;
3104
3140
  }
3105
- function hr(e) {
3141
+ function wr(e) {
3106
3142
  return `tools:${e[0]?.id ?? ""}`;
3107
3143
  }
3108
- function en() {
3144
+ function pn() {
3109
3145
  const e = document.createElement("span");
3110
3146
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3111
3147
  }
3112
- function ko(e, t) {
3113
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Fa() : xo());
3148
+ function Ro(e, t) {
3149
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ga() : Lo());
3114
3150
  }
3115
- function mr(e, t) {
3151
+ function br(e, t) {
3116
3152
  const n = t.replace(/\r\n/g, `
3117
3153
  `).split(`
3118
3154
  `);
@@ -3136,14 +3172,14 @@ function mr(e, t) {
3136
3172
  const l = i.match(/^(#{1,3})\s+(.+)$/);
3137
3173
  if (l) {
3138
3174
  const c = document.createElement(`h${l[1].length + 2}`);
3139
- lt(c, l[2]), e.appendChild(c), o += 1;
3175
+ ut(c, l[2]), e.appendChild(c), o += 1;
3140
3176
  continue;
3141
3177
  }
3142
3178
  if (/^\s*[-*+]\s+/.test(i)) {
3143
3179
  const c = document.createElement("ul");
3144
3180
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3145
3181
  const u = document.createElement("li");
3146
- lt(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3182
+ ut(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3147
3183
  }
3148
3184
  e.appendChild(c);
3149
3185
  continue;
@@ -3152,7 +3188,7 @@ function mr(e, t) {
3152
3188
  const c = document.createElement("ol");
3153
3189
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3154
3190
  const u = document.createElement("li");
3155
- lt(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3191
+ ut(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3156
3192
  }
3157
3193
  e.appendChild(c);
3158
3194
  continue;
@@ -3160,19 +3196,19 @@ function mr(e, t) {
3160
3196
  const p = [i];
3161
3197
  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]); )
3162
3198
  p.push(n[o]), o += 1;
3163
- const d = document.createElement("p");
3199
+ const s = document.createElement("p");
3164
3200
  p.forEach((c, u) => {
3165
- u > 0 && d.appendChild(document.createElement("br")), lt(d, c);
3166
- }), e.appendChild(d);
3201
+ u > 0 && s.appendChild(document.createElement("br")), ut(s, c);
3202
+ }), e.appendChild(s);
3167
3203
  }
3168
3204
  }
3169
- function lt(e, t) {
3205
+ function ut(e, t) {
3170
3206
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3171
3207
  let o = 0;
3172
3208
  for (const i of t.matchAll(n)) {
3173
- const a = i.index ?? 0;
3174
- a > o && e.appendChild(
3175
- document.createTextNode(t.slice(o, a))
3209
+ const r = i.index ?? 0;
3210
+ r > o && e.appendChild(
3211
+ document.createTextNode(t.slice(o, r))
3176
3212
  );
3177
3213
  const l = i[0];
3178
3214
  if (l.startsWith("`")) {
@@ -3186,17 +3222,17 @@ function lt(e, t) {
3186
3222
  p.textContent = l.slice(1, -1), e.appendChild(p);
3187
3223
  } else {
3188
3224
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3189
- if (p && fr(p[2])) {
3190
- const d = document.createElement("a");
3191
- d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3225
+ if (p && _r(p[2])) {
3226
+ const s = document.createElement("a");
3227
+ s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
3192
3228
  } else
3193
3229
  e.appendChild(document.createTextNode(l));
3194
3230
  }
3195
- o = a + l.length;
3231
+ o = r + l.length;
3196
3232
  }
3197
3233
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
3198
3234
  }
3199
- function fr(e) {
3235
+ function _r(e) {
3200
3236
  if (e.startsWith("/") || e.startsWith("#"))
3201
3237
  return !0;
3202
3238
  try {
@@ -3206,8 +3242,8 @@ function fr(e) {
3206
3242
  return !1;
3207
3243
  }
3208
3244
  }
3209
- function Xn(e, t) {
3210
- if (wr(e))
3245
+ function oo(e, t) {
3246
+ if (xr(e))
3211
3247
  return;
3212
3248
  const n = `
3213
3249
  :host {
@@ -3260,7 +3296,7 @@ function Xn(e, t) {
3260
3296
  --pluno-pa-accent-contrast: #fafafa;
3261
3297
  position: fixed;
3262
3298
  z-index: 2147483645;
3263
- font-family: ${ne.fontFamily};
3299
+ font-family: ${ae.fontFamily};
3264
3300
  font-size: 14px;
3265
3301
  color: var(--pluno-pa-text);
3266
3302
  width: var(--pluno-pa-launcher-width);
@@ -4339,7 +4375,7 @@ function Xn(e, t) {
4339
4375
  place-items: center;
4340
4376
  padding: 18px;
4341
4377
  background: rgba(24, 24, 27, 0.28);
4342
- font-family: var(--pluno-pa-font, ${ne.fontFamily});
4378
+ font-family: var(--pluno-pa-font, ${ae.fontFamily});
4343
4379
  color: var(--pluno-pa-text);
4344
4380
  }
4345
4381
  .pluno-pa-widget__share-dialog {
@@ -4910,6 +4946,11 @@ function Xn(e, t) {
4910
4946
  padding: 36px 4px calc(var(--pluno-pa-starter-edge-gap) - 12px);
4911
4947
  text-align: left;
4912
4948
  }
4949
+ .pluno-pa-widget__empty-state--morning-report {
4950
+ --pluno-pa-starter-edge-gap: 18px;
4951
+ margin: auto 0;
4952
+ padding: 12px 4px;
4953
+ }
4913
4954
  .pluno-pa-widget__error-retry {
4914
4955
  display: block;
4915
4956
  margin-top: 6px;
@@ -4929,6 +4970,21 @@ function Xn(e, t) {
4929
4970
  line-height: 1.34;
4930
4971
  text-align: left;
4931
4972
  }
4973
+ .pluno-pa-widget__morning-report-snooze {
4974
+ justify-self: end;
4975
+ margin-top: calc(var(--pluno-pa-starter-edge-gap) * -0.55);
4976
+ padding: 4px 8px;
4977
+ border: 0;
4978
+ background: transparent;
4979
+ color: var(--pluno-pa-muted);
4980
+ font: inherit;
4981
+ font-size: 12px;
4982
+ text-decoration: underline;
4983
+ cursor: pointer;
4984
+ }
4985
+ .pluno-pa-widget__empty-state--morning-report .pluno-pa-widget__morning-report-snooze {
4986
+ margin-top: -6px;
4987
+ }
4932
4988
  .pluno-pa-widget__empty-hero {
4933
4989
  display: inline-flex;
4934
4990
  align-items: center;
@@ -4989,6 +5045,9 @@ function Xn(e, t) {
4989
5045
  gap: 18px;
4990
5046
  width: min(100%, 320px);
4991
5047
  }
5048
+ .pluno-pa-widget__empty-state--morning-report .pluno-pa-widget__starter-prompts {
5049
+ gap: 12px;
5050
+ }
4992
5051
  .pluno-pa-widget__starter-prompts--empty {
4993
5052
  pointer-events: none;
4994
5053
  }
@@ -5139,8 +5198,8 @@ function Xn(e, t) {
5139
5198
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5140
5199
  position: absolute;
5141
5200
  top: -16px;
5142
- left: ${Kt}px;
5143
- width: calc(100% - ${Kt * 2}px);
5201
+ left: ${tn}px;
5202
+ width: calc(100% - ${tn * 2}px);
5144
5203
  height: 36px;
5145
5204
  z-index: 3;
5146
5205
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5184,6 +5243,10 @@ function Xn(e, t) {
5184
5243
  .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
5185
5244
  margin-bottom: 0;
5186
5245
  }
5246
+ .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--morning-report .pluno-pa-widget__character--empty {
5247
+ width: 96px;
5248
+ height: 96px;
5249
+ }
5187
5250
  .pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
5188
5251
  width: 60px;
5189
5252
  height: 60px;
@@ -5488,28 +5551,28 @@ function Xn(e, t) {
5488
5551
  filter: url(#pluno-pa-scribble-wobble-2);
5489
5552
  }
5490
5553
  `;
5491
- if (br(e, n))
5554
+ if (yr(e, n))
5492
5555
  return;
5493
5556
  const o = e.ownerDocument.createElement("style");
5494
- o.id = uo, o.textContent = n, e.appendChild(o), Lo(e);
5557
+ o.id = _o, o.textContent = n, e.appendChild(o), Do(e);
5495
5558
  }
5496
- function wr(e) {
5497
- return e.getElementById(uo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(go) === "true";
5559
+ function xr(e) {
5560
+ return e.getElementById(_o) !== null || e.host instanceof HTMLElement && e.host.getAttribute(xo) === "true";
5498
5561
  }
5499
- function Lo(e) {
5500
- e.host instanceof HTMLElement && e.host.setAttribute(go, "true");
5562
+ function Do(e) {
5563
+ e.host instanceof HTMLElement && e.host.setAttribute(xo, "true");
5501
5564
  }
5502
- function br(e, t) {
5565
+ function yr(e, t) {
5503
5566
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5504
5567
  return !1;
5505
5568
  try {
5506
5569
  const n = new CSSStyleSheet();
5507
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Lo(e), !0;
5570
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Do(e), !0;
5508
5571
  } catch {
5509
5572
  return !1;
5510
5573
  }
5511
5574
  }
5512
- async function _r() {
5575
+ async function vr() {
5513
5576
  return document.body ? document.body : await new Promise((e) => {
5514
5577
  const t = new MutationObserver(() => {
5515
5578
  document.body && (t.disconnect(), e(document.body));
@@ -5517,18 +5580,18 @@ async function _r() {
5517
5580
  t.observe(document.documentElement, { childList: !0 });
5518
5581
  });
5519
5582
  }
5520
- function Po(e) {
5583
+ function Mo(e) {
5521
5584
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5522
5585
  }
5523
- function xr(e) {
5586
+ function Cr(e) {
5524
5587
  if (e)
5525
5588
  return { clientId: e, release: () => {
5526
5589
  } };
5527
5590
  let t = 0;
5528
- for (; Dt.has(t); )
5591
+ for (; Ft.has(t); )
5529
5592
  t += 1;
5530
- Dt.add(t);
5531
- const n = `${Di}${t}`;
5593
+ Ft.add(t);
5594
+ const n = `${zi}${t}`;
5532
5595
  let o = crypto.randomUUID();
5533
5596
  try {
5534
5597
  o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
@@ -5538,15 +5601,15 @@ function xr(e) {
5538
5601
  return {
5539
5602
  clientId: o,
5540
5603
  release: () => {
5541
- i || (i = !0, Dt.delete(t));
5604
+ i || (i = !0, Ft.delete(t));
5542
5605
  }
5543
5606
  };
5544
5607
  }
5545
- function yr(e) {
5608
+ function Sr(e) {
5546
5609
  try {
5547
- const t = window.localStorage.getItem(Po(e));
5610
+ const t = window.localStorage.getItem(Mo(e));
5548
5611
  if (!t)
5549
- return Zn();
5612
+ return io();
5550
5613
  const n = JSON.parse(t);
5551
5614
  return {
5552
5615
  isOpen: n.isOpen === !0,
@@ -5556,25 +5619,25 @@ function yr(e) {
5556
5619
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5557
5620
  (o) => typeof o == "string"
5558
5621
  ) : [],
5559
- launcherPosition: Er(n.launcherPosition) ? n.launcherPosition : null,
5560
- panelSize: kr(n.panelSize) ? ht(n.panelSize) : null,
5561
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-oo) : [],
5622
+ launcherPosition: Pr(n.launcherPosition) ? n.launcherPosition : null,
5623
+ panelSize: Tr(n.panelSize) ? _t(n.panelSize) : null,
5624
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-co) : [],
5562
5625
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5563
5626
  };
5564
5627
  } catch {
5565
- return Zn();
5628
+ return io();
5566
5629
  }
5567
5630
  }
5568
- async function vr(e) {
5631
+ async function Er(e) {
5569
5632
  if (e.loadSharePromptsDisabled)
5570
5633
  return e.loadSharePromptsDisabled();
5571
5634
  try {
5572
- return window.localStorage.getItem(ao) === "true";
5635
+ return window.localStorage.getItem(go) === "true";
5573
5636
  } catch {
5574
5637
  return !1;
5575
5638
  }
5576
5639
  }
5577
- function Cr(e, t) {
5640
+ function kr(e, t) {
5578
5641
  if (e.persistSharePromptsDisabled) {
5579
5642
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5580
5643
  () => {
@@ -5583,12 +5646,12 @@ function Cr(e, t) {
5583
5646
  return;
5584
5647
  }
5585
5648
  try {
5586
- t && window.localStorage.setItem(ao, "true");
5649
+ t && window.localStorage.setItem(go, "true");
5587
5650
  } catch {
5588
5651
  return;
5589
5652
  }
5590
5653
  }
5591
- function Zn() {
5654
+ function io() {
5592
5655
  return {
5593
5656
  isOpen: !1,
5594
5657
  composerValue: "",
@@ -5601,29 +5664,29 @@ function Zn() {
5601
5664
  sharePromptsDisabled: !1
5602
5665
  };
5603
5666
  }
5604
- function Sr(e, t) {
5667
+ function Lr(e, t) {
5605
5668
  try {
5606
5669
  window.localStorage.setItem(
5607
- Po(e),
5670
+ Mo(e),
5608
5671
  JSON.stringify(t)
5609
5672
  );
5610
5673
  } catch {
5611
5674
  return;
5612
5675
  }
5613
5676
  }
5614
- function Er(e) {
5677
+ function Pr(e) {
5615
5678
  if (!e || typeof e != "object")
5616
5679
  return !1;
5617
5680
  const t = e;
5618
5681
  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");
5619
5682
  }
5620
- function kr(e) {
5683
+ function Tr(e) {
5621
5684
  if (!e || typeof e != "object")
5622
5685
  return !1;
5623
5686
  const t = e;
5624
5687
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5625
5688
  }
5626
- async function Io(e, t) {
5689
+ async function zo(e, t) {
5627
5690
  const n = await fetch(e, {
5628
5691
  method: "POST",
5629
5692
  credentials: "include",
@@ -5635,65 +5698,85 @@ async function Io(e, t) {
5635
5698
  ...t ? { signal: t } : {}
5636
5699
  });
5637
5700
  if (!n.ok) {
5638
- const i = await n.text(), a = Qo(i);
5639
- throw a ? (console.error(a), new Error(a)) : new Error(`Failed to load Pluno token (${n.status})`);
5701
+ const i = await n.text(), r = ni(i);
5702
+ throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
5640
5703
  }
5641
5704
  const o = await n.json();
5642
5705
  if (!o.token)
5643
5706
  throw new Error("Pluno token endpoint did not return a token");
5644
5707
  return o.token;
5645
5708
  }
5646
- function Lr(e) {
5647
- return async () => {
5648
- const t = new AbortController();
5649
- let n = !1;
5650
- const o = new Promise((i, a) => {
5651
- const l = window.setTimeout(() => {
5652
- n = !0, t.abort(), a(new Error(Ln));
5653
- }, Ai);
5654
- t.signal.addEventListener(
5709
+ function Ir(e) {
5710
+ let t = !1, n = !1;
5711
+ const o = async () => {
5712
+ const i = new AbortController();
5713
+ let r = !1;
5714
+ const l = new Promise((p, s) => {
5715
+ const c = window.setTimeout(() => {
5716
+ r = !0, i.abort(), s(new Error(Dn));
5717
+ }, Di);
5718
+ i.signal.addEventListener(
5655
5719
  "abort",
5656
- () => window.clearTimeout(l),
5720
+ () => window.clearTimeout(c),
5657
5721
  { once: !0 }
5658
5722
  );
5659
5723
  });
5660
5724
  try {
5661
- const i = await Promise.race([
5662
- Io(e, t.signal),
5663
- o
5725
+ const p = await Promise.race([
5726
+ zo(e, i.signal),
5727
+ l
5664
5728
  ]);
5665
- return t.abort(), i;
5666
- } catch (i) {
5667
- throw t.abort(), n ? new Error(Ln) : i instanceof Error && i.message.startsWith("Pluno widget blocked on ") ? i : new Error(Ni);
5729
+ return i.abort(), p;
5730
+ } catch (p) {
5731
+ throw i.abort(), r ? new Error(Dn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Mi);
5732
+ }
5733
+ };
5734
+ return {
5735
+ loadToken: async () => {
5736
+ t = !0;
5737
+ try {
5738
+ try {
5739
+ return await o();
5740
+ } catch (i) {
5741
+ if (!n)
5742
+ throw i;
5743
+ return n = !1, await o();
5744
+ }
5745
+ } finally {
5746
+ t = !1, n = !1;
5747
+ }
5748
+ },
5749
+ retryPendingFailureOnce: () => {
5750
+ t && (n = !0);
5668
5751
  }
5669
5752
  };
5670
5753
  }
5671
- const Jn = /* @__PURE__ */ new WeakSet();
5672
- function Pr(e) {
5754
+ const ao = /* @__PURE__ */ new WeakSet();
5755
+ function Ar(e) {
5673
5756
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5674
5757
  }
5675
- function Qn(e) {
5758
+ function ro(e) {
5676
5759
  const t = e.pathname.split("/");
5677
5760
  return t[t.length - 1] ?? "";
5678
5761
  }
5679
- function Ir(e, t) {
5762
+ function Nr(e, t) {
5680
5763
  const n = new URL(e.src, document.baseURI);
5681
- return n.href === t.href || n.pathname === t.pathname ? !0 : Qn(n) === Qn(t);
5764
+ return n.href === t.href || n.pathname === t.pathname ? !0 : ro(n) === ro(t);
5682
5765
  }
5683
- class de extends EventTarget {
5766
+ class ge extends EventTarget {
5684
5767
  constructor(t, n) {
5685
- super(), this.channelId = n, this.url = t, this.addPreviewListener(ki, () => {
5686
- this.readyState = de.OPEN, this.dispatchEvent(new Event("open"));
5687
- }), this.addPreviewListener(Li, (o) => {
5768
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Ti, () => {
5769
+ this.readyState = ge.OPEN, this.dispatchEvent(new Event("open"));
5770
+ }), this.addPreviewListener(Ii, (o) => {
5688
5771
  const i = o;
5689
5772
  this.dispatchEvent(
5690
5773
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5691
5774
  );
5692
- }), this.addPreviewListener(Pi, () => {
5693
- this.readyState = de.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5694
- }), this.addPreviewListener(Ii, (o) => {
5775
+ }), this.addPreviewListener(Ai, () => {
5776
+ this.readyState = ge.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5777
+ }), this.addPreviewListener(Ni, (o) => {
5695
5778
  const i = o;
5696
- this.readyState = de.CLOSED, this.dispatchEvent(
5779
+ this.readyState = ge.CLOSED, this.dispatchEvent(
5697
5780
  new CloseEvent("close", {
5698
5781
  code: i.detail?.code ?? 1e3,
5699
5782
  reason: i.detail?.reason ?? "",
@@ -5702,8 +5785,8 @@ class de extends EventTarget {
5702
5785
  ), this.cleanup();
5703
5786
  }), window.dispatchEvent(
5704
5787
  new CustomEvent(
5705
- pt(
5706
- Ci,
5788
+ gt(
5789
+ ki,
5707
5790
  this.channelId
5708
5791
  ),
5709
5792
  {
@@ -5722,18 +5805,18 @@ class de extends EventTarget {
5722
5805
  extensions = "";
5723
5806
  binaryType = "blob";
5724
5807
  bufferedAmount = 0;
5725
- readyState = de.CONNECTING;
5726
- socketId = Tr();
5808
+ readyState = ge.CONNECTING;
5809
+ socketId = Rr();
5727
5810
  listeners = /* @__PURE__ */ new Map();
5728
5811
  send(t) {
5729
- if (this.readyState !== de.OPEN)
5812
+ if (this.readyState !== ge.OPEN)
5730
5813
  throw new DOMException(
5731
5814
  "Pluno preview websocket is not open",
5732
5815
  "InvalidStateError"
5733
5816
  );
5734
5817
  window.dispatchEvent(
5735
5818
  new CustomEvent(
5736
- pt(Si, this.channelId),
5819
+ gt(Li, this.channelId),
5737
5820
  {
5738
5821
  detail: {
5739
5822
  socketId: this.socketId,
@@ -5744,9 +5827,9 @@ class de extends EventTarget {
5744
5827
  );
5745
5828
  }
5746
5829
  close(t, n) {
5747
- this.readyState !== de.CLOSED && (this.readyState = de.CLOSING, window.dispatchEvent(
5830
+ this.readyState !== ge.CLOSED && (this.readyState = ge.CLOSING, window.dispatchEvent(
5748
5831
  new CustomEvent(
5749
- pt(Ei, this.channelId),
5832
+ gt(Pi, this.channelId),
5750
5833
  {
5751
5834
  detail: { socketId: this.socketId, code: t, reason: n }
5752
5835
  }
@@ -5754,11 +5837,11 @@ class de extends EventTarget {
5754
5837
  ), this.cleanup());
5755
5838
  }
5756
5839
  addPreviewListener(t, n) {
5757
- const o = pt(
5840
+ const o = gt(
5758
5841
  t,
5759
5842
  this.channelId
5760
- ), i = (a) => {
5761
- a.detail?.socketId === this.socketId && n(a);
5843
+ ), i = (r) => {
5844
+ r.detail?.socketId === this.socketId && n(r);
5762
5845
  };
5763
5846
  this.listeners.set(o, i), window.addEventListener(o, i);
5764
5847
  }
@@ -5768,19 +5851,19 @@ class de extends EventTarget {
5768
5851
  this.listeners.clear();
5769
5852
  }
5770
5853
  }
5771
- function Tr() {
5854
+ function Rr() {
5772
5855
  const e = window.sessionStorage.getItem(
5773
- kn
5856
+ Rn
5774
5857
  );
5775
5858
  if (e)
5776
5859
  return e;
5777
5860
  const t = crypto.randomUUID();
5778
- return window.sessionStorage.setItem(kn, t), t;
5861
+ return window.sessionStorage.setItem(Rn, t), t;
5779
5862
  }
5780
- function pt(e, t) {
5863
+ function gt(e, t) {
5781
5864
  return `${e}:${t}`;
5782
5865
  }
5783
- function Ar(e) {
5866
+ function Dr(e) {
5784
5867
  const t = document.currentScript;
5785
5868
  if (t instanceof HTMLScriptElement)
5786
5869
  return [t];
@@ -5788,64 +5871,65 @@ function Ar(e) {
5788
5871
  return Array.from(
5789
5872
  document.querySelectorAll("script[type='module'][src]")
5790
5873
  ).filter(
5791
- (i) => i instanceof HTMLScriptElement && Pr(i) && Ir(i, o)
5874
+ (i) => i instanceof HTMLScriptElement && Ar(i) && Nr(i, o)
5792
5875
  );
5793
5876
  }
5794
- function Nr(e) {
5795
- for (const t of Ar(e))
5796
- Jn.has(t) || t.dataset.plunoAutoMount === "false" || (Jn.add(t), To(t).catch((n) => {
5877
+ function Mr(e) {
5878
+ for (const t of Dr(e))
5879
+ ao.has(t) || t.dataset.plunoAutoMount === "false" || (ao.add(t), Oo(t).catch((n) => {
5797
5880
  console.error("Failed to mount Pluno widget", n);
5798
5881
  }));
5799
5882
  }
5800
- function To(e) {
5801
- const t = window, n = t[se];
5883
+ function Oo(e) {
5884
+ const t = window, n = t[ue];
5802
5885
  if (n) {
5803
5886
  if (n.host === null)
5804
5887
  return n.mountPromise.catch(() => {
5805
- const p = t[se];
5806
- return p ? p.mountPromise : To(e);
5888
+ const s = t[ue];
5889
+ return s ? s.mountPromise : Oo(e);
5807
5890
  });
5808
- if (Dr(n.host))
5809
- return n.mountPromise;
5810
- n.destroy?.(), delete t[se];
5891
+ if (zr(n.host))
5892
+ return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
5893
+ n.destroy?.(), delete t[ue];
5811
5894
  }
5812
- const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint;
5813
- let a;
5814
- const l = ta({
5895
+ const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Ir(i) : null;
5896
+ let l;
5897
+ const p = ia({
5815
5898
  token: e.dataset.plunoToken,
5816
- tokenProvider: !e.dataset.plunoToken && !o && i ? Lr(i) : void 0,
5899
+ tokenProvider: r?.loadToken,
5817
5900
  tokenEndpoint: i,
5818
5901
  backendUrl: e.dataset.plunoBackendUrl,
5819
- webSocketFactory: o ? ea(o) : void 0,
5902
+ webSocketFactory: o ? oa(o) : void 0,
5820
5903
  launcherLabel: e.dataset.plunoLauncherLabel,
5821
5904
  accentColor: e.dataset.plunoAccentColor,
5822
5905
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5823
5906
  fontFamily: e.dataset.plunoFontFamily,
5824
5907
  scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
5825
5908
  position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5826
- }).then((p) => {
5827
- if (t[se] !== a) {
5828
- p.destroy();
5909
+ }).then((s) => {
5910
+ if (t[ue] !== l) {
5911
+ s.destroy();
5829
5912
  return;
5830
5913
  }
5831
- const d = p.host;
5832
- d.setAttribute(io, "true"), a.host = d, a.destroy = () => {
5833
- t[se] === a && delete t[se], a.host = null, a.destroy = null, p.destroy();
5914
+ const c = s.host;
5915
+ c.setAttribute(uo, "true"), l.host = c, l.destroy = () => {
5916
+ t[ue] === l && delete t[ue], l.host = null, l.destroy = null, s.destroy();
5834
5917
  };
5835
- }).catch((p) => {
5836
- throw t[se] === a && delete t[se], p;
5918
+ }).catch((s) => {
5919
+ throw t[ue] === l && delete t[ue], s;
5837
5920
  });
5838
- return a = {
5839
- mountPromise: l,
5921
+ return l = {
5922
+ mountPromise: p,
5840
5923
  host: null,
5841
- destroy: null
5842
- }, t[se] = a, l;
5924
+ destroy: null,
5925
+ retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
5926
+ }, t[ue] = l, p;
5843
5927
  }
5844
- function Dr(e) {
5845
- return e.isConnected && e.getAttribute(io) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
5928
+ function zr(e) {
5929
+ return e.isConnected && e.getAttribute(uo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
5846
5930
  }
5847
- Nr(import.meta.url);
5931
+ Mr(import.meta.url);
5848
5932
  export {
5849
- ea as createProductAgentPreviewBridgeWebSocketFactory,
5850
- ta as mountPlunoProductAgentWidget
5933
+ oa as createProductAgentPreviewBridgeWebSocketFactory,
5934
+ ia as mountPlunoProductAgentWidget
5851
5935
  };