@pluno/product-agent-web 0.1.122 → 0.1.124

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,17 +1,17 @@
1
- import { PlunoProductAgent as Di, getProductAgentOriginAccessErrorMessage as Oi } from "./product-agent-sdk.js";
2
- const Ui = "#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", Ot = "#2c2a1e", io = [253, 250, 241], ao = 3.5;
3
- function Fo(e) {
4
- const t = Wo(e);
5
- if (ro(ft(t), io) >= ao)
1
+ import { PlunoProductAgent as Ui, getProductAgentOriginAccessErrorMessage as Bi } from "./product-agent-sdk.js";
2
+ const Fi = "#7c3aed", Ut = "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", Bt = "#2c2a1e", ao = [253, 250, 241], ro = 3.5;
3
+ function Ho(e) {
4
+ const t = $o(e);
5
+ if (lo(ft(t), ao) >= ro)
6
6
  return t;
7
7
  let i = ft(t);
8
- const o = ft(Ot);
8
+ const o = ft(Bt);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (i = Wi(i, o, 0.22), ro(i, io) >= ao)
11
- return vn(i);
12
- return vn(i);
10
+ if (i = $i(i, o, 0.22), lo(i, ao) >= ro)
11
+ return Sn(i);
12
+ return Sn(i);
13
13
  }
14
- function Bi() {
14
+ function Wi() {
15
15
  let n = "M 280 120", i = !1, o = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (o % 3 - 1) * 18, p = i ? 280 - l : 1020 + l;
@@ -19,8 +19,8 @@ function Bi() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function Fi(e) {
23
- const t = Wo(e), n = Sn(ft(t));
22
+ function Hi(e) {
23
+ const t = $o(e), n = Cn(ft(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,9 +56,9 @@ function Fi(e) {
56
56
  shadow: de(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Wo(e) {
59
+ function $o(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()}` : Ui;
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()}` : Fi;
62
62
  }
63
63
  function ft(e) {
64
64
  return [
@@ -67,23 +67,23 @@ function ft(e) {
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function vn([e, t, n]) {
70
+ function Sn([e, t, n]) {
71
71
  const i = (o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0");
72
72
  return `#${i(e)}${i(t)}${i(n)}`;
73
73
  }
74
- function Sn([e, t, n]) {
74
+ function Cn([e, t, n]) {
75
75
  const i = (o) => {
76
76
  const r = o / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
80
80
  }
81
- function ro(e, t) {
82
- const n = Sn(e), i = Sn(t), [o, r] = n > i ? [n, i] : [i, n];
81
+ function lo(e, t) {
82
+ const n = Cn(e), i = Cn(t), [o, r] = n > i ? [n, i] : [i, n];
83
83
  return (o + 0.05) / (r + 0.05);
84
84
  }
85
- function Wi(e, t, n) {
86
- const i = Cn(n);
85
+ function $i(e, t, n) {
86
+ const i = En(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * i,
89
89
  e[1] + (t[1] - e[1]) * i,
@@ -91,43 +91,43 @@ function Wi(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function de(e, t, n) {
94
- const [i, o, r] = Hi(ft(e));
95
- return vn($i(i, Cn(o + n), Cn(r + t)));
94
+ const [i, o, r] = Gi(ft(e));
95
+ return Sn(qi(i, En(o + n), En(r + t)));
96
96
  }
97
- function Hi([e, t, n]) {
97
+ function Gi([e, t, n]) {
98
98
  const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), p = Math.min(i, o, r), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
101
101
  const c = l - p, g = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
102
  return [(l === i ? (o - r) / c + (o < r ? 6 : 0) : l === o ? (r - i) / c + 2 : (i - o) / c + 4) / 6, g, d];
103
103
  }
104
- function $i(e, t, n) {
104
+ function qi(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const i = n < 0.5 ? n * (1 + t) : n + t - n * t, o = 2 * n - i;
108
108
  return [
109
- cn(o, i, e + 1 / 3) * 255,
110
- cn(o, i, e) * 255,
111
- cn(o, i, e - 1 / 3) * 255
109
+ un(o, i, e + 1 / 3) * 255,
110
+ un(o, i, e) * 255,
111
+ un(o, i, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function cn(e, t, n) {
114
+ function un(e, t, n) {
115
115
  let i = n;
116
116
  return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? e + (t - e) * 6 * i : i < 1 / 2 ? t : i < 2 / 3 ? e + (t - e) * (2 / 3 - i) * 6 : e;
117
117
  }
118
- function Cn(e) {
118
+ function En(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const Ho = "suggest_share_on_socials";
122
- function Gi(e) {
121
+ const Go = "suggest_share_on_socials";
122
+ function ji(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 !== Ho)
125
+ if (n.role !== "tool" || n.toolName !== Go)
126
126
  continue;
127
- const i = lo(e, t, "assistant");
127
+ const i = po(e, t, "assistant");
128
128
  if (!i)
129
129
  return null;
130
- const o = lo(e, i.index, "user");
130
+ const o = po(e, i.index, "user");
131
131
  return o ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: o.content,
@@ -136,13 +136,13 @@ function Gi(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- function qi(e) {
139
+ function Vi(e) {
140
140
  let t = 2166136261;
141
141
  for (const n of e)
142
142
  t ^= n.charCodeAt(0), t = Math.imul(t, 16777619);
143
143
  return (t >>> 0) % 2 === 0 ? "referral" : "social";
144
144
  }
145
- function lo(e, t, n) {
145
+ function po(e, t, n) {
146
146
  for (let i = t - 1; i >= 0; i -= 1) {
147
147
  const o = e[i];
148
148
  if (o.role === n && o.content.trim())
@@ -150,15 +150,15 @@ function lo(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- const ji = "https://app.pluno.ai", Vi = "/api/product-agent/embed/active-users", Ki = 1800, Yi = 15e3, Xi = 250, Zi = 1e3, Ji = 3e4;
154
- function Qi(e, t = {}) {
153
+ const Ki = "https://app.pluno.ai", Yi = "/api/product-agent/embed/active-users", Xi = 1800, Zi = 15e3, Ji = 250, Qi = 1e3, ea = 3e4;
154
+ function ta(e, t = {}) {
155
155
  let n = !1, i = null, o = null, r = null;
156
156
  const l = () => {
157
157
  r !== null && (window.clearInterval(r), r = null);
158
158
  }, p = (g) => {
159
159
  n || (o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
160
160
  c();
161
- }, na(g)));
161
+ }, ia(g)));
162
162
  }, d = (g) => {
163
163
  if (l(), i === null) {
164
164
  i = g, e(g);
@@ -170,50 +170,50 @@ function Qi(e, t = {}) {
170
170
  l();
171
171
  return;
172
172
  }
173
- const x = Math.min(1, (performance.now() - f) / Ki);
174
- i = Math.round(h + (g - h) * oa(x)), e(i), x >= 1 && (i = g, e(g), l());
175
- }, Xi);
173
+ const b = Math.min(1, (performance.now() - f) / Xi);
174
+ i = Math.round(h + (g - h) * aa(b)), e(i), b >= 1 && (i = g, e(g), l());
175
+ }, Ji);
176
176
  }, c = async () => {
177
177
  try {
178
- const g = await ea(t);
178
+ const g = await na(t);
179
179
  if (n)
180
180
  return;
181
181
  d(g.count), p(g.refreshAfterMs);
182
182
  } catch {
183
- p(Yi);
183
+ p(Zi);
184
184
  }
185
185
  };
186
186
  return c(), () => {
187
187
  n = !0, o !== null && window.clearTimeout(o), l();
188
188
  };
189
189
  }
190
- async function ea(e) {
190
+ async function na(e) {
191
191
  if (e.loader)
192
192
  return e.loader();
193
- const n = await (e.fetcher ?? fetch)(new URL(Vi, ta(e.backendUrl ?? ji)).toString(), {
193
+ const n = await (e.fetcher ?? fetch)(new URL(Yi, oa(e.backendUrl ?? Ki)).toString(), {
194
194
  cache: "no-store",
195
195
  credentials: "omit"
196
196
  });
197
197
  if (!n.ok)
198
198
  throw new Error("Failed to load active users");
199
- const i = await n.json(), o = po(i.count), r = po(i.refreshAfterMs ?? i.refresh_after_ms);
199
+ const i = await n.json(), o = so(i.count), r = so(i.refreshAfterMs ?? i.refresh_after_ms);
200
200
  if (o === null || r === null)
201
201
  throw new Error("Invalid active users response");
202
202
  return { count: o, refreshAfterMs: r };
203
203
  }
204
- function po(e) {
204
+ function so(e) {
205
205
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
206
206
  }
207
- function ta(e) {
207
+ function oa(e) {
208
208
  return e.endsWith("/") ? e : `${e}/`;
209
209
  }
210
- function na(e) {
211
- return Math.min(Ji, Math.max(Zi, e));
210
+ function ia(e) {
211
+ return Math.min(ea, Math.max(Qi, e));
212
212
  }
213
- function oa(e) {
213
+ function aa(e) {
214
214
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
215
215
  }
216
- const ia = [
216
+ const ra = [
217
217
  "a[href]",
218
218
  "button",
219
219
  "input",
@@ -237,27 +237,27 @@ const ia = [
237
237
  ".pluno-pa-widget__message",
238
238
  ".timeline-item"
239
239
  ].join(",");
240
- function aa(e, t, n) {
241
- return e instanceof Element ? ra(
240
+ function la(e, t, n) {
241
+ return e instanceof Element ? pa(
242
242
  t,
243
243
  n,
244
- e.closest(ia) !== null
244
+ e.closest(ra) !== null
245
245
  ) : !1;
246
246
  }
247
- function ra(e, t, n) {
247
+ function pa(e, t, n) {
248
248
  return e === 1 && !t && !n;
249
249
  }
250
- function la(e, t, n) {
250
+ function sa(e, t, n) {
251
251
  return e instanceof Node && t !== null && !t.contains(e) && !n?.contains(e);
252
252
  }
253
- function pa(e, t = !0) {
253
+ function da(e, t = !0) {
254
254
  if (!e || !t || !e.isConnected || e.disabled || e.readOnly)
255
255
  return !1;
256
256
  const n = e.getRootNode();
257
257
  return (n instanceof ShadowRoot ? n.activeElement : e.ownerDocument.activeElement) === e ? !1 : (e.focus({ preventScroll: !0 }), !0);
258
258
  }
259
- const sa = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
260
- function da(e) {
259
+ const ca = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
260
+ function ua(e) {
261
261
  let t = "", n = "", i = null;
262
262
  for (const o of e.split(new RegExp("(?<=\\n)"))) {
263
263
  if (i) {
@@ -268,7 +268,7 @@ function da(e) {
268
268
  }
269
269
  const r = o.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
270
270
  if (r) {
271
- t += so(n) + o, n = "", i = {
271
+ t += co(n) + o, n = "", i = {
272
272
  marker: r[1][0],
273
273
  length: r[1].length
274
274
  };
@@ -276,31 +276,31 @@ function da(e) {
276
276
  }
277
277
  n += o;
278
278
  }
279
- return t + so(n);
279
+ return t + co(n);
280
280
  }
281
- function so(e) {
281
+ function co(e) {
282
282
  let t = "", n = 0;
283
- for (const i of e.matchAll(sa)) {
283
+ for (const i of e.matchAll(ca)) {
284
284
  const o = i.index ?? 0;
285
- t += co(
285
+ t += uo(
286
286
  e.slice(n, o)
287
287
  ), t += i[0], n = o + i[0].length;
288
288
  }
289
- return t + co(e.slice(n));
289
+ return t + uo(e.slice(n));
290
290
  }
291
- function co(e) {
291
+ function uo(e) {
292
292
  return e.replace(
293
293
  /\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
294
- (t, n, i, o, r) => r[o - 1] === "!" || ca(r, o) || ua(r, o, n) ? t : `[${n}](${i})`
294
+ (t, n, i, o, r) => r[o - 1] === "!" || ga(r, o) || ha(r, o, n) ? t : `[${n}](${i})`
295
295
  );
296
296
  }
297
- function ca(e, t) {
297
+ function ga(e, t) {
298
298
  let n = 0;
299
299
  for (let i = t - 1; e[i] === "\\"; i -= 1)
300
300
  n += 1;
301
301
  return n % 2 === 1;
302
302
  }
303
- function ua(e, t, n) {
303
+ function ha(e, t, n) {
304
304
  if (n !== "x" && n !== "X")
305
305
  return !1;
306
306
  const i = e.lastIndexOf(`
@@ -309,7 +309,7 @@ function ua(e, t, n) {
309
309
  e.slice(i, t)
310
310
  );
311
311
  }
312
- const $o = 100, ga = 1e4, ha = 5e3, ma = "product-agent:sdk-preview-socket-connect", fa = "product-agent:sdk-preview-socket-send", wa = "product-agent:sdk-preview-socket-close", ba = "product-agent:sdk-preview-socket-open", _a = "product-agent:sdk-preview-socket-message", xa = "product-agent:sdk-preview-socket-error", ya = "product-agent:sdk-preview-socket-closed", uo = "product-agent:sdk-preview-socket-id", va = "data-pluno-sdk-preview-channel", Go = "data-pluno-auto-mounted", ve = "__plunoProductAgentAutoMountOwner", Sa = 1e4, Ca = "Failed to load Pluno widget token", go = "Timed out loading Pluno widget token", Ea = "pluno.productAgent.widgetClientId.", un = /* @__PURE__ */ new Set(), ka = "product-agent:preview-diagnostic", qo = "pluno.productAgent.sharePromptsDisabled", La = 3, ho = 'dialog[open], [aria-modal="true"], [role="dialog"]', mo = 1500, Ta = 5e3, Pa = 500, Aa = "No recent chats for this page yet.", Se = {
312
+ const qo = 100, ma = 1e4, fa = 5e3, wa = "product-agent:sdk-preview-socket-connect", ba = "product-agent:sdk-preview-socket-send", _a = "product-agent:sdk-preview-socket-close", xa = "product-agent:sdk-preview-socket-open", ya = "product-agent:sdk-preview-socket-message", va = "product-agent:sdk-preview-socket-error", Sa = "product-agent:sdk-preview-socket-closed", go = "product-agent:sdk-preview-socket-id", Ca = "data-pluno-sdk-preview-channel", jo = "data-pluno-auto-mounted", ve = "__plunoProductAgentAutoMountOwner", Ea = 1e4, ka = "Failed to load Pluno widget token", ho = "Timed out loading Pluno widget token", La = "pluno.productAgent.widgetClientId.", gn = /* @__PURE__ */ new Set(), Ta = "product-agent:preview-diagnostic", Vo = "pluno.productAgent.sharePromptsDisabled", Pa = 3, mo = 'dialog[open], [aria-modal="true"], [role="dialog"]', fo = 1500, Aa = 5e3, Ia = 500, Na = "No recent chats for this page yet.", Se = {
313
313
  launcherLabel: "Ask for anything...",
314
314
  accentColor: "#7c3aed",
315
315
  colorScheme: "light",
@@ -317,7 +317,7 @@ const $o = 100, ga = 1e4, ha = 5e3, ma = "product-agent:sdk-preview-socket-conne
317
317
  scribbleStyle: !0,
318
318
  position: "bottom-right",
319
319
  movableLauncher: !0
320
- }, Ia = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', fo = "pluno-pa-scribble-font", jo = 190, Vo = 41, Na = 22, Ra = 32, za = 1, Ma = 48, Mn = 420, Da = 520, Oa = 0.24, Dn = 680, Ua = 800, Ba = 0.76, N = 8, Ge = 50, Ko = "http://www.w3.org/2000/svg", En = 26, kn = 8, Fa = 36, Ln = 16, Wa = 4, wo = [
320
+ }, Ra = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', wo = "pluno-pa-scribble-font", Ko = 190, Yo = 41, za = 22, Ma = 32, Da = 1, Oa = 48, Dn = 420, Ua = 520, Ba = 0.24, On = 680, Fa = 800, Wa = 0.76, N = 8, Ge = 50, Xo = "http://www.w3.org/2000/svg", kn = 26, Ln = 8, Ha = 36, Tn = 16, $a = 4, bo = [
321
321
  {
322
322
  ellipseCx: "17.5",
323
323
  ellipseCy: "24.5",
@@ -354,12 +354,12 @@ const $o = 100, ga = 1e4, ha = 5e3, ma = "product-agent:sdk-preview-socket-conne
354
354
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
355
355
  pathStrokeWidth: "2.45"
356
356
  }
357
- ], Ha = 11, $a = 13, Tn = 4, Yo = 10, Xo = 40, Ga = "movable-launcher-position-v2", Zo = "pluno-pa-widget-styles", Jo = "data-pluno-pa-widget-styles";
358
- let bo = 0;
359
- function qa(e) {
357
+ ], Ga = 11, qa = 13, Pn = 4, Zo = 10, Jo = 40, ja = "movable-launcher-position-v2", Qo = "pluno-pa-widget-styles", ei = "data-pluno-pa-widget-styles";
358
+ let _o = 0;
359
+ function Va(e) {
360
360
  return (t) => new Ce(t, e);
361
361
  }
362
- async function ja(e = {}) {
362
+ async function Ka(e = {}) {
363
363
  const t = {
364
364
  layout: e.layout ?? "floating",
365
365
  mountTarget: e.mountTarget,
@@ -433,42 +433,42 @@ async function ja(e = {}) {
433
433
  );
434
434
  const n = document.createElement("div");
435
435
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), n.setAttribute("data-pluno-product-agent-layout", t.layout), t.sdkPreviewChannelId && n.setAttribute(
436
- va,
436
+ Ca,
437
437
  t.sdkPreviewChannelId
438
438
  );
439
439
  const i = n.attachShadow({ mode: "open" }), o = document.createElement("div");
440
440
  o.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, o.classList.add(`pluno-pa-widget--layout-${t.layout}`), o.setAttribute("data-pluno-product-agent-ui-root", "widget");
441
- let r = _o(
441
+ let r = xo(
442
442
  t.accentColor,
443
443
  t.scribbleStyle
444
444
  );
445
- hr(
445
+ fr(
446
446
  o,
447
447
  t.launcherLabel,
448
448
  r,
449
449
  t.movableLauncher,
450
450
  t.showLauncherMinimizeButton
451
451
  ), i.appendChild(o);
452
- const l = bl(t), p = t.layout === "floating" ? t.initialDisplayState ?? fl(t) : "shown";
453
- Do(t, p);
452
+ const l = Sl(t), p = t.layout === "floating" ? t.initialDisplayState ?? yl(t) : "shown";
453
+ Uo(t, p);
454
454
  let d = t.movableLauncher ? l.launcherPosition : null, c = d !== null, g = l.panelSize, h = null;
455
455
  o.style.setProperty(
456
456
  "--pluno-pa-mobile-panel-top-offset",
457
457
  `${t.mobilePanelTopOffset}px`
458
458
  ), o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (o.classList.add("pluno-pa-widget--minimized"), $e(
459
459
  o,
460
- hn(
460
+ mn(
461
461
  o,
462
462
  d,
463
463
  t.position
464
464
  )
465
- )), Mo(i, t.accentColor), xo(o, r, {
465
+ )), Oo(i, t.accentColor), yo(o, r, {
466
466
  accentColor: t.accentColor,
467
467
  colorScheme: t.colorScheme,
468
468
  fontFamily: t.fontFamily,
469
469
  scribbleStyle: t.scribbleStyle
470
470
  });
471
- const f = t.mountTarget ?? await ml(), x = f.ownerDocument, y = o.querySelector(
471
+ const f = t.mountTarget ?? await xl(), b = f.ownerDocument, y = o.querySelector(
472
472
  ".pluno-pa-widget__launcher"
473
473
  ), U = o.querySelector(
474
474
  ".pluno-pa-widget__launcher-drag-handle"
@@ -539,7 +539,7 @@ async function ja(e = {}) {
539
539
  throw new Error("Failed to mount Pluno widget drag handle");
540
540
  let E = !1;
541
541
  const A = (a) => {
542
- Bt(t.billingStatus) || (E = !1), Ur(
542
+ Wt(t.billingStatus) || (E = !1), Fr(
543
543
  bt,
544
544
  t.billingStatus,
545
545
  a,
@@ -549,37 +549,37 @@ async function ja(e = {}) {
549
549
  }
550
550
  );
551
551
  };
552
- B.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, To(u), To(v);
552
+ B.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, Po(u), Po(v);
553
553
  let M = [], fe = null;
554
- const ke = () => pa(
554
+ const ke = () => da(
555
555
  v,
556
556
  o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !pe(t.billingStatus)
557
557
  ), je = () => {
558
- Rr(
558
+ Mr(
559
559
  qe,
560
560
  M,
561
561
  (a) => {
562
562
  M = M.filter(
563
563
  (s, m) => m !== a
564
- ), je(), O(b.getState()), V(), ke();
564
+ ), je(), O(_.getState()), V(), ke();
565
565
  }
566
566
  );
567
- }, Fn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => mi(t.tokenEndpoint) : void 0);
568
- if (!t.loginRequired && !t.signupRequired && !t.token && !Fn && !t.webSocketFactory)
567
+ }, Wn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => wi(t.tokenEndpoint) : void 0);
568
+ if (!t.loginRequired && !t.signupRequired && !t.token && !Wn && !t.webSocketFactory)
569
569
  throw new Error("Pluno widget requires token or tokenEndpoint");
570
- const wi = window.fetch.bind(window), Ht = wl(t.clientId);
571
- let b;
570
+ const _i = window.fetch.bind(window), Gt = vl(t.clientId);
571
+ let _;
572
572
  try {
573
573
  const a = {
574
574
  token: t.token,
575
- tokenProvider: Fn,
575
+ tokenProvider: Wn,
576
576
  backendUrl: t.backendUrl,
577
577
  metadata: () => ({
578
578
  ...t.metadata ?? {},
579
- ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
579
+ ...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
580
580
  }),
581
581
  initialStarterPrompts: t.initialStarterPrompts,
582
- clientId: Ht.clientId,
582
+ clientId: Gt.clientId,
583
583
  restorePersistedState: t.restorePersistedState,
584
584
  expectedPersistedSessionId: t.expectedPersistedSessionId,
585
585
  keepRunsActiveOnSessionNavigation: t.keepRunsActiveOnSessionNavigation,
@@ -591,9 +591,9 @@ async function ja(e = {}) {
591
591
  autoConnect: !1,
592
592
  disableNetworkCapture: !!t.sdkPreviewChannelId
593
593
  };
594
- b = await Di.init(a);
594
+ _ = await Ui.init(a);
595
595
  } catch (a) {
596
- throw Ht.release(), n.remove(), a;
596
+ throw Gt.release(), n.remove(), a;
597
597
  }
598
598
  f.appendChild(n), J(
599
599
  "web-sdk.widget",
@@ -605,19 +605,19 @@ async function ja(e = {}) {
605
605
  cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
606
606
  }
607
607
  );
608
- const $t = new Set(l.openToolGroupKeys), Ue = new Set(
608
+ const qt = new Set(l.openToolGroupKeys), Ue = new Set(
609
609
  l.seenShareCandidateIds
610
610
  ), nt = new Set(Ue);
611
- let Gt = l.sharePromptsDisabled || await _l(t), ie = null, Y = !1, xt = !(t.loginRequired || t.signupRequired), Le = !1, Be = {
611
+ let jt = l.sharePromptsDisabled || await Cl(t), ie = null, Y = !1, xt = !(t.loginRequired || t.signupRequired), Le = !1, Be = {
612
612
  enabled: !0
613
- }, Fe = 0, Wn = "", X = !1, we = !1, Te = [], qt = null, ot = null;
613
+ }, Fe = 0, Hn = "", X = !1, we = !1, Te = [], Vt = null, ot = null;
614
614
  const ae = (a, s) => {
615
615
  Be = { enabled: a, reason: s };
616
616
  }, re = () => {
617
617
  he.hidden = !0;
618
- }, bi = () => {
618
+ }, xi = () => {
619
619
  he.hidden = !1;
620
- }, _i = (a = "jump") => {
620
+ }, yi = (a = "jump") => {
621
621
  ae(!0, a), re(), mt(z, () => Be.enabled), Fe = z.scrollTop;
622
622
  }, be = () => {
623
623
  if (Z.hidden = t.layout === "page" || t.loginRequired, ze.hidden = !X, Z.setAttribute("aria-expanded", String(X)), K.classList.toggle(
@@ -631,15 +631,15 @@ async function ja(e = {}) {
631
631
  const s = document.createElement("button");
632
632
  s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = we;
633
633
  const m = document.createElement("span");
634
- m.className = "pluno-pa-widget__history-item-title", m.textContent = cr(a);
634
+ m.className = "pluno-pa-widget__history-item-title", m.textContent = gr(a);
635
635
  const S = document.createElement("time");
636
- S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = gr(
636
+ S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = mr(
637
637
  a.lastActiveAt,
638
638
  Date.now()
639
639
  );
640
640
  const k = document.createElement("small");
641
- k.className = "pluno-pa-widget__history-path", k.textContent = ur(a), s.append(m, S, k), s.addEventListener("click", () => {
642
- X = !1, ot = null, be(), ae(!0, "newSession"), re(), b.loadSession(a.id), O(b.getState()), ke();
641
+ k.className = "pluno-pa-widget__history-path", k.textContent = hr(a), s.append(m, S, k), s.addEventListener("click", () => {
642
+ X = !1, ot = null, be(), ae(!0, "newSession"), re(), _.loadSession(a.id), O(_.getState()), ke();
643
643
  }), K.appendChild(s);
644
644
  }
645
645
  if (we && Te.length > 0) {
@@ -647,12 +647,12 @@ async function ja(e = {}) {
647
647
  a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", K.appendChild(a);
648
648
  }
649
649
  Me.textContent = ot ?? (!we && Te.length === 0 ? "No recent chats for this page yet." : ""), Me.hidden = Me.textContent.length === 0;
650
- }, Hn = async (a) => {
650
+ }, $n = async (a) => {
651
651
  if (!we) {
652
652
  we = !0, ot = null, be();
653
653
  try {
654
- const s = await b.listSessions({ cursor: a, limit: 20 });
655
- Te = a ? [...Te, ...s.sessions] : s.sessions, qt = s.nextCursor;
654
+ const s = await _.listSessions({ cursor: a, limit: 20 });
655
+ Te = a ? [...Te, ...s.sessions] : s.sessions, Vt = s.nextCursor;
656
656
  } catch (s) {
657
657
  J(
658
658
  "web-sdk.widget",
@@ -660,25 +660,25 @@ async function ja(e = {}) {
660
660
  {
661
661
  message: s instanceof Error ? s.message : String(s)
662
662
  }
663
- ), ot = Aa;
663
+ ), ot = Na;
664
664
  } finally {
665
665
  we = !1, be();
666
666
  }
667
667
  }
668
- }, xi = () => {
669
- !qt || we || K.scrollHeight - K.scrollTop - K.clientHeight <= 24 && Hn(qt);
670
- }, $n = () => {
671
- Y || typeof document > "u" || (Mo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || x.body?.appendChild(n)));
672
- }, Gn = new MutationObserver($n);
673
- Gn.observe(x.documentElement, {
668
+ }, vi = () => {
669
+ !Vt || we || K.scrollHeight - K.scrollTop - K.clientHeight <= 24 && $n(Vt);
670
+ }, Gn = () => {
671
+ Y || typeof document > "u" || (Oo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || b.body?.appendChild(n)));
672
+ }, qn = new MutationObserver(Gn);
673
+ qn.observe(b.documentElement, {
674
674
  childList: !0,
675
675
  subtree: !0
676
- }), $n();
676
+ }), Gn();
677
677
  const it = (a = !0) => {
678
- const s = Ut(o, a);
679
- return Pn(
678
+ const s = Ft(o, a);
679
+ return An(
680
680
  o,
681
- d ? zt(d, s) : er(
681
+ d ? Dt(d, s) : nr(
682
682
  o,
683
683
  t.position,
684
684
  s
@@ -686,42 +686,42 @@ async function ja(e = {}) {
686
686
  s
687
687
  );
688
688
  }, W = () => {
689
- const a = rr(
689
+ const a = pr(
690
690
  i,
691
691
  u,
692
692
  v
693
693
  );
694
- yl(t, {
694
+ kl(t, {
695
695
  isOpen: o.classList.contains("pluno-pa-widget--open"),
696
696
  composerValue: v.value,
697
697
  focusedInput: a,
698
698
  focusedInputAt: a ? Date.now() : null,
699
- openToolGroupKeys: [...$t],
699
+ openToolGroupKeys: [...qt],
700
700
  launcherPosition: c ? d : null,
701
701
  panelSize: g,
702
702
  seenShareCandidateIds: [...Ue].slice(
703
- -$o
703
+ -qo
704
704
  ),
705
- sharePromptsDisabled: Gt
705
+ sharePromptsDisabled: jt
706
706
  });
707
707
  }, yt = (a) => {
708
708
  t.onDisplayStateChange?.(a);
709
709
  }, at = (a, s = !0) => {
710
- if (Do(t, a), a === "shown") {
710
+ if (Uo(t, a), a === "shown") {
711
711
  o.classList.remove("pluno-pa-widget--minimized"), y.removeAttribute("tabindex"), y.removeAttribute("role"), y.removeAttribute("aria-label"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && rt(!1), s && yt("shown");
712
712
  return;
713
713
  }
714
714
  ie !== null && (window.clearTimeout(ie), ie = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), y.hidden = !1, y.setAttribute("role", "button"), y.setAttribute("aria-label", "Open Pluno"), w.hidden = !0, L.hidden = !0, y.tabIndex = 0, v.value = "", $e(
715
715
  o,
716
- hn(
716
+ mn(
717
717
  o,
718
718
  d,
719
719
  t.position
720
720
  )
721
- ), Eo(o), W(), s && yt("minimized");
721
+ ), ko(o), W(), s && yt("minimized");
722
722
  }, We = (a, s = {}) => {
723
- ar(a, {
724
- debugVersion: Ga,
723
+ lr(a, {
724
+ debugVersion: ja,
725
725
  launcherPosition: d,
726
726
  rootClasses: o.className,
727
727
  rootStyle: {
@@ -730,9 +730,9 @@ async function ja(e = {}) {
730
730
  right: o.style.right,
731
731
  bottom: o.style.bottom
732
732
  },
733
- rootRect: fn(o),
734
- launcherRect: fn(y),
735
- panelRect: fn(w),
733
+ rootRect: wn(o),
734
+ launcherRect: wn(y),
735
+ panelRect: wn(w),
736
736
  viewport: te(),
737
737
  panelHidden: w.hidden,
738
738
  closeHidden: L.hidden,
@@ -745,23 +745,23 @@ async function ja(e = {}) {
745
745
  return $e(o, s), We("Applied stored closed launcher position", {
746
746
  visibleLauncherPosition: s
747
747
  }), s;
748
- }, jt = (a, s) => {
748
+ }, Kt = (a, s) => {
749
749
  if (!a || !s) {
750
- Eo(o);
750
+ ko(o);
751
751
  return;
752
752
  }
753
- ir(o, {
753
+ rr(o, {
754
754
  x: a.x - s.x,
755
755
  y: a.y - s.y
756
756
  });
757
- }, Vt = () => {
757
+ }, Yt = () => {
758
758
  const a = et(g).width;
759
759
  return t.layout === "page" && w.getBoundingClientRect().width || a;
760
- }, qn = () => {
760
+ }, jn = () => {
761
761
  if (o.classList.contains("pluno-pa-widget--minimized")) {
762
762
  $e(
763
763
  o,
764
- hn(
764
+ mn(
765
765
  o,
766
766
  d,
767
767
  t.position
@@ -771,14 +771,14 @@ async function ja(e = {}) {
771
771
  }
772
772
  const a = rt();
773
773
  if (o.classList.contains("pluno-pa-widget--open") || o.classList.contains("pluno-pa-widget--closing")) {
774
- gn(o, g);
774
+ hn(o, g);
775
775
  const s = et(g);
776
- bn(
776
+ _n(
777
777
  R,
778
- Vt()
778
+ Yt()
779
779
  );
780
- const m = Mt(
781
- h ? zt(h, s) : mn(
780
+ const m = Ot(
781
+ h ? Dt(h, s) : fn(
782
782
  o,
783
783
  a,
784
784
  t.position,
@@ -786,7 +786,7 @@ async function ja(e = {}) {
786
786
  ),
787
787
  s
788
788
  );
789
- jt(m, a), We(
789
+ Kt(m, a), We(
790
790
  "Applied open panel position after viewport resize",
791
791
  { openPanelPosition: m }
792
792
  );
@@ -795,20 +795,20 @@ async function ja(e = {}) {
795
795
  { visibleLauncherPosition: a }
796
796
  );
797
797
  };
798
- let jn = () => {
798
+ let Vn = () => {
799
799
  };
800
- window.addEventListener("resize", qn), t.movableLauncher && U ? (rt(), jn = Za({
800
+ window.addEventListener("resize", jn), t.movableLauncher && U ? (rt(), Vn = Qa({
801
801
  root: o,
802
802
  launcher: y,
803
803
  launcherDragHandle: U,
804
804
  getPosition: () => it(),
805
805
  setPosition: (a) => {
806
- const s = a, m = Ut(o), S = Pn(
806
+ const s = a, m = Ft(o), S = An(
807
807
  o,
808
808
  a,
809
809
  m
810
810
  );
811
- d = Co(
811
+ d = Eo(
812
812
  S,
813
813
  m
814
814
  ), $e(o, S), We("Dragging closed launcher", {
@@ -818,12 +818,12 @@ async function ja(e = {}) {
818
818
  persist: () => {
819
819
  c = !0, W(), We("Persisted closed launcher drag position");
820
820
  }
821
- })) : $e(o, null), gn(o, g);
822
- const yi = () => {
821
+ })) : $e(o, null), hn(o, g);
822
+ const Si = () => {
823
823
  const a = et(g), s = it();
824
824
  return {
825
- position: Mt(
826
- h ? zt(h, a) : mn(
825
+ position: Ot(
826
+ h ? Dt(h, a) : fn(
827
827
  o,
828
828
  s,
829
829
  t.position,
@@ -833,42 +833,42 @@ async function ja(e = {}) {
833
833
  ),
834
834
  size: a
835
835
  };
836
- }, vi = (a) => {
837
- g = Ft(a.size), gn(o, g), bn(
836
+ }, Ci = (a) => {
837
+ g = Ht(a.size), hn(o, g), _n(
838
838
  R,
839
- Vt()
839
+ Yt()
840
840
  );
841
- const s = Mt(
841
+ const s = Ot(
842
842
  a.position,
843
843
  et(g)
844
844
  );
845
- h = Co(
845
+ h = Eo(
846
846
  s,
847
847
  et(g)
848
848
  );
849
849
  const m = it();
850
- jt(s, m);
851
- }, Si = D.length > 0 ? Ja({
850
+ Kt(s, m);
851
+ }, Ei = D.length > 0 ? er({
852
852
  root: o,
853
853
  handles: D,
854
- getBounds: yi,
855
- setBounds: vi,
854
+ getBounds: Si,
855
+ setBounds: Ci,
856
856
  persist: W
857
857
  }) : () => {
858
858
  };
859
- let Kt = !1;
860
- const Vn = async () => {
861
- if (!(!t.billingStatusLoader || Kt)) {
862
- Kt = !0;
859
+ let Xt = !1;
860
+ const Kn = async () => {
861
+ if (!(!t.billingStatusLoader || Xt)) {
862
+ Xt = !0;
863
863
  try {
864
864
  const a = await t.billingStatusLoader();
865
865
  if (Y)
866
866
  return;
867
- Ao(
867
+ Io(
868
868
  t.billingStatus,
869
869
  a,
870
- b.getState().lastErrorCode
871
- ) && (t.billingStatus = a, A(b.getState().lastErrorCode), V());
870
+ _.getState().lastErrorCode
871
+ ) && (t.billingStatus = a, A(_.getState().lastErrorCode), V());
872
872
  } catch (a) {
873
873
  J(
874
874
  "web-sdk.widget",
@@ -876,21 +876,21 @@ async function ja(e = {}) {
876
876
  { message: a instanceof Error ? a.message : String(a) }
877
877
  );
878
878
  } finally {
879
- Kt = !1;
879
+ Xt = !1;
880
880
  }
881
881
  }
882
882
  }, _e = (a = "", s = !0, m = !0) => {
883
- Vn(), dt && (dt = !1, Qt()), o.classList.contains("pluno-pa-widget--open") || (h = null), ie !== null && (window.clearTimeout(ie), ie = null), at("shown", !1), w.hidden = !1, L.hidden = !1, bn(
883
+ Kn(), dt && (dt = !1, tn()), o.classList.contains("pluno-pa-widget--open") || (h = null), ie !== null && (window.clearTimeout(ie), ie = null), at("shown", !1), w.hidden = !1, L.hidden = !1, _n(
884
884
  R,
885
- Vt()
885
+ Yt()
886
886
  ), o.classList.remove("pluno-pa-widget--closing");
887
- const S = rt(), k = mn(
887
+ const S = rt(), k = fn(
888
888
  o,
889
889
  S,
890
890
  t.position,
891
891
  g
892
892
  );
893
- if (jt(k, S), We("Opening launcher at clamped open panel position", {
893
+ if (Kt(k, S), We("Opening launcher at clamped open panel position", {
894
894
  openPanelPosition: k,
895
895
  visibleLauncherPosition: S
896
896
  }), ae(!0, "open"), re(), !s) {
@@ -902,7 +902,7 @@ async function ja(e = {}) {
902
902
  y.hidden = !0, mt(z, () => Be.enabled), Fe = z.scrollTop;
903
903
  }, 220);
904
904
  });
905
- }, Yt = () => {
905
+ }, Zt = () => {
906
906
  ie !== null && (window.clearTimeout(ie), ie = null), y.hidden = !1, d && (rt(!1), We("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), W(), t.onPanelOpenChange?.(!1), ie = window.setTimeout(() => {
907
907
  w.hidden = !0, L.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
908
908
  }, 220);
@@ -914,17 +914,17 @@ async function ja(e = {}) {
914
914
  }), y.addEventListener("click", (a) => {
915
915
  a.target === u && !U || (_e(u.value), u.value = "");
916
916
  });
917
- const Kn = () => {
917
+ const Yn = () => {
918
918
  _e(u.value), u.value = "";
919
919
  };
920
- u.addEventListener("focus", Kn), u.addEventListener("input", () => {
920
+ u.addEventListener("focus", Yn), u.addEventListener("input", () => {
921
921
  if (!u.value)
922
922
  return;
923
923
  const a = u.value;
924
924
  _e(a), u.value = "";
925
925
  });
926
926
  let lt = null, Pe = null, vt = null, He = null, se = null, q = null;
927
- const St = (a) => a === u || a === v, Yn = (a) => a.composedPath().find(St) ?? null, Ci = (a) => {
927
+ const St = (a) => a === u || a === v, Xn = (a) => a.composedPath().find(St) ?? null, ki = (a) => {
928
928
  let s = a;
929
929
  for (; s; ) {
930
930
  if (s.assignedSlot)
@@ -932,15 +932,15 @@ async function ja(e = {}) {
932
932
  s = s.parentElement;
933
933
  }
934
934
  return null;
935
- }, Xt = (a) => {
935
+ }, Jt = (a) => {
936
936
  if (!(a instanceof Element) || a.getRootNode() === o.getRootNode())
937
937
  return null;
938
938
  let s = a;
939
939
  for (; s; ) {
940
- const m = s.closest(ho);
940
+ const m = s.closest(mo);
941
941
  if (m)
942
942
  return m;
943
- const S = Ci(s);
943
+ const S = ki(s);
944
944
  if (S) {
945
945
  s = S;
946
946
  continue;
@@ -949,13 +949,13 @@ async function ja(e = {}) {
949
949
  s = k instanceof ShadowRoot ? k.host : null;
950
950
  }
951
951
  return null;
952
- }, Zt = () => {
953
- let a = x.activeElement;
952
+ }, Qt = () => {
953
+ let a = b.activeElement;
954
954
  for (; a?.shadowRoot?.activeElement; )
955
955
  a = a.shadowRoot.activeElement;
956
956
  return a;
957
- }, Ei = (a) => {
958
- if (!a.isConnected || !a.matches(ho))
957
+ }, Li = (a) => {
958
+ if (!a.isConnected || !a.matches(mo))
959
959
  return !1;
960
960
  if (!(a instanceof HTMLElement))
961
961
  return !0;
@@ -965,56 +965,56 @@ async function ja(e = {}) {
965
965
  return a.checkVisibility();
966
966
  const s = window.getComputedStyle(a);
967
967
  return s.display !== "none" && s.visibility !== "hidden";
968
- }, Jt = (a, s) => {
968
+ }, en = (a, s) => {
969
969
  s && (se !== null && window.clearTimeout(se), se = window.setTimeout(() => {
970
970
  se = null, xe === a && s.isConnected && s.focus({ preventScroll: !0 });
971
971
  }, 0));
972
972
  }, pt = (a, s = null) => {
973
973
  if (xe === a) {
974
- a && Jt(a, s);
974
+ a && en(a, s);
975
975
  return;
976
976
  }
977
- xe = a, a !== null ? (Jt(a, s), He = window.setInterval(() => {
977
+ xe = a, a !== null ? (en(a, s), He = window.setInterval(() => {
978
978
  const m = xe;
979
- if (!m || !Ei(m)) {
979
+ if (!m || !Li(m)) {
980
980
  pt(null);
981
981
  return;
982
982
  }
983
- Jt(m, null);
984
- }, Pa)) : (He !== null && (window.clearInterval(He), He = null), se !== null && (window.clearTimeout(se), se = null), vt = null);
985
- }, ki = () => {
983
+ en(m, null);
984
+ }, Ia)) : (He !== null && (window.clearInterval(He), He = null), se !== null && (window.clearTimeout(se), se = null), vt = null);
985
+ }, Ti = () => {
986
986
  He !== null && (window.clearInterval(He), He = null), se !== null && (window.clearTimeout(se), se = null), q !== null && (window.clearTimeout(q), q = null);
987
- }, Xn = (a) => {
988
- const s = Yn(a);
987
+ }, Zn = (a) => {
988
+ const s = Xn(a);
989
989
  if (!s)
990
990
  return;
991
991
  const m = Date.now();
992
992
  Pe = m, lt = m, q !== null && window.clearTimeout(q);
993
- const S = xe ?? Xt(Zt());
993
+ const S = xe ?? Jt(Qt());
994
994
  S && (pt(S, s), a.stopImmediatePropagation()), q = window.setTimeout(() => {
995
995
  if (q = null, Pe !== m)
996
996
  return;
997
- const k = Zt();
997
+ const k = Qt();
998
998
  if (k === s) {
999
999
  Pe = null;
1000
1000
  return;
1001
1001
  }
1002
- const Ae = Xt(k);
1002
+ const Ae = Jt(k);
1003
1003
  Ae && pt(Ae, s);
1004
1004
  }, 0);
1005
1005
  }, Ct = (a) => {
1006
- const s = Yn(a);
1007
- s && (lt = Date.now(), xe !== null && (a.stopImmediatePropagation(), Pe = null, q !== null && (window.clearTimeout(q), q = null), W(), a.type === "focus" && s === u && Kn()));
1006
+ const s = Xn(a);
1007
+ s && (lt = Date.now(), xe !== null && (a.stopImmediatePropagation(), Pe = null, q !== null && (window.clearTimeout(q), q = null), W(), a.type === "focus" && s === u && Yn()));
1008
1008
  };
1009
- x.defaultView?.addEventListener(
1009
+ b.defaultView?.addEventListener(
1010
1010
  "pointerdown",
1011
- Xn,
1011
+ Zn,
1012
1012
  !0
1013
- ), x.defaultView?.addEventListener(
1013
+ ), b.defaultView?.addEventListener(
1014
1014
  "focus",
1015
1015
  Ct,
1016
1016
  !0
1017
- ), x.defaultView?.addEventListener(
1017
+ ), b.defaultView?.addEventListener(
1018
1018
  "focusin",
1019
1019
  Ct,
1020
1020
  !0
@@ -1026,21 +1026,21 @@ async function ja(e = {}) {
1026
1026
  if (!St(a.target) || xe !== null)
1027
1027
  return;
1028
1028
  const s = lt;
1029
- if (lt = null, s === null || Date.now() - s > mo)
1029
+ if (lt = null, s === null || Date.now() - s > fo)
1030
1030
  return;
1031
- const m = a.target, S = Pe !== null && Date.now() - Pe <= mo;
1031
+ const m = a.target, S = Pe !== null && Date.now() - Pe <= fo;
1032
1032
  Pe = null, q !== null && (window.clearTimeout(q), q = null);
1033
1033
  const k = (Ae) => {
1034
- const dn = Xt(Ae);
1035
- if (!dn)
1034
+ const cn = Jt(Ae);
1035
+ if (!cn)
1036
1036
  return !1;
1037
1037
  if (S)
1038
- return pt(dn, m), !0;
1039
- const oo = Date.now();
1040
- return vt !== null && oo - vt <= Ta ? (pt(dn, m), !0) : (vt = oo, !0);
1038
+ return pt(cn, m), !0;
1039
+ const io = Date.now();
1040
+ return vt !== null && io - vt <= Aa ? (pt(cn, m), !0) : (vt = io, !0);
1041
1041
  };
1042
1042
  k(a.relatedTarget) || window.setTimeout(() => {
1043
- xe === null && m.isConnected && k(Zt());
1043
+ xe === null && m.isConnected && k(Qt());
1044
1044
  }, 0);
1045
1045
  }), y.addEventListener("keydown", (a) => {
1046
1046
  !o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), _e());
@@ -1048,37 +1048,37 @@ async function ja(e = {}) {
1048
1048
  a.stopPropagation();
1049
1049
  }), H?.addEventListener("click", (a) => {
1050
1050
  a.preventDefault(), a.stopPropagation(), at("minimized");
1051
- }), L.addEventListener("click", Yt), z.addEventListener("scroll", () => {
1051
+ }), L.addEventListener("click", Zt), z.addEventListener("scroll", () => {
1052
1052
  z.scrollTop < Fe - 1 && ae(!1, "userScroll"), Fe = z.scrollTop;
1053
1053
  }), he.addEventListener("click", () => {
1054
- _i();
1054
+ yi();
1055
1055
  });
1056
- const Zn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
1056
+ const Jn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
1057
1057
  ([a]) => {
1058
1058
  a?.isIntersecting && (ae(!0, "bottom"), re());
1059
1059
  },
1060
1060
  { root: z, threshold: 0 }
1061
1061
  );
1062
- Zn?.observe(tt);
1062
+ Jn?.observe(tt);
1063
1063
  const st = () => t.loginRequired || t.signupRequired;
1064
1064
  let xe = null, dt = !1;
1065
- const le = () => xt || b.getState().status !== "connected", Ve = () => {
1065
+ const le = () => xt || _.getState().status !== "connected", Ve = () => {
1066
1066
  const a = st();
1067
1067
  u.readOnly = !1, v.readOnly = !1, u.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : dt ? "New update" : t.launcherLabel, v.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Se.launcherLabel, ne.hidden = a;
1068
1068
  }, V = () => {
1069
- F.disabled = le() || pe(t.billingStatus) || !b.getState().isThinking && v.value.trim().length === 0 && M.length === 0, B.disabled = st() || le() || pe(t.billingStatus);
1069
+ F.disabled = le() || pe(t.billingStatus) || !_.getState().isThinking && v.value.trim().length === 0 && M.length === 0, B.disabled = st() || le() || pe(t.billingStatus);
1070
1070
  };
1071
1071
  Ve();
1072
- const Qt = () => {
1073
- const a = b.getState().isThinking;
1072
+ const tn = () => {
1073
+ const a = _.getState().isThinking;
1074
1074
  o.classList.toggle("pluno-pa-widget--thinking", a), o.classList.toggle(
1075
1075
  "pluno-pa-widget--unread",
1076
1076
  !a && dt
1077
1077
  ), Ve();
1078
1078
  };
1079
- Qt();
1080
- const en = () => {
1081
- st() || Y || (xt = !0, Ve(), V(), b.connect().then(
1079
+ tn();
1080
+ const nn = () => {
1081
+ st() || Y || (xt = !0, Ve(), V(), _.connect().then(
1082
1082
  () => {
1083
1083
  Y || (xt = !1, Ve(), V());
1084
1084
  },
@@ -1102,56 +1102,56 @@ async function ja(e = {}) {
1102
1102
  t.onSignupClick?.();
1103
1103
  return;
1104
1104
  }
1105
- le() || pe(t.billingStatus) || (Le = !0, ae(!0, "send"), re(), M = wn(
1106
- b,
1105
+ le() || pe(t.billingStatus) || (Le = !0, ae(!0, "send"), re(), M = bn(
1106
+ _,
1107
1107
  v,
1108
1108
  M,
1109
- It
1109
+ Rt
1110
1110
  ), je(), V());
1111
1111
  });
1112
1112
  let ct = 0;
1113
- const Li = () => {
1113
+ const Pi = () => {
1114
1114
  ct = 0, o.classList.remove("pluno-pa-widget--drag-over");
1115
- }, tn = (a) => {
1115
+ }, on = (a) => {
1116
1116
  fe !== null && window.clearTimeout(fe), $.textContent = a, $.hidden = !1, fe = window.setTimeout(() => {
1117
1117
  $.textContent = "", $.hidden = !0, fe = null;
1118
1118
  }, 3e3);
1119
- }, Ti = () => {
1119
+ }, Ai = () => {
1120
1120
  fe !== null && (window.clearTimeout(fe), fe = null), $.textContent = "", $.hidden = !0;
1121
- }, nn = async (a) => {
1121
+ }, an = async (a) => {
1122
1122
  if (!t.attachmentsEnabled || a.length === 0)
1123
1123
  return;
1124
- const s = Dr(b, a);
1125
- if (M = [...M, ...s], je(), Ti(), V(), O(b.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1124
+ const s = Ur(_, a);
1125
+ if (M = [...M, ...s], je(), Ai(), V(), O(_.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1126
1126
  _e();
1127
1127
  return;
1128
1128
  }
1129
1129
  ke();
1130
- }, Pi = async (a) => {
1131
- await nn(a), !(a.length === 0 || xe !== null) && v.focus();
1130
+ }, Ii = async (a) => {
1131
+ await an(a), !(a.length === 0 || xe !== null) && v.focus();
1132
1132
  };
1133
1133
  B.addEventListener("click", () => {
1134
1134
  t.loginRequired || le() || pe(t.billingStatus) || ge.click();
1135
1135
  }), ge.addEventListener("change", () => {
1136
1136
  const a = Array.from(ge.files ?? []);
1137
- ge.value = "", Pi(a).catch((s) => {
1138
- tn(
1137
+ ge.value = "", Ii(a).catch((s) => {
1138
+ on(
1139
1139
  s instanceof Error ? s.message : "Failed to attach file"
1140
1140
  ), J("web-sdk.widget", "Attachment failed", {
1141
1141
  message: s instanceof Error ? s.message : String(s)
1142
1142
  });
1143
1143
  });
1144
1144
  }), o.addEventListener("dragenter", (a) => {
1145
- !t.attachmentsEnabled || !Nt(a.dataTransfer) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), ct += 1, o.classList.add("pluno-pa-widget--drag-over"));
1145
+ !t.attachmentsEnabled || !zt(a.dataTransfer) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), ct += 1, o.classList.add("pluno-pa-widget--drag-over"));
1146
1146
  }), o.addEventListener("dragover", (a) => {
1147
1147
  const s = a.dataTransfer;
1148
- !t.attachmentsEnabled || !Nt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
1148
+ !t.attachmentsEnabled || !zt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
1149
1149
  }), o.addEventListener("dragleave", (a) => {
1150
- Nt(a.dataTransfer) && (a.stopPropagation(), ct = Math.max(0, ct - 1), ct === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1150
+ zt(a.dataTransfer) && (a.stopPropagation(), ct = Math.max(0, ct - 1), ct === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1151
1151
  }), o.addEventListener("drop", (a) => {
1152
1152
  const s = a.dataTransfer;
1153
- !t.attachmentsEnabled || !Nt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), Li(), nn(s.files).catch((m) => {
1154
- tn(
1153
+ !t.attachmentsEnabled || !zt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), Pi(), an(s.files).catch((m) => {
1154
+ on(
1155
1155
  m instanceof Error ? m.message : "Failed to attach file"
1156
1156
  ), J("web-sdk.widget", "Attachment failed", {
1157
1157
  message: m instanceof Error ? m.message : String(m)
@@ -1160,8 +1160,8 @@ async function ja(e = {}) {
1160
1160
  }), o.addEventListener("paste", (a) => {
1161
1161
  a.stopPropagation();
1162
1162
  const s = a.clipboardData, m = Array.from(s?.files ?? []);
1163
- !t.attachmentsEnabled || m.length === 0 || t.loginRequired || le() || (a.preventDefault(), nn(m).catch((S) => {
1164
- tn(
1163
+ !t.attachmentsEnabled || m.length === 0 || t.loginRequired || le() || (a.preventDefault(), an(m).catch((S) => {
1164
+ on(
1165
1165
  S instanceof Error ? S.message : "Failed to attach file"
1166
1166
  ), J("web-sdk.widget", "Attachment failed", {
1167
1167
  message: S instanceof Error ? S.message : String(S)
@@ -1172,43 +1172,43 @@ async function ja(e = {}) {
1172
1172
  t.onLoginClick?.();
1173
1173
  return;
1174
1174
  }
1175
- if (b.getState().isThinking) {
1176
- b.stop();
1175
+ if (_.getState().isThinking) {
1176
+ _.stop();
1177
1177
  return;
1178
1178
  }
1179
1179
  if (le())
1180
1180
  return;
1181
1181
  const a = v.value.trim().length > 0 || M.length > 0;
1182
- Le = !0, ae(!0, "send"), re(), M = wn(
1183
- b,
1182
+ Le = !0, ae(!0, "send"), re(), M = bn(
1183
+ _,
1184
1184
  v,
1185
1185
  M,
1186
- It
1187
- ), je(), V(), O(b.getState()), a && ke();
1186
+ Rt
1187
+ ), je(), V(), O(_.getState()), a && ke();
1188
1188
  }), Z.addEventListener("click", () => {
1189
- X = !X, ot = null, be(), X && Te.length === 0 && Hn(null), X || ke();
1189
+ X = !X, ot = null, be(), X && Te.length === 0 && $n(null), X || ke();
1190
1190
  }), _t.addEventListener("click", () => {
1191
1191
  X = !1, be(), ke();
1192
- }), K.addEventListener("scroll", xi), v.addEventListener("input", () => {
1193
- ht(v), W(), V(), Ni();
1192
+ }), K.addEventListener("scroll", vi), v.addEventListener("input", () => {
1193
+ ht(v), W(), V(), zi();
1194
1194
  }), v.addEventListener("keydown", (a) => {
1195
1195
  if (!(a.key !== "Enter" || a.shiftKey)) {
1196
1196
  if (a.preventDefault(), t.loginRequired) {
1197
1197
  t.onLoginClick?.();
1198
1198
  return;
1199
1199
  }
1200
- le() || (Le = !0, ae(!0, "send"), re(), M = wn(
1201
- b,
1200
+ le() || (Le = !0, ae(!0, "send"), re(), M = bn(
1201
+ _,
1202
1202
  v,
1203
1203
  M,
1204
- It
1205
- ), je(), V(), O(b.getState()));
1204
+ Rt
1205
+ ), je(), V(), O(_.getState()));
1206
1206
  }
1207
1207
  }), o.addEventListener("click", (a) => {
1208
1208
  const s = a.target instanceof Element ? a.target : null;
1209
- s?.closest("a[href]") && W(), X && la(s, ze, Z) && (X = !1, be());
1209
+ s?.closest("a[href]") && W(), X && sa(s, ze, Z) && (X = !1, be());
1210
1210
  const S = window.getSelection(), k = !!(S && !S.isCollapsed && S.anchorNode && o.contains(S.anchorNode));
1211
- aa(a.target, a.detail, k) && ke();
1211
+ la(a.target, a.detail, k) && ke();
1212
1212
  }), o.addEventListener("copy", (a) => {
1213
1213
  a.clipboardData && window.getSelection() && !window.getSelection()?.isCollapsed && window.getSelection()?.anchorNode && window.getSelection()?.focusNode && o.contains(window.getSelection()?.anchorNode ?? null) && o.contains(window.getSelection()?.focusNode ?? null) && window.getSelection()?.toString() && (a.clipboardData.clearData(), a.clipboardData.setData(
1214
1214
  "text/plain",
@@ -1227,17 +1227,20 @@ async function ja(e = {}) {
1227
1227
  return;
1228
1228
  }
1229
1229
  a.key !== "Escape" || !X || (X = !1, be(), ke());
1230
- }), l.composerValue && (v.value = l.composerValue, ht(v)), t.layout === "page" ? _e(v.value, !1) : p === "minimized" ? at("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && _e(v.value, !1, !1), lr(l, o, u, v);
1230
+ }), l.composerValue && (v.value = l.composerValue, ht(v)), t.layout === "page" ? _e(v.value, !1) : p === "minimized" ? at("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && _e(v.value, !1, !1), sr(l, o, u, v);
1231
1231
  const Et = () => r;
1232
- let on = b.getState().appearance !== null, kt = null, ut = null, Jn = b.getState().isThinking, Ke = null;
1232
+ let rn = _.getState().appearance !== null, kt = null, ut = null, Qn = _.getState().isThinking, Ke = null;
1233
1233
  const gt = t.taskNotifications;
1234
1234
  let Ye = null, Xe = !1;
1235
- const Qn = () => {
1235
+ const eo = () => {
1236
1236
  Ye !== null && (window.clearTimeout(Ye), Ye = null);
1237
1237
  }, Lt = () => {
1238
1238
  De && (De.hidden = !0);
1239
- }, eo = () => b.getState().assistantDraft.trim().length > 0, Ai = async () => {
1240
- if (!gt || !De || Xe || Y || !b.getState().isThinking || eo())
1239
+ }, Tt = () => {
1240
+ const a = _.getState();
1241
+ return a.assistantDraft.trim().length > 0 && a.assistantDraftPhase !== "commentary";
1242
+ }, Ni = async () => {
1243
+ if (!gt || !De || Xe || Y || !_.getState().isThinking || Tt())
1241
1244
  return;
1242
1245
  let a;
1243
1246
  try {
@@ -1245,7 +1248,7 @@ async function ja(e = {}) {
1245
1248
  } catch {
1246
1249
  return;
1247
1250
  }
1248
- a.enabled || a.neverSuggest || !b.getState().isThinking || eo() || Xe || Y || (De.hidden = !1);
1251
+ a.enabled || a.neverSuggest || !_.getState().isThinking || Tt() || Xe || Y || (De.hidden = !1);
1249
1252
  };
1250
1253
  Oe?.addEventListener("click", () => {
1251
1254
  Xe = !0, Lt(), gt?.enable().catch(() => {
@@ -1256,35 +1259,35 @@ async function ja(e = {}) {
1256
1259
  Xe = !0, Lt(), gt?.dismissForever().catch(() => {
1257
1260
  });
1258
1261
  });
1259
- const Tt = t.tabGroups;
1262
+ const Pt = t.tabGroups;
1260
1263
  let Ze = !1;
1261
- const Pt = async () => {
1262
- if (!Tt || !I || Ze || Y)
1264
+ const At = async () => {
1265
+ if (!Pt || !I || Ze || Y)
1263
1266
  return;
1264
- const a = await Tt.getState().catch(() => null);
1267
+ const a = await Pt.getState().catch(() => null);
1265
1268
  !a || Ze || Y || (I.hidden = !a.permissionNeeded);
1266
1269
  };
1267
1270
  Ee?.addEventListener("click", () => {
1268
- Ze = !0, I && (I.hidden = !0), Tt?.enable().catch(() => {
1271
+ Ze = !0, I && (I.hidden = !0), Pt?.enable().catch(() => {
1269
1272
  }).finally(() => {
1270
- Ze = !1, Pt();
1273
+ Ze = !1, At();
1271
1274
  });
1272
1275
  }), oe?.addEventListener("click", () => {
1273
- Ze = !0, I && (I.hidden = !0), Tt?.dismiss().catch(() => {
1276
+ Ze = !0, I && (I.hidden = !0), Pt?.dismiss().catch(() => {
1274
1277
  }).finally(() => {
1275
- Ze = !1, Pt();
1278
+ Ze = !1, At();
1276
1279
  });
1277
- }), Pt();
1280
+ }), At();
1278
1281
  let Je = null, to = () => {
1279
1282
  };
1280
- const Ii = !!(t.sdkPreviewChannelId && t.referralLinkLoader), an = /* @__PURE__ */ new Map(), rn = () => v.value.trim().length > 0 || M.length > 0, Ni = () => {
1281
- const a = Je !== null && xn(b.getState(), rn());
1282
- me.hidden = !a, a && Je !== null && ei(me, Je);
1283
+ const Ri = !!(t.sdkPreviewChannelId && t.referralLinkLoader), It = /* @__PURE__ */ new Map(), ln = () => v.value.trim().length > 0 || M.length > 0, zi = () => {
1284
+ const a = Je !== null && yn(_.getState(), ln());
1285
+ me.hidden = !a, a && Je !== null && ni(me, Je);
1283
1286
  };
1284
1287
  let Qe = null;
1285
- const ye = /* @__PURE__ */ new Map(), At = /* @__PURE__ */ new Set(), Ri = async (a) => {
1288
+ const ye = /* @__PURE__ */ new Map(), Nt = /* @__PURE__ */ new Set(), Mi = async (a) => {
1286
1289
  if (t.integrationAuthHandler) {
1287
- ye.set(a.authRequestId, { status: "connecting" }), O(b.getState());
1290
+ ye.set(a.authRequestId, { status: "connecting" }), O(_.getState());
1288
1291
  try {
1289
1292
  await t.integrationAuthHandler(a), ye.set(a.authRequestId, { status: "completed" });
1290
1293
  } catch (s) {
@@ -1293,29 +1296,29 @@ async function ja(e = {}) {
1293
1296
  error: s instanceof Error ? s.message : `Could not connect ${a.appName}.`
1294
1297
  });
1295
1298
  }
1296
- O(b.getState());
1299
+ O(_.getState());
1297
1300
  }
1298
- }, ln = (a = {}) => {
1299
- Le = !0, ae(!0, "newSession"), re(), X = !1, be(), b.startNewSession(a), $t.clear(), ye.clear(), At.clear(), v.value = "", M = [], je(), ht(v), W(), V(), v.focus(), O(b.getState());
1300
- }, It = () => {
1301
- t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), ln());
1302
- }, pn = (a) => {
1301
+ }, pn = (a = {}) => {
1302
+ Le = !0, ae(!0, "newSession"), re(), X = !1, be(), _.startNewSession(a), qt.clear(), ye.clear(), Nt.clear(), v.value = "", M = [], je(), ht(v), W(), V(), v.focus(), O(_.getState());
1303
+ }, Rt = () => {
1304
+ t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), pn());
1305
+ }, sn = (a) => {
1303
1306
  if (!a || t.layout === "page") {
1304
1307
  Qe?.remove(), Qe = null;
1305
1308
  return;
1306
1309
  }
1307
- Qe || (Qe = Wt(
1310
+ Qe || (Qe = $t(
1308
1311
  "pluno-pa-widget__new-chat",
1309
1312
  "New chat",
1310
- kr(),
1313
+ Tr(),
1311
1314
  !1
1312
- ), Qe.addEventListener("click", () => ln()), j.insertBefore(Qe, Z));
1315
+ ), Qe.addEventListener("click", () => pn()), j.insertBefore(Qe, Z));
1313
1316
  }, O = (a) => {
1314
- if (be(), Un(a.lastErrorCode) ? Ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (Ke = null), A(Ke), t.loginRequired) {
1315
- an.clear(), Ro(
1317
+ if (be(), Bn(a.lastErrorCode) ? Ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (Ke = null), A(Ke), t.loginRequired) {
1318
+ It.clear(), Mo(
1316
1319
  z,
1317
1320
  F,
1318
- pn,
1321
+ sn,
1319
1322
  Et,
1320
1323
  "Log in to use Pluno on this page.",
1321
1324
  t.loginButtonLabel,
@@ -1325,10 +1328,10 @@ async function ja(e = {}) {
1325
1328
  return;
1326
1329
  }
1327
1330
  if (t.signupRequired) {
1328
- an.clear(), Ro(
1331
+ It.clear(), Mo(
1329
1332
  z,
1330
1333
  F,
1331
- pn,
1334
+ sn,
1332
1335
  Et,
1333
1336
  "Complete signup to unlock your free trial credits.",
1334
1337
  t.signupButtonLabel,
@@ -1337,44 +1340,44 @@ async function ja(e = {}) {
1337
1340
  );
1338
1341
  return;
1339
1342
  }
1340
- const s = sr(a), m = s !== Wn;
1341
- Wn = s;
1343
+ const s = cr(a), m = s !== Hn;
1344
+ Hn = s;
1342
1345
  const S = Le || Be.enabled;
1343
- Le = !1, Gr(
1346
+ Le = !1, jr(
1344
1347
  z,
1345
1348
  tt,
1346
1349
  F,
1347
- pn,
1350
+ sn,
1348
1351
  me,
1349
1352
  a,
1350
1353
  Je,
1351
- Je !== null && xn(a, rn()),
1354
+ Je !== null && yn(a, ln()),
1352
1355
  S,
1353
1356
  () => Be.enabled,
1354
- $t,
1355
- an,
1357
+ qt,
1358
+ It,
1356
1359
  W,
1357
1360
  Et,
1358
1361
  (k) => {
1359
- le() || (It(), Le = !0, ae(!0, "send"), re(), b.sendMessage(k));
1362
+ le() || (Rt(), Le = !0, ae(!0, "send"), re(), _.sendMessage(k));
1360
1363
  },
1361
1364
  () => {
1362
- Le = !0, ae(!0, "send"), re(), b.retryLastMessage();
1365
+ Le = !0, ae(!0, "send"), re(), _.retryLastMessage();
1363
1366
  },
1364
1367
  t.morningReport,
1365
1368
  () => {
1366
- t.morningReport = null, t.onMorningReportSnooze?.(), Yt(), O(b.getState());
1369
+ t.morningReport = null, t.onMorningReportSnooze?.(), Zt(), O(_.getState());
1367
1370
  },
1368
- en,
1371
+ nn,
1369
1372
  t.attachmentPreviewUrlResolver,
1370
1373
  t.integrationAuthHandler ? {
1371
1374
  states: ye,
1372
1375
  initialStatus: t.integrationAuthStatusLoader ? "checking" : "pending",
1373
1376
  onConnect: (k) => {
1374
- Ri(k);
1377
+ Mi(k);
1375
1378
  }
1376
1379
  } : void 0,
1377
- Ii && !Gt ? {
1380
+ Ri && !jt ? {
1378
1381
  dismissedCandidateIds: nt,
1379
1382
  actionCandidate: kt,
1380
1383
  error: ut,
@@ -1384,20 +1387,27 @@ async function ja(e = {}) {
1384
1387
  Ue.add(k.id), W();
1385
1388
  },
1386
1389
  onReferralCopy: (k) => {
1387
- zi(k);
1390
+ Di(k);
1388
1391
  },
1389
1392
  onSocialShare: (k) => {
1390
1393
  Ue.add(k.id), nt.add(k.id), W();
1391
1394
  },
1392
1395
  onDismiss: (k) => {
1393
- Ue.add(k.id), nt.add(k.id), W(), ut = null, O(b.getState());
1396
+ Ue.add(k.id), nt.add(k.id), W(), ut = null, O(_.getState());
1394
1397
  },
1395
1398
  onDisable: (k) => {
1396
- Gt = !0, Ue.add(k.id), nt.add(k.id), W(), xl(t, !0), ut = null, O(b.getState());
1399
+ jt = !0, Ue.add(k.id), nt.add(k.id), W(), El(t, !0), ut = null, O(_.getState());
1397
1400
  }
1398
1401
  } : void 0
1399
- ), S ? (Fe = z.scrollTop, re()) : m && dr(a) && bi();
1400
- }, no = async (a) => {
1402
+ ), S ? (Fe = z.scrollTop, re()) : m && ur(a) && xi();
1403
+ }, no = () => {
1404
+ b.getSelection()?.isCollapsed !== !1 && Jr(It) && O(_.getState());
1405
+ };
1406
+ b.addEventListener(
1407
+ "selectionchange",
1408
+ no
1409
+ );
1410
+ const oo = async (a) => {
1401
1411
  if (!t.integrationAuthStatusLoader)
1402
1412
  return;
1403
1413
  const s = a.messages.map((m) => m.integrationAuthRequest).filter(
@@ -1405,10 +1415,10 @@ async function ja(e = {}) {
1405
1415
  );
1406
1416
  await Promise.all(
1407
1417
  s.map(async (m) => {
1408
- if (!(ye.has(m.authRequestId) || At.has(m.authRequestId))) {
1409
- At.add(m.authRequestId), ye.set(m.authRequestId, {
1418
+ if (!(ye.has(m.authRequestId) || Nt.has(m.authRequestId))) {
1419
+ Nt.add(m.authRequestId), ye.set(m.authRequestId, {
1410
1420
  status: "checking"
1411
- }), O(b.getState());
1421
+ }), O(_.getState());
1412
1422
  try {
1413
1423
  const S = await t.integrationAuthStatusLoader(m);
1414
1424
  ye.set(m.authRequestId, { status: S });
@@ -1418,34 +1428,34 @@ async function ja(e = {}) {
1418
1428
  error: S instanceof Error ? S.message : `Could not load ${m.appName} connection status.`
1419
1429
  });
1420
1430
  } finally {
1421
- At.delete(m.authRequestId);
1431
+ Nt.delete(m.authRequestId);
1422
1432
  }
1423
- Y || O(b.getState());
1433
+ Y || O(_.getState());
1424
1434
  }
1425
1435
  })
1426
1436
  );
1427
1437
  };
1428
- return to = Qi(
1438
+ return to = ta(
1429
1439
  (a) => {
1430
- Je = a, !Y && xn(b.getState(), rn()) && O(b.getState());
1440
+ Je = a, !Y && yn(_.getState(), ln()) && O(_.getState());
1431
1441
  },
1432
1442
  {
1433
1443
  backendUrl: t.backendUrl,
1434
- fetcher: wi,
1444
+ fetcher: _i,
1435
1445
  loader: t.activeUsersLoader
1436
1446
  }
1437
- ), b.on("state", (a) => {
1438
- Pt();
1439
- const s = Jn && !a.isThinking;
1440
- Jn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && gt && !Xe && Ye === null && De?.hidden !== !1 && (Ye = window.setTimeout(() => {
1441
- Ye = null, Ai();
1442
- }, ga)), (!a.isThinking || a.assistantDraft.trim()) && (Qn(), Lt()), s && !o.classList.contains("pluno-pa-widget--open") && (dt = !0), Qt(), a.appearance ? (on = !0, J(
1447
+ ), _.on("state", (a) => {
1448
+ At();
1449
+ const s = Qn && !a.isThinking;
1450
+ Qn = a.isThinking, a.isThinking && !Tt() && gt && !Xe && Ye === null && De?.hidden !== !1 && (Ye = window.setTimeout(() => {
1451
+ Ye = null, Ni();
1452
+ }, ma)), (!a.isThinking || Tt()) && (eo(), Lt()), s && !o.classList.contains("pluno-pa-widget--open") && (dt = !0), tn(), a.appearance ? (rn = !0, J(
1443
1453
  "web-sdk.widget",
1444
1454
  "Agent state supplied appearance",
1445
1455
  {
1446
1456
  appearance: a.appearance
1447
1457
  }
1448
- ), sn(a.appearance, "agent.state.appearance")) : on && (on = !1, J(
1458
+ ), dn(a.appearance, "agent.state.appearance")) : rn && (rn = !1, J(
1449
1459
  "web-sdk.widget",
1450
1460
  "Agent state cleared appearance; reverting to configured widget options",
1451
1461
  {
@@ -1453,17 +1463,17 @@ async function ja(e = {}) {
1453
1463
  fallbackColorScheme: t.colorScheme,
1454
1464
  fallbackFontFamily: t.fontFamily
1455
1465
  }
1456
- ), sn({}, "agent.state.appearance-cleared")), O(a), no(a), V(), s && Vn();
1457
- }), O(b.getState()), no(b.getState()), V(), en(), {
1458
- agent: b,
1459
- startNewChat: ln,
1466
+ ), dn({}, "agent.state.appearance-cleared")), O(a), oo(a), V(), s && Kn();
1467
+ }), O(_.getState()), oo(_.getState()), V(), nn(), {
1468
+ agent: _,
1469
+ startNewChat: pn,
1460
1470
  host: n,
1461
1471
  updateAppearance: (a) => {
1462
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), sn(a, "widgetHandle.updateAppearance");
1472
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), dn(a, "widgetHandle.updateAppearance");
1463
1473
  },
1464
1474
  updateBillingStatus: (a) => {
1465
1475
  const s = a ?? null;
1466
- Ao(
1476
+ Io(
1467
1477
  t.billingStatus,
1468
1478
  s,
1469
1479
  Ke
@@ -1471,13 +1481,13 @@ async function ja(e = {}) {
1471
1481
  },
1472
1482
  updateAuthGate: (a) => {
1473
1483
  const s = st();
1474
- 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), Ve(), O(b.getState()), V(), s && !st() && en();
1484
+ 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), Ve(), O(_.getState()), V(), s && !st() && nn();
1475
1485
  },
1476
1486
  openPanel: (a) => {
1477
1487
  const s = typeof a == "string" ? a : v.value, m = typeof a == "object" ? a.focusComposer !== !1 : !0;
1478
1488
  _e(s, !1, m);
1479
1489
  },
1480
- closePanel: Yt,
1490
+ closePanel: Zt,
1481
1491
  updateDisplayState: (a) => {
1482
1492
  if (a === "shown") {
1483
1493
  at("shown", !1);
@@ -1486,42 +1496,45 @@ async function ja(e = {}) {
1486
1496
  at("minimized", !1);
1487
1497
  },
1488
1498
  updateMorningReport: (a) => {
1489
- t.morningReport = a ?? null, O(b.getState());
1499
+ t.morningReport = a ?? null, O(_.getState());
1490
1500
  },
1491
1501
  destroy: () => {
1492
- Y || (W(), Y = !0, Gn.disconnect(), Zn?.disconnect(), ki(), x.defaultView?.removeEventListener(
1502
+ Y || (W(), Y = !0, qn.disconnect(), b.removeEventListener(
1503
+ "selectionchange",
1504
+ no
1505
+ ), Jn?.disconnect(), Ti(), b.defaultView?.removeEventListener(
1493
1506
  "pointerdown",
1494
- Xn,
1507
+ Zn,
1495
1508
  !0
1496
- ), x.defaultView?.removeEventListener(
1509
+ ), b.defaultView?.removeEventListener(
1497
1510
  "focus",
1498
1511
  Ct,
1499
1512
  !0
1500
- ), x.defaultView?.removeEventListener(
1513
+ ), b.defaultView?.removeEventListener(
1501
1514
  "focusin",
1502
1515
  Ct,
1503
1516
  !0
1504
- ), window.removeEventListener("resize", qn), jn(), Si(), fe !== null && window.clearTimeout(fe), Qn(), to(), b.destroy(), Ht.release(), n.remove());
1517
+ ), window.removeEventListener("resize", jn), Vn(), Ei(), fe !== null && window.clearTimeout(fe), eo(), to(), _.destroy(), Gt.release(), n.remove());
1505
1518
  }
1506
1519
  };
1507
- async function zi(a) {
1520
+ async function Di(a) {
1508
1521
  if (!kt) {
1509
- kt = a, ut = null, O(b.getState());
1522
+ kt = a, ut = null, O(_.getState());
1510
1523
  try {
1511
1524
  if (!t.referralLinkLoader)
1512
1525
  throw new Error("Referral sharing is not available here.");
1513
1526
  const s = await t.referralLinkLoader();
1514
1527
  if (!s)
1515
1528
  throw new Error("Pluno did not return a referral link.");
1516
- await Mi(s), Ue.add(a.id), nt.add(a.id), W();
1529
+ await Oi(s), Ue.add(a.id), nt.add(a.id), W();
1517
1530
  } catch (s) {
1518
1531
  ut = s instanceof Error ? s.message : "Could not copy referral link.";
1519
1532
  } finally {
1520
- kt = null, O(b.getState());
1533
+ kt = null, O(_.getState());
1521
1534
  }
1522
1535
  }
1523
1536
  }
1524
- async function Mi(a) {
1537
+ async function Oi(a) {
1525
1538
  if (navigator.clipboard?.writeText)
1526
1539
  try {
1527
1540
  await navigator.clipboard.writeText(a);
@@ -1537,12 +1550,12 @@ async function ja(e = {}) {
1537
1550
  m.remove(), s?.isConnected && s.focus({ preventScroll: !0 });
1538
1551
  }
1539
1552
  }
1540
- function sn(a, s) {
1553
+ function dn(a, s) {
1541
1554
  const m = a.accentColor ?? t.accentColor, S = a.colorScheme ?? t.colorScheme, k = a.fontFamily ?? t.fontFamily, Ae = a.scribbleStyle ?? t.scribbleStyle;
1542
- r = _o(
1555
+ r = xo(
1543
1556
  m,
1544
1557
  Ae
1545
- ), xo(o, r, {
1558
+ ), yo(o, r, {
1546
1559
  accentColor: m,
1547
1560
  colorScheme: S,
1548
1561
  fontFamily: k,
@@ -1558,14 +1571,14 @@ async function ja(e = {}) {
1558
1571
  });
1559
1572
  }
1560
1573
  }
1561
- function _o(e, t) {
1574
+ function xo(e, t) {
1562
1575
  return { accentColor: e, scribbleStyle: t };
1563
1576
  }
1564
- function Va(e) {
1565
- const t = Ka(e);
1566
- return t === null ? "#fafafa" : Ya(t) > 0.5 ? "#18181b" : "#fafaf9";
1577
+ function Ya(e) {
1578
+ const t = Xa(e);
1579
+ return t === null ? "#fafafa" : Za(t) > 0.5 ? "#18181b" : "#fafaf9";
1567
1580
  }
1568
- function Ka(e) {
1581
+ function Xa(e) {
1569
1582
  const t = e.trim();
1570
1583
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1571
1584
  Number.parseInt(t.slice(1, 3), 16),
@@ -1577,14 +1590,14 @@ function Ka(e) {
1577
1590
  Number.parseInt(t[3] + t[3], 16)
1578
1591
  ] : null;
1579
1592
  }
1580
- function Ya([e, t, n]) {
1593
+ function Za([e, t, n]) {
1581
1594
  const i = (o) => {
1582
1595
  const r = o / 255;
1583
1596
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1584
1597
  };
1585
1598
  return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
1586
1599
  }
1587
- function xo(e, t, n) {
1600
+ function yo(e, t, n) {
1588
1601
  e.classList.toggle(
1589
1602
  "pluno-pa-widget--dark",
1590
1603
  n.colorScheme === "dark"
@@ -1592,11 +1605,11 @@ function xo(e, t, n) {
1592
1605
  "pluno-pa-widget--light",
1593
1606
  n.colorScheme !== "dark"
1594
1607
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1595
- const i = n.scribbleStyle ? Fo(n.accentColor) : n.accentColor;
1608
+ const i = n.scribbleStyle ? Ho(n.accentColor) : n.accentColor;
1596
1609
  e.style.setProperty("--pluno-pa-accent", i), n.scribbleStyle ? e.style.setProperty(
1597
1610
  "--pluno-pa-accent-contrast",
1598
- Va(i)
1599
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ia : n.fontFamily, n.scribbleStyle && Xa(e.ownerDocument);
1611
+ Ya(i)
1612
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ra : n.fontFamily, n.scribbleStyle && Ja(e.ownerDocument);
1600
1613
  const o = Array.from(
1601
1614
  e.querySelectorAll(".pluno-pa-widget__character")
1602
1615
  );
@@ -1608,11 +1621,11 @@ function xo(e, t, n) {
1608
1621
  )
1609
1622
  );
1610
1623
  }
1611
- function Xa(e) {
1612
- if (e.getElementById(fo))
1624
+ function Ja(e) {
1625
+ if (e.getElementById(wo))
1613
1626
  return;
1614
1627
  const t = e.createElement("style");
1615
- t.id = fo, t.textContent = `@font-face {
1628
+ t.id = wo, t.textContent = `@font-face {
1616
1629
  font-family: "Architects Daughter";
1617
1630
  font-style: normal;
1618
1631
  font-weight: 400;
@@ -1620,7 +1633,7 @@ function Xa(e) {
1620
1633
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1621
1634
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1622
1635
  }
1623
- function Za({
1636
+ function Qa({
1624
1637
  root: e,
1625
1638
  launcher: t,
1626
1639
  launcherDragHandle: n,
@@ -1633,12 +1646,12 @@ function Za({
1633
1646
  l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1634
1647
  }, f = (w) => {
1635
1648
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (w.preventDefault(), w.stopPropagation(), l = w.pointerId, p = { x: w.clientX, y: w.clientY }, d = i(), c = !1, t.setPointerCapture?.(w.pointerId));
1636
- }, x = (w) => {
1649
+ }, b = (w) => {
1637
1650
  if (l !== w.pointerId || !p || !d)
1638
1651
  return;
1639
1652
  w.preventDefault();
1640
1653
  const R = w.clientX - p.x, D = w.clientY - p.y;
1641
- !c && Math.hypot(R, D) < Tn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + R, y: d.y + D }));
1654
+ !c && Math.hypot(R, D) < Pn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + R, y: d.y + D }));
1642
1655
  }, y = (w) => {
1643
1656
  l === w.pointerId && (w.preventDefault(), w.stopPropagation(), c && (g = { x: w.clientX, y: w.clientY }, r()), h());
1644
1657
  }, U = (w) => {
@@ -1649,20 +1662,20 @@ function Za({
1649
1662
  const R = Math.hypot(
1650
1663
  w.clientX - g.x,
1651
1664
  w.clientY - g.y
1652
- ) <= Tn;
1665
+ ) <= Pn;
1653
1666
  g = null, R && (w.preventDefault(), w.stopPropagation());
1654
1667
  }, H = (w) => {
1655
1668
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1656
1669
  return;
1657
- const R = w.shiftKey ? Xo : Yo, D = i();
1670
+ const R = w.shiftKey ? Jo : Zo, D = i();
1658
1671
  let L = null;
1659
1672
  w.key === "ArrowUp" ? L = { x: D.x, y: D.y - R } : w.key === "ArrowDown" ? L = { x: D.x, y: D.y + R } : w.key === "ArrowLeft" ? L = { x: D.x - R, y: D.y } : w.key === "ArrowRight" && (L = { x: D.x + R, y: D.y }), L && (w.preventDefault(), w.stopPropagation(), o(L), r());
1660
1673
  };
1661
- return t.addEventListener("pointerdown", f), t.addEventListener("pointermove", x), t.addEventListener("pointerup", y), t.addEventListener("pointercancel", U), t.addEventListener("click", u, !0), n.addEventListener("keydown", H), () => {
1662
- t.removeEventListener("pointerdown", f), t.removeEventListener("pointermove", x), t.removeEventListener("pointerup", y), t.removeEventListener("pointercancel", U), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", H);
1674
+ return t.addEventListener("pointerdown", f), t.addEventListener("pointermove", b), t.addEventListener("pointerup", y), t.addEventListener("pointercancel", U), t.addEventListener("click", u, !0), n.addEventListener("keydown", H), () => {
1675
+ t.removeEventListener("pointerdown", f), t.removeEventListener("pointermove", b), t.removeEventListener("pointerup", y), t.removeEventListener("pointercancel", U), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", H);
1663
1676
  };
1664
1677
  }
1665
- function Ja({
1678
+ function er({
1666
1679
  root: e,
1667
1680
  handles: t,
1668
1681
  getBounds: n,
@@ -1674,36 +1687,36 @@ function Ja({
1674
1687
  r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1675
1688
  }, h = (u) => {
1676
1689
  const H = u.currentTarget, w = H.dataset.resizeDirection;
1677
- !e.classList.contains("pluno-pa-widget--open") || !yo(w) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = w, p = { x: u.clientX, y: u.clientY }, d = n(), c = !1, H.setPointerCapture?.(u.pointerId));
1690
+ !e.classList.contains("pluno-pa-widget--open") || !vo(w) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = w, p = { x: u.clientX, y: u.clientY }, d = n(), c = !1, H.setPointerCapture?.(u.pointerId));
1678
1691
  }, f = (u) => {
1679
1692
  if (r !== u.pointerId || !l || !p || !d)
1680
1693
  return;
1681
1694
  u.preventDefault(), u.stopPropagation();
1682
1695
  const H = u.clientX - p.x, w = u.clientY - p.y;
1683
- !c && Math.hypot(H, w) < Tn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1684
- vo(d, l, H, w)
1696
+ !c && Math.hypot(H, w) < Pn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1697
+ So(d, l, H, w)
1685
1698
  ));
1686
- }, x = (u) => {
1699
+ }, b = (u) => {
1687
1700
  r === u.pointerId && (u.preventDefault(), u.stopPropagation(), c && o(), g());
1688
1701
  }, y = (u) => {
1689
1702
  r === u.pointerId && (u.preventDefault(), g());
1690
1703
  }, U = (u) => {
1691
- const w = u.currentTarget.dataset.resizeDirection, R = u.shiftKey ? Xo : Yo, D = n();
1704
+ const w = u.currentTarget.dataset.resizeDirection, R = u.shiftKey ? Jo : Zo, D = n();
1692
1705
  let L = 0, ne = 0;
1693
- yo(w) && (u.key === "ArrowLeft" ? L = -R : u.key === "ArrowRight" ? L = R : u.key === "ArrowUp" ? ne = -R : u.key === "ArrowDown" && (ne = R), !(L === 0 && ne === 0) && (u.preventDefault(), u.stopPropagation(), i(vo(D, w, L, ne)), o()));
1706
+ vo(w) && (u.key === "ArrowLeft" ? L = -R : u.key === "ArrowRight" ? L = R : u.key === "ArrowUp" ? ne = -R : u.key === "ArrowDown" && (ne = R), !(L === 0 && ne === 0) && (u.preventDefault(), u.stopPropagation(), i(So(D, w, L, ne)), o()));
1694
1707
  };
1695
1708
  for (const u of t)
1696
- u.addEventListener("pointerdown", h), u.addEventListener("pointermove", f), u.addEventListener("pointerup", x), u.addEventListener("pointercancel", y), u.addEventListener("keydown", U);
1709
+ u.addEventListener("pointerdown", h), u.addEventListener("pointermove", f), u.addEventListener("pointerup", b), u.addEventListener("pointercancel", y), u.addEventListener("keydown", U);
1697
1710
  return () => {
1698
1711
  for (const u of t)
1699
- u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", f), u.removeEventListener("pointerup", x), u.removeEventListener("pointercancel", y), u.removeEventListener("keydown", U);
1712
+ u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", f), u.removeEventListener("pointerup", b), u.removeEventListener("pointercancel", y), u.removeEventListener("keydown", U);
1700
1713
  };
1701
1714
  }
1702
- function yo(e) {
1715
+ function vo(e) {
1703
1716
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1704
1717
  }
1705
- function vo(e, t, n, i) {
1706
- const o = te(), r = So({
1718
+ function So(e, t, n, i) {
1719
+ const o = te(), r = Co({
1707
1720
  leading: e.position.x,
1708
1721
  length: e.size.width,
1709
1722
  delta: n,
@@ -1712,10 +1725,10 @@ function vo(e, t, n, i) {
1712
1725
  minLeading: N,
1713
1726
  maxTrailing: o.width - N,
1714
1727
  minLength: Math.min(
1715
- Mn,
1728
+ Dn,
1716
1729
  o.width - N * 2
1717
1730
  )
1718
- }), l = So({
1731
+ }), l = Co({
1719
1732
  leading: e.position.y,
1720
1733
  length: e.size.height,
1721
1734
  delta: i,
@@ -1724,7 +1737,7 @@ function vo(e, t, n, i) {
1724
1737
  minLeading: Ge,
1725
1738
  maxTrailing: o.height - N,
1726
1739
  minLength: Math.min(
1727
- Dn,
1740
+ On,
1728
1741
  o.height - Ge - N
1729
1742
  )
1730
1743
  });
@@ -1733,7 +1746,7 @@ function vo(e, t, n, i) {
1733
1746
  size: { width: r.length, height: l.length }
1734
1747
  };
1735
1748
  }
1736
- function So({
1749
+ function Co({
1737
1750
  leading: e,
1738
1751
  length: t,
1739
1752
  delta: n,
@@ -1780,49 +1793,49 @@ function So({
1780
1793
  }
1781
1794
  return { leading: e, length: t };
1782
1795
  }
1783
- function Ut(e, t = !0) {
1796
+ function Ft(e, t = !0) {
1784
1797
  const n = te();
1785
1798
  if (e.classList.contains("pluno-pa-widget--minimized")) {
1786
- const r = typeof window.matchMedia == "function" && window.matchMedia("(hover: none), (pointer: coarse)").matches ? Ra : Na;
1799
+ const r = typeof window.matchMedia == "function" && window.matchMedia("(hover: none), (pointer: coarse)").matches ? Ma : za;
1787
1800
  return { width: r, height: r };
1788
1801
  }
1789
1802
  const i = e.getBoundingClientRect(), o = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1790
1803
  return {
1791
- width: t && o && i.width > 0 ? i.width : Math.min(jo, n.width - 36),
1792
- height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? Ma : Vo
1804
+ width: t && o && i.width > 0 ? i.width : Math.min(Ko, n.width - 36),
1805
+ height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? Oa : Yo
1793
1806
  };
1794
1807
  }
1795
- function Qa() {
1808
+ function tr() {
1796
1809
  const e = te();
1797
1810
  return {
1798
1811
  width: Math.min(
1799
1812
  ee(
1800
- e.width * Oa,
1801
- Mn,
1802
- Da
1813
+ e.width * Ba,
1814
+ Dn,
1815
+ Ua
1803
1816
  ),
1804
1817
  e.width - N * 2
1805
1818
  ),
1806
1819
  height: Math.min(
1807
1820
  ee(
1808
- e.height * Ba,
1809
- Dn,
1810
- Ua
1821
+ e.height * Wa,
1822
+ On,
1823
+ Fa
1811
1824
  ),
1812
1825
  e.height - Ge - N
1813
1826
  )
1814
1827
  };
1815
1828
  }
1816
1829
  function et(e = null) {
1817
- return e ? Ft(e) : Qa();
1830
+ return e ? Ht(e) : tr();
1818
1831
  }
1819
- function Ft(e) {
1832
+ function Ht(e) {
1820
1833
  const t = te();
1821
1834
  return {
1822
1835
  width: ee(
1823
1836
  e.width,
1824
1837
  Math.min(
1825
- Mn,
1838
+ Dn,
1826
1839
  t.width - N * 2
1827
1840
  ),
1828
1841
  Math.max(
@@ -1833,7 +1846,7 @@ function Ft(e) {
1833
1846
  height: ee(
1834
1847
  e.height,
1835
1848
  Math.min(
1836
- Dn,
1849
+ On,
1837
1850
  t.height - Ge - N
1838
1851
  ),
1839
1852
  Math.max(
@@ -1843,15 +1856,15 @@ function Ft(e) {
1843
1856
  )
1844
1857
  };
1845
1858
  }
1846
- function gn(e, t) {
1859
+ function hn(e, t) {
1847
1860
  if (!t) {
1848
1861
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1849
1862
  return;
1850
1863
  }
1851
- const n = Ft(t);
1864
+ const n = Ht(t);
1852
1865
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1853
1866
  }
1854
- function er(e, t, n) {
1867
+ function nr(e, t, n) {
1855
1868
  const i = Number.parseFloat(e.style.left), o = Number.parseFloat(e.style.top);
1856
1869
  if (Number.isFinite(i) && Number.isFinite(o))
1857
1870
  return { x: i, y: o };
@@ -1864,23 +1877,23 @@ function er(e, t, n) {
1864
1877
  y: l.height - 24 - n.height
1865
1878
  };
1866
1879
  }
1867
- function hn(e, t, n) {
1868
- const i = Ut(e, !1);
1869
- return t ? Pn(
1880
+ function mn(e, t, n) {
1881
+ const i = Ft(e, !1);
1882
+ return t ? An(
1870
1883
  e,
1871
- zt(t, i),
1884
+ Dt(t, i),
1872
1885
  i
1873
- ) : tr(n === "bottom-left" ? "bottom-left" : "bottom-right", i, za);
1886
+ ) : or(n === "bottom-left" ? "bottom-left" : "bottom-right", i, Da);
1874
1887
  }
1875
- function tr(e, t, n) {
1888
+ function or(e, t, n) {
1876
1889
  const i = te();
1877
1890
  return {
1878
1891
  x: e.endsWith("right") ? Math.max(0, i.width - t.width - n) : n,
1879
1892
  y: e.startsWith("bottom") ? Math.max(0, i.height - t.height - n) : n
1880
1893
  };
1881
1894
  }
1882
- function Pn(e, t, n) {
1883
- const i = te(), o = N + or(e);
1895
+ function An(e, t, n) {
1896
+ const i = te(), o = N + ar(e);
1884
1897
  return {
1885
1898
  x: ee(
1886
1899
  t.x,
@@ -1900,36 +1913,36 @@ function Pn(e, t, n) {
1900
1913
  )
1901
1914
  };
1902
1915
  }
1903
- function zt(e, t) {
1916
+ function Dt(e, t) {
1904
1917
  const n = te();
1905
1918
  return {
1906
1919
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1907
1920
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1908
1921
  };
1909
1922
  }
1910
- function Co(e, t) {
1911
- const n = nr(e, t), i = te();
1923
+ function Eo(e, t) {
1924
+ const n = ir(e, t), i = te();
1912
1925
  return {
1913
1926
  anchor: n,
1914
1927
  x: n.endsWith("right") ? i.width - e.x - t.width : e.x,
1915
1928
  y: n.startsWith("bottom") ? i.height - e.y - t.height : e.y
1916
1929
  };
1917
1930
  }
1918
- function nr(e, t) {
1931
+ function ir(e, t) {
1919
1932
  const n = te(), i = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = i <= n.width / 2 ? "left" : "right";
1920
1933
  return `${r}-${l}`;
1921
1934
  }
1922
- function or(e) {
1923
- return e.classList.contains("pluno-pa-widget--scribble") ? $a : Ha;
1935
+ function ar(e) {
1936
+ return e.classList.contains("pluno-pa-widget--scribble") ? qa : Ga;
1924
1937
  }
1925
- function mn(e, t, n, i = null) {
1926
- const o = Ut(e), r = et(i), l = {
1938
+ function fn(e, t, n, i = null) {
1939
+ const o = Ft(e), r = et(i), l = {
1927
1940
  x: n === "bottom-left" ? t.x : t.x + o.width - r.width,
1928
1941
  y: t.y + o.height - r.height
1929
1942
  };
1930
- return Mt(l, r);
1943
+ return Ot(l, r);
1931
1944
  }
1932
- function Mt(e, t) {
1945
+ function Ot(e, t) {
1933
1946
  const n = te();
1934
1947
  return {
1935
1948
  x: ee(
@@ -1957,19 +1970,19 @@ function $e(e, t) {
1957
1970
  }
1958
1971
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1959
1972
  }
1960
- function ir(e, t) {
1973
+ function rr(e, t) {
1961
1974
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1962
1975
  }
1963
- function Eo(e) {
1976
+ function ko(e) {
1964
1977
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1965
1978
  }
1966
1979
  function te() {
1967
1980
  return {
1968
- width: window.innerWidth || document.documentElement.clientWidth || jo + N * 2,
1969
- height: window.innerHeight || document.documentElement.clientHeight || Vo + N * 2
1981
+ width: window.innerWidth || document.documentElement.clientWidth || Ko + N * 2,
1982
+ height: window.innerHeight || document.documentElement.clientHeight || Yo + N * 2
1970
1983
  };
1971
1984
  }
1972
- function fn(e) {
1985
+ function wn(e) {
1973
1986
  const t = e.getBoundingClientRect();
1974
1987
  return {
1975
1988
  x: Math.round(t.x),
@@ -1991,31 +2004,31 @@ function J(e, t, n) {
1991
2004
  details: n
1992
2005
  }, r = i.__plunoProductAgentDiagnostics__ ?? [];
1993
2006
  r.push(o), r.length > 120 && r.splice(0, r.length - 120), i.__plunoProductAgentDiagnostics__ = r, i.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1994
- new CustomEvent(ka, { detail: o })
2007
+ new CustomEvent(Ta, { detail: o })
1995
2008
  );
1996
2009
  }
1997
- function ar(e, t) {
2010
+ function lr(e, t) {
1998
2011
  J("web-sdk.widget.position", e, t);
1999
2012
  }
2000
- function wn(e, t, n, i) {
2013
+ function bn(e, t, n, i) {
2001
2014
  const o = t.value.trim();
2002
2015
  return !o && n.length === 0 ? n : (i(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
2003
- attachments: n.length > 0 ? n.map(pr) : void 0
2016
+ attachments: n.length > 0 ? n.map(dr) : void 0
2004
2017
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
2005
2018
  }
2006
- function rr(e, t, n) {
2019
+ function pr(e, t, n) {
2007
2020
  const i = e.activeElement;
2008
2021
  return i === n ? "composer" : i === t ? "launcher" : null;
2009
2022
  }
2010
- function lr(e, t, n, i) {
2011
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > ha)
2023
+ function sr(e, t, n, i) {
2024
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > fa)
2012
2025
  return;
2013
2026
  const o = e.focusedInput === "composer" ? i : n;
2014
2027
  o === i && !t.classList.contains("pluno-pa-widget--open") || o === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
2015
2028
  !o.isConnected || o.readOnly || (o.focus(), o.setSelectionRange(o.value.length, o.value.length));
2016
2029
  });
2017
2030
  }
2018
- function pr(e) {
2031
+ function dr(e) {
2019
2032
  return e;
2020
2033
  }
2021
2034
  function ht(e) {
@@ -2026,7 +2039,7 @@ function mt(e, t = () => !0) {
2026
2039
  t() && (e.scrollTop = e.scrollHeight);
2027
2040
  });
2028
2041
  }
2029
- function sr(e) {
2042
+ function cr(e) {
2030
2043
  const t = e.messages[e.messages.length - 1];
2031
2044
  return [
2032
2045
  e.messages.length,
@@ -2037,13 +2050,13 @@ function sr(e) {
2037
2050
  e.lastError ?? ""
2038
2051
  ].join(":");
2039
2052
  }
2040
- function dr(e) {
2053
+ function ur(e) {
2041
2054
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
2042
2055
  }
2043
- function cr(e) {
2056
+ function gr(e) {
2044
2057
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
2045
2058
  }
2046
- function ur(e) {
2059
+ function hr(e) {
2047
2060
  const t = e.currentPage;
2048
2061
  if (typeof t?.url == "string" && t.url.trim())
2049
2062
  try {
@@ -2054,7 +2067,7 @@ function ur(e) {
2054
2067
  }
2055
2068
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
2056
2069
  }
2057
- function gr(e, t) {
2070
+ function mr(e, t) {
2058
2071
  const n = new Date(e).getTime();
2059
2072
  if (!Number.isFinite(n))
2060
2073
  return "now";
@@ -2070,24 +2083,24 @@ function gr(e, t) {
2070
2083
  }
2071
2084
  return "now";
2072
2085
  }
2073
- function hr(e, t, n, i, o) {
2074
- e.appendChild(Cr()), e.appendChild(
2075
- mr(
2086
+ function fr(e, t, n, i, o) {
2087
+ e.appendChild(kr()), e.appendChild(
2088
+ wr(
2076
2089
  t,
2077
2090
  n,
2078
2091
  i,
2079
2092
  o
2080
2093
  )
2081
2094
  ), e.appendChild(
2082
- Wt(
2095
+ $t(
2083
2096
  "pluno-pa-widget__close",
2084
2097
  "Close",
2085
- Er(16),
2098
+ Lr(16),
2086
2099
  !0
2087
2100
  )
2088
- ), e.appendChild(fr(n));
2101
+ ), e.appendChild(br(n));
2089
2102
  }
2090
- function mr(e, t, n, i) {
2103
+ function wr(e, t, n, i) {
2091
2104
  const o = document.createElement("form");
2092
2105
  if (o.className = "pluno-pa-widget__launcher", i && o.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
2093
2106
  o.classList.add("pluno-pa-widget__launcher--movable");
@@ -2095,7 +2108,7 @@ function mr(e, t, n, i) {
2095
2108
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", o.appendChild(d);
2096
2109
  }
2097
2110
  o.appendChild(
2098
- ni(
2111
+ ii(
2099
2112
  "pluno-pa-widget__scribble-spirals--launcher",
2100
2113
  10
2101
2114
  )
@@ -2116,15 +2129,15 @@ function mr(e, t, n, i) {
2116
2129
  }
2117
2130
  return o;
2118
2131
  }
2119
- function fr(e) {
2132
+ function br(e) {
2120
2133
  const t = document.createElement("section");
2121
2134
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
2122
- ni("pluno-pa-widget__scribble-spirals--panel", 16)
2135
+ ii("pluno-pa-widget__scribble-spirals--panel", 16)
2123
2136
  );
2124
2137
  const n = document.createElement("div");
2125
2138
  n.className = "pluno-pa-widget__timeline-wrap";
2126
2139
  const i = document.createElement("main");
2127
- i.className = "pluno-pa-widget__timeline", i.appendChild(yr(e));
2140
+ i.className = "pluno-pa-widget__timeline", i.appendChild(Sr(e));
2128
2141
  const o = document.createElement("div");
2129
2142
  o.className = "pluno-pa-widget__timeline-bottom-sentinel", o.setAttribute("aria-hidden", "true"), i.appendChild(o), n.appendChild(i);
2130
2143
  const r = document.createElement("div");
@@ -2133,13 +2146,13 @@ function fr(e) {
2133
2146
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
2134
2147
  const p = document.createElement("div");
2135
2148
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
2136
- Wt(
2149
+ $t(
2137
2150
  "pluno-pa-widget__history",
2138
- An(),
2139
- Lr(),
2151
+ In(),
2152
+ Pr(),
2140
2153
  !0
2141
2154
  )
2142
- ), n.appendChild(p), n.appendChild(xr()), t.appendChild(n), t.appendChild(wr()), t.appendChild(br()), t.appendChild(_r()), t.appendChild(Ie("left", "Resize Pluno from left")), t.appendChild(
2155
+ ), n.appendChild(p), n.appendChild(vr()), t.appendChild(n), t.appendChild(_r()), t.appendChild(xr()), t.appendChild(yr()), t.appendChild(Ie("left", "Resize Pluno from left")), t.appendChild(
2143
2156
  Ie("right", "Resize Pluno from right")
2144
2157
  ), t.appendChild(Ie("top", "Resize Pluno from top")), t.appendChild(
2145
2158
  Ie("bottom", "Resize Pluno from bottom")
@@ -2160,7 +2173,7 @@ function Ie(e, t) {
2160
2173
  `pluno-pa-widget__resize-handle--${e}`
2161
2174
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
2162
2175
  }
2163
- function wr() {
2176
+ function _r() {
2164
2177
  const e = document.createElement("div");
2165
2178
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
2166
2179
  const t = document.createElement("span");
@@ -2174,7 +2187,7 @@ function wr() {
2174
2187
  const r = document.createElement("button");
2175
2188
  return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(i, o, r), e.append(t, n), e;
2176
2189
  }
2177
- function br() {
2190
+ function xr() {
2178
2191
  const e = document.createElement("div");
2179
2192
  e.className = "pluno-pa-widget__notify-suggestion pluno-pa-widget__tab-groups-suggestion", e.hidden = !0;
2180
2193
  const t = document.createElement("span");
@@ -2186,7 +2199,7 @@ function br() {
2186
2199
  const o = document.createElement("button");
2187
2200
  return o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-later pluno-pa-widget__tab-groups-suggestion-dismiss", o.textContent = "Not now", n.append(i, o), e.append(t, n), e;
2188
2201
  }
2189
- function _r() {
2202
+ function yr() {
2190
2203
  const e = document.createElement("form");
2191
2204
  e.className = "pluno-pa-widget__composer";
2192
2205
  const t = document.createElement("div");
@@ -2200,11 +2213,11 @@ function _r() {
2200
2213
  const r = document.createElement("input");
2201
2214
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), o.appendChild(r);
2202
2215
  const l = document.createElement("button");
2203
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Tr()), l.appendChild(Pr()), o.appendChild(l);
2216
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ar()), l.appendChild(Ir()), o.appendChild(l);
2204
2217
  const p = document.createElement("textarea");
2205
2218
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", o.appendChild(p);
2206
2219
  const d = document.createElement("button");
2207
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(ai()), o.appendChild(d), e.appendChild(o);
2220
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(li()), o.appendChild(d), e.appendChild(o);
2208
2221
  const c = document.createElement("div");
2209
2222
  c.className = "pluno-pa-widget__composer-meta";
2210
2223
  const g = document.createElement("a");
@@ -2212,20 +2225,20 @@ function _r() {
2212
2225
  const h = document.createElement("span");
2213
2226
  return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(h), e.appendChild(c), e;
2214
2227
  }
2215
- function An() {
2228
+ function In() {
2216
2229
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
2217
2230
  }
2218
- function xr() {
2231
+ function vr() {
2219
2232
  const e = document.createElement("section");
2220
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", An());
2233
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", In());
2221
2234
  const t = document.createElement("div");
2222
2235
  t.className = "pluno-pa-widget__history-header";
2223
2236
  const n = document.createElement("strong");
2224
- n.textContent = An();
2225
- const i = Wt(
2237
+ n.textContent = In();
2238
+ const i = $t(
2226
2239
  "pluno-pa-widget__history-close",
2227
2240
  "Close recent chats",
2228
- ii(),
2241
+ ri(),
2229
2242
  !1
2230
2243
  );
2231
2244
  t.append(n, i);
@@ -2234,20 +2247,20 @@ function xr() {
2234
2247
  const r = document.createElement("p");
2235
2248
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, o, r), e;
2236
2249
  }
2237
- function yr(e) {
2250
+ function Sr(e) {
2238
2251
  const t = document.createElement("div");
2239
2252
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
2240
2253
  Re(
2241
2254
  "pluno-pa-widget__character--empty",
2242
2255
  e
2243
2256
  )
2244
- ), t.appendChild(Qo()), t;
2257
+ ), t.appendChild(ti()), t;
2245
2258
  }
2246
- function Qo() {
2259
+ function ti() {
2247
2260
  const e = document.createElement("div");
2248
2261
  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;
2249
2262
  }
2250
- function ei(e, t) {
2263
+ function ni(e, t) {
2251
2264
  e.replaceChildren(), e.setAttribute(
2252
2265
  "aria-label",
2253
2266
  `${t.toLocaleString("en-US")} users currently active`
@@ -2260,16 +2273,16 @@ function ei(e, t) {
2260
2273
  );
2261
2274
  }
2262
2275
  function Re(e, t) {
2263
- const n = `pluno-pa-character-${bo}`;
2264
- bo += 1;
2265
- const i = t.scribbleStyle ? Sr(t.accentColor, n) : vr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2276
+ const n = `pluno-pa-character-${_o}`;
2277
+ _o += 1;
2278
+ const i = t.scribbleStyle ? Er(t.accentColor, n) : Cr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2266
2279
  return i.setAttribute(
2267
2280
  "class",
2268
2281
  o.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
2269
2282
  ), i.setAttribute("aria-hidden", "true"), i.setAttribute("focusable", "false"), i.removeAttribute("role"), i.removeAttribute("aria-label"), i;
2270
2283
  }
2271
- function vr(e, t) {
2272
- const n = Fi(e), i = {
2284
+ function Cr(e, t) {
2285
+ const n = Hi(e), i = {
2273
2286
  boltFill: `${t}-boltFill`,
2274
2287
  boltEdge: `${t}-boltEdge`,
2275
2288
  boltGlow: `${t}-boltGlow`,
@@ -2280,7 +2293,7 @@ function vr(e, t) {
2280
2293
  eyeShadow: `${t}-eyeShadow`,
2281
2294
  pupilGloss: `${t}-pupilGloss`,
2282
2295
  boltClip: `${t}-boltClip`
2283
- }, o = ti(), r = _(o, "defs"), l = _(r, "linearGradient", {
2296
+ }, o = oi(), r = x(o, "defs"), l = x(r, "linearGradient", {
2284
2297
  id: i.boltFill,
2285
2298
  x1: "420",
2286
2299
  y1: "180",
@@ -2289,7 +2302,7 @@ function vr(e, t) {
2289
2302
  gradientUnits: "userSpaceOnUse"
2290
2303
  });
2291
2304
  G(l, "0", n.top), G(l, "0.36", n.middle), G(l, "0.72", n.bottom), G(l, "1", n.bottom);
2292
- const p = _(r, "linearGradient", {
2305
+ const p = x(r, "linearGradient", {
2293
2306
  id: i.boltEdge,
2294
2307
  x1: "470",
2295
2308
  y1: "145",
@@ -2298,28 +2311,28 @@ function vr(e, t) {
2298
2311
  gradientUnits: "userSpaceOnUse"
2299
2312
  });
2300
2313
  G(p, "0", n.edgeStart), G(p, "0.32", n.edgeMiddle), G(p, "0.78", n.edgeEnd), G(p, "1", n.edgeEnd);
2301
- const d = _(r, "radialGradient", {
2314
+ const d = x(r, "radialGradient", {
2302
2315
  id: i.boltGlow,
2303
2316
  cx: "50%",
2304
2317
  cy: "22%",
2305
2318
  r: "82%"
2306
2319
  });
2307
2320
  G(d, "0", n.glow, "0.72"), G(d, "0.5", n.middle, "0.44"), G(d, "1", n.bottom, "0");
2308
- const c = _(r, "radialGradient", {
2321
+ const c = x(r, "radialGradient", {
2309
2322
  id: i.eyeWhite,
2310
2323
  cx: "35%",
2311
2324
  cy: "25%",
2312
2325
  r: "70%"
2313
2326
  });
2314
2327
  G(c, "0", "#ffffff"), G(c, "0.72", "#ffffff"), G(c, "1", "#e5e5e5");
2315
- const g = _(r, "radialGradient", {
2328
+ const g = x(r, "radialGradient", {
2316
2329
  id: i.pupil,
2317
2330
  cx: "42%",
2318
2331
  cy: "38%",
2319
2332
  r: "65%"
2320
2333
  });
2321
2334
  G(g, "0", "#2a1f10"), G(g, "0.52", "#080604"), G(g, "1", "#000000");
2322
- const h = _(r, "filter", {
2335
+ const h = x(r, "filter", {
2323
2336
  id: i.softDropShadow,
2324
2337
  x: "-18%",
2325
2338
  y: "-12%",
@@ -2327,14 +2340,14 @@ function vr(e, t) {
2327
2340
  height: "136%",
2328
2341
  "color-interpolation-filters": "sRGB"
2329
2342
  });
2330
- _(h, "feDropShadow", {
2343
+ x(h, "feDropShadow", {
2331
2344
  dx: "0",
2332
2345
  dy: "12",
2333
2346
  stdDeviation: "18",
2334
2347
  "flood-color": n.shadow,
2335
2348
  "flood-opacity": "0.24"
2336
2349
  });
2337
- const f = _(r, "filter", {
2350
+ const f = x(r, "filter", {
2338
2351
  id: i.innerDepth,
2339
2352
  x: "-8%",
2340
2353
  y: "-8%",
@@ -2342,32 +2355,32 @@ function vr(e, t) {
2342
2355
  height: "116%",
2343
2356
  "color-interpolation-filters": "sRGB"
2344
2357
  });
2345
- _(f, "feGaussianBlur", {
2358
+ x(f, "feGaussianBlur", {
2346
2359
  in: "SourceAlpha",
2347
2360
  stdDeviation: "8",
2348
2361
  result: "blur"
2349
- }), _(f, "feOffset", {
2362
+ }), x(f, "feOffset", {
2350
2363
  dx: "-7",
2351
2364
  dy: "-9",
2352
2365
  result: "topLeft"
2353
- }), _(f, "feComposite", {
2366
+ }), x(f, "feComposite", {
2354
2367
  in: "topLeft",
2355
2368
  in2: "SourceAlpha",
2356
2369
  operator: "arithmetic",
2357
2370
  k2: "-1",
2358
2371
  k3: "1",
2359
2372
  result: "innerShadow"
2360
- }), _(f, "feColorMatrix", {
2373
+ }), x(f, "feColorMatrix", {
2361
2374
  in: "innerShadow",
2362
2375
  type: "matrix",
2363
2376
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
2364
2377
  result: "innerLight"
2365
- }), _(f, "feBlend", {
2378
+ }), x(f, "feBlend", {
2366
2379
  in: "SourceGraphic",
2367
2380
  in2: "innerLight",
2368
2381
  mode: "screen"
2369
2382
  });
2370
- const x = _(r, "filter", {
2383
+ const b = x(r, "filter", {
2371
2384
  id: i.eyeShadow,
2372
2385
  x: "-24%",
2373
2386
  y: "-20%",
@@ -2375,14 +2388,14 @@ function vr(e, t) {
2375
2388
  height: "148%",
2376
2389
  "color-interpolation-filters": "sRGB"
2377
2390
  });
2378
- _(x, "feDropShadow", {
2391
+ x(b, "feDropShadow", {
2379
2392
  dx: "0",
2380
2393
  dy: "8",
2381
2394
  stdDeviation: "5",
2382
2395
  "flood-color": n.shadow,
2383
2396
  "flood-opacity": "0.3"
2384
2397
  });
2385
- const y = _(r, "filter", {
2398
+ const y = x(r, "filter", {
2386
2399
  id: i.pupilGloss,
2387
2400
  x: "-15%",
2388
2401
  y: "-15%",
@@ -2390,51 +2403,51 @@ function vr(e, t) {
2390
2403
  height: "130%",
2391
2404
  "color-interpolation-filters": "sRGB"
2392
2405
  });
2393
- _(y, "feDropShadow", {
2406
+ x(y, "feDropShadow", {
2394
2407
  dx: "0",
2395
2408
  dy: "3",
2396
2409
  stdDeviation: "3",
2397
2410
  "flood-color": "#000000",
2398
2411
  "flood-opacity": "0.22"
2399
2412
  });
2400
- const U = _(r, "clipPath", { id: i.boltClip });
2401
- _(U, "path", { d: Dt });
2402
- const u = _(o, "g", {
2413
+ const U = x(r, "clipPath", { id: i.boltClip });
2414
+ x(U, "path", { d: Ut });
2415
+ const u = x(o, "g", {
2403
2416
  filter: Q(i.softDropShadow)
2404
2417
  });
2405
- _(u, "path", {
2406
- d: Dt,
2418
+ x(u, "path", {
2419
+ d: Ut,
2407
2420
  fill: Q(i.boltEdge)
2408
2421
  });
2409
2422
  const H = "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";
2410
- _(u, "path", {
2423
+ x(u, "path", {
2411
2424
  d: H,
2412
2425
  fill: Q(i.boltFill),
2413
2426
  filter: Q(i.innerDepth)
2414
- }), _(u, "path", {
2427
+ }), x(u, "path", {
2415
2428
  d: H,
2416
2429
  fill: Q(i.boltGlow),
2417
2430
  opacity: "0.74"
2418
2431
  });
2419
- const w = _(u, "g", {
2432
+ const w = x(u, "g", {
2420
2433
  "clip-path": Q(i.boltClip),
2421
2434
  opacity: "0.42"
2422
2435
  });
2423
- _(w, "path", {
2436
+ x(w, "path", {
2424
2437
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
2425
2438
  fill: "none",
2426
2439
  stroke: n.highlight,
2427
2440
  "stroke-width": "22",
2428
2441
  "stroke-linecap": "round",
2429
2442
  opacity: "0.65"
2430
- }), _(w, "path", {
2443
+ }), x(w, "path", {
2431
2444
  d: "M556 685 L501 994",
2432
2445
  fill: "none",
2433
2446
  stroke: n.highlight,
2434
2447
  "stroke-width": "20",
2435
2448
  "stroke-linecap": "round",
2436
2449
  opacity: "0.55"
2437
- }), _(w, "path", {
2450
+ }), x(w, "path", {
2438
2451
  d: "M858 160 C882 166 893 181 883 204",
2439
2452
  fill: "none",
2440
2453
  stroke: n.inner,
@@ -2442,8 +2455,8 @@ function vr(e, t) {
2442
2455
  "stroke-linecap": "round",
2443
2456
  opacity: "0.48"
2444
2457
  });
2445
- const R = _(o, "g", { filter: Q(i.eyeShadow) });
2446
- return ko(
2458
+ const R = x(o, "g", { filter: Q(i.eyeShadow) });
2459
+ return Lo(
2447
2460
  R,
2448
2461
  "rotate(-2 528 463)",
2449
2462
  "528",
@@ -2453,7 +2466,7 @@ function vr(e, t) {
2453
2466
  "557",
2454
2467
  "447",
2455
2468
  i
2456
- ), ko(
2469
+ ), Lo(
2457
2470
  R,
2458
2471
  "rotate(2 717 462)",
2459
2472
  "717",
@@ -2465,13 +2478,13 @@ function vr(e, t) {
2465
2478
  i
2466
2479
  ), o;
2467
2480
  }
2468
- function Sr(e, t) {
2469
- const n = Fo(e), i = {
2481
+ function Er(e, t) {
2482
+ const n = Ho(e), i = {
2470
2483
  clip: `${t}-scribbleBoltClip`,
2471
2484
  wobble: `${t}-scribbleBoltWobble`
2472
- }, o = ti(), r = _(o, "defs"), l = _(r, "clipPath", { id: i.clip });
2473
- _(l, "path", { d: Dt });
2474
- const p = _(r, "filter", {
2485
+ }, o = oi(), r = x(o, "defs"), l = x(r, "clipPath", { id: i.clip });
2486
+ x(l, "path", { d: Ut });
2487
+ const p = x(r, "filter", {
2475
2488
  id: i.wobble,
2476
2489
  x: "-10%",
2477
2490
  y: "-10%",
@@ -2479,24 +2492,24 @@ function Sr(e, t) {
2479
2492
  height: "120%",
2480
2493
  "color-interpolation-filters": "sRGB"
2481
2494
  });
2482
- _(p, "feTurbulence", {
2495
+ x(p, "feTurbulence", {
2483
2496
  type: "fractalNoise",
2484
2497
  baseFrequency: "0.011",
2485
2498
  numOctaves: "3",
2486
2499
  seed: "7",
2487
2500
  result: "noise"
2488
- }), _(p, "feDisplacementMap", {
2501
+ }), x(p, "feDisplacementMap", {
2489
2502
  in: "SourceGraphic",
2490
2503
  in2: "noise",
2491
2504
  scale: "16",
2492
2505
  xChannelSelector: "R",
2493
2506
  yChannelSelector: "G"
2494
2507
  });
2495
- const d = _(o, "g", { filter: Q(i.wobble) }), c = _(d, "g", {
2508
+ const d = x(o, "g", { filter: Q(i.wobble) }), c = x(d, "g", {
2496
2509
  "clip-path": Q(i.clip)
2497
2510
  });
2498
- return _(c, "path", {
2499
- d: Bi(),
2511
+ return x(c, "path", {
2512
+ d: Wi(),
2500
2513
  fill: "none",
2501
2514
  stroke: n,
2502
2515
  "stroke-width": "56",
@@ -2504,13 +2517,13 @@ function Sr(e, t) {
2504
2517
  "stroke-linejoin": "round",
2505
2518
  opacity: "0.9",
2506
2519
  transform: "rotate(-14 627 600)"
2507
- }), _(d, "path", {
2508
- d: Dt,
2520
+ }), x(d, "path", {
2521
+ d: Ut,
2509
2522
  fill: "none",
2510
- stroke: Ot,
2523
+ stroke: Bt,
2511
2524
  "stroke-width": "18",
2512
2525
  "stroke-linejoin": "round"
2513
- }), Lo(
2526
+ }), To(
2514
2527
  d,
2515
2528
  "rotate(-2 528 463)",
2516
2529
  "528",
@@ -2519,7 +2532,7 @@ function Sr(e, t) {
2519
2532
  "473",
2520
2533
  "557",
2521
2534
  "447"
2522
- ), Lo(
2535
+ ), To(
2523
2536
  d,
2524
2537
  "rotate(2 717 462)",
2525
2538
  "717",
@@ -2530,73 +2543,73 @@ function Sr(e, t) {
2530
2543
  "447"
2531
2544
  ), o;
2532
2545
  }
2533
- function ti() {
2546
+ function oi() {
2534
2547
  return P("svg", {
2535
- xmlns: Ko,
2548
+ xmlns: Xo,
2536
2549
  viewBox: "0 0 1254 1254"
2537
2550
  });
2538
2551
  }
2539
- function ko(e, t, n, i, o, r, l, p, d) {
2540
- const c = _(e, "g", { transform: t });
2541
- _(c, "ellipse", {
2552
+ function Lo(e, t, n, i, o, r, l, p, d) {
2553
+ const c = x(e, "g", { transform: t });
2554
+ x(c, "ellipse", {
2542
2555
  cx: n,
2543
2556
  cy: i,
2544
2557
  rx: "73",
2545
2558
  ry: "80",
2546
2559
  fill: Q(d.eyeWhite)
2547
- }), _(c, "ellipse", {
2560
+ }), x(c, "ellipse", {
2548
2561
  cx: o,
2549
2562
  cy: r,
2550
2563
  rx: "49",
2551
2564
  ry: "57",
2552
2565
  fill: Q(d.pupil),
2553
2566
  filter: Q(d.pupilGloss)
2554
- }), _(c, "circle", {
2567
+ }), x(c, "circle", {
2555
2568
  cx: l,
2556
2569
  cy: p,
2557
2570
  r: "18",
2558
2571
  fill: "#ffffff"
2559
2572
  });
2560
2573
  }
2561
- function Lo(e, t, n, i, o, r, l, p) {
2562
- const d = _(e, "g", { transform: t });
2563
- _(d, "ellipse", {
2574
+ function To(e, t, n, i, o, r, l, p) {
2575
+ const d = x(e, "g", { transform: t });
2576
+ x(d, "ellipse", {
2564
2577
  cx: n,
2565
2578
  cy: i,
2566
2579
  rx: "73",
2567
2580
  ry: "80",
2568
2581
  fill: "#ffffff",
2569
- stroke: Ot,
2582
+ stroke: Bt,
2570
2583
  "stroke-width": "13"
2571
- }), _(d, "ellipse", {
2584
+ }), x(d, "ellipse", {
2572
2585
  cx: o,
2573
2586
  cy: r,
2574
2587
  rx: "45",
2575
2588
  ry: "53",
2576
- fill: Ot
2577
- }), _(d, "circle", {
2589
+ fill: Bt
2590
+ }), x(d, "circle", {
2578
2591
  cx: l,
2579
2592
  cy: p,
2580
2593
  r: "16",
2581
2594
  fill: "#ffffff"
2582
2595
  });
2583
2596
  }
2584
- function _(e, t, n = {}) {
2597
+ function x(e, t, n = {}) {
2585
2598
  const i = P(t, n);
2586
2599
  return e.appendChild(i), i;
2587
2600
  }
2588
2601
  function G(e, t, n, i) {
2589
2602
  const o = { offset: t, "stop-color": n };
2590
- i !== void 0 && (o["stop-opacity"] = i), _(e, "stop", o);
2603
+ i !== void 0 && (o["stop-opacity"] = i), x(e, "stop", o);
2591
2604
  }
2592
2605
  function Q(e) {
2593
2606
  return `url(#${e})`;
2594
2607
  }
2595
- function Wt(e, t, n, i) {
2608
+ function $t(e, t, n, i) {
2596
2609
  const o = document.createElement("button");
2597
2610
  return o.type = "button", o.className = e, o.setAttribute("aria-label", t), o.title = t, o.hidden = i, o.appendChild(n), o;
2598
2611
  }
2599
- function Cr() {
2612
+ function kr() {
2600
2613
  const e = P("svg", {
2601
2614
  class: "pluno-pa-widget__scribble-defs",
2602
2615
  "aria-hidden": "true",
@@ -2604,46 +2617,46 @@ function Cr() {
2604
2617
  width: "0",
2605
2618
  height: "0"
2606
2619
  }), t = P("defs");
2607
- return t.appendChild(_n("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2608
- _n("pluno-pa-scribble-wobble-2", "5", "15")
2620
+ return t.appendChild(xn("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2621
+ xn("pluno-pa-scribble-wobble-2", "5", "15")
2609
2622
  ), t.appendChild(
2610
- _n("pluno-pa-scribble-wobble-3", "9", "19")
2623
+ xn("pluno-pa-scribble-wobble-3", "9", "19")
2611
2624
  ), e.appendChild(t), e;
2612
2625
  }
2613
- function ni(e, t) {
2626
+ function ii(e, t) {
2614
2627
  const n = P("svg", {
2615
2628
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2616
2629
  preserveAspectRatio: "xMidYMid meet",
2617
2630
  "aria-hidden": "true",
2618
2631
  focusable: "false"
2619
2632
  });
2620
- return oi(n, t), n;
2633
+ return ai(n, t), n;
2621
2634
  }
2622
- function bn(e, t) {
2635
+ function _n(e, t) {
2623
2636
  if (!e)
2624
2637
  return;
2625
2638
  const n = Math.max(
2626
2639
  0,
2627
- t - Ln * 2
2640
+ t - Tn * 2
2628
2641
  ), i = Math.max(
2629
- Wa,
2642
+ $a,
2630
2643
  Math.floor(
2631
- (n - kn * 2) / En
2644
+ (n - Ln * 2) / kn
2632
2645
  )
2633
2646
  );
2634
- oi(e, i);
2647
+ ai(e, i);
2635
2648
  }
2636
- function oi(e, t) {
2649
+ function ai(e, t) {
2637
2650
  if (e.dataset.spiralCount === `${t}`)
2638
2651
  return;
2639
- const n = t * En + kn * 2;
2652
+ const n = t * kn + Ln * 2;
2640
2653
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2641
2654
  "viewBox",
2642
- `0 0 ${n} ${Fa}`
2655
+ `0 0 ${n} ${Ha}`
2643
2656
  ), e.replaceChildren();
2644
2657
  for (let i = 0; i < t; i += 1) {
2645
- const o = wo[i % wo.length], r = P("g", {
2646
- transform: `translate(${kn + i * En} 0)`
2658
+ const o = bo[i % bo.length], r = P("g", {
2659
+ transform: `translate(${Ln + i * kn} 0)`
2647
2660
  });
2648
2661
  r.appendChild(
2649
2662
  P("ellipse", {
@@ -2667,7 +2680,7 @@ function oi(e, t) {
2667
2680
  ), e.appendChild(r);
2668
2681
  }
2669
2682
  }
2670
- function _n(e, t, n) {
2683
+ function xn(e, t, n) {
2671
2684
  const i = P("filter", {
2672
2685
  id: e,
2673
2686
  x: "-8%",
@@ -2710,7 +2723,7 @@ function _n(e, t, n) {
2710
2723
  })
2711
2724
  ), i;
2712
2725
  }
2713
- function Er(e) {
2726
+ function Lr(e) {
2714
2727
  const t = ue(
2715
2728
  "0 0 24 24",
2716
2729
  e,
@@ -2721,7 +2734,7 @@ function Er(e) {
2721
2734
  );
2722
2735
  return t.appendChild(P("path", { d: "m6 9 6 6 6-6" })), t;
2723
2736
  }
2724
- function kr() {
2737
+ function Tr() {
2725
2738
  const e = ue(
2726
2739
  "0 0 24 24",
2727
2740
  17,
@@ -2740,7 +2753,7 @@ function kr() {
2740
2753
  })
2741
2754
  ), e;
2742
2755
  }
2743
- function Lr() {
2756
+ function Pr() {
2744
2757
  const e = ue(
2745
2758
  "0 0 24 24",
2746
2759
  17,
@@ -2751,7 +2764,7 @@ function Lr() {
2751
2764
  );
2752
2765
  return e.appendChild(P("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(P("path", { d: "M3 4v5h5" })), e.appendChild(P("path", { d: "M12 7v5l3 2" })), e;
2753
2766
  }
2754
- function ii() {
2767
+ function ri() {
2755
2768
  const e = ue(
2756
2769
  "0 0 24 24",
2757
2770
  15,
@@ -2762,7 +2775,7 @@ function ii() {
2762
2775
  );
2763
2776
  return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
2764
2777
  }
2765
- function ai() {
2778
+ function li() {
2766
2779
  const e = ue(
2767
2780
  "0 0 24 24",
2768
2781
  14,
@@ -2775,7 +2788,7 @@ function ai() {
2775
2788
  P("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2776
2789
  ), e.appendChild(P("polyline", { points: "5 12 12 5 19 12" })), e;
2777
2790
  }
2778
- function Tr() {
2791
+ function Ar() {
2779
2792
  const e = ue(
2780
2793
  "0 0 24 24",
2781
2794
  16,
@@ -2793,7 +2806,7 @@ function Tr() {
2793
2806
  })
2794
2807
  ), e;
2795
2808
  }
2796
- function Pr() {
2809
+ function Ir() {
2797
2810
  const e = ue("0 0 24 24", 19, 19, "none", "currentColor");
2798
2811
  return e.setAttribute(
2799
2812
  "class",
@@ -2808,7 +2821,7 @@ function Pr() {
2808
2821
  })
2809
2822
  ), e;
2810
2823
  }
2811
- function Ar() {
2824
+ function Nr() {
2812
2825
  const e = ue("0 0 24 24", 18, 18, "currentColor");
2813
2826
  return e.appendChild(
2814
2827
  P("rect", {
@@ -2820,7 +2833,7 @@ function Ar() {
2820
2833
  })
2821
2834
  ), e;
2822
2835
  }
2823
- function Ir() {
2836
+ function Rr() {
2824
2837
  const e = ue(
2825
2838
  "0 0 24 24",
2826
2839
  12,
@@ -2831,7 +2844,7 @@ function Ir() {
2831
2844
  );
2832
2845
  return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
2833
2846
  }
2834
- function Nr() {
2847
+ function zr() {
2835
2848
  const e = ue(
2836
2849
  "0 0 24 24",
2837
2850
  13,
@@ -2866,30 +2879,30 @@ function ue(e, t, n, i, o, r) {
2866
2879
  return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), P("svg", l);
2867
2880
  }
2868
2881
  function P(e, t = {}) {
2869
- const n = document.createElementNS(Ko, e);
2882
+ const n = document.createElementNS(Xo, e);
2870
2883
  for (const [i, o] of Object.entries(t))
2871
2884
  n.setAttribute(i, o);
2872
2885
  return n;
2873
2886
  }
2874
- function To(e) {
2887
+ function Po(e) {
2875
2888
  for (const t of ["keydown", "keypress", "keyup"])
2876
2889
  e.addEventListener(t, (n) => {
2877
2890
  n.stopPropagation();
2878
2891
  });
2879
2892
  }
2880
- function Rr(e, t, n) {
2893
+ function Mr(e, t, n) {
2881
2894
  e.replaceChildren(), e.hidden = t.length === 0;
2882
2895
  for (const [i, o] of t.entries()) {
2883
2896
  const r = document.createElement("div");
2884
- r.className = "pluno-pa-widget__attachment", r.appendChild(zr(o));
2897
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Dr(o));
2885
2898
  const l = document.createElement("span");
2886
2899
  l.textContent = o.name, r.appendChild(l);
2887
2900
  const p = document.createElement("button");
2888
- p.type = "button", p.setAttribute("aria-label", `Remove ${o.name}`), p.appendChild(Ir()), p.addEventListener("click", () => n(i)), r.appendChild(p), e.appendChild(r);
2901
+ p.type = "button", p.setAttribute("aria-label", `Remove ${o.name}`), p.appendChild(Rr()), p.addEventListener("click", () => n(i)), r.appendChild(p), e.appendChild(r);
2889
2902
  }
2890
2903
  }
2891
- function zr(e) {
2892
- const t = On(e), n = ri(e);
2904
+ function Dr(e) {
2905
+ const t = Un(e), n = pi(e);
2893
2906
  if (t === "image" && n) {
2894
2907
  const i = document.createElement("img");
2895
2908
  return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener(
@@ -2909,8 +2922,8 @@ function zr(e) {
2909
2922
  }
2910
2923
  return ce(e);
2911
2924
  }
2912
- function Mr(e, t) {
2913
- const n = On(e), i = ri(e);
2925
+ function Or(e, t) {
2926
+ const n = Un(e), i = pi(e);
2914
2927
  if (n === "image" && i) {
2915
2928
  const o = document.createElement("img");
2916
2929
  o.className = "pluno-pa-widget__message-attachment-preview", o.alt = e.name;
@@ -2952,50 +2965,50 @@ function Mr(e, t) {
2952
2965
  function ce(e, t = "composer") {
2953
2966
  if (t === "composer") {
2954
2967
  const r = document.createElement("span");
2955
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = Po(e), r;
2968
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = Ao(e), r;
2956
2969
  }
2957
2970
  const n = document.createElement("div");
2958
2971
  n.className = "pluno-pa-widget__message-attachment-file";
2959
2972
  const i = document.createElement("span");
2960
- i.textContent = Po(e);
2973
+ i.textContent = Ao(e);
2961
2974
  const o = document.createElement("strong");
2962
2975
  return o.textContent = e.name, n.append(i, o), n;
2963
2976
  }
2964
- function On(e) {
2977
+ function Un(e) {
2965
2978
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2966
2979
  }
2967
- function ri(e) {
2980
+ function pi(e) {
2968
2981
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2969
2982
  }
2970
- function Po(e) {
2971
- const t = On(e);
2983
+ function Ao(e) {
2984
+ const t = Un(e);
2972
2985
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2973
2986
  }
2974
- function Dr(e, t) {
2987
+ function Ur(e, t) {
2975
2988
  return t ? Array.from(t).map((i) => ({
2976
2989
  ...e.createLocalAttachment(i),
2977
- previewUrl: Or(i)
2990
+ previewUrl: Br(i)
2978
2991
  })) : [];
2979
2992
  }
2980
- function Or(e) {
2993
+ function Br(e) {
2981
2994
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2982
2995
  }
2983
- function Nt(e) {
2996
+ function zt(e) {
2984
2997
  return !!(e && Array.from(e.types).includes("Files"));
2985
2998
  }
2986
- function Ur(e, t, n = null, i = !1, o) {
2987
- const r = pe(t) || Un(n), l = !r && i && Bt(t);
2988
- if (!e || !In(t, n) || l) {
2999
+ function Fr(e, t, n = null, i = !1, o) {
3000
+ const r = pe(t) || Bn(n), l = !r && i && Wt(t);
3001
+ if (!e || !Nn(t, n) || l) {
2989
3002
  e && (e.hidden = !0, e.replaceChildren());
2990
3003
  return;
2991
3004
  }
2992
3005
  e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", r ? e.appendChild(
2993
- Br(t, n)
2994
- ) : Bt(t) && e.appendChild(
2995
- Fr(t, o)
3006
+ Wr(t, n)
3007
+ ) : Wt(t) && e.appendChild(
3008
+ Hr(t, o)
2996
3009
  );
2997
3010
  }
2998
- function Br(e, t) {
3011
+ function Wr(e, t) {
2999
3012
  const n = document.createElement("div");
3000
3013
  n.className = "pluno-pa-widget__billing-action-card";
3001
3014
  const i = e.limitExceeded || t === "limit_exceeded", o = i && e.onboardingIncomplete === !0, r = document.createElement("strong");
@@ -3004,11 +3017,11 @@ function Br(e, t) {
3004
3017
  if (l.textContent = o ? "Complete onboarding to unlock credits and start using Pluno." : i ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(l), o) {
3005
3018
  const p = document.createElement("div");
3006
3019
  p.className = "pluno-pa-widget__billing-action-card-actions", p.appendChild(
3007
- Nn("Complete onboarding", e.onboardingUrl ?? "")
3020
+ Rn("Complete onboarding", e.onboardingUrl ?? "")
3008
3021
  ), n.appendChild(p);
3009
3022
  } else
3010
3023
  n.appendChild(
3011
- li(
3024
+ si(
3012
3025
  e,
3013
3026
  "Upgrade plan",
3014
3027
  "pluno-pa-widget__billing-action-card-actions"
@@ -3016,58 +3029,58 @@ function Br(e, t) {
3016
3029
  );
3017
3030
  return n;
3018
3031
  }
3019
- function Fr(e, t) {
3032
+ function Hr(e, t) {
3020
3033
  const n = document.createElement("div");
3021
3034
  if (n.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low", t) {
3022
3035
  const r = document.createElement("button");
3023
- r.type = "button", r.className = "pluno-pa-widget__billing-action-card-dismiss", r.setAttribute("aria-label", "Dismiss low credits warning"), r.title = "Dismiss", r.appendChild(ii()), r.addEventListener("click", t), n.appendChild(r);
3036
+ r.type = "button", r.className = "pluno-pa-widget__billing-action-card-dismiss", r.setAttribute("aria-label", "Dismiss low credits warning"), r.title = "Dismiss", r.appendChild(ri()), r.addEventListener("click", t), n.appendChild(r);
3024
3037
  }
3025
3038
  const i = document.createElement("strong");
3026
3039
  i.textContent = "Credits running low", n.appendChild(i);
3027
3040
  const o = document.createElement("span");
3028
- return o.textContent = Hr(e) ?? "Credits are running low for this period.", n.appendChild(o), n.appendChild(
3029
- li(
3041
+ return o.textContent = Gr(e) ?? "Credits are running low for this period.", n.appendChild(o), n.appendChild(
3042
+ si(
3030
3043
  e,
3031
3044
  "Upgrade",
3032
3045
  "pluno-pa-widget__billing-action-card-actions"
3033
3046
  )
3034
3047
  ), n;
3035
3048
  }
3036
- function In(e, t) {
3037
- return e !== null && (pe(e) || Bt(e) || Un(t));
3049
+ function Nn(e, t) {
3050
+ return e !== null && (pe(e) || Wt(e) || Bn(t));
3038
3051
  }
3039
- function Ao(e, t, n) {
3040
- return In(t, n) || Wr(t) ? !0 : !In(e, n);
3052
+ function Io(e, t, n) {
3053
+ return Nn(t, n) || $r(t) ? !0 : !Nn(e, n);
3041
3054
  }
3042
- function Wr(e) {
3055
+ function $r(e) {
3043
3056
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || pe(e));
3044
3057
  }
3045
3058
  function pe(e) {
3046
3059
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
3047
3060
  }
3048
- function Un(e) {
3061
+ function Bn(e) {
3049
3062
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
3050
3063
  }
3051
- function Bt(e) {
3064
+ function Wt(e) {
3052
3065
  return e != null && !pe(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
3053
3066
  }
3054
- function Hr(e) {
3055
- return e.creditsRemaining === null ? null : `${$r(e.creditsRemaining)} credits left`;
3067
+ function Gr(e) {
3068
+ return e.creditsRemaining === null ? null : `${qr(e.creditsRemaining)} credits left`;
3056
3069
  }
3057
- function $r(e) {
3070
+ function qr(e) {
3058
3071
  return new Intl.NumberFormat("en-US", {
3059
3072
  maximumFractionDigits: 0
3060
3073
  }).format(Math.ceil(e));
3061
3074
  }
3062
- function li(e, t, n) {
3075
+ function si(e, t, n) {
3063
3076
  const i = document.createElement("div");
3064
3077
  return i.className = n, i.appendChild(
3065
- Nn(t, e.pricingUrl)
3078
+ Rn(t, e.pricingUrl)
3066
3079
  ), i.appendChild(
3067
- Nn("Earn credits", e.earnCreditsUrl)
3080
+ Rn("Earn credits", e.earnCreditsUrl)
3068
3081
  ), i;
3069
3082
  }
3070
- function Nn(e, t) {
3083
+ function Rn(e, t) {
3071
3084
  const n = document.createElement("button");
3072
3085
  if (n.type = "button", e === "Earn credits") {
3073
3086
  const i = document.createElement("span");
@@ -3078,18 +3091,18 @@ function Nn(e, t) {
3078
3091
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
3079
3092
  }), n;
3080
3093
  }
3081
- function xn(e, t) {
3094
+ function yn(e, t) {
3082
3095
  return e.messages.filter(
3083
- (i) => !si(i)
3096
+ (i) => !ci(i)
3084
3097
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
3085
3098
  }
3086
- function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3087
- const ne = Yr(r), $ = Xr(
3088
- ne.filter((C) => !si(C))
3099
+ function jr(e, t, n, i, o, r, l, p, d, c, g, h, f, b, y, U, u, H, w, R, D, L) {
3100
+ const ne = el(r), $ = tl(
3101
+ ne.filter((C) => !ci(C))
3089
3102
  ), bt = e.scrollTop, qe = [], ge = /* @__PURE__ */ new Set(), B = (C) => {
3090
3103
  qe.push(C);
3091
3104
  };
3092
- ui(n, r.isThinking), o.hidden = !p, p && l !== null && ei(o, l);
3105
+ hi(n, r.isThinking), o.hidden = !p, p && l !== null && ni(o, l);
3093
3106
  const v = $.length > 0 || !!r.assistantDraft || r.isThinking;
3094
3107
  if (i(v), u || $.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
3095
3108
  const C = document.createElement("div");
@@ -3098,13 +3111,13 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3098
3111
  T.className = "pluno-pa-widget__empty-hero";
3099
3112
  const I = Re(
3100
3113
  "pluno-pa-widget__character--empty",
3101
- x()
3114
+ b()
3102
3115
  );
3103
3116
  if (T.appendChild(I), C.appendChild(T), u) {
3104
3117
  const E = document.createElement("h2");
3105
3118
  E.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", E.textContent = u.opening, C.appendChild(E);
3106
3119
  } else
3107
- C.appendChild(Qo());
3120
+ C.appendChild(ti());
3108
3121
  const Ee = u?.prompts ?? r.starterPrompts, oe = document.createElement("div");
3109
3122
  if (oe.className = Ee.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Ee.length === 0 && !r.starterPromptsLoading && oe.setAttribute("aria-hidden", "true"), Ee.length > 0)
3110
3123
  for (const E of Ee) {
@@ -3117,7 +3130,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3117
3130
  const E = document.createElement("button");
3118
3131
  E.type = "button", E.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", E.disabled = !0, E.tabIndex = -1, E.textContent = "Generating example tasks...", oe.appendChild(E);
3119
3132
  } else
3120
- for (let E = 0; E < La; E += 1) {
3133
+ for (let E = 0; E < Pa; E += 1) {
3121
3134
  const A = document.createElement("button");
3122
3135
  A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", oe.appendChild(A);
3123
3136
  }
@@ -3125,23 +3138,23 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3125
3138
  const E = document.createElement("button");
3126
3139
  E.type = "button", E.className = "pluno-pa-widget__morning-report-snooze", E.textContent = "Snooze morning report", E.addEventListener("click", H), C.appendChild(E);
3127
3140
  }
3128
- h.clear(), B(C), B(t), Io(e, qe);
3141
+ h.clear(), B(C), B(t), Ro(e, qe);
3129
3142
  return;
3130
3143
  }
3131
3144
  let F = null, j = null, Z = [], ze = [];
3132
- const K = $.length - 1, _t = K >= 0 && Rn($[K]), Me = Zr($);
3145
+ const K = $.length - 1, _t = K >= 0 && zn($[K]), Me = nl($);
3133
3146
  let he = !1;
3134
3147
  const me = () => {
3135
3148
  if (Z.length === 0)
3136
3149
  return he = !1, !1;
3137
3150
  const C = Me !== null && Z.some(
3138
- (I) => pi(I, Me)
3139
- ), T = al(
3151
+ (I) => di(I, Me)
3152
+ ), T = dl(
3140
3153
  Z,
3141
3154
  C,
3142
3155
  g,
3143
3156
  f,
3144
- x()
3157
+ b()
3145
3158
  );
3146
3159
  return B(T), F = null, j = T, Z = [], he = C, !0;
3147
3160
  }, z = () => {
@@ -3152,7 +3165,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3152
3165
  for (let C = 0; C < $.length; C += 1) {
3153
3166
  const T = $[C];
3154
3167
  if (T.role === "tool" && T.integrationAuthRequest && D) {
3155
- const E = qr(
3168
+ const E = Vr(
3156
3169
  T.integrationAuthRequest,
3157
3170
  D.states.get(
3158
3171
  T.integrationAuthRequest.authRequestId
@@ -3168,7 +3181,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3168
3181
  Z.push(T);
3169
3182
  continue;
3170
3183
  }
3171
- if (Rn(T)) {
3184
+ if (zn(T)) {
3172
3185
  if (C !== K)
3173
3186
  continue;
3174
3187
  if (me()) {
@@ -3177,7 +3190,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3177
3190
  B(A), F = null, j = A;
3178
3191
  }
3179
3192
  } else {
3180
- const A = zo(x());
3193
+ const A = Do(b());
3181
3194
  B(A), F = null, j = A;
3182
3195
  }
3183
3196
  continue;
@@ -3186,7 +3199,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3186
3199
  if (T.dataType === "run_error" || T.dataType === "run_status") {
3187
3200
  me();
3188
3201
  const E = document.createElement("div"), A = T.dataType === "run_error";
3189
- if (E.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", E.textContent = zn(
3202
+ if (E.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", E.textContent = Mn(
3190
3203
  T.content
3191
3204
  ), A && T.securitySettingsUrl) {
3192
3205
  const M = document.createElement("a");
@@ -3197,12 +3210,12 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3197
3210
  continue;
3198
3211
  }
3199
3212
  T.role === "user" && z();
3200
- const I = me(), Ee = zn(T.content);
3213
+ const I = me(), Ee = Mn(T.content);
3201
3214
  if (T.role === "assistant" && !I) {
3202
- const E = ci(x());
3215
+ const E = gi(b());
3203
3216
  B(E), F = null, j = E;
3204
3217
  }
3205
- const oe = jr(
3218
+ const oe = Kr(
3206
3219
  T,
3207
3220
  Ee,
3208
3221
  h,
@@ -3219,7 +3232,7 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3219
3232
  B(C), F = null, j = C;
3220
3233
  }
3221
3234
  } else {
3222
- const C = zo(x());
3235
+ const C = Do(b());
3223
3236
  B(C), F = null, j = C;
3224
3237
  }
3225
3238
  if (r.lastError) {
@@ -3239,9 +3252,9 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3239
3252
  }
3240
3253
  B(C), F = C, j = null;
3241
3254
  }
3242
- const Oe = L ? L.actionCandidate ?? (r.isThinking ? null : Gi(ne)) : null;
3255
+ const Oe = L ? L.actionCandidate ?? (r.isThinking ? null : ji(ne)) : null;
3243
3256
  if (L && Oe && !L.dismissedCandidateIds.has(Oe.id)) {
3244
- const C = nl(Oe, {
3257
+ const C = ll(Oe, {
3245
3258
  isActing: L.actionCandidate?.id === Oe.id,
3246
3259
  error: L.error,
3247
3260
  characterIconOptions: L.characterIconOptions,
@@ -3257,12 +3270,12 @@ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3257
3270
  "pluno-pa-widget__message--bottom-reserve"
3258
3271
  ), j?.classList.add(
3259
3272
  "pluno-pa-widget__bottom-reserve-compact"
3260
- ), B(t), Kr(
3273
+ ), B(t), Qr(
3261
3274
  h,
3262
3275
  ge
3263
- ), Io(e, qe), d ? mt(e, c) : e.scrollTop = bt;
3276
+ ), Ro(e, qe), d ? mt(e, c) : e.scrollTop = bt;
3264
3277
  }
3265
- function qr(e, t, n) {
3278
+ function Vr(e, t, n) {
3266
3279
  const i = document.createElement("section");
3267
3280
  i.className = "pluno-pa-widget__integration-auth-card", i.setAttribute("aria-label", `Connect ${e.appName}`);
3268
3281
  const o = document.createElement("div");
@@ -3280,29 +3293,52 @@ function qr(e, t, n) {
3280
3293
  const d = document.createElement("button");
3281
3294
  return d.type = "button", d.className = "pluno-pa-widget__integration-auth-button", d.disabled = t.status === "checking" || t.status === "connecting" || t.status === "completed", t.status === "checking" ? d.textContent = "Checking connection..." : t.status === "connecting" ? d.textContent = "Connecting..." : t.status === "completed" ? d.textContent = "Connected" : t.status === "expired" || t.status === "cancelled" ? d.textContent = `Reconnect ${e.appName}` : t.status === "error" ? d.textContent = "Try again" : d.textContent = `Connect ${e.appName}`, d.addEventListener("click", () => n(e)), i.appendChild(d), i;
3282
3295
  }
3283
- function jr(e, t, n, i, o) {
3284
- const r = Vr(e, t), l = r ? n.get(r) : void 0;
3285
- if (r && l)
3286
- return l.classList.remove(
3296
+ function Kr(e, t, n, i, o) {
3297
+ const r = Yr(e), l = Xr(
3298
+ e,
3299
+ t
3300
+ ), p = n.get(r);
3301
+ if (p)
3302
+ return p.node.classList.remove(
3287
3303
  "pluno-pa-widget__message--bottom-reserve"
3288
- ), i.add(r), l;
3289
- const p = document.createElement("div");
3290
- if (p.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? (e.phase && (p.dataset.phase = e.phase), cl(p, t)) : p.textContent = t, e.role === "user" && e.attachments?.length && p.appendChild(
3291
- el(
3292
- e.attachments,
3304
+ ), i.add(r), p.renderSignature === l ? (p.renderDeferred = !1, p.node) : Zr(p.node) ? (p.renderDeferred = !0, p.node) : (No(
3305
+ p.node,
3306
+ e,
3307
+ t,
3293
3308
  o
3309
+ ), p.renderSignature = l, p.renderDeferred = !1, p.node);
3310
+ const d = document.createElement("div");
3311
+ return No(
3312
+ d,
3313
+ e,
3314
+ t,
3315
+ o
3316
+ ), n.set(r, {
3317
+ node: d,
3318
+ renderSignature: l
3319
+ }), i.add(r), d;
3320
+ }
3321
+ function No(e, t, n, i) {
3322
+ if (e.className = `pluno-pa-widget__message pluno-pa-widget__message--${t.role}`, e.removeAttribute("data-phase"), t.role === "assistant" ? (t.phase && (e.dataset.phase = t.phase), e.replaceChildren(), fl(e, n)) : e.textContent = n, t.role === "user" && t.attachments?.length && e.appendChild(
3323
+ al(
3324
+ t.attachments,
3325
+ i
3294
3326
  )
3295
- ), e.phase !== "commentary") {
3296
- const d = document.createElement("div");
3297
- d.className = "pluno-pa-widget__message-actions", d.appendChild(tl(t)), p.appendChild(d);
3327
+ ), t.phase !== "commentary") {
3328
+ const o = document.createElement("div");
3329
+ o.className = "pluno-pa-widget__message-actions", o.appendChild(rl(n)), e.appendChild(o);
3298
3330
  }
3299
- return r && (n.set(r, p), i.add(r)), p;
3300
3331
  }
3301
- function Vr(e, t) {
3302
- return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
3303
- id: e.id,
3332
+ function Yr(e) {
3333
+ const t = e.assistantDraftItemId;
3334
+ return `${e.role}:${t ?? e.id}`;
3335
+ }
3336
+ function Xr(e, t) {
3337
+ return JSON.stringify({
3338
+ role: e.role,
3304
3339
  content: t,
3305
- attachments: e.attachments.map((n) => {
3340
+ phase: e.phase ?? null,
3341
+ attachments: (e.attachments ?? []).map((n) => {
3306
3342
  const { previewUrl: i } = n;
3307
3343
  return {
3308
3344
  id: n.id ?? null,
@@ -3316,11 +3352,25 @@ function Vr(e, t) {
3316
3352
  })
3317
3353
  });
3318
3354
  }
3319
- function Kr(e, t) {
3355
+ function Zr(e) {
3356
+ const t = e.ownerDocument.getSelection();
3357
+ if (!t || t.isCollapsed)
3358
+ return !1;
3359
+ for (let n = 0; n < t.rangeCount; n += 1)
3360
+ if (t.getRangeAt(n).intersectsNode(e))
3361
+ return !0;
3362
+ return !1;
3363
+ }
3364
+ function Jr(e) {
3365
+ return Array.from(e.values()).some(
3366
+ (t) => t.renderDeferred === !0
3367
+ );
3368
+ }
3369
+ function Qr(e, t) {
3320
3370
  for (const n of e.keys())
3321
3371
  t.has(n) || e.delete(n);
3322
3372
  }
3323
- function Io(e, t) {
3373
+ function Ro(e, t) {
3324
3374
  let n = e.firstChild;
3325
3375
  for (const i of t) {
3326
3376
  if (i === n) {
@@ -3334,11 +3384,11 @@ function Io(e, t) {
3334
3384
  n = n.nextSibling, e.removeChild(i);
3335
3385
  }
3336
3386
  }
3337
- function Yr(e) {
3387
+ function el(e) {
3338
3388
  if (!e.assistantDraft)
3339
3389
  return [...e.messages];
3340
3390
  const t = {
3341
- id: "assistant-draft",
3391
+ id: e.assistantDraftItemId ?? "assistant-draft",
3342
3392
  role: "assistant",
3343
3393
  ...e.assistantDraftPhase ? { phase: e.assistantDraftPhase } : {},
3344
3394
  content: e.assistantDraft,
@@ -3355,7 +3405,7 @@ function Yr(e) {
3355
3405
  if (n === -1)
3356
3406
  return [...e.messages, t];
3357
3407
  const i = e.messages.findIndex(
3358
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && No(r, t) && Rn(r)
3408
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && zo(r, t) && zn(r)
3359
3409
  );
3360
3410
  if (i !== -1)
3361
3411
  return [
@@ -3364,7 +3414,7 @@ function Yr(e) {
3364
3414
  ...e.messages.slice(i + 1)
3365
3415
  ];
3366
3416
  let o = n + 1;
3367
- for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && No(e.messages[o], t); )
3417
+ for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && zo(e.messages[o], t); )
3368
3418
  o += 1;
3369
3419
  return [
3370
3420
  ...e.messages.slice(0, o),
@@ -3372,39 +3422,39 @@ function Yr(e) {
3372
3422
  ...e.messages.slice(o)
3373
3423
  ];
3374
3424
  }
3375
- function Xr(e) {
3425
+ function tl(e) {
3376
3426
  return e.map(
3377
3427
  (t) => t.role === "assistant" && t.phase === "commentary" ? { ...t, role: "tool" } : t
3378
3428
  );
3379
3429
  }
3380
- function Zr(e) {
3430
+ function nl(e) {
3381
3431
  const t = [...e].reverse().find((n) => n.role === "user");
3382
3432
  for (let n = e.length - 1; n >= 0; n -= 1) {
3383
3433
  const i = e[n];
3384
3434
  if (!(i.role !== "tool" || e.slice(n + 1).some(
3385
- (r) => (Jr(r) || Qr(r)) && pi(i, r)
3435
+ (r) => (ol(r) || il(r)) && di(i, r)
3386
3436
  )) && (i.loading || i.dataType === "assistant_draft" || t && i.respondsToUserMessageId === t.id))
3387
3437
  return i;
3388
3438
  }
3389
3439
  return null;
3390
3440
  }
3391
- function Jr(e) {
3441
+ function ol(e) {
3392
3442
  return e.role === "assistant" && e.phase !== "commentary";
3393
3443
  }
3394
- function Qr(e) {
3444
+ function il(e) {
3395
3445
  return e.role === "system" && (e.dataType === "run_error" || e.dataType === "run_status" && e.loading !== !0);
3396
3446
  }
3397
- function pi(e, t) {
3447
+ function di(e, t) {
3398
3448
  return e.respondsToUserMessageId && t.respondsToUserMessageId ? e.respondsToUserMessageId === t.respondsToUserMessageId : e.runId && t.runId ? e.runId === t.runId : e.id === t.id;
3399
3449
  }
3400
- function Rn(e) {
3450
+ function zn(e) {
3401
3451
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
3402
3452
  }
3403
- function No(e, t) {
3453
+ function zo(e, t) {
3404
3454
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
3405
3455
  }
3406
- function Ro(e, t, n, i, o, r, l, p) {
3407
- e.replaceChildren(), ui(t, !1), t.disabled = !0, n(!1);
3456
+ function Mo(e, t, n, i, o, r, l, p) {
3457
+ e.replaceChildren(), hi(t, !1), t.disabled = !0, n(!1);
3408
3458
  const d = document.createElement("div");
3409
3459
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
3410
3460
  const c = Re(
@@ -3422,23 +3472,23 @@ function Ro(e, t, n, i, o, r, l, p) {
3422
3472
  }
3423
3473
  e.appendChild(d);
3424
3474
  }
3425
- function el(e, t) {
3475
+ function al(e, t) {
3426
3476
  const n = document.createElement("div");
3427
3477
  n.className = "pluno-pa-widget__message-attachments";
3428
3478
  for (const i of e)
3429
3479
  n.appendChild(
3430
- Mr(i, t)
3480
+ Or(i, t)
3431
3481
  );
3432
3482
  return n;
3433
3483
  }
3434
- function tl(e) {
3484
+ function rl(e) {
3435
3485
  const t = document.createElement("button");
3436
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Nr()), t.addEventListener("click", (n) => {
3486
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(zr()), t.addEventListener("click", (n) => {
3437
3487
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
3438
3488
  }), t;
3439
3489
  }
3440
- function nl(e, t) {
3441
- const n = qi(e.id), i = document.createElement("article");
3490
+ function ll(e, t) {
3491
+ const n = Vi(e.id), i = document.createElement("article");
3442
3492
  i.className = "pluno-pa-widget__share-prompt";
3443
3493
  const o = document.createElement("div");
3444
3494
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
@@ -3476,18 +3526,18 @@ function nl(e, t) {
3476
3526
  const f = document.createElement("button");
3477
3527
  f.type = "button", f.className = "pluno-pa-widget__share-prompt-draft", f.disabled = t.isActing, f.addEventListener("click", () => {
3478
3528
  t.onReferralCopy(e);
3479
- }), t.isActing ? (f.appendChild(pl()), f.appendChild(document.createTextNode("Copying..."))) : f.textContent = "Copy invite link", c.appendChild(f);
3529
+ }), t.isActing ? (f.appendChild(gl()), f.appendChild(document.createTextNode("Copying..."))) : f.textContent = "Copy invite link", c.appendChild(f);
3480
3530
  } else
3481
- for (const f of ol()) {
3482
- const x = document.createElement("a");
3483
- x.className = "pluno-pa-widget__share-prompt-social", x.href = f.href, x.target = "_blank", x.rel = "noopener noreferrer", x.setAttribute("aria-label", `Open ${f.label}`), x.title = f.label, x.appendChild(il(f.id)), x.addEventListener("click", () => t.onSocialShare(e)), c.appendChild(x);
3531
+ for (const f of pl()) {
3532
+ const b = document.createElement("a");
3533
+ b.className = "pluno-pa-widget__share-prompt-social", b.href = f.href, b.target = "_blank", b.rel = "noopener noreferrer", b.setAttribute("aria-label", `Open ${f.label}`), b.title = f.label, b.appendChild(sl(f.id)), b.addEventListener("click", () => t.onSocialShare(e)), c.appendChild(b);
3484
3534
  }
3485
3535
  const g = document.createElement("button");
3486
3536
  g.type = "button", g.className = "pluno-pa-widget__share-prompt-dismiss", g.setAttribute("aria-label", "Dismiss share prompt"), g.title = "Dismiss", g.textContent = "Dismiss", g.addEventListener("click", () => t.onDismiss(e)), c.appendChild(g), d.appendChild(c);
3487
3537
  const h = document.createElement("button");
3488
3538
  return h.type = "button", h.className = "pluno-pa-widget__share-prompt-disable", h.textContent = "Don't ask again", h.addEventListener("click", () => t.onDisable(e)), d.appendChild(h), o.appendChild(d), i.appendChild(o), i;
3489
3539
  }
3490
- function ol() {
3540
+ function pl() {
3491
3541
  const e = "https://pluno.ai/browser", t = `I just used @pluno_ai to get work done directly inside my tools. Worth trying: ${e}`;
3492
3542
  return [
3493
3543
  {
@@ -3507,7 +3557,7 @@ function ol() {
3507
3557
  }
3508
3558
  ];
3509
3559
  }
3510
- function il(e) {
3560
+ function sl(e) {
3511
3561
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3512
3562
  t.setAttribute("class", "pluno-pa-widget__share-prompt-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true");
3513
3563
  const n = (i, o) => {
@@ -3516,13 +3566,13 @@ function il(e) {
3516
3566
  };
3517
3567
  return e === "linkedin" ? (n("M6.7 13.2c.4 4.1.2 8.1.1 12.3"), n("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"), n("M14.4 13.3c.1 3.8.1 7.8 0 11.9"), n("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"), n("M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (n("M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), n("M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), n("M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (n("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"), n("M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), n("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"), n("M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
3518
3568
  }
3519
- function si(e) {
3520
- return e.role === "tool" && e.toolName === Ho;
3569
+ function ci(e) {
3570
+ return e.role === "tool" && e.toolName === Go;
3521
3571
  }
3522
- function zn(e) {
3572
+ function Mn(e) {
3523
3573
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3524
3574
  }
3525
- function al(e, t, n, i, o) {
3575
+ function dl(e, t, n, i, o) {
3526
3576
  const r = document.createElement("article");
3527
3577
  r.className = "pluno-pa-widget__tool-group", r.classList.toggle("pluno-pa-widget__tool-group--active", t), r.title = new Date(
3528
3578
  e[e.length - 1].createdAt
@@ -3532,12 +3582,12 @@ function al(e, t, n, i, o) {
3532
3582
  o
3533
3583
  )
3534
3584
  );
3535
- const l = rl(e, t);
3585
+ const l = cl(e, t);
3536
3586
  if (t) {
3537
3587
  const y = document.createElement("div");
3538
3588
  return y.className = "pluno-pa-widget__tool-active-content", y.appendChild(wt()), y.appendChild(l), r.appendChild(y), r;
3539
3589
  }
3540
- const p = document.createElement("details"), d = ll(e);
3590
+ const p = document.createElement("details"), d = ul(e);
3541
3591
  p.open = n.has(d), r.classList.toggle("pluno-pa-widget__tool-group--open", p.open), p.addEventListener("toggle", () => {
3542
3592
  r.classList.toggle("pluno-pa-widget__tool-group--open", p.open), p.open ? n.add(d) : n.delete(d), i();
3543
3593
  });
@@ -3547,10 +3597,10 @@ function al(e, t, n, i, o) {
3547
3597
  (y) => y.phase !== "commentary" && y.loading
3548
3598
  ), f = document.createElement("span");
3549
3599
  f.className = "pluno-pa-widget__tool-summary-title";
3550
- const x = g ? di(g.content) : "Activity";
3551
- return f.textContent = x, h && (f.classList.add("pluno-pa-widget__tool-summary-title--loading"), f.dataset.loadingText = x), c.appendChild(f), p.appendChild(c), p.appendChild(l), r.appendChild(p), r;
3600
+ const b = g ? ui(g.content) : "Activity";
3601
+ return f.textContent = b, h && (f.classList.add("pluno-pa-widget__tool-summary-title--loading"), f.dataset.loadingText = b), c.appendChild(f), p.appendChild(c), p.appendChild(l), r.appendChild(p), r;
3552
3602
  }
3553
- function rl(e, t) {
3603
+ function cl(e, t) {
3554
3604
  const n = document.createElement("div");
3555
3605
  n.className = "pluno-pa-widget__tool-lines";
3556
3606
  const i = e[e.length - 1];
@@ -3559,16 +3609,16 @@ function rl(e, t) {
3559
3609
  r.className = "pluno-pa-widget__tool-line", r.dataset.eventType = o.phase === "commentary" ? "commentary" : "tool";
3560
3610
  const l = document.createElement("span");
3561
3611
  l.className = "pluno-pa-widget__tool-line-text";
3562
- const p = zn(o.content) || (o.phase === "commentary" ? "" : "Run tool"), d = o.phase === "commentary" ? p : di(p);
3612
+ const p = Mn(o.content) || (o.phase === "commentary" ? "" : "Run tool"), d = o.phase === "commentary" ? p : ui(p);
3563
3613
  t && o === i && o.phase !== "commentary" && (l.classList.add("pluno-pa-widget__tool-line-text--loading"), l.dataset.loadingText = d), l.textContent = d, r.appendChild(l), n.appendChild(r);
3564
3614
  }
3565
3615
  return n;
3566
3616
  }
3567
- function di(e) {
3617
+ function ui(e) {
3568
3618
  const t = e.trim() || "Run tool", n = t.codePointAt(0) ?? 0;
3569
3619
  return n >= 126976 && n <= 129791 || n >= 9728 && n <= 10175 || n >= 127462 && n <= 127487 ? t : `🛠️ ${t}`;
3570
3620
  }
3571
- function ci(e) {
3621
+ function gi(e) {
3572
3622
  const t = document.createElement("article");
3573
3623
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3574
3624
  Re(
@@ -3577,8 +3627,8 @@ function ci(e) {
3577
3627
  )
3578
3628
  ), t;
3579
3629
  }
3580
- function zo(e) {
3581
- const t = ci(e);
3630
+ function Do(e) {
3631
+ const t = gi(e);
3582
3632
  return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(wt()), t;
3583
3633
  }
3584
3634
  function wt(e = "Thinking...") {
@@ -3589,17 +3639,17 @@ function wt(e = "Thinking...") {
3589
3639
  const i = document.createElement("span");
3590
3640
  return i.textContent = e, t.appendChild(i), t;
3591
3641
  }
3592
- function ll(e) {
3642
+ function ul(e) {
3593
3643
  return `tools:${e[0]?.id ?? ""}`;
3594
3644
  }
3595
- function pl() {
3645
+ function gl() {
3596
3646
  const e = document.createElement("span");
3597
3647
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3598
3648
  }
3599
- function ui(e, t) {
3600
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ar() : ai());
3649
+ function hi(e, t) {
3650
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Nr() : li());
3601
3651
  }
3602
- function yn(e) {
3652
+ function vn(e) {
3603
3653
  let t = e.trim();
3604
3654
  if (!t.includes("|"))
3605
3655
  return null;
@@ -3612,18 +3662,18 @@ function yn(e) {
3612
3662
  }
3613
3663
  return n.push(i.trim()), n.length > 1 ? n : null;
3614
3664
  }
3615
- function sl(e) {
3665
+ function hl(e) {
3616
3666
  const t = e.trim();
3617
3667
  if (/^:?-{3,}:?$/.test(t))
3618
3668
  return t.startsWith(":") && t.endsWith(":") ? "center" : t.endsWith(":") ? "right" : t.startsWith(":") ? "left" : null;
3619
3669
  }
3620
- function dl(e, t) {
3621
- const n = yn(e[t] ?? ""), i = yn(e[t + 1] ?? "");
3670
+ function ml(e, t) {
3671
+ const n = vn(e[t] ?? ""), i = vn(e[t + 1] ?? "");
3622
3672
  if (!n || !i || n.length !== i.length)
3623
3673
  return null;
3624
3674
  const o = [];
3625
3675
  for (const h of i) {
3626
- const f = sl(h);
3676
+ const f = hl(h);
3627
3677
  if (f === void 0)
3628
3678
  return null;
3629
3679
  o.push(f);
@@ -3632,25 +3682,25 @@ function dl(e, t) {
3632
3682
  r.className = "pluno-pa-widget__table-scroll";
3633
3683
  const l = document.createElement("table"), p = document.createElement("thead"), d = document.createElement("tr");
3634
3684
  n.forEach((h, f) => {
3635
- const x = document.createElement("th"), y = o[f];
3636
- y && x.classList.add(`pluno-pa-widget__table-cell--${y}`), Ne(x, h), d.appendChild(x);
3685
+ const b = document.createElement("th"), y = o[f];
3686
+ y && b.classList.add(`pluno-pa-widget__table-cell--${y}`), Ne(b, h), d.appendChild(b);
3637
3687
  }), p.appendChild(d), l.appendChild(p);
3638
3688
  const c = document.createElement("tbody");
3639
3689
  let g = t + 2;
3640
3690
  for (; g < e.length && e[g].trim(); ) {
3641
- const h = yn(e[g]);
3691
+ const h = vn(e[g]);
3642
3692
  if (!h)
3643
3693
  break;
3644
3694
  const f = document.createElement("tr");
3645
- n.forEach((x, y) => {
3695
+ n.forEach((b, y) => {
3646
3696
  const U = document.createElement("td"), u = o[y];
3647
3697
  u && U.classList.add(`pluno-pa-widget__table-cell--${u}`), Ne(U, h[y] ?? ""), f.appendChild(U);
3648
3698
  }), c.appendChild(f), g += 1;
3649
3699
  }
3650
3700
  return l.appendChild(c), r.appendChild(l), { element: r, nextIndex: g };
3651
3701
  }
3652
- function cl(e, t) {
3653
- const n = da(t).replace(/\r\n/g, `
3702
+ function fl(e, t) {
3703
+ const n = ua(t).replace(/\r\n/g, `
3654
3704
  `).split(`
3655
3705
  `);
3656
3706
  let i = 0;
@@ -3665,12 +3715,12 @@ function cl(e, t) {
3665
3715
  for (i += 1; i < n.length && !/^```\s*$/.test(n[i]); )
3666
3716
  h.push(n[i]), i += 1;
3667
3717
  i += i < n.length ? 1 : 0;
3668
- const f = document.createElement("pre"), x = document.createElement("code");
3669
- x.textContent = h.join(`
3670
- `), f.appendChild(x), e.appendChild(f);
3718
+ const f = document.createElement("pre"), b = document.createElement("code");
3719
+ b.textContent = h.join(`
3720
+ `), f.appendChild(b), e.appendChild(f);
3671
3721
  continue;
3672
3722
  }
3673
- const l = dl(n, i);
3723
+ const l = ml(n, i);
3674
3724
  if (l) {
3675
3725
  e.appendChild(l.element), i = l.nextIndex;
3676
3726
  continue;
@@ -3729,7 +3779,7 @@ function Ne(e, t) {
3729
3779
  Ne(p, l.slice(1, -1)), e.appendChild(p);
3730
3780
  } else {
3731
3781
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3732
- if (p && ul(p[2])) {
3782
+ if (p && wl(p[2])) {
3733
3783
  const d = document.createElement("a");
3734
3784
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3735
3785
  } else
@@ -3739,7 +3789,7 @@ function Ne(e, t) {
3739
3789
  }
3740
3790
  i < t.length && e.appendChild(document.createTextNode(t.slice(i)));
3741
3791
  }
3742
- function ul(e) {
3792
+ function wl(e) {
3743
3793
  if (e.startsWith("/") || e.startsWith("#"))
3744
3794
  return !0;
3745
3795
  try {
@@ -3749,8 +3799,8 @@ function ul(e) {
3749
3799
  return !1;
3750
3800
  }
3751
3801
  }
3752
- function Mo(e, t) {
3753
- if (gl(e))
3802
+ function Oo(e, t) {
3803
+ if (bl(e))
3754
3804
  return;
3755
3805
  const n = `
3756
3806
  :host {
@@ -5830,8 +5880,8 @@ function Mo(e, t) {
5830
5880
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5831
5881
  position: absolute;
5832
5882
  top: -16px;
5833
- left: ${Ln}px;
5834
- width: calc(100% - ${Ln * 2}px);
5883
+ left: ${Tn}px;
5884
+ width: calc(100% - ${Tn * 2}px);
5835
5885
  height: 36px;
5836
5886
  z-index: 3;
5837
5887
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -6323,28 +6373,28 @@ function Mo(e, t) {
6323
6373
  }
6324
6374
  }
6325
6375
  `;
6326
- if (hl(e, n))
6376
+ if (_l(e, n))
6327
6377
  return;
6328
6378
  const i = e.ownerDocument.createElement("style");
6329
- i.id = Zo, i.textContent = n, e.appendChild(i), gi(e);
6379
+ i.id = Qo, i.textContent = n, e.appendChild(i), mi(e);
6330
6380
  }
6331
- function gl(e) {
6332
- return e.getElementById(Zo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Jo) === "true";
6381
+ function bl(e) {
6382
+ return e.getElementById(Qo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(ei) === "true";
6333
6383
  }
6334
- function gi(e) {
6335
- e.host instanceof HTMLElement && e.host.setAttribute(Jo, "true");
6384
+ function mi(e) {
6385
+ e.host instanceof HTMLElement && e.host.setAttribute(ei, "true");
6336
6386
  }
6337
- function hl(e, t) {
6387
+ function _l(e, t) {
6338
6388
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
6339
6389
  return !1;
6340
6390
  try {
6341
6391
  const n = new CSSStyleSheet();
6342
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], gi(e), !0;
6392
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], mi(e), !0;
6343
6393
  } catch {
6344
6394
  return !1;
6345
6395
  }
6346
6396
  }
6347
- async function ml() {
6397
+ async function xl() {
6348
6398
  return document.body ? document.body : await new Promise((e) => {
6349
6399
  const t = new MutationObserver(() => {
6350
6400
  document.body && (t.disconnect(), e(document.body));
@@ -6352,25 +6402,25 @@ async function ml() {
6352
6402
  t.observe(document.documentElement, { childList: !0 });
6353
6403
  });
6354
6404
  }
6355
- function Bn(e) {
6405
+ function Fn(e) {
6356
6406
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
6357
6407
  }
6358
- function hi(e) {
6359
- return `${Bn(e)}.displayState`;
6408
+ function fi(e) {
6409
+ return `${Fn(e)}.displayState`;
6360
6410
  }
6361
- function fl(e) {
6411
+ function yl(e) {
6362
6412
  try {
6363
6413
  return window.sessionStorage.getItem(
6364
- hi(e)
6414
+ fi(e)
6365
6415
  ) === "minimized" ? "minimized" : "shown";
6366
6416
  } catch {
6367
6417
  return "shown";
6368
6418
  }
6369
6419
  }
6370
- function Do(e, t) {
6420
+ function Uo(e, t) {
6371
6421
  if (e.layout === "floating")
6372
6422
  try {
6373
- const n = hi(e);
6423
+ const n = fi(e);
6374
6424
  if (t === "minimized") {
6375
6425
  window.sessionStorage.setItem(n, t);
6376
6426
  return;
@@ -6380,15 +6430,15 @@ function Do(e, t) {
6380
6430
  return;
6381
6431
  }
6382
6432
  }
6383
- function wl(e) {
6433
+ function vl(e) {
6384
6434
  if (e)
6385
6435
  return { clientId: e, release: () => {
6386
6436
  } };
6387
6437
  let t = 0;
6388
- for (; un.has(t); )
6438
+ for (; gn.has(t); )
6389
6439
  t += 1;
6390
- un.add(t);
6391
- const n = `${Ea}${t}`;
6440
+ gn.add(t);
6441
+ const n = `${La}${t}`;
6392
6442
  let i = crypto.randomUUID();
6393
6443
  try {
6394
6444
  i = window.sessionStorage.getItem(n) ?? i, window.sessionStorage.setItem(n, i);
@@ -6398,15 +6448,15 @@ function wl(e) {
6398
6448
  return {
6399
6449
  clientId: i,
6400
6450
  release: () => {
6401
- o || (o = !0, un.delete(t));
6451
+ o || (o = !0, gn.delete(t));
6402
6452
  }
6403
6453
  };
6404
6454
  }
6405
- function bl(e) {
6455
+ function Sl(e) {
6406
6456
  try {
6407
- const t = window.localStorage.getItem(Bn(e));
6457
+ const t = window.localStorage.getItem(Fn(e));
6408
6458
  if (!t)
6409
- return Oo();
6459
+ return Bo();
6410
6460
  const n = JSON.parse(t);
6411
6461
  return {
6412
6462
  isOpen: n.isOpen === !0,
@@ -6416,25 +6466,25 @@ function bl(e) {
6416
6466
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
6417
6467
  (i) => typeof i == "string"
6418
6468
  ) : [],
6419
- launcherPosition: vl(n.launcherPosition) ? n.launcherPosition : null,
6420
- panelSize: Sl(n.panelSize) ? Ft(n.panelSize) : null,
6421
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-$o) : [],
6469
+ launcherPosition: Ll(n.launcherPosition) ? n.launcherPosition : null,
6470
+ panelSize: Tl(n.panelSize) ? Ht(n.panelSize) : null,
6471
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-qo) : [],
6422
6472
  sharePromptsDisabled: n.sharePromptsDisabled === !0
6423
6473
  };
6424
6474
  } catch {
6425
- return Oo();
6475
+ return Bo();
6426
6476
  }
6427
6477
  }
6428
- async function _l(e) {
6478
+ async function Cl(e) {
6429
6479
  if (e.loadSharePromptsDisabled)
6430
6480
  return e.loadSharePromptsDisabled();
6431
6481
  try {
6432
- return window.localStorage.getItem(qo) === "true";
6482
+ return window.localStorage.getItem(Vo) === "true";
6433
6483
  } catch {
6434
6484
  return !1;
6435
6485
  }
6436
6486
  }
6437
- function xl(e, t) {
6487
+ function El(e, t) {
6438
6488
  if (e.persistSharePromptsDisabled) {
6439
6489
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
6440
6490
  () => {
@@ -6443,12 +6493,12 @@ function xl(e, t) {
6443
6493
  return;
6444
6494
  }
6445
6495
  try {
6446
- t && window.localStorage.setItem(qo, "true");
6496
+ t && window.localStorage.setItem(Vo, "true");
6447
6497
  } catch {
6448
6498
  return;
6449
6499
  }
6450
6500
  }
6451
- function Oo() {
6501
+ function Bo() {
6452
6502
  return {
6453
6503
  isOpen: !1,
6454
6504
  composerValue: "",
@@ -6461,29 +6511,29 @@ function Oo() {
6461
6511
  sharePromptsDisabled: !1
6462
6512
  };
6463
6513
  }
6464
- function yl(e, t) {
6514
+ function kl(e, t) {
6465
6515
  try {
6466
6516
  window.localStorage.setItem(
6467
- Bn(e),
6517
+ Fn(e),
6468
6518
  JSON.stringify(t)
6469
6519
  );
6470
6520
  } catch {
6471
6521
  return;
6472
6522
  }
6473
6523
  }
6474
- function vl(e) {
6524
+ function Ll(e) {
6475
6525
  if (!e || typeof e != "object")
6476
6526
  return !1;
6477
6527
  const t = e;
6478
6528
  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");
6479
6529
  }
6480
- function Sl(e) {
6530
+ function Tl(e) {
6481
6531
  if (!e || typeof e != "object")
6482
6532
  return !1;
6483
6533
  const t = e;
6484
6534
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
6485
6535
  }
6486
- async function mi(e, t) {
6536
+ async function wi(e, t) {
6487
6537
  const n = await fetch(e, {
6488
6538
  method: "POST",
6489
6539
  credentials: "include",
@@ -6495,7 +6545,7 @@ async function mi(e, t) {
6495
6545
  ...t ? { signal: t } : {}
6496
6546
  });
6497
6547
  if (!n.ok) {
6498
- const o = await n.text(), r = Oi(o);
6548
+ const o = await n.text(), r = Bi(o);
6499
6549
  throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
6500
6550
  }
6501
6551
  const i = await n.json();
@@ -6503,15 +6553,15 @@ async function mi(e, t) {
6503
6553
  throw new Error("Pluno token endpoint did not return a token");
6504
6554
  return i.token;
6505
6555
  }
6506
- function Cl(e) {
6556
+ function Pl(e) {
6507
6557
  let t = !1, n = !1;
6508
6558
  const i = async () => {
6509
6559
  const o = new AbortController();
6510
6560
  let r = !1;
6511
6561
  const l = new Promise((p, d) => {
6512
6562
  const c = window.setTimeout(() => {
6513
- r = !0, o.abort(), d(new Error(go));
6514
- }, Sa);
6563
+ r = !0, o.abort(), d(new Error(ho));
6564
+ }, Ea);
6515
6565
  o.signal.addEventListener(
6516
6566
  "abort",
6517
6567
  () => window.clearTimeout(c),
@@ -6520,12 +6570,12 @@ function Cl(e) {
6520
6570
  });
6521
6571
  try {
6522
6572
  const p = await Promise.race([
6523
- mi(e, o.signal),
6573
+ wi(e, o.signal),
6524
6574
  l
6525
6575
  ]);
6526
6576
  return o.abort(), p;
6527
6577
  } catch (p) {
6528
- throw o.abort(), r ? new Error(go) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Ca);
6578
+ throw o.abort(), r ? new Error(ho) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(ka);
6529
6579
  }
6530
6580
  };
6531
6581
  return {
@@ -6548,30 +6598,30 @@ function Cl(e) {
6548
6598
  }
6549
6599
  };
6550
6600
  }
6551
- const Uo = /* @__PURE__ */ new WeakSet();
6552
- function El(e) {
6601
+ const Fo = /* @__PURE__ */ new WeakSet();
6602
+ function Al(e) {
6553
6603
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
6554
6604
  }
6555
- function Bo(e) {
6605
+ function Wo(e) {
6556
6606
  const t = e.pathname.split("/");
6557
6607
  return t[t.length - 1] ?? "";
6558
6608
  }
6559
- function kl(e, t) {
6609
+ function Il(e, t) {
6560
6610
  const n = new URL(e.src, document.baseURI);
6561
- return n.href === t.href || n.pathname === t.pathname ? !0 : Bo(n) === Bo(t);
6611
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Wo(n) === Wo(t);
6562
6612
  }
6563
6613
  class Ce extends EventTarget {
6564
6614
  constructor(t, n) {
6565
- super(), this.channelId = n, this.url = t, this.addPreviewListener(ba, () => {
6615
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(xa, () => {
6566
6616
  this.readyState = Ce.OPEN, this.dispatchEvent(new Event("open"));
6567
- }), this.addPreviewListener(_a, (i) => {
6617
+ }), this.addPreviewListener(ya, (i) => {
6568
6618
  const o = i;
6569
6619
  this.dispatchEvent(
6570
6620
  new MessageEvent("message", { data: o.detail?.data ?? "" })
6571
6621
  );
6572
- }), this.addPreviewListener(xa, () => {
6622
+ }), this.addPreviewListener(va, () => {
6573
6623
  this.readyState = Ce.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
6574
- }), this.addPreviewListener(ya, (i) => {
6624
+ }), this.addPreviewListener(Sa, (i) => {
6575
6625
  const o = i;
6576
6626
  this.readyState = Ce.CLOSED, this.dispatchEvent(
6577
6627
  new CloseEvent("close", {
@@ -6582,8 +6632,8 @@ class Ce extends EventTarget {
6582
6632
  ), this.cleanup();
6583
6633
  }), window.dispatchEvent(
6584
6634
  new CustomEvent(
6585
- Rt(
6586
- ma,
6635
+ Mt(
6636
+ wa,
6587
6637
  this.channelId
6588
6638
  ),
6589
6639
  {
@@ -6603,7 +6653,7 @@ class Ce extends EventTarget {
6603
6653
  binaryType = "blob";
6604
6654
  bufferedAmount = 0;
6605
6655
  readyState = Ce.CONNECTING;
6606
- socketId = Ll();
6656
+ socketId = Nl();
6607
6657
  listeners = /* @__PURE__ */ new Map();
6608
6658
  send(t) {
6609
6659
  if (this.readyState !== Ce.OPEN)
@@ -6613,7 +6663,7 @@ class Ce extends EventTarget {
6613
6663
  );
6614
6664
  window.dispatchEvent(
6615
6665
  new CustomEvent(
6616
- Rt(fa, this.channelId),
6666
+ Mt(ba, this.channelId),
6617
6667
  {
6618
6668
  detail: {
6619
6669
  socketId: this.socketId,
@@ -6626,7 +6676,7 @@ class Ce extends EventTarget {
6626
6676
  close(t, n) {
6627
6677
  this.readyState !== Ce.CLOSED && (this.readyState = Ce.CLOSING, window.dispatchEvent(
6628
6678
  new CustomEvent(
6629
- Rt(wa, this.channelId),
6679
+ Mt(_a, this.channelId),
6630
6680
  {
6631
6681
  detail: { socketId: this.socketId, code: t, reason: n }
6632
6682
  }
@@ -6634,7 +6684,7 @@ class Ce extends EventTarget {
6634
6684
  ), this.cleanup());
6635
6685
  }
6636
6686
  addPreviewListener(t, n) {
6637
- const i = Rt(
6687
+ const i = Mt(
6638
6688
  t,
6639
6689
  this.channelId
6640
6690
  ), o = (r) => {
@@ -6648,19 +6698,19 @@ class Ce extends EventTarget {
6648
6698
  this.listeners.clear();
6649
6699
  }
6650
6700
  }
6651
- function Ll() {
6701
+ function Nl() {
6652
6702
  const e = window.sessionStorage.getItem(
6653
- uo
6703
+ go
6654
6704
  );
6655
6705
  if (e)
6656
6706
  return e;
6657
6707
  const t = crypto.randomUUID();
6658
- return window.sessionStorage.setItem(uo, t), t;
6708
+ return window.sessionStorage.setItem(go, t), t;
6659
6709
  }
6660
- function Rt(e, t) {
6710
+ function Mt(e, t) {
6661
6711
  return `${e}:${t}`;
6662
6712
  }
6663
- function Tl(e) {
6713
+ function Rl(e) {
6664
6714
  const t = document.currentScript;
6665
6715
  if (t instanceof HTMLScriptElement)
6666
6716
  return [t];
@@ -6668,35 +6718,35 @@ function Tl(e) {
6668
6718
  return Array.from(
6669
6719
  document.querySelectorAll("script[type='module'][src]")
6670
6720
  ).filter(
6671
- (o) => o instanceof HTMLScriptElement && El(o) && kl(o, i)
6721
+ (o) => o instanceof HTMLScriptElement && Al(o) && Il(o, i)
6672
6722
  );
6673
6723
  }
6674
- function Pl(e) {
6675
- for (const t of Tl(e))
6676
- Uo.has(t) || t.dataset.plunoAutoMount === "false" || (Uo.add(t), fi(t).catch((n) => {
6724
+ function zl(e) {
6725
+ for (const t of Rl(e))
6726
+ Fo.has(t) || t.dataset.plunoAutoMount === "false" || (Fo.add(t), bi(t).catch((n) => {
6677
6727
  console.error("Failed to mount Pluno widget", n);
6678
6728
  }));
6679
6729
  }
6680
- function fi(e) {
6730
+ function bi(e) {
6681
6731
  const t = window, n = t[ve];
6682
6732
  if (n) {
6683
6733
  if (n.host === null)
6684
6734
  return n.mountPromise.catch(() => {
6685
6735
  const d = t[ve];
6686
- return d ? d.mountPromise : fi(e);
6736
+ return d ? d.mountPromise : bi(e);
6687
6737
  });
6688
- if (Al(n.host))
6738
+ if (Ml(n.host))
6689
6739
  return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
6690
6740
  n.destroy?.(), delete t[ve];
6691
6741
  }
6692
- const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? Cl(o) : null;
6742
+ const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? Pl(o) : null;
6693
6743
  let l;
6694
- const p = ja({
6744
+ const p = Ka({
6695
6745
  token: e.dataset.plunoToken,
6696
6746
  tokenProvider: r?.loadToken,
6697
6747
  tokenEndpoint: o,
6698
6748
  backendUrl: e.dataset.plunoBackendUrl,
6699
- webSocketFactory: i ? qa(i) : void 0,
6749
+ webSocketFactory: i ? Va(i) : void 0,
6700
6750
  launcherLabel: e.dataset.plunoLauncherLabel,
6701
6751
  accentColor: e.dataset.plunoAccentColor,
6702
6752
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -6709,7 +6759,7 @@ function fi(e) {
6709
6759
  return;
6710
6760
  }
6711
6761
  const c = d.host;
6712
- c.setAttribute(Go, "true"), l.host = c, l.destroy = () => {
6762
+ c.setAttribute(jo, "true"), l.host = c, l.destroy = () => {
6713
6763
  t[ve] === l && delete t[ve], l.host = null, l.destroy = null, d.destroy();
6714
6764
  };
6715
6765
  }).catch((d) => {
@@ -6722,11 +6772,11 @@ function fi(e) {
6722
6772
  retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
6723
6773
  }, t[ve] = l, p;
6724
6774
  }
6725
- function Al(e) {
6726
- return e.isConnected && e.getAttribute(Go) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6775
+ function Ml(e) {
6776
+ return e.isConnected && e.getAttribute(jo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6727
6777
  }
6728
- Pl(import.meta.url);
6778
+ zl(import.meta.url);
6729
6779
  export {
6730
- qa as createProductAgentPreviewBridgeWebSocketFactory,
6731
- ja as mountPlunoProductAgentWidget
6780
+ Va as createProductAgentPreviewBridgeWebSocketFactory,
6781
+ Ka as mountPlunoProductAgentWidget
6732
6782
  };