@pluno/product-agent-web 0.1.105 → 0.1.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-sdk.js +1 -1
- package/dist/product-agent-widget.js +922 -918
- package/dist/widget.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { PlunoProductAgent as yi, getProductAgentOriginAccessErrorMessage as vi } from "./product-agent-sdk.js";
|
|
2
|
-
const Si = "#7c3aed",
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
2
|
+
const Si = "#7c3aed", kt = "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", Lt = "#2c2a1e", Gn = [253, 250, 241], $n = 3.5;
|
|
3
|
+
function Lo(e) {
|
|
4
|
+
const t = Po(e);
|
|
5
|
+
if (qn(dt(t), Gn) >= $n)
|
|
6
6
|
return t;
|
|
7
7
|
let i = dt(t);
|
|
8
|
-
const o = dt(
|
|
8
|
+
const o = dt(Lt);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
|
-
if (i = ki(i, o, 0.22),
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (i = ki(i, o, 0.22), qn(i, Gn) >= $n)
|
|
11
|
+
return dn(i);
|
|
12
|
+
return dn(i);
|
|
13
13
|
}
|
|
14
14
|
function Ci() {
|
|
15
15
|
let n = "M 280 120", i = !1, o = 0;
|
|
@@ -20,7 +20,7 @@ function Ci() {
|
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
22
|
function Ei(e) {
|
|
23
|
-
const t =
|
|
23
|
+
const t = Po(e), n = cn(dt(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,7 +56,7 @@ function Ei(e) {
|
|
|
56
56
|
shadow: pe(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Po(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()}` : Si;
|
|
62
62
|
}
|
|
@@ -67,23 +67,23 @@ function dt(e) {
|
|
|
67
67
|
Number.parseInt(e.slice(5, 7), 16)
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function dn([e, t, n]) {
|
|
71
71
|
const i = (o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0");
|
|
72
72
|
return `#${i(e)}${i(t)}${i(n)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function cn([e, t, n]) {
|
|
75
75
|
const i = (o) => {
|
|
76
76
|
const r = o / 255;
|
|
77
77
|
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const n =
|
|
81
|
+
function qn(e, t) {
|
|
82
|
+
const n = cn(e), i = cn(t), [o, r] = n > i ? [n, i] : [i, n];
|
|
83
83
|
return (o + 0.05) / (r + 0.05);
|
|
84
84
|
}
|
|
85
85
|
function ki(e, t, n) {
|
|
86
|
-
const i =
|
|
86
|
+
const i = un(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * i,
|
|
89
89
|
e[1] + (t[1] - e[1]) * i,
|
|
@@ -92,7 +92,7 @@ function ki(e, t, n) {
|
|
|
92
92
|
}
|
|
93
93
|
function pe(e, t, n) {
|
|
94
94
|
const [i, o, r] = Li(dt(e));
|
|
95
|
-
return
|
|
95
|
+
return dn(Pi(i, un(o + n), un(r + t)));
|
|
96
96
|
}
|
|
97
97
|
function Li([e, t, n]) {
|
|
98
98
|
const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), p = Math.min(i, o, r), s = (l + p) / 2;
|
|
@@ -106,28 +106,28 @@ function Pi(e, t, n) {
|
|
|
106
106
|
return [n * 255, n * 255, n * 255];
|
|
107
107
|
const i = n < 0.5 ? n * (1 + t) : n + t - n * t, o = 2 * n - i;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
Jt(o, i, e + 1 / 3) * 255,
|
|
110
|
+
Jt(o, i, e) * 255,
|
|
111
|
+
Jt(o, i, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Jt(e, t, n) {
|
|
115
115
|
let i = n;
|
|
116
116
|
return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? e + (t - e) * 6 * i : i < 1 / 2 ? t : i < 2 / 3 ? e + (t - e) * (2 / 3 - i) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function un(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const Ao = "suggest_share_on_socials";
|
|
122
122
|
function Ai(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 !== Ao)
|
|
126
126
|
continue;
|
|
127
|
-
const i =
|
|
127
|
+
const i = jn(e, t, "assistant");
|
|
128
128
|
if (!i)
|
|
129
129
|
return null;
|
|
130
|
-
const o =
|
|
130
|
+
const o = jn(e, i.index, "user");
|
|
131
131
|
return o ? {
|
|
132
132
|
id: `share:${n.callId ?? n.id}`,
|
|
133
133
|
userPrompt: o.content,
|
|
@@ -142,7 +142,7 @@ async function Ti(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 jn(e, t, n) {
|
|
146
146
|
for (let i = t - 1; i >= 0; i -= 1) {
|
|
147
147
|
const o = e[i];
|
|
148
148
|
if (o.role === n && o.content.trim())
|
|
@@ -173,8 +173,8 @@ function Bi(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
i = Math.round(h + (c - h) * Gi(
|
|
176
|
+
const P = Math.min(1, (performance.now() - C) / Di);
|
|
177
|
+
i = Math.round(h + (c - h) * Gi(P)), e(i), P >= 1 && (i = c, e(c), l());
|
|
178
178
|
}, Mi);
|
|
179
179
|
}, g = async () => {
|
|
180
180
|
try {
|
|
@@ -199,12 +199,12 @@ async function Fi(e) {
|
|
|
199
199
|
});
|
|
200
200
|
if (!n.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const i = await n.json(), o =
|
|
202
|
+
const i = await n.json(), o = Vn(i.count), r = Vn(i.refreshAfterMs ?? i.refresh_after_ms);
|
|
203
203
|
if (o === null || r === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: o, refreshAfterMs: r };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Vn(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
210
|
function Wi(e) {
|
|
@@ -271,7 +271,7 @@ function Xi(e) {
|
|
|
271
271
|
}
|
|
272
272
|
const r = o.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
273
273
|
if (r) {
|
|
274
|
-
t +=
|
|
274
|
+
t += Kn(n) + o, n = "", i = {
|
|
275
275
|
marker: r[1][0],
|
|
276
276
|
length: r[1].length
|
|
277
277
|
};
|
|
@@ -279,19 +279,19 @@ function Xi(e) {
|
|
|
279
279
|
}
|
|
280
280
|
n += o;
|
|
281
281
|
}
|
|
282
|
-
return t +
|
|
282
|
+
return t + Kn(n);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Kn(e) {
|
|
285
285
|
let t = "", n = 0;
|
|
286
286
|
for (const i of e.matchAll(Yi)) {
|
|
287
287
|
const o = i.index ?? 0;
|
|
288
|
-
t +=
|
|
288
|
+
t += Yn(
|
|
289
289
|
e.slice(n, o)
|
|
290
290
|
), t += i[0], n = o + i[0].length;
|
|
291
291
|
}
|
|
292
|
-
return t +
|
|
292
|
+
return t + Yn(e.slice(n));
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function Yn(e) {
|
|
295
295
|
return e.replace(
|
|
296
296
|
/\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
|
|
297
297
|
(t, n, i, o, r) => r[o - 1] === "!" || Zi(r, o) || Ji(r, o, n) ? t : `[${n}](${i})`
|
|
@@ -312,7 +312,7 @@ function Ji(e, t, n) {
|
|
|
312
312
|
e.slice(i, t)
|
|
313
313
|
);
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const To = 100, Qi = 1e4, ea = 5e3, ta = "product-agent:sdk-preview-socket-connect", na = "product-agent:sdk-preview-socket-send", oa = "product-agent:sdk-preview-socket-close", ia = "product-agent:sdk-preview-socket-open", aa = "product-agent:sdk-preview-socket-message", ra = "product-agent:sdk-preview-socket-error", la = "product-agent:sdk-preview-socket-closed", Xn = "product-agent:sdk-preview-socket-id", sa = "data-pluno-sdk-preview-channel", No = "data-pluno-auto-mounted", ve = "__plunoProductAgentAutoMountOwner", pa = 1e4, da = "Failed to load Pluno widget token", Zn = "Timed out loading Pluno widget token", ca = "pluno.productAgent.widgetClientId.", Qt = /* @__PURE__ */ new Set(), ua = "product-agent:preview-diagnostic", Io = "pluno.productAgent.sharePromptsDisabled", ga = 3, Jn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ha = 400, ma = 5e3, fa = 500, Qn = "Close the page's popup to chat", wa = "No recent chats for this page yet.", de = {
|
|
316
316
|
launcherLabel: "Ask for anything...",
|
|
317
317
|
accentColor: "#7c3aed",
|
|
318
318
|
colorScheme: "light",
|
|
@@ -320,7 +320,7 @@ const Ao = 100, Qi = 1e4, ea = 5e3, ta = "product-agent:sdk-preview-socket-conne
|
|
|
320
320
|
scribbleStyle: !0,
|
|
321
321
|
position: "bottom-right",
|
|
322
322
|
movableLauncher: !0
|
|
323
|
-
}, ba = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive',
|
|
323
|
+
}, ba = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', eo = "pluno-pa-scribble-font", Ro = 190, Do = 41, to = 22, _a = 1, xa = 48, vn = 420, ya = 520, va = 0.24, Sn = 680, Sa = 800, Ca = 0.76, I = 8, Oe = 50, zo = "http://www.w3.org/2000/svg", gn = 26, hn = 8, Ea = 36, mn = 16, ka = 4, no = [
|
|
324
324
|
{
|
|
325
325
|
ellipseCx: "17.5",
|
|
326
326
|
ellipseCy: "24.5",
|
|
@@ -357,10 +357,10 @@ const Ao = 100, Qi = 1e4, ea = 5e3, ta = "product-agent:sdk-preview-socket-conne
|
|
|
357
357
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
358
358
|
pathStrokeWidth: "2.45"
|
|
359
359
|
}
|
|
360
|
-
], La = 11, Pa = 13,
|
|
361
|
-
let
|
|
360
|
+
], La = 11, Pa = 13, fn = 4, Mo = 10, Oo = 40, Aa = "movable-launcher-position-v2", Uo = "pluno-pa-widget-styles", Bo = "data-pluno-pa-widget-styles";
|
|
361
|
+
let oo = 0;
|
|
362
362
|
function Ta(e) {
|
|
363
|
-
return (t) => new
|
|
363
|
+
return (t) => new Se(t, e);
|
|
364
364
|
}
|
|
365
365
|
async function Na(e = {}) {
|
|
366
366
|
const t = {
|
|
@@ -417,7 +417,7 @@ async function Na(e = {}) {
|
|
|
417
417
|
integrationAuthStatusLoader: e.integrationAuthStatusLoader,
|
|
418
418
|
integrationAuthHandler: e.integrationAuthHandler
|
|
419
419
|
};
|
|
420
|
-
|
|
420
|
+
J(
|
|
421
421
|
"web-sdk.widget",
|
|
422
422
|
"Mounting widget with merged options",
|
|
423
423
|
{
|
|
@@ -439,7 +439,7 @@ async function Na(e = {}) {
|
|
|
439
439
|
);
|
|
440
440
|
const i = n.attachShadow({ mode: "open" }), o = document.createElement("div");
|
|
441
441
|
o.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, o.classList.add(`pluno-pa-widget--layout-${t.layout}`), o.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
442
|
-
let r =
|
|
442
|
+
let r = io(
|
|
443
443
|
t.accentColor,
|
|
444
444
|
t.scribbleStyle
|
|
445
445
|
);
|
|
@@ -451,22 +451,22 @@ async function Na(e = {}) {
|
|
|
451
451
|
t.showLauncherMinimizeButton
|
|
452
452
|
), i.appendChild(o);
|
|
453
453
|
const l = Qr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Zr(t) : "shown";
|
|
454
|
-
|
|
454
|
+
So(t, p);
|
|
455
455
|
let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
|
|
456
|
-
o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (o.classList.add("pluno-pa-widget--minimized"),
|
|
456
|
+
o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (o.classList.add("pluno-pa-widget--minimized"), Me(
|
|
457
457
|
o,
|
|
458
|
-
|
|
458
|
+
tn(
|
|
459
459
|
o,
|
|
460
460
|
s,
|
|
461
461
|
t.position
|
|
462
462
|
)
|
|
463
|
-
)),
|
|
463
|
+
)), vo(i, t.accentColor), ao(o, r, {
|
|
464
464
|
accentColor: t.accentColor,
|
|
465
465
|
colorScheme: t.colorScheme,
|
|
466
466
|
fontFamily: t.fontFamily,
|
|
467
467
|
scribbleStyle: t.scribbleStyle
|
|
468
468
|
});
|
|
469
|
-
const C = t.mountTarget ?? await Xr(),
|
|
469
|
+
const C = t.mountTarget ?? await Xr(), P = C.ownerDocument, A = o.querySelector(
|
|
470
470
|
".pluno-pa-widget__launcher"
|
|
471
471
|
), O = o.querySelector(
|
|
472
472
|
".pluno-pa-widget__launcher-drag-handle"
|
|
@@ -474,19 +474,19 @@ async function Na(e = {}) {
|
|
|
474
474
|
".pluno-pa-widget__launcher-input"
|
|
475
475
|
), S = o.querySelector(
|
|
476
476
|
".pluno-pa-widget__launcher-minimize"
|
|
477
|
-
), m = o.querySelector(".pluno-pa-widget__panel"),
|
|
477
|
+
), m = o.querySelector(".pluno-pa-widget__panel"), R = o.querySelector(
|
|
478
478
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
479
479
|
), z = Array.from(
|
|
480
480
|
o.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
481
481
|
), k = o.querySelector(
|
|
482
482
|
".pluno-pa-widget__close"
|
|
483
|
-
),
|
|
483
|
+
), ne = o.querySelector(
|
|
484
484
|
".pluno-pa-widget__composer"
|
|
485
|
-
),
|
|
485
|
+
), G = o.querySelector(
|
|
486
486
|
".pluno-pa-widget__attachment-error"
|
|
487
487
|
), Ze = o.querySelector(
|
|
488
488
|
".pluno-pa-widget__billing-status"
|
|
489
|
-
),
|
|
489
|
+
), Ue = o.querySelector(
|
|
490
490
|
".pluno-pa-widget__attachments"
|
|
491
491
|
), ge = o.querySelector(
|
|
492
492
|
".pluno-pa-widget__attachment-input"
|
|
@@ -496,76 +496,76 @@ async function Na(e = {}) {
|
|
|
496
496
|
".pluno-pa-widget__input"
|
|
497
497
|
), B = o.querySelector(
|
|
498
498
|
".pluno-pa-widget__send"
|
|
499
|
-
),
|
|
499
|
+
), j = o.querySelector(
|
|
500
500
|
".pluno-pa-widget__top-actions"
|
|
501
|
-
),
|
|
501
|
+
), oe = o.querySelector(
|
|
502
502
|
".pluno-pa-widget__history"
|
|
503
|
-
),
|
|
503
|
+
), Te = o.querySelector(
|
|
504
504
|
".pluno-pa-widget__history-panel"
|
|
505
505
|
), Y = o.querySelector(
|
|
506
506
|
".pluno-pa-widget__history-list"
|
|
507
|
-
),
|
|
507
|
+
), ct = o.querySelector(
|
|
508
508
|
".pluno-pa-widget__history-close"
|
|
509
|
-
),
|
|
509
|
+
), he = o.querySelector(
|
|
510
510
|
".pluno-pa-widget__history-status"
|
|
511
|
-
),
|
|
511
|
+
), me = o.querySelector(
|
|
512
512
|
".pluno-pa-widget__timeline-jump"
|
|
513
|
-
),
|
|
513
|
+
), Be = o.querySelector(
|
|
514
514
|
".pluno-pa-widget__active-users-counter"
|
|
515
|
-
),
|
|
515
|
+
), F = o.querySelector(
|
|
516
516
|
".pluno-pa-widget__timeline"
|
|
517
|
-
),
|
|
517
|
+
), fe = o.querySelector(
|
|
518
518
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
519
|
-
),
|
|
519
|
+
), _ = o.querySelector(
|
|
520
520
|
".pluno-pa-widget__notify-suggestion"
|
|
521
|
-
),
|
|
521
|
+
), L = o.querySelector(
|
|
522
522
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
523
|
-
),
|
|
523
|
+
), W = o.querySelector(
|
|
524
524
|
".pluno-pa-widget__notify-suggestion-later"
|
|
525
|
-
),
|
|
525
|
+
), Ce = o.querySelector(
|
|
526
526
|
".pluno-pa-widget__notify-suggestion-never"
|
|
527
|
-
),
|
|
527
|
+
), $ = o.querySelector(
|
|
528
528
|
".pluno-pa-widget__tab-groups-suggestion"
|
|
529
|
-
),
|
|
529
|
+
), v = o.querySelector(
|
|
530
530
|
".pluno-pa-widget__tab-groups-suggestion-enable"
|
|
531
|
-
),
|
|
531
|
+
), T = o.querySelector(
|
|
532
532
|
".pluno-pa-widget__tab-groups-suggestion-dismiss"
|
|
533
533
|
);
|
|
534
|
-
if (!
|
|
534
|
+
if (!A || !u || !m || !k || !ne || !G || !Ze || !Ue || !ge || !U || !x || !B || !j || !oe || !Te || !Y || !ct || !he || !me || !Be || !F || !fe)
|
|
535
535
|
throw new Error("Failed to mount Pluno widget");
|
|
536
536
|
if (t.movableLauncher && !O)
|
|
537
537
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
538
|
-
U.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled,
|
|
539
|
-
let
|
|
540
|
-
const
|
|
538
|
+
U.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, go(u), go(x);
|
|
539
|
+
let D = [], we = null;
|
|
540
|
+
const Ee = () => Ki(
|
|
541
541
|
x,
|
|
542
|
-
o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !
|
|
542
|
+
o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !se(t.billingStatus)
|
|
543
543
|
), Fe = () => {
|
|
544
544
|
xr(
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
Ue,
|
|
546
|
+
D,
|
|
547
547
|
(a) => {
|
|
548
|
-
|
|
549
|
-
(d,
|
|
550
|
-
), Fe(), M(
|
|
548
|
+
D = D.filter(
|
|
549
|
+
(d, f) => f !== a
|
|
550
|
+
), Fe(), M(w.getState()), V(), Ee();
|
|
551
551
|
}
|
|
552
552
|
);
|
|
553
|
-
},
|
|
554
|
-
if (!t.loginRequired && !t.signupRequired && !t.token && !
|
|
553
|
+
}, Ln = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => ti(t.tokenEndpoint) : void 0);
|
|
554
|
+
if (!t.loginRequired && !t.signupRequired && !t.token && !Ln && !t.webSocketFactory)
|
|
555
555
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
556
|
-
const oi = window.fetch.bind(window),
|
|
557
|
-
let
|
|
556
|
+
const oi = window.fetch.bind(window), It = Jr(t.clientId);
|
|
557
|
+
let w;
|
|
558
558
|
try {
|
|
559
559
|
const a = {
|
|
560
560
|
token: t.token,
|
|
561
|
-
tokenProvider:
|
|
561
|
+
tokenProvider: Ln,
|
|
562
562
|
backendUrl: t.backendUrl,
|
|
563
563
|
metadata: () => ({
|
|
564
564
|
...t.metadata ?? {},
|
|
565
|
-
...!
|
|
565
|
+
...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
566
566
|
}),
|
|
567
567
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
568
|
-
clientId:
|
|
568
|
+
clientId: It.clientId,
|
|
569
569
|
restorePersistedState: t.restorePersistedState,
|
|
570
570
|
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
571
571
|
keepRunsActiveOnSessionNavigation: t.keepRunsActiveOnSessionNavigation,
|
|
@@ -576,11 +576,11 @@ async function Na(e = {}) {
|
|
|
576
576
|
autoConnect: !1,
|
|
577
577
|
disableNetworkCapture: !!t.sdkPreviewChannelId
|
|
578
578
|
};
|
|
579
|
-
|
|
579
|
+
w = await yi.init(a);
|
|
580
580
|
} catch (a) {
|
|
581
|
-
throw
|
|
581
|
+
throw It.release(), n.remove(), a;
|
|
582
582
|
}
|
|
583
|
-
C.appendChild(n),
|
|
583
|
+
C.appendChild(n), J(
|
|
584
584
|
"web-sdk.widget",
|
|
585
585
|
"Applied initial widget appearance",
|
|
586
586
|
{
|
|
@@ -590,56 +590,56 @@ async function Na(e = {}) {
|
|
|
590
590
|
cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
|
|
591
591
|
}
|
|
592
592
|
);
|
|
593
|
-
const
|
|
593
|
+
const Rt = new Set(l.openToolGroupKeys), We = new Set(
|
|
594
594
|
l.seenShareCandidateIds
|
|
595
|
-
),
|
|
596
|
-
let
|
|
595
|
+
), ut = new Set(We);
|
|
596
|
+
let Dt = l.sharePromptsDisabled || await el(t), ie = null, X = !1, gt = !(t.loginRequired || t.signupRequired), ke = !1, Ne = {
|
|
597
597
|
enabled: !0
|
|
598
|
-
},
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
},
|
|
602
|
-
|
|
598
|
+
}, Ie = 0, Pn = "", Z = !1, be = !1, Le = [], zt = null, Je = null;
|
|
599
|
+
const ae = (a, d) => {
|
|
600
|
+
Ne = { enabled: a, reason: d };
|
|
601
|
+
}, re = () => {
|
|
602
|
+
me.hidden = !0;
|
|
603
603
|
}, ii = () => {
|
|
604
|
-
|
|
604
|
+
me.hidden = !1;
|
|
605
605
|
}, ai = (a = "jump") => {
|
|
606
|
-
|
|
607
|
-
},
|
|
608
|
-
if (
|
|
606
|
+
ae(!0, a), re(), pt(F, () => Ne.enabled), Ie = F.scrollTop;
|
|
607
|
+
}, _e = () => {
|
|
608
|
+
if (oe.hidden = t.layout === "page" || t.loginRequired, Te.hidden = !Z, oe.setAttribute("aria-expanded", String(Z)), Y.classList.toggle(
|
|
609
609
|
"pluno-pa-widget__history-list--center",
|
|
610
|
-
|
|
611
|
-
), Y.replaceChildren(),
|
|
610
|
+
be && Le.length === 0
|
|
611
|
+
), Y.replaceChildren(), be && Le.length === 0) {
|
|
612
612
|
const a = document.createElement("p");
|
|
613
613
|
a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", Y.appendChild(a);
|
|
614
614
|
}
|
|
615
|
-
for (const a of
|
|
615
|
+
for (const a of Le) {
|
|
616
616
|
const d = document.createElement("button");
|
|
617
|
-
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled =
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
|
|
617
|
+
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = be;
|
|
618
|
+
const f = document.createElement("span");
|
|
619
|
+
f.className = "pluno-pa-widget__history-item-title", f.textContent = Za(a);
|
|
620
|
+
const y = document.createElement("time");
|
|
621
|
+
y.className = "pluno-pa-widget__history-time", y.dateTime = a.lastActiveAt, y.textContent = Qa(
|
|
622
622
|
a.lastActiveAt,
|
|
623
623
|
Date.now()
|
|
624
624
|
);
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
|
|
625
|
+
const N = document.createElement("small");
|
|
626
|
+
N.className = "pluno-pa-widget__history-path", N.textContent = Ja(a), d.append(f, y, N), d.addEventListener("click", () => {
|
|
627
|
+
Z = !1, Je = null, _e(), ae(!0, "newSession"), re(), w.loadSession(a.id), M(w.getState()), Ee();
|
|
628
628
|
}), Y.appendChild(d);
|
|
629
629
|
}
|
|
630
|
-
if (
|
|
630
|
+
if (be && Le.length > 0) {
|
|
631
631
|
const a = document.createElement("p");
|
|
632
632
|
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", Y.appendChild(a);
|
|
633
633
|
}
|
|
634
|
-
|
|
635
|
-
},
|
|
636
|
-
if (!
|
|
637
|
-
|
|
634
|
+
he.textContent = Je ?? (!be && Le.length === 0 ? "No recent chats for this page yet." : ""), he.hidden = he.textContent.length === 0;
|
|
635
|
+
}, An = async (a) => {
|
|
636
|
+
if (!be) {
|
|
637
|
+
be = !0, Je = null, _e();
|
|
638
638
|
try {
|
|
639
|
-
const d = await
|
|
640
|
-
|
|
639
|
+
const d = await w.listSessions({ cursor: a, limit: 20 });
|
|
640
|
+
Le = a ? [...Le, ...d.sessions] : d.sessions, zt = d.nextCursor;
|
|
641
641
|
} catch (d) {
|
|
642
|
-
|
|
642
|
+
J(
|
|
643
643
|
"web-sdk.widget",
|
|
644
644
|
"Failed to load session history",
|
|
645
645
|
{
|
|
@@ -647,60 +647,60 @@ async function Na(e = {}) {
|
|
|
647
647
|
}
|
|
648
648
|
), Je = wa;
|
|
649
649
|
} finally {
|
|
650
|
-
|
|
650
|
+
be = !1, _e();
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
}, ri = () => {
|
|
654
|
-
!
|
|
655
|
-
},
|
|
656
|
-
|
|
657
|
-
},
|
|
658
|
-
|
|
654
|
+
!zt || be || Y.scrollHeight - Y.scrollTop - Y.clientHeight <= 24 && An(zt);
|
|
655
|
+
}, Tn = () => {
|
|
656
|
+
X || typeof document > "u" || (vo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
|
|
657
|
+
}, Nn = new MutationObserver(Tn);
|
|
658
|
+
Nn.observe(P.documentElement, {
|
|
659
659
|
childList: !0,
|
|
660
660
|
subtree: !0
|
|
661
|
-
}),
|
|
661
|
+
}), Tn();
|
|
662
662
|
const Qe = (a = !0) => {
|
|
663
|
-
const d =
|
|
664
|
-
return
|
|
663
|
+
const d = Pt(o, a);
|
|
664
|
+
return wn(
|
|
665
665
|
o,
|
|
666
|
-
s ?
|
|
666
|
+
s ? Fo(s, d) : Ba(
|
|
667
667
|
o,
|
|
668
668
|
t.position,
|
|
669
669
|
d
|
|
670
670
|
),
|
|
671
671
|
d
|
|
672
672
|
);
|
|
673
|
-
},
|
|
673
|
+
}, q = () => {
|
|
674
674
|
const a = ja(i, u, x);
|
|
675
675
|
nl(t, {
|
|
676
676
|
isOpen: o.classList.contains("pluno-pa-widget--open"),
|
|
677
677
|
composerValue: x.value,
|
|
678
678
|
focusedInput: a,
|
|
679
679
|
focusedInputAt: a ? Date.now() : null,
|
|
680
|
-
openToolGroupKeys: [...
|
|
680
|
+
openToolGroupKeys: [...Rt],
|
|
681
681
|
launcherPosition: g ? s : null,
|
|
682
682
|
panelSize: c,
|
|
683
683
|
seenShareCandidateIds: [...We].slice(
|
|
684
|
-
-
|
|
684
|
+
-To
|
|
685
685
|
),
|
|
686
|
-
sharePromptsDisabled:
|
|
686
|
+
sharePromptsDisabled: Dt
|
|
687
687
|
});
|
|
688
|
-
},
|
|
688
|
+
}, ht = (a) => {
|
|
689
689
|
t.onDisplayStateChange?.(a);
|
|
690
690
|
}, et = (a, d = !0) => {
|
|
691
|
-
if (
|
|
692
|
-
o.classList.remove("pluno-pa-widget--minimized"),
|
|
691
|
+
if (So(t, a), a === "shown") {
|
|
692
|
+
o.classList.remove("pluno-pa-widget--minimized"), A.removeAttribute("tabindex"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && tt(!1), d && ht("shown");
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
|
-
|
|
695
|
+
ie !== null && (window.clearTimeout(ie), ie = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), A.hidden = !1, m.hidden = !0, k.hidden = !0, A.tabIndex = 0, x.value = "", Me(
|
|
696
696
|
o,
|
|
697
|
-
|
|
697
|
+
tn(
|
|
698
698
|
o,
|
|
699
699
|
s,
|
|
700
700
|
t.position
|
|
701
701
|
)
|
|
702
|
-
),
|
|
703
|
-
},
|
|
702
|
+
), po(o), q(), d && ht("minimized");
|
|
703
|
+
}, Re = (a, d = {}) => {
|
|
704
704
|
qa(a, {
|
|
705
705
|
debugVersion: Aa,
|
|
706
706
|
launcherPosition: s,
|
|
@@ -711,38 +711,38 @@ async function Na(e = {}) {
|
|
|
711
711
|
right: o.style.right,
|
|
712
712
|
bottom: o.style.bottom
|
|
713
713
|
},
|
|
714
|
-
rootRect:
|
|
715
|
-
launcherRect:
|
|
716
|
-
panelRect:
|
|
717
|
-
viewport:
|
|
714
|
+
rootRect: on(o),
|
|
715
|
+
launcherRect: on(A),
|
|
716
|
+
panelRect: on(m),
|
|
717
|
+
viewport: te(),
|
|
718
718
|
panelHidden: m.hidden,
|
|
719
719
|
closeHidden: k.hidden,
|
|
720
720
|
...d
|
|
721
721
|
});
|
|
722
722
|
}, tt = (a = !0) => {
|
|
723
723
|
if (!s)
|
|
724
|
-
return
|
|
724
|
+
return Me(o, null), Qe(a);
|
|
725
725
|
const d = Qe(a);
|
|
726
|
-
return
|
|
726
|
+
return Me(o, d), Re("Applied stored closed launcher position", {
|
|
727
727
|
visibleLauncherPosition: d
|
|
728
728
|
}), d;
|
|
729
|
-
},
|
|
729
|
+
}, Mt = (a, d) => {
|
|
730
730
|
if (!a || !d) {
|
|
731
|
-
|
|
731
|
+
po(o);
|
|
732
732
|
return;
|
|
733
733
|
}
|
|
734
734
|
$a(o, {
|
|
735
735
|
x: a.x - d.x,
|
|
736
736
|
y: a.y - d.y
|
|
737
737
|
});
|
|
738
|
-
},
|
|
738
|
+
}, Ot = () => {
|
|
739
739
|
const a = st(c).width;
|
|
740
740
|
return t.layout === "page" && m.getBoundingClientRect().width || a;
|
|
741
|
-
},
|
|
741
|
+
}, In = () => {
|
|
742
742
|
if (o.classList.contains("pluno-pa-widget--minimized")) {
|
|
743
|
-
|
|
743
|
+
Me(
|
|
744
744
|
o,
|
|
745
|
-
|
|
745
|
+
tn(
|
|
746
746
|
o,
|
|
747
747
|
s,
|
|
748
748
|
t.position
|
|
@@ -752,14 +752,14 @@ async function Na(e = {}) {
|
|
|
752
752
|
}
|
|
753
753
|
const a = tt();
|
|
754
754
|
if (o.classList.contains("pluno-pa-widget--open") || o.classList.contains("pluno-pa-widget--closing")) {
|
|
755
|
-
|
|
755
|
+
en(o, c);
|
|
756
756
|
const d = st(c);
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
757
|
+
rn(
|
|
758
|
+
R,
|
|
759
|
+
Ot()
|
|
760
760
|
);
|
|
761
|
-
const
|
|
762
|
-
h ??
|
|
761
|
+
const f = Et(
|
|
762
|
+
h ?? nn(
|
|
763
763
|
o,
|
|
764
764
|
a,
|
|
765
765
|
t.position,
|
|
@@ -767,44 +767,44 @@ async function Na(e = {}) {
|
|
|
767
767
|
),
|
|
768
768
|
d
|
|
769
769
|
);
|
|
770
|
-
h && (h =
|
|
770
|
+
h && (h = f), Mt(f, a), Re(
|
|
771
771
|
"Applied open panel position after viewport resize",
|
|
772
|
-
{ openPanelPosition:
|
|
772
|
+
{ openPanelPosition: f }
|
|
773
773
|
);
|
|
774
|
-
} else s &&
|
|
774
|
+
} else s && Re(
|
|
775
775
|
"Applied visible launcher position after viewport resize",
|
|
776
776
|
{ visibleLauncherPosition: a }
|
|
777
777
|
);
|
|
778
778
|
};
|
|
779
|
-
let
|
|
779
|
+
let Rn = () => {
|
|
780
780
|
};
|
|
781
|
-
window.addEventListener("resize",
|
|
781
|
+
window.addEventListener("resize", In), t.movableLauncher && O ? (tt(), Rn = Ma({
|
|
782
782
|
root: o,
|
|
783
|
-
launcher:
|
|
783
|
+
launcher: A,
|
|
784
784
|
launcherDragHandle: O,
|
|
785
785
|
getPosition: () => Qe(),
|
|
786
786
|
setPosition: (a) => {
|
|
787
|
-
const d = a,
|
|
787
|
+
const d = a, f = Pt(o), y = wn(
|
|
788
788
|
o,
|
|
789
789
|
a,
|
|
790
|
-
|
|
790
|
+
f
|
|
791
791
|
);
|
|
792
792
|
s = Wa(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
),
|
|
793
|
+
y,
|
|
794
|
+
f
|
|
795
|
+
), Me(o, y), Re("Dragging closed launcher", {
|
|
796
796
|
requestedPosition: d
|
|
797
797
|
});
|
|
798
798
|
},
|
|
799
799
|
persist: () => {
|
|
800
|
-
g = !0,
|
|
800
|
+
g = !0, q(), Re("Persisted closed launcher drag position");
|
|
801
801
|
}
|
|
802
|
-
})) :
|
|
802
|
+
})) : Me(o, null), en(o, c);
|
|
803
803
|
const li = () => {
|
|
804
804
|
const a = st(c), d = Qe();
|
|
805
805
|
return {
|
|
806
|
-
position:
|
|
807
|
-
h ??
|
|
806
|
+
position: Et(
|
|
807
|
+
h ?? nn(
|
|
808
808
|
o,
|
|
809
809
|
d,
|
|
810
810
|
t.position,
|
|
@@ -815,107 +815,107 @@ async function Na(e = {}) {
|
|
|
815
815
|
size: a
|
|
816
816
|
};
|
|
817
817
|
}, si = (a) => {
|
|
818
|
-
c =
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
), h =
|
|
818
|
+
c = Tt(a.size), en(o, c), rn(
|
|
819
|
+
R,
|
|
820
|
+
Ot()
|
|
821
|
+
), h = Et(
|
|
822
822
|
a.position,
|
|
823
823
|
st(c)
|
|
824
824
|
);
|
|
825
825
|
const d = Qe();
|
|
826
|
-
|
|
826
|
+
Mt(h, d);
|
|
827
827
|
}, pi = z.length > 0 ? Oa({
|
|
828
828
|
root: o,
|
|
829
829
|
handles: z,
|
|
830
830
|
getBounds: li,
|
|
831
831
|
setBounds: si,
|
|
832
|
-
persist:
|
|
832
|
+
persist: q
|
|
833
833
|
}) : () => {
|
|
834
834
|
};
|
|
835
|
-
let
|
|
836
|
-
const
|
|
837
|
-
if (!(!t.billingStatusLoader ||
|
|
838
|
-
|
|
835
|
+
let Ut = !1;
|
|
836
|
+
const Dn = async () => {
|
|
837
|
+
if (!(!t.billingStatusLoader || Ut)) {
|
|
838
|
+
Ut = !0;
|
|
839
839
|
try {
|
|
840
840
|
const a = await t.billingStatusLoader();
|
|
841
|
-
if (
|
|
841
|
+
if (X)
|
|
842
842
|
return;
|
|
843
|
-
|
|
843
|
+
mo(
|
|
844
844
|
t.billingStatus,
|
|
845
845
|
a,
|
|
846
|
-
|
|
847
|
-
) && (t.billingStatus = a,
|
|
846
|
+
w.getState().lastErrorCode
|
|
847
|
+
) && (t.billingStatus = a, sn(
|
|
848
848
|
Ze,
|
|
849
849
|
t.billingStatus,
|
|
850
|
-
|
|
851
|
-
),
|
|
850
|
+
w.getState().lastErrorCode
|
|
851
|
+
), V());
|
|
852
852
|
} catch (a) {
|
|
853
|
-
|
|
853
|
+
J(
|
|
854
854
|
"web-sdk.widget",
|
|
855
855
|
"Failed to refresh billing status",
|
|
856
856
|
{ message: a instanceof Error ? a.message : String(a) }
|
|
857
857
|
);
|
|
858
858
|
} finally {
|
|
859
|
-
|
|
859
|
+
Ut = !1;
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
},
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
862
|
+
}, xe = (a = "", d = !0, f = !0) => {
|
|
863
|
+
Dn(), ot && (ot = !1, Wt()), o.classList.contains("pluno-pa-widget--open") || (h = null), ie !== null && (window.clearTimeout(ie), ie = null), et("shown", !1), m.hidden = !1, k.hidden = !1, rn(
|
|
864
|
+
R,
|
|
865
|
+
Ot()
|
|
866
866
|
), o.classList.remove("pluno-pa-widget--closing");
|
|
867
|
-
const
|
|
867
|
+
const y = tt(), N = nn(
|
|
868
868
|
o,
|
|
869
|
-
|
|
869
|
+
y,
|
|
870
870
|
t.position,
|
|
871
871
|
c
|
|
872
872
|
);
|
|
873
|
-
if (
|
|
874
|
-
openPanelPosition:
|
|
875
|
-
visibleLauncherPosition:
|
|
876
|
-
}),
|
|
877
|
-
o.classList.add("pluno-pa-widget--open"),
|
|
873
|
+
if (Mt(N, y), Re("Opening launcher at clamped open panel position", {
|
|
874
|
+
openPanelPosition: N,
|
|
875
|
+
visibleLauncherPosition: y
|
|
876
|
+
}), ae(!0, "open"), re(), !d) {
|
|
877
|
+
o.classList.add("pluno-pa-widget--open"), A.hidden = !0, a && (x.value = a, lt(x)), pt(F, () => Ne.enabled), Ie = F.scrollTop, f && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), q(), ht("shown"), t.onPanelOpenChange?.(!0);
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
880
|
window.requestAnimationFrame(() => {
|
|
881
|
-
o.classList.add("pluno-pa-widget--open"), a && (x.value = a, lt(x)), pt(
|
|
882
|
-
|
|
881
|
+
o.classList.add("pluno-pa-widget--open"), a && (x.value = a, lt(x)), pt(F, () => Ne.enabled), Ie = F.scrollTop, f && (x.focus(), x.setSelectionRange(x.value.length, x.value.length)), q(), ht("shown"), t.onPanelOpenChange?.(!0), ie = window.setTimeout(() => {
|
|
882
|
+
A.hidden = !0, pt(F, () => Ne.enabled), Ie = F.scrollTop;
|
|
883
883
|
}, 220);
|
|
884
884
|
});
|
|
885
|
-
},
|
|
886
|
-
|
|
885
|
+
}, Bt = () => {
|
|
886
|
+
ie !== null && (window.clearTimeout(ie), ie = null), A.hidden = !1, s && (tt(!1), Re("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), q(), t.onPanelOpenChange?.(!1), ie = window.setTimeout(() => {
|
|
887
887
|
m.hidden = !0, k.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
|
|
888
888
|
}, 220);
|
|
889
889
|
};
|
|
890
|
-
|
|
891
|
-
a.preventDefault(),
|
|
890
|
+
A.addEventListener("submit", (a) => {
|
|
891
|
+
a.preventDefault(), xe(u.value), u.value = "";
|
|
892
892
|
}), O?.addEventListener("click", (a) => {
|
|
893
893
|
a.preventDefault(), a.stopPropagation();
|
|
894
|
-
}),
|
|
895
|
-
a.target === u && !O || (
|
|
894
|
+
}), A.addEventListener("click", (a) => {
|
|
895
|
+
a.target === u && !O || (xe(u.value), u.value = "");
|
|
896
896
|
}), u.addEventListener("focus", () => {
|
|
897
|
-
|
|
897
|
+
xe(u.value), u.value = "";
|
|
898
898
|
}), u.addEventListener("input", () => {
|
|
899
899
|
if (!u.value)
|
|
900
900
|
return;
|
|
901
901
|
const a = u.value;
|
|
902
|
-
|
|
902
|
+
xe(a), u.value = "";
|
|
903
903
|
});
|
|
904
|
-
let
|
|
905
|
-
const
|
|
904
|
+
let Ft = null, mt = null, De = null;
|
|
905
|
+
const zn = (a) => a === u || a === x, di = (a) => {
|
|
906
906
|
if (!(a instanceof Element) || a.getRootNode() === o.getRootNode())
|
|
907
907
|
return null;
|
|
908
908
|
let d = a;
|
|
909
909
|
for (; d; ) {
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
return
|
|
913
|
-
const
|
|
914
|
-
d =
|
|
910
|
+
const f = d.closest(Jn);
|
|
911
|
+
if (f)
|
|
912
|
+
return f;
|
|
913
|
+
const y = d.getRootNode();
|
|
914
|
+
d = y instanceof ShadowRoot ? y.host : null;
|
|
915
915
|
}
|
|
916
916
|
return null;
|
|
917
917
|
}, ci = (a) => {
|
|
918
|
-
if (!a.isConnected || !a.matches(
|
|
918
|
+
if (!a.isConnected || !a.matches(Jn))
|
|
919
919
|
return !1;
|
|
920
920
|
if (!(a instanceof HTMLElement))
|
|
921
921
|
return !0;
|
|
@@ -925,73 +925,73 @@ async function Na(e = {}) {
|
|
|
925
925
|
return a.checkVisibility();
|
|
926
926
|
const d = window.getComputedStyle(a);
|
|
927
927
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
928
|
-
},
|
|
929
|
-
He !== a && (He = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null),
|
|
928
|
+
}, Mn = (a) => {
|
|
929
|
+
He !== a && (He = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), ze(), a !== null ? De = window.setInterval(() => {
|
|
930
930
|
const d = He;
|
|
931
|
-
(!d || !ci(d)) &&
|
|
932
|
-
}, fa) :
|
|
931
|
+
(!d || !ci(d)) && Mn(null);
|
|
932
|
+
}, fa) : De !== null && (window.clearInterval(De), De = null, mt = null));
|
|
933
933
|
}, ui = () => {
|
|
934
|
-
|
|
934
|
+
De !== null && (window.clearInterval(De), De = null);
|
|
935
935
|
};
|
|
936
936
|
o.addEventListener("focusin", (a) => {
|
|
937
|
-
|
|
937
|
+
zn(a.target) && (Ft = Date.now(), q());
|
|
938
938
|
}), o.addEventListener("focusout", (a) => {
|
|
939
|
-
if (!
|
|
939
|
+
if (!zn(a.target) || He !== null)
|
|
940
940
|
return;
|
|
941
|
-
const d =
|
|
942
|
-
if (
|
|
941
|
+
const d = Ft;
|
|
942
|
+
if (Ft = null, d === null || Date.now() - d > ha)
|
|
943
943
|
return;
|
|
944
|
-
const
|
|
945
|
-
if (!
|
|
944
|
+
const f = di(a.relatedTarget);
|
|
945
|
+
if (!f)
|
|
946
946
|
return;
|
|
947
|
-
const
|
|
948
|
-
if (
|
|
949
|
-
|
|
947
|
+
const y = Date.now();
|
|
948
|
+
if (mt !== null && y - mt <= ma) {
|
|
949
|
+
Mn(f);
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
952
|
-
|
|
953
|
-
}),
|
|
954
|
-
!o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(),
|
|
952
|
+
mt = y;
|
|
953
|
+
}), A.addEventListener("keydown", (a) => {
|
|
954
|
+
!o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), xe());
|
|
955
955
|
}), S?.addEventListener("pointerdown", (a) => {
|
|
956
956
|
a.stopPropagation();
|
|
957
957
|
}), S?.addEventListener("click", (a) => {
|
|
958
958
|
a.preventDefault(), a.stopPropagation(), et("minimized");
|
|
959
|
-
}), k.addEventListener("click",
|
|
960
|
-
|
|
961
|
-
}),
|
|
959
|
+
}), k.addEventListener("click", Bt), F.addEventListener("scroll", () => {
|
|
960
|
+
F.scrollTop < Ie - 1 && ae(!1, "userScroll"), Ie = F.scrollTop;
|
|
961
|
+
}), me.addEventListener("click", () => {
|
|
962
962
|
ai();
|
|
963
963
|
});
|
|
964
|
-
const
|
|
964
|
+
const On = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
965
965
|
([a]) => {
|
|
966
|
-
a?.isIntersecting && (
|
|
966
|
+
a?.isIntersecting && (ae(!0, "bottom"), re());
|
|
967
967
|
},
|
|
968
|
-
{ root:
|
|
968
|
+
{ root: F, threshold: 0 }
|
|
969
969
|
);
|
|
970
|
-
|
|
970
|
+
On?.observe(fe);
|
|
971
971
|
const nt = () => t.loginRequired || t.signupRequired;
|
|
972
972
|
let He = null, ot = !1;
|
|
973
|
-
const
|
|
973
|
+
const le = () => gt || w.getState().status !== "connected", ze = () => {
|
|
974
974
|
const a = nt(), d = He !== null;
|
|
975
|
-
u.readOnly = !1, x.readOnly = !1, u.placeholder = d ?
|
|
976
|
-
},
|
|
977
|
-
B.disabled =
|
|
975
|
+
u.readOnly = !1, x.readOnly = !1, u.placeholder = d ? Qn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ot ? "New update" : t.launcherLabel, x.placeholder = d ? Qn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : de.launcherLabel, ne.hidden = a;
|
|
976
|
+
}, V = () => {
|
|
977
|
+
B.disabled = le() || se(t.billingStatus) || !w.getState().isThinking && x.value.trim().length === 0 && D.length === 0, U.disabled = nt() || le() || se(t.billingStatus);
|
|
978
978
|
};
|
|
979
|
-
|
|
980
|
-
const
|
|
981
|
-
const a =
|
|
979
|
+
ze();
|
|
980
|
+
const Wt = () => {
|
|
981
|
+
const a = w.getState().isThinking;
|
|
982
982
|
o.classList.toggle("pluno-pa-widget--thinking", a), o.classList.toggle(
|
|
983
983
|
"pluno-pa-widget--unread",
|
|
984
984
|
!a && ot
|
|
985
|
-
),
|
|
985
|
+
), ze();
|
|
986
986
|
};
|
|
987
|
-
|
|
988
|
-
const
|
|
989
|
-
nt() ||
|
|
987
|
+
Wt();
|
|
988
|
+
const Ht = () => {
|
|
989
|
+
nt() || X || (gt = !0, ze(), V(), w.connect().then(
|
|
990
990
|
() => {
|
|
991
|
-
|
|
991
|
+
X || (gt = !1, ze(), V());
|
|
992
992
|
},
|
|
993
993
|
(a) => {
|
|
994
|
-
|
|
994
|
+
X || (gt = !1, ze(), V(), J(
|
|
995
995
|
"web-sdk.widget",
|
|
996
996
|
"Failed to connect Product Agent widget",
|
|
997
997
|
{
|
|
@@ -1001,7 +1001,7 @@ async function Na(e = {}) {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
));
|
|
1003
1003
|
};
|
|
1004
|
-
|
|
1004
|
+
ne.addEventListener("submit", (a) => {
|
|
1005
1005
|
if (a.preventDefault(), t.loginRequired) {
|
|
1006
1006
|
t.onLoginClick?.();
|
|
1007
1007
|
return;
|
|
@@ -1010,69 +1010,69 @@ async function Na(e = {}) {
|
|
|
1010
1010
|
t.onSignupClick?.();
|
|
1011
1011
|
return;
|
|
1012
1012
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1013
|
+
le() || se(t.billingStatus) || (ke = !0, ae(!0, "send"), re(), D = an(
|
|
1014
|
+
w,
|
|
1015
1015
|
x,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
), Fe(),
|
|
1016
|
+
D,
|
|
1017
|
+
vt
|
|
1018
|
+
), Fe(), V());
|
|
1019
1019
|
});
|
|
1020
1020
|
let it = 0;
|
|
1021
1021
|
const gi = () => {
|
|
1022
1022
|
it = 0, o.classList.remove("pluno-pa-widget--drag-over");
|
|
1023
|
-
},
|
|
1024
|
-
|
|
1025
|
-
|
|
1023
|
+
}, Gt = (a) => {
|
|
1024
|
+
we !== null && window.clearTimeout(we), G.textContent = a, G.hidden = !1, we = window.setTimeout(() => {
|
|
1025
|
+
G.textContent = "", G.hidden = !0, we = null;
|
|
1026
1026
|
}, 3e3);
|
|
1027
1027
|
}, hi = () => {
|
|
1028
|
-
|
|
1029
|
-
},
|
|
1028
|
+
we !== null && (window.clearTimeout(we), we = null), G.textContent = "", G.hidden = !0;
|
|
1029
|
+
}, $t = async (a) => {
|
|
1030
1030
|
if (!t.attachmentsEnabled || a.length === 0)
|
|
1031
1031
|
return;
|
|
1032
|
-
const d = Sr(
|
|
1033
|
-
if (
|
|
1034
|
-
|
|
1032
|
+
const d = Sr(w, a);
|
|
1033
|
+
if (D = [...D, ...d], Fe(), hi(), V(), M(w.getState()), !o.classList.contains("pluno-pa-widget--open")) {
|
|
1034
|
+
xe();
|
|
1035
1035
|
return;
|
|
1036
1036
|
}
|
|
1037
|
-
|
|
1037
|
+
Ee();
|
|
1038
1038
|
}, mi = async (a) => {
|
|
1039
|
-
await
|
|
1039
|
+
await $t(a), !(a.length === 0 || He !== null) && x.focus();
|
|
1040
1040
|
};
|
|
1041
1041
|
U.addEventListener("click", () => {
|
|
1042
|
-
t.loginRequired ||
|
|
1042
|
+
t.loginRequired || le() || se(t.billingStatus) || ge.click();
|
|
1043
1043
|
}), ge.addEventListener("change", () => {
|
|
1044
1044
|
const a = Array.from(ge.files ?? []);
|
|
1045
1045
|
ge.value = "", mi(a).catch((d) => {
|
|
1046
|
-
|
|
1046
|
+
Gt(
|
|
1047
1047
|
d instanceof Error ? d.message : "Failed to attach file"
|
|
1048
|
-
),
|
|
1048
|
+
), J("web-sdk.widget", "Attachment failed", {
|
|
1049
1049
|
message: d instanceof Error ? d.message : String(d)
|
|
1050
1050
|
});
|
|
1051
1051
|
});
|
|
1052
1052
|
}), o.addEventListener("dragenter", (a) => {
|
|
1053
|
-
!t.attachmentsEnabled || !
|
|
1053
|
+
!t.attachmentsEnabled || !St(a.dataTransfer) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), it += 1, o.classList.add("pluno-pa-widget--drag-over"));
|
|
1054
1054
|
}), o.addEventListener("dragover", (a) => {
|
|
1055
1055
|
const d = a.dataTransfer;
|
|
1056
|
-
!t.attachmentsEnabled || !
|
|
1056
|
+
!t.attachmentsEnabled || !St(d) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
|
|
1057
1057
|
}), o.addEventListener("dragleave", (a) => {
|
|
1058
|
-
|
|
1058
|
+
St(a.dataTransfer) && (a.stopPropagation(), it = Math.max(0, it - 1), it === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
|
|
1059
1059
|
}), o.addEventListener("drop", (a) => {
|
|
1060
1060
|
const d = a.dataTransfer;
|
|
1061
|
-
!t.attachmentsEnabled || !
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
),
|
|
1065
|
-
message:
|
|
1061
|
+
!t.attachmentsEnabled || !St(d) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), gi(), $t(d.files).catch((f) => {
|
|
1062
|
+
Gt(
|
|
1063
|
+
f instanceof Error ? f.message : "Failed to attach file"
|
|
1064
|
+
), J("web-sdk.widget", "Attachment failed", {
|
|
1065
|
+
message: f instanceof Error ? f.message : String(f)
|
|
1066
1066
|
});
|
|
1067
1067
|
}));
|
|
1068
1068
|
}), o.addEventListener("paste", (a) => {
|
|
1069
1069
|
a.stopPropagation();
|
|
1070
|
-
const d = a.clipboardData,
|
|
1071
|
-
!t.attachmentsEnabled ||
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
),
|
|
1075
|
-
message:
|
|
1070
|
+
const d = a.clipboardData, f = Array.from(d?.files ?? []);
|
|
1071
|
+
!t.attachmentsEnabled || f.length === 0 || t.loginRequired || le() || (a.preventDefault(), $t(f).catch((y) => {
|
|
1072
|
+
Gt(
|
|
1073
|
+
y instanceof Error ? y.message : "Failed to attach file"
|
|
1074
|
+
), J("web-sdk.widget", "Attachment failed", {
|
|
1075
|
+
message: y instanceof Error ? y.message : String(y)
|
|
1076
1076
|
});
|
|
1077
1077
|
}));
|
|
1078
1078
|
}), B.addEventListener("click", () => {
|
|
@@ -1080,47 +1080,47 @@ async function Na(e = {}) {
|
|
|
1080
1080
|
t.onLoginClick?.();
|
|
1081
1081
|
return;
|
|
1082
1082
|
}
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1083
|
+
if (w.getState().isThinking) {
|
|
1084
|
+
w.stop();
|
|
1085
1085
|
return;
|
|
1086
1086
|
}
|
|
1087
|
-
if (
|
|
1087
|
+
if (le())
|
|
1088
1088
|
return;
|
|
1089
|
-
const a = x.value.trim().length > 0 ||
|
|
1090
|
-
|
|
1091
|
-
|
|
1089
|
+
const a = x.value.trim().length > 0 || D.length > 0;
|
|
1090
|
+
ke = !0, ae(!0, "send"), re(), D = an(
|
|
1091
|
+
w,
|
|
1092
1092
|
x,
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
), Fe(),
|
|
1096
|
-
}),
|
|
1097
|
-
|
|
1098
|
-
}),
|
|
1099
|
-
|
|
1093
|
+
D,
|
|
1094
|
+
vt
|
|
1095
|
+
), Fe(), V(), M(w.getState()), a && Ee();
|
|
1096
|
+
}), oe.addEventListener("click", () => {
|
|
1097
|
+
Z = !Z, Je = null, _e(), Z && Le.length === 0 && An(null), Z || Ee();
|
|
1098
|
+
}), ct.addEventListener("click", () => {
|
|
1099
|
+
Z = !1, _e(), Ee();
|
|
1100
1100
|
}), Y.addEventListener("scroll", ri), x.addEventListener("input", () => {
|
|
1101
|
-
lt(x),
|
|
1101
|
+
lt(x), q(), V(), bi();
|
|
1102
1102
|
}), x.addEventListener("keydown", (a) => {
|
|
1103
1103
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
1104
1104
|
if (a.preventDefault(), t.loginRequired) {
|
|
1105
1105
|
t.onLoginClick?.();
|
|
1106
1106
|
return;
|
|
1107
1107
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1108
|
+
le() || (ke = !0, ae(!0, "send"), re(), D = an(
|
|
1109
|
+
w,
|
|
1110
1110
|
x,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
), Fe(),
|
|
1111
|
+
D,
|
|
1112
|
+
vt
|
|
1113
|
+
), Fe(), V(), M(w.getState()));
|
|
1114
1114
|
}
|
|
1115
1115
|
}), o.addEventListener("click", (a) => {
|
|
1116
1116
|
const d = a.target instanceof Element ? a.target : null;
|
|
1117
|
-
d?.closest("a[href]") &&
|
|
1118
|
-
const
|
|
1117
|
+
d?.closest("a[href]") && q(), Z && Vi(d, Te, oe) && (Z = !1, _e());
|
|
1118
|
+
const y = window.getSelection(), N = !!(y && !y.isCollapsed && y.anchorNode && o.contains(y.anchorNode));
|
|
1119
1119
|
qi(
|
|
1120
1120
|
a.target,
|
|
1121
1121
|
a.detail,
|
|
1122
|
-
|
|
1123
|
-
) &&
|
|
1122
|
+
N
|
|
1123
|
+
) && Ee();
|
|
1124
1124
|
}), o.addEventListener("copy", (a) => {
|
|
1125
1125
|
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(
|
|
1126
1126
|
"text/plain",
|
|
@@ -1138,18 +1138,18 @@ async function Na(e = {}) {
|
|
|
1138
1138
|
), a.stopPropagation();
|
|
1139
1139
|
return;
|
|
1140
1140
|
}
|
|
1141
|
-
a.key !== "Escape" || !
|
|
1142
|
-
}), l.composerValue && (x.value = l.composerValue, lt(x)), t.layout === "page" ?
|
|
1143
|
-
const
|
|
1144
|
-
let
|
|
1141
|
+
a.key !== "Escape" || !Z || (Z = !1, _e(), Ee());
|
|
1142
|
+
}), l.composerValue && (x.value = l.composerValue, lt(x)), t.layout === "page" ? xe(x.value, !1) : p === "minimized" ? et("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && xe(x.value, !1, !1), Va(l, o, u, x);
|
|
1143
|
+
const ft = () => r;
|
|
1144
|
+
let qt = w.getState().appearance !== null, wt = null, at = null, Ge = null, Un = w.getState().isThinking, $e = null;
|
|
1145
1145
|
const rt = t.taskNotifications;
|
|
1146
1146
|
let qe = null, je = !1;
|
|
1147
|
-
const
|
|
1147
|
+
const Bn = () => {
|
|
1148
1148
|
qe !== null && (window.clearTimeout(qe), qe = null);
|
|
1149
|
-
},
|
|
1150
|
-
|
|
1151
|
-
},
|
|
1152
|
-
if (!rt || !
|
|
1149
|
+
}, bt = () => {
|
|
1150
|
+
_ && (_.hidden = !0);
|
|
1151
|
+
}, Fn = () => w.getState().assistantDraft.trim().length > 0, fi = async () => {
|
|
1152
|
+
if (!rt || !_ || je || X || !w.getState().isThinking || Fn())
|
|
1153
1153
|
return;
|
|
1154
1154
|
let a;
|
|
1155
1155
|
try {
|
|
@@ -1157,82 +1157,82 @@ async function Na(e = {}) {
|
|
|
1157
1157
|
} catch {
|
|
1158
1158
|
return;
|
|
1159
1159
|
}
|
|
1160
|
-
a.enabled || a.neverSuggest || !
|
|
1160
|
+
a.enabled || a.neverSuggest || !w.getState().isThinking || Fn() || je || X || (_.hidden = !1);
|
|
1161
1161
|
};
|
|
1162
|
-
|
|
1163
|
-
je = !0,
|
|
1162
|
+
L?.addEventListener("click", () => {
|
|
1163
|
+
je = !0, bt(), rt?.enable().catch(() => {
|
|
1164
1164
|
});
|
|
1165
|
-
}),
|
|
1166
|
-
je = !0,
|
|
1167
|
-
}),
|
|
1168
|
-
je = !0,
|
|
1165
|
+
}), W?.addEventListener("click", () => {
|
|
1166
|
+
je = !0, bt();
|
|
1167
|
+
}), Ce?.addEventListener("click", () => {
|
|
1168
|
+
je = !0, bt(), rt?.dismissForever().catch(() => {
|
|
1169
1169
|
});
|
|
1170
1170
|
});
|
|
1171
|
-
const
|
|
1171
|
+
const _t = t.tabGroups;
|
|
1172
1172
|
let Ve = !1;
|
|
1173
|
-
const
|
|
1174
|
-
if (!
|
|
1173
|
+
const xt = async () => {
|
|
1174
|
+
if (!_t || !$ || Ve || X)
|
|
1175
1175
|
return;
|
|
1176
|
-
const a = await
|
|
1177
|
-
!a || Ve ||
|
|
1176
|
+
const a = await _t.getState().catch(() => null);
|
|
1177
|
+
!a || Ve || X || ($.hidden = !a.permissionNeeded);
|
|
1178
1178
|
};
|
|
1179
|
-
|
|
1180
|
-
Ve = !0,
|
|
1179
|
+
v?.addEventListener("click", () => {
|
|
1180
|
+
Ve = !0, $ && ($.hidden = !0), _t?.enable().catch(() => {
|
|
1181
1181
|
}).finally(() => {
|
|
1182
|
-
Ve = !1,
|
|
1182
|
+
Ve = !1, xt();
|
|
1183
1183
|
});
|
|
1184
|
-
}),
|
|
1185
|
-
Ve = !0,
|
|
1184
|
+
}), T?.addEventListener("click", () => {
|
|
1185
|
+
Ve = !0, $ && ($.hidden = !0), _t?.dismiss().catch(() => {
|
|
1186
1186
|
}).finally(() => {
|
|
1187
|
-
Ve = !1,
|
|
1187
|
+
Ve = !1, xt();
|
|
1188
1188
|
});
|
|
1189
|
-
}),
|
|
1190
|
-
let Ke = null,
|
|
1189
|
+
}), xt();
|
|
1190
|
+
let Ke = null, Wn = () => {
|
|
1191
1191
|
};
|
|
1192
|
-
const wi = !!t.socialPostDraftHandler,
|
|
1193
|
-
const a = Ke !== null &&
|
|
1194
|
-
|
|
1192
|
+
const wi = !!t.socialPostDraftHandler, jt = /* @__PURE__ */ new Map(), Vt = () => x.value.trim().length > 0 || D.length > 0, bi = () => {
|
|
1193
|
+
const a = Ke !== null && pn(w.getState(), Vt());
|
|
1194
|
+
Be.hidden = !a, a && Ke !== null && Ho(Be, Ke);
|
|
1195
1195
|
};
|
|
1196
1196
|
let Ye = null;
|
|
1197
|
-
const
|
|
1197
|
+
const ye = /* @__PURE__ */ new Map(), yt = /* @__PURE__ */ new Set(), _i = async (a) => {
|
|
1198
1198
|
if (t.integrationAuthHandler) {
|
|
1199
|
-
|
|
1199
|
+
ye.set(a.authRequestId, { status: "connecting" }), M(w.getState());
|
|
1200
1200
|
try {
|
|
1201
|
-
await t.integrationAuthHandler(a),
|
|
1201
|
+
await t.integrationAuthHandler(a), ye.set(a.authRequestId, { status: "completed" });
|
|
1202
1202
|
} catch (d) {
|
|
1203
|
-
|
|
1203
|
+
ye.set(a.authRequestId, {
|
|
1204
1204
|
status: "error",
|
|
1205
1205
|
error: d instanceof Error ? d.message : `Could not connect ${a.appName}.`
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
|
-
M(
|
|
1208
|
+
M(w.getState());
|
|
1209
1209
|
}
|
|
1210
|
-
},
|
|
1211
|
-
|
|
1212
|
-
},
|
|
1213
|
-
t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(),
|
|
1214
|
-
},
|
|
1210
|
+
}, Kt = (a = {}) => {
|
|
1211
|
+
ke = !0, ae(!0, "newSession"), re(), Z = !1, _e(), w.startNewSession(a), Rt.clear(), ye.clear(), yt.clear(), x.value = "", D = [], Fe(), lt(x), q(), V(), x.focus(), M(w.getState());
|
|
1212
|
+
}, vt = () => {
|
|
1213
|
+
t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Kt());
|
|
1214
|
+
}, Yt = (a) => {
|
|
1215
1215
|
if (!a || t.layout === "page") {
|
|
1216
1216
|
Ye?.remove(), Ye = null;
|
|
1217
1217
|
return;
|
|
1218
1218
|
}
|
|
1219
|
-
Ye || (Ye =
|
|
1219
|
+
Ye || (Ye = Nt(
|
|
1220
1220
|
"pluno-pa-widget__new-chat",
|
|
1221
1221
|
"New chat",
|
|
1222
1222
|
ur(),
|
|
1223
1223
|
!1
|
|
1224
|
-
), Ye.addEventListener("click", () =>
|
|
1224
|
+
), Ye.addEventListener("click", () => Kt()), j.insertBefore(Ye, oe));
|
|
1225
1225
|
}, M = (a) => {
|
|
1226
|
-
if (
|
|
1226
|
+
if (_e(), En(a.lastErrorCode) ? $e = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !se(t.billingStatus) && ($e = null), sn(
|
|
1227
1227
|
Ze,
|
|
1228
1228
|
t.billingStatus,
|
|
1229
1229
|
$e
|
|
1230
1230
|
), t.loginRequired) {
|
|
1231
|
-
|
|
1232
|
-
|
|
1231
|
+
jt.clear(), _o(
|
|
1232
|
+
F,
|
|
1233
1233
|
B,
|
|
1234
|
-
|
|
1235
|
-
|
|
1234
|
+
Yt,
|
|
1235
|
+
ft,
|
|
1236
1236
|
"Log in to use Pluno on this page.",
|
|
1237
1237
|
t.loginButtonLabel,
|
|
1238
1238
|
t.loginUrl,
|
|
@@ -1241,11 +1241,11 @@ async function Na(e = {}) {
|
|
|
1241
1241
|
return;
|
|
1242
1242
|
}
|
|
1243
1243
|
if (t.signupRequired) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1244
|
+
jt.clear(), _o(
|
|
1245
|
+
F,
|
|
1246
1246
|
B,
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
Yt,
|
|
1248
|
+
ft,
|
|
1249
1249
|
"Complete signup to unlock your free trial credits.",
|
|
1250
1250
|
t.signupButtonLabel,
|
|
1251
1251
|
t.signupUrl,
|
|
@@ -1253,107 +1253,107 @@ async function Na(e = {}) {
|
|
|
1253
1253
|
);
|
|
1254
1254
|
return;
|
|
1255
1255
|
}
|
|
1256
|
-
const d = Ya(a),
|
|
1257
|
-
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1256
|
+
const d = Ya(a), f = d !== Pn;
|
|
1257
|
+
Pn = d;
|
|
1258
|
+
const y = ke || Ne.enabled;
|
|
1259
|
+
ke = !1, Tr(
|
|
1260
|
+
F,
|
|
1261
|
+
fe,
|
|
1262
1262
|
B,
|
|
1263
|
-
|
|
1264
|
-
|
|
1263
|
+
Yt,
|
|
1264
|
+
Be,
|
|
1265
1265
|
a,
|
|
1266
1266
|
Ke,
|
|
1267
|
-
Ke !== null &&
|
|
1268
|
-
|
|
1269
|
-
() =>
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
(
|
|
1275
|
-
|
|
1267
|
+
Ke !== null && pn(a, Vt()),
|
|
1268
|
+
y,
|
|
1269
|
+
() => Ne.enabled,
|
|
1270
|
+
Rt,
|
|
1271
|
+
jt,
|
|
1272
|
+
q,
|
|
1273
|
+
ft,
|
|
1274
|
+
(N) => {
|
|
1275
|
+
le() || (vt(), ke = !0, ae(!0, "send"), re(), w.sendMessage(N));
|
|
1276
1276
|
},
|
|
1277
1277
|
() => {
|
|
1278
|
-
|
|
1278
|
+
ke = !0, ae(!0, "send"), re(), w.retryLastMessage();
|
|
1279
1279
|
},
|
|
1280
1280
|
t.morningReport,
|
|
1281
1281
|
() => {
|
|
1282
|
-
t.morningReport = null, t.onMorningReportSnooze?.(),
|
|
1282
|
+
t.morningReport = null, t.onMorningReportSnooze?.(), Bt(), M(w.getState());
|
|
1283
1283
|
},
|
|
1284
|
-
|
|
1284
|
+
Ht,
|
|
1285
1285
|
t.attachmentPreviewUrlResolver,
|
|
1286
1286
|
t.integrationAuthHandler ? {
|
|
1287
|
-
states:
|
|
1287
|
+
states: ye,
|
|
1288
1288
|
initialStatus: t.integrationAuthStatusLoader ? "checking" : "pending",
|
|
1289
|
-
onConnect: (
|
|
1290
|
-
_i(
|
|
1289
|
+
onConnect: (N) => {
|
|
1290
|
+
_i(N);
|
|
1291
1291
|
}
|
|
1292
1292
|
} : void 0,
|
|
1293
|
-
wi && !
|
|
1294
|
-
dismissedCandidateIds:
|
|
1295
|
-
draftingCandidate:
|
|
1293
|
+
wi && !Dt ? {
|
|
1294
|
+
dismissedCandidateIds: ut,
|
|
1295
|
+
draftingCandidate: wt,
|
|
1296
1296
|
error: at,
|
|
1297
|
-
characterIconOptions:
|
|
1298
|
-
onSeen: (
|
|
1299
|
-
We.add(
|
|
1297
|
+
characterIconOptions: ft(),
|
|
1298
|
+
onSeen: (N) => {
|
|
1299
|
+
We.add(N.id), q();
|
|
1300
1300
|
},
|
|
1301
|
-
onDraft: (
|
|
1302
|
-
xi(
|
|
1301
|
+
onDraft: (N) => {
|
|
1302
|
+
xi(N);
|
|
1303
1303
|
},
|
|
1304
|
-
onDismiss: (
|
|
1305
|
-
We.add(
|
|
1304
|
+
onDismiss: (N) => {
|
|
1305
|
+
We.add(N.id), ut.add(N.id), q(), at = null, M(w.getState());
|
|
1306
1306
|
},
|
|
1307
|
-
onDisable: (
|
|
1308
|
-
|
|
1307
|
+
onDisable: (N) => {
|
|
1308
|
+
Dt = !0, We.add(N.id), ut.add(N.id), q(), tl(t, !0), at = null, M(w.getState());
|
|
1309
1309
|
}
|
|
1310
1310
|
} : void 0
|
|
1311
|
-
),
|
|
1312
|
-
},
|
|
1311
|
+
), y ? (Ie = F.scrollTop, re()) : f && Xa(a) && ii();
|
|
1312
|
+
}, Hn = async (a) => {
|
|
1313
1313
|
if (!t.integrationAuthStatusLoader)
|
|
1314
1314
|
return;
|
|
1315
|
-
const d = a.messages.map((
|
|
1315
|
+
const d = a.messages.map((f) => f.integrationAuthRequest).filter((f) => !!f);
|
|
1316
1316
|
await Promise.all(
|
|
1317
|
-
d.map(async (
|
|
1318
|
-
if (!(
|
|
1319
|
-
|
|
1317
|
+
d.map(async (f) => {
|
|
1318
|
+
if (!(ye.has(f.authRequestId) || yt.has(f.authRequestId))) {
|
|
1319
|
+
yt.add(f.authRequestId), ye.set(f.authRequestId, { status: "checking" }), M(w.getState());
|
|
1320
1320
|
try {
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
} catch (
|
|
1324
|
-
|
|
1321
|
+
const y = await t.integrationAuthStatusLoader(f);
|
|
1322
|
+
ye.set(f.authRequestId, { status: y });
|
|
1323
|
+
} catch (y) {
|
|
1324
|
+
ye.set(f.authRequestId, {
|
|
1325
1325
|
status: "error",
|
|
1326
|
-
error:
|
|
1326
|
+
error: y instanceof Error ? y.message : `Could not load ${f.appName} connection status.`
|
|
1327
1327
|
});
|
|
1328
1328
|
} finally {
|
|
1329
|
-
|
|
1329
|
+
yt.delete(f.authRequestId);
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1331
|
+
X || M(w.getState());
|
|
1332
1332
|
}
|
|
1333
1333
|
})
|
|
1334
1334
|
);
|
|
1335
1335
|
};
|
|
1336
|
-
return
|
|
1336
|
+
return Wn = Bi(
|
|
1337
1337
|
(a) => {
|
|
1338
|
-
Ke = a, !
|
|
1338
|
+
Ke = a, !X && pn(w.getState(), Vt()) && M(w.getState());
|
|
1339
1339
|
},
|
|
1340
1340
|
{
|
|
1341
1341
|
backendUrl: t.backendUrl,
|
|
1342
1342
|
fetcher: oi,
|
|
1343
1343
|
loader: t.activeUsersLoader
|
|
1344
1344
|
}
|
|
1345
|
-
),
|
|
1346
|
-
|
|
1347
|
-
const d =
|
|
1348
|
-
|
|
1345
|
+
), w.on("state", (a) => {
|
|
1346
|
+
xt();
|
|
1347
|
+
const d = Un && !a.isThinking;
|
|
1348
|
+
Un = a.isThinking, a.isThinking && !a.assistantDraft.trim() && rt && !je && qe === null && _?.hidden !== !1 && (qe = window.setTimeout(() => {
|
|
1349
1349
|
qe = null, fi();
|
|
1350
|
-
}, Qi)), (!a.isThinking || a.assistantDraft.trim()) && (
|
|
1350
|
+
}, Qi)), (!a.isThinking || a.assistantDraft.trim()) && (Bn(), bt()), d && !o.classList.contains("pluno-pa-widget--open") && (ot = !0), Wt(), a.appearance ? (qt = !0, J(
|
|
1351
1351
|
"web-sdk.widget",
|
|
1352
1352
|
"Agent state supplied appearance",
|
|
1353
1353
|
{
|
|
1354
1354
|
appearance: a.appearance
|
|
1355
1355
|
}
|
|
1356
|
-
),
|
|
1356
|
+
), Xt(a.appearance, "agent.state.appearance")) : qt && (qt = !1, J(
|
|
1357
1357
|
"web-sdk.widget",
|
|
1358
1358
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
1359
1359
|
{
|
|
@@ -1361,34 +1361,34 @@ async function Na(e = {}) {
|
|
|
1361
1361
|
fallbackColorScheme: t.colorScheme,
|
|
1362
1362
|
fallbackFontFamily: t.fontFamily
|
|
1363
1363
|
}
|
|
1364
|
-
),
|
|
1365
|
-
}), M(
|
|
1366
|
-
agent:
|
|
1367
|
-
startNewChat:
|
|
1364
|
+
), Xt({}, "agent.state.appearance-cleared")), M(a), Hn(a), V(), d && Dn();
|
|
1365
|
+
}), M(w.getState()), Hn(w.getState()), V(), Ht(), {
|
|
1366
|
+
agent: w,
|
|
1367
|
+
startNewChat: Kt,
|
|
1368
1368
|
host: n,
|
|
1369
1369
|
updateAppearance: (a) => {
|
|
1370
|
-
a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle),
|
|
1370
|
+
a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Xt(a, "widgetHandle.updateAppearance");
|
|
1371
1371
|
},
|
|
1372
1372
|
updateBillingStatus: (a) => {
|
|
1373
1373
|
const d = a ?? null;
|
|
1374
|
-
|
|
1374
|
+
mo(
|
|
1375
1375
|
t.billingStatus,
|
|
1376
1376
|
d,
|
|
1377
1377
|
$e
|
|
1378
|
-
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !
|
|
1378
|
+
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !se(t.billingStatus) && ($e = null), sn(
|
|
1379
1379
|
o.querySelector(".pluno-pa-widget__billing-status"),
|
|
1380
1380
|
t.billingStatus,
|
|
1381
1381
|
$e
|
|
1382
|
-
),
|
|
1382
|
+
), V());
|
|
1383
1383
|
},
|
|
1384
1384
|
updateAuthGate: (a) => {
|
|
1385
1385
|
const d = nt();
|
|
1386
|
-
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),
|
|
1386
|
+
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), ze(), M(w.getState()), V(), d && !nt() && Ht();
|
|
1387
1387
|
},
|
|
1388
|
-
openPanel: () => {
|
|
1389
|
-
|
|
1388
|
+
openPanel: (a) => {
|
|
1389
|
+
xe(x.value, !1, a?.focusComposer !== !1);
|
|
1390
1390
|
},
|
|
1391
|
-
closePanel:
|
|
1391
|
+
closePanel: Bt,
|
|
1392
1392
|
updateDisplayState: (a) => {
|
|
1393
1393
|
if (a === "shown") {
|
|
1394
1394
|
et("shown", !1);
|
|
@@ -1397,22 +1397,22 @@ async function Na(e = {}) {
|
|
|
1397
1397
|
et("minimized", !1);
|
|
1398
1398
|
},
|
|
1399
1399
|
updateMorningReport: (a) => {
|
|
1400
|
-
t.morningReport = a ?? null, M(
|
|
1400
|
+
t.morningReport = a ?? null, M(w.getState());
|
|
1401
1401
|
},
|
|
1402
1402
|
destroy: () => {
|
|
1403
|
-
|
|
1403
|
+
X || (q(), X = !0, Nn.disconnect(), On?.disconnect(), ui(), window.removeEventListener("resize", In), Rn(), pi(), we !== null && window.clearTimeout(we), Bn(), Wn(), Ge?.remove(), w.destroy(), It.release(), n.remove());
|
|
1404
1404
|
}
|
|
1405
1405
|
};
|
|
1406
1406
|
async function xi(a) {
|
|
1407
|
-
if (!
|
|
1408
|
-
|
|
1407
|
+
if (!wt) {
|
|
1408
|
+
wt = a, at = null, M(w.getState());
|
|
1409
1409
|
try {
|
|
1410
1410
|
if (!t.socialPostDraftHandler)
|
|
1411
1411
|
throw new Error("Social post drafting is not available here.");
|
|
1412
1412
|
const d = await t.socialPostDraftHandler(a);
|
|
1413
1413
|
if (!d.linkedinPost || !d.xPost)
|
|
1414
1414
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1415
|
-
We.add(a.id),
|
|
1415
|
+
We.add(a.id), ut.add(a.id), q(), Ge?.remove(), Ge = Br(d, {
|
|
1416
1416
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1417
1417
|
onClose: () => {
|
|
1418
1418
|
Ge?.remove(), Ge = null;
|
|
@@ -1421,32 +1421,32 @@ async function Na(e = {}) {
|
|
|
1421
1421
|
} catch (d) {
|
|
1422
1422
|
at = d instanceof Error ? d.message : "Could not draft social post.";
|
|
1423
1423
|
} finally {
|
|
1424
|
-
|
|
1424
|
+
wt = null, M(w.getState());
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1429
|
-
const
|
|
1430
|
-
r =
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
),
|
|
1434
|
-
accentColor:
|
|
1435
|
-
colorScheme:
|
|
1436
|
-
fontFamily:
|
|
1437
|
-
scribbleStyle:
|
|
1438
|
-
}),
|
|
1428
|
+
function Xt(a, d) {
|
|
1429
|
+
const f = a.accentColor ?? t.accentColor, y = a.colorScheme ?? t.colorScheme, N = a.fontFamily ?? t.fontFamily, Zt = a.scribbleStyle ?? t.scribbleStyle;
|
|
1430
|
+
r = io(
|
|
1431
|
+
f,
|
|
1432
|
+
Zt
|
|
1433
|
+
), ao(o, r, {
|
|
1434
|
+
accentColor: f,
|
|
1435
|
+
colorScheme: y,
|
|
1436
|
+
fontFamily: N,
|
|
1437
|
+
scribbleStyle: Zt
|
|
1438
|
+
}), J("web-sdk.widget", "Updated widget appearance", {
|
|
1439
1439
|
source: d,
|
|
1440
1440
|
inputAppearance: a,
|
|
1441
|
-
appliedAccentColor:
|
|
1442
|
-
appliedColorScheme:
|
|
1443
|
-
appliedFontFamily:
|
|
1444
|
-
appliedScribbleStyle:
|
|
1441
|
+
appliedAccentColor: f,
|
|
1442
|
+
appliedColorScheme: y,
|
|
1443
|
+
appliedFontFamily: N,
|
|
1444
|
+
appliedScribbleStyle: Zt,
|
|
1445
1445
|
cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
|
|
1446
1446
|
});
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
1449
|
-
function
|
|
1449
|
+
function io(e, t) {
|
|
1450
1450
|
return { accentColor: e, scribbleStyle: t };
|
|
1451
1451
|
}
|
|
1452
1452
|
function Ia(e) {
|
|
@@ -1472,7 +1472,7 @@ function Da([e, t, n]) {
|
|
|
1472
1472
|
};
|
|
1473
1473
|
return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function ao(e, t, n) {
|
|
1476
1476
|
e.classList.toggle(
|
|
1477
1477
|
"pluno-pa-widget--dark",
|
|
1478
1478
|
n.colorScheme === "dark"
|
|
@@ -1480,7 +1480,7 @@ function io(e, t, n) {
|
|
|
1480
1480
|
"pluno-pa-widget--light",
|
|
1481
1481
|
n.colorScheme !== "dark"
|
|
1482
1482
|
), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
1483
|
-
const i = n.scribbleStyle ?
|
|
1483
|
+
const i = n.scribbleStyle ? Lo(n.accentColor) : n.accentColor;
|
|
1484
1484
|
e.style.setProperty("--pluno-pa-accent", i), n.scribbleStyle ? e.style.setProperty(
|
|
1485
1485
|
"--pluno-pa-accent-contrast",
|
|
1486
1486
|
Ia(i)
|
|
@@ -1490,17 +1490,17 @@ function io(e, t, n) {
|
|
|
1490
1490
|
);
|
|
1491
1491
|
for (const r of o)
|
|
1492
1492
|
r.replaceWith(
|
|
1493
|
-
|
|
1493
|
+
Ae(
|
|
1494
1494
|
Array.from(r.classList).join(" "),
|
|
1495
1495
|
t
|
|
1496
1496
|
)
|
|
1497
1497
|
);
|
|
1498
1498
|
}
|
|
1499
1499
|
function za(e) {
|
|
1500
|
-
if (e.getElementById(
|
|
1500
|
+
if (e.getElementById(eo))
|
|
1501
1501
|
return;
|
|
1502
1502
|
const t = e.createElement("style");
|
|
1503
|
-
t.id =
|
|
1503
|
+
t.id = eo, t.textContent = `@font-face {
|
|
1504
1504
|
font-family: "Architects Daughter";
|
|
1505
1505
|
font-style: normal;
|
|
1506
1506
|
font-weight: 400;
|
|
@@ -1521,33 +1521,33 @@ function Ma({
|
|
|
1521
1521
|
l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1522
1522
|
}, C = (m) => {
|
|
1523
1523
|
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, p = { x: m.clientX, y: m.clientY }, s = i(), g = !1, t.setPointerCapture?.(m.pointerId));
|
|
1524
|
-
},
|
|
1524
|
+
}, P = (m) => {
|
|
1525
1525
|
if (l !== m.pointerId || !p || !s)
|
|
1526
1526
|
return;
|
|
1527
1527
|
m.preventDefault();
|
|
1528
|
-
const
|
|
1529
|
-
!g && Math.hypot(
|
|
1530
|
-
},
|
|
1528
|
+
const R = m.clientX - p.x, z = m.clientY - p.y;
|
|
1529
|
+
!g && Math.hypot(R, z) < fn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: s.x + R, y: s.y + z }));
|
|
1530
|
+
}, A = (m) => {
|
|
1531
1531
|
l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
|
|
1532
1532
|
}, O = (m) => {
|
|
1533
1533
|
l === m.pointerId && (m.preventDefault(), h());
|
|
1534
1534
|
}, u = (m) => {
|
|
1535
1535
|
if (!c)
|
|
1536
1536
|
return;
|
|
1537
|
-
const
|
|
1537
|
+
const R = Math.hypot(
|
|
1538
1538
|
m.clientX - c.x,
|
|
1539
1539
|
m.clientY - c.y
|
|
1540
|
-
) <=
|
|
1541
|
-
c = null,
|
|
1540
|
+
) <= fn;
|
|
1541
|
+
c = null, R && (m.preventDefault(), m.stopPropagation());
|
|
1542
1542
|
}, S = (m) => {
|
|
1543
1543
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1544
1544
|
return;
|
|
1545
|
-
const
|
|
1545
|
+
const R = m.shiftKey ? Oo : Mo, z = i();
|
|
1546
1546
|
let k = null;
|
|
1547
|
-
m.key === "ArrowUp" ? k = { x: z.x, y: z.y -
|
|
1547
|
+
m.key === "ArrowUp" ? k = { x: z.x, y: z.y - R } : m.key === "ArrowDown" ? k = { x: z.x, y: z.y + R } : m.key === "ArrowLeft" ? k = { x: z.x - R, y: z.y } : m.key === "ArrowRight" && (k = { x: z.x + R, y: z.y }), k && (m.preventDefault(), m.stopPropagation(), o(k), r());
|
|
1548
1548
|
};
|
|
1549
|
-
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove",
|
|
1550
|
-
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove",
|
|
1549
|
+
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", P), t.addEventListener("pointerup", A), t.addEventListener("pointercancel", O), t.addEventListener("click", u, !0), n.addEventListener("keydown", S), () => {
|
|
1550
|
+
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", A), t.removeEventListener("pointercancel", O), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", S);
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
1553
|
function Oa({
|
|
@@ -1562,58 +1562,58 @@ function Oa({
|
|
|
1562
1562
|
r = null, l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1563
1563
|
}, h = (u) => {
|
|
1564
1564
|
const S = u.currentTarget, m = S.dataset.resizeDirection;
|
|
1565
|
-
!e.classList.contains("pluno-pa-widget--open") || !
|
|
1565
|
+
!e.classList.contains("pluno-pa-widget--open") || !ro(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, S.setPointerCapture?.(u.pointerId));
|
|
1566
1566
|
}, C = (u) => {
|
|
1567
1567
|
if (r !== u.pointerId || !l || !p || !s)
|
|
1568
1568
|
return;
|
|
1569
1569
|
u.preventDefault(), u.stopPropagation();
|
|
1570
1570
|
const S = u.clientX - p.x, m = u.clientY - p.y;
|
|
1571
|
-
!g && Math.hypot(S, m) <
|
|
1572
|
-
|
|
1571
|
+
!g && Math.hypot(S, m) < fn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), i(
|
|
1572
|
+
lo(s, l, S, m)
|
|
1573
1573
|
));
|
|
1574
|
-
},
|
|
1574
|
+
}, P = (u) => {
|
|
1575
1575
|
r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && o(), c());
|
|
1576
|
-
},
|
|
1576
|
+
}, A = (u) => {
|
|
1577
1577
|
r === u.pointerId && (u.preventDefault(), c());
|
|
1578
1578
|
}, O = (u) => {
|
|
1579
|
-
const m = u.currentTarget.dataset.resizeDirection,
|
|
1580
|
-
let k = 0,
|
|
1581
|
-
|
|
1579
|
+
const m = u.currentTarget.dataset.resizeDirection, R = u.shiftKey ? Oo : Mo, z = n();
|
|
1580
|
+
let k = 0, ne = 0;
|
|
1581
|
+
ro(m) && (u.key === "ArrowLeft" ? k = -R : u.key === "ArrowRight" ? k = R : u.key === "ArrowUp" ? ne = -R : u.key === "ArrowDown" && (ne = R), !(k === 0 && ne === 0) && (u.preventDefault(), u.stopPropagation(), i(lo(z, m, k, ne)), o()));
|
|
1582
1582
|
};
|
|
1583
1583
|
for (const u of t)
|
|
1584
|
-
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup",
|
|
1584
|
+
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", A), u.addEventListener("keydown", O);
|
|
1585
1585
|
return () => {
|
|
1586
1586
|
for (const u of t)
|
|
1587
|
-
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup",
|
|
1587
|
+
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", A), u.removeEventListener("keydown", O);
|
|
1588
1588
|
};
|
|
1589
1589
|
}
|
|
1590
|
-
function
|
|
1590
|
+
function ro(e) {
|
|
1591
1591
|
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
|
|
1592
1592
|
}
|
|
1593
|
-
function
|
|
1594
|
-
const o =
|
|
1593
|
+
function lo(e, t, n, i) {
|
|
1594
|
+
const o = te(), r = so({
|
|
1595
1595
|
leading: e.position.x,
|
|
1596
1596
|
length: e.size.width,
|
|
1597
1597
|
delta: n,
|
|
1598
1598
|
resizeLeading: t.endsWith("left") || t === "left",
|
|
1599
1599
|
resizeTrailing: t.endsWith("right") || t === "right",
|
|
1600
|
-
minLeading:
|
|
1601
|
-
maxTrailing: o.width -
|
|
1600
|
+
minLeading: I,
|
|
1601
|
+
maxTrailing: o.width - I,
|
|
1602
1602
|
minLength: Math.min(
|
|
1603
|
-
|
|
1604
|
-
o.width -
|
|
1603
|
+
vn,
|
|
1604
|
+
o.width - I * 2
|
|
1605
1605
|
)
|
|
1606
|
-
}), l =
|
|
1606
|
+
}), l = so({
|
|
1607
1607
|
leading: e.position.y,
|
|
1608
1608
|
length: e.size.height,
|
|
1609
1609
|
delta: i,
|
|
1610
1610
|
resizeLeading: t.startsWith("top") || t === "top",
|
|
1611
1611
|
resizeTrailing: t.startsWith("bottom") || t === "bottom",
|
|
1612
|
-
minLeading:
|
|
1613
|
-
maxTrailing: o.height -
|
|
1612
|
+
minLeading: Oe,
|
|
1613
|
+
maxTrailing: o.height - I,
|
|
1614
1614
|
minLength: Math.min(
|
|
1615
|
-
|
|
1616
|
-
o.height -
|
|
1615
|
+
Sn,
|
|
1616
|
+
o.height - Oe - I
|
|
1617
1617
|
)
|
|
1618
1618
|
});
|
|
1619
1619
|
return {
|
|
@@ -1621,7 +1621,7 @@ function ro(e, t, n, i) {
|
|
|
1621
1621
|
size: { width: r.length, height: l.length }
|
|
1622
1622
|
};
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function so({
|
|
1625
1625
|
leading: e,
|
|
1626
1626
|
length: t,
|
|
1627
1627
|
delta: n,
|
|
@@ -1635,10 +1635,10 @@ function lo({
|
|
|
1635
1635
|
if (i) {
|
|
1636
1636
|
const g = e + n;
|
|
1637
1637
|
if (g >= r) {
|
|
1638
|
-
const h =
|
|
1638
|
+
const h = ee(g, r, s - p);
|
|
1639
1639
|
return { leading: h, length: s - h };
|
|
1640
1640
|
}
|
|
1641
|
-
const c =
|
|
1641
|
+
const c = ee(
|
|
1642
1642
|
s + r - g,
|
|
1643
1643
|
s,
|
|
1644
1644
|
l
|
|
@@ -1648,14 +1648,14 @@ function lo({
|
|
|
1648
1648
|
if (o) {
|
|
1649
1649
|
const g = s + n;
|
|
1650
1650
|
if (g <= l) {
|
|
1651
|
-
const h =
|
|
1651
|
+
const h = ee(
|
|
1652
1652
|
g,
|
|
1653
1653
|
e + p,
|
|
1654
1654
|
l
|
|
1655
1655
|
);
|
|
1656
1656
|
return { leading: e, length: h - e };
|
|
1657
1657
|
}
|
|
1658
|
-
const c =
|
|
1658
|
+
const c = ee(
|
|
1659
1659
|
e - (g - l),
|
|
1660
1660
|
r,
|
|
1661
1661
|
e
|
|
@@ -1664,73 +1664,73 @@ function lo({
|
|
|
1664
1664
|
}
|
|
1665
1665
|
return { leading: e, length: t };
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1668
|
-
const n =
|
|
1667
|
+
function Pt(e, t = !0) {
|
|
1668
|
+
const n = te();
|
|
1669
1669
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1670
|
-
return { width:
|
|
1670
|
+
return { width: to, height: to };
|
|
1671
1671
|
const i = e.getBoundingClientRect(), o = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1672
1672
|
return {
|
|
1673
|
-
width: t && o && i.width > 0 ? i.width : Math.min(
|
|
1674
|
-
height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? xa :
|
|
1673
|
+
width: t && o && i.width > 0 ? i.width : Math.min(Ro, n.width - 36),
|
|
1674
|
+
height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? xa : Do
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
1677
|
function Ua() {
|
|
1678
|
-
const e =
|
|
1678
|
+
const e = te();
|
|
1679
1679
|
return {
|
|
1680
1680
|
width: Math.min(
|
|
1681
|
-
|
|
1681
|
+
ee(
|
|
1682
1682
|
e.width * va,
|
|
1683
|
-
|
|
1683
|
+
vn,
|
|
1684
1684
|
ya
|
|
1685
1685
|
),
|
|
1686
|
-
e.width -
|
|
1686
|
+
e.width - I * 2
|
|
1687
1687
|
),
|
|
1688
1688
|
height: Math.min(
|
|
1689
|
-
|
|
1689
|
+
ee(
|
|
1690
1690
|
e.height * Ca,
|
|
1691
|
-
|
|
1691
|
+
Sn,
|
|
1692
1692
|
Sa
|
|
1693
1693
|
),
|
|
1694
|
-
e.height -
|
|
1694
|
+
e.height - Oe - I
|
|
1695
1695
|
)
|
|
1696
1696
|
};
|
|
1697
1697
|
}
|
|
1698
1698
|
function st(e = null) {
|
|
1699
|
-
return e ?
|
|
1699
|
+
return e ? Tt(e) : Ua();
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1702
|
-
const t =
|
|
1701
|
+
function Tt(e) {
|
|
1702
|
+
const t = te();
|
|
1703
1703
|
return {
|
|
1704
|
-
width:
|
|
1704
|
+
width: ee(
|
|
1705
1705
|
e.width,
|
|
1706
1706
|
Math.min(
|
|
1707
|
-
|
|
1708
|
-
t.width -
|
|
1707
|
+
vn,
|
|
1708
|
+
t.width - I * 2
|
|
1709
1709
|
),
|
|
1710
1710
|
Math.max(
|
|
1711
|
-
|
|
1712
|
-
t.width -
|
|
1711
|
+
I,
|
|
1712
|
+
t.width - I * 2
|
|
1713
1713
|
)
|
|
1714
1714
|
),
|
|
1715
|
-
height:
|
|
1715
|
+
height: ee(
|
|
1716
1716
|
e.height,
|
|
1717
1717
|
Math.min(
|
|
1718
|
-
|
|
1719
|
-
t.height -
|
|
1718
|
+
Sn,
|
|
1719
|
+
t.height - Oe - I
|
|
1720
1720
|
),
|
|
1721
1721
|
Math.max(
|
|
1722
|
-
|
|
1723
|
-
t.height -
|
|
1722
|
+
I,
|
|
1723
|
+
t.height - Oe - I
|
|
1724
1724
|
)
|
|
1725
1725
|
)
|
|
1726
1726
|
};
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1728
|
+
function en(e, t) {
|
|
1729
1729
|
if (!t) {
|
|
1730
1730
|
e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
|
|
1731
1731
|
return;
|
|
1732
1732
|
}
|
|
1733
|
-
const n =
|
|
1733
|
+
const n = Tt(t);
|
|
1734
1734
|
e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
1735
1735
|
}
|
|
1736
1736
|
function Ba(e, t, n) {
|
|
@@ -1740,57 +1740,57 @@ function Ba(e, t, n) {
|
|
|
1740
1740
|
const r = e.getBoundingClientRect();
|
|
1741
1741
|
if (r.width > 0 || r.height > 0)
|
|
1742
1742
|
return { x: r.left, y: r.top };
|
|
1743
|
-
const l =
|
|
1743
|
+
const l = te();
|
|
1744
1744
|
return {
|
|
1745
1745
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
1746
1746
|
y: l.height - 24 - n.height
|
|
1747
1747
|
};
|
|
1748
1748
|
}
|
|
1749
|
-
function
|
|
1750
|
-
const i =
|
|
1751
|
-
return t ?
|
|
1749
|
+
function tn(e, t, n) {
|
|
1750
|
+
const i = Pt(e, !1);
|
|
1751
|
+
return t ? wn(
|
|
1752
1752
|
e,
|
|
1753
|
-
|
|
1753
|
+
Fo(t, i),
|
|
1754
1754
|
i
|
|
1755
1755
|
) : Fa(n === "bottom-left" ? "bottom-left" : "bottom-right", i, _a);
|
|
1756
1756
|
}
|
|
1757
1757
|
function Fa(e, t, n) {
|
|
1758
|
-
const i =
|
|
1758
|
+
const i = te();
|
|
1759
1759
|
return {
|
|
1760
1760
|
x: e.endsWith("right") ? Math.max(0, i.width - t.width - n) : n,
|
|
1761
1761
|
y: e.startsWith("bottom") ? Math.max(0, i.height - t.height - n) : n
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
|
-
function
|
|
1765
|
-
const i =
|
|
1764
|
+
function wn(e, t, n) {
|
|
1765
|
+
const i = te(), o = I + Ga(e);
|
|
1766
1766
|
return {
|
|
1767
|
-
x:
|
|
1767
|
+
x: ee(
|
|
1768
1768
|
t.x,
|
|
1769
|
-
|
|
1769
|
+
I,
|
|
1770
1770
|
Math.max(
|
|
1771
|
-
|
|
1772
|
-
i.width - n.width -
|
|
1771
|
+
I,
|
|
1772
|
+
i.width - n.width - I
|
|
1773
1773
|
)
|
|
1774
1774
|
),
|
|
1775
|
-
y:
|
|
1775
|
+
y: ee(
|
|
1776
1776
|
t.y,
|
|
1777
1777
|
o,
|
|
1778
1778
|
Math.max(
|
|
1779
1779
|
o,
|
|
1780
|
-
i.height - n.height -
|
|
1780
|
+
i.height - n.height - I
|
|
1781
1781
|
)
|
|
1782
1782
|
)
|
|
1783
1783
|
};
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1786
|
-
const n =
|
|
1785
|
+
function Fo(e, t) {
|
|
1786
|
+
const n = te();
|
|
1787
1787
|
return {
|
|
1788
1788
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1789
1789
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1790
1790
|
};
|
|
1791
1791
|
}
|
|
1792
1792
|
function Wa(e, t) {
|
|
1793
|
-
const n = Ha(e, t), i =
|
|
1793
|
+
const n = Ha(e, t), i = te();
|
|
1794
1794
|
return {
|
|
1795
1795
|
anchor: n,
|
|
1796
1796
|
x: n.endsWith("right") ? i.width - e.x - t.width : e.x,
|
|
@@ -1798,41 +1798,41 @@ function Wa(e, t) {
|
|
|
1798
1798
|
};
|
|
1799
1799
|
}
|
|
1800
1800
|
function Ha(e, t) {
|
|
1801
|
-
const n =
|
|
1801
|
+
const n = te(), i = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = i <= n.width / 2 ? "left" : "right";
|
|
1802
1802
|
return `${r}-${l}`;
|
|
1803
1803
|
}
|
|
1804
1804
|
function Ga(e) {
|
|
1805
1805
|
return e.classList.contains("pluno-pa-widget--scribble") ? Pa : La;
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1808
|
-
const o =
|
|
1807
|
+
function nn(e, t, n, i = null) {
|
|
1808
|
+
const o = Pt(e), r = st(i), l = {
|
|
1809
1809
|
x: n === "bottom-left" ? t.x : t.x + o.width - r.width,
|
|
1810
1810
|
y: t.y + o.height - r.height
|
|
1811
1811
|
};
|
|
1812
|
-
return
|
|
1812
|
+
return Et(l, r);
|
|
1813
1813
|
}
|
|
1814
|
-
function
|
|
1815
|
-
const n =
|
|
1814
|
+
function Et(e, t) {
|
|
1815
|
+
const n = te();
|
|
1816
1816
|
return {
|
|
1817
|
-
x:
|
|
1817
|
+
x: ee(
|
|
1818
1818
|
e.x,
|
|
1819
|
-
|
|
1819
|
+
I,
|
|
1820
1820
|
Math.max(
|
|
1821
|
-
|
|
1822
|
-
n.width - t.width -
|
|
1821
|
+
I,
|
|
1822
|
+
n.width - t.width - I
|
|
1823
1823
|
)
|
|
1824
1824
|
),
|
|
1825
|
-
y:
|
|
1825
|
+
y: ee(
|
|
1826
1826
|
e.y,
|
|
1827
|
-
|
|
1827
|
+
Oe,
|
|
1828
1828
|
Math.max(
|
|
1829
|
-
|
|
1830
|
-
n.height - t.height -
|
|
1829
|
+
Oe,
|
|
1830
|
+
n.height - t.height - I
|
|
1831
1831
|
)
|
|
1832
1832
|
)
|
|
1833
1833
|
};
|
|
1834
1834
|
}
|
|
1835
|
-
function
|
|
1835
|
+
function Me(e, t) {
|
|
1836
1836
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1837
1837
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1838
1838
|
return;
|
|
@@ -1842,16 +1842,16 @@ function ze(e, t) {
|
|
|
1842
1842
|
function $a(e, t) {
|
|
1843
1843
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1844
1844
|
}
|
|
1845
|
-
function
|
|
1845
|
+
function po(e) {
|
|
1846
1846
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1847
1847
|
}
|
|
1848
|
-
function
|
|
1848
|
+
function te() {
|
|
1849
1849
|
return {
|
|
1850
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1851
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1850
|
+
width: window.innerWidth || document.documentElement.clientWidth || Ro + I * 2,
|
|
1851
|
+
height: window.innerHeight || document.documentElement.clientHeight || Do + I * 2
|
|
1852
1852
|
};
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function on(e) {
|
|
1855
1855
|
const t = e.getBoundingClientRect();
|
|
1856
1856
|
return {
|
|
1857
1857
|
x: Math.round(t.x),
|
|
@@ -1860,10 +1860,10 @@ function nn(e) {
|
|
|
1860
1860
|
height: Math.round(t.height)
|
|
1861
1861
|
};
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function ee(e, t, n) {
|
|
1864
1864
|
return Math.min(Math.max(e, t), n);
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1866
|
+
function J(e, t, n) {
|
|
1867
1867
|
if (typeof window > "u")
|
|
1868
1868
|
return;
|
|
1869
1869
|
const i = window, o = {
|
|
@@ -1877,9 +1877,9 @@ function X(e, t, n) {
|
|
|
1877
1877
|
);
|
|
1878
1878
|
}
|
|
1879
1879
|
function qa(e, t) {
|
|
1880
|
-
|
|
1880
|
+
J("web-sdk.widget.position", e, t);
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function an(e, t, n, i) {
|
|
1883
1883
|
const o = t.value.trim();
|
|
1884
1884
|
return !o && n.length === 0 ? n : (i(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
|
|
1885
1885
|
attachments: n.length > 0 ? n.map(Ka) : void 0
|
|
@@ -1963,7 +1963,7 @@ function er(e, t, n, i, o) {
|
|
|
1963
1963
|
o
|
|
1964
1964
|
)
|
|
1965
1965
|
), e.appendChild(
|
|
1966
|
-
|
|
1966
|
+
Nt(
|
|
1967
1967
|
"pluno-pa-widget__close",
|
|
1968
1968
|
"Close",
|
|
1969
1969
|
cr(16),
|
|
@@ -1978,12 +1978,12 @@ function tr(e, t, n, i) {
|
|
|
1978
1978
|
s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", o.appendChild(s);
|
|
1979
1979
|
}
|
|
1980
1980
|
o.appendChild(
|
|
1981
|
-
|
|
1981
|
+
$o(
|
|
1982
1982
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1983
1983
|
10
|
|
1984
1984
|
)
|
|
1985
1985
|
), o.appendChild(
|
|
1986
|
-
|
|
1986
|
+
Ae(
|
|
1987
1987
|
"pluno-pa-widget__character--launcher",
|
|
1988
1988
|
t
|
|
1989
1989
|
)
|
|
@@ -1992,7 +1992,7 @@ function tr(e, t, n, i) {
|
|
|
1992
1992
|
r.className = "pluno-pa-widget__launcher-run-indicator", o.appendChild(r);
|
|
1993
1993
|
const l = document.createElement("input");
|
|
1994
1994
|
l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), o.appendChild(l);
|
|
1995
|
-
const p =
|
|
1995
|
+
const p = At("Working...");
|
|
1996
1996
|
if (p.classList.add("pluno-pa-widget__status--launcher"), o.appendChild(p), i) {
|
|
1997
1997
|
const s = document.createElement("button");
|
|
1998
1998
|
s.type = "button", s.className = "pluno-pa-widget__launcher-minimize", s.textContent = "-", s.setAttribute("aria-label", "Minimize Pluno on this site"), s.title = "Minimize Pluno on this site", o.appendChild(s);
|
|
@@ -2002,7 +2002,7 @@ function tr(e, t, n, i) {
|
|
|
2002
2002
|
function nr(e) {
|
|
2003
2003
|
const t = document.createElement("section");
|
|
2004
2004
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
2005
|
-
|
|
2005
|
+
$o("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
2006
2006
|
);
|
|
2007
2007
|
const n = document.createElement("div");
|
|
2008
2008
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
@@ -2016,27 +2016,27 @@ function nr(e) {
|
|
|
2016
2016
|
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
|
|
2017
2017
|
const p = document.createElement("div");
|
|
2018
2018
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
2019
|
-
|
|
2019
|
+
Nt(
|
|
2020
2020
|
"pluno-pa-widget__history",
|
|
2021
|
-
|
|
2021
|
+
bn(),
|
|
2022
2022
|
gr(),
|
|
2023
2023
|
!0
|
|
2024
2024
|
)
|
|
2025
|
-
), n.appendChild(p), n.appendChild(rr()), t.appendChild(n), t.appendChild(or()), t.appendChild(ir()), t.appendChild(ar()), t.appendChild(
|
|
2026
|
-
|
|
2027
|
-
), t.appendChild(
|
|
2028
|
-
|
|
2025
|
+
), n.appendChild(p), n.appendChild(rr()), t.appendChild(n), t.appendChild(or()), t.appendChild(ir()), t.appendChild(ar()), t.appendChild(Pe("left", "Resize Pluno from left")), t.appendChild(
|
|
2026
|
+
Pe("right", "Resize Pluno from right")
|
|
2027
|
+
), t.appendChild(Pe("top", "Resize Pluno from top")), t.appendChild(
|
|
2028
|
+
Pe("bottom", "Resize Pluno from bottom")
|
|
2029
2029
|
), t.appendChild(
|
|
2030
|
-
|
|
2030
|
+
Pe("top-left", "Resize Pluno from top left")
|
|
2031
2031
|
), t.appendChild(
|
|
2032
|
-
|
|
2032
|
+
Pe("top-right", "Resize Pluno from top right")
|
|
2033
2033
|
), t.appendChild(
|
|
2034
|
-
|
|
2034
|
+
Pe("bottom-left", "Resize Pluno from bottom left")
|
|
2035
2035
|
), t.appendChild(
|
|
2036
|
-
|
|
2036
|
+
Pe("bottom-right", "Resize Pluno from bottom right")
|
|
2037
2037
|
), t;
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2039
|
+
function Pe(e, t) {
|
|
2040
2040
|
const n = document.createElement("button");
|
|
2041
2041
|
return n.type = "button", n.className = [
|
|
2042
2042
|
"pluno-pa-widget__resize-handle",
|
|
@@ -2087,7 +2087,7 @@ function ar() {
|
|
|
2087
2087
|
const p = document.createElement("textarea");
|
|
2088
2088
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", o.appendChild(p);
|
|
2089
2089
|
const s = document.createElement("button");
|
|
2090
|
-
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(
|
|
2090
|
+
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(jo()), o.appendChild(s), e.appendChild(o);
|
|
2091
2091
|
const g = document.createElement("div");
|
|
2092
2092
|
g.className = "pluno-pa-widget__composer-meta";
|
|
2093
2093
|
const c = document.createElement("a");
|
|
@@ -2095,17 +2095,17 @@ function ar() {
|
|
|
2095
2095
|
const h = document.createElement("span");
|
|
2096
2096
|
return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", g.appendChild(h), e.appendChild(g), e;
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2098
|
+
function bn() {
|
|
2099
2099
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
2100
2100
|
}
|
|
2101
2101
|
function rr() {
|
|
2102
2102
|
const e = document.createElement("section");
|
|
2103
|
-
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label",
|
|
2103
|
+
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", bn());
|
|
2104
2104
|
const t = document.createElement("div");
|
|
2105
2105
|
t.className = "pluno-pa-widget__history-header";
|
|
2106
2106
|
const n = document.createElement("strong");
|
|
2107
|
-
n.textContent =
|
|
2108
|
-
const i =
|
|
2107
|
+
n.textContent = bn();
|
|
2108
|
+
const i = Nt(
|
|
2109
2109
|
"pluno-pa-widget__history-close",
|
|
2110
2110
|
"Close recent chats",
|
|
2111
2111
|
hr(),
|
|
@@ -2120,17 +2120,17 @@ function rr() {
|
|
|
2120
2120
|
function lr(e) {
|
|
2121
2121
|
const t = document.createElement("div");
|
|
2122
2122
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
2123
|
-
|
|
2123
|
+
Ae(
|
|
2124
2124
|
"pluno-pa-widget__character--empty",
|
|
2125
2125
|
e
|
|
2126
2126
|
)
|
|
2127
|
-
), t.appendChild(
|
|
2127
|
+
), t.appendChild(Wo()), t;
|
|
2128
2128
|
}
|
|
2129
|
-
function
|
|
2129
|
+
function Wo() {
|
|
2130
2130
|
const e = document.createElement("div");
|
|
2131
2131
|
return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2133
|
+
function Ho(e, t) {
|
|
2134
2134
|
e.replaceChildren(), e.setAttribute(
|
|
2135
2135
|
"aria-label",
|
|
2136
2136
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -2142,9 +2142,9 @@ function Wo(e, t) {
|
|
|
2142
2142
|
)
|
|
2143
2143
|
);
|
|
2144
2144
|
}
|
|
2145
|
-
function
|
|
2146
|
-
const n = `pluno-pa-character-${
|
|
2147
|
-
|
|
2145
|
+
function Ae(e, t) {
|
|
2146
|
+
const n = `pluno-pa-character-${oo}`;
|
|
2147
|
+
oo += 1;
|
|
2148
2148
|
const i = t.scribbleStyle ? pr(t.accentColor, n) : sr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
|
|
2149
2149
|
return i.setAttribute(
|
|
2150
2150
|
"class",
|
|
@@ -2163,7 +2163,7 @@ function sr(e, t) {
|
|
|
2163
2163
|
eyeShadow: `${t}-eyeShadow`,
|
|
2164
2164
|
pupilGloss: `${t}-pupilGloss`,
|
|
2165
2165
|
boltClip: `${t}-boltClip`
|
|
2166
|
-
}, o =
|
|
2166
|
+
}, o = Go(), r = b(o, "defs"), l = b(r, "linearGradient", {
|
|
2167
2167
|
id: i.boltFill,
|
|
2168
2168
|
x1: "420",
|
|
2169
2169
|
y1: "180",
|
|
@@ -2171,8 +2171,8 @@ function sr(e, t) {
|
|
|
2171
2171
|
y2: "1040",
|
|
2172
2172
|
gradientUnits: "userSpaceOnUse"
|
|
2173
2173
|
});
|
|
2174
|
-
|
|
2175
|
-
const p =
|
|
2174
|
+
H(l, "0", n.top), H(l, "0.36", n.middle), H(l, "0.72", n.bottom), H(l, "1", n.bottom);
|
|
2175
|
+
const p = b(r, "linearGradient", {
|
|
2176
2176
|
id: i.boltEdge,
|
|
2177
2177
|
x1: "470",
|
|
2178
2178
|
y1: "145",
|
|
@@ -2180,29 +2180,29 @@ function sr(e, t) {
|
|
|
2180
2180
|
y2: "980",
|
|
2181
2181
|
gradientUnits: "userSpaceOnUse"
|
|
2182
2182
|
});
|
|
2183
|
-
|
|
2184
|
-
const s =
|
|
2183
|
+
H(p, "0", n.edgeStart), H(p, "0.32", n.edgeMiddle), H(p, "0.78", n.edgeEnd), H(p, "1", n.edgeEnd);
|
|
2184
|
+
const s = b(r, "radialGradient", {
|
|
2185
2185
|
id: i.boltGlow,
|
|
2186
2186
|
cx: "50%",
|
|
2187
2187
|
cy: "22%",
|
|
2188
2188
|
r: "82%"
|
|
2189
2189
|
});
|
|
2190
|
-
|
|
2191
|
-
const g =
|
|
2190
|
+
H(s, "0", n.glow, "0.72"), H(s, "0.5", n.middle, "0.44"), H(s, "1", n.bottom, "0");
|
|
2191
|
+
const g = b(r, "radialGradient", {
|
|
2192
2192
|
id: i.eyeWhite,
|
|
2193
2193
|
cx: "35%",
|
|
2194
2194
|
cy: "25%",
|
|
2195
2195
|
r: "70%"
|
|
2196
2196
|
});
|
|
2197
|
-
|
|
2198
|
-
const c =
|
|
2197
|
+
H(g, "0", "#ffffff"), H(g, "0.72", "#ffffff"), H(g, "1", "#e5e5e5");
|
|
2198
|
+
const c = b(r, "radialGradient", {
|
|
2199
2199
|
id: i.pupil,
|
|
2200
2200
|
cx: "42%",
|
|
2201
2201
|
cy: "38%",
|
|
2202
2202
|
r: "65%"
|
|
2203
2203
|
});
|
|
2204
|
-
|
|
2205
|
-
const h =
|
|
2204
|
+
H(c, "0", "#2a1f10"), H(c, "0.52", "#080604"), H(c, "1", "#000000");
|
|
2205
|
+
const h = b(r, "filter", {
|
|
2206
2206
|
id: i.softDropShadow,
|
|
2207
2207
|
x: "-18%",
|
|
2208
2208
|
y: "-12%",
|
|
@@ -2210,14 +2210,14 @@ function sr(e, t) {
|
|
|
2210
2210
|
height: "136%",
|
|
2211
2211
|
"color-interpolation-filters": "sRGB"
|
|
2212
2212
|
});
|
|
2213
|
-
|
|
2213
|
+
b(h, "feDropShadow", {
|
|
2214
2214
|
dx: "0",
|
|
2215
2215
|
dy: "12",
|
|
2216
2216
|
stdDeviation: "18",
|
|
2217
2217
|
"flood-color": n.shadow,
|
|
2218
2218
|
"flood-opacity": "0.24"
|
|
2219
2219
|
});
|
|
2220
|
-
const C =
|
|
2220
|
+
const C = b(r, "filter", {
|
|
2221
2221
|
id: i.innerDepth,
|
|
2222
2222
|
x: "-8%",
|
|
2223
2223
|
y: "-8%",
|
|
@@ -2225,32 +2225,32 @@ function sr(e, t) {
|
|
|
2225
2225
|
height: "116%",
|
|
2226
2226
|
"color-interpolation-filters": "sRGB"
|
|
2227
2227
|
});
|
|
2228
|
-
|
|
2228
|
+
b(C, "feGaussianBlur", {
|
|
2229
2229
|
in: "SourceAlpha",
|
|
2230
2230
|
stdDeviation: "8",
|
|
2231
2231
|
result: "blur"
|
|
2232
|
-
}),
|
|
2232
|
+
}), b(C, "feOffset", {
|
|
2233
2233
|
dx: "-7",
|
|
2234
2234
|
dy: "-9",
|
|
2235
2235
|
result: "topLeft"
|
|
2236
|
-
}),
|
|
2236
|
+
}), b(C, "feComposite", {
|
|
2237
2237
|
in: "topLeft",
|
|
2238
2238
|
in2: "SourceAlpha",
|
|
2239
2239
|
operator: "arithmetic",
|
|
2240
2240
|
k2: "-1",
|
|
2241
2241
|
k3: "1",
|
|
2242
2242
|
result: "innerShadow"
|
|
2243
|
-
}),
|
|
2243
|
+
}), b(C, "feColorMatrix", {
|
|
2244
2244
|
in: "innerShadow",
|
|
2245
2245
|
type: "matrix",
|
|
2246
2246
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
2247
2247
|
result: "innerLight"
|
|
2248
|
-
}),
|
|
2248
|
+
}), b(C, "feBlend", {
|
|
2249
2249
|
in: "SourceGraphic",
|
|
2250
2250
|
in2: "innerLight",
|
|
2251
2251
|
mode: "screen"
|
|
2252
2252
|
});
|
|
2253
|
-
const
|
|
2253
|
+
const P = b(r, "filter", {
|
|
2254
2254
|
id: i.eyeShadow,
|
|
2255
2255
|
x: "-24%",
|
|
2256
2256
|
y: "-20%",
|
|
@@ -2258,14 +2258,14 @@ function sr(e, t) {
|
|
|
2258
2258
|
height: "148%",
|
|
2259
2259
|
"color-interpolation-filters": "sRGB"
|
|
2260
2260
|
});
|
|
2261
|
-
|
|
2261
|
+
b(P, "feDropShadow", {
|
|
2262
2262
|
dx: "0",
|
|
2263
2263
|
dy: "8",
|
|
2264
2264
|
stdDeviation: "5",
|
|
2265
2265
|
"flood-color": n.shadow,
|
|
2266
2266
|
"flood-opacity": "0.3"
|
|
2267
2267
|
});
|
|
2268
|
-
const
|
|
2268
|
+
const A = b(r, "filter", {
|
|
2269
2269
|
id: i.pupilGloss,
|
|
2270
2270
|
x: "-15%",
|
|
2271
2271
|
y: "-15%",
|
|
@@ -2273,51 +2273,51 @@ function sr(e, t) {
|
|
|
2273
2273
|
height: "130%",
|
|
2274
2274
|
"color-interpolation-filters": "sRGB"
|
|
2275
2275
|
});
|
|
2276
|
-
|
|
2276
|
+
b(A, "feDropShadow", {
|
|
2277
2277
|
dx: "0",
|
|
2278
2278
|
dy: "3",
|
|
2279
2279
|
stdDeviation: "3",
|
|
2280
2280
|
"flood-color": "#000000",
|
|
2281
2281
|
"flood-opacity": "0.22"
|
|
2282
2282
|
});
|
|
2283
|
-
const O =
|
|
2284
|
-
|
|
2285
|
-
const u =
|
|
2286
|
-
filter:
|
|
2283
|
+
const O = b(r, "clipPath", { id: i.boltClip });
|
|
2284
|
+
b(O, "path", { d: kt });
|
|
2285
|
+
const u = b(o, "g", {
|
|
2286
|
+
filter: Q(i.softDropShadow)
|
|
2287
2287
|
});
|
|
2288
|
-
|
|
2289
|
-
d:
|
|
2290
|
-
fill:
|
|
2288
|
+
b(u, "path", {
|
|
2289
|
+
d: kt,
|
|
2290
|
+
fill: Q(i.boltEdge)
|
|
2291
2291
|
});
|
|
2292
2292
|
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";
|
|
2293
|
-
|
|
2293
|
+
b(u, "path", {
|
|
2294
2294
|
d: S,
|
|
2295
|
-
fill:
|
|
2296
|
-
filter:
|
|
2297
|
-
}),
|
|
2295
|
+
fill: Q(i.boltFill),
|
|
2296
|
+
filter: Q(i.innerDepth)
|
|
2297
|
+
}), b(u, "path", {
|
|
2298
2298
|
d: S,
|
|
2299
|
-
fill:
|
|
2299
|
+
fill: Q(i.boltGlow),
|
|
2300
2300
|
opacity: "0.74"
|
|
2301
2301
|
});
|
|
2302
|
-
const m =
|
|
2303
|
-
"clip-path":
|
|
2302
|
+
const m = b(u, "g", {
|
|
2303
|
+
"clip-path": Q(i.boltClip),
|
|
2304
2304
|
opacity: "0.42"
|
|
2305
2305
|
});
|
|
2306
|
-
|
|
2306
|
+
b(m, "path", {
|
|
2307
2307
|
d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
|
|
2308
2308
|
fill: "none",
|
|
2309
2309
|
stroke: n.highlight,
|
|
2310
2310
|
"stroke-width": "22",
|
|
2311
2311
|
"stroke-linecap": "round",
|
|
2312
2312
|
opacity: "0.65"
|
|
2313
|
-
}),
|
|
2313
|
+
}), b(m, "path", {
|
|
2314
2314
|
d: "M556 685 L501 994",
|
|
2315
2315
|
fill: "none",
|
|
2316
2316
|
stroke: n.highlight,
|
|
2317
2317
|
"stroke-width": "20",
|
|
2318
2318
|
"stroke-linecap": "round",
|
|
2319
2319
|
opacity: "0.55"
|
|
2320
|
-
}),
|
|
2320
|
+
}), b(m, "path", {
|
|
2321
2321
|
d: "M858 160 C882 166 893 181 883 204",
|
|
2322
2322
|
fill: "none",
|
|
2323
2323
|
stroke: n.inner,
|
|
@@ -2325,9 +2325,9 @@ function sr(e, t) {
|
|
|
2325
2325
|
"stroke-linecap": "round",
|
|
2326
2326
|
opacity: "0.48"
|
|
2327
2327
|
});
|
|
2328
|
-
const
|
|
2329
|
-
return
|
|
2330
|
-
|
|
2328
|
+
const R = b(o, "g", { filter: Q(i.eyeShadow) });
|
|
2329
|
+
return co(
|
|
2330
|
+
R,
|
|
2331
2331
|
"rotate(-2 528 463)",
|
|
2332
2332
|
"528",
|
|
2333
2333
|
"463",
|
|
@@ -2336,8 +2336,8 @@ function sr(e, t) {
|
|
|
2336
2336
|
"557",
|
|
2337
2337
|
"447",
|
|
2338
2338
|
i
|
|
2339
|
-
),
|
|
2340
|
-
|
|
2339
|
+
), co(
|
|
2340
|
+
R,
|
|
2341
2341
|
"rotate(2 717 462)",
|
|
2342
2342
|
"717",
|
|
2343
2343
|
"462",
|
|
@@ -2349,12 +2349,12 @@ function sr(e, t) {
|
|
|
2349
2349
|
), o;
|
|
2350
2350
|
}
|
|
2351
2351
|
function pr(e, t) {
|
|
2352
|
-
const n =
|
|
2352
|
+
const n = Lo(e), i = {
|
|
2353
2353
|
clip: `${t}-scribbleBoltClip`,
|
|
2354
2354
|
wobble: `${t}-scribbleBoltWobble`
|
|
2355
|
-
}, o =
|
|
2356
|
-
|
|
2357
|
-
const p =
|
|
2355
|
+
}, o = Go(), r = b(o, "defs"), l = b(r, "clipPath", { id: i.clip });
|
|
2356
|
+
b(l, "path", { d: kt });
|
|
2357
|
+
const p = b(r, "filter", {
|
|
2358
2358
|
id: i.wobble,
|
|
2359
2359
|
x: "-10%",
|
|
2360
2360
|
y: "-10%",
|
|
@@ -2362,23 +2362,23 @@ function pr(e, t) {
|
|
|
2362
2362
|
height: "120%",
|
|
2363
2363
|
"color-interpolation-filters": "sRGB"
|
|
2364
2364
|
});
|
|
2365
|
-
|
|
2365
|
+
b(p, "feTurbulence", {
|
|
2366
2366
|
type: "fractalNoise",
|
|
2367
2367
|
baseFrequency: "0.011",
|
|
2368
2368
|
numOctaves: "3",
|
|
2369
2369
|
seed: "7",
|
|
2370
2370
|
result: "noise"
|
|
2371
|
-
}),
|
|
2371
|
+
}), b(p, "feDisplacementMap", {
|
|
2372
2372
|
in: "SourceGraphic",
|
|
2373
2373
|
in2: "noise",
|
|
2374
2374
|
scale: "16",
|
|
2375
2375
|
xChannelSelector: "R",
|
|
2376
2376
|
yChannelSelector: "G"
|
|
2377
2377
|
});
|
|
2378
|
-
const s =
|
|
2379
|
-
"clip-path":
|
|
2378
|
+
const s = b(o, "g", { filter: Q(i.wobble) }), g = b(s, "g", {
|
|
2379
|
+
"clip-path": Q(i.clip)
|
|
2380
2380
|
});
|
|
2381
|
-
return
|
|
2381
|
+
return b(g, "path", {
|
|
2382
2382
|
d: Ci(),
|
|
2383
2383
|
fill: "none",
|
|
2384
2384
|
stroke: n,
|
|
@@ -2387,13 +2387,13 @@ function pr(e, t) {
|
|
|
2387
2387
|
"stroke-linejoin": "round",
|
|
2388
2388
|
opacity: "0.9",
|
|
2389
2389
|
transform: "rotate(-14 627 600)"
|
|
2390
|
-
}),
|
|
2391
|
-
d:
|
|
2390
|
+
}), b(s, "path", {
|
|
2391
|
+
d: kt,
|
|
2392
2392
|
fill: "none",
|
|
2393
|
-
stroke:
|
|
2393
|
+
stroke: Lt,
|
|
2394
2394
|
"stroke-width": "18",
|
|
2395
2395
|
"stroke-linejoin": "round"
|
|
2396
|
-
}),
|
|
2396
|
+
}), uo(
|
|
2397
2397
|
s,
|
|
2398
2398
|
"rotate(-2 528 463)",
|
|
2399
2399
|
"528",
|
|
@@ -2402,7 +2402,7 @@ function pr(e, t) {
|
|
|
2402
2402
|
"473",
|
|
2403
2403
|
"557",
|
|
2404
2404
|
"447"
|
|
2405
|
-
),
|
|
2405
|
+
), uo(
|
|
2406
2406
|
s,
|
|
2407
2407
|
"rotate(2 717 462)",
|
|
2408
2408
|
"717",
|
|
@@ -2413,69 +2413,69 @@ function pr(e, t) {
|
|
|
2413
2413
|
"447"
|
|
2414
2414
|
), o;
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function Go() {
|
|
2417
2417
|
return E("svg", {
|
|
2418
|
-
xmlns:
|
|
2418
|
+
xmlns: zo,
|
|
2419
2419
|
viewBox: "0 0 1254 1254"
|
|
2420
2420
|
});
|
|
2421
2421
|
}
|
|
2422
|
-
function
|
|
2423
|
-
const g =
|
|
2424
|
-
|
|
2422
|
+
function co(e, t, n, i, o, r, l, p, s) {
|
|
2423
|
+
const g = b(e, "g", { transform: t });
|
|
2424
|
+
b(g, "ellipse", {
|
|
2425
2425
|
cx: n,
|
|
2426
2426
|
cy: i,
|
|
2427
2427
|
rx: "73",
|
|
2428
2428
|
ry: "80",
|
|
2429
|
-
fill:
|
|
2430
|
-
}),
|
|
2429
|
+
fill: Q(s.eyeWhite)
|
|
2430
|
+
}), b(g, "ellipse", {
|
|
2431
2431
|
cx: o,
|
|
2432
2432
|
cy: r,
|
|
2433
2433
|
rx: "49",
|
|
2434
2434
|
ry: "57",
|
|
2435
|
-
fill:
|
|
2436
|
-
filter:
|
|
2437
|
-
}),
|
|
2435
|
+
fill: Q(s.pupil),
|
|
2436
|
+
filter: Q(s.pupilGloss)
|
|
2437
|
+
}), b(g, "circle", {
|
|
2438
2438
|
cx: l,
|
|
2439
2439
|
cy: p,
|
|
2440
2440
|
r: "18",
|
|
2441
2441
|
fill: "#ffffff"
|
|
2442
2442
|
});
|
|
2443
2443
|
}
|
|
2444
|
-
function
|
|
2445
|
-
const s =
|
|
2446
|
-
|
|
2444
|
+
function uo(e, t, n, i, o, r, l, p) {
|
|
2445
|
+
const s = b(e, "g", { transform: t });
|
|
2446
|
+
b(s, "ellipse", {
|
|
2447
2447
|
cx: n,
|
|
2448
2448
|
cy: i,
|
|
2449
2449
|
rx: "73",
|
|
2450
2450
|
ry: "80",
|
|
2451
2451
|
fill: "#ffffff",
|
|
2452
|
-
stroke:
|
|
2452
|
+
stroke: Lt,
|
|
2453
2453
|
"stroke-width": "13"
|
|
2454
|
-
}),
|
|
2454
|
+
}), b(s, "ellipse", {
|
|
2455
2455
|
cx: o,
|
|
2456
2456
|
cy: r,
|
|
2457
2457
|
rx: "45",
|
|
2458
2458
|
ry: "53",
|
|
2459
|
-
fill:
|
|
2460
|
-
}),
|
|
2459
|
+
fill: Lt
|
|
2460
|
+
}), b(s, "circle", {
|
|
2461
2461
|
cx: l,
|
|
2462
2462
|
cy: p,
|
|
2463
2463
|
r: "16",
|
|
2464
2464
|
fill: "#ffffff"
|
|
2465
2465
|
});
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function b(e, t, n = {}) {
|
|
2468
2468
|
const i = E(t, n);
|
|
2469
2469
|
return e.appendChild(i), i;
|
|
2470
2470
|
}
|
|
2471
|
-
function
|
|
2471
|
+
function H(e, t, n, i) {
|
|
2472
2472
|
const o = { offset: t, "stop-color": n };
|
|
2473
|
-
i !== void 0 && (o["stop-opacity"] = i),
|
|
2473
|
+
i !== void 0 && (o["stop-opacity"] = i), b(e, "stop", o);
|
|
2474
2474
|
}
|
|
2475
|
-
function
|
|
2475
|
+
function Q(e) {
|
|
2476
2476
|
return `url(#${e})`;
|
|
2477
2477
|
}
|
|
2478
|
-
function
|
|
2478
|
+
function Nt(e, t, n, i) {
|
|
2479
2479
|
const o = document.createElement("button");
|
|
2480
2480
|
return o.type = "button", o.className = e, o.setAttribute("aria-label", t), o.title = t, o.hidden = i, o.appendChild(n), o;
|
|
2481
2481
|
}
|
|
@@ -2487,46 +2487,46 @@ function dr() {
|
|
|
2487
2487
|
width: "0",
|
|
2488
2488
|
height: "0"
|
|
2489
2489
|
}), t = E("defs");
|
|
2490
|
-
return t.appendChild(
|
|
2491
|
-
|
|
2490
|
+
return t.appendChild(ln("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
2491
|
+
ln("pluno-pa-scribble-wobble-2", "5", "15")
|
|
2492
2492
|
), t.appendChild(
|
|
2493
|
-
|
|
2493
|
+
ln("pluno-pa-scribble-wobble-3", "9", "19")
|
|
2494
2494
|
), e.appendChild(t), e;
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function $o(e, t) {
|
|
2497
2497
|
const n = E("svg", {
|
|
2498
2498
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2499
2499
|
preserveAspectRatio: "xMidYMid meet",
|
|
2500
2500
|
"aria-hidden": "true",
|
|
2501
2501
|
focusable: "false"
|
|
2502
2502
|
});
|
|
2503
|
-
return
|
|
2503
|
+
return qo(n, t), n;
|
|
2504
2504
|
}
|
|
2505
|
-
function
|
|
2505
|
+
function rn(e, t) {
|
|
2506
2506
|
if (!e)
|
|
2507
2507
|
return;
|
|
2508
2508
|
const n = Math.max(
|
|
2509
2509
|
0,
|
|
2510
|
-
t -
|
|
2510
|
+
t - mn * 2
|
|
2511
2511
|
), i = Math.max(
|
|
2512
2512
|
ka,
|
|
2513
2513
|
Math.floor(
|
|
2514
|
-
(n -
|
|
2514
|
+
(n - hn * 2) / gn
|
|
2515
2515
|
)
|
|
2516
2516
|
);
|
|
2517
|
-
|
|
2517
|
+
qo(e, i);
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function qo(e, t) {
|
|
2520
2520
|
if (e.dataset.spiralCount === `${t}`)
|
|
2521
2521
|
return;
|
|
2522
|
-
const n = t *
|
|
2522
|
+
const n = t * gn + hn * 2;
|
|
2523
2523
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2524
2524
|
"viewBox",
|
|
2525
2525
|
`0 0 ${n} ${Ea}`
|
|
2526
2526
|
), e.replaceChildren();
|
|
2527
2527
|
for (let i = 0; i < t; i += 1) {
|
|
2528
|
-
const o =
|
|
2529
|
-
transform: `translate(${
|
|
2528
|
+
const o = no[i % no.length], r = E("g", {
|
|
2529
|
+
transform: `translate(${hn + i * gn} 0)`
|
|
2530
2530
|
});
|
|
2531
2531
|
r.appendChild(
|
|
2532
2532
|
E("ellipse", {
|
|
@@ -2550,7 +2550,7 @@ function $o(e, t) {
|
|
|
2550
2550
|
), e.appendChild(r);
|
|
2551
2551
|
}
|
|
2552
2552
|
}
|
|
2553
|
-
function
|
|
2553
|
+
function ln(e, t, n) {
|
|
2554
2554
|
const i = E("filter", {
|
|
2555
2555
|
id: e,
|
|
2556
2556
|
x: "-8%",
|
|
@@ -2645,7 +2645,7 @@ function hr() {
|
|
|
2645
2645
|
);
|
|
2646
2646
|
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2647
2647
|
}
|
|
2648
|
-
function
|
|
2648
|
+
function jo() {
|
|
2649
2649
|
const e = ue(
|
|
2650
2650
|
"0 0 24 24",
|
|
2651
2651
|
14,
|
|
@@ -2749,12 +2749,12 @@ function ue(e, t, n, i, o, r) {
|
|
|
2749
2749
|
return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
|
|
2750
2750
|
}
|
|
2751
2751
|
function E(e, t = {}) {
|
|
2752
|
-
const n = document.createElementNS(
|
|
2752
|
+
const n = document.createElementNS(zo, e);
|
|
2753
2753
|
for (const [i, o] of Object.entries(t))
|
|
2754
2754
|
n.setAttribute(i, o);
|
|
2755
2755
|
return n;
|
|
2756
2756
|
}
|
|
2757
|
-
function
|
|
2757
|
+
function go(e) {
|
|
2758
2758
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2759
2759
|
e.addEventListener(t, (n) => {
|
|
2760
2760
|
n.stopPropagation();
|
|
@@ -2772,7 +2772,7 @@ function xr(e, t, n) {
|
|
|
2772
2772
|
}
|
|
2773
2773
|
}
|
|
2774
2774
|
function yr(e) {
|
|
2775
|
-
const t =
|
|
2775
|
+
const t = Cn(e), n = Vo(e);
|
|
2776
2776
|
if (t === "image" && n) {
|
|
2777
2777
|
const i = document.createElement("img");
|
|
2778
2778
|
return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener("error", () => i.replaceWith(ce(e))), i;
|
|
@@ -2784,7 +2784,7 @@ function yr(e) {
|
|
|
2784
2784
|
return ce(e);
|
|
2785
2785
|
}
|
|
2786
2786
|
function vr(e, t) {
|
|
2787
|
-
const n =
|
|
2787
|
+
const n = Cn(e), i = Vo(e);
|
|
2788
2788
|
if (n === "image" && i) {
|
|
2789
2789
|
const o = document.createElement("img");
|
|
2790
2790
|
o.className = "pluno-pa-widget__message-attachment-preview", o.alt = e.name;
|
|
@@ -2815,23 +2815,23 @@ function vr(e, t) {
|
|
|
2815
2815
|
function ce(e, t = "composer") {
|
|
2816
2816
|
if (t === "composer") {
|
|
2817
2817
|
const r = document.createElement("span");
|
|
2818
|
-
return r.className = "pluno-pa-widget__attachment-file", r.textContent =
|
|
2818
|
+
return r.className = "pluno-pa-widget__attachment-file", r.textContent = ho(e), r;
|
|
2819
2819
|
}
|
|
2820
2820
|
const n = document.createElement("div");
|
|
2821
2821
|
n.className = "pluno-pa-widget__message-attachment-file";
|
|
2822
2822
|
const i = document.createElement("span");
|
|
2823
|
-
i.textContent =
|
|
2823
|
+
i.textContent = ho(e);
|
|
2824
2824
|
const o = document.createElement("strong");
|
|
2825
2825
|
return o.textContent = e.name, n.append(i, o), n;
|
|
2826
2826
|
}
|
|
2827
|
-
function
|
|
2827
|
+
function Cn(e) {
|
|
2828
2828
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2829
2829
|
}
|
|
2830
|
-
function
|
|
2830
|
+
function Vo(e) {
|
|
2831
2831
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2832
2832
|
}
|
|
2833
|
-
function
|
|
2834
|
-
const t =
|
|
2833
|
+
function ho(e) {
|
|
2834
|
+
const t = Cn(e);
|
|
2835
2835
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2836
2836
|
}
|
|
2837
2837
|
function Sr(e, t) {
|
|
@@ -2843,17 +2843,17 @@ function Sr(e, t) {
|
|
|
2843
2843
|
function Cr(e) {
|
|
2844
2844
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2845
2845
|
}
|
|
2846
|
-
function
|
|
2846
|
+
function St(e) {
|
|
2847
2847
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2848
2848
|
}
|
|
2849
|
-
function
|
|
2850
|
-
if (!e || !
|
|
2849
|
+
function sn(e, t, n = null) {
|
|
2850
|
+
if (!e || !_n(t, n)) {
|
|
2851
2851
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2852
2852
|
return;
|
|
2853
2853
|
}
|
|
2854
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
2854
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", se(t) || En(n) ? e.appendChild(
|
|
2855
2855
|
Er(t, n)
|
|
2856
|
-
) :
|
|
2856
|
+
) : Ko(t) && e.appendChild(kr(t));
|
|
2857
2857
|
}
|
|
2858
2858
|
function Er(e, t) {
|
|
2859
2859
|
const n = document.createElement("div");
|
|
@@ -2862,7 +2862,7 @@ function Er(e, t) {
|
|
|
2862
2862
|
o.textContent = i ? "Credits used up" : "Billing needs attention", n.appendChild(o);
|
|
2863
2863
|
const r = document.createElement("span");
|
|
2864
2864
|
return r.textContent = i ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
|
|
2865
|
-
|
|
2865
|
+
Yo(
|
|
2866
2866
|
e,
|
|
2867
2867
|
"Upgrade plan",
|
|
2868
2868
|
"pluno-pa-widget__billing-action-card-actions"
|
|
@@ -2876,30 +2876,30 @@ function kr(e) {
|
|
|
2876
2876
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2877
2877
|
const i = document.createElement("span");
|
|
2878
2878
|
return i.textContent = Pr(e) ?? "Credits are running low for this period.", t.appendChild(i), t.appendChild(
|
|
2879
|
-
|
|
2879
|
+
Yo(
|
|
2880
2880
|
e,
|
|
2881
2881
|
"Upgrade",
|
|
2882
2882
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2883
2883
|
)
|
|
2884
2884
|
), t;
|
|
2885
2885
|
}
|
|
2886
|
-
function
|
|
2887
|
-
return e !== null && (
|
|
2886
|
+
function _n(e, t) {
|
|
2887
|
+
return e !== null && (se(e) || Ko(e) || En(t));
|
|
2888
2888
|
}
|
|
2889
|
-
function
|
|
2890
|
-
return
|
|
2889
|
+
function mo(e, t, n) {
|
|
2890
|
+
return _n(t, n) || Lr(t) ? !0 : !_n(e, n);
|
|
2891
2891
|
}
|
|
2892
2892
|
function Lr(e) {
|
|
2893
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
2893
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || se(e));
|
|
2894
2894
|
}
|
|
2895
|
-
function
|
|
2895
|
+
function se(e) {
|
|
2896
2896
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2897
2897
|
}
|
|
2898
|
-
function
|
|
2898
|
+
function En(e) {
|
|
2899
2899
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2900
2900
|
}
|
|
2901
|
-
function
|
|
2902
|
-
return !
|
|
2901
|
+
function Ko(e) {
|
|
2902
|
+
return !se(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2903
2903
|
}
|
|
2904
2904
|
function Pr(e) {
|
|
2905
2905
|
return e.creditsRemaining === null ? null : `${Ar(e.creditsRemaining)} credits left`;
|
|
@@ -2909,15 +2909,15 @@ function Ar(e) {
|
|
|
2909
2909
|
maximumFractionDigits: 0
|
|
2910
2910
|
}).format(Math.ceil(e));
|
|
2911
2911
|
}
|
|
2912
|
-
function
|
|
2912
|
+
function Yo(e, t, n) {
|
|
2913
2913
|
const i = document.createElement("div");
|
|
2914
2914
|
return i.className = n, i.appendChild(
|
|
2915
|
-
|
|
2915
|
+
fo(t, e.pricingUrl)
|
|
2916
2916
|
), i.appendChild(
|
|
2917
|
-
|
|
2917
|
+
fo("Earn credits", e.earnCreditsUrl)
|
|
2918
2918
|
), i;
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function fo(e, t) {
|
|
2921
2921
|
const n = document.createElement("button");
|
|
2922
2922
|
if (n.type = "button", e === "Earn credits") {
|
|
2923
2923
|
const i = document.createElement("span");
|
|
@@ -2928,163 +2928,167 @@ function mo(e, t) {
|
|
|
2928
2928
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2929
2929
|
}), n;
|
|
2930
2930
|
}
|
|
2931
|
-
function
|
|
2931
|
+
function pn(e, t) {
|
|
2932
2932
|
return e.messages.filter(
|
|
2933
|
-
(i) => !
|
|
2933
|
+
(i) => !Xo(i)
|
|
2934
2934
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2935
2935
|
}
|
|
2936
|
-
function Tr(e, t, n, i, o, r, l, p, s, g, c, h, C,
|
|
2937
|
-
const
|
|
2938
|
-
(
|
|
2939
|
-
), Ze = e.scrollTop,
|
|
2940
|
-
|
|
2936
|
+
function Tr(e, t, n, i, o, r, l, p, s, g, c, h, C, P, A, O, u, S, m, R, z, k) {
|
|
2937
|
+
const ne = zr(r), G = ne.filter(
|
|
2938
|
+
(_) => !Xo(_)
|
|
2939
|
+
), Ze = e.scrollTop, Ue = [], ge = /* @__PURE__ */ new Set(), U = (_) => {
|
|
2940
|
+
Ue.push(_);
|
|
2941
2941
|
};
|
|
2942
|
-
|
|
2943
|
-
const x =
|
|
2944
|
-
if (i(x), u ||
|
|
2945
|
-
const
|
|
2946
|
-
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2949
|
-
const
|
|
2942
|
+
Jo(n, r.isThinking), o.hidden = !p, p && l !== null && Ho(o, l);
|
|
2943
|
+
const x = G.length > 0 || !!r.assistantDraft || r.isThinking;
|
|
2944
|
+
if (i(x), u || G.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
|
|
2945
|
+
const _ = document.createElement("div");
|
|
2946
|
+
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
|
|
2947
|
+
const L = document.createElement("div");
|
|
2948
|
+
L.className = "pluno-pa-widget__empty-hero";
|
|
2949
|
+
const W = Ae(
|
|
2950
2950
|
"pluno-pa-widget__character--empty",
|
|
2951
|
-
|
|
2951
|
+
P()
|
|
2952
2952
|
);
|
|
2953
|
-
if (
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2953
|
+
if (L.appendChild(W), _.appendChild(L), u) {
|
|
2954
|
+
const v = document.createElement("h2");
|
|
2955
|
+
v.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", v.textContent = u.opening, _.appendChild(v);
|
|
2956
2956
|
} else
|
|
2957
|
-
|
|
2958
|
-
const
|
|
2959
|
-
if (
|
|
2960
|
-
for (const
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
}),
|
|
2957
|
+
_.appendChild(Wo());
|
|
2958
|
+
const Ce = u?.prompts ?? r.starterPrompts, $ = document.createElement("div");
|
|
2959
|
+
if ($.className = Ce.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Ce.length === 0 && !r.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), Ce.length > 0)
|
|
2960
|
+
for (const v of Ce) {
|
|
2961
|
+
const T = document.createElement("button");
|
|
2962
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${v}"`, T.addEventListener("click", () => {
|
|
2963
|
+
A(v);
|
|
2964
|
+
}), $.appendChild(T);
|
|
2965
2965
|
}
|
|
2966
2966
|
else if (r.starterPromptsLoading) {
|
|
2967
|
-
const
|
|
2968
|
-
|
|
2967
|
+
const v = document.createElement("button");
|
|
2968
|
+
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...", $.appendChild(v);
|
|
2969
2969
|
} else
|
|
2970
|
-
for (let
|
|
2971
|
-
const
|
|
2972
|
-
|
|
2970
|
+
for (let v = 0; v < ga; v += 1) {
|
|
2971
|
+
const T = document.createElement("button");
|
|
2972
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.textContent = "", $.appendChild(T);
|
|
2973
2973
|
}
|
|
2974
|
-
if (
|
|
2975
|
-
const
|
|
2976
|
-
|
|
2974
|
+
if (_.appendChild($), u) {
|
|
2975
|
+
const v = document.createElement("button");
|
|
2976
|
+
v.type = "button", v.className = "pluno-pa-widget__morning-report-snooze", v.textContent = "Snooze morning report", v.addEventListener("click", S), _.appendChild(v);
|
|
2977
2977
|
}
|
|
2978
|
-
h.clear(), U(
|
|
2978
|
+
h.clear(), U(_), U(t), wo(e, Ue);
|
|
2979
2979
|
return;
|
|
2980
2980
|
}
|
|
2981
|
-
let B = null,
|
|
2982
|
-
const
|
|
2983
|
-
if (
|
|
2981
|
+
let B = null, j = null, oe = [], Te = [];
|
|
2982
|
+
const Y = G.length - 1, ct = Y >= 0 && xn(G[Y]), he = () => {
|
|
2983
|
+
if (oe.length === 0)
|
|
2984
2984
|
return !1;
|
|
2985
|
-
const
|
|
2986
|
-
|
|
2985
|
+
const _ = $r(
|
|
2986
|
+
oe,
|
|
2987
2987
|
c,
|
|
2988
2988
|
C,
|
|
2989
|
-
|
|
2989
|
+
P()
|
|
2990
2990
|
);
|
|
2991
|
-
return U(
|
|
2991
|
+
return U(_), B = null, j = _, oe = [], !0;
|
|
2992
|
+
}, me = () => {
|
|
2993
|
+
for (const _ of Te)
|
|
2994
|
+
U(_), B = null, j = _;
|
|
2995
|
+
Te = [];
|
|
2992
2996
|
};
|
|
2993
|
-
for (let
|
|
2994
|
-
const
|
|
2995
|
-
if (
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
z.states.get(P.integrationAuthRequest.authRequestId) ?? {
|
|
2997
|
+
for (let _ = 0; _ < G.length; _ += 1) {
|
|
2998
|
+
const L = G[_];
|
|
2999
|
+
if (L.role === "tool" && L.integrationAuthRequest && z) {
|
|
3000
|
+
const v = Nr(
|
|
3001
|
+
L.integrationAuthRequest,
|
|
3002
|
+
z.states.get(L.integrationAuthRequest.authRequestId) ?? {
|
|
3000
3003
|
status: z.initialStatus
|
|
3001
3004
|
},
|
|
3002
3005
|
z.onConnect
|
|
3003
3006
|
);
|
|
3004
|
-
|
|
3007
|
+
Te.push(v);
|
|
3005
3008
|
continue;
|
|
3006
3009
|
}
|
|
3007
|
-
if (
|
|
3008
|
-
|
|
3010
|
+
if (L.role === "tool") {
|
|
3011
|
+
oe.push(L);
|
|
3009
3012
|
continue;
|
|
3010
3013
|
}
|
|
3011
|
-
if (
|
|
3012
|
-
if (
|
|
3014
|
+
if (xn(L)) {
|
|
3015
|
+
if (_ !== Y)
|
|
3013
3016
|
continue;
|
|
3014
|
-
if (
|
|
3015
|
-
const
|
|
3016
|
-
U(
|
|
3017
|
+
if (he()) {
|
|
3018
|
+
const T = At();
|
|
3019
|
+
U(T), B = null, j = T;
|
|
3017
3020
|
} else {
|
|
3018
|
-
const
|
|
3019
|
-
U(
|
|
3021
|
+
const T = yo(P());
|
|
3022
|
+
U(T), B = null, j = T;
|
|
3020
3023
|
}
|
|
3021
3024
|
continue;
|
|
3022
3025
|
}
|
|
3023
|
-
if (
|
|
3024
|
-
if (
|
|
3025
|
-
|
|
3026
|
-
const
|
|
3027
|
-
if (
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3026
|
+
if (L.role === "system") {
|
|
3027
|
+
if (L.dataType === "run_error" || L.dataType === "run_status") {
|
|
3028
|
+
he();
|
|
3029
|
+
const v = document.createElement("div"), T = L.dataType === "run_error";
|
|
3030
|
+
if (v.className = T ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", v.textContent = xo(L.content), T && L.securitySettingsUrl) {
|
|
3031
|
+
const D = document.createElement("a");
|
|
3032
|
+
D.className = "pluno-pa-widget__error-retry", D.href = L.securitySettingsUrl, D.target = "_blank", D.rel = "noreferrer", D.textContent = "Security settings", v.appendChild(D);
|
|
3030
3033
|
}
|
|
3031
|
-
U(
|
|
3034
|
+
U(v), B = T ? v : null, j = T ? null : v, me();
|
|
3032
3035
|
}
|
|
3033
3036
|
continue;
|
|
3034
3037
|
}
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3038
|
+
L.role === "user" && me();
|
|
3039
|
+
const W = he(), Ce = xo(L.content);
|
|
3040
|
+
if (L.role === "assistant" && !W) {
|
|
3041
|
+
const v = Zo(P());
|
|
3042
|
+
U(v), B = null, j = v;
|
|
3039
3043
|
}
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3042
|
-
|
|
3044
|
+
const $ = Ir(
|
|
3045
|
+
L,
|
|
3046
|
+
Ce,
|
|
3043
3047
|
h,
|
|
3044
3048
|
ge,
|
|
3045
|
-
|
|
3049
|
+
R
|
|
3046
3050
|
);
|
|
3047
|
-
U(
|
|
3051
|
+
U($), B = $, j = null, L.role === "assistant" && me();
|
|
3048
3052
|
}
|
|
3049
|
-
const
|
|
3050
|
-
if (r.isThinking && !
|
|
3051
|
-
if (
|
|
3052
|
-
const
|
|
3053
|
-
U(
|
|
3053
|
+
const Be = he(), F = G[G.length - 1]?.id === "assistant-draft";
|
|
3054
|
+
if (r.isThinking && !F && !ct)
|
|
3055
|
+
if (Be) {
|
|
3056
|
+
const _ = At();
|
|
3057
|
+
U(_), B = null, j = _;
|
|
3054
3058
|
} else {
|
|
3055
|
-
const
|
|
3056
|
-
U(
|
|
3059
|
+
const _ = yo(P());
|
|
3060
|
+
U(_), B = null, j = _;
|
|
3057
3061
|
}
|
|
3058
3062
|
if (r.lastError) {
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
const
|
|
3062
|
-
if (
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3063
|
+
const _ = document.createElement("div");
|
|
3064
|
+
_.className = "pluno-pa-widget__error";
|
|
3065
|
+
const L = document.createElement("span");
|
|
3066
|
+
if (L.textContent = r.lastError, _.appendChild(L), r.lastErrorSecuritySettingsUrl) {
|
|
3067
|
+
const W = document.createElement("a");
|
|
3068
|
+
W.className = "pluno-pa-widget__error-retry", W.href = r.lastErrorSecuritySettingsUrl, W.target = "_blank", W.rel = "noreferrer", W.textContent = "Security settings", _.appendChild(W);
|
|
3065
3069
|
}
|
|
3066
3070
|
if (r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
|
|
3067
|
-
const
|
|
3068
|
-
|
|
3071
|
+
const W = document.createElement("button");
|
|
3072
|
+
W.type = "button", W.className = "pluno-pa-widget__error-retry", W.textContent = "Try again", W.addEventListener(
|
|
3069
3073
|
"click",
|
|
3070
3074
|
r.lastErrorCode === "connection_failed" ? m : O
|
|
3071
|
-
),
|
|
3075
|
+
), _.appendChild(W);
|
|
3072
3076
|
}
|
|
3073
|
-
U(
|
|
3077
|
+
U(_), B = _, j = null;
|
|
3074
3078
|
}
|
|
3075
|
-
const
|
|
3076
|
-
if (k &&
|
|
3077
|
-
const
|
|
3078
|
-
isDrafting: k.draftingCandidate?.id ===
|
|
3079
|
+
const fe = k ? k.draftingCandidate ?? (r.isThinking ? null : Ai(ne)) : null;
|
|
3080
|
+
if (k && fe && !k.dismissedCandidateIds.has(fe.id)) {
|
|
3081
|
+
const _ = Ur(fe, {
|
|
3082
|
+
isDrafting: k.draftingCandidate?.id === fe.id,
|
|
3079
3083
|
error: k.error,
|
|
3080
3084
|
characterIconOptions: k.characterIconOptions,
|
|
3081
3085
|
onDraft: k.onDraft,
|
|
3082
3086
|
onDismiss: k.onDismiss,
|
|
3083
3087
|
onDisable: k.onDisable
|
|
3084
3088
|
});
|
|
3085
|
-
U(
|
|
3089
|
+
U(_), k.onSeen(fe), B = null, j = _;
|
|
3086
3090
|
}
|
|
3087
|
-
B?.classList.add("pluno-pa-widget__message--bottom-reserve"),
|
|
3091
|
+
me(), B?.classList.add("pluno-pa-widget__message--bottom-reserve"), j?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), Dr(h, ge), wo(e, Ue), s ? pt(e, g) : e.scrollTop = Ze;
|
|
3088
3092
|
}
|
|
3089
3093
|
function Nr(e, t, n) {
|
|
3090
3094
|
const i = document.createElement("section");
|
|
@@ -3140,7 +3144,7 @@ function Dr(e, t) {
|
|
|
3140
3144
|
for (const n of e.keys())
|
|
3141
3145
|
t.has(n) || e.delete(n);
|
|
3142
3146
|
}
|
|
3143
|
-
function
|
|
3147
|
+
function wo(e, t) {
|
|
3144
3148
|
let n = e.firstChild;
|
|
3145
3149
|
for (const i of t) {
|
|
3146
3150
|
if (i === n) {
|
|
@@ -3174,7 +3178,7 @@ function zr(e) {
|
|
|
3174
3178
|
if (n === -1)
|
|
3175
3179
|
return [...e.messages, t];
|
|
3176
3180
|
const i = e.messages.findIndex(
|
|
3177
|
-
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
3181
|
+
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && bo(r, t) && xn(r)
|
|
3178
3182
|
);
|
|
3179
3183
|
if (i !== -1)
|
|
3180
3184
|
return [
|
|
@@ -3183,7 +3187,7 @@ function zr(e) {
|
|
|
3183
3187
|
...e.messages.slice(i + 1)
|
|
3184
3188
|
];
|
|
3185
3189
|
let o = n + 1;
|
|
3186
|
-
for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
3190
|
+
for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && bo(e.messages[o], t); )
|
|
3187
3191
|
o += 1;
|
|
3188
3192
|
return [
|
|
3189
3193
|
...e.messages.slice(0, o),
|
|
@@ -3191,17 +3195,17 @@ function zr(e) {
|
|
|
3191
3195
|
...e.messages.slice(o)
|
|
3192
3196
|
];
|
|
3193
3197
|
}
|
|
3194
|
-
function
|
|
3198
|
+
function xn(e) {
|
|
3195
3199
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
3196
3200
|
}
|
|
3197
|
-
function
|
|
3201
|
+
function bo(e, t) {
|
|
3198
3202
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
3199
3203
|
}
|
|
3200
|
-
function
|
|
3201
|
-
e.replaceChildren(),
|
|
3204
|
+
function _o(e, t, n, i, o, r, l, p) {
|
|
3205
|
+
e.replaceChildren(), Jo(t, !1), t.disabled = !0, n(!1);
|
|
3202
3206
|
const s = document.createElement("div");
|
|
3203
3207
|
s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
3204
|
-
const g =
|
|
3208
|
+
const g = Ae(
|
|
3205
3209
|
"pluno-pa-widget__character--empty",
|
|
3206
3210
|
i()
|
|
3207
3211
|
);
|
|
@@ -3239,7 +3243,7 @@ function Ur(e, t) {
|
|
|
3239
3243
|
n.className = "pluno-pa-widget__share-prompt";
|
|
3240
3244
|
const i = document.createElement("div");
|
|
3241
3245
|
i.className = "pluno-pa-widget__share-prompt-body", i.appendChild(
|
|
3242
|
-
|
|
3246
|
+
Ae(
|
|
3243
3247
|
"pluno-pa-widget__share-prompt-icon",
|
|
3244
3248
|
t.characterIconOptions
|
|
3245
3249
|
)
|
|
@@ -3261,7 +3265,7 @@ function Ur(e, t) {
|
|
|
3261
3265
|
const g = document.createElement("button");
|
|
3262
3266
|
if (g.type = "button", g.className = "pluno-pa-widget__share-prompt-draft", g.disabled = t.isDrafting, g.addEventListener("click", () => {
|
|
3263
3267
|
t.onDraft(e);
|
|
3264
|
-
}), t.isDrafting ? (g.appendChild(
|
|
3268
|
+
}), t.isDrafting ? (g.appendChild(yn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
|
|
3265
3269
|
p.appendChild(s);
|
|
3266
3270
|
else {
|
|
3267
3271
|
const c = document.createElement("button");
|
|
@@ -3313,10 +3317,10 @@ function Br(e, t) {
|
|
|
3313
3317
|
i.appendChild(s), i.appendChild(p);
|
|
3314
3318
|
const C = document.createElement("div");
|
|
3315
3319
|
C.className = "pluno-pa-widget__share-dialog-step";
|
|
3316
|
-
const
|
|
3317
|
-
|
|
3318
|
-
const
|
|
3319
|
-
|
|
3320
|
+
const P = document.createElement("strong");
|
|
3321
|
+
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", C.appendChild(P);
|
|
3322
|
+
const A = document.createElement("p");
|
|
3323
|
+
A.className = "pluno-pa-widget__share-dialog-hint", A.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(A);
|
|
3320
3324
|
const O = document.createElement("footer");
|
|
3321
3325
|
O.className = "pluno-pa-widget__share-dialog-platforms";
|
|
3322
3326
|
for (const u of Wr(e)) {
|
|
@@ -3361,42 +3365,42 @@ function Wr(e) {
|
|
|
3361
3365
|
}
|
|
3362
3366
|
function Hr(e) {
|
|
3363
3367
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3364
|
-
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" ? (
|
|
3368
|
+
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" ? (K(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), K(
|
|
3365
3369
|
t,
|
|
3366
3370
|
"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"
|
|
3367
|
-
),
|
|
3371
|
+
), K(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), K(
|
|
3368
3372
|
t,
|
|
3369
3373
|
"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"
|
|
3370
|
-
),
|
|
3374
|
+
), K(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (K(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), K(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), K(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (K(
|
|
3371
3375
|
t,
|
|
3372
3376
|
"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"
|
|
3373
|
-
),
|
|
3377
|
+
), K(
|
|
3374
3378
|
t,
|
|
3375
3379
|
"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",
|
|
3376
3380
|
"0.48"
|
|
3377
|
-
),
|
|
3381
|
+
), K(
|
|
3378
3382
|
t,
|
|
3379
3383
|
"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"
|
|
3380
|
-
),
|
|
3384
|
+
), K(
|
|
3381
3385
|
t,
|
|
3382
3386
|
"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"
|
|
3383
3387
|
), t);
|
|
3384
3388
|
}
|
|
3385
|
-
function
|
|
3389
|
+
function K(e, t, n) {
|
|
3386
3390
|
const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3387
3391
|
i.setAttribute("d", t), n && i.setAttribute("opacity", n), e.appendChild(i);
|
|
3388
3392
|
}
|
|
3389
3393
|
function Gr() {
|
|
3390
3394
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3391
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
3395
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), K(e, "M14 5h5v5"), K(e, "M19 5l-8 8"), K(
|
|
3392
3396
|
e,
|
|
3393
3397
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
3394
3398
|
), e;
|
|
3395
3399
|
}
|
|
3396
|
-
function
|
|
3397
|
-
return e.role === "tool" && e.toolName ===
|
|
3400
|
+
function Xo(e) {
|
|
3401
|
+
return e.role === "tool" && e.toolName === Ao;
|
|
3398
3402
|
}
|
|
3399
|
-
function
|
|
3403
|
+
function xo(e) {
|
|
3400
3404
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3401
3405
|
}
|
|
3402
3406
|
function $r(e, t, n, i) {
|
|
@@ -3404,7 +3408,7 @@ function $r(e, t, n, i) {
|
|
|
3404
3408
|
o.className = "pluno-pa-widget__tool-group", o.title = new Date(
|
|
3405
3409
|
e[e.length - 1].createdAt
|
|
3406
3410
|
).toLocaleString(), o.appendChild(
|
|
3407
|
-
|
|
3411
|
+
Ae(
|
|
3408
3412
|
"pluno-pa-widget__character--tool-group",
|
|
3409
3413
|
i
|
|
3410
3414
|
)
|
|
@@ -3414,35 +3418,35 @@ function $r(e, t, n, i) {
|
|
|
3414
3418
|
o.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
|
|
3415
3419
|
});
|
|
3416
3420
|
const p = document.createElement("summary");
|
|
3417
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(
|
|
3421
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(yn());
|
|
3418
3422
|
const g = document.createElement("span");
|
|
3419
3423
|
if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", p.appendChild(g), r.appendChild(p), e.length > 0) {
|
|
3420
3424
|
const c = document.createElement("div");
|
|
3421
3425
|
c.className = "pluno-pa-widget__tool-lines";
|
|
3422
3426
|
for (const h of e) {
|
|
3423
3427
|
const C = document.createElement("div");
|
|
3424
|
-
C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(
|
|
3425
|
-
const
|
|
3426
|
-
|
|
3428
|
+
C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(yn());
|
|
3429
|
+
const P = document.createElement("span");
|
|
3430
|
+
P.textContent = h.content || "Run tool", C.appendChild(P), c.appendChild(C);
|
|
3427
3431
|
}
|
|
3428
3432
|
r.appendChild(c);
|
|
3429
3433
|
}
|
|
3430
3434
|
return o.appendChild(r), o;
|
|
3431
3435
|
}
|
|
3432
|
-
function
|
|
3436
|
+
function Zo(e) {
|
|
3433
3437
|
const t = document.createElement("article");
|
|
3434
3438
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3435
|
-
|
|
3439
|
+
Ae(
|
|
3436
3440
|
"pluno-pa-widget__character--tool-group",
|
|
3437
3441
|
e
|
|
3438
3442
|
)
|
|
3439
3443
|
), t;
|
|
3440
3444
|
}
|
|
3441
|
-
function
|
|
3442
|
-
const t =
|
|
3443
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
3445
|
+
function yo(e) {
|
|
3446
|
+
const t = Zo(e);
|
|
3447
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(At()), t;
|
|
3444
3448
|
}
|
|
3445
|
-
function
|
|
3449
|
+
function At(e = "Thinking...") {
|
|
3446
3450
|
const t = document.createElement("div");
|
|
3447
3451
|
t.className = "pluno-pa-widget__status";
|
|
3448
3452
|
const n = document.createElement("span");
|
|
@@ -3453,12 +3457,12 @@ function Pt(e = "Thinking...") {
|
|
|
3453
3457
|
function qr(e) {
|
|
3454
3458
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3455
3459
|
}
|
|
3456
|
-
function
|
|
3460
|
+
function yn() {
|
|
3457
3461
|
const e = document.createElement("span");
|
|
3458
3462
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3459
3463
|
}
|
|
3460
|
-
function
|
|
3461
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? wr() :
|
|
3464
|
+
function Jo(e, t) {
|
|
3465
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? wr() : jo());
|
|
3462
3466
|
}
|
|
3463
3467
|
function jr(e, t) {
|
|
3464
3468
|
const n = Xi(t).replace(/\r\n/g, `
|
|
@@ -3555,7 +3559,7 @@ function Vr(e) {
|
|
|
3555
3559
|
return !1;
|
|
3556
3560
|
}
|
|
3557
3561
|
}
|
|
3558
|
-
function
|
|
3562
|
+
function vo(e, t) {
|
|
3559
3563
|
if (Kr(e))
|
|
3560
3564
|
return;
|
|
3561
3565
|
const n = `
|
|
@@ -5601,8 +5605,8 @@ function yo(e, t) {
|
|
|
5601
5605
|
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
|
|
5602
5606
|
position: absolute;
|
|
5603
5607
|
top: -16px;
|
|
5604
|
-
left: ${
|
|
5605
|
-
width: calc(100% - ${
|
|
5608
|
+
left: ${mn}px;
|
|
5609
|
+
width: calc(100% - ${mn * 2}px);
|
|
5606
5610
|
height: 36px;
|
|
5607
5611
|
z-index: 3;
|
|
5608
5612
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -5982,20 +5986,20 @@ function yo(e, t) {
|
|
|
5982
5986
|
if (Yr(e, n))
|
|
5983
5987
|
return;
|
|
5984
5988
|
const i = e.ownerDocument.createElement("style");
|
|
5985
|
-
i.id =
|
|
5989
|
+
i.id = Uo, i.textContent = n, e.appendChild(i), Qo(e);
|
|
5986
5990
|
}
|
|
5987
5991
|
function Kr(e) {
|
|
5988
|
-
return e.getElementById(
|
|
5992
|
+
return e.getElementById(Uo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Bo) === "true";
|
|
5989
5993
|
}
|
|
5990
|
-
function
|
|
5991
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5994
|
+
function Qo(e) {
|
|
5995
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Bo, "true");
|
|
5992
5996
|
}
|
|
5993
5997
|
function Yr(e, t) {
|
|
5994
5998
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5995
5999
|
return !1;
|
|
5996
6000
|
try {
|
|
5997
6001
|
const n = new CSSStyleSheet();
|
|
5998
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
6002
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Qo(e), !0;
|
|
5999
6003
|
} catch {
|
|
6000
6004
|
return !1;
|
|
6001
6005
|
}
|
|
@@ -6008,25 +6012,25 @@ async function Xr() {
|
|
|
6008
6012
|
t.observe(document.documentElement, { childList: !0 });
|
|
6009
6013
|
});
|
|
6010
6014
|
}
|
|
6011
|
-
function
|
|
6015
|
+
function kn(e) {
|
|
6012
6016
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
6013
6017
|
}
|
|
6014
|
-
function
|
|
6015
|
-
return `${
|
|
6018
|
+
function ei(e) {
|
|
6019
|
+
return `${kn(e)}.displayState`;
|
|
6016
6020
|
}
|
|
6017
6021
|
function Zr(e) {
|
|
6018
6022
|
try {
|
|
6019
6023
|
return window.sessionStorage.getItem(
|
|
6020
|
-
|
|
6024
|
+
ei(e)
|
|
6021
6025
|
) === "minimized" ? "minimized" : "shown";
|
|
6022
6026
|
} catch {
|
|
6023
6027
|
return "shown";
|
|
6024
6028
|
}
|
|
6025
6029
|
}
|
|
6026
|
-
function
|
|
6030
|
+
function So(e, t) {
|
|
6027
6031
|
if (e.layout === "floating")
|
|
6028
6032
|
try {
|
|
6029
|
-
const n =
|
|
6033
|
+
const n = ei(e);
|
|
6030
6034
|
if (t === "minimized") {
|
|
6031
6035
|
window.sessionStorage.setItem(n, t);
|
|
6032
6036
|
return;
|
|
@@ -6041,9 +6045,9 @@ function Jr(e) {
|
|
|
6041
6045
|
return { clientId: e, release: () => {
|
|
6042
6046
|
} };
|
|
6043
6047
|
let t = 0;
|
|
6044
|
-
for (;
|
|
6048
|
+
for (; Qt.has(t); )
|
|
6045
6049
|
t += 1;
|
|
6046
|
-
|
|
6050
|
+
Qt.add(t);
|
|
6047
6051
|
const n = `${ca}${t}`;
|
|
6048
6052
|
let i = crypto.randomUUID();
|
|
6049
6053
|
try {
|
|
@@ -6054,15 +6058,15 @@ function Jr(e) {
|
|
|
6054
6058
|
return {
|
|
6055
6059
|
clientId: i,
|
|
6056
6060
|
release: () => {
|
|
6057
|
-
o || (o = !0,
|
|
6061
|
+
o || (o = !0, Qt.delete(t));
|
|
6058
6062
|
}
|
|
6059
6063
|
};
|
|
6060
6064
|
}
|
|
6061
6065
|
function Qr(e) {
|
|
6062
6066
|
try {
|
|
6063
|
-
const t = window.localStorage.getItem(
|
|
6067
|
+
const t = window.localStorage.getItem(kn(e));
|
|
6064
6068
|
if (!t)
|
|
6065
|
-
return
|
|
6069
|
+
return Co();
|
|
6066
6070
|
const n = JSON.parse(t);
|
|
6067
6071
|
return {
|
|
6068
6072
|
isOpen: n.isOpen === !0,
|
|
@@ -6073,19 +6077,19 @@ function Qr(e) {
|
|
|
6073
6077
|
(i) => typeof i == "string"
|
|
6074
6078
|
) : [],
|
|
6075
6079
|
launcherPosition: ol(n.launcherPosition) ? n.launcherPosition : null,
|
|
6076
|
-
panelSize: il(n.panelSize) ?
|
|
6077
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-
|
|
6080
|
+
panelSize: il(n.panelSize) ? Tt(n.panelSize) : null,
|
|
6081
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-To) : [],
|
|
6078
6082
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
6079
6083
|
};
|
|
6080
6084
|
} catch {
|
|
6081
|
-
return
|
|
6085
|
+
return Co();
|
|
6082
6086
|
}
|
|
6083
6087
|
}
|
|
6084
6088
|
async function el(e) {
|
|
6085
6089
|
if (e.loadSharePromptsDisabled)
|
|
6086
6090
|
return e.loadSharePromptsDisabled();
|
|
6087
6091
|
try {
|
|
6088
|
-
return window.localStorage.getItem(
|
|
6092
|
+
return window.localStorage.getItem(Io) === "true";
|
|
6089
6093
|
} catch {
|
|
6090
6094
|
return !1;
|
|
6091
6095
|
}
|
|
@@ -6099,12 +6103,12 @@ function tl(e, t) {
|
|
|
6099
6103
|
return;
|
|
6100
6104
|
}
|
|
6101
6105
|
try {
|
|
6102
|
-
t && window.localStorage.setItem(
|
|
6106
|
+
t && window.localStorage.setItem(Io, "true");
|
|
6103
6107
|
} catch {
|
|
6104
6108
|
return;
|
|
6105
6109
|
}
|
|
6106
6110
|
}
|
|
6107
|
-
function
|
|
6111
|
+
function Co() {
|
|
6108
6112
|
return {
|
|
6109
6113
|
isOpen: !1,
|
|
6110
6114
|
composerValue: "",
|
|
@@ -6120,7 +6124,7 @@ function So() {
|
|
|
6120
6124
|
function nl(e, t) {
|
|
6121
6125
|
try {
|
|
6122
6126
|
window.localStorage.setItem(
|
|
6123
|
-
|
|
6127
|
+
kn(e),
|
|
6124
6128
|
JSON.stringify(t)
|
|
6125
6129
|
);
|
|
6126
6130
|
} catch {
|
|
@@ -6139,7 +6143,7 @@ function il(e) {
|
|
|
6139
6143
|
const t = e;
|
|
6140
6144
|
return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
|
|
6141
6145
|
}
|
|
6142
|
-
async function
|
|
6146
|
+
async function ti(e, t) {
|
|
6143
6147
|
const n = await fetch(e, {
|
|
6144
6148
|
method: "POST",
|
|
6145
6149
|
credentials: "include",
|
|
@@ -6166,7 +6170,7 @@ function al(e) {
|
|
|
6166
6170
|
let r = !1;
|
|
6167
6171
|
const l = new Promise((p, s) => {
|
|
6168
6172
|
const g = window.setTimeout(() => {
|
|
6169
|
-
r = !0, o.abort(), s(new Error(
|
|
6173
|
+
r = !0, o.abort(), s(new Error(Zn));
|
|
6170
6174
|
}, pa);
|
|
6171
6175
|
o.signal.addEventListener(
|
|
6172
6176
|
"abort",
|
|
@@ -6176,12 +6180,12 @@ function al(e) {
|
|
|
6176
6180
|
});
|
|
6177
6181
|
try {
|
|
6178
6182
|
const p = await Promise.race([
|
|
6179
|
-
|
|
6183
|
+
ti(e, o.signal),
|
|
6180
6184
|
l
|
|
6181
6185
|
]);
|
|
6182
6186
|
return o.abort(), p;
|
|
6183
6187
|
} catch (p) {
|
|
6184
|
-
throw o.abort(), r ? new Error(
|
|
6188
|
+
throw o.abort(), r ? new Error(Zn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(da);
|
|
6185
6189
|
}
|
|
6186
6190
|
};
|
|
6187
6191
|
return {
|
|
@@ -6204,32 +6208,32 @@ function al(e) {
|
|
|
6204
6208
|
}
|
|
6205
6209
|
};
|
|
6206
6210
|
}
|
|
6207
|
-
const
|
|
6211
|
+
const Eo = /* @__PURE__ */ new WeakSet();
|
|
6208
6212
|
function rl(e) {
|
|
6209
6213
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
6210
6214
|
}
|
|
6211
|
-
function
|
|
6215
|
+
function ko(e) {
|
|
6212
6216
|
const t = e.pathname.split("/");
|
|
6213
6217
|
return t[t.length - 1] ?? "";
|
|
6214
6218
|
}
|
|
6215
6219
|
function ll(e, t) {
|
|
6216
6220
|
const n = new URL(e.src, document.baseURI);
|
|
6217
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
6221
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : ko(n) === ko(t);
|
|
6218
6222
|
}
|
|
6219
|
-
class
|
|
6223
|
+
class Se extends EventTarget {
|
|
6220
6224
|
constructor(t, n) {
|
|
6221
6225
|
super(), this.channelId = n, this.url = t, this.addPreviewListener(ia, () => {
|
|
6222
|
-
this.readyState =
|
|
6226
|
+
this.readyState = Se.OPEN, this.dispatchEvent(new Event("open"));
|
|
6223
6227
|
}), this.addPreviewListener(aa, (i) => {
|
|
6224
6228
|
const o = i;
|
|
6225
6229
|
this.dispatchEvent(
|
|
6226
6230
|
new MessageEvent("message", { data: o.detail?.data ?? "" })
|
|
6227
6231
|
);
|
|
6228
6232
|
}), this.addPreviewListener(ra, () => {
|
|
6229
|
-
this.readyState =
|
|
6233
|
+
this.readyState = Se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
6230
6234
|
}), this.addPreviewListener(la, (i) => {
|
|
6231
6235
|
const o = i;
|
|
6232
|
-
this.readyState =
|
|
6236
|
+
this.readyState = Se.CLOSED, this.dispatchEvent(
|
|
6233
6237
|
new CloseEvent("close", {
|
|
6234
6238
|
code: o.detail?.code ?? 1e3,
|
|
6235
6239
|
reason: o.detail?.reason ?? "",
|
|
@@ -6238,7 +6242,7 @@ class xe extends EventTarget {
|
|
|
6238
6242
|
), this.cleanup();
|
|
6239
6243
|
}), window.dispatchEvent(
|
|
6240
6244
|
new CustomEvent(
|
|
6241
|
-
|
|
6245
|
+
Ct(
|
|
6242
6246
|
ta,
|
|
6243
6247
|
this.channelId
|
|
6244
6248
|
),
|
|
@@ -6258,18 +6262,18 @@ class xe extends EventTarget {
|
|
|
6258
6262
|
extensions = "";
|
|
6259
6263
|
binaryType = "blob";
|
|
6260
6264
|
bufferedAmount = 0;
|
|
6261
|
-
readyState =
|
|
6265
|
+
readyState = Se.CONNECTING;
|
|
6262
6266
|
socketId = sl();
|
|
6263
6267
|
listeners = /* @__PURE__ */ new Map();
|
|
6264
6268
|
send(t) {
|
|
6265
|
-
if (this.readyState !==
|
|
6269
|
+
if (this.readyState !== Se.OPEN)
|
|
6266
6270
|
throw new DOMException(
|
|
6267
6271
|
"Pluno preview websocket is not open",
|
|
6268
6272
|
"InvalidStateError"
|
|
6269
6273
|
);
|
|
6270
6274
|
window.dispatchEvent(
|
|
6271
6275
|
new CustomEvent(
|
|
6272
|
-
|
|
6276
|
+
Ct(na, this.channelId),
|
|
6273
6277
|
{
|
|
6274
6278
|
detail: {
|
|
6275
6279
|
socketId: this.socketId,
|
|
@@ -6280,9 +6284,9 @@ class xe extends EventTarget {
|
|
|
6280
6284
|
);
|
|
6281
6285
|
}
|
|
6282
6286
|
close(t, n) {
|
|
6283
|
-
this.readyState !==
|
|
6287
|
+
this.readyState !== Se.CLOSED && (this.readyState = Se.CLOSING, window.dispatchEvent(
|
|
6284
6288
|
new CustomEvent(
|
|
6285
|
-
|
|
6289
|
+
Ct(oa, this.channelId),
|
|
6286
6290
|
{
|
|
6287
6291
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
6288
6292
|
}
|
|
@@ -6290,7 +6294,7 @@ class xe extends EventTarget {
|
|
|
6290
6294
|
), this.cleanup());
|
|
6291
6295
|
}
|
|
6292
6296
|
addPreviewListener(t, n) {
|
|
6293
|
-
const i =
|
|
6297
|
+
const i = Ct(
|
|
6294
6298
|
t,
|
|
6295
6299
|
this.channelId
|
|
6296
6300
|
), o = (r) => {
|
|
@@ -6306,14 +6310,14 @@ class xe extends EventTarget {
|
|
|
6306
6310
|
}
|
|
6307
6311
|
function sl() {
|
|
6308
6312
|
const e = window.sessionStorage.getItem(
|
|
6309
|
-
|
|
6313
|
+
Xn
|
|
6310
6314
|
);
|
|
6311
6315
|
if (e)
|
|
6312
6316
|
return e;
|
|
6313
6317
|
const t = crypto.randomUUID();
|
|
6314
|
-
return window.sessionStorage.setItem(
|
|
6318
|
+
return window.sessionStorage.setItem(Xn, t), t;
|
|
6315
6319
|
}
|
|
6316
|
-
function
|
|
6320
|
+
function Ct(e, t) {
|
|
6317
6321
|
return `${e}:${t}`;
|
|
6318
6322
|
}
|
|
6319
6323
|
function pl(e) {
|
|
@@ -6329,21 +6333,21 @@ function pl(e) {
|
|
|
6329
6333
|
}
|
|
6330
6334
|
function dl(e) {
|
|
6331
6335
|
for (const t of pl(e))
|
|
6332
|
-
|
|
6336
|
+
Eo.has(t) || t.dataset.plunoAutoMount === "false" || (Eo.add(t), ni(t).catch((n) => {
|
|
6333
6337
|
console.error("Failed to mount Pluno widget", n);
|
|
6334
6338
|
}));
|
|
6335
6339
|
}
|
|
6336
|
-
function
|
|
6337
|
-
const t = window, n = t[
|
|
6340
|
+
function ni(e) {
|
|
6341
|
+
const t = window, n = t[ve];
|
|
6338
6342
|
if (n) {
|
|
6339
6343
|
if (n.host === null)
|
|
6340
6344
|
return n.mountPromise.catch(() => {
|
|
6341
|
-
const s = t[
|
|
6342
|
-
return s ? s.mountPromise :
|
|
6345
|
+
const s = t[ve];
|
|
6346
|
+
return s ? s.mountPromise : ni(e);
|
|
6343
6347
|
});
|
|
6344
6348
|
if (cl(n.host))
|
|
6345
6349
|
return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
|
|
6346
|
-
n.destroy?.(), delete t[
|
|
6350
|
+
n.destroy?.(), delete t[ve];
|
|
6347
6351
|
}
|
|
6348
6352
|
const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? al(o) : null;
|
|
6349
6353
|
let l;
|
|
@@ -6360,26 +6364,26 @@ function ti(e) {
|
|
|
6360
6364
|
scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
|
|
6361
6365
|
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
6362
6366
|
}).then((s) => {
|
|
6363
|
-
if (t[
|
|
6367
|
+
if (t[ve] !== l) {
|
|
6364
6368
|
s.destroy();
|
|
6365
6369
|
return;
|
|
6366
6370
|
}
|
|
6367
6371
|
const g = s.host;
|
|
6368
|
-
g.setAttribute(
|
|
6369
|
-
t[
|
|
6372
|
+
g.setAttribute(No, "true"), l.host = g, l.destroy = () => {
|
|
6373
|
+
t[ve] === l && delete t[ve], l.host = null, l.destroy = null, s.destroy();
|
|
6370
6374
|
};
|
|
6371
6375
|
}).catch((s) => {
|
|
6372
|
-
throw t[
|
|
6376
|
+
throw t[ve] === l && delete t[ve], s;
|
|
6373
6377
|
});
|
|
6374
6378
|
return l = {
|
|
6375
6379
|
mountPromise: p,
|
|
6376
6380
|
host: null,
|
|
6377
6381
|
destroy: null,
|
|
6378
6382
|
retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
|
|
6379
|
-
}, t[
|
|
6383
|
+
}, t[ve] = l, p;
|
|
6380
6384
|
}
|
|
6381
6385
|
function cl(e) {
|
|
6382
|
-
return e.isConnected && e.getAttribute(
|
|
6386
|
+
return e.isConnected && e.getAttribute(No) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
6383
6387
|
}
|
|
6384
6388
|
dl(import.meta.url);
|
|
6385
6389
|
export {
|