@pluno/product-agent-web 0.1.47 → 0.1.49
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/index.d.ts +4 -0
- package/dist/product-agent-sdk.js +327 -243
- package/dist/product-agent-widget.js +505 -465
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { PlunoProductAgent as zn } from "./product-agent-sdk.js";
|
|
2
|
-
const
|
|
2
|
+
const Gn = "#7c3aed", Ue = "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", Fe = "#2c2a1e", Lt = [253, 250, 241], At = 3.5;
|
|
3
3
|
function on(e) {
|
|
4
4
|
const t = an(e);
|
|
5
|
-
if (Pt(Le(t),
|
|
5
|
+
if (Pt(Le(t), Lt) >= At)
|
|
6
6
|
return t;
|
|
7
7
|
let o = Le(t);
|
|
8
8
|
const a = Le(Fe);
|
|
9
9
|
for (let i = 0; i < 6; i += 1)
|
|
10
|
-
if (o = $n(o, a, 0.22), Pt(o,
|
|
10
|
+
if (o = $n(o, a, 0.22), Pt(o, Lt) >= At)
|
|
11
11
|
return ot(o);
|
|
12
12
|
return ot(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Hn() {
|
|
15
15
|
let n = "M 280 120", o = !1, a = 0;
|
|
16
16
|
for (let i = 150; i <= 1170; i += 62) {
|
|
17
17
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -58,7 +58,7 @@ function Wn(e) {
|
|
|
58
58
|
}
|
|
59
59
|
function an(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()}` : Gn;
|
|
62
62
|
}
|
|
63
63
|
function Le(e) {
|
|
64
64
|
return [
|
|
@@ -124,10 +124,10 @@ function Vn(e) {
|
|
|
124
124
|
const n = e[t];
|
|
125
125
|
if (n.role !== "tool" || n.toolName !== rn)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = Tt(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const a =
|
|
130
|
+
const a = Tt(e, o.index, "user");
|
|
131
131
|
return a ? {
|
|
132
132
|
id: `share:${n.callId ?? n.id}`,
|
|
133
133
|
userPrompt: a.content,
|
|
@@ -142,7 +142,7 @@ async function Yn(e) {
|
|
|
142
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
143
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Tt(e, t, n) {
|
|
146
146
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
147
147
|
const a = e[o];
|
|
148
148
|
if (a.role === n && a.content.trim())
|
|
@@ -167,13 +167,13 @@ function oo(e, t = {}) {
|
|
|
167
167
|
o = s, e(s);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const b = o,
|
|
170
|
+
const b = o, w = performance.now();
|
|
171
171
|
i = window.setInterval(() => {
|
|
172
172
|
if (n) {
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const P = Math.min(1, (performance.now() -
|
|
176
|
+
const P = Math.min(1, (performance.now() - w) / Jn);
|
|
177
177
|
o = Math.round(b + (s - b) * lo(P)), e(o), P >= 1 && (o = s, e(s), l());
|
|
178
178
|
}, eo);
|
|
179
179
|
}, u = async () => {
|
|
@@ -199,12 +199,12 @@ async function ao(e) {
|
|
|
199
199
|
});
|
|
200
200
|
if (!n.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const o = await n.json(), a =
|
|
202
|
+
const o = await n.json(), a = It(o.count), i = It(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
203
203
|
if (a === null || i === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: a, refreshAfterMs: i };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function It(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
210
|
function io(e) {
|
|
@@ -232,7 +232,7 @@ const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-a
|
|
|
232
232
|
scribbleStyle: !1,
|
|
233
233
|
position: "bottom-right",
|
|
234
234
|
movableLauncher: !1
|
|
235
|
-
}, vo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive',
|
|
235
|
+
}, vo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Dt = "pluno-pa-scribble-font", dn = 190, cn = 41, Co = 48, Eo = 420, So = 520, ko = 0.24, Lo = 680, Ao = 800, Po = 0.76, F = 8, rt = 50, un = "http://www.w3.org/2000/svg", Rt = 26, Mt = 8, To = 36, Bt = [
|
|
236
236
|
{
|
|
237
237
|
ellipseCx: "17.5",
|
|
238
238
|
ellipseCy: "24.5",
|
|
@@ -269,10 +269,10 @@ const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-a
|
|
|
269
269
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
270
270
|
pathStrokeWidth: "2.45"
|
|
271
271
|
}
|
|
272
|
-
],
|
|
273
|
-
let
|
|
272
|
+
], Io = 11, No = 13, Ot = 4, Do = 10, Ro = 40, Mo = "movable-launcher-position-v2", gn = "pluno-pa-widget-styles", hn = "data-pluno-pa-widget-styles";
|
|
273
|
+
let Ut = 0;
|
|
274
274
|
function Bo(e) {
|
|
275
|
-
return (t) => new
|
|
275
|
+
return (t) => new ee(t, e);
|
|
276
276
|
}
|
|
277
277
|
async function Oo(e = {}) {
|
|
278
278
|
const t = {
|
|
@@ -332,7 +332,7 @@ async function Oo(e = {}) {
|
|
|
332
332
|
);
|
|
333
333
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
334
334
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
335
|
-
let i =
|
|
335
|
+
let i = Ft(
|
|
336
336
|
t.accentColor,
|
|
337
337
|
t.scribbleStyle
|
|
338
338
|
);
|
|
@@ -342,8 +342,8 @@ async function Oo(e = {}) {
|
|
|
342
342
|
i,
|
|
343
343
|
t.movableLauncher
|
|
344
344
|
), o.appendChild(a);
|
|
345
|
-
const l = await
|
|
346
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Qt(o, t.accentColor),
|
|
345
|
+
const l = await ti(), p = l.ownerDocument;
|
|
346
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Qt(o, t.accentColor), zt(a, i, {
|
|
347
347
|
accentColor: t.accentColor,
|
|
348
348
|
colorScheme: t.colorScheme,
|
|
349
349
|
fontFamily: t.fontFamily,
|
|
@@ -364,13 +364,13 @@ async function Oo(e = {}) {
|
|
|
364
364
|
".pluno-pa-widget__launcher-drag-handle"
|
|
365
365
|
), s = a.querySelector(
|
|
366
366
|
".pluno-pa-widget__launcher-input"
|
|
367
|
-
), b = a.querySelector(".pluno-pa-widget__panel"),
|
|
367
|
+
), b = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(
|
|
368
368
|
".pluno-pa-widget__close"
|
|
369
369
|
), P = a.querySelector(
|
|
370
370
|
".pluno-pa-widget__composer"
|
|
371
|
-
),
|
|
371
|
+
), L = a.querySelector(
|
|
372
372
|
".pluno-pa-widget__attachment-error"
|
|
373
|
-
),
|
|
373
|
+
), R = a.querySelector(
|
|
374
374
|
".pluno-pa-widget__billing-status"
|
|
375
375
|
), y = a.querySelector(
|
|
376
376
|
".pluno-pa-widget__attachments"
|
|
@@ -382,44 +382,44 @@ async function Oo(e = {}) {
|
|
|
382
382
|
".pluno-pa-widget__input"
|
|
383
383
|
), E = a.querySelector(
|
|
384
384
|
".pluno-pa-widget__send"
|
|
385
|
-
),
|
|
385
|
+
), O = a.querySelector(
|
|
386
386
|
".pluno-pa-widget__top-actions"
|
|
387
387
|
), le = a.querySelector(
|
|
388
388
|
".pluno-pa-widget__history"
|
|
389
|
-
),
|
|
389
|
+
), me = a.querySelector(
|
|
390
390
|
".pluno-pa-widget__history-panel"
|
|
391
|
-
),
|
|
391
|
+
), z = a.querySelector(
|
|
392
392
|
".pluno-pa-widget__history-list"
|
|
393
|
-
),
|
|
393
|
+
), ne = a.querySelector(
|
|
394
394
|
".pluno-pa-widget__history-close"
|
|
395
|
-
),
|
|
395
|
+
), _ = a.querySelector(
|
|
396
396
|
".pluno-pa-widget__history-status"
|
|
397
|
-
),
|
|
397
|
+
), T = a.querySelector(
|
|
398
398
|
".pluno-pa-widget__timeline-jump"
|
|
399
|
-
),
|
|
399
|
+
), be = a.querySelector(
|
|
400
400
|
".pluno-pa-widget__active-users-counter"
|
|
401
|
-
),
|
|
401
|
+
), k = a.querySelector(
|
|
402
402
|
".pluno-pa-widget__timeline"
|
|
403
403
|
), A = a.querySelector(
|
|
404
404
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
405
405
|
);
|
|
406
|
-
if (!c || !s || !b || !
|
|
406
|
+
if (!c || !s || !b || !w || !P || !L || !R || !y || !C || !h || !g || !E || !O || !le || !me || !z || !ne || !_ || !T || !be || !k || !A)
|
|
407
407
|
throw new Error("Failed to mount Pluno widget");
|
|
408
408
|
if (t.movableLauncher && !u)
|
|
409
409
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
410
|
-
|
|
411
|
-
let
|
|
412
|
-
const
|
|
410
|
+
qt(s), qt(g);
|
|
411
|
+
let x = [], U = null;
|
|
412
|
+
const G = () => {
|
|
413
413
|
va(
|
|
414
414
|
y,
|
|
415
|
-
|
|
415
|
+
x,
|
|
416
416
|
(r) => {
|
|
417
|
-
|
|
417
|
+
x = x.filter(
|
|
418
418
|
(d, S) => S !== r
|
|
419
|
-
),
|
|
419
|
+
), G(), M(f.getState()), W();
|
|
420
420
|
}
|
|
421
421
|
);
|
|
422
|
-
},
|
|
422
|
+
}, An = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
423
423
|
if (!t.tokenEndpoint)
|
|
424
424
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
425
425
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -437,15 +437,15 @@ async function Oo(e = {}) {
|
|
|
437
437
|
if (!d.token)
|
|
438
438
|
throw new Error("Pluno token endpoint did not return a token");
|
|
439
439
|
return d.token;
|
|
440
|
-
}),
|
|
441
|
-
let
|
|
442
|
-
|
|
440
|
+
}), Pn = window.fetch.bind(window);
|
|
441
|
+
let f;
|
|
442
|
+
f = await zn.init({
|
|
443
443
|
token: t.token,
|
|
444
|
-
tokenProvider:
|
|
444
|
+
tokenProvider: An,
|
|
445
445
|
backendUrl: t.backendUrl,
|
|
446
446
|
metadata: () => ({
|
|
447
447
|
...t.metadata ?? {},
|
|
448
|
-
...!
|
|
448
|
+
...!f.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
449
449
|
}),
|
|
450
450
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
451
451
|
clientId: t.clientId,
|
|
@@ -454,53 +454,53 @@ async function Oo(e = {}) {
|
|
|
454
454
|
webSocketFactory: t.webSocketFactory,
|
|
455
455
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
456
456
|
});
|
|
457
|
-
const pe =
|
|
457
|
+
const pe = ni(t), He = new Set(pe.openToolGroupKeys), fe = new Set(
|
|
458
458
|
pe.seenShareCandidateIds
|
|
459
|
-
),
|
|
460
|
-
let We = pe.sharePromptsDisabled || await
|
|
459
|
+
), Ae = new Set(fe);
|
|
460
|
+
let We = pe.sharePromptsDisabled || await oi(t), J = t.movableLauncher ? pe.launcherPosition : null, gt = J !== null, oe = null, Pe = !1, se = !1, de = {
|
|
461
461
|
enabled: !0
|
|
462
|
-
}, ce = 0,
|
|
462
|
+
}, ce = 0, ht = "", ae = !1, Q = !1, ie = [], $e = null, ve = null;
|
|
463
463
|
const q = (r, d) => {
|
|
464
464
|
de = { enabled: r, reason: d };
|
|
465
465
|
}, j = () => {
|
|
466
|
-
|
|
466
|
+
T.hidden = !0;
|
|
467
467
|
}, Tn = () => {
|
|
468
|
-
|
|
469
|
-
},
|
|
470
|
-
q(!0, r), j(), ke(
|
|
468
|
+
T.hidden = !1;
|
|
469
|
+
}, In = (r = "jump") => {
|
|
470
|
+
q(!0, r), j(), ke(k, () => de.enabled), ce = k.scrollTop;
|
|
471
471
|
}, ue = () => {
|
|
472
|
-
if (le.hidden = t.loginRequired,
|
|
472
|
+
if (le.hidden = t.loginRequired, me.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), z.classList.toggle(
|
|
473
473
|
"pluno-pa-widget__history-list--center",
|
|
474
|
-
|
|
475
|
-
),
|
|
474
|
+
Q && ie.length === 0
|
|
475
|
+
), z.replaceChildren(), Q && ie.length === 0) {
|
|
476
476
|
const r = document.createElement("p");
|
|
477
|
-
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...",
|
|
477
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", z.appendChild(r);
|
|
478
478
|
}
|
|
479
479
|
for (const r of ie) {
|
|
480
480
|
const d = document.createElement("button");
|
|
481
|
-
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled =
|
|
481
|
+
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = Q;
|
|
482
482
|
const S = document.createElement("span");
|
|
483
483
|
S.className = "pluno-pa-widget__history-item-title", S.textContent = ea(r);
|
|
484
|
-
const
|
|
485
|
-
|
|
484
|
+
const D = document.createElement("time");
|
|
485
|
+
D.className = "pluno-pa-widget__history-time", D.dateTime = r.lastActiveAt, D.textContent = na(
|
|
486
486
|
r.lastActiveAt,
|
|
487
487
|
Date.now()
|
|
488
488
|
);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
ae = !1, ve = null, ue(), q(!0, "newSession"), j(),
|
|
492
|
-
}),
|
|
489
|
+
const I = document.createElement("small");
|
|
490
|
+
I.className = "pluno-pa-widget__history-path", I.textContent = ta(r), d.append(S, D, I), d.addEventListener("click", () => {
|
|
491
|
+
ae = !1, ve = null, ue(), q(!0, "newSession"), j(), f.loadSession(r.id), M(f.getState());
|
|
492
|
+
}), z.appendChild(d);
|
|
493
493
|
}
|
|
494
|
-
if (
|
|
494
|
+
if (Q && ie.length > 0) {
|
|
495
495
|
const r = document.createElement("p");
|
|
496
|
-
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...",
|
|
496
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", z.appendChild(r);
|
|
497
497
|
}
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
if (!
|
|
501
|
-
|
|
498
|
+
_.textContent = ve ?? (!Q && ie.length === 0 ? "No recent chats for this page yet." : ""), _.hidden = _.textContent.length === 0;
|
|
499
|
+
}, mt = async (r) => {
|
|
500
|
+
if (!Q) {
|
|
501
|
+
Q = !0, ve = null, ue();
|
|
502
502
|
try {
|
|
503
|
-
const d = await
|
|
503
|
+
const d = await f.listSessions({ cursor: r, limit: 20 });
|
|
504
504
|
ie = r ? [...ie, ...d.sessions] : d.sessions, $e = d.nextCursor;
|
|
505
505
|
} catch (d) {
|
|
506
506
|
Y(
|
|
@@ -511,36 +511,36 @@ async function Oo(e = {}) {
|
|
|
511
511
|
}
|
|
512
512
|
), ve = yo;
|
|
513
513
|
} finally {
|
|
514
|
-
|
|
514
|
+
Q = !1, ue();
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
},
|
|
518
|
-
!$e ||
|
|
517
|
+
}, Nn = () => {
|
|
518
|
+
!$e || Q || z.scrollHeight - z.scrollTop - z.clientHeight <= 24 && mt($e);
|
|
519
519
|
}, Dn = () => {
|
|
520
|
-
|
|
521
|
-
},
|
|
522
|
-
|
|
520
|
+
Pe || typeof document > "u" || (Qt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
521
|
+
}, bt = new MutationObserver(Dn);
|
|
522
|
+
bt.observe(p.documentElement, {
|
|
523
523
|
childList: !0,
|
|
524
524
|
subtree: !0
|
|
525
525
|
});
|
|
526
526
|
const qe = (r = !0) => {
|
|
527
527
|
const d = lt(a, r);
|
|
528
|
-
return
|
|
528
|
+
return Gt(
|
|
529
529
|
a,
|
|
530
|
-
|
|
530
|
+
J ? $o(J, d) : Wo(
|
|
531
531
|
a,
|
|
532
532
|
t.position,
|
|
533
533
|
d
|
|
534
534
|
),
|
|
535
535
|
d
|
|
536
536
|
);
|
|
537
|
-
},
|
|
538
|
-
|
|
537
|
+
}, H = () => {
|
|
538
|
+
ii(t, {
|
|
539
539
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
540
540
|
composerValue: g.value,
|
|
541
|
-
openToolGroupKeys: [...
|
|
542
|
-
launcherPosition:
|
|
543
|
-
seenShareCandidateIds: [...
|
|
541
|
+
openToolGroupKeys: [...He],
|
|
542
|
+
launcherPosition: gt ? J : null,
|
|
543
|
+
seenShareCandidateIds: [...fe].slice(
|
|
544
544
|
-ln
|
|
545
545
|
),
|
|
546
546
|
sharePromptsDisabled: We
|
|
@@ -548,7 +548,7 @@ async function Oo(e = {}) {
|
|
|
548
548
|
}, ge = (r, d = {}) => {
|
|
549
549
|
Zo(r, {
|
|
550
550
|
debugVersion: Mo,
|
|
551
|
-
launcherPosition:
|
|
551
|
+
launcherPosition: J,
|
|
552
552
|
rootClasses: a.className,
|
|
553
553
|
rootStyle: {
|
|
554
554
|
left: a.style.left,
|
|
@@ -559,19 +559,19 @@ async function Oo(e = {}) {
|
|
|
559
559
|
rootRect: Qe(a),
|
|
560
560
|
launcherRect: Qe(c),
|
|
561
561
|
panelRect: Qe(b),
|
|
562
|
-
viewport:
|
|
562
|
+
viewport: te(),
|
|
563
563
|
panelHidden: b.hidden,
|
|
564
|
-
closeHidden:
|
|
564
|
+
closeHidden: w.hidden,
|
|
565
565
|
...d
|
|
566
566
|
});
|
|
567
567
|
}, Te = (r = !0) => {
|
|
568
|
-
if (!
|
|
568
|
+
if (!J)
|
|
569
569
|
return Re(a, null), qe(r);
|
|
570
570
|
const d = qe(r);
|
|
571
571
|
return Re(a, d), ge("Applied stored closed launcher position", {
|
|
572
572
|
visibleLauncherPosition: d
|
|
573
573
|
}), d;
|
|
574
|
-
},
|
|
574
|
+
}, ft = (r, d) => {
|
|
575
575
|
if (!r || !d) {
|
|
576
576
|
Xo(a);
|
|
577
577
|
return;
|
|
@@ -580,7 +580,7 @@ async function Oo(e = {}) {
|
|
|
580
580
|
x: r.x - d.x,
|
|
581
581
|
y: r.y - d.y
|
|
582
582
|
});
|
|
583
|
-
},
|
|
583
|
+
}, wt = () => {
|
|
584
584
|
const r = Te();
|
|
585
585
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
586
586
|
const d = Ht(
|
|
@@ -588,80 +588,80 @@ async function Oo(e = {}) {
|
|
|
588
588
|
r,
|
|
589
589
|
t.position
|
|
590
590
|
);
|
|
591
|
-
|
|
591
|
+
ft(d, r), ge(
|
|
592
592
|
"Applied open panel position after viewport resize",
|
|
593
593
|
{ openPanelPosition: d }
|
|
594
594
|
);
|
|
595
|
-
} else
|
|
595
|
+
} else J && ge(
|
|
596
596
|
"Applied visible launcher position after viewport resize",
|
|
597
597
|
{ visibleLauncherPosition: r }
|
|
598
598
|
);
|
|
599
599
|
};
|
|
600
|
-
let
|
|
600
|
+
let _t = () => {
|
|
601
601
|
};
|
|
602
|
-
window.addEventListener("resize",
|
|
602
|
+
window.addEventListener("resize", wt), t.movableLauncher && u ? (Te(), _t = Ho({
|
|
603
603
|
root: a,
|
|
604
604
|
launcher: c,
|
|
605
605
|
launcherDragHandle: u,
|
|
606
606
|
getPosition: () => qe(),
|
|
607
607
|
setPosition: (r) => {
|
|
608
|
-
const d = r, S = lt(a),
|
|
608
|
+
const d = r, S = lt(a), D = Gt(
|
|
609
609
|
a,
|
|
610
610
|
r,
|
|
611
611
|
S
|
|
612
612
|
);
|
|
613
|
-
|
|
614
|
-
|
|
613
|
+
J = qo(
|
|
614
|
+
D,
|
|
615
615
|
S
|
|
616
|
-
), Re(a,
|
|
616
|
+
), Re(a, D), ge("Dragging closed launcher", {
|
|
617
617
|
requestedPosition: d
|
|
618
618
|
});
|
|
619
619
|
},
|
|
620
620
|
persist: () => {
|
|
621
|
-
|
|
621
|
+
gt = !0, H(), ge("Persisted closed launcher drag position");
|
|
622
622
|
}
|
|
623
623
|
})) : Re(a, null);
|
|
624
624
|
let je = !1;
|
|
625
|
-
const
|
|
625
|
+
const xt = async () => {
|
|
626
626
|
if (!(!t.billingStatusLoader || je)) {
|
|
627
627
|
je = !0;
|
|
628
628
|
try {
|
|
629
629
|
const r = await t.billingStatusLoader();
|
|
630
|
-
|
|
630
|
+
Vt(
|
|
631
631
|
t.billingStatus,
|
|
632
632
|
r,
|
|
633
|
-
|
|
633
|
+
f.getState().lastErrorCode
|
|
634
634
|
) && (t.billingStatus = r, nt(
|
|
635
|
-
|
|
635
|
+
R,
|
|
636
636
|
t.billingStatus,
|
|
637
|
-
|
|
637
|
+
f.getState().lastErrorCode
|
|
638
638
|
), W());
|
|
639
639
|
} finally {
|
|
640
640
|
je = !1;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
}, he = (r = "", d = !0) => {
|
|
644
|
-
|
|
645
|
-
const S = Te(),
|
|
644
|
+
xt(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
645
|
+
const S = Te(), D = Ht(
|
|
646
646
|
a,
|
|
647
647
|
S,
|
|
648
648
|
t.position
|
|
649
649
|
);
|
|
650
|
-
if (
|
|
651
|
-
openPanelPosition:
|
|
650
|
+
if (ft(D, S), ge("Opening launcher at clamped open panel position", {
|
|
651
|
+
openPanelPosition: D,
|
|
652
652
|
visibleLauncherPosition: S
|
|
653
653
|
}), q(!0, "open"), j(), !d) {
|
|
654
|
-
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Se(g)), ke(
|
|
654
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Se(g)), ke(k, () => de.enabled), ce = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
|
|
655
655
|
return;
|
|
656
656
|
}
|
|
657
657
|
window.requestAnimationFrame(() => {
|
|
658
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Se(g)), ke(
|
|
659
|
-
c.hidden = !0, ke(
|
|
658
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Se(g)), ke(k, () => de.enabled), ce = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
|
|
659
|
+
c.hidden = !0, ke(k, () => de.enabled), ce = k.scrollTop;
|
|
660
660
|
}, 220);
|
|
661
661
|
});
|
|
662
662
|
}, Rn = () => {
|
|
663
|
-
oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1,
|
|
664
|
-
b.hidden = !0,
|
|
663
|
+
oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, J && (Te(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
|
|
664
|
+
b.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
665
665
|
}, 220);
|
|
666
666
|
};
|
|
667
667
|
c.addEventListener("submit", (r) => {
|
|
@@ -677,25 +677,25 @@ async function Oo(e = {}) {
|
|
|
677
677
|
return;
|
|
678
678
|
const r = s.value;
|
|
679
679
|
he(r), s.value = "";
|
|
680
|
-
}),
|
|
681
|
-
|
|
682
|
-
}),
|
|
683
|
-
|
|
680
|
+
}), w.addEventListener("click", Rn), k.addEventListener("scroll", () => {
|
|
681
|
+
k.scrollTop < ce - 1 && q(!1, "userScroll"), ce = k.scrollTop;
|
|
682
|
+
}), T.addEventListener("click", () => {
|
|
683
|
+
In();
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
686
686
|
([r]) => {
|
|
687
687
|
r?.isIntersecting && (q(!0, "bottom"), j());
|
|
688
688
|
},
|
|
689
|
-
{ root:
|
|
689
|
+
{ root: k, threshold: 0 }
|
|
690
690
|
);
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
const r =
|
|
691
|
+
yt?.observe(A);
|
|
692
|
+
const Ie = () => t.loginRequired || t.signupRequired, vt = () => {
|
|
693
|
+
const r = Ie();
|
|
694
694
|
s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
|
|
695
695
|
}, W = () => {
|
|
696
|
-
E.disabled = X(t.billingStatus) || !
|
|
696
|
+
E.disabled = X(t.billingStatus) || !f.getState().isThinking && g.value.trim().length === 0 && x.length === 0, h.disabled = Ie() || X(t.billingStatus);
|
|
697
697
|
};
|
|
698
|
-
|
|
698
|
+
vt(), P.addEventListener("submit", (r) => {
|
|
699
699
|
if (r.preventDefault(), t.loginRequired) {
|
|
700
700
|
t.onLoginClick?.();
|
|
701
701
|
return;
|
|
@@ -704,37 +704,37 @@ async function Oo(e = {}) {
|
|
|
704
704
|
t.onSignupClick?.();
|
|
705
705
|
return;
|
|
706
706
|
}
|
|
707
|
-
X(t.billingStatus) || (se = !0, q(!0, "send"), j(),
|
|
708
|
-
|
|
707
|
+
X(t.billingStatus) || (se = !0, q(!0, "send"), j(), x = et(
|
|
708
|
+
f,
|
|
709
709
|
g,
|
|
710
|
-
|
|
711
|
-
),
|
|
710
|
+
x
|
|
711
|
+
), G(), W());
|
|
712
712
|
});
|
|
713
713
|
let Ce = 0;
|
|
714
714
|
const Mn = () => {
|
|
715
715
|
Ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
|
|
716
|
+
}, Ct = (r) => {
|
|
717
|
+
U !== null && window.clearTimeout(U), L.textContent = r, L.hidden = !1, U = window.setTimeout(() => {
|
|
718
|
+
L.textContent = "", L.hidden = !0, U = null;
|
|
719
719
|
}, 3e3);
|
|
720
720
|
}, Bn = () => {
|
|
721
|
-
|
|
722
|
-
},
|
|
721
|
+
U !== null && (window.clearTimeout(U), U = null), L.textContent = "", L.hidden = !0;
|
|
722
|
+
}, Et = async (r) => {
|
|
723
723
|
if (r.length === 0)
|
|
724
724
|
return;
|
|
725
725
|
const d = await ka(r);
|
|
726
|
-
if (
|
|
726
|
+
if (x.length + d.length > ze)
|
|
727
727
|
throw new Error(
|
|
728
728
|
`Attach up to ${ze} files per message.`
|
|
729
729
|
);
|
|
730
|
-
|
|
730
|
+
x = [...x, ...d], G(), Bn(), W(), M(f.getState()), a.classList.contains("pluno-pa-widget--open") || he();
|
|
731
731
|
};
|
|
732
732
|
h.addEventListener("click", () => {
|
|
733
733
|
t.loginRequired || X(t.billingStatus) || C.click();
|
|
734
734
|
}), C.addEventListener("change", () => {
|
|
735
735
|
const r = Array.from(C.files ?? []);
|
|
736
|
-
C.value = "",
|
|
737
|
-
|
|
736
|
+
C.value = "", Et(r).catch((d) => {
|
|
737
|
+
Ct(
|
|
738
738
|
d instanceof Error ? d.message : "Failed to attach file"
|
|
739
739
|
), Y("web-sdk.widget", "Attachment failed", {
|
|
740
740
|
message: d instanceof Error ? d.message : String(d)
|
|
@@ -749,8 +749,8 @@ async function Oo(e = {}) {
|
|
|
749
749
|
Me(r.dataTransfer) && (r.stopPropagation(), Ce = Math.max(0, Ce - 1), Ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
750
750
|
}), a.addEventListener("drop", (r) => {
|
|
751
751
|
const d = r.dataTransfer;
|
|
752
|
-
!Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Mn(),
|
|
753
|
-
|
|
752
|
+
!Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Mn(), Et(d.files).catch((S) => {
|
|
753
|
+
Ct(
|
|
754
754
|
S instanceof Error ? S.message : "Failed to attach file"
|
|
755
755
|
), Y("web-sdk.widget", "Attachment failed", {
|
|
756
756
|
message: S instanceof Error ? S.message : String(S)
|
|
@@ -761,65 +761,65 @@ async function Oo(e = {}) {
|
|
|
761
761
|
t.onLoginClick?.();
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
764
|
-
if (
|
|
765
|
-
|
|
764
|
+
if (f.getState().isThinking) {
|
|
765
|
+
f.stop();
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
|
-
se = !0, q(!0, "send"), j(),
|
|
769
|
-
|
|
768
|
+
se = !0, q(!0, "send"), j(), x = et(
|
|
769
|
+
f,
|
|
770
770
|
g,
|
|
771
|
-
|
|
772
|
-
),
|
|
771
|
+
x
|
|
772
|
+
), G(), W(), M(f.getState());
|
|
773
773
|
}), le.addEventListener("click", () => {
|
|
774
|
-
ae = !ae, ve = null, ue(), ae && ie.length === 0 &&
|
|
775
|
-
}),
|
|
774
|
+
ae = !ae, ve = null, ue(), ae && ie.length === 0 && mt(null);
|
|
775
|
+
}), ne.addEventListener("click", () => {
|
|
776
776
|
ae = !1, ue();
|
|
777
|
-
}),
|
|
778
|
-
Se(g),
|
|
777
|
+
}), z.addEventListener("scroll", Nn), g.addEventListener("input", () => {
|
|
778
|
+
Se(g), H(), W(), M(f.getState());
|
|
779
779
|
}), g.addEventListener("keydown", (r) => {
|
|
780
780
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
781
781
|
if (r.preventDefault(), t.loginRequired) {
|
|
782
782
|
t.onLoginClick?.();
|
|
783
783
|
return;
|
|
784
784
|
}
|
|
785
|
-
se = !0, q(!0, "send"), j(),
|
|
786
|
-
|
|
785
|
+
se = !0, q(!0, "send"), j(), x = et(
|
|
786
|
+
f,
|
|
787
787
|
g,
|
|
788
|
-
|
|
789
|
-
),
|
|
788
|
+
x
|
|
789
|
+
), G(), W(), M(f.getState());
|
|
790
790
|
}
|
|
791
791
|
}), a.addEventListener("click", (r) => {
|
|
792
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
792
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
|
|
793
793
|
}), pe.composerValue && (g.value = pe.composerValue, Se(g)), pe.isOpen && he(g.value, !1);
|
|
794
|
-
const
|
|
795
|
-
let Ve =
|
|
794
|
+
const Ne = () => i;
|
|
795
|
+
let Ve = f.getState().appearance !== null, De = null, Ee = null, we = null, St = f.getState().isThinking, _e = null, Ye = null, kt = () => {
|
|
796
796
|
};
|
|
797
797
|
const On = !!t.socialPostDraftHandler;
|
|
798
|
-
let
|
|
798
|
+
let xe = null;
|
|
799
799
|
const Un = () => {
|
|
800
|
-
se = !0, q(!0, "newSession"), j(), ae = !1, ue(),
|
|
800
|
+
se = !0, q(!0, "newSession"), j(), ae = !1, ue(), f.startNewSession(), He.clear(), g.value = "", x = [], G(), Se(g), H(), W(), g.focus(), M(f.getState());
|
|
801
801
|
}, Ke = (r) => {
|
|
802
802
|
if (!r) {
|
|
803
|
-
|
|
803
|
+
xe?.remove(), xe = null;
|
|
804
804
|
return;
|
|
805
805
|
}
|
|
806
|
-
|
|
806
|
+
xe || (xe = Ge(
|
|
807
807
|
"pluno-pa-widget__new-chat",
|
|
808
808
|
"New chat",
|
|
809
809
|
ha(),
|
|
810
810
|
!1
|
|
811
|
-
),
|
|
812
|
-
},
|
|
813
|
-
if (ue(),
|
|
814
|
-
|
|
811
|
+
), xe.addEventListener("click", Un), O.insertBefore(xe, le));
|
|
812
|
+
}, M = (r) => {
|
|
813
|
+
if (ue(), ut(r.lastErrorCode) ? _e = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (_e = null), nt(
|
|
814
|
+
R,
|
|
815
815
|
t.billingStatus,
|
|
816
|
-
|
|
816
|
+
_e
|
|
817
817
|
), t.loginRequired) {
|
|
818
|
-
|
|
819
|
-
|
|
818
|
+
Zt(
|
|
819
|
+
k,
|
|
820
820
|
E,
|
|
821
821
|
Ke,
|
|
822
|
-
|
|
822
|
+
Ne,
|
|
823
823
|
"Log in to use Pluno on this page.",
|
|
824
824
|
t.loginButtonLabel,
|
|
825
825
|
t.loginUrl,
|
|
@@ -828,11 +828,11 @@ async function Oo(e = {}) {
|
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
830
|
if (t.signupRequired) {
|
|
831
|
-
|
|
832
|
-
|
|
831
|
+
Zt(
|
|
832
|
+
k,
|
|
833
833
|
E,
|
|
834
834
|
Ke,
|
|
835
|
-
|
|
835
|
+
Ne,
|
|
836
836
|
"Complete signup to unlock your free trial credits.",
|
|
837
837
|
t.signupButtonLabel,
|
|
838
838
|
t.signupUrl,
|
|
@@ -840,64 +840,64 @@ async function Oo(e = {}) {
|
|
|
840
840
|
);
|
|
841
841
|
return;
|
|
842
842
|
}
|
|
843
|
-
const d = Jo(r), S = d !==
|
|
844
|
-
|
|
845
|
-
const
|
|
843
|
+
const d = Jo(r), S = d !== ht;
|
|
844
|
+
ht = d;
|
|
845
|
+
const D = se || de.enabled;
|
|
846
846
|
se = !1, Ua(
|
|
847
|
-
|
|
847
|
+
k,
|
|
848
848
|
A,
|
|
849
849
|
E,
|
|
850
850
|
Ke,
|
|
851
|
-
|
|
851
|
+
be,
|
|
852
852
|
r,
|
|
853
853
|
Ye,
|
|
854
|
-
Ye !== null &&
|
|
854
|
+
Ye !== null && Kt(
|
|
855
855
|
r,
|
|
856
|
-
g.value.trim().length > 0 ||
|
|
856
|
+
g.value.trim().length > 0 || x.length > 0
|
|
857
857
|
),
|
|
858
|
-
|
|
858
|
+
D,
|
|
859
859
|
() => de.enabled,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
(
|
|
864
|
-
se = !0, q(!0, "send"), j(),
|
|
860
|
+
He,
|
|
861
|
+
H,
|
|
862
|
+
Ne,
|
|
863
|
+
(I) => {
|
|
864
|
+
se = !0, q(!0, "send"), j(), f.sendMessage(I);
|
|
865
865
|
},
|
|
866
866
|
On && !We ? {
|
|
867
|
-
dismissedCandidateIds:
|
|
867
|
+
dismissedCandidateIds: Ae,
|
|
868
868
|
draftingCandidateId: De,
|
|
869
869
|
error: Ee,
|
|
870
|
-
characterIconOptions:
|
|
871
|
-
onSeen: (
|
|
872
|
-
|
|
870
|
+
characterIconOptions: Ne(),
|
|
871
|
+
onSeen: (I) => {
|
|
872
|
+
fe.add(I.id), H();
|
|
873
873
|
},
|
|
874
|
-
onDraft: (
|
|
875
|
-
Fn(
|
|
874
|
+
onDraft: (I) => {
|
|
875
|
+
Fn(I);
|
|
876
876
|
},
|
|
877
|
-
onDismiss: (
|
|
878
|
-
|
|
877
|
+
onDismiss: (I) => {
|
|
878
|
+
fe.add(I.id), Ae.add(I.id), H(), Ee = null, M(f.getState());
|
|
879
879
|
},
|
|
880
|
-
onDisable: (
|
|
881
|
-
We = !0,
|
|
880
|
+
onDisable: (I) => {
|
|
881
|
+
We = !0, fe.add(I.id), Ae.add(I.id), H(), ai(t, !0), Ee = null, M(f.getState());
|
|
882
882
|
}
|
|
883
883
|
} : void 0
|
|
884
|
-
),
|
|
884
|
+
), D ? (ce = k.scrollTop, j()) : S && Qo(r) && Tn();
|
|
885
885
|
};
|
|
886
|
-
return
|
|
886
|
+
return kt = oo(
|
|
887
887
|
(r) => {
|
|
888
|
-
Ye = r, !
|
|
889
|
-
|
|
890
|
-
g.value.trim().length > 0 ||
|
|
891
|
-
) &&
|
|
888
|
+
Ye = r, !Pe && Kt(
|
|
889
|
+
f.getState(),
|
|
890
|
+
g.value.trim().length > 0 || x.length > 0
|
|
891
|
+
) && M(f.getState());
|
|
892
892
|
},
|
|
893
893
|
{
|
|
894
894
|
backendUrl: t.backendUrl,
|
|
895
|
-
fetcher:
|
|
895
|
+
fetcher: Pn,
|
|
896
896
|
loader: t.activeUsersLoader
|
|
897
897
|
}
|
|
898
|
-
),
|
|
899
|
-
const d =
|
|
900
|
-
|
|
898
|
+
), f.on("state", (r) => {
|
|
899
|
+
const d = St && !r.isThinking;
|
|
900
|
+
St = r.isThinking, r.appearance ? (Ve = !0, Y(
|
|
901
901
|
"web-sdk.widget",
|
|
902
902
|
"Agent state supplied appearance",
|
|
903
903
|
{
|
|
@@ -911,27 +911,27 @@ async function Oo(e = {}) {
|
|
|
911
911
|
fallbackColorScheme: t.colorScheme,
|
|
912
912
|
fallbackFontFamily: t.fontFamily
|
|
913
913
|
}
|
|
914
|
-
), Xe({}, "agent.state.appearance-cleared")),
|
|
915
|
-
}),
|
|
916
|
-
agent:
|
|
914
|
+
), Xe({}, "agent.state.appearance-cleared")), M(r), W(), d && xt();
|
|
915
|
+
}), M(f.getState()), W(), {
|
|
916
|
+
agent: f,
|
|
917
917
|
updateAppearance: (r) => {
|
|
918
918
|
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Xe(r, "widgetHandle.updateAppearance");
|
|
919
919
|
},
|
|
920
920
|
updateBillingStatus: (r) => {
|
|
921
921
|
const d = r ?? null;
|
|
922
|
-
|
|
922
|
+
Vt(
|
|
923
923
|
t.billingStatus,
|
|
924
924
|
d,
|
|
925
|
-
|
|
926
|
-
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (
|
|
925
|
+
_e
|
|
926
|
+
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (_e = null), nt(
|
|
927
927
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
928
928
|
t.billingStatus,
|
|
929
|
-
|
|
929
|
+
_e
|
|
930
930
|
), W());
|
|
931
931
|
},
|
|
932
932
|
updateAuthGate: (r) => {
|
|
933
|
-
const d =
|
|
934
|
-
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl),
|
|
933
|
+
const d = Ie();
|
|
934
|
+
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), vt(), M(f.getState()), W(), d && !Ie() && f.connect().catch((S) => {
|
|
935
935
|
Y(
|
|
936
936
|
"web-sdk.widget",
|
|
937
937
|
"Failed to connect after auth gate cleared",
|
|
@@ -945,53 +945,53 @@ async function Oo(e = {}) {
|
|
|
945
945
|
he(g.value, !1);
|
|
946
946
|
},
|
|
947
947
|
destroy: () => {
|
|
948
|
-
|
|
948
|
+
Pe || (Pe = !0, bt.disconnect(), yt?.disconnect(), window.removeEventListener("resize", wt), _t(), U !== null && window.clearTimeout(U), kt(), we?.remove(), f.destroy(), n.remove());
|
|
949
949
|
}
|
|
950
950
|
};
|
|
951
951
|
async function Fn(r) {
|
|
952
952
|
if (!De) {
|
|
953
|
-
De = r.id, Ee = null,
|
|
953
|
+
De = r.id, Ee = null, M(f.getState());
|
|
954
954
|
try {
|
|
955
955
|
if (!t.socialPostDraftHandler)
|
|
956
956
|
throw new Error("Social post drafting is not available here.");
|
|
957
957
|
const d = await t.socialPostDraftHandler(r);
|
|
958
958
|
if (!d.linkedinPost || !d.xPost)
|
|
959
959
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
960
|
-
|
|
960
|
+
fe.add(r.id), Ae.add(r.id), H(), we?.remove(), we = Wa(d, {
|
|
961
961
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
962
962
|
onClose: () => {
|
|
963
|
-
|
|
963
|
+
we?.remove(), we = null;
|
|
964
964
|
}
|
|
965
|
-
}), a.appendChild(
|
|
965
|
+
}), a.appendChild(we);
|
|
966
966
|
} catch (d) {
|
|
967
967
|
Ee = d instanceof Error ? d.message : "Could not draft social post.";
|
|
968
968
|
} finally {
|
|
969
|
-
De = null,
|
|
969
|
+
De = null, M(f.getState());
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
973
|
function Xe(r, d) {
|
|
974
|
-
const S = r.accentColor ?? t.accentColor,
|
|
975
|
-
i =
|
|
974
|
+
const S = r.accentColor ?? t.accentColor, D = r.colorScheme ?? t.colorScheme, I = r.fontFamily ?? t.fontFamily, Ze = r.scribbleStyle ?? t.scribbleStyle;
|
|
975
|
+
i = Ft(
|
|
976
976
|
S,
|
|
977
977
|
Ze
|
|
978
|
-
),
|
|
978
|
+
), zt(a, i, {
|
|
979
979
|
accentColor: S,
|
|
980
|
-
colorScheme:
|
|
981
|
-
fontFamily:
|
|
980
|
+
colorScheme: D,
|
|
981
|
+
fontFamily: I,
|
|
982
982
|
scribbleStyle: Ze
|
|
983
983
|
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
984
984
|
source: d,
|
|
985
985
|
inputAppearance: r,
|
|
986
986
|
appliedAccentColor: S,
|
|
987
|
-
appliedColorScheme:
|
|
988
|
-
appliedFontFamily:
|
|
987
|
+
appliedColorScheme: D,
|
|
988
|
+
appliedFontFamily: I,
|
|
989
989
|
appliedScribbleStyle: Ze,
|
|
990
990
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
991
991
|
});
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function Ft(e, t) {
|
|
995
995
|
return { accentColor: e, scribbleStyle: t };
|
|
996
996
|
}
|
|
997
997
|
function Uo(e) {
|
|
@@ -1017,7 +1017,7 @@ function zo([e, t, n]) {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function zt(e, t, n) {
|
|
1021
1021
|
e.classList.toggle(
|
|
1022
1022
|
"pluno-pa-widget--dark",
|
|
1023
1023
|
n.colorScheme === "dark"
|
|
@@ -1029,7 +1029,7 @@ function Ft(e, t, n) {
|
|
|
1029
1029
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1030
1030
|
"--pluno-pa-accent-contrast",
|
|
1031
1031
|
Uo(o)
|
|
1032
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? vo : n.fontFamily, n.scribbleStyle &&
|
|
1032
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? vo : n.fontFamily, n.scribbleStyle && Go(e.ownerDocument);
|
|
1033
1033
|
const a = Array.from(
|
|
1034
1034
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1035
1035
|
);
|
|
@@ -1041,11 +1041,11 @@ function Ft(e, t, n) {
|
|
|
1041
1041
|
)
|
|
1042
1042
|
);
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1045
|
-
if (e.getElementById(
|
|
1044
|
+
function Go(e) {
|
|
1045
|
+
if (e.getElementById(Dt))
|
|
1046
1046
|
return;
|
|
1047
1047
|
const t = e.createElement("style");
|
|
1048
|
-
t.id =
|
|
1048
|
+
t.id = Dt, t.textContent = `@font-face {
|
|
1049
1049
|
font-family: "Architects Daughter";
|
|
1050
1050
|
font-style: normal;
|
|
1051
1051
|
font-weight: 400;
|
|
@@ -1053,7 +1053,7 @@ function Ho(e) {
|
|
|
1053
1053
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1054
1054
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function Ho({
|
|
1057
1057
|
root: e,
|
|
1058
1058
|
launcher: t,
|
|
1059
1059
|
launcherDragHandle: n,
|
|
@@ -1064,17 +1064,17 @@ function Go({
|
|
|
1064
1064
|
let l = null, p = null, c = null, u = !1, s = null;
|
|
1065
1065
|
const b = () => {
|
|
1066
1066
|
l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1067
|
-
},
|
|
1067
|
+
}, w = (h) => {
|
|
1068
1068
|
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), u = !1, t.setPointerCapture?.(h.pointerId));
|
|
1069
1069
|
}, P = (h) => {
|
|
1070
1070
|
if (l !== h.pointerId || !p || !c)
|
|
1071
1071
|
return;
|
|
1072
1072
|
h.preventDefault();
|
|
1073
1073
|
const g = h.clientX - p.x, E = h.clientY - p.y;
|
|
1074
|
-
!u && Math.hypot(g, E) <
|
|
1075
|
-
},
|
|
1074
|
+
!u && Math.hypot(g, E) < Ot || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
|
|
1075
|
+
}, L = (h) => {
|
|
1076
1076
|
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
|
|
1077
|
-
},
|
|
1077
|
+
}, R = (h) => {
|
|
1078
1078
|
l === h.pointerId && (h.preventDefault(), b());
|
|
1079
1079
|
}, y = (h) => {
|
|
1080
1080
|
if (!s)
|
|
@@ -1082,44 +1082,44 @@ function Go({
|
|
|
1082
1082
|
const g = Math.hypot(
|
|
1083
1083
|
h.clientX - s.x,
|
|
1084
1084
|
h.clientY - s.y
|
|
1085
|
-
) <=
|
|
1085
|
+
) <= Ot;
|
|
1086
1086
|
s = null, g && (h.preventDefault(), h.stopPropagation());
|
|
1087
1087
|
}, C = (h) => {
|
|
1088
1088
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1089
1089
|
return;
|
|
1090
1090
|
const g = h.shiftKey ? Ro : Do, E = o();
|
|
1091
|
-
let
|
|
1092
|
-
h.key === "ArrowUp" ?
|
|
1091
|
+
let O = null;
|
|
1092
|
+
h.key === "ArrowUp" ? O = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? O = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? O = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (O = { x: E.x + g, y: E.y }), O && (h.preventDefault(), h.stopPropagation(), a(O), i());
|
|
1093
1093
|
};
|
|
1094
|
-
return t.addEventListener("pointerdown",
|
|
1095
|
-
t.removeEventListener("pointerdown",
|
|
1094
|
+
return t.addEventListener("pointerdown", w), t.addEventListener("pointermove", P), t.addEventListener("pointerup", L), t.addEventListener("pointercancel", R), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
|
|
1095
|
+
t.removeEventListener("pointerdown", w), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", L), t.removeEventListener("pointercancel", R), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
|
|
1096
1096
|
};
|
|
1097
1097
|
}
|
|
1098
1098
|
function lt(e, t = !0) {
|
|
1099
|
-
const n =
|
|
1099
|
+
const n = te(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1100
1100
|
return {
|
|
1101
1101
|
width: t && a && o.width > 0 ? o.width : Math.min(dn, n.width - 36),
|
|
1102
1102
|
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Co : cn
|
|
1103
1103
|
};
|
|
1104
1104
|
}
|
|
1105
1105
|
function mn() {
|
|
1106
|
-
const e =
|
|
1106
|
+
const e = te();
|
|
1107
1107
|
return {
|
|
1108
1108
|
width: Math.min(
|
|
1109
|
-
|
|
1109
|
+
ye(
|
|
1110
1110
|
e.width * ko,
|
|
1111
1111
|
Eo,
|
|
1112
1112
|
So
|
|
1113
1113
|
),
|
|
1114
|
-
e.width -
|
|
1114
|
+
e.width - F * 2
|
|
1115
1115
|
),
|
|
1116
1116
|
height: Math.min(
|
|
1117
|
-
|
|
1118
|
-
e.height *
|
|
1117
|
+
ye(
|
|
1118
|
+
e.height * Po,
|
|
1119
1119
|
Lo,
|
|
1120
|
-
|
|
1120
|
+
Ao
|
|
1121
1121
|
),
|
|
1122
|
-
e.height - rt -
|
|
1122
|
+
e.height - rt - F
|
|
1123
1123
|
)
|
|
1124
1124
|
};
|
|
1125
1125
|
}
|
|
@@ -1130,42 +1130,42 @@ function Wo(e, t, n) {
|
|
|
1130
1130
|
const i = e.getBoundingClientRect();
|
|
1131
1131
|
if (i.width > 0 || i.height > 0)
|
|
1132
1132
|
return { x: i.left, y: i.top };
|
|
1133
|
-
const l =
|
|
1133
|
+
const l = te();
|
|
1134
1134
|
return {
|
|
1135
1135
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
1136
1136
|
y: l.height - 24 - n.height
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1140
|
-
const o =
|
|
1139
|
+
function Gt(e, t, n) {
|
|
1140
|
+
const o = te(), a = F + Vo(e);
|
|
1141
1141
|
return {
|
|
1142
|
-
x:
|
|
1142
|
+
x: ye(
|
|
1143
1143
|
t.x,
|
|
1144
|
-
|
|
1144
|
+
F,
|
|
1145
1145
|
Math.max(
|
|
1146
|
-
|
|
1147
|
-
o.width - n.width -
|
|
1146
|
+
F,
|
|
1147
|
+
o.width - n.width - F
|
|
1148
1148
|
)
|
|
1149
1149
|
),
|
|
1150
|
-
y:
|
|
1150
|
+
y: ye(
|
|
1151
1151
|
t.y,
|
|
1152
1152
|
a,
|
|
1153
1153
|
Math.max(
|
|
1154
1154
|
a,
|
|
1155
|
-
o.height - n.height -
|
|
1155
|
+
o.height - n.height - F
|
|
1156
1156
|
)
|
|
1157
1157
|
)
|
|
1158
1158
|
};
|
|
1159
1159
|
}
|
|
1160
1160
|
function $o(e, t) {
|
|
1161
|
-
const n =
|
|
1161
|
+
const n = te();
|
|
1162
1162
|
return {
|
|
1163
1163
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1164
1164
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1165
1165
|
};
|
|
1166
1166
|
}
|
|
1167
1167
|
function qo(e, t) {
|
|
1168
|
-
const n = jo(e, t), o =
|
|
1168
|
+
const n = jo(e, t), o = te();
|
|
1169
1169
|
return {
|
|
1170
1170
|
anchor: n,
|
|
1171
1171
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
@@ -1173,11 +1173,11 @@ function qo(e, t) {
|
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
1175
1175
|
function jo(e, t) {
|
|
1176
|
-
const n =
|
|
1176
|
+
const n = te(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
1177
1177
|
return `${i}-${l}`;
|
|
1178
1178
|
}
|
|
1179
1179
|
function Vo(e) {
|
|
1180
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1180
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? No : Io;
|
|
1181
1181
|
}
|
|
1182
1182
|
function Ht(e, t, n) {
|
|
1183
1183
|
const o = lt(e), a = mn(), i = {
|
|
@@ -1187,22 +1187,22 @@ function Ht(e, t, n) {
|
|
|
1187
1187
|
return Yo(i);
|
|
1188
1188
|
}
|
|
1189
1189
|
function Yo(e) {
|
|
1190
|
-
const t =
|
|
1190
|
+
const t = te(), n = mn();
|
|
1191
1191
|
return {
|
|
1192
|
-
x:
|
|
1192
|
+
x: ye(
|
|
1193
1193
|
e.x,
|
|
1194
|
-
|
|
1194
|
+
F,
|
|
1195
1195
|
Math.max(
|
|
1196
|
-
|
|
1197
|
-
t.width - n.width -
|
|
1196
|
+
F,
|
|
1197
|
+
t.width - n.width - F
|
|
1198
1198
|
)
|
|
1199
1199
|
),
|
|
1200
|
-
y:
|
|
1200
|
+
y: ye(
|
|
1201
1201
|
e.y,
|
|
1202
1202
|
rt,
|
|
1203
1203
|
Math.max(
|
|
1204
1204
|
rt,
|
|
1205
|
-
t.height - n.height -
|
|
1205
|
+
t.height - n.height - F
|
|
1206
1206
|
)
|
|
1207
1207
|
)
|
|
1208
1208
|
};
|
|
@@ -1220,10 +1220,10 @@ function Ko(e, t) {
|
|
|
1220
1220
|
function Xo(e) {
|
|
1221
1221
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function te() {
|
|
1224
1224
|
return {
|
|
1225
|
-
width: window.innerWidth || document.documentElement.clientWidth || dn +
|
|
1226
|
-
height: window.innerHeight || document.documentElement.clientHeight || cn +
|
|
1225
|
+
width: window.innerWidth || document.documentElement.clientWidth || dn + F * 2,
|
|
1226
|
+
height: window.innerHeight || document.documentElement.clientHeight || cn + F * 2
|
|
1227
1227
|
};
|
|
1228
1228
|
}
|
|
1229
1229
|
function Qe(e) {
|
|
@@ -1235,7 +1235,7 @@ function Qe(e) {
|
|
|
1235
1235
|
height: Math.round(t.height)
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function ye(e, t, n) {
|
|
1239
1239
|
return Math.min(Math.max(e, t), n);
|
|
1240
1240
|
}
|
|
1241
1241
|
function Y(e, t, n) {
|
|
@@ -1318,7 +1318,7 @@ function oa(e, t, n, o) {
|
|
|
1318
1318
|
e.appendChild(ua()), e.appendChild(
|
|
1319
1319
|
aa(t, n, o)
|
|
1320
1320
|
), e.appendChild(
|
|
1321
|
-
|
|
1321
|
+
Ge(
|
|
1322
1322
|
"pluno-pa-widget__close",
|
|
1323
1323
|
"Close",
|
|
1324
1324
|
ga(16),
|
|
@@ -1363,7 +1363,7 @@ function ia(e) {
|
|
|
1363
1363
|
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
|
|
1364
1364
|
const p = document.createElement("div");
|
|
1365
1365
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1366
|
-
|
|
1366
|
+
Ge(
|
|
1367
1367
|
"pluno-pa-widget__history",
|
|
1368
1368
|
"Recent chats",
|
|
1369
1369
|
ma(),
|
|
@@ -1404,7 +1404,7 @@ function la() {
|
|
|
1404
1404
|
t.className = "pluno-pa-widget__history-header";
|
|
1405
1405
|
const n = document.createElement("strong");
|
|
1406
1406
|
n.textContent = "Recent chats";
|
|
1407
|
-
const o =
|
|
1407
|
+
const o = Ge(
|
|
1408
1408
|
"pluno-pa-widget__history-close",
|
|
1409
1409
|
"Close recent chats",
|
|
1410
1410
|
ba(),
|
|
@@ -1442,8 +1442,8 @@ function sa(e, t) {
|
|
|
1442
1442
|
);
|
|
1443
1443
|
}
|
|
1444
1444
|
function re(e, t) {
|
|
1445
|
-
const n = `pluno-pa-character-${
|
|
1446
|
-
|
|
1445
|
+
const n = `pluno-pa-character-${Ut}`;
|
|
1446
|
+
Ut += 1;
|
|
1447
1447
|
const o = t.scribbleStyle ? ca(t.accentColor, n) : da(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
|
|
1448
1448
|
return o.setAttribute(
|
|
1449
1449
|
"class",
|
|
@@ -1470,7 +1470,7 @@ function da(e, t) {
|
|
|
1470
1470
|
y2: "1040",
|
|
1471
1471
|
gradientUnits: "userSpaceOnUse"
|
|
1472
1472
|
});
|
|
1473
|
-
|
|
1473
|
+
N(l, "0", n.top), N(l, "0.36", n.middle), N(l, "0.72", n.bottom), N(l, "1", n.bottom);
|
|
1474
1474
|
const p = m(i, "linearGradient", {
|
|
1475
1475
|
id: o.boltEdge,
|
|
1476
1476
|
x1: "470",
|
|
@@ -1479,28 +1479,28 @@ function da(e, t) {
|
|
|
1479
1479
|
y2: "980",
|
|
1480
1480
|
gradientUnits: "userSpaceOnUse"
|
|
1481
1481
|
});
|
|
1482
|
-
|
|
1482
|
+
N(p, "0", n.edgeStart), N(p, "0.32", n.edgeMiddle), N(p, "0.78", n.edgeEnd), N(p, "1", n.edgeEnd);
|
|
1483
1483
|
const c = m(i, "radialGradient", {
|
|
1484
1484
|
id: o.boltGlow,
|
|
1485
1485
|
cx: "50%",
|
|
1486
1486
|
cy: "22%",
|
|
1487
1487
|
r: "82%"
|
|
1488
1488
|
});
|
|
1489
|
-
|
|
1489
|
+
N(c, "0", n.glow, "0.72"), N(c, "0.5", n.middle, "0.44"), N(c, "1", n.bottom, "0");
|
|
1490
1490
|
const u = m(i, "radialGradient", {
|
|
1491
1491
|
id: o.eyeWhite,
|
|
1492
1492
|
cx: "35%",
|
|
1493
1493
|
cy: "25%",
|
|
1494
1494
|
r: "70%"
|
|
1495
1495
|
});
|
|
1496
|
-
|
|
1496
|
+
N(u, "0", "#ffffff"), N(u, "0.72", "#ffffff"), N(u, "1", "#e5e5e5");
|
|
1497
1497
|
const s = m(i, "radialGradient", {
|
|
1498
1498
|
id: o.pupil,
|
|
1499
1499
|
cx: "42%",
|
|
1500
1500
|
cy: "38%",
|
|
1501
1501
|
r: "65%"
|
|
1502
1502
|
});
|
|
1503
|
-
|
|
1503
|
+
N(s, "0", "#2a1f10"), N(s, "0.52", "#080604"), N(s, "1", "#000000");
|
|
1504
1504
|
const b = m(i, "filter", {
|
|
1505
1505
|
id: o.softDropShadow,
|
|
1506
1506
|
x: "-18%",
|
|
@@ -1516,7 +1516,7 @@ function da(e, t) {
|
|
|
1516
1516
|
"flood-color": n.shadow,
|
|
1517
1517
|
"flood-opacity": "0.24"
|
|
1518
1518
|
});
|
|
1519
|
-
const
|
|
1519
|
+
const w = m(i, "filter", {
|
|
1520
1520
|
id: o.innerDepth,
|
|
1521
1521
|
x: "-8%",
|
|
1522
1522
|
y: "-8%",
|
|
@@ -1524,27 +1524,27 @@ function da(e, t) {
|
|
|
1524
1524
|
height: "116%",
|
|
1525
1525
|
"color-interpolation-filters": "sRGB"
|
|
1526
1526
|
});
|
|
1527
|
-
m(
|
|
1527
|
+
m(w, "feGaussianBlur", {
|
|
1528
1528
|
in: "SourceAlpha",
|
|
1529
1529
|
stdDeviation: "8",
|
|
1530
1530
|
result: "blur"
|
|
1531
|
-
}), m(
|
|
1531
|
+
}), m(w, "feOffset", {
|
|
1532
1532
|
dx: "-7",
|
|
1533
1533
|
dy: "-9",
|
|
1534
1534
|
result: "topLeft"
|
|
1535
|
-
}), m(
|
|
1535
|
+
}), m(w, "feComposite", {
|
|
1536
1536
|
in: "topLeft",
|
|
1537
1537
|
in2: "SourceAlpha",
|
|
1538
1538
|
operator: "arithmetic",
|
|
1539
1539
|
k2: "-1",
|
|
1540
1540
|
k3: "1",
|
|
1541
1541
|
result: "innerShadow"
|
|
1542
|
-
}), m(
|
|
1542
|
+
}), m(w, "feColorMatrix", {
|
|
1543
1543
|
in: "innerShadow",
|
|
1544
1544
|
type: "matrix",
|
|
1545
1545
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1546
1546
|
result: "innerLight"
|
|
1547
|
-
}), m(
|
|
1547
|
+
}), m(w, "feBlend", {
|
|
1548
1548
|
in: "SourceGraphic",
|
|
1549
1549
|
in2: "innerLight",
|
|
1550
1550
|
mode: "screen"
|
|
@@ -1564,7 +1564,7 @@ function da(e, t) {
|
|
|
1564
1564
|
"flood-color": n.shadow,
|
|
1565
1565
|
"flood-opacity": "0.3"
|
|
1566
1566
|
});
|
|
1567
|
-
const
|
|
1567
|
+
const L = m(i, "filter", {
|
|
1568
1568
|
id: o.pupilGloss,
|
|
1569
1569
|
x: "-15%",
|
|
1570
1570
|
y: "-15%",
|
|
@@ -1572,15 +1572,15 @@ function da(e, t) {
|
|
|
1572
1572
|
height: "130%",
|
|
1573
1573
|
"color-interpolation-filters": "sRGB"
|
|
1574
1574
|
});
|
|
1575
|
-
m(
|
|
1575
|
+
m(L, "feDropShadow", {
|
|
1576
1576
|
dx: "0",
|
|
1577
1577
|
dy: "3",
|
|
1578
1578
|
stdDeviation: "3",
|
|
1579
1579
|
"flood-color": "#000000",
|
|
1580
1580
|
"flood-opacity": "0.22"
|
|
1581
1581
|
});
|
|
1582
|
-
const
|
|
1583
|
-
m(
|
|
1582
|
+
const R = m(i, "clipPath", { id: o.boltClip });
|
|
1583
|
+
m(R, "path", { d: Ue });
|
|
1584
1584
|
const y = m(a, "g", {
|
|
1585
1585
|
filter: $(o.softDropShadow)
|
|
1586
1586
|
});
|
|
@@ -1625,7 +1625,7 @@ function da(e, t) {
|
|
|
1625
1625
|
opacity: "0.48"
|
|
1626
1626
|
});
|
|
1627
1627
|
const g = m(a, "g", { filter: $(o.eyeShadow) });
|
|
1628
|
-
return
|
|
1628
|
+
return Wt(
|
|
1629
1629
|
g,
|
|
1630
1630
|
"rotate(-2 528 463)",
|
|
1631
1631
|
"528",
|
|
@@ -1635,7 +1635,7 @@ function da(e, t) {
|
|
|
1635
1635
|
"557",
|
|
1636
1636
|
"447",
|
|
1637
1637
|
o
|
|
1638
|
-
),
|
|
1638
|
+
), Wt(
|
|
1639
1639
|
g,
|
|
1640
1640
|
"rotate(2 717 462)",
|
|
1641
1641
|
"717",
|
|
@@ -1678,7 +1678,7 @@ function ca(e, t) {
|
|
|
1678
1678
|
"clip-path": $(o.clip)
|
|
1679
1679
|
});
|
|
1680
1680
|
return m(u, "path", {
|
|
1681
|
-
d:
|
|
1681
|
+
d: Hn(),
|
|
1682
1682
|
fill: "none",
|
|
1683
1683
|
stroke: n,
|
|
1684
1684
|
"stroke-width": "56",
|
|
@@ -1692,7 +1692,7 @@ function ca(e, t) {
|
|
|
1692
1692
|
stroke: Fe,
|
|
1693
1693
|
"stroke-width": "18",
|
|
1694
1694
|
"stroke-linejoin": "round"
|
|
1695
|
-
}),
|
|
1695
|
+
}), $t(
|
|
1696
1696
|
c,
|
|
1697
1697
|
"rotate(-2 528 463)",
|
|
1698
1698
|
"528",
|
|
@@ -1701,7 +1701,7 @@ function ca(e, t) {
|
|
|
1701
1701
|
"473",
|
|
1702
1702
|
"557",
|
|
1703
1703
|
"447"
|
|
1704
|
-
),
|
|
1704
|
+
), $t(
|
|
1705
1705
|
c,
|
|
1706
1706
|
"rotate(2 717 462)",
|
|
1707
1707
|
"717",
|
|
@@ -1718,7 +1718,7 @@ function fn() {
|
|
|
1718
1718
|
viewBox: "0 0 1254 1254"
|
|
1719
1719
|
});
|
|
1720
1720
|
}
|
|
1721
|
-
function
|
|
1721
|
+
function Wt(e, t, n, o, a, i, l, p, c) {
|
|
1722
1722
|
const u = m(e, "g", { transform: t });
|
|
1723
1723
|
m(u, "ellipse", {
|
|
1724
1724
|
cx: n,
|
|
@@ -1740,7 +1740,7 @@ function Gt(e, t, n, o, a, i, l, p, c) {
|
|
|
1740
1740
|
fill: "#ffffff"
|
|
1741
1741
|
});
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function $t(e, t, n, o, a, i, l, p) {
|
|
1744
1744
|
const c = m(e, "g", { transform: t });
|
|
1745
1745
|
m(c, "ellipse", {
|
|
1746
1746
|
cx: n,
|
|
@@ -1767,14 +1767,14 @@ function m(e, t, n = {}) {
|
|
|
1767
1767
|
const o = v(t, n);
|
|
1768
1768
|
return e.appendChild(o), o;
|
|
1769
1769
|
}
|
|
1770
|
-
function
|
|
1770
|
+
function N(e, t, n, o) {
|
|
1771
1771
|
const a = { offset: t, "stop-color": n };
|
|
1772
1772
|
o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
|
|
1773
1773
|
}
|
|
1774
1774
|
function $(e) {
|
|
1775
1775
|
return `url(#${e})`;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function Ge(e, t, n, o) {
|
|
1778
1778
|
const a = document.createElement("button");
|
|
1779
1779
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1780
1780
|
}
|
|
@@ -1793,7 +1793,7 @@ function ua() {
|
|
|
1793
1793
|
), e.appendChild(t), e;
|
|
1794
1794
|
}
|
|
1795
1795
|
function wn(e, t) {
|
|
1796
|
-
const n = t *
|
|
1796
|
+
const n = t * Rt + Mt * 2, o = v("svg", {
|
|
1797
1797
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1798
1798
|
viewBox: `0 0 ${n} ${To}`,
|
|
1799
1799
|
preserveAspectRatio: "xMidYMid meet",
|
|
@@ -1801,8 +1801,8 @@ function wn(e, t) {
|
|
|
1801
1801
|
focusable: "false"
|
|
1802
1802
|
});
|
|
1803
1803
|
for (let a = 0; a < t; a += 1) {
|
|
1804
|
-
const i =
|
|
1805
|
-
transform: `translate(${
|
|
1804
|
+
const i = Bt[a % Bt.length], l = v("g", {
|
|
1805
|
+
transform: `translate(${Mt + a * Rt} 0)`
|
|
1806
1806
|
});
|
|
1807
1807
|
l.appendChild(
|
|
1808
1808
|
v("ellipse", {
|
|
@@ -2031,7 +2031,7 @@ function v(e, t = {}) {
|
|
|
2031
2031
|
n.setAttribute(o, a);
|
|
2032
2032
|
return n;
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function qt(e) {
|
|
2035
2035
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2036
2036
|
e.addEventListener(t, (n) => {
|
|
2037
2037
|
n.stopPropagation();
|
|
@@ -2093,14 +2093,14 @@ async function ka(e) {
|
|
|
2093
2093
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
2094
2094
|
if (o === "image/gif") {
|
|
2095
2095
|
const a = new Uint8Array(await Ba(n));
|
|
2096
|
-
if (
|
|
2096
|
+
if (Pa(a))
|
|
2097
2097
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
2098
2098
|
}
|
|
2099
2099
|
return {
|
|
2100
2100
|
name: n.name || Sa(o),
|
|
2101
2101
|
mimeType: o,
|
|
2102
2102
|
sizeBytes: n.size,
|
|
2103
|
-
dataUrl:
|
|
2103
|
+
dataUrl: Aa(
|
|
2104
2104
|
await Oa(n),
|
|
2105
2105
|
o
|
|
2106
2106
|
)
|
|
@@ -2114,11 +2114,11 @@ function La(e) {
|
|
|
2114
2114
|
const t = e.name.toLowerCase();
|
|
2115
2115
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2117
|
+
function Aa(e, t) {
|
|
2118
2118
|
const n = `data:${t};base64,`;
|
|
2119
2119
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
2120
2120
|
}
|
|
2121
|
-
function
|
|
2121
|
+
function Pa(e) {
|
|
2122
2122
|
if (e.length < 14 || !Ta(e))
|
|
2123
2123
|
return !1;
|
|
2124
2124
|
const t = e[10];
|
|
@@ -2130,7 +2130,7 @@ function Aa(e) {
|
|
|
2130
2130
|
if (n += 1, a === 59)
|
|
2131
2131
|
return !1;
|
|
2132
2132
|
if (a === 33) {
|
|
2133
|
-
n += 1, n =
|
|
2133
|
+
n += 1, n = jt(e, n);
|
|
2134
2134
|
continue;
|
|
2135
2135
|
}
|
|
2136
2136
|
if (a !== 44)
|
|
@@ -2142,14 +2142,14 @@ function Aa(e) {
|
|
|
2142
2142
|
const i = e[n + 8];
|
|
2143
2143
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
2144
2144
|
return !1;
|
|
2145
|
-
n += 1, n =
|
|
2145
|
+
n += 1, n = jt(e, n);
|
|
2146
2146
|
}
|
|
2147
2147
|
return !1;
|
|
2148
2148
|
}
|
|
2149
2149
|
function Ta(e) {
|
|
2150
2150
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
2151
2151
|
}
|
|
2152
|
-
function
|
|
2152
|
+
function jt(e, t) {
|
|
2153
2153
|
for (; t < e.length; ) {
|
|
2154
2154
|
const n = e[t];
|
|
2155
2155
|
if (t += 1, n === 0)
|
|
@@ -2166,11 +2166,11 @@ function nt(e, t, n = null) {
|
|
|
2166
2166
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2167
2167
|
return;
|
|
2168
2168
|
}
|
|
2169
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) ||
|
|
2170
|
-
|
|
2171
|
-
) : yn(t) && e.appendChild(
|
|
2169
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || ut(n) ? e.appendChild(
|
|
2170
|
+
Ia(t, n)
|
|
2171
|
+
) : yn(t) && e.appendChild(Na(t));
|
|
2172
2172
|
}
|
|
2173
|
-
function
|
|
2173
|
+
function Ia(e, t) {
|
|
2174
2174
|
const n = document.createElement("div");
|
|
2175
2175
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2176
2176
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
@@ -2184,7 +2184,7 @@ function Na(e, t) {
|
|
|
2184
2184
|
)
|
|
2185
2185
|
), n;
|
|
2186
2186
|
}
|
|
2187
|
-
function
|
|
2187
|
+
function Na(e) {
|
|
2188
2188
|
const t = document.createElement("div");
|
|
2189
2189
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2190
2190
|
const n = document.createElement("strong");
|
|
@@ -2199,9 +2199,9 @@ function Ia(e) {
|
|
|
2199
2199
|
), t;
|
|
2200
2200
|
}
|
|
2201
2201
|
function pt(e, t) {
|
|
2202
|
-
return e !== null && (X(e) || yn(e) ||
|
|
2202
|
+
return e !== null && (X(e) || yn(e) || ut(t));
|
|
2203
2203
|
}
|
|
2204
|
-
function
|
|
2204
|
+
function Vt(e, t, n) {
|
|
2205
2205
|
return pt(t, n) || Da(t) ? !0 : !pt(e, n);
|
|
2206
2206
|
}
|
|
2207
2207
|
function Da(e) {
|
|
@@ -2210,7 +2210,7 @@ function Da(e) {
|
|
|
2210
2210
|
function X(e) {
|
|
2211
2211
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2212
2212
|
}
|
|
2213
|
-
function
|
|
2213
|
+
function ut(e) {
|
|
2214
2214
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2215
2215
|
}
|
|
2216
2216
|
function yn(e) {
|
|
@@ -2227,12 +2227,12 @@ function Ma(e) {
|
|
|
2227
2227
|
function vn(e, t, n) {
|
|
2228
2228
|
const o = document.createElement("div");
|
|
2229
2229
|
return o.className = n, o.appendChild(
|
|
2230
|
-
|
|
2230
|
+
Yt(t, e.pricingUrl)
|
|
2231
2231
|
), o.appendChild(
|
|
2232
|
-
|
|
2232
|
+
Yt("Earn credits", e.earnCreditsUrl)
|
|
2233
2233
|
), o;
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function Yt(e, t) {
|
|
2236
2236
|
const n = document.createElement("button");
|
|
2237
2237
|
if (n.type = "button", e === "Earn credits") {
|
|
2238
2238
|
const o = document.createElement("span");
|
|
@@ -2271,13 +2271,13 @@ function Oa(e) {
|
|
|
2271
2271
|
}), o.readAsDataURL(e);
|
|
2272
2272
|
});
|
|
2273
2273
|
}
|
|
2274
|
-
function
|
|
2274
|
+
function Kt(e, t) {
|
|
2275
2275
|
return e.messages.filter(
|
|
2276
2276
|
(o) => !Cn(o)
|
|
2277
2277
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2278
2278
|
}
|
|
2279
|
-
function Ua(e, t, n, o, a, i, l, p, c, u, s, b,
|
|
2280
|
-
const
|
|
2279
|
+
function Ua(e, t, n, o, a, i, l, p, c, u, s, b, w, P, L) {
|
|
2280
|
+
const R = Fa(i), y = R.filter(
|
|
2281
2281
|
(_) => !Cn(_)
|
|
2282
2282
|
), C = e.scrollTop;
|
|
2283
2283
|
e.replaceChildren(), Sn(n, i.isThinking), a.hidden = !p, p && l !== null && sa(a, l);
|
|
@@ -2285,96 +2285,96 @@ function Ua(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
|
|
|
2285
2285
|
if (o(h), y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
2286
2286
|
const _ = document.createElement("div");
|
|
2287
2287
|
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2288
|
-
const
|
|
2289
|
-
|
|
2290
|
-
const
|
|
2288
|
+
const T = document.createElement("div");
|
|
2289
|
+
T.className = "pluno-pa-widget__empty-hero";
|
|
2290
|
+
const be = re(
|
|
2291
2291
|
"pluno-pa-widget__character--empty",
|
|
2292
|
-
|
|
2292
|
+
w()
|
|
2293
2293
|
);
|
|
2294
|
-
|
|
2295
|
-
const
|
|
2296
|
-
if (
|
|
2297
|
-
for (const
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
P(
|
|
2301
|
-
}),
|
|
2294
|
+
T.appendChild(be), _.appendChild(T), _.appendChild(bn());
|
|
2295
|
+
const k = document.createElement("div");
|
|
2296
|
+
if (k.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && !i.starterPromptsLoading && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
2297
|
+
for (const A of i.starterPrompts) {
|
|
2298
|
+
const x = document.createElement("button");
|
|
2299
|
+
x.type = "button", x.className = "pluno-pa-widget__starter-prompt", x.textContent = `"${A}"`, x.addEventListener("click", () => {
|
|
2300
|
+
P(A);
|
|
2301
|
+
}), k.appendChild(x);
|
|
2302
2302
|
}
|
|
2303
2303
|
else if (i.starterPromptsLoading) {
|
|
2304
|
-
const
|
|
2305
|
-
|
|
2304
|
+
const A = document.createElement("button");
|
|
2305
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", k.appendChild(A);
|
|
2306
2306
|
} else
|
|
2307
|
-
for (let
|
|
2308
|
-
const
|
|
2309
|
-
|
|
2307
|
+
for (let A = 0; A < xo; A += 1) {
|
|
2308
|
+
const x = document.createElement("button");
|
|
2309
|
+
x.type = "button", x.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", x.disabled = !0, x.tabIndex = -1, x.textContent = "", k.appendChild(x);
|
|
2310
2310
|
}
|
|
2311
|
-
_.appendChild(
|
|
2311
|
+
_.appendChild(k), e.appendChild(_), e.appendChild(t);
|
|
2312
2312
|
return;
|
|
2313
2313
|
}
|
|
2314
|
-
let g = null, E = null,
|
|
2315
|
-
const le = () => {
|
|
2316
|
-
if (
|
|
2314
|
+
let g = null, E = null, O = [];
|
|
2315
|
+
const le = y.some(st), me = () => {
|
|
2316
|
+
if (O.length === 0)
|
|
2317
2317
|
return !1;
|
|
2318
|
-
const _ =
|
|
2319
|
-
|
|
2318
|
+
const _ = Ka(
|
|
2319
|
+
O,
|
|
2320
2320
|
s,
|
|
2321
2321
|
b,
|
|
2322
|
-
|
|
2322
|
+
w()
|
|
2323
2323
|
);
|
|
2324
|
-
return e.appendChild(_), g = null, E = _,
|
|
2324
|
+
return e.appendChild(_), g = null, E = _, O = [], !0;
|
|
2325
2325
|
};
|
|
2326
2326
|
for (let _ = 0; _ < y.length; _ += 1) {
|
|
2327
|
-
const
|
|
2328
|
-
if (
|
|
2329
|
-
|
|
2327
|
+
const T = y[_];
|
|
2328
|
+
if (T.role === "tool") {
|
|
2329
|
+
O.push(T);
|
|
2330
|
+
continue;
|
|
2331
|
+
}
|
|
2332
|
+
if (st(T)) {
|
|
2333
|
+
if (me()) {
|
|
2334
|
+
const G = dt();
|
|
2335
|
+
e.appendChild(G), g = null, E = G;
|
|
2336
|
+
} else {
|
|
2337
|
+
const G = Jt(w());
|
|
2338
|
+
e.appendChild(G), g = null, E = G;
|
|
2339
|
+
}
|
|
2330
2340
|
continue;
|
|
2331
2341
|
}
|
|
2332
|
-
if (
|
|
2342
|
+
if (T.role === "system")
|
|
2333
2343
|
continue;
|
|
2334
|
-
const
|
|
2335
|
-
if (
|
|
2336
|
-
const
|
|
2337
|
-
e.appendChild(
|
|
2344
|
+
const be = me(), k = Ya(T.content);
|
|
2345
|
+
if (T.role === "assistant" && !be) {
|
|
2346
|
+
const U = En(w());
|
|
2347
|
+
e.appendChild(U), g = null, E = U;
|
|
2338
2348
|
}
|
|
2339
|
-
const f = document.createElement("div");
|
|
2340
|
-
f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Jt(f, R) : f.textContent = R, L.role === "user" && L.attachments?.length && f.appendChild(Fa(L.attachments));
|
|
2341
2349
|
const A = document.createElement("div");
|
|
2342
|
-
A.className =
|
|
2350
|
+
A.className = `pluno-pa-widget__message pluno-pa-widget__message--${T.role}`, T.role === "assistant" ? Za(A, k) : A.textContent = k, T.role === "user" && T.attachments?.length && A.appendChild(za(T.attachments));
|
|
2351
|
+
const x = document.createElement("div");
|
|
2352
|
+
x.className = "pluno-pa-widget__message-actions", x.appendChild(Ga(k)), A.appendChild(x), e.appendChild(A), g = A, E = null;
|
|
2343
2353
|
}
|
|
2344
|
-
const
|
|
2345
|
-
if (i.assistantDraft)
|
|
2346
|
-
if (
|
|
2347
|
-
const
|
|
2348
|
-
e.appendChild(R), g = null, E = R;
|
|
2349
|
-
}
|
|
2350
|
-
const _ = Zt(i.assistantDraft), L = document.createElement("div");
|
|
2351
|
-
L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Jt(L, _);
|
|
2352
|
-
const H = document.createElement("div");
|
|
2353
|
-
H.className = "pluno-pa-widget__message-actions", H.appendChild(Xt(_)), L.appendChild(H), e.appendChild(L), g = L, E = null;
|
|
2354
|
-
}
|
|
2355
|
-
if (i.isThinking && !i.assistantDraft)
|
|
2356
|
-
if (ye) {
|
|
2357
|
-
const _ = En();
|
|
2354
|
+
const z = me();
|
|
2355
|
+
if (i.isThinking && !i.assistantDraft && !le)
|
|
2356
|
+
if (z) {
|
|
2357
|
+
const _ = dt();
|
|
2358
2358
|
e.appendChild(_), g = null, E = _;
|
|
2359
2359
|
} else {
|
|
2360
|
-
const _ =
|
|
2360
|
+
const _ = Jt(w());
|
|
2361
2361
|
e.appendChild(_), g = null, E = _;
|
|
2362
2362
|
}
|
|
2363
2363
|
if (i.lastError) {
|
|
2364
2364
|
const _ = document.createElement("div");
|
|
2365
2365
|
_.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
|
|
2366
2366
|
}
|
|
2367
|
-
const
|
|
2368
|
-
if (
|
|
2369
|
-
const _ =
|
|
2370
|
-
isDrafting:
|
|
2371
|
-
error:
|
|
2372
|
-
characterIconOptions:
|
|
2373
|
-
onDraft:
|
|
2374
|
-
onDismiss:
|
|
2375
|
-
onDisable:
|
|
2367
|
+
const ne = L && !i.isThinking ? Vn(R) : null;
|
|
2368
|
+
if (L && ne && !L.dismissedCandidateIds.has(ne.id)) {
|
|
2369
|
+
const _ = Ha(ne, {
|
|
2370
|
+
isDrafting: L.draftingCandidateId === ne.id,
|
|
2371
|
+
error: L.error,
|
|
2372
|
+
characterIconOptions: L.characterIconOptions,
|
|
2373
|
+
onDraft: L.onDraft,
|
|
2374
|
+
onDismiss: L.onDismiss,
|
|
2375
|
+
onDisable: L.onDisable
|
|
2376
2376
|
});
|
|
2377
|
-
e.appendChild(_),
|
|
2377
|
+
e.appendChild(_), L.onSeen(ne), g = null, E = _;
|
|
2378
2378
|
}
|
|
2379
2379
|
g?.classList.add(
|
|
2380
2380
|
"pluno-pa-widget__message--bottom-reserve"
|
|
@@ -2382,7 +2382,50 @@ function Ua(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
|
|
|
2382
2382
|
"pluno-pa-widget__bottom-reserve-compact"
|
|
2383
2383
|
), e.appendChild(t), c ? ke(e, u) : e.scrollTop = C;
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2385
|
+
function Fa(e) {
|
|
2386
|
+
if (!e.assistantDraft)
|
|
2387
|
+
return [...e.messages];
|
|
2388
|
+
const t = {
|
|
2389
|
+
id: "assistant-draft",
|
|
2390
|
+
role: "assistant",
|
|
2391
|
+
content: e.assistantDraft,
|
|
2392
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2393
|
+
respondsToUserMessageId: e.assistantDraftRespondsToUserMessageId ?? void 0,
|
|
2394
|
+
runId: e.assistantDraftRunId ?? void 0,
|
|
2395
|
+
dataType: "assistant_draft"
|
|
2396
|
+
};
|
|
2397
|
+
if (!t.respondsToUserMessageId)
|
|
2398
|
+
return [...e.messages, t];
|
|
2399
|
+
const n = e.messages.findIndex(
|
|
2400
|
+
(i) => i.role === "user" && i.id === t.respondsToUserMessageId
|
|
2401
|
+
);
|
|
2402
|
+
if (n === -1)
|
|
2403
|
+
return [...e.messages, t];
|
|
2404
|
+
const o = e.messages.findIndex(
|
|
2405
|
+
(i, l) => l > n && i.role !== "user" && i.respondsToUserMessageId === t.respondsToUserMessageId && Xt(i, t) && st(i)
|
|
2406
|
+
);
|
|
2407
|
+
if (o !== -1)
|
|
2408
|
+
return [
|
|
2409
|
+
...e.messages.slice(0, o),
|
|
2410
|
+
t,
|
|
2411
|
+
...e.messages.slice(o + 1)
|
|
2412
|
+
];
|
|
2413
|
+
let a = n + 1;
|
|
2414
|
+
for (; a < e.messages.length && e.messages[a].role !== "user" && e.messages[a].respondsToUserMessageId === t.respondsToUserMessageId && Xt(e.messages[a], t); )
|
|
2415
|
+
a += 1;
|
|
2416
|
+
return [
|
|
2417
|
+
...e.messages.slice(0, a),
|
|
2418
|
+
t,
|
|
2419
|
+
...e.messages.slice(a)
|
|
2420
|
+
];
|
|
2421
|
+
}
|
|
2422
|
+
function st(e) {
|
|
2423
|
+
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2424
|
+
}
|
|
2425
|
+
function Xt(e, t) {
|
|
2426
|
+
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2427
|
+
}
|
|
2428
|
+
function Zt(e, t, n, o, a, i, l, p) {
|
|
2386
2429
|
e.replaceChildren(), Sn(t, !1), t.disabled = !0, n(!1);
|
|
2387
2430
|
const c = document.createElement("div");
|
|
2388
2431
|
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
@@ -2401,20 +2444,20 @@ function Kt(e, t, n, o, a, i, l, p) {
|
|
|
2401
2444
|
}
|
|
2402
2445
|
e.appendChild(c);
|
|
2403
2446
|
}
|
|
2404
|
-
function
|
|
2447
|
+
function za(e) {
|
|
2405
2448
|
const t = document.createElement("div");
|
|
2406
2449
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2407
2450
|
for (const n of e)
|
|
2408
2451
|
t.appendChild(Ea(n));
|
|
2409
2452
|
return t;
|
|
2410
2453
|
}
|
|
2411
|
-
function
|
|
2454
|
+
function Ga(e) {
|
|
2412
2455
|
const t = document.createElement("button");
|
|
2413
2456
|
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ya()), t.addEventListener("click", (n) => {
|
|
2414
2457
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2415
2458
|
}), t;
|
|
2416
2459
|
}
|
|
2417
|
-
function
|
|
2460
|
+
function Ha(e, t) {
|
|
2418
2461
|
const n = document.createElement("article");
|
|
2419
2462
|
n.className = "pluno-pa-widget__share-prompt";
|
|
2420
2463
|
const o = document.createElement("div");
|
|
@@ -2441,7 +2484,7 @@ function za(e, t) {
|
|
|
2441
2484
|
const u = document.createElement("button");
|
|
2442
2485
|
if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
|
|
2443
2486
|
t.onDraft(e);
|
|
2444
|
-
}), t.isDrafting ? (u.appendChild(
|
|
2487
|
+
}), t.isDrafting ? (u.appendChild(ct()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
|
|
2445
2488
|
p.appendChild(c);
|
|
2446
2489
|
else {
|
|
2447
2490
|
const s = document.createElement("button");
|
|
@@ -2455,7 +2498,7 @@ function za(e, t) {
|
|
|
2455
2498
|
}
|
|
2456
2499
|
return o.appendChild(p), n.appendChild(o), n;
|
|
2457
2500
|
}
|
|
2458
|
-
function
|
|
2501
|
+
function Wa(e, t) {
|
|
2459
2502
|
const n = document.createElement("div");
|
|
2460
2503
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
|
|
2461
2504
|
y.target === n && t.onClose();
|
|
@@ -2474,7 +2517,7 @@ function Ha(e, t) {
|
|
|
2474
2517
|
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2475
2518
|
const s = document.createElement("strong");
|
|
2476
2519
|
s.textContent = "1) Copy Screenshot", u.appendChild(s);
|
|
2477
|
-
const b =
|
|
2520
|
+
const b = $a(
|
|
2478
2521
|
"Copy Screenshot",
|
|
2479
2522
|
async () => {
|
|
2480
2523
|
try {
|
|
@@ -2491,35 +2534,35 @@ function Ha(e, t) {
|
|
|
2491
2534
|
C.src = e.screenshotDataUrl, C.alt = "Product page with Pluno open", y.appendChild(C), c.appendChild(y);
|
|
2492
2535
|
}
|
|
2493
2536
|
o.appendChild(c), o.appendChild(p);
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2537
|
+
const w = document.createElement("div");
|
|
2538
|
+
w.className = "pluno-pa-widget__share-dialog-step";
|
|
2496
2539
|
const P = document.createElement("strong");
|
|
2497
|
-
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on",
|
|
2498
|
-
const
|
|
2499
|
-
|
|
2500
|
-
const
|
|
2501
|
-
|
|
2502
|
-
for (const y of
|
|
2540
|
+
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", w.appendChild(P);
|
|
2541
|
+
const L = document.createElement("p");
|
|
2542
|
+
L.className = "pluno-pa-widget__share-dialog-hint", L.textContent = "Post draft opens prefilled on supported platforms.", w.appendChild(L);
|
|
2543
|
+
const R = document.createElement("footer");
|
|
2544
|
+
R.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2545
|
+
for (const y of qa(e)) {
|
|
2503
2546
|
const C = document.createElement("a");
|
|
2504
|
-
C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(
|
|
2547
|
+
C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(ja(y.id)), R.appendChild(C);
|
|
2505
2548
|
}
|
|
2506
|
-
if (
|
|
2549
|
+
if (w.appendChild(R), o.appendChild(w), t.socialPostRewardsUrl) {
|
|
2507
2550
|
const y = document.createElement("div");
|
|
2508
2551
|
y.className = "pluno-pa-widget__share-dialog-step";
|
|
2509
2552
|
const C = document.createElement("strong");
|
|
2510
2553
|
C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
|
|
2511
2554
|
const h = document.createElement("a");
|
|
2512
|
-
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(
|
|
2555
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Va()), y.appendChild(h), o.appendChild(y);
|
|
2513
2556
|
}
|
|
2514
2557
|
return n.appendChild(o), n;
|
|
2515
2558
|
}
|
|
2516
|
-
function
|
|
2559
|
+
function $a(e, t) {
|
|
2517
2560
|
const n = document.createElement("button");
|
|
2518
2561
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
2519
2562
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
2520
2563
|
}), n;
|
|
2521
2564
|
}
|
|
2522
|
-
function
|
|
2565
|
+
function qa(e) {
|
|
2523
2566
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
2524
2567
|
return [
|
|
2525
2568
|
{
|
|
@@ -2539,36 +2582,36 @@ function Wa(e) {
|
|
|
2539
2582
|
}
|
|
2540
2583
|
];
|
|
2541
2584
|
}
|
|
2542
|
-
function
|
|
2585
|
+
function ja(e) {
|
|
2543
2586
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2544
|
-
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (
|
|
2587
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(
|
|
2545
2588
|
t,
|
|
2546
2589
|
"M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"
|
|
2547
|
-
),
|
|
2590
|
+
), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
|
|
2548
2591
|
t,
|
|
2549
2592
|
"M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"
|
|
2550
|
-
),
|
|
2593
|
+
), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(
|
|
2551
2594
|
t,
|
|
2552
2595
|
"M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"
|
|
2553
|
-
),
|
|
2596
|
+
), B(
|
|
2554
2597
|
t,
|
|
2555
2598
|
"M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1",
|
|
2556
2599
|
"0.48"
|
|
2557
|
-
),
|
|
2600
|
+
), B(
|
|
2558
2601
|
t,
|
|
2559
2602
|
"M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"
|
|
2560
|
-
),
|
|
2603
|
+
), B(
|
|
2561
2604
|
t,
|
|
2562
2605
|
"M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"
|
|
2563
2606
|
), t);
|
|
2564
2607
|
}
|
|
2565
|
-
function
|
|
2608
|
+
function B(e, t, n) {
|
|
2566
2609
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2567
2610
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
2568
2611
|
}
|
|
2569
|
-
function
|
|
2612
|
+
function Va() {
|
|
2570
2613
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2571
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
2614
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(
|
|
2572
2615
|
e,
|
|
2573
2616
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
2574
2617
|
), e;
|
|
@@ -2576,10 +2619,10 @@ function qa() {
|
|
|
2576
2619
|
function Cn(e) {
|
|
2577
2620
|
return e.role === "tool" && e.toolName === rn;
|
|
2578
2621
|
}
|
|
2579
|
-
function
|
|
2622
|
+
function Ya(e) {
|
|
2580
2623
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
2581
2624
|
}
|
|
2582
|
-
function
|
|
2625
|
+
function Ka(e, t, n, o) {
|
|
2583
2626
|
const a = document.createElement("article");
|
|
2584
2627
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(
|
|
2585
2628
|
e[e.length - 1].createdAt
|
|
@@ -2589,27 +2632,27 @@ function ja(e, t, n, o) {
|
|
|
2589
2632
|
o
|
|
2590
2633
|
)
|
|
2591
2634
|
);
|
|
2592
|
-
const i = document.createElement("details"), l =
|
|
2635
|
+
const i = document.createElement("details"), l = Xa(e);
|
|
2593
2636
|
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
2594
2637
|
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
2595
2638
|
});
|
|
2596
2639
|
const p = document.createElement("summary");
|
|
2597
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(
|
|
2640
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(ct());
|
|
2598
2641
|
const u = document.createElement("span");
|
|
2599
2642
|
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), i.appendChild(p), e.length > 0) {
|
|
2600
2643
|
const s = document.createElement("div");
|
|
2601
2644
|
s.className = "pluno-pa-widget__tool-lines";
|
|
2602
2645
|
for (const b of e) {
|
|
2603
|
-
const
|
|
2604
|
-
|
|
2646
|
+
const w = document.createElement("div");
|
|
2647
|
+
w.className = "pluno-pa-widget__tool-line", b.loading && w.appendChild(ct());
|
|
2605
2648
|
const P = document.createElement("span");
|
|
2606
|
-
P.textContent = b.content || "Run tool",
|
|
2649
|
+
P.textContent = b.content || "Run tool", w.appendChild(P), s.appendChild(w);
|
|
2607
2650
|
}
|
|
2608
2651
|
i.appendChild(s);
|
|
2609
2652
|
}
|
|
2610
2653
|
return a.appendChild(i), a;
|
|
2611
2654
|
}
|
|
2612
|
-
function
|
|
2655
|
+
function En(e) {
|
|
2613
2656
|
const t = document.createElement("article");
|
|
2614
2657
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
2615
2658
|
re(
|
|
@@ -2618,11 +2661,11 @@ function st(e) {
|
|
|
2618
2661
|
)
|
|
2619
2662
|
), t;
|
|
2620
2663
|
}
|
|
2621
|
-
function
|
|
2622
|
-
const t =
|
|
2623
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
2664
|
+
function Jt(e) {
|
|
2665
|
+
const t = En(e);
|
|
2666
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(dt()), t;
|
|
2624
2667
|
}
|
|
2625
|
-
function
|
|
2668
|
+
function dt() {
|
|
2626
2669
|
const e = document.createElement("div");
|
|
2627
2670
|
e.className = "pluno-pa-widget__status";
|
|
2628
2671
|
const t = document.createElement("span");
|
|
@@ -2630,17 +2673,17 @@ function En() {
|
|
|
2630
2673
|
const n = document.createElement("span");
|
|
2631
2674
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
2632
2675
|
}
|
|
2633
|
-
function
|
|
2676
|
+
function Xa(e) {
|
|
2634
2677
|
return `tools:${e[0]?.id ?? ""}`;
|
|
2635
2678
|
}
|
|
2636
|
-
function
|
|
2679
|
+
function ct() {
|
|
2637
2680
|
const e = document.createElement("span");
|
|
2638
2681
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2639
2682
|
}
|
|
2640
2683
|
function Sn(e, t) {
|
|
2641
2684
|
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? _a() : _n());
|
|
2642
2685
|
}
|
|
2643
|
-
function
|
|
2686
|
+
function Za(e, t) {
|
|
2644
2687
|
const n = t.replace(/\r\n/g, `
|
|
2645
2688
|
`).split(`
|
|
2646
2689
|
`);
|
|
@@ -2714,7 +2757,7 @@ function Be(e, t) {
|
|
|
2714
2757
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
2715
2758
|
} else {
|
|
2716
2759
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
2717
|
-
if (p &&
|
|
2760
|
+
if (p && Ja(p[2])) {
|
|
2718
2761
|
const c = document.createElement("a");
|
|
2719
2762
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
2720
2763
|
} else
|
|
@@ -2724,7 +2767,7 @@ function Be(e, t) {
|
|
|
2724
2767
|
}
|
|
2725
2768
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
2726
2769
|
}
|
|
2727
|
-
function
|
|
2770
|
+
function Ja(e) {
|
|
2728
2771
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
2729
2772
|
return !0;
|
|
2730
2773
|
try {
|
|
@@ -2735,7 +2778,7 @@ function Ka(e) {
|
|
|
2735
2778
|
}
|
|
2736
2779
|
}
|
|
2737
2780
|
function Qt(e, t) {
|
|
2738
|
-
if (
|
|
2781
|
+
if (Qa(e))
|
|
2739
2782
|
return;
|
|
2740
2783
|
const n = `
|
|
2741
2784
|
:host {
|
|
@@ -3041,7 +3084,7 @@ function Qt(e, t) {
|
|
|
3041
3084
|
flex-direction: column;
|
|
3042
3085
|
gap: 14px;
|
|
3043
3086
|
overflow: auto;
|
|
3044
|
-
padding:
|
|
3087
|
+
padding: 56px 14px 12px;
|
|
3045
3088
|
min-height: 0;
|
|
3046
3089
|
scrollbar-color: var(--pluno-pa-divider) transparent;
|
|
3047
3090
|
scrollbar-width: thin;
|
|
@@ -4422,9 +4465,6 @@ function Qt(e, t) {
|
|
|
4422
4465
|
z-index: 3;
|
|
4423
4466
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
4424
4467
|
}
|
|
4425
|
-
.pluno-pa-widget--scribble .pluno-pa-widget__timeline {
|
|
4426
|
-
padding-top: 34px;
|
|
4427
|
-
}
|
|
4428
4468
|
/* The top text fade paints a square-cornered bg gradient; with the panel
|
|
4429
4469
|
overflow visible for the spiral it would poke past the rounded border */
|
|
4430
4470
|
.pluno-pa-widget--scribble .pluno-pa-widget__timeline-wrap::before {
|
|
@@ -4721,18 +4761,18 @@ function Qt(e, t) {
|
|
|
4721
4761
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
4722
4762
|
}
|
|
4723
4763
|
`;
|
|
4724
|
-
if (
|
|
4764
|
+
if (ei(e, n))
|
|
4725
4765
|
return;
|
|
4726
4766
|
const o = e.ownerDocument.createElement("style");
|
|
4727
4767
|
o.id = gn, o.textContent = n, e.appendChild(o), kn(e);
|
|
4728
4768
|
}
|
|
4729
|
-
function
|
|
4769
|
+
function Qa(e) {
|
|
4730
4770
|
return e.getElementById(gn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(hn) === "true";
|
|
4731
4771
|
}
|
|
4732
4772
|
function kn(e) {
|
|
4733
4773
|
e.host instanceof HTMLElement && e.host.setAttribute(hn, "true");
|
|
4734
4774
|
}
|
|
4735
|
-
function
|
|
4775
|
+
function ei(e, t) {
|
|
4736
4776
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
4737
4777
|
return !1;
|
|
4738
4778
|
try {
|
|
@@ -4742,7 +4782,7 @@ function Za(e, t) {
|
|
|
4742
4782
|
return !1;
|
|
4743
4783
|
}
|
|
4744
4784
|
}
|
|
4745
|
-
async function
|
|
4785
|
+
async function ti() {
|
|
4746
4786
|
return document.body ? document.body : await new Promise((e) => {
|
|
4747
4787
|
const t = new MutationObserver(() => {
|
|
4748
4788
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -4753,7 +4793,7 @@ async function Ja() {
|
|
|
4753
4793
|
function Ln(e) {
|
|
4754
4794
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
4755
4795
|
}
|
|
4756
|
-
function
|
|
4796
|
+
function ni(e) {
|
|
4757
4797
|
try {
|
|
4758
4798
|
const t = window.localStorage.getItem(Ln(e));
|
|
4759
4799
|
if (!t)
|
|
@@ -4765,7 +4805,7 @@ function Qa(e) {
|
|
|
4765
4805
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
4766
4806
|
(o) => typeof o == "string"
|
|
4767
4807
|
) : [],
|
|
4768
|
-
launcherPosition:
|
|
4808
|
+
launcherPosition: ri(n.launcherPosition) ? n.launcherPosition : null,
|
|
4769
4809
|
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ln) : [],
|
|
4770
4810
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
4771
4811
|
};
|
|
@@ -4773,7 +4813,7 @@ function Qa(e) {
|
|
|
4773
4813
|
return en();
|
|
4774
4814
|
}
|
|
4775
4815
|
}
|
|
4776
|
-
async function
|
|
4816
|
+
async function oi(e) {
|
|
4777
4817
|
if (e.loadSharePromptsDisabled)
|
|
4778
4818
|
return e.loadSharePromptsDisabled();
|
|
4779
4819
|
try {
|
|
@@ -4782,7 +4822,7 @@ async function ei(e) {
|
|
|
4782
4822
|
return !1;
|
|
4783
4823
|
}
|
|
4784
4824
|
}
|
|
4785
|
-
function
|
|
4825
|
+
function ai(e, t) {
|
|
4786
4826
|
if (e.persistSharePromptsDisabled) {
|
|
4787
4827
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
4788
4828
|
() => {
|
|
@@ -4806,7 +4846,7 @@ function en() {
|
|
|
4806
4846
|
sharePromptsDisabled: !1
|
|
4807
4847
|
};
|
|
4808
4848
|
}
|
|
4809
|
-
function
|
|
4849
|
+
function ii(e, t) {
|
|
4810
4850
|
try {
|
|
4811
4851
|
window.localStorage.setItem(
|
|
4812
4852
|
Ln(e),
|
|
@@ -4816,38 +4856,38 @@ function ni(e, t) {
|
|
|
4816
4856
|
return;
|
|
4817
4857
|
}
|
|
4818
4858
|
}
|
|
4819
|
-
function
|
|
4859
|
+
function ri(e) {
|
|
4820
4860
|
if (!e || typeof e != "object")
|
|
4821
4861
|
return !1;
|
|
4822
4862
|
const t = e;
|
|
4823
4863
|
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");
|
|
4824
4864
|
}
|
|
4825
4865
|
const tn = /* @__PURE__ */ new WeakSet();
|
|
4826
|
-
function
|
|
4866
|
+
function li(e) {
|
|
4827
4867
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
4828
4868
|
}
|
|
4829
4869
|
function nn(e) {
|
|
4830
4870
|
const t = e.pathname.split("/");
|
|
4831
4871
|
return t[t.length - 1] ?? "";
|
|
4832
4872
|
}
|
|
4833
|
-
function
|
|
4873
|
+
function pi(e, t) {
|
|
4834
4874
|
const n = new URL(e.src, document.baseURI);
|
|
4835
4875
|
return n.href === t.href || n.pathname === t.pathname ? !0 : nn(n) === nn(t);
|
|
4836
4876
|
}
|
|
4837
|
-
class
|
|
4877
|
+
class ee extends EventTarget {
|
|
4838
4878
|
constructor(t, n) {
|
|
4839
4879
|
super(), this.channelId = n, this.url = t, this.addPreviewListener(uo, () => {
|
|
4840
|
-
this.readyState =
|
|
4880
|
+
this.readyState = ee.OPEN, this.dispatchEvent(new Event("open"));
|
|
4841
4881
|
}), this.addPreviewListener(go, (o) => {
|
|
4842
4882
|
const a = o;
|
|
4843
4883
|
this.dispatchEvent(
|
|
4844
4884
|
new MessageEvent("message", { data: a.detail?.data ?? "" })
|
|
4845
4885
|
);
|
|
4846
4886
|
}), this.addPreviewListener(ho, () => {
|
|
4847
|
-
this.readyState =
|
|
4887
|
+
this.readyState = ee.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
4848
4888
|
}), this.addPreviewListener(mo, (o) => {
|
|
4849
4889
|
const a = o;
|
|
4850
|
-
this.readyState =
|
|
4890
|
+
this.readyState = ee.CLOSED, this.dispatchEvent(
|
|
4851
4891
|
new CloseEvent("close", {
|
|
4852
4892
|
code: a.detail?.code ?? 1e3,
|
|
4853
4893
|
reason: a.detail?.reason ?? "",
|
|
@@ -4876,11 +4916,11 @@ class te extends EventTarget {
|
|
|
4876
4916
|
extensions = "";
|
|
4877
4917
|
binaryType = "blob";
|
|
4878
4918
|
bufferedAmount = 0;
|
|
4879
|
-
readyState =
|
|
4880
|
-
socketId =
|
|
4919
|
+
readyState = ee.CONNECTING;
|
|
4920
|
+
socketId = si();
|
|
4881
4921
|
listeners = /* @__PURE__ */ new Map();
|
|
4882
4922
|
send(t) {
|
|
4883
|
-
if (this.readyState !==
|
|
4923
|
+
if (this.readyState !== ee.OPEN)
|
|
4884
4924
|
throw new DOMException(
|
|
4885
4925
|
"Pluno preview websocket is not open",
|
|
4886
4926
|
"InvalidStateError"
|
|
@@ -4898,7 +4938,7 @@ class te extends EventTarget {
|
|
|
4898
4938
|
);
|
|
4899
4939
|
}
|
|
4900
4940
|
close(t, n) {
|
|
4901
|
-
this.readyState !==
|
|
4941
|
+
this.readyState !== ee.CLOSED && (this.readyState = ee.CLOSING, window.dispatchEvent(
|
|
4902
4942
|
new CustomEvent(
|
|
4903
4943
|
Oe(co, this.channelId),
|
|
4904
4944
|
{
|
|
@@ -4922,7 +4962,7 @@ class te extends EventTarget {
|
|
|
4922
4962
|
this.listeners.clear();
|
|
4923
4963
|
}
|
|
4924
4964
|
}
|
|
4925
|
-
function
|
|
4965
|
+
function si() {
|
|
4926
4966
|
const e = window.sessionStorage.getItem(
|
|
4927
4967
|
Nt
|
|
4928
4968
|
);
|
|
@@ -4934,7 +4974,7 @@ function ri() {
|
|
|
4934
4974
|
function Oe(e, t) {
|
|
4935
4975
|
return `${e}:${t}`;
|
|
4936
4976
|
}
|
|
4937
|
-
function
|
|
4977
|
+
function di(e) {
|
|
4938
4978
|
const t = document.currentScript;
|
|
4939
4979
|
if (t instanceof HTMLScriptElement)
|
|
4940
4980
|
return [t];
|
|
@@ -4942,11 +4982,11 @@ function li(e) {
|
|
|
4942
4982
|
return Array.from(
|
|
4943
4983
|
document.querySelectorAll("script[type='module'][src]")
|
|
4944
4984
|
).filter(
|
|
4945
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
4985
|
+
(a) => a instanceof HTMLScriptElement && li(a) && pi(a, o)
|
|
4946
4986
|
);
|
|
4947
4987
|
}
|
|
4948
|
-
function
|
|
4949
|
-
for (const t of
|
|
4988
|
+
function ci(e) {
|
|
4989
|
+
for (const t of di(e)) {
|
|
4950
4990
|
if (tn.has(t) || t.dataset.plunoAutoMount === "false")
|
|
4951
4991
|
continue;
|
|
4952
4992
|
tn.add(t);
|
|
@@ -4967,7 +5007,7 @@ function pi(e) {
|
|
|
4967
5007
|
});
|
|
4968
5008
|
}
|
|
4969
5009
|
}
|
|
4970
|
-
|
|
5010
|
+
ci(import.meta.url);
|
|
4971
5011
|
export {
|
|
4972
5012
|
Bo as createProductAgentPreviewBridgeWebSocketFactory,
|
|
4973
5013
|
Oo as mountPlunoProductAgentWidget
|