@pluno/product-agent-web 0.1.100 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +330 -314
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PlunoProductAgent as wi, getProductAgentOriginAccessErrorMessage as bi } from "./product-agent-sdk.js";
|
|
2
|
-
const _i = "#7c3aed", vt = "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",
|
|
2
|
+
const _i = "#7c3aed", vt = "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", St = "#2c2a1e", Un = [253, 250, 241], Bn = 3.5;
|
|
3
3
|
function vo(e) {
|
|
4
|
-
const t =
|
|
5
|
-
if (Fn(
|
|
4
|
+
const t = So(e);
|
|
5
|
+
if (Fn(lt(t), Un) >= Bn)
|
|
6
6
|
return t;
|
|
7
|
-
let i =
|
|
8
|
-
const o =
|
|
7
|
+
let i = lt(t);
|
|
8
|
+
const o = lt(St);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
10
|
if (i = vi(i, o, 0.22), Fn(i, Un) >= Bn)
|
|
11
11
|
return rn(i);
|
|
@@ -20,7 +20,7 @@ function xi() {
|
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
22
|
function yi(e) {
|
|
23
|
-
const t =
|
|
23
|
+
const t = So(e), n = ln(lt(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,11 +56,11 @@ function yi(e) {
|
|
|
56
56
|
shadow: se(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function So(e) {
|
|
60
60
|
const t = e.trim();
|
|
61
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()}` : _i;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function lt(e) {
|
|
64
64
|
return [
|
|
65
65
|
Number.parseInt(e.slice(1, 3), 16),
|
|
66
66
|
Number.parseInt(e.slice(3, 5), 16),
|
|
@@ -91,17 +91,17 @@ function vi(e, t, n) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function se(e, t, n) {
|
|
94
|
-
const [i, o, r] =
|
|
95
|
-
return rn(
|
|
94
|
+
const [i, o, r] = Si(lt(e));
|
|
95
|
+
return rn(Ci(i, sn(o + n), sn(r + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Si([e, t, n]) {
|
|
98
98
|
const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), s = Math.min(i, o, r), p = (l + s) / 2;
|
|
99
99
|
if (l === s)
|
|
100
100
|
return [0, 0, p];
|
|
101
101
|
const g = l - s, c = p > 0.5 ? g / (2 - l - s) : g / (l + s);
|
|
102
102
|
return [(l === i ? (o - r) / g + (o < r ? 6 : 0) : l === o ? (r - i) / g + 2 : (i - o) / g + 4) / 6, c, p];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Ci(e, t, n) {
|
|
105
105
|
if (t === 0)
|
|
106
106
|
return [n * 255, n * 255, n * 255];
|
|
107
107
|
const i = n < 0.5 ? n * (1 + t) : n + t - n * t, o = 2 * n - i;
|
|
@@ -118,11 +118,11 @@ function Kt(e, t, n) {
|
|
|
118
118
|
function sn(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const Co = "suggest_share_on_socials";
|
|
122
122
|
function Ei(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const n = e[t];
|
|
125
|
-
if (n.role !== "tool" || n.toolName !==
|
|
125
|
+
if (n.role !== "tool" || n.toolName !== Co)
|
|
126
126
|
continue;
|
|
127
127
|
const i = Wn(e, t, "assistant");
|
|
128
128
|
if (!i)
|
|
@@ -153,7 +153,7 @@ function Wn(e, t, n) {
|
|
|
153
153
|
async function Li(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const Pi = "https://app.pluno.ai", Ti = "/api/product-agent/embed/active-users",
|
|
156
|
+
const Pi = "https://app.pluno.ai", Ti = "/api/product-agent/embed/active-users", Ni = 1800, Ai = 15e3, Ii = 250, Ri = 1e3, Di = 3e4;
|
|
157
157
|
function zi(e, t = {}) {
|
|
158
158
|
let n = !1, i = null, o = null, r = null;
|
|
159
159
|
const l = () => {
|
|
@@ -173,9 +173,9 @@ function zi(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const P = Math.min(1, (performance.now() - E) /
|
|
176
|
+
const P = Math.min(1, (performance.now() - E) / Ni);
|
|
177
177
|
i = Math.round(h + (c - h) * Bi(P)), e(i), P >= 1 && (i = c, e(c), l());
|
|
178
|
-
},
|
|
178
|
+
}, Ii);
|
|
179
179
|
}, g = async () => {
|
|
180
180
|
try {
|
|
181
181
|
const c = await Mi(t);
|
|
@@ -183,7 +183,7 @@ function zi(e, t = {}) {
|
|
|
183
183
|
return;
|
|
184
184
|
p(c.count), s(c.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
s(
|
|
186
|
+
s(Ai);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return g(), () => {
|
|
@@ -316,7 +316,7 @@ const Eo = 100, Yi = 1e4, Xi = 5e3, Zi = "product-agent:sdk-preview-socket-conne
|
|
|
316
316
|
scribbleStyle: !0,
|
|
317
317
|
position: "bottom-right",
|
|
318
318
|
movableLauncher: !0
|
|
319
|
-
}, ha = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Yn = "pluno-pa-scribble-font", Po = 190, To = 41, Xn = 22, ma = 1, fa = 48, bn = 420, wa = 520, ba = 0.24, _n = 680, _a = 800, xa = 0.76,
|
|
319
|
+
}, ha = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Yn = "pluno-pa-scribble-font", Po = 190, To = 41, Xn = 22, ma = 1, fa = 48, bn = 420, wa = 520, ba = 0.24, _n = 680, _a = 800, xa = 0.76, A = 8, Ie = 50, No = "http://www.w3.org/2000/svg", pn = 26, dn = 8, ya = 36, cn = 16, va = 4, Zn = [
|
|
320
320
|
{
|
|
321
321
|
ellipseCx: "17.5",
|
|
322
322
|
ellipseCy: "24.5",
|
|
@@ -353,7 +353,7 @@ const Eo = 100, Yi = 1e4, Xi = 5e3, Zi = "product-agent:sdk-preview-socket-conne
|
|
|
353
353
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
354
354
|
pathStrokeWidth: "2.45"
|
|
355
355
|
}
|
|
356
|
-
],
|
|
356
|
+
], Sa = 11, Ca = 13, un = 4, Ao = 10, Io = 40, Ea = "movable-launcher-position-v2", Ro = "pluno-pa-widget-styles", Do = "data-pluno-pa-widget-styles";
|
|
357
357
|
let Jn = 0;
|
|
358
358
|
function ka(e) {
|
|
359
359
|
return (t) => new be(t, e);
|
|
@@ -447,7 +447,7 @@ async function La(e = {}) {
|
|
|
447
447
|
const l = Kr(t), s = t.layout === "floating" ? t.initialDisplayState ?? jr(t) : "shown";
|
|
448
448
|
bo(t, s);
|
|
449
449
|
let p = t.movableLauncher ? l.launcherPosition : null, g = p !== null, c = l.panelSize, h = null;
|
|
450
|
-
o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), s === "minimized" && (o.classList.add("pluno-pa-widget--minimized"),
|
|
450
|
+
o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), s === "minimized" && (o.classList.add("pluno-pa-widget--minimized"), Ae(
|
|
451
451
|
o,
|
|
452
452
|
Zt(
|
|
453
453
|
o,
|
|
@@ -466,9 +466,9 @@ async function La(e = {}) {
|
|
|
466
466
|
".pluno-pa-widget__launcher-drag-handle"
|
|
467
467
|
), u = o.querySelector(
|
|
468
468
|
".pluno-pa-widget__launcher-input"
|
|
469
|
-
),
|
|
469
|
+
), S = o.querySelector(
|
|
470
470
|
".pluno-pa-widget__launcher-minimize"
|
|
471
|
-
), m = o.querySelector(".pluno-pa-widget__panel"),
|
|
471
|
+
), m = o.querySelector(".pluno-pa-widget__panel"), I = o.querySelector(
|
|
472
472
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
473
473
|
), L = Array.from(
|
|
474
474
|
o.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
@@ -478,9 +478,9 @@ async function La(e = {}) {
|
|
|
478
478
|
".pluno-pa-widget__composer"
|
|
479
479
|
), ue = o.querySelector(
|
|
480
480
|
".pluno-pa-widget__attachment-error"
|
|
481
|
-
),
|
|
481
|
+
), Ce = o.querySelector(
|
|
482
482
|
".pluno-pa-widget__billing-status"
|
|
483
|
-
),
|
|
483
|
+
), Ve = o.querySelector(
|
|
484
484
|
".pluno-pa-widget__attachments"
|
|
485
485
|
), D = o.querySelector(
|
|
486
486
|
".pluno-pa-widget__attachment-input"
|
|
@@ -494,11 +494,11 @@ async function La(e = {}) {
|
|
|
494
494
|
".pluno-pa-widget__top-actions"
|
|
495
495
|
), re = o.querySelector(
|
|
496
496
|
".pluno-pa-widget__history"
|
|
497
|
-
),
|
|
497
|
+
), Ke = o.querySelector(
|
|
498
498
|
".pluno-pa-widget__history-panel"
|
|
499
499
|
), H = o.querySelector(
|
|
500
500
|
".pluno-pa-widget__history-list"
|
|
501
|
-
),
|
|
501
|
+
), st = o.querySelector(
|
|
502
502
|
".pluno-pa-widget__history-close"
|
|
503
503
|
), De = o.querySelector(
|
|
504
504
|
".pluno-pa-widget__history-status"
|
|
@@ -516,7 +516,7 @@ async function La(e = {}) {
|
|
|
516
516
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
517
517
|
), v = o.querySelector(
|
|
518
518
|
".pluno-pa-widget__notify-suggestion-later"
|
|
519
|
-
),
|
|
519
|
+
), N = o.querySelector(
|
|
520
520
|
".pluno-pa-widget__notify-suggestion-never"
|
|
521
521
|
), ze = o.querySelector(
|
|
522
522
|
".pluno-pa-widget__tab-groups-suggestion"
|
|
@@ -525,7 +525,7 @@ async function La(e = {}) {
|
|
|
525
525
|
), Qo = o.querySelector(
|
|
526
526
|
".pluno-pa-widget__tab-groups-suggestion-dismiss"
|
|
527
527
|
);
|
|
528
|
-
if (!T || !u || !m || !R || !U || !ue || !
|
|
528
|
+
if (!T || !u || !m || !R || !U || !ue || !Ce || !Ve || !D || !Re || !f || !O || !Ee || !re || !Ke || !H || !st || !De || !le || !_ || !y || !j)
|
|
529
529
|
throw new Error("Failed to mount Pluno widget");
|
|
530
530
|
if (t.movableLauncher && !M)
|
|
531
531
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
@@ -536,7 +536,7 @@ async function La(e = {}) {
|
|
|
536
536
|
o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !ae(t.billingStatus)
|
|
537
537
|
), Me = () => {
|
|
538
538
|
fr(
|
|
539
|
-
|
|
539
|
+
Ve,
|
|
540
540
|
G,
|
|
541
541
|
(a) => {
|
|
542
542
|
G = G.filter(
|
|
@@ -544,15 +544,15 @@ async function La(e = {}) {
|
|
|
544
544
|
), Me(), W(b.getState()), $(), _e();
|
|
545
545
|
}
|
|
546
546
|
);
|
|
547
|
-
},
|
|
548
|
-
if (!t.loginRequired && !t.signupRequired && !t.token && !
|
|
547
|
+
}, Sn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Xo(t.tokenEndpoint) : void 0);
|
|
548
|
+
if (!t.loginRequired && !t.signupRequired && !t.token && !Sn && !t.webSocketFactory)
|
|
549
549
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
550
550
|
const ei = window.fetch.bind(window), Pt = Vr(t.clientId);
|
|
551
551
|
let b;
|
|
552
552
|
try {
|
|
553
553
|
const a = {
|
|
554
554
|
token: t.token,
|
|
555
|
-
tokenProvider:
|
|
555
|
+
tokenProvider: Sn,
|
|
556
556
|
backendUrl: t.backendUrl,
|
|
557
557
|
metadata: () => ({
|
|
558
558
|
...t.metadata ?? {},
|
|
@@ -586,10 +586,10 @@ async function La(e = {}) {
|
|
|
586
586
|
);
|
|
587
587
|
const Tt = new Set(l.openToolGroupKeys), Oe = new Set(
|
|
588
588
|
l.seenShareCandidateIds
|
|
589
|
-
),
|
|
590
|
-
let
|
|
589
|
+
), pt = new Set(Oe);
|
|
590
|
+
let Nt = l.sharePromptsDisabled || await Yr(t), te = null, Y = !1, dt = !(t.loginRequired || t.signupRequired), xe = !1, ke = {
|
|
591
591
|
enabled: !0
|
|
592
|
-
}, Le = 0,
|
|
592
|
+
}, Le = 0, Cn = "", V = !1, he = !1, ye = [], At = null, Ye = null;
|
|
593
593
|
const ne = (a, d) => {
|
|
594
594
|
ke = { enabled: a, reason: d };
|
|
595
595
|
}, oe = () => {
|
|
@@ -597,9 +597,9 @@ async function La(e = {}) {
|
|
|
597
597
|
}, ti = () => {
|
|
598
598
|
le.hidden = !1;
|
|
599
599
|
}, ni = (a = "jump") => {
|
|
600
|
-
ne(!0, a), oe(),
|
|
600
|
+
ne(!0, a), oe(), rt(y, () => ke.enabled), Le = y.scrollTop;
|
|
601
601
|
}, me = () => {
|
|
602
|
-
if (re.hidden = t.layout === "page" || t.loginRequired,
|
|
602
|
+
if (re.hidden = t.layout === "page" || t.loginRequired, Ke.hidden = !V, re.setAttribute("aria-expanded", String(V)), H.classList.toggle(
|
|
603
603
|
"pluno-pa-widget__history-list--center",
|
|
604
604
|
he && ye.length === 0
|
|
605
605
|
), H.replaceChildren(), he && ye.length === 0) {
|
|
@@ -611,27 +611,27 @@ async function La(e = {}) {
|
|
|
611
611
|
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = he;
|
|
612
612
|
const x = document.createElement("span");
|
|
613
613
|
x.className = "pluno-pa-widget__history-item-title", x.textContent = Va(a);
|
|
614
|
-
const
|
|
615
|
-
|
|
614
|
+
const C = document.createElement("time");
|
|
615
|
+
C.className = "pluno-pa-widget__history-time", C.dateTime = a.lastActiveAt, C.textContent = Ya(
|
|
616
616
|
a.lastActiveAt,
|
|
617
617
|
Date.now()
|
|
618
618
|
);
|
|
619
619
|
const z = document.createElement("small");
|
|
620
|
-
z.className = "pluno-pa-widget__history-path", z.textContent = Ka(a), d.append(x,
|
|
621
|
-
V = !1,
|
|
620
|
+
z.className = "pluno-pa-widget__history-path", z.textContent = Ka(a), d.append(x, C, z), d.addEventListener("click", () => {
|
|
621
|
+
V = !1, Ye = null, me(), ne(!0, "newSession"), oe(), b.loadSession(a.id), W(b.getState()), _e();
|
|
622
622
|
}), H.appendChild(d);
|
|
623
623
|
}
|
|
624
624
|
if (he && ye.length > 0) {
|
|
625
625
|
const a = document.createElement("p");
|
|
626
626
|
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", H.appendChild(a);
|
|
627
627
|
}
|
|
628
|
-
De.textContent =
|
|
628
|
+
De.textContent = Ye ?? (!he && ye.length === 0 ? "No recent chats for this page yet." : ""), De.hidden = De.textContent.length === 0;
|
|
629
629
|
}, En = async (a) => {
|
|
630
630
|
if (!he) {
|
|
631
|
-
he = !0,
|
|
631
|
+
he = !0, Ye = null, me();
|
|
632
632
|
try {
|
|
633
633
|
const d = await b.listSessions({ cursor: a, limit: 20 });
|
|
634
|
-
ye = a ? [...ye, ...d.sessions] : d.sessions,
|
|
634
|
+
ye = a ? [...ye, ...d.sessions] : d.sessions, At = d.nextCursor;
|
|
635
635
|
} catch (d) {
|
|
636
636
|
X(
|
|
637
637
|
"web-sdk.widget",
|
|
@@ -639,13 +639,13 @@ async function La(e = {}) {
|
|
|
639
639
|
{
|
|
640
640
|
message: d instanceof Error ? d.message : String(d)
|
|
641
641
|
}
|
|
642
|
-
),
|
|
642
|
+
), Ye = ga;
|
|
643
643
|
} finally {
|
|
644
644
|
he = !1, me();
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
}, oi = () => {
|
|
648
|
-
!
|
|
648
|
+
!At || he || H.scrollHeight - H.scrollTop - H.clientHeight <= 24 && En(At);
|
|
649
649
|
}, kn = () => {
|
|
650
650
|
Y || typeof document > "u" || (wo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
|
|
651
651
|
}, Ln = new MutationObserver(kn);
|
|
@@ -653,8 +653,8 @@ async function La(e = {}) {
|
|
|
653
653
|
childList: !0,
|
|
654
654
|
subtree: !0
|
|
655
655
|
}), kn();
|
|
656
|
-
const
|
|
657
|
-
const d =
|
|
656
|
+
const Xe = (a = !0) => {
|
|
657
|
+
const d = Ct(o, a);
|
|
658
658
|
return gn(
|
|
659
659
|
o,
|
|
660
660
|
p ? zo(p, d) : za(
|
|
@@ -677,23 +677,23 @@ async function La(e = {}) {
|
|
|
677
677
|
seenShareCandidateIds: [...Oe].slice(
|
|
678
678
|
-Eo
|
|
679
679
|
),
|
|
680
|
-
sharePromptsDisabled:
|
|
680
|
+
sharePromptsDisabled: Nt
|
|
681
681
|
});
|
|
682
|
-
},
|
|
682
|
+
}, ct = (a) => {
|
|
683
683
|
t.onDisplayStateChange?.(a);
|
|
684
|
-
},
|
|
684
|
+
}, Ze = (a, d = !0) => {
|
|
685
685
|
if (bo(t, a), a === "shown") {
|
|
686
|
-
o.classList.remove("pluno-pa-widget--minimized"), T.removeAttribute("tabindex"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") &&
|
|
686
|
+
o.classList.remove("pluno-pa-widget--minimized"), T.removeAttribute("tabindex"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && Je(!1), d && ct("shown");
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
|
-
te !== null && (window.clearTimeout(te), te = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), T.hidden = !1, m.hidden = !0, R.hidden = !0, T.tabIndex = 0, f.value = "",
|
|
689
|
+
te !== null && (window.clearTimeout(te), te = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), T.hidden = !1, m.hidden = !0, R.hidden = !0, T.tabIndex = 0, f.value = "", Ae(
|
|
690
690
|
o,
|
|
691
691
|
Zt(
|
|
692
692
|
o,
|
|
693
693
|
p,
|
|
694
694
|
t.position
|
|
695
695
|
)
|
|
696
|
-
), io(o), F(), d &&
|
|
696
|
+
), io(o), F(), d && ct("minimized");
|
|
697
697
|
}, Pe = (a, d = {}) => {
|
|
698
698
|
Wa(a, {
|
|
699
699
|
debugVersion: Ea,
|
|
@@ -713,14 +713,14 @@ async function La(e = {}) {
|
|
|
713
713
|
closeHidden: R.hidden,
|
|
714
714
|
...d
|
|
715
715
|
});
|
|
716
|
-
},
|
|
716
|
+
}, Je = (a = !0) => {
|
|
717
717
|
if (!p)
|
|
718
|
-
return
|
|
719
|
-
const d =
|
|
720
|
-
return
|
|
718
|
+
return Ae(o, null), Xe(a);
|
|
719
|
+
const d = Xe(a);
|
|
720
|
+
return Ae(o, d), Pe("Applied stored closed launcher position", {
|
|
721
721
|
visibleLauncherPosition: d
|
|
722
722
|
}), d;
|
|
723
|
-
},
|
|
723
|
+
}, It = (a, d) => {
|
|
724
724
|
if (!a || !d) {
|
|
725
725
|
io(o);
|
|
726
726
|
return;
|
|
@@ -730,11 +730,11 @@ async function La(e = {}) {
|
|
|
730
730
|
y: a.y - d.y
|
|
731
731
|
});
|
|
732
732
|
}, Rt = () => {
|
|
733
|
-
const a =
|
|
733
|
+
const a = at(c).width;
|
|
734
734
|
return t.layout === "page" && m.getBoundingClientRect().width || a;
|
|
735
735
|
}, Pn = () => {
|
|
736
736
|
if (o.classList.contains("pluno-pa-widget--minimized")) {
|
|
737
|
-
|
|
737
|
+
Ae(
|
|
738
738
|
o,
|
|
739
739
|
Zt(
|
|
740
740
|
o,
|
|
@@ -744,12 +744,12 @@ async function La(e = {}) {
|
|
|
744
744
|
);
|
|
745
745
|
return;
|
|
746
746
|
}
|
|
747
|
-
const a =
|
|
747
|
+
const a = Je();
|
|
748
748
|
if (o.classList.contains("pluno-pa-widget--open") || o.classList.contains("pluno-pa-widget--closing")) {
|
|
749
749
|
Xt(o, c);
|
|
750
|
-
const d =
|
|
750
|
+
const d = at(c);
|
|
751
751
|
tn(
|
|
752
|
-
|
|
752
|
+
I,
|
|
753
753
|
Rt()
|
|
754
754
|
);
|
|
755
755
|
const x = yt(
|
|
@@ -761,7 +761,7 @@ async function La(e = {}) {
|
|
|
761
761
|
),
|
|
762
762
|
d
|
|
763
763
|
);
|
|
764
|
-
h && (h = x),
|
|
764
|
+
h && (h = x), It(x, a), Pe(
|
|
765
765
|
"Applied open panel position after viewport resize",
|
|
766
766
|
{ openPanelPosition: x }
|
|
767
767
|
);
|
|
@@ -772,30 +772,30 @@ async function La(e = {}) {
|
|
|
772
772
|
};
|
|
773
773
|
let Tn = () => {
|
|
774
774
|
};
|
|
775
|
-
window.addEventListener("resize", Pn), t.movableLauncher && M ? (
|
|
775
|
+
window.addEventListener("resize", Pn), t.movableLauncher && M ? (Je(), Tn = Ia({
|
|
776
776
|
root: o,
|
|
777
777
|
launcher: T,
|
|
778
778
|
launcherDragHandle: M,
|
|
779
|
-
getPosition: () =>
|
|
779
|
+
getPosition: () => Xe(),
|
|
780
780
|
setPosition: (a) => {
|
|
781
|
-
const d = a, x =
|
|
781
|
+
const d = a, x = Ct(o), C = gn(
|
|
782
782
|
o,
|
|
783
783
|
a,
|
|
784
784
|
x
|
|
785
785
|
);
|
|
786
786
|
p = Oa(
|
|
787
|
-
|
|
787
|
+
C,
|
|
788
788
|
x
|
|
789
|
-
),
|
|
789
|
+
), Ae(o, C), Pe("Dragging closed launcher", {
|
|
790
790
|
requestedPosition: d
|
|
791
791
|
});
|
|
792
792
|
},
|
|
793
793
|
persist: () => {
|
|
794
794
|
g = !0, F(), Pe("Persisted closed launcher drag position");
|
|
795
795
|
}
|
|
796
|
-
})) :
|
|
796
|
+
})) : Ae(o, null), Xt(o, c);
|
|
797
797
|
const ii = () => {
|
|
798
|
-
const a =
|
|
798
|
+
const a = at(c), d = Xe();
|
|
799
799
|
return {
|
|
800
800
|
position: yt(
|
|
801
801
|
h ?? Jt(
|
|
@@ -810,14 +810,14 @@ async function La(e = {}) {
|
|
|
810
810
|
};
|
|
811
811
|
}, ai = (a) => {
|
|
812
812
|
c = kt(a.size), Xt(o, c), tn(
|
|
813
|
-
|
|
813
|
+
I,
|
|
814
814
|
Rt()
|
|
815
815
|
), h = yt(
|
|
816
816
|
a.position,
|
|
817
|
-
|
|
817
|
+
at(c)
|
|
818
818
|
);
|
|
819
|
-
const d =
|
|
820
|
-
|
|
819
|
+
const d = Xe();
|
|
820
|
+
It(h, d);
|
|
821
821
|
}, ri = L.length > 0 ? Ra({
|
|
822
822
|
root: o,
|
|
823
823
|
handles: L,
|
|
@@ -827,7 +827,7 @@ async function La(e = {}) {
|
|
|
827
827
|
}) : () => {
|
|
828
828
|
};
|
|
829
829
|
let Dt = !1;
|
|
830
|
-
const
|
|
830
|
+
const Nn = async () => {
|
|
831
831
|
if (!(!t.billingStatusLoader || Dt)) {
|
|
832
832
|
Dt = !0;
|
|
833
833
|
try {
|
|
@@ -839,7 +839,7 @@ async function La(e = {}) {
|
|
|
839
839
|
a,
|
|
840
840
|
b.getState().lastErrorCode
|
|
841
841
|
) && (t.billingStatus = a, on(
|
|
842
|
-
|
|
842
|
+
Ce,
|
|
843
843
|
t.billingStatus,
|
|
844
844
|
b.getState().lastErrorCode
|
|
845
845
|
), $());
|
|
@@ -854,30 +854,30 @@ async function La(e = {}) {
|
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
856
|
}, fe = (a = "", d = !0) => {
|
|
857
|
-
|
|
858
|
-
|
|
857
|
+
Nn(), et && (et = !1, Ot()), o.classList.contains("pluno-pa-widget--open") || (h = null), te !== null && (window.clearTimeout(te), te = null), Ze("shown", !1), m.hidden = !1, R.hidden = !1, tn(
|
|
858
|
+
I,
|
|
859
859
|
Rt()
|
|
860
860
|
), o.classList.remove("pluno-pa-widget--closing");
|
|
861
|
-
const x =
|
|
861
|
+
const x = Je(), C = Jt(
|
|
862
862
|
o,
|
|
863
863
|
x,
|
|
864
864
|
t.position,
|
|
865
865
|
c
|
|
866
866
|
);
|
|
867
|
-
if (
|
|
868
|
-
openPanelPosition:
|
|
867
|
+
if (It(C, x), Pe("Opening launcher at clamped open panel position", {
|
|
868
|
+
openPanelPosition: C,
|
|
869
869
|
visibleLauncherPosition: x
|
|
870
870
|
}), ne(!0, "open"), oe(), !d) {
|
|
871
|
-
o.classList.add("pluno-pa-widget--open"), T.hidden = !0, a && (f.value = a,
|
|
871
|
+
o.classList.add("pluno-pa-widget--open"), T.hidden = !0, a && (f.value = a, it(f)), rt(y, () => ke.enabled), Le = y.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), ct("shown"), t.onPanelOpenChange?.(!0);
|
|
872
872
|
return;
|
|
873
873
|
}
|
|
874
874
|
window.requestAnimationFrame(() => {
|
|
875
|
-
o.classList.add("pluno-pa-widget--open"), a && (f.value = a,
|
|
876
|
-
T.hidden = !0,
|
|
875
|
+
o.classList.add("pluno-pa-widget--open"), a && (f.value = a, it(f)), rt(y, () => ke.enabled), Le = y.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), ct("shown"), t.onPanelOpenChange?.(!0), te = window.setTimeout(() => {
|
|
876
|
+
T.hidden = !0, rt(y, () => ke.enabled), Le = y.scrollTop;
|
|
877
877
|
}, 220);
|
|
878
878
|
});
|
|
879
879
|
}, zt = () => {
|
|
880
|
-
te !== null && (window.clearTimeout(te), te = null), T.hidden = !1, p && (
|
|
880
|
+
te !== null && (window.clearTimeout(te), te = null), T.hidden = !1, p && (Je(!1), Pe("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), te = window.setTimeout(() => {
|
|
881
881
|
m.hidden = !0, R.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
|
|
882
882
|
}, 220);
|
|
883
883
|
};
|
|
@@ -895,8 +895,8 @@ async function La(e = {}) {
|
|
|
895
895
|
const a = u.value;
|
|
896
896
|
fe(a), u.value = "";
|
|
897
897
|
});
|
|
898
|
-
let Mt = null,
|
|
899
|
-
const
|
|
898
|
+
let Mt = null, ut = null, Te = null;
|
|
899
|
+
const An = (a) => a === u || a === f, li = (a) => {
|
|
900
900
|
if (!(a instanceof Element) || a.getRootNode() === o.getRootNode())
|
|
901
901
|
return null;
|
|
902
902
|
let d = a;
|
|
@@ -904,8 +904,8 @@ async function La(e = {}) {
|
|
|
904
904
|
const x = d.closest(Vn);
|
|
905
905
|
if (x)
|
|
906
906
|
return x;
|
|
907
|
-
const
|
|
908
|
-
d =
|
|
907
|
+
const C = d.getRootNode();
|
|
908
|
+
d = C instanceof ShadowRoot ? C.host : null;
|
|
909
909
|
}
|
|
910
910
|
return null;
|
|
911
911
|
}, si = (a) => {
|
|
@@ -919,18 +919,18 @@ async function La(e = {}) {
|
|
|
919
919
|
return a.checkVisibility();
|
|
920
920
|
const d = window.getComputedStyle(a);
|
|
921
921
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
922
|
-
},
|
|
923
|
-
Ue !== a && (Ue = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null),
|
|
922
|
+
}, In = (a) => {
|
|
923
|
+
Ue !== a && (Ue = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ne(), a !== null ? Te = window.setInterval(() => {
|
|
924
924
|
const d = Ue;
|
|
925
|
-
(!d || !si(d)) &&
|
|
926
|
-
}, ua) : Te !== null && (window.clearInterval(Te), Te = null,
|
|
925
|
+
(!d || !si(d)) && In(null);
|
|
926
|
+
}, ua) : Te !== null && (window.clearInterval(Te), Te = null, ut = null));
|
|
927
927
|
}, pi = () => {
|
|
928
928
|
Te !== null && (window.clearInterval(Te), Te = null);
|
|
929
929
|
};
|
|
930
930
|
o.addEventListener("focusin", (a) => {
|
|
931
|
-
|
|
931
|
+
An(a.target) && (Mt = Date.now(), F());
|
|
932
932
|
}), o.addEventListener("focusout", (a) => {
|
|
933
|
-
if (!
|
|
933
|
+
if (!An(a.target) || Ue !== null)
|
|
934
934
|
return;
|
|
935
935
|
const d = Mt;
|
|
936
936
|
if (Mt = null, d === null || Date.now() - d > da)
|
|
@@ -938,18 +938,18 @@ async function La(e = {}) {
|
|
|
938
938
|
const x = li(a.relatedTarget);
|
|
939
939
|
if (!x)
|
|
940
940
|
return;
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
|
|
941
|
+
const C = Date.now();
|
|
942
|
+
if (ut !== null && C - ut <= ca) {
|
|
943
|
+
In(x);
|
|
944
944
|
return;
|
|
945
945
|
}
|
|
946
|
-
|
|
946
|
+
ut = C;
|
|
947
947
|
}), T.addEventListener("keydown", (a) => {
|
|
948
948
|
!o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), fe());
|
|
949
|
-
}),
|
|
949
|
+
}), S?.addEventListener("pointerdown", (a) => {
|
|
950
950
|
a.stopPropagation();
|
|
951
|
-
}),
|
|
952
|
-
a.preventDefault(), a.stopPropagation(),
|
|
951
|
+
}), S?.addEventListener("click", (a) => {
|
|
952
|
+
a.preventDefault(), a.stopPropagation(), Ze("minimized");
|
|
953
953
|
}), R.addEventListener("click", zt), y.addEventListener("scroll", () => {
|
|
954
954
|
y.scrollTop < Le - 1 && ne(!1, "userScroll"), Le = y.scrollTop;
|
|
955
955
|
}), le.addEventListener("click", () => {
|
|
@@ -962,30 +962,30 @@ async function La(e = {}) {
|
|
|
962
962
|
{ root: y, threshold: 0 }
|
|
963
963
|
);
|
|
964
964
|
Rn?.observe(j);
|
|
965
|
-
const
|
|
966
|
-
let Ue = null,
|
|
967
|
-
const ie = () =>
|
|
968
|
-
const a =
|
|
969
|
-
u.readOnly = !1, f.readOnly = !1, u.placeholder = d ? Kn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel :
|
|
965
|
+
const Qe = () => t.loginRequired || t.signupRequired;
|
|
966
|
+
let Ue = null, et = !1;
|
|
967
|
+
const ie = () => dt || b.getState().status !== "connected", Ne = () => {
|
|
968
|
+
const a = Qe(), d = Ue !== null;
|
|
969
|
+
u.readOnly = !1, f.readOnly = !1, u.placeholder = d ? Kn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : et ? "New update" : t.launcherLabel, f.placeholder = d ? Kn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, U.hidden = a;
|
|
970
970
|
}, $ = () => {
|
|
971
|
-
O.disabled = ie() || ae(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && G.length === 0, Re.disabled =
|
|
971
|
+
O.disabled = ie() || ae(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && G.length === 0, Re.disabled = Qe() || ie() || ae(t.billingStatus);
|
|
972
972
|
};
|
|
973
|
-
|
|
973
|
+
Ne();
|
|
974
974
|
const Ot = () => {
|
|
975
975
|
const a = b.getState().isThinking;
|
|
976
976
|
o.classList.toggle("pluno-pa-widget--thinking", a), o.classList.toggle(
|
|
977
977
|
"pluno-pa-widget--unread",
|
|
978
|
-
!a &&
|
|
979
|
-
),
|
|
978
|
+
!a && et
|
|
979
|
+
), Ne();
|
|
980
980
|
};
|
|
981
981
|
Ot();
|
|
982
982
|
const Ut = () => {
|
|
983
|
-
|
|
983
|
+
Qe() || Y || (dt = !0, Ne(), $(), b.connect().then(
|
|
984
984
|
() => {
|
|
985
|
-
Y || (
|
|
985
|
+
Y || (dt = !1, Ne(), $());
|
|
986
986
|
},
|
|
987
987
|
(a) => {
|
|
988
|
-
Y || (
|
|
988
|
+
Y || (dt = !1, Ne(), $(), X(
|
|
989
989
|
"web-sdk.widget",
|
|
990
990
|
"Failed to connect Product Agent widget",
|
|
991
991
|
{
|
|
@@ -1008,12 +1008,12 @@ async function La(e = {}) {
|
|
|
1008
1008
|
b,
|
|
1009
1009
|
f,
|
|
1010
1010
|
G,
|
|
1011
|
-
|
|
1011
|
+
bt
|
|
1012
1012
|
), Me(), $());
|
|
1013
1013
|
});
|
|
1014
|
-
let
|
|
1014
|
+
let tt = 0;
|
|
1015
1015
|
const di = () => {
|
|
1016
|
-
|
|
1016
|
+
tt = 0, o.classList.remove("pluno-pa-widget--drag-over");
|
|
1017
1017
|
}, Bt = (a) => {
|
|
1018
1018
|
ge !== null && window.clearTimeout(ge), ue.textContent = a, ue.hidden = !1, ge = window.setTimeout(() => {
|
|
1019
1019
|
ue.textContent = "", ue.hidden = !0, ge = null;
|
|
@@ -1044,15 +1044,15 @@ async function La(e = {}) {
|
|
|
1044
1044
|
});
|
|
1045
1045
|
});
|
|
1046
1046
|
}), o.addEventListener("dragenter", (a) => {
|
|
1047
|
-
!t.attachmentsEnabled || !
|
|
1047
|
+
!t.attachmentsEnabled || !_t(a.dataTransfer) || t.loginRequired || ie() || (a.preventDefault(), a.stopPropagation(), tt += 1, o.classList.add("pluno-pa-widget--drag-over"));
|
|
1048
1048
|
}), o.addEventListener("dragover", (a) => {
|
|
1049
1049
|
const d = a.dataTransfer;
|
|
1050
|
-
!t.attachmentsEnabled || !
|
|
1050
|
+
!t.attachmentsEnabled || !_t(d) || t.loginRequired || ie() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
|
|
1051
1051
|
}), o.addEventListener("dragleave", (a) => {
|
|
1052
|
-
|
|
1052
|
+
_t(a.dataTransfer) && (a.stopPropagation(), tt = Math.max(0, tt - 1), tt === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
|
|
1053
1053
|
}), o.addEventListener("drop", (a) => {
|
|
1054
1054
|
const d = a.dataTransfer;
|
|
1055
|
-
!t.attachmentsEnabled || !
|
|
1055
|
+
!t.attachmentsEnabled || !_t(d) || t.loginRequired || ie() || (a.preventDefault(), a.stopPropagation(), di(), Ft(d.files).catch((x) => {
|
|
1056
1056
|
Bt(
|
|
1057
1057
|
x instanceof Error ? x.message : "Failed to attach file"
|
|
1058
1058
|
), X("web-sdk.widget", "Attachment failed", {
|
|
@@ -1062,11 +1062,11 @@ async function La(e = {}) {
|
|
|
1062
1062
|
}), o.addEventListener("paste", (a) => {
|
|
1063
1063
|
a.stopPropagation();
|
|
1064
1064
|
const d = a.clipboardData, x = Array.from(d?.files ?? []);
|
|
1065
|
-
!t.attachmentsEnabled || x.length === 0 || t.loginRequired || ie() || (a.preventDefault(), Ft(x).catch((
|
|
1065
|
+
!t.attachmentsEnabled || x.length === 0 || t.loginRequired || ie() || (a.preventDefault(), Ft(x).catch((C) => {
|
|
1066
1066
|
Bt(
|
|
1067
|
-
|
|
1067
|
+
C instanceof Error ? C.message : "Failed to attach file"
|
|
1068
1068
|
), X("web-sdk.widget", "Attachment failed", {
|
|
1069
|
-
message:
|
|
1069
|
+
message: C instanceof Error ? C.message : String(C)
|
|
1070
1070
|
});
|
|
1071
1071
|
}));
|
|
1072
1072
|
}), O.addEventListener("click", () => {
|
|
@@ -1085,14 +1085,14 @@ async function La(e = {}) {
|
|
|
1085
1085
|
b,
|
|
1086
1086
|
f,
|
|
1087
1087
|
G,
|
|
1088
|
-
|
|
1088
|
+
bt
|
|
1089
1089
|
), Me(), $(), W(b.getState()), a && _e();
|
|
1090
1090
|
}), re.addEventListener("click", () => {
|
|
1091
|
-
V = !V,
|
|
1092
|
-
}),
|
|
1091
|
+
V = !V, Ye = null, me(), V && ye.length === 0 && En(null), V || _e();
|
|
1092
|
+
}), st.addEventListener("click", () => {
|
|
1093
1093
|
V = !1, me(), _e();
|
|
1094
1094
|
}), H.addEventListener("scroll", oi), f.addEventListener("input", () => {
|
|
1095
|
-
|
|
1095
|
+
it(f), F(), $(), mi();
|
|
1096
1096
|
}), f.addEventListener("keydown", (a) => {
|
|
1097
1097
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
1098
1098
|
if (a.preventDefault(), t.loginRequired) {
|
|
@@ -1103,68 +1103,84 @@ async function La(e = {}) {
|
|
|
1103
1103
|
b,
|
|
1104
1104
|
f,
|
|
1105
1105
|
G,
|
|
1106
|
-
|
|
1106
|
+
bt
|
|
1107
1107
|
), Me(), $(), W(b.getState()));
|
|
1108
1108
|
}
|
|
1109
1109
|
}), o.addEventListener("click", (a) => {
|
|
1110
1110
|
const d = a.target instanceof Element ? a.target : null;
|
|
1111
|
-
d?.closest("a[href]") && F(), V && Gi(d,
|
|
1112
|
-
const
|
|
1111
|
+
d?.closest("a[href]") && F(), V && Gi(d, Ke, re) && (V = !1, me());
|
|
1112
|
+
const C = window.getSelection(), z = !!(C && !C.isCollapsed && C.anchorNode && o.contains(C.anchorNode));
|
|
1113
1113
|
Wi(
|
|
1114
1114
|
a.target,
|
|
1115
1115
|
a.detail,
|
|
1116
1116
|
z
|
|
1117
1117
|
) && _e();
|
|
1118
|
-
}), o.addEventListener("
|
|
1118
|
+
}), o.addEventListener("copy", (a) => {
|
|
1119
|
+
a.clipboardData && window.getSelection() && !window.getSelection()?.isCollapsed && window.getSelection()?.anchorNode && window.getSelection()?.focusNode && o.contains(window.getSelection()?.anchorNode ?? null) && o.contains(window.getSelection()?.focusNode ?? null) && window.getSelection()?.toString() && (a.clipboardData.clearData(), a.clipboardData.setData(
|
|
1120
|
+
"text/plain",
|
|
1121
|
+
window.getSelection()?.toString() ?? ""
|
|
1122
|
+
), a.preventDefault()), a.stopPropagation();
|
|
1123
|
+
});
|
|
1124
|
+
for (const a of ["keypress", "keyup"])
|
|
1125
|
+
o.addEventListener(a, (d) => {
|
|
1126
|
+
(d.metaKey || d.ctrlKey) && d.key.toLowerCase() === "c" && d.stopPropagation();
|
|
1127
|
+
});
|
|
1128
|
+
o.addEventListener("keydown", (a) => {
|
|
1129
|
+
if ((a.metaKey || a.ctrlKey) && a.key.toLowerCase() === "c") {
|
|
1130
|
+
a.defaultPrevented && navigator.clipboard && window.getSelection() && !window.getSelection()?.isCollapsed && window.getSelection()?.anchorNode && window.getSelection()?.focusNode && o.contains(window.getSelection()?.anchorNode ?? null) && o.contains(window.getSelection()?.focusNode ?? null) && window.getSelection()?.toString() && navigator.clipboard.writeText(
|
|
1131
|
+
window.getSelection()?.toString() ?? ""
|
|
1132
|
+
), a.stopPropagation();
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1119
1135
|
a.key !== "Escape" || !V || (V = !1, me(), _e());
|
|
1120
|
-
}), l.composerValue && (f.value = l.composerValue,
|
|
1121
|
-
const
|
|
1122
|
-
let Wt = b.getState().appearance !== null,
|
|
1123
|
-
const
|
|
1136
|
+
}), l.composerValue && (f.value = l.composerValue, it(f)), t.layout === "page" ? fe(f.value, !1) : s === "minimized" ? Ze("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && fe(f.value, !1), Ga(l, o, u, f);
|
|
1137
|
+
const gt = () => r;
|
|
1138
|
+
let Wt = b.getState().appearance !== null, ht = null, nt = null, Be = null, Dn = b.getState().isThinking, Fe = null;
|
|
1139
|
+
const ot = t.taskNotifications;
|
|
1124
1140
|
let We = null, He = !1;
|
|
1125
1141
|
const zn = () => {
|
|
1126
1142
|
We !== null && (window.clearTimeout(We), We = null);
|
|
1127
|
-
},
|
|
1143
|
+
}, mt = () => {
|
|
1128
1144
|
K && (K.hidden = !0);
|
|
1129
1145
|
}, Mn = () => b.getState().assistantDraft.trim().length > 0, gi = async () => {
|
|
1130
|
-
if (!
|
|
1146
|
+
if (!ot || !K || He || Y || !b.getState().isThinking || Mn())
|
|
1131
1147
|
return;
|
|
1132
1148
|
let a;
|
|
1133
1149
|
try {
|
|
1134
|
-
a = await
|
|
1150
|
+
a = await ot.getState();
|
|
1135
1151
|
} catch {
|
|
1136
1152
|
return;
|
|
1137
1153
|
}
|
|
1138
1154
|
a.enabled || a.neverSuggest || !b.getState().isThinking || Mn() || He || Y || (K.hidden = !1);
|
|
1139
1155
|
};
|
|
1140
1156
|
ee?.addEventListener("click", () => {
|
|
1141
|
-
He = !0,
|
|
1157
|
+
He = !0, mt(), ot?.enable().catch(() => {
|
|
1142
1158
|
});
|
|
1143
1159
|
}), v?.addEventListener("click", () => {
|
|
1144
|
-
He = !0,
|
|
1145
|
-
}),
|
|
1146
|
-
He = !0,
|
|
1160
|
+
He = !0, mt();
|
|
1161
|
+
}), N?.addEventListener("click", () => {
|
|
1162
|
+
He = !0, mt(), ot?.dismissForever().catch(() => {
|
|
1147
1163
|
});
|
|
1148
1164
|
});
|
|
1149
|
-
const
|
|
1165
|
+
const ft = t.tabGroups;
|
|
1150
1166
|
let Ge = !1;
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1167
|
+
const wt = async () => {
|
|
1168
|
+
if (!ft || !ze || Ge || Y)
|
|
1153
1169
|
return;
|
|
1154
|
-
const a = await
|
|
1170
|
+
const a = await ft.getState().catch(() => null);
|
|
1155
1171
|
!a || Ge || Y || (ze.hidden = !a.permissionNeeded);
|
|
1156
1172
|
};
|
|
1157
1173
|
Jo?.addEventListener("click", () => {
|
|
1158
|
-
Ge = !0, ze && (ze.hidden = !0),
|
|
1174
|
+
Ge = !0, ze && (ze.hidden = !0), ft?.enable().catch(() => {
|
|
1159
1175
|
}).finally(() => {
|
|
1160
|
-
Ge = !1,
|
|
1176
|
+
Ge = !1, wt();
|
|
1161
1177
|
});
|
|
1162
1178
|
}), Qo?.addEventListener("click", () => {
|
|
1163
|
-
Ge = !0, ze && (ze.hidden = !0),
|
|
1179
|
+
Ge = !0, ze && (ze.hidden = !0), ft?.dismiss().catch(() => {
|
|
1164
1180
|
}).finally(() => {
|
|
1165
|
-
Ge = !1,
|
|
1181
|
+
Ge = !1, wt();
|
|
1166
1182
|
});
|
|
1167
|
-
}),
|
|
1183
|
+
}), wt();
|
|
1168
1184
|
let $e = null, On = () => {
|
|
1169
1185
|
};
|
|
1170
1186
|
const hi = !!t.socialPostDraftHandler, Ht = /* @__PURE__ */ new Map(), Gt = () => f.value.trim().length > 0 || G.length > 0, mi = () => {
|
|
@@ -1173,8 +1189,8 @@ async function La(e = {}) {
|
|
|
1173
1189
|
};
|
|
1174
1190
|
let qe = null;
|
|
1175
1191
|
const $t = (a = {}) => {
|
|
1176
|
-
xe = !0, ne(!0, "newSession"), oe(), V = !1, me(), b.startNewSession(a), Tt.clear(), f.value = "", G = [], Me(),
|
|
1177
|
-
},
|
|
1192
|
+
xe = !0, ne(!0, "newSession"), oe(), V = !1, me(), b.startNewSession(a), Tt.clear(), f.value = "", G = [], Me(), it(f), F(), $(), f.focus(), W(b.getState());
|
|
1193
|
+
}, bt = () => {
|
|
1178
1194
|
t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), $t());
|
|
1179
1195
|
}, qt = (a) => {
|
|
1180
1196
|
if (!a || t.layout === "page") {
|
|
@@ -1189,7 +1205,7 @@ async function La(e = {}) {
|
|
|
1189
1205
|
), qe.addEventListener("click", () => $t()), Ee.insertBefore(qe, re));
|
|
1190
1206
|
}, W = (a) => {
|
|
1191
1207
|
if (me(), yn(a.lastErrorCode) ? Fe = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Fe = null), on(
|
|
1192
|
-
|
|
1208
|
+
Ce,
|
|
1193
1209
|
t.billingStatus,
|
|
1194
1210
|
Fe
|
|
1195
1211
|
), t.loginRequired) {
|
|
@@ -1197,7 +1213,7 @@ async function La(e = {}) {
|
|
|
1197
1213
|
y,
|
|
1198
1214
|
O,
|
|
1199
1215
|
qt,
|
|
1200
|
-
|
|
1216
|
+
gt,
|
|
1201
1217
|
"Log in to use Pluno on this page.",
|
|
1202
1218
|
t.loginButtonLabel,
|
|
1203
1219
|
t.loginUrl,
|
|
@@ -1210,7 +1226,7 @@ async function La(e = {}) {
|
|
|
1210
1226
|
y,
|
|
1211
1227
|
O,
|
|
1212
1228
|
qt,
|
|
1213
|
-
|
|
1229
|
+
gt,
|
|
1214
1230
|
"Complete signup to unlock your free trial credits.",
|
|
1215
1231
|
t.signupButtonLabel,
|
|
1216
1232
|
t.signupUrl,
|
|
@@ -1218,9 +1234,9 @@ async function La(e = {}) {
|
|
|
1218
1234
|
);
|
|
1219
1235
|
return;
|
|
1220
1236
|
}
|
|
1221
|
-
const d = qa(a), x = d !==
|
|
1222
|
-
|
|
1223
|
-
const
|
|
1237
|
+
const d = qa(a), x = d !== Cn;
|
|
1238
|
+
Cn = d;
|
|
1239
|
+
const C = xe || ke.enabled;
|
|
1224
1240
|
xe = !1, kr(
|
|
1225
1241
|
y,
|
|
1226
1242
|
j,
|
|
@@ -1230,14 +1246,14 @@ async function La(e = {}) {
|
|
|
1230
1246
|
a,
|
|
1231
1247
|
$e,
|
|
1232
1248
|
$e !== null && an(a, Gt()),
|
|
1233
|
-
|
|
1249
|
+
C,
|
|
1234
1250
|
() => ke.enabled,
|
|
1235
1251
|
Tt,
|
|
1236
1252
|
Ht,
|
|
1237
1253
|
F,
|
|
1238
|
-
|
|
1254
|
+
gt,
|
|
1239
1255
|
(z) => {
|
|
1240
|
-
ie() || (
|
|
1256
|
+
ie() || (bt(), xe = !0, ne(!0, "send"), oe(), b.sendMessage(z));
|
|
1241
1257
|
},
|
|
1242
1258
|
() => {
|
|
1243
1259
|
xe = !0, ne(!0, "send"), oe(), b.retryLastMessage();
|
|
@@ -1248,11 +1264,11 @@ async function La(e = {}) {
|
|
|
1248
1264
|
},
|
|
1249
1265
|
Ut,
|
|
1250
1266
|
t.attachmentPreviewUrlResolver,
|
|
1251
|
-
hi && !
|
|
1252
|
-
dismissedCandidateIds:
|
|
1253
|
-
draftingCandidate:
|
|
1254
|
-
error:
|
|
1255
|
-
characterIconOptions:
|
|
1267
|
+
hi && !Nt ? {
|
|
1268
|
+
dismissedCandidateIds: pt,
|
|
1269
|
+
draftingCandidate: ht,
|
|
1270
|
+
error: nt,
|
|
1271
|
+
characterIconOptions: gt(),
|
|
1256
1272
|
onSeen: (z) => {
|
|
1257
1273
|
Oe.add(z.id), F();
|
|
1258
1274
|
},
|
|
@@ -1260,13 +1276,13 @@ async function La(e = {}) {
|
|
|
1260
1276
|
fi(z);
|
|
1261
1277
|
},
|
|
1262
1278
|
onDismiss: (z) => {
|
|
1263
|
-
Oe.add(z.id),
|
|
1279
|
+
Oe.add(z.id), pt.add(z.id), F(), nt = null, W(b.getState());
|
|
1264
1280
|
},
|
|
1265
1281
|
onDisable: (z) => {
|
|
1266
|
-
|
|
1282
|
+
Nt = !0, Oe.add(z.id), pt.add(z.id), F(), Xr(t, !0), nt = null, W(b.getState());
|
|
1267
1283
|
}
|
|
1268
1284
|
} : void 0
|
|
1269
|
-
),
|
|
1285
|
+
), C ? (Le = y.scrollTop, oe()) : x && ja(a) && ti();
|
|
1270
1286
|
};
|
|
1271
1287
|
return On = zi(
|
|
1272
1288
|
(a) => {
|
|
@@ -1278,11 +1294,11 @@ async function La(e = {}) {
|
|
|
1278
1294
|
loader: t.activeUsersLoader
|
|
1279
1295
|
}
|
|
1280
1296
|
), b.on("state", (a) => {
|
|
1281
|
-
|
|
1297
|
+
wt();
|
|
1282
1298
|
const d = Dn && !a.isThinking;
|
|
1283
|
-
Dn = a.isThinking, a.isThinking && !a.assistantDraft.trim() &&
|
|
1299
|
+
Dn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && ot && !He && We === null && K?.hidden !== !1 && (We = window.setTimeout(() => {
|
|
1284
1300
|
We = null, gi();
|
|
1285
|
-
}, Yi)), (!a.isThinking || a.assistantDraft.trim()) && (zn(),
|
|
1301
|
+
}, Yi)), (!a.isThinking || a.assistantDraft.trim()) && (zn(), mt()), d && !o.classList.contains("pluno-pa-widget--open") && (et = !0), Ot(), a.appearance ? (Wt = !0, X(
|
|
1286
1302
|
"web-sdk.widget",
|
|
1287
1303
|
"Agent state supplied appearance",
|
|
1288
1304
|
{
|
|
@@ -1296,7 +1312,7 @@ async function La(e = {}) {
|
|
|
1296
1312
|
fallbackColorScheme: t.colorScheme,
|
|
1297
1313
|
fallbackFontFamily: t.fontFamily
|
|
1298
1314
|
}
|
|
1299
|
-
), jt({}, "agent.state.appearance-cleared")), W(a), $(), d &&
|
|
1315
|
+
), jt({}, "agent.state.appearance-cleared")), W(a), $(), d && Nn();
|
|
1300
1316
|
}), W(b.getState()), $(), Ut(), {
|
|
1301
1317
|
agent: b,
|
|
1302
1318
|
startNewChat: $t,
|
|
@@ -1317,8 +1333,8 @@ async function La(e = {}) {
|
|
|
1317
1333
|
), $());
|
|
1318
1334
|
},
|
|
1319
1335
|
updateAuthGate: (a) => {
|
|
1320
|
-
const d =
|
|
1321
|
-
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl),
|
|
1336
|
+
const d = Qe();
|
|
1337
|
+
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ne(), W(b.getState()), $(), d && !Qe() && Ut();
|
|
1322
1338
|
},
|
|
1323
1339
|
openPanel: () => {
|
|
1324
1340
|
fe(f.value, !1);
|
|
@@ -1326,10 +1342,10 @@ async function La(e = {}) {
|
|
|
1326
1342
|
closePanel: zt,
|
|
1327
1343
|
updateDisplayState: (a) => {
|
|
1328
1344
|
if (a === "shown") {
|
|
1329
|
-
|
|
1345
|
+
Ze("shown", !1);
|
|
1330
1346
|
return;
|
|
1331
1347
|
}
|
|
1332
|
-
|
|
1348
|
+
Ze("minimized", !1);
|
|
1333
1349
|
},
|
|
1334
1350
|
updateMorningReport: (a) => {
|
|
1335
1351
|
t.morningReport = a ?? null, W(b.getState());
|
|
@@ -1339,42 +1355,42 @@ async function La(e = {}) {
|
|
|
1339
1355
|
}
|
|
1340
1356
|
};
|
|
1341
1357
|
async function fi(a) {
|
|
1342
|
-
if (!
|
|
1343
|
-
|
|
1358
|
+
if (!ht) {
|
|
1359
|
+
ht = a, nt = null, W(b.getState());
|
|
1344
1360
|
try {
|
|
1345
1361
|
if (!t.socialPostDraftHandler)
|
|
1346
1362
|
throw new Error("Social post drafting is not available here.");
|
|
1347
1363
|
const d = await t.socialPostDraftHandler(a);
|
|
1348
1364
|
if (!d.linkedinPost || !d.xPost)
|
|
1349
1365
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1350
|
-
Oe.add(a.id),
|
|
1366
|
+
Oe.add(a.id), pt.add(a.id), F(), Be?.remove(), Be = Dr(d, {
|
|
1351
1367
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1352
1368
|
onClose: () => {
|
|
1353
1369
|
Be?.remove(), Be = null;
|
|
1354
1370
|
}
|
|
1355
1371
|
}), o.appendChild(Be);
|
|
1356
1372
|
} catch (d) {
|
|
1357
|
-
|
|
1373
|
+
nt = d instanceof Error ? d.message : "Could not draft social post.";
|
|
1358
1374
|
} finally {
|
|
1359
|
-
|
|
1375
|
+
ht = null, W(b.getState());
|
|
1360
1376
|
}
|
|
1361
1377
|
}
|
|
1362
1378
|
}
|
|
1363
1379
|
function jt(a, d) {
|
|
1364
|
-
const x = a.accentColor ?? t.accentColor,
|
|
1380
|
+
const x = a.accentColor ?? t.accentColor, C = a.colorScheme ?? t.colorScheme, z = a.fontFamily ?? t.fontFamily, Vt = a.scribbleStyle ?? t.scribbleStyle;
|
|
1365
1381
|
r = Qn(
|
|
1366
1382
|
x,
|
|
1367
1383
|
Vt
|
|
1368
1384
|
), eo(o, r, {
|
|
1369
1385
|
accentColor: x,
|
|
1370
|
-
colorScheme:
|
|
1386
|
+
colorScheme: C,
|
|
1371
1387
|
fontFamily: z,
|
|
1372
1388
|
scribbleStyle: Vt
|
|
1373
1389
|
}), X("web-sdk.widget", "Updated widget appearance", {
|
|
1374
1390
|
source: d,
|
|
1375
1391
|
inputAppearance: a,
|
|
1376
1392
|
appliedAccentColor: x,
|
|
1377
|
-
appliedColorScheme:
|
|
1393
|
+
appliedColorScheme: C,
|
|
1378
1394
|
appliedFontFamily: z,
|
|
1379
1395
|
appliedScribbleStyle: Vt,
|
|
1380
1396
|
cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
|
|
@@ -1386,7 +1402,7 @@ function Qn(e, t) {
|
|
|
1386
1402
|
}
|
|
1387
1403
|
function Pa(e) {
|
|
1388
1404
|
const t = Ta(e);
|
|
1389
|
-
return t === null ? "#fafafa" :
|
|
1405
|
+
return t === null ? "#fafafa" : Na(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1390
1406
|
}
|
|
1391
1407
|
function Ta(e) {
|
|
1392
1408
|
const t = e.trim();
|
|
@@ -1400,7 +1416,7 @@ function Ta(e) {
|
|
|
1400
1416
|
Number.parseInt(t[3] + t[3], 16)
|
|
1401
1417
|
] : null;
|
|
1402
1418
|
}
|
|
1403
|
-
function
|
|
1419
|
+
function Na([e, t, n]) {
|
|
1404
1420
|
const i = (o) => {
|
|
1405
1421
|
const r = o / 255;
|
|
1406
1422
|
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
@@ -1419,19 +1435,19 @@ function eo(e, t, n) {
|
|
|
1419
1435
|
e.style.setProperty("--pluno-pa-accent", i), n.scribbleStyle ? e.style.setProperty(
|
|
1420
1436
|
"--pluno-pa-accent-contrast",
|
|
1421
1437
|
Pa(i)
|
|
1422
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ha : n.fontFamily, n.scribbleStyle &&
|
|
1438
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ha : n.fontFamily, n.scribbleStyle && Aa(e.ownerDocument);
|
|
1423
1439
|
const o = Array.from(
|
|
1424
1440
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1425
1441
|
);
|
|
1426
1442
|
for (const r of o)
|
|
1427
1443
|
r.replaceWith(
|
|
1428
|
-
|
|
1444
|
+
Se(
|
|
1429
1445
|
Array.from(r.classList).join(" "),
|
|
1430
1446
|
t
|
|
1431
1447
|
)
|
|
1432
1448
|
);
|
|
1433
1449
|
}
|
|
1434
|
-
function
|
|
1450
|
+
function Aa(e) {
|
|
1435
1451
|
if (e.getElementById(Yn))
|
|
1436
1452
|
return;
|
|
1437
1453
|
const t = e.createElement("style");
|
|
@@ -1443,7 +1459,7 @@ function Ia(e) {
|
|
|
1443
1459
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1444
1460
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1445
1461
|
}
|
|
1446
|
-
function
|
|
1462
|
+
function Ia({
|
|
1447
1463
|
root: e,
|
|
1448
1464
|
launcher: t,
|
|
1449
1465
|
launcherDragHandle: n,
|
|
@@ -1460,8 +1476,8 @@ function Na({
|
|
|
1460
1476
|
if (l !== m.pointerId || !s || !p)
|
|
1461
1477
|
return;
|
|
1462
1478
|
m.preventDefault();
|
|
1463
|
-
const
|
|
1464
|
-
!g && Math.hypot(
|
|
1479
|
+
const I = m.clientX - s.x, L = m.clientY - s.y;
|
|
1480
|
+
!g && Math.hypot(I, L) < un || (g = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + I, y: p.y + L }));
|
|
1465
1481
|
}, T = (m) => {
|
|
1466
1482
|
l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
|
|
1467
1483
|
}, M = (m) => {
|
|
@@ -1469,20 +1485,20 @@ function Na({
|
|
|
1469
1485
|
}, u = (m) => {
|
|
1470
1486
|
if (!c)
|
|
1471
1487
|
return;
|
|
1472
|
-
const
|
|
1488
|
+
const I = Math.hypot(
|
|
1473
1489
|
m.clientX - c.x,
|
|
1474
1490
|
m.clientY - c.y
|
|
1475
1491
|
) <= un;
|
|
1476
|
-
c = null,
|
|
1477
|
-
},
|
|
1492
|
+
c = null, I && (m.preventDefault(), m.stopPropagation());
|
|
1493
|
+
}, S = (m) => {
|
|
1478
1494
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1479
1495
|
return;
|
|
1480
|
-
const
|
|
1496
|
+
const I = m.shiftKey ? Io : Ao, L = i();
|
|
1481
1497
|
let R = null;
|
|
1482
|
-
m.key === "ArrowUp" ? R = { x: L.x, y: L.y -
|
|
1498
|
+
m.key === "ArrowUp" ? R = { x: L.x, y: L.y - I } : m.key === "ArrowDown" ? R = { x: L.x, y: L.y + I } : m.key === "ArrowLeft" ? R = { x: L.x - I, y: L.y } : m.key === "ArrowRight" && (R = { x: L.x + I, y: L.y }), R && (m.preventDefault(), m.stopPropagation(), o(R), r());
|
|
1483
1499
|
};
|
|
1484
|
-
return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", P), t.addEventListener("pointerup", T), t.addEventListener("pointercancel", M), t.addEventListener("click", u, !0), n.addEventListener("keydown",
|
|
1485
|
-
t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", T), t.removeEventListener("pointercancel", M), t.removeEventListener("click", u, !0), n.removeEventListener("keydown",
|
|
1500
|
+
return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", P), t.addEventListener("pointerup", T), t.addEventListener("pointercancel", M), t.addEventListener("click", u, !0), n.addEventListener("keydown", S), () => {
|
|
1501
|
+
t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", T), t.removeEventListener("pointercancel", M), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", S);
|
|
1486
1502
|
};
|
|
1487
1503
|
}
|
|
1488
1504
|
function Ra({
|
|
@@ -1496,24 +1512,24 @@ function Ra({
|
|
|
1496
1512
|
const c = () => {
|
|
1497
1513
|
r = null, l = null, s = null, p = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1498
1514
|
}, h = (u) => {
|
|
1499
|
-
const
|
|
1500
|
-
!e.classList.contains("pluno-pa-widget--open") || !to(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, s = { x: u.clientX, y: u.clientY }, p = n(), g = !1,
|
|
1515
|
+
const S = u.currentTarget, m = S.dataset.resizeDirection;
|
|
1516
|
+
!e.classList.contains("pluno-pa-widget--open") || !to(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, s = { x: u.clientX, y: u.clientY }, p = n(), g = !1, S.setPointerCapture?.(u.pointerId));
|
|
1501
1517
|
}, E = (u) => {
|
|
1502
1518
|
if (r !== u.pointerId || !l || !s || !p)
|
|
1503
1519
|
return;
|
|
1504
1520
|
u.preventDefault(), u.stopPropagation();
|
|
1505
|
-
const
|
|
1506
|
-
!g && Math.hypot(
|
|
1507
|
-
no(p, l,
|
|
1521
|
+
const S = u.clientX - s.x, m = u.clientY - s.y;
|
|
1522
|
+
!g && Math.hypot(S, m) < un || (g = !0, e.classList.add("pluno-pa-widget--resizing"), i(
|
|
1523
|
+
no(p, l, S, m)
|
|
1508
1524
|
));
|
|
1509
1525
|
}, P = (u) => {
|
|
1510
1526
|
r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && o(), c());
|
|
1511
1527
|
}, T = (u) => {
|
|
1512
1528
|
r === u.pointerId && (u.preventDefault(), c());
|
|
1513
1529
|
}, M = (u) => {
|
|
1514
|
-
const m = u.currentTarget.dataset.resizeDirection,
|
|
1530
|
+
const m = u.currentTarget.dataset.resizeDirection, I = u.shiftKey ? Io : Ao, L = n();
|
|
1515
1531
|
let R = 0, U = 0;
|
|
1516
|
-
to(m) && (u.key === "ArrowLeft" ? R = -
|
|
1532
|
+
to(m) && (u.key === "ArrowLeft" ? R = -I : u.key === "ArrowRight" ? R = I : u.key === "ArrowUp" ? U = -I : u.key === "ArrowDown" && (U = I), !(R === 0 && U === 0) && (u.preventDefault(), u.stopPropagation(), i(no(L, m, R, U)), o()));
|
|
1517
1533
|
};
|
|
1518
1534
|
for (const u of t)
|
|
1519
1535
|
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", E), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", T), u.addEventListener("keydown", M);
|
|
@@ -1532,11 +1548,11 @@ function no(e, t, n, i) {
|
|
|
1532
1548
|
delta: n,
|
|
1533
1549
|
resizeLeading: t.endsWith("left") || t === "left",
|
|
1534
1550
|
resizeTrailing: t.endsWith("right") || t === "right",
|
|
1535
|
-
minLeading:
|
|
1536
|
-
maxTrailing: o.width -
|
|
1551
|
+
minLeading: A,
|
|
1552
|
+
maxTrailing: o.width - A,
|
|
1537
1553
|
minLength: Math.min(
|
|
1538
1554
|
bn,
|
|
1539
|
-
o.width -
|
|
1555
|
+
o.width - A * 2
|
|
1540
1556
|
)
|
|
1541
1557
|
}), l = oo({
|
|
1542
1558
|
leading: e.position.y,
|
|
@@ -1544,11 +1560,11 @@ function no(e, t, n, i) {
|
|
|
1544
1560
|
delta: i,
|
|
1545
1561
|
resizeLeading: t.startsWith("top") || t === "top",
|
|
1546
1562
|
resizeTrailing: t.startsWith("bottom") || t === "bottom",
|
|
1547
|
-
minLeading:
|
|
1548
|
-
maxTrailing: o.height -
|
|
1563
|
+
minLeading: Ie,
|
|
1564
|
+
maxTrailing: o.height - A,
|
|
1549
1565
|
minLength: Math.min(
|
|
1550
1566
|
_n,
|
|
1551
|
-
o.height -
|
|
1567
|
+
o.height - Ie - A
|
|
1552
1568
|
)
|
|
1553
1569
|
});
|
|
1554
1570
|
return {
|
|
@@ -1599,7 +1615,7 @@ function oo({
|
|
|
1599
1615
|
}
|
|
1600
1616
|
return { leading: e, length: t };
|
|
1601
1617
|
}
|
|
1602
|
-
function
|
|
1618
|
+
function Ct(e, t = !0) {
|
|
1603
1619
|
const n = Q();
|
|
1604
1620
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1605
1621
|
return { width: Xn, height: Xn };
|
|
@@ -1618,7 +1634,7 @@ function Da() {
|
|
|
1618
1634
|
bn,
|
|
1619
1635
|
wa
|
|
1620
1636
|
),
|
|
1621
|
-
e.width -
|
|
1637
|
+
e.width - A * 2
|
|
1622
1638
|
),
|
|
1623
1639
|
height: Math.min(
|
|
1624
1640
|
J(
|
|
@@ -1626,11 +1642,11 @@ function Da() {
|
|
|
1626
1642
|
_n,
|
|
1627
1643
|
_a
|
|
1628
1644
|
),
|
|
1629
|
-
e.height -
|
|
1645
|
+
e.height - Ie - A
|
|
1630
1646
|
)
|
|
1631
1647
|
};
|
|
1632
1648
|
}
|
|
1633
|
-
function
|
|
1649
|
+
function at(e = null) {
|
|
1634
1650
|
return e ? kt(e) : Da();
|
|
1635
1651
|
}
|
|
1636
1652
|
function kt(e) {
|
|
@@ -1640,22 +1656,22 @@ function kt(e) {
|
|
|
1640
1656
|
e.width,
|
|
1641
1657
|
Math.min(
|
|
1642
1658
|
bn,
|
|
1643
|
-
t.width -
|
|
1659
|
+
t.width - A * 2
|
|
1644
1660
|
),
|
|
1645
1661
|
Math.max(
|
|
1646
|
-
|
|
1647
|
-
t.width -
|
|
1662
|
+
A,
|
|
1663
|
+
t.width - A * 2
|
|
1648
1664
|
)
|
|
1649
1665
|
),
|
|
1650
1666
|
height: J(
|
|
1651
1667
|
e.height,
|
|
1652
1668
|
Math.min(
|
|
1653
1669
|
_n,
|
|
1654
|
-
t.height -
|
|
1670
|
+
t.height - Ie - A
|
|
1655
1671
|
),
|
|
1656
1672
|
Math.max(
|
|
1657
|
-
|
|
1658
|
-
t.height -
|
|
1673
|
+
A,
|
|
1674
|
+
t.height - Ie - A
|
|
1659
1675
|
)
|
|
1660
1676
|
)
|
|
1661
1677
|
};
|
|
@@ -1682,7 +1698,7 @@ function za(e, t, n) {
|
|
|
1682
1698
|
};
|
|
1683
1699
|
}
|
|
1684
1700
|
function Zt(e, t, n) {
|
|
1685
|
-
const i =
|
|
1701
|
+
const i = Ct(e, !1);
|
|
1686
1702
|
return t ? gn(
|
|
1687
1703
|
e,
|
|
1688
1704
|
zo(t, i),
|
|
@@ -1697,14 +1713,14 @@ function Ma(e, t, n) {
|
|
|
1697
1713
|
};
|
|
1698
1714
|
}
|
|
1699
1715
|
function gn(e, t, n) {
|
|
1700
|
-
const i = Q(), o =
|
|
1716
|
+
const i = Q(), o = A + Ba(e);
|
|
1701
1717
|
return {
|
|
1702
1718
|
x: J(
|
|
1703
1719
|
t.x,
|
|
1704
|
-
|
|
1720
|
+
A,
|
|
1705
1721
|
Math.max(
|
|
1706
|
-
|
|
1707
|
-
i.width - n.width -
|
|
1722
|
+
A,
|
|
1723
|
+
i.width - n.width - A
|
|
1708
1724
|
)
|
|
1709
1725
|
),
|
|
1710
1726
|
y: J(
|
|
@@ -1712,7 +1728,7 @@ function gn(e, t, n) {
|
|
|
1712
1728
|
o,
|
|
1713
1729
|
Math.max(
|
|
1714
1730
|
o,
|
|
1715
|
-
i.height - n.height -
|
|
1731
|
+
i.height - n.height - A
|
|
1716
1732
|
)
|
|
1717
1733
|
)
|
|
1718
1734
|
};
|
|
@@ -1737,10 +1753,10 @@ function Ua(e, t) {
|
|
|
1737
1753
|
return `${r}-${l}`;
|
|
1738
1754
|
}
|
|
1739
1755
|
function Ba(e) {
|
|
1740
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1756
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? Ca : Sa;
|
|
1741
1757
|
}
|
|
1742
1758
|
function Jt(e, t, n, i = null) {
|
|
1743
|
-
const o =
|
|
1759
|
+
const o = Ct(e), r = at(i), l = {
|
|
1744
1760
|
x: n === "bottom-left" ? t.x : t.x + o.width - r.width,
|
|
1745
1761
|
y: t.y + o.height - r.height
|
|
1746
1762
|
};
|
|
@@ -1751,23 +1767,23 @@ function yt(e, t) {
|
|
|
1751
1767
|
return {
|
|
1752
1768
|
x: J(
|
|
1753
1769
|
e.x,
|
|
1754
|
-
|
|
1770
|
+
A,
|
|
1755
1771
|
Math.max(
|
|
1756
|
-
|
|
1757
|
-
n.width - t.width -
|
|
1772
|
+
A,
|
|
1773
|
+
n.width - t.width - A
|
|
1758
1774
|
)
|
|
1759
1775
|
),
|
|
1760
1776
|
y: J(
|
|
1761
1777
|
e.y,
|
|
1762
|
-
|
|
1778
|
+
Ie,
|
|
1763
1779
|
Math.max(
|
|
1764
|
-
|
|
1765
|
-
n.height - t.height -
|
|
1780
|
+
Ie,
|
|
1781
|
+
n.height - t.height - A
|
|
1766
1782
|
)
|
|
1767
1783
|
)
|
|
1768
1784
|
};
|
|
1769
1785
|
}
|
|
1770
|
-
function
|
|
1786
|
+
function Ae(e, t) {
|
|
1771
1787
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1772
1788
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1773
1789
|
return;
|
|
@@ -1782,8 +1798,8 @@ function io(e) {
|
|
|
1782
1798
|
}
|
|
1783
1799
|
function Q() {
|
|
1784
1800
|
return {
|
|
1785
|
-
width: window.innerWidth || document.documentElement.clientWidth || Po +
|
|
1786
|
-
height: window.innerHeight || document.documentElement.clientHeight || To +
|
|
1801
|
+
width: window.innerWidth || document.documentElement.clientWidth || Po + A * 2,
|
|
1802
|
+
height: window.innerHeight || document.documentElement.clientHeight || To + A * 2
|
|
1787
1803
|
};
|
|
1788
1804
|
}
|
|
1789
1805
|
function Qt(e) {
|
|
@@ -1835,12 +1851,12 @@ function Ga(e, t, n, i) {
|
|
|
1835
1851
|
function $a(e) {
|
|
1836
1852
|
return e;
|
|
1837
1853
|
}
|
|
1838
|
-
function
|
|
1854
|
+
function it(e) {
|
|
1839
1855
|
e.style.height = "0px";
|
|
1840
1856
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1841
1857
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1842
1858
|
}
|
|
1843
|
-
function
|
|
1859
|
+
function rt(e, t = () => !0) {
|
|
1844
1860
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1845
1861
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1846
1862
|
});
|
|
@@ -1918,7 +1934,7 @@ function Za(e, t, n, i) {
|
|
|
1918
1934
|
10
|
|
1919
1935
|
)
|
|
1920
1936
|
), o.appendChild(
|
|
1921
|
-
|
|
1937
|
+
Se(
|
|
1922
1938
|
"pluno-pa-widget__character--launcher",
|
|
1923
1939
|
t
|
|
1924
1940
|
)
|
|
@@ -2055,7 +2071,7 @@ function nr() {
|
|
|
2055
2071
|
function or(e) {
|
|
2056
2072
|
const t = document.createElement("div");
|
|
2057
2073
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
2058
|
-
|
|
2074
|
+
Se(
|
|
2059
2075
|
"pluno-pa-widget__character--empty",
|
|
2060
2076
|
e
|
|
2061
2077
|
)
|
|
@@ -2077,7 +2093,7 @@ function Oo(e, t) {
|
|
|
2077
2093
|
)
|
|
2078
2094
|
);
|
|
2079
2095
|
}
|
|
2080
|
-
function
|
|
2096
|
+
function Se(e, t) {
|
|
2081
2097
|
const n = `pluno-pa-character-${Jn}`;
|
|
2082
2098
|
Jn += 1;
|
|
2083
2099
|
const i = t.scribbleStyle ? ar(t.accentColor, n) : ir(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
|
|
@@ -2224,13 +2240,13 @@ function ir(e, t) {
|
|
|
2224
2240
|
d: vt,
|
|
2225
2241
|
fill: Z(i.boltEdge)
|
|
2226
2242
|
});
|
|
2227
|
-
const
|
|
2243
|
+
const S = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
|
|
2228
2244
|
w(u, "path", {
|
|
2229
|
-
d:
|
|
2245
|
+
d: S,
|
|
2230
2246
|
fill: Z(i.boltFill),
|
|
2231
2247
|
filter: Z(i.innerDepth)
|
|
2232
2248
|
}), w(u, "path", {
|
|
2233
|
-
d:
|
|
2249
|
+
d: S,
|
|
2234
2250
|
fill: Z(i.boltGlow),
|
|
2235
2251
|
opacity: "0.74"
|
|
2236
2252
|
});
|
|
@@ -2260,9 +2276,9 @@ function ir(e, t) {
|
|
|
2260
2276
|
"stroke-linecap": "round",
|
|
2261
2277
|
opacity: "0.48"
|
|
2262
2278
|
});
|
|
2263
|
-
const
|
|
2279
|
+
const I = w(o, "g", { filter: Z(i.eyeShadow) });
|
|
2264
2280
|
return ao(
|
|
2265
|
-
|
|
2281
|
+
I,
|
|
2266
2282
|
"rotate(-2 528 463)",
|
|
2267
2283
|
"528",
|
|
2268
2284
|
"463",
|
|
@@ -2272,7 +2288,7 @@ function ir(e, t) {
|
|
|
2272
2288
|
"447",
|
|
2273
2289
|
i
|
|
2274
2290
|
), ao(
|
|
2275
|
-
|
|
2291
|
+
I,
|
|
2276
2292
|
"rotate(2 717 462)",
|
|
2277
2293
|
"717",
|
|
2278
2294
|
"462",
|
|
@@ -2325,7 +2341,7 @@ function ar(e, t) {
|
|
|
2325
2341
|
}), w(p, "path", {
|
|
2326
2342
|
d: vt,
|
|
2327
2343
|
fill: "none",
|
|
2328
|
-
stroke:
|
|
2344
|
+
stroke: St,
|
|
2329
2345
|
"stroke-width": "18",
|
|
2330
2346
|
"stroke-linejoin": "round"
|
|
2331
2347
|
}), ro(
|
|
@@ -2350,7 +2366,7 @@ function ar(e, t) {
|
|
|
2350
2366
|
}
|
|
2351
2367
|
function Uo() {
|
|
2352
2368
|
return k("svg", {
|
|
2353
|
-
xmlns:
|
|
2369
|
+
xmlns: No,
|
|
2354
2370
|
viewBox: "0 0 1254 1254"
|
|
2355
2371
|
});
|
|
2356
2372
|
}
|
|
@@ -2384,14 +2400,14 @@ function ro(e, t, n, i, o, r, l, s) {
|
|
|
2384
2400
|
rx: "73",
|
|
2385
2401
|
ry: "80",
|
|
2386
2402
|
fill: "#ffffff",
|
|
2387
|
-
stroke:
|
|
2403
|
+
stroke: St,
|
|
2388
2404
|
"stroke-width": "13"
|
|
2389
2405
|
}), w(p, "ellipse", {
|
|
2390
2406
|
cx: o,
|
|
2391
2407
|
cy: r,
|
|
2392
2408
|
rx: "45",
|
|
2393
2409
|
ry: "53",
|
|
2394
|
-
fill:
|
|
2410
|
+
fill: St
|
|
2395
2411
|
}), w(p, "circle", {
|
|
2396
2412
|
cx: l,
|
|
2397
2413
|
cy: s,
|
|
@@ -2684,7 +2700,7 @@ function ce(e, t, n, i, o, r) {
|
|
|
2684
2700
|
return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), k("svg", l);
|
|
2685
2701
|
}
|
|
2686
2702
|
function k(e, t = {}) {
|
|
2687
|
-
const n = document.createElementNS(
|
|
2703
|
+
const n = document.createElementNS(No, e);
|
|
2688
2704
|
for (const [i, o] of Object.entries(t))
|
|
2689
2705
|
n.setAttribute(i, o);
|
|
2690
2706
|
return n;
|
|
@@ -2778,7 +2794,7 @@ function _r(e, t) {
|
|
|
2778
2794
|
function xr(e) {
|
|
2779
2795
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2780
2796
|
}
|
|
2781
|
-
function
|
|
2797
|
+
function _t(e) {
|
|
2782
2798
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2783
2799
|
}
|
|
2784
2800
|
function on(e, t, n = null) {
|
|
@@ -2810,7 +2826,7 @@ function vr(e) {
|
|
|
2810
2826
|
const n = document.createElement("strong");
|
|
2811
2827
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2812
2828
|
const i = document.createElement("span");
|
|
2813
|
-
return i.textContent =
|
|
2829
|
+
return i.textContent = Cr(e) ?? "Credits are running low for this period.", t.appendChild(i), t.appendChild(
|
|
2814
2830
|
$o(
|
|
2815
2831
|
e,
|
|
2816
2832
|
"Upgrade",
|
|
@@ -2822,9 +2838,9 @@ function mn(e, t) {
|
|
|
2822
2838
|
return e !== null && (ae(e) || Go(e) || yn(t));
|
|
2823
2839
|
}
|
|
2824
2840
|
function po(e, t, n) {
|
|
2825
|
-
return mn(t, n) ||
|
|
2841
|
+
return mn(t, n) || Sr(t) ? !0 : !mn(e, n);
|
|
2826
2842
|
}
|
|
2827
|
-
function
|
|
2843
|
+
function Sr(e) {
|
|
2828
2844
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
|
|
2829
2845
|
}
|
|
2830
2846
|
function ae(e) {
|
|
@@ -2836,7 +2852,7 @@ function yn(e) {
|
|
|
2836
2852
|
function Go(e) {
|
|
2837
2853
|
return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2838
2854
|
}
|
|
2839
|
-
function
|
|
2855
|
+
function Cr(e) {
|
|
2840
2856
|
return e.creditsRemaining === null ? null : `${Er(e.creditsRemaining)} credits left`;
|
|
2841
2857
|
}
|
|
2842
2858
|
function Er(e) {
|
|
@@ -2868,11 +2884,11 @@ function an(e, t) {
|
|
|
2868
2884
|
(i) => !qo(i)
|
|
2869
2885
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2870
2886
|
}
|
|
2871
|
-
function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u,
|
|
2872
|
-
const R =
|
|
2887
|
+
function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, S, m, I, L) {
|
|
2888
|
+
const R = Nr(r), U = R.filter(
|
|
2873
2889
|
(_) => !qo(_)
|
|
2874
|
-
), ue = e.scrollTop,
|
|
2875
|
-
|
|
2890
|
+
), ue = e.scrollTop, Ce = [], Ve = /* @__PURE__ */ new Set(), D = (_) => {
|
|
2891
|
+
Ce.push(_);
|
|
2876
2892
|
};
|
|
2877
2893
|
Vo(n, r.isThinking), o.hidden = !s, s && l !== null && Oo(o, l);
|
|
2878
2894
|
const Re = U.length > 0 || !!r.assistantDraft || r.isThinking;
|
|
@@ -2881,7 +2897,7 @@ function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, C, m, N, L) {
|
|
|
2881
2897
|
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
|
|
2882
2898
|
const y = document.createElement("div");
|
|
2883
2899
|
y.className = "pluno-pa-widget__empty-hero";
|
|
2884
|
-
const j =
|
|
2900
|
+
const j = Se(
|
|
2885
2901
|
"pluno-pa-widget__character--empty",
|
|
2886
2902
|
P()
|
|
2887
2903
|
);
|
|
@@ -2893,28 +2909,28 @@ function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, C, m, N, L) {
|
|
|
2893
2909
|
const K = u?.prompts ?? r.starterPrompts, ee = document.createElement("div");
|
|
2894
2910
|
if (ee.className = K.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", K.length === 0 && !r.starterPromptsLoading && ee.setAttribute("aria-hidden", "true"), K.length > 0)
|
|
2895
2911
|
for (const v of K) {
|
|
2896
|
-
const
|
|
2897
|
-
|
|
2912
|
+
const N = document.createElement("button");
|
|
2913
|
+
N.type = "button", N.className = "pluno-pa-widget__starter-prompt", N.textContent = `"${v}"`, N.addEventListener("click", () => {
|
|
2898
2914
|
T(v);
|
|
2899
|
-
}), ee.appendChild(
|
|
2915
|
+
}), ee.appendChild(N);
|
|
2900
2916
|
}
|
|
2901
2917
|
else if (r.starterPromptsLoading) {
|
|
2902
2918
|
const v = document.createElement("button");
|
|
2903
2919
|
v.type = "button", v.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", v.disabled = !0, v.tabIndex = -1, v.textContent = "Generating example tasks...", ee.appendChild(v);
|
|
2904
2920
|
} else
|
|
2905
2921
|
for (let v = 0; v < pa; v += 1) {
|
|
2906
|
-
const
|
|
2907
|
-
|
|
2922
|
+
const N = document.createElement("button");
|
|
2923
|
+
N.type = "button", N.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", N.disabled = !0, N.tabIndex = -1, N.textContent = "", ee.appendChild(N);
|
|
2908
2924
|
}
|
|
2909
2925
|
if (_.appendChild(ee), u) {
|
|
2910
2926
|
const v = document.createElement("button");
|
|
2911
|
-
v.type = "button", v.className = "pluno-pa-widget__morning-report-snooze", v.textContent = "Snooze morning report", v.addEventListener("click",
|
|
2927
|
+
v.type = "button", v.className = "pluno-pa-widget__morning-report-snooze", v.textContent = "Snooze morning report", v.addEventListener("click", S), _.appendChild(v);
|
|
2912
2928
|
}
|
|
2913
|
-
h.clear(), D(_), D(t), uo(e,
|
|
2929
|
+
h.clear(), D(_), D(t), uo(e, Ce);
|
|
2914
2930
|
return;
|
|
2915
2931
|
}
|
|
2916
2932
|
let f = null, O = null, Ee = [];
|
|
2917
|
-
const re = U.length - 1,
|
|
2933
|
+
const re = U.length - 1, Ke = re >= 0 && fn(U[re]), H = () => {
|
|
2918
2934
|
if (Ee.length === 0)
|
|
2919
2935
|
return !1;
|
|
2920
2936
|
const _ = Br(
|
|
@@ -2935,19 +2951,19 @@ function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, C, m, N, L) {
|
|
|
2935
2951
|
if (_ !== re)
|
|
2936
2952
|
continue;
|
|
2937
2953
|
if (H()) {
|
|
2938
|
-
const
|
|
2939
|
-
D(
|
|
2954
|
+
const N = Et();
|
|
2955
|
+
D(N), f = null, O = N;
|
|
2940
2956
|
} else {
|
|
2941
|
-
const
|
|
2942
|
-
D(
|
|
2957
|
+
const N = fo(P());
|
|
2958
|
+
D(N), f = null, O = N;
|
|
2943
2959
|
}
|
|
2944
2960
|
continue;
|
|
2945
2961
|
}
|
|
2946
2962
|
if (y.role === "system") {
|
|
2947
2963
|
if (y.dataType === "run_error" || y.dataType === "run_status") {
|
|
2948
2964
|
H();
|
|
2949
|
-
const v = document.createElement("div"),
|
|
2950
|
-
v.className =
|
|
2965
|
+
const v = document.createElement("div"), N = y.dataType === "run_error";
|
|
2966
|
+
v.className = N ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", v.textContent = mo(y.content), D(v), f = N ? v : null, O = N ? null : v;
|
|
2951
2967
|
}
|
|
2952
2968
|
continue;
|
|
2953
2969
|
}
|
|
@@ -2960,14 +2976,14 @@ function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, C, m, N, L) {
|
|
|
2960
2976
|
y,
|
|
2961
2977
|
K,
|
|
2962
2978
|
h,
|
|
2963
|
-
|
|
2964
|
-
|
|
2979
|
+
Ve,
|
|
2980
|
+
I
|
|
2965
2981
|
);
|
|
2966
2982
|
D(ee), f = ee, O = null;
|
|
2967
2983
|
}
|
|
2968
|
-
const
|
|
2969
|
-
if (r.isThinking && !De && !
|
|
2970
|
-
if (
|
|
2984
|
+
const st = H(), De = U[U.length - 1]?.id === "assistant-draft";
|
|
2985
|
+
if (r.isThinking && !De && !Ke)
|
|
2986
|
+
if (st) {
|
|
2971
2987
|
const _ = Et();
|
|
2972
2988
|
D(_), f = null, O = _;
|
|
2973
2989
|
} else {
|
|
@@ -2999,7 +3015,7 @@ function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, M, u, C, m, N, L) {
|
|
|
2999
3015
|
});
|
|
3000
3016
|
D(_), L.onSeen(le), f = null, O = _;
|
|
3001
3017
|
}
|
|
3002
|
-
f?.classList.add("pluno-pa-widget__message--bottom-reserve"), O?.classList.add("pluno-pa-widget__bottom-reserve-compact"), D(t), Tr(h,
|
|
3018
|
+
f?.classList.add("pluno-pa-widget__message--bottom-reserve"), O?.classList.add("pluno-pa-widget__bottom-reserve-compact"), D(t), Tr(h, Ve), uo(e, Ce), p ? rt(e, g) : e.scrollTop = ue;
|
|
3003
3019
|
}
|
|
3004
3020
|
function Lr(e, t, n, i, o) {
|
|
3005
3021
|
const r = Pr(e, t), l = r ? n.get(r) : void 0;
|
|
@@ -3007,13 +3023,13 @@ function Lr(e, t, n, i, o) {
|
|
|
3007
3023
|
return l.classList.remove("pluno-pa-widget__message--bottom-reserve"), i.add(r), l;
|
|
3008
3024
|
const s = document.createElement("div");
|
|
3009
3025
|
s.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Wr(s, t) : s.textContent = t, e.role === "user" && e.attachments?.length && s.appendChild(
|
|
3010
|
-
|
|
3026
|
+
Ar(
|
|
3011
3027
|
e.attachments,
|
|
3012
3028
|
o
|
|
3013
3029
|
)
|
|
3014
3030
|
);
|
|
3015
3031
|
const p = document.createElement("div");
|
|
3016
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
3032
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(Ir(t)), s.appendChild(p), r && (n.set(r, s), i.add(r)), s;
|
|
3017
3033
|
}
|
|
3018
3034
|
function Pr(e, t) {
|
|
3019
3035
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
@@ -3051,7 +3067,7 @@ function uo(e, t) {
|
|
|
3051
3067
|
n = n.nextSibling, e.removeChild(i);
|
|
3052
3068
|
}
|
|
3053
3069
|
}
|
|
3054
|
-
function
|
|
3070
|
+
function Nr(e) {
|
|
3055
3071
|
if (!e.assistantDraft)
|
|
3056
3072
|
return [...e.messages];
|
|
3057
3073
|
const t = {
|
|
@@ -3098,7 +3114,7 @@ function ho(e, t, n, i, o, r, l, s) {
|
|
|
3098
3114
|
e.replaceChildren(), Vo(t, !1), t.disabled = !0, n(!1);
|
|
3099
3115
|
const p = document.createElement("div");
|
|
3100
3116
|
p.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
3101
|
-
const g =
|
|
3117
|
+
const g = Se(
|
|
3102
3118
|
"pluno-pa-widget__character--empty",
|
|
3103
3119
|
i()
|
|
3104
3120
|
);
|
|
@@ -3113,7 +3129,7 @@ function ho(e, t, n, i, o, r, l, s) {
|
|
|
3113
3129
|
}
|
|
3114
3130
|
e.appendChild(p);
|
|
3115
3131
|
}
|
|
3116
|
-
function
|
|
3132
|
+
function Ar(e, t) {
|
|
3117
3133
|
const n = document.createElement("div");
|
|
3118
3134
|
n.className = "pluno-pa-widget__message-attachments";
|
|
3119
3135
|
for (const i of e)
|
|
@@ -3125,7 +3141,7 @@ function Ir(e, t) {
|
|
|
3125
3141
|
);
|
|
3126
3142
|
return n;
|
|
3127
3143
|
}
|
|
3128
|
-
function
|
|
3144
|
+
function Ir(e) {
|
|
3129
3145
|
const t = document.createElement("button");
|
|
3130
3146
|
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(mr()), t.addEventListener("click", (n) => {
|
|
3131
3147
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
@@ -3136,7 +3152,7 @@ function Rr(e, t) {
|
|
|
3136
3152
|
n.className = "pluno-pa-widget__share-prompt";
|
|
3137
3153
|
const i = document.createElement("div");
|
|
3138
3154
|
i.className = "pluno-pa-widget__share-prompt-body", i.appendChild(
|
|
3139
|
-
|
|
3155
|
+
Se(
|
|
3140
3156
|
"pluno-pa-widget__share-prompt-icon",
|
|
3141
3157
|
t.characterIconOptions
|
|
3142
3158
|
)
|
|
@@ -3204,8 +3220,8 @@ function Dr(e, t) {
|
|
|
3204
3220
|
if (g.appendChild(h), p.appendChild(g), e.screenshotDataUrl) {
|
|
3205
3221
|
const u = document.createElement("div");
|
|
3206
3222
|
u.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
3207
|
-
const
|
|
3208
|
-
|
|
3223
|
+
const S = document.createElement("img");
|
|
3224
|
+
S.src = e.screenshotDataUrl, S.alt = "Product page with Pluno open", u.appendChild(S), p.appendChild(u);
|
|
3209
3225
|
}
|
|
3210
3226
|
i.appendChild(p), i.appendChild(s);
|
|
3211
3227
|
const E = document.createElement("div");
|
|
@@ -3217,14 +3233,14 @@ function Dr(e, t) {
|
|
|
3217
3233
|
const M = document.createElement("footer");
|
|
3218
3234
|
M.className = "pluno-pa-widget__share-dialog-platforms";
|
|
3219
3235
|
for (const u of Mr(e)) {
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3236
|
+
const S = document.createElement("a");
|
|
3237
|
+
S.href = u.href, S.target = "_blank", S.rel = "noopener noreferrer", S.title = u.label, S.setAttribute("aria-label", `Open ${u.label}`), S.appendChild(Or(u.id)), M.appendChild(S);
|
|
3222
3238
|
}
|
|
3223
3239
|
if (E.appendChild(M), i.appendChild(E), t.socialPostRewardsUrl) {
|
|
3224
3240
|
const u = document.createElement("div");
|
|
3225
3241
|
u.className = "pluno-pa-widget__share-dialog-step";
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3242
|
+
const S = document.createElement("strong");
|
|
3243
|
+
S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(S);
|
|
3228
3244
|
const m = document.createElement("a");
|
|
3229
3245
|
m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Ur()), u.appendChild(m), i.appendChild(u);
|
|
3230
3246
|
}
|
|
@@ -3291,7 +3307,7 @@ function Ur() {
|
|
|
3291
3307
|
), e;
|
|
3292
3308
|
}
|
|
3293
3309
|
function qo(e) {
|
|
3294
|
-
return e.role === "tool" && e.toolName ===
|
|
3310
|
+
return e.role === "tool" && e.toolName === Co;
|
|
3295
3311
|
}
|
|
3296
3312
|
function mo(e) {
|
|
3297
3313
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
@@ -3301,7 +3317,7 @@ function Br(e, t, n, i) {
|
|
|
3301
3317
|
o.className = "pluno-pa-widget__tool-group", o.title = new Date(
|
|
3302
3318
|
e[e.length - 1].createdAt
|
|
3303
3319
|
).toLocaleString(), o.appendChild(
|
|
3304
|
-
|
|
3320
|
+
Se(
|
|
3305
3321
|
"pluno-pa-widget__character--tool-group",
|
|
3306
3322
|
i
|
|
3307
3323
|
)
|
|
@@ -3329,7 +3345,7 @@ function Br(e, t, n, i) {
|
|
|
3329
3345
|
function jo(e) {
|
|
3330
3346
|
const t = document.createElement("article");
|
|
3331
3347
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3332
|
-
|
|
3348
|
+
Se(
|
|
3333
3349
|
"pluno-pa-widget__character--tool-group",
|
|
3334
3350
|
e
|
|
3335
3351
|
)
|
|
@@ -3381,14 +3397,14 @@ function Wr(e, t) {
|
|
|
3381
3397
|
const l = o.match(/^(#{1,3})\s+(.+)$/);
|
|
3382
3398
|
if (l) {
|
|
3383
3399
|
const c = document.createElement(`h${l[1].length + 2}`);
|
|
3384
|
-
|
|
3400
|
+
je(c, l[2]), e.appendChild(c), i += 1;
|
|
3385
3401
|
continue;
|
|
3386
3402
|
}
|
|
3387
3403
|
if (/^\s*[-*+]\s+/.test(o)) {
|
|
3388
3404
|
const c = document.createElement("ul");
|
|
3389
3405
|
for (; i < n.length && /^\s*[-*+]\s+/.test(n[i]); ) {
|
|
3390
3406
|
const h = document.createElement("li");
|
|
3391
|
-
|
|
3407
|
+
je(h, n[i].replace(/^\s*[-*+]\s+/, "")), c.appendChild(h), i += 1;
|
|
3392
3408
|
}
|
|
3393
3409
|
e.appendChild(c);
|
|
3394
3410
|
continue;
|
|
@@ -3398,7 +3414,7 @@ function Wr(e, t) {
|
|
|
3398
3414
|
const c = document.createElement("ol");
|
|
3399
3415
|
for (c.start = Number(s[1]); i < n.length && /^\s*\d+\.\s+/.test(n[i]); ) {
|
|
3400
3416
|
const h = document.createElement("li");
|
|
3401
|
-
|
|
3417
|
+
je(h, n[i].replace(/^\s*\d+\.\s+/, "")), c.appendChild(h), i += 1;
|
|
3402
3418
|
}
|
|
3403
3419
|
e.appendChild(c);
|
|
3404
3420
|
continue;
|
|
@@ -3408,11 +3424,11 @@ function Wr(e, t) {
|
|
|
3408
3424
|
p.push(n[i]), i += 1;
|
|
3409
3425
|
const g = document.createElement("p");
|
|
3410
3426
|
p.forEach((c, h) => {
|
|
3411
|
-
h > 0 && g.appendChild(document.createElement("br")),
|
|
3427
|
+
h > 0 && g.appendChild(document.createElement("br")), je(g, c);
|
|
3412
3428
|
}), e.appendChild(g);
|
|
3413
3429
|
}
|
|
3414
3430
|
}
|
|
3415
|
-
function
|
|
3431
|
+
function je(e, t) {
|
|
3416
3432
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
3417
3433
|
let i = 0;
|
|
3418
3434
|
for (const o of t.matchAll(n)) {
|
|
@@ -3426,10 +3442,10 @@ function _t(e, t) {
|
|
|
3426
3442
|
s.textContent = l.slice(1, -1), e.appendChild(s);
|
|
3427
3443
|
} else if (l.startsWith("**")) {
|
|
3428
3444
|
const s = document.createElement("strong");
|
|
3429
|
-
s
|
|
3445
|
+
je(s, l.slice(2, -2)), e.appendChild(s);
|
|
3430
3446
|
} else if (l.startsWith("*")) {
|
|
3431
3447
|
const s = document.createElement("em");
|
|
3432
|
-
s
|
|
3448
|
+
je(s, l.slice(1, -1)), e.appendChild(s);
|
|
3433
3449
|
} else {
|
|
3434
3450
|
const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3435
3451
|
if (s && Hr(s[2])) {
|