@pluno/product-agent-web 0.1.38 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +478 -448
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as cn } from "./product-agent-sdk.js";
|
|
2
|
+
const un = "#7c3aed";
|
|
3
|
+
function gn(e) {
|
|
4
|
+
const t = fn(e);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
@@ -76,19 +76,19 @@ function un(e) {
|
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
78
|
const se = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
|
|
79
|
-
function
|
|
80
|
-
const t =
|
|
79
|
+
function Dt(e) {
|
|
80
|
+
const t = Rt(e);
|
|
81
81
|
if (st(fe(t), lt) >= pt)
|
|
82
82
|
return t;
|
|
83
83
|
let o = fe(t);
|
|
84
84
|
const a = fe(se);
|
|
85
85
|
for (let i = 0; i < 6; i += 1)
|
|
86
|
-
if (o =
|
|
87
|
-
return
|
|
88
|
-
return
|
|
86
|
+
if (o = bn(o, a, 0.22), st(o, lt) >= pt)
|
|
87
|
+
return ze(o);
|
|
88
|
+
return ze(o);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const t =
|
|
90
|
+
function hn(e) {
|
|
91
|
+
const t = Dt(e), n = "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";
|
|
92
92
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
93
93
|
<defs>
|
|
94
94
|
<clipPath id="scribbleBoltClip">
|
|
@@ -101,7 +101,7 @@ function gn(e) {
|
|
|
101
101
|
</defs>
|
|
102
102
|
<g filter="url(#scribbleBoltWobble)">
|
|
103
103
|
<g clip-path="url(#scribbleBoltClip)">
|
|
104
|
-
<path d="${
|
|
104
|
+
<path d="${mn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
105
105
|
</g>
|
|
106
106
|
<path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
|
|
107
107
|
<g transform="rotate(-2 528 463)">
|
|
@@ -117,7 +117,7 @@ function gn(e) {
|
|
|
117
117
|
</g>
|
|
118
118
|
</svg>`;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function mn() {
|
|
121
121
|
let n = "M 280 120", o = !1, a = 0;
|
|
122
122
|
for (let i = 150; i <= 1170; i += 62) {
|
|
123
123
|
const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
|
|
@@ -125,8 +125,8 @@ function hn() {
|
|
|
125
125
|
}
|
|
126
126
|
return n;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
const t =
|
|
128
|
+
function fn(e) {
|
|
129
|
+
const t = Rt(e), n = $e(fe(t));
|
|
130
130
|
return n > 0.86 ? {
|
|
131
131
|
top: "#ffffff",
|
|
132
132
|
middle: "#f6f6f6",
|
|
@@ -162,9 +162,9 @@ function mn(e) {
|
|
|
162
162
|
shadow: $(t, -0.25, -0.08)
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Rt(e) {
|
|
166
166
|
const t = e.trim();
|
|
167
|
-
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()}` :
|
|
167
|
+
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()}` : un;
|
|
168
168
|
}
|
|
169
169
|
function fe(e) {
|
|
170
170
|
return [
|
|
@@ -173,11 +173,11 @@ function fe(e) {
|
|
|
173
173
|
Number.parseInt(e.slice(5, 7), 16)
|
|
174
174
|
];
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function ze([e, t, n]) {
|
|
177
177
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
178
178
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function $e([e, t, n]) {
|
|
181
181
|
const o = (a) => {
|
|
182
182
|
const i = a / 255;
|
|
183
183
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
@@ -185,11 +185,11 @@ function ze([e, t, n]) {
|
|
|
185
185
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
186
186
|
}
|
|
187
187
|
function st(e, t) {
|
|
188
|
-
const n =
|
|
188
|
+
const n = $e(e), o = $e(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
189
189
|
return (a + 0.05) / (i + 0.05);
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
const o =
|
|
191
|
+
function bn(e, t, n) {
|
|
192
|
+
const o = We(n);
|
|
193
193
|
return [
|
|
194
194
|
e[0] + (t[0] - e[0]) * o,
|
|
195
195
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -197,38 +197,38 @@ function fn(e, t, n) {
|
|
|
197
197
|
];
|
|
198
198
|
}
|
|
199
199
|
function $(e, t, n) {
|
|
200
|
-
const [o, a, i] =
|
|
201
|
-
return
|
|
200
|
+
const [o, a, i] = wn(fe(e));
|
|
201
|
+
return ze(_n(o, We(a + n), We(i + t)));
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function wn([e, t, n]) {
|
|
204
204
|
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
|
|
205
205
|
if (l === s)
|
|
206
206
|
return [0, 0, u];
|
|
207
207
|
const d = l - s, p = u > 0.5 ? d / (2 - l - s) : d / (l + s);
|
|
208
208
|
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, p, u];
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function _n(e, t, n) {
|
|
211
211
|
if (t === 0)
|
|
212
212
|
return [n * 255, n * 255, n * 255];
|
|
213
213
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
214
214
|
return [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
Me(a, o, e + 1 / 3) * 255,
|
|
216
|
+
Me(a, o, e) * 255,
|
|
217
|
+
Me(a, o, e - 1 / 3) * 255
|
|
218
218
|
];
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Me(e, t, n) {
|
|
221
221
|
let o = n;
|
|
222
222
|
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;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function We(e) {
|
|
225
225
|
return Math.max(0, Math.min(1, e));
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
227
|
+
const Mt = "suggest_share_on_socials";
|
|
228
|
+
function xn(e) {
|
|
229
229
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
230
230
|
const n = e[t];
|
|
231
|
-
if (n.role !== "tool" || n.toolName !==
|
|
231
|
+
if (n.role !== "tool" || n.toolName !== Mt)
|
|
232
232
|
continue;
|
|
233
233
|
const o = dt(e, t, "assistant");
|
|
234
234
|
if (!o)
|
|
@@ -242,8 +242,8 @@ function _n(e) {
|
|
|
242
242
|
}
|
|
243
243
|
return null;
|
|
244
244
|
}
|
|
245
|
-
async function
|
|
246
|
-
const t = await
|
|
245
|
+
async function vn(e) {
|
|
246
|
+
const t = await yn(e);
|
|
247
247
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
248
248
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
249
249
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
@@ -256,18 +256,18 @@ function dt(e, t, n) {
|
|
|
256
256
|
}
|
|
257
257
|
return null;
|
|
258
258
|
}
|
|
259
|
-
async function
|
|
259
|
+
async function yn(e) {
|
|
260
260
|
return await (await fetch(e)).blob();
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
function
|
|
262
|
+
const Cn = "https://app.pluno.ai", En = "/api/product-agent/embed/active-users", Sn = 1800, kn = 15e3, Ln = 250, An = 1e3, Pn = 3e4;
|
|
263
|
+
function Tn(e, t = {}) {
|
|
264
264
|
let n = !1, o = null, a = null, i = null;
|
|
265
265
|
const l = () => {
|
|
266
266
|
i !== null && (window.clearInterval(i), i = null);
|
|
267
267
|
}, s = (p) => {
|
|
268
268
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
269
269
|
d();
|
|
270
|
-
},
|
|
270
|
+
}, Dn(p)));
|
|
271
271
|
}, u = (p) => {
|
|
272
272
|
if (l(), o === null) {
|
|
273
273
|
o = p, e(p);
|
|
@@ -279,27 +279,27 @@ function An(e, t = {}) {
|
|
|
279
279
|
l();
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
o = Math.round(w + (p - w) *
|
|
284
|
-
},
|
|
282
|
+
const A = Math.min(1, (performance.now() - x) / Sn);
|
|
283
|
+
o = Math.round(w + (p - w) * Rn(A)), e(o), A >= 1 && (o = p, e(p), l());
|
|
284
|
+
}, Ln);
|
|
285
285
|
}, d = async () => {
|
|
286
286
|
try {
|
|
287
|
-
const p = await
|
|
287
|
+
const p = await Nn(t);
|
|
288
288
|
if (n)
|
|
289
289
|
return;
|
|
290
290
|
u(p.count), s(p.refreshAfterMs);
|
|
291
291
|
} catch {
|
|
292
|
-
s(
|
|
292
|
+
s(kn);
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
295
|
return d(), () => {
|
|
296
296
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
async function
|
|
299
|
+
async function Nn(e) {
|
|
300
300
|
if (e.loader)
|
|
301
301
|
return e.loader();
|
|
302
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
302
|
+
const n = await (e.fetcher ?? fetch)(new URL(En, In(e.backendUrl ?? Cn)).toString(), {
|
|
303
303
|
cache: "no-store",
|
|
304
304
|
credentials: "omit"
|
|
305
305
|
});
|
|
@@ -313,16 +313,16 @@ async function Tn(e) {
|
|
|
313
313
|
function ct(e) {
|
|
314
314
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
315
315
|
}
|
|
316
|
-
function Nn(e) {
|
|
317
|
-
return e.endsWith("/") ? e : `${e}/`;
|
|
318
|
-
}
|
|
319
316
|
function In(e) {
|
|
320
|
-
return
|
|
317
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
321
318
|
}
|
|
322
319
|
function Dn(e) {
|
|
320
|
+
return Math.min(Pn, Math.max(An, e));
|
|
321
|
+
}
|
|
322
|
+
function Rn(e) {
|
|
323
323
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
324
324
|
}
|
|
325
|
-
const
|
|
325
|
+
const Ot = 100, Mn = "product-agent:sdk-preview-socket-connect", On = "product-agent:sdk-preview-socket-send", Bn = "product-agent:sdk-preview-socket-close", Fn = "product-agent:sdk-preview-socket-open", Un = "product-agent:sdk-preview-socket-message", zn = "product-agent:sdk-preview-socket-error", $n = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Wn = "product-agent:preview-diagnostic", Bt = "pluno.productAgent.sharePromptsDisabled", Ee = 10, Gn = 10 * 1024 * 1024, Ft = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Hn = Array.from(Ft).join(","), jn = 3, V = {
|
|
326
326
|
launcherLabel: "Ask for anything...",
|
|
327
327
|
accentColor: "#7c3aed",
|
|
328
328
|
colorScheme: "light",
|
|
@@ -330,7 +330,7 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
|
|
|
330
330
|
scribbleStyle: !1,
|
|
331
331
|
position: "bottom-right",
|
|
332
332
|
movableLauncher: !1
|
|
333
|
-
},
|
|
333
|
+
}, Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ut = 190, zt = 41, qn = 48, Yn = 420, Kn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, Ge = 50, eo = "http://www.w3.org/2000/svg", ht = [
|
|
334
334
|
{
|
|
335
335
|
ellipseCx: "17.5",
|
|
336
336
|
ellipseCy: "24.5",
|
|
@@ -367,11 +367,12 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
|
|
|
367
367
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
368
368
|
pathStrokeWidth: "2.45"
|
|
369
369
|
}
|
|
370
|
-
],
|
|
371
|
-
|
|
370
|
+
], to = 11, no = 13, mt = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", $t = "pluno-pa-widget-styles", Wt = "data-pluno-pa-widget-styles";
|
|
371
|
+
let ft = 0;
|
|
372
|
+
function ro(e) {
|
|
372
373
|
return (t) => new q(t, e);
|
|
373
374
|
}
|
|
374
|
-
async function
|
|
375
|
+
async function lo(e = {}) {
|
|
375
376
|
const t = {
|
|
376
377
|
launcherLabel: e.launcherLabel ?? V.launcherLabel,
|
|
377
378
|
accentColor: e.accentColor ?? V.accentColor,
|
|
@@ -416,10 +417,10 @@ async function ro(e = {}) {
|
|
|
416
417
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
417
418
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
418
419
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
419
|
-
let i =
|
|
420
|
-
|
|
421
|
-
const l = await
|
|
422
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor),
|
|
420
|
+
let i = bt(t.accentColor, t.scribbleStyle);
|
|
421
|
+
So(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
422
|
+
const l = await ba(), s = l.ownerDocument;
|
|
423
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), wt(a, i, {
|
|
423
424
|
accentColor: t.accentColor,
|
|
424
425
|
colorScheme: t.colorScheme,
|
|
425
426
|
fontFamily: t.fontFamily,
|
|
@@ -430,15 +431,15 @@ async function ro(e = {}) {
|
|
|
430
431
|
fontFamily: t.fontFamily,
|
|
431
432
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
432
433
|
});
|
|
433
|
-
const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"),
|
|
434
|
-
if (!u || !p || !w || !x || !
|
|
434
|
+
const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Q = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
435
|
+
if (!u || !p || !w || !x || !A || !C || !M || !v || !y || !h || !g || !_ || !N || !Q || !ce || !S || !f)
|
|
435
436
|
throw new Error("Failed to mount Pluno widget");
|
|
436
437
|
if (t.movableLauncher && !d)
|
|
437
438
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
438
|
-
|
|
439
|
+
vt(p), vt(g);
|
|
439
440
|
let m = [], T = null;
|
|
440
441
|
const L = () => {
|
|
441
|
-
|
|
442
|
+
zo(v, m, (r) => {
|
|
442
443
|
m = m.filter((c, k) => k !== r), L(), O(b.getState()), U();
|
|
443
444
|
});
|
|
444
445
|
}, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
@@ -456,9 +457,9 @@ async function ro(e = {}) {
|
|
|
456
457
|
if (!c.token)
|
|
457
458
|
throw new Error("Pluno token endpoint did not return a token");
|
|
458
459
|
return c.token;
|
|
459
|
-
}),
|
|
460
|
+
}), P = window.fetch.bind(window);
|
|
460
461
|
let b;
|
|
461
|
-
b = await
|
|
462
|
+
b = await cn.init({
|
|
462
463
|
token: t.token,
|
|
463
464
|
tokenProvider: I,
|
|
464
465
|
backendUrl: t.backendUrl,
|
|
@@ -473,41 +474,41 @@ async function ro(e = {}) {
|
|
|
473
474
|
webSocketFactory: t.webSocketFactory,
|
|
474
475
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
475
476
|
});
|
|
476
|
-
const
|
|
477
|
-
let ke =
|
|
477
|
+
const ee = wa(t), Se = new Set(ee.openToolGroupKeys), re = new Set(ee.seenShareCandidateIds), be = new Set(re);
|
|
478
|
+
let ke = ee.sharePromptsDisabled || await _a(t), G = t.movableLauncher ? ee.launcherPosition : null, Ke = G !== null, K = null, Le = !1, te = !1, ne = {
|
|
478
479
|
enabled: !0
|
|
479
|
-
},
|
|
480
|
+
}, oe = 0, Xe = "";
|
|
480
481
|
const H = (r, c) => {
|
|
481
|
-
|
|
482
|
+
ne = { enabled: r, reason: c };
|
|
482
483
|
}, j = () => {
|
|
483
|
-
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
},
|
|
487
|
-
H(!0, r), j(), me(S, () =>
|
|
488
|
-
},
|
|
484
|
+
Q.hidden = !0;
|
|
485
|
+
}, nn = () => {
|
|
486
|
+
Q.hidden = !1;
|
|
487
|
+
}, on = (r = "jump") => {
|
|
488
|
+
H(!0, r), j(), me(S, () => ne.enabled), oe = S.scrollTop;
|
|
489
|
+
}, an = () => {
|
|
489
490
|
Le || typeof document > "u" || (Pt(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
|
|
490
|
-
},
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
const c =
|
|
494
|
-
return
|
|
491
|
+
}, Ze = new MutationObserver(an);
|
|
492
|
+
Ze.observe(s.documentElement, { childList: !0, subtree: !0 });
|
|
493
|
+
const Ae = (r = !0) => {
|
|
494
|
+
const c = He(a, r);
|
|
495
|
+
return _t(
|
|
495
496
|
a,
|
|
496
|
-
G ?
|
|
497
|
+
G ? mo(G, c) : ho(a, t.position, c),
|
|
497
498
|
c
|
|
498
499
|
);
|
|
499
500
|
}, F = () => {
|
|
500
|
-
|
|
501
|
+
va(t, {
|
|
501
502
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
502
503
|
composerValue: g.value,
|
|
503
504
|
openToolGroupKeys: [...Se],
|
|
504
|
-
launcherPosition:
|
|
505
|
-
seenShareCandidateIds: [...re].slice(-
|
|
505
|
+
launcherPosition: Ke ? G : null,
|
|
506
|
+
seenShareCandidateIds: [...re].slice(-Ot),
|
|
506
507
|
sharePromptsDisabled: ke
|
|
507
508
|
});
|
|
508
|
-
},
|
|
509
|
-
|
|
510
|
-
debugVersion:
|
|
509
|
+
}, ae = (r, c = {}) => {
|
|
510
|
+
yo(r, {
|
|
511
|
+
debugVersion: io,
|
|
511
512
|
launcherPosition: G,
|
|
512
513
|
rootClasses: a.className,
|
|
513
514
|
rootStyle: {
|
|
@@ -516,9 +517,9 @@ async function ro(e = {}) {
|
|
|
516
517
|
right: a.style.right,
|
|
517
518
|
bottom: a.style.bottom
|
|
518
519
|
},
|
|
519
|
-
rootRect:
|
|
520
|
-
launcherRect:
|
|
521
|
-
panelRect:
|
|
520
|
+
rootRect: Oe(a),
|
|
521
|
+
launcherRect: Oe(u),
|
|
522
|
+
panelRect: Oe(w),
|
|
522
523
|
viewport: Y(),
|
|
523
524
|
panelHidden: w.hidden,
|
|
524
525
|
closeHidden: x.hidden,
|
|
@@ -526,126 +527,126 @@ async function ro(e = {}) {
|
|
|
526
527
|
});
|
|
527
528
|
}, we = (r = !0) => {
|
|
528
529
|
if (!G)
|
|
529
|
-
return xe(a, null),
|
|
530
|
-
const c =
|
|
531
|
-
return xe(a, c),
|
|
532
|
-
},
|
|
530
|
+
return xe(a, null), Ae(r);
|
|
531
|
+
const c = Ae(r);
|
|
532
|
+
return xe(a, c), ae("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
|
|
533
|
+
}, Je = (r, c) => {
|
|
533
534
|
if (!r || !c) {
|
|
534
|
-
|
|
535
|
+
vo(a);
|
|
535
536
|
return;
|
|
536
537
|
}
|
|
537
|
-
|
|
538
|
+
xo(a, {
|
|
538
539
|
x: r.x - c.x,
|
|
539
540
|
y: r.y - c.y
|
|
540
541
|
});
|
|
541
|
-
},
|
|
542
|
+
}, Qe = () => {
|
|
542
543
|
const r = we();
|
|
543
544
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
544
|
-
const c =
|
|
545
|
-
|
|
546
|
-
} else G &&
|
|
545
|
+
const c = xt(a, r, t.position);
|
|
546
|
+
Je(c, r), ae("Applied open panel position after viewport resize", { openPanelPosition: c });
|
|
547
|
+
} else G && ae("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
547
548
|
};
|
|
548
|
-
let
|
|
549
|
+
let et = () => {
|
|
549
550
|
};
|
|
550
|
-
window.addEventListener("resize",
|
|
551
|
+
window.addEventListener("resize", Qe), t.movableLauncher && d ? (we(), et = go({
|
|
551
552
|
root: a,
|
|
552
553
|
launcher: u,
|
|
553
554
|
launcherDragHandle: d,
|
|
554
|
-
getPosition: () =>
|
|
555
|
+
getPosition: () => Ae(),
|
|
555
556
|
setPosition: (r) => {
|
|
556
|
-
const c = r, k =
|
|
557
|
-
G =
|
|
557
|
+
const c = r, k = He(a), z = _t(a, r, k);
|
|
558
|
+
G = fo(z, k), xe(a, z), ae("Dragging closed launcher", { requestedPosition: c });
|
|
558
559
|
},
|
|
559
560
|
persist: () => {
|
|
560
|
-
|
|
561
|
+
Ke = !0, F(), ae("Persisted closed launcher drag position");
|
|
561
562
|
}
|
|
562
563
|
})) : xe(a, null);
|
|
563
|
-
let
|
|
564
|
-
const
|
|
565
|
-
if (!(!t.billingStatusLoader ||
|
|
566
|
-
|
|
564
|
+
let Pe = !1;
|
|
565
|
+
const tt = async () => {
|
|
566
|
+
if (!(!t.billingStatusLoader || Pe)) {
|
|
567
|
+
Pe = !0;
|
|
567
568
|
try {
|
|
568
569
|
const r = await t.billingStatusLoader();
|
|
569
|
-
|
|
570
|
+
Ct(t.billingStatus, r, b.getState().lastErrorCode) && (t.billingStatus = r, Ue(M, t.billingStatus, b.getState().lastErrorCode), U());
|
|
570
571
|
} finally {
|
|
571
|
-
|
|
572
|
+
Pe = !1;
|
|
572
573
|
}
|
|
573
574
|
}
|
|
574
|
-
},
|
|
575
|
-
|
|
576
|
-
const k = we(), z =
|
|
577
|
-
if (
|
|
578
|
-
a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () =>
|
|
575
|
+
}, ie = (r = "", c = !0) => {
|
|
576
|
+
tt(), K !== null && (window.clearTimeout(K), K = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
577
|
+
const k = we(), z = xt(a, k, t.position);
|
|
578
|
+
if (Je(z, k), ae("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: k }), H(!0, "open"), j(), !c) {
|
|
579
|
+
a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ne.enabled), oe = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
|
|
579
580
|
return;
|
|
580
581
|
}
|
|
581
582
|
window.requestAnimationFrame(() => {
|
|
582
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () =>
|
|
583
|
-
u.hidden = !0, me(S, () =>
|
|
583
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ne.enabled), oe = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), K = window.setTimeout(() => {
|
|
584
|
+
u.hidden = !0, me(S, () => ne.enabled), oe = S.scrollTop;
|
|
584
585
|
}, 220);
|
|
585
586
|
});
|
|
586
|
-
},
|
|
587
|
-
K !== null && (window.clearTimeout(K), K = null), u.hidden = !1, G && (we(!1),
|
|
587
|
+
}, rn = () => {
|
|
588
|
+
K !== null && (window.clearTimeout(K), K = null), u.hidden = !1, G && (we(!1), ae("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), K = window.setTimeout(() => {
|
|
588
589
|
w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
589
590
|
}, 220);
|
|
590
591
|
};
|
|
591
592
|
u.addEventListener("submit", (r) => {
|
|
592
|
-
r.preventDefault(),
|
|
593
|
+
r.preventDefault(), ie(p.value), p.value = "";
|
|
593
594
|
}), d?.addEventListener("click", (r) => {
|
|
594
595
|
r.preventDefault(), r.stopPropagation();
|
|
595
596
|
}), u.addEventListener("click", (r) => {
|
|
596
|
-
r.target === p && !d || (
|
|
597
|
+
r.target === p && !d || (ie(p.value), p.value = "");
|
|
597
598
|
}), p.addEventListener("focus", () => {
|
|
598
|
-
|
|
599
|
+
ie(p.value), p.value = "";
|
|
599
600
|
}), p.addEventListener("input", () => {
|
|
600
601
|
if (!p.value)
|
|
601
602
|
return;
|
|
602
603
|
const r = p.value;
|
|
603
|
-
|
|
604
|
-
}), x.addEventListener("click",
|
|
605
|
-
S.scrollTop <
|
|
606
|
-
}),
|
|
607
|
-
|
|
604
|
+
ie(r), p.value = "";
|
|
605
|
+
}), x.addEventListener("click", rn), S.addEventListener("scroll", () => {
|
|
606
|
+
S.scrollTop < oe - 1 && H(!1, "userScroll"), oe = S.scrollTop;
|
|
607
|
+
}), Q.addEventListener("click", () => {
|
|
608
|
+
on();
|
|
608
609
|
});
|
|
609
|
-
const
|
|
610
|
+
const nt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
610
611
|
([r]) => {
|
|
611
612
|
r?.isIntersecting && (H(!0, "bottom"), j());
|
|
612
613
|
},
|
|
613
614
|
{ root: S, threshold: 0 }
|
|
614
615
|
);
|
|
615
|
-
|
|
616
|
+
nt?.observe(f);
|
|
616
617
|
const U = () => {
|
|
617
618
|
_.disabled = W(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || W(t.billingStatus);
|
|
618
619
|
};
|
|
619
|
-
t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel,
|
|
620
|
+
t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, A.hidden = !0), A.addEventListener("submit", (r) => {
|
|
620
621
|
if (r.preventDefault(), t.loginRequired) {
|
|
621
622
|
t.onLoginClick?.();
|
|
622
623
|
return;
|
|
623
624
|
}
|
|
624
|
-
W(t.billingStatus) || (
|
|
625
|
+
W(t.billingStatus) || (te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U());
|
|
625
626
|
});
|
|
626
627
|
let ue = 0;
|
|
627
|
-
const
|
|
628
|
+
const ln = () => {
|
|
628
629
|
ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
629
|
-
},
|
|
630
|
+
}, ot = (r) => {
|
|
630
631
|
T !== null && window.clearTimeout(T), C.textContent = r, C.hidden = !1, T = window.setTimeout(() => {
|
|
631
632
|
C.textContent = "", C.hidden = !0, T = null;
|
|
632
633
|
}, 3e3);
|
|
633
|
-
},
|
|
634
|
+
}, pn = () => {
|
|
634
635
|
T !== null && (window.clearTimeout(T), T = null), C.textContent = "", C.hidden = !0;
|
|
635
|
-
},
|
|
636
|
+
}, at = async (r) => {
|
|
636
637
|
if (r.length === 0)
|
|
637
638
|
return;
|
|
638
|
-
const c = await
|
|
639
|
+
const c = await Ho(r);
|
|
639
640
|
if (m.length + c.length > Ee)
|
|
640
641
|
throw new Error(`Attach up to ${Ee} files per message.`);
|
|
641
|
-
m = [...m, ...c], L(),
|
|
642
|
+
m = [...m, ...c], L(), pn(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || ie();
|
|
642
643
|
};
|
|
643
644
|
h.addEventListener("click", () => {
|
|
644
645
|
t.loginRequired || W(t.billingStatus) || y.click();
|
|
645
646
|
}), y.addEventListener("change", () => {
|
|
646
647
|
const r = Array.from(y.files ?? []);
|
|
647
|
-
y.value = "",
|
|
648
|
-
|
|
648
|
+
y.value = "", at(r).catch((c) => {
|
|
649
|
+
ot(c instanceof Error ? c.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
|
|
649
650
|
message: c instanceof Error ? c.message : String(c)
|
|
650
651
|
});
|
|
651
652
|
});
|
|
@@ -658,8 +659,8 @@ async function ro(e = {}) {
|
|
|
658
659
|
ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
659
660
|
}), a.addEventListener("drop", (r) => {
|
|
660
661
|
const c = r.dataTransfer;
|
|
661
|
-
!ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(),
|
|
662
|
-
|
|
662
|
+
!ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ln(), at(c.files).catch((k) => {
|
|
663
|
+
ot(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
|
|
663
664
|
message: k instanceof Error ? k.message : String(k)
|
|
664
665
|
});
|
|
665
666
|
}));
|
|
@@ -672,9 +673,9 @@ async function ro(e = {}) {
|
|
|
672
673
|
b.stop();
|
|
673
674
|
return;
|
|
674
675
|
}
|
|
675
|
-
|
|
676
|
+
te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U(), O(b.getState());
|
|
676
677
|
}), N.addEventListener("click", () => {
|
|
677
|
-
|
|
678
|
+
te = !0, H(!0, "newSession"), j(), b.startNewSession(), Se.clear(), g.value = "", m = [], L(), he(g), F(), U(), g.focus(), O(b.getState());
|
|
678
679
|
}), g.addEventListener("input", () => {
|
|
679
680
|
he(g), F(), U(), O(b.getState());
|
|
680
681
|
}), g.addEventListener("keydown", (r) => {
|
|
@@ -683,90 +684,91 @@ async function ro(e = {}) {
|
|
|
683
684
|
t.onLoginClick?.();
|
|
684
685
|
return;
|
|
685
686
|
}
|
|
686
|
-
|
|
687
|
+
te = !0, H(!0, "send"), j(), m = Be(b, g, m), L(), U(), O(b.getState());
|
|
687
688
|
}
|
|
688
689
|
}), a.addEventListener("click", (r) => {
|
|
689
690
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
690
|
-
}),
|
|
691
|
-
const
|
|
692
|
-
let
|
|
691
|
+
}), ee.composerValue && (g.value = ee.composerValue, he(g)), ee.isOpen && ie(g.value, !1);
|
|
692
|
+
const Te = () => i;
|
|
693
|
+
let Ne = b.getState().appearance !== null, _e = null, ge = null, le = null, it = b.getState().isThinking, pe = null, Ie = null, rt = () => {
|
|
693
694
|
};
|
|
694
|
-
const
|
|
695
|
-
if (
|
|
696
|
-
|
|
695
|
+
const sn = !!t.socialPostDraftHandler, O = (r) => {
|
|
696
|
+
if (Ye(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Ue(M, t.billingStatus, pe), t.loginRequired) {
|
|
697
|
+
oa(S, _, N, Te, t.loginButtonLabel, t.onLoginClick);
|
|
697
698
|
return;
|
|
698
699
|
}
|
|
699
|
-
const c =
|
|
700
|
-
|
|
701
|
-
const z =
|
|
702
|
-
|
|
700
|
+
const c = Co(r), k = c !== Xe;
|
|
701
|
+
Xe = c;
|
|
702
|
+
const z = te || ne.enabled;
|
|
703
|
+
te = !1, na(
|
|
703
704
|
S,
|
|
704
705
|
f,
|
|
705
706
|
_,
|
|
706
707
|
N,
|
|
707
708
|
ce,
|
|
708
709
|
r,
|
|
709
|
-
|
|
710
|
-
|
|
710
|
+
Ie,
|
|
711
|
+
Ie !== null && St(r, g.value.trim().length > 0 || m.length > 0),
|
|
711
712
|
z,
|
|
712
|
-
() =>
|
|
713
|
+
() => ne.enabled,
|
|
713
714
|
Se,
|
|
714
715
|
F,
|
|
715
|
-
|
|
716
|
+
Te,
|
|
716
717
|
(R) => {
|
|
717
|
-
|
|
718
|
+
te = !0, H(!0, "send"), j(), b.sendMessage(R);
|
|
718
719
|
},
|
|
719
|
-
|
|
720
|
+
sn && !ke ? {
|
|
720
721
|
dismissedCandidateIds: be,
|
|
721
722
|
draftingCandidateId: _e,
|
|
722
723
|
error: ge,
|
|
724
|
+
characterIconSvg: Te(),
|
|
723
725
|
onSeen: (R) => {
|
|
724
726
|
re.add(R.id), F();
|
|
725
727
|
},
|
|
726
728
|
onDraft: (R) => {
|
|
727
|
-
|
|
729
|
+
dn(R);
|
|
728
730
|
},
|
|
729
731
|
onDismiss: (R) => {
|
|
730
732
|
re.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
|
|
731
733
|
},
|
|
732
734
|
onDisable: (R) => {
|
|
733
|
-
ke = !0, re.add(R.id), be.add(R.id), F(),
|
|
735
|
+
ke = !0, re.add(R.id), be.add(R.id), F(), xa(t, !0), ge = null, O(b.getState());
|
|
734
736
|
}
|
|
735
737
|
} : void 0
|
|
736
|
-
), z ? (
|
|
738
|
+
), z ? (oe = S.scrollTop, j()) : k && Eo(r) && nn();
|
|
737
739
|
};
|
|
738
|
-
return rt =
|
|
739
|
-
|
|
740
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
740
|
+
return rt = Tn((r) => {
|
|
741
|
+
Ie = r, !Le && St(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
|
|
742
|
+
}, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), b.on("state", (r) => {
|
|
741
743
|
const c = it && !r.isThinking;
|
|
742
|
-
it = r.isThinking, r.appearance ? (
|
|
744
|
+
it = r.isThinking, r.appearance ? (Ne = !0, X("web-sdk.widget", "Agent state supplied appearance", {
|
|
743
745
|
appearance: r.appearance
|
|
744
|
-
}),
|
|
746
|
+
}), De(r.appearance, "agent.state.appearance")) : Ne && (Ne = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
745
747
|
fallbackAccentColor: t.accentColor,
|
|
746
748
|
fallbackColorScheme: t.colorScheme,
|
|
747
749
|
fallbackFontFamily: t.fontFamily
|
|
748
|
-
}),
|
|
750
|
+
}), De({}, "agent.state.appearance-cleared")), O(r), U(), c && tt();
|
|
749
751
|
}), O(b.getState()), U(), {
|
|
750
752
|
agent: b,
|
|
751
753
|
updateAppearance: (r) => {
|
|
752
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
754
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), De(r, "widgetHandle.updateAppearance");
|
|
753
755
|
},
|
|
754
756
|
updateBillingStatus: (r) => {
|
|
755
757
|
const c = r ?? null;
|
|
756
|
-
|
|
758
|
+
Ct(t.billingStatus, c, pe) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Ue(
|
|
757
759
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
758
760
|
t.billingStatus,
|
|
759
761
|
pe
|
|
760
762
|
), U());
|
|
761
763
|
},
|
|
762
764
|
openPanel: () => {
|
|
763
|
-
|
|
765
|
+
ie(g.value, !1);
|
|
764
766
|
},
|
|
765
767
|
destroy: () => {
|
|
766
|
-
Le = !0,
|
|
768
|
+
Le = !0, Ze.disconnect(), nt?.disconnect(), window.removeEventListener("resize", Qe), et(), T !== null && window.clearTimeout(T), rt(), le?.remove(), b.destroy(), n.remove();
|
|
767
769
|
}
|
|
768
770
|
};
|
|
769
|
-
async function
|
|
771
|
+
async function dn(r) {
|
|
770
772
|
if (!_e) {
|
|
771
773
|
_e = r.id, ge = null, O(b.getState());
|
|
772
774
|
try {
|
|
@@ -775,7 +777,7 @@ async function ro(e = {}) {
|
|
|
775
777
|
const c = await t.socialPostDraftHandler(r);
|
|
776
778
|
if (!c.linkedinPost || !c.xPost)
|
|
777
779
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
778
|
-
re.add(r.id), be.add(r.id), F(), le?.remove(), le =
|
|
780
|
+
re.add(r.id), be.add(r.id), F(), le?.remove(), le = ra(c, {
|
|
779
781
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
780
782
|
onClose: () => {
|
|
781
783
|
le?.remove(), le = null;
|
|
@@ -788,32 +790,32 @@ async function ro(e = {}) {
|
|
|
788
790
|
}
|
|
789
791
|
}
|
|
790
792
|
}
|
|
791
|
-
function
|
|
792
|
-
const k = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily,
|
|
793
|
-
i =
|
|
793
|
+
function De(r, c) {
|
|
794
|
+
const k = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, Re = r.scribbleStyle ?? t.scribbleStyle;
|
|
795
|
+
i = bt(k, Re), wt(a, i, {
|
|
794
796
|
accentColor: k,
|
|
795
797
|
colorScheme: z,
|
|
796
798
|
fontFamily: R,
|
|
797
|
-
scribbleStyle:
|
|
799
|
+
scribbleStyle: Re
|
|
798
800
|
}), X("web-sdk.widget", "Updated widget appearance", {
|
|
799
801
|
source: c,
|
|
800
802
|
inputAppearance: r,
|
|
801
803
|
appliedAccentColor: k,
|
|
802
804
|
appliedColorScheme: z,
|
|
803
805
|
appliedFontFamily: R,
|
|
804
|
-
appliedScribbleStyle:
|
|
806
|
+
appliedScribbleStyle: Re,
|
|
805
807
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
806
808
|
});
|
|
807
809
|
}
|
|
808
810
|
}
|
|
809
|
-
function
|
|
810
|
-
return t ?
|
|
811
|
-
}
|
|
812
|
-
function lo(e) {
|
|
813
|
-
const t = po(e);
|
|
814
|
-
return t === null ? "#fafafa" : so(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
811
|
+
function bt(e, t) {
|
|
812
|
+
return t ? hn(e) : gn(e);
|
|
815
813
|
}
|
|
816
814
|
function po(e) {
|
|
815
|
+
const t = so(e);
|
|
816
|
+
return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
817
|
+
}
|
|
818
|
+
function so(e) {
|
|
817
819
|
const t = e.trim();
|
|
818
820
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
819
821
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -825,22 +827,22 @@ function po(e) {
|
|
|
825
827
|
Number.parseInt(t[3] + t[3], 16)
|
|
826
828
|
] : null;
|
|
827
829
|
}
|
|
828
|
-
function
|
|
830
|
+
function co([e, t, n]) {
|
|
829
831
|
const o = (a) => {
|
|
830
832
|
const i = a / 255;
|
|
831
833
|
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
832
834
|
};
|
|
833
835
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
834
836
|
}
|
|
835
|
-
function
|
|
837
|
+
function wt(e, t, n) {
|
|
836
838
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
837
|
-
const o = n.scribbleStyle ?
|
|
838
|
-
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast",
|
|
839
|
+
const o = n.scribbleStyle ? Dt(n.accentColor) : n.accentColor;
|
|
840
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", po(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Vn : n.fontFamily, n.scribbleStyle && uo(e.ownerDocument);
|
|
839
841
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
840
842
|
for (const i of a)
|
|
841
|
-
i.replaceWith(
|
|
843
|
+
i.replaceWith(Z(Array.from(i.classList).join(" "), t));
|
|
842
844
|
}
|
|
843
|
-
function
|
|
845
|
+
function uo(e) {
|
|
844
846
|
if (e.getElementById(gt))
|
|
845
847
|
return;
|
|
846
848
|
const t = e.createElement("style");
|
|
@@ -852,7 +854,7 @@ function co(e) {
|
|
|
852
854
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
853
855
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
854
856
|
}
|
|
855
|
-
function
|
|
857
|
+
function go({
|
|
856
858
|
root: e,
|
|
857
859
|
launcher: t,
|
|
858
860
|
launcherDragHandle: n,
|
|
@@ -865,7 +867,7 @@ function uo({
|
|
|
865
867
|
l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
866
868
|
}, x = (h) => {
|
|
867
869
|
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, u = o(), d = !1, t.setPointerCapture?.(h.pointerId));
|
|
868
|
-
},
|
|
870
|
+
}, A = (h) => {
|
|
869
871
|
if (l !== h.pointerId || !s || !u)
|
|
870
872
|
return;
|
|
871
873
|
h.preventDefault();
|
|
@@ -883,35 +885,35 @@ function uo({
|
|
|
883
885
|
}, y = (h) => {
|
|
884
886
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
885
887
|
return;
|
|
886
|
-
const g = h.shiftKey ?
|
|
888
|
+
const g = h.shiftKey ? ao : oo, _ = o();
|
|
887
889
|
let N = null;
|
|
888
890
|
h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
|
|
889
891
|
};
|
|
890
|
-
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove",
|
|
891
|
-
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove",
|
|
892
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
893
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
892
894
|
};
|
|
893
895
|
}
|
|
894
|
-
function
|
|
896
|
+
function He(e, t = !0) {
|
|
895
897
|
const n = Y(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
896
898
|
return {
|
|
897
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
898
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
899
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Ut, n.width - 36),
|
|
900
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : zt
|
|
899
901
|
};
|
|
900
902
|
}
|
|
901
|
-
function
|
|
903
|
+
function Gt() {
|
|
902
904
|
const e = Y();
|
|
903
905
|
return {
|
|
904
906
|
width: Math.min(
|
|
905
|
-
de(e.width *
|
|
907
|
+
de(e.width * Xn, Yn, Kn),
|
|
906
908
|
e.width - B * 2
|
|
907
909
|
),
|
|
908
910
|
height: Math.min(
|
|
909
|
-
de(e.height *
|
|
910
|
-
e.height -
|
|
911
|
+
de(e.height * Qn, Zn, Jn),
|
|
912
|
+
e.height - Ge - B
|
|
911
913
|
)
|
|
912
914
|
};
|
|
913
915
|
}
|
|
914
|
-
function
|
|
916
|
+
function ho(e, t, n) {
|
|
915
917
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
916
918
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
917
919
|
return { x: o, y: a };
|
|
@@ -924,50 +926,50 @@ function go(e, t, n) {
|
|
|
924
926
|
y: l.height - 24 - n.height
|
|
925
927
|
};
|
|
926
928
|
}
|
|
927
|
-
function
|
|
928
|
-
const o = Y(), a = B +
|
|
929
|
+
function _t(e, t, n) {
|
|
930
|
+
const o = Y(), a = B + wo(e);
|
|
929
931
|
return {
|
|
930
932
|
x: de(t.x, B, Math.max(B, o.width - n.width - B)),
|
|
931
933
|
y: de(t.y, a, Math.max(a, o.height - n.height - B))
|
|
932
934
|
};
|
|
933
935
|
}
|
|
934
|
-
function
|
|
936
|
+
function mo(e, t) {
|
|
935
937
|
const n = Y();
|
|
936
938
|
return {
|
|
937
939
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
938
940
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
939
941
|
};
|
|
940
942
|
}
|
|
941
|
-
function
|
|
942
|
-
const n =
|
|
943
|
+
function fo(e, t) {
|
|
944
|
+
const n = bo(e, t), o = Y();
|
|
943
945
|
return {
|
|
944
946
|
anchor: n,
|
|
945
947
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
946
948
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
947
949
|
};
|
|
948
950
|
}
|
|
949
|
-
function
|
|
951
|
+
function bo(e, t) {
|
|
950
952
|
const n = Y(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
951
953
|
return `${i}-${l}`;
|
|
952
954
|
}
|
|
953
|
-
function
|
|
954
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
955
|
+
function wo(e) {
|
|
956
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
|
|
955
957
|
}
|
|
956
|
-
function
|
|
957
|
-
const o =
|
|
958
|
+
function xt(e, t, n) {
|
|
959
|
+
const o = He(e), a = Gt(), i = {
|
|
958
960
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
959
961
|
y: t.y + o.height - a.height
|
|
960
962
|
};
|
|
961
|
-
return
|
|
963
|
+
return _o(i);
|
|
962
964
|
}
|
|
963
|
-
function
|
|
964
|
-
const t = Y(), n =
|
|
965
|
+
function _o(e) {
|
|
966
|
+
const t = Y(), n = Gt();
|
|
965
967
|
return {
|
|
966
968
|
x: de(e.x, B, Math.max(B, t.width - n.width - B)),
|
|
967
969
|
y: de(
|
|
968
970
|
e.y,
|
|
969
|
-
|
|
970
|
-
Math.max(
|
|
971
|
+
Ge,
|
|
972
|
+
Math.max(Ge, t.height - n.height - B)
|
|
971
973
|
)
|
|
972
974
|
};
|
|
973
975
|
}
|
|
@@ -978,19 +980,19 @@ function xe(e, t) {
|
|
|
978
980
|
}
|
|
979
981
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
980
982
|
}
|
|
981
|
-
function
|
|
983
|
+
function xo(e, t) {
|
|
982
984
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
983
985
|
}
|
|
984
|
-
function
|
|
986
|
+
function vo(e) {
|
|
985
987
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
986
988
|
}
|
|
987
989
|
function Y() {
|
|
988
990
|
return {
|
|
989
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
990
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
991
|
+
width: window.innerWidth || document.documentElement.clientWidth || Ut + B * 2,
|
|
992
|
+
height: window.innerHeight || document.documentElement.clientHeight || zt + B * 2
|
|
991
993
|
};
|
|
992
994
|
}
|
|
993
|
-
function
|
|
995
|
+
function Oe(e) {
|
|
994
996
|
const t = e.getBoundingClientRect();
|
|
995
997
|
return {
|
|
996
998
|
x: Math.round(t.x),
|
|
@@ -1011,12 +1013,12 @@ function X(e, t, n) {
|
|
|
1011
1013
|
message: t,
|
|
1012
1014
|
details: n
|
|
1013
1015
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1014
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
1016
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Wn, { detail: a }));
|
|
1015
1017
|
}
|
|
1016
|
-
function
|
|
1018
|
+
function yo(e, t) {
|
|
1017
1019
|
X("web-sdk.widget.position", e, t);
|
|
1018
1020
|
}
|
|
1019
|
-
function
|
|
1021
|
+
function Be(e, t, n) {
|
|
1020
1022
|
const o = t.value.trim();
|
|
1021
1023
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1022
1024
|
}
|
|
@@ -1030,7 +1032,7 @@ function me(e, t = () => !0) {
|
|
|
1030
1032
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1031
1033
|
});
|
|
1032
1034
|
}
|
|
1033
|
-
function
|
|
1035
|
+
function Co(e) {
|
|
1034
1036
|
const t = e.messages[e.messages.length - 1];
|
|
1035
1037
|
return [
|
|
1036
1038
|
e.messages.length,
|
|
@@ -1041,25 +1043,25 @@ function yo(e) {
|
|
|
1041
1043
|
e.lastError ?? ""
|
|
1042
1044
|
].join(":");
|
|
1043
1045
|
}
|
|
1044
|
-
function
|
|
1046
|
+
function Eo(e) {
|
|
1045
1047
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1046
1048
|
}
|
|
1047
|
-
function
|
|
1048
|
-
e.appendChild(
|
|
1049
|
+
function So(e, t, n, o) {
|
|
1050
|
+
e.appendChild(Io()), e.appendChild(ko(t, n, o)), e.appendChild(jt("pluno-pa-widget__close", "Close", Do(16), !0)), e.appendChild(Lo(n));
|
|
1049
1051
|
}
|
|
1050
|
-
function
|
|
1052
|
+
function ko(e, t, n) {
|
|
1051
1053
|
const o = document.createElement("form");
|
|
1052
1054
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
1053
1055
|
const i = document.createElement("button");
|
|
1054
1056
|
i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
|
|
1055
1057
|
}
|
|
1056
|
-
o.appendChild(
|
|
1058
|
+
o.appendChild(Vt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(Z("pluno-pa-widget__character--launcher", t));
|
|
1057
1059
|
const a = document.createElement("input");
|
|
1058
1060
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
1059
1061
|
}
|
|
1060
|
-
function
|
|
1062
|
+
function Lo(e) {
|
|
1061
1063
|
const t = document.createElement("section");
|
|
1062
|
-
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1064
|
+
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(Vt("pluno-pa-widget__scribble-spirals--panel", 16));
|
|
1063
1065
|
const n = document.createElement("div");
|
|
1064
1066
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1065
1067
|
const o = document.createElement("main");
|
|
@@ -1069,9 +1071,9 @@ function ko(e) {
|
|
|
1069
1071
|
const i = document.createElement("div");
|
|
1070
1072
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
1071
1073
|
const l = document.createElement("button");
|
|
1072
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(
|
|
1074
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(jt("pluno-pa-widget__new-chat", "New chat", Ro(), !0)), t.appendChild(n), t.appendChild(Ao()), t;
|
|
1073
1075
|
}
|
|
1074
|
-
function
|
|
1076
|
+
function Ao() {
|
|
1075
1077
|
const e = document.createElement("form");
|
|
1076
1078
|
e.className = "pluno-pa-widget__composer";
|
|
1077
1079
|
const t = document.createElement("div");
|
|
@@ -1083,13 +1085,13 @@ function Lo() {
|
|
|
1083
1085
|
const a = document.createElement("div");
|
|
1084
1086
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1085
1087
|
const i = document.createElement("input");
|
|
1086
|
-
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept =
|
|
1088
|
+
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Hn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1087
1089
|
const l = document.createElement("button");
|
|
1088
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1090
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Mo()), l.appendChild(Oo()), a.appendChild(l);
|
|
1089
1091
|
const s = document.createElement("textarea");
|
|
1090
1092
|
s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
|
|
1091
1093
|
const u = document.createElement("button");
|
|
1092
|
-
u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(
|
|
1094
|
+
u.type = "button", u.className = "pluno-pa-widget__send", u.setAttribute("aria-label", "Send"), u.appendChild(qt()), a.appendChild(u), e.appendChild(a);
|
|
1093
1095
|
const d = document.createElement("div");
|
|
1094
1096
|
d.className = "pluno-pa-widget__composer-meta";
|
|
1095
1097
|
const p = document.createElement("a");
|
|
@@ -1099,29 +1101,48 @@ function Lo() {
|
|
|
1099
1101
|
}
|
|
1100
1102
|
function Po(e) {
|
|
1101
1103
|
const t = document.createElement("div");
|
|
1102
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1104
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Z("pluno-pa-widget__character--empty", e)), t.appendChild(Ht()), t;
|
|
1103
1105
|
}
|
|
1104
|
-
function
|
|
1106
|
+
function Ht() {
|
|
1105
1107
|
const e = document.createElement("div");
|
|
1106
1108
|
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;
|
|
1107
1109
|
}
|
|
1108
|
-
function
|
|
1110
|
+
function To(e, t) {
|
|
1109
1111
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1110
1112
|
const n = document.createElement("span");
|
|
1111
1113
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
1112
1114
|
}
|
|
1113
|
-
function
|
|
1114
|
-
const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0)
|
|
1115
|
+
function Z(e, t) {
|
|
1116
|
+
const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0);
|
|
1117
|
+
No(o, `pluno-pa-character-${ft}`), ft += 1;
|
|
1118
|
+
const a = e.split(/\s+/).filter(Boolean);
|
|
1115
1119
|
return o.setAttribute(
|
|
1116
1120
|
"class",
|
|
1117
1121
|
a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1118
1122
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1119
1123
|
}
|
|
1120
|
-
function
|
|
1124
|
+
function No(e, t) {
|
|
1125
|
+
const n = /* @__PURE__ */ new Map();
|
|
1126
|
+
for (const a of Array.from(e.querySelectorAll("[id]"))) {
|
|
1127
|
+
const i = a.id, l = `${t}-${i}`;
|
|
1128
|
+
n.set(i, l), a.id = l;
|
|
1129
|
+
}
|
|
1130
|
+
if (n.size === 0)
|
|
1131
|
+
return;
|
|
1132
|
+
const o = [e, ...Array.from(e.querySelectorAll("*"))];
|
|
1133
|
+
for (const a of o)
|
|
1134
|
+
for (const i of Array.from(a.attributes)) {
|
|
1135
|
+
let l = i.value;
|
|
1136
|
+
for (const [s, u] of n)
|
|
1137
|
+
l = l.split(`url(#${s})`).join(`url(#${u})`), l === `#${s}` && (l = `#${u}`);
|
|
1138
|
+
l !== i.value && a.setAttribute(i.name, l);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
function jt(e, t, n, o) {
|
|
1121
1142
|
const a = document.createElement("button");
|
|
1122
1143
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1123
1144
|
}
|
|
1124
|
-
function
|
|
1145
|
+
function Io() {
|
|
1125
1146
|
const e = E("svg", {
|
|
1126
1147
|
class: "pluno-pa-widget__scribble-defs",
|
|
1127
1148
|
"aria-hidden": "true",
|
|
@@ -1129,9 +1150,9 @@ function To() {
|
|
|
1129
1150
|
width: "0",
|
|
1130
1151
|
height: "0"
|
|
1131
1152
|
}), t = E("defs");
|
|
1132
|
-
return t.appendChild(
|
|
1153
|
+
return t.appendChild(Fe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Fe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Fe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1133
1154
|
}
|
|
1134
|
-
function
|
|
1155
|
+
function Vt(e, t) {
|
|
1135
1156
|
const n = E("svg", {
|
|
1136
1157
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1137
1158
|
viewBox: `0 0 ${t * 26} 36`,
|
|
@@ -1164,7 +1185,7 @@ function jt(e, t) {
|
|
|
1164
1185
|
}
|
|
1165
1186
|
return n;
|
|
1166
1187
|
}
|
|
1167
|
-
function
|
|
1188
|
+
function Fe(e, t, n) {
|
|
1168
1189
|
const o = E("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1169
1190
|
return o.appendChild(
|
|
1170
1191
|
E("feTurbulence", {
|
|
@@ -1201,28 +1222,28 @@ function Be(e, t, n) {
|
|
|
1201
1222
|
})
|
|
1202
1223
|
), o;
|
|
1203
1224
|
}
|
|
1204
|
-
function
|
|
1205
|
-
const t =
|
|
1225
|
+
function Do(e) {
|
|
1226
|
+
const t = J("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1206
1227
|
return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1207
1228
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const e =
|
|
1229
|
+
function Ro() {
|
|
1230
|
+
const e = J("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1210
1231
|
return e.appendChild(E("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(E("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1211
1232
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const e =
|
|
1233
|
+
function qt() {
|
|
1234
|
+
const e = J("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1214
1235
|
return e.appendChild(E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1215
1236
|
}
|
|
1216
|
-
function
|
|
1217
|
-
const e =
|
|
1237
|
+
function Mo() {
|
|
1238
|
+
const e = J("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1218
1239
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1219
1240
|
E("path", {
|
|
1220
1241
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
1221
1242
|
})
|
|
1222
1243
|
), e;
|
|
1223
1244
|
}
|
|
1224
|
-
function
|
|
1225
|
-
const e =
|
|
1245
|
+
function Oo() {
|
|
1246
|
+
const e = J("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1226
1247
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1227
1248
|
E("path", {
|
|
1228
1249
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
@@ -1233,19 +1254,19 @@ function Ro() {
|
|
|
1233
1254
|
})
|
|
1234
1255
|
), e;
|
|
1235
1256
|
}
|
|
1236
|
-
function
|
|
1237
|
-
const e =
|
|
1257
|
+
function Bo() {
|
|
1258
|
+
const e = J("0 0 24 24", 18, 18, "currentColor");
|
|
1238
1259
|
return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1239
1260
|
}
|
|
1240
|
-
function
|
|
1241
|
-
const e =
|
|
1261
|
+
function Fo() {
|
|
1262
|
+
const e = J("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1242
1263
|
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
1243
1264
|
}
|
|
1244
|
-
function
|
|
1245
|
-
const e =
|
|
1265
|
+
function Uo() {
|
|
1266
|
+
const e = J("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1246
1267
|
return e.appendChild(E("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(E("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1247
1268
|
}
|
|
1248
|
-
function
|
|
1269
|
+
function J(e, t, n, o, a, i) {
|
|
1249
1270
|
const l = {
|
|
1250
1271
|
viewBox: e,
|
|
1251
1272
|
width: String(t),
|
|
@@ -1256,38 +1277,38 @@ function Z(e, t, n, o, a, i) {
|
|
|
1256
1277
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), E("svg", l);
|
|
1257
1278
|
}
|
|
1258
1279
|
function E(e, t = {}) {
|
|
1259
|
-
const n = document.createElementNS(
|
|
1280
|
+
const n = document.createElementNS(eo, e);
|
|
1260
1281
|
for (const [o, a] of Object.entries(t))
|
|
1261
1282
|
n.setAttribute(o, a);
|
|
1262
1283
|
return n;
|
|
1263
1284
|
}
|
|
1264
|
-
function
|
|
1285
|
+
function vt(e) {
|
|
1265
1286
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1266
1287
|
e.addEventListener(t, (n) => {
|
|
1267
1288
|
n.stopPropagation();
|
|
1268
1289
|
});
|
|
1269
1290
|
}
|
|
1270
|
-
function
|
|
1291
|
+
function zo(e, t, n) {
|
|
1271
1292
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1272
1293
|
for (const [o, a] of t.entries()) {
|
|
1273
1294
|
const i = document.createElement("div");
|
|
1274
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1295
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild($o(a));
|
|
1275
1296
|
const l = document.createElement("span");
|
|
1276
1297
|
l.textContent = a.name, i.appendChild(l);
|
|
1277
1298
|
const s = document.createElement("button");
|
|
1278
|
-
s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(
|
|
1299
|
+
s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Fo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
|
|
1279
1300
|
}
|
|
1280
1301
|
}
|
|
1281
|
-
function
|
|
1282
|
-
if (
|
|
1302
|
+
function $o(e) {
|
|
1303
|
+
if (Yt(e)) {
|
|
1283
1304
|
const n = document.createElement("img");
|
|
1284
1305
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1285
1306
|
}
|
|
1286
1307
|
const t = document.createElement("span");
|
|
1287
1308
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1288
1309
|
}
|
|
1289
|
-
function
|
|
1290
|
-
if (
|
|
1310
|
+
function Wo(e) {
|
|
1311
|
+
if (Yt(e)) {
|
|
1291
1312
|
const a = document.createElement("img");
|
|
1292
1313
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1293
1314
|
}
|
|
@@ -1298,13 +1319,13 @@ function zo(e) {
|
|
|
1298
1319
|
const o = document.createElement("strong");
|
|
1299
1320
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1300
1321
|
}
|
|
1301
|
-
function
|
|
1322
|
+
function Yt(e) {
|
|
1302
1323
|
return e.mimeType.startsWith("image/");
|
|
1303
1324
|
}
|
|
1304
|
-
function
|
|
1325
|
+
function Go(e) {
|
|
1305
1326
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1306
1327
|
}
|
|
1307
|
-
async function
|
|
1328
|
+
async function Ho(e) {
|
|
1308
1329
|
if (!e)
|
|
1309
1330
|
return [];
|
|
1310
1331
|
const t = Array.from(e);
|
|
@@ -1312,37 +1333,37 @@ async function Wo(e) {
|
|
|
1312
1333
|
throw new Error(`Attach up to ${Ee} files per message.`);
|
|
1313
1334
|
return Promise.all(
|
|
1314
1335
|
t.map(async (n) => {
|
|
1315
|
-
const o =
|
|
1336
|
+
const o = jo(n);
|
|
1316
1337
|
if (!o)
|
|
1317
1338
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1318
|
-
if (n.size >
|
|
1339
|
+
if (n.size > Gn)
|
|
1319
1340
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1320
1341
|
if (o === "image/gif") {
|
|
1321
|
-
const a = new Uint8Array(await
|
|
1322
|
-
if (
|
|
1342
|
+
const a = new Uint8Array(await ea(n));
|
|
1343
|
+
if (qo(a))
|
|
1323
1344
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1324
1345
|
}
|
|
1325
1346
|
return {
|
|
1326
|
-
name: n.name ||
|
|
1347
|
+
name: n.name || Go(o),
|
|
1327
1348
|
mimeType: o,
|
|
1328
1349
|
sizeBytes: n.size,
|
|
1329
|
-
dataUrl:
|
|
1350
|
+
dataUrl: Vo(await ta(n), o)
|
|
1330
1351
|
};
|
|
1331
1352
|
})
|
|
1332
1353
|
);
|
|
1333
1354
|
}
|
|
1334
|
-
function
|
|
1335
|
-
if (
|
|
1355
|
+
function jo(e) {
|
|
1356
|
+
if (Ft.has(e.type))
|
|
1336
1357
|
return e.type;
|
|
1337
1358
|
const t = e.name.toLowerCase();
|
|
1338
1359
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
1339
1360
|
}
|
|
1340
|
-
function
|
|
1361
|
+
function Vo(e, t) {
|
|
1341
1362
|
const n = `data:${t};base64,`;
|
|
1342
1363
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1343
1364
|
}
|
|
1344
|
-
function
|
|
1345
|
-
if (e.length < 14 || !
|
|
1365
|
+
function qo(e) {
|
|
1366
|
+
if (e.length < 14 || !Yo(e))
|
|
1346
1367
|
return !1;
|
|
1347
1368
|
const t = e[10];
|
|
1348
1369
|
let n = 13;
|
|
@@ -1353,7 +1374,7 @@ function jo(e) {
|
|
|
1353
1374
|
if (n += 1, a === 59)
|
|
1354
1375
|
return !1;
|
|
1355
1376
|
if (a === 33) {
|
|
1356
|
-
n += 1, n =
|
|
1377
|
+
n += 1, n = yt(e, n);
|
|
1357
1378
|
continue;
|
|
1358
1379
|
}
|
|
1359
1380
|
if (a !== 44)
|
|
@@ -1365,14 +1386,14 @@ function jo(e) {
|
|
|
1365
1386
|
const i = e[n + 8];
|
|
1366
1387
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1367
1388
|
return !1;
|
|
1368
|
-
n += 1, n =
|
|
1389
|
+
n += 1, n = yt(e, n);
|
|
1369
1390
|
}
|
|
1370
1391
|
return !1;
|
|
1371
1392
|
}
|
|
1372
|
-
function
|
|
1393
|
+
function Yo(e) {
|
|
1373
1394
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1374
1395
|
}
|
|
1375
|
-
function
|
|
1396
|
+
function yt(e, t) {
|
|
1376
1397
|
for (; t < e.length; ) {
|
|
1377
1398
|
const n = e[t];
|
|
1378
1399
|
if (t += 1, n === 0)
|
|
@@ -1384,60 +1405,60 @@ function vt(e, t) {
|
|
|
1384
1405
|
function ve(e) {
|
|
1385
1406
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1386
1407
|
}
|
|
1387
|
-
function
|
|
1388
|
-
if (!e || !
|
|
1408
|
+
function Ue(e, t, n = null) {
|
|
1409
|
+
if (!e || !je(t, n)) {
|
|
1389
1410
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1390
1411
|
return;
|
|
1391
1412
|
}
|
|
1392
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) ||
|
|
1413
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || Ye(n) ? e.appendChild(Ko(t, n)) : Kt(t) && e.appendChild(Xo(t));
|
|
1393
1414
|
}
|
|
1394
|
-
function
|
|
1415
|
+
function Ko(e, t) {
|
|
1395
1416
|
const n = document.createElement("div");
|
|
1396
1417
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1397
1418
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1398
1419
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1399
1420
|
const i = document.createElement("span");
|
|
1400
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(
|
|
1421
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Xt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1401
1422
|
}
|
|
1402
|
-
function
|
|
1423
|
+
function Xo(e) {
|
|
1403
1424
|
const t = document.createElement("div");
|
|
1404
1425
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1405
1426
|
const n = document.createElement("strong");
|
|
1406
1427
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1407
1428
|
const o = document.createElement("span");
|
|
1408
|
-
return o.textContent =
|
|
1429
|
+
return o.textContent = Jo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Xt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1409
1430
|
}
|
|
1410
|
-
function
|
|
1411
|
-
return e !== null && (W(e) ||
|
|
1431
|
+
function je(e, t) {
|
|
1432
|
+
return e !== null && (W(e) || Kt(e) || Ye(t));
|
|
1412
1433
|
}
|
|
1413
|
-
function
|
|
1414
|
-
return
|
|
1434
|
+
function Ct(e, t, n) {
|
|
1435
|
+
return je(t, n) || Zo(t) ? !0 : !je(e, n);
|
|
1415
1436
|
}
|
|
1416
|
-
function
|
|
1437
|
+
function Zo(e) {
|
|
1417
1438
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || W(e));
|
|
1418
1439
|
}
|
|
1419
1440
|
function W(e) {
|
|
1420
1441
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1421
1442
|
}
|
|
1422
|
-
function
|
|
1443
|
+
function Ye(e) {
|
|
1423
1444
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1424
1445
|
}
|
|
1425
|
-
function
|
|
1446
|
+
function Kt(e) {
|
|
1426
1447
|
return !W(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1427
1448
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return e.creditsRemaining === null ? null : `${
|
|
1449
|
+
function Jo(e) {
|
|
1450
|
+
return e.creditsRemaining === null ? null : `${Qo(e.creditsRemaining)} credits left`;
|
|
1430
1451
|
}
|
|
1431
|
-
function
|
|
1452
|
+
function Qo(e) {
|
|
1432
1453
|
return new Intl.NumberFormat("en-US", {
|
|
1433
1454
|
maximumFractionDigits: 0
|
|
1434
1455
|
}).format(Math.ceil(e));
|
|
1435
1456
|
}
|
|
1436
|
-
function
|
|
1457
|
+
function Xt(e, t, n) {
|
|
1437
1458
|
const o = document.createElement("div");
|
|
1438
|
-
return o.className = n, o.appendChild(
|
|
1459
|
+
return o.className = n, o.appendChild(Et(t, e.pricingUrl)), o.appendChild(Et("Earn credits", e.earnCreditsUrl)), o;
|
|
1439
1460
|
}
|
|
1440
|
-
function
|
|
1461
|
+
function Et(e, t) {
|
|
1441
1462
|
const n = document.createElement("button");
|
|
1442
1463
|
if (n.type = "button", e === "Earn credits") {
|
|
1443
1464
|
const o = document.createElement("span");
|
|
@@ -1448,7 +1469,7 @@ function Ct(e, t) {
|
|
|
1448
1469
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1449
1470
|
}), n;
|
|
1450
1471
|
}
|
|
1451
|
-
function
|
|
1472
|
+
function ea(e) {
|
|
1452
1473
|
return new Promise((t, n) => {
|
|
1453
1474
|
const o = new FileReader();
|
|
1454
1475
|
o.addEventListener("load", () => {
|
|
@@ -1462,7 +1483,7 @@ function Jo(e) {
|
|
|
1462
1483
|
}), o.readAsArrayBuffer(e);
|
|
1463
1484
|
});
|
|
1464
1485
|
}
|
|
1465
|
-
function
|
|
1486
|
+
function ta(e) {
|
|
1466
1487
|
return new Promise((t, n) => {
|
|
1467
1488
|
const o = new FileReader();
|
|
1468
1489
|
o.addEventListener("load", () => {
|
|
@@ -1476,41 +1497,41 @@ function Qo(e) {
|
|
|
1476
1497
|
}), o.readAsDataURL(e);
|
|
1477
1498
|
});
|
|
1478
1499
|
}
|
|
1479
|
-
function
|
|
1480
|
-
return e.messages.filter((o) => !
|
|
1500
|
+
function St(e, t) {
|
|
1501
|
+
return e.messages.filter((o) => !Zt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1481
1502
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const M = [...i.messages], v = M.filter((f) => !
|
|
1484
|
-
e.replaceChildren(),
|
|
1503
|
+
function na(e, t, n, o, a, i, l, s, u, d, p, w, x, A, C) {
|
|
1504
|
+
const M = [...i.messages], v = M.filter((f) => !Zt(f)), y = e.scrollTop;
|
|
1505
|
+
e.replaceChildren(), Qt(n, i.isThinking), a.hidden = !s, s && l !== null && To(a, l);
|
|
1485
1506
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1486
1507
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1487
1508
|
const f = document.createElement("div");
|
|
1488
1509
|
f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1489
1510
|
const m = document.createElement("div");
|
|
1490
1511
|
m.className = "pluno-pa-widget__empty-hero";
|
|
1491
|
-
const T =
|
|
1492
|
-
m.appendChild(T), f.appendChild(m), f.appendChild(
|
|
1512
|
+
const T = Z("pluno-pa-widget__character--empty", x());
|
|
1513
|
+
m.appendChild(T), f.appendChild(m), f.appendChild(Ht());
|
|
1493
1514
|
const L = document.createElement("div");
|
|
1494
1515
|
if (L.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && L.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1495
1516
|
for (const I of i.starterPrompts) {
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
}), L.appendChild(
|
|
1517
|
+
const P = document.createElement("button");
|
|
1518
|
+
P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
|
|
1519
|
+
A(I);
|
|
1520
|
+
}), L.appendChild(P);
|
|
1500
1521
|
}
|
|
1501
1522
|
else
|
|
1502
|
-
for (let I = 0; I <
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1523
|
+
for (let I = 0; I < jn; I += 1) {
|
|
1524
|
+
const P = document.createElement("button");
|
|
1525
|
+
P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = " ", L.appendChild(P);
|
|
1505
1526
|
}
|
|
1506
1527
|
f.appendChild(L), e.appendChild(f), e.appendChild(t);
|
|
1507
1528
|
return;
|
|
1508
1529
|
}
|
|
1509
1530
|
let g = null, _ = null, N = [];
|
|
1510
|
-
const
|
|
1531
|
+
const Q = () => {
|
|
1511
1532
|
if (N.length === 0)
|
|
1512
1533
|
return !1;
|
|
1513
|
-
const f =
|
|
1534
|
+
const f = ca(N, p, w, x());
|
|
1514
1535
|
return e.appendChild(f), g = null, _ = f, N = [], !0;
|
|
1515
1536
|
};
|
|
1516
1537
|
for (let f = 0; f < v.length; f += 1) {
|
|
@@ -1521,44 +1542,45 @@ function ea(e, t, n, o, a, i, l, s, u, d, p, w, x, P, C) {
|
|
|
1521
1542
|
}
|
|
1522
1543
|
if (m.role === "system")
|
|
1523
1544
|
continue;
|
|
1524
|
-
const T =
|
|
1545
|
+
const T = Q(), L = Lt(m.content);
|
|
1525
1546
|
if (m.role === "assistant" && !T) {
|
|
1526
|
-
const b =
|
|
1547
|
+
const b = Ve(x());
|
|
1527
1548
|
e.appendChild(b), g = null, _ = b;
|
|
1528
1549
|
}
|
|
1529
1550
|
const I = document.createElement("div");
|
|
1530
|
-
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ?
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1551
|
+
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? At(I, L) : I.textContent = L, m.role === "user" && m.attachments?.length && I.appendChild(aa(m.attachments));
|
|
1552
|
+
const P = document.createElement("div");
|
|
1553
|
+
P.className = "pluno-pa-widget__message-actions", P.appendChild(kt(L)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
|
|
1533
1554
|
}
|
|
1534
|
-
const ce =
|
|
1555
|
+
const ce = Q();
|
|
1535
1556
|
if (i.assistantDraft) {
|
|
1536
1557
|
if (!ce) {
|
|
1537
|
-
const L =
|
|
1558
|
+
const L = Ve(x());
|
|
1538
1559
|
e.appendChild(L), g = null, _ = L;
|
|
1539
1560
|
}
|
|
1540
|
-
const f =
|
|
1541
|
-
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1561
|
+
const f = Lt(i.assistantDraft), m = document.createElement("div");
|
|
1562
|
+
m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", At(m, f);
|
|
1542
1563
|
const T = document.createElement("div");
|
|
1543
|
-
T.className = "pluno-pa-widget__message-actions", T.appendChild(
|
|
1564
|
+
T.className = "pluno-pa-widget__message-actions", T.appendChild(kt(f)), m.appendChild(T), e.appendChild(m), g = m, _ = null;
|
|
1544
1565
|
}
|
|
1545
1566
|
if (i.isThinking && !i.assistantDraft)
|
|
1546
1567
|
if (ce) {
|
|
1547
|
-
const f =
|
|
1568
|
+
const f = Jt();
|
|
1548
1569
|
e.appendChild(f), g = null, _ = f;
|
|
1549
1570
|
} else {
|
|
1550
|
-
const f =
|
|
1571
|
+
const f = ua(x());
|
|
1551
1572
|
e.appendChild(f), g = null, _ = f;
|
|
1552
1573
|
}
|
|
1553
1574
|
if (i.lastError) {
|
|
1554
1575
|
const f = document.createElement("div");
|
|
1555
1576
|
f.className = "pluno-pa-widget__error", f.textContent = i.lastError, e.appendChild(f), g = f, _ = null;
|
|
1556
1577
|
}
|
|
1557
|
-
const S = C && !i.isThinking ?
|
|
1578
|
+
const S = C && !i.isThinking ? xn(M) : null;
|
|
1558
1579
|
if (C && S && !C.dismissedCandidateIds.has(S.id)) {
|
|
1559
|
-
const f =
|
|
1580
|
+
const f = ia(S, {
|
|
1560
1581
|
isDrafting: C.draftingCandidateId === S.id,
|
|
1561
1582
|
error: C.error,
|
|
1583
|
+
characterIconSvg: C.characterIconSvg,
|
|
1562
1584
|
onDraft: C.onDraft,
|
|
1563
1585
|
onDismiss: C.onDismiss,
|
|
1564
1586
|
onDisable: C.onDisable
|
|
@@ -1567,35 +1589,35 @@ function ea(e, t, n, o, a, i, l, s, u, d, p, w, x, P, C) {
|
|
|
1567
1589
|
}
|
|
1568
1590
|
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), u ? me(e, d) : e.scrollTop = y;
|
|
1569
1591
|
}
|
|
1570
|
-
function
|
|
1571
|
-
e.replaceChildren(),
|
|
1592
|
+
function oa(e, t, n, o, a, i) {
|
|
1593
|
+
e.replaceChildren(), Qt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1572
1594
|
const l = document.createElement("div");
|
|
1573
1595
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1574
|
-
const s =
|
|
1596
|
+
const s = Z("pluno-pa-widget__character--empty", o());
|
|
1575
1597
|
l.appendChild(s);
|
|
1576
1598
|
const u = document.createElement("div");
|
|
1577
1599
|
u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
|
|
1578
1600
|
const d = document.createElement("button");
|
|
1579
1601
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1580
1602
|
}
|
|
1581
|
-
function
|
|
1603
|
+
function aa(e) {
|
|
1582
1604
|
const t = document.createElement("div");
|
|
1583
1605
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1584
1606
|
for (const n of e)
|
|
1585
|
-
t.appendChild(
|
|
1607
|
+
t.appendChild(Wo(n));
|
|
1586
1608
|
return t;
|
|
1587
1609
|
}
|
|
1588
|
-
function
|
|
1610
|
+
function kt(e) {
|
|
1589
1611
|
const t = document.createElement("button");
|
|
1590
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1612
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Uo()), t.addEventListener("click", (n) => {
|
|
1591
1613
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1592
1614
|
}), t;
|
|
1593
1615
|
}
|
|
1594
|
-
function
|
|
1616
|
+
function ia(e, t) {
|
|
1595
1617
|
const n = document.createElement("article");
|
|
1596
1618
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1597
1619
|
const o = document.createElement("div");
|
|
1598
|
-
o.className = "pluno-pa-widget__share-prompt-body";
|
|
1620
|
+
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(Z("pluno-pa-widget__share-prompt-icon", t.characterIconSvg));
|
|
1599
1621
|
const a = document.createElement("div");
|
|
1600
1622
|
a.className = "pluno-pa-widget__share-prompt-copy";
|
|
1601
1623
|
const i = document.createElement("strong");
|
|
@@ -1613,7 +1635,7 @@ function oa(e, t) {
|
|
|
1613
1635
|
const d = document.createElement("button");
|
|
1614
1636
|
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1615
1637
|
t.onDraft(e);
|
|
1616
|
-
}), t.isDrafting ? (d.appendChild(
|
|
1638
|
+
}), t.isDrafting ? (d.appendChild(qe()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", u.appendChild(d), t.isDrafting)
|
|
1617
1639
|
s.appendChild(u);
|
|
1618
1640
|
else {
|
|
1619
1641
|
const p = document.createElement("button");
|
|
@@ -1627,7 +1649,7 @@ function oa(e, t) {
|
|
|
1627
1649
|
}
|
|
1628
1650
|
return o.appendChild(s), n.appendChild(o), n;
|
|
1629
1651
|
}
|
|
1630
|
-
function
|
|
1652
|
+
function ra(e, t) {
|
|
1631
1653
|
const n = document.createElement("div");
|
|
1632
1654
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1633
1655
|
v.target === n && t.onClose();
|
|
@@ -1646,9 +1668,9 @@ function aa(e, t) {
|
|
|
1646
1668
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1647
1669
|
const p = document.createElement("strong");
|
|
1648
1670
|
p.textContent = "1) Copy Screenshot", d.appendChild(p);
|
|
1649
|
-
const w =
|
|
1671
|
+
const w = la("Copy Screenshot", async () => {
|
|
1650
1672
|
try {
|
|
1651
|
-
return await
|
|
1673
|
+
return await vn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
|
|
1652
1674
|
} catch {
|
|
1653
1675
|
return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
|
|
1654
1676
|
}
|
|
@@ -1662,15 +1684,15 @@ function aa(e, t) {
|
|
|
1662
1684
|
o.appendChild(u), o.appendChild(s);
|
|
1663
1685
|
const x = document.createElement("div");
|
|
1664
1686
|
x.className = "pluno-pa-widget__share-dialog-step";
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1687
|
+
const A = document.createElement("strong");
|
|
1688
|
+
A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
|
|
1667
1689
|
const C = document.createElement("p");
|
|
1668
1690
|
C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
|
|
1669
1691
|
const M = document.createElement("footer");
|
|
1670
1692
|
M.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1671
|
-
for (const v of
|
|
1693
|
+
for (const v of pa(e)) {
|
|
1672
1694
|
const y = document.createElement("a");
|
|
1673
|
-
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(
|
|
1695
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(sa(v.id)), M.appendChild(y);
|
|
1674
1696
|
}
|
|
1675
1697
|
if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
|
|
1676
1698
|
const v = document.createElement("div");
|
|
@@ -1678,17 +1700,17 @@ function aa(e, t) {
|
|
|
1678
1700
|
const y = document.createElement("strong");
|
|
1679
1701
|
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1680
1702
|
const h = document.createElement("a");
|
|
1681
|
-
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(
|
|
1703
|
+
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(da()), v.appendChild(h), o.appendChild(v);
|
|
1682
1704
|
}
|
|
1683
1705
|
return n.appendChild(o), n;
|
|
1684
1706
|
}
|
|
1685
|
-
function
|
|
1707
|
+
function la(e, t) {
|
|
1686
1708
|
const n = document.createElement("button");
|
|
1687
1709
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1688
1710
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1689
1711
|
}), n;
|
|
1690
1712
|
}
|
|
1691
|
-
function
|
|
1713
|
+
function pa(e) {
|
|
1692
1714
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1693
1715
|
return [
|
|
1694
1716
|
{
|
|
@@ -1708,7 +1730,7 @@ function ra(e) {
|
|
|
1708
1730
|
}
|
|
1709
1731
|
];
|
|
1710
1732
|
}
|
|
1711
|
-
function
|
|
1733
|
+
function sa(e) {
|
|
1712
1734
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1713
1735
|
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" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "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"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "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"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "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"), D(t, "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", "0.48"), D(t, "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"), D(t, "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"), t);
|
|
1714
1736
|
}
|
|
@@ -1716,48 +1738,48 @@ function D(e, t, n) {
|
|
|
1716
1738
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1717
1739
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1718
1740
|
}
|
|
1719
|
-
function
|
|
1741
|
+
function da() {
|
|
1720
1742
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1721
1743
|
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1722
1744
|
}
|
|
1723
|
-
function
|
|
1724
|
-
return e.role === "tool" && e.toolName ===
|
|
1745
|
+
function Zt(e) {
|
|
1746
|
+
return e.role === "tool" && e.toolName === Mt;
|
|
1725
1747
|
}
|
|
1726
|
-
function
|
|
1748
|
+
function Lt(e) {
|
|
1727
1749
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1728
1750
|
}
|
|
1729
|
-
function
|
|
1751
|
+
function ca(e, t, n, o) {
|
|
1730
1752
|
const a = document.createElement("article");
|
|
1731
|
-
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(
|
|
1732
|
-
const i = document.createElement("details"), l =
|
|
1753
|
+
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(Z("pluno-pa-widget__character--tool-group", o));
|
|
1754
|
+
const i = document.createElement("details"), l = ga(e);
|
|
1733
1755
|
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
1734
1756
|
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
1735
1757
|
});
|
|
1736
1758
|
const s = document.createElement("summary");
|
|
1737
|
-
s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(
|
|
1759
|
+
s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(qe());
|
|
1738
1760
|
const d = document.createElement("span");
|
|
1739
1761
|
if (d.className = "pluno-pa-widget__tool-summary-title", d.textContent = e[e.length - 1].content || "Run tool", s.appendChild(d), i.appendChild(s), e.length > 0) {
|
|
1740
1762
|
const p = document.createElement("div");
|
|
1741
1763
|
p.className = "pluno-pa-widget__tool-lines";
|
|
1742
1764
|
for (const w of e) {
|
|
1743
1765
|
const x = document.createElement("div");
|
|
1744
|
-
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1766
|
+
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(qe());
|
|
1767
|
+
const A = document.createElement("span");
|
|
1768
|
+
A.textContent = w.content || "Run tool", x.appendChild(A), p.appendChild(x);
|
|
1747
1769
|
}
|
|
1748
1770
|
i.appendChild(p);
|
|
1749
1771
|
}
|
|
1750
1772
|
return a.appendChild(i), a;
|
|
1751
1773
|
}
|
|
1752
|
-
function
|
|
1774
|
+
function Ve(e) {
|
|
1753
1775
|
const t = document.createElement("article");
|
|
1754
|
-
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
1776
|
+
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(Z("pluno-pa-widget__character--tool-group", e)), t;
|
|
1755
1777
|
}
|
|
1756
|
-
function
|
|
1757
|
-
const t =
|
|
1758
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1778
|
+
function ua(e) {
|
|
1779
|
+
const t = Ve(e);
|
|
1780
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Jt()), t;
|
|
1759
1781
|
}
|
|
1760
|
-
function
|
|
1782
|
+
function Jt() {
|
|
1761
1783
|
const e = document.createElement("div");
|
|
1762
1784
|
e.className = "pluno-pa-widget__status";
|
|
1763
1785
|
const t = document.createElement("span");
|
|
@@ -1765,17 +1787,17 @@ function Zt() {
|
|
|
1765
1787
|
const n = document.createElement("span");
|
|
1766
1788
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1767
1789
|
}
|
|
1768
|
-
function
|
|
1790
|
+
function ga(e) {
|
|
1769
1791
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1770
1792
|
}
|
|
1771
|
-
function
|
|
1793
|
+
function qe() {
|
|
1772
1794
|
const e = document.createElement("span");
|
|
1773
1795
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1774
1796
|
}
|
|
1775
|
-
function
|
|
1776
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1797
|
+
function Qt(e, t) {
|
|
1798
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Bo() : qt());
|
|
1777
1799
|
}
|
|
1778
|
-
function
|
|
1800
|
+
function At(e, t) {
|
|
1779
1801
|
const n = t.replace(/\r\n/g, `
|
|
1780
1802
|
`).split(`
|
|
1781
1803
|
`);
|
|
@@ -1847,7 +1869,7 @@ function ye(e, t) {
|
|
|
1847
1869
|
s.textContent = l.slice(1, -1), e.appendChild(s);
|
|
1848
1870
|
} else {
|
|
1849
1871
|
const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1850
|
-
if (s &&
|
|
1872
|
+
if (s && ha(s[2])) {
|
|
1851
1873
|
const u = document.createElement("a");
|
|
1852
1874
|
u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
|
|
1853
1875
|
} else
|
|
@@ -1857,7 +1879,7 @@ function ye(e, t) {
|
|
|
1857
1879
|
}
|
|
1858
1880
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1859
1881
|
}
|
|
1860
|
-
function
|
|
1882
|
+
function ha(e) {
|
|
1861
1883
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1862
1884
|
return !0;
|
|
1863
1885
|
try {
|
|
@@ -1868,7 +1890,7 @@ function ua(e) {
|
|
|
1868
1890
|
}
|
|
1869
1891
|
}
|
|
1870
1892
|
function Pt(e, t) {
|
|
1871
|
-
if (
|
|
1893
|
+
if (ma(e))
|
|
1872
1894
|
return;
|
|
1873
1895
|
const n = `
|
|
1874
1896
|
:host {
|
|
@@ -2567,19 +2589,26 @@ function Pt(e, t) {
|
|
|
2567
2589
|
align-self: stretch;
|
|
2568
2590
|
display: block;
|
|
2569
2591
|
color: var(--pluno-pa-muted);
|
|
2570
|
-
font-size:
|
|
2592
|
+
font-size: 15px;
|
|
2571
2593
|
line-height: 1.35;
|
|
2572
2594
|
margin-top: -4px;
|
|
2573
2595
|
}
|
|
2574
2596
|
.pluno-pa-widget__share-prompt-body {
|
|
2575
2597
|
min-width: 0;
|
|
2576
2598
|
display: grid;
|
|
2599
|
+
grid-template-columns: 44px minmax(0, 1fr);
|
|
2577
2600
|
gap: 8px;
|
|
2578
2601
|
border: 1px solid var(--pluno-pa-divider);
|
|
2579
2602
|
border-radius: 8px;
|
|
2580
2603
|
background: color-mix(in srgb, var(--pluno-pa-surface) 78%, transparent);
|
|
2581
2604
|
padding: 8px;
|
|
2582
2605
|
}
|
|
2606
|
+
.pluno-pa-widget__share-prompt-icon {
|
|
2607
|
+
width: 44px;
|
|
2608
|
+
height: 44px;
|
|
2609
|
+
align-self: start;
|
|
2610
|
+
margin-top: 1px;
|
|
2611
|
+
}
|
|
2583
2612
|
.pluno-pa-widget__share-prompt-copy {
|
|
2584
2613
|
min-width: 0;
|
|
2585
2614
|
display: grid;
|
|
@@ -2587,19 +2616,20 @@ function Pt(e, t) {
|
|
|
2587
2616
|
}
|
|
2588
2617
|
.pluno-pa-widget__share-prompt-copy strong {
|
|
2589
2618
|
color: var(--pluno-pa-text);
|
|
2590
|
-
font-size:
|
|
2619
|
+
font-size: 15px;
|
|
2591
2620
|
line-height: 1.25;
|
|
2592
2621
|
font-weight: 650;
|
|
2593
2622
|
}
|
|
2594
2623
|
.pluno-pa-widget__share-prompt-copy span {
|
|
2595
2624
|
color: var(--pluno-pa-muted);
|
|
2596
|
-
font-size:
|
|
2625
|
+
font-size: 14px;
|
|
2597
2626
|
line-height: 1.35;
|
|
2598
2627
|
}
|
|
2599
2628
|
.pluno-pa-widget__share-prompt-copy .pluno-pa-widget__share-prompt-error {
|
|
2600
2629
|
color: #ef4444;
|
|
2601
2630
|
}
|
|
2602
2631
|
.pluno-pa-widget__share-prompt-actions {
|
|
2632
|
+
grid-column: 2;
|
|
2603
2633
|
display: flex;
|
|
2604
2634
|
align-items: center;
|
|
2605
2635
|
justify-content: space-between;
|
|
@@ -3679,28 +3709,28 @@ function Pt(e, t) {
|
|
|
3679
3709
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3680
3710
|
}
|
|
3681
3711
|
`;
|
|
3682
|
-
if (
|
|
3712
|
+
if (fa(e, n))
|
|
3683
3713
|
return;
|
|
3684
3714
|
const o = e.ownerDocument.createElement("style");
|
|
3685
|
-
o.id =
|
|
3715
|
+
o.id = $t, o.textContent = n, e.appendChild(o), en(e);
|
|
3686
3716
|
}
|
|
3687
|
-
function
|
|
3688
|
-
return e.getElementById(
|
|
3717
|
+
function ma(e) {
|
|
3718
|
+
return e.getElementById($t) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Wt) === "true";
|
|
3689
3719
|
}
|
|
3690
|
-
function
|
|
3691
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3720
|
+
function en(e) {
|
|
3721
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Wt, "true");
|
|
3692
3722
|
}
|
|
3693
|
-
function
|
|
3723
|
+
function fa(e, t) {
|
|
3694
3724
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3695
3725
|
return !1;
|
|
3696
3726
|
try {
|
|
3697
3727
|
const n = new CSSStyleSheet();
|
|
3698
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3728
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], en(e), !0;
|
|
3699
3729
|
} catch {
|
|
3700
3730
|
return !1;
|
|
3701
3731
|
}
|
|
3702
3732
|
}
|
|
3703
|
-
async function
|
|
3733
|
+
async function ba() {
|
|
3704
3734
|
return document.body ? document.body : await new Promise((e) => {
|
|
3705
3735
|
const t = new MutationObserver(() => {
|
|
3706
3736
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3708,49 +3738,49 @@ async function ma() {
|
|
|
3708
3738
|
t.observe(document.documentElement, { childList: !0 });
|
|
3709
3739
|
});
|
|
3710
3740
|
}
|
|
3711
|
-
function
|
|
3741
|
+
function tn(e) {
|
|
3712
3742
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3713
3743
|
}
|
|
3714
|
-
function
|
|
3744
|
+
function wa(e) {
|
|
3715
3745
|
try {
|
|
3716
|
-
const t = window.localStorage.getItem(
|
|
3746
|
+
const t = window.localStorage.getItem(tn(e));
|
|
3717
3747
|
if (!t)
|
|
3718
|
-
return
|
|
3748
|
+
return Tt();
|
|
3719
3749
|
const n = JSON.parse(t);
|
|
3720
3750
|
return {
|
|
3721
3751
|
isOpen: n.isOpen === !0,
|
|
3722
3752
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3723
3753
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3724
|
-
launcherPosition:
|
|
3725
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3754
|
+
launcherPosition: ya(n.launcherPosition) ? n.launcherPosition : null,
|
|
3755
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Ot) : [],
|
|
3726
3756
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3727
3757
|
};
|
|
3728
3758
|
} catch {
|
|
3729
|
-
return
|
|
3759
|
+
return Tt();
|
|
3730
3760
|
}
|
|
3731
3761
|
}
|
|
3732
|
-
async function
|
|
3762
|
+
async function _a(e) {
|
|
3733
3763
|
if (e.loadSharePromptsDisabled)
|
|
3734
3764
|
return e.loadSharePromptsDisabled();
|
|
3735
3765
|
try {
|
|
3736
|
-
return window.localStorage.getItem(
|
|
3766
|
+
return window.localStorage.getItem(Bt) === "true";
|
|
3737
3767
|
} catch {
|
|
3738
3768
|
return !1;
|
|
3739
3769
|
}
|
|
3740
3770
|
}
|
|
3741
|
-
function
|
|
3771
|
+
function xa(e, t) {
|
|
3742
3772
|
if (e.persistSharePromptsDisabled) {
|
|
3743
3773
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3744
3774
|
});
|
|
3745
3775
|
return;
|
|
3746
3776
|
}
|
|
3747
3777
|
try {
|
|
3748
|
-
t && window.localStorage.setItem(
|
|
3778
|
+
t && window.localStorage.setItem(Bt, "true");
|
|
3749
3779
|
} catch {
|
|
3750
3780
|
return;
|
|
3751
3781
|
}
|
|
3752
3782
|
}
|
|
3753
|
-
function
|
|
3783
|
+
function Tt() {
|
|
3754
3784
|
return {
|
|
3755
3785
|
isOpen: !1,
|
|
3756
3786
|
composerValue: "",
|
|
@@ -3760,41 +3790,41 @@ function At() {
|
|
|
3760
3790
|
sharePromptsDisabled: !1
|
|
3761
3791
|
};
|
|
3762
3792
|
}
|
|
3763
|
-
function
|
|
3793
|
+
function va(e, t) {
|
|
3764
3794
|
try {
|
|
3765
|
-
window.localStorage.setItem(
|
|
3795
|
+
window.localStorage.setItem(tn(e), JSON.stringify(t));
|
|
3766
3796
|
} catch {
|
|
3767
3797
|
return;
|
|
3768
3798
|
}
|
|
3769
3799
|
}
|
|
3770
|
-
function
|
|
3800
|
+
function ya(e) {
|
|
3771
3801
|
if (!e || typeof e != "object")
|
|
3772
3802
|
return !1;
|
|
3773
3803
|
const t = e;
|
|
3774
3804
|
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");
|
|
3775
3805
|
}
|
|
3776
|
-
const
|
|
3777
|
-
function
|
|
3806
|
+
const Nt = /* @__PURE__ */ new WeakSet();
|
|
3807
|
+
function Ca(e) {
|
|
3778
3808
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3779
3809
|
}
|
|
3780
|
-
function
|
|
3810
|
+
function It(e) {
|
|
3781
3811
|
const t = e.pathname.split("/");
|
|
3782
3812
|
return t[t.length - 1] ?? "";
|
|
3783
3813
|
}
|
|
3784
|
-
function
|
|
3814
|
+
function Ea(e, t) {
|
|
3785
3815
|
const n = new URL(e.src, document.baseURI);
|
|
3786
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3816
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : It(n) === It(t);
|
|
3787
3817
|
}
|
|
3788
3818
|
class q extends EventTarget {
|
|
3789
3819
|
constructor(t, n) {
|
|
3790
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3820
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
|
|
3791
3821
|
this.readyState = q.OPEN, this.dispatchEvent(new Event("open"));
|
|
3792
|
-
}), this.addPreviewListener(
|
|
3822
|
+
}), this.addPreviewListener(Un, (o) => {
|
|
3793
3823
|
const a = o;
|
|
3794
3824
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3795
|
-
}), this.addPreviewListener(
|
|
3825
|
+
}), this.addPreviewListener(zn, () => {
|
|
3796
3826
|
this.readyState = q.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3797
|
-
}), this.addPreviewListener(
|
|
3827
|
+
}), this.addPreviewListener($n, (o) => {
|
|
3798
3828
|
const a = o;
|
|
3799
3829
|
this.readyState = q.CLOSED, this.dispatchEvent(
|
|
3800
3830
|
new CloseEvent("close", {
|
|
@@ -3804,7 +3834,7 @@ class q extends EventTarget {
|
|
|
3804
3834
|
})
|
|
3805
3835
|
), this.cleanup();
|
|
3806
3836
|
}), window.dispatchEvent(
|
|
3807
|
-
new CustomEvent(Ce(
|
|
3837
|
+
new CustomEvent(Ce(Mn, this.channelId), {
|
|
3808
3838
|
detail: { socketId: this.socketId, url: t }
|
|
3809
3839
|
})
|
|
3810
3840
|
);
|
|
@@ -3820,20 +3850,20 @@ class q extends EventTarget {
|
|
|
3820
3850
|
binaryType = "blob";
|
|
3821
3851
|
bufferedAmount = 0;
|
|
3822
3852
|
readyState = q.CONNECTING;
|
|
3823
|
-
socketId =
|
|
3853
|
+
socketId = Sa();
|
|
3824
3854
|
listeners = /* @__PURE__ */ new Map();
|
|
3825
3855
|
send(t) {
|
|
3826
3856
|
if (this.readyState !== q.OPEN)
|
|
3827
3857
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3828
3858
|
window.dispatchEvent(
|
|
3829
|
-
new CustomEvent(Ce(
|
|
3859
|
+
new CustomEvent(Ce(On, this.channelId), {
|
|
3830
3860
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3831
3861
|
})
|
|
3832
3862
|
);
|
|
3833
3863
|
}
|
|
3834
3864
|
close(t, n) {
|
|
3835
3865
|
this.readyState !== q.CLOSED && (this.readyState = q.CLOSING, window.dispatchEvent(
|
|
3836
|
-
new CustomEvent(Ce(
|
|
3866
|
+
new CustomEvent(Ce(Bn, this.channelId), {
|
|
3837
3867
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3838
3868
|
})
|
|
3839
3869
|
), this.cleanup());
|
|
@@ -3850,7 +3880,7 @@ class q extends EventTarget {
|
|
|
3850
3880
|
this.listeners.clear();
|
|
3851
3881
|
}
|
|
3852
3882
|
}
|
|
3853
|
-
function
|
|
3883
|
+
function Sa() {
|
|
3854
3884
|
const e = window.sessionStorage.getItem(ut);
|
|
3855
3885
|
if (e)
|
|
3856
3886
|
return e;
|
|
@@ -3860,26 +3890,26 @@ function Ca() {
|
|
|
3860
3890
|
function Ce(e, t) {
|
|
3861
3891
|
return `${e}:${t}`;
|
|
3862
3892
|
}
|
|
3863
|
-
function
|
|
3893
|
+
function ka(e) {
|
|
3864
3894
|
const t = document.currentScript;
|
|
3865
3895
|
if (t instanceof HTMLScriptElement)
|
|
3866
3896
|
return [t];
|
|
3867
3897
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3868
3898
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3869
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3899
|
+
(a) => a instanceof HTMLScriptElement && Ca(a) && Ea(a, o)
|
|
3870
3900
|
);
|
|
3871
3901
|
}
|
|
3872
|
-
function
|
|
3873
|
-
for (const t of
|
|
3874
|
-
if (
|
|
3902
|
+
function La(e) {
|
|
3903
|
+
for (const t of ka(e)) {
|
|
3904
|
+
if (Nt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3875
3905
|
continue;
|
|
3876
|
-
|
|
3906
|
+
Nt.add(t);
|
|
3877
3907
|
const n = t.dataset.plunoPreviewChannel;
|
|
3878
|
-
|
|
3908
|
+
lo({
|
|
3879
3909
|
token: t.dataset.plunoToken,
|
|
3880
3910
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3881
3911
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3882
|
-
webSocketFactory: n ?
|
|
3912
|
+
webSocketFactory: n ? ro(n) : void 0,
|
|
3883
3913
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3884
3914
|
accentColor: t.dataset.plunoAccentColor,
|
|
3885
3915
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3891,8 +3921,8 @@ function Sa(e) {
|
|
|
3891
3921
|
});
|
|
3892
3922
|
}
|
|
3893
3923
|
}
|
|
3894
|
-
|
|
3924
|
+
La(import.meta.url);
|
|
3895
3925
|
export {
|
|
3896
|
-
|
|
3897
|
-
|
|
3926
|
+
ro as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3927
|
+
lo as mountPlunoProductAgentWidget
|
|
3898
3928
|
};
|