@pluno/product-agent-web 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +16 -0
- package/dist/product-agent-sdk.js +207 -169
- package/dist/product-agent-widget.js +517 -486
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as zt } from "./product-agent-sdk.js";
|
|
2
|
+
const Gt = "#7c3aed";
|
|
3
|
+
function Ut(e) {
|
|
4
|
+
const t = qt(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">
|
|
@@ -75,23 +75,23 @@ function Ft(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function $t(e) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(Ut(e))}`;
|
|
80
80
|
}
|
|
81
|
-
const j = "#2c2a1e",
|
|
82
|
-
function
|
|
83
|
-
const t =
|
|
84
|
-
if (
|
|
81
|
+
const j = "#2c2a1e", $e = [253, 250, 241], We = 3.5;
|
|
82
|
+
function dt(e) {
|
|
83
|
+
const t = ct(e);
|
|
84
|
+
if (He(te(t), $e) >= We)
|
|
85
85
|
return t;
|
|
86
86
|
let o = te(t);
|
|
87
87
|
const a = te(j);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
89
|
+
if (o = jt(o, a, 0.22), He(o, $e) >= We)
|
|
90
90
|
return Ce(o);
|
|
91
91
|
return Ce(o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
93
|
+
function Wt(e) {
|
|
94
|
+
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";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,7 +104,7 @@ function Gt(e) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${Vt()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
109
|
<path d="${n}" fill="none" stroke="${j}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<g transform="rotate(-2 528 463)">
|
|
@@ -120,10 +120,10 @@ function Gt(e) {
|
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
123
|
+
function Ht(e) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Wt(e))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Vt() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
128
|
for (let i = 150; i <= 1170; i += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -131,8 +131,8 @@ function $t() {
|
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function qt(e) {
|
|
135
|
+
const t = ct(e), n = Ee(te(t));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -168,9 +168,9 @@ function Wt(e) {
|
|
|
168
168
|
shadow: I(t, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function ct(e) {
|
|
172
172
|
const t = e.trim();
|
|
173
|
-
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()}` :
|
|
173
|
+
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()}` : Gt;
|
|
174
174
|
}
|
|
175
175
|
function te(e) {
|
|
176
176
|
return [
|
|
@@ -190,11 +190,11 @@ function Ee([e, t, n]) {
|
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function He(e, t) {
|
|
194
194
|
const n = Ee(e), o = Ee(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function jt(e, t, n) {
|
|
198
198
|
const o = ke(n);
|
|
199
199
|
return [
|
|
200
200
|
e[0] + (t[0] - e[0]) * o,
|
|
@@ -203,17 +203,17 @@ function Ht(e, t, n) {
|
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
205
|
function I(e, t, n) {
|
|
206
|
-
const [o, a, i] =
|
|
207
|
-
return Ce(
|
|
206
|
+
const [o, a, i] = Yt(te(e));
|
|
207
|
+
return Ce(Kt(o, ke(a + n), ke(i + t)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Yt([e, t, n]) {
|
|
210
210
|
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), s = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, s];
|
|
213
|
-
const g = l - p,
|
|
214
|
-
return [(l === o ? (a - i) / g + (a < i ? 6 : 0) : l === a ? (i - o) / g + 2 : (o - a) / g + 4) / 6,
|
|
213
|
+
const g = l - p, u = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
214
|
+
return [(l === o ? (a - i) / g + (a < i ? 6 : 0) : l === a ? (i - o) / g + 2 : (o - a) / g + 4) / 6, u, s];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Kt(e, t, n) {
|
|
217
217
|
if (t === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
@@ -230,16 +230,16 @@ function we(e, t, n) {
|
|
|
230
230
|
function ke(e) {
|
|
231
231
|
return Math.max(0, Math.min(1, e));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const ut = "suggest_share_on_socials";
|
|
234
|
+
function Xt(e) {
|
|
235
235
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
236
236
|
const n = e[t];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== ut)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = Ve(e, t, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = Ve(e, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,13 +248,13 @@ function jt(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t = await
|
|
251
|
+
async function Zt(e) {
|
|
252
|
+
const t = await Jt(e);
|
|
253
253
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
254
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
255
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ve(e, t, n) {
|
|
258
258
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
259
259
|
const a = e[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
@@ -262,10 +262,10 @@ function We(e, t, n) {
|
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
265
|
+
async function Jt(e) {
|
|
266
266
|
return await (await fetch(e)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const gt = 100, Qt = "product-agent:sdk-preview-socket-connect", en = "product-agent:sdk-preview-socket-send", tn = "product-agent:sdk-preview-socket-close", nn = "product-agent:sdk-preview-socket-open", on = "product-agent:sdk-preview-socket-message", an = "product-agent:sdk-preview-socket-error", rn = "product-agent:sdk-preview-socket-closed", qe = "product-agent:sdk-preview-socket-id", ln = "product-agent:preview-diagnostic", ht = "pluno.productAgent.sharePromptsDisabled", de = 10, pn = 10 * 1024 * 1024, sn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), R = {
|
|
269
269
|
launcherLabel: "Ask for anything...",
|
|
270
270
|
accentColor: "#7c3aed",
|
|
271
271
|
colorScheme: "light",
|
|
@@ -273,19 +273,19 @@ const ht = 100, Xt = "product-agent:sdk-preview-socket-connect", Zt = "product-a
|
|
|
273
273
|
scribbleStyle: !1,
|
|
274
274
|
position: "bottom-right",
|
|
275
275
|
movableLauncher: !1
|
|
276
|
-
},
|
|
277
|
-
function
|
|
276
|
+
}, je = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', dn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Ye = "pluno-pa-scribble-font", mt = 190, ft = 41, cn = 48, un = 420, gn = 520, hn = 0.24, mn = 680, fn = 800, bn = 0.76, A = 8, Se = 50, wn = "http://www.w3.org/2000/svg", _n = 11, xn = 13, yn = 4, vn = 10, Cn = 40, En = "movable-launcher-position-v2", bt = "pluno-pa-widget-styles", wt = "data-pluno-pa-widget-styles";
|
|
277
|
+
function kn(e) {
|
|
278
278
|
return (t) => new O(t, e);
|
|
279
279
|
}
|
|
280
|
-
async function
|
|
280
|
+
async function Sn(e = {}) {
|
|
281
281
|
const t = {
|
|
282
|
-
launcherLabel: e.launcherLabel ??
|
|
283
|
-
accentColor: e.accentColor ??
|
|
284
|
-
colorScheme: e.colorScheme ??
|
|
285
|
-
fontFamily: e.fontFamily ??
|
|
286
|
-
scribbleStyle: e.scribbleStyle ??
|
|
287
|
-
position: e.position ??
|
|
288
|
-
movableLauncher: e.movableLauncher ??
|
|
282
|
+
launcherLabel: e.launcherLabel ?? R.launcherLabel,
|
|
283
|
+
accentColor: e.accentColor ?? R.accentColor,
|
|
284
|
+
colorScheme: e.colorScheme ?? R.colorScheme,
|
|
285
|
+
fontFamily: e.fontFamily ?? R.fontFamily,
|
|
286
|
+
scribbleStyle: e.scribbleStyle ?? R.scribbleStyle,
|
|
287
|
+
position: e.position ?? R.position,
|
|
288
|
+
movableLauncher: e.movableLauncher ?? R.movableLauncher,
|
|
289
289
|
token: e.token,
|
|
290
290
|
tokenProvider: e.tokenProvider,
|
|
291
291
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -318,13 +318,13 @@ async function Cn(e = {}) {
|
|
|
318
318
|
initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
|
|
319
319
|
});
|
|
320
320
|
const n = document.createElement("div");
|
|
321
|
-
n.className = "pluno-pa-widget-host";
|
|
321
|
+
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
322
322
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
323
|
-
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}
|
|
323
|
+
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
324
324
|
let i = Ke(t.accentColor, t.scribbleStyle);
|
|
325
|
-
|
|
326
|
-
const l = await
|
|
327
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
325
|
+
Rn(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
326
|
+
const l = await ko(), p = l.ownerDocument;
|
|
327
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), rt(o, t.accentColor), Xe(a, i, {
|
|
328
328
|
accentColor: t.accentColor,
|
|
329
329
|
colorScheme: t.colorScheme,
|
|
330
330
|
fontFamily: t.fontFamily,
|
|
@@ -335,16 +335,16 @@ async function Cn(e = {}) {
|
|
|
335
335
|
fontFamily: t.fontFamily,
|
|
336
336
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
337
337
|
});
|
|
338
|
-
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"),
|
|
339
|
-
if (!s || !
|
|
338
|
+
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), u = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), m = a.querySelector(".pluno-pa-widget__billing-status"), f = a.querySelector(".pluno-pa-widget__attachments"), d = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), _ = a.querySelector(".pluno-pa-widget__new-chat"), k = a.querySelector(".pluno-pa-widget__timeline");
|
|
339
|
+
if (!s || !u || !b || !w || !x || !C || !m || !f || !d || !h || !_ || !k)
|
|
340
340
|
throw new Error("Failed to mount Pluno widget");
|
|
341
341
|
if (t.movableLauncher && !g)
|
|
342
342
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
343
|
-
|
|
344
|
-
let
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
Qe(u), Qe(d);
|
|
344
|
+
let y = [], v = null;
|
|
345
|
+
const D = () => {
|
|
346
|
+
qn(f, y, (r) => {
|
|
347
|
+
y = y.filter((c, L) => L !== r), D(), T();
|
|
348
348
|
});
|
|
349
349
|
}, ne = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
350
350
|
if (!t.tokenEndpoint)
|
|
@@ -357,13 +357,13 @@ async function Cn(e = {}) {
|
|
|
357
357
|
});
|
|
358
358
|
if (!r.ok)
|
|
359
359
|
throw new Error("Failed to load Pluno token");
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
360
|
+
const c = await r.json();
|
|
361
|
+
if (!c.token)
|
|
362
362
|
throw new Error("Pluno token endpoint did not return a token");
|
|
363
|
-
return
|
|
363
|
+
return c.token;
|
|
364
364
|
});
|
|
365
365
|
let E;
|
|
366
|
-
E = await
|
|
366
|
+
E = await zt.init({
|
|
367
367
|
token: t.token,
|
|
368
368
|
tokenProvider: ne,
|
|
369
369
|
backendUrl: t.backendUrl,
|
|
@@ -378,32 +378,32 @@ async function Cn(e = {}) {
|
|
|
378
378
|
webSocketFactory: t.webSocketFactory,
|
|
379
379
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
380
380
|
});
|
|
381
|
-
const z =
|
|
382
|
-
let ue = z.sharePromptsDisabled || await
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
381
|
+
const z = So(t), ce = new Set(z.openToolGroupKeys), $ = new Set(z.seenShareCandidateIds), oe = new Set($);
|
|
382
|
+
let ue = z.sharePromptsDisabled || await Lo(t), M = t.movableLauncher ? z.launcherPosition : null, De = M !== null, B = null, Ie = !1;
|
|
383
|
+
const Tt = () => {
|
|
384
|
+
Ie || typeof document > "u" || (rt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
385
|
+
}, Me = new MutationObserver(Tt);
|
|
386
|
+
Me.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
387
387
|
const ge = (r = !0) => {
|
|
388
|
-
const
|
|
388
|
+
const c = Le(a, r);
|
|
389
389
|
return Ze(
|
|
390
390
|
a,
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
M ?? An(a, t.position, c),
|
|
392
|
+
c
|
|
393
393
|
);
|
|
394
|
-
},
|
|
395
|
-
|
|
394
|
+
}, N = () => {
|
|
395
|
+
Ao(t, {
|
|
396
396
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
397
|
-
composerValue:
|
|
397
|
+
composerValue: d.value,
|
|
398
398
|
openToolGroupKeys: [...ce],
|
|
399
|
-
launcherPosition:
|
|
400
|
-
seenShareCandidateIds: [...$].slice(-
|
|
399
|
+
launcherPosition: De ? M : null,
|
|
400
|
+
seenShareCandidateIds: [...$].slice(-gt),
|
|
401
401
|
sharePromptsDisabled: ue
|
|
402
402
|
});
|
|
403
|
-
}, G = (r,
|
|
404
|
-
|
|
405
|
-
debugVersion:
|
|
406
|
-
launcherPosition:
|
|
403
|
+
}, G = (r, c = {}) => {
|
|
404
|
+
Mn(r, {
|
|
405
|
+
debugVersion: En,
|
|
406
|
+
launcherPosition: M,
|
|
407
407
|
rootClasses: a.className,
|
|
408
408
|
rootStyle: {
|
|
409
409
|
left: a.style.left,
|
|
@@ -414,133 +414,130 @@ async function Cn(e = {}) {
|
|
|
414
414
|
rootRect: _e(a),
|
|
415
415
|
launcherRect: _e(s),
|
|
416
416
|
panelRect: _e(b),
|
|
417
|
-
viewport:
|
|
417
|
+
viewport: K(),
|
|
418
418
|
panelHidden: b.hidden,
|
|
419
419
|
closeHidden: w.hidden,
|
|
420
|
-
...
|
|
420
|
+
...c
|
|
421
421
|
});
|
|
422
422
|
}, ae = (r = !0) => {
|
|
423
|
-
if (!
|
|
423
|
+
if (!M)
|
|
424
424
|
return re(a, null), ge(r);
|
|
425
|
-
const
|
|
426
|
-
return re(a,
|
|
427
|
-
},
|
|
428
|
-
if (!r || !
|
|
429
|
-
|
|
425
|
+
const c = ge(r);
|
|
426
|
+
return re(a, c), G("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
|
|
427
|
+
}, Re = (r, c) => {
|
|
428
|
+
if (!r || !c) {
|
|
429
|
+
In(a);
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
|
-
|
|
433
|
-
x: r.x -
|
|
434
|
-
y: r.y -
|
|
432
|
+
Dn(a, {
|
|
433
|
+
x: r.x - c.x,
|
|
434
|
+
y: r.y - c.y
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, Oe = () => {
|
|
437
437
|
const r = ae();
|
|
438
438
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
} else
|
|
439
|
+
const c = Je(a, r, t.position);
|
|
440
|
+
Re(c, r), G("Applied open panel position after viewport resize", { openPanelPosition: c });
|
|
441
|
+
} else M && G("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
442
442
|
};
|
|
443
|
-
let
|
|
443
|
+
let Be = () => {
|
|
444
444
|
};
|
|
445
|
-
t.movableLauncher && g ? (ae(),
|
|
445
|
+
window.addEventListener("resize", Oe), t.movableLauncher && g ? (ae(), Be = Pn({
|
|
446
446
|
root: a,
|
|
447
447
|
launcherDragHandle: g,
|
|
448
448
|
getPosition: () => ge(),
|
|
449
449
|
setPosition: (r) => {
|
|
450
|
-
const
|
|
451
|
-
|
|
450
|
+
const c = r;
|
|
451
|
+
M = Ze(a, r, Le(a)), re(a, M), G("Dragging closed launcher", { requestedPosition: c });
|
|
452
452
|
},
|
|
453
453
|
persist: () => {
|
|
454
|
-
|
|
454
|
+
De = !0, N(), G("Persisted closed launcher drag position");
|
|
455
455
|
}
|
|
456
456
|
})) : re(a, null);
|
|
457
457
|
let he = !1;
|
|
458
|
-
const
|
|
458
|
+
const Fe = async () => {
|
|
459
459
|
if (!(!t.billingStatusLoader || he)) {
|
|
460
460
|
he = !0;
|
|
461
461
|
try {
|
|
462
462
|
const r = await t.billingStatusLoader();
|
|
463
|
-
|
|
463
|
+
tt(t.billingStatus, r, E.getState().lastErrorCode) && (t.billingStatus = r, ve(m, t.billingStatus, E.getState().lastErrorCode), T());
|
|
464
464
|
} finally {
|
|
465
465
|
he = !1;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
}, W = (r = "",
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
Qe(a);
|
|
474
|
-
if (!d) {
|
|
475
|
-
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (u.value = r, ee(u)), k.scrollTop = k.scrollHeight, u.focus(), u.setSelectionRange(u.value.length, u.value.length), A();
|
|
468
|
+
}, W = (r = "", c = !0) => {
|
|
469
|
+
Fe(), B !== null && (window.clearTimeout(B), B = null), b.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
470
|
+
const L = ae(), Q = Je(a, L, t.position);
|
|
471
|
+
if (Re(Q, L), G("Opening launcher at clamped open panel position", { openPanelPosition: Q, visibleLauncherPosition: L }), !c) {
|
|
472
|
+
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N();
|
|
476
473
|
return;
|
|
477
474
|
}
|
|
478
475
|
window.requestAnimationFrame(() => {
|
|
479
|
-
a.classList.add("pluno-pa-widget--open"), r && (
|
|
476
|
+
a.classList.add("pluno-pa-widget--open"), r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N(), B = window.setTimeout(() => {
|
|
480
477
|
s.hidden = !0, k.scrollTop = k.scrollHeight;
|
|
481
478
|
}, 220);
|
|
482
479
|
});
|
|
483
|
-
},
|
|
484
|
-
B !== null && (window.clearTimeout(B), B = null), s.hidden = !1,
|
|
480
|
+
}, Dt = () => {
|
|
481
|
+
B !== null && (window.clearTimeout(B), B = null), s.hidden = !1, M && (ae(!1), G("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), N(), B = window.setTimeout(() => {
|
|
485
482
|
b.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
486
483
|
}, 220);
|
|
487
484
|
};
|
|
488
485
|
s.addEventListener("submit", (r) => {
|
|
489
|
-
r.preventDefault(), W(
|
|
486
|
+
r.preventDefault(), W(u.value), u.value = "";
|
|
490
487
|
}), g?.addEventListener("click", (r) => {
|
|
491
488
|
r.preventDefault(), r.stopPropagation();
|
|
492
489
|
}), s.addEventListener("click", (r) => {
|
|
493
|
-
r.target !==
|
|
494
|
-
}),
|
|
495
|
-
W(
|
|
496
|
-
}),
|
|
497
|
-
if (!
|
|
490
|
+
r.target !== u && (W(u.value), u.value = "");
|
|
491
|
+
}), u.addEventListener("focus", () => {
|
|
492
|
+
W(u.value), u.value = "";
|
|
493
|
+
}), u.addEventListener("input", () => {
|
|
494
|
+
if (!u.value)
|
|
498
495
|
return;
|
|
499
|
-
const r =
|
|
500
|
-
W(r),
|
|
501
|
-
}), w.addEventListener("click",
|
|
502
|
-
const
|
|
503
|
-
|
|
496
|
+
const r = u.value;
|
|
497
|
+
W(r), u.value = "";
|
|
498
|
+
}), w.addEventListener("click", Dt);
|
|
499
|
+
const T = () => {
|
|
500
|
+
h.disabled = F(t.billingStatus) || !E.getState().isThinking && d.value.trim().length === 0 && y.length === 0;
|
|
504
501
|
};
|
|
505
|
-
t.loginRequired && (
|
|
502
|
+
t.loginRequired && (u.readOnly = !0, u.placeholder = t.loginButtonLabel, d.placeholder = t.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (r) => {
|
|
506
503
|
if (r.preventDefault(), t.loginRequired) {
|
|
507
504
|
t.onLoginClick?.();
|
|
508
505
|
return;
|
|
509
506
|
}
|
|
510
|
-
F(t.billingStatus) || (
|
|
507
|
+
F(t.billingStatus) || (y = xe(E, d, y), D(), T());
|
|
511
508
|
});
|
|
512
509
|
let Z = 0;
|
|
513
|
-
const
|
|
510
|
+
const It = () => {
|
|
514
511
|
Z = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
C.textContent = "", C.hidden = !0,
|
|
512
|
+
}, Mt = (r) => {
|
|
513
|
+
v !== null && window.clearTimeout(v), C.textContent = r, C.hidden = !1, v = window.setTimeout(() => {
|
|
514
|
+
C.textContent = "", C.hidden = !0, v = null;
|
|
518
515
|
}, 3e3);
|
|
519
|
-
},
|
|
520
|
-
|
|
521
|
-
},
|
|
516
|
+
}, Rt = () => {
|
|
517
|
+
v !== null && (window.clearTimeout(v), v = null), C.textContent = "", C.hidden = !0;
|
|
518
|
+
}, Ot = async (r) => {
|
|
522
519
|
if (r.length === 0)
|
|
523
520
|
return;
|
|
524
|
-
const
|
|
525
|
-
if (
|
|
521
|
+
const c = await Xn(r);
|
|
522
|
+
if (y.length + c.length > de)
|
|
526
523
|
throw new Error(`Attach up to ${de} files per message.`);
|
|
527
|
-
|
|
524
|
+
y = [...y, ...c], D(), Rt(), T();
|
|
528
525
|
};
|
|
529
526
|
a.addEventListener("dragenter", (r) => {
|
|
530
527
|
!le(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Z += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
531
528
|
}), a.addEventListener("dragover", (r) => {
|
|
532
|
-
const
|
|
533
|
-
!le(
|
|
529
|
+
const c = r.dataTransfer;
|
|
530
|
+
!le(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
|
|
534
531
|
}), a.addEventListener("dragleave", (r) => {
|
|
535
532
|
le(r.dataTransfer) && (r.stopPropagation(), Z = Math.max(0, Z - 1), Z === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
536
533
|
}), a.addEventListener("drop", (r) => {
|
|
537
|
-
const
|
|
538
|
-
!le(
|
|
539
|
-
|
|
534
|
+
const c = r.dataTransfer;
|
|
535
|
+
!le(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), It(), Ot(c.files).catch((L) => {
|
|
536
|
+
Mt(L instanceof Error ? L.message : "Failed to attach file"), U("web-sdk.widget", "Attachment failed", {
|
|
540
537
|
message: L instanceof Error ? L.message : String(L)
|
|
541
538
|
});
|
|
542
539
|
}));
|
|
543
|
-
}),
|
|
540
|
+
}), h.addEventListener("click", () => {
|
|
544
541
|
if (t.loginRequired) {
|
|
545
542
|
t.onLoginClick?.();
|
|
546
543
|
return;
|
|
@@ -549,144 +546,144 @@ async function Cn(e = {}) {
|
|
|
549
546
|
E.stop();
|
|
550
547
|
return;
|
|
551
548
|
}
|
|
552
|
-
|
|
549
|
+
y = xe(E, d, y), D(), T();
|
|
553
550
|
}), _.addEventListener("click", () => {
|
|
554
|
-
E.startNewSession(), ce.clear(),
|
|
555
|
-
}),
|
|
556
|
-
ee(
|
|
557
|
-
}),
|
|
551
|
+
E.startNewSession(), ce.clear(), d.value = "", y = [], D(), ee(d), N(), T(), d.focus();
|
|
552
|
+
}), d.addEventListener("input", () => {
|
|
553
|
+
ee(d), N(), T();
|
|
554
|
+
}), d.addEventListener("keydown", (r) => {
|
|
558
555
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
559
556
|
if (r.preventDefault(), t.loginRequired) {
|
|
560
557
|
t.onLoginClick?.();
|
|
561
558
|
return;
|
|
562
559
|
}
|
|
563
|
-
|
|
560
|
+
y = xe(E, d, y), D(), T();
|
|
564
561
|
}
|
|
565
562
|
}), a.addEventListener("click", (r) => {
|
|
566
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
567
|
-
}), z.composerValue && (
|
|
568
|
-
const
|
|
569
|
-
let me = E.getState().appearance !== null, ie = null, J = null, H = null,
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
|
|
563
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && N();
|
|
564
|
+
}), z.composerValue && (d.value = z.composerValue, ee(d)), z.isOpen && W(d.value, !1);
|
|
565
|
+
const ze = () => i;
|
|
566
|
+
let me = E.getState().appearance !== null, ie = null, J = null, H = null, Ge = E.getState().isThinking, V = null;
|
|
567
|
+
const Bt = !!t.socialPostDraftHandler, q = (r) => {
|
|
568
|
+
if (Te(r.lastErrorCode) ? V = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !F(t.billingStatus) && (V = null), ve(m, t.billingStatus, V), t.loginRequired) {
|
|
569
|
+
so(k, h, _, ze, t.loginButtonLabel, t.onLoginClick);
|
|
573
570
|
return;
|
|
574
571
|
}
|
|
575
|
-
|
|
572
|
+
po(
|
|
576
573
|
k,
|
|
577
|
-
|
|
574
|
+
h,
|
|
578
575
|
_,
|
|
579
576
|
r,
|
|
580
577
|
ce,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
(
|
|
584
|
-
E.sendMessage(
|
|
578
|
+
N,
|
|
579
|
+
ze,
|
|
580
|
+
(c) => {
|
|
581
|
+
E.sendMessage(c);
|
|
585
582
|
},
|
|
586
|
-
|
|
583
|
+
Bt && !ue ? {
|
|
587
584
|
dismissedCandidateIds: oe,
|
|
588
585
|
draftingCandidateId: ie,
|
|
589
586
|
error: J,
|
|
590
|
-
onSeen: (
|
|
591
|
-
$.add(
|
|
587
|
+
onSeen: (c) => {
|
|
588
|
+
$.add(c.id), N();
|
|
592
589
|
},
|
|
593
|
-
onDraft: (
|
|
594
|
-
|
|
590
|
+
onDraft: (c) => {
|
|
591
|
+
Ft(c);
|
|
595
592
|
},
|
|
596
|
-
onDismiss: (
|
|
597
|
-
$.add(
|
|
593
|
+
onDismiss: (c) => {
|
|
594
|
+
$.add(c.id), oe.add(c.id), N(), J = null, q(E.getState());
|
|
598
595
|
},
|
|
599
|
-
onDisable: (
|
|
600
|
-
ue = !0, $.add(
|
|
596
|
+
onDisable: (c) => {
|
|
597
|
+
ue = !0, $.add(c.id), oe.add(c.id), N(), Po(t, !0), J = null, q(E.getState());
|
|
601
598
|
}
|
|
602
599
|
} : void 0
|
|
603
600
|
);
|
|
604
601
|
};
|
|
605
602
|
return E.on("state", (r) => {
|
|
606
|
-
const
|
|
607
|
-
|
|
603
|
+
const c = Ge && !r.isThinking;
|
|
604
|
+
Ge = r.isThinking, r.appearance ? (me = !0, U("web-sdk.widget", "Agent state supplied appearance", {
|
|
608
605
|
appearance: r.appearance
|
|
609
606
|
}), fe(r.appearance, "agent.state.appearance")) : me && (me = !1, U("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
610
607
|
fallbackAccentColor: t.accentColor,
|
|
611
608
|
fallbackColorScheme: t.colorScheme,
|
|
612
609
|
fallbackFontFamily: t.fontFamily
|
|
613
|
-
}), fe({}, "agent.state.appearance-cleared")), q(r),
|
|
614
|
-
}), q(E.getState()),
|
|
610
|
+
}), fe({}, "agent.state.appearance-cleared")), q(r), T(), c && Fe();
|
|
611
|
+
}), q(E.getState()), T(), {
|
|
615
612
|
agent: E,
|
|
616
613
|
updateAppearance: (r) => {
|
|
617
614
|
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), fe(r, "widgetHandle.updateAppearance");
|
|
618
615
|
},
|
|
619
616
|
updateBillingStatus: (r) => {
|
|
620
|
-
const
|
|
621
|
-
|
|
617
|
+
const c = r ?? null;
|
|
618
|
+
tt(t.billingStatus, c, V) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !F(t.billingStatus) && (V = null), ve(
|
|
622
619
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
623
620
|
t.billingStatus,
|
|
624
621
|
V
|
|
625
|
-
),
|
|
622
|
+
), T());
|
|
626
623
|
},
|
|
627
624
|
openPanel: () => {
|
|
628
|
-
W(
|
|
625
|
+
W(d.value, !1);
|
|
629
626
|
},
|
|
630
627
|
destroy: () => {
|
|
631
|
-
|
|
628
|
+
Ie = !0, Me.disconnect(), window.removeEventListener("resize", Oe), Be(), v !== null && window.clearTimeout(v), H?.remove(), E.destroy(), n.remove();
|
|
632
629
|
}
|
|
633
630
|
};
|
|
634
|
-
async function
|
|
631
|
+
async function Ft(r) {
|
|
635
632
|
if (!ie) {
|
|
636
633
|
ie = r.id, J = null, q(E.getState());
|
|
637
634
|
try {
|
|
638
635
|
if (!t.socialPostDraftHandler)
|
|
639
636
|
throw new Error("Social post drafting is not available here.");
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
637
|
+
const c = await t.socialPostDraftHandler(r);
|
|
638
|
+
if (!c.linkedinPost || !c.xPost)
|
|
642
639
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
643
|
-
$.add(r.id), oe.add(r.id),
|
|
640
|
+
$.add(r.id), oe.add(r.id), N(), H?.remove(), H = go(c, {
|
|
644
641
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
645
642
|
onClose: () => {
|
|
646
643
|
H?.remove(), H = null;
|
|
647
644
|
}
|
|
648
645
|
}), a.appendChild(H);
|
|
649
|
-
} catch (
|
|
650
|
-
J =
|
|
646
|
+
} catch (c) {
|
|
647
|
+
J = c instanceof Error ? c.message : "Could not draft social post.";
|
|
651
648
|
} finally {
|
|
652
649
|
ie = null, q(E.getState());
|
|
653
650
|
}
|
|
654
651
|
}
|
|
655
652
|
}
|
|
656
|
-
function fe(r,
|
|
657
|
-
const L = r.accentColor ?? t.accentColor, Q = r.colorScheme ?? t.colorScheme,
|
|
658
|
-
i = Ke(L, be),
|
|
653
|
+
function fe(r, c) {
|
|
654
|
+
const L = r.accentColor ?? t.accentColor, Q = r.colorScheme ?? t.colorScheme, Ue = r.fontFamily ?? t.fontFamily, be = r.scribbleStyle ?? t.scribbleStyle;
|
|
655
|
+
i = Ke(L, be), Xe(a, i, {
|
|
659
656
|
accentColor: L,
|
|
660
657
|
colorScheme: Q,
|
|
661
|
-
fontFamily:
|
|
658
|
+
fontFamily: Ue,
|
|
662
659
|
scribbleStyle: be
|
|
663
660
|
}), U("web-sdk.widget", "Updated widget appearance", {
|
|
664
|
-
source:
|
|
661
|
+
source: c,
|
|
665
662
|
inputAppearance: r,
|
|
666
663
|
appliedAccentColor: L,
|
|
667
664
|
appliedColorScheme: Q,
|
|
668
|
-
appliedFontFamily:
|
|
665
|
+
appliedFontFamily: Ue,
|
|
669
666
|
appliedScribbleStyle: be,
|
|
670
667
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
671
668
|
});
|
|
672
669
|
}
|
|
673
670
|
}
|
|
674
671
|
function Ke(e, t) {
|
|
675
|
-
return t ?
|
|
672
|
+
return t ? Ht(e) : $t(e);
|
|
676
673
|
}
|
|
677
|
-
function
|
|
674
|
+
function Xe(e, t, n) {
|
|
678
675
|
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);
|
|
679
|
-
const o = n.scribbleStyle ?
|
|
680
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ?
|
|
676
|
+
const o = n.scribbleStyle ? dt(n.accentColor) : n.accentColor;
|
|
677
|
+
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? dn : n.fontFamily, n.scribbleStyle && Ln(e.ownerDocument);
|
|
681
678
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
682
679
|
for (const i of a)
|
|
683
680
|
i.src = t;
|
|
684
681
|
}
|
|
685
|
-
function
|
|
686
|
-
if (e.getElementById(
|
|
682
|
+
function Ln(e) {
|
|
683
|
+
if (e.getElementById(Ye))
|
|
687
684
|
return;
|
|
688
685
|
const t = e.createElement("style");
|
|
689
|
-
t.id =
|
|
686
|
+
t.id = Ye, t.textContent = `@font-face {
|
|
690
687
|
font-family: "Architects Daughter";
|
|
691
688
|
font-style: normal;
|
|
692
689
|
font-weight: 400;
|
|
@@ -694,7 +691,7 @@ function En(e) {
|
|
|
694
691
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
695
692
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
696
693
|
}
|
|
697
|
-
function
|
|
694
|
+
function Pn({
|
|
698
695
|
root: e,
|
|
699
696
|
launcherDragHandle: t,
|
|
700
697
|
getPosition: n,
|
|
@@ -704,80 +701,87 @@ function kn({
|
|
|
704
701
|
let i = null, l = null, p = null, s = !1;
|
|
705
702
|
const g = () => {
|
|
706
703
|
i = null, l = null, p = null, s = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
707
|
-
},
|
|
708
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (
|
|
709
|
-
}, b = (
|
|
710
|
-
if (i !==
|
|
704
|
+
}, u = (m) => {
|
|
705
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), i = m.pointerId, l = { x: m.clientX, y: m.clientY }, p = n(), s = !1, t.setPointerCapture?.(m.pointerId));
|
|
706
|
+
}, b = (m) => {
|
|
707
|
+
if (i !== m.pointerId || !l || !p)
|
|
711
708
|
return;
|
|
712
|
-
|
|
713
|
-
const f =
|
|
714
|
-
!s && Math.hypot(f,
|
|
715
|
-
}, w = (
|
|
716
|
-
i ===
|
|
717
|
-
}, x = (
|
|
718
|
-
i ===
|
|
719
|
-
}, C = (
|
|
709
|
+
m.preventDefault();
|
|
710
|
+
const f = m.clientX - l.x, d = m.clientY - l.y;
|
|
711
|
+
!s && Math.hypot(f, d) < yn || (s = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + f, y: p.y + d }));
|
|
712
|
+
}, w = (m) => {
|
|
713
|
+
i === m.pointerId && (m.preventDefault(), m.stopPropagation(), s && a(), g());
|
|
714
|
+
}, x = (m) => {
|
|
715
|
+
i === m.pointerId && (m.preventDefault(), g());
|
|
716
|
+
}, C = (m) => {
|
|
720
717
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
721
718
|
return;
|
|
722
|
-
const f =
|
|
723
|
-
let
|
|
724
|
-
|
|
719
|
+
const f = m.shiftKey ? Cn : vn, d = n();
|
|
720
|
+
let h = null;
|
|
721
|
+
m.key === "ArrowUp" ? h = { x: d.x, y: d.y - f } : m.key === "ArrowDown" ? h = { x: d.x, y: d.y + f } : m.key === "ArrowLeft" ? h = { x: d.x - f, y: d.y } : m.key === "ArrowRight" && (h = { x: d.x + f, y: d.y }), h && (m.preventDefault(), m.stopPropagation(), o(h), a());
|
|
725
722
|
};
|
|
726
|
-
return t.addEventListener("pointerdown",
|
|
727
|
-
t.removeEventListener("pointerdown",
|
|
723
|
+
return t.addEventListener("pointerdown", u), t.addEventListener("pointermove", b), t.addEventListener("pointerup", w), t.addEventListener("pointercancel", x), t.addEventListener("keydown", C), () => {
|
|
724
|
+
t.removeEventListener("pointerdown", u), t.removeEventListener("pointermove", b), t.removeEventListener("pointerup", w), t.removeEventListener("pointercancel", x), t.removeEventListener("keydown", C);
|
|
728
725
|
};
|
|
729
726
|
}
|
|
730
|
-
function
|
|
731
|
-
const n =
|
|
727
|
+
function Le(e, t = !0) {
|
|
728
|
+
const n = K(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
732
729
|
return {
|
|
733
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
734
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
730
|
+
width: t && a && o.width > 0 ? o.width : Math.min(mt, n.width - 36),
|
|
731
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? cn : ft
|
|
735
732
|
};
|
|
736
733
|
}
|
|
737
|
-
function
|
|
738
|
-
const e =
|
|
734
|
+
function _t() {
|
|
735
|
+
const e = K();
|
|
739
736
|
return {
|
|
740
737
|
width: Math.min(
|
|
741
|
-
|
|
742
|
-
e.width -
|
|
738
|
+
Y(e.width * hn, un, gn),
|
|
739
|
+
e.width - A * 2
|
|
743
740
|
),
|
|
744
741
|
height: Math.min(
|
|
745
|
-
|
|
746
|
-
e.height -
|
|
742
|
+
Y(e.height * bn, mn, fn),
|
|
743
|
+
e.height - Se - A
|
|
747
744
|
)
|
|
748
745
|
};
|
|
749
746
|
}
|
|
750
|
-
function
|
|
747
|
+
function An(e, t, n) {
|
|
751
748
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
752
749
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
753
750
|
return { x: o, y: a };
|
|
754
751
|
const i = e.getBoundingClientRect();
|
|
755
752
|
if (i.width > 0 || i.height > 0)
|
|
756
753
|
return { x: i.left, y: i.top };
|
|
757
|
-
const l =
|
|
754
|
+
const l = K();
|
|
758
755
|
return {
|
|
759
756
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
760
757
|
y: l.height - 24 - n.height
|
|
761
758
|
};
|
|
762
759
|
}
|
|
763
760
|
function Ze(e, t, n) {
|
|
764
|
-
const o =
|
|
761
|
+
const o = K(), a = A + Nn(e);
|
|
765
762
|
return {
|
|
766
|
-
x:
|
|
767
|
-
y:
|
|
763
|
+
x: Y(t.x, A, Math.max(A, o.width - n.width - A)),
|
|
764
|
+
y: Y(t.y, a, Math.max(a, o.height - n.height - A))
|
|
768
765
|
};
|
|
769
766
|
}
|
|
770
|
-
function
|
|
771
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
767
|
+
function Nn(e) {
|
|
768
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? xn : _n;
|
|
772
769
|
}
|
|
773
|
-
function Je(e) {
|
|
774
|
-
const
|
|
770
|
+
function Je(e, t, n) {
|
|
771
|
+
const o = Le(e), a = _t(), i = {
|
|
772
|
+
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
773
|
+
y: t.y + o.height - a.height
|
|
774
|
+
};
|
|
775
|
+
return Tn(i);
|
|
776
|
+
}
|
|
777
|
+
function Tn(e) {
|
|
778
|
+
const t = K(), n = _t();
|
|
775
779
|
return {
|
|
776
|
-
x:
|
|
777
|
-
y:
|
|
780
|
+
x: Y(e.x, A, Math.max(A, t.width - n.width - A)),
|
|
781
|
+
y: Y(
|
|
778
782
|
e.y,
|
|
779
|
-
|
|
780
|
-
Math.max(
|
|
783
|
+
Se,
|
|
784
|
+
Math.max(Se, t.height - n.height - A)
|
|
781
785
|
)
|
|
782
786
|
};
|
|
783
787
|
}
|
|
@@ -788,16 +792,16 @@ function re(e, t) {
|
|
|
788
792
|
}
|
|
789
793
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
790
794
|
}
|
|
791
|
-
function
|
|
795
|
+
function Dn(e, t) {
|
|
792
796
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
793
797
|
}
|
|
794
|
-
function
|
|
798
|
+
function In(e) {
|
|
795
799
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
796
800
|
}
|
|
797
|
-
function
|
|
801
|
+
function K() {
|
|
798
802
|
return {
|
|
799
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
800
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
803
|
+
width: window.innerWidth || document.documentElement.clientWidth || mt + A * 2,
|
|
804
|
+
height: window.innerHeight || document.documentElement.clientHeight || ft + A * 2
|
|
801
805
|
};
|
|
802
806
|
}
|
|
803
807
|
function _e(e) {
|
|
@@ -809,7 +813,7 @@ function _e(e) {
|
|
|
809
813
|
height: Math.round(t.height)
|
|
810
814
|
};
|
|
811
815
|
}
|
|
812
|
-
function
|
|
816
|
+
function Y(e, t, n) {
|
|
813
817
|
return Math.min(Math.max(e, t), n);
|
|
814
818
|
}
|
|
815
819
|
function U(e, t, n) {
|
|
@@ -821,9 +825,9 @@ function U(e, t, n) {
|
|
|
821
825
|
message: t,
|
|
822
826
|
details: n
|
|
823
827
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
824
|
-
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(
|
|
828
|
+
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(ln, { detail: a }));
|
|
825
829
|
}
|
|
826
|
-
function
|
|
830
|
+
function Mn(e, t) {
|
|
827
831
|
U("web-sdk.widget.position", e, t);
|
|
828
832
|
}
|
|
829
833
|
function xe(e, t, n) {
|
|
@@ -835,28 +839,28 @@ function ee(e) {
|
|
|
835
839
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
836
840
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
837
841
|
}
|
|
838
|
-
function
|
|
839
|
-
e.appendChild(
|
|
842
|
+
function Rn(e, t, n, o) {
|
|
843
|
+
e.appendChild(Gn()), e.appendChild(On(t, n, o)), e.appendChild(vt("pluno-pa-widget__close", "Close", Un(16), !0)), e.appendChild(Bn(n));
|
|
840
844
|
}
|
|
841
|
-
function
|
|
845
|
+
function On(e, t, n) {
|
|
842
846
|
const o = document.createElement("form");
|
|
843
847
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
844
848
|
const i = document.createElement("button");
|
|
845
849
|
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);
|
|
846
850
|
}
|
|
847
|
-
o.appendChild(
|
|
851
|
+
o.appendChild(yt("pluno-pa-widget__character--launcher", t));
|
|
848
852
|
const a = document.createElement("input");
|
|
849
853
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
850
854
|
}
|
|
851
|
-
function
|
|
855
|
+
function Bn(e) {
|
|
852
856
|
const t = document.createElement("section");
|
|
853
857
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
854
858
|
const n = document.createElement("div");
|
|
855
859
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
856
860
|
const o = document.createElement("main");
|
|
857
|
-
return o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
861
|
+
return o.className = "pluno-pa-widget__timeline", o.appendChild(zn(e)), n.appendChild(o), n.appendChild(vt("pluno-pa-widget__new-chat", "New chat", $n(), !0)), t.appendChild(n), t.appendChild(Fn()), t;
|
|
858
862
|
}
|
|
859
|
-
function
|
|
863
|
+
function Fn() {
|
|
860
864
|
const e = document.createElement("form");
|
|
861
865
|
e.className = "pluno-pa-widget__composer";
|
|
862
866
|
const t = document.createElement("div");
|
|
@@ -870,7 +874,7 @@ function Rn() {
|
|
|
870
874
|
const i = document.createElement("textarea");
|
|
871
875
|
i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
|
|
872
876
|
const l = document.createElement("button");
|
|
873
|
-
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(
|
|
877
|
+
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(Ct()), a.appendChild(l), e.appendChild(a);
|
|
874
878
|
const p = document.createElement("div");
|
|
875
879
|
p.className = "pluno-pa-widget__composer-meta";
|
|
876
880
|
const s = document.createElement("a");
|
|
@@ -878,23 +882,23 @@ function Rn() {
|
|
|
878
882
|
const g = document.createElement("span");
|
|
879
883
|
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(g), e.appendChild(p), e;
|
|
880
884
|
}
|
|
881
|
-
function
|
|
885
|
+
function zn(e) {
|
|
882
886
|
const t = document.createElement("div");
|
|
883
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
887
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(yt("pluno-pa-widget__character--empty", e)), t.appendChild(xt()), t;
|
|
884
888
|
}
|
|
885
|
-
function
|
|
889
|
+
function xt() {
|
|
886
890
|
const e = document.createElement("div");
|
|
887
891
|
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;
|
|
888
892
|
}
|
|
889
|
-
function
|
|
893
|
+
function yt(e, t) {
|
|
890
894
|
const n = document.createElement("img");
|
|
891
895
|
return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
892
896
|
}
|
|
893
|
-
function
|
|
897
|
+
function vt(e, t, n, o) {
|
|
894
898
|
const a = document.createElement("button");
|
|
895
899
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
896
900
|
}
|
|
897
|
-
function
|
|
901
|
+
function Gn() {
|
|
898
902
|
const e = S("svg", {
|
|
899
903
|
class: "pluno-pa-widget__scribble-defs",
|
|
900
904
|
"aria-hidden": "true",
|
|
@@ -902,9 +906,9 @@ function On() {
|
|
|
902
906
|
width: "0",
|
|
903
907
|
height: "0"
|
|
904
908
|
}), t = S("defs");
|
|
905
|
-
return t.appendChild(
|
|
909
|
+
return t.appendChild(ye("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(ye("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(ye("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
906
910
|
}
|
|
907
|
-
function
|
|
911
|
+
function ye(e, t, n) {
|
|
908
912
|
const o = S("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
909
913
|
return o.appendChild(
|
|
910
914
|
S("feTurbulence", {
|
|
@@ -941,27 +945,27 @@ function ve(e, t, n) {
|
|
|
941
945
|
})
|
|
942
946
|
), o;
|
|
943
947
|
}
|
|
944
|
-
function
|
|
948
|
+
function Un(e) {
|
|
945
949
|
const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
946
950
|
return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
|
|
947
951
|
}
|
|
948
|
-
function
|
|
952
|
+
function $n() {
|
|
949
953
|
const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
950
954
|
return e.appendChild(S("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(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
951
955
|
}
|
|
952
|
-
function
|
|
956
|
+
function Ct() {
|
|
953
957
|
const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
954
958
|
return e.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
955
959
|
}
|
|
956
|
-
function
|
|
960
|
+
function Wn() {
|
|
957
961
|
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
958
962
|
return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
959
963
|
}
|
|
960
|
-
function
|
|
964
|
+
function Hn() {
|
|
961
965
|
const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
962
966
|
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
963
967
|
}
|
|
964
|
-
function
|
|
968
|
+
function Vn() {
|
|
965
969
|
const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
966
970
|
return e.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
967
971
|
}
|
|
@@ -976,38 +980,38 @@ function X(e, t, n, o, a, i) {
|
|
|
976
980
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
|
|
977
981
|
}
|
|
978
982
|
function S(e, t = {}) {
|
|
979
|
-
const n = document.createElementNS(
|
|
983
|
+
const n = document.createElementNS(wn, e);
|
|
980
984
|
for (const [o, a] of Object.entries(t))
|
|
981
985
|
n.setAttribute(o, a);
|
|
982
986
|
return n;
|
|
983
987
|
}
|
|
984
|
-
function
|
|
988
|
+
function Qe(e) {
|
|
985
989
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
986
990
|
e.addEventListener(t, (n) => {
|
|
987
991
|
n.stopPropagation();
|
|
988
992
|
});
|
|
989
993
|
}
|
|
990
|
-
function
|
|
994
|
+
function qn(e, t, n) {
|
|
991
995
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
992
996
|
for (const [o, a] of t.entries()) {
|
|
993
997
|
const i = document.createElement("div");
|
|
994
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
998
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(jn(a));
|
|
995
999
|
const l = document.createElement("span");
|
|
996
1000
|
l.textContent = a.name, i.appendChild(l);
|
|
997
1001
|
const p = document.createElement("button");
|
|
998
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1002
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Hn()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
1001
|
-
function
|
|
1002
|
-
if (
|
|
1005
|
+
function jn(e) {
|
|
1006
|
+
if (Et(e)) {
|
|
1003
1007
|
const n = document.createElement("img");
|
|
1004
1008
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1005
1009
|
}
|
|
1006
1010
|
const t = document.createElement("span");
|
|
1007
1011
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1008
1012
|
}
|
|
1009
|
-
function
|
|
1010
|
-
if (
|
|
1013
|
+
function Yn(e) {
|
|
1014
|
+
if (Et(e)) {
|
|
1011
1015
|
const a = document.createElement("img");
|
|
1012
1016
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1013
1017
|
}
|
|
@@ -1018,13 +1022,13 @@ function Hn(e) {
|
|
|
1018
1022
|
const o = document.createElement("strong");
|
|
1019
1023
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1020
1024
|
}
|
|
1021
|
-
function
|
|
1025
|
+
function Et(e) {
|
|
1022
1026
|
return e.mimeType.startsWith("image/");
|
|
1023
1027
|
}
|
|
1024
|
-
function
|
|
1028
|
+
function Kn(e) {
|
|
1025
1029
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1026
1030
|
}
|
|
1027
|
-
async function
|
|
1031
|
+
async function Xn(e) {
|
|
1028
1032
|
if (!e)
|
|
1029
1033
|
return [];
|
|
1030
1034
|
const t = Array.from(e);
|
|
@@ -1032,37 +1036,37 @@ async function qn(e) {
|
|
|
1032
1036
|
throw new Error(`Attach up to ${de} files per message.`);
|
|
1033
1037
|
return Promise.all(
|
|
1034
1038
|
t.map(async (n) => {
|
|
1035
|
-
const o =
|
|
1039
|
+
const o = Zn(n);
|
|
1036
1040
|
if (!o)
|
|
1037
1041
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1038
|
-
if (n.size >
|
|
1042
|
+
if (n.size > pn)
|
|
1039
1043
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1040
1044
|
if (o === "image/gif") {
|
|
1041
|
-
const a = new Uint8Array(await
|
|
1042
|
-
if (
|
|
1045
|
+
const a = new Uint8Array(await ro(n));
|
|
1046
|
+
if (Qn(a))
|
|
1043
1047
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1044
1048
|
}
|
|
1045
1049
|
return {
|
|
1046
|
-
name: n.name ||
|
|
1050
|
+
name: n.name || Kn(o),
|
|
1047
1051
|
mimeType: o,
|
|
1048
1052
|
sizeBytes: n.size,
|
|
1049
|
-
dataUrl:
|
|
1053
|
+
dataUrl: Jn(await lo(n), o)
|
|
1050
1054
|
};
|
|
1051
1055
|
})
|
|
1052
1056
|
);
|
|
1053
1057
|
}
|
|
1054
|
-
function
|
|
1055
|
-
if (
|
|
1058
|
+
function Zn(e) {
|
|
1059
|
+
if (sn.has(e.type))
|
|
1056
1060
|
return e.type;
|
|
1057
1061
|
const t = e.name.toLowerCase();
|
|
1058
1062
|
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;
|
|
1059
1063
|
}
|
|
1060
|
-
function
|
|
1064
|
+
function Jn(e, t) {
|
|
1061
1065
|
const n = `data:${t};base64,`;
|
|
1062
1066
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1063
1067
|
}
|
|
1064
|
-
function
|
|
1065
|
-
if (e.length < 14 || !
|
|
1068
|
+
function Qn(e) {
|
|
1069
|
+
if (e.length < 14 || !eo(e))
|
|
1066
1070
|
return !1;
|
|
1067
1071
|
const t = e[10];
|
|
1068
1072
|
let n = 13;
|
|
@@ -1073,7 +1077,7 @@ function Yn(e) {
|
|
|
1073
1077
|
if (n += 1, a === 59)
|
|
1074
1078
|
return !1;
|
|
1075
1079
|
if (a === 33) {
|
|
1076
|
-
n += 1, n =
|
|
1080
|
+
n += 1, n = et(e, n);
|
|
1077
1081
|
continue;
|
|
1078
1082
|
}
|
|
1079
1083
|
if (a !== 44)
|
|
@@ -1085,14 +1089,14 @@ function Yn(e) {
|
|
|
1085
1089
|
const i = e[n + 8];
|
|
1086
1090
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1087
1091
|
return !1;
|
|
1088
|
-
n += 1, n =
|
|
1092
|
+
n += 1, n = et(e, n);
|
|
1089
1093
|
}
|
|
1090
1094
|
return !1;
|
|
1091
1095
|
}
|
|
1092
|
-
function
|
|
1096
|
+
function eo(e) {
|
|
1093
1097
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1094
1098
|
}
|
|
1095
|
-
function
|
|
1099
|
+
function et(e, t) {
|
|
1096
1100
|
for (; t < e.length; ) {
|
|
1097
1101
|
const n = e[t];
|
|
1098
1102
|
if (t += 1, n === 0)
|
|
@@ -1104,66 +1108,66 @@ function tt(e, t) {
|
|
|
1104
1108
|
function le(e) {
|
|
1105
1109
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1106
1110
|
}
|
|
1107
|
-
function
|
|
1108
|
-
if (!e || !
|
|
1111
|
+
function ve(e, t, n = null) {
|
|
1112
|
+
if (!e || !Pe(t, n)) {
|
|
1109
1113
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1110
1114
|
return;
|
|
1111
1115
|
}
|
|
1112
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", F(t) ||
|
|
1116
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", F(t) || Te(n) ? e.appendChild(to(t, n)) : kt(t) && e.appendChild(no(t));
|
|
1113
1117
|
}
|
|
1114
|
-
function
|
|
1118
|
+
function to(e, t) {
|
|
1115
1119
|
const n = document.createElement("div");
|
|
1116
1120
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1117
1121
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1118
1122
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1119
1123
|
const i = document.createElement("span");
|
|
1120
|
-
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(
|
|
1124
|
+
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(St(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1121
1125
|
}
|
|
1122
|
-
function
|
|
1126
|
+
function no(e) {
|
|
1123
1127
|
const t = document.createElement("div");
|
|
1124
1128
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1125
1129
|
const n = document.createElement("strong");
|
|
1126
1130
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1127
1131
|
const o = document.createElement("span");
|
|
1128
|
-
return o.textContent =
|
|
1132
|
+
return o.textContent = ao(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(St(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1129
1133
|
}
|
|
1130
|
-
function
|
|
1131
|
-
return e !== null && (F(e) ||
|
|
1134
|
+
function Pe(e, t) {
|
|
1135
|
+
return e !== null && (F(e) || kt(e) || Te(t));
|
|
1132
1136
|
}
|
|
1133
|
-
function
|
|
1134
|
-
return
|
|
1137
|
+
function tt(e, t, n) {
|
|
1138
|
+
return Pe(t, n) || oo(t) ? !0 : !Pe(e, n);
|
|
1135
1139
|
}
|
|
1136
|
-
function
|
|
1140
|
+
function oo(e) {
|
|
1137
1141
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || F(e));
|
|
1138
1142
|
}
|
|
1139
1143
|
function F(e) {
|
|
1140
1144
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1141
1145
|
}
|
|
1142
|
-
function
|
|
1146
|
+
function Te(e) {
|
|
1143
1147
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1144
1148
|
}
|
|
1145
|
-
function
|
|
1149
|
+
function kt(e) {
|
|
1146
1150
|
return !F(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1147
1151
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return e.creditsRemaining === null ? null : `${
|
|
1152
|
+
function ao(e) {
|
|
1153
|
+
return e.creditsRemaining === null ? null : `${io(e.creditsRemaining)} credits left`;
|
|
1150
1154
|
}
|
|
1151
|
-
function
|
|
1155
|
+
function io(e) {
|
|
1152
1156
|
return new Intl.NumberFormat("en-US", {
|
|
1153
1157
|
maximumFractionDigits: 0
|
|
1154
1158
|
}).format(Math.ceil(e));
|
|
1155
1159
|
}
|
|
1156
|
-
function
|
|
1160
|
+
function St(e, t, n) {
|
|
1157
1161
|
const o = document.createElement("div");
|
|
1158
|
-
return o.className = n, o.appendChild(
|
|
1162
|
+
return o.className = n, o.appendChild(nt(t, e.pricingUrl)), o.appendChild(nt("Earn credits", e.earnCreditsUrl)), o;
|
|
1159
1163
|
}
|
|
1160
|
-
function
|
|
1164
|
+
function nt(e, t) {
|
|
1161
1165
|
const n = document.createElement("button");
|
|
1162
1166
|
return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1163
1167
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1164
1168
|
}), n;
|
|
1165
1169
|
}
|
|
1166
|
-
function
|
|
1170
|
+
function ro(e) {
|
|
1167
1171
|
return new Promise((t, n) => {
|
|
1168
1172
|
const o = new FileReader();
|
|
1169
1173
|
o.addEventListener("load", () => {
|
|
@@ -1177,7 +1181,7 @@ function no(e) {
|
|
|
1177
1181
|
}), o.readAsArrayBuffer(e);
|
|
1178
1182
|
});
|
|
1179
1183
|
}
|
|
1180
|
-
function
|
|
1184
|
+
function lo(e) {
|
|
1181
1185
|
return new Promise((t, n) => {
|
|
1182
1186
|
const o = new FileReader();
|
|
1183
1187
|
o.addEventListener("load", () => {
|
|
@@ -1191,89 +1195,89 @@ function oo(e) {
|
|
|
1191
1195
|
}), o.readAsDataURL(e);
|
|
1192
1196
|
});
|
|
1193
1197
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const g = [...o.messages],
|
|
1196
|
-
e.replaceChildren(),
|
|
1197
|
-
const b =
|
|
1198
|
-
if (n.hidden = !b,
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1198
|
+
function po(e, t, n, o, a, i, l, p, s) {
|
|
1199
|
+
const g = [...o.messages], u = g.filter((h) => !wo(h));
|
|
1200
|
+
e.replaceChildren(), Pt(t, o.isThinking);
|
|
1201
|
+
const b = u.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
1202
|
+
if (n.hidden = !b, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
1203
|
+
const h = document.createElement("div");
|
|
1204
|
+
h.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1201
1205
|
const _ = document.createElement("img");
|
|
1202
|
-
_.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", _.src = l(), _.alt = "", _.setAttribute("aria-hidden", "true"),
|
|
1206
|
+
_.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", _.src = l(), _.alt = "", _.setAttribute("aria-hidden", "true"), h.appendChild(_), h.appendChild(xt());
|
|
1203
1207
|
const k = document.createElement("div");
|
|
1204
1208
|
k.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true");
|
|
1205
|
-
for (const
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
p(
|
|
1209
|
-
}), k.appendChild(
|
|
1209
|
+
for (const y of o.starterPrompts) {
|
|
1210
|
+
const v = document.createElement("button");
|
|
1211
|
+
v.type = "button", v.className = "pluno-pa-widget__starter-prompt", v.textContent = `"${y}"`, v.addEventListener("click", () => {
|
|
1212
|
+
p(y);
|
|
1213
|
+
}), k.appendChild(v);
|
|
1210
1214
|
}
|
|
1211
|
-
|
|
1215
|
+
h.appendChild(k), e.appendChild(h);
|
|
1212
1216
|
return;
|
|
1213
1217
|
}
|
|
1214
1218
|
let w = null, x = null, C = [];
|
|
1215
|
-
const
|
|
1219
|
+
const m = () => {
|
|
1216
1220
|
if (C.length === 0)
|
|
1217
1221
|
return !1;
|
|
1218
|
-
const
|
|
1219
|
-
return e.appendChild(
|
|
1222
|
+
const h = _o(C, a, i, l());
|
|
1223
|
+
return e.appendChild(h), w = null, x = h, C = [], !0;
|
|
1220
1224
|
};
|
|
1221
|
-
for (let
|
|
1222
|
-
const _ =
|
|
1225
|
+
for (let h = 0; h < u.length; h += 1) {
|
|
1226
|
+
const _ = u[h];
|
|
1223
1227
|
if (_.role === "tool") {
|
|
1224
1228
|
C.push(_);
|
|
1225
1229
|
continue;
|
|
1226
1230
|
}
|
|
1227
1231
|
if (_.role === "system")
|
|
1228
1232
|
continue;
|
|
1229
|
-
const k =
|
|
1233
|
+
const k = m(), y = at(_.content);
|
|
1230
1234
|
if (_.role === "assistant" && !k) {
|
|
1231
|
-
const ne =
|
|
1235
|
+
const ne = Ae(l());
|
|
1232
1236
|
e.appendChild(ne), w = null, x = ne;
|
|
1233
1237
|
}
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
+
const v = document.createElement("div");
|
|
1239
|
+
v.className = `pluno-pa-widget__message pluno-pa-widget__message--${_.role}`, _.role === "assistant" ? it(v, y) : v.textContent = y, _.role === "user" && _.attachments?.length && v.appendChild(co(_.attachments));
|
|
1240
|
+
const D = document.createElement("div");
|
|
1241
|
+
D.className = "pluno-pa-widget__message-actions", D.appendChild(ot(y)), v.appendChild(D), e.appendChild(v), w = v, x = null;
|
|
1238
1242
|
}
|
|
1239
|
-
const f =
|
|
1243
|
+
const f = m();
|
|
1240
1244
|
if (o.assistantDraft) {
|
|
1241
1245
|
if (!f) {
|
|
1242
|
-
const
|
|
1243
|
-
e.appendChild(
|
|
1246
|
+
const y = Ae(l());
|
|
1247
|
+
e.appendChild(y), w = null, x = y;
|
|
1244
1248
|
}
|
|
1245
|
-
const
|
|
1246
|
-
_.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1249
|
+
const h = at(o.assistantDraft), _ = document.createElement("div");
|
|
1250
|
+
_.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", it(_, h);
|
|
1247
1251
|
const k = document.createElement("div");
|
|
1248
|
-
k.className = "pluno-pa-widget__message-actions", k.appendChild(
|
|
1252
|
+
k.className = "pluno-pa-widget__message-actions", k.appendChild(ot(h)), _.appendChild(k), e.appendChild(_), w = _, x = null;
|
|
1249
1253
|
}
|
|
1250
1254
|
if (o.isThinking && !o.assistantDraft)
|
|
1251
1255
|
if (f) {
|
|
1252
|
-
const
|
|
1253
|
-
e.appendChild(
|
|
1256
|
+
const h = Lt();
|
|
1257
|
+
e.appendChild(h), w = null, x = h;
|
|
1254
1258
|
} else {
|
|
1255
|
-
const
|
|
1256
|
-
e.appendChild(
|
|
1259
|
+
const h = xo(l());
|
|
1260
|
+
e.appendChild(h), w = null, x = h;
|
|
1257
1261
|
}
|
|
1258
1262
|
if (o.lastError) {
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1263
|
+
const h = document.createElement("div");
|
|
1264
|
+
h.className = "pluno-pa-widget__error", h.textContent = o.lastError, e.appendChild(h), w = h, x = null;
|
|
1261
1265
|
}
|
|
1262
|
-
const
|
|
1263
|
-
if (s &&
|
|
1264
|
-
const
|
|
1265
|
-
isDrafting: s.draftingCandidateId ===
|
|
1266
|
+
const d = s && !o.isThinking ? Xt(g) : null;
|
|
1267
|
+
if (s && d && !s.dismissedCandidateIds.has(d.id)) {
|
|
1268
|
+
const h = uo(d, {
|
|
1269
|
+
isDrafting: s.draftingCandidateId === d.id,
|
|
1266
1270
|
error: s.error,
|
|
1267
1271
|
onDraft: s.onDraft,
|
|
1268
1272
|
onDismiss: s.onDismiss,
|
|
1269
1273
|
onDisable: s.onDisable
|
|
1270
1274
|
});
|
|
1271
|
-
e.appendChild(
|
|
1275
|
+
e.appendChild(h), s.onSeen(d), w = null, x = h;
|
|
1272
1276
|
}
|
|
1273
1277
|
w?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.scrollTop = e.scrollHeight;
|
|
1274
1278
|
}
|
|
1275
|
-
function
|
|
1276
|
-
e.replaceChildren(),
|
|
1279
|
+
function so(e, t, n, o, a, i) {
|
|
1280
|
+
e.replaceChildren(), Pt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1277
1281
|
const l = document.createElement("div");
|
|
1278
1282
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1279
1283
|
const p = document.createElement("img");
|
|
@@ -1283,20 +1287,20 @@ function io(e, t, n, o, a, i) {
|
|
|
1283
1287
|
const g = document.createElement("button");
|
|
1284
1288
|
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => i?.()), l.appendChild(g), e.appendChild(l);
|
|
1285
1289
|
}
|
|
1286
|
-
function
|
|
1290
|
+
function co(e) {
|
|
1287
1291
|
const t = document.createElement("div");
|
|
1288
1292
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1289
1293
|
for (const n of e)
|
|
1290
|
-
t.appendChild(
|
|
1294
|
+
t.appendChild(Yn(n));
|
|
1291
1295
|
return t;
|
|
1292
1296
|
}
|
|
1293
|
-
function
|
|
1297
|
+
function ot(e) {
|
|
1294
1298
|
const t = document.createElement("button");
|
|
1295
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1299
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Vn()), t.addEventListener("click", (n) => {
|
|
1296
1300
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1297
1301
|
}), t;
|
|
1298
1302
|
}
|
|
1299
|
-
function
|
|
1303
|
+
function uo(e, t) {
|
|
1300
1304
|
const n = document.createElement("article");
|
|
1301
1305
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1302
1306
|
const o = document.createElement("div");
|
|
@@ -1307,8 +1311,8 @@ function lo(e, t) {
|
|
|
1307
1311
|
i.textContent = "Share this win?", a.appendChild(i);
|
|
1308
1312
|
const l = document.createElement("span");
|
|
1309
1313
|
if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1314
|
+
const u = document.createElement("span");
|
|
1315
|
+
u.className = "pluno-pa-widget__share-prompt-error", u.textContent = t.error, a.appendChild(u);
|
|
1312
1316
|
}
|
|
1313
1317
|
o.appendChild(a);
|
|
1314
1318
|
const p = document.createElement("div");
|
|
@@ -1318,13 +1322,13 @@ function lo(e, t) {
|
|
|
1318
1322
|
const g = document.createElement("button");
|
|
1319
1323
|
if (g.type = "button", g.disabled = t.isDrafting, g.addEventListener("click", () => {
|
|
1320
1324
|
t.onDraft(e);
|
|
1321
|
-
}), t.isDrafting ? (g.appendChild(
|
|
1325
|
+
}), t.isDrafting ? (g.appendChild(Ne()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
|
|
1322
1326
|
p.appendChild(s);
|
|
1323
1327
|
else {
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1328
|
+
const u = document.createElement("button");
|
|
1329
|
+
u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
|
|
1326
1330
|
t.onDismiss(e);
|
|
1327
|
-
}), s.appendChild(
|
|
1331
|
+
}), s.appendChild(u), p.appendChild(s);
|
|
1328
1332
|
const b = document.createElement("button");
|
|
1329
1333
|
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1330
1334
|
t.onDisable(e);
|
|
@@ -1332,10 +1336,10 @@ function lo(e, t) {
|
|
|
1332
1336
|
}
|
|
1333
1337
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1334
1338
|
}
|
|
1335
|
-
function
|
|
1339
|
+
function go(e, t) {
|
|
1336
1340
|
const n = document.createElement("div");
|
|
1337
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1338
|
-
|
|
1341
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (f) => {
|
|
1342
|
+
f.target === n && t.onClose();
|
|
1339
1343
|
});
|
|
1340
1344
|
const o = document.createElement("section");
|
|
1341
1345
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
@@ -1349,49 +1353,51 @@ function po(e, t) {
|
|
|
1349
1353
|
s.className = "pluno-pa-widget__share-dialog-step";
|
|
1350
1354
|
const g = document.createElement("div");
|
|
1351
1355
|
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
const b =
|
|
1356
|
+
const u = document.createElement("strong");
|
|
1357
|
+
u.textContent = "1) Copy Screenshot", g.appendChild(u);
|
|
1358
|
+
const b = ho("Copy Screenshot", async () => {
|
|
1355
1359
|
try {
|
|
1356
|
-
return await
|
|
1360
|
+
return await Zt(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1357
1361
|
} catch {
|
|
1358
1362
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1359
1363
|
}
|
|
1360
1364
|
});
|
|
1361
1365
|
if (g.appendChild(b), s.appendChild(g), e.screenshotDataUrl) {
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
+
const f = document.createElement("div");
|
|
1367
|
+
f.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1368
|
+
const d = document.createElement("img");
|
|
1369
|
+
d.src = e.screenshotDataUrl, d.alt = "Product page with Pluno open", f.appendChild(d), s.appendChild(f);
|
|
1366
1370
|
}
|
|
1367
1371
|
o.appendChild(s), o.appendChild(p);
|
|
1368
1372
|
const w = document.createElement("div");
|
|
1369
1373
|
w.className = "pluno-pa-widget__share-dialog-step";
|
|
1370
1374
|
const x = document.createElement("strong");
|
|
1371
1375
|
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", w.appendChild(x);
|
|
1372
|
-
const C = document.createElement("
|
|
1373
|
-
C.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1376
|
+
const C = document.createElement("p");
|
|
1377
|
+
C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", w.appendChild(C);
|
|
1378
|
+
const m = document.createElement("footer");
|
|
1379
|
+
m.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1380
|
+
for (const f of mo(e)) {
|
|
1381
|
+
const d = document.createElement("a");
|
|
1382
|
+
d.href = f.href, d.target = "_blank", d.rel = "noopener noreferrer", d.title = f.label, d.setAttribute("aria-label", `Open ${f.label}`), d.appendChild(fo(f.id)), m.appendChild(d);
|
|
1377
1383
|
}
|
|
1378
|
-
if (w.appendChild(
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1384
|
+
if (w.appendChild(m), o.appendChild(w), t.socialPostRewardsUrl) {
|
|
1385
|
+
const f = document.createElement("div");
|
|
1386
|
+
f.className = "pluno-pa-widget__share-dialog-step";
|
|
1387
|
+
const d = document.createElement("strong");
|
|
1388
|
+
d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!", f.appendChild(d);
|
|
1389
|
+
const h = document.createElement("a");
|
|
1390
|
+
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(bo()), f.appendChild(h), o.appendChild(f);
|
|
1385
1391
|
}
|
|
1386
1392
|
return n.appendChild(o), n;
|
|
1387
1393
|
}
|
|
1388
|
-
function
|
|
1394
|
+
function ho(e, t) {
|
|
1389
1395
|
const n = document.createElement("button");
|
|
1390
1396
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1391
1397
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1392
1398
|
}), n;
|
|
1393
1399
|
}
|
|
1394
|
-
function
|
|
1400
|
+
function mo(e) {
|
|
1395
1401
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1396
1402
|
return [
|
|
1397
1403
|
{
|
|
@@ -1411,7 +1417,7 @@ function co(e) {
|
|
|
1411
1417
|
}
|
|
1412
1418
|
];
|
|
1413
1419
|
}
|
|
1414
|
-
function
|
|
1420
|
+
function fo(e) {
|
|
1415
1421
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1416
1422
|
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" ? (P(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), P(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"), P(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), P(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"), P(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (P(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), P(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), P(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (P(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"), P(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"), P(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"), P(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);
|
|
1417
1423
|
}
|
|
@@ -1419,34 +1425,34 @@ function P(e, t, n) {
|
|
|
1419
1425
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1420
1426
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1421
1427
|
}
|
|
1422
|
-
function
|
|
1428
|
+
function bo() {
|
|
1423
1429
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1424
1430
|
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), P(e, "M14 5h5v5"), P(e, "M19 5l-8 8"), P(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1425
1431
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return e.role === "tool" && e.toolName ===
|
|
1432
|
+
function wo(e) {
|
|
1433
|
+
return e.role === "tool" && e.toolName === ut;
|
|
1428
1434
|
}
|
|
1429
|
-
function
|
|
1435
|
+
function at(e) {
|
|
1430
1436
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1431
1437
|
}
|
|
1432
|
-
function
|
|
1438
|
+
function _o(e, t, n, o) {
|
|
1433
1439
|
const a = document.createElement("article");
|
|
1434
1440
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1435
1441
|
const i = document.createElement("img");
|
|
1436
1442
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1437
|
-
const l = document.createElement("details"), p =
|
|
1443
|
+
const l = document.createElement("details"), p = yo(e);
|
|
1438
1444
|
l.open = t.has(p), l.addEventListener("toggle", () => {
|
|
1439
1445
|
l.open ? t.add(p) : t.delete(p), n();
|
|
1440
1446
|
});
|
|
1441
1447
|
const s = document.createElement("summary");
|
|
1442
|
-
s.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && s.appendChild(
|
|
1443
|
-
const
|
|
1444
|
-
if (
|
|
1448
|
+
s.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && s.appendChild(Ne());
|
|
1449
|
+
const u = document.createElement("span");
|
|
1450
|
+
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", s.appendChild(u), l.appendChild(s), e.length > 0) {
|
|
1445
1451
|
const b = document.createElement("div");
|
|
1446
1452
|
b.className = "pluno-pa-widget__tool-lines";
|
|
1447
1453
|
for (const w of e) {
|
|
1448
1454
|
const x = document.createElement("div");
|
|
1449
|
-
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(
|
|
1455
|
+
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ne());
|
|
1450
1456
|
const C = document.createElement("span");
|
|
1451
1457
|
C.textContent = w.content || "Run tool", x.appendChild(C), b.appendChild(x);
|
|
1452
1458
|
}
|
|
@@ -1454,17 +1460,17 @@ function mo(e, t, n, o) {
|
|
|
1454
1460
|
}
|
|
1455
1461
|
return a.appendChild(l), a;
|
|
1456
1462
|
}
|
|
1457
|
-
function
|
|
1463
|
+
function Ae(e) {
|
|
1458
1464
|
const t = document.createElement("article");
|
|
1459
1465
|
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1460
1466
|
const n = document.createElement("img");
|
|
1461
1467
|
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), t.appendChild(n), t;
|
|
1462
1468
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const t =
|
|
1465
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1469
|
+
function xo(e) {
|
|
1470
|
+
const t = Ae(e);
|
|
1471
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Lt()), t;
|
|
1466
1472
|
}
|
|
1467
|
-
function
|
|
1473
|
+
function Lt() {
|
|
1468
1474
|
const e = document.createElement("div");
|
|
1469
1475
|
e.className = "pluno-pa-widget__status";
|
|
1470
1476
|
const t = document.createElement("span");
|
|
@@ -1472,17 +1478,17 @@ function kt() {
|
|
|
1472
1478
|
const n = document.createElement("span");
|
|
1473
1479
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1474
1480
|
}
|
|
1475
|
-
function
|
|
1481
|
+
function yo(e) {
|
|
1476
1482
|
return `tools:${e.map((t) => t.id).join("|")}`;
|
|
1477
1483
|
}
|
|
1478
|
-
function
|
|
1484
|
+
function Ne() {
|
|
1479
1485
|
const e = document.createElement("span");
|
|
1480
1486
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1481
1487
|
}
|
|
1482
|
-
function
|
|
1483
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1488
|
+
function Pt(e, t) {
|
|
1489
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Wn() : Ct());
|
|
1484
1490
|
}
|
|
1485
|
-
function
|
|
1491
|
+
function it(e, t) {
|
|
1486
1492
|
const n = t.replace(/\r\n/g, `
|
|
1487
1493
|
`).split(`
|
|
1488
1494
|
`);
|
|
@@ -1498,9 +1504,9 @@ function rt(e, t) {
|
|
|
1498
1504
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1499
1505
|
g.push(n[o]), o += 1;
|
|
1500
1506
|
o += o < n.length ? 1 : 0;
|
|
1501
|
-
const
|
|
1507
|
+
const u = document.createElement("pre"), b = document.createElement("code");
|
|
1502
1508
|
b.textContent = g.join(`
|
|
1503
|
-
`),
|
|
1509
|
+
`), u.appendChild(b), e.appendChild(u);
|
|
1504
1510
|
continue;
|
|
1505
1511
|
}
|
|
1506
1512
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
@@ -1512,8 +1518,8 @@ function rt(e, t) {
|
|
|
1512
1518
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1513
1519
|
const g = document.createElement("ul");
|
|
1514
1520
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1515
|
-
const
|
|
1516
|
-
pe(
|
|
1521
|
+
const u = document.createElement("li");
|
|
1522
|
+
pe(u, n[o].replace(/^\s*[-*+]\s+/, "")), g.appendChild(u), o += 1;
|
|
1517
1523
|
}
|
|
1518
1524
|
e.appendChild(g);
|
|
1519
1525
|
continue;
|
|
@@ -1521,8 +1527,8 @@ function rt(e, t) {
|
|
|
1521
1527
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1522
1528
|
const g = document.createElement("ol");
|
|
1523
1529
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1524
|
-
const
|
|
1525
|
-
pe(
|
|
1530
|
+
const u = document.createElement("li");
|
|
1531
|
+
pe(u, n[o].replace(/^\s*\d+\.\s+/, "")), g.appendChild(u), o += 1;
|
|
1526
1532
|
}
|
|
1527
1533
|
e.appendChild(g);
|
|
1528
1534
|
continue;
|
|
@@ -1531,8 +1537,8 @@ function rt(e, t) {
|
|
|
1531
1537
|
for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
|
|
1532
1538
|
p.push(n[o]), o += 1;
|
|
1533
1539
|
const s = document.createElement("p");
|
|
1534
|
-
p.forEach((g,
|
|
1535
|
-
|
|
1540
|
+
p.forEach((g, u) => {
|
|
1541
|
+
u > 0 && s.appendChild(document.createElement("br")), pe(s, g);
|
|
1536
1542
|
}), e.appendChild(s);
|
|
1537
1543
|
}
|
|
1538
1544
|
}
|
|
@@ -1554,7 +1560,7 @@ function pe(e, t) {
|
|
|
1554
1560
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1555
1561
|
} else {
|
|
1556
1562
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1557
|
-
if (p &&
|
|
1563
|
+
if (p && vo(p[2])) {
|
|
1558
1564
|
const s = document.createElement("a");
|
|
1559
1565
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
|
|
1560
1566
|
} else
|
|
@@ -1564,7 +1570,7 @@ function pe(e, t) {
|
|
|
1564
1570
|
}
|
|
1565
1571
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1566
1572
|
}
|
|
1567
|
-
function
|
|
1573
|
+
function vo(e) {
|
|
1568
1574
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1569
1575
|
return !0;
|
|
1570
1576
|
try {
|
|
@@ -1574,11 +1580,10 @@ function wo(e) {
|
|
|
1574
1580
|
return !1;
|
|
1575
1581
|
}
|
|
1576
1582
|
}
|
|
1577
|
-
function
|
|
1578
|
-
if (e
|
|
1583
|
+
function rt(e, t) {
|
|
1584
|
+
if (Co(e))
|
|
1579
1585
|
return;
|
|
1580
|
-
const n =
|
|
1581
|
-
n.id = "pluno-pa-widget-styles", n.textContent = `
|
|
1586
|
+
const n = `
|
|
1582
1587
|
:host {
|
|
1583
1588
|
all: initial;
|
|
1584
1589
|
color-scheme: light;
|
|
@@ -1621,15 +1626,15 @@ function lt(e, t) {
|
|
|
1621
1626
|
--pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
|
|
1622
1627
|
--pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
|
|
1623
1628
|
--pluno-pa-launcher-height: 41px;
|
|
1624
|
-
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw -
|
|
1625
|
-
--pluno-pa-panel-height: min(clamp(680px, 76vh, 800px), calc(100vh -
|
|
1629
|
+
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
|
|
1630
|
+
--pluno-pa-panel-height: min(clamp(680px, 76vh, 800px), calc(100vh - 58px));
|
|
1626
1631
|
--pluno-pa-panel-offset-x: calc(var(--pluno-pa-launcher-width) - var(--pluno-pa-panel-width));
|
|
1627
1632
|
--pluno-pa-panel-offset-y: calc(var(--pluno-pa-launcher-height) - var(--pluno-pa-panel-height));
|
|
1628
1633
|
--pluno-pa-accent-soft: rgba(24, 24, 27, 0.12);
|
|
1629
1634
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1630
1635
|
position: fixed;
|
|
1631
1636
|
z-index: 2147483645;
|
|
1632
|
-
font-family: ${
|
|
1637
|
+
font-family: ${R.fontFamily};
|
|
1633
1638
|
font-size: 14px;
|
|
1634
1639
|
color: var(--pluno-pa-text);
|
|
1635
1640
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2331,7 +2336,7 @@ function lt(e, t) {
|
|
|
2331
2336
|
place-items: center;
|
|
2332
2337
|
padding: 18px;
|
|
2333
2338
|
background: rgba(24, 24, 27, 0.28);
|
|
2334
|
-
font-family: var(--pluno-pa-font, ${
|
|
2339
|
+
font-family: var(--pluno-pa-font, ${R.fontFamily});
|
|
2335
2340
|
color: var(--pluno-pa-text);
|
|
2336
2341
|
}
|
|
2337
2342
|
.pluno-pa-widget__share-dialog {
|
|
@@ -2444,6 +2449,12 @@ function lt(e, t) {
|
|
|
2444
2449
|
.pluno-pa-widget__share-dialog-status[hidden] {
|
|
2445
2450
|
display: none;
|
|
2446
2451
|
}
|
|
2452
|
+
.pluno-pa-widget__share-dialog-hint {
|
|
2453
|
+
margin: -2px 0 0;
|
|
2454
|
+
color: var(--pluno-pa-share-muted);
|
|
2455
|
+
font-size: 12px;
|
|
2456
|
+
line-height: 1.3;
|
|
2457
|
+
}
|
|
2447
2458
|
.pluno-pa-widget__share-dialog-copy {
|
|
2448
2459
|
display: inline-flex;
|
|
2449
2460
|
align-items: center;
|
|
@@ -2961,7 +2972,7 @@ function lt(e, t) {
|
|
|
2961
2972
|
right: 16px;
|
|
2962
2973
|
height: 36px;
|
|
2963
2974
|
z-index: 3;
|
|
2964
|
-
background-image: url('${
|
|
2975
|
+
background-image: url('${je}');
|
|
2965
2976
|
background-repeat: repeat-x;
|
|
2966
2977
|
background-size: 104px 36px;
|
|
2967
2978
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3208,7 +3219,7 @@ function lt(e, t) {
|
|
|
3208
3219
|
right: 12px;
|
|
3209
3220
|
height: 22px;
|
|
3210
3221
|
z-index: 1;
|
|
3211
|
-
background-image: url('${
|
|
3222
|
+
background-image: url('${je}');
|
|
3212
3223
|
background-repeat: repeat-x;
|
|
3213
3224
|
background-size: 62px 21.5px;
|
|
3214
3225
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3220,9 +3231,29 @@ function lt(e, t) {
|
|
|
3220
3231
|
.pluno-pa-widget--scribble .pluno-pa-widget__close svg {
|
|
3221
3232
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3222
3233
|
}
|
|
3223
|
-
|
|
3234
|
+
`;
|
|
3235
|
+
if (Eo(e, n))
|
|
3236
|
+
return;
|
|
3237
|
+
const o = e.ownerDocument.createElement("style");
|
|
3238
|
+
o.id = bt, o.textContent = n, e.appendChild(o), At(e);
|
|
3239
|
+
}
|
|
3240
|
+
function Co(e) {
|
|
3241
|
+
return e.getElementById(bt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(wt) === "true";
|
|
3242
|
+
}
|
|
3243
|
+
function At(e) {
|
|
3244
|
+
e.host instanceof HTMLElement && e.host.setAttribute(wt, "true");
|
|
3224
3245
|
}
|
|
3225
|
-
|
|
3246
|
+
function Eo(e, t) {
|
|
3247
|
+
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3248
|
+
return !1;
|
|
3249
|
+
try {
|
|
3250
|
+
const n = new CSSStyleSheet();
|
|
3251
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], At(e), !0;
|
|
3252
|
+
} catch {
|
|
3253
|
+
return !1;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
async function ko() {
|
|
3226
3257
|
return document.body ? document.body : await new Promise((e) => {
|
|
3227
3258
|
const t = new MutationObserver(() => {
|
|
3228
3259
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3230,49 +3261,49 @@ async function _o() {
|
|
|
3230
3261
|
t.observe(document.documentElement, { childList: !0 });
|
|
3231
3262
|
});
|
|
3232
3263
|
}
|
|
3233
|
-
function
|
|
3264
|
+
function Nt(e) {
|
|
3234
3265
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3235
3266
|
}
|
|
3236
|
-
function
|
|
3267
|
+
function So(e) {
|
|
3237
3268
|
try {
|
|
3238
|
-
const t = window.localStorage.getItem(
|
|
3269
|
+
const t = window.localStorage.getItem(Nt(e));
|
|
3239
3270
|
if (!t)
|
|
3240
|
-
return
|
|
3271
|
+
return lt();
|
|
3241
3272
|
const n = JSON.parse(t);
|
|
3242
3273
|
return {
|
|
3243
3274
|
isOpen: n.isOpen === !0,
|
|
3244
3275
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3245
3276
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3246
|
-
launcherPosition:
|
|
3247
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3277
|
+
launcherPosition: No(n.launcherPosition) ? n.launcherPosition : null,
|
|
3278
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-gt) : [],
|
|
3248
3279
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3249
3280
|
};
|
|
3250
3281
|
} catch {
|
|
3251
|
-
return
|
|
3282
|
+
return lt();
|
|
3252
3283
|
}
|
|
3253
3284
|
}
|
|
3254
|
-
async function
|
|
3285
|
+
async function Lo(e) {
|
|
3255
3286
|
if (e.loadSharePromptsDisabled)
|
|
3256
3287
|
return e.loadSharePromptsDisabled();
|
|
3257
3288
|
try {
|
|
3258
|
-
return window.localStorage.getItem(
|
|
3289
|
+
return window.localStorage.getItem(ht) === "true";
|
|
3259
3290
|
} catch {
|
|
3260
3291
|
return !1;
|
|
3261
3292
|
}
|
|
3262
3293
|
}
|
|
3263
|
-
function
|
|
3294
|
+
function Po(e, t) {
|
|
3264
3295
|
if (e.persistSharePromptsDisabled) {
|
|
3265
3296
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3266
3297
|
});
|
|
3267
3298
|
return;
|
|
3268
3299
|
}
|
|
3269
3300
|
try {
|
|
3270
|
-
t && window.localStorage.setItem(
|
|
3301
|
+
t && window.localStorage.setItem(ht, "true");
|
|
3271
3302
|
} catch {
|
|
3272
3303
|
return;
|
|
3273
3304
|
}
|
|
3274
3305
|
}
|
|
3275
|
-
function
|
|
3306
|
+
function lt() {
|
|
3276
3307
|
return {
|
|
3277
3308
|
isOpen: !1,
|
|
3278
3309
|
composerValue: "",
|
|
@@ -3282,41 +3313,41 @@ function pt() {
|
|
|
3282
3313
|
sharePromptsDisabled: !1
|
|
3283
3314
|
};
|
|
3284
3315
|
}
|
|
3285
|
-
function
|
|
3316
|
+
function Ao(e, t) {
|
|
3286
3317
|
try {
|
|
3287
|
-
window.localStorage.setItem(
|
|
3318
|
+
window.localStorage.setItem(Nt(e), JSON.stringify(t));
|
|
3288
3319
|
} catch {
|
|
3289
3320
|
return;
|
|
3290
3321
|
}
|
|
3291
3322
|
}
|
|
3292
|
-
function
|
|
3323
|
+
function No(e) {
|
|
3293
3324
|
if (!e || typeof e != "object")
|
|
3294
3325
|
return !1;
|
|
3295
3326
|
const t = e;
|
|
3296
3327
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3297
3328
|
}
|
|
3298
|
-
const
|
|
3299
|
-
function
|
|
3329
|
+
const pt = /* @__PURE__ */ new WeakSet();
|
|
3330
|
+
function To(e) {
|
|
3300
3331
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3301
3332
|
}
|
|
3302
|
-
function
|
|
3333
|
+
function st(e) {
|
|
3303
3334
|
const t = e.pathname.split("/");
|
|
3304
3335
|
return t[t.length - 1] ?? "";
|
|
3305
3336
|
}
|
|
3306
|
-
function
|
|
3337
|
+
function Do(e, t) {
|
|
3307
3338
|
const n = new URL(e.src, document.baseURI);
|
|
3308
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3339
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : st(n) === st(t);
|
|
3309
3340
|
}
|
|
3310
3341
|
class O extends EventTarget {
|
|
3311
3342
|
constructor(t, n) {
|
|
3312
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3343
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(nn, () => {
|
|
3313
3344
|
this.readyState = O.OPEN, this.dispatchEvent(new Event("open"));
|
|
3314
|
-
}), this.addPreviewListener(
|
|
3345
|
+
}), this.addPreviewListener(on, (o) => {
|
|
3315
3346
|
const a = o;
|
|
3316
3347
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3317
|
-
}), this.addPreviewListener(
|
|
3348
|
+
}), this.addPreviewListener(an, () => {
|
|
3318
3349
|
this.readyState = O.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3319
|
-
}), this.addPreviewListener(
|
|
3350
|
+
}), this.addPreviewListener(rn, (o) => {
|
|
3320
3351
|
const a = o;
|
|
3321
3352
|
this.readyState = O.CLOSED, this.dispatchEvent(
|
|
3322
3353
|
new CloseEvent("close", {
|
|
@@ -3326,7 +3357,7 @@ class O extends EventTarget {
|
|
|
3326
3357
|
})
|
|
3327
3358
|
), this.cleanup();
|
|
3328
3359
|
}), window.dispatchEvent(
|
|
3329
|
-
new CustomEvent(se(
|
|
3360
|
+
new CustomEvent(se(Qt, this.channelId), {
|
|
3330
3361
|
detail: { socketId: this.socketId, url: t }
|
|
3331
3362
|
})
|
|
3332
3363
|
);
|
|
@@ -3342,20 +3373,20 @@ class O extends EventTarget {
|
|
|
3342
3373
|
binaryType = "blob";
|
|
3343
3374
|
bufferedAmount = 0;
|
|
3344
3375
|
readyState = O.CONNECTING;
|
|
3345
|
-
socketId =
|
|
3376
|
+
socketId = Io();
|
|
3346
3377
|
listeners = /* @__PURE__ */ new Map();
|
|
3347
3378
|
send(t) {
|
|
3348
3379
|
if (this.readyState !== O.OPEN)
|
|
3349
3380
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3350
3381
|
window.dispatchEvent(
|
|
3351
|
-
new CustomEvent(se(
|
|
3382
|
+
new CustomEvent(se(en, this.channelId), {
|
|
3352
3383
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3353
3384
|
})
|
|
3354
3385
|
);
|
|
3355
3386
|
}
|
|
3356
3387
|
close(t, n) {
|
|
3357
3388
|
this.readyState !== O.CLOSED && (this.readyState = O.CLOSING, window.dispatchEvent(
|
|
3358
|
-
new CustomEvent(se(
|
|
3389
|
+
new CustomEvent(se(tn, this.channelId), {
|
|
3359
3390
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3360
3391
|
})
|
|
3361
3392
|
), this.cleanup());
|
|
@@ -3372,36 +3403,36 @@ class O extends EventTarget {
|
|
|
3372
3403
|
this.listeners.clear();
|
|
3373
3404
|
}
|
|
3374
3405
|
}
|
|
3375
|
-
function
|
|
3376
|
-
const e = window.sessionStorage.getItem(
|
|
3406
|
+
function Io() {
|
|
3407
|
+
const e = window.sessionStorage.getItem(qe);
|
|
3377
3408
|
if (e)
|
|
3378
3409
|
return e;
|
|
3379
3410
|
const t = crypto.randomUUID();
|
|
3380
|
-
return window.sessionStorage.setItem(
|
|
3411
|
+
return window.sessionStorage.setItem(qe, t), t;
|
|
3381
3412
|
}
|
|
3382
3413
|
function se(e, t) {
|
|
3383
3414
|
return `${e}:${t}`;
|
|
3384
3415
|
}
|
|
3385
|
-
function
|
|
3416
|
+
function Mo(e) {
|
|
3386
3417
|
const t = document.currentScript;
|
|
3387
3418
|
if (t instanceof HTMLScriptElement)
|
|
3388
3419
|
return [t];
|
|
3389
3420
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3390
3421
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3391
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3422
|
+
(a) => a instanceof HTMLScriptElement && To(a) && Do(a, o)
|
|
3392
3423
|
);
|
|
3393
3424
|
}
|
|
3394
|
-
function
|
|
3395
|
-
for (const t of
|
|
3396
|
-
if (
|
|
3425
|
+
function Ro(e) {
|
|
3426
|
+
for (const t of Mo(e)) {
|
|
3427
|
+
if (pt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3397
3428
|
continue;
|
|
3398
|
-
|
|
3429
|
+
pt.add(t);
|
|
3399
3430
|
const n = t.dataset.plunoPreviewChannel;
|
|
3400
|
-
|
|
3431
|
+
Sn({
|
|
3401
3432
|
token: t.dataset.plunoToken,
|
|
3402
3433
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3403
3434
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3404
|
-
webSocketFactory: n ?
|
|
3435
|
+
webSocketFactory: n ? kn(n) : void 0,
|
|
3405
3436
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3406
3437
|
accentColor: t.dataset.plunoAccentColor,
|
|
3407
3438
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3413,8 +3444,8 @@ function Ao(e) {
|
|
|
3413
3444
|
});
|
|
3414
3445
|
}
|
|
3415
3446
|
}
|
|
3416
|
-
|
|
3447
|
+
Ro(import.meta.url);
|
|
3417
3448
|
export {
|
|
3418
|
-
|
|
3419
|
-
|
|
3449
|
+
kn as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3450
|
+
Sn as mountPlunoProductAgentWidget
|
|
3420
3451
|
};
|