@pluno/product-agent-web 0.1.95 → 0.1.97
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.
- package/dist/product-agent-sdk.js +319 -310
- package/dist/product-agent-widget.js +417 -415
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
1
|
+
import { PlunoProductAgent as fi, getProductAgentOriginAccessErrorMessage as wi } from "./product-agent-sdk.js";
|
|
2
|
+
const bi = "#7c3aed", xt = "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", yt = "#2c2a1e", Mn = [253, 250, 241], On = 3.5;
|
|
3
3
|
function xo(e) {
|
|
4
4
|
const t = yo(e);
|
|
5
5
|
if (Un(it(t), Mn) >= On)
|
|
@@ -7,11 +7,11 @@ function xo(e) {
|
|
|
7
7
|
let o = it(t);
|
|
8
8
|
const i = it(yt);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
|
-
if (o =
|
|
10
|
+
if (o = yi(o, i, 0.22), Un(o, Mn) >= On)
|
|
11
11
|
return on(o);
|
|
12
12
|
return on(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function _i() {
|
|
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,7 +19,7 @@ function bi() {
|
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function xi(e) {
|
|
23
23
|
const t = yo(e), n = an(it(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
@@ -58,7 +58,7 @@ function _i(e) {
|
|
|
58
58
|
}
|
|
59
59
|
function yo(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()}` :
|
|
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()}` : bi;
|
|
62
62
|
}
|
|
63
63
|
function it(e) {
|
|
64
64
|
return [
|
|
@@ -82,7 +82,7 @@ function Un(e, t) {
|
|
|
82
82
|
const n = an(e), o = an(t), [i, r] = n > o ? [n, o] : [o, n];
|
|
83
83
|
return (i + 0.05) / (r + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function yi(e, t, n) {
|
|
86
86
|
const o = rn(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * o,
|
|
@@ -91,17 +91,17 @@ function xi(e, t, n) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function le(e, t, n) {
|
|
94
|
-
const [o, i, r] =
|
|
95
|
-
return on(
|
|
94
|
+
const [o, i, r] = vi(it(e));
|
|
95
|
+
return on(Si(o, rn(i + n), rn(r + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function vi([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 g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
102
102
|
return [(l === o ? (i - r) / g + (i < r ? 6 : 0) : l === i ? (r - o) / g + 2 : (o - i) / g + 4) / 6, c, s];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Si(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;
|
|
@@ -119,7 +119,7 @@ function rn(e) {
|
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
121
|
const vo = "suggest_share_on_socials";
|
|
122
|
-
function
|
|
122
|
+
function Ci(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const n = e[t];
|
|
125
125
|
if (n.role !== "tool" || n.toolName !== vo)
|
|
@@ -136,8 +136,8 @@ function Si(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function Ei(e) {
|
|
140
|
+
const t = await ki(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 })]);
|
|
@@ -150,18 +150,18 @@ function Bn(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function ki(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const Li = "https://app.pluno.ai", Pi = "/api/product-agent/embed/active-users", Ti = 1800, Ai = 15e3, Ii = 250, Ni = 1e3, Ri = 3e4;
|
|
157
|
+
function Di(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
|
g();
|
|
164
|
-
},
|
|
164
|
+
}, Oi(c)));
|
|
165
165
|
}, s = (c) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
167
|
o = c, e(c);
|
|
@@ -173,27 +173,27 @@ function Ri(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
o = Math.round(h + (c - h) *
|
|
176
|
+
const T = Math.min(1, (performance.now() - S) / Ti);
|
|
177
|
+
o = Math.round(h + (c - h) * Ui(T)), e(o), T >= 1 && (o = c, e(c), l());
|
|
178
178
|
}, Ii);
|
|
179
179
|
}, g = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const c = await
|
|
181
|
+
const c = await zi(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
184
|
s(c.count), p(c.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(Ai);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return g(), () => {
|
|
190
190
|
n = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function zi(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const n = await (e.fetcher ?? fetch)(new URL(Pi, Mi(e.backendUrl ?? Li)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
@@ -207,17 +207,17 @@ async function Di(e) {
|
|
|
207
207
|
function Fn(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function zi(e) {
|
|
211
|
-
return e.endsWith("/") ? e : `${e}/`;
|
|
212
|
-
}
|
|
213
210
|
function Mi(e) {
|
|
214
|
-
return
|
|
211
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
215
212
|
}
|
|
216
213
|
function Oi(e) {
|
|
214
|
+
return Math.min(Ri, Math.max(Ni, e));
|
|
215
|
+
}
|
|
216
|
+
function Ui(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
function
|
|
219
|
+
const Bi = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
|
|
220
|
+
function Fi(e) {
|
|
221
221
|
let t = "", n = "", o = null;
|
|
222
222
|
for (const i of e.split(new RegExp("(?<=\\n)"))) {
|
|
223
223
|
if (o) {
|
|
@@ -240,7 +240,7 @@ function Bi(e) {
|
|
|
240
240
|
}
|
|
241
241
|
function Wn(e) {
|
|
242
242
|
let t = "", n = 0;
|
|
243
|
-
for (const o of e.matchAll(
|
|
243
|
+
for (const o of e.matchAll(Bi)) {
|
|
244
244
|
const i = o.index ?? 0;
|
|
245
245
|
t += Hn(
|
|
246
246
|
e.slice(n, i)
|
|
@@ -251,16 +251,16 @@ function Wn(e) {
|
|
|
251
251
|
function Hn(e) {
|
|
252
252
|
return e.replace(
|
|
253
253
|
/\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
|
|
254
|
-
(t, n, o, i, r) => r[i - 1] === "!" ||
|
|
254
|
+
(t, n, o, i, r) => r[i - 1] === "!" || Wi(r, i) || Hi(r, i, n) ? t : `[${n}](${o})`
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Wi(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
|
|
263
|
+
function Hi(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 Wi(e, t, n) {
|
|
|
269
269
|
e.slice(o, t)
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
-
const So = 100,
|
|
272
|
+
const So = 100, Gi = 1e4, $i = 5e3, qi = "product-agent:sdk-preview-socket-connect", ji = "product-agent:sdk-preview-socket-send", Vi = "product-agent:sdk-preview-socket-close", Ki = "product-agent:sdk-preview-socket-open", Yi = "product-agent:sdk-preview-socket-message", Xi = "product-agent:sdk-preview-socket-error", Zi = "product-agent:sdk-preview-socket-closed", Gn = "product-agent:sdk-preview-socket-id", Ji = "data-pluno-sdk-preview-channel", Co = "data-pluno-auto-mounted", me = "__plunoProductAgentAutoMountOwner", Qi = 1e4, ea = "Failed to load Pluno widget token", $n = "Timed out loading Pluno widget token", ta = "pluno.productAgent.widgetClientId.", Vt = /* @__PURE__ */ new Set(), na = "product-agent:preview-diagnostic", Eo = "pluno.productAgent.sharePromptsDisabled", oa = 3, qn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ia = 400, aa = 5e3, ra = 500, jn = "Close the page's popup to chat", la = "No recent chats for this page yet.", pe = {
|
|
273
273
|
launcherLabel: "Ask for anything...",
|
|
274
274
|
accentColor: "#7c3aed",
|
|
275
275
|
colorScheme: "light",
|
|
@@ -277,7 +277,7 @@ const So = 100, Hi = 1e4, Gi = 5e3, $i = "product-agent:sdk-preview-socket-conne
|
|
|
277
277
|
scribbleStyle: !0,
|
|
278
278
|
position: "bottom-right",
|
|
279
279
|
movableLauncher: !0
|
|
280
|
-
},
|
|
280
|
+
}, pa = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Vn = "pluno-pa-scribble-font", ko = 190, Lo = 41, Kn = 22, sa = 1, da = 48, fn = 420, ca = 520, ua = 0.24, wn = 680, ga = 800, ha = 0.76, N = 8, Ne = 50, Po = "http://www.w3.org/2000/svg", ln = 26, pn = 8, ma = 36, sn = 16, fa = 4, Yn = [
|
|
281
281
|
{
|
|
282
282
|
ellipseCx: "17.5",
|
|
283
283
|
ellipseCy: "24.5",
|
|
@@ -314,12 +314,12 @@ const So = 100, Hi = 1e4, Gi = 5e3, $i = "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
|
-
],
|
|
317
|
+
], wa = 11, ba = 13, dn = 4, To = 10, Ao = 40, _a = "movable-launcher-position-v2", Io = "pluno-pa-widget-styles", No = "data-pluno-pa-widget-styles";
|
|
318
318
|
let Xn = 0;
|
|
319
|
-
function
|
|
319
|
+
function xa(e) {
|
|
320
320
|
return (t) => new fe(t, e);
|
|
321
321
|
}
|
|
322
|
-
async function
|
|
322
|
+
async function ya(e = {}) {
|
|
323
323
|
const t = {
|
|
324
324
|
layout: e.layout ?? "floating",
|
|
325
325
|
mountTarget: e.mountTarget,
|
|
@@ -388,7 +388,7 @@ async function xa(e = {}) {
|
|
|
388
388
|
);
|
|
389
389
|
const n = document.createElement("div");
|
|
390
390
|
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(
|
|
391
|
-
|
|
391
|
+
Ji,
|
|
392
392
|
t.sdkPreviewChannelId
|
|
393
393
|
);
|
|
394
394
|
const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
@@ -397,17 +397,17 @@ async function xa(e = {}) {
|
|
|
397
397
|
t.accentColor,
|
|
398
398
|
t.scribbleStyle
|
|
399
399
|
);
|
|
400
|
-
|
|
400
|
+
$a(
|
|
401
401
|
i,
|
|
402
402
|
t.launcherLabel,
|
|
403
403
|
r,
|
|
404
404
|
t.movableLauncher,
|
|
405
405
|
t.showLauncherMinimizeButton
|
|
406
406
|
), o.appendChild(i);
|
|
407
|
-
const l =
|
|
407
|
+
const l = Hr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Fr(t) : "shown";
|
|
408
408
|
fo(t, p);
|
|
409
409
|
let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
|
|
410
|
-
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (i.classList.add("pluno-pa-widget--minimized"),
|
|
410
|
+
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Ie(
|
|
411
411
|
i,
|
|
412
412
|
Yt(
|
|
413
413
|
i,
|
|
@@ -420,7 +420,7 @@ async function xa(e = {}) {
|
|
|
420
420
|
fontFamily: t.fontFamily,
|
|
421
421
|
scribbleStyle: t.scribbleStyle
|
|
422
422
|
});
|
|
423
|
-
const S = t.mountTarget ?? await
|
|
423
|
+
const S = t.mountTarget ?? await Br(), T = S.ownerDocument, A = i.querySelector(
|
|
424
424
|
".pluno-pa-widget__launcher"
|
|
425
425
|
), D = i.querySelector(
|
|
426
426
|
".pluno-pa-widget__launcher-drag-handle"
|
|
@@ -466,7 +466,7 @@ async function xa(e = {}) {
|
|
|
466
466
|
".pluno-pa-widget__timeline-jump"
|
|
467
467
|
), R = i.querySelector(
|
|
468
468
|
".pluno-pa-widget__active-users-counter"
|
|
469
|
-
),
|
|
469
|
+
), P = i.querySelector(
|
|
470
470
|
".pluno-pa-widget__timeline"
|
|
471
471
|
), re = i.querySelector(
|
|
472
472
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
@@ -474,7 +474,7 @@ async function xa(e = {}) {
|
|
|
474
474
|
".pluno-pa-widget__notify-suggestion"
|
|
475
475
|
), y = i.querySelector(
|
|
476
476
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
477
|
-
),
|
|
477
|
+
), I = i.querySelector(
|
|
478
478
|
".pluno-pa-widget__notify-suggestion-later"
|
|
479
479
|
), Xo = i.querySelector(
|
|
480
480
|
".pluno-pa-widget__notify-suggestion-never"
|
|
@@ -485,14 +485,14 @@ async function xa(e = {}) {
|
|
|
485
485
|
), Jo = i.querySelector(
|
|
486
486
|
".pluno-pa-widget__tab-groups-suggestion-dismiss"
|
|
487
487
|
);
|
|
488
|
-
if (!
|
|
488
|
+
if (!A || !u || !m || !L || !ie || !Q || !Re || !U || !we || !B || !f || !ee || !De || !Se || !Ce || !j || !at || !ae || !x || !R || !P || !re)
|
|
489
489
|
throw new Error("Failed to mount Pluno widget");
|
|
490
490
|
if (t.movableLauncher && !D)
|
|
491
491
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
492
492
|
B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled, ao(u), ao(f);
|
|
493
493
|
let q = [], ue = null;
|
|
494
494
|
const Me = () => {
|
|
495
|
-
|
|
495
|
+
dr(
|
|
496
496
|
U,
|
|
497
497
|
q,
|
|
498
498
|
(a) => {
|
|
@@ -504,7 +504,7 @@ async function xa(e = {}) {
|
|
|
504
504
|
}, yn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Ko(t.tokenEndpoint) : void 0);
|
|
505
505
|
if (!t.loginRequired && !t.signupRequired && !t.token && !yn && !t.webSocketFactory)
|
|
506
506
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
507
|
-
const Qo = window.fetch.bind(window), kt =
|
|
507
|
+
const Qo = window.fetch.bind(window), kt = Wr(t.clientId);
|
|
508
508
|
let b;
|
|
509
509
|
try {
|
|
510
510
|
const a = {
|
|
@@ -527,7 +527,7 @@ async function xa(e = {}) {
|
|
|
527
527
|
autoConnect: !1,
|
|
528
528
|
disableNetworkCapture: !!t.sdkPreviewChannelId
|
|
529
529
|
};
|
|
530
|
-
b = await
|
|
530
|
+
b = await fi.init(a);
|
|
531
531
|
} catch (a) {
|
|
532
532
|
throw kt.release(), n.remove(), a;
|
|
533
533
|
}
|
|
@@ -544,9 +544,9 @@ async function xa(e = {}) {
|
|
|
544
544
|
const Lt = new Set(l.openToolGroupKeys), Oe = new Set(
|
|
545
545
|
l.seenShareCandidateIds
|
|
546
546
|
), rt = new Set(Oe);
|
|
547
|
-
let
|
|
547
|
+
let Pt = l.sharePromptsDisabled || await Gr(t), te = null, V = !1, lt = !(t.loginRequired || t.signupRequired), be = !1, Ee = {
|
|
548
548
|
enabled: !0
|
|
549
|
-
}, ke = 0, vn = "", _e = !1, ge = !1, xe = [],
|
|
549
|
+
}, ke = 0, vn = "", _e = !1, ge = !1, xe = [], Tt = null, je = null;
|
|
550
550
|
const ne = (a, d) => {
|
|
551
551
|
Ee = { enabled: a, reason: d };
|
|
552
552
|
}, oe = () => {
|
|
@@ -554,7 +554,7 @@ async function xa(e = {}) {
|
|
|
554
554
|
}, ei = () => {
|
|
555
555
|
x.hidden = !1;
|
|
556
556
|
}, ti = (a = "jump") => {
|
|
557
|
-
ne(!0, a), oe(), ot(
|
|
557
|
+
ne(!0, a), oe(), ot(P, () => Ee.enabled), ke = P.scrollTop;
|
|
558
558
|
}, Le = () => {
|
|
559
559
|
if (Se.hidden = t.layout === "page" || t.loginRequired, Ce.hidden = !_e, Se.setAttribute("aria-expanded", String(_e)), j.classList.toggle(
|
|
560
560
|
"pluno-pa-widget__history-list--center",
|
|
@@ -567,28 +567,28 @@ async function xa(e = {}) {
|
|
|
567
567
|
const d = document.createElement("button");
|
|
568
568
|
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ge;
|
|
569
569
|
const _ = document.createElement("span");
|
|
570
|
-
_.className = "pluno-pa-widget__history-item-title", _.textContent =
|
|
570
|
+
_.className = "pluno-pa-widget__history-item-title", _.textContent = Wa(a);
|
|
571
571
|
const k = document.createElement("time");
|
|
572
|
-
k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent =
|
|
572
|
+
k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent = Ga(
|
|
573
573
|
a.lastActiveAt,
|
|
574
574
|
Date.now()
|
|
575
575
|
);
|
|
576
576
|
const M = document.createElement("small");
|
|
577
|
-
M.className = "pluno-pa-widget__history-path", M.textContent =
|
|
578
|
-
_e = !1,
|
|
577
|
+
M.className = "pluno-pa-widget__history-path", M.textContent = Ha(a), d.append(_, k, M), d.addEventListener("click", () => {
|
|
578
|
+
_e = !1, je = null, Le(), ne(!0, "newSession"), oe(), b.loadSession(a.id), W(b.getState());
|
|
579
579
|
}), j.appendChild(d);
|
|
580
580
|
}
|
|
581
581
|
if (ge && xe.length > 0) {
|
|
582
582
|
const a = document.createElement("p");
|
|
583
583
|
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", j.appendChild(a);
|
|
584
584
|
}
|
|
585
|
-
ae.textContent =
|
|
585
|
+
ae.textContent = je ?? (!ge && xe.length === 0 ? "No recent chats for this page yet." : ""), ae.hidden = ae.textContent.length === 0;
|
|
586
586
|
}, Sn = async (a) => {
|
|
587
587
|
if (!ge) {
|
|
588
|
-
ge = !0,
|
|
588
|
+
ge = !0, je = null, Le();
|
|
589
589
|
try {
|
|
590
590
|
const d = await b.listSessions({ cursor: a, limit: 20 });
|
|
591
|
-
xe = a ? [...xe, ...d.sessions] : d.sessions,
|
|
591
|
+
xe = a ? [...xe, ...d.sessions] : d.sessions, Tt = d.nextCursor;
|
|
592
592
|
} catch (d) {
|
|
593
593
|
Y(
|
|
594
594
|
"web-sdk.widget",
|
|
@@ -596,21 +596,21 @@ async function xa(e = {}) {
|
|
|
596
596
|
{
|
|
597
597
|
message: d instanceof Error ? d.message : String(d)
|
|
598
598
|
}
|
|
599
|
-
),
|
|
599
|
+
), je = la;
|
|
600
600
|
} finally {
|
|
601
601
|
ge = !1, Le();
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
}, ni = () => {
|
|
605
|
-
!
|
|
605
|
+
!Tt || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 && Sn(Tt);
|
|
606
606
|
}, Cn = () => {
|
|
607
|
-
V || typeof document > "u" || (mo(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget ||
|
|
607
|
+
V || typeof document > "u" || (mo(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || T.body?.appendChild(n)));
|
|
608
608
|
}, En = new MutationObserver(Cn);
|
|
609
|
-
En.observe(
|
|
609
|
+
En.observe(T.documentElement, {
|
|
610
610
|
childList: !0,
|
|
611
611
|
subtree: !0
|
|
612
612
|
}), Cn();
|
|
613
|
-
const
|
|
613
|
+
const Ve = (a = !0) => {
|
|
614
614
|
const d = vt(i, a);
|
|
615
615
|
return cn(
|
|
616
616
|
i,
|
|
@@ -622,8 +622,8 @@ async function xa(e = {}) {
|
|
|
622
622
|
d
|
|
623
623
|
);
|
|
624
624
|
}, F = () => {
|
|
625
|
-
const a =
|
|
626
|
-
|
|
625
|
+
const a = Ma(o, u, f);
|
|
626
|
+
qr(t, {
|
|
627
627
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
628
628
|
composerValue: f.value,
|
|
629
629
|
focusedInput: a,
|
|
@@ -634,16 +634,16 @@ async function xa(e = {}) {
|
|
|
634
634
|
seenShareCandidateIds: [...Oe].slice(
|
|
635
635
|
-So
|
|
636
636
|
),
|
|
637
|
-
sharePromptsDisabled:
|
|
637
|
+
sharePromptsDisabled: Pt
|
|
638
638
|
});
|
|
639
639
|
}, pt = (a) => {
|
|
640
640
|
t.onDisplayStateChange?.(a);
|
|
641
|
-
},
|
|
641
|
+
}, Ke = (a, d = !0) => {
|
|
642
642
|
if (fo(t, a), a === "shown") {
|
|
643
|
-
i.classList.remove("pluno-pa-widget--minimized"),
|
|
643
|
+
i.classList.remove("pluno-pa-widget--minimized"), A.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ye(!1), d && pt("shown");
|
|
644
644
|
return;
|
|
645
645
|
}
|
|
646
|
-
te !== null && (window.clearTimeout(te), te = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"),
|
|
646
|
+
te !== null && (window.clearTimeout(te), te = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), A.hidden = !1, m.hidden = !0, L.hidden = !0, A.tabIndex = 0, f.value = "", Ie(
|
|
647
647
|
i,
|
|
648
648
|
Yt(
|
|
649
649
|
i,
|
|
@@ -651,9 +651,9 @@ async function xa(e = {}) {
|
|
|
651
651
|
t.position
|
|
652
652
|
)
|
|
653
653
|
), no(i), F(), d && pt("minimized");
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
debugVersion:
|
|
654
|
+
}, Pe = (a, d = {}) => {
|
|
655
|
+
za(a, {
|
|
656
|
+
debugVersion: _a,
|
|
657
657
|
launcherPosition: s,
|
|
658
658
|
rootClasses: i.className,
|
|
659
659
|
rootStyle: {
|
|
@@ -663,35 +663,35 @@ async function xa(e = {}) {
|
|
|
663
663
|
bottom: i.style.bottom
|
|
664
664
|
},
|
|
665
665
|
rootRect: Zt(i),
|
|
666
|
-
launcherRect: Zt(
|
|
666
|
+
launcherRect: Zt(A),
|
|
667
667
|
panelRect: Zt(m),
|
|
668
668
|
viewport: J(),
|
|
669
669
|
panelHidden: m.hidden,
|
|
670
670
|
closeHidden: L.hidden,
|
|
671
671
|
...d
|
|
672
672
|
});
|
|
673
|
-
},
|
|
673
|
+
}, Ye = (a = !0) => {
|
|
674
674
|
if (!s)
|
|
675
|
-
return
|
|
676
|
-
const d =
|
|
677
|
-
return
|
|
675
|
+
return Ie(i, null), Ve(a);
|
|
676
|
+
const d = Ve(a);
|
|
677
|
+
return Ie(i, d), Pe("Applied stored closed launcher position", {
|
|
678
678
|
visibleLauncherPosition: d
|
|
679
679
|
}), d;
|
|
680
|
-
},
|
|
680
|
+
}, At = (a, d) => {
|
|
681
681
|
if (!a || !d) {
|
|
682
682
|
no(i);
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
|
-
|
|
685
|
+
Da(i, {
|
|
686
686
|
x: a.x - d.x,
|
|
687
687
|
y: a.y - d.y
|
|
688
688
|
});
|
|
689
|
-
},
|
|
689
|
+
}, It = () => {
|
|
690
690
|
const a = nt(c).width;
|
|
691
691
|
return t.layout === "page" && m.getBoundingClientRect().width || a;
|
|
692
692
|
}, kn = () => {
|
|
693
693
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
694
|
-
|
|
694
|
+
Ie(
|
|
695
695
|
i,
|
|
696
696
|
Yt(
|
|
697
697
|
i,
|
|
@@ -701,13 +701,13 @@ async function xa(e = {}) {
|
|
|
701
701
|
);
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
|
-
const a =
|
|
704
|
+
const a = Ye();
|
|
705
705
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
706
706
|
Kt(i, c);
|
|
707
707
|
const d = nt(c);
|
|
708
708
|
Qt(
|
|
709
709
|
C,
|
|
710
|
-
|
|
710
|
+
It()
|
|
711
711
|
);
|
|
712
712
|
const _ = _t(
|
|
713
713
|
h ?? Xt(
|
|
@@ -718,22 +718,22 @@ async function xa(e = {}) {
|
|
|
718
718
|
),
|
|
719
719
|
d
|
|
720
720
|
);
|
|
721
|
-
h && (h = _),
|
|
721
|
+
h && (h = _), At(_, a), Pe(
|
|
722
722
|
"Applied open panel position after viewport resize",
|
|
723
723
|
{ openPanelPosition: _ }
|
|
724
724
|
);
|
|
725
|
-
} else s &&
|
|
725
|
+
} else s && Pe(
|
|
726
726
|
"Applied visible launcher position after viewport resize",
|
|
727
727
|
{ visibleLauncherPosition: a }
|
|
728
728
|
);
|
|
729
729
|
};
|
|
730
730
|
let Ln = () => {
|
|
731
731
|
};
|
|
732
|
-
window.addEventListener("resize", kn), t.movableLauncher && D ? (
|
|
732
|
+
window.addEventListener("resize", kn), t.movableLauncher && D ? (Ye(), Ln = ka({
|
|
733
733
|
root: i,
|
|
734
|
-
launcher:
|
|
734
|
+
launcher: A,
|
|
735
735
|
launcherDragHandle: D,
|
|
736
|
-
getPosition: () =>
|
|
736
|
+
getPosition: () => Ve(),
|
|
737
737
|
setPosition: (a) => {
|
|
738
738
|
const d = a, _ = vt(i), k = cn(
|
|
739
739
|
i,
|
|
@@ -743,16 +743,16 @@ async function xa(e = {}) {
|
|
|
743
743
|
s = Ia(
|
|
744
744
|
k,
|
|
745
745
|
_
|
|
746
|
-
),
|
|
746
|
+
), Ie(i, k), Pe("Dragging closed launcher", {
|
|
747
747
|
requestedPosition: d
|
|
748
748
|
});
|
|
749
749
|
},
|
|
750
750
|
persist: () => {
|
|
751
|
-
g = !0, F(),
|
|
751
|
+
g = !0, F(), Pe("Persisted closed launcher drag position");
|
|
752
752
|
}
|
|
753
|
-
})) :
|
|
753
|
+
})) : Ie(i, null), Kt(i, c);
|
|
754
754
|
const oi = () => {
|
|
755
|
-
const a = nt(c), d =
|
|
755
|
+
const a = nt(c), d = Ve();
|
|
756
756
|
return {
|
|
757
757
|
position: _t(
|
|
758
758
|
h ?? Xt(
|
|
@@ -768,14 +768,14 @@ async function xa(e = {}) {
|
|
|
768
768
|
}, ii = (a) => {
|
|
769
769
|
c = Ct(a.size), Kt(i, c), Qt(
|
|
770
770
|
C,
|
|
771
|
-
|
|
771
|
+
It()
|
|
772
772
|
), h = _t(
|
|
773
773
|
a.position,
|
|
774
774
|
nt(c)
|
|
775
775
|
);
|
|
776
|
-
const d =
|
|
777
|
-
|
|
778
|
-
}, ai = z.length > 0 ?
|
|
776
|
+
const d = Ve();
|
|
777
|
+
At(h, d);
|
|
778
|
+
}, ai = z.length > 0 ? La({
|
|
779
779
|
root: i,
|
|
780
780
|
handles: z,
|
|
781
781
|
getBounds: oi,
|
|
@@ -784,7 +784,7 @@ async function xa(e = {}) {
|
|
|
784
784
|
}) : () => {
|
|
785
785
|
};
|
|
786
786
|
let Nt = !1;
|
|
787
|
-
const
|
|
787
|
+
const Pn = async () => {
|
|
788
788
|
if (!(!t.billingStatusLoader || Nt)) {
|
|
789
789
|
Nt = !0;
|
|
790
790
|
try {
|
|
@@ -811,38 +811,38 @@ async function xa(e = {}) {
|
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
}, he = (a = "", d = !0) => {
|
|
814
|
-
|
|
814
|
+
Pn(), Ze && (Ze = !1, zt()), i.classList.contains("pluno-pa-widget--open") || (h = null), te !== null && (window.clearTimeout(te), te = null), Ke("shown", !1), m.hidden = !1, L.hidden = !1, Qt(
|
|
815
815
|
C,
|
|
816
|
-
|
|
816
|
+
It()
|
|
817
817
|
), i.classList.remove("pluno-pa-widget--closing");
|
|
818
|
-
const _ =
|
|
818
|
+
const _ = Ye(), k = Xt(
|
|
819
819
|
i,
|
|
820
820
|
_,
|
|
821
821
|
t.position,
|
|
822
822
|
c
|
|
823
823
|
);
|
|
824
|
-
if (
|
|
824
|
+
if (At(k, _), Pe("Opening launcher at clamped open panel position", {
|
|
825
825
|
openPanelPosition: k,
|
|
826
826
|
visibleLauncherPosition: _
|
|
827
827
|
}), ne(!0, "open"), oe(), !d) {
|
|
828
|
-
i.classList.add("pluno-pa-widget--open"),
|
|
828
|
+
i.classList.add("pluno-pa-widget--open"), A.hidden = !0, a && (f.value = a, tt(f)), ot(P, () => Ee.enabled), ke = P.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), pt("shown"), t.onPanelOpenChange?.(!0);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
window.requestAnimationFrame(() => {
|
|
832
|
-
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, tt(f)), ot(
|
|
833
|
-
|
|
832
|
+
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, tt(f)), ot(P, () => Ee.enabled), ke = P.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), pt("shown"), t.onPanelOpenChange?.(!0), te = window.setTimeout(() => {
|
|
833
|
+
A.hidden = !0, ot(P, () => Ee.enabled), ke = P.scrollTop;
|
|
834
834
|
}, 220);
|
|
835
835
|
});
|
|
836
836
|
}, Rt = () => {
|
|
837
|
-
te !== null && (window.clearTimeout(te), te = null),
|
|
837
|
+
te !== null && (window.clearTimeout(te), te = null), A.hidden = !1, s && (Ye(!1), Pe("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), te = window.setTimeout(() => {
|
|
838
838
|
m.hidden = !0, L.hidden = !0, h = null, i.classList.remove("pluno-pa-widget--closing");
|
|
839
839
|
}, 220);
|
|
840
840
|
};
|
|
841
|
-
|
|
841
|
+
A.addEventListener("submit", (a) => {
|
|
842
842
|
a.preventDefault(), he(u.value), u.value = "";
|
|
843
843
|
}), D?.addEventListener("click", (a) => {
|
|
844
844
|
a.preventDefault(), a.stopPropagation();
|
|
845
|
-
}),
|
|
845
|
+
}), A.addEventListener("click", (a) => {
|
|
846
846
|
a.target === u && !D || (he(u.value), u.value = "");
|
|
847
847
|
}), u.addEventListener("focus", () => {
|
|
848
848
|
he(u.value), u.value = "";
|
|
@@ -852,8 +852,8 @@ async function xa(e = {}) {
|
|
|
852
852
|
const a = u.value;
|
|
853
853
|
he(a), u.value = "";
|
|
854
854
|
});
|
|
855
|
-
let Dt = null, st = null,
|
|
856
|
-
const
|
|
855
|
+
let Dt = null, st = null, Te = null;
|
|
856
|
+
const Tn = (a) => a === u || a === f, ri = (a) => {
|
|
857
857
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
858
858
|
return null;
|
|
859
859
|
let d = a;
|
|
@@ -876,73 +876,73 @@ async function xa(e = {}) {
|
|
|
876
876
|
return a.checkVisibility();
|
|
877
877
|
const d = window.getComputedStyle(a);
|
|
878
878
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
879
|
-
},
|
|
880
|
-
|
|
881
|
-
const d =
|
|
882
|
-
(!d || !li(d)) &&
|
|
883
|
-
},
|
|
879
|
+
}, An = (a) => {
|
|
880
|
+
Ue !== a && (Ue = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ae(), a !== null ? Te = window.setInterval(() => {
|
|
881
|
+
const d = Ue;
|
|
882
|
+
(!d || !li(d)) && An(null);
|
|
883
|
+
}, ra) : Te !== null && (window.clearInterval(Te), Te = null, st = null));
|
|
884
884
|
}, pi = () => {
|
|
885
|
-
|
|
885
|
+
Te !== null && (window.clearInterval(Te), Te = null);
|
|
886
886
|
};
|
|
887
887
|
i.addEventListener("focusin", (a) => {
|
|
888
|
-
|
|
888
|
+
Tn(a.target) && (Dt = Date.now(), F());
|
|
889
889
|
}), i.addEventListener("focusout", (a) => {
|
|
890
|
-
if (!
|
|
890
|
+
if (!Tn(a.target) || Ue !== null)
|
|
891
891
|
return;
|
|
892
892
|
const d = Dt;
|
|
893
|
-
if (Dt = null, d === null || Date.now() - d >
|
|
893
|
+
if (Dt = null, d === null || Date.now() - d > ia)
|
|
894
894
|
return;
|
|
895
895
|
const _ = ri(a.relatedTarget);
|
|
896
896
|
if (!_)
|
|
897
897
|
return;
|
|
898
898
|
const k = Date.now();
|
|
899
|
-
if (st !== null && k - st <=
|
|
900
|
-
|
|
899
|
+
if (st !== null && k - st <= aa) {
|
|
900
|
+
An(_);
|
|
901
901
|
return;
|
|
902
902
|
}
|
|
903
903
|
st = k;
|
|
904
|
-
}),
|
|
904
|
+
}), A.addEventListener("keydown", (a) => {
|
|
905
905
|
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), he());
|
|
906
906
|
}), v?.addEventListener("pointerdown", (a) => {
|
|
907
907
|
a.stopPropagation();
|
|
908
908
|
}), v?.addEventListener("click", (a) => {
|
|
909
|
-
a.preventDefault(), a.stopPropagation(),
|
|
910
|
-
}), L.addEventListener("click", Rt),
|
|
911
|
-
|
|
909
|
+
a.preventDefault(), a.stopPropagation(), Ke("minimized");
|
|
910
|
+
}), L.addEventListener("click", Rt), P.addEventListener("scroll", () => {
|
|
911
|
+
P.scrollTop < ke - 1 && ne(!1, "userScroll"), ke = P.scrollTop;
|
|
912
912
|
}), x.addEventListener("click", () => {
|
|
913
913
|
ti();
|
|
914
914
|
});
|
|
915
|
-
const
|
|
915
|
+
const In = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
916
916
|
([a]) => {
|
|
917
917
|
a?.isIntersecting && (ne(!0, "bottom"), oe());
|
|
918
918
|
},
|
|
919
|
-
{ root:
|
|
919
|
+
{ root: P, threshold: 0 }
|
|
920
920
|
);
|
|
921
|
-
|
|
922
|
-
const
|
|
923
|
-
let
|
|
924
|
-
const K = () => lt || b.getState().status !== "connected",
|
|
925
|
-
const a =
|
|
921
|
+
In?.observe(re);
|
|
922
|
+
const Xe = () => t.loginRequired || t.signupRequired;
|
|
923
|
+
let Ue = null, Ze = !1;
|
|
924
|
+
const K = () => lt || b.getState().status !== "connected", Ae = () => {
|
|
925
|
+
const a = Xe(), d = Ue !== null, _ = !a && K();
|
|
926
926
|
u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ? jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ze ? "New update" : t.launcherLabel, f.placeholder = d ? jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, ie.hidden = a;
|
|
927
927
|
}, G = () => {
|
|
928
|
-
ee.disabled = K() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled =
|
|
928
|
+
ee.disabled = K() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled = Xe() || K() || de(t.billingStatus);
|
|
929
929
|
};
|
|
930
|
-
|
|
930
|
+
Ae();
|
|
931
931
|
const zt = () => {
|
|
932
932
|
const a = b.getState().isThinking;
|
|
933
933
|
i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
|
|
934
934
|
"pluno-pa-widget--unread",
|
|
935
935
|
!a && Ze
|
|
936
|
-
),
|
|
936
|
+
), Ae();
|
|
937
937
|
};
|
|
938
938
|
zt();
|
|
939
939
|
const Mt = () => {
|
|
940
|
-
|
|
940
|
+
Xe() || V || (lt = !0, Ae(), G(), b.connect().then(
|
|
941
941
|
() => {
|
|
942
|
-
V || (lt = !1,
|
|
942
|
+
V || (lt = !1, Ae(), G());
|
|
943
943
|
},
|
|
944
944
|
(a) => {
|
|
945
|
-
V || (lt = !1,
|
|
945
|
+
V || (lt = !1, Ae(), G(), Y(
|
|
946
946
|
"web-sdk.widget",
|
|
947
947
|
"Failed to connect Product Agent widget",
|
|
948
948
|
{
|
|
@@ -980,14 +980,16 @@ async function xa(e = {}) {
|
|
|
980
980
|
}, Ut = async (a) => {
|
|
981
981
|
if (!t.attachmentsEnabled || a.length === 0)
|
|
982
982
|
return;
|
|
983
|
-
const d =
|
|
983
|
+
const d = gr(b, a);
|
|
984
984
|
q = [...q, ...d], Me(), di(), G(), W(b.getState()), i.classList.contains("pluno-pa-widget--open") || he();
|
|
985
|
+
}, ci = async (a) => {
|
|
986
|
+
await Ut(a), !(a.length === 0 || Ue !== null) && f.focus();
|
|
985
987
|
};
|
|
986
988
|
B.addEventListener("click", () => {
|
|
987
989
|
t.loginRequired || K() || de(t.billingStatus) || we.click();
|
|
988
990
|
}), we.addEventListener("change", () => {
|
|
989
991
|
const a = Array.from(we.files ?? []);
|
|
990
|
-
we.value = "",
|
|
992
|
+
we.value = "", ci(a).catch((d) => {
|
|
991
993
|
Ot(
|
|
992
994
|
d instanceof Error ? d.message : "Failed to attach file"
|
|
993
995
|
), Y("web-sdk.widget", "Attachment failed", {
|
|
@@ -1036,11 +1038,11 @@ async function xa(e = {}) {
|
|
|
1036
1038
|
mt
|
|
1037
1039
|
), Me(), G(), W(b.getState()));
|
|
1038
1040
|
}), Se.addEventListener("click", () => {
|
|
1039
|
-
_e = !_e,
|
|
1041
|
+
_e = !_e, je = null, Le(), _e && xe.length === 0 && Sn(null);
|
|
1040
1042
|
}), at.addEventListener("click", () => {
|
|
1041
1043
|
_e = !1, Le();
|
|
1042
1044
|
}), j.addEventListener("scroll", ni), f.addEventListener("input", () => {
|
|
1043
|
-
tt(f), F(), G(),
|
|
1045
|
+
tt(f), F(), G(), hi();
|
|
1044
1046
|
}), f.addEventListener("keydown", (a) => {
|
|
1045
1047
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
1046
1048
|
if (a.preventDefault(), t.loginRequired) {
|
|
@@ -1056,17 +1058,17 @@ async function xa(e = {}) {
|
|
|
1056
1058
|
}
|
|
1057
1059
|
}), i.addEventListener("click", (a) => {
|
|
1058
1060
|
(a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
|
|
1059
|
-
}), l.composerValue && (f.value = l.composerValue, tt(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ?
|
|
1061
|
+
}), l.composerValue && (f.value = l.composerValue, tt(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ? Ke("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(f.value, !1), Oa(l, i, u, f);
|
|
1060
1062
|
const dt = () => r;
|
|
1061
|
-
let Bt = b.getState().appearance !== null, ct = null, Qe = null,
|
|
1063
|
+
let Bt = b.getState().appearance !== null, ct = null, Qe = null, Be = null, Nn = b.getState().isThinking, Fe = null;
|
|
1062
1064
|
const et = t.taskNotifications;
|
|
1063
|
-
let
|
|
1065
|
+
let We = null, He = !1;
|
|
1064
1066
|
const Rn = () => {
|
|
1065
|
-
|
|
1067
|
+
We !== null && (window.clearTimeout(We), We = null);
|
|
1066
1068
|
}, ut = () => {
|
|
1067
1069
|
H && (H.hidden = !0);
|
|
1068
|
-
}, Dn = () => b.getState().assistantDraft.trim().length > 0,
|
|
1069
|
-
if (!et || !H ||
|
|
1070
|
+
}, Dn = () => b.getState().assistantDraft.trim().length > 0, ui = async () => {
|
|
1071
|
+
if (!et || !H || He || V || !b.getState().isThinking || Dn())
|
|
1070
1072
|
return;
|
|
1071
1073
|
let a;
|
|
1072
1074
|
try {
|
|
@@ -1074,66 +1076,66 @@ async function xa(e = {}) {
|
|
|
1074
1076
|
} catch {
|
|
1075
1077
|
return;
|
|
1076
1078
|
}
|
|
1077
|
-
a.enabled || a.neverSuggest || !b.getState().isThinking || Dn() ||
|
|
1079
|
+
a.enabled || a.neverSuggest || !b.getState().isThinking || Dn() || He || V || (H.hidden = !1);
|
|
1078
1080
|
};
|
|
1079
1081
|
y?.addEventListener("click", () => {
|
|
1080
|
-
|
|
1082
|
+
He = !0, ut(), et?.enable().catch(() => {
|
|
1081
1083
|
});
|
|
1082
|
-
}),
|
|
1083
|
-
|
|
1084
|
+
}), I?.addEventListener("click", () => {
|
|
1085
|
+
He = !0, ut();
|
|
1084
1086
|
}), Xo?.addEventListener("click", () => {
|
|
1085
|
-
|
|
1087
|
+
He = !0, ut(), et?.dismissForever().catch(() => {
|
|
1086
1088
|
});
|
|
1087
1089
|
});
|
|
1088
1090
|
const gt = t.tabGroups;
|
|
1089
|
-
let
|
|
1091
|
+
let Ge = !1;
|
|
1090
1092
|
const ht = async () => {
|
|
1091
|
-
if (!gt || !ze ||
|
|
1093
|
+
if (!gt || !ze || Ge || V)
|
|
1092
1094
|
return;
|
|
1093
1095
|
const a = await gt.getState().catch(() => null);
|
|
1094
|
-
!a ||
|
|
1096
|
+
!a || Ge || V || (ze.hidden = !a.permissionNeeded);
|
|
1095
1097
|
};
|
|
1096
1098
|
Zo?.addEventListener("click", () => {
|
|
1097
|
-
|
|
1099
|
+
Ge = !0, ze && (ze.hidden = !0), gt?.enable().catch(() => {
|
|
1098
1100
|
}).finally(() => {
|
|
1099
|
-
|
|
1101
|
+
Ge = !1, ht();
|
|
1100
1102
|
});
|
|
1101
1103
|
}), Jo?.addEventListener("click", () => {
|
|
1102
|
-
|
|
1104
|
+
Ge = !0, ze && (ze.hidden = !0), gt?.dismiss().catch(() => {
|
|
1103
1105
|
}).finally(() => {
|
|
1104
|
-
|
|
1106
|
+
Ge = !1, ht();
|
|
1105
1107
|
});
|
|
1106
1108
|
}), ht();
|
|
1107
|
-
let
|
|
1109
|
+
let $e = null, zn = () => {
|
|
1108
1110
|
};
|
|
1109
|
-
const
|
|
1110
|
-
const a =
|
|
1111
|
-
R.hidden = !a, a &&
|
|
1111
|
+
const gi = !!t.socialPostDraftHandler, Ft = /* @__PURE__ */ new Map(), Wt = () => f.value.trim().length > 0 || q.length > 0, hi = () => {
|
|
1112
|
+
const a = $e !== null && nn(b.getState(), Wt());
|
|
1113
|
+
R.hidden = !a, a && $e !== null && zo(R, $e);
|
|
1112
1114
|
};
|
|
1113
|
-
let
|
|
1115
|
+
let qe = null;
|
|
1114
1116
|
const Ht = (a = {}) => {
|
|
1115
1117
|
be = !0, ne(!0, "newSession"), oe(), _e = !1, Le(), b.startNewSession(a), Lt.clear(), f.value = "", q = [], Me(), tt(f), F(), G(), f.focus(), W(b.getState());
|
|
1116
1118
|
}, mt = () => {
|
|
1117
1119
|
t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Ht());
|
|
1118
1120
|
}, Gt = (a) => {
|
|
1119
1121
|
if (!a || t.layout === "page") {
|
|
1120
|
-
|
|
1122
|
+
qe?.remove(), qe = null;
|
|
1121
1123
|
return;
|
|
1122
1124
|
}
|
|
1123
|
-
|
|
1125
|
+
qe || (qe = Et(
|
|
1124
1126
|
"pluno-pa-widget__new-chat",
|
|
1125
1127
|
"New chat",
|
|
1126
|
-
|
|
1128
|
+
nr(),
|
|
1127
1129
|
!1
|
|
1128
|
-
),
|
|
1130
|
+
), qe.addEventListener("click", () => Ht()), De.insertBefore(qe, Se));
|
|
1129
1131
|
}, W = (a) => {
|
|
1130
|
-
if (Le(), _n(a.lastErrorCode) ?
|
|
1132
|
+
if (Le(), _n(a.lastErrorCode) ? Fe = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Fe = null), tn(
|
|
1131
1133
|
Re,
|
|
1132
1134
|
t.billingStatus,
|
|
1133
|
-
|
|
1135
|
+
Fe
|
|
1134
1136
|
), t.loginRequired) {
|
|
1135
1137
|
Ft.clear(), uo(
|
|
1136
|
-
|
|
1138
|
+
P,
|
|
1137
1139
|
ee,
|
|
1138
1140
|
Gt,
|
|
1139
1141
|
dt,
|
|
@@ -1146,7 +1148,7 @@ async function xa(e = {}) {
|
|
|
1146
1148
|
}
|
|
1147
1149
|
if (t.signupRequired) {
|
|
1148
1150
|
Ft.clear(), uo(
|
|
1149
|
-
|
|
1151
|
+
P,
|
|
1150
1152
|
ee,
|
|
1151
1153
|
Gt,
|
|
1152
1154
|
dt,
|
|
@@ -1157,18 +1159,18 @@ async function xa(e = {}) {
|
|
|
1157
1159
|
);
|
|
1158
1160
|
return;
|
|
1159
1161
|
}
|
|
1160
|
-
const d =
|
|
1162
|
+
const d = Ba(a), _ = d !== vn;
|
|
1161
1163
|
vn = d;
|
|
1162
1164
|
const k = be || Ee.enabled;
|
|
1163
|
-
be = !1,
|
|
1164
|
-
|
|
1165
|
+
be = !1, xr(
|
|
1166
|
+
P,
|
|
1165
1167
|
re,
|
|
1166
1168
|
ee,
|
|
1167
1169
|
Gt,
|
|
1168
1170
|
R,
|
|
1169
1171
|
a,
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
+
$e,
|
|
1173
|
+
$e !== null && nn(a, Wt()),
|
|
1172
1174
|
k,
|
|
1173
1175
|
() => Ee.enabled,
|
|
1174
1176
|
Lt,
|
|
@@ -1186,7 +1188,7 @@ async function xa(e = {}) {
|
|
|
1186
1188
|
t.morningReport = null, t.onMorningReportSnooze?.(), Rt(), W(b.getState());
|
|
1187
1189
|
},
|
|
1188
1190
|
Mt,
|
|
1189
|
-
|
|
1191
|
+
gi && !Pt ? {
|
|
1190
1192
|
dismissedCandidateIds: rt,
|
|
1191
1193
|
draftingCandidateId: ct,
|
|
1192
1194
|
error: Qe,
|
|
@@ -1195,20 +1197,20 @@ async function xa(e = {}) {
|
|
|
1195
1197
|
Oe.add(M.id), F();
|
|
1196
1198
|
},
|
|
1197
1199
|
onDraft: (M) => {
|
|
1198
|
-
|
|
1200
|
+
mi(M);
|
|
1199
1201
|
},
|
|
1200
1202
|
onDismiss: (M) => {
|
|
1201
1203
|
Oe.add(M.id), rt.add(M.id), F(), Qe = null, W(b.getState());
|
|
1202
1204
|
},
|
|
1203
1205
|
onDisable: (M) => {
|
|
1204
|
-
|
|
1206
|
+
Pt = !0, Oe.add(M.id), rt.add(M.id), F(), $r(t, !0), Qe = null, W(b.getState());
|
|
1205
1207
|
}
|
|
1206
1208
|
} : void 0
|
|
1207
|
-
), k ? (ke =
|
|
1209
|
+
), k ? (ke = P.scrollTop, oe()) : _ && Fa(a) && ei();
|
|
1208
1210
|
};
|
|
1209
|
-
return zn =
|
|
1211
|
+
return zn = Di(
|
|
1210
1212
|
(a) => {
|
|
1211
|
-
|
|
1213
|
+
$e = a, !V && nn(b.getState(), Wt()) && W(b.getState());
|
|
1212
1214
|
},
|
|
1213
1215
|
{
|
|
1214
1216
|
backendUrl: t.backendUrl,
|
|
@@ -1218,9 +1220,9 @@ async function xa(e = {}) {
|
|
|
1218
1220
|
), b.on("state", (a) => {
|
|
1219
1221
|
ht();
|
|
1220
1222
|
const d = Nn && !a.isThinking;
|
|
1221
|
-
Nn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && et && !
|
|
1222
|
-
|
|
1223
|
-
},
|
|
1223
|
+
Nn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && et && !He && We === null && H?.hidden !== !1 && (We = window.setTimeout(() => {
|
|
1224
|
+
We = null, ui();
|
|
1225
|
+
}, Gi)), (!a.isThinking || a.assistantDraft.trim()) && (Rn(), ut()), d && !i.classList.contains("pluno-pa-widget--open") && (Ze = !0), zt(), a.appearance ? (Bt = !0, Y(
|
|
1224
1226
|
"web-sdk.widget",
|
|
1225
1227
|
"Agent state supplied appearance",
|
|
1226
1228
|
{
|
|
@@ -1234,7 +1236,7 @@ async function xa(e = {}) {
|
|
|
1234
1236
|
fallbackColorScheme: t.colorScheme,
|
|
1235
1237
|
fallbackFontFamily: t.fontFamily
|
|
1236
1238
|
}
|
|
1237
|
-
), $t({}, "agent.state.appearance-cleared")), W(a), G(), d &&
|
|
1239
|
+
), $t({}, "agent.state.appearance-cleared")), W(a), G(), d && Pn();
|
|
1238
1240
|
}), W(b.getState()), G(), Mt(), {
|
|
1239
1241
|
agent: b,
|
|
1240
1242
|
startNewChat: Ht,
|
|
@@ -1247,16 +1249,16 @@ async function xa(e = {}) {
|
|
|
1247
1249
|
lo(
|
|
1248
1250
|
t.billingStatus,
|
|
1249
1251
|
d,
|
|
1250
|
-
|
|
1251
|
-
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (
|
|
1252
|
+
Fe
|
|
1253
|
+
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Fe = null), tn(
|
|
1252
1254
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
1253
1255
|
t.billingStatus,
|
|
1254
|
-
|
|
1256
|
+
Fe
|
|
1255
1257
|
), G());
|
|
1256
1258
|
},
|
|
1257
1259
|
updateAuthGate: (a) => {
|
|
1258
|
-
const d =
|
|
1259
|
-
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),
|
|
1260
|
+
const d = Xe();
|
|
1261
|
+
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), Ae(), W(b.getState()), G(), d && !Xe() && Mt();
|
|
1260
1262
|
},
|
|
1261
1263
|
openPanel: () => {
|
|
1262
1264
|
he(f.value, !1);
|
|
@@ -1264,19 +1266,19 @@ async function xa(e = {}) {
|
|
|
1264
1266
|
closePanel: Rt,
|
|
1265
1267
|
updateDisplayState: (a) => {
|
|
1266
1268
|
if (a === "shown") {
|
|
1267
|
-
|
|
1269
|
+
Ke("shown", !1);
|
|
1268
1270
|
return;
|
|
1269
1271
|
}
|
|
1270
|
-
|
|
1272
|
+
Ke("minimized", !1);
|
|
1271
1273
|
},
|
|
1272
1274
|
updateMorningReport: (a) => {
|
|
1273
1275
|
t.morningReport = a ?? null, W(b.getState());
|
|
1274
1276
|
},
|
|
1275
1277
|
destroy: () => {
|
|
1276
|
-
V || (F(), V = !0, En.disconnect(),
|
|
1278
|
+
V || (F(), V = !0, En.disconnect(), In?.disconnect(), pi(), window.removeEventListener("resize", kn), Ln(), ai(), ue !== null && window.clearTimeout(ue), Rn(), zn(), Be?.remove(), b.destroy(), kt.release(), n.remove());
|
|
1277
1279
|
}
|
|
1278
1280
|
};
|
|
1279
|
-
async function
|
|
1281
|
+
async function mi(a) {
|
|
1280
1282
|
if (!ct) {
|
|
1281
1283
|
ct = a.id, Qe = null, W(b.getState());
|
|
1282
1284
|
try {
|
|
@@ -1285,12 +1287,12 @@ async function xa(e = {}) {
|
|
|
1285
1287
|
const d = await t.socialPostDraftHandler(a);
|
|
1286
1288
|
if (!d.linkedinPost || !d.xPost)
|
|
1287
1289
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1288
|
-
Oe.add(a.id), rt.add(a.id), F(),
|
|
1290
|
+
Oe.add(a.id), rt.add(a.id), F(), Be?.remove(), Be = Pr(d, {
|
|
1289
1291
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1290
1292
|
onClose: () => {
|
|
1291
|
-
|
|
1293
|
+
Be?.remove(), Be = null;
|
|
1292
1294
|
}
|
|
1293
|
-
}), i.appendChild(
|
|
1295
|
+
}), i.appendChild(Be);
|
|
1294
1296
|
} catch (d) {
|
|
1295
1297
|
Qe = d instanceof Error ? d.message : "Could not draft social post.";
|
|
1296
1298
|
} finally {
|
|
@@ -1322,11 +1324,11 @@ async function xa(e = {}) {
|
|
|
1322
1324
|
function Zn(e, t) {
|
|
1323
1325
|
return { accentColor: e, scribbleStyle: t };
|
|
1324
1326
|
}
|
|
1325
|
-
function ya(e) {
|
|
1326
|
-
const t = va(e);
|
|
1327
|
-
return t === null ? "#fafafa" : Sa(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1328
|
-
}
|
|
1329
1327
|
function va(e) {
|
|
1328
|
+
const t = Sa(e);
|
|
1329
|
+
return t === null ? "#fafafa" : Ca(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1330
|
+
}
|
|
1331
|
+
function Sa(e) {
|
|
1330
1332
|
const t = e.trim();
|
|
1331
1333
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1332
1334
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1338,7 +1340,7 @@ function va(e) {
|
|
|
1338
1340
|
Number.parseInt(t[3] + t[3], 16)
|
|
1339
1341
|
] : null;
|
|
1340
1342
|
}
|
|
1341
|
-
function
|
|
1343
|
+
function Ca([e, t, n]) {
|
|
1342
1344
|
const o = (i) => {
|
|
1343
1345
|
const r = i / 255;
|
|
1344
1346
|
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
@@ -1356,8 +1358,8 @@ function Jn(e, t, n) {
|
|
|
1356
1358
|
const o = n.scribbleStyle ? xo(n.accentColor) : n.accentColor;
|
|
1357
1359
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1358
1360
|
"--pluno-pa-accent-contrast",
|
|
1359
|
-
|
|
1360
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1361
|
+
va(o)
|
|
1362
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? pa : n.fontFamily, n.scribbleStyle && Ea(e.ownerDocument);
|
|
1361
1363
|
const i = Array.from(
|
|
1362
1364
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1363
1365
|
);
|
|
@@ -1369,7 +1371,7 @@ function Jn(e, t, n) {
|
|
|
1369
1371
|
)
|
|
1370
1372
|
);
|
|
1371
1373
|
}
|
|
1372
|
-
function
|
|
1374
|
+
function Ea(e) {
|
|
1373
1375
|
if (e.getElementById(Vn))
|
|
1374
1376
|
return;
|
|
1375
1377
|
const t = e.createElement("style");
|
|
@@ -1381,7 +1383,7 @@ function Ca(e) {
|
|
|
1381
1383
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1382
1384
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1383
1385
|
}
|
|
1384
|
-
function
|
|
1386
|
+
function ka({
|
|
1385
1387
|
root: e,
|
|
1386
1388
|
launcher: t,
|
|
1387
1389
|
launcherDragHandle: n,
|
|
@@ -1394,13 +1396,13 @@ function Ea({
|
|
|
1394
1396
|
l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1395
1397
|
}, S = (m) => {
|
|
1396
1398
|
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(), g = !1, t.setPointerCapture?.(m.pointerId));
|
|
1397
|
-
},
|
|
1399
|
+
}, T = (m) => {
|
|
1398
1400
|
if (l !== m.pointerId || !p || !s)
|
|
1399
1401
|
return;
|
|
1400
1402
|
m.preventDefault();
|
|
1401
1403
|
const C = m.clientX - p.x, z = m.clientY - p.y;
|
|
1402
1404
|
!g && Math.hypot(C, z) < dn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + C, y: s.y + z }));
|
|
1403
|
-
},
|
|
1405
|
+
}, A = (m) => {
|
|
1404
1406
|
l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
|
|
1405
1407
|
}, D = (m) => {
|
|
1406
1408
|
l === m.pointerId && (m.preventDefault(), h());
|
|
@@ -1415,15 +1417,15 @@ function Ea({
|
|
|
1415
1417
|
}, v = (m) => {
|
|
1416
1418
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1417
1419
|
return;
|
|
1418
|
-
const C = m.shiftKey ?
|
|
1420
|
+
const C = m.shiftKey ? Ao : To, z = o();
|
|
1419
1421
|
let L = null;
|
|
1420
1422
|
m.key === "ArrowUp" ? L = { x: z.x, y: z.y - C } : m.key === "ArrowDown" ? L = { x: z.x, y: z.y + C } : m.key === "ArrowLeft" ? L = { x: z.x - C, y: z.y } : m.key === "ArrowRight" && (L = { x: z.x + C, y: z.y }), L && (m.preventDefault(), m.stopPropagation(), i(L), r());
|
|
1421
1423
|
};
|
|
1422
|
-
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove",
|
|
1423
|
-
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove",
|
|
1424
|
+
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", T), t.addEventListener("pointerup", A), t.addEventListener("pointercancel", D), t.addEventListener("click", u, !0), n.addEventListener("keydown", v), () => {
|
|
1425
|
+
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", T), t.removeEventListener("pointerup", A), t.removeEventListener("pointercancel", D), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", v);
|
|
1424
1426
|
};
|
|
1425
1427
|
}
|
|
1426
|
-
function
|
|
1428
|
+
function La({
|
|
1427
1429
|
root: e,
|
|
1428
1430
|
handles: t,
|
|
1429
1431
|
getBounds: n,
|
|
@@ -1444,20 +1446,20 @@ function ka({
|
|
|
1444
1446
|
!g && Math.hypot(v, m) < dn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), o(
|
|
1445
1447
|
eo(s, l, v, m)
|
|
1446
1448
|
));
|
|
1447
|
-
},
|
|
1449
|
+
}, T = (u) => {
|
|
1448
1450
|
r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && i(), c());
|
|
1449
|
-
},
|
|
1451
|
+
}, A = (u) => {
|
|
1450
1452
|
r === u.pointerId && (u.preventDefault(), c());
|
|
1451
1453
|
}, D = (u) => {
|
|
1452
|
-
const m = u.currentTarget.dataset.resizeDirection, C = u.shiftKey ?
|
|
1454
|
+
const m = u.currentTarget.dataset.resizeDirection, C = u.shiftKey ? Ao : To, z = n();
|
|
1453
1455
|
let L = 0, ie = 0;
|
|
1454
1456
|
Qn(m) && (u.key === "ArrowLeft" ? L = -C : u.key === "ArrowRight" ? L = C : u.key === "ArrowUp" ? ie = -C : u.key === "ArrowDown" && (ie = C), !(L === 0 && ie === 0) && (u.preventDefault(), u.stopPropagation(), o(eo(z, m, L, ie)), i()));
|
|
1455
1457
|
};
|
|
1456
1458
|
for (const u of t)
|
|
1457
|
-
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", S), u.addEventListener("pointerup",
|
|
1459
|
+
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", S), u.addEventListener("pointerup", T), u.addEventListener("pointercancel", A), u.addEventListener("keydown", D);
|
|
1458
1460
|
return () => {
|
|
1459
1461
|
for (const u of t)
|
|
1460
|
-
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", S), u.removeEventListener("pointerup",
|
|
1462
|
+
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", S), u.removeEventListener("pointerup", T), u.removeEventListener("pointercancel", A), u.removeEventListener("keydown", D);
|
|
1461
1463
|
};
|
|
1462
1464
|
}
|
|
1463
1465
|
function Qn(e) {
|
|
@@ -1544,32 +1546,32 @@ function vt(e, t = !0) {
|
|
|
1544
1546
|
const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1545
1547
|
return {
|
|
1546
1548
|
width: t && i && o.width > 0 ? o.width : Math.min(ko, n.width - 36),
|
|
1547
|
-
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1549
|
+
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? da : Lo
|
|
1548
1550
|
};
|
|
1549
1551
|
}
|
|
1550
|
-
function
|
|
1552
|
+
function Pa() {
|
|
1551
1553
|
const e = J();
|
|
1552
1554
|
return {
|
|
1553
1555
|
width: Math.min(
|
|
1554
1556
|
Z(
|
|
1555
|
-
e.width *
|
|
1557
|
+
e.width * ua,
|
|
1556
1558
|
fn,
|
|
1557
|
-
|
|
1559
|
+
ca
|
|
1558
1560
|
),
|
|
1559
1561
|
e.width - N * 2
|
|
1560
1562
|
),
|
|
1561
1563
|
height: Math.min(
|
|
1562
1564
|
Z(
|
|
1563
|
-
e.height *
|
|
1565
|
+
e.height * ha,
|
|
1564
1566
|
wn,
|
|
1565
|
-
|
|
1567
|
+
ga
|
|
1566
1568
|
),
|
|
1567
1569
|
e.height - Ne - N
|
|
1568
1570
|
)
|
|
1569
1571
|
};
|
|
1570
1572
|
}
|
|
1571
1573
|
function nt(e = null) {
|
|
1572
|
-
return e ? Ct(e) :
|
|
1574
|
+
return e ? Ct(e) : Pa();
|
|
1573
1575
|
}
|
|
1574
1576
|
function Ct(e) {
|
|
1575
1577
|
const t = J();
|
|
@@ -1625,9 +1627,9 @@ function Yt(e, t, n) {
|
|
|
1625
1627
|
e,
|
|
1626
1628
|
Ro(t, o),
|
|
1627
1629
|
o
|
|
1628
|
-
) :
|
|
1630
|
+
) : Aa(n === "bottom-left" ? "bottom-left" : "bottom-right", o, sa);
|
|
1629
1631
|
}
|
|
1630
|
-
function
|
|
1632
|
+
function Aa(e, t, n) {
|
|
1631
1633
|
const o = J();
|
|
1632
1634
|
return {
|
|
1633
1635
|
x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
|
|
@@ -1635,7 +1637,7 @@ function Pa(e, t, n) {
|
|
|
1635
1637
|
};
|
|
1636
1638
|
}
|
|
1637
1639
|
function cn(e, t, n) {
|
|
1638
|
-
const o = J(), i = N +
|
|
1640
|
+
const o = J(), i = N + Ra(e);
|
|
1639
1641
|
return {
|
|
1640
1642
|
x: Z(
|
|
1641
1643
|
t.x,
|
|
@@ -1663,19 +1665,19 @@ function Ro(e, t) {
|
|
|
1663
1665
|
};
|
|
1664
1666
|
}
|
|
1665
1667
|
function Ia(e, t) {
|
|
1666
|
-
const n =
|
|
1668
|
+
const n = Na(e, t), o = J();
|
|
1667
1669
|
return {
|
|
1668
1670
|
anchor: n,
|
|
1669
1671
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
1670
1672
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
1671
1673
|
};
|
|
1672
1674
|
}
|
|
1673
|
-
function
|
|
1675
|
+
function Na(e, t) {
|
|
1674
1676
|
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";
|
|
1675
1677
|
return `${r}-${l}`;
|
|
1676
1678
|
}
|
|
1677
|
-
function
|
|
1678
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1679
|
+
function Ra(e) {
|
|
1680
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? ba : wa;
|
|
1679
1681
|
}
|
|
1680
1682
|
function Xt(e, t, n, o = null) {
|
|
1681
1683
|
const i = vt(e), r = nt(o), l = {
|
|
@@ -1705,14 +1707,14 @@ function _t(e, t) {
|
|
|
1705
1707
|
)
|
|
1706
1708
|
};
|
|
1707
1709
|
}
|
|
1708
|
-
function
|
|
1710
|
+
function Ie(e, t) {
|
|
1709
1711
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1710
1712
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1711
1713
|
return;
|
|
1712
1714
|
}
|
|
1713
1715
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1714
1716
|
}
|
|
1715
|
-
function
|
|
1717
|
+
function Da(e, t) {
|
|
1716
1718
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1717
1719
|
}
|
|
1718
1720
|
function no(e) {
|
|
@@ -1746,31 +1748,31 @@ function Y(e, t, n) {
|
|
|
1746
1748
|
details: n
|
|
1747
1749
|
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1748
1750
|
r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
|
|
1749
|
-
new CustomEvent(
|
|
1751
|
+
new CustomEvent(na, { detail: i })
|
|
1750
1752
|
);
|
|
1751
1753
|
}
|
|
1752
|
-
function
|
|
1754
|
+
function za(e, t) {
|
|
1753
1755
|
Y("web-sdk.widget.position", e, t);
|
|
1754
1756
|
}
|
|
1755
1757
|
function Jt(e, t, n, o) {
|
|
1756
1758
|
const i = t.value.trim();
|
|
1757
1759
|
return !i && n.length === 0 ? n : (o(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(i, {
|
|
1758
|
-
attachments: n.length > 0 ? n.map(
|
|
1760
|
+
attachments: n.length > 0 ? n.map(Ua) : void 0
|
|
1759
1761
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1760
1762
|
}
|
|
1761
|
-
function
|
|
1763
|
+
function Ma(e, t, n) {
|
|
1762
1764
|
const o = e.activeElement;
|
|
1763
1765
|
return o === n ? "composer" : o === t ? "launcher" : null;
|
|
1764
1766
|
}
|
|
1765
|
-
function
|
|
1766
|
-
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt >
|
|
1767
|
+
function Oa(e, t, n, o) {
|
|
1768
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > $i)
|
|
1767
1769
|
return;
|
|
1768
1770
|
const i = e.focusedInput === "composer" ? o : n;
|
|
1769
1771
|
i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1770
1772
|
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1771
1773
|
});
|
|
1772
1774
|
}
|
|
1773
|
-
function
|
|
1775
|
+
function Ua(e) {
|
|
1774
1776
|
return e;
|
|
1775
1777
|
}
|
|
1776
1778
|
function tt(e) {
|
|
@@ -1783,7 +1785,7 @@ function ot(e, t = () => !0) {
|
|
|
1783
1785
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1784
1786
|
});
|
|
1785
1787
|
}
|
|
1786
|
-
function
|
|
1788
|
+
function Ba(e) {
|
|
1787
1789
|
const t = e.messages[e.messages.length - 1];
|
|
1788
1790
|
return [
|
|
1789
1791
|
e.messages.length,
|
|
@@ -1794,13 +1796,13 @@ function Ua(e) {
|
|
|
1794
1796
|
e.lastError ?? ""
|
|
1795
1797
|
].join(":");
|
|
1796
1798
|
}
|
|
1797
|
-
function
|
|
1799
|
+
function Fa(e) {
|
|
1798
1800
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1799
1801
|
}
|
|
1800
|
-
function
|
|
1802
|
+
function Wa(e) {
|
|
1801
1803
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1802
1804
|
}
|
|
1803
|
-
function
|
|
1805
|
+
function Ha(e) {
|
|
1804
1806
|
const t = e.currentPage;
|
|
1805
1807
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1806
1808
|
try {
|
|
@@ -1811,7 +1813,7 @@ function Wa(e) {
|
|
|
1811
1813
|
}
|
|
1812
1814
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1813
1815
|
}
|
|
1814
|
-
function
|
|
1816
|
+
function Ga(e, t) {
|
|
1815
1817
|
const n = new Date(e).getTime();
|
|
1816
1818
|
if (!Number.isFinite(n))
|
|
1817
1819
|
return "now";
|
|
@@ -1827,9 +1829,9 @@ function Ha(e, t) {
|
|
|
1827
1829
|
}
|
|
1828
1830
|
return "now";
|
|
1829
1831
|
}
|
|
1830
|
-
function
|
|
1831
|
-
e.appendChild(
|
|
1832
|
-
|
|
1832
|
+
function $a(e, t, n, o, i) {
|
|
1833
|
+
e.appendChild(er()), e.appendChild(
|
|
1834
|
+
qa(
|
|
1833
1835
|
t,
|
|
1834
1836
|
n,
|
|
1835
1837
|
o,
|
|
@@ -1839,12 +1841,12 @@ function Ga(e, t, n, o, i) {
|
|
|
1839
1841
|
Et(
|
|
1840
1842
|
"pluno-pa-widget__close",
|
|
1841
1843
|
"Close",
|
|
1842
|
-
|
|
1844
|
+
tr(16),
|
|
1843
1845
|
!0
|
|
1844
1846
|
)
|
|
1845
|
-
), e.appendChild(
|
|
1847
|
+
), e.appendChild(ja(n));
|
|
1846
1848
|
}
|
|
1847
|
-
function
|
|
1849
|
+
function qa(e, t, n, o) {
|
|
1848
1850
|
const i = document.createElement("form");
|
|
1849
1851
|
if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
|
|
1850
1852
|
const s = document.createElement("button");
|
|
@@ -1872,7 +1874,7 @@ function $a(e, t, n, o) {
|
|
|
1872
1874
|
}
|
|
1873
1875
|
return i;
|
|
1874
1876
|
}
|
|
1875
|
-
function
|
|
1877
|
+
function ja(e) {
|
|
1876
1878
|
const t = document.createElement("section");
|
|
1877
1879
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1878
1880
|
Oo("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
@@ -1880,7 +1882,7 @@ function qa(e) {
|
|
|
1880
1882
|
const n = document.createElement("div");
|
|
1881
1883
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1882
1884
|
const o = document.createElement("main");
|
|
1883
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1885
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(Za(e));
|
|
1884
1886
|
const i = document.createElement("div");
|
|
1885
1887
|
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
|
|
1886
1888
|
const r = document.createElement("div");
|
|
@@ -1892,10 +1894,10 @@ function qa(e) {
|
|
|
1892
1894
|
Et(
|
|
1893
1895
|
"pluno-pa-widget__history",
|
|
1894
1896
|
un(),
|
|
1895
|
-
|
|
1897
|
+
or(),
|
|
1896
1898
|
!0
|
|
1897
1899
|
)
|
|
1898
|
-
), n.appendChild(p), n.appendChild(
|
|
1900
|
+
), n.appendChild(p), n.appendChild(Xa()), t.appendChild(n), t.appendChild(Va()), t.appendChild(Ka()), t.appendChild(Ya()), t.appendChild(ye("left", "Resize Pluno from left")), t.appendChild(
|
|
1899
1901
|
ye("right", "Resize Pluno from right")
|
|
1900
1902
|
), t.appendChild(ye("top", "Resize Pluno from top")), t.appendChild(
|
|
1901
1903
|
ye("bottom", "Resize Pluno from bottom")
|
|
@@ -1916,7 +1918,7 @@ function ye(e, t) {
|
|
|
1916
1918
|
`pluno-pa-widget__resize-handle--${e}`
|
|
1917
1919
|
].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
|
|
1918
1920
|
}
|
|
1919
|
-
function
|
|
1921
|
+
function Va() {
|
|
1920
1922
|
const e = document.createElement("div");
|
|
1921
1923
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1922
1924
|
const t = document.createElement("span");
|
|
@@ -1930,7 +1932,7 @@ function ja() {
|
|
|
1930
1932
|
const r = document.createElement("button");
|
|
1931
1933
|
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;
|
|
1932
1934
|
}
|
|
1933
|
-
function
|
|
1935
|
+
function Ka() {
|
|
1934
1936
|
const e = document.createElement("div");
|
|
1935
1937
|
e.className = "pluno-pa-widget__notify-suggestion pluno-pa-widget__tab-groups-suggestion", e.hidden = !0;
|
|
1936
1938
|
const t = document.createElement("span");
|
|
@@ -1942,7 +1944,7 @@ function Va() {
|
|
|
1942
1944
|
const i = document.createElement("button");
|
|
1943
1945
|
return i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later pluno-pa-widget__tab-groups-suggestion-dismiss", i.textContent = "Not now", n.append(o, i), e.append(t, n), e;
|
|
1944
1946
|
}
|
|
1945
|
-
function
|
|
1947
|
+
function Ya() {
|
|
1946
1948
|
const e = document.createElement("form");
|
|
1947
1949
|
e.className = "pluno-pa-widget__composer";
|
|
1948
1950
|
const t = document.createElement("div");
|
|
@@ -1956,7 +1958,7 @@ function Ka() {
|
|
|
1956
1958
|
const r = document.createElement("input");
|
|
1957
1959
|
r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
|
|
1958
1960
|
const l = document.createElement("button");
|
|
1959
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1961
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ar()), l.appendChild(rr()), i.appendChild(l);
|
|
1960
1962
|
const p = document.createElement("textarea");
|
|
1961
1963
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1962
1964
|
const s = document.createElement("button");
|
|
@@ -1971,7 +1973,7 @@ function Ka() {
|
|
|
1971
1973
|
function un() {
|
|
1972
1974
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1973
1975
|
}
|
|
1974
|
-
function
|
|
1976
|
+
function Xa() {
|
|
1975
1977
|
const e = document.createElement("section");
|
|
1976
1978
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", un());
|
|
1977
1979
|
const t = document.createElement("div");
|
|
@@ -1981,7 +1983,7 @@ function Ya() {
|
|
|
1981
1983
|
const o = Et(
|
|
1982
1984
|
"pluno-pa-widget__history-close",
|
|
1983
1985
|
"Close recent chats",
|
|
1984
|
-
|
|
1986
|
+
ir(),
|
|
1985
1987
|
!1
|
|
1986
1988
|
);
|
|
1987
1989
|
t.append(n, o);
|
|
@@ -1990,7 +1992,7 @@ function Ya() {
|
|
|
1990
1992
|
const r = document.createElement("p");
|
|
1991
1993
|
return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
|
|
1992
1994
|
}
|
|
1993
|
-
function
|
|
1995
|
+
function Za(e) {
|
|
1994
1996
|
const t = document.createElement("div");
|
|
1995
1997
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1996
1998
|
ve(
|
|
@@ -2018,14 +2020,14 @@ function zo(e, t) {
|
|
|
2018
2020
|
function ve(e, t) {
|
|
2019
2021
|
const n = `pluno-pa-character-${Xn}`;
|
|
2020
2022
|
Xn += 1;
|
|
2021
|
-
const o = t.scribbleStyle ?
|
|
2023
|
+
const o = t.scribbleStyle ? Qa(t.accentColor, n) : Ja(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
|
|
2022
2024
|
return o.setAttribute(
|
|
2023
2025
|
"class",
|
|
2024
2026
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
2025
2027
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
2026
2028
|
}
|
|
2027
|
-
function
|
|
2028
|
-
const n =
|
|
2029
|
+
function Ja(e, t) {
|
|
2030
|
+
const n = xi(e), o = {
|
|
2029
2031
|
boltFill: `${t}-boltFill`,
|
|
2030
2032
|
boltEdge: `${t}-boltEdge`,
|
|
2031
2033
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -2123,7 +2125,7 @@ function Za(e, t) {
|
|
|
2123
2125
|
in2: "innerLight",
|
|
2124
2126
|
mode: "screen"
|
|
2125
2127
|
});
|
|
2126
|
-
const
|
|
2128
|
+
const T = w(r, "filter", {
|
|
2127
2129
|
id: o.eyeShadow,
|
|
2128
2130
|
x: "-24%",
|
|
2129
2131
|
y: "-20%",
|
|
@@ -2131,14 +2133,14 @@ function Za(e, t) {
|
|
|
2131
2133
|
height: "148%",
|
|
2132
2134
|
"color-interpolation-filters": "sRGB"
|
|
2133
2135
|
});
|
|
2134
|
-
w(
|
|
2136
|
+
w(T, "feDropShadow", {
|
|
2135
2137
|
dx: "0",
|
|
2136
2138
|
dy: "8",
|
|
2137
2139
|
stdDeviation: "5",
|
|
2138
2140
|
"flood-color": n.shadow,
|
|
2139
2141
|
"flood-opacity": "0.3"
|
|
2140
2142
|
});
|
|
2141
|
-
const
|
|
2143
|
+
const A = w(r, "filter", {
|
|
2142
2144
|
id: o.pupilGloss,
|
|
2143
2145
|
x: "-15%",
|
|
2144
2146
|
y: "-15%",
|
|
@@ -2146,7 +2148,7 @@ function Za(e, t) {
|
|
|
2146
2148
|
height: "130%",
|
|
2147
2149
|
"color-interpolation-filters": "sRGB"
|
|
2148
2150
|
});
|
|
2149
|
-
w(
|
|
2151
|
+
w(A, "feDropShadow", {
|
|
2150
2152
|
dx: "0",
|
|
2151
2153
|
dy: "3",
|
|
2152
2154
|
stdDeviation: "3",
|
|
@@ -2221,7 +2223,7 @@ function Za(e, t) {
|
|
|
2221
2223
|
o
|
|
2222
2224
|
), i;
|
|
2223
2225
|
}
|
|
2224
|
-
function
|
|
2226
|
+
function Qa(e, t) {
|
|
2225
2227
|
const n = xo(e), o = {
|
|
2226
2228
|
clip: `${t}-scribbleBoltClip`,
|
|
2227
2229
|
wobble: `${t}-scribbleBoltWobble`
|
|
@@ -2252,7 +2254,7 @@ function Ja(e, t) {
|
|
|
2252
2254
|
"clip-path": X(o.clip)
|
|
2253
2255
|
});
|
|
2254
2256
|
return w(g, "path", {
|
|
2255
|
-
d:
|
|
2257
|
+
d: _i(),
|
|
2256
2258
|
fill: "none",
|
|
2257
2259
|
stroke: n,
|
|
2258
2260
|
"stroke-width": "56",
|
|
@@ -2288,7 +2290,7 @@ function Ja(e, t) {
|
|
|
2288
2290
|
}
|
|
2289
2291
|
function Mo() {
|
|
2290
2292
|
return E("svg", {
|
|
2291
|
-
xmlns:
|
|
2293
|
+
xmlns: Po,
|
|
2292
2294
|
viewBox: "0 0 1254 1254"
|
|
2293
2295
|
});
|
|
2294
2296
|
}
|
|
@@ -2352,7 +2354,7 @@ function Et(e, t, n, o) {
|
|
|
2352
2354
|
const i = document.createElement("button");
|
|
2353
2355
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
|
|
2354
2356
|
}
|
|
2355
|
-
function
|
|
2357
|
+
function er() {
|
|
2356
2358
|
const e = E("svg", {
|
|
2357
2359
|
class: "pluno-pa-widget__scribble-defs",
|
|
2358
2360
|
"aria-hidden": "true",
|
|
@@ -2382,7 +2384,7 @@ function Qt(e, t) {
|
|
|
2382
2384
|
0,
|
|
2383
2385
|
t - sn * 2
|
|
2384
2386
|
), o = Math.max(
|
|
2385
|
-
|
|
2387
|
+
fa,
|
|
2386
2388
|
Math.floor(
|
|
2387
2389
|
(n - pn * 2) / ln
|
|
2388
2390
|
)
|
|
@@ -2395,7 +2397,7 @@ function Uo(e, t) {
|
|
|
2395
2397
|
const n = t * ln + pn * 2;
|
|
2396
2398
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2397
2399
|
"viewBox",
|
|
2398
|
-
`0 0 ${n} ${
|
|
2400
|
+
`0 0 ${n} ${ma}`
|
|
2399
2401
|
), e.replaceChildren();
|
|
2400
2402
|
for (let o = 0; o < t; o += 1) {
|
|
2401
2403
|
const i = Yn[o % Yn.length], r = E("g", {
|
|
@@ -2466,7 +2468,7 @@ function en(e, t, n) {
|
|
|
2466
2468
|
})
|
|
2467
2469
|
), o;
|
|
2468
2470
|
}
|
|
2469
|
-
function
|
|
2471
|
+
function tr(e) {
|
|
2470
2472
|
const t = ce(
|
|
2471
2473
|
"0 0 24 24",
|
|
2472
2474
|
e,
|
|
@@ -2477,7 +2479,7 @@ function er(e) {
|
|
|
2477
2479
|
);
|
|
2478
2480
|
return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2479
2481
|
}
|
|
2480
|
-
function
|
|
2482
|
+
function nr() {
|
|
2481
2483
|
const e = ce(
|
|
2482
2484
|
"0 0 24 24",
|
|
2483
2485
|
17,
|
|
@@ -2496,7 +2498,7 @@ function tr() {
|
|
|
2496
2498
|
})
|
|
2497
2499
|
), e;
|
|
2498
2500
|
}
|
|
2499
|
-
function
|
|
2501
|
+
function or() {
|
|
2500
2502
|
const e = ce(
|
|
2501
2503
|
"0 0 24 24",
|
|
2502
2504
|
17,
|
|
@@ -2507,7 +2509,7 @@ function nr() {
|
|
|
2507
2509
|
);
|
|
2508
2510
|
return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
|
|
2509
2511
|
}
|
|
2510
|
-
function
|
|
2512
|
+
function ir() {
|
|
2511
2513
|
const e = ce(
|
|
2512
2514
|
"0 0 24 24",
|
|
2513
2515
|
15,
|
|
@@ -2531,7 +2533,7 @@ function Bo() {
|
|
|
2531
2533
|
E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2532
2534
|
), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2533
2535
|
}
|
|
2534
|
-
function
|
|
2536
|
+
function ar() {
|
|
2535
2537
|
const e = ce(
|
|
2536
2538
|
"0 0 24 24",
|
|
2537
2539
|
16,
|
|
@@ -2549,7 +2551,7 @@ function ir() {
|
|
|
2549
2551
|
})
|
|
2550
2552
|
), e;
|
|
2551
2553
|
}
|
|
2552
|
-
function
|
|
2554
|
+
function rr() {
|
|
2553
2555
|
const e = ce("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2554
2556
|
return e.setAttribute(
|
|
2555
2557
|
"class",
|
|
@@ -2564,7 +2566,7 @@ function ar() {
|
|
|
2564
2566
|
})
|
|
2565
2567
|
), e;
|
|
2566
2568
|
}
|
|
2567
|
-
function
|
|
2569
|
+
function lr() {
|
|
2568
2570
|
const e = ce("0 0 24 24", 18, 18, "currentColor");
|
|
2569
2571
|
return e.appendChild(
|
|
2570
2572
|
E("rect", {
|
|
@@ -2576,7 +2578,7 @@ function rr() {
|
|
|
2576
2578
|
})
|
|
2577
2579
|
), e;
|
|
2578
2580
|
}
|
|
2579
|
-
function
|
|
2581
|
+
function pr() {
|
|
2580
2582
|
const e = ce(
|
|
2581
2583
|
"0 0 24 24",
|
|
2582
2584
|
12,
|
|
@@ -2587,7 +2589,7 @@ function lr() {
|
|
|
2587
2589
|
);
|
|
2588
2590
|
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2589
2591
|
}
|
|
2590
|
-
function
|
|
2592
|
+
function sr() {
|
|
2591
2593
|
const e = ce(
|
|
2592
2594
|
"0 0 24 24",
|
|
2593
2595
|
13,
|
|
@@ -2622,7 +2624,7 @@ function ce(e, t, n, o, i, r) {
|
|
|
2622
2624
|
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
|
|
2623
2625
|
}
|
|
2624
2626
|
function E(e, t = {}) {
|
|
2625
|
-
const n = document.createElementNS(
|
|
2627
|
+
const n = document.createElementNS(Po, e);
|
|
2626
2628
|
for (const [o, i] of Object.entries(t))
|
|
2627
2629
|
n.setAttribute(o, i);
|
|
2628
2630
|
return n;
|
|
@@ -2633,18 +2635,18 @@ function ao(e) {
|
|
|
2633
2635
|
n.stopPropagation();
|
|
2634
2636
|
});
|
|
2635
2637
|
}
|
|
2636
|
-
function
|
|
2638
|
+
function dr(e, t, n) {
|
|
2637
2639
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2638
2640
|
for (const [o, i] of t.entries()) {
|
|
2639
2641
|
const r = document.createElement("div");
|
|
2640
|
-
r.className = "pluno-pa-widget__attachment", r.appendChild(
|
|
2642
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(cr(i));
|
|
2641
2643
|
const l = document.createElement("span");
|
|
2642
2644
|
l.textContent = i.name, r.appendChild(l);
|
|
2643
2645
|
const p = document.createElement("button");
|
|
2644
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2646
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(pr()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
|
|
2645
2647
|
}
|
|
2646
2648
|
}
|
|
2647
|
-
function
|
|
2649
|
+
function cr(e) {
|
|
2648
2650
|
const t = bn(e), n = Fo(e);
|
|
2649
2651
|
if (t === "image" && n) {
|
|
2650
2652
|
const o = document.createElement("img");
|
|
@@ -2656,7 +2658,7 @@ function dr(e) {
|
|
|
2656
2658
|
}
|
|
2657
2659
|
return se(e);
|
|
2658
2660
|
}
|
|
2659
|
-
function
|
|
2661
|
+
function ur(e) {
|
|
2660
2662
|
const t = bn(e), n = Fo(e);
|
|
2661
2663
|
if (t === "image" && n) {
|
|
2662
2664
|
const o = document.createElement("img");
|
|
@@ -2694,13 +2696,13 @@ function ro(e) {
|
|
|
2694
2696
|
const t = bn(e);
|
|
2695
2697
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2696
2698
|
}
|
|
2697
|
-
function
|
|
2699
|
+
function gr(e, t) {
|
|
2698
2700
|
return t ? Array.from(t).map((o) => ({
|
|
2699
2701
|
...e.createLocalAttachment(o),
|
|
2700
|
-
previewUrl:
|
|
2702
|
+
previewUrl: hr(o)
|
|
2701
2703
|
})) : [];
|
|
2702
2704
|
}
|
|
2703
|
-
function
|
|
2705
|
+
function hr(e) {
|
|
2704
2706
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2705
2707
|
}
|
|
2706
2708
|
function ft(e) {
|
|
@@ -2712,10 +2714,10 @@ function tn(e, t, n = null) {
|
|
|
2712
2714
|
return;
|
|
2713
2715
|
}
|
|
2714
2716
|
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) || _n(n) ? e.appendChild(
|
|
2715
|
-
|
|
2716
|
-
) : Wo(t) && e.appendChild(
|
|
2717
|
+
mr(t, n)
|
|
2718
|
+
) : Wo(t) && e.appendChild(fr(t));
|
|
2717
2719
|
}
|
|
2718
|
-
function
|
|
2720
|
+
function mr(e, t) {
|
|
2719
2721
|
const n = document.createElement("div");
|
|
2720
2722
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2721
2723
|
const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
@@ -2729,13 +2731,13 @@ function hr(e, t) {
|
|
|
2729
2731
|
)
|
|
2730
2732
|
), n;
|
|
2731
2733
|
}
|
|
2732
|
-
function
|
|
2734
|
+
function fr(e) {
|
|
2733
2735
|
const t = document.createElement("div");
|
|
2734
2736
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2735
2737
|
const n = document.createElement("strong");
|
|
2736
2738
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2737
2739
|
const o = document.createElement("span");
|
|
2738
|
-
return o.textContent =
|
|
2740
|
+
return o.textContent = br(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2739
2741
|
Ho(
|
|
2740
2742
|
e,
|
|
2741
2743
|
"Upgrade",
|
|
@@ -2747,9 +2749,9 @@ function gn(e, t) {
|
|
|
2747
2749
|
return e !== null && (de(e) || Wo(e) || _n(t));
|
|
2748
2750
|
}
|
|
2749
2751
|
function lo(e, t, n) {
|
|
2750
|
-
return gn(t, n) ||
|
|
2752
|
+
return gn(t, n) || wr(t) ? !0 : !gn(e, n);
|
|
2751
2753
|
}
|
|
2752
|
-
function
|
|
2754
|
+
function wr(e) {
|
|
2753
2755
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || de(e));
|
|
2754
2756
|
}
|
|
2755
2757
|
function de(e) {
|
|
@@ -2761,10 +2763,10 @@ function _n(e) {
|
|
|
2761
2763
|
function Wo(e) {
|
|
2762
2764
|
return !de(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2763
2765
|
}
|
|
2764
|
-
function wr(e) {
|
|
2765
|
-
return e.creditsRemaining === null ? null : `${br(e.creditsRemaining)} credits left`;
|
|
2766
|
-
}
|
|
2767
2766
|
function br(e) {
|
|
2767
|
+
return e.creditsRemaining === null ? null : `${_r(e.creditsRemaining)} credits left`;
|
|
2768
|
+
}
|
|
2769
|
+
function _r(e) {
|
|
2768
2770
|
return new Intl.NumberFormat("en-US", {
|
|
2769
2771
|
maximumFractionDigits: 0
|
|
2770
2772
|
}).format(Math.ceil(e));
|
|
@@ -2793,8 +2795,8 @@ function nn(e, t) {
|
|
|
2793
2795
|
(o) => !Go(o)
|
|
2794
2796
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2795
2797
|
}
|
|
2796
|
-
function
|
|
2797
|
-
const z =
|
|
2798
|
+
function xr(e, t, n, o, i, r, l, p, s, g, c, h, S, T, A, D, u, v, m, C) {
|
|
2799
|
+
const z = Cr(r), L = z.filter(
|
|
2798
2800
|
(x) => !Go(x)
|
|
2799
2801
|
), ie = e.scrollTop, Q = [], Re = /* @__PURE__ */ new Set(), U = (x) => {
|
|
2800
2802
|
Q.push(x);
|
|
@@ -2806,11 +2808,11 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2806
2808
|
x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
|
|
2807
2809
|
const R = document.createElement("div");
|
|
2808
2810
|
R.className = "pluno-pa-widget__empty-hero";
|
|
2809
|
-
const
|
|
2811
|
+
const P = ve(
|
|
2810
2812
|
"pluno-pa-widget__character--empty",
|
|
2811
|
-
|
|
2813
|
+
T()
|
|
2812
2814
|
);
|
|
2813
|
-
if (R.appendChild(
|
|
2815
|
+
if (R.appendChild(P), x.appendChild(R), u) {
|
|
2814
2816
|
const y = document.createElement("h2");
|
|
2815
2817
|
y.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", y.textContent = u.opening, x.appendChild(y);
|
|
2816
2818
|
} else
|
|
@@ -2818,18 +2820,18 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2818
2820
|
const re = u?.prompts ?? r.starterPrompts, H = document.createElement("div");
|
|
2819
2821
|
if (H.className = re.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", re.length === 0 && !r.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), re.length > 0)
|
|
2820
2822
|
for (const y of re) {
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
}), H.appendChild(
|
|
2823
|
+
const I = document.createElement("button");
|
|
2824
|
+
I.type = "button", I.className = "pluno-pa-widget__starter-prompt", I.textContent = `"${y}"`, I.addEventListener("click", () => {
|
|
2825
|
+
A(y);
|
|
2826
|
+
}), H.appendChild(I);
|
|
2825
2827
|
}
|
|
2826
2828
|
else if (r.starterPromptsLoading) {
|
|
2827
2829
|
const y = document.createElement("button");
|
|
2828
2830
|
y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", y.disabled = !0, y.tabIndex = -1, y.textContent = "Generating example tasks...", H.appendChild(y);
|
|
2829
2831
|
} else
|
|
2830
|
-
for (let y = 0; y <
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2832
|
+
for (let y = 0; y < oa; y += 1) {
|
|
2833
|
+
const I = document.createElement("button");
|
|
2834
|
+
I.type = "button", I.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", I.disabled = !0, I.tabIndex = -1, I.textContent = "", H.appendChild(I);
|
|
2833
2835
|
}
|
|
2834
2836
|
if (x.appendChild(H), u) {
|
|
2835
2837
|
const y = document.createElement("button");
|
|
@@ -2842,11 +2844,11 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2842
2844
|
const De = L.length - 1, Se = De >= 0 && hn(L[De]), Ce = () => {
|
|
2843
2845
|
if (ee.length === 0)
|
|
2844
2846
|
return !1;
|
|
2845
|
-
const x =
|
|
2847
|
+
const x = Rr(
|
|
2846
2848
|
ee,
|
|
2847
2849
|
c,
|
|
2848
2850
|
S,
|
|
2849
|
-
|
|
2851
|
+
T()
|
|
2850
2852
|
);
|
|
2851
2853
|
return U(x), B = null, f = x, ee = [], !0;
|
|
2852
2854
|
};
|
|
@@ -2860,28 +2862,28 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2860
2862
|
if (x !== De)
|
|
2861
2863
|
continue;
|
|
2862
2864
|
if (Ce()) {
|
|
2863
|
-
const
|
|
2864
|
-
U(
|
|
2865
|
+
const I = St();
|
|
2866
|
+
U(I), B = null, f = I;
|
|
2865
2867
|
} else {
|
|
2866
|
-
const
|
|
2867
|
-
U(
|
|
2868
|
+
const I = ho(T());
|
|
2869
|
+
U(I), B = null, f = I;
|
|
2868
2870
|
}
|
|
2869
2871
|
continue;
|
|
2870
2872
|
}
|
|
2871
2873
|
if (R.role === "system") {
|
|
2872
2874
|
if (R.dataType === "run_error" || R.dataType === "run_status") {
|
|
2873
2875
|
Ce();
|
|
2874
|
-
const y = document.createElement("div"),
|
|
2875
|
-
y.className =
|
|
2876
|
+
const y = document.createElement("div"), I = R.dataType === "run_error";
|
|
2877
|
+
y.className = I ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = go(R.content), U(y), B = I ? y : null, f = I ? null : y;
|
|
2876
2878
|
}
|
|
2877
2879
|
continue;
|
|
2878
2880
|
}
|
|
2879
|
-
const
|
|
2880
|
-
if (R.role === "assistant" && !
|
|
2881
|
-
const y = $o(
|
|
2881
|
+
const P = Ce(), re = go(R.content);
|
|
2882
|
+
if (R.role === "assistant" && !P) {
|
|
2883
|
+
const y = $o(T());
|
|
2882
2884
|
U(y), B = null, f = y;
|
|
2883
2885
|
}
|
|
2884
|
-
const H =
|
|
2886
|
+
const H = yr(R, re, h, Re);
|
|
2885
2887
|
U(H), B = H, f = null;
|
|
2886
2888
|
}
|
|
2887
2889
|
const j = Ce(), at = L[L.length - 1]?.id === "assistant-draft";
|
|
@@ -2890,7 +2892,7 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2890
2892
|
const x = St();
|
|
2891
2893
|
U(x), B = null, f = x;
|
|
2892
2894
|
} else {
|
|
2893
|
-
const x = ho(
|
|
2895
|
+
const x = ho(T());
|
|
2894
2896
|
U(x), B = null, f = x;
|
|
2895
2897
|
}
|
|
2896
2898
|
if (r.lastError) {
|
|
@@ -2898,17 +2900,17 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2898
2900
|
x.className = "pluno-pa-widget__error";
|
|
2899
2901
|
const R = document.createElement("span");
|
|
2900
2902
|
if (R.textContent = r.lastError, x.appendChild(R), r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
|
|
2901
|
-
const
|
|
2902
|
-
|
|
2903
|
+
const P = document.createElement("button");
|
|
2904
|
+
P.type = "button", P.className = "pluno-pa-widget__error-retry", P.textContent = "Try again", P.addEventListener(
|
|
2903
2905
|
"click",
|
|
2904
2906
|
r.lastErrorCode === "connection_failed" ? m : D
|
|
2905
|
-
), x.appendChild(
|
|
2907
|
+
), x.appendChild(P);
|
|
2906
2908
|
}
|
|
2907
2909
|
U(x), B = x, f = null;
|
|
2908
2910
|
}
|
|
2909
|
-
const ae = C && !r.isThinking ?
|
|
2911
|
+
const ae = C && !r.isThinking ? Ci(z) : null;
|
|
2910
2912
|
if (C && ae && !C.dismissedCandidateIds.has(ae.id)) {
|
|
2911
|
-
const x =
|
|
2913
|
+
const x = Lr(ae, {
|
|
2912
2914
|
isDrafting: C.draftingCandidateId === ae.id,
|
|
2913
2915
|
error: C.error,
|
|
2914
2916
|
characterIconOptions: C.characterIconOptions,
|
|
@@ -2918,18 +2920,18 @@ function _r(e, t, n, o, i, r, l, p, s, g, c, h, S, P, I, D, u, v, m, C) {
|
|
|
2918
2920
|
});
|
|
2919
2921
|
U(x), C.onSeen(ae), B = null, f = x;
|
|
2920
2922
|
}
|
|
2921
|
-
B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t),
|
|
2923
|
+
B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), Sr(h, Re), so(e, Q), s ? ot(e, g) : e.scrollTop = ie;
|
|
2922
2924
|
}
|
|
2923
|
-
function
|
|
2924
|
-
const i =
|
|
2925
|
+
function yr(e, t, n, o) {
|
|
2926
|
+
const i = vr(e, t), r = i ? n.get(i) : void 0;
|
|
2925
2927
|
if (i && r)
|
|
2926
2928
|
return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
|
|
2927
2929
|
const l = document.createElement("div");
|
|
2928
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2930
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? zr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Er(e.attachments));
|
|
2929
2931
|
const p = document.createElement("div");
|
|
2930
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2932
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(kr(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
|
|
2931
2933
|
}
|
|
2932
|
-
function
|
|
2934
|
+
function vr(e, t) {
|
|
2933
2935
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2934
2936
|
id: e.id,
|
|
2935
2937
|
content: t,
|
|
@@ -2947,7 +2949,7 @@ function yr(e, t) {
|
|
|
2947
2949
|
})
|
|
2948
2950
|
});
|
|
2949
2951
|
}
|
|
2950
|
-
function
|
|
2952
|
+
function Sr(e, t) {
|
|
2951
2953
|
for (const n of e.keys())
|
|
2952
2954
|
t.has(n) || e.delete(n);
|
|
2953
2955
|
}
|
|
@@ -2965,7 +2967,7 @@ function so(e, t) {
|
|
|
2965
2967
|
n = n.nextSibling, e.removeChild(o);
|
|
2966
2968
|
}
|
|
2967
2969
|
}
|
|
2968
|
-
function
|
|
2970
|
+
function Cr(e) {
|
|
2969
2971
|
if (!e.assistantDraft)
|
|
2970
2972
|
return [...e.messages];
|
|
2971
2973
|
const t = {
|
|
@@ -3027,20 +3029,20 @@ function uo(e, t, n, o, i, r, l, p) {
|
|
|
3027
3029
|
}
|
|
3028
3030
|
e.appendChild(s);
|
|
3029
3031
|
}
|
|
3030
|
-
function
|
|
3032
|
+
function Er(e) {
|
|
3031
3033
|
const t = document.createElement("div");
|
|
3032
3034
|
t.className = "pluno-pa-widget__message-attachments";
|
|
3033
3035
|
for (const n of e)
|
|
3034
|
-
t.appendChild(
|
|
3036
|
+
t.appendChild(ur(n));
|
|
3035
3037
|
return t;
|
|
3036
3038
|
}
|
|
3037
|
-
function
|
|
3039
|
+
function kr(e) {
|
|
3038
3040
|
const t = document.createElement("button");
|
|
3039
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
3041
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(sr()), t.addEventListener("click", (n) => {
|
|
3040
3042
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
3041
3043
|
}), t;
|
|
3042
3044
|
}
|
|
3043
|
-
function
|
|
3045
|
+
function Lr(e, t) {
|
|
3044
3046
|
const n = document.createElement("article");
|
|
3045
3047
|
n.className = "pluno-pa-widget__share-prompt";
|
|
3046
3048
|
const o = document.createElement("div");
|
|
@@ -3081,7 +3083,7 @@ function kr(e, t) {
|
|
|
3081
3083
|
}
|
|
3082
3084
|
return o.appendChild(p), n.appendChild(o), n;
|
|
3083
3085
|
}
|
|
3084
|
-
function
|
|
3086
|
+
function Pr(e, t) {
|
|
3085
3087
|
const n = document.createElement("div");
|
|
3086
3088
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (u) => {
|
|
3087
3089
|
u.target === n && t.onClose();
|
|
@@ -3104,7 +3106,7 @@ function Lr(e, t) {
|
|
|
3104
3106
|
"Copy Screenshot",
|
|
3105
3107
|
async () => {
|
|
3106
3108
|
try {
|
|
3107
|
-
return await
|
|
3109
|
+
return await Ei(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
3108
3110
|
} catch {
|
|
3109
3111
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
3110
3112
|
}
|
|
@@ -3119,13 +3121,13 @@ function Lr(e, t) {
|
|
|
3119
3121
|
o.appendChild(s), o.appendChild(p);
|
|
3120
3122
|
const S = document.createElement("div");
|
|
3121
3123
|
S.className = "pluno-pa-widget__share-dialog-step";
|
|
3122
|
-
const
|
|
3123
|
-
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3124
|
+
const T = document.createElement("strong");
|
|
3125
|
+
T.className = "pluno-pa-widget__share-dialog-step-title", T.textContent = "2) Share on", S.appendChild(T);
|
|
3126
|
+
const A = document.createElement("p");
|
|
3127
|
+
A.className = "pluno-pa-widget__share-dialog-hint", A.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(A);
|
|
3126
3128
|
const D = document.createElement("footer");
|
|
3127
3129
|
D.className = "pluno-pa-widget__share-dialog-platforms";
|
|
3128
|
-
for (const u of
|
|
3130
|
+
for (const u of Ar(e)) {
|
|
3129
3131
|
const v = document.createElement("a");
|
|
3130
3132
|
v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(Ir(u.id)), D.appendChild(v);
|
|
3131
3133
|
}
|
|
@@ -3135,7 +3137,7 @@ function Lr(e, t) {
|
|
|
3135
3137
|
const v = document.createElement("strong");
|
|
3136
3138
|
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(v);
|
|
3137
3139
|
const m = document.createElement("a");
|
|
3138
|
-
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(
|
|
3140
|
+
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(Nr()), u.appendChild(m), o.appendChild(u);
|
|
3139
3141
|
}
|
|
3140
3142
|
return n.appendChild(o), n;
|
|
3141
3143
|
}
|
|
@@ -3145,7 +3147,7 @@ function Tr(e, t) {
|
|
|
3145
3147
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
3146
3148
|
}), n;
|
|
3147
3149
|
}
|
|
3148
|
-
function
|
|
3150
|
+
function Ar(e) {
|
|
3149
3151
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
3150
3152
|
return [
|
|
3151
3153
|
{
|
|
@@ -3192,7 +3194,7 @@ function $(e, t, n) {
|
|
|
3192
3194
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3193
3195
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
3194
3196
|
}
|
|
3195
|
-
function
|
|
3197
|
+
function Nr() {
|
|
3196
3198
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3197
3199
|
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"), $(
|
|
3198
3200
|
e,
|
|
@@ -3205,7 +3207,7 @@ function Go(e) {
|
|
|
3205
3207
|
function go(e) {
|
|
3206
3208
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3207
3209
|
}
|
|
3208
|
-
function
|
|
3210
|
+
function Rr(e, t, n, o) {
|
|
3209
3211
|
const i = document.createElement("article");
|
|
3210
3212
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
3211
3213
|
e[e.length - 1].createdAt
|
|
@@ -3215,7 +3217,7 @@ function Nr(e, t, n, o) {
|
|
|
3215
3217
|
o
|
|
3216
3218
|
)
|
|
3217
3219
|
);
|
|
3218
|
-
const r = document.createElement("details"), l =
|
|
3220
|
+
const r = document.createElement("details"), l = Dr(e);
|
|
3219
3221
|
r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
|
|
3220
3222
|
i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
|
|
3221
3223
|
});
|
|
@@ -3228,8 +3230,8 @@ function Nr(e, t, n, o) {
|
|
|
3228
3230
|
for (const h of e) {
|
|
3229
3231
|
const S = document.createElement("div");
|
|
3230
3232
|
S.className = "pluno-pa-widget__tool-line", h.loading && S.appendChild(mn());
|
|
3231
|
-
const
|
|
3232
|
-
|
|
3233
|
+
const T = document.createElement("span");
|
|
3234
|
+
T.textContent = h.content || "Run tool", S.appendChild(T), c.appendChild(S);
|
|
3233
3235
|
}
|
|
3234
3236
|
r.appendChild(c);
|
|
3235
3237
|
}
|
|
@@ -3256,7 +3258,7 @@ function St(e = "Thinking...") {
|
|
|
3256
3258
|
const o = document.createElement("span");
|
|
3257
3259
|
return o.textContent = e, t.appendChild(o), t;
|
|
3258
3260
|
}
|
|
3259
|
-
function
|
|
3261
|
+
function Dr(e) {
|
|
3260
3262
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3261
3263
|
}
|
|
3262
3264
|
function mn() {
|
|
@@ -3264,10 +3266,10 @@ function mn() {
|
|
|
3264
3266
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3265
3267
|
}
|
|
3266
3268
|
function qo(e, t) {
|
|
3267
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
3269
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? lr() : Bo());
|
|
3268
3270
|
}
|
|
3269
|
-
function
|
|
3270
|
-
const n =
|
|
3271
|
+
function zr(e, t) {
|
|
3272
|
+
const n = Fi(t).replace(/\r\n/g, `
|
|
3271
3273
|
`).split(`
|
|
3272
3274
|
`);
|
|
3273
3275
|
let o = 0;
|
|
@@ -3341,7 +3343,7 @@ function wt(e, t) {
|
|
|
3341
3343
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
3342
3344
|
} else {
|
|
3343
3345
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3344
|
-
if (p &&
|
|
3346
|
+
if (p && Mr(p[2])) {
|
|
3345
3347
|
const s = document.createElement("a");
|
|
3346
3348
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
|
|
3347
3349
|
} else
|
|
@@ -3351,7 +3353,7 @@ function wt(e, t) {
|
|
|
3351
3353
|
}
|
|
3352
3354
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
3353
3355
|
}
|
|
3354
|
-
function
|
|
3356
|
+
function Mr(e) {
|
|
3355
3357
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
3356
3358
|
return !0;
|
|
3357
3359
|
try {
|
|
@@ -3362,7 +3364,7 @@ function zr(e) {
|
|
|
3362
3364
|
}
|
|
3363
3365
|
}
|
|
3364
3366
|
function mo(e, t) {
|
|
3365
|
-
if (
|
|
3367
|
+
if (Or(e))
|
|
3366
3368
|
return;
|
|
3367
3369
|
const n = `
|
|
3368
3370
|
:host {
|
|
@@ -5702,18 +5704,18 @@ function mo(e, t) {
|
|
|
5702
5704
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5703
5705
|
}
|
|
5704
5706
|
`;
|
|
5705
|
-
if (
|
|
5707
|
+
if (Ur(e, n))
|
|
5706
5708
|
return;
|
|
5707
5709
|
const o = e.ownerDocument.createElement("style");
|
|
5708
|
-
o.id =
|
|
5710
|
+
o.id = Io, o.textContent = n, e.appendChild(o), jo(e);
|
|
5709
5711
|
}
|
|
5710
|
-
function
|
|
5711
|
-
return e.getElementById(
|
|
5712
|
+
function Or(e) {
|
|
5713
|
+
return e.getElementById(Io) !== null || e.host instanceof HTMLElement && e.host.getAttribute(No) === "true";
|
|
5712
5714
|
}
|
|
5713
5715
|
function jo(e) {
|
|
5714
5716
|
e.host instanceof HTMLElement && e.host.setAttribute(No, "true");
|
|
5715
5717
|
}
|
|
5716
|
-
function
|
|
5718
|
+
function Ur(e, t) {
|
|
5717
5719
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5718
5720
|
return !1;
|
|
5719
5721
|
try {
|
|
@@ -5723,7 +5725,7 @@ function Or(e, t) {
|
|
|
5723
5725
|
return !1;
|
|
5724
5726
|
}
|
|
5725
5727
|
}
|
|
5726
|
-
async function
|
|
5728
|
+
async function Br() {
|
|
5727
5729
|
return document.body ? document.body : await new Promise((e) => {
|
|
5728
5730
|
const t = new MutationObserver(() => {
|
|
5729
5731
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5737,7 +5739,7 @@ function xn(e) {
|
|
|
5737
5739
|
function Vo(e) {
|
|
5738
5740
|
return `${xn(e)}.displayState`;
|
|
5739
5741
|
}
|
|
5740
|
-
function
|
|
5742
|
+
function Fr(e) {
|
|
5741
5743
|
try {
|
|
5742
5744
|
return window.sessionStorage.getItem(
|
|
5743
5745
|
Vo(e)
|
|
@@ -5759,7 +5761,7 @@ function fo(e, t) {
|
|
|
5759
5761
|
return;
|
|
5760
5762
|
}
|
|
5761
5763
|
}
|
|
5762
|
-
function
|
|
5764
|
+
function Wr(e) {
|
|
5763
5765
|
if (e)
|
|
5764
5766
|
return { clientId: e, release: () => {
|
|
5765
5767
|
} };
|
|
@@ -5767,7 +5769,7 @@ function Fr(e) {
|
|
|
5767
5769
|
for (; Vt.has(t); )
|
|
5768
5770
|
t += 1;
|
|
5769
5771
|
Vt.add(t);
|
|
5770
|
-
const n = `${
|
|
5772
|
+
const n = `${ta}${t}`;
|
|
5771
5773
|
let o = crypto.randomUUID();
|
|
5772
5774
|
try {
|
|
5773
5775
|
o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
|
|
@@ -5781,7 +5783,7 @@ function Fr(e) {
|
|
|
5781
5783
|
}
|
|
5782
5784
|
};
|
|
5783
5785
|
}
|
|
5784
|
-
function
|
|
5786
|
+
function Hr(e) {
|
|
5785
5787
|
try {
|
|
5786
5788
|
const t = window.localStorage.getItem(xn(e));
|
|
5787
5789
|
if (!t)
|
|
@@ -5795,8 +5797,8 @@ function Wr(e) {
|
|
|
5795
5797
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
5796
5798
|
(o) => typeof o == "string"
|
|
5797
5799
|
) : [],
|
|
5798
|
-
launcherPosition:
|
|
5799
|
-
panelSize:
|
|
5800
|
+
launcherPosition: jr(n.launcherPosition) ? n.launcherPosition : null,
|
|
5801
|
+
panelSize: Vr(n.panelSize) ? Ct(n.panelSize) : null,
|
|
5800
5802
|
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-So) : [],
|
|
5801
5803
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
5802
5804
|
};
|
|
@@ -5804,7 +5806,7 @@ function Wr(e) {
|
|
|
5804
5806
|
return wo();
|
|
5805
5807
|
}
|
|
5806
5808
|
}
|
|
5807
|
-
async function
|
|
5809
|
+
async function Gr(e) {
|
|
5808
5810
|
if (e.loadSharePromptsDisabled)
|
|
5809
5811
|
return e.loadSharePromptsDisabled();
|
|
5810
5812
|
try {
|
|
@@ -5813,7 +5815,7 @@ async function Hr(e) {
|
|
|
5813
5815
|
return !1;
|
|
5814
5816
|
}
|
|
5815
5817
|
}
|
|
5816
|
-
function
|
|
5818
|
+
function $r(e, t) {
|
|
5817
5819
|
if (e.persistSharePromptsDisabled) {
|
|
5818
5820
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5819
5821
|
() => {
|
|
@@ -5840,7 +5842,7 @@ function wo() {
|
|
|
5840
5842
|
sharePromptsDisabled: !1
|
|
5841
5843
|
};
|
|
5842
5844
|
}
|
|
5843
|
-
function
|
|
5845
|
+
function qr(e, t) {
|
|
5844
5846
|
try {
|
|
5845
5847
|
window.localStorage.setItem(
|
|
5846
5848
|
xn(e),
|
|
@@ -5850,13 +5852,13 @@ function $r(e, t) {
|
|
|
5850
5852
|
return;
|
|
5851
5853
|
}
|
|
5852
5854
|
}
|
|
5853
|
-
function
|
|
5855
|
+
function jr(e) {
|
|
5854
5856
|
if (!e || typeof e != "object")
|
|
5855
5857
|
return !1;
|
|
5856
5858
|
const t = e;
|
|
5857
5859
|
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");
|
|
5858
5860
|
}
|
|
5859
|
-
function
|
|
5861
|
+
function Vr(e) {
|
|
5860
5862
|
if (!e || typeof e != "object")
|
|
5861
5863
|
return !1;
|
|
5862
5864
|
const t = e;
|
|
@@ -5874,7 +5876,7 @@ async function Ko(e, t) {
|
|
|
5874
5876
|
...t ? { signal: t } : {}
|
|
5875
5877
|
});
|
|
5876
5878
|
if (!n.ok) {
|
|
5877
|
-
const i = await n.text(), r =
|
|
5879
|
+
const i = await n.text(), r = wi(i);
|
|
5878
5880
|
throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
|
|
5879
5881
|
}
|
|
5880
5882
|
const o = await n.json();
|
|
@@ -5882,7 +5884,7 @@ async function Ko(e, t) {
|
|
|
5882
5884
|
throw new Error("Pluno token endpoint did not return a token");
|
|
5883
5885
|
return o.token;
|
|
5884
5886
|
}
|
|
5885
|
-
function
|
|
5887
|
+
function Kr(e) {
|
|
5886
5888
|
let t = !1, n = !1;
|
|
5887
5889
|
const o = async () => {
|
|
5888
5890
|
const i = new AbortController();
|
|
@@ -5890,7 +5892,7 @@ function Vr(e) {
|
|
|
5890
5892
|
const l = new Promise((p, s) => {
|
|
5891
5893
|
const g = window.setTimeout(() => {
|
|
5892
5894
|
r = !0, i.abort(), s(new Error($n));
|
|
5893
|
-
},
|
|
5895
|
+
}, Qi);
|
|
5894
5896
|
i.signal.addEventListener(
|
|
5895
5897
|
"abort",
|
|
5896
5898
|
() => window.clearTimeout(g),
|
|
@@ -5904,7 +5906,7 @@ function Vr(e) {
|
|
|
5904
5906
|
]);
|
|
5905
5907
|
return i.abort(), p;
|
|
5906
5908
|
} catch (p) {
|
|
5907
|
-
throw i.abort(), r ? new Error($n) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(
|
|
5909
|
+
throw i.abort(), r ? new Error($n) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(ea);
|
|
5908
5910
|
}
|
|
5909
5911
|
};
|
|
5910
5912
|
return {
|
|
@@ -5928,29 +5930,29 @@ function Vr(e) {
|
|
|
5928
5930
|
};
|
|
5929
5931
|
}
|
|
5930
5932
|
const bo = /* @__PURE__ */ new WeakSet();
|
|
5931
|
-
function
|
|
5933
|
+
function Yr(e) {
|
|
5932
5934
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5933
5935
|
}
|
|
5934
5936
|
function _o(e) {
|
|
5935
5937
|
const t = e.pathname.split("/");
|
|
5936
5938
|
return t[t.length - 1] ?? "";
|
|
5937
5939
|
}
|
|
5938
|
-
function
|
|
5940
|
+
function Xr(e, t) {
|
|
5939
5941
|
const n = new URL(e.src, document.baseURI);
|
|
5940
5942
|
return n.href === t.href || n.pathname === t.pathname ? !0 : _o(n) === _o(t);
|
|
5941
5943
|
}
|
|
5942
5944
|
class fe extends EventTarget {
|
|
5943
5945
|
constructor(t, n) {
|
|
5944
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
5946
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Ki, () => {
|
|
5945
5947
|
this.readyState = fe.OPEN, this.dispatchEvent(new Event("open"));
|
|
5946
|
-
}), this.addPreviewListener(
|
|
5948
|
+
}), this.addPreviewListener(Yi, (o) => {
|
|
5947
5949
|
const i = o;
|
|
5948
5950
|
this.dispatchEvent(
|
|
5949
5951
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5950
5952
|
);
|
|
5951
|
-
}), this.addPreviewListener(
|
|
5953
|
+
}), this.addPreviewListener(Xi, () => {
|
|
5952
5954
|
this.readyState = fe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5953
|
-
}), this.addPreviewListener(
|
|
5955
|
+
}), this.addPreviewListener(Zi, (o) => {
|
|
5954
5956
|
const i = o;
|
|
5955
5957
|
this.readyState = fe.CLOSED, this.dispatchEvent(
|
|
5956
5958
|
new CloseEvent("close", {
|
|
@@ -5962,7 +5964,7 @@ class fe extends EventTarget {
|
|
|
5962
5964
|
}), window.dispatchEvent(
|
|
5963
5965
|
new CustomEvent(
|
|
5964
5966
|
bt(
|
|
5965
|
-
|
|
5967
|
+
qi,
|
|
5966
5968
|
this.channelId
|
|
5967
5969
|
),
|
|
5968
5970
|
{
|
|
@@ -5982,7 +5984,7 @@ class fe extends EventTarget {
|
|
|
5982
5984
|
binaryType = "blob";
|
|
5983
5985
|
bufferedAmount = 0;
|
|
5984
5986
|
readyState = fe.CONNECTING;
|
|
5985
|
-
socketId =
|
|
5987
|
+
socketId = Zr();
|
|
5986
5988
|
listeners = /* @__PURE__ */ new Map();
|
|
5987
5989
|
send(t) {
|
|
5988
5990
|
if (this.readyState !== fe.OPEN)
|
|
@@ -5992,7 +5994,7 @@ class fe extends EventTarget {
|
|
|
5992
5994
|
);
|
|
5993
5995
|
window.dispatchEvent(
|
|
5994
5996
|
new CustomEvent(
|
|
5995
|
-
bt(
|
|
5997
|
+
bt(ji, this.channelId),
|
|
5996
5998
|
{
|
|
5997
5999
|
detail: {
|
|
5998
6000
|
socketId: this.socketId,
|
|
@@ -6005,7 +6007,7 @@ class fe extends EventTarget {
|
|
|
6005
6007
|
close(t, n) {
|
|
6006
6008
|
this.readyState !== fe.CLOSED && (this.readyState = fe.CLOSING, window.dispatchEvent(
|
|
6007
6009
|
new CustomEvent(
|
|
6008
|
-
bt(
|
|
6010
|
+
bt(Vi, this.channelId),
|
|
6009
6011
|
{
|
|
6010
6012
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
6011
6013
|
}
|
|
@@ -6027,7 +6029,7 @@ class fe extends EventTarget {
|
|
|
6027
6029
|
this.listeners.clear();
|
|
6028
6030
|
}
|
|
6029
6031
|
}
|
|
6030
|
-
function
|
|
6032
|
+
function Zr() {
|
|
6031
6033
|
const e = window.sessionStorage.getItem(
|
|
6032
6034
|
Gn
|
|
6033
6035
|
);
|
|
@@ -6039,7 +6041,7 @@ function Xr() {
|
|
|
6039
6041
|
function bt(e, t) {
|
|
6040
6042
|
return `${e}:${t}`;
|
|
6041
6043
|
}
|
|
6042
|
-
function
|
|
6044
|
+
function Jr(e) {
|
|
6043
6045
|
const t = document.currentScript;
|
|
6044
6046
|
if (t instanceof HTMLScriptElement)
|
|
6045
6047
|
return [t];
|
|
@@ -6047,11 +6049,11 @@ function Zr(e) {
|
|
|
6047
6049
|
return Array.from(
|
|
6048
6050
|
document.querySelectorAll("script[type='module'][src]")
|
|
6049
6051
|
).filter(
|
|
6050
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
6052
|
+
(i) => i instanceof HTMLScriptElement && Yr(i) && Xr(i, o)
|
|
6051
6053
|
);
|
|
6052
6054
|
}
|
|
6053
|
-
function
|
|
6054
|
-
for (const t of
|
|
6055
|
+
function Qr(e) {
|
|
6056
|
+
for (const t of Jr(e))
|
|
6055
6057
|
bo.has(t) || t.dataset.plunoAutoMount === "false" || (bo.add(t), Yo(t).catch((n) => {
|
|
6056
6058
|
console.error("Failed to mount Pluno widget", n);
|
|
6057
6059
|
}));
|
|
@@ -6064,18 +6066,18 @@ function Yo(e) {
|
|
|
6064
6066
|
const s = t[me];
|
|
6065
6067
|
return s ? s.mountPromise : Yo(e);
|
|
6066
6068
|
});
|
|
6067
|
-
if (
|
|
6069
|
+
if (el(n.host))
|
|
6068
6070
|
return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
|
|
6069
6071
|
n.destroy?.(), delete t[me];
|
|
6070
6072
|
}
|
|
6071
|
-
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ?
|
|
6073
|
+
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Kr(i) : null;
|
|
6072
6074
|
let l;
|
|
6073
|
-
const p =
|
|
6075
|
+
const p = ya({
|
|
6074
6076
|
token: e.dataset.plunoToken,
|
|
6075
6077
|
tokenProvider: r?.loadToken,
|
|
6076
6078
|
tokenEndpoint: i,
|
|
6077
6079
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
6078
|
-
webSocketFactory: o ?
|
|
6080
|
+
webSocketFactory: o ? xa(o) : void 0,
|
|
6079
6081
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
6080
6082
|
accentColor: e.dataset.plunoAccentColor,
|
|
6081
6083
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -6101,11 +6103,11 @@ function Yo(e) {
|
|
|
6101
6103
|
retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
|
|
6102
6104
|
}, t[me] = l, p;
|
|
6103
6105
|
}
|
|
6104
|
-
function
|
|
6106
|
+
function el(e) {
|
|
6105
6107
|
return e.isConnected && e.getAttribute(Co) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
6106
6108
|
}
|
|
6107
|
-
|
|
6109
|
+
Qr(import.meta.url);
|
|
6108
6110
|
export {
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
+
xa as createProductAgentPreviewBridgeWebSocketFactory,
|
|
6112
|
+
ya as mountPlunoProductAgentWidget
|
|
6111
6113
|
};
|