@pluno/product-agent-web 0.1.83 → 0.1.84

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