@pluno/product-agent-web 0.1.120 → 0.1.122

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