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